conformtools 0.6.21 → 0.6.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/dist/account-ZGDVLMZA.js +3 -0
  2. package/dist/{agent-hook-setup-D2QNHA3V.js → agent-hook-setup-IACTYSVL.js} +1 -1
  3. package/dist/{analysis-engine-VNGF3DE4.js → analysis-engine-BBOSGAB2.js} +1 -1
  4. package/dist/{bridge-GW2VQP2I.js → bridge-6XEVB67I.js} +1 -1
  5. package/dist/browser/timeline_core_bg.wasm +0 -0
  6. package/dist/{chunk-M56WEBZY.js → chunk-3AR7KSPH.js} +1 -1
  7. package/dist/{chunk-2WNNDPVR.js → chunk-3KS3547B.js} +1 -1
  8. package/dist/{chunk-X7C4YS2J.js → chunk-3LGFQ42R.js} +1 -1
  9. package/dist/{chunk-CXOK4SF6.js → chunk-5JDF2IUF.js} +1 -1
  10. package/dist/{chunk-5YCUHHZO.js → chunk-5VQ2IHWO.js} +1 -1
  11. package/dist/{chunk-3WJSWOCS.js → chunk-67VLJJ75.js} +2 -2
  12. package/dist/chunk-6U2DUMIM.js +3 -0
  13. package/dist/{chunk-5XJVAA6N.js → chunk-BHBBS26Z.js} +1 -1
  14. package/dist/{chunk-LKX3HCRN.js → chunk-DCO5D65W.js} +1 -1
  15. package/dist/{chunk-AY72AUHE.js → chunk-DESBZZGR.js} +94 -94
  16. package/dist/chunk-E75BCWXY.js +4 -0
  17. package/dist/{chunk-2WD3MDPB.js → chunk-EZYCCYY7.js} +1 -1
  18. package/dist/{chunk-XAUMTGJZ.js → chunk-GN5T5S6K.js} +2 -2
  19. package/dist/{chunk-M545OKDZ.js → chunk-HNEKQMQG.js} +1 -1
  20. package/dist/chunk-IDADYIY6.js +7 -0
  21. package/dist/{chunk-SQCGMF6W.js → chunk-ISG6PEOD.js} +1 -1
  22. package/dist/chunk-IW5M45CL.js +3 -0
  23. package/dist/{chunk-OR6IMPAS.js → chunk-KDNIWB5V.js} +1 -1
  24. package/dist/{chunk-JCNKPRYY.js → chunk-LBROV5JN.js} +1 -1
  25. package/dist/chunk-NHWWMLZW.js +5 -0
  26. package/dist/{chunk-I6WBZBGN.js → chunk-NQDVV2PX.js} +1 -1
  27. package/dist/chunk-OCNKVM26.js +7 -0
  28. package/dist/{chunk-P6MSAFNR.js → chunk-Q72JSDNU.js} +1 -1
  29. package/dist/{chunk-PENDVYIL.js → chunk-V6MI7VE3.js} +1 -1
  30. package/dist/{chunk-Z42CP7YT.js → chunk-XIFURVIB.js} +1 -1
  31. package/dist/{chunk-WW6XAQKM.js → chunk-XX7QQIBI.js} +1 -1
  32. package/dist/{chunk-5WL2ZPPB.js → chunk-ZEVOSOP4.js} +185 -184
  33. package/dist/{chunk-26ZNWQLT.js → chunk-ZNUIZEPF.js} +1 -1
  34. package/dist/chunk-ZPIY5DOU.js +3 -0
  35. package/dist/{claude-setup-AI4WXN2V.js → claude-setup-6RMV3QZM.js} +1 -1
  36. package/dist/cli.js +2 -2
  37. package/dist/{cr3-wasm-CVZ2A7HA.js → cr3-wasm-CQ5YEFUF.js} +1 -1
  38. package/dist/{demo-engine-MOHHYVGV.js → demo-engine-O5T6QRYL.js} +1 -1
  39. package/dist/{dng-wasm-TN64FKIN.js → dng-wasm-K6PWOV4P.js} +1 -1
  40. package/dist/{dpx-wasm-BO2NDGTA.js → dpx-wasm-RJZANW6N.js} +1 -1
  41. package/dist/{engine-WMOJ3HRU.js → engine-WEGECPAH.js} +2 -2
  42. package/dist/{exr-wasm-W4K6W6JZ.js → exr-wasm-EZY3GZ2L.js} +1 -1
  43. package/dist/framing-V3AI35RV.js +3 -0
  44. package/dist/gfx-worker.js +1 -1
  45. package/dist/{h264-LC27KFZT.js → h264-KMDAFD3Q.js} +1 -1
  46. package/dist/{h264-mxf-GQCFBTTP.js → h264-mxf-IJYHBYKB.js} +1 -1
  47. package/dist/hook.js +3 -3
  48. package/dist/{host-relink-BYLBYTPH.js → host-relink-IDTSHA4V.js} +1 -1
  49. package/dist/hosted-7KVSASRJ.js +3 -0
  50. package/dist/hosts-5VFREDGW.js +3 -0
  51. package/dist/http.js +4 -4
  52. package/dist/{inspect-63MCOFOQ.js → inspect-VS5N6SKX.js} +16 -17
  53. package/dist/isobmff-4FUKPUL3.js +3 -0
  54. package/dist/{mc-video-G4KNAHGG.js → mc-video-DTMHUECT.js} +1 -1
  55. package/dist/mcp.js +1 -1
  56. package/dist/{media-Z23SL7RZ.js → media-3XXQBZNW.js} +1 -1
  57. package/dist/mxf-LGRSWF7S.js +3 -0
  58. package/dist/{ops-T6ZV7RAM.js → ops-QAML7C35.js} +1 -1
  59. package/dist/{probe-YOYK7HR5.js → probe-VB6JH6ZJ.js} +1 -1
  60. package/dist/{r3d-6P6K47AH.js → r3d-AWQQHTQC.js} +1 -1
  61. package/dist/{r3d-ISLQ6I3S.js → r3d-OL6DVR3C.js} +1 -1
  62. package/dist/resolve-bridge.py +208 -13
  63. package/dist/{sequence-patch-5MFTY52Q.js → sequence-patch-OHYBBKKZ.js} +1 -1
  64. package/dist/{still-DMZJUM7M.js → still-CDF26BQZ.js} +1 -1
  65. package/dist/{still-wasm-ZLP224QL.js → still-wasm-3EBYMLVL.js} +1 -1
  66. package/dist/{store-6XN5Q6UG.js → store-ZXNF2RXS.js} +1 -1
  67. package/dist/{tiff-wasm-TAEKNO4Q.js → tiff-wasm-JIBA5AI4.js} +1 -1
  68. package/dist/timeline-BAMMSL7B.js +3 -0
  69. package/dist/wasm/media_core_bg.wasm +0 -0
  70. package/dist/{wav-BNOX5U7S.js → wav-N6EWJR2P.js} +1 -1
  71. package/package.json +5 -5
  72. package/dist/account-VD3EE5UT.js +0 -3
  73. package/dist/chunk-2XQ42O7E.js +0 -7
  74. package/dist/chunk-BUOYYO22.js +0 -3
  75. package/dist/chunk-COALWMI7.js +0 -4
  76. package/dist/chunk-MU5AGXSH.js +0 -3
  77. package/dist/chunk-QJPOC4SW.js +0 -3
  78. package/dist/chunk-VG73BE6N.js +0 -4
  79. package/dist/chunk-ZAL7Y5VZ.js +0 -7
  80. package/dist/framing-GOLRVBBJ.js +0 -3
  81. package/dist/hosted-ASNIPMSH.js +0 -3
  82. package/dist/hosts-EYVK23A3.js +0 -3
  83. package/dist/isobmff-IMEN2G3B.js +0 -3
  84. package/dist/mxf-ZEM6EEZU.js +0 -3
  85. package/dist/timeline-P4GJT36O.js +0 -3
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
+ import{a as U}from"./chunk-TK55FA56.js";import{a as J,b as T}from"./chunk-AACY2V3L.js";import{b as _,c as N,g as O}from"./chunk-NQDVV2PX.js";import{b as L}from"./chunk-XX7QQIBI.js";import{b as V,c as b}from"./chunk-5JDF2IUF.js";import{$ as p,A as P,B as x,C as F,D as A,Da as I,Ga as C,Ha 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 k,ta as H,x as S,y as M}from"./chunk-DCO5D65W.js";import"./chunk-PSANHDZM.js";function m(e){return(n,t)=>e.read(n,t)}function $(e){let n=e.toLowerCase().trim();return n==="aprn"||n==="aprh"?"prores_raw":n==="apch"||n==="apcn"||n==="apcs"||n==="apco"||n==="ap4h"||n==="ap4x"?"prores":n==="avdn"?"dnxhd":n==="dnxh"?"dnxhr":n==="avc1"||n==="avc3"?"h264":n==="hev1"||n==="hvc1"?"h265":n==="braw"?"braw":e}var g={apco:"Proxy",apcs:"LT",apcn:"422",apch:"HQ",ap4h:"4444",ap4x:"4444 XQ"},Z={1:"bt709",2:"unknown",4:"bt470m",5:"bt470bg",6:"smpte170m",7:"smpte240m",8:"film",9:"bt2020",10:"smpte428",11:"smpte431",12:"smpte432",22:"jedec-p22"},ee={1:"bt709",2:"unknown",4:"gamma22",5:"gamma28",6:"smpte170m",7:"smpte240m",8:"linear",9:"log100",10:"log316",11:"iec61966-2-4",12:"bt1361e",13:"iec61966-2-1",14:"bt2020-10",15:"bt2020-12",16:"smpte2084",17:"smpte428",18:"arib-std-b67"},re={0:"gbr",1:"bt709",2:"unknown",4:"fcc",5:"bt470bg",6:"smpte170m",7:"smpte240m",8:"ycgco",9:"bt2020nc",10:"bt2020c",14:"ictcp"};function ne(e,n){return e==="ap4h"||e==="ap4x"?n===32?"yuva444p12le":"yuv444p12le":e in g?"yuv422p10le":void 0}var B={66:"Baseline",77:"Main",88:"Extended",100:"High",110:"High 10",122:"High 4:2:2",244:"High 4:4:4"},Q={1:"Main",2:"Main 10",3:"Main Still",4:"Rext"},te={1270:"DNxHR 444",1271:"DNxHR HQX",1272:"DNxHR HQ",1273:"DNxHR SQ",1274:"DNxHR LB"};function oe(e,n){if(g[e.codec_fourcc])return`ProRes ${g[e.codec_fourcc]}`;if(e.vc3_cid)return te[e.vc3_cid]??`DNxHD ${e.vc3_cid}`;if(e.video_profile!=null){if(n==="h264"&&B[e.video_profile])return`H.264 ${B[e.video_profile]}`;if(n==="h265"&&Q[e.video_profile])return`HEVC ${Q[e.video_profile]}`}}function ie(e,n){let t=e.video_chroma,r=e.video_bit_depth;if(t==null&&n==="h264"&&[66,77,88].includes(e.video_profile??-1)&&([t,r]=[1,8]),t==null&&e.vc3_cid&&(t=e.vc3_cid===1270||e.vc3_cid===1256?3:2),t==null||r==null)return;let a=["gray","yuv420p","yuv422p","yuv444p"][t];return r>8?`${a}${r}le`:a}function j(e,n){let t=[];for(let r of e){if(r.kind!=="clip"||!r.source_range)continue;let a=r.source_range.start.value,i=r.source_range.duration.value,c=Math.max(0,Math.floor(a)-n),o=Math.floor(a+i-1)+n;o>=c&&t.push({first_frame:c,last_frame:o})}return t}function ae(e,n){return e&&n&&Math.abs(n/e-1)<.001?n:e??n}var he={async inspect(e){await d();let n=e.parts[0],t=await p(m(n),n.fileSize,e.format),r=JSON.parse(t);if(!r)return null;let a=r.timecode&&r.timecode.fps_denominator>0?r.timecode.fps_numerator/r.timecode.fps_denominator:null,i=r.video_fps_numerator&&r.video_fps_denominator?r.video_fps_numerator/r.video_fps_denominator:null,c=ae(a,i),o=$(r.codec_fourcc),l=[{kind:"video",codec:o,width:r.width??void 0,height:r.height??void 0,rate:c??void 0,bit_depth:_(r.codec_fourcc)??_(o)??N(o,r.video_profile)??r.video_bit_depth??void 0,codec_specific:{fourcc:r.codec_fourcc,profile:oe(r,o),pixel_format:ne(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 s of r.audio_tracks??(r.audio?[r.audio]:[]))l.push({kind:"audio",codec:s.codec_fourcc,channels:s.channels??void 0,rate:s.sample_rate??void 0,bit_depth:s.bit_depth??void 0,codec_specific:{fourcc:s.codec_fourcc,channel_layout:s.channel_layout??void 0}});return{id:n.filename,kind:"external",target_url:n.filename,available_range:c&&r.duration_seconds?{start:{value:0,rate:c},duration:{value:Math.round(r.duration_seconds*c),rate:c}}:null,reel_name:null,source_timecode:r.timecode?.display??null,container:e.format==="mov"?"mov":e.format,codec:o,size_bytes:n.fileSize,source_fps:c,source_resolution_w:r.width??null,source_resolution_h:r.height??null,source_pixel_aspect:r.par?r.par[0]/r.par[1]:null,streams:l,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 n=e.parts[0],t=JSON.parse(await E(m(n),n.fileSize,e.format));if(t.length===0)return null;let r=JSON.parse(await p(m(n),n.fileSize,e.format)),a=r?$(r.codec_fourcc):e.format,i=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:a,width:r?.width??void 0,height:r?.height??void 0,fps:i,frame_count:J(t),timecode:r?.timecode?.display??void 0,granularity:T(t),segments:t}},async sparsify(e,n){await d();let t=e.parts[0],r=j(n.items,n.handles),a=await H(m(t),t.fileSize,JSON.stringify(r),e.format),i=JSON.parse(a);return[{filename:t.filename,fileSize:i.fileSize,structuralRanges:i.structuralRanges,essenceRanges:i.essenceRanges,trimInputs:i.trimInputs}]},async trim(e,n){await d();let t=e.parts[0],r=j(n.items,0);if(r.length===0)throw new Error("isobmff trim: no usable trim ranges in items");let a=await L(r,n.handles,(i,c)=>k(m(t),t.fileSize,i,c,e.format));return a.map((i,c)=>{let o=JSON.parse(i);return a.length>1&&(o.output_clip_number=c+1,o.output_clip_count=a.length,o.output_part_number=1),o})},async decode(e,n,t){await d();let r=t.detail==="coarse",a=e.parts[0];if(e.format==="crm"){let s=await R(m(a),a.fileSize,n,r?"preview":"full");return u(s)}let i=await K(e);if(n<0||n>=i.length)throw new b(n,i.length);let c=i[n],o=await a.read(c.offset,c.size);if(e.format==="braw")return u(r?v(o,0):y(o));if(h(o)){let s=await X(e);return u(s?f.decode_prores_raw_tier(o,r?"preview":"full",s):r?P(o,0):x(o))}if(G(o))return u(r?D(o,0):z(o));if(r)return u(S(o,0));let l=await ce(o);return l||u(A(o))},async decode16(e,n){await d();let t=e.parts[0];if(e.format==="crm")throw new Error("crm: no 16-bit decoder");let r=await K(e);if(n<0||n>=r.length)throw new b(n,r.length);let a=r[n],i=await t.read(a.offset,a.size),c=h(i)?await X(e):null,o=e.format==="braw"?w(i):h(i)?c?f.decode_prores_raw_tier(i,"rgb16",c):M(i):G(i)?(()=>{throw new Error("vc3: no 16-bit decoder")})():F(i);return V(o)}};async function ce(e){if(!!0)return null;try{let n=await import("./prores-CFX64NME.js");if(!await n.proresGpuAvailable())return null;let t=await n.decodeProResRgbaGpu(e);return t?{width:t.width,height:t.height,rgba:t.rgba}:null}catch{return null}}function G(e){return e.length>=4&&e[0]===0&&e[1]===0&&e[2]===2&&e[3]===128}function h(e){return e.length>=8&&e[4]===112&&e[5]===114&&e[6]===114&&e[7]===102}function u(e){let n=new DataView(e.buffer,e.byteOffset,8);return{width:n.getUint32(0,!0),height:n.getUint32(4,!0),rgba:e.slice(8)}}var f=C,W=new WeakMap;function X(e){let n=W.get(e);if(!n){let t=e.parts[0];n=f.prores_raw_container_color&&f.decode_prores_raw_tier?U({fileSize:t.fileSize,read:t.read}).then(r=>{let a=f.prores_raw_container_color(r);return a.length?a:null}):Promise.resolve(null),W.set(e,n)}return n}var q=new WeakMap;async function K(e){let n=q.get(e);if(!n){let t=e.parts[0],r=O(await I(m(t),t.fileSize,e.format));if(!r.w||!r.h)throw new Error("could not find a video sample table");n=r.offs,q.set(e,n)}return n}export{he as isobmffFormat,ae as movFrameRate};
@@ -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-VFXMP7IF.js";import"./chunk-BBCQMZQN.js";import{c as w,g as y}from"./chunk-CXOK4SF6.js";import{Ca as l,Ga as p,Ha as h}from"./chunk-LKX3HCRN.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};
3
+ import{c as b}from"./chunk-VFXMP7IF.js";import"./chunk-BBCQMZQN.js";import{c as w,g as y}from"./chunk-5JDF2IUF.js";import{Ca as l,Ga as p,Ha as h}from"./chunk-DCO5D65W.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};
package/dist/mcp.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{b as ma}from"./chunk-SQCGMF6W.js";import{e as ca,i as la,j as ua,k as da,m as fa,n as pa,o as tn}from"./chunk-5WL2ZPPB.js";import"./chunk-M56WEBZY.js";import"./chunk-5YCUHHZO.js";import"./chunk-XAUMTGJZ.js";import"./chunk-X7C4YS2J.js";import"./chunk-2WNNDPVR.js";import"./chunk-YU3SUSK3.js";import"./chunk-QTFFVLVJ.js";import"./chunk-5YULBQJX.js";import{A as S,Ac as Wi,B as Li,Bc as Dt,C as K,Cc as Xi,D as Fi,Dc as Qi,E as en,Ec as Yi,F as Hi,Fc as ea,G as dt,H as Ui,Lc as ta,Mc as ra,Uc as oa,Yc as na,Zc as sa,_c as ia,a as qi,b as Go,bd as aa,c as Ni,d as ji,e as Oi,f as Bo,g as Jo,h as Wo,i as Ot,j as At,k as Ai,l as Di,m as Xo,n as f,o as D,p as W,q as Zi,r as G,s as q,t as v,u as se,v as V,w as Qo,x as Yo,y as F,z as pe}from"./chunk-AY72AUHE.js";import"./chunk-IN6XVTUS.js";import"./chunk-5XJVAA6N.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-P6MSAFNR.js";import{a as zr,b as Ii,c as Ci,d as Mi}from"./chunk-QJPOC4SW.js";import"./chunk-Z42CP7YT.js";import"./chunk-PENDVYIL.js";import"./chunk-2WD3MDPB.js";import"./chunk-OR6IMPAS.js";import"./chunk-JCNKPRYY.js";import"./chunk-OSUIS4JU.js";import"./chunk-JV7TZDKJ.js";import"./chunk-BBCQMZQN.js";import"./chunk-I6WBZBGN.js";import"./chunk-WW6XAQKM.js";import"./chunk-CXOK4SF6.js";import{a as Gi,e as Bi,k as Ji}from"./chunk-ZAL7Y5VZ.js";import"./chunk-VG73BE6N.js";import"./chunk-BUOYYO22.js";import"./chunk-C2ESM27Z.js";import"./chunk-LMRPCWHV.js";import"./chunk-26ZNWQLT.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-LKX3HCRN.js";import"./chunk-3WJSWOCS.js";import"./chunk-2XQ42O7E.js";import"./chunk-M545OKDZ.js";import{e as Vi,f as Ki}from"./chunk-COALWMI7.js";import"./chunk-MU5AGXSH.js";import{c as $,f as Ri}from"./chunk-PSANHDZM.js";var Qt=$(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});A.regexpCode=A.getEsmExportName=A.getProperty=A.safeStringify=A.stringify=A.strConcat=A.addCodeArg=A.str=A._=A.nil=A._Code=A.Name=A.IDENTIFIER=A._CodeOrName=void 0;var Wt=class{};A._CodeOrName=Wt;A.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Ye=class extends Wt{constructor(e){if(super(),!A.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};A.Name=Ye;var ye=class extends Wt{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,o)=>`${r}${o}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,o)=>(o instanceof Ye&&(r[o.str]=(r[o.str]||0)+1),r),{})}};A._Code=ye;A.nil=new ye("");function Oa(t,...e){let r=[t[0]],o=0;for(;o<e.length;)En(r,e[o]),r.push(t[++o]);return new ye(r)}A._=Oa;var xn=new ye("+");function Aa(t,...e){let r=[Xt(t[0])],o=0;for(;o<e.length;)r.push(xn),En(r,e[o]),r.push(xn,Xt(t[++o]));return qf(r),new ye(r)}A.str=Aa;function En(t,e){e instanceof ye?t.push(...e._items):e instanceof Ye?t.push(e):t.push(Of(e))}A.addCodeArg=En;function qf(t){let e=1;for(;e<t.length-1;){if(t[e]===xn){let r=Nf(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function Nf(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Ye||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Ye))return`"${t}${e.slice(1)}`}function jf(t,e){return e.emptyStr()?t:t.emptyStr()?e:Aa`${t}${e}`}A.strConcat=jf;function Of(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Xt(Array.isArray(t)?t.join(","):t)}function Af(t){return new ye(Xt(t))}A.stringify=Af;function Xt(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}A.safeStringify=Xt;function Df(t){return typeof t=="string"&&A.IDENTIFIER.test(t)?new ye(`.${t}`):Oa`[${t}]`}A.getProperty=Df;function Zf(t){if(typeof t=="string"&&A.IDENTIFIER.test(t))return new ye(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}A.getEsmExportName=Zf;function Lf(t){return new ye(t.toString())}A.regexpCode=Lf});var Pn=$(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.ValueScope=le.ValueScopeName=le.Scope=le.varKinds=le.UsedValueState=void 0;var ce=Qt(),kn=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Qr;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Qr||(le.UsedValueState=Qr={}));le.varKinds={const:new ce.Name("const"),let:new ce.Name("let"),var:new ce.Name("var")};var Yr=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof ce.Name?e:this.name(e)}name(e){return new ce.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,o;if(!((o=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||o===void 0)&&o.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};le.Scope=Yr;var eo=class extends ce.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:o}){this.value=e,this.scopePath=(0,ce._)`.${new ce.Name(r)}[${o}]`}};le.ValueScopeName=eo;var Ff=(0,ce._)`\n`,zn=class extends Yr{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?Ff:ce.nil}}get(){return this._scope}name(e){return new eo(e,this._newName(e))}value(e,r){var o;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:s}=n,i=(o=r.key)!==null&&o!==void 0?o:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,n);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,n.setValue(r,{property:s,itemIndex:u}),n}getValue(e,r){let o=this._values[e];if(o)return o.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,o=>{if(o.scopePath===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return(0,ce._)`${e}${o.scopePath}`})}scopeCode(e=this._values,r,o){return this._reduceValues(e,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},r,o)}_reduceValues(e,r,o={},n){let s=ce.nil;for(let i in e){let a=e[i];if(!a)continue;let c=o[i]=o[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,Qr.Started);let l=r(u);if(l){let d=this.opts.es5?le.varKinds.var:le.varKinds.const;s=(0,ce._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=n?.(u))s=(0,ce._)`${s}${l}${this.opts._n}`;else throw new kn(u);c.set(u,Qr.Completed)})}return s}};le.ValueScope=zn});var R=$(I=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0});I.or=I.and=I.not=I.CodeGen=I.operators=I.varKinds=I.ValueScopeName=I.ValueScope=I.Scope=I.Name=I.regexpCode=I.stringify=I.getProperty=I.nil=I.strConcat=I.str=I._=void 0;var M=Qt(),we=Pn(),He=Qt();Object.defineProperty(I,"_",{enumerable:!0,get:function(){return He._}});Object.defineProperty(I,"str",{enumerable:!0,get:function(){return He.str}});Object.defineProperty(I,"strConcat",{enumerable:!0,get:function(){return He.strConcat}});Object.defineProperty(I,"nil",{enumerable:!0,get:function(){return He.nil}});Object.defineProperty(I,"getProperty",{enumerable:!0,get:function(){return He.getProperty}});Object.defineProperty(I,"stringify",{enumerable:!0,get:function(){return He.stringify}});Object.defineProperty(I,"regexpCode",{enumerable:!0,get:function(){return He.regexpCode}});Object.defineProperty(I,"Name",{enumerable:!0,get:function(){return He.Name}});var no=Pn();Object.defineProperty(I,"Scope",{enumerable:!0,get:function(){return no.Scope}});Object.defineProperty(I,"ValueScope",{enumerable:!0,get:function(){return no.ValueScope}});Object.defineProperty(I,"ValueScopeName",{enumerable:!0,get:function(){return no.ValueScopeName}});Object.defineProperty(I,"varKinds",{enumerable:!0,get:function(){return no.varKinds}});I.operators={GT:new M._Code(">"),GTE:new M._Code(">="),LT:new M._Code("<"),LTE:new M._Code("<="),EQ:new M._Code("==="),NEQ:new M._Code("!=="),NOT:new M._Code("!"),OR:new M._Code("||"),AND:new M._Code("&&"),ADD:new M._Code("+")};var Ne=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},Tn=class extends Ne{constructor(e,r,o){super(),this.varKind=e,this.name=r,this.rhs=o}render({es5:e,_n:r}){let o=e?we.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${o} ${this.name}${n};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=vt(this.rhs,e,r)),this}get names(){return this.rhs instanceof M._CodeOrName?this.rhs.names:{}}},to=class extends Ne{constructor(e,r,o){super(),this.lhs=e,this.rhs=r,this.sideEffects=o}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof M.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=vt(this.rhs,e,r),this}get names(){let e=this.lhs instanceof M.Name?{}:{...this.lhs.names};return oo(e,this.rhs)}},Rn=class extends to{constructor(e,r,o,n){super(e,o,n),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},In=class extends Ne{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},Cn=class extends Ne{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Mn=class extends Ne{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},qn=class extends Ne{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=vt(this.code,e,r),this}get names(){return this.code instanceof M._CodeOrName?this.code.names:{}}},Yt=class extends Ne{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,o)=>r+o.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let o=e[r].optimizeNodes();Array.isArray(o)?e.splice(r,1,...o):o?e[r]=o:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:o}=this,n=o.length;for(;n--;){let s=o[n];s.optimizeNames(e,r)||(Hf(e,s.names),o.splice(n,1))}return o.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>rt(e,r.names),{})}},je=class extends Yt{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},Nn=class extends Yt{},$t=class extends je{};$t.kind="else";var et=class t extends je{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let o=r.optimizeNodes();r=this.else=Array.isArray(o)?new $t(o):o}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(Da(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var o;if(this.else=(o=this.else)===null||o===void 0?void 0:o.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=vt(this.condition,e,r),this}get names(){let e=super.names;return oo(e,this.condition),this.else&&rt(e,this.else.names),e}};et.kind="if";var tt=class extends je{};tt.kind="for";var jn=class extends tt{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=vt(this.iteration,e,r),this}get names(){return rt(super.names,this.iteration.names)}},On=class extends tt{constructor(e,r,o,n){super(),this.varKind=e,this.name=r,this.from=o,this.to=n}render(e){let r=e.es5?we.varKinds.var:this.varKind,{name:o,from:n,to:s}=this;return`for(${r} ${o}=${n}; ${o}<${s}; ${o}++)`+super.render(e)}get names(){let e=oo(super.names,this.from);return oo(e,this.to)}},ro=class extends tt{constructor(e,r,o,n){super(),this.loop=e,this.varKind=r,this.name=o,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=vt(this.iterable,e,r),this}get names(){return rt(super.names,this.iterable.names)}},er=class extends je{constructor(e,r,o){super(),this.name=e,this.args=r,this.async=o}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};er.kind="func";var tr=class extends Yt{render(e){return"return "+super.render(e)}};tr.kind="return";var An=class extends je{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var o,n;return super.optimizeNames(e,r),(o=this.catch)===null||o===void 0||o.optimizeNames(e,r),(n=this.finally)===null||n===void 0||n.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&rt(e,this.catch.names),this.finally&&rt(e,this.finally.names),e}},rr=class extends je{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};rr.kind="catch";var or=class extends je{render(e){return"finally"+super.render(e)}};or.kind="finally";var Dn=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
3
+ import{b as ma}from"./chunk-ISG6PEOD.js";import{e as ca,i as la,j as ua,k as da,m as fa,n as pa,o as tn}from"./chunk-ZEVOSOP4.js";import"./chunk-3AR7KSPH.js";import"./chunk-5VQ2IHWO.js";import"./chunk-GN5T5S6K.js";import"./chunk-3LGFQ42R.js";import"./chunk-3KS3547B.js";import"./chunk-YU3SUSK3.js";import"./chunk-QTFFVLVJ.js";import"./chunk-5YULBQJX.js";import{$c as ia,A as S,Ac as Wi,B as Li,Bc as Dt,C as K,Cc as Xi,D as Fi,Dc as Qi,E as en,Ec as Yi,F as Hi,Fc as ea,G as dt,H as Ui,Lc as ta,Mc as ra,Vc as oa,Zc as na,_c as sa,a as qi,b as Go,c as Ni,cd as aa,d as ji,e as Oi,f as Bo,g as Jo,h as Wo,i as Ot,j as At,k as Ai,l as Di,m as Xo,n as f,o as D,p as W,q as Zi,r as G,s as q,t as v,u as se,v as V,w as Qo,x as Yo,y as F,z as pe}from"./chunk-DESBZZGR.js";import"./chunk-IN6XVTUS.js";import"./chunk-BHBBS26Z.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-Q72JSDNU.js";import{a as zr,b as Ii,d as Ci,e as Mi}from"./chunk-6U2DUMIM.js";import"./chunk-XIFURVIB.js";import"./chunk-V6MI7VE3.js";import"./chunk-EZYCCYY7.js";import"./chunk-KDNIWB5V.js";import"./chunk-LBROV5JN.js";import"./chunk-OSUIS4JU.js";import"./chunk-JV7TZDKJ.js";import"./chunk-BBCQMZQN.js";import"./chunk-NQDVV2PX.js";import"./chunk-XX7QQIBI.js";import"./chunk-5JDF2IUF.js";import{a as Gi,e as Bi,k as Ji}from"./chunk-IDADYIY6.js";import"./chunk-IW5M45CL.js";import"./chunk-NHWWMLZW.js";import"./chunk-C2ESM27Z.js";import"./chunk-LMRPCWHV.js";import"./chunk-ZNUIZEPF.js";import"./chunk-N34DQ6MH.js";import"./chunk-NU3X7P4N.js";import"./chunk-DCO5D65W.js";import"./chunk-67VLJJ75.js";import"./chunk-OCNKVM26.js";import"./chunk-HNEKQMQG.js";import{e as Vi,f as Ki}from"./chunk-E75BCWXY.js";import"./chunk-ZPIY5DOU.js";import{c as $,f as Ri}from"./chunk-PSANHDZM.js";var Qt=$(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});A.regexpCode=A.getEsmExportName=A.getProperty=A.safeStringify=A.stringify=A.strConcat=A.addCodeArg=A.str=A._=A.nil=A._Code=A.Name=A.IDENTIFIER=A._CodeOrName=void 0;var Wt=class{};A._CodeOrName=Wt;A.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Ye=class extends Wt{constructor(e){if(super(),!A.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};A.Name=Ye;var ye=class extends Wt{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,o)=>`${r}${o}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,o)=>(o instanceof Ye&&(r[o.str]=(r[o.str]||0)+1),r),{})}};A._Code=ye;A.nil=new ye("");function Oa(t,...e){let r=[t[0]],o=0;for(;o<e.length;)En(r,e[o]),r.push(t[++o]);return new ye(r)}A._=Oa;var xn=new ye("+");function Aa(t,...e){let r=[Xt(t[0])],o=0;for(;o<e.length;)r.push(xn),En(r,e[o]),r.push(xn,Xt(t[++o]));return qf(r),new ye(r)}A.str=Aa;function En(t,e){e instanceof ye?t.push(...e._items):e instanceof Ye?t.push(e):t.push(Of(e))}A.addCodeArg=En;function qf(t){let e=1;for(;e<t.length-1;){if(t[e]===xn){let r=Nf(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function Nf(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Ye||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Ye))return`"${t}${e.slice(1)}`}function jf(t,e){return e.emptyStr()?t:t.emptyStr()?e:Aa`${t}${e}`}A.strConcat=jf;function Of(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Xt(Array.isArray(t)?t.join(","):t)}function Af(t){return new ye(Xt(t))}A.stringify=Af;function Xt(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}A.safeStringify=Xt;function Df(t){return typeof t=="string"&&A.IDENTIFIER.test(t)?new ye(`.${t}`):Oa`[${t}]`}A.getProperty=Df;function Zf(t){if(typeof t=="string"&&A.IDENTIFIER.test(t))return new ye(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}A.getEsmExportName=Zf;function Lf(t){return new ye(t.toString())}A.regexpCode=Lf});var Pn=$(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.ValueScope=le.ValueScopeName=le.Scope=le.varKinds=le.UsedValueState=void 0;var ce=Qt(),kn=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Qr;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Qr||(le.UsedValueState=Qr={}));le.varKinds={const:new ce.Name("const"),let:new ce.Name("let"),var:new ce.Name("var")};var Yr=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof ce.Name?e:this.name(e)}name(e){return new ce.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,o;if(!((o=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||o===void 0)&&o.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};le.Scope=Yr;var eo=class extends ce.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:o}){this.value=e,this.scopePath=(0,ce._)`.${new ce.Name(r)}[${o}]`}};le.ValueScopeName=eo;var Ff=(0,ce._)`\n`,zn=class extends Yr{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?Ff:ce.nil}}get(){return this._scope}name(e){return new eo(e,this._newName(e))}value(e,r){var o;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:s}=n,i=(o=r.key)!==null&&o!==void 0?o:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,n);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,n.setValue(r,{property:s,itemIndex:u}),n}getValue(e,r){let o=this._values[e];if(o)return o.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,o=>{if(o.scopePath===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return(0,ce._)`${e}${o.scopePath}`})}scopeCode(e=this._values,r,o){return this._reduceValues(e,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},r,o)}_reduceValues(e,r,o={},n){let s=ce.nil;for(let i in e){let a=e[i];if(!a)continue;let c=o[i]=o[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,Qr.Started);let l=r(u);if(l){let d=this.opts.es5?le.varKinds.var:le.varKinds.const;s=(0,ce._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=n?.(u))s=(0,ce._)`${s}${l}${this.opts._n}`;else throw new kn(u);c.set(u,Qr.Completed)})}return s}};le.ValueScope=zn});var R=$(I=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0});I.or=I.and=I.not=I.CodeGen=I.operators=I.varKinds=I.ValueScopeName=I.ValueScope=I.Scope=I.Name=I.regexpCode=I.stringify=I.getProperty=I.nil=I.strConcat=I.str=I._=void 0;var M=Qt(),we=Pn(),He=Qt();Object.defineProperty(I,"_",{enumerable:!0,get:function(){return He._}});Object.defineProperty(I,"str",{enumerable:!0,get:function(){return He.str}});Object.defineProperty(I,"strConcat",{enumerable:!0,get:function(){return He.strConcat}});Object.defineProperty(I,"nil",{enumerable:!0,get:function(){return He.nil}});Object.defineProperty(I,"getProperty",{enumerable:!0,get:function(){return He.getProperty}});Object.defineProperty(I,"stringify",{enumerable:!0,get:function(){return He.stringify}});Object.defineProperty(I,"regexpCode",{enumerable:!0,get:function(){return He.regexpCode}});Object.defineProperty(I,"Name",{enumerable:!0,get:function(){return He.Name}});var no=Pn();Object.defineProperty(I,"Scope",{enumerable:!0,get:function(){return no.Scope}});Object.defineProperty(I,"ValueScope",{enumerable:!0,get:function(){return no.ValueScope}});Object.defineProperty(I,"ValueScopeName",{enumerable:!0,get:function(){return no.ValueScopeName}});Object.defineProperty(I,"varKinds",{enumerable:!0,get:function(){return no.varKinds}});I.operators={GT:new M._Code(">"),GTE:new M._Code(">="),LT:new M._Code("<"),LTE:new M._Code("<="),EQ:new M._Code("==="),NEQ:new M._Code("!=="),NOT:new M._Code("!"),OR:new M._Code("||"),AND:new M._Code("&&"),ADD:new M._Code("+")};var Ne=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},Tn=class extends Ne{constructor(e,r,o){super(),this.varKind=e,this.name=r,this.rhs=o}render({es5:e,_n:r}){let o=e?we.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${o} ${this.name}${n};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=vt(this.rhs,e,r)),this}get names(){return this.rhs instanceof M._CodeOrName?this.rhs.names:{}}},to=class extends Ne{constructor(e,r,o){super(),this.lhs=e,this.rhs=r,this.sideEffects=o}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof M.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=vt(this.rhs,e,r),this}get names(){let e=this.lhs instanceof M.Name?{}:{...this.lhs.names};return oo(e,this.rhs)}},Rn=class extends to{constructor(e,r,o,n){super(e,o,n),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},In=class extends Ne{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},Cn=class extends Ne{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Mn=class extends Ne{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},qn=class extends Ne{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=vt(this.code,e,r),this}get names(){return this.code instanceof M._CodeOrName?this.code.names:{}}},Yt=class extends Ne{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,o)=>r+o.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let o=e[r].optimizeNodes();Array.isArray(o)?e.splice(r,1,...o):o?e[r]=o:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:o}=this,n=o.length;for(;n--;){let s=o[n];s.optimizeNames(e,r)||(Hf(e,s.names),o.splice(n,1))}return o.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>rt(e,r.names),{})}},je=class extends Yt{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},Nn=class extends Yt{},$t=class extends je{};$t.kind="else";var et=class t extends je{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let o=r.optimizeNodes();r=this.else=Array.isArray(o)?new $t(o):o}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(Da(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var o;if(this.else=(o=this.else)===null||o===void 0?void 0:o.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=vt(this.condition,e,r),this}get names(){let e=super.names;return oo(e,this.condition),this.else&&rt(e,this.else.names),e}};et.kind="if";var tt=class extends je{};tt.kind="for";var jn=class extends tt{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=vt(this.iteration,e,r),this}get names(){return rt(super.names,this.iteration.names)}},On=class extends tt{constructor(e,r,o,n){super(),this.varKind=e,this.name=r,this.from=o,this.to=n}render(e){let r=e.es5?we.varKinds.var:this.varKind,{name:o,from:n,to:s}=this;return`for(${r} ${o}=${n}; ${o}<${s}; ${o}++)`+super.render(e)}get names(){let e=oo(super.names,this.from);return oo(e,this.to)}},ro=class extends tt{constructor(e,r,o,n){super(),this.loop=e,this.varKind=r,this.name=o,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=vt(this.iterable,e,r),this}get names(){return rt(super.names,this.iterable.names)}},er=class extends je{constructor(e,r,o){super(),this.name=e,this.args=r,this.async=o}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};er.kind="func";var tr=class extends Yt{render(e){return"return "+super.render(e)}};tr.kind="return";var An=class extends je{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var o,n;return super.optimizeNames(e,r),(o=this.catch)===null||o===void 0||o.optimizeNames(e,r),(n=this.finally)===null||n===void 0||n.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&rt(e,this.catch.names),this.finally&&rt(e,this.finally.names),e}},rr=class extends je{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};rr.kind="catch";var or=class extends je{render(e){return"finally"+super.render(e)}};or.kind="finally";var Dn=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
4
4
  `:""},this._extScope=e,this._scope=new we.Scope({parent:e}),this._nodes=[new Nn]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let o=this._extScope.value(e,r);return(this._values[o.prefix]||(this._values[o.prefix]=new Set)).add(o),o}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,o,n){let s=this._scope.toName(r);return o!==void 0&&n&&(this._constants[s.str]=o),this._leafNode(new Tn(e,s,o)),s}const(e,r,o){return this._def(we.varKinds.const,e,r,o)}let(e,r,o){return this._def(we.varKinds.let,e,r,o)}var(e,r,o){return this._def(we.varKinds.var,e,r,o)}assign(e,r,o){return this._leafNode(new to(e,r,o))}add(e,r){return this._leafNode(new Rn(e,I.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==M.nil&&this._leafNode(new qn(e)),this}object(...e){let r=["{"];for(let[o,n]of e)r.length>1&&r.push(","),r.push(o),(o!==n||this.opts.es5)&&(r.push(":"),(0,M.addCodeArg)(r,n));return r.push("}"),new M._Code(r)}if(e,r,o){if(this._blockNode(new et(e)),r&&o)this.code(r).else().code(o).endIf();else if(r)this.code(r).endIf();else if(o)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new et(e))}else(){return this._elseNode(new $t)}endIf(){return this._endBlockNode(et,$t)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new jn(e),r)}forRange(e,r,o,n,s=this.opts.es5?we.varKinds.var:we.varKinds.let){let i=this._scope.toName(e);return this._for(new On(s,i,r,o),()=>n(i))}forOf(e,r,o,n=we.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=r instanceof M.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,M._)`${i}.length`,a=>{this.var(s,(0,M._)`${i}[${a}]`),o(s)})}return this._for(new ro("of",n,s,r),()=>o(s))}forIn(e,r,o,n=this.opts.es5?we.varKinds.var:we.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,M._)`Object.keys(${r})`,o);let s=this._scope.toName(e);return this._for(new ro("in",n,s,r),()=>o(s))}endFor(){return this._endBlockNode(tt)}label(e){return this._leafNode(new In(e))}break(e){return this._leafNode(new Cn(e))}return(e){let r=new tr;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(tr)}try(e,r,o){if(!r&&!o)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new An;if(this._blockNode(n),this.code(e),r){let s=this.name("e");this._currNode=n.catch=new rr(s),r(s)}return o&&(this._currNode=n.finally=new or,this.code(o)),this._endBlockNode(rr,or)}throw(e){return this._leafNode(new Mn(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let o=this._nodes.length-r;if(o<0||e!==void 0&&o!==e)throw new Error(`CodeGen: wrong number of nodes: ${o} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=M.nil,o,n){return this._blockNode(new er(e,r,o)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(er)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let o=this._currNode;if(o instanceof e||r&&o instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof et))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};I.CodeGen=Dn;function rt(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function oo(t,e){return e instanceof M._CodeOrName?rt(t,e.names):t}function vt(t,e,r){if(t instanceof M.Name)return o(t);if(!n(t))return t;return new M._Code(t._items.reduce((s,i)=>(i instanceof M.Name&&(i=o(i)),i instanceof M._Code?s.push(...i._items):s.push(i),s),[]));function o(s){let i=r[s.str];return i===void 0||e[s.str]!==1?s:(delete e[s.str],i)}function n(s){return s instanceof M._Code&&s._items.some(i=>i instanceof M.Name&&e[i.str]===1&&r[i.str]!==void 0)}}function Hf(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function Da(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,M._)`!${Zn(t)}`}I.not=Da;var Uf=Za(I.operators.AND);function Vf(...t){return t.reduce(Uf)}I.and=Vf;var Kf=Za(I.operators.OR);function Gf(...t){return t.reduce(Kf)}I.or=Gf;function Za(t){return(e,r)=>e===M.nil?r:r===M.nil?e:(0,M._)`${Zn(e)} ${t} ${Zn(r)}`}function Zn(t){return t instanceof M.Name?t:(0,M._)`(${t})`}});var N=$(C=>{"use strict";Object.defineProperty(C,"__esModule",{value:!0});C.checkStrictMode=C.getErrorPath=C.Type=C.useFunc=C.setEvaluated=C.evaluatedPropsToName=C.mergeEvaluated=C.eachItem=C.unescapeJsonPointer=C.escapeJsonPointer=C.escapeFragment=C.unescapeFragment=C.schemaRefOrVal=C.schemaHasRulesButRef=C.schemaHasRules=C.checkUnknownRules=C.alwaysValidSchema=C.toHash=void 0;var L=R(),Bf=Qt();function Jf(t){let e={};for(let r of t)e[r]=!0;return e}C.toHash=Jf;function Wf(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(Ha(t,e),!Ua(e,t.self.RULES.all))}C.alwaysValidSchema=Wf;function Ha(t,e=t.schema){let{opts:r,self:o}=t;if(!r.strictSchema||typeof e=="boolean")return;let n=o.RULES.keywords;for(let s in e)n[s]||Ga(t,`unknown keyword: "${s}"`)}C.checkUnknownRules=Ha;function Ua(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}C.schemaHasRules=Ua;function Xf(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}C.schemaHasRulesButRef=Xf;function Qf({topSchemaRef:t,schemaPath:e},r,o,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,L._)`${r}`}return(0,L._)`${t}${e}${(0,L.getProperty)(o)}`}C.schemaRefOrVal=Qf;function Yf(t){return Va(decodeURIComponent(t))}C.unescapeFragment=Yf;function ep(t){return encodeURIComponent(Fn(t))}C.escapeFragment=ep;function Fn(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}C.escapeJsonPointer=Fn;function Va(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}C.unescapeJsonPointer=Va;function tp(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}C.eachItem=tp;function La({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:o}){return(n,s,i,a)=>{let c=i===void 0?s:i instanceof L.Name?(s instanceof L.Name?t(n,s,i):e(n,s,i),i):s instanceof L.Name?(e(n,i,s),s):r(s,i);return a===L.Name&&!(c instanceof L.Name)?o(n,c):c}}C.mergeEvaluated={props:La({mergeNames:(t,e,r)=>t.if((0,L._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,L._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,L._)`${r} || {}`).code((0,L._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,L._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,L._)`${r} || {}`),Hn(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:Ka}),items:La({mergeNames:(t,e,r)=>t.if((0,L._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,L._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,L._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,L._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function Ka(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,L._)`{}`);return e!==void 0&&Hn(t,r,e),r}C.evaluatedPropsToName=Ka;function Hn(t,e,r){Object.keys(r).forEach(o=>t.assign((0,L._)`${e}${(0,L.getProperty)(o)}`,!0))}C.setEvaluated=Hn;var Fa={};function rp(t,e){return t.scopeValue("func",{ref:e,code:Fa[e.code]||(Fa[e.code]=new Bf._Code(e.code))})}C.useFunc=rp;var Ln;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(Ln||(C.Type=Ln={}));function op(t,e,r){if(t instanceof L.Name){let o=e===Ln.Num;return r?o?(0,L._)`"[" + ${t} + "]"`:(0,L._)`"['" + ${t} + "']"`:o?(0,L._)`"/" + ${t}`:(0,L._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,L.getProperty)(t).toString():"/"+Fn(t)}C.getErrorPath=op;function Ga(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}C.checkStrictMode=Ga});var Oe=$(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:!0});var te=R(),np={data:new te.Name("data"),valCxt:new te.Name("valCxt"),instancePath:new te.Name("instancePath"),parentData:new te.Name("parentData"),parentDataProperty:new te.Name("parentDataProperty"),rootData:new te.Name("rootData"),dynamicAnchors:new te.Name("dynamicAnchors"),vErrors:new te.Name("vErrors"),errors:new te.Name("errors"),this:new te.Name("this"),self:new te.Name("self"),scope:new te.Name("scope"),json:new te.Name("json"),jsonPos:new te.Name("jsonPos"),jsonLen:new te.Name("jsonLen"),jsonPart:new te.Name("jsonPart")};Un.default=np});var nr=$(re=>{"use strict";Object.defineProperty(re,"__esModule",{value:!0});re.extendErrors=re.resetErrorsCount=re.reportExtraError=re.reportError=re.keyword$DataError=re.keywordError=void 0;var j=R(),so=N(),ie=Oe();re.keywordError={message:({keyword:t})=>(0,j.str)`must pass "${t}" keyword validation`};re.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,j.str)`"${t}" keyword must be ${e} ($data)`:(0,j.str)`"${t}" keyword is invalid ($data)`};function sp(t,e=re.keywordError,r,o){let{it:n}=t,{gen:s,compositeRule:i,allErrors:a}=n,c=Wa(t,e,r);o??(i||a)?Ba(s,c):Ja(n,(0,j._)`[${c}]`)}re.reportError=sp;function ip(t,e=re.keywordError,r){let{it:o}=t,{gen:n,compositeRule:s,allErrors:i}=o,a=Wa(t,e,r);Ba(n,a),s||i||Ja(o,ie.default.vErrors)}re.reportExtraError=ip;function ap(t,e){t.assign(ie.default.errors,e),t.if((0,j._)`${ie.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,j._)`${ie.default.vErrors}.length`,e),()=>t.assign(ie.default.vErrors,null)))}re.resetErrorsCount=ap;function cp({gen:t,keyword:e,schemaValue:r,data:o,errsCount:n,it:s}){if(n===void 0)throw new Error("ajv implementation error");let i=t.name("err");t.forRange("i",n,ie.default.errors,a=>{t.const(i,(0,j._)`${ie.default.vErrors}[${a}]`),t.if((0,j._)`${i}.instancePath === undefined`,()=>t.assign((0,j._)`${i}.instancePath`,(0,j.strConcat)(ie.default.instancePath,s.errorPath))),t.assign((0,j._)`${i}.schemaPath`,(0,j.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,j._)`${i}.schema`,r),t.assign((0,j._)`${i}.data`,o))})}re.extendErrors=cp;function Ba(t,e){let r=t.const("err",e);t.if((0,j._)`${ie.default.vErrors} === null`,()=>t.assign(ie.default.vErrors,(0,j._)`[${r}]`),(0,j._)`${ie.default.vErrors}.push(${r})`),t.code((0,j._)`${ie.default.errors}++`)}function Ja(t,e){let{gen:r,validateName:o,schemaEnv:n}=t;n.$async?r.throw((0,j._)`new ${t.ValidationError}(${e})`):(r.assign((0,j._)`${o}.errors`,e),r.return(!1))}var ot={keyword:new j.Name("keyword"),schemaPath:new j.Name("schemaPath"),params:new j.Name("params"),propertyName:new j.Name("propertyName"),message:new j.Name("message"),schema:new j.Name("schema"),parentSchema:new j.Name("parentSchema")};function Wa(t,e,r){let{createErrors:o}=t.it;return o===!1?(0,j._)`{}`:lp(t,e,r)}function lp(t,e,r={}){let{gen:o,it:n}=t,s=[up(n,r),dp(t,r)];return fp(t,e,s),o.object(...s)}function up({errorPath:t},{instancePath:e}){let r=e?(0,j.str)`${t}${(0,so.getErrorPath)(e,so.Type.Str)}`:t;return[ie.default.instancePath,(0,j.strConcat)(ie.default.instancePath,r)]}function dp({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:o}){let n=o?e:(0,j.str)`${e}/${t}`;return r&&(n=(0,j.str)`${n}${(0,so.getErrorPath)(r,so.Type.Str)}`),[ot.schemaPath,n]}function fp(t,{params:e,message:r},o){let{keyword:n,data:s,schemaValue:i,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;o.push([ot.keyword,n],[ot.params,typeof e=="function"?e(t):e||(0,j._)`{}`]),c.messages&&o.push([ot.message,typeof r=="function"?r(t):r]),c.verbose&&o.push([ot.schema,i],[ot.parentSchema,(0,j._)`${l}${d}`],[ie.default.data,s]),u&&o.push([ot.propertyName,u])}});var Qa=$(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.boolOrEmptySchema=wt.topBoolOrEmptySchema=void 0;var pp=nr(),mp=R(),hp=Oe(),gp={message:"boolean schema is false"};function yp(t){let{gen:e,schema:r,validateName:o}=t;r===!1?Xa(t,!1):typeof r=="object"&&r.$async===!0?e.return(hp.default.data):(e.assign((0,mp._)`${o}.errors`,null),e.return(!0))}wt.topBoolOrEmptySchema=yp;function _p(t,e){let{gen:r,schema:o}=t;o===!1?(r.var(e,!1),Xa(t)):r.var(e,!0)}wt.boolOrEmptySchema=_p;function Xa(t,e){let{gen:r,data:o}=t,n={gen:r,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,pp.reportError)(n,gp,void 0,e)}});var Vn=$(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.getRules=bt.isJSONType=void 0;var $p=["string","number","integer","boolean","null","object","array"],vp=new Set($p);function wp(t){return typeof t=="string"&&vp.has(t)}bt.isJSONType=wp;function bp(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}bt.getRules=bp});var Kn=$(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.shouldUseRule=Ue.shouldUseGroup=Ue.schemaHasRulesForType=void 0;function Sp({schema:t,self:e},r){let o=e.RULES.types[r];return o&&o!==!0&&Ya(t,o)}Ue.schemaHasRulesForType=Sp;function Ya(t,e){return e.rules.some(r=>ec(t,r))}Ue.shouldUseGroup=Ya;function ec(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(o=>t[o]!==void 0))}Ue.shouldUseRule=ec});var sr=$(oe=>{"use strict";Object.defineProperty(oe,"__esModule",{value:!0});oe.reportTypeError=oe.checkDataTypes=oe.checkDataType=oe.coerceAndCheckDataType=oe.getJSONTypes=oe.getSchemaTypes=oe.DataType=void 0;var xp=Vn(),Ep=Kn(),kp=nr(),T=R(),tc=N(),St;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(St||(oe.DataType=St={}));function zp(t){let e=rc(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}oe.getSchemaTypes=zp;function rc(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(xp.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}oe.getJSONTypes=rc;function Pp(t,e){let{gen:r,data:o,opts:n}=t,s=Tp(e,n.coerceTypes),i=e.length>0&&!(s.length===0&&e.length===1&&(0,Ep.schemaHasRulesForType)(t,e[0]));if(i){let a=Bn(e,o,n.strictNumbers,St.Wrong);r.if(a,()=>{s.length?Rp(t,e,s):Jn(t)})}return i}oe.coerceAndCheckDataType=Pp;var oc=new Set(["string","number","integer","boolean","null"]);function Tp(t,e){return e?t.filter(r=>oc.has(r)||e==="array"&&r==="array"):[]}function Rp(t,e,r){let{gen:o,data:n,opts:s}=t,i=o.let("dataType",(0,T._)`typeof ${n}`),a=o.let("coerced",(0,T._)`undefined`);s.coerceTypes==="array"&&o.if((0,T._)`${i} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>o.assign(n,(0,T._)`${n}[0]`).assign(i,(0,T._)`typeof ${n}`).if(Bn(e,n,s.strictNumbers),()=>o.assign(a,n))),o.if((0,T._)`${a} !== undefined`);for(let u of r)(oc.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);o.else(),Jn(t),o.endIf(),o.if((0,T._)`${a} !== undefined`,()=>{o.assign(n,a),Ip(t,a)});function c(u){switch(u){case"string":o.elseIf((0,T._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,T._)`"" + ${n}`).elseIf((0,T._)`${n} === null`).assign(a,(0,T._)`""`);return;case"number":o.elseIf((0,T._)`${i} == "boolean" || ${n} === null
5
5
  || (${i} == "string" && ${n} && ${n} == +${n})`).assign(a,(0,T._)`+${n}`);return;case"integer":o.elseIf((0,T._)`${i} === "boolean" || ${n} === null
6
6
  || (${i} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(a,(0,T._)`+${n}`);return;case"boolean":o.elseIf((0,T._)`${n} === "false" || ${n} === 0 || ${n} === null`).assign(a,!1).elseIf((0,T._)`${n} === "true" || ${n} === 1`).assign(a,!0);return;case"null":o.elseIf((0,T._)`${n} === "" || ${n} === 0 || ${n} === false`),o.assign(a,null);return;case"array":o.elseIf((0,T._)`${i} === "string" || ${i} === "number"
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{g as a,h as b,i as c,j as d,k as e,l as f,m as g,n as h,o as i,p as j,q as k,r as l,s as m,t as n,u as o,v as p,w as q}from"./chunk-5XJVAA6N.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-BBCQMZQN.js";import"./chunk-I6WBZBGN.js";import"./chunk-WW6XAQKM.js";import"./chunk-CXOK4SF6.js";import"./chunk-NU3X7P4N.js";import"./chunk-LKX3HCRN.js";import"./chunk-COALWMI7.js";import"./chunk-MU5AGXSH.js";import"./chunk-PSANHDZM.js";export{a as MEDIA_EXTS,g as bwfAt,q as coverage,e as decodeFrameRgba,o as factsLine,h as factsText,n as findMedia,p as findText,c as folderClip,i as islandsFor,m as nameMatch,l as normName,d as openSource,f as probeMedia,b as siblingParts,k as trimMedia,j as trimSource};
3
+ import{g as a,h as b,i as c,j as d,k as e,l as f,m as g,n as h,o as i,p as j,q as k,r as l,s as m,t as n,u as o,v as p,w as q}from"./chunk-BHBBS26Z.js";import"./chunk-3PVQ5QP4.js";import"./chunk-VFXMP7IF.js";import"./chunk-BBCQMZQN.js";import"./chunk-NQDVV2PX.js";import"./chunk-XX7QQIBI.js";import"./chunk-5JDF2IUF.js";import"./chunk-NU3X7P4N.js";import"./chunk-DCO5D65W.js";import"./chunk-E75BCWXY.js";import"./chunk-ZPIY5DOU.js";import"./chunk-PSANHDZM.js";export{a as MEDIA_EXTS,g as bwfAt,q as coverage,e as decodeFrameRgba,o as factsLine,h as factsText,n as findMedia,p as findText,c as folderClip,i as islandsFor,m as nameMatch,l as normName,d as openSource,f as probeMedia,b as siblingParts,k as trimMedia,j as trimSource};
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
+ import{a as N}from"./chunk-AACY2V3L.js";import{b as $}from"./chunk-XX7QQIBI.js";import{b as J}from"./chunk-5JDF2IUF.js";import{Ha as l,M,R as P,b as U,ca as D,da as T,e as k,ea as C,fa as E,g as S,ga as L,ia as O,ra as V,ua as W,w as B,wa as G}from"./chunk-DCO5D65W.js";import"./chunk-PSANHDZM.js";var z=new Uint8Array([6,14,43,52,2,5,1,1,13,1,2,1,1,17,1,0]);function oe(t){e:for(let r=t.length-z.length;r>=0;r--){for(let e=0;e<z.length;e++)if(t[r+e]!==z[e])continue e;return r}return-1}function j(t,r){if(r>=t.byteLength)return[null,0];let e=t.getUint8(r);if(e<128)return[e,1];let n=e&127;if(n===0||n>8||r+1+n>t.byteLength)return[null,1];let a=0;for(let i=0;i<n;i++)a=a*256+t.getUint8(r+1+i);return[a,1+n]}function b(t,r){let e=t.getUint32(r,!1),n=t.getUint32(r+4,!1);return e*4294967296+n}async function Z(t){let r=t.fileSize,e=[];if(r<1024)return e;let a=Math.max(0,r-65536),i=r-a,o=await t.read(a,i);e.push({offset:a,length:i});let s=oe(o);if(s<0)return e;let c=new DataView(o.buffer,o.byteOffset,o.byteLength),[f,re]=j(c,s+16);if(f===null||f<16||f>65536)return e;let v=s+16+re;if(v+f>o.length)return e;let F=[],te=new DataView(o.buffer,o.byteOffset+v,f),g=Math.floor((f-4)/12);if(g<1||g>4096)return e;for(let u=0;u<g;u++){let d=b(te,u*12+4);d>=0&&d<r&&F.push(d)}for(let u of F){let d=Math.min(256,r-u),p=await t.read(u,d);if(p.length<80)continue;let _=new DataView(p.buffer,p.byteOffset,p.byteLength),[A,R]=j(_,16);if(A===null)continue;let m=16+R,y,x;if(p.length<m+64){let ie=Math.min(m+64,r-u),h=await t.read(u,ie);if(h.length<m+64)continue;let I=new DataView(h.buffer,h.byteOffset,h.byteLength);y=b(I,m+32),x=b(I,m+40)}else y=b(_,m+32),x=b(_,m+40);let ne=u+16+R+A+y+x,ae=Math.min(ne+65536,r)-u;e.push({offset:u,length:ae})}return e}function H(t,r){let e=[];for(let n of t){if(n.kind!=="clip"||!n.source_range)continue;let a=n.source_range.start.value,i=n.source_range.duration.value,o=Math.max(0,Math.floor(a)-r),s=Math.floor(a+i-1)+r;s>=o&&e.push({first_frame:o,last_frame:s})}return e}function se(t,r){let e=[...t].sort((i,o)=>i.offset-o.offset),n=[],a=0;for(let i of e)i.offset>a&&n.push({offset:a,length:i.offset-a}),a=Math.max(a,i.offset+i.length);return a<r&&n.push({offset:a,length:r-a}),n}async function q(t,r,e){let n=H(r,0);if(n.length===0)throw new Error("planMxfTrimsFromItems: no usable trim ranges in items");await l();let a=(o,s)=>t.read(o,s),i=await $(n,e,(o,s)=>V(a,t.fileSize,o,s));return i.map((o,s)=>{let c=JSON.parse(o);return i.length>1&&(c.output_clip_number=s+1,c.output_clip_count=i.length,c.output_part_number=1),c})}async function K(t,r,e){await l();let n=H(r,e),i=await W((s,c)=>t.read(s,c),t.fileSize,JSON.stringify(n));if(i!=="null")return JSON.parse(i);console.warn(`[mxf] no parseable index \u2014 shipping the WHOLE file (${t.fileSize} bytes). The cut's ${n.length} range(s) cannot be addressed; nothing is trimmed.`);let o=(await Z(t)).map(s=>({offset:s.offset,length:s.length}));return{fileSize:t.fileSize,structuralRanges:o,essenceRanges:se(o,t.fileSize),trimInputs:n,wholeFileFallback:!0}}async function Q(t){await l();let e=await G((n,a)=>t.read(n,a),t.fileSize);return JSON.parse(e)}function w(t){return(r,e)=>t.read(r,e)}var Me={async inspect(t){let r=t.parts[0],e=await Q(r);if(!e)return null;let n=e.timecode??null,a=n&&n.fps_denominator>0?n.fps_numerator/n.fps_denominator:null,i=e.width??null,o=e.height??null,s=e.inner_codec==="mpeg2"||e.inner_codec==="dv"?e.inner_codec:null;return{id:r.filename,kind:"external",target_url:r.filename,available_range:a&&e.frame_count?{start:{value:0,rate:a},duration:{value:e.frame_count,rate:a}}:null,reel_name:e.avid?.tape_name??null,source_timecode:n?.display??null,source_fps:a,source_resolution_w:i,source_resolution_h:o,container:"mxf",codec:s,size_bytes:r.fileSize,streams:[...i||o||a?[{kind:"video",codec:s,width:i??void 0,height:o??void 0,rate:a??void 0,codec_specific:null}]:[],...e.audio?[{kind:"audio",codec:e.audio.codec_fourcc,channels:e.audio.channels??void 0,rate:e.audio.sample_rate??void 0,bit_depth:e.audio.bit_depth??void 0,codec_specific:{fourcc:e.audio.codec_fourcc}}]:[]],decode_provenance:e.decode_provenance??null,vendor_metadata:{frame_count:e.frame_count,...n?{drop_frame:n.drop_frame}:{},...e.inner_codec?{inner_codec:e.inner_codec}:{},...e.truncated?{truncated:!0}:{},...e.avid?{avid:{...e.avid,kind:i||o?"picture":"sound"}}:{}},binding_state:"unbound",raw_extraction:{mxf_probe:e},metadata:{}}},async extract(t){await l();let r=t.parts[0],e=JSON.parse(await O(w(r),r.fileSize));return e.length===0?null:{v:1,container:"mxf",codec:"mxf",frame_count:N(e),granularity:"frame",segments:e}},async sparsify(t,r){let e=t.parts[0],n=await K(e,r.items,r.handles);return[{filename:e.filename,fileSize:n.fileSize,structuralRanges:n.structuralRanges,essenceRanges:n.essenceRanges,trimInputs:n.trimInputs,wholeFileFallback:n.wholeFileFallback}]},async trim(t,r){let e=t.parts[0];return q(e,r.items,r.handles)},async decode(t,r,e){await l();let n=t.parts[0],a=w(n),i=await ee(t),o=e.detail==="coarse",s;if(i==="arriraw")s=await S(a,n.fileSize,r,o?"preview:4":"full");else if(i==="arriraw-alev3")s=await k(a,n.fileSize,r,o?"preview:4":"full");else if(i==="dnxhr")s=await M(a,n.fileSize,r,o?"preview":"full");else if(i==="xocn")s=await P(a,n.fileSize,r,o?"preview":"full");else if(i==="prores")s=await B(a,n.fileSize,r,o?"preview":"full");else throw new Error(`mxf decode: no decoder for inner codec '${i}'`);let c=new DataView(s.buffer,s.byteOffset,8);return{width:c.getUint32(0,!0),height:c.getUint32(4,!0),rgba:s.slice(8)}},async decode16(t,r){await l();let e=t.parts[0],n=w(e),a=await ee(t),i;try{if(a==="arriraw"){let o=await ue(t,r);if(o)return o;i=await S(n,e.fileSize,r,"rgb16")}else if(a==="dnxhr")i=await M(n,e.fileSize,r,"rgb16");else if(a==="xocn")i=await P(n,e.fileSize,r,"rgb16");else throw new Error(`mxf decode16: no decoder for inner codec '${a}'`)}catch(o){throw fe(o,a)}return J(i)}};function fe(t,r){let e=typeof t=="string"?t:t instanceof Error?t.message:"";return/has no 16-bit decoder|no rgb16 tier/.test(e)?new Error(`mxf ${r}: has no 16-bit decoder \u2014 ${e}`):t}var X=new WeakMap;async function ue(t,r){if(!!0)return null;try{let e=await import("./arriraw-PS6V532Y.js");if(!await e.arrirawGpuAvailable())return null;let{parseArrirawGpuPayload:n,arrirawFrameToRgb16:a}=await import("./clip-state-B6JOX3JE.js"),i=t.parts[0],o=X.get(t)??null,s=await U(w(i),i.fileSize,r,o?.key),c=n(s,o);if(!c)return null;X.set(t,{key:c.key,state:c.state});let f=await e.decodeArrirawFrameGpu(c.essence,c.state);return f?{width:f.width,height:f.height,rgb16:a(f)}:null}catch{return null}}var Y=new WeakMap;async function ee(t){let r=Y.get(t);if(r)return r;await l();let e=t.parts[0],n=w(e),a="mxf";return await T(n,e.fileSize)?a="arriraw":await D(n,e.fileSize)?a="arriraw-alev3":await E(n,e.fileSize)?a="dnxhr":await L(n,e.fileSize)?a="xocn":await C(n,e.fileSize)&&(a="prores"),Y.set(t,a),a}export{Me as mxfFormat};
@@ -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,b,c,d,e,f,g,h,i}from"./chunk-CXOK4SF6.js";import"./chunk-PSANHDZM.js";export{c as CoverageMissError,e as DeliveryCoverageMissError,a as INTENTS,f as asDeliveryCoverageMiss,h as extract,i as mediaOp,d as parseDeliveryCoverageMiss,g as resolveFormat,b as unpackFrame16};
3
+ import{a,b,c,d,e,f,g,h,i}from"./chunk-5JDF2IUF.js";import"./chunk-PSANHDZM.js";export{c as CoverageMissError,e as DeliveryCoverageMissError,a as INTENTS,f as asDeliveryCoverageMiss,h as extract,i as mediaOp,d as parseDeliveryCoverageMiss,g as resolveFormat,b as unpackFrame16};
@@ -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{I as b,R as $,b as m,da as o,h as c,k as p,p as f,v as d}from"./chunk-MU5AGXSH.js";import"./chunk-PSANHDZM.js";import{dirname as g}from"node:path";import{fileURLToPath as P}from"node:url";import x from"node:process";var a="ColorMatchProbe.ofx.bundle",R="http://127.0.0.1:9876",u="/Library/OFX/Plugins";async function v(){let r=x.execPath;for(let t of[m("CONFORM_RESOLVE_PROBE"),o(g(r),"..","Resources","resolve-probe",a),o(g(P(import.meta.url)),"..","..","..","resolve_hook","build",a)])if(t&&await d(o(t,"Contents","MacOS","ColorMatchProbe.ofx")))return t;return null}async function k(){let r=c()==="darwin"&&p()==="arm64",t=await d(o(u,a)),n=await fetch(R+"/",{signal:AbortSignal.timeout(500)}).then(i=>i.ok).catch(()=>!1),s=!!await v();return{installed:t,loaded:n,shipped:s,supported:r,next:r?n?"running: the Color page selection and the selected node are read live":t?"installed; restart Resolve to load it":s?"host_setup host=resolve action=install_probe (asks for an administrator), then restart Resolve":"not in this build":"the probe runs on Apple silicon Macs only"}}async function C(){if(c()!=="darwin"||p()!=="arm64")throw new Error("the probe runs on Apple silicon Macs only");let r=await v();if(!r)throw new Error("this build does not carry the probe (resolve_hook/build.sh makes it)");return await O(r,u,a),await b(o(f(),"Library","Application Support","Blackmagic Design","DaVinci Resolve","OFXPluginCacheV2.xml")).catch(()=>{}),{path:o(u,a),restart_required:!0}}var e=r=>`'${r.replace(/'/g,"'\\''")}'`;async function O(r,t,n){let s=o(t,n),l=o(t,`.${n}.staging`),i=o(t,`.${n}.previous`),w=[`mkdir -p ${e(t)}`,`rm -rf ${e(l)} ${e(i)}`,`cp -R ${e(r)} ${e(l)}`,`if [ -e ${e(s)} ]; then mv ${e(s)} ${e(i)}; fi`,`mv ${e(l)} ${e(s)} || { [ -e ${e(i)} ] && mv ${e(i)} ${e(s)}; exit 1; }`,`rm -rf ${e(i)}`].join(" && "),h=await $("osascript",["-e",`do shell script ${JSON.stringify(w)} with administrator privileges`]);if(!h.success)throw new Error(`installing into ${t} needs an administrator, and that was refused or failed: ${h.stderr.trim()}`)}export{a as PROBE_BUNDLE,R as PROBE_URL,C as installProbe,k as probeStatus};
3
+ import{I as b,R as $,b as m,da as o,h as c,k as p,p as f,v as d}from"./chunk-ZPIY5DOU.js";import"./chunk-PSANHDZM.js";import{dirname as g}from"node:path";import{fileURLToPath as P}from"node:url";import x from"node:process";var a="ColorMatchProbe.ofx.bundle",R="http://127.0.0.1:9876",u="/Library/OFX/Plugins";async function v(){let r=x.execPath;for(let t of[m("CONFORM_RESOLVE_PROBE"),o(g(r),"..","Resources","resolve-probe",a),o(g(P(import.meta.url)),"..","..","..","resolve_hook","build",a)])if(t&&await d(o(t,"Contents","MacOS","ColorMatchProbe.ofx")))return t;return null}async function k(){let r=c()==="darwin"&&p()==="arm64",t=await d(o(u,a)),n=await fetch(R+"/",{signal:AbortSignal.timeout(500)}).then(i=>i.ok).catch(()=>!1),s=!!await v();return{installed:t,loaded:n,shipped:s,supported:r,next:r?n?"running: the Color page selection and the selected node are read live":t?"installed; restart Resolve to load it":s?"host_setup host=resolve action=install_probe (asks for an administrator), then restart Resolve":"not in this build":"the probe runs on Apple silicon Macs only"}}async function C(){if(c()!=="darwin"||p()!=="arm64")throw new Error("the probe runs on Apple silicon Macs only");let r=await v();if(!r)throw new Error("this build does not carry the probe (resolve_hook/build.sh makes it)");return await O(r,u,a),await b(o(f(),"Library","Application Support","Blackmagic Design","DaVinci Resolve","OFXPluginCacheV2.xml")).catch(()=>{}),{path:o(u,a),restart_required:!0}}var e=r=>`'${r.replace(/'/g,"'\\''")}'`;async function O(r,t,n){let s=o(t,n),l=o(t,`.${n}.staging`),i=o(t,`.${n}.previous`),w=[`mkdir -p ${e(t)}`,`rm -rf ${e(l)} ${e(i)}`,`cp -R ${e(r)} ${e(l)}`,`if [ -e ${e(s)} ]; then mv ${e(s)} ${e(i)}; fi`,`mv ${e(l)} ${e(s)} || { [ -e ${e(i)} ] && mv ${e(i)} ${e(s)}; exit 1; }`,`rm -rf ${e(i)}`].join(" && "),h=await $("osascript",["-e",`do shell script ${JSON.stringify(w)} with administrator privileges`]);if(!h.success)throw new Error(`installing into ${t} needs an administrator, and that was refused or failed: ${h.stderr.trim()}`)}export{a as PROBE_BUNDLE,R as PROBE_URL,C as installProbe,k as probeStatus};
@@ -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 n1}from"./chunk-7D7H6VFW.js";import{Ha as Z,ya as Q}from"./chunk-LKX3HCRN.js";import"./chunk-PSANHDZM.js";var r1=new Uint32Array([327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,458759,458759,458759,458759,458759,458759,458759,458759,524296,524296,524296,524296,589839,589839,655376,655377,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,458764,458764,458764,458764,458764,458764,458764,458764,458766,458766,458766,458766,458766,458766,458766,458766,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154]),e1=new Uint32Array([393223,393224,327686,327686,262149,262149,262149,262149,196609,196609,196609,196609,196609,196609,196609,196609,262146,262146,262146,262146,262147,262147,262147,262147,196612,196612,196612,196612,196612,196612,196612,196612,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536]),t1=new Uint32Array([131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,196610,196610,196610,196610,196610,196610,196610,196610,196611,196611,196611,196611,196611,196611,196611,196611,196612,196612,196612,196612,196612,196612,196612,196612,262149,262149,262149,262149,262150,262150,262150,262150,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073]),a1=new Uint32Array([0,1,5,6,14,15,27,28,44,45,65,66,90,91,119,120,2,4,7,13,16,26,29,43,46,64,67,89,92,118,121,150,3,8,12,17,25,30,42,47,63,68,88,93,117,122,149,151,9,11,18,24,31,41,48,62,69,87,94,116,123,148,152,177,10,19,23,32,40,49,61,70,86,95,115,124,147,153,176,178,20,22,33,39,50,60,71,85,96,114,125,146,154,175,179,200,21,34,38,51,59,72,84,97,113,126,145,155,174,180,199,201,35,37,52,58,73,83,98,112,127,144,156,173,181,198,202,219,36,53,57,74,82,99,111,128,143,157,172,182,197,203,218,220,54,56,75,81,100,110,129,142,158,171,183,196,204,217,221,234,55,76,80,101,109,130,141,159,170,184,195,205,216,222,233,235,77,79,102,108,131,140,160,169,185,194,206,215,223,232,236,245,78,103,107,132,139,161,168,186,193,207,214,224,231,237,244,246,104,106,133,138,162,167,187,192,208,213,225,230,238,243,247,252,105,134,137,163,166,188,191,209,212,226,229,239,242,248,251,253,135,136,164,165,189,190,210,211,227,228,240,241,249,250,254,255]),j=new Int32Array([2048,2882,2841,2772,2676,2554,2408,2239,2048,1837,1609,1365,1108,841,565,284,2048,2772,2408,1837,1108,284,-565,-1365,-2048,-2554,-2841,-2882,-2676,-2239,-1609,-841,2048,2554,1609,284,-1108,-2239,-2841,-2772,-2048,-841,565,1837,2676,2882,2408,1365,2048,2239,565,-1365,-2676,-2772,-1609,284,2048,2882,2408,841,-1108,-2554,-2841,-1837,2048,1837,-565,-2554,-2676,-841,1609,2882,2048,-284,-2408,-2772,-1108,1365,2841,2239,2048,1365,-1609,-2882,-1108,1837,2841,841,-2048,-2772,-565,2239,2676,284,-2408,-2554,2048,841,-2408,-2239,1108,2882,565,-2554,-2048,1365,2841,284,-2676,-1837,1609,2772,2048,284,-2841,-841,2676,1365,-2408,-1837,2048,2239,-1609,-2554,1108,2772,-565,-2882,2048,-284,-2841,841,2676,-1365,-2408,1837,2048,-2239,-1609,2554,1108,-2772,-565,2882,2048,-841,-2408,2239,1108,-2882,565,2554,-2048,-1365,2841,-284,-2676,1837,1609,-2772,2048,-1365,-1609,2882,-1108,-1837,2841,-841,-2048,2772,-565,-2239,2676,-284,-2408,2554,2048,-1837,-565,2554,-2676,841,1609,-2882,2048,284,-2408,2772,-1108,-1365,2841,-2239,2048,-2239,565,1365,-2676,2772,-1609,-284,2048,-2882,2408,-841,-1108,2554,-2841,1837,2048,-2554,1609,-284,-1108,2239,-2841,2772,-2048,841,565,-1837,2676,-2882,2408,-1365,2048,-2772,2408,-1837,1108,-284,-565,1365,-2048,2554,-2841,2882,-2676,2239,-1609,841,2048,-2882,2841,-2772,2676,-2554,2408,-2239,2048,-1837,1609,-1365,1108,-841,565,-284]),i1={m16:931135616,lg_a:1098061119,lg_b:1125906863,lg_c:1046850094,lg_pa:1008981770,gc_k:1064554302,gc_p:1101529087,gc_t:1028443341,sd_eps:953267991,inv273:997199617,rr_c13:956301440,rr_c16:931135616,rr_c18:914358400,bil_sg:973078528,bil_srb:975874731,sobel_sc:931135616,bil_t7_0:1032826803,bil_t7_1:1040595071,bil_t7_2:1044597305,bil_t7_3:1046301409,bil_t7_4:1044597305,bil_t7_5:1040595071,bil_t7_6:1032826803,bil_t9_0:1031861895,bil_t9_1:1035879338,bil_t9_2:1039871874,bil_t9_3:1041522383,bil_t9_4:1042077871,bil_t9_5:1041522383,bil_t9_6:1039871874,bil_t9_7:1035879338,bil_t9_8:1031861895,gauss55_00:1065353216,gauss55_01:1082130432,gauss55_02:1088421888,gauss55_03:1082130432,gauss55_04:1065353216,gauss55_10:1082130432,gauss55_11:1098907648,gauss55_12:1104150528,gauss55_13:1098907648,gauss55_14:1082130432,gauss55_20:1088421888,gauss55_21:1104150528,gauss55_22:1109655552,gauss55_23:1104150528,gauss55_24:1088421888,gauss55_30:1082130432,gauss55_31:1098907648,gauss55_32:1104150528,gauss55_33:1098907648,gauss55_34:1082130432,gauss55_40:1065353216,gauss55_41:1082130432,gauss55_42:1088421888,gauss55_43:1082130432,gauss55_44:1065353216};function T(n,r){return(n[r]<<24|n[r+1]<<16|n[r+2]<<8|n[r+3])>>>0}function w(n,r){return n[r]<<8|n[r+1]}function z(n){let r=Math.min(n.length,65536),e=-1;for(let u=16;u+6<=r;u+=2){if(w(n,u)!==259)continue;let g=w(n,u+2),p=w(n,u+4);if(g<256||g>8192||p<128||p>8192)continue;let y=u-16;if(T(n,y+4)!==0||T(n,y+8)!==0)continue;let P=T(n,y);if(!(P<65536||y+P>n.length+8192)){e=y;break}}if(e<0)throw new Error("RED codestream container not found");let i=e,t=i+12,a=[];for(let u=0;u<8;u++)a.push(w(n,t+4+2*u));let o=i+28;if(o+512>n.length)throw new Error("R3D container table truncated");let b=a[1],m=a[2],f=i+540,v=v1(n,f,a[4],b);if(b%2!==0)throw new Error(`odd R3D canvas width ${b}`);return{canvasW:b,canvasH:m,rawFields:a,table512:n.subarray(o,o+512),streamOff:f,segments:v}}function v1(n,r,e,i){let t=Math.ceil(i/128),a=r;for(;(w(n,a)&4095)<256;)if(a+=2,a+2>n.length)throw new Error("R3D segment stream truncated");a+=1;let o=a,b=n[a-1],m=[];for(let f=0;f<e;f++){if(o+8>n.length)throw new Error("R3D segment header past essence end");let v=[w(n,o),w(n,o+2),w(n,o+4),w(n,o+6)],u=v.map(h=>h+7>>3),g=o+8,p=u[0]+u[1]+u[2]+u[3];if(g+p>n.length)throw new Error("R3D segment body past essence end");let y=g,P=v.map((h,x)=>{let C={off:y,bitLength:h,byteLength:u[x]};return y+=u[x],C});m.push({x:f%t*128,y:Math.floor(f/t)*16,quant:b,subbands:P}),b=n[g+p]??0,o=g+p+1}return m}function u1(n){let r=new Uint32Array(n.segments.length*4*8),e=0;for(let i of n.segments)for(let t=0;t<4;t++){let a=i.subbands[t];r[e]=a.off,r[e+1]=a.bitLength,r[e+2]=a.byteLength,r[e+3]=i.x,r[e+4]=i.y,r[e+5]=i.quant,r[e+6]=t,r[e+7]=0,e+=8}return r}function k(n){return x1[0]=n>>>0,h1[0]}var s1=new ArrayBuffer(4),x1=new Uint32Array(s1),h1=new Float32Array(s1),w1=1112556626;function B1(n){if(n.length<140)return null;let r=new DataView(n.buffer,n.byteOffset,n.byteLength);if(r.getUint32(0,!0)!==w1||r.getUint32(4,!0)!==1)return null;let e=r.getUint32(8,!0),i=12,t=[];for(let f=0;f<4;f++,i+=4)t.push(r.getUint32(i,!0));let a=[];for(let f=0;f<26;f++,i+=4)a.push(r.getUint32(i,!0));let o=r.getUint32(i,!0);i+=4;let b=r.getUint32(i,!0);if(i+=4,i+b>n.length)return null;let m=new TextDecoder().decode(n.subarray(i,i+b));return{wbBits:t,smatrixBits:a,exposureBits:o,fixFlashers:(e&2)!==0,model:m}}async function E(n){try{return await Z(),B1(Q(n??new Uint8Array(0)))}catch{return null}}var o1=`// R3D KOMODO entropy decode (kernel 1 of 2). One invocation per (segment, subband) job.
3
+ import{a as n1}from"./chunk-7D7H6VFW.js";import{Ha as Z,ya as Q}from"./chunk-DCO5D65W.js";import"./chunk-PSANHDZM.js";var r1=new Uint32Array([327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,458759,458759,458759,458759,458759,458759,458759,458759,524296,524296,524296,524296,589839,589839,655376,655377,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,458764,458764,458764,458764,458764,458764,458764,458764,458766,458766,458766,458766,458766,458766,458766,458766,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154]),e1=new Uint32Array([393223,393224,327686,327686,262149,262149,262149,262149,196609,196609,196609,196609,196609,196609,196609,196609,262146,262146,262146,262146,262147,262147,262147,262147,196612,196612,196612,196612,196612,196612,196612,196612,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536]),t1=new Uint32Array([131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,196610,196610,196610,196610,196610,196610,196610,196610,196611,196611,196611,196611,196611,196611,196611,196611,196612,196612,196612,196612,196612,196612,196612,196612,262149,262149,262149,262149,262150,262150,262150,262150,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073]),a1=new Uint32Array([0,1,5,6,14,15,27,28,44,45,65,66,90,91,119,120,2,4,7,13,16,26,29,43,46,64,67,89,92,118,121,150,3,8,12,17,25,30,42,47,63,68,88,93,117,122,149,151,9,11,18,24,31,41,48,62,69,87,94,116,123,148,152,177,10,19,23,32,40,49,61,70,86,95,115,124,147,153,176,178,20,22,33,39,50,60,71,85,96,114,125,146,154,175,179,200,21,34,38,51,59,72,84,97,113,126,145,155,174,180,199,201,35,37,52,58,73,83,98,112,127,144,156,173,181,198,202,219,36,53,57,74,82,99,111,128,143,157,172,182,197,203,218,220,54,56,75,81,100,110,129,142,158,171,183,196,204,217,221,234,55,76,80,101,109,130,141,159,170,184,195,205,216,222,233,235,77,79,102,108,131,140,160,169,185,194,206,215,223,232,236,245,78,103,107,132,139,161,168,186,193,207,214,224,231,237,244,246,104,106,133,138,162,167,187,192,208,213,225,230,238,243,247,252,105,134,137,163,166,188,191,209,212,226,229,239,242,248,251,253,135,136,164,165,189,190,210,211,227,228,240,241,249,250,254,255]),j=new Int32Array([2048,2882,2841,2772,2676,2554,2408,2239,2048,1837,1609,1365,1108,841,565,284,2048,2772,2408,1837,1108,284,-565,-1365,-2048,-2554,-2841,-2882,-2676,-2239,-1609,-841,2048,2554,1609,284,-1108,-2239,-2841,-2772,-2048,-841,565,1837,2676,2882,2408,1365,2048,2239,565,-1365,-2676,-2772,-1609,284,2048,2882,2408,841,-1108,-2554,-2841,-1837,2048,1837,-565,-2554,-2676,-841,1609,2882,2048,-284,-2408,-2772,-1108,1365,2841,2239,2048,1365,-1609,-2882,-1108,1837,2841,841,-2048,-2772,-565,2239,2676,284,-2408,-2554,2048,841,-2408,-2239,1108,2882,565,-2554,-2048,1365,2841,284,-2676,-1837,1609,2772,2048,284,-2841,-841,2676,1365,-2408,-1837,2048,2239,-1609,-2554,1108,2772,-565,-2882,2048,-284,-2841,841,2676,-1365,-2408,1837,2048,-2239,-1609,2554,1108,-2772,-565,2882,2048,-841,-2408,2239,1108,-2882,565,2554,-2048,-1365,2841,-284,-2676,1837,1609,-2772,2048,-1365,-1609,2882,-1108,-1837,2841,-841,-2048,2772,-565,-2239,2676,-284,-2408,2554,2048,-1837,-565,2554,-2676,841,1609,-2882,2048,284,-2408,2772,-1108,-1365,2841,-2239,2048,-2239,565,1365,-2676,2772,-1609,-284,2048,-2882,2408,-841,-1108,2554,-2841,1837,2048,-2554,1609,-284,-1108,2239,-2841,2772,-2048,841,565,-1837,2676,-2882,2408,-1365,2048,-2772,2408,-1837,1108,-284,-565,1365,-2048,2554,-2841,2882,-2676,2239,-1609,841,2048,-2882,2841,-2772,2676,-2554,2408,-2239,2048,-1837,1609,-1365,1108,-841,565,-284]),i1={m16:931135616,lg_a:1098061119,lg_b:1125906863,lg_c:1046850094,lg_pa:1008981770,gc_k:1064554302,gc_p:1101529087,gc_t:1028443341,sd_eps:953267991,inv273:997199617,rr_c13:956301440,rr_c16:931135616,rr_c18:914358400,bil_sg:973078528,bil_srb:975874731,sobel_sc:931135616,bil_t7_0:1032826803,bil_t7_1:1040595071,bil_t7_2:1044597305,bil_t7_3:1046301409,bil_t7_4:1044597305,bil_t7_5:1040595071,bil_t7_6:1032826803,bil_t9_0:1031861895,bil_t9_1:1035879338,bil_t9_2:1039871874,bil_t9_3:1041522383,bil_t9_4:1042077871,bil_t9_5:1041522383,bil_t9_6:1039871874,bil_t9_7:1035879338,bil_t9_8:1031861895,gauss55_00:1065353216,gauss55_01:1082130432,gauss55_02:1088421888,gauss55_03:1082130432,gauss55_04:1065353216,gauss55_10:1082130432,gauss55_11:1098907648,gauss55_12:1104150528,gauss55_13:1098907648,gauss55_14:1082130432,gauss55_20:1088421888,gauss55_21:1104150528,gauss55_22:1109655552,gauss55_23:1104150528,gauss55_24:1088421888,gauss55_30:1082130432,gauss55_31:1098907648,gauss55_32:1104150528,gauss55_33:1098907648,gauss55_34:1082130432,gauss55_40:1065353216,gauss55_41:1082130432,gauss55_42:1088421888,gauss55_43:1082130432,gauss55_44:1065353216};function T(n,r){return(n[r]<<24|n[r+1]<<16|n[r+2]<<8|n[r+3])>>>0}function w(n,r){return n[r]<<8|n[r+1]}function z(n){let r=Math.min(n.length,65536),e=-1;for(let u=16;u+6<=r;u+=2){if(w(n,u)!==259)continue;let g=w(n,u+2),p=w(n,u+4);if(g<256||g>8192||p<128||p>8192)continue;let y=u-16;if(T(n,y+4)!==0||T(n,y+8)!==0)continue;let P=T(n,y);if(!(P<65536||y+P>n.length+8192)){e=y;break}}if(e<0)throw new Error("RED codestream container not found");let i=e,t=i+12,a=[];for(let u=0;u<8;u++)a.push(w(n,t+4+2*u));let o=i+28;if(o+512>n.length)throw new Error("R3D container table truncated");let b=a[1],m=a[2],f=i+540,v=v1(n,f,a[4],b);if(b%2!==0)throw new Error(`odd R3D canvas width ${b}`);return{canvasW:b,canvasH:m,rawFields:a,table512:n.subarray(o,o+512),streamOff:f,segments:v}}function v1(n,r,e,i){let t=Math.ceil(i/128),a=r;for(;(w(n,a)&4095)<256;)if(a+=2,a+2>n.length)throw new Error("R3D segment stream truncated");a+=1;let o=a,b=n[a-1],m=[];for(let f=0;f<e;f++){if(o+8>n.length)throw new Error("R3D segment header past essence end");let v=[w(n,o),w(n,o+2),w(n,o+4),w(n,o+6)],u=v.map(h=>h+7>>3),g=o+8,p=u[0]+u[1]+u[2]+u[3];if(g+p>n.length)throw new Error("R3D segment body past essence end");let y=g,P=v.map((h,x)=>{let C={off:y,bitLength:h,byteLength:u[x]};return y+=u[x],C});m.push({x:f%t*128,y:Math.floor(f/t)*16,quant:b,subbands:P}),b=n[g+p]??0,o=g+p+1}return m}function u1(n){let r=new Uint32Array(n.segments.length*4*8),e=0;for(let i of n.segments)for(let t=0;t<4;t++){let a=i.subbands[t];r[e]=a.off,r[e+1]=a.bitLength,r[e+2]=a.byteLength,r[e+3]=i.x,r[e+4]=i.y,r[e+5]=i.quant,r[e+6]=t,r[e+7]=0,e+=8}return r}function k(n){return x1[0]=n>>>0,h1[0]}var s1=new ArrayBuffer(4),x1=new Uint32Array(s1),h1=new Float32Array(s1),w1=1112556626;function B1(n){if(n.length<140)return null;let r=new DataView(n.buffer,n.byteOffset,n.byteLength);if(r.getUint32(0,!0)!==w1||r.getUint32(4,!0)!==1)return null;let e=r.getUint32(8,!0),i=12,t=[];for(let f=0;f<4;f++,i+=4)t.push(r.getUint32(i,!0));let a=[];for(let f=0;f<26;f++,i+=4)a.push(r.getUint32(i,!0));let o=r.getUint32(i,!0);i+=4;let b=r.getUint32(i,!0);if(i+=4,i+b>n.length)return null;let m=new TextDecoder().decode(n.subarray(i,i+b));return{wbBits:t,smatrixBits:a,exposureBits:o,fixFlashers:(e&2)!==0,model:m}}async function E(n){try{return await Z(),B1(Q(n??new Uint8Array(0)))}catch{return null}}var o1=`// R3D KOMODO entropy decode (kernel 1 of 2). One invocation per (segment, subband) job.
4
4
  // Faithful port of decode_subband_raw in rust/media-core/src/r3d/entropy.rs.
5
5
  // Writes RAW coefficients (scan order) straight into coeff[job*2048 ..] \u2014 the buffer must be
6
6
  // zero-initialized; only nonzero decoded positions are written (deterministic across reruns).
@@ -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 l}from"./chunk-CXOK4SF6.js";import{Aa as v,Ba as F,H as _,Ha as f,I as S,J as P,ja as b,ka as R,xa as w}from"./chunk-LKX3HCRN.js";import"./chunk-PSANHDZM.js";var g=class{constructor(e=[]){this.ranges=[];for(let[r,n]of e)this.add(r,n)}add(e,r){if(r<=e)return;let n=[],[s,o]=[e,r];for(let[i,a]of this.ranges)a<s||i>o?n.push([i,a]):(s=Math.min(s,i),o=Math.max(o,a));n.push([s,o]),n.sort((i,a)=>i[0]-a[0]),this.ranges=n}has(e,r){return r<=e?!0:this.ranges.some(([n,s])=>n<=e&&s>=r)}missing(e,r){if(r<=e)return[];let n=[],s=e;for(let[o,i]of this.ranges)if(!(i<=s)&&(o>=r||(o>s&&n.push([s,Math.min(o,r)]),s=Math.max(s,i),s>=r)))break;return s<r&&n.push([s,r]),n}count(){return this.ranges.reduce((e,[r,n])=>e+(n-r),0)}toJSON(){return this.ranges.map(([e,r])=>[e,r])}};function N(t,e){let r=new g;for(let n of t){if(n.kind!=="clip"||!n.source_range)continue;let s=n.source_range.start.value,o=n.source_range.duration.value,i=Math.max(0,Math.max(0,Math.floor(s))-e),a=Math.floor(s+o)+e;a>i&&r.add(i,a)}return r.toJSON()}function O(t,e,r){let n=N(e,r),s=a=>n.some(([c,u])=>a>=c&&a<u),o=new Map,i=a=>{let c=o.get(a);return c||(c={part:a,structuralRanges:[],essenceRanges:[]},o.set(a,c)),c};for(let a of t.segments){let c=a.part??0;a.kind==="structural"?i(c).structuralRanges.push({offset:a.offset,length:a.length}):(a.kind==="frame"||a.kind==="gop")&&a.frame_in!=null&&s(a.frame_in)&&i(c).essenceRanges.push({offset:a.offset,length:a.length})}return[...o.values()].sort((a,c)=>a.part-c.part)}async function A(t,e){if(!!0)return null;try{let n=await(await import("./r3d-6P6K47AH.js")).decodeR3dRgbaGpu(t,e);return n?{width:n.width,height:n.height,rgba:n.rgba}:null}catch{return null}}function p(t){return(e,r,n)=>t.parts[e].read(r,n)}function d(t){return JSON.stringify(t.parts.map(e=>({name:e.filename,size:e.fileSize})))}function L(t,e){let r=[];for(let n of t){if(n.kind!=="clip"||!n.source_range)continue;let s=n.source_range.start.value,o=n.source_range.duration.value;r.push({frame_in:Math.max(0,Math.floor(s)),frame_out:Math.floor(s+o),handles:e})}return JSON.stringify(r)}var k=16,h=new WeakMap,J=new WeakMap;function x(t){let e=J.get(t);return e||(e=t.parts[0].read(0,Math.min(16*1024,t.parts[0].fileSize)),J.set(t,e)),e}async function D(t){let e=h.get(t);return e||(await f(),e=JSON.parse(await b(p(t),d(t))),h.set(t,e)),e}async function G(t){await f();let e=await b(p(t),d(t));return h.set(t,JSON.parse(e)),e}function B(t,e){h.set(t,JSON.parse(e))}async function C(t,e){let r=JSON.parse(await R(p(t),d(t)));return{v:1,container:"r3d",codec:"redcode",frame_count:e.frame_count,granularity:"frame",...t.parts.length>1?{part_names:t.parts.map(n=>n.filename.split(/[/\\]/).pop()??n.filename)}:{},segments:r}}var V={async inspect(t){await f();let e=await w(p(t),d(t)),r=JSON.parse(e);if(!r||r.frame_count===0)return null;let n=t.parts[0],s=r.timecode??null,o=s&&s.fps_denominator>0?s.fps_numerator/s.fps_denominator:null,i=r.width??null,a=r.height??null;return{id:n.filename,kind:"external",target_url:n.filename,available_range:o&&r.frame_count?{start:{value:0,rate:o},duration:{value:r.frame_count,rate:o}}:null,reel_name:r.reel??null,source_timecode:s?.display??null,source_fps:o,source_resolution_w:i,source_resolution_h:a,container:"r3d",codec:"redcode",size_bytes:r.file_size,streams:[{kind:"video",codec:"redcode",width:i??void 0,height:a??void 0,rate:o??void 0,bit_depth:k,codec_specific:{fourcc:r.codec_fourcc??"REDCODE"}}],decode_provenance:r.decode_provenance??null,vendor_metadata:{frame_count:r.frame_count,...s?{drop_frame:s.drop_frame}:{}},binding_state:"unbound",raw_extraction:{r3d_probe:r},metadata:{}}},async extract(t){await f();let e=JSON.parse(await w(p(t),d(t)));return!e||e.frame_count===0?null:C(t,e)},async sparsify(t,e){await f();let r=JSON.parse(await R(p(t),d(t))),n={v:1,container:"r3d",codec:"redcode",frame_count:r.filter(o=>o.kind==="frame").length,granularity:"frame",segments:r},s=new Map;for(let o of r)o.kind==="frame"&&s.set(o.part??0,(s.get(o.part??0)??0)+1);return O(n,e.items,e.handles).map(o=>({filename:t.parts[o.part].filename,fileSize:t.parts[o.part].fileSize,structuralRanges:o.structuralRanges,essenceRanges:o.essenceRanges,frameCount:s.get(o.part)??0,keptFrames:o.essenceRanges.length}))},async trim(t,e){await f();let r=t.parts.some(a=>a.dataRanges!==void 0),n=r?JSON.stringify(t.parts.map(a=>a.dataRanges??[])):"[]",s=r?"[]":L(e.items,e.handles),o=await F(p(t),d(t),s,n);return JSON.parse(o).parts.map(a=>a.trim_plan)},async decode(t,e,r){await f();let n=await D(t);if(e<0||e>=n.length)throw new l(e,n.length);let s=n[e],o=s.part??0,i=t.parts[o];if(!i)throw new l(e,n.length);let a=await i.read(s.essenceOffset,s.essenceLength),c=2,u=await x(t),m;if(r.detail==="coarse")m=_(a,u,0);else if(v(a))m=_(a,u,c);else{let y=await A(a,u);if(y)return y;m=P(a,u)}let M=new DataView(m.buffer,m.byteOffset,8);return{width:M.getUint32(0,!0),height:M.getUint32(4,!0),rgba:m.slice(8)}},async decode16(t,e){await f();let r=await D(t);if(e<0||e>=r.length)throw new l(e,r.length);let n=r[e],s=t.parts[n.part??0];if(!s)throw new l(e,r.length);let o=await s.read(n.essenceOffset,n.essenceLength),i=S(o),a=new DataView(i.buffer,i.byteOffset,8),c=a.getUint32(0,!0),u=a.getUint32(4,!0),m=i.slice(8);return{width:c,height:u,rgb16:new Uint16Array(m.buffer,m.byteOffset,c*u*3)}}};export{G as listR3dFramesJson,V as r3dFormat,B as seedR3dFramesJson};
3
+ import{c as l}from"./chunk-5JDF2IUF.js";import{Aa as v,Ba as F,H as _,Ha as f,I as S,J as P,ja as b,ka as R,xa as w}from"./chunk-DCO5D65W.js";import"./chunk-PSANHDZM.js";var g=class{constructor(e=[]){this.ranges=[];for(let[r,n]of e)this.add(r,n)}add(e,r){if(r<=e)return;let n=[],[s,o]=[e,r];for(let[i,a]of this.ranges)a<s||i>o?n.push([i,a]):(s=Math.min(s,i),o=Math.max(o,a));n.push([s,o]),n.sort((i,a)=>i[0]-a[0]),this.ranges=n}has(e,r){return r<=e?!0:this.ranges.some(([n,s])=>n<=e&&s>=r)}missing(e,r){if(r<=e)return[];let n=[],s=e;for(let[o,i]of this.ranges)if(!(i<=s)&&(o>=r||(o>s&&n.push([s,Math.min(o,r)]),s=Math.max(s,i),s>=r)))break;return s<r&&n.push([s,r]),n}count(){return this.ranges.reduce((e,[r,n])=>e+(n-r),0)}toJSON(){return this.ranges.map(([e,r])=>[e,r])}};function N(t,e){let r=new g;for(let n of t){if(n.kind!=="clip"||!n.source_range)continue;let s=n.source_range.start.value,o=n.source_range.duration.value,i=Math.max(0,Math.max(0,Math.floor(s))-e),a=Math.floor(s+o)+e;a>i&&r.add(i,a)}return r.toJSON()}function O(t,e,r){let n=N(e,r),s=a=>n.some(([c,u])=>a>=c&&a<u),o=new Map,i=a=>{let c=o.get(a);return c||(c={part:a,structuralRanges:[],essenceRanges:[]},o.set(a,c)),c};for(let a of t.segments){let c=a.part??0;a.kind==="structural"?i(c).structuralRanges.push({offset:a.offset,length:a.length}):(a.kind==="frame"||a.kind==="gop")&&a.frame_in!=null&&s(a.frame_in)&&i(c).essenceRanges.push({offset:a.offset,length:a.length})}return[...o.values()].sort((a,c)=>a.part-c.part)}async function A(t,e){if(!!0)return null;try{let n=await(await import("./r3d-AWQQHTQC.js")).decodeR3dRgbaGpu(t,e);return n?{width:n.width,height:n.height,rgba:n.rgba}:null}catch{return null}}function p(t){return(e,r,n)=>t.parts[e].read(r,n)}function d(t){return JSON.stringify(t.parts.map(e=>({name:e.filename,size:e.fileSize})))}function L(t,e){let r=[];for(let n of t){if(n.kind!=="clip"||!n.source_range)continue;let s=n.source_range.start.value,o=n.source_range.duration.value;r.push({frame_in:Math.max(0,Math.floor(s)),frame_out:Math.floor(s+o),handles:e})}return JSON.stringify(r)}var k=16,h=new WeakMap,J=new WeakMap;function x(t){let e=J.get(t);return e||(e=t.parts[0].read(0,Math.min(16*1024,t.parts[0].fileSize)),J.set(t,e)),e}async function D(t){let e=h.get(t);return e||(await f(),e=JSON.parse(await b(p(t),d(t))),h.set(t,e)),e}async function G(t){await f();let e=await b(p(t),d(t));return h.set(t,JSON.parse(e)),e}function B(t,e){h.set(t,JSON.parse(e))}async function C(t,e){let r=JSON.parse(await R(p(t),d(t)));return{v:1,container:"r3d",codec:"redcode",frame_count:e.frame_count,granularity:"frame",...t.parts.length>1?{part_names:t.parts.map(n=>n.filename.split(/[/\\]/).pop()??n.filename)}:{},segments:r}}var V={async inspect(t){await f();let e=await w(p(t),d(t)),r=JSON.parse(e);if(!r||r.frame_count===0)return null;let n=t.parts[0],s=r.timecode??null,o=s&&s.fps_denominator>0?s.fps_numerator/s.fps_denominator:null,i=r.width??null,a=r.height??null;return{id:n.filename,kind:"external",target_url:n.filename,available_range:o&&r.frame_count?{start:{value:0,rate:o},duration:{value:r.frame_count,rate:o}}:null,reel_name:r.reel??null,source_timecode:s?.display??null,source_fps:o,source_resolution_w:i,source_resolution_h:a,container:"r3d",codec:"redcode",size_bytes:r.file_size,streams:[{kind:"video",codec:"redcode",width:i??void 0,height:a??void 0,rate:o??void 0,bit_depth:k,codec_specific:{fourcc:r.codec_fourcc??"REDCODE"}}],decode_provenance:r.decode_provenance??null,vendor_metadata:{frame_count:r.frame_count,...s?{drop_frame:s.drop_frame}:{}},binding_state:"unbound",raw_extraction:{r3d_probe:r},metadata:{}}},async extract(t){await f();let e=JSON.parse(await w(p(t),d(t)));return!e||e.frame_count===0?null:C(t,e)},async sparsify(t,e){await f();let r=JSON.parse(await R(p(t),d(t))),n={v:1,container:"r3d",codec:"redcode",frame_count:r.filter(o=>o.kind==="frame").length,granularity:"frame",segments:r},s=new Map;for(let o of r)o.kind==="frame"&&s.set(o.part??0,(s.get(o.part??0)??0)+1);return O(n,e.items,e.handles).map(o=>({filename:t.parts[o.part].filename,fileSize:t.parts[o.part].fileSize,structuralRanges:o.structuralRanges,essenceRanges:o.essenceRanges,frameCount:s.get(o.part)??0,keptFrames:o.essenceRanges.length}))},async trim(t,e){await f();let r=t.parts.some(a=>a.dataRanges!==void 0),n=r?JSON.stringify(t.parts.map(a=>a.dataRanges??[])):"[]",s=r?"[]":L(e.items,e.handles),o=await F(p(t),d(t),s,n);return JSON.parse(o).parts.map(a=>a.trim_plan)},async decode(t,e,r){await f();let n=await D(t);if(e<0||e>=n.length)throw new l(e,n.length);let s=n[e],o=s.part??0,i=t.parts[o];if(!i)throw new l(e,n.length);let a=await i.read(s.essenceOffset,s.essenceLength),c=2,u=await x(t),m;if(r.detail==="coarse")m=_(a,u,0);else if(v(a))m=_(a,u,c);else{let y=await A(a,u);if(y)return y;m=P(a,u)}let M=new DataView(m.buffer,m.byteOffset,8);return{width:M.getUint32(0,!0),height:M.getUint32(4,!0),rgba:m.slice(8)}},async decode16(t,e){await f();let r=await D(t);if(e<0||e>=r.length)throw new l(e,r.length);let n=r[e],s=t.parts[n.part??0];if(!s)throw new l(e,r.length);let o=await s.read(n.essenceOffset,n.essenceLength),i=S(o),a=new DataView(i.buffer,i.byteOffset,8),c=a.getUint32(0,!0),u=a.getUint32(4,!0),m=i.slice(8);return{width:c,height:u,rgb16:new Uint16Array(m.buffer,m.byteOffset,c*u*3)}}};export{G as listR3dFramesJson,V as r3dFormat,B as seedR3dFramesJson};
@@ -452,25 +452,208 @@ def pool_ids(folder):
452
452
  return ids
453
453
 
454
454
 
455
- def _append_piece(mp, t, clip, pc, track, t0):
455
+ def _append_piece(mp, t, clip, pc, track, t0, media_type=1, rescale=True):
456
456
  """One piece (pc: src_in / src_out source frames, start / end record frames from the head) of `clip` onto `track`
457
457
  of the CURRENT timeline. AppendToTimeline takes endFrame EXCLUSIVE and lands within a frame or two on a source at
458
- another rate (0.9.5, measured 2026-09-08): read back, and when the length is off re-appended with the window
459
- scaled (3 tries). Returns (item or None, exact)."""
458
+ another rate (0.9.5, measured 2026-09-08; EXCLUSIVE re-measured live on Resolve 21 2026-11-11: src 0-3 laid 3 frames,
459
+ source read back 0-2): read back, and when the length is off re-appended with the window's END
460
+ scaled (3 tries; src_in is never moved). rescale=False appends once, as asked, for a caller that reads back what
461
+ Resolve laid instead (timeline_new's cross-rate pieces). media_type 1 = video, 2 = audio, None = both (linked; the
462
+ first item is read back, all are taken out on a retry). Returns (item or None, exact)."""
460
463
  want = int(pc["end"]) - int(pc["start"])
461
464
  src = max(1, int(pc["src_out"]) - int(pc["src_in"]))
462
465
  got, item = None, None
463
466
  for attempt in range(3):
464
- res = mp.AppendToTimeline([{"mediaPoolItem": clip, "startFrame": int(pc["src_in"]), "endFrame": int(pc["src_in"]) + src,
465
- "recordFrame": t0 + int(pc["start"]), "trackIndex": track, "mediaType": 1}]) or []
467
+ info = {"mediaPoolItem": clip, "startFrame": int(pc["src_in"]), "endFrame": int(pc["src_in"]) + src,
468
+ "recordFrame": t0 + int(pc["start"]), "trackIndex": track}
469
+ if media_type is not None:
470
+ info["mediaType"] = media_type
471
+ res = mp.AppendToTimeline([info]) or []
466
472
  item = res[0] if res else None
467
473
  got = int(item.GetEnd()) - int(item.GetStart()) if item else None
468
- if got is None or got == want or got <= 0 or attempt == 2 or not t.DeleteClips([item]):
474
+ if not rescale or got is None or got == want or got <= 0 or attempt == 2 or not t.DeleteClips(list(res)):
469
475
  break
470
476
  src = max(1, int(round(src * want / got)))
471
477
  return item, item is not None and got == want and int(item.GetStart()) == t0 + int(pc["start"])
472
478
 
473
479
 
480
+ MEDIA_TYPE = {"video": 1, "audio": 2, "both": None}
481
+
482
+
483
+ def _fps(v):
484
+ """A frame rate exactly as Resolve gave it as text ("23.976", "25.000"): a Fraction, None when it gave none."""
485
+ from fractions import Fraction
486
+ try:
487
+ f = Fraction(str(v).strip())
488
+ return f if f > 0 else None
489
+ except (TypeError, ValueError, ZeroDivisionError):
490
+ return None
491
+
492
+
493
+ def _src_frame(item, fn):
494
+ """An item's source frame as Resolve reads it back, None when this Resolve has no such call."""
495
+ try:
496
+ return int(getattr(item, fn)()) if has(item, fn) else None
497
+ except Exception:
498
+ return None
499
+
500
+
501
+ def _timeline_new(p, op):
502
+ """A NATIVE Resolve timeline (MediaPool.CreateEmptyTimeline), never an imported file: `name` (made unique), in the
503
+ pool `folder` (default the conform.tools one; made if missing). Settings before any clip, because Resolve takes a
504
+ timeline's own frame rate only while it is EMPTY and only with useCustomSettings on: `settings_from` (a timeline
505
+ whose settings it carries, inherit_settings) and/or `fps`, `width`, `height` (custom settings switched on first),
506
+ each read back; one Resolve did not keep deletes the timeline and refuses, naming it. Then `pieces` [{clip: pool
507
+ unique id | path (imported into the folder when not in the pool), src_in?, src_out? (source frames from the clip's
508
+ first, default the whole clip), start (record frame from the timeline head; default right after the track's last),
509
+ track? (1), kind? video|audio|both}] laid with _append_piece and read back; the pieces that did not land exact are
510
+ listed (off), and `landed` gives each piece's read-back record and source frames and, for audio, the audio tracks
511
+ Resolve laid it on. Each piece is laid once as asked; a video piece from a clip at another rate is held to Resolve's
512
+ measured real-time length (floor law, below) and its source frames are listed under not_checked. The artist's
513
+ timeline and bin are put back unless `stay`. Undo: the new timeline, then the pool clips this
514
+ imported. No other timeline is touched."""
515
+ mp = p.GetMediaPool()
516
+ prev, prev_folder = p.GetCurrentTimeline(), mp.GetCurrentFolder()
517
+ if op.get("folder"):
518
+ folder, missing = pool_folder(mp, op["folder"], create=True)
519
+ if folder is None:
520
+ return {"ok": False, "undo": [], "detail": "could not make the pool folder %s" % missing}
521
+ else:
522
+ folder = our_folder(mp)
523
+ name = unique_name(p, str(op.get("name") or "Timeline").strip() or "Timeline")
524
+ tl, made, keep = None, [], False
525
+
526
+ def restore():
527
+ if not keep and prev is not None:
528
+ p.SetCurrentTimeline(prev)
529
+ mp.SetCurrentFolder(prev_folder)
530
+
531
+ def refuse(why, **extra):
532
+ if tl is not None:
533
+ mp.DeleteTimelines([tl])
534
+ if made:
535
+ mp.DeleteClips(made)
536
+ restore()
537
+ return dict({"ok": False, "undo": [], "detail": why + "; nothing was made"}, **extra)
538
+
539
+ try:
540
+ mp.SetCurrentFolder(folder)
541
+ tl = mp.CreateEmptyTimeline(name)
542
+ if not tl:
543
+ return refuse("Resolve would not create a timeline named %r" % name)
544
+ uid = tl.GetUniqueId()
545
+ settings = None
546
+ if op.get("settings_from"):
547
+ names = [x.GetName() for x in timelines(p)]
548
+ if op["settings_from"] not in names:
549
+ return refuse("no timeline named %r to take settings from" % op["settings_from"])
550
+ try:
551
+ settings = inherit_settings(p, find_timeline(p, op["settings_from"]), tl)
552
+ except BridgeFail as e:
553
+ return refuse(e.message, failed=e.extra.get("failed", []))
554
+ want = [(k, op[a]) for k, a in (("timelineFrameRate", "fps"), ("timelineResolutionWidth", "width"), ("timelineResolutionHeight", "height")) if op.get(a) not in (None, "")]
555
+ if want:
556
+ # custom first: a timeline following the project refuses its own rate and raster (Resolve's rule)
557
+ tl.SetSetting("useCustomSettings", "1")
558
+ if _set_norm(tl.GetSetting("useCustomSettings")) != "1":
559
+ return refuse("Resolve would not switch the new timeline to custom settings, so it cannot have its own %s" % ", ".join(k for k, _ in want), failed=["useCustomSettings"])
560
+ for k, v in want:
561
+ tl.SetSetting(k, _set_value(v))
562
+ off = [k for k, v in want if _set_norm(tl.GetSetting(k)) != _set_norm(_set_value(v))]
563
+ if off:
564
+ pf = p.GetSetting("timelineFrameRate")
565
+ return refuse("Resolve kept %s (asked %s%s)" % (
566
+ ", ".join("%s %s" % (k, tl.GetSetting(k)) for k in off), ", ".join("%s %s" % (k, v) for k, v in want if k in off),
567
+ "; the project is at %s fps" % pf if pf else ""), failed=off)
568
+ # the pieces' clips: pool ids found anywhere in the pool, files imported once each into the folder
569
+ pieces = list(op.get("pieces") or [])
570
+ pool = pool_by_uid(mp.GetRootFolder(), {str(pc["clip"]) for pc in pieces if pc.get("clip")})
571
+ paths = list(dict.fromkeys(pc["path"] for pc in pieces if pc.get("path") and not pc.get("clip")))
572
+ by_path = {}
573
+ if paths:
574
+ before = pool_ids(mp.GetRootFolder())
575
+ for c in mp.ImportMedia(paths) or []:
576
+ by_path[same_file_key(c.GetClipProperty("File Path") or "")] = c
577
+ if c.GetMediaId() not in before:
578
+ made.append(c)
579
+ p.SetCurrentTimeline(tl) # AppendToTimeline lays clips on the current timeline only
580
+ t0 = int(tl.GetStartFrame())
581
+ ends, placed, off, unchecked, landed = {}, 0, [], [], []
582
+ tfps = _fps(tl.GetSetting("timelineFrameRate"))
583
+ for i, pc in enumerate(pieces):
584
+ label = pc.get("name") or (os.path.basename(pc["path"]) if pc.get("path") else str(pc.get("clip")))
585
+ clip = pool.get(str(pc["clip"])) if pc.get("clip") else by_path.get(same_file_key(pc.get("path") or ""))
586
+ if clip is None:
587
+ off.append({"piece": i, "clip": label, "why": "not in the media pool" if pc.get("clip") else "Resolve did not import it"})
588
+ continue
589
+ kind = pc.get("kind") or "video"
590
+ if kind not in MEDIA_TYPE:
591
+ off.append({"piece": i, "clip": label, "why": "kind is video, audio or both"})
592
+ continue
593
+ track = int(pc.get("track") or 1)
594
+ for k in (("video", "audio") if kind == "both" else (kind,)):
595
+ while int(tl.GetTrackCount(k) or 0) < track:
596
+ if not tl.AddTrack(k):
597
+ break
598
+ src_in = int(pc.get("src_in") or 0)
599
+ src_out = int(pc["src_out"]) if pc.get("src_out") is not None else int(clip.GetClipProperty("Frames") or 0)
600
+ if src_out <= src_in:
601
+ off.append({"piece": i, "clip": label, "why": "no frames between src_in %d and src_out %d" % (src_in, src_out)})
602
+ continue
603
+ key = (kind, track)
604
+ start = int(pc["start"]) if pc.get("start") is not None else ends.get(key, 0)
605
+ # Laid ONCE, exactly as asked (src_in, src_out; endFrame exclusive), never re-windowed. A clip at another rate
606
+ # plays in real time: Resolve lays floor((src_out - src_in) x timeline fps / clip fps) record frames at the
607
+ # asked start (MEASURED live on Resolve 21 AppendToTimeline 2026-11-11, 10 rows of a 23.976 clip on a 25 fps
608
+ # timeline, e.g. 0-24 -> 25, 0-12 -> 12, 60-72 -> 12, 1-2 -> 1; not binary-decoded). Same rate: n frames.
609
+ cfps = _fps(clip.GetClipProperty("FPS"))
610
+ cross = kind != "audio" and cfps is not None and tfps is not None and cfps != tfps
611
+ n = src_out - src_in
612
+ rec = int(n * tfps / cfps) if cross else n # Fractions >= 0: int() is floor
613
+ item, exact = _append_piece(mp, tl, clip, {"src_in": src_in, "src_out": src_out, "start": start, "end": start + rec},
614
+ track, t0, MEDIA_TYPE[kind], rescale=False)
615
+ if item is None:
616
+ off.append({"piece": i, "clip": label, "why": "Resolve refused it at %d" % start})
617
+ continue
618
+ placed += 1
619
+ ends[key] = int(item.GetEnd()) - t0
620
+ got_rec = [int(item.GetStart()) - t0, int(item.GetEnd()) - t0]
621
+ land = {"piece": i, "clip": label, "record": got_rec, "source_asked": [src_in, src_out],
622
+ "source": [_src_frame(item, "GetSourceStartFrame"), _src_frame(item, "GetSourceEndFrame")]}
623
+ if kind != "video":
624
+ # one append, linked or audio only: Resolve lays a clip's audio channels on as many tracks as its audio
625
+ # format has (live 2026-11-11: a stereo cam.mov "both" on A1 AND A2), read back here by clip and start
626
+ land["audio_tracks"] = [n for n in range(1, int(tl.GetTrackCount("audio") or 0) + 1)
627
+ if any(int(x.GetStart()) == int(item.GetStart()) and x.GetMediaPoolItem() is not None
628
+ and x.GetMediaPoolItem().GetUniqueId() == clip.GetUniqueId()
629
+ for x in tl.GetItemListInTrack("audio", n) or [])]
630
+ if cross:
631
+ land["cross_rate"] = {"clip_fps": str(float(cfps)), "timeline_fps": str(float(tfps)), "record_frames": rec}
632
+ # its record frames are checked (the floor law); its source frames are not: Resolve's
633
+ # GetSourceStartFrame/End on a cross-rate item are not in source frames (live 2026-11-11: [86, 95] for 0-12)
634
+ unchecked.append({"piece": i, "clip": label, "why": "%s fps clip on a %s fps timeline: source frames not checked, "
635
+ "Resolve does not read them back in source frames for a clip at another rate" % (float(cfps), float(tfps))})
636
+ if not exact:
637
+ off.append({"piece": i, "clip": label, "why": "landed at %d-%d, asked %d-%d" % (got_rec[0], got_rec[1], start, start + rec)})
638
+ landed.append(land)
639
+ keep = bool(op.get("stay"))
640
+ got = {"fps": tl.GetSetting("timelineFrameRate") or "", "width": tl.GetSetting("timelineResolutionWidth") or "",
641
+ "height": tl.GetSetting("timelineResolutionHeight") or "", "custom": _set_norm(tl.GetSetting("useCustomSettings") or "0") == "1"}
642
+ undo = [{"op": "timeline_discard", "timeline": tl.GetName(), "guid": uid}] + ([{"op": "pool_delete", "clips": [c.GetUniqueId() for c in made]}] if made else [])
643
+ out = {"ok": not off, "name": tl.GetName(), "settings": got, "placed": placed, "pieces": len(pieces),
644
+ "imported": len(made), "off": off, "not_checked": unchecked, "landed": landed, "stayed": keep, "undo": undo,
645
+ **({"inheritance": settings["inheritance"], "notes": settings["notes"]} if settings else {})}
646
+ notes = ["%d of %d piece(s) not exact: %s" % (len(off), len(pieces), "; ".join("#%d %s: %s" % (o["piece"] + 1, o["clip"], o["why"]) for o in off[:10]))] if off else []
647
+ notes += ["not checked: " + "; ".join("#%d %s: %s" % (o["piece"] + 1, o["clip"], o["why"]) for o in unchecked[:10])] if unchecked else []
648
+ if notes:
649
+ out["detail"] = " | ".join(notes)
650
+ restore()
651
+ return out
652
+ except Exception:
653
+ refuse("failed")
654
+ raise
655
+
656
+
474
657
  def pool_by_uid(folder, uids, out=None):
475
658
  """{unique id: media pool item} for the clips named, anywhere under `folder`."""
476
659
  out = {} if out is None else out
@@ -1502,19 +1685,25 @@ def _op(p, t, op, find):
1502
1685
  walk(sub)
1503
1686
  walk(p.GetMediaPool().GetRootFolder())
1504
1687
  return {"ok": not missed, "refreshed": n, "undo": [], **({"detail": "Resolve did not re-read: " + ", ".join(os.path.basename(x) for x in missed)} if missed else {})}
1688
+ if kind == "timeline_new":
1689
+ return _timeline_new(p, op)
1505
1690
  if kind == "timeline_discard":
1506
1691
  # 0.9.5 Reconformer's Discard: a built copy deleted by name — only one whose name ends _RECONFORMED, so this never
1507
1692
  # deletes a real timeline; when it is open, B (its name without the suffix) is opened first. No undo (said).
1693
+ # With `guid` (timeline_new's undo): exactly the timeline that op made, by its unique id, whatever it is called now.
1508
1694
  name = str(op.get("timeline") or "")
1509
1695
  # a second build of the same B is "..._RECONFORMED (2)" (unique_name): a build too
1510
1696
  m = re.match(r"^(.*)_RECONFORMED(?: \(\d+\))?$", name)
1511
- if not m:
1697
+ if op.get("guid"):
1698
+ tl = next((x for x in timelines(p) if x.GetUniqueId() == op["guid"]), None)
1699
+ elif not m:
1512
1700
  return {"ok": False, "undo": [], "detail": "only a ..._RECONFORMED timeline (a Reconform build) can be discarded"}
1513
- tl = find_timeline(p, name) if name in [x.GetName() for x in timelines(p)] else None
1701
+ else:
1702
+ tl = find_timeline(p, name) if name in [x.GetName() for x in timelines(p)] else None
1514
1703
  if tl is None:
1515
1704
  return {"ok": True, "undo": [], "detail": "already gone"}
1516
1705
  cur = p.GetCurrentTimeline()
1517
- if cur is not None and cur.GetUniqueId() == tl.GetUniqueId():
1706
+ if m and cur is not None and cur.GetUniqueId() == tl.GetUniqueId():
1518
1707
  base = m.group(1)
1519
1708
  if base in [x.GetName() for x in timelines(p)]:
1520
1709
  p.SetCurrentTimeline(find_timeline(p, base))
@@ -1582,7 +1771,7 @@ def _op(p, t, op, find):
1582
1771
  t.AddTrack("video")
1583
1772
  k = int(t.GetTrackCount("video"))
1584
1773
  t0 = int(t.GetStartFrame())
1585
- got = mp.AppendToTimeline([{"mediaPoolItem": c, "startFrame": 0, "endFrame": int(c.GetClipProperty("Frames") or 1) - 1,
1774
+ got = mp.AppendToTimeline([{"mediaPoolItem": c, "startFrame": 0, "endFrame": int(c.GetClipProperty("Frames") or 1), # exclusive (live 2026-11-11)
1586
1775
  "trackIndex": k, "recordFrame": t0 + int(f), "mediaType": 1} for c, f in zip(clips, op["at"])]) or []
1587
1776
  placed = len(got)
1588
1777
  undo = [{"op": "track_delete", "kind": "video", "index": k}] + undo
@@ -2479,10 +2668,16 @@ def a_apply(resolve, args):
2479
2668
  return _in_scratch(resolve, args, lambda p: _apply(p, args))
2480
2669
 
2481
2670
 
2671
+ # ops that need no timeline open: a native timeline made in an empty project, and its undo
2672
+ NO_TIMELINE_OPS = ("timeline_new", "timeline_discard", "pool_delete")
2673
+
2674
+
2482
2675
  def _apply(p, args):
2483
- t = find_timeline(p, args.get("timeline"))
2484
- tname = t.GetName() # said at the end even when an op deleted it (Discard)
2485
- index = [_item_index(t)]
2676
+ ops = args.get("ops") or []
2677
+ loose = not args.get("timeline") and p.GetCurrentTimeline() is None and ops and all(o.get("op") in NO_TIMELINE_OPS for o in ops)
2678
+ t = None if loose else find_timeline(p, args.get("timeline"))
2679
+ tname = t.GetName() if t else "" # said at the end even when an op deleted it (Discard)
2680
+ index = [_item_index(t) if t else ({}, {})]
2486
2681
 
2487
2682
  def find(a):
2488
2683
  for fresh in (False, True):
@@ -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,b,c,d,e,f}from"./chunk-2WNNDPVR.js";import"./chunk-COALWMI7.js";import"./chunk-MU5AGXSH.js";import"./chunk-PSANHDZM.js";export{b as APPLIED,a as BACKUP_SUFFIX,e as applyPatch,c as patchFolders,d as planPatch,f as undoPatch};
3
+ import{a,b,c,d,e,f}from"./chunk-3KS3547B.js";import"./chunk-E75BCWXY.js";import"./chunk-ZPIY5DOU.js";import"./chunk-PSANHDZM.js";export{b as APPLIED,a as BACKUP_SUFFIX,e as applyPatch,c as patchFolders,d as planPatch,f as undoPatch};