browsertrack 0.0.1 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/.github/workflows/docs.yml +54 -0
  2. package/AGENTS.md +133 -0
  3. package/README.md +143 -0
  4. package/dist/chunk-6VA7GBAO.js +246 -0
  5. package/dist/chunk-6VA7GBAO.js.map +1 -0
  6. package/dist/chunk-G2Y3CXCY.js +659 -0
  7. package/dist/chunk-G2Y3CXCY.js.map +1 -0
  8. package/dist/chunk-ILRYKMME.js +1228 -0
  9. package/dist/chunk-ILRYKMME.js.map +1 -0
  10. package/dist/chunk-SKCMT2DE.js +2641 -0
  11. package/dist/chunk-SKCMT2DE.js.map +1 -0
  12. package/dist/chunk-SPCIROIU.js +616 -0
  13. package/dist/chunk-SPCIROIU.js.map +1 -0
  14. package/dist/cli/index.js +2942 -0
  15. package/dist/cli/index.js.map +1 -0
  16. package/dist/client/index.cjs +2780 -0
  17. package/dist/client/index.d.ts +211 -0
  18. package/dist/client/index.js +20 -0
  19. package/dist/client/index.js.map +1 -0
  20. package/dist/client.iife.js +630 -0
  21. package/dist/core/index.d.ts +86 -0
  22. package/dist/core/index.js +37 -0
  23. package/dist/core/index.js.map +1 -0
  24. package/dist/daemon/index.d.ts +58 -0
  25. package/dist/daemon/index.js +32 -0
  26. package/dist/daemon/index.js.map +1 -0
  27. package/dist/engine-CeT9URuN.d.ts +161 -0
  28. package/dist/index.d.ts +11 -0
  29. package/dist/index.js +56 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/mcp/index.d.ts +11 -0
  32. package/dist/mcp/index.js +12 -0
  33. package/dist/mcp/index.js.map +1 -0
  34. package/dist/notes-CBvN91Wf.d.ts +260 -0
  35. package/dist/projects-CY8ungMt.d.ts +99 -0
  36. package/dist/server-Dd8NX2Mk.d.ts +55 -0
  37. package/docboot.config.js +16 -0
  38. package/docs/cli.md +51 -0
  39. package/docs/closed-loop-verification.md +57 -0
  40. package/docs/getting-started.md +122 -0
  41. package/docs/incidents-diagnostics.md +61 -0
  42. package/docs/index.md +46 -0
  43. package/docs/mcp-reference.md +128 -0
  44. package/docs/security-privacy.md +32 -0
  45. package/docs/visual-notes.md +67 -0
  46. package/examples/test-app/index.html +299 -0
  47. package/package.json +56 -7
  48. package/packages/cli/src/index.ts +413 -0
  49. package/packages/client/package.json +28 -0
  50. package/packages/client/src/breadcrumbs.ts +30 -0
  51. package/packages/client/src/client.ts +278 -0
  52. package/packages/client/src/commands/handler.ts +301 -0
  53. package/packages/client/src/config.ts +37 -0
  54. package/packages/client/src/index.ts +50 -0
  55. package/packages/client/src/interceptors/console.ts +68 -0
  56. package/packages/client/src/interceptors/interaction.ts +119 -0
  57. package/packages/client/src/interceptors/navigation.ts +93 -0
  58. package/packages/client/src/interceptors/network.ts +165 -0
  59. package/packages/client/src/interceptors/runtime.ts +65 -0
  60. package/packages/client/src/notes/inspector.ts +1553 -0
  61. package/packages/client/src/screenshot/browser-script-driver.ts +192 -0
  62. package/packages/client/src/screenshot/driver.ts +14 -0
  63. package/packages/client/src/transport/websocket.ts +194 -0
  64. package/packages/client/tsconfig.json +8 -0
  65. package/packages/core/package.json +26 -0
  66. package/packages/core/src/fingerprint.ts +120 -0
  67. package/packages/core/src/index.ts +9 -0
  68. package/packages/core/src/redaction.ts +174 -0
  69. package/packages/core/src/selector.ts +77 -0
  70. package/packages/core/src/types/commands.ts +101 -0
  71. package/packages/core/src/types/events.ts +108 -0
  72. package/packages/core/src/types/incidents.ts +54 -0
  73. package/packages/core/src/types/notes.ts +106 -0
  74. package/packages/core/src/types/probes.ts +44 -0
  75. package/packages/core/src/types/projects.ts +20 -0
  76. package/packages/core/tsconfig.json +8 -0
  77. package/packages/daemon/src/config.ts +29 -0
  78. package/packages/daemon/src/incidents/engine.ts +211 -0
  79. package/packages/daemon/src/index.ts +18 -0
  80. package/packages/daemon/src/notes/engine.ts +92 -0
  81. package/packages/daemon/src/notes/verification.ts +191 -0
  82. package/packages/daemon/src/server/daemon.ts +112 -0
  83. package/packages/daemon/src/server/http.ts +165 -0
  84. package/packages/daemon/src/server/ws.ts +246 -0
  85. package/packages/daemon/src/session/manager.ts +147 -0
  86. package/packages/daemon/src/storage/db.ts +742 -0
  87. package/packages/daemon/src/storage/screenshot-store.ts +49 -0
  88. package/packages/daemon/src/verification/engine.ts +264 -0
  89. package/packages/mcp/src/handlers.ts +398 -0
  90. package/packages/mcp/src/index.ts +3 -0
  91. package/packages/mcp/src/server.ts +86 -0
  92. package/packages/mcp/src/tools.ts +236 -0
  93. package/src/index.ts +4 -0
  94. package/test/client/interceptors.test.ts +130 -0
  95. package/test/core/fingerprint.test.ts +53 -0
  96. package/test/core/notes.test.ts +66 -0
  97. package/test/core/redaction.test.ts +60 -0
  98. package/test/daemon/incident-engine.test.ts +98 -0
  99. package/test/daemon/notes-storage.test.ts +130 -0
  100. package/test/daemon/notes-verification.test.ts +135 -0
  101. package/test/daemon/storage.test.ts +123 -0
  102. package/test/daemon/verification-engine.test.ts +88 -0
  103. package/test/e2e/daemon-mcp-e2e.test.ts +153 -0
  104. package/test/e2e/visual-notes-e2e.test.ts +205 -0
  105. package/test/mcp/handlers.test.ts +116 -0
  106. package/test/mcp/notes.test.ts +107 -0
  107. package/tsconfig.base.json +17 -0
  108. package/tsconfig.json +26 -0
  109. package/tsup.config.ts +54 -0
  110. package/vitest.config.ts +9 -0
