clipoox-render 0.4.4 → 0.4.5

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.
@@ -0,0 +1,5 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/rotoMaskStore-DdpmT9C3.js","assets/titleFrameBudget-X7HLSDre.js","assets/sceneTrack-Bbov7zET.js","assets/api-BFN7blbw.js","assets/i18n-BJppIrtF.js","assets/index-CKtv7gGE.js","assets/timeline3dExport-DCOr6ARB.js","assets/timeline3d-Dn7PqmEe.js","assets/three.module-Bx43vjkH.js","assets/gltfLoader-U0Eebg7v.js","assets/RoomEnvironment-Dmv_G5ka.js","assets/frameSink-DYs2gTzq.js","assets/titleFrames-aMG7HdVe.js","assets/titleArt-CUtA0C3I.js","assets/textAnimators-BVXTl8bU.js","assets/lottieLayer-C2YbiXhK.js","assets/rigTrack-XaMj1yaH.js","assets/rotoMatte-i-cJTYmK.js","assets/store-GFMJzaWS.js","assets/windowFrames-1wAkkWnv.js","assets/gpuExport-CQ7ZhpsX.js","assets/glTransitionSources.generated-DM5sRMX2.js","assets/timelineComp-Dx_kED5V.js","assets/gpuCompose-DbnZuelB.js","assets/motionBlur-uAm030t9.js","assets/distortGL-BA5molk-.js","assets/id3-arvEpAg7.js","assets/output-p-Q7qous.js","assets/clientExport-DvpTTndR.js","assets/distortFrames-BLt1icUb.js","assets/engine-DioUF2mX.js","assets/store-Cug4GGcP.js","assets/conversion-4rhF3xRJ.js","assets/pendingMatte-CQb7jPg1.js","assets/timelineOps-afzSo188.js","assets/cameraTracker-BAQHuTV-.js","assets/clientJobs-CuuUyhEy.js","assets/personHq-B1c0QVJT.js","assets/matteQuality-9X-jgJrH.js","assets/surfacePin-B4-1UqXD.js","assets/sceneTrack-DIPzBmMK.js","assets/surfaceLight-C--moyc9.js","assets/clientJobs-CIrYTMpn.js"])))=>i.map(i=>d[i]);
2
+ import{_ as w,b_ as I,iF as O}from"./titleFrameBudget-X7HLSDre.js";import{FrameSink as R,SKIPPED_FRAME as F}from"./frameSink-DYs2gTzq.js";class $ extends R{want;next=new Map;last=new Map;out={};constructor(c){super({put:async()=>{throw Error("a pick sink keeps its frames")}}),this.want=new Map;for(const[u,a]of Object.entries(c))for(const[s,r]of Object.entries(a||{}))this.want.set(`${u}
3
+ ${s}`,new Set(r));this.wants=(u,a,s)=>{const r=this.want.get(`${u}
4
+ ${a}`);return!!r&&(s===void 0||r.has(s))}}async push(c,u,a){const s=`${c}
5
+ ${u}`,r=this.next.get(s)??0;if(this.next.set(s,r+1),a===F)return;const n=a==="="?this.last.get(s):a;n!==void 0&&(this.last.set(s,n),this.want.get(s)?.has(r)&&(((this.out[c]??={})[u]??={})[r]=n))}picked(){return this.out}}const b=(o,c)=>Object.keys(o[c]||{}).length>0,D={async frames({clips:o,format:c,camera:u=null,want:a}){const{unpackMasks:s}=await w(async()=>{const{unpackMasks:e}=await import("./rotoMaskStore-DdpmT9C3.js");return{unpackMasks:e}},__vite__mapDeps([0,1,2,3,4,5])),r=await s(o);o=r.clips;const n=new $(a),_={},k=I(c).fps,l=n.wants,p=async(e,m,h)=>{for(const y of m){n.wants=(E,v,d)=>E===e&&v===y&&l(E,v,d);try{await h()}catch(E){_[y]=String(E?.message||E).slice(0,200)}finally{n.wants=l}}},t=e=>Object.keys(a[e]||{});if(b(a,"modelFrames")){const{render3DFrames:e}=await w(async()=>{const{render3DFrames:m}=await import("./timeline3dExport-DCOr6ARB.js");return{render3DFrames:m}},__vite__mapDeps([6,1,7,8,9,3,4,5,10,11]));await p("modelFrames",t("modelFrames"),()=>e(o,c,n,void 0,u))}if(b(a,"titleFrames")){const{renderTitleFrames:e}=await w(async()=>{const{renderTitleFrames:h}=await import("./titleFrames-aMG7HdVe.js");return{renderTitleFrames:h}},__vite__mapDeps([12,1,13,14,15,16,4,5,3,11])),m=[...o,...O(o)];await p("titleFrames",t("titleFrames"),()=>e(m,c,n,void 0,u))}if(b(a,"matteFrames")){const e=await w(()=>import("./rotoMatte-i-cJTYmK.js").then(h=>h.r),__vite__mapDeps([17,1,3,4,5,18])),m=[...o,...e.maskedCopies(o)];await p("matteFrames",t("matteFrames"),()=>e.renderMatteFrames(m,k,n))}if(b(a,"windowFrames")){const e=await w(()=>import("./windowFrames-1wAkkWnv.js"),__vite__mapDeps([19,1,17,3,4,5,18]));await p("windowFrames",t("windowFrames"),()=>e.renderWindowFrames(o,k,n))}return{frames:n.picked(),failed:_,missingMasks:r.missing}},async gpuExport({clips:o,format:c,tracks:u={},camera:a=null,encode:s=null,range:r,only:n,name:_="film.mp4",softwareEncoder:k=!1}){const{unpackMasks:l}=await w(async()=>{const{unpackMasks:i}=await import("./rotoMaskStore-DdpmT9C3.js");return{unpackMasks:i}},__vite__mapDeps([0,1,2,3,4,5])),p=await l(o);if(p.missing)throw Object.assign(new Error(`${p.missing} stored Roto mask(s) / track(s) could not be read`),{name:"MissingMasks"});o=p.clips;const t=await w(()=>import("./gpuExport-CQ7ZhpsX.js"),__vite__mapDeps([20,1,21,3,4,5,22,23,24,25,26,27]));if(k){if(n!=="video"||!await t.canEncodeH264(c))throw Object.assign(new Error("no H.264 encoder in this browser"),{name:"NoEncoder"})}else if(!await t.gpuExportSupported(c,s))throw Object.assign(new Error("no hardware video encoder in this browser"),{name:"NoEncoder"});const{softwareRetry:e}=await w(async()=>{const{softwareRetry:i}=await import("./clientExport-DvpTTndR.js");return{softwareRetry:i}},__vite__mapDeps([28,1,22])),m=i=>{try{window.__clipooxProgress?.(i)}catch{}};let h=k;const y=`/__clipoox/out/${encodeURIComponent(_)}`,E=()=>new WritableStream({async write(i){const g=await fetch(`${y}?at=${i.position}`,{method:"PATCH",body:i.data});if(!g.ok)throw new Error(`the film could not be handed over (${g.status})`)}}),v=i=>t.exportOnGpu(o,{format:c,encode:s,tracks:u,camera:a,onProgress:m,software:i,liveMotion:!0,range:r,only:n,sink:E()}),d=i=>{const g=i instanceof Error?`${i.name}: ${i.message}`:String(i);return new Error(`${t.gpuExportStage()||"start"}${r?` (frames ${r.from}–${r.to})`:""}: ${g}`)},f=await v(k).catch(i=>{if(!e(i,t.gpuExportStage(),s))throw d(i);return h=!0,v(!0).catch(g=>{throw d(g)})});let P="";try{const i=document.createElement("canvas").getContext("webgl2"),g=i?.getExtension("WEBGL_debug_renderer_info");P=String(g&&i?i.getParameter(g.UNMASKED_RENDERER_WEBGL):"").slice(0,120)}catch{}return{ms:f.ms,software:h,gpu:P}},async distort({clips:o,format:c,tracks:u={}}){const{unpackMasks:a}=await w(async()=>{const{unpackMasks:t}=await import("./rotoMaskStore-DdpmT9C3.js");return{unpackMasks:t}},__vite__mapDeps([0,1,2,3,4,5])),s=await a(o);if(s.missing)throw Object.assign(new Error(`${s.missing} stored Roto mask(s) / track(s) could not be read`),{name:"MissingMasks"});let r=0;const n=async t=>{const e=`chunk-${r++}.json`,m=await fetch(`/__clipoox/chunk/${e}`,{method:"POST",body:JSON.stringify(t)});if(!m.ok)throw new Error(`the frames could not be handed over (${m.status})`);return e},{FrameSink:_}=await w(async()=>{const{FrameSink:t}=await import("./frameSink-DYs2gTzq.js");return{FrameSink:t}},__vite__mapDeps([11,1])),{distortForServer:k}=await w(async()=>{const{distortForServer:t}=await import("./distortFrames-BLt1icUb.js");return{distortForServer:t}},__vite__mapDeps([29,1,25,26])),l=new _({put:n,inlineLimit:0}),p=await k(s.clips,c,l,void 0,u);return{clips:p.clips,tracks:p.tracks,frames:await l.finish()}},async upscale({url:o,kind:c,scale:u=2,model:a="photo",name:s="upscaled.bin"}){const r=await w(()=>import("./engine-DioUF2mX.js"),__vite__mapDeps([30,1,31,26,27,32])),n=t=>{try{window.__clipooxProgress?.(t.fraction)}catch{}},_=c==="video"?await r.upscaleVideo(o,{model:a,onProgress:n}):await r.upscaleImage(o,{scale:u,model:a,onProgress:n}),k=`/__clipoox/out/${encodeURIComponent(s)}`,l=new Uint8Array(await _.blob.arrayBuffer()),p=8<<20;for(let t=0;t<l.length;t+=p){const e=await fetch(`${k}?at=${t}`,{method:"PATCH",body:l.subarray(t,Math.min(l.length,t+p))});if(!e.ok)throw new Error(`the file could not be handed over (${e.status})`)}return{width:_.width,height:_.height,duration:_.duration??null,type:_.blob.type,bytes:l.length,backend:_.backend,seconds:_.seconds,soundDropped:!!_.soundDropped}},async runClientJobs({clips:o,format:c,tracks:u={},camera:a=null,only:s}){const[{useStore:r},{unpackMasks:n,packMasks:_},{runPendingMattes:k},{runSurfacePins:l},{runPendingClientJobs:p}]=await Promise.all([w(()=>import("./store-GFMJzaWS.js").then(d=>d.d),__vite__mapDeps([18,1,5])),w(()=>import("./rotoMaskStore-DdpmT9C3.js"),__vite__mapDeps([0,1,2,3,4,5])),w(()=>import("./pendingMatte-CQb7jPg1.js"),__vite__mapDeps([33,1,34,2,35,14,22,3,4,5,18,16,36,37,38])),w(()=>import("./surfacePin-B4-1UqXD.js"),__vite__mapDeps([39,1,40,2,4,5,35,14,38,41,18])),w(()=>import("./clientJobs-CIrYTMpn.js"),__vite__mapDeps([42,1,5,18,4,3,36]))]),t=await n(o);r.setState({clips:t.clips,timelineFormat:c,timelineTracks:u,timelineCamera:a??void 0});const e=d=>!s?.length||s.includes(d),m=[],h=d=>{try{window.__clipooxProgress?.(d)}catch{}};if(h(.05),e("person-matte")||e("object-matte")||e("person-matte-hq")){const d=await k();for(const f of d)m.push({kind:"person-matte",clipId:f.clipId,ok:f.ok,message:f.message})}if(h(.4),e("surface-track")){const d=await l();for(const f of d)m.push({kind:"surface-track",clipId:f.clipId,ok:f.ok,message:f.message})}h(.7);const y=await p({only:s});for(const d of y)m.push({kind:d.kind,clipId:d.clipId,ok:d.ok,message:d.error||"done"});h(.95);const E=r.getState(),v=await _(E.clips);return h(1),{clips:v,timelineTracks:E.timelineTracks,timelineCamera:E.timelineCamera??null,results:m}}};window.__layerWorker=D;
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="robots" content="noindex" />
6
6
  <title>Timeline layer worker</title>
