@lucida-analytics/browser 0.0.0-stage → 0.1.1
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.
- package/LICENSE +202 -0
- package/README.md +232 -2
- package/dist/autocapture.d.ts +78 -0
- package/dist/autocapture.js +1 -0
- package/dist/banner-2TSKJ4WK.js +1 -0
- package/dist/chunk-32K5P5GN.js +1 -0
- package/dist/chunk-AWIQCFGN.js +1 -0
- package/dist/chunk-FUE3SDQU.js +1 -0
- package/dist/chunk-NIDQQHZJ.js +1 -0
- package/dist/chunk-O4W7SZ2X.js +1 -0
- package/dist/client-BUpBXyOh.d.ts +8 -0
- package/dist/consent.d.ts +95 -0
- package/dist/consent.js +1 -0
- package/dist/core.d.ts +9 -0
- package/dist/core.js +3 -0
- package/dist/correlate.d.ts +15 -0
- package/dist/correlate.js +1 -0
- package/dist/early-access.d.ts +12 -0
- package/dist/early-access.js +1 -0
- package/dist/experiments.d.ts +199 -0
- package/dist/experiments.js +1 -0
- package/dist/flags.d.ts +13 -0
- package/dist/flags.js +3 -0
- package/dist/forms.d.ts +13 -0
- package/dist/forms.js +1 -0
- package/dist/guides.d.ts +1196 -0
- package/dist/guides.js +1 -0
- package/dist/heatmaps.d.ts +19 -0
- package/dist/heatmaps.js +1 -0
- package/dist/host-headers.d.ts +16 -0
- package/dist/host-headers.js +1 -0
- package/dist/index.d.ts +89 -0
- package/dist/index.js +3 -0
- package/dist/inspector.d.ts +13 -0
- package/dist/inspector.js +1 -0
- package/dist/lucida.js +3 -0
- package/dist/modules-FANMZRDJ.js +1 -0
- package/dist/persistent-SLVINN5A.js +1 -0
- package/dist/recommendations.d.ts +2 -0
- package/dist/recommendations.js +1 -0
- package/dist/recorder-3YIZ6OKD.js +78 -0
- package/dist/replay.d.ts +18 -0
- package/dist/replay.js +1 -0
- package/dist/static/v0/autocapture.js +1 -0
- package/dist/static/v0/banner-2TSKJ4WK.js +1 -0
- package/dist/static/v0/chunk-32K5P5GN.js +1 -0
- package/dist/static/v0/chunk-AWIQCFGN.js +1 -0
- package/dist/static/v0/chunk-FUE3SDQU.js +1 -0
- package/dist/static/v0/chunk-NIDQQHZJ.js +1 -0
- package/dist/static/v0/chunk-O4W7SZ2X.js +1 -0
- package/dist/static/v0/consent.js +1 -0
- package/dist/static/v0/core.js +3 -0
- package/dist/static/v0/correlate.js +1 -0
- package/dist/static/v0/early-access.js +1 -0
- package/dist/static/v0/experiments.js +1 -0
- package/dist/static/v0/flags.js +3 -0
- package/dist/static/v0/forms.js +1 -0
- package/dist/static/v0/guides.js +1 -0
- package/dist/static/v0/heatmaps.js +1 -0
- package/dist/static/v0/host-headers.js +1 -0
- package/dist/static/v0/index.js +3 -0
- package/dist/static/v0/inspector.js +1 -0
- package/dist/static/v0/lucida.js +3 -0
- package/dist/static/v0/modules-FANMZRDJ.js +1 -0
- package/dist/static/v0/persistent-SLVINN5A.js +1 -0
- package/dist/static/v0/recommendations.js +1 -0
- package/dist/static/v0/recorder-3YIZ6OKD.js +78 -0
- package/dist/static/v0/replay.js +1 -0
- package/dist/static/v0/toolbar.js +4 -0
- package/dist/static/v0/validation-HGJXZ553.js +1 -0
- package/dist/static/v0/webmcp.js +1 -0
- package/dist/static/v0.1.1/autocapture.js +1 -0
- package/dist/static/v0.1.1/banner-2TSKJ4WK.js +1 -0
- package/dist/static/v0.1.1/chunk-32K5P5GN.js +1 -0
- package/dist/static/v0.1.1/chunk-AWIQCFGN.js +1 -0
- package/dist/static/v0.1.1/chunk-FUE3SDQU.js +1 -0
- package/dist/static/v0.1.1/chunk-NIDQQHZJ.js +1 -0
- package/dist/static/v0.1.1/chunk-O4W7SZ2X.js +1 -0
- package/dist/static/v0.1.1/consent.js +1 -0
- package/dist/static/v0.1.1/core.js +3 -0
- package/dist/static/v0.1.1/correlate.js +1 -0
- package/dist/static/v0.1.1/early-access.js +1 -0
- package/dist/static/v0.1.1/experiments.js +1 -0
- package/dist/static/v0.1.1/flags.js +3 -0
- package/dist/static/v0.1.1/forms.js +1 -0
- package/dist/static/v0.1.1/guides.js +1 -0
- package/dist/static/v0.1.1/heatmaps.js +1 -0
- package/dist/static/v0.1.1/host-headers.js +1 -0
- package/dist/static/v0.1.1/index.js +3 -0
- package/dist/static/v0.1.1/inspector.js +1 -0
- package/dist/static/v0.1.1/integrity.json +30 -0
- package/dist/static/v0.1.1/lucida.js +3 -0
- package/dist/static/v0.1.1/modules-FANMZRDJ.js +1 -0
- package/dist/static/v0.1.1/persistent-SLVINN5A.js +1 -0
- package/dist/static/v0.1.1/recommendations.js +1 -0
- package/dist/static/v0.1.1/recorder-3YIZ6OKD.js +78 -0
- package/dist/static/v0.1.1/replay.js +1 -0
- package/dist/static/v0.1.1/toolbar.js +4 -0
- package/dist/static/v0.1.1/validation-HGJXZ553.js +1 -0
- package/dist/static/v0.1.1/webmcp.js +1 -0
- package/dist/toolbar.d.ts +193 -0
- package/dist/toolbar.js +4 -0
- package/dist/types-BtvrrgrR.d.ts +932 -0
- package/dist/types-CLEZS45j.d.ts +1109 -0
- package/dist/validation-HGJXZ553.js +1 -0
- package/dist/webmcp.d.ts +21 -0
- package/dist/webmcp.js +1 -0
- package/package.json +104 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var b=!1,E=()=>{b=!1},C=n=>{try{let t=new URL(n);return t.protocol==="https:"?t.href:null}catch{return null}},w=new Set(["tour","checklist","modal","slideout"]),k=new Set(["announcement","banner"]);function e(n,t){let s=document.createElement(n);return t!==void 0&&(s.textContent=t),s}function v(n,t){return n.guide_ids?.length?n.guide_ids.flatMap(s=>t.find(o=>o.id===s)??[]):t.filter(s=>w.has(s.kind))}function M(n,t){if(!n.search_url||!t.trim())return null;try{let s=new URL(n.search_url.replace("{q}",encodeURIComponent(t.trim())));return s.protocol==="https:"?s.href:null}catch{return null}}function L(n,t){let s=e("section");if(s.setAttribute("aria-label",n.title??n.module??"Module"),s.append(e("h2",n.title??"")),n.body&&s.append(e("p",n.body)),n.module==="guides"){let o=e("ul");for(let l of v(n,t.library)){let i=e("button",l.name);i.type="button",i.onclick=()=>(t.opened(),t.launch(l.id));let r=e("li");r.append(i),o.append(r)}s.append(o.childElementCount?o:e("p","No guides yet."))}else if(n.module==="announcements"){let o=t.library.filter(i=>k.has(i.kind)&&i.steps[0]).sort((i,r)=>(r.published_at??"").localeCompare(i.published_at??"")),l=e("ul");for(let i of o.slice(0,10)){let r=e("li");r.append(e("strong",i.steps[0].title??i.name)),i.steps[0].body&&r.append(e("p",i.steps[0].body)),l.append(r)}s.append(l.childElementCount?l:e("p","Nothing new."))}else if(n.module==="search"){let o=e("form");o.setAttribute("role","search");let l=e("label","Search help"),i=e("input");i.type="search",l.append(i);let r=e("button","Search");r.type="submit";let f=e("ul");o.append(l,r,f);let p=e("div");p.setAttribute("aria-live","polite"),o.onsubmit=m=>{m.preventDefault(),t.opened();let h=i.value.trim(),u=h.toLowerCase();f.replaceChildren();let a=t.library.filter(c=>w.has(c.kind)&&u&&(c.name+" "+c.steps.map(g=>`${g.title??""} ${g.body??""}`).join(" ")).toLowerCase().includes(u)).slice(0,5);for(let c of a)f.append(y(c,t));p.replaceChildren(),t.assist&&!b&&h?A(h,a.length,t,p):t.assist?.searched({query:h,results:a.length,answered:!1});let d=M(n,i.value);d&&window.open(d,"_blank","noopener,noreferrer")},o.append(p),s.append(o)}return s}function y(n,t){let s=e("button",n.name);s.type="button",s.onclick=()=>t.launch(n.id);let o=e("li");return o.append(s),o}async function A(n,t,s,o){let l=s.assist;o.textContent="Finding an answer...";let i=await l.ask(n.slice(0,500));if(o.replaceChildren(),i==="unavailable"&&(b=!0),!i||i==="unavailable")return l.searched({query:n,results:t,answered:!1});let r=!!i.answer.trim();if(l.searched({query:n,results:t,answered:r}),!r)return;o.append(e("h3","Answer"),e("p",i.answer));let f=e("ul");for(let u of(i.citations??[]).slice(0,5)){let a=C(u.url);if(!a)continue;let d=e("a",u.title||a);Object.assign(d,{href:a,target:"_blank",rel:"noopener noreferrer"});let c=e("li");c.append(d),f.append(c)}f.childElementCount&&o.append(e("p","Sources"),f);let p=e("ul");for(let u of(i.guide_ids??[]).slice(0,3)){let a=s.library.find(d=>d.id===u);a&&p.append(y(a,s))}p.childElementCount&&o.append(e("p","Suggested guides"),p);let m=e("div"),h=(u,a)=>{let d=e("button",u);return d.type="button",d.onclick=()=>{l.searched({query:n,results:t,answered:r,feedback:a}),m.replaceChildren(e("p","Thanks for the feedback."))},d};m.append(h("Helpful","up"),h("Not helpful","down")),o.append(m)}export{v as listed,L as renderModule,E as resetAssist,M as searchHref};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as k}from"./chunk-AWIQCFGN.js";import{b as y,k as w}from"./chunk-FUE3SDQU.js";var L="button{font:13px system-ui;cursor:pointer}.d,.b,.l,.o{position:fixed;z-index:2147482000}.d{width:16px;height:16px;padding:0;border-radius:50%;border:2px solid #fff;background:#e5484d;animation:p 1.6s infinite}.o{z-index:2147481000;border:2px solid #e5484d;border-radius:6px;pointer-events:none}.b{padding:1px 8px;border:0;border-radius:10px;background:#e5484d;color:#fff;font-size:11px}.l{right:16px;bottom:16px;padding:10px 16px;border:0;border-radius:24px;background:#111;color:#fff;box-shadow:0 4px 16px rgba(0,0,0,.3)}@keyframes p{0%{box-shadow:0 0 0 0 rgba(229,72,77,.6)}100%{box-shadow:0 0 0 14px rgba(229,72,77,0)}}@media (prefers-reduced-motion:reduce){.d{animation:none}}";function x(e,r,a){let i=document.createElement(e);return i.className=r,a&&(i.textContent=a),i}function T(e,r,a,i={}){let p=document.createElement("div");p.setAttribute("data-lc-ignore","");let h=p.attachShadow({mode:"open"});h.append(y(L,i.nonce));let l=e.steps[0],v=l.title??e.name,c=!1,u=!1,g=!1,f=()=>{g||(g=!0,clearInterval(G),removeEventListener("scroll",s,!0),removeEventListener("resize",s),p.remove(),a())},E=()=>{let o=k();if(!o||c)return o?.();c=!0;let t=e.kind==="launcher",m={...r,shown(){},dismissed:(b,H)=>t?void 0:(u=!0,r.dismissed(b,H)),completed:()=>(u=!t,r.completed())};w({...e,kind:t?"resource_center":"tooltip"},m,()=>{c=!1,o(),u&&f()},i)},n=e.kind==="badge"?x("button","b",v):x("button",e.kind==="launcher"?"l":"d",e.kind==="launcher"?e.appearance?.launcher_label??e.name:void 0);n.type="button",n.setAttribute("aria-label",e.kind==="launcher"?String(e.appearance?.launcher_label??e.name):v);let d=e.kind==="hotspot"?x("div","o"):void 0;n.onclick=()=>{e.kind==="badge"?(r.dismissed(0,l.id),f()):E()},h.append(...d?[d]:[],n);function s(){if(e.kind==="launcher")return;let o=l.selector?document.querySelector(l.selector):null;if(n.hidden=!o,d&&(d.hidden=!o),!o)return;let t=o.getBoundingClientRect(),[m,b]=e.kind==="badge"?[t.right-n.offsetWidth/2,t.top-n.offsetHeight/2]:[t.right-8,t.top-8];n.style.left=`${m}px`,n.style.top=`${b}px`,d&&Object.assign(d.style,{left:`${t.left}px`,top:`${t.top}px`,width:`${t.width}px`,height:`${t.height}px`})}let G=setInterval(s,500);return addEventListener("scroll",s,!0),addEventListener("resize",s),document.body.append(p),s(),r.shown(),f}export{T as renderPersistent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var S="lc_recs",E="lc_recs_recent";function C(t,s,m,c){for(let d of c?[c]:m){let r=s(d)?.[S];if(r&&typeof r=="object"&&(r.placement===t||c!==void 0&&r.placement===void 0))return{flag:d,cfg:r}}}var I=t=>{let{core:s}=t,m=t.config.recommendations??{},c=m.viewEvent??"$product_viewed",d=m.itemIdProperty??"item_id",r=[];try{let n=JSON.parse(s.storage.get(E)??"[]");Array.isArray(n)&&(r=n.filter(e=>typeof e=="string").slice(0,20))}catch{}let p=()=>s.hasConsent("analytics"),_=n=>{n&&(r=[n,...r.filter(e=>e!==n)].slice(0,20),p()&&s.storage.set(E,JSON.stringify(r)))};t.onCapture(n=>{let e=n.properties?.[d];n.event===c&&(typeof e=="string"||typeof e=="number")&&_(String(e))}),t.recs={viewed:_,async get(n,e={}){let k=Object.keys(t.flags?.all()??{}),o=C(n,i=>t.flags?.payload(i),k,e.flag),g=o?t.flags?.get(o.flag):void 0,a=new URLSearchParams({api_key:t.apiKey,placement:n});e.itemId&&a.set("item_id",e.itemId),p()&&r.length&&a.set("recent",r.filter(i=>i!==e.itemId).slice(0,10).join(","));let u=o?.cfg.strategy;typeof u=="string"&&a.set("strategy",u);let y=e.limit??o?.cfg.limit;typeof y=="number"&&y>0&&a.set("limit",String(Math.min(50,Math.floor(y)))),e.exclude?.length&&a.set("exclude",e.exclude.slice(0,50).join(","));let l={};try{let i=await t.fetch(`${t.config.apiHost}/v1/recommendations?${a}`,{credentials:"omit"});i.ok?l=await i.json():t.log("recommendations failed",i.status)}catch(i){t.log("recommendations failed",i)}let f=Array.isArray(l.items)?l.items:[],w=l.strategy??u??"",v={$recommendation_placement:n,$recommendation_strategy:w,...o?{$recommendation_flag:o.flag}:{},...g!==void 0?{$recommendation_variant:String(g)}:{}},R=!1,b={placement:n,strategy:w,items:f,...o?{flag:o.flag}:{},...g!==void 0?{variant:g}:{},shown(){R||!f.length||(R=!0,s.capture("$recommendation_shown",{...v,$recommendation_items:f.map(i=>i.item_id)}))},clicked(i){let x=f.findIndex($=>$.item_id===i);s.capture("$recommendation_clicked",{...v,$recommendation_item:i,...x>=0?{$recommendation_position:x+1}:{}})}};return e.autoShown!==!1&&b.shown(),b}}};export{S as RECS_PAYLOAD_KEY,C as placementFlag,I as recommendations};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import{b as Vt,d as Xt,h as Yt,i as Jt,j as gt}from"./chunk-NIDQQHZJ.js";import{b as Zt,c as Kt}from"./chunk-O4W7SZ2X.js";var kn=Object.defineProperty,Rn=(e,t,r)=>t in e?kn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,y=(e,t,r)=>Rn(e,typeof t!="symbol"?t+"":t,r),Qt,L=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e[e.Asset=7]="Asset",e[e.Annotation=8]="Annotation",e))(L||{}),D=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(D||{}),ue=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(ue||{}),Se=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(Se||{}),ze=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(ze||{}),Ne=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(Ne||{}),Y=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(Y||{}),er={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument","firstChild","lastChild","nextSibling","previousSibling"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},tr={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},$e={},wt={},rr=0,En=()=>!!globalThis.Zone;function _t(e){if($e[e])return $e[e];let t=globalThis[e],r=t.prototype,n=e in er?er[e]:void 0,i=!!(n&&n.every(a=>{var l,f;return!!((f=(l=Object.getOwnPropertyDescriptor(r,a))==null?void 0:l.get)!=null&&f.toString().includes("[native code]"))})),o=e in tr?tr[e]:void 0,s=!!(o&&o.every(a=>{var l;return typeof r[a]=="function"&&((l=r[a])==null?void 0:l.toString().includes("[native code]"))}));if(i&&s&&!En())return $e[e]=t.prototype,t.prototype;try{let a=document.createElement("iframe");a.style.display="none",document.body.appendChild(a);let l=a.contentWindow;if(!l)return t.prototype;let f=l[e].prototype;if(!f)return a.remove(),r;let u=navigator.userAgent;return u.includes("Safari")&&!u.includes("Chrome")?(a.classList.add("rr-block"),a.setAttribute("__rrwebUntaintedMutationObserver",""),wt[e]=()=>a.remove()):a.remove(),$e[e]=f}catch{return r}}var vt={};function de(e,t,r){var n,i;let o=(n=vt[e])==null?void 0:n[r];if(o)return o.call(t);let s=_t(e),a=(i=Object.getOwnPropertyDescriptor(s,r))==null?void 0:i.get;return a?((vt[e]||(vt[e]={}))[r]=a,a.call(t)):t[r]}var yt={};function pr(e,t,r){let n=`${e}.${String(r)}`;if(yt[n])return yt[n].bind(t);let o=_t(e)[r];return typeof o!="function"?t[r]:(yt[n]=o,o.bind(t))}function Tn(e){return de("Node",e,"ownerDocument")}function On(e){return de("Node",e,"childNodes")}function Nn(e){return de("Node",e,"parentNode")}function An(e){return de("Node",e,"parentElement")}function Ln(e){return de("Node",e,"textContent")}function Dn(e){return de("Node",e,"firstChild")}function _n(e){return de("Node",e,"lastChild")}function Fn(e){return de("Node",e,"nextSibling")}function zn(e){return de("Node",e,"previousSibling")}function Pn(e,t){return pr("Node",e,"contains")(t)}function Un(e){return pr("Node",e,"getRootNode")()}function Bn(e){return!e||!("host"in e)?null:de("ShadowRoot",e,"host")}function $n(e){return e.styleSheets}function Wn(e){return!e||!("shadowRoot"in e)?null:de("Element",e,"shadowRoot")}function Hn(e,t){return de("Element",e,"querySelector")(t)}function Gn(e,t){return de("Element",e,"querySelectorAll")(t)}function mr(){let e=_t("MutationObserver");rr++;let t=!1;return[e.constructor,()=>{if(t||(t=!0,--rr!==0))return;let r=wt.MutationObserver;if(r)try{r()}finally{delete $e.MutationObserver,delete wt.MutationObserver}}]}var je=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(je=()=>new Date().getTime());function Re(e,t,r){try{if(!(t in e))return()=>{};let n=e[t],i=r(n);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=i,()=>{e[t]=n}}catch{return()=>{}}}var C={ownerDocument:Tn,childNodes:On,parentNode:Nn,parentElement:An,textContent:Ln,firstChild:Dn,lastChild:_n,nextSibling:Fn,previousSibling:zn,contains:Pn,getRootNode:Un,host:Bn,styleSheets:$n,shadowRoot:Wn,querySelector:Hn,querySelectorAll:Gn,nowTimestamp:je,mutationObserverCtor:mr,patch:Re};function gr(e){return e.nodeType===e.ELEMENT_NODE}function We(e){let t=e&&"host"in e&&"mode"in e&&C.host(e)||null;return!!(t&&"shadowRoot"in t&&C.shadowRoot(t)===e)}function He(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function jn(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function qn(e){let{cssText:t}=e;if(t.split('"').length<3)return t;let r=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?r.push("layer"):e.layerName&&r.push(`layer(${e.layerName})`),e.supportsText&&r.push(`supports(${e.supportsText})`),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}function Ct(e){try{let t=e.rules||e.cssRules;if(!t)return null;let r=e.href;!r&&e.ownerNode&&(r=e.ownerNode.baseURI);let n=Array.from(t,i=>vr(i,r)).join("");return jn(n)}catch{return null}}function vr(e,t){if(Xn(e)){let r;try{r=Ct(e.styleSheet)||qn(e)}catch{r=e.cssText}return e.styleSheet.href?lt(r,e.styleSheet.href):r}else{let r=e.cssText;return Zn(e)&&e.selectorText.includes(":")&&(r=Vn(r)),t?lt(r,t):r}}function Vn(e){let t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function Xn(e){return"styleSheet"in e}function Zn(e){return"selectorText"in e}var ot=class{constructor(){y(this,"idNodeMap",new Map),y(this,"nodeMetaMap",new WeakMap)}getId(t){var r;return t?((r=this.getMeta(t))==null?void 0:r.id)??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){let r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(i=>this.removeNodeFromMap(i));let n=C.shadowRoot(t);n&&this.removeNodeFromMap(n)}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,r){let n=r.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,r)}replace(t,r){let n=this.getNode(t);if(n){let i=this.nodeMetaMap.get(n);i&&this.nodeMetaMap.set(r,i)}this.idNodeMap.set(t,r)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function Kn(){return new ot}function st({element:e,maskInputOptions:t,tagName:r,type:n,value:i,maskInputFn:o}){let s=i||"",a=n&&xe(n);return(t[r.toLowerCase()]||a&&t[a])&&(o?s=o(s,e):s="*".repeat(s.length)),s}function xe(e){return e.toLowerCase()}var nr="__rrweb_original__";function Yn(e){let t=e.getContext("2d");if(!t)return!0;let r=50;for(let n=0;n<e.width;n+=r)for(let i=0;i<e.height;i+=r){let o=t.getImageData,s=nr in o?o[nr]:o;if(new Uint32Array(s.call(t,n,i,Math.min(r,e.width-n),Math.min(r,e.height-i)).data.buffer).some(l=>l!==0))return!1}return!0}function at(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?xe(t):null}function yr(e,t){let r;try{r=new URL(e,t??window.location.href)}catch{return null}let n=/\.([0-9a-z]+)(?:$)/i,i=r.pathname.match(n);return i?.[1]??null}function Jn(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var Qn=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,ei=/^(?:[a-z+]+:)?\/\//i,ti=/^www\..*/i,ri=/^(data:)([^,]*),(.*)/i;function lt(e,t){return(e||"").replace(Qn,(r,n,i,o,s,a)=>{let l=i||s||a,f=n||o||"";if(!l)return r;if(ei.test(l)||ti.test(l))return`url(${f}${l}${f})`;if(ri.test(l))return`url(${f}${l}${f})`;if(l[0]==="/")return`url(${f}${Jn(t)+l}${f})`;let u=l.split("#")[0],d=l.substring(u.length),p=t.split("#")[0].split("/"),h=u.split("/");p.pop();for(let m of h)m!=="."&&(m===".."?p.pop():p.push(m));return`url(${f}${p.join("/")}${d}${f})`})}var br="(?:/\\*[^*]*\\*/)|[\\s;]",ni=new RegExp(`${br}|\\b(0)px?`,"g"),ii=new RegExp(br,"g");function et(e,t=!1){return t?e.replace(ii,""):e.replace(ni,"$1")}function oi(e,t,r=!1){let n=Array.from(t.childNodes),i=[],o=0;if(n.length>1&&e&&typeof e=="string"){let s=et(e,r),a=s.length/e.length;for(let l=1;l<n.length;l++)if(n[l].textContent&&typeof n[l].textContent=="string"){let f=et(n[l].textContent,r),u=100,d=3;for(;d<f.length&&(f[d].match(/[a-zA-Z0-9]/)||f.indexOf(f.substring(0,d),1)!==-1);d++);for(;d<f.length;d++){let p=f.substring(0,d),h=s.split(p),m=-1;if(h.length===2)m=h[0].length;else if(h.length>2&&h[0]===""&&n[l-1].textContent!=="")m=s.indexOf(p,1);else if(h.length===1){if(p=p.substring(0,p.length-1),h=s.split(p),h.length<=1)return i.push(e),i;d=u+1}else d===f.length-1&&(m=s.indexOf(p));if(h.length>=2&&d>u){let c=n[l-1].textContent;if(c&&typeof c=="string"){let v=et(c).length;m=s.indexOf(p,v)}m===-1&&(m=h[0].length)}if(m!==-1){let c=Math.floor(m/a);for(;c>0&&c<e.length;){if(o+=1,o>50*n.length)return i.push(e),i;let v=et(e.substring(0,c),r);if(v.length===m){i.push(e.substring(0,c)),e=e.substring(c),s=s.substring(m);break}else v.length<m?c+=Math.max(1,Math.floor((m-v.length)/a)):c-=Math.max(1,Math.floor((v.length-m)*a))}break}}}}return i.push(e),i}function si(e,t){return oi(e,t).join("/* rr_split */")}var ai=1,li=new RegExp("[^a-z0-9-_:]"),ut=-2;function Sr(){return ai++}function ui(e){if(e instanceof HTMLFormElement)return"form";let t=xe(e.tagName);return li.test(t)?"div":t}var Oe,ir,ci=/^[^ \t\n\r\u000c]+/,fi=/^[, \t\n\r\u000c]+/;function di(e,t){if(t.trim()==="")return t;let r=0;function n(o){let s,a=o.exec(t.substring(r));return a?(s=a[0],r+=s.length,s):""}let i=[];for(;n(fi),!(r>=t.length);){let o=n(ci);if(o.slice(-1)===",")o=Le(e,o.substring(0,o.length-1)),i.push(o);else{let s="";o=Le(e,o);let a=!1;for(;;){let l=t.charAt(r);if(l===""){i.push((o+s).trim());break}else if(a)l===")"&&(a=!1);else if(l===","){r+=1,i.push((o+s).trim());break}else l==="("&&(a=!0);s+=l,r+=1}}}return i.join(", ")}var or=new WeakMap;function Le(e,t){return!t||t.trim()===""?t:Ft(e,t)}function hi(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function Ft(e,t){let r=or.get(e);if(r||(r=e.createElement("a"),or.set(e,r)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return r.setAttribute("href",t),r.href}function wr(e,t,r,n){return n&&(r==="src"||r==="href"&&!(t==="use"&&n[0]==="#")||r==="xlink:href"&&n[0]!=="#"||r==="background"&&["table","td","th"].includes(t)?Le(e,n):r==="srcset"?di(e,n):r==="style"?lt(n,Ft(e)):t==="object"&&r==="data"?Le(e,n):n)}function Cr(e,t,r){return["video","audio"].includes(e)&&xe(t)==="autoplay"}function pi(e,t,r){try{if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){let i=e.classList[n];if(t.test(i))return!0}if(r)return e.matches(r)}catch{}return!1}function ct(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return r?ct(C.parentNode(e),t,r):!1;for(let n=e.classList.length;n--;){let i=e.classList[n];if(t.test(i))return!0}return r?ct(C.parentNode(e),t,r):!1}function Mr(e,t,r,n){let i;if(gr(e)){if(i=e,!C.childNodes(i).length)return!1}else{if(C.parentElement(e)===null)return!1;i=C.parentElement(e)}try{if(typeof t=="string"){if(n){if(i.closest(`.${t}`))return!0}else if(i.classList.contains(t))return!0}else if(ct(i,t,n))return!0;if(r){if(n){if(i.closest(r))return!0}else if(i.matches(r))return!0}}catch{}return!1}function mi(e,t,r){let n=e.contentWindow;if(!n)return;let i=!1,o;try{o=n.document.readyState}catch{return}if(o!=="complete"){let a=setTimeout(()=>{i||(t(),i=!0)},r);e.addEventListener("load",()=>{clearTimeout(a),i=!0,t()});return}let s="about:blank";if(n.location.href!==s||e.src===s||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function gi(e,t,r){let n=!1,i;try{i=e.sheet}catch{return}if(i)return;let o=setTimeout(()=>{n||(t(),n=!0)},r);e.addEventListener("load",()=>{clearTimeout(o),n=!0,t()})}function vi(e,t){let{doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:s,inlineStylesheet:a,maskInputOptions:l={},maskTextFn:f,maskInputFn:u,dataURLOptions:d={},inlineImages:p,recordCanvas:h,keepIframeSrcFn:m,newlyAddedElement:c=!1,cssCaptured:v=!1}=t,w=yi(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:Y.Document,childNodes:[],compatMode:e.compatMode}:{type:Y.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:Y.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:w};case e.ELEMENT_NODE:return Si(e,{doc:r,blockClass:i,blockSelector:o,inlineStylesheet:a,maskInputOptions:l,maskInputFn:u,dataURLOptions:d,inlineImages:p,recordCanvas:h,keepIframeSrcFn:m,newlyAddedElement:c,rootId:w});case e.TEXT_NODE:return bi(e,{doc:r,needsMask:s,maskTextFn:f,rootId:w,cssCaptured:v});case e.CDATA_SECTION_NODE:return{type:Y.CDATA,textContent:"",rootId:w};case e.COMMENT_NODE:return{type:Y.Comment,textContent:C.textContent(e)||"",rootId:w};default:return!1}}function yi(e,t){if(!t.hasNode(e))return;let r=t.getId(e);return r===1?void 0:r}function bi(e,t){let{needsMask:r,maskTextFn:n,rootId:i,cssCaptured:o}=t,s=C.parentNode(e),a=s&&s.tagName,l="",f=a==="STYLE"?!0:void 0,u=a==="SCRIPT"?!0:void 0;return u?l="SCRIPT_PLACEHOLDER":o||(l=C.textContent(e),f&&l&&(l=lt(l,Ft(t.doc)))),!f&&!u&&l&&r&&(l=n?n(l,C.parentElement(e)):l.replace(/[\S]/g,"*")),{type:Y.Text,textContent:l||"",rootId:i}}function Si(e,t){let{doc:r,blockClass:n,blockSelector:i,inlineStylesheet:o,maskInputOptions:s={},maskInputFn:a,dataURLOptions:l={},inlineImages:f,recordCanvas:u,keepIframeSrcFn:d,newlyAddedElement:p=!1,rootId:h}=t,m=pi(e,n,i),c=ui(e),v={},w=e.attributes.length;for(let g=0;g<w;g++){let S=e.attributes[g];Cr(c,S.name,S.value)||(v[S.name]=wr(r,c,xe(S.name),S.value))}if(c==="link"&&o){let g=Array.from(r.styleSheets).find(k=>k.href===e.href),S=null;g&&(S=Ct(g)),S&&(delete v.rel,delete v.href,v._cssText=S)}if(c==="style"&&e.sheet){let g=Ct(e.sheet);g&&(e.childNodes.length>1&&(g=si(g,e)),v._cssText=g)}if(["input","textarea","select"].includes(c)){let g=e.value,S=e.checked;v.type!=="radio"&&v.type!=="checkbox"&&v.type!=="submit"&&v.type!=="button"&&g?v.value=st({element:e,type:at(e),tagName:c,value:g,maskInputOptions:s,maskInputFn:a}):S&&(v.checked=S)}if(c==="option"&&(e.selected&&!s.select?v.selected=!0:delete v.selected),c==="dialog"&&e.open&&(v.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),c==="canvas"&&u){if(e.__context==="2d")Yn(e)||(v.rr_dataURL=e.toDataURL(l.type,l.quality));else if(!("__context"in e)){let g=e.toDataURL(l.type,l.quality),S=r.createElement("canvas");S.width=e.width,S.height=e.height;let k=S.toDataURL(l.type,l.quality);g!==k&&(v.rr_dataURL=g)}}if(c==="img"&&f){Oe||(Oe=r.createElement("canvas"),ir=Oe.getContext("2d"));let g=e,S=g.currentSrc||g.getAttribute("src")||"<unknown-src>",k=g.crossOrigin,I=()=>{g.removeEventListener("load",I);try{Oe.width=g.naturalWidth,Oe.height=g.naturalHeight,ir.drawImage(g,0,0),v.rr_dataURL=Oe.toDataURL(l.type,l.quality)}catch(O){if(g.crossOrigin!=="anonymous"){g.crossOrigin="anonymous",g.complete&&g.naturalWidth!==0?I():g.addEventListener("load",I);return}else console.warn(`Cannot inline img src=${S}! Error: ${O}`)}g.crossOrigin==="anonymous"&&(k?v.crossOrigin=k:g.removeAttribute("crossorigin"))};g.complete&&g.naturalWidth!==0?I():g.addEventListener("load",I)}if(["audio","video"].includes(c)){let g=v;g.rr_mediaState=e.paused?"paused":"played",g.rr_mediaCurrentTime=e.currentTime,g.rr_mediaPlaybackRate=e.playbackRate,g.rr_mediaMuted=e.muted,g.rr_mediaLoop=e.loop,g.rr_mediaVolume=e.volume}if(p||(e.scrollLeft&&(v.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(v.rr_scrollTop=e.scrollTop)),m){let{width:g,height:S}=e.getBoundingClientRect();v={class:v.class,rr_width:`${g}px`,rr_height:`${S}px`}}c==="iframe"&&!d(v.src)&&(e.contentDocument||(v.rr_src=v.src),delete v.src);let b;try{customElements.get(c)&&(b=!0)}catch{}return{type:Y.Element,tagName:c,attributes:v,childNodes:[],isSVG:hi(e)||void 0,needBlock:m,rootId:h,isCustom:b}}function $(e){return e==null?"":e.toLowerCase()}function Ir(e){return e===!0||e==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:e==="all",headMetaDescKeywords:e==="all",headTitleMutations:e==="all"}:e||{}}function wi(e,t){if(t.comment&&e.type===Y.Comment)return!0;if(e.type===Y.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"&&e.attributes.as==="script"||e.attributes.rel==="modulepreload")||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&yr(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&($(e.attributes.name).match(/^msapplication-tile(image|color)$/)||$(e.attributes.name)==="application-name"||$(e.attributes.rel)==="icon"||$(e.attributes.rel)==="apple-touch-icon"||$(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&$(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&($(e.attributes.property).match(/^(og|twitter|fb):/)||$(e.attributes.name).match(/^(og|twitter):/)||$(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&($(e.attributes.name)==="robots"||$(e.attributes.name)==="googlebot"||$(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&($(e.attributes.name)==="author"||$(e.attributes.name)==="generator"||$(e.attributes.name)==="framework"||$(e.attributes.name)==="publisher"||$(e.attributes.name)==="progid"||$(e.attributes.property).match(/^article:/)||$(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&($(e.attributes.name)==="google-site-verification"||$(e.attributes.name)==="yandex-verification"||$(e.attributes.name)==="csrf-token"||$(e.attributes.name)==="p:domain_verify"||$(e.attributes.name)==="verify-v1"||$(e.attributes.name)==="verification"||$(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function De(e,t){let{doc:r,mirror:n,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:a,skipChild:l=!1,inlineStylesheet:f=!0,maskInputOptions:u={},maskTextFn:d,maskInputFn:p,slimDOMOptions:h,dataURLOptions:m={},inlineImages:c=!1,recordCanvas:v=!1,onSerialize:w,onIframeLoad:b,iframeLoadTimeout:g=5e3,onStylesheetLoad:S,stylesheetLoadTimeout:k=5e3,keepIframeSrcFn:I=()=>!1,newlyAddedElement:O=!1,cssCaptured:R=!1}=t,{needsMask:x}=t,{preserveWhiteSpace:U=!0}=t;x||(x=Mr(e,s,a,x===void 0));let W=vi(e,{doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:x,inlineStylesheet:f,maskInputOptions:u,maskTextFn:d,maskInputFn:p,dataURLOptions:m,inlineImages:c,recordCanvas:v,keepIframeSrcFn:I,newlyAddedElement:O,cssCaptured:R});if(!W)return console.warn(e,"not serialized"),null;let B;n.hasNode(e)?B=n.getId(e):wi(W,h)||!U&&W.type===Y.Text&&!W.textContent.replace(/^\s+|\s+$/gm,"").length?B=ut:B=Sr();let E=Object.assign(W,{id:B});if(n.add(e,E),B===ut)return null;w&&w(e);let X=!l;if(E.type===Y.Element){X=X&&!E.needBlock,delete E.needBlock;let N=C.shadowRoot(e);N&&He(N)&&(E.isShadowHost=!0)}if((E.type===Y.Document||E.type===Y.Element)&&X){h.headWhitespace&&E.type===Y.Element&&E.tagName==="head"&&(U=!1);let N={doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:x,maskTextClass:s,maskTextSelector:a,skipChild:l,inlineStylesheet:f,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:h,dataURLOptions:m,inlineImages:c,recordCanvas:v,preserveWhiteSpace:U,onSerialize:w,onIframeLoad:b,iframeLoadTimeout:g,onStylesheetLoad:S,stylesheetLoadTimeout:k,keepIframeSrcFn:I,cssCaptured:!1};if(!(E.type===Y.Element&&E.tagName==="textarea"&&E.attributes.value!==void 0)){E.type===Y.Element&&E.attributes._cssText!==void 0&&typeof E.attributes._cssText=="string"&&(N.cssCaptured=!0);for(let H of Array.from(C.childNodes(e))){let G=De(H,N);G&&E.childNodes.push(G)}}let F=null;if(gr(e)&&(F=C.shadowRoot(e)))for(let H of Array.from(C.childNodes(F))){let G=De(H,N);G&&(He(F)&&(G.isShadow=!0),E.childNodes.push(G))}}let Z=C.parentNode(e);return Z&&We(Z)&&He(Z)&&(E.isShadow=!0),E.type===Y.Element&&E.tagName==="iframe"&&mi(e,()=>{let N=e.contentDocument;if(N&&b){let F=De(N,{doc:N,mirror:n,blockClass:i,blockSelector:o,needsMask:x,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:f,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:h,dataURLOptions:m,inlineImages:c,recordCanvas:v,preserveWhiteSpace:U,onSerialize:w,onIframeLoad:b,iframeLoadTimeout:g,onStylesheetLoad:S,stylesheetLoadTimeout:k,keepIframeSrcFn:I});F&&b(e,F)}},g),E.type===Y.Element&&E.tagName==="link"&&typeof E.attributes.rel=="string"&&(E.attributes.rel==="stylesheet"||E.attributes.rel==="preload"&&typeof E.attributes.href=="string"&&yr(E.attributes.href)==="css")&&gi(e,()=>{if(S){let N=De(e,{doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:x,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:f,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:h,dataURLOptions:m,inlineImages:c,recordCanvas:v,preserveWhiteSpace:U,onSerialize:w,onIframeLoad:b,iframeLoadTimeout:g,onStylesheetLoad:S,stylesheetLoadTimeout:k,keepIframeSrcFn:I});N&&S(e,N)}},k),E}function Ci(e,t){let{mirror:r=new ot,blockClass:n="rr-block",blockSelector:i=null,maskTextClass:o="rr-mask",maskTextSelector:s=null,inlineStylesheet:a=!0,inlineImages:l=!1,recordCanvas:f=!1,maskAllInputs:u=!1,maskTextFn:d,maskInputFn:p,slimDOM:h=!1,dataURLOptions:m,preserveWhiteSpace:c,onSerialize:v,onIframeLoad:w,iframeLoadTimeout:b,onStylesheetLoad:g,stylesheetLoadTimeout:S,keepIframeSrcFn:k=()=>!1}=t,I=u===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:u===!1?{password:!0}:u,O=Ir(h);return De(e,{doc:e,mirror:r,blockClass:n,blockSelector:i,maskTextClass:o,maskTextSelector:s,skipChild:!1,inlineStylesheet:a,maskInputOptions:I,maskTextFn:d,maskInputFn:p,slimDOMOptions:O,dataURLOptions:m,inlineImages:l,recordCanvas:f,preserveWhiteSpace:c,onSerialize:v,onIframeLoad:w,iframeLoadTimeout:b,onStylesheetLoad:g,stylesheetLoadTimeout:S,keepIframeSrcFn:k,newlyAddedElement:!1})}var Mt=class e{constructor(...t){y(this,"parentElement",null),y(this,"parentNode",null),y(this,"ownerDocument"),y(this,"firstChild",null),y(this,"lastChild",null),y(this,"previousSibling",null),y(this,"nextSibling",null),y(this,"ELEMENT_NODE",1),y(this,"TEXT_NODE",3),y(this,"nodeType"),y(this,"nodeName"),y(this,"RRNodeType")}get childNodes(){let t=[],r=this.firstChild;for(;r;)t.push(r),r=r.nextSibling;return t}contains(t){if(t instanceof e){if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0}else return!1;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,r){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}};function te(e,t,r=document){let n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}var Ae=`Please stop import mirror directly. Instead of that,\r
|
|
2
|
+
now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
|
|
3
|
+
or you can use record.mirror to access the mirror instance during recording.`,sr={map:{},getId(){return console.error(Ae),-1},getNode(){return console.error(Ae),null},removeNodeFromMap(){console.error(Ae)},has(){return console.error(Ae),!1},reset(){console.error(Ae)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(sr=new Proxy(sr,{get(e,t,r){return t==="map"&&console.error(Ae),Reflect.get(e,t,r)}}));function qe(e,t,r={}){let n=null,i=0;return function(...o){let s=Date.now();!i&&r.leading===!1&&(i=s);let a=t-(s-i),l=this;a<=0||a>t?(n&&(clearTimeout(n),n=null),i=s,e.apply(l,o)):!n&&r.trailing!==!1&&(n=setTimeout(()=>{i=r.leading===!1?0:Date.now(),n=null,e.apply(l,o)},a))}}function ht(e,t,r,n,i=window){let o=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,n?r:{set(s){setTimeout(()=>{r.set.call(this,s)},0),o&&o.set&&o.set.call(this,s)}}),()=>ht(e,t,o||{},!0)}function xr(e){var t,r,n,i;let o=e.document;return{left:o.scrollingElement?o.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:o.documentElement.scrollLeft||o?.body&&((t=C.parentElement(o.body))==null?void 0:t.scrollLeft)||((r=o?.body)==null?void 0:r.scrollLeft)||0,top:o.scrollingElement?o.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:o?.documentElement.scrollTop||o?.body&&((n=C.parentElement(o.body))==null?void 0:n.scrollTop)||((i=o?.body)==null?void 0:i.scrollTop)||0}}function kr(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Rr(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Er(e){return e?e.nodeType===e.ELEMENT_NODE?e:C.parentElement(e):null}function ae(e,t,r,n){if(!e)return!1;let i=Er(e);if(!i)return!1;try{if(typeof t=="string"){if(i.classList.contains(t)||n&&i.closest("."+t)!==null)return!0}else if(ct(i,t,n))return!0}catch{}return!!(r&&(i.matches(r)||n&&i.closest(r)!==null))}function Mi(e,t){return t.getId(e)!==-1}function bt(e,t,r){return e.tagName==="TITLE"&&r.headTitleMutations?!0:t.getId(e)===ut}function Tr(e,t){if(We(e))return!1;let r=t.getId(e);if(!t.has(r))return!0;let n=C.parentNode(e);return n&&n.nodeType===e.DOCUMENT_NODE?!1:n?Tr(n,t):!0}function It(e){return!!e.changedTouches}function Ii(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function Or(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function Nr(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function xt(e){return e?e instanceof Mt&&"shadowRoot"in e?!!e.shadowRoot:!!C.shadowRoot(e):!1}var kt=class{constructor(){y(this,"id",1),y(this,"styleIDMap",new WeakMap),y(this,"idStyleMap",new Map)}getId(t){return this.styleIDMap.get(t)??-1}has(t){return this.styleIDMap.has(t)}add(t,r){if(this.has(t))return this.getId(t);let n;return r===void 0?n=this.id++:n=r,this.styleIDMap.set(t,n),this.idStyleMap.set(n,t),n}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function Ar(e){var t;let r=null;return"getRootNode"in e&&((t=C.getRootNode(e))==null?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&C.host(C.getRootNode(e))&&(r=C.host(C.getRootNode(e))),r}function xi(e){let t=e,r;for(;r=Ar(t);)t=r;return t}function ki(e){let t=C.ownerDocument(e);if(!t)return!1;let r=xi(e);return C.contains(t,r)}function Rt(e){let t=C.ownerDocument(e);return t?C.contains(t,e)||ki(e):!1}var ar=(e,t)=>`${e}@${t}`,Et=class{constructor(){y(this,"frozen",!1),y(this,"locked",!1),y(this,"texts",[]),y(this,"attributes",[]),y(this,"attributeMap",new WeakMap),y(this,"removes",[]),y(this,"mapRemoves",[]),y(this,"movedMap",{}),y(this,"addedSet",new Set),y(this,"movedSet",new Set),y(this,"droppedSet",new Set),y(this,"removesSubTreeCache",new Set),y(this,"mutationCb"),y(this,"blockClass"),y(this,"blockSelector"),y(this,"maskTextClass"),y(this,"maskTextSelector"),y(this,"inlineStylesheet"),y(this,"maskInputOptions"),y(this,"maskTextFn"),y(this,"maskInputFn"),y(this,"keepIframeSrcFn"),y(this,"recordCanvas"),y(this,"inlineImages"),y(this,"slimDOMOptions"),y(this,"dataURLOptions"),y(this,"doc"),y(this,"mirror"),y(this,"iframeManager"),y(this,"stylesheetManager"),y(this,"shadowDomManager"),y(this,"processedNodeManager"),y(this,"unattachedDoc"),y(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),y(this,"emit",()=>{if(this.frozen||this.locked)return;let t=[],r=new Set;for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let p of this.movedSet){let h=C.parentNode(p);this.removesSubTreeCache.has(h)&&!this.movedSet.has(h)||this.addedSet.add(p)}let n=null,i=null,o=-1,s=null,a=!1,l=new Set,f=this.addedSet.values(),u=f.next();for(;this.addedSet.size;){if(n!==null&&this.addedSet.has(C.previousSibling(n)))s=n,n=C.previousSibling(n);else{for(this.addedSet.has(u.value)||(u=f.next()),n=u.value;;){if(i=C.parentNode(n),this.addedSet.has(i)){n=i;continue}break}if(l.has(i))i=null;else if(i){if(Rt(i)?(a=lr(this.droppedSet,i)||this.removesSubTreeCache.has(i),a&&lr(this.movedSet,n)&&(a=!1)):a=!0,this.addedSet.has(C.lastChild(i)))n=C.lastChild(i),s=null;else for(;;){if(s=C.nextSibling(n),this.addedSet.has(s)){n=s;continue}break}if(o=We(i)?this.mirror.getId(Ar(n)):this.mirror.getId(i),o===-1&&i.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let c=C.host(i);o=this.mirror.getId(c)}}}if(this.addedSet.delete(n),!i||o===-1){l.add(n);continue}else if(a){this.droppedSet.add(n);continue}let p=!1;if(n.nodeType===Node.TEXT_NODE){let c=i.tagName;if(c==="TEXTAREA")continue;c==="STYLE"&&r.has(o)&&(p=!0)}let h=s?this.mirror.getId(s):null;for(;h===ut;)s=s&&C.nextSibling(s),h=s&&this.mirror.getId(s);if(h===-1){console.warn("Couldn't record new node. Couldn't find mirror id for nextSibling:",s),n=null;continue}let m=De(n,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:c=>{Or(c,this.mirror)&&this.iframeManager.addIframe(c),Nr(c,this.mirror)&&this.stylesheetManager.trackLinkElement(c),xt(n)&&this.shadowDomManager.addShadowRoot(C.shadowRoot(n),this.doc)},onIframeLoad:(c,v)=>{this.iframeManager.attachIframe(c,v),this.shadowDomManager.observeAttachShadow(c)},onStylesheetLoad:(c,v)=>{this.stylesheetManager.attachLinkElement(c,v)},cssCaptured:p});m&&(t.push({parentId:o,nextId:h,node:m}),r.add(m.id))}let d={texts:this.texts.map(p=>{let h=p.node,m=C.parentNode(h);return m&&m.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(m),{id:this.mirror.getId(h),value:p.value}}).filter(p=>!r.has(p.id)).filter(p=>this.mirror.has(p.id)),attributes:this.attributes.map(p=>{let{attributes:h}=p;if(typeof h.style=="string"){let m=JSON.stringify(p.styleDiff),c=JSON.stringify(p._unchangedStyles);m.length<h.style.length&&(m+c).split("var(").length===h.style.split("var(").length&&(h.style=p.styleDiff)}return{id:this.mirror.getId(p.node),attributes:h}}).filter(p=>!r.has(p.id)).filter(p=>this.mirror.has(p.id)),removes:this.removes,adds:t};!d.texts.length&&!d.attributes.length&&!d.removes.length&&!d.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(d))}),y(this,"genTextAreaValueMutation",t=>{let r=this.attributeMap.get(t);r||(r={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(r),this.attributeMap.set(t,r));let n=Array.from(C.childNodes(t),i=>C.textContent(i)||"").join("");r.attributes.value=st({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:at(t),value:n,maskInputFn:this.maskInputFn})}),y(this,"processMutation",t=>{if(!bt(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{let r=C.textContent(t.target);!ae(t.target,this.blockClass,this.blockSelector,!1)&&r!==t.oldValue&&this.texts.push({value:Mr(t.target,this.maskTextClass,this.maskTextSelector,!0)&&r?this.maskTextFn?this.maskTextFn(r,Er(t.target)):r.replace(/[\S]/g,"*"):r,node:t.target});break}case"attributes":{let r=t.target,n=xe(r.tagName),i=t.attributeName,o=t.target.getAttribute(i);if(i==="value"){let a=at(r);o=st({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:a,value:o,maskInputFn:this.maskInputFn})}if(ae(t.target,this.blockClass,this.blockSelector,!1)||o===t.oldValue)return;let s=this.attributeMap.get(t.target);if(n==="iframe"&&i==="src"&&!this.keepIframeSrcFn(o))if(!r.contentDocument)i="rr_src";else return;if(s||(s={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(s),this.attributeMap.set(t.target,s)),i==="type"&&n==="input"&&(t.oldValue||"").toLowerCase()==="password"&&r.setAttribute("data-rr-is-password","true"),!Cr(n,i))if(s.attributes[i]=wr(this.doc,n,xe(i),o),i==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let a=this.unattachedDoc.createElement("span");t.oldValue&&a.setAttribute("style",t.oldValue);for(let l of Array.from(r.style)){let f=r.style.getPropertyValue(l),u=r.style.getPropertyPriority(l);f!==a.style.getPropertyValue(l)||u!==a.style.getPropertyPriority(l)?u===""?s.styleDiff[l]=f:s.styleDiff[l]=[f,u]:s._unchangedStyles[l]=[f,u]}for(let l of Array.from(a.style))r.style.getPropertyValue(l)===""&&(s.styleDiff[l]=!1)}else i==="open"&&r.tagName==="DIALOG"&&(r.matches("dialog:modal")?s.attributes.rr_open_mode="modal":s.attributes.rr_open_mode="non-modal");break}case"childList":{if(ae(t.target,this.blockClass,this.blockSelector,!0))return;if(t.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(t.target);return}t.addedNodes.forEach(r=>this.genAdds(r,t.target)),t.removedNodes.forEach(r=>{Rt(r)||this.shadowDomManager.removeShadowRootsIn(r);let n=this.mirror.getId(r),i=We(t.target)?this.mirror.getId(C.host(t.target)):this.mirror.getId(t.target);ae(t.target,this.blockClass,this.blockSelector,!1)||bt(r,this.mirror,this.slimDOMOptions)||!Mi(r,this.mirror)||(this.addedSet.has(r)?(Tt(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&n===-1||Tr(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[ar(n,i)]?Tt(this.movedSet,r):(this.removes.push({parentId:i,id:n,isShadow:We(t.target)&&He(t.target)?!0:void 0}),Ri(r,this.removesSubTreeCache))),this.mapRemoves.push(r))});break}}}),y(this,"genAdds",(t,r)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(bt(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let n=null;r&&this.mirror.hasNode(r)&&(n=this.mirror.getId(r)),n&&n!==-1&&(this.movedMap[ar(this.mirror.getId(t),n)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);ae(t,this.blockClass,this.blockSelector,!1)||(C.childNodes(t).forEach(n=>this.genAdds(n)),xt(t)&&C.childNodes(C.shadowRoot(t)).forEach(n=>{this.processedNodeManager.add(n,this),this.genAdds(n,t)}))}})}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","processedNodeManager"].forEach(r=>{this[r]=t[r]})}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1,this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0}unlock(){this.locked=!1,this.emit()}};function Tt(e,t){e.delete(t),C.childNodes(t).forEach(r=>Tt(e,r))}function Ri(e,t){let r=[e];for(;r.length;){let n=r.pop();t.has(n)||(t.add(n),C.childNodes(n).forEach(i=>r.push(i)))}}function lr(e,t){return e.size===0?!1:Lr(e,t)}function Lr(e,t){if(e.has(t))return!0;let r=C.parentNode(t);return r?Lr(e,r):!1}var Ge;function Ei(e){Ge=e}function Ti(){Ge=void 0}var _=e=>Ge?(...r)=>{try{return e(...r)}catch(n){if(Ge&&Ge(n)===!0)return;throw n}}:e,Fe=new Set;function Xe(e){try{if("composedPath"in e){let t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function Dr(e,t){let r=new Et;Fe.add(r),r.init(e);let[n,i]=mr(),o=new n(_(r.processMutations.bind(r)));return o.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),()=>{o.disconnect(),Fe.delete(r),i()}}function Oi({mousemoveCb:e,sampling:t,doc:r,mirror:n}){if(t.mousemove===!1)return()=>{};let i=typeof t.mousemove=="number"?t.mousemove:50,o=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500,s=[],a,l=qe(_(d=>{let p=Date.now()-a;e(s.map(h=>(h.timeOffset-=p,h)),d),s=[],a=null}),o),f=_(qe(_(d=>{let p=Xe(d),{clientX:h,clientY:m}=It(d)?d.changedTouches[0]:d;a||(a=je()),s.push({x:h,y:m,id:n.getId(p),timeOffset:je()-a}),l(typeof DragEvent<"u"&&d instanceof DragEvent?D.Drag:d instanceof MouseEvent?D.MouseMove:D.TouchMove)}),i,{trailing:!1})),u=[te("mousemove",f,r),te("touchmove",f,r),te("drag",f,r)];return _(()=>{u.forEach(d=>d())})}function Ni({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,sampling:o}){if(o.mouseInteraction===!1)return()=>{};let s=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,a=[],l=null,f=u=>d=>{let p=Xe(d);if(ae(p,n,i,!0))return;let h=null,m=u;if("pointerType"in d){switch(d.pointerType){case"mouse":h=Se.Mouse;break;case"touch":h=Se.Touch;break;case"pen":h=Se.Pen;break}h===Se.Touch?ue[u]===ue.MouseDown?m="TouchStart":ue[u]===ue.MouseUp&&(m="TouchEnd"):Se.Pen}else It(d)&&(h=Se.Touch);h!==null?(l=h,(m.startsWith("Touch")&&h===Se.Touch||m.startsWith("Mouse")&&h===Se.Mouse)&&(h=null)):ue[u]===ue.Click&&(h=l,l=null);let c=It(d)?d.changedTouches[0]:d;if(!c)return;let v=r.getId(p),{clientX:w,clientY:b}=c;_(e)({type:ue[m],id:v,x:w,y:b,...h!==null&&{pointerType:h}})};return Object.keys(ue).filter(u=>Number.isNaN(Number(u))&&!u.endsWith("_Departed")&&s[u]!==!1).forEach(u=>{let d=xe(u),p=f(u);if(window.PointerEvent)switch(ue[u]){case ue.MouseDown:case ue.MouseUp:d=d.replace("mouse","pointer");break;case ue.TouchStart:case ue.TouchEnd:return}a.push(te(d,p,t))}),_(()=>{a.forEach(u=>u())})}function _r({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,sampling:o}){let s=_(qe(_(a=>{let l=Xe(a);if(!l||ae(l,n,i,!0))return;let f=r.getId(l);if(l===t&&t.defaultView){let u=xr(t.defaultView);e({id:f,x:u.left,y:u.top})}else e({id:f,x:l.scrollLeft,y:l.scrollTop})}),o.scroll||100));return te("scroll",s,t)}function Ai({viewportResizeCb:e},{win:t}){let r=-1,n=-1,i=_(qe(_(()=>{let o=kr(),s=Rr();(r!==o||n!==s)&&(e({width:Number(s),height:Number(o)}),r=o,n=s)}),200));return te("resize",i,t)}var Li=["INPUT","TEXTAREA","SELECT"],ur=new WeakMap;function Di({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,ignoreClass:o,ignoreSelector:s,maskInputOptions:a,maskInputFn:l,sampling:f,userTriggeredOnInput:u}){function d(b){let g=Xe(b),S=b.isTrusted,k=g&&g.tagName;if(g&&k==="OPTION"&&(g=C.parentElement(g)),!g||!k||Li.indexOf(k)<0||ae(g,n,i,!0)||g.classList.contains(o)||s&&g.matches(s))return;let I=g.value,O=!1,R=at(g)||"";R==="radio"||R==="checkbox"?O=g.checked:(a[k.toLowerCase()]||a[R])&&(I=st({element:g,maskInputOptions:a,tagName:k,type:R,value:I,maskInputFn:l})),p(g,u?{text:I,isChecked:O,userTriggered:S}:{text:I,isChecked:O});let x=g.name;R==="radio"&&x&&O&&t.querySelectorAll(`input[type="radio"][name="${x}"]`).forEach(U=>{if(U!==g){let W=U.value;p(U,u?{text:W,isChecked:!O,userTriggered:!1}:{text:W,isChecked:!O})}})}function p(b,g){let S=ur.get(b);if(!S||S.text!==g.text||S.isChecked!==g.isChecked){ur.set(b,g);let k=r.getId(b);_(e)({...g,id:k})}}let m=(f.input==="last"?["change"]:["input","change"]).map(b=>te(b,_(d),t)),c=t.defaultView;if(!c)return()=>{m.forEach(b=>b())};let v=c.Object.getOwnPropertyDescriptor(c.HTMLInputElement.prototype,"value"),w=[[c.HTMLInputElement.prototype,"value"],[c.HTMLInputElement.prototype,"checked"],[c.HTMLSelectElement.prototype,"value"],[c.HTMLTextAreaElement.prototype,"value"],[c.HTMLSelectElement.prototype,"selectedIndex"],[c.HTMLOptionElement.prototype,"selected"]];return v&&v.set&&m.push(...w.map(b=>ht(b[0],b[1],{set(){_(d)({target:this,isTrusted:!1})}},!1,c))),_(()=>{m.forEach(b=>b())})}function ft(e){let t=[];function r(n,i){if(tt("CSSGroupingRule")&&n.parentRule instanceof CSSGroupingRule||tt("CSSMediaRule")&&n.parentRule instanceof CSSMediaRule||tt("CSSSupportsRule")&&n.parentRule instanceof CSSSupportsRule||tt("CSSConditionRule")&&n.parentRule instanceof CSSConditionRule){let s=Array.from(n.parentRule.cssRules).indexOf(n);return i.unshift(s),r(n.parentRule,i)}else if(n.parentStyleSheet){let s=Array.from(n.parentStyleSheet.cssRules).indexOf(n);i.unshift(s)}return i}return r(e,t)}function Ie(e,t,r){let n,i;return e?(e.ownerNode?n=t.getId(e.ownerNode):i=r.getId(e),{styleId:i,id:n}):{}}function _i({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:n}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};let i=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:_((u,d,p)=>{let[h,m]=p,{id:c,styleId:v}=Ie(d,t,r.styleMirror);return(c&&c!==-1||v&&v!==-1)&&e({id:c,styleId:v,adds:[{rule:h,index:m}]}),u.apply(d,p)})}),n.CSSStyleSheet.prototype.addRule=function(u,d,p=this.cssRules.length){let h=`${u} { ${d} }`;return n.CSSStyleSheet.prototype.insertRule.apply(this,[h,p])};let o=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:_((u,d,p)=>{let[h]=p,{id:m,styleId:c}=Ie(d,t,r.styleMirror);return(m&&m!==-1||c&&c!==-1)&&e({id:m,styleId:c,removes:[{index:h}]}),u.apply(d,p)})}),n.CSSStyleSheet.prototype.removeRule=function(u){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[u])};let s;n.CSSStyleSheet.prototype.replace&&(s=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(s,{apply:_((u,d,p)=>{let[h]=p,{id:m,styleId:c}=Ie(d,t,r.styleMirror);return(m&&m!==-1||c&&c!==-1)&&e({id:m,styleId:c,replace:h}),u.apply(d,p)})}));let a;n.CSSStyleSheet.prototype.replaceSync&&(a=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:_((u,d,p)=>{let[h]=p,{id:m,styleId:c}=Ie(d,t,r.styleMirror);return(m&&m!==-1||c&&c!==-1)&&e({id:m,styleId:c,replaceSync:h}),u.apply(d,p)})}));let l={};rt("CSSGroupingRule")?l.CSSGroupingRule=n.CSSGroupingRule:(rt("CSSMediaRule")&&(l.CSSMediaRule=n.CSSMediaRule),rt("CSSConditionRule")&&(l.CSSConditionRule=n.CSSConditionRule),rt("CSSSupportsRule")&&(l.CSSSupportsRule=n.CSSSupportsRule));let f={};return Object.entries(l).forEach(([u,d])=>{f[u]={insertRule:d.prototype.insertRule,deleteRule:d.prototype.deleteRule},d.prototype.insertRule=new Proxy(f[u].insertRule,{apply:_((p,h,m)=>{let[c,v]=m,{id:w,styleId:b}=Ie(h.parentStyleSheet,t,r.styleMirror);return(w&&w!==-1||b&&b!==-1)&&e({id:w,styleId:b,adds:[{rule:c,index:[...ft(h),v||0]}]}),p.apply(h,m)})}),d.prototype.deleteRule=new Proxy(f[u].deleteRule,{apply:_((p,h,m)=>{let[c]=m,{id:v,styleId:w}=Ie(h.parentStyleSheet,t,r.styleMirror);return(v&&v!==-1||w&&w!==-1)&&e({id:v,styleId:w,removes:[{index:[...ft(h),c]}]}),p.apply(h,m)})})}),_(()=>{n.CSSStyleSheet.prototype.insertRule=i,n.CSSStyleSheet.prototype.deleteRule=o,s&&(n.CSSStyleSheet.prototype.replace=s),a&&(n.CSSStyleSheet.prototype.replaceSync=a),Object.entries(l).forEach(([u,d])=>{d.prototype.insertRule=f[u].insertRule,d.prototype.deleteRule=f[u].deleteRule})})}function Fr({mirror:e,stylesheetManager:t},r){var n,i,o;let s=null;r.nodeName==="#document"?s=e.getId(r):s=e.getId(C.host(r));let a=r.nodeName==="#document"?(n=r.defaultView)==null?void 0:n.Document:(o=(i=r.ownerDocument)==null?void 0:i.defaultView)==null?void 0:o.ShadowRoot,l=a?.prototype?Object.getOwnPropertyDescriptor(a?.prototype,"adoptedStyleSheets"):void 0;return s===null||s===-1||!a||!l?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var f;return(f=l.get)==null?void 0:f.call(this)},set(f){var u;let d=(u=l.set)==null?void 0:u.call(this,f);if(s!==null&&s!==-1)try{t.adoptStyleSheets(f,s)}catch{}return d}}),_(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})}))}function Fi({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:i}){let o=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:_((a,l,f)=>{var u;let[d,p,h]=f;if(r.has(d))return o.apply(l,[d,p,h]);let{id:m,styleId:c}=Ie((u=l.parentRule)==null?void 0:u.parentStyleSheet,t,n.styleMirror);return(m&&m!==-1||c&&c!==-1)&&e({id:m,styleId:c,set:{property:d,value:p,priority:h},index:ft(l.parentRule)}),a.apply(l,f)})});let s=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(s,{apply:_((a,l,f)=>{var u;let[d]=f;if(r.has(d))return s.apply(l,[d]);let{id:p,styleId:h}=Ie((u=l.parentRule)==null?void 0:u.parentStyleSheet,t,n.styleMirror);return(p&&p!==-1||h&&h!==-1)&&e({id:p,styleId:h,remove:{property:d},index:ft(l.parentRule)}),a.apply(l,f)})}),_(()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=s})}function zi({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:i,doc:o}){let s=_(l=>qe(_(f=>{let u=Xe(f);if(!u||ae(u,t,r,!0))return;let{currentTime:d,volume:p,muted:h,playbackRate:m,loop:c}=u;e({type:l,id:n.getId(u),currentTime:d,volume:p,muted:h,playbackRate:m,loop:c})}),i.media||500)),a=[te("play",s(Ne.Play),o),te("pause",s(Ne.Pause),o),te("seeked",s(Ne.Seeked),o),te("volumechange",s(Ne.VolumeChange),o),te("ratechange",s(Ne.RateChange),o)];return _(()=>{a.forEach(l=>l())})}function Pi({fontCb:e,doc:t}){let r=t.defaultView;if(!r)return()=>{};let n=[],i=new WeakMap,o=r.FontFace;r.FontFace=function(l,f,u){let d=new o(l,f,u);return i.set(d,{family:l,buffer:typeof f!="string",descriptors:u,fontSource:typeof f=="string"?f:JSON.stringify(Array.from(new Uint8Array(f)))}),d};let s=Re(t.fonts,"add",function(a){return function(l){return setTimeout(_(()=>{let f=i.get(l);f&&(e(f),i.delete(l))}),0),a.apply(this,[l])}});return n.push(()=>{r.FontFace=o}),n.push(s),_(()=>{n.forEach(a=>a())})}function Ui(e){let{doc:t,mirror:r,blockClass:n,blockSelector:i,selectionCb:o}=e,s=!0,a=_(()=>{let l=t.getSelection();if(!l||s&&l?.isCollapsed)return;s=l.isCollapsed||!1;let f=[],u=l.rangeCount||0;for(let d=0;d<u;d++){let p=l.getRangeAt(d),{startContainer:h,startOffset:m,endContainer:c,endOffset:v}=p;ae(h,n,i,!0)||ae(c,n,i,!0)||f.push({start:r.getId(h),startOffset:m,end:r.getId(c),endOffset:v})}o({ranges:f})});return a(),te("selectionchange",a)}function Bi({doc:e,customElementCb:t}){let r=e.defaultView;return!r||!r.customElements?()=>{}:Re(r.customElements,"define",function(i){return function(o,s,a){try{t({define:{name:o}})}catch{console.warn(`Custom element callback failed for ${o}`)}return i.apply(this,[o,s,a])}})}function $i(e,t){let{mutationCb:r,mousemoveCb:n,mouseInteractionCb:i,scrollCb:o,viewportResizeCb:s,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:f,styleDeclarationCb:u,canvasMutationCb:d,fontCb:p,selectionCb:h,customElementCb:m}=e;e.mutationCb=(...c)=>{t.mutation&&t.mutation(...c),r(...c)},e.mousemoveCb=(...c)=>{t.mousemove&&t.mousemove(...c),n(...c)},e.mouseInteractionCb=(...c)=>{t.mouseInteraction&&t.mouseInteraction(...c),i(...c)},e.scrollCb=(...c)=>{t.scroll&&t.scroll(...c),o(...c)},e.viewportResizeCb=(...c)=>{t.viewportResize&&t.viewportResize(...c),s(...c)},e.inputCb=(...c)=>{t.input&&t.input(...c),a(...c)},e.mediaInteractionCb=(...c)=>{t.mediaInteaction&&t.mediaInteaction(...c),l(...c)},e.styleSheetRuleCb=(...c)=>{t.styleSheetRule&&t.styleSheetRule(...c),f(...c)},e.styleDeclarationCb=(...c)=>{t.styleDeclaration&&t.styleDeclaration(...c),u(...c)},e.canvasMutationCb=(...c)=>{t.canvasMutation&&t.canvasMutation(...c),d(...c)},e.fontCb=(...c)=>{t.font&&t.font(...c),p(...c)},e.selectionCb=(...c)=>{t.selection&&t.selection(...c),h(...c)},e.customElementCb=(...c)=>{t.customElement&&t.customElement(...c),m(...c)}}function Wi(e,t={}){let r=e.doc.defaultView;if(!r)return()=>{};$i(e,t);let n;e.recordDOM&&(n=Dr(e,e.doc));let i=Oi(e),o=Ni(e),s=_r(e),a=Ai(e,{win:r}),l=Di(e),f=zi(e),u=()=>{},d=()=>{},p=()=>{},h=()=>{};e.recordDOM&&(u=_i(e,{win:r}),d=Fr(e,e.doc),p=Fi(e,{win:r}),e.collectFonts&&(h=Pi(e)));let m=Ui(e),c=Bi(e),v=[];for(let w of e.plugins)v.push(w.observer(w.callback,r,w.options));return _(()=>{n?.(),i(),o(),s(),a(),l(),f(),u(),d(),p(),h(),m(),c(),v.forEach(w=>w())})}function tt(e){return typeof window[e]<"u"}function rt(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var dt=class{constructor(t){y(this,"iframeIdToRemoteIdMap",new WeakMap),y(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,r,n,i){let o=n||this.getIdToRemoteIdMap(t),s=i||this.getRemoteIdToIdMap(t),a=o.get(r);return a||(a=this.generateIdFn(),o.set(r,a),s.set(a,r)),a}getIds(t,r){let n=this.getIdToRemoteIdMap(t),i=this.getRemoteIdToIdMap(t);return r.map(o=>this.getId(t,o,n,i))}getRemoteId(t,r,n){let i=n||this.getRemoteIdToIdMap(t);if(typeof r!="number")return r;let o=i.get(r);return o||-1}getRemoteIds(t,r){let n=this.getRemoteIdToIdMap(t);return r.map(i=>this.getRemoteId(t,i,n))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let r=this.iframeIdToRemoteIdMap.get(t);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(t,r)),r}getRemoteIdToIdMap(t){let r=this.iframeRemoteIdToIdMap.get(t);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(t,r)),r}},Ot=class{constructor(t){y(this,"iframes",new WeakMap),y(this,"crossOriginIframeMap",new WeakMap),y(this,"crossOriginIframeMirror",new dt(Sr)),y(this,"crossOriginIframeStyleMirror"),y(this,"crossOriginIframeRootIdMap",new WeakMap),y(this,"mirror"),y(this,"mutationCb"),y(this,"wrappedEmit"),y(this,"loadListener"),y(this,"unloadListener"),y(this,"attachedWindows",new Map),y(this,"messageHandler",r=>this.handleMessage(r)),y(this,"stylesheetManager"),y(this,"recordCrossOriginIframes"),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new dt(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}addLoadListener(t){this.loadListener=t}addUnloadListener(t){this.unloadListener=t}attachIframe(t,r){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.watchIframeWindow(t),(n=this.loadListener)==null||n.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}destroy(){window.removeEventListener("message",this.messageHandler),this.attachedWindows.forEach(t=>t())}watchIframeWindow(t){let r=t.contentWindow;if(!r||this.attachedWindows.has(r))return;let n=[],i=()=>{this.attachedWindows.delete(r),n.forEach(o=>{try{o()}catch{}})};this.attachedWindows.set(r,i),this.recordCrossOriginIframes&&n.push(te("message",this.messageHandler,r)),n.push(te("pagehide",o=>{var s;if(o.persisted)return;let a=r.document;i(),(s=this.unloadListener)==null||s.call(this,a)},r))}handleMessage(t){let r=t;if(r.data.type!=="rrweb"||r.origin!==r.data.origin||!t.source)return;let i=this.crossOriginIframeMap.get(t.source);if(!i)return;let o=this.transformCrossOriginEvent(i,r.data.event);o&&this.wrappedEmit(o,r.data.isCheckout)}transformCrossOriginEvent(t,r){var n;switch(r.type){case L.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(r.data.node,t);let i=r.data.node.id;return this.crossOriginIframeRootIdMap.set(t,i),this.patchRootIdOnNode(r.data.node,i),{timestamp:r.timestamp,type:L.IncrementalSnapshot,data:{source:D.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case L.Meta:case L.Load:case L.DomContentLoaded:return!1;case L.Annotation:case L.Plugin:return r;case L.Custom:return this.replaceIds(r.data.payload,t,["id","parentId","previousId","nextId"]),r;case L.IncrementalSnapshot:switch(r.data.source){case D.Mutation:return r.data.adds.forEach(i=>{this.replaceIds(i,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,t);let o=this.crossOriginIframeRootIdMap.get(t);o&&this.patchRootIdOnNode(i.node,o)}),r.data.removes.forEach(i=>{this.replaceIds(i,t,["parentId","id"])}),r.data.attributes.forEach(i=>{this.replaceIds(i,t,["id"])}),r.data.texts.forEach(i=>{this.replaceIds(i,t,["id"])}),r;case D.Drag:case D.TouchMove:case D.MouseMove:return r.data.positions.forEach(i=>{this.replaceIds(i,t,["id"])}),r;case D.ViewportResize:return!1;case D.MediaInteraction:case D.MouseInteraction:case D.Scroll:case D.CanvasMutation:case D.Input:return this.replaceIds(r.data,t,["id"]),r;case D.StyleSheetRule:case D.StyleDeclaration:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleId"]),r;case D.Font:return r;case D.Selection:return r.data.ranges.forEach(i=>{this.replaceIds(i,t,["start","end"])}),r;case D.AdoptedStyleSheet:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleIds"]),(n=r.data.styles)==null||n.forEach(i=>{this.replaceStyleIds(i,t,["styleId"])}),r}}return!1}replace(t,r,n,i){for(let o of i)!Array.isArray(r[o])&&typeof r[o]!="number"||(Array.isArray(r[o])?r[o]=t.getIds(n,r[o]):r[o]=t.getId(n,r[o]));return r}replaceIds(t,r,n){return this.replace(this.crossOriginIframeMirror,t,r,n)}replaceStyleIds(t,r,n){return this.replace(this.crossOriginIframeStyleMirror,t,r,n)}replaceIdOnNode(t,r){this.replaceIds(t,r,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(n=>{this.replaceIdOnNode(n,r)})}patchRootIdOnNode(t,r){t.type!==Y.Document&&!t.rootId&&(t.rootId=r),"childNodes"in t&&t.childNodes.forEach(n=>{this.patchRootIdOnNode(n,r)})}},Nt=class{constructor(t){y(this,"shadowDoms",new Map),y(this,"mutationCb"),y(this,"scrollCb"),y(this,"bypassOptions"),y(this,"mirror"),y(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,r){if(!He(t)||this.shadowDoms.has(t))return;let n=[];this.shadowDoms.set(t,n);let i=Dr({...this.bypassOptions,doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);n.push(i),n.push(_r({...this.bypassOptions,scrollCb:this.scrollCb,doc:t,mirror:this.mirror})),setTimeout(()=>{this.shadowDoms.get(t)===n&&(t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(C.host(t))),n.push(Fr({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t)))},0)}removeShadowRootsIn(t){if(this.shadowDoms.size===0)return;let r=C.shadowRoot(t);r&&(this.shadowDoms.has(r)&&this.removeShadowRoot(r),this.removeShadowRootsIn(r)),C.childNodes(t).forEach(n=>this.removeShadowRootsIn(n))}removeShadowRoot(t){let r=this.shadowDoms.get(t);this.shadowDoms.delete(t),r?.forEach(St)}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,r){let n=this;this.restoreHandlers.push(Re(t.prototype,"attachShadow",function(i){return function(o){let s=i.call(this,o),a=C.shadowRoot(this);return a&&Rt(this)&&n.addShadowRoot(a,r),s}}))}reset(){this.restoreHandlers.forEach(St),this.restoreHandlers=[];let t=this.shadowDoms;this.shadowDoms=new Map,t.forEach(r=>r.forEach(St))}};function St(e){try{e()}catch{}}var _e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Hi=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(Be=0;Be<_e.length;Be++)Hi[_e.charCodeAt(Be)]=Be;var Be,Gi=function(e){var t=new Uint8Array(e),r,n=t.length,i="";for(r=0;r<n;r+=3)i+=_e[t[r]>>2],i+=_e[(t[r]&3)<<4|t[r+1]>>4],i+=_e[(t[r+1]&15)<<2|t[r+2]>>6],i+=_e[t[r+2]&63];return n%3===2?i=i.substring(0,i.length-1)+"=":n%3===1&&(i=i.substring(0,i.length-2)+"=="),i},cr=new Map;function ji(e,t){let r=cr.get(e);return r||(r=new Map,cr.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}var zr=(e,t,r)=>{if(!e||!(Ur(e,t)||typeof e=="object"))return;let n=e.constructor.name,i=ji(r,n),o=i.indexOf(e);return o===-1&&(o=i.length,i.push(e)),o};function nt(e,t,r){if(e instanceof Array)return e.map(n=>nt(n,t,r));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){let n=e.constructor.name,i=Gi(e);return{rr_type:n,base64:i}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[nt(e.buffer,t,r),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let n=e.constructor.name,{src:i}=e;return{rr_type:n,src:i}}else if(e instanceof HTMLCanvasElement){let n="HTMLImageElement",i=e.toDataURL();return{rr_type:n,src:i}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[nt(e.data,t,r),e.width,e.height]};if(Ur(e,t)||typeof e=="object"){let n=e.constructor.name,i=zr(e,t,r);return{rr_type:n,index:i}}}}return e}var Pr=(e,t,r)=>e.map(n=>nt(n,t,r)),Ur=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof t[i]=="function").find(i=>e instanceof t[i]);function qi(e,t,r,n){let i=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let s of o)try{if(typeof t.CanvasRenderingContext2D.prototype[s]!="function")continue;let a=Re(t.CanvasRenderingContext2D.prototype,s,function(l){return function(...f){return ae(this.canvas,r,n,!0)||setTimeout(()=>{let u=Pr(f,t,this);e(this.canvas,{type:ze["2D"],property:s,args:u})},0),l.apply(this,f)}});i.push(a)}catch{let a=ht(t.CanvasRenderingContext2D.prototype,s,{set(l){e(this.canvas,{type:ze["2D"],property:s,args:[l],setter:!0})}});i.push(a)}return()=>{i.forEach(s=>s())}}function Vi(e){return e==="experimental-webgl"?"webgl":e}function fr(e,t,r,n){let i=[];try{let o=Re(e.HTMLCanvasElement.prototype,"getContext",function(s){return function(a,...l){if(!ae(this,t,r,!0)){let f=Vi(a);if("__context"in this||(this.__context=f),n&&["webgl","webgl2"].includes(f))if(l[0]&&typeof l[0]=="object"){let u=l[0];u.preserveDrawingBuffer||(u.preserveDrawingBuffer=!0)}else l.splice(0,1,{preserveDrawingBuffer:!0})}return s.apply(this,[a,...l])}});i.push(o)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(o=>o())}}function dr(e,t,r,n,i,o){let s=[],a=Object.getOwnPropertyNames(e);for(let l of a)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(l))try{if(typeof e[l]!="function")continue;let f=Re(e,l,function(u){return function(...d){let p=u.apply(this,d);if(zr(p,o,this),"tagName"in this.canvas&&!ae(this.canvas,n,i,!0)){let h=Pr(d,o,this),m={type:t,property:l,args:h};r(this.canvas,m)}return p}});s.push(f)}catch{let f=ht(e,l,{set(u){r(this.canvas,{type:t,property:l,args:[u],setter:!0})}});s.push(f)}return s}function Xi(e,t,r,n){let i=[];return typeof t.WebGLRenderingContext<"u"&&i.push(...dr(t.WebGLRenderingContext.prototype,ze.WebGL,e,r,n,t)),typeof t.WebGL2RenderingContext<"u"&&i.push(...dr(t.WebGL2RenderingContext.prototype,ze.WebGL2,e,r,n,t)),()=>{i.forEach(o=>o())}}var Br=`(function() {
|
|
4
|
+
"use strict";
|
|
5
|
+
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
6
|
+
var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);
|
|
7
|
+
for (var i = 0; i < chars.length; i++) {
|
|
8
|
+
lookup[chars.charCodeAt(i)] = i;
|
|
9
|
+
}
|
|
10
|
+
var encode = function(arraybuffer) {
|
|
11
|
+
var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";
|
|
12
|
+
for (i2 = 0; i2 < len; i2 += 3) {
|
|
13
|
+
base64 += chars[bytes[i2] >> 2];
|
|
14
|
+
base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];
|
|
15
|
+
base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];
|
|
16
|
+
base64 += chars[bytes[i2 + 2] & 63];
|
|
17
|
+
}
|
|
18
|
+
if (len % 3 === 2) {
|
|
19
|
+
base64 = base64.substring(0, base64.length - 1) + "=";
|
|
20
|
+
} else if (len % 3 === 1) {
|
|
21
|
+
base64 = base64.substring(0, base64.length - 2) + "==";
|
|
22
|
+
}
|
|
23
|
+
return base64;
|
|
24
|
+
};
|
|
25
|
+
const lastBlobMap = /* @__PURE__ */ new Map();
|
|
26
|
+
const transparentBlobMap = /* @__PURE__ */ new Map();
|
|
27
|
+
async function getTransparentBlobFor(width, height, dataURLOptions) {
|
|
28
|
+
const id = \`\${width}-\${height}\`;
|
|
29
|
+
if ("OffscreenCanvas" in globalThis) {
|
|
30
|
+
if (transparentBlobMap.has(id)) return transparentBlobMap.get(id);
|
|
31
|
+
const offscreen = new OffscreenCanvas(width, height);
|
|
32
|
+
offscreen.getContext("2d");
|
|
33
|
+
const blob = await offscreen.convertToBlob(dataURLOptions);
|
|
34
|
+
const arrayBuffer = await blob.arrayBuffer();
|
|
35
|
+
const base64 = encode(arrayBuffer);
|
|
36
|
+
transparentBlobMap.set(id, base64);
|
|
37
|
+
return base64;
|
|
38
|
+
} else {
|
|
39
|
+
return "";
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const worker = self;
|
|
43
|
+
worker.onmessage = async function(e) {
|
|
44
|
+
if ("OffscreenCanvas" in globalThis) {
|
|
45
|
+
const { id, bitmap, width, height, dataURLOptions } = e.data;
|
|
46
|
+
const transparentBase64 = getTransparentBlobFor(
|
|
47
|
+
width,
|
|
48
|
+
height,
|
|
49
|
+
dataURLOptions
|
|
50
|
+
);
|
|
51
|
+
const offscreen = new OffscreenCanvas(width, height);
|
|
52
|
+
const ctx = offscreen.getContext("2d");
|
|
53
|
+
ctx.drawImage(bitmap, 0, 0);
|
|
54
|
+
bitmap.close();
|
|
55
|
+
const blob = await offscreen.convertToBlob(dataURLOptions);
|
|
56
|
+
const type = blob.type;
|
|
57
|
+
const arrayBuffer = await blob.arrayBuffer();
|
|
58
|
+
const base64 = encode(arrayBuffer);
|
|
59
|
+
if (!lastBlobMap.has(id) && await transparentBase64 === base64) {
|
|
60
|
+
lastBlobMap.set(id, base64);
|
|
61
|
+
return worker.postMessage({ id });
|
|
62
|
+
}
|
|
63
|
+
if (lastBlobMap.get(id) === base64) return worker.postMessage({ id });
|
|
64
|
+
worker.postMessage({
|
|
65
|
+
id,
|
|
66
|
+
type,
|
|
67
|
+
base64,
|
|
68
|
+
width,
|
|
69
|
+
height
|
|
70
|
+
});
|
|
71
|
+
lastBlobMap.set(id, base64);
|
|
72
|
+
} else {
|
|
73
|
+
return worker.postMessage({ id: e.data.id });
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
})();
|
|
77
|
+
//# sourceMappingURL=image-bitmap-data-url-worker-IJpC7g_b.js.map
|
|
78
|
+
`,hr=typeof self<"u"&&self.Blob&&new Blob([Br],{type:"text/javascript;charset=utf-8"});function Zi(e){let t;try{if(t=hr&&(self.URL||self.webkitURL).createObjectURL(hr),!t)throw"";let r=new Worker(t,{name:e?.name});return r.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),r}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(Br),{name:e?.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}var At=class{constructor(t){y(this,"pendingCanvasMutations",new Map),y(this,"rafStamps",{latestId:0,invokeId:null}),y(this,"mirror"),y(this,"mutationCb"),y(this,"resetObservers"),y(this,"frozen",!1),y(this,"locked",!1),y(this,"processMutation",(l,f)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(l)||this.pendingCanvasMutations.set(l,[]),this.pendingCanvasMutations.get(l).push(f)});let{sampling:r="all",win:n,blockClass:i,blockSelector:o,recordCanvas:s,dataURLOptions:a}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,s&&r==="all"&&this.initCanvasMutationObserver(n,i,o),s&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,i,o,{dataURLOptions:a})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(t,r,n,i,o){let s=fr(r,n,i,!0),a=new Map,l=new Zi;l.onmessage=m=>{let{id:c}=m.data;if(a.set(c,!1),!("base64"in m.data))return;let{base64:v,type:w,width:b,height:g}=m.data;this.mutationCb({id:c,type:ze["2D"],commands:[{property:"clearRect",args:[0,0,b,g]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:v}],type:w}]},0,0]}]})};let f=1e3/t,u=0,d,p=()=>{let m=[];return r.document.querySelectorAll("canvas").forEach(c=>{ae(c,n,i,!0)||m.push(c)}),m},h=m=>{if(u&&m-u<f){d=requestAnimationFrame(h);return}u=m,p().forEach(async c=>{var v;let w=this.mirror.getId(c);if(a.get(w)||c.width===0||c.height===0)return;if(a.set(w,!0),["webgl","webgl2"].includes(c.__context)){let g=c.getContext(c.__context);((v=g?.getContextAttributes())==null?void 0:v.preserveDrawingBuffer)===!1&&g.clear(g.COLOR_BUFFER_BIT)}let b=await createImageBitmap(c);l.postMessage({id:w,bitmap:b,width:c.width,height:c.height,dataURLOptions:o.dataURLOptions},[b])}),d=requestAnimationFrame(h)};d=requestAnimationFrame(h),this.resetObservers=()=>{s(),cancelAnimationFrame(d)}}initCanvasMutationObserver(t,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let i=fr(t,r,n,!1),o=qi(this.processMutation.bind(this),t,r,n),s=Xi(this.processMutation.bind(this),t,r,n);this.resetObservers=()=>{i(),o(),s()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let t=r=>{this.rafStamps.latestId=r,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,r)=>{let n=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,r){if(this.frozen||this.locked)return;let n=this.pendingCanvasMutations.get(t);if(!n||r===-1)return;let i=n.map(s=>{let{type:a,...l}=s;return l}),{type:o}=n[0];this.mutationCb({id:r,type:o,commands:i}),this.pendingCanvasMutations.delete(t)}},Lt=class{constructor(t){y(this,"trackedLinkElements",new WeakSet),y(this,"mutationCb"),y(this,"adoptedStyleSheetCb"),y(this,"styleMirror",new kt),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,r){if(t.length===0)return;let n={id:r,styleIds:[]},i=[];for(let o of t){let s;this.styleMirror.has(o)?s=this.styleMirror.getId(o):(s=this.styleMirror.add(o),i.push({styleId:s,rules:Array.from(o.rules||CSSRule,(a,l)=>({rule:vr(a,o.href),index:l}))})),n.styleIds.push(s)}i.length>0&&(n.styles=i),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}},Dt=class{constructor(){y(this,"nodeMap",new WeakMap),y(this,"active",!1)}inOtherBuffer(t,r){let n=this.nodeMap.get(t);return n&&Array.from(n).some(i=>i!==r)}add(t,r){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(r))}destroy(){}},q,it,Me,Ve=!1;try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement("iframe");document.body.appendChild(e),Array.from=((Qt=e.contentWindow)==null?void 0:Qt.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var me=Kn();function ce(e={}){let{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:i="rr-block",blockSelector:o=null,ignoreClass:s="rr-ignore",ignoreSelector:a=null,maskTextClass:l="rr-mask",maskTextSelector:f=null,inlineStylesheet:u=!0,maskAllInputs:d,maskInputOptions:p,slimDOMOptions:h,maskInputFn:m,maskTextFn:c,hooks:v,packFn:w,sampling:b={},dataURLOptions:g={},mousemoveWait:S,recordDOM:k=!0,recordCanvas:I=!1,recordCrossOriginIframes:O=!1,recordAfter:R=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:x=!1,collectFonts:U=!1,inlineImages:W=!1,plugins:B,keepIframeSrcFn:E=()=>!1,ignoreCSSAttributes:X=new Set([]),errorHandler:Z}=e;Ei(Z);let N=O?window.parent===window:!0,F=!1;if(!N)try{window.parent.document&&(F=!1)}catch{F=!0}if(N&&!t)throw new Error("emit function is required");if(!N&&!F)return()=>{};S!==void 0&&b.mousemove===void 0&&(b.mousemove=S),me.reset();let H=d===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:p!==void 0?p:{password:!0},G=Ir(h);Ii();let ge,re=0,ve=A=>{for(let Q of B||[])Q.eventProcessor&&(A=Q.eventProcessor(A));return w&&!F&&(A=w(A)),A};q=(A,Q)=>{let T=A;if(T.timestamp=je(),T.type!==L.FullSnapshot&&!(T.type===L.IncrementalSnapshot&&T.data.source===D.Mutation)){Me.unfreeze();for(let j of Fe)if(j.isFrozen())j.unfreeze();else break}if(N)t?.(ve(T),Q);else if(F){let j={type:"rrweb",event:ve(T),origin:window.location.origin,isCheckout:Q};window.parent.postMessage(j,"*")}if(T.type===L.FullSnapshot)ge=T,re=0;else if(T.type===L.IncrementalSnapshot){if(T.data.source===D.Mutation&&T.data.isAttachIframe)return;re++;let j=n&&re>=n,oe=r&&T.timestamp-ge.timestamp>r;(j||oe)&&it(!0)}};let ee=A=>{q({type:L.IncrementalSnapshot,data:{source:D.Mutation,...A}})},ne=A=>q({type:L.IncrementalSnapshot,data:{source:D.Scroll,...A}}),V=A=>q({type:L.IncrementalSnapshot,data:{source:D.CanvasMutation,...A}}),ye=A=>q({type:L.IncrementalSnapshot,data:{source:D.AdoptedStyleSheet,...A}}),pe=new Lt({mutationCb:ee,adoptedStyleSheetCb:ye}),J=new Ot({mirror:me,mutationCb:ee,stylesheetManager:pe,recordCrossOriginIframes:O,wrappedEmit:q});for(let A of B||[])A.getMirror&&A.getMirror({nodeMirror:me,crossOriginIframeMirror:J.crossOriginIframeMirror,crossOriginIframeStyleMirror:J.crossOriginIframeStyleMirror});let ke=new Dt;Me=new At({recordCanvas:I,mutationCb:V,win:window,blockClass:i,blockSelector:o,mirror:me,sampling:b.canvas,dataURLOptions:g});let ie=new Nt({mutationCb:ee,scrollCb:ne,bypassOptions:{blockClass:i,blockSelector:o,maskTextClass:l,maskTextSelector:f,inlineStylesheet:u,maskInputOptions:H,dataURLOptions:g,maskTextFn:c,maskInputFn:m,recordCanvas:I,inlineImages:W,sampling:b,slimDOMOptions:G,iframeManager:J,stylesheetManager:pe,canvasManager:Me,keepIframeSrcFn:E,processedNodeManager:ke},mirror:me});it=(A=!1)=>{if(!k)return;q({type:L.Meta,data:{href:window.location.href,width:Rr(),height:kr()}},A),pe.reset(),ie.init(),Me.lock(),Fe.forEach(T=>T.lock());let Q=Ci(document,{mirror:me,blockClass:i,blockSelector:o,maskTextClass:l,maskTextSelector:f,inlineStylesheet:u,maskAllInputs:H,maskTextFn:c,maskInputFn:m,slimDOM:G,dataURLOptions:g,recordCanvas:I,inlineImages:W,onSerialize:T=>{Or(T,me)&&J.addIframe(T),Nr(T,me)&&pe.trackLinkElement(T),xt(T)&&ie.addShadowRoot(C.shadowRoot(T),document)},onIframeLoad:(T,j)=>{J.attachIframe(T,j),ie.observeAttachShadow(T)},onStylesheetLoad:(T,j)=>{pe.attachLinkElement(T,j)},keepIframeSrcFn:E});if(!Q)return console.warn("Failed to snapshot the document");q({type:L.FullSnapshot,data:{node:Q,initialOffset:xr(window)}},A),Me.unlock(),Fe.forEach(T=>T.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&pe.adoptStyleSheets(document.adoptedStyleSheets,me.getId(document))};try{let A=[],Q=oe=>{var K;return _(Wi)({mutationCb:ee,mousemoveCb:(z,Ue)=>q({type:L.IncrementalSnapshot,data:{source:Ue,positions:z}}),mouseInteractionCb:z=>q({type:L.IncrementalSnapshot,data:{source:D.MouseInteraction,...z}}),scrollCb:ne,viewportResizeCb:z=>q({type:L.IncrementalSnapshot,data:{source:D.ViewportResize,...z}}),inputCb:z=>q({type:L.IncrementalSnapshot,data:{source:D.Input,...z}}),mediaInteractionCb:z=>q({type:L.IncrementalSnapshot,data:{source:D.MediaInteraction,...z}}),styleSheetRuleCb:z=>q({type:L.IncrementalSnapshot,data:{source:D.StyleSheetRule,...z}}),styleDeclarationCb:z=>q({type:L.IncrementalSnapshot,data:{source:D.StyleDeclaration,...z}}),canvasMutationCb:V,fontCb:z=>q({type:L.IncrementalSnapshot,data:{source:D.Font,...z}}),selectionCb:z=>{q({type:L.IncrementalSnapshot,data:{source:D.Selection,...z}})},customElementCb:z=>{q({type:L.IncrementalSnapshot,data:{source:D.CustomElement,...z}})},blockClass:i,ignoreClass:s,ignoreSelector:a,maskTextClass:l,maskTextSelector:f,maskInputOptions:H,inlineStylesheet:u,sampling:b,recordDOM:k,recordCanvas:I,inlineImages:W,userTriggeredOnInput:x,collectFonts:U,doc:oe,maskInputFn:m,maskTextFn:c,keepIframeSrcFn:E,blockSelector:o,slimDOMOptions:G,dataURLOptions:g,mirror:me,iframeManager:J,stylesheetManager:pe,shadowDomManager:ie,processedNodeManager:ke,canvasManager:Me,ignoreCSSAttributes:X,plugins:((K=B?.filter(z=>z.observer))==null?void 0:K.map(z=>({observer:z.observer,options:z.options,callback:Ue=>q({type:L.Plugin,data:{plugin:z.name,payload:Ue}})})))||[]},v)},T=new Map;J.addLoadListener(oe=>{try{let K=oe.contentDocument;if(T.has(K))return;T.set(K,Q(K))}catch(K){console.warn(K)}}),J.addUnloadListener(oe=>{let K=T.get(oe);K&&(T.delete(oe),K(),ie.removeShadowRootsIn(oe),me.removeNodeFromMap(oe))});let j=()=>{it(),A.push(Q(document)),Ve=!0};return["interactive","complete"].includes(document.readyState)?j():(A.push(te("DOMContentLoaded",()=>{q({type:L.DomContentLoaded,data:{}}),R==="DOMContentLoaded"&&j()})),A.push(te("load",()=>{q({type:L.Load,data:{}}),R==="load"&&j()},window))),()=>{[...A,...T.values()].forEach(oe=>{try{oe()}catch(K){String(K).toLowerCase().includes("cross-origin")||console.warn(K)}}),T.clear(),J.destroy(),ke.destroy(),ie.reset(),Me.reset(),Ve=!1,Ti()}}catch(A){console.warn(A)}}ce.addCustomEvent=(e,t)=>{if(!Ve)throw new Error("please add custom event after start recording");q({type:L.Custom,data:{tag:e,payload:t}})};ce.addAnnotation=e=>{if(!Ve)throw new Error("please add annotation after recording started");q({type:L.Annotation,data:e})};ce.freezePage=()=>{Me.freeze(),Fe.forEach(e=>e.freeze())};ce.takeFullSnapshot=e=>{if(!Ve)throw new Error("please take full snapshot after start recording");it(e)};ce.mirror=me;var $r=["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"];var Wr=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"];var Ki="<masked>",Yi=["password","passwd","pwd","pass","token","access_token","refresh_token","id_token","secret","client_secret","api_key","apikey","key","auth","authorization","code","otp","email","ssn"];var Ji=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function Hr(e,t){let r=e,n=[...Yi,...t.maskParams??[],...t.maskCampaignParams?[...Wr,...$r]:[]];if(n.length){let i=r.indexOf("#"),o=i<0?r:r.slice(0,i),s=i<0?"":r.slice(i);r=o.replace(new RegExp(`([?&])(${n.map(Ji).join("|")})=[^&]*`,"gi"),`$1$2=${Ki}`)+s}return t.stripHash&&(r=r.replace(/#.*$/,"")),r}var fe=Uint8Array,he=Uint16Array,Wt=Int32Array,Ht=new fe([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Gt=new fe([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Gr=new fe([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Zr=function(e,t){for(var r=new he(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];for(var i=new Wt(r[30]),n=1;n<30;++n)for(var o=r[n];o<r[n+1];++o)i[o]=o-r[n]<<5|n;return{b:r,r:i}},Kr=Zr(Ht,2),Qi=Kr.b,Pt=Kr.r;Qi[28]=258,Pt[258]=28;var Yr=Zr(Gt,0),Do=Yr.b,jr=Yr.r,Ut=new he(32768);for(P=0;P<32768;++P)we=(P&43690)>>1|(P&21845)<<1,we=(we&52428)>>2|(we&13107)<<2,we=(we&61680)>>4|(we&3855)<<4,Ut[P]=((we&65280)>>8|(we&255)<<8)>>1;var we,P,Ye=(function(e,t,r){for(var n=e.length,i=0,o=new he(t);i<n;++i)e[i]&&++o[e[i]-1];var s=new he(t);for(i=1;i<t;++i)s[i]=s[i-1]+o[i-1]<<1;var a;if(r){a=new he(1<<t);var l=15-t;for(i=0;i<n;++i)if(e[i])for(var f=i<<4|e[i],u=t-e[i],d=s[e[i]-1]++<<u,p=d|(1<<u)-1;d<=p;++d)a[Ut[d]>>l]=f}else for(a=new he(n),i=0;i<n;++i)e[i]&&(a[i]=Ut[s[e[i]-1]++]>>15-e[i]);return a}),Ee=new fe(288);for(P=0;P<144;++P)Ee[P]=8;var P;for(P=144;P<256;++P)Ee[P]=9;var P;for(P=256;P<280;++P)Ee[P]=7;var P;for(P=280;P<288;++P)Ee[P]=8;var P,pt=new fe(32);for(P=0;P<32;++P)pt[P]=5;var P,eo=Ye(Ee,9,0);var to=Ye(pt,5,0);var Jr=function(e){return(e+7)/8|0},Qr=function(e,t,r){return(t==null||t<0)&&(t=0),(r==null||r>e.length)&&(r=e.length),new fe(e.subarray(t,r))};var Ce=function(e,t,r){r<<=t&7;var n=t/8|0;e[n]|=r,e[n+1]|=r>>8},Ze=function(e,t,r){r<<=t&7;var n=t/8|0;e[n]|=r,e[n+1]|=r>>8,e[n+2]|=r>>16},zt=function(e,t){for(var r=[],n=0;n<e.length;++n)e[n]&&r.push({s:n,f:e[n]});var i=r.length,o=r.slice();if(!i)return{t:tn,l:0};if(i==1){var s=new fe(r[0].s+1);return s[r[0].s]=1,{t:s,l:1}}r.sort(function(k,I){return k.f-I.f}),r.push({s:-1,f:25001});var a=r[0],l=r[1],f=0,u=1,d=2;for(r[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=i-1;)a=r[r[f].f<r[d].f?f++:d++],l=r[f!=u&&r[f].f<r[d].f?f++:d++],r[u++]={s:-1,f:a.f+l.f,l:a,r:l};for(var p=o[0].s,n=1;n<i;++n)o[n].s>p&&(p=o[n].s);var h=new he(p+1),m=Bt(r[u-1],h,0);if(m>t){var n=0,c=0,v=m-t,w=1<<v;for(o.sort(function(I,O){return h[O.s]-h[I.s]||I.f-O.f});n<i;++n){var b=o[n].s;if(h[b]>t)c+=w-(1<<m-h[b]),h[b]=t;else break}for(c>>=v;c>0;){var g=o[n].s;h[g]<t?c-=1<<t-h[g]++-1:++n}for(;n>=0&&c;--n){var S=o[n].s;h[S]==t&&(--h[S],++c)}m=t}return{t:new fe(h),l:m}},Bt=function(e,t,r){return e.s==-1?Math.max(Bt(e.l,t,r+1),Bt(e.r,t,r+1)):t[e.s]=r},qr=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new he(++t),n=0,i=e[0],o=1,s=function(l){r[n++]=l},a=1;a<=t;++a)if(e[a]==i&&a!=t)++o;else{if(!i&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(i),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(i);o=1,i=e[a]}return{c:r.subarray(0,n),n:t}},Ke=function(e,t){for(var r=0,n=0;n<t.length;++n)r+=e[n]*t[n];return r},en=function(e,t,r){var n=r.length,i=Jr(t+2);e[i]=n&255,e[i+1]=n>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var o=0;o<n;++o)e[i+o+4]=r[o];return(i+4+n)*8},Vr=function(e,t,r,n,i,o,s,a,l,f,u){Ce(t,u++,r),++i[256];for(var d=zt(i,15),p=d.t,h=d.l,m=zt(o,15),c=m.t,v=m.l,w=qr(p),b=w.c,g=w.n,S=qr(c),k=S.c,I=S.n,O=new he(19),R=0;R<b.length;++R)++O[b[R]&31];for(var R=0;R<k.length;++R)++O[k[R]&31];for(var x=zt(O,7),U=x.t,W=x.l,B=19;B>4&&!U[Gr[B-1]];--B);var E=f+5<<3,X=Ke(i,Ee)+Ke(o,pt)+s,Z=Ke(i,p)+Ke(o,c)+s+14+3*B+Ke(O,U)+2*O[16]+3*O[17]+7*O[18];if(l>=0&&E<=X&&E<=Z)return en(t,u,e.subarray(l,l+f));var N,F,H,G;if(Ce(t,u,1+(Z<X)),u+=2,Z<X){N=Ye(p,h,0),F=p,H=Ye(c,v,0),G=c;var ge=Ye(U,W,0);Ce(t,u,g-257),Ce(t,u+5,I-1),Ce(t,u+10,B-4),u+=14;for(var R=0;R<B;++R)Ce(t,u+3*R,U[Gr[R]]);u+=3*B;for(var re=[b,k],ve=0;ve<2;++ve)for(var ee=re[ve],R=0;R<ee.length;++R){var ne=ee[R]&31;Ce(t,u,ge[ne]),u+=U[ne],ne>15&&(Ce(t,u,ee[R]>>5&127),u+=ee[R]>>12)}}else N=eo,F=Ee,H=to,G=pt;for(var R=0;R<a;++R){var V=n[R];if(V>255){var ne=V>>18&31;Ze(t,u,N[ne+257]),u+=F[ne+257],ne>7&&(Ce(t,u,V>>23&31),u+=Ht[ne]);var ye=V&31;Ze(t,u,H[ye]),u+=G[ye],ye>3&&(Ze(t,u,V>>5&8191),u+=Gt[ye])}else Ze(t,u,N[V]),u+=F[V]}return Ze(t,u,N[256]),u+F[256]},ro=new Wt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),tn=new fe(0),no=function(e,t,r,n,i,o){var s=o.z||e.length,a=new fe(n+s+5*(1+Math.ceil(s/7e3))+i),l=a.subarray(n,a.length-i),f=o.l,u=(o.r||0)&7;if(t){u&&(l[0]=o.r>>3);for(var d=ro[t-1],p=d>>13,h=d&8191,m=(1<<r)-1,c=o.p||new he(32768),v=o.h||new he(m+1),w=Math.ceil(r/3),b=2*w,g=function(j){return(e[j]^e[j+1]<<w^e[j+2]<<b)&m},S=new Wt(25e3),k=new he(288),I=new he(32),O=0,R=0,x=o.i||0,U=0,W=o.w||0,B=0;x+2<s;++x){var E=g(x),X=x&32767,Z=v[E];if(c[X]=Z,v[E]=X,W<=x){var N=s-x;if((O>7e3||U>24576)&&(N>423||!f)){u=Vr(e,l,0,S,k,I,R,U,B,x-B,u),U=O=R=0,B=x;for(var F=0;F<286;++F)k[F]=0;for(var F=0;F<30;++F)I[F]=0}var H=2,G=0,ge=h,re=X-Z&32767;if(N>2&&E==g(x-re))for(var ve=Math.min(p,N)-1,ee=Math.min(32767,x),ne=Math.min(258,N);re<=ee&&--ge&&X!=Z;){if(e[x+H]==e[x+H-re]){for(var V=0;V<ne&&e[x+V]==e[x+V-re];++V);if(V>H){if(H=V,G=re,V>ve)break;for(var ye=Math.min(re,V-2),pe=0,F=0;F<ye;++F){var J=x-re+F&32767,ke=c[J],ie=J-ke&32767;ie>pe&&(pe=ie,Z=J)}}}X=Z,Z=c[X],re+=X-Z&32767}if(G){S[U++]=268435456|Pt[H]<<18|jr[G];var A=Pt[H]&31,Q=jr[G]&31;R+=Ht[A]+Gt[Q],++k[257+A],++I[Q],W=x+H,++O}else S[U++]=e[x],++k[e[x]]}}for(x=Math.max(x,W);x<s;++x)S[U++]=e[x],++k[e[x]];u=Vr(e,l,f,S,k,I,R,U,B,x-B,u),f||(o.r=u&7|l[u/8|0]<<3,u-=7,o.h=v,o.p=c,o.i=x,o.w=W)}else{for(var x=o.w||0;x<s+f;x+=65535){var T=x+65535;T>=s&&(l[u/8|0]=f,T=s),u=en(l,u+1,e.subarray(x,T))}o.i=s}return Qr(a,0,n+Jr(u)+i)},io=(function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var r=t,n=9;--n;)r=(r&1&&-306674912)^r>>>1;e[t]=r}return e})(),oo=function(){var e=-1;return{p:function(t){for(var r=e,n=0;n<t.length;++n)r=io[r&255^t[n]]^r>>>8;e=r},d:function(){return~e}}};var so=function(e,t,r,n,i){if(!i&&(i={l:1},t.dictionary)){var o=t.dictionary.subarray(-32768),s=new fe(o.length+e.length);s.set(o),s.set(e,o.length),e=s,i.w=o.length}return no(e,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,r,n,i)};var $t=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8},ao=function(e,t){var r=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:t.level==9?2:0,e[9]=3,t.mtime!=0&&$t(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),r){e[3]=8;for(var n=0;n<=r.length;++n)e[n+10]=r.charCodeAt(n)}};var lo=function(e){return 10+(e.filename?e.filename.length+1:0)};function rn(e,t){t||(t={});var r=oo(),n=e.length;r.p(e);var i=so(e,t,lo(t),8),o=i.length;return ao(i,t),$t(i,o-8,r.d()),$t(i,o-4,n),i}var Xr=typeof TextEncoder<"u"&&new TextEncoder,uo=typeof TextDecoder<"u"&&new TextDecoder,co=0;try{uo.decode(tn,{stream:!0}),co=1}catch{}function nn(e,t){if(t){for(var r=new fe(e.length),n=0;n<e.length;++n)r[n]=e.charCodeAt(n);return r}if(Xr)return Xr.encode(e);for(var i=e.length,o=new fe(e.length+(e.length>>1)),s=0,a=function(u){o[s++]=u},n=0;n<i;++n){if(s+5>o.length){var l=new fe(s+8+(i-n<<1));l.set(o),o=l}var f=e.charCodeAt(n);f<128||t?a(f):f<2048?(a(192|f>>6),a(128|f&63)):f>55295&&f<57344?(f=65536+(f&1047552)|e.charCodeAt(++n)&1023,a(240|f>>18),a(128|f>>12&63),a(128|f>>6&63),a(128|f&63)):(a(224|f>>12),a(128|f>>6&63),a(128|f&63))}return Qr(o,0,s)}async function on(e){if(typeof CompressionStream<"u"&&typeof Response<"u")try{let t=new Response(e).body?.pipeThrough(new CompressionStream("gzip"));if(t)return new Uint8Array(await new Response(t).arrayBuffer())}catch{}return jt(e)}function jt(e){return rn(nn(e))}var fo=8e6,sn=6e4;function an(e){let t=[],r=0,n=0,i,o=!!e.hold,s=!1,a,l,f=[],u=()=>f.reduce((b,g)=>b+g.json.length,0),d=()=>{if(!t.length)return;let{sessionId:b,windowId:g}=e.ids();i&&i!==b&&(n=0,e.onSessionChange?.()),i=b,f.push({json:p(b,g,n,t),parts:t,window:g,session:b,seq:n++,tries:0}),t=[],r=0},p=(b,g,S,k)=>`{"api_key":${JSON.stringify(e.apiKey)},"session_id":${JSON.stringify(b)},"window_id":${JSON.stringify(g)},"seq":${S},"events":[${k.join(",")}]}`,h=0,m=async b=>{try{let g=await on(b.json),S=await e.fetch(`${e.url}?compression=gzip`,{method:"POST",body:g,headers:{"Content-Type":"text/plain;charset=UTF-8"},credentials:"omit",keepalive:g.length<sn}),k=S.headers?.get?.("Retry-After")?.trim()??"";return h=/^\d+$/.test(k)?Math.min(Number(k),300)*1e3:0,S.status}catch{return 0}},c=()=>o||s?Promise.resolve():(l??=(async()=>{for(;f.length&&!o&&!s;){let b=f[0],g=await m(b);g>=200&&g<300?(f.shift(),e.onSent?.(b.session,b.json.length)):!Kt(g)||++b.tries>(e.maxRetries??5)?(e.log?.("replay chunk dropped",b.seq,g),f.shift(),e.onGap?.()):await new Promise(S=>setTimeout(S,Math.max(h,Zt(b.tries-1,e.backoff))))}})().finally(()=>{l=void 0}),l),v=()=>{a??=setTimeout(()=>{a=void 0,w()},e.flushMs)},w=()=>(a!==void 0&&clearTimeout(a),a=void 0,d(),o&&u()>fo&&(o=!1),c());return{add(b){if(s)return;let g=JSON.stringify(b);if(g.length>Vt-4096)return e.log?.("replay event too large",g.length);r&&r+g.length>e.chunkBytes&&w(),t.push(g),r+=g.length+1,r>=e.chunkBytes?w():v()},flush:w,beacon(){if(o||s)return;d();let b=f[0]?.seq??0,g=f[0]?.session;for(let S of f.splice(0)){S.session!==g&&([g,b]=[S.session,S.seq]);let k=I=>{let O=jt(p(S.session,S.window,b,I));if(O.length>sn&&I.length>1){k(I.slice(0,I.length>>1)),k(I.slice(I.length>>1));return}b++,navigator.sendBeacon?.(`${e.url}?compression=gzip`,new Blob([O],{type:"text/plain"}))};k(S.parts)}n=Math.max(n,b)},release(){o=!1,w()},discard(){s=!0,t=[],f.length=0,a!==void 0&&clearTimeout(a)},get unsent(){return r+u()},get seq(){return n},get held(){return o}}}var ln=(e,t)=>{let r=e(t);return r&&r.nodeType===1?r:null};function Pe(e,t,r){let n=i=>{i&&(i.type===2&&i.attributes&&r(i.attributes,(i.tagName??"").toLowerCase(),ln(t,i.id)),i.childNodes?.forEach(n))};if(e.type===2&&n(e.data?.node),!(e.type!==3||e.data?.source!==0)){e.data.adds?.forEach(i=>n(i.node));for(let i of e.data.attributes??[]){let o=ln(t,i.id);r(i.attributes,o?.tagName.toLowerCase()??"",o)}}}var ho=["title","alt","placeholder","aria-label","aria-description","aria-placeholder","aria-roledescription","aria-valuetext"],po=new Set(["input","textarea","select"]),un=e=>e.replace(/\S/g,"*");function cn(e,t){let r=i=>{try{return!!i?.closest(t)&&!i.closest(e)}catch{return!1}},n=(i,o,s)=>{if(!r(s))for(let a of Object.keys(i)){let l=i[a];(ho.includes(a)||a==="value"&&!po.has(o))&&typeof l=="string"&&(i[a]=un(l))}};return{maskTextFn:(i,o)=>r(o)?i:un(i),scrub:(i,o)=>Pe(i,o,n)}}var fn="data-lc-fixed";function dn(e,t){Pe(e,t,(r,n,i)=>{if(!(!i||fn in r))try{let o=getComputedStyle(i).position;(o==="fixed"||o==="sticky")&&(r[fn]="")}catch{}})}var hn=()=>window.parent!==window;function mo(){let e=location.ancestorOrigins;if(e?.length)return e[0];try{return document.referrer?new URL(document.referrer).origin:void 0}catch{return}}var pn=e=>{let t=mo();return!!t&&e.includes(t)};function mn(e){let t=r=>{let n=r.data;n&&typeof n=="object"&&n.type==="rrweb"&&!e.includes(r.origin)&&r.stopImmediatePropagation()};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)}var go=new Set(["Shift","Control","Alt","Meta","CapsLock","AltGraph"]);function gn(e,t,r=1e3){let n=0,i,o=()=>{i=void 0,n>0&&e(n)&&(n=0)},s=l=>{if(!(l instanceof Element))return!1;if(l instanceof HTMLInputElement&&l.type==="password")return!0;let f=t();try{return!!f&&!!l.closest(f)}catch{return!1}},a=l=>{l.repeat||go.has(l.key)||s(l.target)||(n++,i??=setTimeout(o,r))};return document.addEventListener("keydown",a,{capture:!0,passive:!0}),{flush:o,stop(){document.removeEventListener("keydown",a,{capture:!0}),i!==void 0&&clearTimeout(i),o()}}}function vn(e,t=1e3){let r=0,n,i=()=>{n=void 0;let s=Math.max(document.documentElement.scrollHeight,document.body?.scrollHeight??0);s>0&&s!==r&&(r=s,e(s))},o=()=>{n??=setTimeout(i,t)};return window.addEventListener("load",o),window.addEventListener("resize",o),{schedule:o,reset(){r=0,n!==void 0&&clearTimeout(n),i()},stop(){window.removeEventListener("load",o),window.removeEventListener("resize",o),n!==void 0&&clearTimeout(n)}}}function yn(){let e=[[]];return{push(t,r){r&&(e=[e[e.length-1],[]]),e[e.length-1].push(t)},drain(){let t=e.flat();return e=[[]],t},get size(){return e.reduce((t,r)=>t+r.length,0)}}}function bn(e,t,r){if(!e)return null;let n=null;try{let i=e.proxy&&new URL(e.proxy.url,location.href);i&&/^https?:$/.test(i.protocol)&&r.includes(i.origin)&&e.proxy?.origins.length&&(n={url:i.toString(),origins:[...e.proxy.origins]})}catch{}return{inlineImages:!!e.inlineImages&&!t,maxInlineBytes:e.maxInlineBytes??256*1024,collectFonts:!!e.collectFonts,proxy:n}}var vo=new Set(["img","source","video","audio","track","image","input"]),yo=/url\(\s*(['"]?)([^'")]+)\1\s*\)/g;function Sn(e){let t=o=>{if(!e.proxy||o.startsWith("data:"))return o;try{let s=new URL(o,location.href);return e.proxy.origins.includes(s.origin)?`${e.proxy.url}${e.proxy.url.includes("?")?"&":"?"}url=${encodeURIComponent(s.toString())}`:o}catch{return o}},r=o=>o.replace(yo,(s,a,l)=>{let f=t(l.trim());return f===l.trim()?s:`url(${a}${f}${a})`}),n=o=>o.split(",").map(s=>{let[a,...l]=s.trim().split(/\s+/);return a?[t(a),...l].join(" "):s}).join(", "),i=(o,s)=>{if(s==="img"&&typeof o.rr_dataURL=="string"&&o.rr_dataURL.length>e.maxInlineBytes&&delete o.rr_dataURL,!!e.proxy)for(let[a,l]of Object.entries(o))typeof l=="string"&&(a==="_cssText"||a==="style"?o[a]=r(l):a==="srcset"?o[a]=n(l):(a==="poster"||a==="src"&&vo.has(s)||a==="href"&&s==="link"||a==="xlink:href"&&s==="image")&&(o[a]=t(l)))};return{scrub(o,s){if(Pe(o,s,i),e.proxy&&o.type===3&&o.data?.source===8)for(let a of o.data.adds??[])typeof a.rule=="string"&&(a.rule=r(a.rule))}}}function bo(e,t,r){let n={x:0,y:0,width:e.width,height:e.height},i=[];try{i=r?.(e)??[]}catch{i=[n]}let o=t.flatMap(s=>{try{return e.matches(s.selector)?s.regions??[n]:[]}catch{return[n]}});return[...i,...o]}function wn(e){let t=new Map,r=document.createElement("canvas"),n=()=>{for(let o of Array.from(document.querySelectorAll("canvas"))){let s=e.idOf(o);if(!(s<=0||!o.width||!o.height||o.closest(e.skip)))try{r.width=o.width,r.height=o.height;let a=r.getContext("2d");if(!a)return;a.drawImage(o,0,0),a.fillStyle="#000";for(let d of bo(o,e.rules,e.regionsFn))a.fillRect(d.x,d.y,d.width,d.height);let l=r.toDataURL("image/jpeg",e.quality),f=l.slice(l.indexOf(",")+1);if(!f||t.get(s)===f)continue;t.set(s,f);let u={rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:f}],type:"image/jpeg"};e.emit({type:3,timestamp:Date.now(),data:{source:9,id:s,type:0,commands:[{property:"clearRect",args:[0,0,o.width,o.height]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[u]},0,0]}]}})}catch{}}},i=setInterval(n,Math.round(1e3/e.fps));return{reset:()=>t.clear(),tick:n,stop:()=>clearInterval(i)}}function Cn(e,t=Date.now){let r=e.eventsPerSecond??10,n=e.burst??100,i=n,o=t();return()=>{let s=t();return i=Math.min(n,i+(s-o)/1e3*r),o=s,i<1?!1:(i-=1,!0)}}var So=1e4;function Mn(e,t=Date.now){let r=new Map,n=0;return{allow(i){let o=i.data;return i.type!==3||o?.source!==0||!o.attributes?.length?!0:(r.size>So&&r.clear(),o.attributes=o.attributes.filter(s=>{let a=r.get(s.id);return a||r.set(s.id,a=Cn({burst:e.burst??100,eventsPerSecond:e.perSecond??10},t)),a()?!0:(n++,!1)}),!!(o.attributes.length||o.adds?.length||o.removes?.length||o.texts?.length))},get dropped(){return n}}}var wo=new Set([1,2,3,4,5,6,7,12]);function In(e){let t,r=!1,n=0;return{check(i){if(e<=0)return{keep:!0,resumed:!1};let o=i.timestamp??Date.now();if(t??=o,i.type===3&&wo.has(i.data?.source??-1)){t=o;let s=r&&n>0;return r=!1,n=0,{keep:!0,resumed:s}}return!r&&o-t>e&&(r=!0),r?(n++,{keep:!1,resumed:!1}):{keep:!0,resumed:!1}}}}function xn(e,t,r){let n=[],i;switch(t.mode){case"on_event":e.onCapture(o=>t.events.includes(o.event)&&r());break;case"on_flag":{let o=e.flags?.onChange(s=>s[t.flag]&&r());o&&n.push(o);break}case"on_url":try{i=new RegExp(t.pattern)}catch{e.log("bad on_url pattern",t.pattern)}break;case"on_frustration":{let o=[],s=a=>{let l=Date.now();for(o.push({t:l,x:a.clientX,y:a.clientY});o.length&&l-o[0].t>1e3;)o.shift();o.filter(u=>Math.hypot(u.x-a.clientX,u.y-a.clientY)<=30).length>=3&&r()};document.addEventListener("click",s,!0),n.push(()=>document.removeEventListener("click",s,!0));break}default:}return{checkUrl:o=>i?.test(o)&&r(),stop:()=>n.forEach(o=>o())}}var Co={on_event:"event_trigger_matched",on_url:"url_trigger_matched",on_flag:"linked_flag_matched",on_frustration:"frustration_detected"};function Mo(e){let t=parseInt(e.replace(/-/g,"").slice(0,12),16);return Number.isFinite(t)&&t>0?t:Date.now()}var Io=5*6e4,xo={$pageview:e=>({url:e.$current_url}),$pageleave:()=>({}),$form_start:e=>({form:e.form}),$form_submit:e=>({form:e.form}),$replay_tag:e=>({name:e.name})},ko="********";function Cs(e,t,r,n){let{core:i}=e,o=e.config.apiHost,s=t.trigger_groups,a=t.trigger.mode,l=a==="on_url"&&n?.url_trigger||a==="on_event"&&n?.event_trigger||a==="on_flag"&&n?.linked_flag,u=!(s.length>0||a!=="always"&&!l),d=t.min_duration_ms,p=!!(n?.url_trigger||n?.event_trigger||n?.linked_flag);r.startReason=u?p?"trigger_overridden":n?.sampling?"sampling_overridden":"recording_initialized":void 0;let h=!1,m=!1,c=!1,v,w=!1,b=yn(),g=t.min_duration_mode==="session"?Mo(i.sessionId):Date.now();r.bufferLength=()=>b.size;let S=()=>{r.status=w?"disabled":h?"paused":u?"active":"buffering"},k=()=>{try{ce.takeFullSnapshot(!0)}catch{}},I=an({url:`${o}/v1/replay`,apiKey:e.apiKey,fetch:e.fetch,ids:()=>({sessionId:i.sessionId,windowId:i.session.touch().windowId}),chunkBytes:t.chunk_bytes,flushMs:t.flush_interval_ms,hold:d>0||s.some(M=>(M.min_duration_ms??0)>0),onSent:(M,se)=>{r.flushedBytes+=se,r.ack(M)},onSessionChange:()=>k(),onGap:()=>k(),log:e.log}),O=vn(M=>{try{ce.addCustomEvent("page_height",{height:M})}catch{}}),R=Jt(t.url_privacy_rules),x=gt(R,location.href),U="",W="",B,E=()=>{U=["[data-lc-mask]",...t.mask_selectors,...x.mask].join(","),W=["[data-lc-block]",...t.block_selectors,...x.block].join(","),B=t.mask_all_text||x.maskAllText?cn(U,["[data-lc-unmask]",...t.unmask_selectors].join(",")):void 0};E(),r.bufferBytes=()=>I.unsent;let X=t.mutationThrottle?Mn(t.mutationThrottle):void 0;r.throttled=()=>X?.dropped??0;let Z=M=>{try{return M?[new URL(M).origin]:[]}catch{return[]}},N=bn(t.assets,t.mask_all_text||R.some(M=>M.mask_all_text),[location.origin,...Z(o),...Z(e.config.uiHost)]),F=N&&(N.proxy||N.inlineImages)?Sn(N):void 0,H=!!t.canvas&&(t.canvasMask.length>0||!!t.canvasMaskRegions),G,ge=t.maskUrlFn??(M=>Hr(M,e.config.urlPrivacy??{})),re=In(t.idle_threshold_ms),ve=(M,se)=>{if(h||w)return;let le=re.check(M);if(!le.keep||(le.resumed&&k(),X&&!X.allow(M)))return;M.type===2&&G?.reset();let be=Qe=>ce.mirror.getNode(Qe);if(B?.scrub(M,be),F?.scrub(M,be),dn(M,be),ge&&M.type===4&&typeof M.data?.href=="string"){let Qe=M.data;Qe.href=ge(Qe.href)}M.type===3&&M.data?.source===0&&O.schedule(),u?I.add(M):b.push(M,!!se)},ee=t.crossOriginIframes,ne=!!ee&&hn(),V=ne&&!pn(ee),ye=ee&&!ne?mn(ee):void 0,pe=V?void 0:gn(M=>{try{return ce.addCustomEvent("keys",{n:M}),!0}catch{return!1}},()=>[U,W,"[data-lc-ignore]"].filter(Boolean).join(",")),J=()=>{if(!(v||w||V)){try{v=ke()}catch(M){r.status="rrweb_error",r.rrwebError=String(M).slice(0,200);return}H&&t.canvas&&(G=wn({...t.canvas,skip:`${W},[data-lc-ignore]`,rules:t.canvasMask,regionsFn:t.canvasMaskRegions,idOf:M=>ce.mirror.getId(M),emit:M=>ve(M)})),O.reset(),S()}},ke=()=>ce({emit:ve,checkoutEveryNms:u?Io:t.buffer_ms/2,maskAllInputs:t.mask_all_inputs,maskInputOptions:{...t.maskInputOptions,password:!0},maskInputFn:t.maskInputFn??(()=>ko),maskTextSelector:B?"*":U,...B?{maskTextFn:B.maskTextFn}:t.maskTextFn&&{maskTextFn:t.maskTextFn},blockSelector:W,ignoreSelector:"[data-lc-ignore]",sampling:{mousemove:50,scroll:150,input:"last",...t.canvas&&!H&&{canvas:t.canvas.fps}},...t.canvas&&!H&&{dataURLOptions:{type:"image/jpeg",quality:t.canvas.quality}},...N?.inlineImages&&{inlineImages:!0},...N?.collectFonts&&{collectFonts:!0},errorHandler:M=>(r.rrwebErrors++,r.rrwebError=String(M).slice(0,200),!0),recordCrossOriginIframes:!!ee,slimDOMOptions:{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0},recordCanvas:!!t.canvas&&!H})??void 0,ie=()=>{v?.(),v=void 0,G?.stop(),G=void 0},A=(M,se)=>{if(!(u||w)){u=!0,r.startReason=M??Co[a]??"recording_initialized",se?.min_duration_ms!==void 0&&(d=se.min_duration_ms),r.minDurationMs=d;for(let le of b.drain())I.add(le);ie(),h||J(),T(),S()}},Q,T=()=>{!I.held||Q!==void 0||(Q=setTimeout(()=>I.release(),Math.max(0,d-(Date.now()-g))))},j=s.length?Yt(e,s,()=>i.sessionId,M=>A("trigger_group_matched",M),{url:n?.url_trigger,event:n?.event_trigger,flag:n?.linked_flag,sampling:n?.sampling}):void 0,oe=j??xn(e,t.trigger,()=>A());j&&(r.triggers=j.states,r.matchedGroups=j.matched);let K="",z=()=>{if(location.href===K)return;K=location.href;let M=gt(R,K),se=M.key!==x.key;se&&(x=M,E());let le=!!v,be=Xt(K,t.include_urls,t.exclude_urls);!be&&!m?(m=h=!0,ie(),b.drain(),I.flush(),S()):be&&m&&(m=!1,h=c,h||J(),S()),be&&oe.checkUrl(K),se&&le&&v&&(ie(),J())},Ue=setInterval(z,1e3),mt=window.navigation,Je=[],Te=()=>z();if(mt)mt.addEventListener("currententrychange",Te),Je.push(()=>mt.removeEventListener("currententrychange",Te));else for(let M of["pushState","replaceState"]){let se=history[M],le=function(...be){se.apply(this,be),z()};history[M]=le,Je.push(()=>{history[M]===le&&(history[M]=se)})}window.addEventListener("popstate",Te),window.addEventListener("hashchange",Te),Je.push(()=>(window.removeEventListener("popstate",Te),window.removeEventListener("hashchange",Te))),e.onCapture(M=>{M.event==="$pageview"&&z();let se=xo[M.event];if(!(!se||h||w||!v))try{let le=se(M.properties);ge&&typeof le.url=="string"&&(le.url=ge(le.url)),ce.addCustomEvent(M.event,le)}catch{}});let qt=()=>{document.visibilityState==="visible"?u&&v&&ce.takeFullSnapshot(!0):I.beacon()};return document.addEventListener("visibilitychange",qt),e.onUnload(()=>{I.held?I.discard():I.beacon()}),z(),j?.check(),h||J(),u&&T(),S(),{stop:()=>{w=!0,ie(),clearInterval(Ue);for(let M of Je)M();clearTimeout(Q),document.removeEventListener("visibilitychange",qt),ye?.(),O.stop(),pe?.stop(),oe.stop(),b.drain(),I.discard(),S()},paused:()=>h,pause(){c||w||(c=h=!0,ie(),b.drain(),I.flush(),S())},resume(){!c||w||(c=!1,h=m,h||J(),S())}}}export{Cs as startRecorder};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as g,c as y,d as P,e as v,f as E,g as b,i as O,j as D}from"./chunk-NIDQQHZJ.js";import"./chunk-O4W7SZ2X.js";var S="lc_replay_ack",U=()=>{try{let e=sessionStorage.getItem(S);return e?[e]:[]}catch{return[]}};function x(){let e={status:"awaiting_config",disabledReason:void 0,startReason:void 0,sampleRate:void 0,minDurationMs:void 0,triggers:void 0,matchedGroups:void 0,bufferLength:void 0,flushedBytes:0,confirmed:new Set(U()),rrwebError:void 0,rrwebErrors:0,bufferBytes:void 0,throttled:void 0};return Object.assign(e,{ack(t){if(!e.confirmed.has(t)){e.confirmed.add(t);try{sessionStorage.setItem(S,t)}catch{}}},props(t){let o=e.triggers?.(),r={$recording_status:e.status,$has_recording:e.confirmed.has(t)};e.disabledReason&&(r.$replay_disabled_reason=e.disabledReason),e.startReason&&(r.$session_recording_start_reason=e.startReason),e.sampleRate!==void 0&&(r.$replay_sample_rate=e.sampleRate),e.minDurationMs!==void 0&&(r.$replay_minimum_duration=e.minDurationMs),o&&(r.$replay_url_trigger_status=o.url,r.$replay_event_trigger_status=o.event,r.$replay_linked_flag_trigger_status=o.flag);let l=e.matchedGroups?.();l?.length&&(r.$replay_trigger_groups_matched=l),e.bufferLength&&(r.$replay_buffer_length=e.bufferLength()),e.flushedBytes&&(r.$replay_flushed_size=e.flushedBytes),e.rrwebError&&(r.$replay_rrweb_error=e.rrwebError),e.rrwebErrors&&(r.$replay_rrweb_error_count=e.rrwebErrors);let n=e.bufferBytes?.();n&&(r.$replay_buffer_size=n);let s=e.throttled?.();return s&&(r.$replay_throttled_mutations=s),r}})}var $="lucida_replay_url";function k(e,t,o,r=2e3){let l={},n=()=>{if(!o())return;let i=globalThis,d=t();try{e.intercom&&typeof i.Intercom=="function"&&l.intercom!==d&&(i.Intercom("update",{[$]:d}),l.intercom=d),e.crisp&&typeof i.$crisp?.push=="function"&&l.crisp!==d&&(i.$crisp.push(["set","session:data",[[[$,d]]]]),l.crisp=d)}catch{}};n();let s=setInterval(n,r);return()=>clearInterval(s)}var L=e=>{let t=x();e.eventExtras.push(a=>t.props(a));let o=e.config.replay??{},r=a=>{t.status="disabled",t.disabledReason=a};if(o.enabled===!1)return r("disabled_locally");if(!v(e.config.replayOwner??o.owner))return r("owner_watchtower");if(navigator.connection?.saveData)return r("data_saver");let n="idle",s,i=0,d=!1,j=location.href,R=()=>e.core.hasConsent("analytics")&&e.core.hasConsent("replay"),m=async a=>{if(n!=="idle")return;if(!R())return r("no_consent");n="starting",t.status="awaiting_config";let u=++i,p=await e.loadConfig(),f=g(p?.replay_never_record,j)||!!a&&g(p?.replay_never_record,location.href),c=f?null:y(o,p);if(u!==i)return void(n="idle");if(!c)return r(f?"never_record_page":"remote_disabled"),void(n="idle");let M=e.core.sessionId,w=c.trigger_groups.length>0,T=!!a?.sampling||w||b(M,"",c.sample_rate);if(t.sampleRate=w?void 0:c.sample_rate,t.minDurationMs=c.min_duration_ms,!T)return t.status="sampled",void(n="idle");t.status="lazy_loading",t.disabledReason=void 0;let{startRecorder:I}=await import("./recorder-3YIZ6OKD.js");if(u!==i)return void(n="idle");s=I(e,c,t,a),n="on"},h=()=>{i++,s?.stop(),s=void 0,n="idle"};e.replay={start:async a=>{d=!1;let u=a===!0,p=f=>u||typeof a=="object"&&!!a[f];await m({sampling:a===void 0||p("sampling"),url_trigger:p("url_trigger"),event_trigger:p("event_trigger"),linked_flag:p("linked_flag")})},stop:()=>{d=!0,h(),r("stopped_manually")},pause:()=>s?.pause(),resume:()=>s?.resume(),tag:a=>e.client.capture("$replay_tag",{name:a,session_id:e.core.sessionId}),isRecording:()=>n==="on"&&!s?.paused()},e.core.onChange(a=>{a==="consent"&&(R()?d||m():(h(),r("no_consent")))}),m();let _=o.supportWidgets,C=_?.intercom||_?.crisp?k(_,()=>e.client.getReplayUrl(),()=>n==="on"&&!s?.paused()):void 0;return()=>{i++,s?.stop(),C?.()}};export{E as fnv1a32,v as lucidaRecords,D as pagePrivacy,g as policyMatches,L as replay,y as resolveReplay,b as sampled,P as urlAllowed,O as urlRules};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var yn=Object.defineProperty;var N=(e,t)=>()=>(e&&(t=e(e=0)),t);var ye=(e,t)=>{for(var n in t)yn(e,n,{get:t[n],enumerable:!0})};function F(e){let t=[];for(let n=e;n&&t.length<bn;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,bn,de=N(()=>{"use strict";Ve=/^[A-Za-z_][\w-]*$/,bn=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):xn(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(kn))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"||wn())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 xn,kn,wn,Oe=N(()=>{"use strict";Ye();xn=e=>{if(typeof e!="string"||!e)return!1;try{return!!document.querySelector(e)}catch{return!1}};kn="input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]),textarea";wn=()=>{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&&En.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(_n.has(e.kind)&&e.steps.length!==1)return`A ${e.kind} has exactly one step`;let t=An[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(Sn.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(Cn))return"fill needs a text field"}return null}function Tn(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=Tn(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,En,_n,Sn,An,Cn,He,ot,re=N(()=>{"use strict";de();Oe();ke=["data-lc-id","data-testid","data-test","data-cy","data-qa"],En=/^[A-Za-z_][\w-]*$/,_n=new Set(["tooltip","modal","banner","announcement","hotspot","beacon","badge","slideout","inline"]),Sn=new Set(["tooltip","tour","hotspot","beacon","badge","inline"]),An={carousel:[1,10],form_validation:[1,30]},Cn="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:{}})});async function ct(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 dt(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 pt(e,t){let n=De();t===null?delete n[e]:n[e]=t;try{localStorage.setItem(ut,JSON.stringify(n))}catch{}}function De(){try{return JSON.parse(localStorage.getItem(ut)??"{}")}catch{return{}}}var _e,Ie,se,ae,Se,ut,ie=N(()=>{"use strict";_e="guides:write",Ie="experiments:write",se="__lc_edit",ae="__lc_toolbar",Se=e=>(e.config.uiHost??e.config.apiHost??"").replace(/\/+$/,"");ut="lc_flag_overrides"});function Ae(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)?Gn.test(t):/^(https?:)?\/\//i.test(t)||!/^[a-z][a-z0-9+.-]*:/i.test(t):!1}function Un(e){let t=e.trim();return/^(https?:|mailto:|tel:)/i.test(t)||!/^[a-z][a-z0-9+.-]*:/i.test(t)}function Kn(e){for(let{name:t,value:n}of[...e.attributes]){let o=t.toLowerCase();(jn.has(o)||o.startsWith("aria-")||o.startsWith("data-")&&!o.startsWith("data-lc"))&&(o!=="href"||Un(n))&&(o!=="src"||ue(n))&&(o!=="srcset"||Bn(n))&&(o!=="style"||Fn(n))||e.removeAttribute(t)}e.getAttribute("target")==="_blank"&&e.setAttribute("rel","noopener noreferrer")}function gt(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(Dn.has(o)){n.remove();continue}if(gt(n),!Nn.has(o)){n.replaceWith(...n.childNodes);continue}Kn(n)}}function ht(e){let t=document.createElement("template");return t.innerHTML=e,gt(t.content),document.importNode(t.content,!0)}var Dn,Nn,jn,Gn,Bn,Fn,vt=N(()=>{"use strict";Dn=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"]),Nn=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"]),jn=new Set(["class","id","title","alt","href","src","srcset","sizes","width","height","role","target","rel","colspan","rowspan","loading","decoding","lang","dir","style","datetime","media"]),Gn=/^data:image\/(png|jpe?g|gif|webp|avif);/i;Bn=e=>e.split(",").every(t=>ue(t.trim().split(/\s+/)[0]??"")),Fn=e=>!/url\s*\(|expression\s*\(|@import|behavior\s*:|javascript:/i.test(e)});function yt(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"||zn.has(o.type))&&(t===void 0||!o.url||t.includes(o.url))):[]}function Vn(e,t){let n=yt(t),o=(e.getAttribute(Te)??"").split(" ").filter(Boolean);if(o.includes(n)||!Jn.has(t.position)||typeof t.html!="string")return;let r=ht(t.html);for(let i of[...r.children])i.setAttribute(Ce,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 Yn(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&&Xn(t.srcset)?e.setAttribute("srcset",t.srcset):e.removeAttribute("srcset"),typeof t.alt=="string"&&e.setAttribute("alt",t.alt))}}function Zn(e,t,n){let o=yt(e);if(n.querySelector(`[${Ce}="${o}"]`))return;let r;if(e.type==="css"){if(typeof e.css!="string")return;r=n.importNode(Ae(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(Ce,o),n.head.append(r)}function Qn(e,t){let n=e;switch(t.type){case"text":e.textContent=t.value;break;case"attr":if(Wn.test(t.name)||typeof t.value=="string"&&/^(href|src|action|formaction)$/i.test(t.name)&&qn.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":Vn(e,t);break;case"image":Yn(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&&Zn(r,n,s);continue}let i;try{i=[...t.querySelectorAll(r.selector)]}catch{continue}i.length||o.push(r);for(let s of i)Qn(s,r)}return o}function bt(e=document){for(let t of[...e.querySelectorAll(`[${Ce}]`)])t.remove();for(let t of[...e.querySelectorAll(`[${Te}]`)])t.removeAttribute(Te)}var pe,Ce,Wn,qn,zn,Jn,Te,Xn,Re=N(()=>{"use strict";Ne();vt();pe="lc_changes",Ce="data-lc-change",Wn=/^on/i,qn=/^\s*(javascript|data|vbscript):/i,zn=new Set(["css","js"]),Jn=new Set(["before","after","prepend","append"]),Te="data-lc-inserted";Xn=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=()=>{bt();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>eo&&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 xt(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 eo,Ge=N(()=>{"use strict";de();Re();eo=100});function ao(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(ao(n),"i").test(t)}catch{return!1}})}var Mt=N(()=>{"use strict"});function Ht(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,Pt=N(()=>{"use strict";Re();Me={desktop:0,tablet:768,mobile:375}});function It(e=document){let t=[],n=new Set;for(let o of e.querySelectorAll(ho)){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>=vo)break}return t}var ho,vo,Dt=N(()=>{"use strict";re();ho="h1,h2,h3,button,a,img,[role=button],section[id],header,nav,footer,form label,li",vo=150});var jt={};ye(jt,{experimentEditor:()=>yo,withChanges:()=>Nt});function Nt(e,t,n){return e.variants.map(o=>o.key===t?{...o,payload:{...o.payload,[pe]:n}}:o)}async function yo(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=Ht(()=>d.changes()),w=()=>{},f=()=>{let x=n.variants.find(C=>C.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,C)=>{let O=J("li",{textContent:`${x.type} ${x.selector??"(page)"}${x.url?` (on ${x.url})`:""} `});O.append(Q(`Remove change ${C+1}`,()=>d.remove(C))),s.append(O)}),a.disabled=!d.canUndo(),u.disabled=!d.canRedo()},l=xt(()=>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,C,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[C](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(),C=h.files?.[0];if(h.value="",!x||!C)return;let O=await e.api.uploadAsset(C);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 C=e.picked();if(!C)return e.note("Inspect an element first");x(C),b()},E=(x,C,O)=>Q(x,v(H=>{let g=window.prompt(C);g!==null&&O(H,g)})),A=J("input",{placeholder:"Goal name"}),S=Q("Save variant",async()=>{let x=await e.api.saveVariants(n.id,Nt(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(!A.value.trim())return e.note("Name the goal first");let C=x.textContent?.trim().slice(0,100),O=await e.api.addGoal(n.id,{name:A.value.trim(),selector:ee(x),...C?{text:C}:{},url:location.pathname});e.note(O?`Goal "${A.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,C)=>d.text(x,C)),E("Style","CSS as property:value",(x,C)=>{let[O,...H]=C.split(":");O&&H.length&&d.style(x,O.trim(),H.join(":").trim())}),E("Attribute","name=value (empty value removes)",(x,C)=>{let[O,...H]=C.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,C)=>{let[O,...H]=C.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,C)=>d.image(x,C.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(It());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",A),L),new MutationObserver((x,C)=>{t.isConnected?t.dataset.mounted="1":t.dataset.mounted&&(l(),y.close(),w(),C.disconnect())}).observe(document.body,{childList:!0,subtree:!0}),f(),t}var J,Q,fe,Gt=N(()=>{"use strict";Re();ie();Ge();Pt();re();Dt();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 Bt(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 Ft(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 Ut,$e,Kt=N(()=>{"use strict";Ut=".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 ko(e,t=wo()){if(!e?.dark?.tokens)return!1;let n=e.theme_mode??"auto";return n==="dark"||n==="auto"&&t}function wo(){try{return typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches}catch{return!1}}function qt(e,t){let n={...e?.font_family?{font:e.font_family}:{},...e?.tokens};return ko(e,t)?{...n,...e?.dark?.tokens}:n}function zt(e,t){let n=o=>typeof o=="string"&&bo.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"&&xo.test(t.font)&&(e.style.fontFamily=t.font),t?.shadow&&t.shadow in Wt&&(e.style.boxShadow=Wt[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 bo,xo,Wt,Jt=N(()=>{"use strict";bo=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i,xo=/^[\w\s,'"-]{1,100}$/,Wt={none:"none",sm:"0 1px 4px rgba(0,0,0,.15)",lg:"0 8px 32px rgba(0,0,0,.3)"}});var Qt={};ye(Qt,{listed:()=>Xt,renderModule:()=>Ao,resetAssist:()=>Eo,searchHref:()=>Yt});function R(e,t){let n=document.createElement(e);return t!==void 0&&(n.textContent=t),n}function Xt(e,t){return e.guide_ids?.length?e.guide_ids.flatMap(n=>t.find(o=>o.id===n)??[]):t.filter(n=>Vt.has(n.kind))}function Yt(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 Ao(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 Xt(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=>So.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=>Vt.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(Zt(l,t));u.replaceChildren(),t.assist&&!We&&y?Co(y,f.length,t,u):t.assist?.searched({query:y,results:f.length,answered:!1});let b=Yt(e,i.value);b&&window.open(b,"_blank","noopener,noreferrer")},o.append(u),n.append(o)}return n}function Zt(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 Co(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=_o(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(Zt(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,Eo,_o,Vt,So,en=N(()=>{"use strict";We=!1,Eo=()=>{We=!1},_o=e=>{try{let t=new URL(e);return t.protocol==="https:"?t.href:null}catch{return null}},Vt=new Set(["tour","checklist","modal","slideout"]),So=new Set(["announcement","banner"])});function To(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 Ro(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 Ho(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"||!Lo.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 Po(e,t,n){e.addEventListener("keydown",o=>{if(o.key==="Escape")return n();if(o.key!=="Tab")return;let r=[...e.querySelectorAll(Oo)];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 Io(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 tn(e,t,n,o={}){let r=document.createElement("div");r.setAttribute("data-lc-ignore","");let i=r.attachShadow({mode:"open"});i.append(Ae($o,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??Ro)(m),A=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())},C=m=>{if(m.action==="next"||m.action==="start_tour")A(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:To(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=()=>C(W),U.append(X)}return U},H=m=>[...m.title?[z("h2",m.title)]:[],...m.body?[z("p",m.body)]:[],...(m.media??[]).flatMap(M=>Ho(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&&C(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(()=>(en(),Qt)).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?Bt(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"}`,zt(l,qt(e.appearance)),(e.kind==="modal"||M)&&l.setAttribute("aria-modal","true"),M&&w.push(Ft(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"),Io(l,K,m.placement);let q=m.advance==="click"?"click":m.advance==="input"?"change":null;if(!q)return;let ce=()=>A();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()}Po(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 Mo,$o,Lo,Oo,nn=N(()=>{"use strict";Ne();Kt();Oe();Jt();Mo=".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}",$o=Mo+Ut,Lo=["www.youtube-nocookie.com","www.youtube.com","player.vimeo.com","www.loom.com","fast.wistia.net"],Oo="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 No(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 on(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=No(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&&Do.test(u)&&(a.font_family=u),a}var Do,rn=N(()=>{"use strict";Do=/^[\w\s,'"-]{1,100}$/});async function sn(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 an(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 sn(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 sn(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=on(),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,ln=N(()=>{"use strict";re();rn();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 cn={};ye(cn,{guideBuilder:()=>Uo});function Uo(e){let t=I("div"),n=He(),o,r=!!e.scopes?.includes(_e),i=an({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 jo)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 Go)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"),A=I("div");A.style.whiteSpace="pre-wrap";let S="",L=()=>{E.textContent=S?`Element: ${S}`:"No element picked",A.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},C=()=>{x(),o?.();let g=ot(n);if(!g.steps.length)return e.note("Add a step first");o=tn(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())),A,te("Preview",C),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 jo,Go,I,te,dn=N(()=>{"use strict";nn();ie();re();ln();jo=["tooltip","modal","banner","tour","checklist","resource_center","announcement","hotspot","beacon","badge","launcher","slideout","inline","carousel","form_validation"],Go=["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 fn={};ye(fn,{CHECK_MESSAGE:()=>un,CHECK_PARAM:()=>Bo,describeResult:()=>mn,parseCheck:()=>Fo,resolveSteps:()=>pn,runCheck:()=>Wo});function Fo(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 pn(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(Ko),onPage:!n.url||t.includes(n.url),invalid:o}})}async function Wo(e,t,n=1500){t("Checking guide selectors on this page..."),await new Promise(r=>setTimeout(r,n));let o=pn(e);t(o.map(mn).join(`
|
|
3
|
+
`)||"The guide has no anchored steps");try{window.opener?.postMessage({type:un,url:location.href,results:o},e.origin)}catch{}return o}var Bo,un,Ko,mn,gn=N(()=>{"use strict";Bo="__lc_check",un="lc:guide-check";Ko=e=>{let t=e.getBoundingClientRect();return t.width>0&&t.height>0};mn=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 Rn(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 Mn(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([Mn(Rn(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 $n=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<=$n?{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 Ln(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 On(e,t=document,n=location.href){if(!Ln(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 A=Z(E.map(S=>[S,S]),c[h]??E[0]);return A.onchange=()=>{c[h]=A.value},P(v,A)},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=>On(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 A=k("div",`${v.name} (${E.length} on this page)`,"margin:2px 0");return A.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())})),A})),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 mt=500,Hn=new Set(["$snapshot","$replay_tag","$rageclick","$deadclick","$heatmap_moves","$attention"]),Pn=e=>Hn.has(e)?"replay":e.startsWith("$")?"system":"custom";function In(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 ft(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=In(n.value),p=u.filter(c=>c.pinned||(o.value==="all"||Pn(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}`),A=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(A)}),k("pre",A,"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>mt&&(u=u.filter((c,h)=>c.pinned||h>=u.length-mt)),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 to(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 no=e=>e===void 0?Ue:typeof e=="boolean"?String(e):`v:${e}`,oo=e=>e===Ue?null:e==="true"?!0:e==="false"?!1:e.slice(2);function kt(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(to(a.find(c=>c.key===b),y[b]??s[b]),no(y[b]));return l.onchange=()=>{pt(b,oo(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 wt(e){return e<768?"mobile":e<1024?"tablet":"desktop"}var Et=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#17becf","#bcbd22","#3b4cc0","#f4a582","#006d2c"],_t=(e,t)=>t[e]?.value==="(other)"?"#9e9e9e":Et[e%Et.length]??"#9e9e9e",St=[["","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 At(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=_t(d,e.legend),i.beginPath(),i.arc(a*s,u,3,0,Math.PI*2),i.fill());return n}function Ct(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:${_t(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 Tt=()=>({w:document.documentElement.scrollWidth,h:document.documentElement.scrollHeight}),le=(e=location.pathname)=>e.length>1&&e.replace(/\/+$/,"")||"/";function ro(e){let{w:t,h:n}=Tt(),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 io(e){let{h:t}=Tt(),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 so(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 Rt(e){let t=k("div"),n=Z([["click","Clicks"],["rage","Rage clicks"],["dead","Dead clicks"],["move","Mouse movement"],["scroll","Scrollmap"]]),o=Z(St),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=()=>wt(window.innerWidth),l=()=>{for(let v of d)v.remove();d=[],a.replaceChildren(),w.forEach((v,E)=>{let A=`${E+1}: ${v.clicks} clicks${v.rage_clicks?`, ${v.rage_clicks} rage`:""}`,S=so(v,i.checked);for(let x of S){let C=be(x.getBoundingClientRect(),A,v.rage_clicks?"#f55":"#4af");document.body.append(C),d.push(C)}let L=k("div",`${A} ${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=At(o.value,r.value);if(v==="click"&&E){let A=await e.api.confetti(le(),b(),E);if(!A)return e.note("No confetti data");let S=new Set,L=Be(A,S);u=L,s.append(Ct(A,S,()=>{Be(A,S,L)})),e.note(`${A.dots.length} clicks on ${le()} (${b()}) coloured by ${E}`),await p(!1)}else if(v==="scroll"){let A=await e.api.scroll(le(),b());if(!A)return e.note("No scroll data");u=io(A)}else{let A=await e.api.heat(le(),b(),v);if(!A)return e.note("No heatmap data");u=ro(A),e.note(`${A.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}}Mt();var $t=255,lo=new Set(["input","textarea","select","option"]),co="[data-lc-mask],.lc-mask,[data-lc-no-capture],.lc-no-capture,[data-lc-block]",uo=new Set(["value","password","autocomplete"]),po=/(?:\d[ -]?){9,}/;function mo(e){if(!e||lo.has(e.tagName.toLowerCase())||e.isContentEditable)return!1;try{return!e.closest(co)}catch{return!1}}function fo(e,t){if(e.source==="attribute"){let o=(e.attribute??"").toLowerCase();if(!o||uo.has(o)||o.startsWith("on"))return;let r=t.getAttribute(o);return r===null?void 0:r.slice(0,$t)}let n=(t.textContent??"").replace(/\s+/g," ").trim();if(!(!n||po.test(n)))return n.slice(0,$t)}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(!mo(s))continue;let a=fo(i,s);a!==void 0&&(r[i.name]=a)}return r}de();ie();var go=new Set(["input","textarea","select","option"]);function Lt(e,t){if(!e)return"Inspect an element first";if(go.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 Ot(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=Lt(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=Lt(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 vn="lc_toolbar_session",Le="lc_toolbar_edit",Je="lc_toolbar_check",qo="lc_toolbar_recording",ve="__lc_check";function hn(){try{let e=JSON.parse(sessionStorage.getItem(vn)??"null");return e&&(!e.expires_at||Date.parse(e.expires_at)>Date.now())?e:null}catch{return null}}function zo(){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 Ci=e=>{if(location.hash==="#lc-device-preview")return;let t=zo(),n,o=async r=>{let i=hn();return r&&(i=await ct(e,r),i&&sessionStorage.setItem(vn,JSON.stringify(i))),i?(n?.(),n=Jo(e,i),!0):!1};return e.toolbar={load:r=>o(r)},(t||hn())&&o(t),()=>n?.()};function Jo(e,t){let n=dt(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 A=E?T("Actions",()=>{E.node.hidden=!E.node.hidden,A?.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)),C=(_,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(()=>(Gt(),jt));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(()=>(dn(),cn));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"))),...A&&E?[A,E.node]:[],v("Heatmap",()=>Rt({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",()=>kt(e,n)),v("Event debugger",()=>ft(e)),...o("actions:write")?[v("Snapshot properties",()=>Ot({host:e,session:t,picked:()=>y,note:d}))]:[],G,g,k("hr"),k("b","Visual editor"),k("br"),C("Text","New text",(_,j)=>S.text(_,j)),C("Style","CSS as property:value",(_,j)=>{let[D,...B]=j.split(":");D&&B.length&&S.style(_,D.trim(),B.join(":").trim())}),C("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(qo)&&G.click();let V=sessionStorage.getItem(Je);return V&&(sessionStorage.removeItem(Je),Promise.resolve().then(()=>(gn(),fn)).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,ct as exchangeToken,De as getFlagOverrides,pt as setFlagOverride,Ci as toolbar,dt as toolbarApi,Se as toolbarHost};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as x,f as E,g as L,j as w}from"./chunk-FUE3SDQU.js";var k=/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/,A=/^\+?[\d\s().-]{7,20}$/,G=".v{position:fixed;z-index:2147483000;background:#fff;color:#b42318;border:1px solid #f04438;border-radius:6px;padding:6px 10px;font:13px system-ui;max-width:280px;box-shadow:0 2px 8px rgba(0,0,0,.15)}";function H(t,l){let n=t.trim();for(let e of l){if(e.type==="required"){if(!n)return e;continue}if(!n)continue;let u=typeof e.value=="number"?e.value:Number(e.value);if(e.type==="email"&&!k.test(n)||e.type==="url"&&!N(n)||e.type==="phone"&&!(A.test(n)&&n.replace(/\D/g,"").length>=7)||e.type==="regex"&&!T(n,e.value)||e.type==="min_length"&&Number.isFinite(u)&&n.length<u||e.type==="max_length"&&Number.isFinite(u)&&n.length>u||e.type==="number"&&!Number.isFinite(Number(n)))return e}return null}function N(t){try{return/^https?:$/.test(new URL(t).protocol)}catch{return!1}}function T(t,l){if(typeof l!="string"||l.length>500)return!0;try{return new RegExp(l).test(t)}catch{return!0}}var M=t=>t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement?t.value:null;function $(t,l,n,e={}){let u=document.createElement("div");u.setAttribute("data-lc-ignore","");let p=u.attachShadow({mode:"open"});p.append(x(G,e.nonce)),document.body.append(u);let v=new WeakSet,m=new Map,f=[],b=!1,g=(r,i,d)=>{let s=M(i);if(s===null)return!0;let a=H(s,d);if(m.get(r)?.remove(),m.delete(r),i.removeAttribute("aria-invalid"),!a)return!0;let o=document.createElement("div");o.className="v",o.setAttribute("role","alert"),o.textContent=a.message;let c=E(t.appearance);return delete c.background,delete c.text,L(o,c),p.append(o),w(o,i,"bottom"),m.set(r,o),i.setAttribute("aria-invalid","true"),l.validationFailed?.(r,a.type),!1},y=()=>{for(let r of t.steps){let i=r.validation;if(!i?.selector||!i.rules?.length)continue;let d;try{d=[...document.querySelectorAll(i.selector)]}catch{continue}for(let s of d){if(v.has(s))continue;v.add(s);let a=()=>{g(r.id,s,i.rules)};s.addEventListener("blur",a),f.push(()=>s.removeEventListener("blur",a));let o=s.closest("form");if(!o)continue;let c=h=>{g(r.id,s,i.rules)||(h.preventDefault(),h.stopPropagation())};o.addEventListener("submit",c,!0),f.push(()=>o.removeEventListener("submit",c,!0))}}},R=setInterval(y,500);return y(),l.shown(),()=>{if(!b){b=!0,clearInterval(R);for(let r of f)r();u.remove(),n()}}}export{H as failedRule,$ as renderValidation};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var l="lc_agent_session",p=Symbol.for("lucida.webmcp.wrapped"),f=e=>e,d=200;function m(e,t){let r=e.execute;if(typeof r!="function"||f(r)[p])return e;let a=String(e.name??"").slice(0,d),u=function(...c){let i=performance.now(),n=s=>t(a,s,Math.round(performance.now()-i)),o;try{o=r.apply(this,c)}catch(s){throw n(!1),s}return o&&typeof o.then=="function"?o.then(()=>n(!0),()=>n(!1)):n(!0),o};return f(u)[p]=!0,{...e,execute:u}}var g=e=>{let t=navigator.modelContext;if(!t)return;let{core:r}=e,a=()=>{try{return r.storage.get(l)??null}catch{return null}};e.eventExtras.push(n=>a()===n?{$agent_session:!0}:{});let u=(n,o,s)=>{try{r.storage.set(l,r.sessionId)}catch{}e.client.capture("$agent_action",{tool:n,status:o?"ok":"error",duration_ms:s,$agent_session:!0,$agent_protocol:"webmcp"})},{provideContext:c,registerTool:i}=t;return typeof c=="function"&&(t.provideContext=function(n){let o=n?.tools,s=Array.isArray(o)?o.map(w=>m(w,u)):o;return c.call(this,{...n,tools:s})}),typeof i=="function"&&(t.registerTool=function(n){return i.call(this,n&&typeof n=="object"?m(n,u):n)}),()=>{c&&(t.provideContext=c),i&&(t.registerTool=i)}};export{g as webmcp,m as wrapTool};
|