@manototh/do11y 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/do11y.js +19 -2
- package/dist/do11y.min.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> Originally derived from [github.com/axiomhq/do11y](https://github.com/axiomhq/do11y)
|
|
4
4
|
|
|
5
|
-
Do11y is a documentation observability tool. It streams behavioral events from your docs site to [Supabase](https://supabase.com) (or any HTTP endpoint) in real time:
|
|
5
|
+
Do11y is a documentation observability tool. It streams behavioral events from your docs site to [Supabase](https://supabase.com) (or any HTTP endpoint or OpenTelemetry-compatible backend) in real time:
|
|
6
6
|
|
|
7
7
|
- Page views
|
|
8
8
|
- Scroll depth
|
|
@@ -42,6 +42,8 @@ Do11y supports the latest versions of the following frameworks:
|
|
|
42
42
|
- Nextra
|
|
43
43
|
- MkDocs Material
|
|
44
44
|
- VitePress
|
|
45
|
+
- Starlight (Astro)
|
|
46
|
+
- Docsy (Hugo)
|
|
45
47
|
|
|
46
48
|
For other frameworks, use manual setup with custom selectors.
|
|
47
49
|
|
package/dist/do11y.js
CHANGED
|
@@ -66,9 +66,11 @@
|
|
|
66
66
|
const EVENT_TOC_CLICK = "browser.do11y.toc_click";
|
|
67
67
|
const EVENT_FEEDBACK = "browser.do11y.feedback";
|
|
68
68
|
const EVENT_EXPAND_COLLAPSE = "browser.do11y.expand_collapse";
|
|
69
|
-
const VERSION = "0.1.
|
|
69
|
+
const VERSION = "0.1.1";
|
|
70
70
|
const _alreadyLoaded = !!window.__do11yInitialized;
|
|
71
71
|
window.__do11yInitialized = true;
|
|
72
|
+
const _isInIframe = window.self !== window.top;
|
|
73
|
+
if (_isInIframe && !_alreadyLoaded) window.__do11yInitialized = false;
|
|
72
74
|
const config = {
|
|
73
75
|
destination: "supabase",
|
|
74
76
|
supabaseUrl: "",
|
|
@@ -183,6 +185,17 @@
|
|
|
183
185
|
tabContainerSelector: "starlight-tabs [role=\"tablist\"], [role=\"tablist\"]",
|
|
184
186
|
tocSelector: ".right-sidebar-panel, starlight-toc, mobile-starlight-toc",
|
|
185
187
|
feedbackSelector: "[class*=\"feedback\"], [class*=\"helpful\"]"
|
|
188
|
+
},
|
|
189
|
+
docsy: {
|
|
190
|
+
searchSelector: ".td-search input, .td-search__input, #docsearch-0, #docsearch-1",
|
|
191
|
+
copyButtonSelector: "button[aria-label*=\"copy\" i], button[title*=\"copy\" i], .td-click-to-copy",
|
|
192
|
+
codeBlockSelector: ".highlight, pre.chroma, pre",
|
|
193
|
+
navigationSelector: "nav, [role=\"navigation\"], .td-sidebar, .td-navbar, [class*=\"sidebar\"]",
|
|
194
|
+
footerSelector: "footer, [role=\"contentinfo\"], .td-footer, [class*=\"footer\"]",
|
|
195
|
+
contentSelector: "main, article, [role=\"main\"], .td-content, [class*=\"content\"]",
|
|
196
|
+
tabContainerSelector: ".nav-tabs[role=\"tablist\"], [role=\"tablist\"], .tab-content",
|
|
197
|
+
tocSelector: ".td-toc, nav[id=\"TableOfContents\"], [class*=\"toc\"]",
|
|
198
|
+
feedbackSelector: ".feedback--answer, [class*=\"feedback\"], [class*=\"helpful\"]"
|
|
186
199
|
}
|
|
187
200
|
};
|
|
188
201
|
const SELECTOR_KEYS = [
|
|
@@ -794,6 +807,7 @@
|
|
|
794
807
|
if (config.debug) console.log("[Do11y] Sync flushed", events.length, "events");
|
|
795
808
|
}
|
|
796
809
|
function trackPageView() {
|
|
810
|
+
pageExited = false;
|
|
797
811
|
const session = updatePageSequence(window.location.pathname);
|
|
798
812
|
const referrerDomain = getReferrerDomain();
|
|
799
813
|
const referrerInfo = classifyReferrer(referrerDomain);
|
|
@@ -967,7 +981,10 @@
|
|
|
967
981
|
let lastActivityTime = Date.now();
|
|
968
982
|
let totalActiveTime = 0;
|
|
969
983
|
let isPageVisible = true;
|
|
984
|
+
let pageExited = false;
|
|
970
985
|
function emitPageExit() {
|
|
986
|
+
if (pageExited) return;
|
|
987
|
+
pageExited = true;
|
|
971
988
|
if (isPageVisible) totalActiveTime += Date.now() - lastActivityTime;
|
|
972
989
|
const totalTime = Date.now() - pageLoadTime;
|
|
973
990
|
const engagementRatio = totalTime > 0 ? totalActiveTime / totalTime : 0;
|
|
@@ -1312,7 +1329,7 @@
|
|
|
1312
1329
|
}
|
|
1313
1330
|
flushSync();
|
|
1314
1331
|
}
|
|
1315
|
-
if (!_alreadyLoaded) if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", init);
|
|
1332
|
+
if (!_alreadyLoaded && !_isInIframe) if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", init);
|
|
1316
1333
|
else init();
|
|
1317
1334
|
window.Do11y = window.Do11y ?? {
|
|
1318
1335
|
getConfig: () => ({
|
package/dist/do11y.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){let e=`browser.do11y.referrer_category`,t=`browser.do11y.ai_platform`,n=`browser.do11y.scroll.threshold`,r=`browser.do11y.scroll.percent`,i=`browser.do11y.section.heading`,a=`browser.do11y.section.heading_level`,o=`browser.do11y.section.visible_seconds`,s=`browser.do11y.expand.summary`,c=`browser.do11y.expand.action`,l=`browser.do11y.expand.section`,u=`browser.do11y.scroll_depth`,d=`browser.do11y.search_opened`,f=`browser.do11y.section_visible`,p=`browser.do11y.expand_collapse`,m=`0.1.0`,ee=!!window.__do11yInitialized;window.__do11yInitialized=!0;let h={destination:`supabase`,supabaseUrl:``,supabaseKey:``,supabaseTable:`do11y_events`,endpoint:``,headers:{},bodyTransform:void 0,otelSdkEndpoint:``,otelSdkHeaders:{},otelSdkServiceName:`do11y`,otelSdkResourceAttributes:{},otelSdkCdnUrl:`https://esm.sh/`,debug:!1,flushInterval:5e3,maxBatchSize:10,trackOutboundLinks:!0,trackInternalLinks:!0,trackScrollDepth:!0,scrollThresholds:[25,50,75,90],allowedDomains:null,respectDNT:!0,maxRetries:2,retryDelay:1e3,rateLimitMs:100,framework:`mintlify`,trackSectionVisibility:!0,sectionVisibleThreshold:3,trackTabSwitches:!0,trackTocClicks:!0,trackExpandCollapse:!0,trackFeedback:!0,tabContainerSelector:null,tocSelector:null,feedbackSelector:null,searchSelector:null,copyButtonSelector:null,codeBlockSelector:null,navigationSelector:null,footerSelector:null,contentSelector:null,useOtelBrowserInstrumentations:!1},g={mintlify:{searchSelector:`#search-bar-entry, #search-bar-entry-mobile, [class*="search"]`,copyButtonSelector:`button[class*="copy"], button[aria-label*="copy" i]`,codeBlockSelector:`pre, [class*="code"]`,navigationSelector:`nav, [role="navigation"], #navbar, #sidebar, [class*="nav"], [class*="sidebar"]`,footerSelector:`footer, [role="contentinfo"], [class*="footer"]`,contentSelector:`main, article, [role="main"], [class*="content"]`,tabContainerSelector:`[role="tablist"], [class*="tab"]`,tocSelector:`#table-of-contents, [data-testid="table-of-contents"], [class*="table-of-contents"], [class*="toc"]`,feedbackSelector:`[class*="feedback"], [class*="helpful"]`},docusaurus:{searchSelector:`.DocSearch, .DocSearch-Button`,copyButtonSelector:`button.clean-btn[aria-label*="copy" i], button[class*="copyButton"]`,codeBlockSelector:`pre, [class*="code"]`,navigationSelector:`nav, [role="navigation"], .navbar, .sidebar, [class*="nav"], [class*="sidebar"]`,footerSelector:`footer, [role="contentinfo"], [class*="footer"]`,contentSelector:`main, article, [role="main"], [class*="content"]`,tabContainerSelector:`.tabs[role="tablist"], [class*="tabs"]`,tocSelector:`.table-of-contents, [class*="toc"]`,feedbackSelector:`[class*="feedback"], [class*="helpful"]`},nextra:{searchSelector:`.nextra-search input, input[placeholder*="search" i], button[aria-label*="search" i]`,copyButtonSelector:`button[class*="copy"], button[aria-label*="copy" i], button[title*="copy" i]`,codeBlockSelector:`pre, [class*="code"]`,navigationSelector:`nav, [role="navigation"], [class*="nav"], [class*="sidebar"]`,footerSelector:`footer, [role="contentinfo"], [class*="footer"]`,contentSelector:`main, article, [role="main"], [class*="content"]`,tabContainerSelector:`[role="tablist"], [class*="tab"]`,tocSelector:`.nextra-toc, [class*="toc"]`,feedbackSelector:`[class*="feedback"], [class*="helpful"]`},"mkdocs-material":{searchSelector:`.md-search__input`,copyButtonSelector:`.md-clipboard, .md-code__button[title="Copy to clipboard"]`,codeBlockSelector:`pre, code, [class*="code"]`,navigationSelector:`nav, [role="navigation"], .md-nav, .md-sidebar`,footerSelector:`footer, [role="contentinfo"], .md-footer`,contentSelector:`main, article, [role="main"], .md-content`,tabContainerSelector:`.tabbed-labels, .md-typeset .tabbed-set`,tocSelector:`.md-sidebar--secondary .md-nav, [class*="toc"]`,feedbackSelector:`[class*="feedback"], [class*="helpful"]`},vitepress:{searchSelector:`.VPNavBarSearch button, .VPNavBarSearchButton, #local-search`,copyButtonSelector:`button.copy, .vp-code-copy, button.copy[title*="Copy"]`,codeBlockSelector:`div[class*="language-"], pre, [class*="code"]`,navigationSelector:`nav, [role="navigation"], .VPNav, .VPSidebar, [class*="nav"], [class*="sidebar"]`,footerSelector:`footer, [role="contentinfo"], .VPFooter, [class*="footer"]`,contentSelector:`main, article, [role="main"], .VPContent, [class*="content"]`,tabContainerSelector:`.vp-code-group .tabs, [role="tablist"]`,tocSelector:`.VPDocAsideOutline, .VPLocalNavOutlineDropdown, a.outline-link`,feedbackSelector:`[class*="feedback"], [class*="helpful"]`},starlight:{searchSelector:`site-search button[data-open-modal], sl-doc-search .DocSearch-Button, button[aria-label*="search" i]`,copyButtonSelector:`.expressive-code .copy button, .copy button[data-code]`,codeBlockSelector:`.expressive-code pre, pre`,navigationSelector:`nav, [role="navigation"], [class*="sidebar"]`,footerSelector:`footer, [role="contentinfo"], [class*="footer"]`,contentSelector:`main, .sl-markdown-content, [role="main"]`,tabContainerSelector:`starlight-tabs [role="tablist"], [role="tablist"]`,tocSelector:`.right-sidebar-panel, starlight-toc, mobile-starlight-toc`,feedbackSelector:`[class*="feedback"], [class*="helpful"]`}},_=[`searchSelector`,`copyButtonSelector`,`codeBlockSelector`,`navigationSelector`,`footerSelector`,`contentSelector`,`tabContainerSelector`,`tocSelector`,`feedbackSelector`];function te(){let e=g[h.framework];e?_.forEach(t=>{h[t]||(h[t]=e[t])}):h.framework!==`custom`&&h.debug&&console.warn(`[Do11y] Unknown framework "${h.framework}". Falling back to generic selectors. Supported: `+Object.keys(g).join(`, `)+`, custom`);let t=g.mintlify;t&&_.forEach(e=>{h[e]||(h[e]=t[e])})}function v(){if(h.respectDNT&&(navigator.doNotTrack===`1`||navigator.doNotTrack===`yes`||window.doNotTrack===`1`))return h.debug&&console.log(`[Do11y] Disabled: Do Not Track is enabled`),!0;if(h.allowedDomains&&h.allowedDomains.length>0){let e=window.location.hostname;if(!h.allowedDomains.some(t=>e===t||e.endsWith(`.`+t)))return h.debug&&console.log(`[Do11y] Disabled: Domain not allowed:`,e),!0}return!1}function y(e){if(!e||typeof e!=`string`)return null;try{return document.querySelector(e),e}catch{return h.debug&&console.warn(`[Do11y] Invalid CSS selector rejected:`,e),null}}function b(e){if(typeof e.className==`string`)return e.className;let t=e.className;return t&&typeof t.baseVal==`string`?t.baseVal:``}function x(e){let t=e.match(/(?:^|\s)language-([\w-]+)(?:\s|$)/);return t?t[1]:null}function ne(e){if(!e)return`unknown`;let t=e;for(let e=0;t&&e<12;e++,t=t.parentElement){for(let e of[`language`,`data-language`,`data-lang`,`data-code-lang`]){let n=t.getAttribute(e);if(n)return n}let e=x(b(t));if(e)return e;let n=t.querySelector(`:scope > span.lang`)?.textContent?.trim();if(n)return n;let r=t.querySelector(`[data-language], [data-lang], [data-code-lang], [class*="language-"], [language]`);if(r){let e=r.getAttribute(`language`)??r.getAttribute(`data-language`)??r.getAttribute(`data-lang`)??r.getAttribute(`data-code-lang`)??x(b(r));if(e)return e}}return`unknown`}function re(e){if(e.startsWith(`#`))return e;let t=e.indexOf(`#`);if(t===-1)return null;let n=e.slice(0,t);return!n||n===window.location.pathname||n===`${window.location.pathname}${window.location.search}`?e.slice(t):null}function ie(e){let t=y(h.tocSelector)??`.table-of-contents, .VPDocAsideOutline, .VPLocalNavOutlineDropdown, [class*="toc"], [class*="TableOfContents"], [class*="page-outline"], .right-sidebar-panel, starlight-toc`,n=e.closest(t);return n?((n===e||n.tagName===`A`)&&(n=e.closest(`.VPDocAsideOutline, .VPLocalNavOutlineDropdown, nav, aside, .right-sidebar-panel, starlight-toc`)??n.parentElement),n):null}function S(e,t){if(!e||typeof e!=`string`)return null;let n=t??100,r=e;return r=r.replace(/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g,`[email]`),r=r.replace(/\b\d{3}[-.]?\d{3}[-.]?\d{4}\b/g,`[phone]`),r=r.replace(/\b\d{3}-\d{2}-\d{4}\b/g,`[redacted]`),r=r.replace(/\b(?:\d[ -]?){13,19}\b/g,`[card]`),r=r.replace(/eyJ[A-Za-z0-9_-]+\.eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g,`[token]`),r=r.replace(/\bxa[a-z]{2}-[A-Za-z0-9_-]{20,}/g,`[token]`),r=r.replace(/\b[0-9a-fA-F]{32,}\b/g,`[redacted]`),r.trim().substring(0,n)}function ae(){if(window.crypto&&typeof window.crypto.randomUUID==`function`)return window.crypto.randomUUID();if(window.crypto&&typeof window.crypto.getRandomValues==`function`){let e=new Uint8Array(16);window.crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``);return t.slice(0,8)+`-`+t.slice(8,12)+`-`+t.slice(12,16)+`-`+t.slice(16,20)+`-`+t.slice(20)}return`no-crypto-00-0000-0000-000000000000`}function oe(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.id==`string`&&t.id.length>0&&typeof t.startTime==`string`&&Array.isArray(t.pageSequence)&&typeof t.pageCount==`number`}function C(){let e=null;try{let t=sessionStorage.getItem(`do11y_session`);if(t){let n=JSON.parse(t);oe(n)&&(e=n)}}catch{}return e||(e={id:ae(),startTime:new Date().toISOString(),pageSequence:[],pageCount:0,referrerCategory:null,aiPlatform:null},w(e)),e}function w(e){try{sessionStorage.setItem(`do11y_session`,JSON.stringify(e))}catch{}}function T(e){let t=C();return t.pageCount++,t.pageSequence.push({path:e,timestamp:new Date().toISOString(),index:t.pageCount}),t.pageSequence.length>50&&(t.pageSequence=t.pageSequence.slice(-50)),w(t),t}function se(){return{"browser.do11y.viewport_category":ce(),"browser.family":le(),"device.type":ue(),"browser.language":(navigator.language||``).split(`-`)[0]||`unknown`,"browser.do11y.timezone_offset":new Date().getTimezoneOffset()/60}}function ce(){let e=window.innerWidth;return e<640?`mobile`:e<1024?`tablet`:e<1440?`desktop`:`large-desktop`}function le(){let e=navigator.userAgent;return e.includes(`Firefox`)?`Firefox`:e.includes(`Edg`)?`Edge`:e.includes(`Chrome`)?`Chrome`:e.includes(`Safari`)?`Safari`:`Other`}function ue(){let e=navigator.userAgent;return/Mobile|Android|iPhone|iPad/.test(e)?/iPad|Tablet/.test(e)?`tablet`:`mobile`:`desktop`}let de=[{match:`chatgpt`,platform:`ChatGPT`},{match:`chat.com`,platform:`ChatGPT`},{match:`openai`,platform:`ChatGPT`},{match:`perplexity`,platform:`Perplexity`},{match:`claude.ai`,platform:`Claude`},{match:`anthropic`,platform:`Claude`},{match:`gemini`,platform:`Gemini`},{match:`copilot`,platform:`Copilot`},{match:`deepseek`,platform:`DeepSeek`},{match:`meta.ai`,platform:`Meta AI`},{match:`grok`,platform:`Grok`},{match:`x.ai`,platform:`Grok`},{match:`mistral`,platform:`Mistral`},{match:`you.com`,platform:`You.com`},{match:`phind`,platform:`Phind`}];function fe(e){if(!e||e===`direct`)return{referrerCategory:`direct`,aiPlatform:null};if(e===`internal`)return{referrerCategory:`internal`,aiPlatform:null};if(e===`unknown`)return{referrerCategory:`unknown`,aiPlatform:null};let t=e.toLowerCase();for(let e of de)if(t.indexOf(e.match)!==-1)return{referrerCategory:`ai`,aiPlatform:e.platform};return/google\.|bing\.|baidu\.|yandex\.|duckduckgo\.|yahoo\./.test(t)?{referrerCategory:`search-engine`,aiPlatform:null}:/github\.|gitlab\.|bitbucket\./.test(t)?{referrerCategory:`code-host`,aiPlatform:null}:/stackoverflow\.|stackexchange\.|reddit\.|news\.ycombinator\./.test(t)?{referrerCategory:`community`,aiPlatform:null}:/twitter\.|x\.com|linkedin\.|facebook\.|threads\.net/.test(t)?{referrerCategory:`social`,aiPlatform:null}:{referrerCategory:`other`,aiPlatform:null}}function pe(){try{if(!document.referrer)return`direct`;let e=new URL(document.referrer);return e.hostname===window.location.hostname?`internal`:e.hostname}catch{return`unknown`}}function me(){return{"url.path":window.location.pathname,"url.fragment":window.location.hash||null,"url.query":window.location.search?`has_params`:null,"browser.do11y.page_title":S(document.title,150)}}let E=[],D=null,O={},k=!1;function A(e,t){if(k)return;let n=Date.now();if(h.rateLimitMs>0&&O[e]&&n-O[e]<h.rateLimitMs){h.debug&&console.log(`[Do11y] Rate limited:`,e);return}O[e]=n;let r=C(),i={_time:new Date().toISOString(),eventName:e,"browser.do11y.version":m,"session.id":r.id,"browser.do11y.session_page_count":r.pageCount,...me(),...se(),...t};if(h.debug&&console.log(`[Do11y] Event queued:`,e,i),h.destination===`otlp`&&j){j.emit({eventName:e,severityNumber:9,attributes:i,body:``});return}E.push(i),E.length>100&&(E=E.slice(-100),h.debug&&console.warn(`[Do11y] Event queue capped at 100 events`)),E.length>=h.maxBatchSize?F():he()}function he(){D||=setTimeout(F,h.flushInterval)}let j=null;function ge(e){try{let t=new URL(e);return!(t.protocol!==`https:`||!t.hostname.endsWith(`.supabase.co`))}catch{return!1}}function _e(e){try{let t=new URL(e);if(t.protocol!==`https:`)return!1;let n=t.hostname;return!(n===`localhost`||n===`127.0.0.1`||n===`::1`||/^(10\.|172\.(1[6-9]|2\d|3[01])\.|192\.168\.)/.test(n))}catch{return!1}}function M(){return h.destination===`supabase`?h.supabaseUrl?ge(h.supabaseUrl)?!h.supabaseKey||typeof h.supabaseKey!=`string`||h.supabaseKey.length<10?(h.debug&&console.warn(`[Do11y] Invalid or missing Supabase publishable key`),!1):/^[a-zA-Z0-9_-]+$/.test(h.supabaseTable)?!0:(h.debug&&console.warn(`[Do11y] Invalid table name`),!1):(h.debug&&console.warn(`[Do11y] Invalid Supabase URL. Must be https://<project>.supabase.co`),!1):(h.debug&&console.warn(`[Do11y] No Supabase URL configured`),!1):h.destination===`http`?h.endpoint?_e(h.endpoint)?!0:(h.debug&&console.warn(`[Do11y] Invalid HTTP endpoint. Must be HTTPS and not a private address.`),!1):(h.debug&&console.warn(`[Do11y] No HTTP endpoint configured`),!1):h.destination===`otlp`?h.otelSdkEndpoint?(N().catch(e=>{h.debug&&console.warn(`[Do11y] OTel SDK initialization failed:`,e)}),!0):(h.debug&&console.warn(`[Do11y] No OTLP endpoint configured`),!1):(h.debug&&console.warn(`[Do11y] Unknown destination:`,h.destination),!1)}async function N(){if(j)return;let e=h.otelSdkCdnUrl.replace(/\/+$/,``)+`/`,t=await import(`${e}@opentelemetry/api-logs`),n=await import(`${e}@opentelemetry/sdk-logs`),r=await import(`${e}@opentelemetry/exporter-logs-otlp-http`),i={"service.name":h.otelSdkServiceName||`do11y`,"service.version":m,"telemetry.sdk.name":`do11y`,"telemetry.sdk.language":`webjs`,"telemetry.sdk.version":m,...h.otelSdkResourceAttributes},a=new n.LoggerProvider({resource:{attributes:i},processors:[new n.BatchLogRecordProcessor({exporter:new r.OTLPLogExporter({url:h.otelSdkEndpoint.replace(/\/$/,``)+`/v1/logs`,headers:h.otelSdkHeaders})})]});t.logs.setGlobalLoggerProvider(a),j=a.getLogger(`do11y`),h.debug&&console.log(`[Do11y] OTel SDK initialized with endpoint:`,h.otelSdkEndpoint)}function P(e){if(h.destination===`supabase`){let t=h.supabaseUrl.replace(/\/$/,``)+`/rest/v1/`+h.supabaseTable,n=h.bodyTransform??(e=>e.map(e=>({payload:e})));return{url:t,headers:{apikey:h.supabaseKey,Authorization:`Bearer `+h.supabaseKey,"Content-Type":`application/json`,Prefer:`return=minimal`},body:JSON.stringify(n(e))}}let t=h.bodyTransform??(e=>e);return{url:h.endpoint,headers:{"Content-Type":`application/json`,...h.headers},body:JSON.stringify(t(e))}}function F(e){if(D&&=(clearTimeout(D),null),E.length===0||!M())return;let t=typeof e==`number`?e:h.maxRetries,n=E.slice();E=[],ve(P(n),n,t)}function I(e){try{return new URL(e).origin!==window.location.origin}catch{return!1}}function ve(e,t,n){let r=I(e.url);h.debug&&r&&console.log(`[Do11y] Cross-origin request to`,new URL(e.url).origin,`- requires CORS headers on the server`),fetch(e.url,{method:`POST`,headers:e.headers,body:e.body,keepalive:!0,mode:r?`cors`:`same-origin`}).then(e=>{if(e.ok){h.debug&&console.log(`[Do11y] Flushed`,t.length,`events`);return}if(n>0&&(e.status>=500||e.status===429)){h.debug&&console.log(`[Do11y] Retrying after error:`,e.status),E=t.concat(E),setTimeout(()=>{F(n-1)},h.retryDelay*(h.maxRetries-n+1));return}h.debug&&e.text().then(t=>{let n=`[Do11y] Ingest failed: ${e.status}`;e.status===0&&e.type===`opaque`?console.error(n,`- CORS error: server did not return Access-Control-Allow-Origin`):console.error(n,t)}).catch(()=>{})}).catch(e=>{if(n>0){if(h.debug){let t=r?` (this may be a CORS issue — try using an OTel Collector proxy)`:``;console.log(`[Do11y] Network error, retrying:`,e.message+t)}E=t.concat(E),setTimeout(()=>{F(n-1)},h.retryDelay*(h.maxRetries-n+1))}else h.debug&&console.error(`[Do11y] Failed to send events:`,e.message)})}function ye(){if(h.destination===`otlp`||E.length===0||!M())return;let e=E;E=[];let t=P(e);try{fetch(t.url,{method:`POST`,headers:t.headers,body:t.body,keepalive:!0})}catch{}h.debug&&console.log(`[Do11y] Sync flushed`,e.length,`events`)}function L(){let n=T(window.location.pathname),r=pe(),i=fe(r);n.pageCount===1&&(n.referrerCategory=i.referrerCategory,n.aiPlatform=i.aiPlatform,w(n)),A(`browser.do11y.page_view`,{"browser.do11y.referrer_domain":r,[e]:i.referrerCategory,[t]:i.aiPlatform,"browser.do11y.is_first_page":n.pageCount===1,"browser.do11y.previous_path":n.pageSequence.length>1?n.pageSequence[n.pageSequence.length-2].path:null})}function be(){document.addEventListener(`click`,e=>{let t=e.target.closest(`a`);if(!t)return;let n=t.getAttribute(`href`);if(!n)return;let r=`other`,i=null;try{if(n.startsWith(`#`))r=`anchor`;else if(n.startsWith(`/`)||n.startsWith(`./`)||n.startsWith(`../`))r=`internal`;else if(n.startsWith(`http`)){let e=new URL(n);e.hostname===window.location.hostname?r=`internal`:(r=`external`,i=e.hostname)}else n.startsWith(`mailto:`)&&(r=`email`)}catch{}r===`internal`&&!h.trackInternalLinks||r===`external`&&!h.trackOutboundLinks||(A(`browser.do11y.link_click`,{"browser.do11y.link.type":r,"browser.do11y.link.target_url":n,"browser.do11y.link.target_domain":i,"browser.do11y.link.text":S(t.textContent,100),"browser.do11y.link.context":xe(t),"browser.do11y.link.section":S(R(t),100),"browser.do11y.link.index":Se(t,n)}),F())},!0)}function xe(e){return e.closest(h.navigationSelector)?`navigation`:e.closest(h.footerSelector)?`footer`:e.closest(h.contentSelector)?`content`:`other`}function R(e){let t=e;for(;t&&t!==document.body;){let e=t.previousElementSibling;for(;e;){if(/^H[1-6]$/.test(e.tagName))return e.textContent?.trim().substring(0,100)??null;let t=e.querySelectorAll(`h1, h2, h3, h4, h5, h6`);if(t.length>0)return t[t.length-1].textContent?.trim().substring(0,100)??null;e=e.previousElementSibling}t=t.parentElement}return null}function Se(e,t){if(typeof CSS>`u`||typeof CSS.escape!=`function`)return 1;try{let n=document.querySelectorAll(`a[href="`+CSS.escape(t)+`"]`);for(let t=0;t<n.length;t++)if(n[t]===e)return t+1}catch{}return 1}let z=new Set,B=null;function Ce(e){let t=e;for(;t&&t!==document.body&&t!==document.documentElement;){let e=window.getComputedStyle(t).overflowY;if((e===`auto`||e===`scroll`)&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return null}function we(){if(!h.trackScrollDepth)return;if(h.contentSelector){let e=document.querySelector(h.contentSelector);e&&(B=Ce(e))}let e=!1;function t(){e||=(window.requestAnimationFrame(()=>{V(),e=!1}),!0)}if(window.addEventListener(`scroll`,t),B&&(B.addEventListener(`scroll`,t),h.debug)){let e=B;console.log(`[do11y] Using container-based scroll tracking:`,e.className||e.tagName)}V()}function V(){let e,t,i;B&&B.scrollHeight>B.clientHeight?(e=B.scrollTop,t=B.scrollHeight,i=B.clientHeight):(e=window.scrollY||document.documentElement.scrollTop,t=document.documentElement.scrollHeight,i=window.innerHeight);let a=t-i;if(a<=0){h.scrollThresholds.forEach(e=>{z.has(e)||(z.add(e),A(u,{[n]:e,[r]:100}))});return}let o=Math.round(e/a*100);h.scrollThresholds.forEach(e=>{o>=e&&!z.has(e)&&(z.add(e),A(u,{[n]:e,[r]:o}))})}let H=Date.now(),U=Date.now(),W=0,G=!0;function K(){G&&(W+=Date.now()-U);let n=Date.now()-H,r=n>0?W/n:0,i=0;z.forEach(e=>{e>i&&(i=e)}),X();let a=C();A(`browser.do11y.page_exit`,{"browser.do11y.page_exit.total_time_seconds":Math.round(n/1e3),"browser.do11y.page_exit.active_time_seconds":Math.round(W/1e3),"browser.do11y.page_exit.engagement_ratio":Math.round(r*100)/100,"browser.do11y.page_exit.max_scroll_depth":i,[e]:a.referrerCategory,[t]:a.aiPlatform})}function Te(){document.addEventListener(`visibilitychange`,()=>{document.hidden?G&&=(W+=Date.now()-U,!1):(U=Date.now(),G=!0)}),window.addEventListener(`beforeunload`,()=>{K(),Ne()})}function Ee(){document.addEventListener(`click`,e=>{e.target.closest(h.searchSelector)&&A(d,{})},!0),document.addEventListener(`keydown`,e=>{(e.metaKey||e.ctrlKey)&&e.key===`k`&&A(d,{"browser.do11y.search.trigger":`keyboard`})})}function De(e){if(!e)return 1;try{let t=document.querySelectorAll(h.codeBlockSelector);for(let n=0;n<t.length;n++)if(t[n]===e)return n+1}catch{}return 1}function Oe(){document.addEventListener(`click`,e=>{let t=e.target.closest(h.copyButtonSelector);if(t){let e=t.closest(`[class*="language-"], [language]`)??t.closest(h.codeBlockSelector)??t.closest(`.expressive-code`)?.querySelector(`pre`)??t.closest(`div, section`)?.querySelector(`pre`)??t.parentElement?.querySelector(`pre`)??null,n=ne((e?e.tagName===`PRE`?e.querySelector(`code`):e.querySelector(`code[class*="language-"], code[language]`)??e.querySelector(`code`):null)??e??t);A(`browser.do11y.code_copied`,{"browser.do11y.code.language":n,"browser.do11y.code.section":S(R(e??t),100),"browser.do11y.code.index":De(e)})}},!0)}let q=null,J={};function ke(){if(!h.trackSectionVisibility||typeof IntersectionObserver>`u`)return;let e=h.sectionVisibleThreshold*1e3;q=new IntersectionObserver(t=>{t.forEach(t=>{let n=t.target.getAttribute(`data-do11y-section-id`);if(n)if(t.isIntersecting)J[n]||(J[n]={start:Date.now(),reported:!1});else{if(J[n]&&!J[n].reported){let r=Date.now()-J[n].start;if(r>=e){let e=t.target.textContent?.trim()??``;A(f,{[i]:S(e,100),[a]:parseInt(t.target.tagName.charAt(1),10),[o]:Math.round(r/1e3)}),J[n].reported=!0}}delete J[n]}})},{threshold:.5}),Y()}function Y(){q&&document.querySelectorAll(`h2, h3`).forEach((e,t)=>{e.setAttribute(`data-do11y-section-id`,`section-`+t),q.observe(e)})}function X(){if(!q)return;let e=Date.now(),t=h.sectionVisibleThreshold*1e3;Object.keys(J).forEach(n=>{let r=J[n];if(r&&!r.reported){let s=e-r.start;if(s>=t){let e=typeof CSS<`u`&&typeof CSS.escape==`function`?CSS.escape(n):n.replace(/["\\]/g,`\\$&`),t=document.querySelector(`[data-do11y-section-id="`+e+`"]`);t&&A(f,{[i]:S(t.textContent?.trim()??``,100),[a]:parseInt(t.tagName.charAt(1),10),[o]:Math.round(s/1e3)})}}}),J={}}function Ae(){h.trackTabSwitches&&document.addEventListener(`click`,e=>{let t=`[role="tab"], .tabs button, .tabs a, .tabbed-labels label`,n=y(h.tabContainerSelector);n&&(t+=`, `+n+` button, `+n+` a, `+n+` label`);let r=e.target.closest(t);if(!r||r.getAttribute(`aria-selected`)===`true`||r.classList.contains(`active`)||r.classList.contains(`is-active`))return;let i=S(r.textContent,50);if(!i)return;let a=S(R(r),100);A(`browser.do11y.tab_switch`,{"browser.do11y.tab.label":i,"browser.do11y.tab.group":a,"browser.do11y.tab.is_default":!1})})}function je(){h.trackTocClicks&&document.addEventListener(`click`,e=>{let t=e.target.closest(`a`);if(!t)return;let n=ie(t);if(!n)return;let r=t.getAttribute(`href`),i=r?re(r):null;if(!i)return;let a=S(t.textContent,100),o=null;try{let e=i.slice(1),t=document.getElementById(e);t&&/^H[1-6]$/.test(t.tagName)&&(o=parseInt(t.tagName.charAt(1),10))}catch{}let s=n.querySelectorAll(`a[href*="#"]`),c=1;for(let e=0;e<s.length;e++)if(s[e]===t){c=e+1;break}A(`browser.do11y.toc_click`,{"browser.do11y.toc.heading":a,"browser.do11y.toc.heading_level":o,"browser.do11y.toc.position":c})},!0)}function Me(){h.trackFeedback&&document.addEventListener(`click`,e=>{let t=e.target.closest(`button, [role="button"], a`);if(!t||!t.closest(y(h.feedbackSelector)??`[class*="feedback"], [class*="helpful"], [class*="rating"], [class*="was-this"], [data-feedback]`))return;let n=(t.textContent??``).trim().toLowerCase(),r=(t.getAttribute(`aria-label`)??``).toLowerCase(),i=(t.getAttribute(`title`)??``).toLowerCase(),a=t.getAttribute(`data-value`)??t.getAttribute(`data-md-value`)??t.getAttribute(`data-feedback`),o=a&&/^[\w\s.,!?-]{1,50}$/.test(a)?a:null,s=null;o?s=o:/\byes\b|👍|thumbs.?up|helpful/i.test(n+` `+r+` `+i)?s=`yes`:/\bno\b|👎|thumbs.?down|not.?helpful/i.test(n+` `+r+` `+i)&&(s=`no`),s&&A(`browser.do11y.feedback`,{"browser.do11y.feedback.rating":s})})}function Z(){h.trackExpandCollapse&&(document.addEventListener(`toggle`,e=>{let t=e.target;if(t.tagName!==`DETAILS`)return;let n=t.querySelector(`summary`),r=S(n?n.textContent:``,100);A(p,{[s]:r,[c]:t.open?`expand`:`collapse`,[l]:S(R(t),100)})},!0),document.addEventListener(`click`,e=>{let t=e.target.closest(`[aria-expanded], [class*="accordion"] button, [class*="collapsible"] button`);if(!t||t.closest(`details`)||t.closest(`nav, [role="navigation"], header`))return;let n=t.getAttribute(`aria-expanded`)===`true`;A(p,{[s]:S(t.textContent,100),[c]:n?`collapse`:`expand`,[l]:S(R(t),100)})}))}let Q=null;function $(){if(window.Do11yConfig&&typeof window.Do11yConfig==`object`)for(let e in window.Do11yConfig)Object.prototype.hasOwnProperty.call(window.Do11yConfig,e)&&Object.prototype.hasOwnProperty.call(h,e)&&(h[e]=window.Do11yConfig[e]);let e=document.querySelector(`meta[name="do11y-destination"]`);if(e){let t=e.getAttribute(`content`);(t===`supabase`||t===`http`||t===`otlp`)&&(h.destination=t)}let t=document.querySelector(`meta[name="do11y-url"]`);t&&(h.supabaseUrl=t.getAttribute(`content`)??h.supabaseUrl);let n=document.querySelector(`meta[name="do11y-key"]`);n&&(h.supabaseKey=n.getAttribute(`content`)??h.supabaseKey);let r=document.querySelector(`meta[name="do11y-table"]`);r&&(h.supabaseTable=r.getAttribute(`content`)??h.supabaseTable);let i=document.querySelector(`meta[name="do11y-endpoint"]`);i&&(h.endpoint=i.getAttribute(`content`)??h.endpoint);let a=document.querySelector(`meta[name="do11y-otlp-endpoint"]`);a&&(h.otelSdkEndpoint=a.getAttribute(`content`)??h.otelSdkEndpoint);let o=document.querySelector(`meta[name="do11y-otlp-headers"]`);if(o)try{let e=JSON.parse(o.getAttribute(`content`)??`{}`);typeof e==`object`&&e&&(h.otelSdkHeaders=e)}catch{}let s=document.querySelector(`meta[name="do11y-debug"]`);s&&s.getAttribute(`content`)===`true`&&(h.debug=!0);let c=document.querySelector(`meta[name="do11y-domains"]`);if(c){let e=c.getAttribute(`content`);e&&(h.allowedDomains=e.split(`,`).map(e=>e.trim()))}let l=document.querySelector(`meta[name="do11y-framework"]`);l&&(h.framework=l.getAttribute(`content`)??h.framework);let u=document.querySelector(`meta[name="do11y-use-otel-instrumentations"]`);if(u&&u.getAttribute(`content`)===`true`&&(h.useOtelBrowserInstrumentations=!0),te(),h.debug){let e=h.destination===`supabase`?!!h.supabaseKey:h.destination===`otlp`?!!h.otelSdkEndpoint:!!h.endpoint;console.log(`[Do11y] Initializing with config:`,{destination:h.destination,hasCredentials:e,framework:h.framework,allowedDomains:h.allowedDomains,respectDNT:h.respectDNT})}if(v()){k=!0,h.debug&&console.log(`[Do11y] Tracking disabled`);return}(h.destination===`supabase`?h.supabaseKey:h.destination===`otlp`?h.otelSdkEndpoint:h.endpoint)||h.debug&&(console.warn(`[Do11y] No destination configured. Events will not be sent.`),h.destination===`supabase`?console.warn(`[Do11y] Add <meta name="do11y-url"> and <meta name="do11y-key"> to enable.`):h.destination===`otlp`?console.warn(`[Do11y] Add <meta name="do11y-otlp-endpoint"> to enable.`):console.warn(`[Do11y] Add <meta name="do11y-endpoint"> to enable.`)),L(),be(),we(),Te(),Ee(),Oe(),ke(),Ae(),je(),Me(),Z();let d=window.location.pathname;Q=new MutationObserver(()=>{window.location.pathname!==d&&(d=window.location.pathname,K(),z=new Set,H=Date.now(),U=Date.now(),W=0,G=!0,L(),Y(),V())}),Q.observe(document.body,{childList:!0,subtree:!0}),window.addEventListener(`popstate`,()=>{window.location.pathname!==d&&(d=window.location.pathname,K(),z=new Set,H=Date.now(),U=Date.now(),W=0,G=!0,L(),Y(),V())}),Object.freeze(h),h.debug&&console.log(`[Do11y] Initialized successfully`)}function Ne(){Q&&=(Q.disconnect(),null),q&&=(X(),q.disconnect(),null),D&&=(clearTimeout(D),null),ye()}ee||(document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,$):$()),window.Do11y=window.Do11y??{getConfig:()=>({destination:h.destination,hasCredentials:h.destination===`supabase`?!!h.supabaseKey:h.destination===`otlp`?!!h.otelSdkEndpoint:!!h.endpoint,isDisabled:k,allowedDomains:h.allowedDomains,respectDNT:h.respectDNT}),flush:F,isEnabled:()=>k?!1:h.destination===`supabase`?!!h.supabaseKey:h.destination===`otlp`?!!h.otelSdkEndpoint:!!h.endpoint,getQueueSize:()=>E.length,version:m}})();
|
|
1
|
+
(function(){let e=`browser.do11y.referrer_category`,t=`browser.do11y.ai_platform`,n=`browser.do11y.scroll.threshold`,r=`browser.do11y.scroll.percent`,i=`browser.do11y.section.heading`,a=`browser.do11y.section.heading_level`,o=`browser.do11y.section.visible_seconds`,s=`browser.do11y.expand.summary`,c=`browser.do11y.expand.action`,l=`browser.do11y.expand.section`,u=`browser.do11y.scroll_depth`,d=`browser.do11y.search_opened`,f=`browser.do11y.section_visible`,p=`browser.do11y.expand_collapse`,m=`0.1.1`,h=!!window.__do11yInitialized;window.__do11yInitialized=!0;let g=window.self!==window.top;g&&!h&&(window.__do11yInitialized=!1);let _={destination:`supabase`,supabaseUrl:``,supabaseKey:``,supabaseTable:`do11y_events`,endpoint:``,headers:{},bodyTransform:void 0,otelSdkEndpoint:``,otelSdkHeaders:{},otelSdkServiceName:`do11y`,otelSdkResourceAttributes:{},otelSdkCdnUrl:`https://esm.sh/`,debug:!1,flushInterval:5e3,maxBatchSize:10,trackOutboundLinks:!0,trackInternalLinks:!0,trackScrollDepth:!0,scrollThresholds:[25,50,75,90],allowedDomains:null,respectDNT:!0,maxRetries:2,retryDelay:1e3,rateLimitMs:100,framework:`mintlify`,trackSectionVisibility:!0,sectionVisibleThreshold:3,trackTabSwitches:!0,trackTocClicks:!0,trackExpandCollapse:!0,trackFeedback:!0,tabContainerSelector:null,tocSelector:null,feedbackSelector:null,searchSelector:null,copyButtonSelector:null,codeBlockSelector:null,navigationSelector:null,footerSelector:null,contentSelector:null,useOtelBrowserInstrumentations:!1},v={mintlify:{searchSelector:`#search-bar-entry, #search-bar-entry-mobile, [class*="search"]`,copyButtonSelector:`button[class*="copy"], button[aria-label*="copy" i]`,codeBlockSelector:`pre, [class*="code"]`,navigationSelector:`nav, [role="navigation"], #navbar, #sidebar, [class*="nav"], [class*="sidebar"]`,footerSelector:`footer, [role="contentinfo"], [class*="footer"]`,contentSelector:`main, article, [role="main"], [class*="content"]`,tabContainerSelector:`[role="tablist"], [class*="tab"]`,tocSelector:`#table-of-contents, [data-testid="table-of-contents"], [class*="table-of-contents"], [class*="toc"]`,feedbackSelector:`[class*="feedback"], [class*="helpful"]`},docusaurus:{searchSelector:`.DocSearch, .DocSearch-Button`,copyButtonSelector:`button.clean-btn[aria-label*="copy" i], button[class*="copyButton"]`,codeBlockSelector:`pre, [class*="code"]`,navigationSelector:`nav, [role="navigation"], .navbar, .sidebar, [class*="nav"], [class*="sidebar"]`,footerSelector:`footer, [role="contentinfo"], [class*="footer"]`,contentSelector:`main, article, [role="main"], [class*="content"]`,tabContainerSelector:`.tabs[role="tablist"], [class*="tabs"]`,tocSelector:`.table-of-contents, [class*="toc"]`,feedbackSelector:`[class*="feedback"], [class*="helpful"]`},nextra:{searchSelector:`.nextra-search input, input[placeholder*="search" i], button[aria-label*="search" i]`,copyButtonSelector:`button[class*="copy"], button[aria-label*="copy" i], button[title*="copy" i]`,codeBlockSelector:`pre, [class*="code"]`,navigationSelector:`nav, [role="navigation"], [class*="nav"], [class*="sidebar"]`,footerSelector:`footer, [role="contentinfo"], [class*="footer"]`,contentSelector:`main, article, [role="main"], [class*="content"]`,tabContainerSelector:`[role="tablist"], [class*="tab"]`,tocSelector:`.nextra-toc, [class*="toc"]`,feedbackSelector:`[class*="feedback"], [class*="helpful"]`},"mkdocs-material":{searchSelector:`.md-search__input`,copyButtonSelector:`.md-clipboard, .md-code__button[title="Copy to clipboard"]`,codeBlockSelector:`pre, code, [class*="code"]`,navigationSelector:`nav, [role="navigation"], .md-nav, .md-sidebar`,footerSelector:`footer, [role="contentinfo"], .md-footer`,contentSelector:`main, article, [role="main"], .md-content`,tabContainerSelector:`.tabbed-labels, .md-typeset .tabbed-set`,tocSelector:`.md-sidebar--secondary .md-nav, [class*="toc"]`,feedbackSelector:`[class*="feedback"], [class*="helpful"]`},vitepress:{searchSelector:`.VPNavBarSearch button, .VPNavBarSearchButton, #local-search`,copyButtonSelector:`button.copy, .vp-code-copy, button.copy[title*="Copy"]`,codeBlockSelector:`div[class*="language-"], pre, [class*="code"]`,navigationSelector:`nav, [role="navigation"], .VPNav, .VPSidebar, [class*="nav"], [class*="sidebar"]`,footerSelector:`footer, [role="contentinfo"], .VPFooter, [class*="footer"]`,contentSelector:`main, article, [role="main"], .VPContent, [class*="content"]`,tabContainerSelector:`.vp-code-group .tabs, [role="tablist"]`,tocSelector:`.VPDocAsideOutline, .VPLocalNavOutlineDropdown, a.outline-link`,feedbackSelector:`[class*="feedback"], [class*="helpful"]`},starlight:{searchSelector:`site-search button[data-open-modal], sl-doc-search .DocSearch-Button, button[aria-label*="search" i]`,copyButtonSelector:`.expressive-code .copy button, .copy button[data-code]`,codeBlockSelector:`.expressive-code pre, pre`,navigationSelector:`nav, [role="navigation"], [class*="sidebar"]`,footerSelector:`footer, [role="contentinfo"], [class*="footer"]`,contentSelector:`main, .sl-markdown-content, [role="main"]`,tabContainerSelector:`starlight-tabs [role="tablist"], [role="tablist"]`,tocSelector:`.right-sidebar-panel, starlight-toc, mobile-starlight-toc`,feedbackSelector:`[class*="feedback"], [class*="helpful"]`},docsy:{searchSelector:`.td-search input, .td-search__input, #docsearch-0, #docsearch-1`,copyButtonSelector:`button[aria-label*="copy" i], button[title*="copy" i], .td-click-to-copy`,codeBlockSelector:`.highlight, pre.chroma, pre`,navigationSelector:`nav, [role="navigation"], .td-sidebar, .td-navbar, [class*="sidebar"]`,footerSelector:`footer, [role="contentinfo"], .td-footer, [class*="footer"]`,contentSelector:`main, article, [role="main"], .td-content, [class*="content"]`,tabContainerSelector:`.nav-tabs[role="tablist"], [role="tablist"], .tab-content`,tocSelector:`.td-toc, nav[id="TableOfContents"], [class*="toc"]`,feedbackSelector:`.feedback--answer, [class*="feedback"], [class*="helpful"]`}},y=[`searchSelector`,`copyButtonSelector`,`codeBlockSelector`,`navigationSelector`,`footerSelector`,`contentSelector`,`tabContainerSelector`,`tocSelector`,`feedbackSelector`];function ee(){let e=v[_.framework];e?y.forEach(t=>{_[t]||(_[t]=e[t])}):_.framework!==`custom`&&_.debug&&console.warn(`[Do11y] Unknown framework "${_.framework}". Falling back to generic selectors. Supported: `+Object.keys(v).join(`, `)+`, custom`);let t=v.mintlify;t&&y.forEach(e=>{_[e]||(_[e]=t[e])})}function b(){if(_.respectDNT&&(navigator.doNotTrack===`1`||navigator.doNotTrack===`yes`||window.doNotTrack===`1`))return _.debug&&console.log(`[Do11y] Disabled: Do Not Track is enabled`),!0;if(_.allowedDomains&&_.allowedDomains.length>0){let e=window.location.hostname;if(!_.allowedDomains.some(t=>e===t||e.endsWith(`.`+t)))return _.debug&&console.log(`[Do11y] Disabled: Domain not allowed:`,e),!0}return!1}function x(e){if(!e||typeof e!=`string`)return null;try{return document.querySelector(e),e}catch{return _.debug&&console.warn(`[Do11y] Invalid CSS selector rejected:`,e),null}}function S(e){if(typeof e.className==`string`)return e.className;let t=e.className;return t&&typeof t.baseVal==`string`?t.baseVal:``}function C(e){let t=e.match(/(?:^|\s)language-([\w-]+)(?:\s|$)/);return t?t[1]:null}function te(e){if(!e)return`unknown`;let t=e;for(let e=0;t&&e<12;e++,t=t.parentElement){for(let e of[`language`,`data-language`,`data-lang`,`data-code-lang`]){let n=t.getAttribute(e);if(n)return n}let e=C(S(t));if(e)return e;let n=t.querySelector(`:scope > span.lang`)?.textContent?.trim();if(n)return n;let r=t.querySelector(`[data-language], [data-lang], [data-code-lang], [class*="language-"], [language]`);if(r){let e=r.getAttribute(`language`)??r.getAttribute(`data-language`)??r.getAttribute(`data-lang`)??r.getAttribute(`data-code-lang`)??C(S(r));if(e)return e}}return`unknown`}function ne(e){if(e.startsWith(`#`))return e;let t=e.indexOf(`#`);if(t===-1)return null;let n=e.slice(0,t);return!n||n===window.location.pathname||n===`${window.location.pathname}${window.location.search}`?e.slice(t):null}function re(e){let t=x(_.tocSelector)??`.table-of-contents, .VPDocAsideOutline, .VPLocalNavOutlineDropdown, [class*="toc"], [class*="TableOfContents"], [class*="page-outline"], .right-sidebar-panel, starlight-toc`,n=e.closest(t);return n?((n===e||n.tagName===`A`)&&(n=e.closest(`.VPDocAsideOutline, .VPLocalNavOutlineDropdown, nav, aside, .right-sidebar-panel, starlight-toc`)??n.parentElement),n):null}function w(e,t){if(!e||typeof e!=`string`)return null;let n=t??100,r=e;return r=r.replace(/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g,`[email]`),r=r.replace(/\b\d{3}[-.]?\d{3}[-.]?\d{4}\b/g,`[phone]`),r=r.replace(/\b\d{3}-\d{2}-\d{4}\b/g,`[redacted]`),r=r.replace(/\b(?:\d[ -]?){13,19}\b/g,`[card]`),r=r.replace(/eyJ[A-Za-z0-9_-]+\.eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g,`[token]`),r=r.replace(/\bxa[a-z]{2}-[A-Za-z0-9_-]{20,}/g,`[token]`),r=r.replace(/\b[0-9a-fA-F]{32,}\b/g,`[redacted]`),r.trim().substring(0,n)}function ie(){if(window.crypto&&typeof window.crypto.randomUUID==`function`)return window.crypto.randomUUID();if(window.crypto&&typeof window.crypto.getRandomValues==`function`){let e=new Uint8Array(16);window.crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``);return t.slice(0,8)+`-`+t.slice(8,12)+`-`+t.slice(12,16)+`-`+t.slice(16,20)+`-`+t.slice(20)}return`no-crypto-00-0000-0000-000000000000`}function ae(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.id==`string`&&t.id.length>0&&typeof t.startTime==`string`&&Array.isArray(t.pageSequence)&&typeof t.pageCount==`number`}function T(){let e=null;try{let t=sessionStorage.getItem(`do11y_session`);if(t){let n=JSON.parse(t);ae(n)&&(e=n)}}catch{}return e||(e={id:ie(),startTime:new Date().toISOString(),pageSequence:[],pageCount:0,referrerCategory:null,aiPlatform:null},E(e)),e}function E(e){try{sessionStorage.setItem(`do11y_session`,JSON.stringify(e))}catch{}}function oe(e){let t=T();return t.pageCount++,t.pageSequence.push({path:e,timestamp:new Date().toISOString(),index:t.pageCount}),t.pageSequence.length>50&&(t.pageSequence=t.pageSequence.slice(-50)),E(t),t}function se(){return{"browser.do11y.viewport_category":ce(),"browser.family":le(),"device.type":ue(),"browser.language":(navigator.language||``).split(`-`)[0]||`unknown`,"browser.do11y.timezone_offset":new Date().getTimezoneOffset()/60}}function ce(){let e=window.innerWidth;return e<640?`mobile`:e<1024?`tablet`:e<1440?`desktop`:`large-desktop`}function le(){let e=navigator.userAgent;return e.includes(`Firefox`)?`Firefox`:e.includes(`Edg`)?`Edge`:e.includes(`Chrome`)?`Chrome`:e.includes(`Safari`)?`Safari`:`Other`}function ue(){let e=navigator.userAgent;return/Mobile|Android|iPhone|iPad/.test(e)?/iPad|Tablet/.test(e)?`tablet`:`mobile`:`desktop`}let de=[{match:`chatgpt`,platform:`ChatGPT`},{match:`chat.com`,platform:`ChatGPT`},{match:`openai`,platform:`ChatGPT`},{match:`perplexity`,platform:`Perplexity`},{match:`claude.ai`,platform:`Claude`},{match:`anthropic`,platform:`Claude`},{match:`gemini`,platform:`Gemini`},{match:`copilot`,platform:`Copilot`},{match:`deepseek`,platform:`DeepSeek`},{match:`meta.ai`,platform:`Meta AI`},{match:`grok`,platform:`Grok`},{match:`x.ai`,platform:`Grok`},{match:`mistral`,platform:`Mistral`},{match:`you.com`,platform:`You.com`},{match:`phind`,platform:`Phind`}];function fe(e){if(!e||e===`direct`)return{referrerCategory:`direct`,aiPlatform:null};if(e===`internal`)return{referrerCategory:`internal`,aiPlatform:null};if(e===`unknown`)return{referrerCategory:`unknown`,aiPlatform:null};let t=e.toLowerCase();for(let e of de)if(t.indexOf(e.match)!==-1)return{referrerCategory:`ai`,aiPlatform:e.platform};return/google\.|bing\.|baidu\.|yandex\.|duckduckgo\.|yahoo\./.test(t)?{referrerCategory:`search-engine`,aiPlatform:null}:/github\.|gitlab\.|bitbucket\./.test(t)?{referrerCategory:`code-host`,aiPlatform:null}:/stackoverflow\.|stackexchange\.|reddit\.|news\.ycombinator\./.test(t)?{referrerCategory:`community`,aiPlatform:null}:/twitter\.|x\.com|linkedin\.|facebook\.|threads\.net/.test(t)?{referrerCategory:`social`,aiPlatform:null}:{referrerCategory:`other`,aiPlatform:null}}function pe(){try{if(!document.referrer)return`direct`;let e=new URL(document.referrer);return e.hostname===window.location.hostname?`internal`:e.hostname}catch{return`unknown`}}function me(){return{"url.path":window.location.pathname,"url.fragment":window.location.hash||null,"url.query":window.location.search?`has_params`:null,"browser.do11y.page_title":w(document.title,150)}}let D=[],O=null,k={},A=!1;function j(e,t){if(A)return;let n=Date.now();if(_.rateLimitMs>0&&k[e]&&n-k[e]<_.rateLimitMs){_.debug&&console.log(`[Do11y] Rate limited:`,e);return}k[e]=n;let r=T(),i={_time:new Date().toISOString(),eventName:e,"browser.do11y.version":m,"session.id":r.id,"browser.do11y.session_page_count":r.pageCount,...me(),...se(),...t};if(_.debug&&console.log(`[Do11y] Event queued:`,e,i),_.destination===`otlp`&&M){M.emit({eventName:e,severityNumber:9,attributes:i,body:``});return}D.push(i),D.length>100&&(D=D.slice(-100),_.debug&&console.warn(`[Do11y] Event queue capped at 100 events`)),D.length>=_.maxBatchSize?F():he()}function he(){O||=setTimeout(F,_.flushInterval)}let M=null;function ge(e){try{let t=new URL(e);return!(t.protocol!==`https:`||!t.hostname.endsWith(`.supabase.co`))}catch{return!1}}function _e(e){try{let t=new URL(e);if(t.protocol!==`https:`)return!1;let n=t.hostname;return!(n===`localhost`||n===`127.0.0.1`||n===`::1`||/^(10\.|172\.(1[6-9]|2\d|3[01])\.|192\.168\.)/.test(n))}catch{return!1}}function N(){return _.destination===`supabase`?_.supabaseUrl?ge(_.supabaseUrl)?!_.supabaseKey||typeof _.supabaseKey!=`string`||_.supabaseKey.length<10?(_.debug&&console.warn(`[Do11y] Invalid or missing Supabase publishable key`),!1):/^[a-zA-Z0-9_-]+$/.test(_.supabaseTable)?!0:(_.debug&&console.warn(`[Do11y] Invalid table name`),!1):(_.debug&&console.warn(`[Do11y] Invalid Supabase URL. Must be https://<project>.supabase.co`),!1):(_.debug&&console.warn(`[Do11y] No Supabase URL configured`),!1):_.destination===`http`?_.endpoint?_e(_.endpoint)?!0:(_.debug&&console.warn(`[Do11y] Invalid HTTP endpoint. Must be HTTPS and not a private address.`),!1):(_.debug&&console.warn(`[Do11y] No HTTP endpoint configured`),!1):_.destination===`otlp`?_.otelSdkEndpoint?(ve().catch(e=>{_.debug&&console.warn(`[Do11y] OTel SDK initialization failed:`,e)}),!0):(_.debug&&console.warn(`[Do11y] No OTLP endpoint configured`),!1):(_.debug&&console.warn(`[Do11y] Unknown destination:`,_.destination),!1)}async function ve(){if(M)return;let e=_.otelSdkCdnUrl.replace(/\/+$/,``)+`/`,t=await import(`${e}@opentelemetry/api-logs`),n=await import(`${e}@opentelemetry/sdk-logs`),r=await import(`${e}@opentelemetry/exporter-logs-otlp-http`),i={"service.name":_.otelSdkServiceName||`do11y`,"service.version":m,"telemetry.sdk.name":`do11y`,"telemetry.sdk.language":`webjs`,"telemetry.sdk.version":m,..._.otelSdkResourceAttributes},a=new n.LoggerProvider({resource:{attributes:i},processors:[new n.BatchLogRecordProcessor({exporter:new r.OTLPLogExporter({url:_.otelSdkEndpoint.replace(/\/$/,``)+`/v1/logs`,headers:_.otelSdkHeaders})})]});t.logs.setGlobalLoggerProvider(a),M=a.getLogger(`do11y`),_.debug&&console.log(`[Do11y] OTel SDK initialized with endpoint:`,_.otelSdkEndpoint)}function P(e){if(_.destination===`supabase`){let t=_.supabaseUrl.replace(/\/$/,``)+`/rest/v1/`+_.supabaseTable,n=_.bodyTransform??(e=>e.map(e=>({payload:e})));return{url:t,headers:{apikey:_.supabaseKey,Authorization:`Bearer `+_.supabaseKey,"Content-Type":`application/json`,Prefer:`return=minimal`},body:JSON.stringify(n(e))}}let t=_.bodyTransform??(e=>e);return{url:_.endpoint,headers:{"Content-Type":`application/json`,..._.headers},body:JSON.stringify(t(e))}}function F(e){if(O&&=(clearTimeout(O),null),D.length===0||!N())return;let t=typeof e==`number`?e:_.maxRetries,n=D.slice();D=[],be(P(n),n,t)}function ye(e){try{return new URL(e).origin!==window.location.origin}catch{return!1}}function be(e,t,n){let r=ye(e.url);_.debug&&r&&console.log(`[Do11y] Cross-origin request to`,new URL(e.url).origin,`- requires CORS headers on the server`),fetch(e.url,{method:`POST`,headers:e.headers,body:e.body,keepalive:!0,mode:r?`cors`:`same-origin`}).then(e=>{if(e.ok){_.debug&&console.log(`[Do11y] Flushed`,t.length,`events`);return}if(n>0&&(e.status>=500||e.status===429)){_.debug&&console.log(`[Do11y] Retrying after error:`,e.status),D=t.concat(D),setTimeout(()=>{F(n-1)},_.retryDelay*(_.maxRetries-n+1));return}_.debug&&e.text().then(t=>{let n=`[Do11y] Ingest failed: ${e.status}`;e.status===0&&e.type===`opaque`?console.error(n,`- CORS error: server did not return Access-Control-Allow-Origin`):console.error(n,t)}).catch(()=>{})}).catch(e=>{if(n>0){if(_.debug){let t=r?` (this may be a CORS issue — try using an OTel Collector proxy)`:``;console.log(`[Do11y] Network error, retrying:`,e.message+t)}D=t.concat(D),setTimeout(()=>{F(n-1)},_.retryDelay*(_.maxRetries-n+1))}else _.debug&&console.error(`[Do11y] Failed to send events:`,e.message)})}function xe(){if(_.destination===`otlp`||D.length===0||!N())return;let e=D;D=[];let t=P(e);try{fetch(t.url,{method:`POST`,headers:t.headers,body:t.body,keepalive:!0})}catch{}_.debug&&console.log(`[Do11y] Sync flushed`,e.length,`events`)}function I(){K=!1;let n=oe(window.location.pathname),r=pe(),i=fe(r);n.pageCount===1&&(n.referrerCategory=i.referrerCategory,n.aiPlatform=i.aiPlatform,E(n)),j(`browser.do11y.page_view`,{"browser.do11y.referrer_domain":r,[e]:i.referrerCategory,[t]:i.aiPlatform,"browser.do11y.is_first_page":n.pageCount===1,"browser.do11y.previous_path":n.pageSequence.length>1?n.pageSequence[n.pageSequence.length-2].path:null})}function Se(){document.addEventListener(`click`,e=>{let t=e.target.closest(`a`);if(!t)return;let n=t.getAttribute(`href`);if(!n)return;let r=`other`,i=null;try{if(n.startsWith(`#`))r=`anchor`;else if(n.startsWith(`/`)||n.startsWith(`./`)||n.startsWith(`../`))r=`internal`;else if(n.startsWith(`http`)){let e=new URL(n);e.hostname===window.location.hostname?r=`internal`:(r=`external`,i=e.hostname)}else n.startsWith(`mailto:`)&&(r=`email`)}catch{}r===`internal`&&!_.trackInternalLinks||r===`external`&&!_.trackOutboundLinks||(j(`browser.do11y.link_click`,{"browser.do11y.link.type":r,"browser.do11y.link.target_url":n,"browser.do11y.link.target_domain":i,"browser.do11y.link.text":w(t.textContent,100),"browser.do11y.link.context":Ce(t),"browser.do11y.link.section":w(L(t),100),"browser.do11y.link.index":we(t,n)}),F())},!0)}function Ce(e){return e.closest(_.navigationSelector)?`navigation`:e.closest(_.footerSelector)?`footer`:e.closest(_.contentSelector)?`content`:`other`}function L(e){let t=e;for(;t&&t!==document.body;){let e=t.previousElementSibling;for(;e;){if(/^H[1-6]$/.test(e.tagName))return e.textContent?.trim().substring(0,100)??null;let t=e.querySelectorAll(`h1, h2, h3, h4, h5, h6`);if(t.length>0)return t[t.length-1].textContent?.trim().substring(0,100)??null;e=e.previousElementSibling}t=t.parentElement}return null}function we(e,t){if(typeof CSS>`u`||typeof CSS.escape!=`function`)return 1;try{let n=document.querySelectorAll(`a[href="`+CSS.escape(t)+`"]`);for(let t=0;t<n.length;t++)if(n[t]===e)return t+1}catch{}return 1}let R=new Set,z=null;function B(e){let t=e;for(;t&&t!==document.body&&t!==document.documentElement;){let e=window.getComputedStyle(t).overflowY;if((e===`auto`||e===`scroll`)&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return null}function Te(){if(!_.trackScrollDepth)return;if(_.contentSelector){let e=document.querySelector(_.contentSelector);e&&(z=B(e))}let e=!1;function t(){e||=(window.requestAnimationFrame(()=>{V(),e=!1}),!0)}if(window.addEventListener(`scroll`,t),z&&(z.addEventListener(`scroll`,t),_.debug)){let e=z;console.log(`[do11y] Using container-based scroll tracking:`,e.className||e.tagName)}V()}function V(){let e,t,i;z&&z.scrollHeight>z.clientHeight?(e=z.scrollTop,t=z.scrollHeight,i=z.clientHeight):(e=window.scrollY||document.documentElement.scrollTop,t=document.documentElement.scrollHeight,i=window.innerHeight);let a=t-i;if(a<=0){_.scrollThresholds.forEach(e=>{R.has(e)||(R.add(e),j(u,{[n]:e,[r]:100}))});return}let o=Math.round(e/a*100);_.scrollThresholds.forEach(e=>{o>=e&&!R.has(e)&&(R.add(e),j(u,{[n]:e,[r]:o}))})}let H=Date.now(),U=Date.now(),W=0,G=!0,K=!1;function q(){if(K)return;K=!0,G&&(W+=Date.now()-U);let n=Date.now()-H,r=n>0?W/n:0,i=0;R.forEach(e=>{e>i&&(i=e)}),Z();let a=T();j(`browser.do11y.page_exit`,{"browser.do11y.page_exit.total_time_seconds":Math.round(n/1e3),"browser.do11y.page_exit.active_time_seconds":Math.round(W/1e3),"browser.do11y.page_exit.engagement_ratio":Math.round(r*100)/100,"browser.do11y.page_exit.max_scroll_depth":i,[e]:a.referrerCategory,[t]:a.aiPlatform})}function Ee(){document.addEventListener(`visibilitychange`,()=>{document.hidden?G&&=(W+=Date.now()-U,!1):(U=Date.now(),G=!0)}),window.addEventListener(`beforeunload`,()=>{q(),Fe()})}function De(){document.addEventListener(`click`,e=>{e.target.closest(_.searchSelector)&&j(d,{})},!0),document.addEventListener(`keydown`,e=>{(e.metaKey||e.ctrlKey)&&e.key===`k`&&j(d,{"browser.do11y.search.trigger":`keyboard`})})}function Oe(e){if(!e)return 1;try{let t=document.querySelectorAll(_.codeBlockSelector);for(let n=0;n<t.length;n++)if(t[n]===e)return n+1}catch{}return 1}function ke(){document.addEventListener(`click`,e=>{let t=e.target.closest(_.copyButtonSelector);if(t){let e=t.closest(`[class*="language-"], [language]`)??t.closest(_.codeBlockSelector)??t.closest(`.expressive-code`)?.querySelector(`pre`)??t.closest(`div, section`)?.querySelector(`pre`)??t.parentElement?.querySelector(`pre`)??null,n=te((e?e.tagName===`PRE`?e.querySelector(`code`):e.querySelector(`code[class*="language-"], code[language]`)??e.querySelector(`code`):null)??e??t);j(`browser.do11y.code_copied`,{"browser.do11y.code.language":n,"browser.do11y.code.section":w(L(e??t),100),"browser.do11y.code.index":Oe(e)})}},!0)}let J=null,Y={};function Ae(){if(!_.trackSectionVisibility||typeof IntersectionObserver>`u`)return;let e=_.sectionVisibleThreshold*1e3;J=new IntersectionObserver(t=>{t.forEach(t=>{let n=t.target.getAttribute(`data-do11y-section-id`);if(n)if(t.isIntersecting)Y[n]||(Y[n]={start:Date.now(),reported:!1});else{if(Y[n]&&!Y[n].reported){let r=Date.now()-Y[n].start;if(r>=e){let e=t.target.textContent?.trim()??``;j(f,{[i]:w(e,100),[a]:parseInt(t.target.tagName.charAt(1),10),[o]:Math.round(r/1e3)}),Y[n].reported=!0}}delete Y[n]}})},{threshold:.5}),X()}function X(){J&&document.querySelectorAll(`h2, h3`).forEach((e,t)=>{e.setAttribute(`data-do11y-section-id`,`section-`+t),J.observe(e)})}function Z(){if(!J)return;let e=Date.now(),t=_.sectionVisibleThreshold*1e3;Object.keys(Y).forEach(n=>{let r=Y[n];if(r&&!r.reported){let s=e-r.start;if(s>=t){let e=typeof CSS<`u`&&typeof CSS.escape==`function`?CSS.escape(n):n.replace(/["\\]/g,`\\$&`),t=document.querySelector(`[data-do11y-section-id="`+e+`"]`);t&&j(f,{[i]:w(t.textContent?.trim()??``,100),[a]:parseInt(t.tagName.charAt(1),10),[o]:Math.round(s/1e3)})}}}),Y={}}function je(){_.trackTabSwitches&&document.addEventListener(`click`,e=>{let t=`[role="tab"], .tabs button, .tabs a, .tabbed-labels label`,n=x(_.tabContainerSelector);n&&(t+=`, `+n+` button, `+n+` a, `+n+` label`);let r=e.target.closest(t);if(!r||r.getAttribute(`aria-selected`)===`true`||r.classList.contains(`active`)||r.classList.contains(`is-active`))return;let i=w(r.textContent,50);if(!i)return;let a=w(L(r),100);j(`browser.do11y.tab_switch`,{"browser.do11y.tab.label":i,"browser.do11y.tab.group":a,"browser.do11y.tab.is_default":!1})})}function Me(){_.trackTocClicks&&document.addEventListener(`click`,e=>{let t=e.target.closest(`a`);if(!t)return;let n=re(t);if(!n)return;let r=t.getAttribute(`href`),i=r?ne(r):null;if(!i)return;let a=w(t.textContent,100),o=null;try{let e=i.slice(1),t=document.getElementById(e);t&&/^H[1-6]$/.test(t.tagName)&&(o=parseInt(t.tagName.charAt(1),10))}catch{}let s=n.querySelectorAll(`a[href*="#"]`),c=1;for(let e=0;e<s.length;e++)if(s[e]===t){c=e+1;break}j(`browser.do11y.toc_click`,{"browser.do11y.toc.heading":a,"browser.do11y.toc.heading_level":o,"browser.do11y.toc.position":c})},!0)}function Ne(){_.trackFeedback&&document.addEventListener(`click`,e=>{let t=e.target.closest(`button, [role="button"], a`);if(!t||!t.closest(x(_.feedbackSelector)??`[class*="feedback"], [class*="helpful"], [class*="rating"], [class*="was-this"], [data-feedback]`))return;let n=(t.textContent??``).trim().toLowerCase(),r=(t.getAttribute(`aria-label`)??``).toLowerCase(),i=(t.getAttribute(`title`)??``).toLowerCase(),a=t.getAttribute(`data-value`)??t.getAttribute(`data-md-value`)??t.getAttribute(`data-feedback`),o=a&&/^[\w\s.,!?-]{1,50}$/.test(a)?a:null,s=null;o?s=o:/\byes\b|👍|thumbs.?up|helpful/i.test(n+` `+r+` `+i)?s=`yes`:/\bno\b|👎|thumbs.?down|not.?helpful/i.test(n+` `+r+` `+i)&&(s=`no`),s&&j(`browser.do11y.feedback`,{"browser.do11y.feedback.rating":s})})}function Pe(){_.trackExpandCollapse&&(document.addEventListener(`toggle`,e=>{let t=e.target;if(t.tagName!==`DETAILS`)return;let n=t.querySelector(`summary`),r=w(n?n.textContent:``,100);j(p,{[s]:r,[c]:t.open?`expand`:`collapse`,[l]:w(L(t),100)})},!0),document.addEventListener(`click`,e=>{let t=e.target.closest(`[aria-expanded], [class*="accordion"] button, [class*="collapsible"] button`);if(!t||t.closest(`details`)||t.closest(`nav, [role="navigation"], header`))return;let n=t.getAttribute(`aria-expanded`)===`true`;j(p,{[s]:w(t.textContent,100),[c]:n?`collapse`:`expand`,[l]:w(L(t),100)})}))}let Q=null;function $(){if(window.Do11yConfig&&typeof window.Do11yConfig==`object`)for(let e in window.Do11yConfig)Object.prototype.hasOwnProperty.call(window.Do11yConfig,e)&&Object.prototype.hasOwnProperty.call(_,e)&&(_[e]=window.Do11yConfig[e]);let e=document.querySelector(`meta[name="do11y-destination"]`);if(e){let t=e.getAttribute(`content`);(t===`supabase`||t===`http`||t===`otlp`)&&(_.destination=t)}let t=document.querySelector(`meta[name="do11y-url"]`);t&&(_.supabaseUrl=t.getAttribute(`content`)??_.supabaseUrl);let n=document.querySelector(`meta[name="do11y-key"]`);n&&(_.supabaseKey=n.getAttribute(`content`)??_.supabaseKey);let r=document.querySelector(`meta[name="do11y-table"]`);r&&(_.supabaseTable=r.getAttribute(`content`)??_.supabaseTable);let i=document.querySelector(`meta[name="do11y-endpoint"]`);i&&(_.endpoint=i.getAttribute(`content`)??_.endpoint);let a=document.querySelector(`meta[name="do11y-otlp-endpoint"]`);a&&(_.otelSdkEndpoint=a.getAttribute(`content`)??_.otelSdkEndpoint);let o=document.querySelector(`meta[name="do11y-otlp-headers"]`);if(o)try{let e=JSON.parse(o.getAttribute(`content`)??`{}`);typeof e==`object`&&e&&(_.otelSdkHeaders=e)}catch{}let s=document.querySelector(`meta[name="do11y-debug"]`);s&&s.getAttribute(`content`)===`true`&&(_.debug=!0);let c=document.querySelector(`meta[name="do11y-domains"]`);if(c){let e=c.getAttribute(`content`);e&&(_.allowedDomains=e.split(`,`).map(e=>e.trim()))}let l=document.querySelector(`meta[name="do11y-framework"]`);l&&(_.framework=l.getAttribute(`content`)??_.framework);let u=document.querySelector(`meta[name="do11y-use-otel-instrumentations"]`);if(u&&u.getAttribute(`content`)===`true`&&(_.useOtelBrowserInstrumentations=!0),ee(),_.debug){let e=_.destination===`supabase`?!!_.supabaseKey:_.destination===`otlp`?!!_.otelSdkEndpoint:!!_.endpoint;console.log(`[Do11y] Initializing with config:`,{destination:_.destination,hasCredentials:e,framework:_.framework,allowedDomains:_.allowedDomains,respectDNT:_.respectDNT})}if(b()){A=!0,_.debug&&console.log(`[Do11y] Tracking disabled`);return}(_.destination===`supabase`?_.supabaseKey:_.destination===`otlp`?_.otelSdkEndpoint:_.endpoint)||_.debug&&(console.warn(`[Do11y] No destination configured. Events will not be sent.`),_.destination===`supabase`?console.warn(`[Do11y] Add <meta name="do11y-url"> and <meta name="do11y-key"> to enable.`):_.destination===`otlp`?console.warn(`[Do11y] Add <meta name="do11y-otlp-endpoint"> to enable.`):console.warn(`[Do11y] Add <meta name="do11y-endpoint"> to enable.`)),I(),Se(),Te(),Ee(),De(),ke(),Ae(),je(),Me(),Ne(),Pe();let d=window.location.pathname;Q=new MutationObserver(()=>{window.location.pathname!==d&&(d=window.location.pathname,q(),R=new Set,H=Date.now(),U=Date.now(),W=0,G=!0,I(),X(),V())}),Q.observe(document.body,{childList:!0,subtree:!0}),window.addEventListener(`popstate`,()=>{window.location.pathname!==d&&(d=window.location.pathname,q(),R=new Set,H=Date.now(),U=Date.now(),W=0,G=!0,I(),X(),V())}),Object.freeze(_),_.debug&&console.log(`[Do11y] Initialized successfully`)}function Fe(){Q&&=(Q.disconnect(),null),J&&=(Z(),J.disconnect(),null),O&&=(clearTimeout(O),null),xe()}!h&&!g&&(document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,$):$()),window.Do11y=window.Do11y??{getConfig:()=>({destination:_.destination,hasCredentials:_.destination===`supabase`?!!_.supabaseKey:_.destination===`otlp`?!!_.otelSdkEndpoint:!!_.endpoint,isDisabled:A,allowedDomains:_.allowedDomains,respectDNT:_.respectDNT}),flush:F,isEnabled:()=>A?!1:_.destination===`supabase`?!!_.supabaseKey:_.destination===`otlp`?!!_.otelSdkEndpoint:!!_.endpoint,getQueueSize:()=>D.length,version:m}})();
|