/**
 * Minified by jsDelivr using Terser v5.37.0.
 * Original file: /npm/yaz0@4.0.2/lib/browser/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
import Yaz0Loader from"./libyaz0.js";import mergeChunks from"../util/merge-chunks.js";let Yaz0=null;function getYaz0(){return Yaz0||(Yaz0=Yaz0Loader()),Yaz0}const YAZ0_OK=0,YAZ0_NEED_AVAIL_IN=1,YAZ0_NEED_AVAIL_OUT=2,YAZ0_BAD_MAGIC=-1,YAZ0_OUT_OF_MEMORY=-2,OUTPUT_BUFFER_SIZE=4096;async function run(e,t,s){const r=await getYaz0(),a=r._emYaz0Init();e?(void 0===s&&(s=0),r._yaz0ModeCompress(a,t.length,s)):r._yaz0ModeDecompress(a);const n=r._malloc(t.length);r.HEAPU8.set(t,n),r._yaz0Input(a,n,t.length);const o=r._malloc(4096);r._yaz0Output(a,o,4096);const _=[];let u=!1;for(;!u;){switch(r._yaz0Run(a)){case 0:u=!0;break;case 1:throw new Error("Yaz0: Unexpected EOF");case 2:const e=r._yaz0OutputChunkSize(a),t=r.HEAPU8.slice(o,o+e);_.push(t),r._yaz0Output(a,o,4096)}}const c=r._yaz0OutputChunkSize(a);c>0&&_.push(r.HEAPU8.subarray(o,o+c));const z=mergeChunks(_);return r._free(n),r._free(o),r._yaz0Destroy(a),z}const compress=(e,t)=>run(!0,e,t),decompress=e=>run(!1,e);export{compress,decompress};
//# sourceMappingURL=/sm/d50c074c708e0c25b47cbeb55d48e0ea7f871f093f4534dfb7be0a74da37efe6.map