conformtools 0.6.8 → 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-UIDAF74E.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-F74QMWXE.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-NJSA4N67.js +0 -3
  81. package/dist/chunk-7SENYEIV.js +0 -6
  82. package/dist/chunk-AMRJXYL4.js +0 -3
  83. package/dist/chunk-BW4LRTHG.js +0 -5
  84. package/dist/chunk-H6WZ43NS.js +0 -39
  85. package/dist/chunk-IPFPZBSC.js +0 -5
  86. package/dist/chunk-J2JXLEAI.js +0 -3
  87. package/dist/chunk-JZY2BHQB.js +0 -9
  88. package/dist/chunk-LGUO7PL5.js +0 -20
  89. package/dist/chunk-MS3AWOSG.js +0 -7
  90. package/dist/chunk-PFISREY4.js +0 -3
  91. package/dist/chunk-RJ6JA2LZ.js +0 -3
  92. package/dist/chunk-SGLQY53R.js +0 -3
  93. package/dist/chunk-SYX6W5TS.js +0 -378
  94. package/dist/chunk-WN53ARHJ.js +0 -3
  95. package/dist/engine-P6H5P6HP.js +0 -5
  96. package/dist/framing-7LAOPOED.js +0 -3
  97. package/dist/host-relink-UOS3P5SL.js +0 -10
  98. package/dist/hosts-66KSLCFJ.js +0 -3
  99. package/dist/media_core-YZ3PABEG.js +0 -9
  100. package/dist/mxf-FJSRFLJC.js +0 -3
  101. package/dist/store-EXUE5XX5.js +0 -3
  102. package/dist/timeline-GVVL2CBI.js +0 -3
  103. package/dist/timeline_core-IOENXK4Z.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
