// Find the original unminified code in neo-draw--transform-img-to-svg.frontend.original.js
(async()=>{function hashStringForObserver(str){const hashDjb2=(str)=>{let hash=5381;for(let i=0;i<str.length;i++){hash=((hash<<5)+hash)+str.charCodeAt(i)}hash=Math.abs(hash).toString(16).padStart(8,"0");return hash};const hash1=hashDjb2(str);const hash2=hashDjb2(hash1+str);return hash1+hash2}
function observeOnce(selector,callback,{domRoot=document.documentElement,callbackSalt=""}={}){if(!callback){return new Promise(resolve=>observeOnce(selector,resolve,{domRoot,callbackSalt:Math.random().toString()}))}
const uniqueKey=hashStringForObserver(`${selector}|${callback.toString()}|${callbackSalt}`);observeOnce.observerRegistries??=new WeakMap();if(!observeOnce.observerRegistries.has(domRoot)){observeOnce.observerRegistries.set(domRoot,[])}
if(observeOnce.observerRegistries.get(domRoot).some(entry=>entry.uniqueKey===uniqueKey)){return}
const newObserverEntry={uniqueKey,selector,callback,domRoot,processedNodes:new Set()};observeOnce.observerRegistries.get(domRoot).push(newObserverEntry);for(const node of domRoot.querySelectorAll(selector)){newObserverEntry.processedNodes.add(node);callback(node)}
observeOnce.observersExistingForDomRoots??=new WeakSet();if(observeOnce.observersExistingForDomRoots.has(domRoot)){return}observeOnce.observersExistingForDomRoots.add(domRoot);new MutationObserver(async mutations=>{observeOnce.semaphores??=new WeakMap();observeOnce.semaphores.set(domRoot,!0);await new Promise(requestAnimationFrame);if(!observeOnce.semaphores.get(domRoot)){return}observeOnce.semaphores.set(domRoot,!1);for(const registryEntry of observeOnce.observerRegistries.get(domRoot)){for(const node of domRoot.querySelectorAll(registryEntry.selector)){if(registryEntry.processedNodes.has(node)){continue}
registryEntry.processedNodes.add(node);registryEntry.callback(node)}}}).observe(domRoot,{childList:!0,subtree:!0})}
function observeInViewportOnce(node,callback,rootMargin="0px"){if(typeof node==="string"){observeOnce(node,(node)=>{observeInViewportOnce(node,callback,rootMargin)},{callbackSalt:hashStringForObserver(callback.toString())});return}
new IntersectionObserver((entries,observer)=>{entries.forEach(entry=>{if(entry.isIntersecting){callback(entry.target);observer.disconnect()}})},{rootMargin:rootMargin}).observe(node)}
function observeAttributes(node,callback){if(typeof node==="string"){observeOnce(node,(node)=>{observeAttributes(node,callback)},{callbackSalt:hashStringForObserver(callback.toString())});return}
new MutationObserver(mutations=>{callback(node)}).observe(node,{attributes:!0,childList:!1,subtree:!1,characterData:!1});callback(node)}
function observeNode(node,callback){if(typeof node==="string"){observeOnce(node,(node)=>{observeNode(node,callback)},{callbackSalt:hashStringForObserver(callback.toString())});return}
new MutationObserver(mutations=>{callback(node)}).observe(node,{attributes:!0,childList:!0,subtree:!0,characterData:!0});callback(node)}
function observeResize(node,callback){if(typeof node==="string"){observeOnce(node,(node)=>{observeResize(node,callback)},{callbackSalt:hashStringForObserver(callback.toString())});return}
let nodeWidth,nodeHeight;new ResizeObserver((entries)=>{entries.forEach(async(entry)=>{const{width,height}=entry.contentRect;if(nodeWidth===width&&nodeHeight===height){return}
nodeWidth=width;nodeHeight=height;callback(node,{width,height});await new Promise(requestAnimationFrame);while(entry.target.getAnimations().some(a=>a.playState==="running")){const boundingRect=entry.target.getBoundingClientRect();if(nodeWidth===boundingRect.width&&nodeHeight===boundingRect.height){break}
nodeWidth=boundingRect.width;nodeHeight=boundingRect.height;callback(entry.target,{width:boundingRect.width,height:boundingRect.height});await new Promise(requestAnimationFrame)}})}).observe(node)}
function observeClick(node,callback){if(typeof node==="string"){observeOnce(node,(node)=>{observeClick(node,callback)},{callbackSalt:hashStringForObserver(callback.toString())});return}
node.addEventListener("click",(event)=>callback(node,event))}
function _addEventListenerWithObserverSupport(node,eventType,callback){if(typeof node==="string"){observeOnce(node,(node)=>{_addEventListenerWithObserverSupport(node,eventType,callback)},{callbackSalt:hashStringForObserver(callback.toString())});return}
node.addEventListener(eventType,callback)}
function addEventListenerWithInitialCall(node,eventType,callback){_addEventListenerWithObserverSupport(node,eventType,callback);callback({target:node})}
function addEventListenerWithInitialCallMultiple(nodesAndEventTypes,callback){for(const[node,eventType]of nodesAndEventTypes){_addEventListenerWithObserverSupport(node,eventType,callback)}
callback()}
async function domLoaded(callback){if(document.readyState==="loading"){await new Promise(resolve=>window.addEventListener("DOMContentLoaded",resolve))}
if(callback){callback()}}
async function delay(time,callback){await domLoaded();await new Promise(resolve=>setTimeout(resolve,time*1000));if(callback){callback()}}
function jsVar(variableName){if(!(window.neoGlobalEnqueueBackendNeoAnimate||window.neoGlobalEnqueueFrontendNeoAnimate)){throw new Error("The neoWP JS variables have not been initialized yet. Problem with the enqueue global?")}
if(window.neoGlobalEnqueueBackendNeoAnimate&&window.neoGlobalEnqueueBackendNeoAnimate[variableName]!==undefined){return window.neoGlobalEnqueueBackendNeoAnimate[variableName]}
if(window.neoGlobalEnqueueFrontendNeoAnimate&&window.neoGlobalEnqueueFrontendNeoAnimate[variableName]!==undefined){return window.neoGlobalEnqueueFrontendNeoAnimate[variableName]}
throw new Error("Missing JS variable: "+variableName+". Make sure it is registered via enqueue_js_variable_backend(...) or enqueue_js_variable_frontend(...).")}
function jsVarExists(variableName){if(!(window.neoGlobalEnqueueBackendNeoAnimate||window.neoGlobalEnqueueFrontendNeoAnimate)){throw new Error("The neoWP JS variables have not been initialized yet. Problem with the enqueue global?")}
return(window.neoGlobalEnqueueBackendNeoAnimate||window.neoGlobalEnqueueFrontendNeoAnimate)?.[variableName]!==undefined}
function neo__(enStr,deStr){if(!window.wp?.i18n?.getLocaleData){return enStr}
if((window.wp?.i18n?.getLocaleData?.()?.[""]?.lang??"").startsWith("de")){return deStr}
return enStr}
function toFixed(number,digits=0){return Number(number).toLocaleString(neo__("en-US","de-DE"),{minimumFractionDigits:digits,maximumFractionDigits:digits})}
function neoWarn(...message){(window.NeoLogWarnError?.neoWarn||console.warn)(...message)}
function neoError(...message){(window.NeoLogWarnError?.neoError||console.error)(...message)}
function neoInterfaceFunctionErrorMessage(){return neo__("neoWP: Incompatible function call. Make sure that all of your neoPlugins are up to date.","neoWP: Inkompatibler Interface-Aufruf. Stelle sicher, dass alle deine neoPlugins aktuell sind.")}
function isInterfaceFunctionErrorMessage(message){return message===neoInterfaceFunctionErrorMessage()}
async function neoLoadInterfaceFunc(callingPluginSlug,importPath,functionName){const interfaceModuleUrls=jsVar("neoInterfaceModuleUrls");let moduleUrl=null;for(const[baseUrl,jsRelPaths]of Object.entries(interfaceModuleUrls)){if(jsRelPaths.includes(importPath)){moduleUrl=baseUrl+"/"+importPath;break}}
const warnAboutIncompatiblePlugin=async(reason)=>{if(functionName.toLowerCase().includes("suppressErrorPopup".toLowerCase())){return}
neoWarn(`neoWP: Incompatible function call in plugin "${callingPluginSlug}". The function "${functionName}" is not available. Reason: ${reason || "Function or module not found."} Make sure that all of your neoPlugins are up to date.`);const Swal=(await import("./_global-sweetalert2.js")).default;Swal.fire({icon:"warning",title:neo__("Incompatible neoPlugin","Nicht kompatibles neoPlugin"),text:neo__(`The neoPlugin that provides this feature is not compatible with the current version of ${callingPluginSlug}. You can use this feature once all your neoPlugins are up to date. Update all neoPlugins.`,`Das neoPlugin, das diese Funktion bereitstellt, ist nicht mit der aktuellen Version von ${callingPluginSlug} kompatibel. Du kannst dieses Feature verwenden, sobald alle deine neoPlugins auf dem aktuellen Stand sind. Aktualisiere alle neoPlugins.`),showCloseButton:!0,showConfirmButton:!0,showDenyButton:!1,confirmButtonText:neo__("OK","OK"),})};if(!moduleUrl){warnAboutIncompatiblePlugin();throw new Error(neoInterfaceFunctionErrorMessage())}
const module=await import(moduleUrl);if(!module[functionName]){warnAboutIncompatiblePlugin();throw new Error(neoInterfaceFunctionErrorMessage())}
return module[functionName]}
function isModuleAvailable(moduleName){return jsVar("neoAvailableModules").includes(moduleName)}
async function transformImgIntoSvg(imgNode){transformImgIntoSvg.svgIdsByImgNode??=new Map();const removeExistingSvgForImgNode=()=>{const svgNodeId=transformImgIntoSvg.svgIdsByImgNode.get(imgNode);if(!svgNodeId){return}
document.querySelector(`[data-neo-draw--svg-id="${svgNodeId}"]`)?.remove();document.querySelector(`style[data-neo-draw--computed-base-styles-for-svg-id=${svgNodeId}]`)?.remove();transformImgIntoSvg.svgIdsByImgNode.delete(imgNode)};if(!imgNode.getAttribute("src")){removeExistingSvgForImgNode();return}
const isNeoDraw=imgNode.getAttribute("src").includes("neo-draw=true");if(!isNeoDraw){removeExistingSvgForImgNode();return}
const isLinked=imgNode.getAttribute("src").includes("neo-draw--linked=true");let isAnimated=!1;try{isAnimated=await(await neoLoadInterfaceFunc("neo-animate","neo-animate--frontend-interface.js","interfaceIsNeoDrawImageAnimatedSuppressErrorPopup20260607"))(imgNode)}catch(e){isAnimated=!1}
if(!(isLinked||isAnimated)){removeExistingSvgForImgNode();return}
transformImgIntoSvg.svgIndexCounterForIds??=0;let svgNodeId;if(transformImgIntoSvg.svgIdsByImgNode.has(imgNode)){svgNodeId=transformImgIntoSvg.svgIdsByImgNode.get(imgNode);document.querySelector(`[data-neo-draw--svg-id="${svgNodeId}"]`)?.remove()}else{svgNodeId=`neo-draw--svg-${transformImgIntoSvg.svgIndexCounterForIds}`;transformImgIntoSvg.svgIndexCounterForIds+=1;transformImgIntoSvg.svgIdsByImgNode.set(imgNode,svgNodeId)}
await new Promise((resolve,reject)=>{if(imgNode.complete){resolve()}else{const resolveAndRemoveOldListeners=()=>{resolve();imgNode.removeEventListener("load",resolveAndRemoveOldListeners);imgNode.removeEventListener("error",rejectAndRemoveOldListeners)};const rejectAndRemoveOldListeners=()=>{reject();imgNode.removeEventListener("load",resolveAndRemoveOldListeners);imgNode.removeEventListener("error",rejectAndRemoveOldListeners)};imgNode.addEventListener("load",resolveAndRemoveOldListeners);imgNode.addEventListener("error",rejectAndRemoveOldListeners)}});const{fitProtocolToFetchImgUrl}=await import("./_global--url-helper.js");const resp=await fetch(fitProtocolToFetchImgUrl(imgNode.src));if(!resp.ok){throw new Error("The image "+imgNode.src+" could not be loaded. Error code: "+resp.status)}
const svgContent=await(resp).text();if(!svgContent.includes("<svg")){throw new Error("The image "+imgNode.src+"is not a valid SVG image. It does not contain an <svg> tag.")}
const{DomNodeHelper}=await import("./_global--dom-node-helper.js");const svgNode=new DomNodeHelper(svgContent).withClass("neo-draw--unpacked-svg").getNode();svgNode.setAttribute("data-neo-draw--svg-id",svgNodeId);const allIds=[...[...svgNode.querySelectorAll("[id]")].map(node=>node.getAttribute("id")),...[...svgNode.querySelectorAll("[data-neo-animate--id]")].map(node=>node.getAttribute("data-neo-animate--id")),].filter((value,index,self)=>self.indexOf(value)===index);let svgInnerHtml=svgNode.innerHTML;for(const id of allIds){if(id.length<10){const{neoWarn}=await import("./_global--log.js");neoWarn(`neoDraw: The ID "${id}" in the SVG "${svgNodeId}" (src "${imgNode.src}") is very short. It is probably not unique. Please make sure that all IDs in the SVG are unique.`);continue}
svgInnerHtml=svgInnerHtml.replaceAll(id,`${svgNodeId}-${id}-unique`.replaceAll("-","_"))}
svgNode.innerHTML=svgInnerHtml;function copyComputedBaseStylesFromImgNodeToSvgNode(imgNode){document.querySelector(`style[data-neo-draw--computed-base-styles-for-svg-id=${svgNodeId}]`)?.remove();const inlineStyles=imgNode.getAttribute("style");imgNode.removeAttribute("style");const computedStyles=window.getComputedStyle(imgNode);let cssText="";const computedStylesLength=computedStyles.length;for(let i=0;i<computedStylesLength;i++){const styleName=computedStyles[i];if(styleName==="visibility")continue;cssText+=`${styleName}: ${computedStyles.getPropertyValue(styleName)}; `}
imgNode.style.setProperty("opacity","0","important");imgNode.classList.add("neo-animate--suppress-flash-prevention");cssText+=`visibility: ${computedStyles.getPropertyValue("visibility")}; `;const baseStylesTag=document.createElement("style");baseStylesTag.setAttribute("data-neo-draw--computed-base-styles-for-svg-id",svgNodeId);baseStylesTag.innerHTML=`svg[data-neo-draw--svg-id="${svgNodeId}"]:not(#more-specificity) { ${cssText} }
svg[data-neo-draw--svg-id="${svgNodeId}"]:not(#more-specificity) + img { display: none !important; }`;imgNode.parentNode.insertBefore(baseStylesTag,imgNode.nextSibling);imgNode.classList.remove("neo-animate--suppress-flash-prevention");if(inlineStyles===null)imgNode.removeAttribute("style");else{imgNode.setAttribute("style",inlineStyles)}}
copyComputedBaseStylesFromImgNodeToSvgNode(imgNode);new MutationObserver(async(mutations)=>{const cssLoadPromises=[];for(const mutation of mutations){for(const changedNode of[mutation.target,...mutation.addedNodes]){if(changedNode.tagName?.toLowerCase()==="link"){cssLoadPromises.push(new Promise(resolve=>{if(changedNode.sheet){resolve()}else{changedNode.addEventListener("load",resolve);changedNode.addEventListener("error",resolve)}}))}else if(changedNode.tagName?.toLowerCase()==="style"){let isNeoAnimateAnimationStyleNode=!1;try{isNeoAnimateAnimationStyleNode=await(await neoLoadInterfaceFunc("neo-animate","neo-animate--frontend-interface.js","interfaceIsNeoAnimateAnimationStyleNodeSuppressErrorPopup20260609"))(changedNode)}catch(e){if(!isInterfaceFunctionErrorMessage(e.message)){throw e}}
if(isNeoAnimateAnimationStyleNode){continue}
if(changedNode.getAttribute("data-neo-draw--computed-base-styles-for-svg-id")){continue}
cssLoadPromises.push(Promise.resolve())}}}
await Promise.allSettled(cssLoadPromises);if(cssLoadPromises.length>0){copyComputedBaseStylesFromImgNodeToSvgNode(imgNode)}}).observe(document.querySelector("html"),{childList:!0,subtree:!0});function transferAttributesFromImgToSvg(imgSourceNode,svgTargetNode){const neodrawClasses=[...svgTargetNode.classList].filter(c=>c.startsWith("neo-"));for(const attr of imgSourceNode.attributes){if(attr.value===svgTargetNode.getAttribute(attr.name)){continue}
svgTargetNode.setAttribute(attr.name,imgSourceNode.getAttribute(attr.name))}
neodrawClasses.forEach((neodrawClass)=>{svgTargetNode.classList.add(neodrawClass)})}
new MutationObserver(()=>{transferAttributesFromImgToSvg(imgNode,svgNode)}).observe(imgNode,{attributes:!0});transferAttributesFromImgToSvg(imgNode,svgNode);imgNode.parentNode.insertBefore(svgNode,imgNode);if(isAnimated){try{await(await neoLoadInterfaceFunc("neo-animate","neo-animate--frontend-interface.js","interfaceStartNeoDrawSvgAnimationSuppressErrorPopup20260607"))({svgNode})}catch(e){if(!isInterfaceFunctionErrorMessage(e.message)){throw e}}}}
domLoaded(async()=>{await Promise.allSettled([...document.querySelectorAll("img")].map(node=>{return transformImgIntoSvg(node)}));new MutationObserver((mutations)=>{for(const mutation of mutations){if(mutation.type==="attributes"&&mutation.attributeName==="src"){if(mutation.target.tagName.toLowerCase()!=="img"){continue}
transformImgIntoSvg(mutation.target)}
for(const node of mutation.addedNodes){if(node.tagName?.toLowerCase()!=="img"){continue}
transformImgIntoSvg(node)}}}).observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["src"]})})})()