conformtools 0.6.27 → 0.6.29

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 (57) hide show
  1. package/dist/{account-RSL4PTDB.js → account-F4ODJBD2.js} +1 -1
  2. package/dist/{agent-hook-setup-IACTYSVL.js → agent-hook-setup-KBCGZNEE.js} +1 -1
  3. package/dist/{analysis-engine-BBOSGAB2.js → analysis-engine-LGB4OXG7.js} +1 -1
  4. package/dist/{bridge-42OMO43V.js → bridge-GLW34YZF.js} +1 -1
  5. package/dist/browser/timeline_core_bg.wasm +0 -0
  6. package/dist/{chunk-2DMNGWC2.js → chunk-7DH6DFYL.js} +1 -1
  7. package/dist/{chunk-XLRQNFJU.js → chunk-BZE7IP6U.js} +91 -91
  8. package/dist/{chunk-TGLH2JDW.js → chunk-FHCRWOI7.js} +1 -1
  9. package/dist/{chunk-NRURUPLU.js → chunk-GDPYFRSV.js} +1 -1
  10. package/dist/chunk-H3FD5KA2.js +7 -0
  11. package/dist/{chunk-BIX5ETBY.js → chunk-HHOFGYZ7.js} +1 -1
  12. package/dist/{chunk-YMRK5D3X.js → chunk-HZBGG7HI.js} +1 -1
  13. package/dist/{chunk-AR5BTVBM.js → chunk-KD7UGCLT.js} +1 -1
  14. package/dist/{chunk-2X2SFPWD.js → chunk-NTPDZOPF.js} +1 -1
  15. package/dist/chunk-QDL3XYOE.js +545 -0
  16. package/dist/chunk-QQBDHVUU.js +3 -0
  17. package/dist/chunk-RKJML7MH.js +10 -0
  18. package/dist/{chunk-T4B4Y5WQ.js → chunk-RVKNGIE3.js} +2 -2
  19. package/dist/{chunk-3KS3547B.js → chunk-SSFG7FNI.js} +1 -1
  20. package/dist/{chunk-UXEL636C.js → chunk-UXVABU6B.js} +1 -1
  21. package/dist/{chunk-6BL5HE4S.js → chunk-WJS6NM7T.js} +1 -1
  22. package/dist/{chunk-RL5XRG6O.js → chunk-WWE2FXAQ.js} +1 -1
  23. package/dist/{chunk-HNEKQMQG.js → chunk-YJREJ2MH.js} +1 -1
  24. package/dist/{chunk-JZCADV5C.js → chunk-ZE7BP4AE.js} +1 -1
  25. package/dist/{claude-setup-6RMV3QZM.js → claude-setup-FYWGYBTH.js} +1 -1
  26. package/dist/cli.js +2 -2
  27. package/dist/demo-engine-5HWLXPDJ.js +3 -0
  28. package/dist/{engine-I2NXY2OK.js → engine-LFB243Q6.js} +2 -2
  29. package/dist/{framing-PHFTZ4GL.js → framing-KHUFARKE.js} +1 -1
  30. package/dist/gfx-worker.js +1 -1
  31. package/dist/h264-QGSP23K2.js +3 -0
  32. package/dist/{h264-mxf-PKSTGNGH.js → h264-mxf-I4YANT5F.js} +1 -1
  33. package/dist/{host-relink-FHOEDE76.js → host-relink-L7I75SUH.js} +1 -1
  34. package/dist/{hosted-26GUD7IU.js → hosted-5Y5VX6X6.js} +1 -1
  35. package/dist/hosts-QMGBN2E6.js +3 -0
  36. package/dist/http.js +2 -2
  37. package/dist/{inspect-RT36GEVU.js → inspect-GP6B6UPD.js} +2 -2
  38. package/dist/{isobmff-65LRNCQH.js → isobmff-LAXAYC7P.js} +1 -1
  39. package/dist/{mc-video-2PCAX65A.js → mc-video-KQ7TP4DG.js} +1 -1
  40. package/dist/mcp.js +7 -7
  41. package/dist/{media-OXHZ3PGZ.js → media-SUPBJX64.js} +1 -1
  42. package/dist/{mxf-WFJNAX7D.js → mxf-2TQO552L.js} +1 -1
  43. package/dist/{ops-SH3IUU2Z.js → ops-CVKPID5Z.js} +1 -1
  44. package/dist/{probe-VB6JH6ZJ.js → probe-HUPB4H4G.js} +1 -1
  45. package/dist/{r3d-X2O5LUAB.js → r3d-EPSGIBPT.js} +1 -1
  46. package/dist/resolve-bridge.py +4 -1
  47. package/dist/{sequence-patch-OHYBBKKZ.js → sequence-patch-GXM3QSJC.js} +1 -1
  48. package/dist/{store-F2CTSR6E.js → store-K4W2LVRN.js} +1 -1
  49. package/dist/{timeline-AK6DUMWB.js → timeline-HTG23FEH.js} +1 -1
  50. package/package.json +5 -5
  51. package/dist/chunk-E4KQR4M3.js +0 -10
  52. package/dist/chunk-IDADYIY6.js +0 -7
  53. package/dist/chunk-M6SVZJAX.js +0 -537
  54. package/dist/chunk-ZPIY5DOU.js +0 -3
  55. package/dist/demo-engine-ITZ7VG6Q.js +0 -3
  56. package/dist/h264-TVMYQ7EB.js +0 -3
  57. package/dist/hosts-DXH4SQPZ.js +0 -3
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{a as L}from"./chunk-6BL5HE4S.js";import{B as O,C as R,E as W,F as I,da as P,o as _,t as H,z as N}from"./chunk-ZPIY5DOU.js";import X from"node:http";import{connect as Y}from"node:net";import{createHash as M,randomBytes as U}from"node:crypto";import{Buffer as d}from"node:buffer";var j="258EAFA5-E914-47DA-95CA-C5AB0DC85B11";function A(a,e,c=!1){let n=e.length,r=c?128:0,s=n<126?d.from([128|a,r|n]):n<65536?d.from([128|a,r|126,n>>8,n&255]):(()=>{let o=d.alloc(10);return o[0]=128|a,o[1]=r|127,o.writeBigUInt64BE(BigInt(n),2),o})();if(!c)return d.concat([s,d.from(e)]);let t=U(4),i=d.from(e);for(let o=0;o<i.length;o++)i[o]^=t[o&3];return d.concat([s,t,i])}function D(a,e,c,n=!1){let r=d.alloc(0),s=[],t=0,i=!1,o=[],p=[],u=()=>{i||(i=!0,p.forEach(l=>l()))},f=(l=1e3,m="")=>{if(i)return;let h=d.from(m),g=d.alloc(2+h.length);g.writeUInt16BE(l,0),h.copy(g,2);try{a.write(A(8,g,n))}catch{}a.end(),u()};return a.on("data",l=>{for(r=d.concat([r,l]);r.length>=2;){let m=(r[0]&128)!==0,h=r[0]&15,g=(r[1]&128)!==0,v=r[1]&127,w=2;if(v===126){if(r.length<4)return;v=r.readUInt16BE(2),w=4}else if(v===127){if(r.length<10)return;let b=r.readBigUInt64BE(2);if(b>BigInt(c))return f(1009,"too big");v=Number(b),w=10}if(g===n)return f(1002,n?"server frames must not be masked":"client frames must be masked");if(v>c||t+v>c)return f(1009,"message too big");let E=g?4:0;if(r.length<w+E+v)return;let S=d.from(r.subarray(w+E,w+E+v));if(g){let b=r.subarray(w,w+4);for(let x=0;x<S.length;x++)S[x]^=b[x&3]}if(r=r.subarray(w+E+v),h===8)return f(1e3);if(h===9){a.write(A(10,S,n));continue}if(h!==10){if(h===1||h===0){if(s.push(S),t+=S.length,m){let b=d.concat(s).toString("utf8");s=[],t=0,o.forEach(x=>x(b))}continue}return f(1003,"text frames only")}}}),a.on("close",u),a.on("error",u),{origin:e,send:l=>{i||a.write(A(1,d.from(l,"utf8"),n))},close:f,onMessage:l=>{o.push(l)},onClose:l=>{p.push(l)}}}function J(a,e){let c=new Set,n=X.createServer((r,s)=>{let t=n.address();a.onHttp?.(r,s,typeof t=="object"&&t?t.port:a.port)||(s.writeHead(426,{"content-type":"text/plain"}),s.end("websocket only"))});return n.on("upgrade",(r,s)=>{let t=r.headers["sec-websocket-key"];if(r.url?.split("?")[0]!==a.path||typeof t!="string"||String(r.headers.upgrade).toLowerCase()!=="websocket"){s.end(`HTTP/1.1 400 Bad Request\r
3
+ import{a as L}from"./chunk-WJS6NM7T.js";import{C as O,D as R,F as W,G as I,ea as P,o as _,t as H,z as N}from"./chunk-QQBDHVUU.js";import X from"node:http";import{connect as Y}from"node:net";import{createHash as M,randomBytes as U}from"node:crypto";import{Buffer as d}from"node:buffer";var j="258EAFA5-E914-47DA-95CA-C5AB0DC85B11";function A(a,e,c=!1){let n=e.length,r=c?128:0,s=n<126?d.from([128|a,r|n]):n<65536?d.from([128|a,r|126,n>>8,n&255]):(()=>{let o=d.alloc(10);return o[0]=128|a,o[1]=r|127,o.writeBigUInt64BE(BigInt(n),2),o})();if(!c)return d.concat([s,d.from(e)]);let t=U(4),i=d.from(e);for(let o=0;o<i.length;o++)i[o]^=t[o&3];return d.concat([s,t,i])}function D(a,e,c,n=!1){let r=d.alloc(0),s=[],t=0,i=!1,o=[],p=[],u=()=>{i||(i=!0,p.forEach(l=>l()))},f=(l=1e3,m="")=>{if(i)return;let h=d.from(m),g=d.alloc(2+h.length);g.writeUInt16BE(l,0),h.copy(g,2);try{a.write(A(8,g,n))}catch{}a.end(),u()};return a.on("data",l=>{for(r=d.concat([r,l]);r.length>=2;){let m=(r[0]&128)!==0,h=r[0]&15,g=(r[1]&128)!==0,v=r[1]&127,w=2;if(v===126){if(r.length<4)return;v=r.readUInt16BE(2),w=4}else if(v===127){if(r.length<10)return;let b=r.readBigUInt64BE(2);if(b>BigInt(c))return f(1009,"too big");v=Number(b),w=10}if(g===n)return f(1002,n?"server frames must not be masked":"client frames must be masked");if(v>c||t+v>c)return f(1009,"message too big");let E=g?4:0;if(r.length<w+E+v)return;let S=d.from(r.subarray(w+E,w+E+v));if(g){let b=r.subarray(w,w+4);for(let x=0;x<S.length;x++)S[x]^=b[x&3]}if(r=r.subarray(w+E+v),h===8)return f(1e3);if(h===9){a.write(A(10,S,n));continue}if(h!==10){if(h===1||h===0){if(s.push(S),t+=S.length,m){let b=d.concat(s).toString("utf8");s=[],t=0,o.forEach(x=>x(b))}continue}return f(1003,"text frames only")}}}),a.on("close",u),a.on("error",u),{origin:e,send:l=>{i||a.write(A(1,d.from(l,"utf8"),n))},close:f,onMessage:l=>{o.push(l)},onClose:l=>{p.push(l)}}}function J(a,e){let c=new Set,n=X.createServer((r,s)=>{let t=n.address();a.onHttp?.(r,s,typeof t=="object"&&t?t.port:a.port)||(s.writeHead(426,{"content-type":"text/plain"}),s.end("websocket only"))});return n.on("upgrade",(r,s)=>{let t=r.headers["sec-websocket-key"];if(r.url?.split("?")[0]!==a.path||typeof t!="string"||String(r.headers.upgrade).toLowerCase()!=="websocket"){s.end(`HTTP/1.1 400 Bad Request\r
4
4
  \r
5
5
  `);return}let i=M("sha1").update(t+j).digest("base64");s.write(`HTTP/1.1 101 Switching Protocols\r
6
6
  Upgrade: websocket\r
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{c as le,d as ue,g as pe,h as fe,i as de}from"./chunk-VZ3XYHK4.js";import{a as me}from"./chunk-HNEKQMQG.js";import{a as s}from"./chunk-E75BCWXY.js";import{B as T,C as R,D as re,E as O,F as oe,O as ie,R as ae,V as se,W as ce,b as c,da as l,h as y,i as te,o as h,p as b,v as ne,z as _}from"./chunk-ZPIY5DOU.js";var Be=["pro","studio","enterprise"],gt=e=>Be.includes((e??"").toLowerCase()),ge=["align","reconform","conform-reference"],he=["autobalance"],Fe={transferGB:2e3},g={payg:{id:"payg",name:"Pay As You Go",includes:{web:!0,mcp:!1,app:!1,studio_tools:!1}},web:{id:"web",name:"Indie",unlisted:!0,includes:{web:!0,mcp:!1,app:!1,studio_tools:!1},allowance:{transferGB:50}},indie:{id:"indie",name:"Pro",popular:!0,includes:{web:!0,mcp:!0,app:!0,studio_tools:!1},allowance:{transferGB:250}},pro:{id:"pro",name:"Studio",includes:{web:!0,mcp:!0,app:!0,studio_tools:!0},allowance:{transferGB:1e3}},studio:{id:"studio",name:"Enterprise",includes:{web:!0,mcp:!0,app:!0,studio_tools:!0},allowance:Fe}},_e={web:!0,mcp:!0,app:!0,studio_tools:!0};import{AsyncLocalStorage as xe}from"node:async_hooks";var M=()=>{throw new Error("this build has no local engine \u2014 timelines are read and written on conform.tools")};function we(e,t){return M()}function ye(e,t){return M()}function be(e){return M()}var Ge=new xe;function B(e){let t=Ge.getStore();if(!t||t.declared.includes(e))return;let n=`verb '${t.verb}' reached the protected stage '${e}' without declaring it in protectedStages (core/verbs.ts)`;if(c("CONFORM_STRICT_STAGES")==="1")throw new s("internal",n);console.error(`[conform] warning: ${n}`)}var F=!1,ze=new xe;function J(){let e=ze.getStore();if(e==="hosted")return"hosted";if(e==="local"){if(!!1)throw new s("unsupported","offline conversion needs the app's own engine (this build converts on conform.tools)");return"local"}return c("CONFORM_ENGINE")==="hosted"||!!1?"hosted":"local"}async function vt(e){return B("canonicalize"),J()==="local"?await we(e.fmt,e.data):await ve(e.fmt,e.file)}async function St(e,t){return B("write"),J()==="local"?await ye(e,t):await Se(e,t)}async function xt(e){if(J()!=="local")return null;B("canonicalize");let t=JSON.parse(await be(JSON.stringify(e)));return{session:t.session,issues:t.issues??[]}}import{createPrivateKey as Et,createPublicKey as Ke,sign as At,verify as We}from"node:crypto";import{Buffer as v}from"node:buffer";var He="CONFORMTOOLS_LICENSE_V1",ke=/^[0-9A-F]{8}(-[0-9A-F]{8}){3}$/,Oe=e=>JSON.stringify({dev_mode:e.dev_mode??!1,email:e.email,expires_at:e.expires_at,features:e.features,issued_at:e.issued_at,machine_fingerprint:e.machine_fingerprint,tier:e.tier});function Ee(e){let t=e.split(/\r?\n/).map(r=>r.trim()).filter(r=>r&&!r.startsWith("#")&&!r.startsWith("-----")).join(""),n=JSON.parse(v.from(t,"base64").toString("utf8"));if(n?.magic!==He||!n.payload?.data)throw new Error("not a conform.tools licence");return n.payload}function Ae(e,t){let n=v.from(e.signature,"base64"),r=v.from(Oe(e.data));return n.length!==64?!1:t.some(o=>We(null,r,Ke({key:v.concat([v.from("302a300506032b6570032100","hex"),v.from(o)]),format:"der",type:"spki"}),n))}var Ye=["cMwVBrEYKMzlG6pC7FF2lNKIoEqGz2xB5yph6clNnTg=","qnheqkkDU09l1oI6h2CFh4uQ97bY/hkTA5niGKH0+X8="],qe=Ye.map(e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)));function N(){let e=c("CONFORM_RECORDS_DIR");if(e)return e;let t=b(),n=y()==="darwin"?l(t,"Library/Application Support"):y()==="win32"?c("LOCALAPPDATA")??l(t,"AppData/Local"):c("XDG_DATA_HOME")??l(t,".local/share");return l(n,"conform.tools")}var Ve=()=>c("CONFORM_LICENSE_PATH")??l(N(),"license.lic"),$=()=>l(N(),"grant.lic"),Xe=null;function I(){return Xe??=(async()=>{let e=await me();if(!e)return[];let t=await ae(e,["machine"],{timeoutMs:15e3}).catch(()=>null);try{return JSON.parse(t?.stdout??"").machines.filter(n=>ke.test(n))}catch{return[]}})()}function Ze(e,t,n=Date.now()){if(!Ae(e,qe))return{ok:!1,reason:"invalid licence signature"};let r=Date.parse(e.data.expires_at);return!Number.isFinite(r)||r<n?{ok:!1,reason:`licence expired ${e.data.expires_at}`}:[t??[]].flat().includes(e.data.machine_fingerprint)?{ok:!0,data:e.data}:{ok:!1,reason:"licence is for another machine"}}async function Pe(){let e;try{e=await _(Ve())}catch{return null}try{return Ze(Ee(e),await I())}catch(t){return{ok:!1,reason:t.message}}}var Qe={production:{supabaseUrl:"https://sttpwvjbpsetzbhrkohl.supabase.co",anonKey:"sb_publishable_cyuIPsrQa5Ye7lqFxjnknQ_ozDuwwzp",appBase:"https://conform.tools"},staging:{supabaseUrl:"https://slxggvbvgzkiwojcgykx.supabase.co",anonKey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InNseGdndmJ2Z3praXdvamNneWt4Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzEyODUzMTksImV4cCI6MjA4Njg2MTMxOX0.b18iDsWftny0k9VmOCcbN6kLlyZsZ7GULn_jRH9CE9I",appBase:"https://beta.conform.tools"}};function a(){let e=c("CONFORM_ENV")==="staging"?"staging":"production",t=Qe[e];return{env:e,supabaseUrl:c("CONFORM_SUPABASE_URL")??t.supabaseUrl,anonKey:c("CONFORM_SUPABASE_ANON_KEY")??t.anonKey,appBase:c("CONFORM_APP_BASE")??t.appBase}}var et=600*1e3,Te=72*3600*1e3,tt=300*1e3,S=()=>l(h(),a().env==="production"?"auth.json":`auth-${a().env}.json`);async function x(){for(let e of new Set([S(),l(h(),"auth.json")]))try{let t=JSON.parse(await _(e));if(t.env===a().env&&t.access_token)return t}catch{}return await rt()}var nt=()=>{let e=y()==="win32"?c("APPDATA")??l(b(),"AppData","Roaming"):y()==="darwin"?l(b(),"Library","Application Support"):c("XDG_CONFIG_HOME")??l(b(),".config");return l(e,"conform-tools","kv-store.json")};async function rt(){let e=nt();try{let t=JSON.parse(await _(e)),n=JSON.parse(t["ct-supabase-auth"]??"null");if(!n?.access_token||!n.refresh_token)return null;let r=n.access_token.split(".")[1].replace(/-/g,"+").replace(/_/g,"/");if(JSON.parse(atob(r+"=".repeat(-r.length&3))).iss!==`${a().supabaseUrl}/auth/v1`)return null;let i={env:a().env,access_token:n.access_token,refresh_token:n.refresh_token,expires_at:n.expires_at??0};return await L(i),delete t["ct-supabase-auth"],await T(e,JSON.stringify(t)),i}catch{return null}}async function ot(){try{for await(let e of ie(h())){if(!/^auth(?:-(\w+))?\.json$/.exec(e.name))continue;let n=JSON.parse(await _(l(h(),e.name)));if(n.access_token&&n.env&&n.env!==a().env)return{other_env:n.env}}}catch{}return{}}async function L(e){await R(h()),await T(S(),JSON.stringify(e)),await oe(S(),384)}var z=6e3,P=0,K=()=>Date.now()<P,$e=()=>{P=Date.now()+6e4};function Bt(){P=0}var Ie=e=>e.expires_at-60>Date.now()/1e3;async function G(e){let t=await x();return t&&t.refresh_token!==e.refresh_token&&Object.assign(e,t),Ie(e)}async function W(e){if(Ie(e))return e.access_token;if(K())return null;if(await G(e))return e.access_token;let t=await re(`${S()}.lock`);try{if(await G(e))return e.access_token;let n=a(),r=await fetch(`${n.supabaseUrl}/auth/v1/token?grant_type=refresh_token`,{method:"POST",headers:{apikey:n.anonKey,"content-type":"application/json"},body:JSON.stringify({refresh_token:e.refresh_token}),signal:AbortSignal.timeout(z)}).catch(i=>{throw $e(),i});if(!r.ok)return r.status!==400&&r.status!==401?null:await G(e)?e.access_token:"";let o=await r.json();return e.access_token=o.access_token,o.refresh_token&&(e.refresh_token=o.refresh_token),e.expires_at=o.expires_at??Math.floor(Date.now()/1e3)+(o.expires_in??3600),await L(e),e.access_token}catch{return null}finally{await t()}}async function Ft(){return(await x().catch(()=>null))?.last_entitlement?.model_key??null}async function Jt(){return(await H()).token}async function H(e="conform.tools"){let t=await x();if(!t)return m=null,{token:null,error:new s("not_signed_in",`${e}: not signed in to conform.tools \u2014 run account_login`)};let n=await W(t);return n?{token:n,error:null}:n===""?(m=null,{token:null,error:new s("not_signed_in",`${e}: the sign-in expired or was revoked \u2014 sign in again (account_login)`)}):{token:null,error:new s("offline",`${e}: couldn't reach conform.tools to renew the sign-in (no answer, or the server was busy). You are still signed in; it retries by itself \u2014 check the network if it keeps happening.`)}}var m=null;function Ne(e,t){return{signed_in:!0,entitled:e.entitled,env:a().env,email:e.email,access:e.access,tier:e.tier,trial_days_remaining:e.trial_days_remaining,source:t,...e.entitled?{}:{reason:"not_entitled"},...e.invite_only?{invite_only:!0}:{},...e.dev?{dev:!0}:{}}}async function Y(e={}){let t=await Pe();if(t?.ok)return{signed_in:!!await x().catch(()=>null),entitled:!0,env:a().env,email:t.data.email,access:"licence",tier:t.data.tier,source:"licence"};let n=await it(e);return t&&!n.entitled?{...n,licence_error:t.reason}:n}async function it(e){if(!e.force&&m&&Date.now()-m.at<et)return{...m.status,source:"cache"};let t=a(),n=await x();if(!n)return{signed_in:!1,entitled:!1,env:t.env,reason:"not_signed_in",...await ot()};let r=await W(n);if(r==="")return{signed_in:!0,entitled:!1,env:t.env,reason:"auth_rejected"};if(r&&!K())try{let o=(await I())[0],i=await fetch(`${t.supabaseUrl}/functions/v1/v1-billing/v1/billing/entitlement${o?`?machine=${o}`:""}`,{headers:{authorization:`Bearer ${r}`,apikey:t.anonKey},signal:AbortSignal.timeout(z)}).catch(u=>{throw $e(),u});if(i.status===401||i.status===403)return{signed_in:!0,entitled:!1,env:t.env,reason:"auth_rejected"};if(i.ok){let{grant:u,...p}=(await i.json()).data;o&&await at(u),n.last_entitlement=p,n.last_entitlement_at=Date.now(),await L(n);let f=Ne(p,"live");return m={at:Date.now(),status:f},f}}catch{}if(n.last_entitlement&&n.last_entitlement_at&&Date.now()-n.last_entitlement_at<Te){let o=Te-(Date.now()-n.last_entitlement_at);return{...Ne(n.last_entitlement,"grace"),grace_remaining_h:Math.round(o/36e4)/10}}return{signed_in:!0,entitled:!1,env:t.env,reason:"offline_grace_expired"}}async function at(e){try{if(!e)return await O($());await R(N()),await T($(),e)}catch{}}function st(e){return e.source==="licence"?`${e.email} \xB7 machine licence (${e.tier}) \u2014 runs offline, no account check`:ct(e)+(e.licence_error?`
3
+ import{c as le,d as ue,g as pe,h as fe,i as de}from"./chunk-VZ3XYHK4.js";import{a as me}from"./chunk-YJREJ2MH.js";import{a as s}from"./chunk-E75BCWXY.js";import{C as T,D as R,E as re,F as O,G as oe,P as ie,S as ae,W as se,X as ce,b as c,ea as l,h as y,i as te,o as h,p as b,v as ne,z as _}from"./chunk-QQBDHVUU.js";var Be=["pro","studio","enterprise"],gt=e=>Be.includes((e??"").toLowerCase()),ge=["align","reconform","conform-reference"],he=["autobalance","p2p","p2p-send","receive"],Fe={transferGB:2e3},g={payg:{id:"payg",name:"Pay As You Go",includes:{web:!0,mcp:!1,app:!1,studio_tools:!1}},web:{id:"web",name:"Indie",unlisted:!0,includes:{web:!0,mcp:!1,app:!1,studio_tools:!1},allowance:{transferGB:50}},indie:{id:"indie",name:"Pro",popular:!0,includes:{web:!0,mcp:!0,app:!0,studio_tools:!1},allowance:{transferGB:250}},pro:{id:"pro",name:"Studio",includes:{web:!0,mcp:!0,app:!0,studio_tools:!0},allowance:{transferGB:1e3}},studio:{id:"studio",name:"Enterprise",includes:{web:!0,mcp:!0,app:!0,studio_tools:!0},allowance:Fe}},_e={web:!0,mcp:!0,app:!0,studio_tools:!0};import{AsyncLocalStorage as xe}from"node:async_hooks";var M=()=>{throw new Error("this build has no local engine \u2014 timelines are read and written on conform.tools")};function we(e,t){return M()}function ye(e,t){return M()}function be(e){return M()}var Ge=new xe;function B(e){let t=Ge.getStore();if(!t||t.declared.includes(e))return;let n=`verb '${t.verb}' reached the protected stage '${e}' without declaring it in protectedStages (core/verbs.ts)`;if(c("CONFORM_STRICT_STAGES")==="1")throw new s("internal",n);console.error(`[conform] warning: ${n}`)}var F=!1,ze=new xe;function J(){let e=ze.getStore();if(e==="hosted")return"hosted";if(e==="local"){if(!!1)throw new s("unsupported","offline conversion needs the app's own engine (this build converts on conform.tools)");return"local"}return c("CONFORM_ENGINE")==="hosted"||!!1?"hosted":"local"}async function vt(e){return B("canonicalize"),J()==="local"?await we(e.fmt,e.data):await ve(e.fmt,e.file)}async function St(e,t){return B("write"),J()==="local"?await ye(e,t):await Se(e,t)}async function xt(e){if(J()!=="local")return null;B("canonicalize");let t=JSON.parse(await be(JSON.stringify(e)));return{session:t.session,issues:t.issues??[]}}import{createPrivateKey as Et,createPublicKey as Ke,sign as At,verify as We}from"node:crypto";import{Buffer as v}from"node:buffer";var He="CONFORMTOOLS_LICENSE_V1",ke=/^[0-9A-F]{8}(-[0-9A-F]{8}){3}$/,Oe=e=>JSON.stringify({dev_mode:e.dev_mode??!1,email:e.email,expires_at:e.expires_at,features:e.features,issued_at:e.issued_at,machine_fingerprint:e.machine_fingerprint,tier:e.tier});function Ee(e){let t=e.split(/\r?\n/).map(r=>r.trim()).filter(r=>r&&!r.startsWith("#")&&!r.startsWith("-----")).join(""),n=JSON.parse(v.from(t,"base64").toString("utf8"));if(n?.magic!==He||!n.payload?.data)throw new Error("not a conform.tools licence");return n.payload}function Ae(e,t){let n=v.from(e.signature,"base64"),r=v.from(Oe(e.data));return n.length!==64?!1:t.some(o=>We(null,r,Ke({key:v.concat([v.from("302a300506032b6570032100","hex"),v.from(o)]),format:"der",type:"spki"}),n))}var Ye=["cMwVBrEYKMzlG6pC7FF2lNKIoEqGz2xB5yph6clNnTg=","qnheqkkDU09l1oI6h2CFh4uQ97bY/hkTA5niGKH0+X8="],qe=Ye.map(e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)));function N(){let e=c("CONFORM_RECORDS_DIR");if(e)return e;let t=b(),n=y()==="darwin"?l(t,"Library/Application Support"):y()==="win32"?c("LOCALAPPDATA")??l(t,"AppData/Local"):c("XDG_DATA_HOME")??l(t,".local/share");return l(n,"conform.tools")}var Ve=()=>c("CONFORM_LICENSE_PATH")??l(N(),"license.lic"),$=()=>l(N(),"grant.lic"),Xe=null;function I(){return Xe??=(async()=>{let e=await me();if(!e)return[];let t=await ae(e,["machine"],{timeoutMs:15e3}).catch(()=>null);try{return JSON.parse(t?.stdout??"").machines.filter(n=>ke.test(n))}catch{return[]}})()}function Ze(e,t,n=Date.now()){if(!Ae(e,qe))return{ok:!1,reason:"invalid licence signature"};let r=Date.parse(e.data.expires_at);return!Number.isFinite(r)||r<n?{ok:!1,reason:`licence expired ${e.data.expires_at}`}:[t??[]].flat().includes(e.data.machine_fingerprint)?{ok:!0,data:e.data}:{ok:!1,reason:"licence is for another machine"}}async function Pe(){let e;try{e=await _(Ve())}catch{return null}try{return Ze(Ee(e),await I())}catch(t){return{ok:!1,reason:t.message}}}var Qe={production:{supabaseUrl:"https://sttpwvjbpsetzbhrkohl.supabase.co",anonKey:"sb_publishable_cyuIPsrQa5Ye7lqFxjnknQ_ozDuwwzp",appBase:"https://conform.tools"},staging:{supabaseUrl:"https://slxggvbvgzkiwojcgykx.supabase.co",anonKey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InNseGdndmJ2Z3praXdvamNneWt4Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzEyODUzMTksImV4cCI6MjA4Njg2MTMxOX0.b18iDsWftny0k9VmOCcbN6kLlyZsZ7GULn_jRH9CE9I",appBase:"https://beta.conform.tools"}};function a(){let e=c("CONFORM_ENV")==="staging"?"staging":"production",t=Qe[e];return{env:e,supabaseUrl:c("CONFORM_SUPABASE_URL")??t.supabaseUrl,anonKey:c("CONFORM_SUPABASE_ANON_KEY")??t.anonKey,appBase:c("CONFORM_APP_BASE")??t.appBase}}var et=600*1e3,Te=72*3600*1e3,tt=300*1e3,S=()=>l(h(),a().env==="production"?"auth.json":`auth-${a().env}.json`);async function x(){for(let e of new Set([S(),l(h(),"auth.json")]))try{let t=JSON.parse(await _(e));if(t.env===a().env&&t.access_token)return t}catch{}return await rt()}var nt=()=>{let e=y()==="win32"?c("APPDATA")??l(b(),"AppData","Roaming"):y()==="darwin"?l(b(),"Library","Application Support"):c("XDG_CONFIG_HOME")??l(b(),".config");return l(e,"conform-tools","kv-store.json")};async function rt(){let e=nt();try{let t=JSON.parse(await _(e)),n=JSON.parse(t["ct-supabase-auth"]??"null");if(!n?.access_token||!n.refresh_token)return null;let r=n.access_token.split(".")[1].replace(/-/g,"+").replace(/_/g,"/");if(JSON.parse(atob(r+"=".repeat(-r.length&3))).iss!==`${a().supabaseUrl}/auth/v1`)return null;let i={env:a().env,access_token:n.access_token,refresh_token:n.refresh_token,expires_at:n.expires_at??0};return await L(i),delete t["ct-supabase-auth"],await T(e,JSON.stringify(t)),i}catch{return null}}async function ot(){try{for await(let e of ie(h())){if(!/^auth(?:-(\w+))?\.json$/.exec(e.name))continue;let n=JSON.parse(await _(l(h(),e.name)));if(n.access_token&&n.env&&n.env!==a().env)return{other_env:n.env}}}catch{}return{}}async function L(e){await R(h()),await T(S(),JSON.stringify(e)),await oe(S(),384)}var z=6e3,P=0,K=()=>Date.now()<P,$e=()=>{P=Date.now()+6e4};function Bt(){P=0}var Ie=e=>e.expires_at-60>Date.now()/1e3;async function G(e){let t=await x();return t&&t.refresh_token!==e.refresh_token&&Object.assign(e,t),Ie(e)}async function W(e){if(Ie(e))return e.access_token;if(K())return null;if(await G(e))return e.access_token;let t=await re(`${S()}.lock`);try{if(await G(e))return e.access_token;let n=a(),r=await fetch(`${n.supabaseUrl}/auth/v1/token?grant_type=refresh_token`,{method:"POST",headers:{apikey:n.anonKey,"content-type":"application/json"},body:JSON.stringify({refresh_token:e.refresh_token}),signal:AbortSignal.timeout(z)}).catch(i=>{throw $e(),i});if(!r.ok)return r.status!==400&&r.status!==401?null:await G(e)?e.access_token:"";let o=await r.json();return e.access_token=o.access_token,o.refresh_token&&(e.refresh_token=o.refresh_token),e.expires_at=o.expires_at??Math.floor(Date.now()/1e3)+(o.expires_in??3600),await L(e),e.access_token}catch{return null}finally{await t()}}async function Ft(){return(await x().catch(()=>null))?.last_entitlement?.model_key??null}async function Jt(){return(await H()).token}async function H(e="conform.tools"){let t=await x();if(!t)return m=null,{token:null,error:new s("not_signed_in",`${e}: not signed in to conform.tools \u2014 run account_login`)};let n=await W(t);return n?{token:n,error:null}:n===""?(m=null,{token:null,error:new s("not_signed_in",`${e}: the sign-in expired or was revoked \u2014 sign in again (account_login)`)}):{token:null,error:new s("offline",`${e}: couldn't reach conform.tools to renew the sign-in (no answer, or the server was busy). You are still signed in; it retries by itself \u2014 check the network if it keeps happening.`)}}var m=null;function Ne(e,t){return{signed_in:!0,entitled:e.entitled,env:a().env,email:e.email,access:e.access,tier:e.tier,trial_days_remaining:e.trial_days_remaining,source:t,...e.entitled?{}:{reason:"not_entitled"},...e.invite_only?{invite_only:!0}:{},...e.dev?{dev:!0}:{}}}async function Y(e={}){let t=await Pe();if(t?.ok)return{signed_in:!!await x().catch(()=>null),entitled:!0,env:a().env,email:t.data.email,access:"licence",tier:t.data.tier,source:"licence"};let n=await it(e);return t&&!n.entitled?{...n,licence_error:t.reason}:n}async function it(e){if(!e.force&&m&&Date.now()-m.at<et)return{...m.status,source:"cache"};let t=a(),n=await x();if(!n)return{signed_in:!1,entitled:!1,env:t.env,reason:"not_signed_in",...await ot()};let r=await W(n);if(r==="")return{signed_in:!0,entitled:!1,env:t.env,reason:"auth_rejected"};if(r&&!K())try{let o=(await I())[0],i=await fetch(`${t.supabaseUrl}/functions/v1/v1-billing/v1/billing/entitlement${o?`?machine=${o}`:""}`,{headers:{authorization:`Bearer ${r}`,apikey:t.anonKey},signal:AbortSignal.timeout(z)}).catch(u=>{throw $e(),u});if(i.status===401||i.status===403)return{signed_in:!0,entitled:!1,env:t.env,reason:"auth_rejected"};if(i.ok){let{grant:u,...p}=(await i.json()).data;o&&await at(u),n.last_entitlement=p,n.last_entitlement_at=Date.now(),await L(n);let f=Ne(p,"live");return m={at:Date.now(),status:f},f}}catch{}if(n.last_entitlement&&n.last_entitlement_at&&Date.now()-n.last_entitlement_at<Te){let o=Te-(Date.now()-n.last_entitlement_at);return{...Ne(n.last_entitlement,"grace"),grace_remaining_h:Math.round(o/36e4)/10}}return{signed_in:!0,entitled:!1,env:t.env,reason:"offline_grace_expired"}}async function at(e){try{if(!e)return await O($());await R(N()),await T($(),e)}catch{}}function st(e){return e.source==="licence"?`${e.email} \xB7 machine licence (${e.tier}) \u2014 runs offline, no account check`:ct(e)+(e.licence_error?`
4
4
  (the machine licence was not used: ${e.licence_error})`:"")}function ct(e){let t=a();if(!e.signed_in)return`not signed in (${t.env})${e.other_env?`; you are signed in to ${e.other_env} only (each server keeps its own sign-in)`:""}. Run the account_login tool, or \`npx -y conformtools@latest login\` in a terminal.`;if(e.reason==="auth_rejected")return"signed-in session was rejected (expired or revoked) \u2014 sign in again with account_login.";if(e.reason==="offline_grace_expired")return"offline for more than 72 h since the last account check \u2014 reconnect and run account_status.";let n=`${e.email??"(unknown email)"} \xB7 ${t.env}`;if(!e.entitled&&e.invite_only)return`${n}
5
5
  the conform.tools engine (the MCP and the app) is invite-only for now, and ${e.email??"this account"} is not on the list. If that is the wrong Google account, run account_logout, then account_login with the invited one.`;if(!e.entitled)return`${n}
6
6
  no active plan on ${e.email??"this account"}: the MCP is in the ${g.indie.name} plan and up. If that is the wrong Google account, run account_logout, then account_login and pick the account with the plan; otherwise choose a plan at ${t.appBase}/pricing, then run account_status.`;let r=e.access==="trial"?`trial, ${e.trial_days_remaining??"?"} day(s) left`:e.access==="allowlist"?"invited (early access)":`subscribed${e.tier?` (${q(e.tier)})`:""}`,o=D(e),i=o?` \xB7 includes ${[o.web&&"the web tools",o.mcp&&"the MCP",o.app&&"the app"].filter(Boolean).join(", ")||"the web tools"}`:"";return`${n}
@@ -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{Bb as L,Cb as A,Db as E,Eb as P,Fb as T,Gb as M,Hb as N,Ib as D,Jb as z,Kb as B,Lb as I,ob as S}from"./chunk-XLRQNFJU.js";import{a as b}from"./chunk-E75BCWXY.js";import{aa as p,u as R}from"./chunk-ZPIY5DOU.js";async function W(r,t){let c=t.media_root?[t.media_root]:await z();if(!c.length)throw new b("invalid_args","no media_root given and no remembered locations \u2014 pass the folder to link from");for(let e of c)try{if(!(await R(e)).isDirectory)throw 0}catch{throw new b("invalid_args",`media_root is not a folder on this machine: ${e}`)}let i=A(r,{ref_ids:t.ref_ids,lane:t.lane,reset:t.reset});if(!i.length)return{session:r,changed:!1,note:"",text:"nothing in scope: every reference in scope is already linked (use reset=true to re-point) or the ids/lane matched nothing"};if(t.reset)for(let e of i)e.binding_state="unbound",delete e.coverage_reason;let m=[],k=!1,u=[];for(let e of c)if(t.gather==="path")for(let n of i){let l=n.local_path??n.target_url??"",o=l?await P(e,l):null;o?m.push(o):u.push(`${n.id} ${p(l)}: not at its recorded path under ${e}`)}else{let n=await E(e,i,t.cap,{byName:t.criteria?.file_name!==!1,exts:t.criteria?.extensions});m.push(...n.paths),k||=n.capped}let{refs:$,failed:_}=await T([...new Set(m)]);t.remember&&t.media_root&&await B(t.media_root);let y=new Set(i.map(e=>e.id)),f=S(r,$,y);if(f.splits.length){r=f.session;let e=new Set([...y,...f.splits.flatMap(n=>n.into)]);i=(r.media_references??[]).filter(n=>e.has(n.id));for(let n of f.splits){let l=o=>p(i.find(G=>G.id===o)?.target_url??o);u.push(`split ${n.ref_id} across ${n.into.length} section file(s): ${n.into.map(l).join(", ")}`)}}let d=L(t.criteria),a=M(r,i,$,d,t.tolerances),O=t.criteria?.picture?await N(r,a):[],s=e=>a.rows.filter(n=>n.status===e).length,U=c.map(e=>e.split(/[\\/]/).filter(Boolean).pop()??e).join(", "),v=[`${t.dry_run?"would link":"found"} ${s("matched")} of ${i.length} clip${i.length===1?"":"s"} in ${U}${s("ambiguous")?`, ${s("ambiguous")} with more than one match`:""}${i.length-s("matched")-s("ambiguous")?`, ${i.length-s("matched")-s("ambiguous")} not found there`:""}${t.dry_run?" (dry run: nothing changed)":""}`,`scope: ${i.length} reference(s)${t.lane!=="both"?` (${t.lane} lane)`:""}${t.ref_ids?` (zone of ${t.ref_ids.length})`:""}; gather=${t.gather} under ${c.join(", ")}: ${$.length} candidate clip(s)${k?` (CAPPED at ${t.cap} \u2014 narrow the folder)`:""}`,`criteria: ${[...Object.entries(d).filter(([,e])=>e===!0).map(([e])=>e),...t.criteria?.picture?["picture"]:[]].join(", ")}${d.fileName?` (${d.fileNameMode})`:""}${d.fileExtensions?`; ext ${d.fileExtensions}`:""}; timecode containment + fps always on`,..._.length?[`could not probe ${_.length}: ${_.slice(0,5).join("; ")}`]:[],...u.slice(0,20),...O.slice(0,40)];if(t.dry_run)return{session:r,changed:!1,note:"",text:[...v,I(r,a,{compare:t.compare}),"(dry run \u2014 nothing changed; pass accept=[{ref_id,candidate_id}] to commit chosen rows, or run again without dry_run to apply every matched row)"].join(`
3
+ import{Bb as L,Cb as A,Db as E,Eb as P,Fb as T,Gb as M,Hb as N,Ib as D,Jb as z,Kb as B,Lb as I,ob as S}from"./chunk-BZE7IP6U.js";import{a as b}from"./chunk-E75BCWXY.js";import{ba as p,u as R}from"./chunk-QQBDHVUU.js";async function W(r,t){let c=t.media_root?[t.media_root]:await z();if(!c.length)throw new b("invalid_args","no media_root given and no remembered locations \u2014 pass the folder to link from");for(let e of c)try{if(!(await R(e)).isDirectory)throw 0}catch{throw new b("invalid_args",`media_root is not a folder on this machine: ${e}`)}let i=A(r,{ref_ids:t.ref_ids,lane:t.lane,reset:t.reset});if(!i.length)return{session:r,changed:!1,note:"",text:"nothing in scope: every reference in scope is already linked (use reset=true to re-point) or the ids/lane matched nothing"};if(t.reset)for(let e of i)e.binding_state="unbound",delete e.coverage_reason;let m=[],k=!1,u=[];for(let e of c)if(t.gather==="path")for(let n of i){let l=n.local_path??n.target_url??"",o=l?await P(e,l):null;o?m.push(o):u.push(`${n.id} ${p(l)}: not at its recorded path under ${e}`)}else{let n=await E(e,i,t.cap,{byName:t.criteria?.file_name!==!1,exts:t.criteria?.extensions});m.push(...n.paths),k||=n.capped}let{refs:$,failed:_}=await T([...new Set(m)]);t.remember&&t.media_root&&await B(t.media_root);let y=new Set(i.map(e=>e.id)),f=S(r,$,y);if(f.splits.length){r=f.session;let e=new Set([...y,...f.splits.flatMap(n=>n.into)]);i=(r.media_references??[]).filter(n=>e.has(n.id));for(let n of f.splits){let l=o=>p(i.find(G=>G.id===o)?.target_url??o);u.push(`split ${n.ref_id} across ${n.into.length} section file(s): ${n.into.map(l).join(", ")}`)}}let d=L(t.criteria),a=M(r,i,$,d,t.tolerances),O=t.criteria?.picture?await N(r,a):[],s=e=>a.rows.filter(n=>n.status===e).length,U=c.map(e=>e.split(/[\\/]/).filter(Boolean).pop()??e).join(", "),v=[`${t.dry_run?"would link":"found"} ${s("matched")} of ${i.length} clip${i.length===1?"":"s"} in ${U}${s("ambiguous")?`, ${s("ambiguous")} with more than one match`:""}${i.length-s("matched")-s("ambiguous")?`, ${i.length-s("matched")-s("ambiguous")} not found there`:""}${t.dry_run?" (dry run: nothing changed)":""}`,`scope: ${i.length} reference(s)${t.lane!=="both"?` (${t.lane} lane)`:""}${t.ref_ids?` (zone of ${t.ref_ids.length})`:""}; gather=${t.gather} under ${c.join(", ")}: ${$.length} candidate clip(s)${k?` (CAPPED at ${t.cap} \u2014 narrow the folder)`:""}`,`criteria: ${[...Object.entries(d).filter(([,e])=>e===!0).map(([e])=>e),...t.criteria?.picture?["picture"]:[]].join(", ")}${d.fileName?` (${d.fileNameMode})`:""}${d.fileExtensions?`; ext ${d.fileExtensions}`:""}; timecode containment + fps always on`,..._.length?[`could not probe ${_.length}: ${_.slice(0,5).join("; ")}`]:[],...u.slice(0,20),...O.slice(0,40)];if(t.dry_run)return{session:r,changed:!1,note:"",text:[...v,I(r,a,{compare:t.compare}),"(dry run \u2014 nothing changed; pass accept=[{ref_id,candidate_id}] to commit chosen rows, or run again without dry_run to apply every matched row)"].join(`
4
4
  `)};let h,g=[];if(t.accept?.length){h=[];for(let e of t.accept){let n=a.rows.find(o=>o.ref_id===e.ref_id);n&&(n.candidate?.id===e.candidate_id||n.alternatives.some(o=>o.id===e.candidate_id))?h.push(e):g.push(`${e.ref_id} \u2192 ${e.candidate_id}: not a proposed match or alternative for that reference`)}}else h=a.rows.filter(e=>e.status==="matched"&&e.candidate).map(e=>({ref_id:e.ref_id,candidate_id:e.candidate.id}));let w=D(r,a,h),x=w.session.media_references??[],j=x.filter(e=>i.some(n=>n.id===e.id)&&e.binding_state==="linked").length,q=w.applied,C=x.filter(e=>i.some(n=>n.id===e.id)&&e.binding_state!=="linked").map(e=>` - ${e.id} ${p(e.target_url??"")}: ${e.coverage_reason??(a.rows.find(n=>n.ref_id===e.id)?.status==="ambiguous"?"ambiguous \u2014 pick one with accept":"no file matched")}`),F=[...v,`Linked ${j} of ${i.length}${g.length?`; ${g.length} pick(s) vetoed`:""}`,...q.map(e=>`- ${e.ref_id}: ${p(e.before.path??"?")} \u2192 ${e.after.path}${e.warning?` \u26A0 ${e.warning}`:""}`),...g.map(e=>` \u2717 ${e}`),...C.length?["unresolved:",...C]:[]].join(`
5
5
  `);return{session:w.session,changed:!0,note:`relink ${t.gather} ${c[0]} (${j}/${i.length})`,text:F}}export{W as a};