1import{p as i,a as s}from"./vendor-smart-links-processor.js";import{o as u}from"./vendor-idle.js";import"./vendor-inapp.js";import"./vendor-asset.js";import"./vendor-device.js";class a extends HTMLElement{clickListener=null;observer=null;toggleAttrObserver=null;connectedCallback(){if(document.querySelector(".custom-wide-container, .content-wide-area")||document.body.classList.contains("custom-wide-mode"))return;i(document),u(()=>i(document),1e3);const o=document.querySelector(".post-content-body");o&&(this.observer=new MutationObserver(r=>{for(const t of r)t.addedNodes.forEach(n=>{if(n.nodeType!==1)return;const e=n;e.closest(".post-content-body")?e.tagName==="A"?s(e):typeof e.querySelectorAll=="function"&&e.querySelectorAll("a").forEach(c=>s(c)):typeof e.querySelectorAll=="function"&&e.querySelectorAll(".post-content-body a").forEach(c=>s(c))})}),this.observer.observe(o,{childList:!0,subtree:!0})),this.toggleAttrObserver=new MutationObserver(r=>{r.forEach(t=>{if(t.type!=="attributes"||t.attributeName!=="data-kg-toggle-state")return;const n=t.target;n.getAttribute("data-kg-toggle-state")==="open"&&n.querySelectorAll("a").forEach(e=>s(e))})}),document.querySelectorAll(".post-content-body .kg-toggle-card").forEach(r=>{this.toggleAttrObserver?.observe(r,{attributes:!0,attributeFilter:["data-kg-toggle-state"]})}),this.clickListener=r=>{const t=r.target.closest(".post-content-body a");t&&s(t)},document.addEventListener("click",this.clickListener),document.addEventListener("auxclick",this.clickListener);const l=window.Tana=window.Tana||{};l.smartLinks={cleanup:()=>this.cleanup()}}disconnectedCallback(){this.cleanup()}cleanup(){this.clickListener&&(document.removeEventListener("click",this.clickListener),document.removeEventListener("auxclick",this.clickListener),this.clickListener=null),this.observer&&(this.observer.disconnect(),this.observer=null),this.toggleAttrObserver&&(this.toggleAttrObserver.disconnect(),this.toggleAttrObserver=null);const o=window.Tana=window.Tana||{};o.smartLinks&&(o.smartLinks.cleanup=void 0)}}customElements.get("tana-smart-links")||customElements.define("tana-smart-links",a);export{a as TanaSmartLinks};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.