conformtools 0.6.5 → 0.6.6
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 +3 -3
- package/dist/account-HDXVTS5T.js +3 -0
- package/dist/arriraw-YIJ3BYNN.js +525 -0
- package/dist/avid-panel/MANIFEST.json +11 -0
- package/dist/avid-panel/avid-manifest.json +46 -0
- package/dist/avid-panel/icon.svg +4 -0
- package/dist/avid-panel/icons/conformtools.svg +4 -0
- package/dist/avid-panel/index.html +26 -0
- package/dist/avid-panel/panel.css +12 -0
- package/dist/avid-panel/panel.js +7 -0
- package/dist/bridge-D5KPIUSY.js +3 -0
- package/dist/browser/timeline_core_bg.wasm +0 -0
- package/dist/chunk-3OCQA33E.js +3 -0
- package/dist/chunk-3XD6NC4G.js +10 -0
- package/dist/chunk-5JBUCVRI.js +20 -0
- package/dist/chunk-5RSNFPED.js +8 -0
- package/dist/chunk-5SUGU2YR.js +3 -0
- package/dist/chunk-6ML26TIK.js +3 -0
- package/dist/chunk-7D7H6VFW.js +3 -0
- package/dist/chunk-7MC7M2Y5.js +3 -0
- package/dist/chunk-AACY2V3L.js +3 -0
- package/dist/chunk-AS7IXHYM.js +19 -0
- package/dist/chunk-BL6L5ZBP.js +39 -0
- package/dist/chunk-C2ESM27Z.js +3 -0
- package/dist/chunk-C5IX63YF.js +3 -0
- package/dist/chunk-D6YDLKSA.js +3 -0
- package/dist/chunk-DKGGJM6Z.js +3 -0
- package/dist/chunk-EJGVNQ3E.js +8 -0
- package/dist/chunk-HGDO3OED.js +3 -0
- package/dist/chunk-JV7TZDKJ.js +3 -0
- package/dist/chunk-LFJLRLEP.js +3 -0
- package/dist/chunk-NFJHWZJX.js +3 -0
- package/dist/chunk-NQHQKEP5.js +3 -0
- package/dist/chunk-NU3X7P4N.js +3 -0
- package/dist/chunk-OJWIBQK4.js +376 -0
- package/dist/chunk-OVUCL3YY.js +5 -0
- package/dist/chunk-P7OVDUA5.js +3 -0
- package/dist/chunk-PFISREY4.js +3 -0
- package/dist/chunk-PFZVET7S.js +3 -0
- package/dist/chunk-PLRB2YXJ.js +3 -0
- package/dist/chunk-PSANHDZM.js +3 -0
- package/dist/chunk-RFIPLBQ4.js +5 -0
- package/dist/chunk-SZD4C5MB.js +6 -0
- package/dist/chunk-TK55FA56.js +3 -0
- package/dist/chunk-TXQR2HI2.js +4 -0
- package/dist/chunk-UCMNH6Q6.js +3 -0
- package/dist/chunk-UKKRZ574.js +7 -0
- package/dist/chunk-VS3MKKJ5.js +3 -0
- package/dist/chunk-X53BNWNV.js +3 -0
- package/dist/chunk-XNR7M4VX.js +3 -0
- package/dist/claude-setup-IIWUB4CE.js +5 -0
- package/dist/cli.js +17 -0
- package/dist/clip-state-B6JOX3JE.js +3 -0
- package/dist/conformtools-analyze +0 -0
- package/dist/conformtools-decode +0 -0
- package/dist/cr3-wasm-L2LFY3LM.js +3 -0
- package/dist/dng-wasm-U6NC3MDK.js +3 -0
- package/dist/dpx-wasm-RMKEUKED.js +3 -0
- package/dist/engine-P6H5P6HP.js +5 -0
- package/dist/esm-SFFBP7PS.js +3 -0
- package/dist/exr-wasm-LBAOMOZD.js +3 -0
- package/dist/flame/hook/conformtools_flame/__init__.py +10 -0
- package/dist/flame/hook/conformtools_flame/building.py +191 -0
- package/dist/flame/hook/conformtools_flame/hook.py +177 -0
- package/dist/flame/hook/conformtools_flame/render.py +622 -0
- package/dist/flame/hook/conformtools_flame/util.py +33 -0
- package/dist/flame/hook/conformtools_flame/verbs.py +1037 -0
- package/dist/flame/hook/conformtools_flame_hook.py +42 -0
- package/dist/fonts/gfx/BarlowCondensed-Bold.ttf +0 -0
- package/dist/fonts/gfx/BarlowCondensed-Regular.ttf +0 -0
- package/dist/fonts/gfx/InstrumentSerif-Regular.ttf +0 -0
- package/dist/fonts/gfx/Inter-Bold.ttf +0 -0
- package/dist/fonts/gfx/Inter-Regular.ttf +0 -0
- package/dist/fonts/gfx/JetBrainsMono-Bold.ttf +0 -0
- package/dist/fonts/gfx/JetBrainsMono-Regular.ttf +0 -0
- package/dist/fonts/gfx/OFL.txt +100 -0
- package/dist/framing-SRCJKAYO.js +3 -0
- package/dist/gfx-worker.js +3 -0
- package/dist/h264-3ESGVT6G.js +3 -0
- package/dist/h264-mxf-NPFS7NGH.js +3 -0
- package/dist/host-relink-D6CB2VOQ.js +10 -0
- package/dist/hosts-W4AD2MYH.js +3 -0
- package/dist/http.js +5 -0
- package/dist/i2o-transfer +0 -0
- package/dist/inspect-7ASUPU73.js +68 -0
- package/dist/isobmff-SIOE67WL.js +3 -0
- package/dist/mcp.js +13 -0
- package/dist/media-7AUNRKHF.js +3 -0
- package/dist/media_core-Q2PIEV7D.js +9 -0
- package/dist/media_core_bg-FDL7GJZP.js +3 -0
- package/dist/media_core_bg-XRBVKQZH.js +3 -0
- package/dist/mxf-74TTDICM.js +3 -0
- package/dist/nuke/panel/python/Startup/conformtools_nuke_startup.py +44 -0
- package/dist/nuke/panel/python/conformtools_nuke/__init__.py +10 -0
- package/dist/nuke/panel/python/conformtools_nuke/panel.py +217 -0
- package/dist/nuke/panel/python/conformtools_nuke/verbs.py +837 -0
- package/dist/ops-FSOOBXMV.js +3 -0
- package/dist/peer-kit/ctpeer/__init__.py +21 -0
- package/dist/peer-kit/ctpeer/client.py +247 -0
- package/dist/peer-kit/ctpeer/neutral.py +178 -0
- package/dist/peer-kit/ctpeer/pairing.py +139 -0
- package/dist/peer-kit/ctpeer/protocol.py +209 -0
- package/dist/peer-kit/ctpeer/websocket.py +289 -0
- package/dist/premiere-uxp/icons/panel.png +0 -0
- package/dist/premiere-uxp/icons/panel@2x.png +0 -0
- package/dist/premiere-uxp/icons/plugin.png +0 -0
- package/dist/premiere-uxp/icons/plugin@2x.png +0 -0
- package/dist/premiere-uxp/index.html +38 -0
- package/dist/premiere-uxp/index.js +93 -0
- package/dist/premiere-uxp/lib/clipmeta.js +170 -0
- package/dist/premiere-uxp/lib/ctx.js +68 -0
- package/dist/premiere-uxp/lib/edit.js +516 -0
- package/dist/premiere-uxp/lib/handles.js +57 -0
- package/dist/premiere-uxp/lib/markers.js +198 -0
- package/dist/premiere-uxp/lib/pairing.js +67 -0
- package/dist/premiere-uxp/lib/premiere.js +91 -0
- package/dist/premiere-uxp/lib/probe.js +241 -0
- package/dist/premiere-uxp/lib/protocol.js +165 -0
- package/dist/premiere-uxp/lib/render.js +45 -0
- package/dist/premiere-uxp/lib/session.js +85 -0
- package/dist/premiere-uxp/lib/sizing.js +325 -0
- package/dist/premiere-uxp/lib/time.js +88 -0
- package/dist/premiere-uxp/lib/timeline.js +336 -0
- package/dist/premiere-uxp/lib/verbs.js +21 -0
- package/dist/premiere-uxp/lib/write.js +97 -0
- package/dist/premiere-uxp/manifest.json +102 -0
- package/dist/probe-F7WQHMIA.js +3 -0
- package/dist/prores-RIG37OIH.js +526 -0
- package/dist/r3d-YTLOMC7C.js +3 -0
- package/dist/r3d-ZDJ3WURS.js +1025 -0
- package/dist/resolve-bridge.py +2286 -0
- package/dist/resolve-presets/conform.tools.xml +127 -0
- package/dist/source-BDJAUQVR.js +3 -0
- package/dist/statusline-GMMCFMOA.js +4 -0
- package/dist/statusline.js +3 -0
- package/dist/still-ZG2RUQAL.js +3 -0
- package/dist/store-ZHXLQCGN.js +3 -0
- package/dist/tiff-wasm-D2FJ3L56.js +3 -0
- package/dist/timeline-6DYFDVEH.js +3 -0
- package/dist/timeline_core-IOENXK4Z.js +3 -0
- package/dist/timeline_core_bg-JW42YM3G.js +3 -0
- package/dist/udf_bg-B37GKRIH.js +3 -0
- package/dist/wasm/media_core_bg.wasm +0 -0
- package/dist/wasm/udf_bg.wasm +0 -0
- package/dist/wasm-threads/media_core_bg.wasm +0 -0
- package/dist/wav-OWMUGQMM.js +3 -0
- package/package.json +6 -4
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
+
import{g as a,h as b,i as c,j as d,k as e,l as f,m as g,n as h,o as i}from"./chunk-5JBUCVRI.js";import"./chunk-PLRB2YXJ.js";import"./chunk-PSANHDZM.js";export{c as BridgeError,g as HostBridge,e as PANEL_PREFIX,b as PORTS,a as PROTOCOL,h as hostBridge,d as pairingPath,f as panelOrigins,i as resetHostBridge};
|
|
Binary file
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
+
var n=class extends Error{constructor(o,r,s){super(r);this.code=o;this.data=s;this.name="ConformError"}};function i(e,t){return{content:[{type:"text",text:e}],...t?{structuredContent:{ok:!0,...t}}:{}}}var a=e=>i(e);function c(e){let t=e instanceof n?e:u(e);return{content:[{type:"text",text:`error [${t.code}]: ${t.message}`}],structuredContent:{ok:!1,code:t.code,message:t.message,...t.data?{data:t.data}:{}},isError:!0}}function u(e){let t=e instanceof Error?e.message:String(e);return/unknown session_id|not found on this machine|No such file|NotFound/i.test(t)?new n("not_found",t):/unsupported|not supported|no local decoder|cannot detect/i.test(t)?new n("unsupported",t):/before the file start|past the last frame|is before|required|unknown (operation|target|verb)/i.test(t)?new n("invalid_args",t):/could not read|failed to parse|engine read failed/i.test(t)?new n("unreadable",t):/refused|coverage|never shipped/i.test(t)?new n("refused",t):/abort|cancel/i.test(t)?new n("cancelled",t):new n("engine",t)}function d(e,t){let[o,...r]=t.content,s=`[conformtools ${e}]`;return{...t,content:o?[{...o,text:`${s} ${o.text}`},...r]:[{type:"text",text:s}]}}function l(e){let{images:t,...o}=e;return t?.length?{...o,content:[...e.content,...t.map(r=>({type:"image",...r}))]}:o}export{n as a,i as b,a as c,c as d,d as e,l as f};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
+
import{a as M}from"./chunk-PFZVET7S.js";import{b as fe,c as pe,f as he}from"./chunk-P7OVDUA5.js";import{f as K,h as me}from"./chunk-7MC7M2Y5.js";import{a as de}from"./chunk-VS3MKKJ5.js";import{i as D}from"./chunk-XNR7M4VX.js";import{b as C,d as J,f as R}from"./chunk-NU3X7P4N.js";import{Ga as ue,da as oe,ea as ie,ia as se,na as ae,va as ce,wa as le}from"./chunk-C5IX63YF.js";import{a as ne}from"./chunk-3OCQA33E.js";import{C as W,I as v,J as A,K as re,N as te,V as b,W as y,X as L,Y as _,b as E,c as Z,d as Q,g as q,p as I,q as B,s as ee,t as O,w as H,y as j}from"./chunk-PLRB2YXJ.js";var V=!1;var F=8,Me=0,Fe=3,z=2;async function Pe(e){let t=new Uint8Array(await e.slice(0,16).arrayBuffer()),o=s=>String.fromCharCode(t[s],t[s+1],t[s+2],t[s+3]);if(t[0]===6&&t[1]===14&&t[2]===43&&t[3]===52)return"mxf";if(o(4)==="RED1"||o(4)==="RED2")return"r3d";let r=t[0]<<24|t[1]<<16|t[2]<<8|t[3],i=o(4);return/^[A-Za-z0-9 ]{4}$/.test(i)&&(r>=8||r===1)&&r<=e.size?"isobmff":null}function Ee(e){let t=e.toLowerCase();return t.endsWith(".braw")?"braw":t.endsWith(".crm")?"crm":"mov"}function Oe(e){return async(t,o)=>new Uint8Array(await e.slice(t,Math.min(t+o,e.size)).arrayBuffer())}function be(e){let t=e.timecode;return!t||!t.fps_denominator?null:t.fps_numerator/t.fps_denominator}async function nr(e){return await ue(),ge?ge.clip(e,V?"rec709":"",()=>we(e)):we(e)}var ge=null;async function we(e){let t=await Pe(e),o=[];if(t==="r3d"){let r=e,i=r.parts&&r.bases?r.parts:[{name:e.name,size:e.size}],n=r.bases??[0],s=async(u,m,d)=>{let f=n[u]+m;return new Uint8Array(await e.slice(f,Math.min(f+d,n[u]+i[u].size)).arrayBuffer())},a=JSON.stringify(i.map(u=>({name:u.name,size:u.size}))),c=JSON.parse(await le(s,a)),l=JSON.parse(await se(s,a));return i.length===1&&/_\d{3}\.r3d$/i.test(e.name)&&!/_001\.r3d$/i.test(e.name)&&o.push("spanned R3D part \u2014 only this part's frames are indexed"),{frames:l.map(u=>({offset:n[u.part??0]+u.essenceOffset,size:u.essenceLength})),w:c.width??0,h:c.height??0,fps:be(c),startFrame:c.timecode?.start_frame??0,dropFrame:c.timecode?.drop_frame??!1,label:"R3D",spec:{codec:"r3d",subbands:Me},geometrySpec:{codec:"r3d",subbands:Fe},index:null,warnings:o}}if(t==="mxf"){let r=Oe(e),i=JSON.parse(await ce(r,e.size));if(!i)throw new Error(`${e.name}: MXF index unreadable`);let n=JSON.parse(await ae(r,e.size)),s=[];for(let f=0;f<n.frame_count;f++)s.push({offset:n.frames[f*2],size:n.frames[f*2+1]});let a=s.filter(f=>f.size===0).length;a&&o.push(`${a} frame(s) had no locatable picture KLV`);let c=i.width??0,l=i.height??0,u=(i.inner_codec??"").toLowerCase(),m=null,d="MXF";return u==="arriraw"?(m={codec:"arriraw",w:c,h:l,scale:F},d="ARRIRAW"):u==="xocn"?(m={codec:"xocn",scale:F,...V?{display:"rec709"}:{}},d="X-OCN"):await ie(r,e.size)?(m={codec:"vc3",scale:F},d="DNxHR"):await oe(r,e.size)?(m={codec:"prores"},d="ProRes"):o.push(`MXF inner codec ${u||"unknown"} not wired to the fingerprint pool`),{frames:m?s:[],w:c,h:l,fps:be(i),startFrame:i.timecode?.start_frame??0,dropFrame:i.timecode?.drop_frame??!1,label:d,spec:m,geometrySpec:m&&m.codec==="arriraw"?{...m,scale:z}:m&&m.codec==="xocn"?{codec:"xocn",scale:z,...V?{display:"rec709"}:{}}:m&&m.codec==="vc3"?{codec:"vc3",scale:z}:null,index:null,warnings:o}}if(t==="isobmff"){let r=await me(e),i=Ee(e.name);if(r.kind==="prores")return{frames:r.offs,w:r.w,h:r.h,fps:r.fps,startFrame:r.startFrame,dropFrame:r.dropFrame,label:K(r.kind),spec:{codec:"prores"},geometrySpec:null,index:r,warnings:o};if(r.kind==="h264"||r.kind==="hevc")return{frames:r.offs,w:r.w,h:r.h,fps:r.fps,startFrame:r.startFrame,dropFrame:r.dropFrame,label:K(r.kind),spec:null,geometrySpec:null,index:r,warnings:o};let n=i==="braw"?{codec:"braw",scale:F}:r.codec==="aprh"||r.codec==="aprn"?{codec:"proresraw",scale:F}:null;return n||o.push(`codec ${r.codec} not wired to the fingerprint pool`),{frames:n?r.offs:[],w:r.w,h:r.h,fps:r.fps,startFrame:r.startFrame,dropFrame:r.dropFrame,label:n?i==="braw"?"BRAW":"ProRes RAW":`unsupported (${r.codec})`,spec:n,geometrySpec:n?{...n,scale:z}:null,index:r,warnings:o}}throw new Error(`${e.name}: unrecognised container`)}var Ae=Number(E("CONFORM_DECODERS")??0)||Math.max(2,Math.min(Math.floor(Q()/2),Math.floor(Z()/2**31))),X=0,_e=[],Ce=async(...e)=>{X>=Ae?await new Promise(t=>_e.push(t)):X++;try{return await te(...e)}finally{let t=_e.shift();t?t():X--}};async function De(){let e=q()==="win32"?"conformtools-decode.exe":"conformtools-decode",t=[E("CONFORM_NATIVE_DECODE"),I(new URL(`./${e}`,import.meta.url)),I(new URL(`../../rust/target/release/${e}`,import.meta.url))].filter(Boolean);for(let o of t)if(await ee(o))return o;return null}var $=class extends Error{constructor(o,r){super(r);this.why=o}};function Mr(e){let t=null;try{t=JSON.parse(e.trim().split(`
|
|
4
|
+
`).pop())}catch{}if(t?.why==="not_entitled")throw new ne("not_entitled",t.detail??"this machine is not licensed");return t?.detail??e.trim()}function ze(e,t){try{let o=JSON.parse(e.trim().split(`
|
|
5
|
+
`).pop()??"");return new $(o.why,o.detail)}catch{return new $("decoder",`the native decoder exited ${t}: ${e.trim().slice(-300)}`)}}function Ne(e){let t=e.reduce((i,n)=>i+n.length,0),o=new Uint8Array(t),r=0;for(let i of e)o.set(i,r),r+=i.length;return o}async function ye(e,t,o,r,i){let n=await De();if(!n)throw new $("missing","the native decoder (conformtools-decode) is not installed");let s=null,a=[],c=0,l=d=>{let f=new Uint8Array(d),p=0;for(;p<d;){let h=a[0],g=Math.min(h.length,d-p);f.set(h.subarray(0,g),p),p+=g,g===h.length?a.shift():a[0]=h.subarray(g)}return c-=d,f},u=[e,t,"--width",String(i.width??32768)];i.from!=null&&u.push("--from",String(i.from)),i.count!=null&&u.push("--count",String(i.count)),i.range&&u.push("--range",i.range);let m=await Ce(n,u,d=>{if(a.push(d),c+=d.length,!s){let p=Ne(a.splice(0));a.push(p);let h=p.indexOf(10);if(h<0)return;s=JSON.parse(new TextDecoder().decode(p.subarray(0,h))),l(h+1),o(s)}let f=4+s.w*s.h*(s.bpp??(e==="rgb16"?6:4));for(;c>=f;){let p=l(f);r(new DataView(p.buffer).getUint32(0,!0),p.subarray(4))}},{signal:i.signal});if(m.code!==0||!s)throw ze(m.stderr,m.code)}function xe(e,t,o,r={}){return ye("bgra",e,t,o,r)}function $e(e,t,o,r={}){return ye("rgb16",e,t,(i,n)=>o(i,new Uint16Array(n.buffer,n.byteOffset,n.length>>1)),r)}var Te=["none","rle","zips","zip","piz","pxr24","b44","b44a","dwaa","dwab","htj2k"],N=e=>(e>>4)*10+(e&15);function Ue(e){let t=N(e&63),o=N(e>>>8&127),r=N(e>>>16&127),i=N(e>>>24&63),n=s=>String(s).padStart(2,"0");return`${n(i)}:${n(r)}:${n(o)}${e&64?";":":"}${n(t)}`}function ke(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(e.length<8||t.getUint32(0,!0)!==20000630)return null;let o={fps:null,timecode:null,width:0,height:0,display:null,compression:null,attributes:[]},r=8,i=()=>{let s=r;for(;r<e.length&&e[r]!==0;)r++;let a=new TextDecoder().decode(e.subarray(s,r));return r++,a},n=s=>({width:t.getInt32(s+8,!0)-t.getInt32(s,!0)+1,height:t.getInt32(s+12,!0)-t.getInt32(s+4,!0)+1});for(;r<e.length;){let s=i();if(!s)break;let a=i();if(r+4>e.length)return null;let c=t.getInt32(r,!0);if(r+=4,c<0||r+c>e.length)return null;if(o.attributes.push(`${s}:${a}`),s==="framesPerSecond"&&a==="rational"&&c>=8){let l=t.getInt32(r,!0),u=t.getUint32(r+4,!0);o.fps=u?l/u:null}else s==="timeCode"&&a==="timecode"&&c>=8?o.timecode=Ue(t.getUint32(r,!0)):s==="dataWindow"&&a==="box2i"&&c>=16?{width:o.width,height:o.height}=n(r):s==="displayWindow"&&a==="box2i"&&c>=16?o.display=n(r):s==="compression"&&c>=1&&(o.compression=Te[e[r]]??`type ${e[r]}`);r+=c}return o}async function Ie(e){let t=e,o=null,r=/^(.*?)\[(\d+)-(\d+)\](.*)$/.exec(b(e));if(await O(e))o=/^(.*?)(\d+)(\.exr)$/i;else{t=y(e);let n=r?[null,r[1],r[2],r[4]]:/^(.*?)(\d+)(\.exr)$/i.exec(b(e));if(!n)return{frames:[e],numbers:[]};let s=a=>a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");o=new RegExp(`^${s(n[1])}(\\d{${n[2].length}})${s(n[3])}$`,"i")}let i=[];for await(let n of v(t)){let s=n.isFile?o.exec(n.name):null;s&&i.push({n:Number(s[s.length===4?2:1]),f:_(t,n.name)})}return i.sort((n,s)=>n.n-s.n),{frames:i.map(n=>n.f),numbers:i.map(n=>n.n)}}async function ve(e){let t=await Ie(e),o=t.frames[0];if(!o)throw new Error(`no .exr frames for '${b(e)}'`);let r=await A(o),i;try{i=ke(await r.readAt(0,Math.min(r.size,1<<20)))}finally{await r.close()}if(!i)throw new Error(`'${b(o)}' is not an OpenEXR file`);let n=Math.max(1,t.frames.length),s=t.numbers.length>1?t.numbers[t.numbers.length-1]-t.numbers[0]+1-t.numbers.length:0,a=i.fps??0;return{id:b(o),kind:"external",target_url:o,local_path:o,content_kind:n>1?"video":"still",source_fps:i.fps??void 0,source_timecode:i.timecode??void 0,source_resolution_w:i.width,source_resolution_h:i.height,available_range:{start:{value:0,rate:a},duration:{value:n,rate:a}},streams:[{kind:"video",codec:"exr",width:i.width,height:i.height,rate:i.fps??void 0,codec_specific:{compression:i.compression}}],vendor_metadata:{exr:{frames:n,first_frame:t.numbers[0]??null,last_frame:t.numbers[t.numbers.length-1]??null,missing_frames:s,display_window:i.display,attributes:i.attributes,fps_source:i.fps!=null?"header framesPerSecond":"not in the header",timecode_source:i.timecode?"header timeCode (first frame)":"not in the header"}}}}var G=new Set([".mov",".mp4",".m4v",".mxf",".wav",".braw",".crm",".r3d",".aif",".aiff"]);async function Be(e){let t=await A(e);return{path:e,file:t,size:t.size}}function He(e){return(t,o)=>e.file.readAt(t,o)}async function je(e){let t=M(b(e));if(!t)return[e];let o=y(e),r=[];for await(let i of v(o)){if(!i.isFile)continue;let n=M(i.name);n&&n.clipBase===t.clipBase&&r.push({n:n.partNumber,p:_(o,i.name)})}return r.sort((i,n)=>i.n-n.n).map(i=>i.p)}async function Y(e){if(await O(e)){let n=[];for await(let s of v(e))s.isFile&&M(s.name)&&n.push(_(e,s.name));if(!n.length)throw new Error(`'${b(e)}' is a folder with no .R3D parts`);e=n.sort()[0]}let t=pe(b(e));if(!t)throw new Error(`unsupported media file '${b(e)}' (supported: ${[...G].join(" ")})`);let o=await je(e),r=await Promise.all(o.map(Be));return{source:he(t,r.map(n=>fe(b(n.path),{fileSize:n.size,read:He(n)}))),parts:r,format:t,anchor:o[0],close:()=>r.forEach(n=>n.file.close())}}async function We(e,t,o,r){if(!/h264|avc|hevc|h265/.test(o)){let i=null,n=await Y(e);try{return await D(n.source,{verb:"decode",index:t,intent:"park"})}catch(s){i=s}finally{n.close()}try{return await Se(e,t,r)}catch(s){throw/no decoder/.test(String(i))?s:i instanceof Error?i:new Error(String(i))}}return Se(e,t,r)}async function kr(e,t,o,r={}){if(/\.mxf$/i.test(e)&&(!o||/h264|avc|mxf/.test(o))){let a=null,c=null;try{await $e(e,l=>{a=l},(l,u)=>{l===t&&(c=u.slice())},{from:t,count:1,range:r.range})}catch(l){if(!(l instanceof $)||!/unsupported|missing/.test(l.why))throw l}if(c&&a){let l=a;return{rgb:c,width:l.w,height:l.h,bits:l.bit_depth??16,decoder:"media-core",full_range:l.full_range??null}}}let i=await We(e,t,o),n=i.width*i.height,s=new Uint16Array(n*3);for(let a=0;a<n;a++)s[a*3]=i.rgba[a*4]*257,s[a*3+1]=i.rgba[a*4+1]*257,s[a*3+2]=i.rgba[a*4+2]*257;return{rgb:s,width:i.width,height:i.height,bits:8,decoder:"8-bit",full_range:null}}async function Se(e,t,o){t=Math.round(t);let r=0,i=0,n=null;if(await xe(e,a=>{r=a.w,i=a.h},(a,c)=>{a===t&&(n=c)},{from:t,count:1,width:o}),!n)throw new Error(`the OS decoder returned no frame ${t} of ${b(e)}`);let s=n;for(let a=0;a<s.length;a+=4){let c=s[a];s[a]=s[a+2],s[a+2]=c}return{rgba:s,width:r,height:i}}async function P(e){if(/\.exr$/i.test(e))return ve(e);let t=await Y(e);try{let o=await D(t.source,{verb:"inspect"});if(!o)throw new Error(`could not read '${b(e)}' as ${t.format}`);return o.target_url=t.anchor,o.local_path=t.anchor,o.id=o.id||b(t.anchor),t.parts.length>1&&((o.vendor_metadata??={}).spanned_parts=t.parts.map(r=>b(r.path))),o.size_bytes=t.parts.reduce((r,i)=>r+i.size,0),o}finally{t.close()}}function Le(e,t,o,r){let i=Math.abs(r*1001-Math.round(r*1001/1e3)*1e3)<1?Math.round(r)*1e3/1001:r,n=Math.floor(e*i/t+1e-6);return{tc:C(n,r),frames:Math.round(o*i/t)}}var Je=e=>String(Math.round(e*1e3)/1e3);function Ir(e,t){let o=e.streams?.find(m=>m.kind==="video"),r=e.streams?.filter(m=>m.kind==="audio")??[],i=e.vendor_metadata?.bext;if(!o&&e.available_range&&r[0]?.rate){let m=r[0].rate,d=e.available_range.duration.value,p=(t?[t]:[24e3/1001,24]).map(h=>{let g=Le(i?.time_reference??0,i?.sample_rate||m,d,h);return`${i?`start TC ${g.tc}, `:""}${g.frames} frames @ ${Je(h)} fps`});return[e.target_url??"",`audio only; ${d} samples (${(d/m).toFixed(3)} s)${i?`; BWF time_reference ${i.time_reference}`:"; no BWF timecode"}`,...p,...t?[]:["(pass fps for the project's rate)"],...r.map((h,g)=>`audio ${r.length>1?`${g+1}: `:""}${h.codec??"pcm"} ${h.channels??"?"}ch ${h.rate} Hz ${h.bit_depth??"?"}-bit`)].join(`
|
|
6
|
+
`)}let n=e.available_range?.duration?.value??e.declared_duration?.value??null,s=e.source_fps??o?.rate??null,a=e.size_bytes,c=e.vendor_metadata?.spanned_parts,l=o?.codec_specific??{},u=[l.profile?`${l.profile} (${l.fourcc})`:l.fourcc,l.pixel_format,o?.bit_depth?`${o.bit_depth}-bit`:null,l.colr?`colour ${l.colr.primaries}/${l.colr.transfer}/${l.colr.matrix} (primaries/transfer/matrix)`:null].filter(Boolean).join(", ");return[e.target_url??"",o?`${o.codec??"?"} ${o.width??"?"}x${o.height??"?"}${s?` @ ${Math.round(s*1e3)/1e3} fps`:""}${u?`; ${u}`:""}`:"no video track",`start TC ${e.source_timecode??"none"}; ${n!=null?`${n} frames`:"length unknown"}${n!=null&&s?` (${(n/s).toFixed(2)} s)`:""}`,r.length?r.map((m,d)=>{let f=m.codec_specific?.channel_layout;return`audio ${r.length>1?`${d+1}: `:""}${m.codec??"pcm"} ${m.channels??"?"}ch${f?` (${f})`:""} ${m.rate??"?"} Hz ${m.bit_depth??"?"}-bit`}).join(`
|
|
7
|
+
`):"no audio",`${e.reel_name?`reel ${e.reel_name}; `:""}${a!=null?`${(a/1e6).toFixed(1)} MB`:""}${c?`; spanned ${c.length} parts`:""}`].join(`
|
|
8
|
+
`)}var Ke=8*1024*1024,T=e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0));async function Ve(e,t,o){if(e.executable_locally===!1)throw new Error("this trim plan is server-side only");let r=new Map(t.parts.map(n=>[b(n.path),n]));await j(y(o));let i=await re(o);try{await i.truncate(e.total_size),await i.writeAt(0,T(e.dest_header_bytes_base64));for(let n of e.src_byte_ranges){let s=n.src_file_name?r.get(b(n.src_file_name)):t.parts[0];if(!s)throw new Error(`plan references unknown source part '${n.src_file_name}'`);let a=0;for(;a<n.length;){let c=Math.min(Ke,n.length-a),l=await s.file.readAt(n.offset+a,c);if(l.length<c)throw new Error(`short read in ${b(s.path)} at ${n.offset+a}`);await i.writeAt(n.write_to_dest_offset+a,l),a+=c}}e.dest_footer_bytes_base64&&e.dest_footer_offset!=null&&await i.writeAt(e.dest_footer_offset,T(e.dest_footer_bytes_base64));for(let n of e.dest_patches??[])await i.writeAt(n.offset,T(n.bytes_base64))}finally{await i.close()}for(let n of e.dest_sidecar_writes??[])await H(_(y(o),n.name),T(n.bytes_base64))}function Xe(e,t){let o=[];for(let r of e){if(r.kind!=="clip"||!r.source_range)continue;let i=r.source_range.start.value,n=r.source_range.duration.value,s=Math.max(0,Math.floor(i)-t),a=Math.floor(i+n-1)+t;a>=s&&o.push({first_frame:s,last_frame:a})}return de(o)}async function Ge(e,t,o,r,i){let n=await Y(e);try{let s=Xe(t,o);if(!s.length)throw new Error("no usable frame ranges (items need kind=clip with source_range)");let a=await D(n.source,{verb:"trim",selection:{items:t,handles:o}}),c=L(n.anchor),l=n.format==="r3d",u=l?M(b(n.anchor))?.clipBase??b(n.anchor,c):b(n.anchor,c),m=[];for(let[d,f]of a.entries()){let p=f.output_clip_number??(s.length>1?d+1:void 0),h=s[(p??1)-1]??s[0],g=p&&(f.output_clip_count??s.length)>1?`_S${String(p).padStart(3,"0")}`:"",w;if(l){let x=f.output_part_number??d+1;w=_(r,`${u}${g}.RDC`,`${u}_${String(x).padStart(3,"0")}.R3D`),m.push({path:w,bytes:f.total_size,island:h,part:x,clip:p})}else{let x=i&&a.length===1?i:`${u}${g||`_trim_${h.first_frame}-${h.last_frame}`}${c}`;w=_(r,x),m.push({path:w,bytes:f.total_size,island:h,clip:p})}await Ve(f,n,w)}return l||await Ye(e,m,!!i&&a.length===1),{outputs:m,islands:s,format:n.format}}finally{n.close()}}async function Ye(e,t,o){let r=await P(e).catch(()=>null),i=r?.source_fps??r?.streams?.find(n=>n.kind==="video")?.rate??null;if(!(!r?.source_timecode||!i))for(let n of t){if(!n.island)continue;let s=await P(n.path).catch(()=>null),a=s?.available_range?.duration?.value??s?.declared_duration?.value;if(!s?.source_timecode||!a)continue;let c=R(s.source_timecode,i,r.source_timecode);if(c===n.island.first_frame&&c+a-1===n.island.last_frame||(n.island={first_frame:c,last_frame:c+a-1},o))continue;let l=n.path.replace(/_trim_\d+-\d+(\.[^./\\]+)$/,`_trim_${c}-${c+a-1}$1`);l!==n.path&&(await W(n.path,l),n.path=l)}}async function Br(e){let t=await P(e.path),o=t.source_fps??t.streams?.find(p=>p.kind==="video")?.rate??null,r=t.available_range?.duration?.value??t.declared_duration?.value??null;if(!o)throw new Error("cannot trim: no frame rate / timecode track on this file");let i=R(e.in,o,t.source_timecode??null),n=R(e.out,o,t.source_timecode??null);if(e.out_exclusive&&(n-=1),n<i)throw new Error(`out (${n}) is before in (${i})`);if(i<0)throw new Error(`in (${i}) is before the file start (TC ${t.source_timecode})`);if(r!=null&&n>r-1)throw new Error(`out (${n}) is past the last frame (${r-1})`);let s={id:"trim",kind:"clip",source_range:{start:{value:i,rate:o},duration:{value:n-i+1,rate:o}}},a=y(e.path),c;if(e.out_path)try{(await B(e.out_path)).isDirectory?a=e.out_path:(a=y(e.out_path),c=b(e.out_path))}catch{a=y(e.out_path),c=b(e.out_path)}let l=await Ge(e.path,[s],Math.max(0,Math.floor(e.handles??0)),a,c),u=l.islands[0],m=l.outputs.length===1&&l.outputs[0].island?l.outputs[0].island:u,d=m.first_frame,f=m.last_frame;return{outputs:l.outputs,first_frame:d,last_frame:f,frames:f-d+1,fps:o,facts:t,...d!==u.first_frame||f!==u.last_frame?{asked:{first_frame:u.first_frame,last_frame:u.last_frame}}:{}}}function Re(e){let t=[...G].map(o=>o.slice(1)).join("|");return e.toLowerCase().replace(new RegExp(`\\.(${t})(?=[._\\s-]|$)`,"g"),"").replace(/[^a-z0-9]/g,"")}function Ze(e,t){let o=Re(e),r=Re(t);if(r&&o.includes(r))return"name";let i=t.toLowerCase().split(/[^a-z0-9]+/).filter(n=>/\d/.test(n)&&n.length>=3);return i.length&&i.every(n=>o.includes(n))?"id":null}async function Hr(e,t,o){let r=[],i=0,n=null,s=Date.now()+o.time_limit_s*1e3,a=async(c,l)=>{try{for await(let u of v(c)){if(n&&!n.startsWith("folders"))return;if(++i>o.max_entries){n=`stopped after ${o.max_entries} entries (max_entries)`;return}if(Date.now()>s){n=`stopped after ${o.time_limit_s} s (time_limit_s)`;return}if(u.name.startsWith("."))continue;let m=_(c,u.name);if(u.isDirectory)l<o.max_depth?await a(m,l+1):n??=`folders deeper than max_depth=${o.max_depth} not searched (e.g. ${m})`;else if(u.isFile&&G.has(L(u.name).toLowerCase())){let d=Ze(u.name,t);d&&r.push({path:m,match:d,size:(await B(m).catch(()=>({size:0}))).size})}}}catch{}};if(await a(e,0),o.probe)for(let c=0;c<r.length;c+=8)await Promise.all(r.slice(c,c+8).map(async l=>{try{l.facts=await P(l.path)}catch(u){l.error=u.message}}));return r.sort((c,l)=>c.path.localeCompare(l.path)),{hits:r,scanned:i,truncated:n}}function Qe(e){let t=e.streams?.find(a=>a.kind==="video"),o=e.source_fps??t?.rate??null,r=e.available_range?.duration?.value??e.declared_duration?.value??null,i=t?.codec_specific??{},n=e.source_timecode&&o?J(e.source_timecode,o):null,s=n!=null&&r!=null&&o?C((n+r)%(Math.round(o)*86400),o,e.source_timecode.includes(";")):null;return`${t?`${t.codec??"?"}${i.profile?` ${i.profile}`:""} ${t.width??"?"}x${t.height??"?"}`:"no video"}${o?` @ ${Math.round(o*1e3)/1e3} fps`:""}; TC ${e.source_timecode??"none"}${s?`\u2013${s}`:""}; ${r??"?"} fr${r!=null&&o?` (${(r/o).toFixed(2)} s)`:""}`}function jr(e,t,o,r){let i=e.hits.slice(0,r),n=[];e.truncated&&n.push(`TRUNCATED: ${e.truncated} \u2014 the search did NOT cover all of ${t}; the matches below may be incomplete.`),e.hits.length>i.length&&n.push(`TRUNCATED: showing ${i.length} of ${e.hits.length} matches. Pass limit=${e.hits.length} or narrow the query.`),n.push(`${e.hits.length} file${e.hits.length===1?"":"s"} match "${o}" under ${t} (${e.scanned} entries scanned)`);let s=new Map;for(let c of e.hits)s.set(b(c.path).toLowerCase(),(s.get(b(c.path).toLowerCase())??0)+1);let a=[...s].filter(([,c])=>c>1);a.length&&n.push(`same name in several folders: ${a.map(([c,l])=>`${c} \xD7${l}`).join(", ")} \u2014 they can be DIFFERENT clips; match by TC + duration, never by name alone`);for(let c of i)n.push(`- ${c.path}${c.match==="id"?" (id match)":""}
|
|
9
|
+
${c.facts?Qe(c.facts):c.error?`probe failed: ${c.error}`:`${(c.size/1e6).toFixed(1)} MB`}`);return n.join(`
|
|
10
|
+
`)}async function Wr(e,t,o=0){let r=await P(e),i=r.source_fps??r.streams?.find(d=>d.kind==="video")?.rate??null,n=r.available_range?.duration?.value??r.declared_duration?.value??null;if(!i||n==null)throw new Error(`cannot check coverage: ${b(e)} has no frame rate or length`);let s=Math.round(i)*86400,a=r.source_timecode?J(r.source_timecode,i)??0:0,c=!!r.source_timecode?.includes(";"),l=d=>{let f=R(d,i,r.source_timecode??null);return typeof d=="number"||/^\d+$/.test(d.trim())?f:f<-s/2?f+s:f>s/2?f-s:f},u=d=>C(((a+d)%s+s)%s,i,c),m=t.map((d,f)=>{let p=l(d.in),h=l(d.out),g=p,w=n-h,x=g>=0&&w>=0&&h>p,U=Math.max(0,-g),k=Math.max(0,-w),S=[];return h<=p?S.push("out is not after in"):x?S.push(`covered; handles head ${g} / tail ${w} fr`):S.push(`NOT covered: short ${[U?`${U} fr at head`:"",k?`${k} fr at tail`:""].filter(Boolean).join(", ")}`),x&&o&&(g<o||w<o)&&S.push(`handles short of ${o}: ${[g<o?`head by ${o-g}`:"",w<o?`tail by ${o-w}`:""].filter(Boolean).join(", ")}`),{label:d.label??`range ${f+1}`,in_tc:u(p),out_tc:u(h),frames:h-p,covered:x,head:g,tail:w,short_head:U,short_tail:k,note:S.join("; ")}});return{facts:r,rows:m}}export{nr as a,De as b,Mr as c,xe as d,Ie as e,G as f,je as g,Y as h,We as i,kr as j,P as k,Le as l,Ir as m,Xe as n,Ge as o,Br as p,Re as q,Ze as r,Hr as s,Qe as t,jr as u,Wr as v};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
+
import{A as L,Y as P,b as N,k as A,p as O,v as R,x as M,y as W,z as I}from"./chunk-PLRB2YXJ.js";import K from"node:http";import{connect as Y}from"node:net";import{createHash as U,randomBytes as j}from"node:crypto";import{Buffer as m}from"node:buffer";var D="258EAFA5-E914-47DA-95CA-C5AB0DC85B11";function C(o,e,a=!1){let n=e.length,t=a?128:0,s=n<126?m.from([128|o,t|n]):n<65536?m.from([128|o,t|126,n>>8,n&255]):(()=>{let i=m.alloc(10);return i[0]=128|o,i[1]=t|127,i.writeBigUInt64BE(BigInt(n),2),i})();if(!a)return m.concat([s,m.from(e)]);let r=j(4),c=m.from(e);for(let i=0;i<c.length;i++)c[i]^=r[i&3];return m.concat([s,r,c])}function J(o,e,a,n=!1){let t=m.alloc(0),s=[],r=0,c=!1,i=[],p=[],u=()=>{c||(c=!0,p.forEach(l=>l()))},f=(l=1e3,d="")=>{if(c)return;let h=m.from(d),g=m.alloc(2+h.length);g.writeUInt16BE(l,0),h.copy(g,2);try{o.write(C(8,g,n))}catch{}o.end(),u()};return o.on("data",l=>{for(t=m.concat([t,l]);t.length>=2;){let d=(t[0]&128)!==0,h=t[0]&15,g=(t[1]&128)!==0,v=t[1]&127,y=2;if(v===126){if(t.length<4)return;v=t.readUInt16BE(2),y=4}else if(v===127){if(t.length<10)return;let w=t.readBigUInt64BE(2);if(w>BigInt(a))return f(1009,"too big");v=Number(w),y=10}if(g===n)return f(1002,n?"server frames must not be masked":"client frames must be masked");if(v>a||r+v>a)return f(1009,"message too big");let T=g?4:0;if(t.length<y+T+v)return;let S=m.from(t.subarray(y+T,y+T+v));if(g){let w=t.subarray(y,y+4);for(let x=0;x<S.length;x++)S[x]^=w[x&3]}if(t=t.subarray(y+T+v),h===8)return f(1e3);if(h===9){o.write(C(10,S,n));continue}if(h!==10){if(h===1||h===0){if(s.push(S),r+=S.length,d){let w=m.concat(s).toString("utf8");s=[],r=0,i.forEach(x=>x(w))}continue}return f(1003,"text frames only")}}}),o.on("close",u),o.on("error",u),{origin:e,send:l=>{c||o.write(C(1,m.from(l,"utf8"),n))},close:f,onMessage:l=>{i.push(l)},onClose:l=>{p.push(l)}}}function F(o,e){let a=new Set,n=K.createServer((t,s)=>{let r=n.address();o.onHttp?.(t,s,typeof r=="object"&&r?r.port:o.port)||(s.writeHead(426,{"content-type":"text/plain"}),s.end("websocket only"))});return n.on("upgrade",(t,s)=>{let r=t.headers["sec-websocket-key"];if(t.url?.split("?")[0]!==o.path||typeof r!="string"||String(t.headers.upgrade).toLowerCase()!=="websocket"){s.end(`HTTP/1.1 400 Bad Request\r
|
|
4
|
+
\r
|
|
5
|
+
`);return}let c=U("sha1").update(r+D).digest("base64");s.write(`HTTP/1.1 101 Switching Protocols\r
|
|
6
|
+
Upgrade: websocket\r
|
|
7
|
+
Connection: Upgrade\r
|
|
8
|
+
Sec-WebSocket-Accept: ${c}\r
|
|
9
|
+
\r
|
|
10
|
+
`),a.add(s),s.on("close",()=>a.delete(s));let i=typeof t.headers.origin=="string"?t.headers.origin:null;e(J(s,i,o.maxBytes))}),new Promise((t,s)=>{n.once("error",s),n.listen(o.port,o.hostname,()=>{let r=n.address();t({port:typeof r=="object"&&r?r.port:o.port,close:()=>new Promise(c=>{for(let i of a)i.destroy();n.close(()=>c())})})})})}function de(o,e){let a=new URL(o);if(a.protocol!=="ws:")return Promise.reject(new Error(`only ws:// URLs: ${o}`));let n=j(16).toString("base64"),t=U("sha1").update(n+D).digest("base64");return new Promise((s,r)=>{let c=Y({host:a.hostname,port:Number(a.port||80)}),i=f=>{c.destroy(),r(f)};c.setTimeout(e.timeoutMs,()=>i(new Error(`no answer from ${a.host} within ${e.timeoutMs} ms`))),c.once("error",i),c.once("connect",()=>c.write(`GET ${a.pathname}${a.search} HTTP/1.1\r
|
|
11
|
+
Host: ${a.host}\r
|
|
12
|
+
Upgrade: websocket\r
|
|
13
|
+
Connection: Upgrade\r
|
|
14
|
+
Sec-WebSocket-Key: ${n}\r
|
|
15
|
+
Sec-WebSocket-Version: 13\r
|
|
16
|
+
\r
|
|
17
|
+
`));let p=m.alloc(0),u=f=>{p=m.concat([p,f]);let l=p.indexOf(`\r
|
|
18
|
+
\r
|
|
19
|
+
`);if(l<0)return;c.off("data",u);let d=p.subarray(0,l).toString("latin1").split(`\r
|
|
20
|
+
`),h=d.find(y=>/^sec-websocket-accept:/i.test(y))?.split(":")[1]?.trim();if(!/^HTTP\/1\.1 101/.test(d[0])||h!==t)return i(new Error(`${a.host} refused the WebSocket upgrade: ${d[0]}`));c.setTimeout(0),c.off("error",i);let g=p.subarray(l+4),v=J(c,null,e.maxBytes,!0);g.length&&c.emit("data",g),s(v)};c.on("data",u)})}import{existsSync as te,readFileSync as ne}from"node:fs";var $="0.6.6";function Q(o,e){let a=o.split("-")[0].split(".").map(Number),n=e.split("-")[0].split(".").map(Number);for(let t=0;t<Math.max(a.length,n.length);t++){let s=(a[t]||0)-(n[t]||0);if(s)return s>0}return!1}var Z=null;function q(){return N("CONFORM_UPDATE_CHECK")==="off"?Promise.resolve(null):Z??=fetch("https://registry.npmjs.org/conformtools/latest",{signal:AbortSignal.timeout(2e3)}).then(o=>o.ok?o.json():null).then(o=>typeof o?.version=="string"?o.version:null).catch(()=>null)}var ee="run npx -y --prefer-online conformtools@latest mcp (in the MCP client config too; --prefer-online makes npx re-check npm instead of reusing its cached copy), then restart the MCP client; if an old global install is shadowing it: npm rm -g conformtools";async function ve(){let o=await q();return`conformtools ${$}`+(o&&Q(o,$)?` \u2014 update available: ${o} \u2192 ${ee}`:"")}var k=1,re=[48127,48128,48129,48130,48131,48132,48133,48134],oe=5e3,V=4,se=8*1024*1024,b=class extends Error{constructor(a,n){super(n);this.code=a}},_=()=>P(A(),"host-bridge","pairing.json"),B="/avid-panel/",ie="/avid-panel/pairing",G="avid",z={"index.html":"text/html; charset=utf-8","panel.js":"text/javascript; charset=utf-8","panel.css":"text/css; charset=utf-8","icon.svg":"image/svg+xml"},ae="default-src 'none'; script-src 'self'; style-src 'self'; img-src 'self' data:; connect-src 'self' ws://localhost:{port} ws://127.0.0.1:{port} http://localhost:* http://127.0.0.1:* https://localhost:* https://127.0.0.1:*; base-uri 'none'; form-action 'none'; frame-ancestors 'none'",X=o=>[`http://localhost:${o}`,`http://127.0.0.1:${o}`];function ce(){for(let o of["./avid/panel/web-dist/","./avid-panel/"]){let e=O(new URL(o,import.meta.url));if(te(P(e,"index.html")))return e}return null}function le(){let o=new Uint8Array(32);return crypto.getRandomValues(o),Array.from(o,e=>e.toString(16).padStart(2,"0")).join("")}var H=class{constructor(){this.token=le();this.port=0;this.live=new Map;this.waiters=[];this.seq=0;this.events=[]}async start(e=re){let a;for(let n of e)try{this.server=await F({hostname:"127.0.0.1",port:n,path:"/host-bridge",maxBytes:se,onHttp:(t,s,r)=>this.servePanel(t,s,r)},t=>this.accept(t)),this.port=this.server.port;break}catch(t){a=t}if(!this.server)throw new b("no_port",`every host-bridge port (${e.join(", ")}) is taken: ${a}`);await W(P(A(),"host-bridge")),await M(_(),JSON.stringify({protocol:k,url:`ws://127.0.0.1:${this.port}/host-bridge`,port:this.port,token:this.token})),await L(_(),384)}async stop(){for(let e of this.live.values())e.conn.close(1001,"engine stopping");this.live.clear(),await this.server?.close();try{JSON.parse(await R(_())).token===this.token&&await I(_())}catch{}}peers(){return[...this.live.values()].map(e=>e.peer)}peer(e){return this.live.get(e)?.peer}async waitFor(e,a){return this.live.has(e)?this.peer(e):(await Promise.race([new Promise(n=>this.waiters.push({host:e,resolve:n})),new Promise(n=>setTimeout(n,a))]),this.peer(e))}request(e,a,n={},t=3e4){let s=this.live.get(e);if(!s)return Promise.reject(new b("not_connected",`${e}: its panel is not connected`));let r=`r${++this.seq}`;return new Promise((c,i)=>{let p=setTimeout(()=>{s.pending.delete(r),i(new b("timeout",`${e}: no answer to ${a} within ${Math.round(t/1e3)} s`))},t);s.pending.set(r,{resolve:c,reject:i,timer:p}),s.conn.send(JSON.stringify({type:"request",id:r,method:a,params:n}))})}servePanel(e,a,n){let t=(e.url??"").split("?")[0];if(!t.startsWith(B)&&t!==B.slice(0,-1))return!1;let s=(f,l,d,h=!1)=>{let g=typeof d=="string"?new TextEncoder().encode(d):d;return a.writeHead(f,{"content-type":l,"content-length":String(g.length),"cache-control":"no-store","x-content-type-options":"nosniff","referrer-policy":"no-referrer","cross-origin-resource-policy":"same-origin","x-frame-options":"DENY","content-security-policy":ae.replaceAll("{port}",String(n))}),a.end(h?void 0:g),!0},r=(f,l)=>s(f,"text/plain; charset=utf-8",l),c=f=>{let l=e.headers[f];return typeof l=="string"?l:void 0},i=(c("host")??"").toLowerCase();if(i!==`localhost:${n}`&&i!==`127.0.0.1:${n}`)return r(421,"misdirected request");if(t===ie)return e.method==="POST"&&X(n).includes(c("origin")??"")&&(c("sec-fetch-site")??"same-origin")==="same-origin"&&c("x-ct-panel")==="1"&&(c("content-length")??"0").trim()==="0"?s(200,"application/json",JSON.stringify({protocol:k,url:`ws://localhost:${n}/host-bridge`,port:n,token:this.token})):r(403,"forbidden");if(e.method!=="GET"&&e.method!=="HEAD")return r(405,"method not allowed");let p=t.slice(B.length)||"index.html",u=ce();return!z[p]||!u?r(404,"not found"):s(200,z[p],ne(P(u,p)),e.method==="HEAD")}accept(e){let a=!!e.origin&&X(this.port).includes(e.origin);if(e.origin&&/^https?:/i.test(e.origin)&&!a){e.send(JSON.stringify({type:"error",code:"origin_refused",message:"web pages may not use the host bridge"})),e.close(1008,"origin");return}let n=null,t=setTimeout(()=>{n||(e.send(JSON.stringify({type:"error",code:"hello_timeout",message:"no hello"})),e.close(1008,"hello"))},oe);e.onMessage(s=>{let r;try{r=JSON.parse(s)}catch{return}if(!n){let i=(l,d)=>{clearTimeout(t),e.send(JSON.stringify({type:"error",code:l,message:d})),e.close(1008,l)};if(r.type!=="hello")return i("hello_expected","the first frame must be hello");if(r.protocol!==k)return i("protocol_mismatch",`this engine speaks protocol ${k}`);if(r.token!==this.token)return i("bad_token","the pairing token does not match: re-read the pairing file");let p=r.host??{},u=String(p.id??"");if(!/^[a-z][a-z0-9_-]{1,31}$/.test(u))return i("bad_host","host.id is missing or malformed");if(a&&u!==G)return i("origin_mismatch",`a connection from the panel page may only be host ${G}`);if(!this.live.has(u)&&this.live.size>=V)return i("too_many_peers",`at most ${V} panels`);clearTimeout(t),this.live.get(u)?.conn.close(1e3,"replaced by a newer connection"),n=u;let f={id:u,name:String(p.name??u),version:String(p.version??""),platform:String(p.platform??""),capabilities:Array.isArray(r.capabilities)?r.capabilities.map(String):[],optional_verbs:Array.isArray(r.optional_verbs)?r.optional_verbs.map(String):[]};this.live.set(u,{peer:f,conn:e,pending:new Map}),e.send(JSON.stringify({type:"welcome",protocol:k,app:{name:"conformtools",version:$}})),this.waiters=this.waiters.filter(l=>l.host===u?(l.resolve(),!1):!0);return}let c=this.live.get(n);if(!(!c||c.conn!==e))if(r.type==="response"){let i=c.pending.get(String(r.id));if(!i)return;if(c.pending.delete(String(r.id)),clearTimeout(i.timer),r.ok)i.resolve(r.result??null);else{let p=r.error??{};i.reject(new b(p.code??"peer_error",`${n}: ${p.message??p.code??"error"}`))}}else r.type==="event"&&(this.events.push({host:n,name:String(r.name),data:r.data}),this.events.length>200&&this.events.shift())}),e.onClose(()=>{if(clearTimeout(t),!n)return;let s=this.live.get(n);if(s?.conn===e){for(let r of s.pending.values())clearTimeout(r.timer),r.reject(new b("disconnected",`${n}: the panel disconnected`));this.live.delete(n)}})}},E=null;function Pe(){return E??=(async()=>{let o=new H;return await o.start(),o})(),E.catch(()=>{E=null}),E}function ke(){E=null}export{$ as a,Q as b,q as c,ee as d,ve as e,de as f,k as g,re as h,b as i,_ as j,B as k,X as l,H as m,Pe as n,ke as o};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
+
import{a as h}from"./chunk-3OCQA33E.js";import{A as K,I as X,L as Y,O as H,P as q,Q as V,Y as u,b as l,f as F,g as x,k as g,l as J,p as N,r as G,s as z,v as y,x as D,y as T,z as v}from"./chunk-PLRB2YXJ.js";var _={payg:{id:"payg",name:"Pay As You Go",monthly:0,yearly:0,stripe:{},includes:{web:!0,mcp:!1,app:!1}},web:{id:"web",name:"Web",monthly:10,yearly:100,stripe:{},includes:{web:!0,mcp:!1,app:!1}},indie:{id:"indie",name:"MCP",monthly:49,yearly:490,stripe:{monthly:"price_1T5XDXJ5lnla0aaLasKq49tm",yearly:"price_1T5XDXJ5lnla0aaL2MdMSuI9"},includes:{web:!0,mcp:!0,app:!1}},pro:{id:"pro",name:"App",monthly:199,yearly:1990,stripe:{monthly:"price_1T5X8oJ5lnla0aaLyNJa93H0",yearly:"price_1T5X8oJ5lnla0aaL3dh7b1el"},includes:{web:!0,mcp:!0,app:!0}},studio:{id:"studio",name:"Studio",monthly:"custom",yearly:"custom",stripe:{monthly:"price_1T5X7xJ5lnla0aaLoeE1aBlL",yearly:"price_1T5X7xJ5lnla0aaLeBiYo3Di"},includes:{web:!0,mcp:!0,app:!0}}},Z={web:!0,mcp:!0,app:!0};var Ne=Object.fromEntries(Object.values(_).flatMap(e=>Object.values(e.stripe).map(t=>[t,e.id])));import{createPrivateKey as $e,createPublicKey as fe,sign as Ce,verify as ge}from"node:crypto";import{Buffer as w}from"node:buffer";var he="CONFORMTOOLS_LICENSE_V1",W=/^[0-9A-F]{8}(-[0-9A-F]{8}){3}$/,Q=e=>JSON.stringify({dev_mode:e.dev_mode??!1,email:e.email,expires_at:e.expires_at,features:e.features,issued_at:e.issued_at,machine_fingerprint:e.machine_fingerprint,tier:e.tier});function ee(e){let t=e.split(/\r?\n/).map(r=>r.trim()).filter(r=>r&&!r.startsWith("#")&&!r.startsWith("-----")).join(""),n=JSON.parse(w.from(t,"base64").toString("utf8"));if(n?.magic!==he||!n.payload?.data)throw new Error("not a conform.tools licence");return n.payload}function te(e,t){let n=w.from(e.signature,"base64"),r=w.from(Q(e.data));return n.length!==64?!1:t.some(i=>ge(null,r,fe({key:w.concat([w.from("302a300506032b6570032100","hex"),w.from(i)]),format:"der",type:"spki"}),n))}async function $(){let e=x()==="win32"?"conformtools-analyze.exe":"conformtools-analyze",t=[l("CONFORM_ANALYZE"),N(new URL(`./${e}`,import.meta.url)),N(new URL(`../../rust/target/release/${e}`,import.meta.url))].filter(Boolean);for(let n of t)if(await z(n))return n;return null}var ne=e=>e.code==="not_entitled"?new h("not_entitled",String(e.why)):void 0;async function Be(e){let t=await re(),n=await t.ask({op:"job",reference:e.reference,clips:e.clips,lite:e.lite??!0,display:!!e.display});if(!n.ok)throw t.close(),ne(n)??new Error(`analysis engine: ${n.why}`);return t}async function Fe(e,t,n){let r=await re(),i=()=>r.close();n?.addEventListener("abort",i);let o;try{o=await r.ask(e,t)}finally{n?.removeEventListener("abort",i),r.close()}if(n?.aborted)throw new Error("cancelled");if(!o.ok)throw ne(o)??new Error(o.why??`the analysis engine could not run ${e.op}`);return o}async function re(){let e=await $();if(!e)throw new Error("the analysis engine (conformtools-analyze) is not installed");let t="",n=null,r=H(e,["serve"],s=>{t+=new TextDecoder().decode(s);let d;for(;(d=t.indexOf(`
|
|
4
|
+
`))>=0;){let m=t.slice(0,d);t=t.slice(d+1);let c=JSON.parse(m);if(c.progress){n?.progress?.(c.progress[0],c.progress[1],c.phase??"");continue}let p=n;n=null,p?.done(c)}},s=>console.error(s.trimEnd()));r.exited.then(()=>n?.done({ok:!1,why:"the analysis engine exited"}));let i=Promise.resolve();return{ask:(s,d)=>{let m=i.then(async()=>{r.hold(!0);try{let c=new Promise(f=>{n={done:f,progress:d}});await r.write(new TextEncoder().encode(JSON.stringify(s)+`
|
|
5
|
+
`));let p=await c;return p.miss&&(console.error(`[mirror] MISS \u2014 ${p.miss} is not in the mirror. Replay never reads the source drive; record this case again with the drive mounted (CONFORM_MIRROR_MODE=record).`),F(75)),p}finally{r.hold(!1)}});return i=m.catch(()=>{}),m},close:()=>r.close()}}var ye=["cMwVBrEYKMzlG6pC7FF2lNKIoEqGz2xB5yph6clNnTg=","qnheqkkDU09l1oI6h2CFh4uQ97bY/hkTA5niGKH0+X8="],_e=ye.map(e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)));function k(){let e=l("CONFORM_RECORDS_DIR");if(e)return e;let t=J(),n=x()==="darwin"?u(t,"Library/Application Support"):x()==="win32"?l("LOCALAPPDATA")??u(t,"AppData/Local"):l("XDG_DATA_HOME")??u(t,".local/share");return u(n,"conform.tools")}var we=()=>l("CONFORM_LICENSE_PATH")??u(k(),"license.lic"),A=()=>u(k(),"grant.lic"),be=null;function C(){return be??=(async()=>{let e=await $();if(!e)return[];let t=await Y(e,["machine"],{timeoutMs:15e3}).catch(()=>null);try{return JSON.parse(t?.stdout??"").machines.filter(n=>W.test(n))}catch{return[]}})()}function xe(e,t,n=Date.now()){if(!te(e,_e))return{ok:!1,reason:"invalid licence signature"};let r=Date.parse(e.data.expires_at);return!Number.isFinite(r)||r<n?{ok:!1,reason:`licence expired ${e.data.expires_at}`}:[t??[]].flat().includes(e.data.machine_fingerprint)?{ok:!0,data:e.data}:{ok:!1,reason:"licence is for another machine"}}async function ie(){let e;try{e=await y(we())}catch{return null}try{return xe(ee(e),await C())}catch(t){return{ok:!1,reason:t.message}}}var ve={production:{supabaseUrl:"https://sttpwvjbpsetzbhrkohl.supabase.co",anonKey:"sb_publishable_cyuIPsrQa5Ye7lqFxjnknQ_ozDuwwzp",appBase:"https://conform.tools"},staging:{supabaseUrl:"https://slxggvbvgzkiwojcgykx.supabase.co",anonKey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InNseGdndmJ2Z3praXdvamNneWt4Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzEyODUzMTksImV4cCI6MjA4Njg2MTMxOX0.b18iDsWftny0k9VmOCcbN6kLlyZsZ7GULn_jRH9CE9I",appBase:"https://beta.conform.tools"}};function a(){let e=l("CONFORM_ENV")==="staging"?"staging":"production",t=ve[e];return{env:e,supabaseUrl:l("CONFORM_SUPABASE_URL")??t.supabaseUrl,anonKey:l("CONFORM_SUPABASE_ANON_KEY")??t.anonKey,appBase:l("CONFORM_APP_BASE")??t.appBase}}var Se=600*1e3,oe=72*3600*1e3,Ee=300*1e3,E=()=>u(g(),a().env==="production"?"auth.json":`auth-${a().env}.json`);async function M(){for(let e of new Set([E(),u(g(),"auth.json")]))try{let t=JSON.parse(await y(e));if(t.env===a().env&&t.access_token)return t}catch{}return null}async function Pe(){try{for await(let e of X(g())){if(!/^auth(?:-(\w+))?\.json$/.exec(e.name))continue;let n=JSON.parse(await y(u(g(),e.name)));if(n.access_token&&n.env&&n.env!==a().env)return{other_env:n.env}}}catch{}return{}}async function R(e){await T(g()),await D(E(),JSON.stringify(e)),await K(E(),384)}var se=6e3,P=0,ce=()=>Date.now()<P,le=()=>{P=Date.now()+6e4};function We(){P=0}async function ue(e){if(e.expires_at-60>Date.now()/1e3)return e.access_token;if(ce())return null;let t=a();try{let n=await fetch(`${t.supabaseUrl}/auth/v1/token?grant_type=refresh_token`,{method:"POST",headers:{apikey:t.anonKey,"content-type":"application/json"},body:JSON.stringify({refresh_token:e.refresh_token}),signal:AbortSignal.timeout(se)}).catch(i=>{throw le(),i});if(!n.ok)return n.status===400||n.status===401?"":null;let r=await n.json();return e.access_token=r.access_token,r.refresh_token&&(e.refresh_token=r.refresh_token),e.expires_at=r.expires_at??Math.floor(Date.now()/1e3)+(r.expires_in??3600),await R(e),e.access_token}catch{return null}}async function Qe(){let e=await M();return e&&await ue(e)||null}var b=null;function ae(e,t){return{signed_in:!0,entitled:e.entitled,env:a().env,email:e.email,access:e.access,tier:e.tier,trial_days_remaining:e.trial_days_remaining,source:t,...e.entitled?{}:{reason:"not_entitled"}}}async function pe(e={}){let t=await ie();if(t?.ok)return{signed_in:!!await M().catch(()=>null),entitled:!0,env:a().env,email:t.data.email,access:"licence",tier:t.data.tier,source:"licence"};let n=await ke(e);return t&&!n.entitled?{...n,licence_error:t.reason}:n}async function ke(e){if(!e.force&&b&&Date.now()-b.at<Se)return{...b.status,source:"cache"};let t=a(),n=await M();if(!n)return{signed_in:!1,entitled:!1,env:t.env,reason:"not_signed_in",...await Pe()};let r=await ue(n);if(r==="")return{signed_in:!0,entitled:!1,env:t.env,reason:"auth_rejected"};if(r&&!ce())try{let i=(await C())[0],o=await fetch(`${t.supabaseUrl}/functions/v1/v1-billing/v1/billing/entitlement${i?`?machine=${i}`:""}`,{headers:{authorization:`Bearer ${r}`,apikey:t.anonKey},signal:AbortSignal.timeout(se)}).catch(s=>{throw le(),s});if(o.status===401||o.status===403)return{signed_in:!0,entitled:!1,env:t.env,reason:"auth_rejected"};if(o.ok){let{grant:s,...d}=(await o.json()).data;i&&await Ae(s),n.last_entitlement=d,n.last_entitlement_at=Date.now(),await R(n);let m=ae(d,"live");return b={at:Date.now(),status:m},m}}catch{}if(n.last_entitlement&&n.last_entitlement_at&&Date.now()-n.last_entitlement_at<oe){let i=oe-(Date.now()-n.last_entitlement_at);return{...ae(n.last_entitlement,"grace"),grace_remaining_h:Math.round(i/36e4)/10}}return{signed_in:!0,entitled:!1,env:t.env,reason:"offline_grace_expired"}}async function Ae(e){try{if(!e)return await v(A());await T(k()),await D(A(),e)}catch{}}function Oe(e){return e.source==="licence"?`${e.email} \xB7 machine licence (${e.tier}) \u2014 runs offline, no account check`:Le(e)+(e.licence_error?`
|
|
6
|
+
(the machine licence was not used: ${e.licence_error})`:"")}function Le(e){let t=a();if(!e.signed_in)return`not signed in (${t.env})${e.other_env?`; you are signed in to ${e.other_env} only (each server keeps its own sign-in)`:""}. Run the account_login tool, or \`npx -y conformtools@latest login\` in a terminal.`;if(e.reason==="auth_rejected")return"signed-in session was rejected (expired or revoked) \u2014 sign in again with account_login.";if(e.reason==="offline_grace_expired")return"offline for more than 72 h since the last account check \u2014 reconnect and run account_status.";let n=`${e.email??"(unknown email)"} \xB7 ${t.env}`;if(!e.entitled)return`${n}
|
|
7
|
+
no active plan on ${e.email??"this account"}: the trial has ended and there is no subscription. If that is the wrong Google account, run account_logout, then account_login and pick the account with the plan; otherwise choose a plan at ${t.appBase}/pricing, then run account_status.`;let r=e.access==="trial"?`trial, ${e.trial_days_remaining??"?"} day(s) left`:`subscribed${e.tier?` (${e.tier})`:""}`,i=O(e),o=i?` \xB7 includes ${[i.web&&"the web tools",i.mcp&&"the MCP",i.app&&"the app"].filter(Boolean).join(", ")||"the web tools"}`:"";return`${n}
|
|
8
|
+
${r}${o}${e.source==="grace"?` \u2014 offline, using the last check (${e.grace_remaining_h} h of grace left)`:""}`}function O(e){if(e.access==="trial")return Z;let t=(e.tier??"").toLowerCase();return(t==="enterprise"?_.studio:_[t])?.includes??null}var de=()=>pe();function et(e){de=e}async function me(){let e=await de();if(e.entitled)return e;let t=e.signed_in&&e.reason==="not_entitled"?"not_entitled":"not_signed_in";throw new h(t,Oe(e),{account:e})}async function tt(){let e=await me();if(e.source==="licence"||O(e)?.mcp!==!1)return e;throw new h("not_entitled",`The conform.tools MCP is in the MCP plan ($${_.indie.monthly}/mo) and up. Your plan${e.tier?` (${e.tier})`:""} includes Timeline Exchange and Conform Connect on ${a().appBase}, but not the engine on this machine. Upgrade at ${a().appBase}/pricing, then run account_status.`,{account:e,needs:"mcp"})}async function nt(){let e=await me();if(e.source==="licence"||O(e)?.app)return e;throw new h("not_entitled",`The conform.tools app is in the App plan ($${_.pro.monthly}/mo). Your plan${e.tier?` (${e.tier})`:""} does not include the app${O(e)?.mcp?" \u2014 it includes the conform.tools MCP: use it from Claude, Claude Code or any MCP client":""}. Upgrade at ${a().appBase}/pricing, then reopen the app.`,{account:e,needs:"app"})}var S=null;function rt(e={}){if(S)return S;let t=a(),n=crypto.randomUUID().replaceAll("-","");return S=new Promise((r,i)=>{let o=!1,s=c=>{o||(o=!0,clearTimeout(m),setTimeout(()=>d.close(),250),S=null,c())},d=V({hostname:"127.0.0.1",port:0,onListen:async c=>{let p=`${t.appBase}/plugin-auth?client=engine&port=${c}&state=${n}`,f=await q(p);e.onUrl?.(p,f)}},async c=>{let p=new URL(c.url);if(p.pathname!=="/callback")return new Response("not found",{status:404});let f=p.searchParams,U=f.get("access_token")??"",j=f.get("refresh_token")??"",L=!!U&&!!j&&f.get("state")===n;if(L){let B=Number(f.get("expires_at"));await R({env:t.env,access_token:U,refresh_token:j,expires_at:B>0?B:Math.floor(Date.now()/1e3)+3600}),b=null,P=0,pe({force:!0}).then(I=>s(()=>r(I)),I=>s(()=>i(I)))}return new Response(Ie(L),{status:L?200:400,headers:{"content-type":"text/html; charset=utf-8"}})}),m=setTimeout(()=>s(()=>i(new h("not_signed_in","sign-in was not completed within 5 minutes"))),e.timeoutMs??Ee)}),S}async function it(){b=null,P=0,await G(E())&&await v(E()),await v(A()).catch(()=>{});let e=u(g(),"auth.json");try{JSON.parse(await y(e)).env===a().env&&await v(e)}catch{}}function Ie(e){let[t,n]=e?["Connected","You're signed in \u2014 you can close this tab."]:["Sign-in failed","Please try again."];return`<!doctype html><meta charset=utf-8><title>conform.tools</title><body style='font:16px -apple-system,Helvetica,Arial,sans-serif;display:flex;align-items:center;justify-content:center;height:100vh;margin:0;background:#f5f5f7;color:#1d1d1f'><div style='text-align:center'><div style='font-size:22px;font-weight:700'>conform<span style='color:#ff3c00'>.tools</span></div><div style='margin-top:14px;font-size:20px;font-weight:600'>${t}</div><div style='margin-top:6px;color:#6e6e73'>${n}</div></div></body>`}export{Be as a,Fe as b,re as c,a as d,se as e,We as f,Qe as g,pe as h,Oe as i,O as j,et as k,me as l,tt as m,nt as n,rt as o,it as p};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
+
import{a as s,b as m}from"./chunk-DKGGJM6Z.js";import{Ea as d,Ga as n,Y as c,q as u}from"./chunk-C5IX63YF.js";async function x(r){await n();let e=c(r);return e==="null"?null:JSON.parse(e)}async function p(r){await n();let e;try{e=u(r)}catch{return null}if(e.length<8)return null;let t=new DataView(e.buffer,e.byteOffset,e.byteLength),a=t.getUint32(0,!0),i=t.getUint32(4,!0),o=a*i*4;return e.length<8+o?null:{width:a,height:i,rgba:new Uint8ClampedArray(e.subarray(8,8+o))}}async function y(r,e=8){await n();let t=m(d,"decode_dpx_preview");if(!t)return p(r);try{return s(t(r,e))}catch{return null}}export{x as a,p as b,y as c};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
+
import{a as c,b as m}from"./chunk-DKGGJM6Z.js";import{Ea as u,Ga as t,X as s,p as d}from"./chunk-C5IX63YF.js";async function h(r){await t();let e=s(r);return e==="null"?null:JSON.parse(e)}async function g(r){await t();let e;try{e=d(r)}catch{return null}if(e.length<8)return null;let n=new DataView(e.buffer,e.byteOffset,e.byteLength),i=n.getUint32(0,!0),a=n.getUint32(4,!0),o=i*a*4;return e.length<8+o?null:{width:i,height:a,rgba:new Uint8ClampedArray(e.subarray(8,8+o))}}async function y(r,e=8){await t();let n=m(u,"decode_dng_preview");if(!n)return g(r);try{return c(n(r,e))}catch{return null}}export{h as a,g as b,y as c};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
+
var r=null;function t(){return typeof navigator<"u"&&!!navigator.gpu}async function a(){if(!t())return null;try{let e=await navigator.gpu.requestAdapter({powerPreference:"high-performance"});if(!e)return null;let i=await e.requestDevice({requiredLimits:{maxBufferSize:e.limits.maxBufferSize,maxStorageBufferBindingSize:e.limits.maxStorageBufferBindingSize,maxComputeWorkgroupStorageSize:e.limits.maxComputeWorkgroupStorageSize,maxComputeInvocationsPerWorkgroup:e.limits.maxComputeInvocationsPerWorkgroup}}),o=r;return i.lost.then(n=>{console.warn(`[media/gpu] device lost (${n.reason}): ${n.message}`),r===o&&(r=null)}),i}catch(e){return console.warn("[media/gpu] WebGPU unavailable, lanes fall back to WASM:",e),null}}function u(){return r||(r=a()),r}export{u as a};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
+
import{Ba as l,Ga as d}from"./chunk-C5IX63YF.js";var u=[{codec:"prores",label:"Apple ProRes",full:!0,preview:!0,luma:!0,scrubPreview:!0,backend:"wasm",notes:"preview tier is DC-only 1/8 COLOR (2026-08-05 \u2014 was gray luma; Y+Cb+Cr DC walks, no AC/IDCT) \u2014 the realtime tier for BOTH playback and scrub: full 4K XQ decode is ~170ms/frame + a 35MB RGBA hand-off, which can hold neither 24fps nor a smooth scrub; the parked frame upgrades to full via the standard 160ms park timer (scrubPreview flipped true 2026-08-05 with the colour preview \u2014 the old 'full decode is scrub-fast' held for 2K 422, not 4K XQ). Both wrappers: .mov (sample table) and MXF OP1a (RDD 44, 2026-07-28 \u2014 is_prores_mxf routes the identical icpf bitstream through the walker via decode_prores_mxf; Suite ap4h fixture gated byte-exact vs ffmpeg 10-bit, rust tests/prores_mxf_gate.rs)"},{codec:"prores_raw",label:"Apple ProRes RAW",full:!0,preview:!0,luma:!0,scrubPreview:!0,backend:"wasm",notes:"preview tier is a TRUE DC-only Bayer decode: the DC-DPCM segment is a strict prefix of each tile component's bitstream, so the preview reads just those prefixes (no AC walk, no IDCT), lands the exact closed-form value the full IDCT produces, and runs the SAME develop on the 1/8 grid (tier_parity gate). Decode = Apple's own reconstruction (RE'd from AppleProResRAWCodec.bundle 2026-10-22): bit-exact vs VideoToolbox's software decode on iPhone 17 Pro / Sony a7S III / Panasonic; the ffmpeg 8.0 byte-exact path remains as decode_bayer. Develop = the ProRes RAW SDK as DaVinci Resolve runs it (kernels transcribed from its Metal AIR, parameters RE'd from Resolve and captured live): noise-gated edge-directed demosaic, mired-interpolated per-CCT WB + forward matrix from the moov (iPhone; header colour otherwise), Apple Log / Apple Wide Gamut output matching a Resolve 21 render to f32 rounding (97.9% of 10-bit codes identical end to end; the rest is Resolve's hardware-decode LSB noise). Viewer tiers render ACEScct log (2026-07-26 \u2014 no baked Rec.709/sRGB; the transcode-grade log form); decode_prores_raw_tier takes the clip's container colour."},{codec:"h264",label:"H.264 / AVC",full:!0,preview:!0,luma:!1,scrubPreview:!0,backend:"webcodecs",notes:"scrub = nearest-keyframe snap (1 decode); exact frame on park"},{codec:"hevc",label:"HEVC / H.265",full:!0,preview:!0,luma:!1,scrubPreview:!0,backend:"webcodecs",notes:"scrub = nearest-keyframe snap (1 decode); exact frame on park"},{codec:"xavc",label:"Sony XAVC-Intra",full:!0,preview:!1,luma:!1,scrubPreview:!1,backend:"webcodecs",notes:"all-intra; already scrub-fast"},{codec:"h264_mxf",label:"H.264 long-GOP (MXF)",full:!0,preview:!0,luma:!1,scrubPreview:!0,backend:"webcodecs",notes:"Camera proxies (Sony CTAPA and kin): H.264 High long-GOP in MXF OP1a. SEPARATE from 'xavc' because XAVC-Intra is all-intra and this is not \u2014 measured on a 1224-frame CTAPA proxy: IBBP, I every 12, but a true RAP (index flag 0x80) only every 48; the intervening I-frames are open-GOP (flag 0x40) and are NOT legal entry points. Decoded by LongGopPlayer: walk the GOP from its RAP, first AU 'key' and the rest 'delta', outputs taken in EMISSION order (WebCodecs owns the B-frame reorder, so the index's temporal_offset is never interpreted). Whole GOP is cached, so any scrub inside those 2s is free. Until 2026-08-10 these files were misidentified as xavc and decoded one isolated AU at a time (submit + flush), so every P/B frame hit a decoder with no reference state, only the leading IDR ever decoded, and the viewer showed frame 0 forever. Gated by oracle/i2o/e2e/mxf-longgop-playback.spec.ts against ffmpeg"},{codec:"r3d",label:"RED R3D",full:!0,preview:!0,luma:!0,scrubPreview:!0,backend:"wasm",notes:"Full + preview render NATIVE RWG/Log3G10 (2026-07-26 \u2014 IPP2 output LUT removed from decoders; display transforms are downstream)"},{codec:"arriraw",label:"ARRIRAW",full:!0,preview:!0,luma:!0,scrubPreview:!0,backend:"wasm",notes:"EVERY STAGE BYTE-EXACT vs the ARRI SDK (2026-07-27): prep, the ADA-7 demosaic (0 of 15,690,240), the LuMaTaLu colour kernel (0 of 31,457,280 \u2014 closed by transcribing the SDK's own f32 op order: the LUT index is fmul-then-fadd not a fused mul_add, the B-spline weights are evaluated expanded with the sixth applied last, and the bicubic accumulates columns before rows), the 1:1 resample (identity) and AfaScaler+BufferScaler (0 of 43,739,136). The shipped master still omits AfaScaler's Rec.709 YCbCr detail and its Jenkins-hash grain \u2014 added looks, not native signal \u2014 so the end-to-end floor gate vs the SDK's DEFAULT output reads 0.16/255; colour is no part of that number. exact AWG4/LogC4 develop (2026-07-21, vs ARRI SDK); preview is colour via the same per-clip develop plan (tier gate corr \u22650.997). Pre-A35 12-bit ALEV-III (Mini/Mini LF) fully wired 2026-07-26: Gen2 develop to native AWG3/LogC3, SDK-gated MAE<0.8/255, probe inner_codec 'arriraw-alev3' \u2192 decode_arriraw12_mxf; other ALEV3 bodies decode flagged calib:parametric-alev3-family-unvalidated"},{codec:"dnxhr",label:"Avid DNxHR / DNxHD",full:!0,preview:!0,luma:!0,scrubPreview:!0,backend:"wasm",notes:"DC-only 1/8 preview tier is COLOR (2026-08-05 \u2014 was gray luma) \u2014 playback + scrub ride it (4K/UHD DNxHR full decodes aren't scrub-fast); park upgrades to full"},{codec:"crm",label:"Canon Cinema RAW Light",full:!0,preview:!0,luma:!0,scrubPreview:!0,backend:"wasm",notes:"preview LL tier develops through the SAME tone-exact Canon Log 2 path as Full (2026-07-26 \u2014 replaced the placeholder tone map that drifted -46/255)"},{codec:"braw",label:"Blackmagic RAW",full:!0,preview:!0,luma:!0,scrubPreview:!0,backend:"wasm",notes:"per-clip WB develop (bmdf wkel/wtin \u2192 wb_grid tables; Pocket-6K-family sweep-validated); preview is COLOUR-accurate native Gen5 log (gate corr \u22650.996 vs downsampled full). ENTROPY-PROFILE GATED PER FRAME (rust braw::PROFILES): the frame-header ladder selects one of four separately-compiled SDK decoder families AND its dequant table, and it is per-frame rate-control output \u2014 NOT a per-clip constant (the old 'compression base' model was wrong; two encodes off the same PYXIS body carry different ladders). A frame whose exact ladder we have not captured tables for is refused with calib:unsupported-entropy-profile rather than decoded on a neighbouring quantiser. Captured profiles: (0,0,0,1) C013/C060 8\xD78 byte-exact; and the 12\xD712 family (SHIPPED 2026-07-26) \u2014 (1,2,3,4) URSA 12K, plus BOTH PYXIS encodes (0,1,2,4) and (0,0,1,2), which are the same camera at the same raster with quantisers half a step apart. That family is 12\xD712 luma / 12\xD76 chroma, 2 luma + Cb + Cr per unit off one threaded bit-reader; all four walks (full, multithreaded, DC preview, colour preview) are parametric over it. GRAIN + EDGE FILTER MODELLED 2026-07-26 \u2014 the decode is now essentially the SDK's literal output: the synthesized high-frequency PRNG grain is reproduced (scatter map verified 0 mismatches over 76,896 observations across two clips), its per-frame seed turns out to be carried IN the bitstream (16 BE bytes before the first tile) and re-seeded per tile as s1 ^= broadcast16(region<<5|vtile), and the post-IDCT block-edge filter (A*b + B*(a+c) >> 4) is applied. The filter's per-block STRENGTH byte is solved too (2026-07-26): it is transmitted, not derived - each unit ends with a [ctx+0x68]-bit field on its own reader (the skip the walk used to call 'hf_bias' and discard), packing four 2-bit weight selectors per block (bits 7:6/5:4 = the horizontal cut's two 6-px column spans, 3:2/1:0 = the vertical cut's two 6-px row spans); and the four weights are master[ladder[k]] with master[i] = (16-2i, i), so the header ladder IS the deblock strength ramp and no future profile needs a capture for it. BRAW IS BYTE-EXACT (2026-07-26). Frame-gated vs the SDK's own decoded.bin, through BOTH the oracle bitstream and the real .braw container path: all four captures \u2014 C060 (8x8), URSA 12K, and both PYXIS encodes \u2014 now differ from the SDK in ZERO samples, luma and chroma alike, across 208,099,712 luma samples; the gates assert max == 0 rather than a mean bound, because a tolerance cannot tell 'clean' from 'one wrong block in 400,000'. The last drift (11,248 URSA pixels off by one, ~0.014%) was never a modelling gap: the SDK computes an Arai-Agui-Nakajima SCALED DCT \u2014 coefficients premultiplied by s[u]*s[v] = c(k)/(2*cos(k*pi/2N)), then a unit-scale radix-3 x radix-4 butterfly \u2014 so a dense basis multiply is the same function through a DIFFERENT operation graph and rounds differently in f32, which is why f32, f32+FMA and f64 all missed. Both transforms (luma 12x12 @0x6e9c8, chroma 12x6 @0x6fc68) are now the SDK's literal dataflow, machine-transcribed by oracle/media/braw/t12_transcribe.py \u2014 a symbolic byte-slot emulator of the unrolled NEON \u2014 into the generated rust/media-core/src/codecs/braw_t12_idct.rs. The 8x8 family gains the same seed fix (whole-frame grain, no captured constant) AND the same edge filter: it was never a different algorithm, only a different compiled copy (@0x6b6a4) whose ladder (0,0,0,1) resolves to three identities plus one weak tap - C060 Y 1.76 -> 0.003. Also solved by censusing where the residual sat: the SDK runs horizontal before vertical; a vertical cut is governed by the block to its LEFT; the frame's final vertical cut is not filtered (the SDK handles cuts in pairs and drops the pair whose second cut leaves the frame); and the 8x8 byte is a nibble per block (7:6 h / 5:4 v for block 0, 3:2 h / 1:0 v for block 1). Both PYXIS profiles now carry captured grain quantisers (the PARIS original's were read once its volume was remounted). Also gated: the multithreaded walk is byte-identical to single-threaded, and both preview tiers are exact block means of the full decode (corr 1.0000). Still refused: Pocket 6K C040 (2,3,4,4) = a fourth algorithm. See oracle/media/braw/ENTROPY_PROFILE_RE.md"},{codec:"xocn",label:"Sony X-OCN",full:!0,preview:!0,luma:!0,scrubPreview:!0,backend:"wasm",notes:"Full + preview render NATIVE S-Gamut3/S-Log3 (2026-07-26 \u2014 replaced the adaptive display transform); preview = LL-band-only decode (~1/8 per axis, ~90x faster), colour-consistent with Full by construction. Fitted sensors: Burano LT/8K (SBRg), Venice ST (SBRe), VENICE 2 8.6K (SBRf, 2026-07-26 \u2014 decodes via the same parametric geometry, own C0_VENICE2 matrix R\xB2\u22650.9994). X-OCN IS BYTE-EXACT ACROSS MODES (2026-07-27): LT 6K, Venice ST and Burano 8K all decode to ZERO differing samples vs libSonyRawDev's own decoder output \u2014 86,293,760 samples over the three, gated in tests/xocn_variant_gate.rs against hashes of the SDK's planes. Venice ST and 8K previously lost their top and bottom rows (28 and 12 rows; the interiors were already exact) because the band row ranges were formulas in the LL strip count n, read off the LT capture (y0=10, y1=8n-2 and friends) \u2014 those hold only when 8n == h + 12, which is an LT coincidence. The real rule (xocn::phase_chain): the standalone band carries the frame's h rows CENTRED in its 8n coded rows, and every coarser level is the even subset of the level below, so lo = a[k] and y14 = a[k] + n[k] fall out per level and reproduce LT's captured constants exactly. Settled by MEASURING the bitstream \u2014 strips are byte-aligned, so the row count of a strip is the count whose decode consumes its byte size (harness xocnstrip) \u2014 not by sweeping constants. The write-side dy row shift that used to paper over the phase is gone. SBRf/VENICE 2 decodes through the same path but is not yet re-gated byte-exact (fixture on PARIS)"}],f=new Map(u.map(t=>[t.codec,t]));function a(t){let e=(t??"").toLowerCase().trim();return e?e==="aprn"||e==="aprh"?"prores_raw":e==="prores_mxf"||e.startsWith("ap")?"prores":e==="arriraw-alev3"?"arriraw":e==="avc1"||e==="avc3"||e==="h264"?"h264":e.startsWith("hvc")||e.startsWith("hev")||e==="h265"?"hevc":e.startsWith("avd")||e==="dnxh"||e==="dnxhd"?"dnxhr":e==="redcode"?"r3d":f.has(e)?e:null:null}function m(t){let e=(t??"").toLowerCase().trim();if(!e)return null;if(e==="aprn"||e==="aprh"||a(e)==="prores_raw"||e==="ap4h"||e==="ap4x")return 12;if(e.startsWith("ap"))return 10;let r=a(e);return r==="r3d"?16:r==="arriraw"||r==="braw"?12:r==="xocn"?16:r==="crm"?12:/dnxhr.?(hqx|444)/.test(e)?10:null}function b(t,e){if(typeof e!="number")return null;let r=a(t);return r==="h264"?[66,77,88,100].includes(e)?8:e===110?10:null:r==="hevc"?e===1?8:e===2?10:null:null}function w(t){let e=(t??"").toLowerCase().trim();if(!e)return null;if(e==="ap4h"||e==="ap4x")return"4:4:4";let r=a(e);return r==="prores_raw"||r==="r3d"||r==="arriraw"||r==="braw"||r==="xocn"||r==="crm"?"bayer":r==="prores"?"4:2:2":/dnxhr.?444/.test(e)?"4:4:4":/dnxhr.?(hqx|hq|sq|lb)/.test(e)?"4:2:2":null}function v(t){let e=t.toLowerCase().replace(/[^0-9a-z]/g,"");return e==="bayer"||e==="raw"?"bayer":e.length>=3&&/^\d+$/.test(e)?e.split("").join(":"):e}function c(t){let e=a(t);return e==="prores"||e==="h264"||e==="hevc"?e:"other"}var h={prores:"ProRes",h264:"H.264",hevc:"HEVC",r3d:"R3D",arriraw:"ARRIRAW",xocn:"X-OCN",vc3:"DNxHR",braw:"BRAW",proresraw:"ProRes RAW",other:"unsupported"};function y(t){return h[t]??"unsupported"}function p(t){let e=JSON.parse(t),r=e.frames??[],o=r.length>>1,s=new Array(o);for(let n=0,i=0;i<o;n+=2,i++)s[i]={offset:r[n],size:r[n+1]};return{offs:s,codec:e.codec,kind:c(e.codec),w:e.width,h:e.height,fps:e.fps??null,startFrame:e.start_frame??0,dropFrame:e.drop_frame??!1}}async function E(t){await d();let r=await l((o,s)=>t.slice(o,o+s).arrayBuffer().then(n=>new Uint8Array(n)),t.size,"mov");return p(r)}export{a,m as b,b as c,w as d,v as e,y as f,p as g,E as h};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
+
function r(n){let e=-1;for(let o of n)(o.kind==="frame"||o.kind==="gop"||o.kind==="audio")&&o.frame_out!=null&&(e=Math.max(e,o.frame_out));return e+1}function t(n){return n.some(e=>e.kind==="gop")?"gop":n.some(e=>e.kind==="audio")?"second":"frame"}export{r as a,t as b};
|