conformtools 0.6.2 → 0.6.4
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.
- package/README.md +6 -1
- package/dist/browser/timeline_core_bg.wasm +0 -0
- package/dist/{chunk-BTXLTVNK.js → chunk-42QQI3WX.js} +1 -1
- package/dist/chunk-6FVGUJ6L.js +3 -0
- package/dist/{chunk-KP4C2MFM.js → chunk-BW2NQ54J.js} +1 -1
- package/dist/{chunk-PIEH7J6J.js → chunk-CL26XMDO.js} +1 -1
- package/dist/chunk-EO5NIBOV.js +3 -0
- package/dist/{chunk-BXFVYGFW.js → chunk-EPZ6NWE4.js} +1 -1
- package/dist/{chunk-RULUDOB7.js → chunk-HKP4P6JN.js} +1 -1
- package/dist/{chunk-JH3OLTR6.js → chunk-JB7PR2TQ.js} +1 -1
- package/dist/chunk-QTKRMXL5.js +363 -0
- package/dist/{chunk-FNGHTZ5F.js → chunk-QTPCU2TF.js} +1 -1
- package/dist/chunk-TEZP6VEQ.js +3 -0
- package/dist/{chunk-RUBNBRUK.js → chunk-WT6NIJCB.js} +1 -1
- package/dist/{claude-setup-XSNTKEU7.js → claude-setup-BM3AAUKR.js} +1 -1
- package/dist/cli.js +9 -9
- package/dist/conformtools-decode +0 -0
- package/dist/{cr3-wasm-YTMVBAFM.js → cr3-wasm-WKWMEK3V.js} +1 -1
- package/dist/{dng-wasm-WUUQB7M2.js → dng-wasm-Z5OVO4UI.js} +1 -1
- package/dist/{dpx-wasm-XBKO4V4W.js → dpx-wasm-QNYXAOAJ.js} +1 -1
- package/dist/{exr-wasm-VE2W6MFW.js → exr-wasm-BHSBJLQH.js} +1 -1
- package/dist/{h264-HD7BY5J5.js → h264-LIZVHN2W.js} +1 -1
- package/dist/{h264-mxf-6OOODSAK.js → h264-mxf-MWS7DDV7.js} +1 -1
- package/dist/http.js +1 -1
- package/dist/i2o-transfer +0 -0
- package/dist/{inspect-TDZCNXVW.js → inspect-DZF537QL.js} +1 -1
- package/dist/isobmff-HM3UPWPZ.js +3 -0
- package/dist/mcp.js +8 -8
- package/dist/{media_core_bg-YBW45HJ2.js → media_core_bg-FGAR5KA5.js} +1 -1
- package/dist/mxf-K465SWBN.js +3 -0
- package/dist/{ops-UPPAG2TI.js → ops-73NR3X6R.js} +1 -1
- package/dist/{r3d-KJVC7T2C.js → r3d-RR3FUM6H.js} +1 -1
- package/dist/{r3d-EY6FEFKM.js → r3d-VUOYU2KQ.js} +1 -1
- package/dist/resolve-bridge.py +73 -10
- package/dist/still-4G25EYN5.js +3 -0
- package/dist/{tiff-wasm-T2V2ICZT.js → tiff-wasm-QJPCR7JT.js} +1 -1
- package/dist/wasm/media_core_bg.wasm +0 -0
- package/dist/wasm/udf_bg.wasm +0 -0
- package/dist/{wav-LFS6OZHJ.js → wav-63QF6SCT.js} +1 -1
- package/package.json +1 -1
- package/dist/chunk-CX3USH6A.js +0 -318
- package/dist/chunk-D5DEQ467.js +0 -3
- package/dist/chunk-JEMLKBH2.js +0 -3
- package/dist/chunk-RXHNBSER.js +0 -3
- package/dist/isobmff-57HSD6O2.js +0 -3
- package/dist/mxf-FAXEK4WR.js +0 -3
- package/dist/still-WY7MUR7A.js +0 -3
- /package/dist/{arriraw-BEZILZY3.js → arriraw-3GKCR6K2.js} +0 -0
- /package/dist/{chunk-NP53ITN6.js → chunk-WHY3DVXS.js} +0 -0
- /package/dist/{media_core_bg-5UIQAP7I.js → media_core_bg-YK63OUDM.js} +0 -0
- /package/dist/{prores-BNALPJPS.js → prores-L4JZZWGH.js} +0 -0
- /package/dist/{timeline_core_bg-XYT26ZTU.js → timeline_core_bg-2TYWZ35G.js} +0 -0
- /package/dist/{udf_bg-R3JEZJAT.js → udf_bg-A4WEMSAX.js} +0 -0
package/dist/chunk-D5DEQ467.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
import{readFile as y,writeFile as v,appendFile as F,stat as f,readdir as k,mkdir as U,open as h,copyFile as D,mkdtemp as O,rm as P,chmod as T,rename as R,cp as M,statfs as S}from"node:fs/promises";import{execFile as W,spawn as A}from"node:child_process";import{createHash as $}from"node:crypto";import{createReadStream as E}from"node:fs";import{homedir as B,tmpdir as H,platform as N,release as C,arch as z,totalmem as L,availableParallelism as I}from"node:os";import{fileURLToPath as b}from"node:url";import _ from"node:http";import m from"node:process";import{Buffer as x}from"node:buffer";import{join as w,resolve as j}from"node:path";import{basename as ze,dirname as Le,extname as Ie,join as _e,relative as je,resolve as Ge}from"node:path";{let e=globalThis.fetch,t=typeof globalThis.Deno<"u";e&&!t&&(globalThis.fetch=(async(n,o)=>{let r=typeof n=="string"?n:n instanceof URL?n.href:n.url;if(r.startsWith("file:")){let i=await y(b(r)),s=r.endsWith(".wasm")?"application/wasm":"application/octet-stream";return new Response(i,{status:200,headers:{"content-type":s}})}return e(n,o)}))}var p=e=>m.env[e],re=()=>Number(p("CONFORM_MEMORY_GB")??0)*2**30||L(),ne=()=>I(),oe=()=>m.argv.slice(2),se=e=>m.exit(e),ie=()=>m.platform,ae=()=>m.arch;function ce(){let e=m.versions.deno;return{platform:`${N()} ${C()} ${z()}`,runtime:e?`deno ${e}`:`node ${m.version}`}}var le=()=>p("CONFORM_MCP_HOME")??w(g(),".conform-mcp"),g=()=>p("HOME")??B();function me(e){let t=e.trim();if(t.length>=2&&(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))&&(t=t.slice(1,-1)),/^file:\/\//i.test(t))try{t=b(t)}catch{}return t==="~"?t=g():(t.startsWith("~/")||t.startsWith("~\\"))&&(t=w(g(),t.slice(2))),t&&j(t)}var ue=e=>b(e);async function de(e){let t=await f(e);return{isFile:t.isFile(),isDirectory:t.isDirectory(),size:t.size,mtimeMs:t.mtimeMs}}async function fe(e){try{return await f(e),!0}catch{return!1}}async function pe(e){try{return(await f(e)).isFile()}catch{return!1}}async function ge(e){try{return(await f(e)).isDirectory()}catch{return!1}}async function ye(e){let t=await y(e);return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}var he=e=>y(e,"utf8"),be=(e,t)=>v(e,t),we=(e,t,n)=>n?.append?F(e,t):v(e,t);async function xe(e){await U(e,{recursive:!0})}var ve=e=>P(e,{force:!0}),Pe=(e,t)=>T(e,t).catch(()=>{}),Re=(e,t)=>D(e,t),Ae=(e,t)=>R(e,t),Fe=e=>P(e,{recursive:!0,force:!0}),ke=(e,t)=>M(e,t,{recursive:!0,verbatimSymlinks:!0});async function Ue(e){try{let t=await S(e);return Number(t.bavail)*Number(t.bsize)}catch{return null}}var De=(e="conform-")=>O(w(H(),e));async function*Oe(e){for(let t of await k(e,{withFileTypes:!0}))yield{name:t.name,isFile:t.isFile(),isDirectory:t.isDirectory()}}async function Te(e){let t=await h(e,"r"),n=(await t.stat()).size;return{path:e,size:n,async readAt(o,r){let i=new Uint8Array(r),s=0;for(;s<r;){let{bytesRead:c}=await t.read(i,s,r-s,o+s);if(!c)break;s+=c}return s===r?i:i.subarray(0,s)},close:()=>t.close()}}async function Me(e){let t=await h(e,"w");return{async writeAt(n,o){let r=0;for(;r<o.length;){let{bytesWritten:i}=await t.write(o,r,o.length-r,n+r);r+=i}},truncate:n=>t.truncate(n),close:()=>t.close()}}function G(e,t,n={}){return new Promise(o=>{W(e,t,{maxBuffer:1<<30,env:n.env?{...m.env,...n.env}:void 0,timeout:n.timeoutMs},(r,i,s)=>{let c=r?.code??0;o({success:!r,code:c,stdout:String(i),stderr:String(s)})})})}function Se(e,t,n,o={}){return new Promise((r,i)=>{let s=A(e,t,{env:o.env?{...m.env,...o.env}:void 0,stdio:["ignore","pipe","pipe"]}),c="";s.stdout.on("data",a=>n(a)),s.stderr.on("data",a=>{c+=new TextDecoder().decode(a)}),s.on("error",i),s.on("close",a=>r({code:a,stderr:c})),o.signal?.addEventListener("abort",()=>s.kill(),{once:!0})})}function We(e,t,n,o){let r=A(e,t,{stdio:["pipe","pipe","pipe"]});r.stdout.on("data",a=>n(a)),r.stderr.on("data",a=>o?.(new TextDecoder().decode(a)));let i=new Promise(a=>{r.on("close",l=>a(l)),r.on("error",()=>a(null))}),s=[r,r.stdout,r.stderr,r.stdin],c=a=>{for(let l of s)(a?l.ref:l.unref)?.call(l)};return c(!1),{write:a=>new Promise((l,u)=>{r.stdin.write(a,d=>d?u(d):l())}),hold:c,close:()=>{try{r.stdin.end(),r.kill()}catch{}},exited:i}}async function $e(e){if(p("CONFORM_NO_BROWSER"))return!1;let[t,n]=m.platform==="darwin"?["open",[e]]:m.platform==="win32"?["cmd",["/c","start","",e.replace(/&/g,"^&")]]:["xdg-open",[e]];return(await G(t,n)).success}function Ee(e,t){let n=_.createServer(async(o,r)=>{try{let i=[];if(o.method!=="GET"&&o.method!=="HEAD")for await(let u of o)i.push(u);let s=i.length>0,c=new Headers;for(let[u,d]of Object.entries(o.headers))d!=null&&c.set(u,Array.isArray(d)?d.join(", "):d);let a=`http://${o.headers.host??`${e.hostname}:${e.port}`}${o.url??"/"}`,l=await t(new Request(a,{method:o.method,headers:c,body:s?x.concat(i):void 0}));r.statusCode=l.status,l.headers.forEach((u,d)=>r.setHeader(d,u)),r.end(x.from(await l.arrayBuffer()))}catch(i){r.statusCode=500,r.end(JSON.stringify({ok:!1,code:"internal",message:i instanceof Error?i.message:String(i)}))}});return n.listen(e.port,e.hostname,()=>{let o=n.address();e.onListen?.(typeof o=="object"&&o?o.port:e.port)}),{close:()=>n.close()}}async function Be(e){let t=$("sha256");for await(let n of E(e))t.update(n);return t.digest("hex")}async function He(e,t,n){let o=`${t}.part`;for(let r=0;;r++){let i=0;try{i=(await f(o)).size}catch{}try{let s=await fetch(e,{headers:i?{Range:`bytes=${i}-`}:{}});if(s.status===416)break;if(!s.ok||!s.body)throw new Error(`${e} answered ${s.status}`);i&&s.status!==206&&(i=0);let c=i+Number(s.headers.get("content-length")??0),a=await h(o,i?"a":"w");try{let l=i;for await(let u of s.body)await a.write(u),l+=u.length,n?.(l,c)}finally{await a.close()}break}catch(s){if(r>=4)throw s;await new Promise(c=>setTimeout(c,2e3*(r+1)))}}await R(o,t)}export{b as a,p as b,re as c,ne as d,oe as e,se as f,ie as g,ae as h,ce as i,le as j,g as k,me as l,ue as m,de as n,fe as o,pe as p,ge as q,ye as r,he as s,be as t,we as u,xe as v,ve as w,Pe as x,Re as y,Ae as z,Fe as A,ke as B,Ue as C,De as D,Oe as E,Te as F,Me as G,G as H,Se as I,We as J,$e as K,Ee as L,Be as M,He as N,ze as O,Le as P,Ie as Q,_e as R,je as S,Ge as T};
|
package/dist/chunk-JEMLKBH2.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
function f(a){let s=[...a].sort((e,r)=>e.first_frame-r.first_frame),t=[];for(let e of s){let r=t[t.length-1];r&&e.first_frame<=r.last_frame+1?r.last_frame=Math.max(r.last_frame,e.last_frame):t.push({...e})}return t}export{f as a};
|
package/dist/chunk-RXHNBSER.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
var l=new Set(["png","jpg","jpeg","tif","tiff","psd","tga","bmp","gif","webp","avif","heic","heif","exr","dpx","pict","pct"]);function r(t){let n=t.split(/[/\\]/).pop()??"",e=n.lastIndexOf(".");return e>0?n.slice(e+1).toLowerCase():""}function i(t){return!!t&&l.has(r(t))}function o(t){return t.content_kind==="still"?!0:t.content_kind!=null?!1:i(t.source_filename)||i(t.target_url)}export{r as a,i as b,o as c};
|
package/dist/isobmff-57HSD6O2.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
import{a as k,b as I}from"./chunk-SP5RGDAM.js";import{a as O,b as T}from"./chunk-AACY2V3L.js";import{b as p,c as H}from"./chunk-BUEIRRNY.js";import{a as N}from"./chunk-TK55FA56.js";import{a as C}from"./chunk-JEMLKBH2.js";import{b as J,c as _}from"./chunk-FNGHTZ5F.js";import{A as x,Ca as s,K as F,L as D,W as f,ca as A,h,j as g,k as v,ka as z,m as w,na as E,u as R,v as S,x as y,y as M,z as P}from"./chunk-PIEH7J6J.js";import"./chunk-PSANHDZM.js";function m(e){return(t,n)=>e.read(t,n)}function L(e){let t=e.toLowerCase().trim();return t==="aprn"||t==="aprh"?"prores_raw":t==="apch"||t==="apcn"||t==="apcs"||t==="apco"||t==="ap4h"||t==="ap4x"?"prores":t==="avdn"?"dnxhd":t==="dnxh"?"dnxhr":t==="avc1"||t==="avc3"?"h264":t==="hev1"||t==="hvc1"?"h265":t==="braw"?"braw":e}var b={apco:"Proxy",apcs:"LT",apcn:"422",apch:"HQ",ap4h:"4444",ap4x:"4444 XQ"},X={1:"bt709",2:"unknown",5:"bt470bg",6:"smpte170m",9:"bt2020",11:"smpte431",12:"smpte432"},q={1:"bt709",2:"unknown",6:"smpte170m",8:"linear",13:"iec61966-2-1",14:"bt2020-10",15:"bt2020-12",16:"smpte2084",18:"arib-std-b67"},K={0:"gbr",1:"bt709",2:"unknown",5:"bt470bg",6:"smpte170m",9:"bt2020nc",10:"bt2020c"};function Y(e,t){return e==="ap4h"||e==="ap4x"?t===32?"yuva444p12le":"yuv444p12le":e in b?"yuv422p10le":void 0}var U={66:"Baseline",77:"Main",88:"Extended",100:"High",110:"High 10",122:"High 4:2:2",244:"High 4:4:4"},V={1:"Main",2:"Main 10",3:"Main Still",4:"Rext"},Z={1270:"DNxHR 444",1271:"DNxHR HQX",1272:"DNxHR HQ",1273:"DNxHR SQ",1274:"DNxHR LB"};function ee(e,t){if(b[e.codec_fourcc])return`ProRes ${b[e.codec_fourcc]}`;if(e.vc3_cid)return Z[e.vc3_cid]??`DNxHD ${e.vc3_cid}`;if(e.video_profile!=null){if(t==="h264"&&U[e.video_profile])return`H.264 ${U[e.video_profile]}`;if(t==="h265"&&V[e.video_profile])return`HEVC ${V[e.video_profile]}`}}function re(e,t){let n=e.video_chroma,r=e.video_bit_depth;if(n==null&&t==="h264"&&[66,77,88].includes(e.video_profile??-1)&&([n,r]=[1,8]),n==null&&e.vc3_cid&&(n=e.vc3_cid===1270||e.vc3_cid===1256?3:2),n==null||r==null)return;let o=["gray","yuv420p","yuv422p","yuv444p"][n];return r>8?`${o}${r}le`:o}function $(e,t){let n=[];for(let r of e){if(r.kind!=="clip"||!r.source_range)continue;let o=r.source_range.start.value,i=r.source_range.duration.value,c=Math.max(0,Math.floor(o)-t),a=Math.floor(o+i-1)+t;a>=c&&n.push({first_frame:c,last_frame:a})}return n}var le={async inspect(e){await s();let t=e.parts[0],n=await f(m(t),t.fileSize,e.format),r=JSON.parse(n);if(!r)return null;let o=r.timecode&&r.timecode.fps_denominator>0?r.timecode.fps_numerator/r.timecode.fps_denominator:null,i=L(r.codec_fourcc),c=[{kind:"video",codec:i,width:r.width??void 0,height:r.height??void 0,rate:o??void 0,bit_depth:p(r.codec_fourcc)??p(i)??H(i,r.video_profile)??r.video_bit_depth??void 0,codec_specific:{fourcc:r.codec_fourcc,profile:ee(r,i),pixel_format:Y(r.codec_fourcc,r.video_depth)??re(r,i),colr:r.colr?{primaries:X[r.colr.primaries]??r.colr.primaries,transfer:q[r.colr.transfer]??r.colr.transfer,matrix:K[r.colr.matrix]??r.colr.matrix}:void 0}}];for(let a of r.audio_tracks??(r.audio?[r.audio]:[]))c.push({kind:"audio",codec:a.codec_fourcc,channels:a.channels??void 0,rate:a.sample_rate??void 0,bit_depth:a.bit_depth??void 0,codec_specific:{fourcc:a.codec_fourcc,channel_layout:a.channel_layout??void 0}});return{id:t.filename,kind:"external",target_url:t.filename,available_range:o&&r.duration_seconds?{start:{value:0,rate:o},duration:{value:Math.round(r.duration_seconds*o),rate:o}}:null,reel_name:null,source_timecode:r.timecode?.display??null,container:e.format==="mov"?"mov":e.format,codec:i,size_bytes:t.fileSize,source_fps:o,source_resolution_w:r.width??null,source_resolution_h:r.height??null,streams:c,decode_provenance:r.decode_provenance??null,vendor_metadata:r.timecode?{drop_frame:r.timecode.drop_frame}:{},binding_state:"unbound",raw_extraction:{mov_probe:r},metadata:{}}},async extract(e){await s();let t=e.parts[0],n=JSON.parse(await A(m(t),t.fileSize,e.format));if(n.length===0)return null;let r=JSON.parse(await f(m(t),t.fileSize,e.format)),o=r?L(r.codec_fourcc):e.format,i=r?.timecode&&r.timecode.fps_denominator>0?r.timecode.fps_numerator/r.timecode.fps_denominator:void 0;return{v:1,container:e.format==="mov"?"mov":e.format,codec:o,width:r?.width??void 0,height:r?.height??void 0,fps:i,frame_count:O(n),timecode:r?.timecode?.display??void 0,granularity:T(n),segments:n}},async sparsify(e,t){await s();let n=e.parts[0],r=$(t.items,t.handles),o=await E(m(n),n.fileSize,JSON.stringify(r),e.format),i=JSON.parse(o);return[{filename:n.filename,fileSize:i.fileSize,structuralRanges:i.structuralRanges,essenceRanges:i.essenceRanges,trimInputs:i.trimInputs}]},async trim(e,t){await s();let n=e.parts[0],r=$(t.items,t.handles);if(r.length===0)throw new Error("isobmff trim: no usable trim ranges in items");let o=C(r),i=[];for(let[c,a]of o.entries()){let l=await z(m(n),n.fileSize,a.first_frame,a.last_frame+1,e.format),u=JSON.parse(l);o.length>1&&(u.output_clip_number=c+1,u.output_clip_count=o.length,u.output_part_number=1),i.push(u)}return i},async decode(e,t,n){await s();let r=n.detail==="coarse",o=e.parts[0];if(e.format==="crm"){let u=await w(m(o),o.fileSize,t,r?"preview":"full");return d(u)}let i=await j(e);if(t<0||t>=i.length)throw new _(t,i.length);let c=i[t],a=await o.read(c.offset,c.size);if(e.format==="braw")return d(r?g(a,0):v(a));if(Q(a))return d(r?y(a,0):M(a));if(B(a))return d(r?F(a,0):D(a));if(r)return d(R(a,0));let l=await te(a);return l||d(x(a))},async decode16(e,t){await s();let n=e.parts[0];if(e.format==="crm")throw new Error("crm: no 16-bit decoder");let r=await j(e);if(t<0||t>=r.length)throw new _(t,r.length);let o=r[t],i=await n.read(o.offset,o.size),c=e.format==="braw"?h(i):Q(i)?S(i):B(i)?(()=>{throw new Error("vc3: no 16-bit decoder")})():P(i);return J(c)}};async function te(e){if(!!0)return null;try{let t=await import("./prores-BNALPJPS.js");if(!await t.proresGpuAvailable())return null;let n=await t.decodeProResRgbaGpu(e);return n?{width:n.width,height:n.height,rgba:n.rgba}:null}catch{return null}}function B(e){return e.length>=4&&e[0]===0&&e[1]===0&&e[2]===2&&e[3]===128}function Q(e){return e.length>=8&&e[4]===112&&e[5]===114&&e[6]===114&&e[7]===102}function d(e){let t=new DataView(e.buffer,e.byteOffset,8);return{width:t.getUint32(0,!0),height:t.getUint32(4,!0),rgba:e.slice(8)}}var G=new WeakMap;async function j(e){let t=G.get(e);if(!t){let n=e.parts[0];t=I(k(await N({fileSize:n.fileSize,read:n.read}))),G.set(e,t)}return t}export{le as isobmffFormat};
|
package/dist/mxf-FAXEK4WR.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
import{a as $}from"./chunk-AACY2V3L.js";import{a as J}from"./chunk-JEMLKBH2.js";import{b as j}from"./chunk-FNGHTZ5F.js";import{$ as L,Ca as l,J as P,O as z,Z as D,_ as E,a as k,aa as C,ba as O,c as I,da as V,e as M,la as W,oa as G,qa as N,t as T}from"./chunk-PIEH7J6J.js";import"./chunk-PSANHDZM.js";var F=new Uint8Array([6,14,43,52,2,5,1,1,13,1,2,1,1,17,1,0]);function oe(t){e:for(let r=t.length-F.length;r>=0;r--){for(let e=0;e<F.length;e++)if(t[r+e]!==F[e])continue e;return r}return-1}function Z(t,r){if(r>=t.byteLength)return[null,0];let e=t.getUint8(r);if(e<128)return[e,1];let n=e&127;if(n===0||n>8||r+1+n>t.byteLength)return[null,1];let a=0;for(let i=0;i<n;i++)a=a*256+t.getUint8(r+1+i);return[a,1+n]}function w(t,r){let e=t.getUint32(r,!1),n=t.getUint32(r+4,!1);return e*4294967296+n}async function H(t){let r=t.fileSize,e=[];if(r<1024)return e;let a=Math.max(0,r-65536),i=r-a,o=await t.read(a,i);e.push({offset:a,length:i});let s=oe(o);if(s<0)return e;let c=new DataView(o.buffer,o.byteOffset,o.byteLength),[f,d]=Z(c,s+16);if(f===null||f<16||f>65536)return e;let A=s+16+d;if(A+f>o.length)return e;let R=[],te=new DataView(o.buffer,o.byteOffset+A,f),y=Math.floor((f-4)/12);if(y<1||y>4096)return e;for(let u=0;u<y;u++){let p=w(te,u*12+4);p>=0&&p<r&&R.push(p)}for(let u of R){let p=Math.min(256,r-u),b=await t.read(u,p);if(b.length<80)continue;let _=new DataView(b.buffer,b.byteOffset,b.byteLength),[v,U]=Z(_,16);if(v===null)continue;let m=16+U,x,S;if(b.length<m+64){let ie=Math.min(m+64,r-u),g=await t.read(u,ie);if(g.length<m+64)continue;let B=new DataView(g.buffer,g.byteOffset,g.byteLength);x=w(B,m+32),S=w(B,m+40)}else x=w(_,m+32),S=w(_,m+40);let ne=u+16+U+v+x+S,ae=Math.min(ne+65536,r)-u;e.push({offset:u,length:ae})}return e}function q(t,r){let e=[];for(let n of t){if(n.kind!=="clip"||!n.source_range)continue;let a=n.source_range.start.value,i=n.source_range.duration.value,o=Math.max(0,Math.floor(a)-r),s=Math.floor(a+i-1)+r;s>=o&&e.push({first_frame:o,last_frame:s})}return e}function se(t,r){let e=[...t].sort((i,o)=>i.offset-o.offset),n=[],a=0;for(let i of e)i.offset>a&&n.push({offset:a,length:i.offset-a}),a=Math.max(a,i.offset+i.length);return a<r&&n.push({offset:a,length:r-a}),n}async function K(t,r,e){let n=q(r,e);if(n.length===0)throw new Error("planMxfTrimsFromItems: no usable trim ranges in items");await l();let a=(s,c)=>t.read(s,c),i=J(n),o=[];for(let[s,c]of i.entries()){let f=await W(a,t.fileSize,c.first_frame,c.last_frame+1),d=JSON.parse(f);i.length>1&&(d.output_clip_number=s+1,d.output_clip_count=i.length,d.output_part_number=1),o.push(d)}return o}async function Q(t,r,e){await l();let n=q(r,e),i=await G((s,c)=>t.read(s,c),t.fileSize,JSON.stringify(n));if(i!=="null")return JSON.parse(i);console.warn(`[mxf] no parseable index \u2014 shipping the WHOLE file (${t.fileSize} bytes). The cut's ${n.length} range(s) cannot be addressed; nothing is trimmed.`);let o=(await H(t)).map(s=>({offset:s.offset,length:s.length}));return{fileSize:t.fileSize,structuralRanges:o,essenceRanges:se(o,t.fileSize),trimInputs:n,wholeFileFallback:!0}}async function X(t){await l();let e=await N((n,a)=>t.read(n,a),t.fileSize);return JSON.parse(e)}function h(t){return(r,e)=>t.read(r,e)}var Me={async inspect(t){let r=t.parts[0],e=await X(r);if(!e)return null;let n=e.timecode??null,a=n&&n.fps_denominator>0?n.fps_numerator/n.fps_denominator:null,i=e.width??null,o=e.height??null;return{id:r.filename,kind:"external",target_url:r.filename,available_range:a&&e.frame_count?{start:{value:0,rate:a},duration:{value:e.frame_count,rate:a}}:null,reel_name:null,source_timecode:n?.display??null,source_fps:a,source_resolution_w:i,source_resolution_h:o,container:"mxf",codec:null,size_bytes:r.fileSize,streams:[...i||o||a?[{kind:"video",codec:null,width:i??void 0,height:o??void 0,rate:a??void 0,codec_specific:null}]:[],...e.audio?[{kind:"audio",codec:e.audio.codec_fourcc,channels:e.audio.channels??void 0,rate:e.audio.sample_rate??void 0,bit_depth:e.audio.bit_depth??void 0,codec_specific:{fourcc:e.audio.codec_fourcc}}]:[]],decode_provenance:e.decode_provenance??null,vendor_metadata:{frame_count:e.frame_count,...n?{drop_frame:n.drop_frame}:{},...e.inner_codec?{inner_codec:e.inner_codec}:{},...e.truncated?{truncated:!0}:{}},binding_state:"unbound",raw_extraction:{mxf_probe:e},metadata:{}}},async extract(t){await l();let r=t.parts[0],e=JSON.parse(await V(h(r),r.fileSize));return e.length===0?null:{v:1,container:"mxf",codec:"mxf",frame_count:$(e),granularity:"frame",segments:e}},async sparsify(t,r){let e=t.parts[0],n=await Q(e,r.items,r.handles);return[{filename:e.filename,fileSize:n.fileSize,structuralRanges:n.structuralRanges,essenceRanges:n.essenceRanges,trimInputs:n.trimInputs,wholeFileFallback:n.wholeFileFallback}]},async trim(t,r){let e=t.parts[0];return K(e,r.items,r.handles)},async decode(t,r,e){await l();let n=t.parts[0],a=h(n),i=await re(t),o=e.detail==="coarse",s;if(i==="arriraw")s=await M(a,n.fileSize,r,o?"preview:4":"full");else if(i==="arriraw-alev3")s=await I(a,n.fileSize,r,o?"preview:4":"full");else if(i==="dnxhr")s=await P(a,n.fileSize,r,o?"preview":"full");else if(i==="xocn")s=await z(a,n.fileSize,r,o?"preview":"full");else if(i==="prores")s=await T(a,n.fileSize,r,o?"preview":"full");else throw new Error(`mxf decode: no decoder for inner codec '${i}'`);let c=new DataView(s.buffer,s.byteOffset,8);return{width:c.getUint32(0,!0),height:c.getUint32(4,!0),rgba:s.slice(8)}},async decode16(t,r){await l();let e=t.parts[0],n=h(e),a=await re(t),i;try{if(a==="arriraw"){let o=await ue(t,r);if(o)return o;i=await M(n,e.fileSize,r,"rgb16")}else if(a==="dnxhr")i=await P(n,e.fileSize,r,"rgb16");else if(a==="xocn")i=await z(n,e.fileSize,r,"rgb16");else throw new Error(`mxf decode16: no decoder for inner codec '${a}'`)}catch(o){throw fe(o,a)}return j(i)}};function fe(t,r){let e=typeof t=="string"?t:t instanceof Error?t.message:"";return/has no 16-bit decoder|no rgb16 tier/.test(e)?new Error(`mxf ${r}: has no 16-bit decoder \u2014 ${e}`):t}var Y=new WeakMap;async function ue(t,r){if(!!0)return null;try{let e=await import("./arriraw-BEZILZY3.js");if(!await e.arrirawGpuAvailable())return null;let{parseArrirawGpuPayload:n,arrirawFrameToRgb16:a}=await import("./clip-state-B6JOX3JE.js"),i=t.parts[0],o=Y.get(t)??null,s=await k(h(i),i.fileSize,r,o?.key),c=n(s,o);if(!c)return null;Y.set(t,{key:c.key,state:c.state});let f=await e.decodeArrirawFrameGpu(c.essence,c.state);return f?{width:f.width,height:f.height,rgb16:a(f)}:null}catch{return null}}var ee=new WeakMap;async function re(t){let r=ee.get(t);if(r)return r;await l();let e=t.parts[0],n=h(e),a="mxf";return await E(n,e.fileSize)?a="arriraw":await D(n,e.fileSize)?a="arriraw-alev3":await C(n,e.fileSize)?a="dnxhr":await O(n,e.fileSize)?a="xocn":await L(n,e.fileSize)&&(a="prores"),ee.set(t,a),a}export{Me as mxfFormat};
|
package/dist/still-WY7MUR7A.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
import{a as _}from"./chunk-RXHNBSER.js";import{a as M}from"./chunk-UCMNH6Q6.js";import"./chunk-PSANHDZM.js";function v(n){return{size:n.fileSize,read:(t,e)=>n.read(t,e)}}var U=class{constructor(t){this.r=t;this.buf=new Uint8Array(0);this.base=0}async at(t,e){if(t<0||e<=0)return new Uint8Array(0);let r=t-this.base;return r>=0&&r+e<=this.buf.length?this.buf.subarray(r,r+e):(this.buf=await this.r.read(t,Math.max(e,65536)),this.base=t,this.buf.subarray(0,Math.min(e,this.buf.length)))}},A=(n,t)=>n[t]<<8|n[t+1],w=(n,t)=>n[t]|n[t+1]<<8,W=(n,t)=>n[t]|n[t+1]<<8|n[t+2]<<16,d=(n,t)=>(n[t]<<24|n[t+1]<<16|n[t+2]<<8|n[t+3])>>>0,b=(n,t)=>(n[t]|n[t+1]<<8|n[t+2]<<16|n[t+3]<<24)>>>0,P=(n,t)=>n[t]|n[t+1]<<8|n[t+2]<<16|n[t+3]<<24,p=(n,t,e)=>String.fromCharCode(...n.subarray(t,t+e));function h(n,t){if(!Number.isFinite(n)||!Number.isFinite(t))return null;let e=Math.round(n),r=Math.round(t);return e<1||r<1||e>1e6||r>1e6?null:{width:e,height:r}}var k=n=>({width:n.height,height:n.width});async function C(n){let t=await n.at(0,24);return t.length<24||t[0]!==137||p(t,1,3)!=="PNG"||p(t,12,4)!=="IHDR"?null:h(d(t,16),d(t,20))}var D=new Set([192,193,194,195,197,198,199,201,202,203,205,206,207]);function I(n){if(n.length<8)return null;let t=n[0]===73&&n[1]===73,e=n[0]===77&&n[1]===77;if(!t&&!e)return null;let r=a=>t?w(n,a):A(n,a),i=a=>t?b(n,a):d(n,a);if(r(2)!==42)return null;let l=i(4);if(l+2>n.length)return null;let c=r(l);for(let a=0;a<c;a++){let u=l+2+a*12;if(u+12>n.length)break;if(r(u)===274)return r(u+8)}return null}async function F(n,t){let e=await n.at(0,2);if(e.length<2||e[0]!==255||e[1]!==216)return null;let r=1,i=null,l=2;for(;l+4<=t;){let c=await n.at(l,4);if(c.length<4)break;if(c[0]!==255){l++;continue}let a=c[1];if(a===255){l++;continue}if(a===1||a>=208&&a<=217){l+=2;continue}if(a===218)break;let u=A(c,2);if(u<2)break;if(D.has(a)){let o=await n.at(l+4,5);o.length>=5&&(i=h(A(o,3),A(o,1)));break}if(a===225){let o=await n.at(l+4,Math.min(u-2,65536));o.length>6&&p(o,0,4)==="Exif"&&(r=I(o.subarray(6))??1)}l+=2+u}return i?r>=5&&r<=8?k(i):i:null}async function j(n){let t=await n.at(0,10);return t.length<10||p(t,0,3)!=="GIF"?null:h(w(t,6),w(t,8))}async function L(n){let t=await n.at(0,26);return t.length<22||p(t,0,2)!=="BM"?null:b(t,14)===12?h(w(t,18),w(t,20)):t.length<26?null:h(P(t,18),Math.abs(P(t,22)))}async function H(n){let t=await n.at(0,30);if(t.length<16||p(t,0,4)!=="RIFF"||p(t,8,4)!=="WEBP")return null;let e=p(t,12,4);if(e==="VP8X")return t.length<30?null:h(W(t,24)+1,W(t,27)+1);if(e==="VP8 ")return t.length<30||t[23]!==157||t[24]!==1||t[25]!==42?null:h(w(t,26)&16383,w(t,28)&16383);if(e==="VP8L"){if(t.length<25||t[20]!==47)return null;let r=b(t,21);return h((r&16383)+1,(r>>>14&16383)+1)}return null}async function S(n,t){let e=[],r=0;async function i(a,u,o){let f=a;for(;f+8<=u&&o<8;){let g=await n.at(f,16);if(g.length<8)return;let s=d(g,0),m=p(g,4,4),y=8;if(s===1){if(g.length<16)return;s=d(g,8)*2**32+d(g,12),y=16}else s===0&&(s=u-f);if(s<y||f+s>u)return;if(m==="meta")await i(f+y+4,f+s,o+1);else if(m==="iprp"||m==="ipco")await i(f+y,f+s,o+1);else if(m==="ispe"){let x=await n.at(f+y+4,8);if(x.length===8){let R=h(d(x,0),d(x,4));R&&e.push(R)}}else if(m==="irot"){let x=await n.at(f+y,1);x.length===1&&(r=x[0]&3)}f+=s}}let l=await n.at(0,12);if(l.length<12||p(l,4,4)!=="ftyp"||(await i(0,t,0),e.length===0))return null;let c=e.reduce((a,u)=>a.width*a.height>=u.width*u.height?a:u);return r===1||r===3?k(c):c}async function G(n){let t=await n.at(0,22);return t.length<22||p(t,0,4)!=="8BPS"?null:h(d(t,18),d(t,14))}var N=new Set([0,1,2,3,9,10,11]);async function T(n){let t=await n.at(0,18);if(t.length<18||t[1]>1||!N.has(t[2]))return null;let e=t[16];return[8,15,16,24,32].includes(e)?h(w(t,12),w(t,14)):null}async function B(n){let t=await n.at(0,8);if(t.length<8)return null;let e=t[0]===73&&t[1]===73,r=t[0]===77&&t[1]===77;if(!e&&!r)return null;let i=(s,m)=>e?w(s,m):A(s,m),l=(s,m)=>e?b(s,m):d(s,m);if(i(t,2)!==42)return null;let c=l(t,4),a=await n.at(c,2);if(a.length<2)return null;let u=i(a,0);if(u<1||u>4096)return null;let o=await n.at(c+2,u*12),f=0,g=0;for(let s=0;s<u;s++){let m=s*12;if(m+12>o.length)break;let y=i(o,m),R=i(o,m+2)===3?i(o,m+8):l(o,m+8);y===256?f=R:y===257&&(g=R)}return h(f,g)}async function V(n,t){let e=await n.at(0,8);if(e.length<8||e[0]!==118||e[1]!==47||e[2]!==49||e[3]!==1)return null;let r=8,i=Math.min(t,1<<20);for(;r<i;){let l=await n.at(r,512);if(l.length===0)return null;let c=l.indexOf(0);if(c<=0)return null;let a=p(l,0,c),u=l.subarray(c+1).indexOf(0);if(u<0)return null;let o=c+1+u+1;if(o+4>l.length)return null;let f=b(l,o),g=r+o+4;if(a==="dataWindow"){if(f<16)return null;let s=await n.at(g,16);return s.length<16?null:h(P(s,8)-P(s,0)+1,P(s,12)-P(s,4)+1)}r=g+f}return null}async function X(n){let t=await n.at(0,4);if(t.length<4)return null;let e=p(t,0,4),r=e==="SDPX";if(!r&&e!=="XPDS")return null;let i=await n.at(772,8);return i.length<8?null:h(r?d(i,0):b(i,0),r?d(i,4):b(i,4))}var Y={png:C,jpg:F,jpeg:F,gif:j,bmp:L,webp:H,avif:S,heic:S,heif:S,psd:G,tga:T,tif:B,tiff:B,exr:V,dpx:X};async function z(n,t){let e=Y[(n??"").toLowerCase()];if(!e)return null;try{return await e(new U(t),t.size)}catch{return null}}var q=n=>{let t=n.split(/[/\\]/).pop()??"",e=t.lastIndexOf(".");return e>0?t.slice(e+1).toLowerCase():""};async function J(n,t){try{if(n==="dpx"){let e=await(await import("./dpx-wasm-XBKO4V4W.js")).inspectDpxWasm(t);return e?{width:e.width,height:e.height}:null}if(n==="exr"){let e=await(await import("./exr-wasm-VE2W6MFW.js")).inspectExrWasm(t);return e?{width:e.width,height:e.height}:null}if(n==="dng"){let e=await(await import("./dng-wasm-WUUQB7M2.js")).inspectDngWasm(t);return e?{width:e.width,height:e.height}:null}if(n==="cr3"){let e=await(await import("./cr3-wasm-YTMVBAFM.js")).inspectCr3Wasm(t);return e?{width:e.width,height:e.height}:null}if(n==="tif"||n==="tiff"){let e=await(await import("./tiff-wasm-T2V2ICZT.js")).inspectTiffWasm(t);return e?{width:e.width,height:e.height}:null}}catch{}return null}async function K(n){if(typeof createImageBitmap!="function"||typeof Blob>"u")return null;try{let t=await createImageBitmap(new Blob([n])),e={width:t.width,height:t.height};return t.close?.(),e.width>0&&e.height>0?e:null}catch{return null}}async function O(n){let t=q(n.filename),e=await z(t,v(n));if(e)return e;let r=M(t);if(r===null||r==="none")return null;let i;try{i=await n.read(0,n.fileSize)}catch{return null}return r==="wasm-decoder"?await J(t,i):await K(i)}function E(n){let t=_(n);return t==="jpg"?"jpeg":t==="tif"?"tiff":t||"still"}var rt={async inspect(n){let t=n.parts[0],e=await O(t);return{id:t.filename,kind:"external",content_kind:"still",target_url:t.filename,available_range:null,reel_name:null,source_timecode:null,container:_(t.filename)||"still",codec:E(t.filename),size_bytes:t.fileSize,bitrate_bps:null,source_resolution_w:e?.width??null,source_resolution_h:e?.height??null,source_pixel_aspect:e?1:null,streams:[],vendor_metadata:{},binding_state:"unbound",raw_extraction:{},metadata:{}}},async extract(n){let t=n.parts.map((e,r)=>({kind:"frame",part:r,offset:0,length:e.fileSize,frame_in:r,frame_out:r}));return t.length===0?null:{v:1,container:_(n.parts[0].filename)||"still",codec:E(n.parts[0].filename),frame_count:t.length,granularity:"frame",segments:t,...n.parts.length>1?{part_names:n.parts.map(e=>e.filename)}:{}}},async sparsify(){throw new Error("stillFormat.sparsify: stills ship whole \u2014 no sparse plan exists")},async trim(){throw new Error("stillFormat.trim: stills ship whole \u2014 no trim plan exists")}};export{rt as stillFormat};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|