PageSourceSearch

https://knyamed.com/cdn/shop/t/571/assets/section-renderer.js?v=58687129242587501841765537243

js knyamed.com collected 2026-10-01 11:53:33 UTC 3,562 bytes, 2 lines download raw bytes

1import{morph}from"@theme/morph";class SectionRenderer{#cache=new Map;#abortControllersBySectionId=new Map;#pendingPromises=new Map;constructor(){window.addEventListener("load",this.#cachePageSections.bind(this))}async renderSection(sectionId,options){const{cache=!Shopify.designMode}=options??{},{url}=options??{};this.#abortPendingMorph(sectionId);const abortController=new AbortController;this.#abortControllersBySectionId.set(sectionId,abortController);const sectionHTML=await this.getSectionHTML(sectionId,cache,url);return abortController.signal.aborted||(this.#abortControllersBySectionId.delete(sectionId),morphSection(sectionId,sectionHTML)),sectionHTML}#abortPendingMorph(sectionId){const existingAbortController=this.#abortControllersBySectionId.get(sectionId);existingAbortController&&existingAbortController.abort()}async getSectionHTML(sectionId,useCache=!0,url=new URL(window.location.href)){const sectionUrl=buildSectionRenderingURL(sectionId,url);let pendingPromise=this.#pendingPromises.get(sectionUrl);if(pendingPromise)return pendingPromise;if(useCache){const cachedHTML=this.#cache.get(sectionUrl);if(cachedHTML)return cachedHTML}pendingPromise=fetch(sectionUrl).then(response=>response.text()),this.#pendingPromises.set(sectionUrl,pendingPromise);const sectionHTML=await pendingPromise;return this.#pendingPromises.delete(sectionUrl),this.#cache.set(sectionUrl,sectionHTML),sectionHTML}#cachePageSections(){for(const section of document.querySelectorAll(".shopify-section")){const url=buildSectionRenderingURL(section.id);if(this.#cache.get(url)||containsShadowRoot(section))return;this.#cache.set(url,section.outerHTML)}}}const SECTION_ID_PREFIX="shopify-section-";function buildSectionRenderingURL(sectionId,url=new URL(window.location.href)){return url.searchParams.set("section_id",normalizeSectionId(sectionId)),url.searchParams.sort(),url.toString()}export function buildSectionSelector(sectionId){return`${SECTION_ID_PREFIX}${sectionId}`}export function normalizeSectionId(sectionId){return sectionId.replace(new RegExp(`^${SECTION_ID_PREFIX}`),"")}function containsShadowRoot(element){return!!element.shadowRoot||Array.from(element.children).some(containsShadowRoot)}let lastFilterChangeElement=null;export function setLastFilterChangeElement(element){lastFilterChangeElement=element}if(typeof window<"u"){const win=window;win.setLastFilterChangeElement=setLastFilterChangeElement}export async function morphSection(sectionId,html){const fragment=new DOMParser().parseFromString(html,"text/html"),existingElement=document.getElementById(buildSectionSelector(sectionId)),newElement=fragment.getElementById(buildSectionSelector(sectionId));if(!existingElement)throw new Error(`Section ${sectionId} not found`);if(!newElement)throw new Error(`Section ${sectionId} not found in the section rendering response`);morph(existingElement,newElement);const productGridContainer=existingElement.querySelector("#ProductGridContainer");if(productGridContainer&&productGridContainer.getAttribute("quick-filter")==="true"){const element=lastFilterChangeElement||(typeof window.lastChangedInputElement<"u"?window.lastChangedInputElement:null)||document.querySelector('input[type="checkbox"]:checked, input[type="radio"]:checked');element&&typeof window.renderProductGridContainer=="function"&&requestAnimationFrame(()=>{window.renderProductGridContainer(html,element)})}lastFilterChangeElement=null}export const sectionRenderer=new SectionRenderer;
2//# sourceMappingURL=/cdn/shop/t/571/assets/section-renderer.js.map?v=58687129242587501841765537243

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.