conformtools 0.6.14 → 0.6.16

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 (81) hide show
  1. package/README.md +6 -1
  2. package/dist/account-W7Z2MYZU.js +3 -0
  3. package/dist/{agent-hook-setup-RTQT5JEN.js → agent-hook-setup-JCIZG3Q3.js} +1 -1
  4. package/dist/{analysis-engine-UWIK7AYB.js → analysis-engine-DCHJHZ7W.js} +1 -1
  5. package/dist/{bridge-46P34WCD.js → bridge-UPSJ7F3S.js} +1 -1
  6. package/dist/browser/timeline_core_bg.wasm +0 -0
  7. package/dist/{chunk-CQSNVQQE.js → chunk-4RA57LTJ.js} +1 -1
  8. package/dist/chunk-5W57ITT2.js +10 -0
  9. package/dist/chunk-DLF5AKXT.js +10 -0
  10. package/dist/chunk-FLLB6UZJ.js +7 -0
  11. package/dist/{chunk-FXK53VEO.js → chunk-HOACOBAY.js} +1 -1
  12. package/dist/{chunk-YKKB27VF.js → chunk-IDJIOKXA.js} +1 -1
  13. package/dist/{chunk-L3HRAIDR.js → chunk-JL454FFL.js} +1 -1
  14. package/dist/chunk-JM5LHKTU.js +510 -0
  15. package/dist/chunk-JV7TZDKJ.js +3 -0
  16. package/dist/chunk-MGMDNGNX.js +6 -0
  17. package/dist/chunk-OWWXUNJF.js +7 -0
  18. package/dist/{chunk-NZLL44HU.js → chunk-QH5DTYSE.js} +1 -1
  19. package/dist/{chunk-BO462NEL.js → chunk-QRZO5GOI.js} +1 -1
  20. package/dist/chunk-RJD44NQU.js +5 -0
  21. package/dist/{chunk-PHAMF4JF.js → chunk-ROGMKTND.js} +2 -2
  22. package/dist/{chunk-764P7TUD.js → chunk-RVZQ3Y6N.js} +1 -1
  23. package/dist/{chunk-6WLSIH2N.js → chunk-UAURERD3.js} +1 -1
  24. package/dist/{chunk-MOSLNNO5.js → chunk-UKXSKFL3.js} +1 -1
  25. package/dist/{chunk-EP4L2BWV.js → chunk-VETHR2O7.js} +1 -1
  26. package/dist/chunk-VWFEMXYZ.js +159 -0
  27. package/dist/chunk-X527E5VI.js +3 -0
  28. package/dist/{chunk-4BTTR6U3.js → chunk-XVZ7KJRI.js} +5 -5
  29. package/dist/{claude-setup-NGZ5NDYH.js → claude-setup-CM7G2YSG.js} +8 -8
  30. package/dist/cli.js +2 -2
  31. package/dist/demo-engine-CBFAAPPO.js +3 -0
  32. package/dist/engine-6YYXTF2Q.js +5 -0
  33. package/dist/framing-QYRCUEB5.js +3 -0
  34. package/dist/gfx-worker.js +1 -1
  35. package/dist/{h264-MAUQSLPY.js → h264-MAUVJTR4.js} +1 -1
  36. package/dist/{h264-mxf-2SZ66MPB.js → h264-mxf-2O4SAUTA.js} +1 -1
  37. package/dist/hook.js +1 -1
  38. package/dist/{host-relink-664IB3BC.js → host-relink-NVLUO73P.js} +1 -1
  39. package/dist/hosted-2XACQY7J.js +3 -0
  40. package/dist/hosts-GEXAZFB3.js +3 -0
  41. package/dist/http.js +3 -3
  42. package/dist/{inspect-ZM7IW23B.js → inspect-YIFLNOJW.js} +2 -2
  43. package/dist/isobmff-MTMGQKLK.js +3 -0
  44. package/dist/{mc-video-KMWTRVES.js → mc-video-HRZC7HGH.js} +1 -1
  45. package/dist/mcp.js +1 -1
  46. package/dist/{media-MSMXMA6E.js → media-WC4ZVKIL.js} +1 -1
  47. package/dist/{mxf-GOWHEH4A.js → mxf-J5QHA3VY.js} +1 -1
  48. package/dist/{ops-FI2NBTYK.js → ops-XIUVNJE2.js} +1 -1
  49. package/dist/probe-GIAKRPFV.js +3 -0
  50. package/dist/{r3d-LO5Z6DEX.js → r3d-2PCOFR2Z.js} +1 -1
  51. package/dist/resolve-bridge.py +116 -146
  52. package/dist/{sequence-patch-C2QRIT5V.js → sequence-patch-DFGEAJGB.js} +1 -1
  53. package/dist/{still-6FU7ALUV.js → still-4UR35GZH.js} +1 -1
  54. package/dist/{store-JNWELX35.js → store-MWNX47IK.js} +1 -1
  55. package/dist/timeline-Z3KD2CJX.js +3 -0
  56. package/dist/wasm/udf_bg.wasm +0 -0
  57. package/package.json +5 -5
  58. package/dist/account-F54SG45Q.js +0 -3
  59. package/dist/chunk-5PTQAFU5.js +0 -158
  60. package/dist/chunk-BTS3DFPD.js +0 -7
  61. package/dist/chunk-DP4KJ3KL.js +0 -514
  62. package/dist/chunk-EKTETRKB.js +0 -6
  63. package/dist/chunk-J43UCJ6G.js +0 -4
  64. package/dist/chunk-MJBJI6DV.js +0 -3
  65. package/dist/chunk-O372NT7V.js +0 -7
  66. package/dist/chunk-OD445COC.js +0 -7
  67. package/dist/chunk-P3EOFAZR.js +0 -10
  68. package/dist/chunk-XI6XF7FQ.js +0 -3
  69. package/dist/chunk-YYR3FM6A.js +0 -5
  70. package/dist/engine-6ACEWA4S.js +0 -5
  71. package/dist/framing-4HAHAG4I.js +0 -3
  72. package/dist/hosted-L26AGRIY.js +0 -3
  73. package/dist/hosts-BGWD7BKM.js +0 -3
  74. package/dist/isobmff-6ZPEXUF4.js +0 -3
  75. package/dist/nuke/panel/python/Startup/conformtools_nuke_startup.py +0 -44
  76. package/dist/nuke/panel/python/conformtools_nuke/__init__.py +0 -10
  77. package/dist/nuke/panel/python/conformtools_nuke/panel.py +0 -217
  78. package/dist/nuke/panel/python/conformtools_nuke/verbs.py +0 -837
  79. package/dist/probe-ZDX6XNRF.js +0 -3
  80. package/dist/resolve-presets/conform.tools.xml +0 -127
  81. package/dist/timeline-WVETLJZN.js +0 -3
