Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@loaders.gl/core

Package Overview
Dependencies
Maintainers
9
Versions
337
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@loaders.gl/core - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

2

dist/dist.min.js

@@ -1,1 +0,1 @@

!function(e,n){if("object"==typeof exports&&"object"==typeof module)module.exports=n();else if("function"==typeof define&&define.amd)define([],n);else{var t=n();for(var r in t)("object"==typeof exports?exports:e)[r]=t[r]}}(window,function(){return function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)t.d(r,o,function(n){return e[n]}.bind(null,o));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=4)}([function(e,n,t){"use strict";(function(e,r){t.d(n,"c",function(){return o}),t.d(n,"e",function(){return u}),t.d(n,"f",function(){return c}),t.d(n,"b",function(){return a}),t.d(n,"a",function(){return s}),t.d(n,"d",function(){return l});const o="object"!=typeof e||"[object process]"!==String(e)||e.browser,i={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==r&&r,document:"undefined"!=typeof document&&document},u=i.self||i.window||i.global,c=i.window||i.self||i.global,a=i.global||i.self||i.window,s=i.document||{},f=void 0!==e&&e.version.match(/v([0-9]*)/),l=f&&parseFloat(f[1])||0}).call(this,t(5),t(3))},function(e,n){},function(e,n){},function(e,n){var t;t=function(){return this}();try{t=t||new Function("return this")()}catch(e){"object"==typeof window&&(t=window)}e.exports=t},function(e,n,t){(function(n){const r=t(6),o="undefined"==typeof window?n:window;o.loaders=o.loaders||{},e.exports=Object.assign(o.loaders,r)}).call(this,t(3))},function(e,n){var t,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function c(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:u}catch(e){r=u}}();var a,s=[],f=!1,l=-1;function d(){f&&a&&(f=!1,a.length?s=a.concat(s):l=-1,s.length&&y())}function y(){if(!f){var e=c(d);f=!0;for(var n=s.length;n;){for(a=s,s=[];++l<n;)a&&a[l].run();l=-1,n=s.length}a=null,f=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===u||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(n){try{return r.call(null,e)}catch(n){return r.call(this,e)}}}(e)}}function p(e,n){this.fun=e,this.array=n}function w(){}o.nextTick=function(e){var n=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)n[t-1]=arguments[t];s.push(new p(e,n)),1!==s.length||f||c(y)},p.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=w,o.addListener=w,o.once=w,o.off=w,o.removeListener=w,o.removeAllListeners=w,o.emit=w,o.prependListener=w,o.prependOnceListener=w,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(e,n,t){"use strict";t.r(n);const r=e=>"boolean"==typeof e,o=e=>"function"==typeof e,i=e=>null!==e&&"object"==typeof e,u=e=>i(e)&&o(e.then),c=e=>e&&"function"==typeof e[Symbol.iterator],a=e=>e&&"function"==typeof e[Symbol.asyncIterator],s=e=>i(e)&&"done"in e&&"value"in e,f=e=>"undefined"!=typeof Response&&e instanceof Response||e.arrayBuffer&&e.text&&e.json,l=e=>(e=>"undefined"!=typeof File&&e instanceof File)(e)||(e=>"undefined"!=typeof Blob&&e instanceof Blob)(e),d=e=>(e=>i(e)&&o(e.tee)&&o(e.cancel)&&o(e.pipeTo)&&o(e.getReader))(e)||(e=>i(e)&&o(e.read)&&o(e.pipe)&&r(e.readable))(e),y=e=>(e=>i(e)&&o(e.abort)&&o(e.getWriter))(e)||(e=>i(e)&&o(e.end)&&o(e.write)&&r(e.writable))(e);function p(e,n){if(!e)throw new Error(n||"loader assertion failed.")}function w(e){if(!e)return!1;return Array.isArray(e)&&(e=e[0]),e.parseTextSync||e.parseSync||e.parse||e.loadAndParse||e.parseStream||e.parseInBatches||e.worker}function b(e){let n;return p(w(e)),Array.isArray(e)&&(n=e[1],e=e[0],e={...e,options:{...e.options,...n}}),e.extension&&(e.extensions=e.extensions||e.extension,delete e.extension),Array.isArray(e.extensions)||(e.extensions=[e.extensions]),p(e.extensions&&e.extensions.length>0&&e.extensions[0]),e.parseTextSync&&(e.text=!0),e.text||(e.binary=!0),e}const h=/[^.]+$/;function g(e,n,{url:t=""}={}){let r=null;return r=(r=r||function(e,n){const t=n.match(h),r=t&&t[0];return r&&function(e,n){n=n.toLowerCase();for(const t of e){b(t);for(const e of t.extensions)if(e.toLowerCase()===n)return t}return null}(e,r)}(n,t))||function(e,n){for(const t of e)if("string"==typeof n){if(A(n,t))return t}else if(n instanceof ArrayBuffer&&m(n,t))return t;return null}(n,e)}function A(e,n){return n.testText&&n.testText(e)}function m(e,n){switch(Array.isArray(n.test)?"array":typeof n.test){case"function":return n.test(e,n);case"string":case"array":const t=0;return(Array.isArray(n.test)?n.test:[n.test]).some(n=>{return n===function(e,n=0,t){if(e.byteLength<=n+t)return"";const r=new DataView(e);let o="";for(let e=0;e<t;e++)o+=String.fromCharCode(r.getUint8(n+e));return o}(e,t,n.length)});default:return!1}}class x{log(){}info(){}warn(){}error(){}}function T(e,n){return null===(e=Object.assign({},n&&n.DEFAULT_OPTIONS,n&&n.defaultOptions,n&&n.options,e,{dataType:"arraybuffer"})).log&&(e.log=new x),"log"in e||(e.log=console),e}const S={};function B(e){e=Array.isArray(e)?e:[e];for(const n of e){const e=b(n);for(const n of e.extensions)S[n]=e}}function v(){return Object.values(S)}const F=e=>e&&e instanceof ArrayBuffer,O=e=>e&&"undefined"!=typeof Blob&&e instanceof Blob,j=e=>e&&e instanceof Buffer;function I(e){if(F(e))return e;if(j(e)){return new Uint8Array(e).buffer}if(ArrayBuffer.isView(e))return e.buffer;if("string"==typeof e){const n=e;return(new TextEncoder).encode(n).buffer}return p(!1)}function E(e){return new Promise((n,t)=>{let r;const o=new FileReader;o.onload=e=>{r=e.target.result},o.onloadend=e=>n(r),o.onerror=t,o.readAsArrayBuffer(e)})}function L(e){return new DataView(I(e))}const P=new Map;function _(e,n,t){const r=function(e){let n=P.get(e);if(!n){const t=new Blob([e],{type:"application/javascript"});n=URL.createObjectURL(t),P.set(e,n)}return new Worker(n)}(e);t=function(e){null!==(e=Object.assign({},e)).log&&delete e.log;return e}(t);const o=(e,n)=>new Promise((t,o)=>{r.onmessage=e=>{switch(e.data.type){case"done":t(e.data.result),r.terminate();break;case"error":o(new Error(e.data.message))}};const i=I(e);r.postMessage({arraybuffer:i,opts:n},[i])});return n?o(n,t):o}var R=t(0);function U(e){if(R.c||R.d>=10){if("function"==typeof e[Symbol.asyncIterator])return e;if("function"==typeof e.getIterator)return e.getIterator()}return R.c?async function*(e){const n=e.getReader();try{for(;;){const{done:e,value:t}=await n.read();if(e)return;yield t}}finally{n.releaseLock()}}(e):async function*(e){e=await e;for(;;){const n=e.read();if(null===n){if(e._readableState.ended)return;await D(e)}else yield n}}(e)}async function D(e){return new Promise(n=>{e.once("readable",n)})}class k{constructor(e){this._fileOrBlob=e,this.bodyUsed=!1}get headers(){return new Headers({"Content-Length":this._fileOrBlob.size,"Content-Type":this._fileOrBlob.type})}url(){return this._fileOrBlob.name||""}async arrayBuffer(){const{reader:e,promise:n}=this._getFileReader();return e.readAsArrayBuffer(this._fileOrBlob),n}async text(){const{reader:e,promise:n}=this._getFileReader();return e.readAsText(this._fileOrBlob),n}async json(){const e=await this.text();return JSON.parse(e)}_getFileReader(){let e;p(!this.bodyUsed),this.bodyUsed=!0;const n=new Promise((n,t)=>{try{(e=new FileReader).onerror=e=>t(new Error(e)),e.onabort=()=>t(new Error("Read aborted.")),e.onload=()=>n(e.result)}catch(e){t(e)}});return{reader:e,promise:n}}}function C(e,n){return Promise.resolve(new k(e,n))}const M="Cannot convert supplied data type";function W(e,n){if(n.text&&"string"==typeof e)return e;if(e instanceof ArrayBuffer||ArrayBuffer.isView(e)){const t=e.buffer||e;if(n.text&&!n.binary){return new TextDecoder("utf8").decode(t)}return t}throw new Error(M)}async function V(e,n){if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return function*(){yield e.buffer||e}();if(s(e))return e;if(c(e))return e[Symbol.iterator]();throw new Error(M)}async function $(e,n,t,r){return r=r||function(e){return f(e)?e.url:null}(e),e=await async function(e,n){const t=(e=await e)instanceof ArrayBuffer||ArrayBuffer.isView(e);if("string"==typeof e||t)return W(e,n);if(l(e)&&(e=await C(e)),f(e))return n.binary?await e.arrayBuffer():e.text();throw new Error(M)}(e,n),n.parseTextSync&&"string"==typeof e?(t.dataType="text",n.parseTextSync(e,t,r,n)):n.parseSync?n.parseSync(e,t,r,n):n.parse?await n.parse(e,t,r,n):n.worker?await _(n.worker,e,t):p(!1)}async function N(e,n,t,r){if(n.parseInBatches){const o=await async function(e,n){return s(e)?e:f(e)&&e.body?U(e.body):d(e)?U(e):a(e)?e[Symbol.asyncIterator]():V(e)}(e);return n.parseInBatches(o,t,r,n)}return null}async function z(e,n,t,r){Array.isArray(n)||w(n)||(r=t,t=n,n=null);const o=l(r)?r.name:r;n=n||v();const i=Array.isArray(n)?g(e,n,{url:o}):n;return i?(b(i),t=T(t,i),await $(e,i,t,o)):null}function H(e,n,t,r){Array.isArray(n)||w(n)||(r=t,t=n,n=null),n=n||v();const o=Array.isArray(n)?g(e,n,{url:r}):n;return b(o),function(e,n,t,r){return e=W(e,n),n.parseTextSync&&"string"==typeof e?n.parseTextSync(e,t,r,n):n.parseSync?n.parseSync(e,t,r,n):p(!1)}(e,o,t=T(t,o),r)}async function J(e,n,t,r){Array.isArray(n)||w(n)||(r=t,t=n,n=null),n=n||v();const o=Array.isArray(n)?g(null,n,{url:r}):n;return b(o),N(e,o,t=T(t,o),r)}async function q(e,n,t,r){Array.isArray(n)||w(n)||(r=t,t=n,n=null),n=n||v();const o=Array.isArray(n)?g(null,n,{url:r}):n;return b(o),N(e,o,t=T(t,o),r)}let G="";const K={};function Q(e){G=e}function X(){return G}function Y(e){for(const n in K)if(e.startsWith(n)){const t=K[n];return e.replace(n,t)}return e+=G}async function Z(e,n){return l(e)?C(e,n):(e=Y(e),fetch(e,n))}async function ee(e,n,t){return J(await Z(e,t),n,t,e)}async function ne(e,n,t){Array.isArray(n)||w(n)||(t=n,n=null);const r=l(e)?e.name:e;n=n||v();const o=Array.isArray(n)?g(null,n,{url:r}):n;if(t=T(t,o),o&&o.loadAndParse)return await o.loadAndParse(e,t);let i=e;return(l(i)||"string"==typeof i)&&(i=await Z(e,t)),z(i,n,t,r)}var te=t(2);const re={dataType:"arraybuffer",nothrow:!0},oe=e=>e.startsWith("data:");function ie(e,n){return n=function(e={}){return(e=Object.assign({},re,e)).responseType=e.responseType||e.dataType,e}(n),oe(e),n.nothrow||p(!1),null}function ue(e,n={}){return e=Y(e),!R.c&&te.readFileSync?te.readFileSync(e,n):ie(e,n)}var ce=t(1);function ae(e,n,t){return e=Y(e),!R.c&&ce.writeFile?ce.writeFile(e,n,t):p(!1)}function se(e,n,t){return e=Y(e),!R.c&&ce.writeFileSync?ce.writeFileSync(e,n,t):p(!1)}function fe(e){return`Failed to fetch resource ${e.url}(${e.status}): ${e.statusText} `}async function le(e){let n=`Failed to fetch resource ${e.url} (${e.status}): `;try{e.headers.get("Content-Type").includes("application/json")?n+=await e.text():n+=e.statusText}catch(e){return n}return n}function de(e,n,t,r){if(n.encode)return n.encode(e,t);if(n.encodeSync)return Promise.resolve(n.encodeSync(e,t));throw new Error("Writer could not encode data")}function ye(e,n,t,r){if(n.encodeSync)return n.encodeSync(e,t);throw new Error("Writer could not synchronously encode data")}function pe(e,n,t,r){if(n.encodeInBatches)return n.encodeInBatches(e,t);throw new Error("Writer could not encode data in batches")}function we(e,n,t,r){return ae(n,de(e,t,r))}function be(e,n,t,r){return se(n,ye(e,t,r))}function he(e){return e+3&-4}function ge(e,n,t,r=n.byteLength){const o=new Uint8Array(e,t,r),i=new Uint8Array(n);return o.set(i),e}function Ae(e,n,t){let r;if(e instanceof ArrayBuffer)r=new Uint8Array(e);else{const n=e.byteOffset,t=e.byteLength;r=new Uint8Array(e.buffer,n,t)}return n.set(r,t),t+he(r.byteLength)}function me(e,n){const t=e instanceof ArrayBuffer?new Uint8Array(e):e,r=n instanceof ArrayBuffer?new Uint8Array(n):n,o=new Uint8Array(t.byteLength+r.byteLength);return o.set(t,0),o.set(r,t.byteLength),o}async function xe(e,n){for(;;){const{done:t,value:r}=await e.next();if(t)return void e.return();if(n(r))return}}async function Te(e){let n=new ArrayBuffer,t="";for await(const r of e)"string"==typeof r?t+=r:n=me(n,r);return n||t}async function*Se(e,n){const t=new TextDecoder(n);for await(const n of e)yield"string"==typeof n?n:t.decode(n,{stream:!0})}async function*Be(e){let n="";for await(const t of e){let e;for(n+=t;(e=n.indexOf("\n"))>=0;){const t=n.slice(0,e+1);n=n.slice(e+1),yield t}}n.length>0&&(yield n)}async function*ve(e){let n=1;for await(const t of e)yield{counter:n,line:t},n++}t.d(n,"TextEncoder",function(){return Fe}),t.d(n,"TextDecoder",function(){return Oe}),t.d(n,"createReadStream",function(){return je}),t.d(n,"parseFile",function(){return Ie}),t.d(n,"parseFileSync",function(){return Ee}),t.d(n,"loadFile",function(){return Le}),t.d(n,"setPathPrefix",function(){return Q}),t.d(n,"getPathPrefix",function(){return X}),t.d(n,"resolvePath",function(){return Y}),t.d(n,"fetchFile",function(){return Z}),t.d(n,"readFileSync",function(){return ue}),t.d(n,"writeFile",function(){return ae}),t.d(n,"writeFileSync",function(){return se}),t.d(n,"_getErrorMessageFromResponseSync",function(){return fe}),t.d(n,"_getErrorMessageFromResponse",function(){return le}),t.d(n,"registerLoaders",function(){return B}),t.d(n,"parse",function(){return z}),t.d(n,"parseSync",function(){return H}),t.d(n,"parseInBatches",function(){return J}),t.d(n,"parseInBatchesSync",function(){return q}),t.d(n,"load",function(){return ne}),t.d(n,"loadInBatches",function(){return ee}),t.d(n,"encode",function(){return de}),t.d(n,"encodeSync",function(){return ye}),t.d(n,"encodeInBatches",function(){return pe}),t.d(n,"save",function(){return we}),t.d(n,"saveSync",function(){return be}),t.d(n,"isPromise",function(){return u}),t.d(n,"isIterable",function(){return c}),t.d(n,"isAsyncIterable",function(){return a}),t.d(n,"isIterator",function(){return s}),t.d(n,"isFetchResponse",function(){return f}),t.d(n,"isReadableStream",function(){return d}),t.d(n,"isWritableStream",function(){return y}),t.d(n,"isArrayBuffer",function(){return F}),t.d(n,"isBlob",function(){return O}),t.d(n,"toArrayBuffer",function(){return I}),t.d(n,"blobToArrayBuffer",function(){return E}),t.d(n,"toDataView",function(){return L}),t.d(n,"padTo4Bytes",function(){return he}),t.d(n,"copyToArray",function(){return Ae}),t.d(n,"copyArrayBuffer",function(){return ge}),t.d(n,"getStreamIterator",function(){return U}),t.d(n,"forEach",function(){return xe}),t.d(n,"concatenateAsyncIterator",function(){return Te}),t.d(n,"lineAsyncIterator",function(){return Be}),t.d(n,"textDecoderAsyncIterator",function(){return Se}),t.d(n,"numberedLineAsyncIterator",function(){return ve}),t.d(n,"isBrowser",function(){return R.c}),t.d(n,"self",function(){return R.e}),t.d(n,"window",function(){return R.f}),t.d(n,"global",function(){return R.b}),t.d(n,"document",function(){return R.a}),t.d(n,"assert",function(){return p});const Fe=R.b.TextEncoder,Oe=R.b.TextDecoder;async function je(e,n){return console.warn("createReadStream() deprecated, use fetch().then(resp => resp.body)"),e=Y(e),(await Z(e,n)).body}function Ie(...e){return console.warn("parse() deprecated, use parse()"),z(...e)}function Ee(...e){return console.warn("parseSync() deprecated, use parseSync()"),H(...e)}function Le(...e){return console.warn("loadFile() deprecated, use load()"),ne(...e)}}])});
!function(e,n){if("object"==typeof exports&&"object"==typeof module)module.exports=n();else if("function"==typeof define&&define.amd)define([],n);else{var t=n();for(var r in t)("object"==typeof exports?exports:e)[r]=t[r]}}(window,function(){return function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)t.d(r,o,function(n){return e[n]}.bind(null,o));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=5)}([function(e,n,t){"use strict";(function(e,r){t.d(n,"c",function(){return o}),t.d(n,"e",function(){return u}),t.d(n,"f",function(){return c}),t.d(n,"b",function(){return a}),t.d(n,"a",function(){return s}),t.d(n,"d",function(){return l});const o="object"!=typeof e||"[object process]"!==String(e)||e.browser,i={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==r&&r,document:"undefined"!=typeof document&&document},u=i.self||i.window||i.global,c=i.window||i.self||i.global,a=i.global||i.self||i.window,s=i.document||{},f=void 0!==e&&e.version.match(/v([0-9]*)/),l=f&&parseFloat(f[1])||0}).call(this,t(6),t(4))},function(e,n){},function(e,n){},function(e,n){},function(e,n){var t;t=function(){return this}();try{t=t||new Function("return this")()}catch(e){"object"==typeof window&&(t=window)}e.exports=t},function(e,n,t){(function(n){const r=t(7),o="undefined"==typeof window?n:window;o.loaders=o.loaders||{},e.exports=Object.assign(o.loaders,r)}).call(this,t(4))},function(e,n){var t,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function c(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:u}catch(e){r=u}}();var a,s=[],f=!1,l=-1;function d(){f&&a&&(f=!1,a.length?s=a.concat(s):l=-1,s.length&&y())}function y(){if(!f){var e=c(d);f=!0;for(var n=s.length;n;){for(a=s,s=[];++l<n;)a&&a[l].run();l=-1,n=s.length}a=null,f=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===u||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(n){try{return r.call(null,e)}catch(n){return r.call(this,e)}}}(e)}}function p(e,n){this.fun=e,this.array=n}function w(){}o.nextTick=function(e){var n=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)n[t-1]=arguments[t];s.push(new p(e,n)),1!==s.length||f||c(y)},p.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=w,o.addListener=w,o.once=w,o.off=w,o.removeListener=w,o.removeAllListeners=w,o.emit=w,o.prependListener=w,o.prependOnceListener=w,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(e,n,t){"use strict";t.r(n);const r=e=>"boolean"==typeof e,o=e=>"function"==typeof e,i=e=>null!==e&&"object"==typeof e,u=e=>i(e)&&o(e.then),c=e=>e&&"function"==typeof e[Symbol.iterator],a=e=>e&&"function"==typeof e[Symbol.asyncIterator],s=e=>e&&o(e.next),f=e=>"undefined"!=typeof Response&&e instanceof Response||e.arrayBuffer&&e.text&&e.json,l=e=>(e=>"undefined"!=typeof File&&e instanceof File)(e)||(e=>"undefined"!=typeof Blob&&e instanceof Blob)(e),d=e=>(e=>i(e)&&o(e.tee)&&o(e.cancel)&&o(e.pipeTo)&&o(e.getReader))(e)||(e=>i(e)&&o(e.read)&&o(e.pipe)&&r(e.readable))(e),y=e=>(e=>i(e)&&o(e.abort)&&o(e.getWriter))(e)||(e=>i(e)&&o(e.end)&&o(e.write)&&r(e.writable))(e);function p(e,n){if(!e)throw new Error(n||"loader assertion failed.")}function w(e){if(!e)return!1;return Array.isArray(e)&&(e=e[0]),e.parseTextSync||e.parseSync||e.parse||e.loadAndParse||e.parseStream||e.parseInBatches||e.worker}function h(e){let n;return p(w(e)),Array.isArray(e)&&(n=e[1],e=e[0],e={...e,options:{...e.options,...n}}),e.extension&&(e.extensions=e.extensions||e.extension,delete e.extension),Array.isArray(e.extensions)||(e.extensions=[e.extensions]),p(e.extensions&&e.extensions.length>0&&e.extensions[0]),e.parseTextSync&&(e.text=!0),e.text||(e.binary=!0),e}const b=/[^.]+$/;function g(e,n,{url:t=""}={}){let r=null;return r=(r=r||function(e,n){const t=n.match(b),r=t&&t[0];return r&&function(e,n){n=n.toLowerCase();for(const t of e){h(t);for(const e of t.extensions)if(e.toLowerCase()===n)return t}return null}(e,r)}(n,t))||function(e,n){for(const t of e)if("string"==typeof n){if(m(n,t))return t}else if(n instanceof ArrayBuffer&&A(n,t))return t;return null}(n,e)}function m(e,n){return n.testText&&n.testText(e)}function A(e,n){switch(Array.isArray(n.test)?"array":typeof n.test){case"function":return n.test(e,n);case"string":case"array":const t=0;return(Array.isArray(n.test)?n.test:[n.test]).some(n=>{return n===function(e,n,t){if(e.byteLength<=n+t)return"";const r=new DataView(e);let o="";for(let e=0;e<t;e++)o+=String.fromCharCode(r.getUint8(n+e));return o}(e,t,n.length)});default:return!1}}class x{log(){}info(){}warn(){}error(){}}function S(e,n){return null===(e=Object.assign({},n&&n.DEFAULT_OPTIONS,n&&n.defaultOptions,n&&n.options,e,{dataType:"arraybuffer"})).log&&(e.log=new x),"log"in e||(e.log=console),e}const T={};function v(e){e=Array.isArray(e)?e:[e];for(const n of e){const e=h(n);for(const n of e.extensions)T[n]=e}}function B(){return Object.values(T)}var F=t(3);function O(e){if(F.toArrayBuffer&&(e=Object(F.toArrayBuffer)(e)),e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e))return e.buffer;if("string"==typeof e){const n=e;return(new TextEncoder).encode(n).buffer}return p(!1)}const j=new Map;function I(e,n,t){const r=function(e){let n=j.get(e);if(!n){const t=new Blob([e],{type:"application/javascript"});n=URL.createObjectURL(t),j.set(e,n)}return new Worker(n)}(e);t=function(e){null!==(e=Object.assign({},e)).log&&delete e.log;return e}(t);const o=(e,n)=>new Promise((t,o)=>{r.onmessage=e=>{switch(e.data.type){case"done":t(e.data.result),r.terminate();break;case"error":o(new Error(e.data.message))}};const i=O(e);r.postMessage({arraybuffer:i,opts:n},[i])});return n?o(n,t):o}var E=t(0);function P(e){if(E.c||E.d>=10){if("function"==typeof e[Symbol.asyncIterator])return e;if("function"==typeof e.getIterator)return e.getIterator()}return E.c?async function*(e){const n=e.getReader();try{for(;;){const{done:e,value:t}=await n.read();if(e)return;yield t}}finally{n.releaseLock()}}(e):async function*(e){e=await e;for(;;){const n=e.read();if(null===n){if(e._readableState.ended)return;await _(e)}else yield n}}(e)}async function _(e){return new Promise(n=>{e.once("readable",n)})}class L{constructor(e){this._fileOrBlob=e,this.bodyUsed=!1}get headers(){return new Headers({"Content-Length":this._fileOrBlob.size,"Content-Type":this._fileOrBlob.type})}url(){return this._fileOrBlob.name||""}async arrayBuffer(){const{reader:e,promise:n}=this._getFileReader();return e.readAsArrayBuffer(this._fileOrBlob),n}async text(){const{reader:e,promise:n}=this._getFileReader();return e.readAsText(this._fileOrBlob),n}async json(){const e=await this.text();return JSON.parse(e)}_getFileReader(){let e;p(!this.bodyUsed),this.bodyUsed=!0;const n=new Promise((n,t)=>{try{(e=new FileReader).onerror=e=>t(new Error(e)),e.onabort=()=>t(new Error("Read aborted.")),e.onload=()=>n(e.result)}catch(e){t(e)}});return{reader:e,promise:n}}}function R(e,n){return Promise.resolve(new L(e,n))}const U="Cannot convert supplied data type";function k(e,n){if(n.text&&"string"==typeof e)return e;if(e instanceof ArrayBuffer||ArrayBuffer.isView(e)){const t=e.buffer||e;if(n.text&&!n.binary){return new TextDecoder("utf8").decode(t)}return t}throw new Error(U)}function C(e){if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return function*(){yield e.buffer||e}();if(s(e))return e;if(c(e))return e[Symbol.iterator]();throw new Error(U)}async function M(e,n,t,r){return r=r||function(e){return f(e)?e.url:null}(e),e=await async function(e,n){const t=(e=await e)instanceof ArrayBuffer||ArrayBuffer.isView(e);if("string"==typeof e||t)return k(e,n);if(l(e)&&(e=await R(e)),f(e))return n.binary?await e.arrayBuffer():e.text();throw new Error(U)}(e,n),n.parseTextSync&&"string"==typeof e?(t.dataType="text",n.parseTextSync(e,t,r,n)):n.parseSync?n.parseSync(e,t,r,n):n.parse?await n.parse(e,t,r,n):n.worker?await I(n.worker,e,t):p(!1)}function W(e,n,t,r){if(n.parseInBatches){const o=function(e){return s(e)?e:f(e)&&e.body?P(e.body):d(e)?P(e):a(e)?e[Symbol.asyncIterator]():C(e)}(e);return n.parseInBatches(o,t,r,n)}return null}async function D(e,n,t,r){Array.isArray(n)||w(n)||(r=t,t=n,n=null);const o=l(r)?r.name:r;n=n||B();const i=Array.isArray(n)?g(e,n,{url:o}):n;return i?(h(i),t=S(t,i),await M(e,i,t,o)):null}function $(e,n,t,r){Array.isArray(n)||w(n)||(r=t,t=n,n=null),n=n||B();const o=Array.isArray(n)?g(e,n,{url:r}):n;return h(o),function(e,n,t,r){return e=k(e,n),n.parseTextSync&&"string"==typeof e?n.parseTextSync(e,t,r,n):n.parseSync?n.parseSync(e,t,r,n):p(!1)}(e,o,t=S(t,o),r)}async function V(e,n,t,r){Array.isArray(n)||w(n)||(r=t,t=n,n=null),n=n||B();const o=Array.isArray(n)?g(null,n,{url:r}):n;return h(o),W(e,o,t=S(t,o),r)}async function N(e,n,t,r){Array.isArray(n)||w(n)||(r=t,t=n,n=null),n=n||B();const o=Array.isArray(n)?g(null,n,{url:r}):n;return h(o),W(e,o,t=S(t,o),r)}let z="";const H={};function J(e){z=e}function q(){return z}function G(e){for(const n in H)if(e.startsWith(n)){const t=H[n];return e.replace(n,t)}return e+=z}async function K(e,n){return l(e)?R(e,n):(e=G(e),fetch(e,n))}async function Q(e,n,t){return V(await K(e,t),n,t,e)}async function X(e,n,t){Array.isArray(n)||w(n)||(t=n,n=null);const r=l(e)?e.name:e;n=n||B();const o=Array.isArray(n)?g(null,n,{url:r}):n;if(t=S(t,o),o&&o.loadAndParse)return await o.loadAndParse(e,t);let i=e;return(l(i)||"string"==typeof i)&&(i=await K(e,t)),D(i,n,t,r)}var Y=t(2);const Z={dataType:"arraybuffer",nothrow:!0},ee=e=>e.startsWith("data:");function ne(e,n){return n=function(e={}){return(e=Object.assign({},Z,e)).responseType=e.responseType||e.dataType,e}(n),ee(e),n.nothrow||p(!1),null}function te(e,n={}){return e=G(e),!E.c&&Y.readFileSync?Y.readFileSync(e,n):ne(e,n)}var re=t(1);function oe(e,n,t){return e=G(e),!E.c&&re.writeFile?re.writeFile(e,n,t):p(!1)}function ie(e,n,t){return e=G(e),!E.c&&re.writeFileSync?re.writeFileSync(e,n,t):p(!1)}function ue(e){return`Failed to fetch resource ${e.url}(${e.status}): ${e.statusText} `}async function ce(e){let n=`Failed to fetch resource ${e.url} (${e.status}): `;try{e.headers.get("Content-Type").includes("application/json")?n+=await e.text():n+=e.statusText}catch(e){return n}return n}function ae(e,n,t,r){if(n.encode)return n.encode(e,t);if(n.encodeSync)return Promise.resolve(n.encodeSync(e,t));throw new Error("Writer could not encode data")}function se(e,n,t,r){if(n.encodeSync)return n.encodeSync(e,t);throw new Error("Writer could not synchronously encode data")}function fe(e,n,t,r){if(n.encodeInBatches)return n.encodeInBatches(e,t);throw new Error("Writer could not encode data in batches")}function le(e,n,t,r){return oe(n,ae(e,t,r))}function de(e,n,t,r){return ie(n,se(e,t,r))}function ye(e,n){const t=e instanceof ArrayBuffer?new Uint8Array(e):e,r=n instanceof ArrayBuffer?new Uint8Array(n):n,o=new Uint8Array(t.byteLength+r.byteLength);return o.set(t,0),o.set(r,t.byteLength),o}async function pe(e,n){for(;;){const{done:t,value:r}=await e.next();if(t)return void e.return();if(n(r))return}}async function we(e){let n=new ArrayBuffer,t="";for await(const r of e)"string"==typeof r?t+=r:n=ye(n,r);return t||n}async function*he(e,n){const t=new TextDecoder(n);for await(const n of e)yield"string"==typeof n?n:t.decode(n,{stream:!0})}async function*be(e){let n="";for await(const t of e){let e;for(n+=t;(e=n.indexOf("\n"))>=0;){const t=n.slice(0,e+1);n=n.slice(e+1),yield t}}n.length>0&&(yield n)}async function*ge(e){let n=1;for await(const t of e)yield{counter:n,line:t},n++}t.d(n,"TextEncoder",function(){return me}),t.d(n,"TextDecoder",function(){return Ae}),t.d(n,"createReadStream",function(){return xe}),t.d(n,"parseFile",function(){return Se}),t.d(n,"parseFileSync",function(){return Te}),t.d(n,"loadFile",function(){return ve}),t.d(n,"setPathPrefix",function(){return J}),t.d(n,"getPathPrefix",function(){return q}),t.d(n,"resolvePath",function(){return G}),t.d(n,"fetchFile",function(){return K}),t.d(n,"readFileSync",function(){return te}),t.d(n,"writeFile",function(){return oe}),t.d(n,"writeFileSync",function(){return ie}),t.d(n,"_getErrorMessageFromResponseSync",function(){return ue}),t.d(n,"_getErrorMessageFromResponse",function(){return ce}),t.d(n,"registerLoaders",function(){return v}),t.d(n,"parse",function(){return D}),t.d(n,"parseSync",function(){return $}),t.d(n,"parseInBatches",function(){return V}),t.d(n,"parseInBatchesSync",function(){return N}),t.d(n,"load",function(){return X}),t.d(n,"loadInBatches",function(){return Q}),t.d(n,"encode",function(){return ae}),t.d(n,"encodeSync",function(){return se}),t.d(n,"encodeInBatches",function(){return fe}),t.d(n,"save",function(){return le}),t.d(n,"saveSync",function(){return de}),t.d(n,"isPromise",function(){return u}),t.d(n,"isIterable",function(){return c}),t.d(n,"isAsyncIterable",function(){return a}),t.d(n,"isIterator",function(){return s}),t.d(n,"isFetchResponse",function(){return f}),t.d(n,"isReadableStream",function(){return d}),t.d(n,"isWritableStream",function(){return y}),t.d(n,"toArrayBuffer",function(){return O}),t.d(n,"getStreamIterator",function(){return P}),t.d(n,"forEach",function(){return pe}),t.d(n,"concatenateAsyncIterator",function(){return we}),t.d(n,"lineAsyncIterator",function(){return be}),t.d(n,"textDecoderAsyncIterator",function(){return he}),t.d(n,"numberedLineAsyncIterator",function(){return ge}),t.d(n,"isBrowser",function(){return E.c}),t.d(n,"self",function(){return E.e}),t.d(n,"window",function(){return E.f}),t.d(n,"global",function(){return E.b}),t.d(n,"document",function(){return E.a}),t.d(n,"assert",function(){return p});const me=E.b.TextEncoder,Ae=E.b.TextDecoder;async function xe(e,n){return console.warn("createReadStream() deprecated, use fetch().then(resp => resp.body)"),e=G(e),(await K(e,n)).body}function Se(...e){return console.warn("parse() deprecated, use parse()"),D(...e)}function Te(...e){return console.warn("parseSync() deprecated, use parseSync()"),$(...e)}function ve(...e){return console.warn("loadFile() deprecated, use load()"),X(...e)}}])});

