conformtools 0.6.8 → 0.6.10

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 (103) hide show
  1. package/dist/account-GFIQC77T.js +3 -0
  2. package/dist/analysis-engine-4K5K6L53.js +3 -0
  3. package/dist/{bridge-UIDAF74E.js → bridge-73XMEZLH.js} +1 -1
  4. package/dist/browser/timeline_core_bg.wasm +0 -0
  5. package/dist/chunk-2MJAQROY.js +5 -0
  6. package/dist/{chunk-TXQR2HI2.js → chunk-56EEBHP2.js} +1 -1
  7. package/dist/{chunk-GM6QKY7W.js → chunk-6HZP2OJA.js} +1 -1
  8. package/dist/{chunk-VIBEEWPC.js → chunk-7QUSVHO2.js} +2 -2
  9. package/dist/chunk-CJYLQ3UM.js +5 -0
  10. package/dist/chunk-DFDXSIMI.js +39 -0
  11. package/dist/{chunk-3D3Z4TBR.js → chunk-DGXZB7MO.js} +1 -1
  12. package/dist/{chunk-PLRB2YXJ.js → chunk-DNS4ZYIO.js} +1 -1
  13. package/dist/chunk-DPA26AOI.js +3 -0
  14. package/dist/chunk-E5ENIKNR.js +7 -0
  15. package/dist/{chunk-A7FNR3T5.js → chunk-EEDLRRKU.js} +1 -1
  16. package/dist/{chunk-F74QMWXE.js → chunk-GM262EDM.js} +1 -1
  17. package/dist/{chunk-D4WPRRBT.js → chunk-ISKNIQVO.js} +1 -1
  18. package/dist/chunk-JHTMYXJM.js +20 -0
  19. package/dist/chunk-JKOB3U54.js +3 -0
  20. package/dist/{chunk-2BPR6LK6.js → chunk-JXTRQ3UG.js} +1 -1
  21. package/dist/chunk-NQNS4Y2B.js +3 -0
  22. package/dist/chunk-QHXX5GDD.js +440 -0
  23. package/dist/{chunk-NFJHWZJX.js → chunk-TDIY4NRQ.js} +1 -1
  24. package/dist/chunk-UGVGRL5M.js +3 -0
  25. package/dist/chunk-WJ5EWXP2.js +3 -0
  26. package/dist/chunk-XDI6CPPV.js +3 -0
  27. package/dist/chunk-XJNWAQON.js +7 -0
  28. package/dist/chunk-Y2QHZUGL.js +5 -0
  29. package/dist/{chunk-GK4YYKJ6.js → chunk-YC7QDS5U.js} +2 -2
  30. package/dist/chunk-YUO3UWPH.js +3 -0
  31. package/dist/chunk-ZVUKOFUX.js +6 -0
  32. package/dist/{claude-setup-IIWUB4CE.js → claude-setup-OKOPPDMB.js} +1 -1
  33. package/dist/cli.js +2 -2
  34. package/dist/conformtools-analyze +0 -0
  35. package/dist/conformtools-decode +0 -0
  36. package/dist/{cr3-wasm-HLJWEV2S.js → cr3-wasm-NYCB34ND.js} +1 -1
  37. package/dist/{dng-wasm-CQDLPM5V.js → dng-wasm-XCPPBXPZ.js} +1 -1
  38. package/dist/{dpx-wasm-TLGMM7BO.js → dpx-wasm-XACWNFPB.js} +1 -1
  39. package/dist/engine-274GQLUB.js +5 -0
  40. package/dist/{exr-wasm-2NPKPTVB.js → exr-wasm-FQBUR6QT.js} +1 -1
  41. package/dist/flame/hook/conformtools_flame/verbs.py +9 -9
  42. package/dist/framing-BKTUEUZO.js +3 -0
  43. package/dist/gfx-worker.js +1 -1
  44. package/dist/{h264-JJMZSUWW.js → h264-B2TLLEMI.js} +1 -1
  45. package/dist/{h264-mxf-DCUOGLDU.js → h264-mxf-3GED5PBT.js} +1 -1
  46. package/dist/host-relink-PTV44KXF.js +10 -0
  47. package/dist/hosts-D3TR2QEV.js +3 -0
  48. package/dist/http.js +2 -2
  49. package/dist/{inspect-FJKYPEXL.js → inspect-D3WEYL2W.js} +3 -3
  50. package/dist/{isobmff-VJOWP4MH.js → isobmff-C5A2EFKH.js} +1 -1
  51. package/dist/{mc-video-5MGGOQN4.js → mc-video-ARKIHPA7.js} +1 -1
  52. package/dist/mcp.js +1 -1
  53. package/dist/{media-NZYVREUF.js → media-3YMIZSSF.js} +1 -1
  54. package/dist/media_core-XOKN7UUF.js +9 -0
  55. package/dist/mxf-CQSI6H5T.js +3 -0
  56. package/dist/nuke/panel/python/conformtools_nuke/verbs.py +5 -5
  57. package/dist/{ops-X7NAREC4.js → ops-BCTGDBXT.js} +1 -1
  58. package/dist/peer-kit/ctpeer/__init__.py +1 -1
  59. package/dist/peer-kit/ctpeer/neutral.py +10 -10
  60. package/dist/premiere-uxp/lib/edit.js +94 -9
  61. package/dist/premiere-uxp/lib/markers.js +12 -11
  62. package/dist/premiere-uxp/lib/probe.js +6 -3
  63. package/dist/premiere-uxp/lib/verbs.js +1 -1
  64. package/dist/premiere-uxp/manifest.json +1 -1
  65. package/dist/{probe-F7WQHMIA.js → probe-COWUTQGN.js} +1 -1
  66. package/dist/{r3d-T5O6IIZZ.js → r3d-FX7V4BIE.js} +1 -1
  67. package/dist/{r3d-CXUNG6VS.js → r3d-I6EYEYX7.js} +1 -1
  68. package/dist/resolve-bridge.py +725 -88
  69. package/dist/sequence-patch-JVEZW24V.js +3 -0
  70. package/dist/{still-P4JJNTEO.js → still-WUCFH2WX.js} +1 -1
  71. package/dist/{still-wasm-DN5LPASS.js → still-wasm-RTPOMH7S.js} +1 -1
  72. package/dist/store-SZKXADGI.js +3 -0
  73. package/dist/{tiff-wasm-BPRDR6EB.js → tiff-wasm-N2S267IA.js} +1 -1
  74. package/dist/timeline-PEUC3G7K.js +3 -0
  75. package/dist/timeline_core-ZKQQHUA2.js +3 -0
  76. package/dist/wasm/media_core_bg.wasm +0 -0
  77. package/dist/wasm-threads/media_core_bg.wasm +0 -0
  78. package/dist/{wav-64SC6P7U.js → wav-HSCUCY4U.js} +1 -1
  79. package/package.json +1 -1
  80. package/dist/account-NJSA4N67.js +0 -3
  81. package/dist/chunk-7SENYEIV.js +0 -6
  82. package/dist/chunk-AMRJXYL4.js +0 -3
  83. package/dist/chunk-BW4LRTHG.js +0 -5
  84. package/dist/chunk-H6WZ43NS.js +0 -39
  85. package/dist/chunk-IPFPZBSC.js +0 -5
  86. package/dist/chunk-J2JXLEAI.js +0 -3
  87. package/dist/chunk-JZY2BHQB.js +0 -9
  88. package/dist/chunk-LGUO7PL5.js +0 -20
  89. package/dist/chunk-MS3AWOSG.js +0 -7
  90. package/dist/chunk-PFISREY4.js +0 -3
  91. package/dist/chunk-RJ6JA2LZ.js +0 -3
  92. package/dist/chunk-SGLQY53R.js +0 -3
  93. package/dist/chunk-SYX6W5TS.js +0 -378
  94. package/dist/chunk-WN53ARHJ.js +0 -3
  95. package/dist/engine-P6H5P6HP.js +0 -5
  96. package/dist/framing-7LAOPOED.js +0 -3
  97. package/dist/host-relink-UOS3P5SL.js +0 -10
  98. package/dist/hosts-66KSLCFJ.js +0 -3
  99. package/dist/media_core-YZ3PABEG.js +0 -9
  100. package/dist/mxf-FJSRFLJC.js +0 -3
  101. package/dist/store-EXUE5XX5.js +0 -3
  102. package/dist/timeline-GVVL2CBI.js +0 -3
  103. package/dist/timeline_core-IOENXK4Z.js +0 -3
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{V as ve,c as me}from"./chunk-H6WZ43NS.js";import{b as ke,f as xe}from"./chunk-NU3X7P4N.js";import{b as ce}from"./chunk-JZY2BHQB.js";import{a as ae}from"./chunk-PHAMF4JF.js";function Q(e,n,t,i,s){let r=1-s;return r*r*r*e+3*r*r*s*n+3*r*s*s*t+s*s*s*i}function je(e,n,t){let i=0,s=1;for(let a=0;a<48;a++){let u=(i+s)/2;Q(n[0],n[1],n[2],n[3],u)<e?i=u:s=u}let r=(i+s)/2;return Q(t[0],t[1],t[2],t[3],r)}var le=e=>!!(e.sOutX||e.sOutY||e.sInX||e.sInY);function we(e){return e.some(n=>le(n)||n.interp==="bezier")}var $e=new WeakMap;function He(e,n){let t=$e.get(e);if(t&&t.to===n)return t;let i=e.x,s=e.y,r=n.x,a=n.y,u,f,m,l;le(e)||le(n)?(u=i+(e.sOutX??0),f=s+(e.sOutY??0),m=r+(n.sInX??0),l=a+(n.sInY??0)):(u=i+(r-i)/3,f=s+(a-s)/3,m=r-(r-i)/3,l=a-(a-s)/3);let p=[0],g=i,y=s;for(let h=1;h<=256;h++){let k=h/256,x=Q(i,u,m,r,k),w=Q(s,f,l,a,k);p.push(p[p.length-1]+Math.hypot(x-g,w-y)),g=x,y=w}let v={to:n,arc:p,ctrl:[i,u,m,r,s,f,l,a]};return $e.set(e,v),v}function Se(e,n,t){if(!e.length)return[0,0];let i=e[0],s=e[e.length-1];if(n<=i.time)return[i.x,i.y];if(n>=s.time)return[s.x,s.y];for(let r=0;r<e.length-1;r++){let a=e[r],u=e[r+1];if(!(n>=a.time&&n<u.time))continue;if(a.interp==="hold")return[a.x,a.y];let f=u.time-a.time;if(f<=0)return[u.x,u.y];let m=f/(t||24),{arc:l,ctrl:p}=He(a,u),g=l[l.length-1];if(!(g>1e-12))return[a.x,a.y];let y=m>0?g/m:0,v=a.interp==="bezier"&&a.outSpeed!=null?a.outSpeed:y,h=a.interp==="bezier"&&a.outInfluence!=null?a.outInfluence:1/3,k=u.interp==="bezier"&&u.inSpeed!=null?u.inSpeed:y,x=u.interp==="bezier"&&u.inInfluence!=null?u.inInfluence:1/3,w=1/6,A=(b,M)=>Math.abs(b-M)<1e-9,z=v===0&&A(h,1/3),B=k===0&&A(x,1/3);A(h,w)&&(v=y,h=B?.5:1/3),A(x,w)&&(k=y,x=z?.5:1/3);let j=(n-a.time)/(t||24),S=Math.min(Math.max(je(j,[0,h*m,m-x*m,m],[0,v*h*m,g-k*x*m,g]),0),g),I=1,Z=256;for(;I<Z;){let b=I+Z>>1;l[b]<S?I=b+1:Z=b}let X=l[I-1],c=l[I],_=c>X?(S-X)/(c-X):0,o=(I-1+_)/256;return[Q(p[0],p[1],p[2],p[3],o),Q(p[4],p[5],p[6],p[7],o)]}return[s.x,s.y]}function Me(e,n){if((n==="flip_horizontal"?e.flip_horizontal:e.flip_vertical)===!0)return!0;let i=e.effects;return Array.isArray(i)?i.some(s=>{let r=s;return r?.kind===n&&r.enabled!==!1}):!1}function L(e,n){return typeof e=="number"&&Number.isFinite(e)?e:Array.isArray(e)&&typeof e[n]=="number"?e[n]:null}function Ge(e,n,t,i,s){let r;Array.isArray(e.value)&&Array.isArray(n.value)?r=Math.hypot((L(n.value,0)??0)-(L(e.value,0)??0),(L(n.value,1)??0)-(L(e.value,1)??0)):r=(L(n.value,0)??0)-(L(e.value,0)??0);let a=i/t;if(r===0||!(s>0))return a;let u=k=>{let x=typeof k?.x=="number"?k.x:null,w=typeof k?.y=="number"?k.y:null;if(x===null||w===null)return null;let A=Math.min(Math.max(w,0),1)*t;return{dx:A,dy:x/s/r*A}},f=u(e.tout)??{dx:t/3,dy:t/3/t},m=u(n.tin)??{dx:t/3,dy:t/3/t},l=Math.min(Math.max(f.dx,0),t),p=f.dy,g=t-Math.min(Math.max(m.dx,0),t),y=1-m.dy,v=(k,x,w,A)=>{let z=1-A;return 3*k*A*z*z+3*x*A*A*z+w*A*A*A},h=a;for(let k=0;k<8;k++){let x=v(l,g,t,h)-i,w=1-h,A=3*(l*(w*w-2*h*w)+g*(2*h*w-h*h)+t*h*h);if(Math.abs(A)<1e-9)break;let z=h-x/A;if(!(z>=0&&z<=1))break;if(Math.abs(z-h)<1e-7){h=z;break}h=z}if(Math.abs(v(l,g,t,h)-i)>t*1e-4){let k=0,x=1;for(let w=0;w<40;w++)h=(k+x)/2,v(l,g,t,h)<i?k=h:x=h}return v(p,y,1,h)}function De(e,n,t,i=0,s=0){let a=(e.keyframes??[]).filter(m=>m.parameter_path===n&&typeof m.time?.value=="number").map(m=>({time:m.time.value,value:m.value,interp:m.interp??"linear",tin:m.tangent_in,tout:m.tangent_out,drt:!!m.raw_extraction?.drt_tangent})).sort((m,l)=>m.time-l.time);if(!a.length)return;let u=L(a[0].value,i)??0,f=L(a[a.length-1].value,i)??0;if(t<=a[0].time)return u;if(t>=a[a.length-1].time)return f;for(let m=0;m<a.length-1;m++){let l=a[m],p=a[m+1];if(t>=l.time&&t<=p.time){let g=L(l.value,i)??0,y=L(p.value,i)??0;if(l.interp==="hold")return g;let v=p.time-l.time||1,h=(l.tout||p.tin)&&!l.drt&&!p.drt?Ge(l,p,v,t-l.time,s):(t-l.time)/v;return g+(y-g)*h}}return f}function Ue(e){let n=e.keyframes??[];for(let t of n){if(t.parameter_path==="speed")continue;let i=t.time?.rate;if(typeof i=="number"&&i>0)return i}}function Te(e){let n=e.speed;return typeof n=="number"&&Number.isFinite(n)?Math.abs(n)/100:1}function Qe(e){let n=e,t=n.raw_extraction??void 0,i=f=>{let m=t?.[f];return typeof m=="number"&&Number.isFinite(m)?m:void 0};if(!(n.is_reinterpreted===!0||t?.isReinterpreted===!0))return 1;let r=n.original_fps??i("originalFps"),a=n.interpreted_fps??i("reinterpretedFps");if(r!=null&&a!=null&&r>0&&a>0)return a/r;let u=i("reinterpretationSpeedAdjustment");return u!=null&&u>0?u/100:1}function Ae(e,n){let i=(e.keyframes??[]).filter(a=>a.parameter_path==="speed"&&typeof a.time?.value=="number"&&typeof a.value=="number").map(a=>({x:a.time.value,y:a.value,tan:Array.isArray(a.raw_extraction?.drtNativeTangent)?a.raw_extraction.drtNativeTangent:null})).sort((a,u)=>a.x-u.x);if(i.length<2)return null;let s=(a,u)=>{let f=i[a].tan;if(f&&f.length>=4){if(u==="in"&&f[0])return f[1]/f[0];if(u==="out"&&f[2])return f[3]/f[2]}let m=u==="out"?Math.min(a+1,i.length-1):Math.max(a-1,0),l=Math.min(a,m),p=Math.max(a,m),g=i[p].x-i[l].x;return g>0?(i[p].y-i[l].y)/g:0},r=i.length-1;if(n<=i[0].x)return i[0].y+(n-i[0].x)*s(0,"out");if(n>=i[r].x)return i[r].y+(n-i[r].x)*s(r,"in");for(let a=0;a<r;a++){let u=i[a],f=i[a+1];if(n>f.x)continue;let m=f.x-u.x;if(m<=0)return f.y;let l=(n-u.x)/m,p=l*l,g=p*l,y=s(a,"out"),v=s(a+1,"in");return(2*g-3*p+1)*u.y+(g-2*p+l)*m*y+(-2*g+3*p)*f.y+(g-p)*m*v}return i[r].y}function We(e,n,t){let i=e.timeline_range?.start?.value??0,s=e.timeline_range?.start?.rate||t,r=(n-i)/s,a=e.source_range?.start,u=a&&typeof a.value=="number"&&a.rate?a.value/a.rate:0,f=Ae(e,r);if(f!=null)return(u+f)*t;let m=Te(e);if(e.speed_reverse){let l=e.source_range?.duration,p=l&&typeof l.value=="number"&&l.rate?Math.max(0,l.value-1)/l.rate:0;return(u+p-r*m)*t}return(u+r*m)*t}function Je(e,n){let t=e.timeline_range?.start,i=t?.value??0,s=t?.rate||24,r=e.source_range?.start,a=r?.value??0,u=r?.rate||s,f=Ae(e,(n-i)/s);if(f!=null)return a+f*u;let m=Te(e)*Qe(e),l=(n-i)*(u/s)*m;if(e.speed_reverse){let p=e.source_range?.duration?.value??0;return a+Math.max(0,p-1)-l}return a+l}function qe(e){let n=e.keyframes??[],t=[];for(let i of n){if(i.parameter_path!=="position"||typeof i.time?.value!="number")continue;let s=i.value,r=L(s,0),a=L(s,1);if(r==null||a==null)return null;let u=i.raw_extraction?.tangentPs??void 0,f=(m,l)=>{let p=m?.[l];return typeof p=="number"&&Number.isFinite(p)?p:void 0};t.push({time:i.time.value,x:r,y:a,interp:i.interp??"linear",outSpeed:i.tangent_out?.x??void 0,outInfluence:i.tangent_out?.y??void 0,inSpeed:i.tangent_in?.x??void 0,inInfluence:i.tangent_in?.y??void 0,sOutX:f(u,"spatialOutX"),sOutY:f(u,"spatialOutY"),sInX:f(u,"spatialInX"),sInY:f(u,"spatialInY")})}return t.length<2?null:(t.sort((i,s)=>i.time-s.time),we(t)?t:null)}function ze(e,n){let t=Ue(e)??e.timeline_range?.start?.rate??24,i=We(e,n,t),s=!1,r=(m,l=0)=>{let p=De(e,m,i,l,t);return p!==void 0&&(s=!0),p},a=m=>typeof m=="number"?m:null,u=qe(e);u&&(s=!0);let f=u?Se(u,i,t):null;return{scale:r("scale")??a(e.scale),scaleX:r("scale.x")??a(e.scale_x),scaleY:r("scale.y")??a(e.scale_y),posX:f?f[0]:r("position",0)??r("position.x")??a(e.position_x)??0,posY:f?f[1]:r("position",1)??r("position.y")??a(e.position_y)??0,rotation:r("rotation")??a(e.rotation)??0,anchorX:r("anchor",0)??r("anchor.x")??a(e.anchor_x)??0,anchorY:r("anchor",1)??r("anchor.y")??a(e.anchor_y)??0,opacity:r("opacity")??a(e.opacity),cropL:r("crop.left")??a(e.crop_left)??0,cropR:r("crop.right")??a(e.crop_right)??0,cropT:r("crop.top")??a(e.crop_top)??0,cropB:r("crop.bottom")??a(e.crop_bottom)??0,flipH:Me(e,"flip_horizontal"),flipV:Me(e,"flip_vertical"),animated:s}}function Ie(e,n){return Math.floor(Je(e,n)+1e-9)}var fe={strict:{tolerance_px:1,min_frames:1,gap_frames:0,black_threshold:16},standard:{tolerance_px:2,min_frames:2,gap_frames:1,black_threshold:10},relaxed:{tolerance_px:6,min_frames:4,gap_frames:3,black_threshold:6}},pe="strict",Re={tolerance_px:[0,512],min_frames:[1,600],gap_frames:[0,600],black_threshold:[0,255]};function Fe(e,n={}){let t=(e??pe).trim().toLowerCase(),i=fe[t]??fe[pe],s=fe[t]?t:t==="custom"?"custom":pe,r={...i};for(let a of Object.keys(Re)){let u=n[a];if(u===void 0||!Number.isFinite(Number(u)))continue;let[f,m]=Re[a],l=Math.max(f,Math.min(m,Math.round(Number(u))));l!==r[a]&&(s="custom"),r[a]=l}return{...r,preset:s}}function re(e,n){let t=Number(e),i=Number(n);return!Number.isFinite(t)||!Number.isFinite(i)?!1:t>0&&t>=i}function en(e,n,t){return!(e>0)||!(n>0)||!(t>0)?!1:Math.abs(n/t-e)/e>=.02}function nn(e,n,t,i,s){let r=Math.max(2,Number(s)||0);return Math.abs(e-n)<=r&&Math.abs(t-i)<=r}function rn(e,n,t,i,s,r){return!s||!(s.top>0||s.bottom>0||s.left>0||s.right>0)?!1:Math.abs(e-s.top)<=r&&Math.abs(n-s.bottom)<=r&&Math.abs(t-s.left)<=r&&Math.abs(i-s.right)<=r}var Oe=[["bt","ct"],["bb","cb"],["bl","cl"],["br","cr"]],se=e=>Math.max(0,Math.trunc(Number(e)||0)),ie=e=>Math.max(0,Math.min(1,Number(e)||0));function tn(e,n,t,i,s,r={}){let a=r.tolerance_px??4;i=Math.max(1,Math.trunc(i)),s=Math.max(1,Math.trunc(s));let u=[];for(let f of e??[]){let m=Math.trunc(Number(f.pts)||0),l=se(f.bt),p=se(f.bb),g=se(f.bl),y=se(f.br);if(!re(Math.max(l,p,g,y),a)||rn(l,p,g,y,r.declared_blanking,a))continue;let v=Number(r.expected_aspect_ratio)||0;if(v>0){let x=Math.max(1,i-g-y),w=Math.max(1,s-l-p),A=g<=a&&y<=a,z=l<=a&&p<=a;if((A||z)&&en(v,i,s)&&nn(l,p,g,y,a)&&Math.abs(x/w-v)/v<.02)continue}let h=t+m,k;for(let x of n??[])x.start<=h&&h<x.end&&(!k||x.track>k.track)&&(k=x);k&&u.push({frame_abs:h,bt:l,bb:p,bl:g,br:y,ct:ie(f.ct),cb:ie(f.cb),cl:ie(f.cl),cr:ie(f.cr),source:f.source??"pixels",clip:k})}return u.sort((f,m)=>f.frame_abs-m.frame_abs)}function an(e,n){let t=[];return re(e.bt,n)&&t.push("Top"),re(e.bb,n)&&t.push("Bottom"),re(e.bl,n)&&t.push("Left"),re(e.br,n)&&t.push("Right"),t}function Ce(e,n,t,i,s,r={}){let a=Math.max(1,Math.trunc(r.min_frames??1)),u=Math.max(0,Math.trunc(r.gap_frames??0)),f=r.tolerance_px??4,m=[],l;for(let p of tn(e,n,t,i,s,r)){(!l||l.clip!==p.clip||p.frame_abs-l.end_frame-1>u)&&(l={clip:p.clip,start_frame:p.frame_abs,end_frame:p.frame_abs,frame_count:0,measured:{bt:0,bb:0,bl:0,br:0},coverage:{ct:0,cb:0,cl:0,cr:0},sources:new Set},m.push(l)),l.end_frame=p.frame_abs,l.frame_count++,l.sources.add(p.source);for(let[g,y]of Oe)p[g]>=l.measured[g]&&(l.measured[g]=p[g],l.coverage[y]=p[y])}return m.filter(p=>p.frame_count>=a).map(p=>({...p,duration_frames:p.end_frame-p.start_frame+1,sources:[...p.sources].sort(),zones:an(p.measured,f)}))}function bn(e){let n=new Map;for(let i of e){let s=n.get(i.clip.id);s||(s={clip:i.clip,measured:{bt:0,bb:0,bl:0,br:0},coverage:{ct:0,cb:0,cl:0,cr:0},frames:0,first_frame_abs:i.start_frame,zones:[],sources:[],ranges:[]},n.set(i.clip.id,s)),s.frames+=i.frame_count,s.first_frame_abs=Math.min(s.first_frame_abs,i.start_frame);for(let[r,a]of Oe)i.measured[r]>=s.measured[r]&&(s.measured[r]=i.measured[r],s.coverage[a]=i.coverage[a]);s.sources=[...new Set([...s.sources,...i.sources])].sort(),s.ranges.push(i)}let t=["Top","Bottom","Left","Right"];return[...n.values()].map(i=>{let s=new Set(i.ranges.flatMap(r=>r.zones));return{...i,zones:t.filter(r=>s.has(r)),ranges:i.ranges.sort((r,a)=>r.start_frame-a.start_frame)}}).sort((i,s)=>i.clip.start-s.clip.start)}function _n(e,n=1){let t=Math.max(0,Math.trunc(n)),i=[];for(let s of[...e].sort((r,a)=>r.frame-a.frame)){let r=i.at(-1);if(r&&s.frame-r.end_frame<=t+1){r.end_frame=Math.max(r.end_frame,s.frame),r.frames++,r.darkest=Math.min(r.darkest,s.avg);continue}i.push({start_frame:s.frame,end_frame:s.frame,duration_frames:1,frames:1,darkest:s.avg})}for(let s of i)s.duration_frames=s.end_frame-s.start_frame+1;return i}function ge(e,n){let t=n?e.timelines.find(i=>i.id===n||i.name===n):e.timelines.find(i=>i.kind==="primary")??e.timelines[0];if(!t)throw new Error(n?`no timeline ${n} in this session`:"this session has no timeline");if(!t.resolution_w||!t.resolution_h)throw new Error(`${t.name}: the timeline has no raster (resolution) in the session`);return t}var sn=e=>e.fps_den?e.fps_num/e.fps_den:e.fps_num,W=(e,n)=>ke((e.start_frame??0)+n,sn(e),!!e.is_drop_frame),on=e=>e.split(/[\\/]/).pop()??e,te=e=>e.tracks.filter(n=>n.kind==="Video").sort((n,t)=>n.track_index-t.track_index),K=e=>{let n=e.timeline_range.start.value;return[n,n+e.timeline_range.duration.value]},oe=e=>e.items.filter(n=>n.kind==="clip");function ee(e,n){let t=e.media_references.find(u=>u.id===n.media_reference_id),i=t?.local_path??t?.target_url?.replace(/^file:\/\//,"")??null,s=t?.source_resolution_w??0,r=t?.source_resolution_h??0,a=t?.source_pixel_aspect||1;return{path:i,w:s*a,h:r}}var q=(e,n)=>ze(e,n),be=(e,n)=>Ie(e,n);function Ne(e,n,t,i){if(!(t>0&&i>0))return[e,n];let s=Math.min(e/t,n/i);return[t*s,i*s]}function Le(e,n,t){let i=n-e,s=Math.max(1,Math.min(t,i));return[...new Set(Array.from({length:s},(r,a)=>e+Math.min(i-1,Math.floor((a+.5)*i/s))))]}var un=["fit","fill","crop","stretch"];function Ze(e,n,t){if(t)return t;let i=e.reframe_fit??n.mismatch_policy??"fit";return i==="none"?"crop":un.includes(i)?i:"fit"}function Ve(e,n,t,i,s){if(!(e>0&&n>0)||s==="fit")return[1,1];let r=t/e,a=i/n,u=[r,r],f=[a,a],m=r<=a?u:f,l=s==="crop"?[1,1]:s==="fill"?r>a?u:f:[r,a];return[l[0]/m[0],l[1]/m[1]]}var J=(e,n)=>Math.round(e*10**n)/10**n||0;function _e(e,n,t,i=[1,1]){return{Pan:J(e.position_x*n/i[0],3),Tilt:J(-e.position_y*t/i[1],3),ZoomX:J(e.scale_x/100/i[0],5),ZoomY:J(e.scale_y/100/i[1],5),RotationAngle:J(-e.rotation,3),FlipX:e.flip_h,FlipY:e.flip_v}}var Ke=e=>({scale_x:e.scaleX??e.scale??100,scale_y:e.scaleY??e.scale??100,position_x:e.posX,position_y:e.posY,rotation:e.rotation,flip_h:e.flipH,flip_v:e.flipV}),Ee=e=>(e.scale??100)===100&&(e.scaleX??100)===100&&(e.scaleY??100)===100&&!e.posX&&!e.posY&&!e.rotation&&!e.cropL&&!e.cropR&&!e.cropT&&!e.cropB&&!e.flipH&&!e.flipV,Sn=["edit","input","node"];function Be(e){let n=e.node,t=typeof n=="object"&&n?n:{layer:e.layer??1,node:n};return{...t.node!==void 0&&t.node!==""?{node:t.node}:{},...t.layer&&t.layer!==1?{layer:t.layer}:{}}}var cn={aligned:"Green",animated:"Yellow",no_match:"Red",refused:"Red"};async function mn(e,n){let t=n.offline_reference,i=me(n),s=i,r=Math.max(...n.tracks.flatMap(h=>h.items.map(k=>k.timeline_range.start.value+k.timeline_range.duration.value)),0),a=h=>({kind:"Video",track_index:Math.max(0,...te(n).map(k=>k.track_index))+1,name:"OFFLINE REFERENCE",enabled:!0,items:h});if(t?.session_id){let{getSession:h}=await import("./store-EXUE5XX5.js"),k=(await h(t.session_id)).session,x=k.timelines.find(S=>S.kind==="primary")??k.timelines[0],w=(n.start_frame??0)+(t.frame_offset??0)-(x.start_frame??0),A=te(x).filter(S=>S.enabled!==!1).flatMap(S=>S.items.filter(I=>I.kind==="clip"&&I.enabled!==!1&&I.media_reference_id).map(I=>({i:I,top:S.track_index}))),z=[...new Set(A.flatMap(({i:S})=>[S.timeline_range.start.value,S.timeline_range.start.value+S.timeline_range.duration.value]))].sort((S,I)=>S-I),B=[];for(let S=0;S+1<z.length;S++){let[I,Z]=[z[S],z[S+1]],X=A.filter(({i:R})=>R.timeline_range.start.value<=I&&I<R.timeline_range.start.value+R.timeline_range.duration.value).sort((R,O)=>O.top-R.top)[0],[c,_]=[Math.max(0,I-w),Math.min(r,Z-w)];if(!X||_<=c)continue;let o=X.i,b=B.at(-1);if(b&&b.from===o.id&&b.timeline_range.start.value+b.timeline_range.duration.value===c){b.timeline_range.duration.value+=_-c,b.source_range.duration.value+=_-c;continue}let{id:M,timeline_range:$,source_range:d,media_reference_id:C,keyframes:E,...T}=o;B.push({...T,id:`offline-ref-${B.length}`,from:o.id,kind:"clip",enabled:!0,media_reference_id:`offref:${C}`,timeline_range:{start:{value:c,rate:s},duration:{value:_-c,rate:s}},source_range:{start:{value:d.start.value+(c+w-o.timeline_range.start.value),rate:d.start.rate},duration:{value:_-c,rate:d.start.rate}}})}if(!B.length)throw new ae("not_found",`the offline reference timeline "${x.name}" has no picture over this timeline`);let j=new Set(B.map(S=>String(S.media_reference_id).slice(7)));return{lane:a(B),media:k.media_references.filter(S=>j.has(S.id)).map(S=>({...S,id:`offref:${S.id}`})),name:`timeline ${x.name}`}}let u=t?.media_reference_id?e.media_references.find(h=>h.id===t.media_reference_id):void 0,f=u?.local_path??u?.target_url?.replace(/^file:\/\//,"");if(!u||!f)throw new ae("not_found","this timeline has no offline reference linked in Resolve (Timeline \u203A Link Offline Reference Clip): a movie or another timeline");let{probeMedia:m}=await import("./media-NZYVREUF.js"),l=await m(f),p=l.source_timecode?xe(l.source_timecode,i,null):0,g=l.available_range?.duration?.value??l.declared_duration?.value??null,y=(n.start_frame??0)+(t.frame_offset??0)-p;g!=null&&(y>=g||y+r<=0)&&(y=t.frame_offset??0);let v=g!=null?Math.max(1,Math.min(r,g-y)):r;return{lane:a([{id:"offline-reference",kind:"clip",name:u.name??"offline reference",enabled:!0,media_reference_id:u.id,timeline_range:{start:{value:0,rate:s},duration:{value:v,rate:s}},source_range:{start:{value:y,rate:s},duration:{value:v,rate:s}}}]),media:[],name:u.name??on(f)}}async function Mn(e,n,t,i){if(n.reference_track!=="offline")return await Pe(e,n,t,i);let s=ge(e,n.timeline_id),{lane:r,media:a,name:u}=await mn(e,s);s.tracks.push(r),e.media_references.push(...a);try{return{...await Pe(e,{...n,reference_track:te(s).length,reference_label:"the offline reference"},t,i),reference:`the offline reference (${u})`}}finally{s.tracks.splice(s.tracks.indexOf(r),1),e.media_references=e.media_references.filter(f=>!a.includes(f))}}async function Pe(e,n,t,i){let s=ge(e,n.timeline_id),r=s.resolution_w,a=s.resolution_h,u=te(s),f=u.findIndex(c=>/\b(ref|reference|offline)\b/i.test(String(c.name??""))),m=n.reference_track||(f>=0?f+1:u.length),l=u[m-1];if(!l)throw new Error(`no video track V${m} (the timeline has ${u.length})`);if(n.tracks?.includes(m))throw new ae("invalid_args",`the track to align cannot be the reference track (V${m})`);let p=(n.tracks?.length?n.tracks:u.map((c,_)=>_+1)).filter(c=>c!==m);for(let c of p)if(!u[c-1])throw new Error(`no video track V${c} (the timeline has ${u.length})`);let g=n.input_scaling??"fit",y=n.sizing_target??"edit",v=600,h=(c,_)=>{let o=Math.max(1,_-c);if(n.samples==="ends")return[...new Set([0,.25,.5,.75,1].map($=>c+Math.round($*(Math.max(c,_-1)-c))))];let b=(n.samples??"half")==="half"&&!n.step?Math.max(1,Math.round(me(s)/2)):n.step,M=n.samples==="all"?Math.max(1,Math.ceil(o/v)):b?Math.max(1,Math.floor(b),Math.ceil(o/v)):0;if(M){let $=[];for(let d=c;d<_;d+=M)$.push(d);return $.at(-1)!==_-1&&$.push(_-1),$}return Le(c,_,Math.max(1,Math.min(v,Math.floor(Number(n.samples))||1)))},k=Number(s.start_frame??0),x=[],w=[],A=oe(l),z=n.scope??"all",B=new Set(n.picks??[]);if(z==="selected"&&!B.size)throw new Error("no clips selected: select clips in the timeline, or align the whole timeline");for(let c of p)for(let _ of oe(u[c-1])){let[o,b]=K(_);if(z==="playhead"&&!(o<=(n.at??-1)&&(n.at??-1)<b)||z==="selected"&&!B.has(`${c}:${o}`))continue;let M={item_id:_.id,name:_.name??_.id,track:c,start:o,end:b,record_tc:W(s,o),verdict:"refused",confidence:null,samples:[]};x.push(M);let $=N=>{M.reason=N};if(_.enabled===!1){$("disabled");continue}let d,C=0,E=0;for(let N of A){let[Y,D]=K(N),P=Math.max(o,Y),F=Math.min(b,D);F-P>E-C&&(d=N,C=P,E=F)}if(!d){if(n.reference_label){$(`${n.reference_label} does not cover it (${W(s,o)}\u2013${W(s,b)}): it ends before this clip`);continue}let N=l.items.find(Y=>{let[D,P]=K(Y);return Y.kind!=="clip"&&Y.kind!=="gap"&&Math.min(b,P)>Math.max(o,D)});$(N?`V${m} has ${/compound|stack|timeline/i.test(String(N.kind))?"a compound clip or nested timeline":`a ${N.kind}`} over it, not a movie clip: Align reads a media file there (decompose it, or use Offline ref)`:A.length?`nothing on V${m} over it (${W(s,o)}\u2013${W(s,b)}): the reference does not cover this clip`:`V${m} has no movie clips: pick the track the reference is on, or Offline ref`);continue}let T=ee(e,d),R=ee(e,_);if(!T.path){$(`the reference clip ${d.name??d.id} is not linked (timeline_relink first)`);continue}if(!R.path){$("not linked (timeline_relink first)");continue}let O=h(C,E);if(O.some(N=>!Ee(q(d,N)))){$(`the reference clip ${d.name??d.id} is itself resized; the fit is against its raw picture`);continue}if(T.w>0&&T.h>0&&Math.abs(T.w/T.h-r/a)>.01*(r/a)){$(`the reference ${T.w}x${T.h} does not fill the ${r}x${a} frame`);continue}let ne=N=>N.map(Y=>({ref:T.path,refFrame:be(d,Y),src:R.path,srcFrame:be(_,Y)})),G=Array.from({length:E-C},(N,Y)=>C+Y),H=q(_,o);w.push({row:M,item:_,recs:O,every:G,ask:{pairs:ne(O),every:ne(G),every_t:G.map(N=>N-o),edit:Ke(H),edit_identity:Ee(H),edit_animated:!!H.animated,anchor_off:!!(H.anchorX||H.anchorY),...n.inputs?.get(`${c}:${o+k}`)?.length?{input:n.inputs.get(`${c}:${o+k}`)}:{}}})}let j=w.length?await ce({op:"reframe",items:w.map(c=>c.ask),out:[r,a],target:y},t,i):{items:[],offsets:[]},S=j.offsets;j.items.forEach((c,_)=>{let{row:o,item:b,recs:M,every:$,ask:d}=w[_],C=c.measured==="every"?$:M,E=c.measured==="every"?d.every:d.pairs,T=(({w:R,h:O})=>Ve(R,O,r,a,Ze(b,s,n.input_scaling)))(ee(e,b));o.samples=c.scores.map((R,O)=>({record:C[c.at[O]],ref_frame:E[c.at[O]].refFrame,src_frame:E[c.at[O]].srcFrame,score:R})),Object.assign(o,{verdict:c.verdict,confidence:c.confidence,...c.reason?{reason:c.reason}:{},...c.label?{label:c.label}:{},...c.unchanged?{unchanged:!0}:{},...c.grade_sizing?{grade_sizing:c.grade_sizing}:{}}),c.transform&&(o.transform=c.transform,o.properties=_e(c.edit_transform??c.transform,r,a,T)),c.keys?.length&&(o.keys=c.keys.map(R=>({record:C[c.at[R.j]],transform:R.transform,properties:_e(R.transform,r,a,T),confidence:R.confidence}))),c.grade_keys?.length&&(o.grade_keys=c.grade_keys.map(({shape:R,...O})=>R?.kind==="resolve_dissolve"?{...O,ease_in:R.start,ease_out:R.end}:O),o.grade_keys[0].t>0&&o.grade_keys.unshift({...o.grade_keys[0],t:0,ease_in:void 0,ease_out:void 0})),c.edit_keys?.length&&(o.edit_keys=c.edit_keys[0].t>0?[{...c.edit_keys[0],t:0,shape:void 0},...c.edit_keys]:c.edit_keys)});let I=[];for(let c of x){let _={track:c.track,start:c.start};if(c.verdict==="aligned"&&y==="edit"&&!c.unchanged){let o=c.properties;I.push({op:"properties",item:_,set:{...o.ZoomX!==o.ZoomY?{ZoomGang:!1}:{},...o}})}if(c.verdict==="animated"&&c.edit_keys&&I.push({op:"edit_keys",item:_,keys:c.edit_keys}),c.verdict==="animated"&&c.grade_keys&&I.push({op:"grade_sizing",item:_,target:y==="node"?"node":"input",keys:c.grade_keys,...y==="node"?Be(n):{}}),c.verdict==="aligned"&&c.grade_sizing&&!c.unchanged&&I.push({op:"grade_sizing",item:_,target:y,...c.grade_sizing,...y==="node"?Be(n):{}}),n.markers??!0){let o={aligned:"Aligned",animated:"Animated",no_match:"No match",refused:"Not aligned"}[c.verdict],b=[c.label,c.confidence!=null?`confidence ${c.confidence}`:"",c.reason].filter(Boolean).join(" \xB7 ");I.push({op:"marker_add",frame:c.start,color:cn[c.verdict],name:`${o}: ${c.name}`,note:b,data:"ConformTools:align"})}}let Z;if(n.apply_session){Z=0;for(let c of x.filter(_=>_.verdict==="aligned")){let _=c.transform;ve(e,"transform",{timeline_id:s.id,item_id:c.item_id,scale:_.scale_x,position_x:_.position_x,position_y:_.position_y,rotation:_.rotation});let o=s.tracks.flatMap(b=>b.items).find(b=>b.id===c.item_id);Math.abs(_.scale_x-_.scale_y)>.001&&(o.scale_x=_.scale_x,o.scale_y=_.scale_y),_.flip_h?o.flip_horizontal=!0:delete o.flip_horizontal,_.flip_v?o.flip_vertical=!0:delete o.flip_vertical,Z++}}let X={aligned:0,animated:0,no_match:0,refused:0};for(let c of x)X[c.verdict]++;return{timeline:s.name??s.id,raster:[r,a],reference_track:m,rows:x,counts:X,ops:I,...Z!=null?{applied:Z}:{},input_scaling:g,sizing_target:y,...S.length?{offsets:S}:{}}}function Tn(e){let n=e.counts,t=`${e.timeline} (${e.raster.join("x")}): ${n.aligned} aligned, ${n.animated} animated, ${n.no_match} no match, ${n.refused} not aligned \u2014 against ${e.reference??`V${e.reference_track}`}${e.input_scaling!=="fit"?` (Resolve units for input scaling "${e.input_scaling}")`:""}${e.sizing_target!=="edit"?`; written as Color-page ${e.sizing_target==="input"?"Input Sizing":"node Sizing"} on top of each clip's own edit transform`:""}${e.sizing_target==="edit"&&n.animated?`; the ${n.animated} moving clip(s) get Edit-page keyframes on a copy of the timeline, "${e.timeline} ALIGNED" (Resolve cannot keyframe the Edit page from a script; the copy carries every grade and setting)`:""}${e.applied!=null?`; ${e.applied} transform(s) written into the session`:""}`,i=r=>{let a=r.properties,u=r.grade_sizing,f=u?` \u2192 ${e.sizing_target} sizing Zoom ${u.zoom}${u.height!==1?` Height ${u.height}`:""} Pan ${u.pan} Tilt ${u.tilt} Rotate ${u.rotation}${u.flip_x?" FlipH":""}${u.flip_y?" FlipV":""}`:a?` \u2192 Pan ${a.Pan} Tilt ${a.Tilt} Zoom ${a.ZoomX}${a.ZoomY!==a.ZoomX?`/${a.ZoomY}`:""} Rot ${a.RotationAngle}${a.FlipX?" FlipX":""}${a.FlipY?" FlipY":""}`:"",m=r.grade_keys?.length?` \u2192 ${r.grade_keys.length} keyframes (${e.sizing_target==="node"?"node":"Input"} Sizing)`:r.edit_keys?.length?` \u2192 ${r.edit_keys.length} Edit-page keyframes`:"";return` V${r.track} ${r.record_tc} ${r.name}: ${r.verdict.toUpperCase()}${r.label?` (${r.label})`:""}${f}${m}${r.confidence!=null?`, confidence ${r.confidence}`:""}${r.reason?` \u2014 ${r.reason}`:""}`},s=(e.offsets??[]).map(r=>` the reference differs from the ${r.raster} online by ${r.label} on ${r.clips} of ${r.of} clips: a render / decode difference, not sizing \u2014 taken out of every clip, never written`);return[t,...s,...e.rows.map(i),`host_apply ops ready: ${e.ops.filter(r=>r.op==="properties"||r.op==="grade_sizing").length} ${e.sizing_target==="edit"?"properties":"grade_sizing"}, ${e.ops.filter(r=>r.op==="marker_add").length} markers (data "ConformTools:align")`].join(`
4
- `)}var de={"16:9":16/9,"1.85":1.85,"2.00":2,"2.20":2.2,"2.35":2.35,"2.39":2.39,"2.76":2.76,"4:3":4/3,"1:1":1,"9:16":9/16,none:null};function ln(e){if(e==null)return null;if(typeof e=="number")return e>0?e:null;if(e in de)return de[e];let n=/^(\d+(?:\.\d+)?)(?:[:/](\d+(?:\.\d+)?))?$/.exec(e.trim());if(!n)throw new Error(`aspect '${e}': one of ${Object.keys(de).join(", ")}, or a ratio like 1.66 or 3:2`);let t=n[2]?Number(n[1])/Number(n[2]):Number(n[1]);return t>0?t:null}function Xe(e,n,t){let i=[],s=e;for(let[r,a]of t)if(!(a<=s)&&(r>=n||(r>s&&i.push([s,Math.min(r,n)]),s=Math.max(s,a),s>=n)))break;return s<n&&i.push([s,n]),i}function Ye(e,n,t){let i=[...e,[n,t]].sort((r,a)=>r[0]-a[0]),s=[];for(let r of i){let a=s.at(-1);a&&r[0]<=a[1]?a[1]=Math.max(a[1],r[1]):s.push([r[0],r[1]])}return s}async function An(e,n,t,i){let s=ge(e,n.timeline_id),r=s.resolution_w,a=s.resolution_h,u=ln(n.aspect),f=Fe(n.strictness),m=!!n.pixels,l=Math.max(1,Math.min(12,Math.floor(n.samples??3))),p=te(s),g=p.filter(o=>o.enabled!==!1),y=[],v=[],h=o=>{let b=ee(e,o);if(!(b.w>0&&b.h>0))return!1;let[M,$]=Ne(r,a,b.w,b.h),d=q(o,K(o)[0]);return!d.animated&&Math.abs(M-r)<.5&&Math.abs($-a)<.5&&(d.scaleX??d.scale??100)===100&&(d.scaleY??d.scale??100)===100&&!d.posX&&!d.posY&&!d.rotation&&!d.cropL&&!d.cropR&&!d.cropT&&!d.cropB},k=new Map,x=[];for(let o of g)k.set(o,x),x=oe(o).filter(b=>b.enabled!==!1&&h(b)).reduce((b,M)=>Ye(b,...K(M)),x);let w=[];for(let o of[...g].reverse()){let b=oe(o).filter(d=>d.enabled!==!1),M=b.reduce((d,C)=>Ye(d,...K(C)),w),$=p.indexOf(o)+1;for(let d of b){let[C,E]=K(d),T=k.get(o)??[],R=Xe(C,E,w).flatMap(([P,F])=>Xe(P,F,T));if(!R.length)continue;let O=ee(e,d);if(!(O.w>0&&O.h>0)){y.push({item_id:d.id,name:d.name??d.id,track:$,reason:"the source raster is unknown (timeline_relink the clip first)"});continue}m&&!O.path&&y.push({item_id:d.id,name:d.name??d.id,track:$,reason:"not linked: its source frames were not measured (timeline_relink first); its transform was checked"});let[ne,G]=Ne(r,a,O.w,O.h),H=q(d,C).animated,N=P=>{let F=q(d,P);return{box:[ne,G],scale:[(F.scaleX??F.scale??100)/100,(F.scaleY??F.scale??100)/100],pos:[F.posX*ne,F.posY*G],rot:F.rotation,anchor:[F.anchorX,F.anchorY],crop:[F.cropL/100,F.cropR/100,F.cropT/100,F.cropB/100],flip:[F.flipH,F.flipV]}},Y=[],D=new Map;for(let[P,F]of R){let ue=new Set(m&&O.path?Le(P,F,l):[]),he=new Set(H?Array.from({length:F-P},(V,U)=>P+U):ue.size?[]:[P]);for(let V of ue)he.add(V);let ye=[...he].sort((V,U)=>V-U);ye.forEach((V,U)=>{D.set(V,[U?V:P,ye[U+1]??F]),Y.push({rec:V,place:N(V),...ue.has(V)?{src:be(d,V)}:{}})})}v.push({item:d,track:$,path:O.path,frames:Y,hold:D,animated:H})}w=M}let A=v.length?await ce({op:"blanking",items:v.map(o=>({path:o.path,frames:o.frames})),out:[r,a],aspect:u},t,i):{items:[],target:[0,0,r,a]},z=A.target,B=[],j=new Map,S=0;A.items.forEach((o,b)=>{let M=v[b],$=new Map;j.set(M.item.id,$);for(let d of o){if(d.bars&&S++,d.black||!d.edges.some(T=>T>0))continue;let[C,E]=M.hold.get(d.rec);for(let T=C;T<E;T++)B.push({pts:T,bt:d.edges[0],bb:d.edges[1],bl:d.edges[2],br:d.edges[3],source:d.bars?"pixels":"geometry"}),$.set(T,d.zoom)}});let I=v.map(o=>({id:o.item.id,name:o.item.name??o.item.id,start:K(o.item)[0],end:K(o.item)[1],track:o.track})),X=Ce(B,I,0,Math.round(z[2]-z[0]),Math.round(z[3]-z[1]),{tolerance_px:f.tolerance_px,min_frames:f.min_frames,gap_frames:f.gap_frames}).map(o=>{let b=1,M=j.get(o.clip.id);for(let $=o.start_frame;$<=o.end_frame;$++){if(!M.has($))continue;let d=M.get($);b=d==null||b==null?null:Math.max(b,d)}return{item_id:o.clip.id,name:o.clip.name,track:o.clip.track,record_start:o.start_frame,record_end:o.end_frame,record_tc:W(s,o.start_frame),frames:o.duration_frames,edges:{top:o.measured.bt,bottom:o.measured.bb,left:o.measured.bl,right:o.measured.br},zones:o.zones,sources:o.sources,zoom_fix:b}}),c=[],_=new Map;for(let o of X)_.set(o.item_id,[..._.get(o.item_id)??[],o]);for(let[o,b]of _){let M=v.find(T=>T.item.id===o);if(M.animated||b.some(T=>T.zoom_fix==null))continue;let $=Math.max(...b.map(T=>T.zoom_fix)),d=ee(e,M.item),C=_e(Ke(q(M.item,K(M.item)[0])),r,a,Ve(d.w,d.h,r,a,Ze(M.item,s,n.input_scaling))),E=T=>Math.ceil(T*$*1e5)/1e5;c.push({op:"properties",item:{track:M.track,start:K(M.item)[0]},set:{ZoomX:E(C.ZoomX),ZoomY:E(C.ZoomY)}})}if(n.markers??!0)for(let o of X){let b=v.find(d=>d.item.id===o.item_id),M=o.zones.map(d=>`${d} ${o.edges[d.toLowerCase()]} px`).join(" \xB7 "),$=b.animated?"keyframed sizing: fix the keys":o.zoom_fix==null?"no zoom about its anchor fills it":`zoom \xD7${o.zoom_fix} fills it`;c.push({op:"marker_add",frame:o.record_start,duration:o.frames,color:"Red",name:`Blanking: ${o.name}`,note:`${M} (${o.sources.join("+")}) \u2014 ${$}`,data:"ConformTools:blanking"})}return{timeline:s.name??s.id,raster:[r,a],aspect:u,target:z,strictness:f,pixels:m,clips_checked:v.length,frames_measured:S,findings:X,refused:y,ops:c}}function zn(e){return[`${e.findings.length?`BLANKING: ${e.findings.length} range(s) on ${new Set(e.findings.map(t=>t.item_id)).size} clip(s)`:"CLEAN: no clip shows black"} \u2014 ${e.timeline} ${e.raster.join("x")}${e.aspect?`, delivered ${J(e.aspect,3)}:1 (black counted inside it only)`:""}; ${e.strictness.preset} (${e.strictness.tolerance_px} px, ${e.strictness.min_frames} frame(s)); ${e.clips_checked} clip(s) by their transform${e.pixels?`, ${e.frames_measured} source frame(s) measured for their own black edges`:" (pixels:false: a black edge baked into a source is not seen)"}`,...e.findings.map(t=>` V${t.track} ${t.record_tc} ${t.name} (${t.frames} frame${t.frames>1?"s":""}): ${t.zones.map(i=>`${i} ${t.edges[i.toLowerCase()]} px`).join(", ")} [${t.sources.join("+")}]${t.zoom_fix?` \u2014 zoom \xD7${t.zoom_fix} fills it`:" \u2014 no zoom about its anchor fills it"}`),...e.refused.map(t=>` V${t.track} ${t.name}: ${t.reason}`),`host_apply ops ready: ${e.ops.filter(t=>t.op==="properties").length} ZoomX/ZoomY fixes, ${e.ops.filter(t=>t.op==="marker_add").length} markers (data "ConformTools:blanking")`].join(`
5
- `)}export{fe as a,Fe as b,Ce as c,bn as d,_n as e,un as f,Ze as g,Ve as h,_e as i,Sn as j,mn as k,Mn as l,Tn as m,de as n,ln as o,An as p,zn as q};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{Ha as r,W as s,n as o}from"./chunk-RJ6JA2LZ.js";async function d(t){await r();let e=s(t);return e==="null"?null:JSON.parse(e)}async function l(t){await r();let e;try{e=o(t)}catch{return null}if(e.length<8)return null;let n=new DataView(e.buffer,e.byteOffset,e.byteLength),a=n.getUint32(0,!0),i=n.getUint32(4,!0),u=a*i*4;return e.length<8+u?null:{width:a,height:i,rgba:new Uint8ClampedArray(e.subarray(8,8+u))}}export{d as a,l as b};
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{a as h}from"./chunk-PHAMF4JF.js";import{A as K,I as X,L as Y,O as H,P as q,Q as V,Y as u,b as l,f as F,g as x,k as g,l as J,p as N,r as G,s as z,v as y,x as $,y as C,z as v}from"./chunk-PLRB2YXJ.js";var _={payg:{id:"payg",name:"Pay As You Go",monthly:0,yearly:0,stripe:{},includes:{web:!0,mcp:!1,app:!1}},web:{id:"web",name:"Web",monthly:10,yearly:100,stripe:{},includes:{web:!0,mcp:!1,app:!1}},indie:{id:"indie",name:"MCP",monthly:49,yearly:490,stripe:{monthly:"price_1T5XDXJ5lnla0aaLasKq49tm",yearly:"price_1T5XDXJ5lnla0aaL2MdMSuI9"},includes:{web:!0,mcp:!0,app:!1}},pro:{id:"pro",name:"App",monthly:199,yearly:1990,stripe:{monthly:"price_1T5X8oJ5lnla0aaLyNJa93H0",yearly:"price_1T5X8oJ5lnla0aaL3dh7b1el"},includes:{web:!0,mcp:!0,app:!0}},studio:{id:"studio",name:"Studio",monthly:"custom",yearly:"custom",stripe:{monthly:"price_1T5X7xJ5lnla0aaLoeE1aBlL",yearly:"price_1T5X7xJ5lnla0aaLeBiYo3Di"},includes:{web:!0,mcp:!0,app:!0}}},Z={web:!0,mcp:!1,app:!1};var Ne=Object.fromEntries(Object.values(_).flatMap(e=>Object.values(e.stripe).map(t=>[t,e.id])));import{createPrivateKey as De,createPublicKey as fe,sign as Te,verify as ge}from"node:crypto";import{Buffer as w}from"node:buffer";var he="CONFORMTOOLS_LICENSE_V1",W=/^[0-9A-F]{8}(-[0-9A-F]{8}){3}$/,Q=e=>JSON.stringify({dev_mode:e.dev_mode??!1,email:e.email,expires_at:e.expires_at,features:e.features,issued_at:e.issued_at,machine_fingerprint:e.machine_fingerprint,tier:e.tier});function ee(e){let t=e.split(/\r?\n/).map(r=>r.trim()).filter(r=>r&&!r.startsWith("#")&&!r.startsWith("-----")).join(""),n=JSON.parse(w.from(t,"base64").toString("utf8"));if(n?.magic!==he||!n.payload?.data)throw new Error("not a conform.tools licence");return n.payload}function te(e,t){let n=w.from(e.signature,"base64"),r=w.from(Q(e.data));return n.length!==64?!1:t.some(o=>ge(null,r,fe({key:w.concat([w.from("302a300506032b6570032100","hex"),w.from(o)]),format:"der",type:"spki"}),n))}async function D(){let e=x()==="win32"?"conformtools-analyze.exe":"conformtools-analyze",t=[l("CONFORM_ANALYZE"),N(new URL(`./${e}`,import.meta.url)),N(new URL(`../../rust/target/release/${e}`,import.meta.url))].filter(Boolean);for(let n of t)if(await z(n))return n;return null}var ne=e=>e.code==="not_entitled"?new h("not_entitled",String(e.why)):void 0;async function Be(e){let t=await re(),n=await t.ask({op:"job",reference:e.reference,clips:e.clips,lite:e.lite??!0,display:!!e.display});if(!n.ok)throw t.close(),ne(n)??new Error(`analysis engine: ${n.why}`);return t}async function Fe(e,t,n){let r=await re(),o=()=>r.close();n?.addEventListener("abort",o);let i;try{i=await r.ask(e,t)}finally{n?.removeEventListener("abort",o),r.close()}if(n?.aborted)throw new Error("cancelled");if(!i.ok)throw ne(i)??new Error(i.why??`the analysis engine could not run ${e.op}`);return i}async function re(){let e=await D();if(!e)throw new Error("the analysis engine (conformtools-analyze) is not installed");let t="",n=null,r=H(e,["serve"],s=>{t+=new TextDecoder().decode(s);let d;for(;(d=t.indexOf(`
4
- `))>=0;){let m=t.slice(0,d);t=t.slice(d+1);let c=JSON.parse(m);if(c.progress){n?.progress?.(c.progress[0],c.progress[1],c.phase??"");continue}let p=n;n=null,p?.done(c)}},s=>console.error(s.trimEnd()));r.exited.then(()=>n?.done({ok:!1,why:"the analysis engine exited"}));let o=Promise.resolve();return{ask:(s,d)=>{let m=o.then(async()=>{r.hold(!0);try{let c=new Promise(f=>{n={done:f,progress:d}});await r.write(new TextEncoder().encode(JSON.stringify(s)+`
5
- `));let p=await c;return p.miss&&(console.error(`[mirror] MISS \u2014 ${p.miss} is not in the mirror. Replay never reads the source drive; record this case again with the drive mounted (CONFORM_MIRROR_MODE=record).`),F(75)),p}finally{r.hold(!1)}});return o=m.catch(()=>{}),m},close:()=>r.close()}}var ye=["cMwVBrEYKMzlG6pC7FF2lNKIoEqGz2xB5yph6clNnTg=","qnheqkkDU09l1oI6h2CFh4uQ97bY/hkTA5niGKH0+X8="],_e=ye.map(e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)));function A(){let e=l("CONFORM_RECORDS_DIR");if(e)return e;let t=J(),n=x()==="darwin"?u(t,"Library/Application Support"):x()==="win32"?l("LOCALAPPDATA")??u(t,"AppData/Local"):l("XDG_DATA_HOME")??u(t,".local/share");return u(n,"conform.tools")}var we=()=>l("CONFORM_LICENSE_PATH")??u(A(),"license.lic"),k=()=>u(A(),"grant.lic"),be=null;function T(){return be??=(async()=>{let e=await D();if(!e)return[];let t=await Y(e,["machine"],{timeoutMs:15e3}).catch(()=>null);try{return JSON.parse(t?.stdout??"").machines.filter(n=>W.test(n))}catch{return[]}})()}function xe(e,t,n=Date.now()){if(!te(e,_e))return{ok:!1,reason:"invalid licence signature"};let r=Date.parse(e.data.expires_at);return!Number.isFinite(r)||r<n?{ok:!1,reason:`licence expired ${e.data.expires_at}`}:[t??[]].flat().includes(e.data.machine_fingerprint)?{ok:!0,data:e.data}:{ok:!1,reason:"licence is for another machine"}}async function oe(){let e;try{e=await y(we())}catch{return null}try{return xe(ee(e),await T())}catch(t){return{ok:!1,reason:t.message}}}var ve={production:{supabaseUrl:"https://sttpwvjbpsetzbhrkohl.supabase.co",anonKey:"sb_publishable_cyuIPsrQa5Ye7lqFxjnknQ_ozDuwwzp",appBase:"https://conform.tools"},staging:{supabaseUrl:"https://slxggvbvgzkiwojcgykx.supabase.co",anonKey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InNseGdndmJ2Z3praXdvamNneWt4Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzEyODUzMTksImV4cCI6MjA4Njg2MTMxOX0.b18iDsWftny0k9VmOCcbN6kLlyZsZ7GULn_jRH9CE9I",appBase:"https://beta.conform.tools"}};function a(){let e=l("CONFORM_ENV")==="staging"?"staging":"production",t=ve[e];return{env:e,supabaseUrl:l("CONFORM_SUPABASE_URL")??t.supabaseUrl,anonKey:l("CONFORM_SUPABASE_ANON_KEY")??t.anonKey,appBase:l("CONFORM_APP_BASE")??t.appBase}}var Se=600*1e3,ie=72*3600*1e3,Ee=300*1e3,E=()=>u(g(),a().env==="production"?"auth.json":`auth-${a().env}.json`);async function M(){for(let e of new Set([E(),u(g(),"auth.json")]))try{let t=JSON.parse(await y(e));if(t.env===a().env&&t.access_token)return t}catch{}return null}async function Pe(){try{for await(let e of X(g())){if(!/^auth(?:-(\w+))?\.json$/.exec(e.name))continue;let n=JSON.parse(await y(u(g(),e.name)));if(n.access_token&&n.env&&n.env!==a().env)return{other_env:n.env}}}catch{}return{}}async function R(e){await C(g()),await $(E(),JSON.stringify(e)),await K(E(),384)}var se=6e3,P=0,ce=()=>Date.now()<P,le=()=>{P=Date.now()+6e4};function We(){P=0}async function ue(e){if(e.expires_at-60>Date.now()/1e3)return e.access_token;if(ce())return null;let t=a();try{let n=await fetch(`${t.supabaseUrl}/auth/v1/token?grant_type=refresh_token`,{method:"POST",headers:{apikey:t.anonKey,"content-type":"application/json"},body:JSON.stringify({refresh_token:e.refresh_token}),signal:AbortSignal.timeout(se)}).catch(o=>{throw le(),o});if(!n.ok)return n.status===400||n.status===401?"":null;let r=await n.json();return e.access_token=r.access_token,r.refresh_token&&(e.refresh_token=r.refresh_token),e.expires_at=r.expires_at??Math.floor(Date.now()/1e3)+(r.expires_in??3600),await R(e),e.access_token}catch{return null}}async function Qe(){let e=await M();return e&&await ue(e)||null}var b=null;function ae(e,t){return{signed_in:!0,entitled:e.entitled,env:a().env,email:e.email,access:e.access,tier:e.tier,trial_days_remaining:e.trial_days_remaining,source:t,...e.entitled?{}:{reason:"not_entitled"},...e.invite_only?{invite_only:!0}:{}}}async function pe(e={}){let t=await oe();if(t?.ok)return{signed_in:!!await M().catch(()=>null),entitled:!0,env:a().env,email:t.data.email,access:"licence",tier:t.data.tier,source:"licence"};let n=await Ae(e);return t&&!n.entitled?{...n,licence_error:t.reason}:n}async function Ae(e){if(!e.force&&b&&Date.now()-b.at<Se)return{...b.status,source:"cache"};let t=a(),n=await M();if(!n)return{signed_in:!1,entitled:!1,env:t.env,reason:"not_signed_in",...await Pe()};let r=await ue(n);if(r==="")return{signed_in:!0,entitled:!1,env:t.env,reason:"auth_rejected"};if(r&&!ce())try{let o=(await T())[0],i=await fetch(`${t.supabaseUrl}/functions/v1/v1-billing/v1/billing/entitlement${o?`?machine=${o}`:""}`,{headers:{authorization:`Bearer ${r}`,apikey:t.anonKey},signal:AbortSignal.timeout(se)}).catch(s=>{throw le(),s});if(i.status===401||i.status===403)return{signed_in:!0,entitled:!1,env:t.env,reason:"auth_rejected"};if(i.ok){let{grant:s,...d}=(await i.json()).data;o&&await ke(s),n.last_entitlement=d,n.last_entitlement_at=Date.now(),await R(n);let m=ae(d,"live");return b={at:Date.now(),status:m},m}}catch{}if(n.last_entitlement&&n.last_entitlement_at&&Date.now()-n.last_entitlement_at<ie){let o=ie-(Date.now()-n.last_entitlement_at);return{...ae(n.last_entitlement,"grace"),grace_remaining_h:Math.round(o/36e4)/10}}return{signed_in:!0,entitled:!1,env:t.env,reason:"offline_grace_expired"}}async function ke(e){try{if(!e)return await v(k());await C(A()),await $(k(),e)}catch{}}function Le(e){return e.source==="licence"?`${e.email} \xB7 machine licence (${e.tier}) \u2014 runs offline, no account check`:Oe(e)+(e.licence_error?`
6
- (the machine licence was not used: ${e.licence_error})`:"")}function Oe(e){let t=a();if(!e.signed_in)return`not signed in (${t.env})${e.other_env?`; you are signed in to ${e.other_env} only (each server keeps its own sign-in)`:""}. Run the account_login tool, or \`npx -y conformtools@latest login\` in a terminal.`;if(e.reason==="auth_rejected")return"signed-in session was rejected (expired or revoked) \u2014 sign in again with account_login.";if(e.reason==="offline_grace_expired")return"offline for more than 72 h since the last account check \u2014 reconnect and run account_status.";let n=`${e.email??"(unknown email)"} \xB7 ${t.env}`;if(!e.entitled&&e.invite_only)return`${n}
7
- the conform.tools engine (the MCP and the app) is invite-only for now, and ${e.email??"this account"} is not on the list. If that is the wrong Google account, run account_logout, then account_login with the invited one.`;if(!e.entitled)return`${n}
8
- no active plan on ${e.email??"this account"}: the trial has ended and there is no subscription. If that is the wrong Google account, run account_logout, then account_login and pick the account with the plan; otherwise choose a plan at ${t.appBase}/pricing, then run account_status.`;let r=e.access==="trial"?`trial, ${e.trial_days_remaining??"?"} day(s) left`:e.access==="allowlist"?"invited (early access)":`subscribed${e.tier?` (${e.tier})`:""}`,o=L(e),i=o?` \xB7 includes ${[o.web&&"the web tools",o.mcp&&"the MCP",o.app&&"the app"].filter(Boolean).join(", ")||"the web tools"}`:"";return`${n}
9
- ${r}${i}${e.source==="grace"?` \u2014 offline, using the last check (${e.grace_remaining_h} h of grace left)`:""}`}function L(e){if(e.access==="trial")return Z;let t=(e.tier??"").toLowerCase();return(t==="enterprise"?_.studio:_[t])?.includes??null}var de=()=>pe();function et(e){de=e}async function me(){let e=await de();if(e.entitled)return e;let t=e.signed_in&&e.reason==="not_entitled"?"not_entitled":"not_signed_in";throw new h(t,Le(e),{account:e})}async function tt(){let e=await me();if(e.source==="licence"||L(e)?.mcp!==!1)return e;throw new h("not_entitled",`The conform.tools MCP is in the MCP plan ($${_.indie.monthly}/mo) and up. ${e.access==="trial"?"Your trial":`Your plan${e.tier?` (${e.tier})`:""}`} includes Timeline Exchange and Conform Connect on ${a().appBase}, but not the engine on this machine. Upgrade at ${a().appBase}/pricing, then run account_status.`,{account:e,needs:"mcp"})}async function nt(){let e=await me();if(e.source==="licence"||L(e)?.app)return e;throw new h("not_entitled",`The conform.tools app is in the App plan ($${_.pro.monthly}/mo). ${e.access==="trial"?"Your trial":`Your plan${e.tier?` (${e.tier})`:""}`} does not include the app${L(e)?.mcp?" \u2014 it includes the conform.tools MCP: use it from Claude, Claude Code or any MCP client":""}. Upgrade at ${a().appBase}/pricing, then reopen the app.`,{account:e,needs:"app"})}var S=null;function rt(e={}){if(S)return S;let t=a(),n=crypto.randomUUID().replaceAll("-","");return S=new Promise((r,o)=>{let i=!1,s=c=>{i||(i=!0,clearTimeout(m),setTimeout(()=>d.close(),250),S=null,c())},d=V({hostname:"127.0.0.1",port:0,onListen:async c=>{let p=`${t.appBase}/plugin-auth?client=engine&port=${c}&state=${n}`,f=await q(p);e.onUrl?.(p,f)}},async c=>{let p=new URL(c.url);if(p.pathname!=="/callback")return new Response("not found",{status:404});let f=p.searchParams,U=f.get("access_token")??"",j=f.get("refresh_token")??"",O=!!U&&!!j&&f.get("state")===n;if(O){let B=Number(f.get("expires_at"));await R({env:t.env,access_token:U,refresh_token:j,expires_at:B>0?B:Math.floor(Date.now()/1e3)+3600}),b=null,P=0,pe({force:!0}).then(I=>s(()=>r(I)),I=>s(()=>o(I)))}return new Response(Ie(O),{status:O?200:400,headers:{"content-type":"text/html; charset=utf-8"}})}),m=setTimeout(()=>s(()=>o(new h("not_signed_in","sign-in was not completed within 5 minutes"))),e.timeoutMs??Ee)}),S}async function ot(){b=null,P=0,await G(E())&&await v(E()),await v(k()).catch(()=>{});let e=u(g(),"auth.json");try{JSON.parse(await y(e)).env===a().env&&await v(e)}catch{}}function Ie(e){let[t,n]=e?["Connected","You're signed in \u2014 you can close this tab."]:["Sign-in failed","Please try again."];return`<!doctype html><meta charset=utf-8><title>conform.tools</title><body style='font:16px -apple-system,Helvetica,Arial,sans-serif;display:flex;align-items:center;justify-content:center;height:100vh;margin:0;background:#f5f5f7;color:#1d1d1f'><div style='text-align:center'><div style='font-size:22px;font-weight:700'>conform<span style='color:#ff3c00'>.tools</span></div><div style='margin-top:14px;font-size:20px;font-weight:600'>${t}</div><div style='margin-top:6px;color:#6e6e73'>${n}</div></div></body>`}export{Be as a,Fe as b,re as c,a as d,se as e,We as f,Qe as g,pe as h,Le as i,L as j,et as k,me as l,tt as m,nt as n,rt as o,ot as p};
@@ -1,20 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{A as L,Y as P,b as N,k as A,p as O,v as R,x as M,y as W,z as I}from"./chunk-PLRB2YXJ.js";import K from"node:http";import{connect as Y}from"node:net";import{createHash as U,randomBytes as j}from"node:crypto";import{Buffer as m}from"node:buffer";var D="258EAFA5-E914-47DA-95CA-C5AB0DC85B11";function C(o,e,a=!1){let n=e.length,t=a?128:0,s=n<126?m.from([128|o,t|n]):n<65536?m.from([128|o,t|126,n>>8,n&255]):(()=>{let i=m.alloc(10);return i[0]=128|o,i[1]=t|127,i.writeBigUInt64BE(BigInt(n),2),i})();if(!a)return m.concat([s,m.from(e)]);let r=j(4),c=m.from(e);for(let i=0;i<c.length;i++)c[i]^=r[i&3];return m.concat([s,r,c])}function J(o,e,a,n=!1){let t=m.alloc(0),s=[],r=0,c=!1,i=[],p=[],u=()=>{c||(c=!0,p.forEach(l=>l()))},f=(l=1e3,d="")=>{if(c)return;let h=m.from(d),g=m.alloc(2+h.length);g.writeUInt16BE(l,0),h.copy(g,2);try{o.write(C(8,g,n))}catch{}o.end(),u()};return o.on("data",l=>{for(t=m.concat([t,l]);t.length>=2;){let d=(t[0]&128)!==0,h=t[0]&15,g=(t[1]&128)!==0,v=t[1]&127,y=2;if(v===126){if(t.length<4)return;v=t.readUInt16BE(2),y=4}else if(v===127){if(t.length<10)return;let w=t.readBigUInt64BE(2);if(w>BigInt(a))return f(1009,"too big");v=Number(w),y=10}if(g===n)return f(1002,n?"server frames must not be masked":"client frames must be masked");if(v>a||r+v>a)return f(1009,"message too big");let T=g?4:0;if(t.length<y+T+v)return;let S=m.from(t.subarray(y+T,y+T+v));if(g){let w=t.subarray(y,y+4);for(let x=0;x<S.length;x++)S[x]^=w[x&3]}if(t=t.subarray(y+T+v),h===8)return f(1e3);if(h===9){o.write(C(10,S,n));continue}if(h!==10){if(h===1||h===0){if(s.push(S),r+=S.length,d){let w=m.concat(s).toString("utf8");s=[],r=0,i.forEach(x=>x(w))}continue}return f(1003,"text frames only")}}}),o.on("close",u),o.on("error",u),{origin:e,send:l=>{c||o.write(C(1,m.from(l,"utf8"),n))},close:f,onMessage:l=>{i.push(l)},onClose:l=>{p.push(l)}}}function F(o,e){let a=new Set,n=K.createServer((t,s)=>{let r=n.address();o.onHttp?.(t,s,typeof r=="object"&&r?r.port:o.port)||(s.writeHead(426,{"content-type":"text/plain"}),s.end("websocket only"))});return n.on("upgrade",(t,s)=>{let r=t.headers["sec-websocket-key"];if(t.url?.split("?")[0]!==o.path||typeof r!="string"||String(t.headers.upgrade).toLowerCase()!=="websocket"){s.end(`HTTP/1.1 400 Bad Request\r
4
- \r
5
- `);return}let c=U("sha1").update(r+D).digest("base64");s.write(`HTTP/1.1 101 Switching Protocols\r
6
- Upgrade: websocket\r
7
- Connection: Upgrade\r
8
- Sec-WebSocket-Accept: ${c}\r
9
- \r
10
- `),a.add(s),s.on("close",()=>a.delete(s));let i=typeof t.headers.origin=="string"?t.headers.origin:null;e(J(s,i,o.maxBytes))}),new Promise((t,s)=>{n.once("error",s),n.listen(o.port,o.hostname,()=>{let r=n.address();t({port:typeof r=="object"&&r?r.port:o.port,close:()=>new Promise(c=>{for(let i of a)i.destroy();n.close(()=>c())})})})})}function de(o,e){let a=new URL(o);if(a.protocol!=="ws:")return Promise.reject(new Error(`only ws:// URLs: ${o}`));let n=j(16).toString("base64"),t=U("sha1").update(n+D).digest("base64");return new Promise((s,r)=>{let c=Y({host:a.hostname,port:Number(a.port||80)}),i=f=>{c.destroy(),r(f)};c.setTimeout(e.timeoutMs,()=>i(new Error(`no answer from ${a.host} within ${e.timeoutMs} ms`))),c.once("error",i),c.once("connect",()=>c.write(`GET ${a.pathname}${a.search} HTTP/1.1\r
11
- Host: ${a.host}\r
12
- Upgrade: websocket\r
13
- Connection: Upgrade\r
14
- Sec-WebSocket-Key: ${n}\r
15
- Sec-WebSocket-Version: 13\r
16
- \r
17
- `));let p=m.alloc(0),u=f=>{p=m.concat([p,f]);let l=p.indexOf(`\r
18
- \r
19
- `);if(l<0)return;c.off("data",u);let d=p.subarray(0,l).toString("latin1").split(`\r
20
- `),h=d.find(y=>/^sec-websocket-accept:/i.test(y))?.split(":")[1]?.trim();if(!/^HTTP\/1\.1 101/.test(d[0])||h!==t)return i(new Error(`${a.host} refused the WebSocket upgrade: ${d[0]}`));c.setTimeout(0),c.off("error",i);let g=p.subarray(l+4),v=J(c,null,e.maxBytes,!0);g.length&&c.emit("data",g),s(v)};c.on("data",u)})}import{existsSync as te,readFileSync as ne}from"node:fs";var $="0.6.8";function Q(o,e){let a=o.split("-")[0].split(".").map(Number),n=e.split("-")[0].split(".").map(Number);for(let t=0;t<Math.max(a.length,n.length);t++){let s=(a[t]||0)-(n[t]||0);if(s)return s>0}return!1}var Z=null;function q(){return N("CONFORM_UPDATE_CHECK")==="off"?Promise.resolve(null):Z??=fetch("https://registry.npmjs.org/conformtools/latest",{signal:AbortSignal.timeout(2e3)}).then(o=>o.ok?o.json():null).then(o=>typeof o?.version=="string"?o.version:null).catch(()=>null)}var ee="run npx -y --prefer-online conformtools@latest mcp (in the MCP client config too; --prefer-online makes npx re-check npm instead of reusing its cached copy), then restart the MCP client; if an old global install is shadowing it: npm rm -g conformtools";async function ve(){let o=await q();return`conformtools ${$}`+(o&&Q(o,$)?` \u2014 update available: ${o} \u2192 ${ee}`:"")}var k=1,re=[48127,48128,48129,48130,48131,48132,48133,48134],oe=5e3,V=4,se=8*1024*1024,b=class extends Error{constructor(a,n){super(n);this.code=a}},_=()=>P(A(),"host-bridge","pairing.json"),B="/avid-panel/",ie="/avid-panel/pairing",G="avid",z={"index.html":"text/html; charset=utf-8","panel.js":"text/javascript; charset=utf-8","panel.css":"text/css; charset=utf-8","icon.svg":"image/svg+xml"},ae="default-src 'none'; script-src 'self'; style-src 'self'; img-src 'self' data:; connect-src 'self' ws://localhost:{port} ws://127.0.0.1:{port} http://localhost:* http://127.0.0.1:* https://localhost:* https://127.0.0.1:*; base-uri 'none'; form-action 'none'; frame-ancestors 'none'",X=o=>[`http://localhost:${o}`,`http://127.0.0.1:${o}`];function ce(){for(let o of["./avid/panel/web-dist/","./avid-panel/"]){let e=O(new URL(o,import.meta.url));if(te(P(e,"index.html")))return e}return null}function le(){let o=new Uint8Array(32);return crypto.getRandomValues(o),Array.from(o,e=>e.toString(16).padStart(2,"0")).join("")}var H=class{constructor(){this.token=le();this.port=0;this.live=new Map;this.waiters=[];this.seq=0;this.events=[]}async start(e=re){let a;for(let n of e)try{this.server=await F({hostname:"127.0.0.1",port:n,path:"/host-bridge",maxBytes:se,onHttp:(t,s,r)=>this.servePanel(t,s,r)},t=>this.accept(t)),this.port=this.server.port;break}catch(t){a=t}if(!this.server)throw new b("no_port",`every host-bridge port (${e.join(", ")}) is taken: ${a}`);await W(P(A(),"host-bridge")),await M(_(),JSON.stringify({protocol:k,url:`ws://127.0.0.1:${this.port}/host-bridge`,port:this.port,token:this.token})),await L(_(),384)}async stop(){for(let e of this.live.values())e.conn.close(1001,"engine stopping");this.live.clear(),await this.server?.close();try{JSON.parse(await R(_())).token===this.token&&await I(_())}catch{}}peers(){return[...this.live.values()].map(e=>e.peer)}peer(e){return this.live.get(e)?.peer}async waitFor(e,a){return this.live.has(e)?this.peer(e):(await Promise.race([new Promise(n=>this.waiters.push({host:e,resolve:n})),new Promise(n=>setTimeout(n,a))]),this.peer(e))}request(e,a,n={},t=3e4){let s=this.live.get(e);if(!s)return Promise.reject(new b("not_connected",`${e}: its panel is not connected`));let r=`r${++this.seq}`;return new Promise((c,i)=>{let p=setTimeout(()=>{s.pending.delete(r),i(new b("timeout",`${e}: no answer to ${a} within ${Math.round(t/1e3)} s`))},t);s.pending.set(r,{resolve:c,reject:i,timer:p}),s.conn.send(JSON.stringify({type:"request",id:r,method:a,params:n}))})}servePanel(e,a,n){let t=(e.url??"").split("?")[0];if(!t.startsWith(B)&&t!==B.slice(0,-1))return!1;let s=(f,l,d,h=!1)=>{let g=typeof d=="string"?new TextEncoder().encode(d):d;return a.writeHead(f,{"content-type":l,"content-length":String(g.length),"cache-control":"no-store","x-content-type-options":"nosniff","referrer-policy":"no-referrer","cross-origin-resource-policy":"same-origin","x-frame-options":"DENY","content-security-policy":ae.replaceAll("{port}",String(n))}),a.end(h?void 0:g),!0},r=(f,l)=>s(f,"text/plain; charset=utf-8",l),c=f=>{let l=e.headers[f];return typeof l=="string"?l:void 0},i=(c("host")??"").toLowerCase();if(i!==`localhost:${n}`&&i!==`127.0.0.1:${n}`)return r(421,"misdirected request");if(t===ie)return e.method==="POST"&&X(n).includes(c("origin")??"")&&(c("sec-fetch-site")??"same-origin")==="same-origin"&&c("x-ct-panel")==="1"&&(c("content-length")??"0").trim()==="0"?s(200,"application/json",JSON.stringify({protocol:k,url:`ws://localhost:${n}/host-bridge`,port:n,token:this.token})):r(403,"forbidden");if(e.method!=="GET"&&e.method!=="HEAD")return r(405,"method not allowed");let p=t.slice(B.length)||"index.html",u=ce();return!z[p]||!u?r(404,"not found"):s(200,z[p],ne(P(u,p)),e.method==="HEAD")}accept(e){let a=!!e.origin&&X(this.port).includes(e.origin);if(e.origin&&/^https?:/i.test(e.origin)&&!a){e.send(JSON.stringify({type:"error",code:"origin_refused",message:"web pages may not use the host bridge"})),e.close(1008,"origin");return}let n=null,t=setTimeout(()=>{n||(e.send(JSON.stringify({type:"error",code:"hello_timeout",message:"no hello"})),e.close(1008,"hello"))},oe);e.onMessage(s=>{let r;try{r=JSON.parse(s)}catch{return}if(!n){let i=(l,d)=>{clearTimeout(t),e.send(JSON.stringify({type:"error",code:l,message:d})),e.close(1008,l)};if(r.type!=="hello")return i("hello_expected","the first frame must be hello");if(r.protocol!==k)return i("protocol_mismatch",`this engine speaks protocol ${k}`);if(r.token!==this.token)return i("bad_token","the pairing token does not match: re-read the pairing file");let p=r.host??{},u=String(p.id??"");if(!/^[a-z][a-z0-9_-]{1,31}$/.test(u))return i("bad_host","host.id is missing or malformed");if(a&&u!==G)return i("origin_mismatch",`a connection from the panel page may only be host ${G}`);if(!this.live.has(u)&&this.live.size>=V)return i("too_many_peers",`at most ${V} panels`);clearTimeout(t),this.live.get(u)?.conn.close(1e3,"replaced by a newer connection"),n=u;let f={id:u,name:String(p.name??u),version:String(p.version??""),platform:String(p.platform??""),capabilities:Array.isArray(r.capabilities)?r.capabilities.map(String):[],optional_verbs:Array.isArray(r.optional_verbs)?r.optional_verbs.map(String):[]};this.live.set(u,{peer:f,conn:e,pending:new Map}),e.send(JSON.stringify({type:"welcome",protocol:k,app:{name:"conformtools",version:$}})),this.waiters=this.waiters.filter(l=>l.host===u?(l.resolve(),!1):!0);return}let c=this.live.get(n);if(!(!c||c.conn!==e))if(r.type==="response"){let i=c.pending.get(String(r.id));if(!i)return;if(c.pending.delete(String(r.id)),clearTimeout(i.timer),r.ok)i.resolve(r.result??null);else{let p=r.error??{};i.reject(new b(p.code??"peer_error",`${n}: ${p.message??p.code??"error"}`))}}else r.type==="event"&&(this.events.push({host:n,name:String(r.name),data:r.data}),this.events.length>200&&this.events.shift())}),e.onClose(()=>{if(clearTimeout(t),!n)return;let s=this.live.get(n);if(s?.conn===e){for(let r of s.pending.values())clearTimeout(r.timer),r.reject(new b("disconnected",`${n}: the panel disconnected`));this.live.delete(n)}})}},E=null;function Pe(){return E??=(async()=>{let o=new H;return await o.start(),o})(),E.catch(()=>{E=null}),E}function ke(){E=null}export{$ as a,Q as b,q as c,ee as d,ve as e,de as f,k as g,re as h,b as i,_ as j,B as k,X as l,H as m,Pe as n,ke as o};
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{a as fe,b as mt}from"./chunk-7SENYEIV.js";import{a as ut}from"./chunk-TXQR2HI2.js";import{K as ct,O as lt}from"./chunk-H6WZ43NS.js";import{f as pt}from"./chunk-LGUO7PL5.js";import{b as Pe,d as it}from"./chunk-NU3X7P4N.js";import{B as tt,D as pe,H as G,I as rt,L as me,R as nt,S as ot,V as st,W as de,Y as I,b as j,g as V,h as Qe,l as Te,o as Ye,p as Xe,r as ae,s as ce,u as le,v as Ze,w as et,x as ue,y as Q}from"./chunk-PLRB2YXJ.js";import{M as at,S as Y}from"./chunk-C2ESM27Z.js";function dt(r,e){let t=async()=>{throw new Error(`${r}: ${e}`)},n={ok:!1,reason:e};return{host:r,wired:!1,support:async()=>({export:n,open:n,render:n,markers:n,renderplugin:n}),export:t,open:t,renderStart:t,renderStatus:t,renderCancel:t}}var Vt=ArrayBuffer,O=Uint8Array,ge=Uint16Array,Gt=Int16Array;var he=Int32Array,Ee=function(r,e,t){if(O.prototype.slice)return O.prototype.slice.call(r,e,t);(e==null||e<0)&&(e=0),(t==null||t>r.length)&&(t=r.length);var n=new O(t-e);return n.set(r.subarray(e,t)),n},Z=function(r,e,t,n){if(O.prototype.fill)return O.prototype.fill.call(r,e,t,n);for((t==null||t<0)&&(t=0),(n==null||n>r.length)&&(n=r.length);t<n;++t)r[t]=e;return r},qt=function(r,e,t,n){if(O.prototype.copyWithin)return O.prototype.copyWithin.call(r,e,t,n);for((t==null||t<0)&&(t=0),(n==null||n>r.length)&&(n=r.length);t<n;)r[e++]=r[t++]};var zt=["invalid zstd data","window size too large (>2046MB)","invalid block type","FSE accuracy too high","match distance too far back","unexpected EOF"],$=function(r,e,t){var n=new Error(e||zt[r]);if(n.code=r,Error.captureStackTrace&&Error.captureStackTrace(n,$),!t)throw n;return n},ft=function(r,e,t){for(var n=0,o=0;n<t;++n)o|=r[e++]<<(n<<3);return o},Jt=function(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16|r[e+3]<<24)>>>0},Wt=function(r,e){var t=r[0]|r[1]<<8|r[2]<<16;if(t==3126568&&r[3]==253){var n=r[4],o=n>>5&1,s=n>>2&1,i=n&3,m=n>>6;n&8&&$(0);var a=6-o,c=i==3?4:i,u=ft(r,a,c);a+=c;var d=m?1<<m:o,f=ft(r,a,d)+(m==1&&256),h=f;if(!o){var l=1<<10+(r[5]>>3);h=l+(l>>3)*(r[5]&7)}h>2145386496&&$(1);var p=new O((e==1?f||h:e?0:h)+12);return p[0]=1,p[4]=4,p[8]=8,{b:a+d,y:0,l:0,d:u,w:e&&e!=1?e:p.subarray(12),e:h,o:new he(p.buffer,0,3),u:f,c:s,m:Math.min(131072,h)}}else if((t>>4|r[3]<<20)==25481893)return Jt(r,4)+8;$(0)},H=function(r){for(var e=0;1<<e<=r;++e);return e-1},ee=function(r,e,t){var n=(e<<3)+4,o=(r[e]&15)+5;o>t&&$(3);for(var s=1<<o,i=s,m=-1,a=-1,c=-1,u=s,d=new Vt(512+(s<<2)),f=new Gt(d,0,256),h=new ge(d,0,256),l=new ge(d,512,s),p=512+(s<<1),g=new O(d,p,s),S=new O(d,p+s);m<255&&i>0;){var _=H(i+1),v=n>>3,A=(1<<_+1)-1,x=(r[v]|r[v+1]<<8|r[v+2]<<16)>>(n&7)&A,b=(1<<_)-1,w=A-i-1,T=x&b;if(T<w?(n+=_,x=T):(n+=_+1,x>b&&(x-=w)),f[++m]=--x,x==-1?(i+=x,g[--u]=m):i-=x,!x)do{var P=n>>3;a=(r[P]|r[P+1]<<8)>>(n&7)&3,n+=2,m+=a}while(a==3)}(m>255||i)&&$(0);for(var E=0,N=(s>>1)+(s>>3)+3,C=s-1,M=0;M<=m;++M){var y=f[M];if(y<1){h[M]=-y;continue}for(c=0;c<y;++c){g[E]=M;do E=E+N&C;while(E>=u)}}for(E&&$(0),c=0;c<s;++c){var k=h[g[c]]++,L=S[c]=o-H(k);l[c]=(k<<L)-s}return[n+7>>3,{b:o,s:g,n:S,t:l}]},Kt=function(r,e){var t=0,n=-1,o=new O(292),s=r[e],i=o.subarray(0,256),m=o.subarray(256,268),a=new ge(o.buffer,268);if(s<128){var c=ee(r,e+1,6),u=c[0],d=c[1];e+=s;var f=u<<3,h=r[e];h||$(0);for(var l=0,p=0,g=d.b,S=g,_=(++e<<3)-8+H(h);_-=g,!(_<f);){var v=_>>3;if(l+=(r[v]|r[v+1]<<8)>>(_&7)&(1<<g)-1,i[++n]=d.s[l],_-=S,_<f)break;v=_>>3,p+=(r[v]|r[v+1]<<8)>>(_&7)&(1<<S)-1,i[++n]=d.s[p],g=d.n[l],l=d.t[l],S=d.n[p],p=d.t[p]}++n>255&&$(0)}else{for(n=s-127;t<n;t+=2){var A=r[++e];i[t]=A>>4,i[t+1]=A&15}++e}var x=0;for(t=0;t<n;++t){var b=i[t];b>11&&$(0),x+=b&&1<<b-1}var w=H(x)+1,T=1<<w,P=T-x;for(P&P-1&&$(0),i[n++]=H(P)+1,t=0;t<n;++t){var b=i[t];++m[i[t]=b&&w+1-b]}var E=new O(T<<1),N=E.subarray(0,T),C=E.subarray(T);for(a[w]=0,t=w;t>0;--t){var M=a[t];Z(C,t,M,a[t-1]=M+m[t]*(1<<w-t))}for(a[0]!=T&&$(0),t=0;t<n;++t){var y=i[t];if(y){var k=a[y];Z(N,t,k,a[y]=k+(1<<w-y))}}return[e,{n:C,b:w,s:N}]},Qt=ee(new O([81,16,99,140,49,198,24,99,12,33,196,24,99,102,102,134,70,146,4]),0,6)[1],Yt=ee(new O([33,20,196,24,99,140,33,132,16,66,8,33,132,16,66,8,33,68,68,68,68,68,68,68,68,36,9]),0,6)[1],Xt=ee(new O([32,132,16,66,102,70,68,68,68,68,36,73,2]),0,5)[1],gt=function(r,e){for(var t=r.length,n=new he(t),o=0;o<t;++o)n[o]=e,e+=1<<r[o];return n},Oe=new O(new he([0,0,0,0,16843009,50528770,134678020,202050057,269422093]).buffer,0,36),Zt=gt(Oe,0),Me=new O(new he([0,0,0,0,0,0,0,0,16843009,50528770,117769220,185207048,252579084,16]).buffer,0,53),er=gt(Me,3),X=function(r,e,t){var n=r.length,o=e.length,s=r[n-1],i=(1<<t.b)-1,m=-t.b;s||$(0);for(var a=0,c=t.b,u=(n<<3)-8+H(s)-c,d=-1;u>m&&d<o;){var f=u>>3,h=(r[f]|r[f+1]<<8|r[f+2]<<16)>>(u&7);a=(a<<c|h)&i,e[++d]=t.s[a],u-=c=t.n[a]}(u!=m||d+1!=o)&&$(0)},tr=function(r,e,t){var n=6,o=e.length,s=o+3>>2,i=s<<1,m=s+i;X(r.subarray(n,n+=r[0]|r[1]<<8),e.subarray(0,s),t),X(r.subarray(n,n+=r[2]|r[3]<<8),e.subarray(s,i),t),X(r.subarray(n,n+=r[4]|r[5]<<8),e.subarray(i,m),t),X(r.subarray(n),e.subarray(m),t)},rr=function(r,e,t){var n,o=e.b,s=r[o],i=s>>1&3;e.l=s&1;var m=s>>3|r[o+1]<<5|r[o+2]<<13,a=(o+=3)+m;if(i==1)return o>=r.length?void 0:(e.b=o+1,t?(Z(t,r[o],e.y,e.y+=m),t):Z(new O(m),r[o]));if(!(a>r.length)){if(i==0)return e.b=a,t?(t.set(r.subarray(o,a),e.y),e.y+=m,t):Ee(r,o,a);if(i==2){var c=r[o],u=c&3,d=c>>2&3,f=c>>4,h=0,l=0;u<2?d&1?f|=r[++o]<<4|(d&2&&r[++o]<<12):f=c>>3:(l=d,d<2?(f|=(r[++o]&63)<<4,h=r[o]>>6|r[++o]<<2):d==2?(f|=r[++o]<<4|(r[++o]&3)<<12,h=r[o]>>2|r[++o]<<6):(f|=r[++o]<<4|(r[++o]&63)<<12,h=r[o]>>6|r[++o]<<2|r[++o]<<10)),++o;var p=t?t.subarray(e.y,e.y+e.m):new O(e.m),g=p.length-f;if(u==0)p.set(r.subarray(o,o+=f),g);else if(u==1)Z(p,r[o++],g);else{var S=e.h;if(u==2){var _=Kt(r,o);h+=o-(o=_[0]),e.h=S=_[1]}else S||$(0);(l?tr:X)(r.subarray(o,o+=h),p.subarray(g),S)}var v=r[o++];if(v){v==255?v=(r[o++]|r[o++]<<8)+32512:v>127&&(v=v-128<<8|r[o++]);var A=r[o++];A&3&&$(0);for(var x=[Yt,Xt,Qt],b=2;b>-1;--b){var w=A>>(b<<1)+2&3;if(w==1){var T=new O([0,0,r[o++]]);x[b]={s:T.subarray(2,3),n:T.subarray(0,1),t:new ge(T.buffer,0,1),b:0}}else w==2?(n=ee(r,o,9-(b&1)),o=n[0],x[b]=n[1]):w==3&&(e.t||$(0),x[b]=e.t[b])}var P=e.t=x,E=P[0],N=P[1],C=P[2],M=r[a-1];M||$(0);var y=(a<<3)-8+H(M)-C.b,k=y>>3,L=0,re=(r[k]|r[k+1]<<8)>>(y&7)&(1<<C.b)-1;k=(y-=N.b)>>3;var ne=(r[k]|r[k+1]<<8)>>(y&7)&(1<<N.b)-1;k=(y-=E.b)>>3;var oe=(r[k]|r[k+1]<<8)>>(y&7)&(1<<E.b)-1;for(++v;--v;){var Ae=C.s[re],qe=C.n[re],Re=E.s[oe],ze=E.n[oe],Je=N.s[ne],We=N.n[ne];k=(y-=Je)>>3;var Ke=1<<Je,U=Ke+((r[k]|r[k+1]<<8|r[k+2]<<16|r[k+3]<<24)>>>(y&7)&Ke-1);k=(y-=Me[Re])>>3;var J=er[Re]+((r[k]|r[k+1]<<8|r[k+2]<<16)>>(y&7)&(1<<Me[Re])-1);k=(y-=Oe[Ae])>>3;var se=Zt[Ae]+((r[k]|r[k+1]<<8|r[k+2]<<16)>>(y&7)&(1<<Oe[Ae])-1);if(k=(y-=qe)>>3,re=C.t[re]+((r[k]|r[k+1]<<8)>>(y&7)&(1<<qe)-1),k=(y-=ze)>>3,oe=E.t[oe]+((r[k]|r[k+1]<<8)>>(y&7)&(1<<ze)-1),k=(y-=We)>>3,ne=N.t[ne]+((r[k]|r[k+1]<<8)>>(y&7)&(1<<We)-1),U>3)e.o[2]=e.o[1],e.o[1]=e.o[0],e.o[0]=U-=3;else{var ie=U-(se!=0);ie?(U=ie==3?e.o[0]-1:e.o[ie],ie>1&&(e.o[2]=e.o[1]),e.o[1]=e.o[0],e.o[0]=U):U=e.o[0]}for(var b=0;b<se;++b)p[L+b]=p[g+b];L+=se,g+=se;var W=L-U;if(W<0){var K=-W,Bt=e.e+W;K>J&&(K=J);for(var b=0;b<K;++b)p[L+b]=e.w[Bt+b];L+=K,J-=K,W=0}for(var b=0;b<J;++b)p[L+b]=p[W+b];L+=J}if(L!=g)for(;g<p.length;)p[L++]=p[g++];else L=p.length;t?e.y+=L:p=Ee(p,0,L)}else if(t){if(e.y+=f,g)for(var b=0;b<f;++b)p[b]=p[g+b]}else g&&(p=Ee(p,g));return e.b=a,p}$(2)}},nr=function(r,e){if(r.length==1)return r[0];for(var t=new O(e),n=0,o=0;n<r.length;++n){var s=r[n];t.set(s,o),o+=s.length}return t};function we(r,e){for(var t=[],n=+!e,o=0,s=0;r.length;){var i=Wt(r,n||e);if(typeof i=="object"){for(n?(e=null,i.w.length==i.u&&(t.push(e=i.w),s+=i.u)):(t.push(e),i.e=0);!i.l;){var m=rr(r,i,e);m||$(5),e?i.e=i.y:(t.push(m),s+=m.length,qt(i.w,0,m.length),i.w.set(m,i.w.length-m.length))}o=i.b+i.c*4}else o=i;r=r.subarray(o)}return nr(t,s)}function D(r){let e=[],t=0,n=()=>{let s=0,i=1;for(;;){let m=r[t++];if(s+=(m&127)*i,i*=128,!(m&128))return s}},o=s=>Array.from(s,i=>i.toString(16).padStart(2,"0")).join("");for(;t<r.length;){let s=t,i=n(),m=Math.floor(i/8),a=i&7,c;if(a===0){let u=t;n(),c=r.slice(u,t)}else if(a===2){let u=n();c=r.slice(t,t+u),t+=u}else if(a===5)c=r.slice(t,t+4),t+=4;else if(a===1)c=r.slice(t,t+8),t+=8;else throw new Error(`wire type ${a}`);e.push([m,a,o(r.slice(s,t)),c])}return e}var or=r=>Array.from(r,e=>e.toString(16).padStart(2,"0")).join(""),yt=r=>Uint8Array.from(r.match(/../g)??[],e=>parseInt(e,16));function ye(r){let e=r.trim().toLowerCase();if(e.startsWith("80"))return e;if(e.startsWith("81"))return"80"+or(we(yt(e.slice(2))));throw new Error(`grade body: unknown encoding 0x${e.slice(0,2)}`)}function ht(r){let e={};for(let t of r.matchAll(/<ListMgt::LmVersion DbId="[^"]+">([\s\S]*?)<\/ListMgt::LmVersion>/g)){let n=/<Name>([^<]*)<\/Name>/.exec(t[1])?.[1],o=/<Body>([0-9a-fA-F]+)<\/Body>/.exec(t[1])?.[1];n&&o&&(e[n]=ye(o))}return e}function wt(r){let e=new Map;for(let t of r.matchAll(/<ListMgt::LmVersion DbId="([^"]+)">([\s\S]*?)<\/ListMgt::LmVersion>/g)){let n=/<Body>([0-9a-fA-F]+)<\/Body>/.exec(t[2])?.[1];n&&e.set(t[1],ye(n))}return e}function _t(r){let e=Y(r),t=c=>new TextDecoder().decode(e[c]),n=Object.keys(e).find(c=>c.startsWith("SeqContainer/")&&c.endsWith(".xml"));if(!n)throw new Error("grade bodies: no SeqContainer in the .drt");let o=new Map,s=new Map,i=Object.keys(e).filter(c=>c.startsWith("MediaPool/")&&c.endsWith(".xml"));for(let c of i)for(let u of t(c).matchAll(/<Sm2MpVideoClip DbId="([^"]+)">([\s\S]*?)<\/Sm2MpVideoClip>/g)){let d=/<pLmVerTable>([\s\S]*?)<\/pLmVerTable>/.exec(u[2]);d&&(o.set(u[1],ht(d[1])),s.set(u[1],wt(d[1])))}let m=new Map,a=0;for(let c of t(n).matchAll(/<Sm2TiTrack DbId="[^"]+">([\s\S]*?)<\/Sm2TiTrack>/g))if(/<Type>([^<]*)<\/Type>/.exec(c[1])?.[1]==="0"){a++;for(let u of c[1].matchAll(/<Sm2TiVideoClip DbId="[^"]+">([\s\S]*?)<\/Sm2TiVideoClip>/g)){let d=u[1],f=/<Start>(-?\d+)<\/Start>/.exec(d)?.[1],h=/<Name>([^<]*)<\/Name>/.exec(d)?.[1]??"";if(f===void 0)continue;let l=/<pLmVerTable>([\s\S]*?)<\/pLmVerTable>/.exec(d),p=/<MediaRef>([^<]+)<\/MediaRef>/.exec(d)?.[1],g=l&&/<pActive>([^<]+)<\/pActive>/.exec(l[1])?.[1],S=g?wt(l[1]).get(g)??(p?s.get(p)?.get(g):void 0):void 0;m.set(`${a}:${f}`,{name:h,local:l?ht(l[1]):{},remote:p&&o.get(p)||{},...S?{active:S}:{}})}}return m}function on(r){let e=a=>D(a),t=a=>{let c=0,u=1;for(let d of a)if(c+=(d&127)*u,u*=128,!(d&128))break;return c},n=e(yt(r.slice(2))).find(a=>a[0]===3&&a[1]===2&&e(a[3]).some(c=>c[0]===8&&t(c[3])===84)),s=(n?e(n[3]).filter(a=>a[0]===9).flatMap(a=>e(a[3])):[]).find(a=>a[0]===1&&a[1]===2&&e(a[3]).some(c=>c[0]===1&&c[1]===0&&t(c[3])===10));return s?e(s[3]).filter(a=>a[0]===6&&a[1]===2).map(a=>{let c=e(a[3]),u=t(c.find(h=>h[0]===1&&h[1]===0)?.[3]??new Uint8Array([0]))/2,d=c.find(h=>h[0]===2&&h[1]===2)?.[3]??new Uint8Array,f={t:u,zoom:1,height:1,rotation:0,pan:0,tilt:0,flip_x:!1,flip_y:!1};for(let h of e(d)){if(h[0]===5&&h[1]===2){let A=e(h[3]);f.ease_in=t(A.find(x=>x[0]===1)?.[3]??new Uint8Array([1])),f.ease_out=t(A.find(x=>x[0]===2)?.[3]??new Uint8Array([1]));continue}if(h[0]!==3||h[1]!==2)continue;let l=e(h[3]),p=t(l.find(A=>A[0]===1)?.[3]??new Uint8Array),g=l.find(A=>A[0]===2)?.[3],S=g&&e(g).find(A=>A[0]===1&&A[1]===5),_=g&&e(g).find(A=>A[0]===2&&A[1]===0),v=S?new DataView(S[3].buffer,S[3].byteOffset,4).getFloat32(0,!0):_?t(_[3]):void 0;v!==void 0&&(p===271581186?f.height=v:p===271581187?f.zoom=v:p===271581188?f.rotation=v:p===271581189?f.pan=v:p===271581190?f.tilt=v:p===271581191?f.flip_y=!!v:p===271581192&&(f.flip_x=!!v))}return f}).sort((a,c)=>a.t-c.t):[]}var sr=r=>Array.from(r,e=>e.toString(16).padStart(2,"0")).join(""),B=r=>Uint8Array.from(r.match(/../g)??[],e=>parseInt(e,16)),bt=r=>{let e=[];do e.push(r&127|(r>127?128:0)),r=Math.floor(r/128);while(r);return e};function St(r){let e=B(r.trim());if(e.length<9)throw new Error("EffectFiltersBA: too short");if(e[8]===128)return e.slice(9);if(e[8]===129)return we(e.slice(9));throw new Error(`EffectFiltersBA: unknown encoding 0x${e[8].toString(16)}`)}function ir(r){let e=new Uint8Array(9);return new DataView(e.buffer).setUint32(0,2),new DataView(e.buffer).setUint32(4,r.length+1),e[8]=128,sr(new Uint8Array([...e,...r]))}var $e=r=>{let e=D(r).find(t=>t[0]===1&&t[1]===0);return e?ar(e[3]):-1};function ar(r){let e=0,t=1;for(let n of r)if(e+=(n&127)*t,t*=128,!(n&128))break;return e}var Ne=(r,e)=>new Uint8Array([...bt(r<<3|2),...bt(e.length),...e]);function cr(r,e){let t=new DataView(r.buffer,r.byteOffset,r.byteLength),n=-t.getInt32(0)/16;if(!Number.isInteger(n)||n<2||r.length!==4+n*16||r[10]!==12)return r;let o=Array.from({length:n},(a,c)=>({frame:t.getUint32(4+c*16,!0),value:t.getFloat64(4+c*16+8,!0)})),s=o.map(a=>e(a.frame));if(!s.slice(0,-1).some(Boolean))return r;let i=new Uint8Array(4+n*64),m=new DataView(i.buffer);return m.setInt32(0,-(n*64)),o.forEach((a,c)=>{let u=4+c*64;m.setUint32(u,a.frame,!0),i[u+6]=13,m.setFloat64(u+8,a.value,!0);let d=c>0?s[c-1]:void 0,f=c<n-1?s[c]:void 0;d&&m.setFloat64(u+16,-(d.in/10)*(a.frame-o[c-1].frame),!0),f&&m.setFloat64(u+32,f.out/10*(o[c+1].frame-a.frame),!0)}),i}function lr(r,e){let t=[];for(let n of D(r))if(n[0]===9&&n[1]===2&&n[3].length){let o=D(n[3]).map(s=>s[0]===10&&s[1]===2?[...Ne(10,cr(s[3],e))]:[...B(s[2])]).flat();t.push(...Ne(9,new Uint8Array(o)))}else t.push(...B(n[2]));return new Uint8Array(t)}function ur(r){let e=[];for(let t of D(r)){if(t[0]!==9||t[1]!==2||!t[3].length)continue;let n=D(t[3]).find(i=>i[0]===10&&i[1]===2)?.[3];if(!n||n.length<4)continue;let o=new DataView(n.buffer,n.byteOffset,n.byteLength),s=-o.getInt32(0)/16;Number.isInteger(s)&&s>e.length&&n.length===4+s*16&&Array.from({length:s},(i,m)=>n[4+m*16+6]).every(i=>i===12)&&(e=Array.from({length:s},(i,m)=>o.getUint32(4+m*16,!0)))}return e}function pr(r,e){let t=D(e).find(s=>s[0]===1&&s[1]===2&&$e(s[3])===4);if(!t)throw new Error("the written clip carries no Transform group");let n=[],o=!1;for(let s of r?D(r):[]){if(s[0]===1&&s[1]===2&&$e(s[3])===4){o||(n.push(...B(t[2])),o=!0);continue}n.push(...B(s[2]))}return o||n.push(...B(t[2])),new Uint8Array(n)}function vt(r){let e=[],t=0;for(let n of r.matchAll(/<Sm2TiTrack DbId="[^"]+">([\s\S]*?)<\/Sm2TiTrack>/g)){if(/<Type>([^<]*)<\/Type>/.exec(n[1])?.[1]!=="0")continue;t++;let o=n.index+n[0].indexOf(n[1]);for(let s of n[1].matchAll(/<Sm2TiVideoClip DbId="[^"]+">([\s\S]*?)<\/Sm2TiVideoClip>/g)){let i=/<Start>(-?\d+)<\/Start>/.exec(s[1])?.[1];i!==void 0&&e.push({track:t,start:Number(i),at:o+s.index,end:o+s.index+s[0].length,body:s[0]})}}return e}var kt=r=>Object.keys(r).find(e=>e.startsWith("SeqContainer/")&&e.endsWith(".xml"));function xt(r,e,t,n){let o=Y(r),s=Y(e),i=kt(o),m=kt(s);if(!i||!m)throw new Error("no SeqContainer in the .drt");let a=new TextDecoder().decode(o[i]),c=vt(a),u=vt(new TextDecoder().decode(s[m])),d=[],f=[],h=[];for(let p of t){let g=`V${p.item.track}@${p.item.start}`,S=c.find(y=>y.track===p.item.track&&y.start===p.item.start+n),_=S?c.filter(y=>y.track===S.track).indexOf(S):-1,v=_>=0?u.filter(y=>y.track===p.item.track)[_]:void 0,A=v&&/<EffectFiltersBA>([0-9a-fA-F]+)<\/EffectFiltersBA>/.exec(v.body)?.[1];if(!S||!A){f.push(g);continue}let x=/<EffectFiltersBA>([0-9a-fA-F]*)<\/EffectFiltersBA>/.exec(S.body),b=D(St(A)),w=b.find(y=>y[0]===1&&y[1]===2&&$e(y[3])===4),T=w?ur(w[3]):[];if(T.length!==p.keys.length){f.push(`${g} (the engine wrote ${T.length} keys for ${p.keys.length})`);continue}let P=new Map(T.map((y,k)=>[y,p.keys[k].shape])),E=new Uint8Array(b.flatMap(y=>y===w?[...Ne(1,lr(y[3],k=>P.get(k)))]:[...B(y[2])])),N=pr(x?.[1]?St(x[1]):null,E),C=`<EffectFiltersBA>${ir(N)}</EffectFiltersBA>`,M=x?S.body.replace(x[0],C):S.body.replace(/(<\/Sm2TiVideoClip>)$/,`${C}$1`);h.push({at:S.at,end:S.end,body:M}),d.push(g)}for(let p of h.sort((g,S)=>S.at-g.at))a=a.slice(0,p.at)+p.body+a.slice(p.end);let l={...o,[i]:new TextEncoder().encode(a)};return{drt:at(l),keyed:d,missing:f}}function At(r,e,t){let n=r.source_range,o=r.timeline_range,s=n?.start.rate||t,i=n?.start.value??0,m=n?.duration&&o?.duration&&o.duration.value?n.duration.value/n.duration.rate/(o.duration.value/o.duration.rate)*s/t:s/t,a=[],c=0;for(let f of e){let h={value:i+f.t*m,rate:s},l=(p,g)=>a.push({id:`${r.id}-align-${c++}`,parameter_path:p,time:h,value:g,interp:"linear"});l("scale",f.transform.scale_x),e.some(p=>Math.abs(p.transform.scale_y-p.transform.scale_x)>.001)&&l("scale.y",f.transform.scale_y),l("position.x",f.transform.position_x),l("position.y",f.transform.position_y),l("rotation",f.transform.rotation)}let u=e[0].transform,d=(r.keyframes??[]).filter(f=>!/^(scale|position|rotation)/.test(String(f.parameter_path)));Object.assign(r,{scale:u.scale_x,position_x:u.position_x,position_y:u.position_y,rotation:u.rotation,keyframes:[...d,...a]}),Math.abs(u.scale_y-u.scale_x)>.001&&Object.assign(r,{scale_x:u.scale_x,scale_y:u.scale_y}),u.flip_h?r.flip_horizontal=!0:delete r.flip_horizontal,u.flip_v?r.flip_vertical=!0:delete r.flip_vertical}function Tt(r=V()){if(r==="win32"){let e=j("PROGRAMDATA")??"C:\\ProgramData",t=j("PROGRAMFILES")??"C:\\Program Files";return{api:`${e}\\Blackmagic Design\\DaVinci Resolve\\Support\\Developer\\Scripting`,lib:`${t}\\Blackmagic Design\\DaVinci Resolve\\fusionscript.dll`}}return r==="linux"?{api:"/opt/resolve/Developer/Scripting",lib:"/opt/resolve/libs/Fusion/fusionscript.so"}:{api:"/Library/Application Support/Blackmagic Design/DaVinci Resolve/Developer/Scripting",lib:"/Applications/DaVinci Resolve/DaVinci Resolve.app/Contents/Libraries/Fusion/fusionscript.so"}}async function mr(r){let e=j("RESOLVE_SCRIPT_LIB");if(e)return e;if(r==="darwin"){let n=(await me("ps",["-axo","comm="])).stdout.split(`
4
- `).map(o=>o.trim()).find(o=>/\/Contents\/MacOS\/Resolve$/.test(o));if(n){let o=n.replace(/\/MacOS\/Resolve$/,"/Libraries/Fusion/fusionscript.so");if(await ae(o))return o}}return Tt(r).lib}async function dr(){for(let r of["./bridge.py","./resolve-bridge.py"]){let e=Xe(new URL(r,import.meta.url));if(await ce(e))return e}throw new Error("resolve: bridge.py is missing from this install")}var Ce=new Map;function fr(r){return Ce.has(r)||Ce.set(r,me(r,["-c","import sys; print(sys.base_prefix)"],{timeoutMs:2e4}).then(e=>e.stdout.trim().split(`
5
- `).pop()||void 0).catch(()=>{})),Ce.get(r)}var gr=["PYTHON3HOME","FUSION_PYTHON3HOME","FUSION_PYTHON3_HOME","FUSION_PYTHON36_HOME"],hr=async(r,e,t)=>{let n=V(),{api:o}=Tt(n),s=Qe(),i=n==="win32"?await fr(s):void 0,m=await G("ct-bridge-"),a=I(m,"args.json"),c;try{await ue(a,JSON.stringify(e)),c=await me(s,[await dr(),r,`@${a}`],{env:{RESOLVE_SCRIPT_API:j("RESOLVE_SCRIPT_API")??o,RESOLVE_SCRIPT_LIB:await mr(n),PYTHONPATH:I(j("RESOLVE_SCRIPT_API")??o,"Modules"),...i?Object.fromEntries(gr.map(d=>[d,i])):{}},timeoutMs:t})}finally{await pe(m).catch(()=>{})}let u=c.stdout.trim().split(`
6
- `).pop()??"";try{return JSON.parse(u)}catch{return{ok:!1,why:"bridge",detail:c.code==="ENOENT"||/Microsoft Store/.test(c.stderr)?`${s} is not installed (Resolve's scripting needs Python 3: python.org)`:c.stderr.trim().split(`
7
- `).pop()||(typeof c.code=="string"?`the Resolve bridge could not start: ${c.code}`:`no answer from Resolve within ${Math.round(t/1e3)} s`)}}},q=class extends Error{constructor(t,n){super(n);this.why=t}},wr={module:"Install DaVinci Resolve (its scripting module ships with it).",no_connection:"Start Resolve and set Preferences > System > General > External scripting using: Local (Resolve Studio).",no_project:"Open a project in Resolve."},_e=class{constructor(e=hr){this.runner=e;this.host="resolve";this.restore=new Map;this.startNotes=new Map}async call(e,t={},n=6e4){let o=await this.runner(e,t,n);if(o.ok)return o;throw o.why==="resolve_error"&&/NoneType' object is not callable/.test(String(o.detail))&&!(await this.runner("version",{},1e4)).ok?new q("host_quit",`resolve: Resolve stopped responding during ${e} (it may have quit; see its log, ResolveDebug.txt). Restart Resolve and try again.`):new q(o.why??"unknown",`resolve: ${o.detail||o.why}`)}async support(){let e=await this.runner("version",{},15e3),t=e.ok?e.product==="DaVinci Resolve Studio"?{ok:!0}:{ok:!1,reason:`${e.product} has no external scripting (Resolve Studio has)`}:{ok:!1,reason:e.detail??String(e.why),setup:wr[e.why??""]},n=t;if(t.ok){let o=await ut();n=o.readiness==="ready"||o.readiness==="unknown"?{ok:!0}:{ok:!1,reason:`renderplugin: ${o.readiness}`,setup:o.next}}return{export:t,open:t,render:t,markers:t,renderplugin:n}}async current(){return await this.call("current")}async project(e){return await this.call("project",e,12e4)}async clipLut(e){return await this.call("clip_lut",e,6e4)}async items(e){return await this.call("items",e,e.selected?15e3:12e4)}async apply(e){let t=e.ops.filter(o=>o.op==="edit_keys");if(t.length){let o=e.ops.filter(a=>a.op!=="edit_keys"),s=o.length?await this.apply({...e,ops:o}):{project:"",timeline:e.timeline??"",results:[],undo:[],applied:0,failed:0},i=await this.alignedCopy(e,t),m=i.results.filter(a=>a.ok).length;return{...s,project:s.project||i.project,timeline:s.timeline||i.timeline,results:[...s.results,...i.results],applied:s.applied+m,failed:s.failed+i.results.length-m}}let n=e.ops.filter(o=>(o.op==="grade_sizing"&&(o.target==="input"||o.target==="node")&&!o.reset||o.op==="node_structure")&&o.item&&"track"in o.item);for(let o of n){let s=o.node_structure??o.structure_path;if(!s)continue;let i=/<Body>([0-9a-fA-F]+)<\/Body>/.exec(new TextDecoder().decode(await le(s)))?.[1];if(!i)throw new q("usage",`${s}: not a Resolve grade still (.drx with a <Body>)`);o.structure=ye(i),o.structure_name=s}if(n.length){let{grades:o,t0:s}=await this.grades(e.timeline,e.into?{into:e.into,scratch_project:e.scratch_project}:{}),i=m=>{let a=m.item;return o.get(`${a.track}:${a.start+s}`)};for(let m of n){let a=i(m);a&&(m.bodies={local:a.local,remote:a.remote})}}return await this.call("apply",e,6e4+e.ops.length*200)}async alignedCopy(e,t){let n=e.into?{into:e.into,scratch_project:e.scratch_project}:{},o=await G("ct-aligned-"),s=i=>({project:"",timeline:e.timeline??"",results:t.map(()=>({op:"edit_keys",ok:!1,refused:["aligned copy"],detail:`refused: ${i}; nothing changed`}))});try{let i=I(o,"export.drt"),m=await this.call("export",{timeline:e.timeline,out_path:i,...n}),a=String(m.timeline),c=Number(m.start_frame??0),{session:u}=await lt(i,"drt"),d=u.timelines[0],f=(d.fps_num??24)/(d.fps_den??1),h=d.tracks.filter(w=>String(w.kind).toLowerCase()==="video"),l=w=>Math.round(w.value*f/w.rate),p=[],g=[];for(let w of t){let T=h[w.item.track-1]?.items.find(P=>{let E=P.timeline_range?.start;return E&&[w.item.start,w.item.start+c].includes(l(E))});T?(At(T,w.keys,f),p.push(w)):g.push(`V${w.item.track}@${w.item.start}`)}let S=await ct("resolve-drt",u),_=typeof S.body=="string"?new TextEncoder().encode(S.body):S.body,v=xt(await le(i),_,p,c);if(!v.keyed.length)return s(`no clip could be keyed (${[...g,...v.missing].join(", ")})`);let A=I(o,`${a.replace(/[^\w.-]+/g,"_").slice(0,100)}_ALIGNED.drt`);await et(A,v.drt);let x=await this.call("open",{path:A,name:`${a} ALIGNED`,link_existing:!0,same_as:a,...n}),b=new Map([...g.map(w=>[w,"not found in the timeline's export"]),...v.missing.map(w=>[w.split(" ")[0],w])]);return{project:String(x.project??""),timeline:String(x.timeline??""),results:t.map(w=>{let T=`V${w.item.track}@${w.item.start}`;return b.has(T)?{op:"edit_keys",ok:!1,refused:["not keyed"],detail:`refused: ${b.get(T)}; nothing changed`}:{op:"edit_keys",ok:!0,detail:`${w.keys.length} Edit-page keyframes on "${x.timeline}" (a copy of "${a}" with every grade and setting; "${a}" itself unchanged)`}})}}catch(i){return s(i instanceof Error?i.message:String(i))}finally{await pe(o).catch(()=>{})}}async grades(e,t){let n=await G("ct-grades-");try{let o=I(n,"grades.drt"),s=await this.call("export",{timeline:e,out_path:o,...t});return{grades:await le(o).then(_t).catch(()=>new Map),t0:Number(s.start_frame??0)}}finally{await pe(n).catch(()=>{})}}async presets(e){return await this.call("presets",e,12e4)}async presetAuthor(e){return await this.call("preset_author",e,6e4)}async export(e){if(!e.out_path)throw new q("usage","resolve: export needs out_path");let t=await this.call("export",{timeline:e.timeline,out_path:e.out_path,...e.clip_id?{clip_id:e.clip_id}:{}});return{path:String(t.path),format:"drt",project:String(t.project),timeline:String(t.timeline)}}async open(e){let t=await this.call("open",{path:e.path,into:e.into??"current",name:e.name,media_dir:e.media_dirs?.[0],stay:e.stay??!1,folder:e.folder,create_folder:e.create_folder??!1,link_existing:e.link_existing??!1},3e5),n=[...t.notes??[]];return(e.media_dirs?.length??0)>1&&n.push(`Resolve searches one media folder per import; used ${e.media_dirs[0]}`),{project:String(t.project),timeline:String(t.timeline),notes:n,restored:!!t.restored,...t.folder?{folder:String(t.folder)}:{}}}async renderStart(e){let t=await this.call("render_start",{...e}),n=String(t.job_id);this.restore.set(n,t.restore);let o=t.rejected_settings??[];return o.length&&this.startNotes.set(n,[`Resolve refused render setting(s) ${o.join(", ")} for this format; the rest were applied`]),{job_id:n,state:"queued",percent:0}}async renderStatus(e){let t=await this.call("render_status",{job_id:e},15e3),n={job_id:e,state:t.state,percent:Number(t.percent??0)};if(t.error&&(n.error=String(t.error)),n.state==="complete"||n.state==="failed"){let o=await this.call("render_finish",{job_id:e,restore:this.restore.get(e)});this.restore.delete(e),o.output&&(n.outputs=[String(o.output)]);let s=[...this.startNotes.get(e)??[],...o.tracks?[Rt(o)]:[]];this.startNotes.delete(e),s.length&&(n.notes=s)}return n}async renderCancel(e){let t=await this.call("render_cancel",{job_id:e,restore:this.restore.get(e)});return this.restore.delete(e),{job_id:e,state:"cancelled",percent:0,...t.output?{outputs:[String(t.output)]}:{},...t.tracks?{notes:[Rt(t)]}:{}}}},Rt=r=>{let e=r.tracks.map(t=>`V${t}`).join(", ");return r.tracks_restored?`video track(s) ${e} switched back on`:`could NOT switch video track(s) ${e} back on: re-enable them on the Edit page`};async function wn(r,e){let t=[];for await(let n of rt(r))n.isFile&&n.name.startsWith(e)&&t.push(I(r,n.name));return t.sort()}var yr="ws://localhost:1985",Pt="localhost",Et="conform_tools",Ot="conform.tools ",Mt="Video_Full",_r=r=>!!r&&typeof r=="object"&&"_handle"in r&&"_id"in r,z=class extends Error{constructor(t,n){super(n);this.code=t}},Ie=class r{constructor(e){this.ws=e;this.next=1;this.waiting=new Map;e.onMessage(t=>{let n;try{n=JSON.parse(t)}catch{return}let o=typeof n.id=="number"?this.waiting.get(n.id):void 0;if(!o)return;if(this.waiting.delete(n.id),n.error===void 0||n.error===null)return o.ok(n.result??null);let s=n.error;o.no(typeof s=="string"?new z(n.code??-1,s):new z(s.code??n.code??-1,s.message??JSON.stringify(s)))}),e.onClose(()=>{for(let t of this.waiting.values())t.no(new z("closed","Baselight closed the FLAPI connection"));this.waiting.clear()})}static async connect(e,t=3e3){let n=new r(await pt(e,{maxBytes:67108864,timeoutMs:t})),o=await br();return o&&await n.call("authenticate",{username:j("USER")??j("USERNAME")??"conform",token:o},null,t).catch(()=>null),n}call(e,t={},n=null,o=12e4){let s=this.next++;return new Promise((i,m)=>{let a=setTimeout(()=>{this.waiting.delete(s),m(new z("timeout",`${e}: no answer from Baselight within ${Math.round(o/1e3)} s`))},o);this.waiting.set(s,{ok:c=>{clearTimeout(a),i(c)},no:c=>{clearTimeout(a),m(c)}}),this.ws.send(JSON.stringify({jsonrpc:"2.0",method:e,target:n?n._id:null,params:t,id:s}))})}async forget(...e){for(let t of e)_r(t)&&await this.call("forget",{},t).catch(()=>null)}close(){this.ws.close()}};async function br(){let r=j("FLAPI_TOKEN");if(r)return r.trim();let e=V()==="darwin"?I(Te(),"Library","Preferences","FilmLight","flapi-token"):I(Te(),".filmlight","flapi-token");try{return(await Ze(e)).trim()||null}catch{return null}}var $t=(...r)=>Object.fromEntries(r.map(e=>[e,1])),Sr={[-30]:30,[-31]:30,[-32]:30,[-34]:25,[-35]:24};function be(r){if(!r||typeof r!="object")return null;let e=typeof r.fps=="string"?{TC_30DF:-30,TC_60HDF:-31}[r.fps]??Number(r.fps):r.fps,t=e>0?e:Sr[e]??30,n=((r.h*60+r.m)*60+r.s)*t+r.f;if(e!==-30&&e!==-31)return n;let o=r.h*60+r.m;return n-2*(o-Math.floor(o/10))}function vr(r,e,t){let n=Math.round(e),o=r;if(t&&n===30){let c=Math.floor(o/17982),u=o%17982;o+=18*c+(u>2?2*Math.floor((u-2)/1798):0)}let s=o%n,i=Math.floor(o/n)%60,m=Math.floor(o/n/60)%60;return{_type:"timecode",h:Math.floor(o/n/3600)%24,m,s:i,f:s,phase:0,fps:t&&n===30?-30:n,wrap:24}}function Nt(r){let e=Math.round(r);return Math.abs(r-e)<.005?e:Math.abs(r-e*1e3/1001)<.01?e*1e3/1001:r}var F=class extends Error{constructor(t,n){super(`baselight: ${n}`);this.why=t}},kr={darwin:"/Applications/Baselight",linux:"/usr/fl/baselight"},Se=class{constructor(e){this.url=e;this.host="baselight";this.jobs=new Map}async conn(e=3e3){let t=this.url??j("CONFORM_BASELIGHT_URL")??yr;try{return await Ie.connect(t,e)}catch(n){let o=await ae(kr[V()]??"/nonexistent");throw new F(o?"not_running":"not_installed",o?`Baselight is not answering FLAPI at ${t} (${n.message})`:"Baselight is not installed on this machine")}}async with(e){let t=await this.conn();try{return await e(t)}catch(n){throw n instanceof F?n:new F("flapi",n.message)}finally{t.close()}}async support(){let e;try{let t=await this.with(n=>n.call("Application.get_application_info"));e=/baselight|daylight/i.test(t.Product??"")?{ok:!0}:{ok:!1,reason:`the FLAPI server is ${t.Product??"unknown"}, not the Baselight app (port 1984 is the headless flapid)`,setup:"Point CONFORM_BASELIGHT_URL at the running Baselight (ws://localhost:1985)."}}catch(t){let n=t instanceof F?t.why:"flapi";e={ok:!1,reason:t.message.replace(/^baselight: /,""),setup:n==="not_installed"?"Install FilmLight Baselight (FLAPI ships with it; nothing else to install).":"Start Baselight. Its API server listens on port 1985 by default (Preferences > Advanced > API Server)."}}return{export:e,open:e,render:e,markers:{ok:!1,reason:"not wired for Baselight yet (FLAPI has marks: Scene.add_mark)"},renderplugin:{ok:!1,reason:"the renderplugin is a DaVinci Resolve plugin"}}}async scenePath(e,t,n){if(t?.includes(":")){let i=await e.call("Scene.parse_path",{str:t});return{host:i.Host,job:i.Job,scene:i.Scene}}let o=await this.current(e),s=n??o?.job;if(t&&s)return{host:o?.host??Pt,job:s,scene:t};if(!o)throw new F("no_scene",t?`no job to find scene "${t}" in: pass project (the job) or "host:job:scene"`:'no scene is open in Baselight: open one, or name it ("host:job:scene")');return o}async current(e){let t=await e.call("Application.get").catch(()=>null);if(!t)return null;try{let n=await e.call("Application.get_current_scene",{},t);if(!n)return null;try{let o=await e.call("Scene.get_scene_pathname",{},n),[s,i,...m]=o.split(":");return m.length?{host:s,job:i,scene:m.join(":")}:null}finally{await e.forget(n)}}finally{await e.forget(t)}}async export(e){if(!e.out_path)throw new F("usage","export needs out_path");return await this.with(async t=>{let n=await this.scenePath(t,e.timeline),o=await t.call("Scene.open_scene",{scenepath:{Host:n.host,Job:n.job,Scene:n.scene},flags:$t("OPENFLAG_READ_ONLY")});try{let s=await Rr(t,o,n.scene);await Q(de(e.out_path)),await ue(e.out_path,JSON.stringify(s,null,1))}finally{await t.call("Scene.close_scene",{},o).catch(()=>null),await t.forget(o)}return{path:e.out_path,format:"otio",project:n.job,timeline:n.scene}})}async open(e){let{readTimeline:t}=await import("./timeline-GVVL2CBI.js"),{session:n}=await t(e.path),o=n.timelines.find(u=>u.kind!=="compound")??n.timelines[0];if(!o)throw new F("usage",`no timeline in ${e.path}`);let s=new Map((n.media_references??[]).map(u=>[u.id,u])),i=o.fps_num/o.fps_den,m=o.tracks.filter(u=>u.kind==="Video").sort((u,d)=>u.track_index-d.track_index),a=[];m.length>1&&a.push(`placed V1 only: Baselight builds layers above a shot, which FLAPI cannot place in time; ${m.slice(1).reduce((u,d)=>u+d.items.filter(f=>f.kind==="clip").length,0)} clip(s) on V2+ not placed`);let c=(m[0]?.items??[]).filter(u=>u.kind==="clip"||u.kind==="gap").sort((u,d)=>u.timeline_range.start.value-d.timeline_range.start.value);return await this.with(async u=>{let d=e.into==="scratch"?null:await this.current(u);e.into!=="scratch"&&!d&&a.push(`no scene open in Baselight, so it went into our job ${Et}`);let f=d?.job??Et,h=d?.host??Pt;await u.call("JobManager.job_exists",{host:h,jobname:f})||await u.call("JobManager.create_job",{host:h,jobname:f});let l=(e.name??o.name??"conform.tools").replace(/[:/\\]+/g,"_"),p=l;for(let w=2;await u.call("JobManager.scene_exists",{host:h,jobname:f,scenename:p});w++)p=`${l} ${w}`;let g=await u.call("FormatSet.factory_formats"),S=o.resolution_w&&o.resolution_h?await u.call("FormatSet.get_basic_format_name",{width:o.resolution_w,height:o.resolution_h},g):null;await u.forget(g);let _=await u.call("Scene.new_scene",{scenepath:{Host:h,Job:f,Scene:p},options:{format:S,colourspace:Mt,frame_rate:i}},null,3e5),v=0,A=0,x=0,b=0;try{await u.call("Scene.start_delta",{name:"conform.tools open"},_);try{let w=0;for(let P of c){let E=P.timeline_range.start.value,N=P.timeline_range.duration.value;if(E>w&&(await Le(u,_,E-w),x++),w=Math.max(w,E+N),P.kind==="gap"){await Le(u,_,N),x++;continue}let M=(P.media_reference_id?s.get(P.media_reference_id):void 0)?.target_url?.replace(/^file:\/\//,""),y=P.source_range,k=M&&y?await Ar(u,M,Math.round(y.start.value),Math.round(y.start.value)+N-1):null;if(!k){await Le(u,_,N),A++;continue}y&&Math.abs(y.duration.value-N)>.5&&b++;let L=await u.call("Scene.insert_sequence",{sequence:k,where:"INSERT_END",relativeTo:null,colourSpace:null,format:null,frameRate:i},_);await u.forget(k,L),v++}let T=await u.call("Scene.get_scene_settings",{},_);await u.call("SceneSettings.set",{values:{StartTimecode:vr(o.start_frame??0,i,!!o.is_drop_frame)}},T),await u.forget(T),await u.call("Scene.end_delta",{},_)}catch(w){throw await u.call("Scene.cancel_delta",{},_).catch(()=>null),w}await u.call("Scene.save_scene",{},_,3e5)}catch(w){throw await u.call("Scene.close_scene",{},_).catch(()=>null),await u.forget(_),await u.call("JobManager.delete_scene",{host:h,jobname:f,scenename:p}).catch(()=>null),w}return await u.call("Scene.close_scene",{},_),await u.forget(_),a.unshift(`new scene ${h}:${f}:${p}: ${v} shot(s)${x?`, ${x} gap(s) as black`:""}`),A&&a.push(`${A} clip(s) had no media on disk at their path: placed as black of the same length (relink in Baselight's Conform view)`),b&&a.push(`${b} retimed clip(s) placed at normal speed: FLAPI has no retime setter`),p!==l&&a.push(`"${l}" was taken in ${f}: named "${p}"`),e.media_dirs?.length&&a.push("media_dirs not used: Baselight places each clip from its own path"),e.stay&&a.push("stay: FLAPI cannot switch the scene the app shows; open it from the Scenes browser"),{project:f,timeline:p,notes:a,restored:!0}})}async renderStart(e){if(e.disable_tracks?.length)throw new F("usage","disable_tracks: a Baselight render takes every layer or one (RenderTrack); leave the tracks out in the scene");if(e.audio_tracks?.length||e.renderplugin)throw new F("usage","audio_tracks and renderplugin are DaVinci Resolve options");return await this.with(async t=>{let n=await this.scenePath(t,e.timeline,e.project),o=await t.call("Scene.open_scene",{scenepath:{Host:n.host,Job:n.job,Scene:n.scene},flags:$t("OPENFLAG_READ_ONLY")}),s=null,i=null;try{s=await t.call("RenderSetup.create_from_scene",{scene:o});let m=await t.call("RenderSetup.get_num_deliverables",{},s),a=0;if(e.preset){let l=await t.call("RenderSetup.get_deliverable_names",{},s);if(a=l.indexOf(e.preset),a<0)throw new F("usage",`no deliverable "${e.preset}" in ${n.scene} (it has: ${l.join(", ")||"none"})`)}let c=await t.call("RenderSetup.get_deliverable",{index:a},s),u=e.name??n.scene.replace(/[^\w.-]+/g,"_");Object.assign(c,{Disabled:0,Container:"",OutputDirectory:e.target_dir,FileNamePrefix:u}),e.preset||Object.assign(c,{Name:"conform.tools",IsMovie:1,FileType:"lqtmov",MovieCodec:"apch",ImageOptions:{},FileNameExtension:".mov",RenderColourSpace:Mt,HandleEmptyFrames:"GMREB_BLACK",HandleIncompleteStacks:"GMREB_BLACK",HandleError:"BLACK",EmbedTimecode:1}),e.audio||(c.AudioCodec=""),await Q(e.target_dir),await t.call("RenderSetup.set_deliverable",{index:a,deliverable:c},s);for(let l=0;l<m;l++)l!==a&&await t.call("RenderSetup.set_deliverable_enabled",{index:l,enabled:0},s);if(e.range){let l=await t.call("Scene.get_scene_settings",{},o),p=be(await t.call("SceneSettings.get_single",{key:"StartTimecode"},l))??0;await t.forget(l);let g=e.range.in>=p?p:0;await t.call("RenderSetup.set_frames",{frames:[{Start:e.range.in-g,End:e.range.out-g}]},s)}else await t.call("RenderSetup.select_all",{},s);let d=await t.call("RenderSetup.get_output_filename_for_deliverable",{index:a},s);i=await t.call("QueueManager.create_local");let f=await t.call("RenderSetup.submit_to_queue",{queue:i,opname:`${Ot}${u}`},s),h=String(f.ID);return this.jobs.set(h,{op:f.ID,out:d,notes:f.Warning?[`Baselight: ${f.Warning}`]:[]}),{job_id:h,state:"queued",percent:0}}finally{await t.forget(s,i),await t.call("Scene.close_scene",{},o).catch(()=>null),await t.forget(o)}})}async ours(e,t,n){let o=Number(n),s=await e.call("QueueManager.get_operation",{id:o},t).catch(()=>null),i=String(s?.Description??s?.Name??"");if(!this.jobs.has(n)&&!i.startsWith(Ot))throw new F("not_ours",`queue operation ${n} is not a conform.tools render: left alone`);return o}async renderStatus(e){return await this.with(async t=>{let n=await t.call("QueueManager.create_local");try{let o=await this.ours(t,n,e),s=await t.call("QueueManager.get_operation_status",{id:o},n),i=xr(s.Status),m=Number(s.Progress??0),a={job_id:e,state:i,percent:i==="complete"?100:Math.round(m<=1?m*100:m)};if(i==="failed"||i==="complete"&&s.Errors){let u=(await t.call("QueueManager.get_operation_log",{id:o},n).catch(()=>[])).filter(d=>/fail|error|warn/i.test(d.Type)).slice(-6).map(d=>`${d.Message}${d.Detail?`: ${d.Detail}`:""}`);a.error=[s.ProgressText,...u].filter(Boolean).join("; ")||"Baselight reported a failed render",i==="complete"&&(a.state="failed")}if(a.state==="complete"||a.state==="failed"||a.state==="cancelled"){let c=this.jobs.get(e);a.state==="complete"&&c&&(a.outputs=[c.out]),c?.notes.length&&(a.notes=c.notes),await t.call("QueueManager.delete_operation",{id:o},n).catch(()=>null),this.jobs.delete(e)}return a}finally{await t.forget(n)}})}async renderCancel(e){return await this.with(async t=>{let n=await t.call("QueueManager.create_local");try{let o=await this.ours(t,n,e);return await t.call("QueueManager.delete_operation",{id:o},n),this.jobs.delete(e),{job_id:e,state:"cancelled",percent:0}}finally{await t.forget(n)}})}};function xr(r){let e=String(r).replace(/^OPSTATUS_/i,"").toLowerCase();return e==="done"?"complete":e==="active"?"rendering":e==="stopped"?"cancelled":e==="failed"||e==="crashed"||e==="toonew"?"failed":"queued"}async function Le(r,e,t){let n=await r.call("Scene.insert_blank",{red:0,green:0,blue:0,duration:t,where:"INSERT_END",relativeTo:null,colourSpace:null},e);await r.forget(n)}async function Ar(r,e,t,n){let o=await r.call("SequenceDescriptor.get_for_template",{template:e,start:null,end:null}).catch(()=>[]);if(!o?.length)return null;let s=await r.call("SequenceDescriptor.get_start_handle",{},o[0]);await r.forget(...o);let i=await r.call("SequenceDescriptor.get_for_template",{template:e,start:s+t,end:s+n});return i?.length?(await r.forget(...i.slice(1)),i[0]):null}var je=(r,e)=>({OTIO_SCHEMA:"RationalTime.1",rate:e,value:r}),Fe=(r,e,t)=>({OTIO_SCHEMA:"TimeRange.1",start_time:je(r,t),duration:je(e,t)});async function Rr(r,e,t){let n=Nt(await r.call("Scene.get_working_frame_rate",{},e)),o=await r.call("Scene.get_scene_settings",{},e),s=be(await r.call("SceneSettings.get_single",{key:"StartTimecode"},o))??0;await r.forget(o);let i=await r.call("Scene.get_num_shots",{},e),m=i?await r.call("Scene.get_shot_ids",{firstIndex:0,lastIndex:i-1},e):[],a=[];for(let d of m){let f=Math.round(d.StartFrame),h=Math.round(d.EndFrame),l=await r.call("Scene.get_shot",{shot_id:d.ShotId},e);try{let p=await r.call("Shot.get_sequence_descriptor",{},l).catch(()=>null);if(!p){a.push({start:f,end:h,name:`shot ${d.ShotId}`});continue}try{let g=Nt(await r.call("Shot.get_frame_rate",{},l))||n,S=be(await r.call("Shot.get_src_start_timecode",{},l)),_=await r.call("Shot.get_src_start_frame",{},l),v=await r.call("Shot.get_src_end_frame",{},l),x=await r.call("SequenceDescriptor.is_movie",{},p)?Ye(await r.call("SequenceDescriptor.get_path",{},p),await r.call("SequenceDescriptor.get_name",{},p)):await r.call("SequenceDescriptor.get_full_filename_with_d",{},p),b=await r.call("SequenceDescriptor.get_name",{},p),w=await r.call("SequenceDescriptor.get_tape",{index:0},p).catch(()=>""),T=await r.call("SequenceDescriptor.get_start_frame",{},p),P=await r.call("SequenceDescriptor.get_start_handle",{},p),E=await r.call("SequenceDescriptor.get_end_handle",{},p),C=(be(await r.call("SequenceDescriptor.get_start_timecode",{index:0},p))??0)-(T-P),M=Math.round(v-_),y=h-f,k={OTIO_SCHEMA:"Clip.2",name:b,enabled:!0,source_range:Fe(S??C+(_-P),y,g),media_references:{DEFAULT_MEDIA:{OTIO_SCHEMA:"ExternalReference.1",target_url:x,available_range:Fe(C,E-P+1,g),available_image_bounds:null,name:b,metadata:{}}},active_media_reference_key:"DEFAULT_MEDIA",effects:M&&M!==y?[{OTIO_SCHEMA:"LinearTimeWarp.1",name:"",effect_name:"LinearTimeWarp",time_scalar:M/y,metadata:{}}]:[],markers:[],metadata:w?{baselight:{tape:w}}:{}};a.push({start:f,end:h,name:b,clip:k})}finally{await r.forget(p)}}finally{await r.forget(l)}}let c=[];for(let d of[...a].sort((f,h)=>f.start-h.start)){if(!d.clip)continue;let f=c.find(h=>h[h.length-1].end<=d.start);f?f.push(d):c.push([d])}let u=c.map((d,f)=>{let h=[],l=0;for(let p of d)p.start>l&&h.push({OTIO_SCHEMA:"Gap.1",name:"",enabled:!0,source_range:Fe(0,p.start-l,n),effects:[],markers:[],metadata:{}}),h.push(p.clip),l=p.end;return{OTIO_SCHEMA:"Track.1",name:`V${f+1}`,kind:"Video",enabled:!0,children:h,source_range:null,effects:[],markers:[],metadata:{}}});return{OTIO_SCHEMA:"Timeline.1",name:t,metadata:{baselight:{shots:m.length}},global_start_time:je(s,n),tracks:{OTIO_SCHEMA:"Stack.1",name:"tracks",enabled:!0,children:u,source_range:null,effects:[],markers:[],metadata:{}}}}var Tr="127.0.0.1:31416",Pr="/ptsl.PTSL/SendGrpcRequest",Er="CONFORM.TOOLS",Or="CONFORM.TOOLS Desktop",De=[2025,6,0],te=[2025,6],Ve=1e4,Ct=5e3,Mr="ConformTools",$r="Start Pro Tools 2025.6 or newer with a session open (PTSL, its scripting door, listens on 127.0.0.1:31416).",Ue={GetTrackList:3,HostReadyCheck:13,ExportSessionInfoAsText:30,GetSessionSampleRate:35,GetSessionTimeCodeRate:38,GetSessionFeetFramesRate:39,GetSessionName:42,GetSessionPath:43,GetSessionStartTime:44,GetSessionLength:45,GetPTSLVersion:55,GetTransportState:59,ClearMemoryLocation:61,EditMemoryLocation:68,GetMemoryLocations:69,RegisterConnection:70,CreateMemoryLocation:71,SetTimelineSelection:81,GetTimelineSelection:82,GetSessionIDs:97,GetMainCounterFormat:102},Nr=[3,6],Cr=[4,7],Lt=106,Lr=new TextEncoder,Fr=new TextDecoder;function ve(r,e){for(;r>127;)e.push(r&127|128),r=Math.floor(r/128);e.push(r)}function Ft(r){let e=[];for(let[t,n]of r){if(typeof n=="number"){n&&(ve(t<<3,e),ve(n,e));continue}let o=typeof n=="string"?Lr.encode(n):n;if(o.length){ve(t<<3|2,e),ve(o.length,e);for(let s of o)e.push(s)}}return new Uint8Array(e)}function It(r){let e=new Map,t=0,n=()=>{let o=0,s=1,i;do i=r[t++],o+=(i&127)*s,s*=128;while(i&128&&t<r.length);return o};for(;t<r.length;){let o=n(),s=Math.floor(o/8),i=o&7;if(i===0)e.set(s,n());else if(i===2){let m=n();e.set(s,r.subarray(t,t+m)),t+=m}else if(i===1)t+=8;else if(i===5)t+=4;else throw new R("bad_answer",`Pro Tools sent a reply that is not protobuf (wire type ${i})`)}return e}var jt=r=>r instanceof Uint8Array?Fr.decode(r):"",Ir=r=>typeof r=="number"?r:0;function jr(r,e,t){let n=Ft([[2,r],[3,De[0]],[4,e],[5,De[1]],[6,De[2]]]);return Ft([[1,n],[2,t]])}function Dr(r){let e=It(r),t=e.get(1);return{status:t instanceof Uint8Array?Ir(It(t).get(3)):0,body:jt(e.get(2)),error:jt(e.get(3))}}var R=class extends Error{constructor(t,n,o){super(n);this.code=t;this.errors=o}};function Ur(r){let e=null;try{e=JSON.parse(r)}catch{}let t=Array.isArray(e)?e:e&&typeof e=="object"?Array.isArray(e.errors)?e.errors:[e]:[],n=t.find(a=>!a.is_warning)??t[0],o=String(n?.command_error_message||r.trim()||"Pro Tools refused the command"),s=n?.command_error_type,m=s===Lt||s==="PT_NoOpenedSession"||s==="CEType_PT_NoOpenedSession"||s===String(Lt)?"no_session":/session id|not registered|register/i.test(o)?"not_registered":"command_failed";return new R(m,o,t.length?t:void 0)}var Ge=class{constructor(e=Tr){this.sessionId="";this.version=null;this.queue=Promise.resolve();let t=/^(127\.\d{1,3}\.\d{1,3}\.\d{1,3}):(\d{1,5})$/.exec(e)??/^\[(::1)\]:(\d{1,5})$/.exec(e);if(!t)throw new R("refused",`${e} is not a loopback IP address and port; PTSL is loopback only`);this.host=t[1],this.port=Number(t[2])}async send(e,t,n){let o;try{o=await ot(this.host,this.port,Pr,jr(e,this.sessionId,t),n)}catch(i){throw this.sessionId="",this.version=null,i instanceof nt?i.code==="unavailable"?new R("not_running",`Pro Tools is not running (nothing answered on ${this.host}:${this.port})`):i.code==="deadline"?new R("timeout",`Pro Tools did not answer in ${n} ms (a modal dialog or a long command?)`):i.grpcStatus===12?new R("not_ptsl",`the program on ${this.host}:${this.port} is not Pro Tools`):new R("transport",`PTSL transport error: ${i.message}`):i}let s=Dr(o);if(Nr.includes(s.status)){if(!s.body.trim())return null;try{return JSON.parse(s.body)}catch{throw new R("bad_answer","Pro Tools sent a body that is not JSON")}}throw Cr.includes(s.status)?Ur(s.error):new R("bad_status",`Pro Tools answered with task status ${s.status}`)}async handshake(){if(!this.sessionId){let e=await this.send(Ue.RegisterConnection,JSON.stringify({company_name:Er,application_name:Or}),Ct);if(!e?.session_id)throw new R("not_registered","Pro Tools did not give conform.tools a session id");this.sessionId=e.session_id}if(!this.version){let e=await this.send(Ue.GetPTSLVersion,"",Ct),t=o=>Number(e?.[o]??0)||0,n=[t("version"),t("version_minor"),t("version_revision")];if(n[0]<te[0]||n[0]===te[0]&&n[1]<te[1])throw this.sessionId="",new R("host_too_old",`Pro Tools ${n[0]}.${n[1]} is too old; conform.tools needs Pro Tools ${te[0]}.${te[1]} or newer`);this.version=n}}call(e,t,n=Ve){let o=async()=>{if(e==="RegisterConnection")throw new R("refused","RegisterConnection is sent by the client itself");let i=Ue[e];if(i===void 0)throw new R("unknown_command",`${e} is not a PTSL command conform.tools sends`);let m=t==null?"":typeof t=="string"?t:JSON.stringify(t);for(let a=0;;a++){if(await this.handshake(),e==="GetPTSLVersion"){let[c,u,d]=this.version;return{version:c,version_minor:u,version_revision:d}}try{return await this.send(i,m,n)}catch(c){if(c instanceof R&&c.code==="not_registered"&&a===0){this.sessionId="";continue}throw c}}},s=this.queue.then(o,o);return this.queue=s.catch(()=>{}),s}},He={23976:24e3/1001,24:24,25:25,2997:3e4/1001,30:30,47952:48e3/1001,48:48,50:50,5994:6e4/1001,60:60,100:100,11988:12e4/1001,120:120},Hr={1:["23976",!1],2:["24",!1],3:["25",!1],4:["2997",!1],5:["2997",!0],6:["30",!1],7:["30",!0],8:["47952",!1],9:["48",!1],10:["50",!1],11:["5994",!1],12:["5994",!0],13:["60",!1],14:["60",!0],15:["100",!1],16:["11988",!1],17:["11988",!0],18:["120",!1],19:["120",!0]};function Br(r){if(typeof r=="number"||typeof r=="string"&&/^\d+$/.test(r.trim())){let t=Hr[Number(r)];return t?{fps:He[t[0]],drop:t[1]}:null}let e=/Fps(\d+)(Drop)?/i.exec(String(r??""));return e&&He[e[1]]?{fps:He[e[1]],drop:!!e[2]}:null}var Vr=/^-?\d{1,2}[:;.]\d{2}[:;.]\d{2}[:;.,]\d{2,3}(\.\d+)?$/,Gr=/^(?:(\d+):)?(\d+):(\d{2}(?:\.\d+)?)$/;function Be(r,e){let t=String(r??"").trim();if(Vr.test(t))return it(t.replace(/\.\d+$/,""),e.rate.fps,e.rate.drop);if(/^-?\d+$/.test(t))return e.start+Math.floor(Number(t)*e.rate.fps/e.sampleRate+1e-9);let n=Gr.exec(t);return n?e.start+Math.floor((Number(n[1]??0)*3600+Number(n[2])*60+Number(n[3]))*e.rate.fps+1e-9):null}var ke=["Blue","Cyan","Green","Yellow","Red","Pink","Purple","Fuchsia","Rose","Lavender","Sky","Mint","Lemon","Sand","Cocoa","Cream"],Dt=r=>{let e=Number(r);return e>=1?ke[(e-1)%ke.length]:ke[0]},qr=r=>Math.max(0,ke.findIndex(e=>e.toLowerCase()===String(r??"").toLowerCase()))+1,Ut=/(?:^| )\[ct:((?:[^[\]\\]|\\.)*)\]$/s;function zr(r,e){return!e&&!Ut.test(r)?r:`${r}${r?" ":""}[ct:${e.replace(/[\\[\]]/g,t=>`\\${t}`)}]`}function Jr(r){let e=Ut.exec(r);return e?{note:r.slice(0,e.index),data:e[1].replace(/\\(.)/gs,"$1")}:{note:r,data:""}}function Wr(r){return!r.includes(":")||r.includes("/")||r.includes("\\")?r:`/Volumes/${r.split(":").filter(Boolean).join("/")}`}var xe=class{constructor(e=new Ge){this.ptsl=e;this.host="protools"}async sessionName(e=Ve){try{return String((await this.ptsl.call("GetSessionName",null,e)).session_name??"")}catch(t){if(t instanceof R&&t.code==="no_session")return"";throw t}}async sessionPath(e=Ve){let t=await this.ptsl.call("GetSessionPath",null,e),n=typeof t.session_path=="string"?t.session_path:t.session_path?.path??"";return n?Wr(n):""}async current(e=2e3){try{let t=await this.sessionName(e);return t?{project:t,project_path:await this.sessionPath(e).catch(()=>"")}:null}catch{return null}}async facts(){let e=await this.sessionName();if(!e)throw new R("no_session","protools: no session is open");let t=(await this.ptsl.call("GetSessionTimeCodeRate")).current_setting,n=Br(t);if(!n)throw new R("bad_answer",`protools: a timecode rate conform.tools does not know (${t})`);let o=/(\d{4,6})/.exec(String((await this.ptsl.call("GetSessionSampleRate")).sample_rate??""));if(!o)throw new R("bad_answer","protools: Pro Tools reported a sample rate conform.tools does not know");let s=(await this.ptsl.call("GetSessionStartTime")).session_start_time,i={name:e,rate:n,sampleRate:Number(o[1]),start:0},m=Be(s,i);if(m==null)throw new R("bad_answer",`protools: a session start conform.tools cannot read (${s})`);return{...i,start:m}}async support(){let e={ok:!1,reason:"Pro Tools holds one session at a time, and importing a timeline changes it; write a .ptx or AAF with timeline_write and open that in Pro Tools"},t={ok:!1,reason:"bouncing from Pro Tools (ExportMix) is not wired"},n={ok:!1,reason:"the renderplugin is a DaVinci Resolve plugin"},o;try{o=await this.sessionName(3e3)?{ok:!0}:{ok:!1,reason:"Pro Tools is running with no session open"}}catch(s){o={ok:!1,reason:s instanceof Error?s.message:String(s),setup:$r}}return{export:o,open:e,render:t,markers:o,renderplugin:n}}async export(e){let t=await this.sessionName();if(!t)throw new R("no_session","protools: no session is open");if(e.timeline&&e.timeline!==t)throw new R("not_found",`protools: the open session is "${t}"; Pro Tools has one timeline per session`);let n=await this.sessionPath();if(!n||!await ce(n))throw new R("no_file",`protools: session "${t}" has no saved .ptx on disk${n?` (${n})`:""}; save it in Pro Tools first`);let o=e.out_path??I(await G("conform-protools-"),st(n));return await Q(de(o)),await tt(n,o),{path:o,format:"ptx",project:t,timeline:t}}open(){return Promise.reject(new R("unsupported","protools: open is not supported: Pro Tools holds one session, and importing a timeline into it changes it"))}renderStart(){return Promise.reject(new R("unsupported","protools: rendering (a bounce) is not wired"))}renderStatus(){return this.renderStart()}renderCancel(){return this.renderStart()}async project(){let e=await this.facts(),t=await this.sessionPath().catch(()=>""),n=[],o=[];try{let i=await this.ptsl.call("GetTrackList",{page_limit:1e3,track_filter_list:[{filter:"All",is_inverted:!1}]}),m={video:0,audio:0};for(let a of i.track_list??[]){let c=/video/i.test(String(a.type))?"video":"audio",u=a.track_attributes??{},d=u.is_inactive===!0||/^(true|.*_?(set|on|inactive))$/i.test(String(u.is_inactive??""));n.push({kind:c,index:++m[c],name:String(a.name??""),enabled:!d})}}catch(i){o.push(`tracks not read: ${i instanceof Error?i.message:String(i)}`)}let s=(await this.locations(e).catch(()=>({locs:[]}))).locs.length;return{project:e.name,timeline:e.name,timelines:[e.name],session_path:t,fps:e.rate.fps,drop_frame:e.rate.drop,sample_rate:e.sampleRate,start_tc:Pe(e.start,e.rate.fps,e.rate.drop),ptsl_version:this.ptsl.version?.join("."),markers:s,notes:o,tracks:n,jobs:[],found:{},pool:{path:"",clips:0,folders:[]}}}async locations(e){let t=[];for(let o=0;;){let s=await this.ptsl.call("GetMemoryLocations",{pagination_request:{limit:1e3,offset:o}}),i=(s.memory_locations??[]).filter(m=>m&&typeof m=="object");if(t.push(...i),o+=i.length,!i.length||o>=Number((s.pagination_response??s.stats)?.total??0))break}let n=[];for(let o of t){let s=o.time_properties,i=typeof s=="number"||/^\d+$/.test(String(s))?{1:"Marker",2:"Selection"}[Number(s)]:String(s??"").split("_").pop();if(i!=="Marker"&&i!=="Selection")continue;let m=Be(o.start_time,e);if(m==null)continue;let a=i==="Selection"?Be(o.end_time,e):null,{note:c,data:u}=Jr(String(o.comments??""));n.push({number:Number(o.number)||0,frame:m-e.start,duration:a==null?1:Math.max(1,a-m),name:String(o.name??""),note:c,data:u,color:Dt(o.color_index),raw:o})}return n.sort((o,s)=>o.frame-s.frame||o.number-s.number),{locs:n.filter((o,s)=>s===0||n[s-1].frame!==o.frame),numbers:t.map(o=>Number(o.number)||0)}}async writeFormat(){let e=await this.ptsl.call("GetMainCounterFormat"),t=e.current_setting??e.current_type,n=typeof t=="number"||/^\d+$/.test(String(t))?{3:"TimeCode",5:"Samples"}[Number(t)]:String(t??"").split("_").pop();if(n==="TimeCode")return"timecode";if(n==="Samples")return"samples";throw new R("counter_format","protools: set Pro Tools' main counter to Timecode or Samples to edit markers from conform.tools")}async apply(e){let t=await this.facts();if(e.timeline&&e.timeline!==t.name)throw new R("not_found",`protools: the open session is "${t.name}"`);let{locs:n,numbers:o}=await this.locations(t),s=new Map(n.map(l=>[l.frame,l])),i=null,m=l=>i==="samples"?String(Math.round(l*t.sampleRate/t.rate.fps)):Pe(t.start+l,t.rate.fps,t.rate.drop),a=async(l,p)=>{let g=Math.max(1,Math.round(l.duration??1)),S=p?.number??Math.max(0,...o)+1,_=p?.raw??{},v={number:S,name:l.name??"",start_time:m(l.frame),end_time:m(l.frame+(g>1?g:0)),time_properties:g>1?"TP_Selection":"TP_Marker",reference:_.reference||"MLR_Absolute",general_properties:_.general_properties||{zoom_settings:!1,pre_post_roll_times:!1,track_visibility:!1,track_heights:!1,group_enables:!1,window_configuration:!1},comments:zr(l.note??"",l.data??""),color_index:qr(l.color),location:_.location||"MLC_MainRuler",..._.track_name?{track_name:_.track_name}:{}};await this.ptsl.call("CreateMemoryLocation",v),o.push(S),s.set(l.frame,{number:S,frame:l.frame,duration:g,name:l.name??"",note:l.note??"",data:l.data??"",color:Dt(v.color_index),raw:v})},c=async l=>{await this.ptsl.call("ClearMemoryLocation",{location_list:[l.number]}),s.delete(l.frame),o.splice(o.indexOf(l.number),1)},u=l=>({op:"marker_add",frame:l.frame,color:l.color,name:l.name,note:l.note,duration:l.duration,...l.data?{data:l.data}:{}}),d=[],f=[];for(let l of e.ops){let p=Number(l.frame);try{if(!l.op.startsWith("marker_")||l.item){d.push({op:l.op,ok:!1,detail:`protools: '${l.op}' is not reachable over PTSL (timeline markers only)`});continue}if(!Number.isInteger(p)){d.push({op:l.op,ok:!1,detail:"frame must be a whole number"});continue}i??=await this.writeFormat();let g=s.get(p);if(l.op==="marker_add")g&&await c(g),await a({frame:p,color:l.color,name:l.name,note:l.note,duration:Number(l.duration??1),data:l.data||Mr}),d.push({op:l.op,ok:!0}),f.unshift({op:"marker_delete",frame:p},...g?[u(g)]:[]);else if(l.op==="marker_update"){if(!g){d.push({op:l.op,ok:!1,detail:`no marker at frame ${p}`});continue}let S=l.to_frame!==void 0?Number(l.to_frame):p;if(!Number.isInteger(S)){d.push({op:l.op,ok:!1,detail:"to_frame must be a whole number"});continue}if(S!==p&&s.has(S)){d.push({op:l.op,ok:!1,detail:`frame ${S} already has a marker`});continue}await c(g);let _=(v,A)=>l[v]!==void 0?l[v]:A;await a({frame:S,color:_("color",g.color),name:_("name",g.name),note:_("note",g.note),duration:Number(_("duration",g.duration)),data:_("data",g.data)},g),d.push({op:l.op,ok:!0}),f.unshift({op:"marker_update",frame:S,color:g.color,name:g.name,note:g.note,duration:g.duration,data:g.data,...S!==p?{to_frame:p}:{}})}else if(l.op==="marker_delete"){if(!g){d.push({op:l.op,ok:!1,detail:`no marker at frame ${p}`});continue}await c(g),d.push({op:l.op,ok:!0}),f.unshift(u(g))}else d.push({op:l.op,ok:!1,detail:`protools: unknown marker op '${l.op}'`})}catch(g){d.push({op:l.op,ok:!1,detail:g instanceof Error?g.message:String(g)})}}let h=d.filter(l=>l.ok).length;return{project:t.name,timeline:t.name,results:d,undo:f,applied:h,failed:d.length-h}}};var Kr="Install the conform.tools panel in Media Composer (mcp/hosts/avid/panel: package it, copy the .avpi into PanelSDKPlugins; an unsigned panel needs Avid's Feature Toggle Files), then open Tools > CONFORM.TOOLS. Its page loads from this engine's host bridge (port 48127) and connects by itself.",Qr="Install the conform.tools hook (host_setup host=flame action=install_panel), then in Flame: Flame menu > Python > Rescan Python Hooks (or restart Flame), then Flame menu > CONFORM.TOOLS > Connect to CONFORM.TOOLS (or Connect Automatically).",Yr="Install the conform.tools panel (host_setup host=nuke action=install_panel) and restart Nuke Studio / Hiero, then CONFORM.TOOLS > Connect (or tick Connect automatically in its panel).",Ht={resolve:new _e,premiere:new mt,avid:new fe({host:"avid",label:"Media Composer",setup:Kr}),flame:new fe({host:"flame",label:"Flame",setup:Qr,items:!0}),nuke:new fe({host:"nuke",label:"Nuke Studio",setup:Yr,items:!0}),baselight:new Se,protools:new xe};function Mn(r,e){Ht[r]=e}function $n(r){return Ht[r]??dt(r,"not wired yet")}export{_t as a,on as b,hr as c,wn as d,xe as e,Kr as f,Qr as g,Yr as h,Mn as i,$n as j};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{G as g,S as d}from"./chunk-C2ESM27Z.js";var m={prproj:"prproj","resolve-drt":"drt",aaf:"aaf",avb:"avb",otio:"otio",capcut:"capcut","flame-archive":"flame","resolve-fcpxml":"fcpxml","finalcut-fcpxml":"fcpxml","fcp-xml":"xmeml","premiere-xml":"xmeml","resolve-xml":"xmeml"};function v(e){return e in m}var u=null;function c(){return u||(u=y()),u}async function y(){let e=await import("./timeline_core-IOENXK4Z.js"),n=(await import("./timeline_core_bg-JW42YM3G.js")).default;return await e.default({module_or_path:n}),e}async function k(e,n){let o=m[n];if(!o)throw new Error(`timelineInspect: no Rust engine for format '${n}'`);let r=await c(),i=e.name.replace(/\.[^.]+$/,""),t=(b,...w)=>r[b](...w),s;switch(o){case"prproj":s=t("inspect_prproj_json",await a(e));break;case"aaf":s=t("inspect_aaf_json",await a(e));break;case"avb":s=t("inspect_avb_json",await a(e));break;case"flame":s=t("inspect_flame_json",await a(e),i);break;case"drt":s=t("inspect_drt_json",await x(e));break;case"otio":s=t("inspect_otio_json",await e.text(),i);break;case"capcut":s=t("inspect_capcut_json",await e.text(),i);break;case"fcpxml":s=t("inspect_fcpxml_json",await e.text(),i);break;case"xmeml":s=t("inspect_xmeml_json",await e.text(),i);break}return R(s)}var f=12*1024*1024,p=!1;function S(e){p=e}var _=null,h=8e3;async function I(){!_||p||await Promise.race([_,new Promise(e=>setTimeout(e,h))])}function l(e,n,o){if(p||e.length<=f)return e;let r=(e.length/1048576).toFixed(0),i=o?.length??0;throw i===1?new Error(`This ${n.toUpperCase()} timeline extracts to ${r} MB, past what our conversion server can hold in one pass (the ceiling is ours, not your file \u2014 a single long timeline can exceed it on its own). Get in touch and we will convert it for you while we lift the limit.`):new Error(`This ${n.toUpperCase()} selection${i?` (${i} sequences)`:""} extracts to ${r} MB, past what our conversion server can hold in one pass. Convert a few sequences at a time \u2014 one long timeline is usually about ${(f/1048576).toFixed(0)} MB. If a single timeline still will not go through, get in touch and we will convert it for you.`)}async function W(e,n,o){let r=m[n];if(!r)throw new Error(`timelineExtract: no Rust engine for format '${n}'`);switch(await I(),r){case"otio":case"capcut":case"fcpxml":case"xmeml":return{fmt:r,extract:await e.text()};case"drt":{let t=(await c()).extract_drt_json(await x(e));return{fmt:r,extract:l(t,r,o)}}case"prproj":{let i=await c(),t=JSON.stringify(o??[]),s=i.extract_prproj_json(await a(e),t);return{fmt:r,extract:l(s,r,o)}}case"avb":{let i=await c(),t=JSON.stringify(o??[]),s=i.extract_avb_json(await a(e),t);return{fmt:r,extract:l(s,r,o)}}case"aaf":case"flame":{let t=(await c())[`extract_${r}_json`](await a(e));return{fmt:r,extract:l(t,r,o)}}}}async function a(e){return new Uint8Array(await e.arrayBuffer())}async function x(e){let n=d(await a(e)),o={};for(let[r,i]of Object.entries(n))r.toLowerCase().endsWith(".xml")&&(o[r]=g(i));return JSON.stringify(o)}function R(e){let n=JSON.parse(e),o=Array.isArray(n)?n:n?.timelines??n?.sequences??[],r=o.filter(t=>typeof t=="object"&&t!==null),i=o.map(t=>{if(typeof t=="string")return t;let s=t;return s?.name??s?.title??s?.id??""}).filter(t=>!!t);return{names:Array.from(new Set(i)),timelines:r}}async function j(e){let n=await c();return JSON.parse(n.drx_grade_tree(e))}var T={reelName:!1,fileName:!0,fileNameMode:"loose",fileExtensions:"",totalDuration:!1,resolution:!1,bitDepth:!1,fileFormat:!1,codec:!1,mediaUmid:!1};var U="X-Write-Issues";var N=8*1024;function F(e){if(!e)return[];try{let n=JSON.parse(decodeURIComponent(e));return Array.isArray(n)?n:[]}catch{return[]}}export{T as a,v as b,k as c,S as d,W as e,j as f,U as g,F as h};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{d as Tt}from"./chunk-PSANHDZM.js";var At={};Tt(At,{ExrBench:()=>J,ExrStreamEncoder:()=>Q,ProResBench:()=>Z,ProResMovEncoder:()=>tt,ProResMovWriter:()=>et,arriraw12_clip_info:()=>Ot,arriraw_mxf_gpu_frame:()=>Wt,audio_aac_au:()=>Ft,audio_aac_config:()=>St,audio_info:()=>Rt,bench_f32_boundary:()=>Lt,bench_piz_no_huffman:()=>jt,color_cst:()=>zt,dci_code_full_depth:()=>Dt,dci_frame_cap:()=>Ut,dci_gpu_colour_patch:()=>Pt,dci_gpu_colour_tables:()=>Bt,dci_last_pass_caps:()=>Ct,dci_legal_rates:()=>qt,dci_mq_bench:()=>Nt,dci_pack_tier1:()=>Ht,dci_stage_rgba8:()=>Gt,dci_transform_only:()=>Vt,decode_arriraw12_luma:()=>Kt,decode_arriraw12_mxf:()=>Xt,decode_arriraw12_preview:()=>Yt,decode_arriraw12_rgba:()=>$t,decode_arriraw_luma:()=>Jt,decode_arriraw_mxf:()=>Qt,decode_arriraw_preview:()=>Zt,decode_arriraw_preview_gray:()=>te,decode_arriraw_preview_meta:()=>ee,decode_arriraw_rgba:()=>ne,decode_arriraw_rgba_meta:()=>re,decode_arw_preview:()=>_e,decode_arw_rgba:()=>oe,decode_audio_pcm:()=>ie,decode_bmp_rgba:()=>ae,decode_braw_gen5log:()=>de,decode_braw_luma:()=>ce,decode_braw_preview:()=>se,decode_braw_rgba:()=>pe,decode_cr2_preview:()=>ge,decode_cr2_rgba:()=>ue,decode_cr3_rgba:()=>we,decode_crm:()=>be,decode_dng_preview:()=>le,decode_dng_rgba:()=>fe,decode_dpx_preview:()=>ve,decode_dpx_rgba:()=>xe,decode_dv_luma:()=>Ie,decode_dv_preview:()=>ye,decode_dv_rgba:()=>me,decode_exr_linear:()=>he,decode_exr_preview:()=>ke,decode_exr_rgba:()=>Ae,decode_gif_rgba:()=>Me,decode_heic_rgba:()=>Ee,decode_j2k_luma:()=>Te,decode_j2k_preview:()=>Oe,decode_j2k_rgba:()=>We,decode_jpeg_rgba:()=>Fe,decode_mpeg2_luma:()=>Se,decode_mpeg2_preview:()=>Re,decode_mpeg2_rgba:()=>Le,decode_png_rgba:()=>je,decode_prores_band_rgba:()=>ze,decode_prores_luma:()=>De,decode_prores_mxf:()=>Ue,decode_prores_preview:()=>Pe,decode_prores_raw_acescct:()=>Be,decode_prores_raw_luma:()=>Ce,decode_prores_raw_preview:()=>qe,decode_prores_raw_rec2020:()=>Ne,decode_prores_raw_rgba:()=>He,decode_prores_raw_tier:()=>Ge,decode_prores_rgb16:()=>Ve,decode_prores_rgba:()=>Ke,decode_prores_thumb_dc32:()=>Xe,decode_psd_rgba:()=>Ye,decode_r3d_luma:()=>$e,decode_r3d_preview:()=>Je,decode_r3d_preview_clip:()=>Qe,decode_r3d_rgb16:()=>Ze,decode_r3d_rgba:()=>tn,decode_r3d_rgba_clip:()=>en,decode_tga_rgba:()=>nn,decode_tiff_preview:()=>rn,decode_tiff_rgba:()=>_n,decode_vc3_band_rgba:()=>on,decode_vc3_luma:()=>an,decode_vc3_mxf:()=>dn,decode_vc3_preview:()=>cn,decode_vc3_rgba:()=>sn,decode_webp_rgba:()=>pn,decode_xocn_index_luma:()=>gn,decode_xocn_luma:()=>un,decode_xocn_mxf:()=>wn,decode_xocn_preview:()=>bn,decode_xocn_preview_rec709:()=>ln,decode_xocn_rgb16:()=>fn,decode_xocn_rgba:()=>vn,default:()=>rt,encode_dci_j2c:()=>xn,encode_dci_j2c_rgb:()=>In,encode_dci_j2c_rgba8:()=>yn,encode_dci_j2c_staged:()=>mn,encode_dci_j2c_staged_modelled:()=>hn,encode_exr:()=>kn,encode_prores_4444_alpha_mov_rgba:()=>An,encode_prores_4444_alpha_sample_q:()=>Mn,encode_prores_444_sample_cbr:()=>En,encode_prores_444_sample_cbr_rgb16:()=>Tn,encode_prores_444_sample_cbr_rgb16_lut:()=>On,encode_prores_mov_rgba:()=>Wn,encode_prores_rgba:()=>Fn,encode_prores_sample_cbr:()=>Sn,encode_prores_sample_cbr_rgb16:()=>Rn,encode_prores_sample_cbr_rgb16_lut:()=>Ln,encode_prores_sample_q:()=>jn,exr_sequence_filename:()=>zn,fit_sizing:()=>Dn,initSync:()=>p_,inspect_arw:()=>Un,inspect_cr2:()=>Pn,inspect_cr3:()=>Bn,inspect_dng:()=>Cn,inspect_dpx:()=>qn,inspect_exr:()=>Nn,inspect_isobmff:()=>Hn,inspect_tiff:()=>Gn,inspect_wav:()=>Vn,is_arriraw12_mxf:()=>Kn,is_arriraw_mxf:()=>Xn,is_crm:()=>Yn,is_prores_mxf:()=>$n,is_vc3_mxf:()=>Jn,is_xavc_mxf:()=>Qn,is_xocn_mxf:()=>Zn,list_isobmff_segments:()=>tr,list_mxf_segments:()=>er,list_r3d_frames:()=>nr,list_r3d_segments:()=>rr,list_wav_segments:()=>_r,mux_prores_4444_alpha_samples:()=>or,mux_prores_samples:()=>ir,mux_prores_samples_full:()=>ar,mxf_au_run:()=>dr,mxf_frame_index:()=>cr,mxf_gop_map:()=>sr,mxf_h264_kind:()=>pr,plan_isobmff_trim:()=>gr,plan_isobmff_trim_reader:()=>ur,plan_mxf_compact_trim:()=>wr,plan_mxf_trim:()=>br,plan_r3d_compact:()=>lr,plan_wav_trim:()=>fr,plan_wav_trim_reader:()=>vr,prepare_isobmff:()=>xr,prepare_mxf:()=>Ir,prepare_r3d:()=>yr,prepare_wav:()=>mr,probe_mov:()=>hr,probe_mxf:()=>kr,probe_r3d:()=>Ar,prores_band_info:()=>Mr,prores_raw_container_color:()=>Er,prores_reset_rate_control:()=>Tr,r3d_gpu_develop_params:()=>Or,r3d_index_ranges:()=>Wr,r3d_is_helium:()=>Fr,read_arriraw_fcs:()=>Sr,read_arriraw_unit_correction:()=>Rr,recover_reframe:()=>Lr,resample_rgba16:()=>jr,resample_rgba8:()=>zr,reset_dci_rate_state:()=>Dr,resize_luma_area:()=>Ur,rgba8_to_xyz12:()=>Pr,shot_crop:()=>Br,shot_ramp:()=>Cr,shot_scan:()=>qr,trim_r3d:()=>Nr,vc3_band_info:()=>Hr,video_close:()=>Gr,video_decode:()=>Vr,video_frame_index_isobmff_reader:()=>Kr,video_open:()=>Xr,xavc_au:()=>Yr,xavc_frame_count:()=>$r,xocn_frame_count:()=>Jr,xocn_index_prefix_len:()=>Qr,xocn_preview_prefix_len:()=>Zr});var J=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,wt.unregister(this),e}free(){let e=this.__destroy_into_raw();t.__wbg_exrbench_free(e,0)}block_rows(){return t.exrbench_block_rows(this.__wbg_ptr)>>>0}f32_to_half_block(){return t.exrbench_f32_to_half_block(this.__wbg_ptr)}n_blocks(){return t.exrbench_n_blocks(this.__wbg_ptr)>>>0}constructor(e,n,i,a){try{let s=t.__wbindgen_add_to_stack_pointer(-16),g=y(a,t.__wbindgen_export4,t.__wbindgen_export5),w=p;t.exrbench_new(s,e,n,i,g,w);var d=r().getInt32(s+0,!0),_=r().getInt32(s+4,!0),c=r().getInt32(s+8,!0);if(c)throw u(_);return this.__wbg_ptr=d,wt.register(this,this.__wbg_ptr,this),this}finally{t.__wbindgen_add_to_stack_pointer(16)}}piz_stage_block(e){try{let d=t.__wbindgen_add_to_stack_pointer(-16);t.exrbench_piz_stage_block(d,this.__wbg_ptr,e);var n=r().getFloat64(d+0,!0),i=r().getInt32(d+8,!0),a=r().getInt32(d+12,!0);if(a)throw u(i);return n}finally{t.__wbindgen_add_to_stack_pointer(16)}}staging_f32_ptr(){return t.exrbench_staging_f32_ptr(this.__wbg_ptr)>>>0}staging_f32_samples(){return t.exrbench_staging_f32_samples(this.__wbg_ptr)>>>0}staging_half_len(){return t.exrbench_staging_half_len(this.__wbg_ptr)>>>0}staging_half_ptr(){return t.exrbench_staging_half_ptr(this.__wbg_ptr)>>>0}zip_stage_block(e){try{let d=t.__wbindgen_add_to_stack_pointer(-16);t.exrbench_zip_stage_block(d,this.__wbg_ptr,e);var n=r().getFloat64(d+0,!0),i=r().getInt32(d+8,!0),a=r().getInt32(d+12,!0);if(a)throw u(i);return n}finally{t.__wbindgen_add_to_stack_pointer(16)}}};Symbol.dispose&&(J.prototype[Symbol.dispose]=J.prototype.free);var Q=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,bt.unregister(this),e}free(){let e=this.__destroy_into_raw();t.__wbg_exrstreamencoder_free(e,0)}block_rows(){return t.exrstreamencoder_block_rows(this.__wbg_ptr)>>>0}finish(){try{let _=t.__wbindgen_add_to_stack_pointer(-16);t.exrstreamencoder_finish(_,this.__wbg_ptr);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}header(){try{let a=t.__wbindgen_add_to_stack_pointer(-16);t.exrstreamencoder_header(a,this.__wbg_ptr);var e=r().getInt32(a+0,!0),n=r().getInt32(a+4,!0),i=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),i}finally{t.__wbindgen_add_to_stack_pointer(16)}}n_blocks(){return t.exrstreamencoder_n_blocks(this.__wbg_ptr)>>>0}constructor(e,n,i,a,d,_,c,s,g,w){try{let I=t.__wbindgen_add_to_stack_pointer(-16),h=y(i,t.__wbindgen_export4,t.__wbindgen_export5),k=p,M=y(a,t.__wbindgen_export4,t.__wbindgen_export5),O=p,W=y(d,t.__wbindgen_export4,t.__wbindgen_export5),T=p,S=y(_,t.__wbindgen_export4,t.__wbindgen_export5),L=p,j=y(s,t.__wbindgen_export4,t.__wbindgen_export5),D=p;t.exrstreamencoder_new(I,e,n,h,k,M,O,W,T,S,L,c,j,D,g,w);var b=r().getInt32(I+0,!0),v=r().getInt32(I+4,!0),m=r().getInt32(I+8,!0);if(m)throw u(v);return this.__wbg_ptr=b,bt.register(this,this.__wbg_ptr,this),this}finally{t.__wbindgen_add_to_stack_pointer(16)}}push_block(e){try{let c=t.__wbindgen_add_to_stack_pointer(-16);t.exrstreamencoder_push_block(c,this.__wbg_ptr,e);var n=r().getInt32(c+0,!0),i=r().getInt32(c+4,!0),a=r().getInt32(c+8,!0),d=r().getInt32(c+12,!0);if(d)throw u(a);var _=f(n,i).slice();return t.__wbindgen_export3(n,i*1,1),_}finally{t.__wbindgen_add_to_stack_pointer(16)}}rows_remaining(){return t.exrstreamencoder_rows_remaining(this.__wbg_ptr)>>>0}staging_ptr(){return t.exrstreamencoder_staging_ptr(this.__wbg_ptr)>>>0}staging_samples(){return t.exrstreamencoder_staging_samples(this.__wbg_ptr)>>>0}};Symbol.dispose&&(Q.prototype[Symbol.dispose]=Q.prototype.free);var Z=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,lt.unregister(this),e}free(){let e=this.__destroy_into_raw();t.__wbg_proresbench_free(e,0)}constructor(e,n,i,a){try{let s=t.__wbindgen_add_to_stack_pointer(-16),g=y(i,t.__wbindgen_export4,t.__wbindgen_export5),w=p;t.proresbench_new(s,e,n,g,w,a);var d=r().getInt32(s+0,!0),_=r().getInt32(s+4,!0),c=r().getInt32(s+8,!0);if(c)throw u(_);return this.__wbg_ptr=d,lt.register(this,this.__wbg_ptr,this),this}finally{t.__wbindgen_add_to_stack_pointer(16)}}stage(e){try{let d=t.__wbindgen_add_to_stack_pointer(-16);t.proresbench_stage(d,this.__wbg_ptr,e);var n=r().getFloat64(d+0,!0),i=r().getInt32(d+8,!0),a=r().getInt32(d+12,!0);if(a)throw u(i);return n}finally{t.__wbindgen_add_to_stack_pointer(16)}}staging_len(){return t.proresbench_staging_len(this.__wbg_ptr)>>>0}staging_ptr(){return t.proresbench_staging_ptr(this.__wbg_ptr)>>>0}};Symbol.dispose&&(Z.prototype[Symbol.dispose]=Z.prototype.free);var tt=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,ft.unregister(this),e}free(){let e=this.__destroy_into_raw();t.__wbg_proresmovencoder_free(e,0)}add_frame_rgba(e){try{let a=t.__wbindgen_add_to_stack_pointer(-16),d=l(e,t.__wbindgen_export4),_=p;t.proresmovencoder_add_frame_rgba(a,this.__wbg_ptr,d,_);var n=r().getInt32(a+0,!0),i=r().getInt32(a+4,!0);if(i)throw u(n)}finally{t.__wbindgen_add_to_stack_pointer(16)}}finish(){try{let a=t.__wbindgen_add_to_stack_pointer(-16);t.proresmovencoder_finish(a,this.__wbg_ptr);var e=r().getInt32(a+0,!0),n=r().getInt32(a+4,!0),i=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),i}finally{t.__wbindgen_add_to_stack_pointer(16)}}frame_count(){return t.proresmovencoder_frame_count(this.__wbg_ptr)>>>0}constructor(e,n,i,a){let d=t.proresmovencoder_new(e,n,i,a);return this.__wbg_ptr=d,ft.register(this,this.__wbg_ptr,this),this}set_alpha(e){t.proresmovencoder_set_alpha(this.__wbg_ptr,e)}set_bitrate_mbps(e){t.proresmovencoder_set_bitrate_mbps(this.__wbg_ptr,e)}set_qscale(e){t.proresmovencoder_set_qscale(this.__wbg_ptr,e)}};Symbol.dispose&&(tt.prototype[Symbol.dispose]=tt.prototype.free);var et=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,vt.unregister(this),e}free(){let e=this.__destroy_into_raw();t.__wbg_proresmovwriter_free(e,0)}finish(){try{let a=t.__wbindgen_add_to_stack_pointer(-16);t.proresmovwriter_finish(a,this.__wbg_ptr);var e=r().getInt32(a+0,!0),n=r().getInt32(a+4,!0),i=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),i}finally{t.__wbindgen_add_to_stack_pointer(16)}}frame_count(){return t.proresmovwriter_frame_count(this.__wbg_ptr)>>>0}header(){try{let a=t.__wbindgen_add_to_stack_pointer(-16);t.proresmovwriter_header(a,this.__wbg_ptr);var e=r().getInt32(a+0,!0),n=r().getInt32(a+4,!0),i=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),i}finally{t.__wbindgen_add_to_stack_pointer(16)}}mdat_box_header(){try{let a=t.__wbindgen_add_to_stack_pointer(-16);t.proresmovwriter_mdat_box_header(a,this.__wbg_ptr);var e=r().getInt32(a+0,!0),n=r().getInt32(a+4,!0),i=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),i}finally{t.__wbindgen_add_to_stack_pointer(16)}}mdat_box_offset(){return t.proresmovwriter_mdat_box_offset(this.__wbg_ptr)}constructor(e,n,i,a){let d=t.proresmovwriter_new(e,n,i,a);return this.__wbg_ptr=d,vt.register(this,this.__wbg_ptr,this),this}push_frame(){try{let _=t.__wbindgen_add_to_stack_pointer(-16);t.proresmovwriter_push_frame(_,this.__wbg_ptr);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}push_sample(e){try{let a=t.__wbindgen_add_to_stack_pointer(-16),d=l(e,t.__wbindgen_export4),_=p;t.proresmovwriter_push_sample(a,this.__wbg_ptr,d,_);var n=r().getInt32(a+0,!0),i=r().getInt32(a+4,!0);if(i)throw u(n)}finally{t.__wbindgen_add_to_stack_pointer(16)}}push_sample_len(e){try{let a=t.__wbindgen_add_to_stack_pointer(-16);t.proresmovwriter_push_sample_len(a,this.__wbg_ptr,e);var n=r().getInt32(a+0,!0),i=r().getInt32(a+4,!0);if(i)throw u(n)}finally{t.__wbindgen_add_to_stack_pointer(16)}}reserve_large_mdat(e){t.proresmovwriter_reserve_large_mdat(this.__wbg_ptr,e)}set_alpha(e){t.proresmovwriter_set_alpha(this.__wbg_ptr,e)}set_bitrate_mbps(e){t.proresmovwriter_set_bitrate_mbps(this.__wbg_ptr,e)}set_par(e,n){t.proresmovwriter_set_par(this.__wbg_ptr,e,n)}set_profile(e){let n=y(e,t.__wbindgen_export4,t.__wbindgen_export5),i=p;t.proresmovwriter_set_profile(this.__wbg_ptr,n,i)}set_qscale(e){t.proresmovwriter_set_qscale(this.__wbg_ptr,e)}set_start_timecode(e,n){t.proresmovwriter_set_start_timecode(this.__wbg_ptr,e,n)}staging_len(){return t.proresmovwriter_staging_len(this.__wbg_ptr)>>>0}staging_ptr(){return t.proresmovwriter_staging_ptr(this.__wbg_ptr)>>>0}total_len(){return t.proresmovwriter_total_len(this.__wbg_ptr)}};Symbol.dispose&&(et.prototype[Symbol.dispose]=et.prototype.free);function Ot(o){let e,n;try{let d=t.__wbindgen_add_to_stack_pointer(-16),_=l(o,t.__wbindgen_export4),c=p;t.arriraw12_clip_info(d,_,c);var i=r().getInt32(d+0,!0),a=r().getInt32(d+4,!0);return e=i,n=a,E(i,a)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(e,n,1)}}function Wt(o,e,n,i){var a=P(i)?0:y(i,t.__wbindgen_export4,t.__wbindgen_export5),d=p;let _=t.arriraw_mxf_gpu_frame(x(o),e,n,a,d);return u(_)}function Ft(o,e,n){let i=t.audio_aac_au(x(o),e,n);return u(i)}function St(o,e){let n=t.audio_aac_config(x(o),e);return u(n)}function Rt(o,e){let n=t.audio_info(x(o),e);return u(n)}function Lt(o){let e=ot(o,t.__wbindgen_export4),n=p;return t.bench_f32_boundary(e,n)}function jt(o,e,n,i){let a=ot(o,t.__wbindgen_export4),d=p;return t.bench_piz_no_huffman(a,d,e,n,i)}function zt(o,e){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=y(o,t.__wbindgen_export4,t.__wbindgen_export5),s=p;var n=ot(e,t.__wbindgen_export4),i=p;t.color_cst(_,c,s,n,i,x(e));var a=r().getInt32(_+0,!0),d=r().getInt32(_+4,!0);if(d)throw u(a)}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Dt(o,e,n){let i=F(o,t.__wbindgen_export4),a=p;return t.dci_code_full_depth(i,a,e,n)}function Ut(o,e,n){return t.dci_frame_cap(o,e,n)>>>0}function Pt(o,e){try{let c=t.__wbindgen_add_to_stack_pointer(-16),s=l(o,t.__wbindgen_export4),g=p,w=y(e,t.__wbindgen_export4,t.__wbindgen_export5),b=p;t.dci_gpu_colour_patch(c,s,g,w,b);var n=r().getInt32(c+0,!0),i=r().getInt32(c+4,!0),a=r().getInt32(c+8,!0),d=r().getInt32(c+12,!0);if(d)throw u(a);var _=gt(n,i).slice();return t.__wbindgen_export3(n,i*2,2),_}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Bt(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=y(o,t.__wbindgen_export4,t.__wbindgen_export5),s=p;t.dci_gpu_colour_tables(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Ct(){try{let i=t.__wbindgen_add_to_stack_pointer(-16);t.dci_last_pass_caps(i);var o=r().getInt32(i+0,!0),e=r().getInt32(i+4,!0),n=nt(o,e).slice();return t.__wbindgen_export3(o,e*4,4),n}finally{t.__wbindgen_add_to_stack_pointer(16)}}function qt(o,e){try{let d=t.__wbindgen_add_to_stack_pointer(-16);t.dci_legal_rates(d,o,e);var n=r().getInt32(d+0,!0),i=r().getInt32(d+4,!0),a=nt(n,i).slice();return t.__wbindgen_export3(n,i*4,4),a}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Nt(o){return t.dci_mq_bench(o)>>>0}function Ht(o,e,n,i,a,d,_,c,s,g,w){try{let k=t.__wbindgen_add_to_stack_pointer(-16),M=R(o,t.__wbindgen_export4),O=p,W=l(e,t.__wbindgen_export4),T=p,S=R(n,t.__wbindgen_export4),L=p,j=R(i,t.__wbindgen_export4),D=p,C=R(a,t.__wbindgen_export4),q=p,it=R(d,t.__wbindgen_export4),at=p,dt=R(_,t.__wbindgen_export4),ct=p,Mt=R(c,t.__wbindgen_export4),Et=p;t.dci_pack_tier1(k,M,O,W,T,S,L,j,D,C,q,it,at,dt,ct,Mt,Et,s,g,w);var b=r().getInt32(k+0,!0),v=r().getInt32(k+4,!0),m=r().getInt32(k+8,!0),I=r().getInt32(k+12,!0);if(I)throw u(m);var h=f(b,v).slice();return t.__wbindgen_export3(b,v*1,1),h}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Gt(o,e){let n=t.dci_stage_rgba8(o,e);return u(n)}function Vt(o,e,n){let i=F(o,t.__wbindgen_export4),a=p;return t.dci_transform_only(i,a,e,n)}function Kt(o,e){try{let c=t.__wbindgen_add_to_stack_pointer(-16),s=l(o,t.__wbindgen_export4),g=p,w=l(e,t.__wbindgen_export4),b=p;t.decode_arriraw12_luma(c,s,g,w,b);var n=r().getInt32(c+0,!0),i=r().getInt32(c+4,!0),a=r().getInt32(c+8,!0),d=r().getInt32(c+12,!0);if(d)throw u(a);var _=f(n,i).slice();return t.__wbindgen_export3(n,i*1,1),_}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Xt(o,e,n,i){let a=y(i,t.__wbindgen_export4,t.__wbindgen_export5),d=p,_=t.decode_arriraw12_mxf(x(o),e,n,a,d);return u(_)}function Yt(o,e,n){try{let s=t.__wbindgen_add_to_stack_pointer(-16),g=l(o,t.__wbindgen_export4),w=p,b=l(e,t.__wbindgen_export4),v=p;t.decode_arriraw12_preview(s,g,w,b,v,n);var i=r().getInt32(s+0,!0),a=r().getInt32(s+4,!0),d=r().getInt32(s+8,!0),_=r().getInt32(s+12,!0);if(_)throw u(d);var c=f(i,a).slice();return t.__wbindgen_export3(i,a*1,1),c}finally{t.__wbindgen_add_to_stack_pointer(16)}}function $t(o,e){try{let c=t.__wbindgen_add_to_stack_pointer(-16),s=l(o,t.__wbindgen_export4),g=p,w=l(e,t.__wbindgen_export4),b=p;t.decode_arriraw12_rgba(c,s,g,w,b);var n=r().getInt32(c+0,!0),i=r().getInt32(c+4,!0),a=r().getInt32(c+8,!0),d=r().getInt32(c+12,!0);if(d)throw u(a);var _=f(n,i).slice();return t.__wbindgen_export3(n,i*1,1),_}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Jt(o,e,n){try{let s=t.__wbindgen_add_to_stack_pointer(-16),g=l(o,t.__wbindgen_export4),w=p;t.decode_arriraw_luma(s,g,w,e,n);var i=r().getInt32(s+0,!0),a=r().getInt32(s+4,!0),d=r().getInt32(s+8,!0),_=r().getInt32(s+12,!0);if(_)throw u(d);var c=f(i,a).slice();return t.__wbindgen_export3(i,a*1,1),c}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Qt(o,e,n,i){let a=y(i,t.__wbindgen_export4,t.__wbindgen_export5),d=p,_=t.decode_arriraw_mxf(x(o),e,n,a,d);return u(_)}function Zt(o,e,n,i){try{let g=t.__wbindgen_add_to_stack_pointer(-16),w=l(o,t.__wbindgen_export4),b=p;t.decode_arriraw_preview(g,w,b,e,n,i);var a=r().getInt32(g+0,!0),d=r().getInt32(g+4,!0),_=r().getInt32(g+8,!0),c=r().getInt32(g+12,!0);if(c)throw u(_);var s=f(a,d).slice();return t.__wbindgen_export3(a,d*1,1),s}finally{t.__wbindgen_add_to_stack_pointer(16)}}function te(o,e,n,i){try{let g=t.__wbindgen_add_to_stack_pointer(-16),w=l(o,t.__wbindgen_export4),b=p;t.decode_arriraw_preview_gray(g,w,b,e,n,i);var a=r().getInt32(g+0,!0),d=r().getInt32(g+4,!0),_=r().getInt32(g+8,!0),c=r().getInt32(g+12,!0);if(c)throw u(_);var s=f(a,d).slice();return t.__wbindgen_export3(a,d*1,1),s}finally{t.__wbindgen_add_to_stack_pointer(16)}}function ee(o,e,n,i,a,d,_,c,s){try{let k=t.__wbindgen_add_to_stack_pointer(-16),M=l(o,t.__wbindgen_export4),O=p;var g=P(s)?0:Y(s,t.__wbindgen_export4),w=p;t.decode_arriraw_preview_meta(k,M,O,e,n,i,a,d,_,c,g,w);var b=r().getInt32(k+0,!0),v=r().getInt32(k+4,!0),m=r().getInt32(k+8,!0),I=r().getInt32(k+12,!0);if(I)throw u(m);var h=f(b,v).slice();return t.__wbindgen_export3(b,v*1,1),h}finally{t.__wbindgen_add_to_stack_pointer(16)}}function ne(o,e,n){try{let s=t.__wbindgen_add_to_stack_pointer(-16),g=l(o,t.__wbindgen_export4),w=p;t.decode_arriraw_rgba(s,g,w,e,n);var i=r().getInt32(s+0,!0),a=r().getInt32(s+4,!0),d=r().getInt32(s+8,!0),_=r().getInt32(s+12,!0);if(_)throw u(d);var c=f(i,a).slice();return t.__wbindgen_export3(i,a*1,1),c}finally{t.__wbindgen_add_to_stack_pointer(16)}}function re(o,e,n,i,a,d,_,c){try{let h=t.__wbindgen_add_to_stack_pointer(-16),k=l(o,t.__wbindgen_export4),M=p;var s=P(c)?0:Y(c,t.__wbindgen_export4),g=p;t.decode_arriraw_rgba_meta(h,k,M,e,n,i,a,d,_,s,g);var w=r().getInt32(h+0,!0),b=r().getInt32(h+4,!0),v=r().getInt32(h+8,!0),m=r().getInt32(h+12,!0);if(m)throw u(v);var I=f(w,b).slice();return t.__wbindgen_export3(w,b*1,1),I}finally{t.__wbindgen_add_to_stack_pointer(16)}}function _e(o,e){try{let c=t.__wbindgen_add_to_stack_pointer(-16),s=l(o,t.__wbindgen_export4),g=p;t.decode_arw_preview(c,s,g,e);var n=r().getInt32(c+0,!0),i=r().getInt32(c+4,!0),a=r().getInt32(c+8,!0),d=r().getInt32(c+12,!0);if(d)throw u(a);var _=f(n,i).slice();return t.__wbindgen_export3(n,i*1,1),_}finally{t.__wbindgen_add_to_stack_pointer(16)}}function oe(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_arw_rgba(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function ie(o,e,n,i){let a=t.decode_audio_pcm(x(o),e,n,i);return u(a)}function ae(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_bmp_rgba(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function de(o){try{let a=t.__wbindgen_add_to_stack_pointer(-16),d=l(o,t.__wbindgen_export4),_=p;t.decode_braw_gen5log(a,d,_);var e=r().getInt32(a+0,!0),n=r().getInt32(a+4,!0),i=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),i}finally{t.__wbindgen_add_to_stack_pointer(16)}}function ce(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_braw_luma(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function se(o,e){try{let c=t.__wbindgen_add_to_stack_pointer(-16),s=l(o,t.__wbindgen_export4),g=p;t.decode_braw_preview(c,s,g,e);var n=r().getInt32(c+0,!0),i=r().getInt32(c+4,!0),a=r().getInt32(c+8,!0),d=r().getInt32(c+12,!0);if(d)throw u(a);var _=f(n,i).slice();return t.__wbindgen_export3(n,i*1,1),_}finally{t.__wbindgen_add_to_stack_pointer(16)}}function pe(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_braw_rgba(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function ge(o,e){try{let c=t.__wbindgen_add_to_stack_pointer(-16),s=l(o,t.__wbindgen_export4),g=p;t.decode_cr2_preview(c,s,g,e);var n=r().getInt32(c+0,!0),i=r().getInt32(c+4,!0),a=r().getInt32(c+8,!0),d=r().getInt32(c+12,!0);if(d)throw u(a);var _=f(n,i).slice();return t.__wbindgen_export3(n,i*1,1),_}finally{t.__wbindgen_add_to_stack_pointer(16)}}function ue(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_cr2_rgba(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function we(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_cr3_rgba(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function be(o,e,n,i){let a=y(i,t.__wbindgen_export4,t.__wbindgen_export5),d=p,_=t.decode_crm(x(o),e,n,a,d);return u(_)}function le(o,e){try{let c=t.__wbindgen_add_to_stack_pointer(-16),s=l(o,t.__wbindgen_export4),g=p;t.decode_dng_preview(c,s,g,e);var n=r().getInt32(c+0,!0),i=r().getInt32(c+4,!0),a=r().getInt32(c+8,!0),d=r().getInt32(c+12,!0);if(d)throw u(a);var _=f(n,i).slice();return t.__wbindgen_export3(n,i*1,1),_}finally{t.__wbindgen_add_to_stack_pointer(16)}}function fe(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_dng_rgba(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function ve(o,e){try{let c=t.__wbindgen_add_to_stack_pointer(-16),s=l(o,t.__wbindgen_export4),g=p;t.decode_dpx_preview(c,s,g,e);var n=r().getInt32(c+0,!0),i=r().getInt32(c+4,!0),a=r().getInt32(c+8,!0),d=r().getInt32(c+12,!0);if(d)throw u(a);var _=f(n,i).slice();return t.__wbindgen_export3(n,i*1,1),_}finally{t.__wbindgen_add_to_stack_pointer(16)}}function xe(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_dpx_rgba(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Ie(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_dv_luma(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function ye(o,e){try{let c=t.__wbindgen_add_to_stack_pointer(-16),s=l(o,t.__wbindgen_export4),g=p;t.decode_dv_preview(c,s,g,e);var n=r().getInt32(c+0,!0),i=r().getInt32(c+4,!0),a=r().getInt32(c+8,!0),d=r().getInt32(c+12,!0);if(d)throw u(a);var _=f(n,i).slice();return t.__wbindgen_export3(n,i*1,1),_}finally{t.__wbindgen_add_to_stack_pointer(16)}}function me(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_dv_rgba(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function he(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_exr_linear(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function ke(o,e){try{let c=t.__wbindgen_add_to_stack_pointer(-16),s=l(o,t.__wbindgen_export4),g=p;t.decode_exr_preview(c,s,g,e);var n=r().getInt32(c+0,!0),i=r().getInt32(c+4,!0),a=r().getInt32(c+8,!0),d=r().getInt32(c+12,!0);if(d)throw u(a);var _=f(n,i).slice();return t.__wbindgen_export3(n,i*1,1),_}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Ae(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_exr_rgba(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Me(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_gif_rgba(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Ee(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_heic_rgba(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Te(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_j2k_luma(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Oe(o,e){try{let c=t.__wbindgen_add_to_stack_pointer(-16),s=l(o,t.__wbindgen_export4),g=p;t.decode_j2k_preview(c,s,g,e);var n=r().getInt32(c+0,!0),i=r().getInt32(c+4,!0),a=r().getInt32(c+8,!0),d=r().getInt32(c+12,!0);if(d)throw u(a);var _=f(n,i).slice();return t.__wbindgen_export3(n,i*1,1),_}finally{t.__wbindgen_add_to_stack_pointer(16)}}function We(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_j2k_rgba(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Fe(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_jpeg_rgba(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Se(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_mpeg2_luma(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Re(o,e){try{let c=t.__wbindgen_add_to_stack_pointer(-16),s=l(o,t.__wbindgen_export4),g=p;t.decode_mpeg2_preview(c,s,g,e);var n=r().getInt32(c+0,!0),i=r().getInt32(c+4,!0),a=r().getInt32(c+8,!0),d=r().getInt32(c+12,!0);if(d)throw u(a);var _=f(n,i).slice();return t.__wbindgen_export3(n,i*1,1),_}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Le(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_mpeg2_rgba(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function je(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_png_rgba(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function ze(o,e,n){try{let s=t.__wbindgen_add_to_stack_pointer(-16),g=l(o,t.__wbindgen_export4),w=p;t.decode_prores_band_rgba(s,g,w,e,n);var i=r().getInt32(s+0,!0),a=r().getInt32(s+4,!0),d=r().getInt32(s+8,!0),_=r().getInt32(s+12,!0);if(_)throw u(d);var c=f(i,a).slice();return t.__wbindgen_export3(i,a*1,1),c}finally{t.__wbindgen_add_to_stack_pointer(16)}}function De(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_prores_luma(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Ue(o,e,n,i){let a=y(i,t.__wbindgen_export4,t.__wbindgen_export5),d=p,_=t.decode_prores_mxf(x(o),e,n,a,d);return u(_)}function Pe(o,e){try{let c=t.__wbindgen_add_to_stack_pointer(-16),s=l(o,t.__wbindgen_export4),g=p;t.decode_prores_preview(c,s,g,e);var n=r().getInt32(c+0,!0),i=r().getInt32(c+4,!0),a=r().getInt32(c+8,!0),d=r().getInt32(c+12,!0);if(d)throw u(a);var _=f(n,i).slice();return t.__wbindgen_export3(n,i*1,1),_}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Be(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_prores_raw_acescct(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Ce(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_prores_raw_luma(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function qe(o,e){try{let c=t.__wbindgen_add_to_stack_pointer(-16),s=l(o,t.__wbindgen_export4),g=p;t.decode_prores_raw_preview(c,s,g,e);var n=r().getInt32(c+0,!0),i=r().getInt32(c+4,!0),a=r().getInt32(c+8,!0),d=r().getInt32(c+12,!0);if(d)throw u(a);var _=f(n,i).slice();return t.__wbindgen_export3(n,i*1,1),_}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Ne(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_prores_raw_rec2020(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function He(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_prores_raw_rgba(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Ge(o,e,n){try{let s=t.__wbindgen_add_to_stack_pointer(-16),g=l(o,t.__wbindgen_export4),w=p,b=y(e,t.__wbindgen_export4,t.__wbindgen_export5),v=p,m=l(n,t.__wbindgen_export4),I=p;t.decode_prores_raw_tier(s,g,w,b,v,m,I);var i=r().getInt32(s+0,!0),a=r().getInt32(s+4,!0),d=r().getInt32(s+8,!0),_=r().getInt32(s+12,!0);if(_)throw u(d);var c=f(i,a).slice();return t.__wbindgen_export3(i,a*1,1),c}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Ve(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_prores_rgb16(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Ke(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_prores_rgba(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Xe(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_prores_thumb_dc32(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Ye(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_psd_rgba(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function $e(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_r3d_luma(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Je(o,e){try{let c=t.__wbindgen_add_to_stack_pointer(-16),s=l(o,t.__wbindgen_export4),g=p;t.decode_r3d_preview(c,s,g,e);var n=r().getInt32(c+0,!0),i=r().getInt32(c+4,!0),a=r().getInt32(c+8,!0),d=r().getInt32(c+12,!0);if(d)throw u(a);var _=f(n,i).slice();return t.__wbindgen_export3(n,i*1,1),_}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Qe(o,e,n){try{let s=t.__wbindgen_add_to_stack_pointer(-16),g=l(o,t.__wbindgen_export4),w=p,b=l(e,t.__wbindgen_export4),v=p;t.decode_r3d_preview_clip(s,g,w,b,v,n);var i=r().getInt32(s+0,!0),a=r().getInt32(s+4,!0),d=r().getInt32(s+8,!0),_=r().getInt32(s+12,!0);if(_)throw u(d);var c=f(i,a).slice();return t.__wbindgen_export3(i,a*1,1),c}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Ze(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_r3d_rgb16(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function tn(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_r3d_rgba(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function en(o,e){try{let c=t.__wbindgen_add_to_stack_pointer(-16),s=l(o,t.__wbindgen_export4),g=p,w=l(e,t.__wbindgen_export4),b=p;t.decode_r3d_rgba_clip(c,s,g,w,b);var n=r().getInt32(c+0,!0),i=r().getInt32(c+4,!0),a=r().getInt32(c+8,!0),d=r().getInt32(c+12,!0);if(d)throw u(a);var _=f(n,i).slice();return t.__wbindgen_export3(n,i*1,1),_}finally{t.__wbindgen_add_to_stack_pointer(16)}}function nn(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_tga_rgba(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function rn(o,e){try{let c=t.__wbindgen_add_to_stack_pointer(-16),s=l(o,t.__wbindgen_export4),g=p;t.decode_tiff_preview(c,s,g,e);var n=r().getInt32(c+0,!0),i=r().getInt32(c+4,!0),a=r().getInt32(c+8,!0),d=r().getInt32(c+12,!0);if(d)throw u(a);var _=f(n,i).slice();return t.__wbindgen_export3(n,i*1,1),_}finally{t.__wbindgen_add_to_stack_pointer(16)}}function _n(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_tiff_rgba(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function on(o,e,n){try{let s=t.__wbindgen_add_to_stack_pointer(-16),g=l(o,t.__wbindgen_export4),w=p;t.decode_vc3_band_rgba(s,g,w,e,n);var i=r().getInt32(s+0,!0),a=r().getInt32(s+4,!0),d=r().getInt32(s+8,!0),_=r().getInt32(s+12,!0);if(_)throw u(d);var c=f(i,a).slice();return t.__wbindgen_export3(i,a*1,1),c}finally{t.__wbindgen_add_to_stack_pointer(16)}}function an(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_vc3_luma(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function dn(o,e,n,i){let a=y(i,t.__wbindgen_export4,t.__wbindgen_export5),d=p,_=t.decode_vc3_mxf(x(o),e,n,a,d);return u(_)}function cn(o,e){try{let c=t.__wbindgen_add_to_stack_pointer(-16),s=l(o,t.__wbindgen_export4),g=p;t.decode_vc3_preview(c,s,g,e);var n=r().getInt32(c+0,!0),i=r().getInt32(c+4,!0),a=r().getInt32(c+8,!0),d=r().getInt32(c+12,!0);if(d)throw u(a);var _=f(n,i).slice();return t.__wbindgen_export3(n,i*1,1),_}finally{t.__wbindgen_add_to_stack_pointer(16)}}function sn(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_vc3_rgba(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function pn(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_webp_rgba(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function gn(o){try{let a=t.__wbindgen_add_to_stack_pointer(-16),d=l(o,t.__wbindgen_export4),_=p;t.decode_xocn_index_luma(a,d,_);var e=r().getInt32(a+0,!0),n=r().getInt32(a+4,!0),i=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),i}finally{t.__wbindgen_add_to_stack_pointer(16)}}function un(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_xocn_luma(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function wn(o,e,n,i){let a=y(i,t.__wbindgen_export4,t.__wbindgen_export5),d=p,_=t.decode_xocn_mxf(x(o),e,n,a,d);return u(_)}function bn(o,e){try{let c=t.__wbindgen_add_to_stack_pointer(-16),s=l(o,t.__wbindgen_export4),g=p;t.decode_xocn_preview(c,s,g,e);var n=r().getInt32(c+0,!0),i=r().getInt32(c+4,!0),a=r().getInt32(c+8,!0),d=r().getInt32(c+12,!0);if(d)throw u(a);var _=f(n,i).slice();return t.__wbindgen_export3(n,i*1,1),_}finally{t.__wbindgen_add_to_stack_pointer(16)}}function ln(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_xocn_preview_rec709(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function fn(o){try{let a=t.__wbindgen_add_to_stack_pointer(-16),d=l(o,t.__wbindgen_export4),_=p;t.decode_xocn_rgb16(a,d,_);var e=r().getInt32(a+0,!0),n=r().getInt32(a+4,!0),i=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),i}finally{t.__wbindgen_add_to_stack_pointer(16)}}function vn(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.decode_xocn_rgba(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function xn(o,e,n,i){try{let g=t.__wbindgen_add_to_stack_pointer(-16),w=F(o,t.__wbindgen_export4),b=p;t.encode_dci_j2c(g,w,b,e,n,i);var a=r().getInt32(g+0,!0),d=r().getInt32(g+4,!0),_=r().getInt32(g+8,!0),c=r().getInt32(g+12,!0);if(c)throw u(_);var s=f(a,d).slice();return t.__wbindgen_export3(a,d*1,1),s}finally{t.__wbindgen_add_to_stack_pointer(16)}}function In(o,e,n,i,a,d){try{let b=t.__wbindgen_add_to_stack_pointer(-16),v=F(o,t.__wbindgen_export4),m=p,I=y(n,t.__wbindgen_export4,t.__wbindgen_export5),h=p;t.encode_dci_j2c_rgb(b,v,m,e,I,h,i,a,d);var _=r().getInt32(b+0,!0),c=r().getInt32(b+4,!0),s=r().getInt32(b+8,!0),g=r().getInt32(b+12,!0);if(g)throw u(s);var w=f(_,c).slice();return t.__wbindgen_export3(_,c*1,1),w}finally{t.__wbindgen_add_to_stack_pointer(16)}}function yn(o,e,n,i,a){try{let w=t.__wbindgen_add_to_stack_pointer(-16),b=l(o,t.__wbindgen_export4),v=p,m=y(e,t.__wbindgen_export4,t.__wbindgen_export5),I=p;t.encode_dci_j2c_rgba8(w,b,v,m,I,n,i,a);var d=r().getInt32(w+0,!0),_=r().getInt32(w+4,!0),c=r().getInt32(w+8,!0),s=r().getInt32(w+12,!0);if(s)throw u(c);var g=f(d,_).slice();return t.__wbindgen_export3(d,_*1,1),g}finally{t.__wbindgen_add_to_stack_pointer(16)}}function mn(o,e,n,i,a){try{let w=t.__wbindgen_add_to_stack_pointer(-16),b=y(i,t.__wbindgen_export4,t.__wbindgen_export5),v=p;t.encode_dci_j2c_staged(w,o,e,n,b,v,a);var d=r().getInt32(w+0,!0),_=r().getInt32(w+4,!0),c=r().getInt32(w+8,!0),s=r().getInt32(w+12,!0);if(s)throw u(c);var g=f(d,_).slice();return t.__wbindgen_export3(d,_*1,1),g}finally{t.__wbindgen_add_to_stack_pointer(16)}}function hn(o,e,n,i,a){try{let w=t.__wbindgen_add_to_stack_pointer(-16),b=y(i,t.__wbindgen_export4,t.__wbindgen_export5),v=p;t.encode_dci_j2c_staged_modelled(w,o,e,n,b,v,a);var d=r().getInt32(w+0,!0),_=r().getInt32(w+4,!0),c=r().getInt32(w+8,!0),s=r().getInt32(w+12,!0);if(s)throw u(c);var g=f(d,_).slice();return t.__wbindgen_export3(d,_*1,1),g}finally{t.__wbindgen_add_to_stack_pointer(16)}}function kn(o,e,n,i,a,d,_,c,s,g,w,b,v,m,I){try{let T=t.__wbindgen_add_to_stack_pointer(-16),S=ot(o,t.__wbindgen_export4),L=p,j=y(a,t.__wbindgen_export4,t.__wbindgen_export5),D=p,C=y(d,t.__wbindgen_export4,t.__wbindgen_export5),q=p,it=y(_,t.__wbindgen_export4,t.__wbindgen_export5),at=p,dt=y(v,t.__wbindgen_export4,t.__wbindgen_export5),ct=p;t.encode_exr(T,S,L,e,n,i,j,D,C,q,it,at,c,s,g,w,b,dt,ct,m,I);var h=r().getInt32(T+0,!0),k=r().getInt32(T+4,!0),M=r().getInt32(T+8,!0),O=r().getInt32(T+12,!0);if(O)throw u(M);var W=f(h,k).slice();return t.__wbindgen_export3(h,k*1,1),W}finally{t.__wbindgen_add_to_stack_pointer(16)}}function An(o,e,n,i,a){try{let w=t.__wbindgen_add_to_stack_pointer(-16),b=l(o,t.__wbindgen_export4),v=p;t.encode_prores_4444_alpha_mov_rgba(w,b,v,e,n,i,a);var d=r().getInt32(w+0,!0),_=r().getInt32(w+4,!0),c=r().getInt32(w+8,!0),s=r().getInt32(w+12,!0);if(s)throw u(c);var g=f(d,_).slice();return t.__wbindgen_export3(d,_*1,1),g}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Mn(o,e,n,i){try{let g=t.__wbindgen_add_to_stack_pointer(-16),w=l(o,t.__wbindgen_export4),b=p;t.encode_prores_4444_alpha_sample_q(g,w,b,e,n,i);var a=r().getInt32(g+0,!0),d=r().getInt32(g+4,!0),_=r().getInt32(g+8,!0),c=r().getInt32(g+12,!0);if(c)throw u(_);var s=f(a,d).slice();return t.__wbindgen_export3(a,d*1,1),s}finally{t.__wbindgen_add_to_stack_pointer(16)}}function En(o,e,n,i){try{let g=t.__wbindgen_add_to_stack_pointer(-16),w=l(o,t.__wbindgen_export4),b=p;t.encode_prores_444_sample_cbr(g,w,b,e,n,i);var a=r().getInt32(g+0,!0),d=r().getInt32(g+4,!0),_=r().getInt32(g+8,!0),c=r().getInt32(g+12,!0);if(c)throw u(_);var s=f(a,d).slice();return t.__wbindgen_export3(a,d*1,1),s}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Tn(o,e,n,i){try{let g=t.__wbindgen_add_to_stack_pointer(-16),w=F(o,t.__wbindgen_export4),b=p;t.encode_prores_444_sample_cbr_rgb16(g,w,b,e,n,i);var a=r().getInt32(g+0,!0),d=r().getInt32(g+4,!0),_=r().getInt32(g+8,!0),c=r().getInt32(g+12,!0);if(c)throw u(_);var s=f(a,d).slice();return t.__wbindgen_export3(a,d*1,1),s}finally{t.__wbindgen_add_to_stack_pointer(16)}}function On(o,e,n,i,a){try{let w=t.__wbindgen_add_to_stack_pointer(-16),b=F(o,t.__wbindgen_export4),v=p,m=F(a,t.__wbindgen_export4),I=p;t.encode_prores_444_sample_cbr_rgb16_lut(w,b,v,e,n,i,m,I);var d=r().getInt32(w+0,!0),_=r().getInt32(w+4,!0),c=r().getInt32(w+8,!0),s=r().getInt32(w+12,!0);if(s)throw u(c);var g=f(d,_).slice();return t.__wbindgen_export3(d,_*1,1),g}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Wn(o,e,n,i,a){try{let w=t.__wbindgen_add_to_stack_pointer(-16),b=l(o,t.__wbindgen_export4),v=p;t.encode_prores_mov_rgba(w,b,v,e,n,i,a);var d=r().getInt32(w+0,!0),_=r().getInt32(w+4,!0),c=r().getInt32(w+8,!0),s=r().getInt32(w+12,!0);if(s)throw u(c);var g=f(d,_).slice();return t.__wbindgen_export3(d,_*1,1),g}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Fn(o,e,n){try{let s=t.__wbindgen_add_to_stack_pointer(-16),g=l(o,t.__wbindgen_export4),w=p;t.encode_prores_rgba(s,g,w,e,n);var i=r().getInt32(s+0,!0),a=r().getInt32(s+4,!0),d=r().getInt32(s+8,!0),_=r().getInt32(s+12,!0);if(_)throw u(d);var c=f(i,a).slice();return t.__wbindgen_export3(i,a*1,1),c}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Sn(o,e,n,i){try{let g=t.__wbindgen_add_to_stack_pointer(-16),w=l(o,t.__wbindgen_export4),b=p;t.encode_prores_sample_cbr(g,w,b,e,n,i);var a=r().getInt32(g+0,!0),d=r().getInt32(g+4,!0),_=r().getInt32(g+8,!0),c=r().getInt32(g+12,!0);if(c)throw u(_);var s=f(a,d).slice();return t.__wbindgen_export3(a,d*1,1),s}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Rn(o,e,n,i){try{let g=t.__wbindgen_add_to_stack_pointer(-16),w=F(o,t.__wbindgen_export4),b=p;t.encode_prores_sample_cbr_rgb16(g,w,b,e,n,i);var a=r().getInt32(g+0,!0),d=r().getInt32(g+4,!0),_=r().getInt32(g+8,!0),c=r().getInt32(g+12,!0);if(c)throw u(_);var s=f(a,d).slice();return t.__wbindgen_export3(a,d*1,1),s}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Ln(o,e,n,i,a){try{let w=t.__wbindgen_add_to_stack_pointer(-16),b=F(o,t.__wbindgen_export4),v=p,m=F(a,t.__wbindgen_export4),I=p;t.encode_prores_sample_cbr_rgb16_lut(w,b,v,e,n,i,m,I);var d=r().getInt32(w+0,!0),_=r().getInt32(w+4,!0),c=r().getInt32(w+8,!0),s=r().getInt32(w+12,!0);if(s)throw u(c);var g=f(d,_).slice();return t.__wbindgen_export3(d,_*1,1),g}finally{t.__wbindgen_add_to_stack_pointer(16)}}function jn(o,e,n,i){try{let g=t.__wbindgen_add_to_stack_pointer(-16),w=l(o,t.__wbindgen_export4),b=p;t.encode_prores_sample_q(g,w,b,e,n,i);var a=r().getInt32(g+0,!0),d=r().getInt32(g+4,!0),_=r().getInt32(g+8,!0),c=r().getInt32(g+12,!0);if(c)throw u(_);var s=f(a,d).slice();return t.__wbindgen_export3(a,d*1,1),s}finally{t.__wbindgen_add_to_stack_pointer(16)}}function zn(o,e,n,i){let a,d;try{let v=t.__wbindgen_add_to_stack_pointer(-16),m=y(o,t.__wbindgen_export4,t.__wbindgen_export5),I=p;t.exr_sequence_filename(v,m,I,e,n,i);var _=r().getInt32(v+0,!0),c=r().getInt32(v+4,!0),s=r().getInt32(v+8,!0),g=r().getInt32(v+12,!0),w=_,b=c;if(g)throw w=0,b=0,u(s);return a=w,d=b,E(w,b)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(a,d,1)}}function Dn(o,e,n,i,a,d,_,c){let s,g;try{let k=t.__wbindgen_add_to_stack_pointer(-16),M=l(o,t.__wbindgen_export4),O=p,W=l(i,t.__wbindgen_export4),T=p,S=y(c,t.__wbindgen_export4,t.__wbindgen_export5),L=p;t.fit_sizing(k,M,O,e,n,W,T,a,d,_,S,L);var w=r().getInt32(k+0,!0),b=r().getInt32(k+4,!0),v=r().getInt32(k+8,!0),m=r().getInt32(k+12,!0),I=w,h=b;if(m)throw I=0,h=0,u(v);return s=I,g=h,E(I,h)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(s,g,1)}}function Un(o){let e,n;try{let d=t.__wbindgen_add_to_stack_pointer(-16),_=l(o,t.__wbindgen_export4),c=p;t.inspect_arw(d,_,c);var i=r().getInt32(d+0,!0),a=r().getInt32(d+4,!0);return e=i,n=a,E(i,a)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(e,n,1)}}function Pn(o){let e,n;try{let d=t.__wbindgen_add_to_stack_pointer(-16),_=l(o,t.__wbindgen_export4),c=p;t.inspect_cr2(d,_,c);var i=r().getInt32(d+0,!0),a=r().getInt32(d+4,!0);return e=i,n=a,E(i,a)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(e,n,1)}}function Bn(o){let e,n;try{let d=t.__wbindgen_add_to_stack_pointer(-16),_=l(o,t.__wbindgen_export4),c=p;t.inspect_cr3(d,_,c);var i=r().getInt32(d+0,!0),a=r().getInt32(d+4,!0);return e=i,n=a,E(i,a)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(e,n,1)}}function Cn(o){let e,n;try{let d=t.__wbindgen_add_to_stack_pointer(-16),_=l(o,t.__wbindgen_export4),c=p;t.inspect_dng(d,_,c);var i=r().getInt32(d+0,!0),a=r().getInt32(d+4,!0);return e=i,n=a,E(i,a)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(e,n,1)}}function qn(o){let e,n;try{let d=t.__wbindgen_add_to_stack_pointer(-16),_=l(o,t.__wbindgen_export4),c=p;t.inspect_dpx(d,_,c);var i=r().getInt32(d+0,!0),a=r().getInt32(d+4,!0);return e=i,n=a,E(i,a)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(e,n,1)}}function Nn(o){let e,n;try{let d=t.__wbindgen_add_to_stack_pointer(-16),_=l(o,t.__wbindgen_export4),c=p;t.inspect_exr(d,_,c);var i=r().getInt32(d+0,!0),a=r().getInt32(d+4,!0);return e=i,n=a,E(i,a)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(e,n,1)}}function Hn(o,e,n){let i=y(n,t.__wbindgen_export4,t.__wbindgen_export5),a=p,d=t.inspect_isobmff(x(o),e,i,a);return u(d)}function Gn(o){let e,n;try{let d=t.__wbindgen_add_to_stack_pointer(-16),_=l(o,t.__wbindgen_export4),c=p;t.inspect_tiff(d,_,c);var i=r().getInt32(d+0,!0),a=r().getInt32(d+4,!0);return e=i,n=a,E(i,a)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(e,n,1)}}function Vn(o,e){let n=t.inspect_wav(x(o),e);return u(n)}function Kn(o,e){let n=t.is_arriraw12_mxf(x(o),e);return u(n)}function Xn(o,e){let n=t.is_arriraw_mxf(x(o),e);return u(n)}function Yn(o,e){let n=t.is_crm(x(o),e);return u(n)}function $n(o,e){let n=t.is_prores_mxf(x(o),e);return u(n)}function Jn(o,e){let n=t.is_vc3_mxf(x(o),e);return u(n)}function Qn(o,e){let n=t.is_xavc_mxf(x(o),e);return u(n)}function Zn(o,e){let n=t.is_xocn_mxf(x(o),e);return u(n)}function tr(o,e,n){let i=y(n,t.__wbindgen_export4,t.__wbindgen_export5),a=p,d=t.list_isobmff_segments(x(o),e,i,a);return u(d)}function er(o,e){let n=t.list_mxf_segments(x(o),e);return u(n)}function nr(o,e){let n=y(e,t.__wbindgen_export4,t.__wbindgen_export5),i=p,a=t.list_r3d_frames(x(o),n,i);return u(a)}function rr(o,e){let n=y(e,t.__wbindgen_export4,t.__wbindgen_export5),i=p,a=t.list_r3d_segments(x(o),n,i);return u(a)}function _r(o,e){let n=t.list_wav_segments(x(o),e);return u(n)}function or(o,e,n,i,a,d){try{let b=t.__wbindgen_add_to_stack_pointer(-16),v=l(o,t.__wbindgen_export4),m=p,I=R(e,t.__wbindgen_export4),h=p;t.mux_prores_4444_alpha_samples(b,v,m,I,h,n,i,a,d);var _=r().getInt32(b+0,!0),c=r().getInt32(b+4,!0),s=r().getInt32(b+8,!0),g=r().getInt32(b+12,!0);if(g)throw u(s);var w=f(_,c).slice();return t.__wbindgen_export3(_,c*1,1),w}finally{t.__wbindgen_add_to_stack_pointer(16)}}function ir(o,e,n,i,a,d){try{let b=t.__wbindgen_add_to_stack_pointer(-16),v=l(o,t.__wbindgen_export4),m=p,I=R(e,t.__wbindgen_export4),h=p;t.mux_prores_samples(b,v,m,I,h,n,i,a,d);var _=r().getInt32(b+0,!0),c=r().getInt32(b+4,!0),s=r().getInt32(b+8,!0),g=r().getInt32(b+12,!0);if(g)throw u(s);var w=f(_,c).slice();return t.__wbindgen_export3(_,c*1,1),w}finally{t.__wbindgen_add_to_stack_pointer(16)}}function ar(o,e,n,i,a,d,_,c,s,g,w,b){try{let M=t.__wbindgen_add_to_stack_pointer(-16),O=l(o,t.__wbindgen_export4),W=p,T=R(e,t.__wbindgen_export4),S=p,L=y(_,t.__wbindgen_export4,t.__wbindgen_export5),j=p;t.mux_prores_samples_full(M,O,W,T,S,n,i,a,d,L,j,c,s,g,w,b);var v=r().getInt32(M+0,!0),m=r().getInt32(M+4,!0),I=r().getInt32(M+8,!0),h=r().getInt32(M+12,!0);if(h)throw u(I);var k=f(v,m).slice();return t.__wbindgen_export3(v,m*1,1),k}finally{t.__wbindgen_add_to_stack_pointer(16)}}function dr(o,e,n,i){let a=t.mxf_au_run(x(o),e,n,i);return u(a)}function cr(o,e){let n=t.mxf_frame_index(x(o),e);return u(n)}function sr(o,e){let n=t.mxf_gop_map(x(o),e);return u(n)}function pr(o,e){let n=t.mxf_h264_kind(x(o),e);return u(n)}function gr(o,e){let n,i;try{let w=t.__wbindgen_add_to_stack_pointer(-16),b=l(o,t.__wbindgen_export4),v=p,m=y(e,t.__wbindgen_export4,t.__wbindgen_export5),I=p;t.plan_isobmff_trim(w,b,v,m,I);var a=r().getInt32(w+0,!0),d=r().getInt32(w+4,!0),_=r().getInt32(w+8,!0),c=r().getInt32(w+12,!0),s=a,g=d;if(c)throw s=0,g=0,u(_);return n=s,i=g,E(s,g)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(n,i,1)}}function ur(o,e,n,i,a){let d=y(a,t.__wbindgen_export4,t.__wbindgen_export5),_=p,c=t.plan_isobmff_trim_reader(x(o),e,n,i,d,_);return u(c)}function wr(o){let e,n;try{let g=t.__wbindgen_add_to_stack_pointer(-16),w=y(o,t.__wbindgen_export4,t.__wbindgen_export5),b=p;t.plan_mxf_compact_trim(g,w,b);var i=r().getInt32(g+0,!0),a=r().getInt32(g+4,!0),d=r().getInt32(g+8,!0),_=r().getInt32(g+12,!0),c=i,s=a;if(_)throw c=0,s=0,u(d);return e=c,n=s,E(c,s)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(e,n,1)}}function br(o,e,n,i){let a=t.plan_mxf_trim(x(o),e,n,i);return u(a)}function lr(o,e,n,i,a,d,_,c){let s,g;try{let v=t.__wbindgen_add_to_stack_pointer(-16),m=l(o,t.__wbindgen_export4),I=p,h=l(e,t.__wbindgen_export4),k=p,M=l(n,t.__wbindgen_export4),O=p,W=l(i,t.__wbindgen_export4),T=p,S=Y(a,t.__wbindgen_export4),L=p,j=Y(d,t.__wbindgen_export4),D=p,C=Y(_,t.__wbindgen_export4),q=p;t.plan_r3d_compact(v,m,I,h,k,M,O,W,T,S,L,j,D,C,q,c);var w=r().getInt32(v+0,!0),b=r().getInt32(v+4,!0);return s=w,g=b,E(w,b)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(s,g,1)}}function fr(o,e,n,i){let a,d;try{let v=t.__wbindgen_add_to_stack_pointer(-16),m=l(o,t.__wbindgen_export4),I=p;t.plan_wav_trim(v,m,I,e,n,i);var _=r().getInt32(v+0,!0),c=r().getInt32(v+4,!0),s=r().getInt32(v+8,!0),g=r().getInt32(v+12,!0),w=_,b=c;if(g)throw w=0,b=0,u(s);return a=w,d=b,E(w,b)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(a,d,1)}}function vr(o,e,n,i,a){let d=t.plan_wav_trim_reader(x(o),e,n,i,a);return u(d)}function xr(o,e,n,i){let a=y(n,t.__wbindgen_export4,t.__wbindgen_export5),d=p,_=y(i,t.__wbindgen_export4,t.__wbindgen_export5),c=p,s=t.prepare_isobmff(x(o),e,a,d,_,c);return u(s)}function Ir(o,e,n){let i=y(n,t.__wbindgen_export4,t.__wbindgen_export5),a=p,d=t.prepare_mxf(x(o),e,i,a);return u(d)}function yr(o,e,n){let i=y(e,t.__wbindgen_export4,t.__wbindgen_export5),a=p,d=y(n,t.__wbindgen_export4,t.__wbindgen_export5),_=p,c=t.prepare_r3d(x(o),i,a,d,_);return u(c)}function mr(o,e,n,i){let a=y(n,t.__wbindgen_export4,t.__wbindgen_export5),d=p,_=t.prepare_wav(x(o),e,a,d,i);return u(_)}function hr(o){let e,n;try{let g=t.__wbindgen_add_to_stack_pointer(-16),w=l(o,t.__wbindgen_export4),b=p;t.probe_mov(g,w,b);var i=r().getInt32(g+0,!0),a=r().getInt32(g+4,!0),d=r().getInt32(g+8,!0),_=r().getInt32(g+12,!0),c=i,s=a;if(_)throw c=0,s=0,u(d);return e=c,n=s,E(c,s)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(e,n,1)}}function kr(o,e){let n=t.probe_mxf(x(o),e);return u(n)}function Ar(o,e){let n=y(e,t.__wbindgen_export4,t.__wbindgen_export5),i=p,a=t.probe_r3d(x(o),n,i);return u(a)}function Mr(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.prores_band_info(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=nt(e,n).slice();return t.__wbindgen_export3(e,n*4,4),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Er(o){try{let a=t.__wbindgen_add_to_stack_pointer(-16),d=l(o,t.__wbindgen_export4),_=p;t.prores_raw_container_color(a,d,_);var e=r().getInt32(a+0,!0),n=r().getInt32(a+4,!0),i=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),i}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Tr(){t.prores_reset_rate_control()}function Or(o){try{let a=t.__wbindgen_add_to_stack_pointer(-16),d=l(o,t.__wbindgen_export4),_=p;t.r3d_gpu_develop_params(a,d,_);var e=r().getInt32(a+0,!0),n=r().getInt32(a+4,!0),i=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),i}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Wr(o,e,n){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.r3d_index_ranges(_,c,s,e,n);var i=r().getInt32(_+0,!0),a=r().getInt32(_+4,!0),d=nt(i,a).slice();return t.__wbindgen_export3(i,a*4,4),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Fr(o){let e=l(o,t.__wbindgen_export4),n=p;return t.r3d_is_helium(e,n)!==0}function Sr(o){let e,n;try{let g=t.__wbindgen_add_to_stack_pointer(-16),w=l(o,t.__wbindgen_export4),b=p;t.read_arriraw_fcs(g,w,b);var i=r().getInt32(g+0,!0),a=r().getInt32(g+4,!0),d=r().getInt32(g+8,!0),_=r().getInt32(g+12,!0),c=i,s=a;if(_)throw c=0,s=0,u(d);return e=c,n=s,E(c,s)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(e,n,1)}}function Rr(o,e){try{let d=t.__wbindgen_add_to_stack_pointer(-16),_=l(o,t.__wbindgen_export4),c=p;t.read_arriraw_unit_correction(d,_,c,e);var n=r().getInt32(d+0,!0),i=r().getInt32(d+4,!0),a=r_(n,i).slice();return t.__wbindgen_export3(n,i*8,8),a}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Lr(o,e,n,i,a,d,_){let c,s;try{let h=t.__wbindgen_add_to_stack_pointer(-16),k=l(o,t.__wbindgen_export4),M=p,O=l(i,t.__wbindgen_export4),W=p,T=y(_,t.__wbindgen_export4,t.__wbindgen_export5),S=p;t.recover_reframe(h,k,M,e,n,O,W,a,d,T,S);var g=r().getInt32(h+0,!0),w=r().getInt32(h+4,!0),b=r().getInt32(h+8,!0),v=r().getInt32(h+12,!0),m=g,I=w;if(v)throw m=0,I=0,u(b);return c=m,s=I,E(m,I)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(c,s,1)}}function jr(o,e,n,i,a,d){try{let b=t.__wbindgen_add_to_stack_pointer(-16),v=F(o,t.__wbindgen_export4),m=p,I=y(d,t.__wbindgen_export4,t.__wbindgen_export5),h=p;t.resample_rgba16(b,v,m,e,n,i,a,I,h);var _=r().getInt32(b+0,!0),c=r().getInt32(b+4,!0),s=r().getInt32(b+8,!0),g=r().getInt32(b+12,!0);if(g)throw u(s);var w=gt(_,c).slice();return t.__wbindgen_export3(_,c*2,2),w}finally{t.__wbindgen_add_to_stack_pointer(16)}}function zr(o,e,n,i,a,d){try{let b=t.__wbindgen_add_to_stack_pointer(-16),v=l(o,t.__wbindgen_export4),m=p,I=y(d,t.__wbindgen_export4,t.__wbindgen_export5),h=p;t.resample_rgba8(b,v,m,e,n,i,a,I,h);var _=r().getInt32(b+0,!0),c=r().getInt32(b+4,!0),s=r().getInt32(b+8,!0),g=r().getInt32(b+12,!0);if(g)throw u(s);var w=f(_,c).slice();return t.__wbindgen_export3(_,c*1,1),w}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Dr(){t.reset_dci_rate_state()}function Ur(o,e,n,i){try{let g=t.__wbindgen_add_to_stack_pointer(-16),w=l(o,t.__wbindgen_export4),b=p;t.resize_luma_area(g,w,b,e,n,i);var a=r().getInt32(g+0,!0),d=r().getInt32(g+4,!0),_=r().getInt32(g+8,!0),c=r().getInt32(g+12,!0);if(c)throw u(_);var s=f(a,d).slice();return t.__wbindgen_export3(a,d*1,1),s}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Pr(o,e,n,i,a){try{let w=t.__wbindgen_add_to_stack_pointer(-16),b=l(o,t.__wbindgen_export4),v=p,m=y(a,t.__wbindgen_export4,t.__wbindgen_export5),I=p;t.rgba8_to_xyz12(w,b,v,e,n,i,m,I);var d=r().getInt32(w+0,!0),_=r().getInt32(w+4,!0),c=r().getInt32(w+8,!0),s=r().getInt32(w+12,!0);if(s)throw u(c);var g=gt(d,_).slice();return t.__wbindgen_export3(d,_*2,2),g}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Br(o,e,n,i){let a,d;try{let v=t.__wbindgen_add_to_stack_pointer(-16),m=F(o,t.__wbindgen_export4),I=p,h=l(e,t.__wbindgen_export4),k=p,M=R(n,t.__wbindgen_export4),O=p,W=y(i,t.__wbindgen_export4,t.__wbindgen_export5),T=p;t.shot_crop(v,m,I,h,k,M,O,W,T);var _=r().getInt32(v+0,!0),c=r().getInt32(v+4,!0),s=r().getInt32(v+8,!0),g=r().getInt32(v+12,!0),w=_,b=c;if(g)throw w=0,b=0,u(s);return a=w,d=b,E(w,b)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(a,d,1)}}function Cr(o,e,n){let i,a;try{let b=t.__wbindgen_add_to_stack_pointer(-16),v=F(o,t.__wbindgen_export4),m=p,I=l(e,t.__wbindgen_export4),h=p,k=y(n,t.__wbindgen_export4,t.__wbindgen_export5),M=p;t.shot_ramp(b,v,m,I,h,k,M);var d=r().getInt32(b+0,!0),_=r().getInt32(b+4,!0),c=r().getInt32(b+8,!0),s=r().getInt32(b+12,!0),g=d,w=_;if(s)throw g=0,w=0,u(c);return i=g,a=w,E(g,w)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(i,a,1)}}function qr(o,e,n,i){let a,d;try{let v=t.__wbindgen_add_to_stack_pointer(-16),m=F(o,t.__wbindgen_export4),I=p,h=l(e,t.__wbindgen_export4),k=p,M=R(n,t.__wbindgen_export4),O=p,W=y(i,t.__wbindgen_export4,t.__wbindgen_export5),T=p;t.shot_scan(v,m,I,h,k,M,O,W,T);var _=r().getInt32(v+0,!0),c=r().getInt32(v+4,!0),s=r().getInt32(v+8,!0),g=r().getInt32(v+12,!0),w=_,b=c;if(g)throw w=0,b=0,u(s);return a=w,d=b,E(w,b)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(a,d,1)}}function Nr(o,e,n,i){let a=y(e,t.__wbindgen_export4,t.__wbindgen_export5),d=p,_=y(n,t.__wbindgen_export4,t.__wbindgen_export5),c=p,s=y(i,t.__wbindgen_export4,t.__wbindgen_export5),g=p,w=t.trim_r3d(x(o),a,d,_,c,s,g);return u(w)}function Hr(o){try{let _=t.__wbindgen_add_to_stack_pointer(-16),c=l(o,t.__wbindgen_export4),s=p;t.vc3_band_info(_,c,s);var e=r().getInt32(_+0,!0),n=r().getInt32(_+4,!0),i=r().getInt32(_+8,!0),a=r().getInt32(_+12,!0);if(a)throw u(i);var d=nt(e,n).slice();return t.__wbindgen_export3(e,n*4,4),d}finally{t.__wbindgen_add_to_stack_pointer(16)}}function Gr(o){t.video_close(o)}function Vr(o,e,n,i){let a=t.video_decode(o,e,n,i);return u(a)}function Kr(o,e,n){let i=y(n,t.__wbindgen_export4,t.__wbindgen_export5),a=p,d=t.video_frame_index_isobmff_reader(x(o),e,i,a);return u(d)}function Xr(o,e){let n=t.video_open(x(o),e);return u(n)}function Yr(o,e,n){let i=t.xavc_au(x(o),e,n);return u(i)}function $r(o,e){let n=t.xavc_frame_count(x(o),e);return u(n)}function Jr(o,e){let n=t.xocn_frame_count(x(o),e);return u(n)}function Qr(o){let e=l(o,t.__wbindgen_export4),n=p;return t.xocn_index_prefix_len(e,n)>>>0}function Zr(o){let e=l(o,t.__wbindgen_export4),n=p;return t.xocn_preview_prefix_len(e,n)>>>0}function It(){return{__proto__:null,"./media_core_bg.js":{__proto__:null,__wbg___wbindgen_copy_to_typed_array_c5728021fabd0236:function(e,n,i){new Uint8Array(A(i).buffer,A(i).byteOffset,A(i).byteLength).set(f(e,n))},__wbg___wbindgen_is_function_acc5528be2b923f2:function(e){return typeof A(e)=="function"},__wbg___wbindgen_is_undefined_721f8decd50c87a3:function(e){return A(e)===void 0},__wbg___wbindgen_throw_ea4887a5f8f9a9db:function(e,n){throw new Error(E(e,n))},__wbg__wbg_cb_unref_33c39e13d73b25f6:function(e){A(e)._wbg_cb_unref()},__wbg_call_0e855b388e315e17:function(){return st(function(e,n,i,a){let d=A(e).call(A(n),A(i),A(a));return x(d)},arguments)},__wbg_call_5575218572ead796:function(){return st(function(e,n,i){let a=A(e).call(A(n),A(i));return x(a)},arguments)},__wbg_call_dd0f909cbc9405d0:function(){return st(function(e,n,i,a,d){let _=A(e).call(A(n),A(i),A(a),A(d));return x(_)},arguments)},__wbg_length_589238bdcf171f0e:function(e){return A(e).length},__wbg_new_81880fb5002cb255:function(e){let n=new Uint8Array(A(e));return x(n)},__wbg_new_typed_00a409eb4ec4f2d9:function(e,n){try{var i={a:e,b:n},a=(_,c)=>{let s=i.a;i.a=0;try{return e_(s,i.b,_,c)}finally{i.a=s}};let d=new Promise(a);return x(d)}finally{i.a=0}},__wbg_prototypesetcall_d721637c7ca66eb8:function(e,n,i){Uint8Array.prototype.set.call(f(e,n),A(i))},__wbg_queueMicrotask_1c9b3800e321a967:function(e){let n=A(e).queueMicrotask;return x(n)},__wbg_queueMicrotask_311744e534a929a3:function(e){queueMicrotask(A(e))},__wbg_resolve_d82363d90af6928a:function(e){let n=Promise.resolve(A(e));return x(n)},__wbg_static_accessor_GLOBAL_THIS_2fee5048bcca5938:function(){let e=typeof globalThis>"u"?null:globalThis;return P(e)?0:x(e)},__wbg_static_accessor_GLOBAL_ce44e66a4935da8c:function(){let e=typeof global>"u"?null:global;return P(e)?0:x(e)},__wbg_static_accessor_SELF_44f6e0cb5e67cdad:function(){let e=typeof self>"u"?null:self;return P(e)?0:x(e)},__wbg_static_accessor_WINDOW_168f178805d978fe:function(){let e=typeof window>"u"?null:window;return P(e)?0:x(e)},__wbg_then_05edfc8a4fea5106:function(e,n,i){let a=A(e).then(A(n),A(i));return x(a)},__wbg_then_591b6b3a75ee817a:function(e,n){let i=A(e).then(A(n));return x(i)},__wbindgen_cast_0000000000000001:function(e,n){let i=o_(e,n,t_);return x(i)},__wbindgen_cast_0000000000000002:function(e){return x(e)},__wbindgen_cast_0000000000000003:function(e,n){let i=f(e,n);return x(i)},__wbindgen_cast_0000000000000004:function(e,n){let i=E(e,n);return x(i)},__wbindgen_cast_0000000000000005:function(e,n){var i=f(e,n).slice();return t.__wbindgen_export3(e,n*1,1),x(i)},__wbindgen_object_clone_ref:function(e){let n=A(e);return x(n)},__wbindgen_object_drop_ref:function(e){u(e)}}}}function t_(o,e,n){try{let d=t.__wbindgen_add_to_stack_pointer(-16);t.__wasm_bindgen_func_elem_3136(d,o,e,x(n));var i=r().getInt32(d+0,!0),a=r().getInt32(d+4,!0);if(a)throw u(i)}finally{t.__wbindgen_add_to_stack_pointer(16)}}function e_(o,e,n,i){t.__wasm_bindgen_func_elem_3151(o,e,x(n),x(i))}var wt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(o=>t.__wbg_exrbench_free(o,1)),bt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(o=>t.__wbg_exrstreamencoder_free(o,1)),lt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(o=>t.__wbg_proresbench_free(o,1)),ft=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(o=>t.__wbg_proresmovencoder_free(o,1)),vt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(o=>t.__wbg_proresmovwriter_free(o,1));function x(o){X===z.length&&z.push(z.length+1);let e=X;return X=z[e],z[e]=o,e}var xt=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(o=>t.__wbindgen_export2(o.a,o.b));function n_(o){o<1028||(z[o]=X,X=o)}function r_(o,e){return o=o>>>0,yt().subarray(o/8,o/8+e)}function gt(o,e){return o=o>>>0,mt().subarray(o/2,o/2+e)}function nt(o,e){return o=o>>>0,ht().subarray(o/4,o/4+e)}function f(o,e){return o=o>>>0,B().subarray(o/1,o/1+e)}var U=null;function r(){return(U===null||U.buffer.detached===!0||U.buffer.detached===void 0&&U.buffer!==t.memory.buffer)&&(U=new DataView(t.memory.buffer)),U}var N=null;function __(){return(N===null||N.byteLength===0)&&(N=new Float32Array(t.memory.buffer)),N}var H=null;function yt(){return(H===null||H.byteLength===0)&&(H=new Float64Array(t.memory.buffer)),H}function E(o,e){return a_(o>>>0,e)}var G=null;function mt(){return(G===null||G.byteLength===0)&&(G=new Uint16Array(t.memory.buffer)),G}var V=null;function ht(){return(V===null||V.byteLength===0)&&(V=new Uint32Array(t.memory.buffer)),V}var K=null;function B(){return(K===null||K.byteLength===0)&&(K=new Uint8Array(t.memory.buffer)),K}function A(o){return z[o]}function st(o,e){try{return o.apply(this,e)}catch(n){t.__wbindgen_export(x(n))}}var z=new Array(1024).fill(void 0);z.push(void 0,null,!0,!1);var X=z.length;function P(o){return o==null}function o_(o,e,n){let i={a:o,b:e,cnt:1},a=(...d)=>{i.cnt++;let _=i.a;i.a=0;try{return n(_,i.b,...d)}finally{i.a=_,a._wbg_cb_unref()}};return a._wbg_cb_unref=()=>{--i.cnt===0&&(t.__wbindgen_export2(i.a,i.b),i.a=0,xt.unregister(i))},xt.register(a,i,i),a}function F(o,e){let n=e(o.length*2,2)>>>0;return mt().set(o,n/2),p=o.length,n}function R(o,e){let n=e(o.length*4,4)>>>0;return ht().set(o,n/4),p=o.length,n}function l(o,e){let n=e(o.length*1,1)>>>0;return B().set(o,n/1),p=o.length,n}function ot(o,e){let n=e(o.length*4,4)>>>0;return __().set(o,n/4),p=o.length,n}function Y(o,e){let n=e(o.length*8,8)>>>0;return yt().set(o,n/8),p=o.length,n}function y(o,e,n){if(n===void 0){let c=$.encode(o),s=e(c.length,1)>>>0;return B().subarray(s,s+c.length).set(c),p=c.length,s}let i=o.length,a=e(i,1)>>>0,d=B(),_=0;for(;_<i;_++){let c=o.charCodeAt(_);if(c>127)break;d[a+_]=c}if(_!==i){_!==0&&(o=o.slice(_)),a=n(a,i,i=_+o.length*3,1)>>>0;let c=B().subarray(a+_,a+i),s=$.encodeInto(o,c);_+=s.written,a=n(a,i,_,1)>>>0}return p=_,a}function u(o){let e=A(o);return n_(o),e}var _t=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});_t.decode();var i_=2146435072,pt=0;function a_(o,e){return pt+=e,pt>=i_&&(_t=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),_t.decode(),pt=e),_t.decode(B().subarray(o,o+e))}var $=new TextEncoder;"encodeInto"in $||($.encodeInto=function(o,e){let n=$.encode(o);return e.set(n),{read:o.length,written:n.length}});var p=0,d_,c_,t;function kt(o,e){return c_=o,t=o.exports,d_=e,U=null,N=null,H=null,G=null,V=null,K=null,t}async function s_(o,e){if(typeof Response=="function"&&o instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(o,e)}catch(a){if(o.ok&&n(o.type)&&o.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",a);else throw a}let i=await o.arrayBuffer();return await WebAssembly.instantiate(i,e)}else{let i=await WebAssembly.instantiate(o,e);return i instanceof WebAssembly.Instance?{instance:i,module:o}:i}function n(i){switch(i){case"basic":case"cors":case"default":return!0}return!1}}function p_(o){if(t!==void 0)return t;o!==void 0&&(Object.getPrototypeOf(o)===Object.prototype?{module:o}=o:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let e=It();o instanceof WebAssembly.Module||(o=new WebAssembly.Module(o));let n=new WebAssembly.Instance(o,e);return kt(n,o)}async function rt(o){if(t!==void 0)return t;o!==void 0&&(Object.getPrototypeOf(o)===Object.prototype?{module_or_path:o}=o:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),o===void 0&&(o=new URL("media_core_bg.wasm",import.meta.url));let e=It();(typeof o=="string"||typeof Request=="function"&&o instanceof Request||typeof URL=="function"&&o instanceof URL)&&(o=fetch(o));let{instance:n,module:i}=await s_(await o,e);return kt(n,i)}var w_=import.meta.env?.VITE_TE_WORKSPACE==="1";var b_=!0,l_=import.meta.env?.MODE==="development"?["conform.tools","localhost"]:["conform.tools"];var ut=null,g_=!1;function u_(o){return ut||(ut=(async()=>{if(o!==void 0)return rt(o);if(typeof process<"u"&&process.versions?.node){let n="node:fs/promises",{readFile:i}=await import(n),a=await i(new URL("./wasm/media_core_bg.wasm",import.meta.url));return rt({module_or_path:a})}let{default:e}=await import("./media_core_bg-FDL7GJZP.js");return rt({module_or_path:e})})().then(e=>(g_=!0,e))),ut}function y_(){return u_()}export{et as a,Wt as b,Rt as c,zt as d,Xt as e,Jt as f,Qt as g,te as h,ie as i,de as j,ce as k,se as l,pe as m,we as n,be as o,fe as p,xe as q,Ae as r,Fe as s,je as t,De as u,Ue as v,Pe as w,Be as x,Ce as y,qe as z,He as A,Ve as B,Ke as C,Xe as D,$e as E,Je as F,Qe as G,Ze as H,en as I,_n as J,an as K,dn as L,cn as M,sn as N,gn as O,un as P,wn as Q,bn as R,ln as S,Mn as T,Fn as U,jn as V,Bn as W,Cn as X,qn as Y,Nn as Z,Hn as _,Gn as $,Vn as aa,Kn as ba,Xn as ca,$n as da,Jn as ea,Zn as fa,tr as ga,er as ha,nr as ia,rr as ja,_r as ka,ar as la,dr as ma,cr as na,sr as oa,ur as pa,br as qa,vr as ra,xr as sa,Ir as ta,mr as ua,kr as va,Ar as wa,Or as xa,Wr as ya,Fr as za,Nr as Aa,Gr as Ba,Kr as Ca,Qr as Da,Zr as Ea,At as Fa,b_ as Ga,y_ as Ha};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
3
- import{a as c,b as m}from"./chunk-DKGGJM6Z.js";import{$ as s,Fa as u,Ha as n,J as f}from"./chunk-RJ6JA2LZ.js";async function y(r){await n();let e=s(r);return e==="null"?null:JSON.parse(e)}async function d(r){await n();let e;try{e=f(r)}catch{return null}if(e.length<8)return null;let t=new DataView(e.buffer,e.byteOffset,e.byteLength),i=t.getUint32(0,!0),a=t.getUint32(4,!0),o=i*a*4;return e.length<8+o?null:{width:i,height:a,rgba:new Uint8ClampedArray(e.subarray(8,8+o))}}async function b(r,e=8){await n();let t=m(u,"decode_tiff_preview");if(!t)return d(r);try{return c(t(r,e))}catch{return null}}export{y as a,d as b,b as c};