+ import{a as c,b as m}from"./chunk-DKGGJM6Z.js";import{Ga as u,Ia as n,K as f,aa as s}from"./chunk-DPA26AOI.js";async function y(r){await n();let e=s(r);return e==="null"?null:JSON.parse(e)}async function d(r){await n();let e;try{e=f(r)}catch{return null}if(e.length<8)return null;let t=new DataView(e.buffer,e.byteOffset,e.byteLength),i=t.getUint32(0,!0),a=t.getUint32(4,!0),o=i*a*4;return e.length<8+o?null:{width:i,height:a,rgba:new Uint8ClampedArray(e.subarray(8,8+o))}}async function b(r,e=8){await n();let t=m(u,"decode_tiff_preview");if(!t)return d(r);try{return c(t(r,e))}catch{return null}}export{y as a,d as b,b as c};
@@ -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{N as D,O as F,P as N}from"./chunk-DFDXSIMI.js";import{n as j}from"./chunk-JHTMYXJM.js";import{$ as I,B as C,D as R,E as T,H as q,I as L,L as w,W as b,Y as k,Z as _,g as y,k as O,p as S,q as A,r as x,s as P,v as H,x as E,y as M}from"./chunk-DNS4ZYIO.js";var B=16e3,h=class extends Error{constructor(t,i){super(i);this.code=t}},$=class d{constructor(e,t=j,i=B){this.spec=e;this.bridge=t;this.waitMs=i;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={},i){return await this.peer(),await(await this.bridge()).request(this.host,e,t,i)}static{this.announced=(e,t)=>e.optional_verbs.includes(t)}async support(){let e={ok:!1,reason:"the renderplugin is a DaVinci Resolve plugin"},t;try{t=await(await this.bridge()).waitFor(this.host,Math.min(3e3,this.waitMs))}catch(s){let a={ok:!1,reason:s instanceof Error?s.message:String(s)};return{export:a,open:a,render:a,markers:a,renderplugin:e}}if(!t){let s={ok:!1,reason:`the conform.tools plugin in ${this.spec.label} is not connected`,setup:this.spec.setup};return{export:s,open:s,render:s,markers:s,renderplugin:e}}let i=(s,a)=>s?{ok:!0}:{ok:!1,reason:`this plugin version has no ${a}`},n=t.capabilities;return{export:i(n.includes("timeline_read")||n.includes("timeline_write"),"timeline_read"),open:i(d.announced(t,"timeline_write.import_file"),"timeline_write.import_file"),render:i(n.includes("render"),"render"),markers:i(n.includes("markers"),"markers"),renderplugin:e}}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}),i=[];for(let s=1;s<=t;s++){let a=await this.ask("session.timeline_by_index",{project:e,index:s});a&&i.push(await this.ask("session.name",{handle:a}))}let n=await this.ask("session.current_timeline",{project:e});return{project:await this.ask("session.name",{handle:e}),timelines:i,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 s=await this.ask("session.current_timeline",{project:t});if(!s)throw new h("no_timeline",`${this.host}: no timeline is active`);return{project:t,seq:s,name:await this.ask("session.name",{handle:s})}}let i=await this.ask("session.timeline_count",{project:t}),n=[];for(let s=1;s<=i;s++){let a=await this.ask("session.timeline_by_index",{project:t,index:s});if(!a)continue;let p=await this.ask("session.name",{handle:a});if(p===e)return{project:t,seq:a,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:i}=await this.sequence(e);return await this.ask("timeline_read.model",{timeline:i,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:i,seq:n,name:s}=await this.sequence(e.timeline),a=await this.ask("session.name",{handle:i}),p=r=>d.announced(t,r),m=e.out_path,c,l=[];if(p("timeline_write.export_otio")||p("timeline_write.export_xml")){let r=p("timeline_write.export_otio"),o=await this.ask(r?"timeline_write.export_otio":"timeline_write.export_xml",{project:i,timeline:n,path:e.out_path},12e4);if(c=o.format??(r?"otio":"xmeml"),o.ok===!1)throw new h("export_failed",`${this.host}: ${this.spec.label} did not write ${e.out_path}${o.errors?.length?` (${o.errors.join("; ")})`:""}`);o.path&&o.path!==e.out_path&&(m=await this.adopt(o.path,e.out_path)),l=o.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:i},12e4),o=J(r);await E(e.out_path,JSON.stringify(o.otio)),c="otio",l=o.notes}if(!D.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 A(m)).size===0)throw new h("export_failed",`${this.host}: ${this.spec.label} did not write ${m}`);return{path:m,format:c,project:a,timeline:s,...l.length?{notes:l}:{}}}async adopt(e,t){let i=k(e)&&k(e)!==k(t)?t.slice(0,t.length-k(t).length)+k(e):t;if(await C(e,i),!F(i))throw new h("export_failed",`${this.host}: ${this.spec.label} exported ${b(e)}, which the engine does not read`);return i}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 i=await this.ask("session.current_project");if(!i)throw new h("no_project",`${this.host}: no project is open`);let n=await this.ask("timeline_write.import_file",{project:i,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 s=[...n.issues??[]];return n.imported.length>1&&s.push(`imported ${n.imported.length} timelines: ${n.imported.map(a=>a.name).join(", ")}`),e.name&&s.push(`${this.spec.label} names imported timelines after the file's own; name was not applied`),e.media_dirs?.length&&s.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:i}),timeline:n.imported[0]?.name??b(e.path),notes:s,restored:!e.stay,...n.bin?{folder:n.bin}:{}}}async modelItems(e){let t=await this.model(e.timeline),i=[...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:i,color_groups:[],layers:1}}async apply(e){let t=e.ops.length>0&&e.ops.every(l=>l.op==="timeline_rename"&&(l.timeline||l.guid)),{project:i,seq:n,name:s}=await this.sequence(t?void 0:e.timeline),a=[],p=[],m=l=>l.op.startsWith("marker_")&&!l.item;for(let l=0;l<e.ops.length;){let r=l;for(;r<e.ops.length&&m(e.ops[r])===m(e.ops[l]);)r++;let o=e.ops.slice(l,r),u=m(o[0])?await this.markerOps(n,o):await this.clipOps(n,o,e.timeline);a.push(...u.results),p.unshift(...u.undo),l=r}let c=a.filter(l=>l.ok).length;return{project:await this.ask("session.name",{handle:i}),timeline:s,results:a,undo:p,applied:c,failed:a.length-c}}async clipOps(e,t,i){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 s=(l,r)=>({op:l.op,ok:!1,detail:r});if(!n.capabilities.includes("item_meta"))return{results:t.map(l=>s(l,`${this.host}: clip edits are not reachable over this plugin`)),undo:[]};let a=await this.model(i),p=l=>l?"id"in l?{$h:l.id}:(l.kind??"video")!=="video"?null:a.items.find(r=>r.track===l.track&&r.start-a.start_frame===l.start)?.handle??null:null,m=[],c=[];for(let l of t){let r=p(l.item);try{if(!r)m.push(s(l,`no video item at ${JSON.stringify(l.item??null)}`));else if(l.op==="clip_color"){let o=await this.ask("item_meta.color",{handle:r}),u=l.color?await this.ask("item_meta.set_color",{handle:r,color:l.color}):await this.ask("item_meta.clear_color",{handle:r});m.push({op:l.op,ok:u}),u&&c.unshift({op:"clip_color",item:l.item,color:o})}else if(l.op==="enabled"&&d.announced(n,"item_meta.set_enabled")){let o=a.items.find(f=>f.handle?.$h===r.$h)?.enabled??!0,u=await this.ask("item_meta.set_enabled",{item:r,enabled:!!l.on});m.push({op:l.op,ok:u}),u&&c.unshift({op:"enabled",item:l.item,on:o})}else m.push(s(l,`${this.host}: '${l.op}' is not reachable over this plugin`))}catch(o){m.push(s(l,o instanceof Error?o.message:String(o)))}}return{results:m,undo:c}}async markerOps(e,t){let i=await this.peer(),n=r=>d.announced(i,r),s=new Map((await this.ask("markers.list",{target:e})).map(r=>[r.frame,r])),a=[],p=[],m=async r=>{let o=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 o&&s.set(r.frame,{color:"",name:"",note:"",duration:1,...r}),o},c=async r=>{let o=await this.ask("markers.delete_at",{target:e,frame:r});return o&&s.delete(r),o},l=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 o=Number(r.frame);try{if(r.op==="marker_add"){let u=s.get(o);u&&await c(o);let f=await m({frame:o,color:r.color,name:r.name,note:r.note,duration:Number(r.duration??1),custom_data:r.data});a.push({op:r.op,ok:f}),f&&p.unshift(...u?[l(u)]:[],{op:"marker_delete",frame:o})}else if(r.op==="marker_update"){let u=s.get(o);if(!u){a.push({op:r.op,ok:!1,detail:`no marker at frame ${o}`});continue}let f=r.to_frame!==void 0?Number(r.to_frame):o,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:o,color:r.color})&&g),(r.name!==void 0||r.note!==void 0)&&(g=await this.ask("markers.set_text",{target:e,frame:o,name:r.name,note:r.note})&&g),f!==o&&(g=await this.ask("markers.move",{target:e,frame:o,to_frame:f})&&g),s.delete(o),s.set(f,v)):g=await c(o)&&await m(v),a.push({op:r.op,ok:g}),p.unshift({op:"marker_update",frame:f,color:u.color,name:u.name,note:u.note,...f!==o?{to_frame:o}:{}})}else if(r.op==="marker_delete"){let u=s.get(o),f=!!u&&await c(o);a.push({op:r.op,ok:f,...u?{}:{detail:`no marker at frame ${o}`}}),f&&u&&p.unshift(l(u))}else a.push({op:r.op,ok:!1,detail:`${this.host}: '${r.op}' is not reachable over this plugin`})}catch(u){a.push({op:r.op,ok:!1,detail:u instanceof Error?u.message:String(u)})}}return{results:a,undo:p}}async renderStart(e){if(await this.needs("render"),e.renderplugin)throw new h("unsupported","the renderplugin is a DaVinci Resolve plugin");if(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:i}=await this.sequence(e.timeline),n=e.name??i,s={purpose:"deliver",format:"preset",preset:e.preset,target_dir:e.target_dir,name:n,...e.range?{range:[e.range.in,e.range.out]}:{}},a=await this.ask("render.submit",{timeline:t,job:s});if(!a?.id)throw new h("render_refused",`${this.host}: ${a?.error??`${this.spec.label} refused the render`}`);if(!await this.ask("render.start",{job_ids:[a.id]}))throw new h("render_refused",`${this.host}: ${this.spec.label} did not start job ${a.id}`);return this.renders.set(a.id,{dir:e.target_dir,name:n}),{job_id:a.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 i={done:"complete",rendering:"rendering",queued:"queued",failed:"failed",cancelled:"cancelled"}[t.state]??"rendering",n={job_id:e,state:i,percent:Math.round(t.progress??(i==="complete"?100:0)),...t.error?{error:t.error}:{}};if(i==="complete"||i==="failed"||i==="cancelled"){let s=this.renders.get(e);i==="complete"&&s&&(n.outputs=await W(s.dir,s.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 W(d,e){let t=[];try{for await(let i of L(d))i.isFile&&i.name.startsWith(`${e}.`)&&t.push(_(d,i.name))}catch{}return t.sort()}function J(d){let e=(c,l)=>({OTIO_SCHEMA:"RationalTime.1",value:c,rate:l}),t=(c,l,r,o=r)=>({OTIO_SCHEMA:"TimeRange.1",start_time:e(c,r),duration:e(l,o)}),i=d.fps,n=d.tracks?.length?d.tracks:[...new Set(d.items.map(c=>c.track))].sort((c,l)=>c-l).map(c=>({index:c,enabled:!0,name:"",items:d.items.filter(l=>l.track===c)})),s=c=>(c.reversed?-1:1)*(c.speed||1)/(c.fps_factor||1),a=new Map;for(let c of d.items)if(c.file_path&&c.start_tc!=null&&c.src_abs_in!=null){let l=c.src_abs_in-c.start_tc+Math.ceil((c.end-c.start)*Math.abs(s(c))*(c.fps_factor||1));a.set(c.file_path,Math.max(a.get(c.file_path)??0,l))}let p=n.map(c=>{let l=d.start_frame,r=[];for(let o of[...c.items].sort((u,f)=>u.start-f.start)){if(o.start<l)continue;o.start>l&&r.push({OTIO_SCHEMA:"Gap.1",name:"",source_range:t(0,o.start-l,i)});let u=o.src_fps||i,f=o.start_tc!=null&&a.has(o.file_path)?o.start_tc:null,v=f!=null?o.src_abs_in:o.src_in??o.src_abs_in??0,g=s(o);r.push({OTIO_SCHEMA:"Clip.2",name:o.name??b(o.file_path||""),enabled:o.enabled!==!1,source_range:t(v,o.end-o.start,u,i),media_references:{DEFAULT_MEDIA:{OTIO_SCHEMA:"ExternalReference.1",name:b(o.file_path||""),target_url:o.file_path?`file://${o.file_path}`:"",...f!=null?{available_range:t(f,a.get(o.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:o.reel?{cmx_3600:{reel:o.reel}}:{}}),l=o.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,i),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,i=X){super({host:"premiere",label:"Premiere Pro",setup:G},t,i);this.items=async(t={})=>{await this.needs("edit");let{seq:i}=await this.sequence(t.timeline),n=await this.ask("edit.items",{timeline:i,kind:t.kind,track:t.track},12e4),s=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"},a=0;if(!("error"in s))for(let p of n.items){let m=s.get(`${p.kind}:${p.track}:${p.start}:${Number(p.end)-Number(p.start)}`);m?Object.assign(p,m,{saved:!0}):(p.saved=!1,a++)}return{...n,color_groups:[],layers:1,..."error"in s?{saved_note:`saved project not read: ${s.error}`}:{unsaved_items:a}}};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:i}=await this.sequence(t);return await this.ask("edit.markers",{timeline:i},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,i){await this.needs("edit");let{seq:n}=await this.sequence(t);return await this.ask("edit.cut_in",{timeline:n,cuts:i},12e4+i.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:i,name:n}=await this.sequence(t.timeline);await M(t.target_dir);let s=_(t.target_dir,`${t.name??n}.mov`),a=await this.ask("render.export_sequence",{timeline:i,output_path:s,preset_path:t.preset,queue:!1},6e4);if(!a.ok)throw new h("render_refused","premiere: Premiere refused the export");let p=a.job||`ppro-${Date.now()}`;return this.premiereRenders.set(p,s),{job_id:p,state:"rendering",percent:0}}async renderStatus(t){let i=await this.ask("render.progress"),n=i[t]??i.last,s=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"||s&&await x(s)&&!n?{job_id:t,state:"complete",percent:100,...s?{outputs:[s]}:{}}:{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 N(d,"prproj"),i=t.timelines.find(s=>s.name===e),n=new Map;if(!i)throw new Error(`the saved project has no sequence "${e}" (saved before it was made?)`);for(let s of i.tracks)if(!(s.kind!=="Video"&&s.kind!=="Audio"))for(let a of s.items){if(a.kind==="gap"||a.kind==="transition")continue;let p=a;n.set(`${s.kind==="Video"?"video":"audio"}:${s.track_index}:${a.timeline_range.start.value}:${a.timeline_range.duration.value}`,{saved_id:a.id,...p.speed_factor!=null&&p.speed_factor!==1?{retime:p.speed_factor}:{},...p.speed_ramped?{ramped:!0}:{},...p.speed_reverse?{reversed:!0}:{},...a.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 V(){for(let d of["./uxp-plugin/","./premiere-uxp/"]){let e=S(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 V(),"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}),i=t.stdout.split(`
4
+ `).find(n=>/CONFORM\.TOOLS|conformtools/i.test(n));return{installed:!!i&&/enabled|installed/i.test(i),version:i?.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 V(),i=await Q(),n=await q("conform-ccx-");for(let l of["manifest.json","index.html","index.js","lib","icons"])await T(_(t,l),_(n,l));let s=_(O(),"premiere");await M(s);let a=I(_(s,`conformtools-premiere-${i}.ccx`));await R(a);let p=d==="darwin"?await w("sh",["-c",`cd '${n.replace(/'/g,"'\\''")}' && zip -r -q -X '${a.replace(/'/g,"'\\''")}' manifest.json index.html index.js lib icons`]):await w("powershell",["-NoProfile","-Command",`Compress-Archive -Path '${n}\\*' -DestinationPath '${a.replace(/\.ccx$/,".zip")}' -Force; Move-Item -Force '${a.replace(/\.ccx$/,".zip")}' '${a}'`]);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",a]:["--install",a],{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:i,ccx:a,output:c}}export{$ as a,U as b,K as c,Q as d,oe as e,ae as f};
@@ -1,5 +1,5 @@
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 k,L as h,Y as c,a as m,k as w,l as $,r as i,v as b,x as v,y as R}from"./chunk-PLRB2YXJ.js";import"./chunk-PSANHDZM.js";var y="conformtools-statusline";function x(e,n){let s=e.statusLine;return s&&!String(s.command??"").includes(y)?{settings:e,result:"kept"}:s?.command===n?{settings:e,result:"updated"}:{settings:{...e,statusLine:{type:"command",command:n,padding:0}},result:s?"updated":"installed"}}async function P(){let e=new URL(import.meta.url),n=m(new URL("./statusline.js",e));if(await i(n)){await R(w());let t=c(w(),`${y}.js`);return await k(n,t),`node "${t}"`}let s=m(new URL("../adapters/statusline.ts",e));return await i(s)?`deno run --allow-read --allow-env --no-check "${s}" ${y}`:null}function L(e,n){let s=e.permissions&&typeof e.permissions=="object"?e.permissions:{},t=Array.isArray(s.allow)?s.allow.filter(o=>typeof o=="string"):[];return t.includes(n)?{settings:e,added:!1}:{settings:{...e,permissions:{...s,allow:[...t,n]}},added:!0}}async function U(e={}){let n=e.server??"conformtools",s=`mcp__${n}`,t=e.settingsPath??c($(),".claude","settings.json"),o={};if(await i(t)){let a=await b(t);try{o=a.trim()?JSON.parse(a):{}}catch(r){throw new Error(`${t} is not valid JSON (${r instanceof Error?r.message:r}); fix it first, nothing was changed`)}}let p=L(o,s),d=p.settings,l="skipped",C=p.added,S=e.statusline===!1?null:await P();if(S){let a=x(d,S);d=a.settings,l=a.result}let f;(C||l==="installed"||l==="updated"&&d!==p.settings)&&(await i(t)?(f=`${t}.conformtools-backup`,await k(t,f)):await Deno.mkdir(c(t,".."),{recursive:!0}),await v(t,JSON.stringify(d,null,2)+`
3
+ import{B as k,L as h,Z as c,a as m,k as w,l as $,r as i,v as b,x as v,y as R}from"./chunk-DNS4ZYIO.js";import"./chunk-PSANHDZM.js";var y="conformtools-statusline";function x(e,n){let s=e.statusLine;return s&&!String(s.command??"").includes(y)?{settings:e,result:"kept"}:s?.command===n?{settings:e,result:"updated"}:{settings:{...e,statusLine:{type:"command",command:n,padding:0}},result:s?"updated":"installed"}}async function P(){let e=new URL(import.meta.url),n=m(new URL("./statusline.js",e));if(await i(n)){await R(w());let t=c(w(),`${y}.js`);return await k(n,t),`node "${t}"`}let s=m(new URL("../adapters/statusline.ts",e));return await i(s)?`deno run --allow-read --allow-env --no-check "${s}" ${y}`:null}function L(e,n){let s=e.permissions&&typeof e.permissions=="object"?e.permissions:{},t=Array.isArray(s.allow)?s.allow.filter(o=>typeof o=="string"):[];return t.includes(n)?{settings:e,added:!1}:{settings:{...e,permissions:{...s,allow:[...t,n]}},added:!0}}async function U(e={}){let n=e.server??"conformtools",s=`mcp__${n}`,t=e.settingsPath??c($(),".claude","settings.json"),o={};if(await i(t)){let a=await b(t);try{o=a.trim()?JSON.parse(a):{}}catch(r){throw new Error(`${t} is not valid JSON (${r instanceof Error?r.message:r}); fix it first, nothing was changed`)}}let p=L(o,s),d=p.settings,l="skipped",C=p.added,S=e.statusline===!1?null:await P();if(S){let a=x(d,S);d=a.settings,l=a.result}let f;(C||l==="installed"||l==="updated"&&d!==p.settings)&&(await i(t)?(f=`${t}.conformtools-backup`,await k(t,f)):await Deno.mkdir(c(t,".."),{recursive:!0}),await v(t,JSON.stringify(d,null,2)+`
4
4
  `));let u="skipped",g;if(e.register!==!1)try{if((await h("claude",["mcp","get",n])).code===0)u="already";else{let r=await h("claude",["mcp","add","-s","user",n,"--","npx","-y","conformtools@latest","mcp"]);u=r.code===0?"added":"failed",r.code!==0&&(g=r.stderr.trim().slice(-300))}}catch(a){u="failed",g=`claude CLI not found (${a instanceof Error?a.message:a}); add the server with: claude mcp add -s user ${n} -- npx -y conformtools@latest mcp`}return{settings:t,rule:s,added:C,backup:f,registered:u,detail:g,statusline:l}}function M(e){return[e.added?`Claude Code: allowed every conform.tools tool (${e.rule}) in ${e.settings}${e.backup?` (backup: ${e.backup})`:""}`:`Claude Code: ${e.rule} was already allowed in ${e.settings}`,{already:"MCP server: already registered",added:"MCP server: registered (claude mcp add -s user)",skipped:"MCP server: not checked",failed:`MCP server: not registered: ${e.detail??"claude mcp add failed"}`}[e.registered],{installed:"Status line: conform.tools (the running job and its progress) at the bottom of Claude Code",updated:"Status line: conform.tools, refreshed",kept:"Status line: you already have one, so it was left as it is (conformtools statusline prints ours)",skipped:"Status line: not installed"}[e.statusline],"Restart Claude Code (or /mcp) to load it. Remove the rule from permissions.allow to be asked again."].join(`
5
5
  `)}export{U as setupClaude,M as setupText,L as withAllowRule,x as withStatusLine};
package/dist/cli.js CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{$ as V,V as J,X as H,Y as F,_ as G}from"./chunk-SYX6W5TS.js";import"./chunk-BW4LRTHG.js";import"./chunk-IPFPZBSC.js";import"./chunk-MS3AWOSG.js";import"./chunk-7SENYEIV.js";import"./chunk-TXQR2HI2.js";import{J as L}from"./chunk-H6WZ43NS.js";import{a as A}from"./chunk-LGUO7PL5.js";import"./chunk-GM6QKY7W.js";import"./chunk-PFISREY4.js";import"./chunk-JV7TZDKJ.js";import"./chunk-VIBEEWPC.js";import"./chunk-PFZVET7S.js";import"./chunk-6V4OEOOX.js";import"./chunk-RGMTLNMF.js";import"./chunk-D4WPRRBT.js";import"./chunk-WN53ARHJ.js";import"./chunk-A7FNR3T5.js";import"./chunk-J2JXLEAI.js";import"./chunk-SGLQY53R.js";import"./chunk-DKGGJM6Z.js";import"./chunk-D6YDLKSA.js";import"./chunk-AMRJXYL4.js";import"./chunk-3D3Z4TBR.js";import"./chunk-2BPR6LK6.js";import"./chunk-GK4YYKJ6.js";import{b as W}from"./chunk-NU3X7P4N.js";import"./chunk-RJ6JA2LZ.js";import"./chunk-F74QMWXE.js";import{h as D,i as I}from"./chunk-JZY2BHQB.js";import"./chunk-PHAMF4JF.js";import{b as T,e as c,f as s}from"./chunk-PLRB2YXJ.js";import"./chunk-C2ESM27Z.js";import"./chunk-PSANHDZM.js";var i=process.stdout,C=22,E=20,R=E/2,Y=(t,n)=>Math.abs(n)<=Math.min(1-.417*Math.abs(t),2.393*(1-Math.abs(t))),nt=(t,n)=>t*t+n*n<=1;function et(t){let n=.62**-t,l=[];for(let r=0;r<E;r++){let g=[];for(let p=0;p<C;p++){let w=(p+.5)/C*2-1,u=(r+.5)/E*2-1,d=!1;if(Y(w,u))for(let $=0;$<6;$++)for(let y of[!1,!0]){let m=.62**$*(y?.77:1)*n,x=.5*Math.max(0,1-m)**2;(y?nt:Y)(w/m,(u-x)/m)&&(d=!y)}g.push(d)}l.push(g)}return l}var M={C:["\u25E2\u2588\u25E3","\u2588 ","\u2588 ","\u25E5\u2588\u25E4"],O:["\u25E2\u2588\u25E3","\u2588 \u2588","\u2588 \u2588","\u25E5\u2588\u25E4"],N:["\u2588\u25E3 \u2588","\u2588\u2588\u25E3\u2588","\u2588\u25E5\u2588\u2588","\u2588 \u25E5\u2588"],F:["\u2588\u2588\u2588","\u2588\u2584\u2584","\u2588 ","\u2588 "],R:["\u2588\u2588\u25E3","\u2588 \u2588","\u2588\u2588\u25E4","\u2588 \u2588"],M:["\u2588\u25E3\u25E2\u2588","\u2588\u25E5\u25E4\u2588","\u2588 \u2588","\u2588 \u2588"],T:["\u2588\u2588\u2588"," \u2588 "," \u2588 "," \u2588 "],L:["\u2588 ","\u2588 ","\u2588 ","\u2588\u2588\u2588"],S:["\u25E2\u2588\u25E3","\u25E5\u25E3 "," \u25E5\u25E3","\u25E5\u2588\u25E4"],".":[" "," "," ","\u25CF"]},B="CONFORM.TOOLS",rt=[...B].reduce((t,n)=>t+M[n][0].length+1,-1);async function K(t){if(!i.isTTY)return!1;let n=!!T("NO_COLOR"),l=/truecolor|24bit/i.test(T("COLORTERM")??""),r=o=>e=>n?e:`\x1B[${o}m${e}\x1B[0m`,g=r(l?"38;2;255;60;0":"38;5;202"),p=r(l?"38;2;255;222;0":"38;5;220"),w=r("1"),u=r("2"),d=(i.columns??80)>=C+4+rt,$=o=>[...B].map(e=>e==="."?g(M[e][o]):w(M[e][o])).join(" "),y=(o,e)=>d&&o>=2&&o<=5?$(o-2):!d&&o===3?`${w("conform")}${g(".")}${w("tools")}`:o===7?e:"",m=(o,e,O=[])=>{let S=et(o),_=[];for(let f=0;f<R;f++){let Z=S[2*f].map((N,ot)=>{let k=S[2*f+1][ot];return N&&k?"\u2588":N?"\u2580":k?"\u2584":" "}).join(""),tt=f>=8?O[f-8]??"":"";_.push(` ${g(Z)} ${tt||y(f,e)}\x1B[K`)}return _.join(`
3
+ import{$ as V,V as J,X as H,Y as F,_ as G}from"./chunk-QHXX5GDD.js";import"./chunk-6HZP2OJA.js";import"./chunk-2MJAQROY.js";import"./chunk-Y2QHZUGL.js";import"./chunk-E5ENIKNR.js";import"./chunk-ZVUKOFUX.js";import"./chunk-56EEBHP2.js";import{K as L}from"./chunk-DFDXSIMI.js";import"./chunk-NQNS4Y2B.js";import"./chunk-7QUSVHO2.js";import"./chunk-PFZVET7S.js";import{a as A}from"./chunk-JHTMYXJM.js";import"./chunk-UGVGRL5M.js";import"./chunk-YUO3UWPH.js";import"./chunk-JV7TZDKJ.js";import"./chunk-6V4OEOOX.js";import"./chunk-RGMTLNMF.js";import"./chunk-ISKNIQVO.js";import"./chunk-JKOB3U54.js";import"./chunk-EEDLRRKU.js";import"./chunk-DKGGJM6Z.js";import"./chunk-WJ5EWXP2.js";import"./chunk-C2ESM27Z.js";import"./chunk-D6YDLKSA.js";import"./chunk-XDI6CPPV.js";import"./chunk-DGXZB7MO.js";import"./chunk-JXTRQ3UG.js";import"./chunk-YC7QDS5U.js";import{b as W}from"./chunk-NU3X7P4N.js";import"./chunk-DPA26AOI.js";import"./chunk-GM262EDM.js";import{e as D,f as I}from"./chunk-XJNWAQON.js";import"./chunk-CJYLQ3UM.js";import"./chunk-PHAMF4JF.js";import{b as T,e as c,f as s}from"./chunk-DNS4ZYIO.js";import"./chunk-PSANHDZM.js";var i=process.stdout,C=22,E=20,R=E/2,Y=(t,n)=>Math.abs(n)<=Math.min(1-.417*Math.abs(t),2.393*(1-Math.abs(t))),nt=(t,n)=>t*t+n*n<=1;function et(t){let n=.62**-t,l=[];for(let r=0;r<E;r++){let g=[];for(let p=0;p<C;p++){let w=(p+.5)/C*2-1,u=(r+.5)/E*2-1,d=!1;if(Y(w,u))for(let $=0;$<6;$++)for(let y of[!1,!0]){let m=.62**$*(y?.77:1)*n,x=.5*Math.max(0,1-m)**2;(y?nt:Y)(w/m,(u-x)/m)&&(d=!y)}g.push(d)}l.push(g)}return l}var M={C:["\u25E2\u2588\u25E3","\u2588 ","\u2588 ","\u25E5\u2588\u25E4"],O:["\u25E2\u2588\u25E3","\u2588 \u2588","\u2588 \u2588","\u25E5\u2588\u25E4"],N:["\u2588\u25E3 \u2588","\u2588\u2588\u25E3\u2588","\u2588\u25E5\u2588\u2588","\u2588 \u25E5\u2588"],F:["\u2588\u2588\u2588","\u2588\u2584\u2584","\u2588 ","\u2588 "],R:["\u2588\u2588\u25E3","\u2588 \u2588","\u2588\u2588\u25E4","\u2588 \u2588"],M:["\u2588\u25E3\u25E2\u2588","\u2588\u25E5\u25E4\u2588","\u2588 \u2588","\u2588 \u2588"],T:["\u2588\u2588\u2588"," \u2588 "," \u2588 "," \u2588 "],L:["\u2588 ","\u2588 ","\u2588 ","\u2588\u2588\u2588"],S:["\u25E2\u2588\u25E3","\u25E5\u25E3 "," \u25E5\u25E3","\u25E5\u2588\u25E4"],".":[" "," "," ","\u25CF"]},B="CONFORM.TOOLS",rt=[...B].reduce((t,n)=>t+M[n][0].length+1,-1);async function K(t){if(!i.isTTY)return!1;let n=!!T("NO_COLOR"),l=/truecolor|24bit/i.test(T("COLORTERM")??""),r=o=>e=>n?e:`\x1B[${o}m${e}\x1B[0m`,g=r(l?"38;2;255;60;0":"38;5;202"),p=r(l?"38;2;255;222;0":"38;5;220"),w=r("1"),u=r("2"),d=(i.columns??80)>=C+4+rt,$=o=>[...B].map(e=>e==="."?g(M[e][o]):w(M[e][o])).join(" "),y=(o,e)=>d&&o>=2&&o<=5?$(o-2):!d&&o===3?`${w("conform")}${g(".")}${w("tools")}`:o===7?e:"",m=(o,e,O=[])=>{let S=et(o),_=[];for(let f=0;f<R;f++){let Z=S[2*f].map((N,ot)=>{let k=S[2*f+1][ot];return N&&k?"\u2588":N?"\u2580":k?"\u2584":" "}).join(""),tt=f>=8?O[f-8]??"":"";_.push(` ${g(Z)} ${tt||y(f,e)}\x1B[K`)}return _.join(`
4
4
  `)+`
5
5
  `},x=null;t.account.then(o=>{x=o});let P=o=>W(o,24),U=!T("CI")&&T("TERM")!=="dumb";if(i.write(`
6
6
  `),U){let o=()=>i.write("\x1B[?25h");process.once("SIGINT",()=>{o(),process.exit(130)}),i.write("\x1B[?25l"+m(0,p(`\u25B6 ${P(0)}`)));let e=Date.now(),O=0;for(;x===null||Date.now()-e<900;)await new Promise(S=>setTimeout(S,1e3/24)),O=Math.round((Date.now()-e)*24/1e3),i.write(`\x1B[${R}A\r`+m(O/22%1,`${p(`\u25B6 ${P(O)}`)} ${u("checking your account\u2026")}`));i.write(`\x1B[${R}A\r`),o()}let X=(x??await t.account).split(`
7
7
  `);return i.write(m(0,`${u("v")}${t.version} ${u("\xB7 built by post pros")}`,X.map(o=>u(o)))),i.write(`
8
- `),!0}var z=()=>K({version:A,account:Promise.race([D().catch(()=>null),new Promise(t=>setTimeout(t,1500,null))]).then(t=>t?I(t):"account: no answer (offline?)")}),st={login:"account_login",logout:"account_logout",whoami:"account_status",status:"account_status",telemetry:"account_telemetry"};c()[0]==="mcp"&&(await import("./mcp.js"),await new Promise(()=>{}));c()[0]==="http"&&(await import("./http.js"),await new Promise(()=>{}));c()[0]==="statusline"&&((await import("./statusline-GMMCFMOA.js")).main(),s(0));if(c()[0]==="setup"){let t=c()[1];t!=="claude"&&(console.error(`conformtools setup <client>: supported: claude${t?` (not ${t} yet)`:""}`),s(2));let{setupClaude:n,setupText:l}=await import("./claude-setup-IIWUB4CE.js");try{console.log(l(await n())),s(0)}catch(r){console.error(r instanceof Error?r.message:String(r)),s(1)}}var q=c().includes("--json"),[a,v]=c().filter(t=>t!=="--json");if(!a||a==="--list"||a==="help"||a==="--help"){await z(),console.log(`conformtools <verb> '<json args>' [--json]
8
+ `),!0}var z=()=>K({version:A,account:Promise.race([D().catch(()=>null),new Promise(t=>setTimeout(t,1500,null))]).then(t=>t?I(t):"account: no answer (offline?)")}),st={login:"account_login",logout:"account_logout",whoami:"account_status",status:"account_status",telemetry:"account_telemetry"};c()[0]==="mcp"&&(await import("./mcp.js"),await new Promise(()=>{}));c()[0]==="http"&&(await import("./http.js"),await new Promise(()=>{}));c()[0]==="statusline"&&((await import("./statusline-GMMCFMOA.js")).main(),s(0));if(c()[0]==="setup"){let t=c()[1];t!=="claude"&&(console.error(`conformtools setup <client>: supported: claude${t?` (not ${t} yet)`:""}`),s(2));let{setupClaude:n,setupText:l}=await import("./claude-setup-OKOPPDMB.js");try{console.log(l(await n())),s(0)}catch(r){console.error(r instanceof Error?r.message:String(r)),s(1)}}var q=c().includes("--json"),[a,v]=c().filter(t=>t!=="--json");if(!a||a==="--list"||a==="help"||a==="--help"){await z(),console.log(`conformtools <verb> '<json args>' [--json]
9
9
 
10
10
  login / whoami / logout sign in with your conform.tools Google account
11
11
  telemetry on|off|status outcome telemetry (on by default, content-free; see the README, Feedback and privacy)
Binary file
Binary file
@@ -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,b}from"./chunk-J2JXLEAI.js";import"./chunk-RJ6JA2LZ.js";import"./chunk-PSANHDZM.js";export{b as decodeCr3Wasm,a as inspectCr3Wasm};
3
+ import{a,b}from"./chunk-WJ5EWXP2.js";import"./chunk-DPA26AOI.js";import"./chunk-PSANHDZM.js";export{b as decodeCr3Wasm,a as inspectCr3Wasm};
@@ -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,b,c}from"./chunk-A7FNR3T5.js";import"./chunk-DKGGJM6Z.js";import"./chunk-RJ6JA2LZ.js";import"./chunk-PSANHDZM.js";export{c as decodeDngPreviewWasm,b as decodeDngWasm,a as inspectDngWasm};
3
+ import{a,b,c}from"./chunk-EEDLRRKU.js";import"./chunk-DKGGJM6Z.js";import"./chunk-DPA26AOI.js";import"./chunk-PSANHDZM.js";export{c as decodeDngPreviewWasm,b as decodeDngWasm,a as inspectDngWasm};
@@ -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,b,c}from"./chunk-D4WPRRBT.js";import"./chunk-DKGGJM6Z.js";import"./chunk-RJ6JA2LZ.js";import"./chunk-PSANHDZM.js";export{c as decodeDpxPreviewWasm,b as decodeDpxWasm,a as inspectDpxWasm};
3
+ import{a,b,c}from"./chunk-ISKNIQVO.js";import"./chunk-DKGGJM6Z.js";import"./chunk-DPA26AOI.js";import"./chunk-PSANHDZM.js";export{c as decodeDpxPreviewWasm,b as decodeDpxWasm,a as inspectDpxWasm};
@@ -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"./chunk-PSANHDZM.js";function S(){let e=window.__CONFORM_ENGINE__;if(e?.base)return e;let t=new URLSearchParams(window.location.search),n=l=>{try{return sessionStorage.getItem(`conform.engine.${l}`)}catch{return null}},o=(l,c)=>{try{sessionStorage.setItem(`conform.engine.${l}`,c)}catch{}},r=t.get("engine"),i=t.get("token");return r?o("url",r):r=n("url"),i?o("token",i):i=n("token"),{base:r?/^\d+$/.test(r)?`http://127.0.0.1:${r}`:r.replace(/\/$/,""):"http://127.0.0.1:7791",token:i??""}}var g=typeof window>"u"?{base:"http://127.0.0.1:7791",token:""}:S(),f=(e=!0)=>({...e?{"content-type":"application/json"}:{},...g.token?{authorization:`Bearer ${g.token}`}:{}}),y=class extends Error{constructor(n,o){super(o);this.code=n}};async function s(e,t,n,o=[]){let r;try{r=await fetch(`${g.base}${t}`,{method:e,headers:f(),body:n===void 0?void 0:JSON.stringify(n)})}catch{throw new y("engine_down",`the conform.tools engine is not running at ${g.base}`)}let i=await r.json().catch(()=>({}));if(!r.ok&&!("text"in i)&&!o.includes(r.status))throw new y(i.code??String(r.status),i.message??`HTTP ${r.status}`);return i}async function _(e,t,n,o){let r;try{r=await fetch(`${g.base}${e}`,{...t,headers:f(),signal:o})}catch{o?.aborted||n({type:"error",code:"engine_down",message:`the conform.tools engine is not running at ${g.base}`});return}if(!r.ok||!r.body){let c=await r.json().catch(()=>({}));n({type:"error",code:c.code??String(r.status),message:c.message??`HTTP ${r.status}`});return}let i=r.body.getReader(),b=new TextDecoder,l="";for(;;){let{value:c,done:m}=await i.read();if(m)break;l+=b.decode(c,{stream:!0});let u;for(;(u=l.indexOf(`
4
+
5
+ `))>=0;){let h=l.slice(0,u);l=l.slice(u+2),h.startsWith("data: ")&&n(JSON.parse(h.slice(6)))}}}var w=new Set,k=null;function P(){if(k)return;let e=k=new AbortController;(async()=>{for(;!e.signal.aborted;)await _("/app/events",{method:"GET"},t=>{for(let n of w)n(t)},e.signal).catch(()=>{}),e.signal.aborted||await new Promise(t=>setTimeout(t,2e3))})()}var x={base:g.base,health:()=>s("GET","/health"),verb:(e,t={})=>s("POST",`/verbs/${e}`,t),job:e=>s("GET",`/jobs/${e}`),cancelJob:e=>s("DELETE",`/jobs/${e}`),front:e=>s("POST","/app/front",e),account:()=>s("GET","/app/account"),projects:()=>s("GET","/app/projects"),createProject:e=>s("POST","/app/projects",e),project:e=>s("GET",`/app/projects/${e}`),attachSession:(e,t)=>s("PUT",`/app/projects/${e}/sessions`,{session_id:t}),saveContext:(e,t,n)=>s("PUT",`/app/projects/${e}/context`,{text:t,base:n},[409]),frame:async(e,t,n,o,r,i,b)=>{let l=new URLSearchParams({f:String(t),w:String(n),...r?{timeline:r}:{},...i?{track:String(i)}:{},...b?{grade:"resolve",...b.host_timeline?{host_timeline:b.host_timeline}:{}}:{}}),c=await fetch(`${g.base}/app/sessions/${e}/frame?${l}`,{headers:f(!1),signal:o}).catch(()=>null);if(!c?.ok)return null;if(c.headers.get("content-type")!=="application/x-conform-pixels")return createImageBitmap(await c.blob()).catch(()=>null);let m=new Uint8Array(await c.arrayBuffer()),u=new DataView(m.buffer),h=u.getUint32(0,!0),v=u.getUint32(4,!0),T=u.getUint32(8,!0)===1,p=new Uint8ClampedArray(m.buffer,12,h*v*4);for(let d=0;d<p.length;d+=4){if(T){let R=p[d];p[d]=p[d+2],p[d+2]=R}p[d+3]=255}return createImageBitmap(new ImageData(p,h,v)).catch(()=>null)},tools:()=>s("POST","/verbs/tool",{action:"list"}).then(e=>e.tools??[]),blocks:()=>s("POST","/verbs/tool",{action:"blocks"}).then(e=>e.blocks??[]),saveTool:e=>s("POST","/verbs/tool",{action:"save",spec:e},[422]),deleteTool:e=>s("POST","/verbs/tool",{action:"delete",id:e},[422]),toolLayout:()=>s("POST","/verbs/tool",{action:"layout"}).then(e=>e.layout),arrangeTools:e=>s("POST","/verbs/tool",{action:"arrange",layout:e}).then(t=>t.layout),hideTool:(e,t)=>s("POST","/verbs/tool",{action:t?"hide":"show_tool",id:e}).then(n=>n.layout),workspace:e=>s("POST","/verbs/tool",{action:"workspace",project_id:e}).then(t=>t.workspace),saveWorkspace:(e,t)=>s("POST","/verbs/tool",{action:"workspace_save",project_id:e,workspace:t},[422]),exportTools:(e,t)=>s("POST","/verbs/tool",{action:"export",ids:e,path:t},[422]),importTools:e=>s("POST","/verbs/tool",{action:"import",path:e},[422]),hostSetup:(e,t="status")=>s("POST","/verbs/host_setup",{host:e,action:t},[422]),convert:async(e,t)=>{let n=new URLSearchParams({name:e.fileName,out:t,targets:JSON.stringify(e.targets.map(({target:r,ext:i})=>({target:r,ext:i}))),sequences:JSON.stringify(e.sequences)}),o=await fetch(`${g.base}/app/convert?${n}`,{method:"POST",headers:{...f(!1),"content-type":"application/octet-stream"},body:e.bytes});return await o.json().catch(()=>({ok:!1,error:`the engine said ${o.status}`}))},canonicalize:async(e,t=[],n=[])=>{let o=new URLSearchParams({name:e.name,sequences:JSON.stringify(t),previous:JSON.stringify(n)}),r=await fetch(`${g.base}/app/canonicalize?${o}`,{method:"POST",headers:{...f(!1),"content-type":"application/octet-stream"},body:await e.arrayBuffer()}),i=await r.json().catch(()=>({ok:!1,error:`the engine said ${r.status}`}));if(!i.ok)throw new Error(i.error??i.message??`the engine said ${r.status}`);return i},policy:()=>s("GET","/app/policy"),session:e=>s("GET",`/app/sessions/${e}`),onEvent:e=>(w.add(e),P(),()=>{w.delete(e),w.size||(k?.abort(),k=null)}),saveRunCsv:(e,t,n,o)=>s("POST","/verbs/tool_run",{action:"csv",project_id:e,path:t,id:n,table:o}),runs:(e,t)=>s("POST","/verbs/tool_run",{action:"list",project_id:e,...t?{id:t}:{}}).then(n=>n.runs??[])};async function j(e,t){let n=await fetch(`${g.base}/app/fs`,{method:"POST",headers:f(),body:JSON.stringify({op:e,...t})});if(e==="readFile"){if(!n.ok)throw Object.assign(new Error(`could not read ${String(t.path)}`),{name:"NotReadableError"});let r=await n.arrayBuffer();return{result:{byteLength:r.byteLength},bytes:r}}let o=await n.json().catch(()=>({ok:!1}));if(!o.ok)throw Object.assign(new Error(o.message??`the engine said ${n.status}`),{name:"NotFoundError"});return{result:o.result}}var a=()=>typeof window<"u"?window.__TAURI__:void 0,$={available:()=>!!a()?.core?.invoke,licenseStatus:()=>a().core.invoke("license_status"),fingerprint:()=>a().core.invoke("machine_fingerprint"),version:()=>a().app.getVersion(),installUpdate:()=>a().core.invoke("install_update"),importLicense:async()=>{let e=await a().dialog.open({multiple:!1,filters:[{name:"conform.tools licence",extensions:["lic","json"]}]});return typeof e=="string"?a().core.invoke("import_license",{path:e}):null},pickFolder:async()=>{let e=await a().dialog.open({directory:!0,multiple:!1});return typeof e=="string"?e:null},pickFiles:async()=>{let e=await a().dialog.open({directory:!1,multiple:!0});return Array.isArray(e)?e:typeof e=="string"?[e]:[]},pickFile:async()=>{let e=await a().dialog.open({directory:!1,multiple:!1});return typeof e=="string"?e:null},saveFile:async e=>{try{let t=e.split(".").pop()??"json",n=await a().dialog.save({defaultPath:e,filters:[{name:t==="csv"?"Table":"Recipe",extensions:[t]}]});return typeof n=="string"?n:null}catch{let t=await a().dialog.open({directory:!0,multiple:!1});return typeof t=="string"?`${t.replace(/[\\/]$/,"")}/${e}`:null}}};export{y as EngineError,x as engine,j as engineFs,$ as shell};
@@ -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,b,c}from"./chunk-WN53ARHJ.js";import"./chunk-DKGGJM6Z.js";import"./chunk-RJ6JA2LZ.js";import"./chunk-PSANHDZM.js";export{c as decodeExrPreviewWasm,b as decodeExrWasm,a as inspectExrWasm};
3
+ import{a,b,c}from"./chunk-JKOB3U54.js";import"./chunk-DKGGJM6Z.js";import"./chunk-DPA26AOI.js";import"./chunk-PSANHDZM.js";export{c as decodeExrPreviewWasm,b as decodeExrWasm,a as inspectExrWasm};
@@ -16,11 +16,11 @@ Conventions (docs/INTERNAL_HOST_BRIDGE.md "Flame" has the evidence for each):
16
16
  (`record_in + record_duration`). Timeline markers are relative to the
17
17
  sequence start (Resolve's convention); segment markers are in clip frames:
18
18
  `left_offset + (record location - item_start)`.
19
- * **Dynamic attributes** (`name`, `comment`, `colour`, `current_time`, every
19
+ * **Dynamic attributes** (`name`, `comment`, `color`, `current_time`, every
20
20
  marker field) come back as PyAttribute; `_v()` unwraps them.
21
21
  * **Tracks**: video track N is the N-th track walking `versions[*].tracks[*]`;
22
22
  audio track N is `audio_tracks[N-1]` (its first channel's segments).
23
- * **Colours**: marker RGB <-> the neutral names by nearest match
23
+ * **Colors**: marker RGB <-> the neutral names by nearest match
24
24
  (`ctpeer.neutral`). **Custom data** rides in the comment as `[ct:<custom>]`.
25
25
  """
26
26
 
@@ -634,7 +634,7 @@ class FlamePeer(BuildVerbs, RenderVerbs, FrameVerbs):
634
634
  `session.name`, `clip_meta.clip_property` / `clip_info`, never listed
635
635
  in a bin and never written. Nothing is created (`PySegment.match`
636
636
  would make a clip; this never calls it). None for a segment with no
637
- media at all (a colour source, a gap filler)."""
637
+ media at all (a color source, a gap filler)."""
638
638
  seg, seq = self._seg(item)
639
639
  if not (_s(getattr(seg, "file_path", "")) or _s(getattr(seg, "source_name", "")) or _s(getattr(seg, "tape_name", ""))):
640
640
  return None
@@ -976,8 +976,8 @@ class FlamePeer(BuildVerbs, RenderVerbs, FrameVerbs):
976
976
  return ok
977
977
 
978
978
  # ── item_meta ───────────────────────────────────────────────────────
979
- # A SEGMENT's colour (or a Media Panel clip's): RGB in Flame, Resolve's
980
- # clip-colour names on the wire (nearest match, so a name written reads
979
+ # A SEGMENT's color (or a Media Panel clip's): RGB in Flame, Resolve's
980
+ # clip-color names on the wire (nearest match, so a name written reads
981
981
  # back as itself). Flame has no clip flags: the flag verbs say so with
982
982
  # the `unsupported` code, which tools read as "this host has none".
983
983
  def _colour_target(self, handle: Any) -> Any:
@@ -986,7 +986,7 @@ class FlamePeer(BuildVerbs, RenderVerbs, FrameVerbs):
986
986
  return self._seg(handle)[0]
987
987
  if kind in ("clip", "seq"):
988
988
  return self.handles.get(handle, "clip", "seq")
989
- raise PeerError("bad_handle", f"a colour lives on a segment or a Media Panel clip, not a {kind or 'non-handle'}")
989
+ raise PeerError("bad_handle", f"a color lives on a segment or a Media Panel clip, not a {kind or 'non-handle'}")
990
990
 
991
991
  def v_item_meta__color(self, handle: Any) -> str:
992
992
  if self.handles.kind_of(handle) == "src":
@@ -1004,7 +1004,7 @@ class FlamePeer(BuildVerbs, RenderVerbs, FrameVerbs):
1004
1004
  try:
1005
1005
  obj.colour = tuple(rgb)
1006
1006
  except Exception as e:
1007
- raise PeerError("read_only", f"Flame refused the colour: {e}")
1007
+ raise PeerError("read_only", f"Flame refused the color: {e}")
1008
1008
  got = _v(getattr(obj, "colour", None))
1009
1009
  return got not in (None, "") and N.nearest_clip_color(got) == N.nearest_clip_color(rgb)
1010
1010
 
@@ -1022,10 +1022,10 @@ class FlamePeer(BuildVerbs, RenderVerbs, FrameVerbs):
1022
1022
  return [] # Flame keeps no clip flags
1023
1023
 
1024
1024
  def v_item_meta__add_flag(self, handle: Any, color: str) -> bool:
1025
- raise PeerError("unsupported", "Flame has no clip flags (a segment carries a colour instead)")
1025
+ raise PeerError("unsupported", "Flame has no clip flags (a segment carries a color instead)")
1026
1026
 
1027
1027
  def v_item_meta__clear_flags(self, handle: Any, color: Optional[str] = None) -> bool:
1028
- raise PeerError("unsupported", "Flame has no clip flags (a segment carries a colour instead)")
1028
+ raise PeerError("unsupported", "Flame has no clip flags (a segment carries a color instead)")
1029
1029
 
1030
1030
  def v_item_meta__set_enabled(self, item: Any, enabled: bool) -> bool:
1031
1031
  """Show / hide a segment (`hidden`, a dynamic attribute)."""
@@ -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{f as a,g as b,h as c,i as d,j as e,k as f,l as g,m as h,n as i,o as j,p as k,q as l,r as m,s as n}from"./chunk-Y2QHZUGL.js";import"./chunk-DFDXSIMI.js";import"./chunk-NQNS4Y2B.js";import"./chunk-7QUSVHO2.js";import"./chunk-PFZVET7S.js";import"./chunk-YUO3UWPH.js";import"./chunk-JV7TZDKJ.js";import"./chunk-6V4OEOOX.js";import"./chunk-RGMTLNMF.js";import"./chunk-ISKNIQVO.js";import"./chunk-JKOB3U54.js";import"./chunk-EEDLRRKU.js";import"./chunk-DKGGJM6Z.js";import"./chunk-WJ5EWXP2.js";import"./chunk-C2ESM27Z.js";import"./chunk-XDI6CPPV.js";import"./chunk-DGXZB7MO.js";import"./chunk-JXTRQ3UG.js";import"./chunk-NU3X7P4N.js";import"./chunk-DPA26AOI.js";import"./chunk-XJNWAQON.js";import"./chunk-CJYLQ3UM.js";import"./chunk-PHAMF4JF.js";import"./chunk-DNS4ZYIO.js";import"./chunk-PSANHDZM.js";export{j as ASPECTS,a as INPUT_SCALING,f as SIZING_TARGETS,i as alignText,h as alignTimeline,k as aspectOf,l as blankingForAspect,m as blankingQc,n as blankingText,c as inputFitRatio,g as offlineLane,d as resolveProps,b as scalingOf,e as underRef};
@@ -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{e as h,f as d,n as w,p as _}from"./chunk-GK4YYKJ6.js";import"./chunk-NU3X7P4N.js";import{Ha as u,T as l,V as g}from"./chunk-RJ6JA2LZ.js";import"./chunk-PHAMF4JF.js";import{u as y}from"./chunk-PLRB2YXJ.js";import"./chunk-PSANHDZM.js";import{parentPort as p,workerData as C}from"node:worker_threads";import{createCanvas as M,loadImage as A}from"@napi-rs/canvas";var S=(async()=>{await w(C),await u()})(),o=new Map,c=new Map;p.on("message",async t=>{try{await S;let s={};for(let[e,a]of Object.entries(t.images))c.has(a)||c.set(a,await A(await y(a))),s[e]=c.get(a);let m=`${t.fmt.w}x${t.fmt.h}`;o.has(m)||o.set(m,M(t.fmt.w,t.fmt.h));let i=o.get(m).getContext("2d"),v=h(i),r=[],f=null;for(let e=t.from;e<t.to;e++){d(i,t.scene,e/t.fps,t.fmt,v,s);let a=i.getImageData(0,0,t.fmt.w,t.fmt.h).data,n=new Uint8Array(a.buffer,a.byteOffset,a.byteLength);if(f&&_(f,n)){r.push(null);continue}r.push(t.alpha?l(n,t.fmt.w,t.fmt.h,4):g(n,t.fmt.w,t.fmt.h,4)),f=n.slice()}p.postMessage({id:t.id,samples:r},r.filter(e=>!!e).map(e=>e.buffer))}catch(s){p.postMessage({id:t.id,error:s.message??String(s)})}});
3
+ import{e as h,f as d,n as w,p as _}from"./chunk-YC7QDS5U.js";import"./chunk-NU3X7P4N.js";import{Ia as u,U as l,W as g}from"./chunk-DPA26AOI.js";import"./chunk-PHAMF4JF.js";import{u as y}from"./chunk-DNS4ZYIO.js";import"./chunk-PSANHDZM.js";import{parentPort as p,workerData as C}from"node:worker_threads";import{createCanvas as M,loadImage as A}from"@napi-rs/canvas";var S=(async()=>{await w(C),await u()})(),o=new Map,c=new Map;p.on("message",async t=>{try{await S;let s={};for(let[e,a]of Object.entries(t.images))c.has(a)||c.set(a,await A(await y(a))),s[e]=c.get(a);let m=`${t.fmt.w}x${t.fmt.h}`;o.has(m)||o.set(m,M(t.fmt.w,t.fmt.h));let i=o.get(m).getContext("2d"),v=h(i),r=[],f=null;for(let e=t.from;e<t.to;e++){d(i,t.scene,e/t.fps,t.fmt,v,s);let a=i.getImageData(0,0,t.fmt.w,t.fmt.h).data,n=new Uint8Array(a.buffer,a.byteOffset,a.byteLength);if(f&&_(f,n)){r.push(null);continue}r.push(t.alpha?l(n,t.fmt.w,t.fmt.h,4):g(n,t.fmt.w,t.fmt.h,4)),f=n.slice()}p.postMessage({id:t.id,samples:r},r.filter(e=>!!e).map(e=>e.buffer))}catch(s){p.postMessage({id:t.id,error:s.message??String(s)})}});
@@ -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 O}from"./chunk-TK55FA56.js";import"./chunk-PSANHDZM.js";function v(e,n,t,f){let s=new DataView(e.buffer,e.byteOffset,e.byteLength),r=n;for(;r+8<=t;){let o=s.getUint32(r),a=String.fromCharCode(e[r+4],e[r+5],e[r+6],e[r+7]),c=8;if(o===1){let l=s.getUint32(r+8),g=s.getUint32(r+12);o=l*2**32+g,c=16}else o===0&&(o=t-r);if(o<c||r+o>t)break;f(a,r+c,r+o),r+=o}}var E=new Set(["moov","trak","mdia","minf","stbl"]);function D(e){let n=new DataView(e.buffer,e.byteOffset,e.byteLength),t=null,f=(r,o)=>{let a={},c=!1,l=(g,y)=>{v(e,g,y,(w,i,p)=>{if(E.has(w)){l(i,p);return}if(!(!c&&w!=="hdlr"&&w!=="stsd"))switch(w){case"hdlr":{String.fromCharCode(e[i+8],e[i+9],e[i+10],e[i+11])==="vide"&&(c=!0);break}case"stsd":{let u=i+8;a.codec=String.fromCharCode(e[u+4],e[u+5],e[u+6],e[u+7]),a.width=n.getUint16(u+32),a.height=n.getUint16(u+34);break}case"stsz":{let u=n.getUint32(i+4),d=n.getUint32(i+8),m=[];if(u===0)for(let h=0;h<d;h++)m.push(n.getUint32(i+12+h*4));else for(let h=0;h<d;h++)m.push(u);a.sampleSizes=m;break}case"stco":{let u=n.getUint32(i+4),d=[];for(let m=0;m<u;m++)d.push(n.getUint32(i+8+m*4));a.chunkOffsets=d;break}case"co64":{let u=n.getUint32(i+4),d=[];for(let m=0;m<u;m++){let h=n.getUint32(i+8+m*8),k=n.getUint32(i+12+m*8);d.push(h*2**32+k)}a.chunkOffsets=d;break}case"stsc":{let u=n.getUint32(i+4),d=[];for(let m=0;m<u;m++)d.push({firstChunk:n.getUint32(i+8+m*12),samplesPerChunk:n.getUint32(i+8+m*12+4),descIdx:n.getUint32(i+8+m*12+8)});a.sampleToChunk=d;break}}})};l(r,o),c&&a.chunkOffsets&&a.sampleSizes&&a.sampleToChunk&&(t=a)};if(((r,o)=>{v(e,r,o,(a,c,l)=>{a==="moov"&&v(e,c,l,(g,y,w)=>{g==="trak"&&f(y,w)})})})(0,e.length),!t)throw new Error("could not find a video sample table");return t}function V(e){let n=[],t=0;for(let f=0;f<e.chunkOffsets.length;f++){let s=1;for(let o=0;o<e.sampleToChunk.length;o++)f+1>=e.sampleToChunk[o].firstChunk&&(s=e.sampleToChunk[o].samplesPerChunk);let r=e.chunkOffsets[f];for(let o=0;o<s&&t<e.sampleSizes.length;o++){let a=e.sampleSizes[t];n.push({offset:r,size:a}),r+=a,t++}}return n}var P=(e,n)=>String.fromCharCode(e[n],e[n+1],e[n+2],e[n+3]),z=e=>e.toString(16).padStart(2,"0");function S(e,n,t,f){let s=new DataView(e.buffer,e.byteOffset,e.byteLength),r=n;for(;r+8<=t;){let o=s.getUint32(r),a=8;if(o===1?(o=Number(s.getBigUint64(r+8)),a=16):o===0&&(o=t-r),P(e,r+4)===f)return[r+a,r+o];if(o<a)break;r+=o}return null}function H(e,n,t,f){let s=[n,t];for(let r of f){if(!s)return null;s=S(e,s[0],s[1],r)}return s}function M(e,n,t){let f=S(e,n[0],n[1],"stts");if(!f)return new Int32Array(0);let s=t.getUint32(f[0]+4),r=[],o=0,a=f[0]+8;for(let i=0;i<s;i++){let p=t.getUint32(a),u=t.getInt32(a+4);for(let d=0;d<p;d++)r.push(o),o+=u;a+=8}let c=r.length,l=S(e,n[0],n[1],"ctts"),g=new Float64Array(c);for(let i=0;i<c;i++)g[i]=r[i];if(l){let i=t.getUint32(l[0]+4),p=l[0]+8,u=0;for(let d=0;d<i&&u<c;d++){let m=t.getUint32(p),h=t.getInt32(p+4);for(let k=0;k<m&&u<c;k++)g[u++]+=h;p+=8}}let y=Array.from({length:c},(i,p)=>p).sort((i,p)=>g[i]-g[p]||i-p),w=new Int32Array(c);for(let i=0;i<c;i++)w[y[i]]=i;return w}function F(e){let n=new DataView(e.buffer,e.byteOffset,e.byteLength),t=S(e,0,e.length,"moov"),[f,s]=t??[0,e.length],r=f;for(;r+8<=s;){let o=n.getUint32(r),a=8;if(o===1?(o=Number(n.getBigUint64(r+8)),a=16):o===0&&(o=s-r),P(e,r+4)==="trak"){let c=H(e,r+a,r+o,["mdia","minf","stbl"]);if(c){let l=S(e,c[0],c[1],"stsd");if(l){let g=l[0]+8,y=P(e,g+4);if(y==="avc1"||y==="avc3"||y==="hvc1"||y==="hev1"){let w=n.getUint32(g),i=g+8+78,p=y.startsWith("hv")||y.startsWith("he"),u=S(e,i,g+w,p?"hvcC":"avcC");if(!u)return null;let d=e.subarray(u[0],u[1]),m=p?"hvc1.1.6.L93.B0":`avc1.${z(d[1])}${z(d[2])}${z(d[3])}`,h=M(e,c,n),k=h.length,U=S(e,c[0],c[1],"stss"),b=[];if(U){let T=n.getUint32(U[0]+4);for(let C=0;C<T;C++)b.push(n.getUint32(U[0]+8+C*4)-1)}else for(let T=0;T<k;T++)b.push(T);return(b.length===0||b[0]!==0)&&b.unshift(0),b.sort((T,C)=>T-C),{codec:m,description:d,keyframes:b,decodeToPres:h}}}}}if(o<a)break;r+=o}return null}var x=8,R=1500,I=new WeakMap;async function $(e){let n=I.get(e);return n||(n=L(e),I.set(e,n)),n}async function L(e){if(typeof VideoDecoder>"u")throw new Error("h264: WebCodecs (VideoDecoder) not available in this context");let n=e.parts[0],t=await O({fileSize:n.fileSize,read:n.read}),f=V(D(t)),s=F(t);if(!s)throw new Error("h264: no H.264/HEVC config in container");let r=s.decodeToPres.length||f.length,o=new Int32Array(r);for(let l=0;l<s.decodeToPres.length;l++)o[s.decodeToPres[l]]=l;let a=[];for(let l=0;l<s.keyframes.length;l++){let g=s.keyframes[l],y=l+1<s.keyframes.length?s.keyframes[l+1]:f.length;a.push([g,y])}let c={offs:f,cfg:s,gops:a,presToDecode:o,count:r,dec:null,wanted:-1,got:null,gotResolve:null,fedThrough:-1,queue:Promise.resolve()};return c.dec=new VideoDecoder({output:l=>{Number(l.timestamp)===c.wanted&&!c.got?(c.got=l,c.gotResolve?.()):l.close()},error:()=>{c.fedThrough=-1}}),c.dec.configure({codec:s.codec,description:s.description,optimizeForLatency:!0,hardwareAcceleration:"prefer-hardware"}),c}function q(e,n){let t=0,f=e.length-1,s=0;for(;t<=f;){let r=t+f>>1;e[r][0]<=n?(s=r,t=r+1):f=r-1}return s}async function B(e){let n=e.codedWidth,t=e.codedHeight;try{let f=n*t*4,s=new Uint8Array(f);return await e.copyTo(s,{format:"RGBA",colorSpace:"srgb"}),{width:n,height:t,rgba:s}}catch{let s=new OffscreenCanvas(n,t).getContext("2d",{willReadFrequently:!0});if(!s)throw new Error("h264: no 2d context for frame readback");s.drawImage(e,0,0);let r=s.getImageData(0,0,n,t);return{width:n,height:t,rgba:new Uint8Array(r.data.buffer)}}}async function N(e,n){let t=await $(e);if(t.count===0)throw new Error("h264: empty clip");if(n<0||n>=t.count)throw new Error(`COVERAGE_MISS: frame ${n} outside 0..${t.count-1}`);let f,s=new Promise(o=>{f=o}),r=t.queue;t.queue=t.queue.then(()=>s),await r;try{let o=e.parts[0],a=t.presToDecode[n],c=q(t.gops,a),[l,g]=t.gops[c];for(let y=0;y<2;y++){let w=y===0&&t.fedThrough>l&&t.fedThrough<=g&&a>=t.fedThrough,i=w?t.fedThrough:l;if(!w&&t.fedThrough!==-1){try{await t.dec.flush()}catch{}t.fedThrough=-1}let p=Math.min(g,a+1+x);t.wanted=n,t.got=null;let u=new Promise(h=>{t.gotResolve=h});if(p>i){let h=1/0,k=0;for(let b=i;b<p;b++)h=Math.min(h,t.offs[b].offset),k=Math.max(k,t.offs[b].offset+t.offs[b].size);let U=await o.read(h,k-h);for(let b=i;b<p;b++){let T=t.offs[b];t.dec.decode(new EncodedVideoChunk({type:b===l?"key":"delta",timestamp:t.cfg.decodeToPres[b],data:U.subarray(T.offset-h,T.offset-h+T.size)}))}t.fedThrough=p}let d=new Promise(h=>setTimeout(h,R));if(await Promise.race([u,d]),!t.got){try{await t.dec.flush()}catch{}t.fedThrough=-1}let m=t.got;if(t.wanted=-1,t.gotResolve=null,t.got=null,!!m)try{return await B(m)}finally{m.close()}}throw new Error(`h264: frame ${n} did not decode`)}finally{f()}}async function A(){return(await import("./isobmff-VJOWP4MH.js")).isobmffFormat}var J={async inspect(e){return(await A()).inspect(e)},async extract(e){return(await A()).extract(e)},async sparsify(e,n){return(await A()).sparsify(e,n)},async trim(e,n){return(await A()).trim(e,n)},async decode(e,n){return N(e,n)}};export{J as h264Format};
3
+ import{a as O}from"./chunk-TK55FA56.js";import"./chunk-PSANHDZM.js";function v(e,n,t,f){let s=new DataView(e.buffer,e.byteOffset,e.byteLength),r=n;for(;r+8<=t;){let o=s.getUint32(r),a=String.fromCharCode(e[r+4],e[r+5],e[r+6],e[r+7]),c=8;if(o===1){let l=s.getUint32(r+8),g=s.getUint32(r+12);o=l*2**32+g,c=16}else o===0&&(o=t-r);if(o<c||r+o>t)break;f(a,r+c,r+o),r+=o}}var E=new Set(["moov","trak","mdia","minf","stbl"]);function D(e){let n=new DataView(e.buffer,e.byteOffset,e.byteLength),t=null,f=(r,o)=>{let a={},c=!1,l=(g,y)=>{v(e,g,y,(w,i,p)=>{if(E.has(w)){l(i,p);return}if(!(!c&&w!=="hdlr"&&w!=="stsd"))switch(w){case"hdlr":{String.fromCharCode(e[i+8],e[i+9],e[i+10],e[i+11])==="vide"&&(c=!0);break}case"stsd":{let u=i+8;a.codec=String.fromCharCode(e[u+4],e[u+5],e[u+6],e[u+7]),a.width=n.getUint16(u+32),a.height=n.getUint16(u+34);break}case"stsz":{let u=n.getUint32(i+4),d=n.getUint32(i+8),m=[];if(u===0)for(let h=0;h<d;h++)m.push(n.getUint32(i+12+h*4));else for(let h=0;h<d;h++)m.push(u);a.sampleSizes=m;break}case"stco":{let u=n.getUint32(i+4),d=[];for(let m=0;m<u;m++)d.push(n.getUint32(i+8+m*4));a.chunkOffsets=d;break}case"co64":{let u=n.getUint32(i+4),d=[];for(let m=0;m<u;m++){let h=n.getUint32(i+8+m*8),k=n.getUint32(i+12+m*8);d.push(h*2**32+k)}a.chunkOffsets=d;break}case"stsc":{let u=n.getUint32(i+4),d=[];for(let m=0;m<u;m++)d.push({firstChunk:n.getUint32(i+8+m*12),samplesPerChunk:n.getUint32(i+8+m*12+4),descIdx:n.getUint32(i+8+m*12+8)});a.sampleToChunk=d;break}}})};l(r,o),c&&a.chunkOffsets&&a.sampleSizes&&a.sampleToChunk&&(t=a)};if(((r,o)=>{v(e,r,o,(a,c,l)=>{a==="moov"&&v(e,c,l,(g,y,w)=>{g==="trak"&&f(y,w)})})})(0,e.length),!t)throw new Error("could not find a video sample table");return t}function V(e){let n=[],t=0;for(let f=0;f<e.chunkOffsets.length;f++){let s=1;for(let o=0;o<e.sampleToChunk.length;o++)f+1>=e.sampleToChunk[o].firstChunk&&(s=e.sampleToChunk[o].samplesPerChunk);let r=e.chunkOffsets[f];for(let o=0;o<s&&t<e.sampleSizes.length;o++){let a=e.sampleSizes[t];n.push({offset:r,size:a}),r+=a,t++}}return n}var P=(e,n)=>String.fromCharCode(e[n],e[n+1],e[n+2],e[n+3]),z=e=>e.toString(16).padStart(2,"0");function S(e,n,t,f){let s=new DataView(e.buffer,e.byteOffset,e.byteLength),r=n;for(;r+8<=t;){let o=s.getUint32(r),a=8;if(o===1?(o=Number(s.getBigUint64(r+8)),a=16):o===0&&(o=t-r),P(e,r+4)===f)return[r+a,r+o];if(o<a)break;r+=o}return null}function H(e,n,t,f){let s=[n,t];for(let r of f){if(!s)return null;s=S(e,s[0],s[1],r)}return s}function M(e,n,t){let f=S(e,n[0],n[1],"stts");if(!f)return new Int32Array(0);let s=t.getUint32(f[0]+4),r=[],o=0,a=f[0]+8;for(let i=0;i<s;i++){let p=t.getUint32(a),u=t.getInt32(a+4);for(let d=0;d<p;d++)r.push(o),o+=u;a+=8}let c=r.length,l=S(e,n[0],n[1],"ctts"),g=new Float64Array(c);for(let i=0;i<c;i++)g[i]=r[i];if(l){let i=t.getUint32(l[0]+4),p=l[0]+8,u=0;for(let d=0;d<i&&u<c;d++){let m=t.getUint32(p),h=t.getInt32(p+4);for(let k=0;k<m&&u<c;k++)g[u++]+=h;p+=8}}let y=Array.from({length:c},(i,p)=>p).sort((i,p)=>g[i]-g[p]||i-p),w=new Int32Array(c);for(let i=0;i<c;i++)w[y[i]]=i;return w}function F(e){let n=new DataView(e.buffer,e.byteOffset,e.byteLength),t=S(e,0,e.length,"moov"),[f,s]=t??[0,e.length],r=f;for(;r+8<=s;){let o=n.getUint32(r),a=8;if(o===1?(o=Number(n.getBigUint64(r+8)),a=16):o===0&&(o=s-r),P(e,r+4)==="trak"){let c=H(e,r+a,r+o,["mdia","minf","stbl"]);if(c){let l=S(e,c[0],c[1],"stsd");if(l){let g=l[0]+8,y=P(e,g+4);if(y==="avc1"||y==="avc3"||y==="hvc1"||y==="hev1"){let w=n.getUint32(g),i=g+8+78,p=y.startsWith("hv")||y.startsWith("he"),u=S(e,i,g+w,p?"hvcC":"avcC");if(!u)return null;let d=e.subarray(u[0],u[1]),m=p?"hvc1.1.6.L93.B0":`avc1.${z(d[1])}${z(d[2])}${z(d[3])}`,h=M(e,c,n),k=h.length,U=S(e,c[0],c[1],"stss"),b=[];if(U){let T=n.getUint32(U[0]+4);for(let C=0;C<T;C++)b.push(n.getUint32(U[0]+8+C*4)-1)}else for(let T=0;T<k;T++)b.push(T);return(b.length===0||b[0]!==0)&&b.unshift(0),b.sort((T,C)=>T-C),{codec:m,description:d,keyframes:b,decodeToPres:h}}}}}if(o<a)break;r+=o}return null}var x=8,R=1500,I=new WeakMap;async function $(e){let n=I.get(e);return n||(n=L(e),I.set(e,n)),n}async function L(e){if(typeof VideoDecoder>"u")throw new Error("h264: WebCodecs (VideoDecoder) not available in this context");let n=e.parts[0],t=await O({fileSize:n.fileSize,read:n.read}),f=V(D(t)),s=F(t);if(!s)throw new Error("h264: no H.264/HEVC config in container");let r=s.decodeToPres.length||f.length,o=new Int32Array(r);for(let l=0;l<s.decodeToPres.length;l++)o[s.decodeToPres[l]]=l;let a=[];for(let l=0;l<s.keyframes.length;l++){let g=s.keyframes[l],y=l+1<s.keyframes.length?s.keyframes[l+1]:f.length;a.push([g,y])}let c={offs:f,cfg:s,gops:a,presToDecode:o,count:r,dec:null,wanted:-1,got:null,gotResolve:null,fedThrough:-1,queue:Promise.resolve()};return c.dec=new VideoDecoder({output:l=>{Number(l.timestamp)===c.wanted&&!c.got?(c.got=l,c.gotResolve?.()):l.close()},error:()=>{c.fedThrough=-1}}),c.dec.configure({codec:s.codec,description:s.description,optimizeForLatency:!0,hardwareAcceleration:"prefer-hardware"}),c}function q(e,n){let t=0,f=e.length-1,s=0;for(;t<=f;){let r=t+f>>1;e[r][0]<=n?(s=r,t=r+1):f=r-1}return s}async function B(e){let n=e.codedWidth,t=e.codedHeight;try{let f=n*t*4,s=new Uint8Array(f);return await e.copyTo(s,{format:"RGBA",colorSpace:"srgb"}),{width:n,height:t,rgba:s}}catch{let s=new OffscreenCanvas(n,t).getContext("2d",{willReadFrequently:!0});if(!s)throw new Error("h264: no 2d context for frame readback");s.drawImage(e,0,0);let r=s.getImageData(0,0,n,t);return{width:n,height:t,rgba:new Uint8Array(r.data.buffer)}}}async function N(e,n){let t=await $(e);if(t.count===0)throw new Error("h264: empty clip");if(n<0||n>=t.count)throw new Error(`COVERAGE_MISS: frame ${n} outside 0..${t.count-1}`);let f,s=new Promise(o=>{f=o}),r=t.queue;t.queue=t.queue.then(()=>s),await r;try{let o=e.parts[0],a=t.presToDecode[n],c=q(t.gops,a),[l,g]=t.gops[c];for(let y=0;y<2;y++){let w=y===0&&t.fedThrough>l&&t.fedThrough<=g&&a>=t.fedThrough,i=w?t.fedThrough:l;if(!w&&t.fedThrough!==-1){try{await t.dec.flush()}catch{}t.fedThrough=-1}let p=Math.min(g,a+1+x);t.wanted=n,t.got=null;let u=new Promise(h=>{t.gotResolve=h});if(p>i){let h=1/0,k=0;for(let b=i;b<p;b++)h=Math.min(h,t.offs[b].offset),k=Math.max(k,t.offs[b].offset+t.offs[b].size);let U=await o.read(h,k-h);for(let b=i;b<p;b++){let T=t.offs[b];t.dec.decode(new EncodedVideoChunk({type:b===l?"key":"delta",timestamp:t.cfg.decodeToPres[b],data:U.subarray(T.offset-h,T.offset-h+T.size)}))}t.fedThrough=p}let d=new Promise(h=>setTimeout(h,R));if(await Promise.race([u,d]),!t.got){try{await t.dec.flush()}catch{}t.fedThrough=-1}let m=t.got;if(t.wanted=-1,t.gotResolve=null,t.got=null,!!m)try{return await B(m)}finally{m.close()}}throw new Error(`h264: frame ${n} did not decode`)}finally{f()}}async function A(){return(await import("./isobmff-C5A2EFKH.js")).isobmffFormat}var J={async inspect(e){return(await A()).inspect(e)},async extract(e){return(await A()).extract(e)},async sparsify(e,n){return(await A()).sparsify(e,n)},async trim(e,n){return(await A()).trim(e,n)},async decode(e,n){return N(e,n)}};export{J as h264Format};
@@ -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{Ha as v,ma as g,oa as b}from"./chunk-RJ6JA2LZ.js";import"./chunk-PSANHDZM.js";var G=8,P=1500,M=new WeakMap,S=o=>(t,e)=>o.read(t,e);function F(o){let t=new DataView(o.buffer,o.byteOffset,o.byteLength),e=t.getUint32(0,!0),n=[];for(let a=0;a<e;a++)n.push(t.getUint32(4+a*4,!0));let i=[],r=4+e*4;for(let a of n)i.push(o.subarray(r,r+a)),r+=a;return i}function V(o){for(let t=0;t+5<o.length;t++){let e=o[t]===0&&o[t+1]===0&&o[t+2]===0&&o[t+3]===1,n=o[t]===0&&o[t+1]===0&&o[t+2]===1;if(e||n){let i=t+(e?4:3);if((o[i]&31)===7){let r=a=>a.toString(16).padStart(2,"0");return`avc1.${r(o[i+1])}${r(o[i+2])}${r(o[i+3])}`}t=i-1}}return"avc1.640028"}async function A(o){if(typeof VideoDecoder>"u")throw new Error("h264-mxf: WebCodecs (VideoDecoder) not available in this context");await v();let t=o.parts[0],e=S(t),n=JSON.parse(await b(e,t.fileSize));if(!n.raps.length)throw new Error("h264-mxf: no random-access points in MXF index");let i=V(F(await g(e,t.fileSize,0,0))[0]),r={map:n,codec:i,dec:null,wanted:-1,emitted:0,got:null,gotResolve:null,fedGop:-1,fedThrough:-1,queue:Promise.resolve()};return r.dec=new VideoDecoder({output:a=>{r.emitted++===r.wanted&&!r.got?(r.got=a,r.gotResolve?.()):a.close()},error:()=>{r.fedGop=-1,r.fedThrough=-1}}),r.dec.configure({codec:i,codedWidth:n.coded_width||1920,codedHeight:n.coded_height||1088,optimizeForLatency:!0}),r}async function E(o){let t=M.get(o);return t||(t=A(o),M.set(o,t)),t}function D(o,t){let e=o.raps,n=0,i=e.length-1,r=0;for(;n<=i;){let a=n+i>>1;e[a]<=t?(r=a,n=a+1):i=a-1}return{start:e[r],end:r+1<e.length?e[r+1]:o.total_frames}}async function R(o){let t=o.visibleRect,e=t?t.width:o.codedWidth,n=t?t.height:o.codedHeight;try{let i=new Uint8Array(e*n*4);return await o.copyTo(i,{format:"RGBA",colorSpace:"srgb",rect:t??void 0}),{width:e,height:n,rgba:i}}catch{let r=new OffscreenCanvas(e,n).getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("h264-mxf: no 2d context for frame readback");r.drawImage(o,t?t.x:0,t?t.y:0,e,n,0,0,e,n);let a=r.getImageData(0,0,e,n);return{width:e,height:n,rgba:new Uint8Array(a.data.buffer)}}}async function U(o,t){let e=await E(o);if(e.map.total_frames===0)throw new Error("h264-mxf: empty clip");if(t<0||t>=e.map.total_frames)throw new Error(`COVERAGE_MISS: frame ${t} outside 0..${e.map.total_frames-1}`);let n,i=new Promise(a=>{n=a}),r=e.queue;e.queue=e.queue.then(()=>i),await r;try{let a=o.parts[0],w=S(a),{start:c,end:_}=D(e.map,t);for(let u=0;u<2;u++){let f=u===0&&e.fedGop===c&&e.fedThrough>c&&t>=e.fedThrough;if(!f&&e.fedGop!==-1){try{await e.dec.flush()}catch{}e.fedGop=-1,e.fedThrough=-1}let l=f?e.fedThrough:c,h=Math.min(_,t+1+G);f||(e.emitted=0),e.wanted=t-c,e.got=null;let T=new Promise(s=>{e.gotResolve=s});if(h>l){let s=F(await g(w,a.fileSize,l,h-1));for(let d=0;d<s.length;d++){let y=l+d;e.dec.decode(new EncodedVideoChunk({type:y===c?"key":"delta",timestamp:y*1e3,data:s[d]}))}e.fedGop=c,e.fedThrough=h}let x=new Promise(s=>setTimeout(s,P));if(await Promise.race([T,x]),!e.got){try{await e.dec.flush()}catch{}e.fedGop=-1,e.fedThrough=-1}let p=e.got;if(e.wanted=-1,e.gotResolve=null,e.got=null,!!p)try{return await R(p)}finally{p.close()}}throw new Error(`h264-mxf: frame ${t} did not decode`)}finally{n()}}async function m(){return(await import("./mxf-FJSRFLJC.js")).mxfFormat}var O={async inspect(o){return(await m()).inspect(o)},async extract(o){return(await m()).extract(o)},async sparsify(o,t){return(await m()).sparsify(o,t)},async trim(o,t){return(await m()).trim(o,t)},async decode(o,t){return U(o,t)}};export{O as h264MxfFormat};
3
+ import{Ia as v,na as g,pa as b}from"./chunk-DPA26AOI.js";import"./chunk-PSANHDZM.js";var G=8,P=1500,M=new WeakMap,S=o=>(t,e)=>o.read(t,e);function F(o){let t=new DataView(o.buffer,o.byteOffset,o.byteLength),e=t.getUint32(0,!0),n=[];for(let a=0;a<e;a++)n.push(t.getUint32(4+a*4,!0));let i=[],r=4+e*4;for(let a of n)i.push(o.subarray(r,r+a)),r+=a;return i}function V(o){for(let t=0;t+5<o.length;t++){let e=o[t]===0&&o[t+1]===0&&o[t+2]===0&&o[t+3]===1,n=o[t]===0&&o[t+1]===0&&o[t+2]===1;if(e||n){let i=t+(e?4:3);if((o[i]&31)===7){let r=a=>a.toString(16).padStart(2,"0");return`avc1.${r(o[i+1])}${r(o[i+2])}${r(o[i+3])}`}t=i-1}}return"avc1.640028"}async function A(o){if(typeof VideoDecoder>"u")throw new Error("h264-mxf: WebCodecs (VideoDecoder) not available in this context");await v();let t=o.parts[0],e=S(t),n=JSON.parse(await b(e,t.fileSize));if(!n.raps.length)throw new Error("h264-mxf: no random-access points in MXF index");let i=V(F(await g(e,t.fileSize,0,0))[0]),r={map:n,codec:i,dec:null,wanted:-1,emitted:0,got:null,gotResolve:null,fedGop:-1,fedThrough:-1,queue:Promise.resolve()};return r.dec=new VideoDecoder({output:a=>{r.emitted++===r.wanted&&!r.got?(r.got=a,r.gotResolve?.()):a.close()},error:()=>{r.fedGop=-1,r.fedThrough=-1}}),r.dec.configure({codec:i,codedWidth:n.coded_width||1920,codedHeight:n.coded_height||1088,optimizeForLatency:!0}),r}async function E(o){let t=M.get(o);return t||(t=A(o),M.set(o,t)),t}function D(o,t){let e=o.raps,n=0,i=e.length-1,r=0;for(;n<=i;){let a=n+i>>1;e[a]<=t?(r=a,n=a+1):i=a-1}return{start:e[r],end:r+1<e.length?e[r+1]:o.total_frames}}async function R(o){let t=o.visibleRect,e=t?t.width:o.codedWidth,n=t?t.height:o.codedHeight;try{let i=new Uint8Array(e*n*4);return await o.copyTo(i,{format:"RGBA",colorSpace:"srgb",rect:t??void 0}),{width:e,height:n,rgba:i}}catch{let r=new OffscreenCanvas(e,n).getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("h264-mxf: no 2d context for frame readback");r.drawImage(o,t?t.x:0,t?t.y:0,e,n,0,0,e,n);let a=r.getImageData(0,0,e,n);return{width:e,height:n,rgba:new Uint8Array(a.data.buffer)}}}async function U(o,t){let e=await E(o);if(e.map.total_frames===0)throw new Error("h264-mxf: empty clip");if(t<0||t>=e.map.total_frames)throw new Error(`COVERAGE_MISS: frame ${t} outside 0..${e.map.total_frames-1}`);let n,i=new Promise(a=>{n=a}),r=e.queue;e.queue=e.queue.then(()=>i),await r;try{let a=o.parts[0],w=S(a),{start:c,end:_}=D(e.map,t);for(let u=0;u<2;u++){let f=u===0&&e.fedGop===c&&e.fedThrough>c&&t>=e.fedThrough;if(!f&&e.fedGop!==-1){try{await e.dec.flush()}catch{}e.fedGop=-1,e.fedThrough=-1}let l=f?e.fedThrough:c,h=Math.min(_,t+1+G);f||(e.emitted=0),e.wanted=t-c,e.got=null;let T=new Promise(s=>{e.gotResolve=s});if(h>l){let s=F(await g(w,a.fileSize,l,h-1));for(let d=0;d<s.length;d++){let y=l+d;e.dec.decode(new EncodedVideoChunk({type:y===c?"key":"delta",timestamp:y*1e3,data:s[d]}))}e.fedGop=c,e.fedThrough=h}let x=new Promise(s=>setTimeout(s,P));if(await Promise.race([T,x]),!e.got){try{await e.dec.flush()}catch{}e.fedGop=-1,e.fedThrough=-1}let p=e.got;if(e.wanted=-1,e.gotResolve=null,e.got=null,!!p)try{return await R(p)}finally{p.close()}}throw new Error(`h264-mxf: frame ${t} did not decode`)}finally{n()}}async function m(){return(await import("./mxf-CQSI6H5T.js")).mxfFormat}var O={async inspect(o){return(await m()).inspect(o)},async extract(o){return(await m()).extract(o)},async sparsify(o,t){return(await m()).sparsify(o,t)},async trim(o,t){return(await m()).trim(o,t)},async decode(o,t){return U(o,t)}};export{O as h264MxfFormat};
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
+ import{a as T}from"./chunk-2MJAQROY.js";import{c as D}from"./chunk-ZVUKOFUX.js";import{M as A,P,W as N,Z as q}from"./chunk-DFDXSIMI.js";import"./chunk-NQNS4Y2B.js";import{k as M}from"./chunk-7QUSVHO2.js";import"./chunk-PFZVET7S.js";import"./chunk-JHTMYXJM.js";import"./chunk-YUO3UWPH.js";import"./chunk-JV7TZDKJ.js";import"./chunk-6V4OEOOX.js";import"./chunk-RGMTLNMF.js";import"./chunk-ISKNIQVO.js";import"./chunk-JKOB3U54.js";import"./chunk-EEDLRRKU.js";import"./chunk-DKGGJM6Z.js";import"./chunk-WJ5EWXP2.js";import"./chunk-C2ESM27Z.js";import"./chunk-XDI6CPPV.js";import"./chunk-DGXZB7MO.js";import"./chunk-JXTRQ3UG.js";import{b as F}from"./chunk-NU3X7P4N.js";import"./chunk-DPA26AOI.js";import"./chunk-XJNWAQON.js";import"./chunk-CJYLQ3UM.js";import"./chunk-PHAMF4JF.js";import{H as x,I as E,W as U,X as R,Z as k,m as O,q as S}from"./chunk-DNS4ZYIO.js";import"./chunk-PSANHDZM.js";var y=s=>{let i=s?.target_url??s?.local_path??"";return i.startsWith("file://")?O(i):i};async function H(s,i){let o=await V(s,i);return await I(s,o.session,i),o}async function I(s,i,o){let r=await s.liveMarkers(o).catch(()=>null);if(!r)return;let l=i.timelines,e=l.find(m=>m.kind!=="compound")??l[0];if(!e)return;let t=(m,f,a,p)=>({id:`live-${p??"tl"}-${m}`,time:{value:m},duration:{value:Math.max(1,f)},color:a.color,name:a.name,note:a.note,...p?{item_id:p}:{}}),n=r.timeline.map(m=>t(m.frame,m.duration,m)),c=e.tracks.filter(m=>m.kind==="Video");for(let m of r.clips){let f=c[m.track-1]?.items.find(a=>a.timeline_range?.start?.value===m.start);if(f)for(let a of m.markers)n.push(t(a.frame,a.duration,a,f.id))}e.markers=n}async function V(s,i){let o=await s.items({timeline:i,kind:"video"}),r=o.items.map(f=>`${f.kind}:${f.track}:${f.start}:${f.end-f.start}`),l=async f=>{let a=await D(f,o.timeline).catch(()=>null);if(!a||!r.every(d=>a.has(d)))return null;let{session:p}=await P(f,"prproj"),u=p.timelines.find(d=>d.name===o.timeline);return u?z(p,u):null};if(o.project_path){let f=await l(o.project_path);if(f)return await C(f),{session:f,from:"the saved project (matches the live sequence)",path:o.project_path};let a=k(R(o.project_path),"Adobe Premiere Pro Auto-Save"),p=U(o.project_path).replace(/\.prproj$/i,""),u=[];try{for await(let d of E(a))d.isFile&&d.name.startsWith(`${p}--`)&&d.name.endsWith(".prproj")&&u.push({path:k(a,d.name),mtime:(await S(k(a,d.name))).mtime?.getTime()??0})}catch{}for(let d of u.sort((g,_)=>_.mtime-g.mtime).slice(0,3)){let g=await l(d.path);if(g&&await C(g),g)return{session:g,from:`Premiere's auto-save of ${new Date(d.mtime).toLocaleTimeString()} (matches the live sequence; the project itself is not saved)`,path:d.path}}}let e=k(await x("conform-ppro-"),"live.otio"),t=await s.export({timeline:i,out_path:e}),{session:n}=await P(t.path,t.format);if(await W(s,n),await Z(n),typeof o.drop_frame=="boolean")for(let f of n.timelines)f.is_drop_frame=o.drop_frame;await C(n);for(let f of n.timelines)for(let a of f.tracks)for(let p of a.items){let u=p;u.scale=null,u.position_x=null,u.position_y=null,u.rotation=null}let c=await s.model(i).then(f=>f.items.filter(a=>Object.keys(a.sizing??{}).length).map(a=>`${a.name??a.file_path.split("/").pop()} (V${a.track} @${a.start-f.start_frame})`)).catch(()=>[]),m=`Premiere's OTIO export carries the cut, not the clips' Motion / Opacity / effects / retimes${c.length?` \u2014 ${c.length} clip(s) here have Motion that will not carry: ${c.slice(0,6).join(", ")}${c.length>6?"\u2026":""}`:""}; save the project (or wait for its auto-save) and run it again for every one of them`;return{session:n,from:"Premiere's OTIO export of the live sequence (no saved or auto-saved copy matches it yet)",path:t.path,lossy:m}}async function C(s){let i=new Set;for(let r of s.media_references??[]){if(r.binding_state==="linked")continue;let l=y(r);l&&await S(l).then(e=>e.isFile,()=>!1)&&i.add(R(l))}let o=s;for(let r of i){let l=await T(o,{media_root:r,gather:"path",criteria:{file_name:!0,file_name_mode:"tight"},lane:"both",reset:!1,dry_run:!1,compare:!1,cap:2e3,remember:!1}).catch(()=>null);l?.changed&&(o=l.session)}return o!==s&&Object.assign(s,o),(s.media_references??[]).filter(r=>r.binding_state==="linked").length}async function Z(s){let i=0;for(let o of s.media_references??[]){if(o.source_resolution_w)continue;let r=y(o),l=r?await M(r).catch(()=>null):null;if(!l)continue;let e=l;for(let t of["source_resolution_w","source_resolution_h","source_pixel_aspect","codec","container","streams"])e[t]!=null&&o[t]==null&&(o[t]=e[t]);o.source_fps??=e.source_fps??null,o.source_timecode??=e.source_timecode??null,!o.available_range&&e.available_range&&(o.available_range=e.available_range),i++}return i}async function re(s,i){let o=i.timelines.filter(t=>t.offline_reference?.clip_id);if(!o.length)return 0;let r=t=>[...t?.clip_list??[],...(t?.folders??[]).flatMap(r)],l=new Map(r((await s.project({clips:!0})).pool).map(t=>[t.id,t])),e=0;for(let t of o){let n=l.get(t.offline_reference.clip_id);if(n?.file){let c=i.media_references.find(m=>y(m)===n.file);c||(c={id:`offline-ref-${t.id??e}`,kind:"external",name:n.name,target_url:`file://${n.file}`,local_path:n.file},i.media_references.push(c)),t.offline_reference.media_reference_id=c.id,e++}else if(n&&n.name!==t.name&&(n.type==="Timeline"||/compound/i.test(n.type??""))){let{createSession:c}=await import("./store-SZKXADGI.js"),m=k(await x("conform-offline-ref-"),`${n.name.replace(/[^\w.-]+/g,"_")}.drt`),f=await s.export(n.type==="Timeline"?{timeline:n.name,out_path:m}:{clip_id:n.id,out_path:m}),{session:a}=await P(f.path,"drt");a=(await A(a))?.session??a,t.offline_reference.session_id=(await c(a,f.path,"drt")).id,e++}else t.offline_reference=null}return e}async function W(s,i){let o=(await s.projectClips()).clips,r=new Map(o.filter(e=>e.start_frame!=null&&e.fps).map(e=>[e.file,e])),l=0;for(let e of i.media_references??[]){if(e.source_timecode)continue;let t=r.get(y(e));if(t){e.source_timecode=F(t.start_frame,t.fps),e.source_fps??=t.fps,l++;continue}let n=y(e),c=n?await M(n).catch(()=>null):null;c?.source_timecode&&(e.source_timecode=c.source_timecode,e.source_fps??=c.source_fps??null,l++)}return l}function z(s,i){let o=new Map(s.timelines.map(l=>[l.id,l])),r=[i];for(let l=0;l<r.length;l++)for(let e of r[l].tracks)for(let t of e.items){let n=t.nested_timeline_id,c=n?o.get(n):void 0;c&&!r.includes(c)&&r.push(c)}return{...s,timelines:r}}function X(s,i){let o=new Map((s.media_references??[]).map(n=>[n.id,y(n)])),r=[];for(let n of i.media_references??[]){let c=o.get(n.id),m=y(n);c!==void 0&&m&&m!==c&&r.push({ref_id:n.id,old:c,new:m})}let l=new Map(r.map(n=>[n.ref_id,n])),e=[],t=i.timelines.find(n=>n.kind==="primary")??i.timelines[0];for(let n of t?.tracks??[])if(n.kind==="Video")for(let c of n.items){let m=c.media_reference_id?l.get(c.media_reference_id):void 0;!m||c.kind!=="clip"||!c.source_range||e.push({track:n.track_index,start:c.timeline_range.start.value,duration:c.timeline_range.duration.value,src_in:c.source_range.start.value,path:m.new,name:c.name??""})}return{media:r,cuts:e}}async function oe(s,i){let{session:o,from:r,lossy:l}=await H(s,i.timeline),e=await T(structuredClone(o),{media_root:i.media_root,gather:"walk",reset:!0,lane:"video",dry_run:!1,cap:2e3,criteria:i.criteria??(i.mode==="cut_in"?{file_name:!1,reel_name:!0}:{file_name:!0,file_name_mode:"loose"}),tolerances:i.tolerances}),{media:t,cuts:n}=X(o,e.session),c=[`read from ${r}`,...l&&i.mode==="new_version"?[`\u26A0 ${l}`]:[],`matched ${t.length} medi${t.length===1?"um":"a"} under ${i.media_root} (${n.length} clip use${n.length===1?"":"s"} in the sequence)`],m=t.map(u=>` ${u.old.split("/").pop()} \u2192 ${u.new}`);if(i.dry_run||!t.length)return{text:[...c,...m,i.dry_run?"(dry run \u2014 nothing changed in Premiere)":"",e.text.split(`
4
+ `).slice(-6).join(`
5
+ `)].filter(Boolean).join(`
6
+ `),data:{media:t,cuts:n,from:r}};if(i.mode==="replace"||i.mode==="hires"||i.mode==="proxy"){let d=(await s.projectClips()).clips.flatMap(w=>t.filter(j=>j.old===w.file).map(j=>({clip:w.id,path:j.new,mode:i.mode}))),g=i.mode==="replace"?L(o,e.session,t):new Map,_=g.size?await Y(s,new Set(g.keys())):[],b=await s.relinkClips(d),h=b.results.filter(w=>w.ok).length,$=[...c,`${i.mode==="hires"?"attached full-res behind":i.mode==="proxy"?"attached as proxies to":"repointed"} ${h}/${d.length} project clip(s)${i.mode==="proxy"?" (Toggle Proxies in Premiere switches)":""}`,...m,...b.results.filter(w=>!w.ok).map(w=>` refused: ${w.detail??"Premiere refused"}`)],v=_.length?await B(s,_,g):null;return v&&$.push(...v.lines),{text:$.join(`
7
+ `),data:{media:t,results:b.results,undo_relink:b.undo,...v?{refit:v.data}:{},from:r}}}if(i.mode==="cut_in"){let u=await s.items({timeline:i.timeline,kind:"video"}),d=Math.max(0,...u.items.map(h=>h.track)),g=i.track??d+1,_=await s.cutIn(i.timeline,n.map(h=>({path:h.path,track:g,start:h.start,src_in:h.src_in,duration:h.duration,copy_from:{track:h.track,start:h.start}}))),b=_.results.filter(h=>h.ok).length;return{text:[...c,`cut in ${b}/${n.length} on V${g} (video only, the originals untouched underneath; Edit > Undo ${_.undo_steps}\xD7 in Premiere takes the cuts${_.undo_steps>1?" and the carried sizing":""} back; each return clip keeps its in/out marks)`,...n.map((h,$)=>` V${h.track} @${h.start} ${h.name} \u2192 ${h.path.split("/").pop()} src ${h.src_in}${_.results[$]?.ok?"":` REFUSED: ${_.results[$]?.detail??""}`}`)].join(`
8
+ `),data:{media:t,cuts:n,results:_.results,track:g,from:r}}}let f=e.session.timelines.find(u=>u.kind==="primary")??e.session.timelines[0];f&&(f.name=i.name??`${f.name}_CONFORMED`);let a=await q(e.session,"premiere-prproj",k(await x("conform-ppro-"),"/"),""),p=await s.open({path:a.path});return{text:[...c,`new sequence "${p.timeline}" in ${p.project} (the open sequence is untouched)`,...m,...p.notes,...a.issues.slice(0,10).map(u=>` note: ${u.message}`)].join(`
9
+ `),data:{media:t,path:a.path,sequence:p.timeline,issues:a.issues,from:r}}}function L(s,i,o){let r=new Map,l=(e,t)=>(e.media_references??[]).find(n=>n.id===t);for(let e of o){let t=l(s,e.ref_id),n=l(i,e.ref_id),c=t?.source_resolution_w,m=t?.source_resolution_h,f=n?.source_resolution_w,a=n?.source_resolution_h;!c||!m||!f||!a||c===f||Math.abs(c/m-f/a)>.01||r.set(e.old,c/f)}return r}async function Y(s,i){let o=[];for(let r of(await s.current()).timelines){let l=await s.model(r).catch(()=>null);for(let e of l?.items??[])i.has(e.file_path)&&o.push({sequence:r,track:e.track,start:e.start-l.start_frame,file:e.file_path,zx:e.sizing.ZoomX??1,zy:e.sizing.ZoomY??e.sizing.ZoomX??1,keyframed:!!e.sizing_keyframed})}return o}async function B(s,i,o){let r=[],l={},e=new Map;for(let t of i)(e.get(t.sequence)??e.set(t.sequence,[]).get(t.sequence)).push(t);for(let[t,n]of e){let c=n.filter(a=>a.keyframed),m=n.filter(a=>!a.keyframed).map(a=>{let p=o.get(a.file);return{op:"properties",item:{kind:"video",track:a.track,start:a.start},set:{ZoomX:+(a.zx*p).toFixed(6),ZoomY:+(a.zy*p).toFixed(6)}}}),f=m.length?await s.apply({timeline:t,ops:m}):null;l[t]={rescaled:f?.applied??0,keyframed:c.length,undo:f?.undo??[]},r.push(` "${t}": ${f?.applied??0}/${m.length} use(s) rescaled to keep their framing on the new raster (one Edit > Undo)${c.length?`; ${c.length} with keyframed scale left as they are \u2014 check them`:""}`)}return{lines:["framing kept through the raster change (Premiere's Scale is a percent of the media's pixels):",...r],data:l}}async function G(s){let i=new Set;for(let e of s.timelines)for(let t of e.tracks)for(let n of t.items)n.is_adjustment&&(i.add(n.id),n.is_adjustment=!1);let o=s.timelines.flatMap(e=>e.tracks.flatMap(t=>t.items)).filter(e=>e.kind==="nested").length,r=await A(s);if(!r)throw new Error("un-nesting needs the conform.tools engine on this machine");for(let e of r.session.timelines)for(let t of e.tracks)for(let n of t.items)i.has(n.id)&&(n.is_adjustment=!0);let l=s.timelines[0]?.id;return Object.assign(s,r.session),s.timelines=s.timelines.filter(e=>e.id===l),{summary:`un-nested ${o} nest${o===1?"":"s"}`,issues:r.issues}}async function ae(s,i){let{session:o,from:r,lossy:l}=await H(s,i.timeline),e=await J(o,i.ops,i.name),t=await q(e.session,"premiere-prproj",k(await x("conform-ppro-"),"/"),""),n=await s.open({path:t.path}),c=[...e.issues,...t.issues.map(m=>m.message)];return{text:[`read from ${r}`,...l?[`\u26A0 ${l}`]:[],...e.lines,`new sequence "${n.timeline}" in ${n.project} (the open sequence is untouched)`,...c.slice(0,12).map(m=>` note: ${m}`),...c.length>12?[` \u2026and ${c.length-12} more notes`]:[]].join(`
10
+ `),data:{sequence:n.timeline,path:t.path,notes:c,from:r}}}async function J(s,i,o){let r=[],l=[],e=()=>s.timelines[0];for(let n of i){if(n.kind==="unnest"){let a=await G(s);r.push(a.summary),l.push(...a.issues);continue}let c=new Set(s.timelines.map(a=>a.id)),m=N(s,n.kind,{timeline_id:e()?.id,...n.args??{}});r.push(m.summary);let f=s.timelines.find(a=>!c.has(a.id)&&a.kind!=="compound");f&&(s.timelines=z(s,f).timelines)}let t=e();if(!t)throw new Error("nothing to write: the operations left no timeline");return t.name=o??(i.length===1?`${t.name}_${i[0].kind.toUpperCase()}`:`${t.name}_EDIT`),{session:z(s,t),lines:r,issues:l}}export{C as bindAtRecordedPaths,X as changes,J as editSession,ae as hostEdit,oe as hostRelink,H as premiereSession,Z as probeRefs,L as rasterRatios,I as withLiveMarkers,z as withNests,re as withOfflineReference,W as withPremiereTimecodes};
@@ -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{f as a,g as b,h as c,i as d,j as e}from"./chunk-E5ENIKNR.js";import"./chunk-ZVUKOFUX.js";import"./chunk-56EEBHP2.js";import"./chunk-DFDXSIMI.js";import"./chunk-NQNS4Y2B.js";import"./chunk-7QUSVHO2.js";import"./chunk-PFZVET7S.js";import"./chunk-JHTMYXJM.js";import"./chunk-YUO3UWPH.js";import"./chunk-JV7TZDKJ.js";import"./chunk-6V4OEOOX.js";import"./chunk-RGMTLNMF.js";import"./chunk-ISKNIQVO.js";import"./chunk-JKOB3U54.js";import"./chunk-EEDLRRKU.js";import"./chunk-DKGGJM6Z.js";import"./chunk-WJ5EWXP2.js";import"./chunk-C2ESM27Z.js";import"./chunk-XDI6CPPV.js";import"./chunk-DGXZB7MO.js";import"./chunk-JXTRQ3UG.js";import"./chunk-NU3X7P4N.js";import"./chunk-DPA26AOI.js";import"./chunk-XJNWAQON.js";import"./chunk-CJYLQ3UM.js";import"./chunk-PHAMF4JF.js";import"./chunk-DNS4ZYIO.js";import"./chunk-PSANHDZM.js";export{a as AVID_SETUP,b as FLAME_SETUP,c as NUKE_SETUP,e as adapter,d as setAdapter};
package/dist/http.js CHANGED
@@ -1,5 +1,5 @@
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 xt}from"./chunk-NFJHWZJX.js";import{$ as yt,G as nt,H as ot,I as dt,J as pt,K as gt,R as ht,S as wt,T as _t,X as b,Y as kt,_ as U}from"./chunk-SYX6W5TS.js";import"./chunk-BW4LRTHG.js";import"./chunk-IPFPZBSC.js";import"./chunk-MS3AWOSG.js";import"./chunk-7SENYEIV.js";import"./chunk-TXQR2HI2.js";import{J as I,t as mt,u as ft}from"./chunk-H6WZ43NS.js";import{a as et}from"./chunk-LGUO7PL5.js";import"./chunk-GM6QKY7W.js";import"./chunk-PFISREY4.js";import"./chunk-JV7TZDKJ.js";import"./chunk-VIBEEWPC.js";import"./chunk-PFZVET7S.js";import"./chunk-6V4OEOOX.js";import"./chunk-RGMTLNMF.js";import"./chunk-D4WPRRBT.js";import"./chunk-WN53ARHJ.js";import"./chunk-A7FNR3T5.js";import"./chunk-J2JXLEAI.js";import"./chunk-SGLQY53R.js";import"./chunk-DKGGJM6Z.js";import"./chunk-D6YDLKSA.js";import"./chunk-AMRJXYL4.js";import"./chunk-3D3Z4TBR.js";import"./chunk-2BPR6LK6.js";import"./chunk-GK4YYKJ6.js";import"./chunk-NU3X7P4N.js";import"./chunk-RJ6JA2LZ.js";import{B as v,D as lt,t as rt,u as st,v as it,x as at,y as ct,z as ut}from"./chunk-F74QMWXE.js";import{n as H}from"./chunk-JZY2BHQB.js";import{a as B}from"./chunk-PHAMF4JF.js";import{D as L,H as D,I as Z,J as q,Q as tt,V as M,W as J,Y as x,b as E,k as P,q as V,r as W,u as K,v as X,w as A,x as Y,y as $,z as Q}from"./chunk-PLRB2YXJ.js";import"./chunk-C2ESM27Z.js";import"./chunk-PSANHDZM.js";import C from"node:process";var bt=new Map;function St(t,s,o,T){let i=`${t}:${o}:${T}`,a=bt.get(i);return a||(a=(async()=>{let n=x(P(),"cache","grade-luts",t);await $(n);let l=x(n,`V${o}_${T}.cube`);if(!await W(l)){let{adapter:_}=await import("./hosts-66KSLCFJ.js");if((await _("resolve").clipLut({timeline:s,track:o,start:T,out_path:l})).ok===!1)return null}return l})().catch(()=>null),bt.set(i,a)),a}var Ct=new Set(["/app/convert","/app/canonicalize"]);function Ot(t,s){let o=(s??"").split(";")[0].trim().toLowerCase();return o==="application/json"||o==="application/octet-stream"&&Ct.has(t)}function Nt(t){let s=t.replace(/[\\/:*?"<>|\x00-\x1f]+/g,"_").replace(/[. ]+$/,"")||"timeline";return/^(con|prn|aux|nul|com\d|lpt\d)(\..*)?$/i.test(s)?`_${s}`:s}var F={id:"local",name:"Local",client_name:null,handles:24,local:!0};async function Rt(){try{return JSON.parse(await X(x(P(),"projects","projects.json")))}catch{return[]}}async function Tt(){let t=await b("project",{action:"list"});if(!t.isError){let s=t.structuredContent?.projects??[];return await $(x(P(),"projects")),await Y(x(P(),"projects","projects.json"),JSON.stringify(s)),{projects:[F,...s],offline:!1}}return{projects:[F,...await Rt()],offline:!0,code:String(t.structuredContent?.code??"offline"),reason:String(t.structuredContent?.message??t.content[0]?.text??"")}}async function $t(t){return t==="local"?F:(await Rt()).find(s=>s.id===t)??{id:t,name:t}}async function Pt(t,s,o,T,i=(a,n)=>new Response(a,{headers:{"content-type":n}})){if(s[0]!=="app")return null;let[,a,n,l]=s,_=async()=>t.headers.get("content-type")?.includes("json")?await t.json():{};try{if(a==="policy"&&t.method==="GET"){let{config:e}=await import("./account-NJSA4N67.js"),r=await fetch(`${e().supabaseUrl}/functions/v1/v1-billing/v1/billing/app-policy`,{signal:AbortSignal.timeout(3e3)}).catch(()=>null);return o(r?.ok?await r.json():{offline:!0})}if(a==="account"&&t.method==="GET"){let e=await b("account_status",{}),r=await H().then(()=>({app:!0}),u=>({app:!1,app_reason:u.message,code:u.code}));return o({...e.structuredContent,...e.structuredContent?.account??{},...r,text:e.content[0]?.text})}{let e=await H().then(()=>null,r=>r);if(e)return o({ok:!1,code:e.code,message:e.message,needs:"app"},e.code==="not_signed_in"?401:402)}if(a==="events"&&t.method==="GET")return T(gt());if(a==="front"&&t.method==="POST"){let e=await t.json();return pt({project:String(e.project??""),view:String(e.view??""),...e.tool?{tool:String(e.tool)}:{}}),o({ok:!0})}if(a==="convert"&&t.method==="POST"){let e=new URL(t.url).searchParams,r=M(e.get("name")||"timeline"),u=e.get("out")||"",g=JSON.parse(e.get("targets")||"[]"),c=JSON.parse(e.get("sequences")||"[]");if(!u||!g.length)return o({ok:!1,error:"a folder and at least one format are needed"},400);let m=await D("conform-te-"),k=x(m,r);await A(k,new Uint8Array(await t.arrayBuffer()));let h=await b("timeline_read",{path:k}),S=h.structuredContent?.session_id??h.content[0]?.text.match(/session_id: (\w+)/)?.[1];if(h.isError||!S)return o({ok:!1,error:h.content[0]?.text??"could not read the timeline"});let p=(await v(S)).session.timelines.filter(y=>y.kind!=="compound"),w=c.length?p.filter(y=>c.includes(y.name??"")):p,d=[],O=0;for(let y of w)for(let R of g){let N=x(u,`${Nt(y.name??"timeline")}.${R.ext}`),z=await b("timeline_write",{session_id:S,target:R.target,out_path:N,...w.length>1||p.length>1?{timeline_id:y.id}:{}});z.isError?d.push(`${y.name} \u2192 ${R.target}: ${z.content[0]?.text}`):O++}return await L(m).catch(()=>{}),o({ok:O>0,savedCount:O,...d.length?{error:d.join(`
3
+ import{a as xt}from"./chunk-TDIY4NRQ.js";import{$ as yt,G as nt,H as ot,I as dt,J as pt,K as gt,R as ht,S as wt,T as _t,X as b,Y as kt,_ as U}from"./chunk-QHXX5GDD.js";import"./chunk-6HZP2OJA.js";import"./chunk-2MJAQROY.js";import"./chunk-Y2QHZUGL.js";import"./chunk-E5ENIKNR.js";import"./chunk-ZVUKOFUX.js";import"./chunk-56EEBHP2.js";import{K as I,u as mt,v as ft}from"./chunk-DFDXSIMI.js";import"./chunk-NQNS4Y2B.js";import"./chunk-7QUSVHO2.js";import"./chunk-PFZVET7S.js";import{a as et}from"./chunk-JHTMYXJM.js";import"./chunk-UGVGRL5M.js";import"./chunk-YUO3UWPH.js";import"./chunk-JV7TZDKJ.js";import"./chunk-6V4OEOOX.js";import"./chunk-RGMTLNMF.js";import"./chunk-ISKNIQVO.js";import"./chunk-JKOB3U54.js";import"./chunk-EEDLRRKU.js";import"./chunk-DKGGJM6Z.js";import"./chunk-WJ5EWXP2.js";import"./chunk-C2ESM27Z.js";import"./chunk-D6YDLKSA.js";import"./chunk-XDI6CPPV.js";import"./chunk-DGXZB7MO.js";import"./chunk-JXTRQ3UG.js";import"./chunk-YC7QDS5U.js";import"./chunk-NU3X7P4N.js";import"./chunk-DPA26AOI.js";import{B as v,D as lt,t as rt,u as st,v as it,x as at,y as ct,z as ut}from"./chunk-GM262EDM.js";import{k as H}from"./chunk-XJNWAQON.js";import"./chunk-CJYLQ3UM.js";import{a as B}from"./chunk-PHAMF4JF.js";import{D as L,H as D,I as Z,J as q,Q as tt,W as M,X as J,Z as x,b as E,k as P,q as V,r as W,u as K,v as X,w as A,x as Y,y as $,z as Q}from"./chunk-DNS4ZYIO.js";import"./chunk-PSANHDZM.js";import C from"node:process";var bt=new Map;function St(t,s,o,T){let i=`${t}:${o}:${T}`,a=bt.get(i);return a||(a=(async()=>{let n=x(P(),"cache","grade-luts",t);await $(n);let l=x(n,`V${o}_${T}.cube`);if(!await W(l)){let{adapter:_}=await import("./hosts-D3TR2QEV.js");if((await _("resolve").clipLut({timeline:s,track:o,start:T,out_path:l})).ok===!1)return null}return l})().catch(()=>null),bt.set(i,a)),a}var Ct=new Set(["/app/convert","/app/canonicalize"]);function Ot(t,s){let o=(s??"").split(";")[0].trim().toLowerCase();return o==="application/json"||o==="application/octet-stream"&&Ct.has(t)}function Nt(t){let s=t.replace(/[\\/:*?"<>|\x00-\x1f]+/g,"_").replace(/[. ]+$/,"")||"timeline";return/^(con|prn|aux|nul|com\d|lpt\d)(\..*)?$/i.test(s)?`_${s}`:s}var F={id:"local",name:"Local",client_name:null,handles:24,local:!0};async function Rt(){try{return JSON.parse(await X(x(P(),"projects","projects.json")))}catch{return[]}}async function Tt(){let t=await b("project",{action:"list"});if(!t.isError){let s=t.structuredContent?.projects??[];return await $(x(P(),"projects")),await Y(x(P(),"projects","projects.json"),JSON.stringify(s)),{projects:[F,...s],offline:!1}}return{projects:[F,...await Rt()],offline:!0,code:String(t.structuredContent?.code??"offline"),reason:String(t.structuredContent?.message??t.content[0]?.text??"")}}async function $t(t){return t==="local"?F:(await Rt()).find(s=>s.id===t)??{id:t,name:t}}async function Pt(t,s,o,T,i=(a,n)=>new Response(a,{headers:{"content-type":n}})){if(s[0]!=="app")return null;let[,a,n,l]=s,_=async()=>t.headers.get("content-type")?.includes("json")?await t.json():{};try{if(a==="policy"&&t.method==="GET"){let{config:e}=await import("./account-GFIQC77T.js"),r=await fetch(`${e().supabaseUrl}/functions/v1/v1-billing/v1/billing/app-policy`,{signal:AbortSignal.timeout(3e3)}).catch(()=>null);return o(r?.ok?await r.json():{offline:!0})}if(a==="account"&&t.method==="GET"){let e=await b("account_status",{}),r=await H().then(()=>({app:!0}),u=>({app:!1,app_reason:u.message,code:u.code}));return o({...e.structuredContent,...e.structuredContent?.account??{},...r,text:e.content[0]?.text})}{let e=await H().then(()=>null,r=>r);if(e)return o({ok:!1,code:e.code,message:e.message,needs:"app"},e.code==="not_signed_in"?401:402)}if(a==="events"&&t.method==="GET")return T(gt());if(a==="front"&&t.method==="POST"){let e=await t.json();return pt({project:String(e.project??""),view:String(e.view??""),...e.tool?{tool:String(e.tool)}:{}}),o({ok:!0})}if(a==="convert"&&t.method==="POST"){let e=new URL(t.url).searchParams,r=M(e.get("name")||"timeline"),u=e.get("out")||"",g=JSON.parse(e.get("targets")||"[]"),c=JSON.parse(e.get("sequences")||"[]");if(!u||!g.length)return o({ok:!1,error:"a folder and at least one format are needed"},400);let m=await D("conform-te-"),k=x(m,r);await A(k,new Uint8Array(await t.arrayBuffer()));let h=await b("timeline_read",{path:k}),S=h.structuredContent?.session_id??h.content[0]?.text.match(/session_id: (\w+)/)?.[1];if(h.isError||!S)return o({ok:!1,error:h.content[0]?.text??"could not read the timeline"});let p=(await v(S)).session.timelines.filter(y=>y.kind!=="compound"),w=c.length?p.filter(y=>c.includes(y.name??"")):p,d=[],O=0;for(let y of w)for(let R of g){let N=x(u,`${Nt(y.name??"timeline")}.${R.ext}`),z=await b("timeline_write",{session_id:S,target:R.target,out_path:N,...w.length>1||p.length>1?{timeline_id:y.id}:{}});z.isError?d.push(`${y.name} \u2192 ${R.target}: ${z.content[0]?.text}`):O++}return await L(m).catch(()=>{}),o({ok:O>0,savedCount:O,...d.length?{error:d.join(`
4
4
  `)}:{}})}if(a==="fs"&&t.method==="POST"){let{op:e,path:r,offset:u=0,length:g=0}=await _();if(e==="statPath"){let c=await V(r).catch(()=>null);return o({ok:!0,result:c?{kind:c.isDirectory?"directory":"file",size:c.size,lastModified:Math.round(c.mtimeMs)}:null})}if(e==="readDir"){let c=[];for await(let m of Z(r))(m.isFile||m.isDirectory)&&c.push({name:m.name,kind:m.isDirectory?"directory":"file"});return o({ok:!0,result:c})}if(e==="readFile"){let c=await q(r);try{return i(await c.readAt(Math.max(0,u),Math.min(Math.max(0,g),16<<20)),"application/octet-stream")}finally{await c.close()}}return o({ok:!1,code:"bad_request",message:`no fs op ${e}`},400)}if(a==="canonicalize"&&t.method==="POST"){let e=new URL(t.url).searchParams,r=JSON.parse(e.get("sequences")||"[]"),u=JSON.parse(e.get("previous")||"[]"),g=await D("conform-te-");try{let c=x(g,M(e.get("name")||"timeline"));await A(c,new Uint8Array(await t.arrayBuffer()));let m=await b("timeline_read",{path:c}),k=m.structuredContent?.session_id??m.content[0]?.text.match(/session_id: (\w+)/)?.[1];if(m.isError||!k)return o({ok:!1,error:m.content[0]?.text??"could not read the timeline"},422);let h=(await v(k)).session,S=h.timelines;if(r.length){let p=new Map;for(let d of u)p.set(d,(p.get(d)??0)+1);let w=new Set;for(let d of r){let O=h.timelines.filter(N=>N.kind!=="compound"&&(N.name??"")===d),y=p.get(d)??0;p.set(d,y+1);let R=O[Math.min(y,O.length-1)];R&&w.add(R)}S=h.timelines.filter(d=>d.kind==="compound"||w.has(d))}return o({ok:!0,session_id:k,session:{...h,timelines:S}})}finally{await L(g).catch(()=>{})}}if(a==="sessions"&&n&&l==="frame"){let e=new URL(t.url).searchParams,r=Math.max(0,Math.round(Number(e.get("f")??0))),u=Math.min(3840,Math.max(64,Number(e.get("w")??1280)|0));try{let k=(await v(n)).session,h=e.get("track")==="offline"?"offline":Number(e.get("track"))||void 0,S;if(e.get("grade")==="resolve"&&h!=="offline"){let w=(()=>{try{return mt(k,{record:r,timeline:e.get("timeline")??void 0,track:h})}catch{return null}})();w&&(S=await St(n,e.get("host_timeline")??void 0,w.video_track,w.record_start)??void 0)}let p=await ft(k,r,u,e.get("timeline")??void 0,h,S);if(p){let w=new Uint8Array(12+p.px.length),d=new DataView(w.buffer);return d.setUint32(0,p.w,!0),d.setUint32(4,p.h,!0),d.setUint32(8,p.order==="bgra"?1:0,!0),w.set(p.px,12),i(w,"application/x-conform-pixels")}}catch(k){return o({ok:!1,code:"no_frame",message:k.message},404)}let g=await b("timeline_frame",{session_id:n,record:r,width:u,...e.get("timeline")?{timeline:e.get("timeline")}:{}}),c=g.structuredContent?.out_path;if(g.isError||!c)return o({ok:!1,code:String(g.structuredContent?.code??"no_frame"),message:g.content[0]?.text??"no picture here"},404);let m=await K(c);return await(M(J(c)).startsWith("conform-frame-")?L(J(c)):Q(c)).catch(()=>{}),i(m,"image/png")}if(a==="sessions"&&n&&t.method==="GET"){let e=await v(n).catch(()=>null);return e?o(e):o({ok:!1,code:"not_found"},404)}if(a==="sessions"&&!n)return o(await lt());if(a!=="projects")return o({ok:!1,code:"not_found"},404);if(!n){if(t.method==="POST"){let e=await _(),r=await b("project",{action:"create",name:e.name,client_name:e.client_name,handles:e.handles});return r.isError?o({...r.structuredContent,text:r.content[0]?.text},422):(await Tt(),o(r.structuredContent))}return o(await Tt())}if(!l){let[e,r,u,g]=await Promise.all([$t(n),st(n).catch(()=>null),ut(n),dt(n)]);await at(n===rt?null:{id:n,name:e.name??n});let{text:c="",...m}=r??{};return o({project:e,context:c,context_meta:m,sessions:u,activity:g.slice(-100).reverse()})}if(l==="sessions"&&t.method==="PUT")return await ct(n,String((await _()).session_id??"")),o({ok:!0});if(l==="context"&&t.method==="PUT"){let e=await _();try{let{text:r,...u}=await it(n,String(e.text??""),e.base===void 0?void 0:e.base);return o({ok:!0,context:r,context_meta:u})}catch(r){if(r instanceof B&&r.code==="context_conflict"){let u=r.data?.current;return o({ok:!1,code:r.code,message:r.message,context:u.context,context_meta:{updated_at:u.context_updated_at,updated_by:u.context_updated_by_name??null}},409)}throw r}}return o({ok:!1,code:"not_found"},404)}catch(e){let r=e instanceof B?e:null;return o({ok:!1,code:r?.code??"internal",message:e.message},r?.code==="not_found"?404:r?.code==="invalid_args"?400:500)}}var Lt=Number(E("CONFORM_HTTP_PORT")??7791);E("CONFORM_EXIT_WITH_PARENT")==="1"&&(C.stdin.on("end",()=>C.exit(0)),C.stdin.on("close",()=>C.exit(0)),C.stdin.resume());var G=E("CONFORM_HTTP_TOKEN")??"",vt=(E("CONFORM_HTTP_ORIGINS")??"https://conform.tools,https://app.conform.tools,http://localhost:5173,http://localhost:3000").split(","),j=(t,s=new Headers)=>{let o=t.headers.get("origin")??"";return vt.includes(o)&&s.set("access-control-allow-origin",o),s.set("access-control-allow-headers","authorization, content-type"),s.set("access-control-allow-methods","GET, POST, PUT, DELETE, OPTIONS"),s.set("access-control-allow-private-network","true"),s.set("vary","origin"),s},Et=new Set,f=(t,s,o=200)=>new Response(JSON.stringify(s),{status:o,headers:j(t,new Headers({"content-type":"application/json"}))});tt({hostname:"127.0.0.1",port:Lt,onListen:t=>{Et=new Set([`127.0.0.1:${t}`,`localhost:${t}`,`[::1]:${t}`]),console.error(`conformtools HTTP API on http://127.0.0.1:${t} (${U.length} verbs)`),xt(t,G)}},async t=>{let s=new URL(t.url),o=(t.headers.get("host")??"").toLowerCase();if(!Et.has(o))return new Response("forbidden host",{status:403});let T=t.headers.get("origin");if(T&&!vt.includes(T))return new Response("forbidden origin",{status:403});if(t.method==="OPTIONS")return new Response(null,{status:204,headers:j(t)});if((t.method==="POST"||t.method==="PUT")&&t.headers.get("content-length")!=="0"&&!Ot(s.pathname,t.headers.get("content-type")))return f(t,{ok:!1,code:"unsupported_media_type",message:"send the body as application/json"},415);if(G&&t.headers.get("authorization")!==`Bearer ${G}`&&s.pathname!=="/health")return f(t,{ok:!1,code:"unauthorized"},401);let i=s.pathname.split("/").filter(Boolean);try{if(s.pathname==="/health")return f(t,{ok:!0,verbs:U.length,version:et,engine:I()});if(i[0]==="verbs"&&i.length===1&&t.method==="GET")return f(t,U.map(n=>({name:n.name,title:n.title,description:n.description,long:!!n.long,input_schema:ot(nt.object(n.inputSchema)),protected_stages:n.protectedStages??[],engine:I()})));if(i[0]==="verbs"&&i.length===2&&t.method==="POST"){let n=yt(i[1]);if(!n)return f(t,{ok:!1,code:"not_found",message:`unknown verb ${i[1]}`},404);let l=t.headers.get("content-type")?.includes("json")?await t.json():{},_=kt(n.name,l);if(!_.ok)return f(t,{..._.result.structuredContent,text:_.result.content[0].text},400);let e=await b(n.name,_.data);return f(t,{...e.structuredContent??{ok:!e.isError},text:e.content.map(r=>r.text).join(`
5
- `)},e.isError?422:200)}if(i[0]==="debug"&&i.length===3&&t.method==="POST"&&Deno.env.get("CONFORM_DEBUG_BRIDGE")==="1"){let{hostBridge:n}=await import("./bridge-UIDAF74E.js"),l=await n();return await l.waitFor(i[1],5e3)?f(t,{ok:!0,result:await l.request(i[1],i[2],t.headers.get("content-type")?.includes("json")?await t.json():{},12e4)}):f(t,{ok:!1,code:"not_connected"},409)}let a=await Pt(t,i,(n,l)=>f(t,n,l),n=>new Response(n,{headers:j(t,new Headers({"content-type":"text/event-stream","cache-control":"no-cache"}))}),(n,l)=>new Response(n,{headers:j(t,new Headers({"content-type":l,"cache-control":"no-store"}))}));if(a)return a;if(i[0]==="jobs"&&i.length===1)return f(t,await _t());if(i[0]==="jobs"&&i.length===2){if(t.method==="DELETE")return f(t,{ok:wt(i[1])});let n=await ht(i[1]);return n?f(t,n):f(t,{ok:!1,code:"not_found"},404)}return f(t,{ok:!1,code:"not_found"},404)}catch(a){return f(t,{ok:!1,code:"internal",message:a instanceof Error?a.message:String(a)},500)}});
5
+ `)},e.isError?422:200)}if(i[0]==="debug"&&i.length===3&&t.method==="POST"&&Deno.env.get("CONFORM_DEBUG_BRIDGE")==="1"){let{hostBridge:n}=await import("./bridge-73XMEZLH.js"),l=await n();return await l.waitFor(i[1],5e3)?f(t,{ok:!0,result:await l.request(i[1],i[2],t.headers.get("content-type")?.includes("json")?await t.json():{},12e4)}):f(t,{ok:!1,code:"not_connected"},409)}let a=await Pt(t,i,(n,l)=>f(t,n,l),n=>new Response(n,{headers:j(t,new Headers({"content-type":"text/event-stream","cache-control":"no-cache"}))}),(n,l)=>new Response(n,{headers:j(t,new Headers({"content-type":l,"cache-control":"no-store"}))}));if(a)return a;if(i[0]==="jobs"&&i.length===1)return f(t,await _t());if(i[0]==="jobs"&&i.length===2){if(t.method==="DELETE")return f(t,{ok:wt(i[1])});let n=await ht(i[1]);return n?f(t,n):f(t,{ok:!1,code:"not_found"},404)}return f(t,{ok:!1,code:"not_found"},404)}catch(a){return f(t,{ok:!1,code:"internal",message:a instanceof Error?a.message:String(a)},500)}});