7
- <script type="module" crossorigin src="/assets/layer-worker-DLSnp1D-.js"></script>
7
+ <script type="module" crossorigin src="/assets/layer-worker-DK67WH1a.js"></script>
8
8
  <link rel="modulepreload" crossorigin href="/assets/titleFrameBudget-X7HLSDre.js">
9
9
  <link rel="modulepreload" crossorigin href="/assets/frameSink-DYs2gTzq.js">
10
10
  </head>
@@ -1,5 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/rotoMaskStore-DdpmT9C3.js","assets/titleFrameBudget-X7HLSDre.js","assets/sceneTrack-Bbov7zET.js","assets/api-BFN7blbw.js","assets/i18n-BJppIrtF.js","assets/index-CKtv7gGE.js","assets/timeline3dExport-DCOr6ARB.js","assets/timeline3d-Dn7PqmEe.js","assets/three.module-Bx43vjkH.js","assets/gltfLoader-U0Eebg7v.js","assets/RoomEnvironment-Dmv_G5ka.js","assets/frameSink-DYs2gTzq.js","assets/titleFrames-aMG7HdVe.js","assets/titleArt-CUtA0C3I.js","assets/textAnimators-BVXTl8bU.js","assets/lottieLayer-C2YbiXhK.js","assets/rigTrack-XaMj1yaH.js","assets/rotoMatte-i-cJTYmK.js","assets/store-GFMJzaWS.js","assets/windowFrames-1wAkkWnv.js","assets/gpuExport-CQ7ZhpsX.js","assets/glTransitionSources.generated-DM5sRMX2.js","assets/timelineComp-Dx_kED5V.js","assets/gpuCompose-DbnZuelB.js","assets/motionBlur-uAm030t9.js","assets/distortGL-BA5molk-.js","assets/id3-arvEpAg7.js","assets/output-p-Q7qous.js","assets/clientExport-DvpTTndR.js","assets/engine-DioUF2mX.js","assets/store-Cug4GGcP.js","assets/conversion-4rhF3xRJ.js","assets/pendingMatte-CQb7jPg1.js","assets/timelineOps-afzSo188.js","assets/cameraTracker-BAQHuTV-.js","assets/clientJobs-CuuUyhEy.js","assets/personHq-B1c0QVJT.js","assets/matteQuality-9X-jgJrH.js","assets/surfacePin-B4-1UqXD.js","assets/sceneTrack-DIPzBmMK.js","assets/surfaceLight-C--moyc9.js","assets/clientJobs-CIrYTMpn.js"])))=>i.map(i=>d[i]);
2
- import{_ as w,b_ as I,iF as R}from"./titleFrameBudget-X7HLSDre.js";import{FrameSink as D,SKIPPED_FRAME as F}from"./frameSink-DYs2gTzq.js";class O extends D{want;next=new Map;last=new Map;out={};constructor(d){super({put:async()=>{throw Error("a pick sink keeps its frames")}}),this.want=new Map;for(const[u,r]of Object.entries(d))for(const[e,s]of Object.entries(r||{}))this.want.set(`${u}
3
- ${e}`,new Set(s));this.wants=(u,r,e)=>{const s=this.want.get(`${u}
4
- ${r}`);return!!s&&(e===void 0||s.has(e))}}async push(d,u,r){const e=`${d}
5
- ${u}`,s=this.next.get(e)??0;if(this.next.set(e,s+1),r===F)return;const n=r==="="?this.last.get(e):r;n!==void 0&&(this.last.set(e,n),this.want.get(e)?.has(s)&&(((this.out[d]??={})[u]??={})[s]=n))}picked(){return this.out}}const y=(a,d)=>Object.keys(a[d]||{}).length>0,$={async frames({clips:a,format:d,camera:u=null,want:r}){const{unpackMasks:e}=await w(async()=>{const{unpackMasks:t}=await import("./rotoMaskStore-DdpmT9C3.js");return{unpackMasks:t}},__vite__mapDeps([0,1,2,3,4,5])),s=await e(a);a=s.clips;const n=new O(r),m={},E=I(d).fps,h=n.wants,l=async(t,_,p)=>{for(const v of _){n.wants=(k,b,c)=>k===t&&b===v&&h(k,b,c);try{await p()}catch(k){m[v]=String(k?.message||k).slice(0,200)}finally{n.wants=h}}},i=t=>Object.keys(r[t]||{});if(y(r,"modelFrames")){const{render3DFrames:t}=await w(async()=>{const{render3DFrames:_}=await import("./timeline3dExport-DCOr6ARB.js");return{render3DFrames:_}},__vite__mapDeps([6,1,7,8,9,3,4,5,10,11]));await l("modelFrames",i("modelFrames"),()=>t(a,d,n,void 0,u))}if(y(r,"titleFrames")){const{renderTitleFrames:t}=await w(async()=>{const{renderTitleFrames:p}=await import("./titleFrames-aMG7HdVe.js");return{renderTitleFrames:p}},__vite__mapDeps([12,1,13,14,15,16,4,5,3,11])),_=[...a,...R(a)];await l("titleFrames",i("titleFrames"),()=>t(_,d,n,void 0,u))}if(y(r,"matteFrames")){const t=await w(()=>import("./rotoMatte-i-cJTYmK.js").then(p=>p.r),__vite__mapDeps([17,1,3,4,5,18])),_=[...a,...t.maskedCopies(a)];await l("matteFrames",i("matteFrames"),()=>t.renderMatteFrames(_,E,n))}if(y(r,"windowFrames")){const t=await w(()=>import("./windowFrames-1wAkkWnv.js"),__vite__mapDeps([19,1,17,3,4,5,18]));await l("windowFrames",i("windowFrames"),()=>t.renderWindowFrames(a,E,n))}return{frames:n.picked(),failed:m,missingMasks:s.missing}},async gpuExport({clips:a,format:d,tracks:u={},camera:r=null,encode:e=null,range:s,only:n,name:m="film.mp4",softwareEncoder:E=!1}){const{unpackMasks:h}=await w(async()=>{const{unpackMasks:o}=await import("./rotoMaskStore-DdpmT9C3.js");return{unpackMasks:o}},__vite__mapDeps([0,1,2,3,4,5])),l=await h(a);if(l.missing)throw Object.assign(new Error(`${l.missing} stored Roto mask(s) / track(s) could not be read`),{name:"MissingMasks"});a=l.clips;const i=await w(()=>import("./gpuExport-CQ7ZhpsX.js"),__vite__mapDeps([20,1,21,3,4,5,22,23,24,25,26,27]));if(E){if(n!=="video"||!await i.canEncodeH264(d))throw Object.assign(new Error("no H.264 encoder in this browser"),{name:"NoEncoder"})}else if(!await i.gpuExportSupported(d,e))throw Object.assign(new Error("no hardware video encoder in this browser"),{name:"NoEncoder"});const{softwareRetry:t}=await w(async()=>{const{softwareRetry:o}=await import("./clientExport-DvpTTndR.js");return{softwareRetry:o}},__vite__mapDeps([28,1,22])),_=o=>{try{window.__clipooxProgress?.(o)}catch{}};let p=E;const v=`/__clipoox/out/${encodeURIComponent(m)}`,k=()=>new WritableStream({async write(o){const g=await fetch(`${v}?at=${o.position}`,{method:"PATCH",body:o.data});if(!g.ok)throw new Error(`the film could not be handed over (${g.status})`)}}),b=o=>i.exportOnGpu(a,{format:d,encode:e,tracks:u,camera:r,onProgress:_,software:o,liveMotion:!0,range:s,only:n,sink:k()}),c=o=>{const g=o instanceof Error?`${o.name}: ${o.message}`:String(o);return new Error(`${i.gpuExportStage()||"start"}${s?` (frames ${s.from}–${s.to})`:""}: ${g}`)},f=await b(E).catch(o=>{if(!t(o,i.gpuExportStage(),e))throw c(o);return p=!0,b(!0).catch(g=>{throw c(g)})});let P="";try{const o=document.createElement("canvas").getContext("webgl2"),g=o?.getExtension("WEBGL_debug_renderer_info");P=String(g&&o?o.getParameter(g.UNMASKED_RENDERER_WEBGL):"").slice(0,120)}catch{}return{ms:f.ms,software:p,gpu:P}},async upscale({url:a,kind:d,scale:u=2,model:r="photo",name:e="upscaled.bin"}){const s=await w(()=>import("./engine-DioUF2mX.js"),__vite__mapDeps([29,1,30,26,27,31])),n=i=>{try{window.__clipooxProgress?.(i.fraction)}catch{}},m=d==="video"?await s.upscaleVideo(a,{model:r,onProgress:n}):await s.upscaleImage(a,{scale:u,model:r,onProgress:n}),E=`/__clipoox/out/${encodeURIComponent(e)}`,h=new Uint8Array(await m.blob.arrayBuffer()),l=8<<20;for(let i=0;i<h.length;i+=l){const t=await fetch(`${E}?at=${i}`,{method:"PATCH",body:h.subarray(i,Math.min(h.length,i+l))});if(!t.ok)throw new Error(`the file could not be handed over (${t.status})`)}return{width:m.width,height:m.height,duration:m.duration??null,type:m.blob.type,bytes:h.length,backend:m.backend,seconds:m.seconds,soundDropped:!!m.soundDropped}},async runClientJobs({clips:a,format:d,tracks:u={},camera:r=null,only:e}){const[{useStore:s},{unpackMasks:n,packMasks:m},{runPendingMattes:E},{runSurfacePins:h},{runPendingClientJobs:l}]=await Promise.all([w(()=>import("./store-GFMJzaWS.js").then(c=>c.d),__vite__mapDeps([18,1,5])),w(()=>import("./rotoMaskStore-DdpmT9C3.js"),__vite__mapDeps([0,1,2,3,4,5])),w(()=>import("./pendingMatte-CQb7jPg1.js"),__vite__mapDeps([32,1,33,2,34,14,22,3,4,5,18,16,35,36,37])),w(()=>import("./surfacePin-B4-1UqXD.js"),__vite__mapDeps([38,1,39,2,4,5,34,14,37,40,18])),w(()=>import("./clientJobs-CIrYTMpn.js"),__vite__mapDeps([41,1,5,18,4,3,35]))]),i=await n(a);s.setState({clips:i.clips,timelineFormat:d,timelineTracks:u,timelineCamera:r??void 0});const t=c=>!e?.length||e.includes(c),_=[],p=c=>{try{window.__clipooxProgress?.(c)}catch{}};if(p(.05),t("person-matte")||t("object-matte")||t("person-matte-hq")){const c=await E();for(const f of c)_.push({kind:"person-matte",clipId:f.clipId,ok:f.ok,message:f.message})}if(p(.4),t("surface-track")){const c=await h();for(const f of c)_.push({kind:"surface-track",clipId:f.clipId,ok:f.ok,message:f.message})}p(.7);const v=await l({only:e});for(const c of v)_.push({kind:c.kind,clipId:c.clipId,ok:c.ok,message:c.error||"done"});p(.95);const k=s.getState(),b=await m(k.clips);return p(1),{clips:b,timelineTracks:k.timelineTracks,timelineCamera:k.timelineCamera??null,results:_}}};window.__layerWorker=$;