@@ -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 F=new Set(["png","jpg","jpeg","tif","tiff","psd","tga","bmp","gif","webp","avif","heic","heif","exr","dpx","pict","pct"]);function B(t){let n=t.split(/[/\\]/).pop()??"",e=n.lastIndexOf(".");return e>0?n.slice(e+1).toLowerCase():""}function k(t){return!!t&&F.has(B(t))}function V(t){return t.content_kind==="still"?!0:t.content_kind!=null?!1:k(t.source_filename)||k(t.target_url)}var U=/\[\d+-\d+\]|%0?\d*d|#{3,}/;function q(t){return t.content_kind==="still"?!1:t.bundle?.kind==="image-sequence"?!0:U.test(t.target_url??"")||U.test(t.display_name??"")}function Y(t){return{size:t.length,async read(n,e){let r=Math.max(0,Math.min(n,t.length)),u=Math.max(r,Math.min(r+e,t.length));return t.subarray(r,u)}}}function J(t){return{size:t.fileSize,read:(n,e)=>t.read(n,e)}}var _=class{constructor(n){this.r=n;this.buf=new Uint8Array(0);this.base=0}async at(n,e){if(n<0||e<=0)return new Uint8Array(0);let r=n-this.base;return r>=0&&r+e<=this.buf.length?this.buf.subarray(r,r+e):(this.buf=await this.r.read(n,Math.max(e,65536)),this.base=n,this.buf.subarray(0,Math.min(e,this.buf.length)))}},A=(t,n)=>t[n]<<8|t[n+1],b=(t,n)=>t[n]|t[n+1]<<8,M=(t,n)=>t[n]|t[n+1]<<8|t[n+2]<<16,m=(t,n)=>(t[n]<<24|t[n+1]<<16|t[n+2]<<8|t[n+3])>>>0,w=(t,n)=>(t[n]|t[n+1]<<8|t[n+2]<<16|t[n+3]<<24)>>>0,P=(t,n)=>t[n]|t[n+1]<<8|t[n+2]<<16|t[n+3]<<24,g=(t,n,e)=>String.fromCharCode(...t.subarray(n,n+e));function d(t,n){if(!Number.isFinite(t)||!Number.isFinite(n))return null;let e=Math.round(t),r=Math.round(n);return e<1||r<1||e>1e6||r>1e6?null:{width:e,height:r}}var E=t=>({width:t.height,height:t.width});async function L(t){let n=await t.at(0,24);return n.length<24||n[0]!==137||g(n,1,3)!=="PNG"||g(n,12,4)!=="IHDR"?null:d(m(n,16),m(n,20))}var z=new Set([192,193,194,195,197,198,199,201,202,203,205,206,207]);function O(t){if(t.length<8)return null;let n=t[0]===73&&t[1]===73,e=t[0]===77&&t[1]===77;if(!n&&!e)return null;let r=i=>n?b(t,i):A(t,i),u=i=>n?w(t,i):m(t,i);if(r(2)!==42)return null;let l=u(4);if(l+2>t.length)return null;let c=r(l);for(let i=0;i<c;i++){let s=l+2+i*12;if(s+12>t.length)break;if(r(s)===274)return r(s+8)}return null}async function W(t,n){let e=await t.at(0,2);if(e.length<2||e[0]!==255||e[1]!==216)return null;let r=1,u=null,l=2;for(;l+4<=n;){let c=await t.at(l,4);if(c.length<4)break;if(c[0]!==255){l++;continue}let i=c[1];if(i===255){l++;continue}if(i===1||i>=208&&i<=217){l+=2;continue}if(i===218)break;let s=A(c,2);if(s<2)break;if(z.has(i)){let o=await t.at(l+4,5);o.length>=5&&(u=d(A(o,3),A(o,1)));break}if(i===225){let o=await t.at(l+4,Math.min(s-2,65536));o.length>6&&g(o,0,4)==="Exif"&&(r=O(o.subarray(6))??1)}l+=2+s}return u?r>=5&&r<=8?E(u):u:null}async function C(t){let n=await t.at(0,10);return n.length<10||g(n,0,3)!=="GIF"?null:d(b(n,6),b(n,8))}async function I(t){let n=await t.at(0,26);return n.length<22||g(n,0,2)!=="BM"?null:w(n,14)===12?d(b(n,18),b(n,20)):n.length<26?null:d(P(n,18),Math.abs(P(n,22)))}async function j(t){let n=await t.at(0,30);if(n.length<16||g(n,0,4)!=="RIFF"||g(n,8,4)!=="WEBP")return null;let e=g(n,12,4);if(e==="VP8X")return n.length<30?null:d(M(n,24)+1,M(n,27)+1);if(e==="VP8 ")return n.length<30||n[23]!==157||n[24]!==1||n[25]!==42?null:d(b(n,26)&16383,b(n,28)&16383);if(e==="VP8L"){if(n.length<25||n[20]!==47)return null;let r=w(n,21);return d((r&16383)+1,(r>>>14&16383)+1)}return null}async function S(t,n){let e=[],r=0;async function u(i,s,o){let f=i;for(;f+8<=s&&o<8;){let x=await t.at(f,16);if(x.length<8)return;let a=m(x,0),h=g(x,4,4),y=8;if(a===1){if(x.length<16)return;a=m(x,8)*2**32+m(x,12),y=16}else a===0&&(a=s-f);if(a<y||f+a>s)return;if(h==="meta")await u(f+y+4,f+a,o+1);else if(h==="iprp"||h==="ipco")await u(f+y,f+a,o+1);else if(h==="ispe"){let p=await t.at(f+y+4,8);if(p.length===8){let R=d(m(p,0),m(p,4));R&&e.push(R)}}else if(h==="irot"){let p=await t.at(f+y,1);p.length===1&&(r=p[0]&3)}f+=a}}let l=await t.at(0,12);if(l.length<12||g(l,4,4)!=="ftyp"||(await u(0,n,0),e.length===0))return null;let c=e.reduce((i,s)=>i.width*i.height>=s.width*s.height?i:s);return r===1||r===3?E(c):c}async function N(t){let n=await t.at(0,22);return n.length<22||g(n,0,4)!=="8BPS"?null:d(m(n,18),m(n,14))}var T=new Set([0,1,2,3,9,10,11]);async function X(t){let n=await t.at(0,18);if(n.length<18||n[1]>1||!T.has(n[2]))return null;let e=n[16];return[8,15,16,24,32].includes(e)?d(b(n,12),b(n,14)):null}async function v(t){let n=await t.at(0,8);if(n.length<8)return null;let e=n[0]===73&&n[1]===73,r=n[0]===77&&n[1]===77;if(!e&&!r)return null;let u=(a,h)=>e?b(a,h):A(a,h),l=(a,h)=>e?w(a,h):m(a,h);if(u(n,2)!==42)return null;let c=l(n,4),i=await t.at(c,2);if(i.length<2)return null;let s=u(i,0);if(s<1||s>4096)return null;let o=await t.at(c+2,s*12),f=0,x=0;for(let a=0;a<s;a++){let h=a*12;if(h+12>o.length)break;let y=u(o,h),R=u(o,h+2)===3?u(o,h+8):l(o,h+8);y===256?f=R:y===257&&(x=R)}return d(f,x)}async function D(t,n){let e=await t.at(0,8);if(e.length<8||e[0]!==118||e[1]!==47||e[2]!==49||e[3]!==1)return null;let r=8,u=Math.min(n,1<<20);for(;r<u;){let l=await t.at(r,512);if(l.length===0)return null;let c=l.indexOf(0);if(c<=0)return null;let i=g(l,0,c),s=l.subarray(c+1).indexOf(0);if(s<0)return null;let o=c+1+s+1;if(o+4>l.length)return null;let f=w(l,o),x=r+o+4;if(i==="dataWindow"){if(f<16)return null;let a=await t.at(x,16);return a.length<16?null:d(P(a,8)-P(a,0)+1,P(a,12)-P(a,4)+1)}r=x+f}return null}async function G(t){let n=await t.at(0,4);if(n.length<4)return null;let e=g(n,0,4),r=e==="SDPX";if(!r&&e!=="XPDS")return null;let u=await t.at(772,8);return u.length<8?null:d(r?m(u,0):w(u,0),r?m(u,4):w(u,4))}var H={png:L,jpg:W,jpeg:W,gif:C,bmp:I,webp:j,avif:S,heic:S,heif:S,psd:N,tga:X,tif:v,tiff:v,exr:D,dpx:G};async function K(t,n){let e=H[(t??"").toLowerCase()];if(!e)return null;try{return await e(new _(n),n.size)}catch{return null}}export{B as a,k as b,V as c,q as d,Y as e,J as f,K as g};
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
+ import{Qb as F,Rb as N,Ub as D}from"./chunk-VWFEMXYZ.js";import{i as j}from"./chunk-HOACOBAY.js";import{A as E,B as M,F as C,H as R,I as T,L as q,M as L,P as w,_ as b,aa as k,ba as _,da as I,g as y,n as O,s as A,t as S,u as x,v as P,y as H}from"./chunk-X527E5VI.js";var W=16e3,h=class extends Error{constructor(t,s){super(s);this.code=t}},$=class d{constructor(e,t=j,s=W){this.spec=e;this.bridge=t;this.waitMs=s;this.renders=new Map;this.host=e.host,e.items&&(this.items=n=>this.modelItems(n??{}))}async peer(){let e=await(await this.bridge()).waitFor(this.host,this.waitMs);if(!e)throw new h("not_connected",`${this.host}: the conform.tools plugin in ${this.spec.label} is not connected. ${this.spec.setup}`);return e}async needs(e){let t=await this.peer();if(!t.capabilities.includes(e))throw new h("panel_old",`${this.host}: the conform.tools plugin open in ${this.spec.label} ${t.version||""} has no ${e} (an older plugin); update it (${this.spec.setup})`);return t}async ask(e,t={},s){return await this.peer(),await(await this.bridge()).request(this.host,e,t,s)}static{this.announced=(e,t)=>e.optional_verbs.includes(t)}async support(){let e;try{e=await(await this.bridge()).waitFor(this.host,Math.min(3e3,this.waitMs))}catch(n){let o={ok:!1,reason:n instanceof Error?n.message:String(n)};return{export:o,open:o,render:o,markers:o}}if(!e){let n={ok:!1,reason:`the conform.tools plugin in ${this.spec.label} is not connected`,setup:this.spec.setup};return{export:n,open:n,render:n,markers:n}}let t=(n,o)=>n?{ok:!0}:{ok:!1,reason:`this plugin version has no ${o}`},s=e.capabilities;return{export:t(s.includes("timeline_read")||s.includes("timeline_write"),"timeline_read"),open:t(d.announced(e,"timeline_write.import_file"),"timeline_write.import_file"),render:t(s.includes("render"),"render"),markers:t(s.includes("markers"),"markers")}}async current(){let e=await this.ask("session.current_project");if(!e)return{project:"",timelines:[],timeline:""};let t=await this.ask("session.timeline_count",{project:e}),s=[];for(let o=1;o<=t;o++){let l=await this.ask("session.timeline_by_index",{project:e,index:o});l&&s.push(await this.ask("session.name",{handle:l}))}let n=await this.ask("session.current_timeline",{project:e});return{project:await this.ask("session.name",{handle:e}),timelines:s,timeline:n?await this.ask("session.name",{handle:n}):""}}async project(e={}){let t=await this.current();return{project:t.project,timeline:e.timeline??t.timeline,timelines:t.timelines,tracks:[],jobs:[],found:{},pool:{path:"",clips:0,folders:[]}}}async sequence(e){let t=await this.ask("session.current_project");if(!t)throw new h("no_project",`${this.host}: no project is open`);if(!e){let o=await this.ask("session.current_timeline",{project:t});if(!o)throw new h("no_timeline",`${this.host}: no timeline is active`);return{project:t,seq:o,name:await this.ask("session.name",{handle:o})}}let s=await this.ask("session.timeline_count",{project:t}),n=[];for(let o=1;o<=s;o++){let l=await this.ask("session.timeline_by_index",{project:t,index:o});if(!l)continue;let p=await this.ask("session.name",{handle:l});if(p===e)return{project:t,seq:l,name:p};n.push(p)}throw new h("not_found",`${this.host}: no timeline named "${e}" (have: ${n.join(", ")})`)}async model(e){let{project:t,seq:s}=await this.sequence(e);return await this.ask("timeline_read.model",{timeline:s,project:t},12e4)}async export(e){if(!e.out_path)throw new h("usage",`${this.host}: export needs out_path`);let t=await this.peer(),{project:s,seq:n,name:o}=await this.sequence(e.timeline),l=await this.ask("session.name",{handle:s}),p=r=>d.announced(t,r),m=e.out_path,c,a=[];if(p("timeline_write.export_otio")||p("timeline_write.export_xml")){let r=p("timeline_write.export_otio"),i=await this.ask(r?"timeline_write.export_otio":"timeline_write.export_xml",{project:s,timeline:n,path:e.out_path},12e4);if(c=i.format??(r?"otio":"xmeml"),i.ok===!1)throw new h("export_failed",`${this.host}: ${this.spec.label} did not write ${e.out_path}${i.errors?.length?` (${i.errors.join("; ")})`:""}`);i.path&&i.path!==e.out_path&&(m=await this.adopt(i.path,e.out_path)),a=i.warnings??[]}else if(p("timeline_read.export_file")){let r=await this.ask("timeline_read.export_file",{timeline:n,fmt:"otio",path:e.out_path},12e4);if(!r)throw new h("export_failed",`${this.host}: ${this.spec.label} exported no OTIO`);c="otio",r!==e.out_path&&(m=await this.adopt(r,e.out_path))}else{await this.needs("timeline_read");let r=await this.ask("timeline_read.model",{timeline:n,project:s},12e4),i=J(r);await E(e.out_path,JSON.stringify(i.otio)),c="otio",a=i.notes}if(!F.includes(c))throw new h("export_failed",`${this.host}: ${this.spec.label} exported ${c}, which the engine does not read (${m})`);if(!await P(m)||(await S(m)).size===0)throw new h("export_failed",`${this.host}: ${this.spec.label} did not write ${m}`);return{path:m,format:c,project:l,timeline:o,...a.length?{notes:a}:{}}}async adopt(e,t){let s=k(e)&&k(e)!==k(t)?t.slice(0,t.length-k(t).length)+k(e):t;if(await C(e,s),!N(s))throw new h("export_failed",`${this.host}: ${this.spec.label} exported ${b(e)}, which the engine does not read`);return s}async open(e){if(e.into==="scratch")throw new h("unsupported",`${this.host}: opening into a scratch project is not supported; the import lands in the open project`);let t=await this.peer();if(!d.announced(t,"timeline_write.import_file"))throw new h("unsupported",`${this.host}: this conform.tools plugin cannot import timelines (${this.spec.setup})`);let s=await this.ask("session.current_project");if(!s)throw new h("no_project",`${this.host}: no project is open`);let n=await this.ask("timeline_write.import_file",{project:s,path:e.path,sequences:null},3e5);if(!n.ok)throw new h("import_failed",`${this.host}: ${this.spec.label} did not import ${e.path}${n.issues?.length?` (${n.issues.join("; ")})`:""}`);let o=[...n.issues??[]];return n.imported.length>1&&o.push(`imported ${n.imported.length} timelines: ${n.imported.map(l=>l.name).join(", ")}`),e.name&&o.push(`${this.spec.label} names imported timelines after the file's own; name was not applied`),e.media_dirs?.length&&o.push(`${this.spec.label} links media from the paths in the file; media_dirs was not used (relink with timeline_relink before writing)`),{project:await this.ask("session.name",{handle:s}),timeline:n.imported[0]?.name??b(e.path),notes:o,restored:!e.stay,...n.bin?{folder:n.bin}:{}}}async modelItems(e){let t=await this.model(e.timeline),s=[...e.kind==="audio"?[]:t.items.map(n=>({kind:"video",track:n.track,start:n.start-t.start_frame,end:n.end-t.start_frame,id:n.handle?.$h??n.clip_id??"",name:n.name??"",color:n.color??"",flags:n.flags??[],enabled:n.enabled??!0,file:n.file_path})),...e.kind==="video"?[]:(t.audio_items??[]).map(n=>({kind:"audio",track:n.track,start:n.start-t.start_frame,end:n.end-t.start_frame,id:"",name:n.name??"",file:n.file_path??""}))].filter(n=>e.track===void 0||n.track===e.track);return{project:(await this.current()).project,timeline:t.timeline,start_frame:t.start_frame,fps:t.fps,items:s,color_groups:[],layers:1}}async apply(e){let t=e.ops.length>0&&e.ops.every(a=>a.op==="timeline_rename"&&(a.timeline||a.guid)),{project:s,seq:n,name:o}=await this.sequence(t?void 0:e.timeline),l=[],p=[],m=a=>a.op.startsWith("marker_")&&!a.item;for(let a=0;a<e.ops.length;){let r=a;for(;r<e.ops.length&&m(e.ops[r])===m(e.ops[a]);)r++;let i=e.ops.slice(a,r),u=m(i[0])?await this.markerOps(n,i):await this.clipOps(n,i,e.timeline);l.push(...u.results),p.unshift(...u.undo),a=r}let c=l.filter(a=>a.ok).length;return{project:await this.ask("session.name",{handle:s}),timeline:o,results:l,undo:p,applied:c,failed:l.length-c}}async clipOps(e,t,s){let n=await this.peer();if(n.capabilities.includes("edit"))return await this.ask("edit.apply",{timeline:e,ops:t},6e4+t.length*500);let o=(a,r)=>({op:a.op,ok:!1,detail:r});if(!n.capabilities.includes("item_meta"))return{results:t.map(a=>o(a,`${this.host}: clip edits are not reachable over this plugin`)),undo:[]};let l=await this.model(s),p=a=>a?"id"in a?{$h:a.id}:(a.kind??"video")!=="video"?null:l.items.find(r=>r.track===a.track&&r.start-l.start_frame===a.start)?.handle??null:null,m=[],c=[];for(let a of t){let r=p(a.item);try{if(!r)m.push(o(a,`no video item at ${JSON.stringify(a.item??null)}`));else if(a.op==="clip_color"){let i=await this.ask("item_meta.color",{handle:r}),u=a.color?await this.ask("item_meta.set_color",{handle:r,color:a.color}):await this.ask("item_meta.clear_color",{handle:r});m.push({op:a.op,ok:u}),u&&c.unshift({op:"clip_color",item:a.item,color:i})}else if(a.op==="enabled"&&d.announced(n,"item_meta.set_enabled")){let i=l.items.find(f=>f.handle?.$h===r.$h)?.enabled??!0,u=await this.ask("item_meta.set_enabled",{item:r,enabled:!!a.on});m.push({op:a.op,ok:u}),u&&c.unshift({op:"enabled",item:a.item,on:i})}else m.push(o(a,`${this.host}: '${a.op}' is not reachable over this plugin`))}catch(i){m.push(o(a,i instanceof Error?i.message:String(i)))}}return{results:m,undo:c}}async markerOps(e,t){let s=await this.peer(),n=r=>d.announced(s,r),o=new Map((await this.ask("markers.list",{target:e})).map(r=>[r.frame,r])),l=[],p=[],m=async r=>{let i=await this.ask("markers.add",{target:e,frame:r.frame,color:r.color??"",name:r.name??"",note:r.note??"",duration:r.duration??1,custom_data:r.custom_data??""});return i&&o.set(r.frame,{color:"",name:"",note:"",duration:1,...r}),i},c=async r=>{let i=await this.ask("markers.delete_at",{target:e,frame:r});return i&&o.delete(r),i},a=r=>({op:"marker_add",frame:r.frame,color:r.color,name:r.name,note:r.note,duration:r.duration,...r.custom_data?{data:r.custom_data}:{}});for(let r of t){let i=Number(r.frame);try{if(r.op==="marker_add"){let u=o.get(i);u&&await c(i);let f=await m({frame:i,color:r.color,name:r.name,note:r.note,duration:Number(r.duration??1),custom_data:r.data});l.push({op:r.op,ok:f}),f&&p.unshift(...u?[a(u)]:[],{op:"marker_delete",frame:i})}else if(r.op==="marker_update"){let u=o.get(i);if(!u){l.push({op:r.op,ok:!1,detail:`no marker at frame ${i}`});continue}let f=r.to_frame!==void 0?Number(r.to_frame):i,v={...u,frame:f,...r.color!==void 0?{color:String(r.color)}:{},...r.name!==void 0?{name:String(r.name)}:{},...r.note!==void 0?{note:String(r.note)}:{}},g=!0;n("markers.set_color")&&n("markers.set_text")&&n("markers.move")?(r.color!==void 0&&(g=await this.ask("markers.set_color",{target:e,frame:i,color:r.color})&&g),(r.name!==void 0||r.note!==void 0)&&(g=await this.ask("markers.set_text",{target:e,frame:i,name:r.name,note:r.note})&&g),f!==i&&(g=await this.ask("markers.move",{target:e,frame:i,to_frame:f})&&g),o.delete(i),o.set(f,v)):g=await c(i)&&await m(v),l.push({op:r.op,ok:g}),p.unshift({op:"marker_update",frame:f,color:u.color,name:u.name,note:u.note,...f!==i?{to_frame:i}:{}})}else if(r.op==="marker_delete"){let u=o.get(i),f=!!u&&await c(i);l.push({op:r.op,ok:f,...u?{}:{detail:`no marker at frame ${i}`}}),f&&u&&p.unshift(a(u))}else l.push({op:r.op,ok:!1,detail:`${this.host}: '${r.op}' is not reachable over this plugin`})}catch(u){l.push({op:r.op,ok:!1,detail:u instanceof Error?u.message:String(u)})}}return{results:l,undo:p}}async renderStart(e){if(await this.needs("render"),e.disable_tracks?.length||e.audio_tracks?.length)throw new h("unsupported",`${this.host}: disable_tracks / audio_tracks are DaVinci Resolve's; pick a preset that renders what you need`);if(!e.preset)throw new h("usage",`${this.host}: preset is required: one of ${this.spec.label}'s export presets by name`);let{seq:t,name:s}=await this.sequence(e.timeline),n=e.name??s,o={purpose:"deliver",format:"preset",preset:e.preset,target_dir:e.target_dir,name:n,...e.range?{range:[e.range.in,e.range.out]}:{}},l=await this.ask("render.submit",{timeline:t,job:o});if(!l?.id)throw new h("render_refused",`${this.host}: ${l?.error??`${this.spec.label} refused the render`}`);if(!await this.ask("render.start",{job_ids:[l.id]}))throw new h("render_refused",`${this.host}: ${this.spec.label} did not start job ${l.id}`);return this.renders.set(l.id,{dir:e.target_dir,name:n}),{job_id:l.id,state:"queued",percent:0}}async renderStatus(e){let t=await this.ask("render.status",{job_id:e});if(!t)return{job_id:e,state:"failed",percent:0,error:`${this.host}: no render job ${e}`};let s={done:"complete",rendering:"rendering",queued:"queued",failed:"failed",cancelled:"cancelled"}[t.state]??"rendering",n={job_id:e,state:s,percent:Math.round(t.progress??(s==="complete"?100:0)),...t.error?{error:t.error}:{}};if(s==="complete"||s==="failed"||s==="cancelled"){let o=this.renders.get(e);s==="complete"&&o&&(n.outputs=await V(o.dir,o.name)),await this.ask("render.remove",{job_id:e}).catch(()=>!1),this.renders.delete(e)}return n}async renderCancel(e){return await this.ask("render.cancel",{job_id:e})?{job_id:e,state:"cancelled",percent:0}:{...await this.renderStatus(e),error:`${this.spec.label}'s running export cannot be cancelled from here; stop it in ${this.spec.label}`}}};async function V(d,e){let t=[];try{for await(let s of L(d))s.isFile&&s.name.startsWith(`${e}.`)&&t.push(_(d,s.name))}catch{}return t.sort()}function J(d){let e=(c,a)=>({OTIO_SCHEMA:"RationalTime.1",value:c,rate:a}),t=(c,a,r,i=r)=>({OTIO_SCHEMA:"TimeRange.1",start_time:e(c,r),duration:e(a,i)}),s=d.fps,n=d.tracks?.length?d.tracks:[...new Set(d.items.map(c=>c.track))].sort((c,a)=>c-a).map(c=>({index:c,enabled:!0,name:"",items:d.items.filter(a=>a.track===c)})),o=c=>(c.reversed?-1:1)*(c.speed||1)/(c.fps_factor||1),l=new Map;for(let c of d.items)if(c.file_path&&c.start_tc!=null&&c.src_abs_in!=null){let a=c.src_abs_in-c.start_tc+Math.ceil((c.end-c.start)*Math.abs(o(c))*(c.fps_factor||1));l.set(c.file_path,Math.max(l.get(c.file_path)??0,a))}let p=n.map(c=>{let a=d.start_frame,r=[];for(let i of[...c.items].sort((u,f)=>u.start-f.start)){if(i.start<a)continue;i.start>a&&r.push({OTIO_SCHEMA:"Gap.1",name:"",source_range:t(0,i.start-a,s)});let u=i.src_fps||s,f=i.start_tc!=null&&l.has(i.file_path)?i.start_tc:null,v=f!=null?i.src_abs_in:i.src_in??i.src_abs_in??0,g=o(i);r.push({OTIO_SCHEMA:"Clip.2",name:i.name??b(i.file_path||""),enabled:i.enabled!==!1,source_range:t(v,i.end-i.start,u,s),media_references:{DEFAULT_MEDIA:{OTIO_SCHEMA:"ExternalReference.1",name:b(i.file_path||""),target_url:i.file_path?`file://${i.file_path}`:"",...f!=null?{available_range:t(f,l.get(i.file_path),u)}:{},metadata:{}}},active_media_reference_key:"DEFAULT_MEDIA",effects:Math.abs(g-1)>1e-6?[{OTIO_SCHEMA:"LinearTimeWarp.1",name:"",effect_name:"LinearTimeWarp",time_scalar:g}]:[],markers:[],metadata:i.reel?{cmx_3600:{reel:i.reel}}:{}}),a=i.end}return{OTIO_SCHEMA:"Track.1",name:c.name||`V${c.index}`,kind:"Video",enabled:c.enabled!==!1,children:r,effects:[],markers:[],metadata:{}}}),m=[];return d.audio_items?.length&&m.push(`${d.audio_items.length} audio clip(s) not carried: the host's plugin reports no audio source times`),d.transitions?.length&&m.push(`${d.transitions.length} transition(s) not carried (cuts in their place)`),{otio:{OTIO_SCHEMA:"Timeline.1",name:d.timeline,global_start_time:e(d.start_frame,s),metadata:{},tracks:{OTIO_SCHEMA:"Stack.1",name:"tracks",children:p,effects:[],markers:[],metadata:{}}},notes:m}}var X=16e3;var G="Install the conform.tools panel (host_setup host=premiere action=install_panel), then in Premiere open Window > UXP Plugins > conform.tools. It connects by itself from then on.";var U=class extends ${constructor(t=j,s=X){super({host:"premiere",label:"Premiere Pro",setup:G},t,s);this.items=async(t={})=>{await this.needs("edit");let{seq:s}=await this.sequence(t.timeline),n=await this.ask("edit.items",{timeline:s,kind:t.kind,track:t.track},12e4),o=n.project_path?await K(n.project_path,n.timeline).catch(p=>({error:p instanceof Error?p.message:String(p)})):{error:"the project has never been saved"},l=0;if(!("error"in o))for(let p of n.items){let m=o.get(`${p.kind}:${p.track}:${p.start}:${Number(p.end)-Number(p.start)}`);m?Object.assign(p,m,{saved:!0}):(p.saved=!1,l++)}return{...n,color_groups:[],layers:1,..."error"in o?{saved_note:`saved project not read: ${o.error}`}:{unsaved_items:l}}};this.premiereRenders=new Map}async current(){let t=await this.ask("session.describe");return{project:t.project,timelines:t.timelines,timeline:t.current}}async liveMarkers(t){if(!$.announced(await this.peer(),"edit.markers"))return null;let{seq:s}=await this.sequence(t);return await this.ask("edit.markers",{timeline:s},12e4)}async model(t){return await super.model(t)}async projectClips(){return await this.needs("edit"),await this.ask("edit.project_clips",{},12e4)}async relinkClips(t){return await this.needs("edit"),await this.ask("edit.relink_clips",{items:t},6e4+t.length*2e3)}async cutIn(t,s){await this.needs("edit");let{seq:n}=await this.sequence(t);return await this.ask("edit.cut_in",{timeline:n,cuts:s},12e4+s.length*3e3)}async renderStart(t){if(t.range)throw new h("unsupported","premiere: a frame range is not supported yet; set in/out on the sequence in Premiere");if(!t.preset||!/\.epr$/i.test(t.preset))throw new h("usage","premiere: preset must be the path of a Media Encoder preset (.epr)");let{seq:s,name:n}=await this.sequence(t.timeline);await M(t.target_dir);let o=_(t.target_dir,`${t.name??n}.mov`),l=await this.ask("render.export_sequence",{timeline:s,output_path:o,preset_path:t.preset,queue:!1},6e4);if(!l.ok)throw new h("render_refused","premiere: Premiere refused the export");let p=l.job||`ppro-${Date.now()}`;return this.premiereRenders.set(p,o),{job_id:p,state:"rendering",percent:0}}async renderStatus(t){let s=await this.ask("render.progress"),n=s[t]??s.last,o=this.premiereRenders.get(t);return n?.event==="error"||n?.event==="onEncodeError"?{job_id:t,state:"failed",percent:0,error:String(n.data??"encode error")}:n?.event==="complete"||n?.event==="onEncodeComplete"||o&&await x(o)&&!n?{job_id:t,state:"complete",percent:100,...o?{outputs:[o]}:{}}:{job_id:t,state:"rendering",percent:typeof n?.data=="number"?Math.round(Number(n.data)*100):0}}async renderCancel(t){return{job_id:t,state:"cancelled",percent:0,error:"Premiere's export cannot be cancelled from here; cancel it in Premiere / Media Encoder"}}};async function K(d,e){let{session:t}=await D(d,"prproj"),s=t.timelines.find(o=>o.name===e),n=new Map;if(!s)throw new Error(`the saved project has no sequence "${e}" (saved before it was made?)`);for(let o of s.tracks)if(!(o.kind!=="Video"&&o.kind!=="Audio"))for(let l of o.items){if(l.kind==="gap"||l.kind==="transition")continue;let p=l;n.set(`${o.kind==="Video"?"video":"audio"}:${o.track_index}:${l.timeline_range.start.value}:${l.timeline_range.duration.value}`,{saved_id:l.id,...p.speed_factor!=null&&p.speed_factor!==1?{retime:p.speed_factor}:{},...p.speed_ramped?{ramped:!0}:{},...p.speed_reverse?{reversed:!0}:{},...l.kind==="nested"?{nested:!0}:{},...p.is_multicam?{multicam:!0}:{},...p.effects?.some(m=>/stabiliz/i.test(m.kind??""))?{stabilized:!0}:{},...p.effects?.length?{saved_effects:p.effects.map(m=>m.name??m.kind??"")}:{}})}return n}function z(d=y()){return d==="darwin"?"/Library/Application Support/Adobe/Adobe Desktop Common/RemoteComponents/UPI/UnifiedPluginInstallerAgent/UnifiedPluginInstallerAgent.app/Contents/MacOS/UnifiedPluginInstallerAgent":d==="win32"?"C:\\Program Files\\Common Files\\Adobe\\Adobe Desktop Common\\RemoteComponents\\UPI\\UnifiedPluginInstallerAgent\\UnifiedPluginInstallerAgent.exe":null}async function B(){for(let d of["./uxp-plugin/","./premiere-uxp/"]){let e=A(new URL(d,import.meta.url));if(await P(_(e,"manifest.json")))return e}throw new Error("premiere: the conform.tools panel is missing from this install")}async function Q(){return JSON.parse(await H(_(await B(),"manifest.json"))).version}async function oe(d=y()){let e=z(d);if(!e||!await x(e))return{installed:!1,listing:"Creative Cloud's plugin installer is not on this machine"};let t=await w(e,d==="win32"?["/list","all"]:["--list","all"],{timeoutMs:6e4}),s=t.stdout.split(`
4
+ `).find(n=>/CONFORM\.TOOLS|conformtools/i.test(n));return{installed:!!s&&/enabled|installed/i.test(s),version:s?.match(/(\d+\.\d+\.\d+)\s*$/)?.[1],listing:t.stdout.trim()}}async function ae(d=y()){let e=z(d);if(!e||!await x(e))throw new Error("premiere: Creative Cloud's plugin installer (UnifiedPluginInstallerAgent) is not on this machine; install Creative Cloud");let t=await B(),s=await Q(),n=await q("conform-ccx-");for(let a of["manifest.json","index.html","index.js","lib","icons"])await T(_(t,a),_(n,a));let o=_(O(),"premiere");await M(o);let l=I(_(o,`conformtools-premiere-${s}.ccx`));await R(l);let p=d==="darwin"?await w("sh",["-c",`cd '${n.replace(/'/g,"'\\''")}' && zip -r -q -X '${l.replace(/'/g,"'\\''")}' manifest.json index.html index.js lib icons`]):await w("powershell",["-NoProfile","-Command",`Compress-Archive -Path '${n}\\*' -DestinationPath '${l.replace(/\.ccx$/,".zip")}' -Force; Move-Item -Force '${l.replace(/\.ccx$/,".zip")}' '${l}'`]);if(await R(n),!p.success)throw new Error(`premiere: could not package the panel: ${p.stderr.trim()}`);await w(e,d==="win32"?["/remove","conform.tools"]:["--remove","conform.tools"],{timeoutMs:12e4});let m=await w(e,d==="win32"?["/install",l]:["--install",l],{timeoutMs:18e4}),c=`${m.stdout}
5
+ ${m.stderr}`.trim();if(!m.success||!/Installation Successful/i.test(c))throw new Error(`premiere: Adobe's installer refused the panel: ${c.split(`
6
+ `).pop()}`);return{version:s,ccx:l,output:c}}export{$ as a,U as b,K as c,Q as d,oe as e,ae as f};
@@ -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 ee}from"./chunk-VETHR2O7.js";import{a as f}from"./chunk-ROGMKTND.js";import{A as I,B as U,C as H,D as S,E as q,M as V,P as Z,T as W,U as Q,b as c,ba as s,g,h as z,n as p,o as h,u as Y,y as d}from"./chunk-X527E5VI.js";var te=["align","reconform","conform-reference"],he={transferGB:2e3},l={payg:{id:"payg",name:"Pay As You Go",monthly:0,yearly:0,stripe:{},includes:{web:!0,mcp:!1,app:!1,studio_tools:!1}},web:{id:"web",name:"Indie",monthly:10,yearly:100,unlisted:!0,stripe:{},includes:{web:!0,mcp:!1,app:!1,studio_tools:!1},allowance:{transferGB:50}},indie:{id:"indie",name:"Pro",monthly:50,yearly:500,popular:!0,stripe:{monthly:"price_1T5XDXJ5lnla0aaLasKq49tm",yearly:"price_1T5XDXJ5lnla0aaL2MdMSuI9"},includes:{web:!0,mcp:!0,app:!0,studio_tools:!1},allowance:{transferGB:250}},pro:{id:"pro",name:"Studio",monthly:100,yearly:1e3,stripe:{monthly:"price_1T5X8oJ5lnla0aaLyNJa93H0",yearly:"price_1T5X8oJ5lnla0aaL3dh7b1el"},extraSeat:{monthly:75,yearly:750},includes:{web:!0,mcp:!0,app:!0,studio_tools:!0},allowance:{transferGB:1e3}},studio:{id:"studio",name:"Enterprise",monthly:"custom",yearly:"custom",stripe:{monthly:"price_1T5X7xJ5lnla0aaLoeE1aBlL",yearly:"price_1T5X7xJ5lnla0aaLeBiYo3Di"},includes:{web:!0,mcp:!0,app:!0,studio_tools:!0},allowance:he}},ne={web:!0,mcp:!0,app:!0,studio_tools:!0};var je=Object.fromEntries(Object.values(l).flatMap(e=>Object.values(e.stripe).map(t=>[t,e.id])));import{createPrivateKey as Ge,createPublicKey as _e,sign as Fe,verify as ye}from"node:crypto";import{Buffer as _}from"node:buffer";var we="CONFORMTOOLS_LICENSE_V1",re=/^[0-9A-F]{8}(-[0-9A-F]{8}){3}$/,ae=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 ie(e){let t=e.split(/\r?\n/).map(r=>r.trim()).filter(r=>r&&!r.startsWith("#")&&!r.startsWith("-----")).join(""),n=JSON.parse(_.from(t,"base64").toString("utf8"));if(n?.magic!==we||!n.payload?.data)throw new Error("not a conform.tools licence");return n.payload}function oe(e,t){let n=_.from(e.signature,"base64"),r=_.from(ae(e.data));return n.length!==64?!1:t.some(a=>ye(null,r,_e({key:_.concat([_.from("302a300506032b6570032100","hex"),_.from(a)]),format:"der",type:"spki"}),n))}var be=["cMwVBrEYKMzlG6pC7FF2lNKIoEqGz2xB5yph6clNnTg=","qnheqkkDU09l1oI6h2CFh4uQ97bY/hkTA5niGKH0+X8="],xe=be.map(e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)));function E(){let e=c("CONFORM_RECORDS_DIR");if(e)return e;let t=h(),n=g()==="darwin"?s(t,"Library/Application Support"):g()==="win32"?c("LOCALAPPDATA")??s(t,"AppData/Local"):c("XDG_DATA_HOME")??s(t,".local/share");return s(n,"conform.tools")}var Se=()=>c("CONFORM_LICENSE_PATH")??s(E(),"license.lic"),N=()=>s(E(),"grant.lic"),ve=null;function T(){return ve??=(async()=>{let e=await ee();if(!e)return[];let t=await Z(e,["machine"],{timeoutMs:15e3}).catch(()=>null);try{return JSON.parse(t?.stdout??"").machines.filter(n=>re.test(n))}catch{return[]}})()}function ke(e,t,n=Date.now()){if(!oe(e,xe))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 se(){let e;try{e=await d(Se())}catch{return null}try{return ke(ie(e),await T())}catch(t){return{ok:!1,reason:t.message}}}var Oe={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 i(){let e=c("CONFORM_ENV")==="staging"?"staging":"production",t=Oe[e];return{env:e,supabaseUrl:c("CONFORM_SUPABASE_URL")??t.supabaseUrl,anonKey:c("CONFORM_SUPABASE_ANON_KEY")??t.anonKey,appBase:c("CONFORM_APP_BASE")??t.appBase}}var Ae=600*1e3,ce=72*3600*1e3,Le=300*1e3,w=()=>s(p(),i().env==="production"?"auth.json":`auth-${i().env}.json`);async function O(){for(let e of new Set([w(),s(p(),"auth.json")]))try{let t=JSON.parse(await d(e));if(t.env===i().env&&t.access_token)return t}catch{}return await Ie()}var Pe=()=>{let e=g()==="win32"?c("APPDATA")??s(h(),"AppData","Roaming"):g()==="darwin"?s(h(),"Library","Application Support"):c("XDG_CONFIG_HOME")??s(h(),".config");return s(e,"conform-tools","kv-store.json")};async function Ie(){let e=Pe();try{let t=JSON.parse(await d(e)),n=JSON.parse(t["ct-supabase-auth"]??"null");if(!n?.access_token||!n.refresh_token)return null;let r=n.access_token.split(".")[1].replace(/-/g,"+").replace(/_/g,"/");if(JSON.parse(atob(r+"=".repeat(-r.length&3))).iss!==`${i().supabaseUrl}/auth/v1`)return null;let o={env:i().env,access_token:n.access_token,refresh_token:n.refresh_token,expires_at:n.expires_at??0};return await $(o),delete t["ct-supabase-auth"],await I(e,JSON.stringify(t)),o}catch{return null}}async function Ee(){try{for await(let e of V(p())){if(!/^auth(?:-(\w+))?\.json$/.exec(e.name))continue;let n=JSON.parse(await d(s(p(),e.name)));if(n.access_token&&n.env&&n.env!==i().env)return{other_env:n.env}}}catch{}return{}}async function $(e){await U(p()),await I(w(),JSON.stringify(e)),await q(w(),384)}var j=6e3,A=0,B=()=>Date.now()<A,ue=()=>{A=Date.now()+6e4};function tt(){A=0}var pe=e=>e.expires_at-60>Date.now()/1e3;async function R(e){let t=await O();return t&&t.refresh_token!==e.refresh_token&&Object.assign(e,t),pe(e)}async function J(e){if(pe(e))return e.access_token;if(B())return null;if(await R(e))return e.access_token;let t=await H(`${w()}.lock`);try{if(await R(e))return e.access_token;let n=i(),r=await fetch(`${n.supabaseUrl}/auth/v1/token?grant_type=refresh_token`,{method:"POST",headers:{apikey:n.anonKey,"content-type":"application/json"},body:JSON.stringify({refresh_token:e.refresh_token}),signal:AbortSignal.timeout(j)}).catch(o=>{throw ue(),o});if(!r.ok)return r.status!==400&&r.status!==401?null:await R(e)?e.access_token:"";let a=await r.json();return e.access_token=a.access_token,a.refresh_token&&(e.refresh_token=a.refresh_token),e.expires_at=a.expires_at??Math.floor(Date.now()/1e3)+(a.expires_in??3600),await $(e),e.access_token}catch{return null}finally{await t()}}async function nt(){let e=await O();return e&&await J(e)||null}var y=null;function le(e,t){return{signed_in:!0,entitled:e.entitled,env:i().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 de(e={}){let t=await se();if(t?.ok)return{signed_in:!!await O().catch(()=>null),entitled:!0,env:i().env,email:t.data.email,access:"licence",tier:t.data.tier,source:"licence"};let n=await Ne(e);return t&&!n.entitled?{...n,licence_error:t.reason}:n}async function Ne(e){if(!e.force&&y&&Date.now()-y.at<Ae)return{...y.status,source:"cache"};let t=i(),n=await O();if(!n)return{signed_in:!1,entitled:!1,env:t.env,reason:"not_signed_in",...await Ee()};let r=await J(n);if(r==="")return{signed_in:!0,entitled:!1,env:t.env,reason:"auth_rejected"};if(r&&!B())try{let a=(await T())[0],o=await fetch(`${t.supabaseUrl}/functions/v1/v1-billing/v1/billing/entitlement${a?`?machine=${a}`:""}`,{headers:{authorization:`Bearer ${r}`,apikey:t.anonKey},signal:AbortSignal.timeout(j)}).catch(u=>{throw ue(),u});if(o.status===401||o.status===403)return{signed_in:!0,entitled:!1,env:t.env,reason:"auth_rejected"};if(o.ok){let{grant:u,...L}=(await o.json()).data;a&&await Te(u),n.last_entitlement=L,n.last_entitlement_at=Date.now(),await $(n);let P=le(L,"live");return y={at:Date.now(),status:P},P}}catch{}if(n.last_entitlement&&n.last_entitlement_at&&Date.now()-n.last_entitlement_at<ce){let a=ce-(Date.now()-n.last_entitlement_at);return{...le(n.last_entitlement,"grace"),grace_remaining_h:Math.round(a/36e4)/10}}return{signed_in:!0,entitled:!1,env:t.env,reason:"offline_grace_expired"}}async function Te(e){try{if(!e)return await S(N());await U(E()),await I(N(),e)}catch{}}function $e(e){return e.source==="licence"?`${e.email} \xB7 machine licence (${e.tier}) \u2014 runs offline, no account check`:De(e)+(e.licence_error?`
4
+ (the machine licence was not used: ${e.licence_error})`:"")}function De(e){let t=i();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 MCP is in the ${l.indie.name} plan and up (the one free Timeline Exchange is on the web only). 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?` (${G(e.tier)})`:""}`,a=D(e),o=a?` \xB7 includes ${[a.web&&"the web tools",a.mcp&&"the MCP",a.app&&"the app"].filter(Boolean).join(", ")||"the web tools"}`:"";return`${n}
7
+ ${r}${o}${e.source==="grace"?` \u2014 offline, using the last check (${e.grace_remaining_h} h of grace left)`:""}`}function G(e){return l[e.toLowerCase()]?.name??e}function D(e){if(e.access==="trial")return ne;let t=(e.tier??"").toLowerCase();return(t==="enterprise"?l.studio:l[t])?.includes??null}var fe=()=>de();function rt(e){fe=e}async function me(){let e=await fe();if(e.entitled)return e;let t=e.signed_in&&e.reason==="not_entitled"?"not_entitled":"not_signed_in";throw new f(t,$e(e),{account:e})}async function at(){let e=await me();if(e.source==="licence"||D(e)?.mcp!==!1)return e;throw new f("not_entitled",`The conform.tools MCP is in the ${l.indie.name} plan ($${l.indie.monthly}/mo) and up. ${e.access==="trial"?"Your trial":`Your plan${e.tier?` (${G(e.tier)})`:""}`} includes Timeline Exchange and Conform Connect on ${i().appBase}, but not the engine on this machine. Upgrade at ${i().appBase}/pricing, then run account_status.`,{account:e,needs:"mcp"})}async function Ce(){let e=await me();if(e.source==="licence")return e;if(!D(e)?.app)throw new f("not_entitled",`The conform.tools app is in the ${l.indie.name} plan ($${l.indie.monthly}/mo) and up. ${e.access==="trial"?"Your trial":`Your plan${e.tier?` (${G(e.tier)})`:""}`} does not include the app. Upgrade at ${i().appBase}/pricing, then reopen the app.`,{account:e,needs:"app"});let t=await Ue();if(t)throw new f("seat_in_use",`This seat is in use on ${t}. Each seat runs the app on one computer at a time: quit the app there (or sign out), or wait 15 minutes after it last ran, then reopen it here.`,{account:e,needs:"seat",in_use_by:t});return e}async function it(e){if(!te.includes(e))return;let t=await Ce();if(!(t.source==="licence"||D(t)?.studio_tools!==!1))throw new f("not_entitled",`This tool is in the ${l.pro.name} plan ($${l.pro.monthly}/mo a seat). Upgrade at ${i().appBase}/pricing.`,{account:t,needs:"studio_tools"})}var Me=240*1e3,k=null;async function Ue(){if(k&&Date.now()-k.at<Me)return k.busy;let e=await ge("POST").catch(()=>null);return k={at:Date.now(),busy:e},e}async function ge(e){let t=i(),n=await O(),r=(await T())[0],a=n&&await J(n);if(!a||!r||B())return null;let o=await fetch(`${t.supabaseUrl}/functions/v1/v1-billing/v1/billing/seat`,{method:e,headers:{authorization:`Bearer ${a}`,apikey:t.anonKey,"content-type":"application/json"},body:JSON.stringify({machine:r,name:z()}),signal:AbortSignal.timeout(j)});return o.status===409?(await o.json()).in_use_by??"another computer":null}var v=null;function ot(e={}){if(v)return v;let t=i(),n=crypto.randomUUID().replaceAll("-","");return v=new Promise((r,a)=>{let o=!1,u=b=>{o||(o=!0,clearTimeout(P),setTimeout(()=>L.close(),250),v=null,b())},L=Q({hostname:"127.0.0.1",port:0,onListen:async b=>{let x=`${t.appBase}/plugin-auth?client=engine&port=${b}&state=${n}`,m=await W(x);e.onUrl?.(x,m)}},async b=>{let x=new URL(b.url);if(x.pathname!=="/callback")return new Response("not found",{status:404});let m=x.searchParams,F=m.get("access_token")??"",K=m.get("refresh_token")??"",C=!!F&&!!K&&m.get("state")===n;if(C){let X=Number(m.get("expires_at"));await $({env:t.env,access_token:F,refresh_token:K,expires_at:X>0?X:Math.floor(Date.now()/1e3)+3600}),y=null,A=0,de({force:!0}).then(M=>u(()=>r(M)),M=>u(()=>a(M)))}return new Response(Re(C),{status:C?200:400,headers:{"content-type":"text/html; charset=utf-8"}})}),P=setTimeout(()=>u(()=>a(new f("not_signed_in","sign-in was not completed within 5 minutes"))),e.timeoutMs??Le)}),v}async function st(){await ge("DELETE").catch(()=>{}),k=null,y=null,A=0,await Y(w())&&await S(w()),await S(N()).catch(()=>{});let e=s(p(),"auth.json");try{JSON.parse(await d(e)).env===i().env&&await S(e)}catch{}}function Re(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{i as a,Pe as b,j as c,tt as d,nt as e,de as f,$e as g,D as h,rt as i,me as j,at as k,Ce as l,it as m,ot as n,st as o};
@@ -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 F}from"./chunk-PHAMF4JF.js";import{A as m,C as v,E as R,F as g,G as D,L as $,Z as k,aa as i,m as b,s as x,t as p,x as S,z as _}from"./chunk-XI6XF7FQ.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};
3
+ import{a as F}from"./chunk-ROGMKTND.js";import{A as _,B as m,D as v,F as R,G as g,H as D,M as $,_ as k,ba as i,n as b,t as x,u as p,y as S}from"./chunk-X527E5VI.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};
@@ -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{Wc as d}from"./chunk-5PTQAFU5.js";import{A as p,D as m,aa as f,m as c,x as u,z as l}from"./chunk-XI6XF7FQ.js";import o from"node:process";import{readFileSync as g,rmSync as h}from"node:fs";import{createConnection as w}from"node:net";var x=new Set(["tool_run","app","tool"]),s=()=>f(c(),"engine.json");async function I(e,r){await p(c()),await l(s(),JSON.stringify({port:e,token:r||void 0,pid:o.pid})),await m(s(),384);for(let t of["SIGINT","SIGTERM"])o.on(t,()=>o.exit(0));o.on("exit",()=>{try{JSON.parse(g(s(),"utf8")).pid===o.pid&&h(s())}catch{}})}function S(e,r=1500){return new Promise(t=>{let n=w({host:"127.0.0.1",port:e}),i=y=>{clearTimeout(a),n.destroy(),t(y)},a=setTimeout(()=>i(!1),r);n.once("connect",()=>i(!0)).once("error",()=>i(!1))})}async function O(e,r){if(!x.has(e))return null;let t;try{t=JSON.parse(await u(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","x-conform-client":d()??"mcp",...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{I as a,O as b};
3
+ import{Uc as d}from"./chunk-VWFEMXYZ.js";import{A as l,B as p,E as m,ba as f,n as c,y as u}from"./chunk-X527E5VI.js";import o from"node:process";import{readFileSync as g,rmSync as h}from"node:fs";import{createConnection as w}from"node:net";var x=new Set(["tool_run","app","tool"]),s=()=>f(c(),"engine.json");async function I(e,r){await p(c()),await l(s(),JSON.stringify({port:e,token:r||void 0,pid:o.pid})),await m(s(),384);for(let t of["SIGINT","SIGTERM"])o.on(t,()=>o.exit(0));o.on("exit",()=>{try{JSON.parse(g(s(),"utf8")).pid===o.pid&&h(s())}catch{}})}function S(e,r=1500){return new Promise(t=>{let n=w({host:"127.0.0.1",port:e}),i=y=>{clearTimeout(a),n.destroy(),t(y)},a=setTimeout(()=>i(!1),r);n.once("connect",()=>i(!0)).once("error",()=>i(!1))})}async function O(e,r){if(!x.has(e))return null;let t;try{t=JSON.parse(await u(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","x-conform-client":d()??"mcp",...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{I as a,O as b};
@@ -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{Fb as L,Gb as A,Hb as E,Ib as P,Jb as T,Kb as M,Lb as D,Mb as N,Nb as z,Ob as B,Pb as I,sb as S}from"./chunk-VWFEMXYZ.js";import{a as b}from"./chunk-ROGMKTND.js";import{_ as p,t as R}from"./chunk-X527E5VI.js";async function W(o,t){let c=t.media_root?[t.media_root]:await z();if(!c.length)throw new b("invalid_args","no media_root given and no remembered locations \u2014 pass the folder to link from");for(let e of c)try{if(!(await R(e)).isDirectory)throw 0}catch{throw new b("invalid_args",`media_root is not a folder on this machine: ${e}`)}let i=A(o,{ref_ids:t.ref_ids,lane:t.lane,reset:t.reset});if(!i.length)return{session:o,changed:!1,note:"",text:"nothing in scope: every reference in scope is already linked (use reset=true to re-point) or the ids/lane matched nothing"};if(t.reset)for(let e of i)e.binding_state="unbound",delete e.coverage_reason;let m=[],k=!1,u=[];for(let e of c)if(t.gather==="path")for(let n of i){let l=n.local_path??n.target_url??"",r=l?await P(e,l):null;r?m.push(r):u.push(`${n.id} ${p(l)}: not at its recorded path under ${e}`)}else{let n=await E(e,i,t.cap);m.push(...n.paths),k||=n.capped}let{refs:$,failed:_}=await T([...new Set(m)]);t.remember&&t.media_root&&await B(t.media_root);let y=new Set(i.map(e=>e.id)),f=S(o,$,y);if(f.splits.length){o=f.session;let e=new Set([...y,...f.splits.flatMap(n=>n.into)]);i=(o.media_references??[]).filter(n=>e.has(n.id));for(let n of f.splits){let l=r=>p(i.find(G=>G.id===r)?.target_url??r);u.push(`split ${n.ref_id} across ${n.into.length} section file(s): ${n.into.map(l).join(", ")}`)}}let d=L(t.criteria),a=M(o,i,$,d,t.tolerances),O=t.criteria?.picture?await D(o,a):[],s=e=>a.rows.filter(n=>n.status===e).length,U=c.map(e=>e.split(/[\\/]/).filter(Boolean).pop()??e).join(", "),v=[`${t.dry_run?"would link":"found"} ${s("matched")} of ${i.length} clip${i.length===1?"":"s"} in ${U}${s("ambiguous")?`, ${s("ambiguous")} with more than one match`:""}${i.length-s("matched")-s("ambiguous")?`, ${i.length-s("matched")-s("ambiguous")} not found there`:""}${t.dry_run?" (dry run: nothing changed)":""}`,`scope: ${i.length} reference(s)${t.lane!=="both"?` (${t.lane} lane)`:""}${t.ref_ids?` (zone of ${t.ref_ids.length})`:""}; gather=${t.gather} under ${c.join(", ")}: ${$.length} candidate clip(s)${k?` (CAPPED at ${t.cap} \u2014 narrow the folder)`:""}`,`criteria: ${[...Object.entries(d).filter(([,e])=>e===!0).map(([e])=>e),...t.criteria?.picture?["picture"]:[]].join(", ")}${d.fileName?` (${d.fileNameMode})`:""}${d.fileExtensions?`; ext ${d.fileExtensions}`:""}; timecode containment + fps always on`,..._.length?[`could not probe ${_.length}: ${_.slice(0,5).join("; ")}`]:[],...u.slice(0,20),...O.slice(0,40)];if(t.dry_run)return{session:o,changed:!1,note:"",text:[...v,I(o,a,{compare:t.compare}),"(dry run \u2014 nothing changed; pass accept=[{ref_id,candidate_id}] to commit chosen rows, or run again without dry_run to apply every matched row)"].join(`
4
+ `)};let h,g=[];if(t.accept?.length){h=[];for(let e of t.accept){let n=a.rows.find(r=>r.ref_id===e.ref_id);n&&(n.candidate?.id===e.candidate_id||n.alternatives.some(r=>r.id===e.candidate_id))?h.push(e):g.push(`${e.ref_id} \u2192 ${e.candidate_id}: not a proposed match or alternative for that reference`)}}else h=a.rows.filter(e=>e.status==="matched"&&e.candidate).map(e=>({ref_id:e.ref_id,candidate_id:e.candidate.id}));let w=N(o,a,h),x=w.session.media_references??[],j=x.filter(e=>i.some(n=>n.id===e.id)&&e.binding_state==="linked").length,q=w.applied,C=x.filter(e=>i.some(n=>n.id===e.id)&&e.binding_state!=="linked").map(e=>` - ${e.id} ${p(e.target_url??"")}: ${e.coverage_reason??(a.rows.find(n=>n.ref_id===e.id)?.status==="ambiguous"?"ambiguous \u2014 pick one with accept":"no file matched")}`),F=[...v,`Linked ${j} of ${i.length}${g.length?`; ${g.length} pick(s) vetoed`:""}`,...q.map(e=>`- ${e.ref_id}: ${p(e.before.path??"?")} \u2192 ${e.after.path}${e.warning?` \u26A0 ${e.warning}`:""}`),...g.map(e=>` \u2717 ${e}`),...C.length?["unresolved:",...C]:[]].join(`
5
+ `);return{session:w.session,changed:!0,note:`relink ${t.gather} ${c[0]} (${j}/${i.length})`,text:F}}export{W as a};
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
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 a(e,t){return{content:[{type:"text",text:e}],...t?{structuredContent:{ok:!0,...t}}:{}}}var l=e=>a(e);function f(e){let t=e instanceof n?e:d(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 d(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 g(e,t){let[o,...r]=t.content,s=`[conformtools ${e}]`,u=o?[{...o,text:`${s} ${o.text}`},...r]:[{type:"text",text:s}],i=t.structuredContent;return{...t,content:u,...i&&!("text"in i)?{structuredContent:{...i,text:u.map(c=>c.text).join(`
4
- `)}}:{}}}function p(e){let{images:t,...o}=e;return t?.length?{...o,content:[...e.content,...t.map(r=>({type:"image",...r}))]}:o}export{n as a,a as b,l as c,f as d,g as e,p as f};
3
+ var n=class extends Error{constructor(o,r,s){super(r);this.code=o;this.data=s;this.name="ConformError"}};function c(e,t){return{content:[{type:"text",text:e}],...t?{structuredContent:{ok:!0,...t}}:{}}}var l=e=>c(e);function f(e){let t=e instanceof n?e:d(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 d(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 g(e,t){let[o,...r]=t.content,s=`[conformtools ${e}]`,u=o?[{...o,text:`${s} ${o.text}`},...r]:[{type:"text",text:s}],i=t.structuredContent;return{...t,content:u,...i&&!("text"in i)?{structuredContent:{...i,text:u.map(a=>a.text).join(`
4
+ `)}}:{}}}function p(e){let{images:t,...o}=e;return t?.length?{...o,content:[...e.content,...t.map(r=>({type:"image",...r}))]}:o}export{n as a,c as b,l as c,f as d,g as e,p as f};
@@ -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{b as s}from"./chunk-XI6XF7FQ.js";var l="0.6.14";function a(t,i){let n=t.split("-")[0].split(".").map(Number),o=i.split("-")[0].split(".").map(Number);for(let e=0;e<Math.max(n.length,o.length);e++){let r=(n[e]||0)-(o[e]||0);if(r)return r>0}return!1}var u=null;function p(){return s("CONFORM_UPDATE_CHECK")==="off"?Promise.resolve(null):u??=fetch("https://registry.npmjs.org/conformtools/latest",{signal:AbortSignal.timeout(2e3)}).then(t=>t.ok?t.json():null).then(t=>typeof t?.version=="string"?t.version:null).catch(()=>null)}var c="run npx -y conformtools@latest setup claude (or setup codex) once: it registers the server so every new session runs the newest version (npx --prefer-online), then restart the MCP client; if an old global install is shadowing it: npm rm -g conformtools";async function f(){let t=await p();return`conformtools ${l}`+(t&&a(t,l)?` \u2014 update available: ${t} \u2192 ${c}`:"")}export{l as a,a as b,p as c,c as d,f as e};
3
+ import{b as s}from"./chunk-X527E5VI.js";var l="0.6.16";function a(t,i){let n=t.split("-")[0].split(".").map(Number),o=i.split("-")[0].split(".").map(Number);for(let e=0;e<Math.max(n.length,o.length);e++){let r=(n[e]||0)-(o[e]||0);if(r)return r>0}return!1}var u=null;function p(){return s("CONFORM_UPDATE_CHECK")==="off"?Promise.resolve(null):u??=fetch("https://registry.npmjs.org/conformtools/latest",{signal:AbortSignal.timeout(2e3)}).then(t=>t.ok?t.json():null).then(t=>typeof t?.version=="string"?t.version:null).catch(()=>null)}var c="run npx -y conformtools@latest setup claude (or setup codex) once: it registers the server so every new session runs the newest version (npx --prefer-online), then restart the MCP client; if an old global install is shadowing it: npm rm -g conformtools";async function f(){let t=await p();return`conformtools ${l}`+(t&&a(t,l)?` \u2014 update available: ${t} \u2192 ${c}`:"")}export{l as a,a as b,p as c,c as d,f as e};
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{c as u,d as y,f as w,g as h}from"./chunk-LVGGCRDW.js";import{a as f,d as p}from"./chunk-OD445COC.js";import{a}from"./chunk-PHAMF4JF.js";import{b as g}from"./chunk-XI6XF7FQ.js";u(!0);var b={aaf:"aaf",avb:"avb",prproj:"prproj",drt:"resolve-drt",otio:"otio",capcut:"capcut",flame:"flame-archive",fcpxml:"resolve-fcpxml",xmeml:"fcp-xml",blscene:"baselight-blscene"},R=Object.keys(b),v=new Set([502,503,504,529,546]),d=(e,o)=>`${f().supabaseUrl}/functions/v1/${e}${o}`;async function m(){let e=await p();if(!e&&g("CONFORM_ANONYMOUS_READ")==="1")return f().anonKey;if(!e)throw new a("not_signed_in","reading and writing timelines runs on conform.tools \u2014 sign in first (account_login)");return e}async function S(e,o){let t;for(let n=0;n<3;n++){try{let i=await fetch(e,o);if(!v.has(i.status)||n===2)return i;t=new Error(`status ${i.status}`)}catch(i){if(t=i,n===2)break}await new Promise(i=>setTimeout(i,1500*(n+1)))}throw new a("offline",`conform.tools is unreachable (${t instanceof Error?t.message:String(t)}) \u2014 reading and writing timelines need the network`)}async function _(e,o){let n=(await e.json().catch(()=>({})))?.error?.message??`${o} failed (${e.status})`;throw e.status===401?new a("not_signed_in",`${n} \u2014 sign in again (account_login)`):e.status===402||e.status===403?new a("not_entitled",n):new a(e.status>=500?"engine":"refused",n)}async function P(e,o){let t=b[e];if(!t)throw new a("unsupported",`'${e}' timelines are not read by conform.tools yet`);let{fmt:n,extract:i}=await y(o,t),c=JSON.stringify({format:n,source_filename:o.name,persist:!1})+`
3
+ import{c as u,d as y,f as w,g as h}from"./chunk-LVGGCRDW.js";import{a as f,e as p}from"./chunk-OWWXUNJF.js";import{a}from"./chunk-ROGMKTND.js";import{b as g}from"./chunk-X527E5VI.js";u(!0);var b={aaf:"aaf",avb:"avb",prproj:"prproj",drt:"resolve-drt",otio:"otio",capcut:"capcut",flame:"flame-archive",fcpxml:"resolve-fcpxml",xmeml:"fcp-xml",blscene:"baselight-blscene"},R=Object.keys(b),v=new Set([502,503,504,529,546]),d=(e,o)=>`${f().supabaseUrl}/functions/v1/${e}${o}`;async function m(){let e=await p();if(!e&&g("CONFORM_ANONYMOUS_READ")==="1")return f().anonKey;if(!e)throw new a("not_signed_in","reading and writing timelines runs on conform.tools \u2014 sign in first (account_login)");return e}async function S(e,o){let t;for(let n=0;n<3;n++){try{let i=await fetch(e,o);if(!v.has(i.status)||n===2)return i;t=new Error(`status ${i.status}`)}catch(i){if(t=i,n===2)break}await new Promise(i=>setTimeout(i,1500*(n+1)))}throw new a("offline",`conform.tools is unreachable (${t instanceof Error?t.message:String(t)}) \u2014 reading and writing timelines need the network`)}async function _(e,o){let n=(await e.json().catch(()=>({})))?.error?.message??`${o} failed (${e.status})`;throw e.status===401?new a("not_signed_in",`${n} \u2014 sign in again (account_login)`):e.status===402||e.status===403?new a("not_entitled",n):new a(e.status>=500?"engine":"refused",n)}async function P(e,o){let t=b[e];if(!t)throw new a("unsupported",`'${e}' timelines are not read by conform.tools yet`);let{fmt:n,extract:i}=await y(o,t),c=JSON.stringify({format:n,source_filename:o.name,persist:!1})+`
4
4
  `+(typeof i=="string"?i:JSON.stringify(i)),s=await S(d("v1-timeline-canonicalize","/v1/timeline-canonicalize"),{method:"POST",headers:{"content-type":"application/x-ct-canonicalize-v1",authorization:`Bearer ${await m()}`,apikey:f().anonKey},body:c});s.ok||await _(s,"read");let l=await s.json();return JSON.stringify(l.session)}async function N(e,o){let t=await S(d("v1-write","/v1/write"),{method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${await m()}`,apikey:f().anonKey,"x-engine-accept-delivery":"cdn"},body:JSON.stringify({target_format:e,session:o})});t.ok||await _(t,"write");let n=h(t.headers.get(w))??[];if(t.headers.get("x-engine-delivery")==="cdn"){let r=await t.json(),c=await fetch(r.download_url);if(!c.ok)throw new a("engine",`download failed (${c.status})`);let s=new Uint8Array(await c.arrayBuffer());if(s.byteLength!==r.size)throw new a("engine",`download incomplete: ${s.byteLength} of ${r.size} bytes`);return{body:s,contentType:r.content_type,filenameSuggestion:r.filename,issues:n,serverSession:r.session_id??void 0}}let i=t.headers.get("content-disposition")?.match(/filename="([^"]+)"/)?.[1];return{body:new Uint8Array(await t.arrayBuffer()),contentType:t.headers.get("content-type")??"application/octet-stream",filenameSuggestion:i??`timeline.${e}`,issues:n,serverSession:t.headers.get("x-session-id")??void 0}}async function j(e,o,t){try{let n={"content-type":"application/json",authorization:`Bearer ${await m()}`,apikey:f().anonKey},i=k=>d("v1-sessions",`/v1/sessions/${encodeURIComponent(e)}/original${k}`),r=await fetch(i(""),{method:"POST",headers:n,body:JSON.stringify({filename:o,content_type:"application/octet-stream"})});if(!r.ok)return!1;let{key:c,upload:s}=await r.json();return(await fetch(s.url,{method:s.method??"PUT",headers:s.headers??{"content-type":"application/octet-stream"},body:t})).ok?(await fetch(i("/complete"),{method:"POST",headers:n,body:JSON.stringify({key:c})})).ok:!1}catch{return!1}}export{R as a,P as b,N as c,j as d};
@@ -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{d as _}from"./chunk-CQSNVQQE.js";function l(f){let m=[...f].sort((s,t)=>s.first_frame-t.first_frame),e=[];for(let s of m){let t=e[e.length-1];t&&s.first_frame<=t.last_frame+1?t.last_frame=Math.max(t.last_frame,s.last_frame):e.push({...s})}return e}async function g(f,m,e){let s=l(f),t=l(f.map(r=>({first_frame:Math.max(0,r.first_frame-m),last_frame:r.last_frame+m}))),n=[];for(let r of t)try{n.push(await e(r.first_frame,r.last_frame+1))}catch(o){let i=_(o)?.file_frames,u=s.filter(a=>a.last_frame>=r.first_frame&&a.first_frame<=r.last_frame);if(i==null||r.last_frame+1<=i||u.some(a=>a.first_frame<0||a.last_frame+1>i))throw o;n.push(await e(r.first_frame,i))}return n}export{l as a,g as b};
3
+ import{d as _}from"./chunk-4RA57LTJ.js";function l(f){let m=[...f].sort((s,t)=>s.first_frame-t.first_frame),e=[];for(let s of m){let t=e[e.length-1];t&&s.first_frame<=t.last_frame+1?t.last_frame=Math.max(t.last_frame,s.last_frame):e.push({...s})}return e}async function g(f,m,e){let s=l(f),t=l(f.map(r=>({first_frame:Math.max(0,r.first_frame-m),last_frame:r.last_frame+m}))),n=[];for(let r of t)try{n.push(await e(r.first_frame,r.last_frame+1))}catch(o){let i=_(o)?.file_frames,u=s.filter(a=>a.last_frame>=r.first_frame&&a.first_frame<=r.last_frame);if(i==null||r.last_frame+1<=i||u.some(a=>a.first_frame<0||a.last_frame+1>i))throw o;n.push(await e(r.first_frame,i))}return n}export{l as a,g as b};
@@ -1,6 +1,6 @@
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 E}from"./chunk-PHAMF4JF.js";import{R as x,b as y,f as g,g as f,j as w,k as h,r as p,u as b}from"./chunk-XI6XF7FQ.js";async function k(){let e=f()==="win32"?"conformtools-analyze.exe":"conformtools-analyze",r=[y("CONFORM_ANALYZE"),w(e),p(new URL(`./${e}`,import.meta.url)),p(new URL(`../../rust/target/release/${e}`,import.meta.url))].filter(Boolean);for(let n of r)if(await b(n))return n;return null}var R=e=>e.code==="not_entitled"?new E("not_entitled",String(e.why)):void 0;async function A(e){let r=await P(),n=await r.ask({op:"job",reference:e.reference,clips:e.clips,lite:e.lite??!0,display:!!e.display});if(!n.ok)throw r.close(),R(n)??new Error(`analysis engine: ${n.why}`);return r}async function N(e,r,n){let i=await P(),t=()=>i.close();n?.addEventListener("abort",t);let s;try{s=await i.ask(e,r)}finally{n?.removeEventListener("abort",t),i.close()}if(n?.aborted)throw new Error("cancelled");if(!s.ok)throw R(s)??new Error(s.why??`the analysis engine could not run ${e.op}`);return s}async function P(){let e=await k();if(!e)throw new Error(h("the analysis engine (conformtools-analyze)"));let r="",n=null,i=[],t=x(e,["serve"],o=>{r+=new TextDecoder().decode(o);let a;for(;(a=r.indexOf(`
3
+ import{a as E}from"./chunk-ROGMKTND.js";import{S as x,b as y,f as g,g as f,k as w,l as h,s as p,v as b}from"./chunk-X527E5VI.js";async function k(){let e=f()==="win32"?"conformtools-analyze.exe":"conformtools-analyze",r=[y("CONFORM_ANALYZE"),w(e),p(new URL(`./${e}`,import.meta.url)),p(new URL(`../../rust/target/release/${e}`,import.meta.url))].filter(Boolean);for(let n of r)if(await b(n))return n;return null}var R=e=>e.code==="not_entitled"?new E("not_entitled",String(e.why)):void 0;async function A(e){let r=await P(),n=await r.ask({op:"job",reference:e.reference,clips:e.clips,lite:e.lite??!0,display:!!e.display});if(!n.ok)throw r.close(),R(n)??new Error(`analysis engine: ${n.why}`);return r}async function N(e,r,n){let i=await P(),t=()=>i.close();n?.addEventListener("abort",t);let s;try{s=await i.ask(e,r)}finally{n?.removeEventListener("abort",t),i.close()}if(n?.aborted)throw new Error("cancelled");if(!s.ok)throw R(s)??new Error(s.why??`the analysis engine could not run ${e.op}`);return s}async function P(){let e=await k();if(!e)throw new Error(h("the analysis engine (conformtools-analyze)"));let r="",n=null,i=[],t=x(e,["serve"],o=>{r+=new TextDecoder().decode(o);let a;for(;(a=r.indexOf(`
4
4
  `))>=0;){let c=r.slice(0,a);r=r.slice(a+1);let l=JSON.parse(c);if(l.progress){n?.progress?.(l.progress[0],l.progress[1],l.phase??"");continue}let d=n;n=null,d?.done(l)}},o=>{console.error(o.trimEnd()),i=[...i,...o.split(`
5
5
  `).filter(a=>a.trim())].slice(-3)}),s=null;t.exited.then(o=>{s={ok:!1,why:`the analysis engine exited${o==null?"":` (code ${o})`}${i.length?`: ${i.join(" | ").slice(0,400)}`:""}`},n?.done(s)});let m=Promise.resolve();return{ask:(o,a)=>{let c=m.then(async()=>{t.hold(!0);try{if(s)return s;let l=new Promise(v=>{n={done:v,progress:a}}),u=await t.write(new TextEncoder().encode(JSON.stringify(o)+`
6
6
  `)).then(()=>!0,()=>!1)?await l:await Promise.race([l,t.exited.then(()=>s??{ok:!1,why:"the analysis engine exited"})]);return u.miss&&(console.error(`[mirror] MISS \u2014 ${u.miss} is not in the mirror. Replay never reads the source drive; record this case again with the drive mounted (CONFORM_MIRROR_MODE=record).`),g(75)),u}finally{t.hold(!1)}});return m=c.catch(()=>{}),c},close:()=>t.close()}}export{k as a,A as b,N as c,P as d};