conformtools 0.6.7 → 0.6.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{account-DJTD3KYK.js → account-M53GEV7P.js} +1 -1
- package/dist/{bridge-JQF4V3V2.js → bridge-SX5TW4LC.js} +1 -1
- package/dist/{chunk-P2LL3JMC.js → chunk-5BSXYKLN.js} +1 -1
- package/dist/{chunk-SNTAZJ5A.js → chunk-623EA3TK.js} +1 -1
- package/dist/{chunk-S5JDS5PQ.js → chunk-DQGINJDV.js} +1 -1
- package/dist/{chunk-55BKURYP.js → chunk-GRQJGEGV.js} +4 -4
- package/dist/{chunk-SKFMOLUO.js → chunk-GTJ3EM6H.js} +1 -1
- package/dist/{chunk-XLEINKFL.js → chunk-HNBA43BF.js} +1 -1
- package/dist/{chunk-EUBXH67N.js → chunk-MWDF2R26.js} +2 -2
- package/dist/{chunk-5WEZRGXG.js → chunk-QVH44I66.js} +2 -2
- package/dist/chunk-XCKQHL4G.js +9 -0
- package/dist/cli.js +1 -1
- package/dist/{framing-SWOD4CWB.js → framing-3XIVHSUZ.js} +1 -1
- package/dist/{host-relink-TWAF6WIG.js → host-relink-UWML4C7W.js} +1 -1
- package/dist/{hosts-Z666EF7V.js → hosts-SRS5TEM6.js} +1 -1
- package/dist/http.js +2 -2
- package/dist/mcp.js +1 -1
- package/dist/{store-7IOEBOZY.js → store-53BBZBND.js} +1 -1
- package/dist/{timeline-DQG6TVPF.js → timeline-C3OZJBCZ.js} +1 -1
- package/package.json +1 -1
- package/dist/chunk-NAFLOZER.js +0 -9
|
@@ -0,0 +1,9 @@
|
|
|
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-PHAMF4JF.js";import{A as K,I as X,L as Y,O as H,P as q,Q as V,Y as u,b as l,f as F,g as x,k as g,l as J,p as N,r as G,s as z,v as y,x as $,y as C,z as v}from"./chunk-PLRB2YXJ.js";var _={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}},indie:{id:"indie",name:"MCP",monthly:49,yearly:490,stripe:{monthly:"price_1T5XDXJ5lnla0aaLasKq49tm",yearly:"price_1T5XDXJ5lnla0aaL2MdMSuI9"},includes:{web:!0,mcp:!0,app:!1}},pro:{id:"pro",name:"App",monthly:199,yearly:1990,stripe:{monthly:"price_1T5X8oJ5lnla0aaLyNJa93H0",yearly:"price_1T5X8oJ5lnla0aaL3dh7b1el"},includes:{web:!0,mcp:!0,app:!0}},studio:{id:"studio",name:"Studio",monthly:"custom",yearly:"custom",stripe:{monthly:"price_1T5X7xJ5lnla0aaLoeE1aBlL",yearly:"price_1T5X7xJ5lnla0aaLeBiYo3Di"},includes:{web:!0,mcp:!0,app:!0}}},Z={web:!0,mcp:!1,app:!1};var Ne=Object.fromEntries(Object.values(_).flatMap(e=>Object.values(e.stripe).map(n=>[n,e.id])));import{createPrivateKey as De,createPublicKey as fe,sign as Te,verify as ge}from"node:crypto";import{Buffer as w}from"node:buffer";var he="CONFORMTOOLS_LICENSE_V1",W=/^[0-9A-F]{8}(-[0-9A-F]{8}){3}$/,Q=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 n=e.split(/\r?\n/).map(r=>r.trim()).filter(r=>r&&!r.startsWith("#")&&!r.startsWith("-----")).join(""),t=JSON.parse(w.from(n,"base64").toString("utf8"));if(t?.magic!==he||!t.payload?.data)throw new Error("not a conform.tools licence");return t.payload}function ne(e,n){let t=w.from(e.signature,"base64"),r=w.from(Q(e.data));return t.length!==64?!1:n.some(i=>ge(null,r,fe({key:w.concat([w.from("302a300506032b6570032100","hex"),w.from(i)]),format:"der",type:"spki"}),t))}async function D(){let e=x()==="win32"?"conformtools-analyze.exe":"conformtools-analyze",n=[l("CONFORM_ANALYZE"),N(new URL(`./${e}`,import.meta.url)),N(new URL(`../../rust/target/release/${e}`,import.meta.url))].filter(Boolean);for(let t of n)if(await z(t))return t;return null}var te=e=>e.code==="not_entitled"?new h("not_entitled",String(e.why)):void 0;async function Be(e){let n=await re(),t=await n.ask({op:"job",reference:e.reference,clips:e.clips,lite:e.lite??!0,display:!!e.display});if(!t.ok)throw n.close(),te(t)??new Error(`analysis engine: ${t.why}`);return n}async function Fe(e,n,t){let r=await re(),i=()=>r.close();t?.addEventListener("abort",i);let o;try{o=await r.ask(e,n)}finally{t?.removeEventListener("abort",i),r.close()}if(t?.aborted)throw new Error("cancelled");if(!o.ok)throw te(o)??new Error(o.why??`the analysis engine could not run ${e.op}`);return o}async function re(){let e=await D();if(!e)throw new Error("the analysis engine (conformtools-analyze) is not installed");let n="",t=null,r=H(e,["serve"],s=>{n+=new TextDecoder().decode(s);let d;for(;(d=n.indexOf(`
|
|
4
|
+
`))>=0;){let m=n.slice(0,d);n=n.slice(d+1);let c=JSON.parse(m);if(c.progress){t?.progress?.(c.progress[0],c.progress[1],c.phase??"");continue}let p=t;t=null,p?.done(c)}},s=>console.error(s.trimEnd()));r.exited.then(()=>t?.done({ok:!1,why:"the analysis engine exited"}));let i=Promise.resolve();return{ask:(s,d)=>{let m=i.then(async()=>{r.hold(!0);try{let c=new Promise(f=>{t={done:f,progress:d}});await r.write(new TextEncoder().encode(JSON.stringify(s)+`
|
|
5
|
+
`));let p=await c;return p.miss&&(console.error(`[mirror] MISS \u2014 ${p.miss} is not in the mirror. Replay never reads the source drive; record this case again with the drive mounted (CONFORM_MIRROR_MODE=record).`),F(75)),p}finally{r.hold(!1)}});return i=m.catch(()=>{}),m},close:()=>r.close()}}var ye=["cMwVBrEYKMzlG6pC7FF2lNKIoEqGz2xB5yph6clNnTg=","qnheqkkDU09l1oI6h2CFh4uQ97bY/hkTA5niGKH0+X8="],_e=ye.map(e=>Uint8Array.from(atob(e),n=>n.charCodeAt(0)));function A(){let e=l("CONFORM_RECORDS_DIR");if(e)return e;let n=J(),t=x()==="darwin"?u(n,"Library/Application Support"):x()==="win32"?l("LOCALAPPDATA")??u(n,"AppData/Local"):l("XDG_DATA_HOME")??u(n,".local/share");return u(t,"conform.tools")}var we=()=>l("CONFORM_LICENSE_PATH")??u(A(),"license.lic"),k=()=>u(A(),"grant.lic"),be=null;function T(){return be??=(async()=>{let e=await D();if(!e)return[];let n=await Y(e,["machine"],{timeoutMs:15e3}).catch(()=>null);try{return JSON.parse(n?.stdout??"").machines.filter(t=>W.test(t))}catch{return[]}})()}function xe(e,n,t=Date.now()){if(!ne(e,_e))return{ok:!1,reason:"invalid licence signature"};let r=Date.parse(e.data.expires_at);return!Number.isFinite(r)||r<t?{ok:!1,reason:`licence expired ${e.data.expires_at}`}:[n??[]].flat().includes(e.data.machine_fingerprint)?{ok:!0,data:e.data}:{ok:!1,reason:"licence is for another machine"}}async function ie(){let e;try{e=await y(we())}catch{return null}try{return xe(ee(e),await T())}catch(n){return{ok:!1,reason:n.message}}}var ve={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=l("CONFORM_ENV")==="staging"?"staging":"production",n=ve[e];return{env:e,supabaseUrl:l("CONFORM_SUPABASE_URL")??n.supabaseUrl,anonKey:l("CONFORM_SUPABASE_ANON_KEY")??n.anonKey,appBase:l("CONFORM_APP_BASE")??n.appBase}}var Se=600*1e3,oe=72*3600*1e3,Pe=300*1e3,P=()=>u(g(),a().env==="production"?"auth.json":`auth-${a().env}.json`);async function M(){for(let e of new Set([P(),u(g(),"auth.json")]))try{let n=JSON.parse(await y(e));if(n.env===a().env&&n.access_token)return n}catch{}return null}async function Ee(){try{for await(let e of X(g())){if(!/^auth(?:-(\w+))?\.json$/.exec(e.name))continue;let t=JSON.parse(await y(u(g(),e.name)));if(t.access_token&&t.env&&t.env!==a().env)return{other_env:t.env}}}catch{}return{}}async function R(e){await C(g()),await $(P(),JSON.stringify(e)),await K(P(),384)}var se=6e3,E=0,ce=()=>Date.now()<E,le=()=>{E=Date.now()+6e4};function We(){E=0}async function ue(e){if(e.expires_at-60>Date.now()/1e3)return e.access_token;if(ce())return null;let n=a();try{let t=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(se)}).catch(i=>{throw le(),i});if(!t.ok)return t.status===400||t.status===401?"":null;let r=await t.json();return e.access_token=r.access_token,r.refresh_token&&(e.refresh_token=r.refresh_token),e.expires_at=r.expires_at??Math.floor(Date.now()/1e3)+(r.expires_in??3600),await R(e),e.access_token}catch{return null}}async function Qe(){let e=await M();return e&&await ue(e)||null}var b=null;function ae(e,n){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:n,...e.entitled?{}:{reason:"not_entitled"},...e.invite_only?{invite_only:!0}:{}}}async function pe(e={}){let n=await ie();if(n?.ok)return{signed_in:!!await M().catch(()=>null),entitled:!0,env:a().env,email:n.data.email,access:"licence",tier:n.data.tier,source:"licence"};let t=await Ae(e);return n&&!t.entitled?{...t,licence_error:n.reason}:t}async function Ae(e){if(!e.force&&b&&Date.now()-b.at<Se)return{...b.status,source:"cache"};let n=a(),t=await M();if(!t)return{signed_in:!1,entitled:!1,env:n.env,reason:"not_signed_in",...await Ee()};let r=await ue(t);if(r==="")return{signed_in:!0,entitled:!1,env:n.env,reason:"auth_rejected"};if(r&&!ce())try{let i=(await T())[0],o=await fetch(`${n.supabaseUrl}/functions/v1/v1-billing/v1/billing/entitlement${i?`?machine=${i}`:""}`,{headers:{authorization:`Bearer ${r}`,apikey:n.anonKey},signal:AbortSignal.timeout(se)}).catch(s=>{throw le(),s});if(o.status===401||o.status===403)return{signed_in:!0,entitled:!1,env:n.env,reason:"auth_rejected"};if(o.ok){let{grant:s,...d}=(await o.json()).data;i&&await ke(s),t.last_entitlement=d,t.last_entitlement_at=Date.now(),await R(t);let m=ae(d,"live");return b={at:Date.now(),status:m},m}}catch{}if(t.last_entitlement&&t.last_entitlement_at&&Date.now()-t.last_entitlement_at<oe){let i=oe-(Date.now()-t.last_entitlement_at);return{...ae(t.last_entitlement,"grace"),grace_remaining_h:Math.round(i/36e4)/10}}return{signed_in:!0,entitled:!1,env:n.env,reason:"offline_grace_expired"}}async function ke(e){try{if(!e)return await v(k());await C(A()),await $(k(),e)}catch{}}function Oe(e){return e.source==="licence"?`${e.email} \xB7 machine licence (${e.tier}) \u2014 runs offline, no account check`:Le(e)+(e.licence_error?`
|
|
6
|
+
(the machine licence was not used: ${e.licence_error})`:"")}function Le(e){let n=a();if(!e.signed_in)return`not signed in (${n.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 t=`${e.email??"(unknown email)"} \xB7 ${n.env}`;if(!e.entitled&&e.invite_only)return`${t}
|
|
7
|
+
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`${t}
|
|
8
|
+
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 ${n.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=O(e),o=i?` \xB7 includes ${[i.web&&"the web tools",i.mcp&&"the MCP",i.app&&"the app"].filter(Boolean).join(", ")||"the web tools"}`:"";return`${t}
|
|
9
|
+
${r}${o}${e.source==="grace"?` \u2014 offline, using the last check (${e.grace_remaining_h} h of grace left)`:""}`}function O(e){if(e.access==="trial")return Z;let n=(e.tier??"").toLowerCase();return(n==="enterprise"?_.studio:_[n])?.includes??null}var de=()=>pe();function en(e){de=e}async function me(){let e=await de();if(e.entitled)return e;let n=e.signed_in&&e.reason==="not_entitled"?"not_entitled":"not_signed_in";throw new h(n,Oe(e),{account:e})}async function nn(){let e=await me();if(e.source==="licence"||O(e)?.mcp!==!1)return e;throw new h("not_entitled",`The conform.tools MCP is in the MCP plan ($${_.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 tn(){let e=await me();if(e.source==="licence"||O(e)?.app)return e;throw new h("not_entitled",`The conform.tools app is in the App plan ($${_.pro.monthly}/mo). ${e.access==="trial"?"Your trial":`Your plan${e.tier?` (${e.tier})`:""}`} does not include the app${O(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 S=null;function rn(e={}){if(S)return S;let n=a(),t=crypto.randomUUID().replaceAll("-","");return S=new Promise((r,i)=>{let o=!1,s=c=>{o||(o=!0,clearTimeout(m),setTimeout(()=>d.close(),250),S=null,c())},d=V({hostname:"127.0.0.1",port:0,onListen:async c=>{let p=`${n.appBase}/plugin-auth?client=engine&port=${c}&state=${t}`,f=await q(p);e.onUrl?.(p,f)}},async c=>{let p=new URL(c.url);if(p.pathname!=="/callback")return new Response("not found",{status:404});let f=p.searchParams,U=f.get("access_token")??"",j=f.get("refresh_token")??"",L=!!U&&!!j&&f.get("state")===t;if(L){let B=Number(f.get("expires_at"));await R({env:n.env,access_token:U,refresh_token:j,expires_at:B>0?B:Math.floor(Date.now()/1e3)+3600}),b=null,E=0,pe({force:!0}).then(I=>s(()=>r(I)),I=>s(()=>i(I)))}return new Response(Ie(L),{status:L?200:400,headers:{"content-type":"text/html; charset=utf-8"}})}),m=setTimeout(()=>s(()=>i(new h("not_signed_in","sign-in was not completed within 5 minutes"))),e.timeoutMs??Pe)}),S}async function on(){b=null,E=0,await G(P())&&await v(P()),await v(k()).catch(()=>{});let e=u(g(),"auth.json");try{JSON.parse(await y(e)).env===a().env&&await v(e)}catch{}}function Ie(e){let[n,t]=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'>${n}</div><div style='margin-top:6px;color:#6e6e73'>${t}</div></div></body>`}export{Be as a,Fe as b,re as c,a as d,se as e,We as f,Qe as g,pe as h,Oe as i,O as j,en as k,me as l,nn as m,tn as n,rn as o,on as p};
|
package/dist/cli.js
CHANGED
|
@@ -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{$ as V,V as J,X as H,Y as F,_ as G}from"./chunk-
|
|
3
|
+
import{$ as V,V as J,X as H,Y as F,_ as G}from"./chunk-GRQJGEGV.js";import"./chunk-DQGINJDV.js";import"./chunk-HNBA43BF.js";import"./chunk-MWDF2R26.js";import"./chunk-623EA3TK.js";import"./chunk-TXQR2HI2.js";import{J as L}from"./chunk-QVH44I66.js";import{a as A}from"./chunk-5BSXYKLN.js";import"./chunk-GM6QKY7W.js";import"./chunk-PFISREY4.js";import"./chunk-JV7TZDKJ.js";import"./chunk-VIBEEWPC.js";import"./chunk-PFZVET7S.js";import"./chunk-6V4OEOOX.js";import"./chunk-RGMTLNMF.js";import"./chunk-D4WPRRBT.js";import"./chunk-WN53ARHJ.js";import"./chunk-A7FNR3T5.js";import"./chunk-J2JXLEAI.js";import"./chunk-SGLQY53R.js";import"./chunk-DKGGJM6Z.js";import"./chunk-D6YDLKSA.js";import"./chunk-AMRJXYL4.js";import"./chunk-3D3Z4TBR.js";import"./chunk-2BPR6LK6.js";import"./chunk-GK4YYKJ6.js";import{b as W}from"./chunk-NU3X7P4N.js";import"./chunk-RJ6JA2LZ.js";import"./chunk-GTJ3EM6H.js";import{h as D,i as I}from"./chunk-XCKQHL4G.js";import"./chunk-PHAMF4JF.js";import{b as T,e as c,f as s}from"./chunk-PLRB2YXJ.js";import"./chunk-C2ESM27Z.js";import"./chunk-PSANHDZM.js";var i=process.stdout,C=22,E=20,R=E/2,Y=(t,n)=>Math.abs(n)<=Math.min(1-.417*Math.abs(t),2.393*(1-Math.abs(t))),nt=(t,n)=>t*t+n*n<=1;function et(t){let n=.62**-t,l=[];for(let r=0;r<E;r++){let g=[];for(let p=0;p<C;p++){let w=(p+.5)/C*2-1,u=(r+.5)/E*2-1,d=!1;if(Y(w,u))for(let $=0;$<6;$++)for(let y of[!1,!0]){let m=.62**$*(y?.77:1)*n,x=.5*Math.max(0,1-m)**2;(y?nt:Y)(w/m,(u-x)/m)&&(d=!y)}g.push(d)}l.push(g)}return l}var M={C:["\u25E2\u2588\u25E3","\u2588 ","\u2588 ","\u25E5\u2588\u25E4"],O:["\u25E2\u2588\u25E3","\u2588 \u2588","\u2588 \u2588","\u25E5\u2588\u25E4"],N:["\u2588\u25E3 \u2588","\u2588\u2588\u25E3\u2588","\u2588\u25E5\u2588\u2588","\u2588 \u25E5\u2588"],F:["\u2588\u2588\u2588","\u2588\u2584\u2584","\u2588 ","\u2588 "],R:["\u2588\u2588\u25E3","\u2588 \u2588","\u2588\u2588\u25E4","\u2588 \u2588"],M:["\u2588\u25E3\u25E2\u2588","\u2588\u25E5\u25E4\u2588","\u2588 \u2588","\u2588 \u2588"],T:["\u2588\u2588\u2588"," \u2588 "," \u2588 "," \u2588 "],L:["\u2588 ","\u2588 ","\u2588 ","\u2588\u2588\u2588"],S:["\u25E2\u2588\u25E3","\u25E5\u25E3 "," \u25E5\u25E3","\u25E5\u2588\u25E4"],".":[" "," "," ","\u25CF"]},B="CONFORM.TOOLS",rt=[...B].reduce((t,n)=>t+M[n][0].length+1,-1);async function K(t){if(!i.isTTY)return!1;let n=!!T("NO_COLOR"),l=/truecolor|24bit/i.test(T("COLORTERM")??""),r=o=>e=>n?e:`\x1B[${o}m${e}\x1B[0m`,g=r(l?"38;2;255;60;0":"38;5;202"),p=r(l?"38;2;255;222;0":"38;5;220"),w=r("1"),u=r("2"),d=(i.columns??80)>=C+4+rt,$=o=>[...B].map(e=>e==="."?g(M[e][o]):w(M[e][o])).join(" "),y=(o,e)=>d&&o>=2&&o<=5?$(o-2):!d&&o===3?`${w("conform")}${g(".")}${w("tools")}`:o===7?e:"",m=(o,e,O=[])=>{let S=et(o),_=[];for(let f=0;f<R;f++){let Z=S[2*f].map((N,ot)=>{let k=S[2*f+1][ot];return N&&k?"\u2588":N?"\u2580":k?"\u2584":" "}).join(""),tt=f>=8?O[f-8]??"":"";_.push(` ${g(Z)} ${tt||y(f,e)}\x1B[K`)}return _.join(`
|
|
4
4
|
`)+`
|
|
5
5
|
`},x=null;t.account.then(o=>{x=o});let P=o=>W(o,24),U=!T("CI")&&T("TERM")!=="dumb";if(i.write(`
|
|
6
6
|
`),U){let o=()=>i.write("\x1B[?25h");process.once("SIGINT",()=>{o(),process.exit(130)}),i.write("\x1B[?25l"+m(0,p(`\u25B6 ${P(0)}`)));let e=Date.now(),O=0;for(;x===null||Date.now()-e<900;)await new Promise(S=>setTimeout(S,1e3/24)),O=Math.round((Date.now()-e)*24/1e3),i.write(`\x1B[${R}A\r`+m(O/22%1,`${p(`\u25B6 ${P(O)}`)} ${u("checking your account\u2026")}`));i.write(`\x1B[${R}A\r`),o()}let X=(x??await t.account).split(`
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
import{f as a,g as b,h as c,i as d,j as e,k as f,l as g,m as h,n as i,o as j,p as k,q as l}from"./chunk-
|
|
3
|
+
import{f as a,g as b,h as c,i as d,j as e,k as f,l as g,m as h,n as i,o as j,p as k,q as l}from"./chunk-HNBA43BF.js";import"./chunk-QVH44I66.js";import"./chunk-PFISREY4.js";import"./chunk-JV7TZDKJ.js";import"./chunk-VIBEEWPC.js";import"./chunk-PFZVET7S.js";import"./chunk-6V4OEOOX.js";import"./chunk-RGMTLNMF.js";import"./chunk-D4WPRRBT.js";import"./chunk-WN53ARHJ.js";import"./chunk-A7FNR3T5.js";import"./chunk-J2JXLEAI.js";import"./chunk-SGLQY53R.js";import"./chunk-DKGGJM6Z.js";import"./chunk-AMRJXYL4.js";import"./chunk-3D3Z4TBR.js";import"./chunk-2BPR6LK6.js";import"./chunk-NU3X7P4N.js";import"./chunk-RJ6JA2LZ.js";import"./chunk-XCKQHL4G.js";import"./chunk-PHAMF4JF.js";import"./chunk-PLRB2YXJ.js";import"./chunk-C2ESM27Z.js";import"./chunk-PSANHDZM.js";export{i as ASPECTS,a as INPUT_SCALING,e as SIZING_TARGETS,h as alignText,g as alignTimeline,j as aspectOf,k as blankingQc,l as blankingText,c as inputFitRatio,f as offlineLane,d as resolveProps,b as scalingOf};
|
|
@@ -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 C}from"./chunk-
|
|
3
|
+
import{a as C}from"./chunk-DQGINJDV.js";import{c as D}from"./chunk-623EA3TK.js";import{L as A,O as P,V as N,Y as q}from"./chunk-QVH44I66.js";import"./chunk-5BSXYKLN.js";import"./chunk-PFISREY4.js";import"./chunk-JV7TZDKJ.js";import{k as M}from"./chunk-VIBEEWPC.js";import"./chunk-PFZVET7S.js";import"./chunk-6V4OEOOX.js";import"./chunk-RGMTLNMF.js";import"./chunk-D4WPRRBT.js";import"./chunk-WN53ARHJ.js";import"./chunk-A7FNR3T5.js";import"./chunk-J2JXLEAI.js";import"./chunk-SGLQY53R.js";import"./chunk-DKGGJM6Z.js";import"./chunk-AMRJXYL4.js";import"./chunk-3D3Z4TBR.js";import"./chunk-2BPR6LK6.js";import{b as F}from"./chunk-NU3X7P4N.js";import"./chunk-RJ6JA2LZ.js";import"./chunk-XCKQHL4G.js";import"./chunk-PHAMF4JF.js";import{H as x,I as E,V as U,W as R,Y as k,m as O,q as S}from"./chunk-PLRB2YXJ.js";import"./chunk-C2ESM27Z.js";import"./chunk-PSANHDZM.js";var y=s=>{let i=s?.target_url??s?.local_path??"";return i.startsWith("file://")?O(i):i};async function H(s,i){let a=await s.items({timeline:i,kind:"video"}),r=a.items.map(m=>`${m.kind}:${m.track}:${m.start}:${m.end-m.start}`),c=async m=>{let l=await D(m,a.timeline).catch(()=>null);if(!l||!r.every(p=>l.has(p)))return null;let{session:h}=await P(m,"prproj"),u=h.timelines.find(p=>p.name===a.timeline);return u?z(h,u):null};if(a.project_path){let m=await c(a.project_path);if(m)return await T(m),{session:m,from:"the saved project (matches the live sequence)",path:a.project_path};let l=k(R(a.project_path),"Adobe Premiere Pro Auto-Save"),h=U(a.project_path).replace(/\.prproj$/i,""),u=[];try{for await(let p of E(l))p.isFile&&p.name.startsWith(`${h}--`)&&p.name.endsWith(".prproj")&&u.push({path:k(l,p.name),mtime:(await S(k(l,p.name))).mtime?.getTime()??0})}catch{}for(let p of u.sort((g,_)=>_.mtime-g.mtime).slice(0,3)){let g=await c(p.path);if(g&&await T(g),g)return{session:g,from:`Premiere's auto-save of ${new Date(p.mtime).toLocaleTimeString()} (matches the live sequence; the project itself is not saved)`,path:p.path}}}let e=k(await x("conform-ppro-"),"live.otio"),t=await s.export({timeline:i,out_path:e}),{session:n}=await P(t.path,t.format);if(await Z(s,n),await I(n),typeof a.drop_frame=="boolean")for(let m of n.timelines)m.is_drop_frame=a.drop_frame;await T(n);for(let m of n.timelines)for(let l of m.tracks)for(let h of l.items){let u=h;u.scale=null,u.position_x=null,u.position_y=null,u.rotation=null}let o=await s.model(i).then(m=>m.items.filter(l=>Object.keys(l.sizing??{}).length).map(l=>`${l.name??l.file_path.split("/").pop()} (V${l.track} @${l.start-m.start_frame})`)).catch(()=>[]),f=`Premiere's OTIO export carries the cut, not the clips' Motion / Opacity / effects / retimes${o.length?` \u2014 ${o.length} clip(s) here have Motion that will not carry: ${o.slice(0,6).join(", ")}${o.length>6?"\u2026":""}`:""}; save the project (or wait for its auto-save) and run it again for every one of them`;return{session:n,from:"Premiere's OTIO export of the live sequence (no saved or auto-saved copy matches it yet)",path:t.path,lossy:f}}async function T(s){let i=new Set;for(let r of s.media_references??[]){if(r.binding_state==="linked")continue;let c=y(r);c&&await S(c).then(e=>e.isFile,()=>!1)&&i.add(R(c))}let a=s;for(let r of i){let c=await C(a,{media_root:r,gather:"path",criteria:{file_name:!0,file_name_mode:"tight"},lane:"both",reset:!1,dry_run:!1,compare:!1,cap:2e3,remember:!1}).catch(()=>null);c?.changed&&(a=c.session)}return a!==s&&Object.assign(s,a),(s.media_references??[]).filter(r=>r.binding_state==="linked").length}async function I(s){let i=0;for(let a of s.media_references??[]){if(a.source_resolution_w)continue;let r=y(a),c=r?await M(r).catch(()=>null):null;if(!c)continue;let e=c;for(let t of["source_resolution_w","source_resolution_h","source_pixel_aspect","codec","container","streams"])e[t]!=null&&a[t]==null&&(a[t]=e[t]);a.source_fps??=e.source_fps??null,a.source_timecode??=e.source_timecode??null,!a.available_range&&e.available_range&&(a.available_range=e.available_range),i++}return i}async function ie(s,i){let a=i.timelines.filter(t=>t.offline_reference?.clip_id);if(!a.length)return 0;let r=t=>[...t?.clip_list??[],...(t?.folders??[]).flatMap(r)],c=new Map(r((await s.project({clips:!0})).pool).map(t=>[t.id,t])),e=0;for(let t of a){let n=c.get(t.offline_reference.clip_id);if(n?.file){let o=i.media_references.find(f=>y(f)===n.file);o||(o={id:`offline-ref-${t.id??e}`,kind:"external",name:n.name,target_url:`file://${n.file}`,local_path:n.file},i.media_references.push(o)),t.offline_reference.media_reference_id=o.id,e++}else if(n&&n.name!==t.name&&(n.type==="Timeline"||/compound/i.test(n.type??""))){let{createSession:o}=await import("./store-53BBZBND.js"),f=k(await x("conform-offline-ref-"),`${n.name.replace(/[^\w.-]+/g,"_")}.drt`),m=await s.export(n.type==="Timeline"?{timeline:n.name,out_path:f}:{clip_id:n.id,out_path:f}),{session:l}=await P(m.path,"drt");l=(await A(l))?.session??l,t.offline_reference.session_id=(await o(l,m.path,"drt")).id,e++}else t.offline_reference=null}return e}async function Z(s,i){let a=(await s.projectClips()).clips,r=new Map(a.filter(e=>e.start_frame!=null&&e.fps).map(e=>[e.file,e])),c=0;for(let e of i.media_references??[]){if(e.source_timecode)continue;let t=r.get(y(e));if(t){e.source_timecode=F(t.start_frame,t.fps),e.source_fps??=t.fps,c++;continue}let n=y(e),o=n?await M(n).catch(()=>null):null;o?.source_timecode&&(e.source_timecode=o.source_timecode,e.source_fps??=o.source_fps??null,c++)}return c}function z(s,i){let a=new Map(s.timelines.map(c=>[c.id,c])),r=[i];for(let c=0;c<r.length;c++)for(let e of r[c].tracks)for(let t of e.items){let n=t.nested_timeline_id,o=n?a.get(n):void 0;o&&!r.includes(o)&&r.push(o)}return{...s,timelines:r}}function V(s,i){let a=new Map((s.media_references??[]).map(n=>[n.id,y(n)])),r=[];for(let n of i.media_references??[]){let o=a.get(n.id),f=y(n);o!==void 0&&f&&f!==o&&r.push({ref_id:n.id,old:o,new:f})}let c=new Map(r.map(n=>[n.ref_id,n])),e=[],t=i.timelines.find(n=>n.kind==="primary")??i.timelines[0];for(let n of t?.tracks??[])if(n.kind==="Video")for(let o of n.items){let f=o.media_reference_id?c.get(o.media_reference_id):void 0;!f||o.kind!=="clip"||!o.source_range||e.push({track:n.track_index,start:o.timeline_range.start.value,duration:o.timeline_range.duration.value,src_in:o.source_range.start.value,path:f.new,name:o.name??""})}return{media:r,cuts:e}}async function se(s,i){let{session:a,from:r,lossy:c}=await H(s,i.timeline),e=await C(structuredClone(a),{media_root:i.media_root,gather:"walk",reset:!0,lane:"video",dry_run:!1,cap:2e3,criteria:i.criteria??(i.mode==="cut_in"?{file_name:!1,reel_name:!0}:{file_name:!0,file_name_mode:"loose"}),tolerances:i.tolerances}),{media:t,cuts:n}=V(a,e.session),o=[`read from ${r}`,...c&&i.mode==="new_version"?[`\u26A0 ${c}`]:[],`matched ${t.length} medi${t.length===1?"um":"a"} under ${i.media_root} (${n.length} clip use${n.length===1?"":"s"} in the sequence)`],f=t.map(u=>` ${u.old.split("/").pop()} \u2192 ${u.new}`);if(i.dry_run||!t.length)return{text:[...o,...f,i.dry_run?"(dry run \u2014 nothing changed in Premiere)":"",e.text.split(`
|
|
4
4
|
`).slice(-6).join(`
|
|
5
5
|
`)].filter(Boolean).join(`
|
|
6
6
|
`),data:{media:t,cuts:n,from:r}};if(i.mode==="replace"||i.mode==="hires"||i.mode==="proxy"){let p=(await s.projectClips()).clips.flatMap(w=>t.filter(v=>v.old===w.file).map(v=>({clip:w.id,path:v.new,mode:i.mode}))),g=i.mode==="replace"?W(a,e.session,t):new Map,_=g.size?await X(s,new Set(g.keys())):[],b=await s.relinkClips(p),d=b.results.filter(w=>w.ok).length,$=[...o,`${i.mode==="hires"?"attached full-res behind":i.mode==="proxy"?"attached as proxies to":"repointed"} ${d}/${p.length} project clip(s)${i.mode==="proxy"?" (Toggle Proxies in Premiere switches)":""}`,...f,...b.results.filter(w=>!w.ok).map(w=>` refused: ${w.detail??"Premiere refused"}`)],j=_.length?await Y(s,_,g):null;return j&&$.push(...j.lines),{text:$.join(`
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
import{f as a,g as b,h as c,i as d,j as e}from"./chunk-
|
|
3
|
+
import{f as a,g as b,h as c,i as d,j as e}from"./chunk-MWDF2R26.js";import"./chunk-623EA3TK.js";import"./chunk-TXQR2HI2.js";import"./chunk-QVH44I66.js";import"./chunk-5BSXYKLN.js";import"./chunk-PFISREY4.js";import"./chunk-JV7TZDKJ.js";import"./chunk-VIBEEWPC.js";import"./chunk-PFZVET7S.js";import"./chunk-6V4OEOOX.js";import"./chunk-RGMTLNMF.js";import"./chunk-D4WPRRBT.js";import"./chunk-WN53ARHJ.js";import"./chunk-A7FNR3T5.js";import"./chunk-J2JXLEAI.js";import"./chunk-SGLQY53R.js";import"./chunk-DKGGJM6Z.js";import"./chunk-AMRJXYL4.js";import"./chunk-3D3Z4TBR.js";import"./chunk-2BPR6LK6.js";import"./chunk-NU3X7P4N.js";import"./chunk-RJ6JA2LZ.js";import"./chunk-XCKQHL4G.js";import"./chunk-PHAMF4JF.js";import"./chunk-PLRB2YXJ.js";import"./chunk-C2ESM27Z.js";import"./chunk-PSANHDZM.js";export{a as AVID_SETUP,b as FLAME_SETUP,c as NUKE_SETUP,e as adapter,d as setAdapter};
|
package/dist/http.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
import{a as xt}from"./chunk-NFJHWZJX.js";import{$ as yt,G as nt,H as ot,I as dt,J as pt,K as gt,R as ht,S as wt,T as _t,X as b,Y as kt,_ as U}from"./chunk-
|
|
3
|
+
import{a as xt}from"./chunk-NFJHWZJX.js";import{$ as yt,G as nt,H as ot,I as dt,J as pt,K as gt,R as ht,S as wt,T as _t,X as b,Y as kt,_ as U}from"./chunk-GRQJGEGV.js";import"./chunk-DQGINJDV.js";import"./chunk-HNBA43BF.js";import"./chunk-MWDF2R26.js";import"./chunk-623EA3TK.js";import"./chunk-TXQR2HI2.js";import{J as I,t as mt,u as ft}from"./chunk-QVH44I66.js";import{a as et}from"./chunk-5BSXYKLN.js";import"./chunk-GM6QKY7W.js";import"./chunk-PFISREY4.js";import"./chunk-JV7TZDKJ.js";import"./chunk-VIBEEWPC.js";import"./chunk-PFZVET7S.js";import"./chunk-6V4OEOOX.js";import"./chunk-RGMTLNMF.js";import"./chunk-D4WPRRBT.js";import"./chunk-WN53ARHJ.js";import"./chunk-A7FNR3T5.js";import"./chunk-J2JXLEAI.js";import"./chunk-SGLQY53R.js";import"./chunk-DKGGJM6Z.js";import"./chunk-D6YDLKSA.js";import"./chunk-AMRJXYL4.js";import"./chunk-3D3Z4TBR.js";import"./chunk-2BPR6LK6.js";import"./chunk-GK4YYKJ6.js";import"./chunk-NU3X7P4N.js";import"./chunk-RJ6JA2LZ.js";import{B as v,D as lt,t as rt,u as st,v as it,x as at,y as ct,z as ut}from"./chunk-GTJ3EM6H.js";import{n as H}from"./chunk-XCKQHL4G.js";import{a as B}from"./chunk-PHAMF4JF.js";import{D as L,H as D,I as Z,J as q,Q as tt,V as M,W as J,Y as x,b as E,k as P,q as V,r as W,u as K,v as X,w as A,x as Y,y as $,z as Q}from"./chunk-PLRB2YXJ.js";import"./chunk-C2ESM27Z.js";import"./chunk-PSANHDZM.js";import C from"node:process";var bt=new Map;function St(t,s,o,T){let i=`${t}:${o}:${T}`,a=bt.get(i);return a||(a=(async()=>{let n=x(P(),"cache","grade-luts",t);await $(n);let l=x(n,`V${o}_${T}.cube`);if(!await W(l)){let{adapter:_}=await import("./hosts-SRS5TEM6.js");if((await _("resolve").clipLut({timeline:s,track:o,start:T,out_path:l})).ok===!1)return null}return l})().catch(()=>null),bt.set(i,a)),a}var Ct=new Set(["/app/convert","/app/canonicalize"]);function Ot(t,s){let o=(s??"").split(";")[0].trim().toLowerCase();return o==="application/json"||o==="application/octet-stream"&&Ct.has(t)}function Nt(t){let s=t.replace(/[\\/:*?"<>|\x00-\x1f]+/g,"_").replace(/[. ]+$/,"")||"timeline";return/^(con|prn|aux|nul|com\d|lpt\d)(\..*)?$/i.test(s)?`_${s}`:s}var F={id:"local",name:"Local",client_name:null,handles:24,local:!0};async function Rt(){try{return JSON.parse(await X(x(P(),"projects","projects.json")))}catch{return[]}}async function Tt(){let t=await b("project",{action:"list"});if(!t.isError){let s=t.structuredContent?.projects??[];return await $(x(P(),"projects")),await Y(x(P(),"projects","projects.json"),JSON.stringify(s)),{projects:[F,...s],offline:!1}}return{projects:[F,...await Rt()],offline:!0,code:String(t.structuredContent?.code??"offline"),reason:String(t.structuredContent?.message??t.content[0]?.text??"")}}async function $t(t){return t==="local"?F:(await Rt()).find(s=>s.id===t)??{id:t,name:t}}async function Pt(t,s,o,T,i=(a,n)=>new Response(a,{headers:{"content-type":n}})){if(s[0]!=="app")return null;let[,a,n,l]=s,_=async()=>t.headers.get("content-type")?.includes("json")?await t.json():{};try{if(a==="policy"&&t.method==="GET"){let{config:e}=await import("./account-M53GEV7P.js"),r=await fetch(`${e().supabaseUrl}/functions/v1/v1-billing/v1/billing/app-policy`,{signal:AbortSignal.timeout(3e3)}).catch(()=>null);return o(r?.ok?await r.json():{offline:!0})}if(a==="account"&&t.method==="GET"){let e=await b("account_status",{}),r=await H().then(()=>({app:!0}),u=>({app:!1,app_reason:u.message,code:u.code}));return o({...e.structuredContent,...e.structuredContent?.account??{},...r,text:e.content[0]?.text})}{let e=await H().then(()=>null,r=>r);if(e)return o({ok:!1,code:e.code,message:e.message,needs:"app"},e.code==="not_signed_in"?401:402)}if(a==="events"&&t.method==="GET")return T(gt());if(a==="front"&&t.method==="POST"){let e=await t.json();return pt({project:String(e.project??""),view:String(e.view??""),...e.tool?{tool:String(e.tool)}:{}}),o({ok:!0})}if(a==="convert"&&t.method==="POST"){let e=new URL(t.url).searchParams,r=M(e.get("name")||"timeline"),u=e.get("out")||"",g=JSON.parse(e.get("targets")||"[]"),c=JSON.parse(e.get("sequences")||"[]");if(!u||!g.length)return o({ok:!1,error:"a folder and at least one format are needed"},400);let m=await D("conform-te-"),k=x(m,r);await A(k,new Uint8Array(await t.arrayBuffer()));let h=await b("timeline_read",{path:k}),S=h.structuredContent?.session_id??h.content[0]?.text.match(/session_id: (\w+)/)?.[1];if(h.isError||!S)return o({ok:!1,error:h.content[0]?.text??"could not read the timeline"});let p=(await v(S)).session.timelines.filter(y=>y.kind!=="compound"),w=c.length?p.filter(y=>c.includes(y.name??"")):p,d=[],O=0;for(let y of w)for(let R of g){let N=x(u,`${Nt(y.name??"timeline")}.${R.ext}`),z=await b("timeline_write",{session_id:S,target:R.target,out_path:N,...w.length>1||p.length>1?{timeline_id:y.id}:{}});z.isError?d.push(`${y.name} \u2192 ${R.target}: ${z.content[0]?.text}`):O++}return await L(m).catch(()=>{}),o({ok:O>0,savedCount:O,...d.length?{error:d.join(`
|
|
4
4
|
`)}:{}})}if(a==="fs"&&t.method==="POST"){let{op:e,path:r,offset:u=0,length:g=0}=await _();if(e==="statPath"){let c=await V(r).catch(()=>null);return o({ok:!0,result:c?{kind:c.isDirectory?"directory":"file",size:c.size,lastModified:Math.round(c.mtimeMs)}:null})}if(e==="readDir"){let c=[];for await(let m of Z(r))(m.isFile||m.isDirectory)&&c.push({name:m.name,kind:m.isDirectory?"directory":"file"});return o({ok:!0,result:c})}if(e==="readFile"){let c=await q(r);try{return i(await c.readAt(Math.max(0,u),Math.min(Math.max(0,g),16<<20)),"application/octet-stream")}finally{await c.close()}}return o({ok:!1,code:"bad_request",message:`no fs op ${e}`},400)}if(a==="canonicalize"&&t.method==="POST"){let e=new URL(t.url).searchParams,r=JSON.parse(e.get("sequences")||"[]"),u=JSON.parse(e.get("previous")||"[]"),g=await D("conform-te-");try{let c=x(g,M(e.get("name")||"timeline"));await A(c,new Uint8Array(await t.arrayBuffer()));let m=await b("timeline_read",{path:c}),k=m.structuredContent?.session_id??m.content[0]?.text.match(/session_id: (\w+)/)?.[1];if(m.isError||!k)return o({ok:!1,error:m.content[0]?.text??"could not read the timeline"},422);let h=(await v(k)).session,S=h.timelines;if(r.length){let p=new Map;for(let d of u)p.set(d,(p.get(d)??0)+1);let w=new Set;for(let d of r){let O=h.timelines.filter(N=>N.kind!=="compound"&&(N.name??"")===d),y=p.get(d)??0;p.set(d,y+1);let R=O[Math.min(y,O.length-1)];R&&w.add(R)}S=h.timelines.filter(d=>d.kind==="compound"||w.has(d))}return o({ok:!0,session_id:k,session:{...h,timelines:S}})}finally{await L(g).catch(()=>{})}}if(a==="sessions"&&n&&l==="frame"){let e=new URL(t.url).searchParams,r=Math.max(0,Math.round(Number(e.get("f")??0))),u=Math.min(3840,Math.max(64,Number(e.get("w")??1280)|0));try{let k=(await v(n)).session,h=e.get("track")==="offline"?"offline":Number(e.get("track"))||void 0,S;if(e.get("grade")==="resolve"&&h!=="offline"){let w=(()=>{try{return mt(k,{record:r,timeline:e.get("timeline")??void 0,track:h})}catch{return null}})();w&&(S=await St(n,e.get("host_timeline")??void 0,w.video_track,w.record_start)??void 0)}let p=await ft(k,r,u,e.get("timeline")??void 0,h,S);if(p){let w=new Uint8Array(12+p.px.length),d=new DataView(w.buffer);return d.setUint32(0,p.w,!0),d.setUint32(4,p.h,!0),d.setUint32(8,p.order==="bgra"?1:0,!0),w.set(p.px,12),i(w,"application/x-conform-pixels")}}catch(k){return o({ok:!1,code:"no_frame",message:k.message},404)}let g=await b("timeline_frame",{session_id:n,record:r,width:u,...e.get("timeline")?{timeline:e.get("timeline")}:{}}),c=g.structuredContent?.out_path;if(g.isError||!c)return o({ok:!1,code:String(g.structuredContent?.code??"no_frame"),message:g.content[0]?.text??"no picture here"},404);let m=await K(c);return await(M(J(c)).startsWith("conform-frame-")?L(J(c)):Q(c)).catch(()=>{}),i(m,"image/png")}if(a==="sessions"&&n&&t.method==="GET"){let e=await v(n).catch(()=>null);return e?o(e):o({ok:!1,code:"not_found"},404)}if(a==="sessions"&&!n)return o(await lt());if(a!=="projects")return o({ok:!1,code:"not_found"},404);if(!n){if(t.method==="POST"){let e=await _(),r=await b("project",{action:"create",name:e.name,client_name:e.client_name,handles:e.handles});return r.isError?o({...r.structuredContent,text:r.content[0]?.text},422):(await Tt(),o(r.structuredContent))}return o(await Tt())}if(!l){let[e,r,u,g]=await Promise.all([$t(n),st(n).catch(()=>null),ut(n),dt(n)]);await at(n===rt?null:{id:n,name:e.name??n});let{text:c="",...m}=r??{};return o({project:e,context:c,context_meta:m,sessions:u,activity:g.slice(-100).reverse()})}if(l==="sessions"&&t.method==="PUT")return await ct(n,String((await _()).session_id??"")),o({ok:!0});if(l==="context"&&t.method==="PUT"){let e=await _();try{let{text:r,...u}=await it(n,String(e.text??""),e.base===void 0?void 0:e.base);return o({ok:!0,context:r,context_meta:u})}catch(r){if(r instanceof B&&r.code==="context_conflict"){let u=r.data?.current;return o({ok:!1,code:r.code,message:r.message,context:u.context,context_meta:{updated_at:u.context_updated_at,updated_by:u.context_updated_by_name??null}},409)}throw r}}return o({ok:!1,code:"not_found"},404)}catch(e){let r=e instanceof B?e:null;return o({ok:!1,code:r?.code??"internal",message:e.message},r?.code==="not_found"?404:r?.code==="invalid_args"?400:500)}}var Lt=Number(E("CONFORM_HTTP_PORT")??7791);E("CONFORM_EXIT_WITH_PARENT")==="1"&&(C.stdin.on("end",()=>C.exit(0)),C.stdin.on("close",()=>C.exit(0)),C.stdin.resume());var G=E("CONFORM_HTTP_TOKEN")??"",vt=(E("CONFORM_HTTP_ORIGINS")??"https://conform.tools,https://app.conform.tools,http://localhost:5173,http://localhost:3000").split(","),j=(t,s=new Headers)=>{let o=t.headers.get("origin")??"";return vt.includes(o)&&s.set("access-control-allow-origin",o),s.set("access-control-allow-headers","authorization, content-type"),s.set("access-control-allow-methods","GET, POST, PUT, DELETE, OPTIONS"),s.set("access-control-allow-private-network","true"),s.set("vary","origin"),s},Et=new Set,f=(t,s,o=200)=>new Response(JSON.stringify(s),{status:o,headers:j(t,new Headers({"content-type":"application/json"}))});tt({hostname:"127.0.0.1",port:Lt,onListen:t=>{Et=new Set([`127.0.0.1:${t}`,`localhost:${t}`,`[::1]:${t}`]),console.error(`conformtools HTTP API on http://127.0.0.1:${t} (${U.length} verbs)`),xt(t,G)}},async t=>{let s=new URL(t.url),o=(t.headers.get("host")??"").toLowerCase();if(!Et.has(o))return new Response("forbidden host",{status:403});let T=t.headers.get("origin");if(T&&!vt.includes(T))return new Response("forbidden origin",{status:403});if(t.method==="OPTIONS")return new Response(null,{status:204,headers:j(t)});if((t.method==="POST"||t.method==="PUT")&&t.headers.get("content-length")!=="0"&&!Ot(s.pathname,t.headers.get("content-type")))return f(t,{ok:!1,code:"unsupported_media_type",message:"send the body as application/json"},415);if(G&&t.headers.get("authorization")!==`Bearer ${G}`&&s.pathname!=="/health")return f(t,{ok:!1,code:"unauthorized"},401);let i=s.pathname.split("/").filter(Boolean);try{if(s.pathname==="/health")return f(t,{ok:!0,verbs:U.length,version:et,engine:I()});if(i[0]==="verbs"&&i.length===1&&t.method==="GET")return f(t,U.map(n=>({name:n.name,title:n.title,description:n.description,long:!!n.long,input_schema:ot(nt.object(n.inputSchema)),protected_stages:n.protectedStages??[],engine:I()})));if(i[0]==="verbs"&&i.length===2&&t.method==="POST"){let n=yt(i[1]);if(!n)return f(t,{ok:!1,code:"not_found",message:`unknown verb ${i[1]}`},404);let l=t.headers.get("content-type")?.includes("json")?await t.json():{},_=kt(n.name,l);if(!_.ok)return f(t,{..._.result.structuredContent,text:_.result.content[0].text},400);let e=await b(n.name,_.data);return f(t,{...e.structuredContent??{ok:!e.isError},text:e.content.map(r=>r.text).join(`
|
|
5
|
-
`)},e.isError?422:200)}if(i[0]==="debug"&&i.length===3&&t.method==="POST"&&Deno.env.get("CONFORM_DEBUG_BRIDGE")==="1"){let{hostBridge:n}=await import("./bridge-
|
|
5
|
+
`)},e.isError?422:200)}if(i[0]==="debug"&&i.length===3&&t.method==="POST"&&Deno.env.get("CONFORM_DEBUG_BRIDGE")==="1"){let{hostBridge:n}=await import("./bridge-SX5TW4LC.js"),l=await n();return await l.waitFor(i[1],5e3)?f(t,{ok:!0,result:await l.request(i[1],i[2],t.headers.get("content-type")?.includes("json")?await t.json():{},12e4)}):f(t,{ok:!1,code:"not_connected"},409)}let a=await Pt(t,i,(n,l)=>f(t,n,l),n=>new Response(n,{headers:j(t,new Headers({"content-type":"text/event-stream","cache-control":"no-cache"}))}),(n,l)=>new Response(n,{headers:j(t,new Headers({"content-type":l,"cache-control":"no-store"}))}));if(a)return a;if(i[0]==="jobs"&&i.length===1)return f(t,await _t());if(i[0]==="jobs"&&i.length===2){if(t.method==="DELETE")return f(t,{ok:wt(i[1])});let n=await ht(i[1]);return n?f(t,n):f(t,{ok:!1,code:"not_found"},404)}return f(t,{ok:!1,code:"not_found"},404)}catch(a){return f(t,{ok:!1,code:"internal",message:a instanceof Error?a.message:String(a)},500)}});
|
package/dist/mcp.js
CHANGED
|
@@ -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{b as ra}from"./chunk-NFJHWZJX.js";import{A as S,B as Li,C as K,D as Fi,E as en,F as Hi,G as dt,H as Ui,L as Gi,M as Dt,N as Bi,O as Ji,P as Wi,Q as Xi,U as Qi,W as Yi,X as ea,Z as ta,_ as tn,a as qi,b as Go,c as Ni,d as ji,e as Oi,f as Bo,g as Jo,h as Wo,i as Ot,j as At,k as Ai,l as Di,m as Xo,n as f,o as D,p as W,q as Zi,r as G,s as q,t as v,u as se,v as V,w as Qo,x as Yo,y as F,z as pe}from"./chunk-55BKURYP.js";import"./chunk-S5JDS5PQ.js";import"./chunk-XLEINKFL.js";import"./chunk-EUBXH67N.js";import"./chunk-SNTAZJ5A.js";import"./chunk-TXQR2HI2.js";import"./chunk-5WEZRGXG.js";import{a as kr,b as Ii,c as Ci,d as Mi}from"./chunk-P2LL3JMC.js";import"./chunk-GM6QKY7W.js";import"./chunk-PFISREY4.js";import"./chunk-JV7TZDKJ.js";import"./chunk-VIBEEWPC.js";import"./chunk-PFZVET7S.js";import"./chunk-6V4OEOOX.js";import"./chunk-RGMTLNMF.js";import"./chunk-D4WPRRBT.js";import"./chunk-WN53ARHJ.js";import"./chunk-A7FNR3T5.js";import"./chunk-J2JXLEAI.js";import"./chunk-SGLQY53R.js";import"./chunk-DKGGJM6Z.js";import"./chunk-D6YDLKSA.js";import"./chunk-AMRJXYL4.js";import"./chunk-3D3Z4TBR.js";import"./chunk-2BPR6LK6.js";import"./chunk-GK4YYKJ6.js";import"./chunk-NU3X7P4N.js";import"./chunk-RJ6JA2LZ.js";import"./chunk-SKFMOLUO.js";import"./chunk-NAFLOZER.js";import{e as Vi,f as Ki}from"./chunk-PHAMF4JF.js";import"./chunk-PLRB2YXJ.js";import"./chunk-C2ESM27Z.js";import{c as $,f as Ri}from"./chunk-PSANHDZM.js";var Qt=$(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});A.regexpCode=A.getEsmExportName=A.getProperty=A.safeStringify=A.stringify=A.strConcat=A.addCodeArg=A.str=A._=A.nil=A._Code=A.Name=A.IDENTIFIER=A._CodeOrName=void 0;var Wt=class{};A._CodeOrName=Wt;A.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Ye=class extends Wt{constructor(e){if(super(),!A.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};A.Name=Ye;var ye=class extends Wt{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,o)=>`${r}${o}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,o)=>(o instanceof Ye&&(r[o.str]=(r[o.str]||0)+1),r),{})}};A._Code=ye;A.nil=new ye("");function Ea(t,...e){let r=[t[0]],o=0;for(;o<e.length;)En(r,e[o]),r.push(t[++o]);return new ye(r)}A._=Ea;var xn=new ye("+");function za(t,...e){let r=[Xt(t[0])],o=0;for(;o<e.length;)r.push(xn),En(r,e[o]),r.push(xn,Xt(t[++o]));return wf(r),new ye(r)}A.str=za;function En(t,e){e instanceof ye?t.push(...e._items):e instanceof Ye?t.push(e):t.push(xf(e))}A.addCodeArg=En;function wf(t){let e=1;for(;e<t.length-1;){if(t[e]===xn){let r=bf(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function bf(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Ye||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Ye))return`"${t}${e.slice(1)}`}function Sf(t,e){return e.emptyStr()?t:t.emptyStr()?e:za`${t}${e}`}A.strConcat=Sf;function xf(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Xt(Array.isArray(t)?t.join(","):t)}function Ef(t){return new ye(Xt(t))}A.stringify=Ef;function Xt(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}A.safeStringify=Xt;function zf(t){return typeof t=="string"&&A.IDENTIFIER.test(t)?new ye(`.${t}`):Ea`[${t}]`}A.getProperty=zf;function kf(t){if(typeof t=="string"&&A.IDENTIFIER.test(t))return new ye(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}A.getEsmExportName=kf;function Pf(t){return new ye(t.toString())}A.regexpCode=Pf});var Pn=$(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.ValueScope=le.ValueScopeName=le.Scope=le.varKinds=le.UsedValueState=void 0;var ce=Qt(),zn=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Qr;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Qr||(le.UsedValueState=Qr={}));le.varKinds={const:new ce.Name("const"),let:new ce.Name("let"),var:new ce.Name("var")};var Yr=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof ce.Name?e:this.name(e)}name(e){return new ce.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,o;if(!((o=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||o===void 0)&&o.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};le.Scope=Yr;var eo=class extends ce.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:o}){this.value=e,this.scopePath=(0,ce._)`.${new ce.Name(r)}[${o}]`}};le.ValueScopeName=eo;var Tf=(0,ce._)`\n`,kn=class extends Yr{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?Tf:ce.nil}}get(){return this._scope}name(e){return new eo(e,this._newName(e))}value(e,r){var o;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:s}=n,i=(o=r.key)!==null&&o!==void 0?o:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,n);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,n.setValue(r,{property:s,itemIndex:u}),n}getValue(e,r){let o=this._values[e];if(o)return o.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,o=>{if(o.scopePath===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return(0,ce._)`${e}${o.scopePath}`})}scopeCode(e=this._values,r,o){return this._reduceValues(e,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},r,o)}_reduceValues(e,r,o={},n){let s=ce.nil;for(let i in e){let a=e[i];if(!a)continue;let c=o[i]=o[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,Qr.Started);let l=r(u);if(l){let d=this.opts.es5?le.varKinds.var:le.varKinds.const;s=(0,ce._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=n?.(u))s=(0,ce._)`${s}${l}${this.opts._n}`;else throw new zn(u);c.set(u,Qr.Completed)})}return s}};le.ValueScope=kn});var R=$(I=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0});I.or=I.and=I.not=I.CodeGen=I.operators=I.varKinds=I.ValueScopeName=I.ValueScope=I.Scope=I.Name=I.regexpCode=I.stringify=I.getProperty=I.nil=I.strConcat=I.str=I._=void 0;var M=Qt(),we=Pn(),He=Qt();Object.defineProperty(I,"_",{enumerable:!0,get:function(){return He._}});Object.defineProperty(I,"str",{enumerable:!0,get:function(){return He.str}});Object.defineProperty(I,"strConcat",{enumerable:!0,get:function(){return He.strConcat}});Object.defineProperty(I,"nil",{enumerable:!0,get:function(){return He.nil}});Object.defineProperty(I,"getProperty",{enumerable:!0,get:function(){return He.getProperty}});Object.defineProperty(I,"stringify",{enumerable:!0,get:function(){return He.stringify}});Object.defineProperty(I,"regexpCode",{enumerable:!0,get:function(){return He.regexpCode}});Object.defineProperty(I,"Name",{enumerable:!0,get:function(){return He.Name}});var no=Pn();Object.defineProperty(I,"Scope",{enumerable:!0,get:function(){return no.Scope}});Object.defineProperty(I,"ValueScope",{enumerable:!0,get:function(){return no.ValueScope}});Object.defineProperty(I,"ValueScopeName",{enumerable:!0,get:function(){return no.ValueScopeName}});Object.defineProperty(I,"varKinds",{enumerable:!0,get:function(){return no.varKinds}});I.operators={GT:new M._Code(">"),GTE:new M._Code(">="),LT:new M._Code("<"),LTE:new M._Code("<="),EQ:new M._Code("==="),NEQ:new M._Code("!=="),NOT:new M._Code("!"),OR:new M._Code("||"),AND:new M._Code("&&"),ADD:new M._Code("+")};var qe=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},Tn=class extends qe{constructor(e,r,o){super(),this.varKind=e,this.name=r,this.rhs=o}render({es5:e,_n:r}){let o=e?we.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${o} ${this.name}${n};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=vt(this.rhs,e,r)),this}get names(){return this.rhs instanceof M._CodeOrName?this.rhs.names:{}}},to=class extends qe{constructor(e,r,o){super(),this.lhs=e,this.rhs=r,this.sideEffects=o}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof M.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=vt(this.rhs,e,r),this}get names(){let e=this.lhs instanceof M.Name?{}:{...this.lhs.names};return oo(e,this.rhs)}},Rn=class extends to{constructor(e,r,o,n){super(e,o,n),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},In=class extends qe{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},Cn=class extends qe{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Mn=class extends qe{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},qn=class extends qe{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=vt(this.code,e,r),this}get names(){return this.code instanceof M._CodeOrName?this.code.names:{}}},Yt=class extends qe{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,o)=>r+o.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let o=e[r].optimizeNodes();Array.isArray(o)?e.splice(r,1,...o):o?e[r]=o:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:o}=this,n=o.length;for(;n--;){let s=o[n];s.optimizeNames(e,r)||(Rf(e,s.names),o.splice(n,1))}return o.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>rt(e,r.names),{})}},Ne=class extends Yt{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},Nn=class extends Yt{},$t=class extends Ne{};$t.kind="else";var et=class t extends Ne{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let o=r.optimizeNodes();r=this.else=Array.isArray(o)?new $t(o):o}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(ka(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var o;if(this.else=(o=this.else)===null||o===void 0?void 0:o.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=vt(this.condition,e,r),this}get names(){let e=super.names;return oo(e,this.condition),this.else&&rt(e,this.else.names),e}};et.kind="if";var tt=class extends Ne{};tt.kind="for";var jn=class extends tt{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=vt(this.iteration,e,r),this}get names(){return rt(super.names,this.iteration.names)}},On=class extends tt{constructor(e,r,o,n){super(),this.varKind=e,this.name=r,this.from=o,this.to=n}render(e){let r=e.es5?we.varKinds.var:this.varKind,{name:o,from:n,to:s}=this;return`for(${r} ${o}=${n}; ${o}<${s}; ${o}++)`+super.render(e)}get names(){let e=oo(super.names,this.from);return oo(e,this.to)}},ro=class extends tt{constructor(e,r,o,n){super(),this.loop=e,this.varKind=r,this.name=o,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=vt(this.iterable,e,r),this}get names(){return rt(super.names,this.iterable.names)}},er=class extends Ne{constructor(e,r,o){super(),this.name=e,this.args=r,this.async=o}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};er.kind="func";var tr=class extends Yt{render(e){return"return "+super.render(e)}};tr.kind="return";var An=class extends Ne{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var o,n;return super.optimizeNames(e,r),(o=this.catch)===null||o===void 0||o.optimizeNames(e,r),(n=this.finally)===null||n===void 0||n.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&rt(e,this.catch.names),this.finally&&rt(e,this.finally.names),e}},rr=class extends Ne{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};rr.kind="catch";var or=class extends Ne{render(e){return"finally"+super.render(e)}};or.kind="finally";var Dn=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
3
|
+
import{b as ra}from"./chunk-NFJHWZJX.js";import{A as S,B as Li,C as K,D as Fi,E as en,F as Hi,G as dt,H as Ui,L as Gi,M as Dt,N as Bi,O as Ji,P as Wi,Q as Xi,U as Qi,W as Yi,X as ea,Z as ta,_ as tn,a as qi,b as Go,c as Ni,d as ji,e as Oi,f as Bo,g as Jo,h as Wo,i as Ot,j as At,k as Ai,l as Di,m as Xo,n as f,o as D,p as W,q as Zi,r as G,s as q,t as v,u as se,v as V,w as Qo,x as Yo,y as F,z as pe}from"./chunk-GRQJGEGV.js";import"./chunk-DQGINJDV.js";import"./chunk-HNBA43BF.js";import"./chunk-MWDF2R26.js";import"./chunk-623EA3TK.js";import"./chunk-TXQR2HI2.js";import"./chunk-QVH44I66.js";import{a as kr,b as Ii,c as Ci,d as Mi}from"./chunk-5BSXYKLN.js";import"./chunk-GM6QKY7W.js";import"./chunk-PFISREY4.js";import"./chunk-JV7TZDKJ.js";import"./chunk-VIBEEWPC.js";import"./chunk-PFZVET7S.js";import"./chunk-6V4OEOOX.js";import"./chunk-RGMTLNMF.js";import"./chunk-D4WPRRBT.js";import"./chunk-WN53ARHJ.js";import"./chunk-A7FNR3T5.js";import"./chunk-J2JXLEAI.js";import"./chunk-SGLQY53R.js";import"./chunk-DKGGJM6Z.js";import"./chunk-D6YDLKSA.js";import"./chunk-AMRJXYL4.js";import"./chunk-3D3Z4TBR.js";import"./chunk-2BPR6LK6.js";import"./chunk-GK4YYKJ6.js";import"./chunk-NU3X7P4N.js";import"./chunk-RJ6JA2LZ.js";import"./chunk-GTJ3EM6H.js";import"./chunk-XCKQHL4G.js";import{e as Vi,f as Ki}from"./chunk-PHAMF4JF.js";import"./chunk-PLRB2YXJ.js";import"./chunk-C2ESM27Z.js";import{c as $,f as Ri}from"./chunk-PSANHDZM.js";var Qt=$(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});A.regexpCode=A.getEsmExportName=A.getProperty=A.safeStringify=A.stringify=A.strConcat=A.addCodeArg=A.str=A._=A.nil=A._Code=A.Name=A.IDENTIFIER=A._CodeOrName=void 0;var Wt=class{};A._CodeOrName=Wt;A.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Ye=class extends Wt{constructor(e){if(super(),!A.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};A.Name=Ye;var ye=class extends Wt{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,o)=>`${r}${o}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,o)=>(o instanceof Ye&&(r[o.str]=(r[o.str]||0)+1),r),{})}};A._Code=ye;A.nil=new ye("");function Ea(t,...e){let r=[t[0]],o=0;for(;o<e.length;)En(r,e[o]),r.push(t[++o]);return new ye(r)}A._=Ea;var xn=new ye("+");function za(t,...e){let r=[Xt(t[0])],o=0;for(;o<e.length;)r.push(xn),En(r,e[o]),r.push(xn,Xt(t[++o]));return wf(r),new ye(r)}A.str=za;function En(t,e){e instanceof ye?t.push(...e._items):e instanceof Ye?t.push(e):t.push(xf(e))}A.addCodeArg=En;function wf(t){let e=1;for(;e<t.length-1;){if(t[e]===xn){let r=bf(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function bf(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Ye||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Ye))return`"${t}${e.slice(1)}`}function Sf(t,e){return e.emptyStr()?t:t.emptyStr()?e:za`${t}${e}`}A.strConcat=Sf;function xf(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Xt(Array.isArray(t)?t.join(","):t)}function Ef(t){return new ye(Xt(t))}A.stringify=Ef;function Xt(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}A.safeStringify=Xt;function zf(t){return typeof t=="string"&&A.IDENTIFIER.test(t)?new ye(`.${t}`):Ea`[${t}]`}A.getProperty=zf;function kf(t){if(typeof t=="string"&&A.IDENTIFIER.test(t))return new ye(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}A.getEsmExportName=kf;function Pf(t){return new ye(t.toString())}A.regexpCode=Pf});var Pn=$(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.ValueScope=le.ValueScopeName=le.Scope=le.varKinds=le.UsedValueState=void 0;var ce=Qt(),zn=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Qr;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Qr||(le.UsedValueState=Qr={}));le.varKinds={const:new ce.Name("const"),let:new ce.Name("let"),var:new ce.Name("var")};var Yr=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof ce.Name?e:this.name(e)}name(e){return new ce.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,o;if(!((o=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||o===void 0)&&o.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};le.Scope=Yr;var eo=class extends ce.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:o}){this.value=e,this.scopePath=(0,ce._)`.${new ce.Name(r)}[${o}]`}};le.ValueScopeName=eo;var Tf=(0,ce._)`\n`,kn=class extends Yr{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?Tf:ce.nil}}get(){return this._scope}name(e){return new eo(e,this._newName(e))}value(e,r){var o;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:s}=n,i=(o=r.key)!==null&&o!==void 0?o:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,n);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,n.setValue(r,{property:s,itemIndex:u}),n}getValue(e,r){let o=this._values[e];if(o)return o.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,o=>{if(o.scopePath===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return(0,ce._)`${e}${o.scopePath}`})}scopeCode(e=this._values,r,o){return this._reduceValues(e,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},r,o)}_reduceValues(e,r,o={},n){let s=ce.nil;for(let i in e){let a=e[i];if(!a)continue;let c=o[i]=o[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,Qr.Started);let l=r(u);if(l){let d=this.opts.es5?le.varKinds.var:le.varKinds.const;s=(0,ce._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=n?.(u))s=(0,ce._)`${s}${l}${this.opts._n}`;else throw new zn(u);c.set(u,Qr.Completed)})}return s}};le.ValueScope=kn});var R=$(I=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0});I.or=I.and=I.not=I.CodeGen=I.operators=I.varKinds=I.ValueScopeName=I.ValueScope=I.Scope=I.Name=I.regexpCode=I.stringify=I.getProperty=I.nil=I.strConcat=I.str=I._=void 0;var M=Qt(),we=Pn(),He=Qt();Object.defineProperty(I,"_",{enumerable:!0,get:function(){return He._}});Object.defineProperty(I,"str",{enumerable:!0,get:function(){return He.str}});Object.defineProperty(I,"strConcat",{enumerable:!0,get:function(){return He.strConcat}});Object.defineProperty(I,"nil",{enumerable:!0,get:function(){return He.nil}});Object.defineProperty(I,"getProperty",{enumerable:!0,get:function(){return He.getProperty}});Object.defineProperty(I,"stringify",{enumerable:!0,get:function(){return He.stringify}});Object.defineProperty(I,"regexpCode",{enumerable:!0,get:function(){return He.regexpCode}});Object.defineProperty(I,"Name",{enumerable:!0,get:function(){return He.Name}});var no=Pn();Object.defineProperty(I,"Scope",{enumerable:!0,get:function(){return no.Scope}});Object.defineProperty(I,"ValueScope",{enumerable:!0,get:function(){return no.ValueScope}});Object.defineProperty(I,"ValueScopeName",{enumerable:!0,get:function(){return no.ValueScopeName}});Object.defineProperty(I,"varKinds",{enumerable:!0,get:function(){return no.varKinds}});I.operators={GT:new M._Code(">"),GTE:new M._Code(">="),LT:new M._Code("<"),LTE:new M._Code("<="),EQ:new M._Code("==="),NEQ:new M._Code("!=="),NOT:new M._Code("!"),OR:new M._Code("||"),AND:new M._Code("&&"),ADD:new M._Code("+")};var qe=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},Tn=class extends qe{constructor(e,r,o){super(),this.varKind=e,this.name=r,this.rhs=o}render({es5:e,_n:r}){let o=e?we.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${o} ${this.name}${n};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=vt(this.rhs,e,r)),this}get names(){return this.rhs instanceof M._CodeOrName?this.rhs.names:{}}},to=class extends qe{constructor(e,r,o){super(),this.lhs=e,this.rhs=r,this.sideEffects=o}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof M.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=vt(this.rhs,e,r),this}get names(){let e=this.lhs instanceof M.Name?{}:{...this.lhs.names};return oo(e,this.rhs)}},Rn=class extends to{constructor(e,r,o,n){super(e,o,n),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},In=class extends qe{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},Cn=class extends qe{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Mn=class extends qe{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},qn=class extends qe{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=vt(this.code,e,r),this}get names(){return this.code instanceof M._CodeOrName?this.code.names:{}}},Yt=class extends qe{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,o)=>r+o.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let o=e[r].optimizeNodes();Array.isArray(o)?e.splice(r,1,...o):o?e[r]=o:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:o}=this,n=o.length;for(;n--;){let s=o[n];s.optimizeNames(e,r)||(Rf(e,s.names),o.splice(n,1))}return o.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>rt(e,r.names),{})}},Ne=class extends Yt{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},Nn=class extends Yt{},$t=class extends Ne{};$t.kind="else";var et=class t extends Ne{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let o=r.optimizeNodes();r=this.else=Array.isArray(o)?new $t(o):o}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(ka(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var o;if(this.else=(o=this.else)===null||o===void 0?void 0:o.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=vt(this.condition,e,r),this}get names(){let e=super.names;return oo(e,this.condition),this.else&&rt(e,this.else.names),e}};et.kind="if";var tt=class extends Ne{};tt.kind="for";var jn=class extends tt{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=vt(this.iteration,e,r),this}get names(){return rt(super.names,this.iteration.names)}},On=class extends tt{constructor(e,r,o,n){super(),this.varKind=e,this.name=r,this.from=o,this.to=n}render(e){let r=e.es5?we.varKinds.var:this.varKind,{name:o,from:n,to:s}=this;return`for(${r} ${o}=${n}; ${o}<${s}; ${o}++)`+super.render(e)}get names(){let e=oo(super.names,this.from);return oo(e,this.to)}},ro=class extends tt{constructor(e,r,o,n){super(),this.loop=e,this.varKind=r,this.name=o,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=vt(this.iterable,e,r),this}get names(){return rt(super.names,this.iterable.names)}},er=class extends Ne{constructor(e,r,o){super(),this.name=e,this.args=r,this.async=o}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};er.kind="func";var tr=class extends Yt{render(e){return"return "+super.render(e)}};tr.kind="return";var An=class extends Ne{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var o,n;return super.optimizeNames(e,r),(o=this.catch)===null||o===void 0||o.optimizeNames(e,r),(n=this.finally)===null||n===void 0||n.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&rt(e,this.catch.names),this.finally&&rt(e,this.finally.names),e}},rr=class extends Ne{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};rr.kind="catch";var or=class extends Ne{render(e){return"finally"+super.render(e)}};or.kind="finally";var Dn=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
4
4
|
`:""},this._extScope=e,this._scope=new we.Scope({parent:e}),this._nodes=[new Nn]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let o=this._extScope.value(e,r);return(this._values[o.prefix]||(this._values[o.prefix]=new Set)).add(o),o}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,o,n){let s=this._scope.toName(r);return o!==void 0&&n&&(this._constants[s.str]=o),this._leafNode(new Tn(e,s,o)),s}const(e,r,o){return this._def(we.varKinds.const,e,r,o)}let(e,r,o){return this._def(we.varKinds.let,e,r,o)}var(e,r,o){return this._def(we.varKinds.var,e,r,o)}assign(e,r,o){return this._leafNode(new to(e,r,o))}add(e,r){return this._leafNode(new Rn(e,I.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==M.nil&&this._leafNode(new qn(e)),this}object(...e){let r=["{"];for(let[o,n]of e)r.length>1&&r.push(","),r.push(o),(o!==n||this.opts.es5)&&(r.push(":"),(0,M.addCodeArg)(r,n));return r.push("}"),new M._Code(r)}if(e,r,o){if(this._blockNode(new et(e)),r&&o)this.code(r).else().code(o).endIf();else if(r)this.code(r).endIf();else if(o)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new et(e))}else(){return this._elseNode(new $t)}endIf(){return this._endBlockNode(et,$t)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new jn(e),r)}forRange(e,r,o,n,s=this.opts.es5?we.varKinds.var:we.varKinds.let){let i=this._scope.toName(e);return this._for(new On(s,i,r,o),()=>n(i))}forOf(e,r,o,n=we.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=r instanceof M.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,M._)`${i}.length`,a=>{this.var(s,(0,M._)`${i}[${a}]`),o(s)})}return this._for(new ro("of",n,s,r),()=>o(s))}forIn(e,r,o,n=this.opts.es5?we.varKinds.var:we.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,M._)`Object.keys(${r})`,o);let s=this._scope.toName(e);return this._for(new ro("in",n,s,r),()=>o(s))}endFor(){return this._endBlockNode(tt)}label(e){return this._leafNode(new In(e))}break(e){return this._leafNode(new Cn(e))}return(e){let r=new tr;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(tr)}try(e,r,o){if(!r&&!o)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new An;if(this._blockNode(n),this.code(e),r){let s=this.name("e");this._currNode=n.catch=new rr(s),r(s)}return o&&(this._currNode=n.finally=new or,this.code(o)),this._endBlockNode(rr,or)}throw(e){return this._leafNode(new Mn(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let o=this._nodes.length-r;if(o<0||e!==void 0&&o!==e)throw new Error(`CodeGen: wrong number of nodes: ${o} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=M.nil,o,n){return this._blockNode(new er(e,r,o)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(er)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let o=this._currNode;if(o instanceof e||r&&o instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof et))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};I.CodeGen=Dn;function rt(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function oo(t,e){return e instanceof M._CodeOrName?rt(t,e.names):t}function vt(t,e,r){if(t instanceof M.Name)return o(t);if(!n(t))return t;return new M._Code(t._items.reduce((s,i)=>(i instanceof M.Name&&(i=o(i)),i instanceof M._Code?s.push(...i._items):s.push(i),s),[]));function o(s){let i=r[s.str];return i===void 0||e[s.str]!==1?s:(delete e[s.str],i)}function n(s){return s instanceof M._Code&&s._items.some(i=>i instanceof M.Name&&e[i.str]===1&&r[i.str]!==void 0)}}function Rf(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function ka(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,M._)`!${Zn(t)}`}I.not=ka;var If=Pa(I.operators.AND);function Cf(...t){return t.reduce(If)}I.and=Cf;var Mf=Pa(I.operators.OR);function qf(...t){return t.reduce(Mf)}I.or=qf;function Pa(t){return(e,r)=>e===M.nil?r:r===M.nil?e:(0,M._)`${Zn(e)} ${t} ${Zn(r)}`}function Zn(t){return t instanceof M.Name?t:(0,M._)`(${t})`}});var N=$(C=>{"use strict";Object.defineProperty(C,"__esModule",{value:!0});C.checkStrictMode=C.getErrorPath=C.Type=C.useFunc=C.setEvaluated=C.evaluatedPropsToName=C.mergeEvaluated=C.eachItem=C.unescapeJsonPointer=C.escapeJsonPointer=C.escapeFragment=C.unescapeFragment=C.schemaRefOrVal=C.schemaHasRulesButRef=C.schemaHasRules=C.checkUnknownRules=C.alwaysValidSchema=C.toHash=void 0;var L=R(),Nf=Qt();function jf(t){let e={};for(let r of t)e[r]=!0;return e}C.toHash=jf;function Of(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(Ia(t,e),!Ca(e,t.self.RULES.all))}C.alwaysValidSchema=Of;function Ia(t,e=t.schema){let{opts:r,self:o}=t;if(!r.strictSchema||typeof e=="boolean")return;let n=o.RULES.keywords;for(let s in e)n[s]||Na(t,`unknown keyword: "${s}"`)}C.checkUnknownRules=Ia;function Ca(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}C.schemaHasRules=Ca;function Af(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}C.schemaHasRulesButRef=Af;function Df({topSchemaRef:t,schemaPath:e},r,o,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,L._)`${r}`}return(0,L._)`${t}${e}${(0,L.getProperty)(o)}`}C.schemaRefOrVal=Df;function Zf(t){return Ma(decodeURIComponent(t))}C.unescapeFragment=Zf;function Lf(t){return encodeURIComponent(Fn(t))}C.escapeFragment=Lf;function Fn(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}C.escapeJsonPointer=Fn;function Ma(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}C.unescapeJsonPointer=Ma;function Ff(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}C.eachItem=Ff;function Ta({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:o}){return(n,s,i,a)=>{let c=i===void 0?s:i instanceof L.Name?(s instanceof L.Name?t(n,s,i):e(n,s,i),i):s instanceof L.Name?(e(n,i,s),s):r(s,i);return a===L.Name&&!(c instanceof L.Name)?o(n,c):c}}C.mergeEvaluated={props:Ta({mergeNames:(t,e,r)=>t.if((0,L._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,L._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,L._)`${r} || {}`).code((0,L._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,L._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,L._)`${r} || {}`),Hn(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:qa}),items:Ta({mergeNames:(t,e,r)=>t.if((0,L._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,L._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,L._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,L._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function qa(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,L._)`{}`);return e!==void 0&&Hn(t,r,e),r}C.evaluatedPropsToName=qa;function Hn(t,e,r){Object.keys(r).forEach(o=>t.assign((0,L._)`${e}${(0,L.getProperty)(o)}`,!0))}C.setEvaluated=Hn;var Ra={};function Hf(t,e){return t.scopeValue("func",{ref:e,code:Ra[e.code]||(Ra[e.code]=new Nf._Code(e.code))})}C.useFunc=Hf;var Ln;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(Ln||(C.Type=Ln={}));function Uf(t,e,r){if(t instanceof L.Name){let o=e===Ln.Num;return r?o?(0,L._)`"[" + ${t} + "]"`:(0,L._)`"['" + ${t} + "']"`:o?(0,L._)`"/" + ${t}`:(0,L._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,L.getProperty)(t).toString():"/"+Fn(t)}C.getErrorPath=Uf;function Na(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}C.checkStrictMode=Na});var je=$(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:!0});var te=R(),Vf={data:new te.Name("data"),valCxt:new te.Name("valCxt"),instancePath:new te.Name("instancePath"),parentData:new te.Name("parentData"),parentDataProperty:new te.Name("parentDataProperty"),rootData:new te.Name("rootData"),dynamicAnchors:new te.Name("dynamicAnchors"),vErrors:new te.Name("vErrors"),errors:new te.Name("errors"),this:new te.Name("this"),self:new te.Name("self"),scope:new te.Name("scope"),json:new te.Name("json"),jsonPos:new te.Name("jsonPos"),jsonLen:new te.Name("jsonLen"),jsonPart:new te.Name("jsonPart")};Un.default=Vf});var nr=$(re=>{"use strict";Object.defineProperty(re,"__esModule",{value:!0});re.extendErrors=re.resetErrorsCount=re.reportExtraError=re.reportError=re.keyword$DataError=re.keywordError=void 0;var j=R(),so=N(),ie=je();re.keywordError={message:({keyword:t})=>(0,j.str)`must pass "${t}" keyword validation`};re.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,j.str)`"${t}" keyword must be ${e} ($data)`:(0,j.str)`"${t}" keyword is invalid ($data)`};function Kf(t,e=re.keywordError,r,o){let{it:n}=t,{gen:s,compositeRule:i,allErrors:a}=n,c=Aa(t,e,r);o??(i||a)?ja(s,c):Oa(n,(0,j._)`[${c}]`)}re.reportError=Kf;function Gf(t,e=re.keywordError,r){let{it:o}=t,{gen:n,compositeRule:s,allErrors:i}=o,a=Aa(t,e,r);ja(n,a),s||i||Oa(o,ie.default.vErrors)}re.reportExtraError=Gf;function Bf(t,e){t.assign(ie.default.errors,e),t.if((0,j._)`${ie.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,j._)`${ie.default.vErrors}.length`,e),()=>t.assign(ie.default.vErrors,null)))}re.resetErrorsCount=Bf;function Jf({gen:t,keyword:e,schemaValue:r,data:o,errsCount:n,it:s}){if(n===void 0)throw new Error("ajv implementation error");let i=t.name("err");t.forRange("i",n,ie.default.errors,a=>{t.const(i,(0,j._)`${ie.default.vErrors}[${a}]`),t.if((0,j._)`${i}.instancePath === undefined`,()=>t.assign((0,j._)`${i}.instancePath`,(0,j.strConcat)(ie.default.instancePath,s.errorPath))),t.assign((0,j._)`${i}.schemaPath`,(0,j.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,j._)`${i}.schema`,r),t.assign((0,j._)`${i}.data`,o))})}re.extendErrors=Jf;function ja(t,e){let r=t.const("err",e);t.if((0,j._)`${ie.default.vErrors} === null`,()=>t.assign(ie.default.vErrors,(0,j._)`[${r}]`),(0,j._)`${ie.default.vErrors}.push(${r})`),t.code((0,j._)`${ie.default.errors}++`)}function Oa(t,e){let{gen:r,validateName:o,schemaEnv:n}=t;n.$async?r.throw((0,j._)`new ${t.ValidationError}(${e})`):(r.assign((0,j._)`${o}.errors`,e),r.return(!1))}var ot={keyword:new j.Name("keyword"),schemaPath:new j.Name("schemaPath"),params:new j.Name("params"),propertyName:new j.Name("propertyName"),message:new j.Name("message"),schema:new j.Name("schema"),parentSchema:new j.Name("parentSchema")};function Aa(t,e,r){let{createErrors:o}=t.it;return o===!1?(0,j._)`{}`:Wf(t,e,r)}function Wf(t,e,r={}){let{gen:o,it:n}=t,s=[Xf(n,r),Qf(t,r)];return Yf(t,e,s),o.object(...s)}function Xf({errorPath:t},{instancePath:e}){let r=e?(0,j.str)`${t}${(0,so.getErrorPath)(e,so.Type.Str)}`:t;return[ie.default.instancePath,(0,j.strConcat)(ie.default.instancePath,r)]}function Qf({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:o}){let n=o?e:(0,j.str)`${e}/${t}`;return r&&(n=(0,j.str)`${n}${(0,so.getErrorPath)(r,so.Type.Str)}`),[ot.schemaPath,n]}function Yf(t,{params:e,message:r},o){let{keyword:n,data:s,schemaValue:i,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;o.push([ot.keyword,n],[ot.params,typeof e=="function"?e(t):e||(0,j._)`{}`]),c.messages&&o.push([ot.message,typeof r=="function"?r(t):r]),c.verbose&&o.push([ot.schema,i],[ot.parentSchema,(0,j._)`${l}${d}`],[ie.default.data,s]),u&&o.push([ot.propertyName,u])}});var Za=$(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.boolOrEmptySchema=wt.topBoolOrEmptySchema=void 0;var ep=nr(),tp=R(),rp=je(),op={message:"boolean schema is false"};function np(t){let{gen:e,schema:r,validateName:o}=t;r===!1?Da(t,!1):typeof r=="object"&&r.$async===!0?e.return(rp.default.data):(e.assign((0,tp._)`${o}.errors`,null),e.return(!0))}wt.topBoolOrEmptySchema=np;function sp(t,e){let{gen:r,schema:o}=t;o===!1?(r.var(e,!1),Da(t)):r.var(e,!0)}wt.boolOrEmptySchema=sp;function Da(t,e){let{gen:r,data:o}=t,n={gen:r,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,ep.reportError)(n,op,void 0,e)}});var Vn=$(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.getRules=bt.isJSONType=void 0;var ip=["string","number","integer","boolean","null","object","array"],ap=new Set(ip);function cp(t){return typeof t=="string"&&ap.has(t)}bt.isJSONType=cp;function lp(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}bt.getRules=lp});var Kn=$(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.shouldUseRule=Ue.shouldUseGroup=Ue.schemaHasRulesForType=void 0;function up({schema:t,self:e},r){let o=e.RULES.types[r];return o&&o!==!0&&La(t,o)}Ue.schemaHasRulesForType=up;function La(t,e){return e.rules.some(r=>Fa(t,r))}Ue.shouldUseGroup=La;function Fa(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(o=>t[o]!==void 0))}Ue.shouldUseRule=Fa});var sr=$(oe=>{"use strict";Object.defineProperty(oe,"__esModule",{value:!0});oe.reportTypeError=oe.checkDataTypes=oe.checkDataType=oe.coerceAndCheckDataType=oe.getJSONTypes=oe.getSchemaTypes=oe.DataType=void 0;var dp=Vn(),fp=Kn(),pp=nr(),T=R(),Ha=N(),St;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(St||(oe.DataType=St={}));function mp(t){let e=Ua(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}oe.getSchemaTypes=mp;function Ua(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(dp.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}oe.getJSONTypes=Ua;function hp(t,e){let{gen:r,data:o,opts:n}=t,s=gp(e,n.coerceTypes),i=e.length>0&&!(s.length===0&&e.length===1&&(0,fp.schemaHasRulesForType)(t,e[0]));if(i){let a=Bn(e,o,n.strictNumbers,St.Wrong);r.if(a,()=>{s.length?yp(t,e,s):Jn(t)})}return i}oe.coerceAndCheckDataType=hp;var Va=new Set(["string","number","integer","boolean","null"]);function gp(t,e){return e?t.filter(r=>Va.has(r)||e==="array"&&r==="array"):[]}function yp(t,e,r){let{gen:o,data:n,opts:s}=t,i=o.let("dataType",(0,T._)`typeof ${n}`),a=o.let("coerced",(0,T._)`undefined`);s.coerceTypes==="array"&&o.if((0,T._)`${i} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>o.assign(n,(0,T._)`${n}[0]`).assign(i,(0,T._)`typeof ${n}`).if(Bn(e,n,s.strictNumbers),()=>o.assign(a,n))),o.if((0,T._)`${a} !== undefined`);for(let u of r)(Va.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);o.else(),Jn(t),o.endIf(),o.if((0,T._)`${a} !== undefined`,()=>{o.assign(n,a),_p(t,a)});function c(u){switch(u){case"string":o.elseIf((0,T._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,T._)`"" + ${n}`).elseIf((0,T._)`${n} === null`).assign(a,(0,T._)`""`);return;case"number":o.elseIf((0,T._)`${i} == "boolean" || ${n} === null
|
|
5
5
|
|| (${i} == "string" && ${n} && ${n} == +${n})`).assign(a,(0,T._)`+${n}`);return;case"integer":o.elseIf((0,T._)`${i} === "boolean" || ${n} === null
|
|
6
6
|
|| (${i} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(a,(0,T._)`+${n}`);return;case"boolean":o.elseIf((0,T._)`${n} === "false" || ${n} === 0 || ${n} === null`).assign(a,!1).elseIf((0,T._)`${n} === "true" || ${n} === 1`).assign(a,!0);return;case"null":o.elseIf((0,T._)`${n} === "" || ${n} === 0 || ${n} === false`),o.assign(a,null);return;case"array":o.elseIf((0,T._)`${i} === "string" || ${i} === "number"
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
import{A as a,B as b,C as c,D as d,E as e,F as f}from"./chunk-
|
|
3
|
+
import{A as a,B as b,C as c,D as d,E as e,F as f}from"./chunk-GTJ3EM6H.js";import"./chunk-XCKQHL4G.js";import"./chunk-PHAMF4JF.js";import"./chunk-PLRB2YXJ.js";import"./chunk-PSANHDZM.js";export{a as createSession,f as getExtra,b as getSession,d as listSessions,e as saveExtra,c as updateSession};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
import{$ as p,M as a,N as b,O as c,P as d,Q as e,R as f,S as g,T as h,U as i,V as j,W as k,X as l,Y as m,Z as n,_ as o,aa as q,ba as r}from"./chunk-
|
|
3
|
+
import{$ as p,M as a,N as b,O as c,P as d,Q as e,R as f,S as g,T as h,U as i,V as j,W as k,X as l,Y as m,Z as n,_ as o,aa as q,ba as r}from"./chunk-QVH44I66.js";import"./chunk-PFISREY4.js";import"./chunk-JV7TZDKJ.js";import"./chunk-VIBEEWPC.js";import"./chunk-PFZVET7S.js";import"./chunk-6V4OEOOX.js";import"./chunk-RGMTLNMF.js";import"./chunk-D4WPRRBT.js";import"./chunk-WN53ARHJ.js";import"./chunk-A7FNR3T5.js";import"./chunk-J2JXLEAI.js";import"./chunk-SGLQY53R.js";import"./chunk-DKGGJM6Z.js";import"./chunk-AMRJXYL4.js";import"./chunk-3D3Z4TBR.js";import"./chunk-2BPR6LK6.js";import"./chunk-NU3X7P4N.js";import"./chunk-RJ6JA2LZ.js";import"./chunk-XCKQHL4G.js";import"./chunk-PHAMF4JF.js";import"./chunk-PLRB2YXJ.js";import"./chunk-C2ESM27Z.js";import"./chunk-PSANHDZM.js";export{i as OPERATION_KINDS,a as READ_FORMATS,j as applyOperation,k as applyOperationWithSources,q as consolidate,g as countFlags,b as detectFormat,r as judge,p as linkText,e as listClips,h as listFlags,f as listMedia,c as readTimeline,l as resolveTarget,o as routesText,d as summarize,n as writeDestination,m as writeTimeline};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "conformtools",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.9",
|
|
4
4
|
"description": "conform.tools on your machine: timeline exchange, relink, media trim, delivery and auto conform, as MCP tools for Claude and other AI apps, a CLI and a local HTTP API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|
package/dist/chunk-NAFLOZER.js
DELETED
|
@@ -1,9 +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-PHAMF4JF.js";import{A as K,I as X,L as Y,O as H,P as q,Q as V,Y as u,b as l,f as F,g as x,k as g,l as J,p as N,r as G,s as z,v as y,x as $,y as C,z as v}from"./chunk-PLRB2YXJ.js";var _={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}},indie:{id:"indie",name:"MCP",monthly:49,yearly:490,stripe:{monthly:"price_1T5XDXJ5lnla0aaLasKq49tm",yearly:"price_1T5XDXJ5lnla0aaL2MdMSuI9"},includes:{web:!0,mcp:!0,app:!1}},pro:{id:"pro",name:"App",monthly:199,yearly:1990,stripe:{monthly:"price_1T5X8oJ5lnla0aaLyNJa93H0",yearly:"price_1T5X8oJ5lnla0aaL3dh7b1el"},includes:{web:!0,mcp:!0,app:!0}},studio:{id:"studio",name:"Studio",monthly:"custom",yearly:"custom",stripe:{monthly:"price_1T5X7xJ5lnla0aaLoeE1aBlL",yearly:"price_1T5X7xJ5lnla0aaLeBiYo3Di"},includes:{web:!0,mcp:!0,app:!0}}},Z={web:!0,mcp:!1,app:!1};var Ne=Object.fromEntries(Object.values(_).flatMap(e=>Object.values(e.stripe).map(t=>[t,e.id])));import{createPrivateKey as De,createPublicKey as fe,sign as Te,verify as ge}from"node:crypto";import{Buffer as w}from"node:buffer";var he="CONFORMTOOLS_LICENSE_V1",W=/^[0-9A-F]{8}(-[0-9A-F]{8}){3}$/,Q=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(w.from(t,"base64").toString("utf8"));if(n?.magic!==he||!n.payload?.data)throw new Error("not a conform.tools licence");return n.payload}function te(e,t){let n=w.from(e.signature,"base64"),r=w.from(Q(e.data));return n.length!==64?!1:t.some(i=>ge(null,r,fe({key:w.concat([w.from("302a300506032b6570032100","hex"),w.from(i)]),format:"der",type:"spki"}),n))}async function D(){let e=x()==="win32"?"conformtools-analyze.exe":"conformtools-analyze",t=[l("CONFORM_ANALYZE"),N(new URL(`./${e}`,import.meta.url)),N(new URL(`../../rust/target/release/${e}`,import.meta.url))].filter(Boolean);for(let n of t)if(await z(n))return n;return null}var ne=e=>e.code==="not_entitled"?new h("not_entitled",String(e.why)):void 0;async function Be(e){let t=await re(),n=await t.ask({op:"job",reference:e.reference,clips:e.clips,lite:e.lite??!0,display:!!e.display});if(!n.ok)throw t.close(),ne(n)??new Error(`analysis engine: ${n.why}`);return t}async function Fe(e,t,n){let r=await re(),i=()=>r.close();n?.addEventListener("abort",i);let o;try{o=await r.ask(e,t)}finally{n?.removeEventListener("abort",i),r.close()}if(n?.aborted)throw new Error("cancelled");if(!o.ok)throw ne(o)??new Error(o.why??`the analysis engine could not run ${e.op}`);return o}async function re(){let e=await D();if(!e)throw new Error("the analysis engine (conformtools-analyze) is not installed");let t="",n=null,r=H(e,["serve"],s=>{t+=new TextDecoder().decode(s);let d;for(;(d=t.indexOf(`
|
|
4
|
-
`))>=0;){let m=t.slice(0,d);t=t.slice(d+1);let c=JSON.parse(m);if(c.progress){n?.progress?.(c.progress[0],c.progress[1],c.phase??"");continue}let p=n;n=null,p?.done(c)}},s=>console.error(s.trimEnd()));r.exited.then(()=>n?.done({ok:!1,why:"the analysis engine exited"}));let i=Promise.resolve();return{ask:(s,d)=>{let m=i.then(async()=>{r.hold(!0);try{let c=new Promise(f=>{n={done:f,progress:d}});await r.write(new TextEncoder().encode(JSON.stringify(s)+`
|
|
5
|
-
`));let p=await c;return p.miss&&(console.error(`[mirror] MISS \u2014 ${p.miss} is not in the mirror. Replay never reads the source drive; record this case again with the drive mounted (CONFORM_MIRROR_MODE=record).`),F(75)),p}finally{r.hold(!1)}});return i=m.catch(()=>{}),m},close:()=>r.close()}}var ye=["cMwVBrEYKMzlG6pC7FF2lNKIoEqGz2xB5yph6clNnTg=","qnheqkkDU09l1oI6h2CFh4uQ97bY/hkTA5niGKH0+X8="],_e=ye.map(e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)));function A(){let e=l("CONFORM_RECORDS_DIR");if(e)return e;let t=J(),n=x()==="darwin"?u(t,"Library/Application Support"):x()==="win32"?l("LOCALAPPDATA")??u(t,"AppData/Local"):l("XDG_DATA_HOME")??u(t,".local/share");return u(n,"conform.tools")}var we=()=>l("CONFORM_LICENSE_PATH")??u(A(),"license.lic"),k=()=>u(A(),"grant.lic"),be=null;function T(){return be??=(async()=>{let e=await D();if(!e)return[];let t=await Y(e,["machine"],{timeoutMs:15e3}).catch(()=>null);try{return JSON.parse(t?.stdout??"").machines.filter(n=>W.test(n))}catch{return[]}})()}function xe(e,t,n=Date.now()){if(!te(e,_e))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 ie(){let e;try{e=await y(we())}catch{return null}try{return xe(ee(e),await T())}catch(t){return{ok:!1,reason:t.message}}}var ve={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=l("CONFORM_ENV")==="staging"?"staging":"production",t=ve[e];return{env:e,supabaseUrl:l("CONFORM_SUPABASE_URL")??t.supabaseUrl,anonKey:l("CONFORM_SUPABASE_ANON_KEY")??t.anonKey,appBase:l("CONFORM_APP_BASE")??t.appBase}}var Se=600*1e3,oe=72*3600*1e3,Ee=300*1e3,E=()=>u(g(),a().env==="production"?"auth.json":`auth-${a().env}.json`);async function M(){for(let e of new Set([E(),u(g(),"auth.json")]))try{let t=JSON.parse(await y(e));if(t.env===a().env&&t.access_token)return t}catch{}return null}async function Pe(){try{for await(let e of X(g())){if(!/^auth(?:-(\w+))?\.json$/.exec(e.name))continue;let n=JSON.parse(await y(u(g(),e.name)));if(n.access_token&&n.env&&n.env!==a().env)return{other_env:n.env}}}catch{}return{}}async function R(e){await C(g()),await $(E(),JSON.stringify(e)),await K(E(),384)}var se=6e3,P=0,ce=()=>Date.now()<P,le=()=>{P=Date.now()+6e4};function We(){P=0}async function ue(e){if(e.expires_at-60>Date.now()/1e3)return e.access_token;if(ce())return null;let t=a();try{let n=await fetch(`${t.supabaseUrl}/auth/v1/token?grant_type=refresh_token`,{method:"POST",headers:{apikey:t.anonKey,"content-type":"application/json"},body:JSON.stringify({refresh_token:e.refresh_token}),signal:AbortSignal.timeout(se)}).catch(i=>{throw le(),i});if(!n.ok)return n.status===400||n.status===401?"":null;let r=await n.json();return e.access_token=r.access_token,r.refresh_token&&(e.refresh_token=r.refresh_token),e.expires_at=r.expires_at??Math.floor(Date.now()/1e3)+(r.expires_in??3600),await R(e),e.access_token}catch{return null}}async function Qe(){let e=await M();return e&&await ue(e)||null}var b=null;function ae(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 pe(e={}){let t=await ie();if(t?.ok)return{signed_in:!!await M().catch(()=>null),entitled:!0,env:a().env,email:t.data.email,access:"licence",tier:t.data.tier,source:"licence"};let n=await Ae(e);return t&&!n.entitled?{...n,licence_error:t.reason}:n}async function Ae(e){if(!e.force&&b&&Date.now()-b.at<Se)return{...b.status,source:"cache"};let t=a(),n=await M();if(!n)return{signed_in:!1,entitled:!1,env:t.env,reason:"not_signed_in",...await Pe()};let r=await ue(n);if(r==="")return{signed_in:!0,entitled:!1,env:t.env,reason:"auth_rejected"};if(r&&!ce())try{let i=(await T())[0],o=await fetch(`${t.supabaseUrl}/functions/v1/v1-billing/v1/billing/entitlement${i?`?machine=${i}`:""}`,{headers:{authorization:`Bearer ${r}`,apikey:t.anonKey},signal:AbortSignal.timeout(se)}).catch(s=>{throw le(),s});if(o.status===401||o.status===403)return{signed_in:!0,entitled:!1,env:t.env,reason:"auth_rejected"};if(o.ok){let{grant:s,...d}=(await o.json()).data;i&&await ke(s),n.last_entitlement=d,n.last_entitlement_at=Date.now(),await R(n);let m=ae(d,"live");return b={at:Date.now(),status:m},m}}catch{}if(n.last_entitlement&&n.last_entitlement_at&&Date.now()-n.last_entitlement_at<oe){let i=oe-(Date.now()-n.last_entitlement_at);return{...ae(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 ke(e){try{if(!e)return await v(k());await C(A()),await $(k(),e)}catch{}}function Le(e){return e.source==="licence"?`${e.email} \xB7 machine licence (${e.tier}) \u2014 runs offline, no account check`:Oe(e)+(e.licence_error?`
|
|
6
|
-
(the machine licence was not used: ${e.licence_error})`:"")}function Oe(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}
|
|
7
|
-
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}
|
|
8
|
-
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=L(e),o=i?` \xB7 includes ${[i.web&&"the web tools",i.mcp&&"the MCP",i.app&&"the app"].filter(Boolean).join(", ")||"the web tools"}`:"";return`${n}
|
|
9
|
-
${r}${o}${e.source==="grace"?` \u2014 offline, using the last check (${e.grace_remaining_h} h of grace left)`:""}`}function L(e){if(e.access==="trial")return Z;let t=(e.tier??"").toLowerCase();return(t==="enterprise"?_.studio:_[t])?.includes??null}var de=()=>pe();function et(e){de=e}async function me(){let e=await de();if(e.entitled)return e;let t=e.signed_in&&e.reason==="not_entitled"?"not_entitled":"not_signed_in";throw new h(t,Le(e),{account:e})}async function tt(){let e=await me();if(e.source==="licence"||L(e)?.mcp!==!1)return e;throw new h("not_entitled",`The conform.tools MCP is in the MCP plan ($${_.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 nt(){let e=await me();if(e.source==="licence"||L(e)?.app)return e;throw new h("not_entitled",`The conform.tools app is in the App plan ($${_.pro.monthly}/mo). ${e.access==="trial"?"Your trial":`Your plan${e.tier?` (${e.tier})`:""}`} does not include the app${L(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 S=null;function rt(e={}){if(S)return S;let t=a(),n=crypto.randomUUID().replaceAll("-","");return S=new Promise((r,i)=>{let o=!1,s=c=>{o||(o=!0,clearTimeout(m),setTimeout(()=>d.close(),250),S=null,c())},d=V({hostname:"127.0.0.1",port:0,onListen:async c=>{let p=`${t.appBase}/plugin-auth?client=engine&port=${c}&state=${n}`,f=await q(p);e.onUrl?.(p,f)}},async c=>{let p=new URL(c.url);if(p.pathname!=="/callback")return new Response("not found",{status:404});let f=p.searchParams,U=f.get("access_token")??"",j=f.get("refresh_token")??"",O=!!U&&!!j&&f.get("state")===n;if(O){let B=Number(f.get("expires_at"));await R({env:t.env,access_token:U,refresh_token:j,expires_at:B>0?B:Math.floor(Date.now()/1e3)+3600}),b=null,P=0,pe({force:!0}).then(I=>s(()=>r(I)),I=>s(()=>i(I)))}return new Response(Ie(O),{status:O?200:400,headers:{"content-type":"text/html; charset=utf-8"}})}),m=setTimeout(()=>s(()=>i(new h("not_signed_in","sign-in was not completed within 5 minutes"))),e.timeoutMs??Ee)}),S}async function it(){b=null,P=0,await G(E())&&await v(E()),await v(k()).catch(()=>{});let e=u(g(),"auth.json");try{JSON.parse(await y(e)).env===a().env&&await v(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{Be as a,Fe as b,re as c,a as d,se as e,We as f,Qe as g,pe as h,Le as i,L as j,et as k,me as l,tt as m,nt as n,rt as o,it as p};
|