@@ -210,14 +210,2 @@ "use strict";

});
Object.defineProperty(exports, "isArrayBuffer", {
enumerable: true,
get: function get() {
return _binaryUtils.isArrayBuffer;
}
});
Object.defineProperty(exports, "isBlob", {
enumerable: true,
get: function get() {
return _binaryUtils.isBlob;
}
});
Object.defineProperty(exports, "toArrayBuffer", {

@@ -229,32 +217,2 @@ enumerable: true,

});
Object.defineProperty(exports, "blobToArrayBuffer", {
enumerable: true,
get: function get() {
return _binaryUtils.blobToArrayBuffer;
}
});
Object.defineProperty(exports, "toDataView", {
enumerable: true,
get: function get() {
return _binaryUtils.toDataView;
}
});
Object.defineProperty(exports, "padTo4Bytes", {
enumerable: true,
get: function get() {
return _memoryCopyUtils.padTo4Bytes;
}
});
Object.defineProperty(exports, "copyToArray", {
enumerable: true,
get: function get() {
return _memoryCopyUtils.copyToArray;
}
});
Object.defineProperty(exports, "copyArrayBuffer", {
enumerable: true,
get: function get() {
return _memoryCopyUtils.copyArrayBuffer;
}
});
Object.defineProperty(exports, "getStreamIterator", {

@@ -336,4 +294,2 @@ enumerable: true,

var _memoryCopyUtils = require("./javascript-utils/memory-copy-utils");
var _streamUtils = require("./javascript-utils/stream-utils");

@@ -340,0 +296,0 @@

@@ -173,3 +173,3 @@ "use strict";

case 35:
return _context6.abrupt("return", arrayBuffer || string);
return _context6.abrupt("return", string || arrayBuffer);

@@ -176,0 +176,0 @@ case 36:

@@ -9,34 +9,14 @@ "use strict";

exports.toArrayBuffer = toArrayBuffer;
exports.blobToArrayBuffer = blobToArrayBuffer;
exports.toDataView = toDataView;
exports.isBuffer = exports.isBlob = exports.isArrayBuffer = void 0;
var _assert = _interopRequireDefault(require("../utils/assert"));
var isArrayBuffer = function isArrayBuffer(x) {
return x && x instanceof ArrayBuffer;
};
var _toArrayBuffer = require("../node/utils/to-array-buffer.node");
exports.isArrayBuffer = isArrayBuffer;
var isBlob = function isBlob(x) {
return x && typeof Blob !== 'undefined' && x instanceof Blob;
};
exports.isBlob = isBlob;
var isBuffer = function isBuffer(x) {
return x && x instanceof Buffer;
};
exports.isBuffer = isBuffer;
function toArrayBuffer(data) {
if (isArrayBuffer(data)) {
return data;
if (_toArrayBuffer.toArrayBuffer) {
data = (0, _toArrayBuffer.toArrayBuffer)(data);
}
if (isBuffer(data)) {
var typedArray = new Uint8Array(data);
return typedArray.buffer;
if (data instanceof ArrayBuffer) {
return data;
}

@@ -56,24 +36,2 @@

}
function blobToArrayBuffer(blob) {
return new Promise(function (resolve, reject) {
var arrayBuffer;
var fileReader = new FileReader();
fileReader.onload = function (event) {
arrayBuffer = event.target.result;
};
fileReader.onloadend = function (event) {
return resolve(arrayBuffer);
};
fileReader.onerror = reject;
fileReader.readAsArrayBuffer(blob);
});
}
function toDataView(buffer) {
return new DataView(toArrayBuffer(buffer));
}
//# sourceMappingURL=binary-utils.js.map

@@ -43,3 +43,3 @@ "use strict";

var isIterator = function isIterator(x) {
return isObject(x) && 'done' in x && 'value' in x;
return x && isFunction(x.next);
};

@@ -46,0 +46,0 @@

@@ -6,34 +6,4 @@ "use strict";

});
exports.padTo4Bytes = padTo4Bytes;
exports.copyArrayBuffer = copyArrayBuffer;
exports.copyToArray = copyToArray;
exports.concatenateArrayBuffers = concatenateArrayBuffers;
function padTo4Bytes(byteLength) {
return byteLength + 3 & ~3;
}
function copyArrayBuffer(targetBuffer, sourceBuffer, byteOffset) {
var byteLength = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : sourceBuffer.byteLength;
var targetArray = new Uint8Array(targetBuffer, byteOffset, byteLength);
var sourceArray = new Uint8Array(sourceBuffer);
targetArray.set(sourceArray);
return targetBuffer;
}
function copyToArray(source, target, targetOffset) {
var sourceArray;
if (source instanceof ArrayBuffer) {
sourceArray = new Uint8Array(source);
} else {
var srcByteOffset = source.byteOffset;
var srcByteLength = source.byteLength;
sourceArray = new Uint8Array(source.buffer, srcByteOffset, srcByteLength);
}
target.set(sourceArray, targetOffset);
return targetOffset + padTo4Bytes(sourceArray.byteLength);
}
function concatenateArrayBuffers(source1, source2) {

@@ -40,0 +10,0 @@ var sourceArray1 = source1 instanceof ArrayBuffer ? new Uint8Array(source1) : source1;

@@ -151,6 +151,3 @@ "use strict";

function getMagicString(arrayBuffer) {
var byteOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var length = arguments.length > 2 ? arguments[2] : undefined;
function getMagicString(arrayBuffer, byteOffset, length) {
if (arrayBuffer.byteLength <= byteOffset + length) {

@@ -157,0 +154,0 @@ return '';

@@ -9,3 +9,2 @@ "use strict";

exports.getUrlFromData = getUrlFromData;
exports.getSizeFromData = getSizeFromData;
exports.getArrayBufferOrStringFromDataSync = getArrayBufferOrStringFromDataSync;

@@ -32,6 +31,2 @@ exports.getArrayBufferOrStringFromData = getArrayBufferOrStringFromData;

function getSizeFromData(data) {
return (0, _isType.isFetchResponse)(data) ? data.headers.get('Content-Length') : null;
}
function getArrayBufferOrStringFromDataSync(data, loader) {

@@ -63,35 +58,35 @@ if (loader.text && typeof data === 'string') {

var isArrayBuffer;
return _regenerator["default"].wrap(function _callee$(_context) {
return _regenerator["default"].wrap(function _callee$(_context2) {
while (1) {
switch (_context.prev = _context.next) {
switch (_context2.prev = _context2.next) {
case 0:
_context.next = 2;
_context2.next = 2;
return data;
case 2:
data = _context.sent;
data = _context2.sent;
isArrayBuffer = data instanceof ArrayBuffer || ArrayBuffer.isView(data);
if (!(typeof data === 'string' || isArrayBuffer)) {
_context.next = 6;
_context2.next = 6;
break;
}
return _context.abrupt("return", getArrayBufferOrStringFromDataSync(data, loader));
return _context2.abrupt("return", getArrayBufferOrStringFromDataSync(data, loader));
case 6:
if (!(0, _isType.isFileReadable)(data)) {
_context.next = 10;
_context2.next = 10;
break;
}
_context.next = 9;
_context2.next = 9;
return (0, _fetchFile["default"])(data);
case 9:
data = _context.sent;
data = _context2.sent;
case 10:
if (!(0, _isType.isFetchResponse)(data)) {
_context.next = 19;
_context2.next = 19;
break;

@@ -101,19 +96,19 @@ }

if (!loader.binary) {
_context.next = 17;
_context2.next = 17;
break;
}
_context.next = 14;
_context2.next = 14;
return data.arrayBuffer();
case 14:
_context.t0 = _context.sent;
_context.next = 18;
_context2.t0 = _context2.sent;
_context2.next = 18;
break;
case 17:
_context.t0 = data.text();
_context2.t0 = data.text();
case 18:
return _context.abrupt("return", _context.t0);
return _context2.abrupt("return", _context2.t0);

@@ -125,3 +120,3 @@ case 19:

case "end":
return _context.stop();
return _context2.stop();
}

@@ -134,115 +129,51 @@ }

function getAsyncIteratorFromData(_x3, _x4) {
return _getAsyncIteratorFromData.apply(this, arguments);
}
function getAsyncIteratorFromData(data) {
if ((0, _isType.isIterator)(data)) {
return data;
}
function _getAsyncIteratorFromData() {
_getAsyncIteratorFromData = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee2(data, loader) {
return _regenerator["default"].wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
if (!(0, _isType.isIterator)(data)) {
_context2.next = 2;
break;
}
if ((0, _isType.isFetchResponse)(data) && data.body) {
return (0, _streamUtils.getStreamIterator)(data.body);
}
return _context2.abrupt("return", data);
if ((0, _isType.isReadableStream)(data)) {
return (0, _streamUtils.getStreamIterator)(data);
}
case 2:
if (!((0, _isType.isFetchResponse)(data) && data.body)) {
_context2.next = 4;
break;
}
if ((0, _isType.isAsyncIterable)(data)) {
return data[Symbol.asyncIterator]();
}
return _context2.abrupt("return", (0, _streamUtils.getStreamIterator)(data.body));
return getIteratorFromData(data);
}
case 4:
if (!(0, _isType.isReadableStream)(data)) {
_context2.next = 6;
break;
}
function getIteratorFromData(data) {
if (data instanceof ArrayBuffer || ArrayBuffer.isView(data)) {
return _regenerator["default"].mark(function oneChunk() {
return _regenerator["default"].wrap(function oneChunk$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return data.buffer || data;
return _context2.abrupt("return", (0, _streamUtils.getStreamIterator)(data));
case 6:
if (!(0, _isType.isAsyncIterable)(data)) {
_context2.next = 8;
break;
}
return _context2.abrupt("return", data[Symbol.asyncIterator]());
case 8:
return _context2.abrupt("return", getIteratorFromData(data, loader));
case 9:
case "end":
return _context2.stop();
case 2:
case "end":
return _context.stop();
}
}
}
}, _callee2);
}));
return _getAsyncIteratorFromData.apply(this, arguments);
}
}, oneChunk);
})();
}
function getIteratorFromData(_x5, _x6) {
return _getIteratorFromData.apply(this, arguments);
}
if ((0, _isType.isIterator)(data)) {
return data;
}
function _getIteratorFromData() {
_getIteratorFromData = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee3(data, loader) {
return _regenerator["default"].wrap(function _callee3$(_context4) {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
if (!(data instanceof ArrayBuffer || ArrayBuffer.isView(data))) {
_context4.next = 2;
break;
}
if ((0, _isType.isIterable)(data)) {
return data[Symbol.iterator]();
}
return _context4.abrupt("return", _regenerator["default"].mark(function oneChunk() {
return _regenerator["default"].wrap(function oneChunk$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
_context3.next = 2;
return data.buffer || data;
case 2:
case "end":
return _context3.stop();
}
}
}, oneChunk);
})());
case 2:
if (!(0, _isType.isIterator)(data)) {
_context4.next = 4;
break;
}
return _context4.abrupt("return", data);
case 4:
if (!(0, _isType.isIterable)(data)) {
_context4.next = 6;
break;
}
return _context4.abrupt("return", data[Symbol.iterator]());
case 6:
throw new Error(ERR_DATA);
case 7:
case "end":
return _context4.stop();
}
}
}, _callee3);
}));
return _getIteratorFromData.apply(this, arguments);
throw new Error(ERR_DATA);
}
//# sourceMappingURL=get-data.js.map

