conformtools 0.6.11 → 0.6.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -1
- package/dist/{account-IUWNSDG5.js → account-F54SG45Q.js} +1 -1
- package/dist/agent-hook-setup-RTQT5JEN.js +3 -0
- package/dist/{analysis-engine-M7W32RRC.js → analysis-engine-UWIK7AYB.js} +1 -1
- package/dist/{bridge-SV7PCLQY.js → bridge-PWYOJ7E7.js} +1 -1
- package/dist/browser/timeline_core_bg.wasm +0 -0
- package/dist/{chunk-2WBGXD27.js → chunk-4BTTR6U3.js} +2 -2
- package/dist/{chunk-NSQP6CTA.js → chunk-4VFDGL4E.js} +1 -1
- package/dist/{chunk-THVX57I3.js → chunk-6WLSIH2N.js} +1 -1
- package/dist/{chunk-DGXZB7MO.js → chunk-7W5AFZYX.js} +1 -1
- package/dist/chunk-B54TEGMG.js +5 -0
- package/dist/chunk-BTS3DFPD.js +7 -0
- package/dist/chunk-BYMCZJBQ.js +3 -0
- package/dist/{chunk-64X5DLH5.js → chunk-EP4L2BWV.js} +1 -1
- package/dist/chunk-ERUN634Q.js +6 -0
- package/dist/{chunk-6HZP2OJA.js → chunk-G3HBKJ5L.js} +1 -1
- package/dist/{chunk-IK6RKNS5.js → chunk-H4BU5WA6.js} +1 -1
- package/dist/{chunk-XIAG7ACN.js → chunk-I2Y2P5NH.js} +2 -2
- package/dist/{chunk-2CY2OOOJ.js → chunk-J43UCJ6G.js} +1 -1
- package/dist/chunk-L3HRAIDR.js +8 -0
- package/dist/chunk-LKQTE6T5.js +158 -0
- package/dist/chunk-LRGA6QJQ.js +514 -0
- package/dist/{chunk-JXTRQ3UG.js → chunk-LZRCXSUJ.js} +1 -1
- package/dist/chunk-NZLL44HU.js +3 -0
- package/dist/chunk-OD445COC.js +7 -0
- package/dist/chunk-XI6XF7FQ.js +3 -0
- package/dist/{chunk-6VP6G7CY.js → chunk-Y455Y6V4.js} +4 -4
- package/dist/{claude-setup-REU4AOKX.js → claude-setup-NGZ5NDYH.js} +1 -1
- package/dist/cli.js +9 -9
- package/dist/engine-6ACEWA4S.js +5 -0
- package/dist/framing-P5RGN5V3.js +3 -0
- package/dist/gfx-worker.js +1 -1
- package/dist/{h264-B2TLLEMI.js → h264-JI62TU4W.js} +1 -1
- package/dist/{h264-mxf-3GED5PBT.js → h264-mxf-J2QPZO4U.js} +1 -1
- package/dist/hook.js +3 -0
- package/dist/host-relink-76CFY32O.js +10 -0
- package/dist/hosted-L26AGRIY.js +3 -0
- package/dist/hosts-TBHEPV6A.js +3 -0
- package/dist/http.js +3 -3
- package/dist/{inspect-RJFJQSHZ.js → inspect-U656APGR.js} +2 -2
- package/dist/{isobmff-C5A2EFKH.js → isobmff-UISATYUR.js} +1 -1
- package/dist/{mc-video-ARKIHPA7.js → mc-video-LSTKUKNL.js} +1 -1
- package/dist/mcp.js +8 -7
- package/dist/{media-22VAJIVT.js → media-XBNKYKB7.js} +1 -1
- package/dist/mxf-ZL57VJ3C.js +3 -0
- package/dist/{ops-BCTGDBXT.js → ops-ZQEQXW2N.js} +1 -1
- package/dist/probe-ZDX6XNRF.js +3 -0
- package/dist/{r3d-FX7V4BIE.js → r3d-R4TLYJVE.js} +1 -1
- package/dist/resolve-bridge.py +31 -2
- package/dist/{sequence-patch-CN4VC5W3.js → sequence-patch-C2QRIT5V.js} +1 -1
- package/dist/store-JNWELX35.js +3 -0
- package/dist/timeline-JONFBIA3.js +3 -0
- package/package.json +5 -5
- package/dist/chunk-2QT5MMBP.js +0 -499
- package/dist/chunk-5YWO2LBG.js +0 -3
- package/dist/chunk-6NLB5TZ2.js +0 -7
- package/dist/chunk-G3SZDPDS.js +0 -3
- package/dist/chunk-RKIRHMON.js +0 -5
- package/dist/chunk-ROPKSAFP.js +0 -6
- package/dist/chunk-S6KP52OG.js +0 -8
- package/dist/chunk-VE423Z2L.js +0 -132
- package/dist/chunk-XF3YMBI7.js +0 -3
- package/dist/engine-274GQLUB.js +0 -5
- package/dist/framing-ZTMYZR2S.js +0 -3
- package/dist/host-relink-FHNXXMHW.js +0 -10
- package/dist/hosted-BWAYLJXR.js +0 -3
- package/dist/hosts-Y6HGDRLM.js +0 -3
- package/dist/mxf-CQSI6H5T.js +0 -3
- package/dist/probe-72QZKMCC.js +0 -3
- package/dist/store-H676BOKI.js +0 -3
- package/dist/timeline-5TGA5HBY.js +0 -3
- /package/dist/{still-WUCFH2WX.js → still-4UR35GZH.js} +0 -0
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
|
|
4
|
-
`)}:{}})}if(
|
|
5
|
-
`)},e.isError?422:200)}if(
|
|
3
|
+
import{a as Tt}from"./chunk-BYMCZJBQ.js";import{a as wt,b as _t,c as kt,d as yt,e as xt,h as S,i as bt,l as U,m as St}from"./chunk-LRGA6QJQ.js";import"./chunk-B54TEGMG.js";import"./chunk-I2Y2P5NH.js";import"./chunk-ERUN634Q.js";import"./chunk-J43UCJ6G.js";import"./chunk-NZLL44HU.js";import"./chunk-YU3SUSK3.js";import"./chunk-QTFFVLVJ.js";import"./chunk-5YULBQJX.js";import"./chunk-G3HBKJ5L.js";import{G as ot,H as rt,Hb as mt,Ib as ft,J as dt,P as I,cd as pt,ed as gt,gd as ht}from"./chunk-LKQTE6T5.js";import"./chunk-IN6XVTUS.js";import"./chunk-Y455Y6V4.js";import"./chunk-PFZVET7S.js";import"./chunk-6V4OEOOX.js";import"./chunk-4VFDGL4E.js";import{a as nt}from"./chunk-H4BU5WA6.js";import"./chunk-ISKNIQVO.js";import"./chunk-JKOB3U54.js";import"./chunk-EEDLRRKU.js";import"./chunk-WJ5EWXP2.js";import"./chunk-YUO3UWPH.js";import"./chunk-DKGGJM6Z.js";import"./chunk-JV7TZDKJ.js";import"./chunk-RGMTLNMF.js";import"./chunk-XDI6CPPV.js";import"./chunk-7W5AFZYX.js";import"./chunk-LZRCXSUJ.js";import"./chunk-BTS3DFPD.js";import"./chunk-6WLSIH2N.js";import"./chunk-LVGGCRDW.js";import"./chunk-C2ESM27Z.js";import"./chunk-D6YDLKSA.js";import"./chunk-4BTTR6U3.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-DPA26AOI.js";import{C as v,E as lt,t as H,u as st,v as at,x as it,y as ct,z as ut}from"./chunk-L3HRAIDR.js";import{k as F}from"./chunk-OD445COC.js";import"./chunk-EP4L2BWV.js";import{a as B}from"./chunk-PHAMF4JF.js";import{A as $,C as Z,G as L,K as D,L as q,M as tt,T as et,Z as M,_ as J,aa as b,b as E,m as P,s as W,t as K,w as X,x as Y,y as A,z as Q}from"./chunk-XI6XF7FQ.js";import"./chunk-PSANHDZM.js";import C from"node:process";var Ot=new Map;function Rt(t,s,o,T){let a=`${t}:${o}:${T}`,i=Ot.get(a);return i||(i=(async()=>{let n=b(P(),"cache","grade-luts",t);await $(n);let l=b(n,`V${o}_${T}.cube`);if(!await K(l)){let{adapter:k}=await import("./hosts-TBHEPV6A.js");if((await k("resolve").clipLut({timeline:s,track:o,start:T,out_path:l})).ok===!1)return null}return l})().catch(()=>null),Ot.set(a,i)),i}var Lt=new Set(["/app/convert","/app/canonicalize"]);function Et(t,s){let o=(s??"").split(";")[0].trim().toLowerCase();return o==="application/json"||o==="application/octet-stream"&&Lt.has(t)}function Mt(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 G={id:"local",name:"Local",client_name:null,handles:24,local:!0};async function vt(){try{return JSON.parse(await Y(b(P(),"projects","projects.json")))}catch{return[]}}async function Pt(){let t=await S("project",{action:"list"});if(!t.isError){let s=t.structuredContent?.projects??[];return await $(b(P(),"projects")),await Q(b(P(),"projects","projects.json"),JSON.stringify(s)),{projects:[G,...s],offline:!1}}return{projects:[G,...await vt()],offline:!0,code:String(t.structuredContent?.code??"offline"),reason:String(t.structuredContent?.message??t.content[0]?.text??"")}}async function Ut(t){return t==="local"?G:(await vt()).find(s=>s.id===t)??{id:t,name:t}}async function Ct(t,s,o,T,a=(i,n)=>new Response(i,{headers:{"content-type":n}})){if(s[0]!=="app")return null;let[,i,n,l]=s,k=async()=>t.headers.get("content-type")?.includes("json")?await t.json():{};try{if(i==="policy"&&t.method==="GET"){let{config:e}=await import("./account-F54SG45Q.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(i==="account"&&t.method==="GET"){let e=await S("account_status",{}),r=await F().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 F().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(i==="events"&&t.method==="GET")return T(_t());if(i==="front"&&t.method==="POST"){let e=await t.json();return wt({project:String(e.project??""),view:String(e.view??""),...e.tool?{tool:String(e.tool)}:{}}),o({ok:!0})}if(i==="convert"&&t.method==="POST"){let e=new URL(t.url).searchParams,r=M(e.get("name")||"timeline"),u=e.get("out")||"",h=JSON.parse(e.get("targets")||"[]"),c=JSON.parse(e.get("sequences")||"[]");if(!u||!h.length)return o({ok:!1,error:"a folder and at least one format are needed"},400);let m=await D("conform-te-"),w=b(m,r);await A(w,new Uint8Array(await t.arrayBuffer()));let p=await S("timeline_read",{path:w}),y=p.structuredContent?.session_id??p.content[0]?.text.match(/session_id: (\w+)/)?.[1];if(p.isError||!y)return o({ok:!1,error:p.content[0]?.text??"could not read the timeline"});let g=(await v(y)).session.timelines.filter(x=>x.kind!=="compound"),_=c.length?g.filter(x=>c.includes(x.name??"")):g,d=[],O=0;for(let x of _)for(let R of h){let N=b(u,`${Mt(x.name??"timeline")}.${R.ext}`),V=await S("timeline_write",{session_id:y,target:R.target,out_path:N,..._.length>1||g.length>1?{timeline_id:x.id}:{}});V.isError?d.push(`${x.name} \u2192 ${R.target}: ${V.content[0]?.text}`):O++}return await L(m).catch(()=>{}),o({ok:O>0,savedCount:O,...d.length?{error:d.join(`
|
|
4
|
+
`)}:{}})}if(i==="fs"&&t.method==="POST"){let{op:e,path:r,offset:u=0,length:h=0}=await k();if(e==="statPath"){let c=await W(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 q(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 tt(r);try{return a(await c.readAt(Math.max(0,u),Math.min(Math.max(0,h),16<<20)),"application/octet-stream")}finally{await c.close()}}return o({ok:!1,code:"bad_request",message:`no fs op ${e}`},400)}if(i==="canonicalize"&&t.method==="POST"){let e=new URL(t.url).searchParams,r=JSON.parse(e.get("sequences")||"[]"),u=JSON.parse(e.get("previous")||"[]"),h=await D("conform-te-");try{let c=b(h,M(e.get("name")||"timeline"));await A(c,new Uint8Array(await t.arrayBuffer()));let m=await S("timeline_read",{path:c}),w=m.structuredContent?.session_id??m.content[0]?.text.match(/session_id: (\w+)/)?.[1];if(m.isError||!w)return o({ok:!1,error:m.content[0]?.text??"could not read the timeline"},422);let p=(await v(w)).session,y=p.timelines;if(r.length){let g=new Map;for(let d of u)g.set(d,(g.get(d)??0)+1);let _=new Set;for(let d of r){let O=p.timelines.filter(N=>N.kind!=="compound"&&(N.name??"")===d),x=g.get(d)??0;g.set(d,x+1);let R=O[Math.min(x,O.length-1)];R&&_.add(R)}y=p.timelines.filter(d=>d.kind==="compound"||_.has(d))}return o({ok:!0,session_id:w,session:{...p,timelines:y}})}finally{await L(h).catch(()=>{})}}if(i==="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 w=(await v(n)).session,p=e.get("track")==="offline"?"offline":Number(e.get("track"))||void 0,y;if(e.get("grade")==="resolve"&&p!=="offline"){let _=(()=>{try{return mt(w,{record:r,timeline:e.get("timeline")??void 0,track:p})}catch{return null}})();_&&(y=await Rt(n,e.get("host_timeline")??void 0,_.video_track,_.record_start)??void 0)}let g=await ft(w,r,u,e.get("timeline")??void 0,p,y);if(g){let _=new Uint8Array(12+g.px.length),d=new DataView(_.buffer);return d.setUint32(0,g.w,!0),d.setUint32(4,g.h,!0),d.setUint32(8,g.order==="bgra"?1:0,!0),_.set(g.px,12),a(_,"application/x-conform-pixels")}}catch(w){return o({ok:!1,code:"no_frame",message:w.message},404)}let h=await S("timeline_frame",{session_id:n,record:r,width:u,...e.get("timeline")?{timeline:e.get("timeline")}:{}}),c=h.structuredContent?.out_path;if(h.isError||!c)return o({ok:!1,code:String(h.structuredContent?.code??"no_frame"),message:h.content[0]?.text??"no picture here"},404);let m=await X(c);return await(M(J(c)).startsWith("conform-frame-")?L(J(c)):Z(c)).catch(()=>{}),a(m,"image/png")}if(i==="sessions"&&n&&t.method==="GET"){let e=await v(n).catch(()=>null);return e?o(e):o({ok:!1,code:"not_found"},404)}if(i==="sessions"&&!n)return o(await lt());if(i!=="projects")return o({ok:!1,code:"not_found"},404);if(!n){if(t.method==="POST"){let e=await k(),r=await S("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 Pt(),o(r.structuredContent))}return o(await Pt())}if(!l){let[e,r,u,h,c,m]=await Promise.all([Ut(n),st(n).catch(()=>null),ut(n),dt(n),pt(n).then(y=>y.facts).catch(()=>[]),n===H?null:gt().catch(()=>null)]);await it(n===H?null:{id:n,name:e.name??n});let{text:w="",...p}=r??{};return o({project:e,context:w,context_meta:p,sessions:u,activity:h.slice(-100).reverse(),known:ht(c),facility:m?.text??""})}if(l==="sessions"&&t.method==="PUT")return await ct(n,String((await k()).session_id??"")),o({ok:!0});if(l==="context"&&t.method==="PUT"){let e=await k();try{let{text:r,...u}=await at(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 jt=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 z=E("CONFORM_HTTP_TOKEN")??"",$t=(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 $t.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},Nt=new Set,f=(t,s,o=200)=>new Response(JSON.stringify(s),{status:o,headers:j(t,new Headers({"content-type":"application/json"}))});et({hostname:"127.0.0.1",port:jt,onListen:t=>{Nt=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)`),Tt(t,z)}},async t=>{let s=new URL(t.url),o=(t.headers.get("host")??"").toLowerCase();if(!Nt.has(o))return new Response("forbidden host",{status:403});let T=t.headers.get("origin");if(T&&!$t.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"&&!Et(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(z&&t.headers.get("authorization")!==`Bearer ${z}`&&s.pathname!=="/health")return f(t,{ok:!1,code:"unauthorized"},401);let a=s.pathname.split("/").filter(Boolean);try{if(s.pathname==="/health")return f(t,{ok:!0,verbs:U.length,version:nt,engine:I()});if(a[0]==="verbs"&&a.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:rt(ot.object(n.inputSchema)),protected_stages:n.protectedStages??[],engine:I()})));if(a[0]==="verbs"&&a.length===2&&t.method==="POST"){let n=St(a[1]);if(!n)return f(t,{ok:!1,code:"not_found",message:`unknown verb ${a[1]}`},404);let l=t.headers.get("content-type")?.includes("json")?await t.json():{},k=bt(n.name,l);if(!k.ok)return f(t,{...k.result.structuredContent,text:k.result.content[0].text},400);let e=await S(n.name,k.data,{client:t.headers.get("x-conform-client")??"http",poll:t.headers.get("x-conform-poll")==="1"});return f(t,{...e.structuredContent??{ok:!e.isError},text:e.content.map(r=>r.text).join(`
|
|
5
|
+
`)},e.isError?422:200)}if(a[0]==="debug"&&a.length===3&&t.method==="POST"&&Deno.env.get("CONFORM_DEBUG_BRIDGE")==="1"){let{hostBridge:n}=await import("./bridge-PWYOJ7E7.js"),l=await n();return await l.waitFor(a[1],5e3)?f(t,{ok:!0,result:await l.request(a[1],a[2],t.headers.get("content-type")?.includes("json")?await t.json():{},12e4)}):f(t,{ok:!1,code:"not_connected"},409)}let i=await Ct(t,a,(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(i)return i;if(a[0]==="jobs"&&a.length===1)return f(t,await xt());if(a[0]==="jobs"&&a.length===2){if(t.method==="DELETE")return f(t,{ok:yt(a[1])});let n=await kt(a[1]);return n?f(t,n):f(t,{ok:!1,code:"not_found"},404)}return f(t,{ok:!1,code:"not_found"},404)}catch(i){return f(t,{ok:!1,code:"internal",message:i instanceof Error?i.message:String(i)},500)}});
|
|
@@ -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 Js}from"./chunk-6HZP2OJA.js";import"./chunk-IN6XVTUS.js";import"./chunk-PFZVET7S.js";import{a as Br,b as zs,d as Gs}from"./chunk-LVGGCRDW.js";import"./chunk-6V4OEOOX.js";import"./chunk-RGMTLNMF.js";import"./chunk-C2ESM27Z.js";import"./chunk-JXTRQ3UG.js";import{b as fu,c as $,d as Ks,e as k,f as ze,g as Se}from"./chunk-PSANHDZM.js";var _e={};Ks(_e,{__addDisposableResource:()=>Ei,__assign:()=>Ft,__asyncDelegator:()=>pi,__asyncGenerator:()=>fi,__asyncValues:()=>mi,__await:()=>Ge,__awaiter:()=>ai,__classPrivateFieldGet:()=>vi,__classPrivateFieldIn:()=>bi,__classPrivateFieldSet:()=>wi,__createBinding:()=>qt,__decorate:()=>ei,__disposeResources:()=>Si,__esDecorate:()=>ri,__exportStar:()=>li,__extends:()=>Qs,__generator:()=>ui,__importDefault:()=>yi,__importStar:()=>gi,__makeTemplateObject:()=>_i,__metadata:()=>oi,__param:()=>ti,__propKey:()=>si,__read:()=>Vr,__rest:()=>Zs,__rewriteRelativeImportExtension:()=>Ti,__runInitializers:()=>ni,__setFunctionName:()=>ii,__spread:()=>ci,__spreadArray:()=>di,__spreadArrays:()=>hi,__values:()=>Bt,default:()=>yu});function Qs(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Mr(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Zs(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(r[n[s]]=t[n[s]]);return r}function ei(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(i=(s<3?o(i):s>3?o(e,r,i):o(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i}function ti(t,e){return function(r,n){e(r,n,t)}}function ri(t,e,r,n,s,i){function o(T){if(T!==void 0&&typeof T!="function")throw new TypeError("Function expected");return T}for(var a=n.kind,l=a==="getter"?"get":a==="setter"?"set":"value",c=!e&&t?n.static?t:t.prototype:null,d=e||(c?Object.getOwnPropertyDescriptor(c,n.name):{}),m,_=!1,f=r.length-1;f>=0;f--){var y={};for(var v in n)y[v]=v==="access"?{}:n[v];for(var v in n.access)y.access[v]=n.access[v];y.addInitializer=function(T){if(_)throw new TypeError("Cannot add initializers after decoration has completed");i.push(o(T||null))};var w=(0,r[f])(a==="accessor"?{get:d.get,set:d.set}:d[l],y);if(a==="accessor"){if(w===void 0)continue;if(w===null||typeof w!="object")throw new TypeError("Object expected");(m=o(w.get))&&(d.get=m),(m=o(w.set))&&(d.set=m),(m=o(w.init))&&s.unshift(m)}else(m=o(w))&&(a==="field"?s.unshift(m):d[l]=m)}c&&Object.defineProperty(c,n.name,d),_=!0}function ni(t,e,r){for(var n=arguments.length>2,s=0;s<e.length;s++)r=n?e[s].call(t,r):e[s].call(t);return n?r:void 0}function si(t){return typeof t=="symbol"?t:"".concat(t)}function ii(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function oi(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function ai(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(d){try{c(n.next(d))}catch(m){o(m)}}function l(d){try{c(n.throw(d))}catch(m){o(m)}}function c(d){d.done?i(d.value):s(d.value).then(a,l)}c((n=n.apply(t,e||[])).next())})}function ui(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,s,i,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(d){return l([c,d])}}function l(c){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(r=0)),r;)try{if(n=1,s&&(i=c[0]&2?s.return:c[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,c[1])).done)return i;switch(s=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,s=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=e.call(t,r)}catch(d){c=[6,d],s=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function li(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&qt(e,t,r)}function Bt(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Vr(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),s,i=[],o;try{for(;(e===void 0||e-- >0)&&!(s=n.next()).done;)i.push(s.value)}catch(a){o={error:a}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return i}function ci(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Vr(arguments[e]));return t}function hi(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),s=0,e=0;e<r;e++)for(var i=arguments[e],o=0,a=i.length;o<a;o++,s++)n[s]=i[o];return n}function di(t,e,r){if(r||arguments.length===2)for(var n=0,s=e.length,i;n<s;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function Ge(t){return this instanceof Ge?(this.v=t,this):new Ge(t)}function fi(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),s,i=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),s[Symbol.asyncIterator]=function(){return this},s;function o(f){return function(y){return Promise.resolve(y).then(f,m)}}function a(f,y){n[f]&&(s[f]=function(v){return new Promise(function(w,T){i.push([f,v,w,T])>1||l(f,v)})},y&&(s[f]=y(s[f])))}function l(f,y){try{c(n[f](y))}catch(v){_(i[0][3],v)}}function c(f){f.value instanceof Ge?Promise.resolve(f.value.v).then(d,m):_(i[0][2],f)}function d(f){l("next",f)}function m(f){l("throw",f)}function _(f,y){f(y),i.shift(),i.length&&l(i[0][0],i[0][1])}}function pi(t){var e,r;return e={},n("next"),n("throw",function(s){throw s}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(s,i){e[s]=t[s]?function(o){return(r=!r)?{value:Ge(t[s](o)),done:!1}:i?i(o):o}:i}}function mi(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Bt=="function"?Bt(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(o){return new Promise(function(a,l){o=t[i](o),s(a,l,o.done,o.value)})}}function s(i,o,a,l){Promise.resolve(l).then(function(c){i({value:c,done:a})},o)}}function _i(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function gi(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=Wr(t),n=0;n<r.length;n++)r[n]!=="default"&&qt(e,t,r[n]);return _u(e,t),e}function yi(t){return t&&t.__esModule?t:{default:t}}function vi(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function wi(t,e,r,n,s){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(t,r):s?s.value=r:e.set(t,r),r}function bi(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function Ei(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n,s;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose],r&&(s=n)}if(typeof n!="function")throw new TypeError("Object not disposable.");s&&(n=function(){try{s.call(this)}catch(i){return Promise.reject(i)}}),t.stack.push({value:e,dispose:n,async:r})}else r&&t.stack.push({async:!0});return e}function Si(t){function e(i){t.error=t.hasError?new gu(i,t.error,"An error was suppressed during disposal."):i,t.hasError=!0}var r,n=0;function s(){for(;r=t.stack.pop();)try{if(!r.async&&n===1)return n=0,t.stack.push(r),Promise.resolve().then(s);if(r.dispose){var i=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(i).then(s,function(o){return e(o),s()})}else n|=1}catch(o){e(o)}if(n===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return s()}function Ti(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,n,s,i,o){return n?e?".jsx":".js":s&&(!i||!o)?r:s+i+"."+o.toLowerCase()+"js"}):t}var Mr,Ft,qt,_u,Wr,gu,yu,ge=fu(()=>{Mr=function(t,e){return Mr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])},Mr(t,e)};Ft=function(){return Ft=Object.assign||function(e){for(var r,n=1,s=arguments.length;n<s;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},Ft.apply(this,arguments)};qt=Object.create?(function(t,e,r,n){n===void 0&&(n=r);var s=Object.getOwnPropertyDescriptor(e,r);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,s)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]});_u=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},Wr=function(t){return Wr=Object.getOwnPropertyNames||function(e){var r=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[r.length]=n);return r},Wr(t)};gu=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};yu={__extends:Qs,__assign:Ft,__rest:Zs,__decorate:ei,__param:ti,__esDecorate:ri,__runInitializers:ni,__propKey:si,__setFunctionName:ii,__metadata:oi,__awaiter:ai,__generator:ui,__createBinding:qt,__exportStar:li,__values:Bt,__read:Vr,__spread:ci,__spreadArrays:hi,__spreadArray:di,__await:Ge,__asyncGenerator:fi,__asyncDelegator:pi,__asyncValues:mi,__makeTemplateObject:_i,__importStar:gi,__importDefault:yi,__classPrivateFieldGet:vi,__classPrivateFieldSet:wi,__classPrivateFieldIn:bi,__addDisposableResource:Ei,__disposeResources:Si,__rewriteRelativeImportExtension:Ti}});var Ai=$(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.resolveFetch=void 0;var vu=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);Mt.resolveFetch=vu});var Gr=$(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.FunctionRegion=ye.FunctionsHttpError=ye.FunctionsRelayError=ye.FunctionsFetchError=ye.FunctionsError=void 0;var Je=class extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}};ye.FunctionsError=Je;var Hr=class extends Je{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}};ye.FunctionsFetchError=Hr;var Kr=class extends Je{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}};ye.FunctionsRelayError=Kr;var zr=class extends Je{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}};ye.FunctionsHttpError=zr;var Ri;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(Ri||(ye.FunctionRegion=Ri={}))});var ki=$(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.FunctionsClient=void 0;var wu=(ge(),Se(_e)),bu=Ai(),Ye=Gr(),Jr=class{constructor(e,{headers:r={},customFetch:n,region:s=Ye.FunctionRegion.Any}={}){this.url=e,this.headers=r,this.region=s,this.fetch=(0,bu.resolveFetch)(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return wu.__awaiter(this,arguments,void 0,function*(r,n={}){var s;let i,o;try{let{headers:a,method:l,body:c,signal:d,timeout:m}=n,_={},{region:f}=n;f||(f=this.region);let y=new URL(`${this.url}/${r}`);f&&f!=="any"&&(_["x-region"]=f,y.searchParams.set("forceFunctionRegion",f));let v;c&&(a&&!Object.prototype.hasOwnProperty.call(a,"Content-Type")||!a)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(_["Content-Type"]="application/octet-stream",v=c):typeof c=="string"?(_["Content-Type"]="text/plain",v=c):typeof FormData<"u"&&c instanceof FormData?v=c:(_["Content-Type"]="application/json",v=JSON.stringify(c)):c&&typeof c!="string"&&!(typeof Blob<"u"&&c instanceof Blob)&&!(c instanceof ArrayBuffer)&&!(typeof FormData<"u"&&c instanceof FormData)?v=JSON.stringify(c):v=c;let w=d;m&&(o=new AbortController,i=setTimeout(()=>o.abort(),m),d?(w=o.signal,d.addEventListener("abort",()=>o.abort())):w=o.signal);let T=yield this.fetch(y.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},_),this.headers),a),body:v,signal:w}).catch(Z=>{throw new Ye.FunctionsFetchError(Z)}),O=T.headers.get("x-relay-error");if(O&&O==="true")throw new Ye.FunctionsRelayError(T);if(!T.ok)throw new Ye.FunctionsHttpError(T);let E=((s=T.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),x;return E==="application/json"?x=yield T.json():E==="application/octet-stream"||E==="application/pdf"?x=yield T.blob():E==="text/event-stream"?x=T:E==="multipart/form-data"?x=yield T.formData():x=yield T.text(),{data:x,error:null,response:T}}catch(a){return{data:null,error:a,response:a instanceof Ye.FunctionsHttpError||a instanceof Ye.FunctionsRelayError?a.context:void 0}}finally{i&&clearTimeout(i)}})}};Wt.FunctionsClient=Jr});var Oi=$(fe=>{"use strict";Object.defineProperty(fe,"__esModule",{value:!0});fe.FunctionRegion=fe.FunctionsRelayError=fe.FunctionsHttpError=fe.FunctionsFetchError=fe.FunctionsError=fe.FunctionsClient=void 0;var Eu=ki();Object.defineProperty(fe,"FunctionsClient",{enumerable:!0,get:function(){return Eu.FunctionsClient}});var lt=Gr();Object.defineProperty(fe,"FunctionsError",{enumerable:!0,get:function(){return lt.FunctionsError}});Object.defineProperty(fe,"FunctionsFetchError",{enumerable:!0,get:function(){return lt.FunctionsFetchError}});Object.defineProperty(fe,"FunctionsHttpError",{enumerable:!0,get:function(){return lt.FunctionsHttpError}});Object.defineProperty(fe,"FunctionsRelayError",{enumerable:!0,get:function(){return lt.FunctionsRelayError}});Object.defineProperty(fe,"FunctionRegion",{enumerable:!0,get:function(){return lt.FunctionRegion}})});var Xr=$(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.WebSocketFactory=void 0;var Ht=class{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};let r=globalThis.process;if(r){let n=r.versions;if(n&&n.node){let s=n.node,i=parseInt(s.replace(/^v/,"").split(".")[0]);return i>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${i} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${i} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
|
|
3
|
+
import{a as Js}from"./chunk-G3HBKJ5L.js";import"./chunk-IN6XVTUS.js";import"./chunk-PFZVET7S.js";import"./chunk-6V4OEOOX.js";import"./chunk-RGMTLNMF.js";import"./chunk-LZRCXSUJ.js";import{a as Br,b as zs,d as Gs}from"./chunk-LVGGCRDW.js";import"./chunk-C2ESM27Z.js";import{b as fu,c as $,d as Ks,e as k,f as ze,g as Se}from"./chunk-PSANHDZM.js";var _e={};Ks(_e,{__addDisposableResource:()=>Ei,__assign:()=>Ft,__asyncDelegator:()=>pi,__asyncGenerator:()=>fi,__asyncValues:()=>mi,__await:()=>Ge,__awaiter:()=>ai,__classPrivateFieldGet:()=>vi,__classPrivateFieldIn:()=>bi,__classPrivateFieldSet:()=>wi,__createBinding:()=>qt,__decorate:()=>ei,__disposeResources:()=>Si,__esDecorate:()=>ri,__exportStar:()=>li,__extends:()=>Qs,__generator:()=>ui,__importDefault:()=>yi,__importStar:()=>gi,__makeTemplateObject:()=>_i,__metadata:()=>oi,__param:()=>ti,__propKey:()=>si,__read:()=>Vr,__rest:()=>Zs,__rewriteRelativeImportExtension:()=>Ti,__runInitializers:()=>ni,__setFunctionName:()=>ii,__spread:()=>ci,__spreadArray:()=>di,__spreadArrays:()=>hi,__values:()=>Bt,default:()=>yu});function Qs(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Mr(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Zs(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(r[n[s]]=t[n[s]]);return r}function ei(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(i=(s<3?o(i):s>3?o(e,r,i):o(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i}function ti(t,e){return function(r,n){e(r,n,t)}}function ri(t,e,r,n,s,i){function o(T){if(T!==void 0&&typeof T!="function")throw new TypeError("Function expected");return T}for(var a=n.kind,l=a==="getter"?"get":a==="setter"?"set":"value",c=!e&&t?n.static?t:t.prototype:null,d=e||(c?Object.getOwnPropertyDescriptor(c,n.name):{}),m,_=!1,f=r.length-1;f>=0;f--){var y={};for(var v in n)y[v]=v==="access"?{}:n[v];for(var v in n.access)y.access[v]=n.access[v];y.addInitializer=function(T){if(_)throw new TypeError("Cannot add initializers after decoration has completed");i.push(o(T||null))};var w=(0,r[f])(a==="accessor"?{get:d.get,set:d.set}:d[l],y);if(a==="accessor"){if(w===void 0)continue;if(w===null||typeof w!="object")throw new TypeError("Object expected");(m=o(w.get))&&(d.get=m),(m=o(w.set))&&(d.set=m),(m=o(w.init))&&s.unshift(m)}else(m=o(w))&&(a==="field"?s.unshift(m):d[l]=m)}c&&Object.defineProperty(c,n.name,d),_=!0}function ni(t,e,r){for(var n=arguments.length>2,s=0;s<e.length;s++)r=n?e[s].call(t,r):e[s].call(t);return n?r:void 0}function si(t){return typeof t=="symbol"?t:"".concat(t)}function ii(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function oi(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function ai(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(d){try{c(n.next(d))}catch(m){o(m)}}function l(d){try{c(n.throw(d))}catch(m){o(m)}}function c(d){d.done?i(d.value):s(d.value).then(a,l)}c((n=n.apply(t,e||[])).next())})}function ui(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,s,i,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(d){return l([c,d])}}function l(c){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(r=0)),r;)try{if(n=1,s&&(i=c[0]&2?s.return:c[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,c[1])).done)return i;switch(s=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,s=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=e.call(t,r)}catch(d){c=[6,d],s=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function li(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&qt(e,t,r)}function Bt(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Vr(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),s,i=[],o;try{for(;(e===void 0||e-- >0)&&!(s=n.next()).done;)i.push(s.value)}catch(a){o={error:a}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return i}function ci(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Vr(arguments[e]));return t}function hi(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),s=0,e=0;e<r;e++)for(var i=arguments[e],o=0,a=i.length;o<a;o++,s++)n[s]=i[o];return n}function di(t,e,r){if(r||arguments.length===2)for(var n=0,s=e.length,i;n<s;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function Ge(t){return this instanceof Ge?(this.v=t,this):new Ge(t)}function fi(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),s,i=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),s[Symbol.asyncIterator]=function(){return this},s;function o(f){return function(y){return Promise.resolve(y).then(f,m)}}function a(f,y){n[f]&&(s[f]=function(v){return new Promise(function(w,T){i.push([f,v,w,T])>1||l(f,v)})},y&&(s[f]=y(s[f])))}function l(f,y){try{c(n[f](y))}catch(v){_(i[0][3],v)}}function c(f){f.value instanceof Ge?Promise.resolve(f.value.v).then(d,m):_(i[0][2],f)}function d(f){l("next",f)}function m(f){l("throw",f)}function _(f,y){f(y),i.shift(),i.length&&l(i[0][0],i[0][1])}}function pi(t){var e,r;return e={},n("next"),n("throw",function(s){throw s}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(s,i){e[s]=t[s]?function(o){return(r=!r)?{value:Ge(t[s](o)),done:!1}:i?i(o):o}:i}}function mi(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Bt=="function"?Bt(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(o){return new Promise(function(a,l){o=t[i](o),s(a,l,o.done,o.value)})}}function s(i,o,a,l){Promise.resolve(l).then(function(c){i({value:c,done:a})},o)}}function _i(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function gi(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=Wr(t),n=0;n<r.length;n++)r[n]!=="default"&&qt(e,t,r[n]);return _u(e,t),e}function yi(t){return t&&t.__esModule?t:{default:t}}function vi(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function wi(t,e,r,n,s){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(t,r):s?s.value=r:e.set(t,r),r}function bi(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function Ei(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n,s;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose],r&&(s=n)}if(typeof n!="function")throw new TypeError("Object not disposable.");s&&(n=function(){try{s.call(this)}catch(i){return Promise.reject(i)}}),t.stack.push({value:e,dispose:n,async:r})}else r&&t.stack.push({async:!0});return e}function Si(t){function e(i){t.error=t.hasError?new gu(i,t.error,"An error was suppressed during disposal."):i,t.hasError=!0}var r,n=0;function s(){for(;r=t.stack.pop();)try{if(!r.async&&n===1)return n=0,t.stack.push(r),Promise.resolve().then(s);if(r.dispose){var i=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(i).then(s,function(o){return e(o),s()})}else n|=1}catch(o){e(o)}if(n===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return s()}function Ti(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,n,s,i,o){return n?e?".jsx":".js":s&&(!i||!o)?r:s+i+"."+o.toLowerCase()+"js"}):t}var Mr,Ft,qt,_u,Wr,gu,yu,ge=fu(()=>{Mr=function(t,e){return Mr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])},Mr(t,e)};Ft=function(){return Ft=Object.assign||function(e){for(var r,n=1,s=arguments.length;n<s;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},Ft.apply(this,arguments)};qt=Object.create?(function(t,e,r,n){n===void 0&&(n=r);var s=Object.getOwnPropertyDescriptor(e,r);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,s)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]});_u=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},Wr=function(t){return Wr=Object.getOwnPropertyNames||function(e){var r=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[r.length]=n);return r},Wr(t)};gu=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};yu={__extends:Qs,__assign:Ft,__rest:Zs,__decorate:ei,__param:ti,__esDecorate:ri,__runInitializers:ni,__propKey:si,__setFunctionName:ii,__metadata:oi,__awaiter:ai,__generator:ui,__createBinding:qt,__exportStar:li,__values:Bt,__read:Vr,__spread:ci,__spreadArrays:hi,__spreadArray:di,__await:Ge,__asyncGenerator:fi,__asyncDelegator:pi,__asyncValues:mi,__makeTemplateObject:_i,__importStar:gi,__importDefault:yi,__classPrivateFieldGet:vi,__classPrivateFieldSet:wi,__classPrivateFieldIn:bi,__addDisposableResource:Ei,__disposeResources:Si,__rewriteRelativeImportExtension:Ti}});var Ai=$(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.resolveFetch=void 0;var vu=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);Mt.resolveFetch=vu});var Gr=$(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.FunctionRegion=ye.FunctionsHttpError=ye.FunctionsRelayError=ye.FunctionsFetchError=ye.FunctionsError=void 0;var Je=class extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}};ye.FunctionsError=Je;var Hr=class extends Je{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}};ye.FunctionsFetchError=Hr;var Kr=class extends Je{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}};ye.FunctionsRelayError=Kr;var zr=class extends Je{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}};ye.FunctionsHttpError=zr;var Ri;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(Ri||(ye.FunctionRegion=Ri={}))});var ki=$(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.FunctionsClient=void 0;var wu=(ge(),Se(_e)),bu=Ai(),Ye=Gr(),Jr=class{constructor(e,{headers:r={},customFetch:n,region:s=Ye.FunctionRegion.Any}={}){this.url=e,this.headers=r,this.region=s,this.fetch=(0,bu.resolveFetch)(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return wu.__awaiter(this,arguments,void 0,function*(r,n={}){var s;let i,o;try{let{headers:a,method:l,body:c,signal:d,timeout:m}=n,_={},{region:f}=n;f||(f=this.region);let y=new URL(`${this.url}/${r}`);f&&f!=="any"&&(_["x-region"]=f,y.searchParams.set("forceFunctionRegion",f));let v;c&&(a&&!Object.prototype.hasOwnProperty.call(a,"Content-Type")||!a)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(_["Content-Type"]="application/octet-stream",v=c):typeof c=="string"?(_["Content-Type"]="text/plain",v=c):typeof FormData<"u"&&c instanceof FormData?v=c:(_["Content-Type"]="application/json",v=JSON.stringify(c)):c&&typeof c!="string"&&!(typeof Blob<"u"&&c instanceof Blob)&&!(c instanceof ArrayBuffer)&&!(typeof FormData<"u"&&c instanceof FormData)?v=JSON.stringify(c):v=c;let w=d;m&&(o=new AbortController,i=setTimeout(()=>o.abort(),m),d?(w=o.signal,d.addEventListener("abort",()=>o.abort())):w=o.signal);let T=yield this.fetch(y.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},_),this.headers),a),body:v,signal:w}).catch(Z=>{throw new Ye.FunctionsFetchError(Z)}),O=T.headers.get("x-relay-error");if(O&&O==="true")throw new Ye.FunctionsRelayError(T);if(!T.ok)throw new Ye.FunctionsHttpError(T);let E=((s=T.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),x;return E==="application/json"?x=yield T.json():E==="application/octet-stream"||E==="application/pdf"?x=yield T.blob():E==="text/event-stream"?x=T:E==="multipart/form-data"?x=yield T.formData():x=yield T.text(),{data:x,error:null,response:T}}catch(a){return{data:null,error:a,response:a instanceof Ye.FunctionsHttpError||a instanceof Ye.FunctionsRelayError?a.context:void 0}}finally{i&&clearTimeout(i)}})}};Wt.FunctionsClient=Jr});var Oi=$(fe=>{"use strict";Object.defineProperty(fe,"__esModule",{value:!0});fe.FunctionRegion=fe.FunctionsRelayError=fe.FunctionsHttpError=fe.FunctionsFetchError=fe.FunctionsError=fe.FunctionsClient=void 0;var Eu=ki();Object.defineProperty(fe,"FunctionsClient",{enumerable:!0,get:function(){return Eu.FunctionsClient}});var lt=Gr();Object.defineProperty(fe,"FunctionsError",{enumerable:!0,get:function(){return lt.FunctionsError}});Object.defineProperty(fe,"FunctionsFetchError",{enumerable:!0,get:function(){return lt.FunctionsFetchError}});Object.defineProperty(fe,"FunctionsHttpError",{enumerable:!0,get:function(){return lt.FunctionsHttpError}});Object.defineProperty(fe,"FunctionsRelayError",{enumerable:!0,get:function(){return lt.FunctionsRelayError}});Object.defineProperty(fe,"FunctionRegion",{enumerable:!0,get:function(){return lt.FunctionRegion}})});var Xr=$(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.WebSocketFactory=void 0;var Ht=class{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};let r=globalThis.process;if(r){let n=r.versions;if(n&&n.node){let s=n.node,i=parseInt(s.replace(/^v/,"").split(".")[0]);return i>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${i} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${i} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
|
|
4
4
|
import ws from "ws"
|
|
5
5
|
new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){let e=this.detectEnvironment();if(e.constructor)return e.constructor;let r=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(r+=`
|
|
6
6
|
|
|
@@ -65,4 +65,4 @@ Check the top-level render call using <`+p+">.")}return h}function Us(u,h){if(!(
|
|
|
65
65
|
|
|
66
66
|
Caused by: ${(y=d?.name)!==null&&y!==void 0?y:"Error"}: ${T}`,O&&(a+=` (${O})`),d?.stack&&(a+=`
|
|
67
67
|
${d.stack}`)}else{var v;a=(v=i?.stack)!==null&&v!==void 0?v:""}let w=this.url.toString().length;return i?.name==="AbortError"||i?.code==="ABORT_ERR"?(c="",l="Request was aborted (timeout or manual cancellation)",w>this.urlLengthLimit&&(l+=`. Note: Your request URL is ${w} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):(d?.name==="HeadersOverflowError"||d?.code==="UND_ERR_HEADERS_OVERFLOW")&&(c="",l="HTTP headers exceeded server limits (typically 16KB)",w>this.urlLengthLimit&&(l+=`. Your request URL is ${w} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{error:{message:`${(o=i?.name)!==null&&o!==void 0?o:"FetchError"}: ${i?.message}`,details:a,hint:l,code:c},data:null,count:null,status:0,statusText:""}})),s.then(t,e)}returns(){return this}overrideTypes(){return this}},Tu=class extends Su{select(t){let e=!1,r=(t??"*").split("").map(n=>/\s/.test(n)&&!e?"":(n==='"'&&(e=!e),n)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:e=!0,nullsFirst:r,foreignTable:n,referencedTable:s=n}={}){let i=s?`${s}.order`:"order",o=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${o?`${o},`:""}${t}.${e?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:e,referencedTable:r=e}={}){let n=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(n,`${t}`),this}range(t,e,{foreignTable:r,referencedTable:n=r}={}){let s=typeof n>"u"?"offset":`${n}.offset`,i=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(s,`${t}`),this.url.searchParams.set(i,`${e-t+1}`),this}abortSignal(t){return this.signal=t,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:t=!1,verbose:e=!1,settings:r=!1,buffers:n=!1,wal:s=!1,format:i="text"}={}){var o;let a=[t?"analyze":null,e?"verbose":null,r?"settings":null,n?"buffers":null,s?"wal":null].filter(Boolean).join("|"),l=(o=this.headers.get("Accept"))!==null&&o!==void 0?o:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${l}"; options=${a};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(t){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${t}`),this}},Ci=new RegExp("[,()]"),Xe=class extends Tu{eq(t,e){return this.url.searchParams.append(t,`eq.${e}`),this}neq(t,e){return this.url.searchParams.append(t,`neq.${e}`),this}gt(t,e){return this.url.searchParams.append(t,`gt.${e}`),this}gte(t,e){return this.url.searchParams.append(t,`gte.${e}`),this}lt(t,e){return this.url.searchParams.append(t,`lt.${e}`),this}lte(t,e){return this.url.searchParams.append(t,`lte.${e}`),this}like(t,e){return this.url.searchParams.append(t,`like.${e}`),this}likeAllOf(t,e){return this.url.searchParams.append(t,`like(all).{${e.join(",")}}`),this}likeAnyOf(t,e){return this.url.searchParams.append(t,`like(any).{${e.join(",")}}`),this}ilike(t,e){return this.url.searchParams.append(t,`ilike.${e}`),this}ilikeAllOf(t,e){return this.url.searchParams.append(t,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(t,e){return this.url.searchParams.append(t,`ilike(any).{${e.join(",")}}`),this}regexMatch(t,e){return this.url.searchParams.append(t,`match.${e}`),this}regexIMatch(t,e){return this.url.searchParams.append(t,`imatch.${e}`),this}is(t,e){return this.url.searchParams.append(t,`is.${e}`),this}isDistinct(t,e){return this.url.searchParams.append(t,`isdistinct.${e}`),this}in(t,e){let r=Array.from(new Set(e)).map(n=>typeof n=="string"&&Ci.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(t,`in.(${r})`),this}notIn(t,e){let r=Array.from(new Set(e)).map(n=>typeof n=="string"&&Ci.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(t,`not.in.(${r})`),this}contains(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cs.{${e.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(e)}`),this}containedBy(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cd.{${e.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(e)}`),this}rangeGt(t,e){return this.url.searchParams.append(t,`sr.${e}`),this}rangeGte(t,e){return this.url.searchParams.append(t,`nxl.${e}`),this}rangeLt(t,e){return this.url.searchParams.append(t,`sl.${e}`),this}rangeLte(t,e){return this.url.searchParams.append(t,`nxr.${e}`),this}rangeAdjacent(t,e){return this.url.searchParams.append(t,`adj.${e}`),this}overlaps(t,e){return typeof e=="string"?this.url.searchParams.append(t,`ov.${e}`):this.url.searchParams.append(t,`ov.{${e.join(",")}}`),this}textSearch(t,e,{config:r,type:n}={}){let s="";n==="plain"?s="pl":n==="phrase"?s="ph":n==="websearch"&&(s="w");let i=r===void 0?"":`(${r})`;return this.url.searchParams.append(t,`${s}fts${i}.${e}`),this}match(t){return Object.entries(t).forEach(([e,r])=>{this.url.searchParams.append(e,`eq.${r}`)}),this}not(t,e,r){return this.url.searchParams.append(t,`not.${e}.${r}`),this}or(t,{foreignTable:e,referencedTable:r=e}={}){let n=r?`${r}.or`:"or";return this.url.searchParams.append(n,`(${t})`),this}filter(t,e,r){return this.url.searchParams.append(t,`${e}.${r}`),this}},Au=class{constructor(t,{headers:e={},schema:r,fetch:n,urlLengthLimit:s=8e3}){this.url=t,this.headers=new Headers(e),this.schema=r,this.fetch=n,this.urlLengthLimit=s}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(t,e){let{head:r=!1,count:n}=e??{},s=r?"HEAD":"GET",i=!1,o=(t??"*").split("").map(c=>/\s/.test(c)&&!i?"":(c==='"'&&(i=!i),c)).join(""),{url:a,headers:l}=this.cloneRequestState();return a.searchParams.set("select",o),n&&l.append("Prefer",`count=${n}`),new Xe({method:s,url:a,headers:l,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}insert(t,{count:e,defaultToNull:r=!0}={}){var n;let s="POST",{url:i,headers:o}=this.cloneRequestState();if(e&&o.append("Prefer",`count=${e}`),r||o.append("Prefer","missing=default"),Array.isArray(t)){let a=t.reduce((l,c)=>l.concat(Object.keys(c)),[]);if(a.length>0){let l=[...new Set(a)].map(c=>`"${c}"`);i.searchParams.set("columns",l.join(","))}}return new Xe({method:s,url:i,headers:o,schema:this.schema,body:t,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch,urlLengthLimit:this.urlLengthLimit})}upsert(t,{onConflict:e,ignoreDuplicates:r=!1,count:n,defaultToNull:s=!0}={}){var i;let o="POST",{url:a,headers:l}=this.cloneRequestState();if(l.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),e!==void 0&&a.searchParams.set("on_conflict",e),n&&l.append("Prefer",`count=${n}`),s||l.append("Prefer","missing=default"),Array.isArray(t)){let c=t.reduce((d,m)=>d.concat(Object.keys(m)),[]);if(c.length>0){let d=[...new Set(c)].map(m=>`"${m}"`);a.searchParams.set("columns",d.join(","))}}return new Xe({method:o,url:a,headers:l,schema:this.schema,body:t,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch,urlLengthLimit:this.urlLengthLimit})}update(t,{count:e}={}){var r;let n="PATCH",{url:s,headers:i}=this.cloneRequestState();return e&&i.append("Prefer",`count=${e}`),new Xe({method:n,url:s,headers:i,schema:this.schema,body:t,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit})}delete({count:t}={}){var e;let r="DELETE",{url:n,headers:s}=this.cloneRequestState();return t&&s.append("Prefer",`count=${t}`),new Xe({method:r,url:n,headers:s,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch,urlLengthLimit:this.urlLengthLimit})}};function ct(t){"@babel/helpers - typeof";return ct=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ct(t)}function Ru(t,e){if(ct(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ct(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ku(t){var e=Ru(t,"string");return ct(e)=="symbol"?e:e+""}function Ou(t,e,r){return(e=ku(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Pi(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Vt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Pi(Object(r),!0).forEach(function(n){Ou(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Pi(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var Ii=class xi{constructor(e,{headers:r={},schema:n,fetch:s,timeout:i,urlLengthLimit:o=8e3}={}){this.url=e,this.headers=new Headers(r),this.schemaName=n,this.urlLengthLimit=o;let a=s??globalThis.fetch;i!==void 0&&i>0?this.fetch=(l,c)=>{let d=new AbortController,m=setTimeout(()=>d.abort(),i),_=c?.signal;if(_){if(_.aborted)return clearTimeout(m),a(l,c);let f=()=>{clearTimeout(m),d.abort()};return _.addEventListener("abort",f,{once:!0}),a(l,Vt(Vt({},c),{},{signal:d.signal})).finally(()=>{clearTimeout(m),_.removeEventListener("abort",f)})}return a(l,Vt(Vt({},c),{},{signal:d.signal})).finally(()=>clearTimeout(m))}:this.fetch=a}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new Au(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}schema(e){return new xi(this.url,{headers:this.headers,schema:e,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}rpc(e,r={},{head:n=!1,get:s=!1,count:i}={}){var o;let a,l=new URL(`${this.url}/rpc/${e}`),c,d=f=>f!==null&&typeof f=="object"&&(!Array.isArray(f)||f.some(d)),m=n&&Object.values(r).some(d);m?(a="POST",c=r):n||s?(a=n?"HEAD":"GET",Object.entries(r).filter(([f,y])=>y!==void 0).map(([f,y])=>[f,Array.isArray(y)?`{${y.join(",")}}`:`${y}`]).forEach(([f,y])=>{l.searchParams.append(f,y)})):(a="POST",c=r);let _=new Headers(this.headers);return m?_.set("Prefer",i?`count=${i},return=minimal`:"return=minimal"):i&&_.set("Prefer",`count=${i}`),new Xe({method:a,url:l,headers:_,schema:this.schemaName,body:c,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch,urlLengthLimit:this.urlLengthLimit})}};var Po=ze(mn(),1);var mt=class extends Error{constructor(t,e){super(t),this.name="IcebergError",this.status=e.status,this.icebergType=e.icebergType,this.icebergCode=e.icebergCode,this.details=e.details,this.isCommitStateUnknown=e.icebergType==="CommitStateUnknownException"||[500,502,504].includes(e.status)&&e.icebergType?.includes("CommitState")===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function Qu(t,e,r){let n=new URL(e,t);if(r)for(let[s,i]of Object.entries(r))i!==void 0&&n.searchParams.set(s,i);return n.toString()}async function Zu(t){return!t||t.type==="none"?{}:t.type==="bearer"?{Authorization:`Bearer ${t.token}`}:t.type==="header"?{[t.name]:t.value}:t.type==="custom"?await t.getHeaders():{}}function el(t){let e=t.fetchImpl??globalThis.fetch;return{async request({method:r,path:n,query:s,body:i,headers:o}){let a=Qu(t.baseUrl,n,s),l=await Zu(t.auth),c=await e(a,{method:r,headers:{...i?{"Content-Type":"application/json"}:{},...l,...o},body:i?JSON.stringify(i):void 0}),d=await c.text(),m=(c.headers.get("content-type")||"").includes("application/json"),_=m&&d?JSON.parse(d):d;if(!c.ok){let f=m?_:void 0,y=f?.error;throw new mt(y?.message??`Request failed with status ${c.status}`,{status:c.status,icebergType:y?.type,icebergCode:y?.code,details:f})}return{status:c.status,headers:c.headers,data:_}}}}function Zt(t){return t.join("")}var tl=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){let e=t?{parent:Zt(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(n=>({namespace:n}))}async createNamespace(t,e){let r={namespace:t.namespace,properties:e?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Zt(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Zt(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Zt(t.namespace)}`}),!0}catch(e){if(e instanceof mt&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(r){if(r instanceof mt&&r.status===409)return;throw r}}};function Qe(t){return t.join("")}var rl=class{constructor(t,e="",r){this.client=t,this.prefix=e,this.accessDelegation=r}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Qe(t.namespace)}/tables`})).data.identifiers}async createTable(t,e){let r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Qe(t.namespace)}/tables`,body:e,headers:r})).data.metadata}async updateTable(t,e){let r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Qe(t.namespace)}/tables/${t.name}`,body:e});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(t,e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Qe(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String(e?.purge??!1)}})}async loadTable(t){let e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Qe(t.namespace)}/tables/${t.name}`,headers:e})).data.metadata}async tableExists(t){let e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Qe(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(r){if(r instanceof mt&&r.status===404)return!1;throw r}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(r){if(r instanceof mt&&r.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw r}}},zi=class{constructor(t){let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);let r=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=el({baseUrl:r,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=t.accessDelegation?.join(","),this.namespaceOps=new tl(this.client,e),this.tableOps=new rl(this.client,e,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,e){return this.namespaceOps.createNamespace(t,e)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}async createTable(t,e){return this.tableOps.createTable(t,e)}async updateTable(t,e){return this.tableOps.updateTable(t,e)}async dropTable(t,e){await this.tableOps.dropTable(t,e)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,e){return this.namespaceOps.createNamespaceIfNotExists(t,e)}async createTableIfNotExists(t,e){return this.tableOps.createTableIfNotExists(t,e)}};var tr=class extends Error{constructor(t,e="storage",r,n){super(t),this.__isStorageError=!0,this.namespace=e,this.name=e==="vectors"?"StorageVectorsError":"StorageError",this.status=r,this.statusCode=n}};function rr(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var er=class extends tr{constructor(t,e,r,n="storage"){super(t,n,e,r),this.name=n==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=e,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},Xi=class extends tr{constructor(t,e,r="storage"){super(t,r),this.name=r==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=e}};var nl=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),sl=t=>{if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},_n=t=>{if(Array.isArray(t))return t.map(r=>_n(r));if(typeof t=="function"||t!==Object(t))return t;let e={};return Object.entries(t).forEach(([r,n])=>{let s=r.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));e[s]=_n(n)}),e},il=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t);function gt(t){"@babel/helpers - typeof";return gt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gt(t)}function ol(t,e){if(gt(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(gt(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function al(t){var e=ol(t,"string");return gt(e)=="symbol"?e:e+""}function ul(t,e,r){return(e=al(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Gi(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function P(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Gi(Object(r),!0).forEach(function(n){ul(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Gi(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var Ji=t=>{var e;return t.msg||t.message||t.error_description||(typeof t.error=="string"?t.error:(e=t.error)===null||e===void 0?void 0:e.message)||JSON.stringify(t)},ll=async(t,e,r,n)=>{if(t&&typeof t=="object"&&"status"in t&&"ok"in t&&typeof t.status=="number"&&!r?.noResolveJson){let s=t,i=s.status||500;if(typeof s.json=="function")s.json().then(o=>{let a=o?.statusCode||o?.code||i+"";e(new er(Ji(o),i,a,n))}).catch(()=>{if(n==="vectors"){let o=i+"";e(new er(s.statusText||`HTTP ${i} error`,i,o,n))}else{let o=i+"";e(new er(s.statusText||`HTTP ${i} error`,i,o,n))}});else{let o=i+"";e(new er(s.statusText||`HTTP ${i} error`,i,o,n))}}else e(new Xi(Ji(t),t,n))},cl=(t,e,r,n)=>{let s={method:t,headers:e?.headers||{}};return t==="GET"||t==="HEAD"||!n?P(P({},s),r):(sl(n)?(s.headers=P({"Content-Type":"application/json"},e?.headers),s.body=JSON.stringify(n)):s.body=n,e?.duplex&&(s.duplex=e.duplex),P(P({},s),r))};async function _t(t,e,r,n,s,i,o){return new Promise((a,l)=>{t(r,cl(e,n,s,i)).then(c=>{if(!c.ok)throw c;if(n?.noResolveJson)return c;if(o==="vectors"){let d=c.headers.get("content-type");if(c.headers.get("content-length")==="0"||c.status===204)return{};if(!d||!d.includes("application/json"))return{}}return c.json()}).then(c=>a(c)).catch(c=>ll(c,l,n,o))})}function Qi(t="storage"){return{get:async(e,r,n,s)=>_t(e,"GET",r,n,s,void 0,t),post:async(e,r,n,s,i)=>_t(e,"POST",r,s,i,n,t),put:async(e,r,n,s,i)=>_t(e,"PUT",r,s,i,n,t),head:async(e,r,n,s)=>_t(e,"HEAD",r,P(P({},n),{},{noResolveJson:!0}),s,void 0,t),remove:async(e,r,n,s,i)=>_t(e,"DELETE",r,s,i,n,t)}}var hl=Qi("storage"),{get:yt,post:Ae,put:gn,head:dl,remove:yn}=hl,me=Qi("vectors"),Ze=class{constructor(t,e={},r,n="storage"){this.shouldThrowOnError=!1,this.url=t,this.headers=e,this.fetch=nl(r),this.namespace=n}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=P(P({},this.headers),{},{[t]:e}),this}async handleOperation(t){var e=this;try{return{data:await t(),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(rr(r))return{data:null,error:r};throw r}}},fl=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e}then(t,e){return this.execute().then(t,e)}async execute(){var t=this;try{return{data:(await t.downloadFn()).body,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(rr(e))return{data:null,error:e};throw e}}},Zi;Zi=Symbol.toStringTag;var pl=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[Zi]="BlobDownloadBuilder",this.promise=null}asStream(){return new fl(this.downloadFn,this.shouldThrowOnError)}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:await(await t.downloadFn()).blob(),error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(rr(e))return{data:null,error:e};throw e}}},ml={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Yi={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1},_l=class extends Ze{constructor(t,e={},r,n){super(t,e,n,"storage"),this.bucketId=r}async uploadOrUpdate(t,e,r,n){var s=this;return s.handleOperation(async()=>{let i,o=P(P({},Yi),n),a=P(P({},s.headers),t==="POST"&&{"x-upsert":String(o.upsert)}),l=o.metadata;typeof Blob<"u"&&r instanceof Blob?(i=new FormData,i.append("cacheControl",o.cacheControl),l&&i.append("metadata",s.encodeMetadata(l)),i.append("",r)):typeof FormData<"u"&&r instanceof FormData?(i=r,i.has("cacheControl")||i.append("cacheControl",o.cacheControl),l&&!i.has("metadata")&&i.append("metadata",s.encodeMetadata(l))):(i=r,a["cache-control"]=`max-age=${o.cacheControl}`,a["content-type"]=o.contentType,l&&(a["x-metadata"]=s.toBase64(s.encodeMetadata(l))),(typeof ReadableStream<"u"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!o.duplex&&(o.duplex="half")),n?.headers&&(a=P(P({},a),n.headers));let c=s._removeEmptyFolders(e),d=s._getFinalPath(c),m=await(t=="PUT"?gn:Ae)(s.fetch,`${s.url}/object/${d}`,i,P({headers:a},o?.duplex?{duplex:o.duplex}:{}));return{path:c,id:m.Id,fullPath:m.Key}})}async upload(t,e,r){return this.uploadOrUpdate("POST",t,e,r)}async uploadToSignedUrl(t,e,r,n){var s=this;let i=s._removeEmptyFolders(t),o=s._getFinalPath(i),a=new URL(s.url+`/object/upload/sign/${o}`);return a.searchParams.set("token",e),s.handleOperation(async()=>{let l,c=P({upsert:Yi.upsert},n),d=P(P({},s.headers),{"x-upsert":String(c.upsert)});return typeof Blob<"u"&&r instanceof Blob?(l=new FormData,l.append("cacheControl",c.cacheControl),l.append("",r)):typeof FormData<"u"&&r instanceof FormData?(l=r,l.append("cacheControl",c.cacheControl)):(l=r,d["cache-control"]=`max-age=${c.cacheControl}`,d["content-type"]=c.contentType),{path:i,fullPath:(await gn(s.fetch,a.toString(),l,{headers:d})).Key}})}async createSignedUploadUrl(t,e){var r=this;return r.handleOperation(async()=>{let n=r._getFinalPath(t),s=P({},r.headers);e?.upsert&&(s["x-upsert"]="true");let i=await Ae(r.fetch,`${r.url}/object/upload/sign/${n}`,{},{headers:s}),o=new URL(r.url+i.url),a=o.searchParams.get("token");if(!a)throw new tr("No token returned by API");return{signedUrl:o.toString(),path:t,token:a}})}async update(t,e,r){return this.uploadOrUpdate("PUT",t,e,r)}async move(t,e,r){var n=this;return n.handleOperation(async()=>await Ae(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:t,destinationKey:e,destinationBucket:r?.destinationBucket},{headers:n.headers}))}async copy(t,e,r){var n=this;return n.handleOperation(async()=>({path:(await Ae(n.fetch,`${n.url}/object/copy`,{bucketId:n.bucketId,sourceKey:t,destinationKey:e,destinationBucket:r?.destinationBucket},{headers:n.headers})).Key}))}async createSignedUrl(t,e,r){var n=this;return n.handleOperation(async()=>{let s=n._getFinalPath(t),i=await Ae(n.fetch,`${n.url}/object/sign/${s}`,P({expiresIn:e},r?.transform?{transform:r.transform}:{}),{headers:n.headers}),o=r?.download?`&download=${r.download===!0?"":r.download}`:"";return{signedUrl:encodeURI(`${n.url}${i.signedURL}${o}`)}})}async createSignedUrls(t,e,r){var n=this;return n.handleOperation(async()=>{let s=await Ae(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:e,paths:t},{headers:n.headers}),i=r?.download?`&download=${r.download===!0?"":r.download}`:"";return s.map(o=>P(P({},o),{},{signedUrl:o.signedURL?encodeURI(`${n.url}${o.signedURL}${i}`):null}))})}download(t,e,r){let n=typeof e?.transform<"u"?"render/image/authenticated":"object",s=this.transformOptsToQueryString(e?.transform||{}),i=s?`?${s}`:"",o=this._getFinalPath(t),a=()=>yt(this.fetch,`${this.url}/${n}/${o}${i}`,{headers:this.headers,noResolveJson:!0},r);return new pl(a,this.shouldThrowOnError)}async info(t){var e=this;let r=e._getFinalPath(t);return e.handleOperation(async()=>_n(await yt(e.fetch,`${e.url}/object/info/${r}`,{headers:e.headers})))}async exists(t){var e=this;let r=e._getFinalPath(t);try{return await dl(e.fetch,`${e.url}/object/${r}`,{headers:e.headers}),{data:!0,error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(rr(n)&&n instanceof Xi){let s=n.originalError;if([400,404].includes(s?.status))return{data:!1,error:n}}throw n}}getPublicUrl(t,e){let r=this._getFinalPath(t),n=[],s=e?.download?`download=${e.download===!0?"":e.download}`:"";s!==""&&n.push(s);let i=typeof e?.transform<"u"?"render/image":"object",o=this.transformOptsToQueryString(e?.transform||{});o!==""&&n.push(o);let a=n.join("&");return a!==""&&(a=`?${a}`),{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${r}${a}`)}}}async remove(t){var e=this;return e.handleOperation(async()=>await yn(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:t},{headers:e.headers}))}async list(t,e,r){var n=this;return n.handleOperation(async()=>{let s=P(P(P({},ml),e),{},{prefix:t||""});return await Ae(n.fetch,`${n.url}/object/list/${n.bucketId}`,s,{headers:n.headers},r)})}async listV2(t,e){var r=this;return r.handleOperation(async()=>{let n=P({},t);return await Ae(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,n,{headers:r.headers},e)})}encodeMetadata(t){return JSON.stringify(t)}toBase64(t){return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(t)}_getFinalPath(t){return`${this.bucketId}/${t.replace(/^\/+/,"")}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(t){let e=[];return t.width&&e.push(`width=${t.width}`),t.height&&e.push(`height=${t.height}`),t.resize&&e.push(`resize=${t.resize}`),t.format&&e.push(`format=${t.format}`),t.quality&&e.push(`quality=${t.quality}`),e.join("&")}},gl="2.97.0",vt={"X-Client-Info":`storage-js/${gl}`},yl=class extends Ze{constructor(t,e={},r,n){let s=new URL(t);n?.useNewHostname&&/supabase\.(co|in|red)$/.test(s.hostname)&&!s.hostname.includes("storage.supabase.")&&(s.hostname=s.hostname.replace("supabase.","storage.supabase."));let i=s.href.replace(/\/$/,""),o=P(P({},vt),e);super(i,o,r,"storage")}async listBuckets(t){var e=this;return e.handleOperation(async()=>{let r=e.listBucketOptionsToQueryString(t);return await yt(e.fetch,`${e.url}/bucket${r}`,{headers:e.headers})})}async getBucket(t){var e=this;return e.handleOperation(async()=>await yt(e.fetch,`${e.url}/bucket/${t}`,{headers:e.headers}))}async createBucket(t,e={public:!1}){var r=this;return r.handleOperation(async()=>await Ae(r.fetch,`${r.url}/bucket`,{id:t,name:t,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:r.headers}))}async updateBucket(t,e){var r=this;return r.handleOperation(async()=>await gn(r.fetch,`${r.url}/bucket/${t}`,{id:t,name:t,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:r.headers}))}async emptyBucket(t){var e=this;return e.handleOperation(async()=>await Ae(e.fetch,`${e.url}/bucket/${t}/empty`,{},{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await yn(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}listBucketOptionsToQueryString(t){let e={};return t&&("limit"in t&&(e.limit=String(t.limit)),"offset"in t&&(e.offset=String(t.offset)),t.search&&(e.search=t.search),t.sortColumn&&(e.sortColumn=t.sortColumn),t.sortOrder&&(e.sortOrder=t.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},vl=class extends Ze{constructor(t,e={},r){let n=t.replace(/\/$/,""),s=P(P({},vt),e);super(n,s,r,"storage")}async createBucket(t){var e=this;return e.handleOperation(async()=>await Ae(e.fetch,`${e.url}/bucket`,{name:t},{headers:e.headers}))}async listBuckets(t){var e=this;return e.handleOperation(async()=>{let r=new URLSearchParams;t?.limit!==void 0&&r.set("limit",t.limit.toString()),t?.offset!==void 0&&r.set("offset",t.offset.toString()),t?.sortColumn&&r.set("sortColumn",t.sortColumn),t?.sortOrder&&r.set("sortOrder",t.sortOrder),t?.search&&r.set("search",t.search);let n=r.toString(),s=n?`${e.url}/bucket?${n}`:`${e.url}/bucket`;return await yt(e.fetch,s,{headers:e.headers})})}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await yn(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}from(t){var e=this;if(!il(t))throw new tr("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");let r=new zi({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}),n=this.shouldThrowOnError;return new Proxy(r,{get(s,i){let o=s[i];return typeof o!="function"?o:async(...a)=>{try{return{data:await o.apply(s,a),error:null}}catch(l){if(n)throw l;return{data:null,error:l}}}}})}},wl=class extends Ze{constructor(t,e={},r){let n=t.replace(/\/$/,""),s=P(P({},vt),{},{"Content-Type":"application/json"},e);super(n,s,r,"vectors")}async createIndex(t){var e=this;return e.handleOperation(async()=>await me.post(e.fetch,`${e.url}/CreateIndex`,t,{headers:e.headers})||{})}async getIndex(t,e){var r=this;return r.handleOperation(async()=>await me.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers}))}async listIndexes(t){var e=this;return e.handleOperation(async()=>await me.post(e.fetch,`${e.url}/ListIndexes`,t,{headers:e.headers}))}async deleteIndex(t,e){var r=this;return r.handleOperation(async()=>await me.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers})||{})}},bl=class extends Ze{constructor(t,e={},r){let n=t.replace(/\/$/,""),s=P(P({},vt),{},{"Content-Type":"application/json"},e);super(n,s,r,"vectors")}async putVectors(t){var e=this;if(t.vectors.length<1||t.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return e.handleOperation(async()=>await me.post(e.fetch,`${e.url}/PutVectors`,t,{headers:e.headers})||{})}async getVectors(t){var e=this;return e.handleOperation(async()=>await me.post(e.fetch,`${e.url}/GetVectors`,t,{headers:e.headers}))}async listVectors(t){var e=this;if(t.segmentCount!==void 0){if(t.segmentCount<1||t.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(t.segmentIndex!==void 0&&(t.segmentIndex<0||t.segmentIndex>=t.segmentCount))throw new Error(`segmentIndex must be between 0 and ${t.segmentCount-1}`)}return e.handleOperation(async()=>await me.post(e.fetch,`${e.url}/ListVectors`,t,{headers:e.headers}))}async queryVectors(t){var e=this;return e.handleOperation(async()=>await me.post(e.fetch,`${e.url}/QueryVectors`,t,{headers:e.headers}))}async deleteVectors(t){var e=this;if(t.keys.length<1||t.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return e.handleOperation(async()=>await me.post(e.fetch,`${e.url}/DeleteVectors`,t,{headers:e.headers})||{})}},El=class extends Ze{constructor(t,e={},r){let n=t.replace(/\/$/,""),s=P(P({},vt),{},{"Content-Type":"application/json"},e);super(n,s,r,"vectors")}async createBucket(t){var e=this;return e.handleOperation(async()=>await me.post(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}async getBucket(t){var e=this;return e.handleOperation(async()=>await me.post(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:t},{headers:e.headers}))}async listBuckets(t={}){var e=this;return e.handleOperation(async()=>await me.post(e.fetch,`${e.url}/ListVectorBuckets`,t,{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await me.post(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}},Sl=class extends El{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new Tl(this.url,this.headers,t,this.fetch)}async createBucket(t){var e=()=>super.createBucket,r=this;return e().call(r,t)}async getBucket(t){var e=()=>super.getBucket,r=this;return e().call(r,t)}async listBuckets(t={}){var e=()=>super.listBuckets,r=this;return e().call(r,t)}async deleteBucket(t){var e=()=>super.deleteBucket,r=this;return e().call(r,t)}},Tl=class extends wl{constructor(t,e,r,n){super(t,e,n),this.vectorBucketName=r}async createIndex(t){var e=()=>super.createIndex,r=this;return e().call(r,P(P({},t),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(t={}){var e=()=>super.listIndexes,r=this;return e().call(r,P(P({},t),{},{vectorBucketName:r.vectorBucketName}))}async getIndex(t){var e=()=>super.getIndex,r=this;return e().call(r,r.vectorBucketName,t)}async deleteIndex(t){var e=()=>super.deleteIndex,r=this;return e().call(r,r.vectorBucketName,t)}index(t){return new Al(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},Al=class extends bl{constructor(t,e,r,n,s){super(t,e,s),this.vectorBucketName=r,this.indexName=n}async putVectors(t){var e=()=>super.putVectors,r=this;return e().call(r,P(P({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(t){var e=()=>super.getVectors,r=this;return e().call(r,P(P({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(t={}){var e=()=>super.listVectors,r=this;return e().call(r,P(P({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(t){var e=()=>super.queryVectors,r=this;return e().call(r,P(P({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(t){var e=()=>super.deleteVectors,r=this;return e().call(r,P(P({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},eo=class extends yl{constructor(t,e={},r,n){super(t,e,r,n)}from(t){return new _l(this.url,this.headers,t,this.fetch)}get vectors(){return new Sl(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new vl(this.url+"/iceberg",this.headers,this.fetch)}};var Io=ze(Xn(),1);k(R,ze(mn(),1));k(R,ze(Xn(),1));var eh="2.97.0",Tt="";typeof Deno<"u"?Tt="deno":typeof document<"u"?Tt="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Tt="react-native":Tt="node";var th={"X-Client-Info":`supabase-js-${Tt}/${eh}`},rh={headers:th},nh={schema:"public"},sh={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},ih={};function At(t){"@babel/helpers - typeof";return At=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},At(t)}function oh(t,e){if(At(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(At(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ah(t){var e=oh(t,"string");return At(e)=="symbol"?e:e+""}function uh(t,e,r){return(e=ah(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Co(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function se(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Co(Object(r),!0).forEach(function(n){uh(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Co(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var lh=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),ch=()=>Headers,hh=(t,e,r)=>{let n=lh(r),s=ch();return async(i,o)=>{var a;let l=(a=await e())!==null&&a!==void 0?a:t,c=new s(o?.headers);return c.has("apikey")||c.set("apikey",t),c.has("Authorization")||c.set("Authorization",`Bearer ${l}`),n(i,se(se({},o),{},{headers:c}))}};function dh(t){return t.endsWith("/")?t:t+"/"}function fh(t,e){var r,n;let{db:s,auth:i,realtime:o,global:a}=t,{db:l,auth:c,realtime:d,global:m}=e,_={db:se(se({},l),s),auth:se(se({},c),i),realtime:se(se({},d),o),storage:{},global:se(se(se({},m),a),{},{headers:se(se({},(r=m?.headers)!==null&&r!==void 0?r:{}),(n=a?.headers)!==null&&n!==void 0?n:{})}),accessToken:async()=>""};return t.accessToken?_.accessToken=t.accessToken:delete _.accessToken,_}function ph(t){let e=t?.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(dh(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var mh=class extends Io.AuthClient{constructor(t){super(t)}},xo=class{constructor(t,e,r){var n,s;this.supabaseUrl=t,this.supabaseKey=e;let i=ph(t);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",i),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",i),this.storageUrl=new URL("storage/v1",i),this.functionsUrl=new URL("functions/v1",i);let o=`sb-${i.hostname.split(".")[0]}-auth-token`,a={db:nh,realtime:ih,auth:se(se({},sh),{},{storageKey:o}),global:rh},l=fh(r??{},a);if(this.storageKey=(n=l.auth.storageKey)!==null&&n!==void 0?n:"",this.headers=(s=l.global.headers)!==null&&s!==void 0?s:{},l.accessToken)this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(d,m)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(m)} is not possible`)}});else{var c;this.auth=this._initSupabaseAuthClient((c=l.auth)!==null&&c!==void 0?c:{},this.headers,l.global.fetch)}this.fetch=hh(e,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(se({headers:this.headers,accessToken:this._getAccessToken.bind(this)},l.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(d=>this.realtime.setAuth(d)).catch(d=>console.warn("Failed to set initial Realtime auth token:",d)),this.rest=new Ii(new URL("rest/v1",i).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch,timeout:l.db.timeout,urlLengthLimit:l.db.urlLengthLimit}),this.storage=new eo(this.storageUrl.href,this.headers,this.fetch,r?.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new be.FunctionsClient(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,e={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,e,r)}channel(t,e={config:{}}){return this.realtime.channel(t,e)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var t=this,e,r;if(t.accessToken)return await t.accessToken();let{data:n}=await t.auth.getSession();return(e=(r=n.session)===null||r===void 0?void 0:r.access_token)!==null&&e!==void 0?e:t.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:e,detectSessionInUrl:r,storage:n,userStorage:s,storageKey:i,flowType:o,lock:a,debug:l,throwOnError:c},d,m){let _={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new mh({url:this.authUrl.href,headers:se(se({},_),d),storageKey:i,autoRefreshToken:t,persistSession:e,detectSessionInUrl:r,storage:n,userStorage:s,flowType:o,lock:a,debug:l,throwOnError:c,fetch:m,hasCustomAuthorizationHeader:Object.keys(this.headers).some(f=>f.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new Po.RealtimeClient(this.realtimeUrl.href,se(se({},t),{},{params:se(se({},{apikey:this.supabaseKey}),t?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,e)=>{this._handleTokenChanged(t,"CLIENT",e?.access_token)})}_handleTokenChanged(t,e,r){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}},Qn=(t,e,r)=>new xo(t,e,r);function _h(){if(typeof window<"u")return!1;let t=globalThis.process;if(!t)return!1;let e=t.version;if(e==null)return!1;let r=e.match(/^v(\d+)\./);return r?parseInt(r[1],10)<=18:!1}_h()&&console.warn("\u26A0\uFE0F Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");var Rt=typeof window<"u"&&!!window.__CONFORM_ENGINE__,No=Rt?"http://127.0.0.1:9":import.meta.env.VITE_SUPABASE_URL,jo=Rt?"offline":import.meta.env.VITE_SUPABASE_ANON_KEY;if(!No)throw console.error("Missing VITE_SUPABASE_URL environment variable"),new Error("Missing Supabase URL environment variable");if(!jo)throw console.error("Missing VITE_SUPABASE_ANON_KEY environment variable"),new Error("Missing Supabase anon key environment variable");var Uo=Qn(No,jo,{auth:{autoRefreshToken:!Rt,persistSession:!Rt,detectSessionInUrl:!Rt}});var gh=`${import.meta.env.VITE_SUPABASE_URL}/functions/v1`;async function Lo(t){let{data:{session:e}}=await Uo.auth.getSession(),r=e?.access_token??import.meta.env.VITE_SUPABASE_ANON_KEY,n=JSON.stringify({format:t.format,source_filename:t.sourceFilename,persist:t.persist,session_id:t.sessionId,selected_sequence_names:t.selectedSequenceNames,previously_selected_names:t.previouslySelectedNames}),s=typeof t.extract=="string"?t.extract:JSON.stringify(t.extract),i=n+`
|
|
68
|
-
`+s,o=new Set([502,503,504,529,546]),a=null;for(let l=0;;l++){try{a=await fetch(`${gh}/v1-timeline-canonicalize/v1/timeline-canonicalize`,{method:"POST",headers:{"Content-Type":"application/x-ct-canonicalize-v1",Authorization:`Bearer ${r}`},body:i})}catch(c){if(l>=2)throw c;a=null}if(a&&(a.ok||!o.has(a.status)))break;if(l>=2)throw a?.status===546?new Error("Our conversion server stopped this timeline three times in a row. That is a limit on our side, not a problem with your file. Please try again later; if it keeps failing, converting fewer sequences at a time gets it through, and we'd like to hear about it."):new Error(`The processing server timed out (${a?.status??"network error"}) \u2014 a server hiccup, not a problem with your file. Please try again in a minute.`);await new Promise(c=>setTimeout(c,1500*(l+1)))}if(!a.ok){let l=await a.json().catch(()=>({}));throw new Error(l?.error?.message??`canonicalize failed (${a.status})`)}return await a.json()}var yh=[{ext:"mov",name:"QuickTime",container:"mov",codec:"prores",frameType:"intra",sparseStrategy:"byte-range",support:"dedicated",needsStructuralBytes:!1,trimSupported:!0},{ext:"mp4",name:"MPEG-4",container:"mov",codec:"h264",frameType:"inter",sparseStrategy:"byte-range",support:"dedicated",needsStructuralBytes:!1,trimSupported:!0},{ext:"m4v",name:"MPEG-4 Video",container:"mov",codec:"h264",frameType:"inter",sparseStrategy:"byte-range",support:"dedicated",needsStructuralBytes:!1,trimSupported:!0},{ext:"m4a",name:"MPEG-4 Audio",container:"mov",codec:"aac",frameType:"intra",sparseStrategy:"full-file",support:"container",needsStructuralBytes:!1,trimSupported:!1},{ext:"mxf",name:"MXF",container:"mxf",codec:"varies",frameType:"intra",sparseStrategy:"byte-range",support:"dedicated",needsStructuralBytes:!1,trimSupported:!0,notes:"Verified Resolve playback for XAVC-I NDF/DF. Coordinated 45-patch metadata rewrite (index entries + Duration fields). DNxHD foundation works; mid-clip trim works structurally; awaiting more corpus."},{ext:"r3d",name:"RED RAW",container:"r3d",codec:"r3d",frameType:"intra",sparseStrategy:"byte-range",support:"dedicated",needsStructuralBytes:!1,trimSupported:!0,notes:"Verified Resolve playback (V-Raptor 6K). Trim/prepare/inspect run client-side as opaque WASM (mediaOp) \u2014 browser sees no algorithm; WS bridge retired. DRAGON era + Komodo + 8K need corpus expansion. Run oracle/i2o/cli/r3d-corpus.ts on new fixtures."},{ext:"braw",name:"Blackmagic RAW",container:"mov",codec:"braw",frameType:"intra",sparseStrategy:"byte-range",support:"dedicated",needsStructuralBytes:!1,trimSupported:!0,notes:'Verified Resolve playback. Standard MP4 container with BRAW codec; reuses structure-preserving MOV walker. The "secret sauce" was knowing BRAW = MP4.'},{ext:"crm",name:"Canon Cinema RAW Light",container:"crm",codec:"crm",frameType:"intra",sparseStrategy:"byte-range",support:"planned",needsStructuralBytes:!1,trimSupported:!1,notes:"Frame-indexed single file. Canon SDK available."},{ext:"rmf",name:"Canon RAW (legacy)",container:"crm",codec:"crm",frameType:"intra",sparseStrategy:"byte-range",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"ari",name:"ARRIRAW",container:"frame-seq",codec:"arriraw",frameType:"intra",sparseStrategy:"file-select",support:"planned",needsStructuralBytes:!1,trimSupported:!1,notes:"8KB header + raw Bayer per frame. Sparse = select which .ari files to include."},{ext:"arx",name:"ARRIRAW HDE",container:"frame-seq",codec:"arriraw",frameType:"intra",sparseStrategy:"file-select",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"dpx",name:"DPX",container:"frame-seq",codec:"dpx",frameType:"intra",sparseStrategy:"file-select",support:"planned",needsStructuralBytes:!1,trimSupported:!1,notes:"SMPTE 268M. Image data offset at byte 4. ~25MB per 4K frame."},{ext:"exr",name:"OpenEXR",container:"frame-seq",codec:"exr",frameType:"intra",sparseStrategy:"file-select",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"tif",name:"TIFF",container:"frame-seq",codec:"tiff",frameType:"intra",sparseStrategy:"file-select",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"tiff",name:"TIFF",container:"frame-seq",codec:"tiff",frameType:"intra",sparseStrategy:"file-select",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"png",name:"PNG",container:"frame-seq",codec:"png",frameType:"intra",sparseStrategy:"file-select",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"jpg",name:"JPEG",container:"frame-seq",codec:"jpeg",frameType:"intra",sparseStrategy:"file-select",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"jpeg",name:"JPEG",container:"frame-seq",codec:"jpeg",frameType:"intra",sparseStrategy:"file-select",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"psd",name:"Photoshop",container:"still",codec:"psd",frameType:"intra",sparseStrategy:"full-file",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"tga",name:"Targa",container:"still",codec:"tga",frameType:"intra",sparseStrategy:"full-file",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"bmp",name:"Bitmap",container:"still",codec:"bmp",frameType:"intra",sparseStrategy:"full-file",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"gif",name:"GIF",container:"still",codec:"gif",frameType:"intra",sparseStrategy:"full-file",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"webp",name:"WebP",container:"still",codec:"webp",frameType:"intra",sparseStrategy:"full-file",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"avif",name:"AVIF",container:"still",codec:"avif",frameType:"intra",sparseStrategy:"full-file",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"wav",name:"WAV",container:"audio",codec:"pcm",frameType:"intra",sparseStrategy:"full-file",support:"full-file",needsStructuralBytes:!1,trimSupported:!0,notes:"RIFF/WAV trim decoder ships. Poly WAV (8-24ch) could benefit from time-axis chunking."},{ext:"bwf",name:"Broadcast WAV",container:"audio",codec:"pcm",frameType:"intra",sparseStrategy:"full-file",support:"full-file",needsStructuralBytes:!1,trimSupported:!0,notes:"WAV + bext chunk (~602+ bytes) with timecode reference. Same trim decoder as WAV."},{ext:"aif",name:"AIFF",container:"audio",codec:"pcm",frameType:"intra",sparseStrategy:"full-file",support:"full-file",needsStructuralBytes:!1,trimSupported:!1},{ext:"aiff",name:"AIFF",container:"audio",codec:"pcm",frameType:"intra",sparseStrategy:"full-file",support:"full-file",needsStructuralBytes:!1,trimSupported:!1},{ext:"mp3",name:"MP3",container:"audio",codec:"mp3",frameType:"intra",sparseStrategy:"full-file",support:"full-file",needsStructuralBytes:!1,trimSupported:!1},{ext:"aac",name:"AAC",container:"audio",codec:"aac",frameType:"intra",sparseStrategy:"full-file",support:"full-file",needsStructuralBytes:!1,trimSupported:!1},{ext:"avi",name:"AVI",container:"avi",codec:"varies",frameType:"intra",sparseStrategy:"byte-range",support:"container",needsStructuralBytes:!1,trimSupported:!1},{ext:"mkv",name:"Matroska",container:"mkv",codec:"h264",frameType:"inter",sparseStrategy:"byte-range",support:"container",needsStructuralBytes:!1,trimSupported:!1},{ext:"mts",name:"AVCHD",container:"mov",codec:"h264",frameType:"inter",sparseStrategy:"byte-range",support:"container",needsStructuralBytes:!1,trimSupported:!1},{ext:"m2ts",name:"AVCHD",container:"mov",codec:"h264",frameType:"inter",sparseStrategy:"byte-range",support:"container",needsStructuralBytes:!1,trimSupported:!1},{ext:"webm",name:"WebM",container:"mkv",codec:"vp9",frameType:"inter",sparseStrategy:"full-file",support:"full-file",needsStructuralBytes:!1,trimSupported:!1}],$o=new Map;for(let t of yh)$o.set(t.ext,t);function vh(t){let e=t.split(".").pop()?.toLowerCase();return e?$o.get(e)??null:null}function Do(t){return vh(t)!==null}var Lh=ze(Qo());var Uh=typeof __BUILD_SHA__<"u"?__BUILD_SHA__:"dev",br=class extends Error{constructor(e,r){super(r??"A new version of Conform was released while this page was open, so part of the app could no longer be loaded. Reload the page to continue \u2014 nothing has been sent yet."),this.name="StaleBuildError",this.chunk=e,this.buildSha=Uh}};var Zo=typeof __BUILD_SHA__<"u"?__BUILD_SHA__:"dev",Af=900*1e3;async function $h(t=fetch,e=Zo){if(!e||e==="dev"||e==="unknown")return!1;try{let r=await t(`/build-info.json?t=${Date.now()}`,{cache:"no-store"});if(!r.ok)return!1;let n=await r.json();return typeof n.sha=="string"&&n.sha!==""&&n.sha!=="unknown"&&n.sha!==e}catch{return!1}}async function ea(t=fetch,e=Zo){if(await $h(t,e))throw new br("timeline-read","A new version of Conform was released while this page was open. Reload the page and drop the file again \u2014 nothing has been read or sent yet.")}function ta(){return typeof window<"u"&&!!window.__CONFORM_ENGINE__}async function Uf(t){if(Do(t.name))return await Dh(t);let e=await qr(t);if(e.format!=="unknown"&&Br(e.format)){let{names:r}=await zs(t,e.format);return{kind:"timeline",format:e.format,name:t.name,observed_bytes:t.size,total_size:t.size,session:{id:null,inline:{timelines:r.map(n=>({name:n}))}},warnings:[],inspector:{layer:"timeline-core/wasm-inspect",version:"1",duration_ms:0}}}return{kind:"unknown",format:"unknown",name:t.name,observed_bytes:0,total_size:t.size,session:null,warnings:[{code:"container_corruption",message:`Unrecognized file: ${t.name}`}],inspector:{layer:"inspect/unknown",version:"1",duration_ms:0}}}async function Dh(t){let e=Date.now(),r=await Js(t);if(!r)return{kind:"unknown",format:"unknown",name:t.name,observed_bytes:0,total_size:t.size,session:null,warnings:[{code:"container_corruption",message:"No browser-side probe available (proprietary format or unsupported extension)"}],inspector:{layer:"probe-media/local",version:"1",duration_ms:Date.now()-e}};let n=r.container??"media",s={metadata:{id:t.name,user_id:"",source_format:n,source_filename:t.name,source_file_sha256:null,source_file_bytes:t.size,parser_name:`media:${n}`,parser_version:"1",status:"ready",error_message:null,metadata:{},created_at:new Date().toISOString()},timelines:[],media_references:[r]};return{kind:"media",format:n,name:t.name,observed_bytes:0,total_size:t.size,session:{id:null,inline:s},warnings:[],inspector:{layer:"probe-media/local",version:"1",duration_ms:Date.now()-e}}}var ra=new Map,Fh=t=>t.replace(/^[a-z]\d+:/,""),Lf=t=>ra.get(Fh(t));async function $f(t,e={}){if(ta()){let{engine:o}=await import("./engine-274GQLUB.js"),a=await o.canonicalize(t,e.selectedSequenceNames,e.previouslySelectedNames);for(let l of a.session.timelines??[])ra.set(l.id,a.session_id);return{session:a.session,sessionId:a.session_id,persistError:null}}let{format:r}=await qr(t);if(!Br(r))throw new Error(`No Rust timeline engine for format '${r}' (${t.name})`);await ea();let{fmt:n,extract:s}=await Gs(t,r,e.selectedSequenceNames),i=await Lo({format:n,extract:s,sourceFilename:t.name,persist:e.persist,sessionId:e.sessionId,selectedSequenceNames:e.selectedSequenceNames,previouslySelectedNames:e.previouslySelectedNames});return{session:i.session,sessionId:i.session_id??i.session?.id??null,persistError:i.persist_error??null}}export{$f as canonicalizeTimelineFile,Lf as engineSessionFor,Fh as engineTimelineId,Uf as inspectFile};
|
|
68
|
+
`+s,o=new Set([502,503,504,529,546]),a=null;for(let l=0;;l++){try{a=await fetch(`${gh}/v1-timeline-canonicalize/v1/timeline-canonicalize`,{method:"POST",headers:{"Content-Type":"application/x-ct-canonicalize-v1",Authorization:`Bearer ${r}`},body:i})}catch(c){if(l>=2)throw c;a=null}if(a&&(a.ok||!o.has(a.status)))break;if(l>=2)throw a?.status===546?new Error("Our conversion server stopped this timeline three times in a row. That is a limit on our side, not a problem with your file. Please try again later; if it keeps failing, converting fewer sequences at a time gets it through, and we'd like to hear about it."):new Error(`The processing server timed out (${a?.status??"network error"}) \u2014 a server hiccup, not a problem with your file. Please try again in a minute.`);await new Promise(c=>setTimeout(c,1500*(l+1)))}if(!a.ok){let l=await a.json().catch(()=>({}));throw new Error(l?.error?.message??`canonicalize failed (${a.status})`)}return await a.json()}var yh=[{ext:"mov",name:"QuickTime",container:"mov",codec:"prores",frameType:"intra",sparseStrategy:"byte-range",support:"dedicated",needsStructuralBytes:!1,trimSupported:!0},{ext:"mp4",name:"MPEG-4",container:"mov",codec:"h264",frameType:"inter",sparseStrategy:"byte-range",support:"dedicated",needsStructuralBytes:!1,trimSupported:!0},{ext:"m4v",name:"MPEG-4 Video",container:"mov",codec:"h264",frameType:"inter",sparseStrategy:"byte-range",support:"dedicated",needsStructuralBytes:!1,trimSupported:!0},{ext:"m4a",name:"MPEG-4 Audio",container:"mov",codec:"aac",frameType:"intra",sparseStrategy:"full-file",support:"container",needsStructuralBytes:!1,trimSupported:!1},{ext:"mxf",name:"MXF",container:"mxf",codec:"varies",frameType:"intra",sparseStrategy:"byte-range",support:"dedicated",needsStructuralBytes:!1,trimSupported:!0,notes:"Verified Resolve playback for XAVC-I NDF/DF. Coordinated 45-patch metadata rewrite (index entries + Duration fields). DNxHD foundation works; mid-clip trim works structurally; awaiting more corpus."},{ext:"r3d",name:"RED RAW",container:"r3d",codec:"r3d",frameType:"intra",sparseStrategy:"byte-range",support:"dedicated",needsStructuralBytes:!1,trimSupported:!0,notes:"Verified Resolve playback (V-Raptor 6K). Trim/prepare/inspect run client-side as opaque WASM (mediaOp) \u2014 browser sees no algorithm; WS bridge retired. DRAGON era + Komodo + 8K need corpus expansion. Run oracle/i2o/cli/r3d-corpus.ts on new fixtures."},{ext:"braw",name:"Blackmagic RAW",container:"mov",codec:"braw",frameType:"intra",sparseStrategy:"byte-range",support:"dedicated",needsStructuralBytes:!1,trimSupported:!0,notes:'Verified Resolve playback. Standard MP4 container with BRAW codec; reuses structure-preserving MOV walker. The "secret sauce" was knowing BRAW = MP4.'},{ext:"crm",name:"Canon Cinema RAW Light",container:"crm",codec:"crm",frameType:"intra",sparseStrategy:"byte-range",support:"planned",needsStructuralBytes:!1,trimSupported:!1,notes:"Frame-indexed single file. Canon SDK available."},{ext:"rmf",name:"Canon RAW (legacy)",container:"crm",codec:"crm",frameType:"intra",sparseStrategy:"byte-range",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"ari",name:"ARRIRAW",container:"frame-seq",codec:"arriraw",frameType:"intra",sparseStrategy:"file-select",support:"planned",needsStructuralBytes:!1,trimSupported:!1,notes:"8KB header + raw Bayer per frame. Sparse = select which .ari files to include."},{ext:"arx",name:"ARRIRAW HDE",container:"frame-seq",codec:"arriraw",frameType:"intra",sparseStrategy:"file-select",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"dpx",name:"DPX",container:"frame-seq",codec:"dpx",frameType:"intra",sparseStrategy:"file-select",support:"planned",needsStructuralBytes:!1,trimSupported:!1,notes:"SMPTE 268M. Image data offset at byte 4. ~25MB per 4K frame."},{ext:"exr",name:"OpenEXR",container:"frame-seq",codec:"exr",frameType:"intra",sparseStrategy:"file-select",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"tif",name:"TIFF",container:"frame-seq",codec:"tiff",frameType:"intra",sparseStrategy:"file-select",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"tiff",name:"TIFF",container:"frame-seq",codec:"tiff",frameType:"intra",sparseStrategy:"file-select",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"png",name:"PNG",container:"frame-seq",codec:"png",frameType:"intra",sparseStrategy:"file-select",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"jpg",name:"JPEG",container:"frame-seq",codec:"jpeg",frameType:"intra",sparseStrategy:"file-select",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"jpeg",name:"JPEG",container:"frame-seq",codec:"jpeg",frameType:"intra",sparseStrategy:"file-select",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"psd",name:"Photoshop",container:"still",codec:"psd",frameType:"intra",sparseStrategy:"full-file",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"tga",name:"Targa",container:"still",codec:"tga",frameType:"intra",sparseStrategy:"full-file",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"bmp",name:"Bitmap",container:"still",codec:"bmp",frameType:"intra",sparseStrategy:"full-file",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"gif",name:"GIF",container:"still",codec:"gif",frameType:"intra",sparseStrategy:"full-file",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"webp",name:"WebP",container:"still",codec:"webp",frameType:"intra",sparseStrategy:"full-file",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"avif",name:"AVIF",container:"still",codec:"avif",frameType:"intra",sparseStrategy:"full-file",support:"planned",needsStructuralBytes:!1,trimSupported:!1},{ext:"wav",name:"WAV",container:"audio",codec:"pcm",frameType:"intra",sparseStrategy:"full-file",support:"full-file",needsStructuralBytes:!1,trimSupported:!0,notes:"RIFF/WAV trim decoder ships. Poly WAV (8-24ch) could benefit from time-axis chunking."},{ext:"bwf",name:"Broadcast WAV",container:"audio",codec:"pcm",frameType:"intra",sparseStrategy:"full-file",support:"full-file",needsStructuralBytes:!1,trimSupported:!0,notes:"WAV + bext chunk (~602+ bytes) with timecode reference. Same trim decoder as WAV."},{ext:"aif",name:"AIFF",container:"audio",codec:"pcm",frameType:"intra",sparseStrategy:"full-file",support:"full-file",needsStructuralBytes:!1,trimSupported:!1},{ext:"aiff",name:"AIFF",container:"audio",codec:"pcm",frameType:"intra",sparseStrategy:"full-file",support:"full-file",needsStructuralBytes:!1,trimSupported:!1},{ext:"mp3",name:"MP3",container:"audio",codec:"mp3",frameType:"intra",sparseStrategy:"full-file",support:"full-file",needsStructuralBytes:!1,trimSupported:!1},{ext:"aac",name:"AAC",container:"audio",codec:"aac",frameType:"intra",sparseStrategy:"full-file",support:"full-file",needsStructuralBytes:!1,trimSupported:!1},{ext:"avi",name:"AVI",container:"avi",codec:"varies",frameType:"intra",sparseStrategy:"byte-range",support:"container",needsStructuralBytes:!1,trimSupported:!1},{ext:"mkv",name:"Matroska",container:"mkv",codec:"h264",frameType:"inter",sparseStrategy:"byte-range",support:"container",needsStructuralBytes:!1,trimSupported:!1},{ext:"mts",name:"AVCHD",container:"mov",codec:"h264",frameType:"inter",sparseStrategy:"byte-range",support:"container",needsStructuralBytes:!1,trimSupported:!1},{ext:"m2ts",name:"AVCHD",container:"mov",codec:"h264",frameType:"inter",sparseStrategy:"byte-range",support:"container",needsStructuralBytes:!1,trimSupported:!1},{ext:"webm",name:"WebM",container:"mkv",codec:"vp9",frameType:"inter",sparseStrategy:"full-file",support:"full-file",needsStructuralBytes:!1,trimSupported:!1}],$o=new Map;for(let t of yh)$o.set(t.ext,t);function vh(t){let e=t.split(".").pop()?.toLowerCase();return e?$o.get(e)??null:null}function Do(t){return vh(t)!==null}var Lh=ze(Qo());var Uh=typeof __BUILD_SHA__<"u"?__BUILD_SHA__:"dev",br=class extends Error{constructor(e,r){super(r??"A new version of Conform was released while this page was open, so part of the app could no longer be loaded. Reload the page to continue \u2014 nothing has been sent yet."),this.name="StaleBuildError",this.chunk=e,this.buildSha=Uh}};var Zo=typeof __BUILD_SHA__<"u"?__BUILD_SHA__:"dev",Af=900*1e3;async function $h(t=fetch,e=Zo){if(!e||e==="dev"||e==="unknown")return!1;try{let r=await t(`/build-info.json?t=${Date.now()}`,{cache:"no-store"});if(!r.ok)return!1;let n=await r.json();return typeof n.sha=="string"&&n.sha!==""&&n.sha!=="unknown"&&n.sha!==e}catch{return!1}}async function ea(t=fetch,e=Zo){if(await $h(t,e))throw new br("timeline-read","A new version of Conform was released while this page was open. Reload the page and drop the file again \u2014 nothing has been read or sent yet.")}function ta(){return typeof window<"u"&&!!window.__CONFORM_ENGINE__}async function Uf(t){if(Do(t.name))return await Dh(t);let e=await qr(t);if(e.format!=="unknown"&&Br(e.format)){let{names:r}=await zs(t,e.format);return{kind:"timeline",format:e.format,name:t.name,observed_bytes:t.size,total_size:t.size,session:{id:null,inline:{timelines:r.map(n=>({name:n}))}},warnings:[],inspector:{layer:"timeline-core/wasm-inspect",version:"1",duration_ms:0}}}return{kind:"unknown",format:"unknown",name:t.name,observed_bytes:0,total_size:t.size,session:null,warnings:[{code:"container_corruption",message:`Unrecognized file: ${t.name}`}],inspector:{layer:"inspect/unknown",version:"1",duration_ms:0}}}async function Dh(t){let e=Date.now(),r=await Js(t);if(!r)return{kind:"unknown",format:"unknown",name:t.name,observed_bytes:0,total_size:t.size,session:null,warnings:[{code:"container_corruption",message:"No browser-side probe available (proprietary format or unsupported extension)"}],inspector:{layer:"probe-media/local",version:"1",duration_ms:Date.now()-e}};let n=r.container??"media",s={metadata:{id:t.name,user_id:"",source_format:n,source_filename:t.name,source_file_sha256:null,source_file_bytes:t.size,parser_name:`media:${n}`,parser_version:"1",status:"ready",error_message:null,metadata:{},created_at:new Date().toISOString()},timelines:[],media_references:[r]};return{kind:"media",format:n,name:t.name,observed_bytes:0,total_size:t.size,session:{id:null,inline:s},warnings:[],inspector:{layer:"probe-media/local",version:"1",duration_ms:Date.now()-e}}}var ra=new Map,Fh=t=>t.replace(/^[a-z]\d+:/,""),Lf=t=>ra.get(Fh(t));async function $f(t,e={}){if(ta()){let{engine:o}=await import("./engine-6ACEWA4S.js"),a=await o.canonicalize(t,e.selectedSequenceNames,e.previouslySelectedNames);for(let l of a.session.timelines??[])ra.set(l.id,a.session_id);return{session:a.session,sessionId:a.session_id,persistError:null}}let{format:r}=await qr(t);if(!Br(r))throw new Error(`No Rust timeline engine for format '${r}' (${t.name})`);await ea();let{fmt:n,extract:s}=await Gs(t,r,e.selectedSequenceNames),i=await Lo({format:n,extract:s,sourceFilename:t.name,persist:e.persist,sessionId:e.sessionId,selectedSequenceNames:e.selectedSequenceNames,previouslySelectedNames:e.previouslySelectedNames});return{session:i.session,sessionId:i.session_id??i.session?.id??null,persistError:i.persist_error??null}}export{$f as canonicalizeTimelineFile,Lf as engineSessionFor,Fh as engineTimelineId,Uf as inspectFile};
|
|
@@ -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 N}from"./chunk-TK55FA56.js";import{a as T,b as L}from"./chunk-AACY2V3L.js";import{b as p,c as O,g as J}from"./chunk-XDI6CPPV.js";import{b as V}from"./chunk-
|
|
3
|
+
import{a as N}from"./chunk-TK55FA56.js";import{a as T,b as L}from"./chunk-AACY2V3L.js";import{b as p,c as O,g as J}from"./chunk-XDI6CPPV.js";import{b as V}from"./chunk-7W5AFZYX.js";import{b as $,c as _}from"./chunk-LZRCXSUJ.js";import{$ as f,A as P,B as x,C as F,D as A,Da as k,Ga as C,Ha as U,Ia as d,N as D,O as z,ha as E,k as w,m as v,n as y,p as R,qa as H,ta as I,x as S,y as M}from"./chunk-DPA26AOI.js";import"./chunk-PSANHDZM.js";function u(e){return(t,n)=>e.read(t,n)}function B(e){let t=e.toLowerCase().trim();return t==="aprn"||t==="aprh"?"prores_raw":t==="apch"||t==="apcn"||t==="apcs"||t==="apco"||t==="ap4h"||t==="ap4x"?"prores":t==="avdn"?"dnxhd":t==="dnxh"?"dnxhr":t==="avc1"||t==="avc3"?"h264":t==="hev1"||t==="hvc1"?"h265":t==="braw"?"braw":e}var h={apco:"Proxy",apcs:"LT",apcn:"422",apch:"HQ",ap4h:"4444",ap4x:"4444 XQ"},Z={1:"bt709",2:"unknown",5:"bt470bg",6:"smpte170m",9:"bt2020",11:"smpte431",12:"smpte432"},ee={1:"bt709",2:"unknown",6:"smpte170m",8:"linear",13:"iec61966-2-1",14:"bt2020-10",15:"bt2020-12",16:"smpte2084",18:"arib-std-b67"},re={0:"gbr",1:"bt709",2:"unknown",5:"bt470bg",6:"smpte170m",9:"bt2020nc",10:"bt2020c"};function te(e,t){return e==="ap4h"||e==="ap4x"?t===32?"yuva444p12le":"yuv444p12le":e in h?"yuv422p10le":void 0}var Q={66:"Baseline",77:"Main",88:"Extended",100:"High",110:"High 10",122:"High 4:2:2",244:"High 4:4:4"},G={1:"Main",2:"Main 10",3:"Main Still",4:"Rext"},ne={1270:"DNxHR 444",1271:"DNxHR HQX",1272:"DNxHR HQ",1273:"DNxHR SQ",1274:"DNxHR LB"};function oe(e,t){if(h[e.codec_fourcc])return`ProRes ${h[e.codec_fourcc]}`;if(e.vc3_cid)return ne[e.vc3_cid]??`DNxHD ${e.vc3_cid}`;if(e.video_profile!=null){if(t==="h264"&&Q[e.video_profile])return`H.264 ${Q[e.video_profile]}`;if(t==="h265"&&G[e.video_profile])return`HEVC ${G[e.video_profile]}`}}function ie(e,t){let n=e.video_chroma,r=e.video_bit_depth;if(n==null&&t==="h264"&&[66,77,88].includes(e.video_profile??-1)&&([n,r]=[1,8]),n==null&&e.vc3_cid&&(n=e.vc3_cid===1270||e.vc3_cid===1256?3:2),n==null||r==null)return;let i=["gray","yuv420p","yuv422p","yuv444p"][n];return r>8?`${i}${r}le`:i}function W(e,t){let n=[];for(let r of e){if(r.kind!=="clip"||!r.source_range)continue;let i=r.source_range.start.value,o=r.source_range.duration.value,c=Math.max(0,Math.floor(i)-t),a=Math.floor(i+o-1)+t;a>=c&&n.push({first_frame:c,last_frame:a})}return n}var be={async inspect(e){await d();let t=e.parts[0],n=await f(u(t),t.fileSize,e.format),r=JSON.parse(n);if(!r)return null;let i=r.timecode&&r.timecode.fps_denominator>0?r.timecode.fps_numerator/r.timecode.fps_denominator:null,o=B(r.codec_fourcc),c=[{kind:"video",codec:o,width:r.width??void 0,height:r.height??void 0,rate:i??void 0,bit_depth:p(r.codec_fourcc)??p(o)??O(o,r.video_profile)??r.video_bit_depth??void 0,codec_specific:{fourcc:r.codec_fourcc,profile:oe(r,o),pixel_format:te(r.codec_fourcc,r.video_depth)??ie(r,o),colr:r.colr?{primaries:Z[r.colr.primaries]??r.colr.primaries,transfer:ee[r.colr.transfer]??r.colr.transfer,matrix:re[r.colr.matrix]??r.colr.matrix}:void 0}}];for(let a of r.audio_tracks??(r.audio?[r.audio]:[]))c.push({kind:"audio",codec:a.codec_fourcc,channels:a.channels??void 0,rate:a.sample_rate??void 0,bit_depth:a.bit_depth??void 0,codec_specific:{fourcc:a.codec_fourcc,channel_layout:a.channel_layout??void 0}});return{id:t.filename,kind:"external",target_url:t.filename,available_range:i&&r.duration_seconds?{start:{value:0,rate:i},duration:{value:Math.round(r.duration_seconds*i),rate:i}}:null,reel_name:null,source_timecode:r.timecode?.display??null,container:e.format==="mov"?"mov":e.format,codec:o,size_bytes:t.fileSize,source_fps:i,source_resolution_w:r.width??null,source_resolution_h:r.height??null,streams:c,decode_provenance:r.decode_provenance??null,vendor_metadata:r.timecode?{drop_frame:r.timecode.drop_frame}:{},binding_state:"unbound",raw_extraction:{mov_probe:r},metadata:{}}},async extract(e){await d();let t=e.parts[0],n=JSON.parse(await E(u(t),t.fileSize,e.format));if(n.length===0)return null;let r=JSON.parse(await f(u(t),t.fileSize,e.format)),i=r?B(r.codec_fourcc):e.format,o=r?.timecode&&r.timecode.fps_denominator>0?r.timecode.fps_numerator/r.timecode.fps_denominator:void 0;return{v:1,container:e.format==="mov"?"mov":e.format,codec:i,width:r?.width??void 0,height:r?.height??void 0,fps:o,frame_count:T(n),timecode:r?.timecode?.display??void 0,granularity:L(n),segments:n}},async sparsify(e,t){await d();let n=e.parts[0],r=W(t.items,t.handles),i=await I(u(n),n.fileSize,JSON.stringify(r),e.format),o=JSON.parse(i);return[{filename:n.filename,fileSize:o.fileSize,structuralRanges:o.structuralRanges,essenceRanges:o.essenceRanges,trimInputs:o.trimInputs}]},async trim(e,t){await d();let n=e.parts[0],r=W(t.items,0);if(r.length===0)throw new Error("isobmff trim: no usable trim ranges in items");let i=await V(r,t.handles,(o,c)=>H(u(n),n.fileSize,o,c,e.format));return i.map((o,c)=>{let a=JSON.parse(o);return i.length>1&&(a.output_clip_number=c+1,a.output_clip_count=i.length,a.output_part_number=1),a})},async decode(e,t,n){await d();let r=n.detail==="coarse",i=e.parts[0];if(e.format==="crm"){let l=await R(u(i),i.fileSize,t,r?"preview":"full");return s(l)}let o=await Y(e);if(t<0||t>=o.length)throw new _(t,o.length);let c=o[t],a=await i.read(c.offset,c.size);if(e.format==="braw")return s(r?v(a,0):y(a));if(b(a)){let l=await q(e);return s(l?m.decode_prores_raw_tier(a,r?"preview":"full",l):r?P(a,0):x(a))}if(j(a))return s(r?D(a,0):z(a));if(r)return s(S(a,0));let g=await ae(a);return g||s(A(a))},async decode16(e,t){await d();let n=e.parts[0];if(e.format==="crm")throw new Error("crm: no 16-bit decoder");let r=await Y(e);if(t<0||t>=r.length)throw new _(t,r.length);let i=r[t],o=await n.read(i.offset,i.size),c=b(o)?await q(e):null,a=e.format==="braw"?w(o):b(o)?c?m.decode_prores_raw_tier(o,"rgb16",c):M(o):j(o)?(()=>{throw new Error("vc3: no 16-bit decoder")})():F(o);return $(a)}};async function ae(e){if(!U)return null;try{let t=await import("./prores-RIG37OIH.js");if(!await t.proresGpuAvailable())return null;let n=await t.decodeProResRgbaGpu(e);return n?{width:n.width,height:n.height,rgba:n.rgba}:null}catch{return null}}function j(e){return e.length>=4&&e[0]===0&&e[1]===0&&e[2]===2&&e[3]===128}function b(e){return e.length>=8&&e[4]===112&&e[5]===114&&e[6]===114&&e[7]===102}function s(e){let t=new DataView(e.buffer,e.byteOffset,8);return{width:t.getUint32(0,!0),height:t.getUint32(4,!0),rgba:e.slice(8)}}var m=C,X=new WeakMap;function q(e){let t=X.get(e);if(!t){let n=e.parts[0];t=m.prores_raw_container_color&&m.decode_prores_raw_tier?N({fileSize:n.fileSize,read:n.read}).then(r=>{let i=m.prores_raw_container_color(r);return i.length?i:null}):Promise.resolve(null),X.set(e,t)}return t}var K=new WeakMap;async function Y(e){let t=K.get(e);if(!t){let n=e.parts[0],r=J(await k(u(n),n.fileSize,e.format));if(!r.w||!r.h)throw new Error("could not find a video sample table");t=r.offs,K.set(e,t)}return t}export{be as isobmffFormat};
|
|
@@ -1,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{c as b}from"./chunk-6V4OEOOX.js";import"./chunk-RGMTLNMF.js";import{c as w,g as y}from"./chunk-
|
|
3
|
+
import{c as b}from"./chunk-6V4OEOOX.js";import"./chunk-RGMTLNMF.js";import{c as w,g as y}from"./chunk-LZRCXSUJ.js";import{Ca as l,Ga as p,Ia as h}from"./chunk-DPA26AOI.js";import"./chunk-PSANHDZM.js";var F=72*1024*1024,S=16,m=p;function L(){return typeof m.video_open=="function"&&typeof m.video_decode=="function"}async function P(r,e){if(await h(),!L())return null;try{return JSON.parse(await m.video_open(r,e))}catch{return null}}function k(r){l?.(r)}var u=new WeakMap;function v(r){let e=u.get(r);if(!e){let t=r.parts[0];e=P((n,a)=>t.read(n,a),t.fileSize).then(n=>{if(!n)throw new Error(`mcvideo: media-core has no video decoder for ${t.filename}`);return{info:n,cache:new Map,cacheCoarse:!1,frameBytes:0,queue:Promise.resolve()}}),e.catch(()=>u.delete(r)),u.set(r,e)}return e}async function B(r){try{return(await v(r)).info.frames}catch{return 0}}function _(r){let e=new DataView(r.buffer,r.byteOffset,r.byteLength),t=new Map,n=4;for(let a=e.getUint32(0,!0);a>0&&n+12<=r.length;a--){let s=e.getUint32(n,!0),c=e.getUint32(n+4,!0),i=e.getUint32(n+8,!0),o=c*i*4;if(n+=12,n+o>r.length)break;t.set(s,{width:c,height:i,rgba:r.slice(n,n+o)}),n+=o}return t}async function C(r,e,t){let n=await v(r),{info:a}=n;if(e<0||e>=a.frames)throw new w(e,a.frames);let s=async()=>{let i=t&&a.codec==="dv";n.cacheCoarse!==i&&(n.cache.clear(),n.cacheCoarse=i);let o=n.cache.get(e);if(!o){let g=a.inter?Math.max(1,Math.min(S,n.frameBytes?Math.floor(F/n.frameBytes):4)):1,d=_(await m.video_decode(a.handle,e,Math.min(a.frames,e+g),i));n.cache=d,o=d.get(e),o&&(n.frameBytes=o.rgba.length)}if(!o)throw new Error(`mcvideo: ${a.codec} frame ${e} did not decode`);return n.cache.delete(e),o},c=n.queue.then(s,s);return n.queue=c.catch(()=>{}),c}async function f(r){let e=b(r.parts[0]?.filename??""),t=e?await y(e):null;return t&&e?[t,{...r,format:e}]:null}async function M(r){let e=await f(r);if(!e)throw new Error(`mcvideo: no container module for ${r.parts[0]?.filename} \u2014 ships whole`);return e}var I={async inspect(r){let e=await f(r);return e?e[0].inspect(e[1]):null},async extract(r){let e=await f(r);return e?e[0].extract(e[1]):null},async sparsify(r,e){let[t,n]=await M(r);return t.sparsify(n,e)},async trim(r,e){let[t,n]=await M(r);return t.trim(n,e)},async decode(r,e,{detail:t}){return C(r,e,t==="coarse")}};export{k as closeVideoLane,L as hasVideoLane,I as mcVideoFormat,P as openVideoLane,_ as unpackWindow,B as videoLaneFrames};
|