conformtools 0.6.13 → 0.6.15

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 (77) hide show
  1. package/README.md +6 -1
  2. package/dist/account-W7Z2MYZU.js +3 -0
  3. package/dist/{agent-hook-setup-RTQT5JEN.js → agent-hook-setup-JCIZG3Q3.js} +1 -1
  4. package/dist/{analysis-engine-UWIK7AYB.js → analysis-engine-DCHJHZ7W.js} +1 -1
  5. package/dist/{bridge-PWYOJ7E7.js → bridge-RH3JRSBN.js} +1 -1
  6. package/dist/browser/timeline_core_bg.wasm +0 -0
  7. package/dist/{chunk-LZRCXSUJ.js → chunk-4RA57LTJ.js} +1 -1
  8. package/dist/chunk-63WQRYTJ.js +159 -0
  9. package/dist/chunk-6KEFHHS6.js +10 -0
  10. package/dist/{chunk-4VFDGL4E.js → chunk-7NGS2BN7.js} +1 -1
  11. package/dist/{chunk-BYMCZJBQ.js → chunk-B2KCENY6.js} +1 -1
  12. package/dist/chunk-DLF5AKXT.js +10 -0
  13. package/dist/chunk-FLLB6UZJ.js +7 -0
  14. package/dist/chunk-G7CVRPVA.js +5 -0
  15. package/dist/chunk-HTRW5GX4.js +510 -0
  16. package/dist/chunk-IBIAW6IW.js +6 -0
  17. package/dist/{chunk-G3HBKJ5L.js → chunk-IDJIOKXA.js} +1 -1
  18. package/dist/chunk-OWWXUNJF.js +7 -0
  19. package/dist/{chunk-NZLL44HU.js → chunk-QH5DTYSE.js} +1 -1
  20. package/dist/{chunk-PHAMF4JF.js → chunk-ROGMKTND.js} +2 -2
  21. package/dist/{chunk-H4BU5WA6.js → chunk-TBU2XWFD.js} +1 -1
  22. package/dist/{chunk-6WLSIH2N.js → chunk-UAURERD3.js} +1 -1
  23. package/dist/{chunk-7W5AFZYX.js → chunk-UKXSKFL3.js} +1 -1
  24. package/dist/{chunk-L3HRAIDR.js → chunk-VERTA23P.js} +1 -1
  25. package/dist/{chunk-EP4L2BWV.js → chunk-VETHR2O7.js} +1 -1
  26. package/dist/chunk-X527E5VI.js +3 -0
  27. package/dist/{chunk-4BTTR6U3.js → chunk-XVZ7KJRI.js} +5 -5
  28. package/dist/{claude-setup-NGZ5NDYH.js → claude-setup-CM7G2YSG.js} +8 -8
  29. package/dist/cli.js +2 -2
  30. package/dist/demo-engine-WXNT4Y7S.js +3 -0
  31. package/dist/engine-HXZCA42S.js +5 -0
  32. package/dist/framing-HVUDKTZG.js +3 -0
  33. package/dist/gfx-worker.js +1 -1
  34. package/dist/{h264-JI62TU4W.js → h264-MAUVJTR4.js} +1 -1
  35. package/dist/{h264-mxf-J2QPZO4U.js → h264-mxf-2O4SAUTA.js} +1 -1
  36. package/dist/hook.js +1 -1
  37. package/dist/{host-relink-76CFY32O.js → host-relink-RI3JEY4M.js} +1 -1
  38. package/dist/hosted-2XACQY7J.js +3 -0
  39. package/dist/hosts-QW64CIJU.js +3 -0
  40. package/dist/http.js +3 -3
  41. package/dist/{inspect-U656APGR.js → inspect-NUS3XAJH.js} +2 -2
  42. package/dist/isobmff-MTMGQKLK.js +3 -0
  43. package/dist/{mc-video-LSTKUKNL.js → mc-video-HRZC7HGH.js} +1 -1
  44. package/dist/mcp.js +1 -1
  45. package/dist/{media-XBNKYKB7.js → media-WC4ZVKIL.js} +1 -1
  46. package/dist/{mxf-ZL57VJ3C.js → mxf-J5QHA3VY.js} +1 -1
  47. package/dist/{ops-ZQEQXW2N.js → ops-XIUVNJE2.js} +1 -1
  48. package/dist/probe-GIAKRPFV.js +3 -0
  49. package/dist/{r3d-R4TLYJVE.js → r3d-2PCOFR2Z.js} +1 -1
  50. package/dist/resolve-bridge.py +116 -146
  51. package/dist/{sequence-patch-C2QRIT5V.js → sequence-patch-DFGEAJGB.js} +1 -1
  52. package/dist/{store-JNWELX35.js → store-WZHNO43A.js} +1 -1
  53. package/dist/timeline-NOTHRTAT.js +3 -0
  54. package/package.json +5 -5
  55. package/dist/account-F54SG45Q.js +0 -3
  56. package/dist/chunk-B54TEGMG.js +0 -5
  57. package/dist/chunk-BTS3DFPD.js +0 -7
  58. package/dist/chunk-ERUN634Q.js +0 -6
  59. package/dist/chunk-I2Y2P5NH.js +0 -7
  60. package/dist/chunk-J43UCJ6G.js +0 -4
  61. package/dist/chunk-LKQTE6T5.js +0 -158
  62. package/dist/chunk-LRGA6QJQ.js +0 -514
  63. package/dist/chunk-OD445COC.js +0 -7
  64. package/dist/chunk-XI6XF7FQ.js +0 -3
  65. package/dist/chunk-Y455Y6V4.js +0 -10
  66. package/dist/engine-6ACEWA4S.js +0 -5
  67. package/dist/framing-P5RGN5V3.js +0 -3
  68. package/dist/hosted-L26AGRIY.js +0 -3
  69. package/dist/hosts-TBHEPV6A.js +0 -3
  70. package/dist/isobmff-UISATYUR.js +0 -3
  71. package/dist/nuke/panel/python/Startup/conformtools_nuke_startup.py +0 -44
  72. package/dist/nuke/panel/python/conformtools_nuke/__init__.py +0 -10
  73. package/dist/nuke/panel/python/conformtools_nuke/panel.py +0 -217
  74. package/dist/nuke/panel/python/conformtools_nuke/verbs.py +0 -837
  75. package/dist/probe-ZDX6XNRF.js +0 -3
  76. package/dist/resolve-presets/conform.tools.xml +0 -127
  77. package/dist/timeline-JONFBIA3.js +0 -3
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{a as H}from"./chunk-EP4L2BWV.js";import{a as b}from"./chunk-PHAMF4JF.js";import{A as C,B as F,C as w,D as J,L as K,O as X,S as z,T as Y,aa as o,b as c,g as N,m as u,n as B,t as G,x as d,z as $}from"./chunk-XI6XF7FQ.js";var q={transferGB:2e3},f={payg:{id:"payg",name:"Pay As You Go",monthly:0,yearly:0,stripe:{},includes:{web:!0,mcp:!1,app:!1}},web:{id:"web",name:"Web",monthly:10,yearly:100,stripe:{},includes:{web:!0,mcp:!1,app:!1},allowance:{transferGB:50}},indie:{id:"indie",name:"MCP",monthly:49,yearly:490,stripe:{monthly:"price_1T5XDXJ5lnla0aaLasKq49tm",yearly:"price_1T5XDXJ5lnla0aaL2MdMSuI9"},includes:{web:!0,mcp:!0,app:!1},allowance:{transferGB:250}},pro:{id:"pro",name:"App",monthly:199,yearly:1990,stripe:{monthly:"price_1T5X8oJ5lnla0aaLyNJa93H0",yearly:"price_1T5X8oJ5lnla0aaL3dh7b1el"},includes:{web:!0,mcp:!0,app:!0},allowance:q},studio:{id:"studio",name:"Studio",monthly:"custom",yearly:"custom",stripe:{monthly:"price_1T5X7xJ5lnla0aaLoeE1aBlL",yearly:"price_1T5X7xJ5lnla0aaLeBiYo3Di"},includes:{web:!0,mcp:!0,app:!0},allowance:q}};var V={web:!0,mcp:!1,app:!1};var Oe=Object.fromEntries(Object.values(f).flatMap(e=>Object.values(e.stripe).map(t=>[t,e.id])));import{createPrivateKey as $e,createPublicKey as de,sign as Ce,verify as fe}from"node:crypto";import{Buffer as m}from"node:buffer";var me="CONFORMTOOLS_LICENSE_V1",Z=/^[0-9A-F]{8}(-[0-9A-F]{8}){3}$/,W=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 Q(e){let t=e.split(/\r?\n/).map(r=>r.trim()).filter(r=>r&&!r.startsWith("#")&&!r.startsWith("-----")).join(""),n=JSON.parse(m.from(t,"base64").toString("utf8"));if(n?.magic!==me||!n.payload?.data)throw new Error("not a conform.tools licence");return n.payload}function ee(e,t){let n=m.from(e.signature,"base64"),r=m.from(W(e.data));return n.length!==64?!1:t.some(i=>fe(null,r,de({key:m.concat([m.from("302a300506032b6570032100","hex"),m.from(i)]),format:"der",type:"spki"}),n))}var ge=["cMwVBrEYKMzlG6pC7FF2lNKIoEqGz2xB5yph6clNnTg=","qnheqkkDU09l1oI6h2CFh4uQ97bY/hkTA5niGKH0+X8="],he=ge.map(e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)));function A(){let e=c("CONFORM_RECORDS_DIR");if(e)return e;let t=B(),n=N()==="darwin"?o(t,"Library/Application Support"):N()==="win32"?c("LOCALAPPDATA")??o(t,"AppData/Local"):c("XDG_DATA_HOME")??o(t,".local/share");return o(n,"conform.tools")}var _e=()=>c("CONFORM_LICENSE_PATH")??o(A(),"license.lic"),L=()=>o(A(),"grant.lic"),ye=null;function T(){return ye??=(async()=>{let e=await H();if(!e)return[];let t=await X(e,["machine"],{timeoutMs:15e3}).catch(()=>null);try{return JSON.parse(t?.stdout??"").machines.filter(n=>Z.test(n))}catch{return[]}})()}function we(e,t,n=Date.now()){if(!ee(e,he))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 te(){let e;try{e=await d(_e())}catch{return null}try{return we(Q(e),await T())}catch(t){return{ok:!1,reason:t.message}}}var be={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=be[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 xe=600*1e3,ne=72*3600*1e3,ve=300*1e3,h=()=>o(u(),a().env==="production"?"auth.json":`auth-${a().env}.json`);async function I(){for(let e of new Set([h(),o(u(),"auth.json")]))try{let t=JSON.parse(await d(e));if(t.env===a().env&&t.access_token)return t}catch{}return null}async function Se(){try{for await(let e of K(u())){if(!/^auth(?:-(\w+))?\.json$/.exec(e.name))continue;let n=JSON.parse(await d(o(u(),e.name)));if(n.access_token&&n.env&&n.env!==a().env)return{other_env:n.env}}}catch{}return{}}async function M(e){await C(u()),await $(h(),JSON.stringify(e)),await J(h(),384)}var ie=6e3,v=0,ae=()=>Date.now()<v,oe=()=>{v=Date.now()+6e4};function Xe(){v=0}var se=e=>e.expires_at-60>Date.now()/1e3;async function D(e){let t=await I();return t&&t.refresh_token!==e.refresh_token&&Object.assign(e,t),se(e)}async function ce(e){if(se(e))return e.access_token;if(ae())return null;if(await D(e))return e.access_token;let t=await F(`${h()}.lock`);try{if(await D(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(ie)}).catch(s=>{throw oe(),s});if(!r.ok)return r.status!==400&&r.status!==401?null:await D(e)?e.access_token:"";let i=await r.json();return e.access_token=i.access_token,i.refresh_token&&(e.refresh_token=i.refresh_token),e.expires_at=i.expires_at??Math.floor(Date.now()/1e3)+(i.expires_in??3600),await M(e),e.access_token}catch{return null}finally{await t()}}async function ze(){let e=await I();return e&&await ce(e)||null}var g=null;function re(e,t){return{signed_in:!0,entitled:e.entitled,env:a().env,email:e.email,access:e.access,tier:e.tier,trial_days_remaining:e.trial_days_remaining,source:t,...e.entitled?{}:{reason:"not_entitled"},...e.invite_only?{invite_only:!0}:{}}}async function le(e={}){let t=await te();if(t?.ok)return{signed_in:!!await I().catch(()=>null),entitled:!0,env:a().env,email:t.data.email,access:"licence",tier:t.data.tier,source:"licence"};let n=await ke(e);return t&&!n.entitled?{...n,licence_error:t.reason}:n}async function ke(e){if(!e.force&&g&&Date.now()-g.at<xe)return{...g.status,source:"cache"};let t=a(),n=await I();if(!n)return{signed_in:!1,entitled:!1,env:t.env,reason:"not_signed_in",...await Se()};let r=await ce(n);if(r==="")return{signed_in:!0,entitled:!1,env:t.env,reason:"auth_rejected"};if(r&&!ae())try{let i=(await T())[0],s=await fetch(`${t.supabaseUrl}/functions/v1/v1-billing/v1/billing/entitlement${i?`?machine=${i}`:""}`,{headers:{authorization:`Bearer ${r}`,apikey:t.anonKey},signal:AbortSignal.timeout(ie)}).catch(l=>{throw oe(),l});if(s.status===401||s.status===403)return{signed_in:!0,entitled:!1,env:t.env,reason:"auth_rejected"};if(s.ok){let{grant:l,...S}=(await s.json()).data;i&&await Ae(l),n.last_entitlement=S,n.last_entitlement_at=Date.now(),await M(n);let k=re(S,"live");return g={at:Date.now(),status:k},k}}catch{}if(n.last_entitlement&&n.last_entitlement_at&&Date.now()-n.last_entitlement_at<ne){let i=ne-(Date.now()-n.last_entitlement_at);return{...re(n.last_entitlement,"grace"),grace_remaining_h:Math.round(i/36e4)/10}}return{signed_in:!0,entitled:!1,env:t.env,reason:"offline_grace_expired"}}async function Ae(e){try{if(!e)return await w(L());await C(A()),await $(L(),e)}catch{}}function Le(e){return e.source==="licence"?`${e.email} \xB7 machine licence (${e.tier}) \u2014 runs offline, no account check`:Pe(e)+(e.licence_error?`
4
- (the machine licence was not used: ${e.licence_error})`:"")}function Pe(e){let t=a();if(!e.signed_in)return`not signed in (${t.env})${e.other_env?`; you are signed in to ${e.other_env} only (each server keeps its own sign-in)`:""}. Run the account_login tool, or \`npx -y conformtools@latest login\` in a terminal.`;if(e.reason==="auth_rejected")return"signed-in session was rejected (expired or revoked) \u2014 sign in again with account_login.";if(e.reason==="offline_grace_expired")return"offline for more than 72 h since the last account check \u2014 reconnect and run account_status.";let n=`${e.email??"(unknown email)"} \xB7 ${t.env}`;if(!e.entitled&&e.invite_only)return`${n}
5
- the conform.tools engine (the MCP and the app) is invite-only for now, and ${e.email??"this account"} is not on the list. If that is the wrong Google account, run account_logout, then account_login with the invited one.`;if(!e.entitled)return`${n}
6
- no active plan on ${e.email??"this account"}: the trial has ended and there is no subscription. If that is the wrong Google account, run account_logout, then account_login and pick the account with the plan; otherwise choose a plan at ${t.appBase}/pricing, then run account_status.`;let r=e.access==="trial"?`trial, ${e.trial_days_remaining??"?"} day(s) left`:e.access==="allowlist"?"invited (early access)":`subscribed${e.tier?` (${e.tier})`:""}`,i=P(e),s=i?` \xB7 includes ${[i.web&&"the web tools",i.mcp&&"the MCP",i.app&&"the app"].filter(Boolean).join(", ")||"the web tools"}`:"";return`${n}
7
- ${r}${s}${e.source==="grace"?` \u2014 offline, using the last check (${e.grace_remaining_h} h of grace left)`:""}`}function P(e){if(e.access==="trial")return V;let t=(e.tier??"").toLowerCase();return(t==="enterprise"?f.studio:f[t])?.includes??null}var ue=()=>le();function Ye(e){ue=e}async function pe(){let e=await ue();if(e.entitled)return e;let t=e.signed_in&&e.reason==="not_entitled"?"not_entitled":"not_signed_in";throw new b(t,Le(e),{account:e})}async function He(){let e=await pe();if(e.source==="licence"||P(e)?.mcp!==!1)return e;throw new b("not_entitled",`The conform.tools MCP is in the MCP plan ($${f.indie.monthly}/mo) and up. ${e.access==="trial"?"Your trial":`Your plan${e.tier?` (${e.tier})`:""}`} includes Timeline Exchange and Conform Connect on ${a().appBase}, but not the engine on this machine. Upgrade at ${a().appBase}/pricing, then run account_status.`,{account:e,needs:"mcp"})}async function qe(){let e=await pe();if(e.source==="licence"||P(e)?.app)return e;throw new b("not_entitled",`The conform.tools app is in the App plan ($${f.pro.monthly}/mo). ${e.access==="trial"?"Your trial":`Your plan${e.tier?` (${e.tier})`:""}`} does not include the app${P(e)?.mcp?" \u2014 it includes the conform.tools MCP: use it from Claude, Claude Code or any MCP client":""}. Upgrade at ${a().appBase}/pricing, then reopen the app.`,{account:e,needs:"app"})}var x=null;function Ve(e={}){if(x)return x;let t=a(),n=crypto.randomUUID().replaceAll("-","");return x=new Promise((r,i)=>{let s=!1,l=_=>{s||(s=!0,clearTimeout(k),setTimeout(()=>S.close(),250),x=null,_())},S=Y({hostname:"127.0.0.1",port:0,onListen:async _=>{let y=`${t.appBase}/plugin-auth?client=engine&port=${_}&state=${n}`,p=await z(y);e.onUrl?.(y,p)}},async _=>{let y=new URL(_.url);if(y.pathname!=="/callback")return new Response("not found",{status:404});let p=y.searchParams,U=p.get("access_token")??"",R=p.get("refresh_token")??"",O=!!U&&!!R&&p.get("state")===n;if(O){let j=Number(p.get("expires_at"));await M({env:t.env,access_token:U,refresh_token:R,expires_at:j>0?j:Math.floor(Date.now()/1e3)+3600}),g=null,v=0,le({force:!0}).then(E=>l(()=>r(E)),E=>l(()=>i(E)))}return new Response(Ie(O),{status:O?200:400,headers:{"content-type":"text/html; charset=utf-8"}})}),k=setTimeout(()=>l(()=>i(new b("not_signed_in","sign-in was not completed within 5 minutes"))),e.timeoutMs??ve)}),x}async function Ze(){g=null,v=0,await G(h())&&await w(h()),await w(L()).catch(()=>{});let e=o(u(),"auth.json");try{JSON.parse(await d(e)).env===a().env&&await w(e)}catch{}}function Ie(e){let[t,n]=e?["Connected","You're signed in \u2014 you can close this tab."]:["Sign-in failed","Please try again."];return`<!doctype html><meta charset=utf-8><title>conform.tools</title><body style='font:16px -apple-system,Helvetica,Arial,sans-serif;display:flex;align-items:center;justify-content:center;height:100vh;margin:0;background:#f5f5f7;color:#1d1d1f'><div style='text-align:center'><div style='font-size:22px;font-weight:700'>conform<span style='color:#ff3c00'>.tools</span></div><div style='margin-top:14px;font-size:20px;font-weight:600'>${t}</div><div style='margin-top:6px;color:#6e6e73'>${n}</div></div></body>`}export{a,ie as b,Xe as c,ze as d,le as e,Le as f,P as g,Ye as h,pe as i,He as j,qe as k,Ve as l,Ze as m};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{readFile as S,writeFile as N,appendFile as q,stat as W,readdir as G,mkdir as _,open as U,copyFile as Y,mkdtemp as K,rm as P,chmod as X,rename as B,cp as Q,statfs as V,realpath as Z}from"node:fs/promises";import{execFile as ee,spawn as j}from"node:child_process";import{createHash as te}from"node:crypto";import{createReadStream as re,chmodSync as ne,cpSync as oe,existsSync as E,statSync as M}from"node:fs";import{homedir as se,tmpdir as ie,platform as ae,release as ce,arch as le,totalmem as ue,availableParallelism as de}from"node:os";import{fileURLToPath as F}from"node:url";import me from"node:http";import fe from"node:http2";import f from"node:process";import{Buffer as $}from"node:buffer";import{basename as pe,dirname as ge,join as b,resolve as C,sep as v}from"node:path";import{createRequire as ye}from"node:module";import{basename as kt,dirname as At,extname as St,join as Ut,relative as Ft,resolve as Dt}from"node:path";{let e=globalThis.fetch,t=typeof globalThis.Deno<"u";e&&!t&&(globalThis.fetch=(async(n,o)=>{let r=typeof n=="string"?n:n instanceof URL?n.href:n.url;if(r.startsWith("file:")){let s=await S(F(r)),i=r.endsWith(".wasm")?"application/wasm":"application/octet-stream";return new Response(s,{status:200,headers:{"content-type":i}})}return e(n,o)}))}var h=e=>f.env[e],Me=()=>Number(h("CONFORM_MEMORY_GB")??0)*2**30||ue(),Ce=()=>de(),Ie=()=>f.argv.slice(2),He=e=>f.exit(e),we=()=>f.platform,Ne=()=>h("CONFORM_PYTHON")??(we()==="win32"?"python":"python3"),We=()=>f.arch,z=()=>`${f.platform}-${f.arch}`;function _e(e){try{return b(ge(ye(import.meta.url).resolve(`${be(z())}/package.json`)),e)}catch{return null}}var be=e=>`conformtools-${e==="win32-x64"?"windows-x64":e}`,Be=e=>`${e} is not in this package for ${z()} (conform.tools builds it for darwin-arm64, darwin-x64, linux-x64 and win32-x64)`;function je(){let e=f.versions.deno;return{platform:`${ae()} ${ce()} ${le()}`,runtime:e?`deno ${e}`:`node ${f.version}`}}var he=()=>h("CONFORM_MCP_HOME")??b(A(),".conform-mcp"),A=()=>h("HOME")??se();function ze(e){let t=e.trim();if(t.length>=2&&(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))&&(t=t.slice(1,-1)),/^file:\/\//i.test(t))try{t=F(t)}catch{}return t==="~"?t=A():(t.startsWith("~/")||t.startsWith("~\\"))&&(t=b(A(),t.slice(2))),t&&C(t)+(/[\\/]$/.test(t)&&!/[\\/]$/.test(C(t))?v:"")}async function Le(e,t){let n=await import("node:sqlite").catch(()=>null);if(n?.DatabaseSync){let r=new n.DatabaseSync(e,{readOnly:!0});try{let s=r.prepare(t);return s.setReadBigInts(!0),s.all().map(i=>Object.fromEntries(Object.entries(i).map(([c,a])=>[c,typeof a=="bigint"?Number(a):a])))}finally{r.close()}}let o=await D("sqlite3",["-readonly","-json",e,t]);if(!o.success)throw new Error(`sqlite3 ${pe(e)}: ${o.stderr.trim()||o.stdout.trim()}`);return o.stdout.trim()?JSON.parse(o.stdout):[]}var Je=(e,t)=>e?`${e.replace(/[\\/]+$/,"")}${e.includes("\\")&&!e.includes("/")?"\\":"/"}${t}`:t;function qe(e){let t=F(e),n=t.indexOf(`${v}deno-compile-`);if(n<0||!E(t))return t;let o=t.slice(n+1).split(v).slice(1).join(v),r=b(he(),"bin",o);try{let s=M(t),i=E(r)?M(r):null;return(!i||s.isFile()&&(i.size!==s.size||i.mtimeMs<s.mtimeMs))&&(oe(t,r,{recursive:!0,force:!0}),s.isFile()&&ne(r,493)),r}catch{return t}}var I=null;var x=e=>I?.owns(e)?I:null;async function H(e){let t=await W(e);return{isFile:t.isFile(),isDirectory:t.isDirectory(),size:t.size,mtimeMs:t.mtimeMs}}function R(e){return x(e)?.stat(e,()=>H(e))??H(e)}async function Ge(e){try{return await R(e),!0}catch{return!1}}async function Ye(e){try{return(await R(e)).isFile}catch{return!1}}async function Ke(e){try{return(await R(e)).isDirectory}catch{return!1}}async function Xe(e){x(e)?.guard(e,"read whole file");let t=await S(e);return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}var Qe=e=>S(e,"utf8"),Ve=(e,t)=>N(e,t),Ze=(e,t,n)=>n?.append?q(e,t):N(e,t);async function et(e){await _(e,{recursive:!0})}async function tt(e,t={}){let n=Date.now()+(t.timeoutMs??5e3),o=t.staleMs??15e3;for(;;)try{await _(e);break}catch(r){if(r.code!=="EEXIST")throw r;try{if(Date.now()-(await R(e)).mtimeMs>o){await P(e,{recursive:!0,force:!0});continue}}catch{}if(Date.now()>n)break;await new Promise(s=>setTimeout(s,25))}return()=>P(e,{recursive:!0,force:!0}).catch(()=>{})}var rt=e=>P(e,{force:!0}),nt=(e,t)=>X(e,t).catch(()=>{}),ot=(e,t)=>Y(e,t),st=(e,t)=>B(e,t),it=e=>P(e,{recursive:!0,force:!0}),at=(e,t)=>Q(e,t,{recursive:!0,verbatimSymlinks:!0});async function ct(e){try{let t=await V(e);return Number(t.bavail)*Number(t.bsize)}catch{return null}}async function lt(e){try{return await Z(e)}catch{return null}}var ut=(e="conform-")=>K(b(ie(),e));async function*dt(e){let t=async()=>(await G(e,{withFileTypes:!0})).map(n=>({name:n.name,isFile:n.isFile(),isDirectory:n.isDirectory()}));yield*await(x(e)?.readDir(e,t)??t())}async function mt(e){x(e)?.guard(e,"read bytes");let t=await U(e,"r"),n=(await t.stat()).size;return{path:e,size:n,async readAt(o,r){let s=new Uint8Array(r),i=0;for(;i<r;){let{bytesRead:c}=await t.read(s,i,r-i,o+i);if(!c)break;i+=c}return i===r?s:s.subarray(0,i)},close:()=>t.close()}}async function ft(e){let t=await U(e,"w");return{async writeAt(n,o){let r=0;for(;r<o.length;){let{bytesWritten:s}=await t.write(o,r,o.length-r,n+r);r+=s}},truncate:n=>t.truncate(n),close:()=>t.close()}}var L=(e,t)=>{for(let n of t)x(n)?.guard(n,`${e.split(/[\\/]/).pop()} ${t[0]}`)};function D(e,t,n={}){return L(e,t),new Promise(o=>{ee(e,t,{maxBuffer:1<<30,env:n.env?{...f.env,...n.env}:void 0,timeout:n.timeoutMs},(r,s,i)=>{let c=r?.code??0;o({success:!r,code:c,stdout:String(s),stderr:String(i)})})})}var xe="[Console]::OutputEncoding=[Text.Encoding]::UTF8;$t=@{};Get-Process|?{$_.MainWindowTitle}|%{$t[$_.Id]=$_.MainWindowTitle};ConvertTo-Json -Compress -InputObject @(Get-CimInstance Win32_Process|%{[pscustomobject]@{pid=[int]$_.ProcessId;exe=$_.ExecutablePath;cmd=$_.CommandLine;title=$t[[int]$_.ProcessId]}})";async function pt(){let e=await D("powershell.exe",["-NoProfile","-NonInteractive","-Command",xe],{timeoutMs:3e4});return ve(e.stdout)}function ve(e){let t;try{t=JSON.parse(e.replace(/^/,"").trim()||"[]")}catch{return[]}return(Array.isArray(t)?t:[t]).flatMap(n=>{let o=n??{},r=Number(o.pid);return!Number.isInteger(r)||r<=0?[]:[{pid:r,args:String(o.cmd||o.exe||""),title:typeof o.title=="string"?o.title:""}]})}function gt(e,t,n,o={}){return L(e,t),new Promise((r,s)=>{let i=j(e,t,{env:o.env?{...f.env,...o.env}:void 0,stdio:["ignore","pipe","pipe"]}),c="";i.stdout.on("data",a=>n(a)),i.stderr.on("data",a=>{c+=new TextDecoder().decode(a)}),i.on("error",s),i.on("close",a=>r({code:a,stderr:c})),o.signal?.addEventListener("abort",()=>i.kill(),{once:!0})})}function yt(e,t,n,o){let r=j(e,t,{stdio:["pipe","pipe","pipe"]});r.stdin.on("error",()=>{}),r.stdout.on("data",a=>n(a)),r.stderr.on("data",a=>o?.(new TextDecoder().decode(a)));let s=new Promise(a=>{r.on("close",l=>a(l)),r.on("error",()=>a(null))}),i=[r,r.stdout,r.stderr,r.stdin],c=a=>{for(let l of i)(a?l.ref:l.unref)?.call(l)};return c(!1),{write:a=>new Promise((l,d)=>{r.stdin.write(a,m=>m?d(m):l())}),hold:c,close:()=>{try{r.stdin.end(),r.kill()}catch{}},exited:s}}async function wt(e){if(h("CONFORM_NO_BROWSER"))return!1;let[t,n]=f.platform==="darwin"?["open",[e]]:f.platform==="win32"?["cmd",["/c","start","",e.replace(/&/g,"^&")]]:["xdg-open",[e]];return(await D(t,n)).success}function bt(e,t){let n=me.createServer(async(o,r)=>{try{let s=[];if(o.method!=="GET"&&o.method!=="HEAD")for await(let m of o)s.push(m);let i=s.length>0,c=new Headers;for(let[m,p]of Object.entries(o.headers))p!=null&&c.set(m,Array.isArray(p)?p.join(", "):p);let a=`http://${o.headers.host??`${e.hostname}:${e.port}`}${o.url??"/"}`,l=new AbortController;r.on("close",()=>{r.writableEnded||l.abort()});let d=await t(new Request(a,{method:o.method,headers:c,body:i?$.concat(s):void 0,signal:l.signal}));if(r.statusCode=d.status,d.headers.forEach((m,p)=>r.setHeader(p,m)),d.body&&d.headers.get("content-type")?.startsWith("text/event-stream")){r.flushHeaders();let m=d.body.getReader();for(l.signal.addEventListener("abort",()=>void m.cancel(),{once:!0});;){let{value:p,done:g}=await m.read();if(g)break;r.write(p)}r.end();return}r.end($.from(await d.arrayBuffer()))}catch(s){r.statusCode=500,r.end(JSON.stringify({ok:!1,code:"internal",message:s instanceof Error?s.message:String(s)}))}});return n.listen(e.port,e.hostname,()=>{let o=n.address();e.onListen?.(typeof o=="object"&&o?o.port:e.port)}),{close:()=>n.close()}}var y=class extends Error{constructor(n,o,r){super(o);this.code=n;this.grpcStatus=r}};function ht(e,t,n,o,r){return new Promise((s,i)=>{let c=fe.connect(`http://${e}:${t}`),a=!1,l=(u,J)=>{a||(a=!0,clearTimeout(m),c.destroy(),u?i(u):s(J))},d=!1;c.on("connect",()=>{d=!0});let m=setTimeout(()=>l(d?new y("deadline",`no answer from ${e}:${t} in ${r} ms`):new y("unavailable",`${e}:${t}: no connection in ${r} ms`)),r);c.on("error",u=>l(new y("unavailable",`${e}:${t}: ${u.message}`)));let p=$.alloc(5+o.length);p.writeUInt32BE(o.length,1),p.set(o,5);let g=c.request({":method":"POST",":path":n,"content-type":"application/grpc",te:"trailers"}),O=[],w,k="",T=u=>{u["grpc-status"]!=null&&(w=String(u["grpc-status"]),k=decodeURIComponent(String(u["grpc-message"]??"")))};g.on("response",T),g.on("trailers",T),g.on("data",u=>O.push(u)),g.on("error",u=>l(new y("unavailable",`${e}:${t}: ${u.message}`))),g.on("end",()=>{if(w!=="0")return l(new y("grpc",`grpc-status ${w??"missing"}${k?`: ${k}`:""}`,w==null?void 0:Number(w)));let u=$.concat(O);if(u.length<5||u[0]!==0)return l(new y("grpc","reply is not one uncompressed gRPC message"));l(null,new Uint8Array(u.subarray(5,5+u.readUInt32BE(1))))}),g.end(p)})}async function xt(e){let t=te("sha256");for await(let n of re(e))t.update(n);return t.digest("hex")}async function vt(e,t,n){let o=`${t}.part`;for(let r=0;;r++){let s=0;try{s=(await W(o)).size}catch{}try{let i=await fetch(e,{headers:s?{Range:`bytes=${s}-`}:{}});if(i.status===416)break;if(!i.ok||!i.body)throw new Error(`${e} answered ${i.status}`);s&&i.status!==206&&(s=0);let c=s+Number(i.headers.get("content-length")??0),a=await U(o,s?"a":"w");try{let l=s;for await(let d of i.body)await a.write(d),l+=d.length,n?.(l,c)}finally{await a.close()}break}catch(i){if(r>=4)throw i;await new Promise(c=>setTimeout(c,2e3*(r+1)))}}await B(o,t)}function Pt(e){let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}export{F as a,h as b,Me as c,Ce as d,Ie as e,He as f,we as g,Ne as h,We as i,_e as j,Be as k,je as l,he as m,A as n,ze as o,Le as p,Je as q,qe as r,R as s,Ge as t,Ye as u,Ke as v,Xe as w,Qe as x,Ve as y,Ze as z,et as A,tt as B,rt as C,nt as D,ot as E,st as F,it as G,at as H,ct as I,lt as J,ut as K,dt as L,mt as M,ft as N,D as O,pt as P,gt as Q,yt as R,wt as S,bt as T,y as U,ht as V,xt as W,vt as X,Pt as Y,kt as Z,At as _,St as $,Ut as aa,Ft as ba,Dt as ca};
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{a as R}from"./chunk-PFZVET7S.js";import{b as he,c as be,f as ge}from"./chunk-6V4OEOOX.js";import{f as J,h as fe}from"./chunk-XDI6CPPV.js";import{a as pe}from"./chunk-7W5AFZYX.js";import{i as C}from"./chunk-LZRCXSUJ.js";import{b as D,d as K,f as M}from"./chunk-NU3X7P4N.js";import{Ia as de,ea as se,fa as ae,ja as ce,oa as le,wa as ue,xa as me}from"./chunk-DPA26AOI.js";import{a as ie}from"./chunk-PHAMF4JF.js";import{$ as L,A as j,F as W,L as v,M as A,N as ne,Q as oe,Z as b,_ as y,aa as _,b as E,c as Z,d as Q,g as q,j as ee,k as re,r as I,s as H,u as te,v as O,y as B}from"./chunk-XI6XF7FQ.js";var V=!1;var F=8,Pe=0,Ee=3,z=2;async function Oe(e){let t=new Uint8Array(await e.slice(0,16).arrayBuffer()),o=s=>String.fromCharCode(t[s],t[s+1],t[s+2],t[s+3]);if(t[0]===6&&t[1]===14&&t[2]===43&&t[3]===52)return"mxf";if(o(4)==="RED1"||o(4)==="RED2")return"r3d";let r=t[0]<<24|t[1]<<16|t[2]<<8|t[3],i=o(4);return/^[A-Za-z0-9 ]{4}$/.test(i)&&(r>=8||r===1)&&r<=e.size?"isobmff":null}function Ae(e){let t=e.toLowerCase();return t.endsWith(".braw")?"braw":t.endsWith(".crm")?"crm":"mov"}function Ce(e){return async(t,o)=>new Uint8Array(await e.slice(t,Math.min(t+o,e.size)).arrayBuffer())}function we(e){let t=e.timecode;return!t||!t.fps_denominator?null:t.fps_numerator/t.fps_denominator}async function ir(e){return await de(),_e?_e.clip(e,V?"rec709":"",()=>ye(e)):ye(e)}var _e=null;async function ye(e){let t=await Oe(e),o=[];if(t==="r3d"){let r=e,i=r.parts&&r.bases?r.parts:[{name:e.name,size:e.size}],n=r.bases??[0],s=async(u,m,d)=>{let f=n[u]+m;return new Uint8Array(await e.slice(f,Math.min(f+d,n[u]+i[u].size)).arrayBuffer())},a=JSON.stringify(i.map(u=>({name:u.name,size:u.size}))),c=JSON.parse(await me(s,a)),l=JSON.parse(await ce(s,a));return i.length===1&&/_\d{3}\.r3d$/i.test(e.name)&&!/_001\.r3d$/i.test(e.name)&&o.push("spanned R3D part \u2014 only this part's frames are indexed"),{frames:l.map(u=>({offset:n[u.part??0]+u.essenceOffset,size:u.essenceLength})),w:c.width??0,h:c.height??0,fps:we(c),startFrame:c.timecode?.start_frame??0,dropFrame:c.timecode?.drop_frame??!1,label:"R3D",spec:{codec:"r3d",subbands:Pe},geometrySpec:{codec:"r3d",subbands:Ee},index:null,warnings:o}}if(t==="mxf"){let r=Ce(e),i=JSON.parse(await ue(r,e.size));if(!i)throw new Error(`${e.name}: MXF index unreadable`);let n=JSON.parse(await le(r,e.size)),s=[];for(let f=0;f<n.frame_count;f++)s.push({offset:n.frames[f*2],size:n.frames[f*2+1]});let a=s.filter(f=>f.size===0).length;a&&o.push(`${a} frame(s) had no locatable picture KLV`);let c=i.width??0,l=i.height??0,u=(i.inner_codec??"").toLowerCase(),m=null,d="MXF";return u==="arriraw"?(m={codec:"arriraw",w:c,h:l,scale:F},d="ARRIRAW"):u==="xocn"?(m={codec:"xocn",scale:F,...V?{display:"rec709"}:{}},d="X-OCN"):await ae(r,e.size)?(m={codec:"vc3",scale:F},d="DNxHR"):await se(r,e.size)?(m={codec:"prores"},d="ProRes"):o.push(`MXF inner codec ${u||"unknown"} not wired to the fingerprint pool`),{frames:m?s:[],w:c,h:l,fps:we(i),startFrame:i.timecode?.start_frame??0,dropFrame:i.timecode?.drop_frame??!1,label:d,spec:m,geometrySpec:m&&m.codec==="arriraw"?{...m,scale:z}:m&&m.codec==="xocn"?{codec:"xocn",scale:z,...V?{display:"rec709"}:{}}:m&&m.codec==="vc3"?{codec:"vc3",scale:z}:null,index:null,warnings:o}}if(t==="isobmff"){let r=await fe(e),i=Ae(e.name);if(r.kind==="prores")return{frames:r.offs,w:r.w,h:r.h,fps:r.fps,startFrame:r.startFrame,dropFrame:r.dropFrame,label:J(r.kind),spec:{codec:"prores"},geometrySpec:null,index:r,warnings:o};if(r.kind==="h264"||r.kind==="hevc")return{frames:r.offs,w:r.w,h:r.h,fps:r.fps,startFrame:r.startFrame,dropFrame:r.dropFrame,label:J(r.kind),spec:null,geometrySpec:null,index:r,warnings:o};let n=i==="braw"?{codec:"braw",scale:F}:r.codec==="aprh"||r.codec==="aprn"?{codec:"proresraw",scale:F}:null;return n||o.push(`codec ${r.codec} not wired to the fingerprint pool`),{frames:n?r.offs:[],w:r.w,h:r.h,fps:r.fps,startFrame:r.startFrame,dropFrame:r.dropFrame,label:n?i==="braw"?"BRAW":"ProRes RAW":`unsupported (${r.codec})`,spec:n,geometrySpec:n?{...n,scale:z}:null,index:r,warnings:o}}throw new Error(`${e.name}: unrecognised container`)}var De=Number(E("CONFORM_DECODERS")??0)||Math.max(2,Math.min(Math.floor(Q()/2),Math.floor(Z()/2**31))),X=0,xe=[],ze=async(...e)=>{X>=De?await new Promise(t=>xe.push(t)):X++;try{return await oe(...e)}finally{let t=xe.shift();t?t():X--}};async function Ne(){let e=q()==="win32"?"conformtools-decode.exe":"conformtools-decode",t=[E("CONFORM_NATIVE_DECODE"),ee(e),I(new URL(`./${e}`,import.meta.url)),I(new URL(`../../rust/target/release/${e}`,import.meta.url))].filter(Boolean);for(let o of t)if(await te(o))return o;return null}var $=class extends Error{constructor(o,r){super(r);this.why=o}};function Pr(e){let t=null;try{t=JSON.parse(e.trim().split(`
4
- `).pop())}catch{}if(t?.why==="not_entitled")throw new ie("not_entitled",t.detail??"this machine is not licensed");return t?.detail??e.trim()}function Te(e,t){try{let o=JSON.parse(e.trim().split(`
5
- `).pop()??"");return new $(o.why,o.detail)}catch{return new $("decoder",`the native decoder exited ${t}: ${e.trim().slice(-300)}`)}}function Ue(e){let t=e.reduce((i,n)=>i+n.length,0),o=new Uint8Array(t),r=0;for(let i of e)o.set(i,r),r+=i.length;return o}async function $e(e,t,o,r,i){let n=await Ne();if(!n)throw new $("missing",re("the native decoder (conformtools-decode)"));let s=null,a=[],c=0,l=d=>{let f=new Uint8Array(d),p=0;for(;p<d;){let h=a[0],g=Math.min(h.length,d-p);f.set(h.subarray(0,g),p),p+=g,g===h.length?a.shift():a[0]=h.subarray(g)}return c-=d,f},u=[e,t,"--width",String(i.width??32768)];i.from!=null&&u.push("--from",String(i.from)),i.count!=null&&u.push("--count",String(i.count)),i.range&&u.push("--range",i.range);let m=await ze(n,u,d=>{if(a.push(d),c+=d.length,!s){let p=Ue(a.splice(0));a.push(p);let h=p.indexOf(10);if(h<0)return;s=JSON.parse(new TextDecoder().decode(p.subarray(0,h))),l(h+1),o(s)}let f=4+s.w*s.h*(s.bpp??(e==="rgb16"?6:4));for(;c>=f;){let p=l(f);r(new DataView(p.buffer).getUint32(0,!0),p.subarray(4))}},{signal:i.signal});if(m.code!==0||!s)throw Te(m.stderr,m.code)}function ve(e,t,o,r={}){return $e("bgra",e,t,o,r)}function Se(e,t,o,r={}){return $e("rgb16",e,t,(i,n)=>o(i,new Uint16Array(n.buffer,n.byteOffset,n.length>>1)),r)}var ke=["none","rle","zips","zip","piz","pxr24","b44","b44a","dwaa","dwab","htj2k"],N=e=>(e>>4)*10+(e&15);function Ie(e){let t=N(e&63),o=N(e>>>8&127),r=N(e>>>16&127),i=N(e>>>24&63),n=s=>String(s).padStart(2,"0");return`${n(i)}:${n(r)}:${n(o)}${e&64?";":":"}${n(t)}`}function He(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(e.length<8||t.getUint32(0,!0)!==20000630)return null;let o={fps:null,timecode:null,width:0,height:0,display:null,compression:null,attributes:[]},r=8,i=()=>{let s=r;for(;r<e.length&&e[r]!==0;)r++;let a=new TextDecoder().decode(e.subarray(s,r));return r++,a},n=s=>({width:t.getInt32(s+8,!0)-t.getInt32(s,!0)+1,height:t.getInt32(s+12,!0)-t.getInt32(s+4,!0)+1});for(;r<e.length;){let s=i();if(!s)break;let a=i();if(r+4>e.length)return null;let c=t.getInt32(r,!0);if(r+=4,c<0||r+c>e.length)return null;if(o.attributes.push(`${s}:${a}`),s==="framesPerSecond"&&a==="rational"&&c>=8){let l=t.getInt32(r,!0),u=t.getUint32(r+4,!0);o.fps=u?l/u:null}else s==="timeCode"&&a==="timecode"&&c>=8?o.timecode=Ie(t.getUint32(r,!0)):s==="dataWindow"&&a==="box2i"&&c>=16?{width:o.width,height:o.height}=n(r):s==="displayWindow"&&a==="box2i"&&c>=16?o.display=n(r):s==="compression"&&c>=1&&(o.compression=ke[e[r]]??`type ${e[r]}`);r+=c}return o}async function Be(e){let t=e,o=null,r=/^(.*?)\[(\d+)-(\d+)\](.*)$/.exec(b(e));if(await O(e))o=/^(.*?)(\d+)(\.exr)$/i;else{t=y(e);let n=r?[null,r[1],r[2],r[4]]:/^(.*?)(\d+)(\.exr)$/i.exec(b(e));if(!n)return{frames:[e],numbers:[]};let s=a=>a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");o=new RegExp(`^${s(n[1])}(\\d{${n[2].length}})${s(n[3])}$`,"i")}let i=[];for await(let n of v(t)){let s=n.isFile?o.exec(n.name):null;s&&i.push({n:Number(s[s.length===4?2:1]),f:_(t,n.name)})}return i.sort((n,s)=>n.n-s.n),{frames:i.map(n=>n.f),numbers:i.map(n=>n.n)}}async function Re(e){let t=await Be(e),o=t.frames[0];if(!o)throw new Error(`no .exr frames for '${b(e)}'`);let r=await A(o),i;try{i=He(await r.readAt(0,Math.min(r.size,1<<20)))}finally{await r.close()}if(!i)throw new Error(`'${b(o)}' is not an OpenEXR file`);let n=Math.max(1,t.frames.length),s=t.numbers.length>1?t.numbers[t.numbers.length-1]-t.numbers[0]+1-t.numbers.length:0,a=i.fps??0;return{id:b(o),kind:"external",target_url:o,local_path:o,content_kind:n>1?"video":"still",source_fps:i.fps??void 0,source_timecode:i.timecode??void 0,source_resolution_w:i.width,source_resolution_h:i.height,available_range:{start:{value:0,rate:a},duration:{value:n,rate:a}},streams:[{kind:"video",codec:"exr",width:i.width,height:i.height,rate:i.fps??void 0,codec_specific:{compression:i.compression}}],vendor_metadata:{exr:{frames:n,first_frame:t.numbers[0]??null,last_frame:t.numbers[t.numbers.length-1]??null,missing_frames:s,display_window:i.display,attributes:i.attributes,fps_source:i.fps!=null?"header framesPerSecond":"not in the header",timecode_source:i.timecode?"header timeCode (first frame)":"not in the header"}}}}var G=new Set([".mov",".mp4",".m4v",".mxf",".wav",".braw",".crm",".r3d",".aif",".aiff"]);async function je(e){let t=await A(e);return{path:e,file:t,size:t.size}}function We(e){return(t,o)=>e.file.readAt(t,o)}async function Le(e){let t=R(b(e));if(!t)return[e];let o=y(e),r=[];for await(let i of v(o)){if(!i.isFile)continue;let n=R(i.name);n&&n.clipBase===t.clipBase&&r.push({n:n.partNumber,p:_(o,i.name)})}return r.sort((i,n)=>i.n-n.n).map(i=>i.p)}async function Y(e){if(await O(e)){let n=[];for await(let s of v(e))s.isFile&&R(s.name)&&n.push(_(e,s.name));if(!n.length)throw new Error(`'${b(e)}' is a folder with no .R3D parts`);e=n.sort()[0]}let t=be(b(e));if(!t)throw new Error(`unsupported media file '${b(e)}' (supported: ${[...G].join(" ")})`);let o=await Le(e),r=await Promise.all(o.map(je));return{source:ge(t,r.map(n=>he(b(n.path),{fileSize:n.size,read:We(n)}))),parts:r,format:t,anchor:o[0],close:()=>r.forEach(n=>n.file.close())}}async function Je(e,t,o,r){if(!/h264|avc|hevc|h265/.test(o)){let i=null,n=await Y(e);try{return await C(n.source,{verb:"decode",index:t,intent:"park"})}catch(s){i=s}finally{n.close()}try{return await Me(e,t,r)}catch(s){throw/no decoder/.test(String(i))?s:i instanceof Error?i:new Error(String(i))}}return Me(e,t,r)}async function Hr(e,t,o,r={}){if(/\.mxf$/i.test(e)&&(!o||/h264|avc|mxf/.test(o))){let a=null,c=null;try{await Se(e,l=>{a=l},(l,u)=>{l===t&&(c=u.slice())},{from:t,count:1,range:r.range})}catch(l){if(!(l instanceof $)||!/unsupported|missing/.test(l.why))throw l}if(c&&a){let l=a;return{rgb:c,width:l.w,height:l.h,bits:l.bit_depth??16,decoder:"media-core",full_range:l.full_range??null}}}let i=await Je(e,t,o),n=i.width*i.height,s=new Uint16Array(n*3);for(let a=0;a<n;a++)s[a*3]=i.rgba[a*4]*257,s[a*3+1]=i.rgba[a*4+1]*257,s[a*3+2]=i.rgba[a*4+2]*257;return{rgb:s,width:i.width,height:i.height,bits:8,decoder:"8-bit",full_range:null}}async function Me(e,t,o){t=Math.round(t);let r=0,i=0,n=null;if(await ve(e,a=>{r=a.w,i=a.h},(a,c)=>{a===t&&(n=c)},{from:t,count:1,width:o}),!n)throw new Error(`the OS decoder returned no frame ${t} of ${b(e)}`);let s=n;for(let a=0;a<s.length;a+=4){let c=s[a];s[a]=s[a+2],s[a+2]=c}return{rgba:s,width:r,height:i}}async function P(e){if(/\.exr$/i.test(e))return Re(e);let t=await Y(e);try{let o=await C(t.source,{verb:"inspect"});if(!o)throw new Error(`could not read '${b(e)}' as ${t.format}`);return o.target_url=t.anchor,o.local_path=t.anchor,o.id=o.id||b(t.anchor),t.parts.length>1&&((o.vendor_metadata??={}).spanned_parts=t.parts.map(r=>b(r.path))),o.size_bytes=t.parts.reduce((r,i)=>r+i.size,0),o}finally{t.close()}}function Ke(e,t,o,r){let i=Math.abs(r*1001-Math.round(r*1001/1e3)*1e3)<1?Math.round(r)*1e3/1001:r,n=Math.floor(e*i/t+1e-6);return{tc:D(n,r),frames:Math.round(o*i/t)}}var Ve=e=>String(Math.round(e*1e3)/1e3);function Br(e,t){let o=e.streams?.find(m=>m.kind==="video"),r=e.streams?.filter(m=>m.kind==="audio")??[],i=e.vendor_metadata?.bext;if(!o&&e.available_range&&r[0]?.rate){let m=r[0].rate,d=e.available_range.duration.value,p=(t?[t]:[24e3/1001,24]).map(h=>{let g=Ke(i?.time_reference??0,i?.sample_rate||m,d,h);return`${i?`start TC ${g.tc}, `:""}${g.frames} frames @ ${Ve(h)} fps`});return[e.target_url??"",`audio only; ${d} samples (${(d/m).toFixed(3)} s)${i?`; BWF time_reference ${i.time_reference}`:"; no BWF timecode"}`,...p,...t?[]:["(pass fps for the project's rate)"],...r.map((h,g)=>`audio ${r.length>1?`${g+1}: `:""}${h.codec??"pcm"} ${h.channels??"?"}ch ${h.rate} Hz ${h.bit_depth??"?"}-bit`)].join(`
6
- `)}let n=e.available_range?.duration?.value??e.declared_duration?.value??null,s=e.source_fps??o?.rate??null,a=e.size_bytes,c=e.vendor_metadata?.spanned_parts,l=o?.codec_specific??{},u=[l.profile?`${l.profile} (${l.fourcc})`:l.fourcc,l.pixel_format,o?.bit_depth?`${o.bit_depth}-bit`:null,l.colr?`color ${l.colr.primaries}/${l.colr.transfer}/${l.colr.matrix} (primaries/transfer/matrix)`:null].filter(Boolean).join(", ");return[e.target_url??"",o?`${o.codec??"?"} ${o.width??"?"}x${o.height??"?"}${s?` @ ${Math.round(s*1e3)/1e3} fps`:""}${u?`; ${u}`:""}`:"no video track",`start TC ${e.source_timecode??"none"}; ${n!=null?`${n} frames`:"length unknown"}${n!=null&&s?` (${(n/s).toFixed(2)} s)`:""}`,r.length?r.map((m,d)=>{let f=m.codec_specific?.channel_layout;return`audio ${r.length>1?`${d+1}: `:""}${m.codec??"pcm"} ${m.channels??"?"}ch${f?` (${f})`:""} ${m.rate??"?"} Hz ${m.bit_depth??"?"}-bit`}).join(`
7
- `):"no audio",`${e.reel_name?`reel ${e.reel_name}; `:""}${a!=null?`${(a/1e6).toFixed(1)} MB`:""}${c?`; spanned ${c.length} parts`:""}`].join(`
8
- `)}var Xe=8*1024*1024,T=e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0));async function Ge(e,t,o){if(e.executable_locally===!1)throw new Error("this trim plan is server-side only");let r=new Map(t.parts.map(n=>[b(n.path),n]));await j(y(o));let i=await ne(o);try{await i.truncate(e.total_size),await i.writeAt(0,T(e.dest_header_bytes_base64));for(let n of e.src_byte_ranges){let s=n.src_file_name?r.get(b(n.src_file_name)):t.parts[0];if(!s)throw new Error(`plan references unknown source part '${n.src_file_name}'`);let a=0;for(;a<n.length;){let c=Math.min(Xe,n.length-a),l=await s.file.readAt(n.offset+a,c);if(l.length<c)throw new Error(`short read in ${b(s.path)} at ${n.offset+a}`);await i.writeAt(n.write_to_dest_offset+a,l),a+=c}}e.dest_footer_bytes_base64&&e.dest_footer_offset!=null&&await i.writeAt(e.dest_footer_offset,T(e.dest_footer_bytes_base64));for(let n of e.dest_patches??[])await i.writeAt(n.offset,T(n.bytes_base64))}finally{await i.close()}for(let n of e.dest_sidecar_writes??[])await B(_(y(o),n.name),T(n.bytes_base64))}function Ye(e,t){let o=[];for(let r of e){if(r.kind!=="clip"||!r.source_range)continue;let i=r.source_range.start.value,n=r.source_range.duration.value,s=Math.max(0,Math.floor(i)-t),a=Math.floor(i+n-1)+t;a>=s&&o.push({first_frame:s,last_frame:a})}return pe(o)}async function Ze(e,t,o,r,i){let n=await Y(e);try{let s=Ye(t,o);if(!s.length)throw new Error("no usable frame ranges (items need kind=clip with source_range)");let a=await C(n.source,{verb:"trim",selection:{items:t,handles:o}}),c=L(n.anchor),l=n.format==="r3d",u=l?R(b(n.anchor))?.clipBase??b(n.anchor,c):b(n.anchor,c),m=[];for(let[d,f]of a.entries()){let p=f.output_clip_number??(s.length>1?d+1:void 0),h=s[(p??1)-1]??s[0],g=p&&(f.output_clip_count??s.length)>1?`_S${String(p).padStart(3,"0")}`:"",w;if(l){let x=f.output_part_number??d+1;w=_(r,`${u}${g}.RDC`,`${u}_${String(x).padStart(3,"0")}.R3D`),m.push({path:w,bytes:f.total_size,island:h,part:x,clip:p})}else{let x=i&&a.length===1?i:`${u}${g||`_trim_${h.first_frame}-${h.last_frame}`}${c}`;w=_(r,x),m.push({path:w,bytes:f.total_size,island:h,clip:p})}await Ge(f,n,w)}return l||await Qe(e,m,!!i&&a.length===1),{outputs:m,islands:s,format:n.format}}finally{n.close()}}async function Qe(e,t,o){let r=await P(e).catch(()=>null),i=r?.source_fps??r?.streams?.find(n=>n.kind==="video")?.rate??null;if(!(!r?.source_timecode||!i))for(let n of t){if(!n.island)continue;let s=await P(n.path).catch(()=>null),a=s?.available_range?.duration?.value??s?.declared_duration?.value;if(!s?.source_timecode||!a)continue;let c=M(s.source_timecode,i,r.source_timecode);if(c===n.island.first_frame&&c+a-1===n.island.last_frame||(n.island={first_frame:c,last_frame:c+a-1},o))continue;let l=n.path.replace(/_trim_\d+-\d+(\.[^./\\]+)$/,`_trim_${c}-${c+a-1}$1`);l!==n.path&&(await W(n.path,l),n.path=l)}}async function jr(e){let t=await P(e.path),o=t.source_fps??t.streams?.find(p=>p.kind==="video")?.rate??null,r=t.available_range?.duration?.value??t.declared_duration?.value??null;if(!o)throw new Error("cannot trim: no frame rate / timecode track on this file");let i=M(e.in,o,t.source_timecode??null),n=M(e.out,o,t.source_timecode??null);if(e.out_exclusive&&(n-=1),n<i)throw new Error(`out (${n}) is before in (${i})`);if(i<0)throw new Error(`in (${i}) is before the file start (TC ${t.source_timecode})`);if(r!=null&&n>r-1)throw new Error(`out (${n}) is past the last frame (${r-1})`);let s={id:"trim",kind:"clip",source_range:{start:{value:i,rate:o},duration:{value:n-i+1,rate:o}}},a=y(e.path),c;if(e.out_path)try{(await H(e.out_path)).isDirectory?a=e.out_path:(a=y(e.out_path),c=b(e.out_path))}catch{a=y(e.out_path),c=b(e.out_path)}let l=await Ze(e.path,[s],Math.max(0,Math.floor(e.handles??0)),a,c),u=l.islands[0],m=l.outputs.length===1&&l.outputs[0].island?l.outputs[0].island:u,d=m.first_frame,f=m.last_frame;return{outputs:l.outputs,first_frame:d,last_frame:f,frames:f-d+1,fps:o,facts:t,...d!==u.first_frame||f!==u.last_frame?{asked:{first_frame:u.first_frame,last_frame:u.last_frame}}:{}}}function Fe(e){let t=[...G].map(o=>o.slice(1)).join("|");return e.toLowerCase().replace(new RegExp(`\\.(${t})(?=[._\\s-]|$)`,"g"),"").replace(/[^a-z0-9]/g,"")}function qe(e,t){let o=Fe(e),r=Fe(t);if(r&&o.includes(r))return"name";let i=t.toLowerCase().split(/[^a-z0-9]+/).filter(n=>/\d/.test(n)&&n.length>=3);return i.length&&i.every(n=>o.includes(n))?"id":null}async function Wr(e,t,o){let r=[],i=0,n=null,s=Date.now()+o.time_limit_s*1e3,a=async(c,l)=>{try{for await(let u of v(c)){if(n&&!n.startsWith("folders"))return;if(++i>o.max_entries){n=`stopped after ${o.max_entries} entries (max_entries)`;return}if(Date.now()>s){n=`stopped after ${o.time_limit_s} s (time_limit_s)`;return}if(u.name.startsWith("."))continue;let m=_(c,u.name);if(u.isDirectory)l<o.max_depth?await a(m,l+1):n??=`folders deeper than max_depth=${o.max_depth} not searched (e.g. ${m})`;else if(u.isFile&&G.has(L(u.name).toLowerCase())){let d=qe(u.name,t);d&&r.push({path:m,match:d,size:(await H(m).catch(()=>({size:0}))).size})}}}catch{}};if(await a(e,0),o.probe)for(let c=0;c<r.length;c+=8)await Promise.all(r.slice(c,c+8).map(async l=>{try{l.facts=await P(l.path)}catch(u){l.error=u.message}}));return r.sort((c,l)=>c.path.localeCompare(l.path)),{hits:r,scanned:i,truncated:n}}function er(e){let t=e.streams?.find(a=>a.kind==="video"),o=e.source_fps??t?.rate??null,r=e.available_range?.duration?.value??e.declared_duration?.value??null,i=t?.codec_specific??{},n=e.source_timecode&&o?K(e.source_timecode,o):null,s=n!=null&&r!=null&&o?D((n+r)%(Math.round(o)*86400),o,e.source_timecode.includes(";")):null;return`${t?`${t.codec??"?"}${i.profile?` ${i.profile}`:""} ${t.width??"?"}x${t.height??"?"}`:"no video"}${o?` @ ${Math.round(o*1e3)/1e3} fps`:""}; TC ${e.source_timecode??"none"}${s?`\u2013${s}`:""}; ${r??"?"} fr${r!=null&&o?` (${(r/o).toFixed(2)} s)`:""}`}function Lr(e,t,o,r){let i=e.hits.slice(0,r),n=[];e.truncated&&n.push(`TRUNCATED: ${e.truncated} \u2014 the search did NOT cover all of ${t}; the matches below may be incomplete.`),e.hits.length>i.length&&n.push(`TRUNCATED: showing ${i.length} of ${e.hits.length} matches. Pass limit=${e.hits.length} or narrow the query.`),n.push(`${e.hits.length} file${e.hits.length===1?"":"s"} match "${o}" under ${t} (${e.scanned} entries scanned)`);let s=new Map;for(let c of e.hits)s.set(b(c.path).toLowerCase(),(s.get(b(c.path).toLowerCase())??0)+1);let a=[...s].filter(([,c])=>c>1);a.length&&n.push(`same name in several folders: ${a.map(([c,l])=>`${c} \xD7${l}`).join(", ")} \u2014 they can be DIFFERENT clips; match by TC + duration, never by name alone`);for(let c of i)n.push(`- ${c.path}${c.match==="id"?" (id match)":""}
9
- ${c.facts?er(c.facts):c.error?`probe failed: ${c.error}`:`${(c.size/1e6).toFixed(1)} MB`}`);return n.join(`
10
- `)}async function Jr(e,t,o=0){let r=await P(e),i=r.source_fps??r.streams?.find(d=>d.kind==="video")?.rate??null,n=r.available_range?.duration?.value??r.declared_duration?.value??null;if(!i||n==null)throw new Error(`cannot check coverage: ${b(e)} has no frame rate or length`);let s=Math.round(i)*86400,a=r.source_timecode?K(r.source_timecode,i)??0:0,c=!!r.source_timecode?.includes(";"),l=d=>{let f=M(d,i,r.source_timecode??null);return typeof d=="number"||/^\d+$/.test(d.trim())?f:f<-s/2?f+s:f>s/2?f-s:f},u=d=>D(((a+d)%s+s)%s,i,c),m=t.map((d,f)=>{let p=l(d.in),h=l(d.out),g=p,w=n-h,x=g>=0&&w>=0&&h>p,U=Math.max(0,-g),k=Math.max(0,-w),S=[];return h<=p?S.push("out is not after in"):x?S.push(`covered; handles head ${g} / tail ${w} fr`):S.push(`NOT covered: short ${[U?`${U} fr at head`:"",k?`${k} fr at tail`:""].filter(Boolean).join(", ")}`),x&&o&&(g<o||w<o)&&S.push(`handles short of ${o}: ${[g<o?`head by ${o-g}`:"",w<o?`tail by ${o-w}`:""].filter(Boolean).join(", ")}`),{label:d.label??`range ${f+1}`,in_tc:u(p),out_tc:u(h),frames:h-p,covered:x,head:g,tail:w,short_head:U,short_tail:k,note:S.join("; ")}});return{facts:r,rows:m}}export{ir as a,Ne as b,Pr as c,ve as d,Be as e,G as f,Le as g,Y as h,Je as i,Hr as j,P as k,Ke as l,Br as m,Ye as n,Ze as o,jr as p,Fe as q,qe as r,Wr as s,er as t,Lr as u,Jr as v};
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import"./chunk-PSANHDZM.js";function S(){let e=window.__CONFORM_ENGINE__;if(e?.base)return e;let t=new URLSearchParams(window.location.search),n=c=>{try{return sessionStorage.getItem(`conform.engine.${c}`)}catch{return null}},i=(c,g)=>{try{sessionStorage.setItem(`conform.engine.${c}`,g)}catch{}},r=t.get("engine"),o=t.get("token");return r?i("url",r):r=n("url"),o?i("token",o):o=n("token"),{base:r?/^\d+$/.test(r)?`http://127.0.0.1:${r}`:r.replace(/\/$/,""):"http://127.0.0.1:7791",token:o??""}}var u=typeof window>"u"?{base:"http://127.0.0.1:7791",token:""}:S(),f=(e=!0)=>({...e?{"content-type":"application/json"}:{},"x-conform-client":"app",...u.token?{authorization:`Bearer ${u.token}`}:{}}),y=class extends Error{constructor(n,i){super(i);this.code=n}};async function s(e,t,n,i=[],r={}){let o;try{o=await fetch(`${u.base}${t}`,{method:e,headers:{...f(),...r},body:n===void 0?void 0:JSON.stringify(n)})}catch{throw new y("engine_down",`the conform.tools engine is not running at ${u.base}`)}let l=await o.json().catch(()=>({}));if(!o.ok&&!("text"in l)&&!i.includes(o.status))throw new y(l.code??String(o.status),l.message??`HTTP ${o.status}`);return l}async function P(e,t,n,i){let r;try{r=await fetch(`${u.base}${e}`,{...t,headers:f(),signal:i})}catch{i?.aborted||n({type:"error",code:"engine_down",message:`the conform.tools engine is not running at ${u.base}`});return}if(!r.ok||!r.body){let g=await r.json().catch(()=>({}));n({type:"error",code:g.code??String(r.status),message:g.message??`HTTP ${r.status}`});return}let o=r.body.getReader(),l=new TextDecoder,c="";for(;;){let{value:g,done:h}=await o.read();if(h)break;c+=l.decode(g,{stream:!0});let p;for(;(p=c.indexOf(`
4
-
5
- `))>=0;){let m=c.slice(0,p);c=c.slice(p+2),m.startsWith("data: ")&&n(JSON.parse(m.slice(6)))}}}var w=new Set,k=null;function _(){if(k)return;let e=k=new AbortController;(async()=>{for(;!e.signal.aborted;)await P("/app/events",{method:"GET"},t=>{for(let n of w)n(t)},e.signal).catch(()=>{}),e.signal.aborted||await new Promise(t=>setTimeout(t,2e3))})()}var x={base:u.base,health:()=>s("GET","/health"),verb:(e,t={})=>s("POST",`/verbs/${e}`,t),poll:(e,t={})=>s("POST",`/verbs/${e}`,t,[],{"x-conform-poll":"1"}),job:e=>s("GET",`/jobs/${e}`),cancelJob:e=>s("DELETE",`/jobs/${e}`),front:e=>s("POST","/app/front",e),account:()=>s("GET","/app/account"),projects:()=>s("GET","/app/projects"),createProject:e=>s("POST","/app/projects",e),project:e=>s("GET",`/app/projects/${e}`),attachSession:(e,t)=>s("PUT",`/app/projects/${e}/sessions`,{session_id:t}),saveContext:(e,t,n)=>s("PUT",`/app/projects/${e}/context`,{text:t,base:n},[409]),frame:async(e,t,n,i,r,o,l)=>{let c=new URLSearchParams({f:String(t),w:String(n),...r?{timeline:r}:{},...o?{track:String(o)}:{},...l?{grade:"resolve",...l.host_timeline?{host_timeline:l.host_timeline}:{}}:{}}),g=await fetch(`${u.base}/app/sessions/${e}/frame?${c}`,{headers:f(!1),signal:i}).catch(()=>null);if(!g?.ok)return null;if(g.headers.get("content-type")!=="application/x-conform-pixels")return createImageBitmap(await g.blob()).catch(()=>null);let h=new Uint8Array(await g.arrayBuffer()),p=new DataView(h.buffer),m=p.getUint32(0,!0),v=p.getUint32(4,!0),T=p.getUint32(8,!0)===1,d=new Uint8ClampedArray(h.buffer,12,m*v*4);for(let b=0;b<d.length;b+=4){if(T){let R=d[b];d[b]=d[b+2],d[b+2]=R}d[b+3]=255}return createImageBitmap(new ImageData(d,m,v)).catch(()=>null)},tools:()=>s("POST","/verbs/tool",{action:"list"}).then(e=>e.tools??[]),blocks:()=>s("POST","/verbs/tool",{action:"blocks"}).then(e=>e.blocks??[]),saveTool:e=>s("POST","/verbs/tool",{action:"save",spec:e},[422]),deleteTool:e=>s("POST","/verbs/tool",{action:"delete",id:e},[422]),toolLayout:()=>s("POST","/verbs/tool",{action:"layout"}).then(e=>e.layout),arrangeTools:e=>s("POST","/verbs/tool",{action:"arrange",layout:e}).then(t=>t.layout),hideTool:(e,t)=>s("POST","/verbs/tool",{action:t?"hide":"show_tool",id:e}).then(n=>n.layout),workspace:e=>s("POST","/verbs/tool",{action:"workspace",project_id:e}).then(t=>t.workspace),saveWorkspace:(e,t)=>s("POST","/verbs/tool",{action:"workspace_save",project_id:e,workspace:t},[422]),exportTools:(e,t)=>s("POST","/verbs/tool",{action:"export",ids:e,path:t},[422]),importTools:e=>s("POST","/verbs/tool",{action:"import",path:e},[422]),hostSetup:(e,t="status")=>s("POST","/verbs/host_setup",{host:e,action:t},[422]),convert:async(e,t)=>{let n=new URLSearchParams({name:e.fileName,out:t,targets:JSON.stringify(e.targets.map(({target:r,ext:o})=>({target:r,ext:o}))),sequences:JSON.stringify(e.sequences)}),i=await fetch(`${u.base}/app/convert?${n}`,{method:"POST",headers:{...f(!1),"content-type":"application/octet-stream"},body:e.bytes});return await i.json().catch(()=>({ok:!1,error:`the engine said ${i.status}`}))},canonicalize:async(e,t=[],n=[])=>{let i=new URLSearchParams({name:e.name,sequences:JSON.stringify(t),previous:JSON.stringify(n)}),r=await fetch(`${u.base}/app/canonicalize?${i}`,{method:"POST",headers:{...f(!1),"content-type":"application/octet-stream"},body:await e.arrayBuffer()}),o=await r.json().catch(()=>({ok:!1,error:`the engine said ${r.status}`}));if(!o.ok)throw new Error(o.error??o.message??`the engine said ${r.status}`);return o},policy:()=>s("GET","/app/policy"),session:e=>s("GET",`/app/sessions/${e}`),onEvent:e=>(w.add(e),_(),()=>{w.delete(e),w.size||(k?.abort(),k=null)}),saveRunCsv:(e,t,n,i)=>s("POST","/verbs/tool_run",{action:"csv",project_id:e,path:t,id:n,table:i}),runs:(e,t)=>s("POST","/verbs/tool_run",{action:"list",project_id:e,...t?{id:t}:{}}).then(n=>n.runs??[])};async function j(e,t){let n=await fetch(`${u.base}/app/fs`,{method:"POST",headers:f(),body:JSON.stringify({op:e,...t})});if(e==="readFile"){if(!n.ok)throw Object.assign(new Error(`could not read ${String(t.path)}`),{name:"NotReadableError"});let r=await n.arrayBuffer();return{result:{byteLength:r.byteLength},bytes:r}}let i=await n.json().catch(()=>({ok:!1}));if(!i.ok)throw Object.assign(new Error(i.message??`the engine said ${n.status}`),{name:"NotFoundError"});return{result:i.result}}var a=()=>typeof window<"u"?window.__TAURI__:void 0,$={available:()=>!!a()?.core?.invoke,licenseStatus:()=>a().core.invoke("license_status"),fingerprint:()=>a().core.invoke("machine_fingerprint"),version:()=>a().app.getVersion(),installUpdate:()=>a().core.invoke("install_update"),importLicense:async()=>{let e=await a().dialog.open({multiple:!1,filters:[{name:"conform.tools licence",extensions:["lic","json"]}]});return typeof e=="string"?a().core.invoke("import_license",{path:e}):null},pickFolder:async()=>{let e=await a().dialog.open({directory:!0,multiple:!1});return typeof e=="string"?e:null},pickFiles:async()=>{let e=await a().dialog.open({directory:!1,multiple:!0});return Array.isArray(e)?e:typeof e=="string"?[e]:[]},pickFile:async()=>{let e=await a().dialog.open({directory:!1,multiple:!1});return typeof e=="string"?e:null},saveFile:async e=>{try{let t=e.split(".").pop()??"json",n=await a().dialog.save({defaultPath:e,filters:[{name:t==="csv"?"Table":"Recipe",extensions:[t]}]});return typeof n=="string"?n:null}catch{let t=await a().dialog.open({directory:!0,multiple:!1});return typeof t=="string"?`${t.replace(/[\\/]$/,"")}/${e}`:null}}};export{y as EngineError,x as engine,j as engineFs,$ as shell};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{lc as a,mc as b,nc as c,oc as d,pc as e,qc as f,rc as g,sc as h,tc as i,uc as j,vc as k,wc as l,xc as m,yc as n}from"./chunk-LKQTE6T5.js";import"./chunk-IN6XVTUS.js";import"./chunk-Y455Y6V4.js";import"./chunk-PFZVET7S.js";import"./chunk-6V4OEOOX.js";import"./chunk-H4BU5WA6.js";import"./chunk-ISKNIQVO.js";import"./chunk-JKOB3U54.js";import"./chunk-EEDLRRKU.js";import"./chunk-WJ5EWXP2.js";import"./chunk-YUO3UWPH.js";import"./chunk-DKGGJM6Z.js";import"./chunk-JV7TZDKJ.js";import"./chunk-RGMTLNMF.js";import"./chunk-XDI6CPPV.js";import"./chunk-7W5AFZYX.js";import"./chunk-LZRCXSUJ.js";import"./chunk-BTS3DFPD.js";import"./chunk-6WLSIH2N.js";import"./chunk-LVGGCRDW.js";import"./chunk-C2ESM27Z.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-DPA26AOI.js";import"./chunk-L3HRAIDR.js";import"./chunk-OD445COC.js";import"./chunk-EP4L2BWV.js";import"./chunk-PHAMF4JF.js";import"./chunk-XI6XF7FQ.js";import"./chunk-PSANHDZM.js";export{j as ASPECTS,a as INPUT_SCALING,f as SIZING_TARGETS,i as alignText,h as alignTimeline,k as aspectOf,l as blankingForAspect,m as blankingQc,n as blankingText,c as inputFitRatio,g as offlineLane,d as resolveProps,b as scalingOf,e as underRef};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{a,b,c,d}from"./chunk-6WLSIH2N.js";import"./chunk-LVGGCRDW.js";import"./chunk-C2ESM27Z.js";import"./chunk-OD445COC.js";import"./chunk-EP4L2BWV.js";import"./chunk-PHAMF4JF.js";import"./chunk-XI6XF7FQ.js";import"./chunk-PSANHDZM.js";export{a as HOSTED_READ_KEYS,b as readHosted,d as shareOriginal,c as writeHosted};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{f as a,g as b,h as c,i as d,j as e}from"./chunk-I2Y2P5NH.js";import"./chunk-ERUN634Q.js";import"./chunk-J43UCJ6G.js";import"./chunk-LKQTE6T5.js";import"./chunk-IN6XVTUS.js";import"./chunk-Y455Y6V4.js";import"./chunk-PFZVET7S.js";import"./chunk-6V4OEOOX.js";import"./chunk-4VFDGL4E.js";import"./chunk-H4BU5WA6.js";import"./chunk-ISKNIQVO.js";import"./chunk-JKOB3U54.js";import"./chunk-EEDLRRKU.js";import"./chunk-WJ5EWXP2.js";import"./chunk-YUO3UWPH.js";import"./chunk-DKGGJM6Z.js";import"./chunk-JV7TZDKJ.js";import"./chunk-RGMTLNMF.js";import"./chunk-XDI6CPPV.js";import"./chunk-7W5AFZYX.js";import"./chunk-LZRCXSUJ.js";import"./chunk-BTS3DFPD.js";import"./chunk-6WLSIH2N.js";import"./chunk-LVGGCRDW.js";import"./chunk-C2ESM27Z.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-DPA26AOI.js";import"./chunk-L3HRAIDR.js";import"./chunk-OD445COC.js";import"./chunk-EP4L2BWV.js";import"./chunk-PHAMF4JF.js";import"./chunk-XI6XF7FQ.js";import"./chunk-PSANHDZM.js";export{a as AVID_SETUP,b as FLAME_SETUP,c as NUKE_SETUP,e as adapter,d as setAdapter};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{a as N}from"./chunk-TK55FA56.js";import{a as T,b as L}from"./chunk-AACY2V3L.js";import{b as p,c as O,g as J}from"./chunk-XDI6CPPV.js";import{b as V}from"./chunk-7W5AFZYX.js";import{b as $,c as _}from"./chunk-LZRCXSUJ.js";import{$ as f,A as P,B as x,C as F,D as A,Da as k,Ga as C,Ha as U,Ia as d,N as D,O as z,ha as E,k as w,m as v,n as y,p as R,qa as H,ta as I,x as S,y as M}from"./chunk-DPA26AOI.js";import"./chunk-PSANHDZM.js";function u(e){return(t,n)=>e.read(t,n)}function B(e){let t=e.toLowerCase().trim();return t==="aprn"||t==="aprh"?"prores_raw":t==="apch"||t==="apcn"||t==="apcs"||t==="apco"||t==="ap4h"||t==="ap4x"?"prores":t==="avdn"?"dnxhd":t==="dnxh"?"dnxhr":t==="avc1"||t==="avc3"?"h264":t==="hev1"||t==="hvc1"?"h265":t==="braw"?"braw":e}var h={apco:"Proxy",apcs:"LT",apcn:"422",apch:"HQ",ap4h:"4444",ap4x:"4444 XQ"},Z={1:"bt709",2:"unknown",5:"bt470bg",6:"smpte170m",9:"bt2020",11:"smpte431",12:"smpte432"},ee={1:"bt709",2:"unknown",6:"smpte170m",8:"linear",13:"iec61966-2-1",14:"bt2020-10",15:"bt2020-12",16:"smpte2084",18:"arib-std-b67"},re={0:"gbr",1:"bt709",2:"unknown",5:"bt470bg",6:"smpte170m",9:"bt2020nc",10:"bt2020c"};function te(e,t){return e==="ap4h"||e==="ap4x"?t===32?"yuva444p12le":"yuv444p12le":e in h?"yuv422p10le":void 0}var Q={66:"Baseline",77:"Main",88:"Extended",100:"High",110:"High 10",122:"High 4:2:2",244:"High 4:4:4"},G={1:"Main",2:"Main 10",3:"Main Still",4:"Rext"},ne={1270:"DNxHR 444",1271:"DNxHR HQX",1272:"DNxHR HQ",1273:"DNxHR SQ",1274:"DNxHR LB"};function oe(e,t){if(h[e.codec_fourcc])return`ProRes ${h[e.codec_fourcc]}`;if(e.vc3_cid)return ne[e.vc3_cid]??`DNxHD ${e.vc3_cid}`;if(e.video_profile!=null){if(t==="h264"&&Q[e.video_profile])return`H.264 ${Q[e.video_profile]}`;if(t==="h265"&&G[e.video_profile])return`HEVC ${G[e.video_profile]}`}}function ie(e,t){let n=e.video_chroma,r=e.video_bit_depth;if(n==null&&t==="h264"&&[66,77,88].includes(e.video_profile??-1)&&([n,r]=[1,8]),n==null&&e.vc3_cid&&(n=e.vc3_cid===1270||e.vc3_cid===1256?3:2),n==null||r==null)return;let i=["gray","yuv420p","yuv422p","yuv444p"][n];return r>8?`${i}${r}le`:i}function W(e,t){let n=[];for(let r of e){if(r.kind!=="clip"||!r.source_range)continue;let i=r.source_range.start.value,o=r.source_range.duration.value,c=Math.max(0,Math.floor(i)-t),a=Math.floor(i+o-1)+t;a>=c&&n.push({first_frame:c,last_frame:a})}return n}var be={async inspect(e){await d();let t=e.parts[0],n=await f(u(t),t.fileSize,e.format),r=JSON.parse(n);if(!r)return null;let i=r.timecode&&r.timecode.fps_denominator>0?r.timecode.fps_numerator/r.timecode.fps_denominator:null,o=B(r.codec_fourcc),c=[{kind:"video",codec:o,width:r.width??void 0,height:r.height??void 0,rate:i??void 0,bit_depth:p(r.codec_fourcc)??p(o)??O(o,r.video_profile)??r.video_bit_depth??void 0,codec_specific:{fourcc:r.codec_fourcc,profile:oe(r,o),pixel_format:te(r.codec_fourcc,r.video_depth)??ie(r,o),colr:r.colr?{primaries:Z[r.colr.primaries]??r.colr.primaries,transfer:ee[r.colr.transfer]??r.colr.transfer,matrix:re[r.colr.matrix]??r.colr.matrix}:void 0}}];for(let a of r.audio_tracks??(r.audio?[r.audio]:[]))c.push({kind:"audio",codec:a.codec_fourcc,channels:a.channels??void 0,rate:a.sample_rate??void 0,bit_depth:a.bit_depth??void 0,codec_specific:{fourcc:a.codec_fourcc,channel_layout:a.channel_layout??void 0}});return{id:t.filename,kind:"external",target_url:t.filename,available_range:i&&r.duration_seconds?{start:{value:0,rate:i},duration:{value:Math.round(r.duration_seconds*i),rate:i}}:null,reel_name:null,source_timecode:r.timecode?.display??null,container:e.format==="mov"?"mov":e.format,codec:o,size_bytes:t.fileSize,source_fps:i,source_resolution_w:r.width??null,source_resolution_h:r.height??null,streams:c,decode_provenance:r.decode_provenance??null,vendor_metadata:r.timecode?{drop_frame:r.timecode.drop_frame}:{},binding_state:"unbound",raw_extraction:{mov_probe:r},metadata:{}}},async extract(e){await d();let t=e.parts[0],n=JSON.parse(await E(u(t),t.fileSize,e.format));if(n.length===0)return null;let r=JSON.parse(await f(u(t),t.fileSize,e.format)),i=r?B(r.codec_fourcc):e.format,o=r?.timecode&&r.timecode.fps_denominator>0?r.timecode.fps_numerator/r.timecode.fps_denominator:void 0;return{v:1,container:e.format==="mov"?"mov":e.format,codec:i,width:r?.width??void 0,height:r?.height??void 0,fps:o,frame_count:T(n),timecode:r?.timecode?.display??void 0,granularity:L(n),segments:n}},async sparsify(e,t){await d();let n=e.parts[0],r=W(t.items,t.handles),i=await I(u(n),n.fileSize,JSON.stringify(r),e.format),o=JSON.parse(i);return[{filename:n.filename,fileSize:o.fileSize,structuralRanges:o.structuralRanges,essenceRanges:o.essenceRanges,trimInputs:o.trimInputs}]},async trim(e,t){await d();let n=e.parts[0],r=W(t.items,0);if(r.length===0)throw new Error("isobmff trim: no usable trim ranges in items");let i=await V(r,t.handles,(o,c)=>H(u(n),n.fileSize,o,c,e.format));return i.map((o,c)=>{let a=JSON.parse(o);return i.length>1&&(a.output_clip_number=c+1,a.output_clip_count=i.length,a.output_part_number=1),a})},async decode(e,t,n){await d();let r=n.detail==="coarse",i=e.parts[0];if(e.format==="crm"){let l=await R(u(i),i.fileSize,t,r?"preview":"full");return s(l)}let o=await Y(e);if(t<0||t>=o.length)throw new _(t,o.length);let c=o[t],a=await i.read(c.offset,c.size);if(e.format==="braw")return s(r?v(a,0):y(a));if(b(a)){let l=await q(e);return s(l?m.decode_prores_raw_tier(a,r?"preview":"full",l):r?P(a,0):x(a))}if(j(a))return s(r?D(a,0):z(a));if(r)return s(S(a,0));let g=await ae(a);return g||s(A(a))},async decode16(e,t){await d();let n=e.parts[0];if(e.format==="crm")throw new Error("crm: no 16-bit decoder");let r=await Y(e);if(t<0||t>=r.length)throw new _(t,r.length);let i=r[t],o=await n.read(i.offset,i.size),c=b(o)?await q(e):null,a=e.format==="braw"?w(o):b(o)?c?m.decode_prores_raw_tier(o,"rgb16",c):M(o):j(o)?(()=>{throw new Error("vc3: no 16-bit decoder")})():F(o);return $(a)}};async function ae(e){if(!U)return null;try{let t=await import("./prores-RIG37OIH.js");if(!await t.proresGpuAvailable())return null;let n=await t.decodeProResRgbaGpu(e);return n?{width:n.width,height:n.height,rgba:n.rgba}:null}catch{return null}}function j(e){return e.length>=4&&e[0]===0&&e[1]===0&&e[2]===2&&e[3]===128}function b(e){return e.length>=8&&e[4]===112&&e[5]===114&&e[6]===114&&e[7]===102}function s(e){let t=new DataView(e.buffer,e.byteOffset,8);return{width:t.getUint32(0,!0),height:t.getUint32(4,!0),rgba:e.slice(8)}}var m=C,X=new WeakMap;function q(e){let t=X.get(e);if(!t){let n=e.parts[0];t=m.prores_raw_container_color&&m.decode_prores_raw_tier?N({fileSize:n.fileSize,read:n.read}).then(r=>{let i=m.prores_raw_container_color(r);return i.length?i:null}):Promise.resolve(null),X.set(e,t)}return t}var K=new WeakMap;async function Y(e){let t=K.get(e);if(!t){let n=e.parts[0],r=J(await k(u(n),n.fileSize,e.format));if(!r.w||!r.h)throw new Error("could not find a video sample table");t=r.offs,K.set(e,t)}return t}export{be as isobmffFormat};
@@ -1,44 +0,0 @@
1
- """CONFORM.TOOLS for Nuke Studio / Hiero - the startup script.
2
-
3
- Nuke Studio / Hiero import every `.py` in `<plugin path>/Python/Startup` at
4
- launch (`~/.nuke/Python/Startup`, or any folder on `NUKE_PATH`; the older
5
- `HIERO_PLUGIN_PATH` still works). This file puts its sibling `Python/` folder
6
- on `sys.path` (where `conformtools_nuke/` and the vendored `ctpeer/` live),
7
- then adds the CONFORM.TOOLS menu + dockable panel, and connects to the app if
8
- the user turned on "Connect automatically".
9
-
10
- Plain Nuke (no Studio / Hiero timeline) has no `hiero.ui`; then nothing is
11
- installed.
12
- """
13
-
14
- import os
15
- import sys
16
-
17
- _PYTHON = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
18
- if _PYTHON not in sys.path:
19
- sys.path.insert(0, _PYTHON)
20
-
21
-
22
- def _start():
23
- try:
24
- import hiero # type: ignore
25
- import hiero.ui # type: ignore # noqa: F401 (absent in plain Nuke)
26
- except ImportError:
27
- return None
28
- from conformtools_nuke import panel
29
-
30
- ctl = panel.controller(hiero)
31
- try:
32
- panel.install_ui(ctl, hiero)
33
- except Exception as e: # the timeline app must start even if the panel cannot
34
- print(f"[CONFORM.TOOLS] panel unavailable: {e}", file=sys.stderr)
35
- try:
36
- hiero.core.events.registerInterest("kAfterProjectLoad", lambda event: ctl.project_changed())
37
- except Exception:
38
- pass
39
- if ctl.auto_connect:
40
- ctl.connect()
41
- return ctl
42
-
43
-
44
- _start()
@@ -1,10 +0,0 @@
1
- """CONFORM.TOOLS host plugin for Foundry Nuke Studio / Hiero.
2
-
3
- `verbs.NukePeer` answers the host-bridge capability verbs from `hiero.core`;
4
- `panel.Controller` owns the bridge connection; `panel.install_ui` adds the
5
- dockable status panel and the CONFORM.TOOLS menu. The startup script
6
- (`Python/Startup/conformtools_nuke_startup.py`) wires it up when Nuke Studio
7
- or Hiero starts.
8
- """
9
-
10
- __version__ = "0.1.0"
@@ -1,217 +0,0 @@
1
- """The panel's controller (the bridge connection + one preference), the
2
- dockable status panel, and the menu entries.
3
-
4
- Every `hiero` call a request makes goes through
5
- `hiero.core.executeInMainThreadWithResult` (Foundry: methods on objects
6
- attached to a project throw off the main thread); the bridge client's own
7
- threads only wait. Requests reach `verbs.NukePeer` methods by exact name
8
- through `ctpeer.Dispatcher` and nothing else is ever run.
9
- """
10
-
11
- from __future__ import annotations
12
-
13
- import json
14
- import os
15
- import sys
16
- from typing import Any, Callable, Dict, List, Optional
17
-
18
- from ctpeer import BridgeClient
19
-
20
- from . import __version__
21
- from .verbs import CAPABILITIES, OPTIONAL_VERBS, NukePeer
22
-
23
- TITLE = "CONFORM.TOOLS"
24
- PANEL_ID = "app.conform.tools.panel"
25
- PREFS_ENV = "CONFORM_TOOLS_NUKE_PREFS"
26
-
27
-
28
- def prefs_path() -> str:
29
- return os.environ.get(PREFS_ENV) or os.path.join(os.path.expanduser("~"), ".conformtools", "nuke_panel.json")
30
-
31
-
32
- def load_prefs(path: Optional[str] = None) -> Dict[str, Any]:
33
- try:
34
- with open(path or prefs_path(), "r", encoding="utf-8") as f:
35
- data = json.load(f)
36
- return data if isinstance(data, dict) else {}
37
- except (OSError, ValueError):
38
- return {}
39
-
40
-
41
- def save_prefs(prefs: Dict[str, Any], path: Optional[str] = None) -> None:
42
- path = path or prefs_path()
43
- os.makedirs(os.path.dirname(path), exist_ok=True)
44
- with open(path, "w", encoding="utf-8") as f:
45
- json.dump(prefs, f, indent=2)
46
-
47
-
48
- class Controller:
49
- def __init__(self, hiero: Any, client_factory: Callable[..., BridgeClient] = BridgeClient,
50
- prefs_file: Optional[str] = None, read_pairing: Optional[Callable[[], Dict[str, Any]]] = None):
51
- self.hiero = hiero
52
- self.client_factory = client_factory
53
- self.prefs_file = prefs_file
54
- self.read_pairing = read_pairing
55
- self.client: Optional[BridgeClient] = None
56
- self.peer: Optional[NukePeer] = None
57
- self.lines: List[str] = []
58
- self.listeners: List[Callable[[str, str], None]] = []
59
-
60
- @property
61
- def auto_connect(self) -> bool:
62
- return bool(load_prefs(self.prefs_file).get("auto_connect", False))
63
-
64
- def set_auto_connect(self, on: bool) -> None:
65
- prefs = load_prefs(self.prefs_file)
66
- prefs["auto_connect"] = bool(on)
67
- save_prefs(prefs, self.prefs_file)
68
-
69
- def log(self, line: str) -> None:
70
- self.lines = (self.lines + [line])[-200:]
71
- print(f"[{TITLE}] {line}", file=sys.stderr)
72
-
73
- def _on_state(self, state: str, detail: str) -> None:
74
- for fn in list(self.listeners):
75
- try:
76
- fn(state, detail)
77
- except Exception:
78
- pass
79
-
80
- @property
81
- def running(self) -> bool:
82
- return self.client is not None
83
-
84
- def host_info(self) -> Dict[str, Any]:
85
- env = getattr(self.hiero.core, "env", {}) or {}
86
- version = str(env.get("VersionString") or env.get("VersionMajor") or "")
87
- return {"id": "nuke", "name": "Nuke Studio", "version": version, "platform": sys.platform, "plugin_version": __version__}
88
-
89
- def run_on_main(self, fn: Callable[[], Any]) -> Any:
90
- return self.hiero.core.executeInMainThreadWithResult(fn)
91
-
92
- def connect(self) -> BridgeClient:
93
- if self.client is not None:
94
- return self.client
95
- self.peer = NukePeer(self.hiero)
96
- kwargs: Dict[str, Any] = {}
97
- if self.read_pairing is not None:
98
- kwargs["read_pairing"] = self.read_pairing
99
- self.client = self.client_factory(
100
- host=self.host_info(), capabilities=CAPABILITIES, optional_verbs=OPTIONAL_VERBS, verbs=self.peer.verbs(),
101
- run_on_main=self.run_on_main, log=self.log, on_state=self._on_state, **kwargs)
102
- self.client.start()
103
- return self.client
104
-
105
- def disconnect(self) -> None:
106
- client, self.client = self.client, None
107
- if client is not None:
108
- client.stop()
109
- self._on_state("stopped", "")
110
-
111
- def status(self) -> str:
112
- if self.client is None:
113
- return "Not connected"
114
- return {"connected": "Connected to CONFORM.TOOLS", "unpaired": "Waiting for the app - turn on its Host Bridge (Settings)",
115
- "connecting": "Connecting...", "hello": "Connecting...", "refused": f"Refused by the app ({self.client.detail})",
116
- "closed": "Waiting for the app"}.get(self.client.state, self.client.state)
117
-
118
- def project_changed(self) -> None:
119
- if self.peer is not None:
120
- self.peer.handles.clear()
121
- if self.client is not None:
122
- self.client.event("project_changed", {})
123
-
124
-
125
- # ── Qt: the status panel and the menu ──────────────────────────────────────
126
-
127
-
128
- def qt() -> Any:
129
- """PySide6 (Nuke 16) or PySide2 (Nuke 15), as one namespace."""
130
- try:
131
- from PySide6 import QtCore, QtGui, QtWidgets # type: ignore
132
- action = QtGui.QAction
133
- except ImportError:
134
- from PySide2 import QtCore, QtGui, QtWidgets # type: ignore
135
- action = QtWidgets.QAction
136
- ns = type("Qt", (), {})()
137
- ns.QtCore, ns.QtGui, ns.QtWidgets, ns.QAction = QtCore, QtGui, QtWidgets, action
138
- return ns
139
-
140
-
141
- def build_panel(ctl: Controller, Q: Any) -> Any:
142
- """The dockable panel: status line, Connect / Disconnect, the
143
- auto-connect checkbox. Polls the controller on a main-thread QTimer, so
144
- no Qt object is ever touched from the bridge's threads."""
145
- W = Q.QtWidgets
146
- widget = W.QWidget()
147
- widget.setObjectName(PANEL_ID)
148
- widget.setWindowTitle(TITLE)
149
- layout = W.QVBoxLayout(widget)
150
- status = W.QLabel(ctl.status())
151
- button = W.QPushButton("Connect")
152
- auto = W.QCheckBox("Connect automatically when Nuke Studio starts")
153
- auto.setChecked(ctl.auto_connect)
154
- for w in (status, button, auto):
155
- layout.addWidget(w)
156
-
157
- def refresh() -> None:
158
- status.setText(ctl.status())
159
- button.setText("Disconnect" if ctl.running else "Connect")
160
-
161
- def toggle() -> None:
162
- ctl.disconnect() if ctl.running else ctl.connect()
163
- refresh()
164
-
165
- button.clicked.connect(toggle)
166
- auto.toggled.connect(lambda on: ctl.set_auto_connect(bool(on)))
167
- timer = Q.QtCore.QTimer(widget)
168
- timer.timeout.connect(refresh)
169
- timer.start(500)
170
- widget._ct_refresh = refresh # kept alive with the widget; used by tests
171
- widget._ct_timer = timer
172
- return widget
173
-
174
-
175
- def install_ui(ctl: Controller, hiero: Any, Q: Optional[Any] = None) -> Dict[str, Any]:
176
- """Register the panel with Hiero's window manager (Window menu, dockable)
177
- and add CONFORM.TOOLS > Connect / Disconnect / Show Panel actions."""
178
- Q = Q or qt()
179
- ui = hiero.ui
180
- app_cls = getattr(Q.QtWidgets, "QApplication", None)
181
- if app_cls is not None and app_cls.instance() is None:
182
- raise RuntimeError("no Qt application (Nuke Studio running without a GUI)")
183
- panel = build_panel(ctl, Q)
184
- try:
185
- ui.windowManager().addWindow(panel)
186
- except Exception as e:
187
- ctl.log(f"panel not docked: {e}")
188
- actions = {}
189
- for label, fn in (("Connect", ctl.connect), ("Disconnect", ctl.disconnect),
190
- ("Show Panel", lambda: _show(ui, panel))):
191
- act = Q.QAction(f"{label}", None)
192
- act.triggered.connect(lambda checked=False, f=fn: f())
193
- try:
194
- ui.addMenuAction(TITLE, act)
195
- except Exception as e:
196
- ctl.log(f"menu action {label} not added: {e}")
197
- actions[label] = act
198
- return {"panel": panel, "actions": actions}
199
-
200
-
201
- def _show(ui: Any, panel: Any) -> None:
202
- try:
203
- ui.windowManager().showWindow(panel)
204
- except Exception:
205
- panel.show()
206
-
207
-
208
- _controller: Optional[Controller] = None
209
-
210
-
211
- def controller(hiero: Any = None) -> Controller:
212
- global _controller
213
- if _controller is None:
214
- if hiero is None:
215
- import hiero # type: ignore # the real package, inside Nuke Studio only
216
- _controller = Controller(hiero)
217
- return _controller