@scalebun/web 1.3.0 → 1.3.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.
@@ -1,5 +1,5 @@
1
- "use strict";(()=>{var og=Object.defineProperty;var E=(n,e)=>()=>(n&&(e=n(n=0)),e);var L=(n,e)=>{for(var t in e)og(n,t,{get:e[t],enumerable:!0})};function H(){let n=typeof crypto!="undefined"?crypto:void 0;if(n&&typeof n.randomUUID=="function")return n.randomUUID();let e=typeof performance!="undefined"?performance.now():0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let r=(Math.floor(e)+Math.floor(Math.random()*16))%16;return(t==="x"?r:r&3|8).toString(16)})}function P(){return Date.now()}function Xa(){try{if(typeof localStorage!="undefined"){let n=localStorage.getItem(Ga);if(n)return n;let e=`web_${H()}`;return localStorage.setItem(Ga,e),e}}catch{}return`web_${H()}`}var Ga,Ya=E(()=>{"use strict";Ga="scalebun_device_id"});function Ja(n){return(...e)=>{n&&typeof console!="undefined"&&console.info(Ls,...e)}}var Ls,_s=E(()=>{"use strict";Ls="[scalebun]"});var Qa=E(()=>{"use strict"});function Za(){return{platform:"web",renderer:"dom",sdk:{name:cg,version:Os}}}function ec(n){let e=typeof navigator!="undefined"?navigator.userAgent:"",{browser:t,os:r}=lg(e);return{id:n,browser:t.name,browserVersion:t.version,os:r.name,osVersion:r.version}}function tc(n){return{version:n.appVersion,environment:n.environment,release:n.release}}function nc(){let n={};try{typeof navigator!="undefined"&&(n.locale=navigator.language),n.timezone=Intl.DateTimeFormat().resolvedOptions().timeZone,typeof location!="undefined"&&(n.url=location.href),typeof window!="undefined"&&(n.viewport={width:window.innerWidth,height:window.innerHeight});let e=navigator==null?void 0:navigator.connection;e!=null&&e.effectiveType&&(n.networkType=e.effectiveType)}catch{}return n}function lg(n){var s,i,o,a,c,l,u,d,p;let e={},t={},r=(s=/(Edg|OPR)\/([\d.]+)/.exec(n))!=null?s:/(Chrome|Firefox|Safari)\/([\d.]+)/.exec(n);return r&&r[1]&&(e.name=(i={Edg:"Edge",OPR:"Opera"}[r[1]])!=null?i:r[1],e.version=(o=r[2])==null?void 0:o.split(".")[0]),/Windows NT ([\d.]+)/.test(n)?(t.name="Windows",t.version=(a=/Windows NT ([\d.]+)/.exec(n))==null?void 0:a[1]):/Mac OS X ([\d_]+)/.test(n)?(t.name="macOS",t.version=(l=(c=/Mac OS X ([\d_]+)/.exec(n))==null?void 0:c[1])==null?void 0:l.replace(/_/g,".")):/Android ([\d.]+)/.test(n)?(t.name="Android",t.version=(u=/Android ([\d.]+)/.exec(n))==null?void 0:u[1]):/(iPhone|iPad).+OS ([\d_]+)/.test(n)?(t.name="iOS",t.version=(p=(d=/OS ([\d_]+)/.exec(n))==null?void 0:d[1])==null?void 0:p.replace(/_/g,".")):/Linux/.test(n)&&(t.name="Linux"),{browser:e,os:t}}var cg,Os,rc=E(()=>{"use strict";cg="@scalebun/web",Os="1.3.0"});function j(n){return n.replace(/[\w.+-]+@[\w-]+\.[\w.-]+/g,"[email]").replace(/\b[A-Za-z0-9_-]{24,}\b/g,"[token]")}function fg(n){return n.replace(ug,"[email]").replace(pg,"[redacted]")}function mt(n,e=0){if(n==null||e>4)return n;if(typeof n=="string")return fg(n);if(Array.isArray(n))return n.slice(0,1e3).map(t=>mt(t,e+1));if(typeof n=="object"){let t={},r=0;for(let s in n){if(r++>200)break;if(!Object.prototype.hasOwnProperty.call(n,s))continue;let i=n[s];t[s]=dg.test(s)?"[redacted]":mt(i,e+1)}return t}return n}var dg,ug,pg,Ns=E(()=>{"use strict";dg=/pass(word|wd)?|secret|token|api[_-]?key|authorization|auth|ssn|social|credit|card[_-]?(number|num)|cardnum|cvv|cvc/i,ug=/[\w.+-]+@[\w-]+\.[\w.-]+/g,pg=/\b\d[\d -]{11,18}\d\b/g});function sc(n){try{let e=ic()[n];if(!e)return!1;let t="__scalebun_probe__";return e.setItem(t,"1"),e.removeItem(t),!0}catch{return!1}}function mg(){try{return typeof Request!="undefined"&&"keepalive"in new Request("https://scalebun.invalid",{})}catch{return!1}}function hg(){let n=typeof document!="undefined";return{dom:n,storage:sc("localStorage"),session:sc("sessionStorage"),indexedDB:ht("indexedDB"),history:typeof history!="undefined"&&typeof history.pushState=="function",network:typeof fetch!="undefined",beacon:typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function",keepalive:mg(),performance:typeof performance!="undefined"&&typeof performance.now=="function",performanceObserver:ht("PerformanceObserver"),mutationObserver:ht("MutationObserver"),intersectionObserver:ht("IntersectionObserver"),resizeObserver:ht("ResizeObserver"),visibility:n&&typeof document.visibilityState!="undefined",raf:typeof requestAnimationFrame!="undefined",crypto:typeof crypto!="undefined"&&typeof crypto.subtle!="undefined",webWorker:ht("Worker")}}function gg(){return Bs===null&&(Bs=hg()),Bs}function gt(n){return gg()[n]}var ic,ht,Bs,Fs=E(()=>{"use strict";ic=()=>globalThis,ht=n=>typeof ic()[n]!="undefined";Bs=null});function Pe(n,e,t){if(!gt("performanceObserver"))return()=>{};try{let r=new PerformanceObserver(s=>e(s.getEntries()));return r.observe({type:n,buffered:!0,...t}),()=>{try{r.disconnect()}catch{}}}catch{return()=>{}}}var Ds=E(()=>{"use strict";Fs()});var bn,oc=E(()=>{"use strict";bn=class{constructor(e="unknown"){this.onGrant=new Set;this.status=e}get value(){return this.status}get granted(){return this.status==="granted"}set(e){let t=e==="granted"&&this.status!=="granted";if(this.status=e,t){let r=[...this.onGrant];this.onGrant.clear();for(let s of r)try{s()}catch{}}}whenGranted(e){if(this.granted){e();return}this.onGrant.add(e)}}});function bt(n){return n.length>ac?n.slice(0,ac):n}function vg(n){return n.replace(/[?#].*$/,"")}function wg(n){return n==="warn"?"warning":n==="debug"||n==="info"||n==="error"?n:"info"}function cc(n){let e={},t=!1;for(let r in n)n[r]!==void 0&&n[r]!==null&&(e[r]=n[r],t=!0);return t?e:void 0}function xg(n){var t;if(n.kind==="frame"||n.kind==="performance")return null;let e=typeof n.timestamp=="number"?n.timestamp:Date.now();switch(n.kind){case"log":return{ts:e,category:"console",level:wg(n.level),message:bt(j(n.message))};case"network":{let r=n.status;return{ts:e,category:"network",type:"http",level:typeof r=="number"&&r>=400?"error":"info",message:bt(j(`${n.method} ${vg(n.url)}`)),data:cc({status:r,duration:n.duration})}}case"event":return Sg(n.name,(t=n.props)!=null?t:{},e);case"error":return{ts:e,category:"error",type:n.type,level:"error",message:bt(j(n.message))};default:return null}}function Sg(n,e,t){var r,s,i,o;if(n==="SCREEN_VIEW")return{ts:t,category:"navigation",message:`${(r=e.from)!=null?r:"?"} \u2192 ${(s=e.to)!=null?s:"?"}`};if(n==="USER_ACTION"){let a=typeof e.action=="string"?e.action:"action";return{ts:t,category:`ui.${a}`,message:bt(j(String((o=(i=e.selector)!=null?i:e.label)!=null?o:a))),data:cc({dead:e.dead,rage:e.rage})}}return{ts:t,category:"custom",type:"event",message:bt(j(n))}}function lc(n){Hs=n}function dc(n){if(!Hs)return n;try{return Hs(n)}catch{return n}}function uc(n){let e=n.message?{...n,message:bt(j(n.message))}:n,t=dc(e);t&&We.add(t)}function pc(n){let e=xg(n);if(!e)return;let t=dc(e);t&&We.add(t)}function fc(){We.clear()}var bg,yg,ac,qs,We,Hs,mc=E(()=>{"use strict";Ns();bg=50,yg=200,ac=256;qs=class{constructor(){this.ring=[];this.max=bg}setMax(e){this.max=Math.max(1,Math.min(yg,Math.floor(e))),this.trim()}add(e){var r;let t=this.ring[this.ring.length-1];if(t&&t.category===e.category&&t.message===e.message&&t.level===e.level){t.count=((r=t.count)!=null?r:1)+1,t.ts=e.ts;return}this.ring.push(e),this.trim()}snapshot(){return this.ring.slice()}clear(){this.ring=[]}trim(){for(;this.ring.length>this.max;)this.ring.shift()}},We=new qs});function hc(n){n.kind==="frame"&&(typeof n.seq=="number"&&(yn=n.seq),n.frameType==="keyframe"&&n.frameId&&(vn=n.frameId))}function ne(){return yn!=null||vn!=null?{seq:yn,segmentId:vn}:void 0}function gc(){yn=void 0,vn=void 0}var yn,vn,bc=E(()=>{"use strict"});function Oe(n){n&&typeof n=="object"&&($t={...$t,...n})}function yt(){return $t}function yc(){let n=$t.deviceId;$t=n!=null?{deviceId:n}:{}}var $t,vc=E(()=>{"use strict";$t={}});function kg(){var s;let n=globalThis;if(typeof window!="undefined"&&typeof document!="undefined")return"browser";let e=n.navigator,t=n.caches;if(typeof n.EdgeRuntime!="undefined"||(e==null?void 0:e.userAgent)==="Cloudflare-Workers"||typeof n.WebSocketPair!="undefined"||t!==void 0&&typeof t.default!="undefined")return"edge";if(typeof n.importScripts=="function"||typeof n.ServiceWorkerGlobalScope!="undefined")return"worker";let r=n.process;return(s=r==null?void 0:r.versions)!=null&&s.node?"ssr-node":"unknown"}function zs(){return $s===null&&($s=kg()),$s}function Eg(){return zs()==="browser"}function wc(){return!Eg()}var $s,xc=E(()=>{"use strict";$s=null});function wn(n){n&&(Us=n)}function vt(n){if(Us)try{n.nonce=Us}catch{}return n}function Ne(n,e){var o,a,c,l;if(typeof CSSStyleSheet!="undefined"&&"adoptedStyleSheets"in n&&(n instanceof Document||typeof ShadowRoot!="undefined"&&n instanceof ShadowRoot))try{let u=new CSSStyleSheet;u.replaceSync(e);let d=n;d.adoptedStyleSheets=[...d.adoptedStyleSheets,u];return}catch{}let r=n instanceof Document?n:(o=n.ownerDocument)!=null?o:typeof document!="undefined"?document:null;if(!r)return;let s=vt(r.createElement("style"));s.textContent=e,(n instanceof Document&&(l=(c=(a=n.head)!=null?a:n.documentElement)!=null?c:r.body)!=null?l:n).appendChild(s)}var Us,Sc=E(()=>{"use strict";Us=null});var $=E(()=>{"use strict";Ya();_s();Qa();rc();Ns();Ds();oc();mc();bc();vc();xc();Fs();Sc()});function xn(){try{let n=typeof sessionStorage!="undefined"&&sessionStorage.getItem(Ws);if(!n)return null;let e=JSON.parse(n);if(!Array.isArray(e)||typeof e[0]!="string"||!e[0]||typeof e[2]!="number")return null;let t=typeof e[1]=="number"&&isFinite(e[1])&&e[1]>0?e[1]:e[2];return{id:e[0],startedAt:t,lastSeenAt:e[2],seq:e[3]>0?e[3]:0}}catch{return null}}function wt(n){it=n;try{typeof sessionStorage!="undefined"&&sessionStorage.setItem(Ws,JSON.stringify([n.id,n.startedAt,n.lastSeenAt,n.seq]))}catch{}}function kc(n=Ut,e=js){let t=P(),r=xn();if(r&&Math.max(0,t-r.lastSeenAt)<=n&&Math.max(0,t-r.startedAt)<=e)return r.lastSeenAt=t,wt(r),it=r,r;let s={id:`sess_${H()}`,startedAt:t,lastSeenAt:t,seq:0};return wt(s),it=s,s}function Ec(){if(typeof document!="undefined"&&document.visibilityState==="hidden")return;let n=P();if(it)try{if(typeof sessionStorage!="undefined"&&sessionStorage.getItem(Ws)===null){it.lastSeenAt=n,wt(it),Vs=n;return}}catch{}if(n-Vs<6e4)return;Vs=n;let e=xn();e&&(e.lastSeenAt=n,wt(e),it=e)}function Ks(n=1){let e=xn();if(!e){let r=zt;return zt+=n,r}let t=e.seq;return e.seq=t+n,e.lastSeenAt=P(),wt(e),t}function Ic(n){let e=xn();return e?(e.seq<n&&(e.seq=n,wt(e)),e.seq):(zt<n&&(zt=n),zt)}var Ws,Ut,js,it,Vs,zt,Sn=E(()=>{"use strict";$();Ws="scalebun_session",Ut=30*60*1e3,js=4*60*60*1e3;it=null,Vs=0,zt=0});var Xs={};L(Xs,{SDK_SIGNING_VERSION:()=>Cc,signBody:()=>Ac,signatureHeaders:()=>Ag});function Ig(n,e){let t=Gs.get(e);return t||(t=n.importKey("raw",new TextEncoder().encode(e),{name:"HMAC",hash:"SHA-256"},!1,["sign"]),t.catch(()=>Gs.delete(e)),Gs.set(e,t)),t}function Cg(n){let e="";for(let t=0;t<n.length;t++)e+=n[t].toString(16).padStart(2,"0");return e}async function Ac(n,e){var t;try{let r=(t=globalThis.crypto)==null?void 0:t.subtle;if(!r||!n)return null;let s=await Ig(r,n),i=await r.sign("HMAC",s,new TextEncoder().encode(e));return Cg(new Uint8Array(i))}catch{return null}}async function Ag(n,e){let t=await Ac(n,e);return t?{"x-scalebun-signature":t,"x-scalebun-sdk-version":Cc}:{}}var Cc,Gs,Ys=E(()=>{"use strict";Cc="1",Gs=new Map});var Rc={};L(Rc,{gzipString:()=>Rg});async function Rg(n){if(typeof CompressionStream=="undefined")return null;try{let e=new CompressionStream("gzip"),t=e.writable.getWriter();return t.write(new TextEncoder().encode(n)),t.close(),await new Response(e.readable).arrayBuffer()}catch{return null}}var Tc=E(()=>{"use strict"});function Pg(){return new Promise(n=>{try{if(typeof indexedDB=="undefined")return n(null);let e=indexedDB.open(Tg,1);e.onupgradeneeded=()=>{let t=e.result;t.objectStoreNames.contains(xt)||t.createObjectStore(xt)},e.onsuccess=()=>n(e.result),e.onerror=()=>n(null)}catch{n(null)}})}var Tg,xt,Mg,Be,Vt=E(()=>{"use strict";Tg="scalebun",xt="queue",Mg="pending";Be=class{constructor(e=Mg){this.key=e;this.dbp=null}db(){return this.dbp||(this.dbp=Pg()),this.dbp}async load(){let e=await this.db();return e?new Promise(t=>{try{let r=e.transaction(xt,"readonly").objectStore(xt).get(this.key);r.onsuccess=()=>t(Array.isArray(r.result)?r.result:[]),r.onerror=()=>t([])}catch{t([])}}):[]}async save(e){let t=await this.db();if(t)return new Promise(r=>{try{let s=t.transaction(xt,"readwrite");s.objectStore(xt).put(e,this.key),s.oncomplete=()=>r(),s.onerror=()=>r()}catch{r()}})}async clear(){return this.save([])}}});function ot(){return typeof navigator=="undefined"||navigator.onLine!==!1}function Mc(n){return typeof window=="undefined"?()=>{}:(window.addEventListener("online",n),()=>window.removeEventListener("online",n))}var Lg,_g,St,Cn=E(()=>{"use strict";Lg=1e3,_g=3e4,St=class{constructor(){this.fails=0;this.nextAt=0}ready(e){return e>=this.nextAt}fail(e){let t=Math.min(_g,Lg*2**this.fails++);this.nextAt=e+Math.random()*t}reset(){this.fails=0,this.nextAt=0}}});function An(n,e,t){return n.filter(r=>{let s=e(r);return s==null||t-s<=864e5})}function kt(n,e,t){let r=n.map(c=>({it:c,n:Og(c),gone:!1})),s=r.reduce((c,l)=>c+l.n,0);if(s<=2e6)return n.slice();let i=c=>{for(let l of r){if(s<=2e6)return;l.gone||!c(l.it)||(l.gone=!0,s-=l.n)}};if(e&&t){let c=r.reduce((l,u)=>l+(t(u.it)?1:0),0);for(let l of r){if(s<=2e6)break;if(l.gone||!e(l.it))continue;let u=t(l.it);u&&c<=1||(l.gone=!0,s-=l.n,u&&c--)}}else e&&i(e);i(()=>!0);let o=r.filter(c=>!c.gone).map(c=>c.it);if(!e||!t)return o;let a=!1;return o.filter(c=>e(c)?t(c)?(a=!0,!0):a:!0)}var Og,Rn=E(()=>{"use strict";Og=n=>JSON.stringify(n).length+1});function Js(n){return/dynamically imported module|module script failed|error loading dynamically/i.test(n)}var Pn,Qs=E(()=>{"use strict";Pn=class{constructor(){this.features=new Map}add(e){this.features.set(e.name,e)}get(e){return this.features.get(e)}async setupAll(e){var t;for(let r of this.features.values())try{await r.setup(e)}catch(s){e.log(`[scalebun] feature "${r.name}" failed to set up:`,s);try{let i=s,o=String((t=i==null?void 0:i.message)!=null?t:s).slice(0,300);e.trackEvent("sdk_feature_setup_failed",{feature:r.name,error:(i==null?void 0:i.name)||"Error",message:o,moduleLoad:Js(o)})}catch{}}}teardownAll(){for(let e of this.features.values())try{e.teardown()}catch{}this.features.clear()}}});function Ee(n){let e=2166136261;for(let t=0;t<n.length;t++)e^=n.charCodeAt(t),e=Math.imul(e,16777619);return e>>>0}function Le(n,e){return Ee(`${n}:${e}`)%100}function Zs(n,e,t){if(!t.length)return null;let r=Le(n,e),s=0;for(let i of t)if(s+=i.allocationPct,r<s)return i.key;return t[t.length-1].key}var Fe=E(()=>{"use strict"});function ei(n,e){return!(n>0)||!(e>0)?!1:n-e>e*.01}function Et(n,e,t){if(!(e>0)||!ei(e,t))return 100;let r=e-t,s=Math.min(Math.max(n,0),r)+t;return Math.min(100,Math.max(0,Math.round(s/e*100)))}function Bc(n){return n>=100?100:n>=75?75:n>=50?50:n>=25?25:0}var On=E(()=>{"use strict"});var Vc={};L(Vc,{anchorOf:()=>Uc,fieldKeyOf:()=>$c,fieldLabelOf:()=>zc,formIdOf:()=>Nn,installFormAnalytics:()=>Zg,isSensitiveField:()=>qc,isTrackableField:()=>Hc,stepOf:()=>Wt});function qc(n){let e=(n.getAttribute("type")||"").toLowerCase();if(Wg.has(e))return!0;let t=n.getAttribute("autocomplete")||"";return jg.test(t)}function Hc(n){if(!n||typeof n.matches!="function"||!n.matches(Gg))return!1;let e=(n.getAttribute("type")||"").toLowerCase();return Kg.has(e)?!1:!qc(n)}function $c(n,e){let t=n.getAttribute("name");if(t)return t;if(n.id)return n.id;let r=(n.getAttribute("type")||n.tagName).toLowerCase(),s=-1;try{s=Array.prototype.indexOf.call(e.elements,n)}catch{}return s>=0?`${r}[${s}]`:r}function zc(n){var r,s,i,o,a;let e="";try{if(e=n.getAttribute("aria-label")||"",!e){let c=n.getAttribute("id"),l=n.ownerDocument;if(c&&l&&(e=((r=l.querySelector(`label[for="${c}"]`))==null?void 0:r.textContent)||""),e||(e=((i=(s=n.closest)==null?void 0:s.call(n,"label"))==null?void 0:i.textContent)||""),!e){let u=n.getAttribute("aria-labelledby");u&&l&&(e=((a=l.getElementById((o=u.split(/\s+/)[0])!=null?o:""))==null?void 0:a.textContent)||"")}}}catch{}let t=j(e.replace(/\s+/g," ").trim());if(t)return t.length>Fc?`${t.slice(0,Fc-1)}\u2026`:t}function Jg(n){let e=5381;for(let t=0;t<n.length;t++)e=(e<<5)+e+n.charCodeAt(t)|0;return(e>>>0).toString(36)}function Nn(n){var s,i;if(n.id)return n.id;let e=n.getAttribute("name");if(e)return e;let t="";try{t=(s=(n.getAttribute("action")||"").split("?")[0])!=null?s:""}catch{}let r=[];try{for(let o of Array.from(n.elements)){let a=(i=o.getAttribute)==null?void 0:i.call(o,"name");a&&r.push(a)}}catch{}return`form_${Jg(`${n.tagName}|${t}|${r.sort().join(",")}`)}`}function Wt(n){var e,t;try{let r=(t=(e=n.closest)==null?void 0:e.call(n,"[data-scalebun-step]"))==null?void 0:t.getAttribute("data-scalebun-step");return r||void 0}catch{return}}function Uc(n){var e,t,r;try{let s=(e=n.getBoundingClientRect)==null?void 0:e.call(n);if(!s||s.width===0&&s.height===0)return;let i={ex:s.x|0,ey:s.y|0,ew:s.width|0,eh:s.height|0},o=(r=(t=n.closest)==null?void 0:t.call(n,"[data-scalebun-component]"))==null?void 0:r.getAttribute("data-scalebun-component");return o&&(i.component=o),i}catch{return}}function Qg(n){let e=n.validity;return e?e.valueMissing?"required":e.typeMismatch?"type":e.patternMismatch?"pattern":e.tooShort?"too_short":e.tooLong?"too_long":e.rangeUnderflow||e.rangeOverflow||e.stepMismatch?"range":e.badInput?"bad_input":e.customError?"custom":"invalid":"invalid"}function Zg(n){if(typeof document=="undefined")return{onSubmit:()=>({}),stop:()=>{}};let e=!0,t=new Map,r=m=>{let h=t.get(m);return h||(t.size>=Yg?null:(h={startedAt:at(),lastField:null,order:0,fields:new Map},t.set(m,h),n.onEvent({name:"$form_start",props:{form_id:Nn(m),form_name:m.getAttribute("name")||void 0,field_count:s(m),step:Wt(m)}}),h))},s=m=>{try{return m.elements?m.elements.length:0}catch{return 0}},i=m=>Array.from(m.fields.entries()).slice(0,Xg).map(([h,g])=>({key:h,ms:Math.round(g.ms),changed:g.changed,errored:g.errored,order:g.order,...g.label?{label:g.label}:{}})),o=m=>{if(!e)return null;let h=m.target;if(!Hc(h))return null;let g=h.form;if(!g||Dc(g)||Dc(h))return null;let S=r(g);return S?{form:g,el:h,key:$c(h,g),st:S}:null},a=m=>{let h=o(m);if(!h)return;let{st:g,key:S}=h,v=g.fields.get(S);v||(v={ms:0,changed:!1,errored:!1,order:g.order++,focusedAt:null,label:zc(h.el)},g.fields.set(S,v)),v.focusedAt=at(),g.lastField=S},c=m=>{let h=o(m);if(!h)return;let g=h.st.fields.get(h.key);!g||g.focusedAt==null||(g.ms+=at()-g.focusedAt,g.focusedAt=null)},l=m=>{let h=o(m);if(!h)return;let g=h.st.fields.get(h.key);g&&!g.changed&&(g.changed=!0)},u=m=>{var S;let h=o(m);if(!h)return;let g=h.st.fields.get(h.key);g&&(g.errored=!0),n.onEvent({name:"$form_error",props:{form_id:Nn(h.form),field_key:h.key,error_type:Qg(h.el),step:Wt(h.form),...(S=Uc(h.el))!=null?S:{}}})},d=(m,h)=>{var g;for(let S of h.fields.values())S.focusedAt!=null&&(S.ms+=at()-S.focusedAt,S.focusedAt=null);n.onEvent({name:"$form_abandon",props:{form_id:Nn(m),last_field:(g=h.lastField)!=null?g:void 0,time_ms:Math.round(at()-h.startedAt),fields_touched:h.fields.size,field_stats:i(h),step:Wt(m)}})},p=()=>{if(!(!e||!t.size)){for(let[m,h]of t)d(m,h);t.clear()}},f=()=>{document.visibilityState==="hidden"&&p()};return document.addEventListener("focusin",a,!0),document.addEventListener("focusout",c,!0),document.addEventListener("input",l,!0),document.addEventListener("invalid",u,!0),document.addEventListener("visibilitychange",f),window.addEventListener("pagehide",p),{onSubmit(m){let h=t.get(m);if(!h)return{};t.delete(m);for(let g of h.fields.values())g.focusedAt!=null&&(g.ms+=at()-g.focusedAt,g.focusedAt=null);return{duration_ms:Math.round(at()-h.startedAt),fields_touched:h.fields.size,field_stats:i(h),step:Wt(m)}},stop(){e=!1,document.removeEventListener("focusin",a,!0),document.removeEventListener("focusout",c,!0),document.removeEventListener("input",l,!0),document.removeEventListener("invalid",u,!0),document.removeEventListener("visibilitychange",f),window.removeEventListener("pagehide",p),t.clear()}}}var Wg,jg,Kg,Gg,Xg,Yg,Fc,Dc,at,Wc=E(()=>{"use strict";$();Wg=new Set(["password","hidden"]),jg=/(^|\s|-)(cc-|new-password|current-password|one-time-code)/i,Kg=new Set(["submit","button","reset","image"]),Gg="input, select, textarea",Xg=30,Yg=20;Fc=60;Dc=n=>!!n&&typeof n.closest=="function"&&!!n.closest("[data-scalebun-no-capture]");at=()=>typeof performance!="undefined"?performance.now():Date.now()});var jc={};L(jc,{installScrollTracker:()=>eb});function eb(){if(typeof window=="undefined"||typeof document=="undefined")return{summary:()=>tb(),reset:()=>{},stop:()=>{}};let n=0,e=0,t=0,r=0,s=()=>document.documentElement,i=()=>{try{let l=s();e=Math.max(e,l.scrollHeight),t=window.innerWidth||l.clientWidth||0,r=window.innerHeight||l.clientHeight||0}catch{}},o=()=>{let l=window.scrollY||window.pageYOffset||0;l>n&&(n=l)},a;if(typeof ResizeObserver!="undefined")try{a=new ResizeObserver(()=>i()),a.observe(s())}catch{a=void 0}return i(),window.addEventListener("scroll",o,{passive:!0}),window.addEventListener("resize",i,{passive:!0}),{summary:()=>{i();let l=e||0,u=r||0,d=Et(n,l,u);return{scroll_depth_pct:d,max_scroll_px:Math.round(n),doc_h:Math.round(l),viewport_w:Math.round(t),viewport_h:Math.round(u),max_bucket:Bc(d),scrollable:ei(l,u)}},reset:()=>{n=0,e=0,t=window.innerWidth||0,r=window.innerHeight||0},stop:()=>{window.removeEventListener("scroll",o),window.removeEventListener("resize",i),a==null||a.disconnect()}}}function tb(){return{scroll_depth_pct:0,max_scroll_px:0,doc_h:0,viewport_w:0,viewport_h:0,max_bucket:0,scrollable:!1}}var Kc=E(()=>{"use strict";On()});var Xc={};L(Xc,{ATTENTION_BANDS:()=>nb,bandFractions:()=>Gc,installAttentionTracker:()=>rb});function Gc(n,e,t,r){let s=new Array(r).fill(0);if(t<=0||e<=0||r<=0)return s;let i=t/r,o=Math.max(0,n),a=Math.min(t,n+e);for(let c=0;c<r;c++){let l=c*i,u=(c+1)*i,d=Math.max(0,Math.min(a,u)-Math.max(o,l));s[c]=i>0?d/i:0}return s}function rb(){if(typeof window=="undefined"||typeof document=="undefined")return{summary:()=>sb(),reset:()=>{},stop:()=>{}};let n=new Array(10).fill(0),e=0,t=0,r=ct(),s=ct(),i=!1,o=()=>document.documentElement,a=()=>{try{e=Math.max(e,o().scrollHeight),t=window.innerHeight||o().clientHeight||0}catch{}},c=()=>{var v,y;if(i)return;let m=ct(),h=m-r;if(r=m,h<=0||typeof document.visibilityState=="string"&&document.visibilityState!=="visible"||m-s>15e3)return;let g=window.scrollY||window.pageYOffset||0,S=Gc(g,t,e,10);for(let b=0;b<10;b++)n[b]=((v=n[b])!=null?v:0)+h*((y=S[b])!=null?y:0)},l=()=>{s=ct()},u=()=>{document.visibilityState==="visible"?r=ct():c()},d,p;if(typeof ResizeObserver!="undefined")try{p=new ResizeObserver(()=>a()),p.observe(o())}catch{p=void 0}return a(),d=setInterval(c,500),window.addEventListener("scroll",l,{passive:!0}),window.addEventListener("pointermove",l,{passive:!0}),window.addEventListener("keydown",l,{passive:!0}),window.addEventListener("resize",a,{passive:!0}),document.addEventListener("visibilitychange",u),{summary:()=>{a(),c();let m=n.map(h=>Math.round(h));return{attention_bands:m,attention_active_ms:m.reduce((h,g)=>h+g,0),attention_bands_n:10}},reset:()=>{n.fill(0),e=0,t=0,r=ct(),s=ct(),a()},stop:()=>{i=!0,d&&clearInterval(d),window.removeEventListener("scroll",l),window.removeEventListener("pointermove",l),window.removeEventListener("keydown",l),window.removeEventListener("resize",a),document.removeEventListener("visibilitychange",u),p==null||p.disconnect()}}}function sb(){return{attention_bands:new Array(10).fill(0),attention_active_ms:0,attention_bands_n:10}}var nb,ct,Yc=E(()=>{"use strict";nb=10;ct=()=>typeof performance!="undefined"&&performance.now?performance.now():Date.now()});var el={};L(el,{describeElement:()=>Fn,installAutocapture:()=>pb});function cb(n){let e=n.tagName.toLowerCase();n.id&&(e+=`#${n.id}`);let t=(n.getAttribute("class")||"").trim().split(/\s+/).filter(Boolean).slice(0,2);return t.length&&(e+="."+t.join(".")),e}function Fn(n,e=!1){var c;let t={tag:n.tagName.toLowerCase(),selector:cb(n)},r=(n.textContent||"").trim().slice(0,80);r&&(t.text=e?Zc(r):r),n.id&&(t.el_id=n.id);let s=(n.getAttribute("class")||"").trim().split(/\s+/).filter(Boolean).slice(0,3);s.length&&(t.classes=s);let i=n.getAttribute("href");i&&!/^\s*javascript:/i.test(i)&&(t.href=i);let o=n.getAttribute("name");o&&(t.name=o);let a=(c=n.closest("[data-scalebun-variant]"))==null?void 0:c.getAttribute("data-scalebun-variant");return a&&(t.variant=a),t}function lb(n,e){for(let t of e)if(t instanceof Element&&typeof t.matches=="function"&&t.matches(Jc))return t;return n&&typeof n.closest=="function"?n.closest(Jc):null}function db(n){return ab.has(n.tagName)?!1:n.id||(n.getAttribute("class")||"").trim()?!0:!!(n.textContent||"").trim()}function ub(n){try{return new URL(n,location.href)}catch{return null}}function Qc(){try{return location.pathname}catch{return""}}function pb(n){if(typeof document=="undefined"||typeof window=="undefined")return()=>{};let e=!0,t;Promise.resolve().then(()=>(Wc(),Vc)).then(R=>{e&&(t=R.installFormAnalytics(n))}).catch(()=>{});let r;Promise.resolve().then(()=>(Kc(),jc)).then(R=>{e&&(r=R.installScrollTracker())}).catch(()=>{});let s;Promise.resolve().then(()=>(Yc(),Xc)).then(R=>{e&&(s=R.installAttentionTracker())}).catch(()=>{});let i=R=>{var ce;if(!e)return;let A=R.target,O=typeof R.composedPath=="function"?R.composedPath():[],z=lb(A,O),D=z!=null?z:A&&db(A)?A:null;if(!D||Bn(D))return;let te={...Fn(D,n.maskText===!0),event:"click",path:location.pathname,interactive:z!=null};n.onEvent({name:"$autocapture",props:te});let J=(ce=D.getAttribute)==null?void 0:ce.call(D,"href");if(!J||/^\s*javascript:/i.test(J))return;let Q=ub(J);if(!Q)return;D.hasAttribute("download")||ob.test(Q.pathname+Q.search)?n.onEvent({name:"$download",props:{url:Q.href,file:Q.pathname.split("/").pop()||Q.pathname,path:location.pathname}}):Q.host&&Q.host!==location.host&&n.onEvent({name:"$outbound_link",props:{url:Q.href,host:Q.host,path:location.pathname}})},o=R=>{var z;if(!e)return;let A=R.target;if(!A||typeof A.matches!="function"||!A.matches(ib)||Bn(A))return;let O={...Fn(A,n.maskText===!0),event:"change",path:location.pathname};if(A instanceof HTMLSelectElement){let D=(z=A.selectedOptions)==null?void 0:z[0];O.option_value=A.value,O.option_index=A.selectedIndex,D&&(O.option_text=n.maskText===!0?Zc(D.text):D.text),O.multiple=A.multiple||void 0}else A instanceof HTMLInputElement&&(O.checked=A.checked,O.input_type=A.type,A.value&&A.value!=="on"&&(O.option_value=A.value));n.onEvent({name:"$change",props:O})},a=R=>{var O;if(!e)return;let A=R.target;!A||A.tagName!=="FORM"||Bn(A)||n.onEvent({name:"$submit",props:{form_id:A.id||void 0,action:A.getAttribute("action")||void 0,fields:A.elements?A.elements.length:0,...(O=t==null?void 0:t.onSubmit(A))!=null?O:{}}})},c=0,l=null,u=0,d=Qc(),p=!1,f=!1,m=()=>typeof performance!="undefined"?performance.now():0,h=()=>document.visibilityState!=="hidden"&&(typeof document.hasFocus!="function"||document.hasFocus()),g=()=>{e&&l==null&&h()&&(l=m())},S=()=>{l!=null&&(c+=m()-l,l=null)},v=()=>{if(e)try{let R=document.documentElement,A=Et(window.scrollY,R.scrollHeight,window.innerHeight||R.clientHeight);A>u&&(u=A)}catch{}},y=()=>{var R,A;!p||f||(S(),f=!0,n.onEvent({name:"$pageleave",props:{path:d,engagement_ms:Math.round(c),scroll_depth_pct:u,...(R=r==null?void 0:r.summary())!=null?R:{},...(A=s==null?void 0:s.summary())!=null?A:{}}}))},b=()=>{document.visibilityState==="hidden"?y():g()},w=new WeakSet,x;typeof IntersectionObserver!="undefined"&&(x=new IntersectionObserver(R=>{if(e)for(let A of R){let O=A.target;A.isIntersecting&&A.intersectionRatio>=.5&&!w.has(O)&&(w.add(O),x.unobserve(O),Bn(O)||n.onEvent({name:"$impression",props:{...Fn(O),path:location.pathname}}))}},{threshold:[.5]}));let I=()=>{if(!(!x||!e))try{document.querySelectorAll("[data-scalebun-track-impression]").forEach(R=>{w.has(R)||x.observe(R)})}catch{}},k=()=>{if(e){y();try{n.onEvent({name:"$pageview",props:{path:location.pathname,search:location.search||void 0}})}catch{}c=0,l=null,u=0,r==null||r.reset(),s==null||s.reset(),d=Qc(),p=!0,f=!1,g(),I()}};document.addEventListener("click",i,!0),document.addEventListener("submit",a,!0),document.addEventListener("change",o,!0),document.addEventListener("visibilitychange",b),window.addEventListener("scroll",v,{passive:!0}),window.addEventListener("focus",g),window.addEventListener("blur",S),window.addEventListener("popstate",k);let C=history.pushState,M=history.replaceState;return history.pushState=function(...R){C.apply(this,R),k()},history.replaceState=function(...R){M.apply(this,R),k()},k(),()=>{e=!1,t==null||t.stop(),r==null||r.stop(),s==null||s.stop(),document.removeEventListener("click",i,!0),document.removeEventListener("submit",a,!0),document.removeEventListener("change",o,!0),document.removeEventListener("visibilitychange",b),window.removeEventListener("scroll",v),window.removeEventListener("focus",g),window.removeEventListener("blur",S),window.removeEventListener("popstate",k),x==null||x.disconnect(),history.pushState!==C&&history.pushState.toString().includes("pageview")}}var Jc,ib,ob,ab,Zc,Bn,tl=E(()=>{"use strict";On();Jc='button, a, [role="button"], input[type="submit"], input[type="button"], [data-scalebun-capture]',ib='select, input[type="checkbox"], input[type="radio"]',ob=/\.(pdf|zip|gz|tar|rar|7z|csv|tsv|xlsx?|docx?|pptx?|dmg|pkg|exe|msi|apk|ipa|mp3|mp4|mov|avi|wav|svg|png|jpe?g|gif|webp|txt|json|xml)(\?|#|$)/i,ab=new Set(["HTML","BODY","MAIN","SECTION","HEADER","FOOTER","NAV"]),Zc=n=>n.replace(/\S/g,"*");Bn=n=>!!n&&typeof n.closest=="function"&&!!n.closest("[data-scalebun-no-capture]")});function li(n){return n.replace(/[?#].*$/,"").trim()}function Mb(n){return!(!n||n.includes("node_modules")||n==="<anonymous>"||n==="native"||n==="[native code]"||/^(chrome|moz|safari|webkit)-extension:\/\//.test(n))}function Sl(n){var r,s,i,o,a;if(n=n.trim(),!n)return null;if(n==="<anonymous>"||n==="native"||n==="[native code]")return{file:n};let e=/^(.*):(\d+):(\d+)$/.exec(n);if(e)return{file:li((r=e[1])!=null?r:""),line:+((s=e[2])!=null?s:0),col:+((i=e[3])!=null?i:0)};let t=/^(.*):(\d+)$/.exec(n);return t?{file:li((o=t[1])!=null?o:""),line:+((a=t[2])!=null?a:0)}:{file:li(n)}}function kl(n,e){let t={};return n&&n!=="<anonymous>"&&(t.function=n),e.file&&(t.file=e.file),e.line!=null&&(t.line=e.line),e.col!=null&&(t.col=e.col),t.inApp=Mb(e.file),t}function Pb(n){let e=n.trim();if(!e)return null;if(e.indexOf("at ")===0){let r=e.slice(3).trim().replace(/^async\s+/,""),s,i=r.indexOf(" (");i!==-1&&r.endsWith(")")&&(s=r.slice(0,i).trim()||void 0,r=r.slice(i+2,-1));let o=Sl(r);return o?kl(s,o):null}let t=e.lastIndexOf("@");if(t!==-1){let r=e.slice(0,t).trim()||void 0,s=Sl(e.slice(t+1));if(s&&s.file)return kl(r,s)}return null}function El(n){var r;if(!n)return[];let e=[],t=n.split(`
2
- `);for(let s=0;s<t.length&&e.length<50;s++){let i=Pb((r=t[s])!=null?r:"");i&&e.push(i)}return e}var Il=E(()=>{"use strict"});function _b(n){if(!n)return"";let e=/^[a-z]+:\/\/[^/]+(\/.*)$/i.exec(n);return e&&e[1]?e[1]:n}function Ob(n){var i;if(!n||!n.length)return"";let e=n.filter(o=>o.inApp),t=e.length?e:n,r=[],s="";for(let o of t){let a=`${(i=o.function)!=null?i:"<anonymous>"}@${_b(o.file)}`;if(a!==s&&(r.push(a),s=a,r.length>=Lb))break}return r.join(">")}function Nb(n){return n.replace(/0x[0-9a-f]+/gi,"0x?").replace(/\b[0-9a-f]{8,}\b/gi,"H").replace(/\d+/g,"N").replace(/(['"]).*?\1/g,"S").trim().slice(0,200)}function Cl(n,e,t){let r=Ob(e),s=r?`${n}|${r}`:`${n}|${Nb(t)}`;return Ee(s).toString(36)}var Lb,Al=E(()=>{"use strict";Fe();Lb=5});function Rl(n,e){let t=[],r=new Set,s=a=>{var u;if(!a||typeof a!="object"||r.has(a)||t.length>=5)return;r.add(a);let c=a,l=e(c.stack);t.push({type:c.name,message:String((u=c.message)!=null?u:a),...l.length?{frames:l}:{}})},i=n==null?void 0:n.errors;if(Array.isArray(i))for(let a of i)s(a);let o=n==null?void 0:n.cause;for(;o&&t.length<5&&!r.has(o);)s(o),o=o==null?void 0:o.cause;return t}var Tl=E(()=>{"use strict"});var Ml={};L(Ml,{computeFingerprint:()=>Cl,extractCauses:()=>Rl,parseStack:()=>El});var Pl=E(()=>{"use strict";Il();Al();Tl()});function Ul(n){try{if(typeof n=="string")return n.length;if(n instanceof ArrayBuffer||ArrayBuffer.isView(n))return n.byteLength;if(typeof Blob!="undefined"&&n instanceof Blob)return n.size}catch{}return 0}function ui(n,e,t){let r=n.WebSocket;if(typeof r!="function")return()=>{};function s(i,o){let a=o!==void 0?new r(i,o):new r(i),c=String(i);if(t(c))return a;let l=Date.now(),u=0,d=0,p=0,f=0,m=!1,h=!1,g=a.send.bind(a);a.send=function(y){return u++,p+=Ul(y),g(y)},a.addEventListener("message",v=>{d++,f+=Ul(v.data)}),a.addEventListener("error",()=>{m=!0});let S=(v,y)=>{if(h)return;h=!0;let b={protocol:"ws",method:"GET",url:c,status:m&&v===void 0?0:void 0,startedAt:l,duration:Date.now()-l,error:m?"websocket error":void 0,ws:{messagesSent:u,messagesReceived:d,bytesSent:p,bytesReceived:f,...v!==void 0?{closeCode:v}:{},...y?{closeReason:y}:{}}};e(b)};return a.addEventListener("close",v=>S(v.code,v.reason)),a}s.prototype=r.prototype;try{Object.defineProperties(s,{CONNECTING:{value:r.CONNECTING},OPEN:{value:r.OPEN},CLOSING:{value:r.CLOSING},CLOSED:{value:r.CLOSED}})}catch{}return n.WebSocket=s,()=>{n.WebSocket=r}}var Vl=E(()=>{"use strict"});function pi(n,e,t){let r=n.EventSource;if(typeof r!="function")return()=>{};function s(i,o){let a=o!==void 0?new r(i,o):new r(i),c=String(i);if(t(c))return a;let l=Date.now(),u=0,d=0,p=!1,f=!1,m=()=>{if(f)return;f=!0;let g={protocol:"sse",method:"GET",url:c,status:p?0:void 0,startedAt:l,duration:Date.now()-l,error:p?"eventsource error":void 0,ws:{messagesReceived:u,bytesReceived:d,messagesSent:0,bytesSent:0}};e(g)};a.addEventListener("message",g=>{u++,d+=typeof g.data=="string"?g.data.length:0}),a.addEventListener("error",()=>{a.readyState===2&&(p=!0,m())});let h=a.close.bind(a);return a.close=function(){return m(),h()},a}s.prototype=r.prototype;try{Object.defineProperties(s,{CONNECTING:{value:r.CONNECTING},OPEN:{value:r.OPEN},CLOSED:{value:r.CLOSED}})}catch{}return n.EventSource=s,()=>{n.EventSource=r}}var Wl=E(()=>{"use strict"});function ny(n){try{if(n==null)return 0;if(typeof n=="string")return n.length;if(typeof Blob!="undefined"&&n instanceof Blob)return n.size;if(n instanceof ArrayBuffer||ArrayBuffer.isView(n))return n.byteLength;if(typeof URLSearchParams!="undefined"&&n instanceof URLSearchParams)return n.toString().length}catch{}}function fi(n,e,t){let r=n.sendBeacon;return typeof r!="function"?()=>{}:(n.sendBeacon=function(i,o){let a=String(i);if(t(a))return r.call(n,i,o!=null?o:void 0);let c=Date.now(),l=r.call(n,i,o!=null?o:void 0),u={protocol:"beacon",method:"POST",url:a,status:l?void 0:0,startedAt:c,duration:Date.now()-c,requestSize:ny(o),error:l?void 0:"beacon not queued"};return e(u),l},()=>{n.sendBeacon=r})}var jl=E(()=>{"use strict"});var Kl={};L(Kl,{installBeacon:()=>fi,installEventSource:()=>pi,installStreams:()=>ry,installWebSocket:()=>ui});function ry(n,e,t,r,s){let i=[];return s.ws&&typeof n.WebSocket=="function"&&i.push(ui(n,t,r)),s.sse&&typeof n.EventSource=="function"&&i.push(pi(n,t,r)),s.beacon&&e&&typeof e.sendBeacon=="function"&&i.push(fi(e,t,r)),i}var Gl=E(()=>{"use strict";Vl();Wl();jl()});function mi(n,e){if(/graphql/i.test(n))return!0;if(!e)return!1;let t=e.slice(0,200);return/["']?query["']?\s*[:=]/.test(t)||/^\s*(query|mutation|subscription)\b/.test(t)}function hi(n){if(!n)return;let e=n.trim();if(e.startsWith("[")){let t=Yl(e);if(Array.isArray(t)&&t.length){let r=t[0],s=r?Xl(r):void 0;return{...s!=null?s:{},batched:!0}}return}if(e.startsWith("{")){let t=Yl(e);return t&&("query"in t||"operationName"in t)?Xl(t):void 0}if(Jl.test(e))return iy(e)}function Jn(n){if(!n||typeof n!="object")return!1;if(Array.isArray(n))return n.some(t=>Jn(t));let e=n.errors;return Array.isArray(e)&&e.length>0}function Xl(n){let e={},t=n.operationName;typeof t=="string"&&t&&(e.operationName=t);let r=typeof n.query=="string"?n.query:void 0;if(r){let s=Ql(r);if(s&&(e.operationType=s),!e.operationName){let i=Zl(r);i&&(e.operationName=i)}}return e}function iy(n){let e={},t=Ql(n);t&&(e.operationType=t);let r=Zl(n);return r&&(e.operationName=r),e}function Ql(n){let e=n.trimStart();if(e.startsWith("{"))return"query";let t=Jl.exec(e.slice(0,64));return t?t[1]:void 0}function Zl(n){let e=sy.exec(n);return e&&e[2]?e[2]:void 0}function Yl(n){try{return JSON.parse(n)}catch{return}}var Jl,sy,ed=E(()=>{"use strict";Jl=/\b(query|mutation|subscription)\b/,sy=/\b(query|mutation|subscription)\s+([A-Za-z_][A-Za-z0-9_]*)/});function gi(n,e){if(!n)return!1;let t=n.toLowerCase();return e.some(r=>t.startsWith(r.toLowerCase()))}function bi(n,e){let t=n;return t.length>e&&(t=t.slice(0,e)+"\u2026[truncated]"),j(t)}var QE,td=E(()=>{"use strict";$();QE=64*1024});var nd={};L(nd,{enrichHttpCapture:()=>oy,graphqlResponseHasErrors:()=>Jn,looksLikeGraphql:()=>mi,parseGraphqlRequest:()=>hi});async function oy(n,e){var s,i,o;let t,r=async()=>(t===void 0&&(t=n.readResponseText?await n.readResponseText():null),t);if(e.graphql)try{if(mi(n.url,n.reqBody)){let a=(s=hi(n.reqBody))!=null?s:{};if(n.status&&n.status>=200&&n.status<300){let c=await r();if(c)try{a.hasErrors=Jn(JSON.parse(c))}catch{}}Object.keys(a).length&&(n.graphql=a)}}catch{}if(e.body){let a=e.body;try{if(n.reqBody&&gi(n.reqContentType,a.contentTypeAllowlist)&&(n.request={...(i=n.request)!=null?i:{},body:bi(n.reqBody,a.bodyMaxBytes)}),gi(n.resContentType,a.contentTypeAllowlist)){let c=await r();c!=null&&(n.response={...(o=n.response)!=null?o:{},body:bi(c,a.bodyMaxBytes)})}}catch{}}}var rd=E(()=>{"use strict";ed();td()});function wd(n){if(tr.size)for(let e of tr)try{e(n)}catch{}}function xd(n){return tr.add(n),()=>{tr.delete(n)}}var tr,ki=E(()=>{"use strict";tr=new Set});var rr,sr,ir=E(()=>{"use strict";rr={startChild:()=>rr,finish(){},setData(){}},sr={startSpan:()=>rr,finish(){}}});function Rd(n){var r;let e=new Uint8Array(n);if(typeof crypto!="undefined"&&crypto.getRandomValues)crypto.getRandomValues(e);else for(let s=0;s<n;s++)e[s]=Date.now()+s*2654435761&255;let t="";for(let s=0;s<n;s++)t+=((r=e[s])!=null?r:0).toString(16).padStart(2,"0");return t}function At(){return Rd(16)}function je(){return Rd(8)}function Td(n){return`00-${n.traceId}-${n.spanId}-${n.sampled?"01":"00"}`}function Md(n){var t,r,s;let e=gy.exec(n.trim().toLowerCase());return e?{traceId:(t=e[1])!=null?t:"",spanId:(r=e[2])!=null?r:"",sampled:(parseInt((s=e[3])!=null?s:"0",16)&1)===1}:null}var gy,or=E(()=>{"use strict";gy=/^00-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})$/});var ar,Pd=E(()=>{"use strict";or();ir();ar=class{constructor(e,t){this.name=e;this.traceId=At();this.rootSpanId=je();this.spans=[];this.dropped=0;this.errors=0;var r,s;this.clock=t.clock,this.maxSpans=(r=t.maxSpans)!=null?r:1e3,this.sampled=(s=t.sampled)!=null?s:!0,this.onFinish=t.onFinish,this.startMs=this.clock()}open(e,t,r){if(this.endMs!=null||this.spans.length>=this.maxSpans)return this.dropped++,rr;let s={spanId:je(),parentSpanId:t,op:e,description:r,startMs:this.clock()};this.spans.push(s);let i=this.clock;return{startChild:(o,a)=>this.open(o,s.spanId,a),finish:(o=i())=>{s.endMs==null&&(s.endMs=o)},setData:(o,a)=>{var c;((c=s.data)!=null?c:s.data={})[o]=a}}}startSpan(e,t){return this.open(e,this.rootSpanId,t)}addSpan(e,t,r,s){if(this.endMs!=null||this.spans.length>=this.maxSpans){this.dropped++;return}this.spans.push({spanId:je(),parentSpanId:this.rootSpanId,op:e,startMs:Math.round(t),endMs:Math.round(r),...s?{data:s}:{}})}finish(e=this.clock()){this.endMs==null&&(this.endMs=e,this.onFinish(this))}noteError(){this.endMs==null&&this.errors++}context(){return{traceId:this.traceId,spanId:this.rootSpanId,sampled:this.sampled}}data(){var e;return{name:this.name,traceId:this.traceId,spanId:this.rootSpanId,sampled:this.sampled,startMs:this.startMs,durationMs:Math.max(0,((e=this.endMs)!=null?e:this.startMs)-this.startMs),spans:this.spans.slice(),...this.dropped>0?{droppedSpans:this.dropped}:{},...this.errors>0?{errorCount:this.errors}:{}}}}});function Ld(n,e){let t=At(),r=je(),s=[],i=(o,a,c)=>{a>0&&c>a&&s.push({spanId:je(),parentSpanId:r,op:o,startMs:Ii(a),endMs:Ii(c)})};return i("dns",n.domainLookupStart,n.domainLookupEnd),i("connect",n.connectStart,n.connectEnd),n.secureConnectionStart>0&&i("tls",n.secureConnectionStart,n.connectEnd),i("request",n.requestStart,n.responseStart),i("response",n.responseStart,n.responseEnd),i("dom",n.responseEnd,n.domContentLoadedEventEnd),i("load",n.domContentLoadedEventEnd,n.loadEventEnd),{name:`pageload ${e}`,traceId:t,spanId:r,sampled:!0,startMs:0,durationMs:Ii(n.loadEventEnd||n.duration),spans:s}}var Ii,_d=E(()=>{"use strict";or();Ii=n=>Math.round(n)});var Od={};L(Od,{Transaction:()=>ar,buildPageload:()=>Ld,formatTraceparent:()=>Td,newSpanId:()=>je,newTraceId:()=>At,parseTraceparent:()=>Md});var Nd=E(()=>{"use strict";Pd();or();_d()});var Ud={};L(Ud,{createBugReportWidget:()=>By});function Oy(n){let e=n.startsWith("top")?"top: 16px;":"bottom: 16px;",t=n.endsWith("right")?"right: 16px;":"left: 16px;";return e+t}function Ny(n){return`[data-scalebun-bugreport]{position:fixed;${Oy(n)}z-index:${_y};font-family:system-ui,sans-serif}[data-scalebun-bugreport] .sbbr-launch{cursor:pointer;border:none;border-radius:9999px;padding:10px 16px;font-size:13px;font-weight:600;color:#fff;background:#ef4444;box-shadow:0 2px 8px rgba(0,0,0,.2)}[data-scalebun-bugreport].sbbr-expanded .sbbr-launch{display:none}[data-scalebun-bugreport] .sbbr-panel{display:none;width:min(300px,calc(100vw - 32px));background:#fff;color:#111827;border:1px solid #e5e7eb;border-radius:12px;padding:14px;box-shadow:0 8px 30px rgba(0,0,0,.18);margin-top:8px}[data-scalebun-bugreport] .sbbr-panel.sbbr-open{display:block}[data-scalebun-bugreport] .sbbr-title{font-size:14px;font-weight:700;margin-bottom:8px}[data-scalebun-bugreport] .sbbr-field{width:100%;box-sizing:border-box;font:inherit;font-size:13px;padding:8px;border:1px solid #e5e7eb;border-radius:8px}[data-scalebun-bugreport] textarea.sbbr-field{resize:vertical}[data-scalebun-bugreport] .sbbr-email{margin-top:8px}[data-scalebun-bugreport] .sbbr-status{font-size:12px;color:#6b7280;min-height:16px;margin-top:8px}[data-scalebun-bugreport] .sbbr-actions{display:flex;gap:8px;justify-content:flex-end;margin-top:8px}[data-scalebun-bugreport] .sbbr-btn{cursor:pointer;font:inherit;font-size:13px;padding:6px 12px;border-radius:8px}[data-scalebun-bugreport] .sbbr-cancel{border:1px solid #e5e7eb;background:#fff}[data-scalebun-bugreport] .sbbr-send{font-weight:600;border:none;background:#ef4444;color:#fff}@media(prefers-color-scheme:dark){[data-scalebun-bugreport] .sbbr-panel{background:#17161c;color:#ececf1;border-color:#2e2c36;box-shadow:0 8px 30px rgba(0,0,0,.5)}[data-scalebun-bugreport] .sbbr-field{background:#111016;color:#ececf1;border-color:#2e2c36}[data-scalebun-bugreport] .sbbr-field::placeholder{color:#8b8796}[data-scalebun-bugreport] .sbbr-status{color:#a5a1b0}[data-scalebun-bugreport] .sbbr-cancel{background:#221f2b;color:#ececf1;border-color:#2e2c36}}`}function By(n){if(typeof document=="undefined")return{destroy:()=>{}};let e=document.createElement("div");e.setAttribute("data-scalebun-bugreport",""),Ne(document,Ny(n.position));let t=document.createElement("button");t.type="button",t.className="sbbr-launch",t.textContent=n.label;let r=document.createElement("div");r.className="sbbr-panel",r.innerHTML=`
1
+ "use strict";(()=>{var og=Object.defineProperty;var k=(n,e)=>()=>(n&&(e=n(n=0)),e);var L=(n,e)=>{for(var t in e)og(n,t,{get:e[t],enumerable:!0})};function H(){let n=typeof crypto!="undefined"?crypto:void 0;if(n&&typeof n.randomUUID=="function")return n.randomUUID();let e=typeof performance!="undefined"?performance.now():0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let r=(Math.floor(e)+Math.floor(Math.random()*16))%16;return(t==="x"?r:r&3|8).toString(16)})}function P(){return Date.now()}function Ga(){try{if(typeof localStorage!="undefined"){let n=localStorage.getItem(Ka);if(n)return n;let e=`web_${H()}`;return localStorage.setItem(Ka,e),e}}catch{}return`web_${H()}`}var Ka,Xa=k(()=>{"use strict";Ka="scalebun_device_id"});function Ya(n){return(...e)=>{n&&typeof console!="undefined"&&console.info(_s,...e)}}var _s,Os=k(()=>{"use strict";_s="[scalebun]"});var Ja=k(()=>{"use strict"});function Qa(){return{platform:"web",renderer:"dom",sdk:{name:cg,version:Ns}}}function Za(n){let e=typeof navigator!="undefined"?navigator.userAgent:"",{browser:t,os:r}=lg(e);return{id:n,browser:t.name,browserVersion:t.version,os:r.name,osVersion:r.version}}function ec(n){return{version:n.appVersion,environment:n.environment,release:n.release}}function tc(){let n={};try{typeof navigator!="undefined"&&(n.locale=navigator.language),n.timezone=Intl.DateTimeFormat().resolvedOptions().timeZone,typeof location!="undefined"&&(n.url=location.href),typeof window!="undefined"&&(n.viewport={width:window.innerWidth,height:window.innerHeight});let e=navigator==null?void 0:navigator.connection;e!=null&&e.effectiveType&&(n.networkType=e.effectiveType)}catch{}return n}function lg(n){var s,i,o,a,c,l,u,d,p;let e={},t={},r=(s=/(Edg|OPR)\/([\d.]+)/.exec(n))!=null?s:/(Chrome|Firefox|Safari)\/([\d.]+)/.exec(n);return r&&r[1]&&(e.name=(i={Edg:"Edge",OPR:"Opera"}[r[1]])!=null?i:r[1],e.version=(o=r[2])==null?void 0:o.split(".")[0]),/Windows NT ([\d.]+)/.test(n)?(t.name="Windows",t.version=(a=/Windows NT ([\d.]+)/.exec(n))==null?void 0:a[1]):/Mac OS X ([\d_]+)/.test(n)?(t.name="macOS",t.version=(l=(c=/Mac OS X ([\d_]+)/.exec(n))==null?void 0:c[1])==null?void 0:l.replace(/_/g,".")):/Android ([\d.]+)/.test(n)?(t.name="Android",t.version=(u=/Android ([\d.]+)/.exec(n))==null?void 0:u[1]):/(iPhone|iPad).+OS ([\d_]+)/.test(n)?(t.name="iOS",t.version=(p=(d=/OS ([\d_]+)/.exec(n))==null?void 0:d[1])==null?void 0:p.replace(/_/g,".")):/Linux/.test(n)&&(t.name="Linux"),{browser:e,os:t}}var cg,Ns,nc=k(()=>{"use strict";cg="@scalebun/web",Ns="1.3.1"});function j(n){return n.replace(/[\w.+-]+@[\w-]+\.[\w.-]+/g,"[email]").replace(/\b[A-Za-z0-9_-]{24,}\b/g,"[token]")}function fg(n){return n.replace(ug,"[email]").replace(pg,"[redacted]")}function mt(n,e=0){if(n==null||e>4)return n;if(typeof n=="string")return fg(n);if(Array.isArray(n))return n.slice(0,1e3).map(t=>mt(t,e+1));if(typeof n=="object"){let t={},r=0;for(let s in n){if(r++>200)break;if(!Object.prototype.hasOwnProperty.call(n,s))continue;let i=n[s];t[s]=dg.test(s)?"[redacted]":mt(i,e+1)}return t}return n}var dg,ug,pg,Bs=k(()=>{"use strict";dg=/pass(word|wd)?|secret|token|api[_-]?key|authorization|auth|ssn|social|credit|card[_-]?(number|num)|cardnum|cvv|cvc/i,ug=/[\w.+-]+@[\w-]+\.[\w.-]+/g,pg=/\b\d[\d -]{11,18}\d\b/g});function rc(n){try{let e=sc()[n];if(!e)return!1;let t="__scalebun_probe__";return e.setItem(t,"1"),e.removeItem(t),!0}catch{return!1}}function mg(){try{return typeof Request!="undefined"&&"keepalive"in new Request("https://scalebun.invalid",{})}catch{return!1}}function hg(){let n=typeof document!="undefined";return{dom:n,storage:rc("localStorage"),session:rc("sessionStorage"),indexedDB:ht("indexedDB"),history:typeof history!="undefined"&&typeof history.pushState=="function",network:typeof fetch!="undefined",beacon:typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function",keepalive:mg(),performance:typeof performance!="undefined"&&typeof performance.now=="function",performanceObserver:ht("PerformanceObserver"),mutationObserver:ht("MutationObserver"),intersectionObserver:ht("IntersectionObserver"),resizeObserver:ht("ResizeObserver"),visibility:n&&typeof document.visibilityState!="undefined",raf:typeof requestAnimationFrame!="undefined",crypto:typeof crypto!="undefined"&&typeof crypto.subtle!="undefined",webWorker:ht("Worker")}}function gg(){return Fs===null&&(Fs=hg()),Fs}function gt(n){return gg()[n]}var sc,ht,Fs,Ds=k(()=>{"use strict";sc=()=>globalThis,ht=n=>typeof sc()[n]!="undefined";Fs=null});function Pe(n,e,t){if(!gt("performanceObserver"))return()=>{};try{let r=new PerformanceObserver(s=>e(s.getEntries()));return r.observe({type:n,buffered:!0,...t}),()=>{try{r.disconnect()}catch{}}}catch{return()=>{}}}var qs=k(()=>{"use strict";Ds()});var bn,ic=k(()=>{"use strict";bn=class{constructor(e="unknown"){this.onGrant=new Set;this.status=e}get value(){return this.status}get granted(){return this.status==="granted"}set(e){let t=e==="granted"&&this.status!=="granted";if(this.status=e,t){let r=[...this.onGrant];this.onGrant.clear();for(let s of r)try{s()}catch{}}}whenGranted(e){if(this.granted){e();return}this.onGrant.add(e)}}});function bt(n){return n.length>oc?n.slice(0,oc):n}function vg(n){return n.replace(/[?#].*$/,"")}function wg(n){return n==="warn"?"warning":n==="debug"||n==="info"||n==="error"?n:"info"}function ac(n){let e={},t=!1;for(let r in n)n[r]!==void 0&&n[r]!==null&&(e[r]=n[r],t=!0);return t?e:void 0}function xg(n){var t;if(n.kind==="frame"||n.kind==="performance")return null;let e=typeof n.timestamp=="number"?n.timestamp:Date.now();switch(n.kind){case"log":return{ts:e,category:"console",level:wg(n.level),message:bt(j(n.message))};case"network":{let r=n.status;return{ts:e,category:"network",type:"http",level:typeof r=="number"&&r>=400?"error":"info",message:bt(j(`${n.method} ${vg(n.url)}`)),data:ac({status:r,duration:n.duration})}}case"event":return Sg(n.name,(t=n.props)!=null?t:{},e);case"error":return{ts:e,category:"error",type:n.type,level:"error",message:bt(j(n.message))};default:return null}}function Sg(n,e,t){var r,s,i,o;if(n==="SCREEN_VIEW")return{ts:t,category:"navigation",message:`${(r=e.from)!=null?r:"?"} \u2192 ${(s=e.to)!=null?s:"?"}`};if(n==="USER_ACTION"){let a=typeof e.action=="string"?e.action:"action";return{ts:t,category:`ui.${a}`,message:bt(j(String((o=(i=e.selector)!=null?i:e.label)!=null?o:a))),data:ac({dead:e.dead,rage:e.rage})}}return{ts:t,category:"custom",type:"event",message:bt(j(n))}}function cc(n){$s=n}function lc(n){if(!$s)return n;try{return $s(n)}catch{return n}}function dc(n){let e=n.message?{...n,message:bt(j(n.message))}:n,t=lc(e);t&&We.add(t)}function uc(n){let e=xg(n);if(!e)return;let t=lc(e);t&&We.add(t)}function pc(){We.clear()}var bg,yg,oc,Hs,We,$s,fc=k(()=>{"use strict";Bs();bg=50,yg=200,oc=256;Hs=class{constructor(){this.ring=[];this.max=bg}setMax(e){this.max=Math.max(1,Math.min(yg,Math.floor(e))),this.trim()}add(e){var r;let t=this.ring[this.ring.length-1];if(t&&t.category===e.category&&t.message===e.message&&t.level===e.level){t.count=((r=t.count)!=null?r:1)+1,t.ts=e.ts;return}this.ring.push(e),this.trim()}snapshot(){return this.ring.slice()}clear(){this.ring=[]}trim(){for(;this.ring.length>this.max;)this.ring.shift()}},We=new Hs});function mc(n){n.kind==="frame"&&(typeof n.seq=="number"&&(yn=n.seq),n.frameType==="keyframe"&&n.frameId&&(vn=n.frameId))}function ne(){return yn!=null||vn!=null?{seq:yn,segmentId:vn}:void 0}function hc(){yn=void 0,vn=void 0}var yn,vn,gc=k(()=>{"use strict"});function Oe(n){n&&typeof n=="object"&&(zt={...zt,...n})}function yt(){return zt}function bc(){let n=zt.deviceId;zt=n!=null?{deviceId:n}:{}}var zt,yc=k(()=>{"use strict";zt={}});function kg(){var s;let n=globalThis;if(typeof window!="undefined"&&typeof document!="undefined")return"browser";let e=n.navigator,t=n.caches;if(typeof n.EdgeRuntime!="undefined"||(e==null?void 0:e.userAgent)==="Cloudflare-Workers"||typeof n.WebSocketPair!="undefined"||t!==void 0&&typeof t.default!="undefined")return"edge";if(typeof n.importScripts=="function"||typeof n.ServiceWorkerGlobalScope!="undefined")return"worker";let r=n.process;return(s=r==null?void 0:r.versions)!=null&&s.node?"ssr-node":"unknown"}function Us(){return zs===null&&(zs=kg()),zs}function Eg(){return Us()==="browser"}function vc(){return!Eg()}var zs,wc=k(()=>{"use strict";zs=null});function wn(n){n&&(Vs=n)}function vt(n){if(Vs)try{n.nonce=Vs}catch{}return n}function Ne(n,e){var o,a,c,l;if(typeof CSSStyleSheet!="undefined"&&"adoptedStyleSheets"in n&&(n instanceof Document||typeof ShadowRoot!="undefined"&&n instanceof ShadowRoot))try{let u=new CSSStyleSheet;u.replaceSync(e);let d=n;d.adoptedStyleSheets=[...d.adoptedStyleSheets,u];return}catch{}let r=n instanceof Document?n:(o=n.ownerDocument)!=null?o:typeof document!="undefined"?document:null;if(!r)return;let s=vt(r.createElement("style"));s.textContent=e,(n instanceof Document&&(l=(c=(a=n.head)!=null?a:n.documentElement)!=null?c:r.body)!=null?l:n).appendChild(s)}var Vs,xc=k(()=>{"use strict";Vs=null});var $=k(()=>{"use strict";Xa();Os();Ja();nc();Bs();qs();ic();fc();gc();yc();wc();Ds();xc()});function xn(){try{let n=typeof sessionStorage!="undefined"&&sessionStorage.getItem(js);if(!n)return null;let e=JSON.parse(n);if(!Array.isArray(e)||typeof e[0]!="string"||!e[0]||typeof e[2]!="number")return null;let t=typeof e[1]=="number"&&isFinite(e[1])&&e[1]>0?e[1]:e[2];return{id:e[0],startedAt:t,lastSeenAt:e[2],seq:e[3]>0?e[3]:0}}catch{return null}}function wt(n){it=n;try{typeof sessionStorage!="undefined"&&sessionStorage.setItem(js,JSON.stringify([n.id,n.startedAt,n.lastSeenAt,n.seq]))}catch{}}function Sc(n=Vt,e=Ks){let t=P(),r=xn();if(r&&Math.max(0,t-r.lastSeenAt)<=n&&Math.max(0,t-r.startedAt)<=e)return r.lastSeenAt=t,wt(r),it=r,r;let s={id:`sess_${H()}`,startedAt:t,lastSeenAt:t,seq:0};return wt(s),it=s,s}function kc(){if(typeof document!="undefined"&&document.visibilityState==="hidden")return;let n=P();if(it)try{if(typeof sessionStorage!="undefined"&&sessionStorage.getItem(js)===null){it.lastSeenAt=n,wt(it),Ws=n;return}}catch{}if(n-Ws<6e4)return;Ws=n;let e=xn();e&&(e.lastSeenAt=n,wt(e),it=e)}function Gs(n=1){let e=xn();if(!e){let r=Ut;return Ut+=n,r}let t=e.seq;return e.seq=t+n,e.lastSeenAt=P(),wt(e),t}function Ec(n){let e=xn();return e?(e.seq<n&&(e.seq=n,wt(e)),e.seq):(Ut<n&&(Ut=n),Ut)}var js,Vt,Ks,it,Ws,Ut,Sn=k(()=>{"use strict";$();js="scalebun_session",Vt=30*60*1e3,Ks=4*60*60*1e3;it=null,Ws=0,Ut=0});var Ys={};L(Ys,{SDK_SIGNING_VERSION:()=>Ic,signBody:()=>Cc,signatureHeaders:()=>Ag});function Ig(n,e){let t=Xs.get(e);return t||(t=n.importKey("raw",new TextEncoder().encode(e),{name:"HMAC",hash:"SHA-256"},!1,["sign"]),t.catch(()=>Xs.delete(e)),Xs.set(e,t)),t}function Cg(n){let e="";for(let t=0;t<n.length;t++)e+=n[t].toString(16).padStart(2,"0");return e}async function Cc(n,e){var t;try{let r=(t=globalThis.crypto)==null?void 0:t.subtle;if(!r||!n)return null;let s=await Ig(r,n),i=await r.sign("HMAC",s,new TextEncoder().encode(e));return Cg(new Uint8Array(i))}catch{return null}}async function Ag(n,e){let t=await Cc(n,e);return t?{"x-scalebun-signature":t,"x-scalebun-sdk-version":Ic}:{}}var Ic,Xs,Js=k(()=>{"use strict";Ic="1",Xs=new Map});var Ac={};L(Ac,{gzipString:()=>Tg});async function Tg(n){if(typeof CompressionStream=="undefined")return null;try{let e=new CompressionStream("gzip"),t=e.writable.getWriter();return t.write(new TextEncoder().encode(n)),t.close(),await new Response(e.readable).arrayBuffer()}catch{return null}}var Tc=k(()=>{"use strict"});function Pg(){return new Promise(n=>{try{if(typeof indexedDB=="undefined")return n(null);let e=indexedDB.open(Rg,1);e.onupgradeneeded=()=>{let t=e.result;t.objectStoreNames.contains(xt)||t.createObjectStore(xt)},e.onsuccess=()=>n(e.result),e.onerror=()=>n(null)}catch{n(null)}})}var Rg,xt,Mg,Be,Wt=k(()=>{"use strict";Rg="scalebun",xt="queue",Mg="pending";Be=class{constructor(e=Mg){this.key=e;this.dbp=null}db(){return this.dbp||(this.dbp=Pg()),this.dbp}async load(){let e=await this.db();return e?new Promise(t=>{try{let r=e.transaction(xt,"readonly").objectStore(xt).get(this.key);r.onsuccess=()=>t(Array.isArray(r.result)?r.result:[]),r.onerror=()=>t([])}catch{t([])}}):[]}async save(e){let t=await this.db();if(t)return new Promise(r=>{try{let s=t.transaction(xt,"readwrite");s.objectStore(xt).put(e,this.key),s.oncomplete=()=>r(),s.onerror=()=>r()}catch{r()}})}async clear(){return this.save([])}}});function ot(){return typeof navigator=="undefined"||navigator.onLine!==!1}function Rc(n){return typeof window=="undefined"?()=>{}:(window.addEventListener("online",n),()=>window.removeEventListener("online",n))}var Lg,_g,St,Cn=k(()=>{"use strict";Lg=1e3,_g=3e4,St=class{constructor(){this.fails=0;this.nextAt=0}ready(e){return e>=this.nextAt}fail(e){let t=Math.min(_g,Lg*2**this.fails++);this.nextAt=e+Math.random()*t}reset(){this.fails=0,this.nextAt=0}}});function An(n,e,t){return n.filter(r=>{let s=e(r);return s==null||t-s<=864e5})}function kt(n,e,t){let r=n.map(c=>({it:c,n:Og(c),gone:!1})),s=r.reduce((c,l)=>c+l.n,0);if(s<=2e6)return n.slice();let i=c=>{for(let l of r){if(s<=2e6)return;l.gone||!c(l.it)||(l.gone=!0,s-=l.n)}};if(e&&t){let c=r.reduce((l,u)=>l+(t(u.it)?1:0),0);for(let l of r){if(s<=2e6)break;if(l.gone||!e(l.it))continue;let u=t(l.it);u&&c<=1||(l.gone=!0,s-=l.n,u&&c--)}}else e&&i(e);i(()=>!0);let o=r.filter(c=>!c.gone).map(c=>c.it);if(!e||!t)return o;let a=!1;return o.filter(c=>e(c)?t(c)?(a=!0,!0):a:!0)}var Og,Tn=k(()=>{"use strict";Og=n=>JSON.stringify(n).length+1});function Qs(n){return/dynamically imported module|module script failed|error loading dynamically/i.test(n)}var Pn,Zs=k(()=>{"use strict";Pn=class{constructor(){this.features=new Map}add(e){this.features.set(e.name,e)}get(e){return this.features.get(e)}async setupAll(e){var t;for(let r of this.features.values())try{await r.setup(e)}catch(s){e.log(`[scalebun] feature "${r.name}" failed to set up:`,s);try{let i=s,o=String((t=i==null?void 0:i.message)!=null?t:s).slice(0,300);e.trackEvent("sdk_feature_setup_failed",{feature:r.name,error:(i==null?void 0:i.name)||"Error",message:o,moduleLoad:Qs(o)})}catch{}}}teardownAll(){for(let e of this.features.values())try{e.teardown()}catch{}this.features.clear()}}});function Ee(n){let e=2166136261;for(let t=0;t<n.length;t++)e^=n.charCodeAt(t),e=Math.imul(e,16777619);return e>>>0}function Le(n,e){return Ee(`${n}:${e}`)%100}function ei(n,e,t){if(!t.length)return null;let r=Le(n,e),s=0;for(let i of t)if(s+=i.allocationPct,r<s)return i.key;return t[t.length-1].key}var Fe=k(()=>{"use strict"});function ti(n,e){return!(n>0)||!(e>0)?!1:n-e>e*.01}function Et(n,e,t){if(!(e>0)||!ti(e,t))return 100;let r=e-t,s=Math.min(Math.max(n,0),r)+t;return Math.min(100,Math.max(0,Math.round(s/e*100)))}function Nc(n){return n>=100?100:n>=75?75:n>=50?50:n>=25?25:0}var On=k(()=>{"use strict"});var Uc={};L(Uc,{anchorOf:()=>zc,fieldKeyOf:()=>Hc,fieldLabelOf:()=>$c,formIdOf:()=>Nn,installFormAnalytics:()=>Zg,isSensitiveField:()=>Dc,isTrackableField:()=>qc,stepOf:()=>jt});function Dc(n){let e=(n.getAttribute("type")||"").toLowerCase();if(Wg.has(e))return!0;let t=n.getAttribute("autocomplete")||"";return jg.test(t)}function qc(n){if(!n||typeof n.matches!="function"||!n.matches(Gg))return!1;let e=(n.getAttribute("type")||"").toLowerCase();return Kg.has(e)?!1:!Dc(n)}function Hc(n,e){let t=n.getAttribute("name");if(t)return t;if(n.id)return n.id;let r=(n.getAttribute("type")||n.tagName).toLowerCase(),s=-1;try{s=Array.prototype.indexOf.call(e.elements,n)}catch{}return s>=0?`${r}[${s}]`:r}function $c(n){var r,s,i,o,a;let e="";try{if(e=n.getAttribute("aria-label")||"",!e){let c=n.getAttribute("id"),l=n.ownerDocument;if(c&&l&&(e=((r=l.querySelector(`label[for="${c}"]`))==null?void 0:r.textContent)||""),e||(e=((i=(s=n.closest)==null?void 0:s.call(n,"label"))==null?void 0:i.textContent)||""),!e){let u=n.getAttribute("aria-labelledby");u&&l&&(e=((a=l.getElementById((o=u.split(/\s+/)[0])!=null?o:""))==null?void 0:a.textContent)||"")}}}catch{}let t=j(e.replace(/\s+/g," ").trim());if(t)return t.length>Bc?`${t.slice(0,Bc-1)}\u2026`:t}function Jg(n){let e=5381;for(let t=0;t<n.length;t++)e=(e<<5)+e+n.charCodeAt(t)|0;return(e>>>0).toString(36)}function Nn(n){var s,i;if(n.id)return n.id;let e=n.getAttribute("name");if(e)return e;let t="";try{t=(s=(n.getAttribute("action")||"").split("?")[0])!=null?s:""}catch{}let r=[];try{for(let o of Array.from(n.elements)){let a=(i=o.getAttribute)==null?void 0:i.call(o,"name");a&&r.push(a)}}catch{}return`form_${Jg(`${n.tagName}|${t}|${r.sort().join(",")}`)}`}function jt(n){var e,t;try{let r=(t=(e=n.closest)==null?void 0:e.call(n,"[data-scalebun-step]"))==null?void 0:t.getAttribute("data-scalebun-step");return r||void 0}catch{return}}function zc(n){var e,t,r;try{let s=(e=n.getBoundingClientRect)==null?void 0:e.call(n);if(!s||s.width===0&&s.height===0)return;let i={ex:s.x|0,ey:s.y|0,ew:s.width|0,eh:s.height|0},o=(r=(t=n.closest)==null?void 0:t.call(n,"[data-scalebun-component]"))==null?void 0:r.getAttribute("data-scalebun-component");return o&&(i.component=o),i}catch{return}}function Qg(n){let e=n.validity;return e?e.valueMissing?"required":e.typeMismatch?"type":e.patternMismatch?"pattern":e.tooShort?"too_short":e.tooLong?"too_long":e.rangeUnderflow||e.rangeOverflow||e.stepMismatch?"range":e.badInput?"bad_input":e.customError?"custom":"invalid":"invalid"}function Zg(n){if(typeof document=="undefined")return{onSubmit:()=>({}),stop:()=>{}};let e=!0,t=new Map,r=m=>{let h=t.get(m);return h||(t.size>=Yg?null:(h={startedAt:at(),lastField:null,order:0,fields:new Map},t.set(m,h),n.onEvent({name:"$form_start",props:{form_id:Nn(m),form_name:m.getAttribute("name")||void 0,field_count:s(m),step:jt(m)}}),h))},s=m=>{try{return m.elements?m.elements.length:0}catch{return 0}},i=m=>Array.from(m.fields.entries()).slice(0,Xg).map(([h,g])=>({key:h,ms:Math.round(g.ms),changed:g.changed,errored:g.errored,order:g.order,...g.label?{label:g.label}:{}})),o=m=>{if(!e)return null;let h=m.target;if(!qc(h))return null;let g=h.form;if(!g||Fc(g)||Fc(h))return null;let S=r(g);return S?{form:g,el:h,key:Hc(h,g),st:S}:null},a=m=>{let h=o(m);if(!h)return;let{st:g,key:S}=h,v=g.fields.get(S);v||(v={ms:0,changed:!1,errored:!1,order:g.order++,focusedAt:null,label:$c(h.el)},g.fields.set(S,v)),v.focusedAt=at(),g.lastField=S},c=m=>{let h=o(m);if(!h)return;let g=h.st.fields.get(h.key);!g||g.focusedAt==null||(g.ms+=at()-g.focusedAt,g.focusedAt=null)},l=m=>{let h=o(m);if(!h)return;let g=h.st.fields.get(h.key);g&&!g.changed&&(g.changed=!0)},u=m=>{var S;let h=o(m);if(!h)return;let g=h.st.fields.get(h.key);g&&(g.errored=!0),n.onEvent({name:"$form_error",props:{form_id:Nn(h.form),field_key:h.key,error_type:Qg(h.el),step:jt(h.form),...(S=zc(h.el))!=null?S:{}}})},d=(m,h)=>{var g;for(let S of h.fields.values())S.focusedAt!=null&&(S.ms+=at()-S.focusedAt,S.focusedAt=null);n.onEvent({name:"$form_abandon",props:{form_id:Nn(m),last_field:(g=h.lastField)!=null?g:void 0,time_ms:Math.round(at()-h.startedAt),fields_touched:h.fields.size,field_stats:i(h),step:jt(m)}})},p=()=>{if(!(!e||!t.size)){for(let[m,h]of t)d(m,h);t.clear()}},f=()=>{document.visibilityState==="hidden"&&p()};return document.addEventListener("focusin",a,!0),document.addEventListener("focusout",c,!0),document.addEventListener("input",l,!0),document.addEventListener("invalid",u,!0),document.addEventListener("visibilitychange",f),window.addEventListener("pagehide",p),{onSubmit(m){let h=t.get(m);if(!h)return{};t.delete(m);for(let g of h.fields.values())g.focusedAt!=null&&(g.ms+=at()-g.focusedAt,g.focusedAt=null);return{duration_ms:Math.round(at()-h.startedAt),fields_touched:h.fields.size,field_stats:i(h),step:jt(m)}},stop(){e=!1,document.removeEventListener("focusin",a,!0),document.removeEventListener("focusout",c,!0),document.removeEventListener("input",l,!0),document.removeEventListener("invalid",u,!0),document.removeEventListener("visibilitychange",f),window.removeEventListener("pagehide",p),t.clear()}}}var Wg,jg,Kg,Gg,Xg,Yg,Bc,Fc,at,Vc=k(()=>{"use strict";$();Wg=new Set(["password","hidden"]),jg=/(^|\s|-)(cc-|new-password|current-password|one-time-code)/i,Kg=new Set(["submit","button","reset","image"]),Gg="input, select, textarea",Xg=30,Yg=20;Bc=60;Fc=n=>!!n&&typeof n.closest=="function"&&!!n.closest("[data-scalebun-no-capture]");at=()=>typeof performance!="undefined"?performance.now():Date.now()});var Wc={};L(Wc,{installScrollTracker:()=>eb});function eb(){if(typeof window=="undefined"||typeof document=="undefined")return{summary:()=>tb(),reset:()=>{},stop:()=>{}};let n=0,e=0,t=0,r=0,s=()=>document.documentElement,i=()=>{try{let l=s();e=Math.max(e,l.scrollHeight),t=window.innerWidth||l.clientWidth||0,r=window.innerHeight||l.clientHeight||0}catch{}},o=()=>{let l=window.scrollY||window.pageYOffset||0;l>n&&(n=l)},a;if(typeof ResizeObserver!="undefined")try{a=new ResizeObserver(()=>i()),a.observe(s())}catch{a=void 0}return i(),window.addEventListener("scroll",o,{passive:!0}),window.addEventListener("resize",i,{passive:!0}),{summary:()=>{i();let l=e||0,u=r||0,d=Et(n,l,u);return{scroll_depth_pct:d,max_scroll_px:Math.round(n),doc_h:Math.round(l),viewport_w:Math.round(t),viewport_h:Math.round(u),max_bucket:Nc(d),scrollable:ti(l,u)}},reset:()=>{n=0,e=0,t=window.innerWidth||0,r=window.innerHeight||0},stop:()=>{window.removeEventListener("scroll",o),window.removeEventListener("resize",i),a==null||a.disconnect()}}}function tb(){return{scroll_depth_pct:0,max_scroll_px:0,doc_h:0,viewport_w:0,viewport_h:0,max_bucket:0,scrollable:!1}}var jc=k(()=>{"use strict";On()});var Gc={};L(Gc,{ATTENTION_BANDS:()=>nb,bandFractions:()=>Kc,installAttentionTracker:()=>rb});function Kc(n,e,t,r){let s=new Array(r).fill(0);if(t<=0||e<=0||r<=0)return s;let i=t/r,o=Math.max(0,n),a=Math.min(t,n+e);for(let c=0;c<r;c++){let l=c*i,u=(c+1)*i,d=Math.max(0,Math.min(a,u)-Math.max(o,l));s[c]=i>0?d/i:0}return s}function rb(){if(typeof window=="undefined"||typeof document=="undefined")return{summary:()=>sb(),reset:()=>{},stop:()=>{}};let n=new Array(10).fill(0),e=0,t=0,r=ct(),s=ct(),i=!1,o=()=>document.documentElement,a=()=>{try{e=Math.max(e,o().scrollHeight),t=window.innerHeight||o().clientHeight||0}catch{}},c=()=>{var v,y;if(i)return;let m=ct(),h=m-r;if(r=m,h<=0||typeof document.visibilityState=="string"&&document.visibilityState!=="visible"||m-s>15e3)return;let g=window.scrollY||window.pageYOffset||0,S=Kc(g,t,e,10);for(let b=0;b<10;b++)n[b]=((v=n[b])!=null?v:0)+h*((y=S[b])!=null?y:0)},l=()=>{s=ct()},u=()=>{document.visibilityState==="visible"?r=ct():c()},d,p;if(typeof ResizeObserver!="undefined")try{p=new ResizeObserver(()=>a()),p.observe(o())}catch{p=void 0}return a(),d=setInterval(c,500),window.addEventListener("scroll",l,{passive:!0}),window.addEventListener("pointermove",l,{passive:!0}),window.addEventListener("keydown",l,{passive:!0}),window.addEventListener("resize",a,{passive:!0}),document.addEventListener("visibilitychange",u),{summary:()=>{a(),c();let m=n.map(h=>Math.round(h));return{attention_bands:m,attention_active_ms:m.reduce((h,g)=>h+g,0),attention_bands_n:10}},reset:()=>{n.fill(0),e=0,t=0,r=ct(),s=ct(),a()},stop:()=>{i=!0,d&&clearInterval(d),window.removeEventListener("scroll",l),window.removeEventListener("pointermove",l),window.removeEventListener("keydown",l),window.removeEventListener("resize",a),document.removeEventListener("visibilitychange",u),p==null||p.disconnect()}}}function sb(){return{attention_bands:new Array(10).fill(0),attention_active_ms:0,attention_bands_n:10}}var nb,ct,Xc=k(()=>{"use strict";nb=10;ct=()=>typeof performance!="undefined"&&performance.now?performance.now():Date.now()});var Zc={};L(Zc,{describeElement:()=>Fn,installAutocapture:()=>pb});function cb(n){let e=n.tagName.toLowerCase();n.id&&(e+=`#${n.id}`);let t=(n.getAttribute("class")||"").trim().split(/\s+/).filter(Boolean).slice(0,2);return t.length&&(e+="."+t.join(".")),e}function Fn(n,e=!1){var c;let t={tag:n.tagName.toLowerCase(),selector:cb(n)},r=(n.textContent||"").trim().slice(0,80);r&&(t.text=e?Qc(r):r),n.id&&(t.el_id=n.id);let s=(n.getAttribute("class")||"").trim().split(/\s+/).filter(Boolean).slice(0,3);s.length&&(t.classes=s);let i=n.getAttribute("href");i&&!/^\s*javascript:/i.test(i)&&(t.href=i);let o=n.getAttribute("name");o&&(t.name=o);let a=(c=n.closest("[data-scalebun-variant]"))==null?void 0:c.getAttribute("data-scalebun-variant");return a&&(t.variant=a),t}function lb(n,e){for(let t of e)if(t instanceof Element&&typeof t.matches=="function"&&t.matches(Yc))return t;return n&&typeof n.closest=="function"?n.closest(Yc):null}function db(n){return ab.has(n.tagName)?!1:n.id||(n.getAttribute("class")||"").trim()?!0:!!(n.textContent||"").trim()}function ub(n){try{return new URL(n,location.href)}catch{return null}}function Jc(){try{return location.pathname}catch{return""}}function pb(n){if(typeof document=="undefined"||typeof window=="undefined")return()=>{};let e=!0,t;Promise.resolve().then(()=>(Vc(),Uc)).then(T=>{e&&(t=T.installFormAnalytics(n))}).catch(()=>{});let r;Promise.resolve().then(()=>(jc(),Wc)).then(T=>{e&&(r=T.installScrollTracker())}).catch(()=>{});let s;Promise.resolve().then(()=>(Xc(),Gc)).then(T=>{e&&(s=T.installAttentionTracker())}).catch(()=>{});let i=T=>{var ce;if(!e)return;let A=T.target,O=typeof T.composedPath=="function"?T.composedPath():[],z=lb(A,O),D=z!=null?z:A&&db(A)?A:null;if(!D||Bn(D))return;let te={...Fn(D,n.maskText===!0),event:"click",path:location.pathname,interactive:z!=null};n.onEvent({name:"$autocapture",props:te});let J=(ce=D.getAttribute)==null?void 0:ce.call(D,"href");if(!J||/^\s*javascript:/i.test(J))return;let Q=ub(J);if(!Q)return;D.hasAttribute("download")||ob.test(Q.pathname+Q.search)?n.onEvent({name:"$download",props:{url:Q.href,file:Q.pathname.split("/").pop()||Q.pathname,path:location.pathname}}):Q.host&&Q.host!==location.host&&n.onEvent({name:"$outbound_link",props:{url:Q.href,host:Q.host,path:location.pathname}})},o=T=>{var z;if(!e)return;let A=T.target;if(!A||typeof A.matches!="function"||!A.matches(ib)||Bn(A))return;let O={...Fn(A,n.maskText===!0),event:"change",path:location.pathname};if(A instanceof HTMLSelectElement){let D=(z=A.selectedOptions)==null?void 0:z[0];O.option_value=A.value,O.option_index=A.selectedIndex,D&&(O.option_text=n.maskText===!0?Qc(D.text):D.text),O.multiple=A.multiple||void 0}else A instanceof HTMLInputElement&&(O.checked=A.checked,O.input_type=A.type,A.value&&A.value!=="on"&&(O.option_value=A.value));n.onEvent({name:"$change",props:O})},a=T=>{var O;if(!e)return;let A=T.target;!A||A.tagName!=="FORM"||Bn(A)||n.onEvent({name:"$submit",props:{form_id:A.id||void 0,action:A.getAttribute("action")||void 0,fields:A.elements?A.elements.length:0,...(O=t==null?void 0:t.onSubmit(A))!=null?O:{}}})},c=0,l=null,u=0,d=Jc(),p=!1,f=!1,m=()=>typeof performance!="undefined"?performance.now():0,h=()=>document.visibilityState!=="hidden"&&(typeof document.hasFocus!="function"||document.hasFocus()),g=()=>{e&&l==null&&h()&&(l=m())},S=()=>{l!=null&&(c+=m()-l,l=null)},v=()=>{if(e)try{let T=document.documentElement,A=Et(window.scrollY,T.scrollHeight,window.innerHeight||T.clientHeight);A>u&&(u=A)}catch{}},y=()=>{var T,A;!p||f||(S(),f=!0,n.onEvent({name:"$pageleave",props:{path:d,engagement_ms:Math.round(c),scroll_depth_pct:u,...(T=r==null?void 0:r.summary())!=null?T:{},...(A=s==null?void 0:s.summary())!=null?A:{}}}))},b=()=>{document.visibilityState==="hidden"?y():g()},E=new WeakSet,w;typeof IntersectionObserver!="undefined"&&(w=new IntersectionObserver(T=>{if(e)for(let A of T){let O=A.target;A.isIntersecting&&A.intersectionRatio>=.5&&!E.has(O)&&(E.add(O),w.unobserve(O),Bn(O)||n.onEvent({name:"$impression",props:{...Fn(O),path:location.pathname}}))}},{threshold:[.5]}));let I=()=>{if(!(!w||!e))try{document.querySelectorAll("[data-scalebun-track-impression]").forEach(T=>{E.has(T)||w.observe(T)})}catch{}},x=()=>{if(e){y();try{n.onEvent({name:"$pageview",props:{path:location.pathname,search:location.search||void 0}})}catch{}c=0,l=null,u=0,r==null||r.reset(),s==null||s.reset(),d=Jc(),p=!0,f=!1,g(),I()}};document.addEventListener("click",i,!0),document.addEventListener("submit",a,!0),document.addEventListener("change",o,!0),document.addEventListener("visibilitychange",b),window.addEventListener("scroll",v,{passive:!0}),window.addEventListener("focus",g),window.addEventListener("blur",S),window.addEventListener("popstate",x);let C=history.pushState,M=history.replaceState;return history.pushState=function(...T){C.apply(this,T),x()},history.replaceState=function(...T){M.apply(this,T),x()},x(),()=>{e=!1,t==null||t.stop(),r==null||r.stop(),s==null||s.stop(),document.removeEventListener("click",i,!0),document.removeEventListener("submit",a,!0),document.removeEventListener("change",o,!0),document.removeEventListener("visibilitychange",b),window.removeEventListener("scroll",v),window.removeEventListener("focus",g),window.removeEventListener("blur",S),window.removeEventListener("popstate",x),w==null||w.disconnect(),history.pushState!==C&&history.pushState.toString().includes("pageview")}}var Yc,ib,ob,ab,Qc,Bn,el=k(()=>{"use strict";On();Yc='button, a, [role="button"], input[type="submit"], input[type="button"], [data-scalebun-capture]',ib='select, input[type="checkbox"], input[type="radio"]',ob=/\.(pdf|zip|gz|tar|rar|7z|csv|tsv|xlsx?|docx?|pptx?|dmg|pkg|exe|msi|apk|ipa|mp3|mp4|mov|avi|wav|svg|png|jpe?g|gif|webp|txt|json|xml)(\?|#|$)/i,ab=new Set(["HTML","BODY","MAIN","SECTION","HEADER","FOOTER","NAV"]),Qc=n=>n.replace(/\S/g,"*");Bn=n=>!!n&&typeof n.closest=="function"&&!!n.closest("[data-scalebun-no-capture]")});function di(n){return n.replace(/[?#].*$/,"").trim()}function Mb(n){return!(!n||n.includes("node_modules")||n==="<anonymous>"||n==="native"||n==="[native code]"||/^(chrome|moz|safari|webkit)-extension:\/\//.test(n))}function xl(n){var r,s,i,o,a;if(n=n.trim(),!n)return null;if(n==="<anonymous>"||n==="native"||n==="[native code]")return{file:n};let e=/^(.*):(\d+):(\d+)$/.exec(n);if(e)return{file:di((r=e[1])!=null?r:""),line:+((s=e[2])!=null?s:0),col:+((i=e[3])!=null?i:0)};let t=/^(.*):(\d+)$/.exec(n);return t?{file:di((o=t[1])!=null?o:""),line:+((a=t[2])!=null?a:0)}:{file:di(n)}}function Sl(n,e){let t={};return n&&n!=="<anonymous>"&&(t.function=n),e.file&&(t.file=e.file),e.line!=null&&(t.line=e.line),e.col!=null&&(t.col=e.col),t.inApp=Mb(e.file),t}function Pb(n){let e=n.trim();if(!e)return null;if(e.indexOf("at ")===0){let r=e.slice(3).trim().replace(/^async\s+/,""),s,i=r.indexOf(" (");i!==-1&&r.endsWith(")")&&(s=r.slice(0,i).trim()||void 0,r=r.slice(i+2,-1));let o=xl(r);return o?Sl(s,o):null}let t=e.lastIndexOf("@");if(t!==-1){let r=e.slice(0,t).trim()||void 0,s=xl(e.slice(t+1));if(s&&s.file)return Sl(r,s)}return null}function kl(n){var r;if(!n)return[];let e=[],t=n.split(`
2
+ `);for(let s=0;s<t.length&&e.length<50;s++){let i=Pb((r=t[s])!=null?r:"");i&&e.push(i)}return e}var El=k(()=>{"use strict"});function _b(n){if(!n)return"";let e=/^[a-z]+:\/\/[^/]+(\/.*)$/i.exec(n);return e&&e[1]?e[1]:n}function Ob(n){var i;if(!n||!n.length)return"";let e=n.filter(o=>o.inApp),t=e.length?e:n,r=[],s="";for(let o of t){let a=`${(i=o.function)!=null?i:"<anonymous>"}@${_b(o.file)}`;if(a!==s&&(r.push(a),s=a,r.length>=Lb))break}return r.join(">")}function Nb(n){return n.replace(/0x[0-9a-f]+/gi,"0x?").replace(/\b[0-9a-f]{8,}\b/gi,"H").replace(/\d+/g,"N").replace(/(['"]).*?\1/g,"S").trim().slice(0,200)}function Il(n,e,t){let r=Ob(e),s=r?`${n}|${r}`:`${n}|${Nb(t)}`;return Ee(s).toString(36)}var Lb,Cl=k(()=>{"use strict";Fe();Lb=5});function Al(n,e){let t=[],r=new Set,s=a=>{var u;if(!a||typeof a!="object"||r.has(a)||t.length>=5)return;r.add(a);let c=a,l=e(c.stack);t.push({type:c.name,message:String((u=c.message)!=null?u:a),...l.length?{frames:l}:{}})},i=n==null?void 0:n.errors;if(Array.isArray(i))for(let a of i)s(a);let o=n==null?void 0:n.cause;for(;o&&t.length<5&&!r.has(o);)s(o),o=o==null?void 0:o.cause;return t}var Tl=k(()=>{"use strict"});var Rl={};L(Rl,{computeFingerprint:()=>Il,extractCauses:()=>Al,parseStack:()=>kl});var Ml=k(()=>{"use strict";El();Cl();Tl()});function zl(n){try{if(typeof n=="string")return n.length;if(n instanceof ArrayBuffer||ArrayBuffer.isView(n))return n.byteLength;if(typeof Blob!="undefined"&&n instanceof Blob)return n.size}catch{}return 0}function pi(n,e,t){let r=n.WebSocket;if(typeof r!="function")return()=>{};function s(i,o){let a=o!==void 0?new r(i,o):new r(i),c=String(i);if(t(c))return a;let l=Date.now(),u=0,d=0,p=0,f=0,m=!1,h=!1,g=a.send.bind(a);a.send=function(y){return u++,p+=zl(y),g(y)},a.addEventListener("message",v=>{d++,f+=zl(v.data)}),a.addEventListener("error",()=>{m=!0});let S=(v,y)=>{if(h)return;h=!0;let b={protocol:"ws",method:"GET",url:c,status:m&&v===void 0?0:void 0,startedAt:l,duration:Date.now()-l,error:m?"websocket error":void 0,ws:{messagesSent:u,messagesReceived:d,bytesSent:p,bytesReceived:f,...v!==void 0?{closeCode:v}:{},...y?{closeReason:y}:{}}};e(b)};return a.addEventListener("close",v=>S(v.code,v.reason)),a}s.prototype=r.prototype;try{Object.defineProperties(s,{CONNECTING:{value:r.CONNECTING},OPEN:{value:r.OPEN},CLOSING:{value:r.CLOSING},CLOSED:{value:r.CLOSED}})}catch{}return n.WebSocket=s,()=>{n.WebSocket=r}}var Ul=k(()=>{"use strict"});function fi(n,e,t){let r=n.EventSource;if(typeof r!="function")return()=>{};function s(i,o){let a=o!==void 0?new r(i,o):new r(i),c=String(i);if(t(c))return a;let l=Date.now(),u=0,d=0,p=!1,f=!1,m=()=>{if(f)return;f=!0;let g={protocol:"sse",method:"GET",url:c,status:p?0:void 0,startedAt:l,duration:Date.now()-l,error:p?"eventsource error":void 0,ws:{messagesReceived:u,bytesReceived:d,messagesSent:0,bytesSent:0}};e(g)};a.addEventListener("message",g=>{u++,d+=typeof g.data=="string"?g.data.length:0}),a.addEventListener("error",()=>{a.readyState===2&&(p=!0,m())});let h=a.close.bind(a);return a.close=function(){return m(),h()},a}s.prototype=r.prototype;try{Object.defineProperties(s,{CONNECTING:{value:r.CONNECTING},OPEN:{value:r.OPEN},CLOSED:{value:r.CLOSED}})}catch{}return n.EventSource=s,()=>{n.EventSource=r}}var Vl=k(()=>{"use strict"});function ny(n){try{if(n==null)return 0;if(typeof n=="string")return n.length;if(typeof Blob!="undefined"&&n instanceof Blob)return n.size;if(n instanceof ArrayBuffer||ArrayBuffer.isView(n))return n.byteLength;if(typeof URLSearchParams!="undefined"&&n instanceof URLSearchParams)return n.toString().length}catch{}}function mi(n,e,t){let r=n.sendBeacon;return typeof r!="function"?()=>{}:(n.sendBeacon=function(i,o){let a=String(i);if(t(a))return r.call(n,i,o!=null?o:void 0);let c=Date.now(),l=r.call(n,i,o!=null?o:void 0),u={protocol:"beacon",method:"POST",url:a,status:l?void 0:0,startedAt:c,duration:Date.now()-c,requestSize:ny(o),error:l?void 0:"beacon not queued"};return e(u),l},()=>{n.sendBeacon=r})}var Wl=k(()=>{"use strict"});var jl={};L(jl,{installBeacon:()=>mi,installEventSource:()=>fi,installStreams:()=>ry,installWebSocket:()=>pi});function ry(n,e,t,r,s){let i=[];return s.ws&&typeof n.WebSocket=="function"&&i.push(pi(n,t,r)),s.sse&&typeof n.EventSource=="function"&&i.push(fi(n,t,r)),s.beacon&&e&&typeof e.sendBeacon=="function"&&i.push(mi(e,t,r)),i}var Kl=k(()=>{"use strict";Ul();Vl();Wl()});function hi(n,e){if(/graphql/i.test(n))return!0;if(!e)return!1;let t=e.slice(0,200);return/["']?query["']?\s*[:=]/.test(t)||/^\s*(query|mutation|subscription)\b/.test(t)}function gi(n){if(!n)return;let e=n.trim();if(e.startsWith("[")){let t=Xl(e);if(Array.isArray(t)&&t.length){let r=t[0],s=r?Gl(r):void 0;return{...s!=null?s:{},batched:!0}}return}if(e.startsWith("{")){let t=Xl(e);return t&&("query"in t||"operationName"in t)?Gl(t):void 0}if(Yl.test(e))return iy(e)}function Jn(n){if(!n||typeof n!="object")return!1;if(Array.isArray(n))return n.some(t=>Jn(t));let e=n.errors;return Array.isArray(e)&&e.length>0}function Gl(n){let e={},t=n.operationName;typeof t=="string"&&t&&(e.operationName=t);let r=typeof n.query=="string"?n.query:void 0;if(r){let s=Jl(r);if(s&&(e.operationType=s),!e.operationName){let i=Ql(r);i&&(e.operationName=i)}}return e}function iy(n){let e={},t=Jl(n);t&&(e.operationType=t);let r=Ql(n);return r&&(e.operationName=r),e}function Jl(n){let e=n.trimStart();if(e.startsWith("{"))return"query";let t=Yl.exec(e.slice(0,64));return t?t[1]:void 0}function Ql(n){let e=sy.exec(n);return e&&e[2]?e[2]:void 0}function Xl(n){try{return JSON.parse(n)}catch{return}}var Yl,sy,Zl=k(()=>{"use strict";Yl=/\b(query|mutation|subscription)\b/,sy=/\b(query|mutation|subscription)\s+([A-Za-z_][A-Za-z0-9_]*)/});function bi(n,e){if(!n)return!1;let t=n.toLowerCase();return e.some(r=>t.startsWith(r.toLowerCase()))}function yi(n,e){let t=n;return t.length>e&&(t=t.slice(0,e)+"\u2026[truncated]"),j(t)}var tI,ed=k(()=>{"use strict";$();tI=64*1024});var td={};L(td,{enrichHttpCapture:()=>oy,graphqlResponseHasErrors:()=>Jn,looksLikeGraphql:()=>hi,parseGraphqlRequest:()=>gi});async function oy(n,e){var s,i,o;let t,r=async()=>(t===void 0&&(t=n.readResponseText?await n.readResponseText():null),t);if(e.graphql)try{if(hi(n.url,n.reqBody)){let a=(s=gi(n.reqBody))!=null?s:{};if(n.status&&n.status>=200&&n.status<300){let c=await r();if(c)try{a.hasErrors=Jn(JSON.parse(c))}catch{}}Object.keys(a).length&&(n.graphql=a)}}catch{}if(e.body){let a=e.body;try{if(n.reqBody&&bi(n.reqContentType,a.contentTypeAllowlist)&&(n.request={...(i=n.request)!=null?i:{},body:yi(n.reqBody,a.bodyMaxBytes)}),bi(n.resContentType,a.contentTypeAllowlist)){let c=await r();c!=null&&(n.response={...(o=n.response)!=null?o:{},body:yi(c,a.bodyMaxBytes)})}}catch{}}}var nd=k(()=>{"use strict";Zl();ed()});function vd(n){if(tr.size)for(let e of tr)try{e(n)}catch{}}function wd(n){return tr.add(n),()=>{tr.delete(n)}}var tr,Ei=k(()=>{"use strict";tr=new Set});var rr,sr,ir=k(()=>{"use strict";rr={startChild:()=>rr,finish(){},setData(){}},sr={startSpan:()=>rr,finish(){}}});function Ad(n){var r;let e=new Uint8Array(n);if(typeof crypto!="undefined"&&crypto.getRandomValues)crypto.getRandomValues(e);else for(let s=0;s<n;s++)e[s]=Date.now()+s*2654435761&255;let t="";for(let s=0;s<n;s++)t+=((r=e[s])!=null?r:0).toString(16).padStart(2,"0");return t}function At(){return Ad(16)}function je(){return Ad(8)}function Td(n){return`00-${n.traceId}-${n.spanId}-${n.sampled?"01":"00"}`}function Rd(n){var t,r,s;let e=gy.exec(n.trim().toLowerCase());return e?{traceId:(t=e[1])!=null?t:"",spanId:(r=e[2])!=null?r:"",sampled:(parseInt((s=e[3])!=null?s:"0",16)&1)===1}:null}var gy,or=k(()=>{"use strict";gy=/^00-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})$/});var ar,Md=k(()=>{"use strict";or();ir();ar=class{constructor(e,t){this.name=e;this.traceId=At();this.rootSpanId=je();this.spans=[];this.dropped=0;this.errors=0;var r,s;this.clock=t.clock,this.maxSpans=(r=t.maxSpans)!=null?r:1e3,this.sampled=(s=t.sampled)!=null?s:!0,this.onFinish=t.onFinish,this.startMs=this.clock()}open(e,t,r){if(this.endMs!=null||this.spans.length>=this.maxSpans)return this.dropped++,rr;let s={spanId:je(),parentSpanId:t,op:e,description:r,startMs:this.clock()};this.spans.push(s);let i=this.clock;return{startChild:(o,a)=>this.open(o,s.spanId,a),finish:(o=i())=>{s.endMs==null&&(s.endMs=o)},setData:(o,a)=>{var c;((c=s.data)!=null?c:s.data={})[o]=a}}}startSpan(e,t){return this.open(e,this.rootSpanId,t)}addSpan(e,t,r,s){if(this.endMs!=null||this.spans.length>=this.maxSpans){this.dropped++;return}this.spans.push({spanId:je(),parentSpanId:this.rootSpanId,op:e,startMs:Math.round(t),endMs:Math.round(r),...s?{data:s}:{}})}finish(e=this.clock()){this.endMs==null&&(this.endMs=e,this.onFinish(this))}noteError(){this.endMs==null&&this.errors++}context(){return{traceId:this.traceId,spanId:this.rootSpanId,sampled:this.sampled}}data(){var e;return{name:this.name,traceId:this.traceId,spanId:this.rootSpanId,sampled:this.sampled,startMs:this.startMs,durationMs:Math.max(0,((e=this.endMs)!=null?e:this.startMs)-this.startMs),spans:this.spans.slice(),...this.dropped>0?{droppedSpans:this.dropped}:{},...this.errors>0?{errorCount:this.errors}:{}}}}});function Pd(n,e){let t=At(),r=je(),s=[],i=(o,a,c)=>{a>0&&c>a&&s.push({spanId:je(),parentSpanId:r,op:o,startMs:Ci(a),endMs:Ci(c)})};return i("dns",n.domainLookupStart,n.domainLookupEnd),i("connect",n.connectStart,n.connectEnd),n.secureConnectionStart>0&&i("tls",n.secureConnectionStart,n.connectEnd),i("request",n.requestStart,n.responseStart),i("response",n.responseStart,n.responseEnd),i("dom",n.responseEnd,n.domContentLoadedEventEnd),i("load",n.domContentLoadedEventEnd,n.loadEventEnd),{name:`pageload ${e}`,traceId:t,spanId:r,sampled:!0,startMs:0,durationMs:Ci(n.loadEventEnd||n.duration),spans:s}}var Ci,Ld=k(()=>{"use strict";or();Ci=n=>Math.round(n)});var _d={};L(_d,{Transaction:()=>ar,buildPageload:()=>Pd,formatTraceparent:()=>Td,newSpanId:()=>je,newTraceId:()=>At,parseTraceparent:()=>Rd});var Od=k(()=>{"use strict";Md();or();Ld()});var zd={};L(zd,{createBugReportWidget:()=>By});function Oy(n){let e=n.startsWith("top")?"top: 16px;":"bottom: 16px;",t=n.endsWith("right")?"right: 16px;":"left: 16px;";return e+t}function Ny(n){return`[data-scalebun-bugreport]{position:fixed;${Oy(n)}z-index:${_y};font-family:system-ui,sans-serif}[data-scalebun-bugreport] .sbbr-launch{cursor:pointer;border:none;border-radius:9999px;padding:10px 16px;font-size:13px;font-weight:600;color:#fff;background:#ef4444;box-shadow:0 2px 8px rgba(0,0,0,.2)}[data-scalebun-bugreport].sbbr-expanded .sbbr-launch{display:none}[data-scalebun-bugreport] .sbbr-panel{display:none;width:min(300px,calc(100vw - 32px));background:#fff;color:#111827;border:1px solid #e5e7eb;border-radius:12px;padding:14px;box-shadow:0 8px 30px rgba(0,0,0,.18);margin-top:8px}[data-scalebun-bugreport] .sbbr-panel.sbbr-open{display:block}[data-scalebun-bugreport] .sbbr-title{font-size:14px;font-weight:700;margin-bottom:8px}[data-scalebun-bugreport] .sbbr-field{width:100%;box-sizing:border-box;font:inherit;font-size:13px;padding:8px;border:1px solid #e5e7eb;border-radius:8px}[data-scalebun-bugreport] textarea.sbbr-field{resize:vertical}[data-scalebun-bugreport] .sbbr-email{margin-top:8px}[data-scalebun-bugreport] .sbbr-status{font-size:12px;color:#6b7280;min-height:16px;margin-top:8px}[data-scalebun-bugreport] .sbbr-actions{display:flex;gap:8px;justify-content:flex-end;margin-top:8px}[data-scalebun-bugreport] .sbbr-btn{cursor:pointer;font:inherit;font-size:13px;padding:6px 12px;border-radius:8px}[data-scalebun-bugreport] .sbbr-cancel{border:1px solid #e5e7eb;background:#fff}[data-scalebun-bugreport] .sbbr-send{font-weight:600;border:none;background:#ef4444;color:#fff}@media(prefers-color-scheme:dark){[data-scalebun-bugreport] .sbbr-panel{background:#17161c;color:#ececf1;border-color:#2e2c36;box-shadow:0 8px 30px rgba(0,0,0,.5)}[data-scalebun-bugreport] .sbbr-field{background:#111016;color:#ececf1;border-color:#2e2c36}[data-scalebun-bugreport] .sbbr-field::placeholder{color:#8b8796}[data-scalebun-bugreport] .sbbr-status{color:#a5a1b0}[data-scalebun-bugreport] .sbbr-cancel{background:#221f2b;color:#ececf1;border-color:#2e2c36}}`}function By(n){if(typeof document=="undefined")return{destroy:()=>{}};let e=document.createElement("div");e.setAttribute("data-scalebun-bugreport",""),Ne(document,Ny(n.position));let t=document.createElement("button");t.type="button",t.className="sbbr-launch",t.textContent=n.label;let r=document.createElement("div");r.className="sbbr-panel",r.innerHTML=`
3
3
  <div class="sbbr-title">Report a bug</div>
4
4
  <textarea data-scalebun-msg class="sbbr-field" placeholder="What went wrong?" rows="4"></textarea>
5
5
  <input data-scalebun-email class="sbbr-field sbbr-email" type="email" placeholder="Your email (optional)" />
@@ -7,8 +7,8 @@
7
7
  <div class="sbbr-actions">
8
8
  <button type="button" data-scalebun-cancel class="sbbr-btn sbbr-cancel">Cancel</button>
9
9
  <button type="button" data-scalebun-send class="sbbr-btn sbbr-send">Send</button>
10
- </div>`,e.appendChild(t),e.appendChild(r),document.body.appendChild(e);let s=r.querySelector("[data-scalebun-msg]"),i=r.querySelector("[data-scalebun-email]"),o=r.querySelector("[data-scalebun-status]"),a=r.querySelector("[data-scalebun-send]"),c=r.querySelector("[data-scalebun-cancel]"),l=!1,u=m=>{l=m,r.classList.toggle("sbbr-open",m),e.classList.toggle("sbbr-expanded",m),m&&s.focus()},d=()=>u(!l),p=()=>u(!1),f=async()=>{let m=s.value.trim();if(!m){o.textContent="Please describe the bug.";return}a.disabled=!0,o.textContent="Sending\u2026";let h=null,g;try{let S=await n.onSubmit({message:m,email:i.value.trim()||void 0});S&&typeof S=="object"?g=S.e:h=S!=null?S:null}catch{h=null,g="send"}a.disabled=!1,h?(o.textContent="Thanks \u2014 your report was sent.",s.value="",i.value="",setTimeout(()=>{l&&u(!1),o.textContent=""},1500)):o.textContent=g?zd[g]:zd.send};return t.addEventListener("click",d),c.addEventListener("click",p),a.addEventListener("click",f),{destroy:()=>{t.removeEventListener("click",d),c.removeEventListener("click",p),a.removeEventListener("click",f),e.remove()}}}var zd,_y,Vd=E(()=>{"use strict";$();zd={init:"Reporting isn\u2019t ready yet. Reload the page and try again.",off:"Bug reporting is turned off for this site.",empty:"Please describe the bug.",consent:"Reporting is paused until you accept the privacy notice on this page.",send:"Couldn\u2019t reach the server. Check your connection and try again."},_y=2147483e3});var tu={};L(tu,{normalizeConfig:()=>_i});function Jd(n){let e=_e(n),t=Ke({showOnce:dt(e.showOnce),cooldownHours:Ie(e.cooldownHours),maxImpressions:Ie(e.maxImpressions),maxImpressionsPerSession:Ie(e.maxImpressionsPerSession),samplePct:Ie(e.samplePct)});return Object.keys(t).length?t:void 0}function Qd(n){let e=_e(n),t=Ke({event:U(e.event),action:U(e.action),seconds:Ie(e.seconds),sessions:Ie(e.sessions),slowMs:Ie(e.slowMs),screen:U(e.screen),delaySeconds:Ie(e.delaySeconds)});return Object.keys(t).length?t:void 0}function Zd(n){let e=_e(n),t=Ke({platforms:Li(e.platforms),minAppVersion:U(e.minAppVersion),segments:Li(e.segments),userProps:e.userProps&&typeof e.userProps=="object"&&!Array.isArray(e.userProps)?e.userProps:void 0});return Object.keys(t).length?t:void 0}function Uy(n){var t;let e=[];for(let r of Pi(n)){let s=_e(r),i=U(s.key),o=U(s.kind);!i||!o||!zy.has(o)||e.push(Ke({key:i,kind:o,label:(t=U(s.prompt))!=null?t:U(s.label),choices:Li(s.choices),scaleMax:Ie(s.scaleMax),required:typeof s.required=="boolean"?s.required:void 0,pageBreakBefore:s.pageBreakBefore===!0?!0:void 0}))}return e.length?e:void 0}function Vy(n){let e=_e(n),t=U(e.label),r=U(e.action);if(!(!t||!r||!$y.has(r)))return Ke({label:t,action:r,deepLink:U(e.deepLink)})}function eu(n){let e=_e(n),t=U(e.body);if(!t)return null;let r=_e(e.secondaryCta),s=e.style&&typeof e.style=="object"&&!Array.isArray(e.style)?e.style:void 0,i=e.ext&&typeof e.ext=="object"&&!Array.isArray(e.ext)?e.ext:void 0;return Ke({title:U(e.title),body:t,imageUrl:U(e.imageUrl),cta:Vy(e.cta),secondaryCta:U(r.label)?{label:U(r.label),action:"dismiss"}:void 0,dark:dt(e.dark),rtl:dt(e.rtl),coupon:U(e.coupon),style:s,ext:i})}function Wy(n){let e=_e(n);if(!("enabled"in e)&&!("variantB"in e)&&!("split"in e))return;let t=eu(e.variantB);return Ke({enabled:dt(e.enabled),split:Ie(e.split),variantB:t!=null?t:void 0})}function jy(n){var s,i,o;let e=_e(n),t=U(e.id),r=U(e.type);return!t||!r?null:Ke({id:t,type:r,name:(s=U(e.name))!=null?s:t,question:(i=U(e.question))!=null?i:"",questions:Uy(e.questions),scale:Ie(e.scale),trigger:U(e.trigger),targetScreen:U(e.targetScreen),triggerConfig:Qd(e.triggerConfig),targeting:Zd(e.targeting),throttle:Jd(e.throttle),enabled:(o=dt(e.enabled))!=null?o:!0,revision:U(e.revision),style:e.style&&typeof e.style=="object"&&!Array.isArray(e.style)?e.style:void 0,startScreen:U(e.startScreen),thankYouScreen:U(e.thankYouScreen)})}function Ky(n){let e=_e(n),t=U(e.id),r=eu(e.spec);if(!t||!r)return null;let s=U(e.layout);return Ke({id:t,layout:s&&Hy.includes(s)?s:"modal",trigger:U(e.trigger),delaySeconds:Ie(e.delaySeconds),targetScreen:U(e.targetScreen),triggerConfig:Qd(e.triggerConfig),targeting:Zd(e.targeting),throttle:Jd(e.throttle),spec:r,revision:U(e.revision),experiment:Wy(e.experiment),variantId:U(e.variantId),variantKey:U(e.variantKey),preview:dt(e.preview),previewId:U(e.previewId),isTest:dt(e.isTest),testRunId:U(e.testRunId),createdAt:U(e.createdAt)})}function _i(n){var t,r;let e=_e(n);return{configVersion:(t=Ie(e.configVersion))!=null?t:0,serverTime:(r=U(e.serverTime))!=null?r:new Date().toISOString(),campaigns:Pi(e.campaigns).map(jy).filter(s=>s!==null),inAppMessages:Pi(e.inAppMessages).map(Ky).filter(s=>s!==null)}}var _e,Pi,U,Ie,dt,Li,Ke,Hy,$y,zy,Oi=E(()=>{"use strict";_e=n=>n&&typeof n=="object"&&!Array.isArray(n)?n:{},Pi=n=>Array.isArray(n)?n:[],U=n=>typeof n=="string"?n:void 0,Ie=n=>typeof n=="number"&&Number.isFinite(n)?n:void 0,dt=n=>typeof n=="boolean"?n:void 0,Li=n=>{if(!Array.isArray(n))return;let e=n.filter(t=>typeof t=="string");return e.length?e:void 0},Ke=n=>{for(let e of Object.keys(n))n[e]===void 0&&delete n[e];return n},Hy=["modal","fullscreen","bottom_sheet","top_banner","bottom_banner","tooltip","toast"],$y=new Set(["dismiss","link","custom"]),zy=new Set(["scale","text","single","multi","emoji","boolean","screenshot","voice"])});var Gy,en,nu=E(()=>{"use strict";Gy={rage:["rage_tap"],dead:["dead_tap"],error:["after_crash","js_error"],network_error:["network_error"],slow_screen:["slow_screen"],shake:["shake_device"]},en=class{constructor(e){this.fire=e;this.items=[];this.timers=new Set;this.currentScreen=""}setItems(e){this.items=e,this.scheduleTimers()}onScreenView(e,t=0){let r=this.currentScreen;if(r&&r!==e)for(let s of this.items)s.trigger==="screen_exit"&&this.candidate(s,r,t);this.currentScreen=e;for(let s of this.items)s.trigger==="screen_view"&&this.candidate(s,e,t)}onSignal(e,t=0){let r=Gy[e];if(r)for(let s of this.items)s.trigger&&r.includes(s.trigger)&&this.candidate(s,this.currentScreen,t)}onCustomEvent(e,t=0){var r,s,i;for(let o of this.items)o.trigger==="custom_event"&&((s=(r=o.triggerConfig)==null?void 0:r.event)!=null?s:e)===e?this.candidate(o,this.currentScreen,t):o.trigger==="after_purchase"&&e==="purchase"?this.candidate(o,this.currentScreen,t):o.trigger==="failed_action"&&(((i=o.triggerConfig)==null?void 0:i.action)===e||e==="failed_action")&&this.candidate(o,this.currentScreen,t)}onLifecycle(e,t,r=0){var s;for(let i of this.items)if(i.trigger===e){if(e==="n_sessions"){let o=(s=i.triggerConfig)==null?void 0:s.sessions;if(typeof o=="number"&&o!==t)continue}this.candidate(i,this.currentScreen,r)}}candidate(e,t,r=0){var o,a,c;if(e.targetScreen&&t&&e.targetScreen!==t)return;let s=(c=(a=(o=e.triggerConfig)==null?void 0:o.delaySeconds)!=null?a:e.delaySeconds)!=null?c:0,i=Math.max(0,s-r/1e3);if(i>0){let l=setTimeout(()=>{this.timers.delete(l),this.fire(e)},i*1e3);this.timers.add(l)}else this.fire(e)}scheduleTimers(){var e;for(let t of this.items){let r=(e=t.triggerConfig)==null?void 0:e.seconds;if(t.trigger==="time_in_app"&&typeof r=="number"&&r>0){let s=setTimeout(()=>{this.timers.delete(s),this.candidate(t,this.currentScreen)},r*1e3);this.timers.add(s)}}}stop(){for(let e of this.timers)clearTimeout(e);this.timers.clear()}}});var lu={};L(lu,{clearEngageState:()=>Qy,hasTestSeen:()=>Di,markTestSeen:()=>qi,passesThrottle:()=>Ir,readState:()=>Ni,recordCompleted:()=>Ar,recordShown:()=>Cr});function tn(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}function Ni(n){let e=tn();if(!e)return{...kr};try{let t=e.getItem(su(n));if(!t)return{...kr};let r=JSON.parse(t);return{impressions:typeof r.impressions=="number"?r.impressions:0,lastShownAt:typeof r.lastShownAt=="number"?r.lastShownAt:0,completed:r.completed===!0,revision:typeof r.revision=="string"?r.revision:void 0}}catch{return{...kr}}}function iu(n,e){let t=tn();if(t)try{t.setItem(su(n),JSON.stringify(e))}catch{}}function ou(n){let e=Ni(n.id);return n.revision&&e.revision&&e.revision!==n.revision?{...kr,revision:n.revision}:e}function Fi(){try{return typeof sessionStorage!="undefined"?sessionStorage:null}catch{return null}}function au(n){let e=Fi();if(!e)return{sid:n,counts:{}};try{let t=e.getItem(Bi);if(!t)return{sid:n,counts:{}};let r=JSON.parse(t);return r.sid!==n||!r.counts||typeof r.counts!="object"?{sid:n,counts:{}}:{sid:n,counts:r.counts}}catch{return{sid:n,counts:{}}}}function Yy(n){let e=Fi();if(e)try{e.setItem(Bi,JSON.stringify(n))}catch{}}function cu(n,e){let t=au(e).counts[n.id];return!t||n.revision&&t.rev&&t.rev!==n.revision?0:typeof t.n=="number"?t.n:0}function Ir(n,e,t=""){var o;let r=n.throttle,s=ou(n);if(s.completed)return!1;let i=(o=r==null?void 0:r.maxImpressionsPerSession)!=null?o:r?0:Xy;return i>0&&cu(n,t)>=i?!1:r?!(r.showOnce&&s.impressions>0||typeof r.maxImpressions=="number"&&s.impressions>=r.maxImpressions||typeof r.cooldownHours=="number"&&e-s.lastShownAt<r.cooldownHours*36e5):!0}function Cr(n,e,t=""){let r=ou(n);iu(n.id,{impressions:r.impressions+1,lastShownAt:e,completed:r.completed,revision:n.revision});let s=au(t);s.counts[n.id]={n:cu(n,t)+1,rev:n.revision},Yy(s)}function Ar(n){var t;let e=Ni(n.id);iu(n.id,{...e,completed:!0,revision:(t=n.revision)!=null?t:e.revision})}function Di(n){var t;let e=tn();if(!e)return!1;try{let r=JSON.parse((t=e.getItem(Er))!=null?t:"[]");return Array.isArray(r)&&r.includes(n)}catch{return!1}}function qi(n){var t;let e=tn();if(e)try{let r=JSON.parse((t=e.getItem(Er))!=null?t:"[]").filter(s=>typeof s=="string");if(r.includes(n))return;for(r.push(n);r.length>Jy;)r.shift();e.setItem(Er,JSON.stringify(r))}catch{}}function Qy(){var e;let n=tn();if(n)try{let t=[];for(let r=0;r<n.length;r++){let s=n.key(r);s&&(s.startsWith(ru)||s==="scalebun_engage_sessions"||s===Er)&&t.push(s)}for(let r of t)n.removeItem(r);(e=Fi())==null||e.removeItem(Bi)}catch{}}var ru,su,kr,Xy,Bi,Er,Jy,Hi=E(()=>{"use strict";ru="scalebun_engage_throttle:";su=n=>`${ru}${n}`,kr={impressions:0,lastShownAt:0,completed:!1};Xy=1,Bi="scalebun_engage_session_shows";Er="scalebun_engage_test_seen",Jy=50});function fu(n){if(typeof n!="string")return!1;let e=n.trim();return!e||e.length>32?!1:pu.test(e)||rv.test(e)||sv.test(e)||iv.has(e.toLowerCase())}function $i(n,e={}){let t={};if(!n||typeof n!="object"||Array.isArray(n))return t;let r=n;for(let s of Object.keys(r)){if(!uu.includes(s)){e.keepUnknown&&typeof r[s]=="string"&&(t[s]=r[s]);continue}fu(r[s])&&(t[s]=r[s].trim())}return t}function ov(n){let e=av(n);if(!e)return null;let t=r=>{let s=r/255;return s<=.03928?s/12.92:((s+.055)/1.055)**2.4};return .2126*t(e[0])+.7152*t(e[1])+.0722*t(e[2])}function av(n){let e=n.trim();if(pu.test(e)){let r=e.slice(1);return(r.length===3||r.length===4)&&(r=r.slice(0,3).split("").map(s=>s+s).join("")),r.length>=6?[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16)]:null}let t=/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})/i.exec(e);return t?[Number(t[1]),Number(t[2]),Number(t[3])]:null}function zi(n,e){if(e&&fu(e))return e;let t=ov(n);return t==null?"#ffffff":t>.55?"#111827":"#ffffff"}function pv(n){let e={};if(!n||typeof n!="object"||Array.isArray(n))return e;let t=n;for(let r of Object.keys(du)){let s=t[r];typeof s=="string"&&du[r].includes(s)&&(e[r]=s)}return e}function mu(n,e={}){var u,d;let t=e.dark?ev:Zy,r=e.dark?nv:tv,s=$i(n),i={};for(let p of uu)i[p]=(u=s[p])!=null?u:t[p];let o=(d=s.accent)!=null?d:t.accent;i.ctaText=zi(o,s.ctaText);for(let[p,f]of Object.entries(r))i[p]=f;let a={...cv,...pv(n)},c=lv[a.density];return i.pad=c.pad,i.gap=c.gap,i.qGap=c.qGap,i.radius=dv[a.radius],i.maxWidth=uv[a.width],{vars:Object.entries(i).map(([p,f])=>`--sb-${p}:${f}`).join(";"),values:i,appearance:a}}var uu,Zy,ev,tv,nv,pu,rv,sv,iv,du,cv,lv,dv,uv,Ui=E(()=>{"use strict";uu=["accent","cardBg","titleColor","bodyColor","backdrop","ctaText","couponBg","couponFg","couponBorder"],Zy={accent:"#111827",cardBg:"#ffffff",titleColor:"#111827",bodyColor:"#111827",backdrop:"rgba(0,0,0,.28)",ctaText:"#ffffff",couponBg:"#ecfdf5",couponFg:"#065f46",couponBorder:"#10b981"},ev={accent:"#8b7ff0",cardBg:"#1b1922",titleColor:"#edeaf2",bodyColor:"#edeaf2",backdrop:"rgba(0,0,0,.55)",ctaText:"#ffffff",couponBg:"#12241d",couponFg:"#7ee2bd",couponBorder:"#00c48c"},tv={muted:"#6b7280",border:"#d1d5db",disabledBg:"#e5e7eb",disabledFg:"#9ca3af",fieldBg:"#ffffff"},nv={muted:"#9a95a6",border:"rgba(255,255,255,.16)",disabledBg:"#2e2940",disabledFg:"#6b6578",fieldBg:"#262131"},pu=/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,rv=/^rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*(?:,\s*(?:0|1|0?\.\d+)\s*)?\)$/i,sv=/^hsla?\(\s*\d{1,3}(?:deg)?\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*(?:,\s*(?:0|1|0?\.\d+)\s*)?\)$/i,iv=new Set(["transparent","black","white","red","green","blue","yellow","orange","purple","gray","grey","navy","teal","olive","maroon","silver","lime","aqua","fuchsia"]);du={separators:["none","line","card"],density:["compact","cosy","roomy"],radius:["sharp","soft","round"],width:["narrow","standard","wide"],position:["bottom","center","corner"]},cv={separators:"none",density:"cosy",radius:"soft",width:"standard",position:"bottom"},lv={compact:{pad:"14px",gap:"9px",qGap:"10px"},cosy:{pad:"20px",gap:"14px",qGap:"14px"},roomy:{pad:"26px",gap:"18px",qGap:"22px"}},dv={sharp:"4px",soft:"16px",round:"26px"},uv={narrow:"340px",standard:"420px",wide:"540px"}});var hu=E(()=>{"use strict"});var ji={};L(ji,{CssomRecorder:()=>Wi,adoptedSheetId:()=>Rr});function Rr(n){let e=gu.get(n);return e==null&&(e=fv++,gu.set(n,e)),e}function bu(n){try{return Array.from(n.cssRules).map(e=>e.cssText)}catch{return[]}}var gu,fv,Vi,Wi,Tr=E(()=>{"use strict";gu=new WeakMap,fv=1;Vi="__scalebun_cssom_patched__",Wi=class{constructor(e,t){this.reg=e;this.onMutations=t;this.installed=!1;this.pending=[];this.scheduled=!1}install(){if(typeof CSSStyleSheet=="undefined")return;let e=CSSStyleSheet.prototype;if(e[Vi])return;let t=this;this.origInsert=e.insertRule,e.insertRule=function(r,s){let i=t.origInsert.call(this,r,s),o=t.ref(this);return o&&t.record({op:"sheet",sheet:o,action:"insert",rule:r,index:i}),i},this.origDelete=e.deleteRule,e.deleteRule=function(r){t.origDelete.call(this,r);let s=t.ref(this);s&&t.record({op:"sheet",sheet:s,action:"delete",index:r})},typeof e.replaceSync=="function"&&(this.origReplaceSync=e.replaceSync,e.replaceSync=function(r){t.origReplaceSync.call(this,r);let s=t.ref(this);s&&t.record({op:"sheet",sheet:s,action:"replace",rules:bu(this)})}),typeof e.replace=="function"&&(this.origReplace=e.replace,e.replace=function(r){let s=t.origReplace.call(this,r);return Promise.resolve(s).then(()=>{let i=t.ref(this);i&&t.record({op:"sheet",sheet:i,action:"replace",rules:bu(this)})}),s}),e[Vi]=!0,this.installed=!0}disconnect(){if(!this.installed)return;let e=CSSStyleSheet.prototype;this.origInsert&&(e.insertRule=this.origInsert),this.origDelete&&(e.deleteRule=this.origDelete),this.origReplaceSync&&(e.replaceSync=this.origReplaceSync),this.origReplace&&(e.replace=this.origReplace),delete e[Vi],this.installed=!1,this.pending=[]}ref(e){let t=e.ownerNode;if(t){let r=this.reg.getId(t);return r!=null?{node:r}:null}return{adopted:Rr(e)}}record(e){this.pending.push(e),this.scheduled||(this.scheduled=!0,queueMicrotask(()=>this.flush()))}flush(){if(this.scheduled=!1,!this.pending.length)return;let e=this.pending;this.pending=[],this.onMutations(e)}}});var Br={};L(Br,{MAX_INLINED_CSS_BYTES:()=>yu,NO_MASK_TEXT_PARENTS:()=>Pr,SENSITIVE_ATTRS:()=>Lr,UNRESOLVED_SHEET_ATTR:()=>vu,absUrl:()=>qe,absolutizeAttrValue:()=>Nr,absolutizeCssUrls:()=>nn,absolutizeSrcset:()=>Su,isMaskedSubtree:()=>_r,isPasswordField:()=>Rt,maskSecret:()=>Tt,maskText:()=>Ge,resolveSnapshotOpts:()=>Ze,serializeNode:()=>Xe,serializeShadow:()=>Or,takeSnapshot:()=>bv});function gv(n){let e=(n!=null?n:[]).filter(r=>typeof r=="string"&&r.trim()),t=e.length?`${Ki},${e.join(",")}`:Ki;try{return typeof document!="undefined"&&document.documentElement.matches(t),t}catch{return Ki}}function _r(n,e){if(!n||!e)return!1;try{return!!n.closest(e)}catch{return!1}}function Ze(n={}){var e,t;return{maskAllText:(e=n.maskAllText)!=null?e:!0,maskAllInputs:(t=n.maskAllInputs)!=null?t:!0,maskSel:gv(n.maskSelectors),cssBudget:{used:0}}}function bv(n,e,t={}){var r;return(r=Xe(n,e,Ze(t)))!=null?r:{t:"doc",id:e.add(n),children:[]}}function Xe(n,e,t){var r,s;switch(n.nodeType){case 9:{let o={t:"doc",id:e.add(n),children:Mr(n,e,t)},a=xu(n,n.baseURI);return a.length&&(o.adoptedStyles=a),o}case 10:{let i=n;return{t:"dt",id:e.add(n),name:i.name,publicId:i.publicId,systemId:i.systemId}}case 1:{let i=n;if(yv(i))return wv(i,e,t,t.cssBudget);let o=e.add(n),a=i.tagName.toLowerCase(),c=i.namespaceURI===mv?"svg":i.namespaceURI===hv?"math":void 0,l=a==="style"?xv(i,e):Mr(a==="template"?i.content:i,e,t),u={t:"el",id:o,tag:a,attrs:wu(i,t),children:l};c&&(u.ns=c);let d=i.shadowRoot;return d&&(u.shadow=Or(d,e,t)),u}case 3:{let i=(s=(r=n.parentNode)==null?void 0:r.nodeName)!=null?s:"",o=n.data,c=(t.maskAllText||_r(n.parentElement,t.maskSel))&&!Pr.has(i)?Ge(o):o;return{t:"tx",id:e.add(n),value:c}}case 8:return{t:"cm",id:e.add(n),value:n.data};case 4:return{t:"tx",id:e.add(n),value:n.data};default:return null}}function Mr(n,e,t){let r=[];return n.childNodes.forEach(s=>{let i=Xe(s,e,t);i&&r.push(i)}),r}function yv(n){var t;if(n.tagName.toLowerCase()!=="link")return!1;let e=((t=n.getAttribute("rel"))!=null?t:"").toLowerCase();return e.split(/\s+/).includes("stylesheet")&&!e.includes("alternate")}function vv(n){var e;try{let t=(e=n.sheet)==null?void 0:e.cssRules;return!t||t.length===0?null:Array.from(t).map(r=>r.cssText).join("")}catch{return null}}function wv(n,e,t,r){let s=e.add(n),i=vv(n);if(i&&r.used+i.length<=yu){r.used+=i.length;let a=nn(i,n.ownerDocument.baseURI),c=n.ownerDocument.createTextNode(""),l={},u=n.getAttribute("media");u&&(l.media=u);let d=n.getAttribute("href");return d&&(l["data-scalebun-href"]=qe(d,n.ownerDocument.baseURI)),{t:"el",id:s,tag:"style",attrs:l,children:[{t:"tx",id:e.add(c),value:a}]}}let o=wu(n,t);return o[vu]=i?"budget":"cors",{t:"el",id:s,tag:"link",attrs:o,children:[]}}function xv(n,e){var s,i,o;let t="";try{let a=(s=n.sheet)==null?void 0:s.cssRules;a&&a.length&&(t=Array.from(a).map(c=>c.cssText).join(""))}catch{}if(t||(t=(i=n.textContent)!=null?i:""),!t)return[];t=nn(t,n.ownerDocument.baseURI);let r=(o=n.firstChild)!=null?o:n.ownerDocument.createTextNode("");return[{t:"tx",id:e.add(r),value:t}]}function Rt(n){var t,r;let e=(t=n.tagName)==null?void 0:t.toLowerCase();return e!=="input"&&e!=="textarea"?!1:(((r=n.getAttribute)==null?void 0:r.call(n,"type"))||"").toLowerCase()==="password"}function wu(n,e){var i,o,a,c;let t={};for(let l of Array.from(n.attributes))t[l.name]=e.maskAllInputs&&Lr.has(l.name)?Ge(l.value):l.value;let r=n.tagName.toLowerCase();if(r==="input"||r==="textarea"){let l=(o=(i=n.value)!=null?i:t.value)!=null?o:"";Rt(n)?t.value=Tt(l):t.value=e.maskAllInputs?Ge(l):l}t.loading==="lazy"&&(r==="img"||r==="iframe")&&(t.loading="eager");let s=(c=(a=n.ownerDocument)==null?void 0:a.baseURI)!=null?c:"";for(let l of kv){let u=t[l];u!=null&&(t[l]=Nr(l,u,r,s))}return t}function Or(n,e,t){var a,c,l;let s={mode:"open",id:e.add(n),children:Mr(n,e,t)},i=(l=(c=(a=n.host)==null?void 0:a.ownerDocument)==null?void 0:c.baseURI)!=null?l:"",o=xu(n,i);return o.length&&(s.adoptedStyles=o),s}function xu(n,e){try{let t=n.adoptedStyleSheets;if(!t||!t.length)return[];let r=[];for(let s of t)try{let i=Array.from(s.cssRules).map(o=>o.cssText).join("");i&&r.push({id:Rr(s),css:nn(i,e)})}catch{}return r}catch{return[]}}function Ge(n){return n.replace(/\S/g,"*")}function Tt(n){return"*".repeat(n.length)}function qe(n,e){let t=n.trim();if(!t||!e||Sv.test(t))return n;try{return new URL(t,e).href}catch{return n}}function nn(n,e){if(!n||!e)return n;let t=n.replace(/url\(\s*(['"]?)([^'")]*)\1\s*\)/gi,(r,s,i)=>`url(${s}${qe(i,e)}${s})`);return t=t.replace(/@import\s+(['"])([^'"]+)\1/gi,(r,s,i)=>`@import ${s}${qe(i,e)}${s}`),t}function Nr(n,e,t,r){if(!e||!r)return e;switch(n){case"src":case"poster":return qe(e,r);case"srcset":return Su(e,r);case"style":return nn(e,r);case"href":return t==="link"||t==="use"||t==="image"?qe(e,r):e;case"xlink:href":return t==="use"||t==="image"?qe(e,r):e;case"data":return t==="object"?qe(e,r):e;default:return e}}function Su(n,e){return!n||!e||/data:/i.test(n)?n:n.split(",").map(t=>{let r=t.trim();if(!r)return r;let s=r.search(/\s/);return s===-1?qe(r,e):qe(r.slice(0,s),e)+r.slice(s)}).join(", ")}var Pr,Lr,mv,hv,Ki,yu,vu,Sv,kv,et=E(()=>{"use strict";Tr();Pr=new Set(["STYLE","SCRIPT"]),Lr=new Set(["value","placeholder","alt","title","aria-label","srcdoc"]),mv="http://www.w3.org/2000/svg",hv="http://www.w3.org/1998/Math/MathML",Ki='[data-scalebun-mask],[contenteditable=""],[contenteditable="true"]';yu=2*1024*1024,vu="data-scalebun-sheet-unresolved";Sv=/^(?:[a-z][a-z0-9+.-]*:|\/\/|#)/i;kv=["src","srcset","poster","style","href","xlink:href","data"]});var Fr={};L(Fr,{NodeRegistry:()=>rn});var rn,sn=E(()=>{"use strict";rn=class{constructor(e=1){this.idToNode=new Map;this.nodeToId=new WeakMap;this.counter=e}add(e){let t=this.nodeToId.get(e);if(t!=null)return t;let r=this.counter++;return this.nodeToId.set(e,r),this.idToNode.set(r,e),r}set(e,t){this.nodeToId.set(t,e),this.idToNode.set(e,t),e>=this.counter&&(this.counter=e+1)}getId(e){return this.nodeToId.get(e)}getNode(e){return this.idToNode.get(e)}has(e){return this.nodeToId.has(e)}remove(e){let t=this.nodeToId.get(e);t!=null&&(this.nodeToId.delete(e),this.idToNode.delete(t))}get size(){return this.idToNode.size}}});var Gi={};L(Gi,{captureScreenshot:()=>Ev,startVoiceRecording:()=>Av});async function Ev(n){if(typeof document=="undefined")return null;try{let[{takeSnapshot:e},{NodeRegistry:t}]=await Promise.all([Promise.resolve().then(()=>(et(),Br)),Promise.resolve().then(()=>(sn(),Fr))]),r=e(document,new t,{maskAllText:n,maskAllInputs:n});return{kind:"screenshot",blob:new Blob([JSON.stringify(r)],{type:Eu}),contentType:Eu,width:typeof window!="undefined"?window.innerWidth:void 0,height:typeof window!="undefined"?window.innerHeight:void 0,masked:n}}catch{return null}}function Cv(n){var t;let e=typeof MediaRecorder!="undefined"?MediaRecorder:void 0;if(!e)return null;for(let r of Iv)if(!(r&&!((t=e.isTypeSupported)!=null&&t.call(e,r))))try{let s=new e(n,r?{mimeType:r}:void 0),i=[];return s.ondataavailable=o=>{o.data&&o.data.size&&i.push(o.data)},s.start(),{rec:s,mime:r||s.mimeType||"",chunks:i}}catch{}return null}async function Av(){var h,g,S;if(typeof navigator=="undefined"||!((h=navigator.mediaDevices)!=null&&h.getUserMedia)||typeof MediaRecorder=="undefined")return null;let n;try{n=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{return null}let e=Cv(n);if(!e){for(let v of n.getTracks())v.stop();return null}let{rec:t,mime:r,chunks:s}=e,i=Date.now(),o,a,c;try{let v=(g=globalThis.AudioContext)!=null?g:globalThis.webkitAudioContext;if(v&&typeof requestAnimationFrame=="function"){a=new v;let y=a.createAnalyser();y.fftSize=512,a.createMediaStreamSource(n).connect(y);let b=new Float32Array(y.fftSize),w=()=>{y.getFloatTimeDomainData(b);let x=0;for(let I=0;I<b.length;I++)x+=b[I]*b[I];o==null||o(Math.sqrt(x/b.length)),c=requestAnimationFrame(w)};c=requestAnimationFrame(w)}}catch{}let l="",u,d=(S=globalThis.SpeechRecognition)!=null?S:globalThis.webkitSpeechRecognition,p;if(typeof d=="function")try{let v=new d;v.continuous=!0,v.interimResults=!0,v.onresult=y=>{let b=y.results,w="";for(let x=0;x<b.length;x++)w+=b[x][0].transcript;l=w,u==null||u(l)};try{let y=d.available;if(typeof y=="function"){let b=typeof navigator!="undefined"&&navigator.language||"en-US";await y({langs:[b],processLocally:!0})==="available"&&(v.processLocally=!0)}}catch{}v.start(),p=v}catch{}let f=()=>{try{p==null||p.stop()}catch{}c!=null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(c);try{a==null||a.close()}catch{}for(let v of n.getTracks())v.stop()},m=setTimeout(()=>{t.state!=="inactive"&&t.stop()},3e4);return{onInterim(v){u=v},onLevel(v){o=v},cancel(){clearTimeout(m);try{t.state!=="inactive"&&t.stop()}catch{}f()},stop(){return clearTimeout(m),new Promise(v=>{var y;t.onstop=()=>{f();let b=Math.min(29999,Date.now()-i);if(!s.length){v(null);return}let w=r||s[0].type||"audio/webm";v({kind:"voice",blob:new Blob(s,{type:w}),contentType:w,durationMs:b,transcript:l||void 0,transcriptApproved:!1})},t.state!=="inactive"?t.stop():(y=t.onstop)==null||y.call(t,new Event("stop"))})}}}var Eu,Iv,Xi=E(()=>{"use strict";hu();Eu="application/scalebun-snapshot+json";Iv=["audio/mp4;codecs=mp4a.40.2","audio/mp4","audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus",""]});function Rv(n){var e,t;if(n.questions&&n.questions.length)return n.questions;switch(n.type){case"NPS":return[{key:"score",kind:"scale",scaleMax:(e=n.scale)!=null?e:10,label:n.question}];case"CSAT":case"RATINGS_PROMPT":return[{key:"score",kind:"scale",scaleMax:(t=n.scale)!=null?t:5,label:n.question}];case"FEEDBACK":return[{key:"text",kind:"text",label:n.question}];default:return[{key:"text",kind:"text",label:n.question}]}}function Mv(n){let e=[];for(let t of n)(!e.length||t.pageBreakBefore&&e[e.length-1].length)&&e.push([]),e[e.length-1].push(t);return e.length?e:[[]]}function Iu(n,e){var Se,le;let t=document.createElement("div");t.setAttribute("data-scalebun-engage","");let r=t.attachShadow({mode:"open"}),s=((Se=n.style)==null?void 0:Se.dark)===!0,i=((le=n.style)==null?void 0:le.rtl)===!0,o=mu(n.style,{dark:s});t.setAttribute("dir",i?"rtl":"ltr");for(let[q,V]of Object.entries(o.appearance))t.setAttribute(`data-${q}`,V);document.body.appendChild(t);let a=Rv(n),c=new Map,l=!1,u=()=>{var q;l||(l=!0,(q=e.onStarted)==null||q.call(e))};Ne(r,`:host{${o.vars}}
11
- ${Pv}`);let d=document.createElement("div");d.className="ov";let p=document.createElement("div");p.className="card",p.setAttribute("role","dialog"),p.setAttribute("aria-modal","true"),p.setAttribute("aria-label",n.name||"Survey"),d.appendChild(p),r.appendChild(d);let f=document.createElement("div");p.appendChild(f);let m=["text","screenshot","voice"],h=new Map,g=Mv(a),S=0,v=g.length-1,y=q=>c.has(q.key)||m.includes(q.kind),b=q=>{var V;return((V=g[q])!=null?V:[]).every(K=>K.required===!1?!0:y(K))},w=()=>{A.disabled=!b(S),A.textContent=S===v?"Submit":"Next",R.style.display=S>0?"":"none",I.textContent=g.length>1?`Page ${S+1} of ${g.length}`:""},x=()=>{var q,V;k.replaceChildren();for(let K of(q=g[S])!=null?q:[]){let de=document.createElement("div");de.className="qb";let me=document.createElement("div");me.className="q",me.textContent=K.label||n.question,de.appendChild(me),Lv(de,K,se=>{c.set(K.key,se),u(),w()},se=>{se?h.set(K.key,se):h.delete(K.key),u(),w()},c.get(K.key)),k.appendChild(de)}w(),(V=k.querySelector("textarea, .opt, .emoji"))==null||V.focus()},I=document.createElement("div");I.className="pg",f.appendChild(I);let k=document.createElement("div");f.appendChild(k);let C=document.createElement("div");C.className="foot";let M=document.createElement("button");M.className="x",M.textContent="Dismiss";let R=document.createElement("button");R.className="back",R.type="button",R.textContent="Back",R.style.display="none";let A=document.createElement("button");A.className="go",A.textContent="Submit",C.append(M,R,A),f.appendChild(C),x();let O=()=>{t.remove(),document.removeEventListener("keydown",fe)},z=()=>{e.onDismiss(),O()},D=typeof n.thankYouScreen=="string"?n.thankYouScreen.trim():"",te=()=>{if(e.onSubmit(_v(a,c,[...h.values()])),!D){O();return}f.remove();let q=document.createElement("div");q.className="thanks";let V=document.createElement("div");V.className="q",V.textContent=D,q.appendChild(V),p.appendChild(q),setTimeout(()=>d.addEventListener("click",O),0),setTimeout(O,2200)},J=()=>{if(S<v){S+=1,u(),x();return}te()},Q=()=>{S!==0&&(S-=1,x())},fe=q=>{q.key==="Escape"&&z()};M.addEventListener("click",z),A.addEventListener("click",J),R.addEventListener("click",Q),d.addEventListener("click",q=>{q.target===d&&z()}),document.addEventListener("keydown",fe);let ce=typeof n.startScreen=="string"?n.startScreen.trim():"",xe=()=>{var q;(q=k.querySelector("textarea, .opt, .emoji"))==null||q.focus()};if(ce){f.style.display="none";let q=document.createElement("div"),V=document.createElement("div");V.className="q",V.textContent=ce;let K=document.createElement("div");K.className="lede",K.textContent=`${a.length} quick question${a.length===1?"":"s"}`;let de=document.createElement("div");de.className="foot";let me=document.createElement("button");me.className="x",me.textContent="Dismiss";let se=document.createElement("button");se.className="go",se.textContent="Start",de.append(me,se),q.append(V,K,de),p.insertBefore(q,f),me.addEventListener("click",z),se.addEventListener("click",()=>{q.remove(),f.style.display="",u(),xe()}),se.focus()}else xe();return{close:O}}function Lv(n,e,t,r,s){var i,o;if(e.kind==="screenshot"){let a=document.createElement("div");a.className="att";let c=document.createElement("button");c.className="attbtn",c.type="button",c.textContent="\u{1F4F7} Attach screenshot",c.addEventListener("click",async()=>{c.disabled=!0;try{let{captureScreenshot:l}=await Promise.resolve().then(()=>(Xi(),Gi)),u=await l(!0);u?(r(u),c.textContent="\u2713 Screenshot attached",c.setAttribute("data-done","true")):c.textContent="Screenshot unavailable"}finally{c.disabled=!1}}),a.appendChild(c),n.appendChild(a);return}if(e.kind==="voice"){let a=document.createElement("div");a.className="att";let c=document.createElement("button");c.className="attbtn",c.type="button",c.textContent="\u{1F399} Record voice";let l=document.createElement("textarea");l.placeholder="Transcript (editable)\u2026",l.style.display="none";let u=null;c.addEventListener("click",async()=>{if(u){let d=u;u=null,c.disabled=!0;let p=await d.stop();c.disabled=!1,p?(p.transcript=l.value||p.transcript,p.transcriptApproved=!0,r(p),c.textContent="\u2713 Voice attached",c.setAttribute("data-done","true")):c.textContent="\u{1F399} Record voice"}else{c.disabled=!0;let{startVoiceRecording:d}=await Promise.resolve().then(()=>(Xi(),Gi));if(u=await d(),c.disabled=!1,!u){c.textContent="Mic unavailable";return}l.style.display="block",u.onInterim(p=>{l.value=p}),c.textContent="\u23F9 Stop"}}),a.appendChild(c),n.appendChild(a),n.appendChild(l);return}if(e.kind==="text"){let a=document.createElement("textarea");typeof s=="string"&&(a.value=s),a.addEventListener("input",()=>t(a.value)),n.appendChild(a);return}if(e.kind==="scale"){let a=(i=e.scaleMax)!=null?i:5,c=a>=10?0:1,l=document.createElement("div");l.className="row";let u=[];for(let d=c;d<=a;d++){let p=document.createElement("button");p.className="opt",p.type="button",p.textContent=String(d),p.setAttribute("aria-pressed",s===d?"true":"false"),p.addEventListener("click",()=>{u.forEach(f=>f.setAttribute("aria-pressed","false")),p.setAttribute("aria-pressed","true"),t(d)}),u.push(p),l.appendChild(p)}n.appendChild(l);return}if(e.kind==="emoji"){let a=document.createElement("div");a.className="row";let c=[];Tv.forEach((l,u)=>{let d=document.createElement("button");d.className="emoji",d.type="button",d.textContent=l,d.setAttribute("aria-pressed",s===u+1?"true":"false"),d.setAttribute("aria-label",`${u+1}`),d.addEventListener("click",()=>{c.forEach(p=>p.setAttribute("aria-pressed","false")),d.setAttribute("aria-pressed","true"),t(u+1)}),c.push(d),a.appendChild(d)}),n.appendChild(a);return}if(e.kind==="boolean"||e.kind==="single"||e.kind==="multi"){let a=e.kind==="boolean"?["Yes","No"]:(o=e.choices)!=null?o:[],c=e.kind==="multi",l=new Set(c&&Array.isArray(s)?s:[]),u=document.createElement("div");u.className="row";for(let d of a){let p=document.createElement("button");p.className="opt",p.type="button",p.textContent=d,p.setAttribute("aria-pressed",(c?l.has(d):s===d)?"true":"false"),p.addEventListener("click",()=>{c?(l.has(d)?l.delete(d):l.add(d),p.setAttribute("aria-pressed",l.has(d)?"true":"false"),t([...l])):(u.querySelectorAll(".opt").forEach(f=>f.setAttribute("aria-pressed","false")),p.setAttribute("aria-pressed","true"),t(d))}),u.appendChild(p)}n.appendChild(u)}}function _v(n,e,t){let r=[],s,i;for(let o of n){let a=e.get(o.key);if(a==null)continue;let c=Array.isArray(a)?a.join(", "):a;r.push({key:o.key,value:c}),s===void 0&&typeof a=="number"&&(s=a),i===void 0&&typeof a=="string"&&(i=a)}return{score:s,text:i,answers:r,...t.length?{attachments:t}:{}}}var Tv,Pv,Cu=E(()=>{"use strict";$();Ui();Tv=["\u{1F621}","\u{1F641}","\u{1F610}","\u{1F642}","\u{1F60D}"];Pv=`
10
+ </div>`,e.appendChild(t),e.appendChild(r),document.body.appendChild(e);let s=r.querySelector("[data-scalebun-msg]"),i=r.querySelector("[data-scalebun-email]"),o=r.querySelector("[data-scalebun-status]"),a=r.querySelector("[data-scalebun-send]"),c=r.querySelector("[data-scalebun-cancel]"),l=!1,u=m=>{l=m,r.classList.toggle("sbbr-open",m),e.classList.toggle("sbbr-expanded",m),m&&s.focus()},d=()=>u(!l),p=()=>u(!1),f=async()=>{let m=s.value.trim();if(!m){o.textContent="Please describe the bug.";return}a.disabled=!0,o.textContent="Sending\u2026";let h=null,g;try{let S=await n.onSubmit({message:m,email:i.value.trim()||void 0});S&&typeof S=="object"?g=S.e:h=S!=null?S:null}catch{h=null,g="send"}a.disabled=!1,h?(o.textContent="Thanks \u2014 your report was sent.",s.value="",i.value="",setTimeout(()=>{l&&u(!1),o.textContent=""},1500)):o.textContent=g?$d[g]:$d.send};return t.addEventListener("click",d),c.addEventListener("click",p),a.addEventListener("click",f),{destroy:()=>{t.removeEventListener("click",d),c.removeEventListener("click",p),a.removeEventListener("click",f),e.remove()}}}var $d,_y,Ud=k(()=>{"use strict";$();$d={init:"Reporting isn\u2019t ready yet. Reload the page and try again.",off:"Bug reporting is turned off for this site.",empty:"Please describe the bug.",consent:"Reporting is paused until you accept the privacy notice on this page.",send:"Couldn\u2019t reach the server. Check your connection and try again."},_y=2147483e3});var eu={};L(eu,{normalizeConfig:()=>Oi});function Yd(n){let e=_e(n),t=Ke({showOnce:dt(e.showOnce),cooldownHours:Ie(e.cooldownHours),maxImpressions:Ie(e.maxImpressions),maxImpressionsPerSession:Ie(e.maxImpressionsPerSession),samplePct:Ie(e.samplePct)});return Object.keys(t).length?t:void 0}function Jd(n){let e=_e(n),t=Ke({event:U(e.event),action:U(e.action),seconds:Ie(e.seconds),sessions:Ie(e.sessions),slowMs:Ie(e.slowMs),screen:U(e.screen),delaySeconds:Ie(e.delaySeconds)});return Object.keys(t).length?t:void 0}function Qd(n){let e=_e(n),t=Ke({platforms:_i(e.platforms),minAppVersion:U(e.minAppVersion),segments:_i(e.segments),userProps:e.userProps&&typeof e.userProps=="object"&&!Array.isArray(e.userProps)?e.userProps:void 0});return Object.keys(t).length?t:void 0}function Uy(n){var t;let e=[];for(let r of Li(n)){let s=_e(r),i=U(s.key),o=U(s.kind);!i||!o||!zy.has(o)||e.push(Ke({key:i,kind:o,label:(t=U(s.prompt))!=null?t:U(s.label),choices:_i(s.choices),scaleMax:Ie(s.scaleMax),required:typeof s.required=="boolean"?s.required:void 0,pageBreakBefore:s.pageBreakBefore===!0?!0:void 0}))}return e.length?e:void 0}function Vy(n){let e=_e(n),t=U(e.label),r=U(e.action);if(!(!t||!r||!$y.has(r)))return Ke({label:t,action:r,deepLink:U(e.deepLink)})}function Zd(n){let e=_e(n),t=U(e.body);if(!t)return null;let r=_e(e.secondaryCta),s=e.style&&typeof e.style=="object"&&!Array.isArray(e.style)?e.style:void 0,i=e.ext&&typeof e.ext=="object"&&!Array.isArray(e.ext)?e.ext:void 0;return Ke({title:U(e.title),body:t,imageUrl:U(e.imageUrl),cta:Vy(e.cta),secondaryCta:U(r.label)?{label:U(r.label),action:"dismiss"}:void 0,dark:dt(e.dark),rtl:dt(e.rtl),coupon:U(e.coupon),style:s,ext:i})}function Wy(n){let e=_e(n);if(!("enabled"in e)&&!("variantB"in e)&&!("split"in e))return;let t=Zd(e.variantB);return Ke({enabled:dt(e.enabled),split:Ie(e.split),variantB:t!=null?t:void 0})}function jy(n){var s,i,o;let e=_e(n),t=U(e.id),r=U(e.type);return!t||!r?null:Ke({id:t,type:r,name:(s=U(e.name))!=null?s:t,question:(i=U(e.question))!=null?i:"",questions:Uy(e.questions),scale:Ie(e.scale),trigger:U(e.trigger),targetScreen:U(e.targetScreen),triggerConfig:Jd(e.triggerConfig),targeting:Qd(e.targeting),throttle:Yd(e.throttle),enabled:(o=dt(e.enabled))!=null?o:!0,revision:U(e.revision),style:e.style&&typeof e.style=="object"&&!Array.isArray(e.style)?e.style:void 0,startScreen:U(e.startScreen),thankYouScreen:U(e.thankYouScreen)})}function Ky(n){let e=_e(n),t=U(e.id),r=Zd(e.spec);if(!t||!r)return null;let s=U(e.layout);return Ke({id:t,layout:s&&Hy.includes(s)?s:"modal",trigger:U(e.trigger),delaySeconds:Ie(e.delaySeconds),targetScreen:U(e.targetScreen),triggerConfig:Jd(e.triggerConfig),targeting:Qd(e.targeting),throttle:Yd(e.throttle),spec:r,revision:U(e.revision),experiment:Wy(e.experiment),variantId:U(e.variantId),variantKey:U(e.variantKey),preview:dt(e.preview),previewId:U(e.previewId),isTest:dt(e.isTest),testRunId:U(e.testRunId),createdAt:U(e.createdAt)})}function Oi(n){var t,r;let e=_e(n);return{configVersion:(t=Ie(e.configVersion))!=null?t:0,serverTime:(r=U(e.serverTime))!=null?r:new Date().toISOString(),campaigns:Li(e.campaigns).map(jy).filter(s=>s!==null),inAppMessages:Li(e.inAppMessages).map(Ky).filter(s=>s!==null)}}var _e,Li,U,Ie,dt,_i,Ke,Hy,$y,zy,Ni=k(()=>{"use strict";_e=n=>n&&typeof n=="object"&&!Array.isArray(n)?n:{},Li=n=>Array.isArray(n)?n:[],U=n=>typeof n=="string"?n:void 0,Ie=n=>typeof n=="number"&&Number.isFinite(n)?n:void 0,dt=n=>typeof n=="boolean"?n:void 0,_i=n=>{if(!Array.isArray(n))return;let e=n.filter(t=>typeof t=="string");return e.length?e:void 0},Ke=n=>{for(let e of Object.keys(n))n[e]===void 0&&delete n[e];return n},Hy=["modal","fullscreen","bottom_sheet","top_banner","bottom_banner","tooltip","toast"],$y=new Set(["dismiss","link","custom"]),zy=new Set(["scale","text","single","multi","emoji","boolean","screenshot","voice"])});var Gy,tn,tu=k(()=>{"use strict";Gy={rage:["rage_tap"],dead:["dead_tap"],error:["after_crash","js_error"],network_error:["network_error"],slow_screen:["slow_screen"],shake:["shake_device"]},tn=class{constructor(e){this.fire=e;this.items=[];this.timers=new Set;this.currentScreen=""}setItems(e){this.items=e,this.scheduleTimers()}onScreenView(e,t=0){let r=this.currentScreen;if(r&&r!==e)for(let s of this.items)s.trigger==="screen_exit"&&this.candidate(s,r,t);this.currentScreen=e;for(let s of this.items)s.trigger==="screen_view"&&this.candidate(s,e,t)}onSignal(e,t=0){let r=Gy[e];if(r)for(let s of this.items)s.trigger&&r.includes(s.trigger)&&this.candidate(s,this.currentScreen,t)}onCustomEvent(e,t=0){var r,s,i;for(let o of this.items)o.trigger==="custom_event"&&((s=(r=o.triggerConfig)==null?void 0:r.event)!=null?s:e)===e?this.candidate(o,this.currentScreen,t):o.trigger==="after_purchase"&&e==="purchase"?this.candidate(o,this.currentScreen,t):o.trigger==="failed_action"&&(((i=o.triggerConfig)==null?void 0:i.action)===e||e==="failed_action")&&this.candidate(o,this.currentScreen,t)}onLifecycle(e,t,r=0){var s;for(let i of this.items)if(i.trigger===e){if(e==="n_sessions"){let o=(s=i.triggerConfig)==null?void 0:s.sessions;if(typeof o=="number"&&o!==t)continue}this.candidate(i,this.currentScreen,r)}}candidate(e,t,r=0){var o,a,c;if(e.targetScreen&&t&&e.targetScreen!==t)return;let s=(c=(a=(o=e.triggerConfig)==null?void 0:o.delaySeconds)!=null?a:e.delaySeconds)!=null?c:0,i=Math.max(0,s-r/1e3);if(i>0){let l=setTimeout(()=>{this.timers.delete(l),this.fire(e)},i*1e3);this.timers.add(l)}else this.fire(e)}scheduleTimers(){var e;for(let t of this.items){let r=(e=t.triggerConfig)==null?void 0:e.seconds;if(t.trigger==="time_in_app"&&typeof r=="number"&&r>0){let s=setTimeout(()=>{this.timers.delete(s),this.candidate(t,this.currentScreen)},r*1e3);this.timers.add(s)}}}stop(){for(let e of this.timers)clearTimeout(e);this.timers.clear()}}});var cu={};L(cu,{clearEngageState:()=>Qy,hasTestSeen:()=>qi,markTestSeen:()=>Hi,passesThrottle:()=>Ir,readState:()=>Bi,recordCompleted:()=>Ar,recordShown:()=>Cr});function nn(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}function Bi(n){let e=nn();if(!e)return{...kr};try{let t=e.getItem(ru(n));if(!t)return{...kr};let r=JSON.parse(t);return{impressions:typeof r.impressions=="number"?r.impressions:0,lastShownAt:typeof r.lastShownAt=="number"?r.lastShownAt:0,completed:r.completed===!0,revision:typeof r.revision=="string"?r.revision:void 0}}catch{return{...kr}}}function su(n,e){let t=nn();if(t)try{t.setItem(ru(n),JSON.stringify(e))}catch{}}function iu(n){let e=Bi(n.id);return n.revision&&e.revision&&e.revision!==n.revision?{...kr,revision:n.revision}:e}function Di(){try{return typeof sessionStorage!="undefined"?sessionStorage:null}catch{return null}}function ou(n){let e=Di();if(!e)return{sid:n,counts:{}};try{let t=e.getItem(Fi);if(!t)return{sid:n,counts:{}};let r=JSON.parse(t);return r.sid!==n||!r.counts||typeof r.counts!="object"?{sid:n,counts:{}}:{sid:n,counts:r.counts}}catch{return{sid:n,counts:{}}}}function Yy(n){let e=Di();if(e)try{e.setItem(Fi,JSON.stringify(n))}catch{}}function au(n,e){let t=ou(e).counts[n.id];return!t||n.revision&&t.rev&&t.rev!==n.revision?0:typeof t.n=="number"?t.n:0}function Ir(n,e,t=""){var o;let r=n.throttle,s=iu(n);if(s.completed)return!1;let i=(o=r==null?void 0:r.maxImpressionsPerSession)!=null?o:r?0:Xy;return i>0&&au(n,t)>=i?!1:r?!(r.showOnce&&s.impressions>0||typeof r.maxImpressions=="number"&&s.impressions>=r.maxImpressions||typeof r.cooldownHours=="number"&&e-s.lastShownAt<r.cooldownHours*36e5):!0}function Cr(n,e,t=""){let r=iu(n);su(n.id,{impressions:r.impressions+1,lastShownAt:e,completed:r.completed,revision:n.revision});let s=ou(t);s.counts[n.id]={n:au(n,t)+1,rev:n.revision},Yy(s)}function Ar(n){var t;let e=Bi(n.id);su(n.id,{...e,completed:!0,revision:(t=n.revision)!=null?t:e.revision})}function qi(n){var t;let e=nn();if(!e)return!1;try{let r=JSON.parse((t=e.getItem(Er))!=null?t:"[]");return Array.isArray(r)&&r.includes(n)}catch{return!1}}function Hi(n){var t;let e=nn();if(e)try{let r=JSON.parse((t=e.getItem(Er))!=null?t:"[]").filter(s=>typeof s=="string");if(r.includes(n))return;for(r.push(n);r.length>Jy;)r.shift();e.setItem(Er,JSON.stringify(r))}catch{}}function Qy(){var e;let n=nn();if(n)try{let t=[];for(let r=0;r<n.length;r++){let s=n.key(r);s&&(s.startsWith(nu)||s==="scalebun_engage_sessions"||s===Er)&&t.push(s)}for(let r of t)n.removeItem(r);(e=Di())==null||e.removeItem(Fi)}catch{}}var nu,ru,kr,Xy,Fi,Er,Jy,$i=k(()=>{"use strict";nu="scalebun_engage_throttle:";ru=n=>`${nu}${n}`,kr={impressions:0,lastShownAt:0,completed:!1};Xy=1,Fi="scalebun_engage_session_shows";Er="scalebun_engage_test_seen",Jy=50});function pu(n){if(typeof n!="string")return!1;let e=n.trim();return!e||e.length>32?!1:uu.test(e)||rv.test(e)||sv.test(e)||iv.has(e.toLowerCase())}function zi(n,e={}){let t={};if(!n||typeof n!="object"||Array.isArray(n))return t;let r=n;for(let s of Object.keys(r)){if(!du.includes(s)){e.keepUnknown&&typeof r[s]=="string"&&(t[s]=r[s]);continue}pu(r[s])&&(t[s]=r[s].trim())}return t}function ov(n){let e=av(n);if(!e)return null;let t=r=>{let s=r/255;return s<=.03928?s/12.92:((s+.055)/1.055)**2.4};return .2126*t(e[0])+.7152*t(e[1])+.0722*t(e[2])}function av(n){let e=n.trim();if(uu.test(e)){let r=e.slice(1);return(r.length===3||r.length===4)&&(r=r.slice(0,3).split("").map(s=>s+s).join("")),r.length>=6?[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16)]:null}let t=/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})/i.exec(e);return t?[Number(t[1]),Number(t[2]),Number(t[3])]:null}function Ui(n,e){if(e&&pu(e))return e;let t=ov(n);return t==null?"#ffffff":t>.55?"#111827":"#ffffff"}function pv(n){let e={};if(!n||typeof n!="object"||Array.isArray(n))return e;let t=n;for(let r of Object.keys(lu)){let s=t[r];typeof s=="string"&&lu[r].includes(s)&&(e[r]=s)}return e}function fu(n,e={}){var u,d;let t=e.dark?ev:Zy,r=e.dark?nv:tv,s=zi(n),i={};for(let p of du)i[p]=(u=s[p])!=null?u:t[p];let o=(d=s.accent)!=null?d:t.accent;i.ctaText=Ui(o,s.ctaText);for(let[p,f]of Object.entries(r))i[p]=f;let a={...cv,...pv(n)},c=lv[a.density];return i.pad=c.pad,i.gap=c.gap,i.qGap=c.qGap,i.radius=dv[a.radius],i.maxWidth=uv[a.width],{vars:Object.entries(i).map(([p,f])=>`--sb-${p}:${f}`).join(";"),values:i,appearance:a}}var du,Zy,ev,tv,nv,uu,rv,sv,iv,lu,cv,lv,dv,uv,Vi=k(()=>{"use strict";du=["accent","cardBg","titleColor","bodyColor","backdrop","ctaText","couponBg","couponFg","couponBorder"],Zy={accent:"#111827",cardBg:"#ffffff",titleColor:"#111827",bodyColor:"#111827",backdrop:"rgba(0,0,0,.28)",ctaText:"#ffffff",couponBg:"#ecfdf5",couponFg:"#065f46",couponBorder:"#10b981"},ev={accent:"#8b7ff0",cardBg:"#1b1922",titleColor:"#edeaf2",bodyColor:"#edeaf2",backdrop:"rgba(0,0,0,.55)",ctaText:"#ffffff",couponBg:"#12241d",couponFg:"#7ee2bd",couponBorder:"#00c48c"},tv={muted:"#6b7280",border:"#d1d5db",disabledBg:"#e5e7eb",disabledFg:"#9ca3af",fieldBg:"#ffffff"},nv={muted:"#9a95a6",border:"rgba(255,255,255,.16)",disabledBg:"#2e2940",disabledFg:"#6b6578",fieldBg:"#262131"},uu=/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,rv=/^rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*(?:,\s*(?:0|1|0?\.\d+)\s*)?\)$/i,sv=/^hsla?\(\s*\d{1,3}(?:deg)?\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*(?:,\s*(?:0|1|0?\.\d+)\s*)?\)$/i,iv=new Set(["transparent","black","white","red","green","blue","yellow","orange","purple","gray","grey","navy","teal","olive","maroon","silver","lime","aqua","fuchsia"]);lu={separators:["none","line","card"],density:["compact","cosy","roomy"],radius:["sharp","soft","round"],width:["narrow","standard","wide"],position:["bottom","center","corner"]},cv={separators:"none",density:"cosy",radius:"soft",width:"standard",position:"bottom"},lv={compact:{pad:"14px",gap:"9px",qGap:"10px"},cosy:{pad:"20px",gap:"14px",qGap:"14px"},roomy:{pad:"26px",gap:"18px",qGap:"22px"}},dv={sharp:"4px",soft:"16px",round:"26px"},uv={narrow:"340px",standard:"420px",wide:"540px"}});var mu=k(()=>{"use strict"});var Ki={};L(Ki,{CssomRecorder:()=>ji,adoptedSheetId:()=>Tr});function Tr(n){let e=hu.get(n);return e==null&&(e=fv++,hu.set(n,e)),e}function gu(n){try{return Array.from(n.cssRules).map(e=>e.cssText)}catch{return[]}}var hu,fv,Wi,ji,Rr=k(()=>{"use strict";hu=new WeakMap,fv=1;Wi="__scalebun_cssom_patched__",ji=class{constructor(e,t){this.reg=e;this.onMutations=t;this.installed=!1;this.pending=[];this.scheduled=!1}install(){if(typeof CSSStyleSheet=="undefined")return;let e=CSSStyleSheet.prototype;if(e[Wi])return;let t=this;this.origInsert=e.insertRule,e.insertRule=function(r,s){let i=t.origInsert.call(this,r,s),o=t.ref(this);return o&&t.record({op:"sheet",sheet:o,action:"insert",rule:r,index:i}),i},this.origDelete=e.deleteRule,e.deleteRule=function(r){t.origDelete.call(this,r);let s=t.ref(this);s&&t.record({op:"sheet",sheet:s,action:"delete",index:r})},typeof e.replaceSync=="function"&&(this.origReplaceSync=e.replaceSync,e.replaceSync=function(r){t.origReplaceSync.call(this,r);let s=t.ref(this);s&&t.record({op:"sheet",sheet:s,action:"replace",rules:gu(this)})}),typeof e.replace=="function"&&(this.origReplace=e.replace,e.replace=function(r){let s=t.origReplace.call(this,r);return Promise.resolve(s).then(()=>{let i=t.ref(this);i&&t.record({op:"sheet",sheet:i,action:"replace",rules:gu(this)})}),s}),e[Wi]=!0,this.installed=!0}disconnect(){if(!this.installed)return;let e=CSSStyleSheet.prototype;this.origInsert&&(e.insertRule=this.origInsert),this.origDelete&&(e.deleteRule=this.origDelete),this.origReplaceSync&&(e.replaceSync=this.origReplaceSync),this.origReplace&&(e.replace=this.origReplace),delete e[Wi],this.installed=!1,this.pending=[]}ref(e){let t=e.ownerNode;if(t){let r=this.reg.getId(t);return r!=null?{node:r}:null}return{adopted:Tr(e)}}record(e){this.pending.push(e),this.scheduled||(this.scheduled=!0,queueMicrotask(()=>this.flush()))}flush(){if(this.scheduled=!1,!this.pending.length)return;let e=this.pending;this.pending=[],this.onMutations(e)}}});var Br={};L(Br,{MAX_INLINED_CSS_BYTES:()=>bu,NO_MASK_TEXT_PARENTS:()=>Pr,SENSITIVE_ATTRS:()=>Lr,UNRESOLVED_SHEET_ATTR:()=>yu,absUrl:()=>qe,absolutizeAttrValue:()=>Nr,absolutizeCssUrls:()=>rn,absolutizeSrcset:()=>xu,isMaskedSubtree:()=>_r,isPasswordField:()=>Tt,maskSecret:()=>Rt,maskText:()=>Ge,resolveSnapshotOpts:()=>Ze,serializeNode:()=>Xe,serializeShadow:()=>Or,takeSnapshot:()=>bv});function gv(n){let e=(n!=null?n:[]).filter(r=>typeof r=="string"&&r.trim()),t=e.length?`${Gi},${e.join(",")}`:Gi;try{return typeof document!="undefined"&&document.documentElement.matches(t),t}catch{return Gi}}function _r(n,e){if(!n||!e)return!1;try{return!!n.closest(e)}catch{return!1}}function Ze(n={}){var e,t;return{maskAllText:(e=n.maskAllText)!=null?e:!0,maskAllInputs:(t=n.maskAllInputs)!=null?t:!0,maskSel:gv(n.maskSelectors),cssBudget:{used:0}}}function bv(n,e,t={}){var r;return(r=Xe(n,e,Ze(t)))!=null?r:{t:"doc",id:e.add(n),children:[]}}function Xe(n,e,t){var r,s;switch(n.nodeType){case 9:{let o={t:"doc",id:e.add(n),children:Mr(n,e,t)},a=wu(n,n.baseURI);return a.length&&(o.adoptedStyles=a),o}case 10:{let i=n;return{t:"dt",id:e.add(n),name:i.name,publicId:i.publicId,systemId:i.systemId}}case 1:{let i=n;if(yv(i))return wv(i,e,t,t.cssBudget);let o=e.add(n),a=i.tagName.toLowerCase(),c=i.namespaceURI===mv?"svg":i.namespaceURI===hv?"math":void 0,l=a==="style"?xv(i,e):Mr(a==="template"?i.content:i,e,t),u={t:"el",id:o,tag:a,attrs:vu(i,t),children:l};c&&(u.ns=c);let d=i.shadowRoot;return d&&(u.shadow=Or(d,e,t)),u}case 3:{let i=(s=(r=n.parentNode)==null?void 0:r.nodeName)!=null?s:"",o=n.data,c=(t.maskAllText||_r(n.parentElement,t.maskSel))&&!Pr.has(i)?Ge(o):o;return{t:"tx",id:e.add(n),value:c}}case 8:return{t:"cm",id:e.add(n),value:n.data};case 4:return{t:"tx",id:e.add(n),value:n.data};default:return null}}function Mr(n,e,t){let r=[];return n.childNodes.forEach(s=>{let i=Xe(s,e,t);i&&r.push(i)}),r}function yv(n){var t;if(n.tagName.toLowerCase()!=="link")return!1;let e=((t=n.getAttribute("rel"))!=null?t:"").toLowerCase();return e.split(/\s+/).includes("stylesheet")&&!e.includes("alternate")}function vv(n){var e;try{let t=(e=n.sheet)==null?void 0:e.cssRules;return!t||t.length===0?null:Array.from(t).map(r=>r.cssText).join("")}catch{return null}}function wv(n,e,t,r){let s=e.add(n),i=vv(n);if(i&&r.used+i.length<=bu){r.used+=i.length;let a=rn(i,n.ownerDocument.baseURI),c=n.ownerDocument.createTextNode(""),l={},u=n.getAttribute("media");u&&(l.media=u);let d=n.getAttribute("href");return d&&(l["data-scalebun-href"]=qe(d,n.ownerDocument.baseURI)),{t:"el",id:s,tag:"style",attrs:l,children:[{t:"tx",id:e.add(c),value:a}]}}let o=vu(n,t);return o[yu]=i?"budget":"cors",{t:"el",id:s,tag:"link",attrs:o,children:[]}}function xv(n,e){var s,i,o;let t="";try{let a=(s=n.sheet)==null?void 0:s.cssRules;a&&a.length&&(t=Array.from(a).map(c=>c.cssText).join(""))}catch{}if(t||(t=(i=n.textContent)!=null?i:""),!t)return[];t=rn(t,n.ownerDocument.baseURI);let r=(o=n.firstChild)!=null?o:n.ownerDocument.createTextNode("");return[{t:"tx",id:e.add(r),value:t}]}function Tt(n){var t,r;let e=(t=n.tagName)==null?void 0:t.toLowerCase();return e!=="input"&&e!=="textarea"?!1:(((r=n.getAttribute)==null?void 0:r.call(n,"type"))||"").toLowerCase()==="password"}function vu(n,e){var i,o,a,c;let t={};for(let l of Array.from(n.attributes))t[l.name]=e.maskAllInputs&&Lr.has(l.name)?Ge(l.value):l.value;let r=n.tagName.toLowerCase();if(r==="input"||r==="textarea"){let l=(o=(i=n.value)!=null?i:t.value)!=null?o:"";Tt(n)?t.value=Rt(l):t.value=e.maskAllInputs?Ge(l):l}t.loading==="lazy"&&(r==="img"||r==="iframe")&&(t.loading="eager");let s=(c=(a=n.ownerDocument)==null?void 0:a.baseURI)!=null?c:"";for(let l of kv){let u=t[l];u!=null&&(t[l]=Nr(l,u,r,s))}return t}function Or(n,e,t){var a,c,l;let s={mode:"open",id:e.add(n),children:Mr(n,e,t)},i=(l=(c=(a=n.host)==null?void 0:a.ownerDocument)==null?void 0:c.baseURI)!=null?l:"",o=wu(n,i);return o.length&&(s.adoptedStyles=o),s}function wu(n,e){try{let t=n.adoptedStyleSheets;if(!t||!t.length)return[];let r=[];for(let s of t)try{let i=Array.from(s.cssRules).map(o=>o.cssText).join("");i&&r.push({id:Tr(s),css:rn(i,e)})}catch{}return r}catch{return[]}}function Ge(n){return n.replace(/\S/g,"*")}function Rt(n){return"*".repeat(n.length)}function qe(n,e){let t=n.trim();if(!t||!e||Sv.test(t))return n;try{return new URL(t,e).href}catch{return n}}function rn(n,e){if(!n||!e)return n;let t=n.replace(/url\(\s*(['"]?)([^'")]*)\1\s*\)/gi,(r,s,i)=>`url(${s}${qe(i,e)}${s})`);return t=t.replace(/@import\s+(['"])([^'"]+)\1/gi,(r,s,i)=>`@import ${s}${qe(i,e)}${s}`),t}function Nr(n,e,t,r){if(!e||!r)return e;switch(n){case"src":case"poster":return qe(e,r);case"srcset":return xu(e,r);case"style":return rn(e,r);case"href":return t==="link"||t==="use"||t==="image"?qe(e,r):e;case"xlink:href":return t==="use"||t==="image"?qe(e,r):e;case"data":return t==="object"?qe(e,r):e;default:return e}}function xu(n,e){return!n||!e||/data:/i.test(n)?n:n.split(",").map(t=>{let r=t.trim();if(!r)return r;let s=r.search(/\s/);return s===-1?qe(r,e):qe(r.slice(0,s),e)+r.slice(s)}).join(", ")}var Pr,Lr,mv,hv,Gi,bu,yu,Sv,kv,et=k(()=>{"use strict";Rr();Pr=new Set(["STYLE","SCRIPT"]),Lr=new Set(["value","placeholder","alt","title","aria-label","srcdoc"]),mv="http://www.w3.org/2000/svg",hv="http://www.w3.org/1998/Math/MathML",Gi='[data-scalebun-mask],[contenteditable=""],[contenteditable="true"]';bu=2*1024*1024,yu="data-scalebun-sheet-unresolved";Sv=/^(?:[a-z][a-z0-9+.-]*:|\/\/|#)/i;kv=["src","srcset","poster","style","href","xlink:href","data"]});var Fr={};L(Fr,{NodeRegistry:()=>sn});var sn,on=k(()=>{"use strict";sn=class{constructor(e=1){this.idToNode=new Map;this.nodeToId=new WeakMap;this.counter=e}add(e){let t=this.nodeToId.get(e);if(t!=null)return t;let r=this.counter++;return this.nodeToId.set(e,r),this.idToNode.set(r,e),r}set(e,t){this.nodeToId.set(t,e),this.idToNode.set(e,t),e>=this.counter&&(this.counter=e+1)}getId(e){return this.nodeToId.get(e)}getNode(e){return this.idToNode.get(e)}has(e){return this.nodeToId.has(e)}remove(e){let t=this.nodeToId.get(e);t!=null&&(this.nodeToId.delete(e),this.idToNode.delete(t))}get size(){return this.idToNode.size}}});var Xi={};L(Xi,{captureScreenshot:()=>Ev,startVoiceRecording:()=>Av});async function Ev(n){if(typeof document=="undefined")return null;try{let[{takeSnapshot:e},{NodeRegistry:t}]=await Promise.all([Promise.resolve().then(()=>(et(),Br)),Promise.resolve().then(()=>(on(),Fr))]),r=e(document,new t,{maskAllText:n,maskAllInputs:n});return{kind:"screenshot",blob:new Blob([JSON.stringify(r)],{type:ku}),contentType:ku,width:typeof window!="undefined"?window.innerWidth:void 0,height:typeof window!="undefined"?window.innerHeight:void 0,masked:n}}catch{return null}}function Cv(n){var t;let e=typeof MediaRecorder!="undefined"?MediaRecorder:void 0;if(!e)return null;for(let r of Iv)if(!(r&&!((t=e.isTypeSupported)!=null&&t.call(e,r))))try{let s=new e(n,r?{mimeType:r}:void 0),i=[];return s.ondataavailable=o=>{o.data&&o.data.size&&i.push(o.data)},s.start(),{rec:s,mime:r||s.mimeType||"",chunks:i}}catch{}return null}async function Av(){var h,g,S;if(typeof navigator=="undefined"||!((h=navigator.mediaDevices)!=null&&h.getUserMedia)||typeof MediaRecorder=="undefined")return null;let n;try{n=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{return null}let e=Cv(n);if(!e){for(let v of n.getTracks())v.stop();return null}let{rec:t,mime:r,chunks:s}=e,i=Date.now(),o,a,c;try{let v=(g=globalThis.AudioContext)!=null?g:globalThis.webkitAudioContext;if(v&&typeof requestAnimationFrame=="function"){a=new v;let y=a.createAnalyser();y.fftSize=512,a.createMediaStreamSource(n).connect(y);let b=new Float32Array(y.fftSize),E=()=>{y.getFloatTimeDomainData(b);let w=0;for(let I=0;I<b.length;I++)w+=b[I]*b[I];o==null||o(Math.sqrt(w/b.length)),c=requestAnimationFrame(E)};c=requestAnimationFrame(E)}}catch{}let l="",u,d=(S=globalThis.SpeechRecognition)!=null?S:globalThis.webkitSpeechRecognition,p;if(typeof d=="function")try{let v=new d;v.continuous=!0,v.interimResults=!0,v.onresult=y=>{let b=y.results,E="";for(let w=0;w<b.length;w++)E+=b[w][0].transcript;l=E,u==null||u(l)};try{let y=d.available;if(typeof y=="function"){let b=typeof navigator!="undefined"&&navigator.language||"en-US";await y({langs:[b],processLocally:!0})==="available"&&(v.processLocally=!0)}}catch{}v.start(),p=v}catch{}let f=()=>{try{p==null||p.stop()}catch{}c!=null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(c);try{a==null||a.close()}catch{}for(let v of n.getTracks())v.stop()},m=setTimeout(()=>{t.state!=="inactive"&&t.stop()},3e4);return{onInterim(v){u=v},onLevel(v){o=v},cancel(){clearTimeout(m);try{t.state!=="inactive"&&t.stop()}catch{}f()},stop(){return clearTimeout(m),new Promise(v=>{var y;t.onstop=()=>{f();let b=Math.min(29999,Date.now()-i);if(!s.length){v(null);return}let E=r||s[0].type||"audio/webm";v({kind:"voice",blob:new Blob(s,{type:E}),contentType:E,durationMs:b,transcript:l||void 0,transcriptApproved:!1})},t.state!=="inactive"?t.stop():(y=t.onstop)==null||y.call(t,new Event("stop"))})}}}var ku,Iv,Yi=k(()=>{"use strict";mu();ku="application/scalebun-snapshot+json";Iv=["audio/mp4;codecs=mp4a.40.2","audio/mp4","audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus",""]});function Tv(n){var e,t;if(n.questions&&n.questions.length)return n.questions;switch(n.type){case"NPS":return[{key:"score",kind:"scale",scaleMax:(e=n.scale)!=null?e:10,label:n.question}];case"CSAT":case"RATINGS_PROMPT":return[{key:"score",kind:"scale",scaleMax:(t=n.scale)!=null?t:5,label:n.question}];case"FEEDBACK":return[{key:"text",kind:"text",label:n.question}];default:return[{key:"text",kind:"text",label:n.question}]}}function Mv(n){let e=[];for(let t of n)(!e.length||t.pageBreakBefore&&e[e.length-1].length)&&e.push([]),e[e.length-1].push(t);return e.length?e:[[]]}function Eu(n,e){var Se,le;let t=document.createElement("div");t.setAttribute("data-scalebun-engage","");let r=t.attachShadow({mode:"open"}),s=((Se=n.style)==null?void 0:Se.dark)===!0,i=((le=n.style)==null?void 0:le.rtl)===!0,o=fu(n.style,{dark:s});t.setAttribute("dir",i?"rtl":"ltr");for(let[q,V]of Object.entries(o.appearance))t.setAttribute(`data-${q}`,V);document.body.appendChild(t);let a=Tv(n),c=new Map,l=!1,u=()=>{var q;l||(l=!0,(q=e.onStarted)==null||q.call(e))};Ne(r,`:host{${o.vars}}
11
+ ${Pv}`);let d=document.createElement("div");d.className="ov";let p=document.createElement("div");p.className="card",p.setAttribute("role","dialog"),p.setAttribute("aria-modal","true"),p.setAttribute("aria-label",n.name||"Survey"),d.appendChild(p),r.appendChild(d);let f=document.createElement("div");p.appendChild(f);let m=["text","screenshot","voice"],h=new Map,g=Mv(a),S=0,v=g.length-1,y=q=>c.has(q.key)||m.includes(q.kind),b=q=>{var V;return((V=g[q])!=null?V:[]).every(K=>K.required===!1?!0:y(K))},E=()=>{A.disabled=!b(S),A.textContent=S===v?"Submit":"Next",T.style.display=S>0?"":"none",I.textContent=g.length>1?`Page ${S+1} of ${g.length}`:""},w=()=>{var q,V;x.replaceChildren();for(let K of(q=g[S])!=null?q:[]){let de=document.createElement("div");de.className="qb";let me=document.createElement("div");me.className="q",me.textContent=K.label||n.question,de.appendChild(me),Lv(de,K,se=>{c.set(K.key,se),u(),E()},se=>{se?h.set(K.key,se):h.delete(K.key),u(),E()},c.get(K.key)),x.appendChild(de)}E(),(V=x.querySelector("textarea, .opt, .emoji"))==null||V.focus()},I=document.createElement("div");I.className="pg",f.appendChild(I);let x=document.createElement("div");f.appendChild(x);let C=document.createElement("div");C.className="foot";let M=document.createElement("button");M.className="x",M.textContent="Dismiss";let T=document.createElement("button");T.className="back",T.type="button",T.textContent="Back",T.style.display="none";let A=document.createElement("button");A.className="go",A.textContent="Submit",C.append(M,T,A),f.appendChild(C),w();let O=()=>{t.remove(),document.removeEventListener("keydown",fe)},z=()=>{e.onDismiss(),O()},D=typeof n.thankYouScreen=="string"?n.thankYouScreen.trim():"",te=()=>{if(e.onSubmit(_v(a,c,[...h.values()])),!D){O();return}f.remove();let q=document.createElement("div");q.className="thanks";let V=document.createElement("div");V.className="q",V.textContent=D,q.appendChild(V),p.appendChild(q),setTimeout(()=>d.addEventListener("click",O),0),setTimeout(O,2200)},J=()=>{if(S<v){S+=1,u(),w();return}te()},Q=()=>{S!==0&&(S-=1,w())},fe=q=>{q.key==="Escape"&&z()};M.addEventListener("click",z),A.addEventListener("click",J),T.addEventListener("click",Q),d.addEventListener("click",q=>{q.target===d&&z()}),document.addEventListener("keydown",fe);let ce=typeof n.startScreen=="string"?n.startScreen.trim():"",xe=()=>{var q;(q=x.querySelector("textarea, .opt, .emoji"))==null||q.focus()};if(ce){f.style.display="none";let q=document.createElement("div"),V=document.createElement("div");V.className="q",V.textContent=ce;let K=document.createElement("div");K.className="lede",K.textContent=`${a.length} quick question${a.length===1?"":"s"}`;let de=document.createElement("div");de.className="foot";let me=document.createElement("button");me.className="x",me.textContent="Dismiss";let se=document.createElement("button");se.className="go",se.textContent="Start",de.append(me,se),q.append(V,K,de),p.insertBefore(q,f),me.addEventListener("click",z),se.addEventListener("click",()=>{q.remove(),f.style.display="",u(),xe()}),se.focus()}else xe();return{close:O}}function Lv(n,e,t,r,s){var i,o;if(e.kind==="screenshot"){let a=document.createElement("div");a.className="att";let c=document.createElement("button");c.className="attbtn",c.type="button",c.textContent="\u{1F4F7} Attach screenshot",c.addEventListener("click",async()=>{c.disabled=!0;try{let{captureScreenshot:l}=await Promise.resolve().then(()=>(Yi(),Xi)),u=await l(!0);u?(r(u),c.textContent="\u2713 Screenshot attached",c.setAttribute("data-done","true")):c.textContent="Screenshot unavailable"}finally{c.disabled=!1}}),a.appendChild(c),n.appendChild(a);return}if(e.kind==="voice"){let a=document.createElement("div");a.className="att";let c=document.createElement("button");c.className="attbtn",c.type="button",c.textContent="\u{1F399} Record voice";let l=document.createElement("textarea");l.placeholder="Transcript (editable)\u2026",l.style.display="none";let u=null;c.addEventListener("click",async()=>{if(u){let d=u;u=null,c.disabled=!0;let p=await d.stop();c.disabled=!1,p?(p.transcript=l.value||p.transcript,p.transcriptApproved=!0,r(p),c.textContent="\u2713 Voice attached",c.setAttribute("data-done","true")):c.textContent="\u{1F399} Record voice"}else{c.disabled=!0;let{startVoiceRecording:d}=await Promise.resolve().then(()=>(Yi(),Xi));if(u=await d(),c.disabled=!1,!u){c.textContent="Mic unavailable";return}l.style.display="block",u.onInterim(p=>{l.value=p}),c.textContent="\u23F9 Stop"}}),a.appendChild(c),n.appendChild(a),n.appendChild(l);return}if(e.kind==="text"){let a=document.createElement("textarea");typeof s=="string"&&(a.value=s),a.addEventListener("input",()=>t(a.value)),n.appendChild(a);return}if(e.kind==="scale"){let a=(i=e.scaleMax)!=null?i:5,c=a>=10?0:1,l=document.createElement("div");l.className="row";let u=[];for(let d=c;d<=a;d++){let p=document.createElement("button");p.className="opt",p.type="button",p.textContent=String(d),p.setAttribute("aria-pressed",s===d?"true":"false"),p.addEventListener("click",()=>{u.forEach(f=>f.setAttribute("aria-pressed","false")),p.setAttribute("aria-pressed","true"),t(d)}),u.push(p),l.appendChild(p)}n.appendChild(l);return}if(e.kind==="emoji"){let a=document.createElement("div");a.className="row";let c=[];Rv.forEach((l,u)=>{let d=document.createElement("button");d.className="emoji",d.type="button",d.textContent=l,d.setAttribute("aria-pressed",s===u+1?"true":"false"),d.setAttribute("aria-label",`${u+1}`),d.addEventListener("click",()=>{c.forEach(p=>p.setAttribute("aria-pressed","false")),d.setAttribute("aria-pressed","true"),t(u+1)}),c.push(d),a.appendChild(d)}),n.appendChild(a);return}if(e.kind==="boolean"||e.kind==="single"||e.kind==="multi"){let a=e.kind==="boolean"?["Yes","No"]:(o=e.choices)!=null?o:[],c=e.kind==="multi",l=new Set(c&&Array.isArray(s)?s:[]),u=document.createElement("div");u.className="row";for(let d of a){let p=document.createElement("button");p.className="opt",p.type="button",p.textContent=d,p.setAttribute("aria-pressed",(c?l.has(d):s===d)?"true":"false"),p.addEventListener("click",()=>{c?(l.has(d)?l.delete(d):l.add(d),p.setAttribute("aria-pressed",l.has(d)?"true":"false"),t([...l])):(u.querySelectorAll(".opt").forEach(f=>f.setAttribute("aria-pressed","false")),p.setAttribute("aria-pressed","true"),t(d))}),u.appendChild(p)}n.appendChild(u)}}function _v(n,e,t){let r=[],s,i;for(let o of n){let a=e.get(o.key);if(a==null)continue;let c=Array.isArray(a)?a.join(", "):a;r.push({key:o.key,value:c}),s===void 0&&typeof a=="number"&&(s=a),i===void 0&&typeof a=="string"&&(i=a)}return{score:s,text:i,answers:r,...t.length?{attachments:t}:{}}}var Rv,Pv,Iu=k(()=>{"use strict";$();Vi();Rv=["\u{1F621}","\u{1F641}","\u{1F610}","\u{1F642}","\u{1F60D}"];Pv=`
12
12
  :host{all:initial}
13
13
  .ov{position:fixed;inset:0;display:flex;align-items:flex-end;justify-content:center;
14
14
  background:var(--sb-backdrop);font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif;pointer-events:auto}
@@ -70,7 +70,7 @@ textarea{width:100%;min-height:72px;border:1px solid var(--sb-border);border-rad
70
70
  .lede{font-size:13px;color:var(--sb-muted);margin:-8px 0 16px}
71
71
  .thanks{text-align:center;padding:6px 0 2px}
72
72
  .thanks .q{margin-bottom:0}
73
- `});function Nv(n){switch(n){case"modal":return".ov{align-items:center;justify-content:center}.card{max-width:380px;border-radius:16px;margin:16px}";case"fullscreen":return".ov{align-items:stretch;justify-content:stretch}.card{border-radius:0;width:100%}";case"bottom_sheet":return".ov{align-items:flex-end;justify-content:center}.card{width:100%;max-width:480px;border-radius:16px 16px 0 0}";case"top_banner":return".ov{align-items:flex-start;justify-content:stretch}.card{width:100%;border-radius:0}";case"bottom_banner":return".ov{align-items:flex-end;justify-content:stretch}.card{width:100%;border-radius:0}";case"toast":return".ov{align-items:flex-end;justify-content:flex-end}.card{max-width:320px;border-radius:12px;margin:16px}";case"tooltip":return".ov{align-items:flex-start;justify-content:center}.card{max-width:280px;border-radius:12px;margin:12px}"}}function Yi(n,e,t){var y,b,w,x,I,k;let r=document.createElement("div");r.setAttribute("data-scalebun-engage","");let s=r.attachShadow({mode:"open"});document.body.appendChild(r);let i=e.dark===!0,o=(b=(y=e.style)==null?void 0:y.cardBg)!=null?b:i?"#1f2937":"#ffffff",a=(x=(w=e.style)==null?void 0:w.text)!=null?x:i?"#f9fafb":"#111827",c=(k=(I=e.style)==null?void 0:I.accent)!=null?k:"#111827",l=Ov.includes(n),u=vt(document.createElement("style"));u.textContent=`
73
+ `});function Nv(n){switch(n){case"modal":return".ov{align-items:center;justify-content:center}.card{max-width:380px;border-radius:16px;margin:16px}";case"fullscreen":return".ov{align-items:stretch;justify-content:stretch}.card{border-radius:0;width:100%}";case"bottom_sheet":return".ov{align-items:flex-end;justify-content:center}.card{width:100%;max-width:480px;border-radius:16px 16px 0 0}";case"top_banner":return".ov{align-items:flex-start;justify-content:stretch}.card{width:100%;border-radius:0}";case"bottom_banner":return".ov{align-items:flex-end;justify-content:stretch}.card{width:100%;border-radius:0}";case"toast":return".ov{align-items:flex-end;justify-content:flex-end}.card{max-width:320px;border-radius:12px;margin:16px}";case"tooltip":return".ov{align-items:flex-start;justify-content:center}.card{max-width:280px;border-radius:12px;margin:12px}"}}function Ji(n,e,t){var y,b,E,w,I,x;let r=document.createElement("div");r.setAttribute("data-scalebun-engage","");let s=r.attachShadow({mode:"open"});document.body.appendChild(r);let i=e.dark===!0,o=(b=(y=e.style)==null?void 0:y.cardBg)!=null?b:i?"#1f2937":"#ffffff",a=(w=(E=e.style)==null?void 0:E.text)!=null?w:i?"#f9fafb":"#111827",c=(x=(I=e.style)==null?void 0:I.accent)!=null?x:"#111827",l=Ov.includes(n),u=vt(document.createElement("style"));u.textContent=`
74
74
  :host{all:initial}
75
75
  .ov{position:fixed;inset:0;display:flex;z-index:2147483600;
76
76
  background:${l?"rgba(0,0,0,.28)":"transparent"};
@@ -87,7 +87,7 @@ img{width:100%;border-radius:8px;margin-bottom:10px;display:block}
87
87
  .x{position:absolute;top:8px;right:10px;background:none;border:none;color:${a};opacity:.5;font-size:18px;cursor:pointer;line-height:1}
88
88
  .sec{background:none;border:none;color:${a};opacity:.7;font-size:13px;cursor:pointer}
89
89
  .cta{background:${c};color:#fff;border:none;border-radius:9px;padding:9px 16px;font-size:14px;font-weight:600;cursor:pointer}
90
- ${Nv(n)}`,s.appendChild(u);let d=document.createElement("div");d.className="ov";let p=document.createElement("div");p.className="card",p.setAttribute("role","dialog"),p.setAttribute("aria-label",e.title||"Message"),e.rtl&&p.setAttribute("dir","rtl"),d.appendChild(p),s.appendChild(d);let f=()=>{r.remove(),document.removeEventListener("keydown",h)},m=()=>{t.onDismiss(),f()},h=C=>{C.key==="Escape"&&m()},g=document.createElement("button");if(g.className="x",g.textContent="\xD7",g.setAttribute("aria-label","Close"),g.addEventListener("click",m),p.appendChild(g),e.imageUrl){let C=document.createElement("img");C.src=e.imageUrl,C.alt="",p.appendChild(C)}if(e.title){let C=document.createElement("div");C.className="t",C.textContent=e.title,p.appendChild(C)}let S=document.createElement("div");if(S.className="b",S.textContent=e.body,p.appendChild(S),e.coupon){let C=document.createElement("div");C.className="coupon",C.textContent=e.coupon,p.appendChild(C)}let v=document.createElement("div");if(v.className="acts",e.secondaryCta){let C=document.createElement("button");C.className="sec",C.textContent=e.secondaryCta.label,C.addEventListener("click",m),v.appendChild(C)}if(e.cta){let C=document.createElement("button");C.className="cta",C.textContent=e.cta.label,C.addEventListener("click",()=>{t.onClick(e.cta),f()}),v.appendChild(C)}return v.childNodes.length&&p.appendChild(v),l&&d.addEventListener("click",C=>{C.target===d&&m()}),document.addEventListener("keydown",h),{close:f}}var Ov,Au=E(()=>{"use strict";$();Ov=["modal","fullscreen","bottom_sheet"]});function Ji(n){return typeof n=="string"&&Object.prototype.hasOwnProperty.call(Ru,n)}function Tu(n){return Ji(n)?Ru[n]:null}function Mu(n){let e=ut(n),r=[e.outcomes,e.rewards,e.segments].flatMap(s=>(Array.isArray(s)?s:[]).map(i=>{var a,c;let o=ut(i);return be((c=(a=o.id)!=null?a:o.value)!=null?c:o.code)}));return[...new Set(r.filter(Boolean))]}function Pu(n){var t;let e={campaignId:n.campaignId,gameKey:n.gameKey,attemptId:n.attemptId,attempt:Math.max(1,Math.floor(n.attempt)),...n.payload?{input:n.payload}:{},...(t=n.allowedOutcomeIds)!=null&&t.length?{allowedOutcomeIds:n.allowedOutcomeIds}:{}};switch(n.variantKey){case"spin_wheel":case"scratch_card":case"slot_reward":case"mystery_box":return{...e,variantKey:n.variantKey,action:"play"};case"progress_unlock":case"streak_reward":return{...e,variantKey:n.variantKey,action:"load"};case"daily_check_in":return{...e,variantKey:n.variantKey,action:"check_in"};case"quiz_card":return{...e,variantKey:n.variantKey,action:"submit_quiz"}}}function Qi(n,e){var f;let t=ut(e);if(be(t.attemptId)!==n.attemptId)throw new Error("Game result attemptId does not match the request");if(t.status==="unavailable")return{attemptId:n.attemptId,status:"unavailable",...typeof t.retryable=="boolean"?{retryable:t.retryable}:{},...be(t.message)?{message:be(t.message)}:{}};if(t.status!=="resolved")throw new Error("Game result status is invalid");let r=ut(t.outcome),s=be(r.id);if(!s)throw new Error("Game result outcome.id is required");let i=be(r.segmentId),o=r.segmentIndex;if(o!==void 0&&(typeof o!="number"||!Number.isInteger(o)||o<0))throw new Error("Game result segmentIndex is invalid");let a=(f=n.allowedOutcomeIds)!=null?f:[],c=typeof o=="number"?a[o]:void 0;if(a.length>0&&!a.includes(i||c||s))throw new Error("Game result is not one of the authored outcomes");let l=Array.isArray(r.symbols)?r.symbols.map(be).filter(Boolean):void 0;if(r.symbols!==void 0&&(!l||l.length===0||l.length>3))throw new Error("Game result symbols are invalid");let u=r.state;if(u!==void 0&&(u===null||typeof u!="object"||Array.isArray(u)))throw new Error("Game result state is invalid");let d=r.value,p=typeof d=="string"||typeof d=="number"||typeof d=="boolean";return{attemptId:n.attemptId,status:"resolved",outcome:{id:s,...be(r.label)?{label:be(r.label)}:{},...i?{segmentId:i}:{},...typeof o=="number"?{segmentIndex:o}:{},...l?{symbols:l}:{},...u?{state:u}:{},...p?{value:d}:{},...be(r.receiptId)?{receiptId:be(r.receiptId)}:{}}}}function Lu(n,e){var a,c,l,u,d,p,f,m,h,g,S,v,y,b,w,x,I,k,C,M,R;let t=ut(e),r=ut((c=(a=t.resultState)!=null?a:t.result)!=null?c:t.reward),s=be((g=(h=(m=(f=(p=(d=(u=(l=t.rewardValue)!=null?l:t.prize)!=null?u:t.rewardResult)!=null?d:t.resultReward)!=null?p:t.reward)!=null?f:r.label)!=null?m:r.title)!=null?h:r.name)!=null?g:t.resultState),i=be((w=(b=(y=(v=(S=t.outcomeId)!=null?S:t.resultId)!=null?v:t.winningId)!=null?y:t.segmentId)!=null?b:r.id)!=null?w:r.value),o=null;switch(n.variantKey){case"spin_wheel":{let A=[t.winningIndex,t.resultIndex,t.selectedIndex,r.index].find(D=>typeof D=="number"&&Number.isInteger(D)&&D>=0),O=typeof A=="number"&&Array.isArray(t.segments)?ut(t.segments[A]):{},z=be((R=(M=(C=(k=(I=(x=t.winningId)!=null?x:t.segmentId)!=null?I:r.segmentId)!=null?k:r.id)!=null?C:O.id)!=null?M:O.value)!=null?R:O.code);if(!z&&A===void 0&&!s)return null;o={id:i||z||`preview_segment_${A}`,...s?{label:s}:{},...z?{segmentId:z}:{},...typeof A=="number"?{segmentIndex:A}:{}};break}case"slot_reward":{let A=Array.isArray(t.resultSymbols)?t.resultSymbols.map(be).filter(Boolean):[];if(A.length===0)return null;o={id:i||`preview_${A.join("_")}`,symbols:A,...s?{label:s}:{}};break}case"scratch_card":case"mystery_box":if(!s&&!i)return null;o={id:i||"preview_reward",...s?{label:s}:{}};break;case"progress_unlock":case"streak_reward":case"daily_check_in":o={id:i||"preview_state",...s?{label:s}:{},state:{...t}};break;case"quiz_card":if(!i&&!s)return null;o={id:i||"preview_quiz",...s?{label:s}:{}};break}return Qi(n,{attemptId:n.attemptId,status:"resolved",outcome:o})}function _u(n,e,t,r){let s=`${e}:${Math.max(1,Math.floor(t))}`,i=n.get(s);if(i)return i;let o=`scalebun_game_${Date.now().toString(36)}_${r().toString(36)}`;return n.set(s,o),o}var Ru,ut,be,Zi=E(()=>{"use strict";Ru={spin_wheel:"play",scratch_card:"play",slot_reward:"play",mystery_box:"play",progress_unlock:"load",streak_reward:"load",daily_check_in:"check_in",quiz_card:"submit_quiz"},ut=n=>n!==null&&typeof n=="object"&&!Array.isArray(n)?n:{},be=n=>typeof n=="string"?n.trim():""});function Nu(n){if(!Ji(n.variantKey))return null;let e=n.variantKey,t=new Map;return async(r,s)=>{try{let i=Bv(n.ext.gameKey);if(!n.preview&&!i)return{ok:!1,message:"This game is not configured.",retryable:!1};let o=Pu({campaignId:n.campaignId,gameKey:i||`preview:${e}`,variantKey:e,attemptId:_u(t,e,r,()=>Fv+=1),attempt:r,...s?{payload:s}:{},allowedOutcomeIds:Mu(n.ext)});if(n.preview){let a=Lu(o,n.ext);return a?Ou(a):{ok:!1,message:"No preview outcome is configured for this campaign.",retryable:!1}}return n.handler?Ou(Qi(o,await n.handler(o))):{ok:!1,message:"Rewards are unavailable right now.",retryable:!1}}catch{return{ok:!1,message:"Rewards are unavailable right now.",retryable:!0}}}}function Ou(n){var t;if(n.status==="unavailable")return{ok:!1,...n.message?{message:n.message}:{message:"Rewards are unavailable right now."},retryable:n.retryable!==!1};let e=n.outcome;return{ok:!0,...e.label?{label:e.label}:{},...typeof e.segmentIndex=="number"?{index:e.segmentIndex}:{},...(t=e.symbols)!=null&&t.length?{symbols:e.symbols}:{},...e.state?{state:e.state}:{}}}var Bv,Fv,Bu=E(()=>{"use strict";Zi();Bv=n=>typeof n=="string"?n.trim():"",Fv=0});var Mt,eo=E(()=>{"use strict";Mt=class{constructor(){this.slots=new Map;this.waiters=new Map}register(e,t){this.slots.set(e,t);let r=this.waiters.get(e);if(r){this.waiters.delete(e);for(let s of r)try{s(t)}catch{}}}unregister(e){this.slots.delete(e)}get(e){return this.slots.get(e)}whenAvailable(e,t){let r=this.slots.get(e);if(r)return t(r),()=>{};let s=this.waiters.get(e);return s||this.waiters.set(e,s=new Set),s.add(t),()=>{var i;return(i=this.waiters.get(e))==null?void 0:i.delete(t)}}clear(){this.slots.clear(),this.waiters.clear()}}});var Fu={};L(Fu,{engageSlots:()=>Pt,hasInAppSlot:()=>to,registerInAppSlot:()=>Dv,slotNameFor:()=>Dr});function Dv(n,e){return!n||!e?()=>{}:(Pt.register(n,e),()=>Pt.unregister(n))}function Dr(n){var t;let e=(t=n.placementKey)!=null?t:n.slot;return typeof e=="string"&&e?e:void 0}function to(n){let e=Dr(n);return!!e&&!!Pt.get(e)}var Pt,no=E(()=>{"use strict";eo();Pt=new Mt});function Lt(n){var e,t,r,s,i;return n.surface==="banner"?((e=n.surfaceOptions)==null?void 0:e.placement)==="bottom"?"bottom-banner":"top-banner":n.surface==="panel"?((t=n.surfaceOptions)==null?void 0:t.placement)==="left"?"side-left":"side-right":n.surface==="slideover"?((r=n.surfaceOptions)==null?void 0:r.placement)==="left"?"side-left":"side-right":n.surface==="inline"?`inline:${(i=(s=n.surfaceOptions)==null?void 0:s.slot)!=null?i:"default"}`:Vv[n.surface]}function jv(n){var o,a,c,l,u;let e=[],t=(d,p)=>e.push({path:d,message:p});if(!n||typeof n!="object")return[{path:"",message:"variant is not an object"}];if((!n.id||!Wv.test(n.id))&&t("id","missing or malformed id"),n.key||t("key","missing key"),Hv.includes(n.surface)||t("surface",`unknown surface "${n.surface}"`),$v.includes(n.priority)||t("priority",`unknown priority "${n.priority}"`),!Array.isArray(n.platforms)||n.platforms.length===0)t("platforms","at least one platform required");else for(let d of n.platforms)qv.includes(d)||t("platforms",`unknown platform "${d}"`);!Array.isArray(n.blocks)||n.blocks.length===0?t("blocks","at least one block required"):n.blocks.forEach((d,p)=>{(!d||!Uv.includes(d.kind))&&t(`blocks[${p}].kind`,`unknown block kind "${d==null?void 0:d.kind}"`)}),!Array.isArray(n.triggers)||n.triggers.length===0?t("triggers","at least one trigger required"):n.triggers.forEach((d,p)=>{(!d||!zv.includes(d.type))&&t(`triggers[${p}].type`,`unknown trigger "${d==null?void 0:d.type}"`),((d==null?void 0:d.type)==="element"||(d==null?void 0:d.type)==="hover")&&!d.match&&t(`triggers[${p}].match`,`${d.type} trigger requires a selector`),(d==null?void 0:d.type)==="idle"&&(typeof d.arg!="number"||d.arg<=0)&&t(`triggers[${p}].arg`,"idle trigger requires a positive ms arg")}),["popover","coachmark","hotspot","toolbar"].includes(n.surface)&&((o=n.targeting)!=null&&o.element||((a=n.triggers)!=null?a:[]).some(p=>p.match&&(p.type==="element"||p.type==="hover"))||t("targeting.element",`${n.surface} requires an anchor selector`));let s=(l=(c=n.contract)==null?void 0:c.requiredBlocks)!=null?l:[],i=new Set(((u=n.blocks)!=null?u:[]).map(d=>d==null?void 0:d.kind));for(let d of s)i.has(d)||t("contract.requiredBlocks",`missing required block "${d}"`);return e}function Du(n){return jv(n).length===0}var qv,Hv,$v,zv,Uv,Vv,ro,so,Wv,qr=E(()=>{"use strict";qv=["web","ios","android"],Hv=["modal","slideover","panel","popover","coachmark","tour","hotspot","inline","banner","toast","center","launcher","palette","checklist","takeover","toolbar"],$v=["critical","high","normal","low","passive"],zv=["manual","route","event","idle","element","hover","selection","keyboard","right-click","schedule","no-data","exit-intent"],Uv=["heading","text","richtext","markdown","image","illustration","video","lottie","code","playground","embed","chart","sparkline","stat","table","form","nps","rating","poll","quiz","emoji","steps","checklist","progress","timeline","list","feature-grid","plan-cards","cta","shortcut","avatar","testimonial","social-proof","callout","badge","divider","spacer","countdown","carousel","qr","confetti","product-grid","spinwheel","scratch","slot"],Vv={takeover:"takeover",modal:"modal",banner:"top-banner",toast:"toast",slideover:"side-right",panel:"side-left",popover:"anchored",coachmark:"anchored",tour:"anchored",hotspot:"anchored",toolbar:"anchored",launcher:"launcher",palette:"palette",center:"center",inline:"inline:default",checklist:"launcher"},ro={takeover:"focus-stealing",modal:"focus-stealing",banner:"ambient",toast:"ambient",slideover:"ambient",panel:"ambient",popover:"ambient",coachmark:"ambient",tour:"ambient",hotspot:"ambient",toolbar:"ambient",launcher:"always-available",palette:"on-demand",center:"none",inline:"in-flow",checklist:"ambient"},so={takeover:5,modal:3,tour:2,banner:1,toast:.5,slideover:0,panel:0,popover:0,coachmark:0,hotspot:0,toolbar:0,inline:0,center:0,launcher:0,palette:0,checklist:0};Wv=/^[a-z0-9][a-z0-9_-]*$/i});var Hr,io=E(()=>{"use strict";Hr=`
90
+ ${Nv(n)}`,s.appendChild(u);let d=document.createElement("div");d.className="ov";let p=document.createElement("div");p.className="card",p.setAttribute("role","dialog"),p.setAttribute("aria-label",e.title||"Message"),e.rtl&&p.setAttribute("dir","rtl"),d.appendChild(p),s.appendChild(d);let f=()=>{r.remove(),document.removeEventListener("keydown",h)},m=()=>{t.onDismiss(),f()},h=C=>{C.key==="Escape"&&m()},g=document.createElement("button");if(g.className="x",g.textContent="\xD7",g.setAttribute("aria-label","Close"),g.addEventListener("click",m),p.appendChild(g),e.imageUrl){let C=document.createElement("img");C.src=e.imageUrl,C.alt="",p.appendChild(C)}if(e.title){let C=document.createElement("div");C.className="t",C.textContent=e.title,p.appendChild(C)}let S=document.createElement("div");if(S.className="b",S.textContent=e.body,p.appendChild(S),e.coupon){let C=document.createElement("div");C.className="coupon",C.textContent=e.coupon,p.appendChild(C)}let v=document.createElement("div");if(v.className="acts",e.secondaryCta){let C=document.createElement("button");C.className="sec",C.textContent=e.secondaryCta.label,C.addEventListener("click",m),v.appendChild(C)}if(e.cta){let C=document.createElement("button");C.className="cta",C.textContent=e.cta.label,C.addEventListener("click",()=>{t.onClick(e.cta),f()}),v.appendChild(C)}return v.childNodes.length&&p.appendChild(v),l&&d.addEventListener("click",C=>{C.target===d&&m()}),document.addEventListener("keydown",h),{close:f}}var Ov,Cu=k(()=>{"use strict";$();Ov=["modal","fullscreen","bottom_sheet"]});function Qi(n){return typeof n=="string"&&Object.prototype.hasOwnProperty.call(Au,n)}function Tu(n){return Qi(n)?Au[n]:null}function Ru(n){let e=ut(n),r=[e.outcomes,e.rewards,e.segments].flatMap(s=>(Array.isArray(s)?s:[]).map(i=>{var a,c;let o=ut(i);return be((c=(a=o.id)!=null?a:o.value)!=null?c:o.code)}));return[...new Set(r.filter(Boolean))]}function Mu(n){var t;let e={campaignId:n.campaignId,gameKey:n.gameKey,attemptId:n.attemptId,attempt:Math.max(1,Math.floor(n.attempt)),...n.payload?{input:n.payload}:{},...(t=n.allowedOutcomeIds)!=null&&t.length?{allowedOutcomeIds:n.allowedOutcomeIds}:{}};switch(n.variantKey){case"spin_wheel":case"scratch_card":case"slot_reward":case"mystery_box":return{...e,variantKey:n.variantKey,action:"play"};case"progress_unlock":case"streak_reward":return{...e,variantKey:n.variantKey,action:"load"};case"daily_check_in":return{...e,variantKey:n.variantKey,action:"check_in"};case"quiz_card":return{...e,variantKey:n.variantKey,action:"submit_quiz"}}}function Zi(n,e){var f;let t=ut(e);if(be(t.attemptId)!==n.attemptId)throw new Error("Game result attemptId does not match the request");if(t.status==="unavailable")return{attemptId:n.attemptId,status:"unavailable",...typeof t.retryable=="boolean"?{retryable:t.retryable}:{},...be(t.message)?{message:be(t.message)}:{}};if(t.status!=="resolved")throw new Error("Game result status is invalid");let r=ut(t.outcome),s=be(r.id);if(!s)throw new Error("Game result outcome.id is required");let i=be(r.segmentId),o=r.segmentIndex;if(o!==void 0&&(typeof o!="number"||!Number.isInteger(o)||o<0))throw new Error("Game result segmentIndex is invalid");let a=(f=n.allowedOutcomeIds)!=null?f:[],c=typeof o=="number"?a[o]:void 0;if(a.length>0&&!a.includes(i||c||s))throw new Error("Game result is not one of the authored outcomes");let l=Array.isArray(r.symbols)?r.symbols.map(be).filter(Boolean):void 0;if(r.symbols!==void 0&&(!l||l.length===0||l.length>3))throw new Error("Game result symbols are invalid");let u=r.state;if(u!==void 0&&(u===null||typeof u!="object"||Array.isArray(u)))throw new Error("Game result state is invalid");let d=r.value,p=typeof d=="string"||typeof d=="number"||typeof d=="boolean";return{attemptId:n.attemptId,status:"resolved",outcome:{id:s,...be(r.label)?{label:be(r.label)}:{},...i?{segmentId:i}:{},...typeof o=="number"?{segmentIndex:o}:{},...l?{symbols:l}:{},...u?{state:u}:{},...p?{value:d}:{},...be(r.receiptId)?{receiptId:be(r.receiptId)}:{}}}}function Pu(n,e){var a,c,l,u,d,p,f,m,h,g,S,v,y,b,E,w,I,x,C,M,T;let t=ut(e),r=ut((c=(a=t.resultState)!=null?a:t.result)!=null?c:t.reward),s=be((g=(h=(m=(f=(p=(d=(u=(l=t.rewardValue)!=null?l:t.prize)!=null?u:t.rewardResult)!=null?d:t.resultReward)!=null?p:t.reward)!=null?f:r.label)!=null?m:r.title)!=null?h:r.name)!=null?g:t.resultState),i=be((E=(b=(y=(v=(S=t.outcomeId)!=null?S:t.resultId)!=null?v:t.winningId)!=null?y:t.segmentId)!=null?b:r.id)!=null?E:r.value),o=null;switch(n.variantKey){case"spin_wheel":{let A=[t.winningIndex,t.resultIndex,t.selectedIndex,r.index].find(D=>typeof D=="number"&&Number.isInteger(D)&&D>=0),O=typeof A=="number"&&Array.isArray(t.segments)?ut(t.segments[A]):{},z=be((T=(M=(C=(x=(I=(w=t.winningId)!=null?w:t.segmentId)!=null?I:r.segmentId)!=null?x:r.id)!=null?C:O.id)!=null?M:O.value)!=null?T:O.code);if(!z&&A===void 0&&!s)return null;o={id:i||z||`preview_segment_${A}`,...s?{label:s}:{},...z?{segmentId:z}:{},...typeof A=="number"?{segmentIndex:A}:{}};break}case"slot_reward":{let A=Array.isArray(t.resultSymbols)?t.resultSymbols.map(be).filter(Boolean):[];if(A.length===0)return null;o={id:i||`preview_${A.join("_")}`,symbols:A,...s?{label:s}:{}};break}case"scratch_card":case"mystery_box":if(!s&&!i)return null;o={id:i||"preview_reward",...s?{label:s}:{}};break;case"progress_unlock":case"streak_reward":case"daily_check_in":o={id:i||"preview_state",...s?{label:s}:{},state:{...t}};break;case"quiz_card":if(!i&&!s)return null;o={id:i||"preview_quiz",...s?{label:s}:{}};break}return Zi(n,{attemptId:n.attemptId,status:"resolved",outcome:o})}function Lu(n,e,t,r){let s=`${e}:${Math.max(1,Math.floor(t))}`,i=n.get(s);if(i)return i;let o=`scalebun_game_${Date.now().toString(36)}_${r().toString(36)}`;return n.set(s,o),o}var Au,ut,be,eo=k(()=>{"use strict";Au={spin_wheel:"play",scratch_card:"play",slot_reward:"play",mystery_box:"play",progress_unlock:"load",streak_reward:"load",daily_check_in:"check_in",quiz_card:"submit_quiz"},ut=n=>n!==null&&typeof n=="object"&&!Array.isArray(n)?n:{},be=n=>typeof n=="string"?n.trim():""});function Ou(n){if(!Qi(n.variantKey))return null;let e=n.variantKey,t=new Map;return async(r,s)=>{try{let i=Bv(n.ext.gameKey);if(!n.preview&&!i)return{ok:!1,message:"This game is not configured.",retryable:!1};let o=Mu({campaignId:n.campaignId,gameKey:i||`preview:${e}`,variantKey:e,attemptId:Lu(t,e,r,()=>Fv+=1),attempt:r,...s?{payload:s}:{},allowedOutcomeIds:Ru(n.ext)});if(n.preview){let a=Pu(o,n.ext);return a?_u(a):{ok:!1,message:"No preview outcome is configured for this campaign.",retryable:!1}}return n.handler?_u(Zi(o,await n.handler(o))):{ok:!1,message:"Rewards are unavailable right now.",retryable:!1}}catch{return{ok:!1,message:"Rewards are unavailable right now.",retryable:!0}}}}function _u(n){var t;if(n.status==="unavailable")return{ok:!1,...n.message?{message:n.message}:{message:"Rewards are unavailable right now."},retryable:n.retryable!==!1};let e=n.outcome;return{ok:!0,...e.label?{label:e.label}:{},...typeof e.segmentIndex=="number"?{index:e.segmentIndex}:{},...(t=e.symbols)!=null&&t.length?{symbols:e.symbols}:{},...e.state?{state:e.state}:{}}}var Bv,Fv,Nu=k(()=>{"use strict";eo();Bv=n=>typeof n=="string"?n.trim():"",Fv=0});var Mt,to=k(()=>{"use strict";Mt=class{constructor(){this.slots=new Map;this.waiters=new Map}register(e,t){this.slots.set(e,t);let r=this.waiters.get(e);if(r){this.waiters.delete(e);for(let s of r)try{s(t)}catch{}}}unregister(e){this.slots.delete(e)}get(e){return this.slots.get(e)}whenAvailable(e,t){let r=this.slots.get(e);if(r)return t(r),()=>{};let s=this.waiters.get(e);return s||this.waiters.set(e,s=new Set),s.add(t),()=>{var i;return(i=this.waiters.get(e))==null?void 0:i.delete(t)}}clear(){this.slots.clear(),this.waiters.clear()}}});var Bu={};L(Bu,{engageSlots:()=>Pt,hasInAppSlot:()=>no,registerInAppSlot:()=>Dv,slotNameFor:()=>Dr});function Dv(n,e){return!n||!e?()=>{}:(Pt.register(n,e),()=>Pt.unregister(n))}function Dr(n){var t;let e=(t=n.placementKey)!=null?t:n.slot;return typeof e=="string"&&e?e:void 0}function no(n){let e=Dr(n);return!!e&&!!Pt.get(e)}var Pt,ro=k(()=>{"use strict";to();Pt=new Mt});function Lt(n){var e,t,r,s,i;return n.surface==="banner"?((e=n.surfaceOptions)==null?void 0:e.placement)==="bottom"?"bottom-banner":"top-banner":n.surface==="panel"?((t=n.surfaceOptions)==null?void 0:t.placement)==="left"?"side-left":"side-right":n.surface==="slideover"?((r=n.surfaceOptions)==null?void 0:r.placement)==="left"?"side-left":"side-right":n.surface==="inline"?`inline:${(i=(s=n.surfaceOptions)==null?void 0:s.slot)!=null?i:"default"}`:Vv[n.surface]}function jv(n){var o,a,c,l,u;let e=[],t=(d,p)=>e.push({path:d,message:p});if(!n||typeof n!="object")return[{path:"",message:"variant is not an object"}];if((!n.id||!Wv.test(n.id))&&t("id","missing or malformed id"),n.key||t("key","missing key"),Hv.includes(n.surface)||t("surface",`unknown surface "${n.surface}"`),$v.includes(n.priority)||t("priority",`unknown priority "${n.priority}"`),!Array.isArray(n.platforms)||n.platforms.length===0)t("platforms","at least one platform required");else for(let d of n.platforms)qv.includes(d)||t("platforms",`unknown platform "${d}"`);!Array.isArray(n.blocks)||n.blocks.length===0?t("blocks","at least one block required"):n.blocks.forEach((d,p)=>{(!d||!Uv.includes(d.kind))&&t(`blocks[${p}].kind`,`unknown block kind "${d==null?void 0:d.kind}"`)}),!Array.isArray(n.triggers)||n.triggers.length===0?t("triggers","at least one trigger required"):n.triggers.forEach((d,p)=>{(!d||!zv.includes(d.type))&&t(`triggers[${p}].type`,`unknown trigger "${d==null?void 0:d.type}"`),((d==null?void 0:d.type)==="element"||(d==null?void 0:d.type)==="hover")&&!d.match&&t(`triggers[${p}].match`,`${d.type} trigger requires a selector`),(d==null?void 0:d.type)==="idle"&&(typeof d.arg!="number"||d.arg<=0)&&t(`triggers[${p}].arg`,"idle trigger requires a positive ms arg")}),["popover","coachmark","hotspot","toolbar"].includes(n.surface)&&((o=n.targeting)!=null&&o.element||((a=n.triggers)!=null?a:[]).some(p=>p.match&&(p.type==="element"||p.type==="hover"))||t("targeting.element",`${n.surface} requires an anchor selector`));let s=(l=(c=n.contract)==null?void 0:c.requiredBlocks)!=null?l:[],i=new Set(((u=n.blocks)!=null?u:[]).map(d=>d==null?void 0:d.kind));for(let d of s)i.has(d)||t("contract.requiredBlocks",`missing required block "${d}"`);return e}function Fu(n){return jv(n).length===0}var qv,Hv,$v,zv,Uv,Vv,so,io,Wv,qr=k(()=>{"use strict";qv=["web","ios","android"],Hv=["modal","slideover","panel","popover","coachmark","tour","hotspot","inline","banner","toast","center","launcher","palette","checklist","takeover","toolbar"],$v=["critical","high","normal","low","passive"],zv=["manual","route","event","idle","element","hover","selection","keyboard","right-click","schedule","no-data","exit-intent"],Uv=["heading","text","richtext","markdown","image","illustration","video","lottie","code","playground","embed","chart","sparkline","stat","table","form","nps","rating","poll","quiz","emoji","steps","checklist","progress","timeline","list","feature-grid","plan-cards","cta","shortcut","avatar","testimonial","social-proof","callout","badge","divider","spacer","countdown","carousel","qr","confetti","product-grid","spinwheel","scratch","slot"],Vv={takeover:"takeover",modal:"modal",banner:"top-banner",toast:"toast",slideover:"side-right",panel:"side-left",popover:"anchored",coachmark:"anchored",tour:"anchored",hotspot:"anchored",toolbar:"anchored",launcher:"launcher",palette:"palette",center:"center",inline:"inline:default",checklist:"launcher"},so={takeover:"focus-stealing",modal:"focus-stealing",banner:"ambient",toast:"ambient",slideover:"ambient",panel:"ambient",popover:"ambient",coachmark:"ambient",tour:"ambient",hotspot:"ambient",toolbar:"ambient",launcher:"always-available",palette:"on-demand",center:"none",inline:"in-flow",checklist:"ambient"},io={takeover:5,modal:3,tour:2,banner:1,toast:.5,slideover:0,panel:0,popover:0,coachmark:0,hotspot:0,toolbar:0,inline:0,center:0,launcher:0,palette:0,checklist:0};Wv=/^[a-z0-9][a-z0-9_-]*$/i});var Hr,oo=k(()=>{"use strict";Hr=`
91
91
  /* Text must be BREAKABLE. Real in-app copy carries runs with no space in them \u2014 a support URL, a
92
92
  deploy hash, a pasted id, a German compound \u2014 and nothing here could break one, so it ran
93
93
  straight out of its container. Sweeping the catalog with a single long URL took the count from 6
@@ -305,7 +305,7 @@ ${Nv(n)}`,s.appendChild(u);let d=document.createElement("div");d.className="ov";
305
305
  .scalebun-poll-pct{ position:relative; z-index:1; font-size:12px; color:var(--scalebun-muted); }
306
306
  .scalebun-quiz-opt.correct{ border-color:#2fa96b; background:color-mix(in srgb, #2fa96b 14%, transparent); }
307
307
  .scalebun-quiz-opt.incorrect{ border-color:#e0483d; background:color-mix(in srgb, #e0483d 14%, transparent); }
308
- `});var qu,Hu=E(()=>{"use strict";qu=`
308
+ `});var Du,qu=k(()=>{"use strict";Du=`
309
309
  /* shared close button */
310
310
  .scalebun-x{ background:none; border:0; color:var(--scalebun-muted); cursor:pointer; font-size:16px; line-height:1;
311
311
  padding:4px 6px; border-radius:6px; }
@@ -533,9 +533,9 @@ ${Nv(n)}`,s.appendChild(u);let d=document.createElement("div");d.className="ov";
533
533
  .scalebun-launcher-item{ text-align:left; background:none; border:0; color:var(--scalebun-fg); cursor:pointer; font:inherit;
534
534
  font-size:13.5px; padding:9px 12px; border-radius:8px; }
535
535
  .scalebun-launcher-item:hover{ background:color-mix(in srgb, var(--scalebun-fg) 7%, transparent); }
536
- `});var $u,oo,zu,Uu,Vu,Wu,ju,Ku,Gu=E(()=>{"use strict";$u=(n,e="")=>typeof n=="string"?n:n==null?e:String(n),oo=n=>Array.isArray(n)?n:[],zu=n=>oo(n).map(e=>typeof e=="string"?{id:e,label:e}:e),Uu=(n,e)=>{let t=e.doc.createElement("div");t.className="scalebun-nps";for(let r=0;r<=10;r++){let s=e.doc.createElement("button");s.type="button",s.className="scalebun-nps-btn",s.textContent=String(r),s.addEventListener("click",()=>{var i;return(i=e.onInteraction)==null?void 0:i.call(e,`nps:${r}`)}),t.appendChild(s)}return t},Vu=(n,e)=>{var s;let t=Number((s=n.props)==null?void 0:s.max)||5,r=e.doc.createElement("div");r.className="scalebun-rating";for(let i=1;i<=t;i++){let o=e.doc.createElement("button");o.type="button",o.className="scalebun-star",o.setAttribute("aria-label",`${i} of ${t}`),o.textContent="\u2605",o.addEventListener("click",()=>{var a;Array.from(r.children).forEach((c,l)=>c.classList.toggle("on",l<i)),(a=e.onInteraction)==null||a.call(e,`rating:${i}`)}),r.appendChild(o)}return r},Wu=(n,e)=>{var s,i;let t=oo((s=n.props)==null?void 0:s.emojis).length?oo((i=n.props)==null?void 0:i.emojis):["\u{1F61E}","\u{1F610}","\u{1F642}","\u{1F604}"],r=e.doc.createElement("div");r.className="scalebun-emoji";for(let o of t){let a=e.doc.createElement("button");a.type="button",a.className="scalebun-emoji-btn",a.textContent=o,a.addEventListener("click",()=>{var c;return(c=e.onInteraction)==null?void 0:c.call(e,`emoji:${o}`)}),r.appendChild(a)}return r},ju=(n,e)=>{var o,a,c,l,u;let t=e.doc.createElement("div");t.className="scalebun-poll";let r=$u((o=n.props)==null?void 0:o.question);if(r){let d=e.doc.createElement("div");d.className="scalebun-poll-q",d.textContent=r,t.appendChild(d)}let s=(c=(a=n.props)==null?void 0:a.results)!=null?c:void 0,i=s?Object.values(s).reduce((d,p)=>d+p,0)||1:0;for(let d of zu((l=n.props)==null?void 0:l.options)){let p=e.doc.createElement("button");p.type="button",p.className="scalebun-poll-opt";let f=e.doc.createElement("span");if(f.className="scalebun-poll-label",f.textContent=d.label,p.appendChild(f),s){let m=Math.round(((u=s[d.id])!=null?u:0)/i*100),h=e.doc.createElement("span");h.className="scalebun-poll-bar",h.style.width=`${m}%`;let g=e.doc.createElement("span");g.className="scalebun-poll-pct",g.textContent=`${m}%`,p.append(h,g),p.disabled=!0}p.addEventListener("click",()=>{var m;return(m=e.onInteraction)==null?void 0:m.call(e,`poll_vote:${d.id}`)}),t.appendChild(p)}return t},Ku=(n,e)=>{var c,l,u;let t=e.doc.createElement("div");t.className="scalebun-quiz";let r=$u((c=n.props)==null?void 0:c.question);if(r){let d=e.doc.createElement("div");d.className="scalebun-poll-q",d.textContent=r,t.appendChild(d)}let s=(l=n.props)==null?void 0:l.outcome,i=new Map,o=!1,a=(d,p)=>{for(let[f,m]of i)m.disabled=!0,p&&f===p?m.classList.add("correct"):f===d&&f!==p&&m.classList.add("incorrect")};for(let d of zu((u=n.props)==null?void 0:u.options)){let p=e.doc.createElement("button");p.type="button",p.className="scalebun-quiz-opt",p.textContent=d.label,i.set(d.id,p),p.addEventListener("click",()=>{var f;if((f=e.onInteraction)==null||f.call(e,`quiz_answer:${d.id}`),!(!e.requestOutcome||o)){o=!0;for(let m of i.values())m.disabled=!0;e.requestOutcome(1,{answeredId:d.id}).then(m=>{var g,S;if(!m.ok){o=!1;for(let y of i.values())y.disabled=!1;let v=e.doc.createElement("div");v.className="scalebun-quiz-note",v.textContent=(g=m.message)!=null?g:"Could not check that answer.",t.appendChild(v);return}let h=(S=m.state)!=null?S:{};a(d.id,typeof h.correctId=="string"?h.correctId:void 0)})}}),t.appendChild(p)}return s!=null&&s.answeredId&&a(s.answeredId,s.correctId),t}});function Yu(n,e,t){e.split(`
537
- `).forEach((s,i)=>{i>0&&n.appendChild(t.createElement("br")),n.appendChild(t.createTextNode(s))})}function zr(n,e){let t=[];for(let r of n){let s=$r[r.kind];if(s)try{let i=s(r,e);i&&t.push(i)}catch{}}return t}var ye,ve,Kv,Gv,Xv,Xu,Yv,Jv,Qv,Zv,ew,tw,nw,rw,sw,$r,Ur=E(()=>{"use strict";Gu();ye=(n,e="")=>typeof n=="string"?n:n==null?e:String(n);ve=(n,e,t)=>{let r=n.createElement(e);return r.className=t,r},Kv=(n,e)=>{var r;let t=ve(e.doc,"h2","scalebun-h");return t.textContent=ye((r=n.props)==null?void 0:r.text),t},Gv=(n,e)=>{var r;let t=ve(e.doc,"p","scalebun-text");return Yu(t,ye((r=n.props)==null?void 0:r.text),e.doc),t},Xv=(n,e)=>{var r,s,i;let t=ve(e.doc,"div","scalebun-rich");return Yu(t,ye((i=(r=n.props)==null?void 0:r.text)!=null?i:(s=n.props)==null?void 0:s.markdown),e.doc),t},Xu=(n,e)=>{var s,i;let t=e.doc.createElement("img");t.className="scalebun-img";let r=ye((s=n.props)==null?void 0:s.src);return r?(t.src=r,t.alt=ye((i=n.props)==null?void 0:i.alt),t.loading="lazy",t.decoding="async",t):null},Yv=(n,e)=>{var s;let t=Array.isArray((s=n.props)==null?void 0:s.items)?n.props.items:[];if(t.length===0)return null;let r=ve(e.doc,"ul","scalebun-checklist");return r.setAttribute("role","list"),t.forEach((i,o)=>{var f,m;let a=i&&typeof i=="object"?i:{},c=typeof i=="string"?i:ye((m=(f=a.label)!=null?f:a.text)!=null?m:a.title),l=a.done===!0||a.checked===!0||a.complete===!0,u=e.doc.createElement("li");u.className="scalebun-checklist-item",u.setAttribute("data-done",l?"true":"false");let d=e.doc.createElement("span");d.className="scalebun-checklist-mark",d.setAttribute("aria-hidden","true"),d.textContent=l?"\u2713":"";let p=e.doc.createElement("span");p.className="scalebun-checklist-label",p.textContent=c,u.appendChild(d),u.appendChild(p),u.setAttribute("aria-label",`${c} \u2014 ${l?"done":"not done"}`),u.addEventListener("click",()=>{var h;return(h=e.onInteraction)==null?void 0:h.call(e,`checklist_item:${o}`)}),r.appendChild(u)}),r},Jv=(n,e)=>{var s;let t=Array.isArray((s=n.props)==null?void 0:s.items)?n.props.items:[];if(t.length===0)return null;let r=ve(e.doc,"ul","scalebun-list");return t.forEach((i,o)=>{var l;let a=e.doc.createElement("li"),c=typeof i=="string"?i:ye((l=i==null?void 0:i.text)!=null?l:i==null?void 0:i.label);a.textContent=c,a.addEventListener("click",()=>{var u;return(u=e.onInteraction)==null?void 0:u.call(e,`list_item:${o}`)}),r.appendChild(a)}),r},Qv=(n,e)=>{var s,i;let t=ve(e.doc,"div","scalebun-callout");if((s=n.props)!=null&&s.icon){let o=ve(e.doc,"span","scalebun-callout-ic");o.textContent=ye(n.props.icon),t.appendChild(o)}let r=ve(e.doc,"span","scalebun-callout-t");return r.textContent=ye((i=n.props)==null?void 0:i.text),t.appendChild(r),t},Zv=(n,e)=>{var r;let t=ve(e.doc,"span","scalebun-badge");return t.textContent=ye((r=n.props)==null?void 0:r.text),t},ew=(n,e)=>{var i;let t=Math.max(0,Math.min(100,Number((i=n.props)==null?void 0:i.value)||0)),r=ve(e.doc,"div","scalebun-progress"),s=ve(e.doc,"div","scalebun-progress-fill");return s.style.width=`${t}%`,r.appendChild(s),r},tw=(n,e)=>ve(e.doc,"hr","scalebun-divider"),nw=(n,e)=>{var s;let t=ve(e.doc,"div","scalebun-spacer"),r=Number((s=n.props)==null?void 0:s.height);return!Number.isNaN(r)&&r>0&&(t.style.height=`${r}px`),t},rw=new Set(["primary","secondary","link","ghost","dismiss"]),sw=(n,e)=>{var s;let t=Array.isArray((s=n.props)==null?void 0:s.actions)?n.props.actions:[];if(t.length===0)return null;let r=ve(e.doc,"div","scalebun-cta-row");for(let i of t){let o=rw.has(ye(i.variant))?ye(i.variant):"primary",a=e.doc.createElement("button");a.type="button",a.className=`scalebun-btn scalebun-btn-${o}`,a.textContent=ye(i.label,"OK"),a.setAttribute("data-action",ye(i.action,"dismiss")),a.addEventListener("click",()=>e.onAction({...i,variant:o})),r.appendChild(a)}return r},$r={heading:Kv,text:Gv,richtext:Xv,image:Xu,illustration:Xu,list:Jv,checklist:Yv,callout:Qv,badge:Zv,progress:ew,divider:tw,spacer:nw,cta:sw,nps:Uu,rating:Vu,emoji:Wu,poll:ju,quiz:Ku}});async function Ju(n){var e;try{if(typeof navigator!="undefined"&&((e=navigator.clipboard)!=null&&e.writeText))return await navigator.clipboard.writeText(n),!0}catch{}try{if(typeof document=="undefined")return!1;let t=document.createElement("textarea");t.value=n,t.style.position="fixed",t.style.opacity="0",t.setAttribute("aria-hidden","true"),document.body.appendChild(t),t.select();let r=typeof document.execCommand=="function"?document.execCommand("copy"):!1;return t.remove(),r}catch{return!1}}var Qu=E(()=>{"use strict"});function ao(n){return{doc:n.doc,onInteraction:e=>n.hooks.onInteraction(e),...n.hooks.requestOutcome?{requestOutcome:n.hooks.requestOutcome}:{},onAction:e=>{if(e.action==="dismiss"){n.requestClose("cta");return}if(n.hooks.onCtaClick(e.action),e.action==="copy"&&e.deepLink){Ju(e.deepLink);return}if(e.action==="link"&&e.deepLink)try{typeof window!="undefined"&&window.location.assign(e.deepLink)}catch{}}}}function oe(n){return zr(n.variant.blocks,ao(n))}function Vr(n,e,t=1e3){let r=!1,s=null,i=null,o=()=>{s!=null&&(clearTimeout(s),s=null)},a=()=>{r||(r=!0,o(),i==null||i.disconnect(),e())},c=()=>{s==null&&!r&&(s=setTimeout(a,t))};return typeof IntersectionObserver=="undefined"?(c(),()=>o()):(i=new IntersectionObserver(l=>{for(let u of l)u.isIntersecting&&u.intersectionRatio>=.5?c():o()},{threshold:[0,.5,1]}),i.observe(n),()=>{o(),i==null||i.disconnect()})}var Te=E(()=>{"use strict";Ur();Qu()});function Zu(n,e,t,r,s){var p;n.addStyles("scalebun-blocks",Hr),n.addStyles("scalebun-surfaces",qu);let i=n.zone(Lt(e)),o=i.ownerDocument,a=null,c=()=>{},l=!1,u=f=>{l||!a||(l=!0,c(),r.onDismiss(f),a.destroy())};return a=t({variant:e,host:n,doc:o,hooks:r,requestClose:u,metrics:s}),i.appendChild(a.el),(p=a.afterMount)==null||p.call(a),r.onImpression(),c=Vr(a.el,r.onView),{variantId:e.id,el:a.el,close:u}}var ep=E(()=>{"use strict";qr();io();Hu();Te()});var tp={};L(tp,{markdownRenderer:()=>iw});function co(n,e){var o;let t=[],r=/(\*\*([^*]+)\*\*)|(\*([^*]+)\*)|(`([^`]+)`)|(\[([^\]]+)\]\(([^)]+)\))/g,s=0,i;for(;i=r.exec(n);){if(i.index>s&&t.push(e.createTextNode(n.slice(s,i.index))),i[2])t.push(lo(e,"strong",i[2]));else if(i[4])t.push(lo(e,"em",i[4]));else if(i[6])t.push(lo(e,"code",i[6]));else if(i[8]){let a=e.createElement("a");a.textContent=i[8];let c=(o=i[9])!=null?o:"";/^(https?:|\/|#|mailto:)/i.test(c)&&(a.href=c,a.rel="noopener noreferrer",a.target="_blank"),t.push(a)}s=r.lastIndex}return s<n.length&&t.push(e.createTextNode(n.slice(s))),t}function lo(n,e,t){let r=n.createElement(e);return r.textContent=t,r}var iw,np=E(()=>{"use strict";iw=(n,e)=>{var i,o;let t=typeof((i=n.props)==null?void 0:i.text)=="string"?n.props.text:typeof((o=n.props)==null?void 0:o.markdown)=="string"?n.props.markdown:"",r=e.doc.createElement("div");r.className="scalebun-md";let s=null;for(let a of t.split(`
538
- `)){let c=a.trimEnd(),l=c.match(/^(#{1,4})\s+(.*)$/),u=c.match(/^\s*[-*]\s+(.*)$/);if(l){s=null;let d=e.doc.createElement(`h${l[1].length}`);d.className="scalebun-md-h",co(l[2],e.doc).forEach(p=>d.appendChild(p)),r.appendChild(d)}else if(u){s||(s=e.doc.createElement("ul"),s.className="scalebun-md-ul",r.appendChild(s));let d=e.doc.createElement("li");co(u[1],e.doc).forEach(p=>d.appendChild(p)),s.appendChild(d)}else if(c){s=null;let d=e.doc.createElement("p");d.className="scalebun-md-p",co(c,e.doc).forEach(p=>d.appendChild(p)),r.appendChild(d)}else s=null}return r}});var rp={};L(rp,{codeRenderer:()=>ow});var ow,sp=E(()=>{"use strict";ow=(n,e)=>{var u,d,p;let t=typeof((u=n.props)==null?void 0:u.code)=="string"?n.props.code:typeof((d=n.props)==null?void 0:d.text)=="string"?n.props.text:"",r=typeof((p=n.props)==null?void 0:p.language)=="string"?n.props.language:"",s=e.doc.createElement("div");s.className="scalebun-code";let i=e.doc.createElement("div");i.className="scalebun-code-bar";let o=e.doc.createElement("span");o.className="scalebun-code-lang",o.textContent=r||"code";let a=e.doc.createElement("button");a.type="button",a.className="scalebun-code-copy",a.textContent="Copy",a.addEventListener("click",async()=>{var m,h,g;let f=!1;try{typeof navigator!="undefined"&&navigator.clipboard&&(await navigator.clipboard.writeText(t),f=!0)}catch{f=!1}if(!f){let S=e.doc.createRange();S.selectNodeContents(c);let v=(h=(m=e.doc).getSelection)==null?void 0:h.call(m);v==null||v.removeAllRanges(),v==null||v.addRange(S)}a.textContent=f?"Copied":"Select all",(g=e.onInteraction)==null||g.call(e,"code_copy"),setTimeout(()=>a.textContent="Copy",1500)}),i.append(o,a);let c=e.doc.createElement("pre");c.className="scalebun-code-pre";let l=e.doc.createElement("code");return l.textContent=t,c.appendChild(l),s.append(i,c),s}});var Wr={};L(Wr,{chartRenderer:()=>lw,sparklineRenderer:()=>aw,statRenderer:()=>cw});function op(n,e,t){let r=n.createElementNS(uo,"svg");return r.setAttribute("viewBox",`0 0 ${e} ${t}`),r.setAttribute("width",String(e)),r.setAttribute("height",String(t)),r}var uo,ip,aw,cw,lw,jr=E(()=>{"use strict";uo="http://www.w3.org/2000/svg",ip=n=>Array.isArray(n)?n.map(Number).filter(e=>Number.isFinite(e)):[];aw=(n,e)=>{var p;let t=ip((p=n.props)==null?void 0:p.values),r=e.doc.createElement("div");if(r.className="scalebun-spark",t.length<2)return r;let s=160,i=40,o=Math.min(...t),c=Math.max(...t)-o||1,l=t.map((f,m)=>`${m/(t.length-1)*s},${i-(f-o)/c*(i-4)-2}`).join(" "),u=op(e.doc,s,i),d=e.doc.createElementNS(uo,"polyline");return d.setAttribute("points",l),d.setAttribute("fill","none"),d.setAttribute("stroke","var(--scalebun-accent)"),d.setAttribute("stroke-width","2"),d.setAttribute("stroke-linejoin","round"),u.appendChild(d),r.appendChild(u),r},cw=(n,e)=>{var i,o,a,c;let t=e.doc.createElement("div");t.className="scalebun-stat";let r=e.doc.createElement("div");if(r.className="scalebun-stat-value",r.textContent=String((o=(i=n.props)==null?void 0:i.value)!=null?o:"\u2014"),t.appendChild(r),((a=n.props)==null?void 0:a.label)!=null){let l=e.doc.createElement("div");l.className="scalebun-stat-label",l.textContent=String(n.props.label),t.appendChild(l)}let s=(c=n.props)==null?void 0:c.delta;if(s!=null){let l=e.doc.createElement("div"),u=Number(s);l.className="scalebun-stat-delta "+(u>=0?"up":"down"),l.textContent=`${u>=0?"\u25B2":"\u25BC"} ${Math.abs(u)}`,t.appendChild(l)}return t},lw=(n,e)=>{var l;let t=ip((l=n.props)==null?void 0:l.values),r=e.doc.createElement("div");if(r.className="scalebun-chart",t.length===0)return r;let s=240,i=100,o=Math.max(...t)||1,a=s/t.length,c=op(e.doc,s,i);return t.forEach((u,d)=>{let p=e.doc.createElementNS(uo,"rect"),f=u/o*(i-4);p.setAttribute("x",String(d*a+2)),p.setAttribute("y",String(i-f)),p.setAttribute("width",String(a-4)),p.setAttribute("height",String(f)),p.setAttribute("rx","2"),p.setAttribute("fill","var(--scalebun-accent)"),c.appendChild(p)}),r.appendChild(c),r}});var ap={};L(ap,{tableRenderer:()=>dw});var dw,cp=E(()=>{"use strict";dw=(n,e)=>{var o,a;let t=Array.isArray((o=n.props)==null?void 0:o.columns)?n.props.columns.map(String):[],r=Array.isArray((a=n.props)==null?void 0:a.rows)?n.props.rows:[],s=e.doc.createElement("table");if(s.className="scalebun-table",t.length){let c=e.doc.createElement("thead"),l=e.doc.createElement("tr");for(let u of t){let d=e.doc.createElement("th");d.textContent=u,l.appendChild(d)}c.appendChild(l),s.appendChild(c)}let i=e.doc.createElement("tbody");for(let c of r){let l=e.doc.createElement("tr");for(let u of Array.isArray(c)?c:[c]){let d=e.doc.createElement("td");d.textContent=u==null?"":String(u),l.appendChild(d)}i.appendChild(l)}return s.appendChild(i),s}});var lp={};L(lp,{videoRenderer:()=>uw});var uw,dp=E(()=>{"use strict";uw=(n,e)=>{var c,l;let t=typeof((c=n.props)==null?void 0:c.src)=="string"?n.props.src:"",r=typeof((l=n.props)==null?void 0:l.poster)=="string"?n.props.poster:"",s=e.doc.createElement("div");if(s.className="scalebun-video",!t)return s;let i=()=>{var d;s.replaceChildren();let u=e.doc.createElement("video");u.className="scalebun-video-el",u.src=t,u.controls=!0,u.autoplay=!0,u.playsInline=!0,s.appendChild(u),(d=e.onInteraction)==null||d.call(e,"video_play")},o=e.doc.createElement("button");if(o.type="button",o.className="scalebun-video-poster",o.setAttribute("aria-label","Play video"),r){let u=e.doc.createElement("img");u.src=r,u.alt="",u.loading="lazy",o.appendChild(u)}let a=e.doc.createElement("span");return a.className="scalebun-video-play",a.textContent="\u25B6",o.appendChild(a),o.addEventListener("click",i),s.appendChild(o),s}});var up={};L(up,{countdownRenderer:()=>fw});function pw(n,e){let t=n==null?void 0:n.target;if(typeof t=="number")return t;if(typeof t=="string"){let s=Date.parse(t);if(!Number.isNaN(s))return s}let r=Number(n==null?void 0:n.durationMs);return e+(Number.isFinite(r)&&r>0?r:24*36e5)}var Kr,fw,pp=E(()=>{"use strict";Kr=n=>String(Math.max(0,n)).padStart(2,"0"),fw=(n,e)=>{let t=e.doc.createElement("div");t.className="scalebun-countdown";let r=()=>typeof Date!="undefined"?Date.now():0,s=pw(n.props,r()),i=[];for(let a of["Days","Hrs","Min","Sec"]){let c=e.doc.createElement("div");c.className="scalebun-cd-cell";let l=e.doc.createElement("div");l.className="scalebun-cd-num",l.textContent="00";let u=e.doc.createElement("div");u.className="scalebun-cd-lab",u.textContent=a,c.append(l,u),t.appendChild(c),i.push([a,l])}let o=()=>{let a=Math.max(0,s-r()),c=Math.floor(a/864e5);a-=c*864e5;let l=Math.floor(a/36e5);a-=l*36e5;let u=Math.floor(a/6e4);a-=u*6e4;let d=Math.floor(a/1e3);i[0][1].textContent=Kr(c),i[1][1].textContent=Kr(l),i[2][1].textContent=Kr(u),i[3][1].textContent=Kr(d)};if(o(),typeof setInterval!="undefined"){let a=setInterval(()=>{if(!t.isConnected){clearInterval(a);return}o()},1e3)}return t}});var fp={};L(fp,{carouselRenderer:()=>mw});var po,mw,mp=E(()=>{"use strict";po=n=>typeof n=="string"&&n?n:void 0,mw=(n,e)=>{var c,l;let t=Array.isArray((c=n.props)==null?void 0:c.slides)?n.props.slides:[],r=e.doc.createElement("div");if(r.className="scalebun-carousel",t.length===0)return r;let s=e.doc.createElement("div");s.className="scalebun-car-track";let i=[];for(let u of t){let d=e.doc.createElement("div");d.className="scalebun-car-slide";let p=po(u.image);if(p){let f=e.doc.createElement("img");f.className="scalebun-car-img",f.src=p,f.alt="",f.loading="lazy",d.appendChild(f)}if(po(u.title)){let f=e.doc.createElement("div");f.className="scalebun-car-title",f.textContent=u.title,d.appendChild(f)}if(po(u.text)){let f=e.doc.createElement("div");f.className="scalebun-car-text",f.textContent=u.text,d.appendChild(f)}s.appendChild(d),i.push(d)}r.appendChild(s);let o=e.doc.createElement("div");o.className="scalebun-car-dots";let a=t.map((u,d)=>{let p=e.doc.createElement("button");return p.type="button",p.className="scalebun-car-dot"+(d===0?" on":""),p.setAttribute("aria-label",`Slide ${d+1}`),p.addEventListener("click",()=>i[d].scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})),o.appendChild(p),p});if(r.appendChild(o),typeof IntersectionObserver!="undefined"){let u=new IntersectionObserver(d=>{for(let p of d)if(p.isIntersecting){let f=i.indexOf(p.target);a.forEach((m,h)=>m.classList.toggle("on",h===f))}},{root:s,threshold:.6});i.forEach(d=>u.observe(d))}return(l=e.onInteraction)==null||l.call(e,"carousel_view"),r}});var hp={};L(hp,{productGridRenderer:()=>hw});var Gr,hw,gp=E(()=>{"use strict";Gr=n=>n==null?void 0:String(n),hw=(n,e)=>{var s,i;let t=Array.isArray((s=n.props)==null?void 0:s.products)?n.props.products:Array.isArray((i=n.props)==null?void 0:i.items)?n.props.items:[],r=e.doc.createElement("div");return r.className="scalebun-pgrid",t.length===0||t.forEach((o,a)=>{var d;let c=e.doc.createElement("button");c.type="button",c.className="scalebun-pcard";let l=Gr(o.image);if(l){let p=e.doc.createElement("img");p.className="scalebun-pcard-img",p.src=l,p.alt="",p.loading="lazy",c.appendChild(p)}if(o.badge){let p=e.doc.createElement("span");p.className="scalebun-pcard-badge",p.textContent=Gr(o.badge),c.appendChild(p)}let u=e.doc.createElement("div");if(u.className="scalebun-pcard-title",u.textContent=(d=Gr(o.title))!=null?d:"",c.appendChild(u),o.price!=null){let p=e.doc.createElement("div");p.className="scalebun-pcard-price",p.textContent=Gr(o.price),c.appendChild(p)}c.addEventListener("click",()=>{var p,f;return(f=e.onInteraction)==null?void 0:f.call(e,`product_select:${(p=o.id)!=null?p:a}`)}),r.appendChild(c)}),r}});var yp={};L(yp,{confettiRenderer:()=>bw});function gw(){try{return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var bp,bw,vp=E(()=>{"use strict";bp=["#6C5CE7","#f5b301","#2fa96b","#e0483d","#7c9dff","#ff8fab"];bw=(n,e)=>{var d,p;let t=e.doc.createElement("div");if(t.className="scalebun-confetti",gw()||typeof requestAnimationFrame=="undefined")return t.classList.add("scalebun-confetti-static"),t.textContent="\u{1F389}",t;let r=e.doc.createElement("canvas");r.className="scalebun-confetti-canvas",t.appendChild(r);let s=r.getContext("2d");if(!s)return t;let i=Math.min(240,Math.max(40,Number((d=n.props)==null?void 0:d.count)||140)),o=[],a=()=>{let f=r.width;o=Array.from({length:i},(m,h)=>({x:f/2+(h-i/2),y:r.height*.25,vx:(h%20-10)*.6,vy:-4-h%7,rot:h,vr:(h%5-2)*.3,c:bp[h%bp.length],s:5+h%4}))};(()=>{var m;let f=(m=t.parentElement)!=null?m:t;r.width=f.clientWidth||360,r.height=f.clientHeight||240})(),a();let l=0,u=()=>{if(!t.isConnected)return;s.clearRect(0,0,r.width,r.height);let f=0;for(let m of o)m.vy+=.16,m.x+=m.vx,m.y+=m.vy,m.rot+=m.vr,m.y<r.height+12&&f++,s.save(),s.translate(m.x,m.y),s.rotate(m.rot),s.fillStyle=m.c,s.fillRect(-m.s/2,-m.s/2,m.s,m.s*.6),s.restore();l++,f>0&&l<240?requestAnimationFrame(u):s.clearRect(0,0,r.width,r.height)};return requestAnimationFrame(u),(p=e.onInteraction)==null||p.call(e,"celebration"),t}});function _t(n,e,t,r={}){var o,a,c;(o=n.querySelector(".scalebun-game-note"))==null||o.remove();let s=e.createElement("div");s.className="scalebun-game-note",s.setAttribute("role","status");let i=e.createElement("span");if(i.textContent=(a=t.message)!=null?a:"Rewards are unavailable right now.",s.appendChild(i),t.retryable&&r.onRetry){let l=e.createElement("button");l.type="button",l.className="scalebun-game-retry",l.textContent=(c=r.retryLabel)!=null?c:"Try again",l.addEventListener("click",()=>{var u;s.remove(),(u=r.onRetry)==null||u.call(r)},{once:!0}),s.appendChild(l)}n.appendChild(s)}function Ot(n){var e;(e=n.querySelector(".scalebun-game-note"))==null||e.remove()}var Xr=E(()=>{"use strict"});var Sp={};L(Sp,{spinwheelRenderer:()=>ww});function mo(n,e,t,r){let s=(r-90)*Math.PI/180;return{x:n+t*Math.cos(s),y:e+t*Math.sin(s)}}function vw(n,e,t,r,s){let i=mo(n,e,t,s),o=mo(n,e,t,r),a=s-r<=180?0:1;return`M ${n} ${e} L ${i.x} ${i.y} A ${t} ${t} 0 ${a} 0 ${o.x} ${o.y} Z`}function xp(){try{return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var wp,yw,fo,ww,kp=E(()=>{"use strict";Xr();wp=["#6C5CE7","#8b7bff","#5b4bd6","#a99cff","#4c3fb0","#7c6ef0"],yw=n=>{var e;return typeof n=="string"?n:String((e=n==null?void 0:n.label)!=null?e:"")};fo="http://www.w3.org/2000/svg",ww=(n,e)=>{var v,y;let t=(Array.isArray((v=n.props)==null?void 0:v.segments)?n.props.segments:[]).map(yw).filter(Boolean),r=t.length?t:["10% off","Free ship","Try again","20% off","$5 credit","Jackpot"],s=r.length,i=Math.max(0,Math.min(s-1,Number((y=n.props)==null?void 0:y.resultIndex)||0)),o=e.doc.createElement("div");o.className="scalebun-wheel";let a=220,c=a/2,l=a/2-4,u=360/s,d=e.doc.createElementNS(fo,"svg");d.setAttribute("viewBox",`0 0 ${a} ${a}`),d.setAttribute("width",String(a)),d.setAttribute("height",String(a)),d.setAttribute("class","scalebun-wheel-svg"),r.forEach((b,w)=>{let x=e.doc.createElementNS(fo,"path");x.setAttribute("d",vw(c,c,l,w*u,(w+1)*u)),x.setAttribute("fill",wp[w%wp.length]),d.appendChild(x);let I=mo(c,c,l*.62,w*u+u/2),k=e.doc.createElementNS(fo,"text");k.setAttribute("x",String(I.x)),k.setAttribute("y",String(I.y)),k.setAttribute("fill","#fff"),k.setAttribute("font-size","10"),k.setAttribute("text-anchor","middle"),k.setAttribute("transform",`rotate(${w*u+u/2} ${I.x} ${I.y})`),k.textContent=b.slice(0,12),d.appendChild(k)});let p=e.doc.createElement("div");p.className="scalebun-wheel-pointer";let f=e.doc.createElement("button");f.type="button",f.className="scalebun-wheel-spin",f.textContent="SPIN";let m=!1,h=b=>360*5-(b*u+u/2),g=(b,w)=>{var k;let x=((k=w!=null?w:r[b])!=null?k:"").slice(0,14);if(xp()){d.style.transform=`rotate(${-(b*u+u/2)}deg)`,f.textContent=x;return}d.style.transition="transform 3.4s cubic-bezier(.17,.67,.16,.99)",d.style.transform=`rotate(${h(b)}deg)`;let I=()=>{f.textContent=x};d.addEventListener("transitionend",I,{once:!0}),setTimeout(I,3600)},S=b=>{m=!0,f.disabled=!0,Ot(o),xp()||(d.style.transition="transform 1.1s linear",d.style.transform="rotate(400deg)"),e.requestOutcome(b).then(w=>{var I,k,C;if(!w.ok){d.style.transition="",d.style.transform="",m=!1,f.disabled=!1,_t(o,e.doc,w,{onRetry:()=>S(b+1)}),(I=e.onInteraction)==null||I.call(e,"spin_unavailable");return}let x=Math.max(0,Math.min(s-1,Number((k=w.index)!=null?k:0)));(C=e.onInteraction)==null||C.call(e,`spin:${x}`),g(x,w.label)})};return f.addEventListener("click",()=>{var b;if(!m){if(e.requestOutcome){S(1);return}m=!0,(b=e.onInteraction)==null||b.call(e,`spin:${i}`),g(i)}}),o.append(p,d,f),o}});var Ip={};L(Ip,{scratchRenderer:()=>xw});function Ep(){try{return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var xw,Cp=E(()=>{"use strict";Xr();xw=(n,e)=>{var S,v;let t=typeof((S=n.props)==null?void 0:S.prize)=="string"?n.props.prize:"You won a prize!",r=((v=n.props)==null?void 0:v.reveal)==="box",s=e.doc.createElement("div");s.className=r?"scalebun-scratch scalebun-scratch-box":"scalebun-scratch";let i=e.doc.createElement("div");i.className="scalebun-scratch-prize",i.textContent=t,s.appendChild(i);let o=!1,a=()=>{o||!e.requestOutcome||(o=!0,e.requestOutcome(1).then(y=>{var b;if(y.ok){Ot(s),y.label&&(i.textContent=y.label);return}i.textContent="\u2014",_t(s,e.doc,y,{onRetry:()=>{o=!1,a()}}),(b=e.onInteraction)==null||b.call(e,"reveal_unavailable")}))};if(r){if(Ep())return s;let y=e.doc.createElement("button");return y.type="button",y.className="scalebun-scratch-lid",y.setAttribute("aria-label","Open the mystery box"),y.textContent="\u{1F381}",y.addEventListener("click",()=>{var b;a(),y.setAttribute("data-open","true"),setTimeout(()=>y.remove(),320),(b=e.onInteraction)==null||b.call(e,"mystery_box_opened")},{once:!0}),s.appendChild(y),s}let c=e.doc.createElement("canvas");c.className="scalebun-scratch-cover";let l=c.getContext("2d");if(Ep()||!l)return c.remove(),s;s.appendChild(c);let u=300,d=90;c.width=u,c.height=d,l.fillStyle="#9aa3b2",l.fillRect(0,0,u,d),l.fillStyle="#6b7280",l.font="13px sans-serif",l.textAlign="center",l.fillText("Scratch here",u/2,d/2+4),l.globalCompositeOperation="destination-out";let p=!1,f=!1,m=(y,b)=>{l.beginPath(),l.arc(y,b,16,0,Math.PI*2),l.fill()},h=y=>{let b=c.getBoundingClientRect();return{x:(y.clientX-b.left)/b.width*u,y:(y.clientY-b.top)/b.height*d}},g=y=>{var w;if(!p)return;let b=h(y);m(b.x,b.y),f||(f=!0,a(),(w=e.onInteraction)==null||w.call(e,"scratch_reveal"))};return c.addEventListener("mousedown",y=>{p=!0;let b=h(y);m(b.x,b.y)}),e.doc.addEventListener("mouseup",()=>p=!1),c.addEventListener("mousemove",g),c.addEventListener("touchmove",y=>{var w;let b=y.touches[0];if(b){let x=h(b);m(x.x,x.y),f||(f=!0,a(),(w=e.onInteraction)==null||w.call(e,"scratch_reveal"))}}),s}});var Ap={};L(Ap,{slotRenderer:()=>Ew});function kw(){try{return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var Sw,Ew,Rp=E(()=>{"use strict";Xr();Sw=["\u{1F352}","\u{1F514}","\u2B50","7\uFE0F\u20E3","\u{1F48E}","\u{1F340}"];Ew=(n,e)=>{var p,f,m;let t=(Array.isArray((p=n.props)==null?void 0:p.symbols)?n.props.symbols.map(String):[]).filter(Boolean),r=t.length?t:Sw,s=Array.isArray((f=n.props)==null?void 0:f.result)?n.props.result.slice(0,3).map(String):[r[0],r[0],r[0]],i=e.doc.createElement("div");i.className="scalebun-slot";let o=e.doc.createElement("div");o.className="scalebun-slot-reels";let a=[];for(let h=0;h<3;h++){let g=e.doc.createElement("div");g.className="scalebun-slot-reel";let S=e.doc.createElement("div");S.className="scalebun-slot-strip";for(let v of[...r,...r,(m=s[h])!=null?m:r[0]]){let y=e.doc.createElement("div");y.className="scalebun-slot-cell",y.textContent=v,S.appendChild(y)}g.appendChild(S),a.push(S),o.appendChild(g)}i.appendChild(o);let c=e.doc.createElement("button");c.type="button",c.className="scalebun-slot-spin scalebun-btn scalebun-btn-primary",c.textContent="Spin";let l=!1,u=()=>{a.forEach((g,S)=>{let v=(g.children.length-1)*44;kw()||(g.style.transition=`transform ${1.6+S*.35}s cubic-bezier(.15,.7,.15,1)`),g.style.transform=`translateY(-${v}px)`})},d=h=>{l=!0,c.disabled=!0,Ot(i),e.requestOutcome(h).then(g=>{var v,y,b;if(!g.ok){l=!1,c.disabled=!1,_t(i,e.doc,g,{onRetry:()=>d(h+1)}),(v=e.onInteraction)==null||v.call(e,"slot_unavailable");return}let S=(y=g.symbols)!=null&&y.length?g.symbols:s;a.forEach((w,x)=>{var k,C;let I=w.children[w.children.length-1];I&&(I.textContent=(C=(k=S[x])!=null?k:s[x])!=null?C:r[0])}),(b=e.onInteraction)==null||b.call(e,`slot:${S.join("")}`),u()})};return c.addEventListener("click",()=>{var h;if(!l){if(e.requestOutcome){d(1);return}l=!0,(h=e.onInteraction)==null||h.call(e,`slot:${s.join("")}`),u()}}),i.appendChild(c),i}});var Tp={};L(Tp,{qrRenderer:()=>Rw});function Iw(n,e,t){let r=2166136261^e*73856093^t*19349663;for(let s=0;s<n.length;s++)r=(r^n.charCodeAt(s))*16777619;return((r>>>13^r)&1)===1}function Cw(n,e){let t=(r,s)=>n>=r&&n<r+7&&e>=s&&e<s+7;return t(0,0)||t(18,0)||t(0,18)}function Aw(n,e){let t=n<7?n:n>=18?n-18:-1,r=e<7?e:e>=18?e-18:-1;if(t<0||r<0)return!1;let s=t===0||t===6||r===0||r===6,i=t>=2&&t<=4&&r>=2&&r<=4;return s||i}var ho,Rw,Mp=E(()=>{"use strict";ho="http://www.w3.org/2000/svg";Rw=(n,e)=>{var d;let t=typeof((d=n.props)==null?void 0:d.value)=="string"&&n.props.value?n.props.value:"https://app.example.com",r=e.doc.createElement("div");r.className="scalebun-qr";let s=160,i=2,o=25+i*2,a=s/o,c=e.doc.createElementNS(ho,"svg");c.setAttribute("viewBox",`0 0 ${s} ${s}`),c.setAttribute("width",String(s)),c.setAttribute("height",String(s)),c.setAttribute("class","scalebun-qr-svg");let l=e.doc.createElementNS(ho,"rect");l.setAttribute("width",String(s)),l.setAttribute("height",String(s)),l.setAttribute("fill","#ffffff"),c.appendChild(l);for(let p=0;p<25;p++)for(let f=0;f<25;f++){let m;if(Cw(f,p)?m=Aw(f,p):f===6||p===6?m=(f+p)%2===0:m=Iw(t,f,p),!m)continue;let h=e.doc.createElementNS(ho,"rect");h.setAttribute("x",String((f+i)*a)),h.setAttribute("y",String((p+i)*a)),h.setAttribute("width",String(a+.5)),h.setAttribute("height",String(a+.5)),h.setAttribute("fill","#0b0d12"),c.appendChild(h)}r.appendChild(c);let u=e.doc.createElement("div");return u.className="scalebun-qr-cap",u.textContent=t.length>40?t.slice(0,39)+"\u2026":t,r.appendChild(u),r}});var Pp={};L(Pp,{streakRenderer:()=>Tw});var go,Tw,Lp=E(()=>{"use strict";go=(n,e)=>{let t=Number(n);return Number.isFinite(t)?Math.trunc(t):e},Tw=(n,e)=>{var l;let t=(l=n.props)!=null?l:{},r=t.mode==="checkin",s=Array.isArray(t.labels)?t.labels.map(u=>String(u!=null?u:"")):[],i=Math.max(1,Math.min(31,go(t.days,s.length||7))),o=Math.max(0,Math.min(i,go(t.filled,0))),a=r?Math.max(0,Math.min(i,go(t.today,o+1))):0,c=e.doc.createElement("div");c.className=r?"scalebun-streak scalebun-streak-checkin":"scalebun-streak",c.setAttribute("role","group"),c.setAttribute("aria-label",r?`Checked in ${o} of ${i} days`:`${o} day streak of ${i}`);for(let u=1;u<=i;u++){let d=u<=o,p=u===a&&!d,f=e.doc.createElement(p?"button":"div");f.className="scalebun-streak-day",f.setAttribute("data-done",d?"true":"false"),p&&(f.type="button",f.setAttribute("data-today","true"));let m=e.doc.createElement("span");m.className="scalebun-streak-mark",m.setAttribute("aria-hidden","true"),m.textContent=d?r?"\u2713":"\u{1F525}":"",f.appendChild(m);let h=s[u-1];if(h){let g=e.doc.createElement("span");g.className="scalebun-streak-label",g.textContent=h,f.appendChild(g)}f.setAttribute("aria-label",`${h||`Day ${u}`} \u2014 ${d?"done":p?"today":"not done"}`),p&&f.addEventListener("click",()=>{var g;return(g=e.onInteraction)==null?void 0:g.call(e,`check_in:${u}`)},{once:!0}),c.appendChild(f)}return c}});var Np={};L(Np,{nextStepIndex:()=>Op,stepLabels:()=>_p,stepsRenderer:()=>Pw});function _p(n){var t,r,s,i,o,a;let e=n!=null?n:{};return{back:(t=He(e.backLabel))!=null?t:"Back",skip:(s=(r=He(e.skipLabel))!=null?r:He(e.secondaryLabel))!=null?s:"Skip",next:(i=He(e.nextLabel))!=null?i:"Next",finish:(a=(o=He(e.finalLabel))!=null?o:He(e.ctaLabel))!=null?a:"Finish"}}function Op(n,e,t){return e<=0?0:Math.max(0,Math.min(n+(t==="next"?1:-1),e-1))}function Mw(n){let e=n==null?void 0:n.steps,r=(Array.isArray(e)?e:[]).map(s=>{var o,a;if(typeof s=="string")return{title:s};let i=s&&typeof s=="object"?s:{};return{title:(o=He(i.title))!=null?o:He(i.label),body:(a=He(i.body))!=null?a:He(i.text)}});return r.length?r:[{}]}var He,Pw,Bp=E(()=>{"use strict";He=n=>typeof n=="string"&&n.trim()?n.trim():void 0;Pw=(n,e)=>{let t=n.props,r=Mw(t),s=_p(t),i=e.doc,o=0,a=i.createElement("div");a.className="scalebun-steps";let c=i.createElement("div");c.className="scalebun-steps-rail",c.setAttribute("role","progressbar"),c.setAttribute("aria-valuemin","1"),c.setAttribute("aria-valuemax",String(r.length));let l=r.map(()=>{let b=i.createElement("span");return b.className="scalebun-steps-dot",c.appendChild(b),b});a.appendChild(c);let u=i.createElement("div");u.className="scalebun-steps-page";let d=i.createElement("div");d.className="scalebun-steps-title";let p=i.createElement("div");p.className="scalebun-steps-body",u.appendChild(d),u.appendChild(p),a.appendChild(u);let f=i.createElement("div");f.className="scalebun-steps-nav";let m=(b,w)=>{let x=i.createElement("button");return x.type="button",x.className=`scalebun-btn ${w}`,x.textContent=b,f.appendChild(x),x},h=m(s.back,"scalebun-btn-ghost"),g=m(s.skip,"scalebun-btn-ghost"),S=m(s.next,"scalebun-btn-primary");a.appendChild(f);let v=()=>{var x,I,k;let b=(x=r[o])!=null?x:{};d.textContent=(I=b.title)!=null?I:"",d.style.display=b.title?"":"none",p.textContent=(k=b.body)!=null?k:"",p.style.display=b.body?"":"none";let w=o+1>=r.length;S.textContent=w?s.finish:s.next,h.hidden=o===0,g.hidden=w,c.setAttribute("aria-valuenow",String(o+1)),c.setAttribute("aria-label",`Step ${o+1} of ${r.length}`),l.forEach((C,M)=>{C.setAttribute("data-state",M<o?"done":M===o?"current":"todo"),M===o?C.setAttribute("aria-current","step"):C.removeAttribute("aria-current")})},y=b=>{var x;let w=Op(o,r.length,b);w!==o&&(o=w,v(),(x=e.onInteraction)==null||x.call(e,`step-${o+1}`))};return h.addEventListener("click",()=>y("back")),g.addEventListener("click",()=>{var b;return(b=e.onInteraction)==null?void 0:b.call(e,"step-skip")}),S.addEventListener("click",()=>{var b;if(o+1>=r.length){(b=e.onInteraction)==null||b.call(e,"step-finish");return}y("next")}),v(),a}});async function Fp(n){let e=new Set;for(let t of n)bo[t]&&!$r[t]&&e.add(t);await Promise.all([...e].map(async t=>{try{$r[t]=await bo[t]()}catch{}}))}var bo,oA,Dp=E(()=>{"use strict";Ur();bo={markdown:()=>Promise.resolve().then(()=>(np(),tp)).then(n=>n.markdownRenderer),code:()=>Promise.resolve().then(()=>(sp(),rp)).then(n=>n.codeRenderer),chart:()=>Promise.resolve().then(()=>(jr(),Wr)).then(n=>n.chartRenderer),sparkline:()=>Promise.resolve().then(()=>(jr(),Wr)).then(n=>n.sparklineRenderer),stat:()=>Promise.resolve().then(()=>(jr(),Wr)).then(n=>n.statRenderer),table:()=>Promise.resolve().then(()=>(cp(),ap)).then(n=>n.tableRenderer),video:()=>Promise.resolve().then(()=>(dp(),lp)).then(n=>n.videoRenderer),countdown:()=>Promise.resolve().then(()=>(pp(),up)).then(n=>n.countdownRenderer),carousel:()=>Promise.resolve().then(()=>(mp(),fp)).then(n=>n.carouselRenderer),"product-grid":()=>Promise.resolve().then(()=>(gp(),hp)).then(n=>n.productGridRenderer),confetti:()=>Promise.resolve().then(()=>(vp(),yp)).then(n=>n.confettiRenderer),spinwheel:()=>Promise.resolve().then(()=>(kp(),Sp)).then(n=>n.spinwheelRenderer),scratch:()=>Promise.resolve().then(()=>(Cp(),Ip)).then(n=>n.scratchRenderer),slot:()=>Promise.resolve().then(()=>(Rp(),Ap)).then(n=>n.slotRenderer),qr:()=>Promise.resolve().then(()=>(Mp(),Tp)).then(n=>n.qrRenderer),streak:()=>Promise.resolve().then(()=>(Lp(),Pp)).then(n=>n.streakRenderer),steps:()=>Promise.resolve().then(()=>(Bp(),Np)).then(n=>n.stepsRenderer)},oA=Object.keys(bo)});var qp={};L(qp,{bannerSurface:()=>Lw});function Lw(n){var o,a,c,l,u,d,p;let{doc:e,variant:t}=n,r=((o=t.surfaceOptions)==null?void 0:o.placement)==="bottom",s=e.createElement("div");s.className="scalebun-banner"+(r?" scalebun-banner-bottom":""),s.setAttribute("role",(c=(a=t.a11y)==null?void 0:a.role)!=null?c:"region"),s.setAttribute("aria-live",(u=(l=t.a11y)==null?void 0:l.liveRegion)!=null?u:"polite"),(d=t.a11y)!=null&&d.labelledBy&&s.setAttribute("aria-label",t.a11y.labelledBy);let i=e.createElement("div");i.className="scalebun-body";for(let f of oe(n))i.appendChild(f);if(s.appendChild(i),((p=t.dismiss)==null?void 0:p.xButton)!==!1){let f=e.createElement("button");f.type="button",f.className="scalebun-x",f.setAttribute("aria-label","Dismiss"),f.textContent="\xD7",f.addEventListener("click",()=>n.requestClose("x")),s.appendChild(f)}return{el:s,destroy:()=>s.remove()}}var Hp=E(()=>{"use strict";Te()});var $p={};L($p,{toastSurface:()=>_w});function _w(n){var l,u,d,p,f,m;let{doc:e,variant:t}=n,r=e.createElement("div");r.className="scalebun-toast",r.setAttribute("role",(u=(l=t.a11y)==null?void 0:l.role)!=null?u:"status"),r.setAttribute("aria-live",(p=(d=t.a11y)==null?void 0:d.liveRegion)!=null?p:"polite");let s=e.createElement("div");s.className="scalebun-body";for(let h of oe(n))s.appendChild(h);if(r.appendChild(s),((f=t.dismiss)==null?void 0:f.xButton)!==!1){let h=e.createElement("button");h.type="button",h.className="scalebun-x",h.setAttribute("aria-label","Dismiss"),h.textContent="\xD7",h.addEventListener("click",()=>n.requestClose("x")),r.appendChild(h)}let i=null,o=(m=t.dismiss)==null?void 0:m.autoDismissMs,a=()=>{o&&o>0&&(i=setTimeout(()=>n.requestClose("auto"),o))},c=()=>{i!=null&&(clearTimeout(i),i=null)};return o&&o>0&&(r.addEventListener("mouseenter",c),r.addEventListener("mouseleave",a),a()),{el:r,destroy:()=>{c(),r.remove()}}}var zp=E(()=>{"use strict";Te()});function Nw(n){if(n.hasAttribute("hidden")||n.getAttribute("aria-hidden")==="true"||n.closest("[inert]"))return!1;if(typeof getComputedStyle!="undefined"){let e=getComputedStyle(n);if(e.display==="none"||e.visibility==="hidden")return!1}return!0}function Up(n){return Array.from(n.querySelectorAll(Ow)).filter(Nw)}function Bw(n){var t;return(t=n.getRootNode().activeElement)!=null?t:null}function Nt(n,e=document){let t=r=>{if(r.key!=="Tab")return;let s=Up(n);if(s.length===0){r.preventDefault(),n.focus();return}let i=Bw(n),o=i?s.indexOf(i):-1;r.preventDefault(),r.shiftKey?o=o<=0?s.length-1:o-1:o=o===-1||o>=s.length-1?0:o+1,s[o].focus()};return n.addEventListener("keydown",t),()=>n.removeEventListener("keydown",t)}function Yr(n){let e=Up(n);e.length?e[0].focus():(n.setAttribute("tabindex","-1"),n.focus())}function Jr(n,e=document){let t=e.body;if(!t)return()=>{};let r=[];for(let s of Array.from(t.children))s===n||s.contains(n)||(r.push({el:s,hadInert:s.hasAttribute("inert"),ariaWas:s.getAttribute("aria-hidden")}),s.setAttribute("inert",""),s.setAttribute("aria-hidden","true"));return()=>{for(let{el:s,hadInert:i,ariaWas:o}of r)i||s.removeAttribute("inert"),o==null?s.removeAttribute("aria-hidden"):s.setAttribute("aria-hidden",o)}}function Bt(n=document){let e=n.activeElement;return()=>{var t;try{(t=e==null?void 0:e.focus)==null||t.call(e)}catch{}}}var Ow,Qr=E(()=>{"use strict";Ow=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",")});var Vp={};L(Vp,{modalSurface:()=>Dw});function Dw(n){var h,g,S,v,y,b,w;let{doc:e,variant:t}=n,r=(h=t.a11y)!=null?h:{},s=(g=t.dismiss)!=null?g:{},i=Bt(e),o=e.createElement("div");o.className="scalebun-backdrop";let a=e.createElement("div");a.className="scalebun-modal-card",a.setAttribute("role",(S=r.role)!=null?S:"dialog"),a.setAttribute("aria-modal","true");let c=(y=(v=t.surfaceOptions)==null?void 0:v.size)!=null?y:"md";a.setAttribute("data-size",c);let l=oe(n),u=l.find(x=>x.classList.contains("scalebun-h"));if(u){let x=`scalebun-mt-${++Fw}`;u.id=x,a.setAttribute("aria-labelledby",x)}else a.setAttribute("aria-label",t.name);if(s.xButton!==!1){let x=e.createElement("button");x.type="button",x.className="scalebun-x scalebun-modal-x",x.setAttribute("aria-label","Close dialog"),x.textContent="\xD7",x.addEventListener("click",()=>n.requestClose("x")),a.appendChild(x)}for(let x of l)a.appendChild(x);o.appendChild(a),s.backdropClose&&o.addEventListener("mousedown",x=>{x.target===o&&n.requestClose("backdrop")});let d=x=>{x.key==="Escape"&&s.escClose!==!1&&(x.stopPropagation(),n.requestClose("esc"))};o.addEventListener("keydown",d);let p=Nt(a,e),f=(w=(b=n.host.shadowRoot)==null?void 0:b.host)!=null?w:o,m=Jr(f,e);return{el:o,afterMount:()=>Yr(a),destroy:()=>{p(),m(),o.removeEventListener("keydown",d),o.remove(),i()}}}var Fw,Wp=E(()=>{"use strict";Te();Qr();Fw=0});var Xp={};L(Xp,{slideoverSurface:()=>$w});function qw(n,e){try{let t=localStorage.getItem(Gp(n)),r=t?Number(t):NaN;return Number.isFinite(r)?Math.min(Kp,Math.max(jp,r)):e}catch{return e}}function Hw(n,e){try{localStorage.setItem(Gp(n),String(Math.round(e)))}catch{}}function $w(n){var g,S,v,y,b,w,x,I,k,C;let{doc:e,variant:t}=n,r=(g=t.surfaceOptions)==null?void 0:g.placement,s=r==="bottom",i=r==="left",o=!s&&((S=t.surfaceOptions)==null?void 0:S.resizable)!==!1,a=!!((v=t.surfaceOptions)!=null&&v.pinnable),c=e.createElement("div");c.className="scalebun-slideover "+(s?"scalebun-slideover-bottom":i?"scalebun-slideover-left":"scalebun-slideover-right"),c.setAttribute("role",(b=(y=t.a11y)==null?void 0:y.role)!=null?b:s?"dialog":"complementary"),c.setAttribute("aria-label",(x=(w=t.a11y)==null?void 0:w.labelledBy)!=null?x:t.name);let l=qw(t.id,(k=(I=t.surfaceOptions)==null?void 0:I.maxWidth)!=null?k:380),u=()=>{s||(c.style.width=`${l}px`)};u();let d=e.createElement("div");if(d.className="scalebun-so-header",a){let M=e.createElement("button");M.type="button",M.className="scalebun-x scalebun-so-pin";let R=`scalebun_inapp_slideover_pin_${t.id}`,A=!1;try{A=localStorage.getItem(R)==="1"}catch{}let O=()=>{c.setAttribute("data-pinned",A?"true":"false"),M.setAttribute("aria-pressed",A?"true":"false"),M.title=A?"Unpin":"Pin",M.textContent=A?"\u{1F4CC}":"\u{1F4CD}"};M.addEventListener("click",()=>{A=!A;try{localStorage.setItem(R,A?"1":"0")}catch{}O()}),O(),d.appendChild(M)}if(((C=t.dismiss)==null?void 0:C.xButton)!==!1){let M=e.createElement("button");M.type="button",M.className="scalebun-x",M.setAttribute("aria-label","Close panel"),M.textContent="\xD7",M.addEventListener("click",()=>n.requestClose("x")),d.appendChild(M)}c.appendChild(d);let p=e.createElement("div");p.className="scalebun-so-body";for(let M of oe(n))p.appendChild(M);c.appendChild(p);let f=null,m=null;if(o){let M=e.createElement("div");M.className="scalebun-so-resize",M.setAttribute("role","separator"),M.setAttribute("aria-orientation","vertical"),M.addEventListener("mousedown",R=>{R.preventDefault();let A=R.clientX,O=l;f=z=>{let D=i?z.clientX-A:A-z.clientX;l=Math.min(Kp,Math.max(jp,O+D)),u()},m=()=>{Hw(t.id,l),h()},e.addEventListener("mousemove",f),e.addEventListener("mouseup",m)}),c.appendChild(M)}let h=()=>{f&&e.removeEventListener("mousemove",f),m&&e.removeEventListener("mouseup",m),f=m=null};return{el:c,destroy:()=>{h(),c.remove()}}}var jp,Kp,Gp,Yp=E(()=>{"use strict";Te();jp=280,Kp=640,Gp=n=>`scalebun_inapp_slideover_${n}`});function Jp(n){return typeof CSS!="undefined"&&CSS.escape?CSS.escape(n):n.replace(/["\\]/g,"\\$&")}function on(n,e,t,r=[]){try{for(let s of[...n.querySelectorAll(e)])r.push(s)}catch{}if(t)for(let s of[...n.querySelectorAll("*")]){let i=s.shadowRoot;i&&on(i,e,t,r)}return r}function yo(n,e,t){let r=null;try{r=n.querySelector(e)}catch{return null}if(r)return r;if(!t)return null;for(let s of[...n.querySelectorAll("*")]){let i=s.shadowRoot;if(i){let o=yo(i,e,!0);if(o)return o}}return null}function zw(n,e,t,r){let s=e.trim(),i=on(n,t!=null?t:"*",r).filter(o=>{var a;return((a=o.textContent)!=null?a:"").trim()===s});return i.length?i.reduce((o,a)=>a.querySelectorAll("*").length<o.querySelectorAll("*").length?a:o):null}function Uw(n,e,t,r){var a,c;let s=e?`[role="${Jp(e)}"]`:"button,a,[role],input,select,textarea,summary",i=on(n,s,r);if(!t)return(a=i[0])!=null?a:null;let o=t.trim();return(c=i.find(l=>{var u,d;return((d=(u=l.getAttribute("aria-label"))!=null?u:l.textContent)!=null?d:"").trim()===o}))!=null?c:null}function Vw(n){var e;if(typeof document=="undefined"||!document.evaluate)return null;try{return(e=document.evaluate(n,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue)!=null?e:null}catch{return null}}function Ww(n,e,t){var r;switch(n.kind){case"selector":return yo(e,n.value,t);case"data-attr":return yo(e,`[data-scalebun-anchor="${Jp(n.value)}"]`,t);case"nth":return(r=on(e,n.selector,t)[n.index])!=null?r:null;case"text":return zw(e,n.value,n.scope,t);case"aria":return Uw(e,n.role,n.name,t);case"xpath":return Vw(n.value)}}function Qp(n=typeof document!="undefined"?document:void 0,e=200){var r;if(!n)return[];let t=new Set;for(let s of on(n,"[data-scalebun-anchor]",!0)){let i=(r=s.getAttribute("data-scalebun-anchor"))==null?void 0:r.trim();if(i&&t.add(i),t.size>=e)break}return[...t].sort()}function pt(n,e=typeof document!="undefined"?document:void 0){let t=n.shadowPiercing!==!1,r=0;for(let s=0;s<n.strategies.length;s++){r++;let i=e?Ww(n.strategies[s],e,t):null;if(i)return{el:i,strategyIndex:s,strategiesTried:r}}return{el:null,strategyIndex:-1,strategiesTried:r}}function Zp(n){return n.el!=null&&n.strategyIndex>0}var Zr=E(()=>{"use strict"});function vo(n,e,t){switch(n){case"top":return e.y-t.y;case"bottom":return t.y+t.height-(e.y+e.height);case"left":return e.x-t.x;case"right":return t.x+t.width-(e.x+e.width)}}function ef(n,e,t,r,s){let i=(an(n)?t.height:t.width)+s;return vo(n,e,r)>=i}function es(n,e,t){return t<e?e:Math.min(t,Math.max(e,n))}function ts(n){var h,g,S,v;let e=(h=n.offset)!=null?h:8,t=(g=n.padding)!=null?g:8,r=(S=n.arrowSize)!=null?S:8,s=n.anchor,i=n.tooltip,o=n.boundary,a=(v=n.preferred)!=null?v:{side:"bottom",align:"center"},c=a.side,l=!1;if(!ef(c,s,i,o,e)){let y=jw[c];(ef(y,s,i,o,e)||vo(y,s,o)>vo(c,s,o))&&(c=y,l=!0)}let u=a.align;n.rtl&&an(c)&&(u=u==="start"?"end":u==="end"?"start":"center");let d=0,p=0;an(c)?(p=c==="top"?s.y-i.height-e:s.y+s.height+e,d=u==="start"?s.x:u==="end"?s.x+s.width-i.width:s.x+s.width/2-i.width/2):(d=c==="left"?s.x-i.width-e:s.x+s.width+e,p=u==="start"?s.y:u==="end"?s.y+s.height-i.height:s.y+s.height/2-i.height/2);let f=!1;if(an(c)){let y=es(d,o.x+t,o.x+o.width-t-i.width);y!==d&&(f=!0,d=y)}else{let y=es(p,o.y+t,o.y+o.height-t-i.height);y!==p&&(f=!0,p=y)}let m={x:0,y:0};return an(c)?(m.x=es(s.x+s.width/2-d,r,i.width-r),m.y=c==="top"?i.height:0):(m.y=es(s.y+s.height/2-p,r,i.height-r),m.x=c==="left"?i.width:0),{placement:{side:c,align:u},x:d,y:p,arrow:m,flipped:l,shifted:f}}var jw,an,wo=E(()=>{"use strict";jw={top:"bottom",bottom:"top",left:"right",right:"left"},an=n=>n==="top"||n==="bottom"});var tt,ns=E(()=>{"use strict";tt=class{constructor(){this.mo=null;this.subs=new Set;this.scheduled=!1}start(){this.mo||typeof MutationObserver=="undefined"||typeof document=="undefined"||(this.mo=new MutationObserver(()=>this.notify()),this.mo.observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0}))}onChange(e){return this.subs.add(e),this.start(),()=>{this.subs.delete(e),this.subs.size||this.dispose()}}notify(){this.scheduled||(this.scheduled=!0,queueMicrotask(()=>{this.scheduled=!1;for(let e of[...this.subs])try{e()}catch{}}))}dispose(){var e;(e=this.mo)==null||e.disconnect(),this.mo=null,this.subs.clear()}}});function Kw(){return{x:0,y:0,width:typeof innerWidth!="undefined"?innerWidth:1024,height:typeof innerHeight!="undefined"?innerHeight:768}}function $e(n){let e=[{kind:"selector",value:n}],t=n.match(/^\[data-scalebun-anchor=["']?([^"'\]]+)["']?\]$/);return t&&e.push({kind:"data-attr",value:t[1]}),{strategies:e,shadowPiercing:!0}}function tf(n){var r,s,i,o;let e=(r=n==null?void 0:n.strategies)!=null?r:[],t=(s=e.find(a=>a.kind==="selector"))!=null?s:e[0];if(!t)return"";switch(t.kind){case"selector":case"data-attr":case"text":case"xpath":return t.value;case"nth":return`${t.selector}[${t.index}]`;case"aria":return`aria:${(i=t.role)!=null?i:"*"}/${(o=t.name)!=null?o:"*"}`}}var Me,Ft=E(()=>{"use strict";Zr();wo();ns();Me=class{constructor(e){this.opts=e;this.raf=null;this.lostTimer=null;this.lastStrategy=-1;this.hadEl=!1;this.missed=!1;var t,r;this.hub=(t=e.hub)!=null?t:new tt,this.ownHub=!e.hub,this.now=(r=e.now)!=null?r:()=>Date.now()}start(){this.reposition(),this.unsubMo=this.hub.onChange(()=>this.reposition()),this.onScrollResize=()=>this.schedule(),typeof window!="undefined"&&(window.addEventListener("scroll",this.onScrollResize,!0),window.addEventListener("resize",this.onScrollResize))}reposition(){var t,r,s,i,o,a;let e=pt(this.opts.spec);if(e.el){this.clearLost(),this.hadEl||(r=(t=this.opts.hooks).onFound)==null||r.call(t,e.el),Zp(e)&&e.strategyIndex!==this.lastStrategy&&((i=(s=this.opts.hooks).onHeal)==null||i.call(s,e.strategyIndex)),this.lastStrategy=e.strategyIndex,this.hadEl=!0,this.missed=!1;let c=e.el.getBoundingClientRect(),l=ts({anchor:{x:c.x,y:c.y,width:c.width,height:c.height},tooltip:this.opts.size(),boundary:Kw(),preferred:this.opts.preferred,offset:this.opts.offset});this.opts.hooks.onReposition(l,e.el)}else this.missed||(this.missed=!0,(a=(o=this.opts.hooks).onMiss)==null||a.call(o)),this.hadEl=!1,this.armLost()}schedule(){if(this.raf!=null)return;let e=()=>{this.raf=null,this.reposition()};this.raf=typeof requestAnimationFrame!="undefined"?requestAnimationFrame(e):setTimeout(e,16)}armLost(){var e;this.lostTimer==null&&(this.lostTimer=setTimeout(()=>{var t,r;this.lostTimer=null,pt(this.opts.spec).el==null&&(this.hadEl=!1,(r=(t=this.opts.hooks).onLost)==null||r.call(t,"not-found"))},(e=this.opts.graceMs)!=null?e:1500))}clearLost(){this.lostTimer!=null&&(clearTimeout(this.lostTimer),this.lostTimer=null)}stop(){var e;(e=this.unsubMo)==null||e.call(this),this.unsubMo=void 0,this.onScrollResize&&typeof window!="undefined"&&(window.removeEventListener("scroll",this.onScrollResize,!0),window.removeEventListener("resize",this.onScrollResize)),this.onScrollResize=void 0,this.raf!=null&&typeof cancelAnimationFrame!="undefined"&&cancelAnimationFrame(this.raf),this.raf=null,this.clearLost(),this.ownHub&&this.hub.dispose()}}});var nf={};L(nf,{popoverSurface:()=>Yw});function Gw(n){var e,t,r;return(r=(e=n.variant.targeting)==null?void 0:e.element)!=null?r:(t=n.variant.triggers.find(s=>(s.type==="element"||s.type==="hover")&&s.match))==null?void 0:t.match}function Xw(n){var t;let e=(t=n.variant.surfaceOptions)==null?void 0:t.placement;return e==="top"||e==="left"||e==="right"?e:"bottom"}function Yw(n){var c,l,u,d,p;let{doc:e,variant:t}=n,r=Gw(n),s=e.createElement("div");s.className="scalebun-popover",s.setAttribute("role",(l=(c=t.a11y)==null?void 0:c.role)!=null?l:"dialog"),s.setAttribute("aria-label",t.name),s.style.position="absolute";let i=(u=t.surfaceOptions)==null?void 0:u.maxWidth;if(i&&(s.style.maxWidth=`${i}px`),((d=t.dismiss)==null?void 0:d.xButton)!==!1){let f=e.createElement("button");f.type="button",f.className="scalebun-x scalebun-pop-x",f.setAttribute("aria-label","Dismiss"),f.textContent="\xD7",f.addEventListener("click",()=>n.requestClose("x")),s.appendChild(f)}let o=e.createElement("div");o.className="scalebun-pop-body";for(let f of oe(n))o.appendChild(f);s.appendChild(o);let a=r?new Me({spec:$e(r),size:()=>({width:s.offsetWidth||320,height:s.offsetHeight||120}),preferred:{side:Xw(n),align:"center"},offset:(p=t.surfaceOptions)==null?void 0:p.offset,hooks:{onReposition:f=>{s.style.top=`${f.y}px`,s.style.left=`${f.x}px`,s.setAttribute("data-placement",f.placement.side)},onHeal:()=>{var f;return(f=n.metrics)==null?void 0:f.recordAnchorRetry()},onMiss:()=>{var f;return(f=n.metrics)==null?void 0:f.recordFailedSelector(r)},onLost:()=>n.requestClose("auto")}}):null;return{el:s,afterMount:()=>a==null?void 0:a.start(),destroy:()=>{a==null||a.stop(),s.remove()}}}var rf=E(()=>{"use strict";Te();Ft()});var sf={};L(sf,{coachmarkSurface:()=>Zw});function Jw(n){var e,t,r;return(r=(e=n.variant.targeting)==null?void 0:e.element)!=null?r:(t=n.variant.triggers.find(s=>(s.type==="element"||s.type==="hover")&&s.match))==null?void 0:t.match}function Qw(n){var t;let e=(t=n.variant.surfaceOptions)==null?void 0:t.placement;return e==="top"||e==="left"||e==="right"?e:"bottom"}function Zw(n){var p,f,m,h,g,S;let{doc:e,variant:t}=n,r=Jw(n),s=((p=t.surfaceOptions)==null?void 0:p.spotlight)!==!1,i=e.createElement("div");i.className="scalebun-coach-root";let o=s?e.createElement("div"):null;o&&(o.className="scalebun-coach-spot",i.appendChild(o));let a=e.createElement("div");a.className="scalebun-coachmark",a.setAttribute("role",(m=(f=t.a11y)==null?void 0:f.role)!=null?m:"dialog"),a.setAttribute("aria-label",t.name),a.style.position="absolute";let c=(h=t.surfaceOptions)==null?void 0:h.maxWidth;if(c&&(a.style.maxWidth=`${c}px`),((g=t.dismiss)==null?void 0:g.xButton)!==!1){let v=e.createElement("button");v.type="button",v.className="scalebun-x scalebun-pop-x",v.setAttribute("aria-label","Dismiss"),v.textContent="\xD7",v.addEventListener("click",()=>n.requestClose("x")),a.appendChild(v)}let l=e.createElement("div");l.className="scalebun-pop-body";for(let v of oe(n))l.appendChild(v);a.appendChild(l),i.appendChild(a);let u=6,d=r?new Me({spec:$e(r),size:()=>({width:a.offsetWidth||300,height:a.offsetHeight||120}),preferred:{side:Qw(n),align:"center"},offset:(S=t.surfaceOptions)==null?void 0:S.offset,hooks:{onReposition:(v,y)=>{if(a.style.top=`${v.y}px`,a.style.left=`${v.x}px`,a.setAttribute("data-placement",v.placement.side),o){let b=y.getBoundingClientRect();o.style.top=`${b.y-u}px`,o.style.left=`${b.x-u}px`,o.style.width=`${b.width+u*2}px`,o.style.height=`${b.height+u*2}px`}},onHeal:()=>{var v;return(v=n.metrics)==null?void 0:v.recordAnchorRetry()},onMiss:()=>{var v;return(v=n.metrics)==null?void 0:v.recordFailedSelector(r)},onLost:v=>{var y;(y=n.metrics)==null||y.recordFailedSelector(r),n.hooks.onInteraction(`anchor-lost:${v}`),n.requestClose("auto")}}}):null;return{el:i,afterMount:()=>d==null?void 0:d.start(),destroy:()=>{d==null||d.stop(),i.remove()}}}var of=E(()=>{"use strict";Te();Ft()});function Dt(n,e){var i,o,a,c;if("all"in n)return n.all.every(l=>Dt(l,e));if("any"in n)return n.any.some(l=>Dt(l,e));if("not"in n)return!Dt(n.not,e);if("flag"in n)return!!((i=e.flags)!=null&&i[n.flag])===((o=n.is)!=null?o:!0);let t=(a=e.props)==null?void 0:a[n.prop],r=(c=n.op)!=null?c:"exists",s=typeof t=="number"&&typeof n.value=="number";switch(r){case"exists":return t!=null;case"eq":return t===n.value;case"ne":return t!==n.value;case"gt":return s&&t>n.value;case"lt":return s&&t<n.value;case"gte":return s&&t>=n.value;case"lte":return s&&t<=n.value;case"in":return Array.isArray(n.value)&&n.value.includes(t);default:return!1}}function af(n,e){if(typeof n=="string")return n;if(Array.isArray(n)){for(let t of n)if(!t.when||Dt(t.when,e))return t.to}return null}var cf=E(()=>{"use strict"});var qt,xo=E(()=>{"use strict";cf();qt=class{constructor(e){this.deps=e;this.tour=null;this.index=0;this.status="idle";this.startedAt=0;this.token=0;this.stepCleanup=null;this.pendingEvent=null;this.context={}}get state(){var e,t;return{tourId:(t=(e=this.tour)==null?void 0:e.id)!=null?t:null,index:this.index,status:this.status}}start(e,t){var s,i,o,a,c;this.status==="running"&&this.end("abandoned","superseded"),this.tour=e,this.context=(s=t==null?void 0:t.context)!=null?s:{},this.status="running",this.startedAt=this.deps.now();let r=!!(t!=null&&t.resume);this.index=r&&(a=(o=(i=this.deps).loadIndex)==null?void 0:o.call(i,e.id))!=null?a:0,(this.index>=e.steps.length||this.index<0)&&(this.index=0),this.deps.emit("$coachmark_tour_started",{tourId:e.id,version:(c=e.version)!=null?c:1,resumed:r&&this.index>0,steps:e.steps.length}),this.enter(this.index)}next(){this.status==="running"&&this.completeStep("next")}back(){if(this.status==="running"&&this.index>0){let e=this.tour.steps[this.index];this.deps.emit("$coachmark_step_back",{tourId:this.tour.id,stepId:e.id,index:this.index}),this.enter(this.index-1)}}skip(){if(this.status!=="running")return;let e=this.tour.steps[this.index];this.deps.emit("$coachmark_step_skipped",{tourId:this.tour.id,stepId:e.id,index:this.index,bySystem:!1}),this.enter(this.index+1)}notify(e){this.status==="running"&&this.pendingEvent===e&&this.completeStep("event")}end(e="abandoned",t="api"){var s,i,o;if(this.status!=="running")return;let r=this.tour;if(this.clearStep(),this.status=e,this.deps.hide(),(i=(s=this.deps).persist)==null||i.call(s,r.id,-1),e==="completed")this.deps.emit("$coachmark_tour_completed",{tourId:r.id,version:(o=r.version)!=null?o:1,steps:r.steps.length,totalMs:this.deps.now()-this.startedAt});else{let a=r.steps[this.index];this.deps.emit("$coachmark_tour_abandoned",{tourId:r.id,stepId:a==null?void 0:a.id,index:this.index,method:t})}}async enter(e){var o,a,c,l;this.clearStep();let t=this.tour;if(!t||this.status!=="running")return;if(e>=t.steps.length)return this.end("completed");this.index=e;let r=++this.token,s=t.steps[e];if(s.skipIf&&Dt(s.skipIf,this.context))return this.deps.emit("$coachmark_step_skipped",{tourId:t.id,stepId:s.id,index:e,bySystem:!0,reason:"skipIf"}),void this.enter(e+1);(a=(o=this.deps).persist)==null||a.call(o,t.id,e);let i=null;if(s.anchor){let u=(c=s.waitConditions)!=null?c:["exists","visible"],d=()=>this.deps.resolveAnchor(s.anchor).el,p=await this.deps.waitFor(d,{conditions:u,timeoutMs:(l=s.timeoutMs)!=null?l:5e3},this.deps.hub);if(r!==this.token||this.status!=="running")return;if(!p.ok)return this.deps.emit("$coachmark_anchor_failed",{tourId:t.id,stepId:s.id,index:e,reason:p.reason,strategiesTried:this.deps.resolveAnchor(s.anchor).strategiesTried}),this.applyFallback(s,e);let f=this.deps.resolveAnchor(s.anchor);f.strategyIndex>0&&this.deps.emit("$coachmark_anchor_healed",{tourId:t.id,stepId:s.id,index:e,winningStrategy:f.strategyIndex}),i=p.el}this.paint(s,i,e,!1)}applyFallback(e,t){var s;let r=(s=e.fallback)!=null?s:"modal";if(this.deps.emit("$coachmark_step_fallback",{tourId:this.tour.id,stepId:e.id,index:t,fallback:r,reason:"anchor-fail"}),r==="skip")return void this.enter(t+1);if(r==="end")return this.end("abandoned","anchor-fail");this.paint(e,null,t,!0)}paint(e,t,r,s){this.deps.render({step:e,el:t,index:r,total:this.tour.steps.length,degraded:s,controls:this.controls()}),this.deps.emit("$coachmark_step_entered",{tourId:this.tour.id,stepId:e.id,index:r,anchored:!!t,degraded:s}),this.armAdvance(e,t)}armAdvance(e,t){var s;let r=(s=e.advance)!=null?s:"next";if(this.pendingEvent=null,r!=="next")if(r==="anchor-click"&&t){let i=()=>this.completeStep("click");t.addEventListener("click",i,{once:!0}),this.stepCleanup=()=>t.removeEventListener("click",i)}else if(r==="anchor-gone"&&e.anchor){let i=this.token,o=()=>this.deps.resolveAnchor(e.anchor).el;this.deps.waitFor(o,{conditions:["gone"],timeoutMs:36e5},this.deps.hub).then(a=>{a.ok&&i===this.token&&this.status==="running"&&this.completeStep("gone")})}else if(typeof r=="object"&&"timer"in r){let i=setTimeout(()=>this.completeStep("timer"),r.timer);this.stepCleanup=()=>clearTimeout(i)}else typeof r=="object"&&"event"in r&&(this.pendingEvent=r.event)}completeStep(e){if(this.status!=="running"||!this.tour)return;let t=this.tour.steps[this.index];this.deps.emit("$coachmark_step_completed",{tourId:this.tour.id,stepId:t.id,index:this.index,advanceBy:e});let r=af(t.next,this.context);if(r){let s=this.tour.steps.findIndex(i=>i.id===r);if(s>=0)return this.deps.emit("$coachmark_branched",{tourId:this.tour.id,fromStep:t.id,toStep:r,index:s}),void this.enter(s)}this.enter(this.index+1)}controls(){return{next:()=>this.next(),back:()=>this.back(),skip:()=>this.skip(),close:()=>this.end("abandoned","dismiss")}}clearStep(){var e;(e=this.stepCleanup)==null||e.call(this),this.stepCleanup=null,this.pendingEvent=null,this.token++}dispose(){this.clearStep(),this.status="idle",this.tour=null}}});function ko(n,e){let t=n.width*n.height;if(t<=0)return 0;let r=Math.max(0,Math.min(n.x+n.width,e.x+e.width)-Math.max(n.x,e.x)),s=Math.max(0,Math.min(n.y+n.height,e.y+e.height)-Math.max(n.y,e.y));return r*s/t}function So(n){let e=n.getBoundingClientRect();return{x:e.left,y:e.top,width:e.width,height:e.height}}function lf(n){if(n)return n;let e=typeof window!="undefined"?window.innerWidth:0,t=typeof window!="undefined"?window.innerHeight:0;return{x:0,y:0,width:e,height:t}}function df(n){if(n.disabled)return!1;let e=n.getBoundingClientRect();if(e.width===0||e.height===0)return!1;let t=typeof document!="undefined"&&document.elementFromPoint?document.elementFromPoint(e.left+e.width/2,e.top+e.height/2):null;return t?n===t||n.contains(t)||t.contains(n):!1}function ex(n,e,t,r){var s,i;if(e.conditions.includes("gone"))return n==null;if(!n||e.conditions.includes("visible")&&ko(So(n),lf(e.boundary))<((s=e.minVisibleRatio)!=null?s:.5)||e.conditions.includes("clickable")&&!df(n))return!1;if(e.conditions.includes("stable")){let o=JSON.stringify(So(n));if(o!==t.v)return t.v=o,r.n=0,!1;if(r.n+=1,r.n<((i=e.stableFrames)!=null?i:2))return!1}return!0}function tx(n,e){var t;return e.conditions.includes("gone")?"timeout":n?e.conditions.includes("visible")&&ko(So(n),lf(e.boundary))<((t=e.minVisibleRatio)!=null?t:.5)?"not-visible":e.conditions.includes("clickable")&&!df(n)?"not-clickable":"timeout":"not-found"}function rs(n,e,t){return new Promise(r=>{var p,f;let s=!1,i=()=>{},o,a,c={v:""},l={n:0},u=(m,h,g)=>{s||(s=!0,i(),o&&clearTimeout(o),a&&clearInterval(a),r({ok:m,el:h,reason:g}))},d=()=>{if(s)return;let m=n();ex(m,e,c,l)&&u(!0,e.conditions.includes("gone")?null:m)};i=t.onChange(d),a=setInterval(d,(p=e.pollMs)!=null?p:100),o=setTimeout(()=>{let m=n();u(!1,m,tx(m,e))},(f=e.timeoutMs)!=null?f:5e3),d()})}var ss=E(()=>{"use strict"});var uf={};L(uf,{tourSurface:()=>rx});function nx(n){var t;let e=n.placement==="top"||n.placement==="left"||n.placement==="right"?n.placement:"bottom";return{id:n.id,anchor:n.anchor?$e(n.anchor):void 0,title:n.title,body:n.body,placement:n.anchor?{side:e,align:"center"}:void 0,advance:(t=n.advance)!=null?t:"next",fallback:"modal"}}function rx(n){var u,d;let{doc:e,variant:t}=n,r=(d=(u=t.surfaceOptions)==null?void 0:u.steps)!=null?d:[],s=new tt,i=e.createElement("div");i.className="scalebun-tour-root";let o=()=>{},a=p=>{var x;let f=e.createElement("div");if(f.className="scalebun-coachmark scalebun-tour-card",f.setAttribute("role","dialog"),f.setAttribute("aria-label",(x=p.step.title)!=null?x:t.name),f.style.position=p.el?"absolute":"fixed",p.step.title){let I=e.createElement("h2");I.className="scalebun-h",I.textContent=p.step.title,f.appendChild(I)}if(p.step.body){let I=e.createElement("p");I.className="scalebun-text",I.textContent=p.step.body,f.appendChild(I)}let m=e.createElement("div");m.className="scalebun-tour-nav";let h=e.createElement("span");h.className="scalebun-tour-prog",h.textContent=`${p.index+1} / ${p.total}`,m.appendChild(h);let g=e.createElement("span");g.className="scalebun-tour-btns";let S=(I,k,C)=>{let M=e.createElement("button");return M.type="button",M.className=`scalebun-btn ${k}`,M.textContent=I,M.addEventListener("click",C),M};p.index>0&&g.appendChild(S("Back","scalebun-btn-ghost",p.controls.back)),g.appendChild(S("Skip","scalebun-btn-ghost",p.controls.skip)),g.appendChild(S(p.index+1>=p.total?"Done":"Next","scalebun-btn-primary",p.controls.next)),m.appendChild(g),f.appendChild(m);let v=e.createElement("button");v.type="button",v.className="scalebun-x scalebun-pop-x",v.setAttribute("aria-label","End tour"),v.textContent="\xD7",v.addEventListener("click",p.controls.close),f.appendChild(v),i.appendChild(f);let y=null,b=null,w=()=>{b==null||b.stop(),b=null,y==null||y.remove(),y=null,f.style.position="fixed",f.style.top="",f.style.left="",f.removeAttribute("data-placement"),f.classList.add("scalebun-tour-center")};if(p.el&&p.step.anchor){let I=tf(p.step.anchor);y=e.createElement("div"),y.className="scalebun-coach-spot",i.appendChild(y);let k=6;b=new Me({spec:p.step.anchor,size:()=>({width:f.offsetWidth||300,height:f.offsetHeight||120}),preferred:p.step.placement,hooks:{onReposition:(C,M)=>{f.style.top=`${C.y}px`,f.style.left=`${C.x}px`,f.setAttribute("data-placement",C.placement.side);let R=M.getBoundingClientRect();y.style.top=`${R.y-k}px`,y.style.left=`${R.x-k}px`,y.style.width=`${R.width+k*2}px`,y.style.height=`${R.height+k*2}px`},onHeal:()=>{var C;return(C=n.metrics)==null?void 0:C.recordAnchorRetry()},onMiss:()=>{var C;return(C=n.metrics)==null?void 0:C.recordFailedSelector(I)},onLost:C=>{var M;w(),(M=n.metrics)==null||M.recordFailedSelector(I),n.hooks.onInteraction(`anchor-lost:${C}`)}}}),b.start()}else f.classList.add("scalebun-tour-center");return()=>{b==null||b.stop(),y==null||y.remove(),f.remove()}},c=new qt({hub:s,resolveAnchor:pt,waitFor:rs,render:p=>{o(),o=a(p)},hide:()=>{o(),o=()=>{}},emit:p=>n.hooks.onInteraction(p),now:()=>Date.now(),persist:(p,f)=>{try{f<0?localStorage.removeItem(Eo(p)):localStorage.setItem(Eo(p),String(f))}catch{}},loadIndex:p=>{try{let f=localStorage.getItem(Eo(p));return f!=null?Number(f):void 0}catch{return}}}),l={id:t.id,version:1,steps:r.map(nx)};return{el:i,afterMount:()=>c.start(l,{resume:!0}),destroy:()=>{o(),c.dispose(),s.dispose(),i.remove()}}}var Eo,pf=E(()=>{"use strict";xo();Zr();ss();ns();Ft();Eo=n=>`scalebun_inapp_tour_${n}`});var ff={};L(ff,{hotspotSurface:()=>ox});function sx(n){var e,t,r;return(r=(e=n.variant.targeting)==null?void 0:e.element)!=null?r:(t=n.variant.triggers.find(s=>(s.type==="element"||s.type==="hover")&&s.match))==null?void 0:t.match}function ix(n){var t;let e=(t=n.variant.surfaceOptions)==null?void 0:t.placement;return e==="top"||e==="left"||e==="right"?e:"bottom"}function ox(n){let{doc:e,variant:t}=n,r=sx(n),s=e.createElement("div");s.className="scalebun-hotspot-root";let i=e.createElement("button");i.type="button",i.className="scalebun-beacon",i.setAttribute("aria-label",t.name),i.setAttribute("aria-expanded","false"),s.appendChild(i);let o=e.createElement("div");o.className="scalebun-beacon-card",o.setAttribute("role","tooltip"),o.hidden=!0;for(let d of oe(n))o.appendChild(d);s.appendChild(o);let a=!1,c=d=>{a!==d&&(a=d,o.hidden=!d,i.setAttribute("aria-expanded",String(d)),d&&n.hooks.onInteraction("hotspot_reveal"))};i.addEventListener("mouseenter",()=>c(!0)),i.addEventListener("focus",()=>c(!0)),i.addEventListener("click",()=>c(!a));let l=!1;o.addEventListener("mouseenter",()=>l=!0),o.addEventListener("mouseleave",()=>{l=!1,c(!1)}),i.addEventListener("mouseleave",()=>setTimeout(()=>!l&&c(!1),120));let u=r?new Me({spec:$e(r),size:()=>({width:o.offsetWidth||240,height:o.offsetHeight||90}),preferred:{side:ix(n),align:"center"},hooks:{onReposition:(d,p)=>{let f=p.getBoundingClientRect();i.style.top=`${f.y-5}px`,i.style.left=`${f.x+f.width-5}px`,o.style.top=`${d.y}px`,o.style.left=`${d.x}px`,o.setAttribute("data-placement",d.placement.side)},onHeal:()=>{var d;return(d=n.metrics)==null?void 0:d.recordAnchorRetry()},onMiss:()=>{var d;return(d=n.metrics)==null?void 0:d.recordFailedSelector(r)},onLost:d=>{var p;(p=n.metrics)==null||p.recordFailedSelector(r),n.hooks.onInteraction(`anchor-lost:${d}`),n.requestClose("auto")}}}):null;return{el:s,afterMount:()=>u==null?void 0:u.start(),destroy:()=>{u==null||u.stop(),s.remove()}}}var mf=E(()=>{"use strict";Te();Ft()});var hf={};L(hf,{toolbarSurface:()=>lx});function ax(n){var e,t,r;return(r=(e=n.variant.targeting)==null?void 0:e.element)!=null?r:(t=n.variant.triggers.find(s=>(s.type==="element"||s.type==="hover")&&s.match))==null?void 0:t.match}function cx(n){var t;let e=(t=n.variant.surfaceOptions)==null?void 0:t.placement;return e==="top"||e==="left"||e==="right"?e:"bottom"}function lx(n){var a,c,l,u;let{doc:e,variant:t}=n,r=ax(n),s=e.createElement("div");s.className="scalebun-toolbar-callout",s.setAttribute("role",(c=(a=t.a11y)==null?void 0:a.role)!=null?c:"dialog"),s.setAttribute("aria-label",t.name),s.style.position="absolute";let i=e.createElement("div");i.className="scalebun-pop-body";for(let d of oe(n))i.appendChild(d);if(s.appendChild(i),((l=t.dismiss)==null?void 0:l.xButton)!==!1){let d=e.createElement("button");d.type="button",d.className="scalebun-x scalebun-pop-x",d.setAttribute("aria-label","Dismiss"),d.textContent="\xD7",d.addEventListener("click",()=>n.requestClose("x")),s.appendChild(d)}let o=r?new Me({spec:$e(r),size:()=>({width:s.offsetWidth||220,height:s.offsetHeight||80}),preferred:{side:cx(n),align:"center"},offset:(u=t.surfaceOptions)==null?void 0:u.offset,hooks:{onReposition:d=>{s.style.top=`${d.y}px`,s.style.left=`${d.x}px`,s.setAttribute("data-placement",d.placement.side)},onHeal:()=>{var d;return(d=n.metrics)==null?void 0:d.recordAnchorRetry()},onMiss:()=>{var d;return(d=n.metrics)==null?void 0:d.recordFailedSelector(r)},onLost:()=>n.requestClose("auto")}}):null;return{el:s,afterMount:()=>o==null?void 0:o.start(),destroy:()=>{o==null||o.stop(),s.remove()}}}var gf=E(()=>{"use strict";Te();Ft()});var bf={};L(bf,{paletteSurface:()=>dx});function dx(n){var S,v,y;let{doc:e,variant:t}=n,r=(v=(S=t.surfaceOptions)==null?void 0:S.commands)!=null?v:[],s=Bt(e),i=e.createElement("div");i.className="scalebun-palette-backdrop";let o=e.createElement("div");o.className="scalebun-palette",o.setAttribute("role","dialog"),o.setAttribute("aria-label",t.name);let a=e.createElement("input");a.className="scalebun-palette-input",a.type="text",a.setAttribute("role","combobox"),a.setAttribute("aria-expanded","true"),a.placeholder="Type a command or search\u2026",o.appendChild(a);let c=e.createElement("ul");c.className="scalebun-palette-list",c.setAttribute("role","listbox"),o.appendChild(c),i.appendChild(o);let l=r.slice(),u=0,d=b=>{if(b){if(n.hooks.onCtaClick(b.action),n.hooks.onInteraction(`palette_select:${b.id}`),b.action==="link"&&b.value)try{typeof window!="undefined"&&window.location.assign(b.value)}catch{}n.requestClose("cta")}},p=()=>{if(c.replaceChildren(),l.length===0){let b=e.createElement("li");b.className="scalebun-palette-empty",b.textContent="No matches",c.appendChild(b);return}l.forEach((b,w)=>{let x=e.createElement("li");x.className="scalebun-palette-item"+(w===u?" active":""),x.setAttribute("role","option"),x.setAttribute("aria-selected",String(w===u));let I=e.createElement("span");if(I.className="scalebun-palette-label",I.textContent=b.label,x.appendChild(I),b.hint){let k=e.createElement("span");k.className="scalebun-palette-hint",k.textContent=b.hint,x.appendChild(k)}x.addEventListener("mousemove",()=>{u=w,f()}),x.addEventListener("click",()=>d(b)),c.appendChild(x)})},f=()=>{Array.from(c.children).forEach((b,w)=>{b.classList.toggle("active",w===u),b.setAttribute("aria-selected",String(w===u))})},m=()=>{let b=a.value.trim().toLowerCase();l=b?r.filter(w=>w.label.toLowerCase().includes(b)||w.action.toLowerCase().includes(b)):r.slice(),u=0,p()};a.addEventListener("input",m);let h=b=>{b.key==="Escape"?(b.stopPropagation(),n.requestClose("esc")):b.key==="ArrowDown"?(b.preventDefault(),u=Math.min(l.length-1,u+1),f()):b.key==="ArrowUp"?(b.preventDefault(),u=Math.max(0,u-1),f()):b.key==="Enter"&&(b.preventDefault(),d(l[u]))};o.addEventListener("keydown",h),((y=t.dismiss)==null?void 0:y.backdropClose)!==!1&&i.addEventListener("mousedown",b=>{b.target===i&&n.requestClose("backdrop")});let g=Nt(o,e);return p(),{el:i,afterMount:()=>a.focus(),destroy:()=>{g(),o.removeEventListener("keydown",h),i.remove(),s()}}}var yf=E(()=>{"use strict";Qr()});var vf={};L(vf,{panelSurface:()=>ux});function ux(n){var g,S,v,y,b,w;let{doc:e,variant:t}=n,r=((g=t.surfaceOptions)==null?void 0:g.placement)==="left",s=e.createElement("div");s.className="scalebun-panel "+(r?"scalebun-panel-left":"scalebun-panel-right"),s.setAttribute("role",(v=(S=t.a11y)==null?void 0:S.role)!=null?v:"complementary"),s.setAttribute("aria-label",t.name);let i=e.createElement("div");i.className="scalebun-panel-head";let o=e.createElement("div");if(o.className="scalebun-panel-title",o.textContent=t.name,i.appendChild(o),((y=t.dismiss)==null?void 0:y.xButton)!==!1){let x=e.createElement("button");x.type="button",x.className="scalebun-x",x.setAttribute("aria-label","Close panel"),x.textContent="\xD7",x.addEventListener("click",()=>n.requestClose("x")),i.appendChild(x)}s.appendChild(i);let a=e.createElement("div");a.className="scalebun-panel-thread",a.setAttribute("role","log"),a.setAttribute("aria-live","polite"),s.appendChild(a);let c=(w=(b=t.blocks.find(x=>x.kind==="text"))==null?void 0:b.props)==null?void 0:w.text;typeof c=="string"&&f("assistant",c);let l=e.createElement("form");l.className="scalebun-panel-composer";let u=e.createElement("textarea");u.className="scalebun-panel-input",u.rows=1,u.placeholder="Ask anything\u2026";let d=e.createElement("button");d.type="submit",d.className="scalebun-btn scalebun-btn-primary scalebun-panel-send",d.textContent="Send",l.append(u,d),s.appendChild(l);let p=null;function f(x,I){let k=e.createElement("div");return k.className=`scalebun-bubble scalebun-bubble-${x}`,k.textContent=I,a.appendChild(k),a.scrollTop=a.scrollHeight,k}let m=x=>{x.preventDefault();let I=u.value.trim();I&&(f("user",I),u.value="",n.hooks.onInteraction(`ai_prompt:${I}`),p=f("assistant",""),p.classList.add("streaming"))};l.addEventListener("submit",m);let h={appendAssistant:x=>{var I;p||(p=f("assistant","")),p.textContent=((I=p.textContent)!=null?I:"")+x,a.scrollTop=a.scrollHeight},endAssistant:()=>{p==null||p.classList.remove("streaming"),p=null}};return s.scalebunStream=h,{el:s,destroy:()=>{l.removeEventListener("submit",m),s.remove()}}}var wf=E(()=>{"use strict"});var Sf={};L(Sf,{checklistSurface:()=>px});function px(n){var w,x,I,k,C,M;let{doc:e,variant:t}=n,r=t.blocks.find(R=>R.kind==="checklist"),s=Array.isArray((w=r==null?void 0:r.props)==null?void 0:w.items)?r.props.items.map(R=>typeof R=="string"?{id:R,label:R}:R):[],i=(I=(x=t.blocks.find(R=>R.kind==="heading"))==null?void 0:x.props)==null?void 0:I.text,o=new Set;try{let R=localStorage.getItem(xf(t.id));if(R)for(let A of JSON.parse(R))o.add(A)}catch{}let a=()=>{try{localStorage.setItem(xf(t.id),JSON.stringify([...o]))}catch{}},c=e.createElement("div");c.className="scalebun-checklist",c.setAttribute("role",(C=(k=t.a11y)==null?void 0:k.role)!=null?C:"complementary"),c.setAttribute("aria-label",t.name);let l=e.createElement("div");l.className="scalebun-cl-head";let u=e.createElement("div");u.className="scalebun-cl-title",u.textContent=typeof i=="string"?i:t.name,l.appendChild(u);let d=e.createElement("button");d.type="button",d.className="scalebun-x scalebun-cl-dock",d.setAttribute("aria-label","Minimize"),d.textContent="\u2014";let p=!1;if(d.addEventListener("click",()=>{p=!p,c.classList.toggle("collapsed",p),d.textContent=p?"\u25A2":"\u2014"}),l.appendChild(d),((M=t.dismiss)==null?void 0:M.xButton)!==!1){let R=e.createElement("button");R.type="button",R.className="scalebun-x",R.setAttribute("aria-label","Dismiss"),R.textContent="\xD7",R.addEventListener("click",()=>n.requestClose("x")),l.appendChild(R)}c.appendChild(l);let f=e.createElement("div");f.className="scalebun-cl-bar";let m=e.createElement("div");m.className="scalebun-cl-fill",f.appendChild(m);let h=e.createElement("div");h.className="scalebun-cl-count",c.append(f,h);let g=e.createElement("ul");g.className="scalebun-cl-list",c.appendChild(g);let S=!1,v=()=>{let R=s.length||1,A=s.filter(O=>o.has(O.id)).length;m.style.width=`${Math.round(A/R*100)}%`,h.textContent=`${A} of ${s.length} complete`,g.replaceChildren();for(let O of s){let z=e.createElement("li");z.className="scalebun-cl-item"+(o.has(O.id)?" done":"");let D=e.createElement("button");D.type="button",D.className="scalebun-cl-check",D.setAttribute("role","checkbox"),D.setAttribute("aria-checked",String(o.has(O.id))),D.textContent=o.has(O.id)?"\u2713":"",D.addEventListener("click",()=>y(O.id));let te=e.createElement("span");te.className="scalebun-cl-label",te.textContent=O.label,z.append(D,te),g.appendChild(z)}A>=s.length&&s.length>0&&!S?(S=!0,c.classList.add("complete"),n.hooks.onInteraction("checklist_complete")):A<s.length&&(S=!1,c.classList.remove("complete"))},y=R=>{o.has(R)?o.delete(R):o.add(R),a(),n.hooks.onInteraction(`checklist_step:${R}`),v()},b=R=>{!o.has(R)&&s.some(A=>A.id===R)&&(o.add(R),a(),v())};return c.scalebunChecklist={completeStep:b},v(),{el:c,destroy:()=>c.remove()}}var xf,kf=E(()=>{"use strict";xf=n=>`scalebun_inapp_checklist_${n}`});var Ef={};L(Ef,{takeoverSurface:()=>mx});function mx(n){var m,h,g,S,v;let{doc:e,variant:t}=n,r=(m=t.a11y)!=null?m:{},s=(h=t.dismiss)!=null?h:{},i=Bt(e),o=e.createElement("div");o.className="scalebun-takeover",o.setAttribute("role",(g=r.role)!=null?g:"dialog"),o.setAttribute("aria-modal","true");let a=e.createElement("div");a.className="scalebun-takeover-inner";let c=oe(n),l=c.find(y=>y.classList.contains("scalebun-h"));if(l){let y=`scalebun-tk-${++fx}`;l.id=y,o.setAttribute("aria-labelledby",y)}else o.setAttribute("aria-label",t.name);if(s.xButton===!0){let y=e.createElement("button");y.type="button",y.className="scalebun-x scalebun-takeover-x",y.setAttribute("aria-label","Close"),y.textContent="\xD7",y.addEventListener("click",()=>n.requestClose("x")),a.appendChild(y)}for(let y of c)a.appendChild(y);o.appendChild(a);let u=y=>{y.key==="Escape"&&s.escClose===!0&&(y.stopPropagation(),n.requestClose("esc"))};o.addEventListener("keydown",u);let d=Nt(o,e),p=(v=(S=n.host.shadowRoot)==null?void 0:S.host)!=null?v:o,f=Jr(p,e);return{el:o,afterMount:()=>Yr(o),destroy:()=>{d(),f(),o.removeEventListener("keydown",u),o.remove(),i()}}}var fx,If=E(()=>{"use strict";Te();Qr();fx=0});var Cf={};L(Cf,{launcherSurface:()=>hx});function hx(n){var u,d,p,f;let{doc:e,variant:t}=n,r=(d=(u=t.surfaceOptions)==null?void 0:u.commands)!=null?d:[],s=(f=(p=t.blocks.find(m=>m.kind==="heading"||m.kind==="text"))==null?void 0:p.props)==null?void 0:f.text,i=e.createElement("div");i.className="scalebun-launcher";let o=e.createElement("div");o.className="scalebun-launcher-menu",o.setAttribute("role","menu"),o.hidden=!0;let a=e.createElement("button");a.type="button",a.className="scalebun-launcher-fab",a.setAttribute("aria-label",typeof s=="string"?s:t.name),a.setAttribute("aria-haspopup","true"),a.setAttribute("aria-expanded","false"),a.textContent="?";let c=!1,l=m=>{c=m,o.hidden=!m,a.setAttribute("aria-expanded",String(m)),a.textContent=m?"\xD7":"?"};a.addEventListener("click",()=>l(!c));for(let m of r){let h=e.createElement("button");h.type="button",h.className="scalebun-launcher-item",h.setAttribute("role","menuitem"),h.textContent=m.label,h.addEventListener("click",()=>{if(n.hooks.onCtaClick(m.action),n.hooks.onInteraction(`launcher_select:${m.id}`),m.action==="link"&&m.value)try{typeof window!="undefined"&&window.location.assign(m.value)}catch{}l(!1)}),o.appendChild(h)}return i.append(o,a),{el:i,destroy:()=>i.remove()}}var Af=E(()=>{"use strict"});var Mf={};L(Mf,{ShadowHost:()=>cn,applyThemeVars:()=>is,resolveScheme:()=>Tf});function Tf(n){if(n==="light"||n==="dark")return n;try{return typeof matchMedia!="undefined"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch{return"light"}}function is(n,e){let t=bx[Tf(e)];for(let[r,s]of Object.entries(t))n.style.setProperty(r,s)}var gx,Rf,bx,cn,os=E(()=>{"use strict";$();gx="scalebun-inapp-host",Rf=`
536
+ `});var Hu,ao,$u,zu,Uu,Vu,Wu,ju,Ku=k(()=>{"use strict";Hu=(n,e="")=>typeof n=="string"?n:n==null?e:String(n),ao=n=>Array.isArray(n)?n:[],$u=n=>ao(n).map(e=>typeof e=="string"?{id:e,label:e}:e),zu=(n,e)=>{let t=e.doc.createElement("div");t.className="scalebun-nps";for(let r=0;r<=10;r++){let s=e.doc.createElement("button");s.type="button",s.className="scalebun-nps-btn",s.textContent=String(r),s.addEventListener("click",()=>{var i;return(i=e.onInteraction)==null?void 0:i.call(e,`nps:${r}`)}),t.appendChild(s)}return t},Uu=(n,e)=>{var s;let t=Number((s=n.props)==null?void 0:s.max)||5,r=e.doc.createElement("div");r.className="scalebun-rating";for(let i=1;i<=t;i++){let o=e.doc.createElement("button");o.type="button",o.className="scalebun-star",o.setAttribute("aria-label",`${i} of ${t}`),o.textContent="\u2605",o.addEventListener("click",()=>{var a;Array.from(r.children).forEach((c,l)=>c.classList.toggle("on",l<i)),(a=e.onInteraction)==null||a.call(e,`rating:${i}`)}),r.appendChild(o)}return r},Vu=(n,e)=>{var s,i;let t=ao((s=n.props)==null?void 0:s.emojis).length?ao((i=n.props)==null?void 0:i.emojis):["\u{1F61E}","\u{1F610}","\u{1F642}","\u{1F604}"],r=e.doc.createElement("div");r.className="scalebun-emoji";for(let o of t){let a=e.doc.createElement("button");a.type="button",a.className="scalebun-emoji-btn",a.textContent=o,a.addEventListener("click",()=>{var c;return(c=e.onInteraction)==null?void 0:c.call(e,`emoji:${o}`)}),r.appendChild(a)}return r},Wu=(n,e)=>{var o,a,c,l,u;let t=e.doc.createElement("div");t.className="scalebun-poll";let r=Hu((o=n.props)==null?void 0:o.question);if(r){let d=e.doc.createElement("div");d.className="scalebun-poll-q",d.textContent=r,t.appendChild(d)}let s=(c=(a=n.props)==null?void 0:a.results)!=null?c:void 0,i=s?Object.values(s).reduce((d,p)=>d+p,0)||1:0;for(let d of $u((l=n.props)==null?void 0:l.options)){let p=e.doc.createElement("button");p.type="button",p.className="scalebun-poll-opt";let f=e.doc.createElement("span");if(f.className="scalebun-poll-label",f.textContent=d.label,p.appendChild(f),s){let m=Math.round(((u=s[d.id])!=null?u:0)/i*100),h=e.doc.createElement("span");h.className="scalebun-poll-bar",h.style.width=`${m}%`;let g=e.doc.createElement("span");g.className="scalebun-poll-pct",g.textContent=`${m}%`,p.append(h,g),p.disabled=!0}p.addEventListener("click",()=>{var m;return(m=e.onInteraction)==null?void 0:m.call(e,`poll_vote:${d.id}`)}),t.appendChild(p)}return t},ju=(n,e)=>{var c,l,u;let t=e.doc.createElement("div");t.className="scalebun-quiz";let r=Hu((c=n.props)==null?void 0:c.question);if(r){let d=e.doc.createElement("div");d.className="scalebun-poll-q",d.textContent=r,t.appendChild(d)}let s=(l=n.props)==null?void 0:l.outcome,i=new Map,o=!1,a=(d,p)=>{for(let[f,m]of i)m.disabled=!0,p&&f===p?m.classList.add("correct"):f===d&&f!==p&&m.classList.add("incorrect")};for(let d of $u((u=n.props)==null?void 0:u.options)){let p=e.doc.createElement("button");p.type="button",p.className="scalebun-quiz-opt",p.textContent=d.label,i.set(d.id,p),p.addEventListener("click",()=>{var f;if((f=e.onInteraction)==null||f.call(e,`quiz_answer:${d.id}`),!(!e.requestOutcome||o)){o=!0;for(let m of i.values())m.disabled=!0;e.requestOutcome(1,{answeredId:d.id}).then(m=>{var g,S;if(!m.ok){o=!1;for(let y of i.values())y.disabled=!1;let v=e.doc.createElement("div");v.className="scalebun-quiz-note",v.textContent=(g=m.message)!=null?g:"Could not check that answer.",t.appendChild(v);return}let h=(S=m.state)!=null?S:{};a(d.id,typeof h.correctId=="string"?h.correctId:void 0)})}}),t.appendChild(p)}return s!=null&&s.answeredId&&a(s.answeredId,s.correctId),t}});function Xu(n,e,t){e.split(`
537
+ `).forEach((s,i)=>{i>0&&n.appendChild(t.createElement("br")),n.appendChild(t.createTextNode(s))})}function zr(n,e){let t=[];for(let r of n){let s=$r[r.kind];if(s)try{let i=s(r,e);i&&t.push(i)}catch{}}return t}var ye,ve,Kv,Gv,Xv,Gu,Yv,Jv,Qv,Zv,ew,tw,nw,rw,sw,$r,Ur=k(()=>{"use strict";Ku();ye=(n,e="")=>typeof n=="string"?n:n==null?e:String(n);ve=(n,e,t)=>{let r=n.createElement(e);return r.className=t,r},Kv=(n,e)=>{var r;let t=ve(e.doc,"h2","scalebun-h");return t.textContent=ye((r=n.props)==null?void 0:r.text),t},Gv=(n,e)=>{var r;let t=ve(e.doc,"p","scalebun-text");return Xu(t,ye((r=n.props)==null?void 0:r.text),e.doc),t},Xv=(n,e)=>{var r,s,i;let t=ve(e.doc,"div","scalebun-rich");return Xu(t,ye((i=(r=n.props)==null?void 0:r.text)!=null?i:(s=n.props)==null?void 0:s.markdown),e.doc),t},Gu=(n,e)=>{var s,i;let t=e.doc.createElement("img");t.className="scalebun-img";let r=ye((s=n.props)==null?void 0:s.src);return r?(t.src=r,t.alt=ye((i=n.props)==null?void 0:i.alt),t.loading="lazy",t.decoding="async",t):null},Yv=(n,e)=>{var s;let t=Array.isArray((s=n.props)==null?void 0:s.items)?n.props.items:[];if(t.length===0)return null;let r=ve(e.doc,"ul","scalebun-checklist");return r.setAttribute("role","list"),t.forEach((i,o)=>{var f,m;let a=i&&typeof i=="object"?i:{},c=typeof i=="string"?i:ye((m=(f=a.label)!=null?f:a.text)!=null?m:a.title),l=a.done===!0||a.checked===!0||a.complete===!0,u=e.doc.createElement("li");u.className="scalebun-checklist-item",u.setAttribute("data-done",l?"true":"false");let d=e.doc.createElement("span");d.className="scalebun-checklist-mark",d.setAttribute("aria-hidden","true"),d.textContent=l?"\u2713":"";let p=e.doc.createElement("span");p.className="scalebun-checklist-label",p.textContent=c,u.appendChild(d),u.appendChild(p),u.setAttribute("aria-label",`${c} \u2014 ${l?"done":"not done"}`),u.addEventListener("click",()=>{var h;return(h=e.onInteraction)==null?void 0:h.call(e,`checklist_item:${o}`)}),r.appendChild(u)}),r},Jv=(n,e)=>{var s;let t=Array.isArray((s=n.props)==null?void 0:s.items)?n.props.items:[];if(t.length===0)return null;let r=ve(e.doc,"ul","scalebun-list");return t.forEach((i,o)=>{var l;let a=e.doc.createElement("li"),c=typeof i=="string"?i:ye((l=i==null?void 0:i.text)!=null?l:i==null?void 0:i.label);a.textContent=c,a.addEventListener("click",()=>{var u;return(u=e.onInteraction)==null?void 0:u.call(e,`list_item:${o}`)}),r.appendChild(a)}),r},Qv=(n,e)=>{var s,i;let t=ve(e.doc,"div","scalebun-callout");if((s=n.props)!=null&&s.icon){let o=ve(e.doc,"span","scalebun-callout-ic");o.textContent=ye(n.props.icon),t.appendChild(o)}let r=ve(e.doc,"span","scalebun-callout-t");return r.textContent=ye((i=n.props)==null?void 0:i.text),t.appendChild(r),t},Zv=(n,e)=>{var r;let t=ve(e.doc,"span","scalebun-badge");return t.textContent=ye((r=n.props)==null?void 0:r.text),t},ew=(n,e)=>{var i;let t=Math.max(0,Math.min(100,Number((i=n.props)==null?void 0:i.value)||0)),r=ve(e.doc,"div","scalebun-progress"),s=ve(e.doc,"div","scalebun-progress-fill");return s.style.width=`${t}%`,r.appendChild(s),r},tw=(n,e)=>ve(e.doc,"hr","scalebun-divider"),nw=(n,e)=>{var s;let t=ve(e.doc,"div","scalebun-spacer"),r=Number((s=n.props)==null?void 0:s.height);return!Number.isNaN(r)&&r>0&&(t.style.height=`${r}px`),t},rw=new Set(["primary","secondary","link","ghost","dismiss"]),sw=(n,e)=>{var s;let t=Array.isArray((s=n.props)==null?void 0:s.actions)?n.props.actions:[];if(t.length===0)return null;let r=ve(e.doc,"div","scalebun-cta-row");for(let i of t){let o=rw.has(ye(i.variant))?ye(i.variant):"primary",a=e.doc.createElement("button");a.type="button",a.className=`scalebun-btn scalebun-btn-${o}`,a.textContent=ye(i.label,"OK"),a.setAttribute("data-action",ye(i.action,"dismiss")),a.addEventListener("click",()=>e.onAction({...i,variant:o})),r.appendChild(a)}return r},$r={heading:Kv,text:Gv,richtext:Xv,image:Gu,illustration:Gu,list:Jv,checklist:Yv,callout:Qv,badge:Zv,progress:ew,divider:tw,spacer:nw,cta:sw,nps:zu,rating:Uu,emoji:Vu,poll:Wu,quiz:ju}});async function Yu(n){var e;try{if(typeof navigator!="undefined"&&((e=navigator.clipboard)!=null&&e.writeText))return await navigator.clipboard.writeText(n),!0}catch{}try{if(typeof document=="undefined")return!1;let t=document.createElement("textarea");t.value=n,t.style.position="fixed",t.style.opacity="0",t.setAttribute("aria-hidden","true"),document.body.appendChild(t),t.select();let r=typeof document.execCommand=="function"?document.execCommand("copy"):!1;return t.remove(),r}catch{return!1}}var Ju=k(()=>{"use strict"});function co(n){return{doc:n.doc,onInteraction:e=>n.hooks.onInteraction(e),...n.hooks.requestOutcome?{requestOutcome:n.hooks.requestOutcome}:{},onAction:e=>{if(e.action==="dismiss"){n.requestClose("cta");return}if(n.hooks.onCtaClick(e.action),e.action==="copy"&&e.deepLink){Yu(e.deepLink);return}if(e.action==="link"&&e.deepLink)try{typeof window!="undefined"&&window.location.assign(e.deepLink)}catch{}}}}function oe(n){return zr(n.variant.blocks,co(n))}function Vr(n,e,t=1e3){let r=!1,s=null,i=null,o=()=>{s!=null&&(clearTimeout(s),s=null)},a=()=>{r||(r=!0,o(),i==null||i.disconnect(),e())},c=()=>{s==null&&!r&&(s=setTimeout(a,t))};return typeof IntersectionObserver=="undefined"?(c(),()=>o()):(i=new IntersectionObserver(l=>{for(let u of l)u.isIntersecting&&u.intersectionRatio>=.5?c():o()},{threshold:[0,.5,1]}),i.observe(n),()=>{o(),i==null||i.disconnect()})}var Re=k(()=>{"use strict";Ur();Ju()});function Qu(n,e,t,r,s){var p;n.addStyles("scalebun-blocks",Hr),n.addStyles("scalebun-surfaces",Du);let i=n.zone(Lt(e)),o=i.ownerDocument,a=null,c=()=>{},l=!1,u=f=>{l||!a||(l=!0,c(),r.onDismiss(f),a.destroy())};return a=t({variant:e,host:n,doc:o,hooks:r,requestClose:u,metrics:s}),i.appendChild(a.el),(p=a.afterMount)==null||p.call(a),r.onImpression(),c=Vr(a.el,r.onView),{variantId:e.id,el:a.el,close:u}}var Zu=k(()=>{"use strict";qr();oo();qu();Re()});var ep={};L(ep,{markdownRenderer:()=>iw});function lo(n,e){var o;let t=[],r=/(\*\*([^*]+)\*\*)|(\*([^*]+)\*)|(`([^`]+)`)|(\[([^\]]+)\]\(([^)]+)\))/g,s=0,i;for(;i=r.exec(n);){if(i.index>s&&t.push(e.createTextNode(n.slice(s,i.index))),i[2])t.push(uo(e,"strong",i[2]));else if(i[4])t.push(uo(e,"em",i[4]));else if(i[6])t.push(uo(e,"code",i[6]));else if(i[8]){let a=e.createElement("a");a.textContent=i[8];let c=(o=i[9])!=null?o:"";/^(https?:|\/|#|mailto:)/i.test(c)&&(a.href=c,a.rel="noopener noreferrer",a.target="_blank"),t.push(a)}s=r.lastIndex}return s<n.length&&t.push(e.createTextNode(n.slice(s))),t}function uo(n,e,t){let r=n.createElement(e);return r.textContent=t,r}var iw,tp=k(()=>{"use strict";iw=(n,e)=>{var i,o;let t=typeof((i=n.props)==null?void 0:i.text)=="string"?n.props.text:typeof((o=n.props)==null?void 0:o.markdown)=="string"?n.props.markdown:"",r=e.doc.createElement("div");r.className="scalebun-md";let s=null;for(let a of t.split(`
538
+ `)){let c=a.trimEnd(),l=c.match(/^(#{1,4})\s+(.*)$/),u=c.match(/^\s*[-*]\s+(.*)$/);if(l){s=null;let d=e.doc.createElement(`h${l[1].length}`);d.className="scalebun-md-h",lo(l[2],e.doc).forEach(p=>d.appendChild(p)),r.appendChild(d)}else if(u){s||(s=e.doc.createElement("ul"),s.className="scalebun-md-ul",r.appendChild(s));let d=e.doc.createElement("li");lo(u[1],e.doc).forEach(p=>d.appendChild(p)),s.appendChild(d)}else if(c){s=null;let d=e.doc.createElement("p");d.className="scalebun-md-p",lo(c,e.doc).forEach(p=>d.appendChild(p)),r.appendChild(d)}else s=null}return r}});var np={};L(np,{codeRenderer:()=>ow});var ow,rp=k(()=>{"use strict";ow=(n,e)=>{var u,d,p;let t=typeof((u=n.props)==null?void 0:u.code)=="string"?n.props.code:typeof((d=n.props)==null?void 0:d.text)=="string"?n.props.text:"",r=typeof((p=n.props)==null?void 0:p.language)=="string"?n.props.language:"",s=e.doc.createElement("div");s.className="scalebun-code";let i=e.doc.createElement("div");i.className="scalebun-code-bar";let o=e.doc.createElement("span");o.className="scalebun-code-lang",o.textContent=r||"code";let a=e.doc.createElement("button");a.type="button",a.className="scalebun-code-copy",a.textContent="Copy",a.addEventListener("click",async()=>{var m,h,g;let f=!1;try{typeof navigator!="undefined"&&navigator.clipboard&&(await navigator.clipboard.writeText(t),f=!0)}catch{f=!1}if(!f){let S=e.doc.createRange();S.selectNodeContents(c);let v=(h=(m=e.doc).getSelection)==null?void 0:h.call(m);v==null||v.removeAllRanges(),v==null||v.addRange(S)}a.textContent=f?"Copied":"Select all",(g=e.onInteraction)==null||g.call(e,"code_copy"),setTimeout(()=>a.textContent="Copy",1500)}),i.append(o,a);let c=e.doc.createElement("pre");c.className="scalebun-code-pre";let l=e.doc.createElement("code");return l.textContent=t,c.appendChild(l),s.append(i,c),s}});var Wr={};L(Wr,{chartRenderer:()=>lw,sparklineRenderer:()=>aw,statRenderer:()=>cw});function ip(n,e,t){let r=n.createElementNS(po,"svg");return r.setAttribute("viewBox",`0 0 ${e} ${t}`),r.setAttribute("width",String(e)),r.setAttribute("height",String(t)),r}var po,sp,aw,cw,lw,jr=k(()=>{"use strict";po="http://www.w3.org/2000/svg",sp=n=>Array.isArray(n)?n.map(Number).filter(e=>Number.isFinite(e)):[];aw=(n,e)=>{var p;let t=sp((p=n.props)==null?void 0:p.values),r=e.doc.createElement("div");if(r.className="scalebun-spark",t.length<2)return r;let s=160,i=40,o=Math.min(...t),c=Math.max(...t)-o||1,l=t.map((f,m)=>`${m/(t.length-1)*s},${i-(f-o)/c*(i-4)-2}`).join(" "),u=ip(e.doc,s,i),d=e.doc.createElementNS(po,"polyline");return d.setAttribute("points",l),d.setAttribute("fill","none"),d.setAttribute("stroke","var(--scalebun-accent)"),d.setAttribute("stroke-width","2"),d.setAttribute("stroke-linejoin","round"),u.appendChild(d),r.appendChild(u),r},cw=(n,e)=>{var i,o,a,c;let t=e.doc.createElement("div");t.className="scalebun-stat";let r=e.doc.createElement("div");if(r.className="scalebun-stat-value",r.textContent=String((o=(i=n.props)==null?void 0:i.value)!=null?o:"\u2014"),t.appendChild(r),((a=n.props)==null?void 0:a.label)!=null){let l=e.doc.createElement("div");l.className="scalebun-stat-label",l.textContent=String(n.props.label),t.appendChild(l)}let s=(c=n.props)==null?void 0:c.delta;if(s!=null){let l=e.doc.createElement("div"),u=Number(s);l.className="scalebun-stat-delta "+(u>=0?"up":"down"),l.textContent=`${u>=0?"\u25B2":"\u25BC"} ${Math.abs(u)}`,t.appendChild(l)}return t},lw=(n,e)=>{var l;let t=sp((l=n.props)==null?void 0:l.values),r=e.doc.createElement("div");if(r.className="scalebun-chart",t.length===0)return r;let s=240,i=100,o=Math.max(...t)||1,a=s/t.length,c=ip(e.doc,s,i);return t.forEach((u,d)=>{let p=e.doc.createElementNS(po,"rect"),f=u/o*(i-4);p.setAttribute("x",String(d*a+2)),p.setAttribute("y",String(i-f)),p.setAttribute("width",String(a-4)),p.setAttribute("height",String(f)),p.setAttribute("rx","2"),p.setAttribute("fill","var(--scalebun-accent)"),c.appendChild(p)}),r.appendChild(c),r}});var op={};L(op,{tableRenderer:()=>dw});var dw,ap=k(()=>{"use strict";dw=(n,e)=>{var o,a;let t=Array.isArray((o=n.props)==null?void 0:o.columns)?n.props.columns.map(String):[],r=Array.isArray((a=n.props)==null?void 0:a.rows)?n.props.rows:[],s=e.doc.createElement("table");if(s.className="scalebun-table",t.length){let c=e.doc.createElement("thead"),l=e.doc.createElement("tr");for(let u of t){let d=e.doc.createElement("th");d.textContent=u,l.appendChild(d)}c.appendChild(l),s.appendChild(c)}let i=e.doc.createElement("tbody");for(let c of r){let l=e.doc.createElement("tr");for(let u of Array.isArray(c)?c:[c]){let d=e.doc.createElement("td");d.textContent=u==null?"":String(u),l.appendChild(d)}i.appendChild(l)}return s.appendChild(i),s}});var cp={};L(cp,{videoRenderer:()=>uw});var uw,lp=k(()=>{"use strict";uw=(n,e)=>{var c,l;let t=typeof((c=n.props)==null?void 0:c.src)=="string"?n.props.src:"",r=typeof((l=n.props)==null?void 0:l.poster)=="string"?n.props.poster:"",s=e.doc.createElement("div");if(s.className="scalebun-video",!t)return s;let i=()=>{var d;s.replaceChildren();let u=e.doc.createElement("video");u.className="scalebun-video-el",u.src=t,u.controls=!0,u.autoplay=!0,u.playsInline=!0,s.appendChild(u),(d=e.onInteraction)==null||d.call(e,"video_play")},o=e.doc.createElement("button");if(o.type="button",o.className="scalebun-video-poster",o.setAttribute("aria-label","Play video"),r){let u=e.doc.createElement("img");u.src=r,u.alt="",u.loading="lazy",o.appendChild(u)}let a=e.doc.createElement("span");return a.className="scalebun-video-play",a.textContent="\u25B6",o.appendChild(a),o.addEventListener("click",i),s.appendChild(o),s}});var dp={};L(dp,{countdownRenderer:()=>fw});function pw(n,e){let t=n==null?void 0:n.target;if(typeof t=="number")return t;if(typeof t=="string"){let s=Date.parse(t);if(!Number.isNaN(s))return s}let r=Number(n==null?void 0:n.durationMs);return e+(Number.isFinite(r)&&r>0?r:24*36e5)}var Kr,fw,up=k(()=>{"use strict";Kr=n=>String(Math.max(0,n)).padStart(2,"0"),fw=(n,e)=>{let t=e.doc.createElement("div");t.className="scalebun-countdown";let r=()=>typeof Date!="undefined"?Date.now():0,s=pw(n.props,r()),i=[];for(let a of["Days","Hrs","Min","Sec"]){let c=e.doc.createElement("div");c.className="scalebun-cd-cell";let l=e.doc.createElement("div");l.className="scalebun-cd-num",l.textContent="00";let u=e.doc.createElement("div");u.className="scalebun-cd-lab",u.textContent=a,c.append(l,u),t.appendChild(c),i.push([a,l])}let o=()=>{let a=Math.max(0,s-r()),c=Math.floor(a/864e5);a-=c*864e5;let l=Math.floor(a/36e5);a-=l*36e5;let u=Math.floor(a/6e4);a-=u*6e4;let d=Math.floor(a/1e3);i[0][1].textContent=Kr(c),i[1][1].textContent=Kr(l),i[2][1].textContent=Kr(u),i[3][1].textContent=Kr(d)};if(o(),typeof setInterval!="undefined"){let a=setInterval(()=>{if(!t.isConnected){clearInterval(a);return}o()},1e3)}return t}});var pp={};L(pp,{carouselRenderer:()=>mw});var fo,mw,fp=k(()=>{"use strict";fo=n=>typeof n=="string"&&n?n:void 0,mw=(n,e)=>{var c,l;let t=Array.isArray((c=n.props)==null?void 0:c.slides)?n.props.slides:[],r=e.doc.createElement("div");if(r.className="scalebun-carousel",t.length===0)return r;let s=e.doc.createElement("div");s.className="scalebun-car-track";let i=[];for(let u of t){let d=e.doc.createElement("div");d.className="scalebun-car-slide";let p=fo(u.image);if(p){let f=e.doc.createElement("img");f.className="scalebun-car-img",f.src=p,f.alt="",f.loading="lazy",d.appendChild(f)}if(fo(u.title)){let f=e.doc.createElement("div");f.className="scalebun-car-title",f.textContent=u.title,d.appendChild(f)}if(fo(u.text)){let f=e.doc.createElement("div");f.className="scalebun-car-text",f.textContent=u.text,d.appendChild(f)}s.appendChild(d),i.push(d)}r.appendChild(s);let o=e.doc.createElement("div");o.className="scalebun-car-dots";let a=t.map((u,d)=>{let p=e.doc.createElement("button");return p.type="button",p.className="scalebun-car-dot"+(d===0?" on":""),p.setAttribute("aria-label",`Slide ${d+1}`),p.addEventListener("click",()=>i[d].scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})),o.appendChild(p),p});if(r.appendChild(o),typeof IntersectionObserver!="undefined"){let u=new IntersectionObserver(d=>{for(let p of d)if(p.isIntersecting){let f=i.indexOf(p.target);a.forEach((m,h)=>m.classList.toggle("on",h===f))}},{root:s,threshold:.6});i.forEach(d=>u.observe(d))}return(l=e.onInteraction)==null||l.call(e,"carousel_view"),r}});var mp={};L(mp,{productGridRenderer:()=>hw});var Gr,hw,hp=k(()=>{"use strict";Gr=n=>n==null?void 0:String(n),hw=(n,e)=>{var s,i;let t=Array.isArray((s=n.props)==null?void 0:s.products)?n.props.products:Array.isArray((i=n.props)==null?void 0:i.items)?n.props.items:[],r=e.doc.createElement("div");return r.className="scalebun-pgrid",t.length===0||t.forEach((o,a)=>{var d;let c=e.doc.createElement("button");c.type="button",c.className="scalebun-pcard";let l=Gr(o.image);if(l){let p=e.doc.createElement("img");p.className="scalebun-pcard-img",p.src=l,p.alt="",p.loading="lazy",c.appendChild(p)}if(o.badge){let p=e.doc.createElement("span");p.className="scalebun-pcard-badge",p.textContent=Gr(o.badge),c.appendChild(p)}let u=e.doc.createElement("div");if(u.className="scalebun-pcard-title",u.textContent=(d=Gr(o.title))!=null?d:"",c.appendChild(u),o.price!=null){let p=e.doc.createElement("div");p.className="scalebun-pcard-price",p.textContent=Gr(o.price),c.appendChild(p)}c.addEventListener("click",()=>{var p,f;return(f=e.onInteraction)==null?void 0:f.call(e,`product_select:${(p=o.id)!=null?p:a}`)}),r.appendChild(c)}),r}});var bp={};L(bp,{confettiRenderer:()=>bw});function gw(){try{return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var gp,bw,yp=k(()=>{"use strict";gp=["#6C5CE7","#f5b301","#2fa96b","#e0483d","#7c9dff","#ff8fab"];bw=(n,e)=>{var d,p;let t=e.doc.createElement("div");if(t.className="scalebun-confetti",gw()||typeof requestAnimationFrame=="undefined")return t.classList.add("scalebun-confetti-static"),t.textContent="\u{1F389}",t;let r=e.doc.createElement("canvas");r.className="scalebun-confetti-canvas",t.appendChild(r);let s=r.getContext("2d");if(!s)return t;let i=Math.min(240,Math.max(40,Number((d=n.props)==null?void 0:d.count)||140)),o=[],a=()=>{let f=r.width;o=Array.from({length:i},(m,h)=>({x:f/2+(h-i/2),y:r.height*.25,vx:(h%20-10)*.6,vy:-4-h%7,rot:h,vr:(h%5-2)*.3,c:gp[h%gp.length],s:5+h%4}))};(()=>{var m;let f=(m=t.parentElement)!=null?m:t;r.width=f.clientWidth||360,r.height=f.clientHeight||240})(),a();let l=0,u=()=>{if(!t.isConnected)return;s.clearRect(0,0,r.width,r.height);let f=0;for(let m of o)m.vy+=.16,m.x+=m.vx,m.y+=m.vy,m.rot+=m.vr,m.y<r.height+12&&f++,s.save(),s.translate(m.x,m.y),s.rotate(m.rot),s.fillStyle=m.c,s.fillRect(-m.s/2,-m.s/2,m.s,m.s*.6),s.restore();l++,f>0&&l<240?requestAnimationFrame(u):s.clearRect(0,0,r.width,r.height)};return requestAnimationFrame(u),(p=e.onInteraction)==null||p.call(e,"celebration"),t}});function _t(n,e,t,r={}){var o,a,c;(o=n.querySelector(".scalebun-game-note"))==null||o.remove();let s=e.createElement("div");s.className="scalebun-game-note",s.setAttribute("role","status");let i=e.createElement("span");if(i.textContent=(a=t.message)!=null?a:"Rewards are unavailable right now.",s.appendChild(i),t.retryable&&r.onRetry){let l=e.createElement("button");l.type="button",l.className="scalebun-game-retry",l.textContent=(c=r.retryLabel)!=null?c:"Try again",l.addEventListener("click",()=>{var u;s.remove(),(u=r.onRetry)==null||u.call(r)},{once:!0}),s.appendChild(l)}n.appendChild(s)}function Ot(n){var e;(e=n.querySelector(".scalebun-game-note"))==null||e.remove()}var Xr=k(()=>{"use strict"});var xp={};L(xp,{spinwheelRenderer:()=>ww});function ho(n,e,t,r){let s=(r-90)*Math.PI/180;return{x:n+t*Math.cos(s),y:e+t*Math.sin(s)}}function vw(n,e,t,r,s){let i=ho(n,e,t,s),o=ho(n,e,t,r),a=s-r<=180?0:1;return`M ${n} ${e} L ${i.x} ${i.y} A ${t} ${t} 0 ${a} 0 ${o.x} ${o.y} Z`}function wp(){try{return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var vp,yw,mo,ww,Sp=k(()=>{"use strict";Xr();vp=["#6C5CE7","#8b7bff","#5b4bd6","#a99cff","#4c3fb0","#7c6ef0"],yw=n=>{var e;return typeof n=="string"?n:String((e=n==null?void 0:n.label)!=null?e:"")};mo="http://www.w3.org/2000/svg",ww=(n,e)=>{var v,y;let t=(Array.isArray((v=n.props)==null?void 0:v.segments)?n.props.segments:[]).map(yw).filter(Boolean),r=t.length?t:["10% off","Free ship","Try again","20% off","$5 credit","Jackpot"],s=r.length,i=Math.max(0,Math.min(s-1,Number((y=n.props)==null?void 0:y.resultIndex)||0)),o=e.doc.createElement("div");o.className="scalebun-wheel";let a=220,c=a/2,l=a/2-4,u=360/s,d=e.doc.createElementNS(mo,"svg");d.setAttribute("viewBox",`0 0 ${a} ${a}`),d.setAttribute("width",String(a)),d.setAttribute("height",String(a)),d.setAttribute("class","scalebun-wheel-svg"),r.forEach((b,E)=>{let w=e.doc.createElementNS(mo,"path");w.setAttribute("d",vw(c,c,l,E*u,(E+1)*u)),w.setAttribute("fill",vp[E%vp.length]),d.appendChild(w);let I=ho(c,c,l*.62,E*u+u/2),x=e.doc.createElementNS(mo,"text");x.setAttribute("x",String(I.x)),x.setAttribute("y",String(I.y)),x.setAttribute("fill","#fff"),x.setAttribute("font-size","10"),x.setAttribute("text-anchor","middle"),x.setAttribute("transform",`rotate(${E*u+u/2} ${I.x} ${I.y})`),x.textContent=b.slice(0,12),d.appendChild(x)});let p=e.doc.createElement("div");p.className="scalebun-wheel-pointer";let f=e.doc.createElement("button");f.type="button",f.className="scalebun-wheel-spin",f.textContent="SPIN";let m=!1,h=b=>360*5-(b*u+u/2),g=(b,E)=>{var x;let w=((x=E!=null?E:r[b])!=null?x:"").slice(0,14);if(wp()){d.style.transform=`rotate(${-(b*u+u/2)}deg)`,f.textContent=w;return}d.style.transition="transform 3.4s cubic-bezier(.17,.67,.16,.99)",d.style.transform=`rotate(${h(b)}deg)`;let I=()=>{f.textContent=w};d.addEventListener("transitionend",I,{once:!0}),setTimeout(I,3600)},S=b=>{m=!0,f.disabled=!0,Ot(o),wp()||(d.style.transition="transform 1.1s linear",d.style.transform="rotate(400deg)"),e.requestOutcome(b).then(E=>{var I,x,C;if(!E.ok){d.style.transition="",d.style.transform="",m=!1,f.disabled=!1,_t(o,e.doc,E,{onRetry:()=>S(b+1)}),(I=e.onInteraction)==null||I.call(e,"spin_unavailable");return}let w=Math.max(0,Math.min(s-1,Number((x=E.index)!=null?x:0)));(C=e.onInteraction)==null||C.call(e,`spin:${w}`),g(w,E.label)})};return f.addEventListener("click",()=>{var b;if(!m){if(e.requestOutcome){S(1);return}m=!0,(b=e.onInteraction)==null||b.call(e,`spin:${i}`),g(i)}}),o.append(p,d,f),o}});var Ep={};L(Ep,{scratchRenderer:()=>xw});function kp(){try{return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var xw,Ip=k(()=>{"use strict";Xr();xw=(n,e)=>{var S,v;let t=typeof((S=n.props)==null?void 0:S.prize)=="string"?n.props.prize:"You won a prize!",r=((v=n.props)==null?void 0:v.reveal)==="box",s=e.doc.createElement("div");s.className=r?"scalebun-scratch scalebun-scratch-box":"scalebun-scratch";let i=e.doc.createElement("div");i.className="scalebun-scratch-prize",i.textContent=t,s.appendChild(i);let o=!1,a=()=>{o||!e.requestOutcome||(o=!0,e.requestOutcome(1).then(y=>{var b;if(y.ok){Ot(s),y.label&&(i.textContent=y.label);return}i.textContent="\u2014",_t(s,e.doc,y,{onRetry:()=>{o=!1,a()}}),(b=e.onInteraction)==null||b.call(e,"reveal_unavailable")}))};if(r){if(kp())return s;let y=e.doc.createElement("button");return y.type="button",y.className="scalebun-scratch-lid",y.setAttribute("aria-label","Open the mystery box"),y.textContent="\u{1F381}",y.addEventListener("click",()=>{var b;a(),y.setAttribute("data-open","true"),setTimeout(()=>y.remove(),320),(b=e.onInteraction)==null||b.call(e,"mystery_box_opened")},{once:!0}),s.appendChild(y),s}let c=e.doc.createElement("canvas");c.className="scalebun-scratch-cover";let l=c.getContext("2d");if(kp()||!l)return c.remove(),s;s.appendChild(c);let u=300,d=90;c.width=u,c.height=d,l.fillStyle="#9aa3b2",l.fillRect(0,0,u,d),l.fillStyle="#6b7280",l.font="13px sans-serif",l.textAlign="center",l.fillText("Scratch here",u/2,d/2+4),l.globalCompositeOperation="destination-out";let p=!1,f=!1,m=(y,b)=>{l.beginPath(),l.arc(y,b,16,0,Math.PI*2),l.fill()},h=y=>{let b=c.getBoundingClientRect();return{x:(y.clientX-b.left)/b.width*u,y:(y.clientY-b.top)/b.height*d}},g=y=>{var E;if(!p)return;let b=h(y);m(b.x,b.y),f||(f=!0,a(),(E=e.onInteraction)==null||E.call(e,"scratch_reveal"))};return c.addEventListener("mousedown",y=>{p=!0;let b=h(y);m(b.x,b.y)}),e.doc.addEventListener("mouseup",()=>p=!1),c.addEventListener("mousemove",g),c.addEventListener("touchmove",y=>{var E;let b=y.touches[0];if(b){let w=h(b);m(w.x,w.y),f||(f=!0,a(),(E=e.onInteraction)==null||E.call(e,"scratch_reveal"))}}),s}});var Cp={};L(Cp,{slotRenderer:()=>Ew});function kw(){try{return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var Sw,Ew,Ap=k(()=>{"use strict";Xr();Sw=["\u{1F352}","\u{1F514}","\u2B50","7\uFE0F\u20E3","\u{1F48E}","\u{1F340}"];Ew=(n,e)=>{var p,f,m;let t=(Array.isArray((p=n.props)==null?void 0:p.symbols)?n.props.symbols.map(String):[]).filter(Boolean),r=t.length?t:Sw,s=Array.isArray((f=n.props)==null?void 0:f.result)?n.props.result.slice(0,3).map(String):[r[0],r[0],r[0]],i=e.doc.createElement("div");i.className="scalebun-slot";let o=e.doc.createElement("div");o.className="scalebun-slot-reels";let a=[];for(let h=0;h<3;h++){let g=e.doc.createElement("div");g.className="scalebun-slot-reel";let S=e.doc.createElement("div");S.className="scalebun-slot-strip";for(let v of[...r,...r,(m=s[h])!=null?m:r[0]]){let y=e.doc.createElement("div");y.className="scalebun-slot-cell",y.textContent=v,S.appendChild(y)}g.appendChild(S),a.push(S),o.appendChild(g)}i.appendChild(o);let c=e.doc.createElement("button");c.type="button",c.className="scalebun-slot-spin scalebun-btn scalebun-btn-primary",c.textContent="Spin";let l=!1,u=()=>{a.forEach((g,S)=>{let v=(g.children.length-1)*44;kw()||(g.style.transition=`transform ${1.6+S*.35}s cubic-bezier(.15,.7,.15,1)`),g.style.transform=`translateY(-${v}px)`})},d=h=>{l=!0,c.disabled=!0,Ot(i),e.requestOutcome(h).then(g=>{var v,y,b;if(!g.ok){l=!1,c.disabled=!1,_t(i,e.doc,g,{onRetry:()=>d(h+1)}),(v=e.onInteraction)==null||v.call(e,"slot_unavailable");return}let S=(y=g.symbols)!=null&&y.length?g.symbols:s;a.forEach((E,w)=>{var x,C;let I=E.children[E.children.length-1];I&&(I.textContent=(C=(x=S[w])!=null?x:s[w])!=null?C:r[0])}),(b=e.onInteraction)==null||b.call(e,`slot:${S.join("")}`),u()})};return c.addEventListener("click",()=>{var h;if(!l){if(e.requestOutcome){d(1);return}l=!0,(h=e.onInteraction)==null||h.call(e,`slot:${s.join("")}`),u()}}),i.appendChild(c),i}});var Tp={};L(Tp,{qrRenderer:()=>Tw});function Iw(n,e,t){let r=2166136261^e*73856093^t*19349663;for(let s=0;s<n.length;s++)r=(r^n.charCodeAt(s))*16777619;return((r>>>13^r)&1)===1}function Cw(n,e){let t=(r,s)=>n>=r&&n<r+7&&e>=s&&e<s+7;return t(0,0)||t(18,0)||t(0,18)}function Aw(n,e){let t=n<7?n:n>=18?n-18:-1,r=e<7?e:e>=18?e-18:-1;if(t<0||r<0)return!1;let s=t===0||t===6||r===0||r===6,i=t>=2&&t<=4&&r>=2&&r<=4;return s||i}var go,Tw,Rp=k(()=>{"use strict";go="http://www.w3.org/2000/svg";Tw=(n,e)=>{var d;let t=typeof((d=n.props)==null?void 0:d.value)=="string"&&n.props.value?n.props.value:"https://app.example.com",r=e.doc.createElement("div");r.className="scalebun-qr";let s=160,i=2,o=25+i*2,a=s/o,c=e.doc.createElementNS(go,"svg");c.setAttribute("viewBox",`0 0 ${s} ${s}`),c.setAttribute("width",String(s)),c.setAttribute("height",String(s)),c.setAttribute("class","scalebun-qr-svg");let l=e.doc.createElementNS(go,"rect");l.setAttribute("width",String(s)),l.setAttribute("height",String(s)),l.setAttribute("fill","#ffffff"),c.appendChild(l);for(let p=0;p<25;p++)for(let f=0;f<25;f++){let m;if(Cw(f,p)?m=Aw(f,p):f===6||p===6?m=(f+p)%2===0:m=Iw(t,f,p),!m)continue;let h=e.doc.createElementNS(go,"rect");h.setAttribute("x",String((f+i)*a)),h.setAttribute("y",String((p+i)*a)),h.setAttribute("width",String(a+.5)),h.setAttribute("height",String(a+.5)),h.setAttribute("fill","#0b0d12"),c.appendChild(h)}r.appendChild(c);let u=e.doc.createElement("div");return u.className="scalebun-qr-cap",u.textContent=t.length>40?t.slice(0,39)+"\u2026":t,r.appendChild(u),r}});var Mp={};L(Mp,{streakRenderer:()=>Rw});var bo,Rw,Pp=k(()=>{"use strict";bo=(n,e)=>{let t=Number(n);return Number.isFinite(t)?Math.trunc(t):e},Rw=(n,e)=>{var l;let t=(l=n.props)!=null?l:{},r=t.mode==="checkin",s=Array.isArray(t.labels)?t.labels.map(u=>String(u!=null?u:"")):[],i=Math.max(1,Math.min(31,bo(t.days,s.length||7))),o=Math.max(0,Math.min(i,bo(t.filled,0))),a=r?Math.max(0,Math.min(i,bo(t.today,o+1))):0,c=e.doc.createElement("div");c.className=r?"scalebun-streak scalebun-streak-checkin":"scalebun-streak",c.setAttribute("role","group"),c.setAttribute("aria-label",r?`Checked in ${o} of ${i} days`:`${o} day streak of ${i}`);for(let u=1;u<=i;u++){let d=u<=o,p=u===a&&!d,f=e.doc.createElement(p?"button":"div");f.className="scalebun-streak-day",f.setAttribute("data-done",d?"true":"false"),p&&(f.type="button",f.setAttribute("data-today","true"));let m=e.doc.createElement("span");m.className="scalebun-streak-mark",m.setAttribute("aria-hidden","true"),m.textContent=d?r?"\u2713":"\u{1F525}":"",f.appendChild(m);let h=s[u-1];if(h){let g=e.doc.createElement("span");g.className="scalebun-streak-label",g.textContent=h,f.appendChild(g)}f.setAttribute("aria-label",`${h||`Day ${u}`} \u2014 ${d?"done":p?"today":"not done"}`),p&&f.addEventListener("click",()=>{var g;return(g=e.onInteraction)==null?void 0:g.call(e,`check_in:${u}`)},{once:!0}),c.appendChild(f)}return c}});var Op={};L(Op,{nextStepIndex:()=>_p,stepLabels:()=>Lp,stepsRenderer:()=>Pw});function Lp(n){var t,r,s,i,o,a;let e=n!=null?n:{};return{back:(t=He(e.backLabel))!=null?t:"Back",skip:(s=(r=He(e.skipLabel))!=null?r:He(e.secondaryLabel))!=null?s:"Skip",next:(i=He(e.nextLabel))!=null?i:"Next",finish:(a=(o=He(e.finalLabel))!=null?o:He(e.ctaLabel))!=null?a:"Finish"}}function _p(n,e,t){return e<=0?0:Math.max(0,Math.min(n+(t==="next"?1:-1),e-1))}function Mw(n){let e=n==null?void 0:n.steps,r=(Array.isArray(e)?e:[]).map(s=>{var o,a;if(typeof s=="string")return{title:s};let i=s&&typeof s=="object"?s:{};return{title:(o=He(i.title))!=null?o:He(i.label),body:(a=He(i.body))!=null?a:He(i.text)}});return r.length?r:[{}]}var He,Pw,Np=k(()=>{"use strict";He=n=>typeof n=="string"&&n.trim()?n.trim():void 0;Pw=(n,e)=>{let t=n.props,r=Mw(t),s=Lp(t),i=e.doc,o=0,a=i.createElement("div");a.className="scalebun-steps";let c=i.createElement("div");c.className="scalebun-steps-rail",c.setAttribute("role","progressbar"),c.setAttribute("aria-valuemin","1"),c.setAttribute("aria-valuemax",String(r.length));let l=r.map(()=>{let b=i.createElement("span");return b.className="scalebun-steps-dot",c.appendChild(b),b});a.appendChild(c);let u=i.createElement("div");u.className="scalebun-steps-page";let d=i.createElement("div");d.className="scalebun-steps-title";let p=i.createElement("div");p.className="scalebun-steps-body",u.appendChild(d),u.appendChild(p),a.appendChild(u);let f=i.createElement("div");f.className="scalebun-steps-nav";let m=(b,E)=>{let w=i.createElement("button");return w.type="button",w.className=`scalebun-btn ${E}`,w.textContent=b,f.appendChild(w),w},h=m(s.back,"scalebun-btn-ghost"),g=m(s.skip,"scalebun-btn-ghost"),S=m(s.next,"scalebun-btn-primary");a.appendChild(f);let v=()=>{var w,I,x;let b=(w=r[o])!=null?w:{};d.textContent=(I=b.title)!=null?I:"",d.style.display=b.title?"":"none",p.textContent=(x=b.body)!=null?x:"",p.style.display=b.body?"":"none";let E=o+1>=r.length;S.textContent=E?s.finish:s.next,h.hidden=o===0,g.hidden=E,c.setAttribute("aria-valuenow",String(o+1)),c.setAttribute("aria-label",`Step ${o+1} of ${r.length}`),l.forEach((C,M)=>{C.setAttribute("data-state",M<o?"done":M===o?"current":"todo"),M===o?C.setAttribute("aria-current","step"):C.removeAttribute("aria-current")})},y=b=>{var w;let E=_p(o,r.length,b);E!==o&&(o=E,v(),(w=e.onInteraction)==null||w.call(e,`step-${o+1}`))};return h.addEventListener("click",()=>y("back")),g.addEventListener("click",()=>{var b;return(b=e.onInteraction)==null?void 0:b.call(e,"step-skip")}),S.addEventListener("click",()=>{var b;if(o+1>=r.length){(b=e.onInteraction)==null||b.call(e,"step-finish");return}y("next")}),v(),a}});async function Bp(n){let e=new Set;for(let t of n)yo[t]&&!$r[t]&&e.add(t);await Promise.all([...e].map(async t=>{try{$r[t]=await yo[t]()}catch{}}))}var yo,lA,Fp=k(()=>{"use strict";Ur();yo={markdown:()=>Promise.resolve().then(()=>(tp(),ep)).then(n=>n.markdownRenderer),code:()=>Promise.resolve().then(()=>(rp(),np)).then(n=>n.codeRenderer),chart:()=>Promise.resolve().then(()=>(jr(),Wr)).then(n=>n.chartRenderer),sparkline:()=>Promise.resolve().then(()=>(jr(),Wr)).then(n=>n.sparklineRenderer),stat:()=>Promise.resolve().then(()=>(jr(),Wr)).then(n=>n.statRenderer),table:()=>Promise.resolve().then(()=>(ap(),op)).then(n=>n.tableRenderer),video:()=>Promise.resolve().then(()=>(lp(),cp)).then(n=>n.videoRenderer),countdown:()=>Promise.resolve().then(()=>(up(),dp)).then(n=>n.countdownRenderer),carousel:()=>Promise.resolve().then(()=>(fp(),pp)).then(n=>n.carouselRenderer),"product-grid":()=>Promise.resolve().then(()=>(hp(),mp)).then(n=>n.productGridRenderer),confetti:()=>Promise.resolve().then(()=>(yp(),bp)).then(n=>n.confettiRenderer),spinwheel:()=>Promise.resolve().then(()=>(Sp(),xp)).then(n=>n.spinwheelRenderer),scratch:()=>Promise.resolve().then(()=>(Ip(),Ep)).then(n=>n.scratchRenderer),slot:()=>Promise.resolve().then(()=>(Ap(),Cp)).then(n=>n.slotRenderer),qr:()=>Promise.resolve().then(()=>(Rp(),Tp)).then(n=>n.qrRenderer),streak:()=>Promise.resolve().then(()=>(Pp(),Mp)).then(n=>n.streakRenderer),steps:()=>Promise.resolve().then(()=>(Np(),Op)).then(n=>n.stepsRenderer)},lA=Object.keys(yo)});var Dp={};L(Dp,{bannerSurface:()=>Lw});function Lw(n){var o,a,c,l,u,d,p;let{doc:e,variant:t}=n,r=((o=t.surfaceOptions)==null?void 0:o.placement)==="bottom",s=e.createElement("div");s.className="scalebun-banner"+(r?" scalebun-banner-bottom":""),s.setAttribute("role",(c=(a=t.a11y)==null?void 0:a.role)!=null?c:"region"),s.setAttribute("aria-live",(u=(l=t.a11y)==null?void 0:l.liveRegion)!=null?u:"polite"),(d=t.a11y)!=null&&d.labelledBy&&s.setAttribute("aria-label",t.a11y.labelledBy);let i=e.createElement("div");i.className="scalebun-body";for(let f of oe(n))i.appendChild(f);if(s.appendChild(i),((p=t.dismiss)==null?void 0:p.xButton)!==!1){let f=e.createElement("button");f.type="button",f.className="scalebun-x",f.setAttribute("aria-label","Dismiss"),f.textContent="\xD7",f.addEventListener("click",()=>n.requestClose("x")),s.appendChild(f)}return{el:s,destroy:()=>s.remove()}}var qp=k(()=>{"use strict";Re()});var Hp={};L(Hp,{toastSurface:()=>_w});function _w(n){var l,u,d,p,f,m;let{doc:e,variant:t}=n,r=e.createElement("div");r.className="scalebun-toast",r.setAttribute("role",(u=(l=t.a11y)==null?void 0:l.role)!=null?u:"status"),r.setAttribute("aria-live",(p=(d=t.a11y)==null?void 0:d.liveRegion)!=null?p:"polite");let s=e.createElement("div");s.className="scalebun-body";for(let h of oe(n))s.appendChild(h);if(r.appendChild(s),((f=t.dismiss)==null?void 0:f.xButton)!==!1){let h=e.createElement("button");h.type="button",h.className="scalebun-x",h.setAttribute("aria-label","Dismiss"),h.textContent="\xD7",h.addEventListener("click",()=>n.requestClose("x")),r.appendChild(h)}let i=null,o=(m=t.dismiss)==null?void 0:m.autoDismissMs,a=()=>{o&&o>0&&(i=setTimeout(()=>n.requestClose("auto"),o))},c=()=>{i!=null&&(clearTimeout(i),i=null)};return o&&o>0&&(r.addEventListener("mouseenter",c),r.addEventListener("mouseleave",a),a()),{el:r,destroy:()=>{c(),r.remove()}}}var $p=k(()=>{"use strict";Re()});function Nw(n){if(n.hasAttribute("hidden")||n.getAttribute("aria-hidden")==="true"||n.closest("[inert]"))return!1;if(typeof getComputedStyle!="undefined"){let e=getComputedStyle(n);if(e.display==="none"||e.visibility==="hidden")return!1}return!0}function zp(n){return Array.from(n.querySelectorAll(Ow)).filter(Nw)}function Bw(n){var t;return(t=n.getRootNode().activeElement)!=null?t:null}function Nt(n,e=document){let t=r=>{if(r.key!=="Tab")return;let s=zp(n);if(s.length===0){r.preventDefault(),n.focus();return}let i=Bw(n),o=i?s.indexOf(i):-1;r.preventDefault(),r.shiftKey?o=o<=0?s.length-1:o-1:o=o===-1||o>=s.length-1?0:o+1,s[o].focus()};return n.addEventListener("keydown",t),()=>n.removeEventListener("keydown",t)}function Yr(n){let e=zp(n);e.length?e[0].focus():(n.setAttribute("tabindex","-1"),n.focus())}function Jr(n,e=document){let t=e.body;if(!t)return()=>{};let r=[];for(let s of Array.from(t.children))s===n||s.contains(n)||(r.push({el:s,hadInert:s.hasAttribute("inert"),ariaWas:s.getAttribute("aria-hidden")}),s.setAttribute("inert",""),s.setAttribute("aria-hidden","true"));return()=>{for(let{el:s,hadInert:i,ariaWas:o}of r)i||s.removeAttribute("inert"),o==null?s.removeAttribute("aria-hidden"):s.setAttribute("aria-hidden",o)}}function Bt(n=document){let e=n.activeElement;return()=>{var t;try{(t=e==null?void 0:e.focus)==null||t.call(e)}catch{}}}var Ow,Qr=k(()=>{"use strict";Ow=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",")});var Up={};L(Up,{modalSurface:()=>Dw});function Dw(n){var h,g,S,v,y,b,E;let{doc:e,variant:t}=n,r=(h=t.a11y)!=null?h:{},s=(g=t.dismiss)!=null?g:{},i=Bt(e),o=e.createElement("div");o.className="scalebun-backdrop";let a=e.createElement("div");a.className="scalebun-modal-card",a.setAttribute("role",(S=r.role)!=null?S:"dialog"),a.setAttribute("aria-modal","true");let c=(y=(v=t.surfaceOptions)==null?void 0:v.size)!=null?y:"md";a.setAttribute("data-size",c);let l=oe(n),u=l.find(w=>w.classList.contains("scalebun-h"));if(u){let w=`scalebun-mt-${++Fw}`;u.id=w,a.setAttribute("aria-labelledby",w)}else a.setAttribute("aria-label",t.name);if(s.xButton!==!1){let w=e.createElement("button");w.type="button",w.className="scalebun-x scalebun-modal-x",w.setAttribute("aria-label","Close dialog"),w.textContent="\xD7",w.addEventListener("click",()=>n.requestClose("x")),a.appendChild(w)}for(let w of l)a.appendChild(w);o.appendChild(a),s.backdropClose&&o.addEventListener("mousedown",w=>{w.target===o&&n.requestClose("backdrop")});let d=w=>{w.key==="Escape"&&s.escClose!==!1&&(w.stopPropagation(),n.requestClose("esc"))};o.addEventListener("keydown",d);let p=Nt(a,e),f=(E=(b=n.host.shadowRoot)==null?void 0:b.host)!=null?E:o,m=Jr(f,e);return{el:o,afterMount:()=>Yr(a),destroy:()=>{p(),m(),o.removeEventListener("keydown",d),o.remove(),i()}}}var Fw,Vp=k(()=>{"use strict";Re();Qr();Fw=0});var Gp={};L(Gp,{slideoverSurface:()=>$w});function qw(n,e){try{let t=localStorage.getItem(Kp(n)),r=t?Number(t):NaN;return Number.isFinite(r)?Math.min(jp,Math.max(Wp,r)):e}catch{return e}}function Hw(n,e){try{localStorage.setItem(Kp(n),String(Math.round(e)))}catch{}}function $w(n){var g,S,v,y,b,E,w,I,x,C;let{doc:e,variant:t}=n,r=(g=t.surfaceOptions)==null?void 0:g.placement,s=r==="bottom",i=r==="left",o=!s&&((S=t.surfaceOptions)==null?void 0:S.resizable)!==!1,a=!!((v=t.surfaceOptions)!=null&&v.pinnable),c=e.createElement("div");c.className="scalebun-slideover "+(s?"scalebun-slideover-bottom":i?"scalebun-slideover-left":"scalebun-slideover-right"),c.setAttribute("role",(b=(y=t.a11y)==null?void 0:y.role)!=null?b:s?"dialog":"complementary"),c.setAttribute("aria-label",(w=(E=t.a11y)==null?void 0:E.labelledBy)!=null?w:t.name);let l=qw(t.id,(x=(I=t.surfaceOptions)==null?void 0:I.maxWidth)!=null?x:380),u=()=>{s||(c.style.width=`${l}px`)};u();let d=e.createElement("div");if(d.className="scalebun-so-header",a){let M=e.createElement("button");M.type="button",M.className="scalebun-x scalebun-so-pin";let T=`scalebun_inapp_slideover_pin_${t.id}`,A=!1;try{A=localStorage.getItem(T)==="1"}catch{}let O=()=>{c.setAttribute("data-pinned",A?"true":"false"),M.setAttribute("aria-pressed",A?"true":"false"),M.title=A?"Unpin":"Pin",M.textContent=A?"\u{1F4CC}":"\u{1F4CD}"};M.addEventListener("click",()=>{A=!A;try{localStorage.setItem(T,A?"1":"0")}catch{}O()}),O(),d.appendChild(M)}if(((C=t.dismiss)==null?void 0:C.xButton)!==!1){let M=e.createElement("button");M.type="button",M.className="scalebun-x",M.setAttribute("aria-label","Close panel"),M.textContent="\xD7",M.addEventListener("click",()=>n.requestClose("x")),d.appendChild(M)}c.appendChild(d);let p=e.createElement("div");p.className="scalebun-so-body";for(let M of oe(n))p.appendChild(M);c.appendChild(p);let f=null,m=null;if(o){let M=e.createElement("div");M.className="scalebun-so-resize",M.setAttribute("role","separator"),M.setAttribute("aria-orientation","vertical"),M.addEventListener("mousedown",T=>{T.preventDefault();let A=T.clientX,O=l;f=z=>{let D=i?z.clientX-A:A-z.clientX;l=Math.min(jp,Math.max(Wp,O+D)),u()},m=()=>{Hw(t.id,l),h()},e.addEventListener("mousemove",f),e.addEventListener("mouseup",m)}),c.appendChild(M)}let h=()=>{f&&e.removeEventListener("mousemove",f),m&&e.removeEventListener("mouseup",m),f=m=null};return{el:c,destroy:()=>{h(),c.remove()}}}var Wp,jp,Kp,Xp=k(()=>{"use strict";Re();Wp=280,jp=640,Kp=n=>`scalebun_inapp_slideover_${n}`});function Yp(n){return typeof CSS!="undefined"&&CSS.escape?CSS.escape(n):n.replace(/["\\]/g,"\\$&")}function an(n,e,t,r=[]){try{for(let s of[...n.querySelectorAll(e)])r.push(s)}catch{}if(t)for(let s of[...n.querySelectorAll("*")]){let i=s.shadowRoot;i&&an(i,e,t,r)}return r}function vo(n,e,t){let r=null;try{r=n.querySelector(e)}catch{return null}if(r)return r;if(!t)return null;for(let s of[...n.querySelectorAll("*")]){let i=s.shadowRoot;if(i){let o=vo(i,e,!0);if(o)return o}}return null}function zw(n,e,t,r){let s=e.trim(),i=an(n,t!=null?t:"*",r).filter(o=>{var a;return((a=o.textContent)!=null?a:"").trim()===s});return i.length?i.reduce((o,a)=>a.querySelectorAll("*").length<o.querySelectorAll("*").length?a:o):null}function Uw(n,e,t,r){var a,c;let s=e?`[role="${Yp(e)}"]`:"button,a,[role],input,select,textarea,summary",i=an(n,s,r);if(!t)return(a=i[0])!=null?a:null;let o=t.trim();return(c=i.find(l=>{var u,d;return((d=(u=l.getAttribute("aria-label"))!=null?u:l.textContent)!=null?d:"").trim()===o}))!=null?c:null}function Vw(n){var e;if(typeof document=="undefined"||!document.evaluate)return null;try{return(e=document.evaluate(n,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue)!=null?e:null}catch{return null}}function Ww(n,e,t){var r;switch(n.kind){case"selector":return vo(e,n.value,t);case"data-attr":return vo(e,`[data-scalebun-anchor="${Yp(n.value)}"]`,t);case"nth":return(r=an(e,n.selector,t)[n.index])!=null?r:null;case"text":return zw(e,n.value,n.scope,t);case"aria":return Uw(e,n.role,n.name,t);case"xpath":return Vw(n.value)}}function Jp(n=typeof document!="undefined"?document:void 0,e=200){var r;if(!n)return[];let t=new Set;for(let s of an(n,"[data-scalebun-anchor]",!0)){let i=(r=s.getAttribute("data-scalebun-anchor"))==null?void 0:r.trim();if(i&&t.add(i),t.size>=e)break}return[...t].sort()}function pt(n,e=typeof document!="undefined"?document:void 0){let t=n.shadowPiercing!==!1,r=0;for(let s=0;s<n.strategies.length;s++){r++;let i=e?Ww(n.strategies[s],e,t):null;if(i)return{el:i,strategyIndex:s,strategiesTried:r}}return{el:null,strategyIndex:-1,strategiesTried:r}}function Qp(n){return n.el!=null&&n.strategyIndex>0}var Zr=k(()=>{"use strict"});function wo(n,e,t){switch(n){case"top":return e.y-t.y;case"bottom":return t.y+t.height-(e.y+e.height);case"left":return e.x-t.x;case"right":return t.x+t.width-(e.x+e.width)}}function Zp(n,e,t,r,s){let i=(cn(n)?t.height:t.width)+s;return wo(n,e,r)>=i}function es(n,e,t){return t<e?e:Math.min(t,Math.max(e,n))}function ts(n){var h,g,S,v;let e=(h=n.offset)!=null?h:8,t=(g=n.padding)!=null?g:8,r=(S=n.arrowSize)!=null?S:8,s=n.anchor,i=n.tooltip,o=n.boundary,a=(v=n.preferred)!=null?v:{side:"bottom",align:"center"},c=a.side,l=!1;if(!Zp(c,s,i,o,e)){let y=jw[c];(Zp(y,s,i,o,e)||wo(y,s,o)>wo(c,s,o))&&(c=y,l=!0)}let u=a.align;n.rtl&&cn(c)&&(u=u==="start"?"end":u==="end"?"start":"center");let d=0,p=0;cn(c)?(p=c==="top"?s.y-i.height-e:s.y+s.height+e,d=u==="start"?s.x:u==="end"?s.x+s.width-i.width:s.x+s.width/2-i.width/2):(d=c==="left"?s.x-i.width-e:s.x+s.width+e,p=u==="start"?s.y:u==="end"?s.y+s.height-i.height:s.y+s.height/2-i.height/2);let f=!1;if(cn(c)){let y=es(d,o.x+t,o.x+o.width-t-i.width);y!==d&&(f=!0,d=y)}else{let y=es(p,o.y+t,o.y+o.height-t-i.height);y!==p&&(f=!0,p=y)}let m={x:0,y:0};return cn(c)?(m.x=es(s.x+s.width/2-d,r,i.width-r),m.y=c==="top"?i.height:0):(m.y=es(s.y+s.height/2-p,r,i.height-r),m.x=c==="left"?i.width:0),{placement:{side:c,align:u},x:d,y:p,arrow:m,flipped:l,shifted:f}}var jw,cn,xo=k(()=>{"use strict";jw={top:"bottom",bottom:"top",left:"right",right:"left"},cn=n=>n==="top"||n==="bottom"});var tt,ns=k(()=>{"use strict";tt=class{constructor(){this.mo=null;this.subs=new Set;this.scheduled=!1}start(){this.mo||typeof MutationObserver=="undefined"||typeof document=="undefined"||(this.mo=new MutationObserver(()=>this.notify()),this.mo.observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0}))}onChange(e){return this.subs.add(e),this.start(),()=>{this.subs.delete(e),this.subs.size||this.dispose()}}notify(){this.scheduled||(this.scheduled=!0,queueMicrotask(()=>{this.scheduled=!1;for(let e of[...this.subs])try{e()}catch{}}))}dispose(){var e;(e=this.mo)==null||e.disconnect(),this.mo=null,this.subs.clear()}}});function Kw(){return{x:0,y:0,width:typeof innerWidth!="undefined"?innerWidth:1024,height:typeof innerHeight!="undefined"?innerHeight:768}}function $e(n){let e=[{kind:"selector",value:n}],t=n.match(/^\[data-scalebun-anchor=["']?([^"'\]]+)["']?\]$/);return t&&e.push({kind:"data-attr",value:t[1]}),{strategies:e,shadowPiercing:!0}}function ef(n){var r,s,i,o;let e=(r=n==null?void 0:n.strategies)!=null?r:[],t=(s=e.find(a=>a.kind==="selector"))!=null?s:e[0];if(!t)return"";switch(t.kind){case"selector":case"data-attr":case"text":case"xpath":return t.value;case"nth":return`${t.selector}[${t.index}]`;case"aria":return`aria:${(i=t.role)!=null?i:"*"}/${(o=t.name)!=null?o:"*"}`}}var Me,Ft=k(()=>{"use strict";Zr();xo();ns();Me=class{constructor(e){this.opts=e;this.raf=null;this.lostTimer=null;this.lastStrategy=-1;this.hadEl=!1;this.missed=!1;var t,r;this.hub=(t=e.hub)!=null?t:new tt,this.ownHub=!e.hub,this.now=(r=e.now)!=null?r:()=>Date.now()}start(){this.reposition(),this.unsubMo=this.hub.onChange(()=>this.reposition()),this.onScrollResize=()=>this.schedule(),typeof window!="undefined"&&(window.addEventListener("scroll",this.onScrollResize,!0),window.addEventListener("resize",this.onScrollResize))}reposition(){var t,r,s,i,o,a;let e=pt(this.opts.spec);if(e.el){this.clearLost(),this.hadEl||(r=(t=this.opts.hooks).onFound)==null||r.call(t,e.el),Qp(e)&&e.strategyIndex!==this.lastStrategy&&((i=(s=this.opts.hooks).onHeal)==null||i.call(s,e.strategyIndex)),this.lastStrategy=e.strategyIndex,this.hadEl=!0,this.missed=!1;let c=e.el.getBoundingClientRect(),l=ts({anchor:{x:c.x,y:c.y,width:c.width,height:c.height},tooltip:this.opts.size(),boundary:Kw(),preferred:this.opts.preferred,offset:this.opts.offset});this.opts.hooks.onReposition(l,e.el)}else this.missed||(this.missed=!0,(a=(o=this.opts.hooks).onMiss)==null||a.call(o)),this.hadEl=!1,this.armLost()}schedule(){if(this.raf!=null)return;let e=()=>{this.raf=null,this.reposition()};this.raf=typeof requestAnimationFrame!="undefined"?requestAnimationFrame(e):setTimeout(e,16)}armLost(){var e;this.lostTimer==null&&(this.lostTimer=setTimeout(()=>{var t,r;this.lostTimer=null,pt(this.opts.spec).el==null&&(this.hadEl=!1,(r=(t=this.opts.hooks).onLost)==null||r.call(t,"not-found"))},(e=this.opts.graceMs)!=null?e:1500))}clearLost(){this.lostTimer!=null&&(clearTimeout(this.lostTimer),this.lostTimer=null)}stop(){var e;(e=this.unsubMo)==null||e.call(this),this.unsubMo=void 0,this.onScrollResize&&typeof window!="undefined"&&(window.removeEventListener("scroll",this.onScrollResize,!0),window.removeEventListener("resize",this.onScrollResize)),this.onScrollResize=void 0,this.raf!=null&&typeof cancelAnimationFrame!="undefined"&&cancelAnimationFrame(this.raf),this.raf=null,this.clearLost(),this.ownHub&&this.hub.dispose()}}});var tf={};L(tf,{popoverSurface:()=>Yw});function Gw(n){var e,t,r;return(r=(e=n.variant.targeting)==null?void 0:e.element)!=null?r:(t=n.variant.triggers.find(s=>(s.type==="element"||s.type==="hover")&&s.match))==null?void 0:t.match}function Xw(n){var t;let e=(t=n.variant.surfaceOptions)==null?void 0:t.placement;return e==="top"||e==="left"||e==="right"?e:"bottom"}function Yw(n){var c,l,u,d,p;let{doc:e,variant:t}=n,r=Gw(n),s=e.createElement("div");s.className="scalebun-popover",s.setAttribute("role",(l=(c=t.a11y)==null?void 0:c.role)!=null?l:"dialog"),s.setAttribute("aria-label",t.name),s.style.position="absolute";let i=(u=t.surfaceOptions)==null?void 0:u.maxWidth;if(i&&(s.style.maxWidth=`${i}px`),((d=t.dismiss)==null?void 0:d.xButton)!==!1){let f=e.createElement("button");f.type="button",f.className="scalebun-x scalebun-pop-x",f.setAttribute("aria-label","Dismiss"),f.textContent="\xD7",f.addEventListener("click",()=>n.requestClose("x")),s.appendChild(f)}let o=e.createElement("div");o.className="scalebun-pop-body";for(let f of oe(n))o.appendChild(f);s.appendChild(o);let a=r?new Me({spec:$e(r),size:()=>({width:s.offsetWidth||320,height:s.offsetHeight||120}),preferred:{side:Xw(n),align:"center"},offset:(p=t.surfaceOptions)==null?void 0:p.offset,hooks:{onReposition:f=>{s.style.top=`${f.y}px`,s.style.left=`${f.x}px`,s.setAttribute("data-placement",f.placement.side)},onHeal:()=>{var f;return(f=n.metrics)==null?void 0:f.recordAnchorRetry()},onMiss:()=>{var f;return(f=n.metrics)==null?void 0:f.recordFailedSelector(r)},onLost:()=>n.requestClose("auto")}}):null;return{el:s,afterMount:()=>a==null?void 0:a.start(),destroy:()=>{a==null||a.stop(),s.remove()}}}var nf=k(()=>{"use strict";Re();Ft()});var rf={};L(rf,{coachmarkSurface:()=>Zw});function Jw(n){var e,t,r;return(r=(e=n.variant.targeting)==null?void 0:e.element)!=null?r:(t=n.variant.triggers.find(s=>(s.type==="element"||s.type==="hover")&&s.match))==null?void 0:t.match}function Qw(n){var t;let e=(t=n.variant.surfaceOptions)==null?void 0:t.placement;return e==="top"||e==="left"||e==="right"?e:"bottom"}function Zw(n){var p,f,m,h,g,S;let{doc:e,variant:t}=n,r=Jw(n),s=((p=t.surfaceOptions)==null?void 0:p.spotlight)!==!1,i=e.createElement("div");i.className="scalebun-coach-root";let o=s?e.createElement("div"):null;o&&(o.className="scalebun-coach-spot",i.appendChild(o));let a=e.createElement("div");a.className="scalebun-coachmark",a.setAttribute("role",(m=(f=t.a11y)==null?void 0:f.role)!=null?m:"dialog"),a.setAttribute("aria-label",t.name),a.style.position="absolute";let c=(h=t.surfaceOptions)==null?void 0:h.maxWidth;if(c&&(a.style.maxWidth=`${c}px`),((g=t.dismiss)==null?void 0:g.xButton)!==!1){let v=e.createElement("button");v.type="button",v.className="scalebun-x scalebun-pop-x",v.setAttribute("aria-label","Dismiss"),v.textContent="\xD7",v.addEventListener("click",()=>n.requestClose("x")),a.appendChild(v)}let l=e.createElement("div");l.className="scalebun-pop-body";for(let v of oe(n))l.appendChild(v);a.appendChild(l),i.appendChild(a);let u=6,d=r?new Me({spec:$e(r),size:()=>({width:a.offsetWidth||300,height:a.offsetHeight||120}),preferred:{side:Qw(n),align:"center"},offset:(S=t.surfaceOptions)==null?void 0:S.offset,hooks:{onReposition:(v,y)=>{if(a.style.top=`${v.y}px`,a.style.left=`${v.x}px`,a.setAttribute("data-placement",v.placement.side),o){let b=y.getBoundingClientRect();o.style.top=`${b.y-u}px`,o.style.left=`${b.x-u}px`,o.style.width=`${b.width+u*2}px`,o.style.height=`${b.height+u*2}px`}},onHeal:()=>{var v;return(v=n.metrics)==null?void 0:v.recordAnchorRetry()},onMiss:()=>{var v;return(v=n.metrics)==null?void 0:v.recordFailedSelector(r)},onLost:v=>{var y;(y=n.metrics)==null||y.recordFailedSelector(r),n.hooks.onInteraction(`anchor-lost:${v}`),n.requestClose("auto")}}}):null;return{el:i,afterMount:()=>d==null?void 0:d.start(),destroy:()=>{d==null||d.stop(),i.remove()}}}var sf=k(()=>{"use strict";Re();Ft()});function Dt(n,e){var i,o,a,c;if("all"in n)return n.all.every(l=>Dt(l,e));if("any"in n)return n.any.some(l=>Dt(l,e));if("not"in n)return!Dt(n.not,e);if("flag"in n)return!!((i=e.flags)!=null&&i[n.flag])===((o=n.is)!=null?o:!0);let t=(a=e.props)==null?void 0:a[n.prop],r=(c=n.op)!=null?c:"exists",s=typeof t=="number"&&typeof n.value=="number";switch(r){case"exists":return t!=null;case"eq":return t===n.value;case"ne":return t!==n.value;case"gt":return s&&t>n.value;case"lt":return s&&t<n.value;case"gte":return s&&t>=n.value;case"lte":return s&&t<=n.value;case"in":return Array.isArray(n.value)&&n.value.includes(t);default:return!1}}function of(n,e){if(typeof n=="string")return n;if(Array.isArray(n)){for(let t of n)if(!t.when||Dt(t.when,e))return t.to}return null}var af=k(()=>{"use strict"});var qt,So=k(()=>{"use strict";af();qt=class{constructor(e){this.deps=e;this.tour=null;this.index=0;this.status="idle";this.startedAt=0;this.token=0;this.stepCleanup=null;this.pendingEvent=null;this.context={}}get state(){var e,t;return{tourId:(t=(e=this.tour)==null?void 0:e.id)!=null?t:null,index:this.index,status:this.status}}start(e,t){var s,i,o,a,c;this.status==="running"&&this.end("abandoned","superseded"),this.tour=e,this.context=(s=t==null?void 0:t.context)!=null?s:{},this.status="running",this.startedAt=this.deps.now();let r=!!(t!=null&&t.resume);this.index=r&&(a=(o=(i=this.deps).loadIndex)==null?void 0:o.call(i,e.id))!=null?a:0,(this.index>=e.steps.length||this.index<0)&&(this.index=0),this.deps.emit("$coachmark_tour_started",{tourId:e.id,version:(c=e.version)!=null?c:1,resumed:r&&this.index>0,steps:e.steps.length}),this.enter(this.index)}next(){this.status==="running"&&this.completeStep("next")}back(){if(this.status==="running"&&this.index>0){let e=this.tour.steps[this.index];this.deps.emit("$coachmark_step_back",{tourId:this.tour.id,stepId:e.id,index:this.index}),this.enter(this.index-1)}}skip(){if(this.status!=="running")return;let e=this.tour.steps[this.index];this.deps.emit("$coachmark_step_skipped",{tourId:this.tour.id,stepId:e.id,index:this.index,bySystem:!1}),this.enter(this.index+1)}notify(e){this.status==="running"&&this.pendingEvent===e&&this.completeStep("event")}end(e="abandoned",t="api"){var s,i,o;if(this.status!=="running")return;let r=this.tour;if(this.clearStep(),this.status=e,this.deps.hide(),(i=(s=this.deps).persist)==null||i.call(s,r.id,-1),e==="completed")this.deps.emit("$coachmark_tour_completed",{tourId:r.id,version:(o=r.version)!=null?o:1,steps:r.steps.length,totalMs:this.deps.now()-this.startedAt});else{let a=r.steps[this.index];this.deps.emit("$coachmark_tour_abandoned",{tourId:r.id,stepId:a==null?void 0:a.id,index:this.index,method:t})}}async enter(e){var o,a,c,l;this.clearStep();let t=this.tour;if(!t||this.status!=="running")return;if(e>=t.steps.length)return this.end("completed");this.index=e;let r=++this.token,s=t.steps[e];if(s.skipIf&&Dt(s.skipIf,this.context))return this.deps.emit("$coachmark_step_skipped",{tourId:t.id,stepId:s.id,index:e,bySystem:!0,reason:"skipIf"}),void this.enter(e+1);(a=(o=this.deps).persist)==null||a.call(o,t.id,e);let i=null;if(s.anchor){let u=(c=s.waitConditions)!=null?c:["exists","visible"],d=()=>this.deps.resolveAnchor(s.anchor).el,p=await this.deps.waitFor(d,{conditions:u,timeoutMs:(l=s.timeoutMs)!=null?l:5e3},this.deps.hub);if(r!==this.token||this.status!=="running")return;if(!p.ok)return this.deps.emit("$coachmark_anchor_failed",{tourId:t.id,stepId:s.id,index:e,reason:p.reason,strategiesTried:this.deps.resolveAnchor(s.anchor).strategiesTried}),this.applyFallback(s,e);let f=this.deps.resolveAnchor(s.anchor);f.strategyIndex>0&&this.deps.emit("$coachmark_anchor_healed",{tourId:t.id,stepId:s.id,index:e,winningStrategy:f.strategyIndex}),i=p.el}this.paint(s,i,e,!1)}applyFallback(e,t){var s;let r=(s=e.fallback)!=null?s:"modal";if(this.deps.emit("$coachmark_step_fallback",{tourId:this.tour.id,stepId:e.id,index:t,fallback:r,reason:"anchor-fail"}),r==="skip")return void this.enter(t+1);if(r==="end")return this.end("abandoned","anchor-fail");this.paint(e,null,t,!0)}paint(e,t,r,s){this.deps.render({step:e,el:t,index:r,total:this.tour.steps.length,degraded:s,controls:this.controls()}),this.deps.emit("$coachmark_step_entered",{tourId:this.tour.id,stepId:e.id,index:r,anchored:!!t,degraded:s}),this.armAdvance(e,t)}armAdvance(e,t){var s;let r=(s=e.advance)!=null?s:"next";if(this.pendingEvent=null,r!=="next")if(r==="anchor-click"&&t){let i=()=>this.completeStep("click");t.addEventListener("click",i,{once:!0}),this.stepCleanup=()=>t.removeEventListener("click",i)}else if(r==="anchor-gone"&&e.anchor){let i=this.token,o=()=>this.deps.resolveAnchor(e.anchor).el;this.deps.waitFor(o,{conditions:["gone"],timeoutMs:36e5},this.deps.hub).then(a=>{a.ok&&i===this.token&&this.status==="running"&&this.completeStep("gone")})}else if(typeof r=="object"&&"timer"in r){let i=setTimeout(()=>this.completeStep("timer"),r.timer);this.stepCleanup=()=>clearTimeout(i)}else typeof r=="object"&&"event"in r&&(this.pendingEvent=r.event)}completeStep(e){if(this.status!=="running"||!this.tour)return;let t=this.tour.steps[this.index];this.deps.emit("$coachmark_step_completed",{tourId:this.tour.id,stepId:t.id,index:this.index,advanceBy:e});let r=of(t.next,this.context);if(r){let s=this.tour.steps.findIndex(i=>i.id===r);if(s>=0)return this.deps.emit("$coachmark_branched",{tourId:this.tour.id,fromStep:t.id,toStep:r,index:s}),void this.enter(s)}this.enter(this.index+1)}controls(){return{next:()=>this.next(),back:()=>this.back(),skip:()=>this.skip(),close:()=>this.end("abandoned","dismiss")}}clearStep(){var e;(e=this.stepCleanup)==null||e.call(this),this.stepCleanup=null,this.pendingEvent=null,this.token++}dispose(){this.clearStep(),this.status="idle",this.tour=null}}});function Eo(n,e){let t=n.width*n.height;if(t<=0)return 0;let r=Math.max(0,Math.min(n.x+n.width,e.x+e.width)-Math.max(n.x,e.x)),s=Math.max(0,Math.min(n.y+n.height,e.y+e.height)-Math.max(n.y,e.y));return r*s/t}function ko(n){let e=n.getBoundingClientRect();return{x:e.left,y:e.top,width:e.width,height:e.height}}function cf(n){if(n)return n;let e=typeof window!="undefined"?window.innerWidth:0,t=typeof window!="undefined"?window.innerHeight:0;return{x:0,y:0,width:e,height:t}}function lf(n){if(n.disabled)return!1;let e=n.getBoundingClientRect();if(e.width===0||e.height===0)return!1;let t=typeof document!="undefined"&&document.elementFromPoint?document.elementFromPoint(e.left+e.width/2,e.top+e.height/2):null;return t?n===t||n.contains(t)||t.contains(n):!1}function ex(n,e,t,r){var s,i;if(e.conditions.includes("gone"))return n==null;if(!n||e.conditions.includes("visible")&&Eo(ko(n),cf(e.boundary))<((s=e.minVisibleRatio)!=null?s:.5)||e.conditions.includes("clickable")&&!lf(n))return!1;if(e.conditions.includes("stable")){let o=JSON.stringify(ko(n));if(o!==t.v)return t.v=o,r.n=0,!1;if(r.n+=1,r.n<((i=e.stableFrames)!=null?i:2))return!1}return!0}function tx(n,e){var t;return e.conditions.includes("gone")?"timeout":n?e.conditions.includes("visible")&&Eo(ko(n),cf(e.boundary))<((t=e.minVisibleRatio)!=null?t:.5)?"not-visible":e.conditions.includes("clickable")&&!lf(n)?"not-clickable":"timeout":"not-found"}function rs(n,e,t){return new Promise(r=>{var p,f;let s=!1,i=()=>{},o,a,c={v:""},l={n:0},u=(m,h,g)=>{s||(s=!0,i(),o&&clearTimeout(o),a&&clearInterval(a),r({ok:m,el:h,reason:g}))},d=()=>{if(s)return;let m=n();ex(m,e,c,l)&&u(!0,e.conditions.includes("gone")?null:m)};i=t.onChange(d),a=setInterval(d,(p=e.pollMs)!=null?p:100),o=setTimeout(()=>{let m=n();u(!1,m,tx(m,e))},(f=e.timeoutMs)!=null?f:5e3),d()})}var ss=k(()=>{"use strict"});var df={};L(df,{tourSurface:()=>rx});function nx(n){var t;let e=n.placement==="top"||n.placement==="left"||n.placement==="right"?n.placement:"bottom";return{id:n.id,anchor:n.anchor?$e(n.anchor):void 0,title:n.title,body:n.body,placement:n.anchor?{side:e,align:"center"}:void 0,advance:(t=n.advance)!=null?t:"next",fallback:"modal"}}function rx(n){var u,d;let{doc:e,variant:t}=n,r=(d=(u=t.surfaceOptions)==null?void 0:u.steps)!=null?d:[],s=new tt,i=e.createElement("div");i.className="scalebun-tour-root";let o=()=>{},a=p=>{var w;let f=e.createElement("div");if(f.className="scalebun-coachmark scalebun-tour-card",f.setAttribute("role","dialog"),f.setAttribute("aria-label",(w=p.step.title)!=null?w:t.name),f.style.position=p.el?"absolute":"fixed",p.step.title){let I=e.createElement("h2");I.className="scalebun-h",I.textContent=p.step.title,f.appendChild(I)}if(p.step.body){let I=e.createElement("p");I.className="scalebun-text",I.textContent=p.step.body,f.appendChild(I)}let m=e.createElement("div");m.className="scalebun-tour-nav";let h=e.createElement("span");h.className="scalebun-tour-prog",h.textContent=`${p.index+1} / ${p.total}`,m.appendChild(h);let g=e.createElement("span");g.className="scalebun-tour-btns";let S=(I,x,C)=>{let M=e.createElement("button");return M.type="button",M.className=`scalebun-btn ${x}`,M.textContent=I,M.addEventListener("click",C),M};p.index>0&&g.appendChild(S("Back","scalebun-btn-ghost",p.controls.back)),g.appendChild(S("Skip","scalebun-btn-ghost",p.controls.skip)),g.appendChild(S(p.index+1>=p.total?"Done":"Next","scalebun-btn-primary",p.controls.next)),m.appendChild(g),f.appendChild(m);let v=e.createElement("button");v.type="button",v.className="scalebun-x scalebun-pop-x",v.setAttribute("aria-label","End tour"),v.textContent="\xD7",v.addEventListener("click",p.controls.close),f.appendChild(v),i.appendChild(f);let y=null,b=null,E=()=>{b==null||b.stop(),b=null,y==null||y.remove(),y=null,f.style.position="fixed",f.style.top="",f.style.left="",f.removeAttribute("data-placement"),f.classList.add("scalebun-tour-center")};if(p.el&&p.step.anchor){let I=ef(p.step.anchor);y=e.createElement("div"),y.className="scalebun-coach-spot",i.appendChild(y);let x=6;b=new Me({spec:p.step.anchor,size:()=>({width:f.offsetWidth||300,height:f.offsetHeight||120}),preferred:p.step.placement,hooks:{onReposition:(C,M)=>{f.style.top=`${C.y}px`,f.style.left=`${C.x}px`,f.setAttribute("data-placement",C.placement.side);let T=M.getBoundingClientRect();y.style.top=`${T.y-x}px`,y.style.left=`${T.x-x}px`,y.style.width=`${T.width+x*2}px`,y.style.height=`${T.height+x*2}px`},onHeal:()=>{var C;return(C=n.metrics)==null?void 0:C.recordAnchorRetry()},onMiss:()=>{var C;return(C=n.metrics)==null?void 0:C.recordFailedSelector(I)},onLost:C=>{var M;E(),(M=n.metrics)==null||M.recordFailedSelector(I),n.hooks.onInteraction(`anchor-lost:${C}`)}}}),b.start()}else f.classList.add("scalebun-tour-center");return()=>{b==null||b.stop(),y==null||y.remove(),f.remove()}},c=new qt({hub:s,resolveAnchor:pt,waitFor:rs,render:p=>{o(),o=a(p)},hide:()=>{o(),o=()=>{}},emit:p=>n.hooks.onInteraction(p),now:()=>Date.now(),persist:(p,f)=>{try{f<0?localStorage.removeItem(Io(p)):localStorage.setItem(Io(p),String(f))}catch{}},loadIndex:p=>{try{let f=localStorage.getItem(Io(p));return f!=null?Number(f):void 0}catch{return}}}),l={id:t.id,version:1,steps:r.map(nx)};return{el:i,afterMount:()=>c.start(l,{resume:!0}),destroy:()=>{o(),c.dispose(),s.dispose(),i.remove()}}}var Io,uf=k(()=>{"use strict";So();Zr();ss();ns();Ft();Io=n=>`scalebun_inapp_tour_${n}`});var pf={};L(pf,{hotspotSurface:()=>ox});function sx(n){var e,t,r;return(r=(e=n.variant.targeting)==null?void 0:e.element)!=null?r:(t=n.variant.triggers.find(s=>(s.type==="element"||s.type==="hover")&&s.match))==null?void 0:t.match}function ix(n){var t;let e=(t=n.variant.surfaceOptions)==null?void 0:t.placement;return e==="top"||e==="left"||e==="right"?e:"bottom"}function ox(n){let{doc:e,variant:t}=n,r=sx(n),s=e.createElement("div");s.className="scalebun-hotspot-root";let i=e.createElement("button");i.type="button",i.className="scalebun-beacon",i.setAttribute("aria-label",t.name),i.setAttribute("aria-expanded","false"),s.appendChild(i);let o=e.createElement("div");o.className="scalebun-beacon-card",o.setAttribute("role","tooltip"),o.hidden=!0;for(let d of oe(n))o.appendChild(d);s.appendChild(o);let a=!1,c=d=>{a!==d&&(a=d,o.hidden=!d,i.setAttribute("aria-expanded",String(d)),d&&n.hooks.onInteraction("hotspot_reveal"))};i.addEventListener("mouseenter",()=>c(!0)),i.addEventListener("focus",()=>c(!0)),i.addEventListener("click",()=>c(!a));let l=!1;o.addEventListener("mouseenter",()=>l=!0),o.addEventListener("mouseleave",()=>{l=!1,c(!1)}),i.addEventListener("mouseleave",()=>setTimeout(()=>!l&&c(!1),120));let u=r?new Me({spec:$e(r),size:()=>({width:o.offsetWidth||240,height:o.offsetHeight||90}),preferred:{side:ix(n),align:"center"},hooks:{onReposition:(d,p)=>{let f=p.getBoundingClientRect();i.style.top=`${f.y-5}px`,i.style.left=`${f.x+f.width-5}px`,o.style.top=`${d.y}px`,o.style.left=`${d.x}px`,o.setAttribute("data-placement",d.placement.side)},onHeal:()=>{var d;return(d=n.metrics)==null?void 0:d.recordAnchorRetry()},onMiss:()=>{var d;return(d=n.metrics)==null?void 0:d.recordFailedSelector(r)},onLost:d=>{var p;(p=n.metrics)==null||p.recordFailedSelector(r),n.hooks.onInteraction(`anchor-lost:${d}`),n.requestClose("auto")}}}):null;return{el:s,afterMount:()=>u==null?void 0:u.start(),destroy:()=>{u==null||u.stop(),s.remove()}}}var ff=k(()=>{"use strict";Re();Ft()});var mf={};L(mf,{toolbarSurface:()=>lx});function ax(n){var e,t,r;return(r=(e=n.variant.targeting)==null?void 0:e.element)!=null?r:(t=n.variant.triggers.find(s=>(s.type==="element"||s.type==="hover")&&s.match))==null?void 0:t.match}function cx(n){var t;let e=(t=n.variant.surfaceOptions)==null?void 0:t.placement;return e==="top"||e==="left"||e==="right"?e:"bottom"}function lx(n){var a,c,l,u;let{doc:e,variant:t}=n,r=ax(n),s=e.createElement("div");s.className="scalebun-toolbar-callout",s.setAttribute("role",(c=(a=t.a11y)==null?void 0:a.role)!=null?c:"dialog"),s.setAttribute("aria-label",t.name),s.style.position="absolute";let i=e.createElement("div");i.className="scalebun-pop-body";for(let d of oe(n))i.appendChild(d);if(s.appendChild(i),((l=t.dismiss)==null?void 0:l.xButton)!==!1){let d=e.createElement("button");d.type="button",d.className="scalebun-x scalebun-pop-x",d.setAttribute("aria-label","Dismiss"),d.textContent="\xD7",d.addEventListener("click",()=>n.requestClose("x")),s.appendChild(d)}let o=r?new Me({spec:$e(r),size:()=>({width:s.offsetWidth||220,height:s.offsetHeight||80}),preferred:{side:cx(n),align:"center"},offset:(u=t.surfaceOptions)==null?void 0:u.offset,hooks:{onReposition:d=>{s.style.top=`${d.y}px`,s.style.left=`${d.x}px`,s.setAttribute("data-placement",d.placement.side)},onHeal:()=>{var d;return(d=n.metrics)==null?void 0:d.recordAnchorRetry()},onMiss:()=>{var d;return(d=n.metrics)==null?void 0:d.recordFailedSelector(r)},onLost:()=>n.requestClose("auto")}}):null;return{el:s,afterMount:()=>o==null?void 0:o.start(),destroy:()=>{o==null||o.stop(),s.remove()}}}var hf=k(()=>{"use strict";Re();Ft()});var gf={};L(gf,{paletteSurface:()=>dx});function dx(n){var S,v,y;let{doc:e,variant:t}=n,r=(v=(S=t.surfaceOptions)==null?void 0:S.commands)!=null?v:[],s=Bt(e),i=e.createElement("div");i.className="scalebun-palette-backdrop";let o=e.createElement("div");o.className="scalebun-palette",o.setAttribute("role","dialog"),o.setAttribute("aria-label",t.name);let a=e.createElement("input");a.className="scalebun-palette-input",a.type="text",a.setAttribute("role","combobox"),a.setAttribute("aria-expanded","true"),a.placeholder="Type a command or search\u2026",o.appendChild(a);let c=e.createElement("ul");c.className="scalebun-palette-list",c.setAttribute("role","listbox"),o.appendChild(c),i.appendChild(o);let l=r.slice(),u=0,d=b=>{if(b){if(n.hooks.onCtaClick(b.action),n.hooks.onInteraction(`palette_select:${b.id}`),b.action==="link"&&b.value)try{typeof window!="undefined"&&window.location.assign(b.value)}catch{}n.requestClose("cta")}},p=()=>{if(c.replaceChildren(),l.length===0){let b=e.createElement("li");b.className="scalebun-palette-empty",b.textContent="No matches",c.appendChild(b);return}l.forEach((b,E)=>{let w=e.createElement("li");w.className="scalebun-palette-item"+(E===u?" active":""),w.setAttribute("role","option"),w.setAttribute("aria-selected",String(E===u));let I=e.createElement("span");if(I.className="scalebun-palette-label",I.textContent=b.label,w.appendChild(I),b.hint){let x=e.createElement("span");x.className="scalebun-palette-hint",x.textContent=b.hint,w.appendChild(x)}w.addEventListener("mousemove",()=>{u=E,f()}),w.addEventListener("click",()=>d(b)),c.appendChild(w)})},f=()=>{Array.from(c.children).forEach((b,E)=>{b.classList.toggle("active",E===u),b.setAttribute("aria-selected",String(E===u))})},m=()=>{let b=a.value.trim().toLowerCase();l=b?r.filter(E=>E.label.toLowerCase().includes(b)||E.action.toLowerCase().includes(b)):r.slice(),u=0,p()};a.addEventListener("input",m);let h=b=>{b.key==="Escape"?(b.stopPropagation(),n.requestClose("esc")):b.key==="ArrowDown"?(b.preventDefault(),u=Math.min(l.length-1,u+1),f()):b.key==="ArrowUp"?(b.preventDefault(),u=Math.max(0,u-1),f()):b.key==="Enter"&&(b.preventDefault(),d(l[u]))};o.addEventListener("keydown",h),((y=t.dismiss)==null?void 0:y.backdropClose)!==!1&&i.addEventListener("mousedown",b=>{b.target===i&&n.requestClose("backdrop")});let g=Nt(o,e);return p(),{el:i,afterMount:()=>a.focus(),destroy:()=>{g(),o.removeEventListener("keydown",h),i.remove(),s()}}}var bf=k(()=>{"use strict";Qr()});var yf={};L(yf,{panelSurface:()=>ux});function ux(n){var g,S,v,y,b,E;let{doc:e,variant:t}=n,r=((g=t.surfaceOptions)==null?void 0:g.placement)==="left",s=e.createElement("div");s.className="scalebun-panel "+(r?"scalebun-panel-left":"scalebun-panel-right"),s.setAttribute("role",(v=(S=t.a11y)==null?void 0:S.role)!=null?v:"complementary"),s.setAttribute("aria-label",t.name);let i=e.createElement("div");i.className="scalebun-panel-head";let o=e.createElement("div");if(o.className="scalebun-panel-title",o.textContent=t.name,i.appendChild(o),((y=t.dismiss)==null?void 0:y.xButton)!==!1){let w=e.createElement("button");w.type="button",w.className="scalebun-x",w.setAttribute("aria-label","Close panel"),w.textContent="\xD7",w.addEventListener("click",()=>n.requestClose("x")),i.appendChild(w)}s.appendChild(i);let a=e.createElement("div");a.className="scalebun-panel-thread",a.setAttribute("role","log"),a.setAttribute("aria-live","polite"),s.appendChild(a);let c=(E=(b=t.blocks.find(w=>w.kind==="text"))==null?void 0:b.props)==null?void 0:E.text;typeof c=="string"&&f("assistant",c);let l=e.createElement("form");l.className="scalebun-panel-composer";let u=e.createElement("textarea");u.className="scalebun-panel-input",u.rows=1,u.placeholder="Ask anything\u2026";let d=e.createElement("button");d.type="submit",d.className="scalebun-btn scalebun-btn-primary scalebun-panel-send",d.textContent="Send",l.append(u,d),s.appendChild(l);let p=null;function f(w,I){let x=e.createElement("div");return x.className=`scalebun-bubble scalebun-bubble-${w}`,x.textContent=I,a.appendChild(x),a.scrollTop=a.scrollHeight,x}let m=w=>{w.preventDefault();let I=u.value.trim();I&&(f("user",I),u.value="",n.hooks.onInteraction(`ai_prompt:${I}`),p=f("assistant",""),p.classList.add("streaming"))};l.addEventListener("submit",m);let h={appendAssistant:w=>{var I;p||(p=f("assistant","")),p.textContent=((I=p.textContent)!=null?I:"")+w,a.scrollTop=a.scrollHeight},endAssistant:()=>{p==null||p.classList.remove("streaming"),p=null}};return s.scalebunStream=h,{el:s,destroy:()=>{l.removeEventListener("submit",m),s.remove()}}}var vf=k(()=>{"use strict"});var xf={};L(xf,{checklistSurface:()=>px});function px(n){var E,w,I,x,C,M;let{doc:e,variant:t}=n,r=t.blocks.find(T=>T.kind==="checklist"),s=Array.isArray((E=r==null?void 0:r.props)==null?void 0:E.items)?r.props.items.map(T=>typeof T=="string"?{id:T,label:T}:T):[],i=(I=(w=t.blocks.find(T=>T.kind==="heading"))==null?void 0:w.props)==null?void 0:I.text,o=new Set;try{let T=localStorage.getItem(wf(t.id));if(T)for(let A of JSON.parse(T))o.add(A)}catch{}let a=()=>{try{localStorage.setItem(wf(t.id),JSON.stringify([...o]))}catch{}},c=e.createElement("div");c.className="scalebun-checklist",c.setAttribute("role",(C=(x=t.a11y)==null?void 0:x.role)!=null?C:"complementary"),c.setAttribute("aria-label",t.name);let l=e.createElement("div");l.className="scalebun-cl-head";let u=e.createElement("div");u.className="scalebun-cl-title",u.textContent=typeof i=="string"?i:t.name,l.appendChild(u);let d=e.createElement("button");d.type="button",d.className="scalebun-x scalebun-cl-dock",d.setAttribute("aria-label","Minimize"),d.textContent="\u2014";let p=!1;if(d.addEventListener("click",()=>{p=!p,c.classList.toggle("collapsed",p),d.textContent=p?"\u25A2":"\u2014"}),l.appendChild(d),((M=t.dismiss)==null?void 0:M.xButton)!==!1){let T=e.createElement("button");T.type="button",T.className="scalebun-x",T.setAttribute("aria-label","Dismiss"),T.textContent="\xD7",T.addEventListener("click",()=>n.requestClose("x")),l.appendChild(T)}c.appendChild(l);let f=e.createElement("div");f.className="scalebun-cl-bar";let m=e.createElement("div");m.className="scalebun-cl-fill",f.appendChild(m);let h=e.createElement("div");h.className="scalebun-cl-count",c.append(f,h);let g=e.createElement("ul");g.className="scalebun-cl-list",c.appendChild(g);let S=!1,v=()=>{let T=s.length||1,A=s.filter(O=>o.has(O.id)).length;m.style.width=`${Math.round(A/T*100)}%`,h.textContent=`${A} of ${s.length} complete`,g.replaceChildren();for(let O of s){let z=e.createElement("li");z.className="scalebun-cl-item"+(o.has(O.id)?" done":"");let D=e.createElement("button");D.type="button",D.className="scalebun-cl-check",D.setAttribute("role","checkbox"),D.setAttribute("aria-checked",String(o.has(O.id))),D.textContent=o.has(O.id)?"\u2713":"",D.addEventListener("click",()=>y(O.id));let te=e.createElement("span");te.className="scalebun-cl-label",te.textContent=O.label,z.append(D,te),g.appendChild(z)}A>=s.length&&s.length>0&&!S?(S=!0,c.classList.add("complete"),n.hooks.onInteraction("checklist_complete")):A<s.length&&(S=!1,c.classList.remove("complete"))},y=T=>{o.has(T)?o.delete(T):o.add(T),a(),n.hooks.onInteraction(`checklist_step:${T}`),v()},b=T=>{!o.has(T)&&s.some(A=>A.id===T)&&(o.add(T),a(),v())};return c.scalebunChecklist={completeStep:b},v(),{el:c,destroy:()=>c.remove()}}var wf,Sf=k(()=>{"use strict";wf=n=>`scalebun_inapp_checklist_${n}`});var kf={};L(kf,{takeoverSurface:()=>mx});function mx(n){var m,h,g,S,v;let{doc:e,variant:t}=n,r=(m=t.a11y)!=null?m:{},s=(h=t.dismiss)!=null?h:{},i=Bt(e),o=e.createElement("div");o.className="scalebun-takeover",o.setAttribute("role",(g=r.role)!=null?g:"dialog"),o.setAttribute("aria-modal","true");let a=e.createElement("div");a.className="scalebun-takeover-inner";let c=oe(n),l=c.find(y=>y.classList.contains("scalebun-h"));if(l){let y=`scalebun-tk-${++fx}`;l.id=y,o.setAttribute("aria-labelledby",y)}else o.setAttribute("aria-label",t.name);if(s.xButton===!0){let y=e.createElement("button");y.type="button",y.className="scalebun-x scalebun-takeover-x",y.setAttribute("aria-label","Close"),y.textContent="\xD7",y.addEventListener("click",()=>n.requestClose("x")),a.appendChild(y)}for(let y of c)a.appendChild(y);o.appendChild(a);let u=y=>{y.key==="Escape"&&s.escClose===!0&&(y.stopPropagation(),n.requestClose("esc"))};o.addEventListener("keydown",u);let d=Nt(o,e),p=(v=(S=n.host.shadowRoot)==null?void 0:S.host)!=null?v:o,f=Jr(p,e);return{el:o,afterMount:()=>Yr(o),destroy:()=>{d(),f(),o.removeEventListener("keydown",u),o.remove(),i()}}}var fx,Ef=k(()=>{"use strict";Re();Qr();fx=0});var If={};L(If,{launcherSurface:()=>hx});function hx(n){var u,d,p,f;let{doc:e,variant:t}=n,r=(d=(u=t.surfaceOptions)==null?void 0:u.commands)!=null?d:[],s=(f=(p=t.blocks.find(m=>m.kind==="heading"||m.kind==="text"))==null?void 0:p.props)==null?void 0:f.text,i=e.createElement("div");i.className="scalebun-launcher";let o=e.createElement("div");o.className="scalebun-launcher-menu",o.setAttribute("role","menu"),o.hidden=!0;let a=e.createElement("button");a.type="button",a.className="scalebun-launcher-fab",a.setAttribute("aria-label",typeof s=="string"?s:t.name),a.setAttribute("aria-haspopup","true"),a.setAttribute("aria-expanded","false"),a.textContent="?";let c=!1,l=m=>{c=m,o.hidden=!m,a.setAttribute("aria-expanded",String(m)),a.textContent=m?"\xD7":"?"};a.addEventListener("click",()=>l(!c));for(let m of r){let h=e.createElement("button");h.type="button",h.className="scalebun-launcher-item",h.setAttribute("role","menuitem"),h.textContent=m.label,h.addEventListener("click",()=>{if(n.hooks.onCtaClick(m.action),n.hooks.onInteraction(`launcher_select:${m.id}`),m.action==="link"&&m.value)try{typeof window!="undefined"&&window.location.assign(m.value)}catch{}l(!1)}),o.appendChild(h)}return i.append(o,a),{el:i,destroy:()=>i.remove()}}var Cf=k(()=>{"use strict"});var Rf={};L(Rf,{ShadowHost:()=>ln,applyThemeVars:()=>is,resolveScheme:()=>Tf});function Tf(n){if(n==="light"||n==="dark")return n;try{return typeof matchMedia!="undefined"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch{return"light"}}function is(n,e){let t=bx[Tf(e)];for(let[r,s]of Object.entries(t))n.style.setProperty(r,s)}var gx,Af,bx,ln,os=k(()=>{"use strict";$();gx="scalebun-inapp-host",Af=`
539
539
  :host{ all: initial; }
540
540
  .layer{
541
541
  position: fixed; inset: 0; z-index: 2147483600;
@@ -560,7 +560,7 @@ ${Nv(n)}`,s.appendChild(u);let d=document.createElement("div");d.className="ov";
560
560
  negative offset and was being sliced off by the screen edge. */
561
561
  .zone-center{ top: 16px; inset-inline-end: 16px; }
562
562
  @media (prefers-reduced-motion: reduce){ .layer *{ animation: none !important; transition: none !important; } }
563
- `,bx={light:{"--scalebun-bg":"#ffffff","--scalebun-fg":"#111827","--scalebun-muted":"#6b7280","--scalebun-border":"#e5e7eb","--scalebun-accent":"#4f46e5","--scalebun-accent-fg":"#ffffff","--scalebun-shadow":"0 10px 40px rgba(0,0,0,.15)","--scalebun-radius":"12px"},dark:{"--scalebun-bg":"#1f2430","--scalebun-fg":"#f3f4f6","--scalebun-muted":"#9aa3b2","--scalebun-border":"#333b4a","--scalebun-accent":"#7c83ff","--scalebun-accent-fg":"#0b0d12","--scalebun-shadow":"0 10px 40px rgba(0,0,0,.5)","--scalebun-radius":"12px"}};cn=class{constructor(){this.zones=new Map;this.mode="auto";this.adoptedIds=new Set}ensure(){var s,i;if(this.host||typeof document=="undefined")return;let e=document.createElement("div");e.id=gx,e.setAttribute("data-scalebun","inapp"),e.style.cssText="all: initial; position: static;",this.host=e;let t=e.attachShadow({mode:"open"});if(this.root=t,typeof CSSStyleSheet!="undefined"&&"adoptedStyleSheets"in t)try{let o=new CSSStyleSheet;o.replaceSync(Rf),t.adoptedStyleSheets=[o],this.sheet=o}catch{this.injectStyleTag(t)}else this.injectStyleTag(t);let r=document.createElement("div");r.className="layer",r.setAttribute("role","presentation"),t.appendChild(r),this.layer=r,document.body.appendChild(e),this.applyTheme(),typeof matchMedia!="undefined"&&(this.mql=matchMedia("(prefers-color-scheme: dark)"),this.onScheme=()=>{this.mode==="auto"&&this.applyTheme()},(i=(s=this.mql).addEventListener)==null||i.call(s,"change",this.onScheme))}injectStyleTag(e){let t=vt(document.createElement("style"));t.textContent=Rf,e.appendChild(t)}addStyles(e,t){if(this.ensure(),this.adoptedIds.has(e)||!this.root)return;this.adoptedIds.add(e);let r=this.root;if(typeof CSSStyleSheet!="undefined"&&"adoptedStyleSheets"in r)try{let i=new CSSStyleSheet;i.replaceSync(t);let o=r.adoptedStyleSheets;r.adoptedStyleSheets=[...o,i];return}catch{}let s=vt(document.createElement("style"));s.setAttribute("data-scalebun-styles",e),s.textContent=t,r.appendChild(s)}setTheme(e){this.mode=e,this.ensure(),this.applyTheme()}applyTheme(){this.host&&is(this.host,this.mode)}element(){return this.host}zone(e){var s;this.ensure();let t=this.zones.get(e);if(t)return t;t=document.createElement("div");let r=e.startsWith("inline:")?"inline":e;return t.className=`zone zone-${r}`,t.setAttribute("data-zone",e),(s=this.layer)==null||s.appendChild(t),this.zones.set(e,t),t}destroy(){var e,t,r;this.mql&&this.onScheme&&((t=(e=this.mql).removeEventListener)==null||t.call(e,"change",this.onScheme)),this.onScheme=void 0,this.mql=void 0,this.zones.clear(),(r=this.host)==null||r.remove(),this.host=void 0,this.root=void 0,this.layer=void 0,this.sheet=void 0}get shadowRoot(){return this.root}}});var Pf={};L(Pf,{mountInline:()=>vx});function vx(n,e,t,r={}){var d,p;let s=(p=(d=e.surfaceOptions)==null?void 0:d.slot)!=null?p:"default",i=null,o=()=>{},a=!1,c=(f="x")=>{a||(a=!0,u(),o(),i&&(t.onDismiss(f),i.remove(),i=null))},l=f=>{var v,y,b,w;if(a||i)return;let m=f.ownerDocument;i=m.createElement("div"),i.className="scalebun-inline-host",is(i,(v=r.theme)!=null?v:"auto");let h=i.attachShadow({mode:"open"});Ne(h,Hr+yx);let g=m.createElement("div");g.className="scalebun-inline",g.setAttribute("role",(b=(y=e.a11y)==null?void 0:y.role)!=null?b:"region"),g.setAttribute("aria-label",e.name);let S=ao({doc:m,hooks:t,requestClose:x=>c(x)});for(let x of zr(e.blocks,S))g.appendChild(x);if((w=e.dismiss)!=null&&w.xButton){let x=m.createElement("button");x.type="button",x.className="scalebun-x",x.setAttribute("aria-label","Dismiss"),x.textContent="\xD7",x.addEventListener("click",()=>c("x")),g.appendChild(x)}h.appendChild(g),f.appendChild(i),t.onImpression(),o=Vr(g,t.onView)},u=n.whenAvailable(s,l);return{close:()=>c("x"),mounted:()=>i!=null}}var yx,Lf=E(()=>{"use strict";$();os();io();Te();Ur();yx=`
563
+ `,bx={light:{"--scalebun-bg":"#ffffff","--scalebun-fg":"#111827","--scalebun-muted":"#6b7280","--scalebun-border":"#e5e7eb","--scalebun-accent":"#4f46e5","--scalebun-accent-fg":"#ffffff","--scalebun-shadow":"0 10px 40px rgba(0,0,0,.15)","--scalebun-radius":"12px"},dark:{"--scalebun-bg":"#1f2430","--scalebun-fg":"#f3f4f6","--scalebun-muted":"#9aa3b2","--scalebun-border":"#333b4a","--scalebun-accent":"#7c83ff","--scalebun-accent-fg":"#0b0d12","--scalebun-shadow":"0 10px 40px rgba(0,0,0,.5)","--scalebun-radius":"12px"}};ln=class{constructor(){this.zones=new Map;this.mode="auto";this.adoptedIds=new Set}ensure(){var s,i;if(this.host||typeof document=="undefined")return;let e=document.createElement("div");e.id=gx,e.setAttribute("data-scalebun","inapp"),e.style.cssText="all: initial; position: static;",this.host=e;let t=e.attachShadow({mode:"open"});if(this.root=t,typeof CSSStyleSheet!="undefined"&&"adoptedStyleSheets"in t)try{let o=new CSSStyleSheet;o.replaceSync(Af),t.adoptedStyleSheets=[o],this.sheet=o}catch{this.injectStyleTag(t)}else this.injectStyleTag(t);let r=document.createElement("div");r.className="layer",r.setAttribute("role","presentation"),t.appendChild(r),this.layer=r,document.body.appendChild(e),this.applyTheme(),typeof matchMedia!="undefined"&&(this.mql=matchMedia("(prefers-color-scheme: dark)"),this.onScheme=()=>{this.mode==="auto"&&this.applyTheme()},(i=(s=this.mql).addEventListener)==null||i.call(s,"change",this.onScheme))}injectStyleTag(e){let t=vt(document.createElement("style"));t.textContent=Af,e.appendChild(t)}addStyles(e,t){if(this.ensure(),this.adoptedIds.has(e)||!this.root)return;this.adoptedIds.add(e);let r=this.root;if(typeof CSSStyleSheet!="undefined"&&"adoptedStyleSheets"in r)try{let i=new CSSStyleSheet;i.replaceSync(t);let o=r.adoptedStyleSheets;r.adoptedStyleSheets=[...o,i];return}catch{}let s=vt(document.createElement("style"));s.setAttribute("data-scalebun-styles",e),s.textContent=t,r.appendChild(s)}setTheme(e){this.mode=e,this.ensure(),this.applyTheme()}applyTheme(){this.host&&is(this.host,this.mode)}element(){return this.host}zone(e){var s;this.ensure();let t=this.zones.get(e);if(t)return t;t=document.createElement("div");let r=e.startsWith("inline:")?"inline":e;return t.className=`zone zone-${r}`,t.setAttribute("data-zone",e),(s=this.layer)==null||s.appendChild(t),this.zones.set(e,t),t}destroy(){var e,t,r;this.mql&&this.onScheme&&((t=(e=this.mql).removeEventListener)==null||t.call(e,"change",this.onScheme)),this.onScheme=void 0,this.mql=void 0,this.zones.clear(),(r=this.host)==null||r.remove(),this.host=void 0,this.root=void 0,this.layer=void 0,this.sheet=void 0}get shadowRoot(){return this.root}}});var Mf={};L(Mf,{mountInline:()=>vx});function vx(n,e,t,r={}){var d,p;let s=(p=(d=e.surfaceOptions)==null?void 0:d.slot)!=null?p:"default",i=null,o=()=>{},a=!1,c=(f="x")=>{a||(a=!0,u(),o(),i&&(t.onDismiss(f),i.remove(),i=null))},l=f=>{var v,y,b,E;if(a||i)return;let m=f.ownerDocument;i=m.createElement("div"),i.className="scalebun-inline-host",is(i,(v=r.theme)!=null?v:"auto");let h=i.attachShadow({mode:"open"});Ne(h,Hr+yx);let g=m.createElement("div");g.className="scalebun-inline",g.setAttribute("role",(b=(y=e.a11y)==null?void 0:y.role)!=null?b:"region"),g.setAttribute("aria-label",e.name);let S=co({doc:m,hooks:t,requestClose:w=>c(w)});for(let w of zr(e.blocks,S))g.appendChild(w);if((E=e.dismiss)!=null&&E.xButton){let w=m.createElement("button");w.type="button",w.className="scalebun-x",w.setAttribute("aria-label","Dismiss"),w.textContent="\xD7",w.addEventListener("click",()=>c("x")),g.appendChild(w)}h.appendChild(g),f.appendChild(i),t.onImpression(),o=Vr(g,t.onView)},u=n.whenAvailable(s,l);return{close:()=>c("x"),mounted:()=>i!=null}}var yx,Pf=k(()=>{"use strict";$();os();oo();Re();Ur();yx=`
564
564
  :host{ display:block; }
565
565
  .scalebun-inline{ position:relative; background:var(--scalebun-bg); color:var(--scalebun-fg);
566
566
  border:1px solid var(--scalebun-border); border-radius:var(--scalebun-radius); padding:18px; }
@@ -568,7 +568,7 @@ ${Nv(n)}`,s.appendChild(u);let d=document.createElement("div");d.className="ov";
568
568
  .scalebun-inline .scalebun-x{ position:absolute; top:8px; inset-inline-end:8px; background:none; border:0;
569
569
  color:var(--scalebun-muted); cursor:pointer; font-size:16px; border-radius:6px; }
570
570
  .scalebun-inline .scalebun-h{ padding-inline-end:24px; }
571
- `});var Of={};L(Of,{SURFACE_LOADERS:()=>Io,isSurfaceSupported:()=>wx,renderVariant:()=>Co});function wx(n){return n==="inline"||n in Io}async function Co(n,e,t){var a;let r=Fp(((a=n.blocks)!=null?a:[]).map(c=>c.kind));if(n.surface==="inline"){if(!t.slots)return await r,_f(n.id);let[{mountInline:c}]=await Promise.all([Promise.resolve().then(()=>(Lf(),Pf)),r]),l=c(t.slots,n,e);return{variantId:n.id,close:()=>l.close()}}let s=Io[n.surface];if(!s)return await r,_f(n.id);let[i]=await Promise.all([s(),r]),o=Zu(t.host,n,i,e,t.metrics);return{variantId:n.id,close:()=>o.close("x")}}function _f(n){return{variantId:n,close:()=>{}}}var Io,Ao=E(()=>{"use strict";ep();Dp();Io={banner:()=>Promise.resolve().then(()=>(Hp(),qp)).then(n=>n.bannerSurface),toast:()=>Promise.resolve().then(()=>(zp(),$p)).then(n=>n.toastSurface),modal:()=>Promise.resolve().then(()=>(Wp(),Vp)).then(n=>n.modalSurface),slideover:()=>Promise.resolve().then(()=>(Yp(),Xp)).then(n=>n.slideoverSurface),popover:()=>Promise.resolve().then(()=>(rf(),nf)).then(n=>n.popoverSurface),coachmark:()=>Promise.resolve().then(()=>(of(),sf)).then(n=>n.coachmarkSurface),tour:()=>Promise.resolve().then(()=>(pf(),uf)).then(n=>n.tourSurface),hotspot:()=>Promise.resolve().then(()=>(mf(),ff)).then(n=>n.hotspotSurface),toolbar:()=>Promise.resolve().then(()=>(gf(),hf)).then(n=>n.toolbarSurface),palette:()=>Promise.resolve().then(()=>(yf(),bf)).then(n=>n.paletteSurface),panel:()=>Promise.resolve().then(()=>(wf(),vf)).then(n=>n.panelSurface),checklist:()=>Promise.resolve().then(()=>(kf(),Sf)).then(n=>n.checklistSurface),takeover:()=>Promise.resolve().then(()=>(If(),Ef)).then(n=>n.takeoverSurface),launcher:()=>Promise.resolve().then(()=>(Af(),Cf)).then(n=>n.launcherSurface)}});function Ff(n){Mo=n}function Po(n){try{To==null||To(n)}catch{}}function Df(n,e){let t=typeof e=="string"&&e?e:null;return t?xx.has(t)?t:null:n&&kx[n]||null}function qf(n){var t;let e=(t=n==null?void 0:n.ext)==null?void 0:t.archetype;return typeof e=="string"&&e?e:void 0}function Lo(n,e){let t=qf(e!=null?e:n.spec);return Df(n.variantKey,t)?!0:t?(Ex.has(t)||Po({variantKey:n.variantKey,reason:"unrenderable",archetype:t}),!1):(n.variantKey&&Po({variantKey:n.variantKey,reason:"unmapped"}),!1)}function Cx(n){var t;let e=B(n.mountModel);if(!e)return null;if(e==="inline"){let r=Dr(n);return!r||!to(n)?(Po({reason:"unrenderable",archetype:"inline"}),null):{surface:"inline",surfaceOptions:{slot:r}}}return(t=Ix[e])!=null?t:null}function Px(n,e,t,r,s){var i,o,a,c,l,u,d,p,f,m,h,g,S,v,y,b,w,x,I,k,C,M,R,A,O,z,D,te,J,Q,fe,ce,xe,Se,le,q,V,K,de,me,se,Ue,Ve;switch(n){case"spinWheel":{let G=ue(e,["segments","prizes","rewards"]);return[{kind:"spinwheel",props:{segments:G.map(pe).filter(Boolean),resultIndex:Rx(G,e)}}]}case"scratchReveal":return[{kind:"scratch",props:{prize:(u=B((l=(c=(a=(o=(i=e.prize)!=null?i:e.reward)!=null?o:e.rewardValue)!=null?a:e.rewardResult)!=null?c:e.resultReward)!=null?l:e.coupon))!=null?u:"You won!",reveal:r==="mystery_box"?"box":"scratch"}}];case"slotReward":{let G=ue(e,["resultSymbols","result","winningSymbols"]).map(pe).filter(Boolean);return[{kind:"slot",props:{symbols:ue(e,["symbols","reels","slotItems"]).map(pe).filter(Boolean),...G.length?{result:G.slice(0,3)}:{}}}]}case"countdown":return[{kind:"countdown",props:Tx(e)}];case"celebration":return[{kind:"confetti",props:{}}];case"qrNfc":return[{kind:"qr",props:{value:(m=(f=(p=(d=B(e.url))!=null?d:B(e.link))!=null?p:B(e.qrValue))!=null?f:B(e.deepLink))!=null?m:"https://app.example.com"}}];case"carouselDeck":{let G=ue(e,["slides","cards","items","steps"]);return[{kind:"carousel",props:{slides:(G.length?G:[{},{},{}]).map(Y=>{var ee,T,_;let X=ae(Y);return{image:B((ee=X.image)!=null?ee:X.imageUrl),title:pe(Y),text:B((_=(T=X.text)!=null?T:X.body)!=null?_:X.subtitle)}})}}]}case"questionFlow":{let G=ue(e,["questions","steps"]),ie=ae(G[0]),Y=(w=(b=(y=B((g=(h=e.question)!=null?h:e.promptText)!=null?g:e.prompt))!=null?y:B((v=(S=ie.prompt)!=null?S:ie.question)!=null?v:ie.label))!=null?b:t)!=null?w:"Tell us",X=ue(e,["options","preferenceOptions","pollOptions","answers","choices","reactions"]),ee=X.length?X:ue(ie,["options","answers","choices"]),T=(ee.length?ee:[{label:"Option A"},{label:"Option B"}]).map((_,N)=>({id:String(N),label:pe(_)}));switch(r){case"nps_prompt":return[{kind:"nps",props:{question:Y}}];case"rating_request":return[{kind:"rating",props:{question:Y,max:Ro(Number((x=e.max)!=null?x:e.scale),5)}}];case"emoji_reaction_bar":{let _=ue(e,["emojis","reactions","options"]).map(N=>{var F;return typeof N=="string"?N:(F=B(ae(N).emoji))!=null?F:pe(N)}).filter(Boolean);return[{kind:"emoji",props:{question:Y,..._.length?{emojis:_}:{}}}]}case"quiz_card":{let _=ae((I=e.outcome)!=null?I:e.quizOutcome),N=B((k=_.answeredId)!=null?k:e.answeredId),F=B((C=_.correctId)!=null?C:e.correctId);return[{kind:"quiz",props:{question:Y,options:T,...N||F?{outcome:{answeredId:N,correctId:F}}:{}}}]}default:return[{kind:"poll",props:{question:Y,options:T}}]}}case"checklistProgress":{let G=ue(e,["steps","items","tasks","checklist"]),ie=G.length?G:["Step one","Step two","Step three"],Y=ie.map((_,N)=>{let F=ae(_);return{id:String(N),label:pe(_),done:F.done===!0||F.checked===!0||F.complete===!0}}),X=Ax((A=(R=(M=e.progress)!=null?M:e.percent)!=null?R:e.progressValue)!=null?A:e.currentValue,40),ee={kind:"progress",props:{value:X}},T=B((z=(O=e.reward)!=null?O:e.prize)!=null?z:e.rewardValue);switch(r){case"streak_reward":case"daily_check_in":{let _=r==="daily_check_in",N=ue(e,["calendarDays","dayLabels","days"]),F=N.map(pe).filter(Boolean),W=N.filter(Ce=>{let Ae=ae(Ce);return Ae.done===!0||Ae.checked===!0||Ae.complete===!0}).length,re=Ro(Number((J=(te=(D=e.filled)!=null?D:e.currentStreak)!=null?te:e.streakValue)!=null?J:e.streakValueSource),W),ge=N.findIndex(Ce=>ae(Ce).today===!0),he=[{kind:"streak",props:{mode:_?"checkin":"streak",filled:re,...ge>=0?{today:ge+1}:{},...F.length?{labels:F}:{days:Ro(Number((Q=e.days)!=null?Q:e.calendarLength),7)},..._&&e.alreadyCheckedIn===!0?{today:-1}:{}}}];return T&&he.push({kind:"callout",props:{icon:"\u{1F381}",text:T}}),he}case"progress_unlock":{let _=X>=100,N=[ee];return T&&N.push({kind:"callout",props:{icon:_?"\u{1F389}":"\u{1F512}",text:_?T:`Unlock ${T}`}}),N}case"goal_tracker":{let _=Number((ce=(fe=e.currentValue)!=null?fe:e.progressValue)!=null?ce:e.current),N=Number((le=(Se=(xe=e.target)!=null?xe:e.goal)!=null?Se:e.targetValue)!=null?le:e.goalValue),F=[ee];return F.push({kind:"stat",props:{value:Number.isFinite(_)?Number.isFinite(N)?`${_} / ${N}`:_:`${Math.round(X)}%`,label:(K=B((V=(q=e.goalLabel)!=null?q:e.unit)!=null?V:e.goalSource))!=null?K:"Progress"}}),F}case"community_challenge":{let _=Number((me=(de=e.participants)!=null?de:e.members)!=null?me:e.joined),N=[ee];return Number.isFinite(_)&&N.push({kind:"stat",props:{value:_,label:(se=B(e.participantsLabel))!=null?se:"taking part"}}),G.length&&N.push({kind:"list",props:{items:Y.map(F=>({label:F.label}))}}),N}case"guided_setup_wizard":case"first_session_onboarding":return[{kind:"steps",props:{steps:ie.map(N=>{var W,re;let F=ae(N);return{title:pe(N)||void 0,body:B((re=(W=F.body)!=null?W:F.text)!=null?re:F.subtitle)}}),backLabel:B(e.backLabel),skipLabel:B(e.skipLabel),nextLabel:B(e.nextLabel),finalLabel:B(e.finalLabel)}}];default:return[ee,{kind:"checklist",props:{items:Y}}]}}case"multiStepSheet":{let G=ue(e,["steps","pages","items","screens"]);return[{kind:"steps",props:{steps:(G.length?G:[{}]).map(Y=>{var ee,T;let X=ae(Y);return{title:pe(Y)||void 0,body:B((T=(ee=X.body)!=null?ee:X.text)!=null?T:X.subtitle)}}),backLabel:B(e.backLabel),skipLabel:B(e.skipLabel),nextLabel:B(e.nextLabel),finalLabel:B(e.finalLabel)}}]}case"sideSheet":return Bf(e,s);case"videoCommerce":{let G=[],ie=B(e.video);ie&&G.push({kind:"video",props:{src:ie}});let Y=ue(e,["products","items"]).map(ee=>{var _,N,F;let T=ae(ee);return{id:String((_=T.id)!=null?_:""),image:B((N=T.image)!=null?N:T.imageUrl),title:pe(ee),price:(F=T.price)!=null?F:T.amount}}),X=B(e.productTitle);return!Y.length&&X&&Y.push({id:"product",image:B((Ue=e.productImage)!=null?Ue:e.image),title:X,price:(Ve=e.price)!=null?Ve:e.amount}),G.push({kind:"product-grid",props:{products:Y}}),G}default:return Bf(e,s)}}function Lx(n,e){var u,d,p,f,m,h,g,S,v,y,b,w,x,I,k,C,M,R,A,O,z,D,te,J,Q,fe,ce,xe,Se,le;let t=[],r=[],s=B((R=(M=(C=(k=(I=(x=(w=(b=(y=(v=(S=(g=(h=(m=(f=(p=(d=(u=n.benefitMessage)!=null?u:n.segmentExplanation)!=null?d:n.availabilityMessage)!=null?p:n.rewardMessage)!=null?f:n.offerMessage)!=null?m:n.proofMessage)!=null?h:n.valueMessage)!=null?g:n.reviewMessage)!=null?S:n.assistantMessage)!=null?v:n.supportMessage)!=null?y:n.arrivalMessage)!=null?b:n.checkoutMessage)!=null?w:n.instruction)!=null?x:n.instructions)!=null?I:n.closedMessage)!=null?k:n.reasonText)!=null?C:n.motivationalText)!=null?M:n.urgencyNote)!=null?R:n.subtitle);s&&s!==e&&t.push({kind:"text",props:{text:s}});let i=ue(n,["actions","ctas"]).map(q=>{var K;let V=ae(q);return{label:pe(q),action:(K=B(V.action))!=null?K:"dismiss",deepLink:B(V.deepLink),variant:"secondary"}}).filter(q=>q.label);i.length&&r.push({kind:"cta",props:{actions:i}});let o=B((fe=(Q=(J=(te=(D=(z=(O=(A=n.price)!=null?A:n.eventTime)!=null?O:n.dateTime)!=null?z:n.goal)!=null?D:n.documentType)!=null?te:n.lastOrderDate)!=null?J:n.reward)!=null?Q:n.rewardTitle)!=null?fe:n.resultReward);o&&r.push({kind:"badge",props:{text:o}});let a=B((ce=n.eventTitle)!=null?ce:n.passTitle);a&&a!==e&&t.push({kind:"callout",props:{icon:"\u{1F39F}\uFE0F",text:a}});let c=B((xe=n.avatar)!=null?xe:n.avatarUrl);c&&t.unshift({kind:"image",props:{src:c,alt:""}});let l=B(n.itemName);if(l){let q=B(n.oldPrice),V=B(n.newPrice),K=q&&V?`${q} \u2192 ${V}`:(le=(Se=V!=null?V:q)!=null?Se:B(n.stockStatus))!=null?le:B(n.quantity);r.push({kind:"callout",props:{icon:"\u{1F3F7}\uFE0F",text:K?`${l} \xB7 ${K}`:l}})}return{lead:t,trail:r}}function Bf(n,e){let t=[],r=ue(n,["bullets","bulletList","benefits","features","newFeatures","perks","perksList","reasonList","digestItems","contentSections","contentBlocks","suggestedActions","points","highlights","dateTimeOptions","tabs","slots"]).map(pe).filter(Boolean);r.length&&t.push({kind:"list",props:{items:r}});let s=ue(n,["plans","planCards","tiers","pricingTiers","packages"]);s.length&&t.push({kind:"table",props:{columns:["Plan","Price"],rows:s.map(a=>{var l,u;let c=ae(a);return[pe(a),String((u=(l=c.price)!=null?l:c.amount)!=null?u:"")]})}});let i=ue(n,["products","productList","productCards","productImages","crossSellItems","recommendations","bundleItems","cartItems","itemList","relatedItems"]);i.length&&t.push({kind:"product-grid",props:{products:i.map(a=>{var l,u,d;let c=ae(a);return{id:String((l=c.id)!=null?l:""),image:B((u=c.image)!=null?u:c.imageUrl),title:pe(a),price:(d=c.price)!=null?d:c.amount}})}});let o=ue(n,["steps","setupSteps","tasks","checklistItems","checklist"]);return o.length&&t.push({kind:"checklist",props:{items:o.map((a,c)=>({id:String(c),label:pe(a),done:ae(a).done===!0}))}}),t}function _x(n,e){var f,m,h,g,S,v,y,b,w,x,I,k,C,M,R,A,O,z,D,te,J;let t=(f=Df(n.variantKey,qf(e)))!=null?f:"",r=ae(e.ext),s=(g=(h=(m=Sx[t])!=null?m:Cx(r))!=null?h:Nf[n.layout])!=null?g:Nf.modal,i=B((S=r.sidePosition)!=null?S:r.position),o=t==="sideSheet"&&(i==="left"||i==="right")?{...s,surfaceOptions:{...s.surfaceOptions,placement:i}}:s,a=[];e.imageUrl&&a.push({kind:"image",props:{src:e.imageUrl,alt:(v=e.title)!=null?v:""}});let c=B((y=r.eyebrow)!=null?y:r.badge);c&&c!==e.title&&c.length<32&&a.push({kind:"badge",props:{text:c}});let l=(R=B(e.title))!=null?R:B((M=(C=(k=(I=(x=(w=(b=r.eventTitle)!=null?b:r.passTitle)!=null?w:r.expandedTitle)!=null?x:r.subject)!=null?I:r.vipTitle)!=null?k:r.offerTitle)!=null?C:r.bubbleLabel)!=null?M:r.peekLabel),u=(A=B(e.body))!=null?A:B(r.expandedBody);l&&a.push({kind:"heading",props:{text:l}}),u&&a.push({kind:"text",props:{text:u}});let d=Lx(r,u);a.push(...d.lead),a.push(...Px(t,r,l,n.variantKey,u)),a.push(...d.trail);let p=[];return(O=e.cta)!=null&&O.label&&p.push({label:e.cta.label,action:(z=e.cta.action)!=null?z:"dismiss",deepLink:e.cta.deepLink,variant:"primary"}),(D=e.secondaryCta)!=null&&D.label&&p.push({label:e.secondaryCta.label,action:"dismiss",variant:"dismiss"}),p.length&&a.push({kind:"cta",props:{actions:p}}),a.length===0&&a.push({kind:"text",props:{text:e.body}}),{id:n.id,key:(te=n.variantKey)!=null?te:n.id,name:(J=e.title)!=null?J:n.id,category:"misc",platforms:["web"],surface:o.surface,surfaceOptions:o.surfaceOptions,blocks:a,priority:"normal",triggers:[{type:"manual"}],dismiss:{xButton:!0,escClose:!0,backdropClose:!0}}}function Nx(n,e){var s;let t=(s=e.ext)==null?void 0:s.animationIn,r=typeof t=="string"?Ox[t]:void 0;r&&n.style.setProperty("--scalebun-anim-in",r)}function Bx(n,e){let t=$i(e.style),r=(s,i)=>{i&&n.style.setProperty(s,i)};r("--scalebun-accent",t.accent),r("--scalebun-bg",t.cardBg),r("--scalebun-fg",t.bodyColor),r("--scalebun-title",t.titleColor),t.accent?r("--scalebun-accent-fg",zi(t.accent,t.ctaText)):r("--scalebun-accent-fg",t.ctaText)}async function Hf(n,e,t){var m;let[{renderVariant:r},{ShadowHost:s}]=await Promise.all([Promise.resolve().then(()=>(Ao(),Of)),Promise.resolve().then(()=>(os(),Mf))]),i=new s;i.ensure(),e.dark===!0&&i.setTheme("dark");let o=i.element();o&&(Bx(o,e),Nx(o,e));let a=ae(e.ext),c=Nu({campaignId:n.id,variantKey:(m=n.variantKey)!=null?m:"",ext:a,preview:n.preview===!0||n.isTest===!0,...Mo?{handler:Mo}:{}});if(c&&Tu(n.variantKey)==="load"){let h=await c(1);h.ok&&h.state&&Object.assign(a,h.state)}let l=_x(n,e),u=!1,d=!1,p=()=>{d||(d=!0,queueMicrotask(()=>{try{i.destroy()}catch{}}))},f=await r(l,{onImpression(){},onView(){},onCtaClick(){u||(u=!0,t.onClick())},onInteraction(){},onDismiss(){u||(u=!0,t.onDismiss()),p()},...c?{requestOutcome:c}:{}},{host:i,slots:Pt});return{close:()=>{try{f.close()}catch{}p()}}}var ae,B,Ro,pe,ue,xx,Sx,kx,To,Mo,Ex,Ix,Nf,Ax,Rx,Tx,Mx,Ox,$f=E(()=>{"use strict";Ui();Bu();no();Zi();ae=n=>n&&typeof n=="object"&&!Array.isArray(n)?n:{},B=n=>typeof n=="string"&&n.length>0?n:void 0,Ro=(n,e)=>typeof n=="number"&&Number.isFinite(n)?n:e,pe=n=>{var t,r,s,i;if(typeof n=="string")return n;let e=ae(n);return(i=(s=(r=(t=B(e.label))!=null?t:B(e.title))!=null?r:B(e.text))!=null?s:B(e.name))!=null?i:""},ue=(n,e)=>{for(let t of e)if(Array.isArray(n[t]))return n[t];return[]},xx=new Set(["spinWheel","scratchReveal","slotReward","carouselDeck","countdown","questionFlow","checklistProgress","qrNfc","videoCommerce","celebration","multiStepSheet","sideSheet"]),Sx={sideSheet:{surface:"slideover",surfaceOptions:{placement:"right"}},multiStepSheet:{surface:"slideover",surfaceOptions:{placement:"bottom"}}},kx={spin_wheel:"spinWheel",scratch_card:"scratchReveal",mystery_box:"scratchReveal",slot_reward:"slotReward",carousel_story:"carouselDeck",swipe_deck:"carouselDeck",countdown_offer:"countdown",poll_card:"questionFlow",survey_sheet:"questionFlow",nps_prompt:"questionFlow",quiz_card:"questionFlow",product_finder:"questionFlow",preferences_picker:"questionFlow",feedback_capture:"questionFlow",emoji_reaction_bar:"questionFlow",rating_request:"questionFlow",progress_unlock:"checklistProgress",streak_reward:"checklistProgress",daily_check_in:"checklistProgress",goal_tracker:"checklistProgress",interactive_checklist:"checklistProgress",guided_setup_wizard:"checklistProgress",first_session_onboarding:"checklistProgress",community_challenge:"checklistProgress",milestone_celebration:"celebration",celebration_confetti_full_screen:"celebration",nfc_qr_prompt:"qrNfc",wallet_pass_offer:"qrNfc",video_commerce_card:"videoCommerce"},To=null,Mo=null;Ex=new Set(["modal","sheet","bannerToast","fullscreen","anchored","inline"]),Ix={overlay:{surface:"modal",surfaceOptions:{placement:"center",size:"md",backdrop:!0}},sheet:{surface:"slideover",surfaceOptions:{placement:"right",resizable:!0}},banner:{surface:"banner",surfaceOptions:{placement:"top"}},fullscreen:{surface:"takeover"},toast:{surface:"toast",surfaceOptions:{placement:"bottom-right"}},bubble:{surface:"toast",surfaceOptions:{placement:"bottom-right"}},anchored:{surface:"popover",surfaceOptions:{placement:"bottom",maxWidth:320}}};Nf={modal:{surface:"modal",surfaceOptions:{placement:"center",size:"md",backdrop:!0}},fullscreen:{surface:"takeover"},bottom_sheet:{surface:"slideover",surfaceOptions:{placement:"bottom"}},top_banner:{surface:"banner",surfaceOptions:{placement:"top"}},bottom_banner:{surface:"banner",surfaceOptions:{placement:"bottom"}},tooltip:{surface:"toast",surfaceOptions:{placement:"bottom-right"}},toast:{surface:"toast",surfaceOptions:{placement:"bottom-right"}}},Ax=(n,e)=>{let t=Number(n);return Number.isFinite(t)?t>0&&t<=1?t*100:t:e},Rx=(n,e)=>{var i,o,a,c,l,u,d;if(!n.length)return 0;for(let p of["resultIndex","winningIndex"]){let f=Number(e[p]);if(Number.isInteger(f)&&f>=0&&f<n.length)return f}let t=p=>{var m,h,g;let f=ae(p);return(g=(h=(m=B(f.id))!=null?m:B(f.segmentId))!=null?h:B(f.key))!=null?g:B(f.value)},r=B((a=(o=(i=e.segmentId)!=null?i:e.winningId)!=null?o:e.resultId)!=null?a:e.outcomeId);if(r){let p=n.findIndex(f=>t(f)===r);if(p>=0)return p}let s=B((d=(u=(l=(c=e.resultState)!=null?c:e.rewardValue)!=null?l:e.prize)!=null?u:e.rewardResult)!=null?d:e.resultReward);if(s){let p=s.trim().toLowerCase(),f=n.findIndex(m=>pe(m).trim().toLowerCase()===p);if(f>=0)return f}return 0},Tx=n=>{var r;let e=Mx(n);if(e)return{target:e};let t=Number((r=n.durationHours)!=null?r:n.hours);return{durationMs:(Number.isFinite(t)&&t>0?t:24)*36e5}},Mx=n=>{var l,u,d,p;let e=(d=(u=(l=B(n.endsAt))!=null?l:B(n.deadline))!=null?u:B(n.to))!=null?d:B(n.endAt);if(e)return e;let t=(p=B(n.expiryTime))!=null?p:B(n.expiresAt);if(!t)return;let r=Date.parse(t);if(Number.isFinite(r))return new Date(r).toISOString();let s=t.split(":").map(f=>Number(f));if(!s.length||s.some(f=>!Number.isFinite(f)))return;let[i=0,o=0,a=0]=s.length===3?s:[0,...s],c=((i*60+o)*60+a)*1e3;return c>0?new Date(Date.now()+c).toISOString():void 0};Ox={fade:"scalebun-fade .18s ease",fade_scale:"scalebun-pop .16s ease",slide_up:"scalebun-slideup .2s ease",slide_down:"scalebun-slidedown .18s ease",slide_in_right:"scalebun-slide-in-r .2s ease"}});var Uf={};L(Uf,{installShakeDetector:()=>qx});function qx(n){if(typeof window=="undefined"||typeof DeviceMotionEvent=="undefined")return()=>{};let e=0,t=!1,r,s=l=>{var h,g,S;let u=l.accelerationIncludingGravity;if(!u)return;let d=((h=u.x)!=null?h:0)/_o,p=((g=u.y)!=null?g:0)/_o,f=((S=u.z)!=null?S:0)/_o;if(Math.sqrt(d*d+p*p+f*f)<Fx)return;let m=P();if(!(m-e<Dx)){e=m;try{n("shake")}catch{}}},i=()=>{t||(t=!0,window.addEventListener("devicemotion",s))},o=()=>{try{return sessionStorage.getItem(zf)}catch{return null}},a=l=>{try{sessionStorage.setItem(zf,l)}catch{}},c=DeviceMotionEvent.requestPermission;if(typeof c=="function"){if(o()==="denied")return()=>{};let l=()=>{r==null||r(),c().then(u=>{a(u==="granted"?"granted":"denied"),u==="granted"&&i()}).catch(()=>{})};window.addEventListener("click",l),window.addEventListener("touchend",l),r=()=>{window.removeEventListener("click",l),window.removeEventListener("touchend",l)}}else i();return()=>{r==null||r(),r=void 0,t&&window.removeEventListener("devicemotion",s),t=!1}}var Fx,Dx,_o,zf,Vf=E(()=>{"use strict";$();Fx=2.3,Dx=1500,_o=9.80665,zf="scalebun_shake_perm"});var Wf={};L(Wf,{EngageRuntime:()=>Oo});var Oo,jf=E(()=>{"use strict";nu();Hi();Cu();Au();$f();Fe();Oo=class{constructor(e){this.deps=e;this.showing=!1;this.startedAt=0;this.campaignsById=new Map;this.shakeInCampaigns=!1;this.shakeInMessages=!1;var t;this.surveys=new en(r=>this.tryShow(r)),this.inapp=new en(r=>this.tryShowInApp(r)),Ff((t=e.gameHandler)!=null?t:null)}setCampaigns(e){this.campaignsById=new Map(e.map(t=>[t.id,t])),this.surveys.setItems(e),this.shakeInCampaigns=e.some(t=>t.trigger==="shake_device"),this.syncShake()}setMessages(e){let t=e.filter(r=>r.preview);this.inapp.setItems(e.filter(r=>!r.preview)),t.length&&this.maybeShowPreview(t),this.shakeInMessages=e.some(r=>r.trigger==="shake_device"),this.syncShake()}async syncShake(){let e=(this.shakeInCampaigns||this.shakeInMessages)&&!!this.deps.signal;if(e&&!this.shakeTeardown){let{installShakeDetector:t}=await Promise.resolve().then(()=>(Vf(),Uf));(this.shakeInCampaigns||this.shakeInMessages)&&this.deps.signal&&!this.shakeTeardown&&(this.shakeTeardown=t(r=>this.deps.signal(r)))}else!e&&this.shakeTeardown&&(this.shakeTeardown(),this.shakeTeardown=void 0)}maybeShowPreview(e){if(this.showing)return;let r=e.filter(o=>!o.testRunId||!Di(o.testRunId)).sort((o,a)=>{var c,l;return((c=a.createdAt)!=null?c:"").localeCompare((l=o.createdAt)!=null?l:"")})[0];if(!r)return;r.testRunId&&qi(r.testRunId),this.showing=!0;let{spec:s,variantId:i}=this.resolveSpec(r);if(this.inappEvent(r,"impression",i,!0),Lo(r,s)){this.showRich(r,s,i,!0);return}this.active=Yi(r.layout,s,{onClick:()=>{this.inappEvent(r,"click",i,!0),this.finishInApp(r,!0)},onDismiss:()=>{this.inappEvent(r,"dismiss",i,!0),this.finishInApp(r,!0)}})}showRich(e,t,r,s=!1){Hf(e,t,{onClick:()=>{this.inappEvent(e,"click",r,s);let a=t.cta;if((a==null?void 0:a.action)==="link"&&a.deepLink&&/^https?:\/\//i.test(a.deepLink))try{window.location.href=a.deepLink}catch{}this.finishInApp(e,s)},onDismiss:()=>{this.inappEvent(e,"dismiss",r,s),this.finishInApp(e,s)}}).then(a=>{this.showing?this.active=a:a.close()}).catch(()=>{this.finish()})}onScreenView(e,t=0){this.surveys.onScreenView(e,t),this.inapp.onScreenView(e,t)}onSignal(e,t=0){this.surveys.onSignal(e,t),this.inapp.onSignal(e,t)}onCustomEvent(e,t=0){this.surveys.onCustomEvent(e,t),this.inapp.onCustomEvent(e,t)}onLifecycle(e,t,r=0){this.surveys.onLifecycle(e,t,r),this.inapp.onLifecycle(e,t,r)}stop(){var e,t;this.surveys.stop(),this.inapp.stop(),(e=this.shakeTeardown)==null||e.call(this),this.shakeTeardown=void 0,(t=this.active)==null||t.close(),this.active=void 0,this.showing=!1}resolveSpec(e){let t=e.experiment;return t!=null&&t.enabled&&t.variantB&&typeof t.split=="number"?Ee(`${e.id}:${this.deps.deviceId}`)%100<t.split?{spec:t.variantB,variantId:"B"}:{spec:e.spec,variantId:"A"}:{spec:e.spec,variantId:e.variantId}}finishInApp(e,t){t||Ar(e),this.finish()}tryShowInApp(e){if(this.showing||!Ir(e,this.deps.now(),this.deps.sessionId))return;this.showing=!0,Cr(e,this.deps.now(),this.deps.sessionId);let{spec:t,variantId:r}=this.resolveSpec(e);if(this.inappEvent(e,"impression",r),Lo(e,t)){this.showRich(e,t,r);return}this.active=Yi(e.layout,t,{onClick:s=>{if(this.inappEvent(e,"click",r),s.action==="link"&&s.deepLink&&/^https?:\/\//i.test(s.deepLink))try{window.location.href=s.deepLink}catch{}this.finishInApp(e,!1)},onDismiss:()=>{this.inappEvent(e,"dismiss",r),this.finishInApp(e,!1)}})}inappEvent(e,t,r,s=!1){let i={eventId:this.deps.uuid(),campaignId:e.id,channel:"inapp",type:t,deviceId:this.deps.deviceId,timestamp:new Date(this.deps.now()).toISOString(),schemaVersion:1,meta:{sessionId:this.deps.sessionId,...r?{variantId:r}:{},...this.deps.replayCoord()?{replay:this.deps.replayCoord()}:{},...s?{isTest:!0,...e.previewId?{previewId:e.previewId}:{}}:{}}};this.deps.transport.postEvents([i])}tryShow(e){this.showing||!Ir(e,this.deps.now(),this.deps.sessionId)||(this.showing=!0,this.startedAt=this.deps.now(),Cr(e,this.deps.now(),this.deps.sessionId),this.beacon(e,"shown"),this.event(e,"impression"),this.active=Iu(e,{onStarted:()=>this.beacon(e,"started"),onSubmit:t=>{this.submit(e,t),this.finish()},onDismiss:()=>{this.event(e,"dismiss"),this.finish()}}))}finish(){this.showing=!1,this.active=void 0}async submit(e,t){var a;Ar(e);let r=this.deps.uuid(),s=(a=t.attachments)!=null&&a.length?await this.uploadAttachments(r,t.attachments):void 0,i={responseId:r,surveyId:e.id,schemaVersion:1,score:t.score,text:t.text,answers:t.answers,...s&&s.length?{attachments:s}:{},durationMs:this.deps.now()-this.startedAt,sessionId:this.deps.sessionId,screen:this.deps.currentScreen(),platform:"web",deviceId:this.deps.deviceId,...this.deps.replayCoord()?{replay:this.deps.replayCoord()}:{},clientTs:new Date(this.deps.now()).toISOString()},o=await this.deps.transport.postResponses([i]);return this.event(e,"completion"),o?"success":"error"}async uploadAttachments(e,t){let r=t.map((a,c)=>({attachmentId:`${e}-att-${c}`,responseId:e,kind:a.kind,contentType:a.contentType})),s=await this.deps.transport.presignAttachments(r);if(!s||!s.enabled)return[];let i=new Map(s.attachments.map(a=>[a.attachmentId,a])),o=[];for(let a=0;a<t.length;a++){let c=t[a],l=i.get(`${e}-att-${a}`);l&&await this.deps.transport.putBlob(l.uploadUrl,c.blob,c.contentType)&&o.push({attachmentId:l.attachmentId,kind:c.kind,storageKey:l.storageKey,mime:c.contentType,byteSize:c.blob.size,...c.width!=null?{width:c.width}:{},...c.height!=null?{height:c.height}:{},...c.durationMs!=null?{durationMs:c.durationMs}:{},...c.transcript?{transcript:c.transcript}:{},...c.transcriptApproved!=null?{transcriptApproved:c.transcriptApproved}:{},...c.masked!=null?{masked:c.masked}:{}})}return o}submitFor(e,t){let r=this.campaignsById.get(e);return r?this.submit(r,t):Promise.resolve("error")}emitRatingEvent(e,t={}){let r={eventId:this.deps.uuid(),type:e,ts:new Date(this.deps.now()).toISOString(),sessionId:this.deps.sessionId,...t.promptId?{promptId:t.promptId}:{},...t.triggerId?{triggerId:t.triggerId}:{},...t.variantId?{variantId:t.variantId}:{},...e==="rating_selected"&&typeof t.stars=="number"?{stars:t.stars}:{},...this.deps.replayCoord()?{replay:this.deps.replayCoord()}:{},dims:{platform:"web"}};this.deps.transport.postRatingEvents([r])}beacon(e,t){let r={beaconId:this.deps.uuid(),surveyId:e.id,stage:t,sessionId:this.deps.sessionId,deviceId:this.deps.deviceId,platform:"web",screen:this.deps.currentScreen(),...this.deps.replayCoord()?{replay:this.deps.replayCoord()}:{},clientTs:new Date(this.deps.now()).toISOString()};this.deps.transport.postImpressions([r])}event(e,t){let r={eventId:this.deps.uuid(),campaignId:e.id,channel:"inapp",type:t,deviceId:this.deps.deviceId,timestamp:new Date(this.deps.now()).toISOString(),schemaVersion:1,meta:{sessionId:this.deps.sessionId,...this.deps.replayCoord()?{replay:this.deps.replayCoord()}:{}}};this.deps.transport.postEvents([r])}}});function No(n){return n>=200?"critical":n>=100?"warning":"info"}function Bo(n,e){if(e<=0)return{fps:0,dropped:0};let t=Math.min(60,Math.round(n/e*1e3)),r=Math.round(e/1e3*60);return{fps:t,dropped:Math.max(0,r-n)}}function Fo(n){return{value:Math.round(n.loadEventEnd||n.duration),metadata:{kind:"page_load",ttfb:Math.round(n.responseStart),dcl:Math.round(n.domContentLoadedEventEnd),navType:n.type}}}var Do=E(()=>{"use strict"});var Yf={};L(Yf,{startCollectors:()=>Wx});function Wx(n,e){let t,r,s,i,o,a=()=>{if(e()){try{let d=performance.memory,p=d==null?void 0:d.usedJSHeapSize;typeof p=="number"&&p>0&&n("memory",p,{kind:"js_heap",totalHeap:d==null?void 0:d.totalJSHeapSize,heapLimit:d==null?void 0:d.jsHeapSizeLimit})}catch{}i=setTimeout(a,Xf)}},c=()=>{var d;try{let p=(d=performance.getEntriesByType)==null?void 0:d.call(performance,"navigation"),f=p==null?void 0:p[0];if(!f||f.loadEventEnd<=0)return;let m=Fo(f);n("screen_load",m.value,m.metadata,m.value)}catch{}},l=()=>{var h;let d=window.PerformanceObserver;if(!d)return;let p=(h=d.supportedEntryTypes)!=null?h:[],f=p.includes("long-animation-frame"),m=!f&&p.includes("longtask");if(!(!f&&!m))try{let g=new d(S=>{var v;for(let y of S.getEntries()){let b=f?(v=y.blockingDuration)!=null?v:0:y.duration;b<Vx||n("js_stall",Math.round(b),{kind:f?"loaf":"longtask",severity:No(b)},Math.round(y.duration))}});g.observe({type:f?"long-animation-frame":"longtask",buffered:!0}),t=g}catch{}},u=()=>{if(!e())return;if(typeof document!="undefined"&&document.visibilityState!=="visible"||typeof requestAnimationFrame=="undefined"){s=setTimeout(u,qo);return}let d=0,p=performance.now(),f=()=>{if(!e())return;d++;let m=performance.now()-p;if(m<Ux)r=requestAnimationFrame(f);else{let{fps:h,dropped:g}=Bo(d,m);n("frame_metrics",h,{totalFrames:d,dropped:g,windowMs:Math.round(m)}),s=setTimeout(u,qo)}};r=requestAnimationFrame(f)};return document.readyState==="complete"?setTimeout(c,0):(o=()=>setTimeout(c,0),window.addEventListener("load",o,{once:!0})),l(),s=setTimeout(u,qo),performance.memory&&(i=setTimeout(a,Xf)),()=>{t==null||t.disconnect(),r!=null&&typeof cancelAnimationFrame!="undefined"&&cancelAnimationFrame(r),s&&clearTimeout(s),i&&clearTimeout(i),o&&typeof window!="undefined"&&window.removeEventListener("load",o)}}var Ux,qo,Vx,Xf,Jf=E(()=>{"use strict";Do();Ux=5e3,qo=25e3,Vx=50,Xf=3e4});var sm={};L(sm,{EXIT_THRESHOLD:()=>Zf,EXIT_WEIGHTS:()=>Qf,REVERSAL_DEFAULTS:()=>$o,ScrollReversalDetector:()=>ls,canFire:()=>rm,isTopExit:()=>tm,reversalMetrics:()=>nm,startExitIntent:()=>Xx});function tm(n,e,t=em){return n&&e<=t}function nm(n,e){let t=n[n.length-1];if(n.length<2||!t)return null;let r=t;for(let o of n)if(t.t-o.t<=e){r=o;break}let s=t.t-r.t;if(s<=0)return null;let i=r.y-t.y;return{distancePx:i,velocityPxMs:i/s}}function rm(n,e,t,r={}){var s,i;return!(t>=((s=r.maxFires)!=null?s:Gx)||e>0&&n-e<((i=r.cooldownMs)!=null?i:Kx))}function Xx(n,e){if(typeof window=="undefined"||typeof document=="undefined")return{stop:()=>{},fires:()=>0};let t=0,r=0,s={...$o,...e!=null?e:{}},i=new ls(s),o=()=>{try{return Et(window.scrollY||0,document.documentElement.scrollHeight,window.innerHeight||0)}catch{return 0}},a=(u,d)=>{let p=Qf[u];if(p===void 0||p<Zf||!rm(Ho(),r,t))return;t++,r=Ho();let f={confidence:p,trigger:u,path:location.pathname,scroll_depth_pct:o(),...d};n.trackEvent("$exit_intent",f),n.signal("exit_intent",f)},c=u=>{tm(!u.relatedTarget,u.clientY,s.topEdgePx)&&a("top_exit",{x:u.clientX|0,y:u.clientY|0,exit_y:Math.round(u.clientY)})},l=()=>{let u=i.push(window.scrollY||0,Ho(),o(),window.innerHeight||0);u&&a("scroll_reversal",{velocity_px_ms:Math.round(u.velocityPxMs*1e3)/1e3,distance_px:Math.round(u.distancePx)})};return document.addEventListener("mouseout",c),window.addEventListener("scroll",l,{passive:!0}),{fires:()=>t,stop:()=>{document.removeEventListener("mouseout",c),window.removeEventListener("scroll",l)}}}var Qf,Zf,Kx,Gx,em,$o,ls,Ho,im=E(()=>{"use strict";On();Qf={top_exit:.8,scroll_reversal:.5},Zf=.5,Kx=3e4,Gx=3,em=40,$o={windowMs:120,minDistancePx:80,minVelocityPxMs:.7,minDepthPct:25,sustainSamples:3,topEdgePx:em};ls=class{constructor(e=$o){this.tuning=e;this.buf=[];this.sustained=0;this.maxY=0;this.latched=!1}get maxScrollY(){return this.maxY}get sustainedSamples(){return this.sustained}push(e,t,r,s){for(e>this.maxY&&(this.maxY=e),this.buf.push({y:e,t});this.buf.length>2&&t-this.buf[1].t>this.tuning.windowMs;)this.buf.shift();let i=nm(this.buf,this.tuning.windowMs);return i!==null&&i.distancePx>=this.tuning.minDistancePx&&i.velocityPxMs>=this.tuning.minVelocityPxMs?(this.sustained+=1,this.latched||this.sustained<this.tuning.sustainSamples||this.maxY<=s||r<this.tuning.minDepthPct?null:(this.latched=!0,i)):(this.sustained=0,this.latched=!1,null)}};Ho=()=>typeof performance!="undefined"&&performance.now?performance.now():Date.now()});function om(n,e){let t={...Jx,...n},r=Le(e,Yx),s=i=>r<Math.max(0,Math.min(1,i))*100;switch(t.mode){case"off":return{record:!1,streamFromStart:!1,bucket:r,reason:"off"};case"always":return{record:!0,streamFromStart:!0,bucket:r,reason:"always"};case"sampled":return s(t.sampleRate)?{record:!0,streamFromStart:!0,bucket:r,reason:"sampled-in"}:{record:!1,streamFromStart:!1,bucket:r,reason:"sampled-out"};case"onError":default:return s(t.onErrorSampleRate)?{record:!0,streamFromStart:!1,bucket:r,reason:"onerror-armed"}:{record:!1,streamFromStart:!1,bucket:r,reason:"onerror-out"}}}var Yx,Jx,am=E(()=>{"use strict";Fe();Yx="wzb-replay-v1",Jx={mode:"sampled",sampleRate:1,onErrorSampleRate:1}});var Uo={};L(Uo,{SegmentBuffer:()=>zo,approxBytes:()=>ln});function ln(n){var i,o;let e=64,t=n.snapshot;if(typeof t=="string")e+=t.length;else if(t)try{e+=JSON.stringify(t).length}catch{e+=4096}let r=n.mutations;if(Array.isArray(r))for(let a of r){e+=40;let c=(o=(i=a.value)!=null?i:a.data)!=null?o:a.css;typeof c=="string"&&(e+=c.length),(a.node||a.doc)&&(e+=256),Array.isArray(a.rules)&&(e+=a.rules.reduce((l,u)=>l+u.length,0))}let s=n.events;return Array.isArray(s)&&(e+=s.length*48),e}var zo,us=E(()=>{"use strict";zo=class{constructor(e,t=1/0){this.maxSegments=e;this.maxBytes=t;this.sealed=[];this.current=null;this.droppedSegments=0;this.accumBytes=0}openSegment(e){var r;this.current&&this.sealed.push(this.current);let t=ln(e);this.current={keyframeId:(r=e.frameId)!=null?r:"",frames:[e],bytes:t},this.accumBytes+=t,this.evict()}append(e){if(!this.current)return!1;let t=ln(e);return this.current.frames.push(e),this.current.bytes+=t,this.accumBytes+=t,this.evict(),!0}evict(){for(;this.sealed.length>0&&(this.sealed.length+1>this.maxSegments||this.accumBytes>this.maxBytes);){let e=this.sealed.shift();this.accumBytes-=e.bytes,this.droppedSegments++}}drainFrames(){let e=[];for(let t of this.sealed)e.push(...t.frames);return this.current&&e.push(...this.current.frames),e}clear(){this.sealed=[],this.current=null,this.accumBytes=0}get currentFrameCount(){var e,t;return(t=(e=this.current)==null?void 0:e.frames.length)!=null?t:0}get currentBytes(){var e,t;return(t=(e=this.current)==null?void 0:e.bytes)!=null?t:0}get totalBytes(){return this.accumBytes}get segmentCount(){return this.sealed.length+(this.current?1:0)}get frameCount(){var e,t;return this.sealed.reduce((r,s)=>r+s.frames.length,0)+((t=(e=this.current)==null?void 0:e.frames.length)!=null?t:0)}get dropped(){return this.droppedSegments}get hasOpenSegment(){return this.current!==null}}});function Qx(n,e){return n>700||e>800?3:n>350||e>400?2:n>150||e>100?1:0}function cm(n,e){if(e===0)return n;let t=n.mutations;if(e>=1&&Array.isArray(t)&&t.length>0&&t.every(s=>s.op==="canvas"))return null;let r=n.events;if(Array.isArray(r)&&r.length>0){let s=r.filter(i=>!(e>=2&&i.k==="move"));if(s.length===0)return null;s.length!==r.length&&(n.events=s)}return n}var ps,lm=E(()=>{"use strict";ps=class{constructor(e){this.egressPending=e;this.longTaskMs=0;this._level=0;if(typeof PerformanceObserver!="undefined")try{this.po=new PerformanceObserver(t=>{for(let r of t.getEntries())this.longTaskMs+=r.duration}),this.po.observe({type:"longtask",buffered:!1})}catch{}typeof setInterval=="function"&&(this.timer=setInterval(()=>this.sample(),1e3))}sample(){var t,r;let e=this.longTaskMs;this.longTaskMs=0,this._level=Qx(e,(r=(t=this.egressPending)==null?void 0:t.call(this))!=null?r:0)}get level(){return this._level}dispose(){var e;this.timer&&clearInterval(this.timer),(e=this.po)==null||e.disconnect(),this.po=void 0}}});function Vo(n){let e=n;for(let t of eS)e=e.replace(t,Zx);return e}function dm(n){let e=n.snapshot;e&&typeof e=="object"&&fs(e);let t=n.mutations;if(Array.isArray(t))for(let r of t)tS(r)}function fs(n){var e;if(n.t==="tx"||n.t==="cm"){typeof n.value=="string"&&(n.value=Vo(n.value));return}if(n.attrs)for(let t in n.attrs)typeof n.attrs[t]=="string"&&(n.attrs[t]=Vo(n.attrs[t]));if(Array.isArray(n.children))for(let t of n.children)fs(t);if((e=n.shadow)!=null&&e.children)for(let t of n.shadow.children)fs(t)}function tS(n){(n.op==="text"||n.op==="attr")&&typeof n.value=="string"&&(n.value=Vo(n.value)),n.op==="add"&&n.node&&fs(n.node)}var Zx,eS,um=E(()=>{"use strict";Zx="[redacted]",eS=[/\b[\w.+-]+@[\w-]+\.[\w.-]+\b/g,/\b[A-Z]{2}\d{2}[A-Z0-9]{10,30}\b/g,/\b\d{3}-\d{2}-\d{4}\b/g,/\b(?:\d[ -]?){13,18}\d\b/g,/(?:\+\d{1,3}[\s.-]?)?\(?\d{2,4}\)?[\s.-]\d{2,4}[\s.-]\d{2,4}(?:[\s.-]\d{2,4})?/g]});var mm={};L(mm,{deviceMemoryGB:()=>fm,networkHint:()=>pm,shouldDeferHeavyEgress:()=>Wo,userOptedOutOfTracking:()=>rS});function nS(){if(typeof navigator!="undefined")return navigator.connection}function pm(){let n=nS(),e=typeof(n==null?void 0:n.effectiveType)=="string"?n.effectiveType:void 0;return{saveData:(n==null?void 0:n.saveData)===!0,slow:e==="2g"||e==="slow-2g",effectiveType:e}}function rS(){var t;if(typeof navigator=="undefined")return!1;let n=navigator;if(n.globalPrivacyControl===!0)return!0;let e=(t=n.doNotTrack)!=null?t:typeof window!="undefined"?window.doNotTrack:void 0;return e==="1"||e==="yes"}function fm(){if(typeof navigator=="undefined")return;let n=navigator.deviceMemory;return typeof n=="number"?n:void 0}function Wo(){let n=pm();if(n.saveData||n.slow)return!0;let e=fm();return typeof e=="number"&&e<=1}var jo=E(()=>{"use strict"});function Ko(){try{if(typeof sessionStorage!="undefined"){let n=sessionStorage.getItem(hm);return n||(n=`t_${H()}`,sessionStorage.setItem(hm,n)),n}}catch{}return ms!=null?ms:ms=`t_${H()}`}function Go(){try{return typeof location!="undefined"?location.pathname+location.search:void 0}catch{return}}function Xo(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}var hm,ms,gm=E(()=>{"use strict";$();hm="scalebun_replay_tab"});var Jo={};L(Jo,{GZ_PREFIX:()=>dn,ReplayEncoder:()=>Yo,decodeSnapshotValue:()=>iS,gunzipBase64:()=>ym,gzipBase64:()=>bm});async function bm(n){let e=new CompressionStream("gzip"),t=e.writable.getWriter();t.write(new TextEncoder().encode(n)),t.close();let r=await new Response(e.readable).arrayBuffer();return oS(new Uint8Array(r))}async function ym(n){let e=atob(n),t=new Uint8Array(e.length);for(let i=0;i<e.length;i++)t[i]=e.charCodeAt(i);let r=new DecompressionStream("gzip"),s=r.writable.getWriter();return s.write(t),s.close(),await new Response(r.readable).text()}async function iS(n){return typeof n=="string"&&n.startsWith(dn)?JSON.parse(await ym(n.slice(dn.length))):n}function oS(n){let e="";for(let r=0;r<n.length;r+=32768)e+=String.fromCharCode.apply(null,Array.from(n.subarray(r,r+32768)));return btoa(e)}var dn,sS,Yo,Qo=E(()=>{"use strict";dn="gz:",sS=`
571
+ `});var _f={};L(_f,{SURFACE_LOADERS:()=>Co,isSurfaceSupported:()=>wx,renderVariant:()=>Ao});function wx(n){return n==="inline"||n in Co}async function Ao(n,e,t){var a;let r=Bp(((a=n.blocks)!=null?a:[]).map(c=>c.kind));if(n.surface==="inline"){if(!t.slots)return await r,Lf(n.id);let[{mountInline:c}]=await Promise.all([Promise.resolve().then(()=>(Pf(),Mf)),r]),l=c(t.slots,n,e);return{variantId:n.id,close:()=>l.close()}}let s=Co[n.surface];if(!s)return await r,Lf(n.id);let[i]=await Promise.all([s(),r]),o=Qu(t.host,n,i,e,t.metrics);return{variantId:n.id,close:()=>o.close("x")}}function Lf(n){return{variantId:n,close:()=>{}}}var Co,To=k(()=>{"use strict";Zu();Fp();Co={banner:()=>Promise.resolve().then(()=>(qp(),Dp)).then(n=>n.bannerSurface),toast:()=>Promise.resolve().then(()=>($p(),Hp)).then(n=>n.toastSurface),modal:()=>Promise.resolve().then(()=>(Vp(),Up)).then(n=>n.modalSurface),slideover:()=>Promise.resolve().then(()=>(Xp(),Gp)).then(n=>n.slideoverSurface),popover:()=>Promise.resolve().then(()=>(nf(),tf)).then(n=>n.popoverSurface),coachmark:()=>Promise.resolve().then(()=>(sf(),rf)).then(n=>n.coachmarkSurface),tour:()=>Promise.resolve().then(()=>(uf(),df)).then(n=>n.tourSurface),hotspot:()=>Promise.resolve().then(()=>(ff(),pf)).then(n=>n.hotspotSurface),toolbar:()=>Promise.resolve().then(()=>(hf(),mf)).then(n=>n.toolbarSurface),palette:()=>Promise.resolve().then(()=>(bf(),gf)).then(n=>n.paletteSurface),panel:()=>Promise.resolve().then(()=>(vf(),yf)).then(n=>n.panelSurface),checklist:()=>Promise.resolve().then(()=>(Sf(),xf)).then(n=>n.checklistSurface),takeover:()=>Promise.resolve().then(()=>(Ef(),kf)).then(n=>n.takeoverSurface),launcher:()=>Promise.resolve().then(()=>(Cf(),If)).then(n=>n.launcherSurface)}});function Bf(n){Po=n}function Lo(n){try{Mo==null||Mo(n)}catch{}}function Ff(n,e){let t=typeof e=="string"&&e?e:null;return t?xx.has(t)?t:null:n&&kx[n]||null}function Df(n){var t;let e=(t=n==null?void 0:n.ext)==null?void 0:t.archetype;return typeof e=="string"&&e?e:void 0}function _o(n,e){let t=Df(e!=null?e:n.spec);return Ff(n.variantKey,t)?!0:t?(Ex.has(t)||Lo({variantKey:n.variantKey,reason:"unrenderable",archetype:t}),!1):(n.variantKey&&Lo({variantKey:n.variantKey,reason:"unmapped"}),!1)}function Cx(n){var t;let e=B(n.mountModel);if(!e)return null;if(e==="inline"){let r=Dr(n);return!r||!no(n)?(Lo({reason:"unrenderable",archetype:"inline"}),null):{surface:"inline",surfaceOptions:{slot:r}}}return(t=Ix[e])!=null?t:null}function Px(n,e,t,r,s){var i,o,a,c,l,u,d,p,f,m,h,g,S,v,y,b,E,w,I,x,C,M,T,A,O,z,D,te,J,Q,fe,ce,xe,Se,le,q,V,K,de,me,se,Ue,Ve;switch(n){case"spinWheel":{let G=ue(e,["segments","prizes","rewards"]);return[{kind:"spinwheel",props:{segments:G.map(pe).filter(Boolean),resultIndex:Tx(G,e)}}]}case"scratchReveal":return[{kind:"scratch",props:{prize:(u=B((l=(c=(a=(o=(i=e.prize)!=null?i:e.reward)!=null?o:e.rewardValue)!=null?a:e.rewardResult)!=null?c:e.resultReward)!=null?l:e.coupon))!=null?u:"You won!",reveal:r==="mystery_box"?"box":"scratch"}}];case"slotReward":{let G=ue(e,["resultSymbols","result","winningSymbols"]).map(pe).filter(Boolean);return[{kind:"slot",props:{symbols:ue(e,["symbols","reels","slotItems"]).map(pe).filter(Boolean),...G.length?{result:G.slice(0,3)}:{}}}]}case"countdown":return[{kind:"countdown",props:Rx(e)}];case"celebration":return[{kind:"confetti",props:{}}];case"qrNfc":return[{kind:"qr",props:{value:(m=(f=(p=(d=B(e.url))!=null?d:B(e.link))!=null?p:B(e.qrValue))!=null?f:B(e.deepLink))!=null?m:"https://app.example.com"}}];case"carouselDeck":{let G=ue(e,["slides","cards","items","steps"]);return[{kind:"carousel",props:{slides:(G.length?G:[{},{},{}]).map(Y=>{var ee,R,_;let X=ae(Y);return{image:B((ee=X.image)!=null?ee:X.imageUrl),title:pe(Y),text:B((_=(R=X.text)!=null?R:X.body)!=null?_:X.subtitle)}})}}]}case"questionFlow":{let G=ue(e,["questions","steps"]),ie=ae(G[0]),Y=(E=(b=(y=B((g=(h=e.question)!=null?h:e.promptText)!=null?g:e.prompt))!=null?y:B((v=(S=ie.prompt)!=null?S:ie.question)!=null?v:ie.label))!=null?b:t)!=null?E:"Tell us",X=ue(e,["options","preferenceOptions","pollOptions","answers","choices","reactions"]),ee=X.length?X:ue(ie,["options","answers","choices"]),R=(ee.length?ee:[{label:"Option A"},{label:"Option B"}]).map((_,N)=>({id:String(N),label:pe(_)}));switch(r){case"nps_prompt":return[{kind:"nps",props:{question:Y}}];case"rating_request":return[{kind:"rating",props:{question:Y,max:Ro(Number((w=e.max)!=null?w:e.scale),5)}}];case"emoji_reaction_bar":{let _=ue(e,["emojis","reactions","options"]).map(N=>{var F;return typeof N=="string"?N:(F=B(ae(N).emoji))!=null?F:pe(N)}).filter(Boolean);return[{kind:"emoji",props:{question:Y,..._.length?{emojis:_}:{}}}]}case"quiz_card":{let _=ae((I=e.outcome)!=null?I:e.quizOutcome),N=B((x=_.answeredId)!=null?x:e.answeredId),F=B((C=_.correctId)!=null?C:e.correctId);return[{kind:"quiz",props:{question:Y,options:R,...N||F?{outcome:{answeredId:N,correctId:F}}:{}}}]}default:return[{kind:"poll",props:{question:Y,options:R}}]}}case"checklistProgress":{let G=ue(e,["steps","items","tasks","checklist"]),ie=G.length?G:["Step one","Step two","Step three"],Y=ie.map((_,N)=>{let F=ae(_);return{id:String(N),label:pe(_),done:F.done===!0||F.checked===!0||F.complete===!0}}),X=Ax((A=(T=(M=e.progress)!=null?M:e.percent)!=null?T:e.progressValue)!=null?A:e.currentValue,40),ee={kind:"progress",props:{value:X}},R=B((z=(O=e.reward)!=null?O:e.prize)!=null?z:e.rewardValue);switch(r){case"streak_reward":case"daily_check_in":{let _=r==="daily_check_in",N=ue(e,["calendarDays","dayLabels","days"]),F=N.map(pe).filter(Boolean),W=N.filter(Ce=>{let Ae=ae(Ce);return Ae.done===!0||Ae.checked===!0||Ae.complete===!0}).length,re=Ro(Number((J=(te=(D=e.filled)!=null?D:e.currentStreak)!=null?te:e.streakValue)!=null?J:e.streakValueSource),W),ge=N.findIndex(Ce=>ae(Ce).today===!0),he=[{kind:"streak",props:{mode:_?"checkin":"streak",filled:re,...ge>=0?{today:ge+1}:{},...F.length?{labels:F}:{days:Ro(Number((Q=e.days)!=null?Q:e.calendarLength),7)},..._&&e.alreadyCheckedIn===!0?{today:-1}:{}}}];return R&&he.push({kind:"callout",props:{icon:"\u{1F381}",text:R}}),he}case"progress_unlock":{let _=X>=100,N=[ee];return R&&N.push({kind:"callout",props:{icon:_?"\u{1F389}":"\u{1F512}",text:_?R:`Unlock ${R}`}}),N}case"goal_tracker":{let _=Number((ce=(fe=e.currentValue)!=null?fe:e.progressValue)!=null?ce:e.current),N=Number((le=(Se=(xe=e.target)!=null?xe:e.goal)!=null?Se:e.targetValue)!=null?le:e.goalValue),F=[ee];return F.push({kind:"stat",props:{value:Number.isFinite(_)?Number.isFinite(N)?`${_} / ${N}`:_:`${Math.round(X)}%`,label:(K=B((V=(q=e.goalLabel)!=null?q:e.unit)!=null?V:e.goalSource))!=null?K:"Progress"}}),F}case"community_challenge":{let _=Number((me=(de=e.participants)!=null?de:e.members)!=null?me:e.joined),N=[ee];return Number.isFinite(_)&&N.push({kind:"stat",props:{value:_,label:(se=B(e.participantsLabel))!=null?se:"taking part"}}),G.length&&N.push({kind:"list",props:{items:Y.map(F=>({label:F.label}))}}),N}case"guided_setup_wizard":case"first_session_onboarding":return[{kind:"steps",props:{steps:ie.map(N=>{var W,re;let F=ae(N);return{title:pe(N)||void 0,body:B((re=(W=F.body)!=null?W:F.text)!=null?re:F.subtitle)}}),backLabel:B(e.backLabel),skipLabel:B(e.skipLabel),nextLabel:B(e.nextLabel),finalLabel:B(e.finalLabel)}}];default:return[ee,{kind:"checklist",props:{items:Y}}]}}case"multiStepSheet":{let G=ue(e,["steps","pages","items","screens"]);return[{kind:"steps",props:{steps:(G.length?G:[{}]).map(Y=>{var ee,R;let X=ae(Y);return{title:pe(Y)||void 0,body:B((R=(ee=X.body)!=null?ee:X.text)!=null?R:X.subtitle)}}),backLabel:B(e.backLabel),skipLabel:B(e.skipLabel),nextLabel:B(e.nextLabel),finalLabel:B(e.finalLabel)}}]}case"sideSheet":return Nf(e,s);case"videoCommerce":{let G=[],ie=B(e.video);ie&&G.push({kind:"video",props:{src:ie}});let Y=ue(e,["products","items"]).map(ee=>{var _,N,F;let R=ae(ee);return{id:String((_=R.id)!=null?_:""),image:B((N=R.image)!=null?N:R.imageUrl),title:pe(ee),price:(F=R.price)!=null?F:R.amount}}),X=B(e.productTitle);return!Y.length&&X&&Y.push({id:"product",image:B((Ue=e.productImage)!=null?Ue:e.image),title:X,price:(Ve=e.price)!=null?Ve:e.amount}),G.push({kind:"product-grid",props:{products:Y}}),G}default:return Nf(e,s)}}function Lx(n,e){var u,d,p,f,m,h,g,S,v,y,b,E,w,I,x,C,M,T,A,O,z,D,te,J,Q,fe,ce,xe,Se,le;let t=[],r=[],s=B((T=(M=(C=(x=(I=(w=(E=(b=(y=(v=(S=(g=(h=(m=(f=(p=(d=(u=n.benefitMessage)!=null?u:n.segmentExplanation)!=null?d:n.availabilityMessage)!=null?p:n.rewardMessage)!=null?f:n.offerMessage)!=null?m:n.proofMessage)!=null?h:n.valueMessage)!=null?g:n.reviewMessage)!=null?S:n.assistantMessage)!=null?v:n.supportMessage)!=null?y:n.arrivalMessage)!=null?b:n.checkoutMessage)!=null?E:n.instruction)!=null?w:n.instructions)!=null?I:n.closedMessage)!=null?x:n.reasonText)!=null?C:n.motivationalText)!=null?M:n.urgencyNote)!=null?T:n.subtitle);s&&s!==e&&t.push({kind:"text",props:{text:s}});let i=ue(n,["actions","ctas"]).map(q=>{var K;let V=ae(q);return{label:pe(q),action:(K=B(V.action))!=null?K:"dismiss",deepLink:B(V.deepLink),variant:"secondary"}}).filter(q=>q.label);i.length&&r.push({kind:"cta",props:{actions:i}});let o=B((fe=(Q=(J=(te=(D=(z=(O=(A=n.price)!=null?A:n.eventTime)!=null?O:n.dateTime)!=null?z:n.goal)!=null?D:n.documentType)!=null?te:n.lastOrderDate)!=null?J:n.reward)!=null?Q:n.rewardTitle)!=null?fe:n.resultReward);o&&r.push({kind:"badge",props:{text:o}});let a=B((ce=n.eventTitle)!=null?ce:n.passTitle);a&&a!==e&&t.push({kind:"callout",props:{icon:"\u{1F39F}\uFE0F",text:a}});let c=B((xe=n.avatar)!=null?xe:n.avatarUrl);c&&t.unshift({kind:"image",props:{src:c,alt:""}});let l=B(n.itemName);if(l){let q=B(n.oldPrice),V=B(n.newPrice),K=q&&V?`${q} \u2192 ${V}`:(le=(Se=V!=null?V:q)!=null?Se:B(n.stockStatus))!=null?le:B(n.quantity);r.push({kind:"callout",props:{icon:"\u{1F3F7}\uFE0F",text:K?`${l} \xB7 ${K}`:l}})}return{lead:t,trail:r}}function Nf(n,e){let t=[],r=ue(n,["bullets","bulletList","benefits","features","newFeatures","perks","perksList","reasonList","digestItems","contentSections","contentBlocks","suggestedActions","points","highlights","dateTimeOptions","tabs","slots"]).map(pe).filter(Boolean);r.length&&t.push({kind:"list",props:{items:r}});let s=ue(n,["plans","planCards","tiers","pricingTiers","packages"]);s.length&&t.push({kind:"table",props:{columns:["Plan","Price"],rows:s.map(a=>{var l,u;let c=ae(a);return[pe(a),String((u=(l=c.price)!=null?l:c.amount)!=null?u:"")]})}});let i=ue(n,["products","productList","productCards","productImages","crossSellItems","recommendations","bundleItems","cartItems","itemList","relatedItems"]);i.length&&t.push({kind:"product-grid",props:{products:i.map(a=>{var l,u,d;let c=ae(a);return{id:String((l=c.id)!=null?l:""),image:B((u=c.image)!=null?u:c.imageUrl),title:pe(a),price:(d=c.price)!=null?d:c.amount}})}});let o=ue(n,["steps","setupSteps","tasks","checklistItems","checklist"]);return o.length&&t.push({kind:"checklist",props:{items:o.map((a,c)=>({id:String(c),label:pe(a),done:ae(a).done===!0}))}}),t}function _x(n,e){var f,m,h,g,S,v,y,b,E,w,I,x,C,M,T,A,O,z,D,te,J;let t=(f=Ff(n.variantKey,Df(e)))!=null?f:"",r=ae(e.ext),s=(g=(h=(m=Sx[t])!=null?m:Cx(r))!=null?h:Of[n.layout])!=null?g:Of.modal,i=B((S=r.sidePosition)!=null?S:r.position),o=t==="sideSheet"&&(i==="left"||i==="right")?{...s,surfaceOptions:{...s.surfaceOptions,placement:i}}:s,a=[];e.imageUrl&&a.push({kind:"image",props:{src:e.imageUrl,alt:(v=e.title)!=null?v:""}});let c=B((y=r.eyebrow)!=null?y:r.badge);c&&c!==e.title&&c.length<32&&a.push({kind:"badge",props:{text:c}});let l=(T=B(e.title))!=null?T:B((M=(C=(x=(I=(w=(E=(b=r.eventTitle)!=null?b:r.passTitle)!=null?E:r.expandedTitle)!=null?w:r.subject)!=null?I:r.vipTitle)!=null?x:r.offerTitle)!=null?C:r.bubbleLabel)!=null?M:r.peekLabel),u=(A=B(e.body))!=null?A:B(r.expandedBody);l&&a.push({kind:"heading",props:{text:l}}),u&&a.push({kind:"text",props:{text:u}});let d=Lx(r,u);a.push(...d.lead),a.push(...Px(t,r,l,n.variantKey,u)),a.push(...d.trail);let p=[];return(O=e.cta)!=null&&O.label&&p.push({label:e.cta.label,action:(z=e.cta.action)!=null?z:"dismiss",deepLink:e.cta.deepLink,variant:"primary"}),(D=e.secondaryCta)!=null&&D.label&&p.push({label:e.secondaryCta.label,action:"dismiss",variant:"dismiss"}),p.length&&a.push({kind:"cta",props:{actions:p}}),a.length===0&&a.push({kind:"text",props:{text:e.body}}),{id:n.id,key:(te=n.variantKey)!=null?te:n.id,name:(J=e.title)!=null?J:n.id,category:"misc",platforms:["web"],surface:o.surface,surfaceOptions:o.surfaceOptions,blocks:a,priority:"normal",triggers:[{type:"manual"}],dismiss:{xButton:!0,escClose:!0,backdropClose:!0}}}function Nx(n,e){var s;let t=(s=e.ext)==null?void 0:s.animationIn,r=typeof t=="string"?Ox[t]:void 0;r&&n.style.setProperty("--scalebun-anim-in",r)}function Bx(n,e){let t=zi(e.style),r=(s,i)=>{i&&n.style.setProperty(s,i)};r("--scalebun-accent",t.accent),r("--scalebun-bg",t.cardBg),r("--scalebun-fg",t.bodyColor),r("--scalebun-title",t.titleColor),t.accent?r("--scalebun-accent-fg",Ui(t.accent,t.ctaText)):r("--scalebun-accent-fg",t.ctaText)}async function qf(n,e,t){var m;let[{renderVariant:r},{ShadowHost:s}]=await Promise.all([Promise.resolve().then(()=>(To(),_f)),Promise.resolve().then(()=>(os(),Rf))]),i=new s;i.ensure(),e.dark===!0&&i.setTheme("dark");let o=i.element();o&&(Bx(o,e),Nx(o,e));let a=ae(e.ext),c=Ou({campaignId:n.id,variantKey:(m=n.variantKey)!=null?m:"",ext:a,preview:n.preview===!0||n.isTest===!0,...Po?{handler:Po}:{}});if(c&&Tu(n.variantKey)==="load"){let h=await c(1);h.ok&&h.state&&Object.assign(a,h.state)}let l=_x(n,e),u=!1,d=!1,p=()=>{d||(d=!0,queueMicrotask(()=>{try{i.destroy()}catch{}}))},f=await r(l,{onImpression(){},onView(){},onCtaClick(){u||(u=!0,t.onClick())},onInteraction(){},onDismiss(){u||(u=!0,t.onDismiss()),p()},...c?{requestOutcome:c}:{}},{host:i,slots:Pt});return{close:()=>{try{f.close()}catch{}p()}}}var ae,B,Ro,pe,ue,xx,Sx,kx,Mo,Po,Ex,Ix,Of,Ax,Tx,Rx,Mx,Ox,Hf=k(()=>{"use strict";Vi();Nu();ro();eo();ae=n=>n&&typeof n=="object"&&!Array.isArray(n)?n:{},B=n=>typeof n=="string"&&n.length>0?n:void 0,Ro=(n,e)=>typeof n=="number"&&Number.isFinite(n)?n:e,pe=n=>{var t,r,s,i;if(typeof n=="string")return n;let e=ae(n);return(i=(s=(r=(t=B(e.label))!=null?t:B(e.title))!=null?r:B(e.text))!=null?s:B(e.name))!=null?i:""},ue=(n,e)=>{for(let t of e)if(Array.isArray(n[t]))return n[t];return[]},xx=new Set(["spinWheel","scratchReveal","slotReward","carouselDeck","countdown","questionFlow","checklistProgress","qrNfc","videoCommerce","celebration","multiStepSheet","sideSheet"]),Sx={sideSheet:{surface:"slideover",surfaceOptions:{placement:"right"}},multiStepSheet:{surface:"slideover",surfaceOptions:{placement:"bottom"}}},kx={spin_wheel:"spinWheel",scratch_card:"scratchReveal",mystery_box:"scratchReveal",slot_reward:"slotReward",carousel_story:"carouselDeck",swipe_deck:"carouselDeck",countdown_offer:"countdown",poll_card:"questionFlow",survey_sheet:"questionFlow",nps_prompt:"questionFlow",quiz_card:"questionFlow",product_finder:"questionFlow",preferences_picker:"questionFlow",feedback_capture:"questionFlow",emoji_reaction_bar:"questionFlow",rating_request:"questionFlow",progress_unlock:"checklistProgress",streak_reward:"checklistProgress",daily_check_in:"checklistProgress",goal_tracker:"checklistProgress",interactive_checklist:"checklistProgress",guided_setup_wizard:"checklistProgress",first_session_onboarding:"checklistProgress",community_challenge:"checklistProgress",milestone_celebration:"celebration",celebration_confetti_full_screen:"celebration",nfc_qr_prompt:"qrNfc",wallet_pass_offer:"qrNfc",video_commerce_card:"videoCommerce"},Mo=null,Po=null;Ex=new Set(["modal","sheet","bannerToast","fullscreen","anchored","inline"]),Ix={overlay:{surface:"modal",surfaceOptions:{placement:"center",size:"md",backdrop:!0}},sheet:{surface:"slideover",surfaceOptions:{placement:"right",resizable:!0}},banner:{surface:"banner",surfaceOptions:{placement:"top"}},fullscreen:{surface:"takeover"},toast:{surface:"toast",surfaceOptions:{placement:"bottom-right"}},bubble:{surface:"toast",surfaceOptions:{placement:"bottom-right"}},anchored:{surface:"popover",surfaceOptions:{placement:"bottom",maxWidth:320}}};Of={modal:{surface:"modal",surfaceOptions:{placement:"center",size:"md",backdrop:!0}},fullscreen:{surface:"takeover"},bottom_sheet:{surface:"slideover",surfaceOptions:{placement:"bottom"}},top_banner:{surface:"banner",surfaceOptions:{placement:"top"}},bottom_banner:{surface:"banner",surfaceOptions:{placement:"bottom"}},tooltip:{surface:"toast",surfaceOptions:{placement:"bottom-right"}},toast:{surface:"toast",surfaceOptions:{placement:"bottom-right"}}},Ax=(n,e)=>{let t=Number(n);return Number.isFinite(t)?t>0&&t<=1?t*100:t:e},Tx=(n,e)=>{var i,o,a,c,l,u,d;if(!n.length)return 0;for(let p of["resultIndex","winningIndex"]){let f=Number(e[p]);if(Number.isInteger(f)&&f>=0&&f<n.length)return f}let t=p=>{var m,h,g;let f=ae(p);return(g=(h=(m=B(f.id))!=null?m:B(f.segmentId))!=null?h:B(f.key))!=null?g:B(f.value)},r=B((a=(o=(i=e.segmentId)!=null?i:e.winningId)!=null?o:e.resultId)!=null?a:e.outcomeId);if(r){let p=n.findIndex(f=>t(f)===r);if(p>=0)return p}let s=B((d=(u=(l=(c=e.resultState)!=null?c:e.rewardValue)!=null?l:e.prize)!=null?u:e.rewardResult)!=null?d:e.resultReward);if(s){let p=s.trim().toLowerCase(),f=n.findIndex(m=>pe(m).trim().toLowerCase()===p);if(f>=0)return f}return 0},Rx=n=>{var r;let e=Mx(n);if(e)return{target:e};let t=Number((r=n.durationHours)!=null?r:n.hours);return{durationMs:(Number.isFinite(t)&&t>0?t:24)*36e5}},Mx=n=>{var l,u,d,p;let e=(d=(u=(l=B(n.endsAt))!=null?l:B(n.deadline))!=null?u:B(n.to))!=null?d:B(n.endAt);if(e)return e;let t=(p=B(n.expiryTime))!=null?p:B(n.expiresAt);if(!t)return;let r=Date.parse(t);if(Number.isFinite(r))return new Date(r).toISOString();let s=t.split(":").map(f=>Number(f));if(!s.length||s.some(f=>!Number.isFinite(f)))return;let[i=0,o=0,a=0]=s.length===3?s:[0,...s],c=((i*60+o)*60+a)*1e3;return c>0?new Date(Date.now()+c).toISOString():void 0};Ox={fade:"scalebun-fade .18s ease",fade_scale:"scalebun-pop .16s ease",slide_up:"scalebun-slideup .2s ease",slide_down:"scalebun-slidedown .18s ease",slide_in_right:"scalebun-slide-in-r .2s ease"}});var zf={};L(zf,{installShakeDetector:()=>qx});function qx(n){if(typeof window=="undefined"||typeof DeviceMotionEvent=="undefined")return()=>{};let e=0,t=!1,r,s=l=>{var h,g,S;let u=l.accelerationIncludingGravity;if(!u)return;let d=((h=u.x)!=null?h:0)/Oo,p=((g=u.y)!=null?g:0)/Oo,f=((S=u.z)!=null?S:0)/Oo;if(Math.sqrt(d*d+p*p+f*f)<Fx)return;let m=P();if(!(m-e<Dx)){e=m;try{n("shake")}catch{}}},i=()=>{t||(t=!0,window.addEventListener("devicemotion",s))},o=()=>{try{return sessionStorage.getItem($f)}catch{return null}},a=l=>{try{sessionStorage.setItem($f,l)}catch{}},c=DeviceMotionEvent.requestPermission;if(typeof c=="function"){if(o()==="denied")return()=>{};let l=()=>{r==null||r(),c().then(u=>{a(u==="granted"?"granted":"denied"),u==="granted"&&i()}).catch(()=>{})};window.addEventListener("click",l),window.addEventListener("touchend",l),r=()=>{window.removeEventListener("click",l),window.removeEventListener("touchend",l)}}else i();return()=>{r==null||r(),r=void 0,t&&window.removeEventListener("devicemotion",s),t=!1}}var Fx,Dx,Oo,$f,Uf=k(()=>{"use strict";$();Fx=2.3,Dx=1500,Oo=9.80665,$f="scalebun_shake_perm"});var Vf={};L(Vf,{EngageRuntime:()=>No});var No,Wf=k(()=>{"use strict";tu();$i();Iu();Cu();Hf();Fe();No=class{constructor(e){this.deps=e;this.showing=!1;this.startedAt=0;this.campaignsById=new Map;this.shakeInCampaigns=!1;this.shakeInMessages=!1;var t;this.surveys=new tn(r=>this.tryShow(r)),this.inapp=new tn(r=>this.tryShowInApp(r)),Bf((t=e.gameHandler)!=null?t:null)}setCampaigns(e){this.campaignsById=new Map(e.map(t=>[t.id,t])),this.surveys.setItems(e),this.shakeInCampaigns=e.some(t=>t.trigger==="shake_device"),this.syncShake()}setMessages(e){let t=e.filter(r=>r.preview);this.inapp.setItems(e.filter(r=>!r.preview)),t.length&&this.maybeShowPreview(t),this.shakeInMessages=e.some(r=>r.trigger==="shake_device"),this.syncShake()}async syncShake(){let e=(this.shakeInCampaigns||this.shakeInMessages)&&!!this.deps.signal;if(e&&!this.shakeTeardown){let{installShakeDetector:t}=await Promise.resolve().then(()=>(Uf(),zf));(this.shakeInCampaigns||this.shakeInMessages)&&this.deps.signal&&!this.shakeTeardown&&(this.shakeTeardown=t(r=>this.deps.signal(r)))}else!e&&this.shakeTeardown&&(this.shakeTeardown(),this.shakeTeardown=void 0)}maybeShowPreview(e){if(this.showing)return;let r=e.filter(o=>!o.testRunId||!qi(o.testRunId)).sort((o,a)=>{var c,l;return((c=a.createdAt)!=null?c:"").localeCompare((l=o.createdAt)!=null?l:"")})[0];if(!r)return;r.testRunId&&Hi(r.testRunId),this.showing=!0;let{spec:s,variantId:i}=this.resolveSpec(r);if(this.inappEvent(r,"impression",i,!0),_o(r,s)){this.showRich(r,s,i,!0);return}this.active=Ji(r.layout,s,{onClick:()=>{this.inappEvent(r,"click",i,!0),this.finishInApp(r,!0)},onDismiss:()=>{this.inappEvent(r,"dismiss",i,!0),this.finishInApp(r,!0)}})}showRich(e,t,r,s=!1){qf(e,t,{onClick:()=>{this.inappEvent(e,"click",r,s);let a=t.cta;if((a==null?void 0:a.action)==="link"&&a.deepLink&&/^https?:\/\//i.test(a.deepLink))try{window.location.href=a.deepLink}catch{}this.finishInApp(e,s)},onDismiss:()=>{this.inappEvent(e,"dismiss",r,s),this.finishInApp(e,s)}}).then(a=>{this.showing?this.active=a:a.close()}).catch(()=>{this.finish()})}onScreenView(e,t=0){this.surveys.onScreenView(e,t),this.inapp.onScreenView(e,t)}onSignal(e,t=0){this.surveys.onSignal(e,t),this.inapp.onSignal(e,t)}onCustomEvent(e,t=0){this.surveys.onCustomEvent(e,t),this.inapp.onCustomEvent(e,t)}onLifecycle(e,t,r=0){this.surveys.onLifecycle(e,t,r),this.inapp.onLifecycle(e,t,r)}stop(){var e,t;this.surveys.stop(),this.inapp.stop(),(e=this.shakeTeardown)==null||e.call(this),this.shakeTeardown=void 0,(t=this.active)==null||t.close(),this.active=void 0,this.showing=!1}resolveSpec(e){let t=e.experiment;return t!=null&&t.enabled&&t.variantB&&typeof t.split=="number"?Ee(`${e.id}:${this.deps.deviceId}`)%100<t.split?{spec:t.variantB,variantId:"B"}:{spec:e.spec,variantId:"A"}:{spec:e.spec,variantId:e.variantId}}finishInApp(e,t){t||Ar(e),this.finish()}tryShowInApp(e){if(this.showing||!Ir(e,this.deps.now(),this.deps.sessionId))return;this.showing=!0,Cr(e,this.deps.now(),this.deps.sessionId);let{spec:t,variantId:r}=this.resolveSpec(e);if(this.inappEvent(e,"impression",r),_o(e,t)){this.showRich(e,t,r);return}this.active=Ji(e.layout,t,{onClick:s=>{if(this.inappEvent(e,"click",r),s.action==="link"&&s.deepLink&&/^https?:\/\//i.test(s.deepLink))try{window.location.href=s.deepLink}catch{}this.finishInApp(e,!1)},onDismiss:()=>{this.inappEvent(e,"dismiss",r),this.finishInApp(e,!1)}})}inappEvent(e,t,r,s=!1){let i={eventId:this.deps.uuid(),campaignId:e.id,channel:"inapp",type:t,deviceId:this.deps.deviceId,timestamp:new Date(this.deps.now()).toISOString(),schemaVersion:1,meta:{sessionId:this.deps.sessionId,...r?{variantId:r}:{},...this.deps.replayCoord()?{replay:this.deps.replayCoord()}:{},...s?{isTest:!0,...e.previewId?{previewId:e.previewId}:{}}:{}}};this.deps.transport.postEvents([i])}tryShow(e){this.showing||!Ir(e,this.deps.now(),this.deps.sessionId)||(this.showing=!0,this.startedAt=this.deps.now(),Cr(e,this.deps.now(),this.deps.sessionId),this.beacon(e,"shown"),this.event(e,"impression"),this.active=Eu(e,{onStarted:()=>this.beacon(e,"started"),onSubmit:t=>{this.submit(e,t),this.finish()},onDismiss:()=>{this.event(e,"dismiss"),this.finish()}}))}finish(){this.showing=!1,this.active=void 0}async submit(e,t){var a;Ar(e);let r=this.deps.uuid(),s=(a=t.attachments)!=null&&a.length?await this.uploadAttachments(r,t.attachments):void 0,i={responseId:r,surveyId:e.id,schemaVersion:1,score:t.score,text:t.text,answers:t.answers,...s&&s.length?{attachments:s}:{},durationMs:this.deps.now()-this.startedAt,sessionId:this.deps.sessionId,screen:this.deps.currentScreen(),platform:"web",deviceId:this.deps.deviceId,...this.deps.replayCoord()?{replay:this.deps.replayCoord()}:{},clientTs:new Date(this.deps.now()).toISOString()},o=await this.deps.transport.postResponses([i]);return this.event(e,"completion"),o?"success":"error"}async uploadAttachments(e,t){let r=t.map((a,c)=>({attachmentId:`${e}-att-${c}`,responseId:e,kind:a.kind,contentType:a.contentType})),s=await this.deps.transport.presignAttachments(r);if(!s||!s.enabled)return[];let i=new Map(s.attachments.map(a=>[a.attachmentId,a])),o=[];for(let a=0;a<t.length;a++){let c=t[a],l=i.get(`${e}-att-${a}`);l&&await this.deps.transport.putBlob(l.uploadUrl,c.blob,c.contentType)&&o.push({attachmentId:l.attachmentId,kind:c.kind,storageKey:l.storageKey,mime:c.contentType,byteSize:c.blob.size,...c.width!=null?{width:c.width}:{},...c.height!=null?{height:c.height}:{},...c.durationMs!=null?{durationMs:c.durationMs}:{},...c.transcript?{transcript:c.transcript}:{},...c.transcriptApproved!=null?{transcriptApproved:c.transcriptApproved}:{},...c.masked!=null?{masked:c.masked}:{}})}return o}submitFor(e,t){let r=this.campaignsById.get(e);return r?this.submit(r,t):Promise.resolve("error")}emitRatingEvent(e,t={}){let r={eventId:this.deps.uuid(),type:e,ts:new Date(this.deps.now()).toISOString(),sessionId:this.deps.sessionId,...t.promptId?{promptId:t.promptId}:{},...t.triggerId?{triggerId:t.triggerId}:{},...t.variantId?{variantId:t.variantId}:{},...e==="rating_selected"&&typeof t.stars=="number"?{stars:t.stars}:{},...this.deps.replayCoord()?{replay:this.deps.replayCoord()}:{},dims:{platform:"web"}};this.deps.transport.postRatingEvents([r])}beacon(e,t){let r={beaconId:this.deps.uuid(),surveyId:e.id,stage:t,sessionId:this.deps.sessionId,deviceId:this.deps.deviceId,platform:"web",screen:this.deps.currentScreen(),...this.deps.replayCoord()?{replay:this.deps.replayCoord()}:{},clientTs:new Date(this.deps.now()).toISOString()};this.deps.transport.postImpressions([r])}event(e,t){let r={eventId:this.deps.uuid(),campaignId:e.id,channel:"inapp",type:t,deviceId:this.deps.deviceId,timestamp:new Date(this.deps.now()).toISOString(),schemaVersion:1,meta:{sessionId:this.deps.sessionId,...this.deps.replayCoord()?{replay:this.deps.replayCoord()}:{}}};this.deps.transport.postEvents([r])}}});function Bo(n){return n>=200?"critical":n>=100?"warning":"info"}function Fo(n,e){if(e<=0)return{fps:0,dropped:0};let t=Math.min(60,Math.round(n/e*1e3)),r=Math.round(e/1e3*60);return{fps:t,dropped:Math.max(0,r-n)}}function Do(n){return{value:Math.round(n.loadEventEnd||n.duration),metadata:{kind:"page_load",ttfb:Math.round(n.responseStart),dcl:Math.round(n.domContentLoadedEventEnd),navType:n.type}}}var qo=k(()=>{"use strict"});var Xf={};L(Xf,{startCollectors:()=>Wx});function Wx(n,e){let t,r,s,i,o,a=()=>{if(e()){try{let d=performance.memory,p=d==null?void 0:d.usedJSHeapSize;typeof p=="number"&&p>0&&n("memory",p,{kind:"js_heap",totalHeap:d==null?void 0:d.totalJSHeapSize,heapLimit:d==null?void 0:d.jsHeapSizeLimit})}catch{}i=setTimeout(a,Gf)}},c=()=>{var d;try{let p=(d=performance.getEntriesByType)==null?void 0:d.call(performance,"navigation"),f=p==null?void 0:p[0];if(!f||f.loadEventEnd<=0)return;let m=Do(f);n("screen_load",m.value,m.metadata,m.value)}catch{}},l=()=>{var h;let d=window.PerformanceObserver;if(!d)return;let p=(h=d.supportedEntryTypes)!=null?h:[],f=p.includes("long-animation-frame"),m=!f&&p.includes("longtask");if(!(!f&&!m))try{let g=new d(S=>{var v;for(let y of S.getEntries()){let b=f?(v=y.blockingDuration)!=null?v:0:y.duration;b<Vx||n("js_stall",Math.round(b),{kind:f?"loaf":"longtask",severity:Bo(b)},Math.round(y.duration))}});g.observe({type:f?"long-animation-frame":"longtask",buffered:!0}),t=g}catch{}},u=()=>{if(!e())return;if(typeof document!="undefined"&&document.visibilityState!=="visible"||typeof requestAnimationFrame=="undefined"){s=setTimeout(u,Ho);return}let d=0,p=performance.now(),f=()=>{if(!e())return;d++;let m=performance.now()-p;if(m<Ux)r=requestAnimationFrame(f);else{let{fps:h,dropped:g}=Fo(d,m);n("frame_metrics",h,{totalFrames:d,dropped:g,windowMs:Math.round(m)}),s=setTimeout(u,Ho)}};r=requestAnimationFrame(f)};return document.readyState==="complete"?setTimeout(c,0):(o=()=>setTimeout(c,0),window.addEventListener("load",o,{once:!0})),l(),s=setTimeout(u,Ho),performance.memory&&(i=setTimeout(a,Gf)),()=>{t==null||t.disconnect(),r!=null&&typeof cancelAnimationFrame!="undefined"&&cancelAnimationFrame(r),s&&clearTimeout(s),i&&clearTimeout(i),o&&typeof window!="undefined"&&window.removeEventListener("load",o)}}var Ux,Ho,Vx,Gf,Yf=k(()=>{"use strict";qo();Ux=5e3,Ho=25e3,Vx=50,Gf=3e4});var rm={};L(rm,{EXIT_THRESHOLD:()=>Qf,EXIT_WEIGHTS:()=>Jf,REVERSAL_DEFAULTS:()=>zo,ScrollReversalDetector:()=>ls,canFire:()=>nm,isTopExit:()=>em,reversalMetrics:()=>tm,startExitIntent:()=>Xx});function em(n,e,t=Zf){return n&&e<=t}function tm(n,e){let t=n[n.length-1];if(n.length<2||!t)return null;let r=t;for(let o of n)if(t.t-o.t<=e){r=o;break}let s=t.t-r.t;if(s<=0)return null;let i=r.y-t.y;return{distancePx:i,velocityPxMs:i/s}}function nm(n,e,t,r={}){var s,i;return!(t>=((s=r.maxFires)!=null?s:Gx)||e>0&&n-e<((i=r.cooldownMs)!=null?i:Kx))}function Xx(n,e){if(typeof window=="undefined"||typeof document=="undefined")return{stop:()=>{},fires:()=>0};let t=0,r=0,s={...zo,...e!=null?e:{}},i=new ls(s),o=()=>{try{return Et(window.scrollY||0,document.documentElement.scrollHeight,window.innerHeight||0)}catch{return 0}},a=(u,d)=>{let p=Jf[u];if(p===void 0||p<Qf||!nm($o(),r,t))return;t++,r=$o();let f={confidence:p,trigger:u,path:location.pathname,scroll_depth_pct:o(),...d};n.trackEvent("$exit_intent",f),n.signal("exit_intent",f)},c=u=>{em(!u.relatedTarget,u.clientY,s.topEdgePx)&&a("top_exit",{x:u.clientX|0,y:u.clientY|0,exit_y:Math.round(u.clientY)})},l=()=>{let u=i.push(window.scrollY||0,$o(),o(),window.innerHeight||0);u&&a("scroll_reversal",{velocity_px_ms:Math.round(u.velocityPxMs*1e3)/1e3,distance_px:Math.round(u.distancePx)})};return document.addEventListener("mouseout",c),window.addEventListener("scroll",l,{passive:!0}),{fires:()=>t,stop:()=>{document.removeEventListener("mouseout",c),window.removeEventListener("scroll",l)}}}var Jf,Qf,Kx,Gx,Zf,zo,ls,$o,sm=k(()=>{"use strict";On();Jf={top_exit:.8,scroll_reversal:.5},Qf=.5,Kx=3e4,Gx=3,Zf=40,zo={windowMs:120,minDistancePx:80,minVelocityPxMs:.7,minDepthPct:25,sustainSamples:3,topEdgePx:Zf};ls=class{constructor(e=zo){this.tuning=e;this.buf=[];this.sustained=0;this.maxY=0;this.latched=!1}get maxScrollY(){return this.maxY}get sustainedSamples(){return this.sustained}push(e,t,r,s){for(e>this.maxY&&(this.maxY=e),this.buf.push({y:e,t});this.buf.length>2&&t-this.buf[1].t>this.tuning.windowMs;)this.buf.shift();let i=tm(this.buf,this.tuning.windowMs);return i!==null&&i.distancePx>=this.tuning.minDistancePx&&i.velocityPxMs>=this.tuning.minVelocityPxMs?(this.sustained+=1,this.latched||this.sustained<this.tuning.sustainSamples||this.maxY<=s||r<this.tuning.minDepthPct?null:(this.latched=!0,i)):(this.sustained=0,this.latched=!1,null)}};$o=()=>typeof performance!="undefined"&&performance.now?performance.now():Date.now()});function im(n,e){let t={...Jx,...n},r=Le(e,Yx),s=i=>r<Math.max(0,Math.min(1,i))*100;switch(t.mode){case"off":return{record:!1,streamFromStart:!1,bucket:r,reason:"off"};case"always":return{record:!0,streamFromStart:!0,bucket:r,reason:"always"};case"sampled":return s(t.sampleRate)?{record:!0,streamFromStart:!0,bucket:r,reason:"sampled-in"}:{record:!1,streamFromStart:!1,bucket:r,reason:"sampled-out"};case"onError":default:return s(t.onErrorSampleRate)?{record:!0,streamFromStart:!1,bucket:r,reason:"onerror-armed"}:{record:!1,streamFromStart:!1,bucket:r,reason:"onerror-out"}}}var Yx,Jx,om=k(()=>{"use strict";Fe();Yx="wzb-replay-v1",Jx={mode:"sampled",sampleRate:1,onErrorSampleRate:1}});var Vo={};L(Vo,{SegmentBuffer:()=>Uo,approxBytes:()=>Ht});function Ht(n){var i,o;let e=64,t=n.snapshot;if(typeof t=="string")e+=t.length;else if(t)try{e+=JSON.stringify(t).length}catch{e+=4096}let r=n.mutations;if(Array.isArray(r))for(let a of r){e+=40;let c=(o=(i=a.value)!=null?i:a.data)!=null?o:a.css;typeof c=="string"&&(e+=c.length),(a.node||a.doc)&&(e+=256),Array.isArray(a.rules)&&(e+=a.rules.reduce((l,u)=>l+u.length,0))}let s=n.events;return Array.isArray(s)&&(e+=s.length*48),e}var Uo,us=k(()=>{"use strict";Uo=class{constructor(e,t=1/0){this.maxSegments=e;this.maxBytes=t;this.sealed=[];this.current=null;this.droppedSegments=0;this.accumBytes=0}openSegment(e){var r;this.current&&this.sealed.push(this.current);let t=Ht(e);this.current={keyframeId:(r=e.frameId)!=null?r:"",frames:[e],bytes:t},this.accumBytes+=t,this.evict()}append(e){if(!this.current)return!1;let t=Ht(e);return this.current.frames.push(e),this.current.bytes+=t,this.accumBytes+=t,this.evict(),!0}evict(){for(;this.sealed.length>0&&(this.sealed.length+1>this.maxSegments||this.accumBytes>this.maxBytes);){let e=this.sealed.shift();this.accumBytes-=e.bytes,this.droppedSegments++}}drainFrames(){let e=[];for(let t of this.sealed)e.push(...t.frames);return this.current&&e.push(...this.current.frames),e}clear(){this.sealed=[],this.current=null,this.accumBytes=0}get currentFrameCount(){var e,t;return(t=(e=this.current)==null?void 0:e.frames.length)!=null?t:0}get currentBytes(){var e,t;return(t=(e=this.current)==null?void 0:e.bytes)!=null?t:0}get totalBytes(){return this.accumBytes}get segmentCount(){return this.sealed.length+(this.current?1:0)}get frameCount(){var e,t;return this.sealed.reduce((r,s)=>r+s.frames.length,0)+((t=(e=this.current)==null?void 0:e.frames.length)!=null?t:0)}get dropped(){return this.droppedSegments}get hasOpenSegment(){return this.current!==null}}});var ps,am=k(()=>{"use strict";ps=class{constructor(e,t){this.windowMs=e;this.emit=t;this.pending=[];this.timer=null}append(e){e.length&&(this.pending.push(...e),this.timer==null&&(this.timer=setTimeout(()=>this.flush(),this.windowMs)))}flush(){if(this.timer!=null&&(clearTimeout(this.timer),this.timer=null),!this.pending.length)return;let e=this.pending;this.pending=[],this.emit(e)}dispose(){this.flush()}}});function Qx(n,e){return n>700||e>800?3:n>350||e>400?2:n>150||e>100?1:0}function cm(n,e){if(e===0)return n;let t=n.mutations;if(e>=1&&Array.isArray(t)&&t.length>0&&t.every(s=>s.op==="canvas"))return null;let r=n.events;if(Array.isArray(r)&&r.length>0){let s=r.filter(i=>!(e>=2&&i.k==="move"));if(s.length===0)return null;s.length!==r.length&&(n.events=s)}return n}var fs,lm=k(()=>{"use strict";fs=class{constructor(e){this.egressPending=e;this.longTaskMs=0;this._level=0;if(typeof PerformanceObserver!="undefined")try{this.po=new PerformanceObserver(t=>{for(let r of t.getEntries())this.longTaskMs+=r.duration}),this.po.observe({type:"longtask",buffered:!1})}catch{}typeof setInterval=="function"&&(this.timer=setInterval(()=>this.sample(),1e3))}sample(){var t,r;let e=this.longTaskMs;this.longTaskMs=0,this._level=Qx(e,(r=(t=this.egressPending)==null?void 0:t.call(this))!=null?r:0)}get level(){return this._level}dispose(){var e;this.timer&&clearInterval(this.timer),(e=this.po)==null||e.disconnect(),this.po=void 0}}});function Wo(n){let e=n;for(let t of eS)e=e.replace(t,Zx);return e}function dm(n){let e=n.snapshot;e&&typeof e=="object"&&ms(e);let t=n.mutations;if(Array.isArray(t))for(let r of t)tS(r)}function ms(n){var e;if(n.t==="tx"||n.t==="cm"){typeof n.value=="string"&&(n.value=Wo(n.value));return}if(n.attrs)for(let t in n.attrs)typeof n.attrs[t]=="string"&&(n.attrs[t]=Wo(n.attrs[t]));if(Array.isArray(n.children))for(let t of n.children)ms(t);if((e=n.shadow)!=null&&e.children)for(let t of n.shadow.children)ms(t)}function tS(n){(n.op==="text"||n.op==="attr")&&typeof n.value=="string"&&(n.value=Wo(n.value)),n.op==="add"&&n.node&&ms(n.node)}var Zx,eS,um=k(()=>{"use strict";Zx="[redacted]",eS=[/\b[\w.+-]+@[\w-]+\.[\w.-]+\b/g,/\b[A-Z]{2}\d{2}[A-Z0-9]{10,30}\b/g,/\b\d{3}-\d{2}-\d{4}\b/g,/\b(?:\d[ -]?){13,18}\d\b/g,/(?:\+\d{1,3}[\s.-]?)?\(?\d{2,4}\)?[\s.-]\d{2,4}[\s.-]\d{2,4}(?:[\s.-]\d{2,4})?/g]});var mm={};L(mm,{deviceMemoryGB:()=>fm,networkHint:()=>pm,shouldDeferHeavyEgress:()=>jo,userOptedOutOfTracking:()=>rS});function nS(){if(typeof navigator!="undefined")return navigator.connection}function pm(){let n=nS(),e=typeof(n==null?void 0:n.effectiveType)=="string"?n.effectiveType:void 0;return{saveData:(n==null?void 0:n.saveData)===!0,slow:e==="2g"||e==="slow-2g",effectiveType:e}}function rS(){var t;if(typeof navigator=="undefined")return!1;let n=navigator;if(n.globalPrivacyControl===!0)return!0;let e=(t=n.doNotTrack)!=null?t:typeof window!="undefined"?window.doNotTrack:void 0;return e==="1"||e==="yes"}function fm(){if(typeof navigator=="undefined")return;let n=navigator.deviceMemory;return typeof n=="number"?n:void 0}function jo(){let n=pm();if(n.saveData||n.slow)return!0;let e=fm();return typeof e=="number"&&e<=1}var Ko=k(()=>{"use strict"});function Go(){try{if(typeof sessionStorage!="undefined"){let n=sessionStorage.getItem(hm);return n||(n=`t_${H()}`,sessionStorage.setItem(hm,n)),n}}catch{}return hs!=null?hs:hs=`t_${H()}`}function Xo(){try{return typeof location!="undefined"?location.pathname+location.search:void 0}catch{return}}function Yo(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}var hm,hs,gm=k(()=>{"use strict";$();hm="scalebun_replay_tab"});var Qo={};L(Qo,{GZ_PREFIX:()=>dn,ReplayEncoder:()=>Jo,decodeSnapshotValue:()=>iS,gunzipBase64:()=>ym,gzipBase64:()=>bm});async function bm(n){let e=new CompressionStream("gzip"),t=e.writable.getWriter();t.write(new TextEncoder().encode(n)),t.close();let r=await new Response(e.readable).arrayBuffer();return oS(new Uint8Array(r))}async function ym(n){let e=atob(n),t=new Uint8Array(e.length);for(let i=0;i<e.length;i++)t[i]=e.charCodeAt(i);let r=new DecompressionStream("gzip"),s=r.writable.getWriter();return s.write(t),s.close(),await new Response(r.readable).text()}async function iS(n){return typeof n=="string"&&n.startsWith(dn)?JSON.parse(await ym(n.slice(dn.length))):n}function oS(n){let e="";for(let r=0;r<n.length;r+=32768)e+=String.fromCharCode.apply(null,Array.from(n.subarray(r,r+32768)));return btoa(e)}var dn,sS,Jo,Zo=k(()=>{"use strict";dn="gz:",sS=`
572
572
  self.onmessage = async (e) => {
573
573
  const { id, json } = e.data;
574
574
  try {
@@ -584,28 +584,28 @@ self.onmessage = async (e) => {
584
584
  self.postMessage({ id, err: String(err) });
585
585
  }
586
586
  };
587
- `,Yo=class{constructor(){this.worker=null;this.url=null;this.nextId=1;this.pending=new Map;this.tryInitWorker()}tryInitWorker(){if(!(typeof Worker=="undefined"||typeof Blob=="undefined"||typeof URL=="undefined")&&typeof CompressionStream!="undefined")try{let e=new Blob([sS],{type:"application/javascript"});this.url=URL.createObjectURL(e),this.worker=new Worker(this.url),this.worker.onmessage=t=>{let{id:r,out:s,err:i}=t.data,o=this.pending.get(r);o&&(this.pending.delete(r),i!=null?o.reject(new Error(i)):o.resolve(s))},this.worker.onerror=()=>this.disableWorker()}catch{this.disableWorker()}}disableWorker(){var e;try{(e=this.worker)==null||e.terminate()}catch{}if(this.worker=null,this.url){try{URL.revokeObjectURL(this.url)}catch{}this.url=null}for(let t of this.pending.values())t.reject(new Error("worker disabled"));this.pending.clear()}async encodeSnapshot(e){let t;try{t=JSON.stringify(e)}catch{return e}if(this.worker)try{return dn+await this.viaWorker(t)}catch{this.disableWorker()}if(typeof CompressionStream!="undefined")try{return dn+await bm(t)}catch{}return e}viaWorker(e){return new Promise((t,r)=>{let s=this.nextId++,i=setTimeout(()=>{this.pending.delete(s)&&r(new Error("worker timeout"))},5e3);this.pending.set(s,{resolve:o=>{clearTimeout(i),t(o)},reject:o=>{clearTimeout(i),r(o)}}),this.worker.postMessage({id:s,json:e})})}dispose(){this.disableWorker()}}});function vm(n){var e;return(e=n.shadowRoot)!=null?e:null}function hs(n,e){e.remove(n);let t=vm(n);t&&t.childNodes.forEach(r=>hs(r,e)),n.childNodes.forEach(r=>hs(r,e))}function gs(n,e=[]){let t=vm(n);return t&&(e.push(t),t.childNodes.forEach(r=>gs(r,e))),n.childNodes.forEach(r=>gs(r,e)),e}function Zo(n,e){e.add(n),n.childNodes.forEach(t=>Zo(t,e))}var wm=E(()=>{"use strict"});var ea={};L(ea,{MutationRecorder:()=>ft,buildMutations:()=>xm});function aS(n){bs.add(n),!(Ht||typeof Element=="undefined"||typeof Element.prototype.attachShadow!="function")&&(Ht=Element.prototype.attachShadow,Element.prototype.attachShadow=function(e){let t=Ht.call(this,e);if(e&&e.mode==="open")for(let r of bs)try{r(this,t)}catch{}return t})}function cS(n){bs.delete(n),bs.size===0&&Ht&&(Element.prototype.attachShadow=Ht,Ht=null)}function ys(n,e){n.childNodes.forEach(t=>{if(t.nodeType!==1)return;let r=t,s=r.shadowRoot;s&&(e(r,s),ys(s,e)),ys(r,e)})}function xm(n,e,t){var l,u,d,p,f,m,h;let r=new Map,s=new Map,i=[],o=[];for(let g of n)if(g.type==="attributes"){let S=e.getId(g.target);if(S==null||!g.attributeName)continue;let v=g.target.getAttribute(g.attributeName);if(v!=null&&t.maskAllInputs&&Lr.has(g.attributeName)&&(v=Ge(v)),v!=null&&g.attributeName==="value"&&Rt(g.target)&&(v=Tt(v)),v!=null){let y=g.target;v=Nr(g.attributeName,v,(u=(l=y.tagName)==null?void 0:l.toLowerCase())!=null?u:"",(p=(d=y.ownerDocument)==null?void 0:d.baseURI)!=null?p:"")}r.set(`${S}:${g.attributeName}`,{op:"attr",id:S,key:g.attributeName,value:v})}else if(g.type==="characterData"){let S=e.getId(g.target);if(S==null)continue;let v=(m=(f=g.target.parentNode)==null?void 0:f.nodeName)!=null?m:"",y=g.target.data,w=(t.maskAllText||_r(g.target.parentElement,t.maskSel))&&!Pr.has(v)?Ge(y):y;s.set(S,{op:"text",id:S,value:w})}else g.type==="childList"&&(g.removedNodes.forEach(S=>{var y;let v=e.getId(S);v!=null&&(i.push({op:"remove",parent:(y=e.getId(g.target))!=null?y:0,id:v}),hs(S,e))}),g.addedNodes.forEach(S=>o.push({node:S,parent:g.target,next:g.nextSibling})));let a=new Set,c=[];for(let{node:g,parent:S,next:v}of o){if(a.has(g)||!g.isConnected)continue;let y=e.getId(S);if(y==null)continue;let b=Xe(g,e,t);b&&(Zo(g,a),c.push({op:"add",parent:y,next:v&&(h=e.getId(v))!=null?h:null,node:b}))}return[...i,...c,...r.values(),...s.values()]}var bs,Ht,ft,un=E(()=>{"use strict";et();wm();bs=new Set,Ht=null;ft=class{constructor(e,t,r={}){this.reg=e;this.onMutations=t;this.observer=null;this.queued=[];this.scheduled=!1;this.rafId=null;this.shadowObservers=new Map;this.shadowHandler=null;this.observedDoc=null;this.o=Ze(r)}observe(e){var t;typeof MutationObserver!="undefined"&&(this.observer=new MutationObserver(r=>this.enqueue(r)),this.observer.observe(e,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),this.observedDoc=(t=e.ownerDocument)!=null?t:e,ys(e,(r,s)=>this.observeShadowRoot(s)),this.shadowHandler=(r,s)=>{if(r.ownerDocument!==this.observedDoc)return;let i=!this.shadowObservers.has(s);this.observeShadowRoot(s);let o=this.reg.getId(r);i&&o!=null&&this.onMutations([{op:"shadow",host:o,shadow:Or(s,this.reg,this.o)}])},aS(this.shadowHandler))}observeShadowRoot(e){if(this.shadowObservers.has(e)||typeof MutationObserver=="undefined")return;let t=new MutationObserver(r=>this.enqueue(r));t.observe(e,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),this.shadowObservers.set(e,t),ys(e,(r,s)=>this.observeShadowRoot(s))}enqueue(e){this.queued.push(...e),!this.scheduled&&(this.scheduled=!0,typeof requestAnimationFrame=="function"?this.rafId=requestAnimationFrame(()=>this.drain()):queueMicrotask(()=>this.drain()))}drain(){this.scheduled=!1,this.rafId=null,this.observer&&this.queued.push(...this.observer.takeRecords()),this.takeShadowRecords();let e=this.queued;this.queued=[],this.process(e)}flush(){this.rafId!=null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(this.rafId),this.scheduled=!1,this.rafId=null,this.observer&&this.queued.push(...this.observer.takeRecords()),this.takeShadowRecords();let e=this.queued;this.queued=[],this.process(e)}disconnect(){var e;this.rafId!=null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(this.rafId),(e=this.observer)==null||e.disconnect(),this.observer=null;for(let t of this.shadowObservers.values())t.disconnect();this.shadowObservers.clear(),this.shadowHandler&&(cS(this.shadowHandler),this.shadowHandler=null),this.observedDoc=null,this.queued=[],this.scheduled=!1,this.rafId=null}takeShadowRecords(){for(let e of this.shadowObservers.values())this.queued.push(...e.takeRecords())}process(e){if(!e.length)return;this.releaseRemovedShadowRoots(e);let t=xm(e,this.reg,this.o);t.length&&this.onMutations(t)}releaseRemovedShadowRoots(e){if(this.shadowObservers.size!==0)for(let t of e)t.type==="childList"&&t.removedNodes.forEach(r=>{if(!r.isConnected)for(let s of gs(r)){let i=this.shadowObservers.get(s);i&&(i.disconnect(),this.shadowObservers.delete(s))}})}}});var na={};L(na,{InteractionRecorder:()=>ta});function Sm(){try{return typeof location!="undefined"?location.href:""}catch{return""}}function uS(n){var r;let e=(r=n.getAttribute)==null?void 0:r.call(n,"role");if(e)return e;let t=n.tagName.toLowerCase();if(t==="a")return"link";if(t==="button"||t==="summary")return"button";if(t==="input"||t==="select"||t==="textarea"||t==="label")return"input"}function pS(n,e){var s,i,o,a,c,l,u;let t=d=>d&&d.trim()?d.trim():"",r=t((s=n.getAttribute)==null?void 0:s.call(n,"aria-label"))||t((i=n.getAttribute)==null?void 0:i.call(n,"title"))||t((o=n.getAttribute)==null?void 0:o.call(n,"alt"))||t((a=n.getAttribute)==null?void 0:a.call(n,"name"))||t((c=n.getAttribute)==null?void 0:c.call(n,"placeholder"));if(!r&&!e&&(r=t(n.innerText||n.textContent)),!r){let d=t((l=n.getAttribute)==null?void 0:l.call(n,"id")),p=t((((u=n.getAttribute)==null?void 0:u.call(n,"class"))||"").split(/\s+/)[0]);r=d?`#${d}`:p?`.${p}`:""}return r=r.replace(/\s+/g," ").trim(),r?r.slice(0,40):void 0}function fS(n,e){var t,r;try{let s=n;if(s&&s.nodeType!==1&&(s=s.parentElement),!s||s.nodeType!==1)return;let i=s,o=(r=(t=i.closest)==null?void 0:t.call(i,dS))!=null?r:null,a=o!=null?o:i;return{tag:a.tagName.toLowerCase(),interactive:!!o,role:o?uS(a):void 0,label:pS(a,e)}}catch{return}}function km(n){for(let e=0;e<n.length;e++)if(n[e].nodeType===1)return!0;return!1}function mS(n,e){var s,i,o;let t=n,r=0;for(;t&&r++<500;){if(t===e)return!0;let a=(i=t.parentNode)!=null?i:(s=t.getRootNode)==null?void 0:s.call(t);t=a&&a!==t?(o=a.host)!=null?o:a:null}return!1}var lS,ta,dS,ra=E(()=>{"use strict";et();lS={moveThrottleMs:50,scrollThrottleMs:100,flushMs:100,deadMs:700,rageWindowMs:800,rageRadius:30,rageMin:3,maskInputs:!0,maskText:!0},ta=class{constructor(e,t,r={}){this.reg=e;this.onEvents=t;this.pending=[];this.listeners=[];this.timer=null;this.deadTimers=new Set;this.deadObservers=new Set;this.lastMoveT=0;this.lastScrollT=0;this.lastActivityT=0;this.clickHistory=[];this.startHref="";this.frameOffsets=new Map;this.onMove=e=>{let t=e,r=Date.now();if(r-this.lastMoveT<this.o.moveThrottleMs)return;this.lastMoveT=r;let s=this.offsetFor(e.target),i=this.rootScroll(e.target);this.pending.push({k:"move",x:t.clientX+s.x,y:t.clientY+s.y,sx:i.sx,sy:i.sy,t:r})};this.onClick=e=>{var m;let t=e,r=Date.now(),s=this.reg.getId(e.target),i=this.offsetFor(e.target),o=this.rootScroll(e.target),a=t.clientX+i.x,c=t.clientY+i.y;this.clickHistory=this.clickHistory.filter(h=>r-h.t<this.o.rageWindowMs);let l=this.clickHistory.filter(h=>Math.hypot(h.x-a,h.y-c)<=this.o.rageRadius);this.clickHistory.push({x:a,y:c,t:r});let u=l.length+1>=this.o.rageMin,d=(m=e.composedPath)==null?void 0:m.call(e),p=d&&d.length?d[0]:e.target,f=fS(p,this.o.maskText);this.pending.push({k:"click",x:a,y:c,sx:o.sx,sy:o.sy,id:s,t:r,...u?{rage:!0}:{},...f?{el:f}:{}}),this.armDeadCheck(p,{x:a,y:c,sx:o.sx,sy:o.sy,id:s,at:r,el:f})};this.onScroll=e=>{var o,a,c,l;let t=Date.now();if(t-this.lastScrollT<this.o.scrollThrottleMs)return;this.lastScrollT=t;let r=e.target,s=(o=r.documentElement)!=null?o:r,i=(a=this.reg.getId(s))!=null?a:0;this.pending.push({k:"scroll",id:i,x:(c=s.scrollLeft)!=null?c:0,y:(l=s.scrollTop)!=null?l:0,t})};this.onInput=e=>{var i;let t=e.target,r=this.reg.getId(t);if(r==null)return;let s=(i=t.value)!=null?i:"";Rt(t)?s=Tt(s):this.o.maskInputs&&(s=Ge(s)),this.pending.push({k:"input",id:r,value:s,t:Date.now()})};this.onResize=()=>{this.pending.push({k:"viewport",w:window.innerWidth,h:window.innerHeight,t:Date.now()})};this.o={...lS,...r}}notifyDomActivity(e=Date.now()){this.lastActivityT=e}observe(){typeof document!="undefined"&&(this.startHref=Sm(),this.add(document,"mousemove",this.onMove,!0),this.add(document,"click",this.onClick,!0),this.add(document,"scroll",this.onScroll,!0),this.add(document,"input",this.onInput,!0),typeof window!="undefined"&&this.add(window,"resize",this.onResize,!0),this.timer=setInterval(()=>this.flush(),this.o.flushMs))}observeFrame(e,t){this.frameOffsets.has(e)||(this.frameOffsets.set(e,t),this.add(e,"mousemove",this.onMove,!0),this.add(e,"click",this.onClick,!0),this.add(e,"scroll",this.onScroll,!0),this.add(e,"input",this.onInput,!0))}unobserveFrame(e){this.frameOffsets.delete(e)&&(this.listeners=this.listeners.filter(t=>{if(t.target===e){try{t.target.removeEventListener(t.type,t.fn,t.capture)}catch{}return!1}return!0}))}rootScroll(e){var t,r,s,i,o,a,c,l,u,d;try{let p=e&&e.ownerDocument||(typeof document!="undefined"?document:null);if(!p)return{sx:0,sy:0};let f=p.defaultView,m=(o=(i=(r=f==null?void 0:f.scrollX)!=null?r:(t=p.documentElement)==null?void 0:t.scrollLeft)!=null?i:(s=p.body)==null?void 0:s.scrollLeft)!=null?o:0,h=(d=(u=(c=f==null?void 0:f.scrollY)!=null?c:(a=p.documentElement)==null?void 0:a.scrollTop)!=null?u:(l=p.body)==null?void 0:l.scrollTop)!=null?d:0;return{sx:Math.round(m),sy:Math.round(h)}}catch{return{sx:0,sy:0}}}offsetFor(e){let t=e&&e.ownerDocument||null,r=t?this.frameOffsets.get(t):void 0;if(!r)return{x:0,y:0};try{return r()}catch{return{x:0,y:0}}}flush(){if(!this.pending.length)return;let e=this.pending;this.pending=[],this.onEvents(e)}disconnect(){for(let e of this.listeners)e.target.removeEventListener(e.type,e.fn,e.capture);this.listeners=[],this.timer&&clearInterval(this.timer),this.timer=null;for(let e of this.deadTimers)clearTimeout(e);this.deadTimers.clear();for(let e of this.deadObservers)try{e.disconnect()}catch{}this.deadObservers.clear(),this.frameOffsets.clear(),this.pending=[]}add(e,t,r,s){e.addEventListener(t,r,s),this.listeners.push({target:e,type:t,fn:r,capture:s})}armDeadCheck(e,t){let{x:r,y:s,id:i,at:o,el:a}=t,c=e&&e.nodeType===1&&e.isConnected?e:null,l=!1,u=null,d=()=>{if(u){try{u.disconnect()}catch{}this.deadObservers.delete(u),u=null}};if(typeof MutationObserver!="undefined"&&typeof document!="undefined")try{u=new MutationObserver(f=>{for(let m of f){let h=c?mS(m.target,c):!1,g=m.type==="childList"&&(km(m.addedNodes)||km(m.removedNodes));if(h||g){l=!0;break}}l&&d()}),u.observe(document,{subtree:!0,childList:!0}),c&&u.observe(c,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),this.deadObservers.add(u)}catch{l=!0}else l=!0;let p=setTimeout(()=>{this.deadTimers.delete(p),d(),!l&&Sm()===this.startHref&&this.pending.push({k:"deadclick",x:r,y:s,sx:t.sx,sy:t.sy,id:i,t:o,...a?{el:a}:{}})},this.o.deadMs);this.deadTimers.add(p)}};dS='a[href],button,input,select,textarea,label,summary,[role=button],[role=link],[role=menuitem],[role=tab],[role=checkbox],[role=radio],[role=switch],[contenteditable=""],[contenteditable=true],[tabindex]:not([tabindex="-1"])'});var Rm={};L(Rm,{bridgeCrossOriginFrame:()=>sa,installChildSatellite:()=>hS,nodeIdBaseFor:()=>ia});function hS(n,e={}){if(typeof window=="undefined"||window.parent===window)return()=>{};let t=Ze(e),r,s=!1,i=o=>{let a=o.data;if(!a||a.scalebun!==Em||s||!Am(o.origin,n))return;s=!0;let c=new rn(typeof a.nodeIdBase=="number"?a.nodeIdBase:1),l=d=>{var p;try{(p=o.source)==null||p.postMessage(d,o.origin)}catch{}},u=Xe(document,c,t);u&&l({scalebun:Im,doc:u}),r=new ft(c,d=>l({scalebun:Cm,mutations:d}),e),r.observe(document.documentElement)};return window.addEventListener("message",i),()=>{window.removeEventListener("message",i),r==null||r.disconnect()}}function sa(n,e,t){let r=n.contentWindow;if(!r)return()=>{};let s=a=>{if(a.source!==r||!Am(a.origin,t.allowedChildOrigins))return;let c=a.data;c&&(c.scalebun===Im&&c.doc?t.emit([{op:"iframe",id:e,doc:c.doc}]):c.scalebun===Cm&&Array.isArray(c.mutations)&&t.emit(c.mutations))};window.addEventListener("message",s);let i="*";try{i=new URL(n.src,location.href).origin}catch{}let o=()=>{try{r.postMessage({scalebun:Em,nodeIdBase:t.nodeIdBase},i)}catch{}};return o(),n.addEventListener("load",o),()=>{window.removeEventListener("message",s),n.removeEventListener("load",o)}}var Em,Im,Cm,Am,ia,oa=E(()=>{"use strict";sn();et();un();Em="scalebun:frame-init",Im="scalebun:frame-key",Cm="scalebun:frame-mut",Am=(n,e)=>e.includes("*")||e.includes(n);ia=n=>n*1e6});var ca={};L(ca,{IframeManager:()=>aa});var aa,la=E(()=>{"use strict";et();un();oa();aa=class{constructor(e,t,r={},s={}){this.reg=e;this.onMutations=t;this.attached=new Map;this.loadListeners=[];this.bridges=new Map;this.started=!1;var i,o;this.o=Ze(r),this.onFrame=s.onFrame,this.onUnframe=s.onUnframe,this.maxDepth=(i=s.maxDepth)!=null?i:3,this.frameOrigins=(o=s.frameOrigins)!=null?o:[]}start(){this.started||typeof document=="undefined"||(this.started=!0,this.installLoad(document,0),this.scan(document,0))}scan(e,t){if(!(t>this.maxDepth)){this.sweep();try{e.querySelectorAll("iframe").forEach(r=>this.attach(r,t))}catch{}}}sweep(){var e;if(this.attached.size)for(let[t,{doc:r,rec:s}]of this.attached)t.isConnected||(s.disconnect(),(e=this.onUnframe)==null||e.call(this,r),this.attached.delete(t));if(this.bridges.size)for(let[t,r]of this.bridges)t.isConnected||(r(),this.bridges.delete(t))}installLoad(e,t){let r=s=>{let i=s.target;i&&i.tagName==="IFRAME"&&this.attach(i,t)};try{e.addEventListener("load",r,!0),this.loadListeners.push({doc:e,fn:r})}catch{}}attach(e,t){var c,l;if(t>this.maxDepth)return;let r=null;try{r=e.contentDocument}catch{this.bridgeCrossOrigin(e);return}if(!r||!r.documentElement){this.bridgeCrossOrigin(e);return}let s=this.attached.get(e);if(s){if(s.doc===r)return;s.rec.disconnect(),(c=this.onUnframe)==null||c.call(this,s.doc),this.attached.delete(e)}let i=this.reg.getId(e);if(i==null)return;let o=Xe(r,this.reg,this.o);o&&this.onMutations([{op:"iframe",id:i,doc:o}]);let a=new ft(this.reg,this.onMutations,this.o);a.observe(r.documentElement),this.attached.set(e,{doc:r,rec:a}),(l=this.onFrame)==null||l.call(this,r,()=>{try{let u=e.getBoundingClientRect();return{x:u.left,y:u.top}}catch{return{x:0,y:0}}}),t<this.maxDepth&&(this.installLoad(r,t+1),this.scan(r,t+1))}bridgeCrossOrigin(e){if(!this.frameOrigins.length||this.bridges.has(e))return;let t=this.reg.getId(e);if(t==null)return;let r=sa(e,t,{nodeIdBase:ia(t),allowedChildOrigins:this.frameOrigins,emit:this.onMutations});this.bridges.set(e,r)}subDocuments(){return this.sweep(),[...this.attached.values()].map(e=>e.doc)}disconnect(){for(let{rec:e}of this.attached.values())e.disconnect();this.attached.clear();for(let e of this.bridges.values())e();this.bridges.clear();for(let{doc:e,fn:t}of this.loadListeners)try{e.removeEventListener("load",t,!0)}catch{}this.loadListeners=[],this.started=!1}}});var Tm={};L(Tm,{CanvasRecorder:()=>da});var gS,da,Mm=E(()=>{"use strict";gS="data-scalebun-block",da=class{constructor(e,t,r=()=>{},s={}){this.reg=e;this.onMutations=t;this.log=r;this.timer=null;this.last=new Map;this.tainted=new Set;this.scratch=null;var i,o,a;this.intervalMs=Math.max(50,Math.round(1e3/((i=s.fps)!=null?i:3))),this.maxDim=(o=s.maxDim)!=null?o:1024,this.quality=(a=s.quality)!=null?a:.6,this.getDocs=s.getDocs}start(){typeof document!="undefined"&&(this.capture(),this.timer=setInterval(()=>this.capture(),this.intervalMs))}disconnect(){this.timer&&clearInterval(this.timer),this.timer=null,this.last.clear(),this.tainted.clear(),this.scratch=null}capture(){let e=this.getDocs?this.getDocs():typeof document!="undefined"?[document]:[],t=[],r=new Set;for(let s of e){let i;try{i=s.querySelectorAll("canvas")}catch{continue}i.forEach(o=>{let a=this.reg.getId(o);if(a==null||(r.add(a),o.hasAttribute(gS)))return;let c=o.width,l=o.height;if(!c||!l)return;let u;try{u=this.encode(o,c,l)}catch{this.tainted.has(a)||(this.tainted.add(a),this.log("[scalebun] canvas not capturable (tainted / cross-origin)"));return}this.last.get(a)!==u&&(this.last.set(a,u),t.push({op:"canvas",id:a,data:u,w:c,h:l}))})}if(this.last.size>r.size)for(let s of this.last.keys())r.has(s)||this.last.delete(s);if(this.tainted.size)for(let s of this.tainted)r.has(s)||this.tainted.delete(s);t.length&&this.onMutations(t)}encode(e,t,r){var i;let s=Math.min(1,this.maxDim/Math.max(t,r));if(s<1){let o=(i=this.scratch)!=null?i:this.scratch=document.createElement("canvas");o.width=Math.max(1,Math.round(t*s)),o.height=Math.max(1,Math.round(r*s));let a=o.getContext("2d");if(!a)throw new Error("no 2d context");return a.clearRect(0,0,o.width,o.height),a.drawImage(e,0,0,o.width,o.height),o.toDataURL("image/webp",this.quality)}return e.toDataURL("image/webp",this.quality)}}});var Pm={};L(Pm,{installCadence:()=>bS});function bS(n){let e=[];if(n.keyframeIntervalMs>0&&n.keyframeIntervalMs!==1/0){let t=setInterval(()=>n.onCheckpoint("time"),n.keyframeIntervalMs);e.push(()=>clearInterval(t))}if(typeof document!="undefined"){let t=()=>{document.visibilityState==="visible"&&n.onCheckpoint("visible")};document.addEventListener("visibilitychange",t),e.push(()=>document.removeEventListener("visibilitychange",t))}if(typeof window!="undefined"&&typeof history!="undefined"&&typeof location!="undefined"){let t=location.href,r=()=>{location.href!==t&&(t=location.href,n.onCheckpoint("url"))};window.addEventListener("popstate",r),window.addEventListener("hashchange",r);let s=history.pushState,i=history.replaceState;history.pushState=function(...o){let a=s.apply(this,o);return r(),a},history.replaceState=function(...o){let a=i.apply(this,o);return r(),a},e.push(()=>{window.removeEventListener("popstate",r),window.removeEventListener("hashchange",r),history.pushState!==s&&(history.pushState=s),history.replaceState!==i&&(history.replaceState=i)})}return()=>{for(let t of e)try{t()}catch{}}}var Lm=E(()=>{"use strict"});var Bm={};L(Bm,{RecorderController:()=>ws,createRecorder:()=>kS});async function kS(n,e){let t=new ws(n,e);return await t.init(),t}function Om(){try{return typeof window!="undefined"?{width:window.innerWidth,height:window.innerHeight}:void 0}catch{return}}function Nm(){try{return typeof location!="undefined"?location.href:void 0}catch{return}}var _m,vs,vS,wS,xS,SS,ws,Fm=E(()=>{"use strict";$();Vt();Rn();us();lm();um();jo();gm();Sn();_m=120,vs=2e5,vS=8,wS=2e6,xS=3e4,SS=5*6e4;ws=class{constructor(e,t){this.ctx=e;this.decision=t;this.active=!1;this.seq=Ks(0);this.keyframeId="";this.checkpointing=!1;this.dirtySinceKeyframe=!1;this.lastKeyframeAt=0;this.streamChainBytes=0;this.streamChainFrames=0;this.pendingEncodes=new Set;this.shed=0;this.redactPII=!1;this.paused=!1;var r,s;this.streaming=t.streamFromStart,this.streaming&&Wo()&&(this.streaming=!1,e.log("[replay] save-data/slow \u2192 buffered")),this.persistBuffer=!!((r=e.replaySampling)!=null&&r.persistBuffer)&&!this.streaming,this.maskText=(s=e.maskReplayText)!=null?s:!1}nextSeq(){let e=Ks(1);return this.seq=e+1,e}get isActive(){return this.active}stats(){var t,r,s,i,o,a;let e=this.segBuf;return{recording:this.active&&!this.paused,paused:this.paused,streaming:this.streaming,sampleReason:this.decision.reason,sampleBucket:this.decision.bucket,qualityLevel:(r=(t=this.adaptive)==null?void 0:t.level)!=null?r:0,segments:(s=e==null?void 0:e.segmentCount)!=null?s:0,frames:(i=e==null?void 0:e.frameCount)!=null?i:0,captured:this.keyframeId!=null,bufferBytes:(o=e==null?void 0:e.totalBytes)!=null?o:0,droppedSegments:(a=e==null?void 0:e.dropped)!=null?a:0,shedFrames:this.shed}}forceCheckpoint(e){this.checkpoint(e)}async init(){let[{ReplayEncoder:e},{SegmentBuffer:t}]=await Promise.all([Promise.resolve().then(()=>(Qo(),Jo)),Promise.resolve().then(()=>(us(),Uo))]);this.segBuf=new t(vS,wS),this.persistBuffer&&(this.replayStore=new Be("pending-replay"),await this.recoverPriorPreRoll(),this.installPersistGuards()),this.encoder=new e,this.disposeEncoder=()=>{var r;return(r=this.encoder)==null?void 0:r.dispose()},await this.arm(),this.unsubSignal=this.ctx.onSignal(()=>this.flush()),this.active=!0}async arm(){var S,v,y,b;if(typeof document=="undefined")return;let e=this.ctx,[{NodeRegistry:t},{takeSnapshot:r},{MutationRecorder:s},{InteractionRecorder:i},{CssomRecorder:o},{IframeManager:a}]=await Promise.all([Promise.resolve().then(()=>(sn(),Fr)),Promise.resolve().then(()=>(et(),Br)),Promise.resolve().then(()=>(un(),ea)),Promise.resolve().then(()=>(ra(),na)),Promise.resolve().then(()=>(Tr(),ji)),Promise.resolve().then(()=>(la(),ca))]),c=new t,l={maskAllText:this.maskText,maskAllInputs:(S=e.maskInputs)!=null?S:!0,maskSelectors:e.maskSelectors};this.redactPII=((v=e.replaySampling)==null?void 0:v.privacyLevel)==="strict"&&!l.maskAllText,this.reg=c,this.snapOpts=l,this.takeSnapshotFn=r;let u=r(document,c,l);this.keyframeId=`f_${H()}`;let d={kind:"frame",renderer:"dom",frameType:"keyframe",frameId:this.keyframeId,seq:this.nextSeq(),snapshot:u,viewport:Om(),href:Nm(),tabId:Ko(),viewId:Xo(),route:Go(),masked:!0,timestamp:P()};this.push(d),this.compressInPlace(d,u),this.persistPreRoll(),this.dirtySinceKeyframe=!1,this.lastKeyframeAt=P();let p=new i(c,w=>{this.push(this.delta({events:w}))},{maskText:!!l.maskAllText}),f=new s(c,w=>{p.notifyDomActivity(),this.push(this.delta({mutations:w}))},l),m=new o(c,w=>{p.notifyDomActivity(),this.push(this.delta({mutations:w}))}),h=new a(c,w=>{p.notifyDomActivity(),this.push(this.delta({mutations:w}))},l,{onFrame:(w,x)=>p.observeFrame(w,x),onUnframe:w=>p.unobserveFrame(w),frameOrigins:(y=e.replayFrameOrigins)!=null?y:[]});if(((b=e.replayFrameOrigins)!=null?b:[]).length&&Promise.resolve().then(()=>(oa(),Rm)).then(({installChildSatellite:w})=>{var x;this.childSatelliteStop=w((x=e.replayFrameOrigins)!=null?x:[],l)}),this.mutationRec=f,this.cssomRec=m,f.observe(document.documentElement),p.observe(),m.install(),h.start(),this.disconnectRecorder=()=>f.disconnect(),this.disconnectInteractions=()=>p.disconnect(),this.disconnectCssom=()=>m.disconnect(),this.disconnectIframes=()=>h.disconnect(),e.replayCanvas){let{CanvasRecorder:w}=await Promise.resolve().then(()=>(Mm(),Tm)),x=new w(c,I=>{p.notifyDomActivity(),this.push(this.delta({mutations:I}))},(...I)=>e.log(...I));x.start(),this.disconnectCanvas=()=>x.disconnect()}this.adaptive=new ps(e.egressPending);let{installCadence:g}=await Promise.resolve().then(()=>(Lm(),Pm));this.disconnectCadence=g({keyframeIntervalMs:xS,onCheckpoint:w=>this.checkpoint(w)})}disarm(){var e,t,r,s,i,o,a,c;(e=this.disconnectRecorder)==null||e.call(this),(t=this.disconnectInteractions)==null||t.call(this),(r=this.disconnectCssom)==null||r.call(this),(s=this.disconnectCanvas)==null||s.call(this),(i=this.disconnectIframes)==null||i.call(this),(o=this.childSatelliteStop)==null||o.call(this),(a=this.disconnectCadence)==null||a.call(this),(c=this.adaptive)==null||c.dispose(),this.disconnectRecorder=void 0,this.disconnectInteractions=void 0,this.disconnectCssom=void 0,this.disconnectCanvas=void 0,this.disconnectIframes=void 0,this.childSatelliteStop=void 0,this.disconnectCadence=void 0,this.adaptive=void 0,this.reg=void 0,this.mutationRec=void 0,this.cssomRec=void 0,this.takeSnapshotFn=void 0,this.snapOpts=void 0}pause(){!this.active||this.paused||(this.disarm(),this.paused=!0,this.ctx.log("[replay] paused"))}resume(){!this.active||!this.paused||(this.paused=!1,this.arm().then(()=>this.ctx.log("[replay] resumed")))}setPrivacy(e){typeof(e==null?void 0:e.maskAllText)!="boolean"||e.maskAllText===this.maskText||(this.maskText=e.maskAllText,this.active&&!this.paused&&(this.disarm(),this.arm()),this.ctx.log("[replay] privacy set: maskAllText="+this.maskText))}delta(e){return{kind:"frame",renderer:"dom",frameType:"delta",frameId:`f_${H()}`,baseFrameId:this.keyframeId,seq:this.nextSeq(),...e,tabId:Ko(),viewId:Xo(),route:Go(),masked:!0,timestamp:P()}}push(e){if(e.frameType==="delta"&&(this.dirtySinceKeyframe=!0),this.redactPII&&dm(e),e.frameType==="delta"&&this.adaptive&&this.adaptive.level>0){let r=cm(e,this.adaptive.level);if(!r){this.shed++;return}e=r}if(this.streaming){this.ctx.emit(e),e.frameType==="delta"&&(this.streamChainBytes+=ln(e),this.streamChainFrames++,!this.checkpointing&&(this.streamChainFrames>=_m||this.streamChainBytes>=vs)&&this.checkpoint(this.streamChainBytes>=vs?"segment-bytes":"segment-frames"));return}let t=this.segBuf;t&&(e.frameType==="keyframe"?t.openSegment(e):t.append(e),!this.checkpointing&&e.frameType==="delta"&&(t.currentFrameCount>=_m||t.currentBytes>=vs)&&this.checkpoint(t.currentBytes>=vs?"segment-bytes":"segment-frames"))}checkpoint(e){var t,r;if(!(this.checkpointing||!this.reg||!this.takeSnapshotFn||typeof document=="undefined")&&!(e==="time"&&!this.dirtySinceKeyframe&&P()-this.lastKeyframeAt<SS)){this.checkpointing=!0;try{(t=this.mutationRec)==null||t.flush(),(r=this.cssomRec)==null||r.flush();let s=this.takeSnapshotFn(document,this.reg,this.snapOpts),i=`f_${H()}`;this.keyframeId=i,this.streamChainBytes=0,this.streamChainFrames=0;let o={kind:"frame",renderer:"dom",frameType:"keyframe",frameId:i,seq:this.nextSeq(),snapshot:s,viewport:Om(),href:Nm(),masked:!0,trigger:e,timestamp:P()};this.push(o),this.compressInPlace(o,s),this.persistPreRoll(),this.dirtySinceKeyframe=!1,this.lastKeyframeAt=P()}finally{this.checkpointing=!1}}}async recoverPriorPreRoll(){var e;if(this.replayStore)try{let t=await this.replayStore.load();if(Array.isArray(t)&&t.length){let r=0;for(let s of t)this.ctx.emit(s),r=Math.max(r,(e=s.seq)!=null?e:0);this.seq=Ic(r+1),await this.replayStore.clear()}}catch{}}persistPreRoll(){!this.replayStore||!this.segBuf||this.streaming||this.replayStore.save(kt(this.segBuf.drainFrames(),()=>!0,e=>e.frameType==="keyframe"))}installPersistGuards(){typeof window!="undefined"&&(this.onPageHide=()=>{var e;return void((e=this.replayStore)==null?void 0:e.clear())},window.addEventListener("pagehide",this.onPageHide),this.onVisHidden=()=>{typeof document!="undefined"&&document.visibilityState==="hidden"&&this.persistPreRoll()},typeof document!="undefined"&&document.addEventListener("visibilitychange",this.onVisHidden))}compressInPlace(e,t){let r=this.encoder;if(!r)return;let s=r.encodeSnapshot(t).then(i=>{e.snapshot=i}).catch(()=>{}).finally(()=>{this.pendingEncodes.delete(s)});this.pendingEncodes.add(s)}flush(){var e,t,r,s;if((e=this.mutationRec)==null||e.flush(),(t=this.cssomRec)==null||t.flush(),this.segBuf)for(let i of this.segBuf.drainFrames())this.ctx.emit(i);(r=this.segBuf)==null||r.clear(),this.streaming=!0,(s=this.replayStore)==null||s.clear()}teardown(){var e,t,r,s;this.disarm(),(e=this.disposeEncoder)==null||e.call(this),this.onPageHide&&typeof window!="undefined"&&window.removeEventListener("pagehide",this.onPageHide),this.onPageHide=void 0,this.onVisHidden&&typeof document!="undefined"&&document.removeEventListener("visibilitychange",this.onVisHidden),this.onVisHidden=void 0,(t=this.replayStore)==null||t.clear(),this.replayStore=void 0,(r=this.unsubSignal)==null||r.call(this),(s=this.segBuf)==null||s.clear(),this.segBuf=void 0,this.encoder=void 0,this.pendingEncodes.clear(),this.streaming=!1,this.checkpointing=!1,this.paused=!1,this.active=!1}}});var qm={};L(qm,{installWebGLPreserve:()=>IS});function Dm(n){if(!n||typeof n.getContext!="function")return null;let e=n;if(e[ua])return null;let t=n.getContext,r=function(s,i){if(typeof s=="string"&&ES.has(s)){let o={...i!=null?i:{},preserveDrawingBuffer:!0};return t.call(this,s,o)}return t.call(this,s,i)};return n.getContext=r,e[ua]=!0,()=>{n.getContext===r&&(n.getContext=t),delete e[ua]}}function IS(){if(typeof HTMLCanvasElement=="undefined")return()=>{};let n=[];try{let e=Dm(HTMLCanvasElement.prototype);if(e&&n.push(e),typeof OffscreenCanvas!="undefined"){let t=Dm(OffscreenCanvas.prototype);t&&n.push(t)}}catch{}return()=>{for(let e of n)try{e()}catch{}}}var ua,ES,Hm=E(()=>{"use strict";ua="__scalebunWebglPatched",ES=new Set(["webgl","webgl2","experimental-webgl","experimental-webgl2"])});var zm={};L(zm,{ReplayFeature:()=>pa});var CS,xs,AS,$m,pa,Um=E(()=>{"use strict";am();Qs();CS=400,xs="sdk_replay_capture_failed",AS=5e3,$m=()=>Promise.resolve().then(()=>(Fm(),Bm)),pa=class{constructor(){this.name="replay"}get isActive(){var e,t;return(t=(e=this.controller)==null?void 0:e.isActive)!=null?t:!1}async setup(e){var r;if(typeof document=="undefined"||typeof MutationObserver=="undefined"){e.trackEvent(xs,{stage:"init",reason:"ENV_UNSUPPORTED"});return}let t=om(e.replaySampling,(r=e.sessionId)!=null?r:"");if(e.log("[replay] sampling:",t.reason,"(bucket",t.bucket+")"),!!t.record){if(e.respectDnt){let{userOptedOutOfTracking:s}=await Promise.resolve().then(()=>(jo(),mm));if(s()){e.log("[replay] dnt: skip"),e.trackEvent(xs,{stage:"init",reason:"DNT_OPTED_OUT"});return}}if(e.replayCanvas){let{installWebGLPreserve:s}=await Promise.resolve().then(()=>(Hm(),qm));this.uninstallWebGL=s()}this.armed=this.arm(e,t)}}async arm(e,t){var r;try{await this.load(e,t)}catch(s){let i=String((r=s==null?void 0:s.message)!=null?r:s).slice(0,300);e.trackEvent(xs,{stage:"init",reason:Js(i)?"ENGINE_CHUNK_LOAD_FAILED":"RECORDER_INIT_FAILED",message:i})}}async load(e,t){var i;let r=o=>{o.catch(()=>{})};r(Promise.resolve().then(()=>(sn(),Fr))),r(Promise.resolve().then(()=>(et(),Br))),r(Promise.resolve().then(()=>(un(),ea))),r(Promise.resolve().then(()=>(ra(),na))),r(Promise.resolve().then(()=>(Tr(),ji))),r(Promise.resolve().then(()=>(la(),ca))),r(Promise.resolve().then(()=>(Qo(),Jo))),r(Promise.resolve().then(()=>(us(),Uo)));let s;try{({createRecorder:s}=await $m())}catch(o){await new Promise(a=>setTimeout(a,CS)),{createRecorder:s}=await $m(),e.trackEvent("sdk_replay_recovered",{stage:"recorder-import",message:String((i=o==null?void 0:o.message)!=null?i:o).slice(0,300)})}this.controller=await s(e,t),this.watchdog=setTimeout(()=>{var a;let o=(a=this.controller)==null?void 0:a.stats();o!=null&&o.recording&&!o.captured&&e.trackEvent(xs,{stage:"first-frame",reason:"NO_FRAME_AFTER_ARM",streaming:o.streaming,bucket:o.sampleBucket})},AS)}flush(){var e;(e=this.controller)==null||e.flush()}stats(){var e,t;return(t=(e=this.controller)==null?void 0:e.stats())!=null?t:null}checkpoint(e="manual"){var t;(t=this.controller)==null||t.forceCheckpoint(e)}pause(){var e;(e=this.controller)==null||e.pause()}resume(){var e;(e=this.controller)==null||e.resume()}setPrivacy(e){var t;(t=this.controller)==null||t.setPrivacy(e)}teardown(){var e,t;clearTimeout(this.watchdog),this.watchdog=void 0,(e=this.controller)==null||e.teardown(),this.controller=void 0,(t=this.uninstallWebGL)==null||t.call(this),this.uninstallWebGL=void 0}}});var Vm,we,fa=E(()=>{"use strict";Vm={title:"Inbox",panelAria:"Notifications",open:"Open notifications",openUnread:n=>`Open notifications, ${n} unread`,close:"Close notifications",unread:n=>`${n} unread`,noUnread:"No unread messages",emptyTitle:"You\u2019re all caught up",emptyBody:"Your notifications will appear here.",emptyAnnounce:"No notifications",allTab:"All",viewAll:"View all",pin:"Pin",unpin:"Unpin",archive:"Archive",delete:"Delete"},we={received:"$message_received",seen:"$message_seen",read:"$message_read",cta:"$message_cta_clicked",archived:"$message_archived",unarchived:"$message_unarchived",pinned:"$message_pinned",unpinned:"$message_unpinned",deleted:"$message_deleted",expired:"$message_expired",unreadChanged:"$inbox_unread_changed"}});var ma={};L(ma,{mountInbox:()=>OS});function Z(n,e,t){let r=document.createElement(n);return e&&(r.className=e),t!=null&&(r.textContent=t),r}function LS(n){let e=Math.max(0,Math.floor((Date.now()-n)/1e3));if(e<60)return"now";let t=Math.floor(e/60);if(t<60)return`${t}m`;let r=Math.floor(t/60);if(r<24)return`${r}h`;let s=Math.floor(r/24);if(s<7)return`${s}d`;let i=Math.floor(s/7);return i<5?`${i}w`:`${Math.floor(s/30)}mo`}function _S(n,e,t,r,s,i){let o=e.includes("right")?"right":"left",a=t?o==="right"?"left":"right":o,c=e.includes("bottom")?"bottom":"top",l=(M,R)=>{var A;return`var(--scalebun-inbox-${M},${(A=i==null?void 0:i[M])!=null?A:R})`},u=l("bg",n?"#1b1922":"#ffffff"),d=l("fg",n?"#edeaf2":"#221e30"),p=l("sub",n?"#9a95a6":"#6b6580"),f=l("line",n?"rgba(255,255,255,.10)":"#eae7f2"),m=l("surf",n?"#262131":"#f7f6fb"),h=l("accent","#7c6cf0"),g=l("unread",n?"rgba(124,108,240,.10)":"rgba(124,108,240,.06)"),S=l("badge","#ff5b6b"),v=l("font","system-ui,-apple-system,Segoe UI,Roboto,sans-serif"),y=l("shadow","0 0 40px rgba(0,0,0,.22)"),b=l("width","380px"),w=l("gap","11px"),x=l("z","2147483600"),I=M=>l("radius",M),k=M=>l("radius-sm",M),C=s?`--scalebun-inbox-accent:${s};`:"";return`
587
+ `,Jo=class{constructor(){this.worker=null;this.url=null;this.nextId=1;this.pending=new Map;this.tryInitWorker()}tryInitWorker(){if(!(typeof Worker=="undefined"||typeof Blob=="undefined"||typeof URL=="undefined")&&typeof CompressionStream!="undefined")try{let e=new Blob([sS],{type:"application/javascript"});this.url=URL.createObjectURL(e),this.worker=new Worker(this.url),this.worker.onmessage=t=>{let{id:r,out:s,err:i}=t.data,o=this.pending.get(r);o&&(this.pending.delete(r),i!=null?o.reject(new Error(i)):o.resolve(s))},this.worker.onerror=()=>this.disableWorker()}catch{this.disableWorker()}}disableWorker(){var e;try{(e=this.worker)==null||e.terminate()}catch{}if(this.worker=null,this.url){try{URL.revokeObjectURL(this.url)}catch{}this.url=null}for(let t of this.pending.values())t.reject(new Error("worker disabled"));this.pending.clear()}async encodeSnapshot(e){let t;try{t=JSON.stringify(e)}catch{return e}if(this.worker)try{return dn+await this.viaWorker(t)}catch{this.disableWorker()}if(typeof CompressionStream!="undefined")try{return dn+await bm(t)}catch{}return e}viaWorker(e){return new Promise((t,r)=>{let s=this.nextId++,i=setTimeout(()=>{this.pending.delete(s)&&r(new Error("worker timeout"))},5e3);this.pending.set(s,{resolve:o=>{clearTimeout(i),t(o)},reject:o=>{clearTimeout(i),r(o)}}),this.worker.postMessage({id:s,json:e})})}dispose(){this.disableWorker()}}});function vm(n){var e;return(e=n.shadowRoot)!=null?e:null}function gs(n,e){e.remove(n);let t=vm(n);t&&t.childNodes.forEach(r=>gs(r,e)),n.childNodes.forEach(r=>gs(r,e))}function bs(n,e=[]){let t=vm(n);return t&&(e.push(t),t.childNodes.forEach(r=>bs(r,e))),n.childNodes.forEach(r=>bs(r,e)),e}function ea(n,e){e.add(n),n.childNodes.forEach(t=>ea(t,e))}var wm=k(()=>{"use strict"});var ta={};L(ta,{MutationRecorder:()=>ft,buildMutations:()=>xm});function aS(n){ys.add(n),!($t||typeof Element=="undefined"||typeof Element.prototype.attachShadow!="function")&&($t=Element.prototype.attachShadow,Element.prototype.attachShadow=function(e){let t=$t.call(this,e);if(e&&e.mode==="open")for(let r of ys)try{r(this,t)}catch{}return t})}function cS(n){ys.delete(n),ys.size===0&&$t&&(Element.prototype.attachShadow=$t,$t=null)}function vs(n,e){n.childNodes.forEach(t=>{if(t.nodeType!==1)return;let r=t,s=r.shadowRoot;s&&(e(r,s),vs(s,e)),vs(r,e)})}function xm(n,e,t){var l,u,d,p,f,m,h;let r=new Map,s=new Map,i=[],o=[];for(let g of n)if(g.type==="attributes"){let S=e.getId(g.target);if(S==null||!g.attributeName)continue;let v=g.target.getAttribute(g.attributeName);if(v!=null&&t.maskAllInputs&&Lr.has(g.attributeName)&&(v=Ge(v)),v!=null&&g.attributeName==="value"&&Tt(g.target)&&(v=Rt(v)),v!=null){let y=g.target;v=Nr(g.attributeName,v,(u=(l=y.tagName)==null?void 0:l.toLowerCase())!=null?u:"",(p=(d=y.ownerDocument)==null?void 0:d.baseURI)!=null?p:"")}r.set(`${S}:${g.attributeName}`,{op:"attr",id:S,key:g.attributeName,value:v})}else if(g.type==="characterData"){let S=e.getId(g.target);if(S==null)continue;let v=(m=(f=g.target.parentNode)==null?void 0:f.nodeName)!=null?m:"",y=g.target.data,E=(t.maskAllText||_r(g.target.parentElement,t.maskSel))&&!Pr.has(v)?Ge(y):y;s.set(S,{op:"text",id:S,value:E})}else g.type==="childList"&&(g.removedNodes.forEach(S=>{var y;let v=e.getId(S);v!=null&&(i.push({op:"remove",parent:(y=e.getId(g.target))!=null?y:0,id:v}),gs(S,e))}),g.addedNodes.forEach(S=>o.push({node:S,parent:g.target,next:g.nextSibling})));let a=new Set,c=[];for(let{node:g,parent:S,next:v}of o){if(a.has(g)||!g.isConnected)continue;let y=e.getId(S);if(y==null)continue;let b=Xe(g,e,t);b&&(ea(g,a),c.push({op:"add",parent:y,next:v&&(h=e.getId(v))!=null?h:null,node:b}))}return[...i,...c,...r.values(),...s.values()]}var ys,$t,ft,un=k(()=>{"use strict";et();wm();ys=new Set,$t=null;ft=class{constructor(e,t,r={}){this.reg=e;this.onMutations=t;this.observer=null;this.queued=[];this.scheduled=!1;this.rafId=null;this.shadowObservers=new Map;this.shadowHandler=null;this.observedDoc=null;this.o=Ze(r)}observe(e){var t;typeof MutationObserver!="undefined"&&(this.observer=new MutationObserver(r=>this.enqueue(r)),this.observer.observe(e,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),this.observedDoc=(t=e.ownerDocument)!=null?t:e,vs(e,(r,s)=>this.observeShadowRoot(s)),this.shadowHandler=(r,s)=>{if(r.ownerDocument!==this.observedDoc)return;let i=!this.shadowObservers.has(s);this.observeShadowRoot(s);let o=this.reg.getId(r);i&&o!=null&&this.onMutations([{op:"shadow",host:o,shadow:Or(s,this.reg,this.o)}])},aS(this.shadowHandler))}observeShadowRoot(e){if(this.shadowObservers.has(e)||typeof MutationObserver=="undefined")return;let t=new MutationObserver(r=>this.enqueue(r));t.observe(e,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),this.shadowObservers.set(e,t),vs(e,(r,s)=>this.observeShadowRoot(s))}enqueue(e){this.queued.push(...e),!this.scheduled&&(this.scheduled=!0,typeof requestAnimationFrame=="function"?this.rafId=requestAnimationFrame(()=>this.drain()):queueMicrotask(()=>this.drain()))}drain(){this.scheduled=!1,this.rafId=null,this.observer&&this.queued.push(...this.observer.takeRecords()),this.takeShadowRecords();let e=this.queued;this.queued=[],this.process(e)}flush(){this.rafId!=null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(this.rafId),this.scheduled=!1,this.rafId=null,this.observer&&this.queued.push(...this.observer.takeRecords()),this.takeShadowRecords();let e=this.queued;this.queued=[],this.process(e)}disconnect(){var e;this.rafId!=null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(this.rafId),(e=this.observer)==null||e.disconnect(),this.observer=null;for(let t of this.shadowObservers.values())t.disconnect();this.shadowObservers.clear(),this.shadowHandler&&(cS(this.shadowHandler),this.shadowHandler=null),this.observedDoc=null,this.queued=[],this.scheduled=!1,this.rafId=null}takeShadowRecords(){for(let e of this.shadowObservers.values())this.queued.push(...e.takeRecords())}process(e){if(!e.length)return;this.releaseRemovedShadowRoots(e);let t=xm(e,this.reg,this.o);t.length&&this.onMutations(t)}releaseRemovedShadowRoots(e){if(this.shadowObservers.size!==0)for(let t of e)t.type==="childList"&&t.removedNodes.forEach(r=>{if(!r.isConnected)for(let s of bs(r)){let i=this.shadowObservers.get(s);i&&(i.disconnect(),this.shadowObservers.delete(s))}})}}});var ra={};L(ra,{InteractionRecorder:()=>na});function Sm(){try{return typeof location!="undefined"?location.href:""}catch{return""}}function uS(n){var r;let e=(r=n.getAttribute)==null?void 0:r.call(n,"role");if(e)return e;let t=n.tagName.toLowerCase();if(t==="a")return"link";if(t==="button"||t==="summary")return"button";if(t==="input"||t==="select"||t==="textarea"||t==="label")return"input"}function pS(n,e){var s,i,o,a,c,l,u;let t=d=>d&&d.trim()?d.trim():"",r=t((s=n.getAttribute)==null?void 0:s.call(n,"aria-label"))||t((i=n.getAttribute)==null?void 0:i.call(n,"title"))||t((o=n.getAttribute)==null?void 0:o.call(n,"alt"))||t((a=n.getAttribute)==null?void 0:a.call(n,"name"))||t((c=n.getAttribute)==null?void 0:c.call(n,"placeholder"));if(!r&&!e&&(r=t(n.innerText||n.textContent)),!r){let d=t((l=n.getAttribute)==null?void 0:l.call(n,"id")),p=t((((u=n.getAttribute)==null?void 0:u.call(n,"class"))||"").split(/\s+/)[0]);r=d?`#${d}`:p?`.${p}`:""}return r=r.replace(/\s+/g," ").trim(),r?r.slice(0,40):void 0}function fS(n,e){var t,r;try{let s=n;if(s&&s.nodeType!==1&&(s=s.parentElement),!s||s.nodeType!==1)return;let i=s,o=(r=(t=i.closest)==null?void 0:t.call(i,dS))!=null?r:null,a=o!=null?o:i;return{tag:a.tagName.toLowerCase(),interactive:!!o,role:o?uS(a):void 0,label:pS(a,e)}}catch{return}}function km(n){for(let e=0;e<n.length;e++)if(n[e].nodeType===1)return!0;return!1}function mS(n,e){var s,i,o;let t=n,r=0;for(;t&&r++<500;){if(t===e)return!0;let a=(i=t.parentNode)!=null?i:(s=t.getRootNode)==null?void 0:s.call(t);t=a&&a!==t?(o=a.host)!=null?o:a:null}return!1}var lS,na,dS,sa=k(()=>{"use strict";et();lS={moveThrottleMs:50,scrollThrottleMs:100,flushMs:100,moveFlushMs:300,deadMs:700,rageWindowMs:800,rageRadius:30,rageMin:3,maskInputs:!0,maskText:!0},na=class{constructor(e,t,r={}){this.reg=e;this.onEvents=t;this.pending=[];this.listeners=[];this.timer=null;this.deadTimers=new Set;this.deadObservers=new Set;this.lastMoveT=0;this.lastScrollT=0;this.lastActivityT=0;this.clickHistory=[];this.startHref="";this.frameOffsets=new Map;this.pendingSince=0;this.onTick=()=>{this.pending.length&&(this.pending.every(e=>e.k==="move")&&Date.now()-this.pendingSince<this.o.moveFlushMs||this.flush())};this.onMove=e=>{let t=e,r=Date.now();if(r-this.lastMoveT<this.o.moveThrottleMs)return;this.lastMoveT=r;let s=this.offsetFor(e.target),i=this.rootScroll(e.target);this.queue({k:"move",x:t.clientX+s.x,y:t.clientY+s.y,sx:i.sx,sy:i.sy,t:r},"move")};this.onClick=e=>{var m;let t=e,r=Date.now(),s=this.reg.getId(e.target),i=this.offsetFor(e.target),o=this.rootScroll(e.target),a=t.clientX+i.x,c=t.clientY+i.y;this.clickHistory=this.clickHistory.filter(h=>r-h.t<this.o.rageWindowMs);let l=this.clickHistory.filter(h=>Math.hypot(h.x-a,h.y-c)<=this.o.rageRadius);this.clickHistory.push({x:a,y:c,t:r});let u=l.length+1>=this.o.rageMin,d=(m=e.composedPath)==null?void 0:m.call(e),p=d&&d.length?d[0]:e.target,f=fS(p,this.o.maskText);this.queue({k:"click",x:a,y:c,sx:o.sx,sy:o.sy,id:s,t:r,...u?{rage:!0}:{},...f?{el:f}:{}},"immediate"),this.armDeadCheck(p,{x:a,y:c,sx:o.sx,sy:o.sy,id:s,at:r,el:f})};this.onScroll=e=>{var o,a,c,l;let t=Date.now();if(t-this.lastScrollT<this.o.scrollThrottleMs)return;this.lastScrollT=t;let r=e.target,s=(o=r.documentElement)!=null?o:r,i=(a=this.reg.getId(s))!=null?a:0;this.queue({k:"scroll",id:i,x:(c=s.scrollLeft)!=null?c:0,y:(l=s.scrollTop)!=null?l:0,t},"fast")};this.onInput=e=>{var i;let t=e.target,r=this.reg.getId(t);if(r==null)return;let s=(i=t.value)!=null?i:"";Tt(t)?s=Rt(s):this.o.maskInputs&&(s=Ge(s)),this.queue({k:"input",id:r,value:s,t:Date.now()},"fast")};this.onResize=()=>{this.queue({k:"viewport",w:window.innerWidth,h:window.innerHeight,t:Date.now()},"fast")};this.o={...lS,...r}}notifyDomActivity(e=Date.now()){this.lastActivityT=e}observe(){typeof document!="undefined"&&(this.startHref=Sm(),this.add(document,"mousemove",this.onMove,!0),this.add(document,"click",this.onClick,!0),this.add(document,"scroll",this.onScroll,!0),this.add(document,"input",this.onInput,!0),typeof window!="undefined"&&this.add(window,"resize",this.onResize,!0),this.timer=setInterval(this.onTick,this.o.flushMs))}queue(e,t){var r,s;if(this.pending.length||(this.pendingSince=Date.now()),this.pending.push(e),t==="immediate"){try{(s=(r=this.o).beforeImmediateFlush)==null||s.call(r)}catch{}this.flush()}}observeFrame(e,t){this.frameOffsets.has(e)||(this.frameOffsets.set(e,t),this.add(e,"mousemove",this.onMove,!0),this.add(e,"click",this.onClick,!0),this.add(e,"scroll",this.onScroll,!0),this.add(e,"input",this.onInput,!0))}unobserveFrame(e){this.frameOffsets.delete(e)&&(this.listeners=this.listeners.filter(t=>{if(t.target===e){try{t.target.removeEventListener(t.type,t.fn,t.capture)}catch{}return!1}return!0}))}rootScroll(e){var t,r,s,i,o,a,c,l,u,d;try{let p=e&&e.ownerDocument||(typeof document!="undefined"?document:null);if(!p)return{sx:0,sy:0};let f=p.defaultView,m=(o=(i=(r=f==null?void 0:f.scrollX)!=null?r:(t=p.documentElement)==null?void 0:t.scrollLeft)!=null?i:(s=p.body)==null?void 0:s.scrollLeft)!=null?o:0,h=(d=(u=(c=f==null?void 0:f.scrollY)!=null?c:(a=p.documentElement)==null?void 0:a.scrollTop)!=null?u:(l=p.body)==null?void 0:l.scrollTop)!=null?d:0;return{sx:Math.round(m),sy:Math.round(h)}}catch{return{sx:0,sy:0}}}offsetFor(e){let t=e&&e.ownerDocument||null,r=t?this.frameOffsets.get(t):void 0;if(!r)return{x:0,y:0};try{return r()}catch{return{x:0,y:0}}}flush(){if(!this.pending.length)return;let e=this.pending;this.pending=[],this.onEvents(e)}disconnect(){for(let e of this.listeners)e.target.removeEventListener(e.type,e.fn,e.capture);this.listeners=[],this.timer&&clearInterval(this.timer),this.timer=null;for(let e of this.deadTimers)clearTimeout(e);this.deadTimers.clear();for(let e of this.deadObservers)try{e.disconnect()}catch{}this.deadObservers.clear(),this.frameOffsets.clear(),this.pending=[]}add(e,t,r,s){e.addEventListener(t,r,s),this.listeners.push({target:e,type:t,fn:r,capture:s})}armDeadCheck(e,t){let{x:r,y:s,id:i,at:o,el:a}=t,c=e&&e.nodeType===1&&e.isConnected?e:null,l=!1,u=null,d=()=>{if(u){try{u.disconnect()}catch{}this.deadObservers.delete(u),u=null}};if(typeof MutationObserver!="undefined"&&typeof document!="undefined")try{u=new MutationObserver(f=>{for(let m of f){let h=c?mS(m.target,c):!1,g=m.type==="childList"&&(km(m.addedNodes)||km(m.removedNodes));if(h||g){l=!0;break}}l&&d()}),u.observe(document,{subtree:!0,childList:!0}),c&&u.observe(c,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),this.deadObservers.add(u)}catch{l=!0}else l=!0;let p=setTimeout(()=>{this.deadTimers.delete(p),d(),!l&&Sm()===this.startHref&&this.queue({k:"deadclick",x:r,y:s,sx:t.sx,sy:t.sy,id:i,t:o,...a?{el:a}:{}},"immediate")},this.o.deadMs);this.deadTimers.add(p)}};dS='a[href],button,input,select,textarea,label,summary,[role=button],[role=link],[role=menuitem],[role=tab],[role=checkbox],[role=radio],[role=switch],[contenteditable=""],[contenteditable=true],[tabindex]:not([tabindex="-1"])'});var Tm={};L(Tm,{bridgeCrossOriginFrame:()=>ia,installChildSatellite:()=>hS,nodeIdBaseFor:()=>oa});function hS(n,e={}){if(typeof window=="undefined"||window.parent===window)return()=>{};let t=Ze(e),r,s=!1,i=o=>{let a=o.data;if(!a||a.scalebun!==Em||s||!Am(o.origin,n))return;s=!0;let c=new sn(typeof a.nodeIdBase=="number"?a.nodeIdBase:1),l=d=>{var p;try{(p=o.source)==null||p.postMessage(d,o.origin)}catch{}},u=Xe(document,c,t);u&&l({scalebun:Im,doc:u}),r=new ft(c,d=>l({scalebun:Cm,mutations:d}),e),r.observe(document.documentElement)};return window.addEventListener("message",i),()=>{window.removeEventListener("message",i),r==null||r.disconnect()}}function ia(n,e,t){let r=n.contentWindow;if(!r)return()=>{};let s=a=>{if(a.source!==r||!Am(a.origin,t.allowedChildOrigins))return;let c=a.data;c&&(c.scalebun===Im&&c.doc?t.emit([{op:"iframe",id:e,doc:c.doc}]):c.scalebun===Cm&&Array.isArray(c.mutations)&&t.emit(c.mutations))};window.addEventListener("message",s);let i="*";try{i=new URL(n.src,location.href).origin}catch{}let o=()=>{try{r.postMessage({scalebun:Em,nodeIdBase:t.nodeIdBase},i)}catch{}};return o(),n.addEventListener("load",o),()=>{window.removeEventListener("message",s),n.removeEventListener("load",o)}}var Em,Im,Cm,Am,oa,aa=k(()=>{"use strict";on();et();un();Em="scalebun:frame-init",Im="scalebun:frame-key",Cm="scalebun:frame-mut",Am=(n,e)=>e.includes("*")||e.includes(n);oa=n=>n*1e6});var la={};L(la,{IframeManager:()=>ca});var ca,da=k(()=>{"use strict";et();un();aa();ca=class{constructor(e,t,r={},s={}){this.reg=e;this.onMutations=t;this.attached=new Map;this.loadListeners=[];this.bridges=new Map;this.started=!1;var i,o;this.o=Ze(r),this.onFrame=s.onFrame,this.onUnframe=s.onUnframe,this.maxDepth=(i=s.maxDepth)!=null?i:3,this.frameOrigins=(o=s.frameOrigins)!=null?o:[]}start(){this.started||typeof document=="undefined"||(this.started=!0,this.installLoad(document,0),this.scan(document,0))}scan(e,t){if(!(t>this.maxDepth)){this.sweep();try{e.querySelectorAll("iframe").forEach(r=>this.attach(r,t))}catch{}}}sweep(){var e;if(this.attached.size)for(let[t,{doc:r,rec:s}]of this.attached)t.isConnected||(s.disconnect(),(e=this.onUnframe)==null||e.call(this,r),this.attached.delete(t));if(this.bridges.size)for(let[t,r]of this.bridges)t.isConnected||(r(),this.bridges.delete(t))}installLoad(e,t){let r=s=>{let i=s.target;i&&i.tagName==="IFRAME"&&this.attach(i,t)};try{e.addEventListener("load",r,!0),this.loadListeners.push({doc:e,fn:r})}catch{}}attach(e,t){var c,l;if(t>this.maxDepth)return;let r=null;try{r=e.contentDocument}catch{this.bridgeCrossOrigin(e);return}if(!r||!r.documentElement){this.bridgeCrossOrigin(e);return}let s=this.attached.get(e);if(s){if(s.doc===r)return;s.rec.disconnect(),(c=this.onUnframe)==null||c.call(this,s.doc),this.attached.delete(e)}let i=this.reg.getId(e);if(i==null)return;let o=Xe(r,this.reg,this.o);o&&this.onMutations([{op:"iframe",id:i,doc:o}]);let a=new ft(this.reg,this.onMutations,this.o);a.observe(r.documentElement),this.attached.set(e,{doc:r,rec:a}),(l=this.onFrame)==null||l.call(this,r,()=>{try{let u=e.getBoundingClientRect();return{x:u.left,y:u.top}}catch{return{x:0,y:0}}}),t<this.maxDepth&&(this.installLoad(r,t+1),this.scan(r,t+1))}bridgeCrossOrigin(e){if(!this.frameOrigins.length||this.bridges.has(e))return;let t=this.reg.getId(e);if(t==null)return;let r=ia(e,t,{nodeIdBase:oa(t),allowedChildOrigins:this.frameOrigins,emit:this.onMutations});this.bridges.set(e,r)}subDocuments(){return this.sweep(),[...this.attached.values()].map(e=>e.doc)}disconnect(){for(let{rec:e}of this.attached.values())e.disconnect();this.attached.clear();for(let e of this.bridges.values())e();this.bridges.clear();for(let{doc:e,fn:t}of this.loadListeners)try{e.removeEventListener("load",t,!0)}catch{}this.loadListeners=[],this.started=!1}}});var Rm={};L(Rm,{CanvasRecorder:()=>ua});var gS,ua,Mm=k(()=>{"use strict";gS="data-scalebun-block",ua=class{constructor(e,t,r=()=>{},s={}){this.reg=e;this.onMutations=t;this.log=r;this.timer=null;this.last=new Map;this.tainted=new Set;this.scratch=null;var i,o,a;this.intervalMs=Math.max(50,Math.round(1e3/((i=s.fps)!=null?i:3))),this.maxDim=(o=s.maxDim)!=null?o:1024,this.quality=(a=s.quality)!=null?a:.6,this.getDocs=s.getDocs}start(){typeof document!="undefined"&&(this.capture(),this.timer=setInterval(()=>this.capture(),this.intervalMs))}disconnect(){this.timer&&clearInterval(this.timer),this.timer=null,this.last.clear(),this.tainted.clear(),this.scratch=null}capture(){let e=this.getDocs?this.getDocs():typeof document!="undefined"?[document]:[],t=[],r=new Set;for(let s of e){let i;try{i=s.querySelectorAll("canvas")}catch{continue}i.forEach(o=>{let a=this.reg.getId(o);if(a==null||(r.add(a),o.hasAttribute(gS)))return;let c=o.width,l=o.height;if(!c||!l)return;let u;try{u=this.encode(o,c,l)}catch{this.tainted.has(a)||(this.tainted.add(a),this.log("[scalebun] canvas not capturable (tainted / cross-origin)"));return}this.last.get(a)!==u&&(this.last.set(a,u),t.push({op:"canvas",id:a,data:u,w:c,h:l}))})}if(this.last.size>r.size)for(let s of this.last.keys())r.has(s)||this.last.delete(s);if(this.tainted.size)for(let s of this.tainted)r.has(s)||this.tainted.delete(s);t.length&&this.onMutations(t)}encode(e,t,r){var i;let s=Math.min(1,this.maxDim/Math.max(t,r));if(s<1){let o=(i=this.scratch)!=null?i:this.scratch=document.createElement("canvas");o.width=Math.max(1,Math.round(t*s)),o.height=Math.max(1,Math.round(r*s));let a=o.getContext("2d");if(!a)throw new Error("no 2d context");return a.clearRect(0,0,o.width,o.height),a.drawImage(e,0,0,o.width,o.height),o.toDataURL("image/webp",this.quality)}return e.toDataURL("image/webp",this.quality)}}});var Pm={};L(Pm,{installCadence:()=>bS});function bS(n){let e=[];if(n.keyframeIntervalMs>0&&n.keyframeIntervalMs!==1/0){let t=setInterval(()=>n.onCheckpoint("time"),n.keyframeIntervalMs);e.push(()=>clearInterval(t))}if(typeof document!="undefined"){let t=()=>{document.visibilityState==="visible"&&n.onCheckpoint("visible")};document.addEventListener("visibilitychange",t),e.push(()=>document.removeEventListener("visibilitychange",t))}if(typeof window!="undefined"&&typeof history!="undefined"&&typeof location!="undefined"){let t=location.href,r=()=>{location.href!==t&&(t=location.href,n.onCheckpoint("url"))};window.addEventListener("popstate",r),window.addEventListener("hashchange",r);let s=history.pushState,i=history.replaceState;history.pushState=function(...o){let a=s.apply(this,o);return r(),a},history.replaceState=function(...o){let a=i.apply(this,o);return r(),a},e.push(()=>{window.removeEventListener("popstate",r),window.removeEventListener("hashchange",r),history.pushState!==s&&(history.pushState=s),history.replaceState!==i&&(history.replaceState=i)})}return()=>{for(let t of e)try{t()}catch{}}}var Lm=k(()=>{"use strict"});var Bm={};L(Bm,{RecorderController:()=>xs,createRecorder:()=>CS});function IS(n){if(n.frameType==="keyframe")return"keyframe";let e=n.mutations;if(e!=null&&e.length)return e.every(r=>r.op==="canvas")?"canvas":"mutation";let t=n.events;return t!=null&&t.length?t.some(r=>r.k==="click"||r.k==="deadclick"||r.k==="input")?"interaction":t.some(r=>r.k==="scroll"||r.k==="viewport")?"scroll":"move":"other"}async function CS(n,e){let t=new xs(n,e);return await t.init(),t}function Om(){try{return typeof window!="undefined"?{width:window.innerWidth,height:window.innerHeight}:void 0}catch{return}}function Nm(){try{return typeof location!="undefined"?location.href:void 0}catch{return}}var _m,ws,vS,wS,xS,SS,kS,ES,xs,Fm=k(()=>{"use strict";$();Wt();Tn();us();am();lm();um();Ko();gm();Sn();_m=120,ws=2e5,vS=8,wS=2e6,xS=3e4,SS=5*6e4,kS=100,ES=300;xs=class{constructor(e,t){this.ctx=e;this.decision=t;this.active=!1;this.seq=Gs(0);this.keyframeId="";this.checkpointing=!1;this.dirtySinceKeyframe=!1;this.lastKeyframeAt=0;this.streamChainBytes=0;this.streamChainFrames=0;this.pendingEncodes=new Set;this.shed=0;this.producerCounts={};this.redactPII=!1;this.paused=!1;var r,s;this.streaming=t.streamFromStart,this.streaming&&jo()&&(this.streaming=!1,e.log("[replay] save-data/slow \u2192 buffered")),this.persistBuffer=!!((r=e.replaySampling)!=null&&r.persistBuffer)&&!this.streaming,this.maskText=(s=e.maskReplayText)!=null?s:!1}nextSeq(){let e=Gs(1);return this.seq=e+1,e}get isActive(){return this.active}stats(){var t,r,s,i,o,a;let e=this.segBuf;return{recording:this.active&&!this.paused,paused:this.paused,streaming:this.streaming,sampleReason:this.decision.reason,sampleBucket:this.decision.bucket,qualityLevel:(r=(t=this.adaptive)==null?void 0:t.level)!=null?r:0,segments:(s=e==null?void 0:e.segmentCount)!=null?s:0,frames:(i=e==null?void 0:e.frameCount)!=null?i:0,captured:this.keyframeId!=null,bufferBytes:(o=e==null?void 0:e.totalBytes)!=null?o:0,droppedSegments:(a=e==null?void 0:e.dropped)!=null?a:0,shedFrames:this.shed,producers:Object.fromEntries(Object.entries(this.producerCounts).map(([c,l])=>[c,{...l}]))}}forceCheckpoint(e){this.checkpoint(e)}async init(){let[{ReplayEncoder:e},{SegmentBuffer:t}]=await Promise.all([Promise.resolve().then(()=>(Zo(),Qo)),Promise.resolve().then(()=>(us(),Vo))]);this.segBuf=new t(vS,wS),this.persistBuffer&&(this.replayStore=new Be("pending-replay"),await this.recoverPriorPreRoll(),this.installPersistGuards()),this.encoder=new e,this.disposeEncoder=()=>{var r;return(r=this.encoder)==null?void 0:r.dispose()},await this.arm(),this.unsubSignal=this.ctx.onSignal(()=>this.flush()),this.active=!0}async arm(){var v,y,b,E;if(typeof document=="undefined")return;let e=this.ctx,[{NodeRegistry:t},{takeSnapshot:r},{MutationRecorder:s},{InteractionRecorder:i},{CssomRecorder:o},{IframeManager:a}]=await Promise.all([Promise.resolve().then(()=>(on(),Fr)),Promise.resolve().then(()=>(et(),Br)),Promise.resolve().then(()=>(un(),ta)),Promise.resolve().then(()=>(sa(),ra)),Promise.resolve().then(()=>(Rr(),Ki)),Promise.resolve().then(()=>(da(),la))]),c=new t,l={maskAllText:this.maskText,maskAllInputs:(v=e.maskInputs)!=null?v:!0,maskSelectors:e.maskSelectors};this.redactPII=((y=e.replaySampling)==null?void 0:y.privacyLevel)==="strict"&&!l.maskAllText,this.reg=c,this.snapOpts=l,this.takeSnapshotFn=r;let u=r(document,c,l);this.keyframeId=`f_${H()}`;let d={kind:"frame",renderer:"dom",frameType:"keyframe",frameId:this.keyframeId,seq:this.nextSeq(),snapshot:u,viewport:Om(),href:Nm(),tabId:Go(),viewId:Yo(),route:Xo(),masked:!0,timestamp:P()};this.push(d),this.compressInPlace(d,u),this.persistPreRoll(),this.dirtySinceKeyframe=!1,this.lastKeyframeAt=P();let p=new ps(kS,w=>this.push(this.delta({mutations:w})));this.deltaBatcher=p;let f=new i(c,w=>{this.push(this.delta({events:w}))},{maskText:!!l.maskAllText,moveFlushMs:ES,beforeImmediateFlush:()=>p.flush()}),m=new s(c,w=>{f.notifyDomActivity(),p.append(w)},l),h=new o(c,w=>{f.notifyDomActivity(),p.append(w)}),g=new a(c,w=>{f.notifyDomActivity(),p.append(w)},l,{onFrame:(w,I)=>f.observeFrame(w,I),onUnframe:w=>f.unobserveFrame(w),frameOrigins:(b=e.replayFrameOrigins)!=null?b:[]});if(((E=e.replayFrameOrigins)!=null?E:[]).length&&Promise.resolve().then(()=>(aa(),Tm)).then(({installChildSatellite:w})=>{var I;this.childSatelliteStop=w((I=e.replayFrameOrigins)!=null?I:[],l)}),this.mutationRec=m,this.cssomRec=h,m.observe(document.documentElement),f.observe(),h.install(),g.start(),this.disconnectRecorder=()=>m.disconnect(),this.disconnectInteractions=()=>f.disconnect(),this.disconnectCssom=()=>h.disconnect(),this.disconnectIframes=()=>g.disconnect(),e.replayCanvas){let{CanvasRecorder:w}=await Promise.resolve().then(()=>(Mm(),Rm)),I=new w(c,x=>{f.notifyDomActivity(),this.push(this.delta({mutations:x}))},(...x)=>e.log(...x));I.start(),this.disconnectCanvas=()=>I.disconnect()}this.adaptive=new fs(e.egressPending);let{installCadence:S}=await Promise.resolve().then(()=>(Lm(),Pm));this.disconnectCadence=S({keyframeIntervalMs:xS,onCheckpoint:w=>this.checkpoint(w)})}disarm(){var e,t,r,s,i,o,a,c,l,u,d;try{(e=this.mutationRec)==null||e.flush(),(t=this.cssomRec)==null||t.flush(),(r=this.deltaBatcher)==null||r.dispose()}catch{}this.deltaBatcher=void 0,(s=this.disconnectRecorder)==null||s.call(this),(i=this.disconnectInteractions)==null||i.call(this),(o=this.disconnectCssom)==null||o.call(this),(a=this.disconnectCanvas)==null||a.call(this),(c=this.disconnectIframes)==null||c.call(this),(l=this.childSatelliteStop)==null||l.call(this),(u=this.disconnectCadence)==null||u.call(this),(d=this.adaptive)==null||d.dispose(),this.disconnectRecorder=void 0,this.disconnectInteractions=void 0,this.disconnectCssom=void 0,this.disconnectCanvas=void 0,this.disconnectIframes=void 0,this.childSatelliteStop=void 0,this.disconnectCadence=void 0,this.adaptive=void 0,this.reg=void 0,this.mutationRec=void 0,this.cssomRec=void 0,this.takeSnapshotFn=void 0,this.snapOpts=void 0}pause(){!this.active||this.paused||(this.disarm(),this.paused=!0,this.ctx.log("[replay] paused"))}resume(){!this.active||!this.paused||(this.paused=!1,this.arm().then(()=>this.ctx.log("[replay] resumed")))}setPrivacy(e){typeof(e==null?void 0:e.maskAllText)!="boolean"||e.maskAllText===this.maskText||(this.maskText=e.maskAllText,this.active&&!this.paused&&(this.disarm(),this.arm()),this.ctx.log("[replay] privacy set: maskAllText="+this.maskText))}delta(e){return{kind:"frame",renderer:"dom",frameType:"delta",frameId:`f_${H()}`,baseFrameId:this.keyframeId,seq:this.nextSeq(),...e,tabId:Go(),viewId:Yo(),route:Xo(),masked:!0,timestamp:P()}}push(e){var i,o;if(e.frameType==="delta"&&(this.dirtySinceKeyframe=!0),this.redactPII&&dm(e),e.frameType==="delta"&&this.adaptive&&this.adaptive.level>0){let a=cm(e,this.adaptive.level);if(!a){this.shed++;return}e=a}let t=IS(e),r=(o=(i=this.producerCounts)[t])!=null?o:i[t]={frames:0,bytes:0};if(r.frames++,r.bytes+=Ht(e),this.streaming){this.ctx.emit(e),e.frameType==="delta"&&(this.streamChainBytes+=Ht(e),this.streamChainFrames++,!this.checkpointing&&(this.streamChainFrames>=_m||this.streamChainBytes>=ws)&&this.checkpoint(this.streamChainBytes>=ws?"segment-bytes":"segment-frames"));return}let s=this.segBuf;s&&(e.frameType==="keyframe"?s.openSegment(e):s.append(e),!this.checkpointing&&e.frameType==="delta"&&(s.currentFrameCount>=_m||s.currentBytes>=ws)&&this.checkpoint(s.currentBytes>=ws?"segment-bytes":"segment-frames"))}checkpoint(e){var t,r,s;if(!(this.checkpointing||!this.reg||!this.takeSnapshotFn||typeof document=="undefined")){this.checkpointing=!0;try{if((t=this.mutationRec)==null||t.flush(),(r=this.cssomRec)==null||r.flush(),(s=this.deltaBatcher)==null||s.flush(),(e==="time"||e==="visible")&&!this.dirtySinceKeyframe&&P()-this.lastKeyframeAt<SS)return;let i=this.takeSnapshotFn(document,this.reg,this.snapOpts),o=`f_${H()}`;this.keyframeId=o,this.streamChainBytes=0,this.streamChainFrames=0;let a={kind:"frame",renderer:"dom",frameType:"keyframe",frameId:o,seq:this.nextSeq(),snapshot:i,viewport:Om(),href:Nm(),masked:!0,trigger:e,timestamp:P()};this.push(a),this.compressInPlace(a,i),this.persistPreRoll(),this.dirtySinceKeyframe=!1,this.lastKeyframeAt=P()}finally{this.checkpointing=!1}}}async recoverPriorPreRoll(){var e;if(this.replayStore)try{let t=await this.replayStore.load();if(Array.isArray(t)&&t.length){let r=0;for(let s of t)this.ctx.emit(s),r=Math.max(r,(e=s.seq)!=null?e:0);this.seq=Ec(r+1),await this.replayStore.clear()}}catch{}}persistPreRoll(){!this.replayStore||!this.segBuf||this.streaming||this.replayStore.save(kt(this.segBuf.drainFrames(),()=>!0,e=>e.frameType==="keyframe"))}installPersistGuards(){typeof window!="undefined"&&(this.onPageHide=()=>{var e;return void((e=this.replayStore)==null?void 0:e.clear())},window.addEventListener("pagehide",this.onPageHide),this.onVisHidden=()=>{typeof document!="undefined"&&document.visibilityState==="hidden"&&this.persistPreRoll()},typeof document!="undefined"&&document.addEventListener("visibilitychange",this.onVisHidden))}compressInPlace(e,t){let r=this.encoder;if(!r)return;let s=r.encodeSnapshot(t).then(i=>{e.snapshot=i}).catch(()=>{}).finally(()=>{this.pendingEncodes.delete(s)});this.pendingEncodes.add(s)}flush(){var e,t,r,s,i;if((e=this.mutationRec)==null||e.flush(),(t=this.cssomRec)==null||t.flush(),(r=this.deltaBatcher)==null||r.flush(),this.segBuf)for(let o of this.segBuf.drainFrames())this.ctx.emit(o);(s=this.segBuf)==null||s.clear(),this.streaming=!0,(i=this.replayStore)==null||i.clear()}teardown(){var e,t,r,s;this.disarm(),(e=this.disposeEncoder)==null||e.call(this),this.onPageHide&&typeof window!="undefined"&&window.removeEventListener("pagehide",this.onPageHide),this.onPageHide=void 0,this.onVisHidden&&typeof document!="undefined"&&document.removeEventListener("visibilitychange",this.onVisHidden),this.onVisHidden=void 0,(t=this.replayStore)==null||t.clear(),this.replayStore=void 0,(r=this.unsubSignal)==null||r.call(this),(s=this.segBuf)==null||s.clear(),this.segBuf=void 0,this.encoder=void 0,this.pendingEncodes.clear(),this.streaming=!1,this.checkpointing=!1,this.paused=!1,this.active=!1}}});var qm={};L(qm,{installWebGLPreserve:()=>TS});function Dm(n){if(!n||typeof n.getContext!="function")return null;let e=n;if(e[pa])return null;let t=n.getContext,r=function(s,i){if(typeof s=="string"&&AS.has(s)){let o={...i!=null?i:{},preserveDrawingBuffer:!0};return t.call(this,s,o)}return t.call(this,s,i)};return n.getContext=r,e[pa]=!0,()=>{n.getContext===r&&(n.getContext=t),delete e[pa]}}function TS(){if(typeof HTMLCanvasElement=="undefined")return()=>{};let n=[];try{let e=Dm(HTMLCanvasElement.prototype);if(e&&n.push(e),typeof OffscreenCanvas!="undefined"){let t=Dm(OffscreenCanvas.prototype);t&&n.push(t)}}catch{}return()=>{for(let e of n)try{e()}catch{}}}var pa,AS,Hm=k(()=>{"use strict";pa="__scalebunWebglPatched",AS=new Set(["webgl","webgl2","experimental-webgl","experimental-webgl2"])});var zm={};L(zm,{ReplayFeature:()=>fa});var RS,Ss,MS,$m,fa,Um=k(()=>{"use strict";om();Zs();RS=400,Ss="sdk_replay_capture_failed",MS=5e3,$m=()=>Promise.resolve().then(()=>(Fm(),Bm)),fa=class{constructor(){this.name="replay"}get isActive(){var e,t;return(t=(e=this.controller)==null?void 0:e.isActive)!=null?t:!1}async setup(e){var r;if(typeof document=="undefined"||typeof MutationObserver=="undefined"){e.trackEvent(Ss,{stage:"init",reason:"ENV_UNSUPPORTED"});return}let t=im(e.replaySampling,(r=e.sessionId)!=null?r:"");if(e.log("[replay] sampling:",t.reason,"(bucket",t.bucket+")"),!!t.record){if(e.respectDnt){let{userOptedOutOfTracking:s}=await Promise.resolve().then(()=>(Ko(),mm));if(s()){e.log("[replay] dnt: skip"),e.trackEvent(Ss,{stage:"init",reason:"DNT_OPTED_OUT"});return}}if(e.replayCanvas){let{installWebGLPreserve:s}=await Promise.resolve().then(()=>(Hm(),qm));this.uninstallWebGL=s()}this.armed=this.arm(e,t)}}async arm(e,t){var r;try{await this.load(e,t)}catch(s){let i=String((r=s==null?void 0:s.message)!=null?r:s).slice(0,300);e.trackEvent(Ss,{stage:"init",reason:Qs(i)?"ENGINE_CHUNK_LOAD_FAILED":"RECORDER_INIT_FAILED",message:i})}}async load(e,t){var i;let r=o=>{o.catch(()=>{})};r(Promise.resolve().then(()=>(on(),Fr))),r(Promise.resolve().then(()=>(et(),Br))),r(Promise.resolve().then(()=>(un(),ta))),r(Promise.resolve().then(()=>(sa(),ra))),r(Promise.resolve().then(()=>(Rr(),Ki))),r(Promise.resolve().then(()=>(da(),la))),r(Promise.resolve().then(()=>(Zo(),Qo))),r(Promise.resolve().then(()=>(us(),Vo)));let s;try{({createRecorder:s}=await $m())}catch(o){await new Promise(a=>setTimeout(a,RS)),{createRecorder:s}=await $m(),e.trackEvent("sdk_replay_recovered",{stage:"recorder-import",message:String((i=o==null?void 0:o.message)!=null?i:o).slice(0,300)})}this.controller=await s(e,t),this.watchdog=setTimeout(()=>{var a;let o=(a=this.controller)==null?void 0:a.stats();o!=null&&o.recording&&!o.captured&&e.trackEvent(Ss,{stage:"first-frame",reason:"NO_FRAME_AFTER_ARM",streaming:o.streaming,bucket:o.sampleBucket})},MS)}flush(){var e;(e=this.controller)==null||e.flush()}stats(){var e,t;return(t=(e=this.controller)==null?void 0:e.stats())!=null?t:null}checkpoint(e="manual"){var t;(t=this.controller)==null||t.forceCheckpoint(e)}pause(){var e;(e=this.controller)==null||e.pause()}resume(){var e;(e=this.controller)==null||e.resume()}setPrivacy(e){var t;(t=this.controller)==null||t.setPrivacy(e)}teardown(){var e,t;clearTimeout(this.watchdog),this.watchdog=void 0,(e=this.controller)==null||e.teardown(),this.controller=void 0,(t=this.uninstallWebGL)==null||t.call(this),this.uninstallWebGL=void 0}}});var Vm,we,ma=k(()=>{"use strict";Vm={title:"Inbox",panelAria:"Notifications",open:"Open notifications",openUnread:n=>`Open notifications, ${n} unread`,close:"Close notifications",unread:n=>`${n} unread`,noUnread:"No unread messages",emptyTitle:"You\u2019re all caught up",emptyBody:"Your notifications will appear here.",emptyAnnounce:"No notifications",allTab:"All",viewAll:"View all",pin:"Pin",unpin:"Unpin",archive:"Archive",delete:"Delete"},we={received:"$message_received",seen:"$message_seen",read:"$message_read",cta:"$message_cta_clicked",archived:"$message_archived",unarchived:"$message_unarchived",pinned:"$message_pinned",unpinned:"$message_unpinned",deleted:"$message_deleted",expired:"$message_expired",unreadChanged:"$inbox_unread_changed"}});var ha={};L(ha,{mountInbox:()=>FS});function Z(n,e,t){let r=document.createElement(n);return e&&(r.className=e),t!=null&&(r.textContent=t),r}function NS(n){let e=Math.max(0,Math.floor((Date.now()-n)/1e3));if(e<60)return"now";let t=Math.floor(e/60);if(t<60)return`${t}m`;let r=Math.floor(t/60);if(r<24)return`${r}h`;let s=Math.floor(r/24);if(s<7)return`${s}d`;let i=Math.floor(s/7);return i<5?`${i}w`:`${Math.floor(s/30)}mo`}function BS(n,e,t,r,s,i){let o=e.includes("right")?"right":"left",a=t?o==="right"?"left":"right":o,c=e.includes("bottom")?"bottom":"top",l=(M,T)=>{var A;return`var(--scalebun-inbox-${M},${(A=i==null?void 0:i[M])!=null?A:T})`},u=l("bg",n?"#1b1922":"#ffffff"),d=l("fg",n?"#edeaf2":"#221e30"),p=l("sub",n?"#9a95a6":"#6b6580"),f=l("line",n?"rgba(255,255,255,.10)":"#eae7f2"),m=l("surf",n?"#262131":"#f7f6fb"),h=l("accent","#7c6cf0"),g=l("unread",n?"rgba(124,108,240,.10)":"rgba(124,108,240,.06)"),S=l("badge","#ff5b6b"),v=l("font","system-ui,-apple-system,Segoe UI,Roboto,sans-serif"),y=l("shadow","0 0 40px rgba(0,0,0,.22)"),b=l("width","380px"),E=l("gap","11px"),w=l("z","2147483600"),I=M=>l("radius",M),x=M=>l("radius-sm",M),C=s?`--scalebun-inbox-accent:${s};`:"";return`
588
588
  :host{all:initial;direction:${t?"rtl":"ltr"};${C}}
589
589
  *{box-sizing:border-box;font-family:${v}}
590
590
  button:focus-visible,.row:focus-visible,.tab:focus-visible{outline:2px solid ${h};outline-offset:2px}
591
591
  .live{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
592
592
  .bell{position:fixed;${c}:22px;${a}:22px;width:52px;height:52px;border-radius:50%;border:none;cursor:pointer;
593
- background:${h};color:#fff;display:grid;place-items:center;box-shadow:0 6px 24px rgba(108,92,231,.4);z-index:${x}}
593
+ background:${h};color:#fff;display:grid;place-items:center;box-shadow:0 6px 24px rgba(108,92,231,.4);z-index:${w}}
594
594
  .bell:hover{filter:brightness(1.06)}
595
595
  .bell svg{width:22px;height:22px}
596
596
  .badge{position:absolute;top:-4px;${a}:-4px;min-width:20px;height:20px;padding:0 5px;border-radius:10px;
597
597
  background:${S};color:#fff;font-size:11px;font-weight:700;display:none;align-items:center;justify-content:center;line-height:1}
598
598
  .badge.on{display:flex}
599
- .scrim{position:fixed;inset:0;background:rgba(10,8,16,.42);z-index:calc(${x} + 1);opacity:0;pointer-events:none;transition:opacity .2s}
599
+ .scrim{position:fixed;inset:0;background:rgba(10,8,16,.42);z-index:calc(${w} + 1);opacity:0;pointer-events:none;transition:opacity .2s}
600
600
  .scrim.on{opacity:1;pointer-events:auto}
601
601
  .panel{position:fixed;${c==="bottom"?"bottom:0;top:0":"top:0;bottom:0"};${a}:0;width:${b};max-width:94vw;background:${u};color:${d};
602
- z-index:calc(${x} + 2);display:flex;flex-direction:column;box-shadow:${y};
602
+ z-index:calc(${w} + 2);display:flex;flex-direction:column;box-shadow:${y};
603
603
  transform:translateX(${a==="right"?"100%":"-100%"});transition:transform .26s cubic-bezier(.4,0,.2,1)}
604
604
  .panel.open{transform:translateX(0)}
605
605
  .hd{display:flex;align-items:center;justify-content:space-between;padding:15px 16px;border-bottom:1px solid ${f}}
606
606
  .hd .ti{font-size:15px;font-weight:700}
607
607
  .hd .mt{font-size:12px;color:${p};margin-top:2px}
608
- .x{width:30px;height:30px;border-radius:${k("8px")};border:1px solid ${f};background:${m};color:${p};cursor:pointer;font-size:17px;line-height:1;display:grid;place-items:center}
608
+ .x{width:30px;height:30px;border-radius:${x("8px")};border:1px solid ${f};background:${m};color:${p};cursor:pointer;font-size:17px;line-height:1;display:grid;place-items:center}
609
609
  .x:hover{color:${d}}
610
610
  .tabs{display:flex;gap:6px;padding:8px 12px;border-bottom:1px solid ${f};overflow-x:auto}
611
611
  .tab{flex-shrink:0;border:none;background:${m};color:${p};border-radius:999px;padding:5px 12px;font-size:12px;font-weight:600;cursor:pointer}
@@ -614,7 +614,7 @@ button:focus-visible,.row:focus-visible,.tab:focus-visible{outline:2px solid ${h
614
614
  .empty{padding:48px 20px;text-align:center;color:${p};font-size:13px}
615
615
  .empty b{display:block;color:${d};font-size:14px;margin-bottom:5px}
616
616
  .list{display:flex;flex-direction:column}
617
- .row{position:relative;display:flex;gap:${w};padding:12px 12px 12px 15px;border-radius:${I("10px")};cursor:pointer}
617
+ .row{position:relative;display:flex;gap:${E};padding:12px 12px 12px 15px;border-radius:${I("10px")};cursor:pointer}
618
618
  .row:hover{background:${m}}
619
619
  .row.unread{background:${g}}
620
620
  .dot{position:absolute;left:5px;top:18px;width:7px;height:7px;border-radius:50%;background:${h};opacity:0}
@@ -628,16 +628,16 @@ button:focus-visible,.row:focus-visible,.tab:focus-visible{outline:2px solid ${h
628
628
  .rtime{flex-shrink:0;font-size:11px;color:${p}}
629
629
  .rb{font-size:12.5px;color:${p};line-height:1.4;margin-top:2px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
630
630
  .rcta{display:flex;gap:7px;margin-top:8px}
631
- .rcta button{background:${h};color:#fff;border:none;border-radius:${k("7px")};padding:5px 11px;font-size:12px;font-weight:600;cursor:pointer}
631
+ .rcta button{background:${h};color:#fff;border:none;border-radius:${x("7px")};padding:5px 11px;font-size:12px;font-weight:600;cursor:pointer}
632
632
  .rcta button.sec{background:${m};color:${d}}
633
633
  /* \u26A0\uFE0F Was \`position:absolute\` floating over the row, which meant NO space was reserved for it and the
634
634
  title ran underneath \u2014 the buttons masked their own row's text (and in RTL they landed on top of
635
635
  the title rather than the timestamp). A hover-only overlay only looks fine while the text is short.
636
636
  Now a real flex child: it always occupies its column, so nothing can ever slide under it, and
637
637
  \`visibility\` (not \`display\`) means revealing it on hover causes no reflow. */
638
- .ract{flex-shrink:0;align-self:flex-start;display:flex;gap:2px;border-radius:${k("8px")};padding:2px;visibility:hidden}
638
+ .ract{flex-shrink:0;align-self:flex-start;display:flex;gap:2px;border-radius:${x("8px")};padding:2px;visibility:hidden}
639
639
  .row:hover .ract,.row:focus-within .ract{visibility:visible}
640
- .ract button{width:26px;height:26px;border:none;background:none;color:${p};cursor:pointer;border-radius:${k("6px")};display:grid;place-items:center}
640
+ .ract button{width:26px;height:26px;border:none;background:none;color:${p};cursor:pointer;border-radius:${x("6px")};display:grid;place-items:center}
641
641
  .ract button:hover{background:${m};color:${d}}
642
642
  .ract button.on{color:${h}}
643
643
  .ract svg{width:15px;height:15px}
@@ -664,10 +664,10 @@ ${r!=="dropdown"?"":`
664
664
  .body{max-height:none}
665
665
  .foot{display:flex;border-top:1px solid ${f};padding:8px}
666
666
  .foot button{flex:1;border:none;background:none;color:${h};font-size:13px;font-weight:600;
667
- cursor:pointer;padding:8px;border-radius:${k("8px")}}
667
+ cursor:pointer;padding:8px;border-radius:${x("8px")}}
668
668
  .foot button:hover{background:${m}}
669
669
  `}
670
- @media(prefers-reduced-motion:reduce){.panel,.scrim{transition:none}}`}function OS(n,e,t){var G,ie,Y,X,ee;let r=(G=e.position)!=null?G:"bottom-right",s=typeof document!="undefined"&&(document.documentElement.getAttribute("dir")==="rtl"||typeof getComputedStyle!="undefined"&&getComputedStyle(document.documentElement).direction==="rtl"),i=(ie=e.rtl)!=null?ie:s,o=e.layout==="dropdown"&&Wm(e.trigger)?"dropdown":"drawer",a=e.accent,c={...Vm,...(Y=t==null?void 0:t.labels)!=null?Y:{},...(X=e.labels)!=null?X:{}},l=(ee=e.formatTime)!=null?ee:LS,u=e.theme?e.theme==="dark":typeof matchMedia!="undefined"&&matchMedia("(prefers-color-scheme: dark)").matches,d=document.createElement("div");d.setAttribute("data-scalebun-inbox","");let p=d.attachShadow({mode:"open"});Ne(p,_S(u,r,i,o,a,t==null?void 0:t.tokens)),document.body.appendChild(d);let f=Z("div","scrim"),m=Z("div","panel");m.setAttribute("role","dialog"),m.setAttribute("aria-modal","true"),m.setAttribute("aria-label",c.panelAria),m.setAttribute("aria-hidden","true"),i&&m.setAttribute("dir","rtl");let h=Z("div","hd"),g=Z("div"),S=Z("div","ti",c.title),v=Z("div","mt");g.append(S,v);let y=document.createElement("button");y.className="x",y.type="button",y.setAttribute("aria-label",c.close),y.textContent="\xD7",h.append(g,y);let b=Z("div","tabs");b.setAttribute("role","tablist"),b.style.display="none";let w=Z("div","body"),x=Z("div","live");if(x.setAttribute("role","status"),x.setAttribute("aria-live","polite"),m.append(h,b,w,x),e.onViewAll){let T=Z("div","foot"),_=document.createElement("button");_.type="button",_.textContent=c.viewAll,_.addEventListener("click",()=>{var N;J(),(N=e.onViewAll)==null||N.call(e)}),T.appendChild(_),m.appendChild(T)}p.append(f,m);let I,k,C=Wm(e.trigger);C||(I=document.createElement("button"),I.className="bell",I.type="button",I.setAttribute("aria-label",c.open),I.setAttribute("aria-expanded","false"),I.setAttribute("aria-haspopup","dialog"),typeof e.icon=="string"?I.textContent=e.icon:e.icon?I.appendChild(e.icon):I.innerHTML=PS,k=document.createElement("span"),k.className="badge",k.setAttribute("aria-hidden","true"),I.appendChild(k),p.appendChild(I));let M=C!=null?C:I,R=!1,A=null,O=!1,z=()=>{if(o!=="dropdown"||!C)return;let T=C.getBoundingClientRect(),_=m.offsetWidth||360,N=m.offsetHeight||420,F=8,W=i?T.right-_:T.left;m.style.left=`${Math.max(F,Math.min(W,window.innerWidth-_-F))}px`;let re=window.innerHeight-T.bottom;m.style.top=re>=N+F||re>=T.top?`${T.bottom+6}px`:`${Math.max(F,T.top-N-6)}px`},D=T=>{var _,N;T!==R&&(R=T,T&&z(),m.classList.toggle("open",T),f.classList.toggle("on",T),m.setAttribute("aria-hidden",T?"false":"true"),I==null||I.setAttribute("aria-expanded",String(T)),T?(A=(N=(_=p.activeElement)!=null?_:M)!=null?N:null,O=!0,n.refresh(),Ve()):A==null||A.focus())},te=()=>D(!0),J=()=>D(!1),Q=()=>D(!R),fe=()=>Q();I==null||I.addEventListener("click",fe),C==null||C.addEventListener("click",fe),y.addEventListener("click",J),f.addEventListener("click",J);let ce=T=>{if(T.key==="Escape"){T.stopPropagation(),J();return}if(T.key==="Tab"){let _=xe(),N=_[0],F=_[_.length-1];if(!N||!F)return;let W=p.activeElement;T.shiftKey&&W===N?(T.preventDefault(),F.focus()):!T.shiftKey&&W===F&&(T.preventDefault(),N.focus())}};m.addEventListener("keydown",ce);function xe(){return[...m.querySelectorAll('button, [tabindex="0"]')]}let Se=n.subscribe(T=>{let _=T.unreadCount;k&&(k.textContent=_>99?"99+":String(_),k.classList.toggle("on",_>0)),v.textContent=_>0?c.unread(_):c.noUnread,I&&I.setAttribute("aria-label",_>0?c.openUnread(_):c.open),R&&Ve()}),le=null;function q(){let T=Z("div","empty");return T.appendChild(Z("b",void 0,c.emptyTitle)),T.appendChild(document.createTextNode(c.emptyBody)),T}function V(T,_,N){let F=document.createElement("button");return F.type="button",F.innerHTML=T,F.setAttribute("aria-label",_),F.title=_,F.addEventListener("click",W=>{W.stopPropagation(),N()}),F}function K(T){var he,Ce,Ae;let _=Z("div","row"+(T.state==="unread"?" unread":""));_.setAttribute("role","listitem"),_.tabIndex=0,_.setAttribute("aria-label",`${T.title}${T.state==="unread"?", unread":""}`),_.dataset.id=T.id,_.appendChild(Z("span","dot"));let N=Z("div","ic");if(T.iconUrl){let Re=document.createElement("img");Re.src=T.iconUrl,Re.alt="",N.appendChild(Re)}else N.textContent=((Ce=(he=T.category)==null?void 0:he[0])!=null?Ce:"\u2022").toUpperCase();_.appendChild(N);let F=Z("div","rc"),W=Z("div","rtop");if(W.appendChild(Z("div","rt",T.title)),W.appendChild(Z("span","rtime",l(T.createdAt))),F.appendChild(W),T.body&&F.appendChild(Z("div","rb",T.body)),(Ae=T.cta)!=null&&Ae.length){let Re=Z("div","rcta");T.cta.slice(0,2).forEach((Je,st)=>{let ke=document.createElement("button");st>0&&(ke.className="sec"),ke.textContent=Je.label,ke.addEventListener("click",gn=>{gn.stopPropagation(),n.act(T.id,Je.key)}),Re.appendChild(ke)}),F.appendChild(Re)}_.appendChild(F);let re=Z("div","ract"),ge=V(RS,T.pinned?c.unpin:c.pin,()=>void n.pin(T.id,!T.pinned));return T.pinned&&ge.classList.add("on"),re.append(ge,V(TS,c.archive,()=>void n.archive(T.id)),V(MS,c.delete,()=>void n.remove(T.id))),_.appendChild(re),_.addEventListener("click",()=>{T.state==="unread"&&n.markRead(T.id)}),_}function de(T){var re,ge,he;let _=T.target.closest(".row");if(!_)return;let N=[...w.querySelectorAll(".row")],F=N.indexOf(_),W=_.dataset.id;T.key==="ArrowDown"?(T.preventDefault(),(re=N[Math.min(N.length-1,F+1)])==null||re.focus()):T.key==="ArrowUp"?(T.preventDefault(),(ge=N[Math.max(0,F-1)])==null||ge.focus()):T.key==="Enter"||T.key===" "?(T.preventDefault(),n.markRead(W)):T.key==="Delete"||T.key==="Backspace"?(T.preventDefault(),n.archive(W),(he=N[Math.min(N.length-1,F+1)])==null||he.focus()):T.key.toLowerCase()==="p"&&(T.preventDefault(),n.pin(W))}w.addEventListener("keydown",de);function me(T){if(T.length<2){b.style.display="none",b.textContent="";return}b.style.display="flex",b.textContent="";let _=(N,F)=>{let W=document.createElement("button");return W.className="tab"+(le===F?" on":""),W.type="button",W.textContent=N,W.setAttribute("role","tab"),W.setAttribute("aria-selected",String(le===F)),W.addEventListener("click",()=>{le=F,Ve()}),W};b.appendChild(_(c.allTab,null));for(let N of T)b.appendChild(_(N.charAt(0).toUpperCase()+N.slice(1),N))}async function se(){var he,Ce,Ae,Re,Je,st;if(!R)return;let T=await n.query({limit:200});if(!R)return;let _=(Ae=(Ce=(he=p.activeElement)==null?void 0:he.closest)==null?void 0:Ce.call(he,".row"))==null?void 0:Ae.dataset.id,N=[...new Set(T.messages.map(ke=>ke.category))].sort();me(N);let F=le?T.messages.filter(ke=>ke.category===le):T.messages,W=o==="dropdown"?Math.max(1,(Re=e.maxItems)!=null?Re:5):1/0,re=F.length>W?F.slice(0,W):F;if(w.textContent="",!re.length){w.appendChild(q()),x.textContent=c.emptyAnnounce,O&&(O=!1,y.focus());return}let ge=Z("div","list");ge.setAttribute("role","list");for(let ke of re)ge.appendChild(K(ke));w.appendChild(ge),x.textContent=`${F.length} notification${F.length===1?"":"s"}`,O?(O=!1,((Je=w.querySelector(".row"))!=null?Je:y).focus()):_&&((st=w.querySelector(`.row[data-id="${_}"]`))==null||st.focus())}let Ue=!1;function Ve(){Ue||(Ue=!0,queueMicrotask(()=>{Ue=!1,se()}))}return{open:te,close:J,destroy(){Se(),m.removeEventListener("keydown",ce),w.removeEventListener("keydown",de),C==null||C.removeEventListener("click",fe),d.remove()}}}function Wm(n){if(!n)return null;if(typeof n=="string")try{return document.querySelector(n)}catch{return null}return n}var RS,TS,MS,PS,ha=E(()=>{"use strict";$();fa();RS='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><path d="M12 17v5M9 3h6l-1 6 3 3v2H7v-2l3-3z"/></svg>',TS='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><path d="M3 7h18v3H3zM5 10v10h14V10M9 14h6"/></svg>',MS='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><path d="M4 7h16M9 7V4h6v3M6 7l1 13h10l1-13"/></svg>',PS='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"/><path d="M10.3 21a1.94 1.94 0 0 0 3.4 0"/></svg>'});var jm={};L(jm,{InboxStore:()=>pn,NOOP_STORE:()=>ga});function BS(n){return new Promise(e=>{try{if(typeof indexedDB=="undefined")return e(null);let t=indexedDB.open(NS+n,1);t.onupgradeneeded=()=>{let r=t.result;r.objectStoreNames.contains(ze)||r.createObjectStore(ze,{keyPath:"id"}),r.objectStoreNames.contains(nt)||r.createObjectStore(nt)},t.onsuccess=()=>e(t.result),t.onerror=()=>e(null)}catch{e(null)}})}var NS,ze,nt,pn,ga,ba=E(()=>{"use strict";NS="scalebun_inbox_",ze="messages",nt="meta";pn=class{constructor(e){this.scope=e;this.dbp=null}db(){return this.dbp||(this.dbp=BS(this.scope)),this.dbp}async hydrate(){let e=await this.db();return e?new Promise(t=>{try{let r=e.transaction(ze,"readonly").objectStore(ze).getAll();r.onsuccess=()=>t(Array.isArray(r.result)?r.result:[]),r.onerror=()=>t([])}catch{t([])}}):[]}put(e){return this.putMany([e])}async putMany(e){if(!e.length)return;let t=await this.db();if(t)return new Promise(r=>{try{let s=t.transaction(ze,"readwrite"),i=s.objectStore(ze);for(let o of e)i.put(o);s.oncomplete=()=>r(),s.onerror=()=>r(),s.onabort=()=>r()}catch{r()}})}async remove(e){let t=await this.db();if(t)return new Promise(r=>{try{let s=t.transaction(ze,"readwrite");s.objectStore(ze).delete(e),s.oncomplete=()=>r(),s.onerror=()=>r()}catch{r()}})}async getMeta(e){let t=await this.db();if(t)return new Promise(r=>{try{let s=t.transaction(nt,"readonly").objectStore(nt).get(e);s.onsuccess=()=>r(s.result),s.onerror=()=>r(void 0)}catch{r(void 0)}})}async setMeta(e,t){let r=await this.db();if(r)return new Promise(s=>{try{let i=r.transaction(nt,"readwrite");i.objectStore(nt).put(t,e),i.oncomplete=()=>s(),i.onerror=()=>s()}catch{s()}})}async clear(){let e=await this.db();if(e)return new Promise(t=>{try{let r=e.transaction([ze,nt],"readwrite");r.objectStore(ze).clear(),r.objectStore(nt).clear(),r.oncomplete=()=>t(),r.onerror=()=>t()}catch{t()}})}},ga={hydrate:()=>Promise.resolve([]),put:()=>Promise.resolve(),putMany:()=>Promise.resolve(),remove:()=>Promise.resolve(),getMeta:()=>Promise.resolve(void 0),setMeta:()=>Promise.resolve(),clear:()=>Promise.resolve()}});var Km={};L(Km,{InboxSync:()=>ya,InboxTransport:()=>va,mergeMessage:()=>wa,stateRank:()=>qS});function wa(n,e){var a,c,l,u,d;if(!n)return e;let t=n;if(e.revision>n.revision){let p={...n},f=e;for(let m of DS)p[m]=f[m];t=p}let r=(a=n.stateAt)!=null?a:0,s=(c=e.stateAt)!=null?c:0;n.state==="deleted"||e.state==="deleted"?t={...t,state:"deleted",stateAt:Math.max(r,s),deletedAt:(l=n.deletedAt)!=null?l:e.deletedAt}:s>=r?t={...t,state:e.state,stateAt:s,readAt:e.readAt,archivedAt:e.archivedAt}:t={...t,state:n.state,stateAt:r};let i=(u=n.pinnedAt)!=null?u:0,o=(d=e.pinnedAt)!=null?d:0;return t={...t,pinned:o>=i?e.pinned:n.pinned,pinnedAt:Math.max(i,o)||void 0},t}function qS(n){return FS[n]}var FS,DS,ya,va,xa=E(()=>{"use strict";Cn();FS={unread:0,read:1,archived:2,deleted:3},DS=["revision","campaignId","category","priority","title","body","html","imageUrl","iconUrl","cta","createdAt","expiresAt","groupKey","data"];ya=class{constructor(e){this.deps=e;this.cursor=null;this.cursorLoaded=!1;this.inflight=null}sync(){return this.inflight?this.inflight:(this.inflight=this.run().finally(()=>{this.inflight=null}),this.inflight)}async run(){var e,t,r,s,i;this.deps.onStatus("syncing");try{this.cursorLoaded||(this.cursor=(e=await this.deps.store.getMeta("cursor"))!=null?e:null,this.cursorLoaded=!0);let o=this.deps.runtime.collectDirtyOps(),a=new Map(o.map(u=>[u.id,{stateAt:u.stateAt,pinnedAt:u.pinnedAt}])),c={cursor:this.cursor,ops:o},l=await this.deps.transport.sync(c);if(!l){this.deps.onStatus(ot()?"error":"offline");return}l.theme&&((r=(t=this.deps).onTheme)==null||r.call(t,l.theme)),this.deps.runtime.applyServerDelta((s=l.messages)!=null?s:[],(i=l.tombstones)!=null?i:[],l.unreadCount),this.deps.runtime.ackDirty(a),l.cursor!==void 0&&(this.cursor=l.cursor,await this.deps.store.setMeta("cursor",l.cursor)),this.deps.onStatus("idle")}catch{this.deps.onStatus(ot()?"error":"offline")}}},va=class{constructor(e,t,r){this.apiBaseUrl=e;this.clientKey=t;this.deviceId=r}get usable(){return!!this.clientKey&&!!this.apiBaseUrl&&typeof fetch!="undefined"}async sync(e){if(!this.usable)return null;try{let t=await fetch(`${this.apiBaseUrl}/sdk/inbox/sync`,{method:"POST",headers:{"content-type":"application/json","x-scalebun-client-key":this.clientKey},body:JSON.stringify({schemaVersion:1,deviceId:this.deviceId,...e}),keepalive:!0});return t.ok?await t.json():null}catch{return null}}}});var Ym={};L(Ym,{InboxRuntime:()=>Sa});function Xm(n){return`${n.createdAt}_${n.id}`}var Gm,HS,Sa,Jm=E(()=>{"use strict";fa();ba();xa();Gm={unread:0,read:1,archived:2,deleted:3},HS=20;Sa=class{constructor(e){this.deps=e;this.mem=new Map;this.unread=0;this.ctaSubs=new Set;this.syncStatus="idle";var t;this.store=(t=e.store)!=null?t:e.scope?new pn(e.scope):ga}async hydrate(){let e=await this.store.hydrate(),t=this.unread;for(let r of e)this.mem.has(r.id)||(this.mem.set(r.id,r),r.state==="unread"&&t++);this.unread=t,this.emitState()}getState(){let e=0;for(let t of this.mem.values())t.state!=="deleted"&&e++;return{unreadCount:this.unread,total:e,syncStatus:this.syncStatus}}emitState(){this.deps.onState(this.getState())}setSyncStatus(e){e!==this.syncStatus&&(this.syncStatus=e,this.emitState())}stamp(e){let t=this.deps.replayCoord();return t?{...e,replayCoord:t}:e}async ingest(e){var r;let t=[];for(let s of e){let i=this.mem.get(s.id);if(i){if(s.revision<=i.revision)continue;let a={...s,state:i.state,pinned:i.pinned,seenAt:i.seenAt,readAt:i.readAt,archivedAt:i.archivedAt,deletedAt:i.deletedAt};this.mem.set(s.id,a),t.push(a);continue}let o={...s,state:(r=s.state)!=null?r:"unread",pinned:!!s.pinned};this.mem.set(o.id,o),t.push(o),o.state==="unread"&&this.unread++,this.deps.trackEvent(we.received,this.stamp({messageId:o.id,campaignId:o.campaignId,category:o.category,priority:o.priority}))}t.length&&(this.emitUnreadAnd(),await this.store.putMany(t))}emitUnreadAnd(e){e!=null&&e!==this.unread&&this.deps.trackEvent(we.unreadChanged,this.stamp({unreadCount:this.unread,delta:this.unread-e})),this.emitState()}transition(e,t,r){let s=this.mem.get(e);if(!s)return;if(!(r!=null&&r.allowRegress)&&Gm[t]<=Gm[s.state])return s;let i=this.unread,o=s.state==="unread";s.state=t;let a=this.deps.now();s.stateAt=a,s._dirty=!0,t==="read"?s.readAt=a:t==="archived"?s.archivedAt=a:t==="deleted"?s.deletedAt=a:t==="unread"&&(s.readAt=void 0);let c=s.state==="unread";return o&&!c?this.unread--:!o&&c&&this.unread++,this.emitUnreadAnd(i),s}async markRead(e){let t=this.transition(e,"read");t&&(this.deps.trackEvent(we.read,this.stamp({messageId:e,category:t.category,priority:t.priority})),await this.store.put(t))}async markUnread(e){let t=this.mem.get(e);t&&t.state==="read"&&(this.transition(e,"unread",{allowRegress:!0}),await this.store.put(t))}async markReadByCampaign(e){for(let t of this.mem.values())if(t.campaignId===e&&t.state==="unread"){await this.markRead(t.id);return}}async markAllRead(e){let t=this.unread,r=[];for(let s of this.mem.values())s.state==="unread"&&(!e||s.category===e)&&(s.state="read",s.readAt=this.deps.now(),this.unread--,r.push(s));this.emitUnreadAnd(t),await this.store.putMany(r)}async archive(e){let t=this.transition(e,"archived");t&&(this.deps.trackEvent(we.archived,this.stamp({messageId:e,category:t.category})),await this.store.put(t))}async unarchive(e){let t=this.mem.get(e);t&&t.state==="archived"&&(this.transition(e,"read",{allowRegress:!0}),this.deps.trackEvent(we.unarchived,this.stamp({messageId:e,category:t.category})),await this.store.put(t))}async pin(e,t=!0){let r=this.mem.get(e);!r||r.pinned===t||(r.pinned=t,r.pinnedAt=this.deps.now(),r._dirty=!0,this.deps.trackEvent(t?we.pinned:we.unpinned,this.stamp({messageId:e,category:r.category})),this.emitState(),await this.store.put(r))}async remove(e){let t=this.mem.get(e);if(!t||t.state==="deleted")return;let r=t.state==="unread";this.transition(e,"deleted",{allowRegress:!0}),this.deps.trackEvent(we.deleted,this.stamp({messageId:e,category:t.category,wasUnread:r})),await this.store.put(t)}onCtaAction(e){return this.ctaSubs.add(e),()=>this.ctaSubs.delete(e)}act(e,t){var i;let r=this.mem.get(e),s=(i=r==null?void 0:r.cta)==null?void 0:i.find(o=>o.key===t);if(!(!r||!s)){if(this.deps.trackEvent(we.cta,this.stamp({messageId:e,ctaKey:t,action:s.action,url:s.url})),s.action==="link"&&s.url&&/^https?:\/\//i.test(s.url))try{window.open(s.url,"_blank","noopener")}catch{}else if(s.action==="deep"||s.action==="custom")for(let o of this.ctaSubs)try{o(e,s)}catch{}r.state==="unread"&&this.markRead(e)}}async get(e){let t=this.mem.get(e);return t&&t.state!=="deleted"?t:void 0}async query(e={}){var c;let t=e.state==null?null:new Set(Array.isArray(e.state)?e.state:[e.state]),r=[...this.mem.values()].filter(l=>!((t?!t.has(l.state):l.state==="deleted"||l.state==="archived")||e.category&&l.category!==e.category||e.pinned!=null&&l.pinned!==e.pinned));if(r.sort((l,u)=>l.pinned!==u.pinned?l.pinned?-1:1:e.sort==="priority"&&l.priority!==u.priority?u.priority-l.priority:u.createdAt-l.createdAt||(l.id<u.id?1:-1)),e.cursor){let l=r.findIndex(u=>Xm(u)===e.cursor);l>=0&&(r=r.slice(l+1))}let s=(c=e.limit)!=null?c:HS,i=r.slice(0,s),o=r.length>s,a=i.length?i[i.length-1]:void 0;return{messages:i,cursor:a?Xm(a):null,hasMore:o}}async markSeen(e){let t=this.deps.now(),r=[];for(let s of e){let i=this.mem.get(s);i&&i.seenAt==null&&(i.seenAt=t,r.push(i),this.deps.trackEvent(we.seen,this.stamp({messageId:s,category:i.category})))}await this.store.putMany(r)}async sweepExpired(){let e=this.deps.now(),t=this.unread,r=[];for(let s of this.mem.values())if(s.expiresAt&&s.expiresAt<=e&&s.priority<3&&s.state!=="archived"&&s.state!=="deleted"){let i=s.state==="unread";s.state="archived",s.archivedAt=e,r.push(s),i&&this.unread--,this.deps.trackEvent(we.expired,this.stamp({messageId:s.id,category:s.category,wasUnread:i}))}this.emitUnreadAnd(t),await this.store.putMany(r)}recountUnread(){let e=0;for(let t of this.mem.values())t.state==="unread"&&e++;this.unread=e}collectDirtyOps(){var t;let e=[];for(let r of this.mem.values())r._dirty&&e.push({id:r.id,state:r.state,pinned:r.pinned,stateAt:(t=r.stateAt)!=null?t:0,pinnedAt:r.pinnedAt});return e}applyServerDelta(e,t,r){let s=[];for(let a of e){let c=this.mem.get(a.id),l=wa(c,a);l._dirty=c==null?void 0:c._dirty,this.mem.set(a.id,l),s.push(l),c||this.deps.trackEvent(we.received,this.stamp({messageId:l.id,campaignId:l.campaignId,category:l.category,priority:l.priority}))}let i=this.deps.now();for(let a of t){let c=this.mem.get(a);c&&c.state!=="deleted"&&(c.state="deleted",c.deletedAt=i,c.stateAt=i,s.push(c))}let o=this.unread;this.recountUnread(),typeof r=="number"&&(this.unread=r),o!==this.unread&&this.deps.trackEvent(we.unreadChanged,this.stamp({unreadCount:this.unread,delta:this.unread-o})),this.emitState(),this.store.putMany(s)}ackDirty(e){var r,s;let t=[];for(let[i,o]of e){let a=this.mem.get(i);a&&a._dirty&&((r=a.stateAt)!=null?r:0)===o.stateAt&&((s=a.pinnedAt)!=null?s:void 0)===o.pinnedAt&&(a._dirty=!1,t.push(a))}this.store.putMany(t)}dispose(){this.mem.clear(),this.ctaSubs.clear(),this.unread=0}}});var Zm={};L(Zm,{InboxFeature:()=>ka});var Qm,ka,eh=E(()=>{"use strict";$();Qm={unreadCount:0,total:0,syncStatus:"idle"},ka=class{constructor(){this.name="inbox";this.ctx=null;this.active=!1;this.stateSubs=new Set;this.unreadSubs=new Set;this.pendingCta=new Set;this.lastState=Qm;this.controllerRef=null;this.pushState=e=>{let t=this.lastState.unreadCount;this.lastState=e;for(let r of this.stateSubs)try{r(e)}catch{}if(e.unreadCount!==t)for(let r of this.unreadSubs)try{r(e.unreadCount)}catch{}}}get isActive(){return this.active}setup(e){this.ctx=e,typeof window!="undefined"&&(this.active=!0,this.onVisible=()=>{document.visibilityState==="visible"&&this.triggerSync()},this.onAttention=()=>this.triggerSync(),document.addEventListener("visibilitychange",this.onVisible),window.addEventListener("focus",this.onAttention),window.addEventListener("online",this.onAttention),"serviceWorker"in navigator&&(this.onSwMessage=t=>{var s;let r=t.data;if((r==null?void 0:r.type)==="scalebun-inbox-sync"){this.refreshNow();return}if((r==null?void 0:r.type)==="scalebun-push-click"&&((s=r.data)!=null&&s.scalebunCampaignId)){let i=r.data.scalebunCampaignId;this.ensureRuntime().then(o=>o==null?void 0:o.markReadByCampaign(i))}},navigator.serviceWorker.addEventListener("message",this.onSwMessage)))}triggerSync(){this.active&&this.syncEngine&&this.syncEngine.sync()}applyTheme(e){var r;JSON.stringify(e)!==JSON.stringify((r=this.remoteTheme)!=null?r:null)&&(this.remoteTheme=e,this.widget&&Promise.resolve().then(()=>(ha(),ma)).then(({mountInbox:s})=>{var i,o;(i=this.widget)==null||i.destroy(),this.widget=s(this.controller(),(o=this.mountOpts)!=null?o:{},this.remoteTheme)}))}refreshNow(){return this.active?this.ensureRuntime().then(()=>{var e;(e=this.syncEngine)==null||e.sync()}):Promise.resolve()}ensureRuntime(){return this.runtime?Promise.resolve(this.runtime):this.ctx?this.loading?this.loading:(this.loading=(async()=>{var c,l,u,d,p,f,m;let[{InboxRuntime:e},{InboxStore:t}]=await Promise.all([Promise.resolve().then(()=>(Jm(),Ym)),Promise.resolve().then(()=>(ba(),jm))]),r=new t(((c=this.ctx)==null?void 0:c.deviceId)||"anon"),s=new e({trackEvent:(h,g)=>{var S;return(S=this.ctx)==null?void 0:S.trackEvent(h,g)},replayCoord:ne,now:P,onState:this.pushState,store:r});this.runtime=s;for(let h of this.pendingCta)s.onCtaAction(h);this.pendingCta.clear(),await s.hydrate();let{InboxSync:i,InboxTransport:o}=await Promise.resolve().then(()=>(xa(),Km)),a=new o((u=(l=this.ctx)==null?void 0:l.apiBaseUrl)!=null?u:"",(p=(d=this.ctx)==null?void 0:d.clientKey)!=null?p:"",(m=(f=this.ctx)==null?void 0:f.deviceId)!=null?m:"anon");return this.syncEngine=new i({transport:a,store:r,runtime:s,onStatus:h=>s.setSyncStatus(h),onTheme:h=>this.applyTheme(h)}),this.syncEngine.sync(),s})(),this.loading):Promise.resolve(void 0)}call(e,...t){return this.ensureRuntime().then(r=>{var s;(s=r==null?void 0:r[e])==null||s.call(r,...t)})}controller(){return this.controllerRef?this.controllerRef:(this.controllerRef={subscribe:e=>(this.stateSubs.add(e),e(this.lastState),this.ensureRuntime(),()=>this.stateSubs.delete(e)),onUnreadChange:e=>(this.unreadSubs.add(e),e(this.lastState.unreadCount),this.ensureRuntime(),()=>this.unreadSubs.delete(e)),getState:()=>this.lastState,query:e=>this.ensureRuntime().then(t=>t?t.query(e):{messages:[],cursor:null,hasMore:!1}),get:e=>this.ensureRuntime().then(t=>t==null?void 0:t.get(e)),markRead:e=>this.call("markRead",e),markUnread:e=>this.call("markUnread",e),markAllRead:e=>this.call("markAllRead",e),archive:e=>this.call("archive",e),unarchive:e=>this.call("unarchive",e),pin:(e,t)=>this.call("pin",e,t),remove:e=>this.call("remove",e),ingest:e=>this.call("ingest",e),act:(e,t)=>{this.call("act",e,t)},mount:e=>{typeof document!="undefined"&&this.ensureRuntime().then(async()=>{var r;let{mountInbox:t}=await Promise.resolve().then(()=>(ha(),ma));(r=this.widget)==null||r.destroy(),this.mountOpts=e!=null?e:{},this.widget=t(this.controller(),this.mountOpts,this.remoteTheme)})},open:()=>{var e;return(e=this.widget)==null?void 0:e.open()},close:()=>{var e;return(e=this.widget)==null?void 0:e.close()},unmount:()=>{var e;(e=this.widget)==null||e.destroy(),this.widget=void 0},onCtaAction:e=>this.runtime?this.runtime.onCtaAction(e):(this.pendingCta.add(e),this.ensureRuntime(),()=>{this.pendingCta.delete(e)}),refresh:()=>this.ensureRuntime().then(()=>{var e;return(e=this.syncEngine)==null?void 0:e.sync()})},this.controllerRef)}teardown(){var e,t;typeof window!="undefined"&&(this.onVisible&&document.removeEventListener("visibilitychange",this.onVisible),this.onAttention&&(window.removeEventListener("focus",this.onAttention),window.removeEventListener("online",this.onAttention)),this.onSwMessage&&"serviceWorker"in navigator&&navigator.serviceWorker.removeEventListener("message",this.onSwMessage)),this.onVisible=void 0,this.onAttention=void 0,this.onSwMessage=void 0,(e=this.widget)==null||e.destroy(),this.widget=void 0,(t=this.runtime)==null||t.dispose(),this.runtime=void 0,this.syncEngine=void 0,this.loading=void 0,this.stateSubs.clear(),this.unreadSubs.clear(),this.pendingCta.clear(),this.lastState=Qm,this.active=!1}}});var th={};L(th,{ProfilerFeature:()=>Ea});function $S(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}var Ea,nh=E(()=>{"use strict";$();Ea=class{constructor(){this.name="profiler";this.ctx=null;this.active=!1;this.startedAt=0}get isActive(){return this.active}setup(e){this.ctx=e,this.active=!0}available(){return typeof window!="undefined"&&typeof window.Profiler=="function"}start(e=10){if(!this.active||this.profiler||!this.available())return!1;try{let t=window.Profiler;return this.profiler=new t({sampleInterval:e,maxBufferSize:1e4}),this.startedAt=P(),!0}catch{return this.profiler=void 0,!1}}async stop(){var t;if(!this.profiler)return!1;let e=this.profiler;this.profiler=void 0;try{let r=await e.stop(),s=Math.round(P()-this.startedAt);return(t=this.ctx)==null||t.emit({kind:"performance",metric:"js_profile",value:Array.isArray(r.samples)?r.samples.length:0,duration:s,screenName:$S(),metadata:{profile:r,format:"w3c-js-self-profiling"},clientId:`prof_${H()}`,timestamp:P()}),!0}catch{return!1}}teardown(){if(this.profiler){try{this.profiler.stop()}catch{}this.profiler=void 0}this.active=!1}}});function Ia(){return typeof window!="undefined"&&typeof window.Profiler=="function"}async function rh(n,e=10){if(!Ia())return null;try{let t=window.Profiler,r=new t({sampleInterval:e,maxBufferSize:1e4});await new Promise(o=>setTimeout(o,n));let s=await r.stop(),i=Array.isArray(s==null?void 0:s.samples)?s.samples.length:0;return{profile:s,samples:i}}catch{return null}}var sh=E(()=>{"use strict"});function ch(n){return n?{...ih,...n}:ih}var ih,oh,ah,Ca=E(()=>{"use strict";ih={pressureSustainMs:6e3,lagP95Ms:500,mainThreadStallMs:500,jankBurstCount:5,jankWindowMs:1e4,frozenFrameMs:700,memSurgeBytesPerSec:6291456,leakSamples:10,leakMinBytes:52428800,heapUsedRatio:.9,cooldownMs:6e4},oh=10*6e4,ah=10});function zS(n){if(!n.length)return 0;let e=Math.min(n.length-1,Math.floor(n.length*.95));return n[e]}var ks,Ss,lh=E(()=>{"use strict";Ca();ks=class ks{constructor(e){this.lag=[];this.pressure="nominal";this.pressureSince=0;this.jankAt=[];this.highSlopeStreak=0;this.memTrend=[];this.lastEmit=new Map;this.emitTimes=[];this.droppedCount=0;this.deps=e,this.th=e.thresholds}get dropped(){return this.droppedCount}onHeartbeat(e){this.lag.push(e),this.lag.length>ks.LAG_RING&&this.lag.shift(),e>=this.th.mainThreadStallMs&&this.emit({type:"main_thread_stall",severity:e>=2e3?"critical":"warning",confidence:"high",tier:"lag-proxy",value:Math.round(e),likelyCause:"main thread blocked",description:`The main thread was blocked for ${Math.round(e)} ms.`}),this.evaluateCpu()}onPressure(e){e!==this.pressure&&(this.pressure=e,this.pressureSince=this.deps.now(),this.evaluateCpu())}onJank(e){var s,i;let t=this.deps.now();e.frameDurationMs>=this.th.frozenFrameMs&&this.emit({type:"frozen_frame",severity:e.frameDurationMs>=2e3?"critical":"warning",confidence:"high",tier:e.metric,value:Math.round(e.frameDurationMs),script:e.script,likelyCause:(s=e.script)!=null&&s.url?`long frame in ${e.script.url}`:"long animation frame",description:`A single frame took ${Math.round(e.frameDurationMs)} ms.`}),this.jankAt.push(t);let r=t-this.th.jankWindowMs;for(;this.jankAt.length&&this.jankAt[0]<r;)this.jankAt.shift();this.jankAt.length>=this.th.jankBurstCount&&this.emit({type:"jank_burst",severity:"warning",confidence:"medium",tier:e.metric,value:this.jankAt.length,script:e.script,likelyCause:(i=e.script)!=null&&i.url?`repeated jank in ${e.script.url}`:"repeated main-thread jank",description:`${this.jankAt.length} janky frames within ${Math.round(this.th.jankWindowMs/1e3)} s.`})}onMemory(e,t){let r=this.deps.now();if(t>0&&e/t>=this.th.heapUsedRatio&&this.emit({type:"low_memory_pressure",severity:"critical",confidence:"high",tier:"memory",value:Math.round(e/t*100),likelyCause:"JS heap near its limit",description:`Used heap is ${Math.round(e/t*100)}% of the limit.`}),this.prevMem){let s=(r-this.prevMem.at)/1e3,i=s>0?(e-this.prevMem.used)/s:0;i>this.th.memSurgeBytesPerSec?(this.highSlopeStreak++,this.highSlopeStreak>=2&&this.emit({type:"memory_surge",severity:i>2*this.th.memSurgeBytesPerSec?"critical":"warning",confidence:"medium",tier:"memory",value:Math.round(i),likelyCause:"rapid heap allocation",description:`Heap grew ~${Math.round(i/(1024*1024))} MiB/s.`})):this.highSlopeStreak=0}if(this.prevMem={used:e,at:r},this.memTrend.push(e),this.memTrend.length>this.th.leakSamples&&this.memTrend.shift(),this.memTrend.length===this.th.leakSamples){let s=!0;for(let o=1;o<this.memTrend.length;o++)if(this.memTrend[o]<this.memTrend[o-1]){s=!1;break}let i=this.memTrend[this.memTrend.length-1]-this.memTrend[0];s&&i>=this.th.leakMinBytes&&this.emit({type:"memory_leak_suspicion",severity:"warning",confidence:"low",tier:"memory",value:Math.round(i),likelyCause:"monotonic heap growth",description:`Heap grew ~${Math.round(i/(1024*1024))} MiB over ${this.memTrend.length} samples without release.`})}}evaluateCpu(){if(this.deps.pressureAvailable){this.pressure==="critical"&&this.deps.now()-this.pressureSince>=this.th.pressureSustainMs&&this.emit({type:"cpu_spike",severity:"critical",confidence:"high",tier:"pressure",likelyCause:"sustained CPU pressure",description:`CPU stayed under critical pressure for ${Math.round(this.th.pressureSustainMs/1e3)}s+.`});return}if(this.lag.length<6)return;let e=zS([...this.lag].sort((t,r)=>t-r));e>this.th.lagP95Ms&&this.emit({type:"cpu_spike",severity:e>2*this.th.lagP95Ms?"critical":"warning",confidence:"medium",tier:"lag-proxy",value:Math.round(e),likelyCause:"sustained event-loop lag",description:`Event-loop lag p95 was ${Math.round(e)} ms.`})}emit(e){var r;let t=this.deps.now();if(!(t-((r=this.lastEmit.get(e.type))!=null?r:-1/0)<this.th.cooldownMs)){if(this.emitTimes=this.emitTimes.filter(s=>t-s<oh),this.emitTimes.length>=ah){this.droppedCount++;return}this.lastEmit.set(e.type,t),this.emitTimes.push(t),this.deps.onIncident({...e,startTs:t})}}};ks.LAG_RING=32;Ss=ks});function dh(n,e){return n.length?n[Math.min(n.length-1,Math.floor(n.length*e))]:0}var Es,uh=E(()=>{"use strict";$();Es=class{constructor(){this.lags=[];this.pressureCounts={nominal:0,fair:0,serious:0,critical:0};this.sawPressure=!1;this.memFirstAt=0;this.memLastAt=0;this.incidents=0}onHeartbeat(e){this.lags.push(e)}onPressure(e){this.pressureCounts[e]++,this.sawPressure=!0}onMemory(e){let t=P();this.memFirst==null&&(this.memFirst=e,this.memFirstAt=t),this.memLast=e,this.memLastAt=t}noteIncident(){this.incidents++}drain(e,t){let r=[...this.lags].sort((i,o)=>i-o),s={lagP50:Math.round(dh(r,.5)),lagP95:Math.round(dh(r,.95)),lagMax:r.length?Math.round(r[r.length-1]):0,heartbeats:this.lags.length,incidents:this.incidents,droppedIncidents:t,tiers:e};if(this.sawPressure&&(s.pressure={...this.pressureCounts}),this.memLast!=null&&this.memFirst!=null){let i=(this.memLastAt-this.memFirstAt)/1e3;s.heap={firstBytes:this.memFirst,lastBytes:this.memLast,slopeBytesPerSec:i>0?Math.round((this.memLast-this.memFirst)/i):0}}return this.lags=[],this.pressureCounts={nominal:0,fair:0,serious:0,critical:0},this.sawPressure=!1,this.incidents=0,this.memLast!=null&&(this.memFirst=this.memLast,this.memFirstAt=P()),s}}});function ph(){try{return typeof document=="undefined"||document.visibilityState!=="hidden"}catch{return!0}}function fh(n,e){var d;let t=[],r=P(),s,i=()=>{let p=P(),f=p-r-e.heartbeatMs;r=p,f>=0&&n.onHeartbeat(f),s=setTimeout(i,e.heartbeatMs)},o=()=>{r=P(),s=setTimeout(i,e.heartbeatMs)},a=()=>{s&&clearTimeout(s),s=void 0},c=()=>{ph()?s||o():a()};typeof document!="undefined"&&(document.addEventListener("visibilitychange",c),t.push(()=>document.removeEventListener("visibilitychange",c))),ph()&&o(),t.push(a);let l=!1;try{let p=globalThis.PressureObserver;if(typeof p=="function"){l=!0;let f=new p(m=>{let h=m[m.length-1];h!=null&&h.state&&n.onPressure(h.state)});f.observe("cpu",{sampleInterval:2e3}).catch(()=>{}),t.push(()=>{try{f.disconnect()}catch{}})}}catch{l=!1}let u=typeof performance!="undefined"&&typeof((d=performance.memory)==null?void 0:d.usedJSHeapSize)=="number";if(u){let p=()=>{var h;let m=performance.memory;m&&typeof m.usedJSHeapSize=="number"&&n.onMemory(m.usedJSHeapSize,(h=m.jsHeapSizeLimit)!=null?h:0)};p();let f=setInterval(p,e.memorySampleMs);t.push(()=>clearInterval(f))}return{stop:()=>{for(let p of t)try{p()}catch{}},pressureAvailable:l,memoryAvailable:u}}var mh=E(()=>{"use strict";$()});var hh={};L(hh,{startWatchdog:()=>GS});function VS(n,e){let t=e!=null?e:1;return t>=1?!0:t<=0?!1:Ee(`${n!=null?n:""}:wzb-watchdog-v1`)%100<t*100}function WS(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}function GS(n){var S,v,y,b;let e=(S=n.watchdogOptions)!=null?S:{};if(!VS(n.sessionId,e.sampleRate))return US;let t=(w,x,I,k)=>{let C=ne();n.emit({kind:"performance",metric:w,value:x,screenName:WS(),metadata:C?{...I,replay:C}:I,clientId:k!=null?k:`wd_${H()}`,timestamp:P()})},r=e.captureProfileOnIncident!==!1,s=!1,i=0,o=w=>{if(!r||s||!Ia())return;let x=P();x-i<KS||(i=x,s=!0,rh(jS).then(I=>{I&&t("js_profile",I.samples,{profile:I.profile,format:"w3c-js-self-profiling",incidentClientId:w})}).finally(()=>{s=!1}))},a=ch(e.thresholds),c=new Es,l=0,u=0,d=typeof globalThis.PressureObserver=="function",p=new Ss({thresholds:a,now:P,pressureAvailable:d,onIncident:w=>{var I;l++,c.noteIncident();let x=`wd_${H()}`;t("resource_incident",(I=w.value)!=null?I:1,w,x),n.signal("resource_pressure"),o(x)}}),f=xd(w=>p.onJank(w)),m=fh({onHeartbeat:w=>{p.onHeartbeat(w),c.onHeartbeat(w)},onPressure:w=>{p.onPressure(w),c.onPressure(w)},onMemory:(w,x)=>{p.onMemory(w,x),c.onMemory(w)}},{heartbeatMs:Math.max(250,(v=e.heartbeatMs)!=null?v:1e3),memorySampleMs:(y=e.memorySampleMs)!=null?y:2e4}),h=()=>({pressure:d,memory:m.memoryAvailable}),g=setInterval(()=>{u++;let w=c.drain(h(),p.dropped);t("resource_health",w.lagP95,w)},(b=e.rollupMs)!=null?b:3e4);return{stop:()=>{clearInterval(g),f(),m.stop()},stats:()=>({incidents:l,droppedIncidents:p.dropped,rollups:u,tiers:h()})}}var US,jS,KS,gh=E(()=>{"use strict";$();Fe();ki();sh();lh();uh();mh();Ca();US={stop:()=>{},stats:()=>({incidents:0,droppedIncidents:0,rollups:0,tiers:{pressure:!1,memory:!1}})};jS=1e4,KS=6e4});var bh={};L(bh,{WatchdogFeature:()=>Aa});var XS,Aa,yh=E(()=>{"use strict";XS={incidents:0,droppedIncidents:0,rollups:0,tiers:{pressure:!1,memory:!1}},Aa=class{constructor(){this.name="watchdog";this.active=!1}get isActive(){return this.active}async setup(e){if(typeof window=="undefined"||typeof performance=="undefined")return;this.active=!0;let{startWatchdog:t}=await Promise.resolve().then(()=>(gh(),hh));this.active&&(this.handle=t(e))}stats(){var e,t;return(t=(e=this.handle)==null?void 0:e.stats())!=null?t:XS}teardown(){var e;this.active=!1,(e=this.handle)==null||e.stop(),this.handle=void 0}}});function YS(n){if(!n)return[];try{let e=JSON.parse(n);return Array.isArray(e)?e:[]}catch{return[]}}function JS(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}var vh,Ra,Is,wh=E(()=>{"use strict";vh="scalebun_inapp_outbox";Ra=class{constructor(e,t=JS()){this.post=e;this.storage=t;this.queue=[];this.flushing=!1;this.timer=null;var r,s;this.queue=YS((s=(r=this.storage)==null?void 0:r.getItem(vh))!=null?s:null)}enqueue(e){this.queue.some(t=>t.id===e.id)||(this.queue.push(e),this.queue.length>200&&this.queue.splice(0,this.queue.length-200),this.persist(),this.schedule())}get size(){return this.queue.length}schedule(){this.timer||this.flushing||(this.timer=setTimeout(()=>{this.timer=null,this.flush()},800))}async flush(){if(!(this.flushing||this.queue.length===0)){this.flushing=!0;try{for(;this.queue.length>0;){let e=this.queue.slice(0,50);if(!await this.post(e))break;let r=new Set(e.map(s=>s.id));this.queue=this.queue.filter(s=>!r.has(s.id)),this.persist()}}finally{this.flushing=!1,this.queue.length>0&&this.schedule()}}}persist(){var e;try{(e=this.storage)==null||e.setItem(vh,JSON.stringify(this.queue))}catch{}}};Is=class{constructor(e,t){this.apiBaseUrl=e;this.clientKey=t;this.outbox=new Ra(r=>this.postEvents(r))}get usable(){return!!this.clientKey&&!!this.apiBaseUrl&&typeof fetch!="undefined"}headers(){return{"content-type":"application/json","x-scalebun-client-key":this.clientKey}}async fetchConfig(e){if(!this.usable)return null;let t=new URLSearchParams;for(let[r,s]of Object.entries(e))s&&t.set(r,String(s));try{let r=await fetch(`${this.apiBaseUrl}/sdk/engage/config?${t.toString()}`,{headers:this.headers(),cache:"no-store"});return r.ok?await r.json():null}catch{return null}}async postEvents(e){if(!this.usable||e.length===0)return!1;try{return(await fetch(`${this.apiBaseUrl}/sdk/engage/events`,{method:"POST",headers:this.headers(),body:JSON.stringify({schemaVersion:1,source:"inapp",events:e}),keepalive:!0})).ok}catch{return!1}}}});function QS(n){let e="";for(let t=0;t<n.length;t++){let r=n[t];r==="*"?n[t+1]==="*"?(e+=".*",t++):e+="[^/]*":"\\^$.|?+()[]{}".includes(r)?e+="\\"+r:e+=r}return new RegExp("^"+e+"$")}function Ta(n,e){return!n||n.length===0?!0:n.some(t=>QS(t).test(e))}function ZS(n,e){var r;if(!n)return!0;let t=(r=e.queryElement)!=null?r:s=>typeof document!="undefined"?!!document.querySelector(s):!1;try{return t(n)}catch{return!1}}function tk(n){let e=n==null?void 0:n.segments;return e?e instanceof Set?e:new Set(e):new Set}function nk(n,e){var r;let t=n.trim();if(!t)return!0;if(t.startsWith("segment:"))return tk(e).has(t.slice(8).trim());for(let s of ek){let i=t.indexOf(s);if(i>0){let o=t.slice(0,i).trim(),a=t.slice(i+s.length).trim(),c=(r=e==null?void 0:e.attrs)==null?void 0:r[o];if(c===void 0)return!1;let l=Number(c),u=Number(a),d=!Number.isNaN(l)&&!Number.isNaN(u)&&a!=="";switch(s){case"=":return String(c)===a;case"!=":return String(c)!==a;case">":return d&&l>u;case"<":return d&&l<u;case">=":return d&&l>=u;case"<=":return d&&l<=u}}}return!1}function rk(n,e){return!n||!n.trim()?!0:n.split("&&").every(t=>nk(t,e))}function kh(n,e,t){var s,i;let r=(s=n.targeting)!=null?s:{};return Ta(r.route,e.route)?ZS(r.element,e)?r.minViewport!=null&&((i=e.viewportWidth)!=null?i:1/0)<r.minViewport?{eligible:!1,reason:"viewport"}:r.selection&&!e.hasSelection?{eligible:!1,reason:"selection"}:rk(r.audience,e.profile)?t.canShow(n,e.now)?{eligible:!0}:{eligible:!1,reason:"frequency"}:{eligible:!1,reason:"audience"}:{eligible:!1,reason:"element"}:{eligible:!1,reason:"route"}}function ik(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}function ok(){try{return typeof sessionStorage!="undefined"?sessionStorage:null}catch{return null}}var ek,xh,Sh,sk,Cs,Ma=E(()=>{"use strict";ss();ek=[">=","<=","!=","=",">","<"];xh="scalebun_inapp_freq",Sh="scalebun_inapp_freq_session",sk=1,Cs=class{constructor(e=ik(),t="",r=ok()){this.storage=e;this.sessionId=t;this.sessionStore=r;this.map=this.load(),this.session=this.loadSession()}loadSession(){var e;try{let t=(e=this.sessionStore)==null?void 0:e.getItem(Sh),r=t?JSON.parse(t):null;if(r&&r.sid===this.sessionId&&r.recs)return{sid:this.sessionId,recs:r.recs}}catch{}return{sid:this.sessionId,recs:{}}}saveSession(){var e;try{(e=this.sessionStore)==null||e.setItem(Sh,JSON.stringify(this.session))}catch{}}load(){var e;try{let t=(e=this.storage)==null?void 0:e.getItem(xh);return t?JSON.parse(t):{}}catch{return{}}}save(){var e;try{(e=this.storage)==null||e.setItem(xh,JSON.stringify(this.map))}catch{}}canShow(e,t){var a,c,l;let r=e.frequency,s=this.map[e.id],i=this.session.recs[e.id];if(s!=null&&s.dismissed&&((a=e.dismiss)!=null&&a.persistDismiss||i!=null&&i.dismissed))return!1;let o=(c=r==null?void 0:r.maxImpressionsPerSession)!=null?c:r?0:sk;return o>0&&((l=i==null?void 0:i.n)!=null?l:0)>=o?!1:s?!(r!=null&&r.showOnce&&s.count>0||(r==null?void 0:r.maxImpressions)!=null&&s.count>=r.maxImpressions||(r==null?void 0:r.cooldown)!=null&&t-s.lastShown<r.cooldown):!0}recordImpression(e,t){var i,o;let r=(i=this.map[e])!=null?i:{count:0,lastShown:0};r.count+=1,r.lastShown=t,this.map[e]=r,this.save();let s=(o=this.session.recs[e])!=null?o:{n:0};s.n+=1,this.session.recs[e]=s,this.saveSession()}recordDismiss(e,t){var i,o;let r=(i=this.map[e])!=null?i:{count:0,lastShown:0};r.dismissed=!0,r.lastShown=t,this.map[e]=r,this.save();let s=(o=this.session.recs[e])!=null?o:{n:0};s.dismissed=!0,this.session.recs[e]=s,this.saveSession()}clear(){this.map={},this.save(),this.session={sid:this.sessionId,recs:{}},this.saveSession()}}});var Eh=E(()=>{"use strict"});function Ih(n,e){var t,r,s;if(n.type!==e.type)return!1;switch(n.type){case"route":return Ta(n.match?[n.match]:void 0,(t=e.value)!=null?t:"");case"event":return n.match==null||n.match===e.value;case"idle":return((r=e.arg)!=null?r:0)>=((s=n.arg)!=null?s:0);case"element":case"hover":case"selection":case"keyboard":case"right-click":return n.match==null||n.match===e.value;default:return!0}}function Ch(){let n=null,e=null,t=()=>typeof location!="undefined"?location.pathname+location.search:"";return{type:"route",start(r){if(typeof window=="undefined"||typeof history=="undefined")return;let s=()=>r.fire({type:"route",value:t()}),i=history.pushState,o=history.replaceState;history.pushState=function(...a){let c=i.apply(this,a);return s(),c},history.replaceState=function(...a){let c=o.apply(this,a);return s(),c},e=s,window.addEventListener("popstate",s),window.addEventListener("hashchange",s),n=()=>{history.pushState=i,history.replaceState=o},s()},stop(){n==null||n(),n=null,e&&typeof window!="undefined"&&(window.removeEventListener("popstate",e),window.removeEventListener("hashchange",e)),e=null}}}function Ah(){let n=null;return{type:"event",start(e){n=e},stop(){n=null},fireEvent(e){n==null||n.fire({type:"event",value:e})}}}function Rh(){let n=null,e=[],t=[],r=null,s=["mousemove","mousedown","keydown","scroll","touchstart","pointerdown"],i=()=>{for(let a of t)clearTimeout(a);t=[]},o=()=>{if(i(),!!n)for(let a of e)a>0&&t.push(setTimeout(()=>n==null?void 0:n.fire({type:"idle",arg:a}),a))};return{type:"idle",start(a){if(n=a,typeof window!="undefined"){r=o;for(let c of s)window.addEventListener(c,r,{passive:!0});o()}},stop(){if(i(),r&&typeof window!="undefined")for(let a of s)window.removeEventListener(a,r);r=null,n=null},setThresholds(a){e=Array.from(new Set(a.filter(c=>c>0))),o()}}}var As,Th=E(()=>{"use strict";Ma();Eh();As=class{constructor(e=()=>Date.now()){this.listeners=new Set;this.plugins=[];this.now=e}on(e){return this.listeners.add(e),()=>this.listeners.delete(e)}fire(e){var r;let t={...e,at:(r=e.at)!=null?r:this.now()};for(let s of this.listeners)try{s(t)}catch{}}use(e){this.plugins.push(e),e.start(this)}stop(){for(let e of this.plugins)e.stop();this.plugins=[],this.listeners.clear()}}});function lk(n,e){var r,s;let t=Math.max(0,Math.min(120,120-(e-n.triggeredAt)/1e3));return ak[n.tier]+((r=n.campaignPriority)!=null?r:0)+t+((s=ck[n.category])!=null?s:0)}function Ph(n,e,t,r){var y;let s=r.now,i=n.map(b=>({c:b,score:lk(b,s)})).sort((b,w)=>w.score-b.score||b.c.id.localeCompare(w.c.id)),o=[],a=(b,w,x,I,k)=>o.push({id:b.id,action:w,reason:x,zone:b.zone,score:I,preempts:k}),c=new Map,l=new Map,u=e.filter(b=>b.zone==="toast").length,d=0,p=e.some(b=>Rs(b.zone)),f=!1,m=e.some(b=>b.tier==="critical")||!1,h=t.tokens,g=t.interruptionsThisSession,S=t.modalsToday,v=t.lastInterruptionAt;for(let{c:b,score:w}of i){if(b.campaignId){if(c.has(b.campaignId)){a(b,"DROP","dedupe:campaign",w);continue}c.set(b.campaignId,w)}let x=(y=r.guard)==null?void 0:y.call(r,b);if(x){a(b,x.action,x.reason,w);continue}if(b.interactionOnly){a(b,"DEFER","interaction-only",w);continue}if(b.guidance&&m){a(b,"DEFER","defer-until-clear",w);continue}if((b.zone==="toast"?3:1)===1&&l.has(b.zone)){a(b,b.cost>0?"QUEUE":"DROP",b.cost>0?"queue:zone-busy":"zone-lost",w);continue}if(Rs(b.zone)&&p){a(b,"QUEUE","queue:focus-busy",w);continue}if(b.zone==="toast"&&u+d>=3){a(b,"QUEUE","queue:toast-cap",w);continue}if(b.cost>0){if(g>=t.maxInterruptionsPerSession){a(b,"QUEUE","queue:budget:interruptions",w);continue}if(b.zone==="modal"&&S>=t.maxModalsPerDay){a(b,"QUEUE","queue:budget:modals",w);continue}if(f||s-v<t.minCooldownMs){a(b,"QUEUE","queue:cooldown",w);continue}if(h<b.cost){a(b,"QUEUE","queue:budget:tokens",w);continue}}let k;if(b.tier==="critical"){let C=e.find(M=>M.zone===b.zone&&!Rs(M.zone)&&Mh[M.tier]<Mh.critical);C&&(k=C.id)}a(b,k?"PREEMPT":"SHOW",k?"preempt:critical":"show",w,k),l.set(b.zone,b.id),b.zone==="toast"&&d++,Rs(b.zone)&&(p=!0),b.tier==="critical"&&(m=!0),b.cost>0&&(h-=b.cost,g++,b.zone==="modal"&&S++,f=!0,v=s)}return o}var ak,ck,Mh,Rs,Lh=E(()=>{"use strict";ak={critical:1e3,high:400,normal:200,low:100,passive:50},ck={security:300,system:250,billing:200},Mh={critical:4,high:3,normal:2,low:1,passive:0};Rs=n=>n==="modal"||n==="takeover"});function dk(n,e={}){switch(n){case"modal":return{surface:"modal",surfaceOptions:{placement:"center",size:"md",backdrop:!0}};case"fullscreen":return{surface:"takeover",surfaceOptions:{size:"full"}};case"bottom_sheet":return{surface:"slideover",surfaceOptions:{placement:"bottom"}};case"top_banner":return{surface:"banner",surfaceOptions:{placement:"top"}};case"bottom_banner":return{surface:"banner",surfaceOptions:{placement:"bottom"}};case"toast":return{surface:"toast",surfaceOptions:{placement:"bottom-right"}};case"tooltip":return e.anchorSelector?{surface:"popover",surfaceOptions:{placement:"bottom",maxWidth:320}}:{surface:"toast",surfaceOptions:{placement:"bottom-right"}};default:return{surface:"modal",surfaceOptions:{placement:"center",backdrop:!0}}}}function uk(n){var s,i;let e=n.spec,t=[];e.imageUrl&&t.push({kind:"image",props:{src:e.imageUrl,alt:(s=e.title)!=null?s:""}}),e.title&&t.push({kind:"heading",props:{text:e.title}}),e.body&&t.push({kind:"text",props:{text:e.body}});let r=[];return e.cta&&r.push({label:e.cta.label,variant:"primary",action:e.cta.action,deepLink:e.cta.deepLink}),e.secondaryCta&&r.push({label:e.secondaryCta.label,variant:"secondary",action:e.secondaryCta.action}),r.length&&t.push({kind:"cta",props:{actions:r}}),t.length===0&&t.push({kind:"text",props:{text:(i=e.body)!=null?i:""}}),t}function pk(n){var t,r,s,i;if(n.preview)return[{type:"manual"}];let e=(r=n.targetScreen)!=null?r:(t=n.triggerConfig)==null?void 0:t.screen;return e?[{type:"route",match:e}]:(s=n.triggerConfig)!=null&&s.event?[{type:"event",match:n.triggerConfig.event}]:(i=n.triggerConfig)!=null&&i.seconds?[{type:"idle",arg:n.triggerConfig.seconds*1e3}]:[{type:"manual"}]}function fk(n){let e=n.throttle;if(!e)return;let t={};return e.showOnce&&(t.showOnce=!0),e.maxImpressions!=null&&(t.maxImpressions=e.maxImpressions),e.cooldownHours!=null&&(t.cooldown=e.cooldownHours*36e5),Object.keys(t).length?t:void 0}function mk(n,e={}){var o,a,c;let{surface:t,surfaceOptions:r}=dk(n.layout,e),s=t==="popover",i=(a=n.targetScreen)!=null?a:(o=n.triggerConfig)==null?void 0:o.screen;return{id:n.id,key:`legacy.${n.layout}.${n.id}`,name:(c=n.spec.title)!=null?c:`Legacy ${n.layout}`,category:"misc",platforms:["web"],surface:t,surfaceOptions:r,blocks:uk(n),priority:n.layout==="fullscreen"?"high":"normal",triggers:pk(n),targeting:{...i?{route:[i]}:{},...s&&e.anchorSelector?{element:e.anchorSelector}:{}},frequency:fk(n),dismiss:{xButton:!0,escClose:!0,backdropClose:n.layout==="modal"},motion:{reducedMotionFallback:"fade"},contract:{payloadVersion:1}}}function _h(n,e={}){return(n!=null?n:[]).map(t=>mk(t,e))}var Oh=E(()=>{"use strict"});function hk(n){var e;return(e=n==null?void 0:n.engine)!=null?e:"compat"}function Nh(n){var r;let e=hk(n.config);if(e==="legacy")return[];let t=[];return(e==="native"||e==="compat")&&t.push(...(r=n.nativeVariants)!=null?r:[]),e==="compat"&&t.push(..._h(n.legacyMessages)),t.filter(Du)}var Bh=E(()=>{"use strict";Oh();qr()});var Fh={};L(Fh,{InAppEngine:()=>Pa});var gk,Pa,Dh=E(()=>{"use strict";wh();Th();Ma();Lh();Bh();os();eo();Ao();qr();Oi();gk=120,Pa=class{constructor(e){this.deps=e;this.host=new cn;this.slots=new Mt;this.variants=[];this.pending=new Map;this.live=new Map;this.tickTimer=null;this.started=!1;var t;this.now=(t=e.now)!=null?t:()=>Date.now(),this.freq=new Cs(void 0,e.sessionId),this.transport=new Is(e.apiBaseUrl,e.clientKey),this.bus=new As(this.now),this.budget={tokens:5,interruptionsThisSession:0,maxInterruptionsPerSession:5,modalsToday:0,maxModalsPerDay:3,lastInterruptionAt:0,minCooldownMs:3e4}}async start(){this.started||(this.started=!0,await this.load())}async onIdentify(){this.started&&await this.load()}async load(){var s,i;let e;try{e=await this.transport.fetchConfig({platform:"web",appVersion:this.deps.appVersion,deviceId:this.deps.deviceId,endUserId:(i=(s=this.deps).userId)==null?void 0:i.call(s),route:this.deps.route()})}catch{return}if(!this.started)return;let t=_i(e),r=e==null?void 0:e.variants;this.variants=Nh({legacyMessages:t.inAppMessages,nativeVariants:r,config:this.deps.config}),this.variants.length!==0&&(this.unsub||(this.host.ensure(),this.bus.use(Ch()),this.bus.use(Ah()),this.bus.use(Rh()),this.unsub=this.bus.on(o=>this.onSignal(o))),this.bus.fire({type:"route",value:this.deps.route()}))}fireEvent(e){this.started&&this.bus.fire({type:"event",value:e})}onSignal(e){let t=this.targetingCtx();for(let r of this.variants)this.live.has(r.id)||this.pending.has(r.id)||r.triggers.some(s=>Ih(s,e))&&kh(r,t,this.freq).eligible&&this.pending.set(r.id,this.toCandidate(r));this.pending.size&&this.scheduleTick()}toCandidate(e){let t=e.surface==="coachmark"||e.surface==="tour"||e.surface==="hotspot",r=e.surface==="launcher"||e.surface==="palette";return{id:e.id,zone:Lt(e),focus:ro[e.surface],cost:so[e.surface],tier:e.priority,category:e.category,triggeredAt:this.now(),guidance:t,interactionOnly:r}}targetingCtx(){var t,r,s,i;let e=typeof window!="undefined"?!!((r=(t=window.getSelection)==null?void 0:t.call(window))!=null&&r.toString()):!1;return{route:this.deps.route(),profile:(i=(s=this.deps).profile)==null?void 0:i.call(s),now:this.now(),viewportWidth:typeof window!="undefined"?window.innerWidth:void 0,hasSelection:e}}scheduleTick(){this.tickTimer||(this.tickTimer=setTimeout(()=>{this.tickTimer=null,this.tick()},gk))}async tick(){let e=[...this.pending.values()];if(e.length===0)return;let t=[...this.live.values()].map(s=>s.occ),r=Ph(e,t,this.budget,{now:this.now()});for(let s of r){let i=this.variants.find(o=>o.id===s.id);i&&(s.action==="SHOW"||s.action==="PREEMPT"?(this.pending.delete(i.id),s.action==="PREEMPT"&&s.preempts&&this.close(s.preempts),await this.show(i)):s.action==="DROP"&&this.pending.delete(i.id))}this.pending.size&&this.scheduleTick()}async show(e){let t=this.now.bind(this),r=(i,o)=>{var c,l;let a={id:`${e.id}:${i}:${t()}`,type:i,variantId:e.id,ts:t(),props:o};this.transport.outbox.enqueue(a),(l=(c=this.deps).onEvent)==null||l.call(c,a)},s={onImpression:()=>{this.freq.recordImpression(e.id,t()),r("impression")},onView:()=>r("view"),onCtaClick:i=>r("cta_click",{action:i}),onInteraction:i=>r("interaction",{name:i}),onDismiss:i=>{this.freq.recordDismiss(e.id,t()),this.live.delete(e.id),r("dismiss",{method:i}),this.scheduleTick()}};try{let i=await Co(e,s,{host:this.host,slots:this.slots});this.live.set(e.id,{occ:{id:e.id,zone:Lt(e),focus:ro[e.surface],tier:e.priority},surface:i});let o=so[e.surface];o>0&&(this.budget.interruptionsThisSession++,this.budget.lastInterruptionAt=t(),this.budget.tokens=Math.max(0,this.budget.tokens-o),Lt(e)==="modal"&&this.budget.modalsToday++)}catch{this.pending.delete(e.id)}}close(e){let t=this.live.get(e);if(t){try{t.surface.close()}catch{}this.live.delete(e)}}stop(){var e;if(this.started){this.started=!1,this.tickTimer&&(clearTimeout(this.tickTimer),this.tickTimer=null),(e=this.unsub)==null||e.call(this),this.bus.stop();for(let t of[...this.live.keys()])this.close(t);this.pending.clear(),this.transport.outbox.flush();try{this.host.destroy()}catch{}}}}});var qh={};L(qh,{InApp2Feature:()=>La});var La,Hh=E(()=>{"use strict";La=class{constructor(){this.name="inapp2";this.active=!1}get isActive(){return this.active}async setup(e){if(typeof window=="undefined"||typeof document=="undefined"||!e.clientKey||!e.apiBaseUrl)return;this.active=!0;let{InAppEngine:t}=await Promise.resolve().then(()=>(Dh(),Fh));this.active&&(this.engine=new t({apiBaseUrl:e.apiBaseUrl,clientKey:e.clientKey,deviceId:e.deviceId,sessionId:e.sessionId,appVersion:e.appVersion,userId:()=>{var r;return(r=e.getUserId)==null?void 0:r.call(e)},route:()=>typeof location!="undefined"?location.pathname+location.search:"",config:{engine:"native"}}),this.engine.start())}fireEvent(e){var t;(t=this.engine)==null||t.fireEvent(e)}onIdentify(){var e;(e=this.engine)==null||e.onIdentify()}teardown(){var e;this.active=!1,(e=this.engine)==null||e.stop(),this.engine=void 0}}});var Wh={};L(Wh,{armSoftAsk:()=>Sk});function Uh(){try{let n=Number(localStorage.getItem(Vh)||0);return Number.isFinite(n)&&n>Date.now()}catch{return!1}}function wk(n){try{localStorage.setItem(Vh,String(Date.now()+n*864e5))}catch{}}function xk(n){return new Promise(e=>{let t=document.createElement("div");t.setAttribute("data-scalebun-softask",""),t.style.cssText="position:fixed;z-index:2147483000;inset:auto 16px 16px auto";let r=t.attachShadow({mode:"open"});r.innerHTML=`
670
+ @media(prefers-reduced-motion:reduce){.panel,.scrim{transition:none}}`}function FS(n,e,t){var G,ie,Y,X,ee;let r=(G=e.position)!=null?G:"bottom-right",s=typeof document!="undefined"&&(document.documentElement.getAttribute("dir")==="rtl"||typeof getComputedStyle!="undefined"&&getComputedStyle(document.documentElement).direction==="rtl"),i=(ie=e.rtl)!=null?ie:s,o=e.layout==="dropdown"&&Wm(e.trigger)?"dropdown":"drawer",a=e.accent,c={...Vm,...(Y=t==null?void 0:t.labels)!=null?Y:{},...(X=e.labels)!=null?X:{}},l=(ee=e.formatTime)!=null?ee:NS,u=e.theme?e.theme==="dark":typeof matchMedia!="undefined"&&matchMedia("(prefers-color-scheme: dark)").matches,d=document.createElement("div");d.setAttribute("data-scalebun-inbox","");let p=d.attachShadow({mode:"open"});Ne(p,BS(u,r,i,o,a,t==null?void 0:t.tokens)),document.body.appendChild(d);let f=Z("div","scrim"),m=Z("div","panel");m.setAttribute("role","dialog"),m.setAttribute("aria-modal","true"),m.setAttribute("aria-label",c.panelAria),m.setAttribute("aria-hidden","true"),i&&m.setAttribute("dir","rtl");let h=Z("div","hd"),g=Z("div"),S=Z("div","ti",c.title),v=Z("div","mt");g.append(S,v);let y=document.createElement("button");y.className="x",y.type="button",y.setAttribute("aria-label",c.close),y.textContent="\xD7",h.append(g,y);let b=Z("div","tabs");b.setAttribute("role","tablist"),b.style.display="none";let E=Z("div","body"),w=Z("div","live");if(w.setAttribute("role","status"),w.setAttribute("aria-live","polite"),m.append(h,b,E,w),e.onViewAll){let R=Z("div","foot"),_=document.createElement("button");_.type="button",_.textContent=c.viewAll,_.addEventListener("click",()=>{var N;J(),(N=e.onViewAll)==null||N.call(e)}),R.appendChild(_),m.appendChild(R)}p.append(f,m);let I,x,C=Wm(e.trigger);C||(I=document.createElement("button"),I.className="bell",I.type="button",I.setAttribute("aria-label",c.open),I.setAttribute("aria-expanded","false"),I.setAttribute("aria-haspopup","dialog"),typeof e.icon=="string"?I.textContent=e.icon:e.icon?I.appendChild(e.icon):I.innerHTML=OS,x=document.createElement("span"),x.className="badge",x.setAttribute("aria-hidden","true"),I.appendChild(x),p.appendChild(I));let M=C!=null?C:I,T=!1,A=null,O=!1,z=()=>{if(o!=="dropdown"||!C)return;let R=C.getBoundingClientRect(),_=m.offsetWidth||360,N=m.offsetHeight||420,F=8,W=i?R.right-_:R.left;m.style.left=`${Math.max(F,Math.min(W,window.innerWidth-_-F))}px`;let re=window.innerHeight-R.bottom;m.style.top=re>=N+F||re>=R.top?`${R.bottom+6}px`:`${Math.max(F,R.top-N-6)}px`},D=R=>{var _,N;R!==T&&(T=R,R&&z(),m.classList.toggle("open",R),f.classList.toggle("on",R),m.setAttribute("aria-hidden",R?"false":"true"),I==null||I.setAttribute("aria-expanded",String(R)),R?(A=(N=(_=p.activeElement)!=null?_:M)!=null?N:null,O=!0,n.refresh(),Ve()):A==null||A.focus())},te=()=>D(!0),J=()=>D(!1),Q=()=>D(!T),fe=()=>Q();I==null||I.addEventListener("click",fe),C==null||C.addEventListener("click",fe),y.addEventListener("click",J),f.addEventListener("click",J);let ce=R=>{if(R.key==="Escape"){R.stopPropagation(),J();return}if(R.key==="Tab"){let _=xe(),N=_[0],F=_[_.length-1];if(!N||!F)return;let W=p.activeElement;R.shiftKey&&W===N?(R.preventDefault(),F.focus()):!R.shiftKey&&W===F&&(R.preventDefault(),N.focus())}};m.addEventListener("keydown",ce);function xe(){return[...m.querySelectorAll('button, [tabindex="0"]')]}let Se=n.subscribe(R=>{let _=R.unreadCount;x&&(x.textContent=_>99?"99+":String(_),x.classList.toggle("on",_>0)),v.textContent=_>0?c.unread(_):c.noUnread,I&&I.setAttribute("aria-label",_>0?c.openUnread(_):c.open),T&&Ve()}),le=null;function q(){let R=Z("div","empty");return R.appendChild(Z("b",void 0,c.emptyTitle)),R.appendChild(document.createTextNode(c.emptyBody)),R}function V(R,_,N){let F=document.createElement("button");return F.type="button",F.innerHTML=R,F.setAttribute("aria-label",_),F.title=_,F.addEventListener("click",W=>{W.stopPropagation(),N()}),F}function K(R){var he,Ce,Ae;let _=Z("div","row"+(R.state==="unread"?" unread":""));_.setAttribute("role","listitem"),_.tabIndex=0,_.setAttribute("aria-label",`${R.title}${R.state==="unread"?", unread":""}`),_.dataset.id=R.id,_.appendChild(Z("span","dot"));let N=Z("div","ic");if(R.iconUrl){let Te=document.createElement("img");Te.src=R.iconUrl,Te.alt="",N.appendChild(Te)}else N.textContent=((Ce=(he=R.category)==null?void 0:he[0])!=null?Ce:"\u2022").toUpperCase();_.appendChild(N);let F=Z("div","rc"),W=Z("div","rtop");if(W.appendChild(Z("div","rt",R.title)),W.appendChild(Z("span","rtime",l(R.createdAt))),F.appendChild(W),R.body&&F.appendChild(Z("div","rb",R.body)),(Ae=R.cta)!=null&&Ae.length){let Te=Z("div","rcta");R.cta.slice(0,2).forEach((Je,st)=>{let ke=document.createElement("button");st>0&&(ke.className="sec"),ke.textContent=Je.label,ke.addEventListener("click",gn=>{gn.stopPropagation(),n.act(R.id,Je.key)}),Te.appendChild(ke)}),F.appendChild(Te)}_.appendChild(F);let re=Z("div","ract"),ge=V(PS,R.pinned?c.unpin:c.pin,()=>void n.pin(R.id,!R.pinned));return R.pinned&&ge.classList.add("on"),re.append(ge,V(LS,c.archive,()=>void n.archive(R.id)),V(_S,c.delete,()=>void n.remove(R.id))),_.appendChild(re),_.addEventListener("click",()=>{R.state==="unread"&&n.markRead(R.id)}),_}function de(R){var re,ge,he;let _=R.target.closest(".row");if(!_)return;let N=[...E.querySelectorAll(".row")],F=N.indexOf(_),W=_.dataset.id;R.key==="ArrowDown"?(R.preventDefault(),(re=N[Math.min(N.length-1,F+1)])==null||re.focus()):R.key==="ArrowUp"?(R.preventDefault(),(ge=N[Math.max(0,F-1)])==null||ge.focus()):R.key==="Enter"||R.key===" "?(R.preventDefault(),n.markRead(W)):R.key==="Delete"||R.key==="Backspace"?(R.preventDefault(),n.archive(W),(he=N[Math.min(N.length-1,F+1)])==null||he.focus()):R.key.toLowerCase()==="p"&&(R.preventDefault(),n.pin(W))}E.addEventListener("keydown",de);function me(R){if(R.length<2){b.style.display="none",b.textContent="";return}b.style.display="flex",b.textContent="";let _=(N,F)=>{let W=document.createElement("button");return W.className="tab"+(le===F?" on":""),W.type="button",W.textContent=N,W.setAttribute("role","tab"),W.setAttribute("aria-selected",String(le===F)),W.addEventListener("click",()=>{le=F,Ve()}),W};b.appendChild(_(c.allTab,null));for(let N of R)b.appendChild(_(N.charAt(0).toUpperCase()+N.slice(1),N))}async function se(){var he,Ce,Ae,Te,Je,st;if(!T)return;let R=await n.query({limit:200});if(!T)return;let _=(Ae=(Ce=(he=p.activeElement)==null?void 0:he.closest)==null?void 0:Ce.call(he,".row"))==null?void 0:Ae.dataset.id,N=[...new Set(R.messages.map(ke=>ke.category))].sort();me(N);let F=le?R.messages.filter(ke=>ke.category===le):R.messages,W=o==="dropdown"?Math.max(1,(Te=e.maxItems)!=null?Te:5):1/0,re=F.length>W?F.slice(0,W):F;if(E.textContent="",!re.length){E.appendChild(q()),w.textContent=c.emptyAnnounce,O&&(O=!1,y.focus());return}let ge=Z("div","list");ge.setAttribute("role","list");for(let ke of re)ge.appendChild(K(ke));E.appendChild(ge),w.textContent=`${F.length} notification${F.length===1?"":"s"}`,O?(O=!1,((Je=E.querySelector(".row"))!=null?Je:y).focus()):_&&((st=E.querySelector(`.row[data-id="${_}"]`))==null||st.focus())}let Ue=!1;function Ve(){Ue||(Ue=!0,queueMicrotask(()=>{Ue=!1,se()}))}return{open:te,close:J,destroy(){Se(),m.removeEventListener("keydown",ce),E.removeEventListener("keydown",de),C==null||C.removeEventListener("click",fe),d.remove()}}}function Wm(n){if(!n)return null;if(typeof n=="string")try{return document.querySelector(n)}catch{return null}return n}var PS,LS,_S,OS,ga=k(()=>{"use strict";$();ma();PS='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><path d="M12 17v5M9 3h6l-1 6 3 3v2H7v-2l3-3z"/></svg>',LS='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><path d="M3 7h18v3H3zM5 10v10h14V10M9 14h6"/></svg>',_S='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><path d="M4 7h16M9 7V4h6v3M6 7l1 13h10l1-13"/></svg>',OS='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"/><path d="M10.3 21a1.94 1.94 0 0 0 3.4 0"/></svg>'});var jm={};L(jm,{InboxStore:()=>pn,NOOP_STORE:()=>ba});function qS(n){return new Promise(e=>{try{if(typeof indexedDB=="undefined")return e(null);let t=indexedDB.open(DS+n,1);t.onupgradeneeded=()=>{let r=t.result;r.objectStoreNames.contains(ze)||r.createObjectStore(ze,{keyPath:"id"}),r.objectStoreNames.contains(nt)||r.createObjectStore(nt)},t.onsuccess=()=>e(t.result),t.onerror=()=>e(null)}catch{e(null)}})}var DS,ze,nt,pn,ba,ya=k(()=>{"use strict";DS="scalebun_inbox_",ze="messages",nt="meta";pn=class{constructor(e){this.scope=e;this.dbp=null}db(){return this.dbp||(this.dbp=qS(this.scope)),this.dbp}async hydrate(){let e=await this.db();return e?new Promise(t=>{try{let r=e.transaction(ze,"readonly").objectStore(ze).getAll();r.onsuccess=()=>t(Array.isArray(r.result)?r.result:[]),r.onerror=()=>t([])}catch{t([])}}):[]}put(e){return this.putMany([e])}async putMany(e){if(!e.length)return;let t=await this.db();if(t)return new Promise(r=>{try{let s=t.transaction(ze,"readwrite"),i=s.objectStore(ze);for(let o of e)i.put(o);s.oncomplete=()=>r(),s.onerror=()=>r(),s.onabort=()=>r()}catch{r()}})}async remove(e){let t=await this.db();if(t)return new Promise(r=>{try{let s=t.transaction(ze,"readwrite");s.objectStore(ze).delete(e),s.oncomplete=()=>r(),s.onerror=()=>r()}catch{r()}})}async getMeta(e){let t=await this.db();if(t)return new Promise(r=>{try{let s=t.transaction(nt,"readonly").objectStore(nt).get(e);s.onsuccess=()=>r(s.result),s.onerror=()=>r(void 0)}catch{r(void 0)}})}async setMeta(e,t){let r=await this.db();if(r)return new Promise(s=>{try{let i=r.transaction(nt,"readwrite");i.objectStore(nt).put(t,e),i.oncomplete=()=>s(),i.onerror=()=>s()}catch{s()}})}async clear(){let e=await this.db();if(e)return new Promise(t=>{try{let r=e.transaction([ze,nt],"readwrite");r.objectStore(ze).clear(),r.objectStore(nt).clear(),r.oncomplete=()=>t(),r.onerror=()=>t()}catch{t()}})}},ba={hydrate:()=>Promise.resolve([]),put:()=>Promise.resolve(),putMany:()=>Promise.resolve(),remove:()=>Promise.resolve(),getMeta:()=>Promise.resolve(void 0),setMeta:()=>Promise.resolve(),clear:()=>Promise.resolve()}});var Km={};L(Km,{InboxSync:()=>va,InboxTransport:()=>wa,mergeMessage:()=>xa,stateRank:()=>zS});function xa(n,e){var a,c,l,u,d;if(!n)return e;let t=n;if(e.revision>n.revision){let p={...n},f=e;for(let m of $S)p[m]=f[m];t=p}let r=(a=n.stateAt)!=null?a:0,s=(c=e.stateAt)!=null?c:0;n.state==="deleted"||e.state==="deleted"?t={...t,state:"deleted",stateAt:Math.max(r,s),deletedAt:(l=n.deletedAt)!=null?l:e.deletedAt}:s>=r?t={...t,state:e.state,stateAt:s,readAt:e.readAt,archivedAt:e.archivedAt}:t={...t,state:n.state,stateAt:r};let i=(u=n.pinnedAt)!=null?u:0,o=(d=e.pinnedAt)!=null?d:0;return t={...t,pinned:o>=i?e.pinned:n.pinned,pinnedAt:Math.max(i,o)||void 0},t}function zS(n){return HS[n]}var HS,$S,va,wa,Sa=k(()=>{"use strict";Cn();HS={unread:0,read:1,archived:2,deleted:3},$S=["revision","campaignId","category","priority","title","body","html","imageUrl","iconUrl","cta","createdAt","expiresAt","groupKey","data"];va=class{constructor(e){this.deps=e;this.cursor=null;this.cursorLoaded=!1;this.inflight=null}sync(){return this.inflight?this.inflight:(this.inflight=this.run().finally(()=>{this.inflight=null}),this.inflight)}async run(){var e,t,r,s,i;this.deps.onStatus("syncing");try{this.cursorLoaded||(this.cursor=(e=await this.deps.store.getMeta("cursor"))!=null?e:null,this.cursorLoaded=!0);let o=this.deps.runtime.collectDirtyOps(),a=new Map(o.map(u=>[u.id,{stateAt:u.stateAt,pinnedAt:u.pinnedAt}])),c={cursor:this.cursor,ops:o},l=await this.deps.transport.sync(c);if(!l){this.deps.onStatus(ot()?"error":"offline");return}l.theme&&((r=(t=this.deps).onTheme)==null||r.call(t,l.theme)),this.deps.runtime.applyServerDelta((s=l.messages)!=null?s:[],(i=l.tombstones)!=null?i:[],l.unreadCount),this.deps.runtime.ackDirty(a),l.cursor!==void 0&&(this.cursor=l.cursor,await this.deps.store.setMeta("cursor",l.cursor)),this.deps.onStatus("idle")}catch{this.deps.onStatus(ot()?"error":"offline")}}},wa=class{constructor(e,t,r){this.apiBaseUrl=e;this.clientKey=t;this.deviceId=r}get usable(){return!!this.clientKey&&!!this.apiBaseUrl&&typeof fetch!="undefined"}async sync(e){if(!this.usable)return null;try{let t=await fetch(`${this.apiBaseUrl}/sdk/inbox/sync`,{method:"POST",headers:{"content-type":"application/json","x-scalebun-client-key":this.clientKey},body:JSON.stringify({schemaVersion:1,deviceId:this.deviceId,...e}),keepalive:!0});return t.ok?await t.json():null}catch{return null}}}});var Ym={};L(Ym,{InboxRuntime:()=>ka});function Xm(n){return`${n.createdAt}_${n.id}`}var Gm,US,ka,Jm=k(()=>{"use strict";ma();ya();Sa();Gm={unread:0,read:1,archived:2,deleted:3},US=20;ka=class{constructor(e){this.deps=e;this.mem=new Map;this.unread=0;this.ctaSubs=new Set;this.syncStatus="idle";var t;this.store=(t=e.store)!=null?t:e.scope?new pn(e.scope):ba}async hydrate(){let e=await this.store.hydrate(),t=this.unread;for(let r of e)this.mem.has(r.id)||(this.mem.set(r.id,r),r.state==="unread"&&t++);this.unread=t,this.emitState()}getState(){let e=0;for(let t of this.mem.values())t.state!=="deleted"&&e++;return{unreadCount:this.unread,total:e,syncStatus:this.syncStatus}}emitState(){this.deps.onState(this.getState())}setSyncStatus(e){e!==this.syncStatus&&(this.syncStatus=e,this.emitState())}stamp(e){let t=this.deps.replayCoord();return t?{...e,replayCoord:t}:e}async ingest(e){var r;let t=[];for(let s of e){let i=this.mem.get(s.id);if(i){if(s.revision<=i.revision)continue;let a={...s,state:i.state,pinned:i.pinned,seenAt:i.seenAt,readAt:i.readAt,archivedAt:i.archivedAt,deletedAt:i.deletedAt};this.mem.set(s.id,a),t.push(a);continue}let o={...s,state:(r=s.state)!=null?r:"unread",pinned:!!s.pinned};this.mem.set(o.id,o),t.push(o),o.state==="unread"&&this.unread++,this.deps.trackEvent(we.received,this.stamp({messageId:o.id,campaignId:o.campaignId,category:o.category,priority:o.priority}))}t.length&&(this.emitUnreadAnd(),await this.store.putMany(t))}emitUnreadAnd(e){e!=null&&e!==this.unread&&this.deps.trackEvent(we.unreadChanged,this.stamp({unreadCount:this.unread,delta:this.unread-e})),this.emitState()}transition(e,t,r){let s=this.mem.get(e);if(!s)return;if(!(r!=null&&r.allowRegress)&&Gm[t]<=Gm[s.state])return s;let i=this.unread,o=s.state==="unread";s.state=t;let a=this.deps.now();s.stateAt=a,s._dirty=!0,t==="read"?s.readAt=a:t==="archived"?s.archivedAt=a:t==="deleted"?s.deletedAt=a:t==="unread"&&(s.readAt=void 0);let c=s.state==="unread";return o&&!c?this.unread--:!o&&c&&this.unread++,this.emitUnreadAnd(i),s}async markRead(e){let t=this.transition(e,"read");t&&(this.deps.trackEvent(we.read,this.stamp({messageId:e,category:t.category,priority:t.priority})),await this.store.put(t))}async markUnread(e){let t=this.mem.get(e);t&&t.state==="read"&&(this.transition(e,"unread",{allowRegress:!0}),await this.store.put(t))}async markReadByCampaign(e){for(let t of this.mem.values())if(t.campaignId===e&&t.state==="unread"){await this.markRead(t.id);return}}async markAllRead(e){let t=this.unread,r=[];for(let s of this.mem.values())s.state==="unread"&&(!e||s.category===e)&&(s.state="read",s.readAt=this.deps.now(),this.unread--,r.push(s));this.emitUnreadAnd(t),await this.store.putMany(r)}async archive(e){let t=this.transition(e,"archived");t&&(this.deps.trackEvent(we.archived,this.stamp({messageId:e,category:t.category})),await this.store.put(t))}async unarchive(e){let t=this.mem.get(e);t&&t.state==="archived"&&(this.transition(e,"read",{allowRegress:!0}),this.deps.trackEvent(we.unarchived,this.stamp({messageId:e,category:t.category})),await this.store.put(t))}async pin(e,t=!0){let r=this.mem.get(e);!r||r.pinned===t||(r.pinned=t,r.pinnedAt=this.deps.now(),r._dirty=!0,this.deps.trackEvent(t?we.pinned:we.unpinned,this.stamp({messageId:e,category:r.category})),this.emitState(),await this.store.put(r))}async remove(e){let t=this.mem.get(e);if(!t||t.state==="deleted")return;let r=t.state==="unread";this.transition(e,"deleted",{allowRegress:!0}),this.deps.trackEvent(we.deleted,this.stamp({messageId:e,category:t.category,wasUnread:r})),await this.store.put(t)}onCtaAction(e){return this.ctaSubs.add(e),()=>this.ctaSubs.delete(e)}act(e,t){var i;let r=this.mem.get(e),s=(i=r==null?void 0:r.cta)==null?void 0:i.find(o=>o.key===t);if(!(!r||!s)){if(this.deps.trackEvent(we.cta,this.stamp({messageId:e,ctaKey:t,action:s.action,url:s.url})),s.action==="link"&&s.url&&/^https?:\/\//i.test(s.url))try{window.open(s.url,"_blank","noopener")}catch{}else if(s.action==="deep"||s.action==="custom")for(let o of this.ctaSubs)try{o(e,s)}catch{}r.state==="unread"&&this.markRead(e)}}async get(e){let t=this.mem.get(e);return t&&t.state!=="deleted"?t:void 0}async query(e={}){var c;let t=e.state==null?null:new Set(Array.isArray(e.state)?e.state:[e.state]),r=[...this.mem.values()].filter(l=>!((t?!t.has(l.state):l.state==="deleted"||l.state==="archived")||e.category&&l.category!==e.category||e.pinned!=null&&l.pinned!==e.pinned));if(r.sort((l,u)=>l.pinned!==u.pinned?l.pinned?-1:1:e.sort==="priority"&&l.priority!==u.priority?u.priority-l.priority:u.createdAt-l.createdAt||(l.id<u.id?1:-1)),e.cursor){let l=r.findIndex(u=>Xm(u)===e.cursor);l>=0&&(r=r.slice(l+1))}let s=(c=e.limit)!=null?c:US,i=r.slice(0,s),o=r.length>s,a=i.length?i[i.length-1]:void 0;return{messages:i,cursor:a?Xm(a):null,hasMore:o}}async markSeen(e){let t=this.deps.now(),r=[];for(let s of e){let i=this.mem.get(s);i&&i.seenAt==null&&(i.seenAt=t,r.push(i),this.deps.trackEvent(we.seen,this.stamp({messageId:s,category:i.category})))}await this.store.putMany(r)}async sweepExpired(){let e=this.deps.now(),t=this.unread,r=[];for(let s of this.mem.values())if(s.expiresAt&&s.expiresAt<=e&&s.priority<3&&s.state!=="archived"&&s.state!=="deleted"){let i=s.state==="unread";s.state="archived",s.archivedAt=e,r.push(s),i&&this.unread--,this.deps.trackEvent(we.expired,this.stamp({messageId:s.id,category:s.category,wasUnread:i}))}this.emitUnreadAnd(t),await this.store.putMany(r)}recountUnread(){let e=0;for(let t of this.mem.values())t.state==="unread"&&e++;this.unread=e}collectDirtyOps(){var t;let e=[];for(let r of this.mem.values())r._dirty&&e.push({id:r.id,state:r.state,pinned:r.pinned,stateAt:(t=r.stateAt)!=null?t:0,pinnedAt:r.pinnedAt});return e}applyServerDelta(e,t,r){let s=[];for(let a of e){let c=this.mem.get(a.id),l=xa(c,a);l._dirty=c==null?void 0:c._dirty,this.mem.set(a.id,l),s.push(l),c||this.deps.trackEvent(we.received,this.stamp({messageId:l.id,campaignId:l.campaignId,category:l.category,priority:l.priority}))}let i=this.deps.now();for(let a of t){let c=this.mem.get(a);c&&c.state!=="deleted"&&(c.state="deleted",c.deletedAt=i,c.stateAt=i,s.push(c))}let o=this.unread;this.recountUnread(),typeof r=="number"&&(this.unread=r),o!==this.unread&&this.deps.trackEvent(we.unreadChanged,this.stamp({unreadCount:this.unread,delta:this.unread-o})),this.emitState(),this.store.putMany(s)}ackDirty(e){var r,s;let t=[];for(let[i,o]of e){let a=this.mem.get(i);a&&a._dirty&&((r=a.stateAt)!=null?r:0)===o.stateAt&&((s=a.pinnedAt)!=null?s:void 0)===o.pinnedAt&&(a._dirty=!1,t.push(a))}this.store.putMany(t)}dispose(){this.mem.clear(),this.ctaSubs.clear(),this.unread=0}}});var Zm={};L(Zm,{InboxFeature:()=>Ea});var Qm,Ea,eh=k(()=>{"use strict";$();Qm={unreadCount:0,total:0,syncStatus:"idle"},Ea=class{constructor(){this.name="inbox";this.ctx=null;this.active=!1;this.stateSubs=new Set;this.unreadSubs=new Set;this.pendingCta=new Set;this.lastState=Qm;this.controllerRef=null;this.pushState=e=>{let t=this.lastState.unreadCount;this.lastState=e;for(let r of this.stateSubs)try{r(e)}catch{}if(e.unreadCount!==t)for(let r of this.unreadSubs)try{r(e.unreadCount)}catch{}}}get isActive(){return this.active}setup(e){this.ctx=e,typeof window!="undefined"&&(this.active=!0,this.onVisible=()=>{document.visibilityState==="visible"&&this.triggerSync()},this.onAttention=()=>this.triggerSync(),document.addEventListener("visibilitychange",this.onVisible),window.addEventListener("focus",this.onAttention),window.addEventListener("online",this.onAttention),"serviceWorker"in navigator&&(this.onSwMessage=t=>{var s;let r=t.data;if((r==null?void 0:r.type)==="scalebun-inbox-sync"){this.refreshNow();return}if((r==null?void 0:r.type)==="scalebun-push-click"&&((s=r.data)!=null&&s.scalebunCampaignId)){let i=r.data.scalebunCampaignId;this.ensureRuntime().then(o=>o==null?void 0:o.markReadByCampaign(i))}},navigator.serviceWorker.addEventListener("message",this.onSwMessage)))}triggerSync(){this.active&&this.syncEngine&&this.syncEngine.sync()}applyTheme(e){var r;JSON.stringify(e)!==JSON.stringify((r=this.remoteTheme)!=null?r:null)&&(this.remoteTheme=e,this.widget&&Promise.resolve().then(()=>(ga(),ha)).then(({mountInbox:s})=>{var i,o;(i=this.widget)==null||i.destroy(),this.widget=s(this.controller(),(o=this.mountOpts)!=null?o:{},this.remoteTheme)}))}refreshNow(){return this.active?this.ensureRuntime().then(()=>{var e;(e=this.syncEngine)==null||e.sync()}):Promise.resolve()}ensureRuntime(){return this.runtime?Promise.resolve(this.runtime):this.ctx?this.loading?this.loading:(this.loading=(async()=>{var c,l,u,d,p,f,m;let[{InboxRuntime:e},{InboxStore:t}]=await Promise.all([Promise.resolve().then(()=>(Jm(),Ym)),Promise.resolve().then(()=>(ya(),jm))]),r=new t(((c=this.ctx)==null?void 0:c.deviceId)||"anon"),s=new e({trackEvent:(h,g)=>{var S;return(S=this.ctx)==null?void 0:S.trackEvent(h,g)},replayCoord:ne,now:P,onState:this.pushState,store:r});this.runtime=s;for(let h of this.pendingCta)s.onCtaAction(h);this.pendingCta.clear(),await s.hydrate();let{InboxSync:i,InboxTransport:o}=await Promise.resolve().then(()=>(Sa(),Km)),a=new o((u=(l=this.ctx)==null?void 0:l.apiBaseUrl)!=null?u:"",(p=(d=this.ctx)==null?void 0:d.clientKey)!=null?p:"",(m=(f=this.ctx)==null?void 0:f.deviceId)!=null?m:"anon");return this.syncEngine=new i({transport:a,store:r,runtime:s,onStatus:h=>s.setSyncStatus(h),onTheme:h=>this.applyTheme(h)}),this.syncEngine.sync(),s})(),this.loading):Promise.resolve(void 0)}call(e,...t){return this.ensureRuntime().then(r=>{var s;(s=r==null?void 0:r[e])==null||s.call(r,...t)})}controller(){return this.controllerRef?this.controllerRef:(this.controllerRef={subscribe:e=>(this.stateSubs.add(e),e(this.lastState),this.ensureRuntime(),()=>this.stateSubs.delete(e)),onUnreadChange:e=>(this.unreadSubs.add(e),e(this.lastState.unreadCount),this.ensureRuntime(),()=>this.unreadSubs.delete(e)),getState:()=>this.lastState,query:e=>this.ensureRuntime().then(t=>t?t.query(e):{messages:[],cursor:null,hasMore:!1}),get:e=>this.ensureRuntime().then(t=>t==null?void 0:t.get(e)),markRead:e=>this.call("markRead",e),markUnread:e=>this.call("markUnread",e),markAllRead:e=>this.call("markAllRead",e),archive:e=>this.call("archive",e),unarchive:e=>this.call("unarchive",e),pin:(e,t)=>this.call("pin",e,t),remove:e=>this.call("remove",e),ingest:e=>this.call("ingest",e),act:(e,t)=>{this.call("act",e,t)},mount:e=>{typeof document!="undefined"&&this.ensureRuntime().then(async()=>{var r;let{mountInbox:t}=await Promise.resolve().then(()=>(ga(),ha));(r=this.widget)==null||r.destroy(),this.mountOpts=e!=null?e:{},this.widget=t(this.controller(),this.mountOpts,this.remoteTheme)})},open:()=>{var e;return(e=this.widget)==null?void 0:e.open()},close:()=>{var e;return(e=this.widget)==null?void 0:e.close()},unmount:()=>{var e;(e=this.widget)==null||e.destroy(),this.widget=void 0},onCtaAction:e=>this.runtime?this.runtime.onCtaAction(e):(this.pendingCta.add(e),this.ensureRuntime(),()=>{this.pendingCta.delete(e)}),refresh:()=>this.ensureRuntime().then(()=>{var e;return(e=this.syncEngine)==null?void 0:e.sync()})},this.controllerRef)}teardown(){var e,t;typeof window!="undefined"&&(this.onVisible&&document.removeEventListener("visibilitychange",this.onVisible),this.onAttention&&(window.removeEventListener("focus",this.onAttention),window.removeEventListener("online",this.onAttention)),this.onSwMessage&&"serviceWorker"in navigator&&navigator.serviceWorker.removeEventListener("message",this.onSwMessage)),this.onVisible=void 0,this.onAttention=void 0,this.onSwMessage=void 0,(e=this.widget)==null||e.destroy(),this.widget=void 0,(t=this.runtime)==null||t.dispose(),this.runtime=void 0,this.syncEngine=void 0,this.loading=void 0,this.stateSubs.clear(),this.unreadSubs.clear(),this.pendingCta.clear(),this.lastState=Qm,this.active=!1}}});var th={};L(th,{ProfilerFeature:()=>Ia});function VS(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}var Ia,nh=k(()=>{"use strict";$();Ia=class{constructor(){this.name="profiler";this.ctx=null;this.active=!1;this.startedAt=0}get isActive(){return this.active}setup(e){this.ctx=e,this.active=!0}available(){return typeof window!="undefined"&&typeof window.Profiler=="function"}start(e=10){if(!this.active||this.profiler||!this.available())return!1;try{let t=window.Profiler;return this.profiler=new t({sampleInterval:e,maxBufferSize:1e4}),this.startedAt=P(),!0}catch{return this.profiler=void 0,!1}}async stop(){var t;if(!this.profiler)return!1;let e=this.profiler;this.profiler=void 0;try{let r=await e.stop(),s=Math.round(P()-this.startedAt);return(t=this.ctx)==null||t.emit({kind:"performance",metric:"js_profile",value:Array.isArray(r.samples)?r.samples.length:0,duration:s,screenName:VS(),metadata:{profile:r,format:"w3c-js-self-profiling"},clientId:`prof_${H()}`,timestamp:P()}),!0}catch{return!1}}teardown(){if(this.profiler){try{this.profiler.stop()}catch{}this.profiler=void 0}this.active=!1}}});function Ca(){return typeof window!="undefined"&&typeof window.Profiler=="function"}async function rh(n,e=10){if(!Ca())return null;try{let t=window.Profiler,r=new t({sampleInterval:e,maxBufferSize:1e4});await new Promise(o=>setTimeout(o,n));let s=await r.stop(),i=Array.isArray(s==null?void 0:s.samples)?s.samples.length:0;return{profile:s,samples:i}}catch{return null}}var sh=k(()=>{"use strict"});function ch(n){return n?{...ih,...n}:ih}var ih,oh,ah,Aa=k(()=>{"use strict";ih={pressureSustainMs:6e3,lagP95Ms:500,mainThreadStallMs:500,jankBurstCount:5,jankWindowMs:1e4,frozenFrameMs:700,memSurgeBytesPerSec:6291456,leakSamples:10,leakMinBytes:52428800,heapUsedRatio:.9,cooldownMs:6e4},oh=10*6e4,ah=10});function WS(n){if(!n.length)return 0;let e=Math.min(n.length-1,Math.floor(n.length*.95));return n[e]}var Es,ks,lh=k(()=>{"use strict";Aa();Es=class Es{constructor(e){this.lag=[];this.pressure="nominal";this.pressureSince=0;this.jankAt=[];this.highSlopeStreak=0;this.memTrend=[];this.lastEmit=new Map;this.emitTimes=[];this.droppedCount=0;this.deps=e,this.th=e.thresholds}get dropped(){return this.droppedCount}onHeartbeat(e){this.lag.push(e),this.lag.length>Es.LAG_RING&&this.lag.shift(),e>=this.th.mainThreadStallMs&&this.emit({type:"main_thread_stall",severity:e>=2e3?"critical":"warning",confidence:"high",tier:"lag-proxy",value:Math.round(e),likelyCause:"main thread blocked",description:`The main thread was blocked for ${Math.round(e)} ms.`}),this.evaluateCpu()}onPressure(e){e!==this.pressure&&(this.pressure=e,this.pressureSince=this.deps.now(),this.evaluateCpu())}onJank(e){var s,i;let t=this.deps.now();e.frameDurationMs>=this.th.frozenFrameMs&&this.emit({type:"frozen_frame",severity:e.frameDurationMs>=2e3?"critical":"warning",confidence:"high",tier:e.metric,value:Math.round(e.frameDurationMs),script:e.script,likelyCause:(s=e.script)!=null&&s.url?`long frame in ${e.script.url}`:"long animation frame",description:`A single frame took ${Math.round(e.frameDurationMs)} ms.`}),this.jankAt.push(t);let r=t-this.th.jankWindowMs;for(;this.jankAt.length&&this.jankAt[0]<r;)this.jankAt.shift();this.jankAt.length>=this.th.jankBurstCount&&this.emit({type:"jank_burst",severity:"warning",confidence:"medium",tier:e.metric,value:this.jankAt.length,script:e.script,likelyCause:(i=e.script)!=null&&i.url?`repeated jank in ${e.script.url}`:"repeated main-thread jank",description:`${this.jankAt.length} janky frames within ${Math.round(this.th.jankWindowMs/1e3)} s.`})}onMemory(e,t){let r=this.deps.now();if(t>0&&e/t>=this.th.heapUsedRatio&&this.emit({type:"low_memory_pressure",severity:"critical",confidence:"high",tier:"memory",value:Math.round(e/t*100),likelyCause:"JS heap near its limit",description:`Used heap is ${Math.round(e/t*100)}% of the limit.`}),this.prevMem){let s=(r-this.prevMem.at)/1e3,i=s>0?(e-this.prevMem.used)/s:0;i>this.th.memSurgeBytesPerSec?(this.highSlopeStreak++,this.highSlopeStreak>=2&&this.emit({type:"memory_surge",severity:i>2*this.th.memSurgeBytesPerSec?"critical":"warning",confidence:"medium",tier:"memory",value:Math.round(i),likelyCause:"rapid heap allocation",description:`Heap grew ~${Math.round(i/(1024*1024))} MiB/s.`})):this.highSlopeStreak=0}if(this.prevMem={used:e,at:r},this.memTrend.push(e),this.memTrend.length>this.th.leakSamples&&this.memTrend.shift(),this.memTrend.length===this.th.leakSamples){let s=!0;for(let o=1;o<this.memTrend.length;o++)if(this.memTrend[o]<this.memTrend[o-1]){s=!1;break}let i=this.memTrend[this.memTrend.length-1]-this.memTrend[0];s&&i>=this.th.leakMinBytes&&this.emit({type:"memory_leak_suspicion",severity:"warning",confidence:"low",tier:"memory",value:Math.round(i),likelyCause:"monotonic heap growth",description:`Heap grew ~${Math.round(i/(1024*1024))} MiB over ${this.memTrend.length} samples without release.`})}}evaluateCpu(){if(this.deps.pressureAvailable){this.pressure==="critical"&&this.deps.now()-this.pressureSince>=this.th.pressureSustainMs&&this.emit({type:"cpu_spike",severity:"critical",confidence:"high",tier:"pressure",likelyCause:"sustained CPU pressure",description:`CPU stayed under critical pressure for ${Math.round(this.th.pressureSustainMs/1e3)}s+.`});return}if(this.lag.length<6)return;let e=WS([...this.lag].sort((t,r)=>t-r));e>this.th.lagP95Ms&&this.emit({type:"cpu_spike",severity:e>2*this.th.lagP95Ms?"critical":"warning",confidence:"medium",tier:"lag-proxy",value:Math.round(e),likelyCause:"sustained event-loop lag",description:`Event-loop lag p95 was ${Math.round(e)} ms.`})}emit(e){var r;let t=this.deps.now();if(!(t-((r=this.lastEmit.get(e.type))!=null?r:-1/0)<this.th.cooldownMs)){if(this.emitTimes=this.emitTimes.filter(s=>t-s<oh),this.emitTimes.length>=ah){this.droppedCount++;return}this.lastEmit.set(e.type,t),this.emitTimes.push(t),this.deps.onIncident({...e,startTs:t})}}};Es.LAG_RING=32;ks=Es});function dh(n,e){return n.length?n[Math.min(n.length-1,Math.floor(n.length*e))]:0}var Is,uh=k(()=>{"use strict";$();Is=class{constructor(){this.lags=[];this.pressureCounts={nominal:0,fair:0,serious:0,critical:0};this.sawPressure=!1;this.memFirstAt=0;this.memLastAt=0;this.incidents=0}onHeartbeat(e){this.lags.push(e)}onPressure(e){this.pressureCounts[e]++,this.sawPressure=!0}onMemory(e){let t=P();this.memFirst==null&&(this.memFirst=e,this.memFirstAt=t),this.memLast=e,this.memLastAt=t}noteIncident(){this.incidents++}drain(e,t){let r=[...this.lags].sort((i,o)=>i-o),s={lagP50:Math.round(dh(r,.5)),lagP95:Math.round(dh(r,.95)),lagMax:r.length?Math.round(r[r.length-1]):0,heartbeats:this.lags.length,incidents:this.incidents,droppedIncidents:t,tiers:e};if(this.sawPressure&&(s.pressure={...this.pressureCounts}),this.memLast!=null&&this.memFirst!=null){let i=(this.memLastAt-this.memFirstAt)/1e3;s.heap={firstBytes:this.memFirst,lastBytes:this.memLast,slopeBytesPerSec:i>0?Math.round((this.memLast-this.memFirst)/i):0}}return this.lags=[],this.pressureCounts={nominal:0,fair:0,serious:0,critical:0},this.sawPressure=!1,this.incidents=0,this.memLast!=null&&(this.memFirst=this.memLast,this.memFirstAt=P()),s}}});function ph(){try{return typeof document=="undefined"||document.visibilityState!=="hidden"}catch{return!0}}function fh(n,e){var d;let t=[],r=P(),s,i=()=>{let p=P(),f=p-r-e.heartbeatMs;r=p,f>=0&&n.onHeartbeat(f),s=setTimeout(i,e.heartbeatMs)},o=()=>{r=P(),s=setTimeout(i,e.heartbeatMs)},a=()=>{s&&clearTimeout(s),s=void 0},c=()=>{ph()?s||o():a()};typeof document!="undefined"&&(document.addEventListener("visibilitychange",c),t.push(()=>document.removeEventListener("visibilitychange",c))),ph()&&o(),t.push(a);let l=!1;try{let p=globalThis.PressureObserver;if(typeof p=="function"){l=!0;let f=new p(m=>{let h=m[m.length-1];h!=null&&h.state&&n.onPressure(h.state)});f.observe("cpu",{sampleInterval:2e3}).catch(()=>{}),t.push(()=>{try{f.disconnect()}catch{}})}}catch{l=!1}let u=typeof performance!="undefined"&&typeof((d=performance.memory)==null?void 0:d.usedJSHeapSize)=="number";if(u){let p=()=>{var h;let m=performance.memory;m&&typeof m.usedJSHeapSize=="number"&&n.onMemory(m.usedJSHeapSize,(h=m.jsHeapSizeLimit)!=null?h:0)};p();let f=setInterval(p,e.memorySampleMs);t.push(()=>clearInterval(f))}return{stop:()=>{for(let p of t)try{p()}catch{}},pressureAvailable:l,memoryAvailable:u}}var mh=k(()=>{"use strict";$()});var hh={};L(hh,{startWatchdog:()=>JS});function KS(n,e){let t=e!=null?e:1;return t>=1?!0:t<=0?!1:Ee(`${n!=null?n:""}:wzb-watchdog-v1`)%100<t*100}function GS(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}function JS(n){var S,v,y,b;let e=(S=n.watchdogOptions)!=null?S:{};if(!KS(n.sessionId,e.sampleRate))return jS;let t=(E,w,I,x)=>{let C=ne();n.emit({kind:"performance",metric:E,value:w,screenName:GS(),metadata:C?{...I,replay:C}:I,clientId:x!=null?x:`wd_${H()}`,timestamp:P()})},r=e.captureProfileOnIncident!==!1,s=!1,i=0,o=E=>{if(!r||s||!Ca())return;let w=P();w-i<YS||(i=w,s=!0,rh(XS).then(I=>{I&&t("js_profile",I.samples,{profile:I.profile,format:"w3c-js-self-profiling",incidentClientId:E})}).finally(()=>{s=!1}))},a=ch(e.thresholds),c=new Is,l=0,u=0,d=typeof globalThis.PressureObserver=="function",p=new ks({thresholds:a,now:P,pressureAvailable:d,onIncident:E=>{var I;l++,c.noteIncident();let w=`wd_${H()}`;t("resource_incident",(I=E.value)!=null?I:1,E,w),n.signal("resource_pressure"),o(w)}}),f=wd(E=>p.onJank(E)),m=fh({onHeartbeat:E=>{p.onHeartbeat(E),c.onHeartbeat(E)},onPressure:E=>{p.onPressure(E),c.onPressure(E)},onMemory:(E,w)=>{p.onMemory(E,w),c.onMemory(E)}},{heartbeatMs:Math.max(250,(v=e.heartbeatMs)!=null?v:1e3),memorySampleMs:(y=e.memorySampleMs)!=null?y:2e4}),h=()=>({pressure:d,memory:m.memoryAvailable}),g=setInterval(()=>{u++;let E=c.drain(h(),p.dropped);t("resource_health",E.lagP95,E)},(b=e.rollupMs)!=null?b:3e4);return{stop:()=>{clearInterval(g),f(),m.stop()},stats:()=>({incidents:l,droppedIncidents:p.dropped,rollups:u,tiers:h()})}}var jS,XS,YS,gh=k(()=>{"use strict";$();Fe();Ei();sh();lh();uh();mh();Aa();jS={stop:()=>{},stats:()=>({incidents:0,droppedIncidents:0,rollups:0,tiers:{pressure:!1,memory:!1}})};XS=1e4,YS=6e4});var bh={};L(bh,{WatchdogFeature:()=>Ta});var QS,Ta,yh=k(()=>{"use strict";QS={incidents:0,droppedIncidents:0,rollups:0,tiers:{pressure:!1,memory:!1}},Ta=class{constructor(){this.name="watchdog";this.active=!1}get isActive(){return this.active}async setup(e){if(typeof window=="undefined"||typeof performance=="undefined")return;this.active=!0;let{startWatchdog:t}=await Promise.resolve().then(()=>(gh(),hh));this.active&&(this.handle=t(e))}stats(){var e,t;return(t=(e=this.handle)==null?void 0:e.stats())!=null?t:QS}teardown(){var e;this.active=!1,(e=this.handle)==null||e.stop(),this.handle=void 0}}});function ZS(n){if(!n)return[];try{let e=JSON.parse(n);return Array.isArray(e)?e:[]}catch{return[]}}function ek(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}var vh,Ra,Cs,wh=k(()=>{"use strict";vh="scalebun_inapp_outbox";Ra=class{constructor(e,t=ek()){this.post=e;this.storage=t;this.queue=[];this.flushing=!1;this.timer=null;var r,s;this.queue=ZS((s=(r=this.storage)==null?void 0:r.getItem(vh))!=null?s:null)}enqueue(e){this.queue.some(t=>t.id===e.id)||(this.queue.push(e),this.queue.length>200&&this.queue.splice(0,this.queue.length-200),this.persist(),this.schedule())}get size(){return this.queue.length}schedule(){this.timer||this.flushing||(this.timer=setTimeout(()=>{this.timer=null,this.flush()},800))}async flush(){if(!(this.flushing||this.queue.length===0)){this.flushing=!0;try{for(;this.queue.length>0;){let e=this.queue.slice(0,50);if(!await this.post(e))break;let r=new Set(e.map(s=>s.id));this.queue=this.queue.filter(s=>!r.has(s.id)),this.persist()}}finally{this.flushing=!1,this.queue.length>0&&this.schedule()}}}persist(){var e;try{(e=this.storage)==null||e.setItem(vh,JSON.stringify(this.queue))}catch{}}};Cs=class{constructor(e,t){this.apiBaseUrl=e;this.clientKey=t;this.outbox=new Ra(r=>this.postEvents(r))}get usable(){return!!this.clientKey&&!!this.apiBaseUrl&&typeof fetch!="undefined"}headers(){return{"content-type":"application/json","x-scalebun-client-key":this.clientKey}}async fetchConfig(e){if(!this.usable)return null;let t=new URLSearchParams;for(let[r,s]of Object.entries(e))s&&t.set(r,String(s));try{let r=await fetch(`${this.apiBaseUrl}/sdk/engage/config?${t.toString()}`,{headers:this.headers(),cache:"no-store"});return r.ok?await r.json():null}catch{return null}}async postEvents(e){if(!this.usable||e.length===0)return!1;try{return(await fetch(`${this.apiBaseUrl}/sdk/engage/events`,{method:"POST",headers:this.headers(),body:JSON.stringify({schemaVersion:1,source:"inapp",events:e}),keepalive:!0})).ok}catch{return!1}}}});function tk(n){let e="";for(let t=0;t<n.length;t++){let r=n[t];r==="*"?n[t+1]==="*"?(e+=".*",t++):e+="[^/]*":"\\^$.|?+()[]{}".includes(r)?e+="\\"+r:e+=r}return new RegExp("^"+e+"$")}function Ma(n,e){return!n||n.length===0?!0:n.some(t=>tk(t).test(e))}function nk(n,e){var r;if(!n)return!0;let t=(r=e.queryElement)!=null?r:s=>typeof document!="undefined"?!!document.querySelector(s):!1;try{return t(n)}catch{return!1}}function sk(n){let e=n==null?void 0:n.segments;return e?e instanceof Set?e:new Set(e):new Set}function ik(n,e){var r;let t=n.trim();if(!t)return!0;if(t.startsWith("segment:"))return sk(e).has(t.slice(8).trim());for(let s of rk){let i=t.indexOf(s);if(i>0){let o=t.slice(0,i).trim(),a=t.slice(i+s.length).trim(),c=(r=e==null?void 0:e.attrs)==null?void 0:r[o];if(c===void 0)return!1;let l=Number(c),u=Number(a),d=!Number.isNaN(l)&&!Number.isNaN(u)&&a!=="";switch(s){case"=":return String(c)===a;case"!=":return String(c)!==a;case">":return d&&l>u;case"<":return d&&l<u;case">=":return d&&l>=u;case"<=":return d&&l<=u}}}return!1}function ok(n,e){return!n||!n.trim()?!0:n.split("&&").every(t=>ik(t,e))}function kh(n,e,t){var s,i;let r=(s=n.targeting)!=null?s:{};return Ma(r.route,e.route)?nk(r.element,e)?r.minViewport!=null&&((i=e.viewportWidth)!=null?i:1/0)<r.minViewport?{eligible:!1,reason:"viewport"}:r.selection&&!e.hasSelection?{eligible:!1,reason:"selection"}:ok(r.audience,e.profile)?t.canShow(n,e.now)?{eligible:!0}:{eligible:!1,reason:"frequency"}:{eligible:!1,reason:"audience"}:{eligible:!1,reason:"element"}:{eligible:!1,reason:"route"}}function ck(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}function lk(){try{return typeof sessionStorage!="undefined"?sessionStorage:null}catch{return null}}var rk,xh,Sh,ak,As,Pa=k(()=>{"use strict";ss();rk=[">=","<=","!=","=",">","<"];xh="scalebun_inapp_freq",Sh="scalebun_inapp_freq_session",ak=1,As=class{constructor(e=ck(),t="",r=lk()){this.storage=e;this.sessionId=t;this.sessionStore=r;this.map=this.load(),this.session=this.loadSession()}loadSession(){var e;try{let t=(e=this.sessionStore)==null?void 0:e.getItem(Sh),r=t?JSON.parse(t):null;if(r&&r.sid===this.sessionId&&r.recs)return{sid:this.sessionId,recs:r.recs}}catch{}return{sid:this.sessionId,recs:{}}}saveSession(){var e;try{(e=this.sessionStore)==null||e.setItem(Sh,JSON.stringify(this.session))}catch{}}load(){var e;try{let t=(e=this.storage)==null?void 0:e.getItem(xh);return t?JSON.parse(t):{}}catch{return{}}}save(){var e;try{(e=this.storage)==null||e.setItem(xh,JSON.stringify(this.map))}catch{}}canShow(e,t){var a,c,l;let r=e.frequency,s=this.map[e.id],i=this.session.recs[e.id];if(s!=null&&s.dismissed&&((a=e.dismiss)!=null&&a.persistDismiss||i!=null&&i.dismissed))return!1;let o=(c=r==null?void 0:r.maxImpressionsPerSession)!=null?c:r?0:ak;return o>0&&((l=i==null?void 0:i.n)!=null?l:0)>=o?!1:s?!(r!=null&&r.showOnce&&s.count>0||(r==null?void 0:r.maxImpressions)!=null&&s.count>=r.maxImpressions||(r==null?void 0:r.cooldown)!=null&&t-s.lastShown<r.cooldown):!0}recordImpression(e,t){var i,o;let r=(i=this.map[e])!=null?i:{count:0,lastShown:0};r.count+=1,r.lastShown=t,this.map[e]=r,this.save();let s=(o=this.session.recs[e])!=null?o:{n:0};s.n+=1,this.session.recs[e]=s,this.saveSession()}recordDismiss(e,t){var i,o;let r=(i=this.map[e])!=null?i:{count:0,lastShown:0};r.dismissed=!0,r.lastShown=t,this.map[e]=r,this.save();let s=(o=this.session.recs[e])!=null?o:{n:0};s.dismissed=!0,this.session.recs[e]=s,this.saveSession()}clear(){this.map={},this.save(),this.session={sid:this.sessionId,recs:{}},this.saveSession()}}});var Eh=k(()=>{"use strict"});function Ih(n,e){var t,r,s;if(n.type!==e.type)return!1;switch(n.type){case"route":return Ma(n.match?[n.match]:void 0,(t=e.value)!=null?t:"");case"event":return n.match==null||n.match===e.value;case"idle":return((r=e.arg)!=null?r:0)>=((s=n.arg)!=null?s:0);case"element":case"hover":case"selection":case"keyboard":case"right-click":return n.match==null||n.match===e.value;default:return!0}}function Ch(){let n=null,e=null,t=()=>typeof location!="undefined"?location.pathname+location.search:"";return{type:"route",start(r){if(typeof window=="undefined"||typeof history=="undefined")return;let s=()=>r.fire({type:"route",value:t()}),i=history.pushState,o=history.replaceState;history.pushState=function(...a){let c=i.apply(this,a);return s(),c},history.replaceState=function(...a){let c=o.apply(this,a);return s(),c},e=s,window.addEventListener("popstate",s),window.addEventListener("hashchange",s),n=()=>{history.pushState=i,history.replaceState=o},s()},stop(){n==null||n(),n=null,e&&typeof window!="undefined"&&(window.removeEventListener("popstate",e),window.removeEventListener("hashchange",e)),e=null}}}function Ah(){let n=null;return{type:"event",start(e){n=e},stop(){n=null},fireEvent(e){n==null||n.fire({type:"event",value:e})}}}function Th(){let n=null,e=[],t=[],r=null,s=["mousemove","mousedown","keydown","scroll","touchstart","pointerdown"],i=()=>{for(let a of t)clearTimeout(a);t=[]},o=()=>{if(i(),!!n)for(let a of e)a>0&&t.push(setTimeout(()=>n==null?void 0:n.fire({type:"idle",arg:a}),a))};return{type:"idle",start(a){if(n=a,typeof window!="undefined"){r=o;for(let c of s)window.addEventListener(c,r,{passive:!0});o()}},stop(){if(i(),r&&typeof window!="undefined")for(let a of s)window.removeEventListener(a,r);r=null,n=null},setThresholds(a){e=Array.from(new Set(a.filter(c=>c>0))),o()}}}var Ts,Rh=k(()=>{"use strict";Pa();Eh();Ts=class{constructor(e=()=>Date.now()){this.listeners=new Set;this.plugins=[];this.now=e}on(e){return this.listeners.add(e),()=>this.listeners.delete(e)}fire(e){var r;let t={...e,at:(r=e.at)!=null?r:this.now()};for(let s of this.listeners)try{s(t)}catch{}}use(e){this.plugins.push(e),e.start(this)}stop(){for(let e of this.plugins)e.stop();this.plugins=[],this.listeners.clear()}}});function pk(n,e){var r,s;let t=Math.max(0,Math.min(120,120-(e-n.triggeredAt)/1e3));return dk[n.tier]+((r=n.campaignPriority)!=null?r:0)+t+((s=uk[n.category])!=null?s:0)}function Ph(n,e,t,r){var y;let s=r.now,i=n.map(b=>({c:b,score:pk(b,s)})).sort((b,E)=>E.score-b.score||b.c.id.localeCompare(E.c.id)),o=[],a=(b,E,w,I,x)=>o.push({id:b.id,action:E,reason:w,zone:b.zone,score:I,preempts:x}),c=new Map,l=new Map,u=e.filter(b=>b.zone==="toast").length,d=0,p=e.some(b=>Rs(b.zone)),f=!1,m=e.some(b=>b.tier==="critical")||!1,h=t.tokens,g=t.interruptionsThisSession,S=t.modalsToday,v=t.lastInterruptionAt;for(let{c:b,score:E}of i){if(b.campaignId){if(c.has(b.campaignId)){a(b,"DROP","dedupe:campaign",E);continue}c.set(b.campaignId,E)}let w=(y=r.guard)==null?void 0:y.call(r,b);if(w){a(b,w.action,w.reason,E);continue}if(b.interactionOnly){a(b,"DEFER","interaction-only",E);continue}if(b.guidance&&m){a(b,"DEFER","defer-until-clear",E);continue}if((b.zone==="toast"?3:1)===1&&l.has(b.zone)){a(b,b.cost>0?"QUEUE":"DROP",b.cost>0?"queue:zone-busy":"zone-lost",E);continue}if(Rs(b.zone)&&p){a(b,"QUEUE","queue:focus-busy",E);continue}if(b.zone==="toast"&&u+d>=3){a(b,"QUEUE","queue:toast-cap",E);continue}if(b.cost>0){if(g>=t.maxInterruptionsPerSession){a(b,"QUEUE","queue:budget:interruptions",E);continue}if(b.zone==="modal"&&S>=t.maxModalsPerDay){a(b,"QUEUE","queue:budget:modals",E);continue}if(f||s-v<t.minCooldownMs){a(b,"QUEUE","queue:cooldown",E);continue}if(h<b.cost){a(b,"QUEUE","queue:budget:tokens",E);continue}}let x;if(b.tier==="critical"){let C=e.find(M=>M.zone===b.zone&&!Rs(M.zone)&&Mh[M.tier]<Mh.critical);C&&(x=C.id)}a(b,x?"PREEMPT":"SHOW",x?"preempt:critical":"show",E,x),l.set(b.zone,b.id),b.zone==="toast"&&d++,Rs(b.zone)&&(p=!0),b.tier==="critical"&&(m=!0),b.cost>0&&(h-=b.cost,g++,b.zone==="modal"&&S++,f=!0,v=s)}return o}var dk,uk,Mh,Rs,Lh=k(()=>{"use strict";dk={critical:1e3,high:400,normal:200,low:100,passive:50},uk={security:300,system:250,billing:200},Mh={critical:4,high:3,normal:2,low:1,passive:0};Rs=n=>n==="modal"||n==="takeover"});function fk(n,e={}){switch(n){case"modal":return{surface:"modal",surfaceOptions:{placement:"center",size:"md",backdrop:!0}};case"fullscreen":return{surface:"takeover",surfaceOptions:{size:"full"}};case"bottom_sheet":return{surface:"slideover",surfaceOptions:{placement:"bottom"}};case"top_banner":return{surface:"banner",surfaceOptions:{placement:"top"}};case"bottom_banner":return{surface:"banner",surfaceOptions:{placement:"bottom"}};case"toast":return{surface:"toast",surfaceOptions:{placement:"bottom-right"}};case"tooltip":return e.anchorSelector?{surface:"popover",surfaceOptions:{placement:"bottom",maxWidth:320}}:{surface:"toast",surfaceOptions:{placement:"bottom-right"}};default:return{surface:"modal",surfaceOptions:{placement:"center",backdrop:!0}}}}function mk(n){var s,i;let e=n.spec,t=[];e.imageUrl&&t.push({kind:"image",props:{src:e.imageUrl,alt:(s=e.title)!=null?s:""}}),e.title&&t.push({kind:"heading",props:{text:e.title}}),e.body&&t.push({kind:"text",props:{text:e.body}});let r=[];return e.cta&&r.push({label:e.cta.label,variant:"primary",action:e.cta.action,deepLink:e.cta.deepLink}),e.secondaryCta&&r.push({label:e.secondaryCta.label,variant:"secondary",action:e.secondaryCta.action}),r.length&&t.push({kind:"cta",props:{actions:r}}),t.length===0&&t.push({kind:"text",props:{text:(i=e.body)!=null?i:""}}),t}function hk(n){var t,r,s,i;if(n.preview)return[{type:"manual"}];let e=(r=n.targetScreen)!=null?r:(t=n.triggerConfig)==null?void 0:t.screen;return e?[{type:"route",match:e}]:(s=n.triggerConfig)!=null&&s.event?[{type:"event",match:n.triggerConfig.event}]:(i=n.triggerConfig)!=null&&i.seconds?[{type:"idle",arg:n.triggerConfig.seconds*1e3}]:[{type:"manual"}]}function gk(n){let e=n.throttle;if(!e)return;let t={};return e.showOnce&&(t.showOnce=!0),e.maxImpressions!=null&&(t.maxImpressions=e.maxImpressions),e.cooldownHours!=null&&(t.cooldown=e.cooldownHours*36e5),Object.keys(t).length?t:void 0}function bk(n,e={}){var o,a,c;let{surface:t,surfaceOptions:r}=fk(n.layout,e),s=t==="popover",i=(a=n.targetScreen)!=null?a:(o=n.triggerConfig)==null?void 0:o.screen;return{id:n.id,key:`legacy.${n.layout}.${n.id}`,name:(c=n.spec.title)!=null?c:`Legacy ${n.layout}`,category:"misc",platforms:["web"],surface:t,surfaceOptions:r,blocks:mk(n),priority:n.layout==="fullscreen"?"high":"normal",triggers:hk(n),targeting:{...i?{route:[i]}:{},...s&&e.anchorSelector?{element:e.anchorSelector}:{}},frequency:gk(n),dismiss:{xButton:!0,escClose:!0,backdropClose:n.layout==="modal"},motion:{reducedMotionFallback:"fade"},contract:{payloadVersion:1}}}function _h(n,e={}){return(n!=null?n:[]).map(t=>bk(t,e))}var Oh=k(()=>{"use strict"});function yk(n){var e;return(e=n==null?void 0:n.engine)!=null?e:"compat"}function Nh(n){var r;let e=yk(n.config);if(e==="legacy")return[];let t=[];return(e==="native"||e==="compat")&&t.push(...(r=n.nativeVariants)!=null?r:[]),e==="compat"&&t.push(..._h(n.legacyMessages)),t.filter(Fu)}var Bh=k(()=>{"use strict";Oh();qr()});var Fh={};L(Fh,{InAppEngine:()=>La});var vk,La,Dh=k(()=>{"use strict";wh();Rh();Pa();Lh();Bh();os();to();To();qr();Ni();vk=120,La=class{constructor(e){this.deps=e;this.host=new ln;this.slots=new Mt;this.variants=[];this.pending=new Map;this.live=new Map;this.tickTimer=null;this.started=!1;var t;this.now=(t=e.now)!=null?t:()=>Date.now(),this.freq=new As(void 0,e.sessionId),this.transport=new Cs(e.apiBaseUrl,e.clientKey),this.bus=new Ts(this.now),this.budget={tokens:5,interruptionsThisSession:0,maxInterruptionsPerSession:5,modalsToday:0,maxModalsPerDay:3,lastInterruptionAt:0,minCooldownMs:3e4}}async start(){this.started||(this.started=!0,await this.load())}async onIdentify(){this.started&&await this.load()}async load(){var s,i;let e;try{e=await this.transport.fetchConfig({platform:"web",appVersion:this.deps.appVersion,deviceId:this.deps.deviceId,endUserId:(i=(s=this.deps).userId)==null?void 0:i.call(s),route:this.deps.route()})}catch{return}if(!this.started)return;let t=Oi(e),r=e==null?void 0:e.variants;this.variants=Nh({legacyMessages:t.inAppMessages,nativeVariants:r,config:this.deps.config}),this.variants.length!==0&&(this.unsub||(this.host.ensure(),this.bus.use(Ch()),this.bus.use(Ah()),this.bus.use(Th()),this.unsub=this.bus.on(o=>this.onSignal(o))),this.bus.fire({type:"route",value:this.deps.route()}))}fireEvent(e){this.started&&this.bus.fire({type:"event",value:e})}onSignal(e){let t=this.targetingCtx();for(let r of this.variants)this.live.has(r.id)||this.pending.has(r.id)||r.triggers.some(s=>Ih(s,e))&&kh(r,t,this.freq).eligible&&this.pending.set(r.id,this.toCandidate(r));this.pending.size&&this.scheduleTick()}toCandidate(e){let t=e.surface==="coachmark"||e.surface==="tour"||e.surface==="hotspot",r=e.surface==="launcher"||e.surface==="palette";return{id:e.id,zone:Lt(e),focus:so[e.surface],cost:io[e.surface],tier:e.priority,category:e.category,triggeredAt:this.now(),guidance:t,interactionOnly:r}}targetingCtx(){var t,r,s,i;let e=typeof window!="undefined"?!!((r=(t=window.getSelection)==null?void 0:t.call(window))!=null&&r.toString()):!1;return{route:this.deps.route(),profile:(i=(s=this.deps).profile)==null?void 0:i.call(s),now:this.now(),viewportWidth:typeof window!="undefined"?window.innerWidth:void 0,hasSelection:e}}scheduleTick(){this.tickTimer||(this.tickTimer=setTimeout(()=>{this.tickTimer=null,this.tick()},vk))}async tick(){let e=[...this.pending.values()];if(e.length===0)return;let t=[...this.live.values()].map(s=>s.occ),r=Ph(e,t,this.budget,{now:this.now()});for(let s of r){let i=this.variants.find(o=>o.id===s.id);i&&(s.action==="SHOW"||s.action==="PREEMPT"?(this.pending.delete(i.id),s.action==="PREEMPT"&&s.preempts&&this.close(s.preempts),await this.show(i)):s.action==="DROP"&&this.pending.delete(i.id))}this.pending.size&&this.scheduleTick()}async show(e){let t=this.now.bind(this),r=(i,o)=>{var c,l;let a={id:`${e.id}:${i}:${t()}`,type:i,variantId:e.id,ts:t(),props:o};this.transport.outbox.enqueue(a),(l=(c=this.deps).onEvent)==null||l.call(c,a)},s={onImpression:()=>{this.freq.recordImpression(e.id,t()),r("impression")},onView:()=>r("view"),onCtaClick:i=>r("cta_click",{action:i}),onInteraction:i=>r("interaction",{name:i}),onDismiss:i=>{this.freq.recordDismiss(e.id,t()),this.live.delete(e.id),r("dismiss",{method:i}),this.scheduleTick()}};try{let i=await Ao(e,s,{host:this.host,slots:this.slots});this.live.set(e.id,{occ:{id:e.id,zone:Lt(e),focus:so[e.surface],tier:e.priority},surface:i});let o=io[e.surface];o>0&&(this.budget.interruptionsThisSession++,this.budget.lastInterruptionAt=t(),this.budget.tokens=Math.max(0,this.budget.tokens-o),Lt(e)==="modal"&&this.budget.modalsToday++)}catch{this.pending.delete(e.id)}}close(e){let t=this.live.get(e);if(t){try{t.surface.close()}catch{}this.live.delete(e)}}stop(){var e;if(this.started){this.started=!1,this.tickTimer&&(clearTimeout(this.tickTimer),this.tickTimer=null),(e=this.unsub)==null||e.call(this),this.bus.stop();for(let t of[...this.live.keys()])this.close(t);this.pending.clear(),this.transport.outbox.flush();try{this.host.destroy()}catch{}}}}});var qh={};L(qh,{InApp2Feature:()=>_a});var _a,Hh=k(()=>{"use strict";_a=class{constructor(){this.name="inapp2";this.active=!1}get isActive(){return this.active}async setup(e){if(typeof window=="undefined"||typeof document=="undefined"||!e.clientKey||!e.apiBaseUrl)return;this.active=!0;let{InAppEngine:t}=await Promise.resolve().then(()=>(Dh(),Fh));this.active&&(this.engine=new t({apiBaseUrl:e.apiBaseUrl,clientKey:e.clientKey,deviceId:e.deviceId,sessionId:e.sessionId,appVersion:e.appVersion,userId:()=>{var r;return(r=e.getUserId)==null?void 0:r.call(e)},route:()=>typeof location!="undefined"?location.pathname+location.search:"",config:{engine:"native"}}),this.engine.start())}fireEvent(e){var t;(t=this.engine)==null||t.fireEvent(e)}onIdentify(){var e;(e=this.engine)==null||e.onIdentify()}teardown(){var e;this.active=!1,(e=this.engine)==null||e.stop(),this.engine=void 0}}});var Wh={};L(Wh,{armSoftAsk:()=>Ik});function Uh(){try{let n=Number(localStorage.getItem(Vh)||0);return Number.isFinite(n)&&n>Date.now()}catch{return!1}}function kk(n){try{localStorage.setItem(Vh,String(Date.now()+n*864e5))}catch{}}function Ek(n){return new Promise(e=>{let t=document.createElement("div");t.setAttribute("data-scalebun-softask",""),t.style.cssText="position:fixed;z-index:2147483000;inset:auto 16px 16px auto";let r=t.attachShadow({mode:"open"});r.innerHTML=`
671
671
  <style>
672
672
  :host{all:initial}
673
673
  .c{width:min(340px,calc(100vw - 32px));box-sizing:border-box;padding:16px 18px;border-radius:14px;
@@ -693,7 +693,7 @@ ${r!=="dropdown"?"":`
693
693
  <button class="no" type="button"></button>
694
694
  <button class="yes" type="button"></button>
695
695
  </div>
696
- </div>`,r.querySelector(".t").textContent=n.title,r.querySelector(".b").textContent=n.body;let s=r.querySelector(".no"),i=r.querySelector(".yes");s.textContent=n.denyText,i.textContent=n.allowText;let o=a=>{t.remove(),e(a)};s.addEventListener("click",()=>o(!1)),i.addEventListener("click",()=>o(!0)),document.body.appendChild(t)})}async function Sk(n,e){var o;if(typeof document=="undefined"||typeof Notification=="undefined"||e.permission()!=="default"||Uh())return;let r={...vk,...n},s=async()=>{var l,u,d;if(e.permission()!=="default"||Uh())return;if(!await xk(r)){wk(r.remindAfterDays),(l=e.log)==null||l.call(e,"soft-ask declined \u2014 snoozed");return}let c=await e.enable();(u=e.log)==null||u.call(e,`soft-ask accepted \u2192 enable() = ${c}`),c==="denied"&&((d=e.log)==null||d.call(e,"browser permission denied \u2014 the SDK cannot re-ask"))},i=(o=n.trigger)!=null?o:"immediate";if(i==="immediate")return void s();if(typeof i=="object"&&"afterMs"in i){setTimeout(()=>void s(),Math.max(0,i.afterMs));return}if(typeof i=="object"&&"onSelector"in i){let a=c=>{let l=c.target;l&&l.closest&&l.closest(i.onSelector)&&(document.removeEventListener("click",a,!0),s())};document.addEventListener("click",a,!0)}}var Vh,vk,jh=E(()=>{"use strict";Vh="scalebun.push.softAsk.snoozedUntil",vk={title:"Stay in the loop",body:"Get notified about important updates. You can turn this off any time.",allowText:"Allow notifications",denyText:"Not now",remindAfterDays:7,accent:"#5B4FE0"}});var Kh={};L(Kh,{buildBugReportPayload:()=>Ek});function kk(){try{return typeof location!="undefined"?location.href:void 0}catch{return}}function Ek(n,e=[],t={}){var s;let r=t.replayCoord;return{clientReportId:`bug_${H()}`,...n.title?{title:j(n.title)}:{},message:j((s=n.message)!=null?s:""),...n.email?{email:n.email}:{},url:kk(),...e.length?{console:e.slice(-20)}:{},...typeof(r==null?void 0:r.seq)=="number"?{replaySeq:r.seq}:{},...r!=null&&r.segmentId?{replaySegmentId:r.segmentId}:{},timestamp:P()}}var Gh=E(()=>{"use strict";$()});function Ik(n){let e=n.getBoundingClientRect();return{x:e.left,y:e.top,width:e.width,height:e.height}}function Ck(){return{x:0,y:0,width:window.innerWidth||1024,height:window.innerHeight||768}}var Ak,Ts,Xh=E(()=>{"use strict";wo();$();Ak=`
696
+ </div>`,r.querySelector(".t").textContent=n.title,r.querySelector(".b").textContent=n.body;let s=r.querySelector(".no"),i=r.querySelector(".yes");s.textContent=n.denyText,i.textContent=n.allowText;let o=a=>{t.remove(),e(a)};s.addEventListener("click",()=>o(!1)),i.addEventListener("click",()=>o(!0)),document.body.appendChild(t)})}async function Ik(n,e){var o;if(typeof document=="undefined"||typeof Notification=="undefined"||e.permission()!=="default"||Uh())return;let r={...Sk,...n},s=async()=>{var l,u,d;if(e.permission()!=="default"||Uh())return;if(!await Ek(r)){kk(r.remindAfterDays),(l=e.log)==null||l.call(e,"soft-ask declined \u2014 snoozed");return}let c=await e.enable();(u=e.log)==null||u.call(e,`soft-ask accepted \u2192 enable() = ${c}`),c==="denied"&&((d=e.log)==null||d.call(e,"browser permission denied \u2014 the SDK cannot re-ask"))},i=(o=n.trigger)!=null?o:"immediate";if(i==="immediate")return void s();if(typeof i=="object"&&"afterMs"in i){setTimeout(()=>void s(),Math.max(0,i.afterMs));return}if(typeof i=="object"&&"onSelector"in i){let a=c=>{let l=c.target;l&&l.closest&&l.closest(i.onSelector)&&(document.removeEventListener("click",a,!0),s())};document.addEventListener("click",a,!0)}}var Vh,Sk,jh=k(()=>{"use strict";Vh="scalebun.push.softAsk.snoozedUntil",Sk={title:"Stay in the loop",body:"Get notified about important updates. You can turn this off any time.",allowText:"Allow notifications",denyText:"Not now",remindAfterDays:7,accent:"#5B4FE0"}});var Kh={};L(Kh,{buildBugReportPayload:()=>Ak});function Ck(){try{return typeof location!="undefined"?location.href:void 0}catch{return}}function Ak(n,e=[],t={}){var s;let r=t.replayCoord;return{clientReportId:`bug_${H()}`,...n.title?{title:j(n.title)}:{},message:j((s=n.message)!=null?s:""),...n.email?{email:n.email}:{},url:Ck(),...e.length?{console:e.slice(-20)}:{},...typeof(r==null?void 0:r.seq)=="number"?{replaySeq:r.seq}:{},...r!=null&&r.segmentId?{replaySegmentId:r.segmentId}:{},timestamp:P()}}var Gh=k(()=>{"use strict";$()});function Tk(n){let e=n.getBoundingClientRect();return{x:e.left,y:e.top,width:e.width,height:e.height}}function Rk(){return{x:0,y:0,width:window.innerWidth||1024,height:window.innerHeight||768}}var Mk,Ms,Xh=k(()=>{"use strict";xo();$();Mk=`
697
697
  :host{all:initial}
698
698
  *{box-sizing:border-box;font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif}
699
699
  .spot{position:fixed;border-radius:8px;box-shadow:0 0 0 9999px rgba(12,10,20,.55);z-index:2147483600;pointer-events:none;transition:all .2s ease}
@@ -712,6 +712,6 @@ button{font:inherit;cursor:pointer;border-radius:8px;border:none}
712
712
  .back{background:#262131;color:#edeaf2;font-size:12px;font-weight:600;padding:7px 12px}
713
713
  .next{background:#7c6cf0;color:#fff;font-size:12px;font-weight:600;padding:7px 14px}
714
714
  .x{position:absolute;top:10px;right:12px;background:none;color:#9a95a6;font-size:17px;line-height:1;padding:2px}
715
- @media(prefers-reduced-motion:reduce){.spot{transition:none}}`,Ts=class{constructor(){this.host=null;this.root=null;this.card=null;this.spot=null;this.ctx=null;this.onReflow=()=>this.position()}ensure(){return this.root?this.root:(this.host=document.createElement("div"),this.host.setAttribute("data-scalebun-coach",""),this.root=this.host.attachShadow({mode:"open"}),Ne(this.root,Ak),document.body.appendChild(this.host),window.addEventListener("scroll",this.onReflow,!0),window.addEventListener("resize",this.onReflow),this.root)}render(e){var d,p;let t=this.ensure();this.ctx=e,[...t.querySelectorAll(".spot,.backdrop,.card")].forEach(f=>f.remove()),this.card=null,this.spot=null;let r=!!e.el&&!e.degraded;if(r)this.spot=document.createElement("div"),this.spot.className="spot",t.appendChild(this.spot);else{let f=document.createElement("div");f.className="backdrop",f.addEventListener("click",()=>e.controls.close()),t.appendChild(f)}let s=document.createElement("div");s.className=r?"card":"card modal",s.setAttribute("role","dialog"),s.setAttribute("aria-modal","true"),e.step.title&&s.setAttribute("aria-label",e.step.title);let i=document.createElement("button");if(i.className="x",i.type="button",i.textContent="\xD7",i.setAttribute("aria-label","Close"),i.addEventListener("click",()=>e.controls.close()),s.appendChild(i),e.step.title){let f=document.createElement("div");f.className="t",f.textContent=e.step.title,s.appendChild(f)}if(e.step.body){let f=document.createElement("div");f.className="b",f.textContent=e.step.body,s.appendChild(f)}let o=document.createElement("div");o.className="ft";let a=document.createElement("span");a.className="count",a.textContent=`${e.index+1} of ${e.total}`;let c=document.createElement("div");c.className="btns";let l=document.createElement("button");if(l.className="skip",l.type="button",l.textContent="Skip",l.addEventListener("click",()=>e.controls.skip()),c.appendChild(l),e.index>0){let f=document.createElement("button");f.className="back",f.type="button",f.textContent="Back",f.addEventListener("click",()=>e.controls.back()),c.appendChild(f)}let u=document.createElement("button");if(u.className="next",u.type="button",u.textContent=e.index+1>=e.total?"Done":"Next",u.addEventListener("click",()=>e.controls.next()),c.appendChild(u),o.append(a,c),s.appendChild(o),r){let f=document.createElement("div");f.className="arrow",s.appendChild(f)}t.appendChild(s),this.card=s,(p=(d=(e.step.title,u)).focus)==null||p.call(d),this.position()}position(){var o;let e=this.ctx;if(!e||!this.card||!e.el||e.degraded)return;let t=Ik(e.el);this.spot&&(this.spot.style.left=`${t.x-6}px`,this.spot.style.top=`${t.y-6}px`,this.spot.style.width=`${t.width+6*2}px`,this.spot.style.height=`${t.height+6*2}px`);let r={width:this.card.offsetWidth||320,height:this.card.offsetHeight||120},s=ts({anchor:t,tooltip:r,boundary:Ck(),preferred:(o=e.step.placement)!=null?o:{side:"bottom",align:"center"}});this.card.style.left=`${s.x}px`,this.card.style.top=`${s.y}px`;let i=this.card.querySelector(".arrow");i&&(i.style.left=s.arrow.y===0||s.arrow.y===r.height?`${s.arrow.x-6}px`:s.placement.side==="left"?`${r.width-6}px`:"-6px",i.style.top=s.arrow.x===0||s.arrow.x===r.width?`${s.arrow.y-6}px`:s.placement.side==="top"?`${r.height-6}px`:"-6px")}hide(){var e;window.removeEventListener("scroll",this.onReflow,!0),window.removeEventListener("resize",this.onReflow),(e=this.host)==null||e.remove(),this.host=null,this.root=null,this.card=null,this.spot=null,this.ctx=null}}});var Jh={};L(Jh,{CoachmarkFeature:()=>Oa});var Yh,Oa,Qh=E(()=>{"use strict";ns();Xh();xo();Zr();ss();Yh="scalebun_coach_progress",Oa=class{constructor(e){this.deps=e;this.hub=new tt;this.renderer=new Ts;this.listeners=new Map;this.toursCache=null;this.reportedAnchors=new Set;this.engine=new qt({hub:this.hub,resolveAnchor:t=>pt(t),waitFor:(t,r,s)=>rs(t,r,s),render:t=>this.renderer.render(t),hide:()=>this.renderer.hide(),emit:(t,r)=>this.emit(t,r),now:()=>Date.now(),persist:(t,r)=>this.persist(t,r),loadIndex:t=>this.loadIndex(t)})}start(e,t){this.reportAnchors(),this.engine.start(e,t)}reportAnchors(){for(let e of Qp())this.reportedAnchors.has(e)||(this.reportedAnchors.add(e),this.emit("$coachmark_anchor_seen",{anchorKey:e}))}async fetchTours(e){var s;if(!e&&this.toursCache)return this.toursCache;let{apiBaseUrl:t,clientKey:r}=this.deps;if(!t||!r||typeof fetch=="undefined")return e?[]:this.toursCache=[];try{let i=`${t}/sdk/coach/config${e?`?preview=${encodeURIComponent(e)}`:""}`,o=await fetch(i,{headers:{"x-scalebun-client-key":r},cache:"no-store"});if(!o.ok)return e?[]:this.toursCache=[];let c=(s=(await o.json()).tours)!=null?s:[];return e?c:this.toursCache=c}catch{return e?[]:this.toursCache=[]}}async startById(e,t){let r=(await this.fetchTours(t==null?void 0:t.preview)).find(s=>s.id===e);return r?(this.engine.start(r,t),!0):!1}next(){this.engine.next()}back(){this.engine.back()}skip(){this.engine.skip()}end(){this.engine.end("abandoned","api")}notify(e){this.engine.notify(e)}current(){return this.engine.state}on(e,t){let r=this.listeners.get(e);return r||(r=new Set,this.listeners.set(e,r)),r.add(t),()=>{var s;(s=this.listeners.get(e))==null||s.delete(t)}}emit(e,t){var o,a;let r=this.deps.replayCoord(),s={...t,...r?{replayCoord:r}:{}};this.deps.trackEvent(e,s);let i={event:e,...s};for(let c of(o=this.listeners.get(e))!=null?o:[])try{c(i)}catch{}for(let c of(a=this.listeners.get("*"))!=null?a:[])try{c(i)}catch{}}progress(){try{return JSON.parse(localStorage.getItem(Yh)||"{}")}catch{return{}}}persist(e,t){try{let r=this.progress();t<0?delete r[e]:r[e]=t,localStorage.setItem(Yh,JSON.stringify(r))}catch{}}loadIndex(e){return this.progress()[e]}dispose(){this.engine.dispose(),this.renderer.hide(),this.hub.dispose(),this.listeners.clear()}}});function Ms(n){return n.supported?n.permission==="denied"?n.everSubscribed?"revoked":"blocked":n.permission==="default"?"never-granted":n.hasSubscription?"subscribed":n.everSubscribed?"expired":"never-granted":"unsupported"}var Zh,Na=E(()=>{"use strict";Zh={subscribed:{title:"Notifications are on",detail:"This browser is registered and can receive push.",actionable:!1},"never-granted":{title:"Not asked yet",detail:"This browser has never been prompted. Ask from a click \u2014 browsers ignore the prompt otherwise.",actionable:!0},blocked:{title:"Blocked in this browser",detail:"Notifications were declined, and the browser will not show the prompt again. Only the person can re-enable it, from the site settings beside the address bar.",actionable:!1},revoked:{title:"Turned off after being enabled",detail:"This browser had notifications and they were switched off. Like blocking, only the person can restore it from the site settings \u2014 but unlike a first refusal, they opted in once, so a reminder in-product is fair.",actionable:!1},expired:{title:"Registration expired",detail:"Permission is still granted but the subscription is gone \u2014 browsers drop them after long inactivity or a data clear. Re-registering fixes it and does NOT prompt.",actionable:!0},unsupported:{title:"Not supported in this browser",detail:"Web push needs a service worker, the Push API and Notifications. This browser is missing at least one.",actionable:!1}}});var Ba={};L(Ba,{notInitializedReport:()=>_k,runPushDiagnostics:()=>Lk});function Rk(){return typeof navigator!="undefined"&&"serviceWorker"in navigator&&typeof window!="undefined"&&"PushManager"in window&&"Notification"in window}function Tk(n){let e="=".repeat((4-n.length%4)%4),t=(n+e).replace(/-/g,"+").replace(/_/g,"/"),r=atob(t),s=new Uint8Array(r.length);for(let i=0;i<r.length;i++)s[i]=r.charCodeAt(i);return s}function Mk(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;return!0}function Pk(n){return new Promise(e=>{let t=n.active;if(!t||typeof MessageChannel=="undefined"){e(null);return}let r=!1,s=i=>{r||(r=!0,e(i))};try{let i=new MessageChannel;i.port1.onmessage=o=>{let a=o.data;s(a&&a.type==="scalebun-sw-pong"?{version:a.version}:null)},t.postMessage({type:"scalebun-sw-ping"},[i.port2]),setTimeout(()=>s(null),1500)}catch{s(null)}})}async function Lk(n){var m,h,g,S,v,y,b,w,x;let e=[],t=I=>(e.push(I),I),r=(I,k,C)=>{t({id:I,status:"unknown",label:k,detail:`Not evaluated \u2014 ${C}`})},s=typeof window!="undefined"&&window.isSecureContext===!0;t({id:"secure_context",status:s?"pass":"fail",label:"Secure context (HTTPS)",detail:s?void 0:"Page is not a secure context",fix:s?void 0:"Serve the site over HTTPS. Web Push is unavailable on plain HTTP (localhost is exempt)."});let i=[];(typeof navigator=="undefined"||!("serviceWorker"in navigator))&&i.push("ServiceWorker"),(typeof window=="undefined"||!("PushManager"in window))&&i.push("PushManager"),(typeof window=="undefined"||!("Notification"in window))&&i.push("Notification");let o=i.length===0&&Rk(),a=typeof navigator!="undefined"&&/iPad|iPhone|iPod/.test(navigator.userAgent||"");if(t({id:"api_support",status:o?"pass":"fail",label:"Browser supports Web Push",detail:o?void 0:`Missing: ${i.join(", ")||"push APIs"}`,fix:o?void 0:a?"On iOS, Web Push only works when the site is installed to the Home Screen as a PWA (iOS 16.4+). In a normal Safari tab these APIs are absent.":"This browser cannot receive Web Push. Hide your opt-in UI when ScaleBun.push.check() reports this."}),!o)return r("sw_reachable","Service worker file is reachable","push APIs are unavailable"),r("sw_registered","Service worker is registered","push APIs are unavailable"),r("sw_version","Service worker is up to date","push APIs are unavailable"),r("vapid_configured","Web Push configured for this app","push APIs are unavailable"),r("permission","Notification permission","push APIs are unavailable"),r("subscription_valid","Push subscription is valid","push APIs are unavailable"),r("device_registered","Device registered with ScaleBun","push APIs are unavailable"),r("identified","User is identified","push APIs are unavailable"),eg(e);let c=null;try{let I=await fetch(n.serviceWorkerUrl,{method:"HEAD",cache:"no-store"});c=I.ok,t({id:"sw_reachable",status:I.ok?"pass":"fail",label:"Service worker file is reachable",detail:`GET ${n.serviceWorkerUrl} \u2192 ${I.status}`,fix:I.ok?void 0:`Copy scalebun-push-sw.js from @scalebun/web/dist/ to your web root so it is served at ${n.serviceWorkerUrl}.`})}catch{t({id:"sw_reachable",status:"unknown",label:"Service worker file is reachable",detail:`Could not fetch ${n.serviceWorkerUrl}`,fix:"Check that the file is served from the same origin and not blocked by CSP."})}let l=null;try{l=(m=await navigator.serviceWorker.getRegistration(n.serviceWorkerUrl))!=null?m:null}catch{l=null}let u=(b=(y=(S=(h=l==null?void 0:l.active)==null?void 0:h.scriptURL)!=null?S:(g=l==null?void 0:l.installing)==null?void 0:g.scriptURL)!=null?y:(v=l==null?void 0:l.waiting)==null?void 0:v.scriptURL)!=null?b:null,d=!!u&&u.indexOf("scalebun-push-sw")>=0;if(t({id:"sw_registered",status:l&&d?"pass":"fail",label:"Service worker is registered",detail:l?d?`Active: ${u}`:`A different worker owns this scope: ${u}`:"No registration found for this scope",fix:l?d?void 0:"Another service worker controls this scope. Serve the ScaleBun worker at a path it can own, and pass serviceWorkerScope to enablePush().":c===!1?"The worker file is missing (see the check above) \u2014 fix that first, then call ScaleBun.enablePush().":"Call ScaleBun.enablePush() from a user gesture to register the worker."}),l&&d){let I=await Pk(l);!I||typeof I.version!="number"?t({id:"sw_version",status:"warn",label:"Service worker is up to date",detail:"The worker did not answer a version ping",fix:`Your copy of scalebun-push-sw.js is older than v${n.expectedSwVersion} (versions before v3 cannot report themselves). Re-copy it from @scalebun/web/dist/.`}):I.version<n.expectedSwVersion?t({id:"sw_version",status:"warn",label:"Service worker is up to date",detail:`Worker is v${I.version}, this SDK expects v${n.expectedSwVersion}`,fix:"Re-copy scalebun-push-sw.js from @scalebun/web/dist/ to your web root \u2014 the deployed copy is stale."}):t({id:"sw_version",status:"pass",label:"Service worker is up to date",detail:`v${I.version}`})}else r("sw_version","Service worker is up to date","no ScaleBun worker is registered");let p=null;try{let I=await fetch(`${n.apiBaseUrl}/sdk/engage/push-config`,{headers:{"content-type":"application/json","x-scalebun-client-key":n.clientKey},cache:"no-store"}),k=I.ok?await I.json():null;p=(k==null?void 0:k.enabled)===!1?null:(w=k==null?void 0:k.vapidPublicKey)!=null?w:null,t({id:"vapid_configured",status:p?"pass":"fail",label:"Web Push configured for this app",detail:p?void 0:"No VAPID key served for this client key",fix:p?void 0:"In the ScaleBun dashboard: Settings \u2192 Integrations \u2192 Web Push (VAPID) \u2192 Generate VAPID keys."})}catch{t({id:"vapid_configured",status:"unknown",label:"Web Push configured for this app",detail:"Could not reach the ScaleBun API",fix:"Check apiBaseUrl, network access, and CORS."})}let f=typeof Notification=="undefined"?"default":Notification.permission;t({id:"permission",status:f==="granted"?"pass":f==="denied"?"fail":"warn",label:"Notification permission",detail:f,fix:f==="granted"?void 0:f==="denied"?"The user blocked notifications. This cannot be re-prompted from code \u2014 they must re-allow it in browser site settings.":"Not asked yet. Call ScaleBun.enablePush() from a click handler."});try{let I=l?await l.pushManager.getSubscription():null;if(!I)t({id:"subscription_valid",status:"fail",label:"Push subscription is valid",detail:"No subscription on this browser",fix:f==="granted"?"Permission is granted but no subscription exists \u2014 call ScaleBun.enablePush() to create one.":"Call ScaleBun.enablePush() from a user gesture."});else{let k=I.toJSON(),C=typeof k.expirationTime=="number"&&k.expirationTime<=Date.now(),M=null;if(p){let A=(x=I.options)==null?void 0:x.applicationServerKey;M=A?Mk(new Uint8Array(A),Tk(p)):null}t({id:"subscription_valid",status:C||M===!1?"fail":M===null&&p?"warn":"pass",label:"Push subscription is valid",detail:C?"Subscription has expired":M===!1?"Subscription was created with a DIFFERENT VAPID key than this app now uses":M===null&&p?"Could not read the subscription key to compare against the tenant VAPID key":I.endpoint,fix:C?"Call ScaleBun.enablePush() again to mint a fresh subscription.":M===!1?"The VAPID keypair was rotated after this browser subscribed, so pushes to it will fail. Call ScaleBun.push.disable() then ScaleBun.enablePush() to re-subscribe.":void 0})}}catch{t({id:"subscription_valid",status:"unknown",label:"Push subscription is valid",detail:"Could not read the push subscription"})}try{let I=await fetch(`${n.apiBaseUrl}/sdk/engage/device-token/status?deviceId=${encodeURIComponent(n.deviceId)}`,{headers:{"content-type":"application/json","x-scalebun-client-key":n.clientKey},cache:"no-store"}),k=I.ok?await I.json():null;if(!k)t({id:"device_registered",status:"unknown",label:"Device registered with ScaleBun",detail:`Status lane returned ${I.status}`}),r("identified","User is identified","the server did not answer");else{let C=k.tokenStatus==="dead";t({id:"device_registered",status:k.registered&&!C?"pass":"fail",label:"Device registered with ScaleBun",detail:k.registered?C?"Token marked dead by the push service":"Registered and active":"No push token stored for this device",fix:k.registered?C?"The browser push service rejected this token (410 Gone). Call ScaleBun.enablePush() to re-subscribe.":void 0:"Call ScaleBun.enablePush() \u2014 the subscription never reached the backend."}),t({id:"identified",status:k.identified?"pass":"warn",label:"User is identified",detail:k.identified?"Bound to a person":"Anonymous device",fix:k.identified?void 0:"Call ScaleBun.identify() \u2014 journeys and lifecycle programs only target identified people, so this browser can receive broadcasts but never an automated lifecycle push."})}}catch{t({id:"device_registered",status:"unknown",label:"Device registered with ScaleBun",detail:"Could not reach the ScaleBun API"}),r("identified","User is identified","the server was unreachable")}return eg(e)}function _k(){return{ok:!1,blocking:"api_support",checks:[{id:"api_support",status:"fail",label:"ScaleBun is initialized",detail:"push.check() was called before ScaleBun.init()",fix:"Call ScaleBun.init({ clientKey, apiBaseUrl }) first \u2014 diagnostics need the resolved config."}]}}function eg(n){var t;let e=n.find(r=>r.status==="fail");return{ok:!e,blocking:(t=e==null?void 0:e.id)!=null?t:null,checks:n}}var Fa=E(()=>{"use strict"});var ng={};L(ng,{DEFAULT_SW_URL:()=>Da,EXPECTED_SW_VERSION:()=>tg,PUSH_STATE_COPY:()=>Zh,PushFeature:()=>qa,resolvePushState:()=>Ms});function Ps(){return typeof navigator!="undefined"&&"serviceWorker"in navigator&&typeof window!="undefined"&&"PushManager"in window&&"Notification"in window}function Ok(n){let e="=".repeat((4-n.length%4)%4),t=(n+e).replace(/-/g,"+").replace(/_/g,"/"),r=atob(t),s=new ArrayBuffer(r.length),i=new Uint8Array(s);for(let o=0;o<r.length;o++)i[o]=r.charCodeAt(o);return i}var tg,Da,mn,qa,rg=E(()=>{"use strict";Na();Na();tg=5,Da="/scalebun-push-sw.js";mn=class mn{constructor(e){this.reg=null;this.lastEndpoint=null;this.swUrl=Da;this.openedCbs=new Set;this.swMessageBound=!1;this.deps=e}log(...e){var t,r;(r=(t=this.deps).log)==null||r.call(t,"[scalebun:push]",...e)}permission(){return typeof Notification=="undefined"?"default":Notification.permission}async enable(e={}){try{if(!Ps())return this.log("unsupported browser \u2014 skipping"),"unsupported";if(!this.deps.clientKey||!this.deps.apiBaseUrl)return"error";if(this.permission()==="denied")return"denied";let t=await this.fetchPushConfig();if(!t||t.enabled===!1||!t.vapidPublicKey)return this.log("web push not configured for this app"),"not-configured";let r=await Notification.requestPermission();if(r!=="granted")return r==="denied"?"denied":"error";let s=e.serviceWorkerUrl||Da;this.swUrl=s,this.reg=await navigator.serviceWorker.register(s,e.serviceWorkerScope?{scope:e.serviceWorkerScope}:void 0),await navigator.serviceWorker.ready,this.bindSwMessages();let o=await this.reg.pushManager.getSubscription()||await this.reg.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Ok(t.vapidPublicKey)}),a=await this.registerDeviceToken(o);return this.lastEndpoint=o.endpoint,a?"subscribed":"error"}catch(t){return this.log("enable failed",t),"error"}}async disable(e={}){var t,r;try{let s=this.reg||(Ps()?await navigator.serviceWorker.getRegistration():null),i=s?await s.pushManager.getSubscription():null,o=(r=(t=i==null?void 0:i.endpoint)!=null?t:this.lastEndpoint)!=null?r:null,a=i?await i.unsubscribe():!0;return this.lastEndpoint=null,e.revokeServerSide!==!1&&await this.revokeDeviceToken(o),a}catch{return!1}}async revokeDeviceToken(e){if(!this.deps.clientKey||!this.deps.apiBaseUrl)return!1;try{return(await fetch(`${this.deps.apiBaseUrl}/sdk/engage/device-token/revoke`,{method:"POST",headers:this.headers(),keepalive:!0,body:JSON.stringify({deviceId:this.deps.deviceId,...e?{endpoint:e}:{}})})).ok}catch{return!1}}onNotificationOpened(e){return this.openedCbs.add(e),this.bindSwMessages(),()=>this.openedCbs.delete(e)}async getSubscription(){try{let e=this.reg||(Ps()?await navigator.serviceWorker.getRegistration():null),t=e?await e.pushManager.getSubscription():null;return t?t.toJSON():null}catch{return null}}async check(e={}){let{runPushDiagnostics:t}=await Promise.resolve().then(()=>(Fa(),Ba));return t({apiBaseUrl:this.deps.apiBaseUrl,clientKey:this.deps.clientKey,deviceId:this.deps.deviceId,serviceWorkerUrl:e.serviceWorkerUrl||this.swUrl,expectedSwVersion:tg})}everSubscribed(){try{return localStorage.getItem(mn.EVER_KEY)==="1"}catch{return!1}}markEverSubscribed(){try{localStorage.setItem(mn.EVER_KEY,"1")}catch{}}async status(){var r,s;let e=Ps(),t=e?await this.getSubscription():null;return t&&this.markEverSubscribed(),{supported:e,permission:this.permission(),subscribed:!!t,endpoint:(s=(r=t==null?void 0:t.endpoint)!=null?r:this.lastEndpoint)!=null?s:null,state:Ms({supported:e,permission:this.permission(),hasSubscription:!!t,everSubscribed:this.everSubscribed()})}}bindSwMessages(){this.swMessageBound||typeof navigator=="undefined"||!("serviceWorker"in navigator)||(this.swMessageBound=!0,navigator.serviceWorker.addEventListener("message",e=>{var r,s;let t=e.data;if(!(!t||typeof t.type!="string"))if(t.type==="scalebun-push-click"){let i=(r=t.data)!=null?r:{};for(let o of this.openedCbs)try{o({data:i,action:(s=t.action)!=null?s:null})}catch{}}else t.type==="scalebun-push-resubscribe"&&t.subscription&&this.registerDeviceTokenJson(t.subscription).then(i=>{var o;i&&((o=t.subscription)!=null&&o.endpoint)&&(this.lastEndpoint=t.subscription.endpoint)})}))}headers(){return{"content-type":"application/json","x-scalebun-client-key":this.deps.clientKey}}async fetchPushConfig(){try{let e=await fetch(`${this.deps.apiBaseUrl}/sdk/engage/push-config`,{headers:this.headers(),cache:"no-store"});return e.ok?await e.json():null}catch{return null}}registerDeviceToken(e){return this.registerDeviceTokenJson(e.toJSON())}async registerDeviceTokenJson(e){if(!e||!e.endpoint)return!1;try{return(await fetch(`${this.deps.apiBaseUrl}/sdk/engage/device-token`,{method:"POST",headers:this.headers(),keepalive:!0,body:JSON.stringify({schemaVersion:1,deviceId:this.deps.deviceId,platform:"web",pushProvider:"webpush",pushToken:JSON.stringify(e),tokenStatus:"active",...this.deps.sdkVersion?{sdkVersion:this.deps.sdkVersion}:{}})})).ok}catch{return!1}}};mn.EVER_KEY="scalebun.push.everSubscribed";qa=mn});var ja="https://api.scalebun.com/api/v1";var ag=["authorization","cookie","set-cookie","x-api-key","x-csrf-token","password","token","secret"];function Ka(n){var r,s,i,o,a,c,l,u,d,p,f,m,h,g,S,v,y,b,w,x,I,k,C,M,R,A,O,z,D,te,J,Q,fe,ce,xe,Se,le,q,V,K,de,me,se,Ue,Ve,G,ie,Y,X,ee,T,_,N,F,W,re,ge,he,Ce,Ae,Re,Je,st,ke,gn,$a,za,Ua,Va,Wa;if(!n||!n.clientKey)throw new Error("[scalebun] clientKey is required");let e=(r=n.apiBaseUrl)==null?void 0:r.replace(/\/$/,""),t=e&&/^https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?([/?#]|$)/.test(e)?e:ja;return{clientKey:n.clientKey,apiBaseUrl:t,environment:n.environment,release:n.release,appVersion:n.appVersion,flushIntervalMs:(s=n.flushIntervalMs)!=null?s:5e3,sessionTimeoutMs:n.sessionTimeoutMs,sessionMaxDurationMs:n.sessionMaxDurationMs,replay:n.replay,errors:n.errors,network:n.network,performance:n.performance,analytics:n.analytics,flags:n.flags,replayCanvas:(i=n.replayCanvas)!=null?i:!1,signSessionLane:(o=n.signSessionLane)!=null?o:!1,replayFrameOrigins:(a=n.replayFrameOrigins)!=null?a:[],autocapture:(c=n.autocapture)!=null?c:!0,tracePropagation:(l=n.tracePropagation)!=null?l:!0,tracePropagationOrigins:(u=n.tracePropagationOrigins)!=null?u:[],maxBatchSize:(d=n.maxBatchSize)!=null?d:50,maxQueueSize:(p=n.maxQueueSize)!=null?p:1e3,debug:(f=n.debug)!=null?f:!1,features:{errors:(h=(m=n.features)==null?void 0:m.errors)!=null?h:!0,network:(S=(g=n.features)==null?void 0:g.network)!=null?S:!0,console:(y=(v=n.features)==null?void 0:v.console)!=null?y:!0,webVitals:(w=(b=n.features)==null?void 0:b.webVitals)!=null?w:!0,performance:(I=(x=n.features)==null?void 0:x.performance)!=null?I:!0,journey:(C=(k=n.features)==null?void 0:k.journey)!=null?C:!0,replay:(R=(M=n.features)==null?void 0:M.replay)!=null?R:!1,bugReport:(O=(A=n.features)==null?void 0:A.bugReport)!=null?O:!0,crash:(D=(z=n.features)==null?void 0:z.crash)!=null?D:!0,config:(J=(te=n.features)==null?void 0:te.config)!=null?J:!0,engage:(fe=(Q=n.features)==null?void 0:Q.engage)!=null?fe:!0,analytics:(xe=(ce=n.features)==null?void 0:ce.analytics)!=null?xe:!0,webPerf:(le=(Se=n.features)==null?void 0:Se.webPerf)!=null?le:!0,profiler:(V=(q=n.features)==null?void 0:q.profiler)!=null?V:!1,watchdog:(de=(K=n.features)==null?void 0:K.watchdog)!=null?de:!1,inbox:(se=(me=n.features)==null?void 0:me.inbox)!=null?se:!1,inapp2:(Ve=(Ue=n.features)==null?void 0:Ue.inapp2)!=null?Ve:!1},watchdog:n.watchdog,exitIntent:n.exitIntent,privacy:{captureNetworkBodies:(ie=(G=n.privacy)==null?void 0:G.captureNetworkBodies)!=null?ie:!1,denylist:[...ag,...(X=(Y=n.privacy)==null?void 0:Y.denylist)!=null?X:[]].map(ig=>ig.toLowerCase()),maskSelectors:(T=(ee=n.privacy)==null?void 0:ee.maskSelectors)!=null?T:[],maskReplayText:(N=(_=n.privacy)==null?void 0:_.maskReplayText)!=null?N:!0,maskInputs:(ge=(re=(F=n.privacy)==null?void 0:F.maskInputs)!=null?re:(W=n.privacy)==null?void 0:W.maskReplayText)!=null?ge:!0,respectDnt:(Ce=(he=n.privacy)==null?void 0:he.respectDnt)!=null?Ce:!1,maskEventText:(Re=(Ae=n.privacy)==null?void 0:Ae.maskEventText)!=null?Re:!1},consent:{required:(Je=n.requireConsent)!=null?Je:!1,initial:(st=n.initialConsent)!=null?st:"unknown"},bugReport:{launcher:(gn=(ke=n.bugReportOptions)==null?void 0:ke.launcher)!=null?gn:!1,position:(za=($a=n.bugReportOptions)==null?void 0:$a.position)!=null?za:"bottom-right",label:(Va=(Ua=n.bugReportOptions)==null?void 0:Ua.label)!=null?Va:"Report a bug"},...(Wa=n.engageOptions)!=null&&Wa.onInAppGameRequest?{onInAppGameRequest:n.engageOptions.onInAppGameRequest}:{}}}$();$();Sn();var kn=class{constructor(e){this.config=e;var r,s;let t=kc((r=e.sessionTimeoutMs)!=null?r:Ut,(s=e.sessionMaxDurationMs)!=null?s:js);this.sessionId=t.id,this.deviceId=Xa()}client(){return Za()}device(){return ec(this.deviceId)}app(){return tc(this.config)}context(){return Ec(),nc()}};Sn();var In=class In{constructor(e){this.config=e;this.suspendedUntil=0}isSuspended(){return Date.now()<this.suspendedUntil}headers(){return{"content-type":"application/json","x-scalebun-client-key":this.config.clientKey}}async signedHeaders(e){let t=this.headers();if(!this.config.signSessionLane)return t;let{signatureHeaders:r}=await Promise.resolve().then(()=>(Ys(),Xs));return{...t,...await r(this.config.clientKey,e)}}async startSession(e){var t,r,s,i,o,a,c,l;await this.post(`${this.config.apiBaseUrl}/ingestion/sessions`,{sessionId:e.sessionId,deviceId:e.device.id,platform:e.client.platform,appVersion:(s=(t=e.app)==null?void 0:t.version)!=null?s:(r=e.app)==null?void 0:r.release,osVersion:e.device.osVersion,deviceModel:(i=e.device.model)!=null?i:e.device.browser,locale:(o=e.context)==null?void 0:o.locale,timezone:(a=e.context)==null?void 0:a.timezone,idleThresholdMs:(c=this.config.sessionTimeoutMs)!=null?c:Ut,sdkVersion:(l=e.client.sdk)==null?void 0:l.version,startedAt:Date.now()})}async sendBatch(e,t){var i,o;let r=`${this.config.apiBaseUrl}/ingestion/sessions/${encodeURIComponent(e.sessionId)}/batch`,s=await this.post(r,e,t==null?void 0:t.keepalive);if(!s)return null;try{return(o=(i=await s.json())==null?void 0:i.results)!=null?o:{}}catch{return{}}}async finalize(e){let t=`${this.config.apiBaseUrl}/ingestion/sessions/${encodeURIComponent(e)}/finalize`;await this.post(t,{endedAt:Date.now()},!0)}async submitBugReport(e,t){if(this.isSuspended())return null;let r=`${this.config.apiBaseUrl}/ingestion/sessions/${encodeURIComponent(e)}/bug-reports`;try{let s=JSON.stringify(t),i=await fetch(r,{method:"POST",headers:await this.signedHeaders(s),body:s});return i.ok?await i.json().catch(()=>({})):null}catch{return null}}async post(e,t,r=!1){if(this.isSuspended())return null;try{let s=JSON.stringify(t),i=await this.signedHeaders(s),o=s;if(!r&&s.length>In.GZIP_MIN_BYTES){let{gzipString:c}=await Promise.resolve().then(()=>(Tc(),Rc)),l=await c(s);l&&(o=new Blob([l]),i["content-encoding"]="gzip")}let a=await fetch(e,{method:"POST",headers:i,body:o,keepalive:r});return a.status===403&&this.maybeEnterSuspended(a),a.ok?a:null}catch{return null}}maybeEnterSuspended(e){let t=Number(e.headers.get("retry-after"))||0;e.clone().json().then(r=>{if(!((r==null?void 0:r.code)==="workspace_suspended"||(r==null?void 0:r.enabled)===!1)&&!t)return;let i=Number(r==null?void 0:r.retryAfterSeconds)||t||3600;this.suspendedUntil=Date.now()+i*1e3}).catch(()=>{t&&(this.suspendedUntil=Date.now()+t*1e3)})}};In.GZIP_MIN_BYTES=1024;var En=In;Vt();$();Cn();Rn();var Ng=1,Pc=n=>n.kind==="frame",Tn=n=>n.frameType==="keyframe",Bg=n=>Pc(n)&&!Tn(n),Fg=3,Mn=class{constructor(e,t,r){this.config=e;this.session=t;this.transport=r;this.queue=[];this.timer=null;this.droppedCount=0;this.queuedCount=0;this.attemptedCount=0;this.retriedCount=0;this.recoveredCount=0;this.expiredCount=0;this.ackedCount=0;this.started=!1;this.dead=!1;this.lifecycle=[];this.buffer=new Be;this.backoff=new St;this.flushing=!1;this.sessionStarted=Promise.resolve();this.sessionOk=!1;this.sessionRetries=0;this.keyframePending=!1;this.inFlight=[];var s,i;this.consentGranted=!((s=e.consent)!=null&&s.required)||((i=e.consent)==null?void 0:i.initial)==="granted"}setConsentGranted(e){this.consentGranted=e}canEgress(){return this.consentGranted&&!this.dead}async start(){var e;if(!this.started){this.started=!0,this.dead=!1,this.armSession();try{let t=await this.buffer.load(),r=typeof t[0]=="string"?t[0]:"",s=(e=r?t[1]:t)!=null?e:[],i=An(s,o=>o.timestamp,P());this.expiredCount+=s.length-i.length,i.length&&(this.recoveredCount+=i.length,r&&r!==this.session.sessionId?this.drainOrphans(r,i):this.queue.unshift(...i))}catch{}this.timer=setInterval(()=>this.autoFlush(),this.config.flushIntervalMs),this.installLifecycleFlush(),this.queue.some(Tn)&&this.flush()}}armSession(){this.sessionOk=!1,this.sessionStarted=this.transport.startSession({sessionId:this.session.sessionId,client:this.session.client(),device:this.session.device(),app:this.session.app(),context:this.session.context()}).then(()=>{this.sessionOk=!0}).catch(()=>{})}emit(e){if(!this.consentGranted){this.droppedCount++;return}if(this.queue.length>=this.config.maxQueueSize){let t=this.queue.findIndex(Bg);this.queue.splice(t>=0?t:0,1),this.droppedCount++}this.queuedCount++,this.queue.push(e),this.started&&Tn(e)&&(this.flushing?this.keyframePending=!0:this.flush())}reportDrop(e,t){var r;e&&((r=this.reported)!=null||(this.reported=new Set),!this.reported.has(e)&&(this.reported.add(e),this.emit({kind:"event",name:"sdk_replay_capture_failed",timestamp:P(),props:{stage:"ingest-rejected",lane:e,reason:t!=null?t:"unknown"}})))}persistQueue(){let e=this.inFlight.length?[...this.inFlight,...this.queue]:this.queue;this.buffer.save([this.session.sessionId,kt(e,Pc,Tn)])}autoFlush(){this.dead||!ot()||!this.backoff.ready(P())||this.flush()}async flush(e){var r;if(this.dead||this.flushing||this.queue.length===0)return;this.flushing=!0;let t=this.queue.splice(0,this.config.maxBatchSize);this.inFlight=t;try{await this.sessionStarted,this.started&&!this.sessionOk&&this.sessionRetries<Fg&&(this.sessionRetries++,this.armSession(),await this.sessionStarted),this.attemptedCount++;let s=await this.transport.sendBatch(this.buildEnvelope(t),e);if(s){this.inFlight=[],this.ackedCount+=t.length;let i=[],o=0;for(let a of t){let c=(r=a.kind)!=null?r:"",l=s[c];!l||l.ok||(this.ackedCount--,l.retry?(i.push(a),this.retriedCount++):(o++,this.droppedCount++,this.reportDrop(c,l.reason)))}i.length?(t.length-i.length-o===0?(this.backoff.fail(P()),this.queue.push(...i)):(this.backoff.reset(),this.queue.unshift(...i)),this.persistQueue()):this.backoff.reset()}else this.backoff.fail(P()),this.retriedCount+=t.length,this.queue.unshift(...t),this.inFlight=[],this.persistQueue()}catch{this.backoff.fail(P()),this.retriedCount+=t.length,this.queue.unshift(...t),this.inFlight=[],this.persistQueue()}finally{this.flushing=!1}this.keyframePending&&(this.keyframePending=!1,this.flush(e))}emitFor(e,t){if(!this.consentGranted||!e||e===this.session.sessionId){this.consentGranted&&e===this.session.sessionId&&this.emit(t);return}this.drainOrphans(e,[t])}async drainOrphans(e,t){let r=null;try{r=await this.transport.sendBatch({...this.buildEnvelope(t),sessionId:e})}catch{}let s=r?t.filter(i=>{var a;let o=r[(a=i.kind)!=null?a:""];return o&&!o.ok&&o.retry}):t;s.length&&this.buffer.save([e,s])}buildEnvelope(e){return{schemaVersion:Ng,sessionId:this.session.sessionId,sentAt:P(),client:this.session.client(),device:this.session.device(),app:this.session.app(),context:this.session.context(),items:e}}installLifecycleFlush(){if(typeof document=="undefined")return;let e=()=>{this.dead||(this.persistQueue(),this.flush({keepalive:!0}))},t=()=>{document.visibilityState==="hidden"&&e()};this.addLifecycle(document,"visibilitychange",t),typeof window!="undefined"&&(this.addLifecycle(window,"pagehide",e),this.addLifecycle(window,"online",()=>{this.backoff.reset(),this.autoFlush()}))}addLifecycle(e,t,r){e.addEventListener(t,r),this.lifecycle.push({target:e,type:t,fn:r})}removeLifecycle(){for(let e of this.lifecycle)try{e.target.removeEventListener(e.type,e.fn)}catch{}this.lifecycle=[]}async stop(){this.timer&&clearInterval(this.timer),this.timer=null,this.removeLifecycle(),await this.flush({keepalive:!0}),await this.transport.finalize(this.session.sessionId),await this.buffer.clear(),this.started=!1}async discard(){this.dead=!0,this.consentGranted=!1,this.timer&&clearInterval(this.timer),this.timer=null,this.removeLifecycle(),this.queue=[],this.started=!1;try{await this.buffer.clear()}catch{}}get pendingCount(){return this.queue.length}get dropped(){return this.droppedCount}get ledger(){return{queued:this.queuedCount,attempted:this.attemptedCount,retried:this.retriedCount,recovered:this.recoveredCount,dropped:this.droppedCount,expired:this.expiredCount,acked:this.ackedCount}}};Qs();$();var Lc={drop:!1,warnings:[]};function _c(n,e,t){var o,a;if(!n||e.startsWith("$"))return Lc;let r=n.strict===!0,s=(o=n.events)==null?void 0:o[e];if(!s)return n.allowUnknownEvents===!1?{drop:r,warnings:[`event "${e}" is not in the tracking plan`]}:Lc;let i=[];for(let c of(a=s.required)!=null?a:[])(t==null||!(c in t))&&i.push(`event "${e}" missing required prop "${c}"`);if(s.props){for(let c of Object.keys(s.props))if(t&&c in t){let l=typeof t[c];l!==s.props[c]&&i.push(`event "${e}" prop "${c}" expected ${s.props[c]}, got ${l}`)}}return{drop:r&&i.length>0,warnings:i}}var Dg=/^[A-Za-z]{3}$/;function qg(n){return Dg.test(n)?n.toUpperCase():n}function Ln(n){let{revenue:e,currency:t,transactionId:r,type:s,productId:i,quantity:o,recurrence:a,...c}=n;if(typeof e!="number"||!Number.isFinite(e)||!t||!r)return null;let l=s!=null?s:"one_time",u=l==="refund"?-Math.abs(e):e,d={...c,transaction_id:r,revenue_type:l};return i&&(d.product_id=i),o!=null&&(d.quantity=o),a&&(d.recurrence=a),{revenue:u,currency:qg(t),props:d}}var Hg=["trial_started","trial_converted","started","renewed","plan_changed","cancel_scheduled","resumed","canceled","expired","payment_failed","refunded"],$g=new Set(["trial_started","trial_converted","started","plan_changed"]);function _n(n){if(n==null)return;let e=n instanceof Date?n:new Date(n);return Number.isNaN(e.getTime())?void 0:e.toISOString()}function zg(n){return{...n.id?{id:String(n.id)}:{},...n.name?{name:String(n.name)}:{},amount:n.amount,currency:String(n.currency).toUpperCase().slice(0,3),interval:n.interval,...typeof n.intervalCount=="number"&&n.intervalCount>0?{intervalCount:Math.floor(n.intervalCount)}:{}}}function Oc(n){if(!n)return null;let e=typeof n.subscriptionId=="string"?n.subscriptionId.trim():"",t=n.status;if(!e||!Hg.includes(t))return null;let r=n.plan;return $g.has(t)&&(!r||typeof r.amount!="number"||!Number.isFinite(r.amount)||r.amount<0||!r.currency||!r.interval)?null:{subscriptionId:e,status:t,...r?{plan:zg(r)}:{},..._n(n.trialEndAt)?{trialEndAt:_n(n.trialEndAt)}:{},..._n(n.effectiveAt)?{effectiveAt:_n(n.effectiveAt)}:{},...n.properties&&typeof n.properties=="object"?n.properties:{}}}Fe();var Ug="wzb-analytics-v1",Vg=new Set(["$identify","$group","$alias","purchase"]);function Nc(n,e,t){return t>=1||Vg.has(n)?!0:t<=0?!1:Ee(`${e}:${Ug}`)%1e4<t*1e4}Vt();Cn();Rn();var fb=50,mb=5e3,hb=2e3,Qe="scalebun_anonymous_id",ri="scalebun_user_id",Dn="scalebun_super_props",ti="scalebun_groups",nl="scalebun_installation_id",rl="scalebun_first_open_done",si="scalebun_attribution_click_id",sl="scalebun_attribution",ol=/^[0-9a-f]{16,64}$/i,gb=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"];function bb(){try{if(typeof localStorage!="undefined"){let e=localStorage.getItem(sl);if(e){let t=JSON.parse(e);if(t&&typeof t=="object")return{props:t,isNew:!1}}}}catch{}let n={};try{if(typeof location!="undefined"){let e=new URL(location.href);for(let t of gb){let r=e.searchParams.get(t);r&&(n[t]=r.slice(0,200))}for(let t of["fbclid","gclid"]){let r=e.searchParams.get(t);r&&(n[t]=r.slice(0,512))}}if(typeof document!="undefined"&&document.referrer)try{let e=new URL(document.referrer);n.referrer=(e.origin+e.pathname).slice(0,512),n.referrer_domain=e.hostname}catch{n.referrer=document.referrer.split("?")[0].slice(0,512)}}catch{}if(!n.referrer&&!n.utm_source&&!n.fbclid&&!n.gclid)return{props:{},isNew:!1};try{typeof location!="undefined"&&(n.landing_url=location.pathname.slice(0,512)),typeof localStorage!="undefined"&&localStorage.setItem(sl,JSON.stringify(n))}catch{}return{props:n,isNew:!0}}var yb="pending-analytics";function vb(){try{if(typeof localStorage!="undefined")return localStorage.getItem(ri)||void 0}catch{}}function ni(n){try{if(typeof localStorage=="undefined")return;n?localStorage.setItem(ri,n):localStorage.removeItem(ri)}catch{}}function ii(){return`anon_${H()}`}function il(n){try{if(typeof localStorage!="undefined"){let e=localStorage.getItem(n);if(e){let t=JSON.parse(e);if(t&&typeof t=="object")return t}}}catch{}return{}}function jt(n,e){try{if(typeof localStorage=="undefined")return;Object.keys(e).length?localStorage.setItem(n,JSON.stringify(e)):localStorage.removeItem(n)}catch{}}function wb(n){try{if(typeof document=="undefined")return null;let e=document.cookie.match(new RegExp("(?:^|; )"+n+"=([^;]*)")),t=e==null?void 0:e[1];return t!=null?decodeURIComponent(t):null}catch{return null}}function oi(n,e,t){try{if(typeof document=="undefined")return;let r=[`${n}=${encodeURIComponent(e)}`,"path=/","max-age=31536000","SameSite=Lax"];t&&r.push(`domain=${t}`),document.cookie=r.join("; ")}catch{}}function xb(n){var r,s;let e="",t;try{typeof localStorage!="undefined"&&(e=(r=localStorage.getItem(nl))!=null?r:"",e||(e=n||`web_${H()}`,localStorage.setItem(nl,e)),t=(s=localStorage.getItem(si))!=null?s:void 0)}catch{}e||(e=n||`web_${H()}`);try{if(typeof location!="undefined"&&location.search){let i=new URL(location.href),o=i.searchParams.get("scalebun_click_id");if(o&&ol.test(o)){t=o;try{typeof localStorage!="undefined"&&localStorage.setItem(si,o)}catch{}i.searchParams.delete("scalebun_click_id");try{history.replaceState(history.state,"",i.pathname+i.search+i.hash)}catch{}}}}catch{}return t?{installationId:e,clickId:t}:{installationId:e}}function Sb(n){if(n){let t=wb(Qe);if(t){try{typeof localStorage!="undefined"&&localStorage.setItem(Qe,t)}catch{}return t}}try{if(typeof localStorage!="undefined"){let t=localStorage.getItem(Qe),r=t!=null?t:ii();return t||localStorage.setItem(Qe,r),n&&oi(Qe,r,n),r}}catch{}let e=ii();return n&&oi(Qe,e,n),e}var qn=class{constructor(){this.name="analytics";this.ctx=null;this.active=!1;this.clientKey="";this.apiBaseUrl="";this.deviceId="";this.installationId="";this.attributionProps={};this.anonymousId="";this.userId=vb();this.superProps={};this.groups={};this.queue=[];this.buffer=new Be(yb);this.persisted=!1;this.backoff=new St;this.sampleRate=1;this.droppedCount=0;this.sampledOutCount=0;this.flushCount=0}get pending(){return this.queue.length}get dropped(){return this.droppedCount}get stats(){return{pending:this.queue.length,dropped:this.droppedCount,sampledOut:this.sampledOutCount,flushes:this.flushCount,sampleRate:this.sampleRate}}get isActive(){return this.active}setup(e){var i,o,a,c,l,u,d;this.ctx=e,this.clientKey=(i=e.clientKey)!=null?i:"",this.apiBaseUrl=(o=e.apiBaseUrl)!=null?o:"",this.deviceId=(a=e.deviceId)!=null?a:"";let t=xb(this.deviceId);this.installationId=t.installationId,this.clickId=t.clickId;let r=bb();this.attributionProps=r.props,this.cookieDomain=(c=e.analyticsOptions)==null?void 0:c.cookieDomain,this.anonymousId=Sb(this.cookieDomain),this.superProps=il(Dn),this.groups=il(ti),this.plan=(l=e.analyticsOptions)==null?void 0:l.plan;let s=(u=e.analyticsOptions)==null?void 0:u.sampleRate;typeof s=="number"&&s>=0&&s<=1&&(this.sampleRate=s),!(!this.clientKey||!this.apiBaseUrl)&&(r.isNew&&this.recordTouchpoint(),this.timer=setInterval(()=>this.autoFlush(),mb),typeof window!="undefined"&&(this.onHide=()=>{this.persist(),this.flush(!0)},window.addEventListener("pagehide",this.onHide)),this.offOnline=Mc(()=>{this.backoff.reset(),this.autoFlush()}),this.active=!0,this.maybeFirstOpen(),this.offSignal=(d=e.onSignal)==null?void 0:d.call(e,(p,f)=>{this.active&&(p==="rage"?this.track("$rageclick"):p==="dead"?this.track("$deadclick"):p==="shake"?this.track("$shake"):p==="error"?this.track("$exception",f):p==="web_vital"?this.track("$web_vital",f):p==="exit_intent"&&this.track("$exit_intent",f))}),this.buffer.load().then(p=>{let f=Array.isArray(p)?p:[],m=An(f,h=>h.event_time,P());this.droppedCount+=f.length-m.length,this.active&&m.length?(this.queue.unshift(...m),this.trim(),this.persisted=!0,this.autoFlush()):m.length<f.length&&this.buffer.clear()}),e.autocapture!==!1&&Promise.resolve().then(()=>(tl(),el)).then(({installAutocapture:p})=>{this.active&&(this.stopAutocapture=p({onEvent:f=>this.track(f.name,{...f.props,capture_source:"automatic"}),maskText:e.maskEventText===!0}))}).catch(()=>{}))}get usable(){return this.active&&!!this.clientKey&&!!this.apiBaseUrl&&typeof fetch!="undefined"}get sessionId(){var e;return(e=this.ctx)==null?void 0:e.sessionId}async recordTouchpoint(){if(!this.clientKey||!this.apiBaseUrl||typeof fetch=="undefined")return;let e=this.attributionProps;try{await fetch(`${this.apiBaseUrl}/ingestion/attribution`,{method:"POST",headers:{"content-type":"application/json","x-scalebun-client-key":this.clientKey},keepalive:!0,body:JSON.stringify({sessionId:this.sessionId,anonymousId:this.anonymousId||void 0,source:e.utm_source,medium:e.utm_medium,campaign:e.utm_campaign,content:e.utm_content,term:e.utm_term,landingUrl:e.landing_url,referrer:e.referrer,referrerDomain:e.referrer_domain,clickToken:this.clickId})})}catch{}}maybeFirstOpen(){let e=!1;try{e=typeof localStorage!="undefined"&&localStorage.getItem(rl)==="1"}catch{}if(!e){try{typeof localStorage!="undefined"&&localStorage.setItem(rl,"1")}catch{}this.track("first_open")}}getInstallationId(){return this.installationId}setClickId(e){if(!(!e||!ol.test(e))){this.clickId=e;try{typeof localStorage!="undefined"&&localStorage.setItem(si,e)}catch{}}}build(e,t){let r=ne(),s=Object.keys(this.attributionProps).length?{...this.attributionProps,...this.superProps}:this.superProps,i=Object.keys(s).length?{...s,...t}:t,o=i&&Object.keys(i).length?mt(i):void 0,a=Object.keys(this.groups).length>0;return{event_id:H(),event_name:e.trim(),event_time:P(),platform:"web",installation_id:this.installationId,...this.deviceId?{device_id:this.deviceId}:{},anonymous_id:this.anonymousId,...this.sessionId?{session_id:this.sessionId}:{},...this.userId?{user_id:this.userId}:{},...this.clickId?{identifiers:{click_id:this.clickId}}:{},...o?{properties:o}:{},...a?{groups:{...this.groups}}:{},...r?{replay:r}:{},context:{sdk_version:Os}}}get identity(){return{anonymousId:this.anonymousId,userId:this.userId,groups:this.groups,superProps:this.superProps}}evaluate(e,t){if(!this.plan)return{drop:!1};let r=_c(this.plan,e,t);if(r.warnings.length)try{for(let s of r.warnings)console.warn(`[scalebun] tracking-plan: ${s}`)}catch{}return{drop:r.drop}}register(e){!e||typeof e!="object"||(this.superProps={...this.superProps,...e},jt(Dn,this.superProps))}unregister(e){if(!(e in this.superProps))return;let{[e]:t,...r}=this.superProps;this.superProps=r,jt(Dn,this.superProps)}group(e,t,r){!e||!t||(this.groups={...this.groups,[e]:t},jt(ti,this.groups),this.usable&&this.enqueue(this.build("$group",{group_type:e,group_key:t,...r!=null?r:{}})))}alias(e,t){var s;if(!e)return;let r=(s=t!=null?t:this.userId)!=null?s:this.anonymousId;this.userId=e,ni(e),this.usable&&this.enqueue(this.build("$alias",{previous_id:r}))}reset(){this.userId=void 0,ni(void 0),this.anonymousId=ii();try{typeof localStorage!="undefined"&&localStorage.setItem(Qe,this.anonymousId)}catch{}this.cookieDomain&&oi(Qe,this.anonymousId,this.cookieDomain),this.superProps={},this.groups={},jt(Dn,this.superProps),jt(ti,this.groups)}track(e,t){if(!(!this.usable||!e)){if(!Nc(e,this.anonymousId,this.sampleRate)){this.sampledOutCount++;return}this.enqueue(this.build(e,t))}}trackPurchase(e){if(!this.usable)return;let t=Ln(e);if(!t)return;let r=this.build("purchase",t.props);r.revenue=t.revenue,r.currency=t.currency,this.enqueue(r)}trackSubscription(e){if(!this.usable)return;let t=Oc(e);if(!t)return;let r=ne();this.enqueue(this.build("$subscription",r?{...t,replay:r}:t))}identify(e,t){e&&(this.userId=e,ni(e),this.usable&&this.enqueue(this.build("$identify",t)))}enqueue(e){this.queue.push(e),this.trim(),this.queue.length>=fb&&this.autoFlush()}trim(){let e=this.queue.length-hb;e>0&&(this.queue.splice(0,e),this.droppedCount+=e)}autoFlush(){!ot()||!this.backoff.ready(P())||this.flush()}async flush(e=!1){if(!this.usable||!this.queue.length)return;let t=this.queue.splice(0,this.queue.length),r=JSON.stringify({events:t});try{let{signatureHeaders:s}=await Promise.resolve().then(()=>(Ys(),Xs)),i=await s(this.clientKey,r);(await fetch(`${this.apiBaseUrl}/batch`,{method:"POST",headers:{"content-type":"application/json","x-scalebun-client-key":this.clientKey,...i},body:r,keepalive:e})).ok?(this.backoff.reset(),this.flushCount++):(this.backoff.fail(P()),this.requeue(t))}catch{this.backoff.fail(P()),this.requeue(t)}this.persist()}requeue(e){this.queue.unshift(...e),this.trim()}async persist(){this.queue.length?(this.persisted=!0,await this.buffer.save(kt(this.queue))):this.persisted&&(this.persisted=!1,await this.buffer.clear())}teardown(){var e,t,r;(e=this.stopAutocapture)==null||e.call(this),this.stopAutocapture=void 0,this.timer&&clearInterval(this.timer),this.timer=void 0,this.onHide&&typeof window!="undefined"&&window.removeEventListener("pagehide",this.onHide),this.onHide=void 0,(t=this.offOnline)==null||t.call(this),(r=this.offSignal)==null||r.call(this),this.offSignal=void 0,this.offOnline=void 0,this.queue=[],this.persisted=!1,this.buffer.clear(),this.active=!1}};$();Fe();function kb(n,e){if(e in n)return n[e];if(e.indexOf(".")===-1)return;let t=n;for(let r of e.split(".")){if(t==null||typeof t!="object")return;t=t[r]}return t}function al(n,e){let t=kb(n,e.attr),r=e.value;switch(e.op){case"exists":return t!=null;case"eq":return t===r;case"neq":return t!==r;case"in":return Array.isArray(r)&&r.includes(t);case"nin":return Array.isArray(r)&&!r.includes(t);case"contains":return typeof t=="string"&&typeof r=="string"&&t.includes(r);case"gt":return typeof t=="number"&&typeof r=="number"&&t>r;case"lt":return typeof t=="number"&&typeof r=="number"&&t<r;default:return!1}}function Eb(n,e){var o,a;let t=(o=e.all)!=null?o:[],r=(a=e.any)!=null?a:[];if(t.length===0&&r.length===0)return!0;let s=t.every(c=>al(n,c)),i=r.length===0||r.some(c=>al(n,c));return s&&i}function Kt(n,e){if(!n||n.length===0)return null;for(let t of n)if(Eb(e,t))return t;return null}var cl="scalebun_config",ai="scalebun_flag_overrides";function Hn(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}function ll(){let n=Hn();if(!n)return null;try{let e=n.getItem(cl);if(!e)return null;let t=JSON.parse(e);return t&&typeof t.version=="string"&&Array.isArray(t.flags)?t:null}catch{return null}}function dl(n){let e=Hn();if(e)try{e.setItem(cl,JSON.stringify(n))}catch{}}function ul(){let n=Hn();if(!n)return{};try{let e=n.getItem(ai),t=e?JSON.parse(e):null;return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function $n(n){let e=Hn();if(e)try{Object.keys(n).length?e.setItem(ai,JSON.stringify(n)):e.removeItem(ai)}catch{}}var ci={version:"",flags:[],remoteConfig:[],experiments:[],rollouts:[]};var Ib=5*60*1e3,pl=n=>{var e;return(e=n.salt)!=null?e:n.key},zn=class{constructor(){this.name="config";this.ctx=null;this.active=!1;this.payload=ci;this.exposed=new Set;this.deviceId="";this.clientKey="";this.apiBaseUrl="";this.lastFetch=0;this.overrides={};this.changeListeners=new Set;this.settled=!1;this.readyPromise=new Promise(e=>this.resolveReady=e)}get isActive(){return this.active}setup(e){var t,r,s,i,o;this.ctx=e,this.deviceId=(t=e.deviceId)!=null?t:"",this.clientKey=(r=e.clientKey)!=null?r:"",this.apiBaseUrl=(s=e.apiBaseUrl)!=null?s:"",Oe({deviceId:this.deviceId}),this.overrides=ul(),this.payload=(o=(i=this.seedFromBootstrap(e.flagsBootstrap))!=null?i:ll())!=null?o:ci,this.exposed=new Set,this.refresh().finally(()=>this.markReady()),typeof document!="undefined"&&(this.onVisible=()=>{document.visibilityState==="visible"&&P()-this.lastFetch>Ib&&this.refresh()},document.addEventListener("visibilitychange",this.onVisible)),e.flagsRealtime!==!1&&this.openStream(),this.active=!0}openStream(){if(!(typeof EventSource=="undefined"||!this.clientKey||!this.apiBaseUrl))try{this.es=new EventSource(`${this.apiBaseUrl}/config/stream?key=${encodeURIComponent(this.clientKey)}`),this.es.onmessage=e=>{try{if(e.data&&JSON.parse(e.data).type==="ping")return}catch{}this.refresh()}}catch{}}seedFromBootstrap(e){return!e||typeof e!="object"||!["flags","remoteConfig","experiments","rollouts"].some(r=>Array.isArray(e[r]))?null:{version:typeof e.version=="string"?e.version:"bootstrap",flags:Array.isArray(e.flags)?e.flags:[],remoteConfig:Array.isArray(e.remoteConfig)?e.remoteConfig:[],experiments:Array.isArray(e.experiments)?e.experiments:[],rollouts:Array.isArray(e.rollouts)?e.rollouts:[],entitlements:e.entitlements,holdout:e.holdout}}markReady(){var e;this.settled||(this.settled=!0,(e=this.resolveReady)==null||e.call(this))}emitChange(){for(let e of this.changeListeners)try{e()}catch{}}async refresh(){var e,t,r,s;if(!(!this.clientKey||!this.apiBaseUrl||typeof fetch=="undefined")){this.lastFetch=P();try{let i={"x-scalebun-client-key":this.clientKey};this.payload.version&&(i["if-none-match"]=`"${this.payload.version}"`);let o=await fetch(`${this.apiBaseUrl}/config`,{headers:i});if(o.status===304||!o.ok)return;let a=await o.json();if(a&&typeof a.version=="string"){let c=a.version!==this.payload.version;this.payload={version:a.version,flags:(e=a.flags)!=null?e:[],remoteConfig:(t=a.remoteConfig)!=null?t:[],experiments:(r=a.experiments)!=null?r:[],rollouts:(s=a.rollouts)!=null?s:[],entitlements:a.entitlements,holdout:a.holdout,sdkFlags:a.sdkFlags},dl(this.payload),c&&(this.exposed.clear(),this.emitChange())}}catch{}}}ready(){return this.readyPromise}onChange(e){return this.changeListeners.add(e),()=>{this.changeListeners.delete(e)}}override(e,t){this.overrides[e]=t,$n(this.overrides),this.emitChange()}clearOverride(e){Object.prototype.hasOwnProperty.call(this.overrides,e)&&(delete this.overrides[e],$n(this.overrides),this.emitChange())}clearOverrides(){this.overrides={},$n(this.overrides),this.emitChange()}hasOverride(e){return Object.prototype.hasOwnProperty.call(this.overrides,e)}bucketingId(e){var s;let t=yt();if(e){let i=t[e];if(i!=null&&i!=="")return String(i)}if((s=this.payload.sdkFlags)!=null&&s.stableBucketingId)return this.deviceId;let r=t.userId;return r!=null&&r!==""?String(r):this.deviceId}knows(e){return!this.hasOverride(e)&&this.payload.flags.some(t=>t.key===e)}isEnabled(e){var r;if(this.hasOverride(e))return!!this.overrides[e];let t=this.payload.flags.find(s=>s.key===e);if(!t)return!1;if(t.variations&&t.variations.length)return!!this.variationDetail(e,!1).value;if(t.targeting&&t.targeting.length){let s=Kt(t.targeting,yt());if(s)return typeof s.rollout=="number"?Le(this.bucketingId(t.bucketBy),pl(t))<s.rollout:(r=s.serve)!=null?r:!0}return t.enabled}variationDetail(e,t){var c,l,u;let r=this.payload.flags.find(d=>d.key===e);if(this.hasOverride(e)){let d=this.overrides[e];if(typeof d=="string"&&(r!=null&&r.variations)){let p=r.variations.find(f=>f.key===d);if(p)return{value:p.value,variant:p.key,reason:"DEFAULT"}}return{value:d!=null?d:t,variant:typeof d=="string"?d:null,reason:"DEFAULT"}}if(!r)return{value:t,variant:null,reason:"FLAG_NOT_FOUND"};let s=r.variations,i=()=>this.bucketingId(r.bucketBy),o=(d,p)=>{var m,h;let f=(m=d!=null?d:r.defaultVariant)!=null?m:null;if(f&&s){let g=s.find(S=>S.key===f);if(g)return{value:g.value,variant:f,reason:p}}return{value:(h=r.defaultValue)!=null?h:t,variant:f,reason:p}},a=()=>{if(s&&s.some(d=>typeof d.allocationPct=="number")){let d=Zs(i(),e,s.map(p=>{var f;return{key:p.key,allocationPct:(f=p.allocationPct)!=null?f:0}}));return o(d,"ROLLOUT")}return s?o(null,"DEFAULT"):{value:r.enabled,variant:null,reason:"DEFAULT"}};if(r.targeting&&r.targeting.length){let d=Kt(r.targeting,yt());if(d)return typeof d.rollout=="number"?Le(i(),pl(r))>=d.rollout?a():s?o((c=d.variation)!=null?c:null,"ROLLOUT"):{value:!0,variant:null,reason:"ROLLOUT"}:d.variation||s?o((l=d.variation)!=null?l:null,"TARGETING_MATCH"):{value:(u=d.serve)!=null?u:!0,variant:null,reason:"TARGETING_MATCH"}}return a()}variation(e,t){return this.variationDetail(e,t).value}get(e,t){let r=this.payload.remoteConfig.find(s=>s.key===e);if(!r)return t;try{switch(r.type){case"number":{let s=Number(r.value);return Number.isFinite(s)?s:t}case"boolean":return r.value==="true";case"json":return JSON.parse(r.value);default:return r.value}}catch{return t}}isOn(e){if(this.hasOverride(e))return!!this.overrides[e];let t=this.payload.rollouts.find(s=>s.key===e);if(!t)return!1;let r=t.percentage;if(t.targeting&&t.targeting.length){let s=Kt(t.targeting,yt());s&&typeof s.percentage=="number"&&(r=s.percentage)}return Le(this.bucketingId(t.bucketBy),t.salt)<r}inHoldout(){let e=this.payload.holdout;return!!e&&e.percentage>0&&Le(this.bucketingId(),e.salt)<e.percentage}inLayerSlot(e){if(!e.layer||!e.layerRange)return!0;let[t,r]=e.layerRange,s=Le(this.bucketingId(),`layer:${e.layer}`);return s>=t&&s<r}variant(e){var o;if(this.hasOverride(e)){let a=this.overrides[e];return a==null?null:String(a)}let t=this.payload.experiments.find(a=>a.key===e);if(!t||this.inHoldout()||!this.inLayerSlot(t))return null;let r=t.variants;if(t.targeting&&t.targeting.length){let a=Kt(t.targeting,yt());if(!a||a.include===!1)return null;a.variants&&a.variants.length&&(r=a.variants)}let s=Zs(this.bucketingId(t.bucketBy),t.salt,r),i=`${e}=${s}`;if(s&&!this.exposed.has(i)){this.exposed.add(i);let a=ne();(o=this.ctx)==null||o.emit({kind:"event",name:"experiment_exposure",props:{experiment:e,variant:s,reason:"ENROLLED",...a?{$replay:a}:{}},timestamp:P()})}return s}entitlement(e){let t=this.payload.entitlements;return(t==null?void 0:t[e])!==!1}teardown(){var e;this.onVisible&&typeof document!="undefined"&&document.removeEventListener("visibilitychange",this.onVisible),this.onVisible=void 0,(e=this.es)==null||e.close(),this.es=void 0,this.active=!1}};$();$();function fl(n){return n&&n.replace(/[\w.+-]+@[\w-]+\.[\w.-]+/g,"[email]").replace(/\?[^\s:)'"]*/g,"")}function ml(n){if(!n)return n;let e=!1,t={};for(let r in n){let s=n[r];if(typeof s=="string"){let i=j(s);t[r]=i,i!==s&&(e=!0)}else t[r]=s}return e?t:n}var hl=16*1024;function gl(n,e={}){var u,d,p,f;let{droppedSince:t=0,extra:r,frames:s,fingerprint:i,causes:o,scope:a}=e,c=n.stack;return!c&&n.source&&(c=`${n.message} at ${n.source}:${(u=n.lineno)!=null?u:0}:${(d=n.colno)!=null?d:0}`),c&&c.length>hl&&(c=c.slice(0,hl)),c=fl(c),{kind:"error",type:n.type,message:j((p=n.message)!=null?p:""),stack:c,source:"js",...n.mechanism?{mechanism:n.mechanism}:{},...s&&s.length?{frames:s}:{},...i?{fingerprint:i}:{},...o&&o.length?{causes:o}:{},...a!=null&&a.level?{level:a.level}:{},...a!=null&&a.tags?{tags:a.tags}:{},...a!=null&&a.context?{context:a.context}:{},...Cb(),...Ab(),screenName:Rb(),clientId:`err_${H()}`,timestamp:P(),...t>0?{droppedSince:t}:{},...(f=ml(r))!=null?f:{}}}function Cb(){let n=We.snapshot();return n.length?{breadcrumbs:n}:{}}function Ab(){let n=ne();return n?{replay:n}:{}}function Rb(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}var Un=class{constructor(e){this.lastSeen=new Map;this.recent=[];this.dropped=0;var t,r,s;this.dedupWindowMs=(t=e==null?void 0:e.dedupWindowMs)!=null?t:5e3,this.capCount=(r=e==null?void 0:e.capCount)!=null?r:20,this.capWindowMs=(s=e==null?void 0:e.capWindowMs)!=null?s:1e4}accept(e){let t=Date.now();if(this.lastSeen.size>512)for(let[s,i]of this.lastSeen)t-i>=this.dedupWindowMs&&this.lastSeen.delete(s);let r=this.lastSeen.get(e);return r!=null&&t-r<this.dedupWindowMs?(this.dropped++,!1):(this.recent=this.recent.filter(s=>t-s<this.capWindowMs),this.recent.length>=this.capCount?(this.dropped++,!1):(this.lastSeen.set(e,t),this.recent.push(t),!0))}takeDropped(){let e=this.dropped;return this.dropped=0,e}};var It={tags:{},context:{}};function bl(n,e){It.tags[n]=e}function yl(n,e){It.context[n]=e}function vl(n){It.level=n}function wl(n){var i;let e={...It.tags,...n==null?void 0:n.tags},t={...It.context,...n==null?void 0:n.context},r=(i=n==null?void 0:n.level)!=null?i:It.level,s={};return r&&(s.level=r),Object.keys(e).length&&(s.tags=e),Object.keys(t).length&&(s.context=t),s}Fe();var Tb="wzb-errors-v1";function xl(n,e){return n==null||n>=1?!0:n<=0?!1:e?Le(e,Tb)<n*100:!0}$();var Bb=()=>[];function Fb(n){if(!n)return"";let e=n.split(`
716
- `).find(t=>/\bat\b|@/.test(t));return(e!=null?e:"").trim().slice(0,200)}var Ll=["ResizeObserver loop limit exceeded","ResizeObserver loop completed with undelivered notifications"];function _l(n,e){return typeof n=="string"?e.includes(n):n.test(e)}var Vn=class{constructor(){this.name="errors";this.ctx=null;this.active=!1;this.throttle=new Un;this.ignore=Ll;this.denyUrls=[];this.captureResourceErrors=!1;this.sampled=!0;this.counters={captured:0,droppedThrottle:0,droppedIgnore:0,droppedBeforeSend:0,byType:{},lastFingerprint:void 0}}stats(){return{captured:this.counters.captured,droppedThrottle:this.counters.droppedThrottle,droppedIgnore:this.counters.droppedIgnore,droppedBeforeSend:this.counters.droppedBeforeSend,byType:{...this.counters.byType},lastFingerprint:this.counters.lastFingerprint,breadcrumbs:We.snapshot().length,sampled:this.sampled}}get isActive(){return this.active}setup(e){var r,s,i;this.ctx=e;let t=e.errorsOptions;t&&(this.ignore=[...Ll,...(r=t.ignoreErrors)!=null?r:[]],this.denyUrls=(s=t.denyUrls)!=null?s:[],this.captureResourceErrors=(i=t.captureResourceErrors)!=null?i:!1,this.beforeSend=t.beforeSend),this.sampled=xl(t==null?void 0:t.sampleRate,e.sessionId),Promise.resolve().then(()=>(Pl(),Ml)).then(o=>{this.parseStack=o.parseStack,this.computeFingerprint=o.computeFingerprint,this.extractCauses=o.extractCauses}).catch(()=>{}),typeof window!="undefined"&&(this.onError=o=>{var l,u;let a=o.target;if(!!a&&a!==window&&typeof a.tagName=="string"&&!o.error&&!o.message){if(!this.captureResourceErrors)return;let d=a.src||a.href||"";this.handleAuto({type:"fatal",message:`Failed to load ${a.tagName.toLowerCase()}${d?` ${d}`:""}`,source:d,mechanism:"resource"});return}this.handleAuto({type:"fatal",message:o.message||((l=o.error)==null?void 0:l.message)||"Uncaught error",stack:(u=o.error)==null?void 0:u.stack,source:o.filename,lineno:o.lineno,colno:o.colno,mechanism:"onerror"},o.error)},this.onRejection=o=>{var c;let a=o.reason;this.handleAuto({type:"unhandledrejection",message:(c=a==null?void 0:a.message)!=null?c:String(o.reason),stack:a==null?void 0:a.stack,mechanism:"onunhandledrejection"},o.reason)},this.sampled&&(window.addEventListener("error",this.onError,!0),window.addEventListener("unhandledrejection",this.onRejection)),this.active=!0)}shouldIgnore(e){for(let t of this.ignore)if(_l(t,e.message))return!0;if(e.source){for(let t of this.denyUrls)if(_l(t,e.source))return!0}return!1}handleAuto(e,t){if(this.shouldIgnore(e)){this.counters.droppedIgnore++;return}let r=`${e.type}|${e.message}|${Fb(e.stack)}`;if(!this.throttle.accept(r)){this.counters.droppedThrottle++;return}this.buildAndEmit(e,{droppedSince:this.throttle.takeDropped(),original:t})}captureHandled(e,t,r){var i;let s=e;this.buildAndEmit({type:"handled",message:(i=s==null?void 0:s.message)!=null?i:String(e),stack:s==null?void 0:s.stack,mechanism:"captureError"},{extra:t,scopeOver:r,original:e})}buildAndEmit(e,t){var a,c,l,u,d,p,f,m,h;let r=(a=this.parseStack)==null?void 0:a.call(this,e.stack),s=(u=(c=t.scopeOver)==null?void 0:c.fingerprint)!=null?u:(l=this.computeFingerprint)==null?void 0:l.call(this,e.type,r,e.message),i=t.original!=null&&this.extractCauses?this.extractCauses(t.original,(d=this.parseStack)!=null?d:Bb):void 0,o=gl(e,{droppedSince:t.droppedSince,extra:t.extra,frames:r,fingerprint:s,causes:i,scope:wl(t.scopeOver)});if(this.beforeSend)try{let g=this.beforeSend(o);if(!g){this.counters.droppedBeforeSend++;return}o=g}catch{}(p=this.ctx)==null||p.emit(o),this.counters.captured++,this.counters.byType[e.type]=((f=this.counters.byType[e.type])!=null?f:0)+1,s&&(this.counters.lastFingerprint=s),(h=this.ctx)==null||h.signal("error",{fingerprint:s,type:e.type,message:((m=e.message)!=null?m:"").slice(0,200),handled:e.type==="handled"})}teardown(){typeof window!="undefined"&&(this.onError&&window.removeEventListener("error",this.onError,!0),this.onRejection&&window.removeEventListener("unhandledrejection",this.onRejection),this.active=!1)}};var di;function Db(){return di||(di=typeof TextEncoder!="undefined"?new TextEncoder:void 0)}function Wn(n){try{let e=Db();return e?e.encode(n).length:unescape(encodeURIComponent(n)).length}catch{return n.length}}function jn(n){try{return n==null?void 0:typeof n=="string"?Wn(n):typeof URLSearchParams!="undefined"&&n instanceof URLSearchParams?Wn(n.toString()):typeof Blob!="undefined"&&n instanceof Blob?n.size:n instanceof ArrayBuffer||ArrayBuffer.isView(n)?n.byteLength:void 0}catch{return}}function Gt(n){if(!n)return;let e=parseInt(n,10);return Number.isFinite(e)&&e>=0?e:void 0}function lt(){return typeof performance!="undefined"&&typeof performance.now=="function"?performance.now():Date.now()}function Ol(n,e,t,r){let s=n.fetch;return typeof s!="function"?()=>{}:(n.fetch=async function(o,a){var S,v,y,b,w,x,I,k,C,M,R;let c=Hb(o),l=$b(o,a);if(t(c))return s.call(this,o,a);let u,d=a,p=r==null?void 0:r(c);if(p){u=p.traceId;let A=new Headers((S=a==null?void 0:a.headers)!=null?S:o instanceof Request?o.headers:void 0);A.set("traceparent",p.header),d={...a,headers:A}}let f=Date.now(),m=lt(),h=zb(d==null?void 0:d.body),g=Ub(o,d);try{let A=await s.call(this,o,d),O=null;try{O=typeof A.clone=="function"?A.clone():null}catch{O=null}return e({method:l,url:c,status:A.status,startedAt:f,duration:Math.round(lt()-m),requestSize:(y=jn(d==null?void 0:d.body))!=null?y:Gt((v=g==null?void 0:g.get)==null?void 0:v.call(g,"content-length")),responseSize:Gt((w=(b=A.headers)==null?void 0:b.get)==null?void 0:w.call(b,"content-length")),reqBody:h,reqContentType:(I=(x=g==null?void 0:g.get)==null?void 0:x.call(g,"content-type"))!=null?I:void 0,resContentType:(M=(C=(k=A.headers)==null?void 0:k.get)==null?void 0:C.call(k,"content-type"))!=null?M:void 0,readResponseText:O?()=>qb(O):void 0,traceId:u}),A}catch(A){let O=A,z=(O==null?void 0:O.name)==="AbortError",D=(O==null?void 0:O.name)==="TimeoutError";throw e({method:l,url:c,status:0,startedAt:f,duration:Math.round(lt()-m),error:(R=O==null?void 0:O.message)!=null?R:"network error",aborted:z,timedOut:D}),A}},()=>{n.fetch=s})}var Kn=64*1024;async function qb(n){try{let e=n.body;if(!e||typeof e.getReader!="function"){let i=await n.text();return i.length>Kn?i.slice(0,Kn):i}let t=e.getReader(),r=typeof TextDecoder!="undefined"?new TextDecoder:void 0,s="";for(;;){let{done:i,value:o}=await t.read();if(i)break;if(o&&r&&(s+=r.decode(o,{stream:!0})),s.length>=Kn){try{await t.cancel()}catch{}return s.slice(0,Kn)}}return r&&(s+=r.decode()),s}catch{return null}}function Hb(n){return typeof n=="string"?n:n instanceof URL?n.href:n.url}function $b(n,e){var r;let t=(r=e==null?void 0:e.method)!=null?r:typeof n!="string"&&!(n instanceof URL)?n.method:void 0;return(t!=null?t:"GET").toUpperCase()}function zb(n){if(typeof n=="string")return n;if(typeof URLSearchParams!="undefined"&&n instanceof URLSearchParams)return n.toString()}function Ub(n,e){try{if(e!=null&&e.headers)return new Headers(e.headers);if(typeof Request!="undefined"&&n instanceof Request)return n.headers}catch{}}function Nl(n,e,t,r){let s=n.XMLHttpRequest;if(typeof s!="function")return()=>{};let i=s.prototype.open,o=s.prototype.send,a=s.prototype.setRequestHeader;return s.prototype.open=function(c,l,...u){return this.__scalebun={method:String(c).toUpperCase(),url:String(l)},i.call(this,c,l,...u)},s.prototype.setRequestHeader=function(c,l){return this.__scalebun&&typeof c=="string"&&c.toLowerCase()==="content-type"&&(this.__scalebun.reqContentType=String(l)),a.call(this,c,l)},s.prototype.send=function(c){let l=this.__scalebun;if(l&&!t(l.url)){let u=r==null?void 0:r(l.url);if(u){l.traceId=u.traceId;try{this.setRequestHeader("traceparent",u.header)}catch{}}let d=Date.now(),p=lt(),f=typeof c=="string"?c:void 0,m=jn(c),h=!1,g=!1;this.addEventListener("abort",()=>{h=!0}),this.addEventListener("timeout",()=>{g=!0}),this.addEventListener("loadend",()=>{let S=this.status===0;e({method:l.method,url:l.url,status:this.status||0,startedAt:d,duration:Math.round(lt()-p),requestSize:m,responseSize:Wb(this),error:S?h?"aborted":g?"timeout":"network error":void 0,aborted:h,timedOut:g,reqBody:f,reqContentType:l.reqContentType,resContentType:Vb(this,"content-type"),readResponseText:async()=>{try{return typeof this.responseText=="string"?this.responseText:null}catch{return null}},traceId:l.traceId})})}return o.call(this,c)},()=>{s.prototype.open=i,s.prototype.send=o,s.prototype.setRequestHeader=a}}function Vb(n,e){var t,r;try{return(r=(t=n.getResponseHeader)==null?void 0:t.call(n,e))!=null?r:void 0}catch{return}}function Wb(n){var t;let e=Gt((t=n.getResponseHeader)==null?void 0:t.call(n,"content-length"));if(e!=null)return e;try{return typeof n.responseText=="string"?Wn(n.responseText):void 0}catch{return}}$();function Bl(n){let{status:e,error:t,aborted:r,timedOut:s}=n;if(r)return"abort";if(s)return"timeout";if((e===0||e===void 0)&&t)return jb(t)?"abort":Kb(t)?"timeout":Gb(t)?"cors":"network_error";if(typeof e=="number"){if(e>=500)return"http_5xx";if(e>=400)return"http_4xx"}}function Fl(n,e=2e3){return typeof n=="number"&&n>=e}function jb(n){return/\babort(ed)?\b/i.test(n)}function Kb(n){return/\btimed?\s*out\b|\btimeout\b/i.test(n)}function Gb(n){return/\bcors\b|cross-origin|access-control|opaque/i.test(n)}var Xb=/^(?:\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{16,}|[0-9A-HJKMNP-TV-Z]{26})$/i;function Yb(n){return n?!!(Xb.test(n)||n.length>=12&&/\d/.test(n)&&/^[A-Za-z0-9_-]+$/.test(n)):!1}function Dl(n){let e=n;try{let s=typeof location!="undefined"?location.href:"http://x";e=new URL(n,s).pathname}catch{let s=e.indexOf("?");s>=0&&(e=e.slice(0,s));let i=e.indexOf("#");i>=0&&(e=e.slice(0,i))}if(e==="/"||e==="")return e||"/";let t=e.split("/"),r=!1;for(let s=0;s<t.length;s++){let i=t[s];i!==void 0&&Yb(i)&&(t[s]=":id",r=!0)}return r?t.join("/"):e}function ql(n,e={}){var a,c;let t=(a=n.protocol)!=null?a:"http",r=t==="http"||t==="beacon"?Bl({status:n.status,error:n.error,aborted:n.aborted,timedOut:n.timedOut}):void 0,s=Fl(n.duration,(c=e.slowMs)!=null?c:2e3),i=Dl(n.url);return{kind:"network",method:n.method,url:n.url,status:n.status,startedAt:n.startedAt,duration:n.duration,error:n.error,requestSize:n.requestSize,responseSize:n.responseSize,route:i,screenName:Jb(),...t!=="http"?{protocol:t}:{},...r?{failure:r}:{},...s?{slow:!0}:{},...n.transferSize!==void 0?{transferSize:n.transferSize}:{},...n.graphql?{graphql:n.graphql}:{},...n.timing?{timing:n.timing}:{},...n.ws?{ws:n.ws}:{},...n.request?{request:n.request}:{},...n.response?{response:n.response}:{},...n.traceId?{traceId:n.traceId}:{},clientId:`net_${H()}`,timestamp:P()}}function Jb(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}function Hl(n){let e=new Uint8Array(n),t=globalThis.crypto;if(t&&typeof t.getRandomValues=="function")t.getRandomValues(e);else for(let s=0;s<n;s++)e[s]=Math.floor(Math.random()*256);let r="";for(let s of e)r+=s.toString(16).padStart(2,"0");return r}function Qb(){let n=Hl(16),e=Hl(8);return{traceId:n,spanId:e,header:`00-${n}-${e}-01`}}function Zb(n){try{let e=typeof location!="undefined"?location.href:void 0;return new URL(n,e).origin}catch{return null}}function $l(n){if(!n.length)return null;let e=new Set(n);return t=>{let r=Zb(t);return r&&e.has(r)?Qb():null}}var ey=new Set(["fetch","xmlhttprequest"]);function ty(n){let e={},t=n.domainLookupEnd-n.domainLookupStart,r=n.connectEnd-n.connectStart,s=n.secureConnectionStart>0?n.connectEnd-n.secureConnectionStart:0,i=n.responseStart-n.requestStart,o=n.responseEnd-n.responseStart;t>0&&(e.dns=Xt(t)),r>0&&(e.tcp=Xt(r)),s>0&&(e.tls=Xt(s)),i>0&&(e.ttfb=Xt(i)),o>0&&(e.download=Xt(o));let a={};return Object.keys(e).length&&(a.timing=e),typeof n.transferSize=="number"&&n.transferSize>0&&(a.transferSize=n.transferSize),a}function Xt(n){return Math.round(n*100)/100}var Ct=class Ct{constructor(){this.byUrl=new Map;this.timeOriginMs=0}install(){var e;if(typeof PerformanceObserver=="undefined"||typeof performance=="undefined")return!1;this.timeOriginMs=(e=performance.timeOrigin)!=null?e:0;try{return this.observer=new PerformanceObserver(t=>{for(let r of t.getEntries()){let s=r;ey.has(s.initiatorType)&&this.add(s)}}),this.observer.observe({type:"resource",buffered:!0}),!0}catch{return!1}}add(e){let t=e.name,r=this.byUrl.get(t);r||(r=[],this.byUrl.set(t,r)),r.push(e),r.length>Ct.MAX_PER_URL&&r.shift(),this.prune()}match(e,t){let r=this.byUrl.get(e);if(!r||!r.length)return{};let s=t-this.timeOriginMs,i=0,o=1/0;for(let c=0;c<r.length;c++){let l=r[c];if(!l)continue;let u=Math.abs(l.startTime-s);u<o&&(o=u,i=c)}let[a]=r.splice(i,1);return r.length||this.byUrl.delete(e),a?ty(a):{}}prune(){if(typeof performance=="undefined")return;let e=performance.now()-Ct.TTL_MS;for(let[t,r]of this.byUrl){let s=r.filter(i=>i.startTime>=e);s.length?this.byUrl.set(t,s):this.byUrl.delete(t)}}teardown(){var e;(e=this.observer)==null||e.disconnect(),this.observer=void 0,this.byUrl.clear()}};Ct.TTL_MS=6e4,Ct.MAX_PER_URL=8;var Xn=Ct;Fe();function zl(n,e){if(n.failed||n.slow)return!0;let t=e>=1?1:e<=0?0:e;return t>=1?!0:t<=0?!1:Ee(n.key)%1e4<Math.round(t*1e4)}var Yn=class{constructor(e,t,r){this.windowMs=e;this.emit=t;this.onSuppress=r;this.map=new Map}push(e){var s,i,o,a;let t=`${e.method}|${(s=e.route)!=null?s:e.url}|${(o=(i=e.status)!=null?i:e.error)!=null?o:""}`,r=this.map.get(t);return r?(r.count++,r.item=e,clearTimeout(r.timer),r.timer=setTimeout(()=>this.flush(t),this.windowMs),(a=this.onSuppress)==null||a.call(this),!1):(this.map.size>=500&&this.evictOldest(),this.map.set(t,{count:0,item:e,timer:setTimeout(()=>this.flush(t),this.windowMs)}),this.emit(e),!0)}flush(e){let t=this.map.get(e);this.map.delete(e),t&&t.count>0&&this.emit({...t.item,repeat:t.count})}evictOldest(){let e=this.map.keys().next().value;if(e!==void 0){let t=this.map.get(e);t&&clearTimeout(t.timer),this.flush(e)}}get pending(){return this.map.size}dispose(){for(let e of this.map.values())clearTimeout(e.timer);this.map.clear()}};function ay(n,e){return typeof n=="string"?e.includes(n):n.test(e)}var Qn=class{constructor(){this.name="network";this.active=!1;this.uninstalls=[];this.slowMs=2e3;this.sampleRate=1;this.dedupMs=0;this.denyUrls=[];this.timingIndex=new Xn;this.timingOn=!1;this.counters={captured:0,byProtocol:{http:0,ws:0,sse:0,beacon:0},byFailure:{http_4xx:0,http_5xx:0,network_error:0,timeout:0,cors:0,abort:0},dropped:0,sampledIn:0,bodiesCaptured:0}}stats(){return{captured:this.counters.captured,byProtocol:{...this.counters.byProtocol},byFailure:{...this.counters.byFailure},dropped:this.counters.dropped,sampledIn:this.counters.sampledIn,bodiesCaptured:this.counters.bodiesCaptured}}get isActive(){return this.active}setup(e){var u,d,p,f,m,h;if(typeof window=="undefined")return;let t=(u=e.networkOptions)!=null?u:{};this.slowMs=(d=t.slowRequestMs)!=null?d:2e3,this.sampleRate=typeof t.sampleRate=="number"?t.sampleRate:1;let r=t.dedupWindowMs;this.dedupMs=typeof r=="number"&&r>0?r:0,this.dedupMs>0&&(this.deduper=new Yn(this.dedupMs,g=>{this.record(g),e.emit(g)},()=>{this.counters.dropped++})),this.denyUrls=(p=t.denyUrls)!=null?p:[],this.beforeSend=t.beforeSend,t.captureBodies&&(this.bodyOpts={bodyMaxBytes:Math.min(Math.max(0,(f=t.bodyMaxBytes)!=null?f:8192),64*1024),contentTypeAllowlist:t.contentTypeAllowlist&&t.contentTypeAllowlist.length?t.contentTypeAllowlist:["application/json","text/plain"]}),this.timingOn=this.timingIndex.install();let s=e.apiBaseUrl,i=g=>!!s&&g.startsWith(s),o=g=>this.handle(e,g),a=(h=$l((m=e.traceOrigins)!=null?m:[]))!=null?h:void 0;this.uninstalls.push(Ol(window,o,i,a)),this.uninstalls.push(Nl(window,o,i,a));let c={ws:t.trackWebSocket!==!1,sse:t.trackSse!==!1,beacon:!0},l=typeof navigator!="undefined"?navigator:void 0;Promise.resolve().then(()=>(Gl(),Kl)).then(g=>{this.active&&this.uninstalls.push(...g.installStreams(window,l,o,i,c))}).catch(()=>{}),this.active=!0}handle(e,t){var s;if(this.denyUrls.some(i=>ay(i,t.url))){this.counters.dropped++;return}let r=(s=t.protocol)!=null?s:"http";if(this.timingOn&&r==="http"&&t.timing===void 0){setTimeout(()=>{if(!this.active)return;let i=this.timingIndex.match(t.url,t.startedAt);i.timing&&(t.timing=i.timing),i.transferSize!==void 0&&t.transferSize===void 0&&(t.transferSize=i.transferSize),this.finalize(e,t)},0);return}this.finalize(e,t)}finalize(e,t){var o;let r=(o=t.protocol)!=null?o:"http",s=r==="http"&&t.graphql===void 0&&this.maybeGraphql(t),i=!!this.bodyOpts&&r==="http";if(s||i){Promise.resolve().then(()=>(rd(),nd)).then(a=>a.enrichHttpCapture(t,{graphql:s,body:i?this.bodyOpts:void 0})).catch(()=>{}).finally(()=>{this.active&&this.emit(e,t)});return}this.emit(e,t)}maybeGraphql(e){return e.method!=="POST"?!1:/graphql/i.test(e.url)||!!e.reqBody&&e.reqBody.includes("query")}emit(e,t){let r=ql(t,{slowMs:this.slowMs});if(this.sampleRate<1){if(!zl({failed:!!r.failure,slow:!!r.slow,key:`${t.url}|${t.startedAt}`},this.sampleRate)){this.counters.dropped++;return}this.counters.sampledIn++}if(this.beforeSend)try{let s=this.beforeSend(r);if(s==null){this.counters.dropped++;return}r=s}catch{}r.failure&&r.failure!=="abort"&&e.signal("network_error"),this.emitItem(e,r)}emitItem(e,t){if(this.deduper){this.deduper.push(t);return}this.record(t),e.emit(t)}record(e){var s;this.counters.captured++;let t=(s=e.protocol)!=null?s:"http";this.counters.byProtocol[t]++;let r=e.failure;r&&this.counters.byFailure[r]++,(e.request||e.response)&&this.counters.bodiesCaptured++}teardown(){var e;for(let t of this.uninstalls)t();this.uninstalls=[],(e=this.deduper)==null||e.dispose(),this.deduper=void 0,this.timingIndex.teardown(),this.timingOn=!1,this.active=!1}};Ds();function sd(n){let e=n[n.length-1];return e&&(e.renderTime||e.loadTime||e.startTime)||0}function yi(){return{max:0,cur:0,first:0,last:0}}function id(n,e){for(let t of e){if(t.hadRecentInput||typeof t.value!="number")continue;let r=typeof t.startTime=="number"?t.startTime:n.last;n.cur>0&&r-n.last<1e3&&r-n.first<5e3?(n.cur+=t.value,n.last=r):(n.cur=t.value,n.first=r,n.last=r),n.cur>n.max&&(n.max=n.cur)}return n}function od(n,e){let t=n;for(let r of e)typeof r.duration=="number"&&r.duration>t&&(t=r.duration);return t}function vi(n){if(n)return n.replace(/[?#].*$/,"")}function ad(){if(typeof performance=="undefined"||typeof performance.getEntriesByType!="function")return;let n=performance.getEntriesByType("navigation")[0];if(!n||!(n.responseStart>0))return;let e=(t,r)=>t>0&&r>=t?Math.round(r-t):0;return{redirect:e(n.redirectStart,n.redirectEnd),worker:e(n.workerStart,n.fetchStart),dns:e(n.domainLookupStart,n.domainLookupEnd),tcp:e(n.connectStart,n.connectEnd),tls:e(n.secureConnectionStart,n.connectEnd),request:e(n.requestStart,n.responseStart)}}function cd(n){var a,c,l,u;if(typeof performance=="undefined"||typeof performance.getEntriesByType!="function")return;let e=performance.getEntriesByType("navigation")[0],t=Math.max(0,(a=e==null?void 0:e.responseStart)!=null?a:0),r=(l=(c=n.renderTime)!=null?c:n.loadTime)!=null?l:0;if(r<=0)return;let s=t,i=(u=n.loadTime)!=null?u:r;if(n.url){let d=performance.getEntriesByName(n.url)[0];d&&(s=Math.max(t,d.requestStart||d.startTime||t),i=n.loadTime||d.responseEnd||i)}let o=d=>Math.round(Math.max(0,d));return{ttfb:o(t),resourceLoadDelay:o(s-t),resourceLoadTime:n.url?o(i-s):0,elementRenderDelay:o(r-(n.url?i:t))}}function ld(n,e){let t;for(let r of n)if(!(r.end<e.start||r.start>e.end))for(let s of r.scripts)s.url&&(!t||s.dur>t.duration)&&(t={url:s.url,duration:Math.round(s.dur),fn:s.fn,invokerType:s.invokerType});return t}var cy={lcp:[2500,4e3],inp:[200,500],cls:[.1,.25],fcp:[1800,3e3],ttfb:[800,1800]};function dd(n,e){let t=cy[n];return t?e<=t[0]?"good":e<=t[1]?"needs-improvement":"poor":"unknown"}function wi(n){if(!n||typeof n.tagName!="string")return;let e=[],t=n,r=0;for(;t&&t.nodeType===1&&r<5;){if(t.id){e.unshift(`#${ud(t.id)}`);break}let s=t.getAttribute&&t.getAttribute("data-testid");if(s){e.unshift(`[data-testid="${ud(s)}"]`);break}let i=t.tagName.toLowerCase(),o=t.parentElement;if(!o){e.unshift(i);break}let a=ly(t,i);e.unshift(a>1?`${i}:nth-of-type(${a})`:i),t=o,r++}return e.length?e.join(" > "):void 0}function ly(n,e){let t=1,r=n.previousElementSibling;for(;r;)r.tagName&&r.tagName.toLowerCase()===e&&t++,r=r.previousElementSibling;return t}function ud(n){return n.replace(/([^\w-])/g,"\\$1")}function pd(n){if(n)return{x:De(n.x),y:De(n.y),width:De(n.width),height:De(n.height)}}function De(n){return typeof n=="number"&&isFinite(n)?n:0}function fd(n){if(!n)return;let e=n.element,t=typeof n.url=="string"&&n.url?n.url:void 0,r=wi(e),s=e&&typeof e.tagName=="string"?e.tagName.toLowerCase():void 0,i=typeof n.loadTime=="number"?n.loadTime:void 0,o=typeof n.renderTime=="number"?n.renderTime:void 0;if(!r&&!t&&!s&&i===void 0&&o===void 0)return;let a={};return r&&(a.element=r),s&&(a.elementTag=s),t&&(a.url=t),i!==void 0&&(a.loadTime=Yt(i)),o!==void 0&&(a.renderTime=Yt(o)),a}function xi(){return{largestValue:0,sources:[]}}function md(n,e,t=5){var r;for(let s of e){if(s.hadRecentInput)continue;let i=De(s.value);if(i<=0||i<=n.largestValue)continue;let o=s.sources||[],a=[];for(let c of o.slice(0,t)){let l=(r=c.node)!=null?r:void 0;a.push({selector:wi(l),previousRect:pd(c.previousRect),currentRect:pd(c.currentRect)})}n.largestValue=i,n.sources=a}return n}function hd(n){if(!(n.largestValue<=0||n.sources.length===0))return{largestShiftValue:Math.round(n.largestValue*1e3)/1e3,sources:n.sources}}function Si(){return{duration:0}}function gd(n,e){for(let t of e){let r=De(t.duration);r<=n.duration||(n.duration=r,n.attribution=dy(t))}return n}function dy(n){var c;let e=(c=n.target)!=null?c:void 0,t=De(n.startTime),r=De(n.processingStart),s=De(n.processingEnd),i=De(n.duration),o={},a=wi(e);return a&&(o.element=a),e&&typeof e.tagName=="string"&&(o.elementTag=e.tagName.toLowerCase()),typeof n.name=="string"&&(o.eventType=n.name),r>0&&(o.inputDelay=Yt(Math.max(0,r-t))),s>=r&&r>0&&(o.processingTime=Yt(Math.max(0,s-r))),s>0&&(o.presentationDelay=Yt(Math.max(0,t+i-s))),o}function bd(n){return n.duration>0?n.attribution:void 0}function Yt(n){return Math.round(n)}$();var er=class er{constructor(){this.name="webVitals";this.ctx=null;this.active=!1;this.disconnects=[];this.lcp=0;this.clsState=yi();this.inp=0;this.clsAcc=xi();this.inpAcc=Si();this.route="/";this.loaf=[]}get isActive(){return this.active}setup(e){this.ctx=e,typeof PerformanceObserver!="undefined"&&(this.disconnects.push(Pe("largest-contentful-paint",t=>{var s,i;let r=sd(t);r&&(this.lcp=r,this.lcpAttr=(s=fd(t[t.length-1]))!=null?s:this.lcpAttr,(i=this.lcpAttr)!=null&&i.url&&(this.lcpAttr.url=vi(this.lcpAttr.url)))})),this.disconnects.push(Pe("layout-shift",t=>{id(this.clsState,t),md(this.clsAcc,t)})),this.disconnects.push(Pe("event",t=>{let r=this.inp;for(let s of t)typeof s.duration=="number"&&s.duration>r&&typeof s.startTime=="number"&&(r=s.duration,this.inpWindow={start:s.startTime,end:s.startTime+s.duration});this.inp=od(this.inp,t),gd(this.inpAcc,t)},{durationThreshold:40})),this.disconnects.push(Pe("long-animation-frame",t=>{var r,s,i;for(let o of t){if(this.loaf.length>=er.LOAF_CAP)break;let a=(r=o.startTime)!=null?r:0,c=((s=o.scripts)!=null?s:[]).map(l=>{var u;return{url:(u=vi(l.sourceURL||l.name||""))!=null?u:"",dur:typeof l.duration=="number"?l.duration:0,fn:l.sourceFunctionName,invokerType:l.invokerType}});this.loaf.push({start:a,end:a+((i=o.duration)!=null?i:0),scripts:c})}})),this.disconnects.push(Pe("paint",t=>{let r=t.find(s=>s.name==="first-contentful-paint");r&&this.emit("fcp",r.startTime,"ms")})),this.route=vd(yd()),this.installRouteDetection(),this.emitTtfb(),typeof document!="undefined"&&(this.hideHandler=()=>{document.visibilityState==="hidden"&&this.finalizeRoute()},document.addEventListener("visibilitychange",this.hideHandler)),this.active=!0)}emitTtfb(){try{let e=typeof performance!="undefined"?performance.getEntriesByType("navigation")[0]:void 0;e&&e.responseStart>0&&this.emit("ttfb",e.responseStart,"ms",{ttfbPhases:ad()})}catch{}}finalizeRoute(){let e=this.clsState.max;if(this.lcp>0){if(this.lcpAttr){let t=cd(this.lcpAttr);t&&(this.lcpAttr.phases=t)}this.emit("lcp",this.lcp,"ms",this.lcpAttr)}if(this.inp>0){let t=bd(this.inpAcc);if(t&&this.inpWindow){let r=ld(this.loaf,this.inpWindow);r&&(t.loafScript=r)}this.emit("inp",this.inp,"ms",t)}e>0&&this.emit("cls",Math.round(e*1e3)/1e3,"score",hd(this.clsAcc)),this.lcp=this.inp=0,this.clsState=yi(),this.lcpAttr=void 0,this.clsAcc=xi(),this.inpAcc=Si(),this.loaf=[],this.inpWindow=void 0}onRouteChange(){let e=vd(yd());e!==this.route&&(this.finalizeRoute(),this.route=e)}installRouteDetection(){let e=typeof window!="undefined"?window:void 0;if(!e)return;let t=()=>this.onRouteChange(),r=e.navigation;if(r&&typeof r.addEventListener=="function"){r.addEventListener("currententrychange",t),this.routeStop=()=>r.removeEventListener("currententrychange",t);return}e.addEventListener("popstate",t);let s=e.history,i=s.pushState,o=s.replaceState,a=c=>function(...l){let u=c.apply(this,l);return t(),u};try{s.pushState=a(i),s.replaceState=a(o)}catch{}this.routeStop=()=>{e.removeEventListener("popstate",t);try{s.pushState=i,s.replaceState=o}catch{}}}emit(e,t,r,s){var o,a,c;let i={kind:"performance",metric:e,value:r==="score"?t:Math.round(t),unit:r,screenName:this.route,clientId:`vit_${H()}`,timestamp:P()};s&&(i.attribution=s),(o=this.ctx)==null||o.emit(i),(c=(a=this.ctx)==null?void 0:a.signal)==null||c.call(a,"web_vital",{metric:e,value:i.value,unit:r,rating:dd(e,i.value),path:this.route})}teardown(){var e;for(let t of this.disconnects)t();this.disconnects=[],this.hideHandler&&typeof document!="undefined"&&document.removeEventListener("visibilitychange",this.hideHandler),(e=this.routeStop)==null||e.call(this),this.routeStop=void 0,this.active=!1}};er.LOAF_CAP=30;var Zn=er;function yd(){try{return typeof location!="undefined"?location.pathname:"/"}catch{return"/"}}function vd(n){return n.replace(/\/[0-9a-f]{8,}(?=\/|$)/gi,"/:id").replace(/\/\d+(?=\/|$)/g,"/:id")||"/"}$();ki();$();var uy=()=>{try{return typeof location!="undefined"?location.pathname:void 0}catch{return}};function Jt(n,e,t={}){var r;return{kind:"performance",metric:j(n),value:Math.round(e*1e3)/1e3,unit:(r=t.unit)!=null?r:"ms",screenName:uy(),clientId:`perf_${H()}`,...t.duration!=null?{duration:Math.round(t.duration)}:{},...t.metadata?{metadata:t.metadata}:{},timestamp:P()}}var Qt=class{constructor(e){this.recent=[];this.dropped=0;var t,r;this.capCount=(t=e==null?void 0:e.capCount)!=null?t:60,this.windowMs=(r=e==null?void 0:e.windowMs)!=null?r:1e4}accept(){let e=Date.now();return this.recent=this.recent.filter(t=>e-t<this.windowMs),this.recent.length>=this.capCount?(this.dropped++,!1):(this.recent.push(e),!0)}takeDropped(){let e=this.dropped;return this.dropped=0,e}};var nr=class{constructor(e){this.open=new Map;this.dropped=0;var t,r,s;this.maxOpen=(t=e==null?void 0:e.maxOpen)!=null?t:100,this.ttlMs=(r=e==null?void 0:e.ttlMs)!=null?r:6e4,this.clock=(s=e==null?void 0:e.clock)!=null?s:Date.now}start(e){if(e){if(this.expire(),!this.open.has(e)&&this.open.size>=this.maxOpen){this.dropped++;return}this.open.set(e,this.clock())}}stop(e){this.expire();let t=this.open.get(e);return t==null?null:(this.open.delete(e),{name:e,durationMs:this.clock()-t})}expire(){let e=this.clock();for(let[t,r]of this.open)e-r>this.ttlMs&&(this.open.delete(t),this.dropped++)}takeDropped(){let e=this.dropped;return this.dropped=0,e}clear(){this.open.clear(),this.dropped=0}};$();function Sd(n){var t,r;let e=n;return{value:(t=e.duration)!=null?t:0,metadata:{startTime:Math.round((r=e.startTime)!=null?r:0)}}}function kd(n){var i,o,a,c,l,u,d,p,f,m;let e=n,t=Array.isArray(e.scripts)?e.scripts:[],r;for(let h of t)(!r||((i=h.duration)!=null?i:0)>((o=r.duration)!=null?o:0))&&(r=h);let s={frameDuration:Math.round((a=e.duration)!=null?a:0),startTime:Math.round((c=e.startTime)!=null?c:0)};if(r){let h={url:j(String((u=(l=r.sourceURL)!=null?l:r.name)!=null?u:"")),invoker:j(String((d=r.invoker)!=null?d:"")),duration:Math.round((p=r.duration)!=null?p:0)};r.sourceFunctionName&&(h.fn=String(r.sourceFunctionName)),r.sourceCharPosition!=null&&r.sourceCharPosition>=0&&(h.pos=r.sourceCharPosition),r.forcedStyleAndLayoutDuration&&(h.forcedLayout=Math.round(r.forcedStyleAndLayoutDuration)),r.invokerType&&(h.invokerType=String(r.invokerType)),s.script=h}return{value:(m=(f=e.blockingDuration)!=null?f:e.duration)!=null?m:0,metadata:s}}var py=new Set(["fetch","xmlhttprequest","beacon"]);function fy(n){return n.replace(/[?#].*$/,"")}function Zt(n,e){return n>0&&e>=n?Math.round(e-n):void 0}var Ei="";function Ed(n){Ei=(n!=null?n:"").replace(/\/$/,"")}function my(n){return!!Ei&&n.startsWith(Ei)}function Id(n){if(py.has(n.initiatorType)||my(n.name))return null;let e=Math.round(n.duration);if(e<=0)return null;let t={kind:"resource",initiator:n.initiatorType,url:fy(n.name)},r=(i,o)=>{o!==void 0&&o>0&&(t[i]=o)};r("dns",Zt(n.domainLookupStart,n.domainLookupEnd)),r("tcp",Zt(n.connectStart,n.connectEnd)),r("tls",n.secureConnectionStart>0?Zt(n.secureConnectionStart,n.connectEnd):void 0),r("ttfb",Zt(n.requestStart,n.responseStart)),r("download",Zt(n.responseStart,n.responseEnd)),r("transferSize",n.transferSize||void 0),r("encodedSize",n.encodedBodySize||void 0),r("decodedSize",n.decodedBodySize||void 0);let s=n.renderBlockingStatus;return s&&(t.renderBlocking=s),{value:e,metadata:t}}function Cd(n){if(typeof window=="undefined"||typeof history=="undefined"||typeof location=="undefined")return()=>{};let e=()=>location.pathname+location.search,t=e(),r=()=>{let o=e();if(o!==t){t=o;try{n(o)}catch{}}},s=history.pushState,i=history.replaceState;return history.pushState=function(...a){let c=s.apply(this,a);return r(),c},history.replaceState=function(...a){let c=i.apply(this,a);return r(),c},window.addEventListener("popstate",r),window.addEventListener("hashchange",r),()=>{history.pushState=s,history.replaceState=i,window.removeEventListener("popstate",r),window.removeEventListener("hashchange",r)}}Fe();var hy="wzb-traces-v1";function Ad(n){return n.durationMs>=n.slowMs||n.hasError||n.sampleRate>=1?!0:n.sampleRate<=0?!1:Ee(`${n.traceId}:${hy}`)%100<n.sampleRate*100}ir();var by=1e3,yy=3e3,vy=()=>typeof performance!="undefined"&&performance.now?performance.now():Date.now();function wy(){try{let n=typeof PerformanceObserver!="undefined"&&PerformanceObserver.supportedEntryTypes;return Array.isArray(n)&&n.includes("long-animation-frame")}catch{return!1}}var cr=class{constructor(){this.name="performance";this.ctx=null;this.active=!1;this.disconnects=[];this.cap=new Qt;this.resCap=new Qt({capCount:100,windowMs:1e4});this.traces=new nr;this.pageloadEmitted=!1;this.tracesSampleRate=1;this.slowTxnMs=yy;this.droppedTxns=0;this.txnCount=0;this.resourceCount=0;this.jankCount=0}get isActive(){return this.active}setup(e){if(this.active)return;this.ctx=e,Ed(e.apiBaseUrl);let t=e.performanceOptions;t&&(typeof t.tracesSampleRate=="number"&&(this.tracesSampleRate=t.tracesSampleRate),typeof t.slowTransactionMs=="number"&&(this.slowTxnMs=t.slowTransactionMs)),Promise.resolve().then(()=>(Nd(),Od)).then(s=>{this.engine=s,this.tryEmitPageload()}).catch(()=>{});let r=()=>{var i,o;let s=(o=(i=performance.getEntriesByType)==null?void 0:i.call(performance,"navigation"))==null?void 0:o[0];s&&(this.navEntry=s,this.tryEmitPageload())};if(typeof document!="undefined"&&document.readyState==="complete"?r():typeof window!="undefined"&&window.addEventListener("load",()=>setTimeout(r,0),{once:!0}),this.disconnects.push(Cd(s=>this.onRouteChange(s))),typeof window!="undefined"){let s=()=>this.finishRouteTxn();window.addEventListener("pagehide",s),this.disconnects.push(()=>window.removeEventListener("pagehide",s))}if(e.onSignal&&this.disconnects.push(e.onSignal(s=>{var i;s==="error"&&((i=this.activeTxn)==null||i.noteError())})),typeof PerformanceObserver=="undefined"){this.active=!0;return}wy()?this.disconnects.push(Pe("long-animation-frame",s=>{for(let i of s)this.emitCapped("loaf",i,kd(i))})):this.disconnects.push(Pe("longtask",s=>{for(let i of s)this.emitCapped("longtask",i,Sd(i))})),this.disconnects.push(Pe("resource",s=>{for(let i of s){let o=Id(i);o&&this.emitResource(o)}})),this.active=!0}emitResource(e){var s;if(!this.resCap.accept())return;let t=this.resCap.takeDropped(),r=t>0?{...e.metadata,droppedSince:t}:e.metadata;this.resourceCount++,(s=this.ctx)==null||s.emit(Jt("resource",e.value,{unit:"ms",duration:e.value,metadata:r}))}perfStats(){return{transactions:this.txnCount,droppedTransactions:this.droppedTxns,resources:this.resourceCount,jank:this.jankCount,activeTransaction:!!this.activeTxn,sampleRate:this.tracesSampleRate}}emitCapped(e,t,r){var a,c,l;if(!this.cap.accept())return;let s=this.cap.takeDropped(),i=s>0?{...r.metadata,droppedSince:s}:r.metadata;this.jankCount++,(a=this.ctx)==null||a.emit(Jt(e,r.value,{unit:"ms",metadata:i}));let o=i.script;wd({metric:e,blockingMs:r.value,frameDurationMs:e==="loaf"?Number((c=i.frameDuration)!=null?c:t.duration):t.duration,script:o?{url:o.url,invoker:o.invoker}:void 0}),(l=this.activeTxn)==null||l.addSpan(e,t.startTime,t.startTime+t.duration,r.metadata)}startTransaction(e){if(!this.engine)return sr;let t=new this.engine.Transaction(e,{clock:vy,onFinish:r=>this.emitTransaction(r)});return this.activeTxn=t,t}getActiveTraceContext(){var e;return(e=this.activeTxn)==null?void 0:e.context()}emitTransaction(e){this.activeTxn===e&&(this.activeTxn=void 0),this.emitTransactionData(e.data())}emitTransactionData(e){var r,s,i,o;if(e.durationMs>=this.slowTxnMs&&((s=(r=this.ctx)==null?void 0:r.signal)==null||s.call(r,"slow_screen")),!Ad({traceId:e.traceId,durationMs:e.durationMs,slowMs:this.slowTxnMs,sampleRate:this.tracesSampleRate,hasError:((i=e.errorCount)!=null?i:0)>0})){this.droppedTxns++;return}this.txnCount++;let t=ne();(o=this.ctx)==null||o.emit(Jt("transaction",e.durationMs,{unit:"ms",duration:e.durationMs,metadata:{kind:"transaction",name:e.name,trace:{traceId:e.traceId,spanId:e.spanId,sampled:e.sampled},spans:e.spans,...e.droppedSpans?{droppedSpans:e.droppedSpans}:{},...e.errorCount?{errorCount:e.errorCount}:{},...t?{replay:t}:{}}}))}tryEmitPageload(){if(this.pageloadEmitted||!this.engine||!this.navEntry||!this.navEntry.loadEventEnd)return;this.pageloadEmitted=!0;let e=typeof location!="undefined"?location.pathname:"/";this.emitTransactionData(this.engine.buildPageload(this.navEntry,e))}onRouteChange(e){this.finishRouteTxn(),this.routeTxn=this.startTransaction(`navigation ${e}`),typeof setTimeout!="undefined"&&(this.routeTimer=setTimeout(()=>this.finishRouteTxn(),by))}finishRouteTxn(){var e;this.routeTimer!==void 0&&(clearTimeout(this.routeTimer),this.routeTimer=void 0),(e=this.routeTxn)==null||e.finish(),this.routeTxn=void 0}startTrace(e){this.traces.start(e)}stopTrace(e){var r;let t=this.traces.stop(e);t&&((r=this.ctx)==null||r.emit(Jt(t.name,t.durationMs,{unit:"ms",duration:t.durationMs,metadata:{kind:"trace"}})))}teardown(){this.finishRouteTxn();for(let e of this.disconnects)e();this.disconnects=[],this.traces.clear(),this.active=!1}};$();var dr=class{constructor(e){this.onScreen=e;this.last="";this.cleanup=[]}start(){if(typeof window!="undefined"){if(typeof document!="undefined"&&document.prerendering){let e=()=>this.begin();document.addEventListener("prerenderingchange",e,{once:!0}),this.cleanup.push(()=>document.removeEventListener("prerenderingchange",e));return}this.begin()}}begin(){this.last=lr(),this.onScreen("",this.last);let e=window.navigation;if(e&&typeof e.addEventListener=="function"){let a=c=>{var u;let l=(u=c.destination)==null?void 0:u.url;this.check(l?xy(l):lr())};e.addEventListener("navigate",a),this.cleanup.push(()=>e.removeEventListener("navigate",a))}let t=history,r=t.pushState,s=t.replaceState,i=()=>this.check();t.pushState=function(...a){let c=r.apply(this,a);return i(),c},t.replaceState=function(...a){let c=s.apply(this,a);return i(),c},this.cleanup.push(()=>{t.pushState=r,t.replaceState=s});let o=()=>this.check();window.addEventListener("popstate",o),window.addEventListener("pageshow",o),this.cleanup.push(()=>{window.removeEventListener("popstate",o),window.removeEventListener("pageshow",o)})}check(e=lr()){if(e&&e!==this.last){let t=this.last;this.last=e,this.onScreen(t,e)}}stop(){for(let e of this.cleanup)e();this.cleanup=[]}};function lr(){try{return typeof location!="undefined"?location.pathname:""}catch{return""}}function xy(n){try{return new URL(n).pathname}catch{return lr()}}var ur=class{constructor(e=800,t=30,r=3){this.windowMs=e;this.radius=t;this.min=r;this.history=[]}push(e,t,r){this.history=this.history.filter(i=>r-i.t<this.windowMs);let s=this.history.filter(i=>Math.hypot(i.x-e,i.y-t)<=this.radius);return this.history.push({x:e,y:t,t:r}),s.length+1>=this.min}},pr=class{constructor(e=700){this.deadMs=e;this.lastChangeT=0;this.observer=null;this.timers=new Set;this.startHref=""}observe(e){typeof MutationObserver!="undefined"&&(this.startHref=Bd(),this.observer=new MutationObserver(()=>{this.lastChangeT=Date.now()}),this.observer.observe(e,{subtree:!0,childList:!0,attributes:!0,characterData:!0}))}onClick(e,t){let r=setTimeout(()=>{this.timers.delete(r),this.lastChangeT<e&&Bd()===this.startHref&&t()},this.deadMs);this.timers.add(r)}disconnect(){var e;(e=this.observer)==null||e.disconnect(),this.observer=null;for(let t of this.timers)clearTimeout(t);this.timers.clear()}};function Bd(){try{return typeof location!="undefined"?location.href:""}catch{return""}}function Fd(n){let e=0;for(let t=n;t;t=t.parentElement){let r=getComputedStyle(t).position;if(r==="fixed")return 1;r==="sticky"&&(e=2)}return e}var fr=class{constructor(e,t={},r){this.emit=e;this.signal=r;var s,i,o,a,c;this.rage=new ur((s=t.rageWindowMs)!=null?s:800,(i=t.rageRadius)!=null?i:30,(o=t.rageMin)!=null?o:3),this.dead=new pr((a=t.deadMs)!=null?a:700),this.maskText=(c=t.maskText)!=null?c:!1}start(){typeof document!="undefined"&&(this.dead.observe(document),this.onClickFn=e=>{var d;let t=e,r=Date.now(),s=e.target;if(!s||!s.tagName)return;let i=Ay(s,this.maskText),o=Ry(s),a=Sy(t),c=ky(s),l=this.rage.push(t.clientX,t.clientY,r),u={action:"click",...a,selector:o,...c};l&&(u.rage=!0),this.emit("USER_ACTION",u,i),l&&((d=this.signal)==null||d.call(this,"rage")),this.dead.onClick(r,()=>{var p;this.emit("USER_ACTION",{action:"click",...a,selector:o,...c,dead:!0},i),(p=this.signal)==null||p.call(this,"dead")})},document.addEventListener("click",this.onClickFn,!0))}stop(){this.dead.disconnect(),this.onClickFn&&typeof document!="undefined"&&document.removeEventListener("click",this.onClickFn,!0)}};function Sy(n){var t,r,s;let e=typeof window!="undefined"?window:void 0;return{x:n.clientX,y:n.clientY,vw:(t=e==null?void 0:e.innerWidth)!=null?t:0,vh:(r=e==null?void 0:e.innerHeight)!=null?r:0,sx:e?Math.round(e.scrollX):0,sy:e?Math.round(e.scrollY):0,dh:document.documentElement.scrollHeight,dpr:(s=e==null?void 0:e.devicePixelRatio)!=null?s:1}}function ky(n){var o;let e=n.getBoundingClientRect(),t={ex:e.x|0,ey:e.y|0,ew:e.width|0,eh:e.height|0},r=Fd(n);r&&(t.fx=r),t.path=Iy(n);let s=Ey();s&&(t.ui=s);let i=(o=n.closest("[data-scalebun-component]"))==null?void 0:o.getAttribute("data-scalebun-component");return i&&(t.component=i),t}function Ey(){let n=[];return document.querySelectorAll('[aria-expanded="true"],dialog[open]').forEach(e=>{let t=e.getAttribute("aria-controls")||e.getAttribute("aria-label")||e.id;t&&n.push(t)}),n.length?n.sort().join("|").slice(0,64):void 0}function Iy(n){let e=[],t=n;for(let r=0;t&&r<6;r++){let s=t.tagName.toLowerCase();if(s==="html"||s==="body")break;if(t.id){e.unshift(`${s}#${t.id}`);break}let i=t.parentElement;if(i){let o=0,a=0,c=i.children,l=t;for(let u=0;u<c.length;u++){let d=c[u];!d||d.tagName!==l.tagName||(a++,d===l&&(o=a))}e.unshift(a>1?`${s}:nth-of-type(${o})`:s)}else e.unshift(s);t=i}return e.join(">")}var Cy=n=>n.replace(/\S/g,"*");function Ay(n,e=!1){let t=n.tagName.toLowerCase(),r=(n.textContent||"").trim().slice(0,40);return r?`${t}: ${e?Cy(r):r}`:t}function Ry(n){let e=n.tagName.toLowerCase();n.id&&(e+=`#${n.id}`);let t=(n.getAttribute("class")||"").trim().split(/\s+/).filter(Boolean).slice(0,2);return t.length&&(e+="."+t.join(".")),e}var mr=class{constructor(){this.name="journey";this.ctx=null;this.active=!1}get isActive(){return this.active}setup(e){this.ctx=e,!(typeof window=="undefined"||typeof document=="undefined")&&(this.nav=new dr((t,r)=>this.emit("SCREEN_VIEW",{from:t,to:r},void 0,r)),this.interactions=new fr((t,r,s)=>this.emit(t,r,s,Dd()),{maskText:e.maskEventText===!0},t=>{var r;return(r=this.ctx)==null?void 0:r.signal(t)}),this.nav.start(),this.interactions.start(),this.active=!0)}emit(e,t,r,s){var a;let i=ne(),o={kind:"event",name:e,props:i?{...t,replayCoord:i}:t,label:r,screenName:s!=null?s:Dd(),eventId:`evt_${H()}`,timestamp:P()};(a=this.ctx)==null||a.emit(o)}teardown(){var e,t;(e=this.nav)==null||e.stop(),(t=this.interactions)==null||t.stop(),this.active=!1}};function Dd(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}_s();$();var Ty={maxDepth:4,maxBreadth:50,maxLength:8192};function Ci(n,e,t,r){if(n===null)return"null";if(n===void 0)return"undefined";let s=typeof n;if(s==="string")return n;if(s==="number"||s==="boolean"||s==="bigint")return String(n);if(s==="symbol")return n.toString();if(s==="function"){let o=n.name;return`[Function${o?`: ${o}`:""}]`}let i=n;if(t.has(i))return"[Circular]";if(n instanceof Error)return`${n.name}: ${n.message}`;if(e>=r.maxDepth)return Array.isArray(n)?"[Array]":"[Object]";t.add(i);try{if(Array.isArray(n)){let d=n.slice(0,r.maxBreadth).map(f=>Ci(f,e+1,t,r)),p=n.length>r.maxBreadth?`, \u2026(+${n.length-r.maxBreadth} more)`:"";return`[${d.join(", ")}${p}]`}if(n instanceof Map)return`Map(${n.size})`;if(n instanceof Set)return`Set(${n.size})`;let o=n.nodeName;if(typeof o=="string"){let d=n.id;return`<${o.toLowerCase()}${d?` #${String(d)}`:""}>`}let a=Object.keys(n),l=a.slice(0,r.maxBreadth).map(d=>{let p=Ci(n[d],e+1,t,r);return`${d}: ${p}`}),u=a.length>r.maxBreadth?`, \u2026(+${a.length-r.maxBreadth} more)`:"";return`{${l.join(", ")}${u}}`}finally{t.delete(i)}}function qd(n,e){let t={...Ty,...e},r;try{r=n.map(s=>Ci(s,0,new WeakSet,t)).join(" ")}catch{r="[unserializable console arguments]"}return r.length>t.maxLength&&(r=r.slice(0,t.maxLength)+"\u2026(truncated)"),r}function Hd(n){for(let e of n)if(e instanceof Error&&e.stack)return e.stack.slice(0,4*1024)}function Ai(n){switch(n){case"debug":return"debug";case"warn":return"warn";case"error":return"error";case"info":case"log":default:return"info"}}var My=()=>{try{return typeof location!="undefined"?location.pathname:void 0}catch{return}};function $d(n,e,t=0){let r=Ai(n),s=j(qd(e)),i={method:n},o=My();if(o&&(i.screen=o),r==="warn"||r==="error"){let a=Hd(e);a&&(i.stack=j(a))}return t>0&&(i.droppedSince=t),{kind:"log",level:r,message:s,source:"console",platform:"js",logId:`log_${H()}`,metadata:i,timestamp:P()}}var hr=class{constructor(e){this.recent=[];this.dropped=0;var t,r;this.capCount=(t=e==null?void 0:e.capCount)!=null?t:100,this.capWindowMs=(r=e==null?void 0:e.capWindowMs)!=null?r:1e4}accept(e){if(e==="warn"||e==="error")return!0;let t=Date.now();return this.recent=this.recent.filter(r=>t-r<this.capWindowMs),this.recent.length>=this.capCount?(this.dropped++,!1):(this.recent.push(t),!0)}takeDropped(){let e=this.dropped;return this.dropped=0,e}};var Py=["debug","info","log","warn","error"],Ly=50,gr=class{constructor(){this.name="console";this.ctx=null;this.active=!1;this.throttle=new hr;this.originals=new Map;this.capturing=!1;this.ring=[]}get isActive(){return this.active}setup(e){if(!this.active&&(this.ctx=e,typeof console!="undefined")){for(let t of Py){let r=console[t];if(typeof r!="function")continue;this.originals.set(t,r);let s=(...i)=>{try{r.apply(console,i)}catch{}this.capture(t,i)};console[t]=s}this.active=!0}}capture(e,t){var r;if(!this.capturing&&!(t.length>0&&t[0]===Ls)){this.capturing=!0;try{if(!this.throttle.accept(Ai(e)))return;let s=$d(e,t,this.throttle.takeDropped());this.pushRing(s),(r=this.ctx)==null||r.emit(s)}catch{}finally{this.capturing=!1}}}pushRing(e){this.ring.push(e),this.ring.length>Ly&&this.ring.shift()}getRecent(){return this.ring.slice()}teardown(){if(typeof console!="undefined")for(let[e,t]of this.originals)console[e]=t;this.originals.clear(),this.ring.length=0,this.active=!1}};var br=class{constructor(){this.name="bugReport";this.ctx=null;this.active=!1;this.submitFn=null;this.widget=null;this.mounting=!1}get isActive(){return this.active}setup(e){this.ctx=e,this.active=!0}signalReport(){var e;(e=this.ctx)==null||e.signal("report")}setSubmit(e){this.submitFn=e}async mountLauncher(e){if(!(this.widget||this.mounting||typeof document=="undefined")){this.mounting=!0;try{let{createBugReportWidget:t}=await Promise.resolve().then(()=>(Vd(),Ud));if(this.widget)return;this.widget=t({position:e.position,label:e.label,onSubmit:r=>this.submitFn?this.submitFn(r):Promise.resolve({e:"init"})})}catch{}finally{this.mounting=!1}}}teardown(){var e;(e=this.widget)==null||e.destroy(),this.widget=null,this.submitFn=null,this.active=!1}};$();var Wd="scalebun:tab",jd="scalebun:live:";function Ti(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}function Fy(){try{return typeof sessionStorage!="undefined"?sessionStorage:null}catch{return null}}function Ri(){try{let n=globalThis.crypto;if(n&&typeof n.randomUUID=="function")return n.randomUUID()}catch{}return`${Date.now().toString(36)}-${Math.floor(Math.random()*1e9).toString(36)}`}function Kd(){let n=Fy();if(!n)return`mem-${Ri()}`;try{let e=n.getItem(Wd);if(e)return e;let t=Ri();return n.setItem(Wd,t),t}catch{return`mem-${Ri()}`}}var Mi=n=>`${jd}${n}`;function yr(n){let e=Ti();if(!e)return null;try{let t=e.getItem(Mi(n));if(!t)return null;let r=JSON.parse(t);return r&&r.v===1&&typeof r.sessionId=="string"?r:null}catch{return null}}function vr(n,e){let t=Ti();if(t)try{t.setItem(Mi(n),JSON.stringify(e))}catch{}}function wr(n,e){let t=yr(n);t&&(t.ended=e,t.lastActive=Date.now(),vr(n,t))}function Gd(n){let e=yr(n);e&&(e.lastActive=Date.now(),vr(n,e))}function Xd(n,e){let t=Ti();if(t)try{let r=[];for(let s=0;s<t.length;s++){let i=t.key(s);if(!(!i||!i.startsWith(jd)||i===Mi(n)))try{let o=JSON.parse(t.getItem(i)||"{}");o&&(o.ended||e-(o.lastActive||0)>864e5)&&r.push(i)}catch{r.push(i)}}for(let s of r)t.removeItem(s)}catch{}}var Dy=15e3,xr=class{constructor(){this.name="crash";this.ctx=null;this.active=!1;this.tabId=""}get isActive(){return this.active}setup(e){var t;this.ctx=e,typeof window!="undefined"&&(this.installReportingObserver(),this.installLiveness((t=e.sessionId)!=null?t:`sess_${H()}`),this.active=!0)}installReportingObserver(){let e=globalThis.ReportingObserver;if(e)try{this.observer=new e(t=>{for(let r of t)this.handleReport(r)},{buffered:!0}),this.observer.observe()}catch{}}handleReport(e){var o,a,c,l,u,d,p,f;if(e.type==="deprecation")return;let t=(o=e.body)!=null?o:{},r=e.type==="crash",s=r?`Browser crash report: ${(a=t.reason)!=null?a:"unknown"}`:(c=t.message)!=null?c:`${e.type} report`,i=t.sourceFile?`${t.sourceFile}:${(l=t.lineNumber)!=null?l:0}:${(u=t.columnNumber)!=null?u:0}`:void 0;this.emitError({type:r?"crash":"handled",message:s,stack:i,fingerprint:`report:${e.type}:${(p=(d=t.reason)!=null?d:t.id)!=null?p:s}`.slice(0,180),metadata:{reportType:e.type,reason:t.reason,anticipated:t.anticipated,url:e.url}}),r&&((f=this.ctx)==null||f.signal("error"))}installLiveness(e){var s;this.tabId=Kd();let t=yr(this.tabId);t&&!t.ended&&t.sessionId!==e&&this.emitRecoveredCrash(t);let r=P();vr(this.tabId,{v:1,sessionId:e,startedAt:r,lastActive:r,screen:(s=Yd())!=null?s:"",ended:!1}),Xd(this.tabId,r),this.onHide=()=>wr(this.tabId,!0),this.onShow=()=>wr(this.tabId,!1),window.addEventListener("pagehide",this.onHide),window.addEventListener("pageshow",this.onShow),this.heartbeat=setInterval(()=>Gd(this.tabId),Dy)}emitRecoveredCrash(e){var s,i,o;let t=Math.max(0,e.lastActive-e.startedAt),r=this.buildError({type:"crash",message:"Session ended abnormally (tab crash, OOM, or forced close \u2014 no graceful shutdown)",fingerprint:"session-abnormal-termination",screenName:e.screen||void 0,metadata:{reason:"unfinalized-session",priorSessionId:e.sessionId,durationMs:t,lastScreen:e.screen},timestamp:e.lastActive});if((s=this.ctx)!=null&&s.emitFor){this.ctx.emitFor(e.sessionId,r);return}(i=this.ctx)==null||i.emit({...r,type:"handled"}),(o=this.ctx)==null||o.signal("error")}buildError(e){var t,r;return{kind:"error",type:e.type,message:j(e.message),stack:e.stack,source:"js",fingerprint:e.fingerprint,screenName:(t=e.screenName)!=null?t:Yd(),clientId:`crash_${H()}`,timestamp:(r=e.timestamp)!=null?r:P(),...e.metadata?{metadata:e.metadata}:{}}}emitError(e){var t;(t=this.ctx)==null||t.emit(this.buildError(e))}teardown(){if(this.observer){try{this.observer.disconnect()}catch{}this.observer=void 0}this.heartbeat&&clearInterval(this.heartbeat),this.heartbeat=void 0,typeof window!="undefined"&&(this.onHide&&window.removeEventListener("pagehide",this.onHide),this.onShow&&window.removeEventListener("pageshow",this.onShow)),this.tabId&&wr(this.tabId,!0),this.active=!1}};function Yd(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}$();Vt();var qy=50,Sr=class{constructor(e,t){this.apiBaseUrl=e;this.clientKey=t;this.buffer=new Be("engage-pending")}headers(){return{"content-type":"application/json","x-scalebun-client-key":this.clientKey}}get usable(){return!!this.clientKey&&!!this.apiBaseUrl&&typeof fetch!="undefined"}async fetchConfig(e){if(!this.usable)return null;let t=new URLSearchParams;e.platform&&t.set("platform",e.platform),e.appVersion&&t.set("appVersion",e.appVersion),e.deviceId&&t.set("deviceId",e.deviceId),e.endUserId&&t.set("endUserId",e.endUserId);try{let r=await fetch(`${this.apiBaseUrl}/sdk/engage/config?${t.toString()}`,{headers:this.headers(),cache:"no-store"});return r.ok?await r.json():null}catch{return null}}postImpressions(e){return this.post("/sdk/engage/surveys/impressions",{schemaVersion:1,impressions:e})}postResponses(e){return this.postWithRetry("/sdk/engage/responses",{schemaVersion:1,responses:e})}postEvents(e){return this.post("/sdk/engage/events",{schemaVersion:1,events:e})}postRatingEvents(e){return this.postWithRetry("/ingestion/rating-events",{schemaVersion:1,events:e})}async presignAttachments(e){if(!this.usable)return null;try{let t=await fetch(`${this.apiBaseUrl}/sdk/engage/attachments/presign`,{method:"POST",headers:this.headers(),body:JSON.stringify({schemaVersion:1,attachments:e})});return t.ok?await t.json():null}catch{return null}}async putBlob(e,t,r){if(typeof fetch=="undefined")return!1;try{return(await fetch(e,{method:"PUT",body:t,headers:{"content-type":r}})).ok}catch{return!1}}async post(e,t){if(!this.usable)return!1;try{return(await fetch(`${this.apiBaseUrl}${e}`,{method:"POST",headers:this.headers(),body:JSON.stringify(t),keepalive:!0})).ok}catch{return!1}}async postWithRetry(e,t,r=3,s=800){for(let i=0;i<r;i++){if(await this.post(e,t))return!0;i<r-1&&await new Promise(o=>setTimeout(o,s*2**i))}return await this.park(e,t),!1}async park(e,t){try{let s=[...await this.buffer.load(),{path:e,body:t}].slice(-qy);await this.buffer.save(s)}catch{}}async flushParked(){if(!this.usable)return;let e;try{e=await this.buffer.load()}catch{return}if(!e.length)return;let t=[];for(let r of e)!r||typeof r.path!="string"||await this.post(r.path,r.body)||t.push(r);await this.buffer.save(t)}};var Hx=32,$x=3e4,Kf="scalebun_engage_sessions";function Gf(){try{return typeof location!="undefined"?location.pathname:""}catch{return""}}function zx(n){let e=n,t=r=>Array.isArray(r)?r.length:0;return!!e&&(t(e.campaigns)>0||t(e.inAppMessages)>0)}var as=class{constructor(){this.name="engage";this.ctx=null;this.active=!1;this.screen="";this.buffer=[];this.bufferOpen=!0}get isActive(){return this.active}async setup(e){var i;if(this.ctx=e,typeof window=="undefined"||typeof document=="undefined")return;let t=(i=e.clientKey)!=null?i:"";if(!t||!e.apiBaseUrl)return;this.transport=new Sr(e.apiBaseUrl,t),this.screen=Gf(),this.active=!0,this.transport.flushParked(),this.unsub=e.onSignal(o=>this.onSignal(o)),this.onPop=()=>this.onScreenView(Gf()),window.addEventListener("popstate",this.onPop);let{count:r,isNewSession:s}=this.bumpSessionCount();s&&(this.onLifecycle("session_start"),this.onLifecycle("app_open"),this.onLifecycle("n_sessions",r)),await this.refresh()}async refresh(){var i,o,a,c,l,u;if(!this.transport)return;let e=await this.transport.fetchConfig({platform:"web",appVersion:(i=this.ctx)==null?void 0:i.appVersion,deviceId:(o=this.ctx)==null?void 0:o.deviceId,endUserId:(c=(a=this.ctx)==null?void 0:a.getUserId)==null?void 0:c.call(a)});if(!zx(e)){(l=this.runtime)==null||l.setCampaigns([]),(u=this.runtime)==null||u.setMessages([]),this.closeBuffer();return}let{normalizeConfig:t}=await Promise.resolve().then(()=>(Oi(),tu)),r=t(e),s=await this.ensureRuntime();s&&(s.setCampaigns(r.campaigns),s.setMessages(r.inAppMessages),this.drain(s))}async ensureRuntime(){var t,r,s,i,o;if(this.runtime)return this.runtime;if(!this.transport)return;let{EngageRuntime:e}=await Promise.resolve().then(()=>(jf(),Wf));return this.runtime=new e({transport:this.transport,deviceId:(r=(t=this.ctx)==null?void 0:t.deviceId)!=null?r:"",sessionId:(i=(s=this.ctx)==null?void 0:s.sessionId)!=null?i:"",uuid:H,now:P,currentScreen:()=>this.screen,replayCoord:ne,signal:a=>{var c;return(c=this.ctx)==null?void 0:c.signal(a)},...(o=this.ctx)!=null&&o.onInAppGameRequest?{gameHandler:this.ctx.onInAppGameRequest}:{}}),this.runtime}async submit(e,t){let r=await this.ensureRuntime();return r?r.submitFor(e,t):"error"}emitRatingEvent(e,t){this.ensureRuntime().then(r=>r==null?void 0:r.emitRatingEvent(e,t))}async resetInAppState(){let{clearEngageState:e}=await Promise.resolve().then(()=>(Hi(),lu));e()}onScreenView(e){this.screen=e,this.feed("screen",e)}onIdentify(){this.active&&this.refresh()}onCustomEvent(e){this.feed("custom",e)}onSignal(e){this.feed("signal",e)}onLifecycle(e,t){this.feed("lifecycle",e,t)}feed(e,t,r){if(this.runtime){this.dispatch(this.runtime,e,t,r,0);return}this.bufferOpen&&(this.buffer.push({ch:e,value:t,arg:r,at:P()}),this.buffer.length>Hx&&this.buffer.shift())}dispatch(e,t,r,s,i){switch(t){case"screen":e.onScreenView(r,i);break;case"custom":e.onCustomEvent(r,i);break;case"signal":e.onSignal(r,i);break;case"lifecycle":e.onLifecycle(r,s,i);break}}drain(e){let t=P()-$x;for(let r of this.buffer)r.at<t||this.dispatch(e,r.ch,r.value,r.arg,P()-r.at);this.closeBuffer()}closeBuffer(){this.bufferOpen=!1,this.buffer=[]}bumpSessionCount(){var e,t;try{let r=(t=(e=this.ctx)==null?void 0:e.sessionId)!=null?t:"",s=localStorage.getItem(Kf),i=s?JSON.parse(s):{};if(r&&i.sessionId===r&&typeof i.count=="number")return{count:i.count,isNewSession:!1};let o=(typeof i.count=="number"?i.count:0)+1;return localStorage.setItem(Kf,JSON.stringify({sessionId:r,count:o})),{count:o,isNewSession:!0}}catch{return{count:1,isNewSession:!0}}}teardown(){var e,t;(e=this.unsub)==null||e.call(this),this.unsub=void 0,this.onPop&&typeof window!="undefined"&&window.removeEventListener("popstate",this.onPop),this.onPop=void 0,(t=this.runtime)==null||t.stop(),this.runtime=void 0,this.closeBuffer(),this.active=!1}};$();Do();function jx(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}var cs=class{constructor(){this.name="webPerf";this.ctx=null;this.active=!1}get isActive(){return this.active}async setup(e){if(this.ctx=e,typeof window=="undefined"||typeof performance=="undefined")return;this.active=!0;let{startCollectors:t}=await Promise.resolve().then(()=>(Jf(),Yf));this.active&&(this.stop=t((r,s,i,o)=>this.emit(r,s,i,o),()=>this.active))}emit(e,t,r,s){var i;(i=this.ctx)==null||i.emit({kind:"performance",metric:e,value:t,screenName:jx(),...s!=null?{duration:s}:{},metadata:r,clientId:`pw_${H()}`,timestamp:P()})}teardown(){var e;this.active=!1,(e=this.stop)==null||e.call(this),this.stop=void 0}};var ds=class{constructor(){this.name="exitIntent";this.active=!1}get isActive(){return this.active}async setup(e){if(typeof window=="undefined"||typeof document=="undefined")return;this.active=!0;let{startExitIntent:t}=await Promise.resolve().then(()=>(im(),sm));this.active&&(this.handle=t(e,e.exitIntent))}teardown(){var e;this.active=!1,(e=this.handle)==null||e.stop(),this.handle=void 0}};var $h=[new zn,new qn,new Vn,new Qn,new Zn,new cs,new cr,new mr,new gr,new br,new xr,new as,new ds],zh={replay:async()=>new(await Promise.resolve().then(()=>(Um(),zm))).ReplayFeature,inbox:async()=>new(await Promise.resolve().then(()=>(eh(),Zm))).InboxFeature,profiler:async()=>new(await Promise.resolve().then(()=>(nh(),th))).ProfilerFeature,watchdog:async()=>new(await Promise.resolve().then(()=>(yh(),bh))).WatchdogFeature,inapp2:async()=>new(await Promise.resolve().then(()=>(Hh(),qh))).InApp2Feature},bk={config:["network"],analytics:["network"],errors:["dom"],network:["dom"],webVitals:["performanceObserver"],webPerf:["performanceObserver"],performance:["performance"],journey:["dom"],console:["dom"],bugReport:["dom"],crash:["dom"],engage:["dom"],inbox:["dom"],profiler:["dom"],watchdog:["performanceObserver"],exitIntent:["dom"],inapp2:["dom"],replay:["dom"]};function _a(n){var e;return(e=bk[n])!=null?e:["dom"]}$();function yk(n){return n==="frame"?"replay":n==="network"?"networkMonitoring":n==="error"?"crashReporting":n==="performance"||n==="resource"||n==="trace"||n==="transaction"?"performanceMonitoring":""}var fn=class{static async bootstrap(e,t){var b,w,x,I;let r=Ka(e),s=Ja(r.debug),i=new kn(r),o=new En(r),a=new Mn(r,i,o);t!=null&&t.edge&&a.setConsentGranted(!1);let c=new Pn;fc(),gc(),typeof((b=r.errors)==null?void 0:b.maxBreadcrumbs)=="number"&&We.setMax(r.errors.maxBreadcrumbs),lc((w=r.errors)==null?void 0:w.beforeBreadcrumb);let l=k=>{var M,R;let C=yk(k.kind);C&&((R=(M=c.get("config"))==null?void 0:M.entitlement)==null?void 0:R.call(M,C))===!1||(pc(k),hc(k),a.emit(k))},u=new Set,d={sessionId:i.sessionId,clientKey:r.clientKey,deviceId:i.deviceId,appVersion:r.appVersion,getUserId:()=>{var k,C;return(C=(k=c.get("analytics"))==null?void 0:k.identity)==null?void 0:C.userId},emit:l,emitFor:(k,C)=>a.emitFor(k,C),egressPending:()=>a.pendingCount,trackEvent:(k,C)=>l({kind:"event",name:k,props:C,timestamp:Date.now()}),getAppState:()=>gt("visibility")&&document.visibilityState==="hidden"?"background":"active",log:s,apiBaseUrl:r.apiBaseUrl,signal:(k,C)=>{for(let M of u)try{M(k,C)}catch{}},onSignal:k=>(u.add(k),()=>u.delete(k)),replaySampling:r.replay,...r.onInAppGameRequest?{onInAppGameRequest:r.onInAppGameRequest}:{},errorsOptions:r.errors,networkOptions:r.network,performanceOptions:r.performance,watchdogOptions:r.watchdog,analyticsOptions:r.analytics,flagsBootstrap:(x=r.flags)==null?void 0:x.bootstrap,flagsRealtime:(I=r.flags)==null?void 0:I.realtime,replayCanvas:r.replayCanvas,replayFrameOrigins:r.replayFrameOrigins,autocapture:r.autocapture,traceOrigins:r.tracePropagation?[...typeof location!="undefined"?[location.origin]:[],...r.tracePropagationOrigins]:[],maskReplayText:r.privacy.maskReplayText,maskEventText:r.privacy.maskEventText,maskSelectors:r.privacy.maskSelectors,maskInputs:r.privacy.maskInputs,respectDnt:r.privacy.respectDnt,exitIntent:r.exitIntent},p=r.features,f=()=>{for(let k of $h)p[k.name]!==!1&&_a(k.name).every(C=>gt(C))&&c.add(k)};f();let m=async()=>{await Promise.all(Object.entries(zh).map(async([k,C])=>{if(p[k]===!0&&_a(k).every(M=>gt(M))&&!c.get(k))try{c.add(await C())}catch(M){s(`[scalebun] optional feature "${k}" failed to load:`,M)}}))},h=new bn(r.consent.initial),g=!1,S=async()=>{var C;if(g)return;g=!0,f(),await m(),await c.setupAll(d),t!=null&&t.edge||await a.start();let k=(C=c.get("analytics"))==null?void 0:C.identity;if(k!=null&&k.userId&&!(t!=null&&t.edge)&&a.emit({kind:"identify",userId:k.userId,anonymousId:k.anonymousId,timestamp:Date.now()}),k){Oe(k.superProps);let M=k.groups;if(M)for(let R of Object.keys(M))Oe({[`group_${R}`]:M[R]});k.userId&&Oe({userId:k.userId})}s(t!=null&&t.edge?"activated (edge-lite)":"activated",{sessionId:i.sessionId})},y={config:r,session:i,pipeline:a,transport:o,registry:c,log:s,setConsent:k=>{h.set(k?"granted":"denied"),k?(a.setConsentGranted(!0),S()):(a.setConsentGranted(!1),g&&c.teardownAll(),g=!1,a.discard())},get consentStatus(){return h.value}};return!r.consent.required||h.granted?await S():s("consent required \u2014 capture deferred until setConsent(true)"),s("initialized",{sessionId:i.sessionId,consent:h.value}),y}};$();ir();var Ha=class{constructor(){this.rt=null;this.ready=!1;this.pendingConsent=null;this.pushFeature=null;this.coachFeature=null;this.coachController=null;this.pendingPushOpenCbs=[];this.settle=null;this.settled=new Promise(e=>{this.settle=e});this.replay={stats:()=>{var e,t;return(t=(e=this.replayFeature())==null?void 0:e.stats())!=null?t:null},checkpoint:e=>{var t;return(t=this.replayFeature())==null?void 0:t.checkpoint(e)},flush:()=>{var e;return(e=this.replayFeature())==null?void 0:e.flush()},stop:()=>{var e;return(e=this.replayFeature())==null?void 0:e.teardown()},start:()=>{var e;return(e=this.replayFeature())==null?void 0:e.resume()},pause:()=>{var e;return(e=this.replayFeature())==null?void 0:e.pause()},resume:()=>{var e;return(e=this.replayFeature())==null?void 0:e.resume()},setPrivacy:e=>{var t;return(t=this.replayFeature())==null?void 0:t.setPrivacy(e)}};this.performance={startTransaction:e=>{var r,s,i;let t=(r=this.rt)==null?void 0:r.registry.get("performance");return(i=(s=t==null?void 0:t.startTransaction)==null?void 0:s.call(t,e))!=null?i:sr},startTrace:e=>{var r,s;let t=(r=this.rt)==null?void 0:r.registry.get("performance");(s=t==null?void 0:t.startTrace)==null||s.call(t,e)},stopTrace:e=>{var r,s;let t=(r=this.rt)==null?void 0:r.registry.get("performance");(s=t==null?void 0:t.stopTrace)==null||s.call(t,e)},markScreenLoadStart:e=>{},sendMetric:(e,t)=>{var r;(r=this.rt)==null||r.pipeline.emit({kind:"performance",metric:e,value:t,timestamp:P()})}};this.session={start:()=>{},end:()=>{this.close()},emitEvent:(e,t)=>{this.track(e,t)}};this.engage={track:(e,t)=>this.track(e,t),refresh:()=>{var e,t;return(t=(e=this.engageFeature())==null?void 0:e.refresh())!=null?t:Promise.resolve()},submit:(e,t)=>{var r,s;return(s=(r=this.engageFeature())==null?void 0:r.submit(e,t))!=null?s:Promise.resolve("error")},emitRatingEvent:(e,t)=>{var r;return(r=this.engageFeature())==null?void 0:r.emitRatingEvent(e,t)},resetInAppState:()=>{var e,t;return(t=(e=this.engageFeature())==null?void 0:e.resetInAppState())!=null?t:Promise.resolve()}};this.push={enable:e=>this.enablePush(e),disable:e=>this.ensurePush().then(t=>{var r;return(r=t==null?void 0:t.disable(e))!=null?r:!1}),status:()=>this.ensurePush().then(e=>{var t;return(t=e==null?void 0:e.status())!=null?t:Promise.resolve({supported:!1,permission:"default",subscribed:!1,endpoint:null,state:"unsupported"})}),getSubscription:()=>this.ensurePush().then(e=>{var t;return(t=e==null?void 0:e.getSubscription())!=null?t:null}),check:async e=>{let t=await this.ensurePush();return t?t.check(e):(await Promise.resolve().then(()=>(Fa(),Ba))).notInitializedReport()}};this.attribution={getInstallationId:()=>{var e,t;return(t=(e=this.analyticsFeature())==null?void 0:e.getInstallationId())!=null?t:""},setClickId:e=>{var t;return(t=this.analyticsFeature())==null?void 0:t.setClickId(e)}};this.flagExposed=new Set;this.flags={isEnabled:e=>{var s;let t=this.cfg(),r=(s=t==null?void 0:t.isEnabled(e))!=null?s:!1;return t!=null&&t.knows(e)&&this.recordExposure(e,r),r},variation:(e,t)=>this.flags.variationDetail(e,t).value,variationDetail:(e,t)=>{var i,o,a;let r=(o=(i=this.cfg())==null?void 0:i.variationDetail(e,t))!=null?o:{value:t,variant:null,reason:"FLAG_NOT_FOUND"},s=(a=r.variant)!=null?a:typeof r.value=="object"?null:r.value;return this.recordExposure(e,typeof s=="number"?String(s):s,r.reason),r},ready:()=>{var e,t;return(t=(e=this.cfg())==null?void 0:e.ready())!=null?t:Promise.resolve()},onChange:e=>{var t,r;return(r=(t=this.cfg())==null?void 0:t.onChange(e))!=null?r:()=>{}},override:(e,t)=>{var r;return(r=this.cfg())==null?void 0:r.override(e,t)},clearOverride:e=>{var t;return(t=this.cfg())==null?void 0:t.clearOverride(e)},clearOverrides:()=>{var e;return(e=this.cfg())==null?void 0:e.clearOverrides()}};this.config={get:(e,t)=>{var r,s;return(s=(r=this.cfg())==null?void 0:r.get(e,t))!=null?s:t},refresh:()=>{var e,t;return(t=(e=this.cfg())==null?void 0:e.refresh())!=null?t:Promise.resolve()}};this.rollouts={isOn:e=>{var r,s;let t=(s=(r=this.cfg())==null?void 0:r.isOn(e))!=null?s:!1;return this.recordExposure(e,t),t}};this.experiments={variant:e=>{var r,s;let t=(s=(r=this.cfg())==null?void 0:r.variant(e))!=null?s:null;return this.recordExposure(e,t),t}};this.profiler={available:()=>{var e,t;return(t=(e=this.prof())==null?void 0:e.available())!=null?t:!1},start:e=>{var t,r;return(r=(t=this.prof())==null?void 0:t.start(e))!=null?r:!1},stop:()=>{var e,t;return(t=(e=this.prof())==null?void 0:e.stop())!=null?t:Promise.resolve(!1)}};this.watchdog={stats:()=>{var t,r,s;let e=(t=this.rt)==null?void 0:t.registry.get("watchdog");return(s=(r=e==null?void 0:e.stats)==null?void 0:r.call(e))!=null?s:null}}}whenReady(){return this.settled}async init(e){var t,r,s,i,o;if(!this.ready){if(wn((t=e==null?void 0:e.csp)==null?void 0:t.nonce),wc()){let a=zs();if(a==="edge"||a==="worker"){try{this.rt=await fn.bootstrap(e,{edge:!0}),this.ready=!0}catch(c){typeof console!="undefined"&&console.warn("[scalebun] edge init failed:",c)}return}e!=null&&e.debug&&typeof console!="undefined"&&console.warn("[scalebun] init() on SSR \u2014 deferring capture to the client.");return}try{if(this.rt=await fn.bootstrap(e),this.ready=!0,this.pendingConsent!==null&&(this.rt.setConsent(this.pendingConsent),this.pendingConsent=null),this.rt.config.features.bugReport!==!1){let c=this.rt.registry.get("bugReport");(r=c==null?void 0:c.setSubmit)==null||r.call(c,l=>this.reportBugDetailed(l)),this.rt.config.bugReport.launcher&&((s=c==null?void 0:c.mountLauncher)==null||s.call(c,{position:this.rt.config.bugReport.position,label:this.rt.config.bugReport.label}))}let a=(i=e==null?void 0:e.push)==null?void 0:i.softAsk;a&&Promise.resolve().then(()=>(jh(),Wh)).then(({armSoftAsk:c})=>c(a,{enable:()=>this.enablePush(),permission:()=>Notification.permission})).catch(()=>{})}catch(a){typeof console!="undefined"&&console.warn("[scalebun] init failed:",a)}finally{(o=this.settle)==null||o.call(this)}}}setConsent(e){this.rt?this.rt.setConsent(e):this.pendingConsent=e}track(e,t){var r,s,i,o;(r=this.analyticsFeature())!=null&&r.evaluate(e,t).drop||((s=this.rt)==null||s.pipeline.emit(this.enrichEvent({kind:"event",name:e,props:t,timestamp:P()})),(i=this.analyticsFeature())==null||i.track(e,t),(o=this.engageFeature())==null||o.onCustomEvent(e))}enrichEvent(e){var c;let t=(c=this.analyticsFeature())==null?void 0:c.identity,r=ne(),s=t==null?void 0:t.superProps,i=e.props,o=s&&Object.keys(s).length?{...s,...i!=null?i:{}}:i,a=o&&mt(o);return{...e,...a!==void 0?{props:a}:{},...t!=null&&t.anonymousId?{anonymousId:t.anonymousId}:{},...t!=null&&t.userId?{userId:t.userId}:{},...t!=null&&t.groups&&Object.keys(t.groups).length?{groups:t.groups}:{},...r?{replay:r}:{}}}register(e){var t;(t=this.analyticsFeature())==null||t.register(e),Oe(e)}unregister(e){var t;(t=this.analyticsFeature())==null||t.unregister(e)}group(e,t,r){var s,i;!e||!t||((s=this.analyticsFeature())==null||s.group(e,t,r),Oe({[`group_${e}`]:t}),(i=this.rt)==null||i.pipeline.emit(this.enrichEvent({kind:"event",name:"$group",props:{group_type:e,group_key:t,...r!=null?r:{}},timestamp:P()})))}alias(e,t){var i,o,a,c;if(!e)return;let r=(i=this.analyticsFeature())==null?void 0:i.identity,s=(o=t!=null?t:r==null?void 0:r.userId)!=null?o:r==null?void 0:r.anonymousId;(a=this.analyticsFeature())==null||a.alias(e,t),(c=this.rt)==null||c.pipeline.emit({kind:"identify",userId:e,previousId:s,timestamp:P()})}reset(){var e,t,r,s,i;(e=this.engageFeature())==null||e.onLifecycle("before_logout"),(t=this.analyticsFeature())==null||t.reset(),yc(),(i=this.rt)==null||i.pipeline.emit({kind:"identify",reset:!0,anonymousId:(s=(r=this.analyticsFeature())==null?void 0:r.identity)==null?void 0:s.anonymousId,timestamp:P()})}trackPurchase(e){var r,s,i;let t=Ln(e);t&&((r=this.rt)==null||r.pipeline.emit(this.enrichEvent({kind:"event",name:"purchase",props:t.props,revenue:t.revenue,currency:t.currency,timestamp:P()})),(s=this.analyticsFeature())==null||s.trackPurchase(e),(i=this.engageFeature())==null||i.onCustomEvent("purchase"))}trackSubscription(e){var t;(t=this.analyticsFeature())==null||t.trackSubscription(e)}trackScreen(e,t){var r,s;e&&((r=this.rt)==null||r.pipeline.emit(this.enrichEvent({kind:"event",name:"SCREEN_VIEW",screenName:e,props:t,timestamp:P()})),(s=this.engageFeature())==null||s.onScreenView(e))}identify(e,t){var s,i,o,a,c,l,u,d;let r=(i=(s=this.analyticsFeature())==null?void 0:s.identity)==null?void 0:i.anonymousId;(o=this.rt)==null||o.pipeline.emit({kind:"identify",userId:e,anonymousId:r,traits:t,timestamp:P()}),(a=this.analyticsFeature())==null||a.identify(e,t),Oe({userId:e,...t!=null?t:{}}),(c=this.engageFeature())==null||c.onIdentify(),(d=(u=(l=this.rt)==null?void 0:l.registry.get("inapp2"))==null?void 0:u.onIdentify)==null||d.call(u)}setUser(e){e!=null&&e.id&&this.identify(e.id,e)}captureError(e,t){var a,c,l;let r=t!=null&&t.componentStack?{componentStack:t.componentStack}:void 0,s=t&&(t.level||t.tags||t.context||t.fingerprint)?{level:t.level,tags:t.tags,context:t.context,fingerprint:t.fingerprint}:void 0,i=(a=this.rt)==null?void 0:a.registry.get("errors");if(i!=null&&i.captureHandled){i.captureHandled(e,r,s);return}let o=e;(l=this.rt)==null||l.pipeline.emit({kind:"error",type:"handled",message:(c=o==null?void 0:o.message)!=null?c:String(e),stack:o==null?void 0:o.stack,source:"js",timestamp:P(),...r!=null?r:{}})}addBreadcrumb(e){var t;uc({ts:P(),category:(t=e.category)!=null?t:"custom",type:e.type,level:e.level,message:e.message,data:e.data})}setTag(e,t){bl(e,t)}setContext(e,t){yl(e,t)}setErrorLevel(e){vl(e)}submitRating(e,t,r){var o,a;let s=Math.round(e);if(!Number.isFinite(s)||s<1||s>5){(o=this.rt)==null||o.log("[scalebun] submitRating: score must be an integer 1\u20135, got",e);return}let i={kind:"rating",score:s,comment:t,surveyId:r,clientRatingId:`rat_${H()}`,timestamp:P()};(a=this.rt)==null||a.pipeline.emit(i)}async registerInAppSlot(e,t){let{registerInAppSlot:r}=await Promise.resolve().then(()=>(no(),Fu));return r(e,t)}async reportBug(e){let t=await this.reportBugDetailed(e);return typeof t=="string"?t:null}async reportBugDetailed(e){var t,r,s,i;if(!this.rt)return{e:"init"};if(this.rt.config.features.bugReport===!1)return this.rt.log("[scalebun] reportBug: bugReport feature is disabled"),{e:"off"};if(!e||!e.message)return this.rt.log("[scalebun] reportBug: a message is required"),{e:"empty"};if(!this.rt.pipeline.canEgress())return this.rt.log("[scalebun] reportBug: blocked \u2014 consent not granted"),{e:"consent"};try{let o=this.rt.registry.get("bugReport");(t=o==null?void 0:o.signalReport)==null||t.call(o);let a=this.rt.registry.get("console"),c=(s=(r=a==null?void 0:a.getRecent)==null?void 0:r.call(a))!=null?s:[],{buildBugReportPayload:l}=await Promise.resolve().then(()=>(Gh(),Kh)),u=ne(),d=l({message:e.message,title:e.title,email:e.email},c,{replayCoord:u}),p=await this.rt.transport.submitBugReport(this.rt.session.sessionId,d);return await this.rt.pipeline.flush(),(i=p==null?void 0:p.id)!=null?i:{e:"send"}}catch{return{e:"send"}}}async flush(){var e,t;await Promise.all([(e=this.rt)==null?void 0:e.pipeline.flush(),(t=this.analyticsFeature())==null?void 0:t.flush()])}errorStats(){var t,r,s;let e=(t=this.rt)==null?void 0:t.registry.get("errors");return(s=(r=e==null?void 0:e.stats)==null?void 0:r.call(e))!=null?s:null}perfStats(){var t,r,s;let e=(t=this.rt)==null?void 0:t.registry.get("performance");return(s=(r=e==null?void 0:e.perfStats)==null?void 0:r.call(e))!=null?s:null}networkStats(){var t,r,s;let e=(t=this.rt)==null?void 0:t.registry.get("network");return(s=(r=e==null?void 0:e.stats)==null?void 0:r.call(e))!=null?s:null}async close(){var e,t;(e=this.rt)==null||e.registry.teardownAll(),await((t=this.rt)==null?void 0:t.pipeline.stop()),this.rt=null,this.ready=!1}get sessionId(){var e;return(e=this.rt)==null?void 0:e.session.sessionId}egressStats(){var r,s,i,o,a,c,l,u,d,p,f,m,h;let e=this.analyticsFeature(),t=(r=this.rt)==null?void 0:r.pipeline.ledger;return{pending:((i=(s=this.rt)==null?void 0:s.pipeline.pendingCount)!=null?i:0)+((o=e==null?void 0:e.pending)!=null?o:0),dropped:((c=(a=this.rt)==null?void 0:a.pipeline.dropped)!=null?c:0)+((l=e==null?void 0:e.dropped)!=null?l:0),queued:(u=t==null?void 0:t.queued)!=null?u:0,attempted:(d=t==null?void 0:t.attempted)!=null?d:0,retried:(p=t==null?void 0:t.retried)!=null?p:0,recovered:(f=t==null?void 0:t.recovered)!=null?f:0,expired:(m=t==null?void 0:t.expired)!=null?m:0,acked:(h=t==null?void 0:t.acked)!=null?h:0}}analyticsStats(){var e,t;return(t=(e=this.analyticsFeature())==null?void 0:e.stats)!=null?t:null}analyticsFeature(){var e;return(e=this.rt)==null?void 0:e.registry.get("analytics")}replayFeature(){var e;return(e=this.rt)==null?void 0:e.registry.get("replay")}engageFeature(){var e;return(e=this.rt)==null?void 0:e.registry.get("engage")}inboxFeature(){var e;return(e=this.rt)==null?void 0:e.registry.get("inbox")}inbox(){var e,t;return(t=(e=this.inboxFeature())==null?void 0:e.controller())!=null?t:Nk}ensureCoach(){return this.coachFeature?Promise.resolve(this.coachFeature):this.rt?Promise.resolve().then(()=>(Qh(),Jh)).then(({CoachmarkFeature:e})=>{var s,i;if(this.coachFeature)return this.coachFeature;let t={trackEvent:(o,a)=>this.track(o,a),replayCoord:ne,apiBaseUrl:(s=this.rt)==null?void 0:s.config.apiBaseUrl,clientKey:(i=this.rt)==null?void 0:i.config.clientKey},r=new e(t);return this.coachFeature=r,r}):Promise.resolve(null)}coachmarks(){if(this.coachController)return this.coachController;let e=t=>{this.ensureCoach().then(r=>{r&&t(r)})};return this.coachController={start:(t,r)=>e(s=>s.start(t,r)),startInline:t=>e(r=>r.start(t)),startById:(t,r)=>e(s=>void s.startById(t,r)),reportAnchors:()=>e(t=>t.reportAnchors()),next:()=>e(t=>t.next()),back:()=>e(t=>t.back()),skip:()=>e(t=>t.skip()),end:()=>e(t=>t.end()),notify:t=>e(r=>r.notify(t)),current:()=>{var t,r;return(r=(t=this.coachFeature)==null?void 0:t.current())!=null?r:{tourId:null,index:0,status:"idle"}},on:(t,r)=>{if(this.coachFeature)return this.coachFeature.on(t,r);let s=null,i=!1;return this.ensureCoach().then(o=>{o&&!i&&(s=o.on(t,r))}),()=>{i=!0,s==null||s()}}},this.coachController}async ensurePush(){if(this.pushFeature)return this.pushFeature;if(!this.rt)return null;let{PushFeature:e}=await Promise.resolve().then(()=>(rg(),ng));this.pushFeature=new e({apiBaseUrl:this.rt.config.apiBaseUrl,clientKey:this.rt.config.clientKey,deviceId:this.rt.session.deviceId,log:this.rt.log}),this.pushFeature.onNotificationOpened(({data:t,action:r})=>{this.track("$push_opened",{...r?{action:r}:{},...t&&typeof t=="object"?t:{}})});for(let t of this.pendingPushOpenCbs)this.pushFeature.onNotificationOpened(t);return this.pendingPushOpenCbs=[],this.pushFeature}async enablePush(e){let t=await this.ensurePush();return t?t.enable(e):"error"}onNotificationOpened(e){return this.pushFeature?this.pushFeature.onNotificationOpened(e):(this.pendingPushOpenCbs.push(e),this.ensurePush(),()=>{var r;(r=this.pushFeature)==null||r.onNotificationOpened(e);let t=this.pendingPushOpenCbs.indexOf(e);t>=0&&this.pendingPushOpenCbs.splice(t,1)})}cfg(){var e;return(e=this.rt)==null?void 0:e.registry.get("config")}recordExposure(e,t,r){var i;if(!this.rt||t==null)return;let s=`${e}=${String(t)}`;this.flagExposed.has(s)||(this.flagExposed.add(s),(i=this.analyticsFeature())==null||i.register({[`$feature/${e}`]:t}),this.track("$feature_flag_called",{flag_key:e,flag_value:t,...r?{reason:r}:{}}))}prof(){var e;return(e=this.rt)==null?void 0:e.registry.get("profiler")}},rt=()=>{},Ye=()=>Promise.resolve(),sg={unreadCount:0,total:0,syncStatus:"idle"},Nk={subscribe:n=>(n(sg),rt),onUnreadChange:n=>(n(0),rt),getState:()=>sg,query:()=>Promise.resolve({messages:[],cursor:null,hasMore:!1}),get:()=>Promise.resolve(void 0),markRead:Ye,markUnread:Ye,markAllRead:Ye,archive:Ye,unarchive:Ye,pin:Ye,remove:Ye,refresh:Ye,ingest:Ye,act:rt,onCtaAction:()=>rt,mount:rt,open:rt,close:rt,unmount:rt},hn=new Ha;$();function Bk(n,e){let t=n.ScaleBun;n.ScaleBun=hn;let r=!1;if(t&&Array.isArray(t.q))for(let i of t.q){let[o,a]=i;o==="init"&&(r=!0);let c=hn[o];if(typeof c=="function"){let l=a?Array.prototype.slice.call(a):[];try{c.apply(hn,l)}catch{}}}let s=e==null?void 0:e.dataset;if(!r&&(s!=null&&s.clientKey)){let i={clientKey:s.clientKey};s.apiBaseUrl&&(i.apiBaseUrl=s.apiBaseUrl),s.environment&&(i.environment=s.environment),s.autocapture!=null&&(i.autocapture=s.autocapture!=="false"),hn.init(i)}}if(typeof window!="undefined"){let n=typeof document!="undefined"?document.currentScript:null;wn(n==null?void 0:n.nonce),Bk(window,n)}})();
715
+ @media(prefers-reduced-motion:reduce){.spot{transition:none}}`,Ms=class{constructor(){this.host=null;this.root=null;this.card=null;this.spot=null;this.ctx=null;this.onReflow=()=>this.position()}ensure(){return this.root?this.root:(this.host=document.createElement("div"),this.host.setAttribute("data-scalebun-coach",""),this.root=this.host.attachShadow({mode:"open"}),Ne(this.root,Mk),document.body.appendChild(this.host),window.addEventListener("scroll",this.onReflow,!0),window.addEventListener("resize",this.onReflow),this.root)}render(e){var d,p;let t=this.ensure();this.ctx=e,[...t.querySelectorAll(".spot,.backdrop,.card")].forEach(f=>f.remove()),this.card=null,this.spot=null;let r=!!e.el&&!e.degraded;if(r)this.spot=document.createElement("div"),this.spot.className="spot",t.appendChild(this.spot);else{let f=document.createElement("div");f.className="backdrop",f.addEventListener("click",()=>e.controls.close()),t.appendChild(f)}let s=document.createElement("div");s.className=r?"card":"card modal",s.setAttribute("role","dialog"),s.setAttribute("aria-modal","true"),e.step.title&&s.setAttribute("aria-label",e.step.title);let i=document.createElement("button");if(i.className="x",i.type="button",i.textContent="\xD7",i.setAttribute("aria-label","Close"),i.addEventListener("click",()=>e.controls.close()),s.appendChild(i),e.step.title){let f=document.createElement("div");f.className="t",f.textContent=e.step.title,s.appendChild(f)}if(e.step.body){let f=document.createElement("div");f.className="b",f.textContent=e.step.body,s.appendChild(f)}let o=document.createElement("div");o.className="ft";let a=document.createElement("span");a.className="count",a.textContent=`${e.index+1} of ${e.total}`;let c=document.createElement("div");c.className="btns";let l=document.createElement("button");if(l.className="skip",l.type="button",l.textContent="Skip",l.addEventListener("click",()=>e.controls.skip()),c.appendChild(l),e.index>0){let f=document.createElement("button");f.className="back",f.type="button",f.textContent="Back",f.addEventListener("click",()=>e.controls.back()),c.appendChild(f)}let u=document.createElement("button");if(u.className="next",u.type="button",u.textContent=e.index+1>=e.total?"Done":"Next",u.addEventListener("click",()=>e.controls.next()),c.appendChild(u),o.append(a,c),s.appendChild(o),r){let f=document.createElement("div");f.className="arrow",s.appendChild(f)}t.appendChild(s),this.card=s,(p=(d=(e.step.title,u)).focus)==null||p.call(d),this.position()}position(){var o;let e=this.ctx;if(!e||!this.card||!e.el||e.degraded)return;let t=Tk(e.el);this.spot&&(this.spot.style.left=`${t.x-6}px`,this.spot.style.top=`${t.y-6}px`,this.spot.style.width=`${t.width+6*2}px`,this.spot.style.height=`${t.height+6*2}px`);let r={width:this.card.offsetWidth||320,height:this.card.offsetHeight||120},s=ts({anchor:t,tooltip:r,boundary:Rk(),preferred:(o=e.step.placement)!=null?o:{side:"bottom",align:"center"}});this.card.style.left=`${s.x}px`,this.card.style.top=`${s.y}px`;let i=this.card.querySelector(".arrow");i&&(i.style.left=s.arrow.y===0||s.arrow.y===r.height?`${s.arrow.x-6}px`:s.placement.side==="left"?`${r.width-6}px`:"-6px",i.style.top=s.arrow.x===0||s.arrow.x===r.width?`${s.arrow.y-6}px`:s.placement.side==="top"?`${r.height-6}px`:"-6px")}hide(){var e;window.removeEventListener("scroll",this.onReflow,!0),window.removeEventListener("resize",this.onReflow),(e=this.host)==null||e.remove(),this.host=null,this.root=null,this.card=null,this.spot=null,this.ctx=null}}});var Jh={};L(Jh,{CoachmarkFeature:()=>Na});var Yh,Na,Qh=k(()=>{"use strict";ns();Xh();So();Zr();ss();Yh="scalebun_coach_progress",Na=class{constructor(e){this.deps=e;this.hub=new tt;this.renderer=new Ms;this.listeners=new Map;this.toursCache=null;this.reportedAnchors=new Set;this.engine=new qt({hub:this.hub,resolveAnchor:t=>pt(t),waitFor:(t,r,s)=>rs(t,r,s),render:t=>this.renderer.render(t),hide:()=>this.renderer.hide(),emit:(t,r)=>this.emit(t,r),now:()=>Date.now(),persist:(t,r)=>this.persist(t,r),loadIndex:t=>this.loadIndex(t)})}start(e,t){this.reportAnchors(),this.engine.start(e,t)}reportAnchors(){for(let e of Jp())this.reportedAnchors.has(e)||(this.reportedAnchors.add(e),this.emit("$coachmark_anchor_seen",{anchorKey:e}))}async fetchTours(e){var s;if(!e&&this.toursCache)return this.toursCache;let{apiBaseUrl:t,clientKey:r}=this.deps;if(!t||!r||typeof fetch=="undefined")return e?[]:this.toursCache=[];try{let i=`${t}/sdk/coach/config${e?`?preview=${encodeURIComponent(e)}`:""}`,o=await fetch(i,{headers:{"x-scalebun-client-key":r},cache:"no-store"});if(!o.ok)return e?[]:this.toursCache=[];let c=(s=(await o.json()).tours)!=null?s:[];return e?c:this.toursCache=c}catch{return e?[]:this.toursCache=[]}}async startById(e,t){let r=(await this.fetchTours(t==null?void 0:t.preview)).find(s=>s.id===e);return r?(this.engine.start(r,t),!0):!1}next(){this.engine.next()}back(){this.engine.back()}skip(){this.engine.skip()}end(){this.engine.end("abandoned","api")}notify(e){this.engine.notify(e)}current(){return this.engine.state}on(e,t){let r=this.listeners.get(e);return r||(r=new Set,this.listeners.set(e,r)),r.add(t),()=>{var s;(s=this.listeners.get(e))==null||s.delete(t)}}emit(e,t){var o,a;let r=this.deps.replayCoord(),s={...t,...r?{replayCoord:r}:{}};this.deps.trackEvent(e,s);let i={event:e,...s};for(let c of(o=this.listeners.get(e))!=null?o:[])try{c(i)}catch{}for(let c of(a=this.listeners.get("*"))!=null?a:[])try{c(i)}catch{}}progress(){try{return JSON.parse(localStorage.getItem(Yh)||"{}")}catch{return{}}}persist(e,t){try{let r=this.progress();t<0?delete r[e]:r[e]=t,localStorage.setItem(Yh,JSON.stringify(r))}catch{}}loadIndex(e){return this.progress()[e]}dispose(){this.engine.dispose(),this.renderer.hide(),this.hub.dispose(),this.listeners.clear()}}});function Ps(n){return n.supported?n.permission==="denied"?n.everSubscribed?"revoked":"blocked":n.permission==="default"?"never-granted":n.hasSubscription?"subscribed":n.everSubscribed?"expired":"never-granted":"unsupported"}var Zh,Ba=k(()=>{"use strict";Zh={subscribed:{title:"Notifications are on",detail:"This browser is registered and can receive push.",actionable:!1},"never-granted":{title:"Not asked yet",detail:"This browser has never been prompted. Ask from a click \u2014 browsers ignore the prompt otherwise.",actionable:!0},blocked:{title:"Blocked in this browser",detail:"Notifications were declined, and the browser will not show the prompt again. Only the person can re-enable it, from the site settings beside the address bar.",actionable:!1},revoked:{title:"Turned off after being enabled",detail:"This browser had notifications and they were switched off. Like blocking, only the person can restore it from the site settings \u2014 but unlike a first refusal, they opted in once, so a reminder in-product is fair.",actionable:!1},expired:{title:"Registration expired",detail:"Permission is still granted but the subscription is gone \u2014 browsers drop them after long inactivity or a data clear. Re-registering fixes it and does NOT prompt.",actionable:!0},unsupported:{title:"Not supported in this browser",detail:"Web push needs a service worker, the Push API and Notifications. This browser is missing at least one.",actionable:!1}}});var Fa={};L(Fa,{notInitializedReport:()=>Bk,runPushDiagnostics:()=>Nk});function Pk(){return typeof navigator!="undefined"&&"serviceWorker"in navigator&&typeof window!="undefined"&&"PushManager"in window&&"Notification"in window}function Lk(n){let e="=".repeat((4-n.length%4)%4),t=(n+e).replace(/-/g,"+").replace(/_/g,"/"),r=atob(t),s=new Uint8Array(r.length);for(let i=0;i<r.length;i++)s[i]=r.charCodeAt(i);return s}function _k(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;return!0}function Ok(n){return new Promise(e=>{let t=n.active;if(!t||typeof MessageChannel=="undefined"){e(null);return}let r=!1,s=i=>{r||(r=!0,e(i))};try{let i=new MessageChannel;i.port1.onmessage=o=>{let a=o.data;s(a&&a.type==="scalebun-sw-pong"?{version:a.version}:null)},t.postMessage({type:"scalebun-sw-ping"},[i.port2]),setTimeout(()=>s(null),1500)}catch{s(null)}})}async function Nk(n){var m,h,g,S,v,y,b,E,w;let e=[],t=I=>(e.push(I),I),r=(I,x,C)=>{t({id:I,status:"unknown",label:x,detail:`Not evaluated \u2014 ${C}`})},s=typeof window!="undefined"&&window.isSecureContext===!0;t({id:"secure_context",status:s?"pass":"fail",label:"Secure context (HTTPS)",detail:s?void 0:"Page is not a secure context",fix:s?void 0:"Serve the site over HTTPS. Web Push is unavailable on plain HTTP (localhost is exempt)."});let i=[];(typeof navigator=="undefined"||!("serviceWorker"in navigator))&&i.push("ServiceWorker"),(typeof window=="undefined"||!("PushManager"in window))&&i.push("PushManager"),(typeof window=="undefined"||!("Notification"in window))&&i.push("Notification");let o=i.length===0&&Pk(),a=typeof navigator!="undefined"&&/iPad|iPhone|iPod/.test(navigator.userAgent||"");if(t({id:"api_support",status:o?"pass":"fail",label:"Browser supports Web Push",detail:o?void 0:`Missing: ${i.join(", ")||"push APIs"}`,fix:o?void 0:a?"On iOS, Web Push only works when the site is installed to the Home Screen as a PWA (iOS 16.4+). In a normal Safari tab these APIs are absent.":"This browser cannot receive Web Push. Hide your opt-in UI when ScaleBun.push.check() reports this."}),!o)return r("sw_reachable","Service worker file is reachable","push APIs are unavailable"),r("sw_registered","Service worker is registered","push APIs are unavailable"),r("sw_version","Service worker is up to date","push APIs are unavailable"),r("vapid_configured","Web Push configured for this app","push APIs are unavailable"),r("permission","Notification permission","push APIs are unavailable"),r("subscription_valid","Push subscription is valid","push APIs are unavailable"),r("device_registered","Device registered with ScaleBun","push APIs are unavailable"),r("identified","User is identified","push APIs are unavailable"),eg(e);let c=null;try{let I=await fetch(n.serviceWorkerUrl,{method:"HEAD",cache:"no-store"});c=I.ok,t({id:"sw_reachable",status:I.ok?"pass":"fail",label:"Service worker file is reachable",detail:`GET ${n.serviceWorkerUrl} \u2192 ${I.status}`,fix:I.ok?void 0:`Copy scalebun-push-sw.js from @scalebun/web/dist/ to your web root so it is served at ${n.serviceWorkerUrl}.`})}catch{t({id:"sw_reachable",status:"unknown",label:"Service worker file is reachable",detail:`Could not fetch ${n.serviceWorkerUrl}`,fix:"Check that the file is served from the same origin and not blocked by CSP."})}let l=null;try{l=(m=await navigator.serviceWorker.getRegistration(n.serviceWorkerUrl))!=null?m:null}catch{l=null}let u=(b=(y=(S=(h=l==null?void 0:l.active)==null?void 0:h.scriptURL)!=null?S:(g=l==null?void 0:l.installing)==null?void 0:g.scriptURL)!=null?y:(v=l==null?void 0:l.waiting)==null?void 0:v.scriptURL)!=null?b:null,d=!!u&&u.indexOf("scalebun-push-sw")>=0;if(t({id:"sw_registered",status:l&&d?"pass":"fail",label:"Service worker is registered",detail:l?d?`Active: ${u}`:`A different worker owns this scope: ${u}`:"No registration found for this scope",fix:l?d?void 0:"Another service worker controls this scope. Serve the ScaleBun worker at a path it can own, and pass serviceWorkerScope to enablePush().":c===!1?"The worker file is missing (see the check above) \u2014 fix that first, then call ScaleBun.enablePush().":"Call ScaleBun.enablePush() from a user gesture to register the worker."}),l&&d){let I=await Ok(l);!I||typeof I.version!="number"?t({id:"sw_version",status:"warn",label:"Service worker is up to date",detail:"The worker did not answer a version ping",fix:`Your copy of scalebun-push-sw.js is older than v${n.expectedSwVersion} (versions before v3 cannot report themselves). Re-copy it from @scalebun/web/dist/.`}):I.version<n.expectedSwVersion?t({id:"sw_version",status:"warn",label:"Service worker is up to date",detail:`Worker is v${I.version}, this SDK expects v${n.expectedSwVersion}`,fix:"Re-copy scalebun-push-sw.js from @scalebun/web/dist/ to your web root \u2014 the deployed copy is stale."}):t({id:"sw_version",status:"pass",label:"Service worker is up to date",detail:`v${I.version}`})}else r("sw_version","Service worker is up to date","no ScaleBun worker is registered");let p=null;try{let I=await fetch(`${n.apiBaseUrl}/sdk/engage/push-config`,{headers:{"content-type":"application/json","x-scalebun-client-key":n.clientKey},cache:"no-store"}),x=I.ok?await I.json():null;p=(x==null?void 0:x.enabled)===!1?null:(E=x==null?void 0:x.vapidPublicKey)!=null?E:null,t({id:"vapid_configured",status:p?"pass":"fail",label:"Web Push configured for this app",detail:p?void 0:"No VAPID key served for this client key",fix:p?void 0:"In the ScaleBun dashboard: Settings \u2192 Integrations \u2192 Web Push (VAPID) \u2192 Generate VAPID keys."})}catch{t({id:"vapid_configured",status:"unknown",label:"Web Push configured for this app",detail:"Could not reach the ScaleBun API",fix:"Check apiBaseUrl, network access, and CORS."})}let f=typeof Notification=="undefined"?"default":Notification.permission;t({id:"permission",status:f==="granted"?"pass":f==="denied"?"fail":"warn",label:"Notification permission",detail:f,fix:f==="granted"?void 0:f==="denied"?"The user blocked notifications. This cannot be re-prompted from code \u2014 they must re-allow it in browser site settings.":"Not asked yet. Call ScaleBun.enablePush() from a click handler."});try{let I=l?await l.pushManager.getSubscription():null;if(!I)t({id:"subscription_valid",status:"fail",label:"Push subscription is valid",detail:"No subscription on this browser",fix:f==="granted"?"Permission is granted but no subscription exists \u2014 call ScaleBun.enablePush() to create one.":"Call ScaleBun.enablePush() from a user gesture."});else{let x=I.toJSON(),C=typeof x.expirationTime=="number"&&x.expirationTime<=Date.now(),M=null;if(p){let A=(w=I.options)==null?void 0:w.applicationServerKey;M=A?_k(new Uint8Array(A),Lk(p)):null}t({id:"subscription_valid",status:C||M===!1?"fail":M===null&&p?"warn":"pass",label:"Push subscription is valid",detail:C?"Subscription has expired":M===!1?"Subscription was created with a DIFFERENT VAPID key than this app now uses":M===null&&p?"Could not read the subscription key to compare against the tenant VAPID key":I.endpoint,fix:C?"Call ScaleBun.enablePush() again to mint a fresh subscription.":M===!1?"The VAPID keypair was rotated after this browser subscribed, so pushes to it will fail. Call ScaleBun.push.disable() then ScaleBun.enablePush() to re-subscribe.":void 0})}}catch{t({id:"subscription_valid",status:"unknown",label:"Push subscription is valid",detail:"Could not read the push subscription"})}try{let I=await fetch(`${n.apiBaseUrl}/sdk/engage/device-token/status?deviceId=${encodeURIComponent(n.deviceId)}`,{headers:{"content-type":"application/json","x-scalebun-client-key":n.clientKey},cache:"no-store"}),x=I.ok?await I.json():null;if(!x)t({id:"device_registered",status:"unknown",label:"Device registered with ScaleBun",detail:`Status lane returned ${I.status}`}),r("identified","User is identified","the server did not answer");else{let C=x.tokenStatus==="dead";t({id:"device_registered",status:x.registered&&!C?"pass":"fail",label:"Device registered with ScaleBun",detail:x.registered?C?"Token marked dead by the push service":"Registered and active":"No push token stored for this device",fix:x.registered?C?"The browser push service rejected this token (410 Gone). Call ScaleBun.enablePush() to re-subscribe.":void 0:"Call ScaleBun.enablePush() \u2014 the subscription never reached the backend."}),t({id:"identified",status:x.identified?"pass":"warn",label:"User is identified",detail:x.identified?"Bound to a person":"Anonymous device",fix:x.identified?void 0:"Call ScaleBun.identify() \u2014 journeys and lifecycle programs only target identified people, so this browser can receive broadcasts but never an automated lifecycle push."})}}catch{t({id:"device_registered",status:"unknown",label:"Device registered with ScaleBun",detail:"Could not reach the ScaleBun API"}),r("identified","User is identified","the server was unreachable")}return eg(e)}function Bk(){return{ok:!1,blocking:"api_support",checks:[{id:"api_support",status:"fail",label:"ScaleBun is initialized",detail:"push.check() was called before ScaleBun.init()",fix:"Call ScaleBun.init({ clientKey, apiBaseUrl }) first \u2014 diagnostics need the resolved config."}]}}function eg(n){var t;let e=n.find(r=>r.status==="fail");return{ok:!e,blocking:(t=e==null?void 0:e.id)!=null?t:null,checks:n}}var Da=k(()=>{"use strict"});var ng={};L(ng,{DEFAULT_SW_URL:()=>qa,EXPECTED_SW_VERSION:()=>tg,PUSH_STATE_COPY:()=>Zh,PushFeature:()=>Ha,resolvePushState:()=>Ps});function Ls(){return typeof navigator!="undefined"&&"serviceWorker"in navigator&&typeof window!="undefined"&&"PushManager"in window&&"Notification"in window}function Fk(n){let e="=".repeat((4-n.length%4)%4),t=(n+e).replace(/-/g,"+").replace(/_/g,"/"),r=atob(t),s=new ArrayBuffer(r.length),i=new Uint8Array(s);for(let o=0;o<r.length;o++)i[o]=r.charCodeAt(o);return i}var tg,qa,mn,Ha,rg=k(()=>{"use strict";Ba();Ba();tg=5,qa="/scalebun-push-sw.js";mn=class mn{constructor(e){this.reg=null;this.lastEndpoint=null;this.swUrl=qa;this.openedCbs=new Set;this.swMessageBound=!1;this.deps=e}log(...e){var t,r;(r=(t=this.deps).log)==null||r.call(t,"[scalebun:push]",...e)}permission(){return typeof Notification=="undefined"?"default":Notification.permission}async enable(e={}){try{if(!Ls())return this.log("unsupported browser \u2014 skipping"),"unsupported";if(!this.deps.clientKey||!this.deps.apiBaseUrl)return"error";if(this.permission()==="denied")return"denied";let t=await this.fetchPushConfig();if(!t||t.enabled===!1||!t.vapidPublicKey)return this.log("web push not configured for this app"),"not-configured";let r=await Notification.requestPermission();if(r!=="granted")return r==="denied"?"denied":"error";let s=e.serviceWorkerUrl||qa;this.swUrl=s,this.reg=await navigator.serviceWorker.register(s,e.serviceWorkerScope?{scope:e.serviceWorkerScope}:void 0),await navigator.serviceWorker.ready,this.bindSwMessages();let o=await this.reg.pushManager.getSubscription()||await this.reg.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Fk(t.vapidPublicKey)}),a=await this.registerDeviceToken(o);return this.lastEndpoint=o.endpoint,a?"subscribed":"error"}catch(t){return this.log("enable failed",t),"error"}}async disable(e={}){var t,r;try{let s=this.reg||(Ls()?await navigator.serviceWorker.getRegistration():null),i=s?await s.pushManager.getSubscription():null,o=(r=(t=i==null?void 0:i.endpoint)!=null?t:this.lastEndpoint)!=null?r:null,a=i?await i.unsubscribe():!0;return this.lastEndpoint=null,e.revokeServerSide!==!1&&await this.revokeDeviceToken(o),a}catch{return!1}}async revokeDeviceToken(e){if(!this.deps.clientKey||!this.deps.apiBaseUrl)return!1;try{return(await fetch(`${this.deps.apiBaseUrl}/sdk/engage/device-token/revoke`,{method:"POST",headers:this.headers(),keepalive:!0,body:JSON.stringify({deviceId:this.deps.deviceId,...e?{endpoint:e}:{}})})).ok}catch{return!1}}onNotificationOpened(e){return this.openedCbs.add(e),this.bindSwMessages(),()=>this.openedCbs.delete(e)}async getSubscription(){try{let e=this.reg||(Ls()?await navigator.serviceWorker.getRegistration():null),t=e?await e.pushManager.getSubscription():null;return t?t.toJSON():null}catch{return null}}async check(e={}){let{runPushDiagnostics:t}=await Promise.resolve().then(()=>(Da(),Fa));return t({apiBaseUrl:this.deps.apiBaseUrl,clientKey:this.deps.clientKey,deviceId:this.deps.deviceId,serviceWorkerUrl:e.serviceWorkerUrl||this.swUrl,expectedSwVersion:tg})}everSubscribed(){try{return localStorage.getItem(mn.EVER_KEY)==="1"}catch{return!1}}markEverSubscribed(){try{localStorage.setItem(mn.EVER_KEY,"1")}catch{}}async status(){var r,s;let e=Ls(),t=e?await this.getSubscription():null;return t&&this.markEverSubscribed(),{supported:e,permission:this.permission(),subscribed:!!t,endpoint:(s=(r=t==null?void 0:t.endpoint)!=null?r:this.lastEndpoint)!=null?s:null,state:Ps({supported:e,permission:this.permission(),hasSubscription:!!t,everSubscribed:this.everSubscribed()})}}bindSwMessages(){this.swMessageBound||typeof navigator=="undefined"||!("serviceWorker"in navigator)||(this.swMessageBound=!0,navigator.serviceWorker.addEventListener("message",e=>{var r,s;let t=e.data;if(!(!t||typeof t.type!="string"))if(t.type==="scalebun-push-click"){let i=(r=t.data)!=null?r:{};for(let o of this.openedCbs)try{o({data:i,action:(s=t.action)!=null?s:null})}catch{}}else t.type==="scalebun-push-resubscribe"&&t.subscription&&this.registerDeviceTokenJson(t.subscription).then(i=>{var o;i&&((o=t.subscription)!=null&&o.endpoint)&&(this.lastEndpoint=t.subscription.endpoint)})}))}headers(){return{"content-type":"application/json","x-scalebun-client-key":this.deps.clientKey}}async fetchPushConfig(){try{let e=await fetch(`${this.deps.apiBaseUrl}/sdk/engage/push-config`,{headers:this.headers(),cache:"no-store"});return e.ok?await e.json():null}catch{return null}}registerDeviceToken(e){return this.registerDeviceTokenJson(e.toJSON())}async registerDeviceTokenJson(e){if(!e||!e.endpoint)return!1;try{return(await fetch(`${this.deps.apiBaseUrl}/sdk/engage/device-token`,{method:"POST",headers:this.headers(),keepalive:!0,body:JSON.stringify({schemaVersion:1,deviceId:this.deps.deviceId,platform:"web",pushProvider:"webpush",pushToken:JSON.stringify(e),tokenStatus:"active",...this.deps.sdkVersion?{sdkVersion:this.deps.sdkVersion}:{}})})).ok}catch{return!1}}};mn.EVER_KEY="scalebun.push.everSubscribed";Ha=mn});var Wa="https://api.scalebun.com/api/v1";var ag=["authorization","cookie","set-cookie","x-api-key","x-csrf-token","password","token","secret"];function ja(n){var r,s,i,o,a,c,l,u,d,p,f,m,h,g,S,v,y,b,E,w,I,x,C,M,T,A,O,z,D,te,J,Q,fe,ce,xe,Se,le,q,V,K,de,me,se,Ue,Ve,G,ie,Y,X,ee,R,_,N,F,W,re,ge,he,Ce,Ae,Te,Je,st,ke,gn,za,Ua,Va;if(!n||!n.clientKey)throw new Error("[scalebun] clientKey is required");let e=(r=n.apiBaseUrl)==null?void 0:r.replace(/\/$/,""),t=e&&/^https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?([/?#]|$)/.test(e)?e:Wa;return{clientKey:n.clientKey,apiBaseUrl:t,environment:n.environment,release:n.release,appVersion:n.appVersion,flushIntervalMs:(s=n.flushIntervalMs)!=null?s:5e3,sessionTimeoutMs:n.sessionTimeoutMs,sessionMaxDurationMs:n.sessionMaxDurationMs,replay:n.replay,errors:n.errors,network:n.network,performance:n.performance,analytics:n.analytics,flags:n.flags,replayCanvas:(i=n.replayCanvas)!=null?i:!1,signSessionLane:(o=n.signSessionLane)!=null?o:!1,replayFrameOrigins:(a=n.replayFrameOrigins)!=null?a:[],autocapture:(c=n.autocapture)!=null?c:!0,tracePropagation:(l=n.tracePropagation)!=null?l:!0,tracePropagationOrigins:(u=n.tracePropagationOrigins)!=null?u:[],maxBatchSize:(d=n.maxBatchSize)!=null?d:50,maxQueueSize:(p=n.maxQueueSize)!=null?p:1e3,debug:(f=n.debug)!=null?f:!1,features:{errors:(h=(m=n.features)==null?void 0:m.errors)!=null?h:!0,network:(S=(g=n.features)==null?void 0:g.network)!=null?S:!0,console:(y=(v=n.features)==null?void 0:v.console)!=null?y:!0,webVitals:(E=(b=n.features)==null?void 0:b.webVitals)!=null?E:!0,performance:(I=(w=n.features)==null?void 0:w.performance)!=null?I:!0,journey:(C=(x=n.features)==null?void 0:x.journey)!=null?C:!0,replay:(T=(M=n.features)==null?void 0:M.replay)!=null?T:!1,bugReport:(O=(A=n.features)==null?void 0:A.bugReport)!=null?O:!0,crash:(D=(z=n.features)==null?void 0:z.crash)!=null?D:!0,config:(J=(te=n.features)==null?void 0:te.config)!=null?J:!0,engage:(fe=(Q=n.features)==null?void 0:Q.engage)!=null?fe:!0,analytics:(xe=(ce=n.features)==null?void 0:ce.analytics)!=null?xe:!0,webPerf:(le=(Se=n.features)==null?void 0:Se.webPerf)!=null?le:!0,profiler:(V=(q=n.features)==null?void 0:q.profiler)!=null?V:!1,watchdog:(de=(K=n.features)==null?void 0:K.watchdog)!=null?de:!1,inbox:(se=(me=n.features)==null?void 0:me.inbox)!=null?se:!1,inapp2:(Ve=(Ue=n.features)==null?void 0:Ue.inapp2)!=null?Ve:!1},watchdog:n.watchdog,exitIntent:n.exitIntent,privacy:{captureNetworkBodies:(ie=(G=n.privacy)==null?void 0:G.captureNetworkBodies)!=null?ie:!1,denylist:[...ag,...(X=(Y=n.privacy)==null?void 0:Y.denylist)!=null?X:[]].map(ig=>ig.toLowerCase()),maskSelectors:(R=(ee=n.privacy)==null?void 0:ee.maskSelectors)!=null?R:[],maskReplayText:(N=(_=n.privacy)==null?void 0:_.maskReplayText)!=null?N:!1,maskInputs:(W=(F=n.privacy)==null?void 0:F.maskInputs)!=null?W:!0,respectDnt:(ge=(re=n.privacy)==null?void 0:re.respectDnt)!=null?ge:!1,maskEventText:(Ce=(he=n.privacy)==null?void 0:he.maskEventText)!=null?Ce:!1},consent:{required:(Ae=n.requireConsent)!=null?Ae:!1,initial:(Te=n.initialConsent)!=null?Te:"unknown"},bugReport:{launcher:(st=(Je=n.bugReportOptions)==null?void 0:Je.launcher)!=null?st:!1,position:(gn=(ke=n.bugReportOptions)==null?void 0:ke.position)!=null?gn:"bottom-right",label:(Ua=(za=n.bugReportOptions)==null?void 0:za.label)!=null?Ua:"Report a bug"},...(Va=n.engageOptions)!=null&&Va.onInAppGameRequest?{onInAppGameRequest:n.engageOptions.onInAppGameRequest}:{}}}$();$();Sn();var kn=class{constructor(e){this.config=e;var r,s;let t=Sc((r=e.sessionTimeoutMs)!=null?r:Vt,(s=e.sessionMaxDurationMs)!=null?s:Ks);this.sessionId=t.id,this.deviceId=Ga()}client(){return Qa()}device(){return Za(this.deviceId)}app(){return ec(this.config)}context(){return kc(),tc()}};Sn();var In=class In{constructor(e){this.config=e;this.suspendedUntil=0}isSuspended(){return Date.now()<this.suspendedUntil}headers(){return{"content-type":"application/json","x-scalebun-client-key":this.config.clientKey}}async signedHeaders(e){let t=this.headers();if(!this.config.signSessionLane)return t;let{signatureHeaders:r}=await Promise.resolve().then(()=>(Js(),Ys));return{...t,...await r(this.config.clientKey,e)}}async startSession(e){var t,r,s,i,o,a,c,l;await this.post(`${this.config.apiBaseUrl}/ingestion/sessions`,{sessionId:e.sessionId,deviceId:e.device.id,platform:e.client.platform,appVersion:(s=(t=e.app)==null?void 0:t.version)!=null?s:(r=e.app)==null?void 0:r.release,osVersion:e.device.osVersion,deviceModel:(i=e.device.model)!=null?i:e.device.browser,locale:(o=e.context)==null?void 0:o.locale,timezone:(a=e.context)==null?void 0:a.timezone,idleThresholdMs:(c=this.config.sessionTimeoutMs)!=null?c:Vt,sdkVersion:(l=e.client.sdk)==null?void 0:l.version,startedAt:Date.now()})}async sendBatch(e,t){var i,o;let r=`${this.config.apiBaseUrl}/ingestion/sessions/${encodeURIComponent(e.sessionId)}/batch`,s=await this.post(r,e,t==null?void 0:t.keepalive);if(!s)return null;try{return(o=(i=await s.json())==null?void 0:i.results)!=null?o:{}}catch{return{}}}async finalize(e){let t=`${this.config.apiBaseUrl}/ingestion/sessions/${encodeURIComponent(e)}/finalize`;await this.post(t,{endedAt:Date.now()},!0)}async submitBugReport(e,t){if(this.isSuspended())return null;let r=`${this.config.apiBaseUrl}/ingestion/sessions/${encodeURIComponent(e)}/bug-reports`;try{let s=JSON.stringify(t),i=await fetch(r,{method:"POST",headers:await this.signedHeaders(s),body:s});return i.ok?await i.json().catch(()=>({})):null}catch{return null}}async post(e,t,r=!1){if(this.isSuspended())return null;try{let s=JSON.stringify(t),i=await this.signedHeaders(s),o=s;if(!r&&s.length>In.GZIP_MIN_BYTES){let{gzipString:c}=await Promise.resolve().then(()=>(Tc(),Ac)),l=await c(s);l&&(o=new Blob([l]),i["content-encoding"]="gzip")}let a=await fetch(e,{method:"POST",headers:i,body:o,keepalive:r});return a.status===403&&this.maybeEnterSuspended(a),a.ok?a:null}catch{return null}}maybeEnterSuspended(e){let t=Number(e.headers.get("retry-after"))||0;e.clone().json().then(r=>{if(!((r==null?void 0:r.code)==="workspace_suspended"||(r==null?void 0:r.enabled)===!1)&&!t)return;let i=Number(r==null?void 0:r.retryAfterSeconds)||t||3600;this.suspendedUntil=Date.now()+i*1e3}).catch(()=>{t&&(this.suspendedUntil=Date.now()+t*1e3)})}};In.GZIP_MIN_BYTES=1024;var En=In;Wt();$();Cn();Tn();var Ng=1,Mc=n=>n.kind==="frame",Rn=n=>n.frameType==="keyframe",Bg=n=>Mc(n)&&!Rn(n),Fg=3,Mn=class{constructor(e,t,r){this.config=e;this.session=t;this.transport=r;this.queue=[];this.timer=null;this.droppedCount=0;this.queuedCount=0;this.attemptedCount=0;this.retriedCount=0;this.recoveredCount=0;this.expiredCount=0;this.ackedCount=0;this.started=!1;this.dead=!1;this.lifecycle=[];this.buffer=new Be;this.backoff=new St;this.flushing=!1;this.sessionStarted=Promise.resolve();this.sessionOk=!1;this.sessionRetries=0;this.keyframePending=!1;this.inFlight=[];var s,i;this.consentGranted=!((s=e.consent)!=null&&s.required)||((i=e.consent)==null?void 0:i.initial)==="granted"}setConsentGranted(e){this.consentGranted=e}canEgress(){return this.consentGranted&&!this.dead}async start(){var e;if(!this.started){this.started=!0,this.dead=!1,this.armSession();try{let t=await this.buffer.load(),r=typeof t[0]=="string"?t[0]:"",s=(e=r?t[1]:t)!=null?e:[],i=An(s,o=>o.timestamp,P());this.expiredCount+=s.length-i.length,i.length&&(this.recoveredCount+=i.length,r&&r!==this.session.sessionId?this.drainOrphans(r,i):this.queue.unshift(...i))}catch{}this.timer=setInterval(()=>this.autoFlush(),this.config.flushIntervalMs),this.installLifecycleFlush(),this.queue.some(Rn)&&this.flush()}}armSession(){this.sessionOk=!1,this.sessionStarted=this.transport.startSession({sessionId:this.session.sessionId,client:this.session.client(),device:this.session.device(),app:this.session.app(),context:this.session.context()}).then(()=>{this.sessionOk=!0}).catch(()=>{})}emit(e){if(!this.consentGranted){this.droppedCount++;return}if(this.queue.length>=this.config.maxQueueSize){let t=this.queue.findIndex(Bg);this.queue.splice(t>=0?t:0,1),this.droppedCount++}this.queuedCount++,this.queue.push(e),this.started&&Rn(e)&&(this.flushing?this.keyframePending=!0:this.flush())}reportDrop(e,t){var r;e&&((r=this.reported)!=null||(this.reported=new Set),!this.reported.has(e)&&(this.reported.add(e),this.emit({kind:"event",name:"sdk_replay_capture_failed",timestamp:P(),props:{stage:"ingest-rejected",lane:e,reason:t!=null?t:"unknown"}})))}persistQueue(){let e=this.inFlight.length?[...this.inFlight,...this.queue]:this.queue;this.buffer.save([this.session.sessionId,kt(e,Mc,Rn)])}autoFlush(){this.dead||!ot()||!this.backoff.ready(P())||this.flush()}async flush(e){var r;if(this.dead||this.flushing||this.queue.length===0)return;this.flushing=!0;let t=this.queue.splice(0,this.config.maxBatchSize);this.inFlight=t;try{await this.sessionStarted,this.started&&!this.sessionOk&&this.sessionRetries<Fg&&(this.sessionRetries++,this.armSession(),await this.sessionStarted),this.attemptedCount++;let s=await this.transport.sendBatch(this.buildEnvelope(t),e);if(s){this.inFlight=[],this.ackedCount+=t.length;let i=[],o=0;for(let a of t){let c=(r=a.kind)!=null?r:"",l=s[c];!l||l.ok||(this.ackedCount--,l.retry?(i.push(a),this.retriedCount++):(o++,this.droppedCount++,this.reportDrop(c,l.reason)))}i.length?(t.length-i.length-o===0?(this.backoff.fail(P()),this.queue.push(...i)):(this.backoff.reset(),this.queue.unshift(...i)),this.persistQueue()):this.backoff.reset()}else this.backoff.fail(P()),this.retriedCount+=t.length,this.queue.unshift(...t),this.inFlight=[],this.persistQueue()}catch{this.backoff.fail(P()),this.retriedCount+=t.length,this.queue.unshift(...t),this.inFlight=[],this.persistQueue()}finally{this.flushing=!1}this.keyframePending&&(this.keyframePending=!1,this.flush(e))}emitFor(e,t){if(!this.consentGranted||!e||e===this.session.sessionId){this.consentGranted&&e===this.session.sessionId&&this.emit(t);return}this.drainOrphans(e,[t])}async drainOrphans(e,t){let r=null;try{r=await this.transport.sendBatch({...this.buildEnvelope(t),sessionId:e})}catch{}let s=r?t.filter(i=>{var a;let o=r[(a=i.kind)!=null?a:""];return o&&!o.ok&&o.retry}):t;s.length&&this.buffer.save([e,s])}buildEnvelope(e){return{schemaVersion:Ng,sessionId:this.session.sessionId,sentAt:P(),client:this.session.client(),device:this.session.device(),app:this.session.app(),context:this.session.context(),items:e}}installLifecycleFlush(){if(typeof document=="undefined")return;let e=()=>{this.dead||(this.persistQueue(),this.flush({keepalive:!0}))},t=()=>{document.visibilityState==="hidden"&&e()};this.addLifecycle(document,"visibilitychange",t),typeof window!="undefined"&&(this.addLifecycle(window,"pagehide",e),this.addLifecycle(window,"online",()=>{this.backoff.reset(),this.autoFlush()}))}addLifecycle(e,t,r){e.addEventListener(t,r),this.lifecycle.push({target:e,type:t,fn:r})}removeLifecycle(){for(let e of this.lifecycle)try{e.target.removeEventListener(e.type,e.fn)}catch{}this.lifecycle=[]}async stop(){this.timer&&clearInterval(this.timer),this.timer=null,this.removeLifecycle(),await this.flush({keepalive:!0}),await this.transport.finalize(this.session.sessionId),await this.buffer.clear(),this.started=!1}async discard(){this.dead=!0,this.consentGranted=!1,this.timer&&clearInterval(this.timer),this.timer=null,this.removeLifecycle(),this.queue=[],this.started=!1;try{await this.buffer.clear()}catch{}}get pendingCount(){return this.queue.length}get dropped(){return this.droppedCount}get ledger(){return{queued:this.queuedCount,attempted:this.attemptedCount,retried:this.retriedCount,recovered:this.recoveredCount,dropped:this.droppedCount,expired:this.expiredCount,acked:this.ackedCount}}};Zs();$();var Pc={drop:!1,warnings:[]};function Lc(n,e,t){var o,a;if(!n||e.startsWith("$"))return Pc;let r=n.strict===!0,s=(o=n.events)==null?void 0:o[e];if(!s)return n.allowUnknownEvents===!1?{drop:r,warnings:[`event "${e}" is not in the tracking plan`]}:Pc;let i=[];for(let c of(a=s.required)!=null?a:[])(t==null||!(c in t))&&i.push(`event "${e}" missing required prop "${c}"`);if(s.props){for(let c of Object.keys(s.props))if(t&&c in t){let l=typeof t[c];l!==s.props[c]&&i.push(`event "${e}" prop "${c}" expected ${s.props[c]}, got ${l}`)}}return{drop:r&&i.length>0,warnings:i}}var Dg=/^[A-Za-z]{3}$/;function qg(n){return Dg.test(n)?n.toUpperCase():n}function Ln(n){let{revenue:e,currency:t,transactionId:r,type:s,productId:i,quantity:o,recurrence:a,...c}=n;if(typeof e!="number"||!Number.isFinite(e)||!t||!r)return null;let l=s!=null?s:"one_time",u=l==="refund"?-Math.abs(e):e,d={...c,transaction_id:r,revenue_type:l};return i&&(d.product_id=i),o!=null&&(d.quantity=o),a&&(d.recurrence=a),{revenue:u,currency:qg(t),props:d}}var Hg=["trial_started","trial_converted","started","renewed","plan_changed","cancel_scheduled","resumed","canceled","expired","payment_failed","refunded"],$g=new Set(["trial_started","trial_converted","started","plan_changed"]);function _n(n){if(n==null)return;let e=n instanceof Date?n:new Date(n);return Number.isNaN(e.getTime())?void 0:e.toISOString()}function zg(n){return{...n.id?{id:String(n.id)}:{},...n.name?{name:String(n.name)}:{},amount:n.amount,currency:String(n.currency).toUpperCase().slice(0,3),interval:n.interval,...typeof n.intervalCount=="number"&&n.intervalCount>0?{intervalCount:Math.floor(n.intervalCount)}:{}}}function _c(n){if(!n)return null;let e=typeof n.subscriptionId=="string"?n.subscriptionId.trim():"",t=n.status;if(!e||!Hg.includes(t))return null;let r=n.plan;return $g.has(t)&&(!r||typeof r.amount!="number"||!Number.isFinite(r.amount)||r.amount<0||!r.currency||!r.interval)?null:{subscriptionId:e,status:t,...r?{plan:zg(r)}:{},..._n(n.trialEndAt)?{trialEndAt:_n(n.trialEndAt)}:{},..._n(n.effectiveAt)?{effectiveAt:_n(n.effectiveAt)}:{},...n.properties&&typeof n.properties=="object"?n.properties:{}}}Fe();var Ug="wzb-analytics-v1",Vg=new Set(["$identify","$group","$alias","purchase"]);function Oc(n,e,t){return t>=1||Vg.has(n)?!0:t<=0?!1:Ee(`${e}:${Ug}`)%1e4<t*1e4}Wt();Cn();Tn();var fb=50,mb=5e3,hb=2e3,Qe="scalebun_anonymous_id",si="scalebun_user_id",Dn="scalebun_super_props",ni="scalebun_groups",tl="scalebun_installation_id",nl="scalebun_first_open_done",ii="scalebun_attribution_click_id",rl="scalebun_attribution",il=/^[0-9a-f]{16,64}$/i,gb=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"];function bb(){try{if(typeof localStorage!="undefined"){let e=localStorage.getItem(rl);if(e){let t=JSON.parse(e);if(t&&typeof t=="object")return{props:t,isNew:!1}}}}catch{}let n={};try{if(typeof location!="undefined"){let e=new URL(location.href);for(let t of gb){let r=e.searchParams.get(t);r&&(n[t]=r.slice(0,200))}for(let t of["fbclid","gclid"]){let r=e.searchParams.get(t);r&&(n[t]=r.slice(0,512))}}if(typeof document!="undefined"&&document.referrer)try{let e=new URL(document.referrer);n.referrer=(e.origin+e.pathname).slice(0,512),n.referrer_domain=e.hostname}catch{n.referrer=document.referrer.split("?")[0].slice(0,512)}}catch{}if(!n.referrer&&!n.utm_source&&!n.fbclid&&!n.gclid)return{props:{},isNew:!1};try{typeof location!="undefined"&&(n.landing_url=location.pathname.slice(0,512)),typeof localStorage!="undefined"&&localStorage.setItem(rl,JSON.stringify(n))}catch{}return{props:n,isNew:!0}}var yb="pending-analytics";function vb(){try{if(typeof localStorage!="undefined")return localStorage.getItem(si)||void 0}catch{}}function ri(n){try{if(typeof localStorage=="undefined")return;n?localStorage.setItem(si,n):localStorage.removeItem(si)}catch{}}function oi(){return`anon_${H()}`}function sl(n){try{if(typeof localStorage!="undefined"){let e=localStorage.getItem(n);if(e){let t=JSON.parse(e);if(t&&typeof t=="object")return t}}}catch{}return{}}function Kt(n,e){try{if(typeof localStorage=="undefined")return;Object.keys(e).length?localStorage.setItem(n,JSON.stringify(e)):localStorage.removeItem(n)}catch{}}function wb(n){try{if(typeof document=="undefined")return null;let e=document.cookie.match(new RegExp("(?:^|; )"+n+"=([^;]*)")),t=e==null?void 0:e[1];return t!=null?decodeURIComponent(t):null}catch{return null}}function ai(n,e,t){try{if(typeof document=="undefined")return;let r=[`${n}=${encodeURIComponent(e)}`,"path=/","max-age=31536000","SameSite=Lax"];t&&r.push(`domain=${t}`),document.cookie=r.join("; ")}catch{}}function xb(n){var r,s;let e="",t;try{typeof localStorage!="undefined"&&(e=(r=localStorage.getItem(tl))!=null?r:"",e||(e=n||`web_${H()}`,localStorage.setItem(tl,e)),t=(s=localStorage.getItem(ii))!=null?s:void 0)}catch{}e||(e=n||`web_${H()}`);try{if(typeof location!="undefined"&&location.search){let i=new URL(location.href),o=i.searchParams.get("scalebun_click_id");if(o&&il.test(o)){t=o;try{typeof localStorage!="undefined"&&localStorage.setItem(ii,o)}catch{}i.searchParams.delete("scalebun_click_id");try{history.replaceState(history.state,"",i.pathname+i.search+i.hash)}catch{}}}}catch{}return t?{installationId:e,clickId:t}:{installationId:e}}function Sb(n){if(n){let t=wb(Qe);if(t){try{typeof localStorage!="undefined"&&localStorage.setItem(Qe,t)}catch{}return t}}try{if(typeof localStorage!="undefined"){let t=localStorage.getItem(Qe),r=t!=null?t:oi();return t||localStorage.setItem(Qe,r),n&&ai(Qe,r,n),r}}catch{}let e=oi();return n&&ai(Qe,e,n),e}var qn=class{constructor(){this.name="analytics";this.ctx=null;this.active=!1;this.clientKey="";this.apiBaseUrl="";this.deviceId="";this.installationId="";this.attributionProps={};this.anonymousId="";this.userId=vb();this.superProps={};this.groups={};this.queue=[];this.buffer=new Be(yb);this.persisted=!1;this.backoff=new St;this.sampleRate=1;this.droppedCount=0;this.sampledOutCount=0;this.flushCount=0}get pending(){return this.queue.length}get dropped(){return this.droppedCount}get stats(){return{pending:this.queue.length,dropped:this.droppedCount,sampledOut:this.sampledOutCount,flushes:this.flushCount,sampleRate:this.sampleRate}}get isActive(){return this.active}setup(e){var i,o,a,c,l,u,d;this.ctx=e,this.clientKey=(i=e.clientKey)!=null?i:"",this.apiBaseUrl=(o=e.apiBaseUrl)!=null?o:"",this.deviceId=(a=e.deviceId)!=null?a:"";let t=xb(this.deviceId);this.installationId=t.installationId,this.clickId=t.clickId;let r=bb();this.attributionProps=r.props,this.cookieDomain=(c=e.analyticsOptions)==null?void 0:c.cookieDomain,this.anonymousId=Sb(this.cookieDomain),this.superProps=sl(Dn),this.groups=sl(ni),this.plan=(l=e.analyticsOptions)==null?void 0:l.plan;let s=(u=e.analyticsOptions)==null?void 0:u.sampleRate;typeof s=="number"&&s>=0&&s<=1&&(this.sampleRate=s),!(!this.clientKey||!this.apiBaseUrl)&&(r.isNew&&this.recordTouchpoint(),this.timer=setInterval(()=>this.autoFlush(),mb),typeof window!="undefined"&&(this.onHide=()=>{this.persist(),this.flush(!0)},window.addEventListener("pagehide",this.onHide)),this.offOnline=Rc(()=>{this.backoff.reset(),this.autoFlush()}),this.active=!0,this.maybeFirstOpen(),this.offSignal=(d=e.onSignal)==null?void 0:d.call(e,(p,f)=>{this.active&&(p==="rage"?this.track("$rageclick"):p==="dead"?this.track("$deadclick"):p==="shake"?this.track("$shake"):p==="error"?this.track("$exception",f):p==="web_vital"?this.track("$web_vital",f):p==="exit_intent"&&this.track("$exit_intent",f))}),this.buffer.load().then(p=>{let f=Array.isArray(p)?p:[],m=An(f,h=>h.event_time,P());this.droppedCount+=f.length-m.length,this.active&&m.length?(this.queue.unshift(...m),this.trim(),this.persisted=!0,this.autoFlush()):m.length<f.length&&this.buffer.clear()}),e.autocapture!==!1&&Promise.resolve().then(()=>(el(),Zc)).then(({installAutocapture:p})=>{this.active&&(this.stopAutocapture=p({onEvent:f=>this.track(f.name,{...f.props,capture_source:"automatic"}),maskText:e.maskEventText===!0}))}).catch(()=>{}))}get usable(){return this.active&&!!this.clientKey&&!!this.apiBaseUrl&&typeof fetch!="undefined"}get sessionId(){var e;return(e=this.ctx)==null?void 0:e.sessionId}async recordTouchpoint(){if(!this.clientKey||!this.apiBaseUrl||typeof fetch=="undefined")return;let e=this.attributionProps;try{await fetch(`${this.apiBaseUrl}/ingestion/attribution`,{method:"POST",headers:{"content-type":"application/json","x-scalebun-client-key":this.clientKey},keepalive:!0,body:JSON.stringify({sessionId:this.sessionId,anonymousId:this.anonymousId||void 0,source:e.utm_source,medium:e.utm_medium,campaign:e.utm_campaign,content:e.utm_content,term:e.utm_term,landingUrl:e.landing_url,referrer:e.referrer,referrerDomain:e.referrer_domain,clickToken:this.clickId})})}catch{}}maybeFirstOpen(){let e=!1;try{e=typeof localStorage!="undefined"&&localStorage.getItem(nl)==="1"}catch{}if(!e){try{typeof localStorage!="undefined"&&localStorage.setItem(nl,"1")}catch{}this.track("first_open")}}getInstallationId(){return this.installationId}setClickId(e){if(!(!e||!il.test(e))){this.clickId=e;try{typeof localStorage!="undefined"&&localStorage.setItem(ii,e)}catch{}}}build(e,t){let r=ne(),s=Object.keys(this.attributionProps).length?{...this.attributionProps,...this.superProps}:this.superProps,i=Object.keys(s).length?{...s,...t}:t,o=i&&Object.keys(i).length?mt(i):void 0,a=Object.keys(this.groups).length>0;return{event_id:H(),event_name:e.trim(),event_time:P(),platform:"web",installation_id:this.installationId,...this.deviceId?{device_id:this.deviceId}:{},anonymous_id:this.anonymousId,...this.sessionId?{session_id:this.sessionId}:{},...this.userId?{user_id:this.userId}:{},...this.clickId?{identifiers:{click_id:this.clickId}}:{},...o?{properties:o}:{},...a?{groups:{...this.groups}}:{},...r?{replay:r}:{},context:{sdk_version:Ns}}}get identity(){return{anonymousId:this.anonymousId,userId:this.userId,groups:this.groups,superProps:this.superProps}}evaluate(e,t){if(!this.plan)return{drop:!1};let r=Lc(this.plan,e,t);if(r.warnings.length)try{for(let s of r.warnings)console.warn(`[scalebun] tracking-plan: ${s}`)}catch{}return{drop:r.drop}}register(e){!e||typeof e!="object"||(this.superProps={...this.superProps,...e},Kt(Dn,this.superProps))}unregister(e){if(!(e in this.superProps))return;let{[e]:t,...r}=this.superProps;this.superProps=r,Kt(Dn,this.superProps)}group(e,t,r){!e||!t||(this.groups={...this.groups,[e]:t},Kt(ni,this.groups),this.usable&&this.enqueue(this.build("$group",{group_type:e,group_key:t,...r!=null?r:{}})))}alias(e,t){var s;if(!e)return;let r=(s=t!=null?t:this.userId)!=null?s:this.anonymousId;this.userId=e,ri(e),this.usable&&this.enqueue(this.build("$alias",{previous_id:r}))}reset(){this.userId=void 0,ri(void 0),this.anonymousId=oi();try{typeof localStorage!="undefined"&&localStorage.setItem(Qe,this.anonymousId)}catch{}this.cookieDomain&&ai(Qe,this.anonymousId,this.cookieDomain),this.superProps={},this.groups={},Kt(Dn,this.superProps),Kt(ni,this.groups)}track(e,t){if(!(!this.usable||!e)){if(!Oc(e,this.anonymousId,this.sampleRate)){this.sampledOutCount++;return}this.enqueue(this.build(e,t))}}trackPurchase(e){if(!this.usable)return;let t=Ln(e);if(!t)return;let r=this.build("purchase",t.props);r.revenue=t.revenue,r.currency=t.currency,this.enqueue(r)}trackSubscription(e){if(!this.usable)return;let t=_c(e);if(!t)return;let r=ne();this.enqueue(this.build("$subscription",r?{...t,replay:r}:t))}identify(e,t){e&&(this.userId=e,ri(e),this.usable&&this.enqueue(this.build("$identify",t)))}enqueue(e){this.queue.push(e),this.trim(),this.queue.length>=fb&&this.autoFlush()}trim(){let e=this.queue.length-hb;e>0&&(this.queue.splice(0,e),this.droppedCount+=e)}autoFlush(){!ot()||!this.backoff.ready(P())||this.flush()}async flush(e=!1){if(!this.usable||!this.queue.length)return;let t=this.queue.splice(0,this.queue.length),r=JSON.stringify({events:t});try{let{signatureHeaders:s}=await Promise.resolve().then(()=>(Js(),Ys)),i=await s(this.clientKey,r);(await fetch(`${this.apiBaseUrl}/batch`,{method:"POST",headers:{"content-type":"application/json","x-scalebun-client-key":this.clientKey,...i},body:r,keepalive:e})).ok?(this.backoff.reset(),this.flushCount++):(this.backoff.fail(P()),this.requeue(t))}catch{this.backoff.fail(P()),this.requeue(t)}this.persist()}requeue(e){this.queue.unshift(...e),this.trim()}async persist(){this.queue.length?(this.persisted=!0,await this.buffer.save(kt(this.queue))):this.persisted&&(this.persisted=!1,await this.buffer.clear())}teardown(){var e,t,r;(e=this.stopAutocapture)==null||e.call(this),this.stopAutocapture=void 0,this.timer&&clearInterval(this.timer),this.timer=void 0,this.onHide&&typeof window!="undefined"&&window.removeEventListener("pagehide",this.onHide),this.onHide=void 0,(t=this.offOnline)==null||t.call(this),(r=this.offSignal)==null||r.call(this),this.offSignal=void 0,this.offOnline=void 0,this.queue=[],this.persisted=!1,this.buffer.clear(),this.active=!1}};$();Fe();function kb(n,e){if(e in n)return n[e];if(e.indexOf(".")===-1)return;let t=n;for(let r of e.split(".")){if(t==null||typeof t!="object")return;t=t[r]}return t}function ol(n,e){let t=kb(n,e.attr),r=e.value;switch(e.op){case"exists":return t!=null;case"eq":return t===r;case"neq":return t!==r;case"in":return Array.isArray(r)&&r.includes(t);case"nin":return Array.isArray(r)&&!r.includes(t);case"contains":return typeof t=="string"&&typeof r=="string"&&t.includes(r);case"gt":return typeof t=="number"&&typeof r=="number"&&t>r;case"lt":return typeof t=="number"&&typeof r=="number"&&t<r;default:return!1}}function Eb(n,e){var o,a;let t=(o=e.all)!=null?o:[],r=(a=e.any)!=null?a:[];if(t.length===0&&r.length===0)return!0;let s=t.every(c=>ol(n,c)),i=r.length===0||r.some(c=>ol(n,c));return s&&i}function Gt(n,e){if(!n||n.length===0)return null;for(let t of n)if(Eb(e,t))return t;return null}var al="scalebun_config",ci="scalebun_flag_overrides";function Hn(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}function cl(){let n=Hn();if(!n)return null;try{let e=n.getItem(al);if(!e)return null;let t=JSON.parse(e);return t&&typeof t.version=="string"&&Array.isArray(t.flags)?t:null}catch{return null}}function ll(n){let e=Hn();if(e)try{e.setItem(al,JSON.stringify(n))}catch{}}function dl(){let n=Hn();if(!n)return{};try{let e=n.getItem(ci),t=e?JSON.parse(e):null;return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function $n(n){let e=Hn();if(e)try{Object.keys(n).length?e.setItem(ci,JSON.stringify(n)):e.removeItem(ci)}catch{}}var li={version:"",flags:[],remoteConfig:[],experiments:[],rollouts:[]};var Ib=5*60*1e3,ul=n=>{var e;return(e=n.salt)!=null?e:n.key},zn=class{constructor(){this.name="config";this.ctx=null;this.active=!1;this.payload=li;this.exposed=new Set;this.deviceId="";this.clientKey="";this.apiBaseUrl="";this.lastFetch=0;this.overrides={};this.changeListeners=new Set;this.settled=!1;this.readyPromise=new Promise(e=>this.resolveReady=e)}get isActive(){return this.active}setup(e){var t,r,s,i,o;this.ctx=e,this.deviceId=(t=e.deviceId)!=null?t:"",this.clientKey=(r=e.clientKey)!=null?r:"",this.apiBaseUrl=(s=e.apiBaseUrl)!=null?s:"",Oe({deviceId:this.deviceId}),this.overrides=dl(),this.payload=(o=(i=this.seedFromBootstrap(e.flagsBootstrap))!=null?i:cl())!=null?o:li,this.exposed=new Set,this.refresh().finally(()=>this.markReady()),typeof document!="undefined"&&(this.onVisible=()=>{document.visibilityState==="visible"&&P()-this.lastFetch>Ib&&this.refresh()},document.addEventListener("visibilitychange",this.onVisible)),e.flagsRealtime!==!1&&this.openStream(),this.active=!0}openStream(){if(!(typeof EventSource=="undefined"||!this.clientKey||!this.apiBaseUrl))try{this.es=new EventSource(`${this.apiBaseUrl}/config/stream?key=${encodeURIComponent(this.clientKey)}`),this.es.onmessage=e=>{try{if(e.data&&JSON.parse(e.data).type==="ping")return}catch{}this.refresh()}}catch{}}seedFromBootstrap(e){return!e||typeof e!="object"||!["flags","remoteConfig","experiments","rollouts"].some(r=>Array.isArray(e[r]))?null:{version:typeof e.version=="string"?e.version:"bootstrap",flags:Array.isArray(e.flags)?e.flags:[],remoteConfig:Array.isArray(e.remoteConfig)?e.remoteConfig:[],experiments:Array.isArray(e.experiments)?e.experiments:[],rollouts:Array.isArray(e.rollouts)?e.rollouts:[],entitlements:e.entitlements,holdout:e.holdout}}markReady(){var e;this.settled||(this.settled=!0,(e=this.resolveReady)==null||e.call(this))}emitChange(){for(let e of this.changeListeners)try{e()}catch{}}async refresh(){var e,t,r,s;if(!(!this.clientKey||!this.apiBaseUrl||typeof fetch=="undefined")){this.lastFetch=P();try{let i={"x-scalebun-client-key":this.clientKey};this.payload.version&&(i["if-none-match"]=`"${this.payload.version}"`);let o=await fetch(`${this.apiBaseUrl}/config`,{headers:i});if(o.status===304||!o.ok)return;let a=await o.json();if(a&&typeof a.version=="string"){let c=a.version!==this.payload.version;this.payload={version:a.version,flags:(e=a.flags)!=null?e:[],remoteConfig:(t=a.remoteConfig)!=null?t:[],experiments:(r=a.experiments)!=null?r:[],rollouts:(s=a.rollouts)!=null?s:[],entitlements:a.entitlements,holdout:a.holdout,sdkFlags:a.sdkFlags},ll(this.payload),c&&(this.exposed.clear(),this.emitChange())}}catch{}}}ready(){return this.readyPromise}onChange(e){return this.changeListeners.add(e),()=>{this.changeListeners.delete(e)}}override(e,t){this.overrides[e]=t,$n(this.overrides),this.emitChange()}clearOverride(e){Object.prototype.hasOwnProperty.call(this.overrides,e)&&(delete this.overrides[e],$n(this.overrides),this.emitChange())}clearOverrides(){this.overrides={},$n(this.overrides),this.emitChange()}hasOverride(e){return Object.prototype.hasOwnProperty.call(this.overrides,e)}bucketingId(e){var s;let t=yt();if(e){let i=t[e];if(i!=null&&i!=="")return String(i)}if((s=this.payload.sdkFlags)!=null&&s.stableBucketingId)return this.deviceId;let r=t.userId;return r!=null&&r!==""?String(r):this.deviceId}knows(e){return!this.hasOverride(e)&&this.payload.flags.some(t=>t.key===e)}isEnabled(e){var r;if(this.hasOverride(e))return!!this.overrides[e];let t=this.payload.flags.find(s=>s.key===e);if(!t)return!1;if(t.variations&&t.variations.length)return!!this.variationDetail(e,!1).value;if(t.targeting&&t.targeting.length){let s=Gt(t.targeting,yt());if(s)return typeof s.rollout=="number"?Le(this.bucketingId(t.bucketBy),ul(t))<s.rollout:(r=s.serve)!=null?r:!0}return t.enabled}variationDetail(e,t){var c,l,u;let r=this.payload.flags.find(d=>d.key===e);if(this.hasOverride(e)){let d=this.overrides[e];if(typeof d=="string"&&(r!=null&&r.variations)){let p=r.variations.find(f=>f.key===d);if(p)return{value:p.value,variant:p.key,reason:"DEFAULT"}}return{value:d!=null?d:t,variant:typeof d=="string"?d:null,reason:"DEFAULT"}}if(!r)return{value:t,variant:null,reason:"FLAG_NOT_FOUND"};let s=r.variations,i=()=>this.bucketingId(r.bucketBy),o=(d,p)=>{var m,h;let f=(m=d!=null?d:r.defaultVariant)!=null?m:null;if(f&&s){let g=s.find(S=>S.key===f);if(g)return{value:g.value,variant:f,reason:p}}return{value:(h=r.defaultValue)!=null?h:t,variant:f,reason:p}},a=()=>{if(s&&s.some(d=>typeof d.allocationPct=="number")){let d=ei(i(),e,s.map(p=>{var f;return{key:p.key,allocationPct:(f=p.allocationPct)!=null?f:0}}));return o(d,"ROLLOUT")}return s?o(null,"DEFAULT"):{value:r.enabled,variant:null,reason:"DEFAULT"}};if(r.targeting&&r.targeting.length){let d=Gt(r.targeting,yt());if(d)return typeof d.rollout=="number"?Le(i(),ul(r))>=d.rollout?a():s?o((c=d.variation)!=null?c:null,"ROLLOUT"):{value:!0,variant:null,reason:"ROLLOUT"}:d.variation||s?o((l=d.variation)!=null?l:null,"TARGETING_MATCH"):{value:(u=d.serve)!=null?u:!0,variant:null,reason:"TARGETING_MATCH"}}return a()}variation(e,t){return this.variationDetail(e,t).value}get(e,t){let r=this.payload.remoteConfig.find(s=>s.key===e);if(!r)return t;try{switch(r.type){case"number":{let s=Number(r.value);return Number.isFinite(s)?s:t}case"boolean":return r.value==="true";case"json":return JSON.parse(r.value);default:return r.value}}catch{return t}}isOn(e){if(this.hasOverride(e))return!!this.overrides[e];let t=this.payload.rollouts.find(s=>s.key===e);if(!t)return!1;let r=t.percentage;if(t.targeting&&t.targeting.length){let s=Gt(t.targeting,yt());s&&typeof s.percentage=="number"&&(r=s.percentage)}return Le(this.bucketingId(t.bucketBy),t.salt)<r}inHoldout(){let e=this.payload.holdout;return!!e&&e.percentage>0&&Le(this.bucketingId(),e.salt)<e.percentage}inLayerSlot(e){if(!e.layer||!e.layerRange)return!0;let[t,r]=e.layerRange,s=Le(this.bucketingId(),`layer:${e.layer}`);return s>=t&&s<r}variant(e){var o;if(this.hasOverride(e)){let a=this.overrides[e];return a==null?null:String(a)}let t=this.payload.experiments.find(a=>a.key===e);if(!t||this.inHoldout()||!this.inLayerSlot(t))return null;let r=t.variants;if(t.targeting&&t.targeting.length){let a=Gt(t.targeting,yt());if(!a||a.include===!1)return null;a.variants&&a.variants.length&&(r=a.variants)}let s=ei(this.bucketingId(t.bucketBy),t.salt,r),i=`${e}=${s}`;if(s&&!this.exposed.has(i)){this.exposed.add(i);let a=ne();(o=this.ctx)==null||o.emit({kind:"event",name:"experiment_exposure",props:{experiment:e,variant:s,reason:"ENROLLED",...a?{$replay:a}:{}},timestamp:P()})}return s}entitlement(e){let t=this.payload.entitlements;return(t==null?void 0:t[e])!==!1}teardown(){var e;this.onVisible&&typeof document!="undefined"&&document.removeEventListener("visibilitychange",this.onVisible),this.onVisible=void 0,(e=this.es)==null||e.close(),this.es=void 0,this.active=!1}};$();$();function pl(n){return n&&n.replace(/[\w.+-]+@[\w-]+\.[\w.-]+/g,"[email]").replace(/\?[^\s:)'"]*/g,"")}function fl(n){if(!n)return n;let e=!1,t={};for(let r in n){let s=n[r];if(typeof s=="string"){let i=j(s);t[r]=i,i!==s&&(e=!0)}else t[r]=s}return e?t:n}var ml=16*1024;function hl(n,e={}){var u,d,p,f;let{droppedSince:t=0,extra:r,frames:s,fingerprint:i,causes:o,scope:a}=e,c=n.stack;return!c&&n.source&&(c=`${n.message} at ${n.source}:${(u=n.lineno)!=null?u:0}:${(d=n.colno)!=null?d:0}`),c&&c.length>ml&&(c=c.slice(0,ml)),c=pl(c),{kind:"error",type:n.type,message:j((p=n.message)!=null?p:""),stack:c,source:"js",...n.mechanism?{mechanism:n.mechanism}:{},...s&&s.length?{frames:s}:{},...i?{fingerprint:i}:{},...o&&o.length?{causes:o}:{},...a!=null&&a.level?{level:a.level}:{},...a!=null&&a.tags?{tags:a.tags}:{},...a!=null&&a.context?{context:a.context}:{},...Cb(),...Ab(),screenName:Tb(),clientId:`err_${H()}`,timestamp:P(),...t>0?{droppedSince:t}:{},...(f=fl(r))!=null?f:{}}}function Cb(){let n=We.snapshot();return n.length?{breadcrumbs:n}:{}}function Ab(){let n=ne();return n?{replay:n}:{}}function Tb(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}var Un=class{constructor(e){this.lastSeen=new Map;this.recent=[];this.dropped=0;var t,r,s;this.dedupWindowMs=(t=e==null?void 0:e.dedupWindowMs)!=null?t:5e3,this.capCount=(r=e==null?void 0:e.capCount)!=null?r:20,this.capWindowMs=(s=e==null?void 0:e.capWindowMs)!=null?s:1e4}accept(e){let t=Date.now();if(this.lastSeen.size>512)for(let[s,i]of this.lastSeen)t-i>=this.dedupWindowMs&&this.lastSeen.delete(s);let r=this.lastSeen.get(e);return r!=null&&t-r<this.dedupWindowMs?(this.dropped++,!1):(this.recent=this.recent.filter(s=>t-s<this.capWindowMs),this.recent.length>=this.capCount?(this.dropped++,!1):(this.lastSeen.set(e,t),this.recent.push(t),!0))}takeDropped(){let e=this.dropped;return this.dropped=0,e}};var It={tags:{},context:{}};function gl(n,e){It.tags[n]=e}function bl(n,e){It.context[n]=e}function yl(n){It.level=n}function vl(n){var i;let e={...It.tags,...n==null?void 0:n.tags},t={...It.context,...n==null?void 0:n.context},r=(i=n==null?void 0:n.level)!=null?i:It.level,s={};return r&&(s.level=r),Object.keys(e).length&&(s.tags=e),Object.keys(t).length&&(s.context=t),s}Fe();var Rb="wzb-errors-v1";function wl(n,e){return n==null||n>=1?!0:n<=0?!1:e?Le(e,Rb)<n*100:!0}$();var Bb=()=>[];function Fb(n){if(!n)return"";let e=n.split(`
716
+ `).find(t=>/\bat\b|@/.test(t));return(e!=null?e:"").trim().slice(0,200)}var Pl=["ResizeObserver loop limit exceeded","ResizeObserver loop completed with undelivered notifications"];function Ll(n,e){return typeof n=="string"?e.includes(n):n.test(e)}var Vn=class{constructor(){this.name="errors";this.ctx=null;this.active=!1;this.throttle=new Un;this.ignore=Pl;this.denyUrls=[];this.captureResourceErrors=!1;this.sampled=!0;this.counters={captured:0,droppedThrottle:0,droppedIgnore:0,droppedBeforeSend:0,byType:{},lastFingerprint:void 0}}stats(){return{captured:this.counters.captured,droppedThrottle:this.counters.droppedThrottle,droppedIgnore:this.counters.droppedIgnore,droppedBeforeSend:this.counters.droppedBeforeSend,byType:{...this.counters.byType},lastFingerprint:this.counters.lastFingerprint,breadcrumbs:We.snapshot().length,sampled:this.sampled}}get isActive(){return this.active}setup(e){var r,s,i;this.ctx=e;let t=e.errorsOptions;t&&(this.ignore=[...Pl,...(r=t.ignoreErrors)!=null?r:[]],this.denyUrls=(s=t.denyUrls)!=null?s:[],this.captureResourceErrors=(i=t.captureResourceErrors)!=null?i:!1,this.beforeSend=t.beforeSend),this.sampled=wl(t==null?void 0:t.sampleRate,e.sessionId),Promise.resolve().then(()=>(Ml(),Rl)).then(o=>{this.parseStack=o.parseStack,this.computeFingerprint=o.computeFingerprint,this.extractCauses=o.extractCauses}).catch(()=>{}),typeof window!="undefined"&&(this.onError=o=>{var l,u;let a=o.target;if(!!a&&a!==window&&typeof a.tagName=="string"&&!o.error&&!o.message){if(!this.captureResourceErrors)return;let d=a.src||a.href||"";this.handleAuto({type:"fatal",message:`Failed to load ${a.tagName.toLowerCase()}${d?` ${d}`:""}`,source:d,mechanism:"resource"});return}this.handleAuto({type:"fatal",message:o.message||((l=o.error)==null?void 0:l.message)||"Uncaught error",stack:(u=o.error)==null?void 0:u.stack,source:o.filename,lineno:o.lineno,colno:o.colno,mechanism:"onerror"},o.error)},this.onRejection=o=>{var c;let a=o.reason;this.handleAuto({type:"unhandledrejection",message:(c=a==null?void 0:a.message)!=null?c:String(o.reason),stack:a==null?void 0:a.stack,mechanism:"onunhandledrejection"},o.reason)},this.sampled&&(window.addEventListener("error",this.onError,!0),window.addEventListener("unhandledrejection",this.onRejection)),this.active=!0)}shouldIgnore(e){for(let t of this.ignore)if(Ll(t,e.message))return!0;if(e.source){for(let t of this.denyUrls)if(Ll(t,e.source))return!0}return!1}handleAuto(e,t){if(this.shouldIgnore(e)){this.counters.droppedIgnore++;return}let r=`${e.type}|${e.message}|${Fb(e.stack)}`;if(!this.throttle.accept(r)){this.counters.droppedThrottle++;return}this.buildAndEmit(e,{droppedSince:this.throttle.takeDropped(),original:t})}captureHandled(e,t,r){var i;let s=e;this.buildAndEmit({type:"handled",message:(i=s==null?void 0:s.message)!=null?i:String(e),stack:s==null?void 0:s.stack,mechanism:"captureError"},{extra:t,scopeOver:r,original:e})}buildAndEmit(e,t){var a,c,l,u,d,p,f,m,h;let r=(a=this.parseStack)==null?void 0:a.call(this,e.stack),s=(u=(c=t.scopeOver)==null?void 0:c.fingerprint)!=null?u:(l=this.computeFingerprint)==null?void 0:l.call(this,e.type,r,e.message),i=t.original!=null&&this.extractCauses?this.extractCauses(t.original,(d=this.parseStack)!=null?d:Bb):void 0,o=hl(e,{droppedSince:t.droppedSince,extra:t.extra,frames:r,fingerprint:s,causes:i,scope:vl(t.scopeOver)});if(this.beforeSend)try{let g=this.beforeSend(o);if(!g){this.counters.droppedBeforeSend++;return}o=g}catch{}(p=this.ctx)==null||p.emit(o),this.counters.captured++,this.counters.byType[e.type]=((f=this.counters.byType[e.type])!=null?f:0)+1,s&&(this.counters.lastFingerprint=s),(h=this.ctx)==null||h.signal("error",{fingerprint:s,type:e.type,message:((m=e.message)!=null?m:"").slice(0,200),handled:e.type==="handled"})}teardown(){typeof window!="undefined"&&(this.onError&&window.removeEventListener("error",this.onError,!0),this.onRejection&&window.removeEventListener("unhandledrejection",this.onRejection),this.active=!1)}};var ui;function Db(){return ui||(ui=typeof TextEncoder!="undefined"?new TextEncoder:void 0)}function Wn(n){try{let e=Db();return e?e.encode(n).length:unescape(encodeURIComponent(n)).length}catch{return n.length}}function jn(n){try{return n==null?void 0:typeof n=="string"?Wn(n):typeof URLSearchParams!="undefined"&&n instanceof URLSearchParams?Wn(n.toString()):typeof Blob!="undefined"&&n instanceof Blob?n.size:n instanceof ArrayBuffer||ArrayBuffer.isView(n)?n.byteLength:void 0}catch{return}}function Xt(n){if(!n)return;let e=parseInt(n,10);return Number.isFinite(e)&&e>=0?e:void 0}function lt(){return typeof performance!="undefined"&&typeof performance.now=="function"?performance.now():Date.now()}function _l(n,e,t,r){let s=n.fetch;return typeof s!="function"?()=>{}:(n.fetch=async function(o,a){var S,v,y,b,E,w,I,x,C,M,T;let c=Hb(o),l=$b(o,a);if(t(c))return s.call(this,o,a);let u,d=a,p=r==null?void 0:r(c);if(p){u=p.traceId;let A=new Headers((S=a==null?void 0:a.headers)!=null?S:o instanceof Request?o.headers:void 0);A.set("traceparent",p.header),d={...a,headers:A}}let f=Date.now(),m=lt(),h=zb(d==null?void 0:d.body),g=Ub(o,d);try{let A=await s.call(this,o,d),O=null;try{O=typeof A.clone=="function"?A.clone():null}catch{O=null}return e({method:l,url:c,status:A.status,startedAt:f,duration:Math.round(lt()-m),requestSize:(y=jn(d==null?void 0:d.body))!=null?y:Xt((v=g==null?void 0:g.get)==null?void 0:v.call(g,"content-length")),responseSize:Xt((E=(b=A.headers)==null?void 0:b.get)==null?void 0:E.call(b,"content-length")),reqBody:h,reqContentType:(I=(w=g==null?void 0:g.get)==null?void 0:w.call(g,"content-type"))!=null?I:void 0,resContentType:(M=(C=(x=A.headers)==null?void 0:x.get)==null?void 0:C.call(x,"content-type"))!=null?M:void 0,readResponseText:O?()=>qb(O):void 0,traceId:u}),A}catch(A){let O=A,z=(O==null?void 0:O.name)==="AbortError",D=(O==null?void 0:O.name)==="TimeoutError";throw e({method:l,url:c,status:0,startedAt:f,duration:Math.round(lt()-m),error:(T=O==null?void 0:O.message)!=null?T:"network error",aborted:z,timedOut:D}),A}},()=>{n.fetch=s})}var Kn=64*1024;async function qb(n){try{let e=n.body;if(!e||typeof e.getReader!="function"){let i=await n.text();return i.length>Kn?i.slice(0,Kn):i}let t=e.getReader(),r=typeof TextDecoder!="undefined"?new TextDecoder:void 0,s="";for(;;){let{done:i,value:o}=await t.read();if(i)break;if(o&&r&&(s+=r.decode(o,{stream:!0})),s.length>=Kn){try{await t.cancel()}catch{}return s.slice(0,Kn)}}return r&&(s+=r.decode()),s}catch{return null}}function Hb(n){return typeof n=="string"?n:n instanceof URL?n.href:n.url}function $b(n,e){var r;let t=(r=e==null?void 0:e.method)!=null?r:typeof n!="string"&&!(n instanceof URL)?n.method:void 0;return(t!=null?t:"GET").toUpperCase()}function zb(n){if(typeof n=="string")return n;if(typeof URLSearchParams!="undefined"&&n instanceof URLSearchParams)return n.toString()}function Ub(n,e){try{if(e!=null&&e.headers)return new Headers(e.headers);if(typeof Request!="undefined"&&n instanceof Request)return n.headers}catch{}}function Ol(n,e,t,r){let s=n.XMLHttpRequest;if(typeof s!="function")return()=>{};let i=s.prototype.open,o=s.prototype.send,a=s.prototype.setRequestHeader;return s.prototype.open=function(c,l,...u){return this.__scalebun={method:String(c).toUpperCase(),url:String(l)},i.call(this,c,l,...u)},s.prototype.setRequestHeader=function(c,l){return this.__scalebun&&typeof c=="string"&&c.toLowerCase()==="content-type"&&(this.__scalebun.reqContentType=String(l)),a.call(this,c,l)},s.prototype.send=function(c){let l=this.__scalebun;if(l&&!t(l.url)){let u=r==null?void 0:r(l.url);if(u){l.traceId=u.traceId;try{this.setRequestHeader("traceparent",u.header)}catch{}}let d=Date.now(),p=lt(),f=typeof c=="string"?c:void 0,m=jn(c),h=!1,g=!1;this.addEventListener("abort",()=>{h=!0}),this.addEventListener("timeout",()=>{g=!0}),this.addEventListener("loadend",()=>{let S=this.status===0;e({method:l.method,url:l.url,status:this.status||0,startedAt:d,duration:Math.round(lt()-p),requestSize:m,responseSize:Wb(this),error:S?h?"aborted":g?"timeout":"network error":void 0,aborted:h,timedOut:g,reqBody:f,reqContentType:l.reqContentType,resContentType:Vb(this,"content-type"),readResponseText:async()=>{try{return typeof this.responseText=="string"?this.responseText:null}catch{return null}},traceId:l.traceId})})}return o.call(this,c)},()=>{s.prototype.open=i,s.prototype.send=o,s.prototype.setRequestHeader=a}}function Vb(n,e){var t,r;try{return(r=(t=n.getResponseHeader)==null?void 0:t.call(n,e))!=null?r:void 0}catch{return}}function Wb(n){var t;let e=Xt((t=n.getResponseHeader)==null?void 0:t.call(n,"content-length"));if(e!=null)return e;try{return typeof n.responseText=="string"?Wn(n.responseText):void 0}catch{return}}$();function Nl(n){let{status:e,error:t,aborted:r,timedOut:s}=n;if(r)return"abort";if(s)return"timeout";if((e===0||e===void 0)&&t)return jb(t)?"abort":Kb(t)?"timeout":Gb(t)?"cors":"network_error";if(typeof e=="number"){if(e>=500)return"http_5xx";if(e>=400)return"http_4xx"}}function Bl(n,e=2e3){return typeof n=="number"&&n>=e}function jb(n){return/\babort(ed)?\b/i.test(n)}function Kb(n){return/\btimed?\s*out\b|\btimeout\b/i.test(n)}function Gb(n){return/\bcors\b|cross-origin|access-control|opaque/i.test(n)}var Xb=/^(?:\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{16,}|[0-9A-HJKMNP-TV-Z]{26})$/i;function Yb(n){return n?!!(Xb.test(n)||n.length>=12&&/\d/.test(n)&&/^[A-Za-z0-9_-]+$/.test(n)):!1}function Fl(n){let e=n;try{let s=typeof location!="undefined"?location.href:"http://x";e=new URL(n,s).pathname}catch{let s=e.indexOf("?");s>=0&&(e=e.slice(0,s));let i=e.indexOf("#");i>=0&&(e=e.slice(0,i))}if(e==="/"||e==="")return e||"/";let t=e.split("/"),r=!1;for(let s=0;s<t.length;s++){let i=t[s];i!==void 0&&Yb(i)&&(t[s]=":id",r=!0)}return r?t.join("/"):e}function Dl(n,e={}){var a,c;let t=(a=n.protocol)!=null?a:"http",r=t==="http"||t==="beacon"?Nl({status:n.status,error:n.error,aborted:n.aborted,timedOut:n.timedOut}):void 0,s=Bl(n.duration,(c=e.slowMs)!=null?c:2e3),i=Fl(n.url);return{kind:"network",method:n.method,url:n.url,status:n.status,startedAt:n.startedAt,duration:n.duration,error:n.error,requestSize:n.requestSize,responseSize:n.responseSize,route:i,screenName:Jb(),...t!=="http"?{protocol:t}:{},...r?{failure:r}:{},...s?{slow:!0}:{},...n.transferSize!==void 0?{transferSize:n.transferSize}:{},...n.graphql?{graphql:n.graphql}:{},...n.timing?{timing:n.timing}:{},...n.ws?{ws:n.ws}:{},...n.request?{request:n.request}:{},...n.response?{response:n.response}:{},...n.traceId?{traceId:n.traceId}:{},clientId:`net_${H()}`,timestamp:P()}}function Jb(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}function ql(n){let e=new Uint8Array(n),t=globalThis.crypto;if(t&&typeof t.getRandomValues=="function")t.getRandomValues(e);else for(let s=0;s<n;s++)e[s]=Math.floor(Math.random()*256);let r="";for(let s of e)r+=s.toString(16).padStart(2,"0");return r}function Qb(){let n=ql(16),e=ql(8);return{traceId:n,spanId:e,header:`00-${n}-${e}-01`}}function Zb(n){try{let e=typeof location!="undefined"?location.href:void 0;return new URL(n,e).origin}catch{return null}}function Hl(n){if(!n.length)return null;let e=new Set(n);return t=>{let r=Zb(t);return r&&e.has(r)?Qb():null}}var ey=new Set(["fetch","xmlhttprequest"]);function ty(n){let e={},t=n.domainLookupEnd-n.domainLookupStart,r=n.connectEnd-n.connectStart,s=n.secureConnectionStart>0?n.connectEnd-n.secureConnectionStart:0,i=n.responseStart-n.requestStart,o=n.responseEnd-n.responseStart;t>0&&(e.dns=Yt(t)),r>0&&(e.tcp=Yt(r)),s>0&&(e.tls=Yt(s)),i>0&&(e.ttfb=Yt(i)),o>0&&(e.download=Yt(o));let a={};return Object.keys(e).length&&(a.timing=e),typeof n.transferSize=="number"&&n.transferSize>0&&(a.transferSize=n.transferSize),a}function Yt(n){return Math.round(n*100)/100}var Ct=class Ct{constructor(){this.byUrl=new Map;this.timeOriginMs=0}install(){var e;if(typeof PerformanceObserver=="undefined"||typeof performance=="undefined")return!1;this.timeOriginMs=(e=performance.timeOrigin)!=null?e:0;try{return this.observer=new PerformanceObserver(t=>{for(let r of t.getEntries()){let s=r;ey.has(s.initiatorType)&&this.add(s)}}),this.observer.observe({type:"resource",buffered:!0}),!0}catch{return!1}}add(e){let t=e.name,r=this.byUrl.get(t);r||(r=[],this.byUrl.set(t,r)),r.push(e),r.length>Ct.MAX_PER_URL&&r.shift(),this.prune()}match(e,t){let r=this.byUrl.get(e);if(!r||!r.length)return{};let s=t-this.timeOriginMs,i=0,o=1/0;for(let c=0;c<r.length;c++){let l=r[c];if(!l)continue;let u=Math.abs(l.startTime-s);u<o&&(o=u,i=c)}let[a]=r.splice(i,1);return r.length||this.byUrl.delete(e),a?ty(a):{}}prune(){if(typeof performance=="undefined")return;let e=performance.now()-Ct.TTL_MS;for(let[t,r]of this.byUrl){let s=r.filter(i=>i.startTime>=e);s.length?this.byUrl.set(t,s):this.byUrl.delete(t)}}teardown(){var e;(e=this.observer)==null||e.disconnect(),this.observer=void 0,this.byUrl.clear()}};Ct.TTL_MS=6e4,Ct.MAX_PER_URL=8;var Xn=Ct;Fe();function $l(n,e){if(n.failed||n.slow)return!0;let t=e>=1?1:e<=0?0:e;return t>=1?!0:t<=0?!1:Ee(n.key)%1e4<Math.round(t*1e4)}var Yn=class{constructor(e,t,r){this.windowMs=e;this.emit=t;this.onSuppress=r;this.map=new Map}push(e){var s,i,o,a;let t=`${e.method}|${(s=e.route)!=null?s:e.url}|${(o=(i=e.status)!=null?i:e.error)!=null?o:""}`,r=this.map.get(t);return r?(r.count++,r.item=e,clearTimeout(r.timer),r.timer=setTimeout(()=>this.flush(t),this.windowMs),(a=this.onSuppress)==null||a.call(this),!1):(this.map.size>=500&&this.evictOldest(),this.map.set(t,{count:0,item:e,timer:setTimeout(()=>this.flush(t),this.windowMs)}),this.emit(e),!0)}flush(e){let t=this.map.get(e);this.map.delete(e),t&&t.count>0&&this.emit({...t.item,repeat:t.count})}evictOldest(){let e=this.map.keys().next().value;if(e!==void 0){let t=this.map.get(e);t&&clearTimeout(t.timer),this.flush(e)}}get pending(){return this.map.size}dispose(){for(let e of this.map.values())clearTimeout(e.timer);this.map.clear()}};function ay(n,e){return typeof n=="string"?e.includes(n):n.test(e)}var Qn=class{constructor(){this.name="network";this.active=!1;this.uninstalls=[];this.slowMs=2e3;this.sampleRate=1;this.dedupMs=0;this.denyUrls=[];this.timingIndex=new Xn;this.timingOn=!1;this.counters={captured:0,byProtocol:{http:0,ws:0,sse:0,beacon:0},byFailure:{http_4xx:0,http_5xx:0,network_error:0,timeout:0,cors:0,abort:0},dropped:0,sampledIn:0,bodiesCaptured:0}}stats(){return{captured:this.counters.captured,byProtocol:{...this.counters.byProtocol},byFailure:{...this.counters.byFailure},dropped:this.counters.dropped,sampledIn:this.counters.sampledIn,bodiesCaptured:this.counters.bodiesCaptured}}get isActive(){return this.active}setup(e){var u,d,p,f,m,h;if(typeof window=="undefined")return;let t=(u=e.networkOptions)!=null?u:{};this.slowMs=(d=t.slowRequestMs)!=null?d:2e3,this.sampleRate=typeof t.sampleRate=="number"?t.sampleRate:1;let r=t.dedupWindowMs;this.dedupMs=typeof r=="number"&&r>0?r:0,this.dedupMs>0&&(this.deduper=new Yn(this.dedupMs,g=>{this.record(g),e.emit(g)},()=>{this.counters.dropped++})),this.denyUrls=(p=t.denyUrls)!=null?p:[],this.beforeSend=t.beforeSend,t.captureBodies&&(this.bodyOpts={bodyMaxBytes:Math.min(Math.max(0,(f=t.bodyMaxBytes)!=null?f:8192),64*1024),contentTypeAllowlist:t.contentTypeAllowlist&&t.contentTypeAllowlist.length?t.contentTypeAllowlist:["application/json","text/plain"]}),this.timingOn=this.timingIndex.install();let s=e.apiBaseUrl,i=g=>!!s&&g.startsWith(s),o=g=>this.handle(e,g),a=(h=Hl((m=e.traceOrigins)!=null?m:[]))!=null?h:void 0;this.uninstalls.push(_l(window,o,i,a)),this.uninstalls.push(Ol(window,o,i,a));let c={ws:t.trackWebSocket!==!1,sse:t.trackSse!==!1,beacon:!0},l=typeof navigator!="undefined"?navigator:void 0;Promise.resolve().then(()=>(Kl(),jl)).then(g=>{this.active&&this.uninstalls.push(...g.installStreams(window,l,o,i,c))}).catch(()=>{}),this.active=!0}handle(e,t){var s;if(this.denyUrls.some(i=>ay(i,t.url))){this.counters.dropped++;return}let r=(s=t.protocol)!=null?s:"http";if(this.timingOn&&r==="http"&&t.timing===void 0){setTimeout(()=>{if(!this.active)return;let i=this.timingIndex.match(t.url,t.startedAt);i.timing&&(t.timing=i.timing),i.transferSize!==void 0&&t.transferSize===void 0&&(t.transferSize=i.transferSize),this.finalize(e,t)},0);return}this.finalize(e,t)}finalize(e,t){var o;let r=(o=t.protocol)!=null?o:"http",s=r==="http"&&t.graphql===void 0&&this.maybeGraphql(t),i=!!this.bodyOpts&&r==="http";if(s||i){Promise.resolve().then(()=>(nd(),td)).then(a=>a.enrichHttpCapture(t,{graphql:s,body:i?this.bodyOpts:void 0})).catch(()=>{}).finally(()=>{this.active&&this.emit(e,t)});return}this.emit(e,t)}maybeGraphql(e){return e.method!=="POST"?!1:/graphql/i.test(e.url)||!!e.reqBody&&e.reqBody.includes("query")}emit(e,t){let r=Dl(t,{slowMs:this.slowMs});if(this.sampleRate<1){if(!$l({failed:!!r.failure,slow:!!r.slow,key:`${t.url}|${t.startedAt}`},this.sampleRate)){this.counters.dropped++;return}this.counters.sampledIn++}if(this.beforeSend)try{let s=this.beforeSend(r);if(s==null){this.counters.dropped++;return}r=s}catch{}r.failure&&r.failure!=="abort"&&e.signal("network_error"),this.emitItem(e,r)}emitItem(e,t){if(this.deduper){this.deduper.push(t);return}this.record(t),e.emit(t)}record(e){var s;this.counters.captured++;let t=(s=e.protocol)!=null?s:"http";this.counters.byProtocol[t]++;let r=e.failure;r&&this.counters.byFailure[r]++,(e.request||e.response)&&this.counters.bodiesCaptured++}teardown(){var e;for(let t of this.uninstalls)t();this.uninstalls=[],(e=this.deduper)==null||e.dispose(),this.deduper=void 0,this.timingIndex.teardown(),this.timingOn=!1,this.active=!1}};qs();function rd(n){let e=n[n.length-1];return e&&(e.renderTime||e.loadTime||e.startTime)||0}function vi(){return{max:0,cur:0,first:0,last:0}}function sd(n,e){for(let t of e){if(t.hadRecentInput||typeof t.value!="number")continue;let r=typeof t.startTime=="number"?t.startTime:n.last;n.cur>0&&r-n.last<1e3&&r-n.first<5e3?(n.cur+=t.value,n.last=r):(n.cur=t.value,n.first=r,n.last=r),n.cur>n.max&&(n.max=n.cur)}return n}function id(n,e){let t=n;for(let r of e)typeof r.duration=="number"&&r.duration>t&&(t=r.duration);return t}function wi(n){if(n)return n.replace(/[?#].*$/,"")}function od(){if(typeof performance=="undefined"||typeof performance.getEntriesByType!="function")return;let n=performance.getEntriesByType("navigation")[0];if(!n||!(n.responseStart>0))return;let e=(t,r)=>t>0&&r>=t?Math.round(r-t):0;return{redirect:e(n.redirectStart,n.redirectEnd),worker:e(n.workerStart,n.fetchStart),dns:e(n.domainLookupStart,n.domainLookupEnd),tcp:e(n.connectStart,n.connectEnd),tls:e(n.secureConnectionStart,n.connectEnd),request:e(n.requestStart,n.responseStart)}}function ad(n){var a,c,l,u;if(typeof performance=="undefined"||typeof performance.getEntriesByType!="function")return;let e=performance.getEntriesByType("navigation")[0],t=Math.max(0,(a=e==null?void 0:e.responseStart)!=null?a:0),r=(l=(c=n.renderTime)!=null?c:n.loadTime)!=null?l:0;if(r<=0)return;let s=t,i=(u=n.loadTime)!=null?u:r;if(n.url){let d=performance.getEntriesByName(n.url)[0];d&&(s=Math.max(t,d.requestStart||d.startTime||t),i=n.loadTime||d.responseEnd||i)}let o=d=>Math.round(Math.max(0,d));return{ttfb:o(t),resourceLoadDelay:o(s-t),resourceLoadTime:n.url?o(i-s):0,elementRenderDelay:o(r-(n.url?i:t))}}function cd(n,e){let t;for(let r of n)if(!(r.end<e.start||r.start>e.end))for(let s of r.scripts)s.url&&(!t||s.dur>t.duration)&&(t={url:s.url,duration:Math.round(s.dur),fn:s.fn,invokerType:s.invokerType});return t}var cy={lcp:[2500,4e3],inp:[200,500],cls:[.1,.25],fcp:[1800,3e3],ttfb:[800,1800]};function ld(n,e){let t=cy[n];return t?e<=t[0]?"good":e<=t[1]?"needs-improvement":"poor":"unknown"}function xi(n){if(!n||typeof n.tagName!="string")return;let e=[],t=n,r=0;for(;t&&t.nodeType===1&&r<5;){if(t.id){e.unshift(`#${dd(t.id)}`);break}let s=t.getAttribute&&t.getAttribute("data-testid");if(s){e.unshift(`[data-testid="${dd(s)}"]`);break}let i=t.tagName.toLowerCase(),o=t.parentElement;if(!o){e.unshift(i);break}let a=ly(t,i);e.unshift(a>1?`${i}:nth-of-type(${a})`:i),t=o,r++}return e.length?e.join(" > "):void 0}function ly(n,e){let t=1,r=n.previousElementSibling;for(;r;)r.tagName&&r.tagName.toLowerCase()===e&&t++,r=r.previousElementSibling;return t}function dd(n){return n.replace(/([^\w-])/g,"\\$1")}function ud(n){if(n)return{x:De(n.x),y:De(n.y),width:De(n.width),height:De(n.height)}}function De(n){return typeof n=="number"&&isFinite(n)?n:0}function pd(n){if(!n)return;let e=n.element,t=typeof n.url=="string"&&n.url?n.url:void 0,r=xi(e),s=e&&typeof e.tagName=="string"?e.tagName.toLowerCase():void 0,i=typeof n.loadTime=="number"?n.loadTime:void 0,o=typeof n.renderTime=="number"?n.renderTime:void 0;if(!r&&!t&&!s&&i===void 0&&o===void 0)return;let a={};return r&&(a.element=r),s&&(a.elementTag=s),t&&(a.url=t),i!==void 0&&(a.loadTime=Jt(i)),o!==void 0&&(a.renderTime=Jt(o)),a}function Si(){return{largestValue:0,sources:[]}}function fd(n,e,t=5){var r;for(let s of e){if(s.hadRecentInput)continue;let i=De(s.value);if(i<=0||i<=n.largestValue)continue;let o=s.sources||[],a=[];for(let c of o.slice(0,t)){let l=(r=c.node)!=null?r:void 0;a.push({selector:xi(l),previousRect:ud(c.previousRect),currentRect:ud(c.currentRect)})}n.largestValue=i,n.sources=a}return n}function md(n){if(!(n.largestValue<=0||n.sources.length===0))return{largestShiftValue:Math.round(n.largestValue*1e3)/1e3,sources:n.sources}}function ki(){return{duration:0}}function hd(n,e){for(let t of e){let r=De(t.duration);r<=n.duration||(n.duration=r,n.attribution=dy(t))}return n}function dy(n){var c;let e=(c=n.target)!=null?c:void 0,t=De(n.startTime),r=De(n.processingStart),s=De(n.processingEnd),i=De(n.duration),o={},a=xi(e);return a&&(o.element=a),e&&typeof e.tagName=="string"&&(o.elementTag=e.tagName.toLowerCase()),typeof n.name=="string"&&(o.eventType=n.name),r>0&&(o.inputDelay=Jt(Math.max(0,r-t))),s>=r&&r>0&&(o.processingTime=Jt(Math.max(0,s-r))),s>0&&(o.presentationDelay=Jt(Math.max(0,t+i-s))),o}function gd(n){return n.duration>0?n.attribution:void 0}function Jt(n){return Math.round(n)}$();var er=class er{constructor(){this.name="webVitals";this.ctx=null;this.active=!1;this.disconnects=[];this.lcp=0;this.clsState=vi();this.inp=0;this.clsAcc=Si();this.inpAcc=ki();this.route="/";this.loaf=[]}get isActive(){return this.active}setup(e){this.ctx=e,typeof PerformanceObserver!="undefined"&&(this.disconnects.push(Pe("largest-contentful-paint",t=>{var s,i;let r=rd(t);r&&(this.lcp=r,this.lcpAttr=(s=pd(t[t.length-1]))!=null?s:this.lcpAttr,(i=this.lcpAttr)!=null&&i.url&&(this.lcpAttr.url=wi(this.lcpAttr.url)))})),this.disconnects.push(Pe("layout-shift",t=>{sd(this.clsState,t),fd(this.clsAcc,t)})),this.disconnects.push(Pe("event",t=>{let r=this.inp;for(let s of t)typeof s.duration=="number"&&s.duration>r&&typeof s.startTime=="number"&&(r=s.duration,this.inpWindow={start:s.startTime,end:s.startTime+s.duration});this.inp=id(this.inp,t),hd(this.inpAcc,t)},{durationThreshold:40})),this.disconnects.push(Pe("long-animation-frame",t=>{var r,s,i;for(let o of t){if(this.loaf.length>=er.LOAF_CAP)break;let a=(r=o.startTime)!=null?r:0,c=((s=o.scripts)!=null?s:[]).map(l=>{var u;return{url:(u=wi(l.sourceURL||l.name||""))!=null?u:"",dur:typeof l.duration=="number"?l.duration:0,fn:l.sourceFunctionName,invokerType:l.invokerType}});this.loaf.push({start:a,end:a+((i=o.duration)!=null?i:0),scripts:c})}})),this.disconnects.push(Pe("paint",t=>{let r=t.find(s=>s.name==="first-contentful-paint");r&&this.emit("fcp",r.startTime,"ms")})),this.route=yd(bd()),this.installRouteDetection(),this.emitTtfb(),typeof document!="undefined"&&(this.hideHandler=()=>{document.visibilityState==="hidden"&&this.finalizeRoute()},document.addEventListener("visibilitychange",this.hideHandler)),this.active=!0)}emitTtfb(){try{let e=typeof performance!="undefined"?performance.getEntriesByType("navigation")[0]:void 0;e&&e.responseStart>0&&this.emit("ttfb",e.responseStart,"ms",{ttfbPhases:od()})}catch{}}finalizeRoute(){let e=this.clsState.max;if(this.lcp>0){if(this.lcpAttr){let t=ad(this.lcpAttr);t&&(this.lcpAttr.phases=t)}this.emit("lcp",this.lcp,"ms",this.lcpAttr)}if(this.inp>0){let t=gd(this.inpAcc);if(t&&this.inpWindow){let r=cd(this.loaf,this.inpWindow);r&&(t.loafScript=r)}this.emit("inp",this.inp,"ms",t)}e>0&&this.emit("cls",Math.round(e*1e3)/1e3,"score",md(this.clsAcc)),this.lcp=this.inp=0,this.clsState=vi(),this.lcpAttr=void 0,this.clsAcc=Si(),this.inpAcc=ki(),this.loaf=[],this.inpWindow=void 0}onRouteChange(){let e=yd(bd());e!==this.route&&(this.finalizeRoute(),this.route=e)}installRouteDetection(){let e=typeof window!="undefined"?window:void 0;if(!e)return;let t=()=>this.onRouteChange(),r=e.navigation;if(r&&typeof r.addEventListener=="function"){r.addEventListener("currententrychange",t),this.routeStop=()=>r.removeEventListener("currententrychange",t);return}e.addEventListener("popstate",t);let s=e.history,i=s.pushState,o=s.replaceState,a=c=>function(...l){let u=c.apply(this,l);return t(),u};try{s.pushState=a(i),s.replaceState=a(o)}catch{}this.routeStop=()=>{e.removeEventListener("popstate",t);try{s.pushState=i,s.replaceState=o}catch{}}}emit(e,t,r,s){var o,a,c;let i={kind:"performance",metric:e,value:r==="score"?t:Math.round(t),unit:r,screenName:this.route,clientId:`vit_${H()}`,timestamp:P()};s&&(i.attribution=s),(o=this.ctx)==null||o.emit(i),(c=(a=this.ctx)==null?void 0:a.signal)==null||c.call(a,"web_vital",{metric:e,value:i.value,unit:r,rating:ld(e,i.value),path:this.route})}teardown(){var e;for(let t of this.disconnects)t();this.disconnects=[],this.hideHandler&&typeof document!="undefined"&&document.removeEventListener("visibilitychange",this.hideHandler),(e=this.routeStop)==null||e.call(this),this.routeStop=void 0,this.active=!1}};er.LOAF_CAP=30;var Zn=er;function bd(){try{return typeof location!="undefined"?location.pathname:"/"}catch{return"/"}}function yd(n){return n.replace(/\/[0-9a-f]{8,}(?=\/|$)/gi,"/:id").replace(/\/\d+(?=\/|$)/g,"/:id")||"/"}$();Ei();$();var uy=()=>{try{return typeof location!="undefined"?location.pathname:void 0}catch{return}};function Qt(n,e,t={}){var r;return{kind:"performance",metric:j(n),value:Math.round(e*1e3)/1e3,unit:(r=t.unit)!=null?r:"ms",screenName:uy(),clientId:`perf_${H()}`,...t.duration!=null?{duration:Math.round(t.duration)}:{},...t.metadata?{metadata:t.metadata}:{},timestamp:P()}}var Zt=class{constructor(e){this.recent=[];this.dropped=0;var t,r;this.capCount=(t=e==null?void 0:e.capCount)!=null?t:60,this.windowMs=(r=e==null?void 0:e.windowMs)!=null?r:1e4}accept(){let e=Date.now();return this.recent=this.recent.filter(t=>e-t<this.windowMs),this.recent.length>=this.capCount?(this.dropped++,!1):(this.recent.push(e),!0)}takeDropped(){let e=this.dropped;return this.dropped=0,e}};var nr=class{constructor(e){this.open=new Map;this.dropped=0;var t,r,s;this.maxOpen=(t=e==null?void 0:e.maxOpen)!=null?t:100,this.ttlMs=(r=e==null?void 0:e.ttlMs)!=null?r:6e4,this.clock=(s=e==null?void 0:e.clock)!=null?s:Date.now}start(e){if(e){if(this.expire(),!this.open.has(e)&&this.open.size>=this.maxOpen){this.dropped++;return}this.open.set(e,this.clock())}}stop(e){this.expire();let t=this.open.get(e);return t==null?null:(this.open.delete(e),{name:e,durationMs:this.clock()-t})}expire(){let e=this.clock();for(let[t,r]of this.open)e-r>this.ttlMs&&(this.open.delete(t),this.dropped++)}takeDropped(){let e=this.dropped;return this.dropped=0,e}clear(){this.open.clear(),this.dropped=0}};$();function xd(n){var t,r;let e=n;return{value:(t=e.duration)!=null?t:0,metadata:{startTime:Math.round((r=e.startTime)!=null?r:0)}}}function Sd(n){var i,o,a,c,l,u,d,p,f,m;let e=n,t=Array.isArray(e.scripts)?e.scripts:[],r;for(let h of t)(!r||((i=h.duration)!=null?i:0)>((o=r.duration)!=null?o:0))&&(r=h);let s={frameDuration:Math.round((a=e.duration)!=null?a:0),startTime:Math.round((c=e.startTime)!=null?c:0)};if(r){let h={url:j(String((u=(l=r.sourceURL)!=null?l:r.name)!=null?u:"")),invoker:j(String((d=r.invoker)!=null?d:"")),duration:Math.round((p=r.duration)!=null?p:0)};r.sourceFunctionName&&(h.fn=String(r.sourceFunctionName)),r.sourceCharPosition!=null&&r.sourceCharPosition>=0&&(h.pos=r.sourceCharPosition),r.forcedStyleAndLayoutDuration&&(h.forcedLayout=Math.round(r.forcedStyleAndLayoutDuration)),r.invokerType&&(h.invokerType=String(r.invokerType)),s.script=h}return{value:(m=(f=e.blockingDuration)!=null?f:e.duration)!=null?m:0,metadata:s}}var py=new Set(["fetch","xmlhttprequest","beacon"]);function fy(n){return n.replace(/[?#].*$/,"")}function en(n,e){return n>0&&e>=n?Math.round(e-n):void 0}var Ii="";function kd(n){Ii=(n!=null?n:"").replace(/\/$/,"")}function my(n){return!!Ii&&n.startsWith(Ii)}function Ed(n){if(py.has(n.initiatorType)||my(n.name))return null;let e=Math.round(n.duration);if(e<=0)return null;let t={kind:"resource",initiator:n.initiatorType,url:fy(n.name)},r=(i,o)=>{o!==void 0&&o>0&&(t[i]=o)};r("dns",en(n.domainLookupStart,n.domainLookupEnd)),r("tcp",en(n.connectStart,n.connectEnd)),r("tls",n.secureConnectionStart>0?en(n.secureConnectionStart,n.connectEnd):void 0),r("ttfb",en(n.requestStart,n.responseStart)),r("download",en(n.responseStart,n.responseEnd)),r("transferSize",n.transferSize||void 0),r("encodedSize",n.encodedBodySize||void 0),r("decodedSize",n.decodedBodySize||void 0);let s=n.renderBlockingStatus;return s&&(t.renderBlocking=s),{value:e,metadata:t}}function Id(n){if(typeof window=="undefined"||typeof history=="undefined"||typeof location=="undefined")return()=>{};let e=()=>location.pathname+location.search,t=e(),r=()=>{let o=e();if(o!==t){t=o;try{n(o)}catch{}}},s=history.pushState,i=history.replaceState;return history.pushState=function(...a){let c=s.apply(this,a);return r(),c},history.replaceState=function(...a){let c=i.apply(this,a);return r(),c},window.addEventListener("popstate",r),window.addEventListener("hashchange",r),()=>{history.pushState=s,history.replaceState=i,window.removeEventListener("popstate",r),window.removeEventListener("hashchange",r)}}Fe();var hy="wzb-traces-v1";function Cd(n){return n.durationMs>=n.slowMs||n.hasError||n.sampleRate>=1?!0:n.sampleRate<=0?!1:Ee(`${n.traceId}:${hy}`)%100<n.sampleRate*100}ir();var by=1e3,yy=3e3,vy=()=>typeof performance!="undefined"&&performance.now?performance.now():Date.now();function wy(){try{let n=typeof PerformanceObserver!="undefined"&&PerformanceObserver.supportedEntryTypes;return Array.isArray(n)&&n.includes("long-animation-frame")}catch{return!1}}var cr=class{constructor(){this.name="performance";this.ctx=null;this.active=!1;this.disconnects=[];this.cap=new Zt;this.resCap=new Zt({capCount:100,windowMs:1e4});this.traces=new nr;this.pageloadEmitted=!1;this.tracesSampleRate=1;this.slowTxnMs=yy;this.droppedTxns=0;this.txnCount=0;this.resourceCount=0;this.jankCount=0}get isActive(){return this.active}setup(e){if(this.active)return;this.ctx=e,kd(e.apiBaseUrl);let t=e.performanceOptions;t&&(typeof t.tracesSampleRate=="number"&&(this.tracesSampleRate=t.tracesSampleRate),typeof t.slowTransactionMs=="number"&&(this.slowTxnMs=t.slowTransactionMs)),Promise.resolve().then(()=>(Od(),_d)).then(s=>{this.engine=s,this.tryEmitPageload()}).catch(()=>{});let r=()=>{var i,o;let s=(o=(i=performance.getEntriesByType)==null?void 0:i.call(performance,"navigation"))==null?void 0:o[0];s&&(this.navEntry=s,this.tryEmitPageload())};if(typeof document!="undefined"&&document.readyState==="complete"?r():typeof window!="undefined"&&window.addEventListener("load",()=>setTimeout(r,0),{once:!0}),this.disconnects.push(Id(s=>this.onRouteChange(s))),typeof window!="undefined"){let s=()=>this.finishRouteTxn();window.addEventListener("pagehide",s),this.disconnects.push(()=>window.removeEventListener("pagehide",s))}if(e.onSignal&&this.disconnects.push(e.onSignal(s=>{var i;s==="error"&&((i=this.activeTxn)==null||i.noteError())})),typeof PerformanceObserver=="undefined"){this.active=!0;return}wy()?this.disconnects.push(Pe("long-animation-frame",s=>{for(let i of s)this.emitCapped("loaf",i,Sd(i))})):this.disconnects.push(Pe("longtask",s=>{for(let i of s)this.emitCapped("longtask",i,xd(i))})),this.disconnects.push(Pe("resource",s=>{for(let i of s){let o=Ed(i);o&&this.emitResource(o)}})),this.active=!0}emitResource(e){var s;if(!this.resCap.accept())return;let t=this.resCap.takeDropped(),r=t>0?{...e.metadata,droppedSince:t}:e.metadata;this.resourceCount++,(s=this.ctx)==null||s.emit(Qt("resource",e.value,{unit:"ms",duration:e.value,metadata:r}))}perfStats(){return{transactions:this.txnCount,droppedTransactions:this.droppedTxns,resources:this.resourceCount,jank:this.jankCount,activeTransaction:!!this.activeTxn,sampleRate:this.tracesSampleRate}}emitCapped(e,t,r){var a,c,l;if(!this.cap.accept())return;let s=this.cap.takeDropped(),i=s>0?{...r.metadata,droppedSince:s}:r.metadata;this.jankCount++,(a=this.ctx)==null||a.emit(Qt(e,r.value,{unit:"ms",metadata:i}));let o=i.script;vd({metric:e,blockingMs:r.value,frameDurationMs:e==="loaf"?Number((c=i.frameDuration)!=null?c:t.duration):t.duration,script:o?{url:o.url,invoker:o.invoker}:void 0}),(l=this.activeTxn)==null||l.addSpan(e,t.startTime,t.startTime+t.duration,r.metadata)}startTransaction(e){if(!this.engine)return sr;let t=new this.engine.Transaction(e,{clock:vy,onFinish:r=>this.emitTransaction(r)});return this.activeTxn=t,t}getActiveTraceContext(){var e;return(e=this.activeTxn)==null?void 0:e.context()}emitTransaction(e){this.activeTxn===e&&(this.activeTxn=void 0),this.emitTransactionData(e.data())}emitTransactionData(e){var r,s,i,o;if(e.durationMs>=this.slowTxnMs&&((s=(r=this.ctx)==null?void 0:r.signal)==null||s.call(r,"slow_screen")),!Cd({traceId:e.traceId,durationMs:e.durationMs,slowMs:this.slowTxnMs,sampleRate:this.tracesSampleRate,hasError:((i=e.errorCount)!=null?i:0)>0})){this.droppedTxns++;return}this.txnCount++;let t=ne();(o=this.ctx)==null||o.emit(Qt("transaction",e.durationMs,{unit:"ms",duration:e.durationMs,metadata:{kind:"transaction",name:e.name,trace:{traceId:e.traceId,spanId:e.spanId,sampled:e.sampled},spans:e.spans,...e.droppedSpans?{droppedSpans:e.droppedSpans}:{},...e.errorCount?{errorCount:e.errorCount}:{},...t?{replay:t}:{}}}))}tryEmitPageload(){if(this.pageloadEmitted||!this.engine||!this.navEntry||!this.navEntry.loadEventEnd)return;this.pageloadEmitted=!0;let e=typeof location!="undefined"?location.pathname:"/";this.emitTransactionData(this.engine.buildPageload(this.navEntry,e))}onRouteChange(e){this.finishRouteTxn(),this.routeTxn=this.startTransaction(`navigation ${e}`),typeof setTimeout!="undefined"&&(this.routeTimer=setTimeout(()=>this.finishRouteTxn(),by))}finishRouteTxn(){var e;this.routeTimer!==void 0&&(clearTimeout(this.routeTimer),this.routeTimer=void 0),(e=this.routeTxn)==null||e.finish(),this.routeTxn=void 0}startTrace(e){this.traces.start(e)}stopTrace(e){var r;let t=this.traces.stop(e);t&&((r=this.ctx)==null||r.emit(Qt(t.name,t.durationMs,{unit:"ms",duration:t.durationMs,metadata:{kind:"trace"}})))}teardown(){this.finishRouteTxn();for(let e of this.disconnects)e();this.disconnects=[],this.traces.clear(),this.active=!1}};$();var dr=class{constructor(e){this.onScreen=e;this.last="";this.cleanup=[]}start(){if(typeof window!="undefined"){if(typeof document!="undefined"&&document.prerendering){let e=()=>this.begin();document.addEventListener("prerenderingchange",e,{once:!0}),this.cleanup.push(()=>document.removeEventListener("prerenderingchange",e));return}this.begin()}}begin(){this.last=lr(),this.onScreen("",this.last);let e=window.navigation;if(e&&typeof e.addEventListener=="function"){let a=c=>{var u;let l=(u=c.destination)==null?void 0:u.url;this.check(l?xy(l):lr())};e.addEventListener("navigate",a),this.cleanup.push(()=>e.removeEventListener("navigate",a))}let t=history,r=t.pushState,s=t.replaceState,i=()=>this.check();t.pushState=function(...a){let c=r.apply(this,a);return i(),c},t.replaceState=function(...a){let c=s.apply(this,a);return i(),c},this.cleanup.push(()=>{t.pushState=r,t.replaceState=s});let o=()=>this.check();window.addEventListener("popstate",o),window.addEventListener("pageshow",o),this.cleanup.push(()=>{window.removeEventListener("popstate",o),window.removeEventListener("pageshow",o)})}check(e=lr()){if(e&&e!==this.last){let t=this.last;this.last=e,this.onScreen(t,e)}}stop(){for(let e of this.cleanup)e();this.cleanup=[]}};function lr(){try{return typeof location!="undefined"?location.pathname:""}catch{return""}}function xy(n){try{return new URL(n).pathname}catch{return lr()}}var ur=class{constructor(e=800,t=30,r=3){this.windowMs=e;this.radius=t;this.min=r;this.history=[]}push(e,t,r){this.history=this.history.filter(i=>r-i.t<this.windowMs);let s=this.history.filter(i=>Math.hypot(i.x-e,i.y-t)<=this.radius);return this.history.push({x:e,y:t,t:r}),s.length+1>=this.min}},pr=class{constructor(e=700){this.deadMs=e;this.lastChangeT=0;this.observer=null;this.timers=new Set;this.startHref=""}observe(e){typeof MutationObserver!="undefined"&&(this.startHref=Nd(),this.observer=new MutationObserver(()=>{this.lastChangeT=Date.now()}),this.observer.observe(e,{subtree:!0,childList:!0,attributes:!0,characterData:!0}))}onClick(e,t){let r=setTimeout(()=>{this.timers.delete(r),this.lastChangeT<e&&Nd()===this.startHref&&t()},this.deadMs);this.timers.add(r)}disconnect(){var e;(e=this.observer)==null||e.disconnect(),this.observer=null;for(let t of this.timers)clearTimeout(t);this.timers.clear()}};function Nd(){try{return typeof location!="undefined"?location.href:""}catch{return""}}function Bd(n){let e=0;for(let t=n;t;t=t.parentElement){let r=getComputedStyle(t).position;if(r==="fixed")return 1;r==="sticky"&&(e=2)}return e}var fr=class{constructor(e,t={},r){this.emit=e;this.signal=r;var s,i,o,a,c;this.rage=new ur((s=t.rageWindowMs)!=null?s:800,(i=t.rageRadius)!=null?i:30,(o=t.rageMin)!=null?o:3),this.dead=new pr((a=t.deadMs)!=null?a:700),this.maskText=(c=t.maskText)!=null?c:!1}start(){typeof document!="undefined"&&(this.dead.observe(document),this.onClickFn=e=>{var d;let t=e,r=Date.now(),s=e.target;if(!s||!s.tagName)return;let i=Ay(s,this.maskText),o=Ty(s),a=Sy(t),c=ky(s),l=this.rage.push(t.clientX,t.clientY,r),u={action:"click",...a,selector:o,...c};l&&(u.rage=!0),this.emit("USER_ACTION",u,i),l&&((d=this.signal)==null||d.call(this,"rage")),this.dead.onClick(r,()=>{var p;this.emit("USER_ACTION",{action:"click",...a,selector:o,...c,dead:!0},i),(p=this.signal)==null||p.call(this,"dead")})},document.addEventListener("click",this.onClickFn,!0))}stop(){this.dead.disconnect(),this.onClickFn&&typeof document!="undefined"&&document.removeEventListener("click",this.onClickFn,!0)}};function Sy(n){var t,r,s;let e=typeof window!="undefined"?window:void 0;return{x:n.clientX,y:n.clientY,vw:(t=e==null?void 0:e.innerWidth)!=null?t:0,vh:(r=e==null?void 0:e.innerHeight)!=null?r:0,sx:e?Math.round(e.scrollX):0,sy:e?Math.round(e.scrollY):0,dh:document.documentElement.scrollHeight,dpr:(s=e==null?void 0:e.devicePixelRatio)!=null?s:1}}function ky(n){var o;let e=n.getBoundingClientRect(),t={ex:e.x|0,ey:e.y|0,ew:e.width|0,eh:e.height|0},r=Bd(n);r&&(t.fx=r),t.path=Iy(n);let s=Ey();s&&(t.ui=s);let i=(o=n.closest("[data-scalebun-component]"))==null?void 0:o.getAttribute("data-scalebun-component");return i&&(t.component=i),t}function Ey(){let n=[];return document.querySelectorAll('[aria-expanded="true"],dialog[open]').forEach(e=>{let t=e.getAttribute("aria-controls")||e.getAttribute("aria-label")||e.id;t&&n.push(t)}),n.length?n.sort().join("|").slice(0,64):void 0}function Iy(n){let e=[],t=n;for(let r=0;t&&r<6;r++){let s=t.tagName.toLowerCase();if(s==="html"||s==="body")break;if(t.id){e.unshift(`${s}#${t.id}`);break}let i=t.parentElement;if(i){let o=0,a=0,c=i.children,l=t;for(let u=0;u<c.length;u++){let d=c[u];!d||d.tagName!==l.tagName||(a++,d===l&&(o=a))}e.unshift(a>1?`${s}:nth-of-type(${o})`:s)}else e.unshift(s);t=i}return e.join(">")}var Cy=n=>n.replace(/\S/g,"*");function Ay(n,e=!1){let t=n.tagName.toLowerCase(),r=(n.textContent||"").trim().slice(0,40);return r?`${t}: ${e?Cy(r):r}`:t}function Ty(n){let e=n.tagName.toLowerCase();n.id&&(e+=`#${n.id}`);let t=(n.getAttribute("class")||"").trim().split(/\s+/).filter(Boolean).slice(0,2);return t.length&&(e+="."+t.join(".")),e}var mr=class{constructor(){this.name="journey";this.ctx=null;this.active=!1}get isActive(){return this.active}setup(e){this.ctx=e,!(typeof window=="undefined"||typeof document=="undefined")&&(this.nav=new dr((t,r)=>this.emit("SCREEN_VIEW",{from:t,to:r},void 0,r)),this.interactions=new fr((t,r,s)=>this.emit(t,r,s,Fd()),{maskText:e.maskEventText===!0},t=>{var r;return(r=this.ctx)==null?void 0:r.signal(t)}),this.nav.start(),this.interactions.start(),this.active=!0)}emit(e,t,r,s){var a;let i=ne(),o={kind:"event",name:e,props:i?{...t,replayCoord:i}:t,label:r,screenName:s!=null?s:Fd(),eventId:`evt_${H()}`,timestamp:P()};(a=this.ctx)==null||a.emit(o)}teardown(){var e,t;(e=this.nav)==null||e.stop(),(t=this.interactions)==null||t.stop(),this.active=!1}};function Fd(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}Os();$();var Ry={maxDepth:4,maxBreadth:50,maxLength:8192};function Ai(n,e,t,r){if(n===null)return"null";if(n===void 0)return"undefined";let s=typeof n;if(s==="string")return n;if(s==="number"||s==="boolean"||s==="bigint")return String(n);if(s==="symbol")return n.toString();if(s==="function"){let o=n.name;return`[Function${o?`: ${o}`:""}]`}let i=n;if(t.has(i))return"[Circular]";if(n instanceof Error)return`${n.name}: ${n.message}`;if(e>=r.maxDepth)return Array.isArray(n)?"[Array]":"[Object]";t.add(i);try{if(Array.isArray(n)){let d=n.slice(0,r.maxBreadth).map(f=>Ai(f,e+1,t,r)),p=n.length>r.maxBreadth?`, \u2026(+${n.length-r.maxBreadth} more)`:"";return`[${d.join(", ")}${p}]`}if(n instanceof Map)return`Map(${n.size})`;if(n instanceof Set)return`Set(${n.size})`;let o=n.nodeName;if(typeof o=="string"){let d=n.id;return`<${o.toLowerCase()}${d?` #${String(d)}`:""}>`}let a=Object.keys(n),l=a.slice(0,r.maxBreadth).map(d=>{let p=Ai(n[d],e+1,t,r);return`${d}: ${p}`}),u=a.length>r.maxBreadth?`, \u2026(+${a.length-r.maxBreadth} more)`:"";return`{${l.join(", ")}${u}}`}finally{t.delete(i)}}function Dd(n,e){let t={...Ry,...e},r;try{r=n.map(s=>Ai(s,0,new WeakSet,t)).join(" ")}catch{r="[unserializable console arguments]"}return r.length>t.maxLength&&(r=r.slice(0,t.maxLength)+"\u2026(truncated)"),r}function qd(n){for(let e of n)if(e instanceof Error&&e.stack)return e.stack.slice(0,4*1024)}function Ti(n){switch(n){case"debug":return"debug";case"warn":return"warn";case"error":return"error";case"info":case"log":default:return"info"}}var My=()=>{try{return typeof location!="undefined"?location.pathname:void 0}catch{return}};function Hd(n,e,t=0){let r=Ti(n),s=j(Dd(e)),i={method:n},o=My();if(o&&(i.screen=o),r==="warn"||r==="error"){let a=qd(e);a&&(i.stack=j(a))}return t>0&&(i.droppedSince=t),{kind:"log",level:r,message:s,source:"console",platform:"js",logId:`log_${H()}`,metadata:i,timestamp:P()}}var hr=class{constructor(e){this.recent=[];this.dropped=0;var t,r;this.capCount=(t=e==null?void 0:e.capCount)!=null?t:100,this.capWindowMs=(r=e==null?void 0:e.capWindowMs)!=null?r:1e4}accept(e){if(e==="warn"||e==="error")return!0;let t=Date.now();return this.recent=this.recent.filter(r=>t-r<this.capWindowMs),this.recent.length>=this.capCount?(this.dropped++,!1):(this.recent.push(t),!0)}takeDropped(){let e=this.dropped;return this.dropped=0,e}};var Py=["debug","info","log","warn","error"],Ly=50,gr=class{constructor(){this.name="console";this.ctx=null;this.active=!1;this.throttle=new hr;this.originals=new Map;this.capturing=!1;this.ring=[]}get isActive(){return this.active}setup(e){if(!this.active&&(this.ctx=e,typeof console!="undefined")){for(let t of Py){let r=console[t];if(typeof r!="function")continue;this.originals.set(t,r);let s=(...i)=>{try{r.apply(console,i)}catch{}this.capture(t,i)};console[t]=s}this.active=!0}}capture(e,t){var r;if(!this.capturing&&!(t.length>0&&t[0]===_s)){this.capturing=!0;try{if(!this.throttle.accept(Ti(e)))return;let s=Hd(e,t,this.throttle.takeDropped());this.pushRing(s),(r=this.ctx)==null||r.emit(s)}catch{}finally{this.capturing=!1}}}pushRing(e){this.ring.push(e),this.ring.length>Ly&&this.ring.shift()}getRecent(){return this.ring.slice()}teardown(){if(typeof console!="undefined")for(let[e,t]of this.originals)console[e]=t;this.originals.clear(),this.ring.length=0,this.active=!1}};var br=class{constructor(){this.name="bugReport";this.ctx=null;this.active=!1;this.submitFn=null;this.widget=null;this.mounting=!1}get isActive(){return this.active}setup(e){this.ctx=e,this.active=!0}signalReport(){var e;(e=this.ctx)==null||e.signal("report")}setSubmit(e){this.submitFn=e}async mountLauncher(e){if(!(this.widget||this.mounting||typeof document=="undefined")){this.mounting=!0;try{let{createBugReportWidget:t}=await Promise.resolve().then(()=>(Ud(),zd));if(this.widget)return;this.widget=t({position:e.position,label:e.label,onSubmit:r=>this.submitFn?this.submitFn(r):Promise.resolve({e:"init"})})}catch{}finally{this.mounting=!1}}}teardown(){var e;(e=this.widget)==null||e.destroy(),this.widget=null,this.submitFn=null,this.active=!1}};$();var Vd="scalebun:tab",Wd="scalebun:live:";function Mi(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}function Fy(){try{return typeof sessionStorage!="undefined"?sessionStorage:null}catch{return null}}function Ri(){try{let n=globalThis.crypto;if(n&&typeof n.randomUUID=="function")return n.randomUUID()}catch{}return`${Date.now().toString(36)}-${Math.floor(Math.random()*1e9).toString(36)}`}function jd(){let n=Fy();if(!n)return`mem-${Ri()}`;try{let e=n.getItem(Vd);if(e)return e;let t=Ri();return n.setItem(Vd,t),t}catch{return`mem-${Ri()}`}}var Pi=n=>`${Wd}${n}`;function yr(n){let e=Mi();if(!e)return null;try{let t=e.getItem(Pi(n));if(!t)return null;let r=JSON.parse(t);return r&&r.v===1&&typeof r.sessionId=="string"?r:null}catch{return null}}function vr(n,e){let t=Mi();if(t)try{t.setItem(Pi(n),JSON.stringify(e))}catch{}}function wr(n,e){let t=yr(n);t&&(t.ended=e,t.lastActive=Date.now(),vr(n,t))}function Kd(n){let e=yr(n);e&&(e.lastActive=Date.now(),vr(n,e))}function Gd(n,e){let t=Mi();if(t)try{let r=[];for(let s=0;s<t.length;s++){let i=t.key(s);if(!(!i||!i.startsWith(Wd)||i===Pi(n)))try{let o=JSON.parse(t.getItem(i)||"{}");o&&(o.ended||e-(o.lastActive||0)>864e5)&&r.push(i)}catch{r.push(i)}}for(let s of r)t.removeItem(s)}catch{}}var Dy=15e3,xr=class{constructor(){this.name="crash";this.ctx=null;this.active=!1;this.tabId=""}get isActive(){return this.active}setup(e){var t;this.ctx=e,typeof window!="undefined"&&(this.installReportingObserver(),this.installLiveness((t=e.sessionId)!=null?t:`sess_${H()}`),this.active=!0)}installReportingObserver(){let e=globalThis.ReportingObserver;if(e)try{this.observer=new e(t=>{for(let r of t)this.handleReport(r)},{buffered:!0}),this.observer.observe()}catch{}}handleReport(e){var o,a,c,l,u,d,p,f;if(e.type==="deprecation")return;let t=(o=e.body)!=null?o:{},r=e.type==="crash",s=r?`Browser crash report: ${(a=t.reason)!=null?a:"unknown"}`:(c=t.message)!=null?c:`${e.type} report`,i=t.sourceFile?`${t.sourceFile}:${(l=t.lineNumber)!=null?l:0}:${(u=t.columnNumber)!=null?u:0}`:void 0;this.emitError({type:r?"crash":"handled",message:s,stack:i,fingerprint:`report:${e.type}:${(p=(d=t.reason)!=null?d:t.id)!=null?p:s}`.slice(0,180),metadata:{reportType:e.type,reason:t.reason,anticipated:t.anticipated,url:e.url}}),r&&((f=this.ctx)==null||f.signal("error"))}installLiveness(e){var s;this.tabId=jd();let t=yr(this.tabId);t&&!t.ended&&t.sessionId!==e&&this.emitRecoveredCrash(t);let r=P();vr(this.tabId,{v:1,sessionId:e,startedAt:r,lastActive:r,screen:(s=Xd())!=null?s:"",ended:!1}),Gd(this.tabId,r),this.onHide=()=>wr(this.tabId,!0),this.onShow=()=>wr(this.tabId,!1),window.addEventListener("pagehide",this.onHide),window.addEventListener("pageshow",this.onShow),this.heartbeat=setInterval(()=>Kd(this.tabId),Dy)}emitRecoveredCrash(e){var s,i,o;let t=Math.max(0,e.lastActive-e.startedAt),r=this.buildError({type:"crash",message:"Session ended abnormally (tab crash, OOM, or forced close \u2014 no graceful shutdown)",fingerprint:"session-abnormal-termination",screenName:e.screen||void 0,metadata:{reason:"unfinalized-session",priorSessionId:e.sessionId,durationMs:t,lastScreen:e.screen},timestamp:e.lastActive});if((s=this.ctx)!=null&&s.emitFor){this.ctx.emitFor(e.sessionId,r);return}(i=this.ctx)==null||i.emit({...r,type:"handled"}),(o=this.ctx)==null||o.signal("error")}buildError(e){var t,r;return{kind:"error",type:e.type,message:j(e.message),stack:e.stack,source:"js",fingerprint:e.fingerprint,screenName:(t=e.screenName)!=null?t:Xd(),clientId:`crash_${H()}`,timestamp:(r=e.timestamp)!=null?r:P(),...e.metadata?{metadata:e.metadata}:{}}}emitError(e){var t;(t=this.ctx)==null||t.emit(this.buildError(e))}teardown(){if(this.observer){try{this.observer.disconnect()}catch{}this.observer=void 0}this.heartbeat&&clearInterval(this.heartbeat),this.heartbeat=void 0,typeof window!="undefined"&&(this.onHide&&window.removeEventListener("pagehide",this.onHide),this.onShow&&window.removeEventListener("pageshow",this.onShow)),this.tabId&&wr(this.tabId,!0),this.active=!1}};function Xd(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}$();Wt();var qy=50,Sr=class{constructor(e,t){this.apiBaseUrl=e;this.clientKey=t;this.buffer=new Be("engage-pending")}headers(){return{"content-type":"application/json","x-scalebun-client-key":this.clientKey}}get usable(){return!!this.clientKey&&!!this.apiBaseUrl&&typeof fetch!="undefined"}async fetchConfig(e){if(!this.usable)return null;let t=new URLSearchParams;e.platform&&t.set("platform",e.platform),e.appVersion&&t.set("appVersion",e.appVersion),e.deviceId&&t.set("deviceId",e.deviceId),e.endUserId&&t.set("endUserId",e.endUserId);try{let r=await fetch(`${this.apiBaseUrl}/sdk/engage/config?${t.toString()}`,{headers:this.headers(),cache:"no-store"});return r.ok?await r.json():null}catch{return null}}postImpressions(e){return this.post("/sdk/engage/surveys/impressions",{schemaVersion:1,impressions:e})}postResponses(e){return this.postWithRetry("/sdk/engage/responses",{schemaVersion:1,responses:e})}postEvents(e){return this.post("/sdk/engage/events",{schemaVersion:1,events:e})}postRatingEvents(e){return this.postWithRetry("/ingestion/rating-events",{schemaVersion:1,events:e})}async presignAttachments(e){if(!this.usable)return null;try{let t=await fetch(`${this.apiBaseUrl}/sdk/engage/attachments/presign`,{method:"POST",headers:this.headers(),body:JSON.stringify({schemaVersion:1,attachments:e})});return t.ok?await t.json():null}catch{return null}}async putBlob(e,t,r){if(typeof fetch=="undefined")return!1;try{return(await fetch(e,{method:"PUT",body:t,headers:{"content-type":r}})).ok}catch{return!1}}async post(e,t){if(!this.usable)return!1;try{return(await fetch(`${this.apiBaseUrl}${e}`,{method:"POST",headers:this.headers(),body:JSON.stringify(t),keepalive:!0})).ok}catch{return!1}}async postWithRetry(e,t,r=3,s=800){for(let i=0;i<r;i++){if(await this.post(e,t))return!0;i<r-1&&await new Promise(o=>setTimeout(o,s*2**i))}return await this.park(e,t),!1}async park(e,t){try{let s=[...await this.buffer.load(),{path:e,body:t}].slice(-qy);await this.buffer.save(s)}catch{}}async flushParked(){if(!this.usable)return;let e;try{e=await this.buffer.load()}catch{return}if(!e.length)return;let t=[];for(let r of e)!r||typeof r.path!="string"||await this.post(r.path,r.body)||t.push(r);await this.buffer.save(t)}};var Hx=32,$x=3e4,jf="scalebun_engage_sessions";function Kf(){try{return typeof location!="undefined"?location.pathname:""}catch{return""}}function zx(n){let e=n,t=r=>Array.isArray(r)?r.length:0;return!!e&&(t(e.campaigns)>0||t(e.inAppMessages)>0)}var as=class{constructor(){this.name="engage";this.ctx=null;this.active=!1;this.screen="";this.buffer=[];this.bufferOpen=!0}get isActive(){return this.active}async setup(e){var i;if(this.ctx=e,typeof window=="undefined"||typeof document=="undefined")return;let t=(i=e.clientKey)!=null?i:"";if(!t||!e.apiBaseUrl)return;this.transport=new Sr(e.apiBaseUrl,t),this.screen=Kf(),this.active=!0,this.transport.flushParked(),this.unsub=e.onSignal(o=>this.onSignal(o)),this.onPop=()=>this.onScreenView(Kf()),window.addEventListener("popstate",this.onPop);let{count:r,isNewSession:s}=this.bumpSessionCount();s&&(this.onLifecycle("session_start"),this.onLifecycle("app_open"),this.onLifecycle("n_sessions",r)),await this.refresh()}async refresh(){var i,o,a,c,l,u;if(!this.transport)return;let e=await this.transport.fetchConfig({platform:"web",appVersion:(i=this.ctx)==null?void 0:i.appVersion,deviceId:(o=this.ctx)==null?void 0:o.deviceId,endUserId:(c=(a=this.ctx)==null?void 0:a.getUserId)==null?void 0:c.call(a)});if(!zx(e)){(l=this.runtime)==null||l.setCampaigns([]),(u=this.runtime)==null||u.setMessages([]),this.closeBuffer();return}let{normalizeConfig:t}=await Promise.resolve().then(()=>(Ni(),eu)),r=t(e),s=await this.ensureRuntime();s&&(s.setCampaigns(r.campaigns),s.setMessages(r.inAppMessages),this.drain(s))}async ensureRuntime(){var t,r,s,i,o;if(this.runtime)return this.runtime;if(!this.transport)return;let{EngageRuntime:e}=await Promise.resolve().then(()=>(Wf(),Vf));return this.runtime=new e({transport:this.transport,deviceId:(r=(t=this.ctx)==null?void 0:t.deviceId)!=null?r:"",sessionId:(i=(s=this.ctx)==null?void 0:s.sessionId)!=null?i:"",uuid:H,now:P,currentScreen:()=>this.screen,replayCoord:ne,signal:a=>{var c;return(c=this.ctx)==null?void 0:c.signal(a)},...(o=this.ctx)!=null&&o.onInAppGameRequest?{gameHandler:this.ctx.onInAppGameRequest}:{}}),this.runtime}async submit(e,t){let r=await this.ensureRuntime();return r?r.submitFor(e,t):"error"}emitRatingEvent(e,t){this.ensureRuntime().then(r=>r==null?void 0:r.emitRatingEvent(e,t))}async resetInAppState(){let{clearEngageState:e}=await Promise.resolve().then(()=>($i(),cu));e()}onScreenView(e){this.screen=e,this.feed("screen",e)}onIdentify(){this.active&&this.refresh()}onCustomEvent(e){this.feed("custom",e)}onSignal(e){this.feed("signal",e)}onLifecycle(e,t){this.feed("lifecycle",e,t)}feed(e,t,r){if(this.runtime){this.dispatch(this.runtime,e,t,r,0);return}this.bufferOpen&&(this.buffer.push({ch:e,value:t,arg:r,at:P()}),this.buffer.length>Hx&&this.buffer.shift())}dispatch(e,t,r,s,i){switch(t){case"screen":e.onScreenView(r,i);break;case"custom":e.onCustomEvent(r,i);break;case"signal":e.onSignal(r,i);break;case"lifecycle":e.onLifecycle(r,s,i);break}}drain(e){let t=P()-$x;for(let r of this.buffer)r.at<t||this.dispatch(e,r.ch,r.value,r.arg,P()-r.at);this.closeBuffer()}closeBuffer(){this.bufferOpen=!1,this.buffer=[]}bumpSessionCount(){var e,t;try{let r=(t=(e=this.ctx)==null?void 0:e.sessionId)!=null?t:"",s=localStorage.getItem(jf),i=s?JSON.parse(s):{};if(r&&i.sessionId===r&&typeof i.count=="number")return{count:i.count,isNewSession:!1};let o=(typeof i.count=="number"?i.count:0)+1;return localStorage.setItem(jf,JSON.stringify({sessionId:r,count:o})),{count:o,isNewSession:!0}}catch{return{count:1,isNewSession:!0}}}teardown(){var e,t;(e=this.unsub)==null||e.call(this),this.unsub=void 0,this.onPop&&typeof window!="undefined"&&window.removeEventListener("popstate",this.onPop),this.onPop=void 0,(t=this.runtime)==null||t.stop(),this.runtime=void 0,this.closeBuffer(),this.active=!1}};$();qo();function jx(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}var cs=class{constructor(){this.name="webPerf";this.ctx=null;this.active=!1}get isActive(){return this.active}async setup(e){if(this.ctx=e,typeof window=="undefined"||typeof performance=="undefined")return;this.active=!0;let{startCollectors:t}=await Promise.resolve().then(()=>(Yf(),Xf));this.active&&(this.stop=t((r,s,i,o)=>this.emit(r,s,i,o),()=>this.active))}emit(e,t,r,s){var i;(i=this.ctx)==null||i.emit({kind:"performance",metric:e,value:t,screenName:jx(),...s!=null?{duration:s}:{},metadata:r,clientId:`pw_${H()}`,timestamp:P()})}teardown(){var e;this.active=!1,(e=this.stop)==null||e.call(this),this.stop=void 0}};var ds=class{constructor(){this.name="exitIntent";this.active=!1}get isActive(){return this.active}async setup(e){if(typeof window=="undefined"||typeof document=="undefined")return;this.active=!0;let{startExitIntent:t}=await Promise.resolve().then(()=>(sm(),rm));this.active&&(this.handle=t(e,e.exitIntent))}teardown(){var e;this.active=!1,(e=this.handle)==null||e.stop(),this.handle=void 0}};var $h=[new zn,new qn,new Vn,new Qn,new Zn,new cs,new cr,new mr,new gr,new br,new xr,new as,new ds],zh={replay:async()=>new(await Promise.resolve().then(()=>(Um(),zm))).ReplayFeature,inbox:async()=>new(await Promise.resolve().then(()=>(eh(),Zm))).InboxFeature,profiler:async()=>new(await Promise.resolve().then(()=>(nh(),th))).ProfilerFeature,watchdog:async()=>new(await Promise.resolve().then(()=>(yh(),bh))).WatchdogFeature,inapp2:async()=>new(await Promise.resolve().then(()=>(Hh(),qh))).InApp2Feature},wk={config:["network"],analytics:["network"],errors:["dom"],network:["dom"],webVitals:["performanceObserver"],webPerf:["performanceObserver"],performance:["performance"],journey:["dom"],console:["dom"],bugReport:["dom"],crash:["dom"],engage:["dom"],inbox:["dom"],profiler:["dom"],watchdog:["performanceObserver"],exitIntent:["dom"],inapp2:["dom"],replay:["dom"]};function Oa(n){var e;return(e=wk[n])!=null?e:["dom"]}$();function xk(n){return n==="frame"?"replay":n==="network"?"networkMonitoring":n==="error"?"crashReporting":n==="performance"||n==="resource"||n==="trace"||n==="transaction"?"performanceMonitoring":""}var fn=class{static async bootstrap(e,t){var b,E,w,I;let r=ja(e),s=Ya(r.debug),i=new kn(r),o=new En(r),a=new Mn(r,i,o);t!=null&&t.edge&&a.setConsentGranted(!1);let c=new Pn;pc(),hc(),typeof((b=r.errors)==null?void 0:b.maxBreadcrumbs)=="number"&&We.setMax(r.errors.maxBreadcrumbs),cc((E=r.errors)==null?void 0:E.beforeBreadcrumb);let l=x=>{var M,T;let C=xk(x.kind);C&&((T=(M=c.get("config"))==null?void 0:M.entitlement)==null?void 0:T.call(M,C))===!1||(uc(x),mc(x),a.emit(x))},u=new Set,d={sessionId:i.sessionId,clientKey:r.clientKey,deviceId:i.deviceId,appVersion:r.appVersion,getUserId:()=>{var x,C;return(C=(x=c.get("analytics"))==null?void 0:x.identity)==null?void 0:C.userId},emit:l,emitFor:(x,C)=>a.emitFor(x,C),egressPending:()=>a.pendingCount,trackEvent:(x,C)=>l({kind:"event",name:x,props:C,timestamp:Date.now()}),getAppState:()=>gt("visibility")&&document.visibilityState==="hidden"?"background":"active",log:s,apiBaseUrl:r.apiBaseUrl,signal:(x,C)=>{for(let M of u)try{M(x,C)}catch{}},onSignal:x=>(u.add(x),()=>u.delete(x)),replaySampling:r.replay,...r.onInAppGameRequest?{onInAppGameRequest:r.onInAppGameRequest}:{},errorsOptions:r.errors,networkOptions:r.network,performanceOptions:r.performance,watchdogOptions:r.watchdog,analyticsOptions:r.analytics,flagsBootstrap:(w=r.flags)==null?void 0:w.bootstrap,flagsRealtime:(I=r.flags)==null?void 0:I.realtime,replayCanvas:r.replayCanvas,replayFrameOrigins:r.replayFrameOrigins,autocapture:r.autocapture,traceOrigins:r.tracePropagation?[...typeof location!="undefined"?[location.origin]:[],...r.tracePropagationOrigins]:[],maskReplayText:r.privacy.maskReplayText,maskEventText:r.privacy.maskEventText,maskSelectors:r.privacy.maskSelectors,maskInputs:r.privacy.maskInputs,respectDnt:r.privacy.respectDnt,exitIntent:r.exitIntent},p=r.features,f=()=>{for(let x of $h)p[x.name]!==!1&&Oa(x.name).every(C=>gt(C))&&c.add(x)};f();let m=async()=>{await Promise.all(Object.entries(zh).map(async([x,C])=>{if(p[x]===!0&&Oa(x).every(M=>gt(M))&&!c.get(x))try{c.add(await C())}catch(M){s(`[scalebun] optional feature "${x}" failed to load:`,M)}}))},h=new bn(r.consent.initial),g=!1,S=async()=>{var C;if(g)return;g=!0,f(),await m(),await c.setupAll(d),t!=null&&t.edge||await a.start();let x=(C=c.get("analytics"))==null?void 0:C.identity;if(x!=null&&x.userId&&!(t!=null&&t.edge)&&a.emit({kind:"identify",userId:x.userId,anonymousId:x.anonymousId,timestamp:Date.now()}),x){Oe(x.superProps);let M=x.groups;if(M)for(let T of Object.keys(M))Oe({[`group_${T}`]:M[T]});x.userId&&Oe({userId:x.userId})}s(t!=null&&t.edge?"activated (edge-lite)":"activated",{sessionId:i.sessionId})},y={config:r,session:i,pipeline:a,transport:o,registry:c,log:s,setConsent:x=>{h.set(x?"granted":"denied"),x?(a.setConsentGranted(!0),S()):(a.setConsentGranted(!1),g&&c.teardownAll(),g=!1,a.discard())},get consentStatus(){return h.value}};return!r.consent.required||h.granted?await S():s("consent required \u2014 capture deferred until setConsent(true)"),s("initialized",{sessionId:i.sessionId,consent:h.value}),y}};$();ir();var $a=class{constructor(){this.rt=null;this.ready=!1;this.pendingConsent=null;this.pushFeature=null;this.coachFeature=null;this.coachController=null;this.pendingPushOpenCbs=[];this.settle=null;this.settled=new Promise(e=>{this.settle=e});this.replay={stats:()=>{var e,t;return(t=(e=this.replayFeature())==null?void 0:e.stats())!=null?t:null},checkpoint:e=>{var t;return(t=this.replayFeature())==null?void 0:t.checkpoint(e)},flush:()=>{var e;return(e=this.replayFeature())==null?void 0:e.flush()},stop:()=>{var e;return(e=this.replayFeature())==null?void 0:e.teardown()},start:()=>{var e;return(e=this.replayFeature())==null?void 0:e.resume()},pause:()=>{var e;return(e=this.replayFeature())==null?void 0:e.pause()},resume:()=>{var e;return(e=this.replayFeature())==null?void 0:e.resume()},setPrivacy:e=>{var t;return(t=this.replayFeature())==null?void 0:t.setPrivacy(e)}};this.performance={startTransaction:e=>{var r,s,i;let t=(r=this.rt)==null?void 0:r.registry.get("performance");return(i=(s=t==null?void 0:t.startTransaction)==null?void 0:s.call(t,e))!=null?i:sr},startTrace:e=>{var r,s;let t=(r=this.rt)==null?void 0:r.registry.get("performance");(s=t==null?void 0:t.startTrace)==null||s.call(t,e)},stopTrace:e=>{var r,s;let t=(r=this.rt)==null?void 0:r.registry.get("performance");(s=t==null?void 0:t.stopTrace)==null||s.call(t,e)},markScreenLoadStart:e=>{},sendMetric:(e,t)=>{var r;(r=this.rt)==null||r.pipeline.emit({kind:"performance",metric:e,value:t,timestamp:P()})}};this.session={start:()=>{},end:()=>{this.close()},emitEvent:(e,t)=>{this.track(e,t)}};this.engage={track:(e,t)=>this.track(e,t),refresh:()=>{var e,t;return(t=(e=this.engageFeature())==null?void 0:e.refresh())!=null?t:Promise.resolve()},submit:(e,t)=>{var r,s;return(s=(r=this.engageFeature())==null?void 0:r.submit(e,t))!=null?s:Promise.resolve("error")},emitRatingEvent:(e,t)=>{var r;return(r=this.engageFeature())==null?void 0:r.emitRatingEvent(e,t)},resetInAppState:()=>{var e,t;return(t=(e=this.engageFeature())==null?void 0:e.resetInAppState())!=null?t:Promise.resolve()}};this.push={enable:e=>this.enablePush(e),disable:e=>this.ensurePush().then(t=>{var r;return(r=t==null?void 0:t.disable(e))!=null?r:!1}),status:()=>this.ensurePush().then(e=>{var t;return(t=e==null?void 0:e.status())!=null?t:Promise.resolve({supported:!1,permission:"default",subscribed:!1,endpoint:null,state:"unsupported"})}),getSubscription:()=>this.ensurePush().then(e=>{var t;return(t=e==null?void 0:e.getSubscription())!=null?t:null}),check:async e=>{let t=await this.ensurePush();return t?t.check(e):(await Promise.resolve().then(()=>(Da(),Fa))).notInitializedReport()}};this.attribution={getInstallationId:()=>{var e,t;return(t=(e=this.analyticsFeature())==null?void 0:e.getInstallationId())!=null?t:""},setClickId:e=>{var t;return(t=this.analyticsFeature())==null?void 0:t.setClickId(e)}};this.flagExposed=new Set;this.flags={isEnabled:e=>{var s;let t=this.cfg(),r=(s=t==null?void 0:t.isEnabled(e))!=null?s:!1;return t!=null&&t.knows(e)&&this.recordExposure(e,r),r},variation:(e,t)=>this.flags.variationDetail(e,t).value,variationDetail:(e,t)=>{var i,o,a;let r=(o=(i=this.cfg())==null?void 0:i.variationDetail(e,t))!=null?o:{value:t,variant:null,reason:"FLAG_NOT_FOUND"},s=(a=r.variant)!=null?a:typeof r.value=="object"?null:r.value;return this.recordExposure(e,typeof s=="number"?String(s):s,r.reason),r},ready:()=>{var e,t;return(t=(e=this.cfg())==null?void 0:e.ready())!=null?t:Promise.resolve()},onChange:e=>{var t,r;return(r=(t=this.cfg())==null?void 0:t.onChange(e))!=null?r:()=>{}},override:(e,t)=>{var r;return(r=this.cfg())==null?void 0:r.override(e,t)},clearOverride:e=>{var t;return(t=this.cfg())==null?void 0:t.clearOverride(e)},clearOverrides:()=>{var e;return(e=this.cfg())==null?void 0:e.clearOverrides()}};this.config={get:(e,t)=>{var r,s;return(s=(r=this.cfg())==null?void 0:r.get(e,t))!=null?s:t},refresh:()=>{var e,t;return(t=(e=this.cfg())==null?void 0:e.refresh())!=null?t:Promise.resolve()}};this.rollouts={isOn:e=>{var r,s;let t=(s=(r=this.cfg())==null?void 0:r.isOn(e))!=null?s:!1;return this.recordExposure(e,t),t}};this.experiments={variant:e=>{var r,s;let t=(s=(r=this.cfg())==null?void 0:r.variant(e))!=null?s:null;return this.recordExposure(e,t),t}};this.profiler={available:()=>{var e,t;return(t=(e=this.prof())==null?void 0:e.available())!=null?t:!1},start:e=>{var t,r;return(r=(t=this.prof())==null?void 0:t.start(e))!=null?r:!1},stop:()=>{var e,t;return(t=(e=this.prof())==null?void 0:e.stop())!=null?t:Promise.resolve(!1)}};this.watchdog={stats:()=>{var t,r,s;let e=(t=this.rt)==null?void 0:t.registry.get("watchdog");return(s=(r=e==null?void 0:e.stats)==null?void 0:r.call(e))!=null?s:null}}}whenReady(){return this.settled}async init(e){var t,r,s,i,o;if(!this.ready){if(wn((t=e==null?void 0:e.csp)==null?void 0:t.nonce),vc()){let a=Us();if(a==="edge"||a==="worker"){try{this.rt=await fn.bootstrap(e,{edge:!0}),this.ready=!0}catch(c){typeof console!="undefined"&&console.warn("[scalebun] edge init failed:",c)}return}e!=null&&e.debug&&typeof console!="undefined"&&console.warn("[scalebun] init() on SSR \u2014 deferring capture to the client.");return}try{if(this.rt=await fn.bootstrap(e),this.ready=!0,this.pendingConsent!==null&&(this.rt.setConsent(this.pendingConsent),this.pendingConsent=null),this.rt.config.features.bugReport!==!1){let c=this.rt.registry.get("bugReport");(r=c==null?void 0:c.setSubmit)==null||r.call(c,l=>this.reportBugDetailed(l)),this.rt.config.bugReport.launcher&&((s=c==null?void 0:c.mountLauncher)==null||s.call(c,{position:this.rt.config.bugReport.position,label:this.rt.config.bugReport.label}))}let a=(i=e==null?void 0:e.push)==null?void 0:i.softAsk;a&&Promise.resolve().then(()=>(jh(),Wh)).then(({armSoftAsk:c})=>c(a,{enable:()=>this.enablePush(),permission:()=>Notification.permission})).catch(()=>{})}catch(a){typeof console!="undefined"&&console.warn("[scalebun] init failed:",a)}finally{(o=this.settle)==null||o.call(this)}}}setConsent(e){this.rt?this.rt.setConsent(e):this.pendingConsent=e}track(e,t){var r,s,i,o;(r=this.analyticsFeature())!=null&&r.evaluate(e,t).drop||((s=this.rt)==null||s.pipeline.emit(this.enrichEvent({kind:"event",name:e,props:t,timestamp:P()})),(i=this.analyticsFeature())==null||i.track(e,t),(o=this.engageFeature())==null||o.onCustomEvent(e))}enrichEvent(e){var c;let t=(c=this.analyticsFeature())==null?void 0:c.identity,r=ne(),s=t==null?void 0:t.superProps,i=e.props,o=s&&Object.keys(s).length?{...s,...i!=null?i:{}}:i,a=o&&mt(o);return{...e,...a!==void 0?{props:a}:{},...t!=null&&t.anonymousId?{anonymousId:t.anonymousId}:{},...t!=null&&t.userId?{userId:t.userId}:{},...t!=null&&t.groups&&Object.keys(t.groups).length?{groups:t.groups}:{},...r?{replay:r}:{}}}register(e){var t;(t=this.analyticsFeature())==null||t.register(e),Oe(e)}unregister(e){var t;(t=this.analyticsFeature())==null||t.unregister(e)}group(e,t,r){var s,i;!e||!t||((s=this.analyticsFeature())==null||s.group(e,t,r),Oe({[`group_${e}`]:t}),(i=this.rt)==null||i.pipeline.emit(this.enrichEvent({kind:"event",name:"$group",props:{group_type:e,group_key:t,...r!=null?r:{}},timestamp:P()})))}alias(e,t){var i,o,a,c;if(!e)return;let r=(i=this.analyticsFeature())==null?void 0:i.identity,s=(o=t!=null?t:r==null?void 0:r.userId)!=null?o:r==null?void 0:r.anonymousId;(a=this.analyticsFeature())==null||a.alias(e,t),(c=this.rt)==null||c.pipeline.emit({kind:"identify",userId:e,previousId:s,timestamp:P()})}reset(){var e,t,r,s,i;(e=this.engageFeature())==null||e.onLifecycle("before_logout"),(t=this.analyticsFeature())==null||t.reset(),bc(),(i=this.rt)==null||i.pipeline.emit({kind:"identify",reset:!0,anonymousId:(s=(r=this.analyticsFeature())==null?void 0:r.identity)==null?void 0:s.anonymousId,timestamp:P()})}trackPurchase(e){var r,s,i;let t=Ln(e);t&&((r=this.rt)==null||r.pipeline.emit(this.enrichEvent({kind:"event",name:"purchase",props:t.props,revenue:t.revenue,currency:t.currency,timestamp:P()})),(s=this.analyticsFeature())==null||s.trackPurchase(e),(i=this.engageFeature())==null||i.onCustomEvent("purchase"))}trackSubscription(e){var t;(t=this.analyticsFeature())==null||t.trackSubscription(e)}trackScreen(e,t){var r,s;e&&((r=this.rt)==null||r.pipeline.emit(this.enrichEvent({kind:"event",name:"SCREEN_VIEW",screenName:e,props:t,timestamp:P()})),(s=this.engageFeature())==null||s.onScreenView(e))}identify(e,t){var s,i,o,a,c,l,u,d;let r=(i=(s=this.analyticsFeature())==null?void 0:s.identity)==null?void 0:i.anonymousId;(o=this.rt)==null||o.pipeline.emit({kind:"identify",userId:e,anonymousId:r,traits:t,timestamp:P()}),(a=this.analyticsFeature())==null||a.identify(e,t),Oe({userId:e,...t!=null?t:{}}),(c=this.engageFeature())==null||c.onIdentify(),(d=(u=(l=this.rt)==null?void 0:l.registry.get("inapp2"))==null?void 0:u.onIdentify)==null||d.call(u)}setUser(e){e!=null&&e.id&&this.identify(e.id,e)}captureError(e,t){var a,c,l;let r=t!=null&&t.componentStack?{componentStack:t.componentStack}:void 0,s=t&&(t.level||t.tags||t.context||t.fingerprint)?{level:t.level,tags:t.tags,context:t.context,fingerprint:t.fingerprint}:void 0,i=(a=this.rt)==null?void 0:a.registry.get("errors");if(i!=null&&i.captureHandled){i.captureHandled(e,r,s);return}let o=e;(l=this.rt)==null||l.pipeline.emit({kind:"error",type:"handled",message:(c=o==null?void 0:o.message)!=null?c:String(e),stack:o==null?void 0:o.stack,source:"js",timestamp:P(),...r!=null?r:{}})}addBreadcrumb(e){var t;dc({ts:P(),category:(t=e.category)!=null?t:"custom",type:e.type,level:e.level,message:e.message,data:e.data})}setTag(e,t){gl(e,t)}setContext(e,t){bl(e,t)}setErrorLevel(e){yl(e)}submitRating(e,t,r){var o,a;let s=Math.round(e);if(!Number.isFinite(s)||s<1||s>5){(o=this.rt)==null||o.log("[scalebun] submitRating: score must be an integer 1\u20135, got",e);return}let i={kind:"rating",score:s,comment:t,surveyId:r,clientRatingId:`rat_${H()}`,timestamp:P()};(a=this.rt)==null||a.pipeline.emit(i)}async registerInAppSlot(e,t){let{registerInAppSlot:r}=await Promise.resolve().then(()=>(ro(),Bu));return r(e,t)}async reportBug(e){let t=await this.reportBugDetailed(e);return typeof t=="string"?t:null}async reportBugDetailed(e){var t,r,s,i;if(!this.rt)return{e:"init"};if(this.rt.config.features.bugReport===!1)return this.rt.log("[scalebun] reportBug: bugReport feature is disabled"),{e:"off"};if(!e||!e.message)return this.rt.log("[scalebun] reportBug: a message is required"),{e:"empty"};if(!this.rt.pipeline.canEgress())return this.rt.log("[scalebun] reportBug: blocked \u2014 consent not granted"),{e:"consent"};try{let o=this.rt.registry.get("bugReport");(t=o==null?void 0:o.signalReport)==null||t.call(o);let a=this.rt.registry.get("console"),c=(s=(r=a==null?void 0:a.getRecent)==null?void 0:r.call(a))!=null?s:[],{buildBugReportPayload:l}=await Promise.resolve().then(()=>(Gh(),Kh)),u=ne(),d=l({message:e.message,title:e.title,email:e.email},c,{replayCoord:u}),p=await this.rt.transport.submitBugReport(this.rt.session.sessionId,d);return await this.rt.pipeline.flush(),(i=p==null?void 0:p.id)!=null?i:{e:"send"}}catch{return{e:"send"}}}async flush(){var e,t;await Promise.all([(e=this.rt)==null?void 0:e.pipeline.flush(),(t=this.analyticsFeature())==null?void 0:t.flush()])}errorStats(){var t,r,s;let e=(t=this.rt)==null?void 0:t.registry.get("errors");return(s=(r=e==null?void 0:e.stats)==null?void 0:r.call(e))!=null?s:null}perfStats(){var t,r,s;let e=(t=this.rt)==null?void 0:t.registry.get("performance");return(s=(r=e==null?void 0:e.perfStats)==null?void 0:r.call(e))!=null?s:null}networkStats(){var t,r,s;let e=(t=this.rt)==null?void 0:t.registry.get("network");return(s=(r=e==null?void 0:e.stats)==null?void 0:r.call(e))!=null?s:null}async close(){var e,t;(e=this.rt)==null||e.registry.teardownAll(),await((t=this.rt)==null?void 0:t.pipeline.stop()),this.rt=null,this.ready=!1}get sessionId(){var e;return(e=this.rt)==null?void 0:e.session.sessionId}egressStats(){var r,s,i,o,a,c,l,u,d,p,f,m,h;let e=this.analyticsFeature(),t=(r=this.rt)==null?void 0:r.pipeline.ledger;return{pending:((i=(s=this.rt)==null?void 0:s.pipeline.pendingCount)!=null?i:0)+((o=e==null?void 0:e.pending)!=null?o:0),dropped:((c=(a=this.rt)==null?void 0:a.pipeline.dropped)!=null?c:0)+((l=e==null?void 0:e.dropped)!=null?l:0),queued:(u=t==null?void 0:t.queued)!=null?u:0,attempted:(d=t==null?void 0:t.attempted)!=null?d:0,retried:(p=t==null?void 0:t.retried)!=null?p:0,recovered:(f=t==null?void 0:t.recovered)!=null?f:0,expired:(m=t==null?void 0:t.expired)!=null?m:0,acked:(h=t==null?void 0:t.acked)!=null?h:0}}analyticsStats(){var e,t;return(t=(e=this.analyticsFeature())==null?void 0:e.stats)!=null?t:null}analyticsFeature(){var e;return(e=this.rt)==null?void 0:e.registry.get("analytics")}replayFeature(){var e;return(e=this.rt)==null?void 0:e.registry.get("replay")}engageFeature(){var e;return(e=this.rt)==null?void 0:e.registry.get("engage")}inboxFeature(){var e;return(e=this.rt)==null?void 0:e.registry.get("inbox")}inbox(){var e,t;return(t=(e=this.inboxFeature())==null?void 0:e.controller())!=null?t:Dk}ensureCoach(){return this.coachFeature?Promise.resolve(this.coachFeature):this.rt?Promise.resolve().then(()=>(Qh(),Jh)).then(({CoachmarkFeature:e})=>{var s,i;if(this.coachFeature)return this.coachFeature;let t={trackEvent:(o,a)=>this.track(o,a),replayCoord:ne,apiBaseUrl:(s=this.rt)==null?void 0:s.config.apiBaseUrl,clientKey:(i=this.rt)==null?void 0:i.config.clientKey},r=new e(t);return this.coachFeature=r,r}):Promise.resolve(null)}coachmarks(){if(this.coachController)return this.coachController;let e=t=>{this.ensureCoach().then(r=>{r&&t(r)})};return this.coachController={start:(t,r)=>e(s=>s.start(t,r)),startInline:t=>e(r=>r.start(t)),startById:(t,r)=>e(s=>void s.startById(t,r)),reportAnchors:()=>e(t=>t.reportAnchors()),next:()=>e(t=>t.next()),back:()=>e(t=>t.back()),skip:()=>e(t=>t.skip()),end:()=>e(t=>t.end()),notify:t=>e(r=>r.notify(t)),current:()=>{var t,r;return(r=(t=this.coachFeature)==null?void 0:t.current())!=null?r:{tourId:null,index:0,status:"idle"}},on:(t,r)=>{if(this.coachFeature)return this.coachFeature.on(t,r);let s=null,i=!1;return this.ensureCoach().then(o=>{o&&!i&&(s=o.on(t,r))}),()=>{i=!0,s==null||s()}}},this.coachController}async ensurePush(){if(this.pushFeature)return this.pushFeature;if(!this.rt)return null;let{PushFeature:e}=await Promise.resolve().then(()=>(rg(),ng));this.pushFeature=new e({apiBaseUrl:this.rt.config.apiBaseUrl,clientKey:this.rt.config.clientKey,deviceId:this.rt.session.deviceId,log:this.rt.log}),this.pushFeature.onNotificationOpened(({data:t,action:r})=>{this.track("$push_opened",{...r?{action:r}:{},...t&&typeof t=="object"?t:{}})});for(let t of this.pendingPushOpenCbs)this.pushFeature.onNotificationOpened(t);return this.pendingPushOpenCbs=[],this.pushFeature}async enablePush(e){let t=await this.ensurePush();return t?t.enable(e):"error"}onNotificationOpened(e){return this.pushFeature?this.pushFeature.onNotificationOpened(e):(this.pendingPushOpenCbs.push(e),this.ensurePush(),()=>{var r;(r=this.pushFeature)==null||r.onNotificationOpened(e);let t=this.pendingPushOpenCbs.indexOf(e);t>=0&&this.pendingPushOpenCbs.splice(t,1)})}cfg(){var e;return(e=this.rt)==null?void 0:e.registry.get("config")}recordExposure(e,t,r){var i;if(!this.rt||t==null)return;let s=`${e}=${String(t)}`;this.flagExposed.has(s)||(this.flagExposed.add(s),(i=this.analyticsFeature())==null||i.register({[`$feature/${e}`]:t}),this.track("$feature_flag_called",{flag_key:e,flag_value:t,...r?{reason:r}:{}}))}prof(){var e;return(e=this.rt)==null?void 0:e.registry.get("profiler")}},rt=()=>{},Ye=()=>Promise.resolve(),sg={unreadCount:0,total:0,syncStatus:"idle"},Dk={subscribe:n=>(n(sg),rt),onUnreadChange:n=>(n(0),rt),getState:()=>sg,query:()=>Promise.resolve({messages:[],cursor:null,hasMore:!1}),get:()=>Promise.resolve(void 0),markRead:Ye,markUnread:Ye,markAllRead:Ye,archive:Ye,unarchive:Ye,pin:Ye,remove:Ye,refresh:Ye,ingest:Ye,act:rt,onCtaAction:()=>rt,mount:rt,open:rt,close:rt,unmount:rt},hn=new $a;$();function qk(n,e){let t=n.ScaleBun;n.ScaleBun=hn;let r=!1;if(t&&Array.isArray(t.q))for(let i of t.q){let[o,a]=i;o==="init"&&(r=!0);let c=hn[o];if(typeof c=="function"){let l=a?Array.prototype.slice.call(a):[];try{c.apply(hn,l)}catch{}}}let s=e==null?void 0:e.dataset;if(!r&&(s!=null&&s.clientKey)){let i={clientKey:s.clientKey};s.apiBaseUrl&&(i.apiBaseUrl=s.apiBaseUrl),s.environment&&(i.environment=s.environment),s.autocapture!=null&&(i.autocapture=s.autocapture!=="false"),hn.init(i)}}if(typeof window!="undefined"){let n=typeof document!="undefined"?document.currentScript:null;wn(n==null?void 0:n.nonce),qk(window,n)}})();
717
717
  //# sourceMappingURL=scalebun.min.js.map