import{A as r}from"./abstractSoundSource-BI3G42KZ.js";import{_ as n,a as u,b as _,c as d}from"./spatialWebAudio-9ecz7TqN.js";import"./webAudioBaseSubGraph-t3b9YWn8.js";import"./audioEngine-CZsqSpdE.js";import"./index-aMLoRFR_.js";import"./svelte/svelte_svelte.js";import"./svelte/svelte_animate.js";import"./svelte/svelte_attachments.js";import"./svelte/svelte_easing.js";import"./svelte/svelte_internal_client.js";import"./svelte/svelte_internal_flags_async.js";import"./svelte/svelte_internal_flags_legacy.js";import"./svelte/svelte_internal_flags_tracing.js";import"./svelte/svelte_internal_server.js";import"./svelte/svelte_legacy.js";import"./svelte/svelte_motion.js";import"./svelte/svelte_reactivity.js";import"./svelte/svelte_reactivity_window.js";import"./svelte/svelte_server.js";import"./svelte/svelte_store.js";import"./svelte/svelte_transition.js";import"./svelte/svelte_events.js";import"./index-Cwdlo4ih.js";class i extends r{constructor(t,e,o,s){super(t,o,s),this._stereo=null,this._audioContext=this.engine._audioContext,this._webAudioNode=e,this._subGraph=new i._SubGraph(this)}async _initAsync(t){t.outBus?this.outBus=t.outBus:t.outBusAutoDefault!==!1&&(await this.engine.isReadyPromise,this.outBus=this.engine.defaultMainBus),await this._subGraph.initAsync(t),n(t)&&this._initSpatialProperty(),this.engine._addNode(this)}get _inNode(){return this._webAudioNode}get _outNode(){return this._subGraph._outNode}get stereo(){return this._stereo??(this._stereo=new u(this._subGraph))}dispose(){super.dispose(),this._stereo=null,this._subGraph.dispose(),this.engine._removeNode(this)}getClassName(){return"_WebAudioSoundSource"}_connect(t){return super._connect(t)?(t._inNode&&this._outNode?.connect(t._inNode),!0):!1}_disconnect(t){return super._disconnect(t)?(t._inNode&&this._outNode?.disconnect(t._inNode),!0):!1}_createSpatialProperty(t,e){return new _(this._subGraph,t,e)}}i._SubGraph=class extends d{get _downstreamNodes(){return this._owner._downstreamNodes??null}get _upstreamNodes(){return this._owner._upstreamNodes??null}_onSubNodesChanged(){super._onSubNodesChanged(),this._owner._inNode.disconnect(),this._owner._subGraph._inNode&&this._owner._inNode.connect(this._owner._subGraph._inNode)}};export{i as _WebAudioSoundSource};
