@omnimedia/omnitool 1.1.0-87 → 1.1.0-88

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -38,7 +38,7 @@ export async function playbackTest(timeline, omni, root) {
38
38
  playhead.style.left = `${progress}%`;
39
39
  updateTimecode(clamped, durationMs);
40
40
  };
41
- player.update(o.timeline);
41
+ await player.update(o.timeline);
42
42
  }
43
43
  function formatTime(ms) {
44
44
  const clamped = Math.max(0, ms);
@@ -1 +1 @@
1
- {"version":3,"file":"playback-test.js","sourceRoot":"","sources":["../../../s/demo/routines/playback-test.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAqB,MAAM,yBAAyB,CAAA;AAE7D,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,QAAsB,EAAE,IAAU,EAAE,IAAiB;IACvF,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAsB,CAAA;IACnE,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAsB,CAAA;IACnE,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAqB,CAAA;IAC9D,MAAM,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,WAAW,CAAmB,CAAA;IAClE,MAAM,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,WAAW,CAAmB,CAAA;IAClE,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAmB,CAAA;IACzE,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,EAAC,QAAQ,EAAC,CAAC,CAAA;IAC3B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;IAC5C,UAAU,CAAC,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAEzC,UAAU,CAAC,QAAQ,GAAG,KAAK,CAAA;IAC3B,UAAU,CAAC,QAAQ,GAAG,KA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 -295,7 +295,7 @@ canvas {
295
295
  }
296
296
  }
297
297
  </style>
298
- <script type=module src="demo/demo.bundle.min.js?v=ccc28607a67d"></script>
298
+ <script type=module src="demo/demo.bundle.min.js?v=c7ab0eb1da2b"></script>
299
299
 
300
300
 
301
301
  <meta name="theme-color" content="#3cff9c">
@@ -317,7 +317,7 @@ canvas {
317
317
  <section>
318
318
  <header class="hero">
319
319
  <div>
320
- <h1>Omnitool <small>v1.1.0-87</small></h1>
320
+ <h1>Omnitool <small>v1.1.0-88</small></h1>
321
321
  <p>Developer demos for decoding, preview, waveform, playback, and export.</p>
322
322
  </div>
323
323
  </header>
@@ -2862,7 +2862,7 @@ fn mainFragment(
2862
2862
  sample.b *= sample.a;
2863
2863
 
2864
2864
  return sample;
2865
- }`;var jl=class Xl extends _{constructor(e={}){e={...Xl.defaultOptions,...e};let t=A.from({vertex:{source:fa,entryPoint:"mainVertex"},fragment:{source:fa,entryPoint:"mainFragment"}}),n=I.from({vertex:mr,fragment:Wl,name:"noise-filter"}),{noise:o,seed:i,...s}=e;super({...s,gpuProgram:t,glProgram:n,resources:{noiseUniforms:new fr({uNoise:{value:1,type:"f32"},uSeed:{value:1,type:"f32"}})}}),this.noise=o,this.seed=i??Math.random()}get noise(){return this.resources.noiseUniforms.uniforms.uNoise}set noise(e){this.resources.noiseUniforms.uniforms.uNoise=e}get seed(){return this.resources.noiseUniforms.uniforms.uSeed}set seed(e){this.resources.noiseUniforms.uniforms.uSeed=e}};jl.defaultOptions={noise:.5};var ma=jl;var si=class extends Wa{constructor(e,t){let{text:n,resolution:o,style:i,anchor:s,width:a,height:c,roundPixels:l,...f}=e;super({...f}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=t,this.text=n??"",this.style=i,this.resolution=o??null,this.allowChildren=!1,this._anchor=new en({_onUpdate:()=>{this.onViewUpdate()}}),s&&(this.anchor=s),this.roundPixels=l??!1,a!==void 0&&(this.width=a),c!==void 0&&(this.height=c)}get anchor(){return this._anchor}set anchor(e){typeof e=="number"?this._anchor.set(e):this._anchor.copyFrom(e)}set text(e){e=e.toString(),this._text!==e&&(this._text=e,this.onViewUpdate())}get text(){return this._text}set resolution(e){this._autoResolution=e===null,this._resolution=e,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(e){e||(e={}),this._style?.off("update",this.onViewUpdate,this),e instanceof this._styleClass?this._style=e:this._style=new this._styleClass(e),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(e){this._setWidth(e,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(e){this._setHeight(e,this.bounds.height)}getSize(e){return e||(e={}),e.width=Math.abs(this.scale.x)*this.bounds.width,e.height=Math.abs(this.scale.y)*this.bounds.height,e}setSize(e,t){typeof e=="object"?(t=e.height??e.width,e=e.width):t??(t=e),e!==void 0&&this._setWidth(e,this.bounds.width),t!==void 0&&this._setHeight(t,this.bounds.height)}containsPoint(e){let t=this.bounds.width,n=this.bounds.height,o=-t*this.anchor.x,i=0;return e.x>=o&&e.x<=o+t&&(i=-n*this.anchor.y,e.y>=i&&e.y<=i+n)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}destroy(e=!1){super.destroy(e),this.owner=null,this._bounds=null,this._anchor=null,(typeof e=="boolean"?e:e?.style)&&this._style.destroy(e),this._style=null,this._text=null}get styleKey(){return`${this._text}:${this._style.styleKey}:${this._resolution}`}};function $l(r,e){let t=r[0]??{};return(typeof t=="string"||r[1])&&(N(tn,`use new ${e}({ text: "hi!", style }) instead`),t={text:t,style:r[1]}),t}var Rn=class extends si{constructor(...e){let t=$l(e,"Text");super(t,ja),this.renderPipeId="text",t.textureStyle&&(this.textureStyle=t.textureStyle instanceof Ki?t.textureStyle:new Ki(t.textureStyle))}updateBounds(){let e=this._bounds,t=this._anchor,n=0,o=0;if(this._style.trim){let{frame:i,canvasAndContext:s}=Zi.getCanvasAndContext({text:this.text,style:this._style,resolution:1});Zi.returnCanvasAndContext(s),n=i.width,o=i.height}else{let i=Xa.measureText(this._text,this._style);n=i.width,o=i.height}e.minX=-t._x*n,e.maxX=e.minX+n,e.minY=-t._y*o,e.maxY=e.minY+o}};Ha.add(Al,Fl);var pa=r=>{let[e,t,n]=r,[o,i]=e,[s,a]=t,c=n*Math.PI/180,l=Math.cos(c),f=Math.sin(c);return[l*s,f*s,-f*a,l*a,o,i]},Kl=([r,e,t,n,o,i])=>new $i(r,e,t,n,o,i);var da=(r,e)=>{let[t,n,o,i,s,a]=r,[c,l,f,u,m,p]=e;return[t*c+o*l,n*c+i*l,t*f+o*u,n*f+i*u,t*m+o*p+s,n*m+i*p+a]};var Yl=[1,0,0,1,0,0];var ha=class{keys;index;constructor(e,t){this.keys=e,this.index=t}near(e){return this.keys[Math.max(0,Math.min(this.keys.length-1,this.index+e))][1]}},Ql=r=>r,Mn=r=>Ql((e,t)=>r(e,t.near(0),t.near(1))),Bn=(r,e,t)=>e+(t-e)*r,$d={linear:Mn(Bn),ease:Mn((r,e,t)=>{let n=r<.5?4*r*r*r:1-Math.pow(-2*r+2,3)/2;return Bn(n,e,t)}),easeIn:Mn((r,e,t)=>Bn(r*r*r,e,t)),easeOut:Mn((r,e,t)=>Bn(1-Math.pow(1-r,3),e,t)),bounce:Mn((r,e,t)=>{let i=r<.36363636363636365?7.5625*r*r:r<.7272727272727273?7.5625*(r-.5454545454545454)**2+.75:r<.9090909090909091?7.5625*(r-.8181818181818182)**2+.9375:7.5625*(r-.9545454545454546)**2+.984375;return Bn(i,e,t)}),catmullRom:Ql((r,e)=>{let t=e.near(-1),n=e.near(0),o=e.near(1),i=e.near(2),s=r*r,a=s*r;return .5*(2*n+(-t+o)*r+(2*t-5*n+4*o-i)*s+(-t+3*n-3*o+i)*a)})},Zl=(r,e,t,n)=>{let o=$d[r];if(!o)throw new Error(`unknown terp "${r}"`);return o(e,new ha(t,n))};var Mr=(r,e,t,n=0)=>{if(e.length===0)return n;if(e.length===1)return e[0][1];let o=[...e].sort((u,m)=>u[0]-m[0]);if(r<=o[0][0])return o[0][1];let i=o[o.length-1];if(r>=i[0])return i[1];let s=0;for(let u=0;u<o.length-1;u++){let m=o[u],p=o[u+1];if(r>=m[0]&&r<=p[0]){s=u;break}}let[a]=o[s],[c]=o[s+1],l=c-a,f=l===0?0:(r-a)/l;return Zl(t,f,o,s)},ai=(r,e)=>[[Mr(r,e.track.position.x,e.terp),Mr(r,e.track.position.y,e.terp)],[Mr(r,e.track.scale.x,e.terp,1),Mr(r,e.track.scale.y,e.terp,1)],Mr(r,e.track.rotation,e.terp)],Jl=(r,e)=>Mr(r,e.track,e.terp);function tu(r){return"duration"in r}function ru(r){let e=[],t=new Map(r.timeline.items.map(n=>[n.id,n]));return ga(r.timeline.rootId,t,r.from,{sequence:()=>{},stack:()=>{},video:(n,o,i)=>e.push({item:n,localTime:o,ancestors:i}),text:(n,o,i)=>e.push({item:n,localTime:o,ancestors:i}),audio:(n,o,i)=>e.push({item:n,localTime:o,ancestors:i})}),e}function nu(r,e,t,n){let o=Yl;for(let i of e)o=eu(r,i.item,o,i.localTime);return eu(r,t,o,n)}function eu(r,e,t,n){let o=t;if("spatialId"in e&&e.spatialId){let i=r.get(e.spatialId);if(i?.enabled){let s=pa(i.transform);o=da(s,o)}}if("animationIds"in e&&e.animationIds)for(let i of e.animationIds){let s=r.get(i),a=s?.anims.transform;if(s?.enabled&&a&&Kd(a,n)){let c=pa(ai(n,a));o=da(c,o)}}return o}function ga(r,e,t,n,o=[]){let i=e.get(r);if(i)switch(i.kind){case X.Stack:n.stack(i,t,o);for(let s of i.childrenIds)ga(s,e,t,n,[...o,{item:i,localTime:t}]);break;case X.Sequence:{n.sequence(i,t,o);let s=j(0);for(let a of i.childrenIds){let c=e.get(a);if(!c||!tu(c))continue;let l=j(s+c.duration);if(t>=l){s=l;continue}let f=j(Math.max(0,t-s));ga(a,e,f,n,[...o,{item:i,localTime:t}]),s=l}break}case X.Video:n.video(i,t,o);break;case X.Text:n.text(i,t,o);break;case X.Audio:n.audio(i,t,o);break}}function ee(r,e){let t=e.items.find(n=>n.id===r);if(!t)return j(0);switch(t.kind){case X.Sequence:{let n=t.childrenIds.map(i=>e.items.find(s=>s.id===i)).filter(Boolean),o=j(0);for(let i=0;i<n.length;i++){let s=n[i];if(s.kind===X.Transition){let a=n[i-1],c=n[i+1];if(a&&c&&a.kind!==X.Transition&&c.kind!==X.Transition){let l=ee(a.id,e),f=ee(c.id,e),u=Math.max(0,Math.min(s.duration,l,f));o=j(o-u)}continue}o=j(o+ee(s.id,e))}return o}case X.Stack:{let n=j(0);for(let o of t.childrenIds){let i=ee(o,e);i>n&&(n=i)}return n}default:return tu(t)?t.duration:j(0)}}function ou(r,e,t){if(!("animationIds"in e)||e.animationIds===void 0)return 1;let n=1;for(let o of e.animationIds){let i=r.items.get(o),s=i?.anims.opacity;i?.enabled&&s&&Br(s.track,t)&&(n=Jl(t,s))}return n}function Br(r,e){if(r.length===0)return!1;let t=r[0][0],n=r[0][0];for(let[o]of r)t=Math.min(t,o),n=Math.max(n,o);return e>=t&&e<=n}function Kd(r,e){return Br(r.track.position.x,e)||Br(r.track.position.y,e)||Br(r.track.scale.x,e)||Br(r.track.scale.y,e)||Br(r.track.rotation,e)}var Un=r=>r;var ci=class{resolveMedia;#e=new Map;constructor(e){this.resolveMedia=e}async getSink(e){let t=this.#e.get(e);if(t)return t.sink;let n=new Pe({formats:Be,source:await $e(this.resolveMedia(e))}),o=await n.getPrimaryVideoTrack(),s=!!o&&await o.canDecode()&&o?new Tn(o):null;return this.#e.set(e,{input:n,sink:s}),s}};async function iu(r,e,t,n){let[o,i]=await Promise.all([t,n]),s=o.find(l=>l.kind==="image")?.frame,a=i.find(l=>l.kind==="image")?.frame,c=[...o.filter(l=>l.kind!=="image"),...i.filter(l=>l.kind!=="image")];return s&&a?[{id:r.id,kind:"transition",name:"circle",progress:e,from:s,to:a},...c]:c}async function su(r,e,t,n){let o=Yd(r,e,t);if(!o)return[];let i=[...n,{item:e,localTime:t}];return o.isTransitioning?iu(o.transition,o.progress,Jt(r,o.outgoing,o.outgoingTime,i),Jt(r,o.incoming,o.incomingTime,i)):Jt(r,o.item,o.localTime,i)}function Yd(r,e,t){let n=e.childrenIds.map(i=>r.items.get(i)).filter(i=>!!i),o=j(0);for(let i=0;i<n.length;i++){let s=n[i];if(s.kind===X.Transition)continue;let a=o,c=ee(s.id,r.timeline),l=j(a+c),f=n[i+1];if(!(f?.kind===X.Transition)){if(t<l)return{isTransitioning:!1,item:s,localTime:j(t-a)};o=l;continue}let m=f,p=n[i+2];if(!p||p.kind===X.Transition){o=l;continue}let d=ee(p.id,r.timeline),g=Math.max(0,Math.min(m.duration,c,d)),x=j(l-g);if(t<x)return{isTransitioning:!1,item:s,localTime:j(t-a)};if(t<l){let y=j(t-x),v=j(t-a);return{isTransitioning:!0,incoming:p,outgoing:s,outgoingTime:v,incomingTime:y,progress:g>0?y/g:1,transition:m}}o=x,i++}return null}async function Jt(r,e,t,n){let o=nu(r.items,n,e,t),i=ou(r,e,t),s="spatialId"in e&&e.spatialId?r.items.get(e.spatialId)?.crop:void 0,a="filterIds"in e&&e.filterIds?e.filterIds.map(c=>r.items.get(c)).filter(c=>!!c?.enabled).map(c=>({type:c.type,params:c.params})):void 0;switch(e.kind){case X.Stack:{let c=[...n,{item:e,localTime:t}];return(await Promise.all(e.childrenIds.map(f=>r.items.get(f)).filter(f=>!!f).map(f=>Jt(r,f,t,c)))).flat()}case X.Sequence:return su(r,e,t,n);case X.Video:{if(t<0||t>=e.duration)return[];let c=await r.videoSampler(e,t);return c?[{kind:"image",frame:c,matrix:o,alpha:i,crop:s,filters:a,id:e.id}]:[]}case X.Text:{if(t<0||t>=e.duration)return[];let c=e.styleId?r.items.get(e.styleId)?.style:void 0;return[{id:e.id,kind:"text",content:e.content,style:c,matrix:o,alpha:i,crop:s,filters:a}]}case X.Gap:return[{id:e.id,kind:"gap"}];default:return[]}}function au(r){return async(e,t)=>{let o=await(await r.getSink(e.mediaHash))?.getSample(t/1e3),i=o?.toVideoFrame();return o?.close(),i??void 0}}function Ur(r,e){let t=new ci(r),n=e??au(t);return{async sample(o,i){let s=new Map(o.items.map(c=>[c.id,c])),a=s.get(o.rootId);return a?Jt({videoSampler:n,timeline:o,items:s},a,i,[]):[]}}}var It=class{driver;resolveMedia;timeline;#e=-1/0;#t=new Map;#r;constructor(e,t,n){this.driver=e,this.resolveMedia=t,this.timeline=n,this.#r=Ur(this.resolveMedia,(o,i)=>{let s=cu(i),a=this.#t.get(o.id);if(!a){let c=this.resolveMedia(o.mediaHash),l=cu(j(o.start+o.duration));a=this.#n(c,s,l),this.#t.set(o.id,a)}return a.next(s)})}next(e){if(e<this.#e)throw new Error(`Forward-only cursor regression: ${e}ms < ${this.#e}ms`);return this.#e=e,this.#r.sample(this.timeline,e)}async cancel(){await Promise.all([...this.#t.values()].map(e=>e.cancel())),this.#t.clear()}#n(e,t,n){let o=this.driver.decodeVideo({source:e,start:t/1e6,end:n/1e6}),i=o.readable.getReader(),s=null,a=null,c=!1,l=async()=>{if(c)return null;let{done:f,value:u}=await i.read();if(f)return c=!0,null;let m=new VideoFrame(u);return u.close(),m};return{async next(f){if(s??=await l(),!!s)for(;;){a??=l();let u=await a;if(!u)return new VideoFrame(s);let m=s.timestamp??-1/0,p=u.timestamp??m;if(p<f){s.close(),s=u,a=null;continue}if(Math.abs(p-f)<Math.abs(m-f)){s.close(),s=u,a=null;continue}return new VideoFrame(s)}},async cancel(){let f=a;a=null,c=!0,(await f?.catch(()=>null))?.close(),s?.close(),s=null,o.cancel()}}}},cu=r=>Math.round(r*1e3);async function lu(r,e,t){return(await Promise.all(e.map(async({item:o,localTime:i})=>{if(o.kind!==X.Audio)return;let s=await r.getSink(o.mediaHash);if(!s)return;let a=o.start+i,c=Un((t-a)/1e3),l=s.samples(a/1e3),f=await l.next();if(f.done)return;let u=f.value,m=l.next();return{offset:c,gain:o.gain??1,get currentSample(){return u},timelineTime:()=>Un(c+u.timestamp),output:()=>({sample:u,timestamp:c+u.timestamp,gain:o.gain??1}),advance:async()=>{let p=await m;return p.done?!1:(u=p.value,m=l.next(),!0)}}}))).filter(o=>!!o)}var li=class{resolveMedia;#e=new Map;constructor(e){this.resolveMedia=e}async getSink(e){let t=this.#e.get(e);if(t)return t.sink;let n=new Pe({formats:Be,source:await $e(this.resolveMedia(e))}),o=await n.getPrimaryAudioTrack(),s=!!o&&await o.canDecode()&&o?new wn(o):null;return this.#e.set(e,{input:n,sink:s}),s}};function uu(r){let e={index:0,stream:r[0],time:r[0].timelineTime()};for(let[t,n]of r.entries()){let o=n.timelineTime();o<e.time&&(e={time:o,stream:n,index:t})}return e}function ui(r){let e=new li(r);return{async*sampleAudio(t,n){let o=ru({timeline:t,from:n}),i=await lu(e,o,n);for(;i.length>0;){let{stream:s,index:a}=uu(i);yield s.output(),await s.advance()||i.splice(a,1)}}}}var fi=class{driver;timeline;resolveMedia;audioSampler;seekVisualSampler;playVisualSampler=null;#e=j(0);#t=null;#r=_l();onTick=this.#r.onTick;audioContext=new AudioContext({sampleRate:48e3});audioGain=this.audioContext.createGain();audioNodes=new Set;#n=null;constructor(e,t,n){this.driver=e,this.timeline=t,this.resolveMedia=n,this.audioGain.connect(this.audioContext.destination),this.audioGain.gain.value=.7**2,this.seekVisualSampler=Ur(this.resolveMedia),this.audioSampler=ui(this.resolveMedia),this.#o()}update(e){this.timeline=e}get isPlaying(){return this.#r.isPlaying()}async#o(){for await(let e of this.#r.ticks()){let t=await this.playVisualSampler?.next(this.currentTime)??[];(await this.driver.composite(t)).close(),this.currentTime>=this.duration&&this.pause()}}async seek(e){return this.pause(),this.#e=e,await this.seekVisualSampler.sample(this.timeline,e)}async start(){if(!this.#r.isPlaying()){await this.audioContext.resume(),this.#e=this.currentTime,this.#t=this.audioContext.currentTime,this.#n?.abort(),this.#n=new AbortController;for(let e of this.audioNodes)e.stop();this.audioNodes.clear(),this.playVisualSampler=new It(this.driver,this.resolveMedia,this.timeline),this.#r.play(),this.#i(this.#n.signal,Un(this.#e/1e3))}}pause(){this.#e=this.currentTime,this.#r.pause(),this.#n?.abort();for(let e of this.audioNodes)e.stop();this.audioNodes.clear(),this.playVisualSampler&&(this.playVisualSampler.cancel(),this.playVisualSampler=null)}get duration(){return ee(this.timeline.rootId,this.timeline)}get currentTime(){if(!this.#r.isPlaying()||this.#t===null)return this.#e;let e=(this.audioContext.currentTime-this.#t)*1e3;return j(this.#e+e)}setFps(e){this.#r.setFPS(e)}async#i(e,t){let n=this.audioContext;if(this.#t!==null)for await(let{sample:o,timestamp:i}of this.audioSampler.sampleAudio(this.timeline,j(t*1e3))){if(e.aborted||!this.#r.isPlaying())return;for(;i-(n.currentTime-this.#t+t)>.75;)await new Promise(c=>setTimeout(c,25));let s=n.createBufferSource();s.buffer=o.toAudioBuffer(),s.connect(this.audioGain),s.onended=()=>this.audioNodes.delete(s),this.audioNodes.add(s);let a=this.#t+i-t;a>=n.currentTime?s.start(a):s.start(n.currentTime,n.currentTime-a)}}};var mi=class{driver;canvas;playback;#e=null;#t=null;constructor(e,t,n){this.driver=e,this.playback=new fi(e,n,t),this.canvas=e.compositor.pixi.renderer.canvas}async play(){await this.playback.start()}pause(){this.playback.pause()}seek(e){return this.#e=e,this.#t??=this.#r().finally(()=>this.#t=null)}setFPS(e){this.playback.setFps(xt(e))}get isSeeking(){return this.#t!==null}get isPlaying(){return this.playback.isPlaying}get duration(){return this.playback.duration}get currentTime(){return this.playback.currentTime}update(e){this.playback.update(e)}async#r(){for(;this.#e!==null;){let e=this.#e;this.#e=null;let t=await this.playback.seek(j(e));(await this.driver.composite(t)).close()}}};var Ke=class{#e;#t;constructor(e={}){this.#e=e.chunkFrames??1024,this.#t=e.clamp??!0}async*mix(e){let t=this.#e,n=null,o=null,i=[],s=0,a=0;for await(let c of e){if(o===null)o=c.planes.length,n=c.sampleRate;else{if(c.planes.length!==o)throw new Error("Channel count changed");if(c.sampleRate!==n)throw new Error("Sample rate changed")}let l=Math.round(c.timestamp*n),f=c.planes[0]?.length??0;for(;s+t<=l;)yield this.#r(i,s,o,n),s+=t;i.push({startFrame:l,endFrame:l+f,data:c.planes}),a=Math.max(a,l+f)}if(o!==null&&n!==null)for(;s<a;)yield this.#r(i,s,o,n),s+=t}#r(e,t,n,o){let i=this.#e,s=new Float32Array(n*i),a=t+i;for(let c=0;c<n;c++){let l=c*i,f=s.subarray(l,l+i);for(let u of e){let m=u.data[c];if(!m)continue;let p=Math.max(t,u.startFrame),d=Math.min(a,u.endFrame);if(p>=d)continue;let g=p-t,x=p-u.startFrame,y=d-p;for(let v=0;v<y;v++)f[g+v]+=m[x+v]}if(this.#t)for(let u=0;u<i;u++){let m=f[u];f[u]=m<-1?-1:m>1?1:m}}for(let c=e.length-1;c>=0;c--)e[c].endFrame<=a&&e.splice(c,1);return{planar:s,sampleRate:o,channels:n,frames:i,startFrame:t}}};var Qd=(r,e,t)=>{if(e===t)return r;let n=t/e,o=Math.max(1,Math.round(r.length*n)),i=new Float32Array(o);for(let s=0;s<o;s++){let a=s/n,c=Math.floor(a),l=Math.min(c+1,r.length-1),f=a-c;i[s]=r[c]*(1-f)+r[l]*f}return i},Ye=(r,e)=>{let t=r.numberOfChannels,n=new Array(t),o=0;for(let i=0;i<t;i++){let s=new Float32Array(r.numberOfFrames);r.copyTo(s,{planeIndex:i,format:"f32-planar"});let a=Qd(s,r.sampleRate,e);n[i]=a,o=a.length}return{data:n,frames:o}};var Nr=(r,e)=>{if(e!==1)for(let t of r)for(let n=0;n<t.length;n++)t[n]*=e};function pi({timeline:r,resolveMedia:e}){let t=new Ke,n=Zd(r,e),o=new TransformStream,i=o.writable.getWriter();async function s(){for await(let a of t.mix(n)){let c=new AudioData({format:"f32-planar",sampleRate:a.sampleRate,numberOfFrames:a.frames,numberOfChannels:a.channels,timestamp:Math.round(a.startFrame/a.sampleRate*1e6),data:new Float32Array(a.planar)});await i.write(c)}await i.close()}return s(),o.readable}async function*Zd(r,e){let t=ui(e);for await(let{sample:n,timestamp:o,gain:i}of t.sampleAudio(r,j(0))){let{data:s}=Ye(n,48e3);Nr(s,i),yield{planes:s,sampleRate:48e3,timestamp:o},n.close()}}function di({timeline:r,fps:e,driver:t,resolveMedia:n}){let o=new TransformStream,i=o.writable.getWriter(),s=new It(t,n,r),a=1/e,c=ee(r.rootId,r);async function l(){await Il({fps:e,duration:c},async(f,u)=>{let m=await s.next(f),p=await t.composite(m),d=new VideoFrame(p,{timestamp:Math.round(u*a*1e6),duration:Math.round(a*1e6)});await i.write(d),p.close()}),await i.close()}return l(),o.readable}function fu(r){let e=pi({...r}),t=di({...r});return r.driver.encode({video:t,audio:e,config:{audio:{codec:"opus",bitrate:128e3},video:{codec:"vp9",bitrate:1e6}}})}var At=class{driver;resources=new ri;constructor(e){this.driver=e}load=async e=>Object.fromEntries(await Promise.all(Object.entries(e).map(async([t,n])=>[t,await this.resources.store(await n)])));timeline=e=>{let t=new re({timeline:{format:"timeline",info:"https://omniclip.app/",version:0,items:[],rootId:0}}),n=e(t);return t.timeline.rootId=n.id,t.timeline};playback=async e=>new mi(this.driver,t=>this.resources.require(t).url,e);render=async(e,t=30)=>fu({timeline:e,fps:xt(t),driver:this.driver,resolveMedia:n=>this.resources.require(n).url})};function xa(r,e){return{error:t=>r.error({...e,...t}),rpcRequest:t=>r.rpcRequest({...e,...t}),rpcError:t=>r.rpcError({...e,...t})}}var hi=()=>r=>({plain:r.none,errMessage:r.mix(r.brightRed,r.bold),errName:r.red,errStack:r.mix(r.red,r.dim),timestamp:r.blue,timestampErr:r.red});function mu(){return hi()}var Ft=Object.freeze({black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",brightBlack:"\x1B[90m",brightRed:"\x1B[91m",brightGreen:"\x1B[92m",brightYellow:"\x1B[93m",brightBlue:"\x1B[94m",brightMagenta:"\x1B[95m",brightCyan:"\x1B[96m",brightWhite:"\x1B[97m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgBrightBlack:"\x1B[100m",bgBrightRed:"\x1B[101m",bgBrightGreen:"\x1B[102m",bgBrightYellow:"\x1B[103m",bgBrightBlue:"\x1B[104m",bgBrightMagenta:"\x1B[105m",bgBrightCyan:"\x1B[106m",bgBrightWhite:"\x1B[107m",bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",inverse:"\x1B[7m",hidden:"\x1B[8m",strikethrough:"\x1B[9m",reset:"\x1B[0m"});var gi=()=>({none:r=>r,uncolor:eh,mix:th,hex:rh,rgb:pu,bgRgb:nh});function eh(r){return r.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,"")}function th(...r){return e=>{for(let t of r)e=t(e);return e}}function rh(r){r=r.replace(/^#/,"");let e,t,n,o;if(r.length===3)e=parseInt(r.split("").map(i=>i+i).join(""),16);else if(r.length===6)e=parseInt(r,16);else throw new Error("Invalid hex color");return t=e>>16&255,n=e>>8&255,o=e&255,pu(t,n,o)}function pu(r,e,t){let n=`\x1B[38;2;${r};${e};${t}m`;return o=>`${n}${o}${Ft.reset}`}function nh(r,e,t){let n=`\x1B[48;2;${r};${e};${t}m`;return o=>`${n}${o}${Ft.reset}`}var Nn={...Object.fromEntries(Object.entries(Ft).map(([r])=>[r,e=>e])),...gi()};var Ln={...Object.fromEntries(Object.entries(Ft).map(([r,e])=>[r,t=>`${e}${t}${Ft.reset}`])),...gi()};function va(){return typeof Deno<"u"&&typeof Deno.version<"u"}function ya(){return typeof process<"u"&&process.versions&&process.versions.node}function du(){return ya()?process.env.FORCE_COLOR||process.stdout.isTTY&&process.env.TERM!=="dumb":va()?Deno.env.get("FORCE_COLOR")||Deno.isatty(Deno.stdout.rid)&&Deno.env.get("TERM")!=="dumb":!1}var ba=()=>du()?Ln:Nn;var xi=()=>({colors:r,theme:e})=>{let t=e(r);function n(s){let a=s.stack?`
2865
+ }`;var jl=class Xl extends _{constructor(e={}){e={...Xl.defaultOptions,...e};let t=A.from({vertex:{source:fa,entryPoint:"mainVertex"},fragment:{source:fa,entryPoint:"mainFragment"}}),n=I.from({vertex:mr,fragment:Wl,name:"noise-filter"}),{noise:o,seed:i,...s}=e;super({...s,gpuProgram:t,glProgram:n,resources:{noiseUniforms:new fr({uNoise:{value:1,type:"f32"},uSeed:{value:1,type:"f32"}})}}),this.noise=o,this.seed=i??Math.random()}get noise(){return this.resources.noiseUniforms.uniforms.uNoise}set noise(e){this.resources.noiseUniforms.uniforms.uNoise=e}get seed(){return this.resources.noiseUniforms.uniforms.uSeed}set seed(e){this.resources.noiseUniforms.uniforms.uSeed=e}};jl.defaultOptions={noise:.5};var ma=jl;var si=class extends Wa{constructor(e,t){let{text:n,resolution:o,style:i,anchor:s,width:a,height:c,roundPixels:l,...f}=e;super({...f}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=t,this.text=n??"",this.style=i,this.resolution=o??null,this.allowChildren=!1,this._anchor=new en({_onUpdate:()=>{this.onViewUpdate()}}),s&&(this.anchor=s),this.roundPixels=l??!1,a!==void 0&&(this.width=a),c!==void 0&&(this.height=c)}get anchor(){return this._anchor}set anchor(e){typeof e=="number"?this._anchor.set(e):this._anchor.copyFrom(e)}set text(e){e=e.toString(),this._text!==e&&(this._text=e,this.onViewUpdate())}get text(){return this._text}set resolution(e){this._autoResolution=e===null,this._resolution=e,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(e){e||(e={}),this._style?.off("update",this.onViewUpdate,this),e instanceof this._styleClass?this._style=e:this._style=new this._styleClass(e),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(e){this._setWidth(e,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(e){this._setHeight(e,this.bounds.height)}getSize(e){return e||(e={}),e.width=Math.abs(this.scale.x)*this.bounds.width,e.height=Math.abs(this.scale.y)*this.bounds.height,e}setSize(e,t){typeof e=="object"?(t=e.height??e.width,e=e.width):t??(t=e),e!==void 0&&this._setWidth(e,this.bounds.width),t!==void 0&&this._setHeight(t,this.bounds.height)}containsPoint(e){let t=this.bounds.width,n=this.bounds.height,o=-t*this.anchor.x,i=0;return e.x>=o&&e.x<=o+t&&(i=-n*this.anchor.y,e.y>=i&&e.y<=i+n)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}destroy(e=!1){super.destroy(e),this.owner=null,this._bounds=null,this._anchor=null,(typeof e=="boolean"?e:e?.style)&&this._style.destroy(e),this._style=null,this._text=null}get styleKey(){return`${this._text}:${this._style.styleKey}:${this._resolution}`}};function $l(r,e){let t=r[0]??{};return(typeof t=="string"||r[1])&&(N(tn,`use new ${e}({ text: "hi!", style }) instead`),t={text:t,style:r[1]}),t}var Rn=class extends si{constructor(...e){let t=$l(e,"Text");super(t,ja),this.renderPipeId="text",t.textureStyle&&(this.textureStyle=t.textureStyle instanceof Ki?t.textureStyle:new Ki(t.textureStyle))}updateBounds(){let e=this._bounds,t=this._anchor,n=0,o=0;if(this._style.trim){let{frame:i,canvasAndContext:s}=Zi.getCanvasAndContext({text:this.text,style:this._style,resolution:1});Zi.returnCanvasAndContext(s),n=i.width,o=i.height}else{let i=Xa.measureText(this._text,this._style);n=i.width,o=i.height}e.minX=-t._x*n,e.maxX=e.minX+n,e.minY=-t._y*o,e.maxY=e.minY+o}};Ha.add(Al,Fl);var pa=r=>{let[e,t,n]=r,[o,i]=e,[s,a]=t,c=n*Math.PI/180,l=Math.cos(c),f=Math.sin(c);return[l*s,f*s,-f*a,l*a,o,i]},Kl=([r,e,t,n,o,i])=>new $i(r,e,t,n,o,i);var da=(r,e)=>{let[t,n,o,i,s,a]=r,[c,l,f,u,m,p]=e;return[t*c+o*l,n*c+i*l,t*f+o*u,n*f+i*u,t*m+o*p+s,n*m+i*p+a]};var Yl=[1,0,0,1,0,0];var ha=class{keys;index;constructor(e,t){this.keys=e,this.index=t}near(e){return this.keys[Math.max(0,Math.min(this.keys.length-1,this.index+e))][1]}},Ql=r=>r,Mn=r=>Ql((e,t)=>r(e,t.near(0),t.near(1))),Bn=(r,e,t)=>e+(t-e)*r,$d={linear:Mn(Bn),ease:Mn((r,e,t)=>{let n=r<.5?4*r*r*r:1-Math.pow(-2*r+2,3)/2;return Bn(n,e,t)}),easeIn:Mn((r,e,t)=>Bn(r*r*r,e,t)),easeOut:Mn((r,e,t)=>Bn(1-Math.pow(1-r,3),e,t)),bounce:Mn((r,e,t)=>{let i=r<.36363636363636365?7.5625*r*r:r<.7272727272727273?7.5625*(r-.5454545454545454)**2+.75:r<.9090909090909091?7.5625*(r-.8181818181818182)**2+.9375:7.5625*(r-.9545454545454546)**2+.984375;return Bn(i,e,t)}),catmullRom:Ql((r,e)=>{let t=e.near(-1),n=e.near(0),o=e.near(1),i=e.near(2),s=r*r,a=s*r;return .5*(2*n+(-t+o)*r+(2*t-5*n+4*o-i)*s+(-t+3*n-3*o+i)*a)})},Zl=(r,e,t,n)=>{let o=$d[r];if(!o)throw new Error(`unknown terp "${r}"`);return o(e,new ha(t,n))};var Mr=(r,e,t,n=0)=>{if(e.length===0)return n;if(e.length===1)return e[0][1];let o=[...e].sort((u,m)=>u[0]-m[0]);if(r<=o[0][0])return o[0][1];let i=o[o.length-1];if(r>=i[0])return i[1];let s=0;for(let u=0;u<o.length-1;u++){let m=o[u],p=o[u+1];if(r>=m[0]&&r<=p[0]){s=u;break}}let[a]=o[s],[c]=o[s+1],l=c-a,f=l===0?0:(r-a)/l;return Zl(t,f,o,s)},ai=(r,e)=>[[Mr(r,e.track.position.x,e.terp),Mr(r,e.track.position.y,e.terp)],[Mr(r,e.track.scale.x,e.terp,1),Mr(r,e.track.scale.y,e.terp,1)],Mr(r,e.track.rotation,e.terp)],Jl=(r,e)=>Mr(r,e.track,e.terp);function tu(r){return"duration"in r}function ru(r){let e=[],t=new Map(r.timeline.items.map(n=>[n.id,n]));return ga(r.timeline.rootId,t,r.from,{sequence:()=>{},stack:()=>{},video:(n,o,i)=>e.push({item:n,localTime:o,ancestors:i}),text:(n,o,i)=>e.push({item:n,localTime:o,ancestors:i}),audio:(n,o,i)=>e.push({item:n,localTime:o,ancestors:i})}),e}function nu(r,e,t,n){let o=Yl;for(let i of e)o=eu(r,i.item,o,i.localTime);return eu(r,t,o,n)}function eu(r,e,t,n){let o=t;if("spatialId"in e&&e.spatialId){let i=r.get(e.spatialId);if(i?.enabled){let s=pa(i.transform);o=da(s,o)}}if("animationIds"in e&&e.animationIds)for(let i of e.animationIds){let s=r.get(i),a=s?.anims.transform;if(s?.enabled&&a&&Kd(a,n)){let c=pa(ai(n,a));o=da(c,o)}}return o}function ga(r,e,t,n,o=[]){let i=e.get(r);if(i)switch(i.kind){case X.Stack:n.stack(i,t,o);for(let s of i.childrenIds)ga(s,e,t,n,[...o,{item:i,localTime:t}]);break;case X.Sequence:{n.sequence(i,t,o);let s=j(0);for(let a of i.childrenIds){let c=e.get(a);if(!c||!tu(c))continue;let l=j(s+c.duration);if(t>=l){s=l;continue}let f=j(Math.max(0,t-s));ga(a,e,f,n,[...o,{item:i,localTime:t}]),s=l}break}case X.Video:n.video(i,t,o);break;case X.Text:n.text(i,t,o);break;case X.Audio:n.audio(i,t,o);break}}function ee(r,e){let t=e.items.find(n=>n.id===r);if(!t)return j(0);switch(t.kind){case X.Sequence:{let n=t.childrenIds.map(i=>e.items.find(s=>s.id===i)).filter(Boolean),o=j(0);for(let i=0;i<n.length;i++){let s=n[i];if(s.kind===X.Transition){let a=n[i-1],c=n[i+1];if(a&&c&&a.kind!==X.Transition&&c.kind!==X.Transition){let l=ee(a.id,e),f=ee(c.id,e),u=Math.max(0,Math.min(s.duration,l,f));o=j(o-u)}continue}o=j(o+ee(s.id,e))}return o}case X.Stack:{let n=j(0);for(let o of t.childrenIds){let i=ee(o,e);i>n&&(n=i)}return n}default:return tu(t)?t.duration:j(0)}}function ou(r,e,t){if(!("animationIds"in e)||e.animationIds===void 0)return 1;let n=1;for(let o of e.animationIds){let i=r.items.get(o),s=i?.anims.opacity;i?.enabled&&s&&Br(s.track,t)&&(n=Jl(t,s))}return n}function Br(r,e){if(r.length===0)return!1;let t=r[0][0],n=r[0][0];for(let[o]of r)t=Math.min(t,o),n=Math.max(n,o);return e>=t&&e<=n}function Kd(r,e){return Br(r.track.position.x,e)||Br(r.track.position.y,e)||Br(r.track.scale.x,e)||Br(r.track.scale.y,e)||Br(r.track.rotation,e)}var Un=r=>r;var ci=class{resolveMedia;#e=new Map;constructor(e){this.resolveMedia=e}async getSink(e){let t=this.#e.get(e);if(t)return t.sink;let n=new Pe({formats:Be,source:await $e(this.resolveMedia(e))}),o=await n.getPrimaryVideoTrack(),s=!!o&&await o.canDecode()&&o?new Tn(o):null;return this.#e.set(e,{input:n,sink:s}),s}};async function iu(r,e,t,n){let[o,i]=await Promise.all([t,n]),s=o.find(l=>l.kind==="image")?.frame,a=i.find(l=>l.kind==="image")?.frame,c=[...o.filter(l=>l.kind!=="image"),...i.filter(l=>l.kind!=="image")];return s&&a?[{id:r.id,kind:"transition",name:"circle",progress:e,from:s,to:a},...c]:c}async function su(r,e,t,n){let o=Yd(r,e,t);if(!o)return[];let i=[...n,{item:e,localTime:t}];return o.isTransitioning?iu(o.transition,o.progress,Jt(r,o.outgoing,o.outgoingTime,i),Jt(r,o.incoming,o.incomingTime,i)):Jt(r,o.item,o.localTime,i)}function Yd(r,e,t){let n=e.childrenIds.map(i=>r.items.get(i)).filter(i=>!!i),o=j(0);for(let i=0;i<n.length;i++){let s=n[i];if(s.kind===X.Transition)continue;let a=o,c=ee(s.id,r.timeline),l=j(a+c),f=n[i+1];if(!(f?.kind===X.Transition)){if(t<l)return{isTransitioning:!1,item:s,localTime:j(t-a)};o=l;continue}let m=f,p=n[i+2];if(!p||p.kind===X.Transition){o=l;continue}let d=ee(p.id,r.timeline),g=Math.max(0,Math.min(m.duration,c,d)),x=j(l-g);if(t<x)return{isTransitioning:!1,item:s,localTime:j(t-a)};if(t<l){let y=j(t-x),v=j(t-a);return{isTransitioning:!0,incoming:p,outgoing:s,outgoingTime:v,incomingTime:y,progress:g>0?y/g:1,transition:m}}o=x,i++}return null}async function Jt(r,e,t,n){let o=nu(r.items,n,e,t),i=ou(r,e,t),s="spatialId"in e&&e.spatialId?r.items.get(e.spatialId)?.crop:void 0,a="filterIds"in e&&e.filterIds?e.filterIds.map(c=>r.items.get(c)).filter(c=>!!c?.enabled).map(c=>({type:c.type,params:c.params})):void 0;switch(e.kind){case X.Stack:{let c=[...n,{item:e,localTime:t}];return(await Promise.all(e.childrenIds.map(f=>r.items.get(f)).filter(f=>!!f).map(f=>Jt(r,f,t,c)))).flat()}case X.Sequence:return su(r,e,t,n);case X.Video:{if(t<0||t>=e.duration)return[];let c=await r.videoSampler(e,t);return c?[{kind:"image",frame:c,matrix:o,alpha:i,crop:s,filters:a,id:e.id}]:[]}case X.Text:{if(t<0||t>=e.duration)return[];let c=e.styleId?r.items.get(e.styleId)?.style:void 0;return[{id:e.id,kind:"text",content:e.content,style:c,matrix:o,alpha:i,crop:s,filters:a}]}case X.Gap:return[{id:e.id,kind:"gap"}];default:return[]}}function au(r){return async(e,t)=>{let o=await(await r.getSink(e.mediaHash))?.getSample(t/1e3),i=o?.toVideoFrame();return o?.close(),i??void 0}}function Ur(r,e){let t=new ci(r),n=e??au(t);return{async sample(o,i){let s=new Map(o.items.map(c=>[c.id,c])),a=s.get(o.rootId);return a?Jt({videoSampler:n,timeline:o,items:s},a,i,[]):[]}}}var It=class{driver;resolveMedia;timeline;#e=-1/0;#t=new Map;#r;constructor(e,t,n){this.driver=e,this.resolveMedia=t,this.timeline=n,this.#r=Ur(this.resolveMedia,(o,i)=>{let s=cu(i),a=this.#t.get(o.id);if(!a){let c=this.resolveMedia(o.mediaHash),l=cu(j(o.start+o.duration));a=this.#n(c,s,l),this.#t.set(o.id,a)}return a.next(s)})}next(e){if(e<this.#e)throw new Error(`Forward-only cursor regression: ${e}ms < ${this.#e}ms`);return this.#e=e,this.#r.sample(this.timeline,e)}async cancel(){await Promise.all([...this.#t.values()].map(e=>e.cancel())),this.#t.clear()}#n(e,t,n){let o=this.driver.decodeVideo({source:e,start:t/1e6,end:n/1e6}),i=o.readable.getReader(),s=null,a=null,c=!1,l=async()=>{if(c)return null;let{done:f,value:u}=await i.read();if(f)return c=!0,null;let m=new VideoFrame(u);return u.close(),m};return{async next(f){if(s??=await l(),!!s)for(;;){a??=l();let u=await a;if(!u)return new VideoFrame(s);let m=s.timestamp??-1/0,p=u.timestamp??m;if(p<f){s.close(),s=u,a=null;continue}if(Math.abs(p-f)<Math.abs(m-f)){s.close(),s=u,a=null;continue}return new VideoFrame(s)}},async cancel(){let f=a;a=null,c=!0,(await f?.catch(()=>null))?.close(),s?.close(),s=null,o.cancel()}}}},cu=r=>Math.round(r*1e3);async function lu(r,e,t){return(await Promise.all(e.map(async({item:o,localTime:i})=>{if(o.kind!==X.Audio)return;let s=await r.getSink(o.mediaHash);if(!s)return;let a=o.start+i,c=Un((t-a)/1e3),l=s.samples(a/1e3),f=await l.next();if(f.done)return;let u=f.value,m=l.next();return{offset:c,gain:o.gain??1,get currentSample(){return u},timelineTime:()=>Un(c+u.timestamp),output:()=>({sample:u,timestamp:c+u.timestamp,gain:o.gain??1}),advance:async()=>{let p=await m;return p.done?!1:(u=p.value,m=l.next(),!0)}}}))).filter(o=>!!o)}var li=class{resolveMedia;#e=new Map;constructor(e){this.resolveMedia=e}async getSink(e){let t=this.#e.get(e);if(t)return t.sink;let n=new Pe({formats:Be,source:await $e(this.resolveMedia(e))}),o=await n.getPrimaryAudioTrack(),s=!!o&&await o.canDecode()&&o?new wn(o):null;return this.#e.set(e,{input:n,sink:s}),s}};function uu(r){let e={index:0,stream:r[0],time:r[0].timelineTime()};for(let[t,n]of r.entries()){let o=n.timelineTime();o<e.time&&(e={time:o,stream:n,index:t})}return e}function ui(r){let e=new li(r);return{async*sampleAudio(t,n){let o=ru({timeline:t,from:n}),i=await lu(e,o,n);for(;i.length>0;){let{stream:s,index:a}=uu(i);yield s.output(),await s.advance()||i.splice(a,1)}}}}var fi=class{driver;timeline;resolveMedia;audioSampler;seekVisualSampler;playVisualSampler=null;#e=j(0);#t=null;#r=_l();onTick=this.#r.onTick;audioContext=new AudioContext({sampleRate:48e3});audioGain=this.audioContext.createGain();audioNodes=new Set;#n=null;constructor(e,t,n){this.driver=e,this.timeline=t,this.resolveMedia=n,this.audioGain.connect(this.audioContext.destination),this.audioGain.gain.value=.7**2,this.seekVisualSampler=Ur(this.resolveMedia),this.audioSampler=ui(this.resolveMedia),this.#o()}update(e){this.timeline=e}get isPlaying(){return this.#r.isPlaying()}async#o(){for await(let e of this.#r.ticks()){let t=await this.playVisualSampler?.next(this.currentTime)??[];(await this.driver.composite(t)).close(),this.currentTime>=this.duration&&this.pause()}}async seek(e){return this.pause(),this.#e=e,await this.seekVisualSampler.sample(this.timeline,e)}async start(){if(!this.#r.isPlaying()){await this.audioContext.resume(),this.#e=this.currentTime,this.#t=this.audioContext.currentTime,this.#n?.abort(),this.#n=new AbortController;for(let e of this.audioNodes)e.stop();this.audioNodes.clear(),this.playVisualSampler=new It(this.driver,this.resolveMedia,this.timeline),this.#r.play(),this.#i(this.#n.signal,Un(this.#e/1e3))}}pause(){this.#e=this.currentTime,this.#r.pause(),this.#n?.abort();for(let e of this.audioNodes)e.stop();this.audioNodes.clear(),this.playVisualSampler&&(this.playVisualSampler.cancel(),this.playVisualSampler=null)}get duration(){return ee(this.timeline.rootId,this.timeline)}get currentTime(){if(!this.#r.isPlaying()||this.#t===null)return this.#e;let e=(this.audioContext.currentTime-this.#t)*1e3;return j(this.#e+e)}setFps(e){this.#r.setFPS(e)}async#i(e,t){let n=this.audioContext;if(this.#t!==null)for await(let{sample:o,timestamp:i}of this.audioSampler.sampleAudio(this.timeline,j(t*1e3))){if(e.aborted||!this.#r.isPlaying())return;for(;i-(n.currentTime-this.#t+t)>.75;)await new Promise(c=>setTimeout(c,25));let s=n.createBufferSource();s.buffer=o.toAudioBuffer(),s.connect(this.audioGain),s.onended=()=>this.audioNodes.delete(s),this.audioNodes.add(s);let a=this.#t+i-t;a>=n.currentTime?s.start(a):s.start(n.currentTime,n.currentTime-a)}}};var mi=class{driver;canvas;playback;#e=null;#t=null;constructor(e,t,n){this.driver=e,this.playback=new fi(e,n,t),this.canvas=e.compositor.pixi.renderer.canvas}async play(){await this.playback.start()}pause(){this.playback.pause()}seek(e){return this.#e=e,this.#t??=this.#r().finally(()=>this.#t=null)}setFPS(e){this.playback.setFps(xt(e))}get isSeeking(){return this.#t!==null}get isPlaying(){return this.playback.isPlaying}get duration(){return this.playback.duration}get currentTime(){return this.playback.currentTime}async update(e){this.playback.update(e),this.isPlaying||await this.seek(this.currentTime)}async#r(){for(;this.#e!==null;){let e=this.#e;this.#e=null;let t=await this.playback.seek(j(e));(await this.driver.composite(t)).close()}}};var Ke=class{#e;#t;constructor(e={}){this.#e=e.chunkFrames??1024,this.#t=e.clamp??!0}async*mix(e){let t=this.#e,n=null,o=null,i=[],s=0,a=0;for await(let c of e){if(o===null)o=c.planes.length,n=c.sampleRate;else{if(c.planes.length!==o)throw new Error("Channel count changed");if(c.sampleRate!==n)throw new Error("Sample rate changed")}let l=Math.round(c.timestamp*n),f=c.planes[0]?.length??0;for(;s+t<=l;)yield this.#r(i,s,o,n),s+=t;i.push({startFrame:l,endFrame:l+f,data:c.planes}),a=Math.max(a,l+f)}if(o!==null&&n!==null)for(;s<a;)yield this.#r(i,s,o,n),s+=t}#r(e,t,n,o){let i=this.#e,s=new Float32Array(n*i),a=t+i;for(let c=0;c<n;c++){let l=c*i,f=s.subarray(l,l+i);for(let u of e){let m=u.data[c];if(!m)continue;let p=Math.max(t,u.startFrame),d=Math.min(a,u.endFrame);if(p>=d)continue;let g=p-t,x=p-u.startFrame,y=d-p;for(let v=0;v<y;v++)f[g+v]+=m[x+v]}if(this.#t)for(let u=0;u<i;u++){let m=f[u];f[u]=m<-1?-1:m>1?1:m}}for(let c=e.length-1;c>=0;c--)e[c].endFrame<=a&&e.splice(c,1);return{planar:s,sampleRate:o,channels:n,frames:i,startFrame:t}}};var Qd=(r,e,t)=>{if(e===t)return r;let n=t/e,o=Math.max(1,Math.round(r.length*n)),i=new Float32Array(o);for(let s=0;s<o;s++){let a=s/n,c=Math.floor(a),l=Math.min(c+1,r.length-1),f=a-c;i[s]=r[c]*(1-f)+r[l]*f}return i},Ye=(r,e)=>{let t=r.numberOfChannels,n=new Array(t),o=0;for(let i=0;i<t;i++){let s=new Float32Array(r.numberOfFrames);r.copyTo(s,{planeIndex:i,format:"f32-planar"});let a=Qd(s,r.sampleRate,e);n[i]=a,o=a.length}return{data:n,frames:o}};var Nr=(r,e)=>{if(e!==1)for(let t of r)for(let n=0;n<t.length;n++)t[n]*=e};function pi({timeline:r,resolveMedia:e}){let t=new Ke,n=Zd(r,e),o=new TransformStream,i=o.writable.getWriter();async function s(){for await(let a of t.mix(n)){let c=new AudioData({format:"f32-planar",sampleRate:a.sampleRate,numberOfFrames:a.frames,numberOfChannels:a.channels,timestamp:Math.round(a.startFrame/a.sampleRate*1e6),data:new Float32Array(a.planar)});await i.write(c)}await i.close()}return s(),o.readable}async function*Zd(r,e){let t=ui(e);for await(let{sample:n,timestamp:o,gain:i}of t.sampleAudio(r,j(0))){let{data:s}=Ye(n,48e3);Nr(s,i),yield{planes:s,sampleRate:48e3,timestamp:o},n.close()}}function di({timeline:r,fps:e,driver:t,resolveMedia:n}){let o=new TransformStream,i=o.writable.getWriter(),s=new It(t,n,r),a=1/e,c=ee(r.rootId,r);async function l(){await Il({fps:e,duration:c},async(f,u)=>{let m=await s.next(f),p=await t.composite(m),d=new VideoFrame(p,{timestamp:Math.round(u*a*1e6),duration:Math.round(a*1e6)});await i.write(d),p.close()}),await i.close()}return l(),o.readable}function fu(r){let e=pi({...r}),t=di({...r});return r.driver.encode({video:t,audio:e,config:{audio:{codec:"opus",bitrate:128e3},video:{codec:"vp9",bitrate:1e6}}})}var At=class{driver;resources=new ri;constructor(e){this.driver=e}load=async e=>Object.fromEntries(await Promise.all(Object.entries(e).map(async([t,n])=>[t,await this.resources.store(await n)])));timeline=e=>{let t=new re({timeline:{format:"timeline",info:"https://omniclip.app/",version:0,items:[],rootId:0}}),n=e(t);return t.timeline.rootId=n.id,t.timeline};playback=async e=>new mi(this.driver,t=>this.resources.require(t).url,e);render=async(e,t=30)=>fu({timeline:e,fps:xt(t),driver:this.driver,resolveMedia:n=>this.resources.require(n).url})};function xa(r,e){return{error:t=>r.error({...e,...t}),rpcRequest:t=>r.rpcRequest({...e,...t}),rpcError:t=>r.rpcError({...e,...t})}}var hi=()=>r=>({plain:r.none,errMessage:r.mix(r.brightRed,r.bold),errName:r.red,errStack:r.mix(r.red,r.dim),timestamp:r.blue,timestampErr:r.red});function mu(){return hi()}var Ft=Object.freeze({black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",brightBlack:"\x1B[90m",brightRed:"\x1B[91m",brightGreen:"\x1B[92m",brightYellow:"\x1B[93m",brightBlue:"\x1B[94m",brightMagenta:"\x1B[95m",brightCyan:"\x1B[96m",brightWhite:"\x1B[97m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgBrightBlack:"\x1B[100m",bgBrightRed:"\x1B[101m",bgBrightGreen:"\x1B[102m",bgBrightYellow:"\x1B[103m",bgBrightBlue:"\x1B[104m",bgBrightMagenta:"\x1B[105m",bgBrightCyan:"\x1B[106m",bgBrightWhite:"\x1B[107m",bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",inverse:"\x1B[7m",hidden:"\x1B[8m",strikethrough:"\x1B[9m",reset:"\x1B[0m"});var gi=()=>({none:r=>r,uncolor:eh,mix:th,hex:rh,rgb:pu,bgRgb:nh});function eh(r){return r.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,"")}function th(...r){return e=>{for(let t of r)e=t(e);return e}}function rh(r){r=r.replace(/^#/,"");let e,t,n,o;if(r.length===3)e=parseInt(r.split("").map(i=>i+i).join(""),16);else if(r.length===6)e=parseInt(r,16);else throw new Error("Invalid hex color");return t=e>>16&255,n=e>>8&255,o=e&255,pu(t,n,o)}function pu(r,e,t){let n=`\x1B[38;2;${r};${e};${t}m`;return o=>`${n}${o}${Ft.reset}`}function nh(r,e,t){let n=`\x1B[48;2;${r};${e};${t}m`;return o=>`${n}${o}${Ft.reset}`}var Nn={...Object.fromEntries(Object.entries(Ft).map(([r])=>[r,e=>e])),...gi()};var Ln={...Object.fromEntries(Object.entries(Ft).map(([r,e])=>[r,t=>`${e}${t}${Ft.reset}`])),...gi()};function va(){return typeof Deno<"u"&&typeof Deno.version<"u"}function ya(){return typeof process<"u"&&process.versions&&process.versions.node}function du(){return ya()?process.env.FORCE_COLOR||process.stdout.isTTY&&process.env.TERM!=="dumb":va()?Deno.env.get("FORCE_COLOR")||Deno.isatty(Deno.stdout.rid)&&Deno.env.get("TERM")!=="dumb":!1}var ba=()=>du()?Ln:Nn;var xi=()=>({colors:r,theme:e})=>{let t=e(r);function n(s){let a=s.stack?`
2866
2866
  `+s.stack+`
2867
2867
  `:"";return[t.errName(s.name+":"),t.errMessage(s.message)].join(" ")+t.errStack(a)}function o(s){return s&&s instanceof Error?n(s):s}function i(s){return s&&s instanceof Error?n(s):t.errMessage(s)}return{stdout:s=>s.map(o),stderr:s=>s.map(i)}};function Vn(...r){return e=>({stdout:t=>{for(let n of r)t=n(e).stdout(t);return t},stderr:t=>{for(let n of r)t=n(e).stderr(t);return t}})}function oh(){return{icon:"\u{1F6A8}",now:()=>Date.now()}}var vi=r=>({colors:e,theme:t})=>{let n={...oh(),...r},o=t(e),i=new Date(n.now()),s=i.getUTCFullYear().toString().padStart(4,"0"),a=(i.getUTCMonth()+1).toString().padStart(2,"0"),c=i.getUTCDate().toString().padStart(2,"0"),l=`${s}-${a}-${c}`,f=i.getUTCHours().toString().padStart(2,"0"),u=i.getUTCMinutes().toString().padStart(2,"0"),m=i.getUTCSeconds().toString().padStart(2,"0"),p=i.getUTCMilliseconds().toString().padStart(3,"0"),d=`${f}:${u}:${m}.${p}`,g=`${l}::${d}`;return{stdout:x=>[o.timestamp(g),...x],stderr:x=>[o.timestampErr(g),...[n.icon].filter(Boolean),...x]}};function hu(){return Vn(xi(),vi())}var yi=()=>({stdout:async r=>{await Deno.stdout.write(new TextEncoder().encode(r+`
2868
2868
  `))},stderr:async r=>{await Deno.stderr.write(new TextEncoder().encode(r+`