@@ -107,71 +107,21 @@ "use strict";

function parseWithLoaderInBatches(_x5, _x6, _x7, _x8) {
return _parseWithLoaderInBatches.apply(this, arguments);
}
function parseWithLoaderInBatches(data, loader, options, url) {
if (loader.parseInBatches) {
var inputIterator = (0, _getData.getAsyncIteratorFromData)(data);
var outputIterator = loader.parseInBatches(inputIterator, options, url, loader);
return outputIterator;
}
function _parseWithLoaderInBatches() {
_parseWithLoaderInBatches = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee2(data, loader, options, url) {
var inputIterator, outputIterator;
return _regenerator["default"].wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
if (!loader.parseInBatches) {
_context2.next = 6;
break;
}
_context2.next = 3;
return (0, _getData.getAsyncIteratorFromData)(data);
case 3:
inputIterator = _context2.sent;
outputIterator = loader.parseInBatches(inputIterator, options, url, loader);
return _context2.abrupt("return", outputIterator);
case 6:
return _context2.abrupt("return", null);
case 7:
case "end":
return _context2.stop();
}
}
}, _callee2);
}));
return _parseWithLoaderInBatches.apply(this, arguments);
return null;
}
function parseWithLoaderInBatchesSync(_x9, _x10, _x11, _x12) {
return _parseWithLoaderInBatchesSync.apply(this, arguments);
}
function parseWithLoaderInBatchesSync(data, loader, options, url) {
if (loader.parseInBatchesSync) {
var inputIterator = (0, _getData.getIteratorFromData)(data);
var outputIterator = loader.parseInBatchesSync(inputIterator, options, url, loader, url);
return outputIterator;
}
function _parseWithLoaderInBatchesSync() {
_parseWithLoaderInBatchesSync = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee3(data, loader, options, url) {
var inputIterator, outputIterator;
return _regenerator["default"].wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
if (!loader.parseInBatchesSync) {
_context3.next = 4;
break;
}
inputIterator = (0, _getData.getIteratorFromData)(data);
outputIterator = loader.parseInBatchesSync(inputIterator, options, url, loader, url);
return _context3.abrupt("return", outputIterator);
case 4:
return _context3.abrupt("return", (0, _assert["default"])(false));
case 5:
case "end":
return _context3.stop();
}
}
}, _callee3);
}));
return _parseWithLoaderInBatchesSync.apply(this, arguments);
return (0, _assert["default"])(false);
}
//# sourceMappingURL=parse-with-loader.js.map

