@scalebun/web 1.2.2 → 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/README.md +0 -2
  2. package/dist/bootstrap/SDKBootstrapper.d.ts.map +1 -1
  3. package/dist/bootstrap/SDKBootstrapper.js +37 -1
  4. package/dist/bootstrap/SDKBootstrapper.js.map +1 -1
  5. package/dist/core/prune.d.ts +28 -4
  6. package/dist/core/prune.d.ts.map +1 -1
  7. package/dist/core/prune.js +92 -11
  8. package/dist/core/prune.js.map +1 -1
  9. package/dist/features/bugreport/BugReportFeature.d.ts +3 -2
  10. package/dist/features/bugreport/BugReportFeature.d.ts.map +1 -1
  11. package/dist/features/bugreport/BugReportFeature.js +2 -1
  12. package/dist/features/bugreport/BugReportFeature.js.map +1 -1
  13. package/dist/features/bugreport/widget.d.ts +21 -2
  14. package/dist/features/bugreport/widget.d.ts.map +1 -1
  15. package/dist/features/bugreport/widget.js +37 -4
  16. package/dist/features/bugreport/widget.js.map +1 -1
  17. package/dist/features/coach/overlay.d.ts.map +1 -1
  18. package/dist/features/coach/overlay.js +26 -5
  19. package/dist/features/coach/overlay.js.map +1 -1
  20. package/dist/features/engage/EngageFeature.d.ts +7 -1
  21. package/dist/features/engage/EngageFeature.d.ts.map +1 -1
  22. package/dist/features/engage/EngageFeature.js +32 -10
  23. package/dist/features/engage/EngageFeature.js.map +1 -1
  24. package/dist/features/engage/normalize.d.ts.map +1 -1
  25. package/dist/features/engage/normalize.js +7 -0
  26. package/dist/features/engage/normalize.js.map +1 -1
  27. package/dist/features/engage/runtime.d.ts +11 -0
  28. package/dist/features/engage/runtime.d.ts.map +1 -1
  29. package/dist/features/engage/runtime.js +25 -10
  30. package/dist/features/engage/runtime.js.map +1 -1
  31. package/dist/features/engage/throttle.d.ts +16 -6
  32. package/dist/features/engage/throttle.d.ts.map +1 -1
  33. package/dist/features/engage/throttle.js +96 -6
  34. package/dist/features/engage/throttle.js.map +1 -1
  35. package/dist/features/engage/types.d.ts +6 -0
  36. package/dist/features/engage/types.d.ts.map +1 -1
  37. package/dist/features/engage/types.js.map +1 -1
  38. package/dist/features/inapp/InApp2Feature.d.ts.map +1 -1
  39. package/dist/features/inapp/InApp2Feature.js +1 -0
  40. package/dist/features/inapp/InApp2Feature.js.map +1 -1
  41. package/dist/features/inapp/blocks/styles.d.ts +1 -1
  42. package/dist/features/inapp/blocks/styles.d.ts.map +1 -1
  43. package/dist/features/inapp/blocks/styles.js +30 -3
  44. package/dist/features/inapp/blocks/styles.js.map +1 -1
  45. package/dist/features/inapp/center/panel.d.ts +1 -1
  46. package/dist/features/inapp/center/panel.d.ts.map +1 -1
  47. package/dist/features/inapp/center/panel.js +40 -6
  48. package/dist/features/inapp/center/panel.js.map +1 -1
  49. package/dist/features/inapp/core/engine.d.ts +2 -0
  50. package/dist/features/inapp/core/engine.d.ts.map +1 -1
  51. package/dist/features/inapp/core/engine.js +1 -1
  52. package/dist/features/inapp/core/engine.js.map +1 -1
  53. package/dist/features/inapp/core/host.d.ts.map +1 -1
  54. package/dist/features/inapp/core/host.js +5 -1
  55. package/dist/features/inapp/core/host.js.map +1 -1
  56. package/dist/features/inapp/core/targeting.d.ts +29 -2
  57. package/dist/features/inapp/core/targeting.d.ts.map +1 -1
  58. package/dist/features/inapp/core/targeting.js +78 -4
  59. package/dist/features/inapp/core/targeting.js.map +1 -1
  60. package/dist/features/inapp/surfaces/coachmark.d.ts.map +1 -1
  61. package/dist/features/inapp/surfaces/coachmark.js +5 -2
  62. package/dist/features/inapp/surfaces/coachmark.js.map +1 -1
  63. package/dist/features/inapp/surfaces/hotspot.d.ts.map +1 -1
  64. package/dist/features/inapp/surfaces/hotspot.js +5 -2
  65. package/dist/features/inapp/surfaces/hotspot.js.map +1 -1
  66. package/dist/features/inapp/surfaces/inline.d.ts.map +1 -1
  67. package/dist/features/inapp/surfaces/inline.js +7 -1
  68. package/dist/features/inapp/surfaces/inline.js.map +1 -1
  69. package/dist/features/inapp/surfaces/popover.d.ts.map +1 -1
  70. package/dist/features/inapp/surfaces/popover.js +5 -2
  71. package/dist/features/inapp/surfaces/popover.js.map +1 -1
  72. package/dist/features/inapp/surfaces/styles.d.ts +1 -1
  73. package/dist/features/inapp/surfaces/styles.d.ts.map +1 -1
  74. package/dist/features/inapp/surfaces/styles.js +60 -11
  75. package/dist/features/inapp/surfaces/styles.js.map +1 -1
  76. package/dist/features/inapp/surfaces/toolbar.d.ts.map +1 -1
  77. package/dist/features/inapp/surfaces/toolbar.js +5 -2
  78. package/dist/features/inapp/surfaces/toolbar.js.map +1 -1
  79. package/dist/features/inapp/surfaces/tour.d.ts.map +1 -1
  80. package/dist/features/inapp/surfaces/tour.js +5 -2
  81. package/dist/features/inapp/surfaces/tour.js.map +1 -1
  82. package/dist/features/inapp/types.d.ts +2 -0
  83. package/dist/features/inapp/types.d.ts.map +1 -1
  84. package/dist/features/journey/InteractionTracker.d.ts.map +1 -1
  85. package/dist/features/journey/InteractionTracker.js +137 -0
  86. package/dist/features/journey/InteractionTracker.js.map +1 -1
  87. package/dist/features/manifest.d.ts +21 -0
  88. package/dist/features/manifest.d.ts.map +1 -1
  89. package/dist/features/manifest.js +27 -10
  90. package/dist/features/manifest.js.map +1 -1
  91. package/dist/features/replay/ReplayFeature.d.ts +20 -0
  92. package/dist/features/replay/ReplayFeature.d.ts.map +1 -1
  93. package/dist/features/replay/ReplayFeature.js +155 -5
  94. package/dist/features/replay/ReplayFeature.js.map +1 -1
  95. package/dist/features/replay/lifecycle/recorder.d.ts +21 -1
  96. package/dist/features/replay/lifecycle/recorder.d.ts.map +1 -1
  97. package/dist/features/replay/lifecycle/recorder.js +20 -4
  98. package/dist/features/replay/lifecycle/recorder.js.map +1 -1
  99. package/dist/features/session/sessionStore.d.ts +17 -1
  100. package/dist/features/session/sessionStore.d.ts.map +1 -1
  101. package/dist/features/session/sessionStore.js +17 -1
  102. package/dist/features/session/sessionStore.js.map +1 -1
  103. package/dist/pipeline/pipeline.d.ts +82 -0
  104. package/dist/pipeline/pipeline.d.ts.map +1 -1
  105. package/dist/pipeline/pipeline.js +307 -14
  106. package/dist/pipeline/pipeline.js.map +1 -1
  107. package/dist/public/ScaleBunFacade.d.ts +31 -0
  108. package/dist/public/ScaleBunFacade.d.ts.map +1 -1
  109. package/dist/public/ScaleBunFacade.js +43 -7
  110. package/dist/public/ScaleBunFacade.js.map +1 -1
  111. package/dist/scalebun.min.js +147 -65
  112. package/dist/scalebun.min.js.map +4 -4
  113. package/dist/transport/httpClient.d.ts +56 -2
  114. package/dist/transport/httpClient.d.ts.map +1 -1
  115. package/dist/transport/httpClient.js +81 -5
  116. package/dist/transport/httpClient.js.map +1 -1
  117. package/package.json +9 -3
