conformtools 0.6.10 → 0.6.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -22
- package/dist/{account-GFIQC77T.js → account-IUWNSDG5.js} +1 -1
- package/dist/{analysis-engine-4K5K6L53.js → analysis-engine-M7W32RRC.js} +1 -1
- package/dist/bridge-6NCHJWE6.js +3 -0
- package/dist/browser/timeline_core_bg.wasm +0 -0
- package/dist/{chunk-56EEBHP2.js → chunk-2CY2OOOJ.js} +1 -1
- package/dist/chunk-3XQI5SIV.js +3 -0
- package/dist/chunk-5YULBQJX.js +3 -0
- package/dist/chunk-64X5DLH5.js +6 -0
- package/dist/{chunk-XJNWAQON.js → chunk-6NLB5TZ2.js} +1 -1
- package/dist/chunk-B77ADB26.js +3 -0
- package/dist/chunk-DFQWQ3EA.js +10 -0
- package/dist/{chunk-JXTRQ3UG.js → chunk-F4PHKOAS.js} +1 -1
- package/dist/chunk-G3SZDPDS.js +3 -0
- package/dist/chunk-IN6XVTUS.js +3 -0
- package/dist/{chunk-NQNS4Y2B.js → chunk-LVGGCRDW.js} +1 -1
- package/dist/chunk-LYM757KG.js +158 -0
- package/dist/chunk-N34DQ6MH.js +14 -0
- package/dist/chunk-NMH62JSC.js +5 -0
- package/dist/chunk-NXJZXXC2.js +20 -0
- package/dist/{chunk-6HZP2OJA.js → chunk-OMPYIH6F.js} +1 -1
- package/dist/{chunk-DGXZB7MO.js → chunk-P3XI63Q2.js} +1 -1
- package/dist/chunk-QTA36RVO.js +502 -0
- package/dist/chunk-QTFFVLVJ.js +8 -0
- package/dist/{chunk-E5ENIKNR.js → chunk-SJ56EEFP.js} +2 -2
- package/dist/chunk-THVX57I3.js +4 -0
- package/dist/chunk-UUXHJNQA.js +8 -0
- package/dist/chunk-VJN4UXFJ.js +8 -0
- package/dist/chunk-XF3YMBI7.js +3 -0
- package/dist/chunk-XVRTAKDK.js +6 -0
- package/dist/chunk-YU3SUSK3.js +3 -0
- package/dist/claude-setup-REU4AOKX.js +13 -0
- package/dist/cli.js +8 -8
- package/dist/emscripten-module-Q67P5WYC-HW3D2R5O.js +2161 -0
- package/dist/engine-6ACEWA4S.js +5 -0
- package/dist/ffi-7KTOX2T4.js +3 -0
- package/dist/framing-CVJM5TT3.js +3 -0
- package/dist/gfx-worker.js +1 -1
- package/dist/{h264-B2TLLEMI.js → h264-5OGRVYUF.js} +1 -1
- package/dist/{h264-mxf-3GED5PBT.js → h264-mxf-FTHNCK4B.js} +1 -1
- package/dist/host-relink-ZP33BK53.js +10 -0
- package/dist/hosted-BWAYLJXR.js +3 -0
- package/dist/hosts-H3IKRZF2.js +3 -0
- package/dist/http.js +3 -3
- package/dist/{inspect-D3WEYL2W.js → inspect-BJYIDVDN.js} +2 -2
- package/dist/{isobmff-C5A2EFKH.js → isobmff-DN6MCHEK.js} +1 -1
- package/dist/{mc-video-ARKIHPA7.js → mc-video-TF3MD7LN.js} +1 -1
- package/dist/mcp.js +8 -7
- package/dist/{media-3YMIZSSF.js → media-MJKEKCPN.js} +1 -1
- package/dist/module-ES6BEMUI-L6VQ7K3J.js +3 -0
- package/dist/module-asyncify-2EFITU5U-Z4EEM6X7.js +3 -0
- package/dist/{mxf-CQSI6H5T.js → mxf-Q5723GPD.js} +1 -1
- package/dist/{ops-BCTGDBXT.js → ops-B2OA7VXN.js} +1 -1
- package/dist/{probe-COWUTQGN.js → probe-72QZKMCC.js} +1 -1
- package/dist/{r3d-FX7V4BIE.js → r3d-7OOZMPWH.js} +1 -1
- package/dist/{sequence-patch-JVEZW24V.js → sequence-patch-CN4VC5W3.js} +1 -1
- package/dist/store-4WZQF6YD.js +3 -0
- package/dist/timeline-ZP5H4YDQ.js +3 -0
- package/package.json +10 -1
- package/dist/bridge-73XMEZLH.js +0 -3
- package/dist/chunk-2MJAQROY.js +0 -5
- package/dist/chunk-7QUSVHO2.js +0 -10
- package/dist/chunk-CJYLQ3UM.js +0 -5
- package/dist/chunk-DFDXSIMI.js +0 -39
- package/dist/chunk-DNS4ZYIO.js +0 -3
- package/dist/chunk-GM262EDM.js +0 -8
- package/dist/chunk-JHTMYXJM.js +0 -20
- package/dist/chunk-QHXX5GDD.js +0 -440
- package/dist/chunk-TDIY4NRQ.js +0 -3
- package/dist/chunk-UGVGRL5M.js +0 -3
- package/dist/chunk-Y2QHZUGL.js +0 -5
- package/dist/chunk-YC7QDS5U.js +0 -19
- package/dist/chunk-ZVUKOFUX.js +0 -6
- package/dist/claude-setup-OKOPPDMB.js +0 -5
- package/dist/conformtools-analyze +0 -0
- package/dist/conformtools-decode +0 -0
- package/dist/engine-274GQLUB.js +0 -5
- package/dist/framing-BKTUEUZO.js +0 -3
- package/dist/host-relink-PTV44KXF.js +0 -10
- package/dist/hosts-D3TR2QEV.js +0 -3
- package/dist/i2o-transfer +0 -0
- package/dist/store-SZKXADGI.js +0 -3
- package/dist/timeline-PEUC3G7K.js +0 -3
- /package/dist/{still-WUCFH2WX.js → still-SX6RJ7O6.js} +0 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
+
import{a as Q,d as mt}from"./chunk-6NLB5TZ2.js";import{a as j}from"./chunk-PHAMF4JF.js";import{$ as y,A as P,K as pt,m as R,x as S,z as T}from"./chunk-G3SZDPDS.js";import{createHash as qt}from"node:crypto";import{open as Zt}from"node:fs/promises";var Mt=new Uint16Array(256);for(let e=0;e<256;e++){let t=0,n=e<<8;for(let r=0;r<8;r++)(t^n)&32768?t=t<<1^4129:t=t<<1,n=n<<1;Mt[e]=t&65535}var tt=0,wt=2;var ne=Date.UTC(2020,0,1,0,0,0);function ht(e,t,n,r,o,s,i,a,g,c,u,_,p,w,d,b){let F=z(o,l.__wbindgen_export3,l.__wbindgen_export4),A=x,v=rt(i,l.__wbindgen_export3),W=x,Dt=l.udf_add_file_stream(f(e),f(t),f(n),f(r),F,A,s,v,W,a,g,c,u,_,p,w,d,b);return M(Dt)}function oe(e,t,n,r){let o,s;try{let p=l.__wbindgen_add_to_stack_pointer(-16),w=z(e,l.__wbindgen_export3,l.__wbindgen_export4),d=x,b=z(t,l.__wbindgen_export3,l.__wbindgen_export4),F=x,A=z(n,l.__wbindgen_export3,l.__wbindgen_export4),v=x;l.udf_build_layout(p,w,d,b,F,A,v,r);var i=h().getInt32(p+0,!0),a=h().getInt32(p+4,!0),g=h().getInt32(p+8,!0),c=h().getInt32(p+12,!0),u=i,_=a;if(c)throw u=0,_=0,M(g);return o=u,s=_,C(u,_)}finally{l.__wbindgen_add_to_stack_pointer(16),l.__wbindgen_export5(o,s,1)}}function xt(e,t,n,r,o,s,i){let a=z(o,l.__wbindgen_export3,l.__wbindgen_export4),g=x,c=rt(i,l.__wbindgen_export3),u=x,_=l.udf_fill_sparse_stream(f(e),f(t),f(n),f(r),a,g,s,c,u);return M(_)}function ie(){let e,t;try{let o=l.__wbindgen_add_to_stack_pointer(-16);l.udf_last_panic(o);var n=h().getInt32(o+0,!0),r=h().getInt32(o+4,!0);return e=n,t=r,C(n,r)}finally{l.__wbindgen_add_to_stack_pointer(16),l.__wbindgen_export5(e,t,1)}}function St(e,t){let n=l.udf_parse_stream(f(e),f(t));return M(n)}function se(e){let t,n;try{let s=l.__wbindgen_add_to_stack_pointer(-16),i=rt(e,l.__wbindgen_export3),a=x;l.udf_read_conform_iuvd(s,i,a);var r=h().getInt32(s+0,!0),o=h().getInt32(s+4,!0);return t=r,n=o,C(r,o)}finally{l.__wbindgen_add_to_stack_pointer(16),l.__wbindgen_export5(t,n,1)}}function Lt(){return{__proto__:null,"./udf_bg.js":{__proto__:null,__wbg___wbindgen_is_function_acc5528be2b923f2:function(t){return typeof m(t)=="function"},__wbg___wbindgen_is_undefined_721f8decd50c87a3:function(t){return m(t)===void 0},__wbg___wbindgen_number_get_1cc01dd708740256:function(t,n){let r=m(n),o=typeof r=="number"?r:void 0;h().setFloat64(t+8,O(o)?0:o,!0),h().setInt32(t+0,!O(o),!0)},__wbg___wbindgen_throw_ea4887a5f8f9a9db:function(t,n){throw new Error(C(t,n))},__wbg__wbg_cb_unref_33c39e13d73b25f6:function(t){m(t)._wbg_cb_unref()},__wbg_call_0e855b388e315e17:function(){return et(function(t,n,r,o){let s=m(t).call(m(n),m(r),m(o));return f(s)},arguments)},__wbg_call_5575218572ead796:function(){return et(function(t,n,r){let o=m(t).call(m(n),m(r));return f(o)},arguments)},__wbg_call_8e98ed2f3c86c4b5:function(){return et(function(t,n){let r=m(t).call(m(n));return f(r)},arguments)},__wbg_error_2b5d73c4c4804cfd:function(t,n){console.error(C(t,n))},__wbg_length_589238bdcf171f0e:function(t){return m(t).length},__wbg_new_81880fb5002cb255:function(t){let n=new Uint8Array(m(t));return f(n)},__wbg_new_from_slice_543b875b27789a8f:function(t,n){let r=new Uint8Array(yt(t,n));return f(r)},__wbg_new_no_args_2d7333de60de5ac7:function(t,n){let r=new Function(C(t,n));return f(r)},__wbg_new_typed_00a409eb4ec4f2d9:function(t,n){try{var r={a:t,b:n},o=(i,a)=>{let g=r.a;r.a=0;try{return $t(g,r.b,i,a)}finally{r.a=g}};let s=new Promise(o);return f(s)}finally{r.a=0}},__wbg_prototypesetcall_d721637c7ca66eb8:function(t,n,r){Uint8Array.prototype.set.call(yt(t,n),m(r))},__wbg_queueMicrotask_1c9b3800e321a967:function(t){let n=m(t).queueMicrotask;return f(n)},__wbg_queueMicrotask_311744e534a929a3:function(t){queueMicrotask(m(t))},__wbg_resolve_d82363d90af6928a:function(t){let n=Promise.resolve(m(t));return f(n)},__wbg_static_accessor_GLOBAL_THIS_2fee5048bcca5938:function(){let t=typeof globalThis>"u"?null:globalThis;return O(t)?0:f(t)},__wbg_static_accessor_GLOBAL_ce44e66a4935da8c:function(){let t=typeof global>"u"?null:global;return O(t)?0:f(t)},__wbg_static_accessor_SELF_44f6e0cb5e67cdad:function(){let t=typeof self>"u"?null:self;return O(t)?0:f(t)},__wbg_static_accessor_WINDOW_168f178805d978fe:function(){let t=typeof window>"u"?null:window;return O(t)?0:f(t)},__wbg_then_05edfc8a4fea5106:function(t,n,r){let o=m(t).then(m(n),m(r));return f(o)},__wbg_then_591b6b3a75ee817a:function(t,n){let r=m(t).then(m(n));return f(r)},__wbindgen_cast_0000000000000001:function(t,n){let r=zt(t,n,jt);return f(r)},__wbindgen_cast_0000000000000002:function(t){return f(t)},__wbindgen_cast_0000000000000003:function(t,n){let r=C(t,n);return f(r)},__wbindgen_object_clone_ref:function(t){let n=m(t);return f(n)},__wbindgen_object_drop_ref:function(t){M(t)}}}}function jt(e,t,n){try{let s=l.__wbindgen_add_to_stack_pointer(-16);l.__wasm_bindgen_func_elem_252(s,e,t,f(n));var r=h().getInt32(s+0,!0),o=h().getInt32(s+4,!0);if(o)throw M(r)}finally{l.__wbindgen_add_to_stack_pointer(16)}}function $t(e,t,n,r){l.__wasm_bindgen_func_elem_266(e,t,f(n),f(r))}function f(e){N===E.length&&E.push(E.length+1);let t=N;return N=E[t],E[t]=e,t}var bt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>l.__wbindgen_export2(e.a,e.b));function Nt(e){e<1028||(E[e]=N,N=e)}function yt(e,t){return e=e>>>0,D().subarray(e/1,e/1+t)}var U=null;function h(){return(U===null||U.buffer.detached===!0||U.buffer.detached===void 0&&U.buffer!==l.memory.buffer)&&(U=new DataView(l.memory.buffer)),U}function C(e,t){return Wt(e>>>0,t)}var $=null;function D(){return($===null||$.byteLength===0)&&($=new Uint8Array(l.memory.buffer)),$}function m(e){return E[e]}function et(e,t){try{return e.apply(this,t)}catch(n){l.__wbindgen_export(f(n))}}var E=new Array(1024).fill(void 0);E.push(void 0,null,!0,!1);var N=E.length;function O(e){return e==null}function zt(e,t,n){let r={a:e,b:t,cnt:1},o=(...s)=>{r.cnt++;let i=r.a;r.a=0;try{return n(i,r.b,...s)}finally{r.a=i,o._wbg_cb_unref()}};return o._wbg_cb_unref=()=>{--r.cnt===0&&(l.__wbindgen_export2(r.a,r.b),r.a=0,bt.unregister(r))},bt.register(o,r,r),o}function rt(e,t){let n=t(e.length*1,1)>>>0;return D().set(e,n/1),x=e.length,n}function z(e,t,n){if(n===void 0){let a=B.encode(e),g=t(a.length,1)>>>0;return D().subarray(g,g+a.length).set(a),x=a.length,g}let r=e.length,o=t(r,1)>>>0,s=D(),i=0;for(;i<r;i++){let a=e.charCodeAt(i);if(a>127)break;s[o+i]=a}if(i!==r){i!==0&&(e=e.slice(i)),o=n(o,r,r=i+e.length*3,1)>>>0;let a=D().subarray(o+i,o+r),g=B.encodeInto(e,a);i+=g.written,o=n(o,r,i,1)>>>0}return x=i,o}function M(e){let t=m(e);return Nt(e),t}var H=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});H.decode();var Bt=2146435072,nt=0;function Wt(e,t){return nt+=t,nt>=Bt&&(H=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),H.decode(),nt=t),H.decode(D().subarray(e,e+t))}var B=new TextEncoder;"encodeInto"in B||(B.encodeInto=function(e,t){let n=B.encode(e);return t.set(n),{read:e.length,written:n.length}});var x=0,Ht,Gt,l;function Jt(e,t){return Gt=e,l=e.exports,Ht=t,U=null,$=null,l.__wbindgen_start(),l}async function Vt(e,t){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,t)}catch(o){if(e.ok&&n(e.type)&&e.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",o);else throw o}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let r=await WebAssembly.instantiate(e,t);return r instanceof WebAssembly.Instance?{instance:r,module:e}:r}function n(r){switch(r){case"basic":case"cors":case"default":return!0}return!1}}async function G(e){if(l!==void 0)return l;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),e===void 0&&(e=new URL("udf_bg.wasm",import.meta.url));let t=Lt();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await Vt(await e,t);return Jt(n,r)}var ot=null;function Xt(e){return ot||(ot=(async()=>{if(e!==void 0)return G(e);if(typeof process<"u"&&process.versions?.node){let n="node:fs/promises",{readFile:r}=await import(n),o=await r(new URL("./wasm/udf_bg.wasm",import.meta.url));return G({module_or_path:o})}let{default:t}=await import("./udf_bg-B37GKRIH.js");return G({module_or_path:t})})()),ot}function J(){return Xt()}function V(e){return(t,n)=>e.read(t,n)}function it(e){return(t,n)=>e.write(t,n)}function X(e){return()=>e.getSize()}function st(e){return t=>e.setSize?e.setSize(t):Promise.resolve()}async function It(e){await J();let t=JSON.parse(await St(V(e),X(e)));if(t.error)throw new Error(t.error);let n=null;if(t.iuvdPayload)try{n=JSON.parse(t.iuvdPayload)}catch{}let r=null,o=t.files.find(s=>s.name===".i2o-manifest.json");if(o&&o.extents.length>0&&o.extents[0].type===tt){let s=o.extents[0].position,i=await e.read((t.partitionStartSector+s)*2048,o.totalSize);try{r=JSON.parse(new TextDecoder().decode(i))}catch{}}return{totalSectors:t.totalSectors,partitionStartSector:t.partitionStartSector,partitionLength:t.partitionLength,volumeName:t.volumeName,files:t.files,manifest:r,iuvdPayload:n,rootIcbSector:t.rootIcbSector,rootDataSector:t.rootDataSector,rootDataLength:t.rootDataLength,rootDataSectors:t.rootDataSectors,vdsStartSector:t.vdsStartSector,partitionDescVdsSector:t.partitionDescVdsSector}}function me(e){let t=[],n=0;for(let r of e.extents)r.type===wt&&t.push({offset:n,length:r.length}),n+=r.length;return t}function At(e){let t=[],n=0;for(let r of e.extents)r.type===tt&&t.push({offset:n,length:r.length,imageSector:r.position}),n+=r.length;return t}async function we(e,t,n,r,o){return await J(),await xt(V(e),it(e),X(e),st(e),n,r,o),It(e)}async function be(e,t,n,r,o,s=0){await J();let i=new Date,a=!!(o&&o.length>0);return await ht(V(e),it(e),X(e),st(e),n,r,a?o:new Uint8Array(0),a,s,i.getFullYear(),i.getMonth()+1,i.getDate(),i.getHours(),i.getMinutes(),i.getSeconds(),-i.getTimezoneOffset()),It(e)}var Y=1<<20,k=5*Y,Et=5*1024*Y,at=1e4,ct=8*Y,Kt=2048;function Ae(e,t,n=Math.max(16*Y,Math.ceil(e/(at-500)))){let r=[...t].filter(c=>c.len>0).sort((c,u)=>c.at-u.at),o=[];for(let c of r){let u=o[o.length-1];u&&c.at<u.at+u.len||(u&&u.at+u.len===c.at&&u.key===c.key&&u.offset+u.len===c.offset?u.len+=c.len:o.push({...c}))}let s=[],i=0;for(let c of o.filter(u=>u.len>=k))c.at>i&&s.push({at:i,len:c.at-i}),s.push({at:c.at,len:c.len,copy:c}),i=c.at+c.len;i<e&&s.push({at:i,len:e-i});let a=c=>c.reduce((u,_)=>{let p=u[u.length-1];return p&&!p.copy&&!_.copy?p.len+=_.len:u.push({..._}),u},[]);for(let c=!0;c;){c=!1,s=a(s);for(let u=0;u<s.length-1;u++){let _=s[u];if(_.len>=k)continue;let p=k-_.len,w=s[u+1],d=s[u-1];if(_.copy){delete _.copy,c=!0;break}w?.copy&&w.len-p>=k?(_.len+=p,w.at+=p,w.len-=p,w.copy={...w.copy,at:w.at,len:w.len,offset:w.copy.offset+p}):d?.copy&&d.len-p>=k?(d.len-=p,d.copy={...d.copy,len:d.len},_.at-=p,_.len+=p):w?.copy?delete w.copy:d?.copy&&delete d.copy,c=!0;break}}let g=[];for(let c of s){let u=c.copy?Math.min(Et,Math.max(n,k)):n;for(let _=c.at,p=c.at+c.len;_<p;){let w=Math.min(u,p-_);p-(_+w)>0&&p-(_+w)<k&&(w=p-_<=Et?p-_:w-k),g.push(c.copy?{kind:"copy",at:_,len:w,key:c.copy.key,offset:c.copy.offset+(_-c.at)}:{kind:"upload",at:_,len:w}),_+=w}}if(g.length>at)throw new Error(`the image needs ${g.length} pieces (S3 allows ${at})`);return g}function Ee(e,t,n,r){let o=[...r].sort((a,g)=>a.offset-g.offset),s=[],i=0;for(let a of o){let g=Math.min(a.offset,t);g>i&&s.push({at:i,len:g-i,key:e,offset:i}),i=Math.max(i,a.offset+a.length)}return i<Math.min(t,n)&&s.push({at:i,len:Math.min(t,n)-i,key:e,offset:i}),s}async function ve(e,t,n,r,o){let s=[];for(let i of t.files)for(let a of At(i)){let g=(t.partitionStartSector+a.imageSector)*Kt;for(let c=a.offset;c<a.offset+a.length;){let u=Math.min(a.offset+a.length,(Math.floor(c/ct)+1)*ct),_=g+(c-a.offset);s.push(o?.(_,u-c)??[qt("sha256").update(await e.read(_,u-c)).digest("hex"),_,u-c]),r?.(u-c),c=u}}return{v:1,block:ct,size:n,blocks:s}}function Te(e,t){let n=new Map;for(let o of t)for(let[s,i,a]of o.index.blocks)n.set(`${s}:${a}`,{key:o.key,offset:i});let r=[];for(let[o,s,i]of e.blocks){let a=n.get(`${o}:${i}`);a&&r.push({at:s,len:i,key:a.key,offset:a.offset})}return r}var vt=(e,t)=>`${Q().supabaseUrl}/functions/v1/${e}${t}`;async function lt(e,t,n={}){let r=await mt();if(!r)throw new Error("not signed in to conform.tools \u2014 run account_login");let o=await fetch(vt(e,t),{method:n.method??(n.body?"POST":"GET"),headers:{authorization:`Bearer ${r}`,apikey:Q().anonKey,...n.body?{"content-type":"application/json"}:{}},...n.body?{body:JSON.stringify(n.body)}:{},signal:AbortSignal.timeout(2e4)}),s=await o.text();if(!o.ok){let i=s;try{let a=JSON.parse(s);i=a.error?.message??a.message??a.error??s}catch{}throw o.status===404&&/Requested function was not found/i.test(String(i))?new Error(`${e} isn't deployed on ${new URL(vt(e,t)).host}: this server doesn't have that feature yet (an older server, or a staging/production mismatch)`):new Error(`${n.method??"GET"} ${t}: ${o.status} ${i}`)}return s?JSON.parse(s):{}}function Pe(e,t="org"){let n=`/v1/sessions/${e}/storage/multipart`,r=(o,s,i)=>lt("v1-sessions",o,{body:s,method:i});return{start:async o=>String((await r(`${n}/start`,{key:o,content_type:"application/x-iso9660-image"})).upload_id),partUrls:async(o,s,i,a)=>(await r(`${n}/${s}/part-urls`,{key:o,first_part:i,count:a})).parts,copyPart:async(o,s,i,a)=>String((await r(`${n}/${s}/copy-part`,{key:o,part_number:i,source_ref:{scheme:t,bucket:"i2o",key:a.key},byte_range:{offset:a.offset,length:a.length}})).etag),complete:async(o,s,i)=>{await r(`${n}/${s}/complete`,{key:o,parts:i})},abort:async(o,s)=>{await r(`${n}/${encodeURIComponent(s)}?key=${encodeURIComponent(o)}`,void 0,"DELETE")},readUrl:async o=>String((await r(`/v1/sessions/${e}/download-url`,{storage_path:o})).download_url)}}async function ut(e,t,n=4){for(let r=1;;r++)try{return await t()}catch(o){if(r>=n)throw new Error(`${e} failed after ${n} tries: ${o instanceof Error?o.message:o}`);await new Promise(s=>setTimeout(s,500*2**r))}}async function ke(e,t,n,r,o={}){let s=o.fetchFn??fetch,i=await e.start(t),a=n.reduce((d,b)=>d+b.len,0),g=new Array(n.length),c=0,u=0,_=new Map,p=async d=>(_.has(d)||(await e.partUrls(t,i,d+1,Math.min(100,n.length-d))).forEach((F,A)=>_.set(d+A,F)),_.get(d)),w=async d=>{let b=n[d];if(b.kind==="copy")g[d]=await ut(`copy piece ${d+1}`,()=>e.copyPart(t,i,d+1,{key:b.key,offset:b.offset,length:b.len}));else{let F=await r(b.at,b.len);g[d]=await ut(`upload piece ${d+1}`,async()=>{let A=await p(d),v=await s(A.upload_url,{method:A.method,headers:A.headers,body:F,signal:o.signal});if(!v.ok)throw _.delete(d),new Error(`${v.status} ${(await v.text()).slice(0,200)}`);let W=v.headers.get("etag");if(!W)throw new Error("the bucket returned no ETag (expose it in the bucket's CORS / response headers)");return W})}c+=b.len,o.onProgress?.(c,a)};try{await Promise.all(Array.from({length:Math.min(6,n.length)},async()=>{for(;u<n.length;)o.signal?.throwIfAborted(),await w(u++)})),await ut("complete",()=>e.complete(t,i,g.map((d,b)=>({part_number:b+1,etag:d}))))}catch(d){throw await e.abort(t,i).catch(()=>{}),d}return{uploaded:n.filter(d=>d.kind==="upload").reduce((d,b)=>d+b.len,0),copied:n.filter(d=>d.kind==="copy").reduce((d,b)=>d+b.len,0),pieces:n.length}}function Fe(e){let t=Zt(e,"r");return{read:async(n,r)=>{let o=new Uint8Array(r);return await(await t).read(o,0,r,n),o},close:async()=>{await(await t).close()}}}var gt="local",Pt=/^[A-Za-z0-9_-]{1,64}$/,I=e=>{if(!Pt.test(e))throw new j("invalid_args",`bad project_id '${e}'`);return y(R(),"projects",e)},dt=(e,t={})=>lt("v1-projects",e,t),kt=e=>Number(/: (\d{3}) /.exec(String(e?.message))?.[1]??0);async function Ft(e){let t="",n={base:null,by:null};try{t=await S(y(I(e),"CONTEXT.md"))}catch{}try{n=JSON.parse(await S(y(I(e),"context.json")))}catch{}return{text:t,meta:n}}async function _t(e,t,n){await P(I(e)),await T(y(I(e),"CONTEXT.md"),t),await T(y(I(e),"context.json"),JSON.stringify(n))}var ft=async(e,t)=>(await _t(e,t.context,{base:t.context_updated_at,by:t.context_updated_by_name??null}),{text:t.context,updated_at:t.context_updated_at,updated_by:t.context_updated_by_name??null});async function Me(e){I(e);let t=await Ft(e);if(e===gt)return{text:t.text,updated_at:null,updated_by:null};if(t.meta.pending)try{return await Tt(e,t.text,t.meta.base)}catch(n){if(!(n instanceof j&&n.code==="context_conflict"))return{text:t.text,updated_at:t.meta.base,updated_by:t.meta.by,offline:!0,pending:!0};let r=n.data?.current??{context:"",context_updated_at:null},o=`${r.context.trimEnd()}
|
|
4
|
+
|
|
5
|
+
## Saved offline on this machine (merge into the notes above)
|
|
6
|
+
|
|
7
|
+
${t.text.trim()}
|
|
8
|
+
`;return await Tt(e,o,r.context_updated_at).catch(()=>ft(e,r))}try{return await ft(e,(await dt(`/v1/projects/${e}`)).project)}catch(n){if(kt(n))throw n;return{text:t.text,updated_at:t.meta.base,updated_by:t.meta.by,offline:!0}}}async function Tt(e,t,n){if(I(e),e===gt)return await _t(e,t,{base:null,by:null}),{text:t,updated_at:null,updated_by:null};let r=await Ft(e),o=n===void 0?r.meta.base:n;try{return await ft(e,(await dt(`/v1/projects/${e}`,{method:"PATCH",body:{context:t,context_base:o}})).project)}catch(s){let i=kt(s);if(i===409){let a=(await dt(`/v1/projects/${e}`)).project;throw new j("context_conflict",`someone saved this project's context${a.context_updated_by_name?` (${a.context_updated_by_name})`:""} since it was read; read it again and save on top of theirs`,{current:a})}if(i)throw s;return await _t(e,t,{...r.meta,base:o,pending:!0}),{text:t,updated_at:o,updated_by:r.meta.by,offline:!0,pending:!0}}}var Ut=()=>y(R(),"current-project.json");async function Ct(){try{let e=JSON.parse(await S(Ut()));return e?.id?e:null}catch{return null}}async function Le(e){await P(R()),await T(Ut(),JSON.stringify(e&&e.id!==gt?e:{}))}async function je(e,t){if(!Pt.test(t))throw new j("invalid_args",`bad session_id '${t}'`);let n=y(I(e),"sessions.json"),r=[];try{r=JSON.parse(await S(n))}catch{}await P(I(e)),await T(n,JSON.stringify([...r.filter(o=>o!==t),t]))}async function $e(e){let t=new Set,n=[];try{n=JSON.parse(await S(y(I(e),"sessions.json")))}catch{}for(let r of n.toReversed())t.add(r);for(let r of await Rt().catch(()=>[]))r.project_id===e&&t.add(r.id);return[...t]}var Qt=R(),L=y(Qt,"sessions"),q=new Map,te=/^[0-9a-f]{8}$/;function K(e,t){if(!te.test(e))throw new Error(`not a session id: ${JSON.stringify(e).slice(0,40)}`);if(t!==void 0&&!/^[a-z0-9_-]{1,32}$/.test(t))throw new Error(`bad session extra kind: ${t}`);return y(L,t===void 0?`${e}.json`:`${e}.${t}.json`)}function ee(){let e=new Uint8Array(4);return crypto.getRandomValues(e),Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}async function We(e,t,n){let r=new Date().toISOString(),o=await Ct(),s={id:ee(),source_path:t,source_format:n,created_at:r,updated_at:r,history:[],...o?{project_id:o.id}:{},session:e};return q.set(s.id,s),Z=s.id,await Ot(s),s}var Z,He=()=>Z;async function Ge(e){let t=q.get(e);if(t)return Z=e,t;try{let n=await S(K(e)),r=JSON.parse(n);return r.id=e,q.set(e,r),Z=e,r}catch{throw new Error(`unknown session_id '${e}' \u2014 call timeline_read first, or timeline_sessions to list`)}}async function Je(e,t){e.updated_at=new Date().toISOString(),e.history.push(t),q.set(e.id,e),await Ot(e)}async function Rt(){await P(L);let e=[];for await(let t of pt(L))if(!(!t.name.endsWith(".json")||t.name.split(".").length>2))try{let n=JSON.parse(await S(y(L,t.name))),{session:r,...o}=n;e.push(o)}catch{}return e.sort((t,n)=>n.updated_at.localeCompare(t.updated_at))}async function Ot(e){await P(L),await T(K(e.id),JSON.stringify(e))}async function Ve(e,t,n){await P(L),await T(K(e,t),JSON.stringify(n))}async function Xe(e,t){try{return JSON.parse(await S(K(e,t)))}catch{return null}}export{ne as a,oe as b,ie as c,se as d,J as e,It as f,me as g,At as h,we as i,be as j,ct as k,Ae as l,Ee as m,ve as n,Te as o,lt as p,Pe as q,ke as r,Fe as s,gt as t,Me as u,Tt as v,Ct as w,Le as x,je as y,$e as z,We as A,He as B,Ge as C,Je as D,Rt as E,Ve as F,Xe as G};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
+
import{a as F}from"./chunk-PHAMF4JF.js";import{$ as i,A as m,B as v,D as R,E as g,F as D,K as $,Y as k,m as b,s as x,t as p,x as S,z as _}from"./chunk-G3SZDPDS.js";var A="_originalframes",y="zAPPLIED_PATCHES",u=t=>t.replace(/[\\/][^\\/]+[\\/]?$/,""),T=()=>i(b(),"move-undo");async function P(t){let n=[];for await(let a of $(t))a.isFile&&!a.name.startsWith(".")&&n.push(a.name);return n.sort()}async function O(t){let n=[];for await(let a of $(u(t)))a.isDirectory&&/patch/i.test(a.name)&&a.name!==y&&n.push(a.name);return n.sort()}async function C(t,n){let a=new Set(await P(t)),e=[];for(let r of n){let s=i(u(t),r);if(await p(s))for(let w of await P(s))e.push({file:w,folder:r,replaces:a.has(w)})}return e}async function j(t,n,a){if(!await p(t)||!(await x(t)).isDirectory)throw new F("invalid_args",`not a folder: ${t}`);let e=u(t),r=[],s=[];for(let o of await C(t,n)){if(a&&!a.has(`${o.folder}/${o.file}`))continue;if(!o.replaces){r.push(`${o.file}: not in the sequence`);continue}let f=i(t,o.file),c=i(e,o.folder,o.file),l=`${t}${A}`,d=i(l,o.file);for(let h=1;await p(d);h++)d=i(`${t}${A}${String(h).padStart(2,"0")}`,o.file);await m(u(d));try{await g(f,d)}catch(h){r.push(`${o.file}: ${h.message}`);continue}try{await R(c,f)}catch(h){await g(d,f).catch(()=>{}),r.push(`${o.file}: ${h.message}`);continue}s.push({file:o.file,backup:d,patch_src:c,applied:c,folder:o.folder}),l=""}let w=[];if(s.length){let o=i(e,y);await m(o);for(let f of new Set(s.map(c=>c.folder))){let c=i(o,f);for(let l=1;await p(c);l++)c=i(o,`${f}_${l}`);try{await g(i(e,f),c),w.push({from:i(e,f),to:c});for(let l of s)l.folder===f&&(l.applied=i(c,l.file))}catch(l){r.push(`${f}: not filed under ${y} (${l.message})`)}}}if(!s.length)return{patched:0,errors:r};let E=`files-${Date.now().toString(36)}`;return await m(T()),await _(i(T(),`${E}.json`),JSON.stringify({patch:!0,sequence:t,entries:s.map(({folder:o,...f})=>f),folders:w})),{patched:s.length,errors:r,undo_id:E}}async function J(t){let n=[];for(let e of t.folders)await p(e.to)&&!await p(e.from)&&await g(e.to,e.from).catch(r=>n.push({path:e.to,error:r.message}));let a=0;for(let e of t.entries){let r=i(t.sequence,e.file);if(await p(e.backup))try{await p(r)&&await v(r),await g(e.backup,r),a++}catch(s){n.push({path:r,error:s.message})}}for(let e of new Set([...t.entries.map(r=>u(r.backup)),...t.folders.map(r=>u(r.to))]))if(await p(e)&&!(await P(e)).length){let r=!0;for await(let s of $(e)){r=!1;break}r&&await D(e).catch(()=>{})}return{restored:a,failed:n}}var L=t=>k(t),U=async t=>JSON.parse(await S(t));export{A as a,y as b,O as c,C as d,j as e,J as f,L as g,U as h};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
+
import{Tb as D,Ub as F,Vb as N}from"./chunk-LYM757KG.js";import{i as j}from"./chunk-NXJZXXC2.js";import{$ as _,A as M,D as C,F as R,G as T,J as q,K as L,N as w,Y as b,_ as k,ba as I,g as y,m as O,r as S,s as A,t as x,u as P,x as H,z as E}from"./chunk-G3SZDPDS.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};
|
|
@@ -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 o,b as l,c,d as m,e as d,f as h,g as f,i as v,j as w,k as y}from"./chunk-QTFFVLVJ.js";var S=class extends h{async evalCodeAsync(e,t="eval.js",s){let i=s===void 0?1:0,n=d(s),r=0;try{r=await this.memory.newHeapCharPointer(e).consume(a=>this.ffi.QTS_Eval_MaybeAsync(this.ctx.value,a.value.ptr,a.value.strlen,t,i,n))}catch(a){throw this.runtime.debugLog("QTS_Eval_MaybeAsync threw",a),a}let u=this.ffi.QTS_ResolveException(this.ctx.value,r);return u?(this.ffi.QTS_FreeValuePointer(this.ctx.value,r),this.fail(this.memory.heapValueHandle(u))):this.success(this.memory.heapValueHandle(r))}newAsyncifiedFunction(e,t){return this.newFunction(e,t)}},x=class extends f{constructor(e){super(e)}newContext(e={}){let t=m(e.intrinsics),s=new l(this.ffi.QTS_NewContext(this.rt.value,t),void 0,n=>{this.contextMap.delete(n),this.callbacks.deleteContext(n),this.ffi.QTS_FreeContext(n)}),i=new S({module:this.module,ctx:s,ffi:this.ffi,rt:this.rt,ownedLifetimes:[],runtime:this,callbacks:this.callbacks});return this.contextMap.set(s.value,i),i}setModuleLoader(e,t){super.setModuleLoader(e,t)}setMaxStackSize(e){return super.setMaxStackSize(e)}},k=class extends y{constructor(e,t){super(e,t),this.ffi=t,this.module=e}newRuntime(e={}){let t=new l(this.ffi.QTS_NewRuntime(),void 0,i=>{this.callbacks.deleteRuntime(i),this.ffi.QTS_FreeRuntime(i)}),s=new x({module:this.module,ffi:this.ffi,rt:t,callbacks:this.callbacks});return v(s,e),e.moduleLoader&&s.setModuleLoader(e.moduleLoader),s}newContext(e={}){let t=this.newRuntime(),s=e.ownedLifetimes?e.ownedLifetimes.concat([t]):[t],i=t.newContext({...e,ownedLifetimes:s});return t.context=i,i}evalCode(){throw new o("QuickJSWASMModuleAsyncify.evalCode: use evalCodeAsync instead")}evalCodeAsync(e,t){return c.withScopeAsync(async s=>{let i=s.manage(this.newContext());w(i.runtime,t);let n=await i.evalCodeAsync(e,"eval.js");if(t.memoryLimitBytes!==void 0&&i.runtime.setMemoryLimit(-1),n.error)throw i.dump(s.manage(n.error));return i.dump(s.manage(n.value))})}};export{k as a};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
+
import{$ as c,A as P,D as p,N as w,a as h,m as C,n as v,t as u,x as y,z as m}from"./chunk-G3SZDPDS.js";import"./chunk-PSANHDZM.js";var b="conformtools-statusline";function O(e,n){let t=e.statusLine;return t&&!String(t.command??"").includes(b)?{settings:e,result:"kept"}:t?.command===n?{settings:e,result:"updated"}:{settings:{...e,statusLine:{type:"command",command:n,padding:0}},result:t?"updated":"installed"}}async function _(){let e=new URL(import.meta.url),n=h(new URL("./statusline.js",e));if(await u(n)){await P(C());let s=c(C(),`${b}.js`);return await p(n,s),`node "${s}"`}let t=h(new URL("../adapters/statusline.ts",e));return await u(t)?`deno run --allow-read --allow-env --no-check "${t}" ${b}`:null}function A(e,n){let t=e.permissions&&typeof e.permissions=="object"?e.permissions:{},s=Array.isArray(t.allow)?t.allow.filter(o=>typeof o=="string"):[];return s.includes(n)?{settings:e,added:!1}:{settings:{...e,permissions:{...t,allow:[...s,n]}},added:!0}}async function T(e={}){let n=e.server??"conformtools",t=`mcp__${n}`,s=e.settingsPath??c(v(),".claude","settings.json"),o={};if(await u(s)){let r=await y(s);try{o=r.trim()?JSON.parse(r):{}}catch(d){throw new Error(`${s} is not valid JSON (${d instanceof Error?d.message:d}); fix it first, nothing was changed`)}}let a=A(o,t),i=a.settings,l="skipped",f=a.added,R=e.statusline===!1?null:await _();if(R){let r=O(i,R);i=r.settings,l=r.result}let k;(f||l==="installed"||l==="updated"&&i!==a.settings)&&(await u(s)?(k=`${s}.conformtools-backup`,await p(s,k)):await Deno.mkdir(c(s,".."),{recursive:!0}),await m(s,JSON.stringify(i,null,2)+`
|
|
4
|
+
`));let g="skipped",x;if(e.register!==!1)try{let r=await w("claude",["mcp","get",n]),d=r.code===0&&r.stdout.includes("conformtools@latest")&&!r.stdout.includes("--prefer-online");if(r.code===0&&!d)g="already";else{d&&await w("claude",["mcp","remove","-s","user",n]);let $=await w("claude",["mcp","add","-s","user",n,"--","npx",...S]);g=$.code===0?d?"updated":"added":"failed",$.code!==0&&(x=$.stderr.trim().slice(-300))}}catch(r){g="failed",x=`claude CLI not found (${r instanceof Error?r.message:r}); add the server with: claude mcp add -s user ${n} -- npx ${S.join(" ")}`}return{settings:s,rule:t,added:f,backup:k,registered:g,detail:x,statusline:l}}function U(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); every new session runs the newest version",updated:"MCP server: registered again so every new session runs the newest version (it was set up to keep a cached copy)",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
|
+
`)}var S=["-y","--prefer-online","conformtools@latest","mcp"],L='args = ["-y", "conformtools@latest", "mcp"]',j=e=>`[mcp_servers.${e}]
|
|
6
|
+
command = "npx"
|
|
7
|
+
args = ${JSON.stringify(S).replace(/","/g,'", "')}
|
|
8
|
+
`;async function D(e={}){let n=e.server??"conformtools",t=e.configPath??c(v(),".codex","config.toml"),s=await u(t)?await y(t):"",o=new RegExp(`^\\s*\\[mcp_servers\\.(?:"${n}"|${n})\\][^\\n]*(?:\\n(?!\\s*\\[)[^\\n]*)*`,"m").exec(s);if(o){if(!o[0].includes(L))return{config:t,registered:"already"};let i=`${t}.conformtools-backup`;await p(t,i);let l=j(n).split(`
|
|
9
|
+
`).find(f=>f.startsWith("args = "));return await m(t,s.slice(0,o.index)+o[0].replace(L,l)+s.slice(o.index+o[0].length)),{config:t,registered:"updated",backup:i}}let a;return s?(a=`${t}.conformtools-backup`,await p(t,a)):await Deno.mkdir(c(t,".."),{recursive:!0}),await m(t,`${s}${s&&!s.endsWith(`
|
|
10
|
+
`)?`
|
|
11
|
+
`:""}${s?`
|
|
12
|
+
`:""}${j(n)}`),{config:t,registered:"added",backup:a}}function E(e){return[e.registered==="added"?`Codex: conform.tools MCP server added to ${e.config}${e.backup?` (backup: ${e.backup})`:""}; every new session runs the newest version`:e.registered==="updated"?`Codex: conform.tools in ${e.config} set to run the newest version on every start${e.backup?` (backup: ${e.backup})`:""}`:`Codex: conform.tools is already in ${e.config}`,"Restart Codex to load it."].join(`
|
|
13
|
+
`)}export{S as LAUNCH_ARGS,j as codexTable,E as codexText,T as setupClaude,D as setupCodex,U as setupText,A as withAllowRule,O as withStatusLine};
|
package/dist/cli.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
import{
|
|
3
|
+
import{h as F,i as G,l as V,m as Y}from"./chunk-QTA36RVO.js";import"./chunk-XF3YMBI7.js";import"./chunk-YU3SUSK3.js";import"./chunk-QTFFVLVJ.js";import"./chunk-5YULBQJX.js";import"./chunk-OMPYIH6F.js";import"./chunk-NMH62JSC.js";import"./chunk-SJ56EEFP.js";import"./chunk-2CY2OOOJ.js";import"./chunk-XVRTAKDK.js";import{P as W,Tc as J,Uc as H}from"./chunk-LYM757KG.js";import"./chunk-IN6XVTUS.js";import"./chunk-DFQWQ3EA.js";import"./chunk-PFZVET7S.js";import"./chunk-6V4OEOOX.js";import"./chunk-NXJZXXC2.js";import{a as A}from"./chunk-B77ADB26.js";import"./chunk-JKOB3U54.js";import"./chunk-EEDLRRKU.js";import"./chunk-WJ5EWXP2.js";import"./chunk-YUO3UWPH.js";import"./chunk-JV7TZDKJ.js";import"./chunk-RGMTLNMF.js";import"./chunk-XDI6CPPV.js";import"./chunk-P3XI63Q2.js";import"./chunk-F4PHKOAS.js";import"./chunk-ISKNIQVO.js";import"./chunk-DKGGJM6Z.js";import"./chunk-THVX57I3.js";import"./chunk-LVGGCRDW.js";import"./chunk-C2ESM27Z.js";import"./chunk-D6YDLKSA.js";import"./chunk-UUXHJNQA.js";import"./chunk-N34DQ6MH.js";import{b as L}from"./chunk-NU3X7P4N.js";import"./chunk-DPA26AOI.js";import"./chunk-VJN4UXFJ.js";import{e as D,f as I}from"./chunk-6NLB5TZ2.js";import"./chunk-64X5DLH5.js";import"./chunk-PHAMF4JF.js";import{b as T,e as l,f as i}from"./chunk-G3SZDPDS.js";import"./chunk-PSANHDZM.js";var c=process.stdout,R=22,E=20,C=E/2,B=(t,n)=>Math.abs(n)<=Math.min(1-.417*Math.abs(t),2.393*(1-Math.abs(t))),et=(t,n)=>t*t+n*n<=1;function rt(t){let n=.62**-t,m=[];for(let r=0;r<E;r++){let a=[];for(let s=0;s<R;s++){let w=(s+.5)/R*2-1,f=(r+.5)/E*2-1,h=!1;if(B(w,f))for(let x=0;x<6;x++)for(let $ of[!1,!0]){let p=.62**x*($?.77:1)*n,y=.5*Math.max(0,1-p)**2;($?et:B)(w/p,(f-y)/p)&&(h=!$)}a.push(h)}m.push(a)}return m}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"]},K="CONFORM.TOOLS",st=[...K].reduce((t,n)=>t+M[n][0].length+1,-1);async function q(t){if(!c.isTTY)return!1;let n=!!T("NO_COLOR"),m=/truecolor|24bit/i.test(T("COLORTERM")??""),r=o=>e=>n?e:`\x1B[${o}m${e}\x1B[0m`,a=r(m?"38;2;255;60;0":"38;5;202"),s=r(m?"38;2;255;222;0":"38;5;220"),w=r("1"),f=r("2"),h=(c.columns??80)>=R+4+st,x=o=>[...K].map(e=>e==="."?a(M[e][o]):w(M[e][o])).join(" "),$=(o,e)=>h&&o>=2&&o<=5?x(o-2):!h&&o===3?`${w("conform")}${a(".")}${w("tools")}`:o===7?e:"",p=(o,e,O=[])=>{let S=rt(o),_=[];for(let g=0;g<C;g++){let tt=S[2*g].map((N,nt)=>{let k=S[2*g+1][nt];return N&&k?"\u2588":N?"\u2580":k?"\u2584":" "}).join(""),ot=g>=8?O[g-8]??"":"";_.push(` ${a(tt)} ${ot||$(g,e)}\x1B[K`)}return _.join(`
|
|
4
4
|
`)+`
|
|
5
|
-
`},
|
|
6
|
-
`),
|
|
7
|
-
`);return
|
|
8
|
-
`),!0}var
|
|
5
|
+
`},y=null;t.account.then(o=>{y=o});let P=o=>L(o,24),X=!T("CI")&&T("TERM")!=="dumb";if(c.write(`
|
|
6
|
+
`),X){let o=()=>c.write("\x1B[?25h");process.once("SIGINT",()=>{o(),process.exit(130)}),c.write("\x1B[?25l"+p(0,s(`\u25B6 ${P(0)}`)));let e=Date.now(),O=0;for(;y===null||Date.now()-e<900;)await new Promise(S=>setTimeout(S,1e3/24)),O=Math.round((Date.now()-e)*24/1e3),c.write(`\x1B[${C}A\r`+p(O/22%1,`${s(`\u25B6 ${P(O)}`)} ${f("checking your account\u2026")}`));c.write(`\x1B[${C}A\r`),o()}let Z=(y??await t.account).split(`
|
|
7
|
+
`);return c.write(p(0,`${f("v")}${t.version} ${f("\xB7 built by post pros")}`,Z.map(o=>f(o)))),c.write(`
|
|
8
|
+
`),!0}var Q=()=>q({version:A,account:Promise.race([D().catch(()=>null),new Promise(t=>setTimeout(t,1500,null))]).then(t=>t?I(t):"account: no answer (offline?)")}),it={login:"account_login",logout:"account_logout",whoami:"account_status",status:"account_status",telemetry:"account_telemetry"};l()[0]==="mcp"&&(await import("./mcp.js"),await new Promise(()=>{}));l()[0]==="http"&&(await import("./http.js"),await new Promise(()=>{}));l()[0]==="statusline"&&((await import("./statusline-GMMCFMOA.js")).main(),i(0));if(l()[0]==="setup"){let t=l()[1];t!=="claude"&&t!=="codex"&&(console.error(`conformtools setup <client>: supported: claude, codex${t?` (not ${t} yet)`:""}`),i(2));let{setupClaude:n,setupText:m,setupCodex:r,codexText:a}=await import("./claude-setup-REU4AOKX.js");try{console.log(t==="codex"?a(await r()):m(await n())),i(0)}catch(s){console.error(s instanceof Error?s.message:String(s)),i(1)}}H("cli");var z=l().includes("--json"),[u,v]=l().filter(t=>t!=="--json");if(!u||u==="--list"||u==="help"||u==="--help"){await Q(),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)
|
|
12
12
|
mcp run as an MCP server (stdio) for Claude Code, Cursor, Codex\u2026
|
|
13
13
|
http run the local HTTP API on 127.0.0.1:7791
|
|
14
|
-
`);let t=
|
|
15
|
-
(on conform.tools) = the timeline is read or written by conform.tools; the file and its media stay here`),
|
|
14
|
+
`);let t=W()==="hosted";for(let n of V)console.log(` ${n.name.padEnd(22)} ${n.title}${t&&n.protectedStages?.length?" (on conform.tools)":""}`);t&&console.log(`
|
|
15
|
+
(on conform.tools) = the timeline is read or written by conform.tools; the file and its media stay here`),i(0)}var d=it[u]??u,ct=Y(d);ct||(console.error(`unknown verb '${u}' \u2014 conformtools --list`),i(2));d==="account_login"&&console.error("opening the browser to sign in to conform.tools\u2026");var at=d==="account_telemetry"&&v&&!v.trim().startsWith("{")?JSON.stringify({action:v.trim()}):v,U;try{U=JSON.parse(at??"{}")}catch{console.error(`arguments must be JSON, e.g. conformtools ${u} '{"path":"\u2026"}'`),i(2)}var j=G(d,U),b=j.ok?await F(d,j.data):j.result;d==="account_login"&&!b.isError&&!z&&await Q()||console.log(z?JSON.stringify(b.structuredContent??{ok:!b.isError,text:b.content.map(t=>t.text).join(`
|
|
16
16
|
`)},null,1):b.content.map(t=>t.text).join(`
|
|
17
|
-
`));await J();
|
|
17
|
+
`));await J();i(b.isError?1:0);
|