@scandit/web-datacapture-core
Version:
Scandit Data Capture SDK for the Web
1 lines • 1.49 kB
JavaScript
import {a}from'../../chunks/chunk-XR65N6EG.js';async function g(r){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(r)).then(encodeURIComponent).then(e=>`data:image/svg+xml;charset=utf-8,${e}`)}var l="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8",n=(r,e,o)=>{r.hasAttribute(e)&&r.setAttribute(e,o);};function u(r,e){let o=false;for(let a of e.querySelectorAll(r))a.remove(),o=true;return o}function m(r){let e=false;for(let o of ["canvas","video","iframe"])e=u(o,r);return e=d(r),e}function d(r,e=l){let o=false;function a(t){if(t.nodeType!==Node.ELEMENT_NODE)return;t.localName==="img"&&(n(t,"src",e),n(t,"srcset",e),o=true),(t.localName==="picture"||t.localName==="source")&&(n(t,"srcset",e),o=true),t.localName==="image"&&(n(t,"href",e),n(t,"xlink:href",e),o=true);let i=window.getComputedStyle(t);t instanceof HTMLElement&&i.backgroundImage.includes("url(")&&(t.style.setProperty("background-image",`url(${e})`,"important"),o=true),t instanceof HTMLElement&&i.background.includes("url(")&&(t.style.setProperty("background",`url(${e})`,"important"),o=true);for(let c of [...t.children])a(c);}return a(r),o}function p(r,e){r&&e!=null&&m(e)&&a.warn("View has been cleaned: custom images are not supported from your license, please contact support@scandit.com");}export{l as placeholderImage,u as removeElementsBySelector,m as removeUnwantedHTMLElement,d as replaceImages,p as stripImagesFromViewAndWarnUser,g as svgToDataURL};