@@ -1,5 +1,5 @@
1
- "use strict";(()=>{var Bh=Object.defineProperty;var E=(n,e)=>()=>(n&&(e=n(n=0)),e);var _=(n,e)=>{for(var t in e)Bh(n,t,{get:e[t],enumerable:!0})};function $(){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 qa(){try{if(typeof localStorage!="undefined"){let n=localStorage.getItem($a);if(n)return n;let e=`web_${$()}`;return localStorage.setItem($a,e),e}}catch{}return`web_${$()}`}var $a,za=E(()=>{"use strict";$a="scalebun_device_id"});function Ua(n){return(...e)=>{n&&typeof console!="undefined"&&console.info(Os,...e)}}var Os,Ns=E(()=>{"use strict";Os="[scalebun]"});var Va=E(()=>{"use strict"});function Wa(){return{platform:"web",renderer:"dom",sdk:{name:Dh,version:Bs}}}function ja(n){let e=typeof navigator!="undefined"?navigator.userAgent:"",{browser:t,os:r}=Hh(e);return{id:n,browser:t.name,browserVersion:t.version,os:r.name,osVersion:r.version}}function Ka(n){return{version:n.appVersion,environment:n.environment,release:n.release}}function Ga(){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 Hh(n){var s,i,o,a,c,l,u,d;let e={},t={},r=/(Edg|OPR|Chrome|Firefox|Safari)\/([\d.]+)/.exec(n);return r&&r[1]&&(e.name=(s={Edg:"Edge",OPR:"Opera"}[r[1]])!=null?s:r[1],e.version=(i=r[2])==null?void 0:i.split(".")[0]),/Windows NT ([\d.]+)/.test(n)?(t.name="Windows",t.version=(o=/Windows NT ([\d.]+)/.exec(n))==null?void 0:o[1]):/Mac OS X ([\d_]+)/.test(n)?(t.name="macOS",t.version=(c=(a=/Mac OS X ([\d_]+)/.exec(n))==null?void 0:a[1])==null?void 0:c.replace(/_/g,".")):/Android ([\d.]+)/.test(n)?(t.name="Android",t.version=(l=/Android ([\d.]+)/.exec(n))==null?void 0:l[1]):/(iPhone|iPad).+OS ([\d_]+)/.test(n)?(t.name="iOS",t.version=(d=(u=/OS ([\d_]+)/.exec(n))==null?void 0:u[1])==null?void 0:d.replace(/_/g,".")):/Linux/.test(n)&&(t.name="Linux"),{browser:e,os:t}}var Dh,Bs,Ya=E(()=>{"use strict";Dh="@scalebun/web",Bs="1.2.2"});function j(n){return n.replace(/[\w.+-]+@[\w-]+\.[\w.-]+/g,"[email]").replace(/\b[A-Za-z0-9_-]{24,}\b/g,"[token]")}function Uh(n){return n.replace(qh,"[email]").replace(zh,"[redacted]")}function mt(n,e=0){if(n==null||e>4)return n;if(typeof n=="string")return Uh(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]=$h.test(s)?"[redacted]":mt(i,e+1)}return t}return n}var $h,qh,zh,Fs=E(()=>{"use strict";$h=/pass(word|wd)?|secret|token|api[_-]?key|authorization|auth|ssn|social|credit|card[_-]?(number|num)|cardnum|cvv|cvc/i,qh=/[\w.+-]+@[\w-]+\.[\w.-]+/g,zh=/\b\d[\d -]{11,18}\d\b/g});function Xa(n){try{let e=Ja()[n];if(!e)return!1;let t="__scalebun_probe__";return e.setItem(t,"1"),e.removeItem(t),!0}catch{return!1}}function Vh(){try{return typeof Request!="undefined"&&"keepalive"in new Request("https://scalebun.invalid",{})}catch{return!1}}function Wh(){let n=typeof document!="undefined";return{dom:n,storage:Xa("localStorage"),session:Xa("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:Vh(),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 jh(){return Ds===null&&(Ds=Wh()),Ds}function $t(n){return jh()[n]}var Ja,ht,Ds,Hs=E(()=>{"use strict";Ja=()=>globalThis,ht=n=>typeof Ja()[n]!="undefined";Ds=null});function Pe(n,e,t){if(!$t("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 $s=E(()=>{"use strict";Hs()});var bn,Qa=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 gt(n){return n.length>Za?n.slice(0,Za):n}function Yh(n){return n.replace(/[?#].*$/,"")}function Xh(n){return n==="warn"?"warning":n==="debug"||n==="info"||n==="error"?n:"info"}function ec(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 Jh(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:Xh(n.level),message:gt(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:gt(j(`${n.method} ${Yh(n.url)}`)),data:ec({status:r,duration:n.duration})}}case"event":return Qh(n.name,(t=n.props)!=null?t:{},e);case"error":return{ts:e,category:"error",type:n.type,level:"error",message:gt(j(n.message))};default:return null}}function Qh(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:gt(j(String((o=(i=e.selector)!=null?i:e.label)!=null?o:a))),data:ec({dead:e.dead,rage:e.rage})}}return{ts:t,category:"custom",type:"event",message:gt(j(n))}}function tc(n){zs=n}function nc(n){if(!zs)return n;try{return zs(n)}catch{return n}}function rc(n){let e=n.message?{...n,message:gt(j(n.message))}:n,t=nc(e);t&&We.add(t)}function sc(n){let e=Jh(n);if(!e)return;let t=nc(e);t&&We.add(t)}function ic(){We.clear()}var Kh,Gh,Za,qs,We,zs,oc=E(()=>{"use strict";Fs();Kh=50,Gh=200,Za=256;qs=class{constructor(){this.ring=[];this.max=Kh}setMax(e){this.max=Math.max(1,Math.min(Gh,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 ac(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 cc(){yn=void 0,vn=void 0}var yn,vn,lc=E(()=>{"use strict"});function Oe(n){n&&typeof n=="object"&&(qt={...qt,...n})}function bt(){return qt}function dc(){let n=qt.deviceId;qt=n!=null?{deviceId:n}:{}}var qt,uc=E(()=>{"use strict";qt={}});function Zh(){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 Vs(){return Us===null&&(Us=Zh()),Us}function eg(){return Vs()==="browser"}function pc(){return!eg()}var Us,fc=E(()=>{"use strict";Us=null});function wn(n){n&&(Ws=n)}function yt(n){if(Ws)try{n.nonce=Ws}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=yt(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 Ws,mc=E(()=>{"use strict";Ws=null});var q=E(()=>{"use strict";za();Ns();Va();Ya();Fs();$s();Qa();oc();lc();uc();fc();Hs();mc()});function xn(){try{let n=typeof sessionStorage!="undefined"&&sessionStorage.getItem(Ks);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 vt(n){it=n;try{typeof sessionStorage!="undefined"&&sessionStorage.setItem(Ks,JSON.stringify([n.id,n.startedAt,n.lastSeenAt,n.seq]))}catch{}}function hc(n=Ut,e=Gs){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,vt(r),it=r,r;let s={id:`sess_${$()}`,startedAt:t,lastSeenAt:t,seq:0};return vt(s),it=s,s}function gc(){if(typeof document!="undefined"&&document.visibilityState==="hidden")return;let n=P();if(it)try{if(typeof sessionStorage!="undefined"&&sessionStorage.getItem(Ks)===null){it.lastSeenAt=n,vt(it),js=n;return}}catch{}if(n-js<6e4)return;js=n;let e=xn();e&&(e.lastSeenAt=n,vt(e),it=e)}function Ys(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(),vt(e),t}function bc(n){let e=xn();return e?(e.seq<n&&(e.seq=n,vt(e)),e.seq):(zt<n&&(zt=n),zt)}var Ks,Ut,Gs,it,js,zt,Sn=E(()=>{"use strict";q();Ks="scalebun_session",Ut=30*60*1e3,Gs=4*60*60*1e3;it=null,js=0,zt=0});var Js={};_(Js,{SDK_SIGNING_VERSION:()=>yc,signBody:()=>vc,signatureHeaders:()=>rg});function tg(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 ng(n){let e="";for(let t=0;t<n.length;t++)e+=n[t].toString(16).padStart(2,"0");return e}async function vc(n,e){var t;try{let r=(t=globalThis.crypto)==null?void 0:t.subtle;if(!r||!n)return null;let s=await tg(r,n),i=await r.sign("HMAC",s,new TextEncoder().encode(e));return ng(new Uint8Array(i))}catch{return null}}async function rg(n,e){let t=await vc(n,e);return t?{"x-scalebun-signature":t,"x-scalebun-sdk-version":yc}:{}}var yc,Xs,Qs=E(()=>{"use strict";yc="1",Xs=new Map});var wc={};_(wc,{gzipString:()=>sg});async function sg(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 xc=E(()=>{"use strict"});function ag(){return new Promise(n=>{try{if(typeof indexedDB=="undefined")return n(null);let e=indexedDB.open(ig,1);e.onupgradeneeded=()=>{let t=e.result;t.objectStoreNames.contains(wt)||t.createObjectStore(wt)},e.onsuccess=()=>n(e.result),e.onerror=()=>n(null)}catch{n(null)}})}var ig,wt,og,Be,Vt=E(()=>{"use strict";ig="scalebun",wt="queue",og="pending";Be=class{constructor(e=og){this.key=e;this.dbp=null}db(){return this.dbp||(this.dbp=ag()),this.dbp}async load(){let e=await this.db();return e?new Promise(t=>{try{let r=e.transaction(wt,"readonly").objectStore(wt).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(wt,"readwrite");s.objectStore(wt).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 Sc(n){return typeof window=="undefined"?()=>{}:(window.addEventListener("online",n),()=>window.removeEventListener("online",n))}var cg,lg,xt,Cn=E(()=>{"use strict";cg=1e3,lg=3e4,xt=class{constructor(){this.fails=0;this.nextAt=0}ready(e){return e>=this.nextAt}fail(e){let t=Math.min(lg,cg*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 St(n,e){if(kc(n)<=2e6)return n.slice();let t=e?n.filter(r=>!e(r)):n.slice();for(;t.length&&kc(t)>2e6;)t.shift();return t}var kc,Rn=E(()=>{"use strict";kc=n=>JSON.stringify(n).length});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 kt(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 Rc(n){return n>=100?100:n>=75?75:n>=50?50:n>=25?25:0}var _n=E(()=>{"use strict"});var Bc={};_(Bc,{anchorOf:()=>Nc,fieldKeyOf:()=>_c,fieldLabelOf:()=>Oc,formIdOf:()=>On,installFormAnalytics:()=>Ag,isSensitiveField:()=>Pc,isTrackableField:()=>Lc,stepOf:()=>Wt});function Pc(n){let e=(n.getAttribute("type")||"").toLowerCase();if(vg.has(e))return!0;let t=n.getAttribute("autocomplete")||"";return wg.test(t)}function Lc(n){if(!n||typeof n.matches!="function"||!n.matches(Sg))return!1;let e=(n.getAttribute("type")||"").toLowerCase();return xg.has(e)?!1:!Pc(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 Oc(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>Tc?`${t.slice(0,Tc-1)}\u2026`:t}function Ig(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 On(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_${Ig(`${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 Nc(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 Cg(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 Ag(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>=Eg?null:(h={startedAt:at(),lastField:null,order:0,fields:new Map},t.set(m,h),n.onEvent({name:"$form_start",props:{form_id:On(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,kg).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(!Lc(h))return null;let g=h.form;if(!g||Mc(g)||Mc(h))return null;let k=r(g);return k?{form:g,el:h,key:_c(h,g),st:k}:null},a=m=>{let h=o(m);if(!h)return;let{st:g,key:k}=h,v=g.fields.get(k);v||(v={ms:0,changed:!1,errored:!1,order:g.order++,focusedAt:null,label:Oc(h.el)},g.fields.set(k,v)),v.focusedAt=at(),g.lastField=k},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 k;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:On(h.form),field_key:h.key,error_type:Cg(h.el),step:Wt(h.form),...(k=Nc(h.el))!=null?k:{}}})},d=(m,h)=>{var g;for(let k of h.fields.values())k.focusedAt!=null&&(k.ms+=at()-k.focusedAt,k.focusedAt=null);n.onEvent({name:"$form_abandon",props:{form_id:On(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 vg,wg,xg,Sg,kg,Eg,Tc,Mc,at,Fc=E(()=>{"use strict";q();vg=new Set(["password","hidden"]),wg=/(^|\s|-)(cc-|new-password|current-password|one-time-code)/i,xg=new Set(["submit","button","reset","image"]),Sg="input, select, textarea",kg=30,Eg=20;Tc=60;Mc=n=>!!n&&typeof n.closest=="function"&&!!n.closest("[data-scalebun-no-capture]");at=()=>typeof performance!="undefined"?performance.now():Date.now()});var Dc={};_(Dc,{installScrollTracker:()=>Rg});function Rg(){if(typeof window=="undefined"||typeof document=="undefined")return{summary:()=>Tg(),reset:()=>{},stop:()=>{}};let n=0,e=0,t=0,r=()=>document.documentElement,s=()=>{try{let c=r();e=Math.max(e,c.scrollHeight),t=window.innerHeight||c.clientHeight||0}catch{}},i=()=>{let c=window.scrollY||window.pageYOffset||0;c>n&&(n=c)},o;if(typeof ResizeObserver!="undefined")try{o=new ResizeObserver(()=>s()),o.observe(r())}catch{o=void 0}return s(),window.addEventListener("scroll",i,{passive:!0}),window.addEventListener("resize",s,{passive:!0}),{summary:()=>{s();let c=e||0,l=t||0,u=kt(n,c,l);return{scroll_depth_pct:u,max_scroll_px:Math.round(n),doc_h:Math.round(c),viewport_h:Math.round(l),max_bucket:Rc(u),scrollable:ei(c,l)}},reset:()=>{n=0,e=0,t=window.innerHeight||0},stop:()=>{window.removeEventListener("scroll",i),window.removeEventListener("resize",s),o==null||o.disconnect()}}}function Tg(){return{scroll_depth_pct:0,max_scroll_px:0,doc_h:0,viewport_h:0,max_bucket:0,scrollable:!1}}var Hc=E(()=>{"use strict";_n()});var qc={};_(qc,{ATTENTION_BANDS:()=>Mg,bandFractions:()=>$c,installAttentionTracker:()=>Pg});function $c(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 Pg(){if(typeof window=="undefined"||typeof document=="undefined")return{summary:()=>Lg(),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,k=$c(g,t,e,10);for(let b=0;b<10;b++)n[b]=((v=n[b])!=null?v:0)+h*((y=k[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 Lg(){return{attention_bands:new Array(10).fill(0),attention_active_ms:0,attention_bands_n:10}}var Mg,ct,zc=E(()=>{"use strict";Mg=10;ct=()=>typeof performance!="undefined"&&performance.now?performance.now():Date.now()});var jc={};_(jc,{describeElement:()=>Bn,installAutocapture:()=>$g});function Bg(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 Bn(n,e=!1){var c;let t={tag:n.tagName.toLowerCase(),selector:Bg(n)},r=(n.textContent||"").trim().slice(0,80);r&&(t.text=e?Wc(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 Fg(n,e){for(let t of e)if(t instanceof Element&&typeof t.matches=="function"&&t.matches(Uc))return t;return n&&typeof n.closest=="function"?n.closest(Uc):null}function Dg(n){return Ng.has(n.tagName)?!1:n.id||(n.getAttribute("class")||"").trim()?!0:!!(n.textContent||"").trim()}function Hg(n){try{return new URL(n,location.href)}catch{return null}}function Vc(){try{return location.pathname}catch{return""}}function $g(n){if(typeof document=="undefined"||typeof window=="undefined")return()=>{};let e=!0,t;Promise.resolve().then(()=>(Fc(),Bc)).then(R=>{e&&(t=R.installFormAnalytics(n))}).catch(()=>{});let r;Promise.resolve().then(()=>(Hc(),Dc)).then(R=>{e&&(r=R.installScrollTracker())}).catch(()=>{});let s;Promise.resolve().then(()=>(zc(),qc)).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=Fg(A,O),D=z!=null?z:A&&Dg(A)?A:null;if(!D||Nn(D))return;let te={...Bn(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=Hg(J);if(!Q)return;D.hasAttribute("download")||Og.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(_g)||Nn(A))return;let O={...Bn(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?Wc(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"||Nn(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=Vc(),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())},k=()=>{l!=null&&(c+=m()-l,l=null)},v=()=>{if(e)try{let R=document.documentElement,A=kt(window.scrollY,R.scrollHeight,window.innerHeight||R.clientHeight);A>u&&(u=A)}catch{}},y=()=>{var R,A;!p||f||(k(),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()},x=new WeakSet,S;typeof IntersectionObserver!="undefined"&&(S=new IntersectionObserver(R=>{if(e)for(let A of R){let O=A.target;A.isIntersecting&&A.intersectionRatio>=.5&&!x.has(O)&&(x.add(O),S.unobserve(O),Nn(O)||n.onEvent({name:"$impression",props:{...Bn(O),path:location.pathname}}))}},{threshold:[.5]}));let w=()=>{if(!(!S||!e))try{document.querySelectorAll("[data-scalebun-track-impression]").forEach(R=>{x.has(R)||S.observe(R)})}catch{}},I=()=>{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=Vc(),p=!0,f=!1,g(),w()}};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",k),window.addEventListener("popstate",I);let C=history.pushState,M=history.replaceState;return history.pushState=function(...R){C.apply(this,R),I()},history.replaceState=function(...R){M.apply(this,R),I()},I(),()=>{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",k),window.removeEventListener("popstate",I),S==null||S.disconnect(),history.pushState!==C&&history.pushState.toString().includes("pageview")}}var Uc,_g,Og,Ng,Wc,Nn,Kc=E(()=>{"use strict";_n();Uc='button, a, [role="button"], input[type="submit"], input[type="button"], [data-scalebun-capture]',_g='select, input[type="checkbox"], input[type="radio"]',Og=/\.(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,Ng=new Set(["HTML","BODY","MAIN","SECTION","HEADER","FOOTER","NAV"]),Wc=n=>n.replace(/\S/g,"*");Nn=n=>!!n&&typeof n.closest=="function"&&!!n.closest("[data-scalebun-no-capture]")});function li(n){return n.replace(/[?#].*$/,"").trim()}function sb(n){return!(!n||n.includes("node_modules")||n==="<anonymous>"||n==="native"||n==="[native code]"||/^(chrome|moz|safari|webkit)-extension:\/\//.test(n))}function ml(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 hl(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=sb(e.file),t}function ib(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=ml(r);return o?hl(s,o):null}let t=e.lastIndexOf("@");if(t!==-1){let r=e.slice(0,t).trim()||void 0,s=ml(e.slice(t+1));if(s&&s.file)return hl(r,s)}return null}function gl(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=ib((r=t[s])!=null?r:"");i&&e.push(i)}return e}var bl=E(()=>{"use strict"});function ab(n){if(!n)return"";let e=/^[a-z]+:\/\/[^/]+(\/.*)$/i.exec(n);return e&&e[1]?e[1]:n}function cb(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>"}@${ab(o.file)}`;if(a!==s&&(r.push(a),s=a,r.length>=ob))break}return r.join(">")}function lb(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 yl(n,e,t){let r=cb(e),s=r?`${n}|${r}`:`${n}|${lb(t)}`;return Ee(s).toString(36)}var ob,vl=E(()=>{"use strict";Fe();ob=5});function wl(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 xl=E(()=>{"use strict"});var Sl={};_(Sl,{computeFingerprint:()=>yl,extractCauses:()=>wl,parseStack:()=>gl});var kl=E(()=>{"use strict";bl();vl();xl()});function Nl(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+=Nl(y),g(y)},a.addEventListener("message",v=>{d++,f+=Nl(v.data)}),a.addEventListener("error",()=>{m=!0});let k=(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=>k(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 Bl=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 Fl=E(()=>{"use strict"});function Mb(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:Mb(o),error:l?void 0:"beacon not queued"};return e(u),l},()=>{n.sendBeacon=r})}var Dl=E(()=>{"use strict"});var Hl={};_(Hl,{installBeacon:()=>fi,installEventSource:()=>pi,installStreams:()=>Pb,installWebSocket:()=>ui});function Pb(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 $l=E(()=>{"use strict";Bl();Fl();Dl()});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=zl(e);if(Array.isArray(t)&&t.length){let r=t[0],s=r?ql(r):void 0;return{...s!=null?s:{},batched:!0}}return}if(e.startsWith("{")){let t=zl(e);return t&&("query"in t||"operationName"in t)?ql(t):void 0}if(Ul.test(e))return _b(e)}function Xn(n){if(!n||typeof n!="object")return!1;if(Array.isArray(n))return n.some(t=>Xn(t));let e=n.errors;return Array.isArray(e)&&e.length>0}function ql(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=Vl(r);if(s&&(e.operationType=s),!e.operationName){let i=Wl(r);i&&(e.operationName=i)}}return e}function _b(n){let e={},t=Vl(n);t&&(e.operationType=t);let r=Wl(n);return r&&(e.operationName=r),e}function Vl(n){let e=n.trimStart();if(e.startsWith("{"))return"query";let t=Ul.exec(e.slice(0,64));return t?t[1]:void 0}function Wl(n){let e=Lb.exec(n);return e&&e[2]?e[2]:void 0}function zl(n){try{return JSON.parse(n)}catch{return}}var Ul,Lb,jl=E(()=>{"use strict";Ul=/\b(query|mutation|subscription)\b/,Lb=/\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 bE,Kl=E(()=>{"use strict";q();bE=64*1024});var Gl={};_(Gl,{enrichHttpCapture:()=>Ob,graphqlResponseHasErrors:()=>Xn,looksLikeGraphql:()=>mi,parseGraphqlRequest:()=>hi});async function Ob(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=Xn(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 Yl=E(()=>{"use strict";jl();Kl()});function pd(n){if(er.size)for(let e of er)try{e(n)}catch{}}function fd(n){return er.add(n),()=>{er.delete(n)}}var er,ki=E(()=>{"use strict";er=new Set});var nr,rr,sr=E(()=>{"use strict";nr={startChild:()=>nr,finish(){},setData(){}},rr={startSpan:()=>nr,finish(){}}});function wd(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 Ct(){return wd(16)}function je(){return wd(8)}function xd(n){return`00-${n.traceId}-${n.spanId}-${n.sampled?"01":"00"}`}function Sd(n){var t,r,s;let e=Vb.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 Vb,ir=E(()=>{"use strict";Vb=/^00-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})$/});var or,kd=E(()=>{"use strict";ir();sr();or=class{constructor(e,t){this.name=e;this.traceId=Ct();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++,nr;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 Ed(n,e){let t=Ct(),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,Id=E(()=>{"use strict";ir();Ii=n=>Math.round(n)});var Cd={};_(Cd,{Transaction:()=>or,buildPageload:()=>Ed,formatTraceparent:()=>xd,newSpanId:()=>je,newTraceId:()=>Ct,parseTraceparent:()=>Sd});var Ad=E(()=>{"use strict";kd();ir();Id()});var _d={};_(_d,{createBugReportWidget:()=>cy});function oy(n){let e=n.startsWith("top")?"top: 16px;":"bottom: 16px;",t=n.endsWith("right")?"right: 16px;":"left: 16px;";return e+t}function ay(n){return`[data-scalebun-bugreport]{position:fixed;${oy(n)}z-index:${iy};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-panel{display:none;width:300px;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}`}function cy(n){if(typeof document=="undefined")return{destroy:()=>{}};let e=document.createElement("div");e.setAttribute("data-scalebun-bugreport",""),Ne(document,ay(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 rg=Object.defineProperty;var E=(n,e)=>()=>(n&&(e=n(n=0)),e);var _=(n,e)=>{for(var t in e)rg(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=E(()=>{"use strict";Ka="scalebun_device_id"});function Ya(n){return(...e)=>{n&&typeof console!="undefined"&&console.info(Ls,...e)}}var Ls,_s=E(()=>{"use strict";Ls="[scalebun]"});var Ja=E(()=>{"use strict"});function Qa(){return{platform:"web",renderer:"dom",sdk:{name:ig,version:Os}}}function Za(n){let e=typeof navigator!="undefined"?navigator.userAgent:"",{browser:t,os:r}=og(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 og(n){var s,i,o,a,c,l,u,d;let e={},t={},r=/(Edg|OPR|Chrome|Firefox|Safari)\/([\d.]+)/.exec(n);return r&&r[1]&&(e.name=(s={Edg:"Edge",OPR:"Opera"}[r[1]])!=null?s:r[1],e.version=(i=r[2])==null?void 0:i.split(".")[0]),/Windows NT ([\d.]+)/.test(n)?(t.name="Windows",t.version=(o=/Windows NT ([\d.]+)/.exec(n))==null?void 0:o[1]):/Mac OS X ([\d_]+)/.test(n)?(t.name="macOS",t.version=(c=(a=/Mac OS X ([\d_]+)/.exec(n))==null?void 0:a[1])==null?void 0:c.replace(/_/g,".")):/Android ([\d.]+)/.test(n)?(t.name="Android",t.version=(l=/Android ([\d.]+)/.exec(n))==null?void 0:l[1]):/(iPhone|iPad).+OS ([\d_]+)/.test(n)?(t.name="iOS",t.version=(d=(u=/OS ([\d_]+)/.exec(n))==null?void 0:u[1])==null?void 0:d.replace(/_/g,".")):/Linux/.test(n)&&(t.name="Linux"),{browser:e,os:t}}var ig,Os,nc=E(()=>{"use strict";ig="@scalebun/web",Os="1.2.4"});function j(n){return n.replace(/[\w.+-]+@[\w-]+\.[\w.-]+/g,"[email]").replace(/\b[A-Za-z0-9_-]{24,}\b/g,"[token]")}function dg(n){return n.replace(cg,"[email]").replace(lg,"[redacted]")}function mt(n,e=0){if(n==null||e>4)return n;if(typeof n=="string")return dg(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]=ag.test(s)?"[redacted]":mt(i,e+1)}return t}return n}var ag,cg,lg,Ns=E(()=>{"use strict";ag=/pass(word|wd)?|secret|token|api[_-]?key|authorization|auth|ssn|social|credit|card[_-]?(number|num)|cardnum|cvv|cvc/i,cg=/[\w.+-]+@[\w-]+\.[\w.-]+/g,lg=/\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 ug(){try{return typeof Request!="undefined"&&"keepalive"in new Request("https://scalebun.invalid",{})}catch{return!1}}function pg(){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:ug(),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 fg(){return Bs===null&&(Bs=pg()),Bs}function gt(n){return fg()[n]}var sc,ht,Bs,Fs=E(()=>{"use strict";sc=()=>globalThis,ht=n=>typeof sc()[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,ic=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>oc?n.slice(0,oc):n}function gg(n){return n.replace(/[?#].*$/,"")}function bg(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 yg(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:bg(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} ${gg(n.url)}`)),data:ac({status:r,duration:n.duration})}}case"event":return vg(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 vg(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){Hs=n}function lc(n){if(!Hs)return n;try{return Hs(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=yg(n);if(!e)return;let t=lc(e);t&&We.add(t)}function pc(){We.clear()}var mg,hg,oc,qs,We,Hs,fc=E(()=>{"use strict";Ns();mg=50,hg=200,oc=256;qs=class{constructor(){this.ring=[];this.max=mg}setMax(e){this.max=Math.max(1,Math.min(hg,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 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=E(()=>{"use strict"});function Oe(n){n&&typeof n=="object"&&($t={...$t,...n})}function yt(){return $t}function bc(){let n=$t.deviceId;$t=n!=null?{deviceId:n}:{}}var $t,yc=E(()=>{"use strict";$t={}});function wg(){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=wg()),$s}function xg(){return zs()==="browser"}function vc(){return!xg()}var $s,wc=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,xc=E(()=>{"use strict";Us=null});var $=E(()=>{"use strict";Xa();_s();Ja();nc();Ns();Ds();ic();fc();gc();yc();wc();Fs();xc()});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 Sc(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 kc(){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 Ec(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={};_(Xs,{SDK_SIGNING_VERSION:()=>Ic,signBody:()=>Cc,signatureHeaders:()=>Eg});function Sg(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 kg(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 Sg(r,n),i=await r.sign("HMAC",s,new TextEncoder().encode(e));return kg(new Uint8Array(i))}catch{return null}}async function Eg(n,e){let t=await Cc(n,e);return t?{"x-scalebun-signature":t,"x-scalebun-sdk-version":Ic}:{}}var Ic,Gs,Ys=E(()=>{"use strict";Ic="1",Gs=new Map});var Ac={};_(Ac,{gzipString:()=>Ig});async function Ig(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 Tg(){return new Promise(n=>{try{if(typeof indexedDB=="undefined")return n(null);let e=indexedDB.open(Cg,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 Cg,xt,Ag,Be,Vt=E(()=>{"use strict";Cg="scalebun",xt="queue",Ag="pending";Be=class{constructor(e=Ag){this.key=e;this.dbp=null}db(){return this.dbp||(this.dbp=Tg()),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 Rg,Mg,St,Cn=E(()=>{"use strict";Rg=1e3,Mg=3e4,St=class{constructor(){this.fails=0;this.nextAt=0}ready(e){return e>=this.nextAt}fail(e){let t=Math.min(Mg,Rg*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:Pg(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 Pg,Tn=E(()=>{"use strict";Pg=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 Nc(n){return n>=100?100:n>=75?75:n>=50?50:n>=25?25:0}var On=E(()=>{"use strict"});var Uc={};_(Uc,{anchorOf:()=>zc,fieldKeyOf:()=>Hc,fieldLabelOf:()=>$c,formIdOf:()=>Nn,installFormAnalytics:()=>Yg,isSensitiveField:()=>Dc,isTrackableField:()=>qc,stepOf:()=>Wt});function Dc(n){let e=(n.getAttribute("type")||"").toLowerCase();if(zg.has(e))return!0;let t=n.getAttribute("autocomplete")||"";return Ug.test(t)}function qc(n){if(!n||typeof n.matches!="function"||!n.matches(Wg))return!1;let e=(n.getAttribute("type")||"").toLowerCase();return Vg.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 Gg(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_${Gg(`${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 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 Xg(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 Yg(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>=Kg?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,jg).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:Xg(h.el),step:Wt(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: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 zg,Ug,Vg,Wg,jg,Kg,Bc,Fc,at,Vc=E(()=>{"use strict";$();zg=new Set(["password","hidden"]),Ug=/(^|\s|-)(cc-|new-password|current-password|one-time-code)/i,Vg=new Set(["submit","button","reset","image"]),Wg="input, select, textarea",jg=30,Kg=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={};_(Wc,{installScrollTracker:()=>Jg});function Jg(){if(typeof window=="undefined"||typeof document=="undefined")return{summary:()=>Qg(),reset:()=>{},stop:()=>{}};let n=0,e=0,t=0,r=()=>document.documentElement,s=()=>{try{let c=r();e=Math.max(e,c.scrollHeight),t=window.innerHeight||c.clientHeight||0}catch{}},i=()=>{let c=window.scrollY||window.pageYOffset||0;c>n&&(n=c)},o;if(typeof ResizeObserver!="undefined")try{o=new ResizeObserver(()=>s()),o.observe(r())}catch{o=void 0}return s(),window.addEventListener("scroll",i,{passive:!0}),window.addEventListener("resize",s,{passive:!0}),{summary:()=>{s();let c=e||0,l=t||0,u=Et(n,c,l);return{scroll_depth_pct:u,max_scroll_px:Math.round(n),doc_h:Math.round(c),viewport_h:Math.round(l),max_bucket:Nc(u),scrollable:ei(c,l)}},reset:()=>{n=0,e=0,t=window.innerHeight||0},stop:()=>{window.removeEventListener("scroll",i),window.removeEventListener("resize",s),o==null||o.disconnect()}}}function Qg(){return{scroll_depth_pct:0,max_scroll_px:0,doc_h:0,viewport_h:0,max_bucket:0,scrollable:!1}}var jc=E(()=>{"use strict";On()});var Gc={};_(Gc,{ATTENTION_BANDS:()=>Zg,bandFractions:()=>Kc,installAttentionTracker:()=>eb});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 eb(){if(typeof window=="undefined"||typeof document=="undefined")return{summary:()=>tb(),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 tb(){return{attention_bands:new Array(10).fill(0),attention_active_ms:0,attention_bands_n:10}}var Zg,ct,Xc=E(()=>{"use strict";Zg=10;ct=()=>typeof performance!="undefined"&&performance.now?performance.now():Date.now()});var Zc={};_(Zc,{describeElement:()=>Fn,installAutocapture:()=>lb});function ib(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:ib(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 ob(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 ab(n){return sb.has(n.tagName)?!1:n.id||(n.getAttribute("class")||"").trim()?!0:!!(n.textContent||"").trim()}function cb(n){try{return new URL(n,location.href)}catch{return null}}function Jc(){try{return location.pathname}catch{return""}}function lb(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=ob(A,O),D=z!=null?z:A&&ab(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=cb(J);if(!Q)return;D.hasAttribute("download")||rb.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(nb)||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()},w=new WeakSet,x;typeof IntersectionObserver!="undefined"&&(x=new IntersectionObserver(T=>{if(e)for(let A of T){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(T=>{w.has(T)||x.observe(T)})}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=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",k);let C=history.pushState,M=history.replaceState;return history.pushState=function(...T){C.apply(this,T),k()},history.replaceState=function(...T){M.apply(this,T),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 Yc,nb,rb,sb,Qc,Bn,el=E(()=>{"use strict";On();Yc='button, a, [role="button"], input[type="submit"], input[type="button"], [data-scalebun-capture]',nb='select, input[type="checkbox"], input[type="radio"]',rb=/\.(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,sb=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 li(n){return n.replace(/[?#].*$/,"").trim()}function Ab(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: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 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=Ab(e.file),t}function Tb(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=Tb((r=t[s])!=null?r:"");i&&e.push(i)}return e}var El=E(()=>{"use strict"});function Mb(n){if(!n)return"";let e=/^[a-z]+:\/\/[^/]+(\/.*)$/i.exec(n);return e&&e[1]?e[1]:n}function Pb(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>"}@${Mb(o.file)}`;if(a!==s&&(r.push(a),s=a,r.length>=Rb))break}return r.join(">")}function Lb(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=Pb(e),s=r?`${n}|${r}`:`${n}|${Lb(t)}`;return Ee(s).toString(36)}var Rb,Cl=E(()=>{"use strict";Fe();Rb=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=E(()=>{"use strict"});var Rl={};_(Rl,{computeFingerprint:()=>Il,extractCauses:()=>Al,parseStack:()=>kl});var Ml=E(()=>{"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 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+=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=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 Vl=E(()=>{"use strict"});function Zb(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:Zb(o),error:l?void 0:"beacon not queued"};return e(u),l},()=>{n.sendBeacon=r})}var Wl=E(()=>{"use strict"});var jl={};_(jl,{installBeacon:()=>fi,installEventSource:()=>pi,installStreams:()=>ey,installWebSocket:()=>ui});function ey(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 Kl=E(()=>{"use strict";Ul();Vl();Wl()});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=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 ny(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 ny(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=ty.exec(n);return e&&e[2]?e[2]:void 0}function Xl(n){try{return JSON.parse(n)}catch{return}}var Yl,ty,Zl=E(()=>{"use strict";Yl=/\b(query|mutation|subscription)\b/,ty=/\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 XE,ed=E(()=>{"use strict";$();XE=64*1024});var td={};_(td,{enrichHttpCapture:()=>ry,graphqlResponseHasErrors:()=>Jn,looksLikeGraphql:()=>mi,parseGraphqlRequest:()=>hi});async function ry(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 nd=E(()=>{"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,ki=E(()=>{"use strict";tr=new Set});var rr,sr,ir=E(()=>{"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=fy.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 fy,or=E(()=>{"use strict";fy=/^00-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})$/});var ar,Md=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 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: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,Ld=E(()=>{"use strict";or();Ii=n=>Math.round(n)});var _d={};_(_d,{Transaction:()=>ar,buildPageload:()=>Pd,formatTraceparent:()=>Td,newSpanId:()=>je,newTraceId:()=>At,parseTraceparent:()=>Rd});var Od=E(()=>{"use strict";Md();or();Ld()});var $d={};_($d,{createBugReportWidget:()=>Oy});function Ly(n){let e=n.startsWith("top")?"top: 16px;":"bottom: 16px;",t=n.endsWith("right")?"right: 16px;":"left: 16px;";return e+t}function _y(n){return`[data-scalebun-bugreport]{position:fixed;${Ly(n)}z-index:${Py};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 Oy(n){if(typeof document=="undefined")return{destroy:()=>{}};let e=document.createElement("div");e.setAttribute("data-scalebun-bugreport",""),Ne(document,_y(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),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;try{h=await n.onSubmit({message:m,email:i.value.trim()||void 0})}catch{h=null}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="Could not send the report. Please try again."};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 iy,Od=E(()=>{"use strict";q();iy=2147483e3});var Wd={};_(Wd,{normalizeConfig:()=>_i});function qd(n){let e=_e(n),t=Ke({showOnce:dt(e.showOnce),cooldownHours:Re(e.cooldownHours),maxImpressions:Re(e.maxImpressions),samplePct:Re(e.samplePct)});return Object.keys(t).length?t:void 0}function zd(n){let e=_e(n),t=Ke({event:U(e.event),action:U(e.action),seconds:Re(e.seconds),sessions:Re(e.sessions),slowMs:Re(e.slowMs),screen:U(e.screen),delaySeconds:Re(e.delaySeconds)});return Object.keys(t).length?t:void 0}function Ud(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 hy(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||!my.has(o)||e.push(Ke({key:i,kind:o,label:(t=U(s.prompt))!=null?t:U(s.label),choices:Li(s.choices),scaleMax:Re(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 gy(n){let e=_e(n),t=U(e.label),r=U(e.action);if(!(!t||!r||!fy.has(r)))return Ke({label:t,action:r,deepLink:U(e.deepLink)})}function Vd(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:gy(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 by(n){let e=_e(n);if(!("enabled"in e)&&!("variantB"in e)&&!("split"in e))return;let t=Vd(e.variantB);return Ke({enabled:dt(e.enabled),split:Re(e.split),variantB:t!=null?t:void 0})}function yy(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:hy(e.questions),scale:Re(e.scale),trigger:U(e.trigger),targetScreen:U(e.targetScreen),triggerConfig:zd(e.triggerConfig),targeting:Ud(e.targeting),throttle:qd(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 vy(n){let e=_e(n),t=U(e.id),r=Vd(e.spec);if(!t||!r)return null;let s=U(e.layout);return Ke({id:t,layout:s&&py.includes(s)?s:"modal",trigger:U(e.trigger),delaySeconds:Re(e.delaySeconds),targetScreen:U(e.targetScreen),triggerConfig:zd(e.triggerConfig),targeting:Ud(e.targeting),throttle:qd(e.throttle),spec:r,revision:U(e.revision),experiment:by(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=Re(e.configVersion))!=null?t:0,serverTime:(r=U(e.serverTime))!=null?r:new Date().toISOString(),campaigns:Pi(e.campaigns).map(yy).filter(s=>s!==null),inAppMessages:Pi(e.inAppMessages).map(vy).filter(s=>s!==null)}}var _e,Pi,U,Re,dt,Li,Ke,py,fy,my,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,Re=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},py=["modal","fullscreen","bottom_sheet","top_banner","bottom_banner","tooltip","toast"],fy=new Set(["dismiss","link","custom"]),my=new Set(["scale","text","single","multi","emoji","boolean","screenshot","voice"])});var wy,en,jd=E(()=>{"use strict";wy={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=wy[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 Jd={};_(Jd,{clearEngageState:()=>Sy,hasTestSeen:()=>Fi,markTestSeen:()=>Di,passesThrottle:()=>Er,readState:()=>Ni,recordCompleted:()=>Bi,recordShown:()=>Ir});function tn(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}function Ni(n){let e=tn();if(!e)return{...Sr};try{let t=e.getItem(Gd(n));if(!t)return{...Sr};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{...Sr}}}function Yd(n,e){let t=tn();if(t)try{t.setItem(Gd(n),JSON.stringify(e))}catch{}}function Xd(n){let e=Ni(n.id);return n.revision&&e.revision&&e.revision!==n.revision?{...Sr,revision:n.revision}:e}function Er(n,e){let t=n.throttle;if(!t)return!0;let r=Xd(n);return!(t.showOnce&&(r.completed||r.impressions>0)||typeof t.maxImpressions=="number"&&r.impressions>=t.maxImpressions||typeof t.cooldownHours=="number"&&e-r.lastShownAt<t.cooldownHours*36e5)}function Ir(n,e){let t=Xd(n);Yd(n.id,{impressions:t.impressions+1,lastShownAt:e,completed:t.completed,revision:n.revision})}function Bi(n){var t;let e=Ni(n.id);Yd(n.id,{...e,completed:!0,revision:(t=n.revision)!=null?t:e.revision})}function Fi(n){var t;let e=tn();if(!e)return!1;try{let r=JSON.parse((t=e.getItem(kr))!=null?t:"[]");return Array.isArray(r)&&r.includes(n)}catch{return!1}}function Di(n){var t;let e=tn();if(e)try{let r=JSON.parse((t=e.getItem(kr))!=null?t:"[]").filter(s=>typeof s=="string");if(r.includes(n))return;for(r.push(n);r.length>xy;)r.shift();e.setItem(kr,JSON.stringify(r))}catch{}}function Sy(){let n=tn();if(n)try{let e=[];for(let t=0;t<n.length;t++){let r=n.key(t);r&&(r.startsWith(Kd)||r==="scalebun_engage_sessions"||r===kr)&&e.push(r)}for(let t of e)n.removeItem(t)}catch{}}var Kd,Gd,Sr,kr,xy,Hi=E(()=>{"use strict";Kd="scalebun_engage_throttle:";Gd=n=>`${Kd}${n}`,Sr={impressions:0,lastShownAt:0,completed:!1};kr="scalebun_engage_test_seen",xy=50});function tu(n){if(typeof n!="string")return!1;let e=n.trim();return!e||e.length>32?!1:eu.test(e)||Ay.test(e)||Ry.test(e)||Ty.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(!Zd.includes(s)){e.keepUnknown&&typeof r[s]=="string"&&(t[s]=r[s]);continue}tu(r[s])&&(t[s]=r[s].trim())}return t}function My(n){let e=Py(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 Py(n){let e=n.trim();if(eu.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 qi(n,e){if(e&&tu(e))return e;let t=My(n);return t==null?"#ffffff":t>.55?"#111827":"#ffffff"}function By(n){let e={};if(!n||typeof n!="object"||Array.isArray(n))return e;let t=n;for(let r of Object.keys(Qd)){let s=t[r];typeof s=="string"&&Qd[r].includes(s)&&(e[r]=s)}return e}function nu(n,e={}){var u,d;let t=e.dark?Ey:ky,r=e.dark?Cy:Iy,s=$i(n),i={};for(let p of Zd)i[p]=(u=s[p])!=null?u:t[p];let o=(d=s.accent)!=null?d:t.accent;i.ctaText=qi(o,s.ctaText);for(let[p,f]of Object.entries(r))i[p]=f;let a={...Ly,...By(n)},c=_y[a.density];return i.pad=c.pad,i.gap=c.gap,i.qGap=c.qGap,i.radius=Oy[a.radius],i.maxWidth=Ny[a.width],{vars:Object.entries(i).map(([p,f])=>`--sb-${p}:${f}`).join(";"),values:i,appearance:a}}var Zd,ky,Ey,Iy,Cy,eu,Ay,Ry,Ty,Qd,Ly,_y,Oy,Ny,zi=E(()=>{"use strict";Zd=["accent","cardBg","titleColor","bodyColor","backdrop","ctaText","couponBg","couponFg","couponBorder"],ky={accent:"#111827",cardBg:"#ffffff",titleColor:"#111827",bodyColor:"#111827",backdrop:"rgba(0,0,0,.28)",ctaText:"#ffffff",couponBg:"#ecfdf5",couponFg:"#065f46",couponBorder:"#10b981"},Ey={accent:"#8b7ff0",cardBg:"#1b1922",titleColor:"#edeaf2",bodyColor:"#edeaf2",backdrop:"rgba(0,0,0,.55)",ctaText:"#ffffff",couponBg:"#12241d",couponFg:"#7ee2bd",couponBorder:"#00c48c"},Iy={muted:"#6b7280",border:"#d1d5db",disabledBg:"#e5e7eb",disabledFg:"#9ca3af",fieldBg:"#ffffff"},Cy={muted:"#9a95a6",border:"rgba(255,255,255,.16)",disabledBg:"#2e2940",disabledFg:"#6b6578",fieldBg:"#262131"},eu=/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,Ay=/^rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*(?:,\s*(?:0|1|0?\.\d+)\s*)?\)$/i,Ry=/^hsla?\(\s*\d{1,3}(?:deg)?\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*(?:,\s*(?:0|1|0?\.\d+)\s*)?\)$/i,Ty=new Set(["transparent","black","white","red","green","blue","yellow","orange","purple","gray","grey","navy","teal","olive","maroon","silver","lime","aqua","fuchsia"]);Qd={separators:["none","line","card"],density:["compact","cosy","roomy"],radius:["sharp","soft","round"],width:["narrow","standard","wide"],position:["bottom","center","corner"]},Ly={separators:"none",density:"cosy",radius:"soft",width:"standard",position:"bottom"},_y={compact:{pad:"14px",gap:"9px",qGap:"10px"},cosy:{pad:"20px",gap:"14px",qGap:"14px"},roomy:{pad:"26px",gap:"18px",qGap:"22px"}},Oy={sharp:"4px",soft:"16px",round:"26px"},Ny={narrow:"340px",standard:"420px",wide:"540px"}});var ru=E(()=>{"use strict"});var Wi={};_(Wi,{CssomRecorder:()=>Vi,adoptedSheetId:()=>Cr});function Cr(n){let e=su.get(n);return e==null&&(e=Fy++,su.set(n,e)),e}function iu(n){try{return Array.from(n.cssRules).map(e=>e.cssText)}catch{return[]}}var su,Fy,Ui,Vi,Ar=E(()=>{"use strict";su=new WeakMap,Fy=1;Ui="__scalebun_cssom_patched__",Vi=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[Ui])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:iu(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:iu(this)})}),s}),e[Ui]=!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[Ui],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:Cr(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 Or={};_(Or,{MAX_INLINED_CSS_BYTES:()=>ou,NO_MASK_TEXT_PARENTS:()=>Tr,SENSITIVE_ATTRS:()=>Mr,UNRESOLVED_SHEET_ATTR:()=>au,absUrl:()=>He,absolutizeAttrValue:()=>_r,absolutizeCssUrls:()=>nn,absolutizeSrcset:()=>du,isMaskedSubtree:()=>Pr,isPasswordField:()=>At,maskSecret:()=>Rt,maskText:()=>Ge,resolveSnapshotOpts:()=>Ze,serializeNode:()=>Ye,serializeShadow:()=>Lr,takeSnapshot:()=>qy});function $y(n){let e=(n!=null?n:[]).filter(r=>typeof r=="string"&&r.trim()),t=e.length?`${ji},${e.join(",")}`:ji;try{return typeof document!="undefined"&&document.documentElement.matches(t),t}catch{return ji}}function Pr(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:$y(n.maskSelectors),cssBudget:{used:0}}}function qy(n,e,t={}){var r;return(r=Ye(n,e,Ze(t)))!=null?r:{t:"doc",id:e.add(n),children:[]}}function Ye(n,e,t){var r,s;switch(n.nodeType){case 9:{let o={t:"doc",id:e.add(n),children:Rr(n,e,t)},a=lu(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(zy(i))return Vy(i,e,t,t.cssBudget);let o=e.add(n),a=i.tagName.toLowerCase(),c=i.namespaceURI===Dy?"svg":i.namespaceURI===Hy?"math":void 0,l=a==="style"?Wy(i,e):Rr(a==="template"?i.content:i,e,t),u={t:"el",id:o,tag:a,attrs:cu(i,t),children:l};c&&(u.ns=c);let d=i.shadowRoot;return d&&(u.shadow=Lr(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||Pr(n.parentElement,t.maskSel))&&!Tr.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 Rr(n,e,t){let r=[];return n.childNodes.forEach(s=>{let i=Ye(s,e,t);i&&r.push(i)}),r}function zy(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 Uy(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 Vy(n,e,t,r){let s=e.add(n),i=Uy(n);if(i&&r.used+i.length<=ou){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"]=He(d,n.ownerDocument.baseURI)),{t:"el",id:s,tag:"style",attrs:l,children:[{t:"tx",id:e.add(c),value:a}]}}let o=cu(n,t);return o[au]=i?"budget":"cors",{t:"el",id:s,tag:"link",attrs:o,children:[]}}function Wy(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 At(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 cu(n,e){var i,o,a,c;let t={};for(let l of Array.from(n.attributes))t[l.name]=e.maskAllInputs&&Mr.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:"";At(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 Ky){let u=t[l];u!=null&&(t[l]=_r(l,u,r,s))}return t}function Lr(n,e,t){var a,c,l;let s={mode:"open",id:e.add(n),children:Rr(n,e,t)},i=(l=(c=(a=n.host)==null?void 0:a.ownerDocument)==null?void 0:c.baseURI)!=null?l:"",o=lu(n,i);return o.length&&(s.adoptedStyles=o),s}function lu(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:Cr(s),css:nn(i,e)})}catch{}return r}catch{return[]}}function Ge(n){return n.replace(/\S/g,"*")}function Rt(n){return"*".repeat(n.length)}function He(n,e){let t=n.trim();if(!t||!e||jy.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}${He(i,e)}${s})`);return t=t.replace(/@import\s+(['"])([^'"]+)\1/gi,(r,s,i)=>`@import ${s}${He(i,e)}${s}`),t}function _r(n,e,t,r){if(!e||!r)return e;switch(n){case"src":case"poster":return He(e,r);case"srcset":return du(e,r);case"style":return nn(e,r);case"href":return t==="link"||t==="use"||t==="image"?He(e,r):e;case"xlink:href":return t==="use"||t==="image"?He(e,r):e;case"data":return t==="object"?He(e,r):e;default:return e}}function du(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?He(r,e):He(r.slice(0,s),e)+r.slice(s)}).join(", ")}var Tr,Mr,Dy,Hy,ji,ou,au,jy,Ky,et=E(()=>{"use strict";Ar();Tr=new Set(["STYLE","SCRIPT"]),Mr=new Set(["value","placeholder","alt","title","aria-label","srcdoc"]),Dy="http://www.w3.org/2000/svg",Hy="http://www.w3.org/1998/Math/MathML",ji='[data-scalebun-mask],[contenteditable=""],[contenteditable="true"]';ou=2*1024*1024,au="data-scalebun-sheet-unresolved";jy=/^(?:[a-z][a-z0-9+.-]*:|\/\/|#)/i;Ky=["src","srcset","poster","style","href","xlink:href","data"]});var Nr={};_(Nr,{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 Ki={};_(Ki,{captureScreenshot:()=>Gy,startVoiceRecording:()=>Jy});async function Gy(n){if(typeof document=="undefined")return null;try{let[{takeSnapshot:e},{NodeRegistry:t}]=await Promise.all([Promise.resolve().then(()=>(et(),Or)),Promise.resolve().then(()=>(sn(),Nr))]),r=e(document,new t,{maskAllText:n,maskAllInputs:n});return{kind:"screenshot",blob:new Blob([JSON.stringify(r)],{type:pu}),contentType:pu,width:typeof window!="undefined"?window.innerWidth:void 0,height:typeof window!="undefined"?window.innerHeight:void 0,masked:n}}catch{return null}}function Xy(n){var t;let e=typeof MediaRecorder!="undefined"?MediaRecorder:void 0;if(!e)return null;for(let r of Yy)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 Jy(){var h,g,k;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=Xy(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),x=()=>{y.getFloatTimeDomainData(b);let S=0;for(let w=0;w<b.length;w++)S+=b[w]*b[w];o==null||o(Math.sqrt(S/b.length)),c=requestAnimationFrame(x)};c=requestAnimationFrame(x)}}catch{}let l="",u,d=(k=globalThis.SpeechRecognition)!=null?k: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,x="";for(let S=0;S<b.length;S++)x+=b[S][0].transcript;l=x,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 x=r||s[0].type||"audio/webm";v({kind:"voice",blob:new Blob(s,{type:x}),contentType:x,durationMs:b,transcript:l||void 0,transcriptApproved:!1})},t.state!=="inactive"?t.stop():(y=t.onstop)==null||y.call(t,new Event("stop"))})}}}var pu,Yy,Gi=E(()=>{"use strict";ru();pu="application/scalebun-snapshot+json";Yy=["audio/mp4;codecs=mp4a.40.2","audio/mp4","audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus",""]});function Qy(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 ev(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 fu(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=nu(n.style,{dark:s});t.setAttribute("dir",i?"rtl":"ltr");for(let[H,V]of Object.entries(o.appearance))t.setAttribute(`data-${H}`,V);document.body.appendChild(t);let a=Qy(n),c=new Map,l=!1,u=()=>{var H;l||(l=!0,(H=e.onStarted)==null||H.call(e))};Ne(r,`:host{${o.vars}}
11
- ${tv}`);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=ev(a),k=0,v=g.length-1,y=H=>c.has(H.key)||m.includes(H.kind),b=H=>{var V;return((V=g[H])!=null?V:[]).every(K=>K.required===!1?!0:y(K))},x=()=>{A.disabled=!b(k),A.textContent=k===v?"Submit":"Next",R.style.display=k>0?"":"none",w.textContent=g.length>1?`Page ${k+1} of ${g.length}`:""},S=()=>{var H,V;I.replaceChildren();for(let K of(H=g[k])!=null?H:[]){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),nv(de,K,se=>{c.set(K.key,se),u(),x()},se=>{se?h.set(K.key,se):h.delete(K.key),u(),x()},c.get(K.key)),I.appendChild(de)}x(),(V=I.querySelector("textarea, .opt, .emoji"))==null||V.focus()},w=document.createElement("div");w.className="pg",f.appendChild(w);let I=document.createElement("div");f.appendChild(I);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),S();let O=()=>{t.remove(),document.removeEventListener("keydown",fe)},z=()=>{e.onDismiss(),O()},D=typeof n.thankYouScreen=="string"?n.thankYouScreen.trim():"",te=()=>{if(e.onSubmit(rv(a,c,[...h.values()])),!D){O();return}f.remove();let H=document.createElement("div");H.className="thanks";let V=document.createElement("div");V.className="q",V.textContent=D,H.appendChild(V),p.appendChild(H),setTimeout(()=>d.addEventListener("click",O),0),setTimeout(O,2200)},J=()=>{if(k<v){k+=1,u(),S();return}te()},Q=()=>{k!==0&&(k-=1,S())},fe=H=>{H.key==="Escape"&&z()};M.addEventListener("click",z),A.addEventListener("click",J),R.addEventListener("click",Q),d.addEventListener("click",H=>{H.target===d&&z()}),document.addEventListener("keydown",fe);let ce=typeof n.startScreen=="string"?n.startScreen.trim():"",xe=()=>{var H;(H=I.querySelector("textarea, .opt, .emoji"))==null||H.focus()};if(ce){f.style.display="none";let H=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),H.append(V,K,de),p.insertBefore(H,f),me.addEventListener("click",z),se.addEventListener("click",()=>{H.remove(),f.style.display="",u(),xe()}),se.focus()}else xe();return{close:O}}function nv(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(()=>(Gi(),Ki)),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(()=>(Gi(),Ki));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=[];Zy.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 rv(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 Zy,tv,mu=E(()=>{"use strict";q();zi();Zy=["\u{1F621}","\u{1F641}","\u{1F610}","\u{1F642}","\u{1F60D}"];tv=`
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?Hd[g]:Hd.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 Hd,Py,zd=E(()=>{"use strict";$();Hd={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."},Py=2147483e3});var Zd={};_(Zd,{normalizeConfig:()=>_i});function Xd(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 Yd(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 Jd(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 $y(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||!Hy.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 zy(n){let e=_e(n),t=U(e.label),r=U(e.action);if(!(!t||!r||!qy.has(r)))return Ke({label:t,action:r,deepLink:U(e.deepLink)})}function Qd(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:zy(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 Uy(n){let e=_e(n);if(!("enabled"in e)&&!("variantB"in e)&&!("split"in e))return;let t=Qd(e.variantB);return Ke({enabled:dt(e.enabled),split:Ie(e.split),variantB:t!=null?t:void 0})}function Vy(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:$y(e.questions),scale:Ie(e.scale),trigger:U(e.trigger),targetScreen:U(e.targetScreen),triggerConfig:Yd(e.triggerConfig),targeting:Jd(e.targeting),throttle:Xd(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 Wy(n){let e=_e(n),t=U(e.id),r=Qd(e.spec);if(!t||!r)return null;let s=U(e.layout);return Ke({id:t,layout:s&&Dy.includes(s)?s:"modal",trigger:U(e.trigger),delaySeconds:Ie(e.delaySeconds),targetScreen:U(e.targetScreen),triggerConfig:Yd(e.triggerConfig),targeting:Jd(e.targeting),throttle:Xd(e.throttle),spec:r,revision:U(e.revision),experiment:Uy(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(Vy).filter(s=>s!==null),inAppMessages:Pi(e.inAppMessages).map(Wy).filter(s=>s!==null)}}var _e,Pi,U,Ie,dt,Li,Ke,Dy,qy,Hy,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},Dy=["modal","fullscreen","bottom_sheet","top_banner","bottom_banner","tooltip","toast"],qy=new Set(["dismiss","link","custom"]),Hy=new Set(["scale","text","single","multi","emoji","boolean","screenshot","voice"])});var jy,en,eu=E(()=>{"use strict";jy={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=jy[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 au={};_(au,{clearEngageState:()=>Yy,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(nu(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 ru(n,e){let t=tn();if(t)try{t.setItem(nu(n),JSON.stringify(e))}catch{}}function su(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 iu(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 Gy(n){let e=Fi();if(e)try{e.setItem(Bi,JSON.stringify(n))}catch{}}function ou(n,e){let t=iu(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=su(n);if(s.completed)return!1;let i=(o=r==null?void 0:r.maxImpressionsPerSession)!=null?o:r?0:Ky;return i>0&&ou(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=su(n);ru(n.id,{impressions:r.impressions+1,lastShownAt:e,completed:r.completed,revision:n.revision});let s=iu(t);s.counts[n.id]={n:ou(n,t)+1,rev:n.revision},Gy(s)}function Ar(n){var t;let e=Ni(n.id);ru(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>Xy;)r.shift();e.setItem(Er,JSON.stringify(r))}catch{}}function Yy(){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(tu)||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 tu,nu,kr,Ky,Bi,Er,Xy,Hi=E(()=>{"use strict";tu="scalebun_engage_throttle:";nu=n=>`${tu}${n}`,kr={impressions:0,lastShownAt:0,completed:!1};Ky=1,Bi="scalebun_engage_session_shows";Er="scalebun_engage_test_seen",Xy=50});function uu(n){if(typeof n!="string")return!1;let e=n.trim();return!e||e.length>32?!1:du.test(e)||tv.test(e)||nv.test(e)||rv.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(!lu.includes(s)){e.keepUnknown&&typeof r[s]=="string"&&(t[s]=r[s]);continue}uu(r[s])&&(t[s]=r[s].trim())}return t}function sv(n){let e=iv(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 iv(n){let e=n.trim();if(du.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&&uu(e))return e;let t=sv(n);return t==null?"#ffffff":t>.55?"#111827":"#ffffff"}function dv(n){let e={};if(!n||typeof n!="object"||Array.isArray(n))return e;let t=n;for(let r of Object.keys(cu)){let s=t[r];typeof s=="string"&&cu[r].includes(s)&&(e[r]=s)}return e}function pu(n,e={}){var u,d;let t=e.dark?Qy:Jy,r=e.dark?ev:Zy,s=$i(n),i={};for(let p of lu)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={...ov,...dv(n)},c=av[a.density];return i.pad=c.pad,i.gap=c.gap,i.qGap=c.qGap,i.radius=cv[a.radius],i.maxWidth=lv[a.width],{vars:Object.entries(i).map(([p,f])=>`--sb-${p}:${f}`).join(";"),values:i,appearance:a}}var lu,Jy,Qy,Zy,ev,du,tv,nv,rv,cu,ov,av,cv,lv,Ui=E(()=>{"use strict";lu=["accent","cardBg","titleColor","bodyColor","backdrop","ctaText","couponBg","couponFg","couponBorder"],Jy={accent:"#111827",cardBg:"#ffffff",titleColor:"#111827",bodyColor:"#111827",backdrop:"rgba(0,0,0,.28)",ctaText:"#ffffff",couponBg:"#ecfdf5",couponFg:"#065f46",couponBorder:"#10b981"},Qy={accent:"#8b7ff0",cardBg:"#1b1922",titleColor:"#edeaf2",bodyColor:"#edeaf2",backdrop:"rgba(0,0,0,.55)",ctaText:"#ffffff",couponBg:"#12241d",couponFg:"#7ee2bd",couponBorder:"#00c48c"},Zy={muted:"#6b7280",border:"#d1d5db",disabledBg:"#e5e7eb",disabledFg:"#9ca3af",fieldBg:"#ffffff"},ev={muted:"#9a95a6",border:"rgba(255,255,255,.16)",disabledBg:"#2e2940",disabledFg:"#6b6578",fieldBg:"#262131"},du=/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,tv=/^rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*(?:,\s*(?:0|1|0?\.\d+)\s*)?\)$/i,nv=/^hsla?\(\s*\d{1,3}(?:deg)?\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*(?:,\s*(?:0|1|0?\.\d+)\s*)?\)$/i,rv=new Set(["transparent","black","white","red","green","blue","yellow","orange","purple","gray","grey","navy","teal","olive","maroon","silver","lime","aqua","fuchsia"]);cu={separators:["none","line","card"],density:["compact","cosy","roomy"],radius:["sharp","soft","round"],width:["narrow","standard","wide"],position:["bottom","center","corner"]},ov={separators:"none",density:"cosy",radius:"soft",width:"standard",position:"bottom"},av={compact:{pad:"14px",gap:"9px",qGap:"10px"},cosy:{pad:"20px",gap:"14px",qGap:"14px"},roomy:{pad:"26px",gap:"18px",qGap:"22px"}},cv={sharp:"4px",soft:"16px",round:"26px"},lv={narrow:"340px",standard:"420px",wide:"540px"}});var fu=E(()=>{"use strict"});var ji={};_(ji,{CssomRecorder:()=>Wi,adoptedSheetId:()=>Tr});function Tr(n){let e=mu.get(n);return e==null&&(e=uv++,mu.set(n,e)),e}function hu(n){try{return Array.from(n.cssRules).map(e=>e.cssText)}catch{return[]}}var mu,uv,Vi,Wi,Rr=E(()=>{"use strict";mu=new WeakMap,uv=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:hu(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:hu(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: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={};_(Br,{MAX_INLINED_CSS_BYTES:()=>gu,NO_MASK_TEXT_PARENTS:()=>Pr,SENSITIVE_ATTRS:()=>Lr,UNRESOLVED_SHEET_ATTR:()=>bu,absUrl:()=>qe,absolutizeAttrValue:()=>Nr,absolutizeCssUrls:()=>nn,absolutizeSrcset:()=>wu,isMaskedSubtree:()=>_r,isPasswordField:()=>Tt,maskSecret:()=>Rt,maskText:()=>Ge,resolveSnapshotOpts:()=>Ze,serializeNode:()=>Xe,serializeShadow:()=>Or,takeSnapshot:()=>hv});function mv(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:mv(n.maskSelectors),cssBudget:{used:0}}}function hv(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=vu(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(gv(i))return yv(i,e,t,t.cssBudget);let o=e.add(n),a=i.tagName.toLowerCase(),c=i.namespaceURI===pv?"svg":i.namespaceURI===fv?"math":void 0,l=a==="style"?vv(i,e):Mr(a==="template"?i.content:i,e,t),u={t:"el",id:o,tag:a,attrs:yu(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 gv(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 bv(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 yv(n,e,t,r){let s=e.add(n),i=bv(n);if(i&&r.used+i.length<=gu){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=yu(n,t);return o[bu]=i?"budget":"cors",{t:"el",id:s,tag:"link",attrs:o,children:[]}}function vv(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 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 yu(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 xv){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=vu(n,i);return o.length&&(s.adoptedStyles=o),s}function vu(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:nn(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||wv.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 wu(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 wu(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,pv,fv,Ki,gu,bu,wv,xv,et=E(()=>{"use strict";Rr();Pr=new Set(["STYLE","SCRIPT"]),Lr=new Set(["value","placeholder","alt","title","aria-label","srcdoc"]),pv="http://www.w3.org/2000/svg",fv="http://www.w3.org/1998/Math/MathML",Ki='[data-scalebun-mask],[contenteditable=""],[contenteditable="true"]';gu=2*1024*1024,bu="data-scalebun-sheet-unresolved";wv=/^(?:[a-z][a-z0-9+.-]*:|\/\/|#)/i;xv=["src","srcset","poster","style","href","xlink:href","data"]});var Fr={};_(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={};_(Gi,{captureScreenshot:()=>Sv,startVoiceRecording:()=>Iv});async function Sv(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:Su}),contentType:Su,width:typeof window!="undefined"?window.innerWidth:void 0,height:typeof window!="undefined"?window.innerHeight:void 0,masked:n}}catch{return null}}function Ev(n){var t;let e=typeof MediaRecorder!="undefined"?MediaRecorder:void 0;if(!e)return null;for(let r of kv)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 Iv(){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=Ev(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 Su,kv,Xi=E(()=>{"use strict";fu();Su="application/scalebun-snapshot+json";kv=["audio/mp4;codecs=mp4a.40.2","audio/mp4","audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus",""]});function Cv(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 Tv(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 ku(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=pu(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=Cv(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
+ ${Rv}`);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=Tv(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",T.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),Mv(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 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),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(Pv(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),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=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 Mv(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=[];Av.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 Pv(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 Av,Rv,Eu=E(()=>{"use strict";$();Ui();Av=["\u{1F621}","\u{1F641}","\u{1F610}","\u{1F642}","\u{1F60D}"];Rv=`
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 iv(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,x,S,w,I;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=(S=(x=e.style)==null?void 0:x.text)!=null?S:i?"#f9fafb":"#111827",c=(I=(w=e.style)==null?void 0:w.accent)!=null?I:"#111827",l=sv.includes(n),u=yt(document.createElement("style"));u.textContent=`
73
+ `});function _v(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=Lv.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,20 @@ 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
- ${iv(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 k=document.createElement("div");if(k.className="b",k.textContent=e.body,p.appendChild(k),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 sv,hu=E(()=>{"use strict";q();sv=["modal","fullscreen","bottom_sheet"]});function Xi(n){return typeof n=="string"&&Object.prototype.hasOwnProperty.call(gu,n)}function bu(n){return Xi(n)?gu[n]:null}function yu(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 vu(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 Ji(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 wu(n,e){var a,c,l,u,d,p,f,m,h,g,k,v,y,b,x,S,w,I,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((x=(b=(y=(v=(k=t.outcomeId)!=null?k:t.resultId)!=null?v:t.winningId)!=null?y:t.segmentId)!=null?b:r.id)!=null?x: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=(I=(w=(S=t.winningId)!=null?S:t.segmentId)!=null?w:r.segmentId)!=null?I: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 Ji(n,{attemptId:n.attemptId,status:"resolved",outcome:o})}function xu(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 gu,ut,be,Qi=E(()=>{"use strict";gu={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 ku(n){if(!Xi(n.variantKey))return null;let e=n.variantKey,t=new Map;return async(r,s)=>{try{let i=ov(n.ext.gameKey);if(!n.preview&&!i)return{ok:!1,message:"This game is not configured.",retryable:!1};let o=vu({campaignId:n.campaignId,gameKey:i||`preview:${e}`,variantKey:e,attemptId:xu(t,e,r,()=>av+=1),attempt:r,...s?{payload:s}:{},allowedOutcomeIds:yu(n.ext)});if(n.preview){let a=wu(o,n.ext);return a?Su(a):{ok:!1,message:"No preview outcome is configured for this campaign.",retryable:!1}}return n.handler?Su(Ji(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 Su(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 ov,av,Eu=E(()=>{"use strict";Qi();ov=n=>typeof n=="string"?n.trim():"",av=0});var Tt,Zi=E(()=>{"use strict";Tt=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 Iu={};_(Iu,{engageSlots:()=>Mt,hasInAppSlot:()=>eo,registerInAppSlot:()=>cv,slotNameFor:()=>Br});function cv(n,e){return!n||!e?()=>{}:(Mt.register(n,e),()=>Mt.unregister(n))}function Br(n){var t;let e=(t=n.placementKey)!=null?t:n.slot;return typeof e=="string"&&e?e:void 0}function eo(n){let e=Br(n);return!!e&&!!Mt.get(e)}var Mt,to=E(()=>{"use strict";Zi();Mt=new Tt});function Pt(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)==="right"?"side-right":"side-left":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"}`:mv[n.surface]}function gv(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||!hv.test(n.id))&&t("id","missing or malformed id"),n.key||t("key","missing key"),dv.includes(n.surface)||t("surface",`unknown surface "${n.surface}"`),uv.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)lv.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||!fv.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||!pv.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 Cu(n){return gv(n).length===0}var lv,dv,uv,pv,fv,mv,no,ro,hv,Fr=E(()=>{"use strict";lv=["web","ios","android"],dv=["modal","slideover","panel","popover","coachmark","tour","hotspot","inline","banner","toast","center","launcher","palette","checklist","takeover","toolbar"],uv=["critical","high","normal","low","passive"],pv=["manual","route","event","idle","element","hover","selection","keyboard","right-click","schedule","no-data","exit-intent"],fv=["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"],mv={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"},no={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"},ro={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};hv=/^[a-z0-9][a-z0-9_-]*$/i});var Dr,so=E(()=>{"use strict";Dr=`
90
+ ${_v(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 Lv,Iu=E(()=>{"use strict";$();Lv=["modal","fullscreen","bottom_sheet"]});function Ji(n){return typeof n=="string"&&Object.prototype.hasOwnProperty.call(Cu,n)}function Au(n){return Ji(n)?Cu[n]:null}function Tu(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 Ru(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 Mu(n,e){var a,c,l,u,d,p,f,m,h,g,S,v,y,b,w,x,I,k,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((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((T=(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?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 Qi(n,{attemptId:n.attemptId,status:"resolved",outcome:o})}function Pu(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 Cu,ut,be,Zi=E(()=>{"use strict";Cu={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 _u(n){if(!Ji(n.variantKey))return null;let e=n.variantKey,t=new Map;return async(r,s)=>{try{let i=Ov(n.ext.gameKey);if(!n.preview&&!i)return{ok:!1,message:"This game is not configured.",retryable:!1};let o=Ru({campaignId:n.campaignId,gameKey:i||`preview:${e}`,variantKey:e,attemptId:Pu(t,e,r,()=>Nv+=1),attempt:r,...s?{payload:s}:{},allowedOutcomeIds:Tu(n.ext)});if(n.preview){let a=Mu(o,n.ext);return a?Lu(a):{ok:!1,message:"No preview outcome is configured for this campaign.",retryable:!1}}return n.handler?Lu(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 Lu(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 Ov,Nv,Ou=E(()=>{"use strict";Zi();Ov=n=>typeof n=="string"?n.trim():"",Nv=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 Nu={};_(Nu,{engageSlots:()=>Pt,hasInAppSlot:()=>to,registerInAppSlot:()=>Bv,slotNameFor:()=>Dr});function Bv(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)==="right"?"side-right":"side-left":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"}`:zv[n.surface]}function Vv(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||!Uv.test(n.id))&&t("id","missing or malformed id"),n.key||t("key","missing key"),Dv.includes(n.surface)||t("surface",`unknown surface "${n.surface}"`),qv.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)Fv.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||!$v.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||!Hv.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 Bu(n){return Vv(n).length===0}var Fv,Dv,qv,Hv,$v,zv,ro,so,Uv,qr=E(()=>{"use strict";Fv=["web","ios","android"],Dv=["modal","slideover","panel","popover","coachmark","tour","hotspot","inline","banner","toast","center","launcher","palette","checklist","takeover","toolbar"],qv=["critical","high","normal","low","passive"],Hv=["manual","route","event","idle","element","hover","selection","keyboard","right-click","schedule","no-data","exit-intent"],$v=["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"],zv={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};Uv=/^[a-z0-9][a-z0-9_-]*$/i});var Hr,io=E(()=>{"use strict";Hr=`
91
+ /* Text must be BREAKABLE. Real in-app copy carries runs with no space in them \u2014 a support URL, a
92
+ deploy hash, a pasted id, a German compound \u2014 and nothing here could break one, so it ran
93
+ straight out of its container. Sweeping the catalog with a single long URL took the count from 6
94
+ variants to 86 of 100, on every surface at once; it was invisible only because the catalog writes
95
+ its own short copy. overflow-wrap:anywhere over break-word on purpose: it also shrinks the box's
96
+ min-content width, which is what stops a panel being forced wider than the viewport and pushing
97
+ the whole page sideways. */
98
+ .scalebun-h, .scalebun-text, .scalebun-rich, .scalebun-list, .scalebun-callout,
99
+ .scalebun-checklist-item, .scalebun-checklist-label, .scalebun-steps-title, .scalebun-steps-body,
100
+ .scalebun-md-h, .scalebun-md-p, .scalebun-md-ul, .scalebun-stat-value, .scalebun-stat-label,
101
+ .scalebun-poll-q, .scalebun-poll-opt, .scalebun-quiz-opt,
102
+ .scalebun-table th, .scalebun-table td{ overflow-wrap:anywhere; min-width:0; }
103
+
91
104
  .scalebun-h{ font-size:17px; font-weight:700; margin:0 0 6px; color:var(--scalebun-fg); }
92
105
  .scalebun-text{ font-size:14px; line-height:1.5; margin:0 0 6px; color:var(--scalebun-fg); }
93
106
  .scalebun-rich{ font-size:14px; line-height:1.5; color:var(--scalebun-fg); }
@@ -102,9 +115,23 @@ ${iv(n)}`,s.appendChild(u);let d=document.createElement("div");d.className="ov";
102
115
  .scalebun-progress{ height:8px; border-radius:4px; background:color-mix(in srgb, var(--scalebun-fg) 10%, transparent); overflow:hidden; margin:8px 0; }
103
116
  .scalebun-progress-fill{ height:100%; background:var(--scalebun-accent); border-radius:4px; transition:width .3s ease; }
104
117
  .scalebun-spacer{ height:8px; }
118
+ /* The row already wraps between buttons; what it could not do is let a SINGLE button be narrower
119
+ than its own label. A button is a flex item, and a flex item's min-width defaults to its content,
120
+ so one long label pushed the row past the card edge no matter how much room the row had to wrap
121
+ into. min-width:0 plus a breakable label is what lets an over-long action fit the surface instead
122
+ of widening it \u2014 80 of the clipped findings were this one row. */
123
+ /* NO min-width:0 on the row. Adding it let the banner's flex layout squeeze the row to ~40px, and
124
+ overflow-wrap:anywhere on the button then split "OK" into "O" over "K". The row keeps its
125
+ automatic minimum so a CTA cannot be crushed by the text beside it; the banner's .scalebun-body
126
+ carries min-width:0 and absorbs the squeeze instead, which is the right priority \u2014 the button is
127
+ the part that has to stay clickable and readable. */
105
128
  .scalebun-cta-row{ display:flex; gap:8px; flex-wrap:wrap; margin-top:10px; }
129
+ /* The floor must NOT be relative: min(100%, 5em) resolves 100% against the already-squeezed row, so
130
+ it evaluated to the squeezed width and provided no floor whatsoever (measured: still 31px). An
131
+ absolute floor is what actually holds, and it also gives the row a real min-content width \u2014
132
+ overflow-wrap:anywhere would otherwise let the row's minimum collapse to one character. */
106
133
  .scalebun-btn{ font:inherit; font-size:13.5px; font-weight:600; border-radius:8px; padding:8px 14px; cursor:pointer;
107
- border:1px solid transparent; transition:filter .12s ease; }
134
+ border:1px solid transparent; transition:filter .12s ease; min-width:5em; max-width:100%; overflow-wrap:anywhere; }
108
135
  .scalebun-btn:hover{ filter:brightness(1.06); }
109
136
  .scalebun-btn:focus-visible{ outline:2px solid var(--scalebun-accent); outline-offset:2px; }
110
137
  .scalebun-btn-primary{ background:var(--scalebun-accent); color:var(--scalebun-accent-fg); }
@@ -151,9 +178,9 @@ ${iv(n)}`,s.appendChild(u);let d=document.createElement("div");d.className="ov";
151
178
  .scalebun-md code, .scalebun-code code{ font-family:ui-monospace,SFMono-Regular,Menlo,monospace; }
152
179
  .scalebun-md code{ background:color-mix(in srgb, var(--scalebun-fg) 8%, transparent); padding:1px 5px; border-radius:5px; font-size:12.5px; }
153
180
  .scalebun-code{ border:1px solid var(--scalebun-border); border-radius:10px; overflow:hidden; margin:0 0 8px; }
154
- .scalebun-code-bar{ display:flex; align-items:center; justify-content:space-between; padding:6px 10px;
181
+ .scalebun-code-bar{ display:flex; align-items:center; justify-content:space-between; gap:8px; min-width:0; padding:6px 10px;
155
182
  background:color-mix(in srgb, var(--scalebun-fg) 6%, transparent); border-bottom:1px solid var(--scalebun-border); }
156
- .scalebun-code-lang{ font-size:11px; color:var(--scalebun-muted); text-transform:uppercase; letter-spacing:.04em; }
183
+ .scalebun-code-lang{ overflow-wrap:anywhere; min-width:0; font-size:11px; color:var(--scalebun-muted); text-transform:uppercase; letter-spacing:.04em; }
157
184
  .scalebun-code-copy{ background:none; border:0; color:var(--scalebun-accent); cursor:pointer; font:inherit; font-size:11.5px; }
158
185
  .scalebun-code-pre{ margin:0; padding:12px; overflow-x:auto; font-size:12.5px; line-height:1.5; }
159
186
  .scalebun-stat{ display:inline-flex; flex-direction:column; }
@@ -278,7 +305,7 @@ ${iv(n)}`,s.appendChild(u);let d=document.createElement("div");d.className="ov";
278
305
  .scalebun-poll-pct{ position:relative; z-index:1; font-size:12px; color:var(--scalebun-muted); }
279
306
  .scalebun-quiz-opt.correct{ border-color:#2fa96b; background:color-mix(in srgb, #2fa96b 14%, transparent); }
280
307
  .scalebun-quiz-opt.incorrect{ border-color:#e0483d; background:color-mix(in srgb, #e0483d 14%, transparent); }
281
- `});var Au,Ru=E(()=>{"use strict";Au=`
308
+ `});var Fu,Du=E(()=>{"use strict";Fu=`
282
309
  /* shared close button */
283
310
  .scalebun-x{ background:none; border:0; color:var(--scalebun-muted); cursor:pointer; font-size:16px; line-height:1;
284
311
  padding:4px 6px; border-radius:6px; }
@@ -291,11 +318,16 @@ ${iv(n)}`,s.appendChild(u);let d=document.createElement("div");d.className="ov";
291
318
  The reduced-motion rule in host.ts is marked important and still wins over anything set here. */
292
319
 
293
320
  /* S9 \u2014 banner */
294
- .scalebun-banner{ display:flex; align-items:center; gap:12px; padding:10px 16px;
321
+ /* WRAPS rather than overflows. A banner carrying a heading, body, a stat and a CTA measures 407px of
322
+ content, so on any phone it ran past the screen edge and took the page's horizontal scroll with it
323
+ \u2014 the one remaining defect that reproduced with the catalog's OWN copy, not stressed content.
324
+ Wrapping to a second row was chosen over dropping the stat or scrolling horizontally: nothing is
325
+ lost, and a banner is already variable-height, so no other surface has to change to allow it. */
326
+ .scalebun-banner{ display:flex; align-items:center; gap:12px; padding:10px 16px; flex-wrap:wrap;
295
327
  background:var(--scalebun-bg); color:var(--scalebun-fg); border-bottom:1px solid var(--scalebun-border);
296
328
  box-shadow:var(--scalebun-shadow); animation:var(--scalebun-anim-in, scalebun-slidedown .18s ease); }
297
329
  .scalebun-banner-bottom{ border-bottom:0; border-top:1px solid var(--scalebun-border); animation:var(--scalebun-anim-in, scalebun-slideup .18s ease); }
298
- .scalebun-banner .scalebun-body{ flex:1; display:flex; align-items:center; gap:12px; min-width:0; }
330
+ .scalebun-banner .scalebun-body{ flex:1; display:flex; align-items:center; gap:12px; min-width:0; flex-wrap:wrap; }
299
331
  .scalebun-banner .scalebun-body>*{ margin:0; }
300
332
  .scalebun-banner .scalebun-cta-row{ margin:0; }
301
333
  @keyframes scalebun-slidedown{ from{ transform:translateY(-100%); } to{ transform:none; } }
@@ -319,7 +351,7 @@ ${iv(n)}`,s.appendChild(u);let d=document.createElement("div");d.className="ov";
319
351
  .scalebun-modal-card[data-size="md"]{ max-width:460px; }
320
352
  .scalebun-modal-card[data-size="lg"]{ max-width:620px; }
321
353
  .scalebun-modal-card[data-size="xl"]{ max-width:820px; }
322
- .scalebun-modal-x{ position:absolute; top:10px; right:10px; }
354
+ .scalebun-modal-x{ position:absolute; top:10px; inset-inline-end:10px; }
323
355
  @keyframes scalebun-fade{ from{ opacity:0; } to{ opacity:1; } }
324
356
  @keyframes scalebun-pop{ from{ transform:scale(.96); opacity:0; } to{ transform:none; opacity:1; } }
325
357
 
@@ -355,7 +387,24 @@ ${iv(n)}`,s.appendChild(u);let d=document.createElement("div");d.className="ov";
355
387
  border-radius:var(--scalebun-radius); box-shadow:var(--scalebun-shadow); padding:14px 16px; max-width:320px;
356
388
  animation:scalebun-pop .14s ease; }
357
389
  .scalebun-pop-body>*:last-child{ margin-bottom:0; }
358
- .scalebun-pop-x{ position:absolute; top:6px; right:6px; }
390
+ .scalebun-pop-x{ position:absolute; top:6px; inset-inline-end:6px; }
391
+ /* A close button is out of flow, so nothing stops a heading running underneath it \u2014 the \xD7 then
392
+ lands on a word of the title. Reserving the space is the same thing .scalebun-toolbar-callout
393
+ already did with its right padding. Every surface that pairs an absolute \xD7 with a heading needs
394
+ it, which the stressed sweep put at nine of them, not the three the authored copy revealed.
395
+
396
+ LOGICAL, not physical. This was padding-right, correct only while text runs left-to-right: in
397
+ RTL a line ENDS on the left and STARTS under the close button, so the reserved gap sat on the
398
+ side the text was leaving and the \xD7 landed on the first word instead of the last. The buttons
399
+ use inset-inline-end for the same reason. Caught by sweeping the catalog in Arabic. */
400
+ .scalebun-popover .scalebun-h,
401
+ .scalebun-coachmark .scalebun-h,
402
+ .scalebun-modal-card .scalebun-h,
403
+ .scalebun-inline .scalebun-h,
404
+ .scalebun-toast .scalebun-h,
405
+ .scalebun-banner .scalebun-h,
406
+ .scalebun-takeover-inner .scalebun-h,
407
+ .scalebun-toolbar-callout .scalebun-h{ padding-inline-end:24px; }
359
408
 
360
409
  /* S5 \u2014 coachmark + spotlight */
361
410
  .scalebun-coach-spot{ position:fixed; border-radius:8px; box-shadow:0 0 0 9999px rgba(12,10,20,.55);
@@ -364,12 +413,29 @@ ${iv(n)}`,s.appendChild(u);let d=document.createElement("div");d.className="ov";
364
413
  border:1px solid var(--scalebun-border); border-radius:var(--scalebun-radius); box-shadow:var(--scalebun-shadow);
365
414
  padding:14px 16px; max-width:300px; animation:scalebun-pop .14s ease; }
366
415
 
367
- /* S6 \u2014 product tour */
368
- .scalebun-tour-card{ max-width:320px; }
369
- .scalebun-tour-center{ top:50%; left:50%; transform:translate(-50%,-50%); }
370
- .scalebun-tour-nav{ display:flex; align-items:center; justify-content:space-between; gap:10px; margin-top:14px; }
371
- .scalebun-tour-prog{ font-size:11.5px; color:var(--scalebun-muted); font-variant-numeric:tabular-nums; }
372
- .scalebun-tour-btns{ display:flex; gap:6px; }
416
+ /* S6 \u2014 product tour. The same three phone-only defects fixed in coach/overlay.ts, which carries the
417
+ full reasoning: width is EXPLICIT because a fixed box with left:50% and no width shrink-wraps to
418
+ half the viewport; the heading reserves the space .scalebun-pop-x is absolutely positioned in; and
419
+ the nav's items are flex:none so an overflowing footer wraps intact instead of collapsing the
420
+ progress counter into a one-character column. */
421
+ .scalebun-tour-card{ width:min(320px, calc(100vw - 32px)); }
422
+ .scalebun-tour-card .scalebun-h{ padding-right:20px; }
423
+ /* Centred by transform, and ANIMATED by transform \u2014 so the entrance clobbered the centring.
424
+ .scalebun-coachmark carries animation:scalebun-pop, whose keyframes set transform:scale(.96) then
425
+ transform:none. An animated property REPLACES the declared one for the whole run, so for the
426
+ animation's 140ms this card was drawn at left:50%/top:50% with NO translate \u2014 sitting half its own
427
+ width down and to the right \u2014 then snapped into place when the animation finished. That is the
428
+ visible jump on opening a tour and on every Next.
429
+ The fix keeps the translate inside the keyframes so the centring survives the run. The individual
430
+ translate property would be tidier, but it silently breaks centring where unsupported, and a card
431
+ that never centres is worse than one that briefly animates. */
432
+ .scalebun-tour-center{ top:50%; left:50%; transform:translate(-50%,-50%); animation-name:scalebun-pop-center; }
433
+ @keyframes scalebun-pop-center{
434
+ from{ transform:translate(-50%,-50%) scale(.96); opacity:0; }
435
+ to{ transform:translate(-50%,-50%); opacity:1; } }
436
+ .scalebun-tour-nav{ display:flex; align-items:center; justify-content:space-between; gap:10px; margin-top:14px; flex-wrap:wrap; }
437
+ .scalebun-tour-prog{ font-size:11.5px; color:var(--scalebun-muted); font-variant-numeric:tabular-nums; flex:none; white-space:nowrap; }
438
+ .scalebun-tour-btns{ display:flex; gap:6px; flex:none; }
373
439
  .scalebun-tour-btns .scalebun-btn{ padding:6px 12px; font-size:12.5px; }
374
440
 
375
441
  /* S7 \u2014 hotspot / beacon */
@@ -403,6 +469,16 @@ ${iv(n)}`,s.appendChild(u);let d=document.createElement("div");d.className="ov";
403
469
  .scalebun-palette-hint{ font-size:11.5px; opacity:.7; }
404
470
  .scalebun-palette-empty{ padding:16px; text-align:center; color:var(--scalebun-muted); font-size:13px; }
405
471
 
472
+ /* Every flex ROW below holds text, and a flex item's min-width defaults to its CONTENT \u2014 so a single
473
+ unbreakable run (a support URL, a deploy hash) forces the row wider than the surface that contains
474
+ it, no matter that the text itself is allowed to wrap. This is the same defect already fixed on
475
+ .scalebun-cta-row; these are the remaining rows, and between them they were 84 of the sweep's last
476
+ 112 findings. The text children already carry overflow-wrap from BLOCKS_CSS \u2014 this is what lets
477
+ them actually use it. */
478
+ .scalebun-panel-head, .scalebun-panel-title, .scalebun-cl-head, .scalebun-cl-title,
479
+ .scalebun-cl-item, .scalebun-cl-label, .scalebun-palette-item, .scalebun-code-bar,
480
+ .scalebun-code-lang, .scalebun-code-copy{ min-width:0; overflow-wrap:anywhere; }
481
+
406
482
  /* S3 \u2014 docked panel + AI shell */
407
483
  .scalebun-panel{ position:absolute; top:0; bottom:0; width:360px; display:flex; flex-direction:column;
408
484
  background:var(--scalebun-bg); color:var(--scalebun-fg); box-shadow:var(--scalebun-shadow); }
@@ -444,7 +520,7 @@ ${iv(n)}`,s.appendChild(u);let d=document.createElement("div");d.className="ov";
444
520
  .scalebun-takeover{ position:absolute; inset:0; display:flex; align-items:center; justify-content:center; pointer-events:auto;
445
521
  background:var(--scalebun-bg); color:var(--scalebun-fg); padding:32px; overflow:auto; animation:var(--scalebun-anim-in, scalebun-fade .2s ease); }
446
522
  .scalebun-takeover-inner{ position:relative; max-width:640px; width:100%; text-align:center; }
447
- .scalebun-takeover-x{ position:absolute; top:-8px; right:-8px; }
523
+ .scalebun-takeover-x{ position:absolute; top:-8px; inset-inline-end:-8px; }
448
524
 
449
525
  /* S12 \u2014 floating launcher */
450
526
  .scalebun-launcher{ position:absolute; bottom:0; right:0; display:flex; flex-direction:column; align-items:flex-end; gap:10px; }
@@ -457,9 +533,9 @@ ${iv(n)}`,s.appendChild(u);let d=document.createElement("div");d.className="ov";
457
533
  .scalebun-launcher-item{ text-align:left; background:none; border:0; color:var(--scalebun-fg); cursor:pointer; font:inherit;
458
534
  font-size:13.5px; padding:9px 12px; border-radius:8px; }
459
535
  .scalebun-launcher-item:hover{ background:color-mix(in srgb, var(--scalebun-fg) 7%, transparent); }
460
- `});var Tu,io,Mu,Pu,Lu,_u,Ou,Nu,Bu=E(()=>{"use strict";Tu=(n,e="")=>typeof n=="string"?n:n==null?e:String(n),io=n=>Array.isArray(n)?n:[],Mu=n=>io(n).map(e=>typeof e=="string"?{id:e,label:e}:e),Pu=(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},Lu=(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},_u=(n,e)=>{var s,i;let t=io((s=n.props)==null?void 0:s.emojis).length?io((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},Ou=(n,e)=>{var o,a,c,l,u;let t=e.doc.createElement("div");t.className="scalebun-poll";let r=Tu((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 Mu((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},Nu=(n,e)=>{var c,l,u;let t=e.doc.createElement("div");t.className="scalebun-quiz";let r=Tu((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 Mu((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,k;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=(k=m.state)!=null?k:{};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 Du(n,e,t){e.split(`
461
- `).forEach((s,i)=>{i>0&&n.appendChild(t.createElement("br")),n.appendChild(t.createTextNode(s))})}function $r(n,e){let t=[];for(let r of n){let s=Hr[r.kind];if(s)try{let i=s(r,e);i&&t.push(i)}catch{}}return t}var ye,ve,bv,yv,vv,Fu,wv,xv,Sv,kv,Ev,Iv,Cv,Av,Rv,Hr,qr=E(()=>{"use strict";Bu();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},bv=(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},yv=(n,e)=>{var r;let t=ve(e.doc,"p","scalebun-text");return Du(t,ye((r=n.props)==null?void 0:r.text),e.doc),t},vv=(n,e)=>{var r,s,i;let t=ve(e.doc,"div","scalebun-rich");return Du(t,ye((i=(r=n.props)==null?void 0:r.text)!=null?i:(s=n.props)==null?void 0:s.markdown),e.doc),t},Fu=(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},wv=(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},xv=(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},Sv=(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},kv=(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},Ev=(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},Iv=(n,e)=>ve(e.doc,"hr","scalebun-divider"),Cv=(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},Av=new Set(["primary","secondary","link","ghost","dismiss"]),Rv=(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=Av.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},Hr={heading:bv,text:yv,richtext:vv,image:Fu,illustration:Fu,list:xv,checklist:wv,callout:Sv,badge:kv,progress:Ev,divider:Iv,spacer:Cv,cta:Rv,nps:Pu,rating:Lu,emoji:_u,poll:Ou,quiz:Nu}});async function Hu(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 $u=E(()=>{"use strict"});function oo(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){Hu(e.deepLink);return}if(e.action==="link"&&e.deepLink)try{typeof window!="undefined"&&window.location.assign(e.deepLink)}catch{}}}}function oe(n){return $r(n.variant.blocks,oo(n))}function zr(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";qr();$u()});function qu(n,e,t,r,s){var p;n.addStyles("scalebun-blocks",Dr),n.addStyles("scalebun-surfaces",Au);let i=n.zone(Pt(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=zr(a.el,r.onView),{variantId:e.id,el:a.el,close:u}}var zu=E(()=>{"use strict";Fr();so();Ru();Te()});var Uu={};_(Uu,{markdownRenderer:()=>Tv});function ao(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(co(e,"strong",i[2]));else if(i[4])t.push(co(e,"em",i[4]));else if(i[6])t.push(co(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 co(n,e,t){let r=n.createElement(e);return r.textContent=t,r}var Tv,Vu=E(()=>{"use strict";Tv=(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(`
462
- `)){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",ao(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");ao(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",ao(c,e.doc).forEach(p=>d.appendChild(p)),r.appendChild(d)}else s=null}return r}});var Wu={};_(Wu,{codeRenderer:()=>Mv});var Mv,ju=E(()=>{"use strict";Mv=(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 k=e.doc.createRange();k.selectNodeContents(c);let v=(h=(m=e.doc).getSelection)==null?void 0:h.call(m);v==null||v.removeAllRanges(),v==null||v.addRange(k)}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 Ur={};_(Ur,{chartRenderer:()=>_v,sparklineRenderer:()=>Pv,statRenderer:()=>Lv});function Gu(n,e,t){let r=n.createElementNS(lo,"svg");return r.setAttribute("viewBox",`0 0 ${e} ${t}`),r.setAttribute("width",String(e)),r.setAttribute("height",String(t)),r}var lo,Ku,Pv,Lv,_v,Vr=E(()=>{"use strict";lo="http://www.w3.org/2000/svg",Ku=n=>Array.isArray(n)?n.map(Number).filter(e=>Number.isFinite(e)):[];Pv=(n,e)=>{var p;let t=Ku((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=Gu(e.doc,s,i),d=e.doc.createElementNS(lo,"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},Lv=(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},_v=(n,e)=>{var l;let t=Ku((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=Gu(e.doc,s,i);return t.forEach((u,d)=>{let p=e.doc.createElementNS(lo,"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 Yu={};_(Yu,{tableRenderer:()=>Ov});var Ov,Xu=E(()=>{"use strict";Ov=(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 Ju={};_(Ju,{videoRenderer:()=>Nv});var Nv,Qu=E(()=>{"use strict";Nv=(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 Zu={};_(Zu,{countdownRenderer:()=>Fv});function Bv(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 Wr,Fv,ep=E(()=>{"use strict";Wr=n=>String(Math.max(0,n)).padStart(2,"0"),Fv=(n,e)=>{let t=e.doc.createElement("div");t.className="scalebun-countdown";let r=()=>typeof Date!="undefined"?Date.now():0,s=Bv(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=Wr(c),i[1][1].textContent=Wr(l),i[2][1].textContent=Wr(u),i[3][1].textContent=Wr(d)};if(o(),typeof setInterval!="undefined"){let a=setInterval(()=>{if(!t.isConnected){clearInterval(a);return}o()},1e3)}return t}});var tp={};_(tp,{carouselRenderer:()=>Dv});var uo,Dv,np=E(()=>{"use strict";uo=n=>typeof n=="string"&&n?n:void 0,Dv=(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=uo(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(uo(u.title)){let f=e.doc.createElement("div");f.className="scalebun-car-title",f.textContent=u.title,d.appendChild(f)}if(uo(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 rp={};_(rp,{productGridRenderer:()=>Hv});var jr,Hv,sp=E(()=>{"use strict";jr=n=>n==null?void 0:String(n),Hv=(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=jr(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=jr(o.badge),c.appendChild(p)}let u=e.doc.createElement("div");if(u.className="scalebun-pcard-title",u.textContent=(d=jr(o.title))!=null?d:"",c.appendChild(u),o.price!=null){let p=e.doc.createElement("div");p.className="scalebun-pcard-price",p.textContent=jr(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 op={};_(op,{confettiRenderer:()=>qv});function $v(){try{return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var ip,qv,ap=E(()=>{"use strict";ip=["#6C5CE7","#f5b301","#2fa96b","#e0483d","#7c9dff","#ff8fab"];qv=(n,e)=>{var d,p;let t=e.doc.createElement("div");if(t.className="scalebun-confetti",$v()||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:ip[h%ip.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 Lt(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 _t(n){var e;(e=n.querySelector(".scalebun-game-note"))==null||e.remove()}var Kr=E(()=>{"use strict"});var dp={};_(dp,{spinwheelRenderer:()=>Vv});function fo(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 Uv(n,e,t,r,s){let i=fo(n,e,t,s),o=fo(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 lp(){try{return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var cp,zv,po,Vv,up=E(()=>{"use strict";Kr();cp=["#6C5CE7","#8b7bff","#5b4bd6","#a99cff","#4c3fb0","#7c6ef0"],zv=n=>{var e;return typeof n=="string"?n:String((e=n==null?void 0:n.label)!=null?e:"")};po="http://www.w3.org/2000/svg",Vv=(n,e)=>{var v,y;let t=(Array.isArray((v=n.props)==null?void 0:v.segments)?n.props.segments:[]).map(zv).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(po,"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,x)=>{let S=e.doc.createElementNS(po,"path");S.setAttribute("d",Uv(c,c,l,x*u,(x+1)*u)),S.setAttribute("fill",cp[x%cp.length]),d.appendChild(S);let w=fo(c,c,l*.62,x*u+u/2),I=e.doc.createElementNS(po,"text");I.setAttribute("x",String(w.x)),I.setAttribute("y",String(w.y)),I.setAttribute("fill","#fff"),I.setAttribute("font-size","10"),I.setAttribute("text-anchor","middle"),I.setAttribute("transform",`rotate(${x*u+u/2} ${w.x} ${w.y})`),I.textContent=b.slice(0,12),d.appendChild(I)});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,x)=>{var I;let S=((I=x!=null?x:r[b])!=null?I:"").slice(0,14);if(lp()){d.style.transform=`rotate(${-(b*u+u/2)}deg)`,f.textContent=S;return}d.style.transition="transform 3.4s cubic-bezier(.17,.67,.16,.99)",d.style.transform=`rotate(${h(b)}deg)`;let w=()=>{f.textContent=S};d.addEventListener("transitionend",w,{once:!0}),setTimeout(w,3600)},k=b=>{m=!0,f.disabled=!0,_t(o),lp()||(d.style.transition="transform 1.1s linear",d.style.transform="rotate(400deg)"),e.requestOutcome(b).then(x=>{var w,I,C;if(!x.ok){d.style.transition="",d.style.transform="",m=!1,f.disabled=!1,Lt(o,e.doc,x,{onRetry:()=>k(b+1)}),(w=e.onInteraction)==null||w.call(e,"spin_unavailable");return}let S=Math.max(0,Math.min(s-1,Number((I=x.index)!=null?I:0)));(C=e.onInteraction)==null||C.call(e,`spin:${S}`),g(S,x.label)})};return f.addEventListener("click",()=>{var b;if(!m){if(e.requestOutcome){k(1);return}m=!0,(b=e.onInteraction)==null||b.call(e,`spin:${i}`),g(i)}}),o.append(p,d,f),o}});var fp={};_(fp,{scratchRenderer:()=>Wv});function pp(){try{return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var Wv,mp=E(()=>{"use strict";Kr();Wv=(n,e)=>{var k,v;let t=typeof((k=n.props)==null?void 0:k.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){_t(s),y.label&&(i.textContent=y.label);return}i.textContent="\u2014",Lt(s,e.doc,y,{onRetry:()=>{o=!1,a()}}),(b=e.onInteraction)==null||b.call(e,"reveal_unavailable")}))};if(r){if(pp())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(pp()||!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 x;if(!p)return;let b=h(y);m(b.x,b.y),f||(f=!0,a(),(x=e.onInteraction)==null||x.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 x;let b=y.touches[0];if(b){let S=h(b);m(S.x,S.y),f||(f=!0,a(),(x=e.onInteraction)==null||x.call(e,"scratch_reveal"))}}),s}});var hp={};_(hp,{slotRenderer:()=>Gv});function Kv(){try{return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var jv,Gv,gp=E(()=>{"use strict";Kr();jv=["\u{1F352}","\u{1F514}","\u2B50","7\uFE0F\u20E3","\u{1F48E}","\u{1F340}"];Gv=(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:jv,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 k=e.doc.createElement("div");k.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,k.appendChild(y)}g.appendChild(k),a.push(k),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,k)=>{let v=(g.children.length-1)*44;Kv()||(g.style.transition=`transform ${1.6+k*.35}s cubic-bezier(.15,.7,.15,1)`),g.style.transform=`translateY(-${v}px)`})},d=h=>{l=!0,c.disabled=!0,_t(i),e.requestOutcome(h).then(g=>{var v,y,b;if(!g.ok){l=!1,c.disabled=!1,Lt(i,e.doc,g,{onRetry:()=>d(h+1)}),(v=e.onInteraction)==null||v.call(e,"slot_unavailable");return}let k=(y=g.symbols)!=null&&y.length?g.symbols:s;a.forEach((x,S)=>{var I,C;let w=x.children[x.children.length-1];w&&(w.textContent=(C=(I=k[S])!=null?I:s[S])!=null?C:r[0])}),(b=e.onInteraction)==null||b.call(e,`slot:${k.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 bp={};_(bp,{qrRenderer:()=>Qv});function Yv(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 Xv(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 Jv(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 mo,Qv,yp=E(()=>{"use strict";mo="http://www.w3.org/2000/svg";Qv=(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(mo,"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(mo,"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(Xv(f,p)?m=Jv(f,p):f===6||p===6?m=(f+p)%2===0:m=Yv(t,f,p),!m)continue;let h=e.doc.createElementNS(mo,"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 vp={};_(vp,{streakRenderer:()=>Zv});var ho,Zv,wp=E(()=>{"use strict";ho=(n,e)=>{let t=Number(n);return Number.isFinite(t)?Math.trunc(t):e},Zv=(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,ho(t.days,s.length||7))),o=Math.max(0,Math.min(i,ho(t.filled,0))),a=r?Math.max(0,Math.min(i,ho(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 kp={};_(kp,{nextStepIndex:()=>Sp,stepLabels:()=>xp,stepsRenderer:()=>tw});function xp(n){var t,r,s,i,o,a;let e=n!=null?n:{};return{back:(t=$e(e.backLabel))!=null?t:"Back",skip:(s=(r=$e(e.skipLabel))!=null?r:$e(e.secondaryLabel))!=null?s:"Skip",next:(i=$e(e.nextLabel))!=null?i:"Next",finish:(a=(o=$e(e.finalLabel))!=null?o:$e(e.ctaLabel))!=null?a:"Finish"}}function Sp(n,e,t){return e<=0?0:Math.max(0,Math.min(n+(t==="next"?1:-1),e-1))}function ew(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=$e(i.title))!=null?o:$e(i.label),body:(a=$e(i.body))!=null?a:$e(i.text)}});return r.length?r:[{}]}var $e,tw,Ep=E(()=>{"use strict";$e=n=>typeof n=="string"&&n.trim()?n.trim():void 0;tw=(n,e)=>{let t=n.props,r=ew(t),s=xp(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,x)=>{let S=i.createElement("button");return S.type="button",S.className=x,S.textContent=b,f.appendChild(S),S},h=m(s.back,"scalebun-btn-ghost"),g=m(s.skip,"scalebun-btn-ghost"),k=m(s.next,"scalebun-btn-primary");a.appendChild(f);let v=()=>{var S,w,I;let b=(S=r[o])!=null?S:{};d.textContent=(w=b.title)!=null?w:"",d.style.display=b.title?"":"none",p.textContent=(I=b.body)!=null?I:"",p.style.display=b.body?"":"none";let x=o+1>=r.length;k.textContent=x?s.finish:s.next,h.hidden=o===0,g.hidden=x,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 S;let x=Sp(o,r.length,b);x!==o&&(o=x,v(),(S=e.onInteraction)==null||S.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")}),k.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 Ip(n){let e=new Set;for(let t of n)go[t]&&!Hr[t]&&e.add(t);await Promise.all([...e].map(async t=>{try{Hr[t]=await go[t]()}catch{}}))}var go,kC,Cp=E(()=>{"use strict";qr();go={markdown:()=>Promise.resolve().then(()=>(Vu(),Uu)).then(n=>n.markdownRenderer),code:()=>Promise.resolve().then(()=>(ju(),Wu)).then(n=>n.codeRenderer),chart:()=>Promise.resolve().then(()=>(Vr(),Ur)).then(n=>n.chartRenderer),sparkline:()=>Promise.resolve().then(()=>(Vr(),Ur)).then(n=>n.sparklineRenderer),stat:()=>Promise.resolve().then(()=>(Vr(),Ur)).then(n=>n.statRenderer),table:()=>Promise.resolve().then(()=>(Xu(),Yu)).then(n=>n.tableRenderer),video:()=>Promise.resolve().then(()=>(Qu(),Ju)).then(n=>n.videoRenderer),countdown:()=>Promise.resolve().then(()=>(ep(),Zu)).then(n=>n.countdownRenderer),carousel:()=>Promise.resolve().then(()=>(np(),tp)).then(n=>n.carouselRenderer),"product-grid":()=>Promise.resolve().then(()=>(sp(),rp)).then(n=>n.productGridRenderer),confetti:()=>Promise.resolve().then(()=>(ap(),op)).then(n=>n.confettiRenderer),spinwheel:()=>Promise.resolve().then(()=>(up(),dp)).then(n=>n.spinwheelRenderer),scratch:()=>Promise.resolve().then(()=>(mp(),fp)).then(n=>n.scratchRenderer),slot:()=>Promise.resolve().then(()=>(gp(),hp)).then(n=>n.slotRenderer),qr:()=>Promise.resolve().then(()=>(yp(),bp)).then(n=>n.qrRenderer),streak:()=>Promise.resolve().then(()=>(wp(),vp)).then(n=>n.streakRenderer),steps:()=>Promise.resolve().then(()=>(Ep(),kp)).then(n=>n.stepsRenderer)},kC=Object.keys(go)});var Ap={};_(Ap,{bannerSurface:()=>nw});function nw(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 Rp=E(()=>{"use strict";Te()});var Tp={};_(Tp,{toastSurface:()=>rw});function rw(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 Mp=E(()=>{"use strict";Te()});function iw(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 Pp(n){return Array.from(n.querySelectorAll(sw)).filter(iw)}function ow(n){var t;return(t=n.getRootNode().activeElement)!=null?t:null}function Ot(n,e=document){let t=r=>{if(r.key!=="Tab")return;let s=Pp(n);if(s.length===0){r.preventDefault(),n.focus();return}let i=ow(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 Gr(n){let e=Pp(n);e.length?e[0].focus():(n.setAttribute("tabindex","-1"),n.focus())}function Yr(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 Nt(n=document){let e=n.activeElement;return()=>{var t;try{(t=e==null?void 0:e.focus)==null||t.call(e)}catch{}}}var sw,Xr=E(()=>{"use strict";sw=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",")});var Lp={};_(Lp,{modalSurface:()=>cw});function cw(n){var h,g,k,v,y,b,x;let{doc:e,variant:t}=n,r=(h=t.a11y)!=null?h:{},s=(g=t.dismiss)!=null?g:{},i=Nt(e),o=e.createElement("div");o.className="scalebun-backdrop";let a=e.createElement("div");a.className="scalebun-modal-card",a.setAttribute("role",(k=r.role)!=null?k:"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(S=>S.classList.contains("scalebun-h"));if(u){let S=`scalebun-mt-${++aw}`;u.id=S,a.setAttribute("aria-labelledby",S)}else a.setAttribute("aria-label",t.name);if(s.xButton!==!1){let S=e.createElement("button");S.type="button",S.className="scalebun-x scalebun-modal-x",S.setAttribute("aria-label","Close dialog"),S.textContent="\xD7",S.addEventListener("click",()=>n.requestClose("x")),a.appendChild(S)}for(let S of l)a.appendChild(S);o.appendChild(a),s.backdropClose&&o.addEventListener("mousedown",S=>{S.target===o&&n.requestClose("backdrop")});let d=S=>{S.key==="Escape"&&s.escClose!==!1&&(S.stopPropagation(),n.requestClose("esc"))};o.addEventListener("keydown",d);let p=Ot(a,e),f=(x=(b=n.host.shadowRoot)==null?void 0:b.host)!=null?x:o,m=Yr(f,e);return{el:o,afterMount:()=>Gr(a),destroy:()=>{p(),m(),o.removeEventListener("keydown",d),o.remove(),i()}}}var aw,_p=E(()=>{"use strict";Te();Xr();aw=0});var Fp={};_(Fp,{slideoverSurface:()=>uw});function lw(n,e){try{let t=localStorage.getItem(Bp(n)),r=t?Number(t):NaN;return Number.isFinite(r)?Math.min(Np,Math.max(Op,r)):e}catch{return e}}function dw(n,e){try{localStorage.setItem(Bp(n),String(Math.round(e)))}catch{}}function uw(n){var g,k,v,y,b,x,S,w,I,C;let{doc:e,variant:t}=n,r=(g=t.surfaceOptions)==null?void 0:g.placement,s=r==="bottom",i=r==="left",o=!s&&((k=t.surfaceOptions)==null?void 0:k.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",(S=(x=t.a11y)==null?void 0:x.labelledBy)!=null?S:t.name);let l=lw(t.id,(I=(w=t.surfaceOptions)==null?void 0:w.maxWidth)!=null?I: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(Np,Math.max(Op,O+D)),u()},m=()=>{dw(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 Op,Np,Bp,Dp=E(()=>{"use strict";Te();Op=280,Np=640,Bp=n=>`scalebun_inapp_slideover_${n}`});function Hp(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 bo(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=bo(i,e,!0);if(o)return o}}return null}function pw(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 fw(n,e,t,r){var a,c;let s=e?`[role="${Hp(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 mw(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 hw(n,e,t){var r;switch(n.kind){case"selector":return bo(e,n.value,t);case"data-attr":return bo(e,`[data-scalebun-anchor="${Hp(n.value)}"]`,t);case"nth":return(r=on(e,n.selector,t)[n.index])!=null?r:null;case"text":return pw(e,n.value,n.scope,t);case"aria":return fw(e,n.role,n.name,t);case"xpath":return mw(n.value)}}function $p(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?hw(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 Jr=E(()=>{"use strict"});function yo(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=(an(n)?t.height:t.width)+s;return yo(n,e,r)>=i}function Qr(n,e,t){return t<e?e:Math.min(t,Math.max(e,n))}function Zr(n){var h,g,k,v;let e=(h=n.offset)!=null?h:8,t=(g=n.padding)!=null?g:8,r=(k=n.arrowSize)!=null?k: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=gw[c];(zp(y,s,i,o,e)||yo(y,s,o)>yo(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=Qr(d,o.x+t,o.x+o.width-t-i.width);y!==d&&(f=!0,d=y)}else{let y=Qr(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=Qr(s.x+s.width/2-d,r,i.width-r),m.y=c==="top"?i.height:0):(m.y=Qr(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 gw,an,vo=E(()=>{"use strict";gw={top:"bottom",bottom:"top",left:"right",right:"left"},an=n=>n==="top"||n==="bottom"});var tt,es=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 bw(){return{x:0,y:0,width:typeof innerWidth!="undefined"?innerWidth:1024,height:typeof innerHeight!="undefined"?innerHeight:768}}function qe(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 Up(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,Bt=E(()=>{"use strict";Jr();vo();es();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=Zr({anchor:{x:c.x,y:c.y,width:c.width,height:c.height},tooltip:this.opts.size(),boundary:bw(),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 Vp={};_(Vp,{popoverSurface:()=>ww});function yw(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 vw(n){var t;let e=(t=n.variant.surfaceOptions)==null?void 0:t.placement;return e==="top"||e==="left"||e==="right"?e:"bottom"}function ww(n){var c,l,u,d,p;let{doc:e,variant:t}=n,r=yw(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:qe(r),size:()=>{let f=s.getBoundingClientRect();return{width:f.width||s.offsetWidth||320,height:f.height||s.offsetHeight||120}},preferred:{side:vw(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 Wp=E(()=>{"use strict";Te();Bt()});var jp={};_(jp,{coachmarkSurface:()=>kw});function xw(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 Sw(n){var t;let e=(t=n.variant.surfaceOptions)==null?void 0:t.placement;return e==="top"||e==="left"||e==="right"?e:"bottom"}function kw(n){var p,f,m,h,g,k;let{doc:e,variant:t}=n,r=xw(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:qe(r),size:()=>{let v=a.getBoundingClientRect();return{width:v.width||a.offsetWidth||300,height:v.height||a.offsetHeight||120}},preferred:{side:Sw(n),align:"center"},offset:(k=t.surfaceOptions)==null?void 0:k.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 Kp=E(()=>{"use strict";Te();Bt()});function Ft(n,e){var i,o,a,c;if("all"in n)return n.all.every(l=>Ft(l,e));if("any"in n)return n.any.some(l=>Ft(l,e));if("not"in n)return!Ft(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 Gp(n,e){if(typeof n=="string")return n;if(Array.isArray(n)){for(let t of n)if(!t.when||Ft(t.when,e))return t.to}return null}var Yp=E(()=>{"use strict"});var Dt,wo=E(()=>{"use strict";Yp();Dt=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&&Ft(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=Gp(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 So(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 xo(n){let e=n.getBoundingClientRect();return{x:e.left,y:e.top,width:e.width,height:e.height}}function Xp(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 Jp(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 Ew(n,e,t,r){var s,i;if(e.conditions.includes("gone"))return n==null;if(!n||e.conditions.includes("visible")&&So(xo(n),Xp(e.boundary))<((s=e.minVisibleRatio)!=null?s:.5)||e.conditions.includes("clickable")&&!Jp(n))return!1;if(e.conditions.includes("stable")){let o=JSON.stringify(xo(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 Iw(n,e){var t;return e.conditions.includes("gone")?"timeout":n?e.conditions.includes("visible")&&So(xo(n),Xp(e.boundary))<((t=e.minVisibleRatio)!=null?t:.5)?"not-visible":e.conditions.includes("clickable")&&!Jp(n)?"not-clickable":"timeout":"not-found"}function ts(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();Ew(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,Iw(m,e))},(f=e.timeoutMs)!=null?f:5e3),d()})}var ns=E(()=>{"use strict"});var Qp={};_(Qp,{tourSurface:()=>Aw});function Cw(n){var t;let e=n.placement==="top"||n.placement==="left"||n.placement==="right"?n.placement:"bottom";return{id:n.id,anchor:n.anchor?qe(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 Aw(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 S;let f=e.createElement("div");if(f.className="scalebun-coachmark scalebun-tour-card",f.setAttribute("role","dialog"),f.setAttribute("aria-label",(S=p.step.title)!=null?S:t.name),f.style.position=p.el?"absolute":"fixed",p.step.title){let w=e.createElement("h2");w.className="scalebun-h",w.textContent=p.step.title,f.appendChild(w)}if(p.step.body){let w=e.createElement("p");w.className="scalebun-text",w.textContent=p.step.body,f.appendChild(w)}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 k=(w,I,C)=>{let M=e.createElement("button");return M.type="button",M.className=`scalebun-btn ${I}`,M.textContent=w,M.addEventListener("click",C),M};p.index>0&&g.appendChild(k("Back","scalebun-btn-ghost",p.controls.back)),g.appendChild(k("Skip","scalebun-btn-ghost",p.controls.skip)),g.appendChild(k(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,x=()=>{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 w=Up(p.step.anchor);y=e.createElement("div"),y.className="scalebun-coach-spot",i.appendChild(y);let I=6;b=new Me({spec:p.step.anchor,size:()=>{let C=f.getBoundingClientRect();return{width:C.width||f.offsetWidth||300,height:C.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-I}px`,y.style.left=`${R.x-I}px`,y.style.width=`${R.width+I*2}px`,y.style.height=`${R.height+I*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(w)},onLost:C=>{var M;x(),(M=n.metrics)==null||M.recordFailedSelector(w),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 Dt({hub:s,resolveAnchor:pt,waitFor:ts,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(ko(p)):localStorage.setItem(ko(p),String(f))}catch{}},loadIndex:p=>{try{let f=localStorage.getItem(ko(p));return f!=null?Number(f):void 0}catch{return}}}),l={id:t.id,version:1,steps:r.map(Cw)};return{el:i,afterMount:()=>c.start(l,{resume:!0}),destroy:()=>{o(),c.dispose(),s.dispose(),i.remove()}}}var ko,Zp=E(()=>{"use strict";wo();Jr();ns();es();Bt();ko=n=>`scalebun_inapp_tour_${n}`});var ef={};_(ef,{hotspotSurface:()=>Mw});function Rw(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 Tw(n){var t;let e=(t=n.variant.surfaceOptions)==null?void 0:t.placement;return e==="top"||e==="left"||e==="right"?e:"bottom"}function Mw(n){let{doc:e,variant:t}=n,r=Rw(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:qe(r),size:()=>{let d=o.getBoundingClientRect();return{width:d.width||o.offsetWidth||240,height:d.height||o.offsetHeight||90}},preferred:{side:Tw(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 tf=E(()=>{"use strict";Te();Bt()});var nf={};_(nf,{toolbarSurface:()=>_w});function Pw(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 Lw(n){var t;let e=(t=n.variant.surfaceOptions)==null?void 0:t.placement;return e==="top"||e==="left"||e==="right"?e:"bottom"}function _w(n){var a,c,l,u;let{doc:e,variant:t}=n,r=Pw(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:qe(r),size:()=>{let d=s.getBoundingClientRect();return{width:d.width||s.offsetWidth||220,height:d.height||s.offsetHeight||80}},preferred:{side:Lw(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 rf=E(()=>{"use strict";Te();Bt()});var sf={};_(sf,{paletteSurface:()=>Ow});function Ow(n){var k,v,y;let{doc:e,variant:t}=n,r=(v=(k=t.surfaceOptions)==null?void 0:k.commands)!=null?v:[],s=Nt(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,x)=>{let S=e.createElement("li");S.className="scalebun-palette-item"+(x===u?" active":""),S.setAttribute("role","option"),S.setAttribute("aria-selected",String(x===u));let w=e.createElement("span");if(w.className="scalebun-palette-label",w.textContent=b.label,S.appendChild(w),b.hint){let I=e.createElement("span");I.className="scalebun-palette-hint",I.textContent=b.hint,S.appendChild(I)}S.addEventListener("mousemove",()=>{u=x,f()}),S.addEventListener("click",()=>d(b)),c.appendChild(S)})},f=()=>{Array.from(c.children).forEach((b,x)=>{b.classList.toggle("active",x===u),b.setAttribute("aria-selected",String(x===u))})},m=()=>{let b=a.value.trim().toLowerCase();l=b?r.filter(x=>x.label.toLowerCase().includes(b)||x.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=Ot(o,e);return p(),{el:i,afterMount:()=>a.focus(),destroy:()=>{g(),o.removeEventListener("keydown",h),i.remove(),s()}}}var of=E(()=>{"use strict";Xr()});var af={};_(af,{panelSurface:()=>Nw});function Nw(n){var g,k,v,y,b,x;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=(k=t.a11y)==null?void 0:k.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 S=e.createElement("button");S.type="button",S.className="scalebun-x",S.setAttribute("aria-label","Close panel"),S.textContent="\xD7",S.addEventListener("click",()=>n.requestClose("x")),i.appendChild(S)}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=(x=(b=t.blocks.find(S=>S.kind==="text"))==null?void 0:b.props)==null?void 0:x.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(S,w){let I=e.createElement("div");return I.className=`scalebun-bubble scalebun-bubble-${S}`,I.textContent=w,a.appendChild(I),a.scrollTop=a.scrollHeight,I}let m=S=>{S.preventDefault();let w=u.value.trim();w&&(f("user",w),u.value="",n.hooks.onInteraction(`ai_prompt:${w}`),p=f("assistant",""),p.classList.add("streaming"))};l.addEventListener("submit",m);let h={appendAssistant:S=>{var w;p||(p=f("assistant","")),p.textContent=((w=p.textContent)!=null?w:"")+S,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 cf=E(()=>{"use strict"});var df={};_(df,{checklistSurface:()=>Bw});function Bw(n){var x,S,w,I,C,M;let{doc:e,variant:t}=n,r=t.blocks.find(R=>R.kind==="checklist"),s=Array.isArray((x=r==null?void 0:r.props)==null?void 0:x.items)?r.props.items.map(R=>typeof R=="string"?{id:R,label:R}:R):[],i=(w=(S=t.blocks.find(R=>R.kind==="heading"))==null?void 0:S.props)==null?void 0:w.text,o=new Set;try{let R=localStorage.getItem(lf(t.id));if(R)for(let A of JSON.parse(R))o.add(A)}catch{}let a=()=>{try{localStorage.setItem(lf(t.id),JSON.stringify([...o]))}catch{}},c=e.createElement("div");c.className="scalebun-checklist",c.setAttribute("role",(C=(I=t.a11y)==null?void 0:I.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 k=!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&&!k?(k=!0,c.classList.add("complete"),n.hooks.onInteraction("checklist_complete")):A<s.length&&(k=!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 lf,uf=E(()=>{"use strict";lf=n=>`scalebun_inapp_checklist_${n}`});var pf={};_(pf,{takeoverSurface:()=>Dw});function Dw(n){var m,h,g,k,v;let{doc:e,variant:t}=n,r=(m=t.a11y)!=null?m:{},s=(h=t.dismiss)!=null?h:{},i=Nt(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-${++Fw}`;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=Ot(o,e),p=(v=(k=n.host.shadowRoot)==null?void 0:k.host)!=null?v:o,f=Yr(p,e);return{el:o,afterMount:()=>Gr(o),destroy:()=>{d(),f(),o.removeEventListener("keydown",u),o.remove(),i()}}}var Fw,ff=E(()=>{"use strict";Te();Xr();Fw=0});var mf={};_(mf,{launcherSurface:()=>Hw});function Hw(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 hf=E(()=>{"use strict"});var yf={};_(yf,{ShadowHost:()=>cn,applyThemeVars:()=>rs,resolveScheme:()=>bf});function bf(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 rs(n,e){let t=qw[bf(e)];for(let[r,s]of Object.entries(t))n.style.setProperty(r,s)}var $w,gf,qw,cn,ss=E(()=>{"use strict";q();$w="scalebun-inapp-host",gf=`
536
+ `});var qu,oo,Hu,$u,zu,Uu,Vu,Wu,ju=E(()=>{"use strict";qu=(n,e="")=>typeof n=="string"?n:n==null?e:String(n),oo=n=>Array.isArray(n)?n:[],Hu=n=>oo(n).map(e=>typeof e=="string"?{id:e,label:e}:e),$u=(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},zu=(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},Uu=(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},Vu=(n,e)=>{var o,a,c,l,u;let t=e.doc.createElement("div");t.className="scalebun-poll";let r=qu((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 Hu((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},Wu=(n,e)=>{var c,l,u;let t=e.doc.createElement("div");t.className="scalebun-quiz";let r=qu((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 Hu((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 Gu(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,Wv,jv,Kv,Ku,Gv,Xv,Yv,Jv,Qv,Zv,ew,tw,nw,$r,Ur=E(()=>{"use strict";ju();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},Wv=(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},jv=(n,e)=>{var r;let t=ve(e.doc,"p","scalebun-text");return Gu(t,ye((r=n.props)==null?void 0:r.text),e.doc),t},Kv=(n,e)=>{var r,s,i;let t=ve(e.doc,"div","scalebun-rich");return Gu(t,ye((i=(r=n.props)==null?void 0:r.text)!=null?i:(s=n.props)==null?void 0:s.markdown),e.doc),t},Ku=(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},Gv=(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},Xv=(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},Yv=(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},Jv=(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},Qv=(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},Zv=(n,e)=>ve(e.doc,"hr","scalebun-divider"),ew=(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},tw=new Set(["primary","secondary","link","ghost","dismiss"]),nw=(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=tw.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:Wv,text:jv,richtext:Kv,image:Ku,illustration:Ku,list:Xv,checklist:Gv,callout:Yv,badge:Jv,progress:Qv,divider:Zv,spacer:ew,cta:nw,nps:$u,rating:zu,emoji:Uu,poll:Vu,quiz:Wu}});async function Xu(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 Yu=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){Xu(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 Re=E(()=>{"use strict";Ur();Yu()});function Ju(n,e,t,r,s){var p;n.addStyles("scalebun-blocks",Hr),n.addStyles("scalebun-surfaces",Fu);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 Qu=E(()=>{"use strict";qr();io();Du();Re()});var Zu={};_(Zu,{markdownRenderer:()=>rw});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 rw,ep=E(()=>{"use strict";rw=(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 tp={};_(tp,{codeRenderer:()=>sw});var sw,np=E(()=>{"use strict";sw=(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={};_(Wr,{chartRenderer:()=>aw,sparklineRenderer:()=>iw,statRenderer:()=>ow});function sp(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,rp,iw,ow,aw,jr=E(()=>{"use strict";uo="http://www.w3.org/2000/svg",rp=n=>Array.isArray(n)?n.map(Number).filter(e=>Number.isFinite(e)):[];iw=(n,e)=>{var p;let t=rp((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=sp(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},ow=(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},aw=(n,e)=>{var l;let t=rp((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=sp(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 ip={};_(ip,{tableRenderer:()=>cw});var cw,op=E(()=>{"use strict";cw=(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 ap={};_(ap,{videoRenderer:()=>lw});var lw,cp=E(()=>{"use strict";lw=(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 lp={};_(lp,{countdownRenderer:()=>uw});function dw(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,uw,dp=E(()=>{"use strict";Kr=n=>String(Math.max(0,n)).padStart(2,"0"),uw=(n,e)=>{let t=e.doc.createElement("div");t.className="scalebun-countdown";let r=()=>typeof Date!="undefined"?Date.now():0,s=dw(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 up={};_(up,{carouselRenderer:()=>pw});var po,pw,pp=E(()=>{"use strict";po=n=>typeof n=="string"&&n?n:void 0,pw=(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 fp={};_(fp,{productGridRenderer:()=>fw});var Gr,fw,mp=E(()=>{"use strict";Gr=n=>n==null?void 0:String(n),fw=(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 gp={};_(gp,{confettiRenderer:()=>hw});function mw(){try{return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var hp,hw,bp=E(()=>{"use strict";hp=["#6C5CE7","#f5b301","#2fa96b","#e0483d","#7c9dff","#ff8fab"];hw=(n,e)=>{var d,p;let t=e.doc.createElement("div");if(t.className="scalebun-confetti",mw()||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:hp[h%hp.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 wp={};_(wp,{spinwheelRenderer:()=>yw});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 bw(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 vp(){try{return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var yp,gw,fo,yw,xp=E(()=>{"use strict";Xr();yp=["#6C5CE7","#8b7bff","#5b4bd6","#a99cff","#4c3fb0","#7c6ef0"],gw=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",yw=(n,e)=>{var v,y;let t=(Array.isArray((v=n.props)==null?void 0:v.segments)?n.props.segments:[]).map(gw).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",bw(c,c,l,w*u,(w+1)*u)),x.setAttribute("fill",yp[w%yp.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(vp()){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),vp()||(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 kp={};_(kp,{scratchRenderer:()=>vw});function Sp(){try{return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var vw,Ep=E(()=>{"use strict";Xr();vw=(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(Sp())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(Sp()||!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 Ip={};_(Ip,{slotRenderer:()=>Sw});function xw(){try{return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}var ww,Sw,Cp=E(()=>{"use strict";Xr();ww=["\u{1F352}","\u{1F514}","\u2B50","7\uFE0F\u20E3","\u{1F48E}","\u{1F340}"];Sw=(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:ww,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;xw()||(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 Ap={};_(Ap,{qrRenderer:()=>Cw});function kw(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 Ew(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 Iw(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,Cw,Tp=E(()=>{"use strict";ho="http://www.w3.org/2000/svg";Cw=(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(Ew(f,p)?m=Iw(f,p):f===6||p===6?m=(f+p)%2===0:m=kw(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 Rp={};_(Rp,{streakRenderer:()=>Aw});var go,Aw,Mp=E(()=>{"use strict";go=(n,e)=>{let t=Number(n);return Number.isFinite(t)?Math.trunc(t):e},Aw=(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 _p={};_(_p,{nextStepIndex:()=>Lp,stepLabels:()=>Pp,stepsRenderer:()=>Rw});function Pp(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 Lp(n,e,t){return e<=0?0:Math.max(0,Math.min(n+(t==="next"?1:-1),e-1))}function Tw(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,Rw,Op=E(()=>{"use strict";He=n=>typeof n=="string"&&n.trim()?n.trim():void 0;Rw=(n,e)=>{let t=n.props,r=Tw(t),s=Pp(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=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=Lp(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 Np(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,tA,Bp=E(()=>{"use strict";Ur();bo={markdown:()=>Promise.resolve().then(()=>(ep(),Zu)).then(n=>n.markdownRenderer),code:()=>Promise.resolve().then(()=>(np(),tp)).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(()=>(op(),ip)).then(n=>n.tableRenderer),video:()=>Promise.resolve().then(()=>(cp(),ap)).then(n=>n.videoRenderer),countdown:()=>Promise.resolve().then(()=>(dp(),lp)).then(n=>n.countdownRenderer),carousel:()=>Promise.resolve().then(()=>(pp(),up)).then(n=>n.carouselRenderer),"product-grid":()=>Promise.resolve().then(()=>(mp(),fp)).then(n=>n.productGridRenderer),confetti:()=>Promise.resolve().then(()=>(bp(),gp)).then(n=>n.confettiRenderer),spinwheel:()=>Promise.resolve().then(()=>(xp(),wp)).then(n=>n.spinwheelRenderer),scratch:()=>Promise.resolve().then(()=>(Ep(),kp)).then(n=>n.scratchRenderer),slot:()=>Promise.resolve().then(()=>(Cp(),Ip)).then(n=>n.slotRenderer),qr:()=>Promise.resolve().then(()=>(Tp(),Ap)).then(n=>n.qrRenderer),streak:()=>Promise.resolve().then(()=>(Mp(),Rp)).then(n=>n.streakRenderer),steps:()=>Promise.resolve().then(()=>(Op(),_p)).then(n=>n.stepsRenderer)},tA=Object.keys(bo)});var Fp={};_(Fp,{bannerSurface:()=>Mw});function Mw(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 Dp=E(()=>{"use strict";Re()});var qp={};_(qp,{toastSurface:()=>Pw});function Pw(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 Hp=E(()=>{"use strict";Re()});function _w(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 $p(n){return Array.from(n.querySelectorAll(Lw)).filter(_w)}function Ow(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=$p(n);if(s.length===0){r.preventDefault(),n.focus();return}let i=Ow(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=$p(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 Lw,Qr=E(()=>{"use strict";Lw=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",")});var zp={};_(zp,{modalSurface:()=>Bw});function Bw(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-${++Nw}`;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 Nw,Up=E(()=>{"use strict";Re();Qr();Nw=0});var Kp={};_(Kp,{slideoverSurface:()=>qw});function Fw(n,e){try{let t=localStorage.getItem(jp(n)),r=t?Number(t):NaN;return Number.isFinite(r)?Math.min(Wp,Math.max(Vp,r)):e}catch{return e}}function Dw(n,e){try{localStorage.setItem(jp(n),String(Math.round(e)))}catch{}}function qw(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=Fw(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 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(Wp,Math.max(Vp,O+D)),u()},m=()=>{Dw(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 Vp,Wp,jp,Gp=E(()=>{"use strict";Re();Vp=280,Wp=640,jp=n=>`scalebun_inapp_slideover_${n}`});function Xp(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 Hw(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 $w(n,e,t,r){var a,c;let s=e?`[role="${Xp(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 zw(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 Uw(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="${Xp(n.value)}"]`,t);case"nth":return(r=on(e,n.selector,t)[n.index])!=null?r:null;case"text":return Hw(e,n.value,n.scope,t);case"aria":return $w(e,n.role,n.name,t);case"xpath":return zw(n.value)}}function Yp(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?Uw(n.strategies[s],e,t):null;if(i)return{el:i,strategyIndex:s,strategiesTried:r}}return{el:null,strategyIndex:-1,strategiesTried:r}}function Jp(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 Qp(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(!Qp(c,s,i,o,e)){let y=Vw[c];(Qp(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 Vw,an,wo=E(()=>{"use strict";Vw={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 Ww(){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 Zp(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),Jp(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:Ww(),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 ef={};_(ef,{popoverSurface:()=>Gw});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 Kw(n){var t;let e=(t=n.variant.surfaceOptions)==null?void 0:t.placement;return e==="top"||e==="left"||e==="right"?e:"bottom"}function Gw(n){var c,l,u,d,p;let{doc:e,variant:t}=n,r=jw(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:Kw(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 tf=E(()=>{"use strict";Re();Ft()});var nf={};_(nf,{coachmarkSurface:()=>Jw});function Xw(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 Yw(n){var t;let e=(t=n.variant.surfaceOptions)==null?void 0:t.placement;return e==="top"||e==="left"||e==="right"?e:"bottom"}function Jw(n){var p,f,m,h,g,S;let{doc:e,variant:t}=n,r=Xw(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:Yw(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 rf=E(()=>{"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 sf(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 of=E(()=>{"use strict"});var qt,xo=E(()=>{"use strict";of();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=sf(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 af(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 cf(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 Qw(n,e,t,r){var s,i;if(e.conditions.includes("gone"))return n==null;if(!n||e.conditions.includes("visible")&&ko(So(n),af(e.boundary))<((s=e.minVisibleRatio)!=null?s:.5)||e.conditions.includes("clickable")&&!cf(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 Zw(n,e){var t;return e.conditions.includes("gone")?"timeout":n?e.conditions.includes("visible")&&ko(So(n),af(e.boundary))<((t=e.minVisibleRatio)!=null?t:.5)?"not-visible":e.conditions.includes("clickable")&&!cf(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();Qw(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,Zw(m,e))},(f=e.timeoutMs)!=null?f:5e3),d()})}var ss=E(()=>{"use strict"});var lf={};_(lf,{tourSurface:()=>tx});function ex(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 tx(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=Zp(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 T=M.getBoundingClientRect();y.style.top=`${T.y-k}px`,y.style.left=`${T.x-k}px`,y.style.width=`${T.width+k*2}px`,y.style.height=`${T.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(ex)};return{el:i,afterMount:()=>c.start(l,{resume:!0}),destroy:()=>{o(),c.dispose(),s.dispose(),i.remove()}}}var Eo,df=E(()=>{"use strict";xo();Zr();ss();ns();Ft();Eo=n=>`scalebun_inapp_tour_${n}`});var uf={};_(uf,{hotspotSurface:()=>sx});function nx(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 rx(n){var t;let e=(t=n.variant.surfaceOptions)==null?void 0:t.placement;return e==="top"||e==="left"||e==="right"?e:"bottom"}function sx(n){let{doc:e,variant:t}=n,r=nx(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:rx(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 pf=E(()=>{"use strict";Re();Ft()});var ff={};_(ff,{toolbarSurface:()=>ax});function ix(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 ox(n){var t;let e=(t=n.variant.surfaceOptions)==null?void 0:t.placement;return e==="top"||e==="left"||e==="right"?e:"bottom"}function ax(n){var a,c,l,u;let{doc:e,variant:t}=n,r=ix(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:ox(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 mf=E(()=>{"use strict";Re();Ft()});var hf={};_(hf,{paletteSurface:()=>cx});function cx(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 gf=E(()=>{"use strict";Qr()});var bf={};_(bf,{panelSurface:()=>lx});function lx(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 yf=E(()=>{"use strict"});var wf={};_(wf,{checklistSurface:()=>dx});function dx(n){var w,x,I,k,C,M;let{doc:e,variant:t}=n,r=t.blocks.find(T=>T.kind==="checklist"),s=Array.isArray((w=r==null?void 0:r.props)==null?void 0:w.items)?r.props.items.map(T=>typeof T=="string"?{id:T,label:T}:T):[],i=(I=(x=t.blocks.find(T=>T.kind==="heading"))==null?void 0:x.props)==null?void 0:I.text,o=new Set;try{let T=localStorage.getItem(vf(t.id));if(T)for(let A of JSON.parse(T))o.add(A)}catch{}let a=()=>{try{localStorage.setItem(vf(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 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 vf,xf=E(()=>{"use strict";vf=n=>`scalebun_inapp_checklist_${n}`});var Sf={};_(Sf,{takeoverSurface:()=>px});function px(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-${++ux}`;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 ux,kf=E(()=>{"use strict";Re();Qr();ux=0});var Ef={};_(Ef,{launcherSurface:()=>fx});function fx(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 If=E(()=>{"use strict"});var Tf={};_(Tf,{ShadowHost:()=>cn,applyThemeVars:()=>is,resolveScheme:()=>Af});function Af(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=hx[Af(e)];for(let[r,s]of Object.entries(t))n.style.setProperty(r,s)}var mx,Cf,hx,cn,os=E(()=>{"use strict";$();mx="scalebun-inapp-host",Cf=`
463
539
  :host{ all: initial; }
464
540
  .layer{
465
541
  position: fixed; inset: 0; z-index: 2147483600;
@@ -478,36 +554,58 @@ ${iv(n)}`,s.appendChild(u);let d=document.createElement("div");d.className="ov";
478
554
  /* full-bleed zones: click-transparent by design \u2014 see the BASE_CSS docblock */
479
555
  .zone-modal, .zone-takeover, .zone-palette{ inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
480
556
  .zone-anchored{ inset: 0; pointer-events: none; }
481
- .zone-center{ top: 0; right: 0; }
557
+ /* 16px in from the corner, like .zone-toast and .zone-launcher \u2014 this alone sat at top:0 right:0.
558
+ The layer is position:fixed inset:0, i.e. exactly the viewport, so a zone flush to the corner
559
+ leaves anything that deliberately overhangs nowhere to go: the bell's unread badge sits at a
560
+ negative offset and was being sliced off by the screen edge. */
561
+ .zone-center{ top: 16px; inset-inline-end: 16px; }
482
562
  @media (prefers-reduced-motion: reduce){ .layer *{ animation: none !important; transition: none !important; } }
483
- `,qw={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=$w,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(gf),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=yt(document.createElement("style"));t.textContent=gf,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=yt(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&&rs(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 vf={};_(vf,{mountInline:()=>Uw});function Uw(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,x;if(a||i)return;let m=f.ownerDocument;i=m.createElement("div"),i.className="scalebun-inline-host",rs(i,(v=r.theme)!=null?v:"auto");let h=i.attachShadow({mode:"open"});Ne(h,Dr+zw);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 k=oo({doc:m,hooks:t,requestClose:S=>c(S)});for(let S of $r(e.blocks,k))g.appendChild(S);if((x=e.dismiss)!=null&&x.xButton){let S=m.createElement("button");S.type="button",S.className="scalebun-x",S.setAttribute("aria-label","Dismiss"),S.textContent="\xD7",S.addEventListener("click",()=>c("x")),g.appendChild(S)}h.appendChild(g),f.appendChild(i),t.onImpression(),o=zr(g,t.onView)},u=n.whenAvailable(s,l);return{close:()=>c("x"),mounted:()=>i!=null}}var zw,wf=E(()=>{"use strict";q();ss();so();Te();qr();zw=`
563
+ `,hx={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=mx,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(Cf),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=Cf,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 Rf={};_(Rf,{mountInline:()=>bx});function bx(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+gx);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 gx,Mf=E(()=>{"use strict";$();os();io();Re();Ur();gx=`
484
564
  :host{ display:block; }
485
565
  .scalebun-inline{ position:relative; background:var(--scalebun-bg); color:var(--scalebun-fg);
486
566
  border:1px solid var(--scalebun-border); border-radius:var(--scalebun-radius); padding:18px; }
487
- .scalebun-inline .scalebun-x{ position:absolute; top:8px; right:8px; background:none; border:0;
567
+ /* inset-inline-end, not right: in RTL the button belongs on the side the text now ends on. */
568
+ .scalebun-inline .scalebun-x{ position:absolute; top:8px; inset-inline-end:8px; background:none; border:0;
488
569
  color:var(--scalebun-muted); cursor:pointer; font-size:16px; border-radius:6px; }
489
- `});var Sf={};_(Sf,{SURFACE_LOADERS:()=>Eo,isSurfaceSupported:()=>Vw,renderVariant:()=>Io});function Vw(n){return n==="inline"||n in Eo}async function Io(n,e,t){var a;let r=Ip(((a=n.blocks)!=null?a:[]).map(c=>c.kind));if(n.surface==="inline"){if(!t.slots)return await r,xf(n.id);let[{mountInline:c}]=await Promise.all([Promise.resolve().then(()=>(wf(),vf)),r]),l=c(t.slots,n,e);return{variantId:n.id,close:()=>l.close()}}let s=Eo[n.surface];if(!s)return await r,xf(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 xf(n){return{variantId:n,close:()=>{}}}var Eo,Co=E(()=>{"use strict";zu();Cp();Eo={banner:()=>Promise.resolve().then(()=>(Rp(),Ap)).then(n=>n.bannerSurface),toast:()=>Promise.resolve().then(()=>(Mp(),Tp)).then(n=>n.toastSurface),modal:()=>Promise.resolve().then(()=>(_p(),Lp)).then(n=>n.modalSurface),slideover:()=>Promise.resolve().then(()=>(Dp(),Fp)).then(n=>n.slideoverSurface),popover:()=>Promise.resolve().then(()=>(Wp(),Vp)).then(n=>n.popoverSurface),coachmark:()=>Promise.resolve().then(()=>(Kp(),jp)).then(n=>n.coachmarkSurface),tour:()=>Promise.resolve().then(()=>(Zp(),Qp)).then(n=>n.tourSurface),hotspot:()=>Promise.resolve().then(()=>(tf(),ef)).then(n=>n.hotspotSurface),toolbar:()=>Promise.resolve().then(()=>(rf(),nf)).then(n=>n.toolbarSurface),palette:()=>Promise.resolve().then(()=>(of(),sf)).then(n=>n.paletteSurface),panel:()=>Promise.resolve().then(()=>(cf(),af)).then(n=>n.panelSurface),checklist:()=>Promise.resolve().then(()=>(uf(),df)).then(n=>n.checklistSurface),takeover:()=>Promise.resolve().then(()=>(ff(),pf)).then(n=>n.takeoverSurface),launcher:()=>Promise.resolve().then(()=>(hf(),mf)).then(n=>n.launcherSurface)}});function If(n){To=n}function Mo(n){try{Ro==null||Ro(n)}catch{}}function Cf(n,e){let t=typeof e=="string"&&e?e:null;return t?Ww.has(t)?t:null:n&&Kw[n]||null}function Af(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 Po(n,e){let t=Af(e!=null?e:n.spec);return Cf(n.variantKey,t)?!0:t?(Gw.has(t)||Mo({variantKey:n.variantKey,reason:"unrenderable",archetype:t}),!1):(n.variantKey&&Mo({variantKey:n.variantKey,reason:"unmapped"}),!1)}function Xw(n){var t;let e=B(n.mountModel);if(!e)return null;if(e==="inline"){let r=Br(n);return!r||!eo(n)?(Mo({reason:"unrenderable",archetype:"inline"}),null):{surface:"inline",surfaceOptions:{slot:r}}}return(t=Yw[e])!=null?t:null}function tx(n,e,t,r,s){var i,o,a,c,l,u,d,p,f,m,h,g,k,v,y,b,x,S,w,I,C,M,R,A,O,z,D,te,J,Q,fe,ce,xe,Se,le,H,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:Qw(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:Zw(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(X=>{var ee,T,L;let Y=ae(X);return{image:B((ee=Y.image)!=null?ee:Y.imageUrl),title:pe(X),text:B((L=(T=Y.text)!=null?T:Y.body)!=null?L:Y.subtitle)}})}}]}case"questionFlow":{let G=ue(e,["questions","steps"]),ie=ae(G[0]),X=(x=(b=(y=B((g=(h=e.question)!=null?h:e.promptText)!=null?g:e.prompt))!=null?y:B((v=(k=ie.prompt)!=null?k:ie.question)!=null?v:ie.label))!=null?b:t)!=null?x:"Tell us",Y=ue(e,["options","preferenceOptions","pollOptions","answers","choices","reactions"]),ee=Y.length?Y:ue(ie,["options","answers","choices"]),T=(ee.length?ee:[{label:"Option A"},{label:"Option B"}]).map((L,N)=>({id:String(N),label:pe(L)}));switch(r){case"nps_prompt":return[{kind:"nps",props:{question:X}}];case"rating_request":return[{kind:"rating",props:{question:X,max:Ao(Number((S=e.max)!=null?S:e.scale),5)}}];case"emoji_reaction_bar":{let L=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:X,...L.length?{emojis:L}:{}}}]}case"quiz_card":{let L=ae((w=e.outcome)!=null?w:e.quizOutcome),N=B((I=L.answeredId)!=null?I:e.answeredId),F=B((C=L.correctId)!=null?C:e.correctId);return[{kind:"quiz",props:{question:X,options:T,...N||F?{outcome:{answeredId:N,correctId:F}}:{}}}]}default:return[{kind:"poll",props:{question:X,options:T}}]}}case"checklistProgress":{let G=ue(e,["steps","items","tasks","checklist"]),ie=G.length?G:["Step one","Step two","Step three"],X=ie.map((L,N)=>{let F=ae(L);return{id:String(N),label:pe(L),done:F.done===!0||F.checked===!0||F.complete===!0}}),Y=Jw((A=(R=(M=e.progress)!=null?M:e.percent)!=null?R:e.progressValue)!=null?A:e.currentValue,40),ee={kind:"progress",props:{value:Y}},T=B((z=(O=e.reward)!=null?O:e.prize)!=null?z:e.rewardValue);switch(r){case"streak_reward":case"daily_check_in":{let L=r==="daily_check_in",N=ue(e,["calendarDays","dayLabels","days"]),F=N.map(pe).filter(Boolean),W=N.filter(Ie=>{let Ce=ae(Ie);return Ce.done===!0||Ce.checked===!0||Ce.complete===!0}).length,re=Ao(Number((J=(te=(D=e.filled)!=null?D:e.currentStreak)!=null?te:e.streakValue)!=null?J:e.streakValueSource),W),ge=N.findIndex(Ie=>ae(Ie).today===!0),he=[{kind:"streak",props:{mode:L?"checkin":"streak",filled:re,...ge>=0?{today:ge+1}:{},...F.length?{labels:F}:{days:Ao(Number((Q=e.days)!=null?Q:e.calendarLength),7)},...L&&e.alreadyCheckedIn===!0?{today:-1}:{}}}];return T&&he.push({kind:"callout",props:{icon:"\u{1F381}",text:T}}),he}case"progress_unlock":{let L=Y>=100,N=[ee];return T&&N.push({kind:"callout",props:{icon:L?"\u{1F389}":"\u{1F512}",text:L?T:`Unlock ${T}`}}),N}case"goal_tracker":{let L=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(L)?Number.isFinite(N)?`${L} / ${N}`:L:`${Math.round(Y)}%`,label:(K=B((V=(H=e.goalLabel)!=null?H:e.unit)!=null?V:e.goalSource))!=null?K:"Progress"}}),F}case"community_challenge":{let L=Number((me=(de=e.participants)!=null?de:e.members)!=null?me:e.joined),N=[ee];return Number.isFinite(L)&&N.push({kind:"stat",props:{value:L,label:(se=B(e.participantsLabel))!=null?se:"taking part"}}),G.length&&N.push({kind:"list",props:{items:X.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:X}}]}}case"multiStepSheet":{let G=ue(e,["steps","pages","items","screens"]);return[{kind:"steps",props:{steps:(G.length?G:[{}]).map(X=>{var ee,T;let Y=ae(X);return{title:pe(X)||void 0,body:B((T=(ee=Y.body)!=null?ee:Y.text)!=null?T:Y.subtitle)}}),backLabel:B(e.backLabel),skipLabel:B(e.skipLabel),nextLabel:B(e.nextLabel),finalLabel:B(e.finalLabel)}}]}case"sideSheet":return Ef(e,s);case"videoCommerce":{let G=[],ie=B(e.video);ie&&G.push({kind:"video",props:{src:ie}});let X=ue(e,["products","items"]).map(ee=>{var L,N,F;let T=ae(ee);return{id:String((L=T.id)!=null?L:""),image:B((N=T.image)!=null?N:T.imageUrl),title:pe(ee),price:(F=T.price)!=null?F:T.amount}}),Y=B(e.productTitle);return!X.length&&Y&&X.push({id:"product",image:B((Ue=e.productImage)!=null?Ue:e.image),title:Y,price:(Ve=e.price)!=null?Ve:e.amount}),G.push({kind:"product-grid",props:{products:X}}),G}default:return Ef(e,s)}}function nx(n,e){var u,d,p,f,m,h,g,k,v,y,b,x,S,w,I,C,M,R,A,O,z,D,te,J,Q,fe,ce,xe,Se,le;let t=[],r=[],s=B((R=(M=(C=(I=(w=(S=(x=(b=(y=(v=(k=(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?k:n.assistantMessage)!=null?v:n.supportMessage)!=null?y:n.arrivalMessage)!=null?b:n.checkoutMessage)!=null?x:n.instruction)!=null?S:n.instructions)!=null?w:n.closedMessage)!=null?I: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(H=>{var K;let V=ae(H);return{label:pe(H),action:(K=B(V.action))!=null?K:"dismiss",deepLink:B(V.deepLink),variant:"secondary"}}).filter(H=>H.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 H=B(n.oldPrice),V=B(n.newPrice),K=H&&V?`${H} \u2192 ${V}`:(le=(Se=V!=null?V:H)!=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 Ef(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 rx(n,e){var f,m,h,g,k,v,y,b,x,S,w,I,C,M,R,A,O,z,D,te,J;let t=(f=Cf(n.variantKey,Af(e)))!=null?f:"",r=ae(e.ext),s=(g=(h=(m=jw[t])!=null?m:Xw(r))!=null?h:kf[n.layout])!=null?g:kf.modal,i=B((k=r.sidePosition)!=null?k: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=(I=(w=(S=(x=(b=r.eventTitle)!=null?b:r.passTitle)!=null?x:r.expandedTitle)!=null?S:r.subject)!=null?w:r.vipTitle)!=null?I: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=nx(r,u);a.push(...d.lead),a.push(...tx(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 ix(n,e){var s;let t=(s=e.ext)==null?void 0:s.animationIn,r=typeof t=="string"?sx[t]:void 0;r&&n.style.setProperty("--scalebun-anim-in",r)}function ox(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",qi(t.accent,t.ctaText)):r("--scalebun-accent-fg",t.ctaText)}async function Rf(n,e,t){var m;let[{renderVariant:r},{ShadowHost:s}]=await Promise.all([Promise.resolve().then(()=>(Co(),Sf)),Promise.resolve().then(()=>(ss(),yf))]),i=new s;i.ensure(),e.dark===!0&&i.setTheme("dark");let o=i.element();o&&(ox(o,e),ix(o,e));let a=ae(e.ext),c=ku({campaignId:n.id,variantKey:(m=n.variantKey)!=null?m:"",ext:a,preview:n.preview===!0||n.isTest===!0,...To?{handler:To}:{}});if(c&&bu(n.variantKey)==="load"){let h=await c(1);h.ok&&h.state&&Object.assign(a,h.state)}let l=rx(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:Mt});return{close:()=>{try{f.close()}catch{}p()}}}var ae,B,Ao,pe,ue,Ww,jw,Kw,Ro,To,Gw,Yw,kf,Jw,Qw,Zw,ex,sx,Tf=E(()=>{"use strict";zi();Eu();to();Qi();ae=n=>n&&typeof n=="object"&&!Array.isArray(n)?n:{},B=n=>typeof n=="string"&&n.length>0?n:void 0,Ao=(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[]},Ww=new Set(["spinWheel","scratchReveal","slotReward","carouselDeck","countdown","questionFlow","checklistProgress","qrNfc","videoCommerce","celebration","multiStepSheet","sideSheet"]),jw={sideSheet:{surface:"slideover",surfaceOptions:{placement:"right"}},multiStepSheet:{surface:"slideover",surfaceOptions:{placement:"bottom"}}},Kw={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"},Ro=null,To=null;Gw=new Set(["modal","sheet","bannerToast","fullscreen","anchored","inline"]),Yw={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}}};kf={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"}}},Jw=(n,e)=>{let t=Number(n);return Number.isFinite(t)?t>0&&t<=1?t*100:t:e},Qw=(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},Zw=n=>{var r;let e=ex(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}},ex=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};sx={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 Pf={};_(Pf,{installShakeDetector:()=>lx});function lx(n){if(typeof window=="undefined"||typeof DeviceMotionEvent=="undefined")return()=>{};let e=0,t=!1,r,s=l=>{var h,g,k;let u=l.accelerationIncludingGravity;if(!u)return;let d=((h=u.x)!=null?h:0)/Lo,p=((g=u.y)!=null?g:0)/Lo,f=((k=u.z)!=null?k:0)/Lo;if(Math.sqrt(d*d+p*p+f*f)<ax)return;let m=P();if(!(m-e<cx)){e=m;try{n("shake")}catch{}}},i=()=>{t||(t=!0,window.addEventListener("devicemotion",s))},o=()=>{try{return sessionStorage.getItem(Mf)}catch{return null}},a=l=>{try{sessionStorage.setItem(Mf,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 ax,cx,Lo,Mf,Lf=E(()=>{"use strict";q();ax=2.3,cx=1500,Lo=9.80665,Mf="scalebun_shake_perm"});var _f={};_(_f,{EngageRuntime:()=>_o});var _o,Of=E(()=>{"use strict";jd();Hi();mu();hu();Tf();Fe();_o=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)),If((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(()=>(Lf(),Pf));(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||!Fi(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&&Di(r.testRunId),this.showing=!0;let{spec:s,variantId:i}=this.resolveSpec(r);if(this.inappEvent(r,"impression",i,!0),Po(r,s)){this.showRich(r,s,i,!0);return}this.active=Yi(r.layout,s,{onClick:()=>{this.inappEvent(r,"click",i,!0),this.finish()},onDismiss:()=>{this.inappEvent(r,"dismiss",i,!0),this.finish()}})}showRich(e,t,r,s=!1){Rf(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.finish()},onDismiss:()=>{this.inappEvent(e,"dismiss",r,s),this.finish()}}).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}}tryShowInApp(e){if(this.showing||!Er(e,this.deps.now()))return;this.showing=!0,Ir(e,this.deps.now());let{spec:t,variantId:r}=this.resolveSpec(e);if(this.inappEvent(e,"impression",r),Po(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.finish()},onDismiss:()=>{this.inappEvent(e,"dismiss",r),this.finish()}})}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||!Er(e,this.deps.now())||(this.showing=!0,this.startedAt=this.deps.now(),Ir(e,this.deps.now()),this.beacon(e,"shown"),this.event(e,"impression"),this.active=fu(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;Bi(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])}}});var Ff,we,Oo=E(()=>{"use strict";Ff={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 No={};_(No,{mountInbox:()=>vx});function Z(n,e,t){let r=document.createElement(n);return e&&(r.className=e),t!=null&&(r.textContent=t),r}function bx(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 yx(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)"),k=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"),x=l("gap","11px"),S=l("z","2147483600"),w=M=>l("radius",M),I=M=>l("radius-sm",M),C=s?`--scalebun-inbox-accent:${s};`:"";return`
570
+ .scalebun-inline .scalebun-h{ padding-inline-end:24px; }
571
+ `});var Lf={};_(Lf,{SURFACE_LOADERS:()=>Io,isSurfaceSupported:()=>yx,renderVariant:()=>Co});function yx(n){return n==="inline"||n in Io}async function Co(n,e,t){var a;let r=Np(((a=n.blocks)!=null?a:[]).map(c=>c.kind));if(n.surface==="inline"){if(!t.slots)return await r,Pf(n.id);let[{mountInline:c}]=await Promise.all([Promise.resolve().then(()=>(Mf(),Rf)),r]),l=c(t.slots,n,e);return{variantId:n.id,close:()=>l.close()}}let s=Io[n.surface];if(!s)return await r,Pf(n.id);let[i]=await Promise.all([s(),r]),o=Ju(t.host,n,i,e,t.metrics);return{variantId:n.id,close:()=>o.close("x")}}function Pf(n){return{variantId:n,close:()=>{}}}var Io,Ao=E(()=>{"use strict";Qu();Bp();Io={banner:()=>Promise.resolve().then(()=>(Dp(),Fp)).then(n=>n.bannerSurface),toast:()=>Promise.resolve().then(()=>(Hp(),qp)).then(n=>n.toastSurface),modal:()=>Promise.resolve().then(()=>(Up(),zp)).then(n=>n.modalSurface),slideover:()=>Promise.resolve().then(()=>(Gp(),Kp)).then(n=>n.slideoverSurface),popover:()=>Promise.resolve().then(()=>(tf(),ef)).then(n=>n.popoverSurface),coachmark:()=>Promise.resolve().then(()=>(rf(),nf)).then(n=>n.coachmarkSurface),tour:()=>Promise.resolve().then(()=>(df(),lf)).then(n=>n.tourSurface),hotspot:()=>Promise.resolve().then(()=>(pf(),uf)).then(n=>n.hotspotSurface),toolbar:()=>Promise.resolve().then(()=>(mf(),ff)).then(n=>n.toolbarSurface),palette:()=>Promise.resolve().then(()=>(gf(),hf)).then(n=>n.paletteSurface),panel:()=>Promise.resolve().then(()=>(yf(),bf)).then(n=>n.panelSurface),checklist:()=>Promise.resolve().then(()=>(xf(),wf)).then(n=>n.checklistSurface),takeover:()=>Promise.resolve().then(()=>(kf(),Sf)).then(n=>n.takeoverSurface),launcher:()=>Promise.resolve().then(()=>(If(),Ef)).then(n=>n.launcherSurface)}});function Nf(n){Mo=n}function Po(n){try{Ro==null||Ro(n)}catch{}}function Bf(n,e){let t=typeof e=="string"&&e?e:null;return t?vx.has(t)?t:null:n&&xx[n]||null}function Ff(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=Ff(e!=null?e:n.spec);return Bf(n.variantKey,t)?!0:t?(Sx.has(t)||Po({variantKey:n.variantKey,reason:"unrenderable",archetype:t}),!1):(n.variantKey&&Po({variantKey:n.variantKey,reason:"unmapped"}),!1)}function Ex(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=kx[e])!=null?t:null}function Rx(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,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:Cx(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:Ax(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,L;let X=ae(Y);return{image:B((ee=X.image)!=null?ee:X.imageUrl),title:pe(Y),text:B((L=(R=X.text)!=null?R:X.body)!=null?L: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"]),R=(ee.length?ee:[{label:"Option A"},{label:"Option B"}]).map((L,N)=>({id:String(N),label:pe(L)}));switch(r){case"nps_prompt":return[{kind:"nps",props:{question:Y}}];case"rating_request":return[{kind:"rating",props:{question:Y,max:To(Number((x=e.max)!=null?x:e.scale),5)}}];case"emoji_reaction_bar":{let L=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,...L.length?{emojis:L}:{}}}]}case"quiz_card":{let L=ae((I=e.outcome)!=null?I:e.quizOutcome),N=B((k=L.answeredId)!=null?k:e.answeredId),F=B((C=L.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((L,N)=>{let F=ae(L);return{id:String(N),label:pe(L),done:F.done===!0||F.checked===!0||F.complete===!0}}),X=Ix((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 L=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=To(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:L?"checkin":"streak",filled:re,...ge>=0?{today:ge+1}:{},...F.length?{labels:F}:{days:To(Number((Q=e.days)!=null?Q:e.calendarLength),7)},...L&&e.alreadyCheckedIn===!0?{today:-1}:{}}}];return R&&he.push({kind:"callout",props:{icon:"\u{1F381}",text:R}}),he}case"progress_unlock":{let L=X>=100,N=[ee];return R&&N.push({kind:"callout",props:{icon:L?"\u{1F389}":"\u{1F512}",text:L?R:`Unlock ${R}`}}),N}case"goal_tracker":{let L=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(L)?Number.isFinite(N)?`${L} / ${N}`:L:`${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 L=Number((me=(de=e.participants)!=null?de:e.members)!=null?me:e.joined),N=[ee];return Number.isFinite(L)&&N.push({kind:"stat",props:{value:L,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 Of(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 L,N,F;let R=ae(ee);return{id:String((L=R.id)!=null?L:""),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 Of(e,s)}}function Mx(n,e){var u,d,p,f,m,h,g,S,v,y,b,w,x,I,k,C,M,T,A,O,z,D,te,J,Q,fe,ce,xe,Se,le;let t=[],r=[],s=B((T=(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?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 Of(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 Px(n,e){var f,m,h,g,S,v,y,b,w,x,I,k,C,M,T,A,O,z,D,te,J;let t=(f=Bf(n.variantKey,Ff(e)))!=null?f:"",r=ae(e.ext),s=(g=(h=(m=wx[t])!=null?m:Ex(r))!=null?h:_f[n.layout])!=null?g:_f.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=(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=Mx(r,u);a.push(...d.lead),a.push(...Rx(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 _x(n,e){var s;let t=(s=e.ext)==null?void 0:s.animationIn,r=typeof t=="string"?Lx[t]:void 0;r&&n.style.setProperty("--scalebun-anim-in",r)}function Ox(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 Df(n,e,t){var m;let[{renderVariant:r},{ShadowHost:s}]=await Promise.all([Promise.resolve().then(()=>(Ao(),Lf)),Promise.resolve().then(()=>(os(),Tf))]),i=new s;i.ensure(),e.dark===!0&&i.setTheme("dark");let o=i.element();o&&(Ox(o,e),_x(o,e));let a=ae(e.ext),c=_u({campaignId:n.id,variantKey:(m=n.variantKey)!=null?m:"",ext:a,preview:n.preview===!0||n.isTest===!0,...Mo?{handler:Mo}:{}});if(c&&Au(n.variantKey)==="load"){let h=await c(1);h.ok&&h.state&&Object.assign(a,h.state)}let l=Px(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,To,pe,ue,vx,wx,xx,Ro,Mo,Sx,kx,_f,Ix,Cx,Ax,Tx,Lx,qf=E(()=>{"use strict";Ui();Ou();no();Zi();ae=n=>n&&typeof n=="object"&&!Array.isArray(n)?n:{},B=n=>typeof n=="string"&&n.length>0?n:void 0,To=(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[]},vx=new Set(["spinWheel","scratchReveal","slotReward","carouselDeck","countdown","questionFlow","checklistProgress","qrNfc","videoCommerce","celebration","multiStepSheet","sideSheet"]),wx={sideSheet:{surface:"slideover",surfaceOptions:{placement:"right"}},multiStepSheet:{surface:"slideover",surfaceOptions:{placement:"bottom"}}},xx={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"},Ro=null,Mo=null;Sx=new Set(["modal","sheet","bannerToast","fullscreen","anchored","inline"]),kx={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}}};_f={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"}}},Ix=(n,e)=>{let t=Number(n);return Number.isFinite(t)?t>0&&t<=1?t*100:t:e},Cx=(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},Ax=n=>{var r;let e=Tx(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}},Tx=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};Lx={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 $f={};_($f,{installShakeDetector:()=>Fx});function Fx(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)<Nx)return;let m=P();if(!(m-e<Bx)){e=m;try{n("shake")}catch{}}},i=()=>{t||(t=!0,window.addEventListener("devicemotion",s))},o=()=>{try{return sessionStorage.getItem(Hf)}catch{return null}},a=l=>{try{sessionStorage.setItem(Hf,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 Nx,Bx,_o,Hf,zf=E(()=>{"use strict";$();Nx=2.3,Bx=1500,_o=9.80665,Hf="scalebun_shake_perm"});var Uf={};_(Uf,{EngageRuntime:()=>Oo});var Oo,Vf=E(()=>{"use strict";eu();Hi();Eu();Iu();qf();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)),Nf((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(()=>(zf(),$f));(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){Df(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=ku(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 Gf={};_(Gf,{startCollectors:()=>Ux});function Ux(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,Kf)}},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<zx||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<$x)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,Kf)),()=>{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 $x,qo,zx,Kf,Xf=E(()=>{"use strict";Do();$x=5e3,qo=25e3,zx=50,Kf=3e4});var nm={};_(nm,{EXIT_THRESHOLD:()=>Jf,EXIT_WEIGHTS:()=>Yf,REVERSAL_DEFAULTS:()=>$o,ScrollReversalDetector:()=>ls,canFire:()=>tm,isTopExit:()=>Zf,reversalMetrics:()=>em,startExitIntent:()=>Kx});function Zf(n,e,t=Qf){return n&&e<=t}function em(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 tm(n,e,t,r={}){var s,i;return!(t>=((s=r.maxFires)!=null?s:jx)||e>0&&n-e<((i=r.cooldownMs)!=null?i:Wx))}function Kx(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=Yf[u];if(p===void 0||p<Jf||!tm(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=>{Zf(!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 Yf,Jf,Wx,jx,Qf,$o,ls,Ho,rm=E(()=>{"use strict";On();Yf={top_exit:.8,scroll_reversal:.5},Jf=.5,Wx=3e4,jx=3,Qf=40,$o={windowMs:120,minDistancePx:80,minVelocityPxMs:.7,minDepthPct:25,sustainSamples:3,topEdgePx:Qf};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=em(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 sm(n,e){let t={...Xx,...n},r=Le(e,Gx),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 Gx,Xx,im=E(()=>{"use strict";Fe();Gx="wzb-replay-v1",Xx={mode:"sampled",sampleRate:1,onErrorSampleRate:1}});var Uo={};_(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 Yx(n,e){return n>700||e>800?3:n>350||e>400?2:n>150||e>100?1:0}function om(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,am=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=Yx(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 Qx)e=e.replace(t,Jx);return e}function cm(n){let e=n.snapshot;e&&typeof e=="object"&&fs(e);let t=n.mutations;if(Array.isArray(t))for(let r of t)Zx(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 Zx(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 Jx,Qx,lm=E(()=>{"use strict";Jx="[redacted]",Qx=[/\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 pm={};_(pm,{deviceMemoryGB:()=>um,networkHint:()=>dm,shouldDeferHeavyEgress:()=>Wo,userOptedOutOfTracking:()=>tS});function eS(){if(typeof navigator!="undefined")return navigator.connection}function dm(){let n=eS(),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 tS(){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 um(){if(typeof navigator=="undefined")return;let n=navigator.deviceMemory;return typeof n=="number"?n:void 0}function Wo(){let n=dm();if(n.saveData||n.slow)return!0;let e=um();return typeof e=="number"&&e<=1}var jo=E(()=>{"use strict"});function Ko(){try{if(typeof sessionStorage!="undefined"){let n=sessionStorage.getItem(fm);return n||(n=`t_${H()}`,sessionStorage.setItem(fm,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 fm,ms,mm=E(()=>{"use strict";$();fm="scalebun_replay_tab"});var Jo={};_(Jo,{GZ_PREFIX:()=>dn,ReplayEncoder:()=>Yo,decodeSnapshotValue:()=>rS,gunzipBase64:()=>gm,gzipBase64:()=>hm});async function hm(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 sS(new Uint8Array(r))}async function gm(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 rS(n){return typeof n=="string"&&n.startsWith(dn)?JSON.parse(await gm(n.slice(dn.length))):n}function sS(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,nS,Yo,Qo=E(()=>{"use strict";dn="gz:",nS=`
572
+ self.onmessage = async (e) => {
573
+ const { id, json } = e.data;
574
+ try {
575
+ const cs = new CompressionStream('gzip');
576
+ const w = cs.writable.getWriter();
577
+ w.write(new TextEncoder().encode(json)); w.close();
578
+ const ab = await new Response(cs.readable).arrayBuffer();
579
+ const bytes = new Uint8Array(ab);
580
+ let bin = ''; const CH = 0x8000;
581
+ for (let i = 0; i < bytes.length; i += CH) bin += String.fromCharCode.apply(null, bytes.subarray(i, i + CH));
582
+ self.postMessage({ id, out: btoa(bin) });
583
+ } catch (err) {
584
+ self.postMessage({ id, err: String(err) });
585
+ }
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([nS],{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 hm(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 bm(n){var e;return(e=n.shadowRoot)!=null?e:null}function hs(n,e){e.remove(n);let t=bm(n);t&&t.childNodes.forEach(r=>hs(r,e)),n.childNodes.forEach(r=>hs(r,e))}function gs(n,e=[]){let t=bm(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 ym=E(()=>{"use strict"});var ea={};_(ea,{MutationRecorder:()=>ft,buildMutations:()=>vm});function iS(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 oS(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 vm(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,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();ym();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)}])},iS(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&&(oS(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=vm(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={};_(na,{InteractionRecorder:()=>ta});function wm(){try{return typeof location!="undefined"?location.href:""}catch{return""}}function lS(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 dS(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 uS(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,cS))!=null?r:null,a=o!=null?o:i;return{tag:a.tagName.toLowerCase(),interactive:!!o,role:o?lS(a):void 0,label:dS(a,e)}}catch{return}}function xm(n){for(let e=0;e<n.length;e++)if(n[e].nodeType===1)return!0;return!1}function pS(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 aS,ta,cS,ra=E(()=>{"use strict";et();aS={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=uS(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:"";Tt(t)?s=Rt(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={...aS,...r}}notifyDomActivity(e=Date.now()){this.lastActivityT=e}observe(){typeof document!="undefined"&&(this.startHref=wm(),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?pS(m.target,c):!1,g=m.type==="childList"&&(xm(m.addedNodes)||xm(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&&wm()===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)}};cS='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 Cm={};_(Cm,{bridgeCrossOriginFrame:()=>sa,installChildSatellite:()=>fS,nodeIdBaseFor:()=>ia});function fS(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!==Sm||s||!Im(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:km,doc:u}),r=new ft(c,d=>l({scalebun:Em,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||!Im(a.origin,t.allowedChildOrigins))return;let c=a.data;c&&(c.scalebun===km&&c.doc?t.emit([{op:"iframe",id:e,doc:c.doc}]):c.scalebun===Em&&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:Sm,nodeIdBase:t.nodeIdBase},i)}catch{}};return o(),n.addEventListener("load",o),()=>{window.removeEventListener("message",s),n.removeEventListener("load",o)}}var Sm,km,Em,Im,ia,oa=E(()=>{"use strict";sn();et();un();Sm="scalebun:frame-init",km="scalebun:frame-key",Em="scalebun:frame-mut",Im=(n,e)=>e.includes("*")||e.includes(n);ia=n=>n*1e6});var ca={};_(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 Am={};_(Am,{CanvasRecorder:()=>da});var mS,da,Tm=E(()=>{"use strict";mS="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(mS)))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 Rm={};_(Rm,{installCadence:()=>hS});function hS(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 Mm=E(()=>{"use strict"});var Om={};_(Om,{RecorderController:()=>ws,createRecorder:()=>xS});async function xS(n,e){let t=new ws(n,e);return await t.init(),t}function Lm(){try{return typeof window!="undefined"?{width:window.innerWidth,height:window.innerHeight}:void 0}catch{return}}function _m(){try{return typeof location!="undefined"?location.href:void 0}catch{return}}var Pm,vs,bS,yS,vS,wS,ws,Nm=E(()=>{"use strict";$();Vt();Tn();us();am();lm();jo();mm();Sn();Pm=120,vs=2e5,bS=8,yS=2e6,vS=3e4,wS=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(bS,yS),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(()=>(Rr(),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:Lm(),href:_m(),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(),Cm)).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(()=>(Tm(),Am)),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(()=>(Mm(),Rm));this.disconnectCadence=g({keyframeIntervalMs:vS,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&&cm(e),e.frameType==="delta"&&this.adaptive&&this.adaptive.level>0){let r=om(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>=Pm||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>=Pm||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<wS)){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:Lm(),href:_m(),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=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;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 Fm={};_(Fm,{installWebGLPreserve:()=>kS});function Bm(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"&&SS.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 kS(){if(typeof HTMLCanvasElement=="undefined")return()=>{};let n=[];try{let e=Bm(HTMLCanvasElement.prototype);if(e&&n.push(e),typeof OffscreenCanvas!="undefined"){let t=Bm(OffscreenCanvas.prototype);t&&n.push(t)}}catch{}return()=>{for(let e of n)try{e()}catch{}}}var ua,SS,Dm=E(()=>{"use strict";ua="__scalebunWebglPatched",SS=new Set(["webgl","webgl2","experimental-webgl","experimental-webgl2"])});var Hm={};_(Hm,{ReplayFeature:()=>pa});var ES,xs,IS,qm,pa,$m=E(()=>{"use strict";im();Qs();ES=400,xs="sdk_replay_capture_failed",IS=5e3,qm=()=>Promise.resolve().then(()=>(Nm(),Om)),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=sm(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(),pm));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(()=>(Dm(),Fm));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(()=>(Rr(),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 qm())}catch(o){await new Promise(a=>setTimeout(a,ES)),{createRecorder:s}=await qm(),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})},IS)}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 zm,we,fa=E(()=>{"use strict";zm={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={};_(ma,{mountInbox:()=>LS});function Z(n,e,t){let r=document.createElement(n);return e&&(r.className=e),t!=null&&(r.textContent=t),r}function MS(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 PS(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"),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`
490
588
  :host{all:initial;direction:${t?"rtl":"ltr"};${C}}
491
589
  *{box-sizing:border-box;font-family:${v}}
492
590
  button:focus-visible,.row:focus-visible,.tab:focus-visible{outline:2px solid ${h};outline-offset:2px}
493
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}
494
592
  .bell{position:fixed;${c}:22px;${a}:22px;width:52px;height:52px;border-radius:50%;border:none;cursor:pointer;
495
- background:${h};color:#fff;display:grid;place-items:center;box-shadow:0 6px 24px rgba(108,92,231,.4);z-index:${S}}
593
+ background:${h};color:#fff;display:grid;place-items:center;box-shadow:0 6px 24px rgba(108,92,231,.4);z-index:${x}}
496
594
  .bell:hover{filter:brightness(1.06)}
497
595
  .bell svg{width:22px;height:22px}
498
596
  .badge{position:absolute;top:-4px;${a}:-4px;min-width:20px;height:20px;padding:0 5px;border-radius:10px;
499
- background:${k};color:#fff;font-size:11px;font-weight:700;display:none;align-items:center;justify-content:center;line-height:1}
597
+ background:${S};color:#fff;font-size:11px;font-weight:700;display:none;align-items:center;justify-content:center;line-height:1}
500
598
  .badge.on{display:flex}
501
- .scrim{position:fixed;inset:0;background:rgba(10,8,16,.42);z-index:calc(${S} + 1);opacity:0;pointer-events:none;transition:opacity .2s}
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}
502
600
  .scrim.on{opacity:1;pointer-events:auto}
503
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};
504
- z-index:calc(${S} + 2);display:flex;flex-direction:column;box-shadow:${y};
602
+ z-index:calc(${x} + 2);display:flex;flex-direction:column;box-shadow:${y};
505
603
  transform:translateX(${a==="right"?"100%":"-100%"});transition:transform .26s cubic-bezier(.4,0,.2,1)}
506
604
  .panel.open{transform:translateX(0)}
507
605
  .hd{display:flex;align-items:center;justify-content:space-between;padding:15px 16px;border-bottom:1px solid ${f}}
508
606
  .hd .ti{font-size:15px;font-weight:700}
509
607
  .hd .mt{font-size:12px;color:${p};margin-top:2px}
510
- .x{width:30px;height:30px;border-radius:${I("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:${k("8px")};border:1px solid ${f};background:${m};color:${p};cursor:pointer;font-size:17px;line-height:1;display:grid;place-items:center}
511
609
  .x:hover{color:${d}}
512
610
  .tabs{display:flex;gap:6px;padding:8px 12px;border-bottom:1px solid ${f};overflow-x:auto}
513
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}
@@ -516,12 +614,12 @@ button:focus-visible,.row:focus-visible,.tab:focus-visible{outline:2px solid ${h
516
614
  .empty{padding:48px 20px;text-align:center;color:${p};font-size:13px}
517
615
  .empty b{display:block;color:${d};font-size:14px;margin-bottom:5px}
518
616
  .list{display:flex;flex-direction:column}
519
- .row{position:relative;display:flex;gap:${x};padding:12px 12px 12px 15px;border-radius:${w("10px")};cursor:pointer}
617
+ .row{position:relative;display:flex;gap:${w};padding:12px 12px 12px 15px;border-radius:${I("10px")};cursor:pointer}
520
618
  .row:hover{background:${m}}
521
619
  .row.unread{background:${g}}
522
620
  .dot{position:absolute;left:5px;top:18px;width:7px;height:7px;border-radius:50%;background:${h};opacity:0}
523
621
  .row.unread .dot{opacity:1}
524
- .ic{flex-shrink:0;width:34px;height:34px;border-radius:${w("9px")};background:${m};display:grid;place-items:center;overflow:hidden;font-weight:700;color:${h};font-size:14px}
622
+ .ic{flex-shrink:0;width:34px;height:34px;border-radius:${I("9px")};background:${m};display:grid;place-items:center;overflow:hidden;font-weight:700;color:${h};font-size:14px}
525
623
  .ic img{width:100%;height:100%;object-fit:cover}
526
624
  .rc{flex:1;min-width:0}
527
625
  .rtop{display:flex;align-items:baseline;justify-content:space-between;gap:8px}
@@ -530,16 +628,16 @@ button:focus-visible,.row:focus-visible,.tab:focus-visible{outline:2px solid ${h
530
628
  .rtime{flex-shrink:0;font-size:11px;color:${p}}
531
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}
532
630
  .rcta{display:flex;gap:7px;margin-top:8px}
533
- .rcta button{background:${h};color:#fff;border:none;border-radius:${I("7px")};padding:5px 11px;font-size:12px;font-weight:600;cursor:pointer}
631
+ .rcta button{background:${h};color:#fff;border:none;border-radius:${k("7px")};padding:5px 11px;font-size:12px;font-weight:600;cursor:pointer}
534
632
  .rcta button.sec{background:${m};color:${d}}
535
633
  /* \u26A0\uFE0F Was \`position:absolute\` floating over the row, which meant NO space was reserved for it and the
536
634
  title ran underneath \u2014 the buttons masked their own row's text (and in RTL they landed on top of
537
635
  the title rather than the timestamp). A hover-only overlay only looks fine while the text is short.
538
636
  Now a real flex child: it always occupies its column, so nothing can ever slide under it, and
539
637
  \`visibility\` (not \`display\`) means revealing it on hover causes no reflow. */
540
- .ract{flex-shrink:0;align-self:flex-start;display:flex;gap:2px;border-radius:${I("8px")};padding:2px;visibility:hidden}
638
+ .ract{flex-shrink:0;align-self:flex-start;display:flex;gap:2px;border-radius:${k("8px")};padding:2px;visibility:hidden}
541
639
  .row:hover .ract,.row:focus-within .ract{visibility:visible}
542
- .ract button{width:26px;height:26px;border:none;background:none;color:${p};cursor:pointer;border-radius:${I("6px")};display:grid;place-items:center}
640
+ .ract button{width:26px;height:26px;border:none;background:none;color:${p};cursor:pointer;border-radius:${k("6px")};display:grid;place-items:center}
543
641
  .ract button:hover{background:${m};color:${d}}
544
642
  .ract button.on{color:${h}}
545
643
  .ract svg{width:15px;height:15px}
@@ -554,7 +652,7 @@ ${r!=="dropdown"?"":`
554
652
  \`positionDropdown()\` at open time, because they depend on where the trigger is on screen. */
555
653
  .panel{inset:auto;top:auto;bottom:auto;left:auto;right:auto;
556
654
  height:auto;max-height:min(70vh,520px);width:min(${b},calc(100vw - 24px));
557
- border:1px solid ${f};border-radius:${w("14px")};overflow:hidden;
655
+ border:1px solid ${f};border-radius:${I("14px")};overflow:hidden;
558
656
  transform:translateY(-6px) scale(.98);opacity:0;transform-origin:top ${a};
559
657
  transition:opacity .14s ease-out,transform .14s ease-out}
560
658
  .panel.open{transform:none;opacity:1}
@@ -566,26 +664,10 @@ ${r!=="dropdown"?"":`
566
664
  .body{max-height:none}
567
665
  .foot{display:flex;border-top:1px solid ${f};padding:8px}
568
666
  .foot button{flex:1;border:none;background:none;color:${h};font-size:13px;font-weight:600;
569
- cursor:pointer;padding:8px;border-radius:${I("8px")}}
667
+ cursor:pointer;padding:8px;border-radius:${k("8px")}}
570
668
  .foot button:hover{background:${m}}
571
669
  `}
572
- @media(prefers-reduced-motion:reduce){.panel,.scrim{transition:none}}`}function vx(n,e,t){var G,ie,X,Y,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"&&Df(e.trigger)?"dropdown":"drawer",a=e.accent,c={...Ff,...(X=t==null?void 0:t.labels)!=null?X:{},...(Y=e.labels)!=null?Y:{}},l=(ee=e.formatTime)!=null?ee:bx,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,yx(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"),k=Z("div","ti",c.title),v=Z("div","mt");g.append(k,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 x=Z("div","body"),S=Z("div","live");if(S.setAttribute("role","status"),S.setAttribute("aria-live","polite"),m.append(h,b,x,S),e.onViewAll){let T=Z("div","foot"),L=document.createElement("button");L.type="button",L.textContent=c.viewAll,L.addEventListener("click",()=>{var N;J(),(N=e.onViewAll)==null||N.call(e)}),T.appendChild(L),m.appendChild(T)}p.append(f,m);let w,I,C=Df(e.trigger);C||(w=document.createElement("button"),w.className="bell",w.type="button",w.setAttribute("aria-label",c.open),w.setAttribute("aria-expanded","false"),w.setAttribute("aria-haspopup","dialog"),typeof e.icon=="string"?w.textContent=e.icon:e.icon?w.appendChild(e.icon):w.innerHTML=gx,I=document.createElement("span"),I.className="badge",I.setAttribute("aria-hidden","true"),w.appendChild(I),p.appendChild(w));let M=C!=null?C:w,R=!1,A=null,O=!1,z=()=>{if(o!=="dropdown"||!C)return;let T=C.getBoundingClientRect(),L=m.offsetWidth||360,N=m.offsetHeight||420,F=8,W=i?T.right-L:T.left;m.style.left=`${Math.max(F,Math.min(W,window.innerWidth-L-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 L,N;T!==R&&(R=T,T&&z(),m.classList.toggle("open",T),f.classList.toggle("on",T),m.setAttribute("aria-hidden",T?"false":"true"),w==null||w.setAttribute("aria-expanded",String(T)),T?(A=(N=(L=p.activeElement)!=null?L:M)!=null?N:null,O=!0,n.refresh(),Ve()):A==null||A.focus())},te=()=>D(!0),J=()=>D(!1),Q=()=>D(!R),fe=()=>Q();w==null||w.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 L=xe(),N=L[0],F=L[L.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 L=T.unreadCount;I&&(I.textContent=L>99?"99+":String(L),I.classList.toggle("on",L>0)),v.textContent=L>0?c.unread(L):c.noUnread,w&&w.setAttribute("aria-label",L>0?c.openUnread(L):c.open),R&&Ve()}),le=null;function H(){let T=Z("div","empty");return T.appendChild(Z("b",void 0,c.emptyTitle)),T.appendChild(document.createTextNode(c.emptyBody)),T}function V(T,L,N){let F=document.createElement("button");return F.type="button",F.innerHTML=T,F.setAttribute("aria-label",L),F.title=L,F.addEventListener("click",W=>{W.stopPropagation(),N()}),F}function K(T){var he,Ie,Ce;let L=Z("div","row"+(T.state==="unread"?" unread":""));L.setAttribute("role","listitem"),L.tabIndex=0,L.setAttribute("aria-label",`${T.title}${T.state==="unread"?", unread":""}`),L.dataset.id=T.id,L.appendChild(Z("span","dot"));let N=Z("div","ic");if(T.iconUrl){let Ae=document.createElement("img");Ae.src=T.iconUrl,Ae.alt="",N.appendChild(Ae)}else N.textContent=((Ie=(he=T.category)==null?void 0:he[0])!=null?Ie:"\u2022").toUpperCase();L.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)),(Ce=T.cta)!=null&&Ce.length){let Ae=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)}),Ae.appendChild(ke)}),F.appendChild(Ae)}L.appendChild(F);let re=Z("div","ract"),ge=V(fx,T.pinned?c.unpin:c.pin,()=>void n.pin(T.id,!T.pinned));return T.pinned&&ge.classList.add("on"),re.append(ge,V(mx,c.archive,()=>void n.archive(T.id)),V(hx,c.delete,()=>void n.remove(T.id))),L.appendChild(re),L.addEventListener("click",()=>{T.state==="unread"&&n.markRead(T.id)}),L}function de(T){var re,ge,he;let L=T.target.closest(".row");if(!L)return;let N=[...x.querySelectorAll(".row")],F=N.indexOf(L),W=L.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))}x.addEventListener("keydown",de);function me(T){if(T.length<2){b.style.display="none",b.textContent="";return}b.style.display="flex",b.textContent="";let L=(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(L(c.allTab,null));for(let N of T)b.appendChild(L(N.charAt(0).toUpperCase()+N.slice(1),N))}async function se(){var he,Ie,Ce,Ae,Je,st;if(!R)return;let T=await n.query({limit:200});if(!R)return;let L=(Ce=(Ie=(he=p.activeElement)==null?void 0:he.closest)==null?void 0:Ie.call(he,".row"))==null?void 0:Ce.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,(Ae=e.maxItems)!=null?Ae:5):1/0,re=F.length>W?F.slice(0,W):F;if(x.textContent="",!re.length){x.appendChild(H()),S.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));x.appendChild(ge),S.textContent=`${F.length} notification${F.length===1?"":"s"}`,O?(O=!1,((Je=x.querySelector(".row"))!=null?Je:y).focus()):L&&((st=x.querySelector(`.row[data-id="${L}"]`))==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),x.removeEventListener("keydown",de),C==null||C.removeEventListener("click",fe),d.remove()}}}function Df(n){if(!n)return null;if(typeof n=="string")try{return document.querySelector(n)}catch{return null}return n}var fx,mx,hx,gx,Bo=E(()=>{"use strict";q();Oo();fx='<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>',mx='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><path d="M3 7h18v3H3zM5 10v10h14V10M9 14h6"/></svg>',hx='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><path d="M4 7h16M9 7V4h6v3M6 7l1 13h10l1-13"/></svg>',gx='<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 Hf={};_(Hf,{InboxStore:()=>ln,NOOP_STORE:()=>Fo});function xx(n){return new Promise(e=>{try{if(typeof indexedDB=="undefined")return e(null);let t=indexedDB.open(wx+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 wx,ze,nt,ln,Fo,Do=E(()=>{"use strict";wx="scalebun_inbox_",ze="messages",nt="meta";ln=class{constructor(e){this.scope=e;this.dbp=null}db(){return this.dbp||(this.dbp=xx(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()}})}},Fo={hydrate:()=>Promise.resolve([]),put:()=>Promise.resolve(),putMany:()=>Promise.resolve(),remove:()=>Promise.resolve(),getMeta:()=>Promise.resolve(void 0),setMeta:()=>Promise.resolve(),clear:()=>Promise.resolve()}});var $f={};_($f,{InboxSync:()=>Ho,InboxTransport:()=>$o,mergeMessage:()=>qo,stateRank:()=>Ex});function qo(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 kx)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 Ex(n){return Sx[n]}var Sx,kx,Ho,$o,zo=E(()=>{"use strict";Cn();Sx={unread:0,read:1,archived:2,deleted:3},kx=["revision","campaignId","category","priority","title","body","html","imageUrl","iconUrl","cta","createdAt","expiresAt","groupKey","data"];Ho=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")}}},$o=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 Uf={};_(Uf,{InboxRuntime:()=>Uo});function zf(n){return`${n.createdAt}_${n.id}`}var qf,Ix,Uo,Vf=E(()=>{"use strict";Oo();Do();zo();qf={unread:0,read:1,archived:2,deleted:3},Ix=20;Uo=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 ln(e.scope):Fo}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)&&qf[t]<=qf[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=>zf(u)===e.cursor);l>=0&&(r=r.slice(l+1))}let s=(c=e.limit)!=null?c:Ix,i=r.slice(0,s),o=r.length>s,a=i.length?i[i.length-1]:void 0;return{messages:i,cursor:a?zf(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=qo(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}}});function Vo(n){return n>=200?"critical":n>=100?"warning":"info"}function Wo(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 jo(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 Ko=E(()=>{"use strict"});var Kf={};_(Kf,{startCollectors:()=>Rx});function Rx(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,jf)}},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=jo(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(k=>{var v;for(let y of k.getEntries()){let b=f?(v=y.blockingDuration)!=null?v:0:y.duration;b<Ax||n("js_stall",Math.round(b),{kind:f?"loaf":"longtask",severity:Vo(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,Go);return}let d=0,p=performance.now(),f=()=>{if(!e())return;d++;let m=performance.now()-p;if(m<Cx)r=requestAnimationFrame(f);else{let{fps:h,dropped:g}=Wo(d,m);n("frame_metrics",h,{totalFrames:d,dropped:g,windowMs:Math.round(m)}),s=setTimeout(u,Go)}};r=requestAnimationFrame(f)};return document.readyState==="complete"?setTimeout(c,0):(o=()=>setTimeout(c,0),window.addEventListener("load",o,{once:!0})),l(),s=setTimeout(u,Go),performance.memory&&(i=setTimeout(a,jf)),()=>{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 Cx,Go,Ax,jf,Gf=E(()=>{"use strict";Ko();Cx=5e3,Go=25e3,Ax=50,jf=3e4});function Yo(){return typeof window!="undefined"&&typeof window.Profiler=="function"}async function Yf(n,e=10){if(!Yo())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 Xf=E(()=>{"use strict"});function em(n){return n?{...Jf,...n}:Jf}var Jf,Qf,Zf,Xo=E(()=>{"use strict";Jf={pressureSustainMs:6e3,lagP95Ms:500,mainThreadStallMs:500,jankBurstCount:5,jankWindowMs:1e4,frozenFrameMs:700,memSurgeBytesPerSec:6291456,leakSamples:10,leakMinBytes:52428800,heapUsedRatio:.9,cooldownMs:6e4},Qf=10*6e4,Zf=10});function Px(n){if(!n.length)return 0;let e=Math.min(n.length-1,Math.floor(n.length*.95));return n[e]}var ds,ls,tm=E(()=>{"use strict";Xo();ds=class ds{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>ds.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=Px([...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<Qf),this.emitTimes.length>=Zf){this.droppedCount++;return}this.lastEmit.set(e.type,t),this.emitTimes.push(t),this.deps.onIncident({...e,startTs:t})}}};ds.LAG_RING=32;ls=ds});function nm(n,e){return n.length?n[Math.min(n.length-1,Math.floor(n.length*e))]:0}var us,rm=E(()=>{"use strict";q();us=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(nm(r,.5)),lagP95:Math.round(nm(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 sm(){try{return typeof document=="undefined"||document.visibilityState!=="hidden"}catch{return!0}}function im(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=()=>{sm()?s||o():a()};typeof document!="undefined"&&(document.addEventListener("visibilitychange",c),t.push(()=>document.removeEventListener("visibilitychange",c))),sm()&&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 om=E(()=>{"use strict";q()});var am={};_(am,{startWatchdog:()=>Fx});function _x(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 Ox(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}function Fx(n){var k,v,y,b;let e=(k=n.watchdogOptions)!=null?k:{};if(!_x(n.sessionId,e.sampleRate))return Lx;let t=(x,S,w,I)=>{let C=ne();n.emit({kind:"performance",metric:x,value:S,screenName:Ox(),metadata:C?{...w,replay:C}:w,clientId:I!=null?I:`wd_${$()}`,timestamp:P()})},r=e.captureProfileOnIncident!==!1,s=!1,i=0,o=x=>{if(!r||s||!Yo())return;let S=P();S-i<Bx||(i=S,s=!0,Yf(Nx).then(w=>{w&&t("js_profile",w.samples,{profile:w.profile,format:"w3c-js-self-profiling",incidentClientId:x})}).finally(()=>{s=!1}))},a=em(e.thresholds),c=new us,l=0,u=0,d=typeof globalThis.PressureObserver=="function",p=new ls({thresholds:a,now:P,pressureAvailable:d,onIncident:x=>{var w;l++,c.noteIncident();let S=`wd_${$()}`;t("resource_incident",(w=x.value)!=null?w:1,x,S),n.signal("resource_pressure"),o(S)}}),f=fd(x=>p.onJank(x)),m=im({onHeartbeat:x=>{p.onHeartbeat(x),c.onHeartbeat(x)},onPressure:x=>{p.onPressure(x),c.onPressure(x)},onMemory:(x,S)=>{p.onMemory(x,S),c.onMemory(x)}},{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 x=c.drain(h(),p.dropped);t("resource_health",x.lagP95,x)},(b=e.rollupMs)!=null?b:3e4);return{stop:()=>{clearInterval(g),f(),m.stop()},stats:()=>({incidents:l,droppedIncidents:p.dropped,rollups:u,tiers:h()})}}var Lx,Nx,Bx,cm=E(()=>{"use strict";q();Fe();ki();Xf();tm();rm();om();Xo();Lx={stop:()=>{},stats:()=>({incidents:0,droppedIncidents:0,rollups:0,tiers:{pressure:!1,memory:!1}})};Nx=1e4,Bx=6e4});var hm={};_(hm,{EXIT_THRESHOLD:()=>dm,EXIT_WEIGHTS:()=>lm,REVERSAL_DEFAULTS:()=>Qo,ScrollReversalDetector:()=>fs,canFire:()=>mm,isTopExit:()=>pm,reversalMetrics:()=>fm,startExitIntent:()=>qx});function pm(n,e,t=um){return n&&e<=t}function fm(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 mm(n,e,t,r={}){var s,i;return!(t>=((s=r.maxFires)!=null?s:$x)||e>0&&n-e<((i=r.cooldownMs)!=null?i:Hx))}function qx(n,e){if(typeof window=="undefined"||typeof document=="undefined")return{stop:()=>{},fires:()=>0};let t=0,r=0,s={...Qo,...e!=null?e:{}},i=new fs(s),o=()=>{try{return kt(window.scrollY||0,document.documentElement.scrollHeight,window.innerHeight||0)}catch{return 0}},a=(u,d)=>{let p=lm[u];if(p===void 0||p<dm||!mm(Jo(),r,t))return;t++,r=Jo();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=>{pm(!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,Jo(),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 lm,dm,Hx,$x,um,Qo,fs,Jo,gm=E(()=>{"use strict";_n();lm={top_exit:.8,scroll_reversal:.5},dm=.5,Hx=3e4,$x=3,um=40,Qo={windowMs:120,minDistancePx:80,minVelocityPxMs:.7,minDepthPct:25,sustainSamples:3,topEdgePx:um};fs=class{constructor(e=Qo){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=fm(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)}};Jo=()=>typeof performance!="undefined"&&performance.now?performance.now():Date.now()});function zx(n){if(!n)return[];try{let e=JSON.parse(n);return Array.isArray(e)?e:[]}catch{return[]}}function Ux(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}var bm,Zo,hs,ym=E(()=>{"use strict";bm="scalebun_inapp_outbox";Zo=class{constructor(e,t=Ux()){this.post=e;this.storage=t;this.queue=[];this.flushing=!1;this.timer=null;var r,s;this.queue=zx((s=(r=this.storage)==null?void 0:r.getItem(bm))!=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(bm,JSON.stringify(this.queue))}catch{}}};hs=class{constructor(e,t){this.apiBaseUrl=e;this.clientKey=t;this.outbox=new Zo(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 Vx(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 ea(n,e){return!n||n.length===0?!0:n.some(t=>Vx(t).test(e))}function Wx(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 Kx(n){let e=n==null?void 0:n.segments;return e?e instanceof Set?e:new Set(e):new Set}function Gx(n,e){var r;let t=n.trim();if(!t)return!0;if(t.startsWith("segment:"))return Kx(e).has(t.slice(8).trim());for(let s of jx){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 Yx(n,e){return!n||!n.trim()?!0:n.split("&&").every(t=>Gx(t,e))}function wm(n,e,t){var s,i;let r=(s=n.targeting)!=null?s:{};return ea(r.route,e.route)?Wx(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"}:Yx(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 Xx(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}var jx,vm,gs,ta=E(()=>{"use strict";ns();jx=[">=","<=","!=","=",">","<"];vm="scalebun_inapp_freq",gs=class{constructor(e=Xx()){this.storage=e;this.map=this.load()}load(){var e;try{let t=(e=this.storage)==null?void 0:e.getItem(vm);return t?JSON.parse(t):{}}catch{return{}}}save(){var e;try{(e=this.storage)==null||e.setItem(vm,JSON.stringify(this.map))}catch{}}canShow(e,t){var i;let r=e.frequency,s=this.map[e.id];return s?!(s.dismissed&&((i=e.dismiss)!=null&&i.persistDismiss)||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 s;let r=(s=this.map[e])!=null?s:{count:0,lastShown:0};r.count+=1,r.lastShown=t,this.map[e]=r,this.save()}recordDismiss(e,t){var s;let r=(s=this.map[e])!=null?s:{count:0,lastShown:0};r.dismissed=!0,r.lastShown=t,this.map[e]=r,this.save()}clear(){this.map={},this.save()}}});var xm=E(()=>{"use strict"});function Sm(n,e){var t,r,s;if(n.type!==e.type)return!1;switch(n.type){case"route":return ea(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 km(){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 Em(){let n=null;return{type:"event",start(e){n=e},stop(){n=null},fireEvent(e){n==null||n.fire({type:"event",value:e})}}}function Im(){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 bs,Cm=E(()=>{"use strict";ta();xm();bs=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 Zx(n,e){var r,s;let t=Math.max(0,Math.min(120,120-(e-n.triggeredAt)/1e3));return Jx[n.tier]+((r=n.campaignPriority)!=null?r:0)+t+((s=Qx[n.category])!=null?s:0)}function Rm(n,e,t,r){var y;let s=r.now,i=n.map(b=>({c:b,score:Zx(b,s)})).sort((b,x)=>x.score-b.score||b.c.id.localeCompare(x.c.id)),o=[],a=(b,x,S,w,I)=>o.push({id:b.id,action:x,reason:S,zone:b.zone,score:w,preempts:I}),c=new Map,l=new Map,u=e.filter(b=>b.zone==="toast").length,d=0,p=e.some(b=>ys(b.zone)),f=!1,m=e.some(b=>b.tier==="critical")||!1,h=t.tokens,g=t.interruptionsThisSession,k=t.modalsToday,v=t.lastInterruptionAt;for(let{c:b,score:x}of i){if(b.campaignId){if(c.has(b.campaignId)){a(b,"DROP","dedupe:campaign",x);continue}c.set(b.campaignId,x)}let S=(y=r.guard)==null?void 0:y.call(r,b);if(S){a(b,S.action,S.reason,x);continue}if(b.interactionOnly){a(b,"DEFER","interaction-only",x);continue}if(b.guidance&&m){a(b,"DEFER","defer-until-clear",x);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",x);continue}if(ys(b.zone)&&p){a(b,"QUEUE","queue:focus-busy",x);continue}if(b.zone==="toast"&&u+d>=3){a(b,"QUEUE","queue:toast-cap",x);continue}if(b.cost>0){if(g>=t.maxInterruptionsPerSession){a(b,"QUEUE","queue:budget:interruptions",x);continue}if(b.zone==="modal"&&k>=t.maxModalsPerDay){a(b,"QUEUE","queue:budget:modals",x);continue}if(f||s-v<t.minCooldownMs){a(b,"QUEUE","queue:cooldown",x);continue}if(h<b.cost){a(b,"QUEUE","queue:budget:tokens",x);continue}}let I;if(b.tier==="critical"){let C=e.find(M=>M.zone===b.zone&&!ys(M.zone)&&Am[M.tier]<Am.critical);C&&(I=C.id)}a(b,I?"PREEMPT":"SHOW",I?"preempt:critical":"show",x,I),l.set(b.zone,b.id),b.zone==="toast"&&d++,ys(b.zone)&&(p=!0),b.tier==="critical"&&(m=!0),b.cost>0&&(h-=b.cost,g++,b.zone==="modal"&&k++,f=!0,v=s)}return o}var Jx,Qx,Am,ys,Tm=E(()=>{"use strict";Jx={critical:1e3,high:400,normal:200,low:100,passive:50},Qx={security:300,system:250,billing:200},Am={critical:4,high:3,normal:2,low:1,passive:0};ys=n=>n==="modal"||n==="takeover"});function eS(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 tS(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 nS(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 rS(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 sS(n,e={}){var o,a,c;let{surface:t,surfaceOptions:r}=eS(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:tS(n),priority:n.layout==="fullscreen"?"high":"normal",triggers:nS(n),targeting:{...i?{route:[i]}:{},...s&&e.anchorSelector?{element:e.anchorSelector}:{}},frequency:rS(n),dismiss:{xButton:!0,escClose:!0,backdropClose:n.layout==="modal"},motion:{reducedMotionFallback:"fade"},contract:{payloadVersion:1}}}function Mm(n,e={}){return(n!=null?n:[]).map(t=>sS(t,e))}var Pm=E(()=>{"use strict"});function iS(n){var e;return(e=n==null?void 0:n.engine)!=null?e:"compat"}function Lm(n){var r;let e=iS(n.config);if(e==="legacy")return[];let t=[];return(e==="native"||e==="compat")&&t.push(...(r=n.nativeVariants)!=null?r:[]),e==="compat"&&t.push(...Mm(n.legacyMessages)),t.filter(Cu)}var _m=E(()=>{"use strict";Pm();Fr()});var Om={};_(Om,{InAppEngine:()=>na});var oS,na,Nm=E(()=>{"use strict";ym();Cm();ta();Tm();_m();ss();Zi();Co();Fr();Oi();oS=120,na=class{constructor(e){this.deps=e;this.freq=new gs;this.host=new cn;this.slots=new Tt;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.transport=new hs(e.apiBaseUrl,e.clientKey),this.bus=new bs(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=Lm({legacyMessages:t.inAppMessages,nativeVariants:r,config:this.deps.config}),this.variants.length!==0&&(this.unsub||(this.host.ensure(),this.bus.use(km()),this.bus.use(Em()),this.bus.use(Im()),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=>Sm(s,e))&&wm(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:Pt(e),focus:no[e.surface],cost:ro[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()},oS))}async tick(){let e=[...this.pending.values()];if(e.length===0)return;let t=[...this.live.values()].map(s=>s.occ),r=Rm(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 Io(e,s,{host:this.host,slots:this.slots});this.live.set(e.id,{occ:{id:e.id,zone:Pt(e),focus:no[e.surface],tier:e.priority},surface:i});let o=ro[e.surface];o>0&&(this.budget.interruptionsThisSession++,this.budget.lastInterruptionAt=t(),this.budget.tokens=Math.max(0,this.budget.tokens-o),Pt(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 sa={};_(sa,{SegmentBuffer:()=>ra,approxBytes:()=>dn});function dn(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 ra,ws=E(()=>{"use strict";ra=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=dn(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=dn(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 aS(n,e){return n>700||e>800?3:n>350||e>400?2:n>150||e>100?1:0}function Bm(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 xs,Fm=E(()=>{"use strict";xs=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=aS(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 ia(n){let e=n;for(let t of lS)e=e.replace(t,cS);return e}function Dm(n){let e=n.snapshot;e&&typeof e=="object"&&Ss(e);let t=n.mutations;if(Array.isArray(t))for(let r of t)dS(r)}function Ss(n){var e;if(n.t==="tx"||n.t==="cm"){typeof n.value=="string"&&(n.value=ia(n.value));return}if(n.attrs)for(let t in n.attrs)typeof n.attrs[t]=="string"&&(n.attrs[t]=ia(n.attrs[t]));if(Array.isArray(n.children))for(let t of n.children)Ss(t);if((e=n.shadow)!=null&&e.children)for(let t of n.shadow.children)Ss(t)}function dS(n){(n.op==="text"||n.op==="attr")&&typeof n.value=="string"&&(n.value=ia(n.value)),n.op==="add"&&n.node&&Ss(n.node)}var cS,lS,Hm=E(()=>{"use strict";cS="[redacted]",lS=[/\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 zm={};_(zm,{deviceMemoryGB:()=>qm,networkHint:()=>$m,shouldDeferHeavyEgress:()=>oa,userOptedOutOfTracking:()=>pS});function uS(){if(typeof navigator!="undefined")return navigator.connection}function $m(){let n=uS(),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 pS(){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 qm(){if(typeof navigator=="undefined")return;let n=navigator.deviceMemory;return typeof n=="number"?n:void 0}function oa(){let n=$m();if(n.saveData||n.slow)return!0;let e=qm();return typeof e=="number"&&e<=1}var aa=E(()=>{"use strict"});function ca(){try{if(typeof sessionStorage!="undefined"){let n=sessionStorage.getItem(Um);return n||(n=`t_${$()}`,sessionStorage.setItem(Um,n)),n}}catch{}return ks!=null?ks:ks=`t_${$()}`}function la(){try{return typeof location!="undefined"?location.pathname+location.search:void 0}catch{return}}function da(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}var Um,ks,Vm=E(()=>{"use strict";q();Um="scalebun_replay_tab"});var pa={};_(pa,{GZ_PREFIX:()=>un,ReplayEncoder:()=>ua,decodeSnapshotValue:()=>mS,gunzipBase64:()=>jm,gzipBase64:()=>Wm});async function Wm(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 hS(new Uint8Array(r))}async function jm(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 mS(n){return typeof n=="string"&&n.startsWith(un)?JSON.parse(await jm(n.slice(un.length))):n}function hS(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 un,fS,ua,fa=E(()=>{"use strict";un="gz:",fS=`
573
- self.onmessage = async (e) => {
574
- const { id, json } = e.data;
575
- try {
576
- const cs = new CompressionStream('gzip');
577
- const w = cs.writable.getWriter();
578
- w.write(new TextEncoder().encode(json)); w.close();
579
- const ab = await new Response(cs.readable).arrayBuffer();
580
- const bytes = new Uint8Array(ab);
581
- let bin = ''; const CH = 0x8000;
582
- for (let i = 0; i < bytes.length; i += CH) bin += String.fromCharCode.apply(null, bytes.subarray(i, i + CH));
583
- self.postMessage({ id, out: btoa(bin) });
584
- } catch (err) {
585
- self.postMessage({ id, err: String(err) });
586
- }
587
- };
588
- `,ua=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([fS],{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 un+await this.viaWorker(t)}catch{this.disableWorker()}if(typeof CompressionStream!="undefined")try{return un+await Wm(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 Km(n){var e;return(e=n.shadowRoot)!=null?e:null}function Es(n,e){e.remove(n);let t=Km(n);t&&t.childNodes.forEach(r=>Es(r,e)),n.childNodes.forEach(r=>Es(r,e))}function Is(n,e=[]){let t=Km(n);return t&&(e.push(t),t.childNodes.forEach(r=>Is(r,e))),n.childNodes.forEach(r=>Is(r,e)),e}function ma(n,e){e.add(n),n.childNodes.forEach(t=>ma(t,e))}var Gm=E(()=>{"use strict"});var ha={};_(ha,{MutationRecorder:()=>ft,buildMutations:()=>Ym});function gS(n){Cs.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 Cs)try{r(this,t)}catch{}return t})}function bS(n){Cs.delete(n),Cs.size===0&&Ht&&(Element.prototype.attachShadow=Ht,Ht=null)}function As(n,e){n.childNodes.forEach(t=>{if(t.nodeType!==1)return;let r=t,s=r.shadowRoot;s&&(e(r,s),As(s,e)),As(r,e)})}function Ym(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 k=e.getId(g.target);if(k==null||!g.attributeName)continue;let v=g.target.getAttribute(g.attributeName);if(v!=null&&t.maskAllInputs&&Mr.has(g.attributeName)&&(v=Ge(v)),v!=null&&g.attributeName==="value"&&At(g.target)&&(v=Rt(v)),v!=null){let y=g.target;v=_r(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(`${k}:${g.attributeName}`,{op:"attr",id:k,key:g.attributeName,value:v})}else if(g.type==="characterData"){let k=e.getId(g.target);if(k==null)continue;let v=(m=(f=g.target.parentNode)==null?void 0:f.nodeName)!=null?m:"",y=g.target.data,x=(t.maskAllText||Pr(g.target.parentElement,t.maskSel))&&!Tr.has(v)?Ge(y):y;s.set(k,{op:"text",id:k,value:x})}else g.type==="childList"&&(g.removedNodes.forEach(k=>{var y;let v=e.getId(k);v!=null&&(i.push({op:"remove",parent:(y=e.getId(g.target))!=null?y:0,id:v}),Es(k,e))}),g.addedNodes.forEach(k=>o.push({node:k,parent:g.target,next:g.nextSibling})));let a=new Set,c=[];for(let{node:g,parent:k,next:v}of o){if(a.has(g)||!g.isConnected)continue;let y=e.getId(k);if(y==null)continue;let b=Ye(g,e,t);b&&(ma(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 Cs,Ht,ft,pn=E(()=>{"use strict";et();Gm();Cs=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,As(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:Lr(s,this.reg,this.o)}])},gS(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),As(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&&(bS(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=Ym(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 Is(r)){let i=this.shadowObservers.get(s);i&&(i.disconnect(),this.shadowObservers.delete(s))}})}}});var ba={};_(ba,{InteractionRecorder:()=>ga});function Xm(){try{return typeof location!="undefined"?location.href:""}catch{return""}}function wS(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 xS(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 SS(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,vS))!=null?r:null,a=o!=null?o:i;return{tag:a.tagName.toLowerCase(),interactive:!!o,role:o?wS(a):void 0,label:xS(a,e)}}catch{return}}function Jm(n){for(let e=0;e<n.length;e++)if(n[e].nodeType===1)return!0;return!1}function kS(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 yS,ga,vS,ya=E(()=>{"use strict";et();yS={moveThrottleMs:50,scrollThrottleMs:100,flushMs:100,deadMs:700,rageWindowMs:800,rageRadius:30,rageMin:3,maskInputs:!0,maskText:!0},ga=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=SS(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:"";At(t)?s=Rt(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={...yS,...r}}notifyDomActivity(e=Date.now()){this.lastActivityT=e}observe(){typeof document!="undefined"&&(this.startHref=Xm(),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?kS(m.target,c):!1,g=m.type==="childList"&&(Jm(m.addedNodes)||Jm(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&&Xm()===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)}};vS='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 nh={};_(nh,{bridgeCrossOriginFrame:()=>va,installChildSatellite:()=>ES,nodeIdBaseFor:()=>wa});function ES(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!==Qm||s||!th(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=Ye(document,c,t);u&&l({scalebun:Zm,doc:u}),r=new ft(c,d=>l({scalebun:eh,mutations:d}),e),r.observe(document.documentElement)};return window.addEventListener("message",i),()=>{window.removeEventListener("message",i),r==null||r.disconnect()}}function va(n,e,t){let r=n.contentWindow;if(!r)return()=>{};let s=a=>{if(a.source!==r||!th(a.origin,t.allowedChildOrigins))return;let c=a.data;c&&(c.scalebun===Zm&&c.doc?t.emit([{op:"iframe",id:e,doc:c.doc}]):c.scalebun===eh&&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:Qm,nodeIdBase:t.nodeIdBase},i)}catch{}};return o(),n.addEventListener("load",o),()=>{window.removeEventListener("message",s),n.removeEventListener("load",o)}}var Qm,Zm,eh,th,wa,xa=E(()=>{"use strict";sn();et();pn();Qm="scalebun:frame-init",Zm="scalebun:frame-key",eh="scalebun:frame-mut",th=(n,e)=>e.includes("*")||e.includes(n);wa=n=>n*1e6});var ka={};_(ka,{IframeManager:()=>Sa});var Sa,Ea=E(()=>{"use strict";et();pn();xa();Sa=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=Ye(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=va(e,t,{nodeIdBase:wa(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 rh={};_(rh,{CanvasRecorder:()=>Ia});var IS,Ia,sh=E(()=>{"use strict";IS="data-scalebun-block",Ia=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(IS)))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 ih={};_(ih,{installCadence:()=>CS});function CS(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 oh=E(()=>{"use strict"});var dh={};_(dh,{RecorderController:()=>Ts,createRecorder:()=>PS});async function PS(n,e){let t=new Ts(n,e);return await t.init(),t}function ch(){try{return typeof window!="undefined"?{width:window.innerWidth,height:window.innerHeight}:void 0}catch{return}}function lh(){try{return typeof location!="undefined"?location.href:void 0}catch{return}}var ah,Rs,AS,RS,TS,MS,Ts,uh=E(()=>{"use strict";q();Vt();Rn();ws();Fm();Hm();aa();Vm();Sn();ah=120,Rs=2e5,AS=8,RS=3e6,TS=3e4,MS=5*6e4;Ts=class{constructor(e,t){this.ctx=e;this.decision=t;this.active=!1;this.seq=Ys(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&&oa()&&(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=Ys(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,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(()=>(fa(),pa)),Promise.resolve().then(()=>(ws(),sa))]);this.segBuf=new t(AS,RS),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 k,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(),Nr)),Promise.resolve().then(()=>(et(),Or)),Promise.resolve().then(()=>(pn(),ha)),Promise.resolve().then(()=>(ya(),ba)),Promise.resolve().then(()=>(Ar(),Wi)),Promise.resolve().then(()=>(Ea(),ka))]),c=new t,l={maskAllText:this.maskText,maskAllInputs:(k=e.maskInputs)!=null?k:!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_${$()}`;let d={kind:"frame",renderer:"dom",frameType:"keyframe",frameId:this.keyframeId,seq:this.nextSeq(),snapshot:u,viewport:ch(),href:lh(),tabId:ca(),viewId:da(),route:la(),masked:!0,timestamp:P()};this.push(d),this.compressInPlace(d,u),this.persistPreRoll(),this.dirtySinceKeyframe=!1,this.lastKeyframeAt=P();let p=new i(c,x=>{this.push(this.delta({events:x}))},{maskText:!!l.maskAllText}),f=new s(c,x=>{p.notifyDomActivity(),this.push(this.delta({mutations:x}))},l),m=new o(c,x=>{p.notifyDomActivity(),this.push(this.delta({mutations:x}))}),h=new a(c,x=>{p.notifyDomActivity(),this.push(this.delta({mutations:x}))},l,{onFrame:(x,S)=>p.observeFrame(x,S),onUnframe:x=>p.unobserveFrame(x),frameOrigins:(y=e.replayFrameOrigins)!=null?y:[]});if(((b=e.replayFrameOrigins)!=null?b:[]).length&&Promise.resolve().then(()=>(xa(),nh)).then(({installChildSatellite:x})=>{var S;this.childSatelliteStop=x((S=e.replayFrameOrigins)!=null?S:[],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:x}=await Promise.resolve().then(()=>(sh(),rh)),S=new x(c,w=>{p.notifyDomActivity(),this.push(this.delta({mutations:w}))},(...w)=>e.log(...w));S.start(),this.disconnectCanvas=()=>S.disconnect()}this.adaptive=new xs(e.egressPending);let{installCadence:g}=await Promise.resolve().then(()=>(oh(),ih));this.disconnectCadence=g({keyframeIntervalMs:TS,onCheckpoint:x=>this.checkpoint(x)})}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_${$()}`,baseFrameId:this.keyframeId,seq:this.nextSeq(),...e,tabId:ca(),viewId:da(),route:la(),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=Bm(e,this.adaptive.level);if(!r){this.shed++;return}e=r}if(this.streaming){this.ctx.emit(e),e.frameType==="delta"&&(this.streamChainBytes+=dn(e),this.streamChainFrames++,!this.checkpointing&&(this.streamChainFrames>=ah||this.streamChainBytes>=Rs)&&this.checkpoint(this.streamChainBytes>=Rs?"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>=ah||t.currentBytes>=Rs)&&this.checkpoint(t.currentBytes>=Rs?"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<MS)){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_${$()}`;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:ch(),href:lh(),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=bc(r+1),await this.replayStore.clear()}}catch{}}persistPreRoll(){!this.replayStore||!this.segBuf||this.streaming||this.replayStore.save(St(this.segBuf.drainFrames()))}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 ph={};_(ph,{decideSampling:()=>OS});function OS(n,e){let t={..._S,...n},r=Le(e,LS),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 LS,_S,fh=E(()=>{"use strict";Fe();LS="wzb-replay-v1",_S={mode:"sampled",sampleRate:1,onErrorSampleRate:1}});var hh={};_(hh,{installWebGLPreserve:()=>BS});function mh(n){if(!n||typeof n.getContext!="function")return null;let e=n;if(e[Ca])return null;let t=n.getContext,r=function(s,i){if(typeof s=="string"&&NS.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[Ca]=!0,()=>{n.getContext===r&&(n.getContext=t),delete e[Ca]}}function BS(){if(typeof HTMLCanvasElement=="undefined")return()=>{};let n=[];try{let e=mh(HTMLCanvasElement.prototype);if(e&&n.push(e),typeof OffscreenCanvas!="undefined"){let t=mh(OffscreenCanvas.prototype);t&&n.push(t)}}catch{}return()=>{for(let e of n)try{e()}catch{}}}var Ca,NS,gh=E(()=>{"use strict";Ca="__scalebunWebglPatched",NS=new Set(["webgl","webgl2","experimental-webgl","experimental-webgl2"])});var kh={};_(kh,{armSoftAsk:()=>US});function xh(){try{let n=Number(localStorage.getItem(Sh)||0);return Number.isFinite(n)&&n>Date.now()}catch{return!1}}function qS(n){try{localStorage.setItem(Sh,String(Date.now()+n*864e5))}catch{}}function zS(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 LS(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"&&Um(e.trigger)?"dropdown":"drawer",a=e.accent,c={...zm,...(Y=t==null?void 0:t.labels)!=null?Y:{},...(X=e.labels)!=null?X:{}},l=(ee=e.formatTime)!=null?ee:MS,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,PS(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 R=Z("div","foot"),L=document.createElement("button");L.type="button",L.textContent=c.viewAll,L.addEventListener("click",()=>{var N;J(),(N=e.onViewAll)==null||N.call(e)}),R.appendChild(L),m.appendChild(R)}p.append(f,m);let I,k,C=Um(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=RS,k=document.createElement("span"),k.className="badge",k.setAttribute("aria-hidden","true"),I.appendChild(k),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(),L=m.offsetWidth||360,N=m.offsetHeight||420,F=8,W=i?R.right-L:R.left;m.style.left=`${Math.max(F,Math.min(W,window.innerWidth-L-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 L,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=(L=p.activeElement)!=null?L: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 L=xe(),N=L[0],F=L[L.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 L=R.unreadCount;k&&(k.textContent=L>99?"99+":String(L),k.classList.toggle("on",L>0)),v.textContent=L>0?c.unread(L):c.noUnread,I&&I.setAttribute("aria-label",L>0?c.openUnread(L):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,L,N){let F=document.createElement("button");return F.type="button",F.innerHTML=R,F.setAttribute("aria-label",L),F.title=L,F.addEventListener("click",W=>{W.stopPropagation(),N()}),F}function K(R){var he,Ce,Ae;let L=Z("div","row"+(R.state==="unread"?" unread":""));L.setAttribute("role","listitem"),L.tabIndex=0,L.setAttribute("aria-label",`${R.title}${R.state==="unread"?", unread":""}`),L.dataset.id=R.id,L.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();L.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)}L.appendChild(F);let re=Z("div","ract"),ge=V(CS,R.pinned?c.unpin:c.pin,()=>void n.pin(R.id,!R.pinned));return R.pinned&&ge.classList.add("on"),re.append(ge,V(AS,c.archive,()=>void n.archive(R.id)),V(TS,c.delete,()=>void n.remove(R.id))),L.appendChild(re),L.addEventListener("click",()=>{R.state==="unread"&&n.markRead(R.id)}),L}function de(R){var re,ge,he;let L=R.target.closest(".row");if(!L)return;let N=[...w.querySelectorAll(".row")],F=N.indexOf(L),W=L.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))}w.addEventListener("keydown",de);function me(R){if(R.length<2){b.style.display="none",b.textContent="";return}b.style.display="flex",b.textContent="";let L=(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(L(c.allTab,null));for(let N of R)b.appendChild(L(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 L=(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(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()):L&&((st=w.querySelector(`.row[data-id="${L}"]`))==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 Um(n){if(!n)return null;if(typeof n=="string")try{return document.querySelector(n)}catch{return null}return n}var CS,AS,TS,RS,ha=E(()=>{"use strict";$();fa();CS='<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>',AS='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><path d="M3 7h18v3H3zM5 10v10h14V10M9 14h6"/></svg>',TS='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8"><path d="M4 7h16M9 7V4h6v3M6 7l1 13h10l1-13"/></svg>',RS='<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 Vm={};_(Vm,{InboxStore:()=>pn,NOOP_STORE:()=>ga});function OS(n){return new Promise(e=>{try{if(typeof indexedDB=="undefined")return e(null);let t=indexedDB.open(_S+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 _S,ze,nt,pn,ga,ba=E(()=>{"use strict";_S="scalebun_inbox_",ze="messages",nt="meta";pn=class{constructor(e){this.scope=e;this.dbp=null}db(){return this.dbp||(this.dbp=OS(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 Wm={};_(Wm,{InboxSync:()=>ya,InboxTransport:()=>va,mergeMessage:()=>wa,stateRank:()=>FS});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 BS)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 FS(n){return NS[n]}var NS,BS,ya,va,xa=E(()=>{"use strict";Cn();NS={unread:0,read:1,archived:2,deleted:3},BS=["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 Gm={};_(Gm,{InboxRuntime:()=>Sa});function Km(n){return`${n.createdAt}_${n.id}`}var jm,DS,Sa,Xm=E(()=>{"use strict";fa();ba();xa();jm={unread:0,read:1,archived:2,deleted:3},DS=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)&&jm[t]<=jm[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=>Km(u)===e.cursor);l>=0&&(r=r.slice(l+1))}let s=(c=e.limit)!=null?c:DS,i=r.slice(0,s),o=r.length>s,a=i.length?i[i.length-1]:void 0;return{messages:i,cursor:a?Km(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 Jm={};_(Jm,{InboxFeature:()=>ka});var Ym,ka,Qm=E(()=>{"use strict";$();Ym={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=Ym;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(()=>(Xm(),Gm)),Promise.resolve().then(()=>(ba(),Vm))]),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(),Wm)),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=Ym,this.active=!1}}});var Zm={};_(Zm,{ProfilerFeature:()=>Ea});function qS(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}var Ea,eh=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:qS(),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 th(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 nh=E(()=>{"use strict"});function oh(n){return n?{...rh,...n}:rh}var rh,sh,ih,Ca=E(()=>{"use strict";rh={pressureSustainMs:6e3,lagP95Ms:500,mainThreadStallMs:500,jankBurstCount:5,jankWindowMs:1e4,frozenFrameMs:700,memSurgeBytesPerSec:6291456,leakSamples:10,leakMinBytes:52428800,heapUsedRatio:.9,cooldownMs:6e4},sh=10*6e4,ih=10});function HS(n){if(!n.length)return 0;let e=Math.min(n.length-1,Math.floor(n.length*.95));return n[e]}var ks,Ss,ah=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=HS([...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<sh),this.emitTimes.length>=ih){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 ch(n,e){return n.length?n[Math.min(n.length-1,Math.floor(n.length*e))]:0}var Es,lh=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(ch(r,.5)),lagP95:Math.round(ch(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 dh(){try{return typeof document=="undefined"||document.visibilityState!=="hidden"}catch{return!0}}function uh(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=()=>{dh()?s||o():a()};typeof document!="undefined"&&(document.addEventListener("visibilitychange",c),t.push(()=>document.removeEventListener("visibilitychange",c))),dh()&&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 ph=E(()=>{"use strict";$()});var fh={};_(fh,{startWatchdog:()=>jS});function zS(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 US(){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(!zS(n.sessionId,e.sampleRate))return $S;let t=(w,x,I,k)=>{let C=ne();n.emit({kind:"performance",metric:w,value:x,screenName:US(),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<WS||(i=x,s=!0,th(VS).then(I=>{I&&t("js_profile",I.samples,{profile:I.profile,format:"w3c-js-self-profiling",incidentClientId:w})}).finally(()=>{s=!1}))},a=oh(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=wd(w=>p.onJank(w)),m=uh({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 $S,VS,WS,mh=E(()=>{"use strict";$();Fe();ki();nh();ah();lh();ph();Ca();$S={stop:()=>{},stats:()=>({incidents:0,droppedIncidents:0,rollups:0,tiers:{pressure:!1,memory:!1}})};VS=1e4,WS=6e4});var hh={};_(hh,{WatchdogFeature:()=>Aa});var KS,Aa,gh=E(()=>{"use strict";KS={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(()=>(mh(),fh));this.active&&(this.handle=t(e))}stats(){var e,t;return(t=(e=this.handle)==null?void 0:e.stats())!=null?t:KS}teardown(){var e;this.active=!1,(e=this.handle)==null||e.stop(),this.handle=void 0}}});function GS(n){if(!n)return[];try{let e=JSON.parse(n);return Array.isArray(e)?e:[]}catch{return[]}}function XS(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}var bh,Ta,Is,yh=E(()=>{"use strict";bh="scalebun_inapp_outbox";Ta=class{constructor(e,t=XS()){this.post=e;this.storage=t;this.queue=[];this.flushing=!1;this.timer=null;var r,s;this.queue=GS((s=(r=this.storage)==null?void 0:r.getItem(bh))!=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(bh,JSON.stringify(this.queue))}catch{}}};Is=class{constructor(e,t){this.apiBaseUrl=e;this.clientKey=t;this.outbox=new Ta(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 YS(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 Ra(n,e){return!n||n.length===0?!0:n.some(t=>YS(t).test(e))}function JS(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 ZS(n){let e=n==null?void 0:n.segments;return e?e instanceof Set?e:new Set(e):new Set}function ek(n,e){var r;let t=n.trim();if(!t)return!0;if(t.startsWith("segment:"))return ZS(e).has(t.slice(8).trim());for(let s of QS){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 tk(n,e){return!n||!n.trim()?!0:n.split("&&").every(t=>ek(t,e))}function xh(n,e,t){var s,i;let r=(s=n.targeting)!=null?s:{};return Ra(r.route,e.route)?JS(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"}:tk(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 rk(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}function sk(){try{return typeof sessionStorage!="undefined"?sessionStorage:null}catch{return null}}var QS,vh,wh,nk,Cs,Ma=E(()=>{"use strict";ss();QS=[">=","<=","!=","=",">","<"];vh="scalebun_inapp_freq",wh="scalebun_inapp_freq_session",nk=1,Cs=class{constructor(e=rk(),t="",r=sk()){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(wh),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(wh,JSON.stringify(this.session))}catch{}}load(){var e;try{let t=(e=this.storage)==null?void 0:e.getItem(vh);return t?JSON.parse(t):{}}catch{return{}}}save(){var e;try{(e=this.storage)==null||e.setItem(vh,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:nk;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 Sh=E(()=>{"use strict"});function kh(n,e){var t,r,s;if(n.type!==e.type)return!1;switch(n.type){case"route":return Ra(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 Eh(){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 Ih(){let n=null;return{type:"event",start(e){n=e},stop(){n=null},fireEvent(e){n==null||n.fire({type:"event",value:e})}}}function Ch(){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,Ah=E(()=>{"use strict";Ma();Sh();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 ak(n,e){var r,s;let t=Math.max(0,Math.min(120,120-(e-n.triggeredAt)/1e3));return ik[n.tier]+((r=n.campaignPriority)!=null?r:0)+t+((s=ok[n.category])!=null?s:0)}function Rh(n,e,t,r){var y;let s=r.now,i=n.map(b=>({c:b,score:ak(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=>Ts(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(Ts(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&&!Ts(M.zone)&&Th[M.tier]<Th.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++,Ts(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 ik,ok,Th,Ts,Mh=E(()=>{"use strict";ik={critical:1e3,high:400,normal:200,low:100,passive:50},ok={security:300,system:250,billing:200},Th={critical:4,high:3,normal:2,low:1,passive:0};Ts=n=>n==="modal"||n==="takeover"});function ck(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 lk(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 dk(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 uk(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 pk(n,e={}){var o,a,c;let{surface:t,surfaceOptions:r}=ck(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:lk(n),priority:n.layout==="fullscreen"?"high":"normal",triggers:dk(n),targeting:{...i?{route:[i]}:{},...s&&e.anchorSelector?{element:e.anchorSelector}:{}},frequency:uk(n),dismiss:{xButton:!0,escClose:!0,backdropClose:n.layout==="modal"},motion:{reducedMotionFallback:"fade"},contract:{payloadVersion:1}}}function Ph(n,e={}){return(n!=null?n:[]).map(t=>pk(t,e))}var Lh=E(()=>{"use strict"});function fk(n){var e;return(e=n==null?void 0:n.engine)!=null?e:"compat"}function _h(n){var r;let e=fk(n.config);if(e==="legacy")return[];let t=[];return(e==="native"||e==="compat")&&t.push(...(r=n.nativeVariants)!=null?r:[]),e==="compat"&&t.push(...Ph(n.legacyMessages)),t.filter(Bu)}var Oh=E(()=>{"use strict";Lh();qr()});var Nh={};_(Nh,{InAppEngine:()=>Pa});var mk,Pa,Bh=E(()=>{"use strict";yh();Ah();Ma();Mh();Oh();os();eo();Ao();qr();Oi();mk=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=_h({legacyMessages:t.inAppMessages,nativeVariants:r,config:this.deps.config}),this.variants.length!==0&&(this.unsub||(this.host.ensure(),this.bus.use(Eh()),this.bus.use(Ih()),this.bus.use(Ch()),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=>kh(s,e))&&xh(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()},mk))}async tick(){let e=[...this.pending.values()];if(e.length===0)return;let t=[...this.live.values()].map(s=>s.occ),r=Rh(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 Fh={};_(Fh,{InApp2Feature:()=>La});var La,Dh=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(()=>(Bh(),Nh));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 Vh={};_(Vh,{armSoftAsk:()=>xk});function zh(){try{let n=Number(localStorage.getItem(Uh)||0);return Number.isFinite(n)&&n>Date.now()}catch{return!1}}function vk(n){try{localStorage.setItem(Uh,String(Date.now()+n*864e5))}catch{}}function wk(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=`
589
671
  <style>
590
672
  :host{all:initial}
591
673
  .c{width:min(340px,calc(100vw - 32px));box-sizing:border-box;padding:16px 18px;border-radius:14px;
@@ -611,25 +693,25 @@ self.onmessage = async (e) => {
611
693
  <button class="no" type="button"></button>
612
694
  <button class="yes" type="button"></button>
613
695
  </div>
614
- </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 US(n,e){var o;if(typeof document=="undefined"||typeof Notification=="undefined"||e.permission()!=="default"||xh())return;let r={...$S,...n},s=async()=>{var l,u,d;if(e.permission()!=="default"||xh())return;if(!await zS(r)){qS(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 Sh,$S,Eh=E(()=>{"use strict";Sh="scalebun.push.softAsk.snoozedUntil",$S={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"}});function VS(n){let e=n.getBoundingClientRect();return{x:e.left,y:e.top,width:e.width,height:e.height}}function WS(){return{x:0,y:0,width:window.innerWidth||1024,height:window.innerHeight||768}}var jS,Ps,Ih=E(()=>{"use strict";vo();q();jS=`
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 xk(n,e){var o;if(typeof document=="undefined"||typeof Notification=="undefined"||e.permission()!=="default"||zh())return;let r={...yk,...n},s=async()=>{var l,u,d;if(e.permission()!=="default"||zh())return;if(!await wk(r)){vk(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 Uh,yk,Wh=E(()=>{"use strict";Uh="scalebun.push.softAsk.snoozedUntil",yk={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"}});function Sk(n){let e=n.getBoundingClientRect();return{x:e.left,y:e.top,width:e.width,height:e.height}}function kk(){return{x:0,y:0,width:window.innerWidth||1024,height:window.innerHeight||768}}var Ek,Rs,jh=E(()=>{"use strict";wo();$();Ek=`
615
697
  :host{all:initial}
616
698
  *{box-sizing:border-box;font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif}
617
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}
618
700
  .backdrop{position:fixed;inset:0;background:rgba(12,10,20,.55);z-index:2147483600}
619
- .card{position:fixed;z-index:2147483602;max-width:320px;background:#1b1922;color:#edeaf2;border-radius:12px;
701
+ .card{position:fixed;z-index:2147483602;width:min(320px,calc(100vw - 32px));background:#1b1922;color:#edeaf2;border-radius:12px;
620
702
  padding:16px 18px;box-shadow:0 12px 40px rgba(0,0,0,.4);border:1px solid rgba(255,255,255,.08)}
621
703
  .card.modal{top:50%;left:50%;transform:translate(-50%,-50%)}
622
704
  .arrow{position:absolute;width:12px;height:12px;background:inherit;border:inherit;transform:rotate(45deg)}
623
- .t{font-size:15px;font-weight:700;margin:0 0 6px}
705
+ .t{font-size:15px;font-weight:700;margin:0 0 6px;padding-right:20px}
624
706
  .b{font-size:13px;line-height:1.5;color:#c8c3d4;margin:0 0 14px}
625
- .ft{display:flex;align-items:center;justify-content:space-between;gap:10px}
626
- .count{font-size:11px;color:#9a95a6;font-variant-numeric:tabular-nums}
627
- .btns{display:flex;gap:8px}
707
+ .ft{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}
708
+ .count{font-size:11px;color:#9a95a6;font-variant-numeric:tabular-nums;flex:none;white-space:nowrap}
709
+ .btns{display:flex;gap:8px;flex:none}
628
710
  button{font:inherit;cursor:pointer;border-radius:8px;border:none}
629
711
  .skip{background:none;color:#9a95a6;font-size:12px;padding:6px 8px}
630
712
  .back{background:#262131;color:#edeaf2;font-size:12px;font-weight:600;padding:7px 12px}
631
713
  .next{background:#7c6cf0;color:#fff;font-size:12px;font-weight:600;padding:7px 14px}
632
714
  .x{position:absolute;top:10px;right:12px;background:none;color:#9a95a6;font-size:17px;line-height:1;padding:2px}
633
- @media(prefers-reduced-motion:reduce){.spot{transition:none}}`,Ps=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,jS),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=VS(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=Zr({anchor:t,tooltip:r,boundary:WS(),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 Ah={};_(Ah,{CoachmarkFeature:()=>Aa});var Ch,Aa,Rh=E(()=>{"use strict";es();Ih();wo();Jr();ns();Ch="scalebun_coach_progress",Aa=class{constructor(e){this.deps=e;this.hub=new tt;this.renderer=new Ps;this.listeners=new Map;this.toursCache=null;this.reportedAnchors=new Set;this.engine=new Dt({hub:this.hub,resolveAnchor:t=>pt(t),waitFor:(t,r,s)=>ts(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 $p())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(Ch)||"{}")}catch{return{}}}persist(e,t){try{let r=this.progress();t<0?delete r[e]:r[e]=t,localStorage.setItem(Ch,JSON.stringify(r))}catch{}}loadIndex(e){return this.progress()[e]}dispose(){this.engine.dispose(),this.renderer.hide(),this.hub.dispose(),this.listeners.clear()}}});function Ls(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 Th,Ra=E(()=>{"use strict";Th={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 Ta={};_(Ta,{notInitializedReport:()=>QS,runPushDiagnostics:()=>JS});function KS(){return typeof navigator!="undefined"&&"serviceWorker"in navigator&&typeof window!="undefined"&&"PushManager"in window&&"Notification"in window}function GS(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 YS(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 XS(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 JS(n){var m,h,g,k,v,y,b,x,S;let e=[],t=w=>(e.push(w),w),r=(w,I,C)=>{t({id:w,status:"unknown",label:I,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&&KS(),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"),Mh(e);let c=null;try{let w=await fetch(n.serviceWorkerUrl,{method:"HEAD",cache:"no-store"});c=w.ok,t({id:"sw_reachable",status:w.ok?"pass":"fail",label:"Service worker file is reachable",detail:`GET ${n.serviceWorkerUrl} \u2192 ${w.status}`,fix:w.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=(k=(h=l==null?void 0:l.active)==null?void 0:h.scriptURL)!=null?k:(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 w=await XS(l);!w||typeof w.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/.`}):w.version<n.expectedSwVersion?t({id:"sw_version",status:"warn",label:"Service worker is up to date",detail:`Worker is v${w.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${w.version}`})}else r("sw_version","Service worker is up to date","no ScaleBun worker is registered");let p=null;try{let w=await fetch(`${n.apiBaseUrl}/sdk/engage/push-config`,{headers:{"content-type":"application/json","x-scalebun-client-key":n.clientKey},cache:"no-store"}),I=w.ok?await w.json():null;p=(I==null?void 0:I.enabled)===!1?null:(x=I==null?void 0:I.vapidPublicKey)!=null?x: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 w=l?await l.pushManager.getSubscription():null;if(!w)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 I=w.toJSON(),C=typeof I.expirationTime=="number"&&I.expirationTime<=Date.now(),M=null;if(p){let A=(S=w.options)==null?void 0:S.applicationServerKey;M=A?YS(new Uint8Array(A),GS(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":w.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 w=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"}),I=w.ok?await w.json():null;if(!I)t({id:"device_registered",status:"unknown",label:"Device registered with ScaleBun",detail:`Status lane returned ${w.status}`}),r("identified","User is identified","the server did not answer");else{let C=I.tokenStatus==="dead";t({id:"device_registered",status:I.registered&&!C?"pass":"fail",label:"Device registered with ScaleBun",detail:I.registered?C?"Token marked dead by the push service":"Registered and active":"No push token stored for this device",fix:I.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:I.identified?"pass":"warn",label:"User is identified",detail:I.identified?"Bound to a person":"Anonymous device",fix:I.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 Mh(e)}function QS(){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 Mh(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 Ma=E(()=>{"use strict"});var Lh={};_(Lh,{DEFAULT_SW_URL:()=>Pa,EXPECTED_SW_VERSION:()=>Ph,PUSH_STATE_COPY:()=>Th,PushFeature:()=>La,resolvePushState:()=>Ls});function _s(){return typeof navigator!="undefined"&&"serviceWorker"in navigator&&typeof window!="undefined"&&"PushManager"in window&&"Notification"in window}function ZS(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 Ph,Pa,mn,La,_h=E(()=>{"use strict";Ra();Ra();Ph=5,Pa="/scalebun-push-sw.js";mn=class mn{constructor(e){this.reg=null;this.lastEndpoint=null;this.swUrl=Pa;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(!_s())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||Pa;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:ZS(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||(_s()?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||(_s()?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(()=>(Ma(),Ta));return t({apiBaseUrl:this.deps.apiBaseUrl,clientKey:this.deps.clientKey,deviceId:this.deps.deviceId,serviceWorkerUrl:e.serviceWorkerUrl||this.swUrl,expectedSwVersion:Ph})}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=_s(),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:Ls({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";La=mn});var Da="https://api.scalebun.com/api/v1";var Fh=["authorization","cookie","set-cookie","x-api-key","x-csrf-token","password","token","secret"];function Ha(n){var t,r,s,i,o,a,c,l,u,d,p,f,m,h,g,k,v,y,b,x,S,w,I,C,M,R,A,O,z,D,te,J,Q,fe,ce,xe,Se,le,H,V,K,de,me,se,Ue,Ve,G,ie,X,Y,ee,T,L,N,F,W,re,ge,he,Ie,Ce,Ae,Je,st,ke,gn,Oa,Na,Ba,Fa;if(!n||!n.clientKey)throw new Error("[scalebun] clientKey is required");let e=((t=n.apiBaseUrl)!=null?t:Da).replace(/\/$/,"");return{clientKey:n.clientKey,apiBaseUrl:e,environment:n.environment,release:n.release,appVersion:n.appVersion,flushIntervalMs:(r=n.flushIntervalMs)!=null?r: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:(s=n.replayCanvas)!=null?s:!1,signSessionLane:(i=n.signSessionLane)!=null?i:!1,replayFrameOrigins:(o=n.replayFrameOrigins)!=null?o:[],autocapture:(a=n.autocapture)!=null?a:!0,tracePropagation:(c=n.tracePropagation)!=null?c:!0,tracePropagationOrigins:(l=n.tracePropagationOrigins)!=null?l:[],maxBatchSize:(u=n.maxBatchSize)!=null?u:50,maxQueueSize:(d=n.maxQueueSize)!=null?d:1e3,debug:(p=n.debug)!=null?p:!1,features:{errors:(m=(f=n.features)==null?void 0:f.errors)!=null?m:!0,network:(g=(h=n.features)==null?void 0:h.network)!=null?g:!0,console:(v=(k=n.features)==null?void 0:k.console)!=null?v:!0,webVitals:(b=(y=n.features)==null?void 0:y.webVitals)!=null?b:!0,performance:(S=(x=n.features)==null?void 0:x.performance)!=null?S:!0,journey:(I=(w=n.features)==null?void 0:w.journey)!=null?I:!0,replay:(M=(C=n.features)==null?void 0:C.replay)!=null?M:!1,bugReport:(A=(R=n.features)==null?void 0:R.bugReport)!=null?A:!0,crash:(z=(O=n.features)==null?void 0:O.crash)!=null?z:!0,config:(te=(D=n.features)==null?void 0:D.config)!=null?te:!0,engage:(Q=(J=n.features)==null?void 0:J.engage)!=null?Q:!0,analytics:(ce=(fe=n.features)==null?void 0:fe.analytics)!=null?ce:!0,webPerf:(Se=(xe=n.features)==null?void 0:xe.webPerf)!=null?Se:!0,profiler:(H=(le=n.features)==null?void 0:le.profiler)!=null?H:!1,watchdog:(K=(V=n.features)==null?void 0:V.watchdog)!=null?K:!1,inbox:(me=(de=n.features)==null?void 0:de.inbox)!=null?me:!1,inapp2:(Ue=(se=n.features)==null?void 0:se.inapp2)!=null?Ue:!1},watchdog:n.watchdog,exitIntent:n.exitIntent,privacy:{captureNetworkBodies:(G=(Ve=n.privacy)==null?void 0:Ve.captureNetworkBodies)!=null?G:!1,denylist:[...Fh,...(X=(ie=n.privacy)==null?void 0:ie.denylist)!=null?X:[]].map(Nh=>Nh.toLowerCase()),maskSelectors:(ee=(Y=n.privacy)==null?void 0:Y.maskSelectors)!=null?ee:[],maskReplayText:(L=(T=n.privacy)==null?void 0:T.maskReplayText)!=null?L:!1,maskInputs:(re=(W=(N=n.privacy)==null?void 0:N.maskInputs)!=null?W:(F=n.privacy)==null?void 0:F.maskReplayText)!=null?re:!1,respectDnt:(he=(ge=n.privacy)==null?void 0:ge.respectDnt)!=null?he:!1,maskEventText:(Ce=(Ie=n.privacy)==null?void 0:Ie.maskEventText)!=null?Ce:!1},consent:{required:(Ae=n.requireConsent)!=null?Ae:!1,initial:(Je=n.initialConsent)!=null?Je:"unknown"},bugReport:{launcher:(ke=(st=n.bugReportOptions)==null?void 0:st.launcher)!=null?ke:!1,position:(Oa=(gn=n.bugReportOptions)==null?void 0:gn.position)!=null?Oa:"bottom-right",label:(Ba=(Na=n.bugReportOptions)==null?void 0:Na.label)!=null?Ba:"Report a bug"},...(Fa=n.engageOptions)!=null&&Fa.onInAppGameRequest?{onInAppGameRequest:n.engageOptions.onInAppGameRequest}:{}}}q();q();Sn();var kn=class{constructor(e){this.config=e;var r,s;let t=hc((r=e.sessionTimeoutMs)!=null?r:Ut,(s=e.sessionMaxDurationMs)!=null?s:Gs);this.sessionId=t.id,this.deviceId=qa()}client(){return Wa()}device(){return ja(this.deviceId)}app(){return Ka(this.config)}context(){return gc(),Ga()}};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(()=>(Qs(),Js));return{...t,...await r(this.config.clientKey,e)}}async startSession(e){var t,r,s,i,o,a,c;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,startedAt:Date.now()})}async sendBatch(e,t){let r=`${this.config.apiBaseUrl}/ingestion/sessions/${encodeURIComponent(e.sessionId)}/batch`;return this.post(r,e,t==null?void 0:t.keepalive)}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!1;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(()=>(xc(),wc)),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}catch{return!1}}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();q();Cn();Rn();var dg=1,Tn=class{constructor(e,t,r){this.config=e;this.session=t;this.transport=r;this.queue=[];this.timer=null;this.droppedCount=0;this.started=!1;this.dead=!1;this.lifecycle=[];this.buffer=new Be;this.backoff=new xt;this.flushing=!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;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.droppedCount+=s.length-i.length,i.length&&(r&&r!==this.session.sessionId?this.drainOrphans(r,i):this.queue.unshift(...i))}catch{}this.transport.startSession({sessionId:this.session.sessionId,client:this.session.client(),device:this.session.device(),app:this.session.app(),context:this.session.context()}),this.timer=setInterval(()=>this.autoFlush(),this.config.flushIntervalMs),this.installLifecycleFlush()}}emit(e){if(!this.consentGranted){this.droppedCount++;return}this.queue.length>=this.config.maxQueueSize&&(this.queue.shift(),this.droppedCount++),this.queue.push(e)}persistQueue(){let e=this.inFlight.length?[...this.inFlight,...this.queue]:this.queue;this.buffer.save([this.session.sessionId,St(e,t=>t.kind==="frame")])}autoFlush(){this.dead||!ot()||!this.backoff.ready(P())||this.flush()}async flush(e){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.transport.sendBatch(this.buildEnvelope(t),e)?(this.backoff.reset(),this.inFlight=[]):(this.backoff.fail(P()),this.queue.unshift(...t),this.inFlight=[],this.persistQueue())}catch{this.backoff.fail(P()),this.queue.unshift(...t),this.inFlight=[],this.persistQueue()}finally{this.flushing=!1}}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=!1;try{r=await this.transport.sendBatch({...this.buildEnvelope(t),sessionId:e})}catch{}r||this.buffer.save([e,t])}buildEnvelope(e){return{schemaVersion:dg,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}};function ug(n){return/dynamically imported module|module script failed|error loading dynamically/i.test(n)}var Mn=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:ug(o)})}catch{}}}teardownAll(){for(let e of this.features.values())try{e.teardown()}catch{}this.features.clear()}};q();var Ec={drop:!1,warnings:[]};function Ic(n,e,t){var o,a;if(!n||e.startsWith("$"))return Ec;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`]}:Ec;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 pg=/^[A-Za-z]{3}$/;function fg(n){return pg.test(n)?n.toUpperCase():n}function Pn(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:fg(t),props:d}}var mg=["trial_started","trial_converted","started","renewed","plan_changed","cancel_scheduled","resumed","canceled","expired","payment_failed","refunded"],hg=new Set(["trial_started","trial_converted","started","plan_changed"]);function Ln(n){if(n==null)return;let e=n instanceof Date?n:new Date(n);return Number.isNaN(e.getTime())?void 0:e.toISOString()}function gg(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 Cc(n){if(!n)return null;let e=typeof n.subscriptionId=="string"?n.subscriptionId.trim():"",t=n.status;if(!e||!mg.includes(t))return null;let r=n.plan;return hg.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:gg(r)}:{},...Ln(n.trialEndAt)?{trialEndAt:Ln(n.trialEndAt)}:{},...Ln(n.effectiveAt)?{effectiveAt:Ln(n.effectiveAt)}:{},...n.properties&&typeof n.properties=="object"?n.properties:{}}}Fe();var bg="wzb-analytics-v1",yg=new Set(["$identify","$group","$alias","purchase"]);function Ac(n,e,t){return t>=1||yg.has(n)?!0:t<=0?!1:Ee(`${e}:${bg}`)%1e4<t*1e4}Vt();Cn();Rn();var qg=50,zg=5e3,Ug=2e3,Qe="scalebun_anonymous_id",ri="scalebun_user_id",Fn="scalebun_super_props",ti="scalebun_groups",Gc="scalebun_installation_id",Yc="scalebun_first_open_done",si="scalebun_attribution_click_id",Xc="scalebun_attribution",Qc=/^[0-9a-f]{16,64}$/i,Vg=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"];function Wg(){try{if(typeof localStorage!="undefined"){let e=localStorage.getItem(Xc);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 Vg){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(Xc,JSON.stringify(n))}catch{}return{props:n,isNew:!0}}var jg="pending-analytics";function Kg(){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_${$()}`}function Jc(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 Gg(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 Yg(n){var r,s;let e="",t;try{typeof localStorage!="undefined"&&(e=(r=localStorage.getItem(Gc))!=null?r:"",e||(e=n||`web_${$()}`,localStorage.setItem(Gc,e)),t=(s=localStorage.getItem(si))!=null?s:void 0)}catch{}e||(e=n||`web_${$()}`);try{if(typeof location!="undefined"&&location.search){let i=new URL(location.href),o=i.searchParams.get("scalebun_click_id");if(o&&Qc.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 Xg(n){if(n){let t=Gg(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 Dn=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=Kg();this.superProps={};this.groups={};this.queue=[];this.buffer=new Be(jg);this.persisted=!1;this.backoff=new xt;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=Yg(this.deviceId);this.installationId=t.installationId,this.clickId=t.clickId;let r=Wg();this.attributionProps=r.props,this.cookieDomain=(c=e.analyticsOptions)==null?void 0:c.cookieDomain,this.anonymousId=Xg(this.cookieDomain),this.superProps=Jc(Fn),this.groups=Jc(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(),zg),typeof window!="undefined"&&(this.onHide=()=>{this.persist(),this.flush(!0)},window.addEventListener("pagehide",this.onHide)),this.offOnline=Sc(()=>{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(()=>(Kc(),jc)).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(Yc)==="1"}catch{}if(!e){try{typeof localStorage!="undefined"&&localStorage.setItem(Yc,"1")}catch{}this.track("first_open")}}getInstallationId(){return this.installationId}setClickId(e){if(!(!e||!Qc.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:$(),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:Bs}}}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=Ic(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(Fn,this.superProps))}unregister(e){if(!(e in this.superProps))return;let{[e]:t,...r}=this.superProps;this.superProps=r,jt(Fn,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(Fn,this.superProps),jt(ti,this.groups)}track(e,t){if(!(!this.usable||!e)){if(!Ac(e,this.anonymousId,this.sampleRate)){this.sampledOutCount++;return}this.enqueue(this.build(e,t))}}trackPurchase(e){if(!this.usable)return;let t=Pn(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=Cc(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>=qg&&this.autoFlush()}trim(){let e=this.queue.length-Ug;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(()=>(Qs(),Js)),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(St(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}};q();Fe();function Jg(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 Zc(n,e){let t=Jg(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 Qg(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=>Zc(n,c)),i=r.length===0||r.some(c=>Zc(n,c));return s&&i}function Kt(n,e){if(!n||n.length===0)return null;for(let t of n)if(Qg(e,t))return t;return null}var el="scalebun_config",ai="scalebun_flag_overrides";function Hn(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}function tl(){let n=Hn();if(!n)return null;try{let e=n.getItem(el);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 nl(n){let e=Hn();if(e)try{e.setItem(el,JSON.stringify(n))}catch{}}function rl(){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 Zg=5*60*1e3,sl=n=>{var e;return(e=n.salt)!=null?e:n.key},qn=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=rl(),this.payload=(o=(i=this.seedFromBootstrap(e.flagsBootstrap))!=null?i:tl())!=null?o:ci,this.exposed=new Set,this.refresh().finally(()=>this.markReady()),typeof document!="undefined"&&(this.onVisible=()=>{document.visibilityState==="visible"&&P()-this.lastFetch>Zg&&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},nl(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=bt();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,bt());if(s)return typeof s.rollout=="number"?Le(this.bucketingId(t.bucketBy),sl(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(k=>k.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,bt());if(d)return typeof d.rollout=="number"?Le(i(),sl(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,bt());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,bt());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}};q();q();function il(n){return n&&n.replace(/[\w.+-]+@[\w-]+\.[\w.-]+/g,"[email]").replace(/\?[^\s:)'"]*/g,"")}function ol(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 al=16*1024;function cl(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>al&&(c=c.slice(0,al)),c=il(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}:{},...eb(),...tb(),screenName:nb(),clientId:`err_${$()}`,timestamp:P(),...t>0?{droppedSince:t}:{},...(f=ol(r))!=null?f:{}}}function eb(){let n=We.snapshot();return n.length?{breadcrumbs:n}:{}}function tb(){let n=ne();return n?{replay:n}:{}}function nb(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}var zn=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 Et={tags:{},context:{}};function ll(n,e){Et.tags[n]=e}function dl(n,e){Et.context[n]=e}function ul(n){Et.level=n}function pl(n){var i;let e={...Et.tags,...n==null?void 0:n.tags},t={...Et.context,...n==null?void 0:n.context},r=(i=n==null?void 0:n.level)!=null?i:Et.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 fl(n,e){return n==null||n>=1?!0:n<=0?!1:e?Le(e,rb)<n*100:!0}q();var db=()=>[];function ub(n){if(!n)return"";let e=n.split(`
634
- `).find(t=>/\bat\b|@/.test(t));return(e!=null?e:"").trim().slice(0,200)}var El=["ResizeObserver loop limit exceeded","ResizeObserver loop completed with undelivered notifications"];function Il(n,e){return typeof n=="string"?e.includes(n):n.test(e)}var Un=class{constructor(){this.name="errors";this.ctx=null;this.active=!1;this.throttle=new zn;this.ignore=El;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=[...El,...(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=fl(t==null?void 0:t.sampleRate,e.sessionId),Promise.resolve().then(()=>(kl(),Sl)).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(Il(t,e.message))return!0;if(e.source){for(let t of this.denyUrls)if(Il(t,e.source))return!0}return!1}handleAuto(e,t){if(this.shouldIgnore(e)){this.counters.droppedIgnore++;return}let r=`${e.type}|${e.message}|${ub(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:db):void 0,o=cl(e,{droppedSince:t.droppedSince,extra:t.extra,frames:r,fingerprint:s,causes:i,scope:pl(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 pb(){return di||(di=typeof TextEncoder!="undefined"?new TextEncoder:void 0)}function Vn(n){try{let e=pb();return e?e.encode(n).length:unescape(encodeURIComponent(n)).length}catch{return n.length}}function Wn(n){try{return n==null?void 0:typeof n=="string"?Vn(n):typeof URLSearchParams!="undefined"&&n instanceof URLSearchParams?Vn(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 Cl(n,e,t,r){let s=n.fetch;return typeof s!="function"?()=>{}:(n.fetch=async function(o,a){var k,v,y,b,x,S,w,I,C,M,R;let c=mb(o),l=hb(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((k=a==null?void 0:a.headers)!=null?k:o instanceof Request?o.headers:void 0);A.set("traceparent",p.header),d={...a,headers:A}}let f=Date.now(),m=lt(),h=gb(d==null?void 0:d.body),g=bb(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=Wn(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((x=(b=A.headers)==null?void 0:b.get)==null?void 0:x.call(b,"content-length")),reqBody:h,reqContentType:(w=(S=g==null?void 0:g.get)==null?void 0:S.call(g,"content-type"))!=null?w:void 0,resContentType:(M=(C=(I=A.headers)==null?void 0:I.get)==null?void 0:C.call(I,"content-type"))!=null?M:void 0,readResponseText:O?()=>fb(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 jn=64*1024;async function fb(n){try{let e=n.body;if(!e||typeof e.getReader!="function"){let i=await n.text();return i.length>jn?i.slice(0,jn):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>=jn){try{await t.cancel()}catch{}return s.slice(0,jn)}}return r&&(s+=r.decode()),s}catch{return null}}function mb(n){return typeof n=="string"?n:n instanceof URL?n.href:n.url}function hb(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 gb(n){if(typeof n=="string")return n;if(typeof URLSearchParams!="undefined"&&n instanceof URLSearchParams)return n.toString()}function bb(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 Al(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=Wn(c),h=!1,g=!1;this.addEventListener("abort",()=>{h=!0}),this.addEventListener("timeout",()=>{g=!0}),this.addEventListener("loadend",()=>{let k=this.status===0;e({method:l.method,url:l.url,status:this.status||0,startedAt:d,duration:Math.round(lt()-p),requestSize:m,responseSize:vb(this),error:k?h?"aborted":g?"timeout":"network error":void 0,aborted:h,timedOut:g,reqBody:f,reqContentType:l.reqContentType,resContentType:yb(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 yb(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 vb(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"?Vn(n.responseText):void 0}catch{return}}q();function Rl(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 wb(t)?"abort":xb(t)?"timeout":Sb(t)?"cors":"network_error";if(typeof e=="number"){if(e>=500)return"http_5xx";if(e>=400)return"http_4xx"}}function Tl(n,e=2e3){return typeof n=="number"&&n>=e}function wb(n){return/\babort(ed)?\b/i.test(n)}function xb(n){return/\btimed?\s*out\b|\btimeout\b/i.test(n)}function Sb(n){return/\bcors\b|cross-origin|access-control|opaque/i.test(n)}var kb=/^(?:\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 Eb(n){return n?!!(kb.test(n)||n.length>=12&&/\d/.test(n)&&/^[A-Za-z0-9_-]+$/.test(n)):!1}function Ml(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&&Eb(i)&&(t[s]=":id",r=!0)}return r?t.join("/"):e}function Pl(n,e={}){var a,c;let t=(a=n.protocol)!=null?a:"http",r=t==="http"||t==="beacon"?Rl({status:n.status,error:n.error,aborted:n.aborted,timedOut:n.timedOut}):void 0,s=Tl(n.duration,(c=e.slowMs)!=null?c:2e3),i=Ml(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:Ib(),...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_${$()}`,timestamp:P()}}function Ib(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}function Ll(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 Cb(){let n=Ll(16),e=Ll(8);return{traceId:n,spanId:e,header:`00-${n}-${e}-01`}}function Ab(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=Ab(t);return r&&e.has(r)?Cb():null}}var Rb=new Set(["fetch","xmlhttprequest"]);function Tb(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 It=class It{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;Rb.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>It.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?Tb(a):{}}prune(){if(typeof performance=="undefined")return;let e=performance.now()-It.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()}};It.TTL_MS=6e4,It.MAX_PER_URL=8;var Gn=It;Fe();function Ol(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 Nb(n,e){return typeof n=="string"?e.includes(n):n.test(e)}var Jn=class{constructor(){this.name="network";this.active=!1;this.uninstalls=[];this.slowMs=2e3;this.sampleRate=1;this.dedupMs=0;this.denyUrls=[];this.timingIndex=new Gn;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(Cl(window,o,i,a)),this.uninstalls.push(Al(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(()=>($l(),Hl)).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=>Nb(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(()=>(Yl(),Gl)).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=Pl(t,{slowMs:this.slowMs});if(this.sampleRate<1){if(!Ol({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}};$s();function Xl(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 Jl(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 Ql(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 Zl(){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 ed(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 td(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 Bb={lcp:[2500,4e3],inp:[200,500],cls:[.1,.25],fcp:[1800,3e3],ttfb:[800,1800]};function nd(n,e){let t=Bb[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(`#${rd(t.id)}`);break}let s=t.getAttribute&&t.getAttribute("data-testid");if(s){e.unshift(`[data-testid="${rd(s)}"]`);break}let i=t.tagName.toLowerCase(),o=t.parentElement;if(!o){e.unshift(i);break}let a=Fb(t,i);e.unshift(a>1?`${i}:nth-of-type(${a})`:i),t=o,r++}return e.length?e.join(" > "):void 0}function Fb(n,e){let t=1,r=n.previousElementSibling;for(;r;)r.tagName&&r.tagName.toLowerCase()===e&&t++,r=r.previousElementSibling;return t}function rd(n){return n.replace(/([^\w-])/g,"\\$1")}function sd(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 id(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=Xt(i)),o!==void 0&&(a.renderTime=Xt(o)),a}function xi(){return{largestValue:0,sources:[]}}function od(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:sd(c.previousRect),currentRect:sd(c.currentRect)})}n.largestValue=i,n.sources=a}return n}function ad(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 cd(n,e){for(let t of e){let r=De(t.duration);r<=n.duration||(n.duration=r,n.attribution=Db(t))}return n}function Db(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=Xt(Math.max(0,r-t))),s>=r&&r>0&&(o.processingTime=Xt(Math.max(0,s-r))),s>0&&(o.presentationDelay=Xt(Math.max(0,t+i-s))),o}function ld(n){return n.duration>0?n.attribution:void 0}function Xt(n){return Math.round(n)}q();var Zn=class Zn{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=Xl(t);r&&(this.lcp=r,this.lcpAttr=(s=id(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=>{Jl(this.clsState,t),od(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=Ql(this.inp,t),cd(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>=Zn.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=ud(dd()),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:Zl()})}catch{}}finalizeRoute(){let e=this.clsState.max;if(this.lcp>0){if(this.lcpAttr){let t=ed(this.lcpAttr);t&&(this.lcpAttr.phases=t)}this.emit("lcp",this.lcp,"ms",this.lcpAttr)}if(this.inp>0){let t=ld(this.inpAcc);if(t&&this.inpWindow){let r=td(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",ad(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=ud(dd());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_${$()}`,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:nd(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}};Zn.LOAF_CAP=30;var Qn=Zn;function dd(){try{return typeof location!="undefined"?location.pathname:"/"}catch{return"/"}}function ud(n){return n.replace(/\/[0-9a-f]{8,}(?=\/|$)/gi,"/:id").replace(/\/\d+(?=\/|$)/g,"/:id")||"/"}q();ki();q();var Hb=()=>{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:Hb(),clientId:`perf_${$()}`,...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 tr=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}};q();function md(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 hd(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 $b=new Set(["fetch","xmlhttprequest","beacon"]);function qb(n){return n.replace(/[?#].*$/,"")}function Zt(n,e){return n>0&&e>=n?Math.round(e-n):void 0}var Ei="";function gd(n){Ei=(n!=null?n:"").replace(/\/$/,"")}function zb(n){return!!Ei&&n.startsWith(Ei)}function bd(n){if($b.has(n.initiatorType)||zb(n.name))return null;let e=Math.round(n.duration);if(e<=0)return null;let t={kind:"resource",initiator:n.initiatorType,url:qb(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 yd(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 Ub="wzb-traces-v1";function vd(n){return n.durationMs>=n.slowMs||n.hasError||n.sampleRate>=1?!0:n.sampleRate<=0?!1:Ee(`${n.traceId}:${Ub}`)%100<n.sampleRate*100}sr();var Wb=1e3,jb=3e3,Kb=()=>typeof performance!="undefined"&&performance.now?performance.now():Date.now();function Gb(){try{let n=typeof PerformanceObserver!="undefined"&&PerformanceObserver.supportedEntryTypes;return Array.isArray(n)&&n.includes("long-animation-frame")}catch{return!1}}var ar=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 tr;this.pageloadEmitted=!1;this.tracesSampleRate=1;this.slowTxnMs=jb;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,gd(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(()=>(Ad(),Cd)).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(yd(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}Gb()?this.disconnects.push(Pe("long-animation-frame",s=>{for(let i of s)this.emitCapped("loaf",i,hd(i))})):this.disconnects.push(Pe("longtask",s=>{for(let i of s)this.emitCapped("longtask",i,md(i))})),this.disconnects.push(Pe("resource",s=>{for(let i of s){let o=bd(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;pd({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 rr;let t=new this.engine.Transaction(e,{clock:Kb,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")),!vd({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(),Wb))}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}};q();var lr=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=cr(),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?Yb(l):cr())};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=cr()){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 cr(){try{return typeof location!="undefined"?location.pathname:""}catch{return""}}function Yb(n){try{return new URL(n).pathname}catch{return cr()}}var dr=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}},ur=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=Rd(),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&&Rd()===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 Rd(){try{return typeof location!="undefined"?location.href:""}catch{return""}}var pr=class{constructor(e,t={},r){this.emit=e;this.signal=r;var s,i,o,a,c;this.rage=new dr((s=t.rageWindowMs)!=null?s:800,(i=t.rageRadius)!=null?i:30,(o=t.rageMin)!=null?o:3),this.dead=new ur((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=Zb(s,this.maskText),o=ey(s),a=Xb(t),c=Jb(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 Xb(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 Jb(n){var s;let e=n.getBoundingClientRect(),t={ex:e.x|0,ey:e.y|0,ew:e.width|0,eh:e.height|0},r=(s=n.closest("[data-scalebun-component]"))==null?void 0:s.getAttribute("data-scalebun-component");return r&&(t.component=r),t}var Qb=n=>n.replace(/\S/g,"*");function Zb(n,e=!1){let t=n.tagName.toLowerCase(),r=(n.textContent||"").trim().slice(0,40);return r?`${t}: ${e?Qb(r):r}`:t}function ey(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 fr=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 lr((t,r)=>this.emit("SCREEN_VIEW",{from:t,to:r},void 0,r)),this.interactions=new pr((t,r,s)=>this.emit(t,r,s,Td()),{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:Td(),eventId:`evt_${$()}`,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 Td(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}Ns();q();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 Md(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 Pd(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 ny=()=>{try{return typeof location!="undefined"?location.pathname:void 0}catch{return}};function Ld(n,e,t=0){let r=Ai(n),s=j(Md(e)),i={method:n},o=ny();if(o&&(i.screen=o),r==="warn"||r==="error"){let a=Pd(e);a&&(i.stack=j(a))}return t>0&&(i.droppedSince=t),{kind:"log",level:r,message:s,source:"console",platform:"js",logId:`log_${$()}`,metadata:i,timestamp:P()}}var mr=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 ry=["debug","info","log","warn","error"],sy=50,hr=class{constructor(){this.name="console";this.ctx=null;this.active=!1;this.throttle=new mr;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 ry){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]===Os)){this.capturing=!0;try{if(!this.throttle.accept(Ai(e)))return;let s=Ld(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>sy&&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 gr=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(()=>(Od(),_d));if(this.widget)return;this.widget=t({position:e.position,label:e.label,onSubmit:r=>this.submitFn?this.submitFn(r):Promise.resolve(null)})}catch{}finally{this.mounting=!1}}}teardown(){var e;(e=this.widget)==null||e.destroy(),this.widget=null,this.submitFn=null,this.active=!1}};q();var Nd="scalebun:tab",Bd="scalebun:live:";function Ti(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}function ly(){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 Fd(){let n=ly();if(!n)return`mem-${Ri()}`;try{let e=n.getItem(Nd);if(e)return e;let t=Ri();return n.setItem(Nd,t),t}catch{return`mem-${Ri()}`}}var Mi=n=>`${Bd}${n}`;function br(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 yr(n,e){let t=Ti();if(t)try{t.setItem(Mi(n),JSON.stringify(e))}catch{}}function vr(n,e){let t=br(n);t&&(t.ended=e,t.lastActive=Date.now(),yr(n,t))}function Dd(n){let e=br(n);e&&(e.lastActive=Date.now(),yr(n,e))}function Hd(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(Bd)||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,wr=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_${$()}`),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=Fd();let t=br(this.tabId);t&&!t.ended&&t.sessionId!==e&&this.emitRecoveredCrash(t);let r=P();yr(this.tabId,{v:1,sessionId:e,startedAt:r,lastActive:r,screen:(s=$d())!=null?s:"",ended:!1}),Hd(this.tabId,r),this.onHide=()=>vr(this.tabId,!0),this.onShow=()=>vr(this.tabId,!1),window.addEventListener("pagehide",this.onHide),window.addEventListener("pageshow",this.onShow),this.heartbeat=setInterval(()=>Dd(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:$d(),clientId:`crash_${$()}`,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&&vr(this.tabId,!0),this.active=!1}};function $d(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}q();Vt();var uy=50,xr=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(-uy);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 dx=32,ux=3e4,Nf="scalebun_engage_sessions";function Bf(){try{return typeof location!="undefined"?location.pathname:""}catch{return""}}function px(n){let e=n,t=r=>Array.isArray(r)?r.length:0;return!!e&&(t(e.campaigns)>0||t(e.inAppMessages)>0)}var is=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 s;if(this.ctx=e,typeof window=="undefined"||typeof document=="undefined")return;let t=(s=e.clientKey)!=null?s:"";if(!t||!e.apiBaseUrl)return;this.transport=new xr(e.apiBaseUrl,t),this.screen=Bf(),this.active=!0,this.transport.flushParked(),this.unsub=e.onSignal(i=>this.onSignal(i)),this.onPop=()=>this.onScreenView(Bf()),window.addEventListener("popstate",this.onPop);let r=this.bumpSessionCount();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(!px(e)){(l=this.runtime)==null||l.setCampaigns([]),(u=this.runtime)==null||u.setMessages([]),this.closeBuffer();return}let{normalizeConfig:t}=await Promise.resolve().then(()=>(Oi(),Wd)),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(()=>(Of(),_f));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:$,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(),Jd));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>dx&&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()-ux;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(Nf),i=s?JSON.parse(s):{};if(i.sessionId===r&&typeof i.count=="number")return i.count;let o=(typeof i.count=="number"?i.count:0)+1;return localStorage.setItem(Nf,JSON.stringify({sessionId:r,count:o})),o}catch{return 1}}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}};q();var Wf={unreadCount:0,total:0,syncStatus:"idle"},os=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=Wf;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(()=>(Bo(),No)).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(()=>(Vf(),Uf)),Promise.resolve().then(()=>(Do(),Hf))]),r=new t(((c=this.ctx)==null?void 0:c.deviceId)||"anon"),s=new e({trackEvent:(h,g)=>{var k;return(k=this.ctx)==null?void 0:k.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(()=>(zo(),$f)),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(()=>(Bo(),No));(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=Wf,this.active=!1}};q();Ko();function Tx(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}var as=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(()=>(Gf(),Kf));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:Tx(),...s!=null?{duration:s}:{},metadata:r,clientId:`pw_${$()}`,timestamp:P()})}teardown(){var e;this.active=!1,(e=this.stop)==null||e.call(this),this.stop=void 0}};q();function Mx(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}var cs=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:Mx(),metadata:{profile:r,format:"w3c-js-self-profiling"},clientId:`prof_${$()}`,timestamp:P()}),!0}catch{return!1}}teardown(){if(this.profiler){try{this.profiler.stop()}catch{}this.profiler=void 0}this.active=!1}};var Dx={incidents:0,droppedIncidents:0,rollups:0,tiers:{pressure:!1,memory:!1}},ps=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(()=>(cm(),am));this.active&&(this.handle=t(e))}stats(){var e,t;return(t=(e=this.handle)==null?void 0:e.stats())!=null?t:Dx}teardown(){var e;this.active=!1,(e=this.handle)==null||e.stop(),this.handle=void 0}};var ms=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(()=>(gm(),hm));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 vs=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(()=>(Nm(),Om));this.active&&(this.engine=new t({apiBaseUrl:e.apiBaseUrl,clientKey:e.clientKey,deviceId:e.deviceId,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 bh=()=>Promise.resolve().then(()=>(uh(),dh)),Ms=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 o,a;if(typeof document=="undefined"||typeof MutationObserver=="undefined")return;let{decideSampling:t}=await Promise.resolve().then(()=>(fh(),ph)),r=t(e.replaySampling,(o=e.sessionId)!=null?o:"");if(e.log("[replay] sampling:",r.reason,"(bucket",r.bucket+")"),!r.record)return;if(e.respectDnt){let{userOptedOutOfTracking:c}=await Promise.resolve().then(()=>(aa(),zm));if(c()){e.log("[replay] dnt: skip");return}}if(e.replayCanvas){let{installWebGLPreserve:c}=await Promise.resolve().then(()=>(gh(),hh));this.uninstallWebGL=c()}let s=c=>{c.catch(()=>{})};s(Promise.resolve().then(()=>(sn(),Nr))),s(Promise.resolve().then(()=>(et(),Or))),s(Promise.resolve().then(()=>(pn(),ha))),s(Promise.resolve().then(()=>(ya(),ba))),s(Promise.resolve().then(()=>(Ar(),Wi))),s(Promise.resolve().then(()=>(Ea(),ka))),s(Promise.resolve().then(()=>(fa(),pa))),s(Promise.resolve().then(()=>(ws(),sa)));let i;try{({createRecorder:i}=await bh())}catch(c){await new Promise(l=>setTimeout(l,400)),{createRecorder:i}=await bh(),e.trackEvent("sdk_replay_recovered",{stage:"recorder-import",message:String((a=c==null?void 0:c.message)!=null?a:c).slice(0,300)})}this.controller=await i(e,r)}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;(e=this.controller)==null||e.teardown(),this.controller=void 0,(t=this.uninstallWebGL)==null||t.call(this),this.uninstallWebGL=void 0}};var yh=[new qn,new Dn,new Un,new Jn,new Qn,new as,new ar,new fr,new hr,new gr,new wr,new is,new os,new cs,new ps,new ms,new vs,new Ms],FS={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 vh(n){var e;return(e=FS[n])!=null?e:["dom"]}q();function DS(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 y,b,x,S;let r=Ha(e),s=Ua(r.debug),i=new kn(r),o=new En(r),a=new Tn(r,i,o);t!=null&&t.edge&&a.setConsentGranted(!1);let c=new Mn;ic(),cc(),typeof((y=r.errors)==null?void 0:y.maxBreadcrumbs)=="number"&&We.setMax(r.errors.maxBreadcrumbs),tc((b=r.errors)==null?void 0:b.beforeBreadcrumb);let l=w=>{var C,M;let I=DS(w.kind);I&&((M=(C=c.get("config"))==null?void 0:C.entitlement)==null?void 0:M.call(C,I))===!1||(sc(w),ac(w),a.emit(w))},u=new Set,d={sessionId:i.sessionId,clientKey:r.clientKey,deviceId:i.deviceId,appVersion:r.appVersion,getUserId:()=>{var w,I;return(I=(w=c.get("analytics"))==null?void 0:w.identity)==null?void 0:I.userId},emit:l,emitFor:(w,I)=>a.emitFor(w,I),egressPending:()=>a.pendingCount,trackEvent:(w,I)=>l({kind:"event",name:w,props:I,timestamp:Date.now()}),getAppState:()=>$t("visibility")&&document.visibilityState==="hidden"?"background":"active",log:s,apiBaseUrl:r.apiBaseUrl,signal:(w,I)=>{for(let C of u)try{C(w,I)}catch{}},onSignal:w=>(u.add(w),()=>u.delete(w)),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:(S=r.flags)==null?void 0:S.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 w of yh)p[w.name]!==!1&&vh(w.name).every(I=>$t(I))&&c.add(w)};f();let m=new bn(r.consent.initial),h=!1,g=async()=>{var I;if(h)return;h=!0,f(),await c.setupAll(d),t!=null&&t.edge||await a.start();let w=(I=c.get("analytics"))==null?void 0:I.identity;if(w!=null&&w.userId&&!(t!=null&&t.edge)&&a.emit({kind:"identify",userId:w.userId,anonymousId:w.anonymousId,timestamp:Date.now()}),w){Oe(w.superProps);let C=w.groups;if(C)for(let M of Object.keys(C))Oe({[`group_${M}`]:C[M]});w.userId&&Oe({userId:w.userId})}s(t!=null&&t.edge?"activated (edge-lite)":"activated",{sessionId:i.sessionId})},v={config:r,session:i,pipeline:a,transport:o,registry:c,log:s,setConsent:w=>{m.set(w?"granted":"denied"),w?(a.setConsentGranted(!0),g()):(a.setConsentGranted(!1),h&&c.teardownAll(),h=!1,a.discard())},get consentStatus(){return m.value}};return!r.consent.required||m.granted?await g():s("consent required \u2014 capture deferred until setConsent(true)"),s("initialized",{sessionId:i.sessionId,consent:m.value}),v}};q();function HS(){try{return typeof location!="undefined"?location.href:void 0}catch{return}}function wh(n,e=[]){var t;return{clientReportId:`bug_${$()}`,...n.title?{title:j(n.title)}:{},message:j((t=n.message)!=null?t:""),...n.email?{email:n.email}:{},url:HS(),...e.length?{console:e.slice(-20)}:{},timestamp:P()}}q();sr();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:rr},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(()=>(Ma(),Ta))).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),pc()){let a=Vs();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.reportBug(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(()=>(Eh(),kh)).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(),dc(),(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=Pn(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;rc({ts:P(),category:(t=e.category)!=null?t:"custom",type:e.type,level:e.level,message:e.message,data:e.data})}setTag(e,t){ll(e,t)}setContext(e,t){dl(e,t)}setErrorLevel(e){ul(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_${$()}`,timestamp:P()};(a=this.rt)==null||a.pipeline.emit(i)}async registerInAppSlot(e,t){let{registerInAppSlot:r}=await Promise.resolve().then(()=>(to(),Iu));return r(e,t)}async reportBug(e){var t,r,s,i;if(!this.rt)return null;if(this.rt.config.features.bugReport===!1)return this.rt.log("[scalebun] reportBug: bugReport feature is disabled"),null;if(!e||!e.message)return this.rt.log("[scalebun] reportBug: a message is required"),null;if(!this.rt.pipeline.canEgress())return this.rt.log("[scalebun] reportBug: blocked \u2014 consent not granted"),null;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:[],l=wh({message:e.message,title:e.title,email:e.email},c),u=await this.rt.transport.submitBugReport(this.rt.session.sessionId,l);return await this.rt.pipeline.flush(),(i=u==null?void 0:u.id)!=null?i:null}catch{return null}}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 t,r,s,i,o,a;let e=this.analyticsFeature();return{pending:((r=(t=this.rt)==null?void 0:t.pipeline.pendingCount)!=null?r:0)+((s=e==null?void 0:e.pending)!=null?s:0),dropped:((o=(i=this.rt)==null?void 0:i.pipeline.dropped)!=null?o:0)+((a=e==null?void 0:e.dropped)!=null?a: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:ek}ensureCoach(){return this.coachFeature?Promise.resolve(this.coachFeature):this.rt?Promise.resolve().then(()=>(Rh(),Ah)).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(()=>(_h(),Lh));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=()=>{},Xe=()=>Promise.resolve(),Oh={unreadCount:0,total:0,syncStatus:"idle"},ek={subscribe:n=>(n(Oh),rt),onUnreadChange:n=>(n(0),rt),getState:()=>Oh,query:()=>Promise.resolve({messages:[],cursor:null,hasMore:!1}),get:()=>Promise.resolve(void 0),markRead:Xe,markUnread:Xe,markAllRead:Xe,archive:Xe,unarchive:Xe,pin:Xe,remove:Xe,refresh:Xe,ingest:Xe,act:rt,onCtaAction:()=>rt,mount:rt,open:rt,close:rt,unmount:rt},hn=new _a;q();function tk(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),tk(window,n)}})();
715
+ @media(prefers-reduced-motion:reduce){.spot{transition:none}}`,Rs=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,Ek),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=Sk(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:kk(),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 Gh={};_(Gh,{CoachmarkFeature:()=>Oa});var Kh,Oa,Xh=E(()=>{"use strict";ns();jh();xo();Zr();ss();Kh="scalebun_coach_progress",Oa=class{constructor(e){this.deps=e;this.hub=new tt;this.renderer=new Rs;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 Yp())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(Kh)||"{}")}catch{return{}}}persist(e,t){try{let r=this.progress();t<0?delete r[e]:r[e]=t,localStorage.setItem(Kh,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 Yh,Na=E(()=>{"use strict";Yh={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={};_(Ba,{notInitializedReport:()=>Mk,runPushDiagnostics:()=>Rk});function Ik(){return typeof navigator!="undefined"&&"serviceWorker"in navigator&&typeof window!="undefined"&&"PushManager"in window&&"Notification"in window}function Ck(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 Ak(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 Tk(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 Rk(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&&Ik(),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"),Jh(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 Tk(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?Ak(new Uint8Array(A),Ck(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 Jh(e)}function Mk(){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 Jh(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 Zh={};_(Zh,{DEFAULT_SW_URL:()=>Da,EXPECTED_SW_VERSION:()=>Qh,PUSH_STATE_COPY:()=>Yh,PushFeature:()=>qa,resolvePushState:()=>Ms});function Ps(){return typeof navigator!="undefined"&&"serviceWorker"in navigator&&typeof window!="undefined"&&"PushManager"in window&&"Notification"in window}function Pk(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 Qh,Da,mn,qa,eg=E(()=>{"use strict";Na();Na();Qh=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:Pk(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:Qh})}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 Wa="https://api.scalebun.com/api/v1";var sg=["authorization","cookie","set-cookie","x-api-key","x-csrf-token","password","token","secret"];function ja(n){var t,r,s,i,o,a,c,l,u,d,p,f,m,h,g,S,v,y,b,w,x,I,k,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,L,N,F,W,re,ge,he,Ce,Ae,Te,Je,st,ke,gn,$a,za,Ua,Va;if(!n||!n.clientKey)throw new Error("[scalebun] clientKey is required");let e=((t=n.apiBaseUrl)!=null?t:Wa).replace(/\/$/,"");return{clientKey:n.clientKey,apiBaseUrl:e,environment:n.environment,release:n.release,appVersion:n.appVersion,flushIntervalMs:(r=n.flushIntervalMs)!=null?r: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:(s=n.replayCanvas)!=null?s:!1,signSessionLane:(i=n.signSessionLane)!=null?i:!1,replayFrameOrigins:(o=n.replayFrameOrigins)!=null?o:[],autocapture:(a=n.autocapture)!=null?a:!0,tracePropagation:(c=n.tracePropagation)!=null?c:!0,tracePropagationOrigins:(l=n.tracePropagationOrigins)!=null?l:[],maxBatchSize:(u=n.maxBatchSize)!=null?u:50,maxQueueSize:(d=n.maxQueueSize)!=null?d:1e3,debug:(p=n.debug)!=null?p:!1,features:{errors:(m=(f=n.features)==null?void 0:f.errors)!=null?m:!0,network:(g=(h=n.features)==null?void 0:h.network)!=null?g:!0,console:(v=(S=n.features)==null?void 0:S.console)!=null?v:!0,webVitals:(b=(y=n.features)==null?void 0:y.webVitals)!=null?b:!0,performance:(x=(w=n.features)==null?void 0:w.performance)!=null?x:!0,journey:(k=(I=n.features)==null?void 0:I.journey)!=null?k:!0,replay:(M=(C=n.features)==null?void 0:C.replay)!=null?M:!1,bugReport:(A=(T=n.features)==null?void 0:T.bugReport)!=null?A:!0,crash:(z=(O=n.features)==null?void 0:O.crash)!=null?z:!0,config:(te=(D=n.features)==null?void 0:D.config)!=null?te:!0,engage:(Q=(J=n.features)==null?void 0:J.engage)!=null?Q:!0,analytics:(ce=(fe=n.features)==null?void 0:fe.analytics)!=null?ce:!0,webPerf:(Se=(xe=n.features)==null?void 0:xe.webPerf)!=null?Se:!0,profiler:(q=(le=n.features)==null?void 0:le.profiler)!=null?q:!1,watchdog:(K=(V=n.features)==null?void 0:V.watchdog)!=null?K:!1,inbox:(me=(de=n.features)==null?void 0:de.inbox)!=null?me:!1,inapp2:(Ue=(se=n.features)==null?void 0:se.inapp2)!=null?Ue:!1},watchdog:n.watchdog,exitIntent:n.exitIntent,privacy:{captureNetworkBodies:(G=(Ve=n.privacy)==null?void 0:Ve.captureNetworkBodies)!=null?G:!1,denylist:[...sg,...(Y=(ie=n.privacy)==null?void 0:ie.denylist)!=null?Y:[]].map(ng=>ng.toLowerCase()),maskSelectors:(ee=(X=n.privacy)==null?void 0:X.maskSelectors)!=null?ee:[],maskReplayText:(L=(R=n.privacy)==null?void 0:R.maskReplayText)!=null?L:!1,maskInputs:(re=(W=(N=n.privacy)==null?void 0:N.maskInputs)!=null?W:(F=n.privacy)==null?void 0:F.maskReplayText)!=null?re:!1,respectDnt:(he=(ge=n.privacy)==null?void 0:ge.respectDnt)!=null?he:!1,maskEventText:(Ae=(Ce=n.privacy)==null?void 0:Ce.maskEventText)!=null?Ae:!1},consent:{required:(Te=n.requireConsent)!=null?Te:!1,initial:(Je=n.initialConsent)!=null?Je:"unknown"},bugReport:{launcher:(ke=(st=n.bugReportOptions)==null?void 0:st.launcher)!=null?ke:!1,position:($a=(gn=n.bugReportOptions)==null?void 0:gn.position)!=null?$a:"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:Ut,(s=e.sessionMaxDurationMs)!=null?s:js);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(()=>(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(),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;Vt();$();Cn();Tn();var Lg=1,Mc=n=>n.kind==="frame",Rn=n=>n.frameType==="keyframe",_g=n=>Mc(n)&&!Rn(n),Og=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(_g);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<Og&&(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:Lg,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 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 Ng=/^[A-Za-z]{3}$/;function Bg(n){return Ng.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:Bg(t),props:d}}var Fg=["trial_started","trial_converted","started","renewed","plan_changed","cancel_scheduled","resumed","canceled","expired","payment_failed","refunded"],Dg=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 qg(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||!Fg.includes(t))return null;let r=n.plan;return Dg.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:qg(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 Hg="wzb-analytics-v1",$g=new Set(["$identify","$group","$alias","purchase"]);function Oc(n,e,t){return t>=1||$g.has(n)?!0:t<=0?!1:Ee(`${e}:${Hg}`)%1e4<t*1e4}Vt();Cn();Tn();var db=50,ub=5e3,pb=2e3,Qe="scalebun_anonymous_id",ri="scalebun_user_id",Dn="scalebun_super_props",ti="scalebun_groups",tl="scalebun_installation_id",nl="scalebun_first_open_done",si="scalebun_attribution_click_id",rl="scalebun_attribution",il=/^[0-9a-f]{16,64}$/i,fb=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"];function mb(){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 fb){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 hb="pending-analytics";function gb(){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 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 jt(n,e){try{if(typeof localStorage=="undefined")return;Object.keys(e).length?localStorage.setItem(n,JSON.stringify(e)):localStorage.removeItem(n)}catch{}}function bb(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 yb(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(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&&il.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 vb(n){if(n){let t=bb(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=gb();this.superProps={};this.groups={};this.queue=[];this.buffer=new Be(hb);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=yb(this.deviceId);this.installationId=t.installationId,this.clickId=t.clickId;let r=mb();this.attributionProps=r.props,this.cookieDomain=(c=e.analyticsOptions)==null?void 0:c.cookieDomain,this.anonymousId=vb(this.cookieDomain),this.superProps=sl(Dn),this.groups=sl(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(),ub),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(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=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},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(!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,ni(e),this.usable&&this.enqueue(this.build("$identify",t)))}enqueue(e){this.queue.push(e),this.trim(),this.queue.length>=db&&this.autoFlush()}trim(){let e=this.queue.length-pb;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 wb(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=wb(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 xb(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 Kt(n,e){if(!n||n.length===0)return null;for(let t of n)if(xb(e,t))return t;return null}var al="scalebun_config",ai="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(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 Sb=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=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=dl(),this.payload=(o=(i=this.seedFromBootstrap(e.flagsBootstrap))!=null?i:cl())!=null?o:ci,this.exposed=new Set,this.refresh().finally(()=>this.markReady()),typeof document!="undefined"&&(this.onVisible=()=>{document.visibilityState==="visible"&&P()-this.lastFetch>Sb&&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=Kt(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=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(),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=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 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}:{},...kb(),...Eb(),screenName:Ib(),clientId:`err_${H()}`,timestamp:P(),...t>0?{droppedSince:t}:{},...(f=fl(r))!=null?f:{}}}function kb(){let n=We.snapshot();return n.length?{breadcrumbs:n}:{}}function Eb(){let n=ne();return n?{replay:n}:{}}function Ib(){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 Cb="wzb-errors-v1";function wl(n,e){return n==null||n>=1?!0:n<=0?!1:e?Le(e,Cb)<n*100:!0}$();var _b=()=>[];function Ob(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}|${Ob(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:_b):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 di;function Nb(){return di||(di=typeof TextEncoder!="undefined"?new TextEncoder:void 0)}function Wn(n){try{let e=Nb();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 _l(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,T;let c=Fb(o),l=Db(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=qb(d==null?void 0:d.body),g=Hb(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?()=>Bb(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 Bb(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 Fb(n){return typeof n=="string"?n:n instanceof URL?n.href:n.url}function Db(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 qb(n){if(typeof n=="string")return n;if(typeof URLSearchParams!="undefined"&&n instanceof URLSearchParams)return n.toString()}function Hb(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:zb(this),error:S?h?"aborted":g?"timeout":"network error":void 0,aborted:h,timedOut:g,reqBody:f,reqContentType:l.reqContentType,resContentType:$b(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 $b(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 zb(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 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 Ub(t)?"abort":Vb(t)?"timeout":Wb(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 Ub(n){return/\babort(ed)?\b/i.test(n)}function Vb(n){return/\btimed?\s*out\b|\btimeout\b/i.test(n)}function Wb(n){return/\bcors\b|cross-origin|access-control|opaque/i.test(n)}var jb=/^(?:\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 Kb(n){return n?!!(jb.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&&Kb(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:Gb(),...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 Gb(){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 Xb(){let n=ql(16),e=ql(8);return{traceId:n,spanId:e,header:`00-${n}-${e}-01`}}function Yb(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=Yb(t);return r&&e.has(r)?Xb():null}}var Jb=new Set(["fetch","xmlhttprequest"]);function Qb(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;Jb.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?Qb(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 sy(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=>sy(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}};Ds();function rd(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 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 vi(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 iy={lcp:[2500,4e3],inp:[200,500],cls:[.1,.25],fcp:[1800,3e3],ttfb:[800,1800]};function ld(n,e){let t=iy[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(`#${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=oy(t,i);e.unshift(a>1?`${i}:nth-of-type(${a})`:i),t=o,r++}return e.length?e.join(" > "):void 0}function oy(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=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 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:wi(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 Si(){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=ay(t))}return n}function ay(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 gd(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=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=vi(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=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=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=yi(),this.lcpAttr=void 0,this.clsAcc=xi(),this.inpAcc=Si(),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")||"/"}$();ki();$();var cy=()=>{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:cy(),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 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 ly=new Set(["fetch","xmlhttprequest","beacon"]);function dy(n){return n.replace(/[?#].*$/,"")}function Zt(n,e){return n>0&&e>=n?Math.round(e-n):void 0}var Ei="";function kd(n){Ei=(n!=null?n:"").replace(/\/$/,"")}function uy(n){return!!Ei&&n.startsWith(Ei)}function Ed(n){if(ly.has(n.initiatorType)||uy(n.name))return null;let e=Math.round(n.duration);if(e<=0)return null;let t={kind:"resource",initiator:n.initiatorType,url:dy(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 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 py="wzb-traces-v1";function Cd(n){return n.durationMs>=n.slowMs||n.hasError||n.sampleRate>=1?!0:n.sampleRate<=0?!1:Ee(`${n.traceId}:${py}`)%100<n.sampleRate*100}ir();var my=1e3,hy=3e3,gy=()=>typeof performance!="undefined"&&performance.now?performance.now():Date.now();function by(){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=hy;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}by()?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(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;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:gy,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(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(),my))}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?yy(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 yy(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""}}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=Iy(s,this.maskText),o=Cy(s),a=vy(t),c=wy(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 vy(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 wy(n){var i;let e=n.getBoundingClientRect(),t={ex:e.x|0,ey:e.y|0,ew:e.width|0,eh:e.height|0};ky(n)&&(t.fx=1),t.path=Sy(n);let r=xy();r&&(t.ui=r);let s=(i=n.closest("[data-scalebun-component]"))==null?void 0:i.getAttribute("data-scalebun-component");return s&&(t.component=s),t}function xy(){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 Sy(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(">")}function ky(n){let e=typeof window!="undefined"?window:void 0;if(!e)return!1;for(let t=n;t;t=t.parentElement)if(e.getComputedStyle(t).position==="fixed")return!0;return!1}var Ey=n=>n.replace(/\S/g,"*");function Iy(n,e=!1){let t=n.tagName.toLowerCase(),r=(n.textContent||"").trim().slice(0,40);return r?`${t}: ${e?Ey(r):r}`:t}function Cy(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,Bd()),{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:Bd(),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 Bd(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}_s();$();var Ay={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 Fd(n,e){let t={...Ay,...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 Dd(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 Ty=()=>{try{return typeof location!="undefined"?location.pathname:void 0}catch{return}};function qd(n,e,t=0){let r=Ai(n),s=j(Fd(e)),i={method:n},o=Ty();if(o&&(i.screen=o),r==="warn"||r==="error"){let a=Dd(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 Ry=["debug","info","log","warn","error"],My=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 Ry){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=qd(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>My&&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(()=>(zd(),$d));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 Ud="scalebun:tab",Vd="scalebun:live:";function Ri(){try{return typeof localStorage!="undefined"?localStorage:null}catch{return null}}function Ny(){try{return typeof sessionStorage!="undefined"?sessionStorage:null}catch{return null}}function Ti(){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 Wd(){let n=Ny();if(!n)return`mem-${Ti()}`;try{let e=n.getItem(Ud);if(e)return e;let t=Ti();return n.setItem(Ud,t),t}catch{return`mem-${Ti()}`}}var Mi=n=>`${Vd}${n}`;function yr(n){let e=Ri();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=Ri();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 jd(n){let e=yr(n);e&&(e.lastActive=Date.now(),vr(n,e))}function Kd(n,e){let t=Ri();if(t)try{let r=[];for(let s=0;s<t.length;s++){let i=t.key(s);if(!(!i||!i.startsWith(Vd)||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 By=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=Wd();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=Gd())!=null?s:"",ended:!1}),Kd(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(()=>jd(this.tabId),By)}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:Gd(),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 Gd(){try{return typeof location!="undefined"?location.pathname:void 0}catch{return}}$();Vt();var Fy=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(-Fy);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 Dx=32,qx=3e4,Wf="scalebun_engage_sessions";function jf(){try{return typeof location!="undefined"?location.pathname:""}catch{return""}}function Hx(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=jf(),this.active=!0,this.transport.flushParked(),this.unsub=e.onSignal(o=>this.onSignal(o)),this.onPop=()=>this.onScreenView(jf()),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(!Hx(e)){(l=this.runtime)==null||l.setCampaigns([]),(u=this.runtime)==null||u.setMessages([]),this.closeBuffer();return}let{normalizeConfig:t}=await Promise.resolve().then(()=>(Oi(),Zd)),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(()=>(Vf(),Uf));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(),au));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>Dx&&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()-qx;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(Wf),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(Wf,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 Vx(){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(()=>(Xf(),Gf));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:Vx(),...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(()=>(rm(),nm));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 qh=[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],Hh={replay:async()=>new(await Promise.resolve().then(()=>($m(),Hm))).ReplayFeature,inbox:async()=>new(await Promise.resolve().then(()=>(Qm(),Jm))).InboxFeature,profiler:async()=>new(await Promise.resolve().then(()=>(eh(),Zm))).ProfilerFeature,watchdog:async()=>new(await Promise.resolve().then(()=>(gh(),hh))).WatchdogFeature,inapp2:async()=>new(await Promise.resolve().then(()=>(Dh(),Fh))).InApp2Feature},hk={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=hk[n])!=null?e:["dom"]}$();function gk(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=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((w=r.errors)==null?void 0:w.beforeBreadcrumb);let l=k=>{var M,T;let C=gk(k.kind);C&&((T=(M=c.get("config"))==null?void 0:M.entitlement)==null?void 0:T.call(M,C))===!1||(uc(k),mc(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 qh)p[k.name]!==!1&&_a(k.name).every(C=>gt(C))&&c.add(k)};f();let m=async()=>{await Promise.all(Object.entries(Hh).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 T of Object.keys(M))Oe({[`group_${T}`]:M[T]});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}};$();function bk(){try{return typeof location!="undefined"?location.href:void 0}catch{return}}function $h(n,e=[]){var t;return{clientReportId:`bug_${H()}`,...n.title?{title:j(n.title)}:{},message:j((t=n.message)!=null?t:""),...n.email?{email:n.email}:{},url:bk(),...e.length?{console:e.slice(-20)}:{},timestamp:P()}}$();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),vc()){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(()=>(Wh(),Vh)).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(()=>(no(),Nu));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:[],l=$h({message:e.message,title:e.title,email:e.email},c),u=await this.rt.transport.submitBugReport(this.rt.session.sessionId,l);return await this.rt.pipeline.flush(),(i=u==null?void 0:u.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:Lk}ensureCoach(){return this.coachFeature?Promise.resolve(this.coachFeature):this.rt?Promise.resolve().then(()=>(Xh(),Gh)).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(()=>(eg(),Zh));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(),tg={unreadCount:0,total:0,syncStatus:"idle"},Lk={subscribe:n=>(n(tg),rt),onUnreadChange:n=>(n(0),rt),getState:()=>tg,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 _k(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),_k(window,n)}})();
635
717
  //# sourceMappingURL=scalebun.min.js.map