// This is the minified and stringified code of the array-buffer-cache-worker package. export const worker = `(()=>{var e={455(e,r){!function(e){"use strict";var r=function(e){return function(r){var t=e(r);return r.add(t),t}},t=function(e){return function(r,t){return e.set(r,t),t}},n=void 0===Number.MAX_SAFE_INTEGER?9007199254740991:Number.MAX_SAFE_INTEGER,o=536870912,s=2*o,a=function(e,r){return function(t){var a=r.get(t),i=void 0===a?t.size:an)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;t.has(i);)i=Math.floor(Math.random()*n);return e(t,i)}},i=new WeakMap,u=t(i),c=a(u,i),l=r(c);e.addUniqueNumber=l,e.generateUniqueNumber=c}(r)}};const r={};function t(n){const o=r[n];if(void 0!==o)return o.exports;const s=r[n]={exports:{}};return e[n].call(s.exports,s,s.exports,t),s.exports}(()=>{"use strict";const e=-32603,r=-32602,n=-32601,o=(e,r)=>Object.assign(new Error(e),{status:r}),s=r=>o('The handler of the method called "'.concat(r,'" returned an unexpected result.'),e),a=(r,t)=>async({data:{id:a,method:i,params:u}})=>{const c=t[i];try{if(void 0===c)throw(e=>o('The requested method called "'.concat(e,'" is not supported.'),n))(i);const t=void 0===u?c():c(u);if(void 0===t)throw(r=>o('The handler of the method called "'.concat(r,'" returned no required result.'),e))(i);const l=t instanceof Promise?await t:t;if(null===a){if(void 0!==l.result)throw s(i)}else{if(void 0===l.result)throw s(i);const{result:e,transferables:t=[]}=l;r.postMessage({id:a,result:e},t)}}catch(e){const{message:t,status:n=-32603}=e;r.postMessage({error:{code:n,message:t},id:a})}};var i=t(455);const u=new Map,c=(e,t,n)=>({...t,connect:({port:r})=>{r.start();const n=e(r,t),o=(0,i.generateUniqueNumber)(u);return u.set(o,()=>{n(),r.close(),u.delete(o)}),{result:o}},disconnect:({portId:e})=>{const t=u.get(e);if(void 0===t)throw(e=>o('The specified parameter called "portId" with the given value "'.concat(e,'" does not identify a port connected to this worker.'),r))(e);return t(),{result:null}},isSupported:async()=>{if(await new Promise(e=>{const r=new ArrayBuffer(0),{port1:t,port2:n}=new MessageChannel;t.onmessage=({data:r})=>e(null!==r),n.postMessage(r,[r])})){const e=n();return{result:e instanceof Promise?await e:e}}return{result:!1}}}),l=(e,r,t=()=>!0)=>{const n=c(l,r,t),o=a(e,n);return e.addEventListener("message",o),()=>e.removeEventListener("message",o)};const d=new class{constructor(){this._store=new Map}clone(e){const r=this._store.get(e);if(void 0===r)throw new Error('There is no arrayBuffer stored with an id called "'.concat(e,'".'));return r.slice(0)}purge(e){if(!this._store.delete(e))throw new Error('There is no arrayBuffer stored with an id called "'.concat(e,'".'))}slice(e,r,t){const n=this._store.get(e);if(void 0===n)throw new Error('There is no arrayBuffer stored with an id called "'.concat(e,'".'));if(r<0||r>n.byteLength)throw new Error('The given value for begin "'.concat(r,'" is out of bounds.'));if(null!==t){if(t>n.byteLength)throw new Error('The given value for end "'.concat(t,'" is out of bounds.'));if(t{const r=d.clone(e);return{result:r,transferables:[r]}},purge:({arrayBufferId:e})=>(d.purge(e),{result:null}),slice:({arrayBufferId:e,begin:r,end:t})=>{const n=d.slice(e,r,t);return{result:n,transferables:[n]}},store:({arrayBuffer:e,arrayBufferId:r})=>(d.store(r,e),{result:null})})})()})();`; // tslint:disable-line:max-line-length