@microblink/blinkid-imagecapture-in-browser-sdk
Version:
A smart image capturing library for WebAssembly-enabled browsers.
1 lines • 8.77 kB
JavaScript
let e,t,n=!1,l=!1;const s="undefined"!=typeof window?window:{},o=s.document||{head:{}},c={t:0,l:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,l)=>e.addEventListener(t,n,l),rel:(e,t,n,l)=>e.removeEventListener(t,n,l),ce:(e,t)=>new CustomEvent(e,t)},i=e=>Promise.resolve(e),r=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(e){}return!1})(),a=(e,t,n)=>{n&&n.map((([n,l,s])=>{const o=f(e,n),i=u(t,s),r=d(n);c.ael(o,l,i,r),(t.o=t.o||[]).push((()=>c.rel(o,l,i,r)))}))},u=(e,t)=>n=>{try{256&e.t?e.i[t](n):(e.u=e.u||[]).push([t,n])}catch(e){X(e)}},f=(e,t)=>8&t?s:e,d=e=>0!=(2&e),p=new WeakMap,h=e=>"sc-"+e.p,m={},$=e=>"object"==(e=typeof e)||"function"===e,y=(e,t,...n)=>{let l=null,s=!1,o=!1,c=[];const i=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?i(l):null!=l&&"boolean"!=typeof l&&((s="function"!=typeof e&&!$(l))&&(l+=""),s&&o?c[c.length-1].h+=l:c.push(s?b(null,l):l),o=s)};if(i(n),t){const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}const r=b(e,null);return r.m=t,c.length>0&&(r.$=c),r},b=(e,t)=>({t:0,g:e,h:t,v:null,$:null,m:null}),w={},g=(e,t,n,l,o,i)=>{if(n!==l){let r=Q(e,t),a=t.toLowerCase();if("class"===t){const t=e.classList,s=j(n),o=j(l);t.remove(...s.filter((e=>e&&!o.includes(e)))),t.add(...o.filter((e=>e&&!s.includes(e))))}else if("ref"===t)l&&l(e);else if(r||"o"!==t[0]||"n"!==t[1]){const s=$(l);if((r||s&&null!==l)&&!o)try{if(e.tagName.includes("-"))e[t]=l;else{let s=null==l?"":l;"list"===t?r=!1:null!=n&&e[t]==s||(e[t]=s)}}catch(e){}null==l||!1===l?!1===l&&""!==e.getAttribute(t)||e.removeAttribute(t):(!r||4&i||o)&&!s&&e.setAttribute(t,l=!0===l?"":l)}else t="-"===t[2]?t.slice(3):Q(s,a)?a.slice(2):a[2]+t.slice(3),n&&c.rel(e,t,n,!1),l&&c.ael(e,t,l,!1)}},v=/\s/,j=e=>e?e.split(v):[],S=(e,t,n,l)=>{const s=11===t.v.nodeType&&t.v.host?t.v.host:t.v,o=e&&e.m||m,c=t.m||m;for(l in o)l in c||g(s,l,o[l],void 0,n,t.t);for(l in c)g(s,l,o[l],c[l],n,t.t)},O=(t,l,s)=>{let c,i,r=l.$[s],a=0;if(null!==r.h)c=r.v=o.createTextNode(r.h);else{if(n||(n="svg"===r.g),c=r.v=o.createElementNS(n?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",r.g),n&&"foreignObject"===r.g&&(n=!1),S(null,r,n),null!=e&&c["s-si"]!==e&&c.classList.add(c["s-si"]=e),r.$)for(a=0;a<r.$.length;++a)i=O(t,r,a),i&&c.appendChild(i);"svg"===r.g?n=!1:"foreignObject"===c.tagName&&(n=!0)}return c},k=(e,n,l,s,o,c)=>{let i,r=e;for(r.shadowRoot&&r.tagName===t&&(r=r.shadowRoot);o<=c;++o)s[o]&&(i=O(null,l,o),i&&(s[o].v=i,r.insertBefore(i,n)))},C=(e,t,n,l,s)=>{for(;t<=n;++t)(l=e[t])&&(s=l.v,x(l),s.remove())},M=(e,t)=>e.g===t.g,P=(e,t)=>{const l=t.v=e.v,s=e.$,o=t.$,c=t.g,i=t.h;null===i?(n="svg"===c||"foreignObject"!==c&&n,"slot"===c||S(e,t,n),null!==s&&null!==o?((e,t,n,l)=>{let s,o=0,c=0,i=t.length-1,r=t[0],a=t[i],u=l.length-1,f=l[0],d=l[u];for(;o<=i&&c<=u;)null==r?r=t[++o]:null==a?a=t[--i]:null==f?f=l[++c]:null==d?d=l[--u]:M(r,f)?(P(r,f),r=t[++o],f=l[++c]):M(a,d)?(P(a,d),a=t[--i],d=l[--u]):M(r,d)?(P(r,d),e.insertBefore(r.v,a.v.nextSibling),r=t[++o],d=l[--u]):M(a,f)?(P(a,f),e.insertBefore(a.v,r.v),a=t[--i],f=l[++c]):(s=O(t&&t[c],n,c),f=l[++c],s&&r.v.parentNode.insertBefore(s,r.v));o>i?k(e,null==l[u+1]?null:l[u+1].v,n,l,c,u):c>u&&C(t,o,i)})(l,s,t,o):null!==o?(null!==e.h&&(l.textContent=""),k(l,null,t,o,0,o.length-1)):null!==s&&C(s,0,s.length-1),n&&"svg"===c&&(n=!1)):e.h!==i&&(l.data=i)},x=e=>{e.m&&e.m.ref&&e.m.ref(null),e.$&&e.$.map(x)},L=e=>I(e).j,U=(e,t,n)=>{const l=L(e);return{emit:e=>W(l,t,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:e})}},W=(e,t,n)=>{const l=c.ce(t,n);return e.dispatchEvent(l),l},D=(e,t)=>{t&&!e.S&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.S=t)))},E=(e,t)=>{if(e.t|=16,!(4&e.t))return D(e,e.O),ie((()=>R(e,t)));e.t|=512},R=(e,t)=>{const n=e.i;let l;return t?(e.t|=256,e.u&&(e.u.map((([e,t])=>q(n,e,t))),e.u=null),l=q(n,"componentWillLoad")):l=q(n,"componentWillUpdate"),N(l,(()=>T(e,n,t)))},T=async(e,t,n)=>{const l=e.j,s=l["s-rc"];n&&(e=>{const t=e.k,n=e.j,l=t.t,s=((e,t)=>{let n=h(t),l=ee.get(n);if(e=11===e.nodeType?e:o,l)if("string"==typeof l){let t,s=p.get(e=e.head||e);s||p.set(e,s=new Set),s.has(n)||(t=o.createElement("style"),t.innerHTML=l,e.insertBefore(t,e.querySelector("link")),s&&s.add(n))}else e.adoptedStyleSheets.includes(l)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,l]);return n})(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&l&&(n["s-sc"]=s,n.classList.add(s+"-h"))})(e);A(e,t),s&&(s.map((e=>e())),l["s-rc"]=void 0);{const t=l["s-p"],n=()=>F(e);0===t.length?n():(Promise.all(t).then(n),e.t|=4,t.length=0)}},A=(n,l)=>{try{l=l.render(),n.t&=-17,n.t|=2,((n,l)=>{const s=n.j,o=n.C||b(null,null),c=(e=>e&&e.g===w)(l)?l:y(null,null,l);t=s.tagName,c.g=null,c.t|=4,n.C=c,c.v=o.v=s.shadowRoot||s,e=s["s-sc"],P(o,c)})(n,l)}catch(e){X(e,n.j)}return null},F=e=>{const t=e.j,n=e.i,l=e.O;q(n,"componentDidRender"),64&e.t?q(n,"componentDidUpdate"):(e.t|=64,V(t),q(n,"componentDidLoad"),e.M(t),l||H()),e.P(t),e.S&&(e.S(),e.S=void 0),512&e.t&&ce((()=>E(e,!1))),e.t&=-517},H=()=>{V(o.documentElement),ce((()=>W(s,"appload",{detail:{namespace:"blinkid-imagecapture-in-browser"}})))},q=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){X(e)}},N=(e,t)=>e&&e.then?e.then(t):t(),V=e=>e.classList.add("hydrated"),_=(e,t,n)=>{if(t.L){e.watchers&&(t.U=e.watchers);const l=Object.entries(t.L),s=e.prototype;if(l.map((([e,[l]])=>{31&l||2&n&&32&l?Object.defineProperty(s,e,{get(){return((e,t)=>I(this).W.get(t))(0,e)},set(n){((e,t,n,l)=>{const s=I(e),o=s.j,c=s.W.get(t),i=s.t,r=s.i;if(n=((e,t)=>null==e||$(e)?e:4&t?"false"!==e&&(""===e||!!e):2&t?parseFloat(e):1&t?e+"":e)(n,l.L[t][0]),!(8&i&&void 0!==c||n===c)&&(s.W.set(t,n),r)){if(l.U&&128&i){const e=l.U[t];e&&e.map((e=>{try{r[e](n,c,t)}catch(e){X(e,o)}}))}2==(18&i)&&E(s,!1)}})(this,e,n,t)},configurable:!0,enumerable:!0}):1&n&&64&l&&Object.defineProperty(s,e,{value(...t){const n=I(this);return n.D.then((()=>n.i[e](...t)))}})})),1&n){const t=new Map;s.attributeChangedCallback=function(e,n,l){c.jmp((()=>{const n=t.get(e);if(this.hasOwnProperty(n))l=this[n],delete this[n];else if(s.hasOwnProperty(n)&&"number"==typeof this[n]&&this[n]==l)return;this[n]=(null!==l||"boolean"!=typeof this[n])&&l}))},e.observedAttributes=l.filter((([e,t])=>15&t[0])).map((([e,n])=>{const l=n[1]||e;return t.set(l,e),l}))}}return e},z=e=>{q(e,"connectedCallback")},B=(e,t={})=>{const n=[],l=t.exclude||[],i=s.customElements,u=o.head,f=u.querySelector("meta[charset]"),d=o.createElement("style"),p=[];let m,$=!0;Object.assign(c,t),c.l=new URL(t.resourcesUrl||"./",o.baseURI).href,e.map((e=>{e[1].map((t=>{const s={t:t[0],p:t[1],L:t[2],R:t[3]};s.L=t[2],s.R=t[3],s.U={};const o=s.p,u=class extends HTMLElement{constructor(e){super(e),K(e=this,s),1&s.t&&e.attachShadow({mode:"open"})}connectedCallback(){m&&(clearTimeout(m),m=null),$?p.push(this):c.jmp((()=>(e=>{if(0==(1&c.t)){const t=I(e),n=t.k,l=()=>{};if(1&t.t)a(e,t,n.R),z(t.i);else{t.t|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){D(t,t.O=n);break}}n.L&&Object.entries(n.L).map((([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}})),(async(e,t,n,l,s)=>{if(0==(32&t.t)){{if(t.t|=32,(s=Z(n)).then){const e=()=>{};s=await s,e()}s.isProxied||(n.U=s.watchers,_(s,n,2),s.isProxied=!0);const e=()=>{};t.t|=8;try{new s(t)}catch(e){X(e)}t.t&=-9,t.t|=128,e(),z(t.i)}if(s.style){let e=s.style;const t=h(n);if(!ee.has(t)){const l=()=>{};((e,t,n)=>{let l=ee.get(e);r&&n?(l=l||new CSSStyleSheet,l.replace(t)):l=t,ee.set(e,l)})(t,e,!!(1&n.t)),l()}}}const o=t.O,c=()=>E(t,!0);o&&o["s-rc"]?o["s-rc"].push(c):c()})(0,t,n)}l()}})(this)))}disconnectedCallback(){c.jmp((()=>(()=>{if(0==(1&c.t)){const e=I(this),t=e.i;e.o&&(e.o.map((e=>e())),e.o=void 0),q(t,"disconnectedCallback")}})()))}componentOnReady(){return I(this).T}};s.A=e[0],l.includes(o)||i.get(o)||(n.push(o),i.define(o,_(u,s,1)))}))})),d.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",d.setAttribute("data-styles",""),u.insertBefore(d,f?f.nextSibling:u.firstChild),$=!1,p.length?p.map((e=>e.connectedCallback())):c.jmp((()=>m=setTimeout(H,30)))},G=new WeakMap,I=e=>G.get(e),J=(e,t)=>G.set(t.i=e,t),K=(e,t)=>{const n={t:0,j:e,k:t,W:new Map};return n.D=new Promise((e=>n.P=e)),n.T=new Promise((e=>n.M=e)),e["s-p"]=[],e["s-rc"]=[],a(e,n,t.R),G.set(e,n)},Q=(e,t)=>t in e,X=(e,t)=>(0,console.error)(e,t),Y=new Map,Z=e=>{const t=e.p.replace(/-/g,"_"),n=e.A,l=Y.get(n);return l?l[t]:import(`./${n}.entry.js`).then((e=>(Y.set(n,e),e[t])),X)},ee=new Map,te=[],ne=[],le=(e,t)=>n=>{e.push(n),l||(l=!0,t&&4&c.t?ce(oe):c.raf(oe))},se=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){X(e)}e.length=0},oe=()=>{se(te),se(ne),(l=te.length>0)&&c.raf(oe)},ce=e=>i().then(e),ie=le(ne,!0);export{w as H,B as b,U as c,L as g,y as h,i as p,J as r}