1'use strict';function n(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}}var r=typeof Object.defineProperties=="function"?Object.defineProperty:function(a,b,d){if(a==Array.prototype||a==Object.prototype)return a;a[b]=d.value;return a}; 2function t(a){a=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var b=0;b<a.length;++b){var d=a[b];if(d&&d.Math==Math)return d}throw Error("Cannot find global object");}var u=t(this);function v(a,b){if(b)a:{var d=u;a=a.split(".");for(var f=0;f<a.length-1;f++){var k=a[f];if(!(k in d))break a;d=d[k]}a=a[a.length-1];f=d[a];b=b(f);b!=f&&b!=null&&r(d,a,{configurable:!0,writable:!0,value:b})}} 3v("Symbol",function(a){function b(l){if(this instanceof b)throw new TypeError("Symbol is not a constructor");return new d(f+(l||"")+"_"+k++,l)}function d(l,c){this.g=l;r(this,"description",{configurable:!0,writable:!0,value:c})}if(a)return a;d.prototype.toString=function(){return this.g};var f="jscomp_symbol_"+(Math.random()*1E9>>>0)+"_",k=0;return b}); 4v("Symbol.iterator",function(a){if(a)return a;a=Symbol("Symbol.iterator");for(var b="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),d=0;d<b.length;d++){var f=u[b[d]];typeof f==="function"&&typeof f.prototype[a]!="function"&&r(f.prototype,a,{configurable:!0,writable:!0,value:function(){return w(n(this))}})}return a});function w(a){a={next:a};a[Symbol.iterator]=function(){return this};return a} 5function x(a){return y(a,a)}function y(a,b){a.raw=b;Object.freeze&&(Object.freeze(a),Object.freeze(b));return a}function z(a){var b=typeof Symbol!="undefined"&&Symbol.iterator&&a[Symbol.iterator];if(b)return b.call(a);if(typeof a.length=="number")return{next:n(a)};throw Error(String(a)+" is not an iterable or ArrayLike");}function A(a){if(!(a instanceof Array)){a=z(a);for(var b,d=[];!(b=a.next()).done;)d.push(b.value);a=d}return a} 6function E(){this.j=!1;this.h=null;this.m=void 0;this.g=1;this.o=0;this.i=null}function F(a){if(a.j)throw new TypeError("Generator is already running");a.j=!0}E.prototype.l=function(a){this.m=a};function G(a,b){a.i={F:b,G:!0};a.g=a.o}E.prototype.return=function(a){this.i={return:a};this.g=this.o};function H(a,b,d){a.g=d;return{value:b}}function I(a){this.g=new E;this.h=a} 7function J(a,b){F(a.g);var d=a.g.h;if(d)return K(a,"return"in d?d["return"]:function(f){return{value:f,done:!0}},b,a.g.return);a.g.return(b);return L(a)}function K(a,b,d,f){try{var k=b.call(a.g.h,d);if(!(k instanceof Object))throw new TypeError("Iterator result "+k+" is not an object");if(!k.done)return a.g.j=!1,k;var l=k.value}catch(c){return a.g.h=null,G(a.g,c),L(a)}a.g.h=null;f.call(a.g,l);return L(a)} 8function L(a){for(;a.g.g;)try{var b=a.h(a.g);if(b)return a.g.j=!1,{value:b.value,done:!1}}catch(d){a.g.m=void 0,G(a.g,d)}a.g.j=!1;if(a.g.i){b=a.g.i;a.g.i=null;if(b.G)throw b.F;return{value:b.return,done:!0}}return{value:void 0,done:!0}} 9function M(a){this.next=function(b){F(a.g);a.g.h?b=K(a,a.g.h.next,b,a.g.l):(a.g.l(b),b=L(a));return b};this.throw=function(b){F(a.g);a.g.h?b=K(a,a.g.h["throw"],b,a.g.l):(G(a.g,b),b=L(a));return b};this.return=function(b){return J(a,b)};this[Symbol.iterator]=function(){return this}}function N(a){function b(f){return a.next(f)}function d(f){return a.throw(f)}return new Promise(function(f,k){function l(c){c.done?f(c.value):Promise.resolve(c.value).then(b,d).then(l,k)}l(a.next())})} 10function O(){for(var a=Number(this),b=[],d=a;d<arguments.length;d++)b[d-a]=arguments[d];return b} 11v("Promise",function(a){function b(c){this.h=0;this.i=void 0;this.g=[];this.o=!1;var e=this.j();try{c(e.resolve,e.reject)}catch(g){e.reject(g)}}function d(){this.g=null}function f(c){return c instanceof b?c:new b(function(e){e(c)})}if(a)return a;d.prototype.h=function(c){if(this.g==null){this.g=[];var e=this;this.i(function(){e.l()})}this.g.push(c)};var k=u.setTimeout;d.prototype.i=function(c){k(c,0)};d.prototype.l=function(){for(;this.g&&this.g.length;){var c=this.g;this.g=[];for(var e=0;e<c.length;++e){var g= 12c[e];c[e]=null;try{g()}catch(h){this.j(h)}}}this.g=null};d.prototype.j=function(c){this.i(function(){throw c;})};b.prototype.j=function(){function c(h){return function(m){g||(g=!0,h.call(e,m))}}var e=this,g=!1;return{resolve:c(this.A),reject:c(this.l)}};b.prototype.A=function(c){if(c===this)this.l(new TypeError("A Promise cannot resolve to itself"));else if(c instanceof b)this.C(c);else{a:switch(typeof c){case "object":var e=c!=null;break a;case "function":e=!0;break a;default:e=!1}e?this.v(c):this.m(c)}}; 13b.prototype.v=function(c){var e=void 0;try{e=c.then}catch(g){this.l(g);return}typeof e=="function"?this.D(e,c):this.m(c)};b.prototype.l=function(c){this.u(2,c)};b.prototype.m=function(c){this.u(1,c)};b.prototype.u=function(c,e){if(this.h!=0)throw Error("Cannot settle("+c+", "+e+"): Promise already settled in state"+this.h);this.h=c;this.i=e;this.h===2&&this.B();this.H()};b.prototype.B=function(){var c=this;k(function(){if(c.I()){var e=u.console;typeof e!=="undefined"&&e.error(c.i)}},1)};b.prototype.I= 14function(){if(this.o)return!1;var c=u.CustomEvent,e=u.Event,g=u.dispatchEvent;if(typeof g==="undefined")return!0;typeof c==="function"?c=new c("unhandledrejection",{cancelable:!0}):typeof e==="function"?c=new e("unhandledrejection",{cancelable:!0}):(c=u.document.createEvent("CustomEvent"),c.initCustomEvent("unhandledrejection",!1,!0,c));c.promise=this;c.reason=this.i;return g(c)};b.prototype.H=function(){if(this.g!=null){for(var c=0;c<this.g.length;++c)l.h(this.g[c]);this.g=null}};var l=new d;b.prototype.C= 15function(c){var e=this.j();c.s(e.resolve,e.reject)};b.prototype.D=function(c,e){var g=this.j();try{c.call(e,g.resolve,g.reject)}catch(h){g.reject(h)}};b.prototype.then=function(c,e){function g(p,q){return typeof p=="function"?function(B){try{h(p(B))}catch(C){m(C)}}:q}var h,m,D=new b(function(p,q){h=p;m=q});this.s(g(c,h),g(e,m));return D};b.prototype.catch=function(c){return this.then(void 0,c)};b.prototype.s=function(c,e){function g(){switch(h.h){case 1:c(h.i);break;case 2:e(h.i);break;default:throw Error("Unexpected state: "+ 16h.h);}}var h=this;this.g==null?l.h(g):this.g.push(g);this.o=!0};b.resolve=f;b.reject=function(c){return new b(function(e,g){g(c)})};b.race=function(c){return new b(function(e,g){for(var h=z(c),m=h.next();!m.done;m=h.next())f(m.value).s(e,g)})};b.all=function(c){var e=z(c),g=e.next();return g.done?f([]):new b(function(h,m){function D(B){return function(C){p[B]=C;q--;q==0&&h(p)}}var p=[],q=0;do p.push(void 0),q++,f(g.value).s(D(p.length-1),m),g=e.next();while(!g.done)})};return b}); 17v("globalThis",function(a){return a||u});/* 18 19 Copyright Google LLC 20 SPDX-License-Identifier: Apache-2.0 21*/ 22var P=globalThis.trustedTypes,Q;function R(){var a=null;if(!P)return a;try{var b=function(d){return d};a=P.createPolicy("goog#html",{createHTML:b,createScript:b,createScriptURL:b})}catch(d){}return a};function S(a){this.g=a}S.prototype.toString=function(){return this.g+""};function T(a){Q===void 0&&(Q=R());var b=Q;return new S(b?b.createScriptURL(a):a)};function U(a){a.importScripts.apply(a,A(O.apply(1,arguments).map(function(b){if(b instanceof S)b=b.g;else throw Error("");return b})))};function V(a){var b=O.apply(1,arguments);if(b.length===0)return T(a[0]);for(var d=a[0],f=0;f<b.length;f++)d+=encodeURIComponent(b[f])+a[f+1];return T(d)};var W=x(["./decoder/wasm/wrapper.js"]),X=!1,Y;self.addEventListener("message",function(a){return N(new M(new I(function(b){if(b.g==1){switch(a.data.eventType){case "CREATE_DECODER":b.g=2;return;case "DECODE_STANDALONE_IAMF":aa(a.data.eventData);break;default:Z("Worker received unhandled message: "+JSON.stringify(a,["type","data","message"]))}b.g=0}else return b.g!=4?b=H(b,ba().then(function(){X=!0}).catch(function(d){X=!1;Z(d.message)}),4):(b.g=0,b=void 0),b})))}); 23function Z(a){postMessage({eventType:"ERROR",message:a})}function ba(){var a;return N(new M(new I(function(b){if(b.g==1)return U(self,V(W)),H(b,loadWasmModule({locateFile:function(d){return"./decoder/wasm/"+d}}),2);Y=b.m;a={eventType:"DECODER_CREATED",outputBuffers:void 0};postMessage(a);b.g=0})))} 24function aa(a){if(X){var b=new Y.DecoderWrapper;if(a=b.SetupStandaloneIamfDecoder(a.iamfBytes,a.sampleRate,a.binaural))Z("Failed to configure decoding with the provided IAMF bytes. This is likely due to invalid IAMF content. Decoder status: "+a),b.delete();else{for(a=[];;){var d=b.Decode();if(!d)break;if(typeof d==="string"){Z(d);return}a.push(d.slice())}b.delete();postMessage({eventType:"DECODE_DONE",outputBuffers:a})}}else Z("Decoding attempted before worker is ready.")}; 25