/**
 * =====================================================
 * Layer rules for the current page.
 * =====================================================
 */

window.OLAYER_RULES = [{"action":"page-title","value":"Ticinocom SA | Internet, Mobile, TV, Hosting in Ticino"},{"action":"image-alt","attribute":"alt","value":"Logo Ticinocom SA con design moderno e colori vivaci","url":"https://ticino.com/wp-content/uploads/2021/07/ticinocom-logo-color-lg.png"},{"action":"image-alt","attribute":"alt","value":"Famiglia felice che usa internet a casa, banner promozionale per i migliori abbonamenti Internet","url":"https://ticino.com/wp-content/uploads/2025/05/Screenshot-2025-05-23-10.24.46.png"},{"action":"image-alt","attribute":"alt","value":"Logo Ticinocom SA versione grigia nel footer","url":"https://ticino.com/wp-content/uploads/2020/09/ticinocom-logo-grey.png"},{"action":"image-alt","attribute":"alt","value":"Logo certificazione SwissLabel per Ticinocom SA","url":"https://ticino.com/wp-content/uploads/elementor/thumbs/logo-swisslabel-oyjea9t5ygzad4alpp3w8ybrxjsrc1o3afhavecyp8.png"},{"action":"meta-description","name":"description","value":"Ticinocom SA: Il tuo provider 100% Ticinese per Internet, Mobile, TV e Hosting. Servizi affidabili dal 1996. Scopri le nostre offerte e connettiti con il Ticino!"},{"action":"faq-page","schemaJson":"{\n  \"@context\": \"https://schema.org\",\n  \"@type\": \"FAQPage\",\n  \"mainEntity\": [\n    {\n      \"@type\": \"Question\",\n      \"name\": \"Generale\",\n      \"acceptedAnswer\": {\n        \"@type\": \"Answer\",\n        \"text\": \"Questioni amministrative oppure legate alla connessione Internet/guasti. Gratis.\"\n      }\n    },\n    {\n      \"@type\": \"Question\",\n      \"name\": \"Tecnica\",\n      \"acceptedAnswer\": {\n        \"@type\": \"Answer\",\n        \"text\": \"Questioni Hosting & Email oppure supporto prioritario. CHF 2.50/min.\"\n      }\n    },\n    {\n      \"@type\": \"Question\",\n      \"name\": \"Ricevi già la fattura QR?\",\n      \"acceptedAnswer\": {\n        \"@type\": \"Answer\",\n        \"text\": \"Sì, vai a app.ticino.com\"\n      }\n    },\n    {\n      \"@type\": \"Question\",\n      \"name\": \"Ricevi già la fattura QR?\",\n      \"acceptedAnswer\": {\n        \"@type\": \"Answer\",\n        \"text\": \"No, vai a my.ticino.com\"\n      }\n    }\n  ]\n}"}];

/**
 * =====================================================
 * Layer script bundle.
 * =====================================================
 */