@@ -0,0 +1,630 @@
1
+ "use strict";var BrowserTrack=(()=>{var tt=Object.defineProperty;var go=Object.getOwnPropertyDescriptor;var yo=Object.getOwnPropertyNames;var bo=Object.prototype.hasOwnProperty;var wo=(e,t,r)=>t in e?tt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var xo=(e,t)=>{for(var r in t)tt(e,r,{get:t[r],enumerable:!0})},vo=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of yo(t))!bo.call(e,o)&&o!==r&&tt(e,o,{get:()=>t[o],enumerable:!(n=go(t,o))||n.enumerable});return e};var So=e=>vo(tt({},"__esModule",{value:!0}),e);var N=(e,t,r)=>wo(e,typeof t!="symbol"?t+"":t,r);var hl={};xo(hl,{BreadcrumbBuffer:()=>Pe,BrowserScriptScreenshotDriver:()=>Ue,BrowserTrackClient:()=>ze,DEFAULT_OPTIONS:()=>ot,NoteInspector:()=>qe,getClient:()=>no,init:()=>hr});var Pe=class{constructor(t=50){N(this,"capacity");N(this,"buffer",[]);this.capacity=t}add(t){let r={...t,timestamp:t.timestamp||Date.now()};this.buffer.push(r),this.buffer.length>this.capacity&&this.buffer.shift()}getRecent(){return[...this.buffer]}clear(){this.buffer=[]}};var rt="[REDACTED]",ko=[/^authorization$/i,/^cookie$/i,/^set-cookie$/i,/password/i,/token/i,/secret/i,/api[-_]?key/i,/access[-_]?token/i,/refresh[-_]?token/i,/credentials/i,/private[-_]?key/i,/ssn/i,/credit[-_]?card/i,/cvv/i],kr=["token","auth","key","apikey","api_key","secret","password","access_token","refresh_token","code","signature"];function Co(e){if(!e)return!1;let t=e.replace(/[-_]/g,"");return ko.some(r=>r.test(e)||r.test(t))}function me(e){if(!e)return e;try{let t=!e.startsWith("http://")&&!e.startsWith("https://")&&!e.startsWith("ws://")&&!e.startsWith("wss://"),r="http://localhost",n=new URL(e,r),o=!1;for(let a of kr)n.searchParams.has(a)&&(n.searchParams.set(a,rt),o=!0);for(let a of Array.from(n.searchParams.keys()))Co(a)&&(n.searchParams.set(a,rt),o=!0);if(!o)return e;let i=t?n.pathname+n.search+n.hash:n.toString();return i=i.replace(/%5BREDACTED%5D/g,rt),i}catch{let t=e;for(let r of kr){let n=new RegExp(`([?&]${r}=)[^&#]+`,"gi");t=t.replace(n,`$1${rt}`)}return t}}function ge(e,t={}){if(!e||!e.tagName)return"unknown";let r=t.maxClasses??2,n=e.getAttribute("data-testid")||e.getAttribute("data-test")||e.getAttribute("data-cy")||e.getAttribute("data-qa");if(n)return`[data-testid="${n}"]`;let o=e.id;if(o&&!/^[0-9]+$/.test(o)&&!/[0-9a-f]{8}-[0-9a-f]{4}/i.test(o))return`#${o}`;let i=e.getAttribute("aria-label");if(i&&i.length<30)return`${e.tagName.toLowerCase()}[aria-label="${i}"]`;let a=e.getAttribute("name");if(a)return`${e.tagName.toLowerCase()}[name="${a}"]`;let s=e.tagName.toLowerCase(),l=Array.from(e.classList||[]).filter(c=>!c.startsWith("css-")&&!c.startsWith("_")&&!/^[a-z0-9]{5,}$/i.test(c)).slice(0,r);if(l.length>0){let c=l.map(d=>`.${d}`).join("");return`${s}${c}`}if(e.parentElement&&e.parentElement!==document.body&&e.parentElement!==document.documentElement){let c=ge(e.parentElement,{maxClasses:1});if(c&&c!=="unknown"&&!c.includes(">"))return`${c} > ${s}`}return s}function Se(e,t=200){return e?e.length<=t?e:e.slice(0,t)+"...":""}function Oe(e){let t=ge(e),r=e.tagName.toLowerCase(),n=e.id||void 0,o=Array.from(e.classList||[]),i,a=!0;try{let c=e.getBoundingClientRect();i={x:Math.round(c.x),y:Math.round(c.y),width:Math.round(c.width),height:Math.round(c.height),top:Math.round(c.top),left:Math.round(c.left),bottom:Math.round(c.bottom),right:Math.round(c.right)};let d=window.getComputedStyle(e);a=d.display!=="none"&&d.visibility!=="hidden"&&d.opacity!=="0"&&c.width>0&&c.height>0}catch{}let s;r!=="input"&&r!=="textarea"&&r!=="select"&&(s=Se(e.textContent?.trim(),80));let l=Se(e.outerHTML?.trim(),200);return{selector:t,tag:r,id:n,classes:o,boundingRect:i,visible:a,innerText:s,outerHTML:l}}function Cr(e){if(typeof document>"u")return()=>{};let t=n=>{try{let o=n.target;if(!o||!(o instanceof Element))return;let i=Oe(o),a=`click ${i.selector}${i.innerText?` ("${i.innerText}")`:""}`;e({type:"click",category:"ui",message:a,timestamp:Date.now(),element:i},i)}catch{}},r=n=>{try{let o=n.target;if(!o||!(o instanceof Element))return;let i=Oe(o),a=o.getAttribute("action")||"",s=`submit form ${i.selector}${a?` (action: ${a})`:""}`;e({type:"submit",category:"ui",message:s,timestamp:Date.now(),element:i},i)}catch{}};return document.addEventListener("click",t,{capture:!0,passive:!0}),document.addEventListener("submit",r,{capture:!0,passive:!0}),()=>{document.removeEventListener("click",t,{capture:!0}),document.removeEventListener("submit",r,{capture:!0})}}var nt=class{constructor(t){N(this,"screenshotDriver");this.screenshotDriver=t}async executeCommand(t){try{switch(t.type){case"reload":return this.handleReload(t);case"navigate":return this.handleNavigate(t);case"get_page_state":return this.handleGetPageState(t);case"query_element":return this.handleQueryElement(t);case"capture_element":return await this.handleCaptureElement(t);case"check_overflow":return this.handleCheckOverflow(t);case"get_element_rect":return this.handleGetElementRect(t);case"get_element_style":return this.handleGetElementStyle(t);default:return{id:t.id,ok:!1,error:`Unsupported command type: ${t.type}`}}}catch(r){return{id:t.id,ok:!1,error:r?.message||"Command execution failed"}}}handleReload(t){return typeof window<"u"&&window.location?(setTimeout(()=>{window.location.reload()},50),{id:t.id,ok:!0,result:{message:"Reload initiated"}}):{id:t.id,ok:!1,error:"No browser window available"}}handleNavigate(t){let r=t.params?.url;return r?typeof window<"u"&&window.location?(setTimeout(()=>{window.location.href=r},50),{id:t.id,ok:!0,result:{message:`Navigating to ${r}`}}):{id:t.id,ok:!1,error:"No browser window available"}:{id:t.id,ok:!1,error:"Missing target url parameter"}}handleGetPageState(t){if(typeof window>"u"||typeof document>"u")return{id:t.id,ok:!1,error:"No browser document available"};let r=document.activeElement&&document.activeElement!==document.body?Oe(document.activeElement):void 0;return{id:t.id,ok:!0,result:{url:window.location.href,route:window.location.pathname+window.location.search+window.location.hash,title:document.title,readyState:document.readyState,activeElement:r}}}handleQueryElement(t){if(typeof document>"u")return{id:t.id,ok:!1,error:"No browser document available"};let r=t.params?.selector;if(!r)return{id:t.id,ok:!1,error:"Missing selector parameter"};let n=document.querySelector(r);if(!n)return{id:t.id,ok:!0,result:{exists:!1}};let o=Oe(n);return{id:t.id,ok:!0,result:{exists:!0,visible:o.visible,tag:o.tag,id:o.id,classes:o.classes,boundingRect:o.boundingRect,innerText:o.innerText,outerHTML:o.outerHTML}}}async handleCaptureElement(t){let r=t.params?.selector,n=null;if(r){if(n=document.querySelector(r),!n)return{id:t.id,ok:!1,reason:`ELEMENT_NOT_FOUND: ${r}`,error:`Element not found for selector: ${r}`}}else n=document.body||document.documentElement;let o=await this.screenshotDriver.captureElement(n);return o.ok?{id:t.id,ok:!0,result:{dataUrl:o.dataUrl,format:o.format,width:o.width,height:o.height}}:{id:t.id,ok:!1,reason:o.reason||"CAPTURE_FAILED",error:o.reason||"Failed to capture element screenshot"}}handleCheckOverflow(t){if(typeof window>"u"||typeof document>"u")return{id:t.id,ok:!1,error:"No browser window available"};let r=t.params?.selector;if(!r)return{id:t.id,ok:!1,error:"Missing selector parameter"};let n=document.querySelector(r);if(!n)return{id:t.id,ok:!1,error:`Element not found: ${r}`};let o=n.getBoundingClientRect(),i=window.innerWidth,a=window.innerHeight,s=Math.max(0,Math.round(o.right-i)),l=Math.max(0,Math.round(o.bottom-a)),c=s>0||o.left<0,d=!1;return n.parentElement&&(d=n.parentElement.scrollWidth>n.parentElement.clientWidth),{id:t.id,ok:!0,result:{selector:r,overflow:c||d,viewportWidth:i,viewportHeight:a,rect:{x:Math.round(o.x),y:Math.round(o.y),width:Math.round(o.width),height:Math.round(o.height),top:Math.round(o.top),left:Math.round(o.left),bottom:Math.round(o.bottom),right:Math.round(o.right)},overflowRightPx:s,overflowBottomPx:l,parentOverflow:d}}}handleGetElementRect(t){if(typeof document>"u")return{id:t.id,ok:!1,error:"No browser document available"};let r=t.params?.selector;if(!r)return{id:t.id,ok:!1,error:"Missing selector parameter"};let n=document.querySelector(r);if(!n)return{id:t.id,ok:!1,error:`Element not found: ${r}`};let o=n.getBoundingClientRect();return{id:t.id,ok:!0,result:{x:Math.round(o.x),y:Math.round(o.y),width:Math.round(o.width),height:Math.round(o.height),top:Math.round(o.top),left:Math.round(o.left),bottom:Math.round(o.bottom),right:Math.round(o.right)}}}handleGetElementStyle(t){if(typeof window>"u"||typeof document>"u")return{id:t.id,ok:!1,error:"No browser window available"};let r=t.params?.selector;if(!r)return{id:t.id,ok:!1,error:"Missing selector parameter"};let n=document.querySelector(r);if(!n)return{id:t.id,ok:!1,error:`Element not found: ${r}`};let o=window.getComputedStyle(n),i=t.params?.properties||["overflow","overflowX","overflowY","width","maxWidth","display","position"],a={};for(let s of i)a[s]=o.getPropertyValue(s)||o[s]||"";return{id:t.id,ok:!0,result:{selector:r,styles:a}}}};var ot={daemonUrl:"ws://127.0.0.1:7331",projectId:"",maxBreadcrumbs:50,captureErrors:!0,captureConsole:!0,captureNetwork:!0,captureNavigation:!0,captureInteractions:!0,onErrorScreenshot:!0,notes:{enabled:!0,shortcut:"Alt+Click",showBadges:!0,maskSelectors:['input[type="password"]',"[data-sensitive]"]},debug:!1};function Mr(e){if(typeof console>"u")return()=>{};let t=console.error,r=console.warn;function n(o){return o.map(i=>{if(i instanceof Error)return i.stack||`${i.name}: ${i.message}`;if(typeof i=="object"&&i!==null)try{return JSON.stringify(i)}catch{return String(i)}return String(i)}).join(" ")}return console.error=function(...o){try{let i=n(o),a=new Error().stack;e({level:"error",message:i,stack:a,timestamp:Date.now()})}catch{}return t.apply(console,o)},console.warn=function(...o){try{let i=n(o),a=new Error().stack;e({level:"warn",message:i,stack:a,timestamp:Date.now()})}catch{}return r.apply(console,o)},()=>{console.error=t,console.warn=r}}function Er(e){if(typeof window>"u"||typeof history>"u")return()=>{};let t=me(window.location.href);e({to:t,type:"initial",timestamp:Date.now()});let r=history.pushState,n=history.replaceState;history.pushState=function(a,s,l){let c=t,d=r.apply(history,[a,s,l]);try{let u=me(window.location.href);t=u,e({from:c,to:u,type:"pushState",timestamp:Date.now()})}catch{}return d},history.replaceState=function(a,s,l){let c=t,d=n.apply(history,[a,s,l]);try{let u=me(window.location.href);t=u,e({from:c,to:u,type:"replaceState",timestamp:Date.now()})}catch{}return d};let o=()=>{let a=t,s=me(window.location.href);t=s,e({from:a,to:s,type:"popstate",timestamp:Date.now()})},i=()=>{let a=t,s=me(window.location.href);t=s,e({from:a,to:s,type:"hashchange",timestamp:Date.now()})};return window.addEventListener("popstate",o),window.addEventListener("hashchange",i),()=>{history.pushState=r,history.replaceState=n,window.removeEventListener("popstate",o),window.removeEventListener("hashchange",i)}}function $r(e){let t=[];if(typeof window<"u"&&typeof window.fetch=="function"){let r=window.fetch;window.fetch=async function(n,o){let i=Date.now(),a="",s="GET";try{typeof n=="string"?a=n:n instanceof URL?a=n.toString():n&&typeof n=="object"&&"url"in n&&(a=n.url,s=n.method||"GET"),o&&o.method&&(s=o.method.toUpperCase())}catch{a="unknown_url"}let l=me(a);try{let c=await r.apply(window,[n,o]),d=Date.now()-i;return e({url:l,method:s,status:c.status,statusText:c.statusText,durationMs:d,timestamp:i}),c}catch(c){let d=Date.now()-i,u=c?.name==="AbortError";throw e({url:l,method:s,durationMs:d,error:c?.message||"Network request failed",aborted:u,timestamp:i}),c}},t.push(()=>{window.fetch=r})}if(typeof window<"u"&&typeof window.XMLHttpRequest=="function"){let r=XMLHttpRequest.prototype.open,n=XMLHttpRequest.prototype.send,o=XMLHttpRequest.prototype.abort,i=new WeakMap;XMLHttpRequest.prototype.open=function(...a){try{let s=String(a[0]||"GET").toUpperCase(),l=String(a[1]||"");i.set(this,{url:me(l),method:s,startTime:Date.now()})}catch{}return r.apply(this,a)},XMLHttpRequest.prototype.abort=function(){let a=i.get(this);return a&&(a.aborted=!0),o.apply(this)},XMLHttpRequest.prototype.send=function(a){let s=i.get(this)||{url:"unknown_url",method:"GET",startTime:Date.now()},l=()=>{try{let d=Date.now()-s.startTime;e({url:s.url,method:s.method,status:this.status,statusText:this.statusText,durationMs:d,aborted:s.aborted,timestamp:s.startTime})}catch{}},c=()=>{try{let d=Date.now()-s.startTime;e({url:s.url,method:s.method,status:this.status||0,durationMs:d,error:"XHR Network Error",aborted:s.aborted,timestamp:s.startTime})}catch{}};return this.addEventListener("load",l,{once:!0}),this.addEventListener("error",c,{once:!0}),this.addEventListener("timeout",c,{once:!0}),n.apply(this,[a])},t.push(()=>{XMLHttpRequest.prototype.open=r,XMLHttpRequest.prototype.send=n,XMLHttpRequest.prototype.abort=o})}return()=>{for(let r of t)try{r()}catch{}}}function Ar(e){if(typeof window>"u")return()=>{};let t=n=>{try{let o={message:n.message||n.error&&n.error.message||"Script error",stack:n.error&&n.error.stack||void 0,filename:n.filename||void 0,lineno:n.lineno||void 0,colno:n.colno||void 0,errorType:n.error&&n.error.name||"Error",timestamp:Date.now()};e(o,n.error)}catch{}},r=n=>{try{let o=n.reason,i="Unhandled Promise Rejection",a,s="UnhandledRejection";if(o instanceof Error)i=o.message,a=o.stack,s=o.name||"UnhandledRejection";else if(typeof o=="string")i=o;else if(o&&typeof o=="object")try{i=JSON.stringify(o)}catch{i=String(o)}let l={message:i,stack:a,errorType:s,timestamp:Date.now()};e(l,o)}catch{}};return window.addEventListener("error",t),window.addEventListener("unhandledrejection",r),()=>{window.removeEventListener("error",t),window.removeEventListener("unhandledrejection",r)}}var Mo=Object.defineProperty,ae=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}},_e=(e,t)=>{for(var r in t)Mo(e,r,{get:t[r],enumerable:!0})};function Eo(e){if(e===!0)return"soft";if(e===!1)return"disabled";if(typeof e=="string"){let t=e.toLowerCase().trim();if(t==="auto")return"auto";if(t==="full")return"full";if(t==="soft"||t==="disabled")return t}return"soft"}function $o(e="soft"){switch(e){case"auto":{C.session.styleMap=new Map,C.session.nodeMap=new Map;return}case"soft":{C.session.styleMap=new Map,C.session.nodeMap=new Map,C.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{C.session.styleMap=new Map,C.session.nodeMap=new Map,C.session.styleCache=new WeakMap,C.computedStyle=new WeakMap,C.measureHints=new WeakMap,C.baseStyle=new re(50),C.defaultStyle=new re(30),C.image=new re(100),C.background=new re(100),C.resource=new re(150),C.compress=new re(50),C.font=new Set;return}default:{C.session.styleMap=new Map,C.session.nodeMap=new Map,C.session.styleCache=new WeakMap;return}}}var re,C,ne=ae(()=>{"use strict";re=class extends Map{constructor(e=100,...t){super(...t),this._maxSize=e}set(e,t){if(this.size>=this._maxSize&&!this.has(e)){let r=this.keys().next().value;r!==void 0&&this.delete(r)}return super.set(e,t)}},C={image:new re(100),background:new re(100),resource:new re(150),defaultStyle:new re(30),baseStyle:new re(50),compress:new re(50),computedStyle:new WeakMap,measureHints:new WeakMap,burstAdvice:new WeakMap,warnedReconcile:!1,font:new Set,session:{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map}}});function nr(e){let t=e.match(/url\((['"]?)(.*?)(\1)\)/);if(!t)return null;let r=t[2].trim();return r.startsWith("#")?null:r}function cn(e,t=1){let r=e.match(/^\s*-?(?:webkit-)?image-set\(([\s\S]*)\)\s*$/i);if(!r)return null;let n=[];for(let o of r[1].split(",")){let i=o.match(/url\((['"]?)(.*?)(\1)\)/);if(!i)continue;let a=o.match(/type\(\s*["']([^"']+)["']\s*\)/i);if(a&&!dn.test(a[1].trim()))continue;let s=o.match(/(\d+(?:\.\d+)?)\s*(x|dpi|dppx)/i),l=1;if(s){let c=parseFloat(s[1]);l=/dpi/i.test(s[2])?c/96:c}n.push({url:i[2].trim(),dppx:l})}return n.length?(n.sort((o,i)=>o.dppx-i.dppx),(n.find(o=>o.dppx>=t)||n[n.length-1]).url):null}function Ao(e){if(!e||e==="none")return"";let t=e.replace(/translate[XY]?\([^)]*\)/g,"");return t=t.replace(/matrix\(([^)]+)\)/g,(r,n)=>{let o=n.split(",").map(i=>i.trim());return o.length!==6?`matrix(${n})`:(o[4]="0",o[5]="0",`matrix(${o.join(", ")})`)}),t=t.replace(/matrix3d\(([^)]+)\)/g,(r,n)=>{let o=n.split(",").map(i=>i.trim());return o.length!==16?`matrix3d(${n})`:(o[12]="0",o[13]="0",`matrix3d(${o.join(", ")})`)}),t.trim().replace(/\s{2,}/g," ")}function xt(e){if(/%[0-9A-Fa-f]{2}/.test(e))return e;try{return encodeURI(e)}catch{return e}}function Ro(e,t){if(!e||/^(data|blob|about|#)/i.test(e.trim()))return e;try{let r=t||typeof document<"u"&&(document.baseURI||document.location?.href)||"http://localhost/";return new URL(e,r).href}catch{return e}}var dn,Et=ae(()=>{"use strict";dn=/^image\/(jpeg|jpg|png|gif|webp|avif|apng|svg\+xml|bmp|x-icon|vnd\.microsoft\.icon)\s*(;|$)/i});function No(e="[snapDOM]",{ttlMs:t=5*6e4,maxEntries:r=12}={}){let n=new Map,o=0;function i(a,s,l){if(o>=r)return;let c=Date.now();(n.get(s)||0)>c||(n.set(s,c+t),o++,a==="warn"&&console&&console.warn?console.warn(`${e} ${l}`):console&&console.error&&console.error(`${e} ${l}`))}return{warnOnce(a,s){i("warn",a,s)},errorOnce(a,s){i("error",a,s)},reset(){n.clear(),o=0}}}function Lo(e){return/^data:|^blob:|^about:blank$/i.test(e)}function To(e,t){try{let r=typeof location<"u"&&location.href?location.href:"http://localhost/",n=t.includes("{url}")?t.split("{url}")[0]:t,o=new URL(n||".",r),i=new URL(e,r);if(i.origin===o.origin)return!0;let a=i.searchParams;if(a&&(a.has("url")||a.has("target")))return!0}catch{}return!1}function Fo(e,t){if(!t||Lo(e)||To(e,t))return!1;try{let r=typeof location<"u"&&location.href?location.href:"http://localhost/",n=new URL(e,r);return typeof location<"u"?n.origin!==location.origin:!0}catch{return!!t}}function Po(e,t){if(!t)return e;if(t.includes("{url}"))return t.replace("{urlRaw}",xt(e)).replace("{url}",encodeURIComponent(e));if(/[?&]url=?$/.test(t))return`${t}${encodeURIComponent(e)}`;if(t.endsWith("?"))return`${t}url=${encodeURIComponent(e)}`;if(t.endsWith("/"))return`${t}${xt(e)}`;let r=t.includes("?")?"&":"?";return`${t}${r}url=${encodeURIComponent(e)}`}function Rr(e){return new Promise((t,r)=>{let n=new FileReader;n.onload=()=>t(String(n.result||"")),n.onerror=()=>r(new Error("read_failed")),n.readAsDataURL(e)})}function Oo(e,t){return[t.as||"blob",t.timeout??3e3,t.useProxy||"",t.errorTTL??8e3,e].join("|")}async function le(e,t={}){let r=t.as??"blob",n=t.timeout??3e3,o=t.useProxy||"",i=t.errorTTL??8e3,a=t.headers||{},s=!!t.silent;if(/^data:/i.test(e))try{if(r==="text")return{ok:!0,data:String(e),status:200,url:e,fromCache:!1};if(r==="dataURL")return{ok:!0,data:String(e),status:200,url:e,fromCache:!1,mime:String(e).slice(5).split(";")[0]||""};let[,y="",b=""]=String(e).match(/^data:([^,]*),(.*)$/)||[],x=/;base64/i.test(y)?atob(b):decodeURIComponent(b),v=new Uint8Array([...x].map(w=>w.charCodeAt(0))),g=new Blob([v],{type:(y||"").split(";")[0]||""});return{ok:!0,data:g,status:200,url:e,fromCache:!1,mime:g.type||""}}catch{return{ok:!1,data:null,status:0,url:e,fromCache:!1,reason:"special_url_error"}}if(/^blob:/i.test(e))try{let y=await fetch(e);if(!y.ok)return{ok:!1,data:null,status:y.status,url:e,fromCache:!1,reason:"http_error"};let b=await y.blob(),x=b.type||y.headers.get("content-type")||"";return r==="dataURL"?{ok:!0,data:await Rr(b),status:y.status,url:e,fromCache:!1,mime:x}:r==="text"?{ok:!0,data:await b.text(),status:y.status,url:e,fromCache:!1,mime:x}:{ok:!0,data:b,status:y.status,url:e,fromCache:!1,mime:x}}catch{return{ok:!1,data:null,status:0,url:e,fromCache:!1,reason:"network"}}if(/^about:blank$/i.test(e))return r==="dataURL"?{ok:!0,data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==",status:200,url:e,fromCache:!1,mime:"image/png"}:{ok:!0,data:r==="text"?"":new Blob([]),status:200,url:e,fromCache:!1};let l=Oo(e,{as:r,timeout:n,useProxy:o,errorTTL:i}),c=De.get(l);if(c&&c.until>Date.now())return{...c.result,fromCache:!0};c&&De.delete(l);let d=dt.get(l);if(d)return d;let u=Fo(e,o)?Po(e,o):e,p=t.credentials;if(!p)try{let y=typeof location<"u"&&location.href?location.href:"http://localhost/",b=new URL(e,y);p=typeof location<"u"&&b.origin===location.origin?"include":"omit"}catch{p="omit"}let h=new AbortController,f=setTimeout(()=>h.abort("timeout"),n),m=(async()=>{try{let y=await fetch(u,{signal:h.signal,credentials:p,headers:a});if(!y.ok){let v={ok:!1,data:null,status:y.status,url:u,fromCache:!1,reason:"http_error"};if(i>0&&De.set(l,{until:Date.now()+i,result:v}),!s){let g=`${y.status} ${y.statusText||""}`.trim();Wt.warnOnce(`http:${y.status}:${r}:${new URL(e,location?.href??"http://localhost/").origin}`,`HTTP error ${g} while fetching ${r} ${e}`)}return t.onError&&t.onError(v),v}if(r==="text")return{ok:!0,data:await y.text(),status:y.status,url:u,fromCache:!1};let b=await y.blob(),x=b.type||y.headers.get("content-type")||"";return r==="dataURL"?{ok:!0,data:await Rr(b),status:y.status,url:u,fromCache:!1,mime:x}:{ok:!0,data:b,status:y.status,url:u,fromCache:!1,mime:x}}catch(y){let b=y&&typeof y=="object"&&"name"in y&&y.name==="AbortError"?String(y.message||"").includes("timeout")?"timeout":"abort":"network",x={ok:!1,data:null,status:0,url:u,fromCache:!1,reason:b};if(!/^blob:/i.test(e)&&i>0&&De.set(l,{until:Date.now()+i,result:x}),!s){let v=`${b}:${r}:${new URL(e,location?.href??"http://localhost/").origin}`,g=b==="timeout"?`Timeout after ${n}ms. Consider increasing timeout or using a proxy for ${e}`:b==="abort"?`Request aborted while fetching ${r} ${e}`:`Network/CORS issue while fetching ${r} ${e}. A proxy may be required`;Wt.errorOnce(v,g)}return t.onError&&t.onError(x),x}finally{clearTimeout(f),dt.delete(l)}})();return dt.set(l,m),m}var Wt,dt,De,$e=ae(()=>{"use strict";Et(),Wt=No("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),dt=new Map,De=new Map});async function un(e,t={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(e)||e.trim()==="none")return e;let r=cn(e,typeof devicePixelRatio<"u"&&devicePixelRatio||1)??nr(e);if(!r)return e;let n=Ro(r),o=xt(n),i=(t.useProxy||"")+"|"+o;if(C.background.has(i)){let a=C.background.get(i);return a?`url("${a}")`:"none"}try{let a=await le(o,{as:"dataURL",useProxy:t.useProxy});return a.ok?(C.background.set(i,a.data),`url("${a.data}")`):(C.background.set(i,null),"none")}catch{return C.background.set(i,null),"none"}}var Io=ae(()=>{"use strict";ne(),Et(),$e()});function pn(e){if(e=String(e).toLowerCase(),ir.has(e)){let i={};return C.defaultStyle.set(e,i),i}if(C.defaultStyle.has(e))return C.defaultStyle.get(e);let t=document.getElementById("snapdom-sandbox");t||(t=document.createElement("div"),t.id="snapdom-sandbox",t.setAttribute("data-snapdom-sandbox","true"),t.setAttribute("aria-hidden","true"),t.style.position="absolute",t.style.left="-9999px",t.style.top="-9999px",t.style.width="0px",t.style.height="0px",t.style.overflow="hidden",document.body.appendChild(t));let r=document.createElement(e);r.style.all="initial",t.appendChild(r);let n=getComputedStyle(r),o={};for(let i of n){if(or(i))continue;let a=n.getPropertyValue(i);o[i]=a}return t.removeChild(r),C.defaultStyle.set(e,o),o}function or(e){let t=_t.get(e);if(t===void 0){let r=String(e).toLowerCase();t=yn.has(r)||gn.test(r)||mn.test(r),_t.set(e,t)}return t}function hn(e,t){return!wn.has(e)&&(t==="inline"||bn.has(e)||ar.has(e))}function Do(e,t,r){let n=(t.display||"").toLowerCase();if(n==="inline"||ar.has(e))return!1;if(r)return!0;if((t.float||"none").toLowerCase()!=="none")return!1;let o=(t.position||"static").toLowerCase();return o==="absolute"||o==="fixed"?!1:!kn.has(n)}function Ht(e,t,r=!0,n=!1){if(t=String(t||"").toLowerCase(),ir.has(t))return"";let o=[],i=pn(t),a=(e.display||"").toLowerCase(),s=a==="inline",l=hn(t,a),c=e["text-wrap-mode"]||e["white-space"]||"",d=c==="nowrap"||c==="pre",u=l&&r&&!(l&&r&&!s&&d),p=!1;for(let h in e){if(or(h))continue;let f=e[h];if(u){if(xn.has(h))continue;if(vn.has(h)){f&&f!==i[h]&&(o.push(`${h}:${f}`),f!=="auto"&&(p=!0));continue}}if(f&&f!==i[h]){if(!d&&(h==="width"||h==="inline-size")&&f.endsWith("px")&&f.includes(".")){let m=parseFloat(f);if(Number.isFinite(m)){o.push(`${h}:${(m+Sn).toFixed(3)}px`);continue}}o.push(`${h}:${f}`)}}if(u&&!s&&!n&&!p){let h=e.width;h&&h!=="auto"&&h!==i.width&&o.push(`min-width:${h}`)}return o.sort(),o.join(";")}function Wo(e){let t=new Set;return e.nodeType!==Node.ELEMENT_NODE&&e.nodeType!==Node.DOCUMENT_FRAGMENT_NODE?[]:(e.tagName&&t.add(e.tagName.toLowerCase()),typeof e.querySelectorAll=="function"&&e.querySelectorAll("*").forEach(r=>t.add(r.tagName.toLowerCase())),Array.from(t))}function Ho(e){let t=new Map;for(let n of e){let o=pn(n);if(!o)continue;let i=Object.entries(o).map(([a,s])=>`${a}:${s};`).sort().join("");i&&(t.has(i)||t.set(i,[]),t.get(i).push(n))}let r="";for(let[n,o]of t.entries())r+=`${o.join(",")} { ${n} }
2
+ `;return r}function Bo(e){let t=Array.from(new Set(e.values())).filter(Boolean).sort(),r=new Map,n=1;for(let o of t)r.set(o,`c${n++}`);return r}function _o(e){try{let t=e?.ownerDocument;if(!t)return typeof window<"u"?window:null;let r=t.defaultView;if(r&&typeof r.getComputedStyle=="function")return r;if(typeof window<"u"&&window.frames)for(let n=0;n<window.frames.length;n++)try{if(window.frames[n]?.document===t)return window.frames[n]}catch{}}catch{}return typeof window<"u"?window:null}function _(e,t=null){let r=()=>{let i={length:0,getPropertyValue:()=>"",item:()=>""};return i[Symbol.iterator]=function*(){},i};if(e?.nodeType!==1){let i=typeof window<"u"?window:null;if(i&&typeof i.getComputedStyle=="function")try{return i.getComputedStyle(e,t)||r()}catch{return r()}return r()}let n=C.computedStyle.get(e);n||(n=new Map,C.computedStyle.set(e,n));let o=n.get(t);if(!o){let i=_o(e),a=null;try{a=i&&typeof i.getComputedStyle=="function"?i.getComputedStyle(e,t):null}catch{}if(!a&&typeof window<"u"&&typeof window.getComputedStyle=="function")try{e.ownerDocument===document&&(a=window.getComputedStyle(e,t))}catch{}o=a||r(),n.set(t,o)}return o}function Nr(e){let t={};for(let r of e)t[r]=e.getPropertyValue(r);for(let r of Cn){let n=t[`border-${r}-style`],o=t[`border-${r}-width`];(n==="none"||n==="hidden"||o==="0px")&&(delete t[`border-${r}-style`],delete t[`border-${r}-width`],delete t[`border-${r}-color`])}return t}function Bt(e){let t=[],r=0,n=0;for(let o=0;o<e.length;o++){let i=e[o];i==="("&&r++,i===")"&&r--,i===","&&r===0&&(t.push(e.slice(n,o).trim()),n=o+1)}return t.push(e.slice(n).trim()),t}var fn,ir,jo,mn,gn,yn,_t,bn,ar,wn,xn,vn,Sn,kn,Cn,$t=ae(()=>{"use strict";ne(),fn=new Set(["meta","script","noscript","title","link","template"]),ir=new Set(["meta","link","style","title","noscript","script","template","g","defs","use","marker","mask","clipPath","pattern","symbol","path","polygon","polyline","line","circle","ellipse","rect","filter","lineargradient","radialgradient","stop"]),jo=["div","span","p","a","img","ul","li","button","input","select","textarea","label","section","article","header","footer","nav","main","aside","h1","h2","h3","h4","h5","h6","table","thead","tbody","tr","td","th"],mn=/(?:^|-)(animation|transition)(?:-|$)/i,gn=/^(--.+|view-timeline|scroll-timeline|animation-trigger|offset-|position-try|app-region|interactivity|overlay|view-transition|-webkit-locale|-webkit-user-(?:drag|modify)|-webkit-tap-highlight-color|-webkit-text-security)$/i,yn=new Set(["cursor","pointer-events","touch-action","user-select","print-color-adjust","speak","reading-flow","reading-order","anchor-name","anchor-scope","container-name","container-type","timeline-scope","zoom","stroke-color"]),_t=new Map,bn=new Set(["span","small","em","strong","b","i","u","s","code","cite","mark","sub","sup"]),ar=new Set(["table","thead","tbody","tfoot","tr","td","th"]),wn=new Set(["img","video","canvas","svg","iframe","embed","object","input","textarea","select"]),xn=new Set(["width","max-width","inline-size","max-inline-size"]),vn=new Set(["min-width","min-inline-size"]),Sn=.001,kn=new Set(["inline-block","inline-flex","inline-grid","inline-table","inline-flow-root","table"]),Cn=["top","right","bottom","left"]});function ut(e,{fast:t=!1}={}){if(t)return e();"requestIdleCallback"in window?requestIdleCallback(e,{timeout:50}):setTimeout(e,1)}function Me(e=1e3){return typeof requestAnimationFrame!="function"||typeof document<"u"&&document.visibilityState==="hidden"?Promise.resolve():new Promise(t=>{let r=!1,n=()=>{r||(r=!0,t())};try{requestAnimationFrame(n)}catch{n();return}setTimeout(n,e)})}function Uo(){if(typeof navigator>"u")return!1;if(navigator.userAgentData)return navigator.userAgentData.platform==="iOS";let e=navigator.userAgent||"",t=/iPhone|iPad|iPod/.test(e),r=navigator.maxTouchPoints>2&&/Macintosh/.test(e);return t||r}function we(){if(typeof navigator>"u")return!1;let e=navigator.userAgent||"",t=e.toLowerCase(),r=t.includes("safari")&&!t.includes("chrome")&&!t.includes("crios")&&!t.includes("fxios")&&!t.includes("android"),n=/applewebkit/i.test(e),o=/mobile/i.test(e),i=!/safari/i.test(e),a=n&&o&&i,s=/(micromessenger|wxwork|wecom|windowswechat|macwechat)/i.test(e),l=/(baiduboxapp|baidubrowser|baidusearch|baiduboxlite)/i.test(t),c=/ipad|iphone|ipod/.test(t)&&n;return r||a||s||l||c}function qo(){if(typeof navigator>"u")return!1;let e=(navigator.userAgent||"").toLowerCase();return e.includes("firefox")||e.includes("fxios")}var Ae=ae(()=>{"use strict"});function j(e,t,r){let n=e&&typeof e=="object"&&(e.options||e);n&&n.debug&&(r!==void 0?console.warn("[snapdom]",t,r):console.warn("[snapdom]",t))}var Mn=ae(()=>{"use strict"}),de=ae(()=>{"use strict";Io(),$t(),Ae(),Et(),Mn()}),En={};_e(En,{decodeSvgFromDataURL:()=>sr,encodeSvgToDataURL:()=>lr,fixSafariShadows:()=>cr,toCanvas:()=>At});function zo(e){try{let t=e.match(/<svg\b[^>]*>/i);if(!t)return e;let r=t[0],n=parseFloat((r.match(/\bwidth="([\d.]+)/i)||[])[1]),o=parseFloat((r.match(/\bheight="([\d.]+)/i)||[])[1]);if(!Number.isFinite(n)||!Number.isFinite(o)||n<=0||o<=0)return e;let i=Math.min(1,be/n,be/o,Math.sqrt(vt/(n*o)));if(i>=1)return e;let a=Math.max(1,Math.floor(n*i)),s=Math.max(1,Math.floor(o*i));return console.warn(`[snapDOM] Capture ${Math.round(n)}\xD7${Math.round(o)}px exceeds the browser image-decode limit (${be}px/side); downscaling to ${a}\xD7${s}px. Lower \`scale\` or set \`width\`/\`height\` to control output size.`),e.replace(r,r.replace(/(\bwidth=")[\d.]+/i,`$1${a}`).replace(/(\bheight=")[\d.]+/i,`$1${s}`))}catch{return e}}function Vo(e,t){let r=["x","y","width","height"].map(k=>Number(t?.[k]));if(!r.every(Number.isFinite)||r[2]<=0||r[3]<=0)throw new RangeError("[snapdom] canvas crop requires finite x/y and positive width/height");let n=e.match(/<svg\b[^>]*>/i);if(!n)throw new Error("[snapdom] cannot crop a non-SVG capture");let o=n[0],i=(o.match(/\bviewBox="([^"]+)"/i)||[])[1],a=String(i||"").trim().split(/[\s,]+/).map(Number);if(a.length!==4||!a.every(Number.isFinite)||a[2]<=0||a[3]<=0)throw new Error("[snapdom] cannot crop an SVG without a finite viewBox");let[s,l,c,d]=a,u=Math.max(s,r[0]),p=Math.max(l,r[1]),h=Math.min(s+c,r[0]+r[2]),f=Math.min(l+d,r[1]+r[3]);if(!(h>u)||!(f>p))throw new RangeError("[snapdom] canvas crop does not intersect the SVG viewBox");let m=parseFloat((o.match(/\bwidth="([\d.]+)/i)||[])[1]),y=parseFloat((o.match(/\bheight="([\d.]+)/i)||[])[1]),b=Number.isFinite(m)&&m>0?m/c:1,x=Number.isFinite(y)&&y>0?y/d:1,v=Math.max(1,(h-u)*b),g=Math.max(1,(f-p)*x),w=o.replace(/(\bwidth=")[^"]*/i,`$1${v}`).replace(/(\bheight=")[^"]*/i,`$1${g}`).replace(/(\bviewBox=")[^"]*/i,`$1${u} ${p} ${h-u} ${f-p}`);return e.replace(o,w)}function Lr(e){return typeof e=="string"&&/^data:image\/svg\+xml/i.test(e)}function sr(e){let t=e.indexOf(",");return t>=0?decodeURIComponent(e.slice(t+1)):""}function Xo(e){let t=e.indexOf(",");if(t<0)return"";let r=e.slice(t+1,t+1201).replace(/%[0-9A-Fa-f]?$/,"");try{return decodeURIComponent(r)}catch{return""}}function lr(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}function $n(e){let t=[],r="",n=0;for(let o=0;o<e.length;o++){let i=e[o];i==="("&&n++,i===")"&&(n=Math.max(0,n-1)),i===";"&&n===0?(t.push(r),r=""):r+=i}return r.trim()&&t.push(r),t.map(o=>o.trim()).filter(Boolean)}function Yo(e){let t=[],r="",n=0;for(let i=0;i<e.length;i++){let a=e[i];a==="("&&n++,a===")"&&(n=Math.max(0,n-1)),a===","&&n===0?(t.push(r.trim()),r=""):r+=a}r.trim()&&t.push(r.trim());let o=[];for(let i of t){if(/\binset\b/i.test(i))continue;let a=i.match(/-?\d+(?:\.\d+)?px/gi)||[],[s="0px",l="0px",c="0px"]=a;c=`${parseFloat(c)/2}px`;let d=i.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/ig,"").trim().replace(/\s{2,}/g," "),u=!!d&&d!==",";o.push(`drop-shadow(${s} ${l} ${c}${u?` ${d}`:""})`)}return o.join(" ")}function An(e){let t=$n(e),r=null,n=null,o=null,i=[];for(let s of t){let l=s.indexOf(":");if(l<0)continue;let c=s.slice(0,l).trim().toLowerCase(),d=s.slice(l+1).trim();c==="box-shadow"?o=d:c==="filter"?r=d:c==="-webkit-filter"?n=d:i.push([c,d])}if(o){let s=Yo(o);s&&(r=r?`${r} ${s}`:s,n=n?`${n} ${s}`:s)}let a=[...i];return r&&a.push(["filter",r]),n&&a.push(["-webkit-filter",n]),a.map(([s,l])=>`${s}:${l}`).join(";")}function Go(e){return e.replace(/([^{}]+)\{([^}]*)\}/g,(t,r,n)=>`${r}{${An(n)}}`)}function Ko(e){return e=e.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(t,r)=>t.replace(r,Go(r))),e=e.replace(/style=(['"])([\s\S]*?)\1/gi,(t,r,n)=>`style=${r}${An(n)}${r}`),e}function Qo(){return pt||(pt=(async()=>{try{let e='<svg xmlns="http://www.w3.org/2000/svg" width="8" height="20"><foreignObject width="8" height="20"><div xmlns="http://www.w3.org/1999/xhtml" style="width:4px;height:4px;margin-top:8px;background:#000;box-shadow:0 8px 0 0 #000"></div></foreignObject></svg>',t=new Image;t.decoding="sync",t.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`,await t.decode();let r=document.createElement("canvas");r.width=8,r.height=20;let n=r.getContext("2d",{willReadFrequently:!0});n.drawImage(t,0,0);let o=n.getImageData(2,18,1,1).data[3]>128,i=n.getImageData(2,2,1,1).data[3]>128;return{native:o||i,flippedY:i&&!o}}catch{return{native:!1,flippedY:!1}}})(),pt)}function Jo(e){let t=[],r=0,n=0;for(let o=0;o<e.length;o++){let i=e[o];i==="("?r++:i===")"?r=Math.max(0,r-1):i===","&&r===0&&(t.push(e.slice(n,o)),n=o+1)}return t.push(e.slice(n)),t.map(o=>{let i=0,a=0,s="",l=0;for(;l<o.length;){let c=o[l];if(c==="("?i++:c===")"&&(i=Math.max(0,i-1)),i===0&&(l===0||o[l-1]===" ")){let d=/^-?\d*\.?\d+px/.exec(o.slice(l));if(d){a++,s+=a===2?`${-parseFloat(d[0])}px`:d[0],l+=d[0].length;continue}}s+=c,l++}return s}).join(",")}function Zo(e,t){let r=n=>$n(n).map(o=>{let i=o.indexOf(":");if(i<0)return o;let a=o.slice(0,i).trim().toLowerCase();return a==="text-shadow"||t&&a==="box-shadow"?`${a}:${Jo(o.slice(i+1))}`:o}).join(";");return e=e.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(n,o)=>n.replace(o,o.replace(/([^{}]+)\{([^}]*)\}/g,(i,a,s)=>`${a}{${r(s)}}`))),e=e.replace(/style=(['"])([\s\S]*?)\1/gi,(n,o,i)=>`style=${o}${r(i)}${o}`),e}async function cr(e){if(!/(?:box-shadow|text-shadow)\s*:[^;"}]*px/i.test(e))return{svg:e,naturalOnly:!1};let{native:t,flippedY:r}=await Qo();try{let n=e;return t||(n=Ko(n)),r&&(n=Zo(n,t)),{svg:n,naturalOnly:!0}}catch{return{svg:e,naturalOnly:!0}}}async function ei(e,t){e.setAttribute("data-snapdom-internal",""),e.style.cssText="position:fixed;left:-99999px;top:-99999px;pointer-events:none",document.body.appendChild(e);try{let r=document.createElement("canvas");r.width=16,r.height=16;let n=()=>new Promise(a=>{requestAnimationFrame(a),setTimeout(a,50)}),o=r.getContext("2d",{willReadFrequently:!0});if(!o){await n(),await n();return}let i=performance.now()+(t?600:150);for(;;){o.clearRect(0,0,16,16);try{o.drawImage(e,0,0,16,16)}catch{return}let a=o.getImageData(0,0,16,16).data,s=!1;for(let l=3;l<a.length;l+=4)if(a[l]>0){s=!0;break}if(s||performance.now()>i)return;await n()}}finally{try{e.remove()}catch{}}}async function At(e,t){let{width:r,height:n,scale:o=1,dpr:i=1,meta:a={},backgroundColor:s,crop:l=null}=t,c=e,d=!1,u=!1;if(l&&!Lr(e))throw new RangeError("[snapdom] canvas crop requires an SVG capture payload");if(Lr(e)){let $=(Xo(e).match(/<svg\b[^>]*>/i)||[])[0]||"",R=parseFloat(($.match(/\bwidth="([\d.]+)/i)||[])[1]),T=parseFloat(($.match(/\bheight="([\d.]+)/i)||[])[1]),D=Number.isFinite(R)&&Number.isFinite(T)&&R>0&&T>0&&Math.min(1,be/R,be/T,Math.sqrt(vt/(R*T)))<1;if(l||D||we())try{let F=sr(e);if(l&&(F=Vo(F,l)),we()){let O=await cr(F);F=O.svg,d=O.naturalOnly,u=/@font-face|data:image\//i.test(F)}(D||l)&&(F=zo(F)),c=lr(F)}catch(F){if(l)throw F;c=e}}let p=new Image;p.loading="eager",p.decoding="sync",p.crossOrigin="anonymous",p.src=c,await p.decode(),we()&&await ei(p,u);let h=p.naturalWidth,f=p.naturalHeight,m=l?h:Number.isFinite(a.vbW)?a.vbW:Number.isFinite(a.w0)?a.w0:h,y=l?f:Number.isFinite(a.vbH)?a.vbH:Number.isFinite(a.h0)?a.h0:f,b,x,v=Number.isFinite(r),g=Number.isFinite(n);if(v&&g)b=Math.max(1,r),x=Math.max(1,n);else if(v){let $=r/Math.max(1,m);b=r,x=y*$}else if(g){let $=n/Math.max(1,y);x=n,b=m*$}else b=h,x=f;b=b*o,x=x*o;let w=b*i,k=x*i,M=Math.max(w/be,k/be,Math.sqrt(w*k/vt));M>1&&(console.warn(`[snapDOM] Output ${Math.round(w)}\xD7${Math.round(k)}px exceeds the browser canvas limit (${be}px/side); downscaling. Lower \`scale\`/\`dpr\` or set \`width\`/\`height\`.`),b/=M,x/=M);let S=document.createElement("canvas");S.width=b*i,S.height=x*i,S.style.width=`${b}px`,S.style.height=`${x}px`;let E=S.getContext("2d");if(i!==1&&E.scale(i,i),s&&(E.save(),E.fillStyle=s,E.fillRect(0,0,b,x),E.restore()),d&&(Math.round(b*i)!==h||Math.round(x*i)!==f)){let $=document.createElement("canvas");$.width=h,$.height=f,$.getContext("2d").drawImage(p,0,0),E.drawImage($,0,0,b,x)}else E.drawImage(p,0,0,b,x);return S}var be,vt,pt,je=ae(()=>{"use strict";Ae(),be=16384,vt=16384*16384,pt=null}),ht={};_e(ht,{rasterize:()=>Rn});async function Rn(e,t){let r=await At(e,t),n=await new Promise(i=>{let a=()=>i(r.toDataURL(`image/${t.format}`,t.quality));try{r.toBlob(s=>{if(!s)return a();let l=new FileReader;l.onload=()=>i(String(l.result||"")),l.onerror=a,l.readAsDataURL(s)},`image/${t.format}`,t.quality)}catch{a()}}),o=new Image;return o.src=n,await o.decode(),o.style.width=`${r.width/t.dpr}px`,o.style.height=`${r.height/t.dpr}px`,o}var ft=ae(()=>{"use strict";je()}),jt={};_e(jt,{toImg:()=>Tr,toSvg:()=>Tr});async function Tr(e,t){let{scale:r=1,width:n,height:o,meta:i={}}=t,a=Number.isFinite(n),s=Number.isFinite(o),l=Number.isFinite(r)&&r!==1||a||s;if(we()&&l)try{let{svg:d}=await cr(sr(e)),u=(d.match(/<svg\b[^>]*>/i)||[])[0]||"",p=parseFloat((u.match(/\bwidth="([\d.]+)/i)||[])[1]),h=parseFloat((u.match(/\bheight="([\d.]+)/i)||[])[1]);if(!Number.isFinite(p)||!Number.isFinite(h))throw new Error("svg without dimensions");let f=Number.isFinite(i.vbW)?i.vbW:Number.isFinite(i.w0)?i.w0:p,m=Number.isFinite(i.vbH)?i.vbH:Number.isFinite(i.h0)?i.h0:h,y,b;a&&s?(y=n,b=o):a?(y=n,b=Math.round(m*(n/Math.max(1,f)))):s?(b=o,y=Math.round(f*(o/Math.max(1,m)))):(y=Math.round(p*r),b=Math.round(h*r));let x=d.replace(/width="[^"]*"/,`width="${y}"`).replace(/height="[^"]*"/,`height="${b}"`),v=new Image;return v.decoding="sync",v.loading="eager",v.src=lr(x),await v.decode(),v.style.width=`${y}px`,v.style.height=`${b}px`,v}catch(d){return j(t,"safari vector toImg failed, falling back to PNG",d),Rn(e,{...t,format:"png",quality:1,meta:i})}let c=new Image;if(c.decoding="sync",c.loading="eager",c.src=e,await c.decode(),a&&s)c.style.width=`${n}px`,c.style.height=`${o}px`;else if(a){let d=Number.isFinite(i.vbW)?i.vbW:Number.isFinite(i.w0)?i.w0:c.naturalWidth,u=Number.isFinite(i.vbH)?i.vbH:Number.isFinite(i.h0)?i.h0:c.naturalHeight,p=n/Math.max(1,d);c.style.width=`${n}px`,c.style.height=`${Math.round(u*p)}px`}else if(s){let d=Number.isFinite(i.vbW)?i.vbW:Number.isFinite(i.w0)?i.w0:c.naturalWidth,u=Number.isFinite(i.vbH)?i.vbH:Number.isFinite(i.h0)?i.h0:c.naturalHeight,p=o/Math.max(1,u);c.style.height=`${o}px`,c.style.width=`${Math.round(d*p)}px`}else{let d=Math.round(c.naturalWidth*r),u=Math.round(c.naturalHeight*r);if(c.style.width=`${d}px`,c.style.height=`${u}px`,typeof e=="string"&&e.startsWith("data:image/svg+xml"))try{let p=decodeURIComponent(e.split(",")[1]).replace(/width="[^"]*"/,`width="${d}"`).replace(/height="[^"]*"/,`height="${u}"`);e=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(p)}`,c.src=e}catch(p){j(t,"SVG width/height patch in toImg failed",p)}}return c}var Fr=ae(()=>{"use strict";de(),ft(),je()}),Nn={};_e(Nn,{toBlob:()=>Ln});async function Ln(e,t){let r=t.type;if(r==="svg"){let o=decodeURIComponent(e.split(",")[1]);return new Blob([o],{type:"image/svg+xml"})}let n=await At(e,t);return new Promise(o=>n.toBlob(i=>o(i),`image/${r}`,t.quality))}var Tn=ae(()=>{"use strict";je()}),Fn={};_e(Fn,{download:()=>ti});async function Pr(e,t){let r=new File([e],t,{type:e.type});if(!navigator.canShare?.({files:[r]}))return!1;try{await navigator.share({files:[r],title:t})}catch(n){if(n.name!=="AbortError")return!1}return!0}async function ti(e,t){let r=new Set(["png","jpeg","jpg","webp","svg"]),n=(t?.type||"").toLowerCase(),o=r.has(n)?n:"",i=(t?.format||o||"").toLowerCase(),a=i==="jpg"?"jpeg":i||"png",s=t?.filename||`snapdom.${a}`,l={...t||{},format:a,type:a};l.dpr=1;let c=Uo();if(a==="svg"){let p=await Ln(e,{...l,type:"svg"});if(c&&await Pr(p,s))return;let h=URL.createObjectURL(p),f=document.createElement("a");f.href=h,f.download=s,document.body.appendChild(f),f.click(),URL.revokeObjectURL(h),f.remove();return}let d=await At(e,l);if(c){let p=`image/${a}`,h=await new Promise(f=>d.toBlob(f,p,t?.quality));if(h&&await Pr(h,s))return}let u=document.createElement("a");u.href=d.toDataURL(`image/${a}`,t?.quality),u.download=s,document.body.appendChild(u),u.click(),u.remove()}var ri=ae(()=>{"use strict";Tn(),je(),Ae()});de();de();ne();var Ut=new WeakMap,He=new Map,ni=2e3,St=0;function mt(){St++,He.size>ni&&He.clear()}var oi="[data-snapdom-sandbox],[data-snapdom-internal],[data-snapdom]";function Ft(e){let t=e&&(e.nodeType===1?e:e.parentElement);return!!(t&&t.closest&&t.closest(oi))}function Pn(e){for(let t of e)if(!Ft(t.target)){if(t.type==="childList"){let r=!0;for(let n of t.addedNodes)if(!Ft(n)){r=!1;break}if(r){for(let n of t.removedNodes)if(!Ft(n)){r=!1;break}}if(r)continue}return!0}return!1}var Or=!1;function ii(e=document.documentElement){if(Or)return;Or=!0;let t=r=>{Pn(r)&&mt()};try{new MutationObserver(t).observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(t).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{let r=document.fonts;r&&(r.addEventListener?.("loadingdone",mt),r.ready?.then(()=>mt()).catch(()=>{}))}catch{}}var ai=["mask","mask-image","-webkit-mask","-webkit-mask-image","mask-source","mask-box-image-source","mask-border-source","-webkit-mask-box-image-source","border-image","border-image-source"];function Ir(e){let t=Ut.get(e);if(t&&t.epoch===St){let r=t.snapshot&&t.snapshot.__needsBgInline;if(r!==void 0)return r}return!0}function si(e,t={}){let r={},n=t.excludeStyleProps;for(let u=0;u<e.length;u++){let p=e[u];if(or(p)||n&&(n instanceof RegExp&&n.test(p)||typeof n=="function"&&n(p)))continue;let h=e.getPropertyValue(p);(p==="background-image"||p==="content")&&h.includes("url(")&&!h.includes("data:")&&(h="none"),r[p]=h}let o=["text-decoration-line","text-decoration-color","text-decoration-style","text-decoration-thickness","text-underline-offset","text-decoration-skip-ink"];for(let u of o)if(!r[u])try{let p=e.getPropertyValue(u);p&&(r[u]=p)}catch{}let i=["-webkit-text-stroke","-webkit-text-stroke-width","-webkit-text-stroke-color","paint-order"];for(let u of i)if(!r[u])try{let p=e.getPropertyValue(u);p&&(r[u]=p)}catch{}if(t.embedFonts){let u=["font-feature-settings","font-variation-settings","font-kerning","font-variant","font-variant-ligatures","font-optical-sizing"];for(let p of u)if(!r[p])try{let h=e.getPropertyValue(p);h&&(r[p]=h)}catch{}}try{(r["content-visibility"]||e.getPropertyValue("content-visibility"))==="hidden"&&(r["content-visibility"]="hidden")}catch{}let a=!1;{let u=e.getPropertyValue("background-image");if(u&&u!=="none"&&(a=!0),!a){let p=e.getPropertyValue("background-color");p&&p!=="rgba(0, 0, 0, 0)"&&p!=="transparent"&&(a=!0)}if(!a)for(let p of ai){let h=e.getPropertyValue(p);if(h&&h!=="none"){a=!0;break}}if(!a){let p=e.getPropertyValue("background");p&&/url\s*\(/i.test(p)&&(a=!0)}}Object.defineProperty(r,"__needsBgInline",{value:a,enumerable:!1});let s=parseFloat(e.getPropertyValue("border-top-width")||0)||0,l=parseFloat(e.getPropertyValue("border-right-width")||0)||0,c=parseFloat(e.getPropertyValue("border-bottom-width")||0)||0,d=parseFloat(e.getPropertyValue("border-left-width")||0)||0;if(s===0&&l===0&&c===0&&d===0){let u=(e.getPropertyValue("border-image-source")||"").trim(),p=u&&u!=="none",h=["border","border-top","border-right","border-bottom","border-left","border-width","border-style","border-color","border-top-width","border-top-style","border-top-color","border-right-width","border-right-style","border-right-color","border-bottom-width","border-bottom-style","border-bottom-color","border-left-width","border-left-style","border-left-color","border-block","border-block-width","border-block-style","border-block-color","border-inline","border-inline-width","border-inline-style","border-inline-color"];for(let f of h)delete r[f];p||(r.border="none")}return r}function li(e){for(let t=e.firstChild;t;t=t.nextSibling){if(t.nodeType===3&&/\S/.test(t.nodeValue||""))return!0;if(t.nodeType===1){let r=_(t).position;if(r!=="absolute"&&r!=="fixed")return!0}}return!1}function ci(e,t,r){try{if(typeof e.computedStyleMap=="function"){let o=e.computedStyleMap().get("width");if(o!=null)return!Dr(String(o).trim().toLowerCase())}}catch{}let n=e.style&&(e.style.width||e.style.inlineSize);return n&&!Dr(String(n).trim().toLowerCase())?!0:ui(e,t)?r||pi(e,t):!1}var di=new Set(["auto","min-content","max-content","stretch","fill-available","-webkit-fill-available"]);function Dr(e){return di.has(e)||e.startsWith("fit-content")}function ui(e,t){let r=e.getBoundingClientRect().width-(parseFloat(t.paddingLeft)||0)-(parseFloat(t.paddingRight)||0)-(parseFloat(t.borderLeftWidth)||0)-(parseFloat(t.borderRightWidth)||0);if(!(r>0))return!1;let n=1/0,o=-1/0,i=null;for(let a=e.firstChild;a;a=a.nextSibling){let s;if(a.nodeType===3){if(!/\S/.test(a.nodeValue||"")||(i=i||document.createRange(),i.selectNode(a),s=i.getBoundingClientRect(),!s.width&&!s.height))continue}else if(a.nodeType===1){let l=_(a);if(l.display==="none"||l.position==="absolute"||l.position==="fixed")continue;s=a.getBoundingClientRect()}else continue;s.left<n&&(n=s.left),s.right>o&&(o=s.right)}return o===-1/0?!1:o-n<r-.5}function pi(e,t){let r=e.parentElement;if(!r)return!1;let n=_(r),o=r.getBoundingClientRect().width-(parseFloat(n.paddingLeft)||0)-(parseFloat(n.paddingRight)||0)-(parseFloat(n.borderLeftWidth)||0)-(parseFloat(n.borderRightWidth)||0)-(parseFloat(t.marginLeft)||0)-(parseFloat(t.marginRight)||0);return o>0?Math.abs(e.getBoundingClientRect().width-o)>.5:!1}var Wr=new WeakMap;function hi(e){let t=Wr.get(e);return t||(t=Object.entries(e).sort((r,n)=>r[0]<n[0]?-1:r[0]>n[0]?1:0).map(([r,n])=>`${r}:${n}`).join(";"),Wr.set(e,t),t)}function fi(e,t=null,r={}){let n=Ut.get(e),o=!!(r&&r.embedFonts),i=r&&r.excludeStyleProps||null;if(n&&n.epoch===St&&n.embedFonts===o&&n.excludeStyleProps===i)return n.snapshot;let a=t||getComputedStyle(e),s=si(a,r);return xi(e,a,s),Ut.set(e,{epoch:St,snapshot:s,embedFonts:o,excludeStyleProps:i}),s}function mi(e,t){return e&&e.session&&e.persist?e:e&&(e.styleMap||e.styleCache||e.nodeMap)?{session:e,persist:{snapshotKeyCache:He,defaultStyle:C.defaultStyle,baseStyle:C.baseStyle,image:C.image,resource:C.resource,background:C.background,font:C.font},options:t||{}}:{session:C.session,persist:{snapshotKeyCache:He,defaultStyle:C.defaultStyle,baseStyle:C.baseStyle,image:C.image,resource:C.resource,background:C.background,font:C.font},options:e||t||{}}}function gi(e,t,r){if(!(!e.style||e.style.length===0))for(let n=0;n<e.style.length;n++){let o=e.style[n],i=r.getPropertyValue(o);i&&t.style.setProperty(o,i)}}async function pe(e,t,r,n){if(e.tagName==="STYLE")return;let o=mi(r,n),i=o.options&&o.options.cache||"auto";i!=="disabled"&&ii(document.documentElement),i==="disabled"&&!o.session.__bumpedForDisabled&&(mt(),He.clear(),o.session.__bumpedForDisabled=!0);let{session:a,persist:s}=o;if(!a.styleCache.has(e)){let y=null;try{y=getComputedStyle(e)}catch{}a.styleCache.set(e,y||getComputedStyle(document.documentElement))}let l=a.styleCache.get(e);e.getAttribute?.("style")&&gi(e,t,l);let c=l.getPropertyValue("animation-name");t&&t.style&&c&&c!=="none"&&t.style.setProperty("animation","none","important");let d=fi(e,l,o.options),u=On(e);if(u){let y=l.getPropertyValue("min-width");(!y||y==="auto"||y==="0px")&&(d["min-width"]="0px")}let p=e.tagName?.toLowerCase()||"div",h=hi(d),f=!0;if(hn(p,(d.display||"").toLowerCase())){f=li(e),f&&Do(p,d,u)&&ci(e,l,u)&&(f=!1),h=`${h}|${p}${f?"|c":""}${u?"|f":""}`;let y=d["text-wrap-mode"]||d["white-space"]||"";f&&y!=="nowrap"&&y!=="pre"&&(a.reconcileRisk=(a.reconcileRisk||0)+1)}let m=s.snapshotKeyCache.get(h);m===void 0&&(m=Ht(d,p,f,u),s.snapshotKeyCache.set(h,m)),a.styleMap.set(t,m)}function yi(e){return e.backgroundImage&&e.backgroundImage!=="none"||e.backgroundColor&&e.backgroundColor!=="rgba(0, 0, 0, 0)"&&e.backgroundColor!=="transparent"||(parseFloat(e.borderTopWidth)||0)>0||(parseFloat(e.borderBottomWidth)||0)>0||(parseFloat(e.paddingTop)||0)>0||(parseFloat(e.paddingBottom)||0)>0?!0:(e.overflowBlock||e.overflowY||"visible")!=="visible"}function On(e){let t=e.parentElement;if(!t)return!1;let r=_(t).display||"";return r.includes("flex")||r.includes("grid")}function bi(e){for(let n=e.firstChild;n;n=n.nextSibling)if(n.nodeType===3&&/\S/.test(n.nodeValue))return!0;let t=e.firstElementChild,r=e.lastElementChild;if(t&&t.tagName==="BR"||r&&r.tagName==="BR")return!0;for(let n=e.firstElementChild;n;n=n.nextElementSibling){let o=_(n);if(o.display==="none")continue;let i=o.position;if(i!=="absolute"&&i!=="fixed")return!0}return!1}function wi(e){let t=e.getBoundingClientRect().top,r=-1/0,n=null;for(let o=e.firstChild;o;o=o.nextSibling){if(o.nodeType===3){if(!/\S/.test(o.nodeValue||""))continue;n=n||document.createRange(),n.selectNode(o);let s=n.getBoundingClientRect();(s.width||s.height)&&(r=Math.max(r,s.bottom));continue}if(o.nodeType!==1)continue;let i=_(o);if(i.display==="none")continue;let a=i.position;a==="absolute"||a==="fixed"||i.float&&i.float!=="none"||(r=Math.max(r,o.getBoundingClientRect().bottom))}return r===-1/0?NaN:r-t}function xi(e,t,r){if(e instanceof HTMLElement&&e.style&&e.style.height)return;let n=e.tagName&&e.tagName.toLowerCase();if(!n||!["div","section","article","main","aside","header","footer","nav"].includes(n)||t.aspectRatio&&t.aspectRatio!=="none"&&t.aspectRatio!=="auto")return;let o=t.display||"";if(o.includes("flex")||o.includes("grid"))return;let i=t.position;if(i==="absolute"||i==="fixed"||i==="sticky"||t.transform!=="none"||yi(t)||On(e))return;let a=t.overflowX||t.overflow||"visible",s=t.overflowY||t.overflow||"visible";if(a!=="visible"||s!=="visible")return;let l=t.clip;if(l&&l!=="auto"&&l!=="rect(auto, auto, auto, auto)"||t.visibility==="hidden"||t.opacity==="0"||!bi(e))return;let c=parseFloat(t.height),d=wi(e);Number.isFinite(c)&&Number.isFinite(d)&&Math.abs(c-d)>2||(delete r.height,delete r["block-size"])}$t();var In=["fill","stroke","color","background-color","stop-color"],vi=new Set(["symbol","defs","pattern","marker","linearGradient","radialGradient","filter"]);function qt(e){let t=e;for(;t&&t.nodeType===1;){if(t.namespaceURI==="http://www.w3.org/2000/svg"){if(t.localName==="mask"||t.localName==="clipPath")return!1;if(vi.has(t.localName))return!0}t=t.parentNode}return!1}var Hr=new Map;function Si(e,t){let r=t+"::"+e.toLowerCase(),n=Hr.get(r);if(n)return n;let o=document,i=t==="http://www.w3.org/2000/svg"?o.createElementNS(t,e):o.createElement(e),a=o.createElement("div");a.setAttribute("data-snapdom-internal",""),a.style.cssText="position:absolute;left:-99999px;top:-99999px;contain:strict;display:block;",a.appendChild(i),o.documentElement.appendChild(a);let s=getComputedStyle(i),l={};for(let c of In)l[c]=s.getPropertyValue(c)||"";return a.remove(),Hr.set(r,l),l}function ki(e,t){if(e?.nodeType!==1||t?.nodeType!==1||qt(e))return;let r=e.getAttribute?.("style"),n=!!(r&&r.includes("var("));if(!n&&e.attributes?.length){let i=e.attributes;for(let a=0;a<i.length;a++){let s=i[a];if(s&&typeof s.value=="string"&&s.value.includes("var(")){n=!0;break}}}let o=null;if(n)try{o=getComputedStyle(e)}catch{}if(n){let i=e.style;if(i&&i.length){let a=new Set;for(let s=0;s<i.length;s++){let l=i[s];if(a.has(l))continue;a.add(l);let c=i.getPropertyValue(l);if(!c||!c.includes("var("))continue;let d=o&&o.getPropertyValue(l);if(d)try{t.style.setProperty(l,d.trim(),i.getPropertyPriority(l))}catch{}}}}if(n&&e.attributes?.length){let i=e.attributes;for(let a=0;a<i.length;a++){let s=i[a];if(!s||typeof s.value!="string"||!s.value.includes("var("))continue;let l=s.name,c=o&&o.getPropertyValue(l);if(c)try{t.style.setProperty(l,c.trim())}catch{}}}if(!n){if(!o)try{o=getComputedStyle(e)}catch{o=null}if(!o)return;let i=e.namespaceURI||"html",a=Si(e.tagName,i);for(let s of In){let l=o.getPropertyValue(s)||"",c=a[s]||"";if(l&&l!==c)try{t.style.setProperty(s,l.trim())}catch{}}}}de();de();ne();$e();$e();function Ee(e){return!!(!e||e.startsWith("data:")||e.startsWith("blob:")||/^data:image\/(gif|png|svg)/.test(e)&&e.length<200)}var Br="img[data-src], img[data-lazy-src], img[data-original], img[data-hi-res-src], img[data-srcset], img[data-lazy-srcset]";function Ci(e,t){return!e||e?.nodeType!==1?!1:e.matches?.("picture")||e.querySelector("picture")?!0:t?!!(e.matches?.(Br)||e.querySelector(Br)):!1}var Mi=/^image\/(jpeg|jpg|png|gif|webp|avif|apng|svg\+xml|bmp|x-icon|vnd\.microsoft\.icon)\s*(;|$)/i;function kt(e,t){if(!e)return null;let r=0;try{r=t?t.getBoundingClientRect().width||t.width:0}catch{}r||(r=window.innerWidth||1e3);let n=[];for(let i of e.split(",")){let a=i.trim().split(/\s+/);if(!a[0])continue;let s=a[1]||"",l=1;/^\d*\.?\d+x$/i.test(s)?l=parseFloat(s):/^\d+w$/i.test(s)&&(l=parseInt(s,10)/r),n.push({url:a[0],d:l})}if(!n.length)return null;n.sort((i,a)=>i.d-a.d);let o=window.devicePixelRatio||1;return(n.find(i=>i.d>=o)||n[n.length-1]).url}function Dn(e,t){let r=e.currentSrc||"";if(r&&!Ee(r))return r;let n=t.querySelectorAll("source[srcset]"),o=null;for(let i of n){let a=i.getAttribute("srcset");if(!a||Ee(a))continue;let s=i.getAttribute("type");if(s&&!Mi.test(s.trim()))continue;let l=i.getAttribute("media");if(l)try{if(window.matchMedia(l).matches)return kt(a,e)}catch{}o||(o=kt(a,e))}return o}function Ei(e){let t=[e.getAttribute("data-src"),e.getAttribute("data-lazy-src"),e.getAttribute("data-original"),e.getAttribute("data-hi-res-src")];for(let n of t)if(n&&!Ee(n))return n;let r=e.getAttribute("data-srcset")||e.getAttribute("data-lazy-srcset");if(r){let n=r.split(",")[0].trim().split(/\s+/)[0];if(n&&!Ee(n))return n}return null}function $i(e={}){let t=e.pictureResolver&&typeof e.pictureResolver=="object"?e.pictureResolver:{};return{timeout:t.timeout??5e3,concurrency:t.concurrency??4,resolveLazySrc:t.resolveLazySrc!==!1,silent:t.silent??!1,useProxy:typeof e.useProxy=="string"?e.useProxy:""}}async function Ai(e,t={}){if(!e||e?.nodeType!==1||t.resolvePicturePlaceholders===!1)return null;let{timeout:r,concurrency:n,resolveLazySrc:o,silent:i,useProxy:a}=$i(t);if(!Ci(e,o))return null;let s=[],l=[];async function c(p){let h=await le(p,{as:"dataURL",timeout:r,useProxy:a,silent:!0});return h.ok?h.data:null}async function d(p){for(let h=0;h<p.length;h+=n){let f=p.slice(h,h+n);await Promise.allSettled(f.map(m=>m()))}}let u=Array.from(e.querySelectorAll("picture"));e.matches?.("picture")&&u.unshift(e);for(let p of u){let h=p.querySelector("img");if(!h)continue;let f=h.getAttribute("src")||"";if(!Ee(f))continue;let m=Dn(h,p);m&&l.push(async()=>{let y=await c(m);if(!y){i||console.warn(`[snapdom:picture-resolver] Failed to fetch: ${m.slice(0,60)}`);return}let b=h.getAttribute("src"),x=h.getAttribute("srcset"),v=h.getAttribute("sizes"),g=[];h.src=y,h.setAttribute("src",y),h.removeAttribute("srcset"),h.removeAttribute("sizes");let w=p.querySelectorAll("source");for(let k of w)g.push({el:k,parent:k.parentElement,next:k.nextSibling}),k.remove();s.push(()=>{b!==null?h.setAttribute("src",b):h.removeAttribute("src"),x!==null&&h.setAttribute("srcset",x),v!==null&&h.setAttribute("sizes",v);for(let{el:k,parent:M,next:S}of g)M&&M.insertBefore(k,S)})})}if(o){let p=Array.from(e.querySelectorAll("img"));e.localName==="img"&&p.unshift(e);for(let h of p){if(h.closest("picture")&&Ee(h.getAttribute("src")||""))continue;let f=h.getAttribute("src")||"",m=Ei(h);m&&Ee(f)&&l.push(async()=>{let y=await c(m);if(!y)return;let b=h.getAttribute("src");h.src=y,h.setAttribute("src",y),h.removeAttribute("srcset"),h.removeAttribute("sizes"),s.push(()=>{b!==null?h.setAttribute("src",b):h.removeAttribute("src")})})}}return l.length===0?null:(await d(l),async function(){for(let p of s)try{p()}catch{}})}function Pt(e,t,r){return r?Promise.all(e.map(n=>new Promise(o=>t(n,o)))):Promise.all(e.map(n=>new Promise(o=>{function i(){ut(a=>{!(a&&typeof a.timeRemaining=="function")||a.timeRemaining()>0?t(n,o):i()},{fast:r})}i()})))}function Ri(e,t){if(e=e.trim(),!e)return e;let r=t?`[data-sd-slotted~="${t}"]`:"[data-sd-slotted]";return e.endsWith(":not([data-sd-slotted])")||e.endsWith(`:not(${r})`)?e:`${e}:not(${r})`}function Ni(e,t,r=!0,n){return e.split(",").map(o=>o.trim()).filter(Boolean).map(o=>{if(o.startsWith(":where(")||o.startsWith("@"))return o;let i=r?Ri(o,n):o;return`:where(${t} ${i})`}).join(", ")}function Li(e,t,r){return e?(e=e.replace(/:host\(([^)]+)\)/g,(n,o)=>`:where(${t}:is(${o.trim()}))`),e=e.replace(/:host\b/g,`:where(${t})`),e=e.replace(/:host-context\(([^)]+)\)/g,(n,o)=>`:where(:where(${o.trim()}) ${t})`),e=e.replace(/::slotted\(([^)]+)\)/g,(n,o)=>`:where(${t} ${o.trim()})`),e=e.replace(/(^|})(\s*)([^@}{]+){/g,(n,o,i,a)=>{let s=Ni(a,t,!0,r);return`${o}${i}${s}{`}),e):""}function Ti(e){return e.shadowScopeSeq=(e.shadowScopeSeq||0)+1,`s${e.shadowScopeSeq}`}function Fi(e){let t="";try{e.querySelectorAll("style").forEach(n=>{t+=(n.textContent||"")+`
3
+ `});let r=e.adoptedStyleSheets||[];for(let n of r)try{if(n&&n.cssRules)for(let o of n.cssRules)t+=o.cssText+`
4
+ `}catch{}}catch{}return t}function Pi(e,t,r){if(!t)return;let n=document.createElement("style");n.setAttribute("data-sd",r),n.textContent=t,e.insertBefore(n,e.firstChild||null)}function Oi(e,t){try{let r=null,n=_(e).content;if(n&&n.includes("url(")){let a=n.match(/url\(["']?([^"')]+)["']?\)/);a&&(r=a[1])}let o=e.closest?.("picture"),i=r||(o?Dn(e,o):e.currentSrc)||e.src||kt(e.getAttribute("srcset"),e)||"";if(!i)return;t.setAttribute("src",i),t.removeAttribute("srcset"),t.removeAttribute("sizes"),t.loading="eager",t.decoding="sync"}catch{}}function Ii(e){let t=new Set;if(!e)return t;let r=/var\(\s*(--[A-Za-z0-9_-]+)\b/g,n;for(;n=r.exec(e);)t.add(n[1]);return t}function Di(e,t){try{let r=getComputedStyle(e).getPropertyValue(t).trim();if(r)return r}catch{}try{let r=getComputedStyle(document.documentElement).getPropertyValue(t).trim();if(r)return r}catch{}return""}function Wi(e,t,r){let n=[];for(let o of t){let i=Di(e,o);i&&n.push(`${o}: ${i};`)}return n.length?`${r}{${n.join("")}}
5
+ `:""}function Hi(e,t){if(!e)return;let r=n=>{let o=n.getAttribute("data-sd-slotted")||"";t?` ${o} `.includes(` ${t} `)||n.setAttribute("data-sd-slotted",o?`${o} ${t}`:t):n.setAttribute("data-sd-slotted",o)};e.nodeType===Node.ELEMENT_NODE&&r(e),e.querySelectorAll?.("*").forEach(r)}async function Bi(e,t=3){let r=()=>{try{return e.contentDocument||e.contentWindow?.document||null}catch{return null}},n=r(),o=0;for(;o<t&&(!n||!n.body&&!n.documentElement);)await new Promise(i=>setTimeout(i,0)),n=r(),o++;return n&&(n.body||n.documentElement)?n:null}function _i(e){let t=e.getBoundingClientRect(),r=0,n=0,o=0,i=0;try{let l=getComputedStyle(e);r=parseFloat(l.borderLeftWidth)||0,n=parseFloat(l.borderRightWidth)||0,o=parseFloat(l.borderTopWidth)||0,i=parseFloat(l.borderBottomWidth)||0}catch{}let a=Math.max(0,Math.round(t.width-(r+n))),s=Math.max(0,Math.round(t.height-(o+i)));return{contentWidth:a,contentHeight:s,rect:t}}function he(e){let t=0,r=0;if(e.offsetWidth>0&&(t=e.offsetWidth),e.offsetHeight>0&&(r=e.offsetHeight),t===0||r===0)try{let n=getComputedStyle(e);if(t===0){let o=parseFloat(n.width);!isNaN(o)&&o>0&&(t=o)}if(r===0){let o=parseFloat(n.height);!isNaN(o)&&o>0&&(r=o)}}catch{}if(t===0||r===0)try{if(t===0){let n=parseFloat(e.getAttribute("width"));!isNaN(n)&&n>0&&(t=n)}if(r===0){let n=parseFloat(e.getAttribute("height"));!isNaN(n)&&n>0&&(r=n)}}catch{}if((t===0||r===0)&&(e.naturalWidth||e.naturalHeight))try{t===0&&e.naturalWidth>0&&(t=e.naturalWidth),r===0&&e.naturalHeight>0&&(r=e.naturalHeight)}catch{}return{width:t,height:r}}function ji(e,t,r){let n=e.defaultView,o=n?n.scrollX:0,i=n?n.scrollY:0,a=e.body?e.body.scrollLeft:0,s=e.body?e.body.scrollTop:0,l=e.documentElement?e.documentElement.scrollLeft:0,c=e.documentElement?e.documentElement.scrollTop:0,d=0,u=0,p=0,h=0;try{let m=n&&e.body?n.getComputedStyle(e.body):null;m&&(d=(parseFloat(m.marginTop)||0)+(parseFloat(m.paddingTop)||0),u=(parseFloat(m.marginRight)||0)+(parseFloat(m.paddingRight)||0),p=(parseFloat(m.marginBottom)||0)+(parseFloat(m.paddingBottom)||0),h=(parseFloat(m.marginLeft)||0)+(parseFloat(m.paddingLeft)||0))}catch{}try{e.documentElement.setAttribute("data-sd-pinned","")}catch{}let f=e.createElement("style");return f.setAttribute("data-sd-iframe-pin",""),f.textContent=`html {margin: 0 !important;padding: 0 !important;width: ${t}px !important;height: ${r}px !important;min-width: ${t}px !important;min-height: ${r}px !important;box-sizing: border-box !important;overflow: hidden !important;background-clip: border-box !important;}body {margin: 0 !important;padding: ${d}px ${u}px ${p}px ${h}px !important;width: ${t}px !important;height: ${r}px !important;min-width: ${t}px !important;min-height: ${r}px !important;box-sizing: border-box !important;overflow: hidden !important;background-clip: border-box !important;}`,(e.head||e.documentElement).appendChild(f),()=>{try{f.remove()}catch{}try{e.documentElement.removeAttribute("data-sd-pinned")}catch{}try{n&&typeof n.scrollTo=="function"&&n.scrollTo(o,i),e.body&&(e.body.scrollLeft=a,e.body.scrollTop=s),e.documentElement&&(e.documentElement.scrollLeft=l,e.documentElement.scrollTop=c)}catch{}}}async function Ui(e,t,r){let n=await Bi(e,3);if(!n)throw new Error("iframe document not accessible/ready");let{contentWidth:o,contentHeight:i,rect:a}=_i(e),s=r?.snap;if(!s&&typeof window<"u"&&window.snapdom&&(s=window.snapdom),!s||typeof s.toPng!="function")throw new Error("[snapdom] iframe capture requires snapdom.toPng. Use snapdom(el) or pass options.snap. With ESM, assign window.snapdom = snapdom after import if using iframes.");let l={...r,scale:1,clip:null},c=ji(n,o,i),d=C.session.nodeMap,u=C.session.styleMap,p=C.session.styleCache,h;try{h=await s.toPng(n.documentElement,l)}finally{c(),C.session.nodeMap=d,C.session.styleMap=u,C.session.styleCache=p}h.style.display="block",h.style.width=`${o}px`,h.style.height=`${i}px`;let f=document.createElement("div");return t.nodeMap.set(f,e),pe(e,f,t,r),f.style.overflow="hidden",f.style.display="block",f.style.width||(f.style.width=`${Math.round(a.width)}px`),f.style.height||(f.style.height=`${Math.round(a.height)}px`),f.appendChild(h),f}function qi(e){let{width:t,height:r}=he(e),n=e.getBoundingClientRect(),o;try{o=window.getComputedStyle(e)}catch{}let i=o?parseFloat(o.width):NaN,a=o?parseFloat(o.height):NaN,s=Math.round(t||n.width||0),l=Math.round(r||n.height||0),c=Number.isFinite(i)&&i>0?Math.round(i):Math.max(12,s||16),d=Number.isFinite(a)&&a>0?Math.round(a):Math.max(12,l||16),u=(e.type||"text").toLowerCase()==="checkbox",p=!!e.checked,h=!!e.indeterminate,f=Math.max(Math.min(c,d),12),m="middle";try{o&&o.verticalAlign&&(m=o.verticalAlign)}catch{}let y=document.createElement("div");y.setAttribute("data-snapdom-input-replacement",e.type||"checkbox"),y.style.cssText=`display:inline-block;width:${f}px;height:${f}px;vertical-align:${m};flex-shrink:0;line-height:0;`;let b=document.createElementNS("http://www.w3.org/2000/svg","svg");b.setAttribute("width",String(f)),b.setAttribute("height",String(f)),b.setAttribute("viewBox",`0 0 ${f} ${f}`),y.appendChild(b);function x(){let v="#0a6ed1";try{o&&(v=o.accentColor||o.color||v)}catch{}let g=2,w=g/2,k=f-g;if(b.innerHTML="",u){let M=document.createElementNS("http://www.w3.org/2000/svg","rect");if(M.setAttribute("x",String(w)),M.setAttribute("y",String(w)),M.setAttribute("width",String(k)),M.setAttribute("height",String(k)),M.setAttribute("rx","2"),M.setAttribute("ry","2"),M.setAttribute("fill",p?v:"none"),M.setAttribute("stroke",v),M.setAttribute("stroke-width",String(g)),b.appendChild(M),p){let S=document.createElementNS("http://www.w3.org/2000/svg","path");S.setAttribute("d",`M ${w+2} ${f/2} L ${f/2-1} ${f-w-2} L ${f-w-2} ${w+2}`),S.setAttribute("stroke","white"),S.setAttribute("stroke-width",String(Math.max(1.5,g))),S.setAttribute("fill","none"),S.setAttribute("stroke-linecap","round"),S.setAttribute("stroke-linejoin","round"),b.appendChild(S)}else if(h){let S=document.createElementNS("http://www.w3.org/2000/svg","rect"),E=Math.max(6,k-4);S.setAttribute("x",String((f-E)/2)),S.setAttribute("y",String((f-g)/2)),S.setAttribute("width",String(E)),S.setAttribute("height",String(g)),S.setAttribute("fill",v),S.setAttribute("rx","1"),b.appendChild(S)}}else{let M=document.createElementNS("http://www.w3.org/2000/svg","circle");if(M.setAttribute("cx",String(f/2)),M.setAttribute("cy",String(f/2)),M.setAttribute("r",String((f-g)/2)),M.setAttribute("fill",p?v:"none"),M.setAttribute("stroke",v),M.setAttribute("stroke-width",String(g)),b.appendChild(M),p){let S=document.createElementNS("http://www.w3.org/2000/svg","circle"),E=Math.max(2,(f-g*2)*.35);S.setAttribute("cx",String(f/2)),S.setAttribute("cy",String(f/2)),S.setAttribute("r",String(E)),S.setAttribute("fill","white"),b.appendChild(S)}}y.style.setProperty("width",`${f}px`,"important"),y.style.setProperty("height",`${f}px`,"important"),y.style.setProperty("min-width",`${f}px`,"important"),y.style.setProperty("min-height",`${f}px`,"important")}return x(),{el:y,applyVisual:x}}var Ie=new re(80);async function We(e){if(C.resource?.has(e))return C.resource.get(e);if(Ie.has(e))return Ie.get(e);let t=(async()=>{let r=await le(e,{as:"dataURL",silent:!0});if(!r.ok||typeof r.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${e}`);return C.resource?.set(e,r.data),r.data})();Ie.set(e,t);try{let r=await t;return Ie.set(e,r),r}catch(r){throw Ie.delete(e),r}}var zi=/\bblob:[^)"'\s]+/g;async function _r(e){if(!e||e.indexOf("blob:")===-1)return e;let t=Array.from(new Set(e.match(zi)||[]));if(t.length===0)return e;let r=e;for(let n of t)try{let o=await We(n);r=r.split(n).join(o)}catch{}return r}function it(e){return typeof e=="string"&&e.startsWith("blob:")}function Vi(e){return(e||"").split(",").map(t=>t.trim()).filter(Boolean).map(t=>{let r=t.match(/^(\S+)(\s+.+)?$/);return r?{url:r[1],desc:r[2]||""}:null}).filter(Boolean)}function Xi(e){return e.map(t=>t.desc?`${t.url} ${t.desc.trim()}`:t.url).join(", ")}function at(e,t){let r=e.querySelectorAll?Array.from(e.querySelectorAll(t)):[];return e.matches?.(t)&&r.unshift(e),r}async function Yi(e,t=null){if(!e)return;let r=t,n=at(e,"img");for(let l of n)try{let c=l.getAttribute("src")||l.currentSrc||"";if(it(c)){let u=await We(c);l.setAttribute("src",u)}let d=l.getAttribute("srcset");if(d&&d.includes("blob:")){let u=Vi(d),p=!1;for(let h of u)if(it(h.url))try{h.url=await We(h.url),p=!0}catch(f){j(r,"blobUrlToDataUrl for srcset item failed",f)}p&&l.setAttribute("srcset",Xi(u))}}catch(c){j(r,"resolveBlobUrls for img failed",c)}let o=at(e,"image");for(let l of o)try{let c="http://www.w3.org/1999/xlink",d=l.getAttribute("href")||l.getAttributeNS?.(c,"href");if(it(d)){let u=await We(d);l.setAttribute("href",u),l.removeAttributeNS?.(c,"href")}}catch(c){j(r,"resolveBlobUrls for SVG image href failed",c)}let i=at(e,"[style*='blob:']");for(let l of i)try{let c=l.getAttribute("style");if(c&&c.includes("blob:")){let d=await _r(c);l.setAttribute("style",d)}}catch(c){j(r,"replaceBlobUrls in inline style failed",c)}let a=e.querySelectorAll?e.querySelectorAll("style"):[];for(let l of a)try{let c=l.textContent||"";c.includes("blob:")&&(l.textContent=await _r(c))}catch(c){j(r,"replaceBlobUrls in style tag failed",c)}let s=["poster"];for(let l of s){let c=at(e,`[${l}^='blob:']`);for(let d of c)try{let u=d.getAttribute(l);it(u)&&d.setAttribute(l,await We(u))}catch(u){j(r,`resolveBlobUrls for ${l} failed`,u)}}}Ae();var zt=new Map,jr=new Set(["IFRAME"]);function Rt(e,t){zt.set(String(e).toUpperCase(),t)}function Ot(e){let{width:t,height:r}=he(e),n=t,o=r;if(!n||!o){let a=e.getBoundingClientRect();n=n||a.width||0,o=o||a.height||0}let i=document.createElement("div");return i.style.cssText=`display:inline-block;width:${n}px;height:${o}px;visibility:hidden;`,i}var st=200,Gi=new Set(["img","canvas","video","iframe","object","embed"]);function Ur(e,t){return e.right>=t.left-st&&e.left<=t.right+st&&e.bottom>=t.top-st&&e.top<=t.bottom+st}function Ki(e,t){if(e===t.root)return!1;let r;try{r=e.getBoundingClientRect()}catch{return!1}if(r.width===0&&r.height===0)return!1;let n=_(e);if(n.display==="inline"&&!Gi.has((e.localName||"").toLowerCase()))return!1;let o=t.rect,i=e.scrollWidth||0,a=e.scrollHeight||0,s={left:n.direction==="rtl"?Math.min(r.left,r.right-i):r.left,top:r.top,right:Math.max(r.right,r.left+i),bottom:Math.max(r.bottom,r.top+a)},l=n.writingMode||"";if((l.startsWith("vertical")||l.startsWith("sideways"))&&(s.top=Math.min(r.top,r.bottom-a),s.left=Math.min(s.left,r.right-i)),Ur(s,o))return!1;let c=(e.ownerDocument||document).createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;c.nextNode();){let d=c.currentNode.getBoundingClientRect();if((d.width>0||d.height>0)&&Ur(d,o))return!1}return!0}function Qi(e,t,r){let n=e.cloneNode(!1);e.tagName==="IMG"&&(n.removeAttribute("src"),n.removeAttribute("srcset"),n.removeAttribute("sizes")),pe(e,n,t,r);let{width:o,height:i}=he(e);return o>0&&(n.style.width=`${o}px`,n.style.minWidth=`${o}px`,n.style.maxWidth=`${o}px`),i>0&&(n.style.height=`${i}px`,n.style.minHeight=`${i}px`,n.style.maxHeight=`${i}px`),n.style.visibility="hidden",n.style.overflow="hidden",n.style.boxSizing="border-box",n}async function gt(e,t,r){if(!e)throw new Error("Invalid node");let n=new Set,o=null,i=null;if(e.nodeType===Node.ELEMENT_NODE){let d=(e.localName||e.tagName||"").toLowerCase();if(e.id==="snapdom-sandbox"||e.hasAttribute("data-snapdom-sandbox")||fn.has(d))return null;if(d==="foreignobject"&&e.parentElement?.closest?.("foreignObject"))return j(t,"Nested <foreignObject> skipped (SVG spec limitation \u2014 not rendered by browsers)"),null;if(d==="source"&&e.parentElement?.localName==="picture")return null}if(e.nodeType===Node.TEXT_NODE||e.nodeType!==Node.ELEMENT_NODE)return e.cloneNode(!0);if(e.getAttribute("data-capture")==="exclude"){if(r.excludeMode==="hide")return Ot(e);if(r.excludeMode==="remove")return null}if(r.exclude&&Array.isArray(r.exclude))for(let d of r.exclude)try{if(e.matches?.(d)){if(r.excludeMode==="hide")return Ot(e);if(r.excludeMode==="remove")return null}}catch(u){console.warn(`Invalid selector in exclude option: ${d}`,u)}if(typeof r.filter=="function")try{if(!r.filter(e)){if(r.filterMode==="hide")return Ot(e);if(r.filterMode==="remove")return null}}catch(d){console.warn("Error in filter function:",d)}if(t.clip&&Ki(e,t.clip))return Qi(e,t,r);if(r.__resolveNodeHooks)for(let d of r.__resolveNodeHooks){let u;try{u=await d(e,r)}catch(p){j(t,"resolveNode plugin hook failed",p)}if(u===null)return null;if(u instanceof Node)return u.nodeType===Node.ELEMENT_NODE&&(t.nodeMap.set(u,e),pe(e,u,t,r)),u}{let d=jr.has(e.tagName)&&zt.get(e.tagName);if(d){let u=await d(e,t,r);if(u!==void 0)return u}}if(e.getAttribute("data-capture")==="placeholder"){let d=e.cloneNode(!1);t.nodeMap.set(d,e),pe(e,d,t,r);let u=document.createElement("div");return u.textContent=e.getAttribute("data-placeholder-text")||"",u.style.cssText="color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;",d.appendChild(u),d}{let d=!jr.has(e.tagName)&&zt.get(e.tagName);if(d){let u=await d(e,t,r);if(u!==void 0)return u}}let a;try{if(a=e.cloneNode(!1),a.attributes?.length)try{for(let d of a.attributes)/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/.test(d.value)&&a.setAttribute(d.name,d.value.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/g,""))}catch{}if(ki(e,a),t.nodeMap.set(a,e),e.tagName==="IMG"){Oi(e,a);try{let{width:d,height:u}=he(e),p=Math.round(d||0),h=Math.round(u||0);p&&(a.dataset.snapdomWidth=String(p)),h&&(a.dataset.snapdomHeight=String(h))}catch(d){j(t,"getUnscaledDimensions for IMG failed",d)}try{let d=e.getAttribute("style")||"",u=window.getComputedStyle(e),p=v=>{let g=d.match(new RegExp(`${v}\\s*:\\s*([^;]+)`,"i")),w=g?g[1].trim():u.getPropertyValue(v);return/%|auto/i.test(String(w||""))},h=parseInt(a.dataset.snapdomWidth||"0",10),f=parseInt(a.dataset.snapdomHeight||"0",10),m=p("width")||!h,y=p("height")||!f;m&&h&&(a.style.width=`${h}px`),y&&f&&(a.style.height=`${f}px`);let b=u.getPropertyValue("object-fit"),x=u.getPropertyValue("object-position");b&&b!=="fill"?(a.style.objectFit=b,x&&(a.style.objectPosition=x)):(h&&(a.style.minWidth=`${h}px`),f&&(a.style.minHeight=`${f}px`))}catch(d){j(t,"IMG dimension freeze failed",d)}}}catch(d){throw console.error("[Snapdom] Failed to clone node:",e,d),d}let s=null;if(e instanceof HTMLTextAreaElement){let{width:d,height:u}=he(e),p=d||e.getBoundingClientRect().width||0,h=u||e.getBoundingClientRect().height||0;p&&(a.style.width=`${p}px`),h&&(a.style.height=`${h}px`)}if(e instanceof HTMLInputElement){let d=(e.type||"text").toLowerCase();if((d==="checkbox"||d==="radio")&&qo()){let{el:u,applyVisual:p}=qi(e);t.nodeMap.set(u,e),s=p,a=u}else a.value=e.value,a.setAttribute("value",e.value),e.checked!==void 0&&(a.checked=e.checked,e.checked&&a.setAttribute("checked",""),e.indeterminate&&(a.indeterminate=e.indeterminate))}if((e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&!e.value&&e.placeholder)try{let d=window.getComputedStyle(e,"::placeholder"),u=d&&d.color;if(u&&u!=="rgba(0, 0, 0, 0)"){let p="snapdom-ph-"+(Math.random()*1e6|0);a.classList.add(p);let h=document.createElement("style");h.textContent=`.${p}::placeholder{color:${u}!important;opacity:${d.opacity||"1"}!important;-webkit-text-fill-color:${u}!important;}`,a.prepend(h)}}catch{}if(e instanceof HTMLSelectElement&&(o=e.value),e instanceof HTMLTextAreaElement&&(i=e.value),e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement){e.disabled&&a.setAttribute("disabled",""),e.required&&a.setAttribute("required",""),e.readOnly&&a.setAttribute("readonly","");let d=e;d.min!==void 0&&d.min!==""&&a.setAttribute("min",d.min),d.max!==void 0&&d.max!==""&&a.setAttribute("max",d.max),d.pattern!==void 0&&d.pattern!==""&&a.setAttribute("pattern",d.pattern);let u=e.getAttribute("aria-invalid");u!==null&&a.setAttribute("aria-invalid",u)}if(qt(e)||pe(e,a,t,r),s&&s(),e instanceof SVGElement&&!qt(e)){let d=["fill","stroke","stroke-width","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","opacity","fill-opacity","stroke-opacity","fill-rule","clip-rule","marker","marker-start","marker-mid","marker-end","visibility","display"];try{let u=window.getComputedStyle(e);for(let p of d){let h=u.getPropertyValue(p);h&&a.style.setProperty(p,h)}}catch{}}if(e.shadowRoot){try{let v=e.shadowRoot.querySelectorAll("slot");for(let g of v){let w=g.assignedNodes?.()||[];for(let k of w)n.add(k)}}catch{}let d=Ti(t),u=`[data-sd="${d}"]`;t.shadowScopes||(t.shadowScopes=new WeakMap),t.shadowScopes.set(e.shadowRoot,d);try{a.setAttribute("data-sd",d)}catch{}let p=Fi(e.shadowRoot),h=Li(p,u,d),f=Ii(p),m=Wi(e,f,u);Pi(a,m+h,d);let y=document.createDocumentFragment(),b=(v,g)=>{if(v.nodeType===Node.ELEMENT_NODE&&v.tagName==="STYLE")return g(null);gt(v,t,r).then(w=>{g(w||null)}).catch(()=>{g(null)})},x=await Pt(Array.from(e.shadowRoot.childNodes),b,r.fast);y.append(...x.filter(v=>!!v)),a.appendChild(y)}if(e.tagName==="SLOT"){let d=t.shadowScopes?.get(e.getRootNode()),u=e.assignedNodes?.()||[],p=u.length?e.assignedNodes?.({flatten:!0})||u:[],h=p.length?p:Array.from(e.childNodes),f=document.createDocumentFragment(),m=(b,x)=>{gt(b,t,r).then(v=>{v&&u.length&&Hi(v,d),x(v||null)}).catch(()=>{x(null)})},y=await Pt(Array.from(h),m,r.fast);return f.append(...y.filter(b=>!!b)),f}function l(d,u){if(n.has(d)||e.shadowRoot&&!d.assignedSlot)return u(null);gt(d,t,r).then(p=>{u(p||null)}).catch(()=>{u(null)})}let c=await Pt(Array.from(e.childNodes),l,r.fast);if(a.append(...c.filter(d=>!!d)),o!==null&&a instanceof HTMLSelectElement){a.value=o;for(let d of a.options)d.value===o?d.setAttribute("selected",""):d.removeAttribute("selected")}return i!==null&&a instanceof HTMLTextAreaElement&&(a.textContent=i),a}async function Ji(e,t,r){let n=!1;try{n=!!(e.contentDocument||e.contentWindow?.document)}catch(o){j(t,"iframe same-origin probe failed",o)}if(n)try{return await Ui(e,t,r)}catch(o){console.warn("[SnapDOM] iframe rasterization failed, fallback:",o)}if(n||console.warn("[snapdom] cross-origin <iframe> skipped (its document cannot be read). Captured as a placeholder that keeps the frame's box; pass { placeholders: false } for an invisible spacer.",e),r.placeholders){let{width:o,height:i}=he(e),a=document.createElement("div");return a.style.cssText=`width:${o}px;height:${i}px;background-image:repeating-linear-gradient(45deg,#ddd,#ddd 5px,#f9f9f9 5px,#f9f9f9 10px);display:flex;align-items:center;justify-content:center;font-size:12px;color:#555;border:1px solid #aaa;`,pe(e,a,t,r),a}else{let{width:o,height:i}=he(e),a=document.createElement("div");return a.style.cssText=`display:inline-block;width:${o}px;height:${i}px;visibility:hidden;`,pe(e,a,t,r),a}}function Zi(e){try{let t=Math.max(1,Math.min(32,e.width)),r=Math.max(1,Math.min(32,e.height)),n=document.createElement("canvas");n.width=t,n.height=r;let o=n.getContext("2d",{willReadFrequently:!0});if(!o)return!1;o.drawImage(e,0,0,t,r);let i=o.getImageData(0,0,t,r).data;for(let a=3;a<i.length;a+=4)if(i[a]!==0)return!1;return!0}catch{return!1}}async function ea(e,t,r){let n="";try{let s=e.getContext("2d",{willReadFrequently:!0});try{s&&s.getImageData(0,0,1,1)}catch{}if((we()||!s)&&await Me(),n=e.toDataURL("image/png"),!n||n==="data:,"){try{s&&s.getImageData(0,0,1,1)}catch{}if(await Me(),n=e.toDataURL("image/png"),!n||n==="data:,"){let l=document.createElement("canvas");l.width=e.width,l.height=e.height;let c=l.getContext("2d");c&&(c.drawImage(e,0,0),n=l.toDataURL("image/png"))}}}catch(s){j(t,"Canvas toDataURL failed, using empty/fallback",s)}r&&r.debug&&n&&Zi(e)&&j(t,"canvas is empty at capture time \u2014 capture it after its first frame is drawn",e);let o=document.createElement("img");try{o.decoding="sync",o.loading="eager"}catch(s){j(t,"img decoding/loading hints failed",s)}n&&(o.src=n),o.width=e.width,o.height=e.height;let{width:i,height:a}=he(e);return i>0&&(o.style.width=`${i}px`),a>0&&(o.style.height=`${a}px`),t.nodeMap.set(o,e),pe(e,o,t,r),o}async function ta(e,t,r){let n="";try{let s=document.createElement("canvas");s.width=e.videoWidth||e.offsetWidth||320,s.height=e.videoHeight||e.offsetHeight||240;let l=s.getContext("2d");l&&(l.drawImage(e,0,0,s.width,s.height),n=s.toDataURL("image/png"),(!n||n==="data:,")&&(n=""))}catch(s){j(t,"Video frame capture failed, using poster fallback",s)}let o=document.createElement("img");try{o.decoding="sync",o.loading="eager"}catch{}n?o.src=n:e.poster&&(o.src=e.poster),o.width=e.videoWidth||e.offsetWidth||0,o.height=e.videoHeight||e.offsetHeight||0;let{width:i,height:a}=he(e);return i>0&&(o.style.width=`${i}px`),a>0&&(o.style.height=`${a}px`),o.style.objectFit="contain",t.nodeMap.set(o,e),pe(e,o,t,r),o}async function ra(e,t,r){if(!e.controls)return;let{width:n,height:o}=he(e),i=Math.round(n||e.offsetWidth||300),a=Math.round(o||e.offsetHeight||54),s=a/2,l=Math.max(4,a*.16),c=a*.34,d=i-a*.34,u=c+l+a*.55,p=Math.max(0,d-a*.7-u),h=Math.max(9,Math.round(a*.24)),f=`<svg xmlns="http://www.w3.org/2000/svg" width="${i}" height="${a}" viewBox="0 0 ${i} ${a}"><rect width="${i}" height="${a}" rx="${Math.min(a/2,10)}" fill="#f1f3f4"/><path d="M ${c} ${s-l} L ${c+l} ${s} L ${c} ${s+l} Z" fill="#5f6368"/><rect x="${u}" y="${s-1.5}" width="${p}" height="3" rx="1.5" fill="#bdc1c6"/><circle cx="${u}" cy="${s}" r="${Math.max(3,a*.09)}" fill="#5f6368"/><text x="${d}" y="${s}" fill="#5f6368" font-family="sans-serif" font-size="${h}" text-anchor="end" dominant-baseline="central">0:00</text></svg>`,m=document.createElement("img");try{m.decoding="sync",m.loading="eager"}catch{}return m.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(f)}`,m.width=i,m.height=a,m.style.width=`${i}px`,m.style.height=`${a}px`,t.nodeMap.set(m,e),pe(e,m,t,r),m}Rt("IFRAME",Ji);Rt("CANVAS",ea);Rt("VIDEO",ta);Rt("AUDIO",ra);de();Et();$t();ne();ne();var na=[/font\s*awesome/i,/material\s*icons/i,/ionicons/i,/glyphicons/i,/feather/i,/bootstrap\s*icons/i,/remix\s*icons/i,/heroicons/i,/layui/i,/lucide/i],Ne=Object.assign({materialIconsFilled:"https://fonts.gstatic.com/s/materialicons/v48/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.woff2",materialIconsOutlined:"https://fonts.gstatic.com/s/materialiconsoutlined/v110/gok-H7zzDkdnRel8-DQ6KAXJ69wP1tGnf4ZGhUcel5euIg.woff2",materialIconsRound:"https://fonts.gstatic.com/s/materialiconsround/v109/LDItaoyNOAY6Uewc665JcIzCKsKc_M9flwmPq_HTTw.woff2",materialIconsSharp:"https://fonts.gstatic.com/s/materialiconssharp/v110/oPWQ_lt5nv4pWNJpghLP75WiFR4kLh3kvmvRImcycg.woff2"},typeof window<"u"&&window.__SNAPDOM_ICON_FONTS__||{}),Wn=[],qr=new Set;function oa(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ia(e){let t=Array.isArray(e)?e:[e];for(let r of t){let n;if(r instanceof RegExp)n=r;else if(typeof r=="string")n=new RegExp(oa(r),"i");else{console.warn("[snapdom] Ignored invalid iconFont value:",r);continue}let o=`${n.source}/${n.flags}`;qr.has(o)||(qr.add(o),Wn.push(n))}}function ye(e){let t=typeof e=="string"?e:"",r=[...na,...Wn];for(let n of r)if(n instanceof RegExp&&n.test(t))return!0;return!!(/icon/i.test(t)||/glyph/i.test(t)||/symbols/i.test(t)||/feather/i.test(t)||/fontawesome/i.test(t))}function aa(e=""){let t=String(e).toLowerCase();return/\bmaterial\s*icons\b/.test(t)||/\bmaterial\s*symbols\b/.test(t)}var zr=new Map;function sa(e=""){let t=Object.create(null),r=String(e||""),n=/['"]?\s*([A-Za-z]{3,4})\s*['"]?\s*([+-]?\d+(?:\.\d+)?)\s*/g,o;for(;o=n.exec(r);)t[o[1].toUpperCase()]=Number(o[2]);return t}async function la(e,t,r){let n=String(e||""),o=n.toLowerCase(),i=String(t||"").toLowerCase();if(/\bmaterial\s*icons\b/.test(o)&&!/\bsymbols\b/.test(o))return{familyForMeasure:n,familyForCanvas:n};if(!/\bmaterial\s*symbols\b/.test(o))return{familyForMeasure:n,familyForCanvas:n};let a=r&&(r.FILL??r.fill),s="outlined";/\brounded\b/.test(i)||/\bround\b/.test(i)?s="rounded":/\bsharp\b/.test(i)?s="sharp":/\boutlined\b/.test(i)&&(s="outlined");let l=a===1,c=null;if(l&&(s==="outlined"&&Ne.materialIconsFilled?c={url:Ne.materialIconsFilled,alias:"snapdom-mi-filled"}:s==="rounded"&&Ne.materialIconsRound?c={url:Ne.materialIconsRound,alias:"snapdom-mi-round"}:s==="sharp"&&Ne.materialIconsSharp&&(c={url:Ne.materialIconsSharp,alias:"snapdom-mi-sharp"})),!c)return{familyForMeasure:n,familyForCanvas:n};if(!zr.has(c.alias))try{let u=new FontFace(c.alias,`url(${c.url})`,{style:"normal",weight:"400"});document.fonts.add(u),await u.load(),zr.set(c.alias,!0)}catch{return{familyForMeasure:n,familyForCanvas:n}}let d=`"${c.alias}"`;return{familyForMeasure:d,familyForCanvas:d}}async function ca(e="Material Icons",t=24){try{await Promise.all([document.fonts.load(`400 ${t}px "${String(e).replace(/["']/g,"")}"`),document.fonts.ready])}catch{}}function da(e){let t=e.getPropertyValue("-webkit-text-fill-color")?.trim()||"",r=/^transparent$/i.test(t)||/rgba?\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0\s*\)/i.test(t);if(t&&!r&&t.toLowerCase()!=="currentcolor")return t;let n=e.color?.trim();return n&&n!=="inherit"?n:"#000"}async function ua(e,{family:t="Material Icons",weight:r="normal",fontSize:n=32,color:o="#000",variation:i="",className:a=""}={}){let s=String(t||"").replace(/^['"]+|['"]+$/g,""),l=window.devicePixelRatio||1,c=sa(i),{familyForMeasure:d,familyForCanvas:u}=await la(s,a,c);await ca(u.replace(/^["']+|["']+$/g,""),n);let p=document.createElement("span");p.setAttribute("data-snapdom-internal",""),p.textContent=e,p.style.position="absolute",p.style.visibility="hidden",p.style.left="-99999px",p.style.whiteSpace="nowrap",p.style.fontFamily=d,p.style.fontWeight=String(r||"normal"),p.style.fontSize=`${n}px`,p.style.lineHeight="1",p.style.margin="0",p.style.padding="0",p.style.fontFeatureSettings="'liga' 1",p.style.fontVariantLigatures="normal",p.style.color=o,document.body.appendChild(p);let h=p.getBoundingClientRect(),f=Math.max(1,Math.ceil(h.width)),m=Math.max(1,Math.ceil(h.height));document.body.removeChild(p);let y=document.createElement("canvas");y.width=f*l,y.height=m*l;let b=y.getContext("2d");b.scale(l,l),b.font=`${r?`${r} `:""}${n}px ${u}`,b.textAlign="left",b.textBaseline="top",b.fillStyle=o;try{b.fontKerning="normal"}catch{}return b.fillText(e,0,0),{dataUrl:y.toDataURL(),width:f,height:m}}async function pa(e,t,r=C.session.nodeMap){if(e?.nodeType!==1)return 0;let n='.material-icons, [class*="material-symbols"]',o=Array.from(e.querySelectorAll(n)).filter(s=>s&&s.textContent&&s.textContent.trim());if(e.matches?.(n)&&e.textContent&&e.textContent.trim()&&o.unshift(e),o.length===0)return 0;let i=t?.nodeType===1?Array.from(t.querySelectorAll(n)).filter(s=>s&&s.textContent&&s.textContent.trim()):[];t?.nodeType===1&&t.matches?.(n)&&t.textContent&&t.textContent.trim()&&i.unshift(t);let a=0;for(let s=0;s<o.length;s++){let l=o[s],c=r&&r.get(l)||i[s]||null;try{let d=getComputedStyle(c||l),u=d.fontFamily||"Material Icons";if(!aa(u))continue;let p=(c||l).textContent.trim();if(!p)continue;let h=parseInt(d.fontSize,10)||24,f=d.fontWeight&&d.fontWeight!=="normal"?d.fontWeight:"normal",m=da(d),y=d.fontVariationSettings&&d.fontVariationSettings!=="normal"?d.fontVariationSettings:"",b=(c||l).className||"",{dataUrl:x,width:v,height:g}=await ua(p,{family:u,weight:f,fontSize:h,color:m,variation:y,className:b});l.textContent="";let w=l.ownerDocument.createElement("img");w.src=x,w.alt=p,w.style.height=`${h}px`,w.style.width=`${Math.max(1,Math.round(v/g*h))}px`,w.style.objectFit="contain",w.style.verticalAlign=getComputedStyle(l).verticalAlign||"baseline",l.appendChild(w),a++}catch{}}return a}$e();Ae();async function ha(e,t,r,n=32,o="#000"){t=t.replace(/^['"]+|['"]+$/g,"");let i=window.devicePixelRatio||1;try{await document.fonts.ready}catch{}let a=document.createElement("span");a.setAttribute("data-snapdom-internal",""),a.textContent=e,a.style.position="absolute",a.style.visibility="hidden",a.style.fontFamily=`"${t}"`,a.style.fontWeight=r||"normal",a.style.fontSize=`${n}px`,a.style.lineHeight="1",a.style.whiteSpace="nowrap",a.style.padding="0",a.style.margin="0",document.body.appendChild(a);let s=a.getBoundingClientRect(),l=Math.ceil(s.width),c=Math.ceil(s.height);document.body.removeChild(a);let d=document.createElement("canvas");d.width=Math.max(1,l*i),d.height=Math.max(1,c*i);let u=d.getContext("2d");return u.scale(i,i),u.font=r?`${r} ${n}px "${t}"`:`${n}px "${t}"`,u.textAlign="left",u.textBaseline="top",u.fillStyle=o,u.fillText(e,0,0),{dataUrl:d.toDataURL(),width:l,height:c}}var Hn=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]),fa=["katex","mathjax","mathml"];function dr(e){if(!e)return"";for(let t of e.split(",")){let r=t.trim().replace(/^['"]+|['"]+$/g,"");if(r&&!Hn.has(r.toLowerCase()))return r}return""}function ma(e){if(!e)return[];let t=[];for(let r of e.split(",")){let n=r.trim().replace(/^['"]+|['"]+$/g,"");n&&(Hn.has(n.toLowerCase())||t.push(n))}return t}function yt(e){let t=String(e??"400").trim().toLowerCase();if(t==="normal")return 400;if(t==="bold")return 700;let r=parseInt(t,10);return Number.isFinite(r)?Math.min(900,Math.max(100,r)):400}function bt(e){let t=String(e??"normal").trim().toLowerCase();return t.startsWith("italic")?"italic":t.startsWith("oblique")?"oblique":"normal"}function ga(e){let t=String(e??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return t?Math.max(50,Math.min(200,parseFloat(t[1]))):100}function ya(e){let t=String(e||"400").trim(),r=t.match(/^(\d{2,3})\s+(\d{2,3})$/);if(r){let o=yt(r[1]),i=yt(r[2]);return{min:Math.min(o,i),max:Math.max(o,i)}}let n=yt(t);return{min:n,max:n}}function ba(e){let t=String(e||"normal").trim().toLowerCase();return t==="italic"?{kind:"italic"}:t.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function wa(e){let t=String(e||"100%").trim(),r=t.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(r){let i=parseFloat(r[1]),a=parseFloat(r[2]);return{min:Math.min(i,a),max:Math.max(i,a)}}let n=t.match(/(\d+(?:\.\d+)?)\s*%/),o=n?parseFloat(n[1]):100;return{min:o,max:o}}function xa(e){return!e||typeof e!="string"?"":e.replace(/\s+(variable|vf|v[0-9]+)$/i,"").trim().toLowerCase().replace(/\s+/g,"-")}function va(e,t,r=[]){if(!e)return!1;try{let n=new URL(e,location.href);if(n.origin===location.origin)return!0;let o=n.host.toLowerCase();if(["fonts.googleapis.com","fonts.gstatic.com","use.typekit.net","p.typekit.net","kit.fontawesome.com","use.fontawesome.com","cdn.jsdelivr.net","unpkg.com","cdnjs.cloudflare.com","esm.sh"].some(a=>o.endsWith(a))||r.some(a=>o===a.toLowerCase()||o.endsWith("."+a.toLowerCase())))return!0;let i=(n.pathname+n.search).toLowerCase();if(/\bfont(s)?\b/.test(i)||/\.woff2?(\b|$)/.test(i)||fa.some(a=>i.includes(a)))return!0;for(let a of t){let s=a.toLowerCase().replace(/\s+/g,"+"),l=a.toLowerCase().replace(/\s+/g,"-"),c=xa(a);if(i.includes(s)||i.includes(l)||c&&i.includes(c))return!0}return!1}catch{return!1}}function Sa(e){let t=new Set;for(let r of e||[]){let n=String(r).split("__")[0]?.trim();n&&t.add(n)}return t}function Vr(e,t){return e&&e.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/g,(r,n,o)=>{let i=(o||"").trim();if(!i||/^data:|^blob:|^https?:|^file:|^about:/i.test(i))return r;let a=i;try{a=new URL(i,t||location.href).href}catch{}return`url("${a}")`})}var Vt=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g,Ct=4;async function ka(e,t,r){if(!e)return e;let n=new Set;function o(s,l){try{return new URL(s,l||location.href).href}catch{return s}}async function i(s,l,c=0){if(c>Ct)return console.warn(`[snapDOM] @import depth exceeded (${Ct}) at ${l}`),s;let d="",u=0,p;for(;p=Vt.exec(s);){d+=s.slice(u,p.index),u=Vt.lastIndex;let h=(p[2]||p[4]||"").trim(),f=o(h,l);if(n.has(f)){console.warn(`[snapDOM] Skipping circular @import: ${f}`);continue}n.add(f);let m="";try{let y=await le(f,{as:"text",useProxy:r,silent:!0});y.ok&&typeof y.data=="string"&&(m=y.data)}catch{}m?(m=Vr(m,f),m=await i(m,f,c+1),d+=`
6
+ /* inlined: ${f} */
7
+ ${m}
8
+ `):d+=p[0]}return d+=s.slice(u),d}let a=Vr(e,t||location.href);return a=await i(a,t||location.href,0),a}var Bn=/url\((["']?)([^"')]+)\1\)/g,Ca=/@font-face[^{}]*\{[^}]*\}/g;function se(e,t,r=""){return(e.match(new RegExp(`${t}\\s*:\\s*([^;}]+)[;}]`,"i"))?.[1]||r).trim()}function _n(e){if(!e)return[];let t=[],r=e.split(",").map(n=>n.trim()).filter(Boolean);for(let n of r){let o=n.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!o)continue;let i=o[1],a=o[2],s=l=>{if(!l.includes("?"))return parseInt(l,16);let c=parseInt(l.replace(/\?/g,"0"),16),d=parseInt(l.replace(/\?/g,"F"),16);return[c,d]};if(a){let l=s(i),c=s(a),d=Array.isArray(l)?l[0]:l,u=Array.isArray(c)?c[1]:c;t.push([Math.min(d,u),Math.max(d,u)])}else{let l=s(i);Array.isArray(l)?t.push([l[0],l[1]]):t.push([l,l])}}return t}function jn(e,t){if(!t.length||!e||e.size===0)return!0;for(let r of e)for(let[n,o]of t)if(r>=n&&r<=o)return!0;return!1}function ur(e,t){let r=[];if(!e)return r;for(let n of e.matchAll(Bn)){let o=(n[2]||"").trim();if(!(!o||o.startsWith("data:"))){if(!/^https?:/i.test(o))try{o=new URL(o,t||location.href).href}catch{}r.push(o)}}return r}async function Xt(e,t,r=""){let n=e;for(let o of e.matchAll(Bn)){let i=nr(o[0]);if(!i)continue;let a=i;if(!a.startsWith("http")&&!a.startsWith("data:"))try{a=new URL(a,t||location.href).href}catch{}if(!ye(a)){if(C.resource?.has(a)){C.font?.add(a),n=n.replace(o[0],`url(${C.resource.get(a)})`);continue}try{let s=await le(a,{as:"dataURL",useProxy:r,silent:!0});if(s.ok&&typeof s.data=="string"){let l=s.data;C.resource?.set(a,l),C.font?.add(a),n=n.replace(o[0],`url(${l})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",a)}}}return n}function Ma(e){if(!e.length)return null;let t=(a,s)=>e.some(([l,c])=>!(c<a||l>s)),r=t(0,255)||t(305,305),n=t(256,591)||t(7680,7935),o=t(880,1023),i=t(1024,1279);return t(7840,7929)||t(258,259)||t(416,417)||t(431,432)?"vietnamese":i?"cyrillic":o?"greek":n?"latin-ext":r?"latin":null}function Xr(e={}){let t=new Set((e.families||[]).map(o=>String(o).toLowerCase())),r=new Set((e.domains||[]).map(o=>String(o).toLowerCase())),n=new Set((e.subsets||[]).map(o=>String(o).toLowerCase()));return(o,i)=>{if(t.size&&t.has(o.family.toLowerCase()))return!0;if(r.size)for(let a of o.srcUrls)try{if(r.has(new URL(a).host.toLowerCase()))return!0}catch{}if(n.size){let a=Ma(i);if(a&&n.has(a))return!0}return!1}}function Ea(e){if(!e)return e;let t=/@font-face[^{}]*\{[^}]*\}/gi,r=new Set,n=[];for(let i of e.match(t)||[]){let a=se(i,"font-family"),s=dr(a),l=se(i,"font-weight","400"),c=se(i,"font-style","normal"),d=se(i,"font-stretch","100%"),u=se(i,"unicode-range"),p=se(i,"src"),h=ur(p,location.href),f=h.length?h.map(y=>String(y).toLowerCase()).sort().join("|"):p.toLowerCase(),m=[String(s||"").toLowerCase(),l,c,d,u.toLowerCase(),f].join("|");r.has(m)||(r.add(m),n.push(i))}if(n.length===0)return e;let o=0;return e.replace(t,()=>n[o++]||"")}var Yr=new WeakMap,$a=0;function Aa(e){let t=Yr.get(e);return t===void 0&&(t=$a++,Yr.set(e,t)),t}function Ra(e,t,r,n,o,i){let a=Array.from(e||[]).sort().join("|"),s=t?JSON.stringify({families:(t.families||[]).map(p=>String(p).toLowerCase()).sort(),domains:(t.domains||[]).map(p=>String(p).toLowerCase()).sort(),subsets:(t.subsets||[]).map(p=>String(p).toLowerCase()).sort()}):"",l=(r||[]).map(p=>`${(p.family||"").toLowerCase()}::${p.weight||"normal"}::${p.style||"normal"}::${p.src||""}`).sort().join("|"),c=n||"",d=(o||[]).map(p=>String(p).toLowerCase()).sort().join("|"),u=Aa(i||document);return`fonts-embed-css::req=${a}::ex=${s}::lf=${l}::px=${c}::fd=${d}::doc=${u}`}async function Un(e,t,r,n){let o;try{o=e.cssRules||[]}catch{return}let i=(a,s)=>{try{return new URL(a,s||location.href).href}catch{return a}};for(let a of o){if(a.type===CSSRule.IMPORT_RULE&&a.styleSheet){let s=a.href?i(a.href,t):t;if(n.depth>=Ct){console.warn(`[snapDOM] CSSOM import depth exceeded (${Ct}) at ${s}`);continue}if(s&&n.visitedSheets.has(s)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${s}`);continue}s&&n.visitedSheets.add(s);let l={...n,depth:(n.depth||0)+1};await Un(a.styleSheet,s,r,l);continue}if(a.type===CSSRule.FONT_FACE_RULE){let s=(a.style.getPropertyValue("font-family")||"").trim(),l=dr(s);if(!l||ye(l))continue;let c=(a.style.getPropertyValue("font-weight")||"").trim(),d=(a.style.getPropertyValue("font-style")||"").trim(),u=(a.style.getPropertyValue("font-stretch")||"").trim(),p=(a.style.getPropertyValue("font-variation-settings")||"").trim(),h=(a.style.getPropertyValue("src")||"").trim(),f=(a.style.getPropertyValue("unicode-range")||"").trim(),m=c||"400",y=d||"normal",b=u||"100%",x=(d?`font-style:${d};`:"")+(c?`font-weight:${c};`:"")+(u?`font-stretch:${u};`:"")+(p?`font-variation-settings:${p};`:"")+(f?`unicode-range:${f};`:""),v=n.faceMatchesRequired(l,y,m,b);if(!v&&!n.requiredIndex.has(l.toLowerCase()))continue;let g=_n(f);if(!jn(n.usedCodepoints,g))continue;let w={family:l,weightSpec:m,styleSpec:y,stretchSpec:b,unicodeRange:f,srcRaw:h,srcUrls:ur(h,t||location.href),href:t||location.href};if(n.simpleExcluder&&n.simpleExcluder(w,g))continue;if(!v){n.provisionalFaces.push({family:l.toLowerCase(),block:`@font-face{font-family:${l};src:${h};${x}}`,srcRaw:h,baseHref:t||location.href});continue}if(n.coveredFamilies.add(l.toLowerCase()),/url\(/i.test(h)){let k=await Xt(h,t||location.href,n.useProxy);await r(`@font-face{font-family:${l};src:${k};${x}}`)}else await r(`@font-face{font-family:${l};src:${h};${x}}`)}}}async function Na({required:e,usedCodepoints:t,exclude:r=void 0,localFonts:n=[],useProxy:o="",fontStylesheetDomains:i=[],doc:a=document}={}){e instanceof Set||(e=new Set),t instanceof Set||(t=new Set);let s=new Map;for(let g of e){let[w,k,M,S]=String(g).split("__");if(!w)continue;let E=w.toLowerCase(),$=s.get(E)||[];$.push({w:parseInt(k,10),s:M,st:parseInt(S,10)}),s.set(E,$)}function l(g,w,k,M){let S=String(g).toLowerCase();if(!s.has(S))return!1;let E=s.get(S),$=ya(k),R=ba(w),T=wa(M),D=$.min!==$.max,F=$.min,O=I=>R.kind==="normal"&&I==="normal"||R.kind!=="normal"&&(I==="italic"||I==="oblique"),L=!1;for(let I of E){let X=D?I.w>=$.min&&I.w<=$.max:I.w===F,U=O(bt(I.s)),V=I.st>=T.min&&I.st<=T.max;if(X&&U&&V){L=!0;break}}if(L)return!0;if(!D)for(let I of E){let X=O(bt(I.s)),U=I.st>=T.min&&I.st<=T.max;if(Math.abs(F-I.w)<=300&&X&&U)return!0}if(!D&&R.kind==="normal"&&E.some(I=>bt(I.s)!=="normal"))for(let I of E){let X=Math.abs(F-I.w)<=300,U=I.st>=T.min&&I.st<=T.max;if(X&&U)return!0}return!1}let c=Xr(r),d=Ra(e,r,n,o,i,a);if(C.resource?.has(d))return C.resource.get(d);let u=Sa(e),p=[],h=Vt;for(let g of a.querySelectorAll("style")){let w=g.textContent||"";for(let k of w.matchAll(h)){let M=(k[2]||k[4]||"").trim();!M||ye(M)||a.querySelector(`link[rel="stylesheet"][href="${M}"]`)||p.push(M)}}let f=[];p.length&&await Promise.all(p.map(g=>new Promise(w=>{if(a.querySelector(`link[rel="stylesheet"][href="${g}"]`))return w(null);let k=a.createElement("link");k.rel="stylesheet",k.href=g,k.setAttribute("data-snapdom","injected-import"),k.onload=()=>w(k),k.onerror=()=>w(null),a.head.appendChild(k),f.push(k)})));let m="",y=new Set,b=[],x=Array.from(a.querySelectorAll('link[rel="stylesheet"]')).filter(g=>!!g.href);for(let g of f)try{g.remove()}catch{}for(let g of x)try{if(ye(g.href))continue;let w="",k=!1;try{k=new URL(g.href,location.href).origin===location.origin}catch{}if(!k){let S=Array.isArray(i)?i:[];if(!va(g.href,u,S))continue}if(k){let S=Array.from(a.styleSheets).find(E=>E.href===g.href);if(S)try{let E=S.cssRules||[];w=Array.from(E).map($=>$.cssText).join("")}catch{}}if(!w){let S=await le(g.href,{as:"text",useProxy:o});if(S?.ok&&typeof S.data=="string"&&(w=S.data),ye(g.href))continue}w=await ka(w,g.href,o);let M="";for(let S of w.match(Ca)||[]){let E=se(S,"font-family"),$=dr(E);if(!$||ye($))continue;let R=se(S,"font-weight","400"),T=se(S,"font-style","normal"),D=se(S,"font-stretch","100%"),F=se(S,"unicode-range"),O=se(S,"src"),L=ur(O,g.href),I=l($,T,R,D);if(!I&&!s.has($.toLowerCase()))continue;let X=_n(F);if(!jn(t,X))continue;let U={family:$,weightSpec:R,styleSpec:T,stretchSpec:D,unicodeRange:F,srcRaw:O,srcUrls:L,href:g.href};if(r&&c(U,X))continue;if(!I){b.push({family:$.toLowerCase(),block:S,srcRaw:O,baseHref:g.href});continue}y.add($.toLowerCase());let V=/url\(/i.test(O)?await Xt(S,g.href,o):S;M+=V}M.trim()&&(m+=M)}catch{console.warn("[snapDOM] Failed to process stylesheet:",g.href)}let v={requiredIndex:s,usedCodepoints:t,faceMatchesRequired:l,coveredFamilies:y,provisionalFaces:b,simpleExcluder:r?Xr(r):null,useProxy:o,visitedSheets:new Set,depth:0};for(let g of a.styleSheets)if(!(g.href&&x.some(w=>w.href===g.href)))try{let w=g.href||location.origin+"/";w&&v.visitedSheets.add(w),await Un(g,w,async k=>{m+=k},v)}catch{}for(let g of b)y.has(g.family)||(m+=/url\(/i.test(g.srcRaw)?await Xt(g.block,g.baseHref,o):g.block);try{for(let g of a.fonts||[]){if(!g||!g.family||g.status!=="loaded"||!g._snapdomSrc)continue;let w=String(g.family).replace(/^['"]+|['"]+$/g,"");if(ye(w)||!s.has(w.toLowerCase())||r?.families&&r.families.some(M=>String(M).toLowerCase()===w.toLowerCase()))continue;let k=g._snapdomSrc;if(!String(k).startsWith("data:")){if(C.resource?.has(g._snapdomSrc))k=C.resource.get(g._snapdomSrc),C.font?.add(g._snapdomSrc);else if(!C.font?.has(g._snapdomSrc))try{let M=await le(g._snapdomSrc,{as:"dataURL",useProxy:o,silent:!0});if(M.ok&&typeof M.data=="string")k=M.data,C.resource?.set(g._snapdomSrc,k),C.font?.add(g._snapdomSrc);else continue}catch{console.warn("[snapDOM] Failed to fetch dynamic font src:",g._snapdomSrc);continue}}m+=`@font-face{font-family:'${w}';src:url(${k});font-style:${g.style||"normal"};font-weight:${g.weight||"normal"};}`}}catch{}for(let g of n){if(!g||typeof g!="object")continue;let w=String(g.family||"").replace(/^['"]+|['"]+$/g,"");if(!w||ye(w)||!s.has(w.toLowerCase())||r?.families&&r.families.some(R=>String(R).toLowerCase()===w.toLowerCase()))continue;let k=g.weight!=null?String(g.weight):"normal",M=g.style!=null?String(g.style):"normal",S=g.stretchPct!=null?`${g.stretchPct}%`:"100%",E=String(g.src||""),$=E;if(!$.startsWith("data:")){if(C.resource?.has(E))$=C.resource.get(E),C.font?.add(E);else if(!C.font?.has(E))try{let R=await le(E,{as:"dataURL",useProxy:o,silent:!0});if(R.ok&&typeof R.data=="string")$=R.data,C.resource?.set(E,$),C.font?.add(E);else continue}catch{console.warn("[snapDOM] Failed to fetch localFonts src:",E);continue}}m+=`@font-face{font-family:'${w}';src:url(${$});font-style:${M};font-weight:${k};font-stretch:${S};}`}return m&&(m=Ea(m),C.resource?.set(d,m)),m}function qn(e,t){let r=new Set,n=new Set;if(!e)return{required:r,usedCodepoints:n};let o=l=>{if(l)for(let c of l)n.add(c.codePointAt(0))},i=l=>{let c=ma(l.fontFamily);if(c.length)for(let d of c)r.add(`${d}__${yt(l.fontWeight)}__${bt(l.fontStyle)}__${ga(l.fontStretch)}`)},a=l=>{i(_(l));for(let c of["::before","::after"]){let d=_(l,c),u=d&&d.content;if(!(!u||u==="none"||u==="normal"))if(i(d),/^["']/.test(u))o(u.slice(1,-1));else{let p=u.match(/\\[0-9A-Fa-f]{1,6}/g);if(p)for(let h of p)try{n.add(parseInt(h.slice(1),16))}catch{}}}};a(e);let s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;s.nextNode();){let l=s.currentNode;if(l.nodeType===Node.TEXT_NODE){if(t&&l.parentElement&&!t(l.parentElement))continue;o(l.nodeValue||"")}else{if(t&&!t(l))continue;a(l)}}return{required:r,usedCodepoints:n}}function La(e,t){return qn(e,t).required}async function zn(e,t=2,r=document){try{await r.fonts.ready}catch{}let n=Array.from(e||[]).filter(Boolean);if(n.length===0)return;let o=()=>{let i=r.createElement("div");i.setAttribute("data-snapdom-internal",""),i.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;opacity:0!important;pointer-events:none!important;contain:layout size style;";for(let a of n){let s=r.createElement("span");s.textContent="AaBbGg1234\xC1\xC9\xCD\xD3\xDA\xE7\xF1\u2014\u221E",s.style.fontFamily=`"${a}"`,s.style.fontWeight="700",s.style.fontStyle="italic",s.style.fontSize="32px",s.style.lineHeight="1",s.style.whiteSpace="nowrap",s.style.margin="0",s.style.padding="0",i.appendChild(s)}r.body.appendChild(i),i.offsetWidth,r.body.removeChild(i)};for(let i=0;i<Math.max(1,t);i++)o(),await Me(),await Me()}function Ta(e){return/\bcounter\s*\(|\bcounters\s*\(/.test(e||"")}function Gr(e,t=!1){let r="",n=Math.max(1,e);for(;n>0;)n--,r=String.fromCharCode(97+n%26)+r,n=Math.floor(n/26);return t?r.toUpperCase():r}function Kr(e,t=!0){let r=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]],n=Math.max(1,Math.min(3999,e)),o="";for(let[i,a]of r)for(;n>=i;)o+=a,n-=i;return t?o:o.toLowerCase()}function Qr(e,t){switch((t||"decimal").toLowerCase()){case"decimal":return String(e);case"decimal-leading-zero":{let r=Math.abs(e);return(e<0?"-":"")+(r<10?"0":"")+String(r)}case"lower-alpha":return Gr(e,!1);case"upper-alpha":return Gr(e,!0);case"lower-roman":return Kr(e,!1);case"upper-roman":return Kr(e,!0);default:return String(e)}}function Fa(e){let t=new WeakMap,r=e instanceof Document?e.documentElement:e,n=c=>c&&c.tagName==="LI",o=c=>{let d=0,u=c?.parentElement;if(!u)return 0;for(let p of u.children){if(p===c)break;p.tagName==="LI"&&d++}return d},i=c=>{let d=new Map;for(let[u,p]of c)d.set(u,p.slice());return d},a=(c,d,u)=>{let p=i(c),h;try{h=u.style?.counterReset||getComputedStyle(u).counterReset}catch{}if(h&&h!=="none")for(let y of h.split(",")){let b=y.trim().split(/\s+/),x=b[0],v=Number.isFinite(Number(b[1]))?Number(b[1]):0;if(!x)continue;let g=d.get(x);if(g&&g.length){let w=g.slice();w.push(v),p.set(x,w)}else p.set(x,[v])}let f;try{f=u.style?.counterSet||getComputedStyle(u).counterSet}catch{}if(f&&f!=="none")for(let y of f.split(",")){let b=y.trim().split(/\s+/),x=b[0],v=Number.isFinite(Number(b[1]))?Number(b[1]):0;if(!x)continue;let g=p.get(x)||[];g.length===0&&g.push(0),g[g.length-1]=v,p.set(x,g)}let m;try{m=u.style?.counterIncrement||getComputedStyle(u).counterIncrement}catch{}if(m&&m!=="none")for(let y of m.split(",")){let b=y.trim().split(/\s+/),x=b[0],v=Number.isFinite(Number(b[1]))?Number(b[1]):1;if(!x)continue;let g=p.get(x)||[];g.length===0&&g.push(0),g[g.length-1]+=v,p.set(x,g)}try{if(getComputedStyle(u).display==="list-item"&&n(u)){let y=u.parentElement,b=1;if(y&&y.tagName==="OL"){let v=y.getAttribute("start"),g=Number.isFinite(Number(v))?Number(v):1,w=o(u),k=u.getAttribute("value");b=Number.isFinite(Number(k))?Number(k):g+w}else b=1+o(u);let x=p.get("list-item")||[];x.length===0&&x.push(0),x[x.length-1]=b,p.set("list-item",x)}}catch{}return p},s=(c,d,u)=>{let p=a(u,d,c);t.set(c,p);let h=p;for(let m of c.children)h=s(m,p,h);let f=new Map;for(let[m,y]of u){let b=y.length,x=h.get(m);f.set(m,x&&x.length?x.slice(0,b):y.slice())}for(let[m,y]of h)!f.has(m)&&y.length&&!d.has(m)&&f.set(m,y.slice(0,1));return f},l=new Map;return s(r,l,l),{get(c,d){let u=t.get(c)?.get(d);return u&&u.length?u[u.length-1]:0},getStack(c,d){let u=t.get(c)?.get(d);return u?u.slice():[]}}}function Pa(e,t,r){if(!e||e==="none")return e;try{let n=/\b(counter|counters)\s*\(([^)]+)\)/g;return e.replace(n,(o,i,a)=>{let s=String(a).split(",").map(l=>l.trim());if(i==="counter"){let l=s[0]?.replace(/^["']|["']$/g,""),c=(s[1]||"decimal").toLowerCase(),d=r.get(t,l);return Qr(d,c)}else{let l=s[0]?.replace(/^["']|["']$/g,""),c=s[1]?.replace(/^["']|["']$/g,"")??"",d=(s[2]||"decimal").toLowerCase(),u=r.getStack(t,l);return u.length?u.map(p=>Qr(p,d)).join(c):""}})}catch{return"- "}}$e();var Le=new WeakMap,Jr=1e3;function Oa(e,t){let r=Vn(e);return t?(t.__pseudoPreflightFp!==r&&(t.__pseudoPreflight=en(e,r),t.__pseudoPreflightFp=r),!!t.__pseudoPreflight):en(e,r)}function Yt(e){try{return e&&e.cssRules?e.cssRules:null}catch{return null}}function Vn(e){let t=e.querySelectorAll('style,link[rel~="stylesheet"]'),r=`n:${t.length}|`,n=0;for(let i=0;i<t.length;i++){let a=t[i];if(a.tagName==="STYLE"){let s=a.textContent?a.textContent.length:0;r+=`S${s}|`;let l=a.sheet,c=l?Yt(l):null;c&&(n+=c.length)}else{let s=a.getAttribute("href")||"",l=a.getAttribute("media")||"all";r+=`L${s}|m:${l}|`;let c=a.sheet,d=c?Yt(c):null;d&&(n+=d.length)}}let o=e.adoptedStyleSheets;return r+=`ass:${Array.isArray(o)?o.length:0}|tr:${n}`,r}function Zr(e,t,r){let n=Yt(e);if(!n)return!1;for(let o=0;o<n.length;o++){if(r.budget<=0)return!1;let i=n[o],a=i&&i.cssText?i.cssText:"";r.budget--;for(let s of t)if(a.includes(s))return!0;if(i&&i.cssRules&&i.cssRules.length)for(let s=0;s<i.cssRules.length&&r.budget>0;s++){let l=i.cssRules[s],c=l&&l.cssText?l.cssText:"";r.budget--;for(let d of t)if(c.includes(d))return!0}if(r.budget<=0)return!1}return!1}function en(e=document,t=Vn(e)){let r=Le.get(e);if(r&&r.fingerprint===t)return r.result;let n=["::before","::after","::first-letter",":before",":after",":first-letter","counter(","counters(","counter-increment","counter-reset"],o=e.querySelectorAll("style");for(let a=0;a<o.length;a++){let s=o[a].textContent||"";for(let l of n)if(s.includes(l))return Le.set(e,{fingerprint:t,result:!0}),!0}let i=e.adoptedStyleSheets;if(Array.isArray(i)&&i.length){let a={budget:Jr};try{for(let s of i)if(Zr(s,n,a))return Le.set(e,{fingerprint:t,result:!0}),!0}catch{}}{let a=e.querySelectorAll('style,link[rel~="stylesheet"]'),s={budget:Jr};for(let l=0;l<a.length&&s.budget>0;l++){let c=a[l],d=null;if(c.tagName,d=c.sheet||null,d&&Zr(d,n,s))return Le.set(e,{fingerprint:t,result:!0}),!0}}return e.querySelector('[style*="counter("], [style*="counters("]')?(Le.set(e,{fingerprint:t,result:!0}),!0):(Le.set(e,{fingerprint:t,result:!1}),!1)}function tn(e){for(let t of["Top","Right","Bottom","Left"]){let r=parseFloat(e[`border${t}Width`])||0,n=e[`border${t}Style`];if(r>0&&n&&n!=="none"&&n!=="hidden")return!0}return!1}function Ia(e,t){let r=null,n=()=>{if(!r)try{r=Fa(e)}catch(o){j(t,"buildCounterContext failed",o),r={get:()=>0,getStack:()=>[]}}return r};return{get(o,i){return n().get(o,i)},getStack(o,i){return n().getStack(o,i)}}}function Da(e){let t=!1;for(let r=0;r<e.length;r++){let n=e[r];if(n==='"')t=!t;else if(n==="/"&&!t)return e.slice(0,r).trim()}return e}function Wa(e){if(!e)return"";let t=[],r=/"([^"]*)"/g,n=0,o;for(;o=r.exec(e);){let a=e.slice(n,o.index).trim();a&&t.push(a),t.push(o[1]),n=r.lastIndex}let i=e.slice(n).trim();return i&&t.push(i),t.join("")}function Gt(e,t,r){let n=e.parentElement,o=n&&r?r.get(n):null;return o?{get(i,a){let s=t.get(i,a),l=o.get(a);return typeof l=="number"?Math.max(s,l):s},getStack(i,a){let s=t.getStack(i,a);if(!s.length)return s;let l=o.get(a);if(typeof l=="number"){let c=s.slice();return c[c.length-1]=Math.max(c[c.length-1],l),c}return s}}:t}function Kt(e,t,r){let n=new Map;function o(c){let d=[];if(!c||c==="none")return d;for(let u of String(c).split(",")){let p=u.trim().split(/\s+/),h=p[0],f=Number.isFinite(Number(p[1]))?Number(p[1]):void 0;h&&d.push({name:h,num:f})}return d}let i=o(t?.counterReset),a=o(t?.counterSet),s=o(t?.counterIncrement);function l(c){if(n.has(c))return n.get(c).slice();let d=r.getStack(e,c);d=d.length?d.slice():[];let u=i.find(f=>f.name===c);if(u){let f=Number.isFinite(u.num)?u.num:0;d=d.length?[...d,f]:[f]}let p=a.find(f=>f.name===c);if(p){let f=Number.isFinite(p.num)?p.num:0;d.length===0&&(d=[0]),d[d.length-1]=f}let h=s.find(f=>f.name===c);if(h){let f=Number.isFinite(h.num)?h.num:1;d.length===0&&(d=[0]),d[d.length-1]+=f}return n.set(c,d.slice()),d}return{get(c,d){let u=l(d);return u.length?u[u.length-1]:0},getStack(c,d){return l(d)},__incs:s}}function Ha(e,t,r,n){let o;try{o=_(e,t)}catch{}let i=o?.content;if(!i||i==="none"||i==="normal")return{text:"",incs:[]};i=Da(i);let a=Gt(e,r,n),s=Kt(e,o,a),l=Ta(i)?Pa(i,e,s):i;return{text:Wa(l),incs:s.__incs||[]}}async function Qt(e,t,r,n){if(e?.nodeType!==1||t?.nodeType!==1||e.tagName==="TEXTAREA")return;let o=e.ownerDocument||document;if(!Oa(o,r))return;r.__siblingCounters||(r.__siblingCounters=new WeakMap),r.__counterCtx||(r.__counterCtx=Ia(e.ownerDocument||document,r));let i=r.__counterCtx;for(let s of["::before","::after","::first-letter"])try{let l=_(e,s);if(!l||l.content==="none"&&l.backgroundImage==="none"&&l.backgroundColor==="transparent"&&!tn(l)&&(!l.transform||l.transform==="none")&&l.display==="inline")continue;if(s==="::first-letter"){let P=_(e),B=(P?.display||"").toLowerCase();if(B.includes("flex")||B.includes("grid"))continue;let W=ee=>l[ee]!==P[ee]&&(parseFloat(l[ee])||0)!==0;if(!(l.color!==P.color||l.fontSize!==P.fontSize||l.fontWeight!==P.fontWeight||l.fontFamily!==P.fontFamily||l.fontStyle!==P.fontStyle||l.textTransform!==P.textTransform||l.float!==P.float&&l.float!=="none"||W("paddingTop")||W("paddingRight")||W("paddingBottom")||W("paddingLeft")||W("marginTop")||W("marginRight")||W("marginBottom")||W("marginLeft")))continue;let q=Array.from(t.childNodes).find(ee=>ee.nodeType===Node.TEXT_NODE&&ee.textContent?.trim().length>0);if(!q)continue;let ce=q.textContent,K=ce.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],te=ce.slice(K?.length||0);if(!K||/[\uD800-\uDFFF]/.test(K))continue;let oe=document.createElement("span");oe.textContent=K,oe.dataset.snapdomPseudo="::first-letter";let J=Nr(l),fe=Ht(J,"span");r.styleMap.set(oe,fe);let Ce=document.createTextNode(te);t.replaceChild(Ce,q),t.insertBefore(oe,Ce);continue}let c=l.content??"",d=c===""||c==="none"||c==="normal",{text:u,incs:p}=Ha(e,s,i,r.__siblingCounters),h=l.backgroundImage,f=l.backgroundColor,m=l.fontFamily,y=parseInt(l.fontSize)||32,b=parseInt(l.fontWeight)||!1,x=l.color||"#000",v=l.transform,g=ye(m),w=!d&&u!=="",k=h&&h!=="none",M=f&&f!=="transparent"&&f!=="rgba(0, 0, 0, 0)",S=tn(l),E=v&&v!=="none",$=c!=="none"&&c!=="normal",R=$&&((parseFloat(l.width)||0)>0||(parseFloat(l.height)||0)>0),T=$&&l.boxShadow&&l.boxShadow!=="none",D=$&&l.outlineStyle&&l.outlineStyle!=="none"&&(parseFloat(l.outlineWidth)||0)>0;if(!(w||k||M||S||E||R||T||D)){if(p&&p.length&&e.parentElement){let P=r.__siblingCounters.get(e.parentElement)||new Map;for(let{name:B}of p){if(!B)continue;let W=Gt(e,i,r.__siblingCounters),q=Kt(e,_(e,s),W).get(e,B);P.set(B,q)}r.__siblingCounters.set(e.parentElement,P)}continue}let F=u.startsWith("url(")||/^-?(?:webkit-)?image-set\(/i.test(u),O=!1;if(w&&!g&&u.length>1&&!F){let P=_(e),B=parseFloat(P.fontSize)||16,W=parseFloat(P.lineHeight);Number.isFinite(W)||(W=B*1.5),e.getBoundingClientRect().height<W*1.6&&(t.style.whiteSpace="nowrap",O=!0)}let L=document.createElement("span");L.dataset.snapdomPseudo=s,L.style.pointerEvents="none",O&&(L.style.whiteSpace="nowrap");let I=Nr(l),X=(_(e).display||"").toLowerCase(),U=X.includes("flex")||X.includes("grid");if(U){let P=I["min-width"];(!P||P==="auto"||P==="0px")&&(I["min-width"]="0px")}let V=Ht(I,"span",w,U);if(r.styleMap.set(L,V),g&&u&&u.length===1){let{dataUrl:P,width:B,height:W}=await ha(u,m,b,y,x),q=document.createElement("img");q.src=P,q.style=`height:${y}px;width:${B/W*y}px;object-fit:contain;`,L.appendChild(q),t.dataset.snapdomHasIcon="true"}else if(u&&F){let P=cn(u,typeof devicePixelRatio<"u"&&devicePixelRatio||1)??nr(u);if(P?.trim())try{let B=await le(xt(P),{as:"dataURL",useProxy:n.useProxy});if(B?.ok&&typeof B.data=="string"){let W=document.createElement("img");W.src=B.data,W.style=`width:${y}px;height:auto;object-fit:contain;`,L.appendChild(W)}}catch(B){console.error(`[snapdom] Error in pseudo ${s} for`,e,B)}}else!g&&w&&(L.textContent=u);L.style.backgroundImage="none","maskImage"in L.style&&(L.style.maskImage="none"),"webkitMaskImage"in L.style&&(L.style.webkitMaskImage="none");try{L.style.backgroundRepeat=l.backgroundRepeat,L.style.backgroundSize=l.backgroundSize,l.backgroundPositionX&&l.backgroundPositionY?(L.style.backgroundPositionX=l.backgroundPositionX,L.style.backgroundPositionY=l.backgroundPositionY):L.style.backgroundPosition=l.backgroundPosition,L.style.backgroundOrigin=l.backgroundOrigin,L.style.backgroundClip=l.backgroundClip,L.style.backgroundAttachment=l.backgroundAttachment,L.style.backgroundBlendMode=l.backgroundBlendMode}catch{}if(k)try{let P=Bt(h),B=await Promise.all(P.map(un));L.style.backgroundImage=B.join(", ")}catch(P){console.warn(`[snapdom] Failed to inline background-image for ${s}`,P)}M&&(L.style.backgroundColor=f);let Q=L.childNodes.length>0||L.textContent?.trim()!==""||k||M||S||E||R||T||D;if(p&&p.length&&e.parentElement){let P=r.__siblingCounters.get(e.parentElement)||new Map,B=Gt(e,i,r.__siblingCounters),W=Kt(e,_(e,s),B);for(let{name:q}of p){if(!q)continue;let ce=W.get(e,q);P.set(q,ce)}r.__siblingCounters.set(e.parentElement,P)}if(!Q)continue;s==="::before"?(t.dataset.snapdomHasBefore="1",t.insertBefore(L,t.firstChild)):(t.dataset.snapdomHasAfter="1",t.appendChild(L))}catch(l){console.warn(`[snapdom] Failed to capture ${s} for`,e,l)}let a=Array.from(t.children).filter(s=>!s.dataset.snapdomPseudo);if(r.nodeMap)for(let s of a){let l=r.nodeMap.get(s);l?.nodeType===1&&await Qt(l,s,r,n)}else{let s=Array.from(e.children);for(let l=0;l<Math.min(s.length,a.length);l++)await Qt(s[l],a[l],r,n)}}function Ba(e,t){if(!e||e?.nodeType!==1)return;let r=e.ownerDocument||document,n=t||r,o=e instanceof SVGSVGElement?[e]:Array.from(e.querySelectorAll("svg"));if(o.length===0)return;let i=/url\(\s*#([^)]+)\)/g,a=["fill","stroke","filter","clip-path","mask","marker","marker-start","marker-mid","marker-end"],s=g=>window.CSS&&CSS.escape?CSS.escape(g):g.replace(/[^a-zA-Z0-9_-]/g,"\\$&"),l="http://www.w3.org/1999/xlink",c=g=>{if(!g||!g.getAttribute)return null;let w=g.getAttribute("href")||g.getAttribute("xlink:href")||(typeof g.getAttributeNS=="function"?g.getAttributeNS(l,"href"):null);if(w)return w;let k=g.attributes;if(!k)return null;for(let M=0;M<k.length;M++){let S=k[M];if(!S||!S.name)continue;if(S.name==="href")return S.value;let E=S.name.indexOf(":");if(E!==-1&&S.name.slice(E+1)==="href")return S.value}return null},d=new Set(Array.from(e.querySelectorAll("[id]")).map(g=>g.id)),u=new Set,p=!1,h=(g,w=null)=>{if(!g)return;i.lastIndex=0;let k;for(;k=i.exec(g);){p=!0;let M=(k[1]||"").trim();M&&(d.has(M)||(u.add(M),w&&!w.has(M)&&w.add(M)))}},f=g=>{let w=g.querySelectorAll("use");for(let S of w){let E=c(S);if(!E||!E.startsWith("#"))continue;p=!0;let $=E.slice(1).trim();$&&!d.has($)&&u.add($)}let k='*[style*="url("],*[fill^="url("], *[stroke^="url("],*[filter^="url("],*[clip-path^="url("],*[mask^="url("],*[marker^="url("],*[marker-start^="url("],*[marker-mid^="url("],*[marker-end^="url("]';h(g.getAttribute("style")||"");for(let S of a)h(g.getAttribute(S));let M=g.querySelectorAll(k);for(let S of M){h(S.getAttribute("style")||"");for(let E of a)h(S.getAttribute(E))}};for(let g of o)f(g);if(!p)return;let m=e.querySelector("svg.inline-defs-container");m||(m=r.createElementNS("http://www.w3.org/2000/svg","svg"),m.classList.add("inline-defs-container"),m.setAttribute("aria-hidden","true"),m.setAttribute("style","position:absolute;width:0;height:0;overflow:hidden"),e.insertBefore(m,e.firstChild||null));let y=m.querySelector("defs")||null,b=g=>{if(!g||d.has(g))return null;let w=s(g),k=M=>{let S=n.querySelector(M);return S&&!e.contains(S)?S:null};return k(`svg defs > *#${w}`)||k(`svg > symbol#${w}`)||k(`*#${w}`)};if(!u.size)return;let x=new Set(u),v=new Set;for(;x.size;){let g=x.values().next().value;if(x.delete(g),!g||d.has(g)||v.has(g))continue;let w=b(g);if(!w){v.add(g);continue}y||(y=r.createElementNS("http://www.w3.org/2000/svg","defs"),m.appendChild(y));let k=w.cloneNode(!0);k.id||k.setAttribute("id",g),y.appendChild(k),v.add(g),d.add(g);let M=[k,...k.querySelectorAll("*")];for(let S of M){let E=c(S);if(E&&E.startsWith("#")){let R=E.slice(1).trim();R&&!d.has(R)&&!v.has(R)&&x.add(R)}let $=S.getAttribute?.("style")||"";$&&h($,x);for(let R of a){let T=S.getAttribute?.(R);T&&h(T,x)}}}}ne();function _a(e){let t=getComputedStyle(e),r=t.outlineStyle,n=t.outlineWidth,o=t.borderStyle,i=t.borderWidth,a=r!=="none"&&parseFloat(n)>0,s=o==="none"||parseFloat(i)===0;if(a&&s){let l=e.style.border;return e.style.border=`${n} solid transparent`,()=>{e.style.border=l}}return()=>{}}function ja(e){let t=[];try{let r=e.querySelectorAll("*");for(let n of r){if(!(n instanceof HTMLElement))continue;let o=n.style.contentVisibility||"",i=getComputedStyle(n);(i.contentVisibility||i.getPropertyValue("content-visibility")||"")==="auto"&&(t.push({el:n,original:o}),n.style.contentVisibility="visible")}if(e instanceof HTMLElement){let n=getComputedStyle(e);(n.contentVisibility||n.getPropertyValue("content-visibility")||"")==="auto"&&(t.push({el:e,original:e.style.contentVisibility||""}),e.style.contentVisibility="visible")}}catch{}return()=>{for(let{el:r,original:n}of t)try{r.style.contentVisibility=n}catch{}}}de();$t();function Ua(e){return Xn(e.boxShadow)}function qa(e){return Xn(e.textShadow)}function Xn(e){if(!e||e==="none")return{top:0,right:0,bottom:0,left:0};let t=[],r="",n=0;for(let l=0;l<e.length;l++){let c=e[l];c==="("?n++:c===")"&&(n=Math.max(0,n-1)),c===","&&n===0?(t.push(r),r=""):r+=c}r.trim()&&t.push(r);let o=0,i=0,a=0,s=0;for(let l of t){if(/\binset\b/i.test(l))continue;let c=l.match(/-?\d+(\.\d+)?px/g)?.map(y=>parseFloat(y))||[];if(c.length<2)continue;let[d,u,p=0,h=0]=c,f=Math.abs(d)+p+h,m=Math.abs(u)+p+h;i=Math.max(i,f+Math.max(d,0)),s=Math.max(s,f+Math.max(-d,0)),a=Math.max(a,m+Math.max(u,0)),o=Math.max(o,m+Math.max(-u,0))}return{top:Math.ceil(o),right:Math.ceil(i),bottom:Math.ceil(a),left:Math.ceil(s)}}function za(e){let t=e.filter&&e.filter!=="none"?e.filter:e.webkitFilter||"",r=/blur\(\s*([0-9.]+)px\s*\)/gi,n=0,o;for(;o=r.exec(t);)n+=parseFloat(o[1])||0;let i=Math.ceil(n);return{top:i,right:i,bottom:i,left:i}}function Va(e){if((e.outlineStyle||"none")==="none")return{top:0,right:0,bottom:0,left:0};let t=Math.ceil(parseFloat(e.outlineWidth||"0")||0),r=parseFloat(e.outlineOffset||"0")||0,n=t+Math.max(0,Math.ceil(r));return{top:n,right:n,bottom:n,left:n}}function Xa(e){let t=`${e.filter||""} ${e.webkitFilter||""}`.trim();if(!t||t==="none")return{bleed:{top:0,right:0,bottom:0,left:0},has:!1};let r=t.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi)||[],n=0,o=0,i=0,a=0,s=!1;for(let l of r){s=!0;let c=l.match(/-?\d+(?:\.\d+)?px/gi)?.map(m=>parseFloat(m))||[],[d=0,u=0,p=0]=c,h=Math.abs(d)+p,f=Math.abs(u)+p;o=Math.max(o,h+Math.max(d,0)),a=Math.max(a,h+Math.max(-d,0)),i=Math.max(i,f+Math.max(u,0)),n=Math.max(n,f+Math.max(-u,0))}return{bleed:{top:A(n),right:A(o),bottom:A(i),left:A(a)},has:s}}function Ya(e,t){if(!e||!t||!t.style)return null;let r=getComputedStyle(e);try{t.style.transformOrigin="0 0"}catch{}try{"translate"in t.style&&(t.style.translate="none"),"rotate"in t.style&&(t.style.rotate="none")}catch{}let n=r.transform||"none";if(!n||n==="none"){let s=null;try{s=Mt(e).scale}catch{}try{t.style.transform="none"}catch{}if(!s)return{a:1,b:0,c:0,d:1};let l=s.trim().split(/\s+/).map(parseFloat),c=Number.isFinite(l[0])?l[0]:1,d=Number.isFinite(l[1])?l[1]:c;return{a:c,b:0,c:0,d}}function o(s,l,c,d){let u=Math.sqrt(s*s+l*l)||0,p=0,h=0;if(u>0){let f=s/u,m=l/u;p=f*c+m*d;let y=c-f*p,b=d-m*p;h=Math.sqrt(y*y+b*b)||0,h>0?p=p/h:p=0}return{a:u,b:0,c:p*h,d:h}}let i=n.match(/^matrix\(\s*([^)]+)\)$/i);if(i){let s=i[1].split(",").map(l=>parseFloat(l.trim()));if(s.length===6&&s.every(Number.isFinite)){let[l,c,d,u]=s,p=o(l,c,d,u);try{t.style.transform=`matrix(${p.a}, ${p.b}, ${p.c}, ${p.d}, 0, 0)`}catch{}return p}}let a=n.match(/^matrix3d\(\s*([^)]+)\)$/i);if(a){let s=a[1].split(",").map(l=>parseFloat(l.trim()));if(s.length===16&&s.every(Number.isFinite)){let l=s[0],c=s[1],d=s[4],u=s[5],p=o(l,c,d,u);try{t.style.transform=`matrix(${p.a}, ${p.b}, ${p.c}, ${p.d}, 0, 0)`}catch{}return p}}try{let s=new DOMMatrix(n),l=o(s.a,s.b,s.c,s.d);try{t.style.transform=`matrix(${l.a}, ${l.b}, ${l.c}, ${l.d}, 0, 0)`}catch{}return l}catch{return null}}function wt(e,t,r,n,o){let i=r.a,a=r.b,s=r.c,l=r.d,c=r.e||0,d=r.f||0;function u(b,x){let v=b-n,g=x-o,w=i*v+s*g,k=a*v+l*g;return w+=n+c,k+=o+d,[w,k]}let p=[u(0,0),u(e,0),u(0,t),u(e,t)],h=1/0,f=1/0,m=-1/0,y=-1/0;for(let[b,x]of p)b<h&&(h=b),x<f&&(f=x),b>m&&(m=b),x>y&&(y=x);return{minX:h,minY:f,maxX:m,maxY:y,width:m-h,height:y-f}}function Jt(e,t,r){let n=(e.transformOrigin||"0 0").trim().split(/\s+/),[o,i]=[n[0]||"0",n[1]||"0"],a=(s,l)=>{let c=s.toLowerCase();return c==="left"||c==="top"?0:c==="center"?l/2:c==="right"||c==="bottom"?l:c.endsWith("px")?parseFloat(c)||0:c.endsWith("%")?(parseFloat(c)||0)*l/100:/^-?\d+(\.\d+)?$/.test(c)&&parseFloat(c)||0};return{ox:a(o,t),oy:a(i,r)}}function Mt(e){let t={rotate:"0deg",scale:null,translate:null},r=typeof e.computedStyleMap=="function"?e.computedStyleMap():null;if(r){let o=l=>{try{return typeof r.has=="function"&&!r.has(l)||typeof r.get!="function"?null:r.get(l)}catch{return null}},i=o("rotate");if(i)if(i.angle){let l=i.angle;t.rotate=l.unit==="rad"?l.value*180/Math.PI+"deg":l.value+l.unit}else i.unit?t.rotate=i.unit==="rad"?i.value*180/Math.PI+"deg":i.value+i.unit:t.rotate=String(i);else{let l=getComputedStyle(e);t.rotate=l.rotate&&l.rotate!=="none"?l.rotate:"0deg"}let a=o("scale");if(a){let l="x"in a&&a.x?.value!=null?a.x.value:Array.isArray(a)?a[0]?.value:Number(a)||1,c="y"in a&&a.y?.value!=null?a.y.value:Array.isArray(a)?a[1]?.value:l;t.scale=`${l} ${c}`}else{let l=getComputedStyle(e);t.scale=l.scale&&l.scale!=="none"?l.scale:null}let s=o("translate");if(s){let l="x"in s&&"value"in s.x?s.x.value:Array.isArray(s)?s[0]?.value:0,c="y"in s&&"value"in s.y?s.y.value:Array.isArray(s)?s[1]?.value:0,d="x"in s&&s.x?.unit?s.x.unit:"px",u="y"in s&&s.y?.unit?s.y.unit:"px";t.translate=`${l}${d} ${c}${u}`}else{let l=getComputedStyle(e);t.translate=l.translate&&l.translate!=="none"?l.translate:null}return t}let n=getComputedStyle(e);return t.rotate=n.rotate&&n.rotate!=="none"?n.rotate:"0deg",t.scale=n.scale&&n.scale!=="none"?n.scale:null,t.translate=n.translate&&n.translate!=="none"?n.translate:null,t}var It=null;function Ga(){if(It)return It;let e=document.createElement("div");return e.id="snapdom-measure-slot",e.setAttribute("aria-hidden","true"),Object.assign(e.style,{position:"absolute",left:"-99999px",top:"0px",width:"0px",height:"0px",overflow:"hidden",opacity:"0",pointerEvents:"none",contain:"size layout style"}),document.documentElement.appendChild(e),It=e,e}function Ka(e){let t=Ga(),r=document.createElement("div");r.style.transformOrigin="0 0",e.baseTransform&&(r.style.transform=e.baseTransform),e.rotate&&(r.style.rotate=e.rotate),e.scale&&(r.style.scale=e.scale),e.translate&&(r.style.translate=e.translate),t.appendChild(r);let n=Ja(r);return t.removeChild(r),n}function Qa(e){let t=_(e),r=t.transform||"none";if(r!=="none"&&!/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,\s*0\s*,\s*0\s*\)$/i.test(r))return!0;let n=t.rotate&&t.rotate!=="none"&&t.rotate!=="0deg",o=t.scale&&t.scale!=="none"&&t.scale!=="1",i=t.translate&&t.translate!=="none"&&t.translate!=="0px 0px";return!!(n||o||i)}function Ja(e){let t=getComputedStyle(e).transform;if(!t||t==="none")return new DOMMatrix;try{return new DOMMatrix(t)}catch{return new WebKitCSSMatrix(t)}}var Zt="http://www.w3.org/1999/xhtml",Yn=new WeakSet;function Gn(e,t){if(!t)return null;let r=e.ownerDocument||document,n=r.defaultView||window,o,i,a,s;if(t==="viewport")o=0,i=0,a=r.documentElement?.clientWidth||n.innerWidth,s=r.documentElement?.clientHeight||n.innerHeight;else if(typeof t=="object")o=(Number(t.x)||0)-(n.scrollX||0),i=(Number(t.y)||0)-(n.scrollY||0),a=Number(t.width),s=Number(t.height);else return null;return a>0&&s>0?{left:o,top:i,width:a,height:s,right:o+a,bottom:i+s}:null}function er(e){if(e.parentElement)return e.parentElement;let t=e.getRootNode&&e.getRootNode();return t instanceof ShadowRoot?t.host:null}function Za(e,t){for(let r=t;r;r=er(r))if(r===e)return!0;return!1}function es(e,t){for(let r=er(e);r&&r!==t&&r?.nodeType===1;r=er(r)){let n=_(r);if(n.position!=="static"||n.transform&&n.transform!=="none"||n.filter&&n.filter!=="none"||n.backdropFilter&&n.backdropFilter!=="none"||n.perspective&&n.perspective!=="none"||/transform|perspective|filter/.test(n.willChange||"")||/layout|paint|strict|content/.test(n.contain||""))return r}return null}function Kn(e,t){try{let r=new DOMMatrix;if(t&&t.rotate&&t.rotate!=="0deg"&&(r=r.multiply(new DOMMatrix(`rotate(${t.rotate})`))),t&&t.scale){let n=String(t.scale).trim().split(/\s+/).filter(Boolean);n.length&&n.every(o=>Number.isFinite(Number(o)))&&(r=r.multiply(new DOMMatrix(`scale(${n.join(",")})`)))}return e&&(r=r.multiply(new DOMMatrix(e))),r}catch{return null}}function ts(e,t,r,n,o){let i=e.getBoundingClientRect();t?.nodeType===1&&t.namespaceURI===Zt&&_(e).position==="static"&&(t.style.position="relative");let a=[];for(let[s,l]of r){if(s?.nodeType!==1||s.namespaceURI!==Zt||l?.nodeType!==1||l===e||!Za(e,l))continue;let c=n.get(l)||_(l),d=c.position;if(d!=="fixed"&&d!=="sticky"&&d!=="-webkit-sticky"||s.style.position==="absolute")continue;let u=l.getBoundingClientRect();if(!(u.width>0&&u.height>0))continue;Yn.add(s);let p=c.transform&&c.transform!=="none"?c.transform:"",h=Mt(l),f=!!(p||h.rotate!=="0deg"||h.scale||h.translate),m=f?Kn(p,h):null,y=!m||!m.is2D||m.a===1&&m.b===0&&m.c===0&&m.d===1,b=u.width,x=u.height;y||(b=l.offsetWidth||u.width,x=l.offsetHeight||u.height);let v=l.getRootNode&&l.getRootNode()instanceof ShadowRoot,g=i,w=e.clientLeft||0,k=e.clientTop||0;if(v){let R=es(l,e);R&&(g=R.getBoundingClientRect(),w=R.clientLeft||0,k=R.clientTop||0)}let M=u.left-g.left-w,S=u.top-g.top-k;if(f)if(s.style.translate="none",s.style.rotate="none",s.style.scale="none",y)s.style.transform="none";else{s.style.transform=`matrix(${m.a},${m.b},${m.c},${m.d},0,0)`;let{ox:R,oy:T}=Jt(c,b,x),D=wt(b,x,{a:m.a,b:m.b,c:m.c,d:m.d,e:0,f:0},R,T);M-=D.minX,S-=D.minY}if(d!=="fixed"){let R=s.cloneNode(!1);R.setAttribute("data-snap-ph","1"),R.style.position="static",R.style.visibility="hidden",R.style.width=`${b}px`,R.style.height=`${x}px`,R.style.boxSizing="border-box",s.parentElement?.insertBefore(R,s)}let E=b+2,$=x;o&&(Math.abs(S-o.y)<.5&&(S-=1,$+=1),Math.abs(M-o.x)<.5&&(M-=1,E+=1)),s.style.position="absolute",s.style.left=`${M}px`,s.style.top=`${S}px`,s.style.right="auto",s.style.bottom="auto",s.style.margin="0",s.style.width=`${E}px`,s.style.height=`${$}px`,s.style.boxSizing="border-box",v||a.push(s)}for(let s of a)t.appendChild(s)}function rs(e,t,r={}){if(!e||!t||!t.style)return;let n=getComputedStyle(e);try{t.style.boxShadow="none"}catch(i){j(r,"stripRootShadows boxShadow",i)}try{t.style.textShadow="none"}catch(i){j(r,"stripRootShadows textShadow",i)}try{t.style.outline="none"}catch(i){j(r,"stripRootShadows outline",i)}let o=(n.filter||"").replace(/\bdrop-shadow\((?:[^()]|\([^()]*\))*\)\s*/gi,"").trim().replace(/\s+/g," ");try{t.style.filter=o.length?o:"none"}catch(i){j(r,"stripRootShadows filter",i)}}function ns(e,t){if(!e||!t||!t.style)return;let r=1;try{r=parseFloat(getComputedStyle(e).zoom)}catch{return}if(!(!t.style.getPropertyValue("zoom")&&(!Number.isFinite(r)||r===1)))try{t.style.setProperty("zoom","1","important")}catch{}}function rn(e){let t=e.display||"";if(t.includes("flex")||t.includes("grid")||t.startsWith("table")||t==="inline-block"||t==="flow-root"||e.position==="absolute"||e.position==="fixed"||e.float&&e.float!=="none")return!0;let r=e.overflowX||e.overflow||"visible",n=e.overflowY||e.overflow||"visible";return!!(r!=="visible"||n!=="visible"||e.contain&&/\b(layout|content|paint|strict)\b/.test(e.contain))}function os(e,t){let r=Array.from(e.childNodes),n=t==="top"?r:r.reverse();for(let o of n){if(o.nodeType===Node.TEXT_NODE){if(/\S/.test(o.textContent||""))return null;continue}if(o.nodeType!==Node.ELEMENT_NODE)continue;let i=getComputedStyle(o),a=String(i.display||"");if(!(a==="none"||a==="contents")&&!(i.position==="absolute"||i.position==="fixed"))return i.float&&i.float!=="none"||a.startsWith("inline")?null:o}return null}function is(e,t,r){if(!e||!t||!t.style)return;let n=getComputedStyle(e);if(!rn(n))for(let o of["top","bottom"]){let i=o==="top"?"Top":"Bottom";if((parseFloat(n[`border${i}Width`])||0)>0||(parseFloat(n[`padding${i}`])||0)>0)continue;let a=e,s=t;for(;a&&s;){let l=os(a,o);if(!l)break;let c=r?Array.from(s.children).find(p=>r.get(p)===l)||null:s.children[Array.from(a.children).indexOf(l)]||null,d=getComputedStyle(l),u=parseFloat(d[`margin${i}`])||0;if(c&&c.style&&u>0&&(c.style[`margin${i}`]="0px"),rn(d)||(parseFloat(d[`border${i}Width`])||0)>0||(parseFloat(d[`padding${i}`])||0)>0)break;a=l,s=c}}}function as(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT),r=[];for(;t.nextNode();)r.push(t.currentNode);for(let n of r)n.remove()}function ss(e,t={}){let{stripFrameworkDirectives:r=!0}=t,n=new Set(["xml","xlink"]),o=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;o.nextNode();){let i=o.currentNode;for(let a of Array.from(i.attributes)){let s=a.name;if(s.startsWith("*")){i.removeAttribute(s);continue}if(s.includes("@")){i.removeAttribute(s);continue}if(s.includes(":")){let l=s.split(":",1)[0];if(!n.has(l)){i.removeAttribute(s);continue}}if(r&&(s.startsWith("x-")||s.startsWith("v-")||s.startsWith(":")||s.startsWith("on:")||s.startsWith("bind:")||s.startsWith("let:")||s.startsWith("class:"))){i.removeAttribute(s);continue}}}}var nn=/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/g;function ls(e){if(!e)return;let t=o=>{if(o.nodeType===Node.ELEMENT_NODE){if(o.attributes)for(let i of Array.from(o.attributes)){let a=i.value.replace(nn,"");if(a!==i.value)try{o.setAttribute(i.name,a)}catch{}}}else if(o.nodeType===Node.TEXT_NODE||o.nodeType===Node.CDATA_SECTION_NODE){let i=o.data.replace(nn,"");i!==o.data&&(o.data=i)}};t(e);let r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT),n;for(;n=r.nextNode();)t(n)}function cs(e,t={}){e&&(ss(e,t),as(e),ls(e))}function ds(e){try{let t=e.getAttribute?.("style")||"";return/\b(height|width|block-size|inline-size)\s*:/.test(t)}catch{return!1}}function us(e){return e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof HTMLIFrameElement||e instanceof SVGElement||e instanceof HTMLObjectElement||e instanceof HTMLEmbedElement}function ps(e,t){if(e?.nodeType!==1||ds(e)||us(e))return!1;let r=t.position;if(r==="absolute"||r==="fixed"||r==="sticky")return!1;let n=t.display||"";return!(n.includes("flex")||n.includes("grid")||n.startsWith("table")||t.transform&&t.transform!=="none")}function hs(e,t,r=new Map){function n(o,i){if(o?.nodeType!==1||i?.nodeType!==1)return;let a=o.childElementCount>i.childElementCount,s=r.get(o)||getComputedStyle(o);if(r.has(o)||r.set(o,s),a&&ps(o,s)){i.style.height||(i.style.height="auto"),i.style.width||(i.style.width="auto"),i.style.removeProperty("block-size"),i.style.removeProperty("inline-size"),i.style.minHeight||(i.style.minHeight="0"),i.style.minWidth||(i.style.minWidth="0"),i.style.maxHeight||(i.style.maxHeight="none"),i.style.maxWidth||(i.style.maxWidth="none");let d=s.overflowY||s.overflowBlock||"visible",u=s.overflowX||s.overflowInline||"visible";(d!=="visible"||u!=="visible")&&(i.style.overflow="visible")}let l=Array.from(o.children),c=Array.from(i.children);for(let d=0;d<Math.min(l.length,c.length);d++)n(l[d],c[d])}n(e,t)}function fs(e){let t=getComputedStyle(e);return!(t.display==="none"||t.position==="absolute"||t.position==="fixed")}function ms(e,t){if(e?.nodeType!==1)return!1;if(e.getAttribute("data-capture")==="exclude"&&t?.excludeMode==="remove")return!0;if(Array.isArray(t?.exclude))for(let r of t.exclude)try{if(e.matches(r))return t.excludeMode==="remove"}catch(n){j(t,"exclude selector match failed",n)}if(typeof t?.filter=="function"&&t.filterMode==="remove")try{if(!t.filter(e))return!0}catch(r){j(t,"filter function failed",r)}return!1}function gs(e,t){let r=getComputedStyle(e),n=e.getBoundingClientRect(),o=1/0,i=-1/0,a=!1,s=Array.from(e.children);for(let h of s){if(ms(h,t)||!fs(h))continue;let f=h.getBoundingClientRect(),m=f.top-n.top,y=f.bottom-n.top;y<=m||(m<o&&(o=m),y>i&&(i=y),a=!0)}let l=a?Math.max(0,i-o):0,c=parseFloat(r.borderTopWidth)||0,d=parseFloat(r.borderBottomWidth)||0,u=parseFloat(r.paddingTop)||0,p=parseFloat(r.paddingBottom)||0;return c+d+u+p+l}var A=(e,t=3)=>Number.isFinite(e)?Math.round(e*10**t)/10**t:e,Te=.75;function ys(e,t,r,n,o,i){let a=e.ownerDocument||document,s=e.getBoundingClientRect(),l=o>0&&s.width>0?s.width/o:1,c=i>0&&s.height>0?s.height/i:1;if(Math.abs(l-c)>.02)return 0;let d=a.createElement("div");d.setAttribute("data-snapdom-internal",""),d.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;width:"+o+"px!important;overflow:visible!important;visibility:hidden!important;";let u=d.attachShadow({mode:"open"}),p=a.createElement("style");p.textContent=r,u.appendChild(p);let h=t.cloneNode(!0);u.appendChild(h),a.body.appendChild(d);let f=0,m=(y,b,x)=>{let v=_(y),g=v.boxSizing==="border-box",w=(k,M,...S)=>{let E=parseFloat(k);if(!Number.isFinite(E))return M;let $=E+(g?0:S.reduce((R,T)=>R+(parseFloat(T)||0),0));return Math.abs($-M)<=.51?$:M};return{width:w(v.width,b,v.paddingLeft,v.paddingRight,v.borderLeftWidth,v.borderRightWidth),height:w(v.height,x,v.paddingTop,v.paddingBottom,v.borderTopWidth,v.borderBottomWidth)}};try{let y=h.getBoundingClientRect(),b=h.offsetWidth||o,x=h.offsetHeight||i,v=b>0&&y.width>0?y.width/b:1,g=x>0&&y.height>0?y.height/x:1,w=(k,M,S=!1)=>{let E=k.children,$=M.children,R=Math.min(E.length,$.length);for(let T=0;T<R;T++){let D=E[T],F=$[T],O=n.get(D),L=S||Yn.has(D);if(O?.nodeType===1&&D?.namespaceURI===Zt&&D.style&&O.isConnected){let I=O.getBoundingClientRect();if(I.width>0&&I.height>0){let X=F.getBoundingClientRect(),U=I.width/l,V=I.height/c,Q=X.width,P=X.height,B=O.offsetWidth||U,W=O.offsetHeight||V,q=F.offsetWidth||Q,ce=F.offsetHeight||P,K=Math.abs(U-B)>Te||Math.abs(V-W)>Te||Math.abs(Q-q)>Te||Math.abs(P-ce)>Te;if(L){let J=m(F,q,ce);U=Q>0?U*v*J.width/Q:U,V=P>0?V*g*J.height/P:V,Q=J.width,P=J.height}else if(K){let J=m(O,B,W),fe=m(F,q,ce);U=J.width,V=J.height,Q=fe.width,P=fe.height}let te=Q-U,oe=P-V;(Math.abs(te)>Te||Math.abs(oe)>Te)&&(D.style.boxSizing="border-box",D.style.width=`${A(U)}px`,D.style.height=`${A(V)}px`,f++)}}w(D,F,L)}};w(t,h)}finally{d.remove()}return f}var bs=/::-webkit-scrollbar(-[a-z]+)?\b/i;function tr(e,t=new Set){let r="";if(!e)return r;for(let n=0;n<e.length;n++){let o=e[n];try{if(o.type===CSSRule.IMPORT_RULE&&o.styleSheet){r+=tr(o.styleSheet.cssRules,t);continue}if(o.type===CSSRule.MEDIA_RULE&&o.cssRules){let i=tr(o.cssRules,t);i&&(r+=`@media ${o.conditionText}{${i}}`);continue}if(o.type===CSSRule.STYLE_RULE){let i=o.selectorText||"";if(bs.test(i)){let a=o.cssText;a&&!t.has(a)&&(t.add(a),r+=a)}}}catch{}}return r}var on=new WeakMap;function ws(e){let t="";for(let r of e.styleSheets){let n=-1;try{n=r.cssRules?r.cssRules.length:-1}catch{}t+=(r.href||"inline")+":"+n+"|"}return t}function xs(e){if(!e||!e.styleSheets)return"";let t=ws(e),r=on.get(e);if(r&&r.fp===t)return r.css;let n=new Set,o="";for(let i of Array.from(e.styleSheets))try{let a=i.cssRules;a&&(o+=tr(a,n))}catch{}return on.set(e,{fp:t,css:o}),o}Ae();var lt=new Set;async function vs(e,t={}){let r=t.__session||C.session,n={styleMap:r.styleMap,styleCache:r.styleCache,nodeMap:r.nodeMap,options:t},o=null;if(t.clip){let u=Gn(e,t.clip);if(u){n.clip={rect:u,root:e};let p=e.getBoundingClientRect();o={x:u.left-p.left,y:u.top-p.top,width:u.width,height:u.height}}}let i,a="",s="";if(lt.size){let u=(p,h)=>{for(let f=h;f;f=f.assignedSlot||f.parentElement||f.getRootNode()?.host)if(f===p)return!0;return!1};for(;;){let p=[...lt].filter(({root:h})=>u(h,e)||u(e,h)).map(({promise:h})=>h.catch(()=>{}));if(!p.length)break;await Promise.all(p)}}if(!n.clip&&e.isConnected&&e.ownerDocument?.visibilityState!=="hidden")try{let u=e.getBoundingClientRect(),p=e.ownerDocument?.defaultView||window,h=u.right<=0||u.bottom<=0||u.left>=p.innerWidth||u.top>=p.innerHeight,f=[];if(h&&(()=>{let m=[];e.shadowRoot&&m.push(e.shadowRoot);for(let y of e.querySelectorAll("*"))y.shadowRoot&&m.push(y.shadowRoot);for(;m.length;){let y=m.pop(),b=y.host?.localName==="calcite-icon";for(let x of y.querySelectorAll("*")){if(x.shadowRoot&&m.push(x.shadowRoot),!b||x.localName!=="svg")continue;let v=x.querySelectorAll("path");if(!v.length||[...v].some(w=>w.getAttribute("d")?.trim()))continue;let g=x.getBoundingClientRect();g.width&&g.height&&f.push(x)}}})(),f.length){let m=(async()=>{let b=e.style,x=e.hasAttribute("style"),v=new Map,g=(w,k)=>{v.has(w)||v.set(w,{value:b.getPropertyValue(w),priority:b.getPropertyPriority(w)}),b.setProperty(w,k,"important");let M=v.get(w);M.forcedValue=b.getPropertyValue(w),M.forcedPriority=b.getPropertyPriority(w)};try{g("left","0"),g("top","0"),g("right","auto"),g("bottom","auto"),g("margin-top","0"),g("margin-right","0"),g("margin-bottom","0"),g("margin-left","0"),g("transform","none"),g("translate","none"),g("opacity","0"),g("pointer-events","none");let w=e.getBoundingClientRect();if(w.right<=0||w.bottom<=0||w.left>=p.innerWidth||w.top>=p.innerHeight){let S=e.parentElement?.getBoundingClientRect(),E=S&&S.right>0&&S.left<p.innerWidth?Math.max(0,S.left):0,$=S&&S.bottom>0&&S.top<p.innerHeight?Math.max(0,S.top):0;g("position","fixed"),g("left",`${E}px`),g("top",`${$}px`)}await Me(100);let k=Date.now()+1500,M=()=>f.some(S=>{if([...S.querySelectorAll("path")].some($=>$.getAttribute("d")?.trim()))return!1;let E=S.getBoundingClientRect();return E.width&&E.height&&E.right>0&&E.bottom>0&&E.left<p.innerWidth&&E.top<p.innerHeight});for(;Date.now()<k&&M();)await new Promise(S=>setTimeout(S,25));await Me(100)}finally{for(let[w,k]of v)b.getPropertyValue(w)!==k.forcedValue||b.getPropertyPriority(w)!==k.forcedPriority||(k.value?b.setProperty(w,k.value,k.priority):b.removeProperty(w));!x&&!b.length&&e.removeAttribute("style"),await Me(100)}})(),y={root:e,promise:m};lt.add(y);try{await m}finally{lt.delete(y)}}}catch{}let l=_a(e),c=n.clip?()=>{}:ja(e);try{i=await gt(e,n,t)}catch(u){throw console.warn("deepClone failed:",u),u}finally{c(),l()}try{Ba(i)}catch(u){console.warn("inlineExternal defs or symbol failed:",u)}try{await Qt(e,i,n,t)}catch(u){console.warn("inlinePseudoElements failed:",u)}await Yi(i,n);try{let u=i.querySelectorAll("style[data-sd]");for(let p of u)s+=p.textContent||"",p.remove()}catch(u){j(n,"Failed to extract shadow CSS from style[data-sd]",u)}let d=Bo(n.styleMap);a=Array.from(d.entries()).map(([u,p])=>`.${p}{${u}}`).join(""),a=s+"[data-snapdom-has-after]::after,[data-snapdom-has-before]::before{content:none!important;display:none!important}"+a;for(let[u,p]of n.styleMap.entries()){if(u.tagName==="STYLE")continue;if(u.getRootNode&&u.getRootNode()instanceof ShadowRoot){u.setAttribute("style",p.replace(/;/g,"; "));continue}let h=d.get(p);h&&u.classList.add(h);let f=u.style?.backgroundImage,m=u.dataset?.snapdomHasIcon;f&&f!=="none"&&(u.style.backgroundImage=f),m&&(u.style.verticalAlign="middle",u.style.display="inline")}if((n.clip||e.scrollTop||e.scrollLeft)&&i?.nodeType===1)try{let u=n.clip&&o?{x:o.x,y:o.y}:{x:0,y:0};ts(e,i,n.nodeMap,n.styleCache,u)}catch(u){j(n,"freezeViewportPositioned failed",u)}for(let[u,p]of n.nodeMap.entries()){if(n.clip&&p===e)continue;let h=p.scrollLeft,f=p.scrollTop;if((h||f)&&u?.nodeType===1&&u.namespaceURI==="http://www.w3.org/1999/xhtml"){u.style.overflow="hidden",u.style.scrollbarWidth="none",u.style.msOverflowStyle="none";try{let y=u.querySelectorAll("*");for(let b of y){if(b.nodeType!==1||b.namespaceURI!=="http://www.w3.org/1999/xhtml")continue;let x=b.style.position;if(x==="fixed"||x==="absolute"){let v=parseFloat(b.style.top)||0,g=parseFloat(b.style.left)||0;b.style.top=`${v+f}px`,b.style.left=`${g+h}px`,x==="fixed"&&(b.style.position="absolute")}}}catch{}let m=document.createElement("div");for(m.style.all="unset",m.style.transform=`translate(${-h}px, ${-f}px)`,m.style.willChange="transform",m.style.display="inline-block",m.style.width="100%";u.firstChild;)m.appendChild(u.firstChild);u.appendChild(m)}}if(e===n.nodeMap.get(i)){let u=n.styleCache.get(e)||_(e);n.styleCache.set(e,u);let p=Ao(u.transform);i.style.margin="0",i.style.top="auto",i.style.left="auto",i.style.right="auto",i.style.bottom="auto",i.style.animation="none",i.style.transition="none",i.style.willChange="auto",i.style.float="none",i.style.clear="none",i.style.transform=p||""}for(let[u,p]of n.nodeMap.entries())p.tagName==="PRE"&&(u.style.marginTop="0",u.style.marginBlockStart="0");return{clone:i,classCSS:a,styleCache:n.styleCache,nodeMap:n.nodeMap,reconcileRisk:n.reconcileRisk||0,clipWindow:o}}$e();ne();var Qn="http://www.w3.org/1999/xlink";function Ss(e){return e.getAttribute("href")||e.getAttribute("xlink:href")||(typeof e.getAttributeNS=="function"?e.getAttributeNS(Qn,"href"):null)}function ks(e){let t=parseInt(e.dataset?.snapdomWidth||"",10)||0,r=parseInt(e.dataset?.snapdomHeight||"",10)||0,n=parseInt(e.getAttribute("width")||"",10)||0,o=parseInt(e.getAttribute("height")||"",10)||0,i=parseFloat(e.style?.width||"")||0,a=parseFloat(e.style?.height||"")||0,s=t||i||n||e.width||e.naturalWidth||100,l=r||a||o||e.height||e.naturalHeight||100;return{width:s,height:l}}async function Cs(e,t={}){let r=Array.from(e.querySelectorAll("img"));e.tagName==="IMG"&&r.unshift(e);let n=async s=>{if(!s.getAttribute("src")){let f=s.currentSrc||s.src||kt(s.getAttribute("srcset"),s)||"";f&&s.setAttribute("src",f)}s.removeAttribute("srcset"),s.removeAttribute("sizes");let l=s.src||"";if(!l)return;let c=C.image?.get(l);if(c){s.src=c,s.width||(s.width=s.naturalWidth||100),s.height||(s.height=s.naturalHeight||100);return}let d=await le(l,{as:"dataURL",useProxy:t.useProxy});if(d.ok&&typeof d.data=="string"&&d.data.startsWith("data:")){C.image?.set(l,d.data),s.src=d.data,s.width||(s.width=s.naturalWidth||100),s.height||(s.height=s.naturalHeight||100);return}let{width:u,height:p}=ks(s),{fallbackURL:h}=t||{};if(h)try{let f=typeof h=="function"?await h({width:u,height:p,src:l,element:s}):h;if(f){let m=await le(f,{as:"dataURL",useProxy:t.useProxy});if(m?.ok&&typeof m.data=="string"){s.src=m.data,s.width||(s.width=u),s.height||(s.height=p);return}}}catch{}if(t.placeholders!==!1){let f=document.createElement("div");f.style.cssText=[`width:${u}px`,`height:${p}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${p}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),f.textContent="img",s.replaceWith(f)}else{let f=document.createElement("div");f.style.cssText=`display:inline-block;width:${u}px;height:${p}px;visibility:hidden;`,s.replaceWith(f)}},o=6;for(let s=0;s<r.length;s+=o){let l=r.slice(s,s+o).map(n);await Promise.allSettled(l)}let i=Array.from(e.querySelectorAll("image"));e.localName==="image"&&i.unshift(e);let a=async s=>{let l=Ss(s);if(!l||l.startsWith("data:")||l.startsWith("blob:"))return;let c=await le(l,{as:"dataURL",useProxy:t.useProxy});c.ok&&typeof c.data=="string"&&c.data.startsWith("data:")&&(s.setAttribute("href",c.data),s.removeAttribute("xlink:href"),typeof s.removeAttributeNS=="function"&&s.removeAttributeNS(Qn,"href"))};for(let s=0;s<i.length;s+=o){let l=i.slice(s,s+o).map(a);await Promise.allSettled(l)}}de();ne();var Ms=["background-image","mask","mask-image","-webkit-mask","-webkit-mask-image","mask-source","mask-box-image-source","mask-border-source","-webkit-mask-box-image-source","border-image","border-image-source"],Es=["mask-position","mask-size","mask-repeat","mask-mode","mask-composite","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","-webkit-mask-composite","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],$s=["background-position","background-position-x","background-position-y","background-size","background-repeat","background-origin","background-clip","background-attachment","background-blend-mode"],As=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];async function Rs(e,t,r,n){let o=r.get(e)||_(e);r.has(e)||r.set(e,o);let i=o.getPropertyValue("border-image"),a=o.getPropertyValue("border-image-source"),s=i&&i!=="none"||a&&a!=="none",l=o.getPropertyValue("background-image"),c=o.getPropertyValue("background-color");if(l&&l!=="none"||c&&c!=="rgba(0, 0, 0, 0)"&&c!=="transparent"||/url\s*\(|gradient\s*\(/i.test(o.getPropertyValue("background")||""))for(let d of $s){let u=o.getPropertyValue(d);u&&t.style.setProperty(d,u)}for(let d of Ms){let u=o.getPropertyValue(d);if(d==="background-image"&&(!u||u==="none")){let f=o.getPropertyValue("background");f&&/url\s*\(/.test(f)&&(u=Bt(f).filter(m=>/url\s*\(/.test(m)).join(", ")||u)}if(!u||u==="none")continue;let p=Bt(u),h=await Promise.all(p.map(f=>un(f,n)));h.some(f=>f&&f!=="none"&&!/^url\(undefined/.test(f))&&t.style.setProperty(d,h.join(", "))}for(let d of Es){let u=o.getPropertyValue(d);!u||u==="initial"||t.style.setProperty(d,u)}if(s)for(let d of As){let u=o.getPropertyValue(d);!u||u==="initial"||t.style.setProperty(d,u)}}async function Ns(e,t,r,n={},o=C.session.nodeMap){if(!t)return;let i=[];e&&Ir(e)&&i.push([e,t]);let a=[t];for(;a.length;){let l=a.pop();if(l.children)for(let c of l.children){if(c.tagName==="STYLE")continue;let d=o.get(c);d&&Ir(d)&&i.push([d,c]),a.push(c)}}let s=6;for(let l=0;l<i.length;l+=s)await Promise.allSettled(i.slice(l,l+s).map(([c,d])=>Rs(c,d,r,n)))}ne();de();function Ls(e,t,r=C.session.nodeMap){let n=[],o=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(let s=o.currentNode;s;s=o.nextNode()){let l=r.get(s);if(l?.nodeType!==1)continue;let c=_(l),d=c.getPropertyValue("backdrop-filter")||c.getPropertyValue("-webkit-backdrop-filter");d&&d!=="none"&&s!==t&&n.push({cloneEl:s,orig:l,bf:d,path:Ps(t,s)})}if(!n.length)return;let i=e.getBoundingClientRect(),a=n.map((s,l)=>{let c=t.cloneNode(!0);Fs(c,t,s.orig.getBoundingClientRect(),r),Os(an(c,s.path));for(let d=0;d<l;d++){let u=an(c,n[d].path);u&&(u.style.setProperty("backdrop-filter","none","important"),u.style.setProperty("-webkit-backdrop-filter","none","important"))}return{...s,copy:c}});for(let{cloneEl:s,orig:l,bf:c,copy:d}of a)Ts(s,l,c,d,i)}function Ts(e,t,r,n,o){let i=t.getBoundingClientRect();if(!i.width||!i.height)return;let a=_(t),s=t.offsetWidth?i.width/t.offsetWidth:1,l=Math.abs(s-1)>.001?1/s:1;n.style.position="absolute",n.style.left=`${(o.left-i.left)*l}px`,n.style.top=`${(o.top-i.top)*l}px`,n.style.width=`${o.width}px`,n.style.height=`${o.height}px`,n.style.margin="0",n.style.filter=r,l!==1&&(n.style.transform=`scale(${l})`,n.style.transformOrigin="top left");let c=document.createElement("div");c.style.cssText="position:absolute;inset:0;overflow:hidden;border-radius:inherit;z-index:-2",c.appendChild(n);let d=document.createElement("div");d.style.cssText="position:absolute;inset:0;border-radius:inherit;z-index:-1",d.style.backgroundColor=a.backgroundColor,d.style.backgroundImage=e.style.backgroundImage||a.backgroundImage;for(let u of["background-size","background-position","background-repeat","background-origin","background-clip"])d.style.setProperty(u,a.getPropertyValue(u));e.style.setProperty("background-color","transparent","important"),e.style.setProperty("background-image","none","important"),e.style.setProperty("backdrop-filter","none","important"),e.style.setProperty("-webkit-backdrop-filter","none","important"),a.position==="static"&&(e.style.position="relative"),e.style.isolation="isolate",e.prepend(d),e.prepend(c)}var ct=128;function Fs(e,t,r,n){let o=[[e,t]];for(;o.length;){let[i,a]=o.pop(),s=n.get(a);if(s?.nodeType===1){let d=s.getBoundingClientRect();(d.left>r.right+ct||d.right<r.left-ct||d.top>r.bottom+ct||d.bottom<r.top-ct)&&(i.tagName==="IMG"&&i.setAttribute("src","data:image/gif;base64,R0lGODlhAQABAAAAACwAAAAAAQABAAA="),i.style&&(i.style.backgroundImage="none"))}let l=i.children,c=a.children;for(let d=0;d<l.length;d++)o.push([l[d],c[d]])}}function Ps(e,t){let r=[];for(let n=t;n!==e;n=n.parentElement){if(!n?.parentElement)return null;r.push([...n.parentElement.children].indexOf(n))}return r.reverse()}function an(e,t){if(!t)return null;let r=e;for(let n of t)if(r=r.children[n],!r)return null;return r}function Os(e){if(e)for(let t=e;t&&t.parentNode;){let r=t.parentNode;for(;t.nextSibling;)t.nextSibling.remove();t===e&&t.remove(),t=r}}de();ne();function Is(e,t){if(!e)return()=>{};let r=[],n=200;function o(i){if(t){let c=i.getBoundingClientRect();if(c.width>0||c.height>0){let d=Math.max(c.right,c.left+(i.scrollWidth||0)),u=Math.max(c.bottom,c.top+(i.scrollHeight||0));if(d<t.left-n||c.left>t.right+n||u<t.top-n||c.top>t.bottom+n)return}}let a=getComputedStyle(i),s=Ds(i,a);s&&r.push(s);let l=Ws(i,a);l&&r.push(l);for(let c of i.children||[])o(c)}return o(e),()=>r.forEach(i=>i())}function Ds(e,t){if(!e)return()=>{};t=t||getComputedStyle(e);let r=Hs(t);if(r<=0)return()=>{};if(!Zn(e))return()=>{};let n=Jn(e),o=n.text,i=_s(t);n.write("X");let a=e.scrollHeight-i;n.restore();let s=a>0?a:Bs(t),l=Math.round(s*r+i);if(e.scrollHeight<=l+.5)return()=>{};let c=0,d=o.length,u=-1;for(;c<=d;){let p=c+d>>1;n.write(o.slice(0,p)+"\u2026"),e.scrollHeight<=l+.5?(u=p,c=p+1):d=p-1}return n.write((u>=0?o.slice(0,u):"")+"\u2026"),()=>{n.restore()}}function Ws(e,t){if(!e)return()=>{};if(t=t||getComputedStyle(e),t.textOverflow!=="ellipsis")return()=>{};if(t.whiteSpace!=="nowrap"&&t.whiteSpace!=="pre")return()=>{};if(t.overflowX!=="hidden"&&t.overflowX!=="clip")return()=>{};if(!Zn(e))return()=>{};if(e.scrollWidth<=e.clientWidth+.5)return()=>{};let r=Jn(e),n=r.text,o=0,i=n.length,a=-1;for(;o<=i;){let s=o+i>>1;r.write(n.slice(0,s)+"\u2026"),e.scrollWidth<=e.clientWidth+.5?(a=s,o=s+1):i=s-1}return r.write((a>=0?n.slice(0,a):"")+"\u2026"),()=>{r.restore()}}function Jn(e){let t=[];for(let n=e.firstChild;n;n=n.nextSibling)n.nodeType===Node.TEXT_NODE&&t.push(n);let r=t.map(n=>n.data);return{text:r.join(""),write(n){t[0].data=n;for(let o=1;o<t.length;o++)t[o].data=""},restore(){for(let n=0;n<t.length;n++)t[n].data=r[n]}}}function Hs(e){let t=e.getPropertyValue("-webkit-line-clamp")||e.getPropertyValue("line-clamp");t=(t||"").trim();let r=parseInt(t,10);return Number.isFinite(r)&&r>0?r:0}function Bs(e){let t=(e.lineHeight||"").trim(),r=parseFloat(e.fontSize)||16;return!t||t==="normal"?Math.round(r*1.2):t.endsWith("px")?parseFloat(t):/^\d+(\.\d+)?$/.test(t)?Math.round(parseFloat(t)*r):t.endsWith("%")?Math.round(parseFloat(t)/100*r):Math.round(r*1.2)}function _s(e){return(parseFloat(e.paddingTop)||0)+(parseFloat(e.paddingBottom)||0)}function Zn(e){return e.childElementCount>0?!1:Array.from(e.childNodes).some(t=>t.nodeType===Node.TEXT_NODE)}var Be=[];function Nt(e){if(!e)return null;if(Array.isArray(e)){let[t,r]=e;return typeof t=="function"?t(r):t}if(typeof e=="object"&&"plugin"in e){let{plugin:t,options:r}=e;return typeof t=="function"?t(r):t}return typeof e=="function"?e():e}function js(...e){let t=e.flat();for(let r of t){let n=Nt(r);n&&(Be.some(o=>o&&o.name&&n.name&&o.name===n.name)||Be.push(n))}}function eo(e){return e&&Array.isArray(e.plugins)?e.plugins:Be}async function ke(e,t,r){let n=r,o=eo(t);for(let i of o){let a=i&&typeof i[e]=="function"?i[e]:null;if(!a)continue;let s=await a(t,n);typeof s<"u"&&(n=s)}return n}async function Us(e,t,r){let n=[],o=eo(t);for(let i of o){let a=i&&typeof i[e]=="function"?i[e]:null;if(!a)continue;let s=await a(t,r);typeof s<"u"&&n.push(s)}return n}function qs(e){let t=[];if(Array.isArray(e))for(let r of e){let n=Nt(r);if(!n||!n.name)continue;let o=t.findIndex(i=>i&&i.name===n.name);o>=0&&t.splice(o,1),t.push(n)}for(let r of Be)r&&r.name&&!t.some(n=>n.name===r.name)&&t.push(r);return Object.freeze(t)}function zs(e,t,r=!1){return!e||e.plugins&&!r||(e.plugins=qs(t)),e}function to(){return Be.slice()}ne();var Vs=.92,Xs=.95;async function Ys(e){let t=new Image;if(t.decoding="sync",t.src=e,typeof t.decode=="function")try{return await t.decode(),t}catch{}return await new Promise((r,n)=>{t.onload=()=>r(),t.onerror=n}),t}function Gs(e){let t=/^data:([^;,]+)/.exec(e);return t?t[1]:""}async function pr(e,t,r){if(typeof e!="string"||!e.startsWith("data:image")||e.startsWith("data:image/svg"))return null;let n=e.length+":"+e.slice(0,64)+e.slice(-64)+":"+Math.round(t)+"x"+Math.round(r);if(C.compress.has(n))return C.compress.get(n);let o=await(async()=>{let i;try{i=await Ys(e)}catch{return null}let a=i.naturalWidth||i.width,s=i.naturalHeight||i.height;if(!a||!s)return null;let l=Math.min(1,Math.max(t/a,r/s));if(!(l>0)||l>=.95)return null;let c=l*Xs,d=Math.max(1,Math.round(a*c)),u=Math.max(1,Math.round(s*c)),p=document.createElement("canvas");p.width=d,p.height=u;let h=p.getContext("2d");if(!h)return null;h.imageSmoothingEnabled=!0,h.imageSmoothingQuality="high",h.drawImage(i,0,0,d,u);let f=Gs(e),m=f==="image/jpeg"?"image/jpeg":f==="image/webp"?"image/webp":"image/png";try{let y=p.toDataURL(m,Vs);if(typeof y=="string"&&y.startsWith("data:image")&&y.length<e.length)return y}catch{}return null})();return C.compress.set(n,o),o}async function Ks(e,t){if(!t.compress)return{count:0,before:0,after:0};let r=(t.scale||1)*(t.dpr||1),n=Array.from(e.querySelectorAll("img"));e.tagName==="IMG"&&n.unshift(e);let o=0,i=0,a=0,s=async c=>{let d=c.getAttribute("src")||"";if(!d.startsWith("data:image")||d.startsWith("data:image/svg"))return;let u=parseFloat(c.dataset.snapdomWidth)||parseFloat(c.style.width)||c.width||0,p=parseFloat(c.dataset.snapdomHeight)||parseFloat(c.style.height)||c.height||0;if(!u||!p)return;let h=await pr(d,u*r,p*r);h&&(o++,i+=d.length,a+=h.length,c.setAttribute("src",h))},l=6;for(let c=0;c<n.length;c+=l)await Promise.allSettled(n.slice(c,c+l).map(s));return{count:o,before:i,after:a}}function Qs(e){let t=e.offsetWidth||e.getBoundingClientRect().width||0,r=e.offsetHeight||e.getBoundingClientRect().height||0;return{w:t,h:r}}async function Js(e,t,r=C.session.nodeMap){if(!t.compress)return{count:0};let n=(t.scale||1)*(t.dpr||1),o=[],i=[e,...e.querySelectorAll("*")];for(let c of i){let d=c.style&&c.style.backgroundImage;d&&d.includes("data:image")&&o.push(c)}let a=0,s=async c=>{let d=r.get(c);if(!d||!d.isConnected)return;let u;try{u=getComputedStyle(d)}catch{return}if((u.backgroundRepeat||"repeat").toLowerCase().split(",").some(v=>v.trim()!=="no-repeat"))return;let{w:p,h}=Qs(d);if(!p||!h)return;let f=p*n,m=h*n,y=c.style.backgroundImage,b=[...y.matchAll(/url\((['"]?)(data:image\/[^)'"]+)\1\)/gi)],x=y;for(let v of b){let g=v[2];if(g.startsWith("data:image/svg"))continue;let w=await pr(g,f,m);w&&(x=x.split(g).join(w),a++)}x!==y&&(c.style.backgroundImage=x)},l=6;for(let c=0;c<o.length;c+=l)await Promise.allSettled(o.slice(c,c+l).map(s));return{count:a}}async function Zs(e,t){if(!t.compress)return{count:0};let r=(t.scale||1)*(t.dpr||1),n=Array.from(e.querySelectorAll("image"));e.localName==="image"&&n.unshift(e);let o=0,i=async s=>{let l=s.getAttribute("href")||(typeof s.getAttributeNS=="function"?s.getAttributeNS("http://www.w3.org/1999/xlink","href"):null);if(!l||!l.startsWith("data:image")||l.startsWith("data:image/svg"))return;let c=parseFloat(s.getAttribute("width"))||0,d=parseFloat(s.getAttribute("height"))||0;if(!c||!d)return;let u=await pr(l,c*r,d*r);u&&(s.setAttribute("href",u),s.hasAttribute("xlink:href")&&s.setAttribute("xlink:href",u),o++)},a=6;for(let s=0;s<n.length;s+=a)await Promise.allSettled(n.slice(s,s+a).map(i));return{count:o}}async function el(e,t,r){t.compress&&(await Ks(e,t),await Js(e,t,r),await Zs(e,t))}function tl(e){if(Array.isArray(e.plugins)){for(let t of e.plugins)if(Nt(t)?.name==="picture-resolver")return!0}return to().some(t=>t?.name==="picture-resolver")}function rl(e){let t=Array.isArray(e.plugins)?e.plugins:to(),r=[];for(let n of t){let o=Nt(n);o&&typeof o.resolveNode=="function"&&r.push(o.resolveNode.bind(o))}return r.length?r:null}var nl=2e3,ol=3;function il(e){let t=Date.now(),r=C.burstAdvice.get(e);if(!r||t-r.firstTs>nl){C.burstAdvice.set(e,{count:1,firstTs:t,warned:!1});return}r.count++,r.count>=ol&&!r.warned&&(r.warned=!0,console.warn("[snapdom] Captured this element multiple times. Pass { burst: true } to increase the speed."))}async function al(e,t){if(!e)throw new Error("Element cannot be null or undefined");$o(t.cache),t.__session={styleMap:C.session.styleMap,styleCache:C.session.styleCache,nodeMap:C.session.nodeMap},t.burst||il(e),t.__resolveNodeHooks=rl(t);let r=t.fast,n=t.outerTransforms!==!1,o=!!t.outerShadows,i=t.clip?Gn(e,t.clip):null,a={element:e,options:t,plugins:t.plugins},s,l,c,d,u,p,h="",f="",m,y,b=null;await ke("beforeSnap",a);let x=null;t.resolvePicturePlaceholders!==!1&&!tl(t)&&(x=await Ai(a.element,a.options)),await ke("beforeClone",a);let v=Is(a.element,i);try{({clone:s,classCSS:l,styleCache:c,nodeMap:d,reconcileRisk:u,clipWindow:p}=await vs(a.element,a.options)),u>0&&!t.reconcile&&!C.warnedReconcile&&(C.warnedReconcile=!0,console.warn("[snapdom] Text in inline/table-cell elements kept its natural width and may re-wrap under font-fallback rasterization. Pass { reconcile: true } for pixel-exact layout (roughly doubles capture time).")),!n&&s&&(b=Ya(a.element,s)),!o&&s&&rs(a.element,s,a.options),s&&(is(a.element,s,d),ns(a.element,s))}finally{v()}if(a={clone:s,classCSS:l,styleCache:c,nodeMap:d,...a},await ke("afterClone",a),x&&await x(),cs(a.clone),a.options?.excludeMode==="remove"||a.options?.filterMode==="remove")try{hs(a.element,a.clone,a.styleCache)}catch(R){console.warn("[snapdom] shrink pass failed:",R)}try{await pa(a.clone,a.element,a.nodeMap)}catch{}let g=R=>new Promise((T,D)=>{ut(()=>{Promise.resolve().then(R).then(T,D)},{fast:r})}),w=(async()=>{await Promise.all([g(()=>Cs(a.clone,a.options)),g(()=>Ns(a.element,a.clone,a.styleCache,a.options,a.nodeMap))]);try{Ls(a.element,a.clone,a.nodeMap)}catch(R){console.warn("[snapdom] backdrop-filter emulation failed:",R)}t.compress&&await g(()=>el(a.clone,a.options,a.nodeMap))})(),k=Promise.resolve();t.embedFonts&&(k=g(async()=>{let R=a.element.ownerDocument||document,T=i?O=>{try{let L=O.getBoundingClientRect();return L.right>=i.left-200&&L.left<=i.right+200&&L.bottom>=i.top-200&&L.top<=i.bottom+200}catch{return!0}}:null,{required:D,usedCodepoints:F}=qn(a.element,T);if(we()){let O=new Set(Array.from(D).map(L=>String(L).split("__")[0]).filter(Boolean));await zn(O,1,R)}h=await Na({required:D,usedCodepoints:F,preCached:!1,exclude:a.options.excludeFonts,localFonts:a.options.localFonts,useProxy:a.options.useProxy,fontStylesheetDomains:a.options.fontStylesheetDomains,doc:R})})),await Promise.all([w,k]);let M=Wo(a.clone).sort(),S=M.join(",");C.baseStyle.has(S)?f=C.baseStyle.get(S):await new Promise(R=>{ut(()=>{f=Ho(M),C.baseStyle.set(S,f),R()},{fast:r})});let E=xs(a.element?.ownerDocument||document);a={fontsCSS:h,baseCSS:f,scrollbarCSS:E,...a},await ke("beforeRender",a),await new Promise(R=>{ut(()=>{let T=_(a.element),D=a.element.getBoundingClientRect(),F=Math.max(1,A(a.element.offsetWidth||parseFloat(T.width)||D.width||1)),O=Math.max(1,A(a.element.offsetHeight||parseFloat(T.height)||D.height||1)),L=a.element.ownerDocument||document;if(!p&&(a.element===L.body||a.element===L.documentElement)&&!L.documentElement.hasAttribute("data-sd-pinned")){let z=Math.max(a.element.scrollHeight||0,L.documentElement?.scrollHeight||0,L.body?.scrollHeight||0),Z=Math.max(a.element.scrollWidth||0,L.documentElement?.scrollWidth||0,L.body?.scrollWidth||0);z>0&&(O=Math.max(O,A(z))),Z>0&&(F=Math.max(F,A(Z)));try{let Y=(a.scrollbarCSS||"").length+(a.baseCSS||"").length+(a.fontsCSS||"").length+(a.classCSS||"").length,ie=C.measureHints.get(a.element);if(ie&&ie.cssLen===Y&&ie.w0===F)ie.csh>0&&(O=Math.max(O,A(ie.csh))),ie.csw>0&&(F=Math.max(F,A(ie.csw)));else{let G=L.createElement("div");G.setAttribute("data-snapdom-internal",""),G.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;width:"+F+"px!important;overflow:visible!important;visibility:hidden!important;";let ue=G.attachShadow({mode:"open"}),et=L.createElement("style");et.textContent=(a.scrollbarCSS||"")+a.baseCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+a.classCSS,ue.appendChild(et),ue.appendChild(a.clone.cloneNode(!0)),L.body.appendChild(G);let ve=G.scrollHeight,Tt=G.scrollWidth;L.body.removeChild(G),C.measureHints.set(a.element,{cssLen:Y,w0:F,csh:ve,csw:Tt}),ve>0&&(O=Math.max(O,A(ve))),Tt>0&&(F=Math.max(F,A(Tt)))}}catch{}}if(a.options?.excludeMode==="remove"||a.options?.filterMode==="remove"){let z=gs(a.element,a.options);Number.isFinite(z)&&z>0&&(O=Math.max(1,Math.min(O,A(z+1))))}if(a.options?.reconcile)try{let z=(a.scrollbarCSS||"")+a.baseCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+a.classCSS;ys(a.element,a.clone,z,a.nodeMap,F,O)}catch(z){console.warn("[snapdom] reconcile pass failed:",z)}let I=(z,Z=NaN)=>{let Y=typeof z=="string"?parseFloat(z):z;return Number.isFinite(Y)?Y:Z},X=I(a.options.width),U=I(a.options.height),V=p?A(p.width):F,Q=p?A(p.height):O,P=V,B=Q,W=Number.isFinite(X),q=Number.isFinite(U),ce=Q>0?V/Q:1;W&&q?(P=Math.max(1,A(X)),B=Math.max(1,A(U))):W?(P=Math.max(1,A(X)),B=Math.max(1,A(P/(ce||1)))):q&&(B=Math.max(1,A(U)),P=Math.max(1,A(B*(ce||1))));let K=0,te=0,oe=F,J=O;if(p){let z=0,Z=0;if(Dt(a.element)){let Y=null;if(!n&&b&&Number.isFinite(b.a))Y={a:b.a,b:b.b||0,c:b.c||0,d:b.d||1,e:0,f:0};else{let ie=Mt(a.element),G=Kn(T.transform&&T.transform!=="none"?T.transform:"",ie);G&&G.is2D&&(Y={a:G.a,b:G.b,c:G.c,d:G.d,e:0,f:0})}if(Y&&!(Y.a===1&&Y.b===0&&Y.c===0&&Y.d===1)){let{ox:ie,oy:G}=Jt(T,F,O),ue=wt(F,O,Y,ie,G);z=ue.minX,Z=ue.minY}}K=A(p.x+z),te=A(p.y+Z),oe=A(K+p.width),J=A(te+p.height)}else if(!n&&b&&Number.isFinite(b.a)){let z={a:b.a,b:b.b||0,c:b.c||0,d:b.d||1,e:0,f:0},Z=wt(F,O,z,0,0);K=A(Z.minX),te=A(Z.minY),oe=A(Z.maxX),J=A(Z.maxY)}else if(n&&Dt(a.element)){let z=T.transform&&T.transform!=="none"?T.transform:"",Z=Mt(a.element),Y=Ka({baseTransform:z,rotate:Z.rotate||"0deg",scale:Z.scale,translate:Z.translate}),{ox:ie,oy:G}=Jt(T,F,O),ue=Y.is2D?Y:new DOMMatrix(Y.toString()),et={a:ue.a,b:ue.b,c:ue.c,d:ue.d,e:0,f:0},ve=wt(F,O,et,ie,G);K=A(ve.minX),te=A(ve.minY),oe=A(ve.maxX),J=A(ve.maxY)}let fe=Ua(T),Ce=qa(T),ee=za(T),Ve=Va(T),Xe=Xa(T),Ye=p?{top:0,right:0,bottom:0,left:0}:o?{top:A(Math.max(fe.top,Ce.top)+ee.top+Ve.top+Xe.bleed.top),right:A(Math.max(fe.right,Ce.right)+ee.right+Ve.right+Xe.bleed.right),bottom:A(Math.max(fe.bottom,Ce.bottom)+ee.bottom+Ve.bottom+Xe.bleed.bottom),left:A(Math.max(fe.left,Ce.left)+ee.left+Ve.left+Xe.bleed.left)}:{top:ee.top,right:ee.right,bottom:ee.bottom,left:ee.left};K=A(K-Ye.left),te=A(te-Ye.top),oe=A(oe+Ye.right),J=A(J+Ye.bottom);let fr=Math.max(1,A(oe-K)),mr=Math.max(1,A(J-te)),oo=W||q?A(P/V):1,io=q||W?A(B/Q):1,ao=Math.max(1,A(fr*oo)),so=Math.max(1,A(mr*io)),gr="http://www.w3.org/2000/svg",lo=Dt(a.element)?2:0,Re=A(lo+(n?0:1)),Ge=Math.ceil(fr+Re*2),Ke=Math.ceil(mr+Re*2),Qe=A(-(A(K)-Re)),Je=A(-(A(te)-Re)),yr=Math.max(0,Qe),br=Math.max(0,Je),wr=A(Ge-Math.min(0,Qe)),xr=A(Ke-Math.min(0,Je)),xe=document.createElementNS(gr,"foreignObject");xe.setAttribute("x",String(Math.min(0,Qe))),xe.setAttribute("y",String(Math.min(0,Je))),xe.setAttribute("width",String(wr)),xe.setAttribute("height",String(xr)),xe.style.overflow="visible";let vr=document.createElement("style"),co="svg{overflow:visible;} foreignObject{overflow:visible;} foreignObject>div{-webkit-text-size-adjust:100%!important;text-size-adjust:100%!important;}";vr.textContent=(a.scrollbarCSS||"")+a.baseCSS+a.fontsCSS+co+a.classCSS,xe.appendChild(vr);let Ze=document.createElement("div");Ze.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),Ze.style.cssText=`all:initial;box-sizing:border-box;display:block;overflow:visible;width:${wr}px;height:${xr}px`+(yr!==0||br!==0?`;padding:${br}px 0 0 ${yr}px !important`:""),Ze.appendChild(a.clone),xe.appendChild(Ze);let uo=new XMLSerializer().serializeToString(xe),Sr=W||q,po=Object.freeze({w0:V,h0:Q,vbW:Ge,vbH:Ke,targetW:P,targetH:B,contentX:A(Qe+(p?K:0)),contentY:A(Je+(p?te:0)),clip:p?Object.freeze({x:A(K),y:A(te),width:V,height:Q}):null});Object.defineProperty(t,"meta",{value:po,enumerable:!0,writable:!1,configurable:!0});let ho=!Sr||we()?Ge:A(ao+Re*2),fo=!Sr||we()?Ke:A(so+Re*2),mo=parseFloat(_(L.documentElement)?.fontSize)||16;y=`<svg xmlns="${gr}" width="${ho}" height="${fo}" viewBox="0 0 ${Ge} ${Ke}" font-size="${mo}px">`+uo+"</svg>",m=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(y)}`,a={svgString:y,dataURL:m,...a},R()},{fast:r})}),await ke("afterRender",a);let $=document.getElementById("snapdom-sandbox");return $&&$.style.position==="absolute"&&$.remove(),a.dataURL}function Dt(e){return Qa(e)}ne();function sl(e={}){let t=e.format??"png";t==="jpg"&&(t="jpeg");let r=Eo(e.cache);return{debug:e.debug??!1,fast:e.fast??!0,scale:e.scale??1,exclude:e.exclude??[],excludeMode:e.excludeMode??"hide",filter:e.filter??null,filterMode:e.filterMode??"hide",placeholders:e.placeholders!==!1,embedFonts:e.embedFonts??!1,iconFonts:Array.isArray(e.iconFonts)?e.iconFonts:e.iconFonts?[e.iconFonts]:[],localFonts:Array.isArray(e.localFonts)?e.localFonts:[],excludeFonts:e.excludeFonts??void 0,fontStylesheetDomains:Array.isArray(e.fontStylesheetDomains)?e.fontStylesheetDomains:[],fallbackURL:e.fallbackURL??void 0,cache:r,useProxy:typeof e.useProxy=="string"?e.useProxy:"",width:e.width??null,height:e.height??null,format:t,type:e.type??"svg",quality:e.quality??.92,dpr:e.dpr??(window.devicePixelRatio||1),backgroundColor:e.backgroundColor??(["jpeg","webp"].includes(t)?"#ffffff":null),filename:e.filename??"snapDOM",outerTransforms:e.outerTransforms??!0,outerShadows:e.outerShadows??!1,reconcile:e.reconcile??!1,burst:e.burst??!1,invalidate:e.invalidate??!1,clip:e.clip??null,compress:e.compress!==!1,excludeStyleProps:e.excludeStyleProps??null,resolvePicturePlaceholders:e.resolvePicturePlaceholders!==!1,pictureResolver:e.pictureResolver&&typeof e.pictureResolver=="object"?e.pictureResolver:{}}}Ae();Mn();var sn=new WeakMap;function ro(e,t,r){let n=new Set;if(e instanceof HTMLVideoElement&&n.add(e),e.querySelectorAll)for(let o of e.querySelectorAll("video"))n.add(o);for(let o of t.trackedVideos)n.has(o)||(o.removeEventListener("timeupdate",r),o.removeEventListener("seeked",r),t.trackedVideos.delete(o));for(let o of n)t.trackedVideos.has(o)||(o.addEventListener("timeupdate",r),o.addEventListener("seeked",r),t.trackedVideos.add(o))}function ll(e){let t={dirty:!0,capturing:!1,last:null,inflight:Promise.resolve(),observers:[],trackedVideos:new Set},r=i=>{t.capturing||Pn(i)&&(t.dirty=!0)},n=()=>{t.capturing||(t.dirty=!0)},o=e.ownerDocument||document;try{let i=new MutationObserver(r);i.observe(e,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),t.observers.push(i)}catch{}try{if(o.head){let i=new MutationObserver(r);i.observe(o.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0}),t.observers.push(i)}}catch{}return t.markDirty=r,t.onMediaDirty=n,ro(e,t,n),t}function ln(e){let{burst:t,invalidate:r,...n}=e||{};try{return JSON.stringify(n,Object.keys(n).sort())}catch{return null}}function cl(e,t,r,n){let o=sn.get(e);o||(o=ll(e),o.baselineSignature=ln(t),sn.set(e,o));let i=ln(t),a=i===null||i!==o.baselineSignature,s=async()=>{for(let c of o.observers)o.markDirty(c.takeRecords());if(r.invalidate&&(o.dirty=!0),!a&&!o.dirty&&o.last)return o.last;o.capturing=!0,a||(o.dirty=!1);try{let c=await n();return a||(o.last=c),c}finally{for(let c of o.observers)c.takeRecords();o.capturing=!1,ro(e,o,o.onMediaDirty)}},l=o.inflight.then(s,s);return o.inflight=l.catch(()=>{}),l}de();$e();ne();function dl(...e){return js(...e),H}var H=Object.assign(pl,{plugins:dl}),rr=Symbol("snapdom.internal"),ul=Symbol("snapdom.internal.silent");async function pl(e,t){if(!e)throw new Error("Element cannot be null or undefined");let r=sl(t);if(zs(r,t&&t.plugins),we()){if(r.embedFonts===!0)try{let o=La(e),i=new Set([...o].map(a=>String(a).split("__")[0]).filter(Boolean));await zn(i,1)}catch{}let n=Array.from(e.querySelectorAll("canvas"));e.tagName==="CANVAS"&&n.unshift(e);for(let o of n)try{let i=o.getContext("2d",{willReadFrequently:!0});i&&i.getImageData(0,0,1,1)}catch(i){j(t,"safari canvas poke failed",i)}}return r.iconFonts&&r.iconFonts.length>0&&ia(r.iconFonts),r.snap||(r.snap={toPng:(n,o)=>H.toPng(n,o),toSvg:(n,o)=>H.toSvg(n,o)}),r.burst?cl(e,t,r,()=>H.capture(e,r,rr)):H.capture(e,r,rr)}H.capture=async(e,t,r)=>{if(r!==rr)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");t.element=e;let n=await al(e,t),o={img:async(m,y)=>{let{toImg:b}=await Promise.resolve().then(()=>(Fr(),jt));return b(n,{...m,...y||{}})},svg:async(m,y)=>{let{toSvg:b}=await Promise.resolve().then(()=>(Fr(),jt));return b(n,{...m,...y||{}})},canvas:async(m,y)=>{let{toCanvas:b}=await Promise.resolve().then(()=>(je(),En));return b(n,{...m,...y||{}})},blob:async(m,y)=>{let{toBlob:b}=await Promise.resolve().then(()=>(Tn(),Nn));return b(n,{...m,...y||{}})},png:async(m,y)=>{let{rasterize:b}=await Promise.resolve().then(()=>(ft(),ht));return b(n,{...m,...y||{},format:"png"})},jpeg:async(m,y)=>{let{rasterize:b}=await Promise.resolve().then(()=>(ft(),ht));return b(n,{...m,...y||{},format:"jpeg"})},webp:async(m,y)=>{let{rasterize:b}=await Promise.resolve().then(()=>(ft(),ht));return b(n,{...m,...y||{},format:"webp"})},download:async(m,y)=>{let{download:b}=await Promise.resolve().then(()=>(ri(),Fn));return b(n,{...m,...y||{}})}},i={};for(let m of["img","svg","canvas","blob","png","jpeg","webp"])i[m]=async y=>o[m](t,{...y||{},[ul]:!0});i.jpg=i.jpeg;let a={...t,export:{url:n},exports:i},s=await Us("defineExports",a),l=Object.assign({},...s.filter(m=>m&&typeof m=="object").reverse()),c={...o,...l};c.jpeg&&!c.jpg&&(c.jpg=(m,y)=>c.jpeg(m,y));function d(m,y){let b={...t,...y||{}},x=v=>v==="jpeg"||v==="jpg"||v==="webp";return[m,b.format,b.type].map(v=>typeof v=="string"?v.toLowerCase():"").find(x)&&(b.backgroundColor==null||b.backgroundColor==="transparent")&&(b.backgroundColor="#ffffff"),b}let u=!1,p=Promise.resolve();async function h(m,y){let b=Object.freeze(y&&typeof y=="object"?{...y}:{}),x=async()=>{let g=c[m];if(!g)throw new Error(`[snapdom] Unknown export type: ${m}`);let w=d(m,b),k={...t,export:{type:m,options:w,requestedOptions:b,url:n}};await ke("beforeExport",k,{format:m,options:w});let M=await g(k,w);return await ke("afterExport",k,{format:m,options:w,result:M}),u||(u=!0,await ke("afterSnap",t)),M},v=p.then(x);return p=v.catch(()=>{}),v}let f={url:n,toRaw:()=>n,to:(m,y)=>h(m,y),toImg:m=>h("img",m),toSvg:m=>h("svg",m),toCanvas:m=>h("canvas",m),toBlob:m=>h("blob",m),toPng:m=>h("png",m),toJpg:m=>h("jpg",m),toWebp:m=>h("webp",m),download:m=>h("download",m)};Object.defineProperty(f,"meta",{value:t.meta,enumerable:!0,writable:!1,configurable:!1});for(let m of Object.keys(c)){let y="to"+m.charAt(0).toUpperCase()+m.slice(1);f[y]||(f[y]=b=>h(m,b))}return f};H.toRaw=(e,t)=>H(e,t).then(r=>r.toRaw());H.toImg=(e,t)=>H(e,t).then(r=>r.toImg());H.toSvg=(e,t)=>H(e,t).then(r=>r.toSvg());H.toCanvas=(e,t)=>H(e,t).then(r=>r.toCanvas());H.toBlob=(e,t)=>H(e,t).then(r=>r.toBlob());H.toPng=(e,t)=>H(e,{...t,format:"png"}).then(r=>r.toPng());H.toJpg=(e,t)=>H(e,{...t,format:"jpeg"}).then(r=>r.toJpg());H.toWebp=(e,t)=>H(e,{...t,format:"webp"}).then(r=>r.toWebp());H.download=(e,t)=>H(e,t).then(r=>r.download());var Ue=class{constructor(){N(this,"name","BrowserScriptScreenshotDriver")}async captureSelector(t){try{if(typeof document>"u")return{ok:!1,reason:"NO_DOCUMENT_ENVIRONMENT"};let r=document.querySelector(t);return r?await this.captureElement(r):{ok:!1,reason:`ELEMENT_NOT_FOUND: ${t}`}}catch(r){return{ok:!1,reason:r?.message||"UNKNOWN_CAPTURE_ERROR"}}}async captureElement(t){try{if(typeof window>"u"||typeof document>"u")return{ok:!1,reason:"NO_BROWSER_ENVIRONMENT"};let r=t.getBoundingClientRect(),n=Math.max(Math.round(r.width),10),o=Math.max(Math.round(r.height),10),i=(async()=>{try{let s,l="webp";try{if(typeof H=="function"){let c=await H(t,{scale:1,embedFonts:!1});if(c&&typeof c.toWebp=="function")s=await c.toWebp();else if(c&&typeof c.toPng=="function")s=await c.toPng(),l="png";else if(c?.url)return{ok:!0,dataUrl:c.url,format:"webp",width:n,height:o}}else H?.toWebp?s=await H.toWebp(t,{scale:1,embedFonts:!1}):H?.toPng&&(s=await H.toPng(t,{scale:1,embedFonts:!1}),l="png")}catch{}if(s&&s.src)return{ok:!0,dataUrl:s.src,format:s.src.startsWith("data:image/webp")?"webp":l,width:s.naturalWidth||n,height:s.naturalHeight||o}}catch(s){let l=String(s?.message||s);if(l.includes("CORS")||l.includes("SecurityError")||l.includes("tainted"))return{ok:!1,reason:"CROSS_ORIGIN_RESOURCE"}}return await this.captureWithSvgFallback(t,n,o)})(),a=new Promise(s=>{setTimeout(()=>s({ok:!1,reason:"CAPTURE_TIMEOUT"}),3e3)});return await Promise.race([i,a])}catch(r){return{ok:!1,reason:r?.message||"CAPTURE_EXCEPTION"}}}async captureWithSvgFallback(t,r,n){try{let o=t.cloneNode(!0),i=window.getComputedStyle(t),a="";for(let d=0;d<i.length;d++){let u=i[d];a+=`${u}:${i.getPropertyValue(u)};`}o.style.cssText=a,o.style.margin="0",o.style.position="static";let s=`
9
+ <svg xmlns="http://www.w3.org/2000/svg" width="${r}" height="${n}">
10
+ <foreignObject width="100%" height="100%">
11
+ <div xmlns="http://www.w3.org/1999/xhtml" style="width:${r}px;height:${n}px;">
12
+ ${o.outerHTML}
13
+ </div>
14
+ </foreignObject>
15
+ </svg>
16
+ `.trim(),l=new Blob([s],{type:"image/svg+xml;charset=utf-8"}),c=URL.createObjectURL(l);return await new Promise(d=>{let u=new Image;u.onload=()=>{try{let p=document.createElement("canvas");p.width=r,p.height=n;let h=p.getContext("2d");if(!h){URL.revokeObjectURL(c),d({ok:!1,reason:"CANVAS_CONTEXT_UNAVAILABLE"});return}h.drawImage(u,0,0),URL.revokeObjectURL(c);let f;try{f=p.toDataURL("image/webp",.85)}catch{f=p.toDataURL("image/png")}d({ok:!0,dataUrl:f,format:f.startsWith("data:image/webp")?"webp":"png",width:r,height:n})}catch(p){URL.revokeObjectURL(c),p?.name==="SecurityError"||String(p).includes("tainted")?d({ok:!1,reason:"CROSS_ORIGIN_RESOURCE"}):d({ok:!1,reason:p?.message||"CANVAS_EXPORT_FAILED"})}},u.onerror=()=>{URL.revokeObjectURL(c),d({ok:!1,reason:"IMAGE_LOAD_FAILED"})},u.src=c})}catch(o){return{ok:!1,reason:o?.message||"FALLBACK_CAPTURE_FAILED"}}}};var Lt=class{constructor(t){N(this,"wsUrl");N(this,"projectId");N(this,"debug");N(this,"ws",null);N(this,"sessionId",null);N(this,"queue",[]);N(this,"maxQueueSize",50);N(this,"reconnectAttempts",0);N(this,"maxReconnectDelay",1e4);N(this,"reconnectTimer",null);N(this,"commandHandler");N(this,"messageListeners",[]);N(this,"isDestroyed",!1);this.wsUrl=t.url||"ws://127.0.0.1:7331",this.projectId=t.projectId,this.debug=!!t.debug}setCommandHandler(t){this.commandHandler=t}onMessage(t){return this.messageListeners.push(t),()=>{this.messageListeners=this.messageListeners.filter(r=>r!==t)}}getSessionId(){return this.sessionId}isConnected(){return this.ws!==null&&this.ws.readyState===(typeof WebSocket<"u"?WebSocket.OPEN:1)}connect(){if(!(this.isDestroyed||typeof WebSocket>"u")&&!(this.ws&&(this.ws.readyState===WebSocket.CONNECTING||this.ws.readyState===WebSocket.OPEN)))try{this.ws=new WebSocket(this.wsUrl),this.ws.onopen=()=>{this.reconnectAttempts=0,this.sendHello(),this.flushQueue()},this.ws.onmessage=async t=>{try{let r=typeof t.data=="string"?t.data:"";if(!r)return;let n=JSON.parse(r);for(let o of this.messageListeners)try{o(n)}catch{}if(n.type==="hello_ack"){this.sessionId=n.sessionId,this.debug&&console.log("[BrowserTrack] Connected, session ID:",this.sessionId);return}if(n.type==="command"&&this.commandHandler){let o=n.command,i=await this.commandHandler.executeCommand(o);this.send({type:"command_response",sessionId:this.sessionId,response:i})}}catch{}},this.ws.onerror=()=>{},this.ws.onclose=()=>{this.ws=null,this.scheduleReconnect()}}catch{this.scheduleReconnect()}}send(t){let r=JSON.stringify(t);if(this.isConnected())try{this.ws.send(r)}catch{this.enqueue(r)}else this.enqueue(r)}enqueue(t){this.queue.length>=this.maxQueueSize&&this.queue.shift(),this.queue.push(t)}flushQueue(){if(this.isConnected())for(;this.queue.length>0;){let t=this.queue.shift();if(t)try{this.ws.send(t)}catch{this.queue.unshift(t);break}}}sendHello(){if(typeof window>"u")return;let t={type:"hello",origin:window.location.origin,url:window.location.href,title:document.title,userAgent:navigator.userAgent,timestamp:Date.now(),projectId:this.projectId};try{this.ws.send(JSON.stringify(t))}catch{}}scheduleReconnect(){if(this.isDestroyed||this.reconnectTimer)return;this.reconnectAttempts++;let t=Math.min(1e3*Math.pow(1.5,this.reconnectAttempts),this.maxReconnectDelay);this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},t)}destroy(){if(this.isDestroyed=!0,this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.ws){try{this.ws.close()}catch{}this.ws=null}this.queue=[]}};var qe=class{constructor(t,r,n={}){N(this,"transport");N(this,"screenshotDriver");N(this,"options");N(this,"container",null);N(this,"shadowRoot",null);N(this,"highlightOverlay",null);N(this,"regionOverlay",null);N(this,"regionBox",null);N(this,"regionBanner",null);N(this,"markersContainer",null);N(this,"toolbarElement",null);N(this,"modalOverlay",null);N(this,"cardOverlay",null);N(this,"activeMode","idle");N(this,"hoveredElement",null);N(this,"selectedElement",null);N(this,"selectedRegion",null);N(this,"isDraggingRegion",!1);N(this,"dragStartX",0);N(this,"dragStartY",0);N(this,"savedNotes",[]);N(this,"showMarkers",!0);N(this,"cleanups",[]);this.transport=t,this.screenshotDriver=r,this.options={shortcut:"Alt+Click",maskSelectors:['input[type="password"]',"[data-sensitive]"],showToolbar:!0,...n}}init(){if(typeof window>"u"||typeof document>"u")return;document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{this.ensureContainer()}):this.ensureContainer();let t=this.transport.onMessage(r=>{r&&r.type==="notes_sync"&&Array.isArray(r.notes)&&this.syncNotes(r.notes)});this.cleanups.push(t),this.setupListeners()}syncNotes(t){this.savedNotes=t,this.updateToolbarCount(),this.renderMarkers()}setMode(t){this.activeMode=t,this.updateToolbarState(),t==="element"?this.hideRegionOverlay():t==="region"?(this.hideHighlight(),this.showRegionOverlay()):t==="page"?(this.hideRegionOverlay(),this.hideHighlight(),this.openNoteEditor(document.body,"page")):(this.hideRegionOverlay(),this.hideHighlight())}ensureContainer(){if(typeof document>"u")return null;if(!this.container){this.container=document.createElement("div"),this.container.id="browsertrack-inspector-host",this.container.style.cssText="all: initial; position: fixed; top: 0; left: 0; width: 0; height: 0; z-index: 2147483647; pointer-events: none;",this.shadowRoot=this.container.attachShadow({mode:"open"});let t=document.createElement("style");t.textContent=`
17
+ :host {
18
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
19
+ color-scheme: dark;
20
+ -webkit-font-smoothing: antialiased;
21
+ -moz-osx-font-smoothing: grayscale;
22
+ }
23
+
24
+ /* 1. Element Highlight Overlay */
25
+ .bt-highlight {
26
+ position: fixed;
27
+ border: 2px solid #3b82f6;
28
+ background: rgba(59, 130, 246, 0.16);
29
+ border-radius: 4px;
30
+ pointer-events: none;
31
+ transition: all 0.05s ease-out;
32
+ z-index: 2147483640;
33
+ box-sizing: border-box;
34
+ }
35
+
36
+ .bt-badge {
37
+ position: absolute;
38
+ top: -26px;
39
+ left: 0;
40
+ background: #0f172a;
41
+ color: #38bdf8;
42
+ border: 1px solid #3b82f6;
43
+ font-size: 11px;
44
+ font-weight: 600;
45
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
46
+ padding: 2px 7px;
47
+ border-radius: 4px;
48
+ white-space: nowrap;
49
+ pointer-events: none;
50
+ box-shadow: 0 4px 6px -1px rgba(0,0,0,0.5);
51
+ }
52
+
53
+ /* 2. Region Selection Overlay */
54
+ .bt-region-overlay {
55
+ position: fixed;
56
+ inset: 0;
57
+ width: 100vw;
58
+ height: 100vh;
59
+ cursor: crosshair;
60
+ z-index: 2147483642;
61
+ pointer-events: auto;
62
+ background: rgba(15, 23, 42, 0.25);
63
+ user-select: none;
64
+ }
65
+
66
+ .bt-region-box {
67
+ position: fixed;
68
+ border: 2px dashed #38bdf8;
69
+ background: rgba(56, 189, 248, 0.2);
70
+ box-sizing: border-box;
71
+ pointer-events: none;
72
+ z-index: 2147483643;
73
+ }
74
+
75
+ .bt-region-badge {
76
+ position: absolute;
77
+ top: -26px;
78
+ left: 0;
79
+ background: #0f172a;
80
+ color: #38bdf8;
81
+ border: 1px solid #0284c7;
82
+ font-size: 11px;
83
+ font-weight: 600;
84
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
85
+ padding: 2px 7px;
86
+ border-radius: 4px;
87
+ white-space: nowrap;
88
+ pointer-events: none;
89
+ box-shadow: 0 4px 6px -1px rgba(0,0,0,0.5);
90
+ }
91
+
92
+ .bt-region-banner {
93
+ position: fixed;
94
+ top: 20px;
95
+ left: 50%;
96
+ transform: translateX(-50%);
97
+ background: #0f172a;
98
+ color: #f8fafc;
99
+ border: 1px solid #0284c7;
100
+ border-radius: 30px;
101
+ padding: 8px 16px;
102
+ display: flex;
103
+ align-items: center;
104
+ gap: 12px;
105
+ box-shadow: 0 10px 25px -5px rgba(0,0,0,0.6);
106
+ font-size: 12.5px;
107
+ font-weight: 500;
108
+ pointer-events: auto;
109
+ z-index: 2147483645;
110
+ user-select: none;
111
+ }
112
+
113
+ .bt-region-cancel-btn {
114
+ background: rgba(239, 68, 68, 0.15);
115
+ color: #fca5a5;
116
+ border: 1px solid rgba(239, 68, 68, 0.4);
117
+ padding: 3px 10px;
118
+ border-radius: 20px;
119
+ font-size: 11px;
120
+ font-weight: 600;
121
+ cursor: pointer;
122
+ transition: all 0.15s ease;
123
+ display: inline-flex;
124
+ align-items: center;
125
+ gap: 4px;
126
+ font-family: inherit;
127
+ }
128
+
129
+ .bt-region-cancel-btn:hover {
130
+ background: rgba(239, 68, 68, 0.3);
131
+ color: #ffffff;
132
+ }
133
+
134
+ /* 3. Note Markers on Page */
135
+ .bt-markers-layer {
136
+ position: fixed;
137
+ top: 0;
138
+ left: 0;
139
+ width: 0;
140
+ height: 0;
141
+ pointer-events: none;
142
+ z-index: 2147483638;
143
+ }
144
+
145
+ .bt-note-marker {
146
+ position: fixed;
147
+ pointer-events: auto;
148
+ background: linear-gradient(135deg, #2563eb, #1d4ed8);
149
+ color: #ffffff;
150
+ border: 2px solid #ffffff;
151
+ box-shadow: 0 4px 12px rgba(0,0,0,0.5), 0 0 0 1px rgba(37,99,235,0.4);
152
+ border-radius: 999px;
153
+ height: 26px;
154
+ min-width: 26px;
155
+ padding: 0 7px;
156
+ display: inline-flex;
157
+ align-items: center;
158
+ justify-content: center;
159
+ gap: 4px;
160
+ cursor: pointer;
161
+ font-size: 11px;
162
+ font-weight: 700;
163
+ user-select: none;
164
+ transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.15s ease;
165
+ animation: bt-pop-in 0.2s ease-out;
166
+ box-sizing: border-box;
167
+ z-index: 2147483641;
168
+ }
169
+
170
+ @keyframes bt-pop-in {
171
+ 0% { transform: scale(0.6); opacity: 0; }
172
+ 100% { transform: scale(1); opacity: 1; }
173
+ }
174
+
175
+ .bt-note-marker:hover {
176
+ transform: scale(1.15) translateY(-2px);
177
+ box-shadow: 0 8px 20px rgba(37,99,235,0.6), 0 0 0 2px #60a5fa;
178
+ }
179
+
180
+ .bt-marker-resolved {
181
+ background: linear-gradient(135deg, #475569, #334155);
182
+ border-color: #94a3b8;
183
+ opacity: 0.75;
184
+ }
185
+
186
+ .bt-region-marker-box {
187
+ position: fixed;
188
+ border: 2px dashed #0284c7;
189
+ background: rgba(14, 165, 233, 0.08);
190
+ pointer-events: none;
191
+ box-sizing: border-box;
192
+ border-radius: 6px;
193
+ z-index: 2147483639;
194
+ }
195
+
196
+ .bt-page-notes-dock {
197
+ position: fixed;
198
+ top: 16px;
199
+ right: 16px;
200
+ display: flex;
201
+ flex-direction: column;
202
+ gap: 6px;
203
+ pointer-events: none;
204
+ z-index: 2147483641;
205
+ }
206
+
207
+ .bt-page-note-pill {
208
+ background: #0f172a;
209
+ color: #c084fc;
210
+ border: 1px solid #7e22ce;
211
+ border-radius: 20px;
212
+ padding: 5px 12px;
213
+ font-size: 11.5px;
214
+ font-weight: 600;
215
+ display: inline-flex;
216
+ align-items: center;
217
+ gap: 6px;
218
+ box-shadow: 0 4px 12px rgba(0,0,0,0.5);
219
+ cursor: pointer;
220
+ pointer-events: auto;
221
+ transition: all 0.15s ease;
222
+ }
223
+
224
+ .bt-page-note-pill:hover {
225
+ background: #1e1b4b;
226
+ transform: translateY(-1px);
227
+ }
228
+
229
+ /* 4. Floating Quick Toolbar */
230
+ .bt-toolbar {
231
+ position: fixed;
232
+ bottom: 20px;
233
+ right: 20px;
234
+ background: #0f172a;
235
+ border: 1px solid #334155;
236
+ border-radius: 30px;
237
+ padding: 4px 6px;
238
+ display: flex;
239
+ align-items: center;
240
+ gap: 4px;
241
+ box-shadow: 0 10px 25px -3px rgba(0,0,0,0.6), 0 4px 6px -4px rgba(0,0,0,0.4);
242
+ pointer-events: auto;
243
+ z-index: 2147483646;
244
+ user-select: none;
245
+ transition: all 0.2s ease;
246
+ }
247
+
248
+ .bt-toolbar-btn {
249
+ background: transparent;
250
+ border: none;
251
+ color: #94a3b8;
252
+ font-size: 12px;
253
+ font-weight: 500;
254
+ padding: 6px 12px;
255
+ border-radius: 20px;
256
+ cursor: pointer;
257
+ display: flex;
258
+ align-items: center;
259
+ gap: 6px;
260
+ transition: all 0.15s ease;
261
+ font-family: inherit;
262
+ }
263
+
264
+ .bt-toolbar-btn:hover {
265
+ background: #1e293b;
266
+ color: #f8fafc;
267
+ }
268
+
269
+ .bt-toolbar-btn.active {
270
+ background: #2563eb;
271
+ color: #ffffff;
272
+ font-weight: 600;
273
+ box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
274
+ }
275
+
276
+ .bt-count-pill {
277
+ background: rgba(255, 255, 255, 0.2);
278
+ color: #ffffff;
279
+ font-size: 10px;
280
+ font-weight: 700;
281
+ padding: 1px 6px;
282
+ border-radius: 10px;
283
+ line-height: 1.2;
284
+ }
285
+
286
+ .bt-toolbar-divider {
287
+ width: 1px;
288
+ height: 16px;
289
+ background: #334155;
290
+ margin: 0 2px;
291
+ }
292
+
293
+ /* 5. Modals & Popover Card */
294
+ .bt-modal-backdrop {
295
+ position: fixed;
296
+ top: 0;
297
+ left: 0;
298
+ width: 100vw;
299
+ height: 100vh;
300
+ background: rgba(15, 23, 42, 0.75);
301
+ backdrop-filter: blur(6px);
302
+ display: flex;
303
+ align-items: center;
304
+ justify-content: center;
305
+ pointer-events: auto;
306
+ z-index: 2147483647;
307
+ opacity: 1;
308
+ box-sizing: border-box;
309
+ animation: bt-fade-in 0.15s ease-out;
310
+ }
311
+
312
+ @keyframes bt-fade-in {
313
+ from { opacity: 0; transform: scale(0.98); }
314
+ to { opacity: 1; transform: scale(1); }
315
+ }
316
+
317
+ .bt-modal {
318
+ background: #0f172a;
319
+ color: #f8fafc;
320
+ border: 1px solid #334155;
321
+ border-radius: 14px;
322
+ padding: 20px;
323
+ width: 450px;
324
+ max-width: 92vw;
325
+ box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.05);
326
+ display: flex;
327
+ flex-direction: column;
328
+ gap: 14px;
329
+ box-sizing: border-box;
330
+ }
331
+
332
+ .bt-modal-header {
333
+ display: flex;
334
+ justify-content: space-between;
335
+ align-items: center;
336
+ }
337
+
338
+ .bt-modal-title {
339
+ font-size: 14.5px;
340
+ font-weight: 600;
341
+ letter-spacing: -0.01em;
342
+ display: flex;
343
+ align-items: center;
344
+ gap: 8px;
345
+ color: #f8fafc;
346
+ }
347
+
348
+ .bt-mode-badge {
349
+ font-size: 10px;
350
+ font-weight: 700;
351
+ letter-spacing: 0.05em;
352
+ text-transform: uppercase;
353
+ padding: 2px 7px;
354
+ border-radius: 6px;
355
+ }
356
+
357
+ .bt-badge-element {
358
+ background: rgba(59, 130, 246, 0.15);
359
+ color: #60a5fa;
360
+ border: 1px solid rgba(59, 130, 246, 0.4);
361
+ }
362
+
363
+ .bt-badge-region {
364
+ background: rgba(14, 165, 233, 0.15);
365
+ color: #38bdf8;
366
+ border: 1px solid rgba(14, 165, 233, 0.4);
367
+ }
368
+
369
+ .bt-badge-page {
370
+ background: rgba(168, 85, 247, 0.15);
371
+ color: #c084fc;
372
+ border: 1px solid rgba(168, 85, 247, 0.4);
373
+ }
374
+
375
+ .bt-badge-status-open {
376
+ background: rgba(16, 185, 129, 0.15);
377
+ color: #34d399;
378
+ border: 1px solid rgba(16, 185, 129, 0.4);
379
+ }
380
+
381
+ .bt-badge-status-resolved {
382
+ background: rgba(100, 116, 139, 0.2);
383
+ color: #94a3b8;
384
+ border: 1px solid rgba(100, 116, 139, 0.4);
385
+ }
386
+
387
+ .bt-close-btn {
388
+ background: transparent;
389
+ border: none;
390
+ color: #94a3b8;
391
+ font-size: 15px;
392
+ cursor: pointer;
393
+ padding: 3px 7px;
394
+ border-radius: 6px;
395
+ transition: all 0.12s ease;
396
+ display: flex;
397
+ align-items: center;
398
+ justify-content: center;
399
+ }
400
+ .bt-close-btn:hover {
401
+ background: #1e293b;
402
+ color: #ffffff;
403
+ }
404
+
405
+ .bt-target-pill {
406
+ background: #090d16;
407
+ color: #94a3b8;
408
+ border: 1px solid #1e293b;
409
+ border-radius: 8px;
410
+ padding: 8px 12px;
411
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
412
+ font-size: 11.5px;
413
+ display: flex;
414
+ align-items: center;
415
+ gap: 8px;
416
+ overflow: hidden;
417
+ }
418
+
419
+ .bt-pill-content {
420
+ overflow: hidden;
421
+ text-overflow: ellipsis;
422
+ white-space: nowrap;
423
+ color: #cbd5e1;
424
+ }
425
+
426
+ .bt-note-message-box {
427
+ background: #090d16;
428
+ border: 1px solid #1e293b;
429
+ border-radius: 8px;
430
+ padding: 12px 14px;
431
+ font-size: 13.5px;
432
+ line-height: 1.5;
433
+ color: #f1f5f9;
434
+ white-space: pre-wrap;
435
+ word-break: break-word;
436
+ max-height: 180px;
437
+ overflow-y: auto;
438
+ }
439
+
440
+ .bt-textarea {
441
+ background: #090d16;
442
+ color: #f8fafc;
443
+ border: 1px solid #334155;
444
+ border-radius: 8px;
445
+ padding: 12px;
446
+ font-size: 13.5px;
447
+ line-height: 1.5;
448
+ resize: vertical;
449
+ min-height: 95px;
450
+ outline: none;
451
+ box-sizing: border-box;
452
+ width: 100%;
453
+ font-family: inherit;
454
+ transition: border-color 0.15s ease, box-shadow 0.15s ease;
455
+ }
456
+
457
+ .bt-textarea::placeholder {
458
+ color: #64748b;
459
+ }
460
+
461
+ .bt-textarea:focus {
462
+ border-color: #3b82f6;
463
+ box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
464
+ }
465
+
466
+ .bt-modal-footer {
467
+ display: flex;
468
+ justify-content: space-between;
469
+ align-items: center;
470
+ gap: 12px;
471
+ margin-top: 2px;
472
+ }
473
+
474
+ .bt-kbd-hint {
475
+ font-size: 11px;
476
+ color: #64748b;
477
+ display: flex;
478
+ align-items: center;
479
+ gap: 4px;
480
+ user-select: none;
481
+ }
482
+
483
+ .bt-kbd-hint kbd {
484
+ background: #1e293b;
485
+ color: #94a3b8;
486
+ border: 1px solid #334155;
487
+ border-radius: 4px;
488
+ padding: 1px 5px;
489
+ font-family: inherit;
490
+ font-size: 10px;
491
+ font-weight: 600;
492
+ }
493
+
494
+ .bt-modal-actions {
495
+ display: flex;
496
+ justify-content: flex-end;
497
+ align-items: center;
498
+ gap: 8px;
499
+ }
500
+
501
+ .bt-btn {
502
+ padding: 8px 16px;
503
+ border-radius: 7px;
504
+ font-size: 12.5px;
505
+ font-weight: 600;
506
+ cursor: pointer;
507
+ border: 1px solid transparent;
508
+ transition: all 0.15s ease;
509
+ font-family: inherit;
510
+ display: inline-flex;
511
+ align-items: center;
512
+ justify-content: center;
513
+ gap: 6px;
514
+ }
515
+
516
+ .bt-btn-cancel {
517
+ background: transparent;
518
+ color: #94a3b8;
519
+ }
520
+ .bt-btn-cancel:hover {
521
+ background: #1e293b;
522
+ color: #f8fafc;
523
+ }
524
+
525
+ .bt-btn-save {
526
+ background: #2563eb;
527
+ color: #ffffff;
528
+ box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
529
+ }
530
+ .bt-btn-save:hover {
531
+ background: #1d4ed8;
532
+ box-shadow: 0 4px 10px rgba(37, 99, 235, 0.45);
533
+ }
534
+
535
+ .bt-btn-resolve {
536
+ background: rgba(16, 185, 129, 0.15);
537
+ color: #6ee7b7;
538
+ border: 1px solid rgba(16, 185, 129, 0.35);
539
+ }
540
+ .bt-btn-resolve:hover {
541
+ background: rgba(16, 185, 129, 0.3);
542
+ color: #ffffff;
543
+ }
544
+
545
+ .bt-btn-delete {
546
+ background: rgba(239, 68, 68, 0.15);
547
+ color: #fca5a5;
548
+ border: 1px solid rgba(239, 68, 68, 0.35);
549
+ }
550
+ .bt-btn-delete:hover {
551
+ background: rgba(239, 68, 68, 0.3);
552
+ color: #ffffff;
553
+ }
554
+ `,this.shadowRoot.appendChild(t),this.highlightOverlay=document.createElement("div"),this.highlightOverlay.className="bt-highlight",this.highlightOverlay.style.display="none",this.shadowRoot.appendChild(this.highlightOverlay),this.markersContainer=document.createElement("div"),this.markersContainer.className="bt-markers-layer",this.shadowRoot.appendChild(this.markersContainer),this.options.showToolbar&&this.createToolbar()}if(this.container&&!this.container.isConnected){let t=document.body||document.documentElement;t&&t.appendChild(this.container)}return this.shadowRoot}createToolbar(){if(!this.shadowRoot||this.toolbarElement)return;this.toolbarElement=document.createElement("div"),this.toolbarElement.className="bt-toolbar",this.toolbarElement.innerHTML=`
555
+ <button class="bt-toolbar-btn" id="bt-mode-element" title="Inspect element (or hold Alt+Click)">
556
+ <span>\u{1F3AF}</span> Element
557
+ </button>
558
+ <button class="bt-toolbar-btn" id="bt-mode-region" title="Drag to select screen region">
559
+ <span>\u{1F4D0}</span> Region
560
+ </button>
561
+ <button class="bt-toolbar-btn" id="bt-mode-page" title="Leave full-page note">
562
+ <span>\u{1F4C4}</span> Page
563
+ </button>
564
+ <div class="bt-toolbar-divider"></div>
565
+ <button class="bt-toolbar-btn active" id="bt-toggle-notes" title="Toggle visible note markers on screen">
566
+ <span>\u{1F4CC}</span> Notes <span class="bt-count-pill" id="bt-notes-count">0</span>
567
+ </button>
568
+ `;let t=this.toolbarElement.querySelector("#bt-mode-element"),r=this.toolbarElement.querySelector("#bt-mode-region"),n=this.toolbarElement.querySelector("#bt-mode-page"),o=this.toolbarElement.querySelector("#bt-toggle-notes");t.onclick=i=>{i.stopPropagation(),this.setMode(this.activeMode==="element"?"idle":"element")},r.onclick=i=>{i.stopPropagation(),this.setMode(this.activeMode==="region"?"idle":"region")},n.onclick=i=>{i.stopPropagation(),this.setMode("page")},o.onclick=i=>{i.stopPropagation(),this.showMarkers=!this.showMarkers,o.classList.toggle("active",this.showMarkers),this.renderMarkers()},this.shadowRoot.appendChild(this.toolbarElement)}updateToolbarState(){if(!this.toolbarElement)return;let t=this.toolbarElement.querySelector("#bt-mode-element"),r=this.toolbarElement.querySelector("#bt-mode-region"),n=this.toolbarElement.querySelector("#bt-mode-page");t?.classList.toggle("active",this.activeMode==="element"),r?.classList.toggle("active",this.activeMode==="region"),n?.classList.toggle("active",this.activeMode==="page")}updateToolbarCount(){if(!this.toolbarElement)return;let t=this.toolbarElement.querySelector("#bt-notes-count");if(t){let r=this.savedNotes.filter(n=>n.status==="OPEN").length;t.textContent=String(r)}}renderMarkers(){if(!this.ensureContainer()||!this.markersContainer||(this.markersContainer.innerHTML="",!this.showMarkers))return;let r=window.location.pathname,n=this.savedNotes.filter(i=>i.status==="OPEN"&&(i.route===r||!i.route||i.route==="/"||window.location.href.includes(i.route))),o=[];if(n.forEach((i,a)=>{if(i.type==="page"){o.push(i);return}if(i.type==="region"&&i.region){let c=document.createElement("div");c.className="bt-region-marker-box",c.style.left=`${i.region.x}px`,c.style.top=`${i.region.y}px`,c.style.width=`${i.region.width}px`,c.style.height=`${i.region.height}px`,this.markersContainer.appendChild(c);let d=document.createElement("div");d.className="bt-note-marker",d.style.left=`${Math.max(4,i.region.x-12)}px`,d.style.top=`${Math.max(4,i.region.y-12)}px`,d.title=i.message,d.innerHTML=`<span>\u{1F4D0}</span> <span>#${a+1}</span>`,d.onclick=u=>{u.stopPropagation(),this.openNoteCard(i)},this.markersContainer.appendChild(d);return}let s=null;if(i.target?.selector)try{s=document.querySelector(i.target.selector)}catch{}let l=s?s.getBoundingClientRect():i.target?.boundingRect;if(l){let c=document.createElement("div");c.className="bt-note-marker",c.setAttribute("data-note-id",i.id),c.title=i.message,c.style.left=`${Math.max(4,l.left-10)}px`,c.style.top=`${Math.max(4,l.top-12)}px`,c.innerHTML=`<span>\u{1F4DD}</span> <span>#${a+1}</span>`,c.onclick=d=>{d.stopPropagation(),this.openNoteCard(i)},s&&(c.onmouseenter=()=>this.updateHighlight(s),c.onmouseleave=()=>this.hideHighlight()),this.markersContainer.appendChild(c)}}),o.length>0){let i=document.createElement("div");i.className="bt-page-notes-dock",o.forEach((a,s)=>{let l=document.createElement("div");l.className="bt-page-note-pill",l.innerHTML=`<span>\u{1F4C4}</span> <span>Page Note (${Se(a.message,25)})</span>`,l.onclick=c=>{c.stopPropagation(),this.openNoteCard(a)},i.appendChild(l)}),this.markersContainer.appendChild(i)}}updateMarkerPositions(){!this.showMarkers||!this.markersContainer||this.renderMarkers()}openNoteCard(t){let r=this.ensureContainer();if(!r)return;this.cardOverlay&&this.cardOverlay.parentElement&&(this.cardOverlay.parentElement.removeChild(this.cardOverlay),this.cardOverlay=null);let n=document.createElement("div");n.className="bt-modal-backdrop",this.cardOverlay=n;let o=`bt-badge-${t.type.toLowerCase()}`,i=t.status==="OPEN"?"bt-badge-status-open":"bt-badge-status-resolved",a=t.type==="region"?"\u{1F4D0}":t.type==="page"?"\u{1F4C4}":"\u{1F3AF}",s=t.type==="region"&&t.region?`Region: ${t.region.width} \xD7 ${t.region.height} px \xB7 Route: ${t.route}`:t.type==="page"?`Page Note \xB7 Route: ${t.route}`:`${t.target?.selector||"Element"} (${t.target?.boundingRect?.width||0}\xD7${t.target?.boundingRect?.height||0}px) \xB7 ${t.route}`,l=new Date(t.createdAt).toLocaleString();n.innerHTML=`
569
+ <div class="bt-modal">
570
+ <div class="bt-modal-header">
571
+ <div class="bt-modal-title">
572
+ <span>${a} Visual Note Details</span>
573
+ <span class="bt-mode-badge ${o}">${t.type.toUpperCase()}</span>
574
+ <span class="bt-mode-badge ${i}">${t.status}</span>
575
+ </div>
576
+ <button class="bt-close-btn" id="btn-card-close" title="Close (Esc)">\u2715</button>
577
+ </div>
578
+
579
+ <div class="bt-target-pill" title="${s}">
580
+ <span>\u{1F3F7}\uFE0F</span>
581
+ <span class="bt-pill-content">${s}</span>
582
+ </div>
583
+
584
+ <div class="bt-note-message-box">${t.message}</div>
585
+
586
+ <div style="font-size: 11px; color: #64748b; display: flex; justify-content: space-between; padding: 0 2px;">
587
+ <span>Created: ${l}</span>
588
+ <span>ID: <code style="font-family: monospace; color: #94a3b8;">${t.id}</code></span>
589
+ </div>
590
+
591
+ <div class="bt-modal-footer">
592
+ <button class="bt-btn bt-btn-delete" id="btn-card-delete" title="Delete this note">
593
+ <span>\u{1F5D1}\uFE0F</span> Delete
594
+ </button>
595
+ <div class="bt-modal-actions">
596
+ <button class="bt-btn bt-btn-cancel" id="btn-card-dismiss">Close</button>
597
+ <button class="bt-btn ${t.status==="OPEN"?"bt-btn-resolve":"bt-btn-save"}" id="btn-card-resolve">
598
+ ${t.status==="OPEN"?"<span>\u2705</span> Resolve Note":"<span>\u21BA</span> Reopen"}
599
+ </button>
600
+ </div>
601
+ </div>
602
+ </div>
603
+ `;let c=n.querySelector("#btn-card-close"),d=n.querySelector("#btn-card-dismiss"),u=n.querySelector("#btn-card-resolve"),p=n.querySelector("#btn-card-delete"),h=()=>{this.cardOverlay&&(r.removeChild(this.cardOverlay),this.cardOverlay=null,this.hideHighlight())};c.onclick=h,d.onclick=h,n.onclick=f=>{f.target===n&&h()},u.onclick=()=>{t.status==="OPEN"?this.transport.send({type:"resolve_note",noteId:t.id}):this.transport.send({type:"reopen_note",noteId:t.id}),h()},p.onclick=()=>{this.transport.send({type:"delete_note",noteId:t.id}),h()},r.appendChild(n)}setupListeners(){let t=a=>{if(this.modalOverlay||this.cardOverlay||this.isDraggingRegion||this.activeMode==="region")return;let s=a.composedPath?a.composedPath():[];if(this.container&&s.includes(this.container)){this.hideHighlight();return}if(a.altKey||this.activeMode==="element"){let l=document.elementFromPoint(a.clientX,a.clientY);if(l&&l!==this.container&&!this.container?.contains(l)){this.hoveredElement=l,this.updateHighlight(l);return}}!a.altKey&&this.activeMode!=="element"&&this.hideHighlight()},r=a=>{if(this.modalOverlay||this.cardOverlay)return;let s=a.composedPath?a.composedPath():[];if(!(this.container&&s.includes(this.container))&&this.activeMode!=="region"&&(a.altKey||this.activeMode==="element")){a.preventDefault(),a.stopPropagation();let l=this.hoveredElement||document.elementFromPoint(a.clientX,a.clientY);l&&l!==this.container&&!this.container?.contains(l)&&(this.selectedElement=l,this.openNoteEditor(l,"element"),this.activeMode==="element"&&this.setMode("idle"))}},n=a=>{a.key==="Escape"&&(this.cardOverlay&&this.cardOverlay.parentElement&&this.shadowRoot?(this.shadowRoot.removeChild(this.cardOverlay),this.cardOverlay=null):(this.activeMode==="region"||this.activeMode==="element")&&this.setMode("idle"))},o=a=>{a.key==="Alt"&&!this.modalOverlay&&!this.cardOverlay&&this.activeMode!=="element"&&this.hideHighlight()},i=()=>{requestAnimationFrame(()=>{this.updateMarkerPositions()})};window.addEventListener("mousemove",t,{capture:!0,passive:!0}),window.addEventListener("click",r,{capture:!0}),window.addEventListener("keydown",n,{capture:!0}),window.addEventListener("keyup",o,{capture:!0}),window.addEventListener("scroll",i,{capture:!0,passive:!0}),window.addEventListener("resize",i,{passive:!0}),this.cleanups.push(()=>{window.removeEventListener("mousemove",t,{capture:!0}),window.removeEventListener("click",r,{capture:!0}),window.removeEventListener("keydown",n,{capture:!0}),window.removeEventListener("keyup",o,{capture:!0}),window.removeEventListener("scroll",i,{capture:!0}),window.removeEventListener("resize",i)})}showRegionOverlay(){let t=this.ensureContainer();if(t){if(!this.regionOverlay){this.regionOverlay=document.createElement("div"),this.regionOverlay.className="bt-region-overlay",this.regionBox=document.createElement("div"),this.regionBox.className="bt-region-box",this.regionBox.style.display="none",this.regionOverlay.appendChild(this.regionBox),this.regionBanner=document.createElement("div"),this.regionBanner.className="bt-region-banner",this.regionBanner.innerHTML=`
604
+ <span>\u{1F4D0} Drag rectangle on screen to select region</span>
605
+ <button class="bt-region-cancel-btn" id="bt-region-cancel">\u2715 Cancel (Esc)</button>
606
+ `;let r=this.regionBanner.querySelector("#bt-region-cancel");r.onclick=n=>{n.stopPropagation(),this.setMode("idle")},this.regionOverlay.appendChild(this.regionBanner),this.regionOverlay.oncontextmenu=n=>{n.preventDefault(),this.setMode("idle")},this.regionOverlay.onmousedown=n=>{let o=n.composedPath?n.composedPath():[];this.regionBanner&&o.includes(this.regionBanner)||this.toolbarElement&&o.includes(this.toolbarElement)||(this.isDraggingRegion=!0,this.dragStartX=n.clientX,this.dragStartY=n.clientY,this.regionBox&&(this.regionBox.style.display="block",this.regionBox.style.left=`${n.clientX}px`,this.regionBox.style.top=`${n.clientY}px`,this.regionBox.style.width="0px",this.regionBox.style.height="0px"))},this.regionOverlay.onmousemove=n=>{if(!this.isDraggingRegion||!this.regionBox)return;let o=n.clientX,i=n.clientY,a=Math.min(this.dragStartX,o),s=Math.min(this.dragStartY,i),l=Math.abs(o-this.dragStartX),c=Math.abs(i-this.dragStartY);this.regionBox.style.left=`${a}px`,this.regionBox.style.top=`${s}px`,this.regionBox.style.width=`${l}px`,this.regionBox.style.height=`${c}px`;let d=this.regionBox.querySelector(".bt-region-badge");d||(d=document.createElement("div"),d.className="bt-region-badge",this.regionBox.appendChild(d)),d.textContent=`Region: ${Math.round(l)} \xD7 ${Math.round(c)} px`},this.regionOverlay.onmouseup=n=>{if(!this.isDraggingRegion)return;this.isDraggingRegion=!1;let o=n.clientX,i=n.clientY,a=Math.min(this.dragStartX,o),s=Math.min(this.dragStartY,i),l=Math.abs(o-this.dragStartX),c=Math.abs(i-this.dragStartY);l>15&&c>15?(this.selectedRegion={x:Math.round(a),y:Math.round(s),width:Math.round(l),height:Math.round(c)},this.hideRegionOverlay(),this.setMode("idle"),this.openRegionNoteEditor(this.selectedRegion)):(this.hideRegionOverlay(),this.setMode("idle"))}}this.toolbarElement&&this.toolbarElement.parentNode===t?t.insertBefore(this.regionOverlay,this.toolbarElement):t.appendChild(this.regionOverlay)}}hideRegionOverlay(){this.isDraggingRegion=!1,this.regionOverlay&&this.regionOverlay.parentNode&&this.regionOverlay.parentNode.removeChild(this.regionOverlay),this.regionBox&&(this.regionBox.style.display="none")}updateHighlight(t){if(!this.ensureContainer()||!this.highlightOverlay)return;let n=t.getBoundingClientRect();this.highlightOverlay.style.display="block",this.highlightOverlay.style.top=`${n.top}px`,this.highlightOverlay.style.left=`${n.left}px`,this.highlightOverlay.style.width=`${n.width}px`,this.highlightOverlay.style.height=`${n.height}px`;let i=`${ge(t)} \xB7 ${Math.round(n.width)}\xD7${Math.round(n.height)}`,a=this.highlightOverlay.querySelector(".bt-badge");a||(a=document.createElement("div"),a.className="bt-badge",this.highlightOverlay.appendChild(a)),a.textContent=i}hideHighlight(){this.highlightOverlay&&(this.highlightOverlay.style.display="none")}openNoteEditor(t,r="element"){if(!this.ensureContainer())return;let o=t||document.body;this.selectedElement=o,r==="element"&&this.updateHighlight(o),this.renderNoteModal({title:"Add Visual Note",modeBadge:r.toUpperCase(),pillText:r==="page"?`Page Viewport: ${window.innerWidth} \xD7 ${window.innerHeight} px`:`${ge(o)} (${Math.round(o.getBoundingClientRect().width)}\xD7${Math.round(o.getBoundingClientRect().height)}) \xB7 Viewport: ${window.innerWidth}\xD7${window.innerHeight}`,onSave:async i=>{await this.saveVisualNote(o,i,r)}})}openRegionNoteEditor(t){this.renderNoteModal({title:"Add Region Note",modeBadge:"REGION",pillText:`Selected Area: x:${t.x}, y:${t.y} (${t.width} \xD7 ${t.height} px)`,onSave:async r=>{await this.saveRegionVisualNote(t,r)}})}renderNoteModal(t){let r=this.ensureContainer();if(!r)return;this.modalOverlay&&this.modalOverlay.parentElement&&(this.modalOverlay.parentElement.removeChild(this.modalOverlay),this.modalOverlay=null);let n=document.createElement("div");n.className="bt-modal-backdrop",this.modalOverlay=n;let o=`bt-badge-${t.modeBadge.toLowerCase()}`,i=t.modeBadge==="REGION"?"\u{1F4D0}":t.modeBadge==="PAGE"?"\u{1F4C4}":"\u{1F3AF}",a=typeof navigator<"u"&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);n.innerHTML=`
607
+ <div class="bt-modal">
608
+ <div class="bt-modal-header">
609
+ <div class="bt-modal-title">
610
+ <span>\u{1F4DD} ${t.title}</span>
611
+ <span class="bt-mode-badge ${o}">${t.modeBadge}</span>
612
+ </div>
613
+ <button class="bt-close-btn" id="btn-close" title="Close (Esc)">\u2715</button>
614
+ </div>
615
+ <div class="bt-target-pill" title="${t.pillText}">
616
+ <span>${i}</span>
617
+ <span class="bt-pill-content">${t.pillText}</span>
618
+ </div>
619
+ <textarea class="bt-textarea" placeholder="Describe the layout issue, styling bug, or note for AI agent..." autofocus></textarea>
620
+ <div class="bt-modal-footer">
621
+ <div class="bt-kbd-hint">
622
+ <kbd>${a?"\u2318":"Ctrl"}+Enter</kbd> save \xB7 <kbd>Esc</kbd> cancel
623
+ </div>
624
+ <div class="bt-modal-actions">
625
+ <button class="bt-btn bt-btn-cancel" id="btn-cancel">Cancel</button>
626
+ <button class="bt-btn bt-btn-save" id="btn-save">Save Note</button>
627
+ </div>
628
+ </div>
629
+ </div>
630
+ `;let s=n.querySelector("textarea"),l=n.querySelector("#btn-close"),c=n.querySelector("#btn-cancel"),d=n.querySelector("#btn-save"),u=()=>{this.modalOverlay&&(r.removeChild(this.modalOverlay),this.modalOverlay=null,this.hideHighlight(),this.hideRegionOverlay())};l.onclick=u,c.onclick=u,n.onclick=h=>{h.target===n&&u()};let p=async()=>{let h=s.value.trim();if(h){d.textContent="Saving...",d.disabled=!0;try{await t.onSave(h)}finally{u()}}};d.onclick=p,s.onkeydown=h=>{h.key==="Enter"&&(h.metaKey||h.ctrlKey||!h.shiftKey)&&(h.preventDefault(),p()),h.key==="Escape"&&u()},r.appendChild(n),setTimeout(()=>s?.focus(),50)}async saveVisualNote(t,r,n="element"){let o=t.getBoundingClientRect(),i=n==="page"?"body":ge(t),a;try{let d=await this.screenshotDriver.captureElement(t);d.ok&&(a=d.dataUrl)}catch{}let s=this.extractElementContext(t),l={selector:i,boundingRect:{x:Math.round(o.x),y:Math.round(o.y),width:Math.round(o.width),height:Math.round(o.height),top:Math.round(o.top),left:Math.round(o.left),bottom:Math.round(o.bottom),right:Math.round(o.right)},visible:o.width>0&&o.height>0,confidence:i.startsWith("[data-test")?"high":i.startsWith("#")?"medium":"low"},c={type:"create_note",sessionId:this.transport.getSessionId()||"",noteType:n,message:r,route:window.location.pathname+window.location.search,url:window.location.href,viewport:{width:window.innerWidth,height:window.innerHeight,devicePixelRatio:window.devicePixelRatio||1},scroll:{scrollX:window.scrollX,scrollY:window.scrollY},target:l,elementContext:s,screenshot:a,timestamp:Date.now()};this.transport.send(c),this.options.onNoteCreated&&this.options.onNoteCreated(c)}async saveRegionVisualNote(t,r){let n;try{let i=await this.screenshotDriver.captureElement(document.body||document.documentElement);i.ok&&i.dataUrl&&(n=await this.cropDataUrl(i.dataUrl,t))}catch{}let o={type:"create_note",sessionId:this.transport.getSessionId()||"",noteType:"region",message:r,route:window.location.pathname+window.location.search,url:window.location.href,viewport:{width:window.innerWidth,height:window.innerHeight,devicePixelRatio:window.devicePixelRatio||1},scroll:{scrollX:window.scrollX,scrollY:window.scrollY},region:t,screenshot:n,timestamp:Date.now()};this.transport.send(o),this.options.onNoteCreated&&this.options.onNoteCreated(o)}async cropDataUrl(t,r){return new Promise(n=>{let o=new Image;o.onload=()=>{try{let i=document.createElement("canvas");i.width=r.width,i.height=r.height;let a=i.getContext("2d");if(!a){n(t);return}let s=window.devicePixelRatio||1;a.drawImage(o,r.x*s,r.y*s,r.width*s,r.height*s,0,0,r.width,r.height),n(i.toDataURL("image/webp",.9))}catch{n(t)}},o.onerror=()=>n(t),o.src=t})}extractElementContext(t){let r=ge(t),n=t.tagName.toLowerCase(),o={};for(let s=0;s<t.attributes.length;s++){let l=t.attributes[s];l.name==="value"&&t.type==="password"?o[l.name]="[REDACTED]":o[l.name]=l.value}let i="";try{let s=t.cloneNode(!0);for(let l of Array.from(s.querySelectorAll('input[type="password"]')))l.setAttribute("value","[REDACTED]");i=Se(s.outerHTML,10240)}catch{i=Se(t.outerHTML,10240)}let a;return t.parentElement&&t.parentElement!==document.body&&(a={selector:ge(t.parentElement),tag:t.parentElement.tagName.toLowerCase()}),{selector:r,tag:n,attributes:o,outerHTML:i,innerText:Se(t.textContent?.trim(),200),parent:a}}destroy(){for(let t of this.cleanups)try{t()}catch{}this.cleanups=[],this.container&&this.container.parentElement&&this.container.parentElement.removeChild(this.container),this.container=null,this.shadowRoot=null,this.toolbarElement=null,this.regionOverlay=null,this.regionBox=null,this.regionBanner=null,this.markersContainer=null,this.modalOverlay=null,this.cardOverlay=null}};var ze=class{constructor(t={}){N(this,"options");N(this,"breadcrumbs");N(this,"transport");N(this,"screenshotDriver");N(this,"commandHandler");N(this,"inspector");N(this,"lastElement");N(this,"currentRoute","/");N(this,"cleanups",[]);N(this,"isInitialized",!1);this.options={...ot,...t,notes:{...ot.notes,...t.notes||{}}},this.breadcrumbs=new Pe(this.options.maxBreadcrumbs),this.transport=new Lt({url:this.options.daemonUrl,projectId:this.options.projectId,debug:this.options.debug}),this.screenshotDriver=new Ue,this.commandHandler=new nt(this.screenshotDriver),this.transport.setCommandHandler(this.commandHandler),this.options.notes.enabled&&(this.inspector=new qe(this.transport,this.screenshotDriver,{shortcut:this.options.notes.shortcut,maskSelectors:this.options.notes.maskSelectors}))}init(){if(this.isInitialized||typeof window>"u")return this;this.isInitialized=!0;try{this.currentRoute=window.location.pathname+window.location.search}catch{this.currentRoute="/"}if(this.transport.connect(),this.options.captureErrors){let t=Ar(async r=>{await this.handleRuntimeError(r)});this.cleanups.push(t)}if(this.options.captureConsole){let t=Mr(async r=>{await this.handleConsole(r)});this.cleanups.push(t)}if(this.options.captureNetwork){let t=$r(r=>{this.handleNetwork(r)});this.cleanups.push(t)}if(this.options.captureNavigation){let t=Er(r=>{this.handleNavigation(r)});this.cleanups.push(t)}if(this.options.captureInteractions){let t=Cr((r,n)=>{n&&(this.lastElement=n),this.breadcrumbs.add(r)});this.cleanups.push(t)}return this.inspector&&this.inspector.init(),this}openNoteEditor(t,r="element"){this.inspector&&this.inspector.openNoteEditor(t,r)}startRegionSelection(){this.inspector&&this.inspector.setMode("region")}startElementSelection(){this.inspector&&this.inspector.setMode("element")}setInspectMode(t){this.inspector&&this.inspector.setMode(t)}async createNote(t,r,n="element"){this.inspector&&await this.inspector.saveVisualNote(t,r,n)}async handleRuntimeError(t){this.breadcrumbs.add({type:"error",category:"runtime",message:`${t.errorType}: ${t.message}`,timestamp:t.timestamp,level:"error",data:{filename:t.filename,lineno:t.lineno,colno:t.colno}});let r;if(this.options.onErrorScreenshot&&this.lastElement?.selector)try{let n=await this.screenshotDriver.captureSelector(this.lastElement.selector);n.ok&&(r=n.dataUrl)}catch{}this.sendEvent("runtime_error",t,r)}async handleConsole(t){this.breadcrumbs.add({type:"console",category:"console",message:`console.${t.level}: ${t.message}`,timestamp:t.timestamp,level:t.level==="error"?"error":t.level==="warn"?"warn":"info"}),(t.level==="error"||t.level==="warn")&&this.sendEvent("console",t)}handleNetwork(t){let r=t.status&&t.status>=400||!!t.error,n=`${t.method} ${t.url} -> ${t.status||"ERR"} (${t.durationMs}ms)`;this.breadcrumbs.add({type:t.id?.startsWith("xhr")?"xhr":"fetch",category:"network",message:n,timestamp:t.timestamp,level:r?"error":"info",data:{status:t.status,durationMs:t.durationMs,error:t.error,aborted:t.aborted}}),this.sendEvent("fetch",t)}handleNavigation(t){this.currentRoute=t.to,this.breadcrumbs.add({type:"navigation",category:"navigation",message:`navigate ${t.to} (${t.type})`,timestamp:t.timestamp,level:"info",data:{from:t.from,to:t.to,type:t.type}}),this.sendEvent("navigation",t)}sendEvent(t,r,n){if(typeof window>"u")return;let o={type:"event",sessionId:this.transport.getSessionId()||"",eventType:t,payload:r,breadcrumbs:this.breadcrumbs.getRecent(),lastElement:this.lastElement,route:this.currentRoute,url:window.location.href,title:document.title,timestamp:Date.now(),screenshot:n};this.transport.send(o)}getBreadcrumbs(){return this.breadcrumbs.getRecent()}getLastElement(){return this.lastElement}destroy(){for(let t of this.cleanups)try{t()}catch{}this.cleanups=[],this.transport.destroy(),this.inspector&&this.inspector.destroy(),this.breadcrumbs.clear(),this.isInitialized=!1}};var Fe=null;function hr(e={}){return Fe||(Fe=new ze(e),Fe.init(),Fe)}function no(){return Fe}if(typeof window<"u"){window.__BROWSERTRACK__={init:hr,getClient:no};try{let e=document.currentScript,t=e?.getAttribute("data-auto-init")!=="false",r=e?.getAttribute("data-daemon-url")||void 0,n=e?.getAttribute("data-project-id")||void 0;t&&hr({daemonUrl:r,projectId:n})}catch{}}return So(hl);})();