@@ -18,4 +18,3 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";

export { isPromise, isIterable, isAsyncIterable, isIterator, isFetchResponse, isReadableStream, isWritableStream } from './javascript-utils/is-type';
export { isArrayBuffer, isBlob, toArrayBuffer, blobToArrayBuffer, toDataView } from './javascript-utils/binary-utils';
export { padTo4Bytes, copyToArray, copyArrayBuffer } from './javascript-utils/memory-copy-utils';
export { toArrayBuffer } from './javascript-utils/binary-utils';
export { getStreamIterator } from './javascript-utils/stream-utils';

@@ -22,0 +21,0 @@ export { forEach, concatenateAsyncIterator, lineAsyncIterator, textDecoderAsyncIterator, numberedLineAsyncIterator } from './javascript-utils/async-iterator-utils';

@@ -71,3 +71,3 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";

return arrayBuffer || string;
return string || arrayBuffer;
});

@@ -74,0 +74,0 @@ return _concatenateAsyncIterator.apply(this, arguments);

import assert from '../utils/assert';
export var isArrayBuffer = x => x && x instanceof ArrayBuffer;
export var isBlob = x => x && typeof Blob !== 'undefined' && x instanceof Blob;
export var isBuffer = x => x && x instanceof Buffer;
import { toArrayBuffer as bufferToArrayBuffer } from '../node/utils/to-array-buffer.node';
export function toArrayBuffer(data) {
if (isArrayBuffer(data)) {
return data;
if (bufferToArrayBuffer) {
data = bufferToArrayBuffer(data);
}
if (isBuffer(data)) {
var typedArray = new Uint8Array(data);
return typedArray.buffer;
if (data instanceof ArrayBuffer) {
return data;
}

@@ -27,20 +24,2 @@

}
export function blobToArrayBuffer(blob) {
return new Promise((resolve, reject) => {
var arrayBuffer;
var fileReader = new FileReader();
fileReader.onload = event => {
arrayBuffer = event.target.result;
};
fileReader.onloadend = event => resolve(arrayBuffer);
fileReader.onerror = reject;
fileReader.readAsArrayBuffer(blob);
});
}
export function toDataView(buffer) {
return new DataView(toArrayBuffer(buffer));
}
//# sourceMappingURL=binary-utils.js.map

@@ -10,3 +10,3 @@ var isBoolean = x => typeof x === 'boolean';

export var isAsyncIterable = x => x && typeof x[Symbol.asyncIterator] === 'function';
export var isIterator = x => isObject(x) && 'done' in x && 'value' in x;
export var isIterator = x => x && isFunction(x.next);
export var isFetchResponse = x => typeof Response !== 'undefined' && x instanceof Response || x.arrayBuffer && x.text && x.json;

@@ -13,0 +13,0 @@ export var isFile = x => typeof File !== 'undefined' && x instanceof File;

@@ -1,25 +0,1 @@

export function padTo4Bytes(byteLength) {
return byteLength + 3 & ~3;
}
export function copyArrayBuffer(targetBuffer, sourceBuffer, byteOffset) {
var byteLength = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : sourceBuffer.byteLength;
var targetArray = new Uint8Array(targetBuffer, byteOffset, byteLength);
var sourceArray = new Uint8Array(sourceBuffer);
targetArray.set(sourceArray);
return targetBuffer;
}
export function copyToArray(source, target, targetOffset) {
var sourceArray;
if (source instanceof ArrayBuffer) {
sourceArray = new Uint8Array(source);
} else {
var srcByteOffset = source.byteOffset;
var srcByteLength = source.byteLength;
sourceArray = new Uint8Array(source.buffer, srcByteOffset, srcByteLength);
}
target.set(sourceArray, targetOffset);
return targetOffset + padTo4Bytes(sourceArray.byteLength);
}
export function concatenateArrayBuffers(source1, source2) {

@@ -26,0 +2,0 @@ var sourceArray1 = source1 instanceof ArrayBuffer ? new Uint8Array(source1) : source1;

@@ -77,6 +77,3 @@ import { normalizeLoader } from './normalize-loader';

function getMagicString(arrayBuffer) {
var byteOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var length = arguments.length > 2 ? arguments[2] : undefined;
function getMagicString(arrayBuffer, byteOffset, length) {
if (arrayBuffer.byteLength <= byteOffset + length) {

@@ -83,0 +80,0 @@ return '';

@@ -9,5 +9,2 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";

}
export function getSizeFromData(data) {
return isFetchResponse(data) ? data.headers.get('Content-Length') : null;
}
export function getArrayBufferOrStringFromDataSync(data, loader) {

@@ -57,53 +54,38 @@ if (loader.text && typeof data === 'string') {

export function getAsyncIteratorFromData(_x3, _x4) {
return _getAsyncIteratorFromData.apply(this, arguments);
}
export function getAsyncIteratorFromData(data) {
if (isIterator(data)) {
return data;
}
function _getAsyncIteratorFromData() {
_getAsyncIteratorFromData = _asyncToGenerator(function* (data, loader) {
if (isIterator(data)) {
return data;
}
if (isFetchResponse(data) && data.body) {
return getStreamIterator(data.body);
}
if (isFetchResponse(data) && data.body) {
return getStreamIterator(data.body);
}
if (isReadableStream(data)) {
return getStreamIterator(data);
}
if (isReadableStream(data)) {
return getStreamIterator(data);
}
if (isAsyncIterable(data)) {
return data[Symbol.asyncIterator]();
}
if (isAsyncIterable(data)) {
return data[Symbol.asyncIterator]();
}
return getIteratorFromData(data, loader);
});
return _getAsyncIteratorFromData.apply(this, arguments);
return getIteratorFromData(data);
}
export function getIteratorFromData(data) {
if (data instanceof ArrayBuffer || ArrayBuffer.isView(data)) {
return function* oneChunk() {
yield data.buffer || data;
}();
}
export function getIteratorFromData(_x5, _x6) {
return _getIteratorFromData.apply(this, arguments);
}
if (isIterator(data)) {
return data;
}
function _getIteratorFromData() {
_getIteratorFromData = _asyncToGenerator(function* (data, loader) {
if (data instanceof ArrayBuffer || ArrayBuffer.isView(data)) {
return function* oneChunk() {
yield data.buffer || data;
}();
}
if (isIterable(data)) {
return data[Symbol.iterator]();
}
if (isIterator(data)) {
return data;
}
if (isIterable(data)) {
return data[Symbol.iterator]();
}
throw new Error(ERR_DATA);
});
return _getIteratorFromData.apply(this, arguments);
throw new Error(ERR_DATA);
}
//# sourceMappingURL=get-data.js.map

@@ -49,35 +49,20 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";

}
export function parseWithLoaderInBatches(_x5, _x6, _x7, _x8) {
return _parseWithLoaderInBatches.apply(this, arguments);
}
export function parseWithLoaderInBatches(data, loader, options, url) {
if (loader.parseInBatches) {
var inputIterator = getAsyncIteratorFromData(data);
var outputIterator = loader.parseInBatches(inputIterator, options, url, loader);
return outputIterator;
}
function _parseWithLoaderInBatches() {
_parseWithLoaderInBatches = _asyncToGenerator(function* (data, loader, options, url) {
if (loader.parseInBatches) {
var inputIterator = yield getAsyncIteratorFromData(data);
var outputIterator = loader.parseInBatches(inputIterator, options, url, loader);
return outputIterator;
}
return null;
});
return _parseWithLoaderInBatches.apply(this, arguments);
return null;
}
export function parseWithLoaderInBatchesSync(data, loader, options, url) {
if (loader.parseInBatchesSync) {
var inputIterator = getIteratorFromData(data);
var outputIterator = loader.parseInBatchesSync(inputIterator, options, url, loader, url);
return outputIterator;
}
export function parseWithLoaderInBatchesSync(_x9, _x10, _x11, _x12) {
return _parseWithLoaderInBatchesSync.apply(this, arguments);
return assert(false);
}
function _parseWithLoaderInBatchesSync() {
_parseWithLoaderInBatchesSync = _asyncToGenerator(function* (data, loader, options, url) {
if (loader.parseInBatchesSync) {
var inputIterator = getIteratorFromData(data);
var outputIterator = loader.parseInBatchesSync(inputIterator, options, url, loader, url);
return outputIterator;
}
return assert(false);
});
return _parseWithLoaderInBatchesSync.apply(this, arguments);
}
//# sourceMappingURL=parse-with-loader.js.map

@@ -19,4 +19,3 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";

export { isPromise, isIterable, isAsyncIterable, isIterator, isFetchResponse, isReadableStream, isWritableStream } from './javascript-utils/is-type';
export { isArrayBuffer, isBlob, toArrayBuffer, blobToArrayBuffer, toDataView } from './javascript-utils/binary-utils';
export { padTo4Bytes, copyToArray, copyArrayBuffer } from './javascript-utils/memory-copy-utils';
export { toArrayBuffer } from './javascript-utils/binary-utils';
export { getStreamIterator } from './javascript-utils/stream-utils';

@@ -23,0 +22,0 @@ export { forEach, concatenateAsyncIterator, lineAsyncIterator, textDecoderAsyncIterator, numberedLineAsyncIterator } from './javascript-utils/async-iterator-utils';

@@ -153,3 +153,3 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";

case 35:
return _context6.abrupt("return", arrayBuffer || string);
return _context6.abrupt("return", string || arrayBuffer);

@@ -156,0 +156,0 @@ case 36:

import assert from '../utils/assert';
export var isArrayBuffer = function isArrayBuffer(x) {
return x && x instanceof ArrayBuffer;
};
export var isBlob = function isBlob(x) {
return x && typeof Blob !== 'undefined' && x instanceof Blob;
};
export var isBuffer = function isBuffer(x) {
return x && x instanceof Buffer;
};
import { toArrayBuffer as bufferToArrayBuffer } from '../node/utils/to-array-buffer.node';
export function toArrayBuffer(data) {
if (isArrayBuffer(data)) {
return data;
if (bufferToArrayBuffer) {
data = bufferToArrayBuffer(data);
}
if (isBuffer(data)) {
var typedArray = new Uint8Array(data);
return typedArray.buffer;
if (data instanceof ArrayBuffer) {
return data;
}

@@ -33,22 +24,2 @@

}
export function blobToArrayBuffer(blob) {
return new Promise(function (resolve, reject) {
var arrayBuffer;
var fileReader = new FileReader();
fileReader.onload = function (event) {
arrayBuffer = event.target.result;
};
fileReader.onloadend = function (event) {
return resolve(arrayBuffer);
};
fileReader.onerror = reject;
fileReader.readAsArrayBuffer(blob);
});
}
export function toDataView(buffer) {
return new DataView(toArrayBuffer(buffer));
}
//# sourceMappingURL=binary-utils.js.map

@@ -25,3 +25,3 @@ import _typeof from "@babel/runtime/helpers/esm/typeof";

export var isIterator = function isIterator(x) {
return isObject(x) && 'done' in x && 'value' in x;
return x && isFunction(x.next);
};

@@ -28,0 +28,0 @@ export var isFetchResponse = function isFetchResponse(x) {

@@ -1,25 +0,1 @@

export function padTo4Bytes(byteLength) {
return byteLength + 3 & ~3;
}
export function copyArrayBuffer(targetBuffer, sourceBuffer, byteOffset) {
var byteLength = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : sourceBuffer.byteLength;
var targetArray = new Uint8Array(targetBuffer, byteOffset, byteLength);
var sourceArray = new Uint8Array(sourceBuffer);
targetArray.set(sourceArray);
return targetBuffer;
}
export function copyToArray(source, target, targetOffset) {
var sourceArray;
if (source instanceof ArrayBuffer) {
sourceArray = new Uint8Array(source);
} else {
var srcByteOffset = source.byteOffset;
var srcByteLength = source.byteLength;
sourceArray = new Uint8Array(source.buffer, srcByteOffset, srcByteLength);
}
target.set(sourceArray, targetOffset);
return targetOffset + padTo4Bytes(sourceArray.byteLength);
}
export function concatenateArrayBuffers(source1, source2) {

@@ -26,0 +2,0 @@ var sourceArray1 = source1 instanceof ArrayBuffer ? new Uint8Array(source1) : source1;

@@ -139,6 +139,3 @@ import _typeof from "@babel/runtime/helpers/esm/typeof";

function getMagicString(arrayBuffer) {
var byteOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var length = arguments.length > 2 ? arguments[2] : undefined;
function getMagicString(arrayBuffer, byteOffset, length) {
if (arrayBuffer.byteLength <= byteOffset + length) {

@@ -145,0 +142,0 @@ return '';

@@ -10,5 +10,2 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";

}
export function getSizeFromData(data) {
return isFetchResponse(data) ? data.headers.get('Content-Length') : null;
}
export function getArrayBufferOrStringFromDataSync(data, loader) {

@@ -39,35 +36,35 @@ if (loader.text && typeof data === 'string') {

var isArrayBuffer;
return _regeneratorRuntime.wrap(function _callee$(_context) {
return _regeneratorRuntime.wrap(function _callee$(_context2) {
while (1) {
switch (_context.prev = _context.next) {
switch (_context2.prev = _context2.next) {
case 0:
_context.next = 2;
_context2.next = 2;
return data;
case 2:
data = _context.sent;
data = _context2.sent;
isArrayBuffer = data instanceof ArrayBuffer || ArrayBuffer.isView(data);
if (!(typeof data === 'string' || isArrayBuffer)) {
_context.next = 6;
_context2.next = 6;
break;
}
return _context.abrupt("return", getArrayBufferOrStringFromDataSync(data, loader));
return _context2.abrupt("return", getArrayBufferOrStringFromDataSync(data, loader));
case 6:
if (!isFileReadable(data)) {
_context.next = 10;
_context2.next = 10;
break;
}
_context.next = 9;
_context2.next = 9;
return fetchFileReadable(data);
case 9:
data = _context.sent;
data = _context2.sent;
case 10:
if (!isFetchResponse(data)) {
_context.next = 19;
_context2.next = 19;
break;

@@ -77,19 +74,19 @@ }

if (!loader.binary) {
_context.next = 17;
_context2.next = 17;
break;
}
_context.next = 14;
_context2.next = 14;
return data.arrayBuffer();
case 14:
_context.t0 = _context.sent;
_context.next = 18;
_context2.t0 = _context2.sent;
_context2.next = 18;
break;
case 17:
_context.t0 = data.text();
_context2.t0 = data.text();
case 18:
return _context.abrupt("return", _context.t0);
return _context2.abrupt("return", _context2.t0);

@@ -101,3 +98,3 @@ case 19:

case "end":
return _context.stop();
return _context2.stop();
}

@@ -110,115 +107,50 @@ }

export function getAsyncIteratorFromData(_x3, _x4) {
return _getAsyncIteratorFromData.apply(this, arguments);
}
export function getAsyncIteratorFromData(data) {
if (isIterator(data)) {
return data;
}
function _getAsyncIteratorFromData() {
_getAsyncIteratorFromData = _asyncToGenerator(_regeneratorRuntime.mark(function _callee2(data, loader) {
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
if (!isIterator(data)) {
_context2.next = 2;
break;
}
if (isFetchResponse(data) && data.body) {
return getStreamIterator(data.body);
}
return _context2.abrupt("return", data);
if (isReadableStream(data)) {
return getStreamIterator(data);
}
case 2:
if (!(isFetchResponse(data) && data.body)) {
_context2.next = 4;
break;
}
if (isAsyncIterable(data)) {
return data[Symbol.asyncIterator]();
}
return _context2.abrupt("return", getStreamIterator(data.body));
return getIteratorFromData(data);
}
export function getIteratorFromData(data) {
if (data instanceof ArrayBuffer || ArrayBuffer.isView(data)) {
return _regeneratorRuntime.mark(function oneChunk() {
return _regeneratorRuntime.wrap(function oneChunk$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return data.buffer || data;
case 4:
if (!isReadableStream(data)) {
_context2.next = 6;
break;
}
return _context2.abrupt("return", getStreamIterator(data));
case 6:
if (!isAsyncIterable(data)) {
_context2.next = 8;
break;
}
return _context2.abrupt("return", data[Symbol.asyncIterator]());
case 8:
return _context2.abrupt("return", getIteratorFromData(data, loader));
case 9:
case "end":
return _context2.stop();
case 2:
case "end":
return _context.stop();
}
}
}
}, _callee2);
}));
return _getAsyncIteratorFromData.apply(this, arguments);
}
}, oneChunk);
})();
}
export function getIteratorFromData(_x5, _x6) {
return _getIteratorFromData.apply(this, arguments);
}
if (isIterator(data)) {
return data;
}
function _getIteratorFromData() {
_getIteratorFromData = _asyncToGenerator(_regeneratorRuntime.mark(function _callee3(data, loader) {
return _regeneratorRuntime.wrap(function _callee3$(_context4) {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
if (!(data instanceof ArrayBuffer || ArrayBuffer.isView(data))) {
_context4.next = 2;
break;
}
if (isIterable(data)) {
return data[Symbol.iterator]();
}
return _context4.abrupt("return", _regeneratorRuntime.mark(function oneChunk() {
return _regeneratorRuntime.wrap(function oneChunk$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
_context3.next = 2;
return data.buffer || data;
case 2:
case "end":
return _context3.stop();
}
}
}, oneChunk);
})());
case 2:
if (!isIterator(data)) {
_context4.next = 4;
break;
}
return _context4.abrupt("return", data);
case 4:
if (!isIterable(data)) {
_context4.next = 6;
break;
}
return _context4.abrupt("return", data[Symbol.iterator]());
case 6:
throw new Error(ERR_DATA);
case 7:
case "end":
return _context4.stop();
}
}
}, _callee3);
}));
return _getIteratorFromData.apply(this, arguments);
throw new Error(ERR_DATA);
}
//# sourceMappingURL=get-data.js.map

@@ -89,71 +89,20 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";

}
export function parseWithLoaderInBatches(_x5, _x6, _x7, _x8) {
return _parseWithLoaderInBatches.apply(this, arguments);
}
export function parseWithLoaderInBatches(data, loader, options, url) {
if (loader.parseInBatches) {
var inputIterator = getAsyncIteratorFromData(data);
var outputIterator = loader.parseInBatches(inputIterator, options, url, loader);
return outputIterator;
}
function _parseWithLoaderInBatches() {
_parseWithLoaderInBatches = _asyncToGenerator(_regeneratorRuntime.mark(function _callee2(data, loader, options, url) {
var inputIterator, outputIterator;
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
if (!loader.parseInBatches) {
_context2.next = 6;
break;
}
_context2.next = 3;
return getAsyncIteratorFromData(data);
case 3:
inputIterator = _context2.sent;
outputIterator = loader.parseInBatches(inputIterator, options, url, loader);
return _context2.abrupt("return", outputIterator);
case 6:
return _context2.abrupt("return", null);
case 7:
case "end":
return _context2.stop();
}
}
}, _callee2);
}));
return _parseWithLoaderInBatches.apply(this, arguments);
return null;
}
export function parseWithLoaderInBatchesSync(data, loader, options, url) {
if (loader.parseInBatchesSync) {
var inputIterator = getIteratorFromData(data);
var outputIterator = loader.parseInBatchesSync(inputIterator, options, url, loader, url);
return outputIterator;
}
export function parseWithLoaderInBatchesSync(_x9, _x10, _x11, _x12) {
return _parseWithLoaderInBatchesSync.apply(this, arguments);
return assert(false);
}
function _parseWithLoaderInBatchesSync() {
_parseWithLoaderInBatchesSync = _asyncToGenerator(_regeneratorRuntime.mark(function _callee3(data, loader, options, url) {
var inputIterator, outputIterator;
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
if (!loader.parseInBatchesSync) {
_context3.next = 4;
break;
}
inputIterator = getIteratorFromData(data);
outputIterator = loader.parseInBatchesSync(inputIterator, options, url, loader, url);
return _context3.abrupt("return", outputIterator);
case 4:
return _context3.abrupt("return", assert(false));
case 5:
case "end":
return _context3.stop();
}
}
}, _callee3);
}));
return _parseWithLoaderInBatchesSync.apply(this, arguments);
}
//# sourceMappingURL=parse-with-loader.js.map
{
"name": "@loaders.gl/core",
"version": "1.2.0",
"version": "1.2.1",
"description": "Framework-independent loaders for 3D graphics formats",

@@ -43,3 +43,3 @@ "license": "MIT",

},
"gitHead": "2799d6b66b91d4bd58765e8ce8932f91f29a3bd3"
"gitHead": "fc4f9cef05d6f379a1f22657ed84d1e6acb0bd21"
}

@@ -39,12 +39,4 @@ import {parse, parseSync} from './lib/parse';

export {
isArrayBuffer,
isBlob,
toArrayBuffer,
blobToArrayBuffer,
toDataView
} from './javascript-utils/binary-utils';
export {toArrayBuffer} from './javascript-utils/binary-utils';
export {padTo4Bytes, copyToArray, copyArrayBuffer} from './javascript-utils/memory-copy-utils';
// ITERATOR UTILS

@@ -51,0 +43,0 @@ export {getStreamIterator} from './javascript-utils/stream-utils';

@@ -38,3 +38,3 @@ /* global TextDecoder, TextEncoder */

}
return arrayBuffer || string;
return string || arrayBuffer;
}

@@ -41,0 +41,0 @@

@@ -1,17 +0,13 @@

/* global FileReader, Blob, ArrayBuffer, Buffer, TextEncoder */
/* global ArrayBuffer, TextEncoder */
import assert from '../utils/assert';
import {toArrayBuffer as bufferToArrayBuffer} from '../node/utils/to-array-buffer.node';
export const isArrayBuffer = x => x && x instanceof ArrayBuffer;
export const isBlob = x => x && typeof Blob !== 'undefined' && x instanceof Blob;
export const isBuffer = x => x && x instanceof Buffer;
export function toArrayBuffer(data) {
if (isArrayBuffer(data)) {
return data;
if (bufferToArrayBuffer) {
// TODO - per docs we should just be able to call buffer.buffer, but there are issues
data = bufferToArrayBuffer(data);
}
// TODO - per docs we should just be able to call buffer.buffer, but there are issues
if (isBuffer(data)) {
const typedArray = new Uint8Array(data);
return typedArray.buffer;
if (data instanceof ArrayBuffer) {
return data;
}

@@ -33,17 +29,13 @@

export function blobToArrayBuffer(blob) {
return new Promise((resolve, reject) => {
let arrayBuffer;
const fileReader = new FileReader();
fileReader.onload = event => {
arrayBuffer = event.target.result;
};
fileReader.onloadend = event => resolve(arrayBuffer);
fileReader.onerror = reject;
fileReader.readAsArrayBuffer(blob);
});
}
export function toDataView(buffer) {
return new DataView(toArrayBuffer(buffer));
}
// export function blobToArrayBuffer(blob) {
// return new Promise((resolve, reject) => {
// let arrayBuffer;
// const fileReader = new FileReader();
// fileReader.onload = event => {
// arrayBuffer = event.target.result;
// };
// fileReader.onloadend = event => resolve(arrayBuffer);
// fileReader.onerror = reject;
// fileReader.readAsArrayBuffer(blob);
// });
// }

@@ -13,3 +13,3 @@ /* global File, Blob, Response */

export const isIterator = x => isObject(x) && 'done' in x && 'value' in x;
export const isIterator = x => x && isFunction(x.next);

@@ -16,0 +16,0 @@ export const isFetchResponse = x =>

@@ -1,55 +0,1 @@

export function padTo4Bytes(byteLength) {
return (byteLength + 3) & ~3;
}
/* Creates a new Uint8Array based on two different ArrayBuffers
* @private
* @param {ArrayBuffers} buffer1 The first buffer.
* @param {ArrayBuffers} buffer2 The second buffer.
* @return {ArrayBuffers} The new ArrayBuffer created out of the two.
*/
export function copyArrayBuffer(
targetBuffer,
sourceBuffer,
byteOffset,
byteLength = sourceBuffer.byteLength
) {
const targetArray = new Uint8Array(targetBuffer, byteOffset, byteLength);
const sourceArray = new Uint8Array(sourceBuffer);
targetArray.set(sourceArray);
return targetBuffer;
}
/**
* Copy from source to target at the targetOffset
*
* @param {ArrayBuffer|TypedArray} source - The data to copy
* @param {TypedArray} target - The destination to copy data into
* @param {Number} targetOffset - The start offset into target to place the copied data
*
* @return {Number} Returns the new offset taking into account proper padding
*/
export function copyToArray(source, target, targetOffset) {
let sourceArray;
if (source instanceof ArrayBuffer) {
sourceArray = new Uint8Array(source);
} else {
// Pack buffer onto the big target array
//
// 'source.data.buffer' could be a view onto a larger buffer.
// We MUST use this constructor to ensure the byteOffset and byteLength is
// set to correct values from 'source.data' and not the underlying
// buffer for target.set() to work properly.
const srcByteOffset = source.byteOffset;
const srcByteLength = source.byteLength;
sourceArray = new Uint8Array(source.buffer, srcByteOffset, srcByteLength);
}
// Pack buffer onto the big target array
target.set(sourceArray, targetOffset);
return targetOffset + padTo4Bytes(sourceArray.byteLength);
}
export function concatenateArrayBuffers(source1, source2) {

@@ -56,0 +2,0 @@ const sourceArray1 = source1 instanceof ArrayBuffer ? new Uint8Array(source1) : source1;

@@ -81,3 +81,3 @@ import {normalizeLoader} from './normalize-loader';

function getMagicString(arrayBuffer, byteOffset = 0, length) {
function getMagicString(arrayBuffer, byteOffset, length) {
if (arrayBuffer.byteLength <= byteOffset + length) {

@@ -84,0 +84,0 @@ return '';

@@ -19,5 +19,6 @@ /* global TextDecoder */

export function getSizeFromData(data) {
return isFetchResponse(data) ? data.headers.get('Content-Length') : null;
}
// export function getSizeFromData(data) {
// return isFetchResponse(data) ? data.headers.get('Content-Length') : null;
// }
export function getArrayBufferOrStringFromDataSync(data, loader) {

@@ -68,3 +69,3 @@ if (loader.text && typeof data === 'string') {

export async function getAsyncIteratorFromData(data, loader) {
export function getAsyncIteratorFromData(data) {
if (isIterator(data)) {

@@ -87,6 +88,6 @@ return data;

return getIteratorFromData(data, loader);
return getIteratorFromData(data);
}
export async function getIteratorFromData(data, loader) {
export function getIteratorFromData(data) {
// generate an iterator that emits a single chunk

@@ -93,0 +94,0 @@ if (data instanceof ArrayBuffer || ArrayBuffer.isView(data)) {

@@ -61,6 +61,6 @@ import assert from '../utils/assert';

export async function parseWithLoaderInBatches(data, loader, options, url) {
export function parseWithLoaderInBatches(data, loader, options, url) {
// Create async iterator adapter for data, and concatenate result
if (loader.parseInBatches) {
const inputIterator = await getAsyncIteratorFromData(data);
const inputIterator = getAsyncIteratorFromData(data);
const outputIterator = loader.parseInBatches(inputIterator, options, url, loader);

@@ -74,3 +74,3 @@ return outputIterator;

export async function parseWithLoaderInBatchesSync(data, loader, options, url) {
export function parseWithLoaderInBatchesSync(data, loader, options, url) {
// Create async iterator adapter for data, and concatenate result

@@ -77,0 +77,0 @@ if (loader.parseInBatchesSync) {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc