UNPKG

gy-roslib

Version:

gy

1 lines 1.15 kB
var initWasm=async(_0x104b4e={},_0x514c17)=>{let _0x5c1397;if(_0x514c17['startsWith']('data:')){const _0x32094f=_0x514c17['replace'](/^data:.*?base64,/,'');let _0x49e909;if(typeof Buffer==='function'&&typeof Buffer['from']==='function')_0x49e909=Buffer['from'](_0x32094f,'base64');else{if(typeof atob==='function'){const _0x504463=atob(_0x32094f);_0x49e909=new Uint8Array(_0x504463['length']);for(let _0x4089d7=0x0;_0x4089d7<_0x504463['length'];_0x4089d7++){_0x49e909[_0x4089d7]=_0x504463['charCodeAt'](_0x4089d7);}}else throw new Error('Failed\x20to\x20decode\x20base64-encoded\x20data\x20URL,\x20Buffer\x20and\x20atob\x20are\x20not\x20supported');}_0x5c1397=await WebAssembly['instantiate'](_0x49e909,_0x104b4e);}else{const _0x22b8aa=await fetch(_0x514c17),_0x34dc75=_0x22b8aa['headers']['get']('Content-Type')||'';if('instantiateStreaming'in WebAssembly&&_0x34dc75['startsWith']('application/wasm'))_0x5c1397=await WebAssembly['instantiateStreaming'](_0x22b8aa,_0x104b4e);else{const _0xea533f=await _0x22b8aa['arrayBuffer']();_0x5c1397=await WebAssembly['instantiate'](_0xea533f,_0x104b4e);}}return _0x5c1397['instance'];};export{initWasm as i};