1import{i as y,j as A}from"./chunk-O57EHTWG.js";import{K as f,O as h,Pa as b,Z as p}from"./chunk-IQBTZB72.js";import{a as m,b as S}from"./chunk-WFIHWVQO.js";var M=(()=>{class l{constructor(t,e,r,i){this._meta=t,this._title=e,this.document=i,this.metaTagsMap=new Map,this.structuredDataMap=new Map,this.structuredDataScriptId="plp-structured-data",this.renderer=r.createRenderer(null,null)}updateMetaTags(t){let e=new Map;t&&t.length&&t.forEach(i=>{i.name&&e.set(i.name,i)});let r=[];this.metaTagsMap.forEach((i,a)=>{e.has(a)||r.push(a)}),r.forEach(i=>{this._meta.removeTag(`name="${i}"`),this.metaTagsMap.delete(i)}),e.forEach(i=>{this.metaTagsMap.set(i.name,i),this._meta.updateTag(i)})}updateCanonical(t){let e=this.document.querySelector('link[rel="canonical"]');if(e&&this.renderer.removeChild(this.document.head,e),t){let r=this.renderer.createElement("link");this.renderer.setAttribute(r,"rel","canonical"),this.renderer.setAttribute(r,"href",t),this.renderer.appendChild(this.document.head,r)}}getMetaTag(t){return this.metaTagsMap.get(t)}getMetaTagFromDOM(t){return this._meta.getTag(`name="${t}"`)}updateTitle(t){t&&this._title.setTitle(t)}registerStructuredData(t,e){if(t){if(!e||Object.keys(e).length===0){this.unregisterStructuredData(t);return}this.structuredDataMap.set(t,e),this.renderStructuredDataScript()}}unregisterStructuredData(t){t&&this.structuredDataMap.delete(t)&&this.renderStructuredDataScript()}clearStructuredData(){this.structuredDataMap.size!==0&&(this.structuredDataMap.clear(),this.renderStructuredDataScript())}renderStructuredDataScript(){let t=`script#${this.structuredDataScriptId}[type="application/ld+json"]`,e=this.document.querySelector(t);if(this.structuredDataMap.size===0){e&&this.renderer.removeChild(this.document.head,e);return}let r=Array.from(this.structuredDataMap.values()),i=r.length===1?r[0]:{"@context":"https://schema.org","@graph":r.map(n=>{let s=m({},n);return delete s["@context"],s})},a=e;a||(a=this.renderer.createElement("script"),this.renderer.setAttribute(a,"id",this.structuredDataScriptId),this.renderer.setAttribute(a,"type","application/ld+json"),this.renderer.appendChild(this.document.head,a)),a&&(a.text=JSON.stringify(i))}validateMetaTags(){let t=this.document.querySelectorAll("meta[name]"),e=new Map;return t.forEach(r=>{let i=r.getAttribute("name");i&&e.set(i,(e.get(i)||0)+1)}),e.forEach((r,i)=>{r>1&&console.warn(`[MetaService] Duplicate meta tag detected: "${i}" (count: ${r})`)}),e}static{this.\u0275fac=function(e){return new(e||l)(h(y),h(A),h(b),h(p))}}static{this.\u0275prov=f({token:l,factory:l.\u0275fac,providedIn:"root"})}}return l})();var C=(()=>{class l{constructor(t,e){this._document=t,this._metaService=e,this.faqSchemaRegistrationKey="__ldservice_faq_page__",this.faqSchemaNodes=new Map}registerSchemaNode(t,e){this._metaService.registerStructuredData(t,e)}unregisterSchemaNode(t){if(t===this.faqSchemaRegistrationKey){this._metaService.unregisterStructuredData(t);return}if(this.faqSchemaNodes.delete(t)){this.registerMergedFaqSchema();return}this._metaService.unregisterStructuredData(t)}registerFaqSchema(t,e,r){let i=this.buildFaqSchemaNode(e,r);if(!i){this.faqSchemaNodes.delete(t),this.registerMergedFaqSchema();return}this.faqSchemaNodes.set(t,i),this.registerMergedFaqSchema()}registerFaqSchemaFromPatterns(t,e,r){let i=[];this.collectFaqAccordionItems(e,i),this.registerFaqSchema(t,i,r)}registerMergedFaqSchema(){let t=Array.from(this.faqSchemaNodes.values());if(t.length===0){this.unregisterSchemaNode(this.faqSchemaRegistrationKey);return}let e=t[0],r=t.flatMap(n=>Array.isArray(n.mainEntity)?n.mainEntity:[]),i=new Set,a=r.filter(n=>{let s=JSON.stringify(n);return i.has(s)?!1:(i.add(s),!0)});this.registerSchemaNode(this.faqSchemaRegistrationKey,S(m({},e),{mainEntity:a}))}buildFaqSchemaNode(t,e){let r=t.map(i=>this.buildFaqQuestionNode(i)).filter(i=>i!==null);return r.length===0?null:{"@context":"https://schema.org","@type":"FAQPage","@id":`${this.resolvePageUrl(e)}#faq`,mainEntity:r}}registerWebPageSchema(t,e){let r=this.buildWebPageSchemaNode(e);if(!r){this.unregisterSchemaNode(t);return}this.registerSchemaNode(t,r)}buildWebPageSchemaNode(t){let e=(t.pageUrl??"").trim();if(!e)return null;let r=this.resolvePageUrl(e),i=this.stripHtml(t.pageName),a=i.indexOf("|");if(a!==-1&&(i=i.slice(0,a).trim()),!r||!i)return null;let n={"@context":"https://schema.org","@type":"WebPage","@id":`${r}#webpage`,name:i,url:r},s=t.productId||`${r}#product`;return s&&(n.about={"@id":s}),t.breadcrumbId&&(n.breadcrumb={"@id":t.breadcrumbId}),t.potentialActions&&t.potentialActions.length>0&&(n.potentialAction=t.potentialActions),n}registerBreadcrumbListSchema(t,e,r,i){let a=this.buildBreadcrumbListSchemaNode(e,r,i);if(!a){this.unregisterSchemaNode(t);return}this.registerSchemaNode(t,a)}buildBreadcrumbListSchemaNode(t,e,r){if(!t||t.length<=1)return null;let i=this.resolvePageUrl(e);if(!i)return null;let a=new URL(i).origin,n=t.map((s,g)=>{let c=(s?.label??"").trim(),u=this.stripHtml(c),o=(s?.url??"").trim();return o?this.isHashUrl(o)?o=o==="#"?i:`${i}${o}`:o.startsWith("/")&&(o=`${a}${o}`):o=i,u?{"@type":"ListItem",position:g+1,name:u,item:o}:null}).filter(s=>s!==null);return n.length<=1?null:{"@context":"https://schema.org","@type":"BreadcrumbList","@id":`${i}#breadcrumb`,itemListElement:n}}buildPotentialActionsFromPatterns(t,e){let r=[];t.forEach(c=>{this.collectCallToActions(c,r)});let i=r.filter((c,u,d)=>d.findIndex(o=>o.name===c.name&&o.target===c.target)===u),a=i.find(c=>/\bopen\b/i.test(c.name)),n=i.find(c=>/\bcalculat(e|or)\b/i.test(c.name)),s=[];return a&&s.push(a),n&&!s.some(c=>
1c.name===n.name&&c.target===n.target)&&s.push(n),i.forEach(c=>{s.some(d=>d.name===c.name&&d.target===c.target)||s.push(c)}),(e===void 0?s:s.slice(0,e)).map(c=>({"@type":"ViewAction",name:c.name,target:c.target}))}buildFaqQuestionNode(t){let e=this.stripHtml(t?.title),r=this.stripHtml(t?.description);return!e||!r?null:{"@type":"Question",name:e,acceptedAnswer:{"@type":"Answer",text:r}}}collectFaqAccordionItems(t,e){if(Array.isArray(t)){t.forEach(r=>this.collectFaqAccordionItems(r,e));return}if(this.isRecord(t)){if(t.patternId==="faq-accordion"){let r=t.patternData;this.isRecord(r)&&r.enableStructuredData!==!1&&Array.isArray(r.accordionItems)&&e.push(...r.accordionItems)}Object.values(t).forEach(r=>this.collectFaqAccordionItems(r,e))}}resolvePageUrl(t){if(t)return t;let e=this._document.querySelector('link[rel="canonical"]');return e?.href?e.href:this._document.location?.href??""}collectCallToActions(t,e){if(Array.isArray(t)){t.forEach(r=>this.collectCallToActions(r,e));return}this.isRecord(t)&&(["buttons","links","link"].forEach(r=>{this.collectCallToActionValue(t[r],e)}),Object.entries(t).forEach(([r,i])=>{["buttons","links","link"].includes(r)||this.collectCallToActions(i,e)}))}collectCallToActionValue(t,e){if(Array.isArray(t)){t.forEach(s=>this.collectCallToActionValue(s,e));return}if(!this.isRecord(t))return;let r=this.stripHtml(typeof t.text=="string"?t.text:void 0),i=(typeof t.url=="string"?t.url:"").trim(),a=t.modal,n=this.isRecord(a)&&typeof a.modalId=="string"&&a.modalId.trim().length>0;r&&i&&!this.isHashUrl(i)&&!n&&!this.isPhoneNumberTarget(i)&&e.push({name:r,target:i})}isHashUrl(t){return t.startsWith("#")}isPhoneNumberTarget(t){if(t.toLowerCase().startsWith("tel:"))return!0;let e=t.replace(/[\s().-]/g,"");return/^\+?\d{7,15}$/.test(e)}isRecord(t){return typeof t=="object"&&t!==null}stripHtml(t){return t?t.replace(/<[^>]*?>/g," ").replace(/\s+/g," ").trim():""}static{this.\u0275fac=function(e){return new(e||l)(h(p),h(M))}}static{this.\u0275prov=f({token:l,factory:l.\u0275fac,providedIn:"root"})}}return l})();export{M as a,C as b};
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.