(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))c(a);new MutationObserver(a=>{for(const o of a)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&c(i)}).observe(document,{childList:!0,subtree:!0});function t(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function c(a){if(a.ep)return;a.ep=!0;const o=t(a);fetch(a.href,o)}})();function b(e){document.querySelectorAll('script[type="application/ld+json"]').forEach(c=>{const a=c.textContent;(c.getAttribute("data-schema")==="article"||a&&a.includes('"@type":"Article"'))&&c.remove()});const t=document.createElement("script");t.setAttribute("type","application/ld+json"),t.setAttribute("data-schema","article"),t.textContent=e.schemaJson,document.head.appendChild(t),console.debug("Added Article schema",{schema:JSON.parse(e.schemaJson)})}function E(e){const n=document.querySelector(`link[rel="${e.rel}"]`);if(n)n.setAttribute("href",e.value),console.debug(`Updated ${e.rel} link to: ${e.value}`,{element:n});else{const t=document.createElement("link");t.setAttribute("rel",e.rel),t.setAttribute("href",e.value),document.head.insertAdjacentElement("afterbegin",t),console.debug(`Created new ${e.rel} link with value: ${e.value}`,{element:t})}}function y(e){document.querySelectorAll('script[type="application/ld+json"]').forEach(c=>{const a=c.textContent;(c.getAttribute("data-schema")==="faq"||a&&a.includes('"@type":"FAQPage"'))&&c.remove()});const t=document.createElement("script");t.setAttribute("type","application/ld+json"),t.setAttribute("data-schema","faq"),t.textContent=e.schemaJson,document.head.appendChild(t),console.debug("Added FAQ Page schema",{schema:JSON.parse(e.schemaJson)})}function A(e){const n=document.querySelector(`img[src="${e.url}"]`);n instanceof HTMLImageElement&&(n.setAttribute(e.attribute,e.value),console.debug(`Applied alt text to image: ${e.value}`,{element:n}))}function x(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const T=new Set(["A","B","BLOCKQUOTE","BUTTON","CODE","H1","H2","H3","H4","H5","H6","I","INPUT","NAV","OPTION","PRE","SCRIPT","SELECT","STRONG","STYLE","TABLE","TEXTAREA"]);function S(e,n){let t=e.parentElement;for(;t&&t!==n;){if(T.has(t.tagName))return!0;t=t.parentElement}return!1}function v(e){const n=document.body,t=new RegExp(`\\b${x(e.text)}\\b`,"gi"),c=[],a=document.createTreeWalker(n,NodeFilter.SHOW_TEXT,null);let o;for(;o=a.nextNode();)o instanceof Text&&!S(o,n)&&c.push(o);c.forEach(i=>{const s=i.textContent;if(!s||!t.test(s))return;t.lastIndex=0;const r=document.createDocumentFragment();let l=0,d;for(;(d=t.exec(s))!==null;){const u=d.index;u>l&&r.appendChild(document.createTextNode(s.slice(l,u)));const m=document.createElement(e.tag);e.attributes&&Object.entries(e.attributes).forEach(([g,h])=>{m.setAttribute(g,h)}),m.textContent=d[0],r.appendChild(m),l=u+d[0].length}l<s.length&&r.appendChild(document.createTextNode(s.slice(l))),i.parentNode?.replaceChild(r,i),console.debug(`Created link(s) for text: "${e.text}"`,{element:r})})}function C(e){const n=document.querySelector(`meta[name="${e.name}"]`);if(n)n.setAttribute("content",e.value),console.debug(`Updated meta ${e.name} to: ${e.value}`,{element:n});else{const t=document.createElement("meta");t.setAttribute("name",e.name),t.setAttribute("content",e.value),document.head.insertAdjacentElement("afterbegin",t),console.debug(`Created new meta ${e.name} with value: ${e.value}`,{element:t})}}function O(e){const n=document.querySelector("title");n instanceof HTMLTitleElement&&(n.textContent=e.value,console.debug(`Modified page title to: ${e.value}`,{element:n}))}const p=window.OLAYER_RULES||[];function f(e){try{switch(e.action){case"page-title":O(e);break;case"image-alt":A(e);break;case"meta-description":C(e);break;case"canonical":E(e);break;case"faq-page":y(e);break;case"article":b(e);break;case"internal-links":v(e);break;default:console.warn(`Unknown rule type: ${e.action}`)}}catch(n){console.error("Failed to apply rule:",n,e)}}function L(){console.log("Initializing OLayer..."),p.forEach(f);const e=new MutationObserver(n=>{n.forEach(t=>{t.type==="childList"&&p.forEach(c=>{(c.action==="image-alt"||c.action==="internal-links")&&f(c)})})});return e.observe(document.documentElement,{childList:!0,subtree:!0}),console.log("Observer set up"),e}L();console.log("OLayer initialized");
//# sourceMappingURL=index.js.map
