conformtools 0.6.9 → 0.6.10

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.
Files changed (103) hide show
  1. package/dist/account-GFIQC77T.js +3 -0
  2. package/dist/analysis-engine-4K5K6L53.js +3 -0
  3. package/dist/{bridge-SX5TW4LC.js → bridge-73XMEZLH.js} +1 -1
  4. package/dist/browser/timeline_core_bg.wasm +0 -0
  5. package/dist/chunk-2MJAQROY.js +5 -0
  6. package/dist/{chunk-TXQR2HI2.js → chunk-56EEBHP2.js} +1 -1
  7. package/dist/{chunk-GM6QKY7W.js → chunk-6HZP2OJA.js} +1 -1
  8. package/dist/{chunk-VIBEEWPC.js → chunk-7QUSVHO2.js} +2 -2
  9. package/dist/chunk-CJYLQ3UM.js +5 -0
  10. package/dist/chunk-DFDXSIMI.js +39 -0
  11. package/dist/{chunk-3D3Z4TBR.js → chunk-DGXZB7MO.js} +1 -1
  12. package/dist/{chunk-PLRB2YXJ.js → chunk-DNS4ZYIO.js} +1 -1
  13. package/dist/chunk-DPA26AOI.js +3 -0
  14. package/dist/chunk-E5ENIKNR.js +7 -0
  15. package/dist/{chunk-A7FNR3T5.js → chunk-EEDLRRKU.js} +1 -1
  16. package/dist/{chunk-GTJ3EM6H.js → chunk-GM262EDM.js} +1 -1
  17. package/dist/{chunk-D4WPRRBT.js → chunk-ISKNIQVO.js} +1 -1
  18. package/dist/chunk-JHTMYXJM.js +20 -0
  19. package/dist/chunk-JKOB3U54.js +3 -0
  20. package/dist/{chunk-2BPR6LK6.js → chunk-JXTRQ3UG.js} +1 -1
  21. package/dist/chunk-NQNS4Y2B.js +3 -0
  22. package/dist/chunk-QHXX5GDD.js +440 -0
  23. package/dist/{chunk-NFJHWZJX.js → chunk-TDIY4NRQ.js} +1 -1
  24. package/dist/chunk-UGVGRL5M.js +3 -0
  25. package/dist/chunk-WJ5EWXP2.js +3 -0
  26. package/dist/chunk-XDI6CPPV.js +3 -0
  27. package/dist/chunk-XJNWAQON.js +7 -0
  28. package/dist/chunk-Y2QHZUGL.js +5 -0
  29. package/dist/{chunk-GK4YYKJ6.js → chunk-YC7QDS5U.js} +2 -2
  30. package/dist/chunk-YUO3UWPH.js +3 -0
  31. package/dist/chunk-ZVUKOFUX.js +6 -0
  32. package/dist/{claude-setup-IIWUB4CE.js → claude-setup-OKOPPDMB.js} +1 -1
  33. package/dist/cli.js +2 -2
  34. package/dist/conformtools-analyze +0 -0
  35. package/dist/conformtools-decode +0 -0
  36. package/dist/{cr3-wasm-HLJWEV2S.js → cr3-wasm-NYCB34ND.js} +1 -1
  37. package/dist/{dng-wasm-CQDLPM5V.js → dng-wasm-XCPPBXPZ.js} +1 -1
  38. package/dist/{dpx-wasm-TLGMM7BO.js → dpx-wasm-XACWNFPB.js} +1 -1
  39. package/dist/engine-274GQLUB.js +5 -0
  40. package/dist/{exr-wasm-2NPKPTVB.js → exr-wasm-FQBUR6QT.js} +1 -1
  41. package/dist/flame/hook/conformtools_flame/verbs.py +9 -9
  42. package/dist/framing-BKTUEUZO.js +3 -0
  43. package/dist/gfx-worker.js +1 -1
  44. package/dist/{h264-JJMZSUWW.js → h264-B2TLLEMI.js} +1 -1
  45. package/dist/{h264-mxf-DCUOGLDU.js → h264-mxf-3GED5PBT.js} +1 -1
  46. package/dist/host-relink-PTV44KXF.js +10 -0
  47. package/dist/hosts-D3TR2QEV.js +3 -0
  48. package/dist/http.js +2 -2
  49. package/dist/{inspect-FJKYPEXL.js → inspect-D3WEYL2W.js} +3 -3
  50. package/dist/{isobmff-VJOWP4MH.js → isobmff-C5A2EFKH.js} +1 -1
  51. package/dist/{mc-video-5MGGOQN4.js → mc-video-ARKIHPA7.js} +1 -1
  52. package/dist/mcp.js +1 -1
  53. package/dist/{media-NZYVREUF.js → media-3YMIZSSF.js} +1 -1
  54. package/dist/media_core-XOKN7UUF.js +9 -0
  55. package/dist/mxf-CQSI6H5T.js +3 -0
  56. package/dist/nuke/panel/python/conformtools_nuke/verbs.py +5 -5
  57. package/dist/{ops-X7NAREC4.js → ops-BCTGDBXT.js} +1 -1
  58. package/dist/peer-kit/ctpeer/__init__.py +1 -1
  59. package/dist/peer-kit/ctpeer/neutral.py +10 -10
  60. package/dist/premiere-uxp/lib/edit.js +94 -9
  61. package/dist/premiere-uxp/lib/markers.js +12 -11
  62. package/dist/premiere-uxp/lib/probe.js +6 -3
  63. package/dist/premiere-uxp/lib/verbs.js +1 -1
  64. package/dist/premiere-uxp/manifest.json +1 -1
  65. package/dist/{probe-F7WQHMIA.js → probe-COWUTQGN.js} +1 -1
  66. package/dist/{r3d-T5O6IIZZ.js → r3d-FX7V4BIE.js} +1 -1
  67. package/dist/{r3d-CXUNG6VS.js → r3d-I6EYEYX7.js} +1 -1
  68. package/dist/resolve-bridge.py +725 -88
  69. package/dist/sequence-patch-JVEZW24V.js +3 -0
  70. package/dist/{still-P4JJNTEO.js → still-WUCFH2WX.js} +1 -1
  71. package/dist/{still-wasm-DN5LPASS.js → still-wasm-RTPOMH7S.js} +1 -1
  72. package/dist/store-SZKXADGI.js +3 -0
  73. package/dist/{tiff-wasm-BPRDR6EB.js → tiff-wasm-N2S267IA.js} +1 -1
  74. package/dist/timeline-PEUC3G7K.js +3 -0
  75. package/dist/timeline_core-ZKQQHUA2.js +3 -0
  76. package/dist/wasm/media_core_bg.wasm +0 -0
  77. package/dist/wasm-threads/media_core_bg.wasm +0 -0
  78. package/dist/{wav-64SC6P7U.js → wav-HSCUCY4U.js} +1 -1
  79. package/package.json +1 -1
  80. package/dist/account-M53GEV7P.js +0 -3
  81. package/dist/chunk-5BSXYKLN.js +0 -20
  82. package/dist/chunk-623EA3TK.js +0 -6
  83. package/dist/chunk-AMRJXYL4.js +0 -3
  84. package/dist/chunk-DQGINJDV.js +0 -5
  85. package/dist/chunk-GRQJGEGV.js +0 -378
  86. package/dist/chunk-HNBA43BF.js +0 -5
  87. package/dist/chunk-J2JXLEAI.js +0 -3
  88. package/dist/chunk-MWDF2R26.js +0 -7
  89. package/dist/chunk-PFISREY4.js +0 -3
  90. package/dist/chunk-QVH44I66.js +0 -39
  91. package/dist/chunk-RJ6JA2LZ.js +0 -3
  92. package/dist/chunk-SGLQY53R.js +0 -3
  93. package/dist/chunk-WN53ARHJ.js +0 -3
  94. package/dist/chunk-XCKQHL4G.js +0 -9
  95. package/dist/engine-P6H5P6HP.js +0 -5
  96. package/dist/framing-3XIVHSUZ.js +0 -3
  97. package/dist/host-relink-UWML4C7W.js +0 -10
  98. package/dist/hosts-SRS5TEM6.js +0 -3
  99. package/dist/media_core-YZ3PABEG.js +0 -9
  100. package/dist/mxf-FJSRFLJC.js +0 -3
  101. package/dist/store-53BBZBND.js +0 -3
  102. package/dist/timeline-C3OZJBCZ.js +0 -3
  103. package/dist/timeline_core-IOENXK4Z.js +0 -3
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{A as d,Y as f,k as u,v as c,x as l,y as p}from"./chunk-PLRB2YXJ.js";import o from"node:process";import{readFileSync as y,rmSync as g}from"node:fs";import{createConnection as h}from"node:net";var w=new Set(["tool_run","app","tool"]),s=()=>f(u(),"engine.json");async function k(e,r){await p(u()),await l(s(),JSON.stringify({port:e,token:r||void 0,pid:o.pid})),await d(s(),384);for(let t of["SIGINT","SIGTERM"])o.on(t,()=>o.exit(0));o.on("exit",()=>{try{JSON.parse(y(s(),"utf8")).pid===o.pid&&g(s())}catch{}})}function S(e,r=1500){return new Promise(t=>{let n=h({host:"127.0.0.1",port:e}),i=m=>{clearTimeout(a),n.destroy(),t(m)},a=setTimeout(()=>i(!1),r);n.once("connect",()=>i(!0)).once("error",()=>i(!1))})}async function I(e,r){if(!w.has(e))return null;let t;try{t=JSON.parse(await c(s()))}catch{return null}if(t.pid===o.pid||!await S(t.port))return null;let n;try{n=await fetch(`http://127.0.0.1:${t.port}/verbs/${e}`,{method:"POST",body:JSON.stringify(r),headers:{"content-type":"application/json",...t.token?{authorization:`Bearer ${t.token}`}:{}}})}catch{return null}if(n.status===401||n.status===404)return null;let{text:i,...a}=await n.json();return{content:[{type:"text",text:i??""}],structuredContent:a,isError:!n.ok}}export{k as a,I as b};
3
+ import{A as d,Z as f,k as u,v as c,x as l,y as p}from"./chunk-DNS4ZYIO.js";import o from"node:process";import{readFileSync as y,rmSync as g}from"node:fs";import{createConnection as h}from"node:net";var w=new Set(["tool_run","app","tool"]),s=()=>f(u(),"engine.json");async function k(e,r){await p(u()),await l(s(),JSON.stringify({port:e,token:r||void 0,pid:o.pid})),await d(s(),384);for(let t of["SIGINT","SIGTERM"])o.on(t,()=>o.exit(0));o.on("exit",()=>{try{JSON.parse(y(s(),"utf8")).pid===o.pid&&g(s())}catch{}})}function S(e,r=1500){return new Promise(t=>{let n=h({host:"127.0.0.1",port:e}),i=m=>{clearTimeout(a),n.destroy(),t(m)},a=setTimeout(()=>i(!1),r);n.once("connect",()=>i(!0)).once("error",()=>i(!1))})}async function I(e,r){if(!w.has(e))return null;let t;try{t=JSON.parse(await c(s()))}catch{return null}if(t.pid===o.pid||!await S(t.port))return null;let n;try{n=await fetch(`http://127.0.0.1:${t.port}/verbs/${e}`,{method:"POST",body:JSON.stringify(r),headers:{"content-type":"application/json",...t.token?{authorization:`Bearer ${t.token}`}:{}}})}catch{return null}if(n.status===401||n.status===404)return null;let{text:i,...a}=await n.json();return{content:[{type:"text",text:i??""}],structuredContent:a,isError:!n.ok}}export{k as a,I as b};
@@ -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 F}from"./chunk-PHAMF4JF.js";import{B as R,C as g,D,I as $,W as k,Z as i,k as b,q as x,r as p,v as S,x as _,y as m,z as v}from"./chunk-DNS4ZYIO.js";var A="_originalframes",y="zAPPLIED_PATCHES",u=t=>t.replace(/[\\/][^\\/]+[\\/]?$/,""),T=()=>i(b(),"move-undo");async function P(t){let n=[];for await(let a of $(t))a.isFile&&!a.name.startsWith(".")&&n.push(a.name);return n.sort()}async function O(t){let n=[];for await(let a of $(u(t)))a.isDirectory&&/patch/i.test(a.name)&&a.name!==y&&n.push(a.name);return n.sort()}async function C(t,n){let a=new Set(await P(t)),e=[];for(let r of n){let s=i(u(t),r);if(await p(s))for(let w of await P(s))e.push({file:w,folder:r,replaces:a.has(w)})}return e}async function j(t,n,a){if(!await p(t)||!(await x(t)).isDirectory)throw new F("invalid_args",`not a folder: ${t}`);let e=u(t),r=[],s=[];for(let o of await C(t,n)){if(a&&!a.has(`${o.folder}/${o.file}`))continue;if(!o.replaces){r.push(`${o.file}: not in the sequence`);continue}let f=i(t,o.file),c=i(e,o.folder,o.file),l=`${t}${A}`,d=i(l,o.file);for(let h=1;await p(d);h++)d=i(`${t}${A}${String(h).padStart(2,"0")}`,o.file);await m(u(d));try{await g(f,d)}catch(h){r.push(`${o.file}: ${h.message}`);continue}try{await R(c,f)}catch(h){await g(d,f).catch(()=>{}),r.push(`${o.file}: ${h.message}`);continue}s.push({file:o.file,backup:d,patch_src:c,applied:c,folder:o.folder}),l=""}let w=[];if(s.length){let o=i(e,y);await m(o);for(let f of new Set(s.map(c=>c.folder))){let c=i(o,f);for(let l=1;await p(c);l++)c=i(o,`${f}_${l}`);try{await g(i(e,f),c),w.push({from:i(e,f),to:c});for(let l of s)l.folder===f&&(l.applied=i(c,l.file))}catch(l){r.push(`${f}: not filed under ${y} (${l.message})`)}}}if(!s.length)return{patched:0,errors:r};let E=`files-${Date.now().toString(36)}`;return await m(T()),await _(i(T(),`${E}.json`),JSON.stringify({patch:!0,sequence:t,entries:s.map(({folder:o,...f})=>f),folders:w})),{patched:s.length,errors:r,undo_id:E}}async function J(t){let n=[];for(let e of t.folders)await p(e.to)&&!await p(e.from)&&await g(e.to,e.from).catch(r=>n.push({path:e.to,error:r.message}));let a=0;for(let e of t.entries){let r=i(t.sequence,e.file);if(await p(e.backup))try{await p(r)&&await v(r),await g(e.backup,r),a++}catch(s){n.push({path:r,error:s.message})}}for(let e of new Set([...t.entries.map(r=>u(r.backup)),...t.folders.map(r=>u(r.to))]))if(await p(e)&&!(await P(e)).length){let r=!0;for await(let s of $(e)){r=!1;break}r&&await D(e).catch(()=>{})}return{restored:a,failed:n}}var L=t=>k(t),U=async t=>JSON.parse(await S(t));export{A as a,y as b,O as c,C as d,j as e,J as f,L as g,U 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
+ import{Ia as r,X as s,o}from"./chunk-DPA26AOI.js";async function d(t){await r();let e=s(t);return e==="null"?null:JSON.parse(e)}async function l(t){await r();let e;try{e=o(t)}catch{return null}if(e.length<8)return null;let n=new DataView(e.buffer,e.byteOffset,e.byteLength),a=n.getUint32(0,!0),i=n.getUint32(4,!0),u=a*i*4;return e.length<8+u?null:{width:a,height:i,rgba:new Uint8ClampedArray(e.subarray(8,8+u))}}export{d as a,l as b};
@@ -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{Da as d,Ia as l}from"./chunk-DPA26AOI.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 color 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 color 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 color."},{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; FALLBACK (2026-10-27): where WebCodecs is absent or refuses the config (Firefox + HEVC, Chrome without HEVC hardware, most 4:2:2 10-bit), and for containers the TS players cannot walk (MKV/WebM, raw Annex-B, fragmented MP4), the identify chain labels the clip 'h264_wasm' and media-core's own decoder answers through the mcvideo lane (wasm video_open/video_decode \u2014 rust video::lane, gated byte-exact vs ffmpeg in tests/h264_mov_gate.rs / hevc_gate.rs / annexb_gate.rs); WebCodecs stays first"},{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; FALLBACK (2026-10-27): where WebCodecs is absent or refuses the config (Firefox + HEVC, Chrome without HEVC hardware, most 4:2:2 10-bit), and for containers the TS players cannot walk (MKV/WebM, raw Annex-B, fragmented MP4), the identify chain labels the clip 'hevc_wasm' and media-core's own decoder answers through the mcvideo lane (wasm video_open/video_decode \u2014 rust video::lane, gated byte-exact vs ffmpeg in tests/h264_mov_gate.rs / hevc_gate.rs / annexb_gate.rs); WebCodecs stays first"},{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 color 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; color is no part of that number. exact AWG4/LogC4 develop (2026-07-21, vs ARRI SDK); preview is color 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). PER-FRAME HEADER LAW (2026-10-27, rust braw::frame_law): family, dequant tables, grain quantisers and edge-strength width are computed from each frame's own header exactly as BlackmagicRawAPI does \u2014 transcribed from the 5.1 binary (dequant builder 0xb98d4: luma M*(qi+4)/32, chroma M*max((qi+5)>>1,4)/32, transposed, DC capped by hdr +0x20/+0x22; M = the frame's in-header matrix (Pocket 6K v2 headers) or a built-in bank entry picked by +0x24; grain setup 0x50358: lo = trunc(hdr+0x1c*40/119), hi = 2*lo, chroma = trunc(hdr+0x1e*80/119); driver select 0x50490 from version/type/strength width). It reproduces all six previously captured quantiser pairs and both Pocket 6K grain captures bit for bit. The ladder only sets the deblock ramp, and ladder AND quant index change frame to frame inside a clip (SAN census: 10,959 frames, 8 ladders, qi 0..53 on one Pocket 6K), so the old ladder-keyed registry (now a witness list, braw::PROFILES) was refusing most Pocket 6K frames and mis-decoding others. A frame is refused with calib:unsupported-entropy-profile only when its header resolves to a decoder driver not yet transcribed. Byte-exact frame gates: (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, color 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). Pocket 6K (driver sym1569, single-context scan-wrapping core, inline transforms) byte-exact at qi 7 and qi 27 (C040); the SAN Pocket 6K frames at every other ladder (incl. C030's (0,2,3,4) qi 11) decode through the same driver on law-derived tables \u2014 their SDK frame gates (tests/braw_san_law.rs) pass byte-exact (2026-10-27: all 10 SAN frames \u2014 nine Pocket 6K across eight ladders, qi 4..44, plus C104 f567 \u2014 differ from the 5.1 SDK in zero Y/Cb/Cr samples). URSA 12K 8:1-type header (v5, flags 0x0914: type 3) DECODED BYTE-EXACT (2026-10-27): the SDK decodes it at full resolution through its SCALE-1 driver 0x66fdc (the scale-0 row, 0x65248, only parses), which is sym1575 apart from its tables \u2014 6\xD712 coded blocks become 8\xD78 / 8\xD74 output blocks (12336\xD74032 coded \u2192 8224\xD75376), three sub-streams in a four-slot offset table, early-stopping entropy cores 0x735fc / 0x7392c, type-3 prescale rows into the shared 8\xD78 IDCT, inline chroma butterfly. Gated against the 5.1 SDK on both SAN clips (A003_09021503_C013 f0/f70, A005_09021941_C016 f0/f121): 0 differing Y/Cb/Cr samples; multithreaded walk identical. Two fixes landed with it for every 8\xD78 family: the shared IDCT's pass-1 c0 tap is unfused for coefficient columns 4..7, and the chroma grain pre-load (GRAIN_CHROMA8) + the inline chroma butterfly (Cb copy fused, Cr copy not) replace a never-gated matrix form. SAN census: 10,959 / 10,959 frames now resolve to a transcribed driver. See oracle/media/braw/ENTROPY_PROFILE_RE.md \xA714"},{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)"},{codec:"mpeg2",label:"MPEG-2 / MPEG-1",full:!0,preview:!0,luma:!0,scrubPreview:!1,backend:"wasm",notes:"media-core's own decoder (2026-10-27): XDCAM HD422/EX, HDV, IMX, DVD and broadcast streams in MXF / MOV / PS / TS / ES / AVI through the mcvideo lane (video_open/video_decode, rust video::lane \u2192 video::mpeg2_range): long-GOP from the I frame before the window, display order from the stream's own temporal references; a miss decodes a window of frames and keeps it. decode_mpeg2_{rgba,preview,luma} are the I-frame sample tiers (DC-only 1/8 color preview). Gated sample-identical to ffmpeg (tests/mpeg2_gate.rs)"},{codec:"dv",label:"DV / DVCPRO / DVCPRO HD",full:!0,preview:!0,luma:!0,scrubPreview:!0,backend:"wasm",notes:"media-core's own decoder (2026-10-27), all-intra: DV25 / DVCPRO50 / DVCPRO HD in MXF / MOV / AVI / raw .dv through the mcvideo lane; scrub rides the DC-only 1/8 color preview, park upgrades to full. decode_dv_{rgba,preview,luma} are the frame tiers. Gated vs ffmpeg (tests/dv_gate.rs)"},{codec:"qtraw",label:"QuickTime raw / Animation / Motion-JPEG",full:!0,preview:!1,luma:!1,scrubPreview:!1,backend:"wasm",notes:"media-core's codecs::qtraw through the mcvideo lane (2026-10-27): uncompressed raw/2vuy/v210, Animation (rle \u2014 a delta codec, painted forward from the sync sample before the window), Motion-JPEG (jpeg/mjpa/AVDJ/dmb1 on media-core's JPEG decoder, the JPEG's own raster); clean aperture applied. No browser decodes any of them. Gated vs ffmpeg (media-native mov_simple tests; RGB/Animation lossless-identical)"},{codec:"legacy",label:"Legacy & web video (MPEG-4 Part 2, H.263 / Sorenson, DivX 3, VC-1 / WMV, VP6, Cinepak, SVQ3, AV1)",full:!0,preview:!1,luma:!1,scrubPreview:!1,backend:"wasm",notes:"media-core's legacy decoders through the mcvideo lane (2026-10-27): MOV / MP4 / 3GP, Matroska / WebM, AVI, ASF / WMV, FLV (H.264 in AVI / ASF / FLV too \u2014 only this reader indexes them). Sample-identical to ffmpeg 7.1.1 on 378 of 379 SAN files (the one is ffmpeg concealing a WMV9 picture it misreads); AV1 34,606 / 34,606 frames. Not covered: interlaced VC-1 / VP6, H.263 PB-frames, MS-MPEG4 v1/v2, WMV1/2, AV1 profiles 1/2 and 12-bit"},{codec:"uncompressed",label:"Uncompressed MXF",full:!0,preview:!1,luma:!1,scrubPreview:!1,backend:"wasm",notes:"Avid 1:1 / alpha mattes / SMPTE 384 uncompressed pictures through the mcvideo lane (qtraw::decode_mxf_uncompressed by the descriptor's PictureLayout, 2026-10-27). Not yet gated against a browser-side fixture (no ffmpeg recipe writes one)"}],h=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":e==="h264_wasm"?"h264":e==="hevc_wasm"?"hevc":h.has(e)?e:null:null}function p(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 f={prores:"ProRes",h264:"H.264",hevc:"HEVC",r3d:"R3D",arriraw:"ARRIRAW",xocn:"X-OCN",vc3:"DNxHR",braw:"BRAW",proresraw:"ProRes RAW",other:"unsupported"};function x(t){return f[t]??"unsupported"}function m(t){let e=JSON.parse(t),r=e.frames??[],o=r.length>>1,n=new Array(o);for(let s=0,i=0;i<o;s+=2,i++)n[i]={offset:r[s],size:r[s+1]};return{offs:n,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 D(t){await l();let r=await d((o,n)=>t.slice(o,o+n).arrayBuffer().then(s=>new Uint8Array(s)),t.size,"mov");return m(r)}export{a,p as b,b as c,w as d,v as e,x as f,m as g,D as h};
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
+ import{a as z}from"./chunk-CJYLQ3UM.js";import{a as w}from"./chunk-PHAMF4JF.js";import{A as G,I as F,L as J,P as K,Q as X,Z as o,b as s,g as E,k as u,l as B,r as j,v as d,x as N,y as C,z as y}from"./chunk-DNS4ZYIO.js";var Y={transferGB:2e3},f={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},allowance:{transferGB:50}},indie:{id:"indie",name:"MCP",monthly:49,yearly:490,stripe:{monthly:"price_1T5XDXJ5lnla0aaLasKq49tm",yearly:"price_1T5XDXJ5lnla0aaL2MdMSuI9"},includes:{web:!0,mcp:!0,app:!1},allowance:{transferGB:250}},pro:{id:"pro",name:"App",monthly:199,yearly:1990,stripe:{monthly:"price_1T5X8oJ5lnla0aaLyNJa93H0",yearly:"price_1T5X8oJ5lnla0aaL3dh7b1el"},includes:{web:!0,mcp:!0,app:!0},allowance:Y},studio:{id:"studio",name:"Studio",monthly:"custom",yearly:"custom",stripe:{monthly:"price_1T5X7xJ5lnla0aaLoeE1aBlL",yearly:"price_1T5X7xJ5lnla0aaLeBiYo3Di"},includes:{web:!0,mcp:!0,app:!0},allowance:Y}};var H={web:!0,mcp:!1,app:!1};var Ie=Object.fromEntries(Object.values(f).flatMap(e=>Object.values(e.stripe).map(t=>[t,e.id])));import{createPrivateKey as Oe,createPublicKey as le,sign as Ee,verify as ue}from"node:crypto";import{Buffer as m}from"node:buffer";var pe="CONFORMTOOLS_LICENSE_V1",q=/^[0-9A-F]{8}(-[0-9A-F]{8}){3}$/,V=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 Z(e){let t=e.split(/\r?\n/).map(r=>r.trim()).filter(r=>r&&!r.startsWith("#")&&!r.startsWith("-----")).join(""),n=JSON.parse(m.from(t,"base64").toString("utf8"));if(n?.magic!==pe||!n.payload?.data)throw new Error("not a conform.tools licence");return n.payload}function W(e,t){let n=m.from(e.signature,"base64"),r=m.from(V(e.data));return n.length!==64?!1:t.some(i=>ue(null,r,le({key:m.concat([m.from("302a300506032b6570032100","hex"),m.from(i)]),format:"der",type:"spki"}),n))}var de=["cMwVBrEYKMzlG6pC7FF2lNKIoEqGz2xB5yph6clNnTg=","qnheqkkDU09l1oI6h2CFh4uQ97bY/hkTA5niGKH0+X8="],fe=de.map(e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)));function L(){let e=s("CONFORM_RECORDS_DIR");if(e)return e;let t=B(),n=E()==="darwin"?o(t,"Library/Application Support"):E()==="win32"?s("LOCALAPPDATA")??o(t,"AppData/Local"):s("XDG_DATA_HOME")??o(t,".local/share");return o(n,"conform.tools")}var me=()=>s("CONFORM_LICENSE_PATH")??o(L(),"license.lic"),I=()=>o(L(),"grant.lic"),ge=null;function T(){return ge??=(async()=>{let e=await z();if(!e)return[];let t=await J(e,["machine"],{timeoutMs:15e3}).catch(()=>null);try{return JSON.parse(t?.stdout??"").machines.filter(n=>q.test(n))}catch{return[]}})()}function he(e,t,n=Date.now()){if(!W(e,fe))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 Q(){let e;try{e=await d(me())}catch{return null}try{return he(Z(e),await T())}catch(t){return{ok:!1,reason:t.message}}}var _e={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=s("CONFORM_ENV")==="staging"?"staging":"production",t=_e[e];return{env:e,supabaseUrl:s("CONFORM_SUPABASE_URL")??t.supabaseUrl,anonKey:s("CONFORM_SUPABASE_ANON_KEY")??t.anonKey,appBase:s("CONFORM_APP_BASE")??t.appBase}}var ye=600*1e3,ee=72*3600*1e3,we=300*1e3,x=()=>o(u(),a().env==="production"?"auth.json":`auth-${a().env}.json`);async function $(){for(let e of new Set([x(),o(u(),"auth.json")]))try{let t=JSON.parse(await d(e));if(t.env===a().env&&t.access_token)return t}catch{}return null}async function be(){try{for await(let e of F(u())){if(!/^auth(?:-(\w+))?\.json$/.exec(e.name))continue;let n=JSON.parse(await d(o(u(),e.name)));if(n.access_token&&n.env&&n.env!==a().env)return{other_env:n.env}}}catch{}return{}}async function D(e){await C(u()),await N(x(),JSON.stringify(e)),await G(x(),384)}var ne=6e3,v=0,re=()=>Date.now()<v,ie=()=>{v=Date.now()+6e4};function Fe(){v=0}async function ae(e){if(e.expires_at-60>Date.now()/1e3)return e.access_token;if(re())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(ne)}).catch(i=>{throw ie(),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 D(e),e.access_token}catch{return null}}async function Je(){let e=await $();return e&&await ae(e)||null}var g=null;function te(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"},...e.invite_only?{invite_only:!0}:{}}}async function oe(e={}){let t=await Q();if(t?.ok)return{signed_in:!!await $().catch(()=>null),entitled:!0,env:a().env,email:t.data.email,access:"licence",tier:t.data.tier,source:"licence"};let n=await xe(e);return t&&!n.entitled?{...n,licence_error:t.reason}:n}async function xe(e){if(!e.force&&g&&Date.now()-g.at<ye)return{...g.status,source:"cache"};let t=a(),n=await $();if(!n)return{signed_in:!1,entitled:!1,env:t.env,reason:"not_signed_in",...await be()};let r=await ae(n);if(r==="")return{signed_in:!0,entitled:!1,env:t.env,reason:"auth_rejected"};if(r&&!re())try{let i=(await T())[0],c=await fetch(`${t.supabaseUrl}/functions/v1/v1-billing/v1/billing/entitlement${i?`?machine=${i}`:""}`,{headers:{authorization:`Bearer ${r}`,apikey:t.anonKey},signal:AbortSignal.timeout(ne)}).catch(l=>{throw ie(),l});if(c.status===401||c.status===403)return{signed_in:!0,entitled:!1,env:t.env,reason:"auth_rejected"};if(c.ok){let{grant:l,...S}=(await c.json()).data;i&&await ve(l),n.last_entitlement=S,n.last_entitlement_at=Date.now(),await D(n);let A=te(S,"live");return g={at:Date.now(),status:A},A}}catch{}if(n.last_entitlement&&n.last_entitlement_at&&Date.now()-n.last_entitlement_at<ee){let i=ee-(Date.now()-n.last_entitlement_at);return{...te(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 ve(e){try{if(!e)return await y(I());await C(L()),await N(I(),e)}catch{}}function Se(e){return e.source==="licence"?`${e.email} \xB7 machine licence (${e.tier}) \u2014 runs offline, no account check`:Ae(e)+(e.licence_error?`
4
+ (the machine licence was not used: ${e.licence_error})`:"")}function Ae(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&&e.invite_only)return`${n}
5
+ the conform.tools engine (the MCP and the app) is invite-only for now, and ${e.email??"this account"} is not on the list. If that is the wrong Google account, run account_logout, then account_login with the invited one.`;if(!e.entitled)return`${n}
6
+ 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`:e.access==="allowlist"?"invited (early access)":`subscribed${e.tier?` (${e.tier})`:""}`,i=P(e),c=i?` \xB7 includes ${[i.web&&"the web tools",i.mcp&&"the MCP",i.app&&"the app"].filter(Boolean).join(", ")||"the web tools"}`:"";return`${n}
7
+ ${r}${c}${e.source==="grace"?` \u2014 offline, using the last check (${e.grace_remaining_h} h of grace left)`:""}`}function P(e){if(e.access==="trial")return H;let t=(e.tier??"").toLowerCase();return(t==="enterprise"?f.studio:f[t])?.includes??null}var se=()=>oe();function Ke(e){se=e}async function ce(){let e=await se();if(e.entitled)return e;let t=e.signed_in&&e.reason==="not_entitled"?"not_entitled":"not_signed_in";throw new w(t,Se(e),{account:e})}async function Xe(){let e=await ce();if(e.source==="licence"||P(e)?.mcp!==!1)return e;throw new w("not_entitled",`The conform.tools MCP is in the MCP plan ($${f.indie.monthly}/mo) and up. ${e.access==="trial"?"Your trial":`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 ze(){let e=await ce();if(e.source==="licence"||P(e)?.app)return e;throw new w("not_entitled",`The conform.tools app is in the App plan ($${f.pro.monthly}/mo). ${e.access==="trial"?"Your trial":`Your plan${e.tier?` (${e.tier})`:""}`} does not include the app${P(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 b=null;function Ye(e={}){if(b)return b;let t=a(),n=crypto.randomUUID().replaceAll("-","");return b=new Promise((r,i)=>{let c=!1,l=h=>{c||(c=!0,clearTimeout(A),setTimeout(()=>S.close(),250),b=null,h())},S=X({hostname:"127.0.0.1",port:0,onListen:async h=>{let _=`${t.appBase}/plugin-auth?client=engine&port=${h}&state=${n}`,p=await K(_);e.onUrl?.(_,p)}},async h=>{let _=new URL(h.url);if(_.pathname!=="/callback")return new Response("not found",{status:404});let p=_.searchParams,M=p.get("access_token")??"",U=p.get("refresh_token")??"",k=!!M&&!!U&&p.get("state")===n;if(k){let R=Number(p.get("expires_at"));await D({env:t.env,access_token:M,refresh_token:U,expires_at:R>0?R:Math.floor(Date.now()/1e3)+3600}),g=null,v=0,oe({force:!0}).then(O=>l(()=>r(O)),O=>l(()=>i(O)))}return new Response(Le(k),{status:k?200:400,headers:{"content-type":"text/html; charset=utf-8"}})}),A=setTimeout(()=>l(()=>i(new w("not_signed_in","sign-in was not completed within 5 minutes"))),e.timeoutMs??we)}),b}async function He(){g=null,v=0,await j(x())&&await y(x()),await y(I()).catch(()=>{});let e=o(u(),"auth.json");try{JSON.parse(await d(e)).env===a().env&&await y(e)}catch{}}function Le(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{a,ne as b,Fe as c,Je as d,oe as e,Se as f,P as g,Ke as h,ce as i,Xe as j,ze as k,Ye as l,He as m};
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
+ import{W as $e,c as de}from"./chunk-DFDXSIMI.js";import{b as ve,f as we}from"./chunk-NU3X7P4N.js";import{c as me}from"./chunk-CJYLQ3UM.js";import{a as ce}from"./chunk-PHAMF4JF.js";function te(e,n,t,o,s){let r=1-s;return r*r*r*e+3*r*r*s*n+3*r*s*s*t+s*s*s*o}function Ue(e,n,t){let o=0,s=1;for(let a=0;a<48;a++){let u=(o+s)/2;te(n[0],n[1],n[2],n[3],u)<e?o=u:s=u}let r=(o+s)/2;return te(t[0],t[1],t[2],t[3],r)}var be=e=>!!(e.sOutX||e.sOutY||e.sInX||e.sInY);function Se(e){return e.some(n=>be(n)||n.interp==="bezier")}var Me=new WeakMap;function Qe(e,n){let t=Me.get(e);if(t&&t.to===n)return t;let o=e.x,s=e.y,r=n.x,a=n.y,u,m,c,l;be(e)||be(n)?(u=o+(e.sOutX??0),m=s+(e.sOutY??0),c=r+(n.sInX??0),l=a+(n.sInY??0)):(u=o+(r-o)/3,m=s+(a-s)/3,c=r-(r-o)/3,l=a-(a-s)/3);let f=[0],h=o,x=s;for(let k=1;k<=256;k++){let w=k/256,$=te(o,u,c,r,w),A=te(s,m,l,a,w);f.push(f[f.length-1]+Math.hypot($-h,A-x)),h=$,x=A}let M={to:n,arc:f,ctrl:[o,u,c,r,s,m,l,a]};return Me.set(e,M),M}function Te(e,n,t){if(!e.length)return[0,0];let o=e[0],s=e[e.length-1];if(n<=o.time)return[o.x,o.y];if(n>=s.time)return[s.x,s.y];for(let r=0;r<e.length-1;r++){let a=e[r],u=e[r+1];if(!(n>=a.time&&n<u.time))continue;if(a.interp==="hold")return[a.x,a.y];let m=u.time-a.time;if(m<=0)return[u.x,u.y];let c=m/(t||24),{arc:l,ctrl:f}=Qe(a,u),h=l[l.length-1];if(!(h>1e-12))return[a.x,a.y];let x=c>0?h/c:0,M=a.interp==="bezier"&&a.outSpeed!=null?a.outSpeed:x,k=a.interp==="bezier"&&a.outInfluence!=null?a.outInfluence:1/3,w=u.interp==="bezier"&&u.inSpeed!=null?u.inSpeed:x,$=u.interp==="bezier"&&u.inInfluence!=null?u.inInfluence:1/3,A=1/6,C=(T,p)=>Math.abs(T-p)<1e-9,N=M===0&&C(k,1/3),Z=w===0&&C($,1/3);C(k,A)&&(M=x,k=Z?.5:1/3),C($,A)&&(w=x,$=N?.5:1/3);let Q=(n-a.time)/(t||24),z=Math.min(Math.max(Ue(Q,[0,k*c,c-$*c,c],[0,M*k*c,h-w*$*c,h]),0),h),E=1,G=256;for(;E<G;){let T=E+G>>1;l[T]<z?E=T+1:G=T}let K=l[E-1],i=l[E],b=i>K?(z-K)/(i-K):0,_=(E-1+b)/256;return[te(f[0],f[1],f[2],f[3],_),te(f[4],f[5],f[6],f[7],_)]}return[s.x,s.y]}function Ae(e,n){if((n==="flip_horizontal"?e.flip_horizontal:e.flip_vertical)===!0)return!0;let o=e.effects;return Array.isArray(o)?o.some(s=>{let r=s;return r?.kind===n&&r.enabled!==!1}):!1}function j(e,n){return typeof e=="number"&&Number.isFinite(e)?e:Array.isArray(e)&&typeof e[n]=="number"?e[n]:null}function Je(e,n,t,o,s){let r;Array.isArray(e.value)&&Array.isArray(n.value)?r=Math.hypot((j(n.value,0)??0)-(j(e.value,0)??0),(j(n.value,1)??0)-(j(e.value,1)??0)):r=(j(n.value,0)??0)-(j(e.value,0)??0);let a=o/t;if(r===0||!(s>0))return a;let u=w=>{let $=typeof w?.x=="number"?w.x:null,A=typeof w?.y=="number"?w.y:null;if($===null||A===null)return null;let C=Math.min(Math.max(A,0),1)*t;return{dx:C,dy:$/s/r*C}},m=u(e.tout)??{dx:t/3,dy:t/3/t},c=u(n.tin)??{dx:t/3,dy:t/3/t},l=Math.min(Math.max(m.dx,0),t),f=m.dy,h=t-Math.min(Math.max(c.dx,0),t),x=1-c.dy,M=(w,$,A,C)=>{let N=1-C;return 3*w*C*N*N+3*$*C*C*N+A*C*C*C},k=a;for(let w=0;w<8;w++){let $=M(l,h,t,k)-o,A=1-k,C=3*(l*(A*A-2*k*A)+h*(2*k*A-k*k)+t*k*k);if(Math.abs(C)<1e-9)break;let N=k-$/C;if(!(N>=0&&N<=1))break;if(Math.abs(N-k)<1e-7){k=N;break}k=N}if(Math.abs(M(l,h,t,k)-o)>t*1e-4){let w=0,$=1;for(let A=0;A<40;A++)k=(w+$)/2,M(l,h,t,k)<o?w=k:$=k}return M(f,x,1,k)}function We(e,n,t,o=0,s=0){let a=(e.keyframes??[]).filter(c=>c.parameter_path===n&&typeof c.time?.value=="number").map(c=>({time:c.time.value,value:c.value,interp:c.interp??"linear",tin:c.tangent_in,tout:c.tangent_out,drt:!!c.raw_extraction?.drt_tangent})).sort((c,l)=>c.time-l.time);if(!a.length)return;let u=j(a[0].value,o)??0,m=j(a[a.length-1].value,o)??0;if(t<=a[0].time)return u;if(t>=a[a.length-1].time)return m;for(let c=0;c<a.length-1;c++){let l=a[c],f=a[c+1];if(t>=l.time&&t<=f.time){let h=j(l.value,o)??0,x=j(f.value,o)??0;if(l.interp==="hold")return h;let M=f.time-l.time||1,k=(l.tout||f.tin)&&!l.drt&&!f.drt?Je(l,f,M,t-l.time,s):(t-l.time)/M;return h+(x-h)*k}}return m}function qe(e){let n=e.keyframes??[];for(let t of n){if(t.parameter_path==="speed")continue;let o=t.time?.rate;if(typeof o=="number"&&o>0)return o}}function ze(e){let n=e.speed;return typeof n=="number"&&Number.isFinite(n)?Math.abs(n)/100:1}function en(e){let n=e,t=n.raw_extraction??void 0,o=m=>{let c=t?.[m];return typeof c=="number"&&Number.isFinite(c)?c:void 0};if(!(n.is_reinterpreted===!0||t?.isReinterpreted===!0))return 1;let r=n.original_fps??o("originalFps"),a=n.interpreted_fps??o("reinterpretedFps");if(r!=null&&a!=null&&r>0&&a>0)return a/r;let u=o("reinterpretationSpeedAdjustment");return u!=null&&u>0?u/100:1}function Ie(e,n){let o=(e.keyframes??[]).filter(a=>a.parameter_path==="speed"&&typeof a.time?.value=="number"&&typeof a.value=="number").map(a=>({x:a.time.value,y:a.value,tan:Array.isArray(a.raw_extraction?.drtNativeTangent)?a.raw_extraction.drtNativeTangent:null})).sort((a,u)=>a.x-u.x);if(o.length<2)return null;let s=(a,u)=>{let m=o[a].tan;if(m&&m.length>=4){if(u==="in"&&m[0])return m[1]/m[0];if(u==="out"&&m[2])return m[3]/m[2]}let c=u==="out"?Math.min(a+1,o.length-1):Math.max(a-1,0),l=Math.min(a,c),f=Math.max(a,c),h=o[f].x-o[l].x;return h>0?(o[f].y-o[l].y)/h:0},r=o.length-1;if(n<=o[0].x)return o[0].y+(n-o[0].x)*s(0,"out");if(n>=o[r].x)return o[r].y+(n-o[r].x)*s(r,"in");for(let a=0;a<r;a++){let u=o[a],m=o[a+1];if(n>m.x)continue;let c=m.x-u.x;if(c<=0)return m.y;let l=(n-u.x)/c,f=l*l,h=f*l,x=s(a,"out"),M=s(a+1,"in");return(2*h-3*f+1)*u.y+(h-2*f+l)*c*x+(-2*h+3*f)*m.y+(h-f)*c*M}return o[r].y}function nn(e,n,t){let o=e.timeline_range?.start?.value??0,s=e.timeline_range?.start?.rate||t,r=(n-o)/s,a=e.source_range?.start,u=a&&typeof a.value=="number"&&a.rate?a.value/a.rate:0,m=Ie(e,r);if(m!=null)return(u+m)*t;let c=ze(e);if(e.speed_reverse){let l=e.source_range?.duration,f=l&&typeof l.value=="number"&&l.rate?Math.max(0,l.value-1)/l.rate:0;return(u+f-r*c)*t}return(u+r*c)*t}function rn(e,n){let t=e.timeline_range?.start,o=t?.value??0,s=t?.rate||24,r=e.source_range?.start,a=r?.value??0,u=r?.rate||s,m=Ie(e,(n-o)/s);if(m!=null)return a+m*u;let c=ze(e)*en(e),l=(n-o)*(u/s)*c;if(e.speed_reverse){let f=e.source_range?.duration?.value??0;return a+Math.max(0,f-1)-l}return a+l}function tn(e){let n=e.keyframes??[],t=[];for(let o of n){if(o.parameter_path!=="position"||typeof o.time?.value!="number")continue;let s=o.value,r=j(s,0),a=j(s,1);if(r==null||a==null)return null;let u=o.raw_extraction?.tangentPs??void 0,m=(c,l)=>{let f=c?.[l];return typeof f=="number"&&Number.isFinite(f)?f:void 0};t.push({time:o.time.value,x:r,y:a,interp:o.interp??"linear",outSpeed:o.tangent_out?.x??void 0,outInfluence:o.tangent_out?.y??void 0,inSpeed:o.tangent_in?.x??void 0,inInfluence:o.tangent_in?.y??void 0,sOutX:m(u,"spatialOutX"),sOutY:m(u,"spatialOutY"),sInX:m(u,"spatialInX"),sInY:m(u,"spatialInY")})}return t.length<2?null:(t.sort((o,s)=>o.time-s.time),Se(t)?t:null)}function Re(e,n){let t=qe(e)??e.timeline_range?.start?.rate??24,o=nn(e,n,t),s=!1,r=(c,l=0)=>{let f=We(e,c,o,l,t);return f!==void 0&&(s=!0),f},a=c=>typeof c=="number"?c:null,u=tn(e);u&&(s=!0);let m=u?Te(u,o,t):null;return{scale:r("scale")??a(e.scale),scaleX:r("scale.x")??a(e.scale_x),scaleY:r("scale.y")??a(e.scale_y),posX:m?m[0]:r("position",0)??r("position.x")??a(e.position_x)??0,posY:m?m[1]:r("position",1)??r("position.y")??a(e.position_y)??0,rotation:r("rotation")??a(e.rotation)??0,anchorX:r("anchor",0)??r("anchor.x")??a(e.anchor_x)??0,anchorY:r("anchor",1)??r("anchor.y")??a(e.anchor_y)??0,opacity:r("opacity")??a(e.opacity),cropL:r("crop.left")??a(e.crop_left)??0,cropR:r("crop.right")??a(e.crop_right)??0,cropT:r("crop.top")??a(e.crop_top)??0,cropB:r("crop.bottom")??a(e.crop_bottom)??0,flipH:Ae(e,"flip_horizontal"),flipV:Ae(e,"flip_vertical"),animated:s}}function Oe(e,n){return Math.floor(rn(e,n)+1e-9)}var _e={strict:{tolerance_px:1,min_frames:1,gap_frames:0,black_threshold:16},standard:{tolerance_px:2,min_frames:2,gap_frames:1,black_threshold:10},relaxed:{tolerance_px:6,min_frames:4,gap_frames:3,black_threshold:6}},ge="strict",Ce={tolerance_px:[0,512],min_frames:[1,600],gap_frames:[0,600],black_threshold:[0,255]};function Fe(e,n={}){let t=(e??ge).trim().toLowerCase(),o=_e[t]??_e[ge],s=_e[t]?t:t==="custom"?"custom":ge,r={...o};for(let a of Object.keys(Ce)){let u=n[a];if(u===void 0||!Number.isFinite(Number(u)))continue;let[m,c]=Ce[a],l=Math.max(m,Math.min(c,Math.round(Number(u))));l!==r[a]&&(s="custom"),r[a]=l}return{...r,preset:s}}function ie(e,n){let t=Number(e),o=Number(n);return!Number.isFinite(t)||!Number.isFinite(o)?!1:t>0&&t>=o}function an(e,n,t){return!(e>0)||!(n>0)||!(t>0)?!1:Math.abs(n/t-e)/e>=.02}function sn(e,n,t,o,s){let r=Math.max(2,Number(s)||0);return Math.abs(e-n)<=r&&Math.abs(t-o)<=r}function on(e,n,t,o,s,r){return!s||!(s.top>0||s.bottom>0||s.left>0||s.right>0)?!1:Math.abs(e-s.top)<=r&&Math.abs(n-s.bottom)<=r&&Math.abs(t-s.left)<=r&&Math.abs(o-s.right)<=r}var Ne=[["bt","ct"],["bb","cb"],["bl","cl"],["br","cr"]],le=e=>Math.max(0,Math.trunc(Number(e)||0)),fe=e=>Math.max(0,Math.min(1,Number(e)||0));function un(e,n,t,o,s,r={}){let a=r.tolerance_px??4;o=Math.max(1,Math.trunc(o)),s=Math.max(1,Math.trunc(s));let u=[];for(let m of e??[]){let c=Math.trunc(Number(m.pts)||0),l=le(m.bt),f=le(m.bb),h=le(m.bl),x=le(m.br);if(!ie(Math.max(l,f,h,x),a)||on(l,f,h,x,r.declared_blanking,a))continue;let M=Number(r.expected_aspect_ratio)||0;if(M>0){let $=Math.max(1,o-h-x),A=Math.max(1,s-l-f),C=h<=a&&x<=a,N=l<=a&&f<=a;if((C||N)&&an(M,o,s)&&sn(l,f,h,x,a)&&Math.abs($/A-M)/M<.02)continue}let k=t+c,w;for(let $ of n??[])$.start<=k&&k<$.end&&(!w||$.track>w.track)&&(w=$);w&&u.push({frame_abs:k,bt:l,bb:f,bl:h,br:x,ct:fe(m.ct),cb:fe(m.cb),cl:fe(m.cl),cr:fe(m.cr),source:m.source??"pixels",clip:w})}return u.sort((m,c)=>m.frame_abs-c.frame_abs)}function cn(e,n){let t=[];return ie(e.bt,n)&&t.push("Top"),ie(e.bb,n)&&t.push("Bottom"),ie(e.bl,n)&&t.push("Left"),ie(e.br,n)&&t.push("Right"),t}function Ee(e,n,t,o,s,r={}){let a=Math.max(1,Math.trunc(r.min_frames??1)),u=Math.max(0,Math.trunc(r.gap_frames??0)),m=r.tolerance_px??4,c=[],l;for(let f of un(e,n,t,o,s,r)){(!l||l.clip!==f.clip||f.frame_abs-l.end_frame-1>u)&&(l={clip:f.clip,start_frame:f.frame_abs,end_frame:f.frame_abs,frame_count:0,measured:{bt:0,bb:0,bl:0,br:0},coverage:{ct:0,cb:0,cl:0,cr:0},sources:new Set},c.push(l)),l.end_frame=f.frame_abs,l.frame_count++,l.sources.add(f.source);for(let[h,x]of Ne)f[h]>=l.measured[h]&&(l.measured[h]=f[h],l.coverage[x]=f[x])}return c.filter(f=>f.frame_count>=a).map(f=>({...f,duration_frames:f.end_frame-f.start_frame+1,sources:[...f.sources].sort(),zones:cn(f.measured,m)}))}function yn(e){let n=new Map;for(let o of e){let s=n.get(o.clip.id);s||(s={clip:o.clip,measured:{bt:0,bb:0,bl:0,br:0},coverage:{ct:0,cb:0,cl:0,cr:0},frames:0,first_frame_abs:o.start_frame,zones:[],sources:[],ranges:[]},n.set(o.clip.id,s)),s.frames+=o.frame_count,s.first_frame_abs=Math.min(s.first_frame_abs,o.start_frame);for(let[r,a]of Ne)o.measured[r]>=s.measured[r]&&(s.measured[r]=o.measured[r],s.coverage[a]=o.coverage[a]);s.sources=[...new Set([...s.sources,...o.sources])].sort(),s.ranges.push(o)}let t=["Top","Bottom","Left","Right"];return[...n.values()].map(o=>{let s=new Set(o.ranges.flatMap(r=>r.zones));return{...o,zones:t.filter(r=>s.has(r)),ranges:o.ranges.sort((r,a)=>r.start_frame-a.start_frame)}}).sort((o,s)=>o.clip.start-s.clip.start)}function kn(e,n=1){let t=Math.max(0,Math.trunc(n)),o=[];for(let s of[...e].sort((r,a)=>r.frame-a.frame)){let r=o.at(-1);if(r&&s.frame-r.end_frame<=t+1){r.end_frame=Math.max(r.end_frame,s.frame),r.frames++,r.darkest=Math.min(r.darkest,s.avg);continue}o.push({start_frame:s.frame,end_frame:s.frame,duration_frames:1,frames:1,darkest:s.avg})}for(let s of o)s.duration_frames=s.end_frame-s.start_frame+1;return o}function xe(e,n){let t=n?e.timelines.find(o=>o.id===n||o.name===n):e.timelines.find(o=>o.kind==="primary")??e.timelines[0];if(!t)throw new Error(n?`no timeline ${n} in this session`:"this session has no timeline");if(!t.resolution_w||!t.resolution_h)throw new Error(`${t.name}: the timeline has no raster (resolution) in the session`);return t}var mn=e=>e.fps_den?e.fps_num/e.fps_den:e.fps_num,ae=(e,n)=>ve((e.start_frame??0)+n,mn(e),!!e.is_drop_frame),ln=e=>e.split(/[\\/]/).pop()??e,ue=e=>e.tracks.filter(n=>n.kind==="Video").sort((n,t)=>n.track_index-t.track_index),D=e=>{let n=e.timeline_range.start.value;return[n,n+e.timeline_range.duration.value]},pe=e=>e.items.filter(n=>n.kind==="clip");function se(e,n){let t=e.media_references.find(u=>u.id===n.media_reference_id),o=t?.local_path??t?.target_url?.replace(/^file:\/\//,"")??null,s=t?.source_resolution_w??0,r=t?.source_resolution_h??0,a=t?.source_pixel_aspect||1;return{path:o,w:s*a,h:r}}var re=(e,n)=>Re(e,n),ye=(e,n)=>Oe(e,n),Be=(e,n,t)=>({box:[n,t],scale:[(e.scaleX??e.scale??100)/100,(e.scaleY??e.scale??100)/100],pos:[e.posX*n,e.posY*t],rot:e.rotation,anchor:[e.anchorX,e.anchorY],crop:[e.cropL/100,e.cropR/100,e.cropT/100,e.cropB/100],flip:[e.flipH,e.flipV]});function Xe(e,n,t,o){if(!(t>0&&o>0))return[e,n];let s=Math.min(e/t,n/o);return[t*s,o*s]}function je(e,n,t){let o=n-e,s=Math.max(1,Math.min(t,o));return[...new Set(Array.from({length:s},(r,a)=>e+Math.min(o-1,Math.floor((a+.5)*o/s))))]}var fn=["fit","fill","crop","stretch"];function Ge(e,n,t){if(t)return t;let o=e.reframe_fit??n.mismatch_policy??"fit";return o==="none"?"crop":fn.includes(o)?o:"fit"}function He(e,n,t,o,s){if(!(e>0&&n>0)||s==="fit")return[1,1];let r=t/e,a=o/n,u=[r,r],m=[a,a],c=r<=a?u:m,l=s==="crop"?[1,1]:s==="fill"?r>a?u:m:[r,a];return[l[0]/c[0],l[1]/c[1]]}var ne=(e,n)=>Math.round(e*10**n)/10**n||0;function ke(e,n,t,o=[1,1]){return{Pan:ne(e.position_x*n/o[0],3),Tilt:ne(-e.position_y*t/o[1],3),ZoomX:ne(e.scale_x/100/o[0],5),ZoomY:ne(e.scale_y/100/o[1],5),RotationAngle:ne(-e.rotation,3),FlipX:e.flip_h,FlipY:e.flip_v}}function Ye(e,n,t,o){let s=(n.scaleX??n.scale??100)/100,r=n.rotation*Math.PI/180,a=Math.cos(r),u=Math.sin(r),m=e.position_x*t,c=e.position_y*o;return{...e,scale_x:e.scale_x*s,scale_y:e.scale_y*s,rotation:e.rotation+n.rotation,position_x:(n.posX*t+s*(a*m-u*c))/t,position_y:(n.posY*o+s*(u*m+a*c))/o}}var De=e=>({scale_x:e.scaleX??e.scale??100,scale_y:e.scaleY??e.scale??100,position_x:e.posX,position_y:e.posY,rotation:e.rotation,flip_h:e.flipH,flip_v:e.flipV}),Pe=e=>(e.scale??100)===100&&(e.scaleX??100)===100&&(e.scaleY??100)===100&&!e.posX&&!e.posY&&!e.rotation&&!e.cropL&&!e.cropR&&!e.cropT&&!e.cropB&&!e.flipH&&!e.flipV,zn=["edit","input","node"];function Le(e){let n=e.node,t=typeof n=="object"&&n?n:{layer:e.layer??1,node:n};return{...t.node!==void 0&&t.node!==""?{node:t.node}:{},...t.layer&&t.layer!==1?{layer:t.layer}:{}}}var pn={aligned:"Green",animated:"Yellow",no_match:"Red",refused:"Red"};async function dn(e,n){let t=n.offline_reference,o=de(n),s=o,r=Math.max(...n.tracks.flatMap(k=>k.items.map(w=>w.timeline_range.start.value+w.timeline_range.duration.value)),0),a=k=>({kind:"Video",track_index:Math.max(0,...ue(n).map(w=>w.track_index))+1,name:"OFFLINE REFERENCE",enabled:!0,items:k});if(t?.session_id){let{getSession:k}=await import("./store-SZKXADGI.js"),w=(await k(t.session_id)).session,$=w.timelines.find(z=>z.kind==="primary")??w.timelines[0],A=(n.start_frame??0)+(t.frame_offset??0)-($.start_frame??0),C=ue($).filter(z=>z.enabled!==!1).flatMap(z=>z.items.filter(E=>E.kind==="clip"&&E.enabled!==!1&&E.media_reference_id).map(E=>({i:E,top:z.track_index}))),N=[...new Set(C.flatMap(({i:z})=>[z.timeline_range.start.value,z.timeline_range.start.value+z.timeline_range.duration.value]))].sort((z,E)=>z-E),Z=[];for(let z=0;z+1<N.length;z++){let[E,G]=[N[z],N[z+1]],K=C.filter(({i:Y})=>Y.timeline_range.start.value<=E&&E<Y.timeline_range.start.value+Y.timeline_range.duration.value).sort((Y,v)=>v.top-Y.top)[0],[i,b]=[Math.max(0,E-A),Math.min(r,G-A)];if(!K||b<=i)continue;let _=K.i,T=Z.at(-1);if(T&&T.from===_.id&&T.timeline_range.start.value+T.timeline_range.duration.value===i){T.timeline_range.duration.value+=b-i,T.source_range.duration.value+=b-i;continue}let{id:p,timeline_range:y,source_range:g,media_reference_id:I,keyframes:d,...S}=_;Z.push({...S,id:`offline-ref-${Z.length}`,from:_.id,kind:"clip",enabled:!0,media_reference_id:`offref:${I}`,timeline_range:{start:{value:i,rate:s},duration:{value:b-i,rate:s}},source_range:{start:{value:g.start.value+(i+A-_.timeline_range.start.value),rate:g.start.rate},duration:{value:b-i,rate:g.start.rate}}})}if(!Z.length)throw new ce("not_found",`the offline reference timeline "${$.name}" has no picture over this timeline`);let Q=new Set(Z.map(z=>String(z.media_reference_id).slice(7)));return{lane:a(Z),media:w.media_references.filter(z=>Q.has(z.id)).map(z=>({...z,id:`offref:${z.id}`})),name:`timeline ${$.name}`}}let u=t?.media_reference_id?e.media_references.find(k=>k.id===t.media_reference_id):void 0,m=u?.local_path??u?.target_url?.replace(/^file:\/\//,"");if(!u||!m)throw new ce("not_found","this timeline has no offline reference linked in Resolve (Timeline \u203A Link Offline Reference Clip): a movie or another timeline");let{probeMedia:c}=await import("./media-3YMIZSSF.js"),l=await c(m),f=l.source_timecode?we(l.source_timecode,o,null):0,h=l.available_range?.duration?.value??l.declared_duration?.value??null,x=(n.start_frame??0)+(t.frame_offset??0)-f;h!=null&&(x>=h||x+r<=0)&&(x=t.frame_offset??0);let M=h!=null?Math.max(1,Math.min(r,h-x)):r;return{lane:a([{id:"offline-reference",kind:"clip",name:u.name??"offline reference",enabled:!0,media_reference_id:u.id,timeline_range:{start:{value:0,rate:s},duration:{value:M,rate:s}},source_range:{start:{value:x,rate:s},duration:{value:M,rate:s}}}]),media:[],name:u.name??ln(m)}}async function In(e,n,t,o){if(n.reference_track!=="offline")return await Ze(e,n,t,o);let s=xe(e,n.timeline_id),{lane:r,media:a,name:u}=await dn(e,s);s.tracks.push(r),e.media_references.push(...a);try{return{...await Ze(e,{...n,reference_track:ue(s).length,reference_label:"the offline reference"},t,o),reference:`the offline reference (${u})`}}finally{s.tracks.splice(s.tracks.indexOf(r),1),e.media_references=e.media_references.filter(m=>!a.includes(m))}}async function Ze(e,n,t,o){let s=xe(e,n.timeline_id),r=s.resolution_w,a=s.resolution_h,u=ue(s),m=u.findIndex(i=>/\b(ref|reference|offline)\b/i.test(String(i.name??""))),c=n.reference_track||(m>=0?m+1:u.length),l=u[c-1];if(!l)throw new Error(`no video track V${c} (the timeline has ${u.length})`);if(n.tracks?.includes(c))throw new ce("invalid_args",`the track to align cannot be the reference track (V${c})`);let f=(n.tracks?.length?n.tracks:u.map((i,b)=>b+1).filter(i=>u[i-1].enabled!==!1)).filter(i=>i!==c);for(let i of f)if(!u[i-1])throw new Error(`no video track V${i} (the timeline has ${u.length})`);let h=n.input_scaling??"fit",x=n.sizing_target??"edit",M=600,k=(i,b)=>{let _=Math.max(1,b-i);if(n.samples==="ends")return[...new Set([0,.25,.5,.75,1].map(y=>i+Math.round(y*(Math.max(i,b-1)-i))))];let T=(n.samples??"half")==="half"&&!n.step?Math.max(1,Math.round(de(s)/2)):n.step,p=n.samples==="all"?Math.max(1,Math.ceil(_/M)):T?Math.max(1,Math.floor(T),Math.ceil(_/M)):0;if(p){let y=[];for(let g=i;g<b;g+=p)y.push(g);return y.at(-1)!==b-1&&y.push(b-1),y}return je(i,b,Math.max(1,Math.min(M,Math.floor(Number(n.samples))||1)))},w=Number(s.start_frame??0),$=[],A=[],C=pe(l),N=n.scope??"all",Z=new Set(n.picks??[]);if(N==="selected"&&!Z.size)throw new Error("no clips selected: select clips in the timeline, or align the whole timeline");for(let i of f)for(let b of pe(u[i-1])){let[_,T]=D(b);if(N==="playhead"&&!(_<=(n.at??-1)&&(n.at??-1)<T)||N==="selected"&&!Z.has(`${i}:${_}`))continue;let p={item_id:b.id,name:b.name??b.id,track:i,start:_,end:T,record_tc:ae(s,_),verdict:"refused",confidence:null,samples:[]};$.push(p);let y=R=>{p.reason=R};if(b.enabled===!1){y("disabled");continue}let g,I=0,d=0;for(let R of C){let[O,H]=D(R),P=Math.max(_,O),U=Math.min(T,H);U-P>d-I&&(g=R,I=P,d=U)}if(!g){if(n.reference_label){y(`${n.reference_label} does not cover it (${ae(s,_)}\u2013${ae(s,T)}): it ends before this clip`);continue}let R=l.items.find(O=>{let[H,P]=D(O);return O.kind!=="clip"&&O.kind!=="gap"&&Math.min(T,P)>Math.max(_,H)});y(R?`V${c} has ${/compound|stack|timeline/i.test(String(R.kind))?"a compound clip or nested timeline":`a ${R.kind}`} over it, not a movie clip: Align reads a media file there (decompose it, or use Offline ref)`:C.length?`nothing on V${c} over it (${ae(s,_)}\u2013${ae(s,T)}): the reference does not cover this clip`:`V${c} has no movie clips: pick the track the reference is on, or Offline ref`);continue}let S=se(e,g),Y=se(e,b);if(!S.path){y(`the reference clip ${g.name??g.id} is not linked (timeline_relink first)`);continue}if(!Y.path){y("not linked (timeline_relink first)");continue}let v=k(I,d),B=re(g,I),F=Pe(B)?void 0:B;if(F){let R=F.scaleX??F.scale??100,O=F.scaleY??F.scale??100,H=F.animated||v.some(P=>JSON.stringify(re(g,P))!==JSON.stringify(B))?"keyframed":Math.abs(R-O)>1e-6?"scaled unevenly":F.cropL||F.cropR||F.cropT||F.cropB?"cropped":F.flipH||F.flipV?"flipped":F.anchorX||F.anchorY?"anchored off centre":x!=="edit"?"resized (Colour-page sizing is solved against an unresized reference only)":"";if(H){y(`the reference clip ${g.name??g.id} is ${H}; the fit is against its raw picture`);continue}}if(S.w>0&&S.h>0&&Math.abs(S.w/S.h-r/a)>.01*(r/a)){y(`the reference ${S.w}x${S.h} does not fill the ${r}x${a} frame`);continue}let ee=R=>R.map(O=>({ref:S.path,refFrame:ye(g,O),src:Y.path,srcFrame:ye(b,O)})),X=Array.from({length:d-I},(R,O)=>I+O),L=re(b,_);A.push({row:p,item:b,recs:v,every:X,refT:F,ask:{pairs:ee(v),every:ee(X),every_t:X.map(R=>R-_),edit:De(L),edit_identity:Pe(L),edit_animated:!!L.animated,anchor_off:!!(L.anchorX||L.anchorY),...n.inputs?.get(`${i}:${_+w}`)?.length?{input:n.inputs.get(`${i}:${_+w}`)}:{}}})}let Q=A.length?await me({op:"reframe",items:A.map(i=>i.ask),out:[r,a],target:x},t,o):{items:[],offsets:[]},z=Q.offsets;Q.items.forEach((i,b)=>{let{row:_,item:T,recs:p,every:y,ask:g,refT:I}=A[b];if(I&&(i.verdict==="animated"&&Object.assign(i,{verdict:"refused",reason:"a move under a resized reference is not solved yet",keys:void 0,edit_keys:void 0,grade_keys:void 0}),i.transform&&(i.transform=Ye(i.transform,I,r,a)),i.edit_transform&&(i.edit_transform=Ye(i.edit_transform,I,r,a)),i.transform)){let v=g.edit,B=i.transform,F=.5/r;i.unchanged=Math.abs(B.scale_x-v.scale_x)<.05&&Math.abs(B.scale_y-v.scale_y)<.05&&Math.abs(B.position_x-v.position_x)<F&&Math.abs(B.position_y-v.position_y)<.5/a&&Math.abs(B.rotation-v.rotation)<.02}let d=i.measured==="every"?y:p,S=i.measured==="every"?g.every:g.pairs,Y=(({w:v,h:B})=>He(v,B,r,a,Ge(T,s,n.input_scaling)))(se(e,T));_.samples=i.scores.map((v,B)=>({record:d[i.at[B]],ref_frame:S[i.at[B]].refFrame,src_frame:S[i.at[B]].srcFrame,score:v})),Object.assign(_,{verdict:i.verdict,confidence:i.confidence,...i.reason?{reason:i.reason}:{},...i.label?{label:i.label}:{},...i.unchanged?{unchanged:!0}:{},...i.grade_sizing?{grade_sizing:i.grade_sizing}:{}}),i.transform&&(_.transform=i.transform,_.properties=ke(i.edit_transform??i.transform,r,a,Y)),i.keys?.length&&(_.keys=i.keys.map(v=>({record:d[i.at[v.j]],transform:v.transform,properties:ke(v.transform,r,a,Y),confidence:v.confidence}))),i.grade_keys?.length&&(_.grade_keys=i.grade_keys.map(({shape:v,...B})=>v?.kind==="resolve_dissolve"?{...B,ease_in:v.start,ease_out:v.end}:B),_.grade_keys[0].t>0&&_.grade_keys.unshift({..._.grade_keys[0],t:0,ease_in:void 0,ease_out:void 0})),i.edit_keys?.length&&(_.edit_keys=i.edit_keys[0].t>0?[{...i.edit_keys[0],t:0,shape:void 0},...i.edit_keys]:i.edit_keys)});let E=[];for(let i of $){let b={track:i.track,start:i.start};if(i.verdict==="aligned"&&x==="edit"&&!i.unchanged){let _=i.properties;E.push({op:"properties",item:b,set:{..._.ZoomX!==_.ZoomY?{ZoomGang:!1}:{},..._}})}if(i.verdict==="animated"&&i.edit_keys&&E.push({op:"edit_keys",item:b,keys:i.edit_keys}),i.verdict==="animated"&&i.grade_keys&&E.push({op:"grade_sizing",item:b,target:x==="node"?"node":"input",keys:i.grade_keys,...x==="node"?Le(n):{}}),i.verdict==="aligned"&&i.grade_sizing&&!i.unchanged&&E.push({op:"grade_sizing",item:b,target:x,...i.grade_sizing,...x==="node"?Le(n):{}}),n.markers??!0){let _={aligned:"Aligned",animated:"Animated",no_match:"No match",refused:"Not aligned"}[i.verdict],T=[i.label,i.confidence!=null?`confidence ${i.confidence}`:"",i.reason].filter(Boolean).join(" \xB7 ");E.push({op:"marker_add",frame:i.start,color:pn[i.verdict],name:`${_}: ${i.name}`,note:T,data:"ConformTools:align"})}}let G;if(n.apply_session){G=0;for(let i of $.filter(b=>b.verdict==="aligned")){let b=i.transform;$e(e,"transform",{timeline_id:s.id,item_id:i.item_id,scale:b.scale_x,position_x:b.position_x,position_y:b.position_y,rotation:b.rotation});let _=s.tracks.flatMap(T=>T.items).find(T=>T.id===i.item_id);Math.abs(b.scale_x-b.scale_y)>.001&&(_.scale_x=b.scale_x,_.scale_y=b.scale_y),b.flip_h?_.flip_horizontal=!0:delete _.flip_horizontal,b.flip_v?_.flip_vertical=!0:delete _.flip_vertical,G++}}let K={aligned:0,animated:0,no_match:0,refused:0};for(let i of $)K[i.verdict]++;return{timeline:s.name??s.id,raster:[r,a],reference_track:c,rows:$,counts:K,ops:E,...G!=null?{applied:G}:{},input_scaling:h,sizing_target:x,...z.length?{offsets:z}:{}}}function Rn(e){let n=e.counts,t=`${e.timeline} (${e.raster.join("x")}): ${n.aligned} aligned, ${n.animated} animated, ${n.no_match} no match, ${n.refused} not aligned \u2014 against ${e.reference??`V${e.reference_track}`}${e.input_scaling!=="fit"?` (Resolve units for input scaling "${e.input_scaling}")`:""}${e.sizing_target!=="edit"?`; written as Color-page ${e.sizing_target==="input"?"Input Sizing":"node Sizing"} on top of each clip's own edit transform`:""}${e.sizing_target==="edit"&&n.animated?`; the ${n.animated} moving clip(s) get Edit-page keyframes on a copy of the timeline, "${e.timeline} ALIGNED" (Resolve cannot keyframe the Edit page from a script; the copy carries every grade and setting)`:""}${e.applied!=null?`; ${e.applied} transform(s) written into the session`:""}`,o=r=>{let a=r.properties,u=r.grade_sizing,m=u?` \u2192 ${e.sizing_target} sizing Zoom ${u.zoom}${u.height!==1?` Height ${u.height}`:""} Pan ${u.pan} Tilt ${u.tilt} Rotate ${u.rotation}${u.flip_x?" FlipH":""}${u.flip_y?" FlipV":""}`:a?` \u2192 Pan ${a.Pan} Tilt ${a.Tilt} Zoom ${a.ZoomX}${a.ZoomY!==a.ZoomX?`/${a.ZoomY}`:""} Rot ${a.RotationAngle}${a.FlipX?" FlipX":""}${a.FlipY?" FlipY":""}`:"",c=r.grade_keys?.length?` \u2192 ${r.grade_keys.length} keyframes (${e.sizing_target==="node"?"node":"Input"} Sizing)`:r.edit_keys?.length?` \u2192 ${r.edit_keys.length} Edit-page keyframes`:"";return` V${r.track} ${r.record_tc} ${r.name}: ${r.verdict.toUpperCase()}${r.label?` (${r.label})`:""}${m}${c}${r.confidence!=null?`, confidence ${r.confidence}`:""}${r.reason?` \u2014 ${r.reason}`:""}`},s=(e.offsets??[]).map(r=>` the reference differs from the ${r.raster} online by ${r.label} on ${r.clips} of ${r.of} clips: a render / decode difference, not sizing \u2014 taken out of every clip, never written`);return[t,...s,...e.rows.map(o),`host_apply ops ready: ${e.ops.filter(r=>r.op==="properties"||r.op==="grade_sizing").length} ${e.sizing_target==="edit"?"properties":"grade_sizing"}, ${e.ops.filter(r=>r.op==="marker_add").length} markers (data "ConformTools:align")`].join(`
4
+ `)}var he={"16:9":16/9,"1.85":1.85,"2.00":2,"2.20":2.2,"2.35":2.35,"2.39":2.39,"2.76":2.76,"4:3":4/3,"1:1":1,"9:16":9/16,none:null};function bn(e){if(e==null)return null;if(typeof e=="number")return e>0?e:null;if(e in he)return he[e];let n=/^(\d+(?:\.\d+)?)(?:[:/](\d+(?:\.\d+)?))?$/.exec(e.trim());if(!n)throw new Error(`aspect '${e}': one of ${Object.keys(he).join(", ")}, or a ratio like 1.66 or 3:2`);let t=n[2]?Number(n[1])/Number(n[2]):Number(n[1]);return t>0?t:null}function On(e,n,t){let o=n/t,s=a=>{let u=Math.round(a);return u-u%2};if(!(e>0)||Math.abs(o-e)/e<.002)return{top:0,bottom:0,left:0,right:0};if(e>o){let a=s((t-n/e)/2);return{top:a,bottom:a,left:0,right:0}}let r=s((n-t*e)/2);return{top:0,bottom:0,left:r,right:r}}function Ve(e,n,t){let o=[],s=e;for(let[r,a]of t)if(!(a<=s)&&(r>=n||(r>s&&o.push([s,Math.min(r,n)]),s=Math.max(s,a),s>=n)))break;return s<n&&o.push([s,n]),o}function Ke(e,n,t){let o=[...e,[n,t]].sort((r,a)=>r[0]-a[0]),s=[];for(let r of o){let a=s.at(-1);a&&r[0]<=a[1]?a[1]=Math.max(a[1],r[1]):s.push([r[0],r[1]])}return s}async function Cn(e,n,t,o){let s=xe(e,n.timeline_id),r=s.resolution_w,a=s.resolution_h,u=bn(n.aspect),m=Fe(n.strictness,{tolerance_px:n.tolerance_px,min_frames:n.min_frames,gap_frames:n.gap_frames,black_threshold:n.black_threshold}),c=!!n.pixels,l=Math.max(1,Math.min(12,Math.floor(n.samples??3))),f=ue(s),h=f.filter(p=>p.enabled!==!1),x=[],M=[],k=p=>{let y=se(e,p);if(!(y.w>0&&y.h>0))return!1;let[g,I]=Xe(r,a,y.w,y.h),d=re(p,D(p)[0]);return!d.animated&&Math.abs(g-r)<.5&&Math.abs(I-a)<.5&&(d.scaleX??d.scale??100)===100&&(d.scaleY??d.scale??100)===100&&!d.posX&&!d.posY&&!d.rotation&&!d.cropL&&!d.cropR&&!d.cropT&&!d.cropB},w=new Map,$=[];for(let p of h)w.set(p,$),$=pe(p).filter(y=>y.enabled!==!1&&k(y)).reduce((y,g)=>Ke(y,...D(g)),$);let A=[];for(let p of[...h].reverse()){let y=pe(p).filter(d=>d.enabled!==!1),g=y.reduce((d,S)=>Ke(d,...D(S)),A),I=f.indexOf(p)+1;for(let d of y){let[S,Y]=D(d),v=w.get(p)??[],B=Ve(S,Y,A).flatMap(([P,U])=>Ve(P,U,v));if(!B.length)continue;let F=se(e,d);if(!(F.w>0&&F.h>0)){x.push({item_id:d.id,name:d.name??d.id,track:I,reason:"the source raster is unknown (timeline_relink the clip first)"});continue}c&&!F.path&&x.push({item_id:d.id,name:d.name??d.id,track:I,reason:"not linked: its source frames were not measured (timeline_relink first); its transform was checked"});let[ee,X]=Xe(r,a,F.w,F.h),L=re(d,S).animated,R=P=>Be(re(d,P),ee,X),O=[],H=new Map;for(let[P,U]of B){let J=new Set(c&&F.path?je(P,U,l):[]),W=new Set(L?Array.from({length:U-P},(V,q)=>P+q):J.size?[]:[P]);for(let V of J)W.add(V);let oe=[...W].sort((V,q)=>V-q);oe.forEach((V,q)=>{H.set(V,[q?V:P,oe[q+1]??U]),O.push({rec:V,place:R(V),...J.has(V)?{src:ye(d,V)}:{}})})}M.push({item:d,track:I,path:F.path,frames:O,hold:H,animated:L,box:[ee,X]})}A=g}let C=M.length?await me({op:"blanking",items:M.map(p=>({path:p.path,frames:p.frames})),out:[r,a],aspect:u},t,o):{items:[],target:[0,0,r,a]},N=C.target,Z=[],Q=new Map,z=0;C.items.forEach((p,y)=>{let g=M[y],I=new Map;Q.set(g.item.id,I);for(let d of p){if(d.bars&&z++,d.black||!d.edges.some(v=>v>0))continue;let[S,Y]=g.hold.get(d.rec);for(let v=S;v<Y;v++)Z.push({pts:v,bt:d.edges[0],bb:d.edges[1],bl:d.edges[2],br:d.edges[3],source:d.bars?"pixels":"geometry"}),I.set(v,d.zoom)}});let E=M.map(p=>({id:p.item.id,name:p.item.name??p.item.id,start:D(p.item)[0],end:D(p.item)[1],track:p.track})),K=Ee(Z,E,0,Math.round(N[2]-N[0]),Math.round(N[3]-N[1]),{tolerance_px:m.tolerance_px,min_frames:m.min_frames,gap_frames:m.gap_frames}).map(p=>{let y=1,g=Q.get(p.clip.id);for(let I=p.start_frame;I<=p.end_frame;I++){if(!g.has(I))continue;let d=g.get(I);y=d==null||y==null?null:Math.max(y,d)}return{item_id:p.clip.id,name:p.clip.name,track:p.clip.track,record_start:p.start_frame,record_end:p.end_frame,record_tc:ae(s,p.start_frame),frames:p.duration_frames,edges:{top:p.measured.bt,bottom:p.measured.bb,left:p.measured.bl,right:p.measured.br},zones:p.zones,sources:p.sources,zoom_fix:y}}),i=[],b=new Map;for(let p of K)b.set(p.item_id,[...b.get(p.item_id)??[],p]);let _=new Map,T=async(p,y)=>{let I=(await me({op:"blanking",items:[{path:null,frames:p.frames.map(S=>({rec:S.rec,place:Be(y,p.box[0],p.box[1])}))}],out:[r,a],aspect:u},void 0,o)).items[0]??[],d=[0,1,2,3].map(S=>Math.max(0,...I.map(Y=>Y.edges[S])));return{ok:d.every(S=>S<=m.tolerance_px),edges:d}};for(let[p,y]of b){let g=M.find(X=>X.item.id===p);if(g.animated)continue;let I=se(e,g.item),d={track:g.track,start:D(g.item)[0]},S=re(g.item,D(g.item)[0]),Y=X=>ke(De(X),r,a,He(I.w,I.h,r,a,Ge(g.item,s,n.input_scaling))),v;if(y.every(X=>X.sources.every(L=>L==="geometry"))){let X=["top","bottom","left","right"].map(R=>Math.max(...y.map(O=>O.edges[R]))),L=[];if(S.rotation&&Math.abs(S.rotation)<1){let R={...S,rotation:0},O=await T(g,R);O.ok?v={t:R,what:`rotation ${ne(S.rotation,2)}\xB0 removed`}:L.push({t:R,what:`rotation ${ne(S.rotation,2)}\xB0 removed, `,edges:O.edges})}L.push({t:S,what:"",edges:X});for(let R of v?[]:L){let[O,H,P,U]=R.edges,J=P-U,W=O-H;if(!(!J&&!W)){for(let[oe,V]of[[1,1],[-1,1],[1,-1],[-1,-1]]){let q={...R.t,posX:R.t.posX+oe*J/g.box[0],posY:R.t.posY+V*W/g.box[1]};if((await T(g,q)).ok){v={t:q,what:`${R.what}pan / tilt ${[J&&`${J>0?"+":""}${J} px across`,W&&`${W>0?"+":""}${W} px up/down`].filter(Boolean).join(", ")}`};break}if(!W&&V===1&&oe===-1)break}if(v)break}}}if(v){let X=Y(S),L=Y(v.t),R=Object.fromEntries(["Pan","Tilt","RotationAngle"].filter(O=>L[O]!==X[O]).map(O=>[O,L[O]]));i.push({op:"properties",item:d,set:R}),_.set(p,`${v.what} fills it`);for(let O of y)O.fix=v.what;continue}if(y.some(X=>X.zoom_fix==null))continue;let B=Math.max(...y.map(X=>X.zoom_fix)),F=Y(S),ee=X=>Math.ceil(X*B*1e5)/1e5;i.push({op:"properties",item:d,set:{ZoomX:ee(F.ZoomX),ZoomY:ee(F.ZoomY)}})}if(n.markers??!0)for(let p of K){let y=M.find(d=>d.item.id===p.item_id),g=p.zones.map(d=>`${d} ${p.edges[d.toLowerCase()]} px`).join(" \xB7 "),I=y.animated?"keyframed sizing: fix the keys":_.get(p.item_id)??(p.zoom_fix==null?"no zoom about its anchor fills it":`zoom \xD7${p.zoom_fix} fills it`);i.push({op:"marker_add",frame:p.record_start,duration:p.frames,color:"Red",name:`Blanking: ${p.name}`,note:`${g} (${p.sources.join("+")}) \u2014 ${I}`,data:"ConformTools:blanking"})}return{timeline:s.name??s.id,raster:[r,a],aspect:u,target:N,strictness:m,pixels:c,clips_checked:M.length,frames_measured:z,findings:K,refused:x,ops:i}}function Fn(e){return[`${e.findings.length?`BLANKING: ${e.findings.length} range(s) on ${new Set(e.findings.map(t=>t.item_id)).size} clip(s)`:"CLEAN: no clip shows black"} \u2014 ${e.timeline} ${e.raster.join("x")}${e.aspect?`, delivered ${ne(e.aspect,3)}:1 (black counted inside it only)`:""}; ${e.strictness.preset} (${e.strictness.tolerance_px} px, ${e.strictness.min_frames} frame(s)); ${e.clips_checked} clip(s) by their transform${e.pixels?`, ${e.frames_measured} source frame(s) measured for their own black edges`:" (pixels:false: a black edge baked into a source is not seen)"}`,...e.findings.map(t=>` V${t.track} ${t.record_tc} ${t.name} (${t.frames} frame${t.frames>1?"s":""}): ${t.zones.map(o=>`${o} ${t.edges[o.toLowerCase()]} px`).join(", ")} [${t.sources.join("+")}]${t.zoom_fix?` \u2014 zoom \xD7${t.zoom_fix} fills it`:" \u2014 no zoom about its anchor fills it"}`),...e.refused.map(t=>` V${t.track} ${t.name}: ${t.reason}`),`host_apply ops ready: ${e.ops.filter(t=>t.op==="properties").length} ZoomX/ZoomY fixes, ${e.ops.filter(t=>t.op==="marker_add").length} markers (data "ConformTools:blanking")`].join(`
5
+ `)}export{_e as a,Fe as b,Ee as c,yn as d,kn as e,fn as f,Ge as g,He as h,ke as i,Ye as j,zn as k,dn as l,In as m,Rn as n,he as o,bn as p,On as q,Cn as r,Fn as s};