ossclip 0.1.28 → 0.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/editor-dist/assets/index-DfTreNoE.js +166 -0
- package/editor-dist/index.html +1 -1
- package/package.json +4 -4
- package/src/cover.ts +11 -2
- package/src/interactive/produce-argv.ts +14 -0
- package/src/interactive/produce-wizard.ts +28 -0
- package/src/produce.ts +155 -37
- package/editor-dist/assets/index-BBJKC2Z2.js +0 -164
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
var Vb=Object.defineProperty;var Hb=(e,t,n)=>t in e?Vb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ae=(e,t,n)=>Hb(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();function Ub(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ly={exports:{}},ru={},uy={exports:{}},Te={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react.production.min.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Ys=Symbol.for("react.element"),Zb=Symbol.for("react.portal"),Kb=Symbol.for("react.fragment"),Yb=Symbol.for("react.strict_mode"),Gb=Symbol.for("react.profiler"),Xb=Symbol.for("react.provider"),qb=Symbol.for("react.context"),Qb=Symbol.for("react.forward_ref"),Jb=Symbol.for("react.suspense"),eS=Symbol.for("react.memo"),tS=Symbol.for("react.lazy"),xh=Symbol.iterator;function nS(e){return e===null||typeof e!="object"?null:(e=xh&&e[xh]||e["@@iterator"],typeof e=="function"?e:null)}var cy={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},dy=Object.assign,fy={};function Ri(e,t,n){this.props=e,this.context=t,this.refs=fy,this.updater=n||cy}Ri.prototype.isReactComponent={};Ri.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Ri.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function py(){}py.prototype=Ri.prototype;function jf(e,t,n){this.props=e,this.context=t,this.refs=fy,this.updater=n||cy}var Pf=jf.prototype=new py;Pf.constructor=jf;dy(Pf,Ri.prototype);Pf.isPureReactComponent=!0;var bh=Array.isArray,hy=Object.prototype.hasOwnProperty,Ff={current:null},my={key:!0,ref:!0,__self:!0,__source:!0};function gy(e,t,n){var r,o={},i=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(i=""+t.key),t)hy.call(t,r)&&!my.hasOwnProperty(r)&&(o[r]=t[r]);var a=arguments.length-2;if(a===1)o.children=n;else if(1<a){for(var l=Array(a),c=0;c<a;c++)l[c]=arguments[c+2];o.children=l}if(e&&e.defaultProps)for(r in a=e.defaultProps,a)o[r]===void 0&&(o[r]=a[r]);return{$$typeof:Ys,type:e,key:i,ref:s,props:o,_owner:Ff.current}}function rS(e,t){return{$$typeof:Ys,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function _f(e){return typeof e=="object"&&e!==null&&e.$$typeof===Ys}function oS(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Sh=/\/+/g;function oc(e,t){return typeof e=="object"&&e!==null&&e.key!=null?oS(""+e.key):t.toString(36)}function nl(e,t,n,r,o){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var s=!1;if(e===null)s=!0;else switch(i){case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case Ys:case Zb:s=!0}}if(s)return s=e,o=o(s),e=r===""?"."+oc(s,0):r,bh(o)?(n="",e!=null&&(n=e.replace(Sh,"$&/")+"/"),nl(o,t,n,"",function(c){return c})):o!=null&&(_f(o)&&(o=rS(o,n+(!o.key||s&&s.key===o.key?"":(""+o.key).replace(Sh,"$&/")+"/")+e)),t.push(o)),1;if(s=0,r=r===""?".":r+":",bh(e))for(var a=0;a<e.length;a++){i=e[a];var l=r+oc(i,a);s+=nl(i,t,n,l,o)}else if(l=nS(e),typeof l=="function")for(e=l.call(e),a=0;!(i=e.next()).done;)i=i.value,l=r+oc(i,a++),s+=nl(i,t,n,l,o);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return s}function ha(e,t,n){if(e==null)return e;var r=[],o=0;return nl(e,r,"","",function(i){return t.call(n,i,o++)}),r}function iS(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Vt={current:null},rl={transition:null},sS={ReactCurrentDispatcher:Vt,ReactCurrentBatchConfig:rl,ReactCurrentOwner:Ff};function vy(){throw Error("act(...) is not supported in production builds of React.")}Te.Children={map:ha,forEach:function(e,t,n){ha(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return ha(e,function(){t++}),t},toArray:function(e){return ha(e,function(t){return t})||[]},only:function(e){if(!_f(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Te.Component=Ri;Te.Fragment=Kb;Te.Profiler=Gb;Te.PureComponent=jf;Te.StrictMode=Yb;Te.Suspense=Jb;Te.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=sS;Te.act=vy;Te.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=dy({},e.props),o=e.key,i=e.ref,s=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,s=Ff.current),t.key!==void 0&&(o=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)hy.call(t,l)&&!my.hasOwnProperty(l)&&(r[l]=t[l]===void 0&&a!==void 0?a[l]:t[l])}var l=arguments.length-2;if(l===1)r.children=n;else if(1<l){a=Array(l);for(var c=0;c<l;c++)a[c]=arguments[c+2];r.children=a}return{$$typeof:Ys,type:e.type,key:o,ref:i,props:r,_owner:s}};Te.createContext=function(e){return e={$$typeof:qb,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:Xb,_context:e},e.Consumer=e};Te.createElement=gy;Te.createFactory=function(e){var t=gy.bind(null,e);return t.type=e,t};Te.createRef=function(){return{current:null}};Te.forwardRef=function(e){return{$$typeof:Qb,render:e}};Te.isValidElement=_f;Te.lazy=function(e){return{$$typeof:tS,_payload:{_status:-1,_result:e},_init:iS}};Te.memo=function(e,t){return{$$typeof:eS,type:e,compare:t===void 0?null:t}};Te.startTransition=function(e){var t=rl.transition;rl.transition={};try{e()}finally{rl.transition=t}};Te.unstable_act=vy;Te.useCallback=function(e,t){return Vt.current.useCallback(e,t)};Te.useContext=function(e){return Vt.current.useContext(e)};Te.useDebugValue=function(){};Te.useDeferredValue=function(e){return Vt.current.useDeferredValue(e)};Te.useEffect=function(e,t){return Vt.current.useEffect(e,t)};Te.useId=function(){return Vt.current.useId()};Te.useImperativeHandle=function(e,t,n){return Vt.current.useImperativeHandle(e,t,n)};Te.useInsertionEffect=function(e,t){return Vt.current.useInsertionEffect(e,t)};Te.useLayoutEffect=function(e,t){return Vt.current.useLayoutEffect(e,t)};Te.useMemo=function(e,t){return Vt.current.useMemo(e,t)};Te.useReducer=function(e,t,n){return Vt.current.useReducer(e,t,n)};Te.useRef=function(e){return Vt.current.useRef(e)};Te.useState=function(e){return Vt.current.useState(e)};Te.useSyncExternalStore=function(e,t,n){return Vt.current.useSyncExternalStore(e,t,n)};Te.useTransition=function(){return Vt.current.useTransition()};Te.version="18.3.1";uy.exports=Te;var d=uy.exports;const le=Ub(d);/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.production.min.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var aS=d,lS=Symbol.for("react.element"),uS=Symbol.for("react.fragment"),cS=Object.prototype.hasOwnProperty,dS=aS.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,fS={key:!0,ref:!0,__self:!0,__source:!0};function yy(e,t,n){var r,o={},i=null,s=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(s=t.ref);for(r in t)cS.call(t,r)&&!fS.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)o[r]===void 0&&(o[r]=t[r]);return{$$typeof:lS,type:e,key:i,ref:s,props:o,_owner:dS.current}}ru.Fragment=uS;ru.jsx=yy;ru.jsxs=yy;ly.exports=ru;var u=ly.exports,cd={},wy={exports:{}},fn={},xy={exports:{}},by={};/**
|
|
18
|
-
* @license React
|
|
19
|
-
* scheduler.production.min.js
|
|
20
|
-
*
|
|
21
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
-
*
|
|
23
|
-
* This source code is licensed under the MIT license found in the
|
|
24
|
-
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/(function(e){function t(j,C){var P=j.length;j.push(C);e:for(;0<P;){var N=P-1>>>1,B=j[N];if(0<o(B,C))j[N]=C,j[P]=B,P=N;else break e}}function n(j){return j.length===0?null:j[0]}function r(j){if(j.length===0)return null;var C=j[0],P=j.pop();if(P!==C){j[0]=P;e:for(var N=0,B=j.length,z=B>>>1;N<z;){var Z=2*(N+1)-1,H=j[Z],G=Z+1,O=j[G];if(0>o(H,P))G<B&&0>o(O,H)?(j[N]=O,j[G]=P,N=G):(j[N]=H,j[Z]=P,N=Z);else if(G<B&&0>o(O,P))j[N]=O,j[G]=P,N=G;else break e}}return C}function o(j,C){var P=j.sortIndex-C.sortIndex;return P!==0?P:j.id-C.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,a=s.now();e.unstable_now=function(){return s.now()-a}}var l=[],c=[],f=1,p=null,h=3,m=!1,x=!1,v=!1,k=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(j){for(var C=n(c);C!==null;){if(C.callback===null)r(c);else if(C.startTime<=j)r(c),C.sortIndex=C.expirationTime,t(l,C);else break;C=n(c)}}function b(j){if(v=!1,w(j),!x)if(n(l)!==null)x=!0,D(S);else{var C=n(c);C!==null&&L(b,C.startTime-j)}}function S(j,C){x=!1,v&&(v=!1,g(I),I=-1),m=!0;var P=h;try{for(w(C),p=n(l);p!==null&&(!(p.expirationTime>C)||j&&!A());){var N=p.callback;if(typeof N=="function"){p.callback=null,h=p.priorityLevel;var B=N(p.expirationTime<=C);C=e.unstable_now(),typeof B=="function"?p.callback=B:p===n(l)&&r(l),w(C)}else r(l);p=n(l)}if(p!==null)var z=!0;else{var Z=n(c);Z!==null&&L(b,Z.startTime-C),z=!1}return z}finally{p=null,h=P,m=!1}}var E=!1,T=null,I=-1,R=5,F=-1;function A(){return!(e.unstable_now()-F<R)}function W(){if(T!==null){var j=e.unstable_now();F=j;var C=!0;try{C=T(!0,j)}finally{C?M():(E=!1,T=null)}}else E=!1}var M;if(typeof y=="function")M=function(){y(W)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,V=$.port2;$.port1.onmessage=W,M=function(){V.postMessage(null)}}else M=function(){k(W,0)};function D(j){T=j,E||(E=!0,M())}function L(j,C){I=k(function(){j(e.unstable_now())},C)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(j){j.callback=null},e.unstable_continueExecution=function(){x||m||(x=!0,D(S))},e.unstable_forceFrameRate=function(j){0>j||125<j?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<j?Math.floor(1e3/j):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function(j){switch(h){case 1:case 2:case 3:var C=3;break;default:C=h}var P=h;h=C;try{return j()}finally{h=P}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(j,C){switch(j){case 1:case 2:case 3:case 4:case 5:break;default:j=3}var P=h;h=j;try{return C()}finally{h=P}},e.unstable_scheduleCallback=function(j,C,P){var N=e.unstable_now();switch(typeof P=="object"&&P!==null?(P=P.delay,P=typeof P=="number"&&0<P?N+P:N):P=N,j){case 1:var B=-1;break;case 2:B=250;break;case 5:B=1073741823;break;case 4:B=1e4;break;default:B=5e3}return B=P+B,j={id:f++,callback:C,priorityLevel:j,startTime:P,expirationTime:B,sortIndex:-1},P>N?(j.sortIndex=P,t(c,j),n(l)===null&&j===n(c)&&(v?(g(I),I=-1):v=!0,L(b,P-N))):(j.sortIndex=B,t(l,j),x||m||(x=!0,D(S))),j},e.unstable_shouldYield=A,e.unstable_wrapCallback=function(j){var C=h;return function(){var P=h;h=C;try{return j.apply(this,arguments)}finally{h=P}}}})(by);xy.exports=by;var pS=xy.exports;/**
|
|
26
|
-
* @license React
|
|
27
|
-
* react-dom.production.min.js
|
|
28
|
-
*
|
|
29
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
-
*
|
|
31
|
-
* This source code is licensed under the MIT license found in the
|
|
32
|
-
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var hS=d,dn=pS;function ne(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var Sy=new Set,Es={};function To(e,t){wi(e,t),wi(e+"Capture",t)}function wi(e,t){for(Es[e]=t,e=0;e<t.length;e++)Sy.add(t[e])}var wr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),dd=Object.prototype.hasOwnProperty,mS=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,kh={},Eh={};function gS(e){return dd.call(Eh,e)?!0:dd.call(kh,e)?!1:mS.test(e)?Eh[e]=!0:(kh[e]=!0,!1)}function vS(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function yS(e,t,n,r){if(t===null||typeof t>"u"||vS(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Ht(e,t,n,r,o,i,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=s}var jt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){jt[e]=new Ht(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];jt[t]=new Ht(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){jt[e]=new Ht(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){jt[e]=new Ht(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){jt[e]=new Ht(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){jt[e]=new Ht(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){jt[e]=new Ht(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){jt[e]=new Ht(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){jt[e]=new Ht(e,5,!1,e.toLowerCase(),null,!1,!1)});var Mf=/[\-:]([a-z])/g;function $f(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Mf,$f);jt[t]=new Ht(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Mf,$f);jt[t]=new Ht(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Mf,$f);jt[t]=new Ht(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){jt[e]=new Ht(e,1,!1,e.toLowerCase(),null,!1,!1)});jt.xlinkHref=new Ht("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){jt[e]=new Ht(e,1,!1,e.toLowerCase(),null,!0,!0)});function Af(e,t,n,r){var o=jt.hasOwnProperty(t)?jt[t]:null;(o!==null?o.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(yS(t,n,o,r)&&(n=null),r||o===null?gS(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):o.mustUseProperty?e[o.propertyName]=n===null?o.type===3?!1:"":n:(t=o.attributeName,r=o.attributeNamespace,n===null?e.removeAttribute(t):(o=o.type,n=o===3||o===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var kr=hS.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,ma=Symbol.for("react.element"),Go=Symbol.for("react.portal"),Xo=Symbol.for("react.fragment"),Nf=Symbol.for("react.strict_mode"),fd=Symbol.for("react.profiler"),ky=Symbol.for("react.provider"),Ey=Symbol.for("react.context"),Lf=Symbol.for("react.forward_ref"),pd=Symbol.for("react.suspense"),hd=Symbol.for("react.suspense_list"),Df=Symbol.for("react.memo"),$r=Symbol.for("react.lazy"),Cy=Symbol.for("react.offscreen"),Ch=Symbol.iterator;function Vi(e){return e===null||typeof e!="object"?null:(e=Ch&&e[Ch]||e["@@iterator"],typeof e=="function"?e:null)}var nt=Object.assign,ic;function ss(e){if(ic===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);ic=t&&t[1]||""}return`
|
|
34
|
-
`+ic+e}var sc=!1;function ac(e,t){if(!e||sc)return"";sc=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var r=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){r=c}e.call(t.prototype)}else{try{throw Error()}catch(c){r=c}e()}}catch(c){if(c&&r&&typeof c.stack=="string"){for(var o=c.stack.split(`
|
|
35
|
-
`),i=r.stack.split(`
|
|
36
|
-
`),s=o.length-1,a=i.length-1;1<=s&&0<=a&&o[s]!==i[a];)a--;for(;1<=s&&0<=a;s--,a--)if(o[s]!==i[a]){if(s!==1||a!==1)do if(s--,a--,0>a||o[s]!==i[a]){var l=`
|
|
37
|
-
`+o[s].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}while(1<=s&&0<=a);break}}}finally{sc=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?ss(e):""}function wS(e){switch(e.tag){case 5:return ss(e.type);case 16:return ss("Lazy");case 13:return ss("Suspense");case 19:return ss("SuspenseList");case 0:case 2:case 15:return e=ac(e.type,!1),e;case 11:return e=ac(e.type.render,!1),e;case 1:return e=ac(e.type,!0),e;default:return""}}function md(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Xo:return"Fragment";case Go:return"Portal";case fd:return"Profiler";case Nf:return"StrictMode";case pd:return"Suspense";case hd:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Ey:return(e.displayName||"Context")+".Consumer";case ky:return(e._context.displayName||"Context")+".Provider";case Lf:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Df:return t=e.displayName||null,t!==null?t:md(e.type)||"Memo";case $r:t=e._payload,e=e._init;try{return md(e(t))}catch{}}return null}function xS(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return md(t);case 8:return t===Nf?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Xr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Iy(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function bS(e){var t=Iy(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(s){r=""+s,i.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ga(e){e._valueTracker||(e._valueTracker=bS(e))}function Ty(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Iy(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function wl(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function gd(e,t){var n=t.checked;return nt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Ih(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Xr(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Ry(e,t){t=t.checked,t!=null&&Af(e,"checked",t,!1)}function vd(e,t){Ry(e,t);var n=Xr(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?yd(e,t.type,n):t.hasOwnProperty("defaultValue")&&yd(e,t.type,Xr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Th(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function yd(e,t,n){(t!=="number"||wl(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var as=Array.isArray;function ci(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o<n.length;o++)t["$"+n[o]]=!0;for(n=0;n<e.length;n++)o=t.hasOwnProperty("$"+e[n].value),e[n].selected!==o&&(e[n].selected=o),o&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Xr(n),t=null,o=0;o<e.length;o++){if(e[o].value===n){e[o].selected=!0,r&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function wd(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(ne(91));return nt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Rh(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(ne(92));if(as(n)){if(1<n.length)throw Error(ne(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Xr(n)}}function jy(e,t){var n=Xr(t.value),r=Xr(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function jh(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Py(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function xd(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Py(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var va,Fy=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,o){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,o)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(va=va||document.createElement("div"),va.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=va.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Cs(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var fs={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},SS=["Webkit","ms","Moz","O"];Object.keys(fs).forEach(function(e){SS.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),fs[t]=fs[e]})});function _y(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||fs.hasOwnProperty(e)&&fs[e]?(""+t).trim():t+"px"}function My(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=_y(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var kS=nt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function bd(e,t){if(t){if(kS[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(ne(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(ne(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(ne(61))}if(t.style!=null&&typeof t.style!="object")throw Error(ne(62))}}function Sd(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var kd=null;function zf(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ed=null,di=null,fi=null;function Ph(e){if(e=qs(e)){if(typeof Ed!="function")throw Error(ne(280));var t=e.stateNode;t&&(t=lu(t),Ed(e.stateNode,e.type,t))}}function $y(e){di?fi?fi.push(e):fi=[e]:di=e}function Ay(){if(di){var e=di,t=fi;if(fi=di=null,Ph(e),t)for(e=0;e<t.length;e++)Ph(t[e])}}function Ny(e,t){return e(t)}function Ly(){}var lc=!1;function Dy(e,t,n){if(lc)return e(t,n);lc=!0;try{return Ny(e,t,n)}finally{lc=!1,(di!==null||fi!==null)&&(Ly(),Ay())}}function Is(e,t){var n=e.stateNode;if(n===null)return null;var r=lu(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(ne(231,t,typeof n));return n}var Cd=!1;if(wr)try{var Hi={};Object.defineProperty(Hi,"passive",{get:function(){Cd=!0}}),window.addEventListener("test",Hi,Hi),window.removeEventListener("test",Hi,Hi)}catch{Cd=!1}function ES(e,t,n,r,o,i,s,a,l){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(f){this.onError(f)}}var ps=!1,xl=null,bl=!1,Id=null,CS={onError:function(e){ps=!0,xl=e}};function IS(e,t,n,r,o,i,s,a,l){ps=!1,xl=null,ES.apply(CS,arguments)}function TS(e,t,n,r,o,i,s,a,l){if(IS.apply(this,arguments),ps){if(ps){var c=xl;ps=!1,xl=null}else throw Error(ne(198));bl||(bl=!0,Id=c)}}function Ro(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function zy(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Fh(e){if(Ro(e)!==e)throw Error(ne(188))}function RS(e){var t=e.alternate;if(!t){if(t=Ro(e),t===null)throw Error(ne(188));return t!==e?null:e}for(var n=e,r=t;;){var o=n.return;if(o===null)break;var i=o.alternate;if(i===null){if(r=o.return,r!==null){n=r;continue}break}if(o.child===i.child){for(i=o.child;i;){if(i===n)return Fh(o),e;if(i===r)return Fh(o),t;i=i.sibling}throw Error(ne(188))}if(n.return!==r.return)n=o,r=i;else{for(var s=!1,a=o.child;a;){if(a===n){s=!0,n=o,r=i;break}if(a===r){s=!0,r=o,n=i;break}a=a.sibling}if(!s){for(a=i.child;a;){if(a===n){s=!0,n=i,r=o;break}if(a===r){s=!0,r=i,n=o;break}a=a.sibling}if(!s)throw Error(ne(189))}}if(n.alternate!==r)throw Error(ne(190))}if(n.tag!==3)throw Error(ne(188));return n.stateNode.current===n?e:t}function Oy(e){return e=RS(e),e!==null?By(e):null}function By(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=By(e);if(t!==null)return t;e=e.sibling}return null}var Wy=dn.unstable_scheduleCallback,_h=dn.unstable_cancelCallback,jS=dn.unstable_shouldYield,PS=dn.unstable_requestPaint,ut=dn.unstable_now,FS=dn.unstable_getCurrentPriorityLevel,Of=dn.unstable_ImmediatePriority,Vy=dn.unstable_UserBlockingPriority,Sl=dn.unstable_NormalPriority,_S=dn.unstable_LowPriority,Hy=dn.unstable_IdlePriority,ou=null,nr=null;function MS(e){if(nr&&typeof nr.onCommitFiberRoot=="function")try{nr.onCommitFiberRoot(ou,e,void 0,(e.current.flags&128)===128)}catch{}}var On=Math.clz32?Math.clz32:NS,$S=Math.log,AS=Math.LN2;function NS(e){return e>>>=0,e===0?32:31-($S(e)/AS|0)|0}var ya=64,wa=4194304;function ls(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function kl(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,i=e.pingedLanes,s=n&268435455;if(s!==0){var a=s&~o;a!==0?r=ls(a):(i&=s,i!==0&&(r=ls(i)))}else s=n&~o,s!==0?r=ls(s):i!==0&&(r=ls(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&o)&&(o=r&-r,i=t&-t,o>=i||o===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-On(t),o=1<<n,r|=e[n],t&=~o;return r}function LS(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function DS(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,o=e.expirationTimes,i=e.pendingLanes;0<i;){var s=31-On(i),a=1<<s,l=o[s];l===-1?(!(a&n)||a&r)&&(o[s]=LS(a,t)):l<=t&&(e.expiredLanes|=a),i&=~a}}function Td(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Uy(){var e=ya;return ya<<=1,!(ya&4194240)&&(ya=64),e}function uc(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Gs(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-On(t),e[t]=n}function zS(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var o=31-On(n),i=1<<o;t[o]=0,r[o]=-1,e[o]=-1,n&=~i}}function Bf(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-On(n),o=1<<r;o&t|e[r]&t&&(e[r]|=t),n&=~o}}var Ne=0;function Zy(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Ky,Wf,Yy,Gy,Xy,Rd=!1,xa=[],Br=null,Wr=null,Vr=null,Ts=new Map,Rs=new Map,Nr=[],OS="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Mh(e,t){switch(e){case"focusin":case"focusout":Br=null;break;case"dragenter":case"dragleave":Wr=null;break;case"mouseover":case"mouseout":Vr=null;break;case"pointerover":case"pointerout":Ts.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Rs.delete(t.pointerId)}}function Ui(e,t,n,r,o,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[o]},t!==null&&(t=qs(t),t!==null&&Wf(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function BS(e,t,n,r,o){switch(t){case"focusin":return Br=Ui(Br,e,t,n,r,o),!0;case"dragenter":return Wr=Ui(Wr,e,t,n,r,o),!0;case"mouseover":return Vr=Ui(Vr,e,t,n,r,o),!0;case"pointerover":var i=o.pointerId;return Ts.set(i,Ui(Ts.get(i)||null,e,t,n,r,o)),!0;case"gotpointercapture":return i=o.pointerId,Rs.set(i,Ui(Rs.get(i)||null,e,t,n,r,o)),!0}return!1}function qy(e){var t=fo(e.target);if(t!==null){var n=Ro(t);if(n!==null){if(t=n.tag,t===13){if(t=zy(n),t!==null){e.blockedOn=t,Xy(e.priority,function(){Yy(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function ol(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=jd(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);kd=r,n.target.dispatchEvent(r),kd=null}else return t=qs(n),t!==null&&Wf(t),e.blockedOn=n,!1;t.shift()}return!0}function $h(e,t,n){ol(e)&&n.delete(t)}function WS(){Rd=!1,Br!==null&&ol(Br)&&(Br=null),Wr!==null&&ol(Wr)&&(Wr=null),Vr!==null&&ol(Vr)&&(Vr=null),Ts.forEach($h),Rs.forEach($h)}function Zi(e,t){e.blockedOn===t&&(e.blockedOn=null,Rd||(Rd=!0,dn.unstable_scheduleCallback(dn.unstable_NormalPriority,WS)))}function js(e){function t(o){return Zi(o,e)}if(0<xa.length){Zi(xa[0],e);for(var n=1;n<xa.length;n++){var r=xa[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Br!==null&&Zi(Br,e),Wr!==null&&Zi(Wr,e),Vr!==null&&Zi(Vr,e),Ts.forEach(t),Rs.forEach(t),n=0;n<Nr.length;n++)r=Nr[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Nr.length&&(n=Nr[0],n.blockedOn===null);)qy(n),n.blockedOn===null&&Nr.shift()}var pi=kr.ReactCurrentBatchConfig,El=!0;function VS(e,t,n,r){var o=Ne,i=pi.transition;pi.transition=null;try{Ne=1,Vf(e,t,n,r)}finally{Ne=o,pi.transition=i}}function HS(e,t,n,r){var o=Ne,i=pi.transition;pi.transition=null;try{Ne=4,Vf(e,t,n,r)}finally{Ne=o,pi.transition=i}}function Vf(e,t,n,r){if(El){var o=jd(e,t,n,r);if(o===null)wc(e,t,r,Cl,n),Mh(e,r);else if(BS(o,e,t,n,r))r.stopPropagation();else if(Mh(e,r),t&4&&-1<OS.indexOf(e)){for(;o!==null;){var i=qs(o);if(i!==null&&Ky(i),i=jd(e,t,n,r),i===null&&wc(e,t,r,Cl,n),i===o)break;o=i}o!==null&&r.stopPropagation()}else wc(e,t,r,null,n)}}var Cl=null;function jd(e,t,n,r){if(Cl=null,e=zf(r),e=fo(e),e!==null)if(t=Ro(e),t===null)e=null;else if(n=t.tag,n===13){if(e=zy(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Cl=e,null}function Qy(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(FS()){case Of:return 1;case Vy:return 4;case Sl:case _S:return 16;case Hy:return 536870912;default:return 16}default:return 16}}var zr=null,Hf=null,il=null;function Jy(){if(il)return il;var e,t=Hf,n=t.length,r,o="value"in zr?zr.value:zr.textContent,i=o.length;for(e=0;e<n&&t[e]===o[e];e++);var s=n-e;for(r=1;r<=s&&t[n-r]===o[i-r];r++);return il=o.slice(e,1<r?1-r:void 0)}function sl(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function ba(){return!0}function Ah(){return!1}function pn(e){function t(n,r,o,i,s){this._reactName=n,this._targetInst=o,this.type=r,this.nativeEvent=i,this.target=s,this.currentTarget=null;for(var a in e)e.hasOwnProperty(a)&&(n=e[a],this[a]=n?n(i):i[a]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?ba:Ah,this.isPropagationStopped=Ah,this}return nt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=ba)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=ba)},persist:function(){},isPersistent:ba}),t}var ji={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Uf=pn(ji),Xs=nt({},ji,{view:0,detail:0}),US=pn(Xs),cc,dc,Ki,iu=nt({},Xs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Zf,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Ki&&(Ki&&e.type==="mousemove"?(cc=e.screenX-Ki.screenX,dc=e.screenY-Ki.screenY):dc=cc=0,Ki=e),cc)},movementY:function(e){return"movementY"in e?e.movementY:dc}}),Nh=pn(iu),ZS=nt({},iu,{dataTransfer:0}),KS=pn(ZS),YS=nt({},Xs,{relatedTarget:0}),fc=pn(YS),GS=nt({},ji,{animationName:0,elapsedTime:0,pseudoElement:0}),XS=pn(GS),qS=nt({},ji,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),QS=pn(qS),JS=nt({},ji,{data:0}),Lh=pn(JS),ek={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},tk={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},nk={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function rk(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=nk[e])?!!t[e]:!1}function Zf(){return rk}var ok=nt({},Xs,{key:function(e){if(e.key){var t=ek[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=sl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?tk[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Zf,charCode:function(e){return e.type==="keypress"?sl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?sl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),ik=pn(ok),sk=nt({},iu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Dh=pn(sk),ak=nt({},Xs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Zf}),lk=pn(ak),uk=nt({},ji,{propertyName:0,elapsedTime:0,pseudoElement:0}),ck=pn(uk),dk=nt({},iu,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),fk=pn(dk),pk=[9,13,27,32],Kf=wr&&"CompositionEvent"in window,hs=null;wr&&"documentMode"in document&&(hs=document.documentMode);var hk=wr&&"TextEvent"in window&&!hs,e0=wr&&(!Kf||hs&&8<hs&&11>=hs),zh=" ",Oh=!1;function t0(e,t){switch(e){case"keyup":return pk.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function n0(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var qo=!1;function mk(e,t){switch(e){case"compositionend":return n0(t);case"keypress":return t.which!==32?null:(Oh=!0,zh);case"textInput":return e=t.data,e===zh&&Oh?null:e;default:return null}}function gk(e,t){if(qo)return e==="compositionend"||!Kf&&t0(e,t)?(e=Jy(),il=Hf=zr=null,qo=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return e0&&t.locale!=="ko"?null:t.data;default:return null}}var vk={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Bh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!vk[e.type]:t==="textarea"}function r0(e,t,n,r){$y(r),t=Il(t,"onChange"),0<t.length&&(n=new Uf("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var ms=null,Ps=null;function yk(e){h0(e,0)}function su(e){var t=ei(e);if(Ty(t))return e}function wk(e,t){if(e==="change")return t}var o0=!1;if(wr){var pc;if(wr){var hc="oninput"in document;if(!hc){var Wh=document.createElement("div");Wh.setAttribute("oninput","return;"),hc=typeof Wh.oninput=="function"}pc=hc}else pc=!1;o0=pc&&(!document.documentMode||9<document.documentMode)}function Vh(){ms&&(ms.detachEvent("onpropertychange",i0),Ps=ms=null)}function i0(e){if(e.propertyName==="value"&&su(Ps)){var t=[];r0(t,Ps,e,zf(e)),Dy(yk,t)}}function xk(e,t,n){e==="focusin"?(Vh(),ms=t,Ps=n,ms.attachEvent("onpropertychange",i0)):e==="focusout"&&Vh()}function bk(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return su(Ps)}function Sk(e,t){if(e==="click")return su(t)}function kk(e,t){if(e==="input"||e==="change")return su(t)}function Ek(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Wn=typeof Object.is=="function"?Object.is:Ek;function Fs(e,t){if(Wn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var o=n[r];if(!dd.call(t,o)||!Wn(e[o],t[o]))return!1}return!0}function Hh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Uh(e,t){var n=Hh(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Hh(n)}}function s0(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?s0(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function a0(){for(var e=window,t=wl();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=wl(e.document)}return t}function Yf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Ck(e){var t=a0(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&s0(n.ownerDocument.documentElement,n)){if(r!==null&&Yf(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=n.textContent.length,i=Math.min(r.start,o);r=r.end===void 0?i:Math.min(r.end,o),!e.extend&&i>r&&(o=r,r=i,i=o),o=Uh(n,i);var s=Uh(n,r);o&&s&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Ik=wr&&"documentMode"in document&&11>=document.documentMode,Qo=null,Pd=null,gs=null,Fd=!1;function Zh(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Fd||Qo==null||Qo!==wl(r)||(r=Qo,"selectionStart"in r&&Yf(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),gs&&Fs(gs,r)||(gs=r,r=Il(Pd,"onSelect"),0<r.length&&(t=new Uf("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Qo)))}function Sa(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Jo={animationend:Sa("Animation","AnimationEnd"),animationiteration:Sa("Animation","AnimationIteration"),animationstart:Sa("Animation","AnimationStart"),transitionend:Sa("Transition","TransitionEnd")},mc={},l0={};wr&&(l0=document.createElement("div").style,"AnimationEvent"in window||(delete Jo.animationend.animation,delete Jo.animationiteration.animation,delete Jo.animationstart.animation),"TransitionEvent"in window||delete Jo.transitionend.transition);function au(e){if(mc[e])return mc[e];if(!Jo[e])return e;var t=Jo[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in l0)return mc[e]=t[n];return e}var u0=au("animationend"),c0=au("animationiteration"),d0=au("animationstart"),f0=au("transitionend"),p0=new Map,Kh="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function eo(e,t){p0.set(e,t),To(t,[e])}for(var gc=0;gc<Kh.length;gc++){var vc=Kh[gc],Tk=vc.toLowerCase(),Rk=vc[0].toUpperCase()+vc.slice(1);eo(Tk,"on"+Rk)}eo(u0,"onAnimationEnd");eo(c0,"onAnimationIteration");eo(d0,"onAnimationStart");eo("dblclick","onDoubleClick");eo("focusin","onFocus");eo("focusout","onBlur");eo(f0,"onTransitionEnd");wi("onMouseEnter",["mouseout","mouseover"]);wi("onMouseLeave",["mouseout","mouseover"]);wi("onPointerEnter",["pointerout","pointerover"]);wi("onPointerLeave",["pointerout","pointerover"]);To("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));To("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));To("onBeforeInput",["compositionend","keypress","textInput","paste"]);To("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));To("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));To("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var us="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),jk=new Set("cancel close invalid load scroll toggle".split(" ").concat(us));function Yh(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,TS(r,t,void 0,e),e.currentTarget=null}function h0(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],o=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var s=r.length-1;0<=s;s--){var a=r[s],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==i&&o.isPropagationStopped())break e;Yh(o,a,c),i=l}else for(s=0;s<r.length;s++){if(a=r[s],l=a.instance,c=a.currentTarget,a=a.listener,l!==i&&o.isPropagationStopped())break e;Yh(o,a,c),i=l}}}if(bl)throw e=Id,bl=!1,Id=null,e}function He(e,t){var n=t[Nd];n===void 0&&(n=t[Nd]=new Set);var r=e+"__bubble";n.has(r)||(m0(t,e,2,!1),n.add(r))}function yc(e,t,n){var r=0;t&&(r|=4),m0(n,e,r,t)}var ka="_reactListening"+Math.random().toString(36).slice(2);function _s(e){if(!e[ka]){e[ka]=!0,Sy.forEach(function(n){n!=="selectionchange"&&(jk.has(n)||yc(n,!1,e),yc(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ka]||(t[ka]=!0,yc("selectionchange",!1,t))}}function m0(e,t,n,r){switch(Qy(t)){case 1:var o=VS;break;case 4:o=HS;break;default:o=Vf}n=o.bind(null,t,n,e),o=void 0,!Cd||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),r?o!==void 0?e.addEventListener(t,n,{capture:!0,passive:o}):e.addEventListener(t,n,!0):o!==void 0?e.addEventListener(t,n,{passive:o}):e.addEventListener(t,n,!1)}function wc(e,t,n,r,o){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var a=r.stateNode.containerInfo;if(a===o||a.nodeType===8&&a.parentNode===o)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&(l=s.stateNode.containerInfo,l===o||l.nodeType===8&&l.parentNode===o))return;s=s.return}for(;a!==null;){if(s=fo(a),s===null)return;if(l=s.tag,l===5||l===6){r=i=s;continue e}a=a.parentNode}}r=r.return}Dy(function(){var c=i,f=zf(n),p=[];e:{var h=p0.get(e);if(h!==void 0){var m=Uf,x=e;switch(e){case"keypress":if(sl(n)===0)break e;case"keydown":case"keyup":m=ik;break;case"focusin":x="focus",m=fc;break;case"focusout":x="blur",m=fc;break;case"beforeblur":case"afterblur":m=fc;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":m=Nh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=KS;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=lk;break;case u0:case c0:case d0:m=XS;break;case f0:m=ck;break;case"scroll":m=US;break;case"wheel":m=fk;break;case"copy":case"cut":case"paste":m=QS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=Dh}var v=(t&4)!==0,k=!v&&e==="scroll",g=v?h!==null?h+"Capture":null:h;v=[];for(var y=c,w;y!==null;){w=y;var b=w.stateNode;if(w.tag===5&&b!==null&&(w=b,g!==null&&(b=Is(y,g),b!=null&&v.push(Ms(y,b,w)))),k)break;y=y.return}0<v.length&&(h=new m(h,x,null,n,f),p.push({event:h,listeners:v}))}}if(!(t&7)){e:{if(h=e==="mouseover"||e==="pointerover",m=e==="mouseout"||e==="pointerout",h&&n!==kd&&(x=n.relatedTarget||n.fromElement)&&(fo(x)||x[xr]))break e;if((m||h)&&(h=f.window===f?f:(h=f.ownerDocument)?h.defaultView||h.parentWindow:window,m?(x=n.relatedTarget||n.toElement,m=c,x=x?fo(x):null,x!==null&&(k=Ro(x),x!==k||x.tag!==5&&x.tag!==6)&&(x=null)):(m=null,x=c),m!==x)){if(v=Nh,b="onMouseLeave",g="onMouseEnter",y="mouse",(e==="pointerout"||e==="pointerover")&&(v=Dh,b="onPointerLeave",g="onPointerEnter",y="pointer"),k=m==null?h:ei(m),w=x==null?h:ei(x),h=new v(b,y+"leave",m,n,f),h.target=k,h.relatedTarget=w,b=null,fo(f)===c&&(v=new v(g,y+"enter",x,n,f),v.target=w,v.relatedTarget=k,b=v),k=b,m&&x)t:{for(v=m,g=x,y=0,w=v;w;w=Lo(w))y++;for(w=0,b=g;b;b=Lo(b))w++;for(;0<y-w;)v=Lo(v),y--;for(;0<w-y;)g=Lo(g),w--;for(;y--;){if(v===g||g!==null&&v===g.alternate)break t;v=Lo(v),g=Lo(g)}v=null}else v=null;m!==null&&Gh(p,h,m,v,!1),x!==null&&k!==null&&Gh(p,k,x,v,!0)}}e:{if(h=c?ei(c):window,m=h.nodeName&&h.nodeName.toLowerCase(),m==="select"||m==="input"&&h.type==="file")var S=wk;else if(Bh(h))if(o0)S=kk;else{S=bk;var E=xk}else(m=h.nodeName)&&m.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(S=Sk);if(S&&(S=S(e,c))){r0(p,S,n,f);break e}E&&E(e,h,c),e==="focusout"&&(E=h._wrapperState)&&E.controlled&&h.type==="number"&&yd(h,"number",h.value)}switch(E=c?ei(c):window,e){case"focusin":(Bh(E)||E.contentEditable==="true")&&(Qo=E,Pd=c,gs=null);break;case"focusout":gs=Pd=Qo=null;break;case"mousedown":Fd=!0;break;case"contextmenu":case"mouseup":case"dragend":Fd=!1,Zh(p,n,f);break;case"selectionchange":if(Ik)break;case"keydown":case"keyup":Zh(p,n,f)}var T;if(Kf)e:{switch(e){case"compositionstart":var I="onCompositionStart";break e;case"compositionend":I="onCompositionEnd";break e;case"compositionupdate":I="onCompositionUpdate";break e}I=void 0}else qo?t0(e,n)&&(I="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(I="onCompositionStart");I&&(e0&&n.locale!=="ko"&&(qo||I!=="onCompositionStart"?I==="onCompositionEnd"&&qo&&(T=Jy()):(zr=f,Hf="value"in zr?zr.value:zr.textContent,qo=!0)),E=Il(c,I),0<E.length&&(I=new Lh(I,e,null,n,f),p.push({event:I,listeners:E}),T?I.data=T:(T=n0(n),T!==null&&(I.data=T)))),(T=hk?mk(e,n):gk(e,n))&&(c=Il(c,"onBeforeInput"),0<c.length&&(f=new Lh("onBeforeInput","beforeinput",null,n,f),p.push({event:f,listeners:c}),f.data=T))}h0(p,t)})}function Ms(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Il(e,t){for(var n=t+"Capture",r=[];e!==null;){var o=e,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=Is(e,n),i!=null&&r.unshift(Ms(e,i,o)),i=Is(e,t),i!=null&&r.push(Ms(e,i,o))),e=e.return}return r}function Lo(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Gh(e,t,n,r,o){for(var i=t._reactName,s=[];n!==null&&n!==r;){var a=n,l=a.alternate,c=a.stateNode;if(l!==null&&l===r)break;a.tag===5&&c!==null&&(a=c,o?(l=Is(n,i),l!=null&&s.unshift(Ms(n,l,a))):o||(l=Is(n,i),l!=null&&s.push(Ms(n,l,a)))),n=n.return}s.length!==0&&e.push({event:t,listeners:s})}var Pk=/\r\n?/g,Fk=/\u0000|\uFFFD/g;function Xh(e){return(typeof e=="string"?e:""+e).replace(Pk,`
|
|
38
|
-
`).replace(Fk,"")}function Ea(e,t,n){if(t=Xh(t),Xh(e)!==t&&n)throw Error(ne(425))}function Tl(){}var _d=null,Md=null;function $d(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Ad=typeof setTimeout=="function"?setTimeout:void 0,_k=typeof clearTimeout=="function"?clearTimeout:void 0,qh=typeof Promise=="function"?Promise:void 0,Mk=typeof queueMicrotask=="function"?queueMicrotask:typeof qh<"u"?function(e){return qh.resolve(null).then(e).catch($k)}:Ad;function $k(e){setTimeout(function(){throw e})}function xc(e,t){var n=t,r=0;do{var o=n.nextSibling;if(e.removeChild(n),o&&o.nodeType===8)if(n=o.data,n==="/$"){if(r===0){e.removeChild(o),js(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=o}while(n);js(t)}function Hr(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function Qh(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var Pi=Math.random().toString(36).slice(2),Jn="__reactFiber$"+Pi,$s="__reactProps$"+Pi,xr="__reactContainer$"+Pi,Nd="__reactEvents$"+Pi,Ak="__reactListeners$"+Pi,Nk="__reactHandles$"+Pi;function fo(e){var t=e[Jn];if(t)return t;for(var n=e.parentNode;n;){if(t=n[xr]||n[Jn]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Qh(e);e!==null;){if(n=e[Jn])return n;e=Qh(e)}return t}e=n,n=e.parentNode}return null}function qs(e){return e=e[Jn]||e[xr],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function ei(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(ne(33))}function lu(e){return e[$s]||null}var Ld=[],ti=-1;function to(e){return{current:e}}function Ze(e){0>ti||(e.current=Ld[ti],Ld[ti]=null,ti--)}function We(e,t){ti++,Ld[ti]=e.current,e.current=t}var qr={},Dt=to(qr),Qt=to(!1),wo=qr;function xi(e,t){var n=e.type.contextTypes;if(!n)return qr;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in n)o[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function Jt(e){return e=e.childContextTypes,e!=null}function Rl(){Ze(Qt),Ze(Dt)}function Jh(e,t,n){if(Dt.current!==qr)throw Error(ne(168));We(Dt,t),We(Qt,n)}function g0(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(ne(108,xS(e)||"Unknown",o));return nt({},n,r)}function jl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||qr,wo=Dt.current,We(Dt,e),We(Qt,Qt.current),!0}function em(e,t,n){var r=e.stateNode;if(!r)throw Error(ne(169));n?(e=g0(e,t,wo),r.__reactInternalMemoizedMergedChildContext=e,Ze(Qt),Ze(Dt),We(Dt,e)):Ze(Qt),We(Qt,n)}var pr=null,uu=!1,bc=!1;function v0(e){pr===null?pr=[e]:pr.push(e)}function Lk(e){uu=!0,v0(e)}function no(){if(!bc&&pr!==null){bc=!0;var e=0,t=Ne;try{var n=pr;for(Ne=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}pr=null,uu=!1}catch(o){throw pr!==null&&(pr=pr.slice(e+1)),Wy(Of,no),o}finally{Ne=t,bc=!1}}return null}var ni=[],ri=0,Pl=null,Fl=0,Sn=[],kn=0,xo=null,mr=1,gr="";function uo(e,t){ni[ri++]=Fl,ni[ri++]=Pl,Pl=e,Fl=t}function y0(e,t,n){Sn[kn++]=mr,Sn[kn++]=gr,Sn[kn++]=xo,xo=e;var r=mr;e=gr;var o=32-On(r)-1;r&=~(1<<o),n+=1;var i=32-On(t)+o;if(30<i){var s=o-o%5;i=(r&(1<<s)-1).toString(32),r>>=s,o-=s,mr=1<<32-On(t)+o|n<<o|r,gr=i+e}else mr=1<<i|n<<o|r,gr=e}function Gf(e){e.return!==null&&(uo(e,1),y0(e,1,0))}function Xf(e){for(;e===Pl;)Pl=ni[--ri],ni[ri]=null,Fl=ni[--ri],ni[ri]=null;for(;e===xo;)xo=Sn[--kn],Sn[kn]=null,gr=Sn[--kn],Sn[kn]=null,mr=Sn[--kn],Sn[kn]=null}var cn=null,un=null,Ge=!1,zn=null;function w0(e,t){var n=Cn(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function tm(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,cn=e,un=Hr(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,cn=e,un=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=xo!==null?{id:mr,overflow:gr}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Cn(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,cn=e,un=null,!0):!1;default:return!1}}function Dd(e){return(e.mode&1)!==0&&(e.flags&128)===0}function zd(e){if(Ge){var t=un;if(t){var n=t;if(!tm(e,t)){if(Dd(e))throw Error(ne(418));t=Hr(n.nextSibling);var r=cn;t&&tm(e,t)?w0(r,n):(e.flags=e.flags&-4097|2,Ge=!1,cn=e)}}else{if(Dd(e))throw Error(ne(418));e.flags=e.flags&-4097|2,Ge=!1,cn=e}}}function nm(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;cn=e}function Ca(e){if(e!==cn)return!1;if(!Ge)return nm(e),Ge=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!$d(e.type,e.memoizedProps)),t&&(t=un)){if(Dd(e))throw x0(),Error(ne(418));for(;t;)w0(e,t),t=Hr(t.nextSibling)}if(nm(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(ne(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){un=Hr(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}un=null}}else un=cn?Hr(e.stateNode.nextSibling):null;return!0}function x0(){for(var e=un;e;)e=Hr(e.nextSibling)}function bi(){un=cn=null,Ge=!1}function qf(e){zn===null?zn=[e]:zn.push(e)}var Dk=kr.ReactCurrentBatchConfig;function Yi(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(ne(309));var r=n.stateNode}if(!r)throw Error(ne(147,e));var o=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(s){var a=o.refs;s===null?delete a[i]:a[i]=s},t._stringRef=i,t)}if(typeof e!="string")throw Error(ne(284));if(!n._owner)throw Error(ne(290,e))}return e}function Ia(e,t){throw e=Object.prototype.toString.call(t),Error(ne(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function rm(e){var t=e._init;return t(e._payload)}function b0(e){function t(g,y){if(e){var w=g.deletions;w===null?(g.deletions=[y],g.flags|=16):w.push(y)}}function n(g,y){if(!e)return null;for(;y!==null;)t(g,y),y=y.sibling;return null}function r(g,y){for(g=new Map;y!==null;)y.key!==null?g.set(y.key,y):g.set(y.index,y),y=y.sibling;return g}function o(g,y){return g=Yr(g,y),g.index=0,g.sibling=null,g}function i(g,y,w){return g.index=w,e?(w=g.alternate,w!==null?(w=w.index,w<y?(g.flags|=2,y):w):(g.flags|=2,y)):(g.flags|=1048576,y)}function s(g){return e&&g.alternate===null&&(g.flags|=2),g}function a(g,y,w,b){return y===null||y.tag!==6?(y=Rc(w,g.mode,b),y.return=g,y):(y=o(y,w),y.return=g,y)}function l(g,y,w,b){var S=w.type;return S===Xo?f(g,y,w.props.children,b,w.key):y!==null&&(y.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===$r&&rm(S)===y.type)?(b=o(y,w.props),b.ref=Yi(g,y,w),b.return=g,b):(b=pl(w.type,w.key,w.props,null,g.mode,b),b.ref=Yi(g,y,w),b.return=g,b)}function c(g,y,w,b){return y===null||y.tag!==4||y.stateNode.containerInfo!==w.containerInfo||y.stateNode.implementation!==w.implementation?(y=jc(w,g.mode,b),y.return=g,y):(y=o(y,w.children||[]),y.return=g,y)}function f(g,y,w,b,S){return y===null||y.tag!==7?(y=yo(w,g.mode,b,S),y.return=g,y):(y=o(y,w),y.return=g,y)}function p(g,y,w){if(typeof y=="string"&&y!==""||typeof y=="number")return y=Rc(""+y,g.mode,w),y.return=g,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case ma:return w=pl(y.type,y.key,y.props,null,g.mode,w),w.ref=Yi(g,null,y),w.return=g,w;case Go:return y=jc(y,g.mode,w),y.return=g,y;case $r:var b=y._init;return p(g,b(y._payload),w)}if(as(y)||Vi(y))return y=yo(y,g.mode,w,null),y.return=g,y;Ia(g,y)}return null}function h(g,y,w,b){var S=y!==null?y.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return S!==null?null:a(g,y,""+w,b);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case ma:return w.key===S?l(g,y,w,b):null;case Go:return w.key===S?c(g,y,w,b):null;case $r:return S=w._init,h(g,y,S(w._payload),b)}if(as(w)||Vi(w))return S!==null?null:f(g,y,w,b,null);Ia(g,w)}return null}function m(g,y,w,b,S){if(typeof b=="string"&&b!==""||typeof b=="number")return g=g.get(w)||null,a(y,g,""+b,S);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case ma:return g=g.get(b.key===null?w:b.key)||null,l(y,g,b,S);case Go:return g=g.get(b.key===null?w:b.key)||null,c(y,g,b,S);case $r:var E=b._init;return m(g,y,w,E(b._payload),S)}if(as(b)||Vi(b))return g=g.get(w)||null,f(y,g,b,S,null);Ia(y,b)}return null}function x(g,y,w,b){for(var S=null,E=null,T=y,I=y=0,R=null;T!==null&&I<w.length;I++){T.index>I?(R=T,T=null):R=T.sibling;var F=h(g,T,w[I],b);if(F===null){T===null&&(T=R);break}e&&T&&F.alternate===null&&t(g,T),y=i(F,y,I),E===null?S=F:E.sibling=F,E=F,T=R}if(I===w.length)return n(g,T),Ge&&uo(g,I),S;if(T===null){for(;I<w.length;I++)T=p(g,w[I],b),T!==null&&(y=i(T,y,I),E===null?S=T:E.sibling=T,E=T);return Ge&&uo(g,I),S}for(T=r(g,T);I<w.length;I++)R=m(T,g,I,w[I],b),R!==null&&(e&&R.alternate!==null&&T.delete(R.key===null?I:R.key),y=i(R,y,I),E===null?S=R:E.sibling=R,E=R);return e&&T.forEach(function(A){return t(g,A)}),Ge&&uo(g,I),S}function v(g,y,w,b){var S=Vi(w);if(typeof S!="function")throw Error(ne(150));if(w=S.call(w),w==null)throw Error(ne(151));for(var E=S=null,T=y,I=y=0,R=null,F=w.next();T!==null&&!F.done;I++,F=w.next()){T.index>I?(R=T,T=null):R=T.sibling;var A=h(g,T,F.value,b);if(A===null){T===null&&(T=R);break}e&&T&&A.alternate===null&&t(g,T),y=i(A,y,I),E===null?S=A:E.sibling=A,E=A,T=R}if(F.done)return n(g,T),Ge&&uo(g,I),S;if(T===null){for(;!F.done;I++,F=w.next())F=p(g,F.value,b),F!==null&&(y=i(F,y,I),E===null?S=F:E.sibling=F,E=F);return Ge&&uo(g,I),S}for(T=r(g,T);!F.done;I++,F=w.next())F=m(T,g,I,F.value,b),F!==null&&(e&&F.alternate!==null&&T.delete(F.key===null?I:F.key),y=i(F,y,I),E===null?S=F:E.sibling=F,E=F);return e&&T.forEach(function(W){return t(g,W)}),Ge&&uo(g,I),S}function k(g,y,w,b){if(typeof w=="object"&&w!==null&&w.type===Xo&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case ma:e:{for(var S=w.key,E=y;E!==null;){if(E.key===S){if(S=w.type,S===Xo){if(E.tag===7){n(g,E.sibling),y=o(E,w.props.children),y.return=g,g=y;break e}}else if(E.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===$r&&rm(S)===E.type){n(g,E.sibling),y=o(E,w.props),y.ref=Yi(g,E,w),y.return=g,g=y;break e}n(g,E);break}else t(g,E);E=E.sibling}w.type===Xo?(y=yo(w.props.children,g.mode,b,w.key),y.return=g,g=y):(b=pl(w.type,w.key,w.props,null,g.mode,b),b.ref=Yi(g,y,w),b.return=g,g=b)}return s(g);case Go:e:{for(E=w.key;y!==null;){if(y.key===E)if(y.tag===4&&y.stateNode.containerInfo===w.containerInfo&&y.stateNode.implementation===w.implementation){n(g,y.sibling),y=o(y,w.children||[]),y.return=g,g=y;break e}else{n(g,y);break}else t(g,y);y=y.sibling}y=jc(w,g.mode,b),y.return=g,g=y}return s(g);case $r:return E=w._init,k(g,y,E(w._payload),b)}if(as(w))return x(g,y,w,b);if(Vi(w))return v(g,y,w,b);Ia(g,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,y!==null&&y.tag===6?(n(g,y.sibling),y=o(y,w),y.return=g,g=y):(n(g,y),y=Rc(w,g.mode,b),y.return=g,g=y),s(g)):n(g,y)}return k}var Si=b0(!0),S0=b0(!1),_l=to(null),Ml=null,oi=null,Qf=null;function Jf(){Qf=oi=Ml=null}function ep(e){var t=_l.current;Ze(_l),e._currentValue=t}function Od(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function hi(e,t){Ml=e,Qf=oi=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(qt=!0),e.firstContext=null)}function Rn(e){var t=e._currentValue;if(Qf!==e)if(e={context:e,memoizedValue:t,next:null},oi===null){if(Ml===null)throw Error(ne(308));oi=e,Ml.dependencies={lanes:0,firstContext:e}}else oi=oi.next=e;return t}var po=null;function tp(e){po===null?po=[e]:po.push(e)}function k0(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,tp(t)):(n.next=o.next,o.next=n),t.interleaved=n,br(e,r)}function br(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Ar=!1;function np(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function E0(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function yr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Ur(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Fe&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,br(e,n)}return o=r.interleaved,o===null?(t.next=t,tp(r)):(t.next=o.next,o.next=t),r.interleaved=t,br(e,n)}function al(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Bf(e,n)}}function om(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?o=i=s:i=i.next=s,n=n.next}while(n!==null);i===null?o=i=t:i=i.next=t}else o=i=t;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function $l(e,t,n,r){var o=e.updateQueue;Ar=!1;var i=o.firstBaseUpdate,s=o.lastBaseUpdate,a=o.shared.pending;if(a!==null){o.shared.pending=null;var l=a,c=l.next;l.next=null,s===null?i=c:s.next=c,s=l;var f=e.alternate;f!==null&&(f=f.updateQueue,a=f.lastBaseUpdate,a!==s&&(a===null?f.firstBaseUpdate=c:a.next=c,f.lastBaseUpdate=l))}if(i!==null){var p=o.baseState;s=0,f=c=l=null,a=i;do{var h=a.lane,m=a.eventTime;if((r&h)===h){f!==null&&(f=f.next={eventTime:m,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var x=e,v=a;switch(h=t,m=n,v.tag){case 1:if(x=v.payload,typeof x=="function"){p=x.call(m,p,h);break e}p=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=v.payload,h=typeof x=="function"?x.call(m,p,h):x,h==null)break e;p=nt({},p,h);break e;case 2:Ar=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,h=o.effects,h===null?o.effects=[a]:h.push(a))}else m={eventTime:m,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},f===null?(c=f=m,l=p):f=f.next=m,s|=h;if(a=a.next,a===null){if(a=o.shared.pending,a===null)break;h=a,a=h.next,h.next=null,o.lastBaseUpdate=h,o.shared.pending=null}}while(!0);if(f===null&&(l=p),o.baseState=l,o.firstBaseUpdate=c,o.lastBaseUpdate=f,t=o.shared.interleaved,t!==null){o=t;do s|=o.lane,o=o.next;while(o!==t)}else i===null&&(o.shared.lanes=0);So|=s,e.lanes=s,e.memoizedState=p}}function im(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],o=r.callback;if(o!==null){if(r.callback=null,r=n,typeof o!="function")throw Error(ne(191,o));o.call(r)}}}var Qs={},rr=to(Qs),As=to(Qs),Ns=to(Qs);function ho(e){if(e===Qs)throw Error(ne(174));return e}function rp(e,t){switch(We(Ns,t),We(As,e),We(rr,Qs),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:xd(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=xd(t,e)}Ze(rr),We(rr,t)}function ki(){Ze(rr),Ze(As),Ze(Ns)}function C0(e){ho(Ns.current);var t=ho(rr.current),n=xd(t,e.type);t!==n&&(We(As,e),We(rr,n))}function op(e){As.current===e&&(Ze(rr),Ze(As))}var et=to(0);function Al(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Sc=[];function ip(){for(var e=0;e<Sc.length;e++)Sc[e]._workInProgressVersionPrimary=null;Sc.length=0}var ll=kr.ReactCurrentDispatcher,kc=kr.ReactCurrentBatchConfig,bo=0,tt=null,gt=null,xt=null,Nl=!1,vs=!1,Ls=0,zk=0;function Mt(){throw Error(ne(321))}function sp(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Wn(e[n],t[n]))return!1;return!0}function ap(e,t,n,r,o,i){if(bo=i,tt=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ll.current=e===null||e.memoizedState===null?Vk:Hk,e=n(r,o),vs){i=0;do{if(vs=!1,Ls=0,25<=i)throw Error(ne(301));i+=1,xt=gt=null,t.updateQueue=null,ll.current=Uk,e=n(r,o)}while(vs)}if(ll.current=Ll,t=gt!==null&>.next!==null,bo=0,xt=gt=tt=null,Nl=!1,t)throw Error(ne(300));return e}function lp(){var e=Ls!==0;return Ls=0,e}function qn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return xt===null?tt.memoizedState=xt=e:xt=xt.next=e,xt}function jn(){if(gt===null){var e=tt.alternate;e=e!==null?e.memoizedState:null}else e=gt.next;var t=xt===null?tt.memoizedState:xt.next;if(t!==null)xt=t,gt=e;else{if(e===null)throw Error(ne(310));gt=e,e={memoizedState:gt.memoizedState,baseState:gt.baseState,baseQueue:gt.baseQueue,queue:gt.queue,next:null},xt===null?tt.memoizedState=xt=e:xt=xt.next=e}return xt}function Ds(e,t){return typeof t=="function"?t(e):t}function Ec(e){var t=jn(),n=t.queue;if(n===null)throw Error(ne(311));n.lastRenderedReducer=e;var r=gt,o=r.baseQueue,i=n.pending;if(i!==null){if(o!==null){var s=o.next;o.next=i.next,i.next=s}r.baseQueue=o=i,n.pending=null}if(o!==null){i=o.next,r=r.baseState;var a=s=null,l=null,c=i;do{var f=c.lane;if((bo&f)===f)l!==null&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:e(r,c.action);else{var p={lane:f,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(a=l=p,s=r):l=l.next=p,tt.lanes|=f,So|=f}c=c.next}while(c!==null&&c!==i);l===null?s=r:l.next=a,Wn(r,t.memoizedState)||(qt=!0),t.memoizedState=r,t.baseState=s,t.baseQueue=l,n.lastRenderedState=r}if(e=n.interleaved,e!==null){o=e;do i=o.lane,tt.lanes|=i,So|=i,o=o.next;while(o!==e)}else o===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Cc(e){var t=jn(),n=t.queue;if(n===null)throw Error(ne(311));n.lastRenderedReducer=e;var r=n.dispatch,o=n.pending,i=t.memoizedState;if(o!==null){n.pending=null;var s=o=o.next;do i=e(i,s.action),s=s.next;while(s!==o);Wn(i,t.memoizedState)||(qt=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function I0(){}function T0(e,t){var n=tt,r=jn(),o=t(),i=!Wn(r.memoizedState,o);if(i&&(r.memoizedState=o,qt=!0),r=r.queue,up(P0.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||xt!==null&&xt.memoizedState.tag&1){if(n.flags|=2048,zs(9,j0.bind(null,n,r,o,t),void 0,null),bt===null)throw Error(ne(349));bo&30||R0(n,t,o)}return o}function R0(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=tt.updateQueue,t===null?(t={lastEffect:null,stores:null},tt.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function j0(e,t,n,r){t.value=n,t.getSnapshot=r,F0(t)&&_0(e)}function P0(e,t,n){return n(function(){F0(t)&&_0(e)})}function F0(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Wn(e,n)}catch{return!0}}function _0(e){var t=br(e,1);t!==null&&Bn(t,e,1,-1)}function sm(e){var t=qn();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ds,lastRenderedState:e},t.queue=e,e=e.dispatch=Wk.bind(null,tt,e),[t.memoizedState,e]}function zs(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=tt.updateQueue,t===null?(t={lastEffect:null,stores:null},tt.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function M0(){return jn().memoizedState}function ul(e,t,n,r){var o=qn();tt.flags|=e,o.memoizedState=zs(1|t,n,void 0,r===void 0?null:r)}function cu(e,t,n,r){var o=jn();r=r===void 0?null:r;var i=void 0;if(gt!==null){var s=gt.memoizedState;if(i=s.destroy,r!==null&&sp(r,s.deps)){o.memoizedState=zs(t,n,i,r);return}}tt.flags|=e,o.memoizedState=zs(1|t,n,i,r)}function am(e,t){return ul(8390656,8,e,t)}function up(e,t){return cu(2048,8,e,t)}function $0(e,t){return cu(4,2,e,t)}function A0(e,t){return cu(4,4,e,t)}function N0(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function L0(e,t,n){return n=n!=null?n.concat([e]):null,cu(4,4,N0.bind(null,t,e),n)}function cp(){}function D0(e,t){var n=jn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&sp(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function z0(e,t){var n=jn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&sp(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function O0(e,t,n){return bo&21?(Wn(n,t)||(n=Uy(),tt.lanes|=n,So|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,qt=!0),e.memoizedState=n)}function Ok(e,t){var n=Ne;Ne=n!==0&&4>n?n:4,e(!0);var r=kc.transition;kc.transition={};try{e(!1),t()}finally{Ne=n,kc.transition=r}}function B0(){return jn().memoizedState}function Bk(e,t,n){var r=Kr(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},W0(e))V0(t,n);else if(n=k0(e,t,n,r),n!==null){var o=Bt();Bn(n,e,r,o),H0(n,t,r)}}function Wk(e,t,n){var r=Kr(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(W0(e))V0(t,o);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var s=t.lastRenderedState,a=i(s,n);if(o.hasEagerState=!0,o.eagerState=a,Wn(a,s)){var l=t.interleaved;l===null?(o.next=o,tp(t)):(o.next=l.next,l.next=o),t.interleaved=o;return}}catch{}finally{}n=k0(e,t,o,r),n!==null&&(o=Bt(),Bn(n,e,r,o),H0(n,t,r))}}function W0(e){var t=e.alternate;return e===tt||t!==null&&t===tt}function V0(e,t){vs=Nl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function H0(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Bf(e,n)}}var Ll={readContext:Rn,useCallback:Mt,useContext:Mt,useEffect:Mt,useImperativeHandle:Mt,useInsertionEffect:Mt,useLayoutEffect:Mt,useMemo:Mt,useReducer:Mt,useRef:Mt,useState:Mt,useDebugValue:Mt,useDeferredValue:Mt,useTransition:Mt,useMutableSource:Mt,useSyncExternalStore:Mt,useId:Mt,unstable_isNewReconciler:!1},Vk={readContext:Rn,useCallback:function(e,t){return qn().memoizedState=[e,t===void 0?null:t],e},useContext:Rn,useEffect:am,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,ul(4194308,4,N0.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ul(4194308,4,e,t)},useInsertionEffect:function(e,t){return ul(4,2,e,t)},useMemo:function(e,t){var n=qn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=qn();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Bk.bind(null,tt,e),[r.memoizedState,e]},useRef:function(e){var t=qn();return e={current:e},t.memoizedState=e},useState:sm,useDebugValue:cp,useDeferredValue:function(e){return qn().memoizedState=e},useTransition:function(){var e=sm(!1),t=e[0];return e=Ok.bind(null,e[1]),qn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=tt,o=qn();if(Ge){if(n===void 0)throw Error(ne(407));n=n()}else{if(n=t(),bt===null)throw Error(ne(349));bo&30||R0(r,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,am(P0.bind(null,r,i,e),[e]),r.flags|=2048,zs(9,j0.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=qn(),t=bt.identifierPrefix;if(Ge){var n=gr,r=mr;n=(r&~(1<<32-On(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Ls++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=zk++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Hk={readContext:Rn,useCallback:D0,useContext:Rn,useEffect:up,useImperativeHandle:L0,useInsertionEffect:$0,useLayoutEffect:A0,useMemo:z0,useReducer:Ec,useRef:M0,useState:function(){return Ec(Ds)},useDebugValue:cp,useDeferredValue:function(e){var t=jn();return O0(t,gt.memoizedState,e)},useTransition:function(){var e=Ec(Ds)[0],t=jn().memoizedState;return[e,t]},useMutableSource:I0,useSyncExternalStore:T0,useId:B0,unstable_isNewReconciler:!1},Uk={readContext:Rn,useCallback:D0,useContext:Rn,useEffect:up,useImperativeHandle:L0,useInsertionEffect:$0,useLayoutEffect:A0,useMemo:z0,useReducer:Cc,useRef:M0,useState:function(){return Cc(Ds)},useDebugValue:cp,useDeferredValue:function(e){var t=jn();return gt===null?t.memoizedState=e:O0(t,gt.memoizedState,e)},useTransition:function(){var e=Cc(Ds)[0],t=jn().memoizedState;return[e,t]},useMutableSource:I0,useSyncExternalStore:T0,useId:B0,unstable_isNewReconciler:!1};function Ln(e,t){if(e&&e.defaultProps){t=nt({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Bd(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:nt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var du={isMounted:function(e){return(e=e._reactInternals)?Ro(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Bt(),o=Kr(e),i=yr(r,o);i.payload=t,n!=null&&(i.callback=n),t=Ur(e,i,o),t!==null&&(Bn(t,e,o,r),al(t,e,o))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Bt(),o=Kr(e),i=yr(r,o);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Ur(e,i,o),t!==null&&(Bn(t,e,o,r),al(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Bt(),r=Kr(e),o=yr(n,r);o.tag=2,t!=null&&(o.callback=t),t=Ur(e,o,r),t!==null&&(Bn(t,e,r,n),al(t,e,r))}};function lm(e,t,n,r,o,i,s){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,s):t.prototype&&t.prototype.isPureReactComponent?!Fs(n,r)||!Fs(o,i):!0}function U0(e,t,n){var r=!1,o=qr,i=t.contextType;return typeof i=="object"&&i!==null?i=Rn(i):(o=Jt(t)?wo:Dt.current,r=t.contextTypes,i=(r=r!=null)?xi(e,o):qr),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=du,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=i),t}function um(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&du.enqueueReplaceState(t,t.state,null)}function Wd(e,t,n,r){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs={},np(e);var i=t.contextType;typeof i=="object"&&i!==null?o.context=Rn(i):(i=Jt(t)?wo:Dt.current,o.context=xi(e,i)),o.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Bd(e,t,i,n),o.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(t=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),t!==o.state&&du.enqueueReplaceState(o,o.state,null),$l(e,n,o,r),o.state=e.memoizedState),typeof o.componentDidMount=="function"&&(e.flags|=4194308)}function Ei(e,t){try{var n="",r=t;do n+=wS(r),r=r.return;while(r);var o=n}catch(i){o=`
|
|
39
|
-
Error generating stack: `+i.message+`
|
|
40
|
-
`+i.stack}return{value:e,source:t,stack:o,digest:null}}function Ic(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Vd(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Zk=typeof WeakMap=="function"?WeakMap:Map;function Z0(e,t,n){n=yr(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){zl||(zl=!0,Jd=r),Vd(e,t)},n}function K0(e,t,n){n=yr(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var o=t.value;n.payload=function(){return r(o)},n.callback=function(){Vd(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Vd(e,t),typeof r!="function"&&(Zr===null?Zr=new Set([this]):Zr.add(this));var s=t.stack;this.componentDidCatch(t.value,{componentStack:s!==null?s:""})}),n}function cm(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Zk;var o=new Set;r.set(t,o)}else o=r.get(t),o===void 0&&(o=new Set,r.set(t,o));o.has(n)||(o.add(n),e=sE.bind(null,e,t,n),t.then(e,e))}function dm(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function fm(e,t,n,r,o){return e.mode&1?(e.flags|=65536,e.lanes=o,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=yr(-1,1),t.tag=2,Ur(n,t,1))),n.lanes|=1),e)}var Kk=kr.ReactCurrentOwner,qt=!1;function Ot(e,t,n,r){t.child=e===null?S0(t,null,n,r):Si(t,e.child,n,r)}function pm(e,t,n,r,o){n=n.render;var i=t.ref;return hi(t,o),r=ap(e,t,n,r,i,o),n=lp(),e!==null&&!qt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Sr(e,t,o)):(Ge&&n&&Gf(t),t.flags|=1,Ot(e,t,r,o),t.child)}function hm(e,t,n,r,o){if(e===null){var i=n.type;return typeof i=="function"&&!yp(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,Y0(e,t,i,r,o)):(e=pl(n.type,null,r,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&o)){var s=i.memoizedProps;if(n=n.compare,n=n!==null?n:Fs,n(s,r)&&e.ref===t.ref)return Sr(e,t,o)}return t.flags|=1,e=Yr(i,r),e.ref=t.ref,e.return=t,t.child=e}function Y0(e,t,n,r,o){if(e!==null){var i=e.memoizedProps;if(Fs(i,r)&&e.ref===t.ref)if(qt=!1,t.pendingProps=r=i,(e.lanes&o)!==0)e.flags&131072&&(qt=!0);else return t.lanes=e.lanes,Sr(e,t,o)}return Hd(e,t,n,r,o)}function G0(e,t,n){var r=t.pendingProps,o=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},We(si,ln),ln|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,We(si,ln),ln|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,We(si,ln),ln|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,We(si,ln),ln|=r;return Ot(e,t,o,n),t.child}function X0(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Hd(e,t,n,r,o){var i=Jt(n)?wo:Dt.current;return i=xi(t,i),hi(t,o),n=ap(e,t,n,r,i,o),r=lp(),e!==null&&!qt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Sr(e,t,o)):(Ge&&r&&Gf(t),t.flags|=1,Ot(e,t,n,o),t.child)}function mm(e,t,n,r,o){if(Jt(n)){var i=!0;jl(t)}else i=!1;if(hi(t,o),t.stateNode===null)cl(e,t),U0(t,n,r),Wd(t,n,r,o),r=!0;else if(e===null){var s=t.stateNode,a=t.memoizedProps;s.props=a;var l=s.context,c=n.contextType;typeof c=="object"&&c!==null?c=Rn(c):(c=Jt(n)?wo:Dt.current,c=xi(t,c));var f=n.getDerivedStateFromProps,p=typeof f=="function"||typeof s.getSnapshotBeforeUpdate=="function";p||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==r||l!==c)&&um(t,s,r,c),Ar=!1;var h=t.memoizedState;s.state=h,$l(t,r,s,o),l=t.memoizedState,a!==r||h!==l||Qt.current||Ar?(typeof f=="function"&&(Bd(t,n,f,r),l=t.memoizedState),(a=Ar||lm(t,n,a,r,h,l,c))?(p||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(t.flags|=4194308)):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),s.props=r,s.state=l,s.context=c,r=a):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{s=t.stateNode,E0(e,t),a=t.memoizedProps,c=t.type===t.elementType?a:Ln(t.type,a),s.props=c,p=t.pendingProps,h=s.context,l=n.contextType,typeof l=="object"&&l!==null?l=Rn(l):(l=Jt(n)?wo:Dt.current,l=xi(t,l));var m=n.getDerivedStateFromProps;(f=typeof m=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==p||h!==l)&&um(t,s,r,l),Ar=!1,h=t.memoizedState,s.state=h,$l(t,r,s,o);var x=t.memoizedState;a!==p||h!==x||Qt.current||Ar?(typeof m=="function"&&(Bd(t,n,m,r),x=t.memoizedState),(c=Ar||lm(t,n,c,r,h,x,l)||!1)?(f||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,x,l),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,x,l)),typeof s.componentDidUpdate=="function"&&(t.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof s.componentDidUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=x),s.props=r,s.state=x,s.context=l,r=c):(typeof s.componentDidUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return Ud(e,t,n,r,i,o)}function Ud(e,t,n,r,o,i){X0(e,t);var s=(t.flags&128)!==0;if(!r&&!s)return o&&em(t,n,!1),Sr(e,t,i);r=t.stateNode,Kk.current=t;var a=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&s?(t.child=Si(t,e.child,null,i),t.child=Si(t,null,a,i)):Ot(e,t,a,i),t.memoizedState=r.state,o&&em(t,n,!0),t.child}function q0(e){var t=e.stateNode;t.pendingContext?Jh(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Jh(e,t.context,!1),rp(e,t.containerInfo)}function gm(e,t,n,r,o){return bi(),qf(o),t.flags|=256,Ot(e,t,n,r),t.child}var Zd={dehydrated:null,treeContext:null,retryLane:0};function Kd(e){return{baseLanes:e,cachePool:null,transitions:null}}function Q0(e,t,n){var r=t.pendingProps,o=et.current,i=!1,s=(t.flags&128)!==0,a;if((a=s)||(a=e!==null&&e.memoizedState===null?!1:(o&2)!==0),a?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(o|=1),We(et,o&1),e===null)return zd(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(s=r.children,e=r.fallback,i?(r=t.mode,i=t.child,s={mode:"hidden",children:s},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=s):i=hu(s,r,0,null),e=yo(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Kd(n),t.memoizedState=Zd,e):dp(t,s));if(o=e.memoizedState,o!==null&&(a=o.dehydrated,a!==null))return Yk(e,t,s,r,a,o,n);if(i){i=r.fallback,s=t.mode,o=e.child,a=o.sibling;var l={mode:"hidden",children:r.children};return!(s&1)&&t.child!==o?(r=t.child,r.childLanes=0,r.pendingProps=l,t.deletions=null):(r=Yr(o,l),r.subtreeFlags=o.subtreeFlags&14680064),a!==null?i=Yr(a,i):(i=yo(i,s,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,s=e.child.memoizedState,s=s===null?Kd(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=e.childLanes&~n,t.memoizedState=Zd,r}return i=e.child,e=i.sibling,r=Yr(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function dp(e,t){return t=hu({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Ta(e,t,n,r){return r!==null&&qf(r),Si(t,e.child,null,n),e=dp(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Yk(e,t,n,r,o,i,s){if(n)return t.flags&256?(t.flags&=-257,r=Ic(Error(ne(422))),Ta(e,t,s,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,o=t.mode,r=hu({mode:"visible",children:r.children},o,0,null),i=yo(i,o,s,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&Si(t,e.child,null,s),t.child.memoizedState=Kd(s),t.memoizedState=Zd,i);if(!(t.mode&1))return Ta(e,t,s,null);if(o.data==="$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var a=r.dgst;return r=a,i=Error(ne(419)),r=Ic(i,r,void 0),Ta(e,t,s,r)}if(a=(s&e.childLanes)!==0,qt||a){if(r=bt,r!==null){switch(s&-s){case 4:o=2;break;case 16:o=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:o=32;break;case 536870912:o=268435456;break;default:o=0}o=o&(r.suspendedLanes|s)?0:o,o!==0&&o!==i.retryLane&&(i.retryLane=o,br(e,o),Bn(r,e,o,-1))}return vp(),r=Ic(Error(ne(421))),Ta(e,t,s,r)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=aE.bind(null,e),o._reactRetry=t,null):(e=i.treeContext,un=Hr(o.nextSibling),cn=t,Ge=!0,zn=null,e!==null&&(Sn[kn++]=mr,Sn[kn++]=gr,Sn[kn++]=xo,mr=e.id,gr=e.overflow,xo=t),t=dp(t,r.children),t.flags|=4096,t)}function vm(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Od(e.return,t,n)}function Tc(e,t,n,r,o){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=o)}function J0(e,t,n){var r=t.pendingProps,o=r.revealOrder,i=r.tail;if(Ot(e,t,r.children,n),r=et.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&vm(e,n,t);else if(e.tag===19)vm(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(We(et,r),!(t.mode&1))t.memoizedState=null;else switch(o){case"forwards":for(n=t.child,o=null;n!==null;)e=n.alternate,e!==null&&Al(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),Tc(t,!1,o,n,i);break;case"backwards":for(n=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&Al(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}Tc(t,!0,n,null,i);break;case"together":Tc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function cl(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Sr(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),So|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(ne(153));if(t.child!==null){for(e=t.child,n=Yr(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Yr(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Gk(e,t,n){switch(t.tag){case 3:q0(t),bi();break;case 5:C0(t);break;case 1:Jt(t.type)&&jl(t);break;case 4:rp(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;We(_l,r._currentValue),r._currentValue=o;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(We(et,et.current&1),t.flags|=128,null):n&t.child.childLanes?Q0(e,t,n):(We(et,et.current&1),e=Sr(e,t,n),e!==null?e.sibling:null);We(et,et.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return J0(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),We(et,et.current),r)break;return null;case 22:case 23:return t.lanes=0,G0(e,t,n)}return Sr(e,t,n)}var ew,Yd,tw,nw;ew=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Yd=function(){};tw=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,ho(rr.current);var i=null;switch(n){case"input":o=gd(e,o),r=gd(e,r),i=[];break;case"select":o=nt({},o,{value:void 0}),r=nt({},r,{value:void 0}),i=[];break;case"textarea":o=wd(e,o),r=wd(e,r),i=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Tl)}bd(n,r);var s;n=null;for(c in o)if(!r.hasOwnProperty(c)&&o.hasOwnProperty(c)&&o[c]!=null)if(c==="style"){var a=o[c];for(s in a)a.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(Es.hasOwnProperty(c)?i||(i=[]):(i=i||[]).push(c,null));for(c in r){var l=r[c];if(a=o!=null?o[c]:void 0,r.hasOwnProperty(c)&&l!==a&&(l!=null||a!=null))if(c==="style")if(a){for(s in a)!a.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in l)l.hasOwnProperty(s)&&a[s]!==l[s]&&(n||(n={}),n[s]=l[s])}else n||(i||(i=[]),i.push(c,n)),n=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(i=i||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(i=i||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(Es.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&He("scroll",e),i||a===l||(i=[])):(i=i||[]).push(c,l))}n&&(i=i||[]).push("style",n);var c=i;(t.updateQueue=c)&&(t.flags|=4)}};nw=function(e,t,n,r){n!==r&&(t.flags|=4)};function Gi(e,t){if(!Ge)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function $t(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags&14680064,r|=o.flags&14680064,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Xk(e,t,n){var r=t.pendingProps;switch(Xf(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return $t(t),null;case 1:return Jt(t.type)&&Rl(),$t(t),null;case 3:return r=t.stateNode,ki(),Ze(Qt),Ze(Dt),ip(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Ca(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,zn!==null&&(nf(zn),zn=null))),Yd(e,t),$t(t),null;case 5:op(t);var o=ho(Ns.current);if(n=t.type,e!==null&&t.stateNode!=null)tw(e,t,n,r,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(ne(166));return $t(t),null}if(e=ho(rr.current),Ca(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[Jn]=t,r[$s]=i,e=(t.mode&1)!==0,n){case"dialog":He("cancel",r),He("close",r);break;case"iframe":case"object":case"embed":He("load",r);break;case"video":case"audio":for(o=0;o<us.length;o++)He(us[o],r);break;case"source":He("error",r);break;case"img":case"image":case"link":He("error",r),He("load",r);break;case"details":He("toggle",r);break;case"input":Ih(r,i),He("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},He("invalid",r);break;case"textarea":Rh(r,i),He("invalid",r)}bd(n,i),o=null;for(var s in i)if(i.hasOwnProperty(s)){var a=i[s];s==="children"?typeof a=="string"?r.textContent!==a&&(i.suppressHydrationWarning!==!0&&Ea(r.textContent,a,e),o=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(i.suppressHydrationWarning!==!0&&Ea(r.textContent,a,e),o=["children",""+a]):Es.hasOwnProperty(s)&&a!=null&&s==="onScroll"&&He("scroll",r)}switch(n){case"input":ga(r),Th(r,i,!0);break;case"textarea":ga(r),jh(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=Tl)}r=o,t.updateQueue=r,r!==null&&(t.flags|=4)}else{s=o.nodeType===9?o:o.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Py(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=s.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[Jn]=t,e[$s]=r,ew(e,t,!1,!1),t.stateNode=e;e:{switch(s=Sd(n,r),n){case"dialog":He("cancel",e),He("close",e),o=r;break;case"iframe":case"object":case"embed":He("load",e),o=r;break;case"video":case"audio":for(o=0;o<us.length;o++)He(us[o],e);o=r;break;case"source":He("error",e),o=r;break;case"img":case"image":case"link":He("error",e),He("load",e),o=r;break;case"details":He("toggle",e),o=r;break;case"input":Ih(e,r),o=gd(e,r),He("invalid",e);break;case"option":o=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},o=nt({},r,{value:void 0}),He("invalid",e);break;case"textarea":Rh(e,r),o=wd(e,r),He("invalid",e);break;default:o=r}bd(n,o),a=o;for(i in a)if(a.hasOwnProperty(i)){var l=a[i];i==="style"?My(e,l):i==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&Fy(e,l)):i==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&Cs(e,l):typeof l=="number"&&Cs(e,""+l):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Es.hasOwnProperty(i)?l!=null&&i==="onScroll"&&He("scroll",e):l!=null&&Af(e,i,l,s))}switch(n){case"input":ga(e),Th(e,r,!1);break;case"textarea":ga(e),jh(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Xr(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?ci(e,!!r.multiple,i,!1):r.defaultValue!=null&&ci(e,!!r.multiple,r.defaultValue,!0);break;default:typeof o.onClick=="function"&&(e.onclick=Tl)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return $t(t),null;case 6:if(e&&t.stateNode!=null)nw(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(ne(166));if(n=ho(Ns.current),ho(rr.current),Ca(t)){if(r=t.stateNode,n=t.memoizedProps,r[Jn]=t,(i=r.nodeValue!==n)&&(e=cn,e!==null))switch(e.tag){case 3:Ea(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Ea(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Jn]=t,t.stateNode=r}return $t(t),null;case 13:if(Ze(et),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Ge&&un!==null&&t.mode&1&&!(t.flags&128))x0(),bi(),t.flags|=98560,i=!1;else if(i=Ca(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(ne(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(ne(317));i[Jn]=t}else bi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;$t(t),i=!1}else zn!==null&&(nf(zn),zn=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||et.current&1?vt===0&&(vt=3):vp())),t.updateQueue!==null&&(t.flags|=4),$t(t),null);case 4:return ki(),Yd(e,t),e===null&&_s(t.stateNode.containerInfo),$t(t),null;case 10:return ep(t.type._context),$t(t),null;case 17:return Jt(t.type)&&Rl(),$t(t),null;case 19:if(Ze(et),i=t.memoizedState,i===null)return $t(t),null;if(r=(t.flags&128)!==0,s=i.rendering,s===null)if(r)Gi(i,!1);else{if(vt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=Al(e),s!==null){for(t.flags|=128,Gi(i,!1),r=s.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,s=i.alternate,s===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=s.childLanes,i.lanes=s.lanes,i.child=s.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=s.memoizedProps,i.memoizedState=s.memoizedState,i.updateQueue=s.updateQueue,i.type=s.type,e=s.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return We(et,et.current&1|2),t.child}e=e.sibling}i.tail!==null&&ut()>Ci&&(t.flags|=128,r=!0,Gi(i,!1),t.lanes=4194304)}else{if(!r)if(e=Al(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Gi(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!Ge)return $t(t),null}else 2*ut()-i.renderingStartTime>Ci&&n!==1073741824&&(t.flags|=128,r=!0,Gi(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(n=i.last,n!==null?n.sibling=s:t.child=s,i.last=s)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=ut(),t.sibling=null,n=et.current,We(et,r?n&1|2:n&1),t):($t(t),null);case 22:case 23:return gp(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?ln&1073741824&&($t(t),t.subtreeFlags&6&&(t.flags|=8192)):$t(t),null;case 24:return null;case 25:return null}throw Error(ne(156,t.tag))}function qk(e,t){switch(Xf(t),t.tag){case 1:return Jt(t.type)&&Rl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ki(),Ze(Qt),Ze(Dt),ip(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return op(t),null;case 13:if(Ze(et),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ne(340));bi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ze(et),null;case 4:return ki(),null;case 10:return ep(t.type._context),null;case 22:case 23:return gp(),null;case 24:return null;default:return null}}var Ra=!1,Nt=!1,Qk=typeof WeakSet=="function"?WeakSet:Set,pe=null;function ii(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){st(e,t,r)}else n.current=null}function Gd(e,t,n){try{n()}catch(r){st(e,t,r)}}var ym=!1;function Jk(e,t){if(_d=El,e=a0(),Yf(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,a=-1,l=-1,c=0,f=0,p=e,h=null;t:for(;;){for(var m;p!==n||o!==0&&p.nodeType!==3||(a=s+o),p!==i||r!==0&&p.nodeType!==3||(l=s+r),p.nodeType===3&&(s+=p.nodeValue.length),(m=p.firstChild)!==null;)h=p,p=m;for(;;){if(p===e)break t;if(h===n&&++c===o&&(a=s),h===i&&++f===r&&(l=s),(m=p.nextSibling)!==null)break;p=h,h=p.parentNode}p=m}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Md={focusedElem:e,selectionRange:n},El=!1,pe=t;pe!==null;)if(t=pe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,pe=e;else for(;pe!==null;){t=pe;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var v=x.memoizedProps,k=x.memoizedState,g=t.stateNode,y=g.getSnapshotBeforeUpdate(t.elementType===t.type?v:Ln(t.type,v),k);g.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ne(163))}}catch(b){st(t,t.return,b)}if(e=t.sibling,e!==null){e.return=t.return,pe=e;break}pe=t.return}return x=ym,ym=!1,x}function ys(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&e)===e){var i=o.destroy;o.destroy=void 0,i!==void 0&&Gd(t,n,i)}o=o.next}while(o!==r)}}function fu(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Xd(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function rw(e){var t=e.alternate;t!==null&&(e.alternate=null,rw(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Jn],delete t[$s],delete t[Nd],delete t[Ak],delete t[Nk])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function ow(e){return e.tag===5||e.tag===3||e.tag===4}function wm(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||ow(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function qd(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Tl));else if(r!==4&&(e=e.child,e!==null))for(qd(e,t,n),e=e.sibling;e!==null;)qd(e,t,n),e=e.sibling}function Qd(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Qd(e,t,n),e=e.sibling;e!==null;)Qd(e,t,n),e=e.sibling}var It=null,Dn=!1;function jr(e,t,n){for(n=n.child;n!==null;)iw(e,t,n),n=n.sibling}function iw(e,t,n){if(nr&&typeof nr.onCommitFiberUnmount=="function")try{nr.onCommitFiberUnmount(ou,n)}catch{}switch(n.tag){case 5:Nt||ii(n,t);case 6:var r=It,o=Dn;It=null,jr(e,t,n),It=r,Dn=o,It!==null&&(Dn?(e=It,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):It.removeChild(n.stateNode));break;case 18:It!==null&&(Dn?(e=It,n=n.stateNode,e.nodeType===8?xc(e.parentNode,n):e.nodeType===1&&xc(e,n),js(e)):xc(It,n.stateNode));break;case 4:r=It,o=Dn,It=n.stateNode.containerInfo,Dn=!0,jr(e,t,n),It=r,Dn=o;break;case 0:case 11:case 14:case 15:if(!Nt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var i=o,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&Gd(n,t,s),o=o.next}while(o!==r)}jr(e,t,n);break;case 1:if(!Nt&&(ii(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){st(n,t,a)}jr(e,t,n);break;case 21:jr(e,t,n);break;case 22:n.mode&1?(Nt=(r=Nt)||n.memoizedState!==null,jr(e,t,n),Nt=r):jr(e,t,n);break;default:jr(e,t,n)}}function xm(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Qk),t.forEach(function(r){var o=lE.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function $n(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var o=n[r];try{var i=e,s=t,a=s;e:for(;a!==null;){switch(a.tag){case 5:It=a.stateNode,Dn=!1;break e;case 3:It=a.stateNode.containerInfo,Dn=!0;break e;case 4:It=a.stateNode.containerInfo,Dn=!0;break e}a=a.return}if(It===null)throw Error(ne(160));iw(i,s,o),It=null,Dn=!1;var l=o.alternate;l!==null&&(l.return=null),o.return=null}catch(c){st(o,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)sw(t,e),t=t.sibling}function sw(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if($n(t,e),Gn(e),r&4){try{ys(3,e,e.return),fu(3,e)}catch(v){st(e,e.return,v)}try{ys(5,e,e.return)}catch(v){st(e,e.return,v)}}break;case 1:$n(t,e),Gn(e),r&512&&n!==null&&ii(n,n.return);break;case 5:if($n(t,e),Gn(e),r&512&&n!==null&&ii(n,n.return),e.flags&32){var o=e.stateNode;try{Cs(o,"")}catch(v){st(e,e.return,v)}}if(r&4&&(o=e.stateNode,o!=null)){var i=e.memoizedProps,s=n!==null?n.memoizedProps:i,a=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{a==="input"&&i.type==="radio"&&i.name!=null&&Ry(o,i),Sd(a,s);var c=Sd(a,i);for(s=0;s<l.length;s+=2){var f=l[s],p=l[s+1];f==="style"?My(o,p):f==="dangerouslySetInnerHTML"?Fy(o,p):f==="children"?Cs(o,p):Af(o,f,p,c)}switch(a){case"input":vd(o,i);break;case"textarea":jy(o,i);break;case"select":var h=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var m=i.value;m!=null?ci(o,!!i.multiple,m,!1):h!==!!i.multiple&&(i.defaultValue!=null?ci(o,!!i.multiple,i.defaultValue,!0):ci(o,!!i.multiple,i.multiple?[]:"",!1))}o[$s]=i}catch(v){st(e,e.return,v)}}break;case 6:if($n(t,e),Gn(e),r&4){if(e.stateNode===null)throw Error(ne(162));o=e.stateNode,i=e.memoizedProps;try{o.nodeValue=i}catch(v){st(e,e.return,v)}}break;case 3:if($n(t,e),Gn(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{js(t.containerInfo)}catch(v){st(e,e.return,v)}break;case 4:$n(t,e),Gn(e);break;case 13:$n(t,e),Gn(e),o=e.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(hp=ut())),r&4&&xm(e);break;case 22:if(f=n!==null&&n.memoizedState!==null,e.mode&1?(Nt=(c=Nt)||f,$n(t,e),Nt=c):$n(t,e),Gn(e),r&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!f&&e.mode&1)for(pe=e,f=e.child;f!==null;){for(p=pe=f;pe!==null;){switch(h=pe,m=h.child,h.tag){case 0:case 11:case 14:case 15:ys(4,h,h.return);break;case 1:ii(h,h.return);var x=h.stateNode;if(typeof x.componentWillUnmount=="function"){r=h,n=h.return;try{t=r,x.props=t.memoizedProps,x.state=t.memoizedState,x.componentWillUnmount()}catch(v){st(r,n,v)}}break;case 5:ii(h,h.return);break;case 22:if(h.memoizedState!==null){Sm(p);continue}}m!==null?(m.return=h,pe=m):Sm(p)}f=f.sibling}e:for(f=null,p=e;;){if(p.tag===5){if(f===null){f=p;try{o=p.stateNode,c?(i=o.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(a=p.stateNode,l=p.memoizedProps.style,s=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=_y("display",s))}catch(v){st(e,e.return,v)}}}else if(p.tag===6){if(f===null)try{p.stateNode.nodeValue=c?"":p.memoizedProps}catch(v){st(e,e.return,v)}}else if((p.tag!==22&&p.tag!==23||p.memoizedState===null||p===e)&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===e)break e;for(;p.sibling===null;){if(p.return===null||p.return===e)break e;f===p&&(f=null),p=p.return}f===p&&(f=null),p.sibling.return=p.return,p=p.sibling}}break;case 19:$n(t,e),Gn(e),r&4&&xm(e);break;case 21:break;default:$n(t,e),Gn(e)}}function Gn(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(ow(n)){var r=n;break e}n=n.return}throw Error(ne(160))}switch(r.tag){case 5:var o=r.stateNode;r.flags&32&&(Cs(o,""),r.flags&=-33);var i=wm(e);Qd(e,i,o);break;case 3:case 4:var s=r.stateNode.containerInfo,a=wm(e);qd(e,a,s);break;default:throw Error(ne(161))}}catch(l){st(e,e.return,l)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function eE(e,t,n){pe=e,aw(e)}function aw(e,t,n){for(var r=(e.mode&1)!==0;pe!==null;){var o=pe,i=o.child;if(o.tag===22&&r){var s=o.memoizedState!==null||Ra;if(!s){var a=o.alternate,l=a!==null&&a.memoizedState!==null||Nt;a=Ra;var c=Nt;if(Ra=s,(Nt=l)&&!c)for(pe=o;pe!==null;)s=pe,l=s.child,s.tag===22&&s.memoizedState!==null?km(o):l!==null?(l.return=s,pe=l):km(o);for(;i!==null;)pe=i,aw(i),i=i.sibling;pe=o,Ra=a,Nt=c}bm(e)}else o.subtreeFlags&8772&&i!==null?(i.return=o,pe=i):bm(e)}}function bm(e){for(;pe!==null;){var t=pe;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Nt||fu(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Nt)if(n===null)r.componentDidMount();else{var o=t.elementType===t.type?n.memoizedProps:Ln(t.type,n.memoizedProps);r.componentDidUpdate(o,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&im(t,i,r);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}im(t,s,n)}break;case 5:var a=t.stateNode;if(n===null&&t.flags&4){n=a;var l=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var c=t.alternate;if(c!==null){var f=c.memoizedState;if(f!==null){var p=f.dehydrated;p!==null&&js(p)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(ne(163))}Nt||t.flags&512&&Xd(t)}catch(h){st(t,t.return,h)}}if(t===e){pe=null;break}if(n=t.sibling,n!==null){n.return=t.return,pe=n;break}pe=t.return}}function Sm(e){for(;pe!==null;){var t=pe;if(t===e){pe=null;break}var n=t.sibling;if(n!==null){n.return=t.return,pe=n;break}pe=t.return}}function km(e){for(;pe!==null;){var t=pe;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{fu(4,t)}catch(l){st(t,n,l)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var o=t.return;try{r.componentDidMount()}catch(l){st(t,o,l)}}var i=t.return;try{Xd(t)}catch(l){st(t,i,l)}break;case 5:var s=t.return;try{Xd(t)}catch(l){st(t,s,l)}}}catch(l){st(t,t.return,l)}if(t===e){pe=null;break}var a=t.sibling;if(a!==null){a.return=t.return,pe=a;break}pe=t.return}}var tE=Math.ceil,Dl=kr.ReactCurrentDispatcher,fp=kr.ReactCurrentOwner,Tn=kr.ReactCurrentBatchConfig,Fe=0,bt=null,pt=null,Tt=0,ln=0,si=to(0),vt=0,Os=null,So=0,pu=0,pp=0,ws=null,Xt=null,hp=0,Ci=1/0,fr=null,zl=!1,Jd=null,Zr=null,ja=!1,Or=null,Ol=0,xs=0,ef=null,dl=-1,fl=0;function Bt(){return Fe&6?ut():dl!==-1?dl:dl=ut()}function Kr(e){return e.mode&1?Fe&2&&Tt!==0?Tt&-Tt:Dk.transition!==null?(fl===0&&(fl=Uy()),fl):(e=Ne,e!==0||(e=window.event,e=e===void 0?16:Qy(e.type)),e):1}function Bn(e,t,n,r){if(50<xs)throw xs=0,ef=null,Error(ne(185));Gs(e,n,r),(!(Fe&2)||e!==bt)&&(e===bt&&(!(Fe&2)&&(pu|=n),vt===4&&Lr(e,Tt)),en(e,r),n===1&&Fe===0&&!(t.mode&1)&&(Ci=ut()+500,uu&&no()))}function en(e,t){var n=e.callbackNode;DS(e,t);var r=kl(e,e===bt?Tt:0);if(r===0)n!==null&&_h(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&_h(n),t===1)e.tag===0?Lk(Em.bind(null,e)):v0(Em.bind(null,e)),Mk(function(){!(Fe&6)&&no()}),n=null;else{switch(Zy(r)){case 1:n=Of;break;case 4:n=Vy;break;case 16:n=Sl;break;case 536870912:n=Hy;break;default:n=Sl}n=mw(n,lw.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function lw(e,t){if(dl=-1,fl=0,Fe&6)throw Error(ne(327));var n=e.callbackNode;if(mi()&&e.callbackNode!==n)return null;var r=kl(e,e===bt?Tt:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Bl(e,r);else{t=r;var o=Fe;Fe|=2;var i=cw();(bt!==e||Tt!==t)&&(fr=null,Ci=ut()+500,vo(e,t));do try{oE();break}catch(a){uw(e,a)}while(!0);Jf(),Dl.current=i,Fe=o,pt!==null?t=0:(bt=null,Tt=0,t=vt)}if(t!==0){if(t===2&&(o=Td(e),o!==0&&(r=o,t=tf(e,o))),t===1)throw n=Os,vo(e,0),Lr(e,r),en(e,ut()),n;if(t===6)Lr(e,r);else{if(o=e.current.alternate,!(r&30)&&!nE(o)&&(t=Bl(e,r),t===2&&(i=Td(e),i!==0&&(r=i,t=tf(e,i))),t===1))throw n=Os,vo(e,0),Lr(e,r),en(e,ut()),n;switch(e.finishedWork=o,e.finishedLanes=r,t){case 0:case 1:throw Error(ne(345));case 2:co(e,Xt,fr);break;case 3:if(Lr(e,r),(r&130023424)===r&&(t=hp+500-ut(),10<t)){if(kl(e,0)!==0)break;if(o=e.suspendedLanes,(o&r)!==r){Bt(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=Ad(co.bind(null,e,Xt,fr),t);break}co(e,Xt,fr);break;case 4:if(Lr(e,r),(r&4194240)===r)break;for(t=e.eventTimes,o=-1;0<r;){var s=31-On(r);i=1<<s,s=t[s],s>o&&(o=s),r&=~i}if(r=o,r=ut()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*tE(r/1960))-r,10<r){e.timeoutHandle=Ad(co.bind(null,e,Xt,fr),r);break}co(e,Xt,fr);break;case 5:co(e,Xt,fr);break;default:throw Error(ne(329))}}}return en(e,ut()),e.callbackNode===n?lw.bind(null,e):null}function tf(e,t){var n=ws;return e.current.memoizedState.isDehydrated&&(vo(e,t).flags|=256),e=Bl(e,t),e!==2&&(t=Xt,Xt=n,t!==null&&nf(t)),e}function nf(e){Xt===null?Xt=e:Xt.push.apply(Xt,e)}function nE(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var o=n[r],i=o.getSnapshot;o=o.value;try{if(!Wn(i(),o))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Lr(e,t){for(t&=~pp,t&=~pu,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-On(t),r=1<<n;e[n]=-1,t&=~r}}function Em(e){if(Fe&6)throw Error(ne(327));mi();var t=kl(e,0);if(!(t&1))return en(e,ut()),null;var n=Bl(e,t);if(e.tag!==0&&n===2){var r=Td(e);r!==0&&(t=r,n=tf(e,r))}if(n===1)throw n=Os,vo(e,0),Lr(e,t),en(e,ut()),n;if(n===6)throw Error(ne(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,co(e,Xt,fr),en(e,ut()),null}function mp(e,t){var n=Fe;Fe|=1;try{return e(t)}finally{Fe=n,Fe===0&&(Ci=ut()+500,uu&&no())}}function ko(e){Or!==null&&Or.tag===0&&!(Fe&6)&&mi();var t=Fe;Fe|=1;var n=Tn.transition,r=Ne;try{if(Tn.transition=null,Ne=1,e)return e()}finally{Ne=r,Tn.transition=n,Fe=t,!(Fe&6)&&no()}}function gp(){ln=si.current,Ze(si)}function vo(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,_k(n)),pt!==null)for(n=pt.return;n!==null;){var r=n;switch(Xf(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Rl();break;case 3:ki(),Ze(Qt),Ze(Dt),ip();break;case 5:op(r);break;case 4:ki();break;case 13:Ze(et);break;case 19:Ze(et);break;case 10:ep(r.type._context);break;case 22:case 23:gp()}n=n.return}if(bt=e,pt=e=Yr(e.current,null),Tt=ln=t,vt=0,Os=null,pp=pu=So=0,Xt=ws=null,po!==null){for(t=0;t<po.length;t++)if(n=po[t],r=n.interleaved,r!==null){n.interleaved=null;var o=r.next,i=n.pending;if(i!==null){var s=i.next;i.next=o,r.next=s}n.pending=r}po=null}return e}function uw(e,t){do{var n=pt;try{if(Jf(),ll.current=Ll,Nl){for(var r=tt.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}Nl=!1}if(bo=0,xt=gt=tt=null,vs=!1,Ls=0,fp.current=null,n===null||n.return===null){vt=1,Os=t,pt=null;break}e:{var i=e,s=n.return,a=n,l=t;if(t=Tt,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,f=a,p=f.tag;if(!(f.mode&1)&&(p===0||p===11||p===15)){var h=f.alternate;h?(f.updateQueue=h.updateQueue,f.memoizedState=h.memoizedState,f.lanes=h.lanes):(f.updateQueue=null,f.memoizedState=null)}var m=dm(s);if(m!==null){m.flags&=-257,fm(m,s,a,i,t),m.mode&1&&cm(i,c,t),t=m,l=c;var x=t.updateQueue;if(x===null){var v=new Set;v.add(l),t.updateQueue=v}else x.add(l);break e}else{if(!(t&1)){cm(i,c,t),vp();break e}l=Error(ne(426))}}else if(Ge&&a.mode&1){var k=dm(s);if(k!==null){!(k.flags&65536)&&(k.flags|=256),fm(k,s,a,i,t),qf(Ei(l,a));break e}}i=l=Ei(l,a),vt!==4&&(vt=2),ws===null?ws=[i]:ws.push(i),i=s;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var g=Z0(i,l,t);om(i,g);break e;case 1:a=l;var y=i.type,w=i.stateNode;if(!(i.flags&128)&&(typeof y.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(Zr===null||!Zr.has(w)))){i.flags|=65536,t&=-t,i.lanes|=t;var b=K0(i,a,t);om(i,b);break e}}i=i.return}while(i!==null)}fw(n)}catch(S){t=S,pt===n&&n!==null&&(pt=n=n.return);continue}break}while(!0)}function cw(){var e=Dl.current;return Dl.current=Ll,e===null?Ll:e}function vp(){(vt===0||vt===3||vt===2)&&(vt=4),bt===null||!(So&268435455)&&!(pu&268435455)||Lr(bt,Tt)}function Bl(e,t){var n=Fe;Fe|=2;var r=cw();(bt!==e||Tt!==t)&&(fr=null,vo(e,t));do try{rE();break}catch(o){uw(e,o)}while(!0);if(Jf(),Fe=n,Dl.current=r,pt!==null)throw Error(ne(261));return bt=null,Tt=0,vt}function rE(){for(;pt!==null;)dw(pt)}function oE(){for(;pt!==null&&!jS();)dw(pt)}function dw(e){var t=hw(e.alternate,e,ln);e.memoizedProps=e.pendingProps,t===null?fw(e):pt=t,fp.current=null}function fw(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=qk(n,t),n!==null){n.flags&=32767,pt=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{vt=6,pt=null;return}}else if(n=Xk(n,t,ln),n!==null){pt=n;return}if(t=t.sibling,t!==null){pt=t;return}pt=t=e}while(t!==null);vt===0&&(vt=5)}function co(e,t,n){var r=Ne,o=Tn.transition;try{Tn.transition=null,Ne=1,iE(e,t,n,r)}finally{Tn.transition=o,Ne=r}return null}function iE(e,t,n,r){do mi();while(Or!==null);if(Fe&6)throw Error(ne(327));n=e.finishedWork;var o=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(ne(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(zS(e,i),e===bt&&(pt=bt=null,Tt=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||ja||(ja=!0,mw(Sl,function(){return mi(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Tn.transition,Tn.transition=null;var s=Ne;Ne=1;var a=Fe;Fe|=4,fp.current=null,Jk(e,n),sw(n,e),Ck(Md),El=!!_d,Md=_d=null,e.current=n,eE(n),PS(),Fe=a,Ne=s,Tn.transition=i}else e.current=n;if(ja&&(ja=!1,Or=e,Ol=o),i=e.pendingLanes,i===0&&(Zr=null),MS(n.stateNode),en(e,ut()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)o=t[n],r(o.value,{componentStack:o.stack,digest:o.digest});if(zl)throw zl=!1,e=Jd,Jd=null,e;return Ol&1&&e.tag!==0&&mi(),i=e.pendingLanes,i&1?e===ef?xs++:(xs=0,ef=e):xs=0,no(),null}function mi(){if(Or!==null){var e=Zy(Ol),t=Tn.transition,n=Ne;try{if(Tn.transition=null,Ne=16>e?16:e,Or===null)var r=!1;else{if(e=Or,Or=null,Ol=0,Fe&6)throw Error(ne(331));var o=Fe;for(Fe|=4,pe=e.current;pe!==null;){var i=pe,s=i.child;if(pe.flags&16){var a=i.deletions;if(a!==null){for(var l=0;l<a.length;l++){var c=a[l];for(pe=c;pe!==null;){var f=pe;switch(f.tag){case 0:case 11:case 15:ys(8,f,i)}var p=f.child;if(p!==null)p.return=f,pe=p;else for(;pe!==null;){f=pe;var h=f.sibling,m=f.return;if(rw(f),f===c){pe=null;break}if(h!==null){h.return=m,pe=h;break}pe=m}}}var x=i.alternate;if(x!==null){var v=x.child;if(v!==null){x.child=null;do{var k=v.sibling;v.sibling=null,v=k}while(v!==null)}}pe=i}}if(i.subtreeFlags&2064&&s!==null)s.return=i,pe=s;else e:for(;pe!==null;){if(i=pe,i.flags&2048)switch(i.tag){case 0:case 11:case 15:ys(9,i,i.return)}var g=i.sibling;if(g!==null){g.return=i.return,pe=g;break e}pe=i.return}}var y=e.current;for(pe=y;pe!==null;){s=pe;var w=s.child;if(s.subtreeFlags&2064&&w!==null)w.return=s,pe=w;else e:for(s=y;pe!==null;){if(a=pe,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:fu(9,a)}}catch(S){st(a,a.return,S)}if(a===s){pe=null;break e}var b=a.sibling;if(b!==null){b.return=a.return,pe=b;break e}pe=a.return}}if(Fe=o,no(),nr&&typeof nr.onPostCommitFiberRoot=="function")try{nr.onPostCommitFiberRoot(ou,e)}catch{}r=!0}return r}finally{Ne=n,Tn.transition=t}}return!1}function Cm(e,t,n){t=Ei(n,t),t=Z0(e,t,1),e=Ur(e,t,1),t=Bt(),e!==null&&(Gs(e,1,t),en(e,t))}function st(e,t,n){if(e.tag===3)Cm(e,e,n);else for(;t!==null;){if(t.tag===3){Cm(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Zr===null||!Zr.has(r))){e=Ei(n,e),e=K0(t,e,1),t=Ur(t,e,1),e=Bt(),t!==null&&(Gs(t,1,e),en(t,e));break}}t=t.return}}function sE(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Bt(),e.pingedLanes|=e.suspendedLanes&n,bt===e&&(Tt&n)===n&&(vt===4||vt===3&&(Tt&130023424)===Tt&&500>ut()-hp?vo(e,0):pp|=n),en(e,t)}function pw(e,t){t===0&&(e.mode&1?(t=wa,wa<<=1,!(wa&130023424)&&(wa=4194304)):t=1);var n=Bt();e=br(e,t),e!==null&&(Gs(e,t,n),en(e,n))}function aE(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),pw(e,n)}function lE(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(ne(314))}r!==null&&r.delete(t),pw(e,n)}var hw;hw=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Qt.current)qt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return qt=!1,Gk(e,t,n);qt=!!(e.flags&131072)}else qt=!1,Ge&&t.flags&1048576&&y0(t,Fl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;cl(e,t),e=t.pendingProps;var o=xi(t,Dt.current);hi(t,n),o=ap(null,t,r,e,o,n);var i=lp();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Jt(r)?(i=!0,jl(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,np(t),o.updater=du,t.stateNode=o,o._reactInternals=t,Wd(t,r,e,n),t=Ud(null,t,r,!0,i,n)):(t.tag=0,Ge&&i&&Gf(t),Ot(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(cl(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=cE(r),e=Ln(r,e),o){case 0:t=Hd(null,t,r,e,n);break e;case 1:t=mm(null,t,r,e,n);break e;case 11:t=pm(null,t,r,e,n);break e;case 14:t=hm(null,t,r,Ln(r.type,e),n);break e}throw Error(ne(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Ln(r,o),Hd(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Ln(r,o),mm(e,t,r,o,n);case 3:e:{if(q0(t),e===null)throw Error(ne(387));r=t.pendingProps,i=t.memoizedState,o=i.element,E0(e,t),$l(t,r,null,n);var s=t.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){o=Ei(Error(ne(423)),t),t=gm(e,t,r,n,o);break e}else if(r!==o){o=Ei(Error(ne(424)),t),t=gm(e,t,r,n,o);break e}else for(un=Hr(t.stateNode.containerInfo.firstChild),cn=t,Ge=!0,zn=null,n=S0(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(bi(),r===o){t=Sr(e,t,n);break e}Ot(e,t,r,n)}t=t.child}return t;case 5:return C0(t),e===null&&zd(t),r=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,s=o.children,$d(r,o)?s=null:i!==null&&$d(r,i)&&(t.flags|=32),X0(e,t),Ot(e,t,s,n),t.child;case 6:return e===null&&zd(t),null;case 13:return Q0(e,t,n);case 4:return rp(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Si(t,null,r,n):Ot(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Ln(r,o),pm(e,t,r,o,n);case 7:return Ot(e,t,t.pendingProps,n),t.child;case 8:return Ot(e,t,t.pendingProps.children,n),t.child;case 12:return Ot(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,i=t.memoizedProps,s=o.value,We(_l,r._currentValue),r._currentValue=s,i!==null)if(Wn(i.value,s)){if(i.children===o.children&&!Qt.current){t=Sr(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var a=i.dependencies;if(a!==null){s=i.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(i.tag===1){l=yr(-1,n&-n),l.tag=2;var c=i.updateQueue;if(c!==null){c=c.shared;var f=c.pending;f===null?l.next=l:(l.next=f.next,f.next=l),c.pending=l}}i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),Od(i.return,n,t),a.lanes|=n;break}l=l.next}}else if(i.tag===10)s=i.type===t.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(ne(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),Od(s,n,t),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===t){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}Ot(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,hi(t,n),o=Rn(o),r=r(o),t.flags|=1,Ot(e,t,r,n),t.child;case 14:return r=t.type,o=Ln(r,t.pendingProps),o=Ln(r.type,o),hm(e,t,r,o,n);case 15:return Y0(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Ln(r,o),cl(e,t),t.tag=1,Jt(r)?(e=!0,jl(t)):e=!1,hi(t,n),U0(t,r,o),Wd(t,r,o,n),Ud(null,t,r,!0,e,n);case 19:return J0(e,t,n);case 22:return G0(e,t,n)}throw Error(ne(156,t.tag))};function mw(e,t){return Wy(e,t)}function uE(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Cn(e,t,n,r){return new uE(e,t,n,r)}function yp(e){return e=e.prototype,!(!e||!e.isReactComponent)}function cE(e){if(typeof e=="function")return yp(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Lf)return 11;if(e===Df)return 14}return 2}function Yr(e,t){var n=e.alternate;return n===null?(n=Cn(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function pl(e,t,n,r,o,i){var s=2;if(r=e,typeof e=="function")yp(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case Xo:return yo(n.children,o,i,t);case Nf:s=8,o|=8;break;case fd:return e=Cn(12,n,t,o|2),e.elementType=fd,e.lanes=i,e;case pd:return e=Cn(13,n,t,o),e.elementType=pd,e.lanes=i,e;case hd:return e=Cn(19,n,t,o),e.elementType=hd,e.lanes=i,e;case Cy:return hu(n,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ky:s=10;break e;case Ey:s=9;break e;case Lf:s=11;break e;case Df:s=14;break e;case $r:s=16,r=null;break e}throw Error(ne(130,e==null?e:typeof e,""))}return t=Cn(s,n,t,o),t.elementType=e,t.type=r,t.lanes=i,t}function yo(e,t,n,r){return e=Cn(7,e,r,t),e.lanes=n,e}function hu(e,t,n,r){return e=Cn(22,e,r,t),e.elementType=Cy,e.lanes=n,e.stateNode={isHidden:!1},e}function Rc(e,t,n){return e=Cn(6,e,null,t),e.lanes=n,e}function jc(e,t,n){return t=Cn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function dE(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=uc(0),this.expirationTimes=uc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=uc(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function wp(e,t,n,r,o,i,s,a,l){return e=new dE(e,t,n,a,l),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Cn(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},np(i),e}function fE(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Go,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function gw(e){if(!e)return qr;e=e._reactInternals;e:{if(Ro(e)!==e||e.tag!==1)throw Error(ne(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Jt(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(ne(171))}if(e.tag===1){var n=e.type;if(Jt(n))return g0(e,n,t)}return t}function vw(e,t,n,r,o,i,s,a,l){return e=wp(n,r,!0,e,o,i,s,a,l),e.context=gw(null),n=e.current,r=Bt(),o=Kr(n),i=yr(r,o),i.callback=t??null,Ur(n,i,o),e.current.lanes=o,Gs(e,o,r),en(e,r),e}function mu(e,t,n,r){var o=t.current,i=Bt(),s=Kr(o);return n=gw(n),t.context===null?t.context=n:t.pendingContext=n,t=yr(i,s),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Ur(o,t,s),e!==null&&(Bn(e,o,s,i),al(e,o,s)),s}function Wl(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Im(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function xp(e,t){Im(e,t),(e=e.alternate)&&Im(e,t)}function pE(){return null}var yw=typeof reportError=="function"?reportError:function(e){console.error(e)};function bp(e){this._internalRoot=e}gu.prototype.render=bp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(ne(409));mu(e,t,null,null)};gu.prototype.unmount=bp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;ko(function(){mu(null,e,null,null)}),t[xr]=null}};function gu(e){this._internalRoot=e}gu.prototype.unstable_scheduleHydration=function(e){if(e){var t=Gy();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Nr.length&&t!==0&&t<Nr[n].priority;n++);Nr.splice(n,0,e),n===0&&qy(e)}};function Sp(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function vu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Tm(){}function hE(e,t,n,r,o){if(o){if(typeof r=="function"){var i=r;r=function(){var c=Wl(s);i.call(c)}}var s=vw(t,r,e,0,null,!1,!1,"",Tm);return e._reactRootContainer=s,e[xr]=s.current,_s(e.nodeType===8?e.parentNode:e),ko(),s}for(;o=e.lastChild;)e.removeChild(o);if(typeof r=="function"){var a=r;r=function(){var c=Wl(l);a.call(c)}}var l=wp(e,0,!1,null,null,!1,!1,"",Tm);return e._reactRootContainer=l,e[xr]=l.current,_s(e.nodeType===8?e.parentNode:e),ko(function(){mu(t,l,n,r)}),l}function yu(e,t,n,r,o){var i=n._reactRootContainer;if(i){var s=i;if(typeof o=="function"){var a=o;o=function(){var l=Wl(s);a.call(l)}}mu(t,s,e,o)}else s=hE(n,t,e,o,r);return Wl(s)}Ky=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=ls(t.pendingLanes);n!==0&&(Bf(t,n|1),en(t,ut()),!(Fe&6)&&(Ci=ut()+500,no()))}break;case 13:ko(function(){var r=br(e,1);if(r!==null){var o=Bt();Bn(r,e,1,o)}}),xp(e,1)}};Wf=function(e){if(e.tag===13){var t=br(e,134217728);if(t!==null){var n=Bt();Bn(t,e,134217728,n)}xp(e,134217728)}};Yy=function(e){if(e.tag===13){var t=Kr(e),n=br(e,t);if(n!==null){var r=Bt();Bn(n,e,t,r)}xp(e,t)}};Gy=function(){return Ne};Xy=function(e,t){var n=Ne;try{return Ne=e,t()}finally{Ne=n}};Ed=function(e,t,n){switch(t){case"input":if(vd(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var o=lu(r);if(!o)throw Error(ne(90));Ty(r),vd(r,o)}}}break;case"textarea":jy(e,n);break;case"select":t=n.value,t!=null&&ci(e,!!n.multiple,t,!1)}};Ny=mp;Ly=ko;var mE={usingClientEntryPoint:!1,Events:[qs,ei,lu,$y,Ay,mp]},Xi={findFiberByHostInstance:fo,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},gE={bundleType:Xi.bundleType,version:Xi.version,rendererPackageName:Xi.rendererPackageName,rendererConfig:Xi.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:kr.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Oy(e),e===null?null:e.stateNode},findFiberByHostInstance:Xi.findFiberByHostInstance||pE,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Pa=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Pa.isDisabled&&Pa.supportsFiber)try{ou=Pa.inject(gE),nr=Pa}catch{}}fn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=mE;fn.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Sp(t))throw Error(ne(200));return fE(e,t,null,n)};fn.createRoot=function(e,t){if(!Sp(e))throw Error(ne(299));var n=!1,r="",o=yw;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=wp(e,1,!1,null,null,n,!1,r,o),e[xr]=t.current,_s(e.nodeType===8?e.parentNode:e),new bp(t)};fn.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(ne(188)):(e=Object.keys(e).join(","),Error(ne(268,e)));return e=Oy(t),e=e===null?null:e.stateNode,e};fn.flushSync=function(e){return ko(e)};fn.hydrate=function(e,t,n){if(!vu(t))throw Error(ne(200));return yu(null,e,t,!0,n)};fn.hydrateRoot=function(e,t,n){if(!Sp(e))throw Error(ne(405));var r=n!=null&&n.hydratedSources||null,o=!1,i="",s=yw;if(n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=vw(t,null,e,1,n??null,o,!1,i,s),e[xr]=t.current,_s(e),r)for(e=0;e<r.length;e++)n=r[e],o=n._getVersion,o=o(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,o]:t.mutableSourceEagerHydrationData.push(n,o);return new gu(t)};fn.render=function(e,t,n){if(!vu(t))throw Error(ne(200));return yu(null,e,t,!1,n)};fn.unmountComponentAtNode=function(e){if(!vu(e))throw Error(ne(40));return e._reactRootContainer?(ko(function(){yu(null,null,e,!1,function(){e._reactRootContainer=null,e[xr]=null})}),!0):!1};fn.unstable_batchedUpdates=mp;fn.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!vu(n))throw Error(ne(200));if(e==null||e._reactInternals===void 0)throw Error(ne(38));return yu(e,t,n,!1,r)};fn.version="18.3.1-next-f1338f8080-20240426";function ww(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ww)}catch(e){console.error(e)}}ww(),wy.exports=fn;var rf=wy.exports,Rm=rf;cd.createRoot=Rm.createRoot,cd.hydrateRoot=Rm.hydrateRoot;var vE=Object.defineProperty,xw=(e,t)=>{for(var n in t)vE(e,n,{get:t[n],enumerable:!0,configurable:!0,set:r=>t[n]=()=>r})};if(typeof d.createContext!="function"){const e=['Remotion requires React.createContext, but it is "undefined".','If you are in a React Server Component, turn it into a client component by adding "use client" at the top of the file.',"","Before:",' import {useCurrentFrame} from "remotion";',"","After:",' "use client";',' import {useCurrentFrame} from "remotion";'];throw new Error(e.join(`
|
|
41
|
-
`))}var jo=d.createContext(!1),of=({children:e})=>u.jsx(jo.Provider,{value:!0,children:e}),bw=d.createContext({setError:()=>{},clearError:()=>{}}),jm=()=>{try{return typeof __webpack_module__>"u"?null:__webpack_module__.hot??null}catch{return null}};class yE extends le.Component{constructor(){super(...arguments);Ae(this,"state",{hasError:!1});Ae(this,"hmrStatusHandler",null)}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(n){this.props.onError(n),this.subscribeToHmrReset()}componentDidMount(){this.state.hasError||this.props.onClear()}componentDidUpdate(n,r){r.hasError&&!this.state.hasError&&this.props.onClear()}componentWillUnmount(){this.unsubscribeFromHmrReset()}subscribeToHmrReset(){if(this.hmrStatusHandler)return;const n=jm();if(!n)return;const r=o=>{o==="idle"&&(this.unsubscribeFromHmrReset(),this.setState({hasError:!1}))};this.hmrStatusHandler=r,n.addStatusHandler(r)}unsubscribeFromHmrReset(){const n=this.hmrStatusHandler;if(!n)return;this.hmrStatusHandler=null;const r=jm();r&&r.removeStatusHandler(n)}render(){return this.state.hasError?null:this.props.children}}var Fi=d.createContext({compositions:[],folders:[],currentCompositionMetadata:null,canvasContent:null}),Js=d.createContext({registerComposition:()=>{},unregisterComposition:()=>{},registerFolder:()=>{},unregisterFolder:()=>{},setCanvasContent:()=>{},onlyRenderComposition:null}),ea=d.createContext({getNonce:()=>0}),hl=0;try{typeof __webpack_module__<"u"&&__webpack_module__.hot&&__webpack_module__.hot.addStatusHandler(e=>{e==="idle"&&hl++})}catch{}var wu=()=>{const t=d.useContext(ea).getNonce(),n=d.useRef(t);n.current=t;const r=d.useRef([[hl,t]]),o=d.useCallback(()=>(hl!==r.current[r.current.length-1][0]&&(r.current=[...r.current,[hl,n.current]]),r.current),[r]);return d.useMemo(()=>({get:o}),[o])};function _i(e){return!!e}var Sw=()=>/^([a-zA-Z0-9-\u4E00-\u9FFF])+$/g,kw=e=>e.match(Sw()),wE=e=>{if(e==null)throw new TypeError("You must pass a name to a <Folder />.");if(typeof e!="string")throw new TypeError(`The "name" you pass into <Folder /> must be a string. Got: ${typeof e}`);if(!kw(e))throw new Error(`Folder name can only contain a-z, A-Z, 0-9 and -. You passed ${e}`)},xE=`Folder name must match ${String(Sw())}`,sf=d.createContext({folderName:null,parentName:null}),bE=e=>{const{name:t,children:n}=e,r=d.useContext(sf),{registerFolder:o,unregisterFolder:i}=d.useContext(Js),s=wu(),a=e.stack??null;wE(t);const l=[r.parentName,r.folderName].filter(_i),c=l.length===0?null:l.join("/"),f=d.useMemo(()=>({folderName:t,parentName:c}),[t,c]);return d.useEffect(()=>(o(t,c,s.get(),a),()=>{i(t,c)}),[t,r.folderName,c,o,i,s,a]),u.jsx(sf.Provider,{value:f,children:n})};function Pm(){return["NOD","E_EN","V"].join("")}var Fm=()=>["e","nv"].join(""),In=()=>{const e=typeof window<"u"&&window.remotion_isPlayer,t=typeof window<"u"&&typeof window.process<"u"&&typeof window.process.env<"u"&&(window.process[Fm()][Pm()]==="test"||window.process[Fm()][Pm()]==="production"&&typeof window<"u"&&typeof window.remotion_puppeteerTimeout<"u"),n=typeof window<"u"&&window.remotion_isStudio,r=typeof window<"u"&&window.remotion_isReadOnlyStudio;return{isStudio:n,isRendering:t,isPlayer:e,isReadOnlyStudio:r,isClientSideRendering:!1}},af="remotion-date:",Bs="remotion-file:",SE=({data:e,indent:t,staticBase:n})=>{let r=!1,o=!1,i=!1,s=!1;try{return{serializedString:JSON.stringify(e,function(l,c){const f=this[l];return f instanceof Date?(r=!0,`${af}${f.toISOString()}`):f instanceof Map?(i=!0,c):f instanceof Set?(s=!0,c):typeof f=="string"&&n!==null&&f.startsWith(n)?(o=!0,`${Bs}${f.replace(n+"/","")}`):c},t),customDateUsed:r,customFileUsed:o,mapUsed:i,setUsed:s}}catch(a){throw new Error("Could not serialize the passed input props to JSON: "+a.message)}},Ew=e=>JSON.parse(e,(t,n)=>typeof n=="string"&&n.startsWith(af)?new Date(n.replace(af,"")):typeof n=="string"&&n.startsWith(Bs)?`${window.remotion_staticBase}/${n.replace(Bs,"")}`:n),kE=e=>Ew(SE({data:e,indent:2,staticBase:window.remotion_staticBase}).serializedString),lf=e=>In().isStudio?kE(e):e,Cw=d.createContext(!1),EE=({children:e})=>u.jsx(Cw.Provider,{value:!0,children:e}),kp=()=>d.useContext(Cw),Pr=({className:e,classPrefix:t,type:n})=>{if(!e)return!1;if(n==="exact"){const r=e.split(" ");return t.some(o=>r.some(i=>i.trim()===o||i.trim().endsWith(`:${o}`)||i.trim().endsWith(`!${o}`)))}return t.some(r=>e.startsWith(r)||e.includes(` ${r}`)||e.includes(`!${r}`)||e.includes(`:${r}`))},CE=(e,t)=>{const{style:n,...r}=e,o=d.useMemo(()=>({position:"absolute",top:Pr({className:r.className,classPrefix:["top-","inset-"],type:"prefix"})?void 0:0,left:Pr({className:r.className,classPrefix:["left-","inset-"],type:"prefix"})?void 0:0,right:Pr({className:r.className,classPrefix:["right-","inset-"],type:"prefix"})?void 0:0,bottom:Pr({className:r.className,classPrefix:["bottom-","inset-"],type:"prefix"})?void 0:0,width:Pr({className:r.className,classPrefix:["w-"],type:"prefix"})?void 0:"100%",height:Pr({className:r.className,classPrefix:["h-"],type:"prefix"})?void 0:"100%",display:Pr({className:r.className,classPrefix:["block","inline-block","inline","flex","inline-flex","flow-root","grid","inline-grid","contents","list-item","hidden"],type:"exact"})?void 0:"flex",flexDirection:Pr({className:r.className,classPrefix:["flex-row","flex-col","flex-row-reverse","flex-col-reverse"],type:"exact"})?void 0:"column",...n}),[r.className,n]);return u.jsx("div",{ref:t,style:o,...r})},Vn=d.forwardRef(CE),IE={transform:"rotate(90deg)"},_m=40,TE={color:"white",fontSize:14,fontFamily:"sans-serif"},RE={justifyContent:"center",alignItems:"center"},jE=()=>u.jsxs(Vn,{style:RE,id:"remotion-comp-loading",children:[u.jsx("style",{type:"text/css",children:`
|
|
42
|
-
@keyframes anim {
|
|
43
|
-
from {
|
|
44
|
-
opacity: 0
|
|
45
|
-
}
|
|
46
|
-
to {
|
|
47
|
-
opacity: 1
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
#remotion-comp-loading {
|
|
51
|
-
animation: anim 2s;
|
|
52
|
-
animation-fill-mode: forwards;
|
|
53
|
-
}
|
|
54
|
-
`}),u.jsx("svg",{width:_m,height:_m,viewBox:"-100 -100 400 400",style:IE,children:u.jsx("path",{fill:"#555",stroke:"#555",strokeWidth:"100",strokeLinejoin:"round",d:"M 2 172 a 196 100 0 0 0 195 5 A 196 240 0 0 0 100 2.259 A 196 240 0 0 0 2 172 z"})}),u.jsxs("p",{style:TE,children:["Resolving ","<Suspense>","..."]})]}),rn=null,uf=()=>{if(!rn){if(typeof document>"u")throw new Error("Tried to call an API that only works in the browser from outside the browser");rn=document.createElement("div"),rn.style.position="absolute",rn.style.top="0px",rn.style.left="0px",rn.style.right="0px",rn.style.bottom="0px",rn.style.width="100%",rn.style.height="100%",rn.style.display="flex",rn.style.flexDirection="column";const e=document.createElement("div");e.style.position="fixed",e.style.top="-999999px",e.appendChild(rn),document.body.appendChild(e)}return rn},cf=()=>"remotion_inputPropsOverride"+window.location.origin,Iw=()=>{if(typeof localStorage>"u")return null;const e=localStorage.getItem(cf());return e?JSON.parse(e):null},PE=e=>{if(!(typeof localStorage>"u")){if(e===null){localStorage.removeItem(cf());return}localStorage.setItem(cf(),JSON.stringify(e))}},Mm=!1,FE=()=>{Mm||(Mm=!0,console.warn("Called `getInputProps()` on the server. This function is not available server-side and has returned an empty object."),console.warn("To hide this warning, don't call this function on the server:"),console.warn(" typeof window === 'undefined' ? {} : getInputProps()"))},_E=()=>{if(typeof window>"u")return FE(),{};if(In().isPlayer)throw new Error("You cannot call `getInputProps()` from a <Player>. Instead, the props are available as React props from component that you passed as `component` prop.");const e=Iw();if(e)return e;if(typeof window>"u"||typeof window.remotion_inputProps>"u")throw new Error("Cannot call `getInputProps()` - window.remotion_inputProps is not set. This API is only available if you are in the Studio, or while you are rendering server-side.");const t=window.remotion_inputProps;return t?Ew(t):{}},Ep=d.createContext({props:{},updateProps:()=>{throw new Error("Not implemented")}}),ME=le.createRef(),Tw=({children:e})=>{const[t,n]=le.useState({}),r=d.useCallback(({defaultProps:i,id:s,newProps:a})=>{n(l=>({...l,[s]:typeof a=="function"?a(l[s]??i):a}))},[]),o=d.useMemo(()=>({props:t,updateProps:r}),[t,r]);return u.jsx(Ep.Provider,{value:o,children:e})},Rw=le.createContext(null),ct=()=>{const e=d.useContext(Rw),[t]=d.useState(()=>In());return e??t};function Vl(e,t,n){if(typeof e!="number")throw new Error(`The "${t}" prop ${n} must be a number, but you passed a value of type ${typeof e}`);if(isNaN(e))throw new TypeError(`The "${t}" prop ${n} must not be NaN, but is NaN.`);if(!Number.isFinite(e))throw new TypeError(`The "${t}" prop ${n} must be finite, but is ${e}.`);if(e%1!==0)throw new TypeError(`The "${t}" prop ${n} must be an integer, but is ${e}.`);if(e<=0)throw new TypeError(`The "${t}" prop ${n} must be positive, but got ${e}.`)}function xu(e,t){const{allowFloats:n,component:r}=t;if(typeof e>"u")throw new Error(`The "durationInFrames" prop ${r} is missing.`);if(typeof e!="number")throw new Error(`The "durationInFrames" prop ${r} must be a number, but you passed a value of type ${typeof e}`);if(e<=0)throw new TypeError(`The "durationInFrames" prop ${r} must be positive, but got ${e}.`);if(!n&&e%1!==0)throw new TypeError(`The "durationInFrames" prop ${r} must be an integer, but got ${e}.`);if(!Number.isFinite(e))throw new TypeError(`The "durationInFrames" prop ${r} must be finite, but got ${e}.`)}function bu(e,t,n){if(typeof e!="number")throw new Error(`"fps" must be a number, but you passed a value of type ${typeof e} ${t}`);if(!Number.isFinite(e))throw new Error(`"fps" must be a finite, but you passed ${e} ${t}`);if(isNaN(e))throw new Error(`"fps" must not be NaN, but got ${e} ${t}`);if(e<=0)throw new TypeError(`"fps" must be positive, but got ${e} ${t}`)}var Su=d.createContext(null),$E=d.createRef(),AE=e=>!!e.calculateMetadata,Cp=e=>{const t=d.useContext(Su),{props:n}=d.useContext(Ep),{compositions:r,canvasContent:o,currentCompositionMetadata:i}=d.useContext(Fi),s=(o==null?void 0:o.type)==="composition"?o.compositionId:null,a=e??s,l=r.find(p=>p.id===a),c=d.useMemo(()=>l?n[l.id]??{}:{},[n,l]),f=ct();return d.useMemo(()=>l?i?{type:"success",metadataSource:null,result:{...i,id:l.id,defaultProps:l.defaultProps??{}}}:AE(l)?!t||!t[l.id]?null:t[l.id]:(xu(l.durationInFrames,{allowFloats:!1,component:`in <Composition id="${l.id}">`}),bu(l.fps,`in <Composition id="${l.id}">`),Vl(l.width,"width",`in <Composition id="${l.id}">`),Vl(l.height,"height",`in <Composition id="${l.id}">`),{type:"success",metadataSource:null,result:{width:l.width,height:l.height,fps:l.fps,id:l.id,durationInFrames:l.durationInFrames,defaultProps:l.defaultProps??{},props:{...l.defaultProps??{},...c??{},...typeof window>"u"||f.isPlayer||!window.remotion_inputProps?{}:_E()??{}},defaultCodec:null,defaultOutName:null,defaultVideoImageFormat:null,defaultPixelFormat:null,defaultProResProfile:null,defaultSampleRate:null}}):null,[l,t,i,c,f.isPlayer])},jw=e=>{const t=e.stack??"";return t.startsWith("Error:")?t:`${e.message}
|
|
55
|
-
${t}`},NE=e=>e instanceof Error?!0:!(e===null||typeof e!="object"||!("stack"in e)||typeof e.stack!="string"||!("message"in e)||typeof e.message!="string");function Ip(e,t){let n;throw NE(t)?(n=t,n.stack||(n.stack=new Error(n.message).stack)):typeof t=="string"?n=Error(t):n=Error("Rendering was cancelled"),e&&(e.remotion_cancelledError=jw(n)),n}function Ws(e){return Ip(typeof window<"u"?window:void 0,e)}var LE=["trace","verbose","info","warn","error"],$m=e=>LE.indexOf(e),ku=(e,t)=>$m(e)<=$m(t),ta=({args:e,logLevel:t,tag:n})=>{const r=[...e];return In().isRendering&&!In().isClientSideRendering&&r.unshift(Symbol.for(`__remotion_level_${t}`)),n&&In().isRendering&&!In().isClientSideRendering&&r.unshift(Symbol.for(`__remotion_tag_${n}`)),r},DE=(e,...t)=>{if(ku(e.logLevel,"verbose"))return console.debug(...ta({args:t,logLevel:"verbose",tag:e.tag}))},zE=(e,...t)=>{if(ku(e.logLevel,"trace"))return console.debug(...ta({args:t,logLevel:"trace",tag:e.tag}))},OE=(e,...t)=>{if(ku(e.logLevel,"info"))return console.log(...ta({args:t,logLevel:"info",tag:e.tag}))},BE=(e,...t)=>{if(ku(e.logLevel,"warn"))return console.warn(...ta({args:t,logLevel:"warn",tag:e.tag}))},WE=(e,...t)=>console.error(...ta({args:t,logLevel:"error",tag:e.tag})),St={trace:zE,verbose:DE,info:OE,warn:BE,error:WE};typeof window<"u"&&(window.remotion_renderReady=!1,window.remotion_delayRenderTimeouts||(window.remotion_delayRenderTimeouts={}),window.remotion_delayRenderHandles=[]);var VE="The delayRender was called:",HE="Retries left: ",UE="- Rendering the frame will be retried.",ZE="handle was cleared after",KE=3e4,Pw=({scope:e,environment:t,label:n,options:r})=>{var s;if(typeof n!="string"&&n!==null)throw new Error("The label parameter of delayRender() must be a string or undefined, got: "+JSON.stringify(n));const o=Math.random();e.remotion_delayRenderHandles.push(o);const i=((s=Error().stack)==null?void 0:s.replace(/^Error/g,""))??"";if(t.isRendering){const a=((r==null?void 0:r.timeoutInMilliseconds)??e.remotion_puppeteerTimeout??KE)-2e3,l=((r==null?void 0:r.retries)??0)-(e.remotion_attempt-1);e.remotion_delayRenderTimeouts[o]={label:n??null,startTime:Date.now(),timeout:setTimeout(()=>{const c=["A delayRender()",n?`"${n}"`:null,`was called but not cleared after ${a}ms. See https://remotion.dev/docs/timeout for help.`,l>0?HE+l:null,l>0?UE:null,VE,i].filter(_i).join(" ");t.isClientSideRendering?e.remotion_cancelledError=jw(Error(c)):Ip(e,Error(c))},a)}}return e.remotion_renderReady=!1,o},YE=(e,t)=>typeof window>"u"?Math.random():Pw({scope:window,environment:In(),label:e??null,options:{}}),Fw=({scope:e,handle:t,environment:n,logLevel:r})=>{if(typeof t>"u")throw new TypeError("The continueRender() method must be called with a parameter that is the return value of delayRender(). No value was passed.");if(typeof t!="number")throw new TypeError("The parameter passed into continueRender() must be the return value of delayRender() which is a number. Got: "+JSON.stringify(t));const o=e.remotion_delayRenderHandles.includes(t),i=e.remotion_delayRenderTimeouts[t];if(o&&n.isRendering&&i){const{label:s,startTime:a,timeout:l}=i;clearTimeout(l);const c=[s?`"${s}"`:"A handle",ZE,`${Date.now()-a}ms`].filter(_i).join(" ");St.verbose({logLevel:r,tag:"delayRender()"},c),delete e.remotion_delayRenderTimeouts[t]}e.remotion_delayRenderHandles=e.remotion_delayRenderHandles.filter(s=>s!==t),e.remotion_delayRenderHandles.length===0&&(e.remotion_renderReady=!0)},GE=e=>{typeof window>"u"||Fw({scope:window,handle:e,environment:In(),logLevel:window.remotion_logLevel??"info"})},Po=d.createContext({logLevel:"info",mountTime:0}),ir=()=>{const{logLevel:e}=d.useContext(Po);if(e===null)throw new Error("useLogLevel must be used within a LogLevelProvider");return e},na=()=>{const{mountTime:e}=d.useContext(Po);if(e===null)throw new Error("useMountTime must be used within a LogLevelProvider");return e},_w=d.createContext(null),Hn=()=>{const e=ct(),t=d.useContext(_w)??(typeof window<"u"?window:void 0),n=ir(),r=d.useCallback((s,a)=>t?Pw({scope:t,environment:e,label:s??null,options:a??{}}):Math.random(),[e,t]),o=d.useCallback(s=>{t&&Fw({scope:t,handle:s,environment:e,logLevel:n})},[e,n,t]),i=d.useCallback(s=>Ip(t??(typeof window<"u"?window:void 0),s),[t]);return{delayRender:r,continueRender:o,cancelRender:i}},Mw=({compProps:e,componentName:t,noSuspense:n})=>{const r=d.useRef(null);return"component"in e&&(r.current=e.component),d.useMemo(()=>{if("component"in e){if(typeof document>"u"||n)return e.component;if(typeof e.component>"u")throw new Error(`A value of \`undefined\` was passed to the \`component\` prop. Check the value you are passing to the <${t}/> component.`);return s=>{const a=r.current;return le.createElement(a,s)}}if("lazyComponent"in e&&typeof e.lazyComponent<"u"){if(typeof e.lazyComponent>"u")throw new Error(`A value of \`undefined\` was passed to the \`lazyComponent\` prop. Check the value you are passing to the <${t}/> component.`);return le.lazy(e.lazyComponent)}throw new Error("You must pass either 'component' or 'lazyComponent'")},[e.lazyComponent])},Eu=()=>{const{canvasContent:e,compositions:t,currentCompositionMetadata:n}=d.useContext(Fi),r=t.find(i=>(e==null?void 0:e.type)==="composition"&&i.id===e.compositionId),o=Cp((r==null?void 0:r.id)??null);return d.useMemo(()=>!o||o.type==="error"||o.type==="loading"||!r?null:{...o.result,defaultProps:r.defaultProps??{},id:r.id,...n??{},component:r.component},[n,o,r])},$w=()=>/^([a-zA-Z0-9-\u4E00-\u9FFF])+$/g,Aw=e=>e.match($w()),XE=e=>{if(!Aw(e))throw new Error(`Composition id can only contain a-z, A-Z, 0-9, CJK characters and -. You passed ${e}`)},qE=`Composition ID must match ${String($w())}`,QE=(e,t,n)=>{if(e){if(typeof e!="object")throw new Error(`"${t}" must be an object, but you passed a value of type ${typeof e}`);if(Array.isArray(e))throw new Error(`"${t}" must be an object, an array was passed ${n?`for composition "${n}"`:""}`)}},JE=()=>{const{continueRender:e,delayRender:t}=Hn();return d.useEffect(()=>{const n=t("Waiting for Root component to unsuspend");return()=>e(n)},[e,t]),null},eC=({width:e,height:t,fps:n,durationInFrames:r,id:o,defaultProps:i,schema:s,...a})=>{const l=d.useContext(Js),{registerComposition:c,unregisterComposition:f}=l,p=Eu(),h=Mw({compProps:a,componentName:"Composition",noSuspense:!1}),m=wu(),x=kp(),v=ct(),k=d.useContext(jo);if(typeof window<"u"&&(window.remotion_seenCompositionIds=Array.from(new Set([...window.remotion_seenCompositionIds??[],o]))),k)throw x?new Error("<Composition> was mounted inside the `component` that was passed to the <Player>. See https://remotion.dev/docs/wrong-composition-mount for help."):new Error("<Composition> mounted inside another composition. See https://remotion.dev/docs/wrong-composition-mount for help.");const{folderName:g,parentName:y}=d.useContext(sf),w=a.stack??null,b="component"in a?a.component:null;d.useEffect(()=>{if(!o)throw new Error("No id for composition passed.");return XE(o),QE(i,"defaultProps",o),c({durationInFrames:r??void 0,fps:n??void 0,height:t??void 0,width:e??void 0,id:o,folderName:g,component:h,defaultProps:lf(i??{}),nonce:m.get(),parentFolderName:y,componentFromProps:b,schema:s??null,calculateMetadata:a.calculateMetadata??null,stack:w}),()=>{f(o)}},[r,n,t,h,o,g,i,e,m,y,b,s,a.calculateMetadata,w,c,f]);const S=Cp(o),{setError:E,clearError:T}=d.useContext(bw),I=d.useCallback(F=>{E(F)},[E]),R=d.useCallback(()=>{T()},[T]);if(v.isStudio&&p&&p.component===h&&p.id===o){const F=h;return S===null||S.type!=="success"&&S.type!=="success-and-refreshing"?null:rf.createPortal(u.jsx(of,{children:u.jsx(yE,{onError:I,onClear:R,children:u.jsx(d.Suspense,{fallback:u.jsx(jE,{}),children:u.jsx(F,{...S.result.props??{}})})})}),uf())}if(v.isRendering&&p&&p.component===h&&p.id===o){const F=h;return S===null||S.type!=="success"&&S.type!=="success-and-refreshing"?null:rf.createPortal(u.jsx(of,{children:u.jsx(d.Suspense,{fallback:u.jsx(JE,{}),children:u.jsx(F,{...S.result.props??{}})})}),uf())}return null},Hl=e=>{const{onlyRenderComposition:t}=d.useContext(Js);return t&&t!==e.id?null:u.jsx(eC,{...e})},Nw=[],Lw=null,tC=()=>Nw,Ut=e=>{Nw.push(e)},nC=e=>{Lw=e},rC=()=>Lw,oC=e=>{const t=le.Children.toArray(e);if(t.length!==1)return null;const n=t[0];return!le.isValidElement(n)||typeof n.type!="function"&&typeof n.type!="object"?null:n.type},cs="4.0.499",iC=()=>{if(typeof globalThis>"u")return;const e=()=>{globalThis.remotion_imported=cs,typeof window<"u"&&(window.remotion_imported=cs)},t=globalThis.remotion_imported||typeof window<"u"&&window.remotion_imported;if(t){if(t===cs)return;if(typeof t=="string"&&t.includes("webcodecs")){e();return}throw new TypeError(`🚨 Multiple versions of Remotion detected: ${[cs,typeof t=="string"?t:"an older version"].filter(_i).join(" and ")}. This will cause things to break in an unexpected way.
|
|
56
|
-
Check that all your Remotion packages are on the same version. If your dependencies depend on Remotion, make them peer dependencies. You can also run \`npx remotion versions\` from your terminal to see which versions are mismatching.`)}e()},wt=d.createContext(null),df={};xw(df,{useTimelineSetFrame:()=>Hw,useTimelinePosition:()=>oo,useTimelineContext:()=>ro,usePlayingState:()=>Uw,usePlaybackRate:()=>Pp,useAbsoluteTimelinePosition:()=>Vw,persistCurrentFrame:()=>Dw,getInitialFrameState:()=>zw,getFrameForComposition:()=>Ow,clampFrameToCompositionRange:()=>Bw});function Am(e){let t=e+1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function sC(e){let t=0,n=0,r=0;for(t=0;t<e.length;t++)n=e.charCodeAt(t),r=(r<<5)-r+n,r|=0;return r}var Fo=(e,t)=>{if(e===null)return Math.random();if(typeof e=="string")return Am(sC(e));if(typeof e=="number")return Am(e*1e10);throw new Error("random() argument must be a number or a string")},Mi=d.createContext({setFrame:()=>{throw new Error("default")},setPlaying:()=>{throw new Error("default")}}),$i=d.createContext(null),Tp=d.createContext(null),Rp=d.createContext(null),aC=({children:e,frameState:t})=>{const[n,r]=d.useState(!1),o=d.useRef(!1),[i,s]=d.useState(1),a=d.useRef([]),[l]=d.useState(()=>String(Fo(null))),[c,f]=d.useState(()=>zw()),p=t??c,{delayRender:h,continueRender:m}=Hn();typeof window<"u"&&d.useLayoutEffect(()=>{window.remotion_setFrame=(g,y,w)=>{window.remotion_attempt=w;const b=h(`Setting the current frame to ${g}`);let S=!0;f(E=>(E[y]??window.remotion_initialFrame)===g?(S=!1,E):{...E,[y]:g}),S?requestAnimationFrame(()=>m(b)):m(b)},window.remotion_isPlayer=!1},[m,h]);const x=d.useMemo(()=>({frame:p,playing:n,imperativePlaying:o,rootId:l,audioAndVideoTags:a}),[p,n,l]),v=d.useMemo(()=>({playbackRate:i,setPlaybackRate:s}),[i]),k=d.useMemo(()=>({setFrame:f,setPlaying:r}),[]);return u.jsx(Rp.Provider,{value:x,children:u.jsx(Tp.Provider,{value:v,children:u.jsx($i.Provider,{value:x,children:u.jsx(Mi.Provider,{value:k,children:e})})})})},jp=()=>"remotion.time-all",Dw=e=>{localStorage.setItem(jp(),JSON.stringify(e))},zw=()=>{const e=localStorage.getItem(jp())??"{}";return JSON.parse(e)},Ow=e=>{const t=localStorage.getItem(jp())??"{}",n=JSON.parse(t);return n[e]!==void 0?Number(n[e]):typeof window>"u"?0:window.remotion_initialFrame??0},Bw=(e,t)=>Math.max(0,Math.min(Math.max(0,t-1),e)),Ww=e=>{const t=Eu(),n=ct();if(!t)return typeof window>"u"?0:window.remotion_initialFrame??0;const r=e.frame[t.id]??(n.isPlayer?0:Ow(t.id));return Bw(r,t.durationInFrames)},ro=()=>{const e=d.useContext($i);if(e===null)throw new Error("TimelineContext is not available. This hook must be used inside a <Player> or the Remotion Studio.");return e},Pp=()=>{const e=d.useContext(Tp);if(e===null)throw new Error("PlaybackRateContext is not available. This hook must be used inside a <Player> or the Remotion Studio.");return e},oo=()=>{const e=ro();return Ww(e)},Vw=()=>{const e=d.useContext(Rp);if(e===null)throw new Error("AbsoluteTimeContext is not available. This hook must be used inside a <Player> or the Remotion Studio.");return Ww(e)},Hw=()=>{const{setFrame:e}=d.useContext(Mi);return e},Uw=()=>{const{playing:e,imperativePlaying:t}=ro(),{setPlaying:n}=d.useContext(Mi);return d.useMemo(()=>[e,n,t],[t,e,n])},Pt=()=>{const e=d.useContext(jo),t=ct();if(!e)throw t.isPlayer?new Error("useCurrentFrame can only be called inside a component that was passed to <Player>. See: https://www.remotion.dev/docs/player/examples"):new Error("useCurrentFrame() can only be called inside a component that was registered as a composition. See https://www.remotion.dev/docs/the-fundamentals#defining-compositions");const n=oo(),r=d.useContext(wt),o=r?r.cumulatedFrom+r.relativeFrom:0;return n-o},Cu=()=>{const e=d.useContext(wt),t=(e==null?void 0:e.width)??null,n=(e==null?void 0:e.height)??null,r=(e==null?void 0:e.durationInFrames)??null,o=Eu();return d.useMemo(()=>{if(!o)return null;const{id:i,durationInFrames:s,fps:a,height:l,width:c,defaultProps:f,props:p,defaultCodec:h,defaultOutName:m,defaultVideoImageFormat:x,defaultPixelFormat:v,defaultProResProfile:k,defaultSampleRate:g}=o;return{id:i,width:t??c,height:n??l,fps:a,durationInFrames:r??s,defaultProps:f,props:p,defaultCodec:h,defaultOutName:m,defaultVideoImageFormat:x,defaultPixelFormat:v,defaultProResProfile:k,defaultSampleRate:g}},[r,n,t,o])},ht=()=>{const e=Cu(),t=d.useContext(jo),n=kp();if(!e)throw typeof window<"u"&&window.remotion_isPlayer||n?new Error(["No video config found. Likely reasons:","- You are probably calling useVideoConfig() from outside the component passed to <Player />. See https://www.remotion.dev/docs/player/examples for how to set up the Player correctly.","- You have multiple versions of Remotion installed which causes the React context to get lost."].join("-")):new Error("No video config found. You are probably calling useVideoConfig() from a component which has not been registered as a <Composition />. See https://www.remotion.dev/docs/the-fundamentals#defining-compositions for more information.");if(!t)throw new Error("Called useVideoConfig() outside a Remotion composition.");return e},ra=({frame:e,children:t,active:n=!0})=>{const r=Pt(),o=ht();if(typeof e>"u")throw new Error("The <Freeze /> component requires a 'frame' prop, but none was passed.");if(typeof e!="number")throw new Error(`The 'frame' prop of <Freeze /> must be a number, but is of type ${typeof e}`);if(Number.isNaN(e))throw new Error("The 'frame' prop of <Freeze /> must be a real number, but it is NaN.");if(!Number.isFinite(e))throw new Error(`The 'frame' prop of <Freeze /> must be a finite number, but it is ${e}.`);const i=d.useMemo(()=>{if(typeof n=="boolean")return n;if(typeof n=="function")return n(r)},[n,r]),s=ro(),a=d.useContext(wt),l=(a==null?void 0:a.relativeFrom)??0,c=d.useMemo(()=>i?{...s,playing:!1,imperativePlaying:{current:!1},frame:{[o.id]:e+l}}:s,[i,s,o.id,e,l]),f=d.useMemo(()=>a?i?{...a,cumulatedFrom:0}:a:null,[a,i]);return u.jsx($i.Provider,{value:c,children:u.jsx(wt.Provider,{value:f,children:t})})},sr={"style.transformOrigin":{type:"transform-origin",step:1,default:"50% 50%",description:"Transform origin"},"style.translate":{type:"translate",step:1,default:"0px 0px",description:"Offset"},"style.scale":{type:"scale",max:100,step:.01,default:1,description:"Scale",defaultKeyframeOutput:"perceptual-scale"},"style.rotate":{type:"rotation-css",step:1,default:"0deg",description:"Rotation"},"style.opacity":{type:"number",min:0,max:1,step:.01,default:1,description:"Opacity",hiddenFromList:!1}},lC=sr,Iu={"style.color":{type:"color",default:void 0,description:"Color"},"style.fontFamily":{type:"font-family",default:void 0,description:"Font family",keyframable:!1},"style.fontSize":{type:"number",default:void 0,min:0,step:1,description:"Font size",hiddenFromList:!1},"style.lineHeight":{type:"number",default:void 0,min:0,step:.05,description:"Line height",hiddenFromList:!1},"style.fontWeight":{type:"enum",default:"400",description:"Font weight",variants:{100:{},200:{},300:{},400:{},500:{},600:{},700:{},800:{},900:{},normal:{},bold:{}}},"style.fontStyle":{type:"enum",default:"normal",description:"Font style",variants:{normal:{},italic:{},oblique:{}}},"style.textAlign":{type:"enum",default:"left",description:"Text align",variants:{left:{},center:{},right:{},justify:{},start:{},end:{}}},"style.letterSpacing":{type:"number",default:void 0,step:.1,description:"Letter spacing",hiddenFromList:!1}},io={"style.borderWidth":{type:"number",default:void 0,min:0,step:1,description:"Border width",hiddenFromList:!1},"style.borderStyle":{type:"enum",default:"none",description:"Border style",variants:{none:{},hidden:{},solid:{},dashed:{},dotted:{},double:{},groove:{},ridge:{},inset:{},outset:{}}},"style.borderColor":{type:"color",default:void 0,description:"Border color"}},so={"style.backgroundColor":{type:"color",default:"transparent",description:"Color"}},Zw={children:{type:"text-content",default:"",description:"Text",keyframable:!1}},Ai={premountFor:{type:"number",default:0,description:"Premount For",min:0,step:1,hiddenFromList:!1,keyframable:!1},postmountFor:{type:"number",default:0,min:0,step:1,hiddenFromList:!0,keyframable:!1}},Kw={...Ai},Yw={...sr,...so,...io,...Kw},Fp={type:"boolean",default:!1,description:"Hidden"},Gw={type:"hidden"},_p={type:"hidden"},uC=e=>({name:_p,...e}),Mp={type:"number",default:void 0,min:1,step:1,hiddenFromList:!0},Xw={type:"number",default:0,step:1,hiddenFromList:!0},qw={type:"number",default:0,min:0,step:1,hiddenFromList:!0},$p={type:"number",default:null,step:1,hiddenFromList:!0},Er={durationInFrames:Mp,from:Xw,trimBefore:qw,freeze:$p,hidden:Fp,name:_p,showInTimeline:Gw},Ii={...Er,layout:{type:"enum",default:"absolute-fill",description:"Layout",variants:{"absolute-fill":Yw,none:{}}}},cC={durationInFrames:Mp,trimBefore:qw,freeze:$p,hidden:Fp,name:_p,showInTimeline:Gw},dC={...cC,layout:Ii.layout},fC={...Ii,layout:{...Ii.layout,default:"none"}},Ni=le.createContext({registerSequence:()=>{throw new Error("SequenceManagerContext not initialized")},unregisterSequence:()=>{throw new Error("SequenceManagerContext not initialized")},sequences:[]}),Tu=le.createContext({current:[]}),hr=e=>`${e.absolutePath}\0${e.nodePath.join(".")}\0${e.sequenceKeys.join(".")}\0${e.effectKeys.map(t=>t.join(".")).join(".")}`,Ru=le.createContext({propStatuses:{}}),ju=le.createContext({current:{}}),Pu=le.createContext({getDragOverrides:()=>{throw new Error("VisualModeDragOverridesContext not initialized")},getEffectDragOverrides:()=>{throw new Error("VisualModeDragOverridesContext not initialized")}}),Qw=le.createContext({setDragOverrides:()=>{throw new Error("VisualModeSettersContext not initialized")},clearDragOverrides:()=>{throw new Error("VisualModeSettersContext not initialized")},setEffectDragOverrides:()=>{throw new Error("VisualModeSettersContext not initialized")},clearEffectDragOverrides:()=>{throw new Error("VisualModeSettersContext not initialized")},setPropStatuses:()=>{throw new Error("VisualModeSettersContext not initialized")}}),Pc=(e,t)=>`${hr(e)}.effects.${t}`,pC=({children:e})=>{const[t,n]=d.useState([]),r=d.useRef(t);r.current=t;const[o,i]=d.useState({}),s=d.useRef(o);s.current=o;const[a,l]=d.useState({}),[c,f]=d.useState({}),p=d.useRef(c);p.current=c;const h=d.useCallback((R,F,A)=>{i(W=>({...W,[hr(R)]:{...W[hr(R)],[F]:A}}))},[]),m=d.useCallback(R=>{i(F=>{const A=hr(R);if(!F[A])return F;const W={...F};return delete W[A],W})},[]),x=d.useCallback((R,F,A,W)=>{l(M=>{const $=Pc(R,F);return{...M,[$]:{...M[$],[A]:W}}})},[]),v=d.useCallback((R,F)=>{l(A=>{const W=Pc(R,F);if(!A[W])return A;const M={...A};return delete M[W],M})},[]),k=d.useCallback((R,F)=>{f(A=>{const W=hr(R),M=A[W],$=F(M);return M===$?A:{...A,[W]:$}})},[]),g=d.useCallback(R=>{n(F=>[...F,R])},[]),y=d.useCallback(R=>{n(F=>F.filter(A=>A.id!==R))},[]),w=d.useMemo(()=>({registerSequence:g,sequences:t,unregisterSequence:y}),[g,t,y]),b=d.useCallback(R=>o[hr(R)]??{},[o]),S=d.useCallback((R,F)=>a[Pc(R,F)]??{},[a]),E=d.useMemo(()=>({propStatuses:c}),[c]),T=d.useMemo(()=>({getDragOverrides:b,getEffectDragOverrides:S}),[b,S]),I=d.useMemo(()=>({setDragOverrides:h,clearDragOverrides:m,setEffectDragOverrides:x,clearEffectDragOverrides:v,setPropStatuses:k}),[h,m,x,v,k]);return u.jsx(Tu.Provider,{value:r,children:u.jsx(Ni.Provider,{value:w,children:u.jsx(ju.Provider,{value:p,children:u.jsx(Ru.Provider,{value:E,children:u.jsx(Pu.Provider,{value:T,children:u.jsx(Qw.Provider,{value:I,children:e})})})})})})},Fu=d.createContext(!1),hC=({children:e})=>u.jsx(Fu.Provider,{value:!0,children:e}),Jw=({children:e})=>u.jsx(Fu.Provider,{value:!1,children:e}),mC=()=>{if(!le.useContext(Fu))throw new Error("This component must be inside a <Series /> component.")},ex=d.createContext({premountFramesRemaining:0}),gC=!1,oa=e=>e??gC,ia=({from:e,durationInFrames:t,premountFor:n,postmountFor:r,style:o,styleWhilePremounted:i,styleWhilePostmounted:s,hideWhilePremounted:a})=>{const l=d.useContext(ex),c=Pt()-l.premountFramesRemaining,f=ct(),{fps:p}=ht(),h=n??0,m=r??0,x=Math.ceil(e+t-1),v=!f.isRendering&&c<e&&c>=e-h,k=!f.isRendering&&c>x&&c<=x+m,g=v||k,y=v?e:k?e+t-1:0,w=d.useMemo(()=>g?{...o,...a==="opacity"?{opacity:0}:{display:"none"},pointerEvents:"none",...v?i:{},...k?s:{}}:o,[g,a,k,v,o,s,i]);return{effectivePremountFor:h,effectivePostmountFor:m,premountingActive:v,postmountingActive:k,isPremountingOrPostmounting:g,freezeFrame:y,premountingStyle:w}},vC=(e,t)=>{for(const n of t){const r=n.split("."),o=[e];let i=e;for(let s=0;s<r.length-1;s++){const a=r[s],l=i[a];if(l==null){i=null;break}i=l,o.push(i)}if(i!==null){delete i[r[r.length-1]];for(let s=o.length-1;s>0;s--){const a=o[s];if(Object.keys(a).length===0){const l=r[s-1];delete o[s-1][l]}else break}}}return e},yC=4,wC=.001,xC=1e-7,bC=10,ds=11,Fa=1/(ds-1),SC=typeof Float32Array=="function";function tx(e,t){return 1-3*t+3*e}function nx(e,t){return 3*t-6*e}function rx(e){return 3*e}function Ul(e,t,n){return((tx(t,n)*e+nx(t,n))*e+rx(t))*e}function ox(e,t,n){return 3*tx(t,n)*e*e+2*nx(t,n)*e+rx(t)}function kC({aX:e,_aA:t,_aB:n,mX1:r,mX2:o}){let i,s,a=0,l=t,c=n;do s=l+(c-l)/2,i=Ul(s,r,o)-e,i>0?c=s:l=s;while(Math.abs(i)>xC&&++a<bC);return s}function EC(e,t,n,r){let o=t;for(let i=0;i<yC;++i){const s=ox(o,n,r);if(s===0)return o;const a=Ul(o,n,r)-e;o-=a/s}return o}function ix(e,t,n,r){if(!(e>=0&&e<=1&&n>=0&&n<=1))throw new Error("bezier x values must be in [0, 1] range");const o=SC?new Float32Array(ds):new Array(ds);if(e!==t||n!==r)for(let s=0;s<ds;++s)o[s]=Ul(s*Fa,e,n);function i(s){let a=0,l=1;const c=ds-1;for(;l!==c&&o[l]<=s;++l)a+=Fa;--l;const f=(s-o[l])/(o[l+1]-o[l]),p=a+f*Fa,h=ox(p,e,n);return h>=wC?EC(s,p,e,n):h===0?p:kC({aX:s,_aA:a,_aB:a+Fa,mX1:e,mX2:n})}return function(s){const a=Math.min(1,Math.max(0,s));return e===t&&n===r?a:a===0?0:a===1?1:Ul(i(a),t,r)}}var CC=e=>Math.round(e*1e6)/1e6,IC=new Set(["deg","rad","grad","turn"]),sx=new Set(["%","cap","ch","cm","cqb","cqh","cqi","cqmax","cqmin","cqw","dvh","dvw","em","ex","ic","in","lh","lvh","lvw","mm","pc","pt","px","q","rem","rlh","svh","svw","vb","vh","vi","vmax","vmin","vw"]),ax=/^([+-]?(?:\d+\.?\d*|\.\d+))([a-zA-Z%]+)?$/,lx=new Set(["left","center","right","top","bottom"]),ai=e=>e==="left"?[{axis:"x",value:{value:0,unit:"%"}}]:e==="right"?[{axis:"x",value:{value:100,unit:"%"}}]:e==="top"?[{axis:"y",value:{value:0,unit:"%"}}]:e==="bottom"?[{axis:"y",value:{value:100,unit:"%"}}]:[{axis:"x",value:{value:50,unit:"%"}},{axis:"y",value:{value:50,unit:"%"}}],qi={value:50,unit:"%"},Nm=e=>String(CC(e)),TC=(e,t)=>{const n=ax.exec(e);if(n===null)throw new TypeError(`Cannot interpolate "${t}" because "${e}" is not a supported scale, translate, or rotate value`);const r=n[2]??null,o=Number(n[1]);if(!Number.isFinite(o))throw new TypeError(`Cannot interpolate "${t}" because "${e}" is not finite`);if(r===null)return{kind:"scale",value:o,unit:null};if(IC.has(r))return{kind:"rotate",value:o,unit:r};if(sx.has(r))return{kind:"translate",value:o,unit:r};throw new TypeError(`Cannot interpolate "${t}" because "${r}" is not a supported translate or rotate unit`)},ux=({component:e,value:t,allowPercentage:n})=>{const r=ax.exec(e);if(r===null)throw new TypeError(`Cannot interpolate "${t}" because "${e}" is not a supported transform-origin ${n?"length-percentage":"z length"}`);const o=r[2]??null,i=Number(r[1]);if(!Number.isFinite(i))throw new TypeError(`Cannot interpolate "${t}" because "${e}" is not finite`);if(o===null||!sx.has(o)||!n&&o==="%")throw new TypeError(`Cannot interpolate "${t}" because "${e}" is not a supported transform-origin ${n?"length-percentage":"z length"}`);return{value:i,unit:o}},Fc=(e,t)=>{const n=e.toLowerCase();return lx.has(n)?{type:"keyword",keyword:n}:{type:"length-percentage",parsed:ux({component:e,value:t,allowPercentage:!0})}},RC=(e,t,n)=>{const r=[];for(const o of ai(e))for(const i of ai(t))o.axis!==i.axis&&r.push(o.axis==="x"?[o.value,i.value]:[i.value,o.value]);if(r.length===0)throw new TypeError(`Cannot interpolate "${n}" because "${e} ${t}" is not a valid transform-origin keyword pair`);return r[0]},jC=(e,t)=>{if(e.length===1){const a=Fc(e[0],t);return a.type==="length-percentage"?[a.parsed,qi]:a.keyword==="top"||a.keyword==="bottom"?[qi,ai(a.keyword)[0].value]:[ai(a.keyword)[0].value,qi]}const n=Fc(e[0],t),r=Fc(e[1],t);if(n.type==="length-percentage"&&r.type==="length-percentage")return[n.parsed,r.parsed];if(n.type==="keyword"&&r.type==="keyword")return RC(n.keyword,r.keyword,t);const o=n.type==="keyword"?n:r.type==="keyword"?r:null,i=n.type==="length-percentage"?n.parsed:r.type==="length-percentage"?r.parsed:null;if(o===null||i===null)throw new Error("Expected a keyword and a length-percentage value");const s=n.type==="keyword";if(o.keyword==="left"||o.keyword==="right"){if(!s)throw new TypeError(`Cannot interpolate "${t}" because horizontal transform-origin keywords must come before a length-percentage value`);return[ai(o.keyword)[0].value,i]}return o.keyword==="top"||o.keyword==="bottom"?[i,ai(o.keyword)[0].value]:s?[qi,i]:[i,qi]},PC=(e,t)=>{const[n,r]=jC(t.slice(0,2),e),o=t[2]===void 0?{value:0,unit:null}:ux({component:t[2],value:e,allowPercentage:!1});return{kind:"translate",values:[n.value,r.value,o.value],units:[n.unit,r.unit,o.unit],dimensions:t[2]===void 0?2:3}},FC=e=>{var o,i,s,a,l,c;if(typeof e=="number"){if(!Number.isFinite(e))throw new Error(`outputRange must contain only finite numbers, but got [${e}]`);return{kind:"scale",values:[e,e,1],units:[null,null,null],dimensions:1}}const t=e.trim().split(/\s+/);if(t.length<1||t.length>3||t[0]==="")throw new TypeError(`String outputRange values must contain 1 to 3 components, but got "${e}"`);if(t.some(f=>lx.has(f.toLowerCase())))return PC(e,t);const n=t.map(f=>TC(f,e)),[{kind:r}]=n;for(const f of n)if(f.kind!==r)throw new TypeError(`Cannot interpolate "${e}" because it mixes ${r} and ${f.kind} values`);if(r==="scale"){const f=n[0].value,p=((o=n[1])==null?void 0:o.value)??f,h=((i=n[2])==null?void 0:i.value)??1;return{kind:r,values:[f,p,h],units:[null,null,null],dimensions:n.length}}return{kind:r,values:[n[0].value,((s=n[1])==null?void 0:s.value)??0,((a=n[2])==null?void 0:a.value)??0],units:[n[0].unit,((l=n[1])==null?void 0:l.unit)??null,((c=n[2])==null?void 0:c.unit)??null],dimensions:n.length}},_C=({kind:e,values:t,units:n,dimensions:r})=>e==="scale"?t.slice(0,r).map(o=>Nm(o)).join(" "):t.slice(0,r).map((o,i)=>`${Nm(o)}${n[i]}`).join(" "),Lm=e=>e===0?0:Math.sign(e)*e*e,MC=e=>e===0?0:Math.sign(e)*Math.sqrt(Math.abs(e));function $C(e,t,n,r){const{extrapolateLeft:o,extrapolateRight:i,easing:s,output:a}=r;let l=e;const[c,f]=t,[p,h]=n;if(l<c){if(o==="identity")return l;if(o==="clamp")l=c;else if(o==="wrap"){const m=f-c;l=((l-c)%m+m)%m+c}}if(l>f){if(i==="identity")return l;if(i==="clamp")l=f;else if(i==="wrap"){const m=f-c;l=((l-c)%m+m)%m+c}}if(p===h)return p;if(l=(l-c)/(f-c),l=s(l),a==="perceptual-scale"){const m=Lm(p),x=Lm(h);l=MC(l*(x-m)+m)}else l=l*(h-p)+p;return l}function AC(e,t){let n;for(n=1;n<t.length-1&&!(t[n]>=e);++n);return n-1}var NC=e=>e,LC=e=>e??"linear",cx=e=>e.remotionShouldExtendRight===!0,Dm=({easing:e,segmentIndex:t})=>e===void 0?NC:typeof e=="function"?e:e[t],zm=({input:e,inputRange:t,outputRange:n,easing:r,extrapolateLeft:o,extrapolateRight:i,output:s})=>$C(e,t,n,{easing:r,extrapolateLeft:o,extrapolateRight:e>t[1]&&i==="clamp"&&cx(r)?"extend":i,output:s}),Ap=({input:e,inputRange:t,outputRange:n,options:r})=>{const o=LC(r==null?void 0:r.output);if(t.length===1)return n[0];const i=r==null?void 0:r.easing;let s="extend";(r==null?void 0:r.extrapolateLeft)!==void 0&&(s=r.extrapolateLeft);let a="extend";(r==null?void 0:r.extrapolateRight)!==void 0&&(a=r.extrapolateRight);const l=(r==null?void 0:r.posterize)===void 0?e:Math.floor(e/r.posterize)*r.posterize,c=AC(l,t),f=Dm({easing:i,segmentIndex:c});let p=zm({input:l,inputRange:[t[c],t[c+1]],outputRange:[n[c],n[c+1]],easing:f,extrapolateLeft:s,extrapolateRight:a,output:o});for(let h=0;h<c;h++){const m=Dm({easing:i,segmentIndex:h});if(!cx(m))continue;const x=t[h+1];if(l<=x)continue;const v=zm({input:l,inputRange:[t[h],x],outputRange:[n[h],n[h+1]],easing:m,extrapolateLeft:s,extrapolateRight:"extend",output:o});p+=v-n[h+1]}return p},DC=({input:e,inputRange:t,outputRange:n,options:r})=>{var c;const o=n.map(FC),i=(c=o[0])==null?void 0:c.kind;if(i===void 0)throw new Error("outputRange must have at least 1 element");for(const f of o)if(f.kind!==i)throw new TypeError(`Cannot interpolate ${i} values with ${f.kind} values`);const s=Math.max(...o.map(f=>f.dimensions)),a=[null,null,null];if(i!=="scale")for(let f=0;f<s;f++){for(const p of o){const h=p.units[f];if(h!==null){if(a[f]===null){a[f]=h;continue}if(a[f]!==h)throw new TypeError(`Cannot interpolate ${i} values with different units on axis ${f+1}: ${a[f]} and ${h}`)}}if(a[f]===null)throw new TypeError(`Cannot interpolate ${i} values because axis ${f+1} has no unit`)}const l=[0,0,0];for(let f=0;f<s;f++)l[f]=Ap({input:e,inputRange:t,outputRange:o.map(p=>p.values[f]),options:r});return _C({kind:i,values:l,units:a,dimensions:s})},zC=e=>{var n;const t=(n=e[0])==null?void 0:n.length;if(t===void 0)throw new Error("outputRange must have at least 1 element");if(t===0)throw new TypeError("outputRange tuples must contain at least 1 number");for(const r of e){if(r.length!==t)throw new TypeError(`outputRange tuples must all have the same length, but got ${t} and ${r.length}`);for(const o of r)if(typeof o!="number"||!Number.isFinite(o))throw new TypeError(`outputRange tuples must contain only finite numbers, but got [${r.join(",")}]`)}return t},OC=({input:e,inputRange:t,outputRange:n,options:r})=>{const o=zC(n);return new Array(o).fill(!0).map((i,s)=>Ap({input:e,inputRange:t,outputRange:n.map(a=>a[s]),options:r}))};function BC(e){for(let t=1;t<e.length;++t)if(!(e[t]>e[t-1]))throw new Error(`inputRange must be strictly monotonically increasing but got [${e.join(",")}]`)}function Om(e,t){if(t.length<1)throw new Error(e+" must have at least 1 element");for(const n of t){if(typeof n!="number")throw new Error(`${e} must contain only numbers`);if(!Number.isFinite(n))throw new Error(`${e} must contain only finite numbers, but got [${t.join(",")}]`)}}function WC(e,t){if(e===void 0||typeof e=="function")return;const n=t-1;if(e.length!==n)throw new Error(`When easing is an array, it must have one entry per segment between keyframes (length inputRange.length - 1 = ${n}), but got length ${e.length}`);for(let r=0;r<e.length;r++)if(typeof e[r]!="function")throw new Error(`easing[${r}] must be a function`)}function VC(e){if(e!==void 0&&(typeof e!="number"||!Number.isFinite(e)||e<=0))throw new Error(`posterize must be a positive finite number, but got ${e}`)}function HC(e){if(!(e===void 0||e==="linear"||e==="perceptual-scale"))throw new Error(`output must be "linear" or "perceptual-scale", but got ${String(e)}`)}function Li(e,t,n,r){if(typeof e>"u")throw new Error("input can not be undefined");if(typeof t>"u")throw new Error("inputRange can not be undefined");if(typeof n>"u")throw new Error("outputRange can not be undefined");if(t.length!==n.length)throw new Error("inputRange ("+t.length+") and outputRange ("+n.length+") must have the same length");if(Om("inputRange",t),BC(t),WC(r==null?void 0:r.easing,t.length),VC(r==null?void 0:r.posterize),HC(r==null?void 0:r.output),typeof e!="number")throw new TypeError("Cannot interpolate an input which is not a number");if(!Array.isArray(n))throw new Error("outputRange must contain only numbers");if(n.some(i=>typeof i=="string")){if(!n.every(i=>typeof i=="string"||typeof i=="number"))throw new TypeError("outputRange must contain only numbers, or supported scale, translate, and rotate strings");return DC({input:e,inputRange:t,outputRange:n,options:r})}if(n.every(i=>Array.isArray(i)))return OC({input:e,inputRange:t,outputRange:n,options:r});if(!n.every(i=>typeof i=="number"))throw new TypeError("outputRange must contain only numbers, numeric tuples, or supported scale, translate, and rotate strings");return Om("outputRange",n),Ap({input:e,inputRange:t,outputRange:n,options:r})}var UC=({allowFloats:e,durationInFrames:t,frame:n})=>{if(typeof n>"u")throw new TypeError('Argument missing for parameter "frame"');if(typeof n!="number")throw new TypeError(`Argument passed for "frame" is not a number: ${n}`);if(!Number.isFinite(n))throw new RangeError(`Frame ${n} is not finite`);if(n<0&&n<-t)throw new RangeError(`Cannot use frame ${n}: Duration of composition is ${t}, therefore the lowest frame that can be rendered is ${-t}`);if(n>t-1)throw new RangeError(`Cannot use frame ${n}: Duration of composition is ${t}, therefore the highest frame that can be rendered is ${t-1}`)},ZC=e=>{if(!(typeof e>"u")){if(typeof e!="number")throw new TypeError(`A "duration" of a spring must be a "number" but is "${typeof e}"`);if(Number.isNaN(e))throw new TypeError('A "duration" of a spring is NaN, which it must not be');if(!Number.isFinite(e))throw new TypeError('A "duration" of a spring must be finite, but is '+e);if(e<=0)throw new TypeError('A "duration" of a spring must be positive, but is '+e)}},KC={damping:10,mass:1,stiffness:100,overshootClamping:!1},_c={};function YC({animation:e,now:t,config:n}){const{toValue:r,lastTimestamp:o,current:i,velocity:s}=e,a=Math.min(t-o,64);if(n.damping<=0)throw new Error("Spring damping must be greater than 0, otherwise the spring() animation will never end, causing an infinite loop.");const l=n.damping,c=n.mass,f=n.stiffness,p=[r,o,i,s,l,c,f,t].join("-");if(_c[p])return _c[p];const h=-s,m=r-i,x=l/(2*Math.sqrt(f*c)),v=Math.sqrt(f/c),k=v*Math.sqrt(1-x**2),g=a/1e3,y=Math.sin(k*g),w=Math.cos(k*g),b=Math.exp(-x*v*g),S=b*(y*((h+x*v*m)/k)+m*w),E=r-S,T=x*v*S-b*(w*(h+x*v*m)-k*m*y),I=Math.exp(-v*g),R=r-I*(m+(h+v*m)*g),F=I*(h*(g*v-1)+g*m*v*v),A={toValue:r,prevPosition:i,lastTimestamp:t,current:x<1?E:R,velocity:x<1?T:F};return _c[p]=A,A}var Mc={};function dx({frame:e,fps:t,config:n={}}){const i=[e,t,n.damping,n.mass,n.overshootClamping,n.stiffness].join("-");if(Mc[i])return Mc[i];let s={lastTimestamp:0,current:0,toValue:1,velocity:0,prevPosition:0};const a=Math.max(0,e),l=a%1;for(let c=0;c<=Math.floor(a);c++){c===Math.floor(a)&&(c+=l);const f=c/t*1e3;s=YC({animation:s,now:f,config:{...KC,...n}})}return Mc[i]=s,s}var $c=new Map;function fx({fps:e,config:t={},threshold:n=.005}){if(typeof n!="number")throw new TypeError(`threshold must be a number, got ${n} of type ${typeof n}`);if(n===0)return 1/0;if(n===1)return 0;if(isNaN(n))throw new TypeError("Threshold is NaN");if(!Number.isFinite(n))throw new TypeError("Threshold is not finite");if(n<0)throw new TypeError("Threshold is below 0");const r=[e,t.damping,t.mass,t.overshootClamping,t.stiffness,n].join("-");if($c.has(r))return $c.get(r);bu(e,"to the measureSpring() function");let o=0,i=0;const s=()=>dx({fps:e,frame:o,config:t});let a=s();const l=()=>Math.abs(a.current-a.toValue);let c=l();for(;c>=n;)o++,a=s(),c=l();i=o;for(let f=0;f<20;f++)o++,a=s(),c=l(),c>=n&&(f=0,i=o+1);return $c.set(r,i),i}function ff({frame:e,fps:t,config:n={},from:r=0,to:o=1,durationInFrames:i,durationRestThreshold:s,delay:a=0,reverse:l=!1}){ZC(i),UC({frame:e,durationInFrames:1/0,allowFloats:!0}),bu(t,"to spring()");const c=l||typeof i<"u",f=c?fx({fps:t,config:n,threshold:s}):void 0,p=c?{get:()=>f}:{get:()=>{throw new Error("did not calculate natural duration, this is an error with Remotion. Please report")}},m=(l?(i??p.get())-e:e)+(l?a:-a),x=i===void 0?m:m/(i/p.get());if(i&&m>i)return o;const v=dx({fps:t,frame:x,config:n}),k=n.overshootClamping?o>=r?Math.min(v.current,o):Math.max(v.current,o):v.current;return r===0&&o===1?k:Li(k,[0,1],[r,o])}var Bm=e=>Math.min(1,Math.max(0,e)),Qi=30;class Zl{static step0(t){return t>0?1:0}static step1(t){return t>=1?1:0}static linear(t){return t}static ease(t){return Zl.bezier(.42,0,1,1)(t)}static quad(t){return t*t}static cubic(t){return t*t*t}static poly(t){return n=>n**t}static sin(t){return 1-Math.cos(t*Math.PI/2)}static circle(t){const n=Bm(t);return 1-Math.sqrt(1-n*n)}static exp(t){return 2**(10*(t-1))}static elastic(t=1){const n=t*Math.PI;return r=>1-Math.cos(r*Math.PI/2)**3*Math.cos(r*n)}static back(t=1.70158){return n=>n*n*((t+1)*n-t)}static spring({allowTail:t=!1,durationRestThreshold:n,...r}={}){return Object.assign(i=>i<=0?0:!t&&i>=1?1:ff(t?{fps:Qi,frame:i*fx({fps:Qi,config:r,threshold:n}),config:r}:{fps:Qi,frame:i*Qi,config:r,durationInFrames:Qi,durationRestThreshold:n}),{remotionShouldExtendRight:t})}static bounce(t){const n=Bm(t);if(n<1/2.75)return 7.5625*n*n;if(n<2/2.75){const o=n-.5454545454545454;return 7.5625*o*o+.75}if(n<2.5/2.75){const o=n-.8181818181818182;return 7.5625*o*o+.9375}const r=n-2.625/2.75;return 7.5625*r*r+.984375}static bezier(t,n,r,o){return ix(t,n,r,o)}static in(t){return t}static out(t){return n=>1-t(1-n)}static inOut(t){return n=>n<.5?t(n*2)/2:1-t((1-n)*2)/2}}var An="[-+]?\\d*\\.?\\d+",_a=An+"%";function Ma(...e){return"\\(\\s*("+e.join(")\\s*,\\s*(")+")\\s*\\)"}var $a="(?:none|[-+]?\\d*\\.?\\d+(?:%|deg|rad|grad|turn)?)";function Ji(e){return new RegExp(e+"\\(\\s*("+$a+")\\s+("+$a+")\\s+("+$a+")(?:\\s*\\/\\s*("+$a+"))?\\s*\\)")}function GC(){const e={rgb:void 0,rgba:void 0,hsl:void 0,hsla:void 0,hex3:void 0,hex4:void 0,hex5:void 0,hex6:void 0,hex8:void 0,oklch:void 0,oklab:void 0,lab:void 0,lch:void 0,hwb:void 0};return e.rgb===void 0&&(e.rgb=new RegExp("rgb"+Ma(An,An,An)),e.rgba=new RegExp("rgba"+Ma(An,An,An,An)),e.hsl=new RegExp("hsl"+Ma(An,_a,_a)),e.hsla=new RegExp("hsla"+Ma(An,_a,_a,An)),e.hex3=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,e.hex4=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,e.hex6=/^#([0-9a-fA-F]{6})$/,e.hex8=/^#([0-9a-fA-F]{8})$/,e.oklch=Ji("oklch"),e.oklab=Ji("oklab"),e.lab=Ji("lab"),e.lch=Ji("lch"),e.hwb=Ji("hwb")),e}function gi(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Wm(e,t,n){const r=n<.5?n*(1+t):n+t-n*t,o=2*n-r,i=gi(o,r,e+1/3),s=gi(o,r,e),a=gi(o,r,e-1/3);return Math.round(i*255)<<24|Math.round(s*255)<<16|Math.round(a*255)<<8}function Do(e){const t=Number.parseInt(e,10);return t<0?0:t>255?255:t}function Vm(e){return(Number.parseFloat(e)%360+360)%360/360}function Hm(e){const t=Number.parseFloat(e);return t<0?0:t>1?255:Math.round(t*255)}function Aa(e){const t=Number.parseFloat(e);return t<0?0:t>100?1:t/100}function xn(e,t){return e==="none"?0:e.endsWith("%")?Number.parseFloat(e)/100*t:Number.parseFloat(e)}function Ac(e){return e==="none"?0:e.endsWith("rad")?Number.parseFloat(e)*180/Math.PI:e.endsWith("grad")?Number.parseFloat(e)*.9:e.endsWith("turn")?Number.parseFloat(e)*360:Number.parseFloat(e)}function es(e){return e===void 0||e==="none"?1:e.endsWith("%")?Math.max(0,Math.min(1,Number.parseFloat(e)/100)):Math.max(0,Math.min(1,Number.parseFloat(e)))}function vi(e){return e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055}function Na(e){return Math.max(0,Math.min(1,e))}function ts(e,t,n,r){const o=Math.round(Na(e)*255),i=Math.round(Na(t)*255),s=Math.round(Na(n)*255),a=Math.round(Na(r)*255);return(o<<24|i<<16|s<<8|a)>>>0}function Um(e,t,n){const r=e+.3963377774*t+.2158037573*n,o=e-.1055613458*t-.0638541728*n,i=e-.0894841775*t-1.291485548*n,s=r*r*r,a=o*o*o,l=i*i*i,c=4.0767416621*s-3.3077115913*a+.2309699292*l,f=-1.2684380046*s+2.6097574011*a-.3413193965*l,p=-.0041960863*s-.7034186147*a+1.707614701*l;return[vi(c),vi(f),vi(p)]}function Zm(e,t,n){const r=.008856451679035631,o=24389/27,i=.95047,s=1,a=1.08883,l=(e+16)/116,c=t/500+l,f=l-n/200,p=c*c*c,h=f*f*f,m=p>r?p:(116*c-16)/o,x=e>o*r?((e+16)/116)**3:e/o,v=h>r?h:(116*f-16)/o,k=m*i,g=x*s,y=v*a,w=3.2404542*k-1.5371385*g-.4985314*y,b=-.969266*k+1.8760108*g+.041556*y,S=.0556434*k-.2040259*g+1.0572252*y;return[vi(w),vi(b),vi(S)]}function XC(e,t,n){if(t+n>=1){const c=t/(t+n);return[c,c,c]}const r=1,o=0,i=gi(o,r,e+1/3),s=gi(o,r,e),a=gi(o,r,e-1/3),l=1-t-n;return[i*l+t,s*l+t,a*l+t]}var Km={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199};function qC(e){const t=GC();let n;if(t.hex6&&(n=t.hex6.exec(e)))return Number.parseInt(n[1]+"ff",16)>>>0;if(Km[e]!==void 0)return Km[e];if(t.rgb&&(n=t.rgb.exec(e)))return(Do(n[1])<<24|Do(n[2])<<16|Do(n[3])<<8|255)>>>0;if(t.rgba&&(n=t.rgba.exec(e)))return(Do(n[1])<<24|Do(n[2])<<16|Do(n[3])<<8|Hm(n[4]))>>>0;if(t.hex3&&(n=t.hex3.exec(e)))return Number.parseInt(n[1]+n[1]+n[2]+n[2]+n[3]+n[3]+"ff",16)>>>0;if(t.hex8&&(n=t.hex8.exec(e)))return Number.parseInt(n[1],16)>>>0;if(t.hex4&&(n=t.hex4.exec(e)))return Number.parseInt(n[1]+n[1]+n[2]+n[2]+n[3]+n[3]+n[4]+n[4],16)>>>0;if(t.hsl&&(n=t.hsl.exec(e)))return(Wm(Vm(n[1]),Aa(n[2]),Aa(n[3]))|255)>>>0;if(t.hsla&&(n=t.hsla.exec(e)))return(Wm(Vm(n[1]),Aa(n[2]),Aa(n[3]))|Hm(n[4]))>>>0;if(t.oklch&&(n=t.oklch.exec(e))){const r=xn(n[1],1),o=xn(n[2],.4),i=Ac(n[3]),s=es(n[4]),a=i*Math.PI/180,[l,c,f]=Um(r,o*Math.cos(a),o*Math.sin(a));return ts(l,c,f,s)}if(t.oklab&&(n=t.oklab.exec(e))){const r=xn(n[1],1),o=xn(n[2],.4),i=xn(n[3],.4),s=es(n[4]),[a,l,c]=Um(r,o,i);return ts(a,l,c,s)}if(t.lab&&(n=t.lab.exec(e))){const r=xn(n[1],100),o=xn(n[2],125),i=xn(n[3],125),s=es(n[4]),[a,l,c]=Zm(r,o,i);return ts(a,l,c,s)}if(t.lch&&(n=t.lch.exec(e))){const r=xn(n[1],100),o=xn(n[2],150),i=Ac(n[3]),s=es(n[4]),a=i*Math.PI/180,[l,c,f]=Zm(r,o*Math.cos(a),o*Math.sin(a));return ts(l,c,f,s)}if(t.hwb&&(n=t.hwb.exec(e))){const r=Ac(n[1]),o=xn(n[2],1),i=xn(n[3],1),s=es(n[4]),[a,l,c]=XC(r/360,o,i);return ts(a,l,c,s)}throw new Error(`invalid color string ${e} provided`)}var Ym=e=>(e>>24&255)/255,QC=e=>e>>16&255,JC=e=>e>>8&255,e2=e=>e&255,t2=(e,t,n,r)=>`rgba(${e}, ${t}, ${n}, ${r})`;function n2(e){const t=qC(e);return(t<<24|t>>>8)>>>0}var r2=(e,t,n,r)=>{const[o,i,s,a]=[QC,JC,e2,Ym].map(l=>{const c=Li(e,t,n.map(f=>l(f)),{easing:r==null?void 0:r.easing,extrapolateLeft:"clamp",extrapolateRight:"clamp",posterize:r==null?void 0:r.posterize});return l===Ym?Number(c.toFixed(3)):Math.round(c)});return t2(o,i,s,a)},o2=(e,t,n,r)=>{if(typeof e>"u")throw new TypeError("input can not be undefined");if(typeof t>"u")throw new TypeError("inputRange can not be undefined");if(typeof n>"u")throw new TypeError("outputRange can not be undefined");if(t.length!==n.length)throw new TypeError("inputRange ("+t.length+" values provided) and outputRange ("+n.length+" values provided) must have the same length");const o=n.map(i=>n2(i));return r2(e,t,o,r)},Gm=({easing:e,forceSpringAllowTail:t})=>{switch(e.type){case"linear":return Zl.linear;case"spring":return Zl.spring({allowTail:t??e.allowTail??void 0,damping:e.damping,durationRestThreshold:e.durationRestThreshold??void 0,mass:e.mass,overshootClamping:e.overshootClamping,stiffness:e.stiffness});case"bezier":return ix(e.x1,e.y1,e.x2,e.y2);default:throw new TypeError(`Unsupported easing: ${JSON.stringify(e)}`)}},sa=({frame:e,forceSpringAllowTail:t,status:n})=>{const{keyframes:r,easing:o,clamping:i,interpolationFunction:s}=n;if(r.length===0)return null;const a=[...r].sort((f,p)=>f.frame-p.frame),l=a.map(f=>f.frame),c=a.map(f=>f.value);if(s==="interpolateColors"){if(!c.every(f=>typeof f=="string"))return null;if(r.length===1)return c[0];try{return o2(e,l,c,{easing:o.map(f=>Gm({easing:f,forceSpringAllowTail:t})),posterize:n.posterize})}catch{return null}}if(s!=="interpolate")return null;try{return Li(e,l,c,{easing:o.map(f=>Gm({easing:f,forceSpringAllowTail:t})),extrapolateLeft:i.left,extrapolateRight:i.right,output:n.output,posterize:n.posterize})}catch{return null}},_u=({dragOverrideValue:e,frame:t})=>{if(e===void 0)return{type:"none"};if(e.type==="static")return{type:"resolved",value:e.value};if(t===null)return{type:"none"};const n=sa({forceSpringAllowTail:null,frame:t,status:e.status});return n===null?{type:"none"}:{type:"resolved",value:n}},px=({propStatus:e,dragOverrideValue:t,defaultValue:n,frame:r=null,shouldResortToDefaultValueIfUndefined:o=!1})=>{const i=_u({dragOverrideValue:t,frame:r});return i.type==="resolved"&&i.value!==void 0?i.value:e.status==="keyframed"?r!==null?sa({forceSpringAllowTail:null,frame:r,status:e}):o?n:void 0:e.codeValue===void 0&&o?n:e.codeValue},Np=d.createContext({overrideIdToNodePathMappings:{}}),i2=d.createContext({setOverrideIdToNodePath:()=>{throw new Error("OverrideIdsToNodePathsSettersContext not initialized")}}),s2=({descriptor:e,propStatusOverrides:t,dragOverrides:n,frame:r})=>{if(!t&&!n)return{params:e.params,effectKey:e.effectKey};const o={...e.params};if(t)for(const[i,s]of Object.entries(t))s!==void 0&&(o[i]=s);if(n)for(const[i,s]of Object.entries(n)){const a=_u({dragOverrideValue:s,frame:r});a.type==="resolved"&&(o[i]=a.value)}return{params:o,effectKey:e.definition.calculateKey(o)}},a2=(e,t)=>{if(!e)return null;const n={};let r=!1;for(const[o,i]of Object.entries(e)){if(i.status==="static"){n[o]=i.codeValue,r=!0;continue}if(i.status==="keyframed"){const s=sa({forceSpringAllowTail:null,frame:t,status:i});s!==null&&(n[o]=s,r=!0)}}return r?n:null},aa=e=>{const t=d.useRef(null),n=e.map(i=>i.definition),r=t.current;return r!==null&&r.length===n.length&&r.every((i,s)=>i===n[s])?r:(t.current=n,n)},hx=({propStatuses:e,nodePath:t,effectIndex:n})=>{const r=e[hr(t)];if(!r)return{type:"cannot-update-sequence",reason:"not-found"};if(!r.canUpdate)return{type:"cannot-update-sequence",reason:r.reason};const o=r.effects.find(i=>i.effectIndex===n);return o?o.canUpdate?{type:"can-update-effect",props:o.props}:{type:"cannot-update-effect",reason:o.reason}:{type:"cannot-update-effect",reason:"not-found"}},mx=(e,t)=>{const n=e[hr(t)];if(n&&n.canUpdate)return n.props},la=({effects:e,overrideId:t})=>{const n=d.useRef(null),{propStatuses:r}=d.useContext(Ru),{getEffectDragOverrides:o}=d.useContext(Pu),i=Pt(),{overrideIdToNodePathMappings:s}=d.useContext(Np),a=n.current,l=t?s[t]??null:null,c=e.map((h,m)=>{if(l===null)return{descriptor:h,params:h.params,effectKey:h.effectKey};const x=hx({propStatuses:r,nodePath:l,effectIndex:m}),v=x.type==="can-update-effect"?a2(x.props,i):null,k=o(l,m),g=Object.keys(k).length===0?null:k,{params:y,effectKey:w}=s2({descriptor:h,propStatusOverrides:v,dragOverrides:g,frame:i});return{descriptor:h,params:y,effectKey:w}});if(a!==null&&a.length===c.length&&a.every((h,m)=>h.definition===c[m].descriptor.definition&&h.effectKey===c[m].effectKey))return a;const p=c.map(({descriptor:h,params:m,effectKey:x})=>({definition:h.definition,effectKey:x,params:m,memoized:!0}));return n.current=p,p},Lp=(e,t)=>{const n={};for(const r of Object.keys(e)){const o=e[r];if(o.type!=="hidden")if(o.type==="enum"){n[r]=o;const i=t(r)??o.default,s=o.variants[i];s&&Object.assign(n,Lp(s,t))}else n[r]=o}return n},Dp=e=>{const t={},n=(r,o)=>{r in t||(t[r]=o)};for(const r of Object.keys(e)){const o=e[r];if(n(r,o),o.type==="enum")for(const i of Object.values(o.variants)){const s=Dp(i);for(const a of Object.keys(s))n(a,s[a])}}return t},gx=({schema:e,key:t,value:n})=>{const r=e[t];if(!r)throw new Error("Key "+JSON.stringify(t)+" not found in schema");if(typeof n!="string")throw new Error("Value must be a string, but is "+JSON.stringify(n));if(r.type!=="enum")throw new Error("Key "+JSON.stringify(t)+" is not an enum");if(!r.variants[n])throw new Error("Value for "+JSON.stringify(t)+" must be one of "+Object.keys(r.variants).map(a=>JSON.stringify(a)).join(", ")+", got "+JSON.stringify(n));const i=Object.keys(r.variants).filter(a=>a!==n),s=new Set;for(const a of i){const l=r.variants[a],c=Object.keys(l);for(const f of c)s.add(f)}return[...s]},Xm={type:"linear"},l2=({insertedKeyframeIndex:e,easingLength:t,keyframeCount:n})=>!(e>0&&e<n-1)||t===0?null:Math.min(e-1,t-1),u2=e=>({type:"static",value:e}),c2=({status:e,frame:t,value:n})=>{const r=e.keyframes.findIndex(s=>s.frame===t),o=r===-1?[...e.keyframes,{frame:t,value:n}].sort((s,a)=>s.frame-a.frame):e.keyframes.map((s,a)=>a===r?{frame:t,value:n}:s),i=[...e.easing];if(r===-1){const s=o.findIndex(c=>c.frame===t),a=l2({insertedKeyframeIndex:s,easingLength:i.length,keyframeCount:o.length}),l=a===null?Xm:i[a];i.splice(s,0,l)}for(;i.length<o.length-1;)i.push(Xm);return i.length>o.length-1&&(i.length=o.length-1),{type:"keyframed",status:{...e,keyframes:o,easing:i}}},d2=e=>{if((e==null?void 0:e.type)==="static")return e.value},f2=e=>e!==null&&e.status==="keyframed",vx=(e,t)=>{if(t in e)return e[t];for(const n of Object.values(e))if(n.type==="enum")for(const r of Object.values(n.variants)){const o=vx(r,t);if(o)return o}},yx=({schema:e,currentValue:t,overrideValues:n,propStatus:r,frame:o})=>{var a;const i={},s=new Set;for(const l of Object.keys(t)){const c=(r==null?void 0:r[l])??null,f=vx(e,l);if((f==null?void 0:f.type)==="hidden")continue;let p;if(c===null)p=t[l];else if(f2(c))if((f==null?void 0:f.type)==="array"||(f==null?void 0:f.keyframable)===!1)p=t[l];else{const h=_u({dragOverrideValue:n[l],frame:o});h.type==="resolved"?p=h.value:o!==null?p=sa({forceSpringAllowTail:null,frame:o,status:c})??t[l]:p=t[l]}else c.status==="computed"?p=t[l]:p=px({propStatus:c,dragOverrideValue:n[l],defaultValue:f==null?void 0:f.default,frame:o,shouldResortToDefaultValueIfUndefined:!1});(f==null?void 0:f.type)==="asset"&&typeof p=="string"&&p.startsWith(Bs)&&(p=`${window.remotion_staticBase}/${p.slice(Bs.length)}`),p===void 0&&s.add(l),i[l]=p}for(const l of Object.keys(n))if(((a=e[l])==null?void 0:a.type)==="enum"){const c=gx({schema:e,key:l,value:i[l]});for(const f of c)s.add(f)}return{merged:i,propsToDelete:s}},wx=(e,t)=>{const n=t.split(".");let r=e;for(const o of n){if(r==null||typeof r!="object")return;r=r[o]}return r},xx=({flatSchema:e,key:t,props:n})=>{var o;const r=wx(n,t);if(!(((o=e[t])==null?void 0:o.type)==="text-content"&&typeof r!="string"))return r},p2=(e,t,n)=>{const r={};for(const o of t)r[o]=n?xx({flatSchema:n,key:o,props:e}):wx(e,o);return r},h2=(e,t)=>Object.keys(Lp(e,n=>t[n])),m2=({flatSchema:e,props:t,valuesDotNotation:n,schemaKeys:r,propsToDelete:o})=>{var a;const i={...t};for(const l of r){const c=n[l];if(((a=e[l])==null?void 0:a.type)==="text-content"&&c===void 0)continue;const f=l.split(".");if(f.length===1){i[l]=c;continue}let p=i;for(let h=0;h<f.length-1;h++){const m=f[h];typeof p[m]=="object"&&p[m]!==null?p[m]={...p[m]}:p[m]={},p=p[m]}p[f[f.length-1]]=c}const s=new Set([...o].filter(l=>{var c;return!(((c=e[l])==null?void 0:c.type)==="text-content"&&n[l]===void 0)}));return vC(i,s),i},qm={},Cr=({Component:e,componentName:t,componentIdentity:n,schema:r,supportsEffects:o})=>{const i=uC(r),s=Dp(i),a=Object.keys(s),l=d.forwardRef((c,f)=>{const p=ct();if(!p.isStudio||p.isReadOnlyStudio||p.isRendering)return le.createElement(e,{...c,controls:null,ref:f});const{propStatuses:h}=d.useContext(Ru),{getDragOverrides:m}=d.useContext(Pu),x=d.useContext(Np),v=Pt();if(c.controls)return le.createElement(e,{...c,ref:f});const[k]=d.useState(()=>{const{stack:R}=c;if(!R)return String(Math.random());const F=qm[R];if(F)return F;const A=String(Math.random());return qm[R]=A,A}),g=x.overrideIdToNodePathMappings[k]??null,y=a.map(R=>xx({flatSchema:s,key:R,props:c})),w=d.useMemo(()=>p2(c,a,s),y),b=d.useMemo(()=>({schema:i,currentRuntimeValueDotNotation:w,overrideId:k,supportsEffects:o,componentIdentity:n,componentName:t}),[w,k]),{merged:S,propsToDelete:E}=d.useMemo(()=>yx({schema:i,currentValue:w,overrideValues:g===null?{}:m(g),propStatus:g===null?void 0:mx(h,g),frame:v}),[w,m,g,h,v]),T=h2(i,S),I=m2({flatSchema:s,props:c,valuesDotNotation:S,schemaKeys:T,propsToDelete:E});return le.createElement(e,{...I,controls:b,ref:f})});return l.displayName=`withInteractivitySchema(${e.displayName||e.name||"Component"})`,l},Nc=[],g2=({from:e=0,trimBefore:t=0,freeze:n,durationInFrames:r=1/0,children:o,name:i,height:s,width:a,showInTimeline:l=!0,hidden:c=!1,controls:f,_remotionInternalEffects:p,_remotionInternalLoopDisplay:h,_remotionInternalStack:m,_remotionInternalDocumentationLink:x,_remotionInternalSingleChildComponent:v,_remotionInternalPremountDisplay:k,_remotionInternalPostmountDisplay:g,_remotionInternalIsMedia:y,outlineRef:w,...b},S)=>{const{layout:E="absolute-fill"}=b,[T]=d.useState(()=>String(Math.random())),I=d.useContext(wt),{rootId:R}=ro(),F=I?I.cumulatedFrom+I.relativeFrom:0,A=wu();if(E!=="absolute-fill"&&E!=="none")throw new TypeError(`The layout prop of <Sequence /> expects either "absolute-fill" or "none", but you passed: ${E}`);if(E==="none"&&typeof b.style<"u")throw new TypeError('If layout="none", you may not pass a style. Passed: '+JSON.stringify(b.style));if(typeof r!="number")throw new TypeError(`You passed to durationInFrames an argument of type ${typeof r}, but it must be a number.`);if(r<=0)throw new TypeError(`durationInFrames must be positive, but got ${r}`);if(typeof e!="number")throw new TypeError(`You passed to the "from" props of your <Sequence> an argument of type ${typeof e}, but it must be a number.`);if(!Number.isFinite(e))throw new TypeError(`The "from" prop of a sequence must be finite, but got ${e}.`);if(typeof t!="number")throw new TypeError(`You passed to the "trimBefore" prop of your <Sequence> an argument of type ${typeof t}, but it must be a number.`);if(t<0)throw new TypeError(`The "trimBefore" prop of <Sequence /> must be greater than or equal to 0, but got ${t}.`);if(Number.isNaN(t))throw new TypeError('The "trimBefore" prop of <Sequence /> must be a real number, but it is NaN.');if(!Number.isFinite(t))throw new TypeError(`The "trimBefore" prop of <Sequence /> must be finite, but it is ${t}.`);if(typeof n<"u"&&n!==null){if(typeof n!="number")throw new TypeError(`The "freeze" prop of <Sequence /> must be a number, but is of type ${typeof n}.`);if(Number.isNaN(n))throw new TypeError('The "freeze" prop of <Sequence /> must be a real number, but it is NaN.');if(!Number.isFinite(n))throw new TypeError(`The "freeze" prop of <Sequence /> must be finite, but it is ${n}.`)}const W=oo(),M=ht(),$=e-t,V=((I==null?void 0:I.absoluteFrom)??0)+$,D=I?Math.min(I.durationInFrames-$,r):r,L=Math.max(0,Math.min(M.durationInFrames-e,D)),{registerSequence:j,unregisterSequence:C}=d.useContext(Ni),P=d.useRef(null),N=b.layout==="none"?w??null:w??P,B=d.useMemo(()=>(I==null?void 0:I.premounting)||!!b._remotionInternalIsPremounting,[b._remotionInternalIsPremounting,I==null?void 0:I.premounting]),z=d.useMemo(()=>(I==null?void 0:I.postmounting)||!!b._remotionInternalIsPostmounting,[b._remotionInternalIsPostmounting,I==null?void 0:I.postmounting]),Z=F+$,H=I?I.cumulatedFrom+I.relativeFrom:0,G=I?H-I.cumulatedNegativeFrom:0,O=Math.max(0,G,Z),X=Z-O,ae=d.useMemo(()=>({absoluteFrom:V,cumulatedFrom:F,relativeFrom:$,cumulatedNegativeFrom:X,durationInFrames:L,parentFrom:(I==null?void 0:I.relativeFrom)??0,id:T,height:s??(I==null?void 0:I.height)??null,width:a??(I==null?void 0:I.width)??null,premounting:B,postmounting:z,premountDisplay:k??null,postmountDisplay:g??null}),[F,V,$,L,I,T,s,a,B,z,k,g,X]),oe=d.useMemo(()=>i??"",[i]),Y=x??"https://www.remotion.dev/docs/sequence",q=ct(),xe=d.useContext(Fu),Se=(b==null?void 0:b.stack)??null,de=d.useRef(null);de.current=m??Se;const K=typeof n=="number"?n:null,ee=t===0?null:t,ue=(I==null?void 0:I.cumulatedNegativeFrom)??0,se=y&&y.type!=="image"?y.data.startMediaFrom+ue-X:null,Re=y&&y.type!=="image"?y.data.startMediaFrom+ue:null,Ie=y&&y.type!=="image"&&Re!==null?K===null?null:Re+(h?K%h.durationInFrames:K)*y.data.playbackRate:null;d.useEffect(()=>{if(q.isStudio)return y?(y.type==="image"?j({type:"image",controls:f??null,effects:p??Nc,displayName:oe,documentationLink:Y,duration:L,from:e,trimBefore:ee,id:T,loopDisplay:h,nonce:A.get(),parent:(I==null?void 0:I.id)??null,postmountDisplay:g??null,premountDisplay:k??null,rootId:R,showInTimeline:l,src:y.src,getStack:()=>de.current,refForOutline:N??null,isInsideSeries:xe,frozenFrame:K,singleChildComponent:v??null}):j({type:y.type,controls:f??null,effects:p??Nc,displayName:oe,documentationLink:Y,doesVolumeChange:y.data.doesVolumeChange,duration:L,from:e,trimBefore:ee,id:T,loopDisplay:h,nonce:A.get(),parent:(I==null?void 0:I.id)??null,playbackRate:y.data.playbackRate,postmountDisplay:g??null,premountDisplay:k??null,rootId:R,showInTimeline:l,src:y.data.src,getStack:()=>de.current,startMediaFrom:se??y.data.startMediaFrom,mediaFrameAtSequenceZero:Re,volume:y.data.volumes,refForOutline:N??null,isInsideSeries:xe,frozenFrame:K,frozenMediaFrame:Ie,singleChildComponent:v??null}),()=>{C(T)}):(j({from:e,trimBefore:ee,duration:L,id:T,displayName:oe,documentationLink:Y,parent:(I==null?void 0:I.id)??null,type:"sequence",rootId:R,showInTimeline:l,nonce:A.get(),loopDisplay:h,getStack:()=>de.current,premountDisplay:k??null,postmountDisplay:g??null,controls:f??null,effects:p??Nc,refForOutline:N??null,isInsideSeries:xe,frozenFrame:K,singleChildComponent:v??null}),()=>{C(T)})},[r,T,i,j,oe,C,I==null?void 0:I.id,L,R,e,t,ee,l,A,h,k,g,q.isStudio,f,p,y,Y,N,xe,K,se,Re,Ie,v]);const ze=Math.ceil(F+e+r-1),Je=W<F+e||W>ze?null:o,ke=Je===null||typeof n>"u"||n===null?Je:u.jsx(ra,{frame:n,children:Je}),Ee=b.layout==="none"?void 0:b.style,je=d.useCallback(Le=>{P.current=Le,typeof S=="function"?S(Le):S&&(S.current=Le)},[S]),_e=d.useMemo(()=>({flexDirection:void 0,...a?{width:a}:{},...s?{height:s}:{},...Ee??{}}),[s,Ee,a]);if(S!==null&&E==="none")throw new TypeError('It is not supported to pass both a `ref` and `layout="none"` to <Sequence />.');return c?null:u.jsx(wt.Provider,{value:ae,children:ke===null?null:b.layout==="none"?ke:u.jsx(Vn,{ref:je,style:_e,className:b.className,children:ke})})},v2=d.forwardRef(g2),y2=(e,t)=>{if(e.layout==="none")throw new Error('`<Sequence>` with `premountFor` and `postmountFor` props does not support layout="none"');const{style:n,from:r=0,durationInFrames:o=1/0,premountFor:i=0,postmountFor:s=0,styleWhilePremounted:a,styleWhilePostmounted:l,...c}=e,{freezeFrame:f,isPremountingOrPostmounting:p,postmountingActive:h,premountingActive:m,premountingStyle:x}=ia({from:r,durationInFrames:o,premountFor:i,postmountFor:s,style:n??null,styleWhilePremounted:a??null,styleWhilePostmounted:l??null,hideWhilePremounted:"opacity"});return u.jsx(ra,{frame:f,active:p,children:u.jsx(Mu,{ref:t,from:r,durationInFrames:o,style:x??void 0,_remotionInternalPremountDisplay:i,_remotionInternalPostmountDisplay:s,_remotionInternalIsPremounting:m,_remotionInternalIsPostmounting:h,...c})})},w2=d.forwardRef(y2),x2=(e,t)=>{const n=ct(),{fps:r}=ht();if(e.layout!=="none"&&!n.isRendering){const o=e.premountFor;if(o||e.postmountFor)return u.jsx(w2,{ref:t,...e,premountFor:o})}return u.jsx(v2,{...e,ref:t})},Mu=d.forwardRef(x2),bx=Mu,Ft=Cr({Component:Mu,componentName:"<Sequence>",componentIdentity:"dev.remotion.remotion.Sequence",schema:Ii,supportsEffects:!1});Cr({Component:Mu,componentName:"<Sequence>",componentIdentity:null,schema:dC,supportsEffects:!1});var Sx=(e,t,n)=>{switch(e){case"fill":return[0,0,t.width,t.height,0,0,n.width,n.height];case"contain":{const r=Math.min(n.width/t.width,n.height/t.height),o=(n.width-t.width*r)/2,i=(n.height-t.height*r)/2;return[0,0,t.width,t.height,o,i,t.width*r,t.height*r]}case"cover":{const r=Math.max(n.width/t.width,n.height/t.height),o=(n.width-t.width*r)/2,i=(n.height-t.height*r)/2;return[0,0,t.width,t.height,o,i,t.width*r,t.height*r]}default:throw new Error("Unknown fit: "+e)}},b2="https://remotion.dev/docs/troubleshooting/webgl2-context",kx=(e,t)=>`Failed to acquire ${e} context for ${t}. Pass --gl=angle when using the CLI, set chromiumOptions: { gl: "angle" } when using SSR APIs, or set "OpenGL render backend" to "angle" in the Advanced section when rendering in the Studio. See ${b2}`,S2=e=>new Error(kx("WebGL",e)),Ex=e=>new Error(kx("WebGL2",e));class k2{constructor(t,n){Ae(this,"width");Ae(this,"height");Ae(this,"pairs",new Map);Ae(this,"lostContexts",new Set);this.width=t,this.height=n}getPair(t){const n=this.pairs.get(t);if(n)return n;const r=[this.allocateCanvas(t),this.allocateCanvas(t)];return this.pairs.set(t,r),r}assertContextNotLost(t){if(this.lostContexts.has(t))throw new Error("WebGL context was lost during canvas effect rendering. This typically happens in headless or memory-constrained environments (e.g. Remotion Lambda). Try reducing concurrency or increasing the Lambda function memory.")}allocateCanvas(t){const n=document.createElement("canvas");switch(n.width=this.width,n.height=this.height,t){case"2d":{if(!n.getContext("2d",{colorSpace:"srgb"}))throw new Error("Failed to acquire 2D context for canvas effect");return n}case"webgl2":{const r=n.getContext("webgl2",{premultipliedAlpha:!0,alpha:!0,preserveDrawingBuffer:!0});if(!r)throw Ex("canvas effect");return n.addEventListener("webglcontextlost",o=>{o.preventDefault(),this.lostContexts.add(n)}),n.addEventListener("webglcontextrestored",()=>{this.lostContexts.delete(n)}),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),n}case"webgpu":{if(typeof navigator>"u"||!("gpu"in navigator))throw new Error("WebGPU is not available in this environment for canvas effect");return n}default:{const r=t;throw new Error(`Unknown effect backend: ${r}`)}}}}var E2=e=>{const t=[];let n=[],r=null;for(const o of e){const{backend:i}=o.definition;r===null||i===r?(n.push(o),r=i):(t.push({backend:r,effects:n}),n=[o],r=i)}return r!==null&&n.length>0&&t.push({backend:r,effects:n}),t},La=null,C2=()=>La||(La=(async()=>{if(typeof navigator>"u"||!("gpu"in navigator))throw new Error("WebGPU is not available in this environment");const{gpu:e}=navigator,t=await e.requestAdapter();if(!t)throw new Error("No WebGPU adapter available");return t.requestDevice()})(),La),Cx=(e,t)=>({pool:new k2(e,t),setupCache:new WeakMap,cleanupRegistry:[],currentRunId:0}),pf=e=>{e.currentRunId++;for(const t of e.cleanupRegistry)t.definition.cleanup(t.state)},I2=(e,t,n)=>{const r=t;let o=e.setupCache.get(r);if(o||(o=new WeakMap,e.setupCache.set(r,o)),o.has(n))return o.get(n);const i=t.setup(n);return o.set(n,i),e.cleanupRegistry.push({definition:r,state:i}),i},ua=async({state:e,source:t,effects:n,output:r,width:o,height:i})=>{const s=++e.currentRunId,a=()=>e.currentRunId!==s,l=n.filter(k=>!k.params.disabled),c=E2(l);let f=t,p=null;if(c.length===0){if(t===r)return!0;const k=r.getContext("2d");if(!k)throw new Error("Failed to acquire 2D context for output canvas");return k.clearRect(0,0,o,i),k.drawImage(f,0,0,o,i),!0}let h=!1;for(const k of c)if(k.backend==="webgpu"){h=!0;break}const m=h?await C2():null;if(a())return!1;let x=!0;for(let k=0;k<c.length;k++){const g=c[k],[y,w]=e.pool.getPair(g.backend);let b=y;for(const E of g.effects){const T=E.definition,I=I2(e,T,b);T.apply({source:f,target:b,state:I,params:E.params,width:o,height:i,gpuDevice:m,flipSourceY:g.backend==="webgl2"?x:!1}),g.backend==="webgl2"&&(x=!0,e.pool.assertContextNotLost(b)),f=b,b=b===y?w:y}p=f??p;const S=c[k+1];if(S&&S.backend!==g.backend&&p)if(g.backend==="2d"&&S.backend==="webgl2")f=p,x=!0;else{const E=await createImageBitmap(p);if(a())return E.close(),!1;f=E,S.backend==="webgl2"&&(x=!1)}}if(!p)return!0;const v=r.getContext("2d");if(!v)throw new Error("Failed to acquire 2D context for output canvas");return v.clearRect(0,0,o,i),v.drawImage(p,0,0,o,i),!0},ca=()=>{const e=d.useRef(null),t=d.useRef(null);return d.useEffect(()=>()=>{e.current&&pf(e.current)},[]),d.useMemo(()=>({get:(n,r)=>((!t.current||t.current.width!==n||t.current.height!==r)&&(e.current&&pf(e.current),e.current=Cx(n,r),t.current={width:n,height:r}),e.current)}),[])},T2=({width:e,height:t,fit:n,className:r,style:o,effects:i,...s},a)=>{const l=d.useRef(null),c=ca(),f=d.useMemo(()=>typeof document>"u"?null:document.createElement("canvas"),[]),p=d.useCallback(h=>{const m=l.current,x=e??h.displayWidth,v=t??h.displayHeight;if(!m)throw new Error("Canvas ref is not set");if(!f)throw new Error("Source canvas is not available");f.width=x,f.height=v;const k=f.getContext("2d");if(!k)throw new Error("Could not get 2d context for source canvas");return k.drawImage(h,...Sx(n,{height:h.displayHeight,width:h.displayWidth},{width:x,height:v})),m.width=x,m.height=v,ua({state:c.get(x,v),source:f,effects:i,output:m,width:x,height:v})},[c,i,n,t,f,e]);return d.useImperativeHandle(a,()=>({draw:p,getCanvas:()=>{if(!l.current)throw new Error("Canvas ref is not set");return l.current},clear:()=>{var m;const h=(m=l.current)==null?void 0:m.getContext("2d");if(!h)throw new Error("Could not get 2d context");h.clearRect(0,0,l.current.width,l.current.height)}}),[p]),u.jsx("canvas",{ref:l,className:r,style:o,...s})},R2=le.forwardRef(T2),Ix=async({resolvedSrc:e,signal:t,requestInit:n,contentType:r})=>{if(typeof ImageDecoder>"u")throw new Error("Your browser does not support the WebCodecs ImageDecoder API.");const o=await fetch(e,{...n,signal:t}),{body:i}=o;if(!i)throw new Error("Got no body");const s=new ImageDecoder({data:i,type:r??o.headers.get("Content-Type")??"image/gif"});await Promise.all([s.completed,s.tracks.ready]);const{selectedTrack:a}=s.tracks;if(!a)throw s.close(),new Error("No selected track");return{decoder:s,selectedTrack:a}},j2=5,Qm=({loopBehavior:e,durationFound:t,timeInSec:n})=>e==="loop"?t?n%t:n:Math.min(n,t||1/0),P2=async({resolvedSrc:e,signal:t,requestInit:n,currentTime:r,initialLoopBehavior:o})=>{const{decoder:i,selectedTrack:s}=await Ix({resolvedSrc:e,signal:t,requestInit:n,contentType:null}),a=[];let l=null;const c=async m=>{const x=a.find(k=>k.frameIndex===m);if(x&&x.frame)return x;const v=await i.decode({frameIndex:m,completeFramesOnly:!0});return x?x.frame=v.image:a.push({frame:v.image,frameIndex:m,timeInSeconds:v.image.timestamp/1e6}),{frame:v.image,frameIndex:m,timeInSeconds:v.image.timestamp/1e6}},f=m=>{const v=a.filter(k=>k.frame).sort((k,g)=>{const y=Math.abs(k.timeInSeconds-m),w=Math.abs(g.timeInSeconds-m);return y-w});for(let k=0;k<v.length;k++){if(k<j2)continue;const g=v[k];g.frame=null}},p=async({timeInSec:m,loopBehavior:x})=>{const v=Qm({durationFound:l,loopBehavior:x,timeInSec:m}),g=a.filter(w=>w.timeInSeconds<=v).map(w=>w.frameIndex).reduce((w,b)=>Math.max(w,b),0);let y=g;for(;;){const w=await c(y);if(y++,!w.frame)throw new Error("No frame found");if(!w.frame.duration||(y===s.frameCount&&l===null&&(l=(w.frame.timestamp+w.frame.duration)/1e6),w.timeInSeconds>v||y===s.frameCount))break}s.frameCount-g<3&&x==="loop"&&await c(0),f(v)};return await p({timeInSec:r,loopBehavior:o}),await p({timeInSec:r,loopBehavior:o}),{close:()=>{var m;for(const x of a)(m=x.frame)==null||m.close(),x.frame=null;i.close()},getFrame:async(m,x)=>{if(l!==null&&m>l&&x==="clear-after-finish")return null;const v=Qm({loopBehavior:x,durationFound:l,timeInSec:m});await p({timeInSec:v,loopBehavior:x});const g=a.filter(y=>y.frame).reduce((y,w)=>{const b=Math.abs(y.timeInSeconds-v),S=Math.abs(w.timeInSeconds-v);return b<S?y:w});if(!g.frame)throw new Error("No frame found");return g},frameCount:s.frameCount}},F2=({frame:e,playbackRate:t,fps:n})=>e*t/n,_2=e=>{if(!e)return null;const t={...e};delete t.signal;const{headers:n,...r}=t;return JSON.stringify({...r,headers:n?Array.from(new Headers(n).entries()):null})},M2=e=>typeof window>"u"?e:new URL(e,window.origin).href,$2={src:{type:"asset",default:void 0,description:"Source",keyframable:!1},...Er,...Ai,playbackRate:{type:"number",min:0,max:10,step:.1,default:1,description:"Playback rate",hiddenFromList:!1,keyframable:!1},...sr,...so,...io},A2=e=>{const t={},n=t;for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(r.startsWith("data-")||r.startsWith("aria-"))&&(n[r]=e[r]);return t},Tx=d.forwardRef(({src:e,width:t,height:n,onError:r,loopBehavior:o="loop",playbackRate:i=1,fit:s="fill",requestInit:a,effects:l,controls:c,...f},p)=>{const h=M2(e),[m,x]=d.useState(null),{delayRender:v,continueRender:k}=Hn(),[g]=d.useState(()=>v(`Rendering <AnimatedImage/> with src="${h}"`)),y=Pt(),{fps:w}=ht(),b=F2({frame:y,playbackRate:i,fps:w}),S=d.useRef(b);S.current=b;const E=_2(a),T=d.useRef(a);T.current=a;const I=d.useRef(null),R=la({effects:l,overrideId:(c==null?void 0:c.overrideId)??null});d.useImperativeHandle(p,()=>{var W;const A=(W=I.current)==null?void 0:W.getCanvas();if(!A)throw new Error("Canvas ref is not set");return A},[]);const[F]=d.useState(()=>o);return d.useEffect(()=>{const A=new AbortController;let W=!1,M=!1;const $=()=>{M||(M=!0,k(g))};return P2({resolvedSrc:h,signal:A.signal,requestInit:T.current,currentTime:S.current,initialLoopBehavior:F}).then(V=>{if(W){V.close();return}x(V),$()}).catch(V=>{if(!W){if(V.name==="AbortError"){$();return}r?(r==null||r(V),$()):Ws(V)}}),()=>{W=!0,A.abort(),$()}},[h,g,r,E,F,k]),d.useEffect(()=>()=>{m==null||m.close()},[m]),d.useLayoutEffect(()=>{if(!m)return;const A=v(`Rendering frame at ${b} of <AnimatedImage src="${e}"/>`);let W=!1;return m.getFrame(b,o).then(async M=>{var V,D;if(W)return;if(M===null){(V=I.current)==null||V.clear(),k(A);return}await((D=I.current)==null?void 0:D.draw(M.frame))&&!W&&k(A)}).catch(M=>{W||(r?(r(M),k(A)):Ws(M))}),()=>{W=!0,k(A)}},[b,m,o,r,e,k,v,R,s,t,n]),u.jsx(R2,{ref:I,width:t,height:n,fit:s,effects:R,...f})});Tx.displayName="AnimatedImageContent";var N2=({src:e,width:t,height:n,onError:r,fit:o,playbackRate:i,loopBehavior:s,id:a,className:l,style:c,durationInFrames:f,from:p,premountFor:h,postmountFor:m,styleWhilePremounted:x,styleWhilePostmounted:v,requestInit:k,effects:g=[],controls:y,ref:w,...b})=>{const S=d.useRef(null),E=aa(g);d.useImperativeHandle(w,()=>S.current,[]);const{effectivePostmountFor:T,effectivePremountFor:I,freezeFrame:R,isPremountingOrPostmounting:F,postmountingActive:A,premountingActive:W,premountingStyle:M}=ia({from:p??0,durationInFrames:f??1/0,premountFor:h??null,postmountFor:m??null,style:c??null,styleWhilePremounted:x??null,styleWhilePostmounted:v??null,hideWhilePremounted:"display-none"}),$=A2(b),V={src:e,width:t,height:n,onError:r,fit:o,playbackRate:i,loopBehavior:s,id:a,className:l,style:M??void 0,requestInit:k,...$};return u.jsx(ra,{frame:R,active:F,children:u.jsx(Ft,{layout:"none",from:p??0,durationInFrames:f??1/0,name:"<AnimatedImage>",_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/animatedimage",controls:y,_remotionInternalEffects:E,_remotionInternalPremountDisplay:I||null,_remotionInternalPostmountDisplay:T||null,_remotionInternalIsPremounting:W,_remotionInternalIsPostmounting:A,...b,outlineRef:S,children:u.jsx(Tx,{...V,ref:S,effects:g,controls:y})})})},Rx=Cr({Component:N2,componentName:"<AnimatedImage>",componentIdentity:"dev.remotion.remotion.AnimatedImage",schema:$2,supportsEffects:!0});Rx.displayName="AnimatedImage";Ut(Rx);var L2={type:"boolean",default:!1,description:"Disabled"},D2=e=>{const{calculateKey:t,validateParams:n}=e,r={...e,documentationLink:e.documentationLink??null,calculateKey:i=>{const s=i.disabled??!1;return`${t(i)}-disabled-${s}`},schema:{disabled:L2,...e.schema}};return(i={})=>(n(i),{definition:r,params:i,effectKey:r.calculateKey(i),memoized:!1})},z2=e=>{if(typeof e!="string")throw new TypeError(`The "filename" must be a string, but you passed a value of type ${typeof e}`);if(e.trim()==="")throw new Error("The `filename` must not be empty");if(!e.match(/^([0-9a-zA-Z-!_.*'()/:&$@=;+,?]+)/g))throw new Error('The `filename` must match "/^([0-9a-zA-Z-!_.*\'()/:&$@=;+,?]+)/g". Use forward slashes only, even on Windows.')},O2=e=>{if(typeof e!="string"&&!(e instanceof Uint8Array))throw new TypeError(`The "content" must be a string or Uint8Array, but you passed a value of type ${typeof e}`);if(typeof e=="string"&&e.trim()==="")throw new Error("The `content` must not be empty")},jx=e=>{e.type==="artifact"&&(z2(e.filename),e.contentType!=="thumbnail"&&O2(e.content))},_o=d.createContext({registerRenderAsset:()=>{},unregisterRenderAsset:()=>{},renderAssets:[]}),B2=({children:e,collectAssets:t})=>{const[n,r]=d.useState([]),o=d.useRef([]),i=d.useCallback(l=>{jx(l),o.current=[...o.current,l],r(o.current)},[]);t&&d.useImperativeHandle(t,()=>({collectAssets:()=>{const l=o.current;return o.current=[],r([]),l}}),[]);const s=d.useCallback(l=>{o.current=o.current.filter(c=>c.id!==l),r(o.current)},[]);d.useLayoutEffect(()=>{typeof window<"u"&&(window.remotion_collectAssets=()=>{const l=o.current;return o.current=[],r([]),l})},[]);const a=d.useMemo(()=>({registerRenderAsset:i,unregisterRenderAsset:s,renderAssets:n}),[n,i,s]);return u.jsx(_o.Provider,{value:a,children:e})},or=e=>typeof window>"u"||e.startsWith("http://")||e.startsWith("https://")||e.startsWith("file://")||e.startsWith("blob:")||e.startsWith("data:")?e:new URL(e,window.origin).href,$u=({trimAfter:e,mediaDurationInFrames:t,playbackRate:n,trimBefore:r})=>{let o=t;typeof e<"u"&&(o=e),typeof r<"u"&&(o-=r);const i=o/n;return Number(i.toFixed(10))},Px=d.createContext(null),W2=()=>le.useContext(Px),Au=({durationInFrames:e,times:t=1/0,children:n,name:r,showInTimeline:o,...i})=>{const s=Pt(),{durationInFrames:a}=ht();if(xu(e,{component:"of the <Loop /> component",allowFloats:!0}),typeof t!="number")throw new TypeError(`You passed to "times" an argument of type ${typeof t}, but it must be a number.`);if(t!==1/0&&t%1!==0)throw new TypeError(`The "times" prop of a loop must be an integer, but got ${t}.`);if(t<0)throw new TypeError(`The "times" prop of a loop must be at least 0, but got ${t}`);const l=Math.ceil(a/e),c=Math.min(l,t),f=i.layout==="none"?void 0:i.style,p=e*(c-1),m=Math.floor(s/e)*e,x=Math.min(m,p),v=d.useMemo(()=>({numberOfTimes:Math.min(a/e,t),startOffset:-x,durationInFrames:e}),[a,e,x,t]),k=d.useMemo(()=>({iteration:Math.floor(s/e),durationInFrames:e}),[s,e]);return u.jsx(Px.Provider,{value:k,children:u.jsx(Ft,{durationInFrames:e,from:x,name:r??"<Loop>",_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/loop",_remotionInternalLoopDisplay:v,layout:i.layout,style:f,showInTimeline:o,children:n})})};Au.useLoop=W2;var Lt=({logLevel:e,tag:t,message:n,mountTime:r})=>{const o=[r?Date.now()-r+"ms ":null,t].filter(Boolean).join(" ");St.trace({logLevel:e,tag:null},`[${o}]`,n)},Nu=d.createContext({}),Jm={},Lc=[],Fx=({children:e})=>{const[t,n]=d.useState(()=>Jm);return d.useEffect(()=>{const r=()=>{n(Jm)};return Lc.push(r),()=>{Lc=Lc.filter(o=>o!==r)}},[]),u.jsx(Nu.Provider,{value:t,children:e})},_x=e=>{const t=e.indexOf("#");return t===-1?null:t},V2=e=>{const t=_x(e);return t===null?e:e.slice(0,t)},Mo=e=>{const t=d.useContext(Nu),n=_x(e),r=V2(e);return t[r]?n!==null?t[r]+e.slice(n):t[r]:e},Lu=(e,t)=>{if(typeof e.volume!="number"&&typeof e.volume!="function"&&typeof e.volume<"u")throw new TypeError(`You have passed a volume of type ${typeof e.volume} to your <${t} /> component. Volume must be a number or a function with the signature '(frame: number) => number' undefined.`);if(typeof e.volume=="number"&&e.volume<0)throw new TypeError(`You have passed a volume below 0 to your <${t} /> component. Volume must be between 0 and 1`);if(typeof e.playbackRate!="number"&&typeof e.playbackRate<"u")throw new TypeError(`You have passed a playbackRate of type ${typeof e.playbackRate} to your <${t} /> component. Playback rate must a real number or undefined.`);if(typeof e.playbackRate=="number"&&(isNaN(e.playbackRate)||!Number.isFinite(e.playbackRate)||e.playbackRate<=0))throw new TypeError(`You have passed a playbackRate of ${e.playbackRate} to your <${t} /> component. Playback rate must be a real number above 0.`);if(typeof e.preservePitch!="boolean"&&typeof e.preservePitch<"u")throw new TypeError(`'preservePitch' must be a boolean or undefined but got '${typeof e.preservePitch}' instead`)},H2=(e,t)=>{if(typeof e<"u"){if(typeof e!="number")throw new TypeError(`type of startFrom prop must be a number, instead got type ${typeof e}.`);if(isNaN(e)||e===1/0)throw new TypeError("startFrom prop can not be NaN or Infinity.");if(e<0)throw new TypeError(`startFrom must be greater than equal to 0 instead got ${e}.`)}if(typeof t<"u"){if(typeof t!="number")throw new TypeError(`type of endAt prop must be a number, instead got type ${typeof t}.`);if(isNaN(t))throw new TypeError("endAt prop can not be NaN.");if(t<=0)throw new TypeError(`endAt must be a positive number, instead got ${t}.`)}if(t<e)throw new TypeError("endAt prop must be greater than startFrom prop.")},U2=(e,t)=>{if(typeof e<"u"){if(typeof e!="number")throw new TypeError(`type of trimBefore prop must be a number, instead got type ${typeof e}.`);if(isNaN(e)||e===1/0)throw new TypeError("trimBefore prop can not be NaN or Infinity.");if(e<0)throw new TypeError(`trimBefore must be greater than equal to 0 instead got ${e}.`)}if(typeof t<"u"){if(typeof t!="number")throw new TypeError(`type of trimAfter prop must be a number, instead got type ${typeof t}.`);if(isNaN(t))throw new TypeError("trimAfter prop can not be NaN.");if(t<=0)throw new TypeError(`trimAfter must be a positive number, instead got ${t}.`)}if(t<=e)throw new TypeError("trimAfter prop must be greater than trimBefore prop.")},Du=({startFrom:e,endAt:t,trimBefore:n,trimAfter:r})=>{if(typeof e<"u"&&typeof n<"u")throw new TypeError("Cannot use both startFrom and trimBefore props. Use trimBefore instead as startFrom is deprecated.");if(typeof t<"u"&&typeof r<"u")throw new TypeError("Cannot use both endAt and trimAfter props. Use trimAfter instead as endAt is deprecated.");typeof n<"u"||typeof r<"u"?U2(n,r):(typeof e<"u"||typeof t<"u")&&H2(e,t)},zu=({startFrom:e,endAt:t,trimBefore:n,trimAfter:r})=>({trimBeforeValue:n??e??void 0,trimAfterValue:r??t??void 0}),Z2=(e,t)=>{switch(t.type){case"got-duration":{const n=or(t.src);return e[n]===t.durationInSeconds?e:{...e,[n]:t.durationInSeconds}}default:return e}},zp=d.createContext({durations:{},setDurations:()=>{throw new Error("context missing")}}),Mx=({children:e})=>{const[t,n]=d.useReducer(Z2,{}),r=d.useMemo(()=>({durations:t,setDurations:n}),[t]);return u.jsx(zp.Provider,{value:r,children:e})},Op=({crossOrigin:e,requestsVideoFrame:t,isClientSideRendering:n})=>{if(e!=null)return e;if(n||t)return"anonymous"},Kl=({mediaRef:e,mediaType:t,onAutoPlayError:n,logLevel:r,mountTime:o,reason:i,isPlayer:s})=>{const{current:a}=e;if(!a)return;Lt({logLevel:r,tag:"play",message:`Attempting to play ${a.src}. Reason: ${i}`,mountTime:o});const l=a.play();l.catch&&l.catch(c=>{if(a&&!c.message.includes("request was interrupted by a call to pause")&&!c.message.includes("The operation was aborted.")&&!c.message.includes("The fetching process for the media resource was aborted by the user agent")&&!c.message.includes("request was interrupted by a new load request")&&!c.message.includes("because the media was removed from the document")&&!(c.message.includes("user didn't interact with the document")&&a.muted)&&(console.log(`Could not play ${t} due to following error: `,c),!a.muted)){if(n){n();return}t==="video"&&s&&(St.info({logLevel:r,tag:"<"+t+">"},"The video will be muted and we'll retry playing it."),St.info({logLevel:r,tag:"<"+t+">"},"Use onAutoPlayError() to handle this error yourself."),a.muted=!0,a.play())}})},Bp=({audioContext:e,ref:t})=>{let n=null,r=!1,o=e;return{setAudioContext:i=>{o=i},attemptToConnect:()=>{if(r)throw new Error("SharedElementSourceNode has been disposed");!n&&t.current&&o&&(n=o.createMediaElementSource(t.current))},get:()=>{if(!n)throw new Error("Audio element not connected");return n},cleanup:()=>{n&&(n.disconnect(),n=null),r=!0}}},eg=!1,K2=e=>{eg||(eg=!0,typeof window<"u"&&St.warn({logLevel:e,tag:null},"AudioContext is not supported in this browser"))},Y2=({logLevel:e,latencyHint:t,audioEnabled:n,sampleRate:r})=>{const o=ct(),i=d.useRef(r);if(r!==i.current)throw new Error(`Changing the AudioContext sample rate dynamically is not supported. The sample rate was initialized with ${i.current} Hz, but ${r} Hz was passed later.`);return d.useMemo(()=>{if(o.isRendering||!n)return null;if(typeof AudioContext>"u")return K2(e),null;const a=new AudioContext({latencyHint:t,sampleRate:r}),l=a.createGain();l.connect(a.destination),St.trace({logLevel:e,tag:"audio"},"Creating new audio context"),a.suspend();let c=null;return{audioContext:a,gainNode:l,getState:()=>{const m=a.state;return c==="running"&&m!=="running"?"suspended-to-running":c==="suspended"&&m!=="suspended"?"running-to-suspended":m},resume:()=>{c="running";const m=a.resume();return m.finally(()=>{c==="running"&&(c=null)}),m},suspend:()=>{c="suspended";const m=a.suspend();return m.finally(()=>{c==="suspended"&&(c=null)}),m}}},[e,t,o.isRendering,n,r])},G2=(e,t)=>new Promise(n=>{const r=e.currentTime,i=e.getOutputTimestamp().performanceTime,s=performance.now(),a=()=>{var p;const{currentTime:l}=e,c=e.getOutputTimestamp(),f=performance.now()-s;if(i!==void 0&&c.performanceTime!==void 0&&c.performanceTime>i&&c.contextTime!==void 0&&c.contextTime>r){St.verbose({logLevel:t,tag:"audio"},`waitUntilActuallyResumed: getOutputTimestamp.performanceTime advanced from ${i.toFixed(6)} to ${c.performanceTime.toFixed(6)} after ${f.toFixed(1)}ms. currentTime=${l.toFixed(6)} (advanced by ${(l-r).toFixed(6)}), getOutputTimestamp.performanceTime=${((p=c.performanceTime)==null?void 0:p.toFixed(1))??"undefined"}`),n();return}requestAnimationFrame(a)};requestAnimationFrame(a)}),Dc="data:audio/mp3;base64,/+MYxAAJcAV8AAgAABn//////+/gQ5BAMA+D4Pg+BAQBAEAwD4Pg+D4EBAEAQDAPg++hYBH///hUFQVBUFREDQNHmf///////+MYxBUGkAGIMAAAAP/29Xt6lUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV/+MYxDUAAANIAAAAAFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",X2=(e,t)=>{const n=Object.keys(e).sort(),r=Object.keys(t).sort();if(n.length!==r.length)return!1;for(let o=0;o<n.length;o++)if(n[o]!==r[o]||e[n[o]]!==t[r[o]])return!1;return!0},q2=(e,t,n)=>e==="src"&&!n.startsWith("data:")&&!t.startsWith("data:")?new URL(n,window.origin).toString()!==new URL(t,window.origin).toString():n!==t,Di=d.createContext(null),Ou=d.createContext(null),Q2=e=>{if(e==="suspended"||e==="running-to-suspended"||e==="interrupted")return!0;if(e==="running"||e==="suspended-to-running")return!1;throw new Error(`Unexpected audio context state: ${e}`)},$x=({children:e,audioLatencyHint:t,audioEnabled:n,previewSampleRate:r})=>{const o=ir(),i=r??48e3;d.useEffect(()=>{typeof window>"u"||(window.remotion_sampleRate=i)},[i]);const s=Y2({logLevel:o,latencyHint:t,audioEnabled:n,sampleRate:i}),a=d.useRef(!1),l=d.useRef(null),c=d.useMemo(()=>({value:0}),[]),f=d.useRef([]),p=d.useMemo(()=>({dispatch:b=>{f.current.forEach(S=>S(b))},subscribe:b=>(f.current.push(b),{remove:()=>{f.current=f.current.filter(S=>S!==b)}})}),[]),h=d.useRef({scheduledEndTime:null,mediaEndTime:null}),m=d.useRef(new Map),x=d.useCallback(b=>{m.current.delete(b)},[]),v=d.useMemo(()=>({node:b,mediaTimestamp:S,sourceOffset:E,scheduledTime:T,duration:I,offset:R,originalUnloopedMediaTimestamp:F})=>{if(!s)throw new Error("Audio context not found");const A=s.getState();if(A==="closed")return{type:"not-started",reason:"audio context is closed"};const W=Q2(A);I>0&&(W?m.current.set(b,{scheduledTime:T,offset:R,duration:I}):b.start(T,R,I));const M=T+I/b.playbackRate.value,$=S+R-E,V=$+I,D=s.audioContext.baseLatency+s.audioContext.outputLatency,L=T-s.audioContext.currentTime,j=h.current,C=j.scheduledEndTime!==null&&Math.abs(T-j.scheduledEndTime)>.001,P=j.mediaEndTime!==null&&Math.abs($-j.mediaEndTime)>.001;return St.verbose({logLevel:o,tag:"audio-scheduling"},"scheduled %c%s%c %s %c%s%c %s %c%s%c %s %s %s %s %s",C?"color: red; font-weight: bold":"",T.toFixed(4),"",M.toFixed(4),P?"color: red; font-weight: bold":"",$.toFixed(4),"",V.toFixed(4),I<0||L<0?"color: red; font-weight: bold":"color: blue; font-weight: bold",I<0?"missed "+Math.abs(R).toFixed(2)+"s":Math.abs(L).toFixed(2)+(L<0?" delay":" ahead"),"","current="+s.audioContext.currentTime.toFixed(4),"offset="+R.toFixed(4),"latency="+D.toFixed(4),"state="+s.audioContext.state,F!==$?"original_ts="+F.toFixed(4):"","action="+(W?"schedule":"start"),""),j.scheduledEndTime=M,j.mediaEndTime=V,I>0?{type:"started",scheduledTime:T}:{type:"not-started",reason:"missed "+Math.abs(R).toFixed(2)+"s"}},[s,o]),k=d.useCallback(()=>{if(!s||a.current)return Promise.resolve();a.current=!0,s.gainNode.gain.cancelScheduledValues(s.audioContext.currentTime),s.gainNode.gain.setValueAtTime(0,s.audioContext.currentTime),s.gainNode.gain.linearRampToValueAtTime(1,s.audioContext.currentTime+.03),m.current.forEach((S,E)=>{E.start(S.scheduledTime,S.offset,S.duration)}),m.current.clear();const b=s.resume();return l.current=new Promise(S=>{G2(s.audioContext,o).then(S),b.catch(E=>{St.warn({logLevel:o,tag:"audio"},"AudioContext resume rejected, continuing without audio sync",E),S()})}).finally(()=>{l.current=null}),b.catch(()=>{})},[s,o]),g=d.useCallback(()=>l.current,[]),y=d.useCallback(()=>!s||!a.current?Promise.resolve():(a.current=!1,s.suspend()),[s]),w=d.useMemo(()=>({audioContext:(s==null?void 0:s.audioContext)??null,getAudioContextState:()=>(s==null?void 0:s.getState())??null,gainNode:(s==null?void 0:s.gainNode)??null,audioSyncAnchor:c,audioSyncAnchorEmitter:p,scheduleAudioNode:v,resume:k,suspend:y,getIsResumingAudioContext:g,unscheduleAudioNode:x}),[s,c,p,v,k,y,g,x]);return u.jsx(Di.Provider,{value:w,children:e})},Ax=({children:e,numberOfAudioTags:t})=>{const n=d.useRef([]),[r]=d.useState(t);if(t!==r)throw new Error("The number of shared audio tags has changed dynamically. Once you have set this property, you cannot change it afterwards.");const o=ir(),i=na(),s=ct(),a=d.useContext(Di),l=(a==null?void 0:a.audioContext)??null,c=a==null?void 0:a.resume,[f]=d.useState(()=>new Array(t).fill(!0).map(()=>{const b=d.createRef();return{id:Math.random(),ref:b,mediaElementSourceNode:Bp({audioContext:l,ref:b})}}));for(const{mediaElementSourceNode:b}of f)b==null||b.setAudioContext(l);(le.useInsertionEffect??le.useLayoutEffect)(()=>()=>{requestAnimationFrame(()=>{f.forEach(({mediaElementSourceNode:b})=>{b==null||b.cleanup()})})},[f]);const h=d.useRef(new Array(t).fill(!1)),m=d.useCallback(()=>{f.forEach(({ref:b,id:S})=>{var I;const E=(I=n.current)==null?void 0:I.find(R=>R.id===S),{current:T}=b;if(T){if(E===void 0){T.src!==Dc&&(T.src=Dc);return}if(!E)throw new TypeError("Expected audio data to be there");Object.keys(E.props).forEach(R=>{q2(R,E.props[R],T[R])&&(T[R]=E.props[R])})}})},[f]),x=d.useCallback(b=>{var D,L;const{aud:S,audioId:E,premounting:T,postmounting:I}=b,R=(D=n.current)==null?void 0:D.find(j=>j.audioId===E);if(R)return R;const F=h.current.findIndex(j=>j===!1);if(F===-1)throw new Error(`Tried to simultaneously mount ${t+1} <Html5Audio /> tags at the same time. With the current settings, the maximum amount of <Html5Audio /> tags is limited to ${t} at the same time. Remotion pre-mounts silent audio tags to help avoid browser autoplay restrictions. See https://remotion.dev/docs/player/autoplay#using-the-numberofsharedaudiotags-prop for more information on how to increase this limit.`);const{id:A,ref:W,mediaElementSourceNode:M}=f[F],$=[...h.current];$[F]=A,h.current=$;const V={props:S,id:A,el:W,audioId:E,mediaElementSourceNode:M,premounting:T,audioMounted:!!W.current,postmounting:I,cleanupOnMediaTagUnmount:()=>{}};return(L=n.current)==null||L.push(V),m(),V},[t,f,m]),v=d.useCallback(b=>{var T;const S=[...h.current],E=f.findIndex(I=>I.id===b);if(E===-1)throw new TypeError(`Unknown audio ref ${b}; refs: ${f.map(I=>I.id).join(", ")}`);S[E]=!1,h.current=S,n.current=(T=n.current)==null?void 0:T.filter(I=>I.id!==b),m()},[f,m]),k=d.useCallback(({aud:b,audioId:S,id:E,premounting:T,postmounting:I})=>{var F;let R=!1;n.current=(F=n.current)==null?void 0:F.map(A=>{const W=!!A.el.current;return A.audioMounted!==W&&(R=!0),A.id===E?X2(b,A.props)&&A.premounting===T&&A.postmounting===I?A.audioMounted===W?A:{...A,audioMounted:W}:(R=!0,{...A,props:b,premounting:T,postmounting:I,audioId:S,audioMounted:W}):A.audioMounted===W?A:{...A,audioMounted:W}}),R&&m()},[m]),g=d.useCallback(()=>{f.forEach(b=>{const S=n.current.find(E=>E.el===b.ref);S!=null&&S.premounting||Kl({mediaRef:b.ref,mediaType:"audio",onAutoPlayError:null,logLevel:o,mountTime:i,reason:"playing all audios",isPlayer:s.isPlayer})}),c==null||c()},[o,i,f,s.isPlayer,c]),y=d.useMemo(()=>({registerAudio:x,unregisterAudio:v,updateAudio:k,playAllAudios:g,numberOfAudioTags:t}),[t,g,x,v,k]),w=d.useMemo(()=>f.map(({id:b,ref:S})=>u.jsx("audio",{ref:S,preload:"metadata",src:Dc},b)),[f]);return u.jsxs(Ou.Provider,{value:y,children:[w,e]})},J2=({aud:e,audioId:t,premounting:n,postmounting:r})=>{var l;const o=d.useContext(Di),i=d.useContext(Ou),[s]=d.useState(()=>{if(i&&i.numberOfAudioTags>0)return i.registerAudio({aud:e,audioId:t,premounting:n,postmounting:r});const c=le.createRef(),f=Bp({audioContext:(o==null?void 0:o.audioContext)??null,ref:c});return{el:c,id:Math.random(),props:e,audioId:t,mediaElementSourceNode:f,premounting:n,audioMounted:!!c.current,postmounting:r,cleanupOnMediaTagUnmount:()=>{f==null||f.cleanup()}}});(l=s.mediaElementSourceNode)==null||l.setAudioContext((o==null?void 0:o.audioContext)??null);const a=le.useInsertionEffect??le.useLayoutEffect;return typeof document<"u"&&(a(()=>{i&&i.numberOfAudioTags>0&&i.updateAudio({id:s.id,aud:e,audioId:t,premounting:n,postmounting:r})},[e,i,s.id,t,n,r]),a(()=>()=>{i&&i.numberOfAudioTags>0&&i.unregisterAudio(s.id)},[i,s.id])),s},eI=1e-5,Yl=(e,t)=>Math.abs(e-t)<eI,Nx=(e,t)=>Math.round(e/t*100)/100,hf=()=>typeof window>"u"||!/AppleWebKit/.test(window.navigator.userAgent)?!1:!window.navigator.userAgent.includes("Chrome/"),Bu=()=>typeof window>"u"?!1:/iP(ad|od|hone)/i.test(window.navigator.userAgent)&&hf(),tI=e=>Bu()&&e.startsWith("blob:"),mf=({actualFrom:e,fps:t})=>Nx(Math.max(0,-e),t),gf=({duration:e,fps:t})=>Nx(e,t),nI=({actualSrc:e,actualFrom:t,duration:n,fps:r})=>{if(tI(e)||e.startsWith("data:")||!!new URL(e,(typeof window>"u"?null:window.location.href)??"http://localhost:3000").hash||!Number.isFinite(t))return e;const i=`${e}#t=${mf({actualFrom:t,fps:r})}`;return Number.isFinite(n)?`${i},${gf({duration:n,fps:r})}`:i},rI=({prevStartFrom:e,newStartFrom:t,prevDuration:n,newDuration:r,fps:o})=>{const i=mf({actualFrom:e,fps:o}),s=mf({actualFrom:t,fps:o}),a=gf({duration:n,fps:o}),l=gf({duration:r,fps:o});return!(s<i||l>a)},oI=({actualSrc:e,actualFrom:t,duration:n,fps:r})=>{const o=d.useRef(t),i=d.useRef(n),s=d.useRef(e);return(!rI({prevStartFrom:o.current,newStartFrom:t,prevDuration:i.current,newDuration:n,fps:r})||e!==s.current)&&(o.current=t,i.current=n,s.current=e),nI({actualSrc:s.current,actualFrom:o.current,duration:i.current,fps:r})},tg=!1,iI=e=>{tg||(tg=!0,St.warn({logLevel:e,tag:null},"In Safari, setting a volume and a playback rate at the same time is buggy."),St.warn({logLevel:e,tag:null},"In Desktop Safari, only volumes <= 1 will be applied."),St.warn({logLevel:e,tag:null},e,"In Mobile Safari, the volume will be ignored and set to 1 if a playbackRate is set."))},Lx=({mediaRef:e,volume:t,logLevel:n,source:r,shouldUseWebAudioApi:o})=>{var h,m,x;const i=d.useRef(null),s=d.useRef(t);s.current=t;const a=d.useContext(Di);if(!a)throw new Error("useAmplification must be used within a SharedAudioContext");const{audioContext:l,gainNode:c}=a;if(typeof window<"u"&&d.useLayoutEffect(()=>{var k,g;if(!l||!e.current||!o)return;if(e.current.playbackRate!==1&&hf()){iI(n);return}if(!r||!c)return;const v=new GainNode(l,{gain:s.current});return r.attemptToConnect(),r.get().connect(v),v.connect(c),i.current={gainNode:v},St.trace({logLevel:n,tag:null},`Starting to amplify ${(k=e.current)==null?void 0:k.src}. Gain = ${s.current}, playbackRate = ${(g=e.current)==null?void 0:g.playbackRate}`),()=>{i.current=null,v.disconnect(),r.get().disconnect()}},[n,e,l,r,o,c]),i.current){const v=t;Yl(i.current.gainNode.gain.value,v)||(i.current.gainNode.gain.value=v,St.trace({logLevel:n,tag:null},`Setting gain to ${v} for ${(h=e.current)==null?void 0:h.src}`))}return(hf()&&e.current&&((m=e.current)==null?void 0:m.playbackRate)!==1||!o)&&e.current&&!Yl(t,(x=e.current)==null?void 0:x.volume)&&(e.current.volume=Math.min(t,1)),i},Eo=()=>{const e=d.useContext(wt);return(e==null?void 0:e.cumulatedNegativeFrom)??0},zi=e=>{const t=Au.useLoop(),n=Pt(),r=Eo();return e==="repeat"||t===null?n+r:n+r+t.durationInFrames*t.iteration},Dx=e=>{if(/data:|blob:/.test(e.substring(0,5)))return"Data URL";const t=e.split("/").map(n=>n.split("\\")).flat(1);return t[t.length-1]},sI=({compositionDurationInFrames:e,playbackRate:t,trimBefore:n,trimAfter:r,parentSequenceDurationInFrames:o,loop:i})=>{if(i)return e;const s=$u({mediaDurationInFrames:e*t+(n??0),playbackRate:t,trimBefore:n,trimAfter:r});if(o!==null){const a=Math.min(o,s);return Number(a.toFixed(10))}return s},$o=({frame:e,volume:t,mediaVolume:n=1})=>{if(typeof t=="number")return t*n;if(typeof t>"u")return Number(n);const r=t(e)*n;if(typeof r!="number")throw new TypeError(`You passed in a a function to the volume prop but it did not return a number but a value of type ${typeof r} for frame ${e}`);if(Number.isNaN(r))throw new TypeError(`You passed in a function to the volume prop but it returned NaN for frame ${e}.`);if(!Number.isFinite(r))throw new TypeError(`You passed in a function to the volume prop but it returned a non-finite number for frame ${e}.`);return Math.max(0,r)},ng={},aI=e=>{ng[e]||(console.warn(e),ng[e]=!0)},zx=({volume:e,mediaVolume:t,mediaType:n,src:r,displayName:o,trimBefore:i,trimAfter:s,playbackRate:a,sequenceDurationInFrames:l,mediaStartsAt:c,loop:f})=>{if(!r)throw new Error("No src passed");const p=d.useContext(wt),[h]=d.useState(()=>e),m=sI({compositionDurationInFrames:l,playbackRate:a,trimBefore:i,trimAfter:s,parentSequenceDurationInFrames:(p==null?void 0:p.durationInFrames)??null,loop:f}),x=d.useMemo(()=>typeof e=="number"?e:new Array(Math.floor(Math.max(0,m+c))).fill(!0).map((b,S)=>$o({frame:S+c,volume:e,mediaVolume:t})).join(","),[m,c,e,t]);d.useEffect(()=>{typeof e=="number"&&e!==h&&aI(`Remotion: The ${n} with src ${r} has changed it's volume. Prefer the callback syntax for setting volume to get better timeline display: https://www.remotion.dev/docs/audio/volume`)},[h,n,r,e]);const v=typeof e=="function",k=wu(),{rootId:g}=ro(),y=0-c+(i??0);return d.useMemo(()=>({volumes:x,duration:m,doesVolumeChange:v,nonce:k,rootId:g,finalDisplayName:o??Dx(r),startMediaFrom:y,src:r,playbackRate:a}),[x,m,v,k,g,o,r,y,a])},Wp=({volume:e,mediaVolume:t,src:n,mediaType:r,playbackRate:o,displayName:i,id:s,getStack:a,showInTimeline:l,premountDisplay:c,postmountDisplay:f,loopDisplay:p,documentationLink:h,refForOutline:m})=>{const x=d.useContext(wt),v=Eo(),{registerSequence:k,unregisterSequence:g}=d.useContext(Ni),{durationInFrames:y}=ht(),w=Eo(),{volumes:b,duration:S,doesVolumeChange:E,nonce:T,rootId:I,finalDisplayName:R}=zx({volume:e,mediaVolume:t,mediaType:r,src:n,displayName:i,trimAfter:void 0,trimBefore:void 0,playbackRate:o,sequenceDurationInFrames:y,mediaStartsAt:w,loop:!1}),{isStudio:F}=ct();d.useEffect(()=>{var A,W;if(!n)throw new Error("No src passed");if(!(!F&&((W=(A=window.process)==null?void 0:A.env)==null?void 0:W.NODE_ENV)!=="test")&&l)return k({type:r,src:n,id:s,duration:S,from:0,trimBefore:null,parent:(x==null?void 0:x.id)??null,displayName:R,documentationLink:h,rootId:I,volume:b,showInTimeline:!0,nonce:T.get(),startMediaFrom:0-v,mediaFrameAtSequenceZero:null,doesVolumeChange:E,loopDisplay:p,playbackRate:o,getStack:a,premountDisplay:c,postmountDisplay:f,controls:null,effects:[],refForOutline:m,isInsideSeries:!1,frozenFrame:null,frozenMediaFrame:null}),()=>{g(s)}},[S,s,x,n,k,g,b,E,T,r,v,o,a,l,c,f,p,h,I,R,F,m])},lI=(e,t)=>{const[n,r]=d.useState([]),[o,i]=d.useState([]),[s,a]=d.useState([]),c=ct().isRendering,f=d.useRef(!1),p=d.useCallback(x=>{if(c)return{unblock:()=>{}};let v=!1;return r(k=>[...k,x]),{unblock:()=>{v||(v=!0,r(k=>{const g=k.filter(y=>y!==x);return g.length===k.length?k:g}))}}},[c]),h=d.useCallback(x=>(i(v=>[...v,x]),{remove:()=>{i(v=>v.filter(k=>k!==x))}}),[]),m=d.useCallback(x=>(a(v=>[...v,x]),{remove:()=>{a(v=>v.filter(k=>k!==x))}}),[]);return d.useEffect(()=>{c||n.length>0&&!f.current&&(f.current=!0,o.forEach(x=>x()),Lt({logLevel:e,message:"Player is entering buffer state",mountTime:t,tag:"player"}))},[n]),typeof window<"u"&&d.useLayoutEffect(()=>{c||n.length===0&&f.current&&(f.current=!1,s.forEach(x=>x()),Lt({logLevel:e,message:"Player is exiting buffer state",mountTime:t,tag:"player"}))},[n]),d.useMemo(()=>({addBlock:p,listenForBuffering:h,listenForResume:m,buffering:f}),[p,f,h,m])},Oi=le.createContext(null),Ox=({children:e})=>{const{logLevel:t,mountTime:n}=d.useContext(Po),r=lI(t??"info",n);return u.jsx(Oi.Provider,{value:r,children:e})},Bx=e=>{const[t,n]=d.useState(e.buffering.current);return d.useEffect(()=>{const r=()=>{n(!0)},o=()=>{n(!1)},i=e.listenForBuffering(r),s=e.listenForResume(o);return()=>{i.remove(),s.remove()}},[e]),t},Wu=()=>{const e=d.useContext(Oi),t=ir(),n=e?e.addBlock:null;return d.useMemo(()=>({delayPlayback:()=>{if(!n)throw new Error("Tried to enable the buffering state, but a Remotion context was not found. This API can only be called in a component that was passed to the Remotion Player or a <Composition>. Or you might have experienced a version mismatch - run `npx remotion versions` and ensure all packages have the same version. This error is thrown by the buffer state https://remotion.dev/docs/player/buffer-state");St.trace({logLevel:t,tag:"[buffer-state]"},"Adding buffer handle",new Error().stack);const{unblock:r}=n({id:String(Math.random())});let o=!1;return{unblock:()=>{o||(o=!0,St.trace({logLevel:t,tag:"[buffer-state]"},"Removing buffer handle"),r())}}}}),[n,t])},uI=()=>/^((?!chrome|android).)*safari/i.test(window.navigator.userAgent),cI=({mediaRef:e,mediaType:t,onVariableFpsVideoDetected:n,pauseWhenBuffering:r,logLevel:o,mountTime:i})=>{const s=d.useRef(!1),{delayPlayback:a}=Wu(),l=d.useCallback(c=>{var x;if(t!=="video"||!r)return;const f=e.current;if(!f)return;if(f.readyState>=f.HAVE_FUTURE_DATA&&!uI()){Lt({logLevel:o,message:`Not using buffer until first frame, because readyState is ${f.readyState} and is not Safari or Desktop Chrome`,mountTime:i,tag:"buffer"});return}if(!f.requestVideoFrameCallback){Lt({logLevel:o,message:"Not using buffer until first frame, because requestVideoFrameCallback is not supported",mountTime:i,tag:"buffer"});return}s.current=!0,Lt({logLevel:o,message:`Buffering ${(x=e.current)==null?void 0:x.src} until the first frame is received`,mountTime:i,tag:"buffer"});const p=a(),h=()=>{p.unblock(),f.removeEventListener("ended",h,{once:!0}),f.removeEventListener("pause",h,{once:!0}),s.current=!1},m=()=>{h()};f.requestVideoFrameCallback((v,k)=>{Math.abs(k.mediaTime-c)>.5&&n(),h()}),f.addEventListener("ended",m,{once:!0}),f.addEventListener("pause",m,{once:!0}),f.addEventListener("canplay",m,{once:!0})},[a,o,e,t,i,n,r]);return d.useMemo(()=>({isBuffering:()=>s.current,bufferUntilFirstFrame:l}),[l])},dI=e=>{const{duration:t,currentTime:n,paused:r,ended:o,desiredUnclampedTime:i,mediaTagTime:s,mediaTagLastUpdate:a,rvcTime:l,rvcLastUpdate:c,isVariableFpsVideo:f,acceptableTimeShift:p,lastSeekDueToShift:h,playing:m,playbackRate:x,mediaTagBufferingOrStalled:v,playerBuffering:k,absoluteFrame:g,onlyWarnForMediaSeekingError:y,isPremounting:w,isPostmounting:b,pauseWhenBuffering:S}=e,E=!Number.isNaN(t)&&Number.isFinite(t)?Math.min(t,i):i,T=Math.abs(E-s),I=l?Math.abs(E-l):null,R=c&&l>a?I:T,F=I&&!f?R:T;if(F>p&&h!==E)return{type:"seek-due-to-shift",shouldBeTime:E,why:`because time shift is too big. shouldBeTime = ${E}, isTime = ${s}, requestVideoCallbackTime = ${l}, timeShift = ${F}${f?", isVariableFpsVideo = true":""}, isPremounting = ${w}, isPostmounting = ${b}, pauseWhenBuffering = ${S}`,bufferUntilFirstFrame:m&&x>0,playReason:m&&r?"player is playing but media tag is paused, and just seeked":null,warnAboutNonSeekable:!y};const A=m?.15:.01,W=Math.abs(n-E)>A;if(!m||k&&!v)return{type:"seek-if-not-playing",shouldBeTime:E,why:W?`not playing or something else is buffering. time offset is over seek threshold (${A})`:null};if(!m||k)return{type:"none"};const $=r&&!o;if($||g===0){const D=$?"media tag is paused":"absolute frame is 0";return{type:"play-and-seek",shouldBeTime:E,why:W?`is over timeshift threshold (threshold = ${A}) and ${D}`:null,playReason:`player is playing and ${D}`,bufferUntilFirstFrame:!f&&x>0}}return{type:"none"}},fI=e=>{var r,o;const t=le.useRef({time:((r=e.current)==null?void 0:r.currentTime)??0,lastUpdate:performance.now()}),n=((o=e.current)==null?void 0:o.currentTime)??null;return n!==null&&t.current.time!==n&&(t.current.time=n,t.current.lastUpdate=performance.now()),t},ml=({mediaRef:e,time:t,logLevel:n,why:r,mountTime:o})=>{const i=Bu()?Number(t.toFixed(1)):t;return Lt({logLevel:n,tag:"seek",message:`Seeking from ${e.currentTime} to ${i}. src= ${e.src} Reason: ${r}`,mountTime:o}),e.currentTime=i,i},pI=({element:e,shouldBuffer:t,isPremounting:n,isPostmounting:r,logLevel:o,mountTime:i,src:s})=>{const a=Wu(),[l,c]=d.useState(!1);return d.useEffect(()=>{let f=[];const{current:p}=e;if(!p||!t)return;if(n||r){if((n||r)&&p.readyState<p.HAVE_FUTURE_DATA&&!navigator.userAgent.includes("Firefox/")){Lt({logLevel:o,message:`Calling .load() on ${p.src} because readyState is ${p.readyState} and it is not Firefox. Element is premounted ${p.playbackRate}`,tag:"load",mountTime:i});const v=p.playbackRate;p.load(),p.playbackRate=v}return}const h=v=>{let k=!1;f.forEach(g=>{g(v),k=!0}),f=[],c(g=>(g&&(k=!0),!1)),k&&Lt({logLevel:o,message:`Unmarking as buffering: ${p.src}. Reason: ${v}`,tag:"buffer",mountTime:i})},m=v=>{c(!0),Lt({logLevel:o,message:`Marking as buffering: ${p.src}. Reason: ${v}`,tag:"buffer",mountTime:i});const{unblock:k}=a.delayPlayback(),g=()=>{h('"canplay" was fired'),x()},y=()=>{h('"error" event was occurred'),x()};p.addEventListener("canplay",g,{once:!0}),f.push(()=>{p.removeEventListener("canplay",g)}),p.addEventListener("error",y,{once:!0}),f.push(()=>{p.removeEventListener("error",y)}),f.push(w=>{Lt({logLevel:o,message:`Unblocking ${p.src} from buffer. Reason: ${w}`,tag:"buffer",mountTime:i}),k()})},x=()=>{if(p.readyState<p.HAVE_FUTURE_DATA){if(m(`readyState is ${p.readyState}, which is less than HAVE_FUTURE_DATA`),!navigator.userAgent.includes("Firefox/")){Lt({logLevel:o,message:`Calling .load() on ${s} because readyState is ${p.readyState} and it is not Firefox. ${p.playbackRate}`,tag:"load",mountTime:i});const v=p.playbackRate;p.load(),p.playbackRate=v}}else{const v=()=>{m('"waiting" event was fired')};p.addEventListener("waiting",v),f.push(()=>{p.removeEventListener("waiting",v)})}};return x(),()=>{h("element was unmounted or prop changed")}},[a,s,e,n,r,o,t,i]),l},hI=({mediaRef:e,mediaType:t,lastSeek:n,onVariableFpsVideoDetected:r})=>{const o=d.useRef(null);return d.useEffect(()=>{const{current:i}=e;if(i)o.current={time:i.currentTime,lastUpdate:performance.now()};else{o.current=null;return}if(t!=="video"){o.current=null;return}const s=i;if(!s.requestVideoFrameCallback)return;let a=()=>{};const l=()=>{if(!s)return;const c=s.requestVideoFrameCallback((f,p)=>{if(o.current!==null){const h=Math.abs(o.current.time-p.mediaTime),m=Math.abs(n.current===null?1/0:p.mediaTime-n.current);h>.5&&m>.5&&p.mediaTime>o.current.time&&r()}o.current={time:p.mediaTime,lastUpdate:performance.now()},l()});a=()=>{s.cancelVideoFrameCallback(c),a=()=>{}}};return l(),()=>{a()}},[n,e,t,r]),o},Wx=({frame:e,playbackRate:t,startFrom:n})=>Li(e,[-1,n,n+1],[-1,n,n+t]),Vx=({fps:e,frame:t,playbackRate:n,startFrom:r})=>{const o=Wx({frame:t,playbackRate:n,startFrom:r}),i=1e3/e;return o*i/1e3},rg={},mI=(e,t)=>{if(e===null||e.seekable.length===0||e.seekable.length>1||rg[e.src])return;const n={start:e.seekable.start(0),end:e.seekable.end(0)};if(n.start===0&&n.end===0){const r=[`The media ${e.src} cannot be seeked. This could be one of few reasons:`,"1) The media resource was replaced while the video is playing but it was not loaded yet.","2) The media does not support seeking.","3) The media was loaded with security headers prventing it from being included.","Please see https://remotion.dev/docs/non-seekable-media for assistance."].join(`
|
|
57
|
-
`);console.error(r),rg[e.src]=!0}},Hx=({mediaRef:e,src:t,mediaType:n,playbackRate:r,preservePitch:o=!0,onlyWarnForMediaSeekingError:i,acceptableTimeshift:s,pauseWhenBuffering:a,isPremounting:l,isPostmounting:c,onAutoPlayError:f})=>{const{playbackRate:p}=Pp(),h=Pt(),m=oo(),[x]=Uw(),v=d.useContext(Oi),{fps:k}=ht(),g=Eo(),y=d.useRef(null),w=d.useRef(null),b=ir(),S=na();if(!v)throw new Error("useMediaPlayback must be used inside a <BufferingContext>");const E=d.useRef({}),T=d.useCallback(()=>{t&&(E.current[t]||(St.verbose({logLevel:b,tag:null},`Detected ${t} as a variable FPS video. Disabling buffering while seeking.`),E.current[t]=!0))},[b,t]),I=hI({mediaRef:e,mediaType:n,lastSeek:w,onVariableFpsVideoDetected:T}),R=fI(e),F=Vx({frame:h,playbackRate:r,startFrom:-g,fps:k}),A=pI({element:e,shouldBuffer:a,isPremounting:l,isPostmounting:c,logLevel:b,mountTime:S,src:t??null}),{bufferUntilFirstFrame:W,isBuffering:M}=cI({mediaRef:e,mediaType:n,onVariableFpsVideoDetected:T,pauseWhenBuffering:a,logLevel:b,mountTime:S}),$=r*p,V=(()=>{var N;return(N=e.current)!=null&&N.duration?Math.min(e.current.duration,s??.65):s??.65})(),D=Bx(v);d.useEffect(()=>{var P,N,B,z,Z;if((P=e.current)!=null&&P.paused)return;if(!x){Lt({logLevel:b,tag:"pause",message:`Pausing ${(N=e.current)==null?void 0:N.src} because ${l?"media is premounting":c?"media is postmounting":"Player is not playing"}`,mountTime:S}),(B=e.current)==null||B.pause();return}const j=A||M();v.buffering.current&&!j&&(Lt({logLevel:b,tag:"pause",message:`Pausing ${(z=e.current)==null?void 0:z.src} because player is buffering but media tag is not`,mountTime:S}),(Z=e.current)==null||Z.pause())},[M,A,v,D,l,b,e,n,S,x,c]);const L=ct();d.useLayoutEffect(()=>{const j=Math.max(0,$);e.current&&e.current.playbackRate!==j&&(e.current.playbackRate=j),e.current&&e.current.preservesPitch!==o&&(e.current.preservesPitch=o)},[e,$,o]),d.useEffect(()=>{var N,B;const j=n==="audio"?"<Html5Audio>":"<Html5Video>";if(!e.current)throw new Error(`No ${n} ref found`);if(!t)throw new Error(`No 'src' attribute was passed to the ${j} element.`);const{current:C}=e,P=dI({duration:C.duration,currentTime:C.currentTime,paused:C.paused,ended:C.ended,desiredUnclampedTime:F,mediaTagTime:R.current.time,mediaTagLastUpdate:R.current.lastUpdate,rvcTime:((N=I.current)==null?void 0:N.time)??null,rvcLastUpdate:((B=I.current)==null?void 0:B.lastUpdate)??null,isVariableFpsVideo:!!E.current[t],acceptableTimeShift:V,lastSeekDueToShift:y.current,playing:x,playbackRate:$,mediaTagBufferingOrStalled:A||M(),playerBuffering:v.buffering.current,absoluteFrame:m,onlyWarnForMediaSeekingError:i,isPremounting:l,isPostmounting:c,pauseWhenBuffering:a});if(P.type!=="none"){if(P.type==="seek-due-to-shift"){w.current=ml({mediaRef:C,time:P.shouldBeTime,logLevel:b,why:P.why,mountTime:S}),y.current=w.current,P.bufferUntilFirstFrame&&W(P.shouldBeTime),P.playReason!==null&&Kl({mediaRef:e,mediaType:n,onAutoPlayError:f,logLevel:b,mountTime:S,reason:P.playReason,isPlayer:L.isPlayer}),P.warnAboutNonSeekable&&mI(C);return}if(P.type==="seek-if-not-playing"){P.why!==null&&(w.current=ml({mediaRef:C,time:P.shouldBeTime,logLevel:b,why:P.why,mountTime:S}));return}P.why!==null&&(w.current=ml({mediaRef:C,time:P.shouldBeTime,logLevel:b,why:P.why,mountTime:S})),Kl({mediaRef:e,mediaType:n,onAutoPlayError:f,logLevel:b,mountTime:S,reason:P.playReason,isPlayer:L.isPlayer}),P.bufferUntilFirstFrame&&W(P.shouldBeTime)}},[m,V,W,v.buffering,I,b,F,M,A,e,n,i,$,x,t,f,l,c,a,S,R,L.isPlayer])},Ux=({mediaRef:e,id:t,mediaType:n,onAutoPlayError:r,isPremounting:o,isPostmounting:i})=>{const{audioAndVideoTags:s,imperativePlaying:a}=ro(),l=ir(),c=na(),f=ct();d.useEffect(()=>{const p={id:t,play:h=>{if(a.current&&!(o||i))return Kl({mediaRef:e,mediaType:n,onAutoPlayError:r,logLevel:l,mountTime:c,reason:h,isPlayer:f.isPlayer})}};return s.current.push(p),()=>{s.current=s.current.filter(h=>h.id!==t)}},[s,t,e,n,r,a,o,i,l,c,f.isPlayer])},Vp=d.createContext({playerMuted:!1,mediaVolume:1}),Hp=d.createContext({setPlayerMuted:()=>{throw new Error("default")},setMediaVolume:()=>{throw new Error("default")}}),Up=()=>{const{mediaVolume:e}=d.useContext(Vp),{setMediaVolume:t}=d.useContext(Hp);return d.useMemo(()=>[e,t],[e,t])},Zp=()=>{const{playerMuted:e}=d.useContext(Vp),{setPlayerMuted:t}=d.useContext(Hp);return d.useMemo(()=>[e,t],[e,t])},Bi=e=>{if(e>=100)throw new Error(`Volume was set to ${e}, but regular volume is 1, not 100. Did you forget to divide by 100? Set a volume of less than 100 to dismiss this error.`)},gI=(e,t)=>{const[n]=d.useState(e.shouldPreMountAudioTags);if(e.shouldPreMountAudioTags!==n)throw new Error("Cannot change the behavior for pre-mounting audio tags dynamically.");const r=ir(),{volume:o,muted:i,playbackRate:s,preservePitch:a,shouldPreMountAudioTags:l,src:c,onDuration:f,acceptableTimeShiftInSeconds:p,_remotionInternalNeedsDurationCalculation:h,_remotionInternalNativeLoopPassed:m,_remotionInternalStack:x,allowAmplificationDuringRender:v,name:k,pauseWhenBuffering:g,showInTimeline:y,loopVolumeCurveBehavior:w,stack:b,crossOrigin:S,delayRenderRetries:E,delayRenderTimeoutInMilliseconds:T,toneFrequency:I,useWebAudioApi:R,onError:F,onNativeError:A,audioStreamIndex:W,...M}=e,[$]=Up(),[V]=Zp(),D=zi(w??"repeat");if(!c)throw new TypeError("No 'src' was passed to <Html5Audio>.");const L=Mo(c),j=d.useContext(wt),[C]=d.useState(()=>String(Math.random())),P=$o({frame:D,volume:o,mediaVolume:$});Bi(P);const N=Op({crossOrigin:S,requestsVideoFrame:!1,isClientSideRendering:!1}),B=d.useMemo(()=>({muted:i||V||P<=0,src:L,loop:m,crossOrigin:N,...M}),[m,V,i,M,L,P,N]),z=d.useMemo(()=>`audio-${Fo(c??"")}-${j==null?void 0:j.relativeFrom}-${j==null?void 0:j.cumulatedFrom}-${j==null?void 0:j.durationInFrames}-muted:${e.muted}-loop:${e.loop}`,[c,j==null?void 0:j.relativeFrom,j==null?void 0:j.cumulatedFrom,j==null?void 0:j.durationInFrames,e.muted,e.loop]),{el:Z,mediaElementSourceNode:H,cleanupOnMediaTagUnmount:G}=J2({aud:B,audioId:z,premounting:!!(j!=null&&j.premounting),postmounting:!!(j!=null&&j.postmounting)}),O=d.useCallback(()=>x??null,[x]);Wp({volume:o,mediaVolume:$,src:c,mediaType:"audio",playbackRate:s??1,displayName:k??null,id:C,getStack:O,showInTimeline:y,premountDisplay:(j==null?void 0:j.premountDisplay)??null,postmountDisplay:(j==null?void 0:j.postmountDisplay)??null,loopDisplay:void 0,documentationLink:"https://www.remotion.dev/docs/html5-audio",refForOutline:null}),Hx({mediaRef:Z,src:c,mediaType:"audio",playbackRate:s??1,preservePitch:a,onlyWarnForMediaSeekingError:!1,acceptableTimeshift:p??null,isPremounting:!!(j!=null&&j.premounting),isPostmounting:!!(j!=null&&j.postmounting),pauseWhenBuffering:g,onAutoPlayError:null}),Ux({id:C,isPostmounting:!!(j!=null&&j.postmounting),isPremounting:!!(j!=null&&j.premounting),mediaRef:Z,mediaType:"audio",onAutoPlayError:null}),Lx({logLevel:r,mediaRef:Z,source:H,volume:P,shouldUseWebAudioApi:R??!1}),(le.useInsertionEffect??le.useLayoutEffect)(()=>()=>{requestAnimationFrame(()=>{G()})},[G]),d.useImperativeHandle(t,()=>Z.current,[Z]);const ae=d.useRef(f);return ae.current=f,d.useEffect(()=>{var q;const{current:oe}=Z;if(!oe)return;if(oe.duration){(q=ae.current)==null||q.call(ae,oe.src,oe.duration);return}const Y=()=>{var xe;(xe=ae.current)==null||xe.call(ae,oe.src,oe.duration)};return oe.addEventListener("loadedmetadata",Y),()=>{oe.removeEventListener("loadedmetadata",Y)}},[Z,c]),n?null:u.jsx("audio",{ref:Z,preload:"metadata",crossOrigin:N,...B})},Zx=d.forwardRef(gI),vI=(e,t)=>{const n=d.useRef(null),{volume:r,playbackRate:o,allowAmplificationDuringRender:i,onDuration:s,toneFrequency:a,_remotionInternalNeedsDurationCalculation:l,_remotionInternalNativeLoopPassed:c,acceptableTimeShiftInSeconds:f,name:p,onNativeError:h,delayRenderRetries:m,delayRenderTimeoutInMilliseconds:x,loopVolumeCurveBehavior:v,pauseWhenBuffering:k,audioStreamIndex:g,preservePitch:y,...w}=e,b=oo(),S=zi(v??"repeat"),E=Pt(),T=d.useContext(wt),{registerRenderAsset:I,unregisterRenderAsset:R}=d.useContext(_o),{delayRender:F,continueRender:A}=Hn(),W=d.useMemo(()=>`audio-${Fo(e.src??"")}-${T==null?void 0:T.relativeFrom}-${T==null?void 0:T.cumulatedFrom}-${T==null?void 0:T.durationInFrames}`,[e.src,T==null?void 0:T.relativeFrom,T==null?void 0:T.cumulatedFrom,T==null?void 0:T.durationInFrames]),M=$o({volume:r,frame:S,mediaVolume:1});Bi(M),d.useImperativeHandle(t,()=>n.current,[]),d.useEffect(()=>{if(!e.src)throw new Error("No src passed");if(window.remotion_audioEnabled&&!e.muted&&!(M<=0))return I({type:"audio",src:or(e.src),id:W,frame:b,volume:M,mediaFrame:E,playbackRate:e.playbackRate??1,toneFrequency:a??1,audioStartFrame:Math.max(0,-((T==null?void 0:T.cumulatedNegativeFrom)??0)),audioStreamIndex:g??0}),()=>R(W)},[e.muted,e.src,I,b,W,R,M,S,E,o,e.playbackRate,a,T==null?void 0:T.cumulatedNegativeFrom,g]);const{src:$}=e,V=t||l;return d.useLayoutEffect(()=>{var C,P;if(((P=(C=window.process)==null?void 0:C.env)==null?void 0:P.NODE_ENV)==="test"||!V)return;const D=F("Loading <Html5Audio> duration with src="+$,{retries:m??void 0,timeoutInMilliseconds:x??void 0}),{current:L}=n,j=()=>{L!=null&&L.duration&&s(L.src,L.duration),A(D)};return L!=null&&L.duration?(s(L.src,L.duration),A(D)):L==null||L.addEventListener("loadedmetadata",j,{once:!0}),()=>{L==null||L.removeEventListener("loadedmetadata",j),A(D)}},[$,s,V,m,x,A,F]),V?u.jsx("audio",{ref:n,...w,onError:h}):null},yI=d.forwardRef(vI),wI=(e,t)=>{const n=d.useContext(Ou),r=e,{startFrom:o,endAt:i,trimBefore:s,trimAfter:a,name:l,stack:c,pauseWhenBuffering:f,showInTimeline:p,onError:h,freeze:m,...x}=r,{loop:v,freeze:k,...g}=r,{fps:y}=ht(),w=ct(),b=oa(f);if(w.isClientSideRendering)throw new Error("<Html5Audio> is not supported in @remotion/web-renderer. Use <Audio> from @remotion/media instead. See https://remotion.dev/docs/client-side-rendering/limitations");if(typeof m<"u")throw new TypeError('The "freeze" prop is not supported on <Html5Audio />. Use <Sequence freeze={...}> to freeze media playback.');const{durations:S,setDurations:E}=d.useContext(zp);if(typeof e.src!="string")throw new TypeError(`The \`<Html5Audio>\` tag requires a string for \`src\`, but got ${JSON.stringify(e.src)} instead.`);const T=Mo(e.src),I=d.useCallback(M=>{console.log(M.currentTarget.error);const $=`Could not play audio with src ${T}: ${M.currentTarget.error}. See https://remotion.dev/docs/media-playback-error for help.`;if(v){if(h){h(new Error($));return}Ws(new Error($))}else h==null||h(new Error($)),console.warn($)},[v,h,T]),R=d.useCallback((M,$)=>{E({type:"got-duration",durationInSeconds:$,src:M})},[E]),F=S[or(T)]??S[or(e.src)];Du({startFrom:o,endAt:i,trimBefore:s,trimAfter:a});const{trimBeforeValue:A,trimAfterValue:W}=zu({startFrom:o,endAt:i,trimBefore:s,trimAfter:a});if(v&&F!==void 0){if(!Number.isFinite(F))return u.jsx(gl,{...g,ref:t,_remotionInternalNativeLoopPassed:!0});const M=F*y;return u.jsx(Au,{layout:"none",durationInFrames:$u({trimAfter:W,mediaDurationInFrames:M,playbackRate:e.playbackRate??1,trimBefore:A}),children:u.jsx(gl,{...g,ref:t,_remotionInternalNativeLoopPassed:!0})})}return typeof A<"u"||typeof W<"u"?u.jsx(Ft,{layout:"none",from:0-(A??0),showInTimeline:!1,durationInFrames:W,name:l,children:u.jsx(gl,{_remotionInternalNeedsDurationCalculation:!!v,pauseWhenBuffering:b,...x,ref:t})}):(Lu({playbackRate:e.playbackRate,preservePitch:e.preservePitch,volume:e.volume},"Html5Audio"),w.isRendering?u.jsx(yI,{onDuration:R,...e,ref:t,onNativeError:I,_remotionInternalNeedsDurationCalculation:!!v}):u.jsx(Zx,{_remotionInternalNativeLoopPassed:e._remotionInternalNativeLoopPassed??!1,_remotionInternalStack:c??null,shouldPreMountAudioTags:n!==null&&n.numberOfAudioTags>0,...e,ref:t,onNativeError:I,onDuration:R,pauseWhenBuffering:b,_remotionInternalNeedsDurationCalculation:!!v,showInTimeline:p??!0}))},gl=d.forwardRef(wI);Ut(gl);var xI=e=>{if(e===void 0)return 1;if(typeof e!="number"||!Number.isFinite(e)||e<=0)throw new Error(`<Solid>: \`pixelDensity\` must be a positive finite number. Received: ${String(e)}.`);return e},bI={...Er,color:{type:"color",default:"transparent",description:"Color"},width:{type:"number",min:1,step:1,default:1920,description:"Width",hiddenFromList:!1},height:{type:"number",min:1,step:1,default:1080,description:"Height",hiddenFromList:!1},pixelDensity:{type:"number",min:1,max:3,step:.1,default:1,description:"Pixel density",hiddenFromList:!1},...sr,...so,...io},SI=({color:e,width:t,height:n,effects:r=[],className:o,style:i,pixelDensity:s,overrideId:a,reference:l})=>{const{delayRender:c,continueRender:f,cancelRender:p}=Hn(),h=xI(s),m=Math.ceil(t*h),x=Math.ceil(n*h),[v,k]=d.useState(null),g=la({effects:r,overrideId:a??null}),y=d.useMemo(()=>{if(typeof document>"u")return null;const E=document.createElement("canvas");return E.width=1,E.height=1,E},[]),w=ca(),b=d.useCallback(E=>{k(E),typeof l=="function"?l(E):l&&(l.current=E)},[l]);d.useEffect(()=>{if(!v||!y)return;const E=c("Solid effect chain");if(!w)return f(E),()=>{f(E)};const T=y.getContext("2d",{colorSpace:"srgb"});if(!T){p(new Error("Failed to acquire 2D context for <Solid> source"));return}return T.clearRect(0,0,1,1),e!==void 0&&(T.fillStyle=e,T.fillRect(0,0,1,1)),ua({state:w.get(m,x),source:y,effects:g,output:v,width:m,height:x}).then(I=>{I&&f(E)}).catch(I=>{p(I)}),()=>{f(E)}},[e,v,y,w,m,x,c,f,p,g]);const S=d.useMemo(()=>({width:t,height:n,...i??{}}),[n,i,t]);return u.jsx("canvas",{ref:b,width:m,height:x,className:o,style:S})},kI=d.forwardRef(({effects:e=[],controls:t,color:n,height:r,width:o,className:i,durationInFrames:s,style:a,name:l,from:c,trimBefore:f,freeze:p,hidden:h,showInTimeline:m,pixelDensity:x,...v},k)=>{const g=aa(e),y=d.useRef(null);return d.useImperativeHandle(k,()=>y.current,[]),u.jsx(Ft,{layout:"none",from:c,trimBefore:f,freeze:p,hidden:h,showInTimeline:m,controls:t,_remotionInternalEffects:g,durationInFrames:s,name:l??"<Solid>",outlineRef:y,_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/solid",...v,children:u.jsx(SI,{reference:y,overrideId:(t==null?void 0:t.overrideId)??null,color:n,height:r,width:o,className:i,style:a,effects:e,pixelDensity:x})})}),Kx=Cr({Component:kI,componentName:"<Solid>",componentIdentity:"dev.remotion.remotion.Solid",schema:bI,supportsEffects:!0});Kx.displayName="Solid";Ut(Kx);var Da=null,Yx=()=>{if(Da!==null)return Da;if(typeof document>"u")return!1;const e=document.createElement("canvas"),t=e.getContext("2d");return Da=typeof(t==null?void 0:t.drawElementImage)=="function"&&typeof e.requestPaint=="function"&&typeof e.captureElementImage=="function"&&"transferControlToOffscreen"in HTMLCanvasElement.prototype,Da},EI="HTML in Canvas is not supported. Two common causes: Chrome is older than version 148 (update Chrome), or the HTML-in-Canvas flag is disabled at chrome://flags/#canvas-draw-element (enable it and restart Chrome).";function CI(e,t){if(typeof e!="number"||typeof t!="number")throw new Error(`HtmlInCanvas: \`width\` and \`height\` must be numbers. Received width=${String(e)}, height=${String(t)}.`);if(!Number.isInteger(e)||e<=0)throw new Error(`HtmlInCanvas: \`width\` must be a positive integer. Received: ${String(e)}.`);if(!Number.isInteger(t)||t<=0)throw new Error(`HtmlInCanvas: \`height\` must be a positive integer. Received: ${String(t)}.`)}function II(e){if(e===void 0)return 1;if(typeof e!="number"||!Number.isFinite(e)||e<=0)throw new Error(`HtmlInCanvas: \`pixelDensity\` must be a positive finite number. Received: ${String(e)}.`);return e}var za=e=>e instanceof DOMException&&e.name==="InvalidStateError",og="HtmlInCanvas: Expected the element to be inside the viewport during rendering, but Chrome had no cached paint record for it.",ig=({target:e,width:t,height:n})=>{e.width!==t&&(e.width=t),e.height!==n&&(e.height=n)},TI=({canvas:e,element:t,elementImage:n})=>{const r=e.getContext("2d");if(!r)throw new Error("Failed to acquire 2D context for <HtmlInCanvas> canvas");r.reset();const o=r.drawElementImage(n,0,0);t.style.transform=o.toString()},sg=d.createContext(null),Gx=d.forwardRef(({width:e,height:t,effects:n,children:r,onPaint:o,onInit:i,pixelDensity:s,controls:a,style:l},c)=>{const f=d.useContext(sg);CI(e,t);const p=II(s),h=Math.ceil(e*p),m=Math.ceil(t*p),{delayRender:x,continueRender:v,cancelRender:k}=Hn(),{isClientSideRendering:g,isRendering:y}=ct(),w=!y||g,b=o===void 0&&i===void 0;Yx()||k(new Error(EI));const S=d.useRef(null),E=d.useRef(null),T=d.useRef(null),I=`${e}x${t}@${p}-${b?"direct":"offscreen"}`,R=d.useCallback(Z=>{S.current=Z,typeof c=="function"?c(Z):c&&(c.current=Z)},[c]),F=ca(),A=la({effects:n,overrideId:(a==null?void 0:a.overrideId)??null}),W=d.useRef(A);W.current=A;const M=d.useRef(o);M.current=o;const $=d.useRef(i);$.current=i;const V=d.useRef(!1),D=d.useRef(null),L=d.useRef(!1),j=d.useRef(f);j.current=f;const C=d.useCallback(async()=>{var G;const Z=T.current;if(!Z)throw new Error("Canvas or scene element not found");const H=E.current;if(!H)throw new Error("HtmlInCanvas: paint target is not ready because the canvas is remounting");ig({target:H,width:h,height:m});try{const O=S.current;if(!O)throw new Error("Canvas not found");const X=x("onPaint");if(!V.current){const oe=$.current;if(!oe)V.current=!0;else{let Y;try{Y=O.captureElementImage(Z)}catch(q){if(za(q)&&w){v(X);return}throw za(q)?new Error(og):q}V.current=!0;try{if(H instanceof HTMLCanvasElement)throw new Error("HtmlInCanvas: onInit requires an OffscreenCanvas paint target");const q=await oe({canvas:H,element:Z,elementImage:Y,pixelDensity:p});if(typeof q!="function")throw new Error("HtmlInCanvas: when `onInit` is provided, it must return a cleanup function, or a Promise that resolves to one.");L.current?q():D.current=q}finally{Y.close()}}}let ae;try{ae=O.captureElementImage(Z)}catch(oe){if(za(oe)&&w){v(X);return}throw za(oe)?new Error(og):oe}try{const oe=M.current;if(oe){if(H instanceof HTMLCanvasElement)throw new Error("HtmlInCanvas: onPaint requires an OffscreenCanvas paint target");const Y=oe({canvas:H,element:Z,elementImage:ae,pixelDensity:p});Y&&await Y}else TI({canvas:H,element:Z,elementImage:ae,pixelDensity:p});await ua({state:F.get(h,m),source:H,effects:W.current,output:H,width:h,height:m})}finally{ae.close()}(G=j.current)==null||G.requestParentPaint(),v(X)}catch(O){k(O)}},[m,h,F,v,k,x,p,w]);d.useLayoutEffect(()=>{const Z=S.current;if(!Z)throw new Error("Canvas not found");Z.layoutSubtree=!0;const H=b?Z:Z.transferControlToOffscreen();return E.current=H,ig({target:H,width:h,height:m}),V.current=!1,L.current=!1,Z.addEventListener("paint",C),()=>{var G;Z.removeEventListener("paint",C),E.current=null,V.current=!1,L.current=!0,(G=D.current)==null||G.call(D),D.current=null}},[C,k,h,m,b]);const P=d.useRef(!1);d.useLayoutEffect(()=>{var H;if(!P.current){P.current=!0;return}const Z=S.current;Z&&((H=Z.requestPaint)==null||H.call(Z))},[o,A]),d.useLayoutEffect(()=>{const Z=S.current;if(!Z)return;const H=x("waiting for first paint after canvas resize");return Z.addEventListener("paint",()=>{v(H)},{once:!0}),()=>{v(H)}},[e,t,v,x,I]);const N=d.useMemo(()=>({width:e,height:t}),[e,t]),B=d.useMemo(()=>({width:e,height:t,...l??{}}),[t,l,e]),z=d.useMemo(()=>({requestParentPaint:()=>{var Z,H;(H=(Z=S.current)==null?void 0:Z.requestPaint)==null||H.call(Z)}}),[]);return u.jsx(sg.Provider,{value:z,children:u.jsx("canvas",{ref:R,width:h,height:m,style:B,children:u.jsx("div",{ref:T,style:N,children:r})},I)})});Gx.displayName="HtmlInCanvasContent";var Xx=d.forwardRef(({width:e,height:t,effects:n=[],children:r,onPaint:o,onInit:i,pixelDensity:s,controls:a,style:l,durationInFrames:c,name:f,...p},h)=>{const m=aa(n),x=d.useRef(null),v=d.useCallback(k=>{x.current=k,typeof h=="function"?h(k):h&&(h.current=k)},[h]);return u.jsx(Ft,{durationInFrames:c,name:f??"<HtmlInCanvas>",_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/remotion/html-in-canvas",controls:a,_remotionInternalEffects:m,outlineRef:x,layout:"none",...p,children:u.jsx(Gx,{ref:v,width:e,height:t,effects:n,onPaint:o,onInit:i,pixelDensity:s,controls:a,style:l,children:r})})});Xx.displayName="HtmlInCanvas";var RI={...Er,pixelDensity:{type:"number",min:1,max:3,step:.1,default:1,description:"Pixel density",hiddenFromList:!1},...sr,...so,...io},jI=Cr({Component:Xx,componentName:"<HtmlInCanvas>",componentIdentity:"dev.remotion.remotion.HtmlInCanvas",schema:RI,supportsEffects:!0}),qx=Object.assign(jI,{isSupported:Yx});qx.displayName="HtmlInCanvas";Ut(qx);function vr(e){return e.startsWith("data:")&&e.length>100?e.slice(0,60)+"...["+e.length+" chars total]":e}var PI={...Er,...Ai,fit:{type:"enum",default:"fill",description:"Fit",variants:{fill:{},contain:{},cover:{}}},...sr,...so,...io},FI=()=>{if(typeof DOMException<"u")return new DOMException("Image loading was aborted","AbortError");const e=new Error("Image loading was aborted");return e.name="AbortError",e},_I=({src:e,signal:t})=>new Promise((n,r)=>{const o=new Image;let i=!1;function s(){o.onload=null,o.onerror=null}function a(c){i||(i=!0,s(),c())}function l(){a(()=>r(FI()))}if(o.onload=()=>{var c;Promise.resolve((c=o.decode)==null?void 0:c.call(o)).catch(()=>{}).then(()=>{const f=o.naturalWidth||o.width,p=o.naturalHeight||o.height;if(f<=0||p<=0){a(()=>r(new Error(`Could not determine dimensions for <CanvasImage> with src="${vr(e)}"`)));return}a(()=>n({element:o,width:f,height:p}))})},o.onerror=()=>{a(()=>r(new Error(`Could not load <CanvasImage> with src="${vr(e)}"`)))},t.addEventListener("abort",l,{once:!0}),t.aborted){l();return}o.crossOrigin="anonymous",o.src=e});function MI(e){return 1e3*2**(e-1)}var $I=({onFrame:e})=>{if(typeof requestAnimationFrame>"u")return e(),()=>{};const t=requestAnimationFrame(e);return()=>cancelAnimationFrame(t)},Qx=d.forwardRef(({src:e,width:t,height:n,fit:r="fill",effects:o,controls:i,onError:s,className:a,style:l,id:c,pauseWhenLoading:f,maxRetries:p=2,delayRenderRetries:h,delayRenderTimeoutInMilliseconds:m,refForOutline:x,...v},k)=>{const{delayRender:g,continueRender:y,cancelRender:w}=Hn(),{delayPlayback:b}=Wu(),[S,E]=d.useState(null),[T,I]=d.useState(null),R=Mo(e),F=ca(),A=la({effects:o,overrideId:(i==null?void 0:i.overrideId)??null}),W=d.useContext(wt),M=d.useRef(null),[$,V]=d.useState(!1),D=!!(W!=null&&W.premounting),L=!!(W!=null&&W.postmounting),j=d.useCallback(({markAsReady:N})=>{const B=M.current;!B||B.continued||(B.continued=!0,N&&V(!1),y(B.handle),M.current=null)},[y]),C=d.useMemo(()=>typeof document>"u"?null:document.createElement("canvas"),[]),P=d.useCallback(N=>{E(N),x&&(x.current=N),typeof k=="function"?k(N):k&&(k.current=N)},[k,x]);return d.useLayoutEffect(()=>{if(!(!f||!$||D||L))return b().unblock},[b,$,L,D,f]),d.useLayoutEffect(()=>{const N=g(`Rendering <CanvasImage> with src="${vr(R)}"`,{retries:h??void 0,timeoutInMilliseconds:m??void 0}),B=new AbortController;let z=!1,Z=0,H=null;I(null),V(!0),M.current={handle:N,continued:!1};const G=()=>{_I({src:R,signal:B.signal}).then(O=>{z||I(O)}).catch(O=>{if(O.name==="AbortError"){j({markAsReady:!1});return}if(Z++,Z<=p){const X=MI(Z);console.warn(`Could not load <CanvasImage> with src="${vr(R)}", retrying in ${X}ms`),H=setTimeout(()=>{z||G()},X)}else s?(s(O),j({markAsReady:!0})):w(O)})};return G(),()=>{z=!0,H!==null&&clearTimeout(H),B.abort(),j({markAsReady:!1})}},[R,w,j,g,h,m,p,s]),d.useLayoutEffect(()=>{if(!T||!S||!C)return;const N=g(`Applying effects to <CanvasImage> with src="${vr(R)}"`);let B=!1,z=!1,Z=()=>{};const H=()=>{z||(z=!0,y(N))},G=t??T.width,O=n??T.height,X=C.getContext("2d",{colorSpace:"srgb"});return X?(C.width=G,C.height=O,S.width=G,S.height=O,X.clearRect(0,0,G,O),X.drawImage(T.element,...Sx(r,{width:T.width,height:T.height},{width:G,height:O})),ua({state:F.get(G,O),source:C,effects:A,output:S,width:G,height:O}).then(ae=>{ae&&!B&&(Z=$I({onFrame:()=>{B||(H(),j({markAsReady:!0}))}}))}).catch(ae=>{B||(s?(s(ae),H(),j({markAsReady:!0})):w(ae))}),()=>{B=!0,Z(),H()}):(w(new Error("Could not get 2D context for <CanvasImage> source canvas")),H(),()=>{H()})},[R,w,F,y,j,g,r,n,T,A,s,S,C,t]),u.jsx("canvas",{...v,ref:P,width:t,height:n,className:a,style:l,id:c})});Qx.displayName="CanvasImageContent";var AI=d.forwardRef(({src:e,width:t,height:n,fit:r,effects:o=[],className:i,style:s,id:a,onError:l,pauseWhenLoading:c,maxRetries:f,delayRenderRetries:p,delayRenderTimeoutInMilliseconds:h,durationInFrames:m,from:x,trimBefore:v,freeze:k,premountFor:g,postmountFor:y,styleWhilePremounted:w,styleWhilePostmounted:b,hidden:S,name:E,showInTimeline:T,stack:I,controls:R,_remotionInternalDocumentationLink:F,outlineRef:A,...W},M)=>{if(!e)throw new Error('No "src" prop was passed to <CanvasImage>.');const $=aa(o),V=d.useRef(null);d.useImperativeHandle(M,()=>V.current,[]);const{effectivePostmountFor:D,effectivePremountFor:L,freezeFrame:j,isPremountingOrPostmounting:C,postmountingActive:P,premountingActive:N,premountingStyle:B}=ia({from:x??0,durationInFrames:m??1/0,premountFor:g??null,postmountFor:y??null,style:s??null,styleWhilePremounted:w??null,styleWhilePostmounted:b??null,hideWhilePremounted:"display-none"});return u.jsx(ra,{frame:j,active:C,children:u.jsx(Ft,{layout:"none",from:x??0,trimBefore:v,durationInFrames:m??1/0,freeze:k,hidden:S,showInTimeline:T??!0,name:E??"<CanvasImage>",_remotionInternalDocumentationLink:F??"https://www.remotion.dev/docs/canvasimage",controls:R,_remotionInternalEffects:$,_remotionInternalIsMedia:{type:"image",src:e},_remotionInternalStack:I,_remotionInternalPremountDisplay:L||null,_remotionInternalPostmountDisplay:D||null,_remotionInternalIsPremounting:N,_remotionInternalIsPostmounting:P,outlineRef:A??V,children:u.jsx(Qx,{ref:V,src:e,width:t,height:n,fit:r,effects:o,controls:R,className:i,style:B??void 0,id:a,onError:l,pauseWhenLoading:c,maxRetries:f,delayRenderRetries:p,delayRenderTimeoutInMilliseconds:h,refForOutline:A??null,...W})})})}),Kp=Cr({Component:AI,componentName:"<CanvasImage>",componentIdentity:"dev.remotion.remotion.CanvasImage",schema:PI,supportsEffects:!0});Kp.displayName="CanvasImage";Ut(Kp);var NI=({onLoad:e,onError:t,delayRenderRetries:n,delayRenderTimeoutInMilliseconds:r,...o},i)=>{const{delayRender:s,continueRender:a}=Hn(),[l]=d.useState(()=>s(`Loading <IFrame> with source ${o.src}`,{retries:n??void 0,timeoutInMilliseconds:r??void 0})),c=d.useCallback(p=>{a(l),e==null||e(p)},[l,e,a]),f=d.useCallback(p=>{a(l),t?t(p):console.error("Error loading iframe:",p,"Handle the event using the onError() prop to make this message disappear.")},[l,t,a]);return u.jsx("iframe",{referrerPolicy:"strict-origin-when-cross-origin",...o,ref:i,onError:f,onLoad:c})};d.forwardRef(NI);function LI(e){return 1e3*2**(e-1)}var DI=({onError:e,maxRetries:t=2,src:n,pauseWhenLoading:r,delayRenderRetries:o,delayRenderTimeoutInMilliseconds:i,onImageFrame:s,crossOrigin:a,decoding:l,ref:c,refForOutline:f,...p})=>{const h=d.useRef(null),m=d.useRef({}),{delayPlayback:x}=Wu(),v=d.useContext(wt),[k,g]=d.useState(!1),y=d.useCallback($=>{h.current=$,f.current=$,typeof c=="function"?c($):c&&(c.current=$)},[c,f]),w=Mo(n),b=d.useCallback($=>{if(!h.current)return;const V=h.current.src;setTimeout(()=>{var L;if(!h.current)return;const D=(L=h.current)==null?void 0:L.src;D===V&&(h.current.removeAttribute("src"),h.current.setAttribute("src",D))},$)},[]),{delayRender:S,continueRender:E,cancelRender:T}=Hn(),I=!!(v!=null&&v.premounting),R=!!(v!=null&&v.postmounting),F=d.useCallback($=>{var V,D,L,j,C,P,N;if(m.current){if(m.current[(V=h.current)==null?void 0:V.src]=(m.current[(D=h.current)==null?void 0:D.src]??0)+1,e&&(m.current[(L=h.current)==null?void 0:L.src]??0)>t){e($);return}if((m.current[(j=h.current)==null?void 0:j.src]??0)<=t){const B=LI(m.current[(C=h.current)==null?void 0:C.src]??0);console.warn(`Could not load image with source ${vr((P=h.current)==null?void 0:P.src)}, retrying again in ${B}ms`),b(B);return}try{T("Error loading image with src: "+vr((N=h.current)==null?void 0:N.src))}catch{}}},[T,t,e,b]);typeof window<"u"&&(d.useLayoutEffect(()=>{if(!(!r||!k||I||R))return x().unblock},[x,k,R,I,r]),d.useLayoutEffect(()=>{var j,C;if(((C=(j=window.process)==null?void 0:j.env)==null?void 0:C.NODE_ENV)==="test"){h.current&&(h.current.src=w);return}const{current:$}=h;if(!$)return;g(!0);const V=S("Loading <Img> with src="+vr(w),{retries:o??void 0,timeoutInMilliseconds:i??void 0});let D=!1;const L=()=>{var P,N,B;if(D){E(V);return}(m.current[(P=h.current)==null?void 0:P.src]??0)>0&&(delete m.current[(N=h.current)==null?void 0:N.src],console.info(`Retry successful - ${vr((B=h.current)==null?void 0:B.src)} is now loaded`)),$&&(s==null||s($)),g(!1),E(V)};if(!h.current){L();return}return $.src=w,$.decode().then(L).catch(P=>{console.warn(P),$.complete&&$.naturalWidth>0&&$.naturalHeight>0?L():$.addEventListener("load",L)}),()=>{D=!0,$.removeEventListener("load",L),E(V)}},[w,o,i,s,E,S]));const{isClientSideRendering:A,isRendering:W}=ct(),M=Op({crossOrigin:a,requestsVideoFrame:!1,isClientSideRendering:A});return u.jsx("img",{...p,ref:y,crossOrigin:M,onError:F,decoding:W?"sync":l})},zI=({hidden:e,name:t,stack:n,showInTimeline:r,src:o,from:i,trimBefore:s,durationInFrames:a,freeze:l,premountFor:c,postmountFor:f,style:p,styleWhilePremounted:h,styleWhilePostmounted:m,controls:x,outlineRef:v,...k})=>{if(!o)throw new Error('No "src" prop was passed to <Img>.');const{effectivePostmountFor:g,effectivePremountFor:y,freezeFrame:w,isPremountingOrPostmounting:b,postmountingActive:S,premountingActive:E,premountingStyle:T}=ia({from:i??0,durationInFrames:a??1/0,premountFor:c??null,postmountFor:f??null,style:p??null,styleWhilePremounted:h??null,styleWhilePostmounted:m??null,hideWhilePremounted:"display-none"});return u.jsx(ra,{frame:w,active:b,children:u.jsx(Ft,{layout:"none",from:i??0,trimBefore:s,durationInFrames:a??1/0,freeze:l,_remotionInternalStack:n,_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/img",_remotionInternalIsMedia:{type:"image",src:o},_remotionInternalPremountDisplay:y||null,_remotionInternalPostmountDisplay:g||null,_remotionInternalIsPremounting:E,_remotionInternalIsPostmounting:S,name:t??"<Img>",controls:x,showInTimeline:r??!0,hidden:e,outlineRef:v,children:u.jsx(DI,{src:o,refForOutline:v,style:T??void 0,...k})})})},OI=Kp,BI={src:{type:"asset",default:void 0,description:"Source",keyframable:!1},...Er,...Ai,...sr,...so,...io},WI=new Set(["alt","crossOrigin","decoding","fetchPriority","loading","onError","onImageFrame","onLoad","sizes","srcSet","useMap"]),VI=e=>Object.keys(e).filter(t=>e[t]!==void 0&&WI.has(t)),HI=e=>e.map(t=>`"${t}"`).join(", "),UI=({props:e,ref:t,width:n,height:r})=>{if(typeof n=="string"||typeof r=="string")throw new Error('The "width" and "height" props must be numbers on <Img> when effects are passed, because <Img> renders a <CanvasImage>. Use numeric props or CSS dimensions in "style".');const o=VI(e);if(t!=null&&o.unshift("ref"),o.length!==0)throw new Error(`The ${HI(o)} prop${o.length===1?"":"s"} cannot be used on <Img> when effects are passed, because <Img> renders a <canvas> instead of a native <img>. Remove ${o.length===1?"this prop":"these props"}.`)},ZI=e=>{const t=e==null?void 0:e.objectFit;if(t==="fill"||t==="contain"||t==="cover")return t},KI=({effects:e=[],ref:t,hidden:n,name:r,stack:o,showInTimeline:i,src:s,from:a,trimBefore:l,durationInFrames:c,freeze:f,premountFor:p,postmountFor:h,styleWhilePremounted:m,styleWhilePostmounted:x,controls:v,width:k,height:g,className:y,style:w,id:b,pauseWhenLoading:S,maxRetries:E,delayRenderRetries:T,delayRenderTimeoutInMilliseconds:I,...R})=>{const F=d.useRef(null),A=oa(S);if(e.length===0)return u.jsx(zI,{...R,ref:t,hidden:n,name:r,stack:o,showInTimeline:i,src:s,from:a,trimBefore:l,durationInFrames:c,freeze:f,premountFor:p,postmountFor:h,styleWhilePremounted:m,styleWhilePostmounted:x,controls:v,width:k,height:g,className:y,style:w,id:b,pauseWhenLoading:A,maxRetries:E,delayRenderRetries:T,delayRenderTimeoutInMilliseconds:I,outlineRef:F});if(!s)throw new Error('No "src" prop was passed to <Img>.');UI({props:R,ref:t,width:k,height:g});const W=typeof k=="number"?k:void 0,M=typeof g=="number"?g:void 0,$=R,V=ZI(w)??"fill";return u.jsx(OI,{src:s,width:W,height:M,fit:V,effects:e,className:y,style:w,id:b,pauseWhenLoading:A,maxRetries:E,delayRenderRetries:T,delayRenderTimeoutInMilliseconds:I,from:a,trimBefore:l,durationInFrames:c,freeze:f,premountFor:p,postmountFor:h,styleWhilePremounted:m,styleWhilePostmounted:x,hidden:n,name:r??"<Img>",showInTimeline:i,stack:o,_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/img",controls:v,outlineRef:F,...$})},Yp=Cr({Component:KI,componentName:"<Img>",componentIdentity:"dev.remotion.remotion.Img",schema:BI,supportsEffects:!0});Ut(Yp);var YI=e=>{if(e==="remotion")return"dev.remotion.remotion";if(e.startsWith("@remotion/"))return`dev.remotion.${e.slice(10).replace(/-([a-z])/g,(n,r)=>r.toUpperCase())}`;throw new Error(`Unsupported Remotion package name: ${e}`)},Jx=({packageName:e,componentName:t})=>`${YI(e)}.${t}`,Gp={...Er,...sr},GI={...Gp,...so},e1={...GI,...io},XI={...e1,...Iu,...Zw},qI={...Gp,...Iu,...Zw},QI=(e,t)=>{typeof e=="function"?e(t):e&&(e.current=t)},t1=e=>{const t=Cr(e);return Ut(t),t},Gl=(e,t,n)=>{const r=d.forwardRef((i,s)=>{const{durationInFrames:a,from:l,trimBefore:c,freeze:f,hidden:p,name:h,showInTimeline:m,stack:x,controls:v,...k}=i,g=d.useRef(null),y=d.useCallback(w=>{g.current=w,QI(s,w)},[s]);return u.jsx(Ft,{layout:"none",from:l??0,trimBefore:c,durationInFrames:a??1/0,freeze:f,hidden:p,name:h??t,showInTimeline:m??!0,controls:v,_remotionInternalStack:x,_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/interactive",outlineRef:g,children:le.createElement(e,{...k,ref:y})})});r.displayName=t;const o=t1({Component:r,componentName:t,componentIdentity:Jx({packageName:"remotion",componentName:t.slice(1,-1)}),schema:n,supportsEffects:!1});return o.displayName=t,o},Be=(e,t)=>Gl(e,t,XI),zo=(e,t)=>Gl(e,t,Gp),Mr={baseSchema:Er,transformSchema:sr,textSchema:Iu,backgroundSchema:so,borderSchema:io,premountSchema:Ai,sequenceSchema:Ii,withSchema:t1,_internalMakeRemotionComponentIdentity:Jx,A:Be("a","<Interactive.A>"),Article:Be("article","<Interactive.Article>"),Aside:Be("aside","<Interactive.Aside>"),Button:Be("button","<Interactive.Button>"),Circle:zo("circle","<Interactive.Circle>"),Code:Be("code","<Interactive.Code>"),Div:Be("div","<Interactive.Div>"),Ellipse:zo("ellipse","<Interactive.Ellipse>"),Em:Be("em","<Interactive.Em>"),Footer:Be("footer","<Interactive.Footer>"),G:zo("g","<Interactive.G>"),H1:Be("h1","<Interactive.H1>"),H2:Be("h2","<Interactive.H2>"),H3:Be("h3","<Interactive.H3>"),H4:Be("h4","<Interactive.H4>"),H5:Be("h5","<Interactive.H5>"),H6:Be("h6","<Interactive.H6>"),Header:Be("header","<Interactive.Header>"),Label:Be("label","<Interactive.Label>"),Li:Be("li","<Interactive.Li>"),Line:zo("line","<Interactive.Line>"),Main:Be("main","<Interactive.Main>"),Nav:Be("nav","<Interactive.Nav>"),Ol:Be("ol","<Interactive.Ol>"),P:Be("p","<Interactive.P>"),Path:zo("path","<Interactive.Path>"),Pre:Be("pre","<Interactive.Pre>"),Rect:zo("rect","<Interactive.Rect>"),Section:Be("section","<Interactive.Section>"),Small:Be("small","<Interactive.Small>"),Span:Be("span","<Interactive.Span>"),Strong:Be("strong","<Interactive.Strong>"),Svg:Gl("svg","<Interactive.Svg>",e1),Text:Gl("text","<Interactive.Text>",qI),Ul:Be("ul","<Interactive.Ul>")},JI=async({resolvedSrc:e,signal:t,requestInit:n,contentType:r})=>{const{decoder:o,selectedTrack:i}=await Ix({resolvedSrc:e,signal:t,requestInit:n,contentType:r});try{const{image:s}=await o.decode({frameIndex:i.frameCount-1,completeFramesOnly:!0});try{if(s.duration===null)throw new Error("Could not determine animated image duration");return(s.timestamp+s.duration)/1e6}finally{s.close()}}finally{o.close()}},n1=le.createRef(),eT=({children:e,onlyRenderComposition:t,currentCompositionMetadata:n,initialCompositions:r,initialCanvasContent:o})=>{const[i,s]=d.useState([]),[a,l]=d.useState(o),[c,f]=d.useState(r),p=d.useRef(c),h=d.useCallback(w=>{f(b=>{const S=w(b);return p.current=S,S})},[]),m=d.useCallback(w=>{h(b=>{if(b.find(S=>S.id===w.id))throw new Error(`Multiple composition with id ${w.id} are registered.`);return[...b,w]})},[h]),x=d.useCallback(w=>{f(b=>b.filter(S=>S.id!==w))},[]),v=d.useCallback((w,b,S,E)=>{s(T=>[...T,{name:w,parent:b,nonce:S,stack:E}])},[]),k=d.useCallback((w,b)=>{s(S=>S.filter(E=>!(E.name===w&&E.parent===b)))},[]);d.useImperativeHandle(n1,()=>({getCompositions:()=>p.current}),[]);const g=d.useMemo(()=>({registerComposition:m,unregisterComposition:x,registerFolder:v,unregisterFolder:k,setCanvasContent:l,onlyRenderComposition:t}),[m,v,x,k,t]),y=d.useMemo(()=>({compositions:c,folders:i,currentCompositionMetadata:n,canvasContent:a}),[c,i,n,a]);return u.jsx(Fi.Provider,{value:y,children:u.jsx(Js.Provider,{value:g,children:e})})},r1={};xw(r1,{makeDefaultPreviewCSS:()=>nT,injectCSS:()=>tT,OBJECTFIT_CONTAIN_CLASS_NAME:()=>Vs});var Oa={},tT=e=>{if(typeof document>"u")return()=>{};if(Oa[e])return()=>{};const t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");return n.appendChild(document.createTextNode(e)),t.prepend(n),Oa[e]=n,()=>{const r=Oa[e];r&&(r.parentNode&&r.parentNode.removeChild(r),delete Oa[e])}},Vs="__remotion_objectfitcontain",nT=(e,t)=>e?`
|
|
58
|
-
${e} * {
|
|
59
|
-
box-sizing: border-box;
|
|
60
|
-
}
|
|
61
|
-
${e} *:-webkit-full-screen {
|
|
62
|
-
width: 100%;
|
|
63
|
-
height: 100%;
|
|
64
|
-
}
|
|
65
|
-
${e} .${Vs} {
|
|
66
|
-
object-fit: contain;
|
|
67
|
-
}
|
|
68
|
-
`:`
|
|
69
|
-
* {
|
|
70
|
-
box-sizing: border-box;
|
|
71
|
-
}
|
|
72
|
-
body {
|
|
73
|
-
margin: 0;
|
|
74
|
-
background-color: ${t};
|
|
75
|
-
}
|
|
76
|
-
.${Vs} {
|
|
77
|
-
object-fit: contain;
|
|
78
|
-
}
|
|
79
|
-
`,o1="__remotion-studio-container",rT=()=>document.getElementById(o1),oT=le.createContext(null),iT=null,zc=[],sT=()=>iT,aT=e=>(zc.push(e),()=>{zc=zc.filter(t=>t!==e)}),Xp=d.createContext(null),lT=()=>{const e=d.useContext(Xp);return!e||e.videoEnabled===null?window.remotion_videoEnabled:e.videoEnabled},uT=()=>{const e=d.useContext(Xp);return!e||e.audioEnabled===null?window.remotion_audioEnabled:e.audioEnabled},cT=({children:e,videoEnabled:t,audioEnabled:n})=>{const r=d.useMemo(()=>({videoEnabled:t,audioEnabled:n}),[t,n]);return u.jsx(Xp.Provider,{value:r,children:e})},dT=({children:e,numberOfAudioTags:t,logLevel:n,audioLatencyHint:r,previewSampleRate:o,videoEnabled:i,audioEnabled:s,frameState:a})=>{const l=d.useMemo(()=>{let f=0;return{getNonce:()=>f++}},[]),c=d.useMemo(()=>({logLevel:n,mountTime:Date.now()}),[n]);return u.jsx(Po.Provider,{value:c,children:u.jsx(ea.Provider,{value:l,children:u.jsx(aC,{frameState:a,children:u.jsx(cT,{videoEnabled:i,audioEnabled:s,children:u.jsx(Tw,{children:u.jsx(Fx,{children:u.jsx(pC,{children:u.jsx(Mx,{children:u.jsx(Ox,{children:u.jsx($x,{audioLatencyHint:r,audioEnabled:s,previewSampleRate:o,children:u.jsx(Ax,{numberOfAudioTags:t,children:e})})})})})})})})})})})},ag=["h264","h265","vp8","vp9","av1","mp3","aac","wav","prores","h264-mkv","h264-ts","gif"];function fT(e,t,n){if(!(typeof e>"u")){if(typeof e!="string")throw new TypeError(`The "${n}" prop ${t} must be a string, but you passed a value of type ${typeof e}.`);if(!ag.includes(e))throw new Error(`The "${n}" prop ${t} must be one of ${ag.join(", ")}, but you passed ${e}.`)}}var pT=({calculated:e,compositionId:t,compositionFps:n,compositionHeight:r,compositionWidth:o,compositionDurationInFrames:i})=>{const s=`calculated by calculateMetadata() for the composition "${t}"`,a=`of the "<Composition />" component with the id "${t}"`,l=(e==null?void 0:e.width)??o??void 0;Vl(l,"width",e!=null&&e.width?s:a);const c=(e==null?void 0:e.height)??r??void 0;Vl(c,"height",e!=null&&e.height?s:a);const f=(e==null?void 0:e.fps)??n??null;bu(f,e!=null&&e.fps?s:a);const p=(e==null?void 0:e.durationInFrames)??i??null;xu(p,{allowFloats:!1,component:`of the "<Composition />" component with the id "${t}"`});const h=e==null?void 0:e.defaultCodec;fT(h,s,"defaultCodec");const m=e==null?void 0:e.defaultOutName,x=e==null?void 0:e.defaultVideoImageFormat,v=e==null?void 0:e.defaultPixelFormat,k=e==null?void 0:e.defaultProResProfile,g=e==null?void 0:e.defaultSampleRate;return{width:l,height:c,fps:f,durationInFrames:p,defaultCodec:h,defaultOutName:m,defaultVideoImageFormat:x,defaultPixelFormat:v,defaultProResProfile:k,defaultSampleRate:g}},lg=({calculated:e,compositionDurationInFrames:t,compositionFps:n,compositionHeight:r,compositionId:o,compositionWidth:i,defaultProps:s,originalProps:a})=>{const l=pT({calculated:e,compositionDurationInFrames:t,compositionFps:n,compositionHeight:r,compositionWidth:i,compositionId:o});return{metadataSource:{durationInFrames:(e==null?void 0:e.durationInFrames)===void 0?"composition":"calculate-metadata",fps:(e==null?void 0:e.fps)===void 0?"composition":"calculate-metadata",height:(e==null?void 0:e.height)===void 0?"composition":"calculate-metadata",width:(e==null?void 0:e.width)===void 0?"composition":"calculate-metadata"},videoConfig:{...l,id:o,defaultProps:lf(s??{}),props:lf((e==null?void 0:e.props)??a),defaultCodec:l.defaultCodec??null,defaultOutName:l.defaultOutName??null,defaultVideoImageFormat:l.defaultVideoImageFormat??null,defaultPixelFormat:l.defaultPixelFormat??null,defaultProResProfile:l.defaultProResProfile??null,defaultSampleRate:l.defaultSampleRate??null}}},i1=({calculateMetadata:e,signal:t,defaultProps:n,inputProps:r,compositionId:o,compositionDurationInFrames:i,compositionFps:s,compositionHeight:a,compositionWidth:l})=>{const c=e?e({defaultProps:n,props:r,abortSignal:t,compositionId:o,isRendering:In().isRendering}):null;return c!==null&&typeof c=="object"&&"then"in c?c.then(f=>lg({calculated:f,compositionDurationInFrames:i,compositionFps:s,compositionHeight:a,compositionWidth:l,compositionId:o,defaultProps:n,originalProps:r})):lg({calculated:c,compositionDurationInFrames:i,compositionFps:s,compositionHeight:a,compositionWidth:l,compositionId:o,defaultProps:n,originalProps:r})},s1=e=>{const t=i1(e);return typeof t=="object"&&"then"in t?t.then(({videoConfig:n})=>n):t.videoConfig},hT=e=>{try{return{type:"success",result:i1(e)}}catch(t){return{type:"error",error:t}}},mT=e=>{try{return{type:"success",result:s1(e)}}catch(t){return{type:"error",error:t}}},gT=le.createContext(()=>{}),vT=()=>{if(In().isRendering){const e=window.remotion_envVariables;return e?{...JSON.parse(e),NODE_ENV:"production"}:{}}return{NODE_ENV:"production"}},yT=()=>{const e=vT();window.process||(window.process={}),window.process.env||(window.process.env={}),Object.keys(e).forEach(t=>{window.process.env[t]=e[t]})},wT=le.createContext(null),xT=d.createContext({setSize:()=>{},size:{size:"auto",translation:{x:0,y:0}}}),bT=({canvasSize:e,compositionHeight:t,compositionWidth:n,previewSize:r})=>{const o=e.height/t,i=e.width/n,s=Math.min(o,i);return r==="auto"?s===0?1:s:Number(r)},ST=le.createContext(null),kT=({src:e,transparent:t,currentTime:n,toneMapped:r})=>`http://localhost:${window.remotion_proxyPort}/proxy?src=${encodeURIComponent(or(e))}&time=${encodeURIComponent(Math.max(0,n))}&transparent=${String(t)}&toneMapped=${String(r)}`,ET=({onError:e,volume:t,playbackRate:n,src:r,muted:o,allowAmplificationDuringRender:i,transparent:s,toneMapped:a,toneFrequency:l,name:c,loopVolumeCurveBehavior:f,delayRenderRetries:p,delayRenderTimeoutInMilliseconds:h,onVideoFrame:m,crossOrigin:x,audioStreamIndex:v,preservePitch:k,...g})=>{const y=oo(),w=Pt(),b=zi(f),S=Cu(),E=d.useContext(wt),T=Eo(),{registerRenderAsset:I,unregisterRenderAsset:R}=d.useContext(_o);if(!r)throw new TypeError("No `src` was passed to <OffthreadVideo>.");const F=d.useMemo(()=>`offthreadvideo-${Fo(r)}-${E==null?void 0:E.cumulatedFrom}-${E==null?void 0:E.relativeFrom}-${E==null?void 0:E.durationInFrames}`,[r,E==null?void 0:E.cumulatedFrom,E==null?void 0:E.relativeFrom,E==null?void 0:E.durationInFrames]);if(!S)throw new Error("No video config found");const A=$o({volume:t,frame:b,mediaVolume:1});Bi(A),d.useEffect(()=>{if(!r)throw new Error("No src passed");if(window.remotion_audioEnabled&&!o&&!(A<=0))return I({type:"video",src:or(r),id:F,frame:y,volume:A,mediaFrame:w,playbackRate:n,toneFrequency:l,audioStartFrame:Math.max(0,-((E==null?void 0:E.cumulatedNegativeFrom)??0)),audioStreamIndex:v}),()=>R(F)},[o,r,I,F,R,A,w,y,n,l,E==null?void 0:E.cumulatedNegativeFrom,v]);const W=d.useMemo(()=>Wx({frame:w,playbackRate:n||1,startFrom:-T})/S.fps,[w,T,n,S.fps]),M=d.useMemo(()=>kT({src:r,currentTime:W,transparent:s,toneMapped:a}),[a,W,r,s]),[$,V]=d.useState(null),{delayRender:D,continueRender:L}=Hn();d.useLayoutEffect(()=>{if(!window.remotion_videoEnabled)return;const N=[];V(null);const B=new AbortController,z=D(`Fetching ${M} from server`,{retries:p??void 0,timeoutInMilliseconds:h??void 0});return(async()=>{try{const H=await fetch(M,{signal:B.signal,cache:"no-store"});if(H.status!==200){if(H.status===500){const X=await H.json();if(X.error){const ae=X.error.replace(/^Error: /,"");throw new Error(ae)}}throw new Error(`Server returned status ${H.status} while fetching ${M}`)}const G=await H.blob(),O=URL.createObjectURL(G);N.push(()=>URL.revokeObjectURL(O)),V({src:O,handle:z})}catch(H){if(H.message.includes("aborted")){L(z);return}if(B.signal.aborted){L(z);return}H.message.includes("Failed to fetch")&&(H=new Error(`Failed to fetch ${M}. This could be caused by Chrome rejecting the request because the disk space is low. Consider increasing the disk size of your environment.`,{cause:H})),e?e(H):Ws(H)}})(),N.push(()=>{B.signal.aborted||B.abort()}),()=>{N.forEach(H=>H())}},[M,p,h,e,L,D]);const j=d.useCallback(()=>{e?e==null||e(new Error("Failed to load image with src "+$)):Ws("Failed to load image with src "+$)},[$,e]),C=d.useMemo(()=>[Vs,g.className].filter(_i).join(" "),[g.className]),P=d.useCallback(N=>{m&&m(N)},[m]);return!$||!window.remotion_videoEnabled?null:(L($.handle),u.jsx(Yp,{src:$.src,delayRenderRetries:p,delayRenderTimeoutInMilliseconds:h,onImageFrame:P,...g,onError:j,className:C}))},a1=({ref:e,onVideoFrame:t})=>{d.useEffect(()=>{const{current:n}=e;if(!n||!t)return;let r=0;const o=(i,s)=>{e.current&&(t(e.current,i,s),r=e.current.requestVideoFrameCallback(o))};if(t(n),!!n.requestVideoFrameCallback)return r=n.requestVideoFrameCallback(o),()=>{r&&n.cancelVideoFrameCallback(r)}},[t,e])};class li extends Error{constructor({message:n,src:r}){super(n);Ae(this,"src");this.name="MediaPlaybackError",this.src=r}}var CT=(e,t)=>{const n=d.useContext(Di);if(!n)throw new Error("SharedAudioContext not found");const r=d.useRef(null),o=d.useMemo(()=>n.audioContext?Bp({audioContext:n.audioContext,ref:r}):null,[n.audioContext]);(le.useInsertionEffect??le.useLayoutEffect)(()=>()=>{requestAnimationFrame(()=>{o==null||o.cleanup()})},[o]);const{volume:s,muted:a,playbackRate:l,preservePitch:c,onlyWarnForMediaSeekingError:f,src:p,onDuration:h,acceptableTimeShift:m,acceptableTimeShiftInSeconds:x,toneFrequency:v,name:k,_remotionInternalNativeLoopPassed:g,_remotionInternalStack:y,style:w,pauseWhenBuffering:b,showInTimeline:S,loopVolumeCurveBehavior:E,onError:T,onAutoPlayError:I,onVideoFrame:R,crossOrigin:F,delayRenderRetries:A,delayRenderTimeoutInMilliseconds:W,allowAmplificationDuringRender:M,useWebAudioApi:$,audioStreamIndex:V,...D}=e,L=zi(E??"repeat"),{fps:j,durationInFrames:C}=ht(),P=d.useContext(wt),N=ir(),B=na(),[z]=d.useState(()=>String(Math.random()));if(typeof m<"u")throw new Error("acceptableTimeShift has been removed. Use acceptableTimeShiftInSeconds instead.");const[Z]=Up(),[H]=Zp(),G=$o({frame:L,volume:s,mediaVolume:Z});Bi(G);const O=d.useCallback(()=>y??null,[y]);Wp({volume:s,mediaVolume:Z,mediaType:"video",src:p,playbackRate:e.playbackRate??1,displayName:k??null,id:z,getStack:O,showInTimeline:S,premountDisplay:(P==null?void 0:P.premountDisplay)??null,postmountDisplay:(P==null?void 0:P.postmountDisplay)??null,loopDisplay:void 0,documentationLink:f?"https://www.remotion.dev/docs/offthreadvideo":"https://www.remotion.dev/docs/html5-video",refForOutline:r}),Hx({mediaRef:r,src:p,mediaType:"video",playbackRate:e.playbackRate??1,preservePitch:c,onlyWarnForMediaSeekingError:f,acceptableTimeshift:x??null,isPremounting:!!(P!=null&&P.premounting),isPostmounting:!!(P!=null&&P.postmounting),pauseWhenBuffering:b,onAutoPlayError:I??null}),Ux({id:z,isPostmounting:!!(P!=null&&P.postmounting),isPremounting:!!(P!=null&&P.premounting),mediaRef:r,mediaType:"video",onAutoPlayError:I??null}),Lx({logLevel:N,mediaRef:r,volume:G,source:o,shouldUseWebAudioApi:$??!1});const X=P?P.relativeFrom:0,ae=P?Math.min(P.durationInFrames,C):C,oe=Mo(p),Y=oI({actualSrc:oe,actualFrom:X,duration:ae,fps:j});d.useImperativeHandle(t,()=>r.current,[]),d.useState(()=>Lt({logLevel:N,message:`Mounting video with source = ${Y}, v=${cs}, user agent=${typeof navigator>"u"?"server":navigator.userAgent}`,tag:"video",mountTime:B})),d.useEffect(()=>{const{current:de}=r;if(!de)return;const K=()=>{var ee;if(de.error){if(console.error("Error occurred in video",de==null?void 0:de.error),T){const ue=new li({message:`Code ${de.error.code}: ${de.error.message}`,src:p});T(ue);return}throw new li({message:`The browser threw an error while playing the video ${p}: Code ${de.error.code} - ${(ee=de==null?void 0:de.error)==null?void 0:ee.message}. See https://remotion.dev/docs/media-playback-error for help. Pass an onError() prop to handle the error.`,src:p})}else{if(T){const ue=new li({message:`The browser threw an error while playing the video ${p}`,src:p});T(ue);return}throw new li({message:"The browser threw an error while playing the video",src:p})}};return de.addEventListener("error",K,{once:!0}),()=>{de.removeEventListener("error",K)}},[T,p]);const q=d.useRef(h);q.current=h,a1({ref:r,onVideoFrame:R}),d.useEffect(()=>{var ee;const{current:de}=r;if(!de)return;if(de.duration){(ee=q.current)==null||ee.call(q,p,de.duration);return}const K=()=>{var ue;(ue=q.current)==null||ue.call(q,p,de.duration)};return de.addEventListener("loadedmetadata",K),()=>{de.removeEventListener("loadedmetadata",K)}},[p]),d.useEffect(()=>{const{current:de}=r;de&&(Bu()?de.preload="metadata":de.preload="auto")},[]);const xe=d.useMemo(()=>({...w}),[w]),Se=Op({crossOrigin:F,requestsVideoFrame:!!R,isClientSideRendering:!1});return u.jsx("video",{...D,ref:r,muted:a||H||G<=0,playsInline:!0,src:Y,loop:g,style:xe,disableRemotePlayback:!0,crossOrigin:Se,controls:!1})},qp=d.forwardRef(CT),Qp=e=>{const{startFrom:t,endAt:n,trimBefore:r,trimAfter:o,name:i,pauseWhenBuffering:s,stack:a,showInTimeline:l,...c}=e,f=ct(),p=oa(s);if(f.isClientSideRendering)throw new Error("<OffthreadVideo> is not supported in @remotion/web-renderer. Use <Video> from @remotion/media instead. See https://remotion.dev/docs/client-side-rendering/limitations");const h=d.useCallback(()=>{},[]);if(typeof e.src!="string")throw new TypeError(`The \`<OffthreadVideo>\` tag requires a string for \`src\`, but got ${JSON.stringify(e.src)} instead.`);Du({startFrom:t,endAt:n,trimBefore:r,trimAfter:o});const{trimBeforeValue:m,trimAfterValue:x}=zu({startFrom:t,endAt:n,trimBefore:r,trimAfter:o});if(typeof m<"u"||typeof x<"u")return u.jsx(Ft,{layout:"none",from:0-(m??0),showInTimeline:!1,durationInFrames:x,name:i,children:u.jsx(Qp,{pauseWhenBuffering:p,...c,trimAfter:void 0,name:void 0,showInTimeline:l,trimBefore:void 0,stack:void 0,startFrom:void 0,endAt:void 0})});if(Lu(e,"Video"),f.isRendering)return u.jsx(ET,{pauseWhenBuffering:p,...c,trimAfter:void 0,name:void 0,showInTimeline:l,trimBefore:void 0,stack:void 0,startFrom:void 0,endAt:void 0});const{transparent:v,toneMapped:k,onAutoPlayError:g,onVideoFrame:y,crossOrigin:w,delayRenderRetries:b,delayRenderTimeoutInMilliseconds:S,...E}=c;return u.jsx(qp,{_remotionInternalStack:a??null,onDuration:h,onlyWarnForMediaSeekingError:!0,pauseWhenBuffering:p,showInTimeline:l??!0,onAutoPlayError:g??void 0,onVideoFrame:y??null,crossOrigin:w,...E,_remotionInternalNativeLoopPassed:!1})},l1=({src:e,acceptableTimeShiftInSeconds:t,allowAmplificationDuringRender:n,audioStreamIndex:r,crossOrigin:o,delayRenderRetries:i,delayRenderTimeoutInMilliseconds:s,loopVolumeCurveBehavior:a,muted:l,name:c,onAutoPlayError:f,onError:p,onVideoFrame:h,pauseWhenBuffering:m,playbackRate:x,preservePitch:v,showInTimeline:k,style:g,toneFrequency:y,toneMapped:w,transparent:b,trimAfter:S,trimBefore:E,useWebAudioApi:T,volume:I,_remotionInternalNativeLoopPassed:R,endAt:F,stack:A,startFrom:W,imageFormat:M,...$})=>{if(M)throw new TypeError("The `<OffthreadVideo>` tag does no longer accept `imageFormat`. Use the `transparent` prop if you want to render a transparent video.");return u.jsx(Qp,{acceptableTimeShiftInSeconds:t,allowAmplificationDuringRender:n??!0,audioStreamIndex:r??0,crossOrigin:o,delayRenderRetries:i,delayRenderTimeoutInMilliseconds:s,loopVolumeCurveBehavior:a??"repeat",muted:l??!1,name:c,onAutoPlayError:f??null,onError:p,onVideoFrame:h,pauseWhenBuffering:oa(m),playbackRate:x??1,preservePitch:v,toneFrequency:y??1,showInTimeline:k??!0,src:e,stack:A,startFrom:W,_remotionInternalNativeLoopPassed:R??!1,endAt:F,style:g,toneMapped:w??!0,transparent:b??!1,trimAfter:S,trimBefore:E,useWebAudioApi:T??!1,volume:I,...$})};Ut(l1);var IT="remotion_staticFilesChanged";function TT(){const e=le.useContext(Fi),t=le.useContext($i),n=le.useContext(Mi),r=le.useContext(wt),o=le.useContext(ea),i=le.useContext(jo),s=le.useContext(Nu),a=le.useContext(Su),l=le.useContext(_o),c=le.useContext(Ni),f=le.useContext(Tu),p=le.useContext(ju),h=le.useContext(Oi),m=le.useContext(Po);return d.useMemo(()=>({compositionManagerCtx:e,timelineContext:t,setTimelineContext:n,sequenceContext:r,nonceContext:o,canUseRemotionHooksContext:i,preloadContext:s,resolveCompositionContext:a,renderAssetManagerContext:l,sequenceManagerContext:c,sequenceManagerRefContext:f,visualModePropStatusesRefContext:p,bufferManagerContext:h,logLevelContext:m}),[e,o,r,n,t,i,s,a,l,c,f,p,h,m])}var RT=e=>{const{children:t,contexts:n}=e;return u.jsx(Po.Provider,{value:n.logLevelContext,children:u.jsx(jo.Provider,{value:n.canUseRemotionHooksContext,children:u.jsx(ea.Provider,{value:n.nonceContext,children:u.jsx(Nu.Provider,{value:n.preloadContext,children:u.jsx(Fi.Provider,{value:n.compositionManagerCtx,children:u.jsx(Tu.Provider,{value:n.sequenceManagerRefContext,children:u.jsx(Ni.Provider,{value:n.sequenceManagerContext,children:u.jsx(ju.Provider,{value:n.visualModePropStatusesRefContext,children:u.jsx(_o.Provider,{value:n.renderAssetManagerContext,children:u.jsx(Su.Provider,{value:n.resolveCompositionContext,children:u.jsx($i.Provider,{value:n.timelineContext,children:u.jsx(Mi.Provider,{value:n.setTimelineContext,children:u.jsx(wt.Provider,{value:n.sequenceContext,children:u.jsx(Oi.Provider,{value:n.bufferManagerContext,children:t})})})})})})})})})})})})})})},jT=d.createRef(),me={MaxMediaCacheSizeContext:oT,useUnsafeVideoConfig:Cu,useFrameForVolumeProp:zi,useTimelinePosition:oo,useAbsoluteTimelinePosition:Vw,evaluateVolume:$o,getAbsoluteSrc:or,getAnimatedImageDurationInSeconds:JI,getAssetDisplayName:Dx,Timeline:df,validateMediaTrimProps:Du,validateMediaProps:Lu,resolveTrimProps:zu,VideoForPreview:qp,CompositionManager:Fi,CompositionSetters:Js,VisualModePropStatusesContext:Ru,VisualModePropStatusesRefContext:ju,VisualModeDragOverridesContext:Pu,VisualModeSettersContext:Qw,SequenceManager:Ni,SequenceManagerRefContext:Tu,SequenceStackTracesUpdateContext:gT,baseSchema:Er,sequenceSchema:Ii,SequenceWithoutSchema:bx,sequenceStyleSchema:Yw,sequenceVisualStyleSchema:lC,sequencePremountSchema:Kw,textSchema:Iu,transformSchema:sr,premountSchema:Ai,flattenActiveSchema:Lp,getFlatSchemaWithAllKeys:Dp,RemotionRootContexts:dT,CompositionManagerProvider:eT,useVideo:Eu,getRoot:sT,useMediaVolumeState:Up,usePlayerMutedState:Zp,useMediaInTimeline:Wp,useLazyComponent:Mw,truthy:_i,SequenceContext:wt,PremountContext:ex,usePremounting:ia,useRemotionContexts:TT,RemotionContextProvider:RT,CSSUtils:r1,setupEnvVariables:yT,MediaVolumeContext:Vp,SetMediaVolumeContext:Hp,getRemotionEnvironment:In,SharedAudioContext:Di,SharedAudioContextProvider:$x,SharedAudioTagsContext:Ou,SharedAudioTagsContextProvider:Ax,invalidCompositionErrorMessage:qE,invalidFolderNameErrorMessage:xE,calculateMediaDuration:$u,isCompositionIdValid:Aw,isFolderNameValid:kw,getPreviewDomElement:rT,compositionsRef:n1,portalNode:uf,waitForRoot:aT,SetTimelineContext:Mi,CanUseRemotionHooksProvider:of,CanUseRemotionHooks:jo,PrefetchProvider:Fx,DurationsContextProvider:Mx,IsPlayerContextProvider:EE,useIsPlayer:kp,EditorPropsProvider:Tw,EditorPropsContext:Ep,usePreload:Mo,NonceContext:ea,resolveVideoConfig:s1,resolveVideoConfigOrCatch:mT,resolveVideoConfigWithMetadataOrCatch:hT,ResolveCompositionContext:Su,useResolvedVideoConfig:Cp,resolveCompositionsRef:$E,REMOTION_STUDIO_CONTAINER_ELEMENT:o1,RenderAssetManager:_o,persistCurrentFrame:Dw,usePlaybackRate:Pp,useTimelineContext:ro,useTimelineSetFrame:Hw,isIosSafari:Bu,WATCH_REMOTION_STATIC_FILES:IT,addSequenceStackTraces:Ut,useMediaStartsAt:Eo,BufferingProvider:Ox,BufferingContextReact:Oi,getComponentsToAddStacksTo:tC,getSequenceComponent:rC,getSingleChildComponent:oC,CurrentScaleContext:wT,PixelDensityContext:ST,PreviewSizeContext:xT,calculateScale:bT,validateRenderAsset:jx,Log:St,LogLevelContext:Po,useLogLevel:ir,playbackLogging:Lt,timeValueRef:ME,compositionSelectorRef:jT,RemotionEnvironmentContext:Rw,warnAboutTooHighVolume:Bi,AudioForPreview:Zx,OBJECTFIT_CONTAIN_CLASS_NAME:Vs,InnerOffthreadVideo:Qp,useBasicMediaInTimeline:zx,getInputPropsOverride:Iw,setInputPropsOverride:PE,useVideoEnabled:lT,useAudioEnabled:uT,useIsPlayerBuffering:Bx,TimelinePosition:df,DelayRenderContextType:_w,TimelineContext:$i,PlaybackRateContext:Tp,AbsoluteTimeContext:Rp,RenderAssetManagerProvider:B2,getEffectiveVisualModeValue:px,CompositionRenderErrorContext:bw,useEffectChainState:ca,createEffectChainState:Cx,cleanupEffectChainState:pf,runEffectChain:ua,useMemoizedEffects:la,useMemoizedEffectDefinitions:aa,createEffect:D2,createWebGLContextError:S2,createWebGL2ContextError:Ex,computeEffectiveSchemaValuesDotNotation:yx,interpolateKeyframedStatus:sa,makeStaticDragOverride:u2,makeKeyframedDragOverride:c2,resolveDragOverrideValue:_u,getStaticDragOverrideValue:d2,OverrideIdsToNodePathsGettersContext:Np,OverrideIdsToNodePathsSettersContext:i2,findPropsToDelete:gx,makeSequencePropsSubscriptionKey:hr,getPropStatusesCtx:mx,getEffectPropStatusesCtx:hx,hiddenField:Fp,durationInFramesField:Mp,freezeField:$p,fromField:Xw},u1=e=>le.Children.toArray(e).reduce((n,r)=>r.type===le.Fragment?n.concat(u1(r.props.children)):(n.push(r),n),[]),PT={durationInFrames:Mr.baseSchema.durationInFrames,name:Mr.sequenceSchema.name,hidden:Mr.sequenceSchema.hidden,showInTimeline:Mr.sequenceSchema.showInTimeline,freeze:Mr.baseSchema.freeze,trimBefore:Mr.sequenceSchema.trimBefore,layout:Mr.sequenceSchema.layout},FT=d.forwardRef(({offset:e=0,className:t="",stack:n=null,_remotionInternalRender:r=null,...o},i)=>(mC(),r?r({...o,offset:e,className:t||void 0,stack:n},i):u.jsx(Jw,{children:o.children}))),c1=Mr.withSchema({Component:FT,componentName:"<Series.Sequence>",componentIdentity:"dev.remotion.remotion.Series.Sequence",schema:PT,supportsEffects:!1}),_T=bx,ug=({durationInFrames:e,offset:t,index:n,childrenLength:r})=>{const o=`index = ${n}, duration = ${e}`;(n!==r-1||e!==1/0)&&xu(e,{component:"of a <Series.Sequence /> component",allowFloats:!0});const i=t??0;if(Number.isNaN(i))throw new TypeError(`The "offset" property of a <Series.Sequence /> must not be NaN, but got NaN (${o}).`);if(!Number.isFinite(i))throw new TypeError(`The "offset" property of a <Series.Sequence /> must be finite, but got ${i} (${o}).`);if(i%1!==0)throw new TypeError(`The "offset" property of a <Series.Sequence /> must be finite, but got ${i} (${o}).`);return i},MT=e=>{const t=d.useMemo(()=>{const n=u1(e.children),r=(o,i)=>{if(o===n.length)return null;const a=n[o];if(typeof a=="string"){if(a.trim()==="")return r(o+1,i);throw new TypeError(`The <Series /> component only accepts a list of <Series.Sequence /> components as its children, but you passed a string "${a}"`)}if(a.type!==c1)throw new TypeError(`The <Series /> component only accepts a list of <Series.Sequence /> components as its children, but got ${a} instead`);const l=a;return ug({durationInFrames:l.props.durationInFrames,offset:l.props.offset,index:o,childrenLength:n.length}),le.cloneElement(l,{_remotionInternalRender:(c,f)=>{const p=c.durationInFrames,{durationInFrames:h,children:m,offset:x,controls:v,stack:k,from:g,name:y,...w}=c,b=ug({durationInFrames:p,offset:x,index:o,childrenLength:n.length}),S=i+b,E=i+p+b;return u.jsxs(u.Fragment,{children:[u.jsx(_T,{ref:f,name:y||"<Series.Sequence>",_remotionInternalDocumentationLink:y?void 0:"https://www.remotion.dev/docs/series",_remotionInternalStack:k??void 0,controls:v??void 0,from:S,durationInFrames:p,...w,children:u.jsx(Jw,{children:m})}),r(o+1,E)]})}})};return r(0,0)},[e.children]);return u.jsx(hC,{children:u.jsx(Ft,{layout:"none",name:"<Series>",_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/series",...e,children:t})})},$T=Object.assign(Cr({Component:MT,componentName:"<Series>",componentIdentity:"dev.remotion.remotion.Series",schema:fC,supportsEffects:!1}),{Sequence:c1});Ut($T);var AT={"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";"},cg={},NT=e=>{cg[e]||(console.warn(e),cg[e]=!0)},LT=e=>{for(const t of Object.keys(AT))if(e.includes(t))return{containsHex:!0,hexCode:t};return{containsHex:!1}},vf=e=>e.startsWith("/")?vf(e.substring(1)):e,DT=e=>{if(typeof window<"u"&&window.remotion_staticBase){if(e.startsWith(window.remotion_staticBase))throw new Error(`The value "${e}" is already prefixed with the static base ${window.remotion_staticBase}. You don't need to call staticFile() on it.`);return`${window.remotion_staticBase}/${vf(e)}`}return`/${vf(e)}`},zT=e=>e.split("/").map(o=>encodeURIComponent(o)).join("/"),Jp=e=>{if(e===null)throw new TypeError("null was passed to staticFile()");if(typeof e>"u")throw new TypeError("undefined was passed to staticFile()");if(e.startsWith("http://")||e.startsWith("https://"))throw new TypeError(`staticFile() does not support remote URLs - got "${e}". Instead, pass the URL without wrapping it in staticFile(). See: https://remotion.dev/docs/staticfile-remote-urls`);if(e.startsWith("..")||e.startsWith("./"))throw new TypeError(`staticFile() does not support relative paths - got "${e}". Instead, pass the name of a file that is inside the public/ folder. See: https://remotion.dev/docs/staticfile-relative-paths`);if(e.startsWith("/Users")||e.startsWith("/home")||e.startsWith("/tmp")||e.startsWith("/etc")||e.startsWith("/opt")||e.startsWith("/var")||e.startsWith("C:")||e.startsWith("D:")||e.startsWith("E:"))throw new TypeError(`staticFile() does not support absolute paths - got "${e}". Instead, pass the name of a file that is inside the public/ folder. See: https://remotion.dev/docs/staticfile-relative-paths`);if(e.startsWith("public/"))throw new TypeError(`Do not include the public/ prefix when using staticFile() - got "${e}". See: https://remotion.dev/docs/staticfile-relative-paths`);const t=LT(e);t.containsHex&&NT(`WARNING: You seem to pass an already encoded path (path contains ${t.hexCode}). Since Remotion 4.0, the encoding is done by staticFile() itself. You may want to remove a encodeURIComponent() wrapping.`);const n=zT(e),r=DT(n);return r.startsWith("/")?r:`/${r}`},OT=e=>{const t={...e,durationInFrames:1,fps:1};return le.createElement(Hl,t)};Ut(OT);var dg=e=>Math.round(e*1e5)/1e5,Oc=({element:e,desiredTime:t,logLevel:n,mountTime:r})=>{if(Yl(e.currentTime,t))return{wait:Promise.resolve(t),cancel:()=>{}};ml({logLevel:n,mediaRef:e,time:t,why:"Seeking during rendering",mountTime:r});let o,i=null;const s=new Promise(l=>{o=e.requestVideoFrameCallback((c,f)=>{const p=f.expectedDisplayTime-c;if(p<=0){l(f.mediaTime);return}setTimeout(()=>{l(f.mediaTime)},p+150)})}),a=new Promise(l=>{const c=()=>{l()};e.addEventListener("seeked",c,{once:!0}),i=()=>{e.removeEventListener("seeked",c)}});return{wait:Promise.all([s,a]).then(([l])=>l),cancel:()=>{i==null||i(),e.cancelVideoFrameCallback(o)}}},BT=({element:e,desiredTime:t,fps:n,logLevel:r,mountTime:o})=>{const i=1/n/2;let s=()=>{};return Number.isFinite(e.duration)&&e.currentTime>=e.duration&&t>=e.duration?{prom:Promise.resolve(),cancel:()=>{}}:{prom:new Promise((l,c)=>{const f=Oc({element:e,desiredTime:t+i,logLevel:r,mountTime:o});f.wait.then(p=>{if(Math.abs(t-p)<=i)return l();const m=t>p?1:-1,x=Oc({element:e,desiredTime:p+i*m,logLevel:r,mountTime:o});s=x.cancel,x.wait.then(v=>{const k=Math.abs(t-v);if(dg(k)<=dg(i))return l();const g=Oc({element:e,desiredTime:t+i,logLevel:r,mountTime:o});return s=g.cancel,g.wait.then(()=>{l()}).catch(y=>{c(y)})}).catch(v=>{c(v)})}),s=f.cancel}),cancel:()=>{s()}}},WT=({onError:e,volume:t,allowAmplificationDuringRender:n,playbackRate:r,onDuration:o,toneFrequency:i,name:s,acceptableTimeShiftInSeconds:a,delayRenderRetries:l,delayRenderTimeoutInMilliseconds:c,loopVolumeCurveBehavior:f,audioStreamIndex:p,onVideoFrame:h,preservePitch:m,...x},v)=>{const k=oo(),g=Pt(),y=zi(f??"repeat"),w=Cu(),b=d.useRef(null),S=d.useContext(wt),E=Eo(),T=ct(),I=ir(),R=na(),{delayRender:F,continueRender:A}=Hn(),{registerRenderAsset:W,unregisterRenderAsset:M}=d.useContext(_o),$=d.useMemo(()=>`video-${Fo(x.src??"")}-${S==null?void 0:S.cumulatedFrom}-${S==null?void 0:S.relativeFrom}-${S==null?void 0:S.durationInFrames}`,[x.src,S==null?void 0:S.cumulatedFrom,S==null?void 0:S.relativeFrom,S==null?void 0:S.durationInFrames]);if(!w)throw new Error("No video config found");const V=$o({volume:t,frame:y,mediaVolume:1});Bi(V),d.useEffect(()=>{if(!x.src)throw new Error("No src passed");if(!x.muted&&!(V<=0)&&window.remotion_audioEnabled)return W({type:"video",src:or(x.src),id:$,frame:k,volume:V,mediaFrame:g,playbackRate:r??1,toneFrequency:i??1,audioStartFrame:Math.max(0,-((S==null?void 0:S.cumulatedNegativeFrom)??0)),audioStreamIndex:p??0}),()=>M($)},[x.muted,x.src,W,$,M,V,g,k,r,i,S==null?void 0:S.cumulatedNegativeFrom,p]),d.useImperativeHandle(v,()=>b.current,[]),a1({ref:b,onVideoFrame:h}),d.useEffect(()=>{var z,Z;if(!window.remotion_videoEnabled)return;const{current:L}=b;if(!L)return;const j=Vx({frame:g,playbackRate:r||1,startFrom:-E,fps:w.fps}),C=F(`Rendering <Html5Video /> with src="${x.src}" at time ${j}`,{retries:l??void 0,timeoutInMilliseconds:c??void 0});if(((Z=(z=window.process)==null?void 0:z.env)==null?void 0:Z.NODE_ENV)==="test"){A(C);return}if(Yl(L.currentTime,j)){if(L.readyState>=2){A(C);return}const H=()=>{A(C)};return L.addEventListener("loadeddata",H,{once:!0}),()=>{L.removeEventListener("loadeddata",H)}}const P=()=>{A(C)},N=BT({element:L,desiredTime:j,fps:w.fps,logLevel:I,mountTime:R});N.prom.then(()=>{A(C)}),L.addEventListener("ended",P,{once:!0});const B=()=>{var H;if(L!=null&&L.error){if(console.error("Error occurred in video",L==null?void 0:L.error),e)return;throw new li({message:`The browser threw an error while playing the video ${x.src}: Code ${L.error.code} - ${(H=L==null?void 0:L.error)==null?void 0:H.message}. See https://remotion.dev/docs/media-playback-error for help. Pass an onError() prop to handle the error.`,src:x.src})}else throw new li({message:"The browser threw an error",src:x.src})};return L.addEventListener("error",B,{once:!0}),()=>{N.cancel(),L.removeEventListener("ended",P),L.removeEventListener("error",B),A(C)}},[y,x.src,r,w.fps,g,E,e,l,c,I,R,A,F]);const{src:D}=x;return T.isRendering&&d.useLayoutEffect(()=>{var P,N;if(((N=(P=window.process)==null?void 0:P.env)==null?void 0:N.NODE_ENV)==="test")return;const L=F("Loading <Html5Video> duration with src="+D,{retries:l??void 0,timeoutInMilliseconds:c??void 0}),{current:j}=b,C=()=>{j!=null&&j.duration&&o(D,j.duration),A(L)};return j!=null&&j.duration?(o(D,j.duration),A(L)):j==null||j.addEventListener("loadedmetadata",C,{once:!0}),()=>{j==null||j.removeEventListener("loadedmetadata",C),A(L)}},[D,o,l,c,A,F]),u.jsx("video",{ref:b,disableRemotePlayback:!0,...x})},VT=d.forwardRef(WT),HT=(e,t)=>{const{startFrom:n,endAt:r,trimBefore:o,trimAfter:i,name:s,pauseWhenBuffering:a,stack:l,_remotionInternalNativeLoopPassed:c,showInTimeline:f,onAutoPlayError:p,onVideoFrame:h,...m}=e,{loop:x,...v}=e,{fps:k}=ht(),g=ct(),y=oa(a);if(g.isClientSideRendering)throw new Error("<Html5Video> is not supported in @remotion/web-renderer. Use <Video> from @remotion/media instead. See https://remotion.dev/docs/client-side-rendering/limitations");const{durations:w,setDurations:b}=d.useContext(zp);if(typeof t=="string")throw new Error("string refs are not supported");if(typeof e.src!="string")throw new TypeError(`The \`<Html5Video>\` tag requires a string for \`src\`, but got ${JSON.stringify(e.src)} instead.`);const S=Mo(e.src),E=d.useCallback((F,A)=>{b({type:"got-duration",durationInSeconds:A,src:F})},[b]),T=w[or(S)]??w[or(e.src)];Du({startFrom:n,endAt:r,trimBefore:o,trimAfter:i});const{trimBeforeValue:I,trimAfterValue:R}=zu({startFrom:n,endAt:r,trimBefore:o,trimAfter:i});if(x&&T!==void 0){if(!Number.isFinite(T))return u.jsx(vl,{...v,ref:t,stack:l,_remotionInternalNativeLoopPassed:!0});const F=T*k;return u.jsx(Au,{durationInFrames:$u({trimAfter:R,mediaDurationInFrames:F,playbackRate:e.playbackRate??1,trimBefore:I}),layout:"none",name:s,showInTimeline:!1,children:u.jsx(vl,{...v,ref:t,stack:l,_remotionInternalNativeLoopPassed:!0})})}return typeof I<"u"||typeof R<"u"?u.jsx(Ft,{layout:"none",from:0-(I??0),showInTimeline:!1,durationInFrames:R===void 0?void 0:R/(e.playbackRate??1),name:s,children:u.jsx(vl,{pauseWhenBuffering:y,onVideoFrame:h,...m,ref:t,stack:l})}):(Lu({playbackRate:e.playbackRate,preservePitch:e.preservePitch,volume:e.volume},"Html5Video"),g.isRendering?u.jsx(VT,{onDuration:E,onVideoFrame:h??null,...m,ref:t}):u.jsx(qp,{onlyWarnForMediaSeekingError:!1,...m,ref:t,onVideoFrame:h??null,pauseWhenBuffering:y,onDuration:E,_remotionInternalStack:l??null,_remotionInternalNativeLoopPassed:c??!1,showInTimeline:f??!0,onAutoPlayError:p??void 0}))},vl=d.forwardRef(HT);Ut(vl);iC();var UT={},ZT=new Proxy(UT,{get(e,t){return t==="Bundling"||t==="Rendering"||t==="Log"||t==="Puppeteer"||t==="Output"?ZT:()=>{console.warn("⚠️ The CLI configuration has been extracted from Remotion Core."),console.warn("Update the import from the config file:"),console.warn(),console.warn("- Delete:"),console.warn('import {Config} from "remotion";'),console.warn("+ Replace:"),console.warn('import {Config} from "@remotion/cli/config";'),console.warn(),console.warn("For more information, see https://www.remotion.dev/docs/4-0-migration."),process.exit(1)}}});Ft.displayName="Sequence";Ut(Ft);nC(Ft);Ut(Hl);Ut(bE);typeof window<"u"&&(window.remotion_renderReady=!1,window.remotion_delayRenderTimeouts||(window.remotion_delayRenderTimeouts={}),window.remotion_delayRenderHandles=[]);var KT={"style.transformOrigin":{type:"transform-origin",step:1,default:"50% 50%",description:"Transform origin"},"style.translate":{type:"translate",step:1,default:"0px 0px",description:"Offset"},"style.scale":{type:"scale",max:100,step:.01,default:1,description:"Scale",defaultKeyframeOutput:"perceptual-scale"},"style.rotate":{type:"rotation-css",step:1,default:"0deg",description:"Rotation"},"style.opacity":{type:"number",min:0,max:1,step:.01,default:1,description:"Opacity",hiddenFromList:!1}},YT={"style.borderWidth":{type:"number",default:void 0,min:0,step:1,description:"Border width",hiddenFromList:!1},"style.borderStyle":{type:"enum",default:"none",description:"Border style",variants:{none:{},hidden:{},solid:{},dashed:{},dotted:{},double:{},groove:{},ridge:{},inset:{},outset:{}}},"style.borderColor":{type:"color",default:void 0,description:"Border color"}},GT={"style.backgroundColor":{type:"color",default:"transparent",description:"Color"}},XT={premountFor:{type:"number",default:0,description:"Premount For",min:0,step:1,hiddenFromList:!1,keyframable:!1},postmountFor:{type:"number",default:0,min:0,step:1,hiddenFromList:!0,keyframable:!1}},qT={...XT},QT={...KT,...GT,...YT,...qT},JT={layout:{type:"enum",default:"absolute-fill",description:"Layout",variants:{"absolute-fill":QT,none:{}}}};({...JT.layout});var eR=(e,t,n)=>{if(e){if(typeof e!="object")throw new Error(`"${t}" must be an object, but you passed a value of type ${typeof e}`);if(Array.isArray(e))throw new Error(`"${t}" must be an object, an array was passed ${n?`for composition "${n}"`:""}`)}};function tR(e,t,n){if(typeof e!="number")throw new Error(`The "${t}" prop ${n} must be a number, but you passed a value of type ${typeof e}`);if(isNaN(e))throw new TypeError(`The "${t}" prop ${n} must not be NaN, but is NaN.`);if(!Number.isFinite(e))throw new TypeError(`The "${t}" prop ${n} must be finite, but is ${e}.`);if(e%1!==0)throw new TypeError(`The "${t}" prop ${n} must be an integer, but is ${e}.`);if(e<=0)throw new TypeError(`The "${t}" prop ${n} must be positive, but got ${e}.`)}function nR(e,t){const{allowFloats:n,component:r}=t;if(typeof e>"u")throw new Error(`The "durationInFrames" prop ${r} is missing.`);if(typeof e!="number")throw new Error(`The "durationInFrames" prop ${r} must be a number, but you passed a value of type ${typeof e}`);if(e<=0)throw new TypeError(`The "durationInFrames" prop ${r} must be positive, but got ${e}.`);if(!n&&e%1!==0)throw new TypeError(`The "durationInFrames" prop ${r} must be an integer, but got ${e}.`);if(!Number.isFinite(e))throw new TypeError(`The "durationInFrames" prop ${r} must be finite, but got ${e}.`)}function rR(e,t,n){if(typeof e!="number")throw new Error(`"fps" must be a number, but you passed a value of type ${typeof e} ${t}`);if(!Number.isFinite(e))throw new Error(`"fps" must be a finite, but you passed ${e} ${t}`);if(isNaN(e))throw new Error(`"fps" must not be NaN, but got ${e} ${t}`);if(e<=0)throw new TypeError(`"fps" must be positive, but got ${e} ${t}`);if(n&&e>50)throw new TypeError("The FPS for a GIF cannot be higher than 50. Use the --every-nth-frame option to lower the FPS: https://remotion.dev/docs/render-as-gif")}var Vu={validateFps:rR,validateDimension:tR,validateDurationInFrames:nR,validateDefaultAndInputProps:eR};if(typeof d.createContext!="function"){const e=['Remotion requires React.createContext, but it is "undefined".','If you are in a React Server Component, turn it into a client component by adding "use client" at the top of the file.',"","Before:",' import {Player} from "@remotion/player";',"","After:",' "use client";',' import {Player} from "@remotion/player";'];throw new Error(e.join(`
|
|
80
|
-
`))}var Rt=25,yf=16,oR=()=>u.jsx("svg",{width:Rt,height:Rt,viewBox:"0 0 25 25",fill:"none",children:u.jsx("path",{d:"M8 6.375C7.40904 8.17576 7.06921 10.2486 7.01438 12.3871C6.95955 14.5255 7.19163 16.6547 7.6875 18.5625C9.95364 18.2995 12.116 17.6164 14.009 16.5655C15.902 15.5147 17.4755 14.124 18.6088 12.5C17.5158 10.8949 15.9949 9.51103 14.1585 8.45082C12.3222 7.3906 10.2174 6.68116 8 6.375Z",fill:"white",stroke:"white",strokeWidth:"6.25",strokeLinejoin:"round"})}),iR=()=>u.jsxs("svg",{viewBox:"0 0 100 100",width:Rt,height:Rt,children:[u.jsx("rect",{x:"25",y:"20",width:"20",height:"60",fill:"#fff",ry:"5",rx:"5"}),u.jsx("rect",{x:"55",y:"20",width:"20",height:"60",fill:"#fff",ry:"5",rx:"5"})]}),sR=({isFullscreen:e})=>{const r=e?0:3,o=e?6*1.6:6/2,i=e?6*1.6:6*2;return u.jsxs("svg",{viewBox:"0 0 32 32",height:yf,width:yf,children:[u.jsx("path",{d:`
|
|
81
|
-
M ${r} ${i}
|
|
82
|
-
L ${o} ${o}
|
|
83
|
-
L ${i} ${r}
|
|
84
|
-
`,stroke:"#fff",strokeWidth:6,fill:"none"}),u.jsx("path",{d:`
|
|
85
|
-
M ${32-r} ${i}
|
|
86
|
-
L ${32-o} ${o}
|
|
87
|
-
L ${32-i} ${r}
|
|
88
|
-
`,stroke:"#fff",strokeWidth:6,fill:"none"}),u.jsx("path",{d:`
|
|
89
|
-
M ${r} ${32-i}
|
|
90
|
-
L ${o} ${32-o}
|
|
91
|
-
L ${i} ${32-r}
|
|
92
|
-
`,stroke:"#fff",strokeWidth:6,fill:"none"}),u.jsx("path",{d:`
|
|
93
|
-
M ${32-r} ${32-i}
|
|
94
|
-
L ${32-o} ${32-o}
|
|
95
|
-
L ${32-i} ${32-r}
|
|
96
|
-
`,stroke:"#fff",strokeWidth:6,fill:"none"})]})},aR=()=>u.jsx("svg",{width:Rt,height:Rt,viewBox:"0 0 24 24",children:u.jsx("path",{d:"M3.63 3.63a.996.996 0 000 1.41L7.29 8.7 7 9H4c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h3l3.29 3.29c.63.63 1.71.18 1.71-.71v-4.17l4.18 4.18c-.49.37-1.02.68-1.6.91-.36.15-.58.53-.58.92 0 .72.73 1.18 1.39.91.8-.33 1.55-.77 2.22-1.31l1.34 1.34a.996.996 0 101.41-1.41L5.05 3.63c-.39-.39-1.02-.39-1.42 0zM19 12c0 .82-.15 1.61-.41 2.34l1.53 1.53c.56-1.17.88-2.48.88-3.87 0-3.83-2.4-7.11-5.78-8.4-.59-.23-1.22.23-1.22.86v.19c0 .38.25.71.61.85C17.18 6.54 19 9.06 19 12zm-8.71-6.29l-.17.17L12 7.76V6.41c0-.89-1.08-1.33-1.71-.7zM16.5 12A4.5 4.5 0 0014 7.97v1.79l2.48 2.48c.01-.08.02-.16.02-.24z",fill:"#fff"})}),lR=()=>u.jsx("svg",{width:Rt,height:Rt,viewBox:"0 0 24 24",children:u.jsx("path",{d:"M3 10v4c0 .55.45 1 1 1h3l3.29 3.29c.63.63 1.71.18 1.71-.71V6.41c0-.89-1.08-1.34-1.71-.71L7 9H4c-.55 0-1 .45-1 1zm13.5 2A4.5 4.5 0 0014 7.97v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 4.45v.2c0 .38.25.71.6.85C17.18 6.53 19 9.06 19 12s-1.82 5.47-4.4 6.5c-.36.14-.6.47-.6.85v.2c0 .63.63 1.07 1.21.85C18.6 19.11 21 15.84 21 12s-2.4-7.11-5.79-8.4c-.58-.23-1.21.22-1.21.85z",fill:"#fff"})}),fg="__remotion_buffering_indicator",pg="__remotion_buffering_animation",uR={width:Rt,height:Rt,overflow:"hidden",lineHeight:"normal",fontSize:"inherit"},cR={width:14,height:14,overflow:"hidden",lineHeight:"normal",fontSize:"inherit"},dR=({type:e})=>{const t=e==="player"?uR:cR;return u.jsxs(u.Fragment,{children:[u.jsx("style",{type:"text/css",children:`
|
|
97
|
-
@keyframes ${pg} {
|
|
98
|
-
0% {
|
|
99
|
-
rotate: 0deg;
|
|
100
|
-
}
|
|
101
|
-
100% {
|
|
102
|
-
rotate: 360deg;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.${fg} {
|
|
107
|
-
animation: ${pg} 1s linear infinite;
|
|
108
|
-
}
|
|
109
|
-
`}),u.jsx("div",{style:t,children:u.jsx("svg",{viewBox:e==="player"?"0 0 22 22":"0 0 18 18",style:t,className:fg,children:u.jsx("path",{d:e==="player"?"M 11 4 A 7 7 0 0 1 15.1145 16.66312":"M 9 2 A 7 7 0 0 1 13.1145 14.66312",stroke:"white",strokeLinecap:"round",fill:"none",strokeWidth:3})})})]})},fR=({currentSize:e,width:t,height:n,compositionWidth:r,compositionHeight:o})=>t!==void 0&&n===void 0?{aspectRatio:[r,o].join("/")}:n!==void 0&&t===void 0?{aspectRatio:[r,o].join("/")}:e?{width:r,height:o}:{width:r,height:o},d1=({previewSize:e,compositionWidth:t,compositionHeight:n,canvasSize:r})=>{const o=me.calculateScale({canvasSize:r,compositionHeight:n,compositionWidth:t,previewSize:e}),i=0-(1-o)/2,s=i*t,a=i*n,l=t*o,c=n*o,f=r.width/2-l/2,p=r.height/2-c/2;return{centerX:f,centerY:p,xCorrection:s,yCorrection:a,scale:o}},f1=({config:e,style:t,canvasSize:n,overflowVisible:r,layout:o})=>e?{position:"relative",overflow:r?"visible":"hidden",...fR({compositionHeight:e.height,compositionWidth:e.width,currentSize:n,height:t==null?void 0:t.height,width:t==null?void 0:t.width}),opacity:o?1:0,...t}:{},p1=({config:e,layout:t,scale:n,overflowVisible:r})=>e?t?{position:"absolute",width:e.width,height:e.height,display:"flex",transform:`scale(${n})`,marginLeft:t.xCorrection,marginTop:t.yCorrection,overflow:r?"visible":"hidden"}:{position:"absolute",width:e.width,height:e.height,display:"flex",transform:`scale(${n})`,overflow:r?"visible":"hidden"}:{},h1=({layout:e,scale:t,config:n,overflowVisible:r})=>{if(!n)return{};if(!e)return{width:n.width*t,height:n.height*t,display:"flex",flexDirection:"column",position:"absolute",overflow:r?"visible":"hidden"};const{centerX:o,centerY:i}=e;return{width:n.width*t,height:n.height*t,display:"flex",flexDirection:"column",position:"absolute",left:o,top:i,overflow:r?"visible":"hidden"}},m1=le.createContext(void 0),g1=le.createContext(void 0);class pR{constructor(){Ae(this,"listeners",{ended:[],error:[],pause:[],play:[],ratechange:[],scalechange:[],seeked:[],timeupdate:[],frameupdate:[],fullscreenchange:[],volumechange:[],mutechange:[],waiting:[],resume:[]});Ae(this,"dispatchSeek",t=>{this.dispatchEvent("seeked",{frame:t})});Ae(this,"dispatchVolumeChange",t=>{this.dispatchEvent("volumechange",{volume:t})});Ae(this,"dispatchPause",()=>{this.dispatchEvent("pause",void 0)});Ae(this,"dispatchPlay",()=>{this.dispatchEvent("play",void 0)});Ae(this,"dispatchEnded",()=>{this.dispatchEvent("ended",void 0)});Ae(this,"dispatchRateChange",t=>{this.dispatchEvent("ratechange",{playbackRate:t})});Ae(this,"dispatchScaleChange",t=>{this.dispatchEvent("scalechange",{scale:t})});Ae(this,"dispatchError",t=>{this.dispatchEvent("error",{error:t})});Ae(this,"dispatchTimeUpdate",t=>{this.dispatchEvent("timeupdate",t)});Ae(this,"dispatchFrameUpdate",t=>{this.dispatchEvent("frameupdate",t)});Ae(this,"dispatchFullscreenChange",t=>{this.dispatchEvent("fullscreenchange",t)});Ae(this,"dispatchMuteChange",t=>{this.dispatchEvent("mutechange",t)});Ae(this,"dispatchWaiting",t=>{this.dispatchEvent("waiting",t)});Ae(this,"dispatchResume",t=>{this.dispatchEvent("resume",t)})}addEventListener(t,n){this.listeners[t].push(n)}removeEventListener(t,n){this.listeners[t]=this.listeners[t].filter(r=>r!==n)}dispatchEvent(t,n){this.listeners[t].forEach(r=>{r({detail:n})})}}class hR{constructor(){Ae(this,"listeners",{error:[],waiting:[],resume:[]});Ae(this,"dispatchError",t=>{this.dispatchEvent("error",{error:t})});Ae(this,"dispatchWaiting",t=>{this.dispatchEvent("waiting",t)});Ae(this,"dispatchResume",t=>{this.dispatchEvent("resume",t)})}addEventListener(t,n){this.listeners[t].push(n)}removeEventListener(t,n){this.listeners[t]=this.listeners[t].filter(r=>r!==n)}dispatchEvent(t,n){this.listeners[t].forEach(r=>{r({detail:n})})}}var v1=e=>{const t=d.useContext(me.BufferingContextReact);if(!t)throw new Error("BufferingContextReact not found");d.useLayoutEffect(()=>{const n=t.listenForBuffering(()=>{t.buffering.current=!0,e.dispatchWaiting({})}),r=t.listenForResume(()=>{t.buffering.current=!1,e.dispatchResume({})});return()=>{n.remove(),r.remove()}},[t,e])},mR=({children:e,currentPlaybackRate:t})=>{const[n]=d.useState(()=>new pR);if(!d.useContext(me.BufferingContextReact))throw new Error("BufferingContextReact not found");return d.useEffect(()=>{t&&n.dispatchRateChange(t)},[n,t]),v1(n),u.jsx(m1.Provider,{value:n,children:e})},eh=(e,t)=>{const[n,r]=d.useState(!1);return d.useEffect(()=>{const{current:o}=e;if(!o)return;let i;const s=()=>{t&&(clearTimeout(i),i=setTimeout(()=>{r(!1)},t===!0?3e3:t))},a=()=>{r(!0),s()},l=()=>{r(!1),clearTimeout(i)},c=()=>{r(!0),s()};return o.addEventListener("mouseenter",a),o.addEventListener("mouseleave",l),o.addEventListener("mousemove",c),()=>{o.removeEventListener("mouseenter",a),o.removeEventListener("mouseleave",l),o.removeEventListener("mousemove",c),clearTimeout(i)}},[t,e]),n},Hu=()=>{const[e,t,n]=me.Timeline.usePlayingState(),[r,o]=d.useState(!1),i=me.Timeline.useTimelinePosition(),s=d.useRef(i),a=me.Timeline.useTimelineSetFrame(),l=me.Timeline.useTimelineSetFrame(),c=d.useContext(me.SharedAudioContext),f=d.useContext(me.SharedAudioTagsContext),{audioAndVideoTags:p}=me.useTimelineContext(),h=d.useRef(i);h.current=i;const m=me.useVideo(),x=me.useUnsafeVideoConfig(),v=d.useContext(m1),k=((x==null?void 0:x.durationInFrames)??1)-1,g=i===k,y=i===0;if(!v)throw new TypeError("Expected Player event emitter context");const w=d.useContext(me.BufferingContextReact);if(!w)throw new Error("Missing the buffering context. Most likely you have a Remotion version mismatch.");const{buffering:b}=w,S=d.useCallback(L=>{const j=x?me.TimelinePosition.clampFrameToCompositionRange(L,x.durationInFrames):Math.max(0,L);m!=null&&m.id&&l(C=>({...C,[m.id]:j})),h.current=j,v.dispatchSeek(j)},[x,v,l,m==null?void 0:m.id]),E=d.useCallback(L=>{n.current||(o(!0),g&&S(0),c==null||c.resume(),f&&f.numberOfAudioTags>0&&L&&f.playAllAudios(),p.current.forEach(j=>j.play("player play() was called and playing audio from a click")),n.current=!0,t(!0),s.current=h.current,v.dispatchPlay())},[n,g,c,f,t,v,S,p]),T=d.useCallback(()=>{n.current&&(n.current=!1,t(!1),v.dispatchPause(),c==null||c.suspend())},[v,n,t,c]),I=d.useCallback(()=>{n.current&&(n.current=!1,h.current=s.current,x&&(l(L=>({...L,[x.id]:s.current})),t(!1),v.dispatchPause()))},[x,v,n,t,l]),R=m==null?void 0:m.id,F=d.useCallback(L=>{if(!R)return null;n.current||a(j=>{const C=j[R]??window.remotion_initialFrame??0,P=Math.max(0,C-L);return C===P?j:{...j,[R]:P}})},[n,a,R]),A=d.useCallback(L=>{if(!R)return null;n.current||a(j=>{const C=j[R]??window.remotion_initialFrame??0,P=Math.min(k,C+L);return C===P?j:{...j,[R]:P}})},[R,n,k,a]),W=d.useCallback(L=>{n.current?T():E(L)},[n,T,E]),M=d.useCallback(()=>n.current,[n]),$=d.useCallback(()=>h.current,[h]),V=d.useCallback(()=>b.current,[b]);return d.useMemo(()=>({frameBack:F,frameForward:A,isLastFrame:g,emitter:v,playing:e,play:E,pause:T,seek:S,isFirstFrame:y,getCurrentFrame:$,isPlaying:M,isBuffering:V,pauseAndReturnToPlayStart:I,hasPlayed:r,toggle:W}),[v,F,A,r,y,g,$,T,I,E,e,S,W,M,V])},gR=({browserMediaControlsBehavior:e,videoConfig:t,playbackRate:n})=>{const{playing:r,pause:o,play:i,emitter:s,getCurrentFrame:a,seek:l}=Hu(),c=d.useRef(!1);d.useEffect(()=>{r&&(c.current=!0)},[r]),d.useEffect(()=>{navigator.mediaSession&&e.mode!=="do-nothing"&&(r?navigator.mediaSession.playbackState="playing":c.current&&(navigator.mediaSession.playbackState="paused"))},[e.mode,r]),d.useEffect(()=>{if(!navigator.mediaSession||e.mode==="do-nothing")return;const f=()=>{t&&navigator.mediaSession&&navigator.mediaSession.setPositionState({duration:t.durationInFrames/t.fps,playbackRate:n,position:a()/t.fps})};return s.addEventListener("timeupdate",f),()=>{s.removeEventListener("timeupdate",f)}},[e.mode,s,a,n,t]),d.useEffect(()=>{if(navigator.mediaSession&&e.mode!=="do-nothing")return navigator.mediaSession.setActionHandler("play",()=>{e.mode==="register-media-session"&&i()}),navigator.mediaSession.setActionHandler("pause",()=>{e.mode==="register-media-session"&&o()}),navigator.mediaSession.setActionHandler("seekto",f=>{e.mode==="register-media-session"&&f.seekTime!==void 0&&t&&l(Math.round(f.seekTime*t.fps))}),navigator.mediaSession.setActionHandler("seekbackward",()=>{e.mode==="register-media-session"&&t&&l(Math.max(0,Math.round((a()-10)*t.fps)))}),navigator.mediaSession.setActionHandler("seekforward",()=>{e.mode==="register-media-session"&&t&&l(Math.max(t.durationInFrames-1,Math.round((a()+10)*t.fps)))}),navigator.mediaSession.setActionHandler("previoustrack",()=>{e.mode==="register-media-session"&&l(0)}),()=>{navigator.mediaSession.metadata=null,navigator.mediaSession.setActionHandler("play",null),navigator.mediaSession.setActionHandler("pause",null),navigator.mediaSession.setActionHandler("seekto",null),navigator.mediaSession.setActionHandler("seekbackward",null),navigator.mediaSession.setActionHandler("seekforward",null),navigator.mediaSession.setActionHandler("previoustrack",null)}},[e.mode,a,o,i,l,t])},vR=({time:e,currentFrame:t,playbackSpeed:n,fps:r,actualLastFrame:o,actualFirstFrame:i,framesAdvanced:s,shouldLoop:a})=>{const c=(n<0?Math.ceil:Math.floor)(e*n/(1e3/r))-s,f=c+t,p=t>o||t<i,h=f>o||f<i,m=!a&&h&&!p;return n>0?h?{nextFrame:i,framesToAdvance:c,hasEnded:m}:{nextFrame:f,framesToAdvance:c,hasEnded:m}:h?{nextFrame:o,framesToAdvance:c,hasEnded:m}:{nextFrame:f,framesToAdvance:c,hasEnded:m}},hg=()=>typeof document>"u"?!1:document.visibilityState==="hidden",yR=()=>{const e=d.useRef(hg());return d.useEffect(()=>{const t=()=>{e.current=hg()};return document.addEventListener("visibilitychange",t),()=>{document.removeEventListener("visibilitychange",t)}},[]),e},wR=.1,mg=({audioContext:e,audioSyncAnchor:t,absoluteTimeInSeconds:n,globalPlaybackRate:r,logLevel:o,force:i})=>{const s=e.currentTime-n/r,a=s-t.value,{outputLatency:l}=e,c=l===0?.3:l,f=e.baseLatency+c;return Math.abs(a)<wR+f&&!i||Math.abs(a)<Number.EPSILON?!1:(me.Log.verbose({logLevel:o,tag:"audio-scheduling"},"Anchor "+(i?"forcibly ":"")+"changed from %s to %s with shift %s",t.value,s,a),t.value=s,!0)},xR=e=>{if(e==="suspended"||e==="running-to-suspended")return!0;if(e==="closed"||e==="interrupted"||e==="running"||e==="suspended-to-running")return!1;throw new Error(`Unexpected audio context state: ${e}`)},bR=({loop:e,playbackRate:t,moveToBeginningWhenEnded:n,inFrame:r,outFrame:o,browserMediaControlsBehavior:i,getCurrentFrame:s,muted:a})=>{const l=me.useUnsafeVideoConfig(),c=me.Timeline.useTimelinePosition(),{playing:f,pause:p,emitter:h,isPlaying:m}=Hu(),x=me.Timeline.useTimelineSetFrame(),v=d.useContext(me.SharedAudioContext),k=me.useLogLevel(),g=yR(),y=d.useRef(0),w=d.useContext(me.BufferingContextReact);if(!w)throw new Error("Missing the buffering context. Most likely you have a Remotion version mismatch.");gR({browserMediaControlsBehavior:i,playbackRate:t,videoConfig:l}),d.useLayoutEffect(()=>{if(!v||!v.audioContext||!l||a)return;mg({audioContext:v.audioContext,audioSyncAnchor:v.audioSyncAnchor,absoluteTimeInSeconds:c/l.fps,globalPlaybackRate:t,logLevel:k,force:!1})&&v.audioSyncAnchorEmitter.dispatch("changed")},[l,c,k,t,v,a]),d.useLayoutEffect(()=>{const b=v==null?void 0:v.audioContext;if(!b||!l||a)return;const S=()=>{const E=v==null?void 0:v.getAudioContextState();E&&xR(E)&&mg({audioContext:b,audioSyncAnchor:v.audioSyncAnchor,absoluteTimeInSeconds:s()/l.fps,globalPlaybackRate:t,logLevel:k,force:!0})};return b==null||b.addEventListener("statechange",S),()=>{b==null||b.removeEventListener("statechange",S)}},[l,s,k,a,t,v]),d.useEffect(()=>{var M;if(!l)return;if(!f){(M=v==null?void 0:v.suspend)==null||M.call(v);return}let b=!1,S=null,E=performance.now(),T=0;const I=()=>{S!==null&&(S.type==="raf"?cancelAnimationFrame(S.id):clearTimeout(S.id))},R=()=>{b=!0,I()},F=()=>{var N,B;if(b)return;if(!m()){(N=v==null?void 0:v.suspend)==null||N.call(v);return}!a&&!w.buffering.current&&((B=v==null?void 0:v.resume)==null||B.call(v));const $=performance.now()-E,V=o??l.durationInFrames-1,D=r??0,L=s(),{nextFrame:j,framesToAdvance:C,hasEnded:P}=vR({time:$,currentFrame:L,playbackSpeed:t,fps:l.fps,actualFirstFrame:D,actualLastFrame:V,framesAdvanced:T,shouldLoop:e});if(T+=C,j!==s()&&(!P||n)&&!w.buffering.current&&x(z=>({...z,[l.id]:j})),P){R(),p(),h.dispatchEnded();return}A()},A=()=>{var V,D;const $=((V=v==null?void 0:v.getIsResumingAudioContext)==null?void 0:V.call(v))??null;if($!==null&&!a){$.then(()=>{E=performance.now(),T=0,A()});return}if(w.buffering.current){a||(D=v==null?void 0:v.suspend)==null||D.call(v);const L=w.listenForResume(()=>{L.remove(),E=performance.now(),T=0,A()});return}if(g.current){S={type:"timeout",id:setTimeout(F,1e3/l.fps)};return}S={type:"raf",id:requestAnimationFrame(F)}};A();const W=()=>{document.visibilityState!=="visible"&&(I(),F())};return window.addEventListener("visibilitychange",W),()=>{window.removeEventListener("visibilitychange",W),R()}},[l,e,p,f,x,h,t,r,o,n,g,s,w,m,v,k,a]),d.useEffect(()=>{const b=performance.now(),S=b-y.current;if(S>=250){h.dispatchTimeUpdate({frame:c}),y.current=b;return}const E=setTimeout(()=>{h.dispatchTimeUpdate({frame:c}),y.current=performance.now()},250-S);return()=>clearTimeout(E)},[h,c]),d.useEffect(()=>{h.dispatchFrameUpdate({frame:c})},[h,c])},Bc=[],Wc=e=>e?"current"in e?e.current:e:null,th=(e,t)=>{const[n,r]=d.useState(()=>{const s=Wc(e);if(!s)return null;const a=s.getClientRects();return a[0]?{width:a[0].width,height:a[0].height,left:a[0].x,top:a[0].y,windowSize:{height:window.innerHeight,width:window.innerWidth}}:null}),o=d.useMemo(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(s=>{const{contentRect:a,target:l}=s[0],c=l.getClientRects();if(!(c!=null&&c[0])){r(null);return}const f=a.width===0?1:c[0].width/a.width,p=a.height===0?1:c[0].height/a.height,h=t.shouldApplyCssTransforms||f===0?c[0].width:c[0].width*(1/f),m=t.shouldApplyCssTransforms||p===0?c[0].height:c[0].height*(1/p);r(x=>x&&x.width===h&&x.height===m&&x.left===c[0].x&&x.top===c[0].y&&x.windowSize.height===window.innerHeight&&x.windowSize.width===window.innerWidth?x:{width:h,height:m,left:c[0].x,top:c[0].y,windowSize:{height:window.innerHeight,width:window.innerWidth}})}),[t.shouldApplyCssTransforms]),i=d.useCallback(()=>{const s=Wc(e);if(!s)return;const a=s.getClientRects();if(!a[0]){r(null);return}r(l=>l&&l.width===a[0].width&&l.height===a[0].height&&l.left===a[0].x&&l.top===a[0].y&&l.windowSize.height===window.innerHeight&&l.windowSize.width===window.innerWidth?l:{width:a[0].width,height:a[0].height,left:a[0].x,top:a[0].y,windowSize:{height:window.innerHeight,width:window.innerWidth}})},[e]);return d.useEffect(()=>{i()},[i]),d.useEffect(()=>{if(!o)return;const s=Wc(e);return s&&o.observe(s),()=>{s&&o.unobserve(s)}},[o,e]),d.useEffect(()=>{if(t.triggerOnWindowResize)return window.addEventListener("resize",i),()=>{window.removeEventListener("resize",i)}},[t.triggerOnWindowResize,i]),d.useEffect(()=>(Bc.push(i),()=>{Bc=Bc.filter(s=>s!==i)}),[i]),d.useMemo(()=>n?{...n,refresh:i}:null,[n,i])},nh=e=>e??"__remotion-player",SR={display:"flex",justifyContent:"center",alignItems:"center",flex:1,height:"100%",width:"100%"};class y1 extends le.Component{constructor(){super(...arguments);Ae(this,"state",{hasError:null})}static getDerivedStateFromError(n){return{hasError:n}}componentDidCatch(n){this.props.onError(n)}render(){return this.state.hasError?u.jsx("div",{style:SR,children:this.props.errorFallback({error:this.state.hasError})}):this.props.children}}var kR=async()=>{if(typeof window>"u"||typeof window.crypto>"u"||typeof window.crypto.subtle>"u")return null;try{const e=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(window.location.hostname));return Array.from(new Uint8Array(e)).map(t=>t.toString(16).padStart(2,"0")).join("")}catch{return null}},Vc={backgroundColor:"red",position:"absolute",padding:12,fontFamily:"Arial"},ER=["28d262b44cc61fa750f1686b16ad0604dabfe193fbc263eec05c89b7ad4c2cd6","4db1b0a94be33165dfefcb3ba03d04c7a2666dd27c496d3dc9fa41858e94925e","fbc48530bbf245da790f63675e84e06bab38c3b114fab07eb350025119922bdc","7baf10a8932757b1b3a22b3fce10a048747ac2f8eaf638603487e3705b07eb83","8a6c21a598d8c667272b5207c051b85997bf5b45d5fb712378be3f27cd72c6a6","a2f7aaac9c50a9255e7fc376110c4e0bfe153722dc66ed3c5d3bf2a135f65518"],gg=!1,CR=()=>{const[e,t]=le.useState(!1);return d.useEffect(()=>{gg||(gg=!0,kR().then(n=>{n&&ER.includes(n)&&t(!0)}).catch(()=>{}))},[]),d.useEffect(()=>{if(!e)return;const n=()=>{if(!document.querySelector(".warning-banner")){const i=document.createElement("div");i.className="warning-banner",Object.assign(i.style,Vc,{zIndex:"9999",cssText:`${Vc.cssText} !important;`}),i.innerHTML=`
|
|
110
|
-
<a href="https://github.com/remotion-dev/remotion/pull/4589" style="color: white;">
|
|
111
|
-
Remotion Unlicensed – Contact hi@remotion.dev
|
|
112
|
-
</a>
|
|
113
|
-
`,document.body.appendChild(i)}},r=new MutationObserver(()=>n());return r.observe(document.body,{childList:!0,subtree:!0}),()=>{r.disconnect()}},[e]),e?u.jsx("div",{style:Vc,className:"warning-banner",children:u.jsx("a",{style:{color:"white"},href:"https://github.com/remotion-dev/remotion/pull/4589",children:"Remotion Unlicensed – Contact hi@remotion.dev"})}):null},vg=({playing:e,buffering:t})=>e&&t?u.jsx(dR,{type:"player"}):e?u.jsx(iR,{}):u.jsx(oR,{}),Oo=12,yg=5,IR=({volume:e,isVertical:t,onBlur:n,inputRef:r,setVolume:o})=>{const i=d.useMemo(()=>{const h={paddingLeft:5,height:Rt,width:mo,display:"inline-flex",alignItems:"center"};return t?{...h,position:"absolute",transform:`rotate(-90deg) translateX(${mo/2+Rt/2}px)`}:{...h}},[t]),s=typeof le.useId>"u"?"volume-slider":le.useId(),[a]=d.useState(()=>`__remotion-volume-slider-${Fo(s)}`.replace(".","")),l=d.useCallback(p=>{o(parseFloat(p.target.value))},[o]),c=d.useMemo(()=>{const p={WebkitAppearance:"none",backgroundColor:"rgba(255, 255, 255, 0.5)",borderRadius:yg/2,cursor:"pointer",height:yg,width:mo,backgroundImage:`linear-gradient(
|
|
114
|
-
to right,
|
|
115
|
-
white ${e*100}%, rgba(255, 255, 255, 0) ${e*100}%
|
|
116
|
-
)`};return t?{...p,bottom:Rt+mo/2}:p},[t,e]),f=`
|
|
117
|
-
.${a}::-webkit-slider-thumb {
|
|
118
|
-
-webkit-appearance: none;
|
|
119
|
-
background-color: white;
|
|
120
|
-
border-radius: ${Oo/2}px;
|
|
121
|
-
box-shadow: 0 0 2px black;
|
|
122
|
-
height: ${Oo}px;
|
|
123
|
-
width: ${Oo}px;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.${a}::-moz-range-thumb {
|
|
127
|
-
-webkit-appearance: none;
|
|
128
|
-
background-color: white;
|
|
129
|
-
border-radius: ${Oo/2}px;
|
|
130
|
-
box-shadow: 0 0 2px black;
|
|
131
|
-
height: ${Oo}px;
|
|
132
|
-
width: ${Oo}px;
|
|
133
|
-
}
|
|
134
|
-
`;return u.jsxs("div",{style:i,children:[u.jsx("style",{dangerouslySetInnerHTML:{__html:f}}),u.jsx("input",{ref:r,"aria-label":"Change volume",className:a,max:1,min:0,onBlur:n,onChange:l,step:.01,type:"range",value:e,style:c})]})},TR=e=>u.jsx(IR,{...e}),mo=100,RR=({displayVerticalVolumeSlider:e,renderMuteButton:t,renderVolumeSlider:n})=>{const[r,o]=me.usePlayerMutedState(),[i,s]=me.useMediaVolumeState(),[a,l]=d.useState(!1),c=d.useRef(null),f=d.useRef(null),p=eh(c,!1),h=d.useCallback(()=>{setTimeout(()=>{f.current&&document.activeElement!==f.current&&l(!1)},10)},[]),m=i===0,x=d.useCallback(()=>{if(m){s(1),o(!1);return}o(b=>!b)},[m,o,s]),v=d.useMemo(()=>({display:"inline-flex",background:"none",border:"none",justifyContent:"center",alignItems:"center",touchAction:"none",...e&&{position:"relative"}}),[e]),k=d.useMemo(()=>({display:"inline",width:Rt,height:Rt,cursor:"pointer",appearance:"none",background:"none",border:"none",padding:0}),[]),g=d.useCallback(({muted:b,volume:S})=>{const E=b||S===0;return u.jsx("button",{"aria-label":E?"Unmute sound":"Mute sound",title:E?"Unmute sound":"Mute sound",onClick:x,onBlur:h,onFocus:()=>l(!0),style:k,type:"button",children:E?u.jsx(aR,{}):u.jsx(lR,{})})},[h,x,k]),y=d.useMemo(()=>t?t({muted:r,volume:i}):g({muted:r,volume:i}),[r,i,g,t]),w=d.useMemo(()=>(a||p)&&!r&&!me.isIosSafari()?(n??TR)({isVertical:e,volume:i,onBlur:()=>l(!1),inputRef:f,setVolume:s}):null,[e,a,p,r,i,n,s]);return u.jsxs("div",{ref:c,style:v,children:[y,w]})};function jR(e){const[t,n]=d.useState(e),r=d.useRef(null);return d.useEffect(()=>{const o=i=>{r.current&&!r.current.contains(i.target)&&n(!1)};return document.addEventListener("pointerup",o,!0),()=>{document.removeEventListener("pointerup",o,!0)}},[]),{ref:r,isComponentVisible:t,setIsComponentVisible:n}}var PR=35,FR=70,_R={height:30,paddingRight:15,paddingLeft:12,display:"flex",flexDirection:"row",alignItems:"center"},MR={width:22,display:"flex",alignItems:"center"},$R={width:14,height:14,color:"black"},AR=()=>u.jsx("svg",{viewBox:"0 0 512 512",style:$R,children:u.jsx("path",{fill:"currentColor",d:"M435.848 83.466L172.804 346.51l-96.652-96.652c-4.686-4.686-12.284-4.686-16.971 0l-28.284 28.284c-4.686 4.686-4.686 12.284 0 16.971l133.421 133.421c4.686 4.686 12.284 4.686 16.971 0l299.813-299.813c4.686-4.686 4.686-12.284 0-16.971l-28.284-28.284c-4.686-4.686-12.284-4.686-16.97 0z"})}),NR=e=>{const t=e.toString();return t.includes(".")?t:t+".0"},LR=({rate:e,onSelect:t,selectedRate:n,keyboardSelectedRate:r})=>{const o=d.useCallback(p=>{p.stopPropagation(),p.preventDefault(),t(e)},[t,e]),[i,s]=d.useState(!1),a=d.useCallback(()=>{s(!0)},[]),l=d.useCallback(()=>{s(!1)},[]),c=r===e,f=d.useMemo(()=>({..._R,backgroundColor:i||c?"#eee":"transparent"}),[i,c]);return u.jsxs("div",{onPointerEnter:a,onPointerLeave:l,tabIndex:0,style:f,onClick:o,children:[u.jsx("div",{style:MR,children:e===n?u.jsx(AR,{}):null}),NR(e),"x"]},e)},DR=({setIsComponentVisible:e,playbackRates:t,canvasSize:n})=>{const{setPlaybackRate:r,playbackRate:o}=me.usePlaybackRate(),[i,s]=d.useState(o);d.useEffect(()=>{const c=f=>{if(f.preventDefault(),f.key==="ArrowUp"){const p=t.findIndex(h=>h===i);if(p===0)return;s(p===-1?t[0]:t[p-1])}else if(f.key==="ArrowDown"){const p=t.findIndex(h=>h===i);if(p===t.length-1)return;s(p===-1?t[t.length-1]:t[p+1])}else f.key==="Enter"&&(r(i),e(!1))};return window.addEventListener("keydown",c),()=>{window.removeEventListener("keydown",c)}},[t,i,r,e]);const a=d.useCallback(c=>{r(c),e(!1)},[e,r]),l=d.useMemo(()=>({position:"absolute",right:0,width:125,maxHeight:n.height-FR-PR,bottom:35,background:"#fff",borderRadius:4,overflow:"auto",color:"black",textAlign:"left"}),[n.height]);return u.jsx("div",{style:l,children:t.map(c=>u.jsx(LR,{selectedRate:o,onSelect:a,rate:c,keyboardSelectedRate:i},c))})},zR={fontSize:13,fontWeight:"bold",color:"white",border:"2px solid white",borderRadius:20,paddingLeft:8,paddingRight:8,paddingTop:2,paddingBottom:2},wf={appearance:"none",backgroundColor:"transparent",border:"none",cursor:"pointer",paddingLeft:0,paddingRight:0,paddingTop:6,paddingBottom:6,height:37,display:"inline-flex",marginBottom:0,marginTop:0,alignItems:"center"},OR={...wf,position:"relative"},BR=({playbackRates:e,canvasSize:t})=>{const{ref:n,isComponentVisible:r,setIsComponentVisible:o}=jR(!1),{playbackRate:i}=me.usePlaybackRate(),s=d.useCallback(a=>{a.stopPropagation(),a.preventDefault(),o(l=>!l)},[o]);return u.jsx("div",{ref:n,children:u.jsxs("button",{type:"button","aria-label":"Change playback rate",style:OR,onClick:s,children:[u.jsxs("div",{style:zR,children:[i,"x"]}),r&&u.jsx(DR,{canvasSize:t,playbackRates:e,setIsComponentVisible:o})]})})},wg=(e,t,n)=>Math.round(Li(e,[0,n],[0,t-1],{extrapolateLeft:"clamp",extrapolateRight:"clamp"})),ui=5,ns=12,xf=4,WR={userSelect:"none",WebkitUserSelect:"none",paddingTop:xf,paddingBottom:xf,boxSizing:"border-box",cursor:"pointer",position:"relative",touchAction:"none"},VR={height:ui,backgroundColor:"rgba(255, 255, 255, 0.25)",width:"100%",borderRadius:ui/2},HR=e=>{let t=e;for(;t.parentElement;)t=t.parentElement;return t},UR=({durationInFrames:e,onSeekEnd:t,onSeekStart:n,inFrame:r,outFrame:o})=>{const i=d.useRef(null),s=eh(i,!1),a=th(i,{triggerOnWindowResize:!0,shouldApplyCssTransforms:!0}),{seek:l,play:c,pause:f,playing:p}=Hu(),h=me.Timeline.useTimelinePosition(),[m,x]=d.useState({dragging:!1}),v=(a==null?void 0:a.width)??0,k=d.useCallback(E=>{var R;if(E.button!==0)return;const T=(R=i.current)==null?void 0:R.getBoundingClientRect().left,I=wg(E.clientX-T,e,v);f(),l(I),x({dragging:!0,wasPlaying:p}),n()},[e,v,f,l,p,n]),g=d.useCallback(E=>{var R;if(!a)throw new Error("Player has no size");if(!m.dragging)return;const T=(R=i.current)==null?void 0:R.getBoundingClientRect().left,I=wg(E.clientX-T,e,a.width);l(I)},[m.dragging,e,l,a]),y=d.useCallback(()=>{x({dragging:!1}),m.dragging&&(m.wasPlaying?c():f(),t())},[m,t,f,c]);d.useEffect(()=>{if(!m.dragging)return;const E=HR(i.current);return E.addEventListener("pointermove",g),E.addEventListener("pointerup",y),()=>{E.removeEventListener("pointermove",g),E.removeEventListener("pointerup",y)}},[m.dragging,g,y]);const w=d.useMemo(()=>({height:ns,width:ns,borderRadius:ns/2,position:"absolute",top:xf-ns/2+5/2,backgroundColor:"white",left:Math.max(0,h/Math.max(1,e-1)*v-ns/2),boxShadow:"0 0 2px black",opacity:Number(s||m.dragging)}),[s,m.dragging,e,h,v]),b=d.useMemo(()=>({height:ui,backgroundColor:"rgba(255, 255, 255, 1)",width:(h-(r??0))/(e-1)*v,marginLeft:(r??0)/(e-1)*v,borderRadius:ui/2}),[e,h,r,v]),S=d.useMemo(()=>({height:ui,backgroundColor:"rgba(255, 255, 255, 0.25)",width:((o??e-1)-(r??0))/(e-1)*100+"%",marginLeft:(r??0)/(e-1)*100+"%",borderRadius:ui/2,position:"absolute"}),[e,r,o]);return u.jsxs("div",{ref:i,onPointerDown:k,style:WR,children:[u.jsxs("div",{style:VR,children:[u.jsx("div",{style:S}),u.jsx("div",{style:b})]}),u.jsx("div",{style:w})]})},xg=e=>{const t=Math.floor(e/60),n=Math.floor(e-t*60);return`${String(t)}:${String(n).padStart(2,"0")}`},ZR=({durationInFrames:e,maxTimeLabelWidth:t,fps:n})=>{const r=me.Timeline.useTimelinePosition(),o=d.useMemo(()=>({color:"white",fontFamily:"sans-serif",fontSize:14,maxWidth:t===null?void 0:t,overflow:"hidden",textOverflow:"ellipsis"}),[t]),s=r===e-1?r+1:r;return u.jsxs("div",{style:o,children:[xg(s/n)," / ",xg(e/n)]})},KR=10,bf=12,YR=({allowFullscreen:e,playerWidth:t})=>d.useMemo(()=>{const r=Rt,o=Rt,i=e?yf:0,s=o+r+i+bf*2+KR*2,a=t-s,l=Math.max(a,0),c=l-mo,p=(c<mo?l:c)+s+mo,h=t<p;return{maxTimeLabelWidth:l===0?null:l,displayVerticalVolumeSlider:h}},[e,t]),GR=[0,.013,.049,.104,.175,.259,.352,.45,.55,.648,.741,.825,.896,.951,.987],XR=[0,8.1,15.5,22.5,29,35.3,41.2,47.1,52.9,58.8,64.7,71,77.5,84.5,91.9],qR=1/.7,QR={boxSizing:"border-box",position:"absolute",bottom:0,width:"100%",paddingTop:40,paddingBottom:10,backgroundImage:`linear-gradient(to bottom,${GR.map((e,t)=>`hsla(0, 0%, 0%, ${e}) ${XR[t]*qR}%`).join(", ")}, hsl(0, 0%, 0%) 100%)`,backgroundSize:"auto 145px",display:"flex",paddingRight:bf,paddingLeft:bf,flexDirection:"column",transition:"opacity 0.3s"},JR={display:"flex",flexDirection:"row",width:"100%",alignItems:"center",justifyContent:"center",userSelect:"none",WebkitUserSelect:"none"},ej={display:"flex",flexDirection:"row",userSelect:"none",WebkitUserSelect:"none",alignItems:"center"},rs={width:12},tj={height:8},nj={flex:1},rj={},oj=({durationInFrames:e,isFullscreen:t,fps:n,showVolumeControls:r,onFullscreenButtonClick:o,allowFullscreen:i,onExitFullscreenButtonClick:s,spaceKeyToPlayOrPause:a,onSeekEnd:l,onSeekStart:c,inFrame:f,outFrame:p,initiallyShowControls:h,canvasSize:m,renderPlayPauseButton:x,renderFullscreenButton:v,alwaysShowControls:k,showPlaybackRateControl:g,containerRef:y,buffering:w,hideControlsWhenPointerDoesntMove:b,onPointerDown:S,onDoubleClick:E,renderMuteButton:T,renderVolumeSlider:I,playing:R,toggle:F,renderCustomControls:A})=>{const W=d.useRef(null),[M,$]=d.useState(!1),V=eh(y,b),{maxTimeLabelWidth:D,displayVerticalVolumeSlider:L}=YR({allowFullscreen:i,playerWidth:(m==null?void 0:m.width)??0}),[j,C]=d.useState(()=>{if(typeof h=="boolean")return h;if(typeof h=="number"){if(h%1!==0)throw new Error("initiallyShowControls must be an integer or a boolean");if(Number.isNaN(h))throw new Error("initiallyShowControls must not be NaN");if(!Number.isFinite(h))throw new Error("initiallyShowControls must be finite");if(h<=0)throw new Error("initiallyShowControls must be a positive integer");return h}throw new TypeError("initiallyShowControls must be a number or a boolean")}),P=d.useMemo(()=>({...QR,opacity:Number(V||!R||j||k)}),[V,j,R,k]);d.useEffect(()=>{W.current&&a&&W.current.focus({preventScroll:!0})},[R,a]),d.useEffect(()=>{$((typeof document<"u"&&(document.fullscreenEnabled||document.webkitFullscreenEnabled))??!1)},[]),d.useEffect(()=>{if(j===!1)return;const X=setTimeout(()=>{C(!1)},j===!0?2e3:j);return()=>{clearInterval(X)}},[j]);const N=d.useMemo(()=>{if(g===!0)return[.5,.8,1,1.2,1.5,1.8,2,2.5,3];if(Array.isArray(g)){for(const O of g){if(typeof O!="number")throw new Error("Every item in showPlaybackRateControl must be a number");if(O<=0)throw new Error("Every item in showPlaybackRateControl must be positive")}return g}return null},[g]),B=A?A():null,z=d.useRef(null),Z=d.useRef(null),H=d.useCallback(O=>{(O.target===z.current||O.target===Z.current)&&(S==null||S(O))},[S]),G=d.useCallback(O=>{(O.target===z.current||O.target===Z.current)&&(E==null||E(O))},[E]);return u.jsxs("div",{ref:z,style:P,onPointerDown:H,onDoubleClick:G,children:[u.jsxs("div",{ref:Z,style:JR,children:[u.jsxs("div",{style:ej,children:[u.jsx("button",{ref:W,type:"button",style:wf,onClick:F,"aria-label":R?"Pause video":"Play video",title:R?"Pause video":"Play video",children:x===null?u.jsx(vg,{buffering:w,playing:R}):x({playing:R,isBuffering:w})??u.jsx(vg,{buffering:w,playing:R})}),r?u.jsxs(u.Fragment,{children:[u.jsx("div",{style:rs}),u.jsx(RR,{renderMuteButton:T,renderVolumeSlider:I,displayVerticalVolumeSlider:L})]}):null,u.jsx("div",{style:rs}),u.jsx(ZR,{durationInFrames:e,fps:n,maxTimeLabelWidth:D}),u.jsx("div",{style:rs})]}),u.jsx("div",{style:nj}),B,B&&N&&m?u.jsx("div",{style:rs}):null,N&&m&&u.jsx(BR,{canvasSize:m,playbackRates:N}),N&&M&&i?u.jsx("div",{style:rs}):null,u.jsx("div",{style:rj,children:M&&i?u.jsx("button",{type:"button","aria-label":t?"Exit fullscreen":"Enter Fullscreen",title:t?"Exit fullscreen":"Enter Fullscreen",style:wf,onClick:t?s:o,children:v===null?u.jsx(sR,{isFullscreen:t}):v({isFullscreen:t})}):null})]}),u.jsx("div",{style:tj}),u.jsx(UR,{onSeekEnd:l,onSeekStart:c,durationInFrames:e,inFrame:f,outFrame:p})]})},w1=typeof document>"u",ij=e=>{let t=!1;return{promise:new Promise((r,o)=>{e.then(i=>{if(t){o({isCanceled:t,value:i});return}r(i)}).catch(i=>{o({isCanceled:t,error:i})})}),cancel:()=>{t=!0}}},sj=e=>new Promise(t=>setTimeout(t,e)),aj=()=>{const e=d.useRef([]),t=d.useCallback(i=>{e.current=[...e.current,i]},[]),n=d.useCallback(i=>{e.current=e.current.filter(s=>s!==i)},[]),r=d.useCallback(()=>e.current.map(i=>i.cancel()),[]);return d.useMemo(()=>({appendPendingPromise:t,removePendingPromise:n,clearPendingPromises:r}),[t,r,n])},lj=(e,t,n)=>{const r=aj(),o=d.useCallback(async l=>{if(l instanceof PointerEvent?l.pointerType==="touch":l.nativeEvent.pointerType==="touch"){e(l);return}r.clearPendingPromises();const c=ij(sj(200));r.appendPendingPromise(c);try{await c.promise,r.removePendingPromise(c),e(l)}catch(f){const p=f;if(r.removePendingPromise(c),!p.isCanceled)throw p.error}},[r,e]),i=d.useCallback(()=>{document.addEventListener("pointerup",l=>{o(l)},{once:!0})},[o]),s=d.useCallback(()=>{r.clearPendingPromises(),t()},[r,t]);return d.useMemo(()=>n?{handlePointerDown:i,handleDoubleClick:s}:{handlePointerDown:e,handleDoubleClick:()=>{}},[n,s,i,e])},Sf=le.version.split(".")[0];if(Sf==="0")throw new Error(`Version ${Sf} of "react" is not supported by Remotion`);var uj=parseInt(Sf,10)>=18,cj=({controls:e,style:t,loop:n,autoPlay:r,allowFullscreen:o,inputProps:i,clickToPlay:s,showVolumeControls:a,doubleClickToFullscreen:l,spaceKeyToPlayOrPause:c,errorFallback:f,playbackRate:p,renderLoading:h,renderPoster:m,className:x,moveToBeginningWhenEnded:v,showPosterWhenUnplayed:k,showPosterWhenEnded:g,showPosterWhenPaused:y,showPosterWhenBuffering:w,showPosterWhenBufferingAndPaused:b,inFrame:S,outFrame:E,initiallyShowControls:T,renderFullscreen:I,renderPlayPauseButton:R,renderMuteButton:F,renderVolumeSlider:A,renderCustomControls:W,alwaysShowControls:M,showPlaybackRateControl:$,posterFillMode:V,bufferStateDelayInMilliseconds:D,hideControlsWhenPointerDoesntMove:L,overflowVisible:j,browserMediaControlsBehavior:C,overrideInternalClassName:P,noSuspense:N},B)=>{const z=me.useUnsafeVideoConfig(),Z=me.useVideo(),H=d.useRef(null),G=th(H,{triggerOnWindowResize:!1,shouldApplyCssTransforms:!1}),[O,X]=d.useState(!1),[ae,oe]=d.useState(r),[Y,q]=d.useState(()=>!1),[xe,Se]=d.useState(!1),de=d.useMemo(()=>typeof document>"u"?!1:!!(document.fullscreenEnabled||document.webkitFullscreenEnabled),[]),K=Hu(),ee=K.toggle,{playerMuted:ue,mediaVolume:se}=d.useContext(me.MediaVolumeContext);d.useEffect(()=>{K.emitter.dispatchVolumeChange(se)},[K.emitter,se]);const Re=ue||se===0;d.useEffect(()=>{K.emitter.dispatchMuteChange({isMuted:Re})},[K.emitter,Re]),bR({loop:n,playbackRate:p,moveToBeginningWhenEnded:v,inFrame:S,outFrame:E,getCurrentFrame:K.getCurrentFrame,browserMediaControlsBehavior:C,muted:Re}),d.useEffect(()=>{O&&!K.playing&&(X(!1),K.play())},[O,K]),d.useEffect(()=>{const{current:ge}=H;if(!ge)return;const Ce=()=>{const Et=document.fullscreenElement===ge||document.webkitFullscreenElement===ge;q(Et)};return document.addEventListener("fullscreenchange",Ce),document.addEventListener("webkitfullscreenchange",Ce),()=>{document.removeEventListener("fullscreenchange",Ce),document.removeEventListener("webkitfullscreenchange",Ce)}},[]);const Ie=d.useCallback(ge=>{ee(ge)},[ee]),ze=d.useCallback(()=>{if(!o)throw new Error("allowFullscreen is false");if(!de)throw new Error("Browser doesnt support fullscreen");if(!H.current)throw new Error("No player ref found");H.current.webkitRequestFullScreen?H.current.webkitRequestFullScreen():H.current.requestFullscreen()},[o,de]),Je=d.useCallback(()=>{document.webkitExitFullscreen?document.webkitExitFullscreen():document.exitFullscreen()},[]);d.useEffect(()=>{const{current:ge}=H;if(!ge)return;const Ce=()=>{const Et=document.webkitFullscreenElement??document.fullscreenElement;Et&&Et===H.current?K.emitter.dispatchFullscreenChange({isFullscreen:!0}):K.emitter.dispatchFullscreenChange({isFullscreen:!1})};return ge.addEventListener("webkitfullscreenchange",Ce),ge.addEventListener("fullscreenchange",Ce),()=>{ge.removeEventListener("webkitfullscreenchange",Ce),ge.removeEventListener("fullscreenchange",Ce)}},[K.emitter]);const ke=(z==null?void 0:z.durationInFrames)??1,Ee=d.useMemo(()=>!z||!G?null:d1({canvasSize:G,compositionHeight:z.height,compositionWidth:z.width,previewSize:"auto"}),[G,z]),je=(Ee==null?void 0:Ee.scale)??1,_e=d.useRef(!1);d.useEffect(()=>{if(!_e.current){_e.current=!0;return}K.emitter.dispatchScaleChange(je)},[K.emitter,je]);const{setMediaVolume:Le,setPlayerMuted:dt}=d.useContext(me.SetMediaVolumeContext),[Zt,hn]=d.useState(!1);d.useEffect(()=>{let ge=null,Ce=!1;const Et=()=>{Ce=!1,requestAnimationFrame(()=>{D===0?hn(!0):ge=setTimeout(()=>{Ce||hn(!0)},D)})},_n=()=>{requestAnimationFrame(()=>{Ce=!0,hn(!1),ge&&clearTimeout(ge)})};return K.emitter.addEventListener("waiting",Et),K.emitter.addEventListener("resume",_n),()=>{K.emitter.removeEventListener("waiting",Et),K.emitter.removeEventListener("resume",_n),hn(!1),ge&&clearTimeout(ge),Ce=!0}},[D,K.emitter]),d.useImperativeHandle(B,()=>{const ge={play:K.play,pause:()=>{X(!1),K.pause()},toggle:Ie,getContainerNode:()=>H.current,getCurrentFrame:K.getCurrentFrame,isPlaying:K.isPlaying,seekTo:Ce=>{const Et=ke-1,_n=Math.max(0,Math.min(Et,Ce));K.isPlaying()&&(X(_n!==Et||n),K.pause()),_n===Et&&!n&&K.emitter.dispatchEnded(),K.seek(_n)},isFullscreen:()=>{const{current:Ce}=H;return Ce?document.fullscreenElement===Ce||document.webkitFullscreenElement===Ce:!1},requestFullscreen:ze,exitFullscreen:Je,getVolume:()=>ue?0:se,setVolume:Ce=>{if(typeof Ce!="number")throw new TypeError(`setVolume() takes a number, got value of type ${typeof Ce}`);if(isNaN(Ce))throw new TypeError("setVolume() got a number that is NaN. Volume must be between 0 and 1.");if(Ce<0||Ce>1)throw new TypeError(`setVolume() got a number that is out of range. Must be between 0 and 1, got ${Ce}`);Le(Ce)},isMuted:()=>Re,mute:()=>{dt(!0)},unmute:()=>{dt(!1)},getScale:()=>je,pauseAndReturnToPlayStart:()=>{K.pauseAndReturnToPlayStart()}};return Object.assign(K.emitter,ge)},[ke,Je,n,ue,Re,se,K,ze,dt,Le,Ie,je]);const Un=Z?Z.component:null,_t=d.useMemo(()=>f1({canvasSize:G,config:z,style:t,overflowVisible:j,layout:Ee}),[G,z,Ee,j,t]),Zn=d.useMemo(()=>h1({config:z,layout:Ee,scale:je,overflowVisible:j}),[z,Ee,j,je]),Kt=d.useMemo(()=>p1({config:z,layout:Ee,scale:je,overflowVisible:j}),[z,Ee,j,je]),mn=K.pause,Yt=K.emitter.dispatchError,ft=d.useCallback(ge=>{mn(),Yt(ge)},[Yt,mn]),gn=d.useCallback(ge=>{ge.stopPropagation(),ze()},[ze]),zt=d.useCallback(ge=>{ge.stopPropagation(),Je()},[Je]),Pn=d.useCallback(ge=>{(ge instanceof MouseEvent?ge.button===2:ge.nativeEvent.button)||Ie(ge)},[Ie]),Kn=d.useCallback(()=>{Se(!0)},[]),Fn=d.useCallback(()=>{Se(!1)},[]),Ir=d.useCallback(()=>{Y?Je():ze()},[Je,Y,ze]),{handlePointerDown:lr,handleDoubleClick:ur}=lj(Pn,Ir,l&&o&&de);d.useEffect(()=>{ae&&(K.play(),oe(!1))},[ae,K]);const _=d.useMemo(()=>h?h({height:_t.height,width:_t.width,isBuffering:Zt}):null,[_t.height,_t.width,h,Zt]),U=d.useMemo(()=>({type:"scale",scale:je}),[je]);if(!z)return null;const re=m?m({height:V==="player-size"?_t.height:z.height,width:V==="player-size"?_t.width:z.width,isBuffering:Zt}):null;if(re===void 0)throw new TypeError("renderPoster() must return a React element, but undefined was returned");const fe=re&&[y&&!K.isPlaying()&&!xe,g&&K.isLastFrame&&!K.isPlaying(),k&&!K.hasPlayed&&!K.isPlaying(),w&&Zt&&K.isPlaying(),b&&Zt&&!K.isPlaying()].some(Boolean),{left:we,top:be,width:Pe,height:Me,...Ve}=Zn,De=u.jsxs(u.Fragment,{children:[u.jsxs("div",{style:Zn,onPointerDown:s?lr:void 0,onDoubleClick:l?ur:void 0,children:[u.jsxs("div",{style:Kt,className:nh(P),children:[Un?u.jsx(y1,{onError:ft,errorFallback:f,children:u.jsx(me.CurrentScaleContext.Provider,{value:U,children:u.jsx(Un,{...(Z==null?void 0:Z.props)??{},...i??{}})})}):null,fe&&V==="composition-size"?u.jsx("div",{style:{...Ve,width:z.width,height:z.height},onPointerDown:s?lr:void 0,onDoubleClick:l?ur:void 0,children:re}):null]}),u.jsx(CR,{})]}),fe&&V==="player-size"?u.jsx("div",{style:Zn,onPointerDown:s?lr:void 0,onDoubleClick:l?ur:void 0,children:re}):null,e?u.jsx(oj,{fps:z.fps,playing:K.playing,toggle:K.toggle,durationInFrames:z.durationInFrames,containerRef:H,onFullscreenButtonClick:gn,isFullscreen:Y,allowFullscreen:o,showVolumeControls:a,onExitFullscreenButtonClick:zt,spaceKeyToPlayOrPause:c,onSeekEnd:Fn,onSeekStart:Kn,inFrame:S,outFrame:E,initiallyShowControls:T,canvasSize:G,renderFullscreenButton:I,renderPlayPauseButton:R,alwaysShowControls:M,showPlaybackRateControl:$,buffering:Zt,hideControlsWhenPointerDoesntMove:L,onDoubleClick:l?ur:void 0,onPointerDown:s?lr:void 0,renderMuteButton:F,renderVolumeSlider:A,renderCustomControls:W}):null]});return N||w1&&!uj?u.jsx("div",{ref:H,style:_t,className:x,children:De}):u.jsx("div",{ref:H,style:_t,className:x,children:u.jsx(d.Suspense,{fallback:_,children:De})})},dj=d.forwardRef(cj),x1="remotion.volumePreference",fj=(e,t,n)=>{if(!(typeof window>"u"))try{window.localStorage.setItem(n??x1,String(e))}catch(r){me.Log.error({logLevel:t,tag:null},"Could not persist volume",r)}},pj=e=>{if(typeof window>"u")return 1;try{const t=window.localStorage.getItem(e??x1);return t?Number(t):1}catch{return 1}},rh="player-comp",b1=({children:e,timelineContext:t,playbackRateContext:n,fps:r,compositionHeight:o,compositionWidth:i,durationInFrames:s,component:a,numberOfSharedAudioTags:l,initiallyMuted:c,logLevel:f,audioLatencyHint:p,sampleRate:h,volumePersistenceKey:m,initialVolume:x,inputProps:v,audioEnabled:k})=>{const g=x===void 0,y=d.useMemo(()=>({compositions:[{component:a,durationInFrames:s,height:o,width:i,fps:r,id:rh,nonce:[[0,777]],folderName:null,parentFolderName:null,schema:null,calculateMetadata:null,stack:null}],folders:[],currentCompositionMetadata:{defaultCodec:null,defaultOutName:null,defaultPixelFormat:null,defaultProResProfile:null,defaultSampleRate:null,defaultVideoImageFormat:null,durationInFrames:s,fps:r,height:o,width:i,props:v},canvasContent:{type:"composition",compositionId:"player-comp"}}),[a,s,o,i,r,v]),[w,b]=d.useState(()=>c),[S,E]=d.useState(()=>g?pj(m??null):x),T=d.useMemo(()=>({playerMuted:w,mediaVolume:S}),[w,S]),I=d.useRef(!1),R=I.current||k&&!w&&S>0;I.current=R;const F=d.useCallback($=>{E($),g&&fj($,f,m??null)},[g,f,m]),A=d.useMemo(()=>({setPlayerMuted:b,setMediaVolume:F}),[F]),W=d.useMemo(()=>({logLevel:f,mountTime:Date.now()}),[f]),M=d.useMemo(()=>({isPlayer:!0,isRendering:!1,isStudio:!1,isClientSideRendering:!1,isReadOnlyStudio:!1}),[]);return u.jsx(me.RemotionEnvironmentContext.Provider,{value:M,children:u.jsx(me.LogLevelContext.Provider,{value:W,children:u.jsx(me.CanUseRemotionHooksProvider,{children:u.jsx(me.AbsoluteTimeContext.Provider,{value:t,children:u.jsx(me.PlaybackRateContext.Provider,{value:n,children:u.jsx(me.TimelineContext.Provider,{value:t,children:u.jsx(me.CompositionManager.Provider,{value:y,children:u.jsx(me.PrefetchProvider,{children:u.jsx(me.DurationsContextProvider,{children:u.jsx(me.MediaVolumeContext.Provider,{value:T,children:u.jsx(me.SetMediaVolumeContext.Provider,{value:A,children:u.jsx(me.BufferingProvider,{children:u.jsx(me.SharedAudioContextProvider,{audioLatencyHint:p,audioEnabled:R,previewSampleRate:h,children:u.jsx(me.SharedAudioTagsContextProvider,{numberOfAudioTags:l,children:e})})})})})})})})})})})})})})},bg=!1,hj=(e,t)=>{e||bg||(bg=!0,me.Log.warn({logLevel:t,tag:null},"Note: Some companies are required to obtain a license to use Remotion. See: https://remotion.dev/license\nPass the `acknowledgeRemotionLicense` prop to `<Player />` function to make this message disappear."))},Sg=(e,t)=>{if(typeof e>"u"||e===null)return e??null;if(typeof e!="number")throw new TypeError(`"${t}" must be a number, but is ${JSON.stringify(e)}`);if(Number.isNaN(e))throw new TypeError(`"${t}" must not be NaN, but is ${JSON.stringify(e)}`);if(!Number.isFinite(e))throw new TypeError(`"${t}" must be finite, but is ${JSON.stringify(e)}`);if(e%1!==0)throw new TypeError(`"${t}" must be an integer, but is ${JSON.stringify(e)}`);return e},mj=({inFrame:e,durationInFrames:t,outFrame:n})=>{const r=Sg(e,"inFrame"),o=Sg(n,"outFrame");if(!(r===null&&o===null)){if(r!==null&&r>t-1)throw new Error("inFrame must be less than (durationInFrames - 1), but is "+r);if(o!==null&&o>t-1)throw new Error("outFrame must be less than (durationInFrames - 1), but is "+o);if(r!==null&&r<0)throw new Error("inFrame must be greater than 0, but is "+r);if(o!==null&&o<=0)throw new Error(`outFrame must be greater than 0, but is ${o}. If you want to render a single frame, use <Thumbnail /> instead.`);if(o!==null&&r!==null&&o<=r)throw new Error("outFrame must be greater than inFrame, but is "+o+" <= "+r)}},gj=({initialFrame:e,durationInFrames:t})=>{if(typeof t!="number")throw new Error(`\`durationInFrames\` must be a number, but is ${JSON.stringify(t)}`);if(!(typeof e>"u")){if(typeof e!="number")throw new Error(`\`initialFrame\` must be a number, but is ${JSON.stringify(e)}`);if(Number.isNaN(e))throw new Error("`initialFrame` must be a number, but is NaN");if(!Number.isFinite(e))throw new Error("`initialFrame` must be a number, but is Infinity");if(e%1!==0)throw new Error(`\`initialFrame\` must be an integer, but is ${JSON.stringify(e)}`);if(e>t-1)throw new Error(`\`initialFrame\` must be less or equal than \`durationInFrames - 1\`, but is ${JSON.stringify(e)}`)}},vj=e=>{if(e!==void 0){if(e>10)throw new Error(`The highest possible playback rate is 10. You passed: ${e}`);if(e<-10)throw new Error(`The lowest possible playback rate is -10. You passed: ${e}`);if(e===0)throw new Error("A playback rate of 0 is not supported.")}},yj=Vu.validateFps,kg=Vu.validateDimension,wj=Vu.validateDurationInFrames,xj=Vu.validateDefaultAndInputProps,bj=e=>"component"in e?e.component:null,Sj=({durationInFrames:e,compositionHeight:t,compositionWidth:n,fps:r,inputProps:o,style:i,controls:s=!1,loop:a=!1,autoPlay:l=!1,showVolumeControls:c=!0,allowFullscreen:f=!0,clickToPlay:p,doubleClickToFullscreen:h=!1,spaceKeyToPlayOrPause:m=!0,moveToBeginningWhenEnded:x=!0,numberOfSharedAudioTags:v=5,errorFallback:k=()=>"⚠️",playbackRate:g=1,renderLoading:y,className:w,showPosterWhenUnplayed:b,showPosterWhenEnded:S,showPosterWhenPaused:E,showPosterWhenBuffering:T,showPosterWhenBufferingAndPaused:I,initialFrame:R,renderPoster:F,inFrame:A,outFrame:W,initiallyShowControls:M,renderFullscreenButton:$,renderPlayPauseButton:V,renderVolumeSlider:D,renderCustomControls:L,alwaysShowControls:j=!1,initiallyMuted:C=!1,showPlaybackRateControl:P=!1,posterFillMode:N="player-size",bufferStateDelayInMilliseconds:B,hideControlsWhenPointerDoesntMove:z=!0,overflowVisible:Z=!1,renderMuteButton:H,browserMediaControlsBehavior:G,overrideInternalClassName:O,logLevel:X="info",noSuspense:ae,acknowledgeRemotionLicense:oe,audioLatencyHint:Y="playback",sampleRate:q=48e3,volumePersistenceKey:xe,initialVolume:Se,...de},K)=>{if(typeof window<"u"&&(window.remotion_isPlayer=!0),de.defaultProps!==void 0)throw new Error("The <Player /> component does not accept `defaultProps`, but some were passed. Use `inputProps` instead.");const ee=bj(de);if((ee==null?void 0:ee.type)===Hl)throw new TypeError("'component' should not be an instance of <Composition/>. Pass the React component directly, and set the duration, fps and dimensions as separate props. See https://www.remotion.dev/docs/player/examples for an example.");if(ee===Hl)throw new TypeError("'component' must not be the 'Composition' component. Pass your own React component directly, and set the duration, fps and dimensions as separate props. See https://www.remotion.dev/docs/player/examples for an example.");d.useState(()=>hj(!!oe,X));const ue=me.useLazyComponent({compProps:de,componentName:"Player",noSuspense:!!ae});gj({initialFrame:R,durationInFrames:e});const[se,Re]=d.useState(()=>({[rh]:R??0})),[Ie,ze]=d.useState(!1),[Je]=d.useState("player-comp"),ke=d.useRef(null),Ee=d.useRef([]),je=d.useRef(!1),[_e,Le]=d.useState(g);if(typeof t!="number")throw new TypeError(`'compositionHeight' must be a number but got '${typeof t}' instead`);if(typeof n!="number")throw new TypeError(`'compositionWidth' must be a number but got '${typeof n}' instead`);if(kg(t,"compositionHeight","of the <Player /> component"),kg(n,"compositionWidth","of the <Player /> component"),wj(e,{component:"of the <Player/> component",allowFloats:!1}),yj(r,"as a prop of the <Player/> component",!1),xj(o,"inputProps",null),mj({durationInFrames:e,inFrame:A,outFrame:W}),typeof s!="boolean"&&typeof s<"u")throw new TypeError(`'controls' must be a boolean or undefined but got '${typeof s}' instead`);if(typeof l!="boolean"&&typeof l<"u")throw new TypeError(`'autoPlay' must be a boolean or undefined but got '${typeof l}' instead`);if(typeof a!="boolean"&&typeof a<"u")throw new TypeError(`'loop' must be a boolean or undefined but got '${typeof a}' instead`);if(typeof h!="boolean"&&typeof h<"u")throw new TypeError(`'doubleClickToFullscreen' must be a boolean or undefined but got '${typeof h}' instead`);if(typeof c!="boolean"&&typeof c<"u")throw new TypeError(`'showVolumeControls' must be a boolean or undefined but got '${typeof c}' instead`);if(typeof f!="boolean"&&typeof f<"u")throw new TypeError(`'allowFullscreen' must be a boolean or undefined but got '${typeof f}' instead`);if(typeof p!="boolean"&&typeof p<"u")throw new TypeError(`'clickToPlay' must be a boolean or undefined but got '${typeof p}' instead`);if(typeof m!="boolean"&&typeof m<"u")throw new TypeError(`'spaceKeyToPlayOrPause' must be a boolean or undefined but got '${typeof m}' instead`);if(typeof q!="number"||!Number.isFinite(q)||Number.isNaN(q)||q<=0||q%1!==0)throw new TypeError(`'sampleRate' must be a positive integer but got '${q}' instead`);if(typeof Se<"u"&&typeof Se!="number")throw new TypeError(`'initialVolume' must be a number or undefined but got '${typeof Se}' instead`);if(typeof Se=="number"&&(!Number.isFinite(Se)||Number.isNaN(Se)||Se<0||Se>1))throw new TypeError(`'initialVolume' must be between 0 and 1 but got '${Se}' instead`);if(typeof v!="number"||v%1!==0||!Number.isFinite(v)||Number.isNaN(v)||v<0)throw new TypeError(`'numberOfSharedAudioTags' must be an integer but got '${v}' instead`);vj(_e),d.useEffect(()=>{Le(g)},[g]),d.useImperativeHandle(K,()=>ke.current,[]),d.useState(()=>{me.playbackLogging({logLevel:X,message:`[player] Mounting <Player>. User agent = ${typeof navigator>"u"?"server":navigator.userAgent}`,tag:"player",mountTime:Date.now()})});const dt=d.useMemo(()=>({frame:se,playing:Ie,rootId:Je,imperativePlaying:je,audioAndVideoTags:Ee}),[se,Ie,Je]),Zt=d.useMemo(()=>({playbackRate:_e,setPlaybackRate:Le}),[_e]),hn=d.useMemo(()=>({setFrame:Re,setPlaying:ze}),[Re]);typeof window<"u"&&d.useLayoutEffect(()=>{me.CSSUtils.injectCSS(me.CSSUtils.makeDefaultPreviewCSS(`.${nh(O)}`,"#fff"))},[O]);const Un=d.useMemo(()=>o??{},[o]),_t=d.useMemo(()=>G??{mode:"prevent-media-session"},[G]);return u.jsx(me.IsPlayerContextProvider,{children:u.jsx(b1,{timelineContext:dt,playbackRateContext:Zt,component:ue,compositionHeight:t,compositionWidth:n,durationInFrames:e,fps:r,numberOfSharedAudioTags:v,initiallyMuted:C,logLevel:X,audioLatencyHint:Y,sampleRate:q,volumePersistenceKey:xe,initialVolume:Se,inputProps:Un,audioEnabled:!0,children:u.jsx(me.SetTimelineContext.Provider,{value:hn,children:u.jsx(mR,{currentPlaybackRate:_e,children:u.jsx(dj,{ref:ke,posterFillMode:N,renderLoading:y,autoPlay:!!l,loop:!!a,controls:!!s,errorFallback:k,style:i,inputProps:Un,allowFullscreen:!!f,moveToBeginningWhenEnded:!!x,clickToPlay:typeof p=="boolean"?p:!!s,showVolumeControls:!!c,doubleClickToFullscreen:!!h,spaceKeyToPlayOrPause:!!m,playbackRate:_e,className:w??void 0,showPosterWhenUnplayed:!!b,showPosterWhenEnded:!!S,showPosterWhenPaused:!!E,showPosterWhenBuffering:!!T,showPosterWhenBufferingAndPaused:!!I,renderPoster:F,inFrame:A??null,outFrame:W??null,initiallyShowControls:M??!0,renderFullscreen:$??null,renderPlayPauseButton:V??null,renderMuteButton:H??null,renderVolumeSlider:D??null,renderCustomControls:L??null,alwaysShowControls:j,showPlaybackRateControl:P,bufferStateDelayInMilliseconds:B??300,hideControlsWhenPointerDoesntMove:z,overflowVisible:Z,browserMediaControlsBehavior:_t,overrideInternalClassName:O??void 0,noSuspense:!!ae})})})})})},kj=d.forwardRef,Ej=kj(Sj),Cj=()=>{const e=d.useContext(g1);if(!e)throw new TypeError("Expected Player event emitter context");return d.useMemo(()=>({emitter:e}),[e])},kf=le.version.split(".")[0];if(kf==="0")throw new Error(`Version ${kf} of "react" is not supported by Remotion`);var Ij=parseInt(kf,10)>=18,Tj=({style:e,inputProps:t,errorFallback:n,renderLoading:r,className:o,overflowVisible:i,noSuspense:s,overrideInternalClassName:a},l)=>{const c=me.useUnsafeVideoConfig(),f=me.useVideo(),p=d.useRef(null),h=th(p,{triggerOnWindowResize:!1,shouldApplyCssTransforms:!1}),m=d.useMemo(()=>!c||!h?null:d1({canvasSize:h,compositionHeight:c.height,compositionWidth:c.width,previewSize:"auto"}),[h,c]),x=(m==null?void 0:m.scale)??1,v=Cj();v1(v.emitter),d.useImperativeHandle(l,()=>{const I={getContainerNode:()=>p.current,getScale:()=>x};return Object.assign(v.emitter,I)},[x,v.emitter]);const k=f?f.component:null,g=d.useMemo(()=>f1({config:c,style:e,canvasSize:h,overflowVisible:i,layout:m}),[h,c,m,i,e]),y=d.useMemo(()=>h1({config:c,layout:m,scale:x,overflowVisible:i}),[c,m,i,x]),w=d.useMemo(()=>p1({config:c,layout:m,scale:x,overflowVisible:i}),[c,m,i,x]),b=d.useCallback(I=>{v.emitter.dispatchError(I)},[v.emitter]),S=d.useMemo(()=>r?r({height:g.height,width:g.width,isBuffering:!1}):null,[g.height,g.width,r]),E=d.useMemo(()=>({type:"scale",scale:x}),[x]);if(!c)return null;const T=u.jsx("div",{style:y,children:u.jsx("div",{style:w,className:nh(a),children:k?u.jsx(y1,{onError:b,errorFallback:n,children:u.jsx(me.CurrentScaleContext.Provider,{value:E,children:u.jsx(k,{...(f==null?void 0:f.props)??{},...t??{}})})}):null})});return s||w1&&!Ij?u.jsx("div",{ref:p,style:g,className:o,children:T}):u.jsx("div",{ref:p,style:g,className:o,children:u.jsx(d.Suspense,{fallback:S,children:T})})},Rj=d.forwardRef(Tj),jj=({frameToDisplay:e,style:t,inputProps:n,compositionHeight:r,compositionWidth:o,durationInFrames:i,fps:s,className:a,errorFallback:l=()=>"⚠️",renderLoading:c,overflowVisible:f=!1,overrideInternalClassName:p,logLevel:h="info",noSuspense:m,...x},v)=>{typeof window<"u"&&d.useLayoutEffect(()=>{window.remotion_isPlayer=!0},[]);const[k]=d.useState(()=>String(Fo(null))),g=d.useRef(null),y=d.useMemo(()=>({playing:!1,frame:{[rh]:e},rootId:k,imperativePlaying:{current:!1},audioAndVideoTags:{current:[]}}),[e,k]),w=d.useMemo(()=>({playbackRate:1,setPlaybackRate:()=>{throw new Error("thumbnail")}}),[]);d.useImperativeHandle(v,()=>g.current,[]);const b=me.useLazyComponent({compProps:x,componentName:"Thumbnail",noSuspense:!!m}),[S]=d.useState(()=>new hR),E=d.useMemo(()=>n??{},[n]);return u.jsx(me.IsPlayerContextProvider,{children:u.jsx(b1,{timelineContext:y,playbackRateContext:w,component:b,compositionHeight:r,compositionWidth:o,durationInFrames:i,fps:s,numberOfSharedAudioTags:0,initiallyMuted:!0,logLevel:h,audioLatencyHint:"playback",sampleRate:48e3,inputProps:E,audioEnabled:!1,children:u.jsx(g1.Provider,{value:S,children:u.jsx(Rj,{ref:g,className:a,errorFallback:l,inputProps:E,renderLoading:c,style:t,overflowVisible:f,overrideInternalClassName:p,noSuspense:!!m})})})})},Pj=d.forwardRef;Pj(jj);const yi=[1,1.5,2,4];function Eg(e){return yi.find(t=>t>e+1e-9)??yi[yi.length-1]}function Fj(e,t){switch(t){case"L":return e.playing&&e.rate>0?{rate:Eg(e.rate),playing:!0}:{rate:yi[0],playing:!0};case"J":return e.playing&&e.rate<0?{rate:-Eg(-e.rate),playing:!0}:{rate:-yi[0],playing:!0};case"K":return{rate:yi[0],playing:!e.playing}}}function oh(e,t,n){const r=Math.round(e*n),o=Math.round(t*n);return{from:r,durationInFrames:Math.max(1,o-r)}}function _j(e){if(typeof e!="object"||e===null)return null;const t=e;return typeof t.scale!="number"||!Number.isFinite(t.scale)||t.scale<=0||!Array.isArray(t.allowed)||t.allowed.some(n=>typeof n!="boolean")?null:{scale:t.scale,allowed:t.allowed}}function Mj(e,t,n,r){const o=t?t.scale:n,i=[];let s=!1;for(let a=0;a<e.length;a++){const l=e[a-1],c=l?e[a].srcIn-l.srcOut:0;a>0&&c>=r&&(s=!s);const f=t?t.allowed[a]!==!1:!0;i.push(s&&f?o:1)}return i}const $j=({src:e,spans:t,punchInScale:n=1.07,punch:r=null,punchThresholdSec:o=.15,audioFadeSec:i=.01,background:s="black"})=>{const{fps:a}=ht(),l=d.useMemo(()=>Mj(t,r,n,o),[t,r,n,o]),c=Math.max(1,Math.round(i*a));return u.jsx(Vn,{style:{backgroundColor:s},children:t.map((f,p)=>{const{from:h,durationInFrames:m}=oh(f.outIn,f.outOut,a);return u.jsx(Ft,{from:h,durationInFrames:m,premountFor:a,children:u.jsx(Vn,{style:{transform:`scale(${l[p]})`},children:u.jsx(l1,{src:e,trimBefore:Math.round(f.srcIn*a),trimAfter:Math.round(f.srcOut*a),style:{width:"100%",height:"100%",objectFit:"cover",objectPosition:"var(--ossclip-obj-x, 50%) var(--ossclip-obj-y, 50%)"},volume:x=>Math.max(0,Math.min(1,(x+1)/c,(m-x)/c))})})},p)})})};function J(e,t,n){function r(a,l){var c;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(c=a._zod).traits??(c.traits=new Set),a._zod.traits.add(e),t(a,l);for(const f in s.prototype)f in a||Object.defineProperty(a,f,{value:s.prototype[f].bind(a)});a._zod.constr=s,a._zod.def=l}const o=(n==null?void 0:n.Parent)??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function s(a){var l;const c=n!=null&&n.Parent?new i:this;r(c,a),(l=c._zod).deferred??(l.deferred=[]);for(const f of c._zod.deferred)f();return c}return Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>{var l,c;return n!=null&&n.Parent&&a instanceof n.Parent?!0:(c=(l=a==null?void 0:a._zod)==null?void 0:l.traits)==null?void 0:c.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}class Hs extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const S1={};function Qr(e){return S1}function Aj(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function Nj(e,t){return typeof t=="bigint"?t.toString():t}function k1(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function ih(e){return e==null}function sh(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Lj(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,i=Number.parseInt(e.toFixed(o).replace(".","")),s=Number.parseInt(t.toFixed(o).replace(".",""));return i%s/10**o}function Xe(e,t,n){Object.defineProperty(e,t,{get(){{const r=n();return e[t]=r,r}},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function ah(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function os(e){return JSON.stringify(e)}const E1=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Ef(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Dj=k1(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function Xl(e){if(Ef(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(Ef(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}const zj=new Set(["string","number","symbol"]);function da(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ao(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function ve(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Oj(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Bj={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Wj(e,t){const n={},r=e._zod.def;for(const o in t){if(!(o in r.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&(n[o]=r.shape[o])}return Ao(e,{...e._zod.def,shape:n,checks:[]})}function Vj(e,t){const n={...e._zod.def.shape},r=e._zod.def;for(const o in t){if(!(o in r.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&delete n[o]}return Ao(e,{...e._zod.def,shape:n,checks:[]})}function Hj(e,t){if(!Xl(t))throw new Error("Invalid input to extend: expected a plain object");const n={...e._zod.def,get shape(){const r={...e._zod.def.shape,...t};return ah(this,"shape",r),r},checks:[]};return Ao(e,n)}function Uj(e,t){return Ao(e,{...e._zod.def,get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return ah(this,"shape",n),n},catchall:t._zod.def.catchall,checks:[]})}function Zj(e,t,n){const r=t._zod.def.shape,o={...r};if(n)for(const i in n){if(!(i in r))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(o[i]=e?new e({type:"optional",innerType:r[i]}):r[i])}else for(const i in r)o[i]=e?new e({type:"optional",innerType:r[i]}):r[i];return Ao(t,{...t._zod.def,shape:o,checks:[]})}function Kj(e,t,n){const r=t._zod.def.shape,o={...r};if(n)for(const i in n){if(!(i in o))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(o[i]=new e({type:"nonoptional",innerType:r[i]}))}else for(const i in r)o[i]=new e({type:"nonoptional",innerType:r[i]});return Ao(t,{...t._zod.def,shape:o,checks:[]})}function bs(e,t=0){var n;for(let r=t;r<e.issues.length;r++)if(((n=e.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function go(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Ba(e){return typeof e=="string"?e:e==null?void 0:e.message}function Jr(e,t,n){var o,i,s,a,l,c;const r={...e,path:e.path??[]};if(!e.message){const f=Ba((s=(i=(o=e.inst)==null?void 0:o._zod.def)==null?void 0:i.error)==null?void 0:s.call(i,e))??Ba((a=t==null?void 0:t.error)==null?void 0:a.call(t,e))??Ba((l=n.customError)==null?void 0:l.call(n,e))??Ba((c=n.localeError)==null?void 0:c.call(n,e))??"Invalid input";r.message=f}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function lh(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Us(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const C1=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,Nj,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},I1=J("$ZodError",C1),T1=J("$ZodError",C1,{Parent:Error});function Yj(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function Gj(e,t){const n=t||function(i){return i.message},r={_errors:[]},o=i=>{for(const s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>o({issues:a}));else if(s.code==="invalid_key")o({issues:s.issues});else if(s.code==="invalid_element")o({issues:s.issues});else if(s.path.length===0)r._errors.push(n(s));else{let a=r,l=0;for(;l<s.path.length;){const c=s.path[l];l===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(s))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return o(e),r}const Xj=e=>(t,n,r,o)=>{const i=r?Object.assign(r,{async:!1}):{async:!1},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new Hs;if(s.issues.length){const a=new((o==null?void 0:o.Err)??e)(s.issues.map(l=>Jr(l,i,Qr())));throw E1(a,o==null?void 0:o.callee),a}return s.value},qj=e=>async(t,n,r,o)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){const a=new((o==null?void 0:o.Err)??e)(s.issues.map(l=>Jr(l,i,Qr())));throw E1(a,o==null?void 0:o.callee),a}return s.value},R1=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new Hs;return i.issues.length?{success:!1,error:new(e??I1)(i.issues.map(s=>Jr(s,o,Qr())))}:{success:!0,data:i.value}},Qj=R1(T1),j1=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(s=>Jr(s,o,Qr())))}:{success:!0,data:i.value}},Jj=j1(T1),eP=/^[cC][^\s-]{8,}$/,tP=/^[0-9a-z]+$/,nP=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,rP=/^[0-9a-vA-V]{20}$/,oP=/^[A-Za-z0-9]{27}$/,iP=/^[a-zA-Z0-9_-]{21}$/,sP=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,aP=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Cg=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,lP=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,uP="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function cP(){return new RegExp(uP,"u")}const dP=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,fP=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,pP=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,hP=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,mP=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,P1=/^[A-Za-z0-9_-]*$/,gP=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,vP=/^\+(?:[0-9]){6,14}[0-9]$/,F1="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",yP=new RegExp(`^${F1}$`);function _1(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function wP(e){return new RegExp(`^${_1(e)}$`)}function xP(e){const t=_1({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-]\\d{2}:\\d{2})");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${F1}T(?:${r})$`)}const bP=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},SP=/^\d+$/,kP=/^-?\d+(?:\.\d+)?/i,EP=/true|false/i,CP=/^[^A-Z]*$/,IP=/^[^a-z]*$/,tn=J("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),M1={number:"number",bigint:"bigint",object:"date"},$1=J("$ZodCheckLessThan",(e,t)=>{tn.init(e,t);const n=M1[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),A1=J("$ZodCheckGreaterThan",(e,t)=>{tn.init(e,t);const n=M1[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),TP=J("$ZodCheckMultipleOf",(e,t)=>{tn.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):Lj(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),RP=J("$ZodCheckNumberFormat",(e,t)=>{var s;tn.init(e,t),t.format=t.format||"float64";const n=(s=t.format)==null?void 0:s.includes("int"),r=n?"int":"number",[o,i]=Bj[t.format];e._zod.onattach.push(a=>{const l=a._zod.bag;l.format=t.format,l.minimum=o,l.maximum=i,n&&(l.pattern=SP)}),e._zod.check=a=>{const l=a.value;if(n){if(!Number.isInteger(l)){a.issues.push({expected:r,format:t.format,code:"invalid_type",input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?a.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!t.abort}):a.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!t.abort});return}}l<o&&a.issues.push({origin:"number",input:l,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),l>i&&a.issues.push({origin:"number",input:l,code:"too_big",maximum:i,inst:e})}}),jP=J("$ZodCheckMaxLength",(e,t)=>{var n;tn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!ih(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const s=lh(o);r.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),PP=J("$ZodCheckMinLength",(e,t)=>{var n;tn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!ih(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const s=lh(o);r.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),FP=J("$ZodCheckLengthEquals",(e,t)=>{var n;tn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!ih(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,i=o.length;if(i===t.length)return;const s=lh(o),a=i>t.length;r.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Uu=J("$ZodCheckStringFormat",(e,t)=>{var n,r;tn.init(e,t),e._zod.onattach.push(o=>{const i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),_P=J("$ZodCheckRegex",(e,t)=>{Uu.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),MP=J("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=CP),Uu.init(e,t)}),$P=J("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=IP),Uu.init(e,t)}),AP=J("$ZodCheckIncludes",(e,t)=>{tn.init(e,t);const n=da(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),NP=J("$ZodCheckStartsWith",(e,t)=>{tn.init(e,t);const n=new RegExp(`^${da(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),LP=J("$ZodCheckEndsWith",(e,t)=>{tn.init(e,t);const n=new RegExp(`.*${da(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),DP=J("$ZodCheckOverwrite",(e,t)=>{tn.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class zP{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
|
|
135
|
-
`).filter(s=>s),o=Math.min(...r.map(s=>s.length-s.trimStart().length)),i=r.map(s=>s.slice(o)).map(s=>" ".repeat(this.indent*2)+s);for(const s of i)this.content.push(s)}compile(){const t=Function,n=this==null?void 0:this.args,o=[...((this==null?void 0:this.content)??[""]).map(i=>` ${i}`)];return new t(...n,o.join(`
|
|
136
|
-
`))}}const OP={major:4,minor:0,patch:0},qe=J("$ZodType",(e,t)=>{var o;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=OP;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const i of r)for(const s of i._zod.onattach)s(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),(o=e._zod.deferred)==null||o.push(()=>{e._zod.run=e._zod.parse});else{const i=(s,a,l)=>{let c=bs(s),f;for(const p of a){if(p._zod.def.when){if(!p._zod.def.when(s))continue}else if(c)continue;const h=s.issues.length,m=p._zod.check(s);if(m instanceof Promise&&(l==null?void 0:l.async)===!1)throw new Hs;if(f||m instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await m,s.issues.length!==h&&(c||(c=bs(s,h)))});else{if(s.issues.length===h)continue;c||(c=bs(s,h))}}return f?f.then(()=>s):s};e._zod.run=(s,a)=>{const l=e._zod.parse(s,a);if(l instanceof Promise){if(a.async===!1)throw new Hs;return l.then(c=>i(c,r,a))}return i(l,r,a)}}e["~standard"]={validate:i=>{var s;try{const a=Qj(e,i);return a.success?{value:a.data}:{issues:(s=a.error)==null?void 0:s.issues}}catch{return Jj(e,i).then(l=>{var c;return l.success?{value:l.data}:{issues:(c=l.error)==null?void 0:c.issues}})}},vendor:"zod",version:1}}),uh=J("$ZodString",(e,t)=>{var n;qe.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??bP(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Qe=J("$ZodStringFormat",(e,t)=>{Uu.init(e,t),uh.init(e,t)}),BP=J("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=aP),Qe.init(e,t)}),WP=J("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Cg(r))}else t.pattern??(t.pattern=Cg());Qe.init(e,t)}),VP=J("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=lP),Qe.init(e,t)}),HP=J("$ZodURL",(e,t)=>{Qe.init(e,t),e._zod.check=n=>{try{const r=n.value,o=new URL(r),i=o.href;t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:gP.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),!r.endsWith("/")&&i.endsWith("/")?n.value=i.slice(0,-1):n.value=i;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),UP=J("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=cP()),Qe.init(e,t)}),ZP=J("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=iP),Qe.init(e,t)}),KP=J("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=eP),Qe.init(e,t)}),YP=J("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=tP),Qe.init(e,t)}),GP=J("$ZodULID",(e,t)=>{t.pattern??(t.pattern=nP),Qe.init(e,t)}),XP=J("$ZodXID",(e,t)=>{t.pattern??(t.pattern=rP),Qe.init(e,t)}),qP=J("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=oP),Qe.init(e,t)}),QP=J("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=xP(t)),Qe.init(e,t)}),JP=J("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=yP),Qe.init(e,t)}),eF=J("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=wP(t)),Qe.init(e,t)}),tF=J("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=sP),Qe.init(e,t)}),nF=J("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=dP),Qe.init(e,t),e._zod.onattach.push(n=>{const r=n._zod.bag;r.format="ipv4"})}),rF=J("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=fP),Qe.init(e,t),e._zod.onattach.push(n=>{const r=n._zod.bag;r.format="ipv6"}),e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),oF=J("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=pP),Qe.init(e,t)}),iF=J("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=hP),Qe.init(e,t),e._zod.check=n=>{const[r,o]=n.value.split("/");try{if(!o)throw new Error;const i=Number(o);if(`${i}`!==o)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${r}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function N1(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const sF=J("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=mP),Qe.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64"}),e._zod.check=n=>{N1(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function aF(e){if(!P1.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return N1(n)}const lF=J("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=P1),Qe.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64url"}),e._zod.check=n=>{aF(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),uF=J("$ZodE164",(e,t)=>{t.pattern??(t.pattern=vP),Qe.init(e,t)});function cF(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const dF=J("$ZodJWT",(e,t)=>{Qe.init(e,t),e._zod.check=n=>{cF(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),L1=J("$ZodNumber",(e,t)=>{qe.init(e,t),e._zod.pattern=e._zod.bag.pattern??kP,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;const i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),n}}),fF=J("$ZodNumber",(e,t)=>{RP.init(e,t),L1.init(e,t)}),pF=J("$ZodBoolean",(e,t)=>{qe.init(e,t),e._zod.pattern=EP,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),hF=J("$ZodUnknown",(e,t)=>{qe.init(e,t),e._zod.parse=n=>n}),mF=J("$ZodNever",(e,t)=>{qe.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Ig(e,t,n){e.issues.length&&t.issues.push(...go(n,e.issues)),t.value[n]=e.value}const gF=J("$ZodArray",(e,t)=>{qe.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const i=[];for(let s=0;s<o.length;s++){const a=o[s],l=t.element._zod.run({value:a,issues:[]},r);l instanceof Promise?i.push(l.then(c=>Ig(c,n,s))):Ig(l,n,s)}return i.length?Promise.all(i).then(()=>n):n}});function Wa(e,t,n){e.issues.length&&t.issues.push(...go(n,e.issues)),t.value[n]=e.value}function Tg(e,t,n,r){e.issues.length?r[n]===void 0?n in r?t.value[n]=void 0:t.value[n]=e.value:t.issues.push(...go(n,e.issues)):e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}const vF=J("$ZodObject",(e,t)=>{qe.init(e,t);const n=k1(()=>{const p=Object.keys(t.shape);for(const m of p)if(!(t.shape[m]instanceof qe))throw new Error(`Invalid element at key "${m}": expected a Zod schema`);const h=Oj(t.shape);return{shape:t.shape,keys:p,keySet:new Set(p),numKeys:p.length,optionalKeys:new Set(h)}});Xe(e._zod,"propValues",()=>{const p=t.shape,h={};for(const m in p){const x=p[m]._zod;if(x.values){h[m]??(h[m]=new Set);for(const v of x.values)h[m].add(v)}}return h});const r=p=>{const h=new zP(["shape","payload","ctx"]),m=n.value,x=y=>{const w=os(y);return`shape[${w}]._zod.run({ value: input[${w}], issues: [] }, ctx)`};h.write("const input = payload.value;");const v=Object.create(null);let k=0;for(const y of m.keys)v[y]=`key_${k++}`;h.write("const newResult = {}");for(const y of m.keys)if(m.optionalKeys.has(y)){const w=v[y];h.write(`const ${w} = ${x(y)};`);const b=os(y);h.write(`
|
|
137
|
-
if (${w}.issues.length) {
|
|
138
|
-
if (input[${b}] === undefined) {
|
|
139
|
-
if (${b} in input) {
|
|
140
|
-
newResult[${b}] = undefined;
|
|
141
|
-
}
|
|
142
|
-
} else {
|
|
143
|
-
payload.issues = payload.issues.concat(
|
|
144
|
-
${w}.issues.map((iss) => ({
|
|
145
|
-
...iss,
|
|
146
|
-
path: iss.path ? [${b}, ...iss.path] : [${b}],
|
|
147
|
-
}))
|
|
148
|
-
);
|
|
149
|
-
}
|
|
150
|
-
} else if (${w}.value === undefined) {
|
|
151
|
-
if (${b} in input) newResult[${b}] = undefined;
|
|
152
|
-
} else {
|
|
153
|
-
newResult[${b}] = ${w}.value;
|
|
154
|
-
}
|
|
155
|
-
`)}else{const w=v[y];h.write(`const ${w} = ${x(y)};`),h.write(`
|
|
156
|
-
if (${w}.issues.length) payload.issues = payload.issues.concat(${w}.issues.map(iss => ({
|
|
157
|
-
...iss,
|
|
158
|
-
path: iss.path ? [${os(y)}, ...iss.path] : [${os(y)}]
|
|
159
|
-
})));`),h.write(`newResult[${os(y)}] = ${w}.value`)}h.write("payload.value = newResult;"),h.write("return payload;");const g=h.compile();return(y,w)=>g(p,y,w)};let o;const i=Ef,s=!S1.jitless,l=s&&Dj.value,c=t.catchall;let f;e._zod.parse=(p,h)=>{f??(f=n.value);const m=p.value;if(!i(m))return p.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),p;const x=[];if(s&&l&&(h==null?void 0:h.async)===!1&&h.jitless!==!0)o||(o=r(t.shape)),p=o(p,h);else{p.value={};const w=f.shape;for(const b of f.keys){const S=w[b],E=S._zod.run({value:m[b],issues:[]},h),T=S._zod.optin==="optional"&&S._zod.optout==="optional";E instanceof Promise?x.push(E.then(I=>T?Tg(I,p,b,m):Wa(I,p,b))):T?Tg(E,p,b,m):Wa(E,p,b)}}if(!c)return x.length?Promise.all(x).then(()=>p):p;const v=[],k=f.keySet,g=c._zod,y=g.def.type;for(const w of Object.keys(m)){if(k.has(w))continue;if(y==="never"){v.push(w);continue}const b=g.run({value:m[w],issues:[]},h);b instanceof Promise?x.push(b.then(S=>Wa(S,p,w))):Wa(b,p,w)}return v.length&&p.issues.push({code:"unrecognized_keys",keys:v,input:m,inst:e}),x.length?Promise.all(x).then(()=>p):p}});function Rg(e,t,n,r){for(const o of e)if(o.issues.length===0)return t.value=o.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(o=>o.issues.map(i=>Jr(i,r,Qr())))}),t}const yF=J("$ZodUnion",(e,t)=>{qe.init(e,t),Xe(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),Xe(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),Xe(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),Xe(e._zod,"pattern",()=>{if(t.options.every(n=>n._zod.pattern)){const n=t.options.map(r=>r._zod.pattern);return new RegExp(`^(${n.map(r=>sh(r.source)).join("|")})$`)}}),e._zod.parse=(n,r)=>{let o=!1;const i=[];for(const s of t.options){const a=s._zod.run({value:n.value,issues:[]},r);if(a instanceof Promise)i.push(a),o=!0;else{if(a.issues.length===0)return a;i.push(a)}}return o?Promise.all(i).then(s=>Rg(s,n,e,r)):Rg(i,n,e,r)}}),wF=J("$ZodIntersection",(e,t)=>{qe.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,i=t.left._zod.run({value:o,issues:[]},r),s=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([l,c])=>jg(n,l,c)):jg(n,i,s)}});function Cf(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Xl(e)&&Xl(t)){const n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o={...e,...t};for(const i of r){const s=Cf(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],i=t[r],s=Cf(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function jg(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),bs(e))return e;const r=Cf(t.value,n.value);if(!r.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return e.value=r.data,e}const xF=J("$ZodRecord",(e,t)=>{qe.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Xl(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const i=[];if(t.keyType._zod.values){const s=t.keyType._zod.values;n.value={};for(const l of s)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){const c=t.valueType._zod.run({value:o[l],issues:[]},r);c instanceof Promise?i.push(c.then(f=>{f.issues.length&&n.issues.push(...go(l,f.issues)),n.value[l]=f.value})):(c.issues.length&&n.issues.push(...go(l,c.issues)),n.value[l]=c.value)}let a;for(const l in o)s.has(l)||(a=a??[],a.push(l));a&&a.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:a})}else{n.value={};for(const s of Reflect.ownKeys(o)){if(s==="__proto__")continue;const a=t.keyType._zod.run({value:s,issues:[]},r);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){n.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map(c=>Jr(c,r,Qr())),input:s,path:[s],inst:e}),n.value[a.value]=a.value;continue}const l=t.valueType._zod.run({value:o[s],issues:[]},r);l instanceof Promise?i.push(l.then(c=>{c.issues.length&&n.issues.push(...go(s,c.issues)),n.value[a.value]=c.value})):(l.issues.length&&n.issues.push(...go(s,l.issues)),n.value[a.value]=l.value)}}return i.length?Promise.all(i).then(()=>n):n}}),bF=J("$ZodEnum",(e,t)=>{qe.init(e,t);const n=Aj(t.entries);e._zod.values=new Set(n),e._zod.pattern=new RegExp(`^(${n.filter(r=>zj.has(typeof r)).map(r=>typeof r=="string"?da(r):r.toString()).join("|")})$`),e._zod.parse=(r,o)=>{const i=r.value;return e._zod.values.has(i)||r.issues.push({code:"invalid_value",values:n,input:i,inst:e}),r}}),SF=J("$ZodLiteral",(e,t)=>{qe.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?da(n):n?n.toString():String(n)).join("|")})$`),e._zod.parse=(n,r)=>{const o=n.value;return e._zod.values.has(o)||n.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),n}}),kF=J("$ZodTransform",(e,t)=>{qe.init(e,t),e._zod.parse=(n,r)=>{const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(n.value=s,n));if(o instanceof Promise)throw new Hs;return n.value=o,n}}),EF=J("$ZodOptional",(e,t)=>{qe.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Xe(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Xe(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${sh(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>t.innerType._zod.optin==="optional"?t.innerType._zod.run(n,r):n.value===void 0?n:t.innerType._zod.run(n,r)}),CF=J("$ZodNullable",(e,t)=>{qe.init(e,t),Xe(e._zod,"optin",()=>t.innerType._zod.optin),Xe(e._zod,"optout",()=>t.innerType._zod.optout),Xe(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${sh(n.source)}|null)$`):void 0}),Xe(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),IF=J("$ZodDefault",(e,t)=>{qe.init(e,t),e._zod.optin="optional",Xe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>Pg(i,t)):Pg(o,t)}});function Pg(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const TF=J("$ZodPrefault",(e,t)=>{qe.init(e,t),e._zod.optin="optional",Xe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),RF=J("$ZodNonOptional",(e,t)=>{qe.init(e,t),Xe(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>Fg(i,e)):Fg(o,e)}});function Fg(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const jF=J("$ZodCatch",(e,t)=>{qe.init(e,t),e._zod.optin="optional",Xe(e._zod,"optout",()=>t.innerType._zod.optout),Xe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue({...n,error:{issues:i.issues.map(s=>Jr(s,r,Qr()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(i=>Jr(i,r,Qr()))},input:n.value}),n.issues=[]),n)}}),PF=J("$ZodPipe",(e,t)=>{qe.init(e,t),Xe(e._zod,"values",()=>t.in._zod.values),Xe(e._zod,"optin",()=>t.in._zod.optin),Xe(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(n,r)=>{const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>_g(i,t,r)):_g(o,t,r)}});function _g(e,t,n){return bs(e)?e:t.out._zod.run({value:e.value,issues:e.issues},n)}const FF=J("$ZodReadonly",(e,t)=>{qe.init(e,t),Xe(e._zod,"propValues",()=>t.innerType._zod.propValues),Xe(e._zod,"values",()=>t.innerType._zod.values),Xe(e._zod,"optin",()=>t.innerType._zod.optin),Xe(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(Mg):Mg(o)}});function Mg(e){return e.value=Object.freeze(e.value),e}const _F=J("$ZodCustom",(e,t)=>{tn.init(e,t),qe.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>$g(i,n,r,e));$g(o,n,r,e)}});function $g(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(Us(o))}}class MF{constructor(){this._map=new Map,this._idmap=new Map}add(t,...n){const r=n[0];if(this._map.set(t,r),r&&typeof r=="object"&&"id"in r){if(this._idmap.has(r.id))throw new Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,t)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};return delete r.id,{...r,...this._map.get(t)}}return this._map.get(t)}has(t){return this._map.has(t)}}function $F(){return new MF}const Va=$F();function AF(e,t){return new e({type:"string",...ve(t)})}function NF(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ve(t)})}function Ag(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ve(t)})}function LF(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ve(t)})}function DF(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ve(t)})}function zF(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ve(t)})}function OF(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ve(t)})}function BF(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ve(t)})}function WF(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ve(t)})}function VF(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ve(t)})}function HF(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ve(t)})}function UF(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ve(t)})}function ZF(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ve(t)})}function KF(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ve(t)})}function YF(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ve(t)})}function GF(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ve(t)})}function XF(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ve(t)})}function qF(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ve(t)})}function QF(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ve(t)})}function JF(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ve(t)})}function e_(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ve(t)})}function t_(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ve(t)})}function n_(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ve(t)})}function r_(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ve(t)})}function o_(e,t){return new e({type:"string",format:"date",check:"string_format",...ve(t)})}function i_(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ve(t)})}function s_(e,t){return new e({type:"string",format:"duration",check:"string_format",...ve(t)})}function a_(e,t){return new e({type:"number",checks:[],...ve(t)})}function l_(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ve(t)})}function u_(e,t){return new e({type:"boolean",...ve(t)})}function c_(e){return new e({type:"unknown"})}function d_(e,t){return new e({type:"never",...ve(t)})}function Ng(e,t){return new $1({check:"less_than",...ve(t),value:e,inclusive:!1})}function Hc(e,t){return new $1({check:"less_than",...ve(t),value:e,inclusive:!0})}function Lg(e,t){return new A1({check:"greater_than",...ve(t),value:e,inclusive:!1})}function Uc(e,t){return new A1({check:"greater_than",...ve(t),value:e,inclusive:!0})}function Dg(e,t){return new TP({check:"multiple_of",...ve(t),value:e})}function D1(e,t){return new jP({check:"max_length",...ve(t),maximum:e})}function ql(e,t){return new PP({check:"min_length",...ve(t),minimum:e})}function z1(e,t){return new FP({check:"length_equals",...ve(t),length:e})}function f_(e,t){return new _P({check:"string_format",format:"regex",...ve(t),pattern:e})}function p_(e){return new MP({check:"string_format",format:"lowercase",...ve(e)})}function h_(e){return new $P({check:"string_format",format:"uppercase",...ve(e)})}function m_(e,t){return new AP({check:"string_format",format:"includes",...ve(t),includes:e})}function g_(e,t){return new NP({check:"string_format",format:"starts_with",...ve(t),prefix:e})}function v_(e,t){return new LP({check:"string_format",format:"ends_with",...ve(t),suffix:e})}function fa(e){return new DP({check:"overwrite",tx:e})}function y_(e){return fa(t=>t.normalize(e))}function w_(){return fa(e=>e.trim())}function x_(){return fa(e=>e.toLowerCase())}function b_(){return fa(e=>e.toUpperCase())}function S_(e,t,n){return new e({type:"array",element:t,...ve(n)})}function k_(e,t,n){return new e({type:"custom",check:"custom",fn:t,...ve(n)})}const E_=J("ZodISODateTime",(e,t)=>{QP.init(e,t),rt.init(e,t)});function C_(e){return r_(E_,e)}const I_=J("ZodISODate",(e,t)=>{JP.init(e,t),rt.init(e,t)});function T_(e){return o_(I_,e)}const R_=J("ZodISOTime",(e,t)=>{eF.init(e,t),rt.init(e,t)});function j_(e){return i_(R_,e)}const P_=J("ZodISODuration",(e,t)=>{tF.init(e,t),rt.init(e,t)});function F_(e){return s_(P_,e)}const __=(e,t)=>{I1.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Gj(e,n)},flatten:{value:n=>Yj(e,n)},addIssue:{value:n=>e.issues.push(n)},addIssues:{value:n=>e.issues.push(...n)},isEmpty:{get(){return e.issues.length===0}}})},Zu=J("ZodError",__,{Parent:Error}),M_=Xj(Zu),$_=qj(Zu),A_=R1(Zu),N_=j1(Zu),lt=J("ZodType",(e,t)=>(qe.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),e.clone=(n,r)=>Ao(e,n,r),e.brand=()=>e,e.register=(n,r)=>(n.add(e,r),e),e.parse=(n,r)=>M_(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>A_(e,n,r),e.parseAsync=async(n,r)=>$_(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>N_(e,n,r),e.spa=e.safeParseAsync,e.refine=(n,r)=>e.check(RM(n,r)),e.superRefine=n=>e.check(jM(n)),e.overwrite=n=>e.check(fa(n)),e.optional=()=>Bg(e),e.nullable=()=>Wg(e),e.nullish=()=>Bg(Wg(e)),e.nonoptional=n=>xM(e,n),e.array=()=>at(e),e.or=n=>ch([e,n]),e.and=n=>uM(e,n),e.transform=n=>Vg(e,hM(n)),e.default=n=>vM(e,n),e.prefault=n=>wM(e,n),e.catch=n=>SM(e,n),e.pipe=n=>Vg(e,n),e.readonly=()=>CM(e),e.describe=n=>{const r=e.clone();return Va.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=Va.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Va.get(e);const r=e.clone();return Va.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),O1=J("_ZodString",(e,t)=>{uh.init(e,t),lt.init(e,t);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...r)=>e.check(f_(...r)),e.includes=(...r)=>e.check(m_(...r)),e.startsWith=(...r)=>e.check(g_(...r)),e.endsWith=(...r)=>e.check(v_(...r)),e.min=(...r)=>e.check(ql(...r)),e.max=(...r)=>e.check(D1(...r)),e.length=(...r)=>e.check(z1(...r)),e.nonempty=(...r)=>e.check(ql(1,...r)),e.lowercase=r=>e.check(p_(r)),e.uppercase=r=>e.check(h_(r)),e.trim=()=>e.check(w_()),e.normalize=(...r)=>e.check(y_(...r)),e.toLowerCase=()=>e.check(x_()),e.toUpperCase=()=>e.check(b_())}),L_=J("ZodString",(e,t)=>{uh.init(e,t),O1.init(e,t),e.email=n=>e.check(NF(D_,n)),e.url=n=>e.check(BF(z_,n)),e.jwt=n=>e.check(n_(eM,n)),e.emoji=n=>e.check(WF(O_,n)),e.guid=n=>e.check(Ag(zg,n)),e.uuid=n=>e.check(LF(Ha,n)),e.uuidv4=n=>e.check(DF(Ha,n)),e.uuidv6=n=>e.check(zF(Ha,n)),e.uuidv7=n=>e.check(OF(Ha,n)),e.nanoid=n=>e.check(VF(B_,n)),e.guid=n=>e.check(Ag(zg,n)),e.cuid=n=>e.check(HF(W_,n)),e.cuid2=n=>e.check(UF(V_,n)),e.ulid=n=>e.check(ZF(H_,n)),e.base64=n=>e.check(JF(q_,n)),e.base64url=n=>e.check(e_(Q_,n)),e.xid=n=>e.check(KF(U_,n)),e.ksuid=n=>e.check(YF(Z_,n)),e.ipv4=n=>e.check(GF(K_,n)),e.ipv6=n=>e.check(XF(Y_,n)),e.cidrv4=n=>e.check(qF(G_,n)),e.cidrv6=n=>e.check(QF(X_,n)),e.e164=n=>e.check(t_(J_,n)),e.datetime=n=>e.check(C_(n)),e.date=n=>e.check(T_(n)),e.time=n=>e.check(j_(n)),e.duration=n=>e.check(F_(n))});function he(e){return AF(L_,e)}const rt=J("ZodStringFormat",(e,t)=>{Qe.init(e,t),O1.init(e,t)}),D_=J("ZodEmail",(e,t)=>{VP.init(e,t),rt.init(e,t)}),zg=J("ZodGUID",(e,t)=>{BP.init(e,t),rt.init(e,t)}),Ha=J("ZodUUID",(e,t)=>{WP.init(e,t),rt.init(e,t)}),z_=J("ZodURL",(e,t)=>{HP.init(e,t),rt.init(e,t)}),O_=J("ZodEmoji",(e,t)=>{UP.init(e,t),rt.init(e,t)}),B_=J("ZodNanoID",(e,t)=>{ZP.init(e,t),rt.init(e,t)}),W_=J("ZodCUID",(e,t)=>{KP.init(e,t),rt.init(e,t)}),V_=J("ZodCUID2",(e,t)=>{YP.init(e,t),rt.init(e,t)}),H_=J("ZodULID",(e,t)=>{GP.init(e,t),rt.init(e,t)}),U_=J("ZodXID",(e,t)=>{XP.init(e,t),rt.init(e,t)}),Z_=J("ZodKSUID",(e,t)=>{qP.init(e,t),rt.init(e,t)}),K_=J("ZodIPv4",(e,t)=>{nF.init(e,t),rt.init(e,t)}),Y_=J("ZodIPv6",(e,t)=>{rF.init(e,t),rt.init(e,t)}),G_=J("ZodCIDRv4",(e,t)=>{oF.init(e,t),rt.init(e,t)}),X_=J("ZodCIDRv6",(e,t)=>{iF.init(e,t),rt.init(e,t)}),q_=J("ZodBase64",(e,t)=>{sF.init(e,t),rt.init(e,t)}),Q_=J("ZodBase64URL",(e,t)=>{lF.init(e,t),rt.init(e,t)}),J_=J("ZodE164",(e,t)=>{uF.init(e,t),rt.init(e,t)}),eM=J("ZodJWT",(e,t)=>{dF.init(e,t),rt.init(e,t)}),B1=J("ZodNumber",(e,t)=>{L1.init(e,t),lt.init(e,t),e.gt=(r,o)=>e.check(Lg(r,o)),e.gte=(r,o)=>e.check(Uc(r,o)),e.min=(r,o)=>e.check(Uc(r,o)),e.lt=(r,o)=>e.check(Ng(r,o)),e.lte=(r,o)=>e.check(Hc(r,o)),e.max=(r,o)=>e.check(Hc(r,o)),e.int=r=>e.check(Og(r)),e.safe=r=>e.check(Og(r)),e.positive=r=>e.check(Lg(0,r)),e.nonnegative=r=>e.check(Uc(0,r)),e.negative=r=>e.check(Ng(0,r)),e.nonpositive=r=>e.check(Hc(0,r)),e.multipleOf=(r,o)=>e.check(Dg(r,o)),e.step=(r,o)=>e.check(Dg(r,o)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function ie(e){return a_(B1,e)}const tM=J("ZodNumberFormat",(e,t)=>{fF.init(e,t),B1.init(e,t)});function Og(e){return l_(tM,e)}const nM=J("ZodBoolean",(e,t)=>{pF.init(e,t),lt.init(e,t)});function Wt(e){return u_(nM,e)}const rM=J("ZodUnknown",(e,t)=>{hF.init(e,t),lt.init(e,t)});function Ti(){return c_(rM)}const oM=J("ZodNever",(e,t)=>{mF.init(e,t),lt.init(e,t)});function W1(e){return d_(oM,e)}const iM=J("ZodArray",(e,t)=>{gF.init(e,t),lt.init(e,t),e.element=t.element,e.min=(n,r)=>e.check(ql(n,r)),e.nonempty=n=>e.check(ql(1,n)),e.max=(n,r)=>e.check(D1(n,r)),e.length=(n,r)=>e.check(z1(n,r)),e.unwrap=()=>e.element});function at(e,t){return S_(iM,e,t)}const sM=J("ZodObject",(e,t)=>{vF.init(e,t),lt.init(e,t),Xe(e,"shape",()=>t.shape),e.keyof=()=>ar(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Ti()}),e.loose=()=>e.clone({...e._zod.def,catchall:Ti()}),e.strict=()=>e.clone({...e._zod.def,catchall:W1()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>Hj(e,n),e.merge=n=>Uj(e,n),e.pick=n=>Wj(e,n),e.omit=n=>Vj(e,n),e.partial=(...n)=>Zj(H1,e,n[0]),e.required=(...n)=>Kj(U1,e,n[0])});function ye(e,t){const n={type:"object",get shape(){return ah(this,"shape",{...e}),this.shape},...ve(t)};return new sM(n)}const aM=J("ZodUnion",(e,t)=>{yF.init(e,t),lt.init(e,t),e.options=t.options});function ch(e,t){return new aM({type:"union",options:e,...ve(t)})}const lM=J("ZodIntersection",(e,t)=>{wF.init(e,t),lt.init(e,t)});function uM(e,t){return new lM({type:"intersection",left:e,right:t})}const V1=J("ZodRecord",(e,t)=>{xF.init(e,t),lt.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function er(e,t,n){return new V1({type:"record",keyType:e,valueType:t,...ve(n)})}function cM(e,t,n){return new V1({type:"record",keyType:ch([e,W1()]),valueType:t,...ve(n)})}const If=J("ZodEnum",(e,t)=>{bF.init(e,t),lt.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const i={};for(const s of r)if(n.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new If({...t,checks:[],...ve(o),entries:i})},e.exclude=(r,o)=>{const i={...t.entries};for(const s of r)if(n.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new If({...t,checks:[],...ve(o),entries:i})}});function ar(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new If({type:"enum",entries:n,...ve(t)})}const dM=J("ZodLiteral",(e,t)=>{SF.init(e,t),lt.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function fM(e,t){return new dM({type:"literal",values:Array.isArray(e)?e:[e],...ve(t)})}const pM=J("ZodTransform",(e,t)=>{kF.init(e,t),lt.init(e,t),e._zod.parse=(n,r)=>{n.addIssue=i=>{if(typeof i=="string")n.issues.push(Us(i,n.value,t));else{const s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=e),s.continue??(s.continue=!0),n.issues.push(Us(s))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function hM(e){return new pM({type:"transform",transform:e})}const H1=J("ZodOptional",(e,t)=>{EF.init(e,t),lt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Bg(e){return new H1({type:"optional",innerType:e})}const mM=J("ZodNullable",(e,t)=>{CF.init(e,t),lt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Wg(e){return new mM({type:"nullable",innerType:e})}const gM=J("ZodDefault",(e,t)=>{IF.init(e,t),lt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function vM(e,t){return new gM({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const yM=J("ZodPrefault",(e,t)=>{TF.init(e,t),lt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function wM(e,t){return new yM({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const U1=J("ZodNonOptional",(e,t)=>{RF.init(e,t),lt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function xM(e,t){return new U1({type:"nonoptional",innerType:e,...ve(t)})}const bM=J("ZodCatch",(e,t)=>{jF.init(e,t),lt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function SM(e,t){return new bM({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const kM=J("ZodPipe",(e,t)=>{PF.init(e,t),lt.init(e,t),e.in=t.in,e.out=t.out});function Vg(e,t){return new kM({type:"pipe",in:e,out:t})}const EM=J("ZodReadonly",(e,t)=>{FF.init(e,t),lt.init(e,t)});function CM(e){return new EM({type:"readonly",innerType:e})}const IM=J("ZodCustom",(e,t)=>{_F.init(e,t),lt.init(e,t)});function TM(e){const t=new tn({check:"custom"});return t._zod.check=e,t}function RM(e,t={}){return k_(IM,e,t)}function jM(e){const t=TM(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(Us(r,n.value,t._zod.def));else{const o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),n.issues.push(Us(o))}},e(n.value,n)));return t}const Ku=ar(["full-bleed","video-top","pip-bubble","graphic-only","blurred-behind","lower-third","split-left","split-right"]),Yu=ar(["TitleCard","StatCard","RuleCard","StrikethroughReveal","FlowDiagram","TerminalMock","ChatMock","ScreenshotFrame","BulletList"]),PM=ye({startWord:ie().int().nonnegative(),endWord:ie().int().nonnegative()}),FM=ye({id:he(),anchor:PM,layout:Ku,component:Yu,props:er(he(),Ti()),overrides:er(he(),Ti()).default({}),rationale:he().optional()});ye({id:he(),kind:ar(["graphic","plain"]).optional(),layout:Ku,component:Yu.optional(),props:er(he(),Ti()).optional(),startSec:ie().nonnegative(),endSec:ie().nonnegative(),graphicRect:ye({x:ie(),y:ie(),w:ie(),h:ie()}).optional(),elements:er(he(),ye({dx:ie().optional(),dy:ie().optional(),scale:ie().positive().optional(),hidden:Wt().optional()})).optional(),video:ye({scale:ie().positive().max(4).optional(),dy:ie().optional(),dx:ie().optional(),autoZoom:Wt().optional()}).optional(),pip:ye({cornerRadius:ie().min(0).max(1).optional(),x:ie().min(0).max(1).optional(),y:ie().min(0).max(1).optional()}).optional(),captionY:ie().min(0).max(1).optional(),captionScale:ie().min(.2).max(3).optional(),pinned:Wt().optional()}).superRefine((e,t)=>{e.kind!=="plain"&&(e.component===void 0||e.props===void 0)&&t.addIssue({code:"custom",message:'a graphic cue requires component and props; only kind: "plain" may omit them'})});ye({centerYFrac:ie().min(0).max(1),sizeFrac:ie().min(0).max(1).optional(),centerXFrac:ie().min(0).max(1).optional(),sourceAspect:ie().positive().optional(),subject:ar(["face","screen"]).optional()});const Gu=ye({bg:he().default("#0B0B0E"),fg:he().default("#FFFFFF"),accent:he().default("#FFE14D"),muted:he().default("#9A9AA3"),success:he().default("#5FBF77"),cardBg:he().default("#15151B"),cardBorder:he().default("#2A2A33"),danger:he().default("#FF5C5C"),radiusPx:ie().default(24),fontDisplay:he().default("'Inter', 'Helvetica Neue', 'Arial Black', Arial, sans-serif"),fontMono:he().default("'SF Mono', 'Cascadia Code', Consolas, monospace")}),_M=Gu.parse({}),MM=ye({eyebrow:he().max(28).optional(),title:he().min(1).max(48).describe("the claim WITHOUT the emphasis token — never repeat the emphasis here"),emphasis:he().max(16).optional().describe("the number/punch token pulled OUT of the title (e.g. '861%') — not a duplicate of it"),sub:he().max(64).optional()}),$M=ye({label:he().min(1).max(28),value:he().min(1).max(12),caption:he().max(40).optional(),inverted:Wt().default(!1)}),AM=ye({kicker:he().min(1).max(24),text:he().min(1).max(40),struck:he().max(40).optional()}),NM=ye({lines:at(ye({text:he().min(1).max(32),struck:Wt().default(!1),mark:ar(["none","cross","check"]).default("none")})).min(1).max(4)}),LM=ye({title:he().max(28).optional(),items:at(he().min(1).max(36)).min(2).max(5)}),DM=ye({nodes:at(he().min(1).max(16)).min(2).max(5),emphasizeLast:Wt().default(!0)}),zM=ye({windows:at(ye({title:he().max(24),lines:at(he().max(40)).min(1).max(6)})).min(1).max(5),fanOut:he().max(20).optional()}),OM=ye({messages:at(ye({from:ar(["user","agent"]),text:he().min(1).max(60)})).min(1).max(4),keyword:he().max(16).optional().describe("ONLY for a 'comment <word>' ask: the single distinctive word the viewer types, plain and unformatted. Leave unset for any other CTA — especially 'reply with a number/which one', where there is no word to type. Never a referential filler like 'number', 'answer', 'comment' or 'below'.")}),BM=ye({src:he().optional().describe("OMIT THIS unless the user supplied an actual image file beside the video — never invent a filename from the transcript; without it the frame renders as a styled placeholder, which is the intended look"),label:he().max(32).optional(),kenBurns:Wt().default(!0)}),WM={TitleCard:{propsSchema:MM,defaultProps:{title:"TITLE"},defaultLayout:"pip-bubble",altLayouts:[],whenToUse:"The core claim or hook as big typography; use `emphasis` for a huge number or punch word."},StatCard:{propsSchema:$M,defaultProps:{label:"METRIC",value:"+0%"},defaultLayout:"video-top",altLayouts:["blurred-behind"],whenToUse:"One striking metric (value like '+242%', '×3', '5s'); punchline in `caption`."},RuleCard:{propsSchema:AM,defaultProps:{kicker:"RULE",text:"DO THE THING"},defaultLayout:"video-top",altLayouts:["blurred-behind"],whenToUse:"A prescriptive takeaway ('CAPACITY RULE / CAP ACTIVE AGENTS'); `struck` shows the rejected alternative."},StrikethroughReveal:{propsSchema:NM,defaultProps:{lines:[{text:"NOT THIS",struck:!0}]},defaultLayout:"blurred-behind",altLayouts:["graphic-only"],whenToUse:'Negation/contrast beat — big words over the blurred speaker. Strike EVERY line of the phrase the speaker negates, not just its tail — a half-struck claim reads as a typo. For wrong-vs-right lists, set mark: "cross"/"check" (✗/✓) per line instead.'},FlowDiagram:{propsSchema:DM,defaultProps:{nodes:["A","B"]},defaultLayout:"graphic-only",altLayouts:[],whenToUse:"A causal chain or pipeline as chips with arrows (TEAM → AI AGENTS → CHURN)."},TerminalMock:{propsSchema:zM,defaultProps:{windows:[{title:"terminal-01",lines:["$ run"]}]},defaultLayout:"graphic-only",altLayouts:[],whenToUse:"Anything about running code/processes/agents — stylized terminal windows."},ChatMock:{propsSchema:OM,defaultProps:{messages:[{from:"user",text:"hello"}]},defaultLayout:"blurred-behind",altLayouts:["graphic-only"],whenToUse:"A quoted phrase or exchange as chat bubbles over the blurred speaker; for a comment-CTA beat, set `keyword` to the word viewers should type."},ScreenshotFrame:{propsSchema:BM,defaultProps:{},defaultLayout:"video-top",altLayouts:["blurred-behind"],whenToUse:"Reference to a document/PR/review — a framed screenshot look with a label chip."},BulletList:{propsSchema:LM,defaultProps:{items:["FIRST","SECOND"]},defaultLayout:"blurred-behind",altLayouts:["graphic-only"],whenToUse:"An ENUMERATION — the speaker lists two or more parallel things ('what you need is X, Y, Z'). One bullet per item, optional kicker title. Use this for lists instead of bending TitleCard or StrikethroughReveal around them."}};function Hg(e,t,n={}){const r=WM[e],o={...r.defaultProps,...t,...n},i=r.propsSchema.safeParse(o);return i.success?i.data:null}const VM=ye({text:he(),start:ie().nonnegative(),end:ie().nonnegative(),conf:ie().min(0).max(1).optional()}),HM=ye({language:he().default("en"),words:at(VM)}),UM=ar(["exact","light","standard","aggressive"]),Z1=ar(["silence","pause","filler","retake","user","clip"]),Ug=ye({srcIn:ie().nonnegative(),srcOut:ie().nonnegative(),kind:ar(["keep","remove"]),reason:Z1.optional(),confidence:ie().min(0).max(1).optional()}),Ua=ye({start:ie(),end:ie()}),ZM=ye({silences:at(Ua),gaps:at(Ua),cuttable:at(Ua),breaths:at(Ua).default([]),fillers:at(ye({wordIndex:ie().int(),text:he(),start:ie(),end:ie()}))}),KM=ye({duration:ie().positive(),width:ie().int().positive(),height:ie().int().positive(),fps:ie().positive(),hasAudio:Wt(),rotation:ie().int().optional()}),YM=ye({width:ie().int().positive().default(1080),height:ie().int().positive().default(1920),fps:ie().positive().default(30)});ye({version:fM(1),source:ye({path:he(),probe:KM,audioPath:he().optional(),mezzaninePath:he().optional(),face:ye({centerXFrac:ie(),centerYFrac:ie(),sizeFrac:ie(),framesSampled:ie().int(),framesDetected:ie().int()}).nullable().optional()}),cleanup:UM,intent:he().optional(),transcript:HM.optional(),repairs:at(ye({startWord:ie().int(),endWord:ie().int(),heard:he(),correction:he(),applied:Wt(),rejected:he().optional()})).optional(),analysis:ZM.optional(),cutlist:at(Ug).optional(),cutlistProposed:at(Ug).optional(),clip:ye({targetSec:ie().positive(),startWord:ie().int().nonnegative(),endWord:ie().int().nonnegative(),startSec:ie().nonnegative(),endSec:ie().nonnegative(),reason:he()}).optional(),scenes:at(FM).optional(),producer:ye({provider:he(),models:at(he()).default([]),cached:Wt().default(!1),at:he().optional()}).optional(),theme:Gu.optional(),render:YM});const GM=ye({dx:ie().optional(),dy:ie().optional(),scale:ie().positive().optional(),hidden:Wt().optional()}),K1=ye({props:er(he(),Ti()).default({}),elements:er(he(),GM).default({}),timing:ye({startSec:ie().nonnegative(),endSec:ie().nonnegative()}).optional(),component:Yu.optional(),layout:Ku.optional(),video:ye({scale:ie().positive().max(4).optional(),dy:ie().optional(),dx:ie().optional(),autoZoom:Wt().optional()}).optional(),pip:ye({cornerRadius:ie().min(0).max(1).optional(),x:ie().min(0).max(1).optional(),y:ie().min(0).max(1).optional()}).optional(),captionY:ie().min(0).max(1).optional(),captionScale:ie().min(.2).max(3).optional(),graphicRect:ye({x:ie().min(0).max(1),y:ie().min(0).max(1),w:ie().min(.08).max(1),h:ie().min(.05).max(1)}).optional(),hidden:Wt().optional()}),XM=ye({text:he().min(1).max(80),was:he()}),qM=ye({fromKey:he().regex(/^w\d+$/),toKey:he().regex(/^w\d+$/),text:he().min(1).max(400),was:he()});function Zg(e,t,n){var r;return((r=e[t])==null?void 0:r.was)??n}function Kg(e,t,n,r){var o;return((o=e.find(i=>i.fromKey===t&&i.toKey===n))==null?void 0:o.was)??r}function Y1(e){return String(Math.round(e*1e3))}const QM=ch([ye({at:ie().finite().nonnegative(),id:he().min(1)}),ie().finite().nonnegative().transform(e=>({at:e,id:Y1(e)}))]);function JM(e,t){const n=Y1(e),r=new Set(t.map(o=>o.id));if(!r.has(n))return n;for(let o=2;;o++){const i=`${n}-${o}`;if(!r.has(i))return i}}const e$=ye({theme:Gu.partial().default({}),captionsHidden:Wt().optional(),scenes:er(he(),K1).default({}),captions:er(he(),XM).default({}),captionWordsHidden:er(he(),ye({was:he()})).default({}),captionRangeEdits:at(qM).default([]),captionLineTiming:er(he(),ye({lead:ie().min(-30).max(30),tail:ie().min(-30).max(30)})).default({}),splits:at(QM).default([]),cuts:at(ye({startSec:ie().nonnegative(),endSec:ie().nonnegative(),src:ye({startSec:ie().nonnegative(),endSec:ie().nonnegative()}).optional()})).default([]),cleanup:ye({reasons:cM(Z1,Wt()).default({}),kept:at(ye({srcIn:ie().nonnegative(),srcOut:ie().nonnegative()})).default([])}).default({reasons:{},kept:[]})}),t$=()=>e$.parse({});function n$(e,t){return Hg(e,{},t)??Hg(e,{},{})}function r$(e,t){const n=e[t],r=t.indexOf("@");if(r===-1)return n;const o=e[t.slice(0,r)];if(!o)return n;const{timing:i,hidden:s,...a}=o;return n?{...a,...n,props:{...a.props,...n.props},elements:{...a.elements,...n.elements},...a.video||n.video?{video:{...a.video,...n.video}}:{},...a.pip||n.pip?{pip:{...a.pip,...n.pip}}:{}}:{...a,props:{...a.props},elements:{...a.elements}}}function Tf(e,t){const n=new Set(e.map(i=>i.id)),r=Object.keys(t.scenes).filter(i=>!n.has(i));return{cues:e.map(i=>{const s=r$(t.scenes,i.id);if(!s)return i;const a=s.component!==void 0&&s.component!==i.component,l=s.component??i.component,c=s.component!==void 0&&a?n$(s.component,s.props):{...i.props,...s.props},f=s.layout!==void 0&&s.layout!==i.layout,{graphicRect:p,...h}=i;return{...f?h:i,component:l,layout:s.layout??i.layout,props:c,...Object.keys(s.elements).length>0?{elements:s.elements}:{},...s.video?{video:s.video}:{},...s.pip?{pip:s.pip}:{},...s.captionY!==void 0?{captionY:s.captionY}:{},...s.captionScale!==void 0?{captionScale:s.captionScale}:{},...s.graphicRect?{graphicRect:s.graphicRect}:{},...s.timing&&!i.pinned?{startSec:s.timing.startSec,endSec:s.timing.endSec,pinned:!0}:{}}}),orphans:r}}const Ql=.3;function dh(e,t){const n=[...e];for(const r of[...t].sort((o,i)=>o.at-i.at)){const o=n.findIndex(s=>r.at>=s.startSec+Ql&&r.at<=s.endSec-Ql);if(o===-1)continue;const i=n[o];n.splice(o,1,{...i,endSec:r.at},{...i,id:`${i.id.split("@")[0]}@${r.id}`,startSec:r.at})}return n}function G1(e,t){const n=[];return{cues:e.filter(o=>{var i;return((i=t.scenes[o.id])==null?void 0:i.hidden)!==!0?!0:(n.push(o.id),!1)}),hidden:n}}function o$(e,t){return G1(dh(e,t.splits),t)}function bn(e){if(!Number.isFinite(e))throw new Error(`captionKeyFor: caption words need a finite srcStart (§137), got ${String(e)} — run backfillSrcStart on lines read from a pre-§137 render-props.json`);return`w${Math.round(e*1e3)}`}function Zs(e){return/^\d+$/.test(e)}function Ue(e){return!e||!Number.isFinite(e.srcStart)?null:bn(e.srcStart)}const i$=8;function s$(e,t,n){var i,s;if(!Zs(e))return{to:e};const r=Number(e);if(((i=n[r])==null?void 0:i.text)===t.was)return Yg(n[r]);const o=[];for(let a=1;a<=i$;a++)for(const l of[r-a,r+a])((s=n[l])==null?void 0:s.text)===t.was&&o.push(l);return o.length===0?{to:null,reason:n.some(l=>l.text===t.was)?"out-of-range":"not-found"}:o.length>1?{to:null,reason:"ambiguous"}:Yg(n[o[0]])}function Yg(e){const t=Ue(e);return t===null?{to:null,reason:"unanchorable"}:{to:t}}function a$(e,t){const n=t.flatMap(a=>a.words),r={},o=[],i=Object.entries(e).map(([a,l])=>({key:a,edit:l,legacy:Zs(a),claim:s$(a,l,n)})),s=new Map;for(const a of i){if(a.claim.to===null)continue;const l=s.get(a.claim.to);l?l.push(a):s.set(a.claim.to,[a])}for(const a of i){if(a.claim.to===null){o.push({key:a.key,was:a.edit.was,reason:a.claim.reason});continue}const l=s.get(a.claim.to),c=l.length===1?l[0]:l.find(f=>!f.legacy);if(c===a){r[a.claim.to]=a.edit;continue}o.push({key:a.key,was:a.edit.was,reason:c===void 0?"collision":"superseded"})}return{edits:r,unresolved:o}}function l$(e,t){const n={...t.edits};for(const r of t.unresolved){if(r.reason==="superseded")continue;const o=e[r.key];o!==void 0&&(n[r.key]=o)}return n}function u$(e,t){const n=[];if(Object.keys(t).length===0)return{lines:[...e],dropped:n};const r=new Set,o=e.map(i=>({...i,words:i.words.map(s=>{const a=Ue(s);if(a===null)return s;const l=t[a];return l?r.has(a)?(n.push({key:a,expected:l.was,found:s.text,reason:"duplicate-anchor"}),s):(r.add(a),s.text!==l.was?(n.push({key:a,expected:l.was,found:s.text}),s):{...s,text:l.text}):s})}));for(const[i,s]of Object.entries(t))r.has(i)||n.push({key:i,expected:s.was,found:null});return{lines:o,dropped:n}}function c$(e,t,n,r){const o=e.map(l=>l.length+1),i=o.reduce((l,c)=>l+c,0),s=[];let a=t;for(let l=0;l<e.length;l++){const c=(n-t)*o[l]/i,f=l===e.length-1?n:a+c;s.push({text:e[l],start:a,end:f,srcStart:r[l]}),a=f}return s}function d$(e,t){const n=[];if(t.length===0)return{lines:[...e],dropped:n};let r=[...e];const o=new Set,i=new Set;for(const s of t){const a=`${s.fromKey}..${s.toKey}`,l=[];for(let M=0;M<r.length;M++)for(let $=0;$<r[M].words.length;$++)l.push({line:M,word:$,w:r[M].words[$]});const c=l.findIndex(M=>Ue(M.w)===s.fromKey);if(o.has(a)||i.has(s.fromKey)){n.push({key:a,expected:s.was,found:c===-1?null:l[c].w.text,reason:"duplicate-anchor"});continue}if(c===-1){n.push({key:a,expected:s.was,found:null});continue}let f=-1;for(let M=c;M<l.length;M++)if(Ue(l[M].w)===s.toKey){f=M;break}if(f===-1){n.push({key:a,expected:s.was,found:null});continue}const p=l.slice(c,f+1),h=p.map(M=>M.w.text).join(" ").normalize("NFC");if(h!==s.was.normalize("NFC")){n.push({key:a,expected:s.was,found:h});continue}const m=s.text.trim().split(/\s+/).filter(Boolean);if(m.length===0){n.push({key:a,expected:s.was,found:h});continue}o.add(a);for(const M of p){const $=Ue(M.w);$!==null&&i.add($)}if(m.length===p.length){const M=new Map(p.map(($,V)=>[`${$.line}:${$.word}`,m[V]]));r=r.map(($,V)=>({...$,words:$.words.map((D,L)=>{const j=M.get(`${V}:${L}`);return j===void 0?D:{...D,text:j}})}));continue}const x=[],v=new Map;for(const M of p){const $=v.get(M.line);$?($.last=M.word,$.words.push(M.w)):(x.push(M.line),v.set(M.line,{first:M.word,last:M.word,words:[M.w]}))}const k=x.map(M=>v.get(M).words.reduce(($,V)=>$+(V.end-V.start),0)),g=k.reduce((M,$)=>M+$,0),y=g>0?k:k.map(()=>1),w=g>0?g:k.length,b=y.map(M=>m.length*M/w),S=b.map(M=>Math.floor(M));let E=m.length-S.reduce((M,$)=>M+$,0);const T=b.map((M,$)=>({i:$,rem:M-Math.floor(M)})).sort((M,$)=>$.rem-M.rem||M.i-$.i);for(let M=0;E>0;M=(M+1)%T.length)S[T[M].i]++,E--;const I=p[0].w.srcStart,R=p[p.length-1].w.srcStart,F=m.map((M,$)=>m.length===1?I:I+(R-I)*$/(m.length-1));let A=0;const W=[];for(let M=0;M<r.length;M++){const $=r[M],V=v.get(M);if(!V){W.push($);continue}const D=S[x.indexOf(M)],L=m.slice(A,A+D),j=F.slice(A,A+D);A+=D;const C=D===0?[]:c$(L,V.words[0].start,V.words[V.words.length-1].end,j),P=[...$.words.slice(0,V.first),...C,...$.words.slice(V.last+1)];P.length!==0&&W.push({...$,words:P})}r=W}return{lines:r,dropped:n}}function f$(e,t){const n=[];if(Object.keys(t).length===0)return{lines:[...e],dropped:n};const r=new Set,o=[];for(const i of e){const s=[];for(const h of i.words){const m=Ue(h),x=m===null?void 0:t[m];if(m===null||!x){s.push(h);continue}if(r.has(m)){n.push({key:m,expected:x.was,found:h.text,reason:"duplicate-anchor"}),s.push(h);continue}if(r.add(m),h.text!==x.was){n.push({key:m,expected:x.was,found:h.text}),s.push(h);continue}}if(s.length===i.words.length){o.push(i);continue}if(s.length===0)continue;const a=i.words[i.words.length-1],l=s[0],c=s[s.length-1],f=l===i.words[0]?i.start:l.start,p=c===a?i.end:Math.max(c.end,c.end+(i.end-a.end));o.push({words:s,start:f,end:p})}for(const[i,s]of Object.entries(t))r.has(i)||n.push({key:i,expected:s.was,found:null});return{lines:o,dropped:n}}const Jl=.05;function p$(e,t,n,r,o){const i=n-t;if(!(i>0))return e.map(l=>({...l}));const s=(o-r)/i,a=l=>r+(l-t)*s;return e.map(l=>({...l,start:a(l.start),end:a(l.end)}))}function X1(e,t){const n=[],r=e.length;if(r===0){for(const f of Object.keys(t))n.push({key:f,expected:"",found:null});return{lines:[],dropped:n}}if(Object.keys(t).length===0)return{lines:[...e],dropped:n};const o=e.map(f=>f.start),i=e.map(f=>f.end),s=new Set;for(let f=0;f<r;f++){const p=e[f],h=Ue(p.words[0]),m=h===null?void 0:t[h];if(!(h===null||!m)){if(s.has(h)){n.push({key:h,expected:"",found:p.words[0].text,reason:"duplicate-anchor"});continue}s.add(h),i[f]=p.end+m.tail,f+1<r&&e[f+1].start===p.end&&(o[f+1]=i[f]),o[f]=p.start+m.lead,f>0&&e[f-1].end===p.start&&(i[f-1]=o[f])}}const a=e[0].start,l=e[r-1].end;for(let f=0;f<r;f++){const p=f===0?a:Math.max(a,i[f-1]);o[f]=Math.min(Math.max(o[f],p),l),i[f]=Math.min(Math.max(i[f],o[f]+Jl),l)}for(let f=r-1;f>=0;f--){const p=f===r-1?l:Math.min(l,o[f+1]);i[f]=Math.max(Math.min(i[f],p),a),o[f]=Math.max(Math.min(o[f],i[f]-Jl),a)}const c=e.map((f,p)=>{const h=o[p],m=i[p];return h===f.start&&m===f.end?f:{...f,start:h,end:m,words:p$(f.words,f.start,f.end,h,m)}});for(const f of Object.keys(t))s.has(f)||n.push({key:f,expected:"",found:null});return{lines:c,dropped:n}}function h$(e,t){return Gu.parse({...e,...t.theme})}function Gg(e,t,n,r){const o=e.scenes[t]??K1.parse({});return{...e,scenes:{...e.scenes,[t]:{...o,elements:{...o.elements,[n]:{...o.elements[n],...r}}}}}}function m$(e,t,n){const r=e.scenes[t];if(!r)return e;const{[n]:o,...i}=r.elements;return{...e,scenes:{...e.scenes,[t]:{...r,elements:i}}}}function g$(e,t,n){const r=e.scenes[t],o=r==null?void 0:r.elements[n];if(!r||!(o!=null&&o.hidden))return e;const{hidden:i,...s}=o,{[n]:a,...l}=r.elements,c=Object.keys(s).length>0?{...r.elements,[n]:s}:l;return{...e,scenes:{...e.scenes,[t]:{...r,elements:c}}}}function v$(e,t){const n=e.scenes[t];if(!n||!n.timing)return e;const{timing:r,...o}=n;return{...e,scenes:{...e.scenes,[t]:o}}}function y$(e,t){const n=e.scenes[t];if(!n||!n.graphicRect)return e;const{graphicRect:r,...o}=n;return{...e,scenes:{...e.scenes,[t]:o}}}function q1(e){const t=e.indexOf("@");return t===-1?e:e.slice(0,t)}const w$=.6;function x$(e,t){const n=new Set([0]);for(const r of e??[])Number.isFinite(r)&&r>0&&r<t&&n.add(r);return[...n].sort((r,o)=>r-o)}function b$(e,t){const n=t.outputDurationSec,r=[...e].sort((f,p)=>f.startSec-p.startSec);if(n<=0)return r;const o=x$(t.clipStarts,n),i=[];let s=0;for(const f of r)f.startSec-s>1e-9&&i.push({start:s,end:f.startSec}),s=Math.max(s,f.endSec);n-s>1e-9&&i.push({start:s,end:n});const a=[];for(const f of i){const p=o.filter(m=>m>f.start+1e-9&&m<f.end-1e-9),h=[f.start,...p,f.end];for(let m=0;m<h.length-1;m++){const x=h[m],v=h[m+1];if(v-x<w$)continue;let k=0;for(let g=0;g<o.length;g++)o[g]<=x+1e-9&&(k=g);a.push({start:x,end:v,clip:k})}}const l=new Map,c=a.map(f=>{const p=l.get(f.clip)??0;return l.set(f.clip,p+1),{id:p===0?`take-${f.clip}`:`take-${f.clip}-${p}`,kind:"plain",layout:"full-bleed",startSec:f.start,endSec:f.end}});return[...r,...c].sort((f,p)=>f.startSec-p.startSec)}const S$=1.05;function k$(e,t){for(const r of e)if(t>=r.startSec&&t<r.endSec){const o=r.endSec-r.startSec,i=o>0?(t-r.startSec)/o:1,s=.5-.5*Math.cos(Math.PI*i);return r.from+(r.to-r.from)*s}const n=e[e.length-1];return n&&t===n.endSec?n.to:1}function E$(e,t,n){if(e.length===0)return{x:0,y:0,w:(n==null?void 0:n.width)??0,h:(n==null?void 0:n.height)??0,full:!0};if(t<e[0].startSec)return e[0].rect;for(const r of e)if(t>=r.startSec&&t<r.endSec)return r.rect;return e[e.length-1].rect}class Q1{constructor(t){Ae(this,"spans");Ae(this,"outputDuration");let n=-1/0;for(const i of t){if(i.srcOut<i.srcIn)throw new Error(`segment ends before it starts: ${i.srcIn}..${i.srcOut}`);if(i.srcIn<n)throw new Error(`cutlist segments overlap at ${i.srcIn}`);n=i.srcOut}const r=[];let o=0;for(const i of t){if(i.kind!=="keep"||i.srcOut<=i.srcIn)continue;const s=i.srcOut-i.srcIn;r.push({srcIn:i.srcIn,srcOut:i.srcOut,outIn:o,outOut:o+s}),o+=s}this.spans=r,this.outputDuration=o}toOutput(t){for(const i of this.spans)if(t>=i.srcIn&&t<=i.srcOut)return i.outIn+(t-i.srcIn);const n=1e-9;let r=null,o=1/0;for(const i of this.spans){const s=t<i.srcIn?i.srcIn-t:t-i.srcOut;s<o&&(o=s,r=i)}if(r&&o<=n){const i=Math.min(Math.max(t,r.srcIn),r.srcOut);return r.outIn+(i-r.srcIn)}return null}toOutputClamped(t){const n=this.toOutput(t);if(n!==null)return n;let r=0;for(const o of this.spans)if(o.srcOut<=t)r=o.outOut;else if(o.srcIn>=t)return o.outIn;return r}toSource(t){const n=this.spans;if(n.length===0)return 0;const r=n[0];if(t<=r.outIn)return r.srcIn;for(const o of n)if(t>=o.outIn&&t<=o.outOut)return o.srcIn+(t-o.outIn);return n[n.length-1].srcOut}mapWord(t){const n=(t.start+t.end)/2;if(this.toOutput(n)===null&&this.toOutput(t.start)===null&&this.toOutput(t.end)===null)return null;const r=this.toOutputClamped(t.start),o=this.toOutputClamped(t.end);return o<=r?null:{start:r,end:o}}}function Xu(e){return new Q1(e.map(t=>({srcIn:t.srcIn,srcOut:t.srcOut,kind:"keep"})))}function J1(e,t,n){return Math.abs(e.outputDuration-t.outputDuration)>n||e.spans.length!==t.spans.length?!1:e.spans.every((r,o)=>{const i=t.spans[o];return Math.abs(r.srcIn-i.srcIn)<=n&&Math.abs(r.srcOut-i.srcOut)<=n&&Math.abs(r.outIn-i.outIn)<=n&&Math.abs(r.outOut-i.outOut)<=n})}function Xg(e,t){const n=o=>o.words;if(e.every(o=>n(o).every(i=>i.srcStart!==void 0)))return[...e];const r=Xu(t);return e.map(o=>({...o,words:n(o).map(i=>i.srcStart===void 0?{...i,srcStart:r.toSource(i.start)}:i)}))}const C$=/[\p{Script=Arabic}\p{Script=Hebrew}\p{Script=Syriac}\p{Script=Thaana}\p{Script=Nko}]/u,I$=new RegExp("\\p{L}","u");function fh(e){for(const t of e){if(C$.test(t))return"rtl";if(I$.test(t))return"ltr"}return"ltr"}const Ks="Noto Nastaliq Urdu",eb="fonts/NotoNastaliqUrdu-Bold.ttf";function T$(e){return e.some(t=>fh(t.words.map(n=>n.text).join(" "))==="rtl")}const tb=9,R$=new Set(["a","an","and","as","at","but","by","for","from","in","is","it","of","on","or","the","to","with","that","this","my","your","so","had","has","have","was","were","will","can","should","i"]);function j$(e,t=tb){const n=e.trim().replace(/\s+/g," ");if(!n)return n;const r=a=>a.split(" ").filter(Boolean);if(r(n).length<=t)return n;const o=n.split(/\s*[—–:]\s*|\s+-\s+/)[0].trim(),i=r(o).length>=3?o:n,s=r(i).slice(0,t);for(;s.length>3&&R$.has(s[s.length-1].toLowerCase().replace(/\W/g,""));)s.pop();return s.join(" ").replace(/[,;:—–-]+$/,"")}function ph(e){return e!=="user"&&e!=="clip"}function nb(e,t){if(!t)return[];const n=t.kept??[];return e.filter(r=>{var o;return r.kind==="remove"&&ph(r.reason)&&(r.reason!==void 0&&((o=t.reasons)==null?void 0:o[r.reason])===!1||n.some(i=>i.srcIn<r.srcOut&&i.srcOut>r.srcIn))})}function P$(e,t){const n=new Set(nb(e,t));if(n.size===0)return[...e];const r=[];for(const o of e){const i=n.has(o)?{srcIn:o.srcIn,srcOut:o.srcOut,kind:"keep"}:o,s=r[r.length-1];if(s!==void 0&&s.kind==="keep"&&i.kind==="keep"){s.srcOut=i.srcOut;continue}r.push(i.kind==="keep"?{srcIn:i.srcIn,srcOut:i.srcOut,kind:"keep"}:i)}return r}function F$(e,t,n,r,o){const i=n.toSource(t),s=r.toOutput(i);if(s!==null)return s;const a=r.toOutputClamped(i);return o.push(`${e} at ${t.toFixed(3)}s fell inside the new cut — snapped to ${a.toFixed(3)}s`),a}function _$(e,t){const n=[...t].sort((o,i)=>o.start-i.start);if(n.length===0)return[...e];const r=[];for(const o of e){if(o.kind!=="keep"){r.push(o);continue}let i=o.srcIn;for(const s of n){const a=Math.max(i,s.start),l=Math.min(o.srcOut,s.end);a>=l||(a>i&&r.push({srcIn:i,srcOut:a,kind:"keep"}),r.push({srcIn:a,srcOut:l,kind:"remove",reason:"user",confidence:1}),i=l)}i<o.srcOut&&r.push({srcIn:i,srcOut:o.srcOut,kind:"keep"})}return r}const rb=1e-6;function M$(e,t,n,r){var i;if(!(Object.values((t==null?void 0:t.reasons)??{}).some(s=>s===!1)||(((i=t==null?void 0:t.kept)==null?void 0:i.length)??0)>0)||e.length===0||r.length===0)return null;try{const s=P$(e,t),a=n.flatMap(f=>f.src&&f.src.endSec>f.src.startSec?[{start:f.src.startSec,end:f.src.endSec}]:[]),l=new Q1(_$(s,a)),c=Xu(r);return J1(c,l,rb)?null:{oldMap:c,newMap:l}}catch{return null}}function $$(e){if(e===null){const r=o=>o;return{toLive:r,fromLive:r,hasOldClockPreimage:()=>!0}}const{oldMap:t,newMap:n}=e;return{toLive:r=>{const o=t.toSource(r);return n.toOutput(o)??n.toOutputClamped(o)},fromLive:r=>{const o=n.toSource(r);return t.toOutput(o)??t.toOutputClamped(o)},hasOldClockPreimage:r=>t.toOutput(n.toSource(r))!==null}}function ob(e,t,n){const r=e.fromLive(t),o=e.fromLive(n);return o-r<rb?{kind:"degenerate"}:e.hasOldClockPreimage(t)&&e.hasOldClockPreimage(n)?{kind:"exact",startSec:r,endSec:o}:{kind:"shrunk",startSec:r,endSec:o,report:`cut ${t.toFixed(3)}s–${n.toFixed(3)}s trimmed to the last render's ${r.toFixed(3)}s–${o.toFixed(3)}s — the revived material at its edge isn't in the last render yet`}}function A$(e,t,n){const r=[],o=(s,a)=>F$(s,a,t,n,r),i={spans:n.spans.map(s=>({...s})),outputDurationSec:n.outputDuration,captionLines:e.captionLines.map((s,a)=>({...s,start:o(`caption line ${a+1} start`,s.start),end:o(`caption line ${a+1} end`,s.end),words:s.words.map(l=>({...l,start:o(`caption word "${l.text}" start`,l.start),end:o(`caption word "${l.text}" end`,l.end)}))})),sceneCues:e.sceneCues.map(s=>({...s,startSec:o(`scene "${s.id}" start`,s.startSec),endSec:o(`scene "${s.id}" end`,s.endSec)})),punch:{scale:1,allowed:[]}};return e.zoomPlan&&(i.zoomPlan=e.zoomPlan.map((s,a)=>({...s,startSec:o(`zoom segment ${a+1} start`,s.startSec),endSec:o(`zoom segment ${a+1} end`,s.endSec)}))),e.ctaWindow&&(i.ctaWindow={startSec:o("CTA window start",e.ctaWindow.startSec),endSec:o("CTA window end",e.ctaWindow.endSec)}),e.sourceTextRegions&&(i.sourceTextRegions=e.sourceTextRegions.map((s,a)=>({...s,startSec:o(`source text region ${a+1} start`,s.startSec),endSec:o(`source text region ${a+1} end`,s.endSec)}))),{fields:i,reports:r}}const nn={width:1080,height:1920};nn.width;nn.height;const pa={centerYFrac:.38,sizeFrac:.22},N$=.35,L$=.45,ib=1-1/S$,D$=.4*ib,z$=.6*ib;function sb(e,t,n=nn){const r=e.w*n.width,o=e.h*n.height;return Math.max(o,r/(t.sourceAspect??n.width/n.height))}function O$(e,t,n=nn){if(t.subject==="screen")return .5;const r=e.h*n.height,o=sb(e,t,n),i=o-r;if(i<=1)return .5;const s=t.sizeFrac??pa.sizeFrac,a=(t.centerYFrac-s/2-N$*s)*o,l=(t.centerYFrac+s/2)*o,c=(a+l)/2-L$*r,f=a-D$*r,p=l+z$*r-r,h=p<=f?Math.min(Math.max(c,p),f):p;return Math.min(1,Math.max(0,h/i))}function B$(e,t,n,r,o=nn){if(r.length===0)return e;const i=t.h*o.height,s=sb(t,n,o);if(s-i<=1)return e;const l=i/s,c=1-l;if(c<=0)return e;let f=e*c;for(let p=0;p<r.length+1;p++){const h=r.find(w=>{const b=w.y,S=w.y+w.h,E=f+l,T=b<f&&f<S,I=b<E&&E<S;return T||I});if(!h)break;const m=[],x=h.y+h.h;x<=c&&m.push(x);const v=h.y-l;if(v>=0&&m.push(v),h.h<=l){const w=Math.max(0,h.y+h.h-l),b=Math.min(c,h.y);w<=b&&m.push(Math.min(Math.max(f,w),b))}const k=n.sizeFrac??pa.sizeFrac,g=n.centerYFrac+k/2,y=m.filter(w=>w+l>=g);if(y.length===0)return e;f=y.reduce((w,b)=>Math.abs(b-f)<Math.abs(w-f)?b:w)}return Math.min(1,Math.max(0,f/c))}function W$(e,t,n=nn){if(t.subject==="screen")return .5;const r=e.w*n.width,o=e.h*n.height,i=Math.max(r,o*(t.sourceAspect??n.width/n.height)),s=i-r;if(s<=1||t.centerXFrac===void 0)return .5;const a=t.centerXFrac*i-r/2;return Math.min(1,Math.max(0,a/s))}const V$={top:.12,bottom:.22,right:.16,left:.04},H$={top:.06,bottom:.12,right:.05,left:.05};function Qn(e=nn){return e.width>e.height?H$:V$}function U$(e=nn){const t=Qn(e);return{x:t.left,y:t.top,w:1-t.left-t.right,h:1-t.top-t.bottom}}const Z$=.08,K$=.05;function eu(e,t=nn){const n=U$(t),r=1e-9,o=(c,f,p)=>c<f-r?f:c>p+r?p:c,i=o(e.w,Z$,n.w),s=o(e.h,K$,n.h),a=o(e.x,n.x,n.x+n.w-i),l=o(e.y,n.y,n.y+n.h-s);return{x:a,y:l,w:i,h:s}}const qg=.045;function Y$(e){return e.width>e.height?44:64}const dr={x:0,y:0,w:1,h:1},Zc=.3,Bo={x:.5-Zc/2,y:.66,w:Zc,h:Zc*1080/1920};function Co(e,t=pa,n=[],r=nn){const o=a=>B$(O$(a,t,r),a,t,n,r),i=a=>W$(a,t,r),s=r.width>r.height;switch(e){case"full-bleed":return{video:{rect:dr,cornerRadius:0,blurPx:0,dim:0,opacity:1,objectPosY:o(dr),objectPosX:i(dr)},graphic:null,captionAnchor:s?.8:.7};case"lower-third":{const a=s?{x:.05,y:.7,w:.62,h:.18}:{x:.04,y:.56,w:.8,h:.22};return{video:{rect:dr,cornerRadius:0,blurPx:0,dim:0,opacity:1,objectPosY:o(dr),objectPosX:i(dr)},graphic:a,captionAnchor:s?.62:.49}}case"split-left":case"split-right":{if(s){const l=e==="split-left",c={x:l?0:.5,y:0,w:.5,h:1};return{video:{rect:c,cornerRadius:0,blurPx:0,dim:0,opacity:1,objectPosY:o(c),objectPosX:i(c)},graphic:l?{x:.55,y:.2,w:.4,h:.56}:{x:.05,y:.2,w:.4,h:.56},captionAnchor:.82}}const a={x:0,y:0,w:1,h:.5};return{video:{rect:a,cornerRadius:0,blurPx:0,dim:0,opacity:1,objectPosY:o(a),objectPosX:i(a)},graphic:{x:.04,y:.58,w:.8,h:.2},captionAnchor:.53}}case"video-top":{const a={x:0,y:0,w:1,h:.42};return{video:{rect:a,cornerRadius:0,blurPx:0,dim:0,opacity:1,objectPosY:o(a),objectPosX:i(a)},graphic:{x:.04,y:.54,w:.8,h:.24},captionAnchor:.48}}case"pip-bubble":return{video:{rect:Bo,cornerRadius:1,blurPx:0,dim:0,opacity:1,objectPosY:o(Bo),objectPosX:i(Bo)},graphic:{x:.06,y:.14,w:.78,h:.42},captionAnchor:s?.78:.61};case"graphic-only":return{video:{rect:Bo,cornerRadius:1,blurPx:0,dim:0,opacity:0,objectPosY:o(Bo),objectPosX:i(Bo)},graphic:{x:.04,y:.14,w:.8,h:.54},captionAnchor:s?.8:.73};case"blurred-behind":return{video:{rect:dr,cornerRadius:0,blurPx:22,dim:.55,opacity:1,objectPosY:o(dr),objectPosX:i(dr)},graphic:{x:.07,y:.24,w:.77,h:.36},captionAnchor:s?.8:.69}}}const G$={x:.07,y:.24,w:.77,h:.36};function ab(e,t=nn){return e.graphicRect?eu(e.graphicRect,t):Co(e.layout,pa,[],t).graphic??G$}const lb=.35;function Gr(e,t){for(const n of e)if(t>=n.startSec&&t<n.endSec)return n;return null}function En(e,t,n){return e+(t-e)*n}function X$(e,t,n){return{x:En(e.x,t.x,n),y:En(e.y,t.y,n),w:En(e.w,t.w,n),h:En(e.h,t.h,n)}}function Qg(e,t,n){return{rect:X$(e.rect,t.rect,n),cornerRadius:En(e.cornerRadius,t.cornerRadius,n),blurPx:En(e.blurPx,t.blurPx,n),dim:En(e.dim,t.dim,n),opacity:En(e.opacity,t.opacity,n),objectPosY:En(e.objectPosY,t.objectPosY,n),objectPosX:En(e.objectPosX,t.objectPosX,n)}}function tu(e){return e*e*(3-2*e)}function ub(e){return e.filter(t=>!(t.kind==="plain"&&t.layout==="full-bleed"))}function Kc(e,t,n,r){const o=Co(e.layout,t,n,r).video,i=e.layout==="pip-bubble"?e.pip:void 0;if(!i)return o;const s={...o.rect,x:Math.min(Math.max(i.x??o.rect.x,0),1-o.rect.w),y:Math.min(Math.max(i.y??o.rect.y,0),1-o.rect.h)};return{...o,rect:s,cornerRadius:i.cornerRadius??o.cornerRadius}}function q$(e,t,n=pa,r=[],o=nn){const i=ub(e),s=r.filter(g=>t>=g.startSec&&t<g.endSec),a=Co("full-bleed",n,s,o).video,l=Gr(i,t);if(!l)return a;const c=Kc(l,n,s,o),f=Math.min(lb,(l.endSec-l.startSec)/2),p=t-l.startSec,h=l.endSec-t,m=Gr(i,l.startSec-.001),x=Gr(i,l.endSec+.001),v=m?Kc(m,n,s,o):a,k=x?Kc(x,n,s,o):a;return p<f?Qg(v,c,tu(p/f)):h<f?Qg(c,k,tu(1-h/f)):c}function Q$(e,t,n,r){return[n!==0||r!==0?`translate(${n}px, ${r}px)`:"",e*t!==1?`scale(${e*t})`:""].filter(Boolean).join(" ")||void 0}function Yc(e){return e==="pip-bubble"||e==="graphic-only"?1:0}function J$(e,t){const n=ub(e),r=Gr(n,t);if(!r)return 0;const o=Yc(r.layout),i=Math.min(lb,(r.endSec-r.startSec)/2),s=Gr(n,r.startSec-.001),a=Gr(n,r.endSec+.001),l=s?Yc(s.layout):0,c=a?Yc(a.layout):0,f=t-r.startSec,p=r.endSec-t;return f<i?En(l,o,tu(f/i)):p<i?En(o,c,tu(1-p/i)):o}function e4(e,t,n){return e.filter(r=>(r.startSec??Number.NEGATIVE_INFINITY)<n&&(r.endSec??Number.POSITIVE_INFINITY)>t)}function t4(e,t){let n=0;for(const r of t){const o=Math.max(e.y,r.y),i=Math.min(e.y+e.h,r.y+r.h);i>o&&(n+=i-o)}return Math.min(1,n/e.h)}function n4(e,t,n,r=nn){const o=Co(e,void 0,[],r),i=Qn(r),s=o.captionAnchor,a=l=>{const c={y:l-qg,h:qg*2};if(c.y<i.top||c.y+c.h>1-i.bottom||t4(c,t)>0)return!1;const f=n??o.graphic;return!(f&&Math.min(c.y+c.h,f.y+f.h)-Math.max(c.y,f.y)>0)};if(a(s))return s;for(let l=.02;l<=.6;l+=.02)for(const c of[s-l,s+l])if(a(c))return c;return s}const r4=.3,o4=.3,i4=.133,hh=e=>e*(2-e);function cb(e,t=r4,n=o4){if(e<=0)return{enterSec:0,exitSec:0};const r=t+n;if(r<=e)return{enterSec:t,exitSec:n};const o=e/r;return{enterSec:t*o,exitSec:n*o}}const Jg=.4;function s4(e,t){if(!t)return e;const n=e.replace(/^[^A-Za-z0-9]+|[^A-Za-z0-9]+$/g,"");return n.toLowerCase()!==t.toLowerCase()?e:e.replace(n,`"${n.toUpperCase()}"`)}function a4(e,t){return t?e>=t.startSec-Jg&&e<=t.endSec+Jg:!1}function l4(e,t){return e??Y$(t)}function u4(e){return e*10/64}function c4(e){return{fontFamily:(e==null?void 0:e.fontDisplay)??"'Inter', 'Helvetica Neue', 'Arial Black', Arial, sans-serif",color:(e==null?void 0:e.fg)??"white"}}function d4(e,t){return e==="rtl"?`'${Ks}', ${t}`:t}function f4(e){return e==="rtl"?1.9:1.15}const p4=()=>{const[e]=le.useState(()=>YE(`load ${Ks}`));return le.useEffect(()=>{let t=!1;const n=()=>{t||(t=!0,GE(e))};return new FontFace(Ks,`url("${Jp(eb)}") format("truetype")`,{weight:"900"}).load().then(o=>{document.fonts.add(o),n()},n),n},[e]),null},h4=({line:e,wordOffset:t,verticalAnchor:n,fontSizePx:r,activeColor:o,fontFamily:i,textColor:s,ctaKeyword:a,ctaWindow:l})=>{const c=Pt(),{fps:f,width:p,height:h}=ht(),m=Qn({width:p,height:h}),x=e.start+c/f,v=fh(e.words.map(k=>k.text).join(" "));return u.jsx(Vn,{style:{pointerEvents:"none"},children:u.jsx("div",{style:{position:"absolute",top:`${n*100}%`,left:0,right:0,transform:"translateY(-50%)",direction:v,display:"flex",justifyContent:"center",gap:"0.28em",flexWrap:"wrap",paddingLeft:`${m.left*100}%`,paddingRight:`${m.right*100}%`,fontFamily:d4(v,i),fontWeight:900,fontSize:r,lineHeight:f4(v),textAlign:"center",color:s,WebkitTextStroke:`${u4(r)}px rgba(0,0,0,0.85)`,paintOrder:"stroke fill",textShadow:`0 4px ${r*24/64}px rgba(0,0,0,0.55)`},children:e.words.map((k,g)=>{const y=Math.max(k.end,k.start+.12),w=x>=k.start&&x<=y,b=w?Math.min(1,(x-k.start)/i4):0,S=hh(b);return u.jsx("span",{"data-caption-word":t+g,"data-caption-text":k.text,"data-caption-src":Ue(k)===null?void 0:k.srcStart,style:{display:"inline-block",pointerEvents:"auto",transform:S>0?`scale(${1+.08*S})`:"scale(1)",color:w?o:s},children:s4(k.text,a4(k.start,l)?a:void 0)},g)})})})},m4=({lines:e,cues:t=[],verticalAnchor:n=.76,fontSizePx:r,activeColor:o="#FFE14D",theme:i,ctaKeyword:s,ctaWindow:a,sourceTextRegions:l=[]})=>{const{fps:c,width:f,height:p}=ht(),h={width:f,height:p},m=l4(r,h),{fontFamily:x,color:v}=c4(i),k=[];let g=0;for(const y of e)k.push(g),g+=y.words.length;return u.jsxs(Vn,{children:[T$(e)?u.jsx(p4,{}):null,e.map((y,w)=>{const b=t.length>0?Gr(t,y.start):null,S=(b==null?void 0:b.captionY)!==void 0?b.captionY:t.length>0||l.length>0?n4((b==null?void 0:b.layout)??"full-bleed",e4(l,y.start,y.end),b==null?void 0:b.graphicRect,h):n,{from:E,durationInFrames:T}=oh(y.start,y.end,c);return u.jsx(Ft,{from:E,durationInFrames:T,children:u.jsx(h4,{line:y,wordOffset:k[w],verticalAnchor:S,fontSizePx:m*((b==null?void 0:b.captionScale)??1),activeColor:o,fontFamily:x,textColor:v,ctaKeyword:s,ctaWindow:a})},w)})]})};function db(e,t,n,r=.5,o=.5){const i=Math.max(1,e.width),s=Math.max(1,e.height),a=Math.max(1,t.w),l=Math.max(1,t.h),c=Math.max(n.width/a,n.height/l),f=-t.x*c+(n.width-a*c)*ev(r),p=-t.y*c+(n.height-l*c)*ev(o);return{width:i*c,height:s*c,left:f,top:p}}function ev(e){return Number.isFinite(e)?Math.min(1,Math.max(0,e)):.5}function fb(e,t,n){const r=Math.max(1,e.width),o=Math.max(1,e.height),i=Math.max(1,t.w),s=Math.max(1,t.h),a=Math.min(n.width/i,n.height/s),l=-t.x*a+(n.width-i*a)/2,c=-t.y*a+(n.height-s*a)/2;return{width:r*a,height:o*a,left:l,top:c}}function g4(e,t){return fb(e,{x:0,y:0,w:e.width,h:e.height},t)}function pb(e,t){if(e.length===0)return t;for(const o of e)if(t>=o.outIn&&t<o.outOut)return o.srcIn+(t-o.outIn);const n=e[0];return t<n.outIn?n.srcIn:e[e.length-1].srcOut}function v4(e,t,n,r,o,i){return e==="fit"?fb(t,n,r):db(t,n,r,o,i)}function y4(e,t,n,r){return e.length===0?{x:0,y:0,w:r.width,h:r.height,full:!0}:E$(e,pb(t,n),r)}function w4(e,t,n){if(e.length===0)return null;const r=pb(t,n);if(r<e[0].startSec)return e[0];for(const o of e)if(r>=o.startSec&&r<o.endSec)return o;return e[e.length-1]}function x4(e,t,n,r,o,i,s,a,l){if(!o)return null;if(e&&e.length>0){const f=w4(e,n,r);if(f)return db(o,f.window,s,f.bias.x,f.bias.y)}if(!t||t.length<2)return null;const c=y4(t,n,r,o);return c.full?null:v4(i,o,c,s,a,l)}const b4=({cues:e,theme:t,face:n,zoomPlan:r,sourceTextRegions:o,contentTimeline:i,framingTimeline:s,spans:a,sourceSize:l,contentCropMode:c="cover",sourceFit:f="cover",children:p})=>{const h=Pt(),{fps:m,width:x,height:v}=ht(),k=h/m,y=q$(e,k,n??void 0,o??[],{width:x,height:v}),w=J$(e,k),b=y.rect.w*x,S=y.rect.h*v,E=y.cornerRadius*Math.min(b,S)/2,T=Gr(e,k),I=T==null?void 0:T.video,R=r&&r.length>0?k$(r,k):1,F=Math.max(0,y.opacity*(1-.6*y.cornerRadius)),A=(I==null?void 0:I.autoZoom)!==!1,W=f==="contain"&&l!==void 0,M=A&&!W?1+(R-1)*F:1,$=(I==null?void 0:I.scale)??1,V=(I==null?void 0:I.dx)??0,D=(I==null?void 0:I.dy)??0,L=Q$(M,$,V,D);return u.jsxs(Vn,{children:[u.jsx(Vn,{style:{background:t.bg,opacity:w}}),u.jsxs("div",{"data-edit-video":T==null?void 0:T.id,style:{position:"absolute",left:`${y.rect.x*100}%`,top:`${y.rect.y*100}%`,width:b,height:S,borderRadius:E,overflow:"hidden",opacity:y.opacity,backgroundColor:W?t.bg:void 0,boxShadow:y.cornerRadius>.5?"0 18px 60px rgba(0,0,0,0.55)":void 0},children:[u.jsx("div",{style:{position:"absolute",inset:0,filter:y.blurPx>.5?`blur(${y.blurPx}px)`:void 0,transform:L,transformOrigin:"50% 40%","--ossclip-obj-y":`${y.objectPosY*100}%`,"--ossclip-obj-x":`${y.objectPosX*100}%`},children:W?u.jsx(S4,{source:l,slot:{width:b,height:S},children:p}):u.jsx(k4,{timeline:i,framing:s,spans:a,sourceSize:l,mode:c,tSec:k,slot:{width:b,height:S},posX:y.objectPosX,posY:y.objectPosY,children:p})}),u.jsx("div",{style:{position:"absolute",inset:0,background:"black",opacity:y.dim}})]})]})},S4=({source:e,slot:t,children:n})=>{const r=g4(e,t);return u.jsx("div",{style:{position:"absolute",width:r.width,height:r.height,left:r.left,top:r.top},children:n})},k4=({timeline:e,framing:t,spans:n,sourceSize:r,mode:o,tSec:i,slot:s,posX:a,posY:l,children:c})=>{const f=x4(t,e,n??[],i,r,o,s,a,l);return f?u.jsx("div",{style:{position:"absolute",width:f.width,height:f.height,left:f.left,top:f.top},children:c}):u.jsx("div",{style:{position:"absolute",inset:0},children:c})},mh=.94,E4=new Set(["FlowDiagram","StrikethroughReveal","ChatMock","BulletList"]),tv=2.4,Za=.45,qu=.58,At=.72,C4=.62;function Yo(e,t,n,r,o){const i=Math.max(1,Math.floor(n/Math.max(1,o*t)));return Math.max(1,Math.ceil(e/i))*t*r}const Ye=e=>typeof e=="string"?e:"",Dr=e=>Array.isArray(e)?e:[];function I4(e,t,n,r=1/0){switch(e){case"TitleCard":{const o=n-80,i=Ye(t.emphasis),s=28;let a=0,l=0;Ye(t.eyebrow)&&(a+=34*1.2,l++),i&&(a+=210*.95,l++);const c=i?64:96;return a+=Yo(Ye(t.title).length,c,o,1.05,At),l++,Ye(t.sub)&&(a+=Yo(Ye(t.sub).length,40,o,1.2,qu),l++),a+s*Math.max(0,l-1)}case"StatCard":{const o=Yo(Ye(t.label).length,42,n*.55,1.15,At);let i=88+Math.max(o,110*1.15)+4;return Ye(t.caption)&&(i+=30+(38*1.2+32+4)),i}case"RuleCard":{const o=n-60-96;let i=80;return i+=30*1.2+14,i+=Yo(Ye(t.text).length,72,o,1.02,At),Ye(t.struck)&&(i+=26+Yo(Ye(t.struck).length,44,o,1.2,At)),i}case"StrikethroughReveal":{const o=Dr(t.lines).map(a=>Ye(a==null?void 0:a.text)),i=yb(o,n,r),s=o.reduce((a,l)=>a+vb(l,i,n).length,0);return s*i*1.08+i*.2*Math.max(0,s-1)}case"FlowDiagram":{const o=Dr(t.nodes).map(l=>Ye(l)),i=Math.max(1,o.length),{mode:s,fontSize:a}=Cb(o,n,r);return s==="row"?a*Ss+4:a*(Ss*i+Eb*(i-1))}case"TerminalMock":{const o=Dr(t.windows);let i=0;for(const s of o){const a=Dr(s==null?void 0:s.lines);i+=56.8+2,i+=Math.max(1,a.length)*27*1.2+8*Math.max(0,a.length-1)+36,i+=4}return i+=22*Math.max(0,o.length-1),Ye(t.fanOut)&&(i+=22+40*1.2),i}case"ChatMock":{const o=Sb(t).map(s=>s.text),i=kb(o,{widthPx:n,heightPx:r});return bb(o,i,n)}case"ScreenshotFrame":{const o=n*.94;return(Ye(t.src)?o*9/16:480)+4}case"BulletList":{const o=Dr(t.items).map(s=>Ye(s)),i=gb(o,n,r,!!Ye(t.title),Ye(t.title));return F4(o.length,i,!!Ye(t.title))}}}const Fr=e=>Ye(e).split(/\s+/).reduce((t,n)=>Math.max(t,n.length),0);function T4(e,t){switch(e){case"RuleCard":{const n=Fr(t.kicker)*30*(At+.28),r=Fr(t.text)*72*At,o=Fr(t.struck)*44*(At+.04),i=Math.max(n,r,o);return i>0?156+i:0}case"TitleCard":{const n=Ye(t.emphasis)?64:96,r=Fr(t.eyebrow)*34*(At+.35),o=Fr(t.emphasis)*210*At,i=Fr(t.title)*n*(At+.02),s=Fr(t.sub)*40*qu,a=Math.max(r,o,i,s);return a>0?80+a:0}case"TerminalMock":{let n=0;for(const r of Dr(t.windows))for(const o of Dr(r==null?void 0:r.lines))n=Math.max(n,Ye(o).length);return n>0?108+n*27*C4:0}case"StatCard":{const n=Ye(t.value).length*110*At;return n===0?0:164+Fr(t.label)*42*At+40+n}default:return 0}}const nv=36,R4=120,hb=1.6,mb=.88,j4=(At+.28)*.36,P4=1.1;function F4(e,t,n){return(Math.max(1,e)*hb+(n?mb:0))*t}function gb(e,t=831,n=1/0,r=!1,o=""){const i=e.reduce((l,c)=>Math.max(l,c.length),0);if(i===0)return nv;const s=Math.min(t/(i*At+P4),o?t/(o.length*j4):1/0),a=n*mh/(Math.max(1,e.length)*hb+(r?mb:0));return Math.max(nv,Math.min(R4,Math.floor(Math.min(s,a))))}const _4=92,M4=44,$4=150,A4=[" → "," -> "," → "," > "];function vb(e,t,n){const r=o=>o.length*t*At<=n;if(r(e))return[e];for(const o of A4){if(!e.includes(o))continue;const s=e.split(o).map((a,l)=>l===0?a:`${o.trim()} ${a}`.trim());if(s.every(r))return s}return[e]}function yb(e,t=831,n=1/0){const r=e.reduce((s,a)=>Math.max(s,a.length),0);if(r===0)return _4;const o=t/(r*At),i=n/(Math.max(1,e.length)*1.28);return Math.max(M4,Math.min($4,Math.floor(Math.min(o,i))))}const rv=22,ov=44,N4=96,iv=22,wb=.85,xb=.82;function bb(e,t,n){const o=(n-80)*xb-2*t*wb;let i=0;for(const s of e)i+=Yo(s.length,t,o,1.2,qu)+t*1.2+4;return i+t*.5*Math.max(0,e.length-1)}function Sb(e){const t=Ye(e.keyword);return t?[{from:"user",text:`"${t.toUpperCase()}"`}]:Dr(e.messages).map(n=>{const r=n??{};return{from:r.from==="agent"?"agent":"user",text:Ye(r.text)}})}function kb(e,t={}){const n=t.widthPx??831,r=t.heightPx??1/0,o=n-80,i=e.reduce((p,h)=>Math.max(p,h.length),0);if(i===0)return ov;const s=e.flatMap(p=>p.split(/\s+/)).reduce((p,h)=>Math.max(p,h.length),0),a=p=>o*xb/(p*qu+2*wb),l=Math.min(i,iv),c=i>iv?ov:N4;let f=Math.floor(Math.min(a(l),a(s),c));for(;f>rv&&bb(e,f,n)>r*mh;)f-=1;return Math.max(rv,f)}const sv=26,L4=22,D4=76,Ss=2.1,Eb=2.05;function Cb(e,t,n=1/0){const r=e.reduce((v,k)=>v+k.length,0),o=Math.max(1,e.length),i=.78,s=1.6,a=1.8,l=t-20,c=Math.floor(Math.min(l/(i*r+s*o+a*(o-1)),n/Ss)),f=Math.max(...e.map(v=>v.length),1),p=Ss*o+Eb*(o-1),h=Math.floor(Math.min(l/(i*f+s),n/p,D4)),m=c>=sv;return h>=L4?m?c*Ss>=h*p?{mode:"row",fontSize:c}:{mode:"stack",fontSize:h}:{mode:"stack",fontSize:h}:{mode:"row",fontSize:Math.max(sv,c)}}function z4(e,t,n){if(E4.has(e))return 1;const r=n.heightPx*mh,o=c=>I4(e,t,n.widthPx/c)*c<=r;if(!o(Za))return Za;const i=T4(e,t),s=i>0?n.widthPx/i:tv;let a=Za,l=Math.max(Za,Math.min(tv,s));if(l<=a)return a;for(let c=0;c<24;c++){const f=(a+l)/2;o(f)?a=f:l=f}return a}function kt(e=0){const t=Pt(),{fps:n}=ht();return ff({frame:t-e,fps:n,config:{damping:200,stiffness:130},durationInFrames:Math.round(n*.5)})}function tr(e,t=26){return{opacity:e,transform:`translateY(${(1-e)*t}px)`}}function Io(e){return{opacity:e,transform:`scale(${.9+.1*e})`}}function O4(e,t){return!e||t===1?e:Object.fromEntries(Object.entries(e).map(([n,r])=>[n,{...r,...r.dx!==void 0?{dx:r.dx/t}:{},...r.dy!==void 0?{dy:r.dy/t}:{}}]))}function yt(e,t){const n=e==null?void 0:e[t];if(!n)return{};if(n.hidden)return{display:"none"};const r=[`translate(${n.dx??0}px, ${n.dy??0}px)`];return n.scale!==void 0&&n.scale!==1&&r.push(`scale(${n.scale})`),{transform:r.join(" ")}}const B4=({props:e,theme:t,edits:n})=>{var l;const r=kt(0),o=kt(5),i=kt(10),s=(l=e.emphasis)==null?void 0:l.trim(),a=!!s&&s.toLowerCase().includes(e.title.trim().toLowerCase());return u.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:28,textAlign:"center",fontFamily:t.fontDisplay,color:t.fg,padding:"0 40px"},children:[e.eyebrow?u.jsx("div",{"data-edit-id":"eyebrow",style:{...tr(r),fontSize:34,fontWeight:700,letterSpacing:"0.35em",color:t.muted,textTransform:"uppercase",...yt(n,"eyebrow")},children:e.eyebrow}):null,s?u.jsx("div",{"data-edit-id":"emphasis",style:{...tr(o,40),fontSize:210,fontWeight:900,lineHeight:.95,...yt(n,"emphasis")},children:s}):null,a?null:u.jsx("div",{"data-edit-id":"title",style:{...tr(s?i:o,34),fontSize:s?64:96,fontWeight:900,lineHeight:1.05,textTransform:"uppercase",letterSpacing:"0.02em",...yt(n,"title")},children:e.title}),e.sub?u.jsx("div",{"data-edit-id":"sub",style:{...tr(i),fontSize:40,fontWeight:600,color:t.muted,...yt(n,"sub")},children:e.sub}):null]})},W4=({props:e,theme:t,edits:n})=>{const r=kt(0),o=kt(6),i=e.inverted;return u.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:30,fontFamily:t.fontDisplay,width:"100%",padding:"0 30px"},children:[u.jsxs("div",{style:{...Io(r),display:"flex",alignItems:"center",justifyContent:"space-between",gap:40,width:"100%",background:i?t.fg:t.cardBg,color:i?t.bg:t.fg,border:`2px solid ${i?t.fg:t.cardBorder}`,borderRadius:t.radiusPx,padding:"44px 52px"},children:[u.jsx("div",{"data-edit-id":"label",style:{fontSize:42,fontWeight:800,textTransform:"uppercase",letterSpacing:"0.06em",lineHeight:1.15,maxWidth:"55%",...yt(n,"label")},children:e.label}),u.jsx("div",{"data-edit-id":"value",style:{fontSize:110,fontWeight:900,whiteSpace:"nowrap",...yt(n,"value")},children:e.value})]}),e.caption?u.jsx("div",{"data-edit-id":"caption",style:{...tr(o),fontSize:38,fontWeight:800,color:t.fg,background:t.cardBg,border:`2px solid ${t.cardBorder}`,borderRadius:t.radiusPx/2,padding:"16px 30px",textTransform:"uppercase",letterSpacing:"0.08em",...yt(n,"caption")},children:e.caption}):null]})},V4=({props:e,theme:t,edits:n})=>{const r=kt(0),o=kt(8);return u.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:26,fontFamily:t.fontDisplay,width:"100%",padding:"0 30px"},children:[u.jsxs("div",{style:{...Io(r),width:"100%",background:t.fg,color:t.bg,borderRadius:t.radiusPx,padding:"40px 48px",textAlign:"left"},children:[u.jsx("div",{"data-edit-id":"kicker",style:{fontSize:30,fontWeight:800,letterSpacing:"0.28em",textTransform:"uppercase",color:"#55555E",marginBottom:14,fontFamily:t.fontMono,...yt(n,"kicker")},children:e.kicker}),u.jsx("div",{"data-edit-id":"text",style:{fontSize:72,fontWeight:900,lineHeight:1.02,textTransform:"uppercase",...yt(n,"text")},children:e.text})]}),e.struck?u.jsx("div",{"data-edit-id":"struck",style:{...tr(o),fontSize:44,fontWeight:800,color:t.muted,textDecoration:"line-through",textDecorationThickness:6,textDecorationColor:t.danger,textTransform:"uppercase",letterSpacing:"0.04em",...yt(n,"struck")},children:e.struck}):null]})},H4=({text:e,struck:t,mark:n,delay:r,fontSize:o,theme:i,editId:s,edits:a})=>{const l=kt(r),c=kt(r+8);return u.jsxs("div",{"data-edit-id":s,style:{...tr(l,30),position:"relative",display:"inline-block",...yt(a,s)},children:[u.jsxs("span",{style:{fontSize:o,fontWeight:900,textTransform:"uppercase",lineHeight:1.08,whiteSpace:"nowrap",color:t?i.muted:i.fg},children:[n!=="none"?u.jsx("span",{style:{color:n==="cross"?i.danger:i.success,marginRight:"0.3em"},children:n==="cross"?"✗":"✓"}):null,e]}),t?u.jsx("div",{style:{position:"absolute",left:"-2%",top:"50%",height:o*.11,width:`${c*104}%`,background:i.danger,borderRadius:o*.055,transform:"translateY(-50%) rotate(-2deg)"}}):null]})},U4=({props:e,theme:t,widthPx:n,heightPx:r,edits:o})=>{const i=e.lines.map(l=>(l.mark??"none")!=="none"?`✗ ${l.text}`:l.text),s=yb(i,n,r),a=e.lines.flatMap((l,c)=>vb(l.text,s,n??831).map((f,p)=>({text:f,struck:l.struck,mark:p===0?l.mark??"none":"none",lineIndex:c})));return u.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:s*.2,textAlign:"center",fontFamily:t.fontDisplay},children:a.map((l,c)=>u.jsx(H4,{text:l.text,struck:l.struck,mark:l.mark,delay:c*6,fontSize:s,theme:t,editId:`line-${l.lineIndex}`,edits:o},c))})},Z4=({text:e,emphasized:t,delay:n,fontSize:r,theme:o,editId:i,edits:s})=>{const a=kt(n);return u.jsx("div",{"data-edit-id":i,style:{...Io(a),background:t?o.fg:o.cardBg,color:t?o.bg:o.fg,border:`2px solid ${t?o.fg:o.cardBorder}`,borderRadius:o.radiusPx/2,padding:`${r*.55}px ${r*.8}px`,fontSize:r,fontWeight:900,textTransform:"uppercase",letterSpacing:"0.04em",whiteSpace:"nowrap",fontFamily:o.fontDisplay,...yt(s,i)},children:e})},K4=({delay:e,fontSize:t,theme:n,down:r=!1})=>{const o=kt(e);return u.jsx("div",{style:{opacity:o,color:n.muted,fontSize:t*1.15,fontWeight:700,lineHeight:1,paddingLeft:r?0:t*.55},children:r?"↓":"→"})};function Y4(e,t=G4,n){return Cb(e,t,n)}const G4=864,X4=({props:e,theme:t,widthPx:n,heightPx:r,edits:o})=>{const{mode:i,fontSize:s}=Y4(e.nodes,n,r),a=i==="row";return u.jsx("div",{style:{display:"flex",flexDirection:a?"row":"column",flexWrap:"nowrap",alignItems:"center",justifyContent:"center",gap:a?0:s*.45,padding:"0 10px"},children:e.nodes.map((l,c)=>u.jsxs("div",{style:{display:"flex",flexDirection:a?"row":"column",alignItems:"center",gap:a?s*.55:s*.45},children:[c>0?u.jsx(K4,{delay:c*6+3,fontSize:s,theme:t,down:!a}):null,u.jsx(Z4,{text:l,emphasized:e.emphasizeLast&&c===e.nodes.length-1,delay:c*6,fontSize:s,theme:t,editId:`node-${c}`,edits:o})]},c))})},q4=({title:e,lines:t,delay:n,theme:r,editId:o,edits:i})=>{const s=kt(n);return u.jsxs("div",{"data-edit-id":o,style:{...Io(s),background:r.cardBg,border:`2px solid ${r.cardBorder}`,borderRadius:r.radiusPx/2,overflow:"hidden",width:"100%",fontFamily:r.fontMono,...yt(i,o)},children:[u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 20px",borderBottom:`2px solid ${r.cardBorder}`},children:[["#FF5F57","#FEBC2E","#28C840"].map(a=>u.jsx("div",{style:{width:16,height:16,borderRadius:8,background:a}},a)),u.jsx("div",{style:{marginLeft:10,fontSize:24,color:r.muted},children:e})]}),u.jsx("div",{style:{padding:"18px 22px",display:"flex",flexDirection:"column",gap:8},children:t.map((a,l)=>u.jsx("div",{style:{fontSize:27,color:r.fg,whiteSpace:"pre"},children:a},l))})]})},Q4=({props:e,theme:t,edits:n})=>{const r=kt(e.windows.length*6+4);return u.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:22,width:"100%",padding:"0 30px"},children:[e.windows.map((o,i)=>u.jsx(q4,{title:o.title,lines:o.lines,delay:i*6,theme:t,editId:`window-${i}`,edits:n},i)),e.fanOut?u.jsxs("div",{"data-edit-id":"fanOut",style:{...tr(r),fontFamily:t.fontDisplay,fontSize:40,fontWeight:900,letterSpacing:"0.2em",color:t.fg,textTransform:"uppercase",...yt(n,"fanOut")},children:["⌄ ",e.fanOut]}):null]})},J4=({from:e,text:t,delay:n,fontSize:r,theme:o,editId:i,edits:s})=>{const a=kt(n),l=e==="user";return u.jsx("div",{"data-edit-id":i,style:{...Io(a),alignSelf:l?"flex-end":"flex-start",background:l?o.fg:o.cardBg,color:l?o.bg:o.fg,border:`2px solid ${l?o.fg:o.cardBorder}`,borderRadius:28,[l?"borderBottomRightRadius":"borderBottomLeftRadius"]:8,padding:`${r*.6}px ${r*.85}px`,fontSize:r,fontWeight:700,maxWidth:"82%",fontFamily:o.fontDisplay,...yt(s,i)},children:t})},eA=({props:e,theme:t,widthPx:n,heightPx:r,edits:o})=>{const i=Sb(e),s=kb(i.map(a=>a.text),{widthPx:n,heightPx:r});return u.jsx("div",{style:{display:"flex",flexDirection:"column",gap:s*.5,width:"100%",padding:"0 40px"},children:i.map((a,l)=>u.jsx(J4,{from:a.from,text:a.text,delay:l*8,fontSize:s,theme:t,editId:`message-${l}`,edits:o},l))})},tA=({props:e,theme:t,edits:n})=>{const r=kt(0),o=kt(8),i=Pt(),{fps:s}=ht(),a=e.kenBurns?Li(i,[0,s*8],[1,1.08],{extrapolateRight:"clamp"}):1,l=e.src?/^https?:\/\//.test(e.src)?e.src:Jp(e.src):null;return u.jsxs("div",{"data-edit-id":"image",style:{...Io(r),position:"relative",width:"94%",...yt(n,"image")},children:[u.jsx("div",{style:{overflow:"hidden",borderRadius:t.radiusPx/2,border:`2px solid ${t.cardBorder}`,background:t.cardBg,boxShadow:"0 24px 80px rgba(0,0,0,0.5)"},children:l?u.jsx(Yp,{src:l,style:{width:"100%",display:"block",transform:`scale(${a})`}}):u.jsx("div",{style:{height:420,display:"flex",flexDirection:"column",gap:14,padding:30,transform:`scale(${a})`},children:[.9,.75,.85,.6,.8,.5].map((c,f)=>u.jsx("div",{style:{height:22,width:`${c*100}%`,borderRadius:6,background:f%3===0?t.cardBorder:"#22222B"}},f))})}),e.label?u.jsx("div",{"data-edit-id":"label",style:{...Io(o),position:"absolute",right:-8,bottom:-20,background:t.fg,color:t.bg,fontFamily:t.fontMono,fontSize:28,fontWeight:800,letterSpacing:"0.08em",padding:"12px 22px",borderRadius:10,textTransform:"uppercase",...yt(n,"label")},children:e.label}):null]})},nA=({text:e,index:t,fontSize:n,theme:r,edits:o})=>{const i=`item-${t}`,s=kt(t*7);return u.jsxs("div",{"data-edit-id":i,style:{...tr(s,26),display:"flex",alignItems:"baseline",gap:n*.35,...yt(o,i)},children:[u.jsx("span",{style:{fontSize:n*.75,color:r.accent,fontWeight:900},children:"▸"}),u.jsx("span",{style:{fontSize:n,fontWeight:900,textTransform:"uppercase",lineHeight:1.15,whiteSpace:"nowrap",color:r.fg},children:e})]})},rA=({props:e,theme:t,widthPx:n,heightPx:r,edits:o})=>{const i=gb(e.items,n,r,!!e.title,e.title),s=kt(0);return u.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:i*.45,fontFamily:t.fontDisplay},children:[e.title?u.jsx("div",{"data-edit-id":"title",style:{...tr(s,20),fontSize:i*.36,fontWeight:700,letterSpacing:"0.28em",textTransform:"uppercase",color:t.muted,...yt(o,"title")},children:e.title}):null,e.items.map((a,l)=>u.jsx(nA,{text:a,index:l,fontSize:i,theme:t,edits:o},l))]})},oA={TitleCard:B4,StatCard:W4,RuleCard:V4,StrikethroughReveal:U4,FlowDiagram:X4,TerminalMock:Q4,ChatMock:eA,ScreenshotFrame:tA,BulletList:rA},iA=new Set(["lower-third","full-bleed"]),sA=.55,aA=e=>{const t=/^#([0-9a-fA-F]{6})$/.exec(e.trim()),[n,r,o]=t?[0,2,4].map(i=>Number.parseInt(t[1].slice(i,i+2),16)):[0,0,0];return`rgba(${n}, ${r}, ${o}, ${sA})`},lA=e=>({width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",opacity:e,transform:e<1?`translateY(${(1-e)*18}px)`:void 0}),uA=({durationInFrames:e,children:t})=>{const n=Pt(),{fps:r}=ht(),{exitSec:o}=cb(e/r),i=(e-n)/r,s=o<=0?1:Math.min(1,Math.max(0,i/o));return u.jsx("div",{style:lA(hh(s)),children:t})},cA=({durationInFrames:e,themeBg:t,radiusPx:n})=>{const r=Pt(),{fps:o}=ht(),{enterSec:i}=cb(e/o),s=i<=0?1:Math.min(1,Math.max(0,r/o/i)),a=hh(s);return u.jsx("div",{style:{position:"absolute",inset:0,background:aA(t),backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)",borderRadius:n,opacity:a,transform:a<1?`translateY(${(1-a)*18}px)`:void 0}})},dA=({cues:e,theme:t})=>{const{fps:n,width:r,height:o}=ht();return u.jsx(Vn,{style:{pointerEvents:"none"},children:e.map(i=>{if(i.kind==="plain"||!i.component||!i.props)return null;const s=ab(i,{width:r,height:o}),a=oA[i.component],{from:l,durationInFrames:c}=oh(i.startSec,i.endSec,n),f=s.w*r,p=s.h*o,h=iA.has(i.layout),m=h?Math.min(24,Math.round(p*.12)):0,x=f-m*2,v=p-m*2,k=z4(i.component,i.props,{widthPx:x,heightPx:v});return u.jsx(Ft,{from:l,durationInFrames:c,children:u.jsx("div",{"data-edit-scene":i.id,style:{position:"absolute",left:`${s.x*100}%`,top:`${s.y*100}%`,width:`${s.w*100}%`,height:`${s.h*100}%`,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"auto",overflow:"hidden"},children:u.jsxs(uA,{durationInFrames:c,children:[h?u.jsx(cA,{durationInFrames:c,themeBg:t.bg,radiusPx:t.radiusPx}):null,u.jsx("div",{style:{width:x/k,transform:`scale(${k})`,position:"relative"},children:u.jsx(a,{props:i.props,theme:t,widthPx:x/k,heightPx:v/k,edits:O4(i.elements,k)})})]})})},i.id)})})},fA="made with ossclip",pA=.45,hA=.024;function mA(e=nn){const t=Qn(e);return{xPx:Math.round(t.left*e.width),yPx:Math.round(t.top*e.height),fontPx:Math.round(Math.min(e.width,e.height)*hA),opacity:pA,text:fA}}function gA(e){return e===!0}const vA=({theme:e,frame:t})=>{const n=mA(t);return u.jsx("div",{style:{position:"absolute",left:n.xPx,top:n.yPx,fontFamily:e.fontDisplay,fontSize:n.fontPx,fontWeight:600,letterSpacing:"0.02em",color:e.fg,opacity:n.opacity,pointerEvents:"none",whiteSpace:"nowrap"},children:n.text})};function yA(e){return e!==!0}const wA=({videoFileName:e,spans:t,captionLines:n,sceneCues:r,theme:o,settings:i,face:s,zoomPlan:a,ctaKeyword:l,ctaWindow:c,sourceTextRegions:f,contentTimeline:p,framingTimeline:h,sourceSize:m,contentCropMode:x,sourceFit:v,watermark:k,captionsHidden:g,staticCamera:y,punch:w})=>{if(!e)return u.jsx(Vn,{style:{backgroundColor:"#111",color:"#888",alignItems:"center",justifyContent:"center",fontFamily:"monospace",fontSize:40},children:"no production loaded"});const b=/^https?:\/\//.test(e)?e:Jp(e),S=v==="contain"||y===!0?null:_j(w);return u.jsxs(Vn,{style:{backgroundColor:"black"},children:[u.jsx(b4,{cues:r,theme:o,face:s,zoomPlan:a,sourceTextRegions:f,contentTimeline:p,framingTimeline:h,spans:t,sourceSize:m,contentCropMode:x,sourceFit:v,children:u.jsx($j,{src:b,spans:t,...S?{punch:S}:{},...v==="contain"?{punchInScale:1,background:"transparent"}:{},...y===!0?{punchInScale:1}:{}})}),u.jsx(dA,{cues:r,theme:o}),yA(g)?u.jsx(m4,{lines:n,cues:r,activeColor:o.accent,theme:o,ctaKeyword:l,ctaWindow:c,sourceTextRegions:f}):null,gA(k)?u.jsx(vA,{theme:o,frame:{width:i.width,height:i.height}}):null]})},xA=600,bA=()=>({doc:t$(),past:[],future:[],dirty:!1,savedAt:0,lastCoalesce:null}),Xn=(e,t)=>e.scenes[t]??{props:{},elements:{}};function SA(e,t){var r;const n=(o,i)=>{const s=Date.now(),a=i!==void 0&&e.lastCoalesce!==null&&e.lastCoalesce.key===i&&s-e.lastCoalesce.at<xA;return{doc:o,past:a?e.past:[...e.past,e.doc],future:[],dirty:!0,savedAt:e.savedAt,lastCoalesce:i!==void 0?{key:i,at:s}:null}};switch(t.type){case"load":return{doc:t.doc,past:[],future:[],dirty:!1,savedAt:0,lastCoalesce:null};case"patchProps":{const o=Xn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,props:{...o.props,...t.patch}}}},t.coalesce)}case"patchElement":return n(Gg(e.doc,t.sceneId,t.elementId,t.patch),t.coalesce);case"clearElement":return n(m$(e.doc,t.sceneId,t.elementId));case"hideElement":return n(Gg(e.doc,t.sceneId,t.elementId,{hidden:!0}));case"restoreElement":{const o=(r=e.doc.scenes[t.sceneId])==null?void 0:r.elements[t.elementId];return o!=null&&o.hidden?n(g$(e.doc,t.sceneId,t.elementId)):e}case"patchTiming":{const o=Xn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,timing:{startSec:t.startSec,endSec:t.endSec}}}})}case"clearTiming":return n(v$(e.doc,t.sceneId));case"patchVideo":{const o=Xn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,video:{...o.video,...t.patch}}}},t.coalesce)}case"clearVideo":{const o=e.doc.scenes[t.sceneId];if(!(o!=null&&o.video))return e;const{video:i,...s}=o;return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:s}})}case"patchPip":{const o=Xn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,pip:{...o.pip,...t.patch}}}},t.coalesce)}case"clearPip":{const o=e.doc.scenes[t.sceneId];if(!(o!=null&&o.pip))return e;const{pip:i,...s}=o;return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:s}})}case"patchCaptionY":{const o=Xn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,captionY:t.y}}},t.coalesce)}case"patchCaptionScale":{const o=Xn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,captionScale:t.scale}}},t.coalesce)}case"clearCaptionStyle":{const o=e.doc.scenes[t.sceneId];if((o==null?void 0:o.captionY)===void 0&&(o==null?void 0:o.captionScale)===void 0)return e;const{captionY:i,captionScale:s,...a}=o;return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:a}})}case"patchCaptionStyleAll":{const o={...e.doc.scenes};for(const i of t.sceneIds){const s=o[i]??{props:{},elements:{}};o[i]={...s,...t.y!==void 0?{captionY:t.y}:{},...t.scale!==void 0?{captionScale:t.scale}:{}}}return n({...e.doc,scenes:o})}case"addSplit":return e.doc.splits.some(o=>Math.abs(o.at-t.t)<.001)?e:n({...e.doc,splits:[...e.doc.splits,{at:t.t,id:JM(t.t,e.doc.splits)}].sort((o,i)=>o.at-i.at)});case"setCaptionsHidden":{if(t.hidden===(e.doc.captionsHidden===!0))return e;if(t.hidden)return n({...e.doc,captionsHidden:!0});const{captionsHidden:o,...i}=e.doc;return n(i)}case"hideScene":{const o=Xn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,hidden:!0}}})}case"restoreScene":{const o=e.doc.scenes[t.sceneId];if(!(o!=null&&o.hidden))return e;const{hidden:i,...s}=o;return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:s}})}case"cutChunk":{const o=e.doc.cuts.filter(i=>i.src!==void 0||i.startSec!==t.startSec||i.endSec!==t.endSec);return n({...e.doc,cuts:[...o,{startSec:t.startSec,endSec:t.endSec}]})}case"restoreChunk":{if(t.index<0||t.index>=e.doc.cuts.length)return e;const o=e.doc.cuts.filter((i,s)=>s!==t.index);return n({...e.doc,cuts:o})}case"patchComponent":{const o=Xn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,component:t.component}}})}case"patchLayout":{const{graphicRect:o,...i}=Xn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...i,layout:t.layout}}})}case"patchGraphicRect":{const o=Xn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,graphicRect:t.rect}}},t.coalesce)}case"clearGraphicRect":return n(y$(e.doc,t.sceneId));case"patchCaption":{const o=bn(t.srcStart),i=Zg(e.doc.captions,o,t.was);if(t.text===i){const{[o]:s,...a}=e.doc.captions;return n({...e.doc,captions:a})}return n({...e.doc,captions:{...e.doc.captions,[o]:{text:t.text,was:i}}})}case"patchCaptionRange":{const o=bn(t.fromSrcStart),i=bn(t.toSrcStart),s=t.text.trim();if(!s)return e;const a=Kg(e.doc.captionRangeEdits,o,i,t.was);if(s===a){const v=e.doc.captionRangeEdits.filter(k=>k.fromKey!==o||k.toKey!==i);return v.length===e.doc.captionRangeEdits.length?e:n({...e.doc,captionRangeEdits:v})}const l=Math.min(Math.round(t.fromSrcStart*1e3),Math.round(t.toSrcStart*1e3)),c=Math.max(Math.round(t.fromSrcStart*1e3),Math.round(t.toSrcStart*1e3)),f=v=>{if(Zs(v))return!1;const k=Number(v.slice(1));return k>=l&&k<=c},p=Object.fromEntries(Object.entries(e.doc.captions).filter(([v])=>!f(v))),h=Object.fromEntries(Object.entries(e.doc.captionWordsHidden).filter(([v])=>!f(v))),m=Object.fromEntries(Object.entries(e.doc.captionLineTiming).filter(([v])=>!f(v))),x=[...e.doc.captionRangeEdits.filter(v=>{const k=Math.min(Number(v.fromKey.slice(1)),Number(v.toKey.slice(1)));return Math.max(Number(v.fromKey.slice(1)),Number(v.toKey.slice(1)))<l||k>c}),{fromKey:o,toKey:i,text:s,was:a}];return n({...e.doc,captions:p,captionWordsHidden:h,captionLineTiming:m,captionRangeEdits:x})}case"patchCaptionAllOccurrences":{let o=e.doc.captions,i=!1;for(const s of t.entries){const a=bn(s.srcStart),l=Zg(o,a,s.was);if(t.text===l){if(!(a in o))continue;const{[a]:f,...p}=o;o=p,i=!0;continue}const c=o[a];c!==void 0&&c.text===t.text&&c.was===l||(o={...o,[a]:{text:t.text,was:l}},i=!0)}return i?n({...e.doc,captions:o}):e}case"patchCaptionRangeAllOccurrences":{const o=t.text.trim();if(!o)return e;let i=e.doc,s=!1;for(const a of t.entries){const l=bn(a.fromSrcStart),c=bn(a.toSrcStart),f=Kg(i.captionRangeEdits,l,c,a.was);if(o===f){const x=i.captionRangeEdits.filter(v=>v.fromKey!==l||v.toKey!==c);if(x.length===i.captionRangeEdits.length)continue;i={...i,captionRangeEdits:x},s=!0;continue}const p=Math.min(Math.round(a.fromSrcStart*1e3),Math.round(a.toSrcStart*1e3)),h=Math.max(Math.round(a.fromSrcStart*1e3),Math.round(a.toSrcStart*1e3)),m=x=>{if(Zs(x))return!1;const v=Number(x.slice(1));return v>=p&&v<=h};i={...i,captions:Object.fromEntries(Object.entries(i.captions).filter(([x])=>!m(x))),captionWordsHidden:Object.fromEntries(Object.entries(i.captionWordsHidden).filter(([x])=>!m(x))),captionLineTiming:Object.fromEntries(Object.entries(i.captionLineTiming).filter(([x])=>!m(x))),captionRangeEdits:[...i.captionRangeEdits.filter(x=>{const v=Math.min(Number(x.fromKey.slice(1)),Number(x.toKey.slice(1)));return Math.max(Number(x.fromKey.slice(1)),Number(x.toKey.slice(1)))<p||v>h}),{fromKey:l,toKey:c,text:o,was:f}]},s=!0}return s?n(i):e}case"patchCaptionLineTiming":{let o=e.doc.captionLineTiming,i=!1;for(const s of t.entries){const a=bn(s.srcStart);if(Math.abs(s.lead)<.001&&Math.abs(s.tail)<.001){if(!(a in o))continue;const{[a]:c,...f}=o;o=f,i=!0;continue}const l=o[a];l!==void 0&&l.lead===s.lead&&l.tail===s.tail||(o={...o,[a]:{lead:s.lead,tail:s.tail}},i=!0)}return i?n({...e.doc,captionLineTiming:o}):e}case"hideCaptionWords":{const o={...e.doc.captionWordsHidden};let i=!1;for(const s of t.words){const a=bn(s.srcStart);a in o||(o[a]={was:s.was},i=!0)}return i?n({...e.doc,captionWordsHidden:o}):e}case"restoreCaptionWords":{const o={...e.doc.captionWordsHidden};let i=!1;for(const s of t.srcStarts){const a=bn(s);a in o&&(delete o[a],i=!0)}return i?n({...e.doc,captionWordsHidden:o}):e}case"cutWords":{const o={...e.doc.captionWordsHidden};for(const s of t.words){const a=bn(s.srcStart);a in o||(o[a]={was:s.was})}const i=e.doc.cuts.filter(s=>s.src!==void 0||s.startSec!==t.startSec||s.endSec!==t.endSec);return n({...e.doc,captionWordsHidden:o,cuts:[...i,{startSec:t.startSec,endSec:t.endSec}]})}case"setReasonEnabled":{const{reasons:o}=e.doc.cleanup;if(t.enabled){if(!(t.reason in o))return e;const{[t.reason]:i,...s}=o;return n({...e.doc,cleanup:{...e.doc.cleanup,reasons:s}})}return o[t.reason]===!1?e:n({...e.doc,cleanup:{...e.doc.cleanup,reasons:{...o,[t.reason]:!1}}})}case"toggleKept":{if(!(t.srcOut>t.srcIn))return e;const{kept:o}=e.doc.cleanup,i=o.filter(a=>!(a.srcIn<t.srcOut&&a.srcOut>t.srcIn)),s=i.length<o.length?{...e.doc.cleanup,kept:i}:{...e.doc.cleanup,kept:[...o,{srcIn:t.srcIn,srcOut:t.srcOut}]};return n({...e.doc,cleanup:s})}case"patchTheme":return n({...e.doc,theme:{...e.doc.theme,...t.patch}});case"undo":{if(e.past.length===0)return e;const o=e.past[e.past.length-1],i=e.past.slice(0,-1);return{doc:o,past:i,future:[...e.future,e.doc],savedAt:e.savedAt,dirty:i.length!==e.savedAt,lastCoalesce:null}}case"redo":{if(e.future.length===0)return e;const o=e.future[e.future.length-1],i=[...e.past,e.doc];return{doc:o,past:i,future:e.future.slice(0,-1),savedAt:e.savedAt,dirty:i.length!==e.savedAt,lastCoalesce:null}}case"saved":return{...e,dirty:!1,savedAt:e.past.length}}}function kA(){const[e,t]=d.useReducer(SA,void 0,bA),n=async()=>{const r=await fetch("/api/overrides",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(e.doc)});if(!r.ok){const o=await r.json().catch(()=>({}));throw new Error(o.error??"save failed")}t({type:"saved"})};return{doc:e.doc,dirty:e.dirty,canUndo:e.past.length>0,canRedo:e.future.length>0,load:r=>t({type:"load",doc:r}),undo:()=>t({type:"undo"}),redo:()=>t({type:"redo"}),save:n,patchProps:(r,o,i)=>t({type:"patchProps",sceneId:r,patch:o,coalesce:i}),patchElement:(r,o,i,s)=>t({type:"patchElement",sceneId:r,elementId:o,patch:i,coalesce:s}),clearElement:(r,o)=>t({type:"clearElement",sceneId:r,elementId:o}),hideElement:(r,o)=>t({type:"hideElement",sceneId:r,elementId:o}),restoreElement:(r,o)=>t({type:"restoreElement",sceneId:r,elementId:o}),patchTiming:(r,o,i)=>t({type:"patchTiming",sceneId:r,startSec:o,endSec:i}),clearTiming:r=>t({type:"clearTiming",sceneId:r}),patchVideo:(r,o,i)=>t({type:"patchVideo",sceneId:r,patch:o,coalesce:i}),clearVideo:r=>t({type:"clearVideo",sceneId:r}),patchPip:(r,o,i)=>t({type:"patchPip",sceneId:r,patch:o,coalesce:i}),clearPip:r=>t({type:"clearPip",sceneId:r}),patchCaptionY:(r,o,i)=>t({type:"patchCaptionY",sceneId:r,y:o,coalesce:i}),patchCaptionScale:(r,o,i)=>t({type:"patchCaptionScale",sceneId:r,scale:o,coalesce:i}),clearCaptionStyle:r=>t({type:"clearCaptionStyle",sceneId:r}),patchCaptionStyleAll:(r,o)=>t({type:"patchCaptionStyleAll",sceneIds:r,...o}),addSplit:r=>t({type:"addSplit",t:r}),setCaptionsHidden:r=>t({type:"setCaptionsHidden",hidden:r}),hideScene:r=>t({type:"hideScene",sceneId:r}),restoreScene:r=>t({type:"restoreScene",sceneId:r}),cutChunk:(r,o)=>t({type:"cutChunk",startSec:r,endSec:o}),restoreChunk:r=>t({type:"restoreChunk",index:r}),patchGraphicRect:(r,o,i)=>t({type:"patchGraphicRect",sceneId:r,rect:o,coalesce:i}),clearGraphicRect:r=>t({type:"clearGraphicRect",sceneId:r}),patchComponent:(r,o)=>t({type:"patchComponent",sceneId:r,component:o}),patchLayout:(r,o)=>t({type:"patchLayout",sceneId:r,layout:o}),patchCaption:(r,o,i)=>t({type:"patchCaption",srcStart:r,text:o,was:i}),patchCaptionRange:(r,o,i,s)=>t({type:"patchCaptionRange",fromSrcStart:r,toSrcStart:o,text:i,was:s}),patchCaptionAllOccurrences:(r,o)=>t({type:"patchCaptionAllOccurrences",entries:r,text:o}),patchCaptionRangeAllOccurrences:(r,o)=>t({type:"patchCaptionRangeAllOccurrences",entries:r,text:o}),patchCaptionLineTiming:r=>t({type:"patchCaptionLineTiming",entries:r}),hideCaptionWords:r=>t({type:"hideCaptionWords",words:r}),restoreCaptionWords:r=>t({type:"restoreCaptionWords",srcStarts:r}),cutWords:(r,o,i)=>t({type:"cutWords",words:r,startSec:o,endSec:i}),setReasonEnabled:(r,o)=>t({type:"setReasonEnabled",reason:r,enabled:o}),toggleKept:(r,o)=>t({type:"toggleKept",srcIn:r,srcOut:o}),patchTheme:r=>t({type:"patchTheme",patch:r})}}function av(e){const t=e==null?void 0:e.closest("[data-edit-id]");if(!t)return null;const n=t.closest("[data-edit-scene]");return n?{sceneId:n.dataset.editScene,elementId:t.dataset.editId}:null}function lv(e){const t=e==null?void 0:e.closest("[data-edit-video]");return(t==null?void 0:t.dataset.editVideo)||null}function uv(e,t,n){const r=e.querySelectorAll(`[data-edit-scene="${t}"] [data-edit-id="${n}"]`);if(r.length===0)return null;let o=1/0,i=1/0,s=-1/0,a=-1/0;return r.forEach(l=>{const c=l.getBoundingClientRect();o=Math.min(o,c.left),i=Math.min(i,c.top),s=Math.max(s,c.right),a=Math.max(a,c.bottom)}),new DOMRect(o,i,s-o,a-i)}const cv=.015,EA=1e-9;function Wo(e,t){let n=null,r=1/0;for(const o of e){const i=Math.abs(o.feature-o.target);i<=t+EA&&i<r&&(n=o,r=i)}return n}function dv(e,t,n,r){const o={...e},i=[];if(t==="move"){const s=e.x+e.w/2,a=e.x+e.w,l=.5-e.w/2,c=l>=n.left&&l+e.w<=1-n.right,f=Wo([...c?[{target:.5,feature:s}]:[],{target:n.left,feature:e.x},{target:1-n.right,feature:a}],r);f&&(o.x=e.x+(f.target-f.feature),i.push({axis:"x",at:f.target}));const p=e.y+e.h/2,h=e.y+e.h,m=.5-e.h/2,x=m>=n.top&&m+e.h<=1-n.bottom,v=Wo([...x?[{target:.5,feature:p}]:[],{target:n.top,feature:e.y},{target:1-n.bottom,feature:h}],r);return v&&(o.y=e.y+(v.target-v.feature),i.push({axis:"y",at:v.target})),{rect:o,guides:i}}if(t.includes("w")){const s=Wo([{target:n.left,feature:e.x}],r);if(s){const a=e.x+e.w;o.x=s.target,o.w=a-s.target,i.push({axis:"x",at:s.target})}}else if(t.includes("e")){const s=1-n.right,a=Wo([{target:s,feature:e.x+e.w}],r);a&&(o.w=a.target-e.x,i.push({axis:"x",at:a.target}))}if(t.includes("n")){const s=Wo([{target:n.top,feature:e.y}],r);if(s){const a=e.y+e.h;o.y=s.target,o.h=a-s.target,i.push({axis:"y",at:s.target})}}else if(t.includes("s")){const s=1-n.bottom,a=Wo([{target:s,feature:e.y+e.h}],r);a&&(o.h=a.target-e.y,i.push({axis:"y",at:a.target}))}return{rect:o,guides:i}}function CA(e){const t=e.spans;if(t===void 0)return{};let n;try{n=Xu(t).spans.length}catch{return{}}if(n===0)return{};const r={};return e.captionLines&&(r.captionLines=Xg(e.captionLines,t)),e.baseCaptionLines&&(r.baseCaptionLines=Xg(e.baseCaptionLines,t)),r}function fv(e,t){const n=t.baseCaptionLines??t.captionLines??[],r=a$(e.captions,n);return{doc:{...e,captions:l$(e.captions,r)},unresolved:r.unresolved}}function IA(e){const t={};for(const[n,r]of Object.entries(e))Zs(n)||(t[n]=r);return t}function TA(e,t){const n=i=>JSON.stringify([i.text,i.was]),r=new Map;for(const i of Object.values(t))r.set(n(i),(r.get(n(i))??0)+1);const o=[];for(const i of Object.values(e)){const s=r.get(n(i))??0;s>0?r.set(n(i),s-1):o.push(i)}return o}function RA(e){return e.map(t=>`“${t.was}” was retyped as “${t.text}”, and the overrides this render wrote back no longer have it. Retype it if you still want it.`)}function Ib(e){return e.map(t=>{const n=`“${t.was}” was retyped in an older version of this project`;switch(t.reason){case"out-of-range":return`${n}, and the word is still here but too far from where the edit was stored to be sure it is the same one — it was left alone. It is still saved. Retype it here if that is the word you meant.`;case"ambiguous":return`${n}, and more than one word here says it — it was left alone rather than applied to the wrong one. Retype the one you meant.`;case"unanchorable":return`${n}, but this project's files carry no source timing for that word, so nothing can be anchored to it. Re-run produce, then retype it.`;case"collision":return`${n} twice, and both point at the same word — neither was applied. Retype the one you meant.`;case"superseded":return`${n} and again since; the newer edit was kept and the older one dropped.`;default:return`${n}, and no word here says it any more — the cut probably removed it. Retype it if you still want it.`}})}function jA(e){return e.map(t=>t.reason==="duplicate-anchor"?`“${t.expected}” shares its moment with another word — only the first was retyped.`:t.found===null?`“${t.expected}” was retyped, but no word in this cut sits at that moment any more.`:`“${t.expected}” was retyped, but the transcript says “${t.found}” there now.`)}function PA(e){return e.map(t=>t.reason==="duplicate-anchor"?`“${t.expected}” shares its moment with another word — only the first was hidden from the captions.`:t.found===null?`“${t.expected}” was hidden from the captions, but no word in this cut sits at that moment any more — the hidden word no longer exists.`:`“${t.expected}” was hidden from the captions, but the transcript says “${t.found}” there now — it was left visible rather than hiding a different word.`)}function FA(e){return e.map(t=>t.reason==="duplicate-anchor"?`“${t.expected}” was rewritten, but an earlier rewrite already claimed the word it starts on — only the first applied.`:t.found===null?`“${t.expected}” was rewritten, but its words no longer sit at those source moments — re-select and Edit if you still want it.`:`“${t.expected}” was rewritten, but the transcript says “${t.found}” there now — the whole rewrite was left unapplied rather than guessing at part of it.`)}function _A(e){return e.map(t=>t.reason==="duplicate-anchor"?`A re-timed caption (${t.key}) starts on the same moment as another — only the first was re-timed.`:`A re-timed caption (${t.key}) no longer exists — the cut removed it, so its timing nudge was dropped.`)}function MA(e){if(e===void 0||e.trim()==="")return null;const t=Number(e);return Ue({srcStart:t})===null?null:t}function $A(e,t){var i;if(!e)return null;const n=[];if(e.kind!=="plain"&&((i=t.scenes[e.id])==null?void 0:i.hidden)!==!0&&n.push("graphic"),t.cuts.some(s=>s.src===void 0&&s.startSec===e.startSec&&s.endSec===e.endSec)||n.push("take"),n.length===0)return null;const o=q1(e.id);return{sceneId:e.id,rootId:o,isSplitHalf:o!==e.id,startSec:e.startSec,endSec:e.endSec,targets:n}}function pv(e,t,n,r){const o={...e};return t==="move"?(o.x+=n,o.y+=r,o):(t.includes("w")&&(o.x+=n,o.w-=n),t.includes("e")&&(o.w+=n),t.includes("n")&&(o.y+=r,o.h-=r),t.includes("s")&&(o.h+=r),o)}const hv=64,Ka=9,Ya=e=>Math.round(e*10)/10,Vo=e=>Math.round(e*1e4)/1e4,Tb={position:"absolute",width:10,height:10,background:"#5b8cff",border:"1px solid #0B0B0E",borderRadius:2,pointerEvents:"auto",zIndex:6},mv={nw:{left:0,top:0,transform:"translate(-50%,-50%)",cursor:"nwse-resize"},n:{left:"50%",top:0,transform:"translate(-50%,-50%)",cursor:"ns-resize"},ne:{right:0,top:0,transform:"translate(50%,-50%)",cursor:"nesw-resize"},e:{right:0,top:"50%",transform:"translate(50%,-50%)",cursor:"ew-resize"},se:{right:0,bottom:0,transform:"translate(50%,50%)",cursor:"nwse-resize"},s:{left:"50%",bottom:0,transform:"translate(-50%,50%)",cursor:"ns-resize"},sw:{left:0,bottom:0,transform:"translate(-50%,50%)",cursor:"nesw-resize"},w:{left:0,top:"50%",transform:"translate(-50%,-50%)",cursor:"ew-resize"}},AA={...Tb,background:"#ffe14d"},NA={top:{top:0,left:14,right:14,height:10},bottom:{bottom:0,left:14,right:14,height:10},left:{left:0,top:14,bottom:14,width:10},right:{right:0,top:14,bottom:14,width:10}},LA={position:"absolute",cursor:"move",pointerEvents:"auto",zIndex:5},Rb=/^(line|node|message|window|item)-(\d+)$/;function DA(e,t,n){const r=Rb.exec(e);if(!r)return null;const o=r[1],i=Number(r[2]);if(o==="message"&&i===0&&typeof t.keyword=="string"&&t.keyword){const f=n.trim().replace(/^"(.*)"$/,"$1").toLowerCase();return f?{keyword:f}:null}const s=o==="line"?"lines":o==="node"?"nodes":o==="item"?"items":o==="window"?"windows":"messages",a=t[s];if(!Array.isArray(a)||i<0||i>=a.length)return null;const l=a.slice(),c=l[i];if(o==="node"||o==="item")l[i]=n;else if(o==="window"){if(typeof c!="object"||c===null)return null;const f=n.split(`
|
|
160
|
-
`).slice(0,6).map(p=>p.slice(0,40));l[i]={...c,lines:f}}else{if(typeof c!="object"||c===null)return null;l[i]={...c,text:n}}return{[s]:l}}function zA(e,t){const n=Rb.exec(e);if(!n){const c=t[e];return typeof c=="string"?c:null}const r=n[1],o=Number(n[2]);if(r==="message"&&o===0&&typeof t.keyword=="string"&&t.keyword)return t.keyword;const s=t[r==="line"?"lines":r==="node"?"nodes":r==="item"?"items":r==="window"?"windows":"messages"];if(!Array.isArray(s)||o<0||o>=s.length)return null;const a=s[o];if(r==="node"||r==="item")return typeof a=="string"?a:null;if(r==="window"){const c=a==null?void 0:a.lines;return Array.isArray(c)&&c.every(f=>typeof f=="string")?c.join(`
|
|
161
|
-
`):null}const l=a==null?void 0:a.text;return typeof l=="string"?l:null}function jb(){const e=document.activeElement;(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&e.blur()}const OA=({stageRef:e,selection:t,onSelect:n,edits:r,onSave:o,settings:i,playerRef:s,onTransport:a,onVideoPreview:l,onGraphicPreview:c,cue:f,cues:p,onToggleHelp:h,onRequestDelete:m,fromLive:x=g=>g,hasOldClockPreimage:v=()=>!0,onClockRefused:k=()=>{}})=>{const[g,y]=d.useState(null),w=d.useRef(null),b=d.useRef(0),S=d.useRef(null),E=d.useRef(0),T=d.useRef(null),I=d.useRef(0),R=d.useRef(null),[F,A]=d.useState(!1),[W,M]=d.useState([]),$=d.useRef(null),[V,D]=d.useState(null),[L,j]=d.useState(null),C=d.useRef(null),[P,N]=d.useState({dx:0,dy:0}),B=d.useRef(null),z=d.useRef(t),Z=d.useCallback(O=>{z.current=O,n(O)},[n]);d.useEffect(()=>{z.current=t},[t]);const H=(O,X)=>{const ae=[];let oe=null;for(let Y=0;Y<25;Y++){const q=document.elementFromPoint(O,X);if(!q||q===document.documentElement||q===document.body){oe=q;break}if(oe=q,q.hasAttribute("data-edit-id")||q.hasAttribute("data-edit-scene")||q.hasAttribute("data-caption-word")||q.closest("[data-edit-video]")!==null||["BUTTON","INPUT","SELECT","TEXTAREA"].includes(q.tagName)||!(q instanceof HTMLElement))break;ae.push({el:q,prev:q.style.pointerEvents}),q.style.pointerEvents="none"}return ae.forEach(({el:Y,prev:q})=>{Y.style.pointerEvents=q}),oe},G=d.useCallback(()=>{var q,xe;const O=e.current,X=(q=s.current)==null?void 0:q.getScale(),ae=((xe=O==null?void 0:O.querySelector(".__remotion-player"))==null?void 0:xe.getBoundingClientRect())??(O==null?void 0:O.getBoundingClientRect());if(!ae||!X||X<=0)return null;const oe=i.width*X,Y=i.height*X;return{left:ae.left+(ae.width-oe)/2,top:ae.top+(ae.height-Y)/2,w:oe,h:Y}},[e,s,i]);return d.useEffect(()=>{if(!t){y(null);return}let O;const X=()=>{var oe;const ae=e.current;if(ae){const Y=t.elementId?uv(ae,t.sceneId,t.elementId):((oe=ae.querySelector(`[data-edit-scene="${t.sceneId}"]`))==null?void 0:oe.getBoundingClientRect())??null;y(Y)}O=requestAnimationFrame(X)};return O=requestAnimationFrame(X),()=>cancelAnimationFrame(O)},[e,t]),d.useEffect(()=>{const O=X=>{var Y,q;const ae=e.current;if(!ae||!ae.contains(X.target)||X.altKey||X.button!==0)return;(((Y=z.current)==null?void 0:Y.elementId)&&((q=B.current)==null?void 0:q.contains(X.target))||av(H(X.clientX,X.clientY))!==null)&&X.stopPropagation()};return window.addEventListener("pointerdown",O,!0),()=>window.removeEventListener("pointerdown",O,!0)},[e]),d.useEffect(()=>{const O=X=>{var ee,ue,se,Re,Ie,ze,Je;const ae=e.current;if(!ae||!ae.contains(X.target))return;const oe=document.activeElement;if((oe instanceof HTMLInputElement||oe instanceof HTMLTextAreaElement)&&oe.contains(X.target)||(jb(),X.altKey||X.button!==0))return;const Y=X.target instanceof Element?X.target.closest("[data-el-handle]"):null,q=z.current;if(Y&&(q!=null&&q.elementId)){const ke=uv(ae,q.sceneId,q.elementId);if(ke){const Ee=ke.left+ke.width/2,je=ke.top+ke.height/2,_e=Math.hypot(X.clientX-Ee,X.clientY-je);if(_e>2){const Le=((ue=(ee=r.doc.scenes[q.sceneId])==null?void 0:ee.elements[q.elementId])==null?void 0:ue.scale)??1;$.current={sceneId:q.sceneId,elementId:q.elementId,cx:Ee,cy:je,startDist:_e,prior:Le,factor:1},D(1)}}return}if((se=z.current)!=null&&se.elementId&&((Re=B.current)!=null&&Re.contains(X.target))){C.current={x:X.clientX,y:X.clientY,dx:0,dy:0},N({dx:0,dy:0});return}const xe=X.target instanceof Element?X.target.closest("[data-box-handle]"):null,Se=z.current;if(xe&&Se&&!Se.elementId){const ke=ae.querySelector(`[data-edit-scene="${Se.sceneId}"]`),Ee=G();if(ke&&Ee){const je=ke.getBoundingClientRect();R.current=null,T.current={sceneId:Se.sceneId,handle:xe.dataset.boxHandle,x:X.clientX,y:X.clientY,dx:0,dy:0,start:{x:(je.left-Ee.left)/Ee.w,y:(je.top-Ee.top)/Ee.h,w:je.width/Ee.w,h:je.height/Ee.h}},A(!0)}return}const de=H(X.clientX,X.clientY),K=av(de);if(!K){const ke=de==null?void 0:de.closest("[data-edit-scene]");if(ke){Z({sceneId:ke.dataset.editScene,elementId:null});return}const Ee=lv(de),je=ae.getBoundingClientRect().bottom;if(Ee&&X.clientY<je-hv){Z({sceneId:Ee,elementId:null});const _e=p.find(dt=>dt.id===Ee);if((_e==null?void 0:_e.layout)==="pip-bubble"&&!X.altKey){const dt=Co("pip-bubble",void 0,[],i).video.rect;S.current={sceneId:Ee,x:X.clientX,y:X.clientY,base:{x:((Ie=_e.pip)==null?void 0:Ie.x)??dt.x,y:((ze=_e.pip)==null?void 0:ze.y)??dt.y},slot:{w:dt.w,h:dt.h}};return}const Le=(Je=r.doc.scenes[Ee])==null?void 0:Je.video;w.current={sceneId:Ee,x:X.clientX,y:X.clientY,dx:0,dy:0,baseDx:(Le==null?void 0:Le.dx)??0,baseDy:(Le==null?void 0:Le.dy)??0};return}Z(null);return}Z({sceneId:K.sceneId,elementId:K.elementId}),C.current={x:X.clientX,y:X.clientY,dx:0,dy:0},N({dx:0,dy:0})};return window.addEventListener("mousedown",O),()=>window.removeEventListener("mousedown",O)},[e,Z,r,G,p,i]),d.useEffect(()=>{const O=()=>{var q,xe;const oe=(q=s.current)==null?void 0:q.getScale(),Y=(xe=e.current)==null?void 0:xe.getBoundingClientRect();return oe&&oe>0?1/oe:Y&&Y.width>0?i.width/Y.width:1},X=oe=>{const Y=e.current;if(Y&&!(T.current||$.current))if(S.current)Y.style.cursor="move";else if(w.current)Y.style.cursor="grabbing";else{const ee=oe.target instanceof Element?oe.target:null,ue=ee!==null&&Y.contains(ee)&&!ee.closest("button, input, select, textarea, [data-edit-id], [data-edit-scene], [data-caption-word]")&&oe.clientY<Y.getBoundingClientRect().bottom-hv,se=ue&&(()=>{var Ie;const Re=lv(ee);return Re!==null&&((Ie=p.find(ze=>ze.id===Re))==null?void 0:Ie.layout)==="pip-bubble"})();Y.style.cursor=ue?se?"move":"grab":""}const q=$.current;if(q){const ue=Math.hypot(oe.clientX-q.cx,oe.clientY-q.cy)/q.startDist;q.factor=Math.min(4/q.prior,Math.max(.05/q.prior,ue)),D(q.factor);return}const xe=T.current;if(xe){xe.dx=oe.clientX-xe.x,xe.dy=oe.clientY-xe.y,R.current=oe.altKey,I.current||(I.current=requestAnimationFrame(()=>{I.current=0;const ee=T.current,ue=G();if(!ee||!ue)return;const se=eu(pv(ee.start,ee.handle,ee.dx/ue.w,ee.dy/ue.h),i);if(oe.altKey)M([]),c({sceneId:ee.sceneId,rect:se});else{const Re=dv(se,ee.handle,Qn(i),cv);M(Re.guides),c({sceneId:ee.sceneId,rect:Re.rect})}}));return}if(S.current){E.current||(E.current=requestAnimationFrame(()=>{E.current=0;const ee=S.current,ue=G();if(!ee||!ue)return;const se=(oe.clientX-ee.x)/ue.w,Re=(oe.clientY-ee.y)/ue.h;r.patchPip(ee.sceneId,{x:Vo(Math.min(Math.max(ee.base.x+se,0),1-ee.slot.w)),y:Vo(Math.min(Math.max(ee.base.y+Re,0),1-ee.slot.h))},`pip:${ee.sceneId}:drag`)}));return}const de=w.current;if(de){de.dx=oe.clientX-de.x,de.dy=oe.clientY-de.y,b.current||(b.current=requestAnimationFrame(()=>{b.current=0;const ee=w.current;if(!ee)return;const ue=O();l({sceneId:ee.sceneId,patch:{dx:ee.baseDx+ee.dx*ue,dy:ee.baseDy+ee.dy*ue}})}));return}const K=C.current;K&&(K.dx=oe.clientX-K.x,K.dy=oe.clientY-K.y,N({dx:K.dx,dy:K.dy}))},ae=oe=>{const Y=$.current;if(Y){$.current=null,D(null),Math.abs(Y.factor-1)>.001&&r.patchElement(Y.sceneId,Y.elementId,{scale:Math.round(Y.prior*Y.factor*1e3)/1e3});return}const q=T.current;if(q){if(T.current=null,A(!1),M([]),I.current&&(cancelAnimationFrame(I.current),I.current=0),q.dx!==0||q.dy!==0){const ee=G();if(ee){let ue=eu(pv(q.start,q.handle,q.dx/ee.w,q.dy/ee.h),i);(R.current??oe.altKey)||(ue=dv(ue,q.handle,Qn(i),cv).rect),r.patchGraphicRect(q.sceneId,{x:Vo(ue.x),y:Vo(ue.y),w:Vo(ue.w),h:Vo(ue.h)})}}R.current=null,c(null);return}if(S.current){S.current=null,E.current&&(cancelAnimationFrame(E.current),E.current=0);return}const Se=w.current;if(Se){if(w.current=null,b.current&&(cancelAnimationFrame(b.current),b.current=0),Se.dx!==0||Se.dy!==0){const ee=O();r.patchVideo(Se.sceneId,{dx:Ya(Se.baseDx+Se.dx*ee),dy:Ya(Se.baseDy+Se.dy*ee)})}l(null);return}const de=C.current,K=z.current;if(!de||!(K!=null&&K.elementId)){C.current=null;return}if(de.dx!==0||de.dy!==0){const ee=O(),ue=r.doc.scenes[K.sceneId],se=ue==null?void 0:ue.elements[K.elementId];r.patchElement(K.sceneId,K.elementId,{dx:Ya(((se==null?void 0:se.dx)??0)+de.dx*ee),dy:Ya(((se==null?void 0:se.dy)??0)+de.dy*ee)})}C.current=null,N({dx:0,dy:0})};return window.addEventListener("mousemove",X),window.addEventListener("mouseup",ae),()=>{window.removeEventListener("mousemove",X),window.removeEventListener("mouseup",ae)}},[r,e,i,s,l,c,G,p]),d.useEffect(()=>{const O=X=>{var xe;const ae=e.current;if(!ae||!ae.contains(X.target))return;const oe=(xe=H(X.clientX,X.clientY))==null?void 0:xe.closest("[data-caption-word]");if(!oe)return;X.preventDefault();const Y=MA(oe.dataset.captionSrc),q=oe.dataset.captionText??"";Y===null||!q||j({srcStart:Y,was:q,draft:q,rect:oe.getBoundingClientRect()})};return window.addEventListener("dblclick",O),()=>window.removeEventListener("dblclick",O)},[e]),d.useEffect(()=>{const O=()=>{const Y=document.activeElement;return Y instanceof HTMLInputElement||Y instanceof HTMLTextAreaElement||Y instanceof HTMLSelectElement||Y instanceof HTMLElement&&Y.isContentEditable},X=()=>{const Y=document.activeElement;return Y instanceof HTMLTextAreaElement||Y instanceof HTMLElement&&Y.isContentEditable?!0:Y instanceof HTMLInputElement&&!["range","checkbox","radio","button"].includes(Y.type)},ae=()=>{const Y=document.activeElement;Y instanceof HTMLElement&&!X()&&Y.blur()},oe=Y=>{var xe,Se,de;if(L!==null)return;const q=Y.metaKey||Y.ctrlKey;if(Y.key==="Escape"){if(O()){(xe=document.activeElement)==null||xe.blur();return}Z(null)}else if(q&&Y.key.toLowerCase()==="z")Y.preventDefault(),Y.shiftKey?r.redo():r.undo();else if(q&&Y.key.toLowerCase()==="y")Y.preventDefault(),r.redo();else if(q&&Y.key.toLowerCase()==="s")Y.preventDefault(),o();else if(Y.key===" "&&!q){if(X())return;const K=document.activeElement;if(K instanceof HTMLElement&&K.tagName==="BUTTON"&&((Se=e.current)!=null&&Se.contains(K)))return;ae(),Y.preventDefault(),(de=s.current)==null||de.toggle()}else if(!q&&["j","k","l"].includes(Y.key.toLowerCase())){if(X())return;ae(),Y.preventDefault(),a(Y.key.toUpperCase())}else if(!q&&!Y.altKey&&(Y.key==="ArrowLeft"||Y.key==="ArrowRight")){if(O())return;Y.preventDefault();const K=s.current;if(!K)return;K.seekTo(Math.max(0,K.getCurrentFrame()+(Y.key==="ArrowRight"?1:-1)))}else if(q&&Y.key.toLowerCase()==="b"){if(X())return;Y.preventDefault();const K=s.current;if(!K)return;const ee=K.getCurrentFrame()/i.fps;if(!p.find(se=>ee>=se.startSec+Ql&&ee<=se.endSec-Ql))return;if(!v(ee)){k("Can't split here: this moment isn't in the last render yet — render once (or re-remove the pause) to split here.");return}r.addSplit(Math.round(x(ee)*1e3)/1e3)}else if(!q&&Y.altKey&&(Y.key==="ArrowLeft"||Y.key==="ArrowRight")){if(X())return;const K=z.current,ee=K?(()=>{const ue=p.findIndex(se=>se.id===K.sceneId);return ue===-1?void 0:p[ue+(Y.key==="ArrowRight"?1:-1)]})():p[Y.key==="ArrowRight"?0:p.length-1];if(!ee)return;Y.preventDefault(),Z({sceneId:ee.id,elementId:null})}else if(q&&(Y.key==="ArrowLeft"||Y.key==="ArrowRight")){if(X())return;Y.preventDefault();const K=s.current;if(!K)return;const ee=K.getCurrentFrame()/i.fps,ue=p.findIndex(Re=>ee>=Re.startSec&&ee<Re.endSec),se=p[(ue===-1?0:ue)+(Y.key==="ArrowRight"?1:-1)];if(!se)return;K.seekTo(Math.round(se.startSec*i.fps)),Z({sceneId:se.id,elementId:null})}else if(!q&&!Y.altKey&&Y.key==="?"){if(O())return;Y.preventDefault(),h()}else if(!q&&(Y.key==="Delete"||Y.key==="Backspace")){if(O())return;const K=z.current;if(!K||K.elementId!==null||!f||f.id!==K.sceneId)return;const ee=$A(f,r.doc);if(!ee)return;Y.preventDefault(),m(ee)}};return window.addEventListener("keydown",oe),()=>window.removeEventListener("keydown",oe)},[Z,r,L,o,s,e,a,f,p,i,h,m,x,v,k]),u.jsxs("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:[P.dx!==0||P.dy!==0||F?u.jsx("div",{"data-testid":"safe-area-guide",style:{position:"absolute",left:`${Qn(i).left*100}%`,top:`${Qn(i).top*100}%`,right:`${Qn(i).right*100}%`,bottom:`${Qn(i).bottom*100}%`,border:"1px dashed rgba(255, 225, 77, 0.45)",boxShadow:"0 0 0 9999px rgba(0, 0, 0, 0.18)",pointerEvents:"none"}}):null,W.map(O=>u.jsx("div",{"data-testid":`guide-${O.axis}`,style:{position:"absolute",pointerEvents:"none",background:"#FFE14D",...O.axis==="x"?{left:`${O.at*100}%`,top:0,bottom:0,width:1}:{top:`${O.at*100}%`,left:0,right:0,height:1}}},O.axis)),g&&t?u.jsxs("div",{ref:B,"data-testid":"overlay-box",style:{position:"fixed",pointerEvents:"auto",left:g.left+P.dx-Ka/2+g.width*(1-(V??1))/2,top:g.top+P.dy-Ka/2+g.height*(1-(V??1))/2,width:g.width*(V??1)+Ka,height:g.height*(V??1)+Ka,border:t.elementId?"2px dashed #ffe14d":"2px dashed #5b8cff",borderRadius:4,boxShadow:"0 0 0 1px rgba(0,0,0,0.35)",cursor:t.elementId?"grab":"default"},children:[t.elementId?u.jsx("div",{style:{position:"absolute",bottom:"100%",left:0,marginBottom:4,fontSize:10,fontFamily:"ui-monospace, 'SF Mono', monospace",letterSpacing:"0.04em",textTransform:"uppercase",color:"#0B0B0E",background:"#ffe14d",padding:"2px 6px",borderRadius:3,whiteSpace:"nowrap"},children:t.elementId}):null,t.elementId?["nw","ne","se","sw"].map(O=>u.jsx("div",{"data-el-handle":O,"data-testid":`el-handle-${O}`,style:{...AA,...mv[O]}},O)):null,!t.elementId&&f&&f.kind!=="plain"?u.jsxs(u.Fragment,{children:[["top","bottom","left","right"].map(O=>u.jsx("div",{"data-box-handle":"move","data-testid":O==="top"?"box-handle-move":`box-handle-move-${O}`,style:{...LA,...NA[O]}},O)),["nw","n","ne","e","se","s","sw","w"].map(O=>u.jsx("div",{"data-box-handle":O,"data-testid":`box-handle-${O}`,style:{...Tb,...mv[O]}},O))]}):null]}):null,L?u.jsx("input",{autoFocus:!0,"data-testid":"caption-edit",value:L.draft,onChange:O=>j({...L,draft:O.target.value}),onBlur:()=>{const O=L.draft.trim();O&&r.patchCaption(L.srcStart,O,L.was),j(null)},onKeyDown:O=>{O.key==="Enter"&&O.target.blur(),O.key==="Escape"&&j(null)},style:{position:"fixed",pointerEvents:"auto",left:L.rect.left-4,top:L.rect.top-4,width:Math.max(L.rect.width+40,90),height:L.rect.height+8,fontSize:Math.max(13,Math.min(L.rect.height*.7,28)),fontFamily:"'Inter', system-ui, sans-serif",fontWeight:800,border:"2px solid #FFE14D",borderRadius:4,padding:"0 4px",background:"#0B0B0E",color:"#fff",outline:"none",zIndex:11}}):null]})},Nn={display:"flex",flexDirection:"column",gap:6},is={display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},Ke={fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"#9A9AA3"},ks={fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",fontSize:13,background:"#0F0F14",border:"1px solid #2A2A33",borderRadius:6,color:"#fff",padding:"6px 8px",width:"100%"},Rf={...ks,fontFamily:"'Inter', system-ui, sans-serif"},ot={display:"flex",flexDirection:"column",gap:14,padding:"16px 18px",borderBottom:"1px solid #22222a"},on={fontSize:12,fontWeight:600,color:"#FF5C5C",background:"transparent",border:"1px solid #452626",borderRadius:6,padding:"7px 10px",cursor:"pointer"},sn=()=>{var e,t;(t=(e=document.activeElement)==null?void 0:e.blur)==null||t.call(e)},BA=e=>String(Math.round(e*1e3)/1e3),Gt=({id:e,value:t,onCommit:n,min:r,max:o,dragStep:i})=>{const[s,a]=le.useState(null),[l,c]=le.useState(!1),f=le.useRef(null),p=le.useRef(null),h=r??-1/0,m=o??1/0,x=i??(r!==void 0&&o!==void 0?(o-r)/240:.5),v=s!==null;return u.jsxs("div",{style:Nn,children:[u.jsx("span",{style:Ke,children:e}),u.jsx("input",{type:"text",inputMode:"decimal",ref:f,"data-testid":`field-${e}`,style:{...ks,...v?{}:{cursor:"ew-resize",touchAction:"none"},...l?{borderColor:"#FFE14D",color:"#FFE14D"}:{}},value:s??(Number.isFinite(t)?BA(t):"0"),onFocus:k=>a(k.target.value),onBlur:()=>a(null),onPointerDown:k=>{v||(k.preventDefault(),p.current={x:k.clientX,v:Number.isFinite(t)?t:0,moved:!1},k.currentTarget.setPointerCapture(k.pointerId),c(!0))},onPointerMove:k=>{const g=p.current;if(!g)return;const y=k.clientX-g.x;if(!g.moved&&Math.abs(y)<=2)return;g.moved=!0;const w=Math.round(Math.min(m,Math.max(h,g.v+y*x))*1e3)/1e3;n(w)},onPointerUp:()=>{var g,y,w;const k=((g=p.current)==null?void 0:g.moved)===!0;p.current=null,c(!1),k||((y=f.current)==null||y.focus(),(w=f.current)==null||w.select())},onPointerCancel:()=>{p.current=null,c(!1)},onChange:k=>{a(k.target.value);const g=k.target.value.trim();if(g==="")return;const y=Number(g.replace(",","."));Number.isFinite(y)&&n(Math.min(m,Math.max(h,y)))}})]})},Ga=({id:e,value:t,isColor:n,onCommit:r})=>u.jsxs("div",{style:Nn,children:[u.jsx("span",{style:Ke,children:e}),u.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[n?u.jsx("input",{type:"color",value:t,onChange:o=>r(o.target.value),style:{width:28,height:28,border:"1px solid #2A2A33",borderRadius:6,padding:0,background:"none"}}):null,u.jsx("input",{"data-testid":`theme-${e}`,style:{...Rf,flex:1},value:t,onChange:o=>r(o.target.value)})]})]}),WA=({selection:e,cue:t,frame:n,allSceneIds:r,edits:o,onSelect:i,resolvedTheme:s,anchorText:a,onVideoPreview:l,runInfo:c,captionsHiddenByFlag:f,fromLive:p=x=>x,hasOldClockPreimage:h=()=>!0,onClockRefused:m=()=>{}})=>{var b,S,E,T,I,R,F,A,W,M,$,V;if(e!=null&&e.elementId&&t){const D=e.elementId,L=((b=t.elements)==null?void 0:b[D])??{},j=t.props?zA(D,t.props):null,C=/^window-\d+$/.test(D);return u.jsxs("div",{children:[u.jsxs("div",{style:ot,children:[u.jsx("span",{style:Ke,children:"Selected"}),u.jsx("div",{style:{fontSize:15,fontWeight:700,fontFamily:"ui-monospace, monospace"},children:D})]}),(()=>{var H;const P=/^line-(\d+)$/.exec(D),N=(H=t.props)==null?void 0:H.lines;if(t.component!=="StrikethroughReveal"||!P||!Array.isArray(N))return null;const B=Number(P[1]),z=N[B];if(!z)return null;const Z=z.struck?"struck":(z.mark??"none")!=="none"?z.mark:"plain";return u.jsx("div",{style:ot,children:u.jsxs("div",{style:Nn,children:[u.jsx("span",{style:Ke,children:"Line style"}),u.jsxs("select",{"data-testid":"line-style",style:ks,value:Z,onChange:G=>{const O=G.target.value,X=N.slice();X[B]={...X[B],struck:O==="struck",mark:O==="cross"||O==="check"?O:"none"},o.patchProps(e.sceneId,{lines:X})},children:[u.jsx("option",{value:"plain",children:"plain"}),u.jsx("option",{value:"struck",children:"struck through"}),u.jsx("option",{value:"cross",children:"✗ wrong"}),u.jsx("option",{value:"check",children:"✓ right"})]})]})})})(),j!==null?u.jsx("div",{style:ot,children:u.jsxs("div",{style:Nn,children:[u.jsx("span",{style:Ke,children:"Text"}),(()=>{const P=N=>{const B=t.props??{},z=/^(line|node|message|window|item)-\d+$/.test(D)?DA(D,B,N):{[D]:N};z&&o.patchProps(e.sceneId,z,`text:${e.sceneId}:${D}`)};return C?u.jsx("textarea",{style:{...Rf,resize:"vertical",fontFamily:"inherit"},"data-testid":"element-text",rows:Math.min(6,Math.max(2,j.split(`
|
|
162
|
-
`).length)),value:j,onChange:N=>P(N.target.value)}):u.jsx("input",{style:Rf,"data-testid":"element-text",value:j,onChange:N=>P(N.target.value)})})()]})}):null,u.jsxs("div",{style:ot,children:[u.jsxs("div",{style:Nn,children:[u.jsxs("span",{style:Ke,children:["scale"," ",u.jsxs("span",{style:{color:"#EDEDF2"},children:[(L.scale??1).toFixed(2),"×"]})]}),u.jsx("input",{type:"range","data-testid":"el-scale-slider",min:.1,max:3,step:.01,value:L.scale??1,onChange:P=>o.patchElement(e.sceneId,D,{scale:Number(P.target.value)},`element:${e.sceneId}:${D}:scale`)})]}),u.jsxs("div",{style:is,children:[u.jsx(Gt,{id:"x",value:L.dx??0,dragStep:1,onCommit:P=>o.patchElement(e.sceneId,D,{dx:P},`element:${e.sceneId}:${D}:dx`)}),u.jsx(Gt,{id:"y",value:L.dy??0,dragStep:1,onCommit:P=>o.patchElement(e.sceneId,D,{dy:P},`element:${e.sceneId}:${D}:dy`)})]}),u.jsx(Gt,{id:"scale",value:L.scale??1,min:.05,max:4,dragStep:.01,onCommit:P=>o.patchElement(e.sceneId,D,{scale:P},`element:${e.sceneId}:${D}:scale`)})]}),u.jsxs("div",{style:ot,children:[u.jsx("button",{style:on,onClick:()=>{sn(),o.clearElement(e.sceneId,D)},children:"Reset element"}),u.jsx("button",{"data-testid":"delete-element",style:{...on,marginTop:8},onClick:()=>{sn(),o.hideElement(e.sceneId,D),i({sceneId:e.sceneId,elementId:null})},children:"Delete element"})]})]})}if(e&&t){const D=t.kind==="plain";if(((S=o.doc.scenes[e.sceneId])==null?void 0:S.hidden)===!0)return u.jsx("div",{children:u.jsxs("div",{style:ot,children:[u.jsx("span",{style:Ke,children:"Scene"}),u.jsxs("div",{style:{fontSize:15,fontWeight:700,fontFamily:"ui-monospace, monospace"},children:[e.sceneId," ",u.jsx("span",{style:{color:"#9A9AA3",fontWeight:400},children:"(deleted)"})]}),u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Its window plays as a plain take. Restore brings the graphic back."}),u.jsx("button",{"data-testid":"restore-scene",style:{...on,color:"#5FBF77",border:"1px solid #24402c"},onClick:()=>{sn(),o.restoreScene(e.sceneId)},children:"Restore scene"})]})});const L=o.doc.cuts.findIndex(C=>C.src===void 0&&C.startSec===t.startSec&&C.endSec===t.endSec);if(L!==-1)return u.jsx("div",{children:u.jsxs("div",{style:ot,children:[u.jsx("span",{style:Ke,children:D?"Take":"Scene"}),u.jsxs("div",{style:{fontSize:15,fontWeight:700,fontFamily:"ui-monospace, monospace"},children:[e.sceneId," ",u.jsx("span",{style:{color:"#9A9AA3",fontWeight:400},children:"(marked for removal)"})]}),u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Struck through on the timeline. It disappears from the output on the next produce/Render — this preview still plays it (the editor doesn't re-derive a second cut timeline just to show one early)."}),u.jsx("button",{"data-testid":"restore-chunk",style:{...on,color:"#5FBF77",border:"1px solid #24402c"},onClick:()=>{sn(),o.restoreChunk(L)},children:"Restore"})]})});const j=Object.entries(t.elements??{}).filter(([,C])=>C.hidden===!0).map(([C])=>{var B,z;const N=((z=(B=o.doc.scenes[e.sceneId])==null?void 0:B.elements[C])==null?void 0:z.hidden)===!0?e.sceneId:q1(e.sceneId);return{id:C,owningSceneId:N}});return u.jsxs("div",{children:[u.jsxs("div",{style:ot,children:[u.jsx("span",{style:Ke,children:D?"Take":"Scene"}),u.jsx("div",{style:{fontSize:15,fontWeight:700,fontFamily:"ui-monospace, monospace"},children:e.sceneId}),D?u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"A continuous stretch of the talking head — no graphic. Frame it below; its window follows the cut."}):null]}),u.jsxs("div",{style:ot,children:[!D&&t.component?u.jsxs("div",{style:Nn,children:[u.jsx("span",{style:Ke,children:"Component"}),u.jsx("select",{style:ks,value:t.component,onChange:C=>o.patchComponent(e.sceneId,C.target.value),children:Yu.options.map(C=>u.jsx("option",{value:C,children:C},C))})]}):null,u.jsxs("div",{style:Nn,children:[u.jsx("span",{style:Ke,children:"Layout"}),u.jsx("select",{style:ks,"data-testid":"layout-select",value:t.layout,onChange:C=>o.patchLayout(e.sceneId,C.target.value),children:Ku.options.map(C=>u.jsx("option",{value:C,children:C},C))})]})]}),u.jsxs("div",{style:ot,children:[u.jsx("span",{style:Ke,children:"Video framing"}),u.jsxs("div",{style:Nn,children:[u.jsxs("span",{style:Ke,children:["zoom"," ",u.jsxs("span",{style:{color:"#EDEDF2"},children:[(((E=t.video)==null?void 0:E.scale)??1).toFixed(2),"×"]})]}),u.jsx("input",{type:"range","data-testid":"zoom-slider",min:.5,max:3,step:.01,value:((T=t.video)==null?void 0:T.scale)??1,onChange:C=>l({sceneId:e.sceneId,patch:{scale:Number(C.target.value)}}),onPointerUp:C=>{const P=Number(C.target.value);o.patchVideo(e.sceneId,{scale:P},`video:${e.sceneId}:scale`),l(null)},onKeyUp:C=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(C.key))return;const N=Number(C.target.value);o.patchVideo(e.sceneId,{scale:N},`video:${e.sceneId}:scale`),l(null)}})]}),u.jsxs("label",{style:{display:"flex",gap:8,alignItems:"center",fontSize:12,color:"#9A9AA3",cursor:"pointer"},children:[u.jsx("input",{type:"checkbox","data-testid":"auto-zoom",checked:((I=t.video)==null?void 0:I.autoZoom)!==!1,onChange:C=>o.patchVideo(e.sceneId,{autoZoom:C.target.checked})}),"auto zoom (the slow push composes on top of your zoom)"]}),u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Pan: drag the picture on the stage."}),u.jsx(Gt,{id:"scale",value:((R=t.video)==null?void 0:R.scale)??1,min:.05,max:4,dragStep:.01,onCommit:C=>o.patchVideo(e.sceneId,{scale:C},`video:${e.sceneId}:scale`)}),u.jsxs("div",{style:is,children:[u.jsx(Gt,{id:"dx",value:((F=t.video)==null?void 0:F.dx)??0,dragStep:1,onCommit:C=>o.patchVideo(e.sceneId,{dx:C},`video:${e.sceneId}:dx`)}),u.jsx(Gt,{id:"dy",value:((A=t.video)==null?void 0:A.dy)??0,dragStep:1,onCommit:C=>o.patchVideo(e.sceneId,{dy:C},`video:${e.sceneId}:dy`)})]}),t.video?u.jsx("button",{style:on,onClick:()=>{sn(),o.clearVideo(e.sceneId)},children:"Reset framing"}):null]}),t.layout==="pip-bubble"?(()=>{const C=Co("pip-bubble",void 0,[],n).video,P=t.pip??{},N=P.cornerRadius??C.cornerRadius;return u.jsxs("div",{style:ot,children:[u.jsx("span",{style:Ke,children:"PiP bubble"}),u.jsxs("div",{style:Nn,children:[u.jsxs("span",{style:Ke,children:["roundness"," ",u.jsx("span",{style:{color:"#EDEDF2"},children:N.toFixed(2)})]}),u.jsx("input",{type:"range","data-testid":"pip-roundness",min:0,max:1,step:.01,value:N,onChange:B=>o.patchPip(e.sceneId,{cornerRadius:Number(B.target.value)},`pip:${e.sceneId}:cornerRadius`)})]}),u.jsxs("div",{style:is,children:[u.jsx(Gt,{id:"pip-x",value:P.x??C.rect.x,min:0,max:1-C.rect.w,dragStep:.002,onCommit:B=>o.patchPip(e.sceneId,{x:B},`pip:${e.sceneId}:x`)}),u.jsx(Gt,{id:"pip-y",value:P.y??C.rect.y,min:0,max:1-C.rect.h,dragStep:.002,onCommit:B=>o.patchPip(e.sceneId,{y:B},`pip:${e.sceneId}:y`)})]}),t.pip?u.jsx("button",{"data-testid":"reset-pip",style:on,onClick:()=>{sn(),o.clearPip(e.sceneId)},children:"Reset bubble"}):null]})})():null,(()=>{var N;if(D)return null;const C=ab(t,n),P=B=>z=>o.patchGraphicRect(e.sceneId,eu({...C,[B]:z},n),`box:${e.sceneId}:${B}`);return u.jsxs("div",{style:ot,children:[u.jsx("span",{style:Ke,children:"Graphic box"}),u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Frame fractions — or drag the handles on the stage."}),u.jsxs("div",{style:is,children:[u.jsx(Gt,{id:"box-x",value:C.x,min:0,max:1,dragStep:.002,onCommit:P("x")}),u.jsx(Gt,{id:"box-y",value:C.y,min:0,max:1,dragStep:.002,onCommit:P("y")})]}),u.jsxs("div",{style:is,children:[u.jsx(Gt,{id:"box-w",value:C.w,min:.08,max:1,dragStep:.002,onCommit:P("w")}),u.jsx(Gt,{id:"box-h",value:C.h,min:.05,max:1,dragStep:.002,onCommit:P("h")})]}),(N=o.doc.scenes[e.sceneId])!=null&&N.graphicRect?u.jsx("button",{"data-testid":"reset-box",style:on,onClick:()=>{sn(),o.clearGraphicRect(e.sceneId)},children:"Reset box"}):null]})})(),(()=>{const C=Co(t.layout,void 0,[],n).captionAnchor,P=t.captionY??C,N=t.captionScale??1,B=o.doc.scenes[e.sceneId];return u.jsxs("div",{style:ot,children:[u.jsx("span",{style:Ke,children:"Captions"}),o.doc.captionsHidden===!0||f===!0?u.jsxs("div",{"data-testid":"captions-hidden-hint",style:{fontSize:12,color:"#FFE14D"},children:["Captions are hidden globally",f===!0?" (--no-captions)":" (Theme panel)"," — these settings are kept and apply when captions are shown again."]}):null,u.jsxs("div",{style:Nn,children:[u.jsxs("span",{style:Ke,children:["position"," ",u.jsx("span",{style:{color:"#EDEDF2"},children:P.toFixed(2)})]}),u.jsx("input",{type:"range","data-testid":"caption-y-slider",min:.05,max:.95,step:.01,value:P,onChange:z=>o.patchCaptionY(e.sceneId,Number(z.target.value),`captionY:${e.sceneId}`)})]}),u.jsxs("div",{style:Nn,children:[u.jsxs("span",{style:Ke,children:["scale"," ",u.jsxs("span",{style:{color:"#EDEDF2"},children:[N.toFixed(2),"×"]})]}),u.jsx("input",{type:"range","data-testid":"caption-scale-slider",min:.2,max:3,step:.01,value:N,onChange:z=>o.patchCaptionScale(e.sceneId,Number(z.target.value),`captionScale:${e.sceneId}`)})]}),u.jsx(Gt,{id:"caption-scale",value:N,min:.2,max:3,dragStep:.01,onCommit:z=>o.patchCaptionScale(e.sceneId,z,`captionScale:${e.sceneId}`)}),u.jsx("button",{"data-testid":"caption-y-all",style:{...on,color:"#EDEDF2",border:"1px solid #2A2A33"},title:"Write this scene's caption position and scale to every scene — one undo step",onClick:()=>{sn(),o.patchCaptionStyleAll(r,{y:P,scale:N})},children:"Apply to all scenes"}),(B==null?void 0:B.captionY)!==void 0||(B==null?void 0:B.captionScale)!==void 0?u.jsx("button",{"data-testid":"reset-caption-y",style:on,onClick:()=>{sn(),o.clearCaptionStyle(e.sceneId)},children:"Reset captions"}):null]})})(),u.jsxs("div",{style:ot,children:[u.jsx("span",{style:Ke,children:"Timing"}),u.jsxs("div",{"data-testid":"timing-range",style:{fontSize:13,fontFamily:"ui-monospace, 'SF Mono', monospace"},children:[t.startSec.toFixed(2),"s – ",t.endSec.toFixed(2),"s",u.jsxs("span",{style:{color:"#9A9AA3"},children:[" ","(",(t.endSec-t.startSec).toFixed(2),"s)"]})]}),u.jsx("div",{style:{fontSize:12,color:t.pinned?"#FFE14D":"#9A9AA3"},children:D?"Derived from the cut — not movable":t.pinned?"Pinned to these times":"Tracking transcript"}),!t.pinned&&a?u.jsxs("div",{style:{fontSize:12,color:"#9A9AA3",fontStyle:"italic"},children:["“",a,"”"]}):null,t.pinned?u.jsx("button",{style:on,onClick:()=>{sn(),o.clearTiming(e.sceneId)},children:"Un-pin (re-anchor to words)"}):null]}),D?null:u.jsx("div",{style:ot,children:u.jsx("button",{"data-testid":"delete-scene",style:on,onClick:()=>{sn(),o.hideScene(e.sceneId)},children:"Delete scene"})}),j.length>0?u.jsxs("div",{style:ot,children:[u.jsx("span",{style:Ke,children:"Hidden elements"}),j.map(({id:C,owningSceneId:P})=>u.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[u.jsx("span",{style:{fontSize:13,fontFamily:"ui-monospace, monospace",color:"#C9C9D4"},children:C}),u.jsx("button",{"data-testid":`restore-element-${C}`,style:{...on,color:"#5FBF77",border:"1px solid #24402c",padding:"4px 8px"},onClick:()=>{sn(),o.restoreElement(P,C)},children:"Restore"})]},C))]}):null,u.jsxs("div",{style:ot,children:[u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Removes this window from the output on the next produce/Render. Struck through here until then — the preview keeps playing it."}),u.jsx("button",{"data-testid":"cut-chunk",style:on,onClick:()=>{sn();const C=ob({fromLive:p,hasOldClockPreimage:h},t.startSec,t.endSec);if(C.kind==="degenerate"){m("Can't cut this window: it isn't in the last render yet — render once (or re-remove the pause) to cut it.");return}C.kind==="shrunk"&&console.warn(`ossclip cut preview: ${C.report}`),o.cutChunk(C.startSec,C.endSec)},children:"Delete this chunk"})]})]})}const x=o.doc.theme,v=(D,L)=>o.patchTheme({[D]:L}),k=D=>`${Math.floor(D/60)}:${String(Math.floor(D%60)).padStart(2,"0")}`,g=((W=c==null?void 0:c.usage)==null?void 0:W.totals)??null,y=((M=c==null?void 0:c.production)==null?void 0:M.producer)??null,w=(($=c==null?void 0:c.production)==null?void 0:$.clip)??null;return u.jsxs("div",{children:[u.jsxs("div",{style:ot,children:[u.jsx("span",{style:Ke,children:"Theme"}),u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Nothing selected — global tokens."})]}),u.jsxs("div",{style:ot,children:[u.jsx(Ga,{id:"accent",value:x.accent??s.accent,isColor:!0,onCommit:D=>v("accent",D)}),u.jsx(Ga,{id:"bg",value:x.bg??s.bg,isColor:!0,onCommit:D=>v("bg",D)}),u.jsx(Ga,{id:"fg",value:x.fg??s.fg,isColor:!0,onCommit:D=>v("fg",D)}),u.jsx(Gt,{id:"radiusPx",value:x.radiusPx??s.radiusPx,min:0,dragStep:.5,onCommit:D=>v("radiusPx",D)}),u.jsx(Ga,{id:"fontDisplay",value:x.fontDisplay??s.fontDisplay,isColor:!1,onCommit:D=>v("fontDisplay",D)})]}),u.jsxs("div",{style:ot,children:[u.jsx("span",{style:Ke,children:"Captions"}),u.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,color:"#EDEDF2",cursor:"pointer"},children:[u.jsx("input",{type:"checkbox","data-testid":"captions-visible-toggle",checked:o.doc.captionsHidden!==!0&&f!==!0,disabled:f===!0&&o.doc.captionsHidden!==!0,onChange:D=>o.setCaptionsHidden(!D.target.checked)}),"Show captions"]}),o.doc.captionsHidden===!0?u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Hidden everywhere — the CTA keyword styling rides the caption track, so it is hidden too. Per-scene caption position/scale edits are kept."}):null,f===!0?u.jsx("div",{"data-testid":"captions-flag-note",style:{fontSize:12,color:"#FFE14D"},children:"This project was produced with --no-captions, which Render replays — the toggle can't bring captions back here; re-run produce without the flag."}):null]}),y||g?u.jsxs("div",{style:ot,"data-testid":"run-info",children:[u.jsx("span",{style:Ke,children:"This video"}),y?u.jsxs("div",{style:{fontSize:12,color:"#C9C9D4"},children:["planned by ",u.jsx("span",{style:{color:"#EDEDF2"},children:y.provider}),y.models.length>0?` (${y.models.join(", ")})`:"",y.cached?" · reused from cache":"",y.at?` · ${new Date(y.at).toLocaleString()}`:""]}):null,g?u.jsxs("div",{style:{fontSize:12,color:"#C9C9D4"},children:[g.calls," LLM call",g.calls===1?"":"s"," ·"," ",g.inputTokens.toLocaleString()," in / ",g.outputTokens.toLocaleString()," out tokens",g.anyEstimated?" (partly estimated)":""]}):null,g&&g.equivalentUsd!==null?u.jsx("div",{style:{fontSize:12,color:"#C9C9D4"},children:g.allUnbilled?`~$${g.equivalentUsd.toFixed(2)} of API-rate work, covered by the subscription`:g.billedUsd!==null?`~$${g.billedUsd.toFixed(2)} charged at API rates`:`~$${g.equivalentUsd.toFixed(2)} at API rates`}):null,w?u.jsxs("div",{style:{fontSize:12,color:"#C9C9D4"},children:["clip: ",k(w.startSec),"–",k(w.endSec),(V=c==null?void 0:c.production)!=null&&V.sourceDuration?` of ${k(c.production.sourceDuration)}`:""," ","(--clip ",w.targetSec,")"]}):null]}):null,u.jsx("div",{style:ot,children:u.jsx("div",{"data-testid":"ai-disclaimer",style:{fontSize:12,color:"#9A9AA3"},children:"AI can make mistakes. The cut, captions and graphics are generated — review them before publishing."})})]})},Gc=1.2,nu=.05;function VA(e,t,n,r){return n<=0||r<=0?0:Math.min(1,Math.max(0,(e-t)/n))*r}const HA=16,UA=e=>Math.min(HA,Math.max(1,e));function ZA(e,t,n,r,o){if(e<=0||n<=0)return 0;const s=(r+o)*(t/e),a=Math.max(0,t*n-n);return Math.min(a,Math.max(0,s-o))}const gh=e=>e.filter(t=>t.kind!=="plain");function KA(e,t,n,r){const o=gh(e),i=o.findIndex(m=>m.id===t),s=o[i];if(!s)return null;const a=s.endSec-s.startSec,l=i>0?o[i-1]:void 0,c=i<o.length-1?o[i+1]:void 0,f=l?l.endSec+nu:0,p=c?c.startSec-nu:r,h=Math.min(Math.max(s.startSec+n,f),Math.max(f,p-a));return{startSec:h,endSec:h+a}}function YA(e,t,n,r,o){const i=gh(e),s=i.findIndex(m=>m.id===t),a=s>0?i[s-1]:void 0,l=s>=0&&s<i.length-1?i[s+1]:void 0,c=a?a.endSec+nu:0,f=l?l.startSec-nu:o;let p=Math.min(Math.max(n,c),Math.max(c,f-Gc)),h=Math.max(Math.min(r,f),p+Gc);return h>f&&(h=f,p=Math.max(c,h-Gc)),{startSec:p,endSec:h}}function gv(e,t,n,r){const o=[0,r,n];for(const a of gh(e))a.id!==t&&o.push(a.startSec,a.endSec);o.sort((a,l)=>a-l);const i=[];let s;for(const a of o)(s===void 0||a-s>1e-6)&&(i.push(a),s=a);return i}function Xa(e,t,n){if(n<=0||t.length===0)return{sec:e,snapped:null};let r=null,o=1/0;for(const i of t){const s=Math.abs(e-i);(s<o||s===o&&r!==null&&i<r)&&(r=i,o=s)}return r===null||o>n?{sec:e,snapped:null}:{sec:r,snapped:r}}function Pb(e,t){if(e.length===0)return 0;for(const r of e)if(t>=r.srcIn&&t<=r.srcOut)return r.outIn+(t-r.srcIn);let n=0;for(const r of e)if(r.srcOut<=t)n=r.outOut;else if(r.srcIn>=t)return r.outIn;return n}function Xc(e,t){const n=Math.max(0,e);if(t<=0)return`${n.toFixed(1)}s`;const r=Math.floor(n),o=Math.floor(r/60),i=r%60,s=Math.floor((n-r)*t),a=String(Math.max(1,Math.ceil(t)-1)).length;return`${o}:${String(i).padStart(2,"0")}:${String(s).padStart(a,"0")}`}const vh={silence:"#4DA3FF",pause:"#B78CFF",filler:"#FFB84D",retake:"#FF7AB8",user:"#6BDD8B",clip:"#4DDCD4"},GA="#8a8a95";function XA(e){const t=`${(e.srcOut-e.srcIn).toFixed(1)}s removed`;return e.reason?`${e.reason} · ${t}`:t}const qA=1e-6;function QA(e,t,n){if(t.length===0)return[];const r=new Set(nb(e,n)),o=[];for(const i of e){if(i.kind!=="remove"||i.srcOut<=i.srcIn)continue;const s=Pb(t,i.srcIn),a=o.filter(l=>Math.abs(l.outSec-s)<qA).length;o.push({srcIn:i.srcIn,srcOut:i.srcOut,reason:i.reason,outSec:s,label:XA(i),color:i.reason?vh[i.reason]:GA,stackIndex:a,vetoable:ph(i.reason),vetoed:r.has(i)})}return o}const JA={silence:"Silences",pause:"Pauses",filler:"Fillers",retake:"Retakes",user:"Your cuts",clip:"Clip window"};function e3(e){const t=new Map;for(const n of e){if(n.kind!=="remove"||n.reason===void 0||!ph(n.reason)||n.srcOut<=n.srcIn)continue;const r=t.get(n.reason)??{reason:n.reason,count:0,seconds:0};r.count+=1,r.seconds+=n.srcOut-n.srcIn,t.set(n.reason,r)}return Object.keys(vh).map(n=>t.get(n)).filter(n=>n!==void 0)}const t3=10,n3=4,vv=8,yv=8,r3=300,o3=e=>{const t=Math.max(0,Math.round(e));return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`},i3=(e,t)=>{const[n,r]=le.useState({}),o=le.useRef({}),i=t.map(s=>s.toFixed(1)).join(",");return le.useEffect(()=>{if(!e||t.length===0)return;const s=[...new Set(t.map(p=>p.toFixed(1)))].filter(p=>o.current[p]===void 0);if(s.length===0)return;let a=!1;const l=document.createElement("video");l.src=e,l.muted=!0,l.preload="auto";const c=document.createElement("canvas");return(async()=>{await new Promise((h,m)=>{l.onloadedmetadata=()=>h(),l.onerror=()=>m(new Error("no video for thumbnails"))}),c.width=168,c.height=Math.max(1,Math.round(168*l.videoHeight/Math.max(1,l.videoWidth)));const p=c.getContext("2d");if(p){for(const h of s){if(a)return;await new Promise(m=>{l.onseeked=()=>m(),l.currentTime=Math.max(0,Number(h))}),p.drawImage(l,0,0,c.width,c.height),o.current[h]=c.toDataURL("image/jpeg",.6)}a||r({...o.current})}})().catch(()=>{}),()=>{a=!0,l.removeAttribute("src"),l.load()}},[e,i]),n},s3=({cues:e,ghosts:t,cuts:n=[],spans:r=[],cleanup:o=[],durationSec:i,fps:s,playerRef:a,selection:l,onSelect:c,edits:f,videoSrc:p,toSourceSec:h,toLive:m=x=>x})=>{const x=d.useRef(null),v=d.useRef(null),k=d.useRef(!1),g=d.useRef(null),[y,w]=d.useState(0),b=d.useRef(y);b.current=y;const[S,E]=d.useState(null),[T,I]=d.useState(1),R=le.useMemo(()=>h?e.filter(C=>C.kind==="plain").map(C=>h((C.startSec+C.endSec)/2)):[],[e,h]),F=i3(p,R),A=d.useRef(null),W=d.useRef(null),M=d.useCallback((C,P)=>{const N=A.current;I(B=>{const z=UA(C);if(z===B||!N)return z;const Z=N.getBoundingClientRect();return W.current={prevZoom:B,anchorX:P!==void 0?P-Z.left:Z.width/2},z})},[]);d.useLayoutEffect(()=>{const C=A.current,P=W.current;!C||!P||(W.current=null,C.scrollLeft=ZA(P.prevZoom,T,C.clientWidth,C.scrollLeft,P.anchorX))},[T]);const $=d.useRef(T);$.current=T,d.useEffect(()=>{const C=A.current;if(!C)return;const P=N=>{N.ctrlKey||N.metaKey?(N.preventDefault(),M($.current*Math.exp(-N.deltaY*.01),N.clientX)):C.scrollWidth>C.clientWidth&&(N.preventDefault(),C.scrollLeft+=N.deltaY+N.deltaX)};return C.addEventListener("wheel",P,{passive:!1}),()=>C.removeEventListener("wheel",P)},[M]),d.useEffect(()=>{const C=a.current;if(!C)return;w(C.getCurrentFrame());const P=N=>w(N.detail.frame);return C.addEventListener("frameupdate",P),()=>C.removeEventListener("frameupdate",P)},[a]),d.useEffect(()=>{const C=A.current;if(!C||i<=0||C.scrollWidth<=C.clientWidth)return;const P=y/s/i*C.scrollWidth,{scrollLeft:N,clientWidth:B}=C;(P<N||P>N+B)&&(C.scrollLeft=Math.max(0,Math.min(C.scrollWidth-B,P-B*.1)))},[y,s,i]),d.useEffect(()=>{var P,N;if(!l)return;const C=(P=A.current)==null?void 0:P.querySelector(`[data-testid="timeline-block-${l.sceneId}"]`);(N=C==null?void 0:C.scrollIntoView)==null||N.call(C,{inline:"nearest",block:"nearest"})},[l]);const V=d.useCallback(C=>{var B;const P=x.current;if(!P||i<=0)return;const N=P.getBoundingClientRect();(B=a.current)==null||B.seekTo(Math.round(VA(C,N.left,N.width,i)*s))},[a,i,s]),D=d.useCallback((C,P)=>N=>{N.stopPropagation(),N.preventDefault();const B=x.current;B&&(v.current={sceneId:C.id,edge:P,startContentX:N.clientX-B.getBoundingClientRect().left,origStart:C.startSec,origEnd:C.endSec},E({sceneId:C.id,startSec:C.startSec,endSec:C.endSec,snapped:null}))},[]),L=d.useRef(0);d.useEffect(()=>{const C=B=>{const z=A.current;if(!z||z.scrollWidth<=z.clientWidth)return;const Z=Date.now();if(Z-L.current<r3)return;const H=z.getBoundingClientRect(),G=z.scrollWidth-z.clientWidth;B>=H.right-yv&&z.scrollLeft<G?(z.scrollLeft=Math.min(G,z.scrollLeft+z.clientWidth),L.current=Z):B<=H.left+yv&&z.scrollLeft>0&&(z.scrollLeft=Math.max(0,z.scrollLeft-z.clientWidth),L.current=Z)},P=B=>{var Se;if((k.current||((Se=g.current)==null?void 0:Se.moved)===!0||v.current!==null)&&C(B.clientX),k.current){V(B.clientX);return}const Z=g.current;if(Z&&i>0){if(!Z.moved&&Math.abs(B.clientX-Z.startX)<n3)return;if(Z.moved=!0,Z.scrub){V(B.clientX);return}const de=x.current,K=de==null?void 0:de.getBoundingClientRect(),ee=K?(B.clientX-K.left-Z.startContentX)/K.width*i:0;let ue=ee,se=null;const Re=K&&K.width>0&&!B.altKey?e.find(ze=>ze.id===Z.sceneId):void 0;if(Re&&K){const ze=vv/(K.width/i),Je=gv(e,Z.sceneId,b.current/s,i),ke=Re.startSec+ee,Ee=Re.endSec+ee,je=Xa(ke,Je,ze),_e=Xa(Ee,Je,ze),Le=je.snapped===null?1/0:Math.abs(je.sec-ke),dt=_e.snapped===null?1/0:Math.abs(_e.sec-Ee);Le<=dt&&je.snapped!==null?(ue=ee+(je.sec-ke),se=je.snapped):_e.snapped!==null&&(ue=ee+(_e.sec-Ee),se=_e.snapped)}const Ie=KA(e,Z.sceneId,ue,i);if(Ie){const ze=se!==null&&(Math.abs(Ie.startSec-se)<1e-6||Math.abs(Ie.endSec-se)<1e-6)?se:null;E({sceneId:Z.sceneId,...Ie,snapped:ze})}return}const H=v.current;if(!H||i<=0)return;const G=x.current;if(!G)return;const O=G.getBoundingClientRect(),X=(B.clientX-O.left-H.startContentX)/O.width*i;let ae=H.edge==="start"?H.origStart+X:H.origStart,oe=H.edge==="end"?H.origEnd+X:H.origEnd,Y=null;if(!B.altKey&&O.width>0){const de=vv/(O.width/i),K=gv(e,H.sceneId,b.current/s,i);if(H.edge==="start"){const ee=Xa(ae,K,de);ae=ee.sec,Y=ee.snapped}else{const ee=Xa(oe,K,de);oe=ee.sec,Y=ee.snapped}}const q=YA(e,H.sceneId,ae,oe,i),xe=Y!==null&&(Math.abs(q.startSec-Y)<1e-6||Math.abs(q.endSec-Y)<1e-6)?Y:null;E({sceneId:H.sceneId,...q,snapped:xe})},N=B=>{k.current=!1;const z=g.current;if(z){g.current=null,z.moved&&!z.scrub&&E(H=>(H&&H.sceneId===z.sceneId&&f.patchTiming(z.sceneId,H.startSec,H.endSec),null));return}const Z=v.current;Z&&(E(H=>(H&&H.sceneId===Z.sceneId&&(H.startSec!==Z.origStart||H.endSec!==Z.origEnd)&&f.patchTiming(Z.sceneId,H.startSec,H.endSec),null)),v.current=null)};return window.addEventListener("mousemove",P),window.addEventListener("mouseup",N),()=>{window.removeEventListener("mousemove",P),window.removeEventListener("mouseup",N)}},[e,i,f,V,s]);const j=i>0?Math.min(1,y/s/i)*100:0;return u.jsxs("div",{style:a3,onMouseDownCapture:jb,children:[u.jsxs("div",{style:l3,children:[u.jsx("span",{style:c3,children:"ctrl+scroll to zoom"}),u.jsx("button",{"data-testid":"zoom-out",style:qc,onClick:()=>M(T/2),disabled:T<=1,title:"Zoom out (ctrl/cmd + scroll on the timeline)",children:"−"}),u.jsxs("span",{"data-testid":"zoom-level",style:u3,children:[Math.round(T*10)/10,"×"]}),u.jsx("button",{"data-testid":"zoom-in",style:qc,onClick:()=>M(T*2),disabled:T>=16,title:"Zoom in (ctrl/cmd + scroll on the timeline)",children:"+"}),u.jsx("button",{"data-testid":"zoom-fit",style:{...qc,width:"auto",padding:"0 8px"},onClick:()=>M(1),disabled:T<=1,title:"Fit the whole clip in view",children:"fit"})]}),u.jsx("div",{ref:A,"data-testid":"timeline-scroller",style:d3,children:u.jsxs("div",{style:{width:`${T*100}%`,minWidth:"100%",paddingBottom:6},children:[u.jsx("div",{"data-testid":"ruler",style:f3,onMouseDown:C=>{C.preventDefault(),V(C.clientX),k.current=!0},children:(()=>{var H;if(i<=0)return u.jsx("span",{style:Qc,children:"0:00"});const P=(((H=A.current)==null?void 0:H.clientWidth)??1200)*T/i;let B=[.5,1,2,5,10,15,30,60,120,300,600].find(G=>G*P>=70)??600;for(;i/(B/5)>600;)B*=2;const z=B/5,Z=[];for(let G=0;G<=i+1e-6;G+=z){const O=Math.round(G/z)%5===0,X=`${G/i*100}%`;Z.push(u.jsx("div",{style:{position:"absolute",left:X,bottom:0,width:1,height:O?8:4,background:O?"#3A3A44":"#26262e",pointerEvents:"none"}},G.toFixed(3))),O&&G+z<=i&&Z.push(u.jsx("span",{style:{...Qc,position:"absolute",left:X,top:0,transform:G===0?void 0:"translateX(-50%)",pointerEvents:"none"},children:o3(G)},`l${G.toFixed(3)}`))}return u.jsxs(u.Fragment,{children:[Z,u.jsx("span",{style:{...Qc,position:"absolute",right:2,top:0,pointerEvents:"none"},children:Xc(i,s)})]})})()}),u.jsxs("div",{ref:x,style:p3,onMouseDown:C=>{C.preventDefault(),V(C.clientX),k.current=!0},children:[e.map(C=>{const P=C.kind==="plain",N=(S==null?void 0:S.sceneId)===C.id,B=N?S.startSec:C.startSec,z=N?S.endSec:C.endSec,Z=i>0?B/i*100:0,H=i>0?Math.max(0,(z-B)/i*100):0,G=(l==null?void 0:l.sceneId)===C.id,O=P&&h?F[h((C.startSec+C.endSec)/2).toFixed(1)]:void 0;return u.jsxs("div",{"data-testid":`timeline-block-${C.id}`,onMouseDown:X=>{var ae;X.stopPropagation(),X.preventDefault(),c({sceneId:C.id,elementId:null}),g.current={sceneId:C.id,startX:X.clientX,startContentX:X.clientX-(((ae=x.current)==null?void 0:ae.getBoundingClientRect().left)??0),moved:!1,scrub:P}},style:{...wv,left:`${Z}%`,width:`${H}%`,zIndex:N?4:G?3:1,border:G?"2px solid #5b8cff":P?"1px solid #22222a":"1px solid #2A2A33",backgroundColor:G?"#1c2333":P?"#131318":"#1A1A21",...O?{backgroundImage:`linear-gradient(rgba(10,10,14,0.35), rgba(10,10,14,0.6)), url(${O})`,backgroundSize:"auto 100%, auto 100%",backgroundRepeat:"repeat-x"}:{}},children:[u.jsx("span",{style:P?O?{...qa,color:"#D8D8DE",textShadow:"0 1px 2px rgba(0,0,0,0.9)"}:{...qa,color:"#55555f"}:qa,children:C.id}),!P&&C.pinned?u.jsx("span",{style:h3,children:"PIN"}):null,P?null:u.jsxs(u.Fragment,{children:[u.jsx("div",{onMouseDown:D(C,"start"),style:{...bv,left:0,cursor:"ew-resize"}}),u.jsx("div",{onMouseDown:D(C,"end"),style:{...bv,right:0,cursor:"ew-resize"}})]})]},C.id)}),t.map(C=>{const P=i>0?C.startSec/i*100:0,N=i>0?Math.max(0,(C.endSec-C.startSec)/i*100):0,B=(l==null?void 0:l.sceneId)===C.id;return u.jsx("div",{"data-testid":`timeline-block-${C.id}`,onMouseDown:z=>{z.stopPropagation(),z.preventDefault(),c({sceneId:C.id,elementId:null})},style:{...wv,left:`${P}%`,width:`${N}%`,zIndex:B?3:2,border:B?"2px dashed #5b8cff":"1px dashed #6a6a75",background:"transparent"},children:u.jsx("span",{style:{...qa,color:"#6a6a75",textDecoration:"line-through"},children:C.id})},`ghost-${C.id}`)}),n.map((C,P)=>{const N=z=>i>0?Math.min(100,Math.max(0,z/i*100)):0;if(!C.src){const z=Math.min(Math.max(m(C.startSec),0),i),Z=Math.min(Math.max(m(C.endSec),0),i),H=N(z),G=i>0?Math.max(0,(Z-z)/i*100):0;return u.jsx("div",{"data-testid":`timeline-cut-${C.startSec}-${C.endSec}`,style:{...m3,left:`${H}%`,width:`${G}%`},children:u.jsx("div",{style:g3})},`cut-${P}-${C.startSec}-${C.endSec}`)}if(r.length===0)return null;const B=N(Pb(r,C.src.startSec));return u.jsx("div",{"data-testid":`timeline-cut-seam-${C.startSec}-${C.endSec}`,title:"Restore cut — the material returns on the next produce/Render",onMouseDown:z=>{z.stopPropagation(),z.preventDefault(),f.restoreChunk(P)},style:{...v3,left:`${B}%`},children:u.jsx("div",{style:y3})},`cut-${P}-${C.startSec}-${C.endSec}`)}),QA(o,r,f.doc.cleanup).map(C=>{const P=i>0?Math.min(100,Math.max(0,C.outSec/i*100)):0,N=C.vetoed?`${C.label} — declined: kept, playing in the preview (click to re-remove)`:C.vetoable?`${C.label} — click to keep this; the preview updates immediately`:C.label;return u.jsx("div",{"data-testid":`timeline-removal-${C.srcIn}-${C.srcOut}`,...C.vetoed?{"data-vetoed":"true"}:{},title:N,...C.vetoable?{onMouseDown:B=>{B.stopPropagation(),B.preventDefault(),f.toggleKept(C.srcIn,C.srcOut)}}:{},style:{...w3,...C.vetoable?{cursor:"pointer"}:{},left:`${P}%`,marginLeft:-3+C.stackIndex*7},children:u.jsx("div",{style:C.vetoed?{...xv,background:"transparent",border:`1px solid ${C.color}`,opacity:.55}:{...xv,background:C.color}})},`removal-${C.srcIn}-${C.srcOut}`)}),S?u.jsxs("div",{"data-testid":"drag-readout",style:{...Sv,left:`${i>0?S.startSec/i*100:0}%`,transform:i>0&&S.startSec/i>.85?"translateX(-100%)":Sv.transform},children:[Xc(S.startSec,s)," – ",Xc(S.endSec,s)]}):null,(S==null?void 0:S.snapped)!==null&&(S==null?void 0:S.snapped)!==void 0?u.jsx("div",{"data-testid":"snap-tick",style:{...x3,left:`${i>0?S.snapped/i*100:0}%`}}):null,u.jsx("div",{"data-testid":"playhead",style:{...b3,left:`${j}%`},children:u.jsx("div",{"data-testid":"playhead-grab",onMouseDown:C=>{C.stopPropagation(),C.preventDefault(),k.current=!0},style:S3})})]})]})})]})},a3={flexShrink:0,borderTop:"1px solid #1E1E24",background:"#111116",padding:"6px 20px 8px"},l3={display:"flex",justifyContent:"flex-end",alignItems:"center",gap:6,marginBottom:4},qc={width:22,height:18,fontSize:12,lineHeight:1,color:"#EDEDF2",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:4,cursor:"pointer",padding:0},u3={fontSize:10,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#9A9AA3",minWidth:26,textAlign:"center"},c3={fontSize:10,color:"#55555f",marginRight:4,userSelect:"none"},d3={overflowX:"auto",overflowY:"hidden"},f3={position:"relative",height:18,padding:"0 2px",marginBottom:4,borderBottom:"1px solid #1E1E24",cursor:"ew-resize",userSelect:"none"},Qc={fontSize:10,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#9A9AA3"},p3={position:"relative",height:44,background:"#0F0F14",border:"1px solid #2A2A33",borderRadius:6,overflow:"visible",userSelect:"none"},wv={position:"absolute",top:3,bottom:3,borderRadius:4,boxSizing:"border-box",cursor:"pointer",display:"flex",alignItems:"center",overflow:"hidden"},qa={fontSize:10,fontFamily:"ui-monospace, 'SF Mono', monospace",textTransform:"uppercase",letterSpacing:"0.04em",color:"#9A9AA3",padding:"0 8px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",pointerEvents:"none"},h3={position:"absolute",top:3,right:3,fontSize:9,fontFamily:"ui-monospace, 'SF Mono', monospace",letterSpacing:"0.04em",textTransform:"uppercase",color:"#0B0B0E",background:"#ffe14d",padding:"1px 5px",borderRadius:3,pointerEvents:"none"},m3={position:"absolute",top:3,bottom:3,zIndex:3,pointerEvents:"none",borderRadius:4,border:"1px solid rgba(255,92,92,0.6)",background:"repeating-linear-gradient(135deg, rgba(255,92,92,0.22), rgba(255,92,92,0.22) 6px, transparent 6px, transparent 12px)"},g3={position:"absolute",left:0,right:0,top:"50%",height:2,background:"rgba(255,92,92,0.8)"},v3={position:"absolute",top:-4,bottom:-4,width:12,marginLeft:-6,zIndex:4,cursor:"pointer",pointerEvents:"auto"},y3={position:"absolute",left:"50%",top:0,bottom:0,width:2,background:"#FF5C5C",pointerEvents:"none"},w3={position:"absolute",top:-4,bottom:-4,width:6,marginLeft:-3,zIndex:3,pointerEvents:"auto"},xv={position:"absolute",left:"50%",top:0,bottom:0,width:2,pointerEvents:"none"},bv={position:"absolute",top:0,bottom:0,width:t3},x3={position:"absolute",top:-4,bottom:-4,width:1,zIndex:6,background:"#FFE14D",pointerEvents:"none"},Sv={position:"absolute",bottom:"100%",marginBottom:3,transform:"translateX(-4px)",whiteSpace:"nowrap",fontSize:10,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#0B0B0E",background:"#FFE14D",padding:"1px 5px",borderRadius:3,zIndex:6,pointerEvents:"none"},b3={position:"absolute",top:-26,bottom:-4,width:2,zIndex:5,background:"#FFE14D",pointerEvents:"none"},S3={position:"absolute",top:0,bottom:0,left:-4,width:10,pointerEvents:"auto",cursor:"ew-resize"};function k3(e,t,n){const r=e.filter(h=>Ue(h.word)!==null);if(r.length===0)return null;const o=e[0].word,i=e[e.length-1].word,s=Math.max(o.start,t??0),a=i.end;if(a<=s)return null;const l=[];e.every(h=>{const m=Ue(h.word);return m!==null&&m in n.captionWordsHidden})||l.push("caption");const f=n.cuts.some(h=>h.src===void 0&&h.startSec===s&&h.endSec===a),p=e.some(h=>h.synthetic);return!f&&!p&&l.push("caption-video"),l.length===0?null:{startSec:s,endSec:a,words:r.map(h=>({srcStart:h.word.srcStart,was:h.live})),targets:l}}function E3(e,t,n,r){const o=n-t+1;if(o<=0||t<0||n>=e.length)return[];const i=f=>f.map(p=>p.live).join(" ").normalize("NFC"),s=e.slice(t,n+1),a=i(s),l=o===1?Ue(s[0].word):null,c=[];for(let f=0;f+o<=e.length;){if(f>t-o&&f<=n){f=n+1;continue}const p=e.slice(f,f+o),h=p.every(x=>Ue(x.word)!==null&&r(x.word)===void 0),m=l!==null&&Ue(p[0].word)===l;if(h&&!m&&i(p)===a){c.push({fromSrcStart:p[0].word.srcStart,toSrcStart:p[o-1].word.srcStart,was:p.map(x=>x.base).join(" ").normalize("NFC"),rawWas:p.map(x=>x.base).join(" ")}),f+=o;continue}f++}return c}function C3(e,t,n,r,o){const i=Math.max(0,Math.floor(o)),s=new Float32Array(i);if(i===0||!(r>n)||!(t>0)||e.length===0)return{buckets:s,fromSec:n,toSec:r};const a=r-n;for(let l=0;l<i;l++){const c=Math.max(0,Math.ceil((n+a*l/i)*t)),f=Math.min(e.length,Math.ceil((n+a*(l+1)/i)*t));let p=0;for(let h=c;h<f;h++){const m=Math.abs(e[h]);m>p&&(p=m)}s[l]=p}return{buckets:s,fromSec:n,toSec:r}}const ao=280,an=48,Qa=1;let Ja=null;const I3=e=>((Ja===null||Ja.key!==e)&&(Ja={key:e,promise:(async()=>{if(typeof AudioContext>"u"||typeof fetch>"u")return null;const t=await fetch("/media/audio.wav");if(!t.ok)return null;const n=await t.arrayBuffer(),r=new AudioContext;try{const o=await r.decodeAudioData(n);return{channel:o.getChannelData(0).slice(),sampleRate:o.sampleRate}}finally{r.close()}})().catch(()=>null)}),Ja.promise),kv=6,Ev=8,T3=e=>{const t=e.anchorTop+e.anchorHeight+kv,n=e.anchorTop-e.menuH-kv,o=t+e.menuH<=e.scrollTop+e.clientHeight||n<e.scrollTop?t:n,i=e.anchorLeft+e.anchorWidth/2-e.menuW/2,s=Math.max(Ev,Math.min(i,e.clientWidth-e.menuW-Ev));return{top:o,left:s}},Cv="transcript-word-",Iv=e=>{var o;if(e===null)return null;const t=e.nodeType===3?e.parentElement:e,n=((o=t==null?void 0:t.closest)==null?void 0:o.call(t,`[data-testid^="${Cv}"]`))??null;if(n===null)return null;const r=Number(n.getAttribute("data-testid").slice(Cv.length));return Number.isInteger(r)?r:null},R3=e=>({lo:e.prev===null?e.track.start:e.prev.end===e.span.start?e.prev.start+Jl:e.prev.end,hi:e.next===null?e.track.end:e.next.start===e.span.end?e.next.end-Jl:e.next.start}),j3=(e,t,n)=>{const r=Math.min(Math.max(e.start,t),n);return{start:r,end:Math.min(Math.max(e.end,r),n)}},P3=e=>{if(e.edge==="band"){const t=Math.min(Math.max(e.dSec,e.lo-e.span.start),e.hi-e.span.end);return{start:e.span.start+t,end:e.span.end+t}}return e.edge==="lead"?{start:Math.min(Math.max(e.span.start+e.dSec,e.lo),Math.min(e.hi,e.span.end)),end:e.span.end}:{start:e.span.start,end:Math.max(Math.min(e.span.end+e.dSec,e.hi),Math.max(e.lo,e.span.start))}},F3=e=>{const t=e.span.end-e.span.start,n=t>0?(e.newSpan.end-e.newSpan.start)/t:1,r=i=>e.newSpan.start+(i-e.span.start)*n,o=e.lines.map(i=>({srcStart:i.srcStart,lead:r(i.start)-i.start,tail:r(i.end)-i.end}));return e.prev!==null&&e.prev.end===e.span.start&&o.unshift({srcStart:e.prev.srcStart,lead:e.prev.lead,tail:e.newSpan.start-e.prev.end}),e.next!==null&&e.next.start===e.span.end&&o.push({srcStart:e.next.srcStart,lead:e.newSpan.end-e.next.start,tail:e.next.tail}),o},el=(e,t)=>{const n=e[t],r=n==null?void 0:n.words[0],o=Ue(r);if(!n||!r||o===null)return null;const i=n.words[n.words.length-1];return{key:o,srcStart:r.srcStart,start:n.start,end:n.end,srcEnd:Number.isFinite(i.srcStart)?i.srcStart+(i.end-i.start):r.srcStart+(n.end-n.start)}},_3=(e,t)=>{const n=[];let r=0;for(const o of e){const i=new Set(o.words.map(l=>Ue(l)).filter(l=>l!==null)),s=t[r],a=l=>{const c=Ue(l);return c!==null&&i.has(c)};s!==void 0&&s.words.some(a)?(n.push(r),r++):n.push(null)}return n},M3=({baseLines:e,liveLines:t,timingLines:n,fps:r,playerRef:o,edits:i,onDeleteWords:s,width:a,workdir:l,toPlayerSec:c=p=>p,fromPlayerSec:f=p=>p})=>{const[p,h]=d.useState(""),[m,x]=d.useState(null),[v,k]=d.useState(null),[g,y]=d.useState(null),[w,b]=d.useState(null),[S,E]=d.useState(!1),T=d.useRef(null),[I,R]=d.useState(null),[F,A]=d.useState(null),[W,M]=d.useState(null),[$,V]=d.useState(!1),[D,L]=d.useState(null),[j,C]=d.useState(!1),P=d.useRef(null),N=d.useRef(null),B=d.useMemo(()=>{const _=new Map;for(const U of e)for(const re of U.words){const fe=Ue(re);if(fe===null)continue;const we=_.get(fe);we?we.push(re.text):_.set(fe,[re.text])}return _},[e]),z=d.useMemo(()=>{var fe;const _=[];let U=0;const re=new Map;for(let we=0;we<t.length;we++){const be=t[we];for(let Pe=0;Pe<be.words.length;Pe++){const Me=be.words[Pe],Ve=Ue(Me);let De;if(Ve!==null){const ge=re.get(Ve)??0;re.set(Ve,ge+1),De=(fe=B.get(Ve))==null?void 0:fe[ge]}_.push({index:U,base:De??Me.text,live:Me.text,synthetic:Ve!==null&&De===void 0,start:Me.start,end:Me.end,lineIndex:we,word:Me}),U++}}return _},[B,t]);d.useEffect(()=>{k(null),y(null)},[z.length]);const Z=d.useMemo(()=>new Set(Object.keys(i.doc.captionWordsHidden)),[i.doc.captionWordsHidden]),H=_=>{const U=Ue(_.word);return U!==null&&Z.has(U)},G=d.useMemo(()=>fh(z.map(_=>_.live).join(" ")),[z]);d.useEffect(()=>{if(G!=="rtl"||typeof FontFace>"u"||!document.fonts)return;let _=!1;for(const U of document.fonts)U.family===Ks&&(_=!0);if(!_)try{new FontFace(Ks,`url("/media/${eb}") format("truetype")`).load().then(re=>document.fonts.add(re),()=>{})}catch{}},[G]),d.useEffect(()=>{const _=o.current;if(!_)return;const U=re=>{const fe=f(re.detail.frame/r),we=z.find(be=>fe>=be.start&&fe<be.end);M(be=>we?we.index===be?be:we.index:be)};return _.addEventListener("frameupdate",U),()=>_.removeEventListener("frameupdate",U)},[o,r,z,f]),d.useEffect(()=>{var _,U,re;W!==null&&((re=(U=(_=P.current)==null?void 0:_.querySelector(`[data-testid="transcript-word-${W}"]`))==null?void 0:U.scrollIntoView)==null||re.call(U,{block:"nearest"}))},[W]);const O=p.trim().normalize("NFC").toLowerCase(),X=d.useMemo(()=>O?z.filter(_=>_.live.normalize("NFC").toLowerCase().includes(O)).map(_=>_.index):[],[O,z]),ae=d.useMemo(()=>O?new Set(X):null,[O,X]),[oe,Y]=d.useState(0),q=_=>{var U,re,fe;(fe=(re=(U=P.current)==null?void 0:U.querySelector(`[data-testid="transcript-word-${_}"]`))==null?void 0:re.scrollIntoView)==null||fe.call(re,{block:"center"})};d.useEffect(()=>{Y(0),X.length>0&&q(X[0])},[X]);const xe=_=>{if(X.length===0)return;const U=(oe+_+X.length)%X.length;Y(U),q(X[U])},Se=_=>{const U=_.draft.trim();U&&i.patchCaption(_.srcStart,U,_.base),x(null)},de=_=>{Ue(_.word)!==null&&K(_.word)===void 0&&x({index:_.index,draft:_.live,srcStart:_.word.srcStart,base:_.base})},K=_=>{const U=Ue(_);if(U===null)return;const re=Number(U.slice(1));return i.doc.captionRangeEdits.find(fe=>{const we=Number(fe.fromKey.slice(1)),be=Number(fe.toKey.slice(1));return re>=Math.min(we,be)&&re<=Math.max(we,be)})},ee=v===null?null:Math.min(v.anchor,v.focus),ue=v===null?null:Math.max(v.anchor,v.focus),se=ee===null||ue===null?[]:z.slice(ee,ue+1),Re=se.length>0&&se.every(H),Ie=se.some(_=>Ue(_.word)===null),ze=se.map(_=>K(_.word)).find(_=>_!==void 0),Je=_=>{var Ve,De,ge;if(m!==null||g!==null||w!==null)return;const U=P.current;if(!U)return;const re=(Ve=document.getSelection)==null?void 0:Ve.call(document);if(!re||re.isCollapsed)return;const{anchorNode:fe,focusNode:we}=re;if(!fe||!we||!U.contains(fe)||!U.contains(we))return;const be=we.nodeType===3?we.parentElement:we;if((De=be==null?void 0:be.closest)!=null&&De.call(be,"input, textarea"))return;const Pe=Iv(fe),Me=Iv(we);Pe===null||Me===null||_.detail>=2&&Pe===Me||(k({anchor:Math.min(Pe,Me),focus:Math.max(Pe,Me)}),(ge=re.removeAllRanges)==null||ge.call(re))};d.useLayoutEffect(()=>{if(ee===null||ue===null){L(null);return}const _=P.current,U=(_==null?void 0:_.querySelector(`[data-testid="transcript-word-${ee}"]`))??null,re=(_==null?void 0:_.querySelector(`[data-testid="transcript-word-${ue}"]`))??null;if(!_||re===null){L(null);return}const fe=U!==null&&U.offsetTop===re.offsetTop,we=fe?Math.min(U.offsetLeft,re.offsetLeft):re.offsetLeft,be=fe?Math.max(U.offsetLeft+U.offsetWidth,re.offsetLeft+re.offsetWidth):re.offsetLeft+re.offsetWidth,Pe=N.current,Me=T3({anchorTop:re.offsetTop,anchorHeight:re.offsetHeight,anchorLeft:we,anchorWidth:be-we,menuW:(Pe==null?void 0:Pe.offsetWidth)??0,menuH:(Pe==null?void 0:Pe.offsetHeight)??0,scrollTop:_.scrollTop,clientWidth:_.clientWidth,clientHeight:_.clientHeight});L(Ve=>Ve!==null&&Ve.top===Me.top&&Ve.left===Me.left?Ve:Me)},[ee,ue,a,m,g,w,D]),d.useEffect(()=>{C(!1),b(null)},[ee,ue]),d.useEffect(()=>{g!==null&&(ee!==g.selLo||ue!==g.selHi)&&y(null)},[g,ee,ue]);const ke=d.useMemo(()=>g!==null&&ee!==null&&ue!==null?E3(z,ee,ue,K):[],[g,ee,ue,z,i.doc.captionRangeEdits]),Ee=()=>{if(se.length===0||Ie)return;const _=k3(se.map(U=>({word:U.word,live:U.live,synthetic:U.synthetic})),ee!==null&&ee>0?z[ee-1].end:null,i.doc);_!==null&&(s(_),k(null))},je=()=>{if(se.length===0||Ie)return;const _=ze;if(_!==void 0){const U=Math.min(Number(_.fromKey.slice(1)),Number(_.toKey.slice(1))),re=Math.max(Number(_.fromKey.slice(1)),Number(_.toKey.slice(1))),fe=z.filter(we=>{const be=Ue(we.word);if(be===null)return!1;const Pe=Number(be.slice(1));return Pe>=U&&Pe<=re});if(fe.length===0)return;k({anchor:fe[0].index,focus:fe[fe.length-1].index}),y({draft:fe.map(we=>we.live).join(" ").normalize("NFC"),fromSrcStart:Number(_.fromKey.slice(1))/1e3,toSrcStart:Number(_.toKey.slice(1))/1e3,was:fe.map(we=>we.base).join(" ").normalize("NFC"),rawWas:fe.map(we=>we.base).join(" "),covered:!0,selLo:fe[0].index,selHi:fe[fe.length-1].index});return}y({draft:se.map(U=>U.live).join(" ").normalize("NFC"),fromSrcStart:se[0].word.srcStart,toSrcStart:se[se.length-1].word.srcStart,was:se.map(U=>U.base).join(" ").normalize("NFC"),rawWas:se.map(U=>U.base).join(" "),covered:!1,selLo:ee,selHi:ue})},_e=_=>{const U=_.draft.trim();if(U){const re=U.split(/\s+/).filter(Boolean);!_.covered&&_.fromSrcStart===_.toSrcStart&&re.length===1?i.patchCaption(_.fromSrcStart,U,_.rawWas):i.patchCaptionRange(_.fromSrcStart,_.toSrcStart,U,_.was),k(null)}y(null)},Le=_=>{const U=_.draft.trim();if(U){const re=U.split(/\s+/).filter(Boolean);!_.covered&&_.fromSrcStart===_.toSrcStart&&re.length===1?i.patchCaptionAllOccurrences([{srcStart:_.fromSrcStart,was:_.rawWas},...ke.map(fe=>({srcStart:fe.fromSrcStart,was:fe.rawWas}))],U):i.patchCaptionRangeAllOccurrences([{fromSrcStart:_.fromSrcStart,toSrcStart:_.toSrcStart,was:_.was},...ke],U),k(null)}y(null)},dt=()=>{se.length===0||Ie||(i.hideCaptionWords(se.filter(_=>!H(_)).map(_=>({srcStart:_.word.srcStart,was:_.live}))),k(null))},Zt=()=>{se.length!==0&&(i.restoreCaptionWords(se.filter(H).map(_=>_.word.srcStart)),k(null))},hn=d.useMemo(()=>_3(t,n),[t,n]),Un=_=>{var fe;const U=hn[_]??null;if(U===null)return;const re=Ue((fe=n[U])==null?void 0:fe.words[0]);return re===null?void 0:i.doc.captionLineTiming[re]},_t=se.length===0?0:se[se.length-1].lineIndex-se[0].lineIndex+1,Zn=()=>{var Ve,De;if(se.length===0||Ie)return;const _=n,U=hn[se[0].lineIndex]??null,re=hn[se[se.length-1].lineIndex]??null;if(U===null||re===null)return;const fe=[];for(let ge=U;ge<=re;ge++){const Ce=el(_,ge);if(Ce===null)return;fe.push(Ce)}const we=fe[0],be=fe[fe.length-1],Pe={start:we.start,end:be.end},Me=R3({prev:U>0?_[U-1]:null,next:re<_.length-1?_[re+1]:null,span:Pe,track:{start:_[0].start,end:_[_.length-1].end}});b({track:_,from:U,to:re,span:Pe,bounds:Me,newSpan:j3({start:Pe.start+(((Ve=i.doc.captionLineTiming[we.key])==null?void 0:Ve.lead)??0),end:Pe.end+(((De=i.doc.captionLineTiming[be.key])==null?void 0:De.tail)??0)},Me.lo,Me.hi)})},Kt=d.useMemo(()=>{if(w===null)return null;const _=[];for(let U=w.from;U<=w.to;U++){const re=el(w.track,U);if(re===null)return null;_.push(re)}return{lines:_,prev:w.from>0?el(w.track,w.from-1):null,next:w.to<w.track.length-1?el(w.track,w.to+1):null}},[w]),mn=d.useMemo(()=>{var we,be;if(w===null||Kt===null)return null;const{lines:_,prev:U,next:re}=Kt,fe=i.doc.captionLineTiming;return F3({lines:_,span:w.span,newSpan:w.newSpan,prev:U===null?null:{...U,lead:((we=fe[U.key])==null?void 0:we.lead)??0},next:re===null?null:{...re,tail:((be=fe[re.key])==null?void 0:be.tail)??0}})},[w,Kt,i.doc.captionLineTiming]),Yt=d.useMemo(()=>{if(w===null||mn===null)return null;const _={...i.doc.captionLineTiming};for(const U of mn)_[bn(U.srcStart)]={lead:U.lead,tail:U.tail};return X1(w.track,_).lines},[w,mn,i.doc.captionLineTiming]),ft=d.useMemo(()=>{if(w===null||Yt===null)return null;const _=Yt[w.from],U=Yt[w.to];return _&&U?{start:_.start,end:U.end}:null},[w,Yt]),gn=w===null?0:w.to-w.from+1,zt=d.useMemo(()=>{if(w===null||Kt===null)return null;const _=Kt.prev??Kt.lines[0],U=Kt.next??Kt.lines[Kt.lines.length-1];return{srcStart:_.srcStart,srcEnd:U.srcEnd,outStart:_.start,dur:U.srcEnd-_.srcStart+2*Qa}},[w,Kt]);d.useEffect(()=>{A(null)},[l]),d.useEffect(()=>{if(w===null||F!==null)return;let _=!1;return I3(l).then(U=>{!_&&U!==null&&A(U)}),()=>{_=!0}},[w,F,l]);const Pn=_=>zt===null?0:(_-zt.outStart+Qa)/zt.dur*ao;d.useEffect(()=>{var Ve;if(w===null||ft===null||Yt===null||zt===null)return;const _=T.current,U=((Ve=_==null?void 0:_.getContext)==null?void 0:Ve.call(_,"2d"))??null;if(!_||!U)return;const re=Pn;U.fillStyle="#0F0F14",U.fillRect(0,0,ao,an);const fe=Math.floor(ao/2),we=F===null?new Float32Array(fe):C3(F.channel,F.sampleRate,zt.srcStart-Qa,zt.srcEnd+Qa,fe).buckets;U.fillStyle="#4a4a58";const be=ao/fe;for(let De=0;De<fe;De++){const ge=Math.max(1,we[De]*(an-4));U.fillRect(De*be,(an-ge)/2,Math.max(1,be-1),ge)}U.fillStyle="rgba(255, 225, 77, 0.06)";for(const De of[w.from-1,w.to+1]){const ge=Yt[De];ge&&U.fillRect(re(ge.start),0,Math.max(1,re(ge.end)-re(ge.start)),an)}const Pe=re(ft.start),Me=re(ft.end);U.fillStyle="rgba(255, 225, 77, 0.18)",U.fillRect(Pe,0,Math.max(1,Me-Pe),an),U.fillStyle="#7a7a88";for(let De=Math.max(0,w.from-1);De<=w.to+1;De++){const ge=Yt[De];ge&&(De!==w.from&&U.fillRect(re(ge.start),0,1,an),De!==w.to&&U.fillRect(re(ge.end),0,1,an))}U.fillStyle="#FFE14D",U.fillRect(Pe-1,0,2,an),U.fillRect(Me-1,0,2,an)},[w,ft,Yt,zt,F]);const Kn=zt===null?0:zt.dur/ao,Fn=w===null||ft===null||zt===null?null:{lead:Pn(ft.start),tail:Pn(ft.end)},Ir=_=>U=>{w!==null&&(U.preventDefault(),R({edge:_,startX:U.clientX,span:w.newSpan}))};d.useEffect(()=>{if(I===null||w===null)return;const _=re=>{b({...w,newSpan:P3({edge:I.edge,span:I.span,dSec:(re.clientX-I.startX)*Kn,lo:w.bounds.lo,hi:w.bounds.hi})})},U=()=>R(null);return window.addEventListener("pointermove",_),window.addEventListener("pointerup",U),window.addEventListener("pointercancel",U),window.addEventListener("blur",U),()=>{window.removeEventListener("pointermove",_),window.removeEventListener("pointerup",U),window.removeEventListener("pointercancel",U),window.removeEventListener("blur",U)}},[I,w,Kn]),d.useEffect(()=>{w===null&&I!==null&&R(null)},[w,I]);const lr=()=>{if(ft===null)return;const _=o.current;if(_){if(S){_.pause(),E(!1);return}_.seekTo(Math.ceil(c(ft.start)*r)),_.play(),E(!0)}};d.useEffect(()=>{if(!S||ft===null)return;const _=o.current;if(!_)return;const U=c(ft.end),re=fe=>{fe.detail.frame/r>=U&&(_.pause(),E(!1))};return _.addEventListener("frameupdate",re),()=>_.removeEventListener("frameupdate",re)},[S,ft,r,o,c]),d.useEffect(()=>{const _=o.current;if(!_)return;const U=()=>E(!1);return _.addEventListener("pause",U),()=>_.removeEventListener("pause",U)}),d.useEffect(()=>{var _;w!==null||!S||((_=o.current)==null||_.pause(),E(!1))},[w,S,o]);const ur=_=>{i.patchCaptionLineTiming(_),b(null)};return u.jsxs("div",{"data-testid":"transcript-panel",style:{...$3,width:a},children:[u.jsxs("div",{style:A3,children:[u.jsx("span",{style:N3,children:"Transcript"}),u.jsxs("div",{style:X3,children:[u.jsx("span",{style:Rv,children:"Click to jump · double-click to retype · drag to select"}),u.jsx("button",{"data-testid":"transcript-help-toggle",style:q3,onClick:()=>V(_=>!_),title:"What each gesture does","aria-label":"Transcript help","aria-expanded":$,children:"?"})]}),$?u.jsx("div",{"data-testid":"transcript-help",style:Rv,children:"Drag across words — or shift-click — to mark a run. Its toolbar offers Edit (rewrite freely — word count may change, captions only; works on a single word too, the way to split a merged one), Timing (whole CAPTIONS — drag the waveform handles to move when they come in and go out, or drag between them to shift them all, taking the time from the captions either side) and Delete — from the captions only (restorable — the word stays here and in the audio) or from the video too, on the next Render. Double-click retype stays 1:1 — word count and timing fixed, so scene anchors and the caption highlight keep working."}):null,u.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[u.jsx("input",{"data-testid":"transcript-search",style:{...L3,flex:1},placeholder:"Find a word…",value:p,onChange:_=>h(_.target.value),onKeyDown:_=>{_.key==="Enter"&&(_.preventDefault(),xe(_.shiftKey?-1:1))}}),u.jsx("button",{"data-testid":"transcript-prev",style:jv,onClick:()=>xe(-1),disabled:X.length===0,title:"Previous match (⇧Enter)","aria-label":"Previous match",children:"‹"}),u.jsx("button",{"data-testid":"transcript-next",style:jv,onClick:()=>xe(1),disabled:X.length===0,title:"Next match (Enter)","aria-label":"Next match",children:"›"})]}),ae?u.jsx("div",{"data-testid":"transcript-match-count",style:{fontSize:11,color:"#9A9AA3"},children:X.length===0?"0 matches":`${oe+1}/${X.length} match${X.length===1?"":"es"}`}):null]}),u.jsxs("div",{style:D3,"data-testid":"transcript-body",dir:G,ref:P,onMouseUp:Je,tabIndex:0,onKeyDown:_=>{if(!(m!==null||g!==null)){if(w!==null){_.key==="Escape"&&(_.stopPropagation(),b(null));return}if(_.key==="Escape"){if(v===null)return;_.stopPropagation(),k(null),y(null);return}(_.key==="Delete"||_.key==="Backspace")&&v!==null&&(_.preventDefault(),_.stopPropagation(),Re?Zt():Ee())}},children:[z.map((_,U)=>{const re=K(_.word),fe=Un(_.lineIndex),we=H(_)?"hidden from captions — select and Restore":re!==void 0?`part of a rewritten range (was “${re.was}”) — select it and use Edit`:_.synthetic?`rewritten (was “${_.base}”) — select and Edit to change`:_.live!==_.base?`edited (was “${_.base}”) — double-click to retype`:"click to jump · double-click to retype";return u.jsxs(le.Fragment,{children:[U>0?" ":null,(m==null?void 0:m.index)===_.index?u.jsx("input",{autoFocus:!0,"data-testid":"transcript-edit",style:tN,value:m.draft,onChange:be=>x({...m,draft:be.target.value}),onBlur:()=>Se(m),onKeyDown:be=>{be.key==="Enter"&&be.target.blur(),be.key==="Escape"&&x(null)}}):u.jsx("span",{"data-testid":`transcript-word-${_.index}`,onClick:be=>{var Pe;if(g!==null&&y(null),w!==null&&b(null),be.shiftKey){k(Me=>Me===null?{anchor:_.index,focus:_.index}:{...Me,focus:_.index});return}(Pe=o.current)==null||Pe.seekTo(Math.ceil(c(_.start)*r)),k({anchor:_.index,focus:_.index})},onDoubleClick:()=>de(_),title:fe===void 0?we:`${we} · caption timing adjusted (${Math.round(fe.lead*1e3)}ms in / ${Math.round(fe.tail*1e3)}ms out) — Timing to change`,style:{...z3,...fe!==void 0?Z3:{},...H(_)?U3:{},..._.live!==_.base||_.synthetic?W3:{},...ee!==null&&_.index>=ee&&_.index<=ue?H3:{},...ae!=null&&ae.has(_.index)?O3:{},...X[oe]===_.index?B3:{},...W===_.index?V3:{}},children:_.live})]},_.index)}),v!==null&&D!==null&&m===null&&g===null&&w===null?u.jsxs("div",{"data-testid":"transcript-selection-menu",role:"menu",ref:N,dir:"ltr",style:{...yl,top:D.top,left:D.left},children:[u.jsx(Ho,{"data-testid":"transcript-edit-range",onClick:je,disabled:Ie,title:Ie?"A selected word has no source anchor (this project predates them) — re-run produce first":ze!==void 0?"Re-edit the rewritten range this selection touches":se.length===1?"Retype this word (1:1 — same as double-click)":"Rewrite these words as free text — word count may change",children:"Edit"}),u.jsx(Ho,{"data-testid":"transcript-timing",onClick:Zn,disabled:se.length===0||Ie,title:Ie?"A selected word has no source anchor (this project predates them) — re-run produce first":_t===1?"Adjust when this caption appears and leaves":`Adjust when these ${_t} captions appear and leave`,children:"Timing"}),Re?u.jsx(Ho,{"data-testid":"transcript-restore",onClick:Zt,title:"Show these words in the captions again",children:"Restore"}):u.jsxs("span",{style:{position:"relative"},children:[u.jsx(Ho,{"data-testid":"transcript-delete-menu",onClick:()=>C(_=>!_),title:"Delete these words — from the captions only, or from the video too",children:"Delete ▾"}),j?u.jsxs("div",{"data-testid":"transcript-delete-flyout",dir:"ltr",style:Q3,children:[u.jsx(Ho,{"data-testid":"transcript-hide",onClick:()=>{C(!1),dt()},disabled:Ie,title:Ie?"A selected word has no source anchor (this project predates them) — re-run produce first":"Hide these words from the captions — restorable, the words stay here and in the audio",children:"Delete captions"}),u.jsx(Ho,{"data-testid":"transcript-delete",onClick:()=>{C(!1),Ee()},disabled:Ie,title:Ie?"A selected word has no source anchor (this project predates them) — re-run produce first":"Delete these words — from the captions only, or from the video too",children:"Delete + video…"})]}):null]}),u.jsxs("span",{style:Pv,children:[se.length," word",se.length===1?"":"s"]})]}):null,g!==null&&D!==null?u.jsxs("div",{"data-testid":"transcript-range-popover",ref:N,dir:"ltr",style:{...yl,top:D.top,left:D.left,flexDirection:"column",alignItems:"stretch",gap:6},children:[u.jsx("textarea",{autoFocus:!0,"data-testid":"transcript-range-edit",rows:3,dir:"auto",style:eN,value:g.draft,onChange:_=>y({...g,draft:_.target.value}),onKeyDown:_=>{_.key==="Enter"&&!_.shiftKey&&(_.preventDefault(),_e(g)),_.key==="Escape"&&y(null)}}),u.jsxs("div",{style:{display:"flex",gap:6},children:[u.jsx("button",{"data-testid":"transcript-apply",style:Uo,onClick:()=>_e(g),title:"Rewrite this selection (Enter)",children:"Apply"}),ke.length>0?u.jsxs("button",{"data-testid":"transcript-apply-all",style:Uo,onClick:()=>Le(g),title:"Rewrite this selection AND every other place the same words occur — one undo step",children:["Apply to all (",ke.length,")"]}):null,u.jsx("button",{style:Uo,onClick:()=>y(null),title:"Discard the rewrite (Esc)",children:"Cancel"})]})]}):null,w!==null&&ft!==null&&D!==null?u.jsxs("div",{"data-testid":"transcript-timing-popover",ref:N,dir:"ltr",style:{...yl,top:D.top,left:D.left,flexDirection:"column",alignItems:"stretch",gap:6},children:[u.jsxs("div",{style:{position:"relative",width:ao,height:an},children:[u.jsx("canvas",{"data-testid":"transcript-timing-canvas",ref:T,width:ao,height:an,style:{display:"block",borderRadius:4}}),Fn!==null?u.jsxs(u.Fragment,{children:[u.jsx("div",{"data-testid":"transcript-timing-band",title:gn===1?"Drag to shift this caption, its duration intact":"Drag to shift these captions, every duration intact",onPointerDown:Ir("band"),style:{...Y3,left:Fn.lead,width:Math.max(0,Fn.tail-Fn.lead),cursor:(I==null?void 0:I.edge)==="band"?"grabbing":"grab"}}),u.jsx(Tv,{"data-testid":"transcript-timing-handle-lead",title:gn===1?"Drag to move when this caption comes in — the previous caption gives up the time":"Drag to move when the first caption comes in — the previous caption gives up the time",x:Fn.lead,active:(I==null?void 0:I.edge)==="lead",onPointerDown:Ir("lead")}),u.jsx(Tv,{"data-testid":"transcript-timing-handle-tail",title:gn===1?"Drag to move when this caption goes out — the next caption gives up the time":"Drag to move when the last caption goes out — the next caption gives up the time",x:Fn.tail,active:(I==null?void 0:I.edge)==="tail",onPointerDown:Ir("tail")})]}):null]}),u.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[u.jsx("button",{"data-testid":"transcript-timing-play",style:Uo,onClick:lr,title:S?"Pause":gn===1?"Play just this caption's span":"Play just these captions' span",children:S?"Pause":"Play"}),u.jsxs("span",{"data-testid":"transcript-timing-span",style:Pv,children:[ft.start.toFixed(2),"s – ",ft.end.toFixed(2),"s",` · ${gn} caption${gn===1?"":"s"}`]}),u.jsx("button",{"data-testid":"transcript-timing-apply",style:Uo,onClick:()=>{mn!==null&&ur(mn)},title:gn===1?"Store this caption's timing — the neighbour's matching seam moves with it":"Store these captions' timing — one undo step for the whole gesture",children:"Apply"}),u.jsx("button",{"data-testid":"transcript-timing-cancel",style:Uo,onClick:()=>b(null),title:"Discard the nudge (Esc)",children:"Cancel"})]})]}):null]})]})},Ho=({children:e,...t})=>{const[n,r]=d.useState(!1);return u.jsx("button",{role:"menuitem",...t,style:{...J3,...n&&!t.disabled?{background:"#34343F"}:{},...t.disabled?{opacity:.5,cursor:"default"}:{}},onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:e})},Tv=({x:e,active:t,...n})=>{const[r,o]=d.useState(!1);return u.jsx("div",{...n,style:{...K3,left:e-Fb/2},onPointerEnter:()=>o(!0),onPointerLeave:()=>o(!1),children:u.jsx("div",{style:{...G3,background:t?"#fff":r?"#FFF0A0":"#FFE14D",width:t?4:2}})})},$3={flexShrink:0,display:"flex",flexDirection:"column",background:"#111116",minHeight:0},A3={display:"flex",flexDirection:"column",gap:8,padding:"14px 14px 10px",borderBottom:"1px solid #1E1E24"},N3={fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"#9A9AA3"},Rv={fontSize:11,lineHeight:1.45,color:"#6a6a75"},L3={fontFamily:"'Inter', system-ui, sans-serif",fontSize:13,background:"#0F0F14",border:"1px solid #2A2A33",borderRadius:6,color:"#fff",padding:"6px 8px"},D3={flex:1,position:"relative",fontFamily:"'Inter', 'Noto Nastaliq Urdu', 'Geeza Pro', 'Noto Naskh Arabic', system-ui, sans-serif",overflowY:"auto",overflowX:"hidden",overflowWrap:"break-word",padding:"10px 14px 16px",fontSize:13,lineHeight:2,color:"#C9C9D4"},z3={cursor:"pointer",borderRadius:3,padding:"2px 4px",unicodeBidi:"isolate"},O3={background:"#2b2b1a",outline:"1px solid #6b6432"},B3={background:"#3d3a17",outline:"2px solid #FFE14D",color:"#fff"},jv={width:26,height:30,fontSize:16,lineHeight:1,color:"#EDEDF2",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:6,cursor:"pointer",padding:0},W3={color:"#FFE14D"},V3={textDecoration:"underline",textUnderlineOffset:4},H3={background:"#FFE14D",color:"#111",borderRadius:0,boxShadow:"-4px 0 0 0 #FFE14D, 4px 0 0 0 #FFE14D"},U3={textDecoration:"line-through",color:"#6a6a75"},Z3={borderBottom:"1px dotted #9A9AA3"},Fb=12,K3={position:"absolute",top:0,width:Fb,height:an,cursor:"ew-resize",touchAction:"none",display:"flex",justifyContent:"center"},Y3={position:"absolute",top:0,height:an,touchAction:"none"},G3={height:"100%",borderRadius:1,pointerEvents:"none"},X3={display:"flex",gap:6,alignItems:"center",justifyContent:"space-between"},q3={width:20,height:20,fontSize:11,lineHeight:1,color:"#9A9AA3",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:6,cursor:"pointer",padding:0,flexShrink:0},yl={position:"absolute",zIndex:31,background:"#262630",border:"1px solid #3A3A47",borderRadius:10,padding:"4px 6px",boxShadow:"0 14px 34px rgba(0,0,0,0.66), 0 2px 6px rgba(0,0,0,0.4)",display:"flex",flexDirection:"row",alignItems:"center",gap:2},Q3={...yl,top:"100%",left:0,marginTop:4,zIndex:32,minWidth:170,flexDirection:"column",alignItems:"stretch"},Pv={fontSize:11,color:"#9A9AA3",paddingInline:"6px 8px",whiteSpace:"nowrap"},J3={fontSize:12,fontWeight:600,color:"#EDEDF2",background:"transparent",border:"none",borderRadius:6,padding:"6px 10px",cursor:"pointer",textAlign:"left",whiteSpace:"nowrap"},eN={fontFamily:"'Inter', 'Noto Nastaliq Urdu', 'Geeza Pro', 'Noto Naskh Arabic', system-ui, sans-serif",fontSize:13,width:280,background:"#0F0F14",border:"1px solid #FFE14D",borderRadius:4,color:"#fff",padding:"4px 6px",resize:"vertical"},Uo={fontSize:11,color:"#EDEDF2",background:"#34343F",border:"1px solid #45454F",borderRadius:6,cursor:"pointer",padding:"4px 8px"},tN={fontFamily:"'Inter', 'Noto Nastaliq Urdu', 'Geeza Pro', 'Noto Naskh Arabic', system-ui, sans-serif",fontSize:13,width:110,background:"#0F0F14",border:"1px solid #FFE14D",borderRadius:4,color:"#fff",padding:"1px 4px"},nN=[{title:"transport",rows:[["space","play / pause"],["J / K / L","reverse · pause · forward (tap again to speed up)"],["← / →","step one frame back / forward"],["⌘/ctrl + ← / →","jump to and select the previous / next scene"]]},{title:"selection",rows:[["click","select scene or element"],["⌥ + ← / →","select previous / next scene"],["esc","clear selection · close dialogs"]]},{title:"editing",rows:[["⌘/ctrl + B","split the scene at the playhead"],["delete / backspace","delete the selected scene — asks graphic or whole take (§139)"],["enter (in that dialog)","confirm the highlighted option"],["⌘/ctrl + Z","undo"],["⌘/ctrl + ⇧ + Z","redo (⌘Y works too)"],["⌘/ctrl + S","save"],["double-click caption word","retype it in place"],["drag element / corner handles","move · resize"],["drag picture","pan the video framing"],["drag a scene block / edge on the timeline","snaps to scene edges + the playhead (hold ⌥ while dragging to disable)"],["drag a box on the stage","snaps to centre / safe-area guides (hold ⌥ mid-drag to disable)"]]},{title:"view",rows:[["⌘/ctrl + scroll on preview","zoom the view (never edits)"],["⌥-drag / middle-drag","pan the zoomed view"],["⌘/ctrl + scroll on timeline","zoom the timeline"],["?","this reference"]]}],rN=({onClose:e})=>(d.useEffect(()=>{const t=n=>{n.key==="Escape"&&(n.stopPropagation(),e())};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e]),u.jsx("div",{style:oN,onMouseDown:e,children:u.jsxs("div",{"data-testid":"shortcuts-modal",style:iN,onMouseDown:t=>t.stopPropagation(),children:[u.jsxs("div",{style:sN,children:[u.jsx("span",{style:aN,children:"keybinds"}),u.jsx("span",{style:lN,children:"esc close"})]}),u.jsx("div",{style:uN,children:"available commands and configured shortcuts"}),nN.map(t=>u.jsxs("div",{style:{marginTop:18},children:[u.jsx("div",{style:cN,children:t.title}),t.rows.map(([n,r])=>u.jsxs("div",{style:dN,children:[u.jsx("span",{style:fN,children:n}),u.jsx("span",{style:pN,children:r})]},n))]},t.title))]})})),oN={position:"fixed",inset:0,zIndex:30,background:"rgba(5,5,8,0.6)",display:"flex",alignItems:"center",justifyContent:"center"},iN={width:620,maxWidth:"90vw",maxHeight:"82vh",overflowY:"auto",background:"#12121A",border:"1px solid #3A3A48",borderRadius:8,padding:"20px 26px 26px",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace"},sN={display:"flex",justifyContent:"space-between",alignItems:"center"},aN={fontSize:18,fontWeight:700,color:"#EDEDF2"},lN={fontSize:13,fontWeight:700,color:"#0B0B0E",background:"#a8c7fa",borderRadius:4,padding:"3px 10px"},uN={fontSize:13,color:"#6a6a75",marginTop:4},cN={fontSize:14,fontWeight:700,color:"#8ab4f8",marginBottom:6},dN={display:"flex",gap:16,padding:"3px 0"},fN={width:290,flexShrink:0,color:"#c5a3ff",fontWeight:600,fontSize:13},pN={color:"#C9C9D4",fontSize:13},Fv={graphic:{label:"just the graphic",detail:e=>e.isSplitHalf?"this half only — the take underneath keeps playing":"the take underneath keeps playing"},take:{label:"the whole take",detail:e=>`cuts ${(e.endSec-e.startSec).toFixed(1)}s out of the video`}},hN=({plan:e,onConfirm:t,onCancel:n})=>{const[r,o]=d.useState(e.targets[0]),i=d.useRef(null),s=d.useRef(null);return d.useEffect(()=>{const a=l=>{if(l.key==="Escape"){l.stopPropagation(),n();return}if(l.key!=="Tab")return;const c=i.current;if(!c)return;const f=c.querySelectorAll("input, button"),p=f[0],h=f[f.length-1];!p||!h||(l.shiftKey&&document.activeElement===p?(l.preventDefault(),h.focus()):!l.shiftKey&&document.activeElement===h&&(l.preventDefault(),p.focus()))};return window.addEventListener("keydown",a,!0),()=>window.removeEventListener("keydown",a,!0)},[n]),d.useEffect(()=>{var l;const a=document.activeElement;return(l=s.current)==null||l.focus(),()=>{var c;return(c=a==null?void 0:a.focus)==null?void 0:c.call(a)}},[]),u.jsx("div",{style:mN,onMouseDown:n,children:u.jsxs("form",{ref:i,"data-testid":"delete-scene-modal",role:"dialog","aria-modal":"true","aria-label":`Delete ${e.rootId}`,style:gN,onMouseDown:a=>a.stopPropagation(),onSubmit:a=>{a.preventDefault(),t(r)},children:[u.jsxs("div",{style:vN,children:[u.jsxs("span",{style:yN,children:["delete ",e.rootId,e.isSplitHalf?u.jsx("span",{style:wN,children:"half"}):null,"?"]}),u.jsx("span",{style:xN,children:"esc cancel"})]}),u.jsx("div",{style:bN,children:"undoable with ⌘Z, like every other edit"}),u.jsx("div",{style:{marginTop:16},children:e.targets.map(a=>u.jsxs("label",{style:SN,"data-testid":`delete-option-${a}`,children:[u.jsx("input",{type:"radio",name:"delete-target",value:a,checked:r===a,onChange:()=>o(a),style:kN}),u.jsxs("span",{children:[u.jsx("span",{style:EN,children:Fv[a].label}),u.jsx("span",{style:CN,children:Fv[a].detail(e)})]})]},a))}),u.jsxs("div",{style:IN,children:[u.jsx("button",{type:"button","data-testid":"delete-cancel",style:_b,onClick:n,children:"Cancel"}),u.jsx("button",{ref:s,type:"submit","data-testid":"delete-confirm",style:TN,children:"Delete"})]})]})})},mN={position:"fixed",inset:0,zIndex:30,background:"rgba(5,5,8,0.6)",display:"flex",alignItems:"center",justifyContent:"center"},gN={width:420,maxWidth:"90vw",background:"#12121A",border:"1px solid #3A3A48",borderRadius:8,padding:"18px 22px 20px",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace"},vN={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12},yN={fontSize:16,fontWeight:700,color:"#EDEDF2"},wN={fontSize:11,fontWeight:700,color:"#0B0B0E",background:"#c5a3ff",borderRadius:4,padding:"2px 6px",marginLeft:6},xN={fontSize:12,fontWeight:700,color:"#0B0B0E",background:"#a8c7fa",borderRadius:4,padding:"3px 10px",whiteSpace:"nowrap"},bN={fontSize:12,color:"#6a6a75",marginTop:4},SN={display:"flex",alignItems:"flex-start",gap:10,padding:"8px 0",cursor:"pointer"},kN={accentColor:"#8ab4f8",marginTop:2,cursor:"pointer"},EN={display:"block",fontSize:13,fontWeight:600,color:"#EDEDF2"},CN={display:"block",fontSize:12,color:"#9A9AA3",marginTop:2},IN={display:"flex",justifyContent:"flex-end",gap:8,marginTop:14},_b={fontSize:12,fontWeight:600,color:"#C9C9D4",background:"transparent",border:"1px solid #2A2A33",borderRadius:6,padding:"7px 12px",cursor:"pointer",fontFamily:"inherit"},TN={..._b,color:"#FF5C5C",border:"1px solid #452626"},_v={caption:{label:"Remove from captions only",detail:()=>"restorable — the words stay in the transcript and the audio"},"caption-video":{label:"Remove captions + video",detail:e=>`cuts ${(e.endSec-e.startSec).toFixed(1)}s out of the video on the next Render; captions disappear now`}},RN=({plan:e,onConfirm:t,onCancel:n})=>{const[r,o]=d.useState(e.targets[0]),i=d.useRef(null),s=d.useRef(null);d.useEffect(()=>{const l=c=>{if(c.key==="Escape"){c.stopPropagation(),n();return}if(c.key!=="Tab")return;const f=i.current;if(!f)return;const p=f.querySelectorAll("input, button"),h=p[0],m=p[p.length-1];!h||!m||(c.shiftKey&&document.activeElement===h?(c.preventDefault(),m.focus()):!c.shiftKey&&document.activeElement===m&&(c.preventDefault(),h.focus()))};return window.addEventListener("keydown",l,!0),()=>window.removeEventListener("keydown",l,!0)},[n]),d.useEffect(()=>{var c;const l=document.activeElement;return(c=s.current)==null||c.focus(),()=>{var f;return(f=l==null?void 0:l.focus)==null?void 0:f.call(l)}},[]);const a=e.words.length;return u.jsx("div",{style:jN,onMouseDown:n,children:u.jsxs("form",{ref:i,"data-testid":"delete-words-modal",role:"dialog","aria-modal":"true","aria-label":`Delete ${a} word${a===1?"":"s"}`,style:PN,onMouseDown:l=>l.stopPropagation(),onSubmit:l=>{l.preventDefault(),t(r)},children:[u.jsxs("div",{style:FN,children:[u.jsxs("span",{style:_N,children:["delete ",a," word",a===1?"":"s","?"]}),u.jsx("span",{style:MN,children:"esc cancel"})]}),u.jsx("div",{style:$N,children:"undoable with ⌘Z, like every other edit"}),u.jsx("div",{style:{marginTop:16},children:e.targets.map(l=>u.jsxs("label",{style:AN,"data-testid":`delete-words-option-${l}`,children:[u.jsx("input",{type:"radio",name:"delete-words-target",value:l,checked:r===l,onChange:()=>o(l),style:NN}),u.jsxs("span",{children:[u.jsx("span",{style:LN,children:_v[l].label}),u.jsx("span",{style:DN,children:_v[l].detail(e)})]})]},l))}),u.jsxs("div",{style:zN,children:[u.jsx("button",{type:"button","data-testid":"delete-words-cancel",style:Mb,onClick:n,children:"Cancel"}),u.jsx("button",{ref:s,type:"submit","data-testid":"delete-words-confirm",style:ON,children:"Delete"})]})]})})},jN={position:"fixed",inset:0,zIndex:30,background:"rgba(5,5,8,0.6)",display:"flex",alignItems:"center",justifyContent:"center"},PN={width:420,maxWidth:"90vw",background:"#12121A",border:"1px solid #3A3A48",borderRadius:8,padding:"18px 22px 20px",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace"},FN={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12},_N={fontSize:16,fontWeight:700,color:"#EDEDF2"},MN={fontSize:12,fontWeight:700,color:"#0B0B0E",background:"#a8c7fa",borderRadius:4,padding:"3px 10px",whiteSpace:"nowrap"},$N={fontSize:12,color:"#6a6a75",marginTop:4},AN={display:"flex",alignItems:"flex-start",gap:10,padding:"8px 0",cursor:"pointer"},NN={accentColor:"#8ab4f8",marginTop:2,cursor:"pointer"},LN={display:"block",fontSize:13,fontWeight:600,color:"#EDEDF2"},DN={display:"block",fontSize:12,color:"#9A9AA3",marginTop:2},zN={display:"flex",justifyContent:"flex-end",gap:8,marginTop:14},Mb={fontSize:12,fontWeight:600,color:"#C9C9D4",background:"transparent",border:"1px solid #2A2A33",borderRadius:6,padding:"7px 12px",cursor:"pointer",fontFamily:"inherit"},ON={...Mb,color:"#FF5C5C",border:"1px solid #452626"},BN=(e,t=3)=>{const n=e.split("/");if(n.length<=t)return{head:"",tail:e};const r=n.length-t;return{head:n.slice(0,r).join("/")||"/",tail:n.slice(r).join("/")}},Mv=e=>e.scrollTop+e.clientHeight<e.scrollHeight-1,WN=(e,t,n)=>n<=0?-1:Math.max(0,Math.min(n-1,e+t)),$v=({recent:e,required:t,onOpen:n,onClose:r})=>{const[o,i]=d.useState(null),[s,a]=d.useState(null),[l,c]=d.useState(!1),f=d.useRef(null),p=d.useRef(null),[h,m]=d.useState(!1),[x,v]=d.useState(!1),k=()=>{m(f.current?Mv(f.current):!1)},g=()=>{v(p.current?Mv(p.current):!1)},y=async S=>{try{const E=await fetch(`/api/fs${S?`?dir=${encodeURIComponent(S)}`:""}`),T=await E.json();if(!E.ok)throw new Error(T.error??`listing failed: ${E.status}`);i(T)}catch(E){a(E instanceof Error?E.message:String(E))}};d.useEffect(()=>{y()},[]),d.useEffect(()=>{const S=()=>{k(),g()};return S(),window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[o,e]),d.useEffect(()=>{if(t)return;const S=E=>{E.key==="Escape"&&(E.stopPropagation(),r())};return window.addEventListener("keydown",S,!0),()=>window.removeEventListener("keydown",S,!0)},[t,r]);const w=S=>{var F;const E=S.key==="ArrowDown"?1:S.key==="ArrowUp"?-1:0;if(E===0&&S.key!=="Home"&&S.key!=="End")return;const T=Array.from(S.currentTarget.querySelectorAll("button"));if(T.length===0)return;const I=T.indexOf(document.activeElement),R=S.key==="Home"?0:S.key==="End"?T.length-1:WN(I,E,T.length);S.preventDefault(),(F=T[R])==null||F.focus()},b=S=>{c(!0),a(null),n(S).then(E=>{c(!1),E&&a(E)})};return u.jsx("div",{style:VN,onMouseDown:t?void 0:r,children:u.jsxs("div",{"data-testid":"project-picker",style:HN,onMouseDown:S=>S.stopPropagation(),children:[u.jsxs("div",{style:UN,children:[u.jsx("span",{style:ZN,children:t?"open a project":"switch project"}),t?null:u.jsx("button",{"data-testid":"project-picker-close",style:KN,onClick:r,children:"esc close"})]}),u.jsx("div",{style:YN,children:"A project is a work directory a `ossclip produce` run wrote — the folder holding render-props.json."}),s?u.jsx("div",{"data-testid":"project-picker-error",style:GN,children:s}):null,e.length>0?u.jsxs("div",{style:{marginTop:16,flexShrink:0},children:[u.jsx("div",{style:Av,children:"recent"}),u.jsx("div",{ref:p,className:"ossclip-scroll-list",style:x?{...Nv,...Dv}:Nv,onScroll:g,onKeyDown:w,"data-testid":"project-recent-list",children:e.map(S=>{const{head:E,tail:T}=BN(S);return u.jsxs("button",{"data-testid":"project-recent",className:"ossclip-picker-row",style:{...Jc,...e5},disabled:l,onClick:()=>b(S),title:S,children:[u.jsx("span",{style:{color:"#FFE14D",flexShrink:0},children:"▸"}),u.jsxs("span",{style:t5,children:[u.jsx("span",{style:n5,children:T}),E?u.jsx("span",{style:r5,children:E}):null]})]},S)})})]}):null,u.jsxs("div",{style:JN,children:[u.jsx("div",{style:Av,children:"browse"}),u.jsxs("div",{style:{color:"#6a6a75",fontSize:12,marginBottom:6},children:["Folders only — hidden ones are omitted, and any projects produced inside a folder show up directly as ",u.jsx("span",{style:{color:"#FFE14D"},children:"▸ .ossclip/…"})," entries."]}),o?u.jsxs(u.Fragment,{children:[u.jsxs("div",{style:XN,children:[u.jsx("span",{style:qN,title:o.dir,children:o.dir}),o.isWorkdir?u.jsx("button",{"data-testid":"project-open-current",style:QN,disabled:l,onClick:()=>b(o.dir),children:"open this project"}):null]}),u.jsxs("div",{ref:f,className:"ossclip-scroll-list",style:h?{...Lv,...Dv}:Lv,onScroll:k,onKeyDown:w,"data-testid":"project-fs-list",children:[o.parent?u.jsxs("button",{"data-testid":"project-fs-up",className:"ossclip-picker-row",style:Jc,disabled:l,onClick:()=>void y(o.parent),children:[u.jsx("span",{style:{color:"#6a6a75",flexShrink:0},children:"↑"}),u.jsx("span",{style:zv,children:".."})]}):null,o.entries.map(S=>u.jsxs("button",{"data-testid":S.isWorkdir?"project-fs-workdir":"project-fs-dir",className:`ossclip-picker-row${S.isWorkdir?" is-workdir":""}`,style:Jc,disabled:l,onClick:()=>S.isWorkdir?b(S.path):void y(S.path),title:S.path,children:[u.jsx("span",{style:{flexShrink:0,color:S.isWorkdir?"#FFE14D":"#6a6a75"},children:S.isWorkdir?"▸":"▪"}),u.jsxs("span",{style:zv,children:[S.name,S.isWorkdir?null:u.jsx("span",{style:{color:"#55555f"},children:"/"})]}),S.isWorkdir?u.jsx("span",{style:o5,children:"project"}):null]},S.path)),o.entries.length===0?u.jsx("div",{style:{color:"#6a6a75",fontSize:12,padding:"6px 8px"},children:"no folders here"}):null]})]}):u.jsx("div",{style:{color:"#6a6a75",fontSize:13},children:"loading…"})]})]})})},VN={position:"fixed",inset:0,zIndex:30,background:"rgba(5,5,8,0.6)",display:"flex",alignItems:"center",justifyContent:"center"},HN={width:620,maxWidth:"90vw",maxHeight:"82vh",boxSizing:"border-box",display:"flex",flexDirection:"column",background:"#12121A",border:"1px solid #3A3A48",borderRadius:8,padding:"20px 26px 26px",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace"},UN={display:"flex",justifyContent:"space-between",alignItems:"center"},ZN={fontSize:18,fontWeight:700,color:"#EDEDF2"},KN={fontSize:13,fontWeight:700,color:"#0B0B0E",background:"#a8c7fa",border:"none",borderRadius:4,padding:"3px 10px",cursor:"pointer"},YN={fontSize:13,color:"#6a6a75",marginTop:4},GN={marginTop:12,fontSize:13,color:"#FF5C5C"},Av={fontSize:14,fontWeight:700,color:"#8ab4f8",marginBottom:6},XN={display:"flex",alignItems:"center",gap:10,marginBottom:6},qN={fontSize:12,color:"#9A9AA3",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},QN={flexShrink:0,fontSize:12,fontWeight:700,color:"#0B0B0E",background:"#FFE14D",border:"1px solid #FFE14D",borderRadius:6,padding:"4px 10px",cursor:"pointer"},JN={marginTop:16,display:"flex",flexDirection:"column",flex:1,minHeight:0},Nv={maxHeight:218,overflowY:"auto",overscrollBehavior:"contain",flexShrink:0,display:"flex",flexDirection:"column",gap:2},Lv={flex:1,minHeight:0,overflowY:"auto",overscrollBehavior:"contain",display:"flex",flexDirection:"column",gap:2},Dv={maskImage:"linear-gradient(to bottom, black calc(100% - 24px), transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black calc(100% - 24px), transparent 100%)"},Jc={flexShrink:0,minHeight:34,display:"flex",alignItems:"center",gap:8,width:"100%",boxSizing:"border-box",textAlign:"left",fontFamily:"inherit",fontSize:13,lineHeight:1.4,borderRadius:6,padding:"6px 10px",cursor:"pointer",overflow:"hidden"},zv={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},e5={minHeight:46,alignItems:"center"},t5={display:"flex",flexDirection:"column",minWidth:0},n5={color:"#EDEDF2",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},r5={fontSize:11,color:"#6a6a75",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},o5={marginLeft:10,fontSize:11,fontWeight:700,color:"#FFE14D"},i5=({defaultOutPath:e,onCancel:t,onConfirm:n})=>{const[r,o]=d.useState(e??""),[i,s]=d.useState(!1);d.useEffect(()=>{const l=c=>{c.key==="Escape"?(c.stopPropagation(),t()):c.key==="Enter"&&!i&&(c.preventDefault(),n(r.trim()?r.trim():void 0))};return window.addEventListener("keydown",l,!0),()=>window.removeEventListener("keydown",l,!0)},[t,n,r,i]);const a=async()=>{s(!0);try{const l=await fetch("/api/pick-save-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({defaultPath:r||e})});if(l.ok){const c=await l.json();c.path&&o(c.path)}}catch{}finally{s(!1)}};return u.jsx("div",{style:s5,onMouseDown:t,children:u.jsxs("div",{"data-testid":"render-modal",style:a5,onMouseDown:l=>l.stopPropagation(),children:[u.jsxs("div",{style:l5,children:[u.jsx("div",{style:u5,children:"🎬 Render Master Video"}),u.jsx("button",{style:c5,onClick:t,children:"✕"})]}),u.jsx("div",{style:d5,children:"Choose where to export your rendered master cut, or keep the default location."}),u.jsxs("div",{style:{marginTop:20},children:[u.jsx("label",{style:f5,children:"Export File Destination"}),u.jsxs("div",{style:p5,children:[u.jsx("input",{"data-testid":"render-outpath-input",type:"text",value:r,onChange:l=>o(l.target.value),placeholder:"e.g. /Users/name/Movies/final-cut.mp4",style:h5,autoFocus:!0}),u.jsx("button",{"data-testid":"render-browse-btn",style:m5,onClick:a,disabled:i,title:"Open native file picker to choose destination",children:i?"Browsing…":"📁 Browse…"})]})]}),u.jsxs("div",{style:g5,children:[u.jsx("button",{style:v5,onClick:t,children:"Cancel"}),u.jsx("button",{"data-testid":"render-confirm-btn",style:y5,onClick:()=>n(r.trim()?r.trim():void 0),children:"Start Render ⚡"})]})]})})},s5={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},a5={width:560,maxWidth:"92vw",background:"#12121A",border:"1px solid #3A3A48",borderRadius:10,padding:"24px 28px",boxShadow:"0 20px 40px rgba(0,0,0,0.6)",fontFamily:"ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},l5={display:"flex",justifyContent:"space-between",alignItems:"center"},u5={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},c5={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},d5={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},f5={display:"block",fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.04em"},p5={display:"flex",gap:8},h5={flex:1,background:"#09090D",border:"1px solid #2C2C38",borderRadius:6,padding:"10px 14px",color:"#EDEDF2",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",outline:"none"},m5={background:"#1E1E2A",border:"1px solid #3A3A48",borderRadius:6,color:"#EDEDF2",padding:"0 16px",fontSize:13,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap"},g5={display:"flex",justifyContent:"flex-end",gap:12,marginTop:24},v5={background:"transparent",border:"1px solid #2C2C38",borderRadius:6,color:"#C9C9D4",padding:"9px 18px",fontSize:13,fontWeight:600,cursor:"pointer"},y5={background:"#00E5A3",border:"none",borderRadius:6,color:"#051A13",padding:"9px 20px",fontSize:13,fontWeight:700,cursor:"pointer",boxShadow:"0 2px 10px rgba(0,229,163,0.3)"};function w5(e){switch(e){case"override":return"Project override";case"flag":case"config":return"Your default portrait"}}function x5(e){const t=/^data:([^;,]+);base64,(.+)$/s.exec(e);return t?{mimeType:t[1],data:t[2]}:null}function b5(e){switch(e){case"no-youtube":return'This project was produced without the YouTube pack. The AI thumbnail needs --youtube — run produce with it (or set "youtube": true in ~/.ossclip/config.json) and render once.';case"no-portrait":return'No portrait photo is configured — the thumbnail uses it as the likeness reference. Set "portrait" in ~/.ossclip/config.json or run produce with --portrait <path>.';case"no-key":return"GEMINI_API_KEY is not set in the environment the edit server runs in.";case"portrait-missing":return"The configured portrait photo no longer exists on disk.";default:return"The AI thumbnail is unavailable for this project."}}const Ov=60,S5=({onClose:e})=>{const[t,n]=d.useState(null),[r,o]=d.useState(null),[i,s]=d.useState(""),[a,l]=d.useState(""),[c,f]=d.useState(""),[p,h]=d.useState(null),[m,x]=d.useState(!1),[v,k]=d.useState(null),[g,y]=d.useState(null),w=d.useRef(null);d.useEffect(()=>{const R=F=>{F.key==="Escape"&&(F.stopPropagation(),e())};return window.addEventListener("keydown",R,!0),()=>window.removeEventListener("keydown",R,!0)},[e]),d.useEffect(()=>{(async()=>{try{const R=await fetch("/api/thumbnail"),F=await R.json();if(!R.ok)throw new Error(F.error??`GET /api/thumbnail failed: ${R.status}`);n(F),h(F.imageUrl),F.concept&&(s(F.concept.overlayText),l(F.concept.scene),f(F.concept.styleNotes))}catch(R){o(R instanceof Error?R.message:String(R))}})()},[]);const b=async()=>{x(!0),k(null);try{const R=await fetch("/api/thumbnail/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({concept:{scene:a,overlayText:i,styleNotes:c}})}),F=await R.json();if(!R.ok||F.ok!==!0){k(F.error??`regenerate failed: ${R.status}`);return}h(F.imageUrl??null)}catch(R){k(R instanceof Error?R.message:String(R))}finally{x(!1)}},S=R=>{n(F=>F&&{...F,portrait:R})},E=async R=>{y(null);try{const F=await new Promise(($,V)=>{const D=new FileReader;D.onload=()=>$(String(D.result)),D.onerror=()=>V(new Error("could not read the image file")),D.readAsDataURL(R)}),A=x5(F);if(A===null){y("could not read the image file");return}const W=await fetch("/api/thumbnail/portrait",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)}),M=await W.json();if(!W.ok||M.ok!==!0){y(M.error??`swap failed: ${W.status}`);return}S(M.portrait??null)}catch(F){y(F instanceof Error?F.message:String(F))}},T=async()=>{y(null);try{const R=await fetch("/api/thumbnail/portrait",{method:"DELETE"}),F=await R.json();if(!R.ok||F.ok!==!0){y(F.error??`reset failed: ${R.status}`);return}S(F.portrait??null)}catch(R){y(R instanceof Error?R.message:String(R))}},I=(t==null?void 0:t.status)==="unavailable";return u.jsx("div",{style:k5,onMouseDown:e,children:u.jsxs("div",{"data-testid":"thumbnail-modal",style:E5,onMouseDown:R=>R.stopPropagation(),children:[u.jsxs("div",{style:C5,children:[u.jsx("div",{style:I5,children:"AI Thumbnail"}),u.jsx("button",{style:T5,onClick:e,"aria-label":"Close",children:"✕"})]}),r?u.jsxs("div",{"data-testid":"thumbnail-load-error",style:rd,children:["Couldn't load the thumbnail state: ",r]}):t===null?u.jsx("div",{style:ed,children:"Loading…"}):I?u.jsx("div",{"data-testid":"thumbnail-unavailable",style:{...ed,marginTop:12},children:b5(t.reason)}):u.jsxs(u.Fragment,{children:[t.status==="skipped"?u.jsx("div",{"data-testid":"thumbnail-skipped-note",style:{...ed,marginTop:8},children:"Thumbnail was skipped at the concept approval prompt — regenerating replaces that decision."}):null,u.jsx("div",{style:R5,children:p?u.jsx("img",{"data-testid":"thumbnail-image",src:p,alt:"Current AI thumbnail",style:j5}):u.jsx("div",{"data-testid":"thumbnail-placeholder",style:P5,children:"No thumbnail generated yet — edit the concept and hit Regenerate."})}),t.portrait?u.jsxs("div",{"data-testid":"portrait-strip",style:F5,children:[u.jsx("img",{"data-testid":"portrait-preview",src:t.portrait.url,alt:"Portrait reference",style:_5}),u.jsxs("div",{style:{flex:1,minWidth:0},children:[u.jsx("div",{"data-testid":"portrait-source",style:M5,children:w5(t.portrait.source)}),u.jsx("div",{style:Wv,children:"The swap applies to this project only and is used by future renders too."})]}),u.jsx("button",{"data-testid":"portrait-swap-btn",style:Bv,onClick:()=>{var R;return(R=w.current)==null?void 0:R.click()},disabled:m,children:"Swap face…"}),t.portrait.source==="override"?u.jsx("button",{"data-testid":"portrait-reset-btn",style:Bv,onClick:()=>void T(),disabled:m,children:"Use default"}):null,u.jsx("input",{ref:w,"data-testid":"portrait-file-input",type:"file",accept:"image/png,image/jpeg,image/webp",style:{display:"none"},onChange:R=>{var A;const F=(A=R.target.files)==null?void 0:A[0];R.target.value="",F&&E(F)}})]}):null,g?u.jsx("div",{"data-testid":"portrait-error",style:rd,children:g}):null,u.jsxs("div",{style:{marginTop:16},children:[u.jsxs("label",{style:td,children:["Overlay text — the words ON the image (",Ov," chars, 4–9 words)"]}),u.jsx("input",{"data-testid":"thumbnail-overlay-input",type:"text",maxLength:Ov,value:i,onChange:R=>s(R.target.value),style:nd})]}),u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:td,children:"Scene — what the image shows"}),u.jsx("textarea",{"data-testid":"thumbnail-scene-input",value:a,onChange:R=>l(R.target.value),rows:3,style:{...nd,resize:"vertical"}})]}),u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:td,children:"Style notes — palette, lighting, mood"}),u.jsx("textarea",{"data-testid":"thumbnail-style-input",value:c,onChange:R=>f(R.target.value),rows:3,style:{...nd,resize:"vertical"}})]}),v?u.jsx("div",{"data-testid":"thumbnail-error",style:rd,children:v}):null,u.jsxs("div",{style:$5,children:[u.jsx("div",{style:Wv,children:"Regenerating replaces the video's .thumbnail.png and saves this concept for future renders."}),u.jsx("button",{"data-testid":"thumbnail-regenerate-btn",style:{...A5,...m?{opacity:.6,cursor:"default"}:{}},onClick:()=>void b(),disabled:m,children:m?"Generating…":"Regenerate"})]})]})]})})},k5={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},E5={width:560,maxWidth:"92vw",maxHeight:"90vh",overflowY:"auto",background:"#12121A",border:"1px solid #3A3A48",borderRadius:10,padding:"24px 28px",boxShadow:"0 20px 40px rgba(0,0,0,0.6)",fontFamily:"ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},C5={display:"flex",justifyContent:"space-between",alignItems:"center"},I5={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},T5={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},ed={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},R5={marginTop:16,border:"1px solid #2C2C38",borderRadius:6,background:"#09090D",aspectRatio:"16 / 9",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},j5={width:"100%",height:"100%",objectFit:"contain"},P5={color:"#8B8B9E",fontSize:13,padding:16,textAlign:"center"},F5={display:"flex",alignItems:"center",gap:12,marginTop:12,padding:"10px 12px",border:"1px solid #2C2C38",borderRadius:6,background:"#09090D"},_5={width:44,height:44,borderRadius:6,objectFit:"cover",flexShrink:0,border:"1px solid #2C2C38"},M5={fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:2},Bv={background:"transparent",border:"1px solid #3A3A48",borderRadius:6,color:"#C9C9D4",padding:"7px 12px",fontSize:12,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap"},td={display:"block",fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.04em"},nd={width:"100%",boxSizing:"border-box",background:"#09090D",border:"1px solid #2C2C38",borderRadius:6,padding:"10px 14px",color:"#EDEDF2",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",outline:"none"},rd={marginTop:12,color:"#FF5C5C",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",whiteSpace:"pre-wrap"},$5={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,marginTop:20},Wv={fontSize:12,color:"#8B8B9E",lineHeight:1.4},A5={background:"#00E5A3",border:"none",borderRadius:6,color:"#051A13",padding:"9px 20px",fontSize:13,fontWeight:700,cursor:"pointer",whiteSpace:"nowrap",boxShadow:"0 2px 10px rgba(0,229,163,0.3)"},N5=({cutlist:e,edits:t,onClose:n})=>{d.useEffect(()=>{const i=s=>{s.key==="Escape"&&(s.stopPropagation(),n())};return window.addEventListener("keydown",i,!0),()=>window.removeEventListener("keydown",i,!0)},[n]);const r=e3(e),o=t.doc.cleanup.kept.length;return u.jsx("div",{style:L5,onMouseDown:n,children:u.jsxs("div",{"data-testid":"cleanup-modal",style:D5,onMouseDown:i=>i.stopPropagation(),children:[u.jsxs("div",{style:z5,children:[u.jsx("div",{style:O5,children:"Cleanup"}),u.jsx("button",{style:B5,onClick:n,"aria-label":"Close",children:"✕"})]}),u.jsx("div",{style:Vv,children:"What produce removed, by reason. Untick a category to keep it — the preview plays your choice immediately and the next render applies it. Individual removals can be kept by clicking their seam on the timeline."}),r.length===0?u.jsx("div",{"data-testid":"cleanup-empty",style:{...Vv,marginTop:16},children:"This run proposed no removals to review."}):u.jsx("div",{style:{marginTop:16},children:r.map(i=>{const s=t.doc.cleanup.reasons[i.reason]!==!1;return u.jsxs("label",{"data-testid":`cleanup-reason-${i.reason}`,style:W5,children:[u.jsx("input",{type:"checkbox","data-testid":`cleanup-checkbox-${i.reason}`,checked:s,onChange:a=>t.setReasonEnabled(i.reason,a.target.checked)}),u.jsx("span",{style:{...V5,background:vh[i.reason]}}),u.jsxs("span",{style:{...H5,...s?{}:{color:"#8B8B9E"}},children:[JA[i.reason]," — ",i.count," removal",i.count===1?"":"s"," ","· ",i.seconds.toFixed(1),"s"]}),s?null:u.jsx("span",{"data-testid":`cleanup-declined-${i.reason}`,style:U5,children:"kept — live in the preview"})]},i.reason)})}),o>0?u.jsxs("div",{"data-testid":"cleanup-kept-note",style:{...Z5,marginTop:12},children:[o," individual removal",o===1?"":"s"," kept via timeline seams."]}):null]})})},L5={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},D5={width:460,maxWidth:"92vw",maxHeight:"90vh",overflowY:"auto",background:"#12121A",border:"1px solid #3A3A48",borderRadius:10,padding:"24px 28px",boxShadow:"0 20px 40px rgba(0,0,0,0.6)",fontFamily:"ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},z5={display:"flex",justifyContent:"space-between",alignItems:"center"},O5={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},B5={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},Vv={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},W5={display:"flex",alignItems:"center",gap:10,padding:"8px 10px",border:"1px solid #2C2C38",borderRadius:6,background:"#09090D",marginBottom:8,cursor:"pointer"},V5={width:10,height:10,borderRadius:2,flexShrink:0},H5={fontSize:13,color:"#EDEDF2",flex:1,minWidth:0},U5={fontSize:11,color:"#FFE14D",whiteSpace:"nowrap"},Z5={fontSize:12,color:"#8B8B9E",lineHeight:1.4},Hv=3,Uv=5,od=500;function K5(e){return e.split(/\s+/).filter(t=>t.replace(/^#+/,"").length>0).map(t=>t.startsWith("#")?t:`#${t}`)}function Y5(e){return e.map(t=>t.startsWith("#")?t:`#${t}`).join(" ")}function $b(e){return e.split(",").map(t=>t.trim()).filter(t=>t.length>0)}function Ab(e){return e.join(", ")}function G5(e){return Ab($b(e)).length}function X5(e){const t=Math.max(0,Math.floor(e));return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function q5(e){return`[${{browse:"Browse",search:"Search",benefit:"Benefit",alt:"Alt"}[e]}]`}const Q5="This run never generated YouTube metadata. Run produce with --youtube (and an LLM provider) once — the pack lands here afterwards.",J5=({onClose:e})=>{var W;const[t,n]=d.useState(null),[r,o]=d.useState(null),[i,s]=d.useState([]),[a,l]=d.useState(null),[c,f]=d.useState(""),[p,h]=d.useState(""),[m,x]=d.useState(""),[v,k]=d.useState(null),[g,y]=d.useState(null),[w,b]=d.useState(null),[S,E]=d.useState(!1),[T,I]=d.useState(null);d.useEffect(()=>{const M=$=>{$.key==="Escape"&&($.stopPropagation(),e())};return window.addEventListener("keydown",M,!0),()=>window.removeEventListener("keydown",M,!0)},[e]);const R=d.useCallback(async()=>{try{const M=await fetch("/api/youtube"),$=await M.json();if(!M.ok)throw new Error($.error??`GET /api/youtube failed: ${M.status}`);n($),$.pack&&(s($.pack.titles),l($.pack.titleAngles??null),f($.pack.description),h(Y5($.pack.hashtags)),x(Ab($.pack.tags)),k($.pack.hook60??null),y($.pack.linkedinPost??null),b($.pack.communityPost??null))}catch(M){o(M instanceof Error?M.message:String(M))}},[]);d.useEffect(()=>{R()},[R]);const F=async()=>{var M;E(!0),I(null);try{const $=await fetch("/api/youtube",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({pack:{titles:i,...a!==null?{titleAngles:a}:{},description:c,hashtags:K5(p),tags:$b(m),...(M=t==null?void 0:t.pack)!=null&&M.chapters?{chapters:t.pack.chapters}:{},...v!==null?{hook60:v}:{},...g!==null?{linkedinPost:g}:{},...w!==null?{communityPost:w}:{}}})}),V=await $.json();if(!$.ok||V.ok!==!0){I(V.error??`save failed: ${$.status}`);return}await R()}catch($){I($ instanceof Error?$.message:String($))}finally{E(!1)}},A=G5(m);return u.jsx("div",{style:eL,onMouseDown:e,children:u.jsxs("div",{"data-testid":"youtube-modal",style:tL,onMouseDown:M=>M.stopPropagation(),children:[u.jsxs("div",{style:nL,children:[u.jsx("div",{style:rL,children:"YouTube SEO metadata"}),u.jsx("button",{style:oL,onClick:e,"aria-label":"Close",children:"✕"})]}),r?u.jsxs("div",{"data-testid":"youtube-load-error",style:Yv,children:["Couldn't load the YouTube pack: ",r]}):t===null?u.jsx("div",{style:Zv,children:"Loading…"}):t.available?u.jsxs(u.Fragment,{children:[u.jsxs("div",{style:{marginTop:16},children:[u.jsxs("label",{style:_r,children:["Title options (",Hv,"–",Uv,", up to 100 chars each)"]}),i.map((M,$)=>u.jsxs("div",{style:iL,children:[(a==null?void 0:a[$])!==void 0?u.jsx("span",{"data-testid":`youtube-title-angle-${$}`,style:sL,children:q5(a[$])}):null,u.jsx("input",{"data-testid":`youtube-title-input-${$}`,type:"text",maxLength:100,value:M,onChange:V=>s(D=>D.map((L,j)=>j===$?V.target.value:L)),style:lo}),u.jsx("button",{"data-testid":`youtube-title-remove-${$}`,style:Kv,disabled:i.length<=Hv,onClick:()=>{s(V=>V.filter((D,L)=>L!==$)),l(V=>V&&V.filter((D,L)=>L!==$))},"aria-label":`Remove title ${$+1}`,children:"✕"})]},$)),u.jsx("button",{"data-testid":"youtube-title-add",style:Kv,disabled:i.length>=Uv,onClick:()=>{s(M=>[...M,""]),l(M=>M&&[...M,"alt"])},children:"+ Add title"})]}),u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:_r,children:"Description"}),u.jsx("textarea",{"data-testid":"youtube-description-input",value:c,onChange:M=>f(M.target.value),rows:6,style:{...lo,resize:"vertical"}})]}),u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:_r,children:"Hashtags — space-separated, # added if missing"}),u.jsx("input",{"data-testid":"youtube-hashtags-input",type:"text",value:p,onChange:M=>h(M.target.value),style:lo})]}),u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:_r,children:"Tags — comma-separated"}),u.jsx("input",{"data-testid":"youtube-tags-input",type:"text",value:m,onChange:M=>x(M.target.value),style:lo}),u.jsxs("div",{"data-testid":"youtube-tags-counter",style:{...aL,...A>od?{color:"#FFB84D"}:{}},children:[A," / ",od,A>od?" — tags past the budget are dropped on save":""]})]}),(W=t.pack)!=null&&W.chapters&&t.pack.chapters.length>0?u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:_r,children:"Chapters (read-only — embedded in the description on save/render)"}),u.jsx("div",{"data-testid":"youtube-chapters",style:lL,children:t.pack.chapters.map((M,$)=>u.jsxs("div",{children:[X5(M.atSec)," ",M.title]},$))}),u.jsx("div",{style:Gv,children:"Timestamps are measured from the actual edit, so they are not hand-editable here; the .youtube.md splices them into the description's Timestamps block for you."})]}):null,v!==null?u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:_r,children:"First-60s hook strategy (for you — never uploaded)"}),u.jsx("textarea",{"data-testid":"youtube-hook60-input",value:v,onChange:M=>k(M.target.value),rows:3,style:{...lo,resize:"vertical"}})]}):null,g!==null?u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:_r,children:"LinkedIn post"}),u.jsx("textarea",{"data-testid":"youtube-linkedin-input",value:g,onChange:M=>y(M.target.value),rows:6,style:{...lo,resize:"vertical"}})]}):null,w!==null?u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:_r,children:"Community post"}),u.jsx("textarea",{"data-testid":"youtube-community-input",value:w,onChange:M=>b(M.target.value),rows:3,style:{...lo,resize:"vertical"}})]}):null,T?u.jsx("div",{"data-testid":"youtube-error",style:Yv,children:T}):null,u.jsxs("div",{style:uL,children:[u.jsx("div",{style:Gv,children:"Saves for future renders and rewrites the .youtube.md file now. Delete youtube-pack-approved.json in the workdir to let the AI regenerate."}),u.jsx("button",{"data-testid":"youtube-save-btn",style:{...cL,...S?{opacity:.6,cursor:"default"}:{}},onClick:()=>void F(),disabled:S,children:S?"Saving…":"Save"})]})]}):u.jsx("div",{"data-testid":"youtube-unavailable",style:{...Zv,marginTop:12},children:Q5})]})})},eL={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},tL={width:620,maxWidth:"92vw",maxHeight:"90vh",overflowY:"auto",background:"#12121A",border:"1px solid #3A3A48",borderRadius:10,padding:"24px 28px",boxShadow:"0 20px 40px rgba(0,0,0,0.6)",fontFamily:"ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},nL={display:"flex",justifyContent:"space-between",alignItems:"center"},rL={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},oL={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},Zv={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},_r={display:"block",fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.04em"},lo={width:"100%",boxSizing:"border-box",background:"#09090D",border:"1px solid #2C2C38",borderRadius:6,padding:"10px 14px",color:"#EDEDF2",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",outline:"none"},iL={display:"flex",gap:8,alignItems:"center",marginBottom:8},sL={fontSize:11,fontWeight:700,color:"#8B8B9E",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",whiteSpace:"nowrap",minWidth:62},Kv={fontSize:12,fontWeight:600,color:"#C9C9D4",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:6,padding:"6px 10px",cursor:"pointer",whiteSpace:"nowrap"},aL={marginTop:6,fontSize:12,color:"#8B8B9E",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace"},lL={border:"1px solid #2C2C38",borderRadius:6,background:"#09090D",padding:"10px 14px",color:"#C9C9D4",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",lineHeight:1.6},Yv={marginTop:12,color:"#FF5C5C",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",whiteSpace:"pre-wrap"},uL={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,marginTop:20},Gv={fontSize:12,color:"#8B8B9E",lineHeight:1.4,marginTop:6},cL={background:"#00E5A3",border:"none",borderRadius:6,color:"#051A13",padding:"9px 20px",fontSize:13,fontWeight:700,cursor:"pointer",whiteSpace:"nowrap",boxShadow:"0 2px 10px rgba(0,229,163,0.3)"};function dL(e){switch(e){case"no-destination":return"This workdir has no cover.json and no recorded --out, so there is nowhere to write a cover. Run `ossclip produce` once with an output path, or `ossclip cover --out <path>` from a terminal.";default:return"The cover is unavailable for this project."}}function fL(e){const t=e.trim().replace(/\s+/g," "),n=j$(t);return{preview:n,trimmed:n!==t}}function pL(e){if(e.trim()==="")return{ok:!0};const t=Number(e);return!Number.isFinite(t)||t<0?{ok:!1,message:`"${e}" is not a timestamp in seconds — 0 or more, please.`}:{ok:!0,atSec:t}}function Xv(e){return e!==null&&e.frame.sourceVideo!==null?{enabled:!0}:{enabled:!1,note:"There is no record of the original take for this project, so only the finished video can be read. The next `ossclip produce` records one."}}function hL(e){return e==="final"?"A frame from the finished video carries the burned-in captions, graphics and watermark.":"The original take — clean, framed the way produce framed it. Needs a cover.json."}function mL(e){return{...e.typed===(e.persistedText??"")?{}:{text:e.typed},...e.atSec===void 0?{}:{atSec:e.atSec},from:e.from}}const gL=({onClose:e,playheadSec:t})=>{const[n,r]=d.useState(null),[o,i]=d.useState(null),[s,a]=d.useState(""),[l,c]=d.useState(""),[f,p]=d.useState("final"),[h,m]=d.useState(null),[x,v]=d.useState(!1),[k,g]=d.useState(null),[y,w]=d.useState([]);d.useEffect(()=>{const R=F=>{F.key==="Escape"&&(F.stopPropagation(),e())};return window.addEventListener("keydown",R,!0),()=>window.removeEventListener("keydown",R,!0)},[e]),d.useEffect(()=>{(async()=>{try{const R=await fetch("/api/cover"),F=await R.json();if(!R.ok)throw new Error(F.error??`GET /api/cover failed: ${R.status}`);r(F),m(F.imageUrl),F.provenance&&(a(F.provenance.text),Xv(F.provenance).enabled&&p(F.provenance.frame.source))}catch(R){i(R instanceof Error?R.message:String(R))}})()},[]);const b=pL(l),S=fL(s),E=Xv((n==null?void 0:n.provenance)??null),T=async()=>{var R;if(b.ok){v(!0),g(null),w([]);try{const F=await fetch("/api/cover/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(mL({typed:s,persistedText:((R=n==null?void 0:n.provenance)==null?void 0:R.text)??null,atSec:b.atSec,from:f}))}),A=await F.json();if(!F.ok||A.ok!==!0){g(A.error??`regenerate failed: ${F.status}`);return}if(m(A.imageUrl??null),w(A.notes??[]),A.provenance){const W=A.provenance;r(M=>M&&{...M,provenance:W,status:"ready"}),a(W.text)}c("")}catch(F){g(F instanceof Error?F.message:String(F))}finally{v(!1)}}},I=(n==null?void 0:n.status)==="unavailable";return u.jsx("div",{style:vL,onMouseDown:e,children:u.jsxs("div",{"data-testid":"cover-modal",style:yL,onMouseDown:R=>R.stopPropagation(),children:[u.jsxs("div",{style:wL,children:[u.jsx("div",{style:xL,children:"Cover image"}),u.jsx("button",{style:bL,onClick:e,"aria-label":"Close",children:"✕"})]}),o?u.jsxs("div",{"data-testid":"cover-load-error",style:sd,children:["Couldn't load the cover state: ",o]}):n===null?u.jsx("div",{style:qv,children:"Loading…"}):I?u.jsx("div",{"data-testid":"cover-unavailable",style:{...qv,marginTop:12},children:dL(n.reason)}):u.jsxs(u.Fragment,{children:[u.jsx("div",{style:SL,children:h?u.jsx("img",{"data-testid":"cover-image",src:h,alt:"Current cover",style:kL}):u.jsx("div",{"data-testid":"cover-placeholder",style:EL,children:"No cover on disk yet — set a headline and hit Apply."})}),u.jsxs("div",{style:{marginTop:16},children:[u.jsxs("label",{style:Qv,children:["Headline — at most ",tb," words (§35)"]}),u.jsx("input",{"data-testid":"cover-text-input",type:"text",value:s,onChange:R=>a(R.target.value),style:Jv}),S.trimmed?u.jsxs("div",{"data-testid":"cover-headline-preview",style:{...Zo,marginTop:6},children:["Will render as: “",S.preview,"”"]}):null]}),u.jsxs("div",{style:{marginTop:16},children:[u.jsx("label",{style:Qv,children:"Frame"}),u.jsxs("div",{style:ey,children:[u.jsx("button",{"data-testid":"cover-playhead-btn",style:id,onClick:()=>c(t().toFixed(2)),disabled:x,children:"Use current playhead"}),u.jsx("input",{"data-testid":"cover-at-input",type:"text",inputMode:"decimal",placeholder:"seconds — blank keeps the current still",value:l,onChange:R=>c(R.target.value),style:{...Jv,flex:1}})]}),b.ok?null:u.jsx("div",{"data-testid":"cover-at-error",style:sd,children:b.message}),u.jsx("div",{style:{...ey,marginTop:10},children:["final","source"].map(R=>{const F=R==="source"&&!E.enabled;return u.jsx("button",{"data-testid":`cover-from-${R}`,style:{...id,...f===R?CL:{},...F?{opacity:.5,cursor:"default"}:{}},onClick:()=>p(R),disabled:x||F,"aria-pressed":f===R,children:R==="final"?"Finished video":"Original take"},R)})}),u.jsx("div",{"data-testid":"cover-from-note",style:{...Zo,marginTop:6},children:hL(f)}),E.note?u.jsx("div",{"data-testid":"cover-from-disabled-note",style:{...Zo,marginTop:4},children:E.note}):null,u.jsx("div",{style:{...Zo,marginTop:4},children:"Leave the seconds blank and the cover re-uses the still it already has — no frame extraction at all, and this choice does not apply."})]}),y.length>0?u.jsx("div",{"data-testid":"cover-notes",style:{...Zo,marginTop:12},children:y.map(R=>u.jsx("div",{children:R},R))}):null,k?u.jsx("div",{"data-testid":"cover-error",style:sd,children:k}):null,u.jsxs("div",{style:IL,children:[u.jsx("div",{style:Zo,children:n.outPath?`Writes ${n.outPath} — the video itself is untouched.`:"The video itself is untouched."}),u.jsxs("div",{style:{display:"flex",gap:8},children:[u.jsx("button",{"data-testid":"cover-cancel-btn",style:id,onClick:e,children:"Cancel"}),u.jsx("button",{"data-testid":"cover-apply-btn",style:{...TL,...x||!b.ok?{opacity:.6,cursor:"default"}:{}},onClick:()=>void T(),disabled:x||!b.ok,children:x?"Rebuilding…":"Apply"})]})]})]})]})})},vL={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},yL={width:560,maxWidth:"92vw",maxHeight:"90vh",overflowY:"auto",background:"#12121A",border:"1px solid #3A3A48",borderRadius:10,padding:"24px 28px",boxShadow:"0 20px 40px rgba(0,0,0,0.6)",fontFamily:"ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},wL={display:"flex",justifyContent:"space-between",alignItems:"center"},xL={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},bL={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},qv={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},SL={marginTop:16,border:"1px solid #2C2C38",borderRadius:6,background:"#09090D",maxHeight:320,minHeight:180,display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},kL={maxWidth:"100%",maxHeight:320,objectFit:"contain"},EL={color:"#8B8B9E",fontSize:13,padding:16,textAlign:"center"},Qv={display:"block",fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.04em"},Jv={width:"100%",boxSizing:"border-box",background:"#09090D",border:"1px solid #2C2C38",borderRadius:6,padding:"10px 14px",color:"#EDEDF2",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",outline:"none"},ey={display:"flex",alignItems:"center",gap:8},id={background:"transparent",border:"1px solid #3A3A48",borderRadius:6,color:"#C9C9D4",padding:"9px 12px",fontSize:12,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap"},CL={borderColor:"#5b8cff",color:"#EDEDF2"},sd={marginTop:12,color:"#FF5C5C",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",whiteSpace:"pre-wrap"},IL={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,marginTop:20},Zo={fontSize:12,color:"#8B8B9E",lineHeight:1.4,wordBreak:"break-all"},TL={background:"#00E5A3",border:"none",borderRadius:6,color:"#051A13",padding:"9px 20px",fontSize:13,fontWeight:700,cursor:"pointer",whiteSpace:"nowrap",boxShadow:"0 2px 10px rgba(0,229,163,0.3)"};function tl(e){for(let t=e.length-1;t>=0;t--){const n=/^\s*(\d{1,3})%\s*$/.exec(e[t]);if(n)return Math.min(100,Number(n[1]))}return null}function RL(e){const t=n=>{for(let r=e.length-1;r>=0;r--)if(n.test(e[r]))return e[r]};return[t(/^▸ producing scenes/),t(/^▸ llm:/)].filter(n=>n!==void 0)}function ty(e,t){const n=Math.max(0,Math.floor((t-e)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function jL(e,t){return e?{load:e,notifyDiscard:t}:{load:null,notifyDiscard:!1}}function PL(e,t){return e===null||e===t}function FL(e){const t=e.lines??[];return e.running?{running:!0,lines:t,startedAt:e.startedAt,resumed:!0}:e.exitCode===null||t.length===0?null:e.exitCode===0?{running:!1,lines:t,succeeded:!0,startedAt:e.startedAt,resumed:!0}:{running:!1,lines:t,failed:e.exitCode,cancelled:e.cancelled,startedAt:e.startedAt,resumed:!0}}function _L(e){if(e.dirty){if(e.renderRunning){e.onBlocked();return}e.save().catch(t=>e.onSaveError(t instanceof Error?t.message:String(t)))}}function ML(e,t,n=r=>r){const{cues:r}=Tf(e,t);return dh(r,t.splits).filter(i=>{var s;return((s=t.scenes[i.id])==null?void 0:s.hidden)===!0}).map(i=>({...i,startSec:n(i.startSec),endSec:n(i.endSec)}))}const ny=e=>({...e,...CA(e)}),ry=e=>{const t=Ib(e);e.forEach((n,r)=>{console.warn(`ossclip §137: dropped caption edit ${JSON.stringify(n)} — ${t[r]}`)})},$L=()=>{const e=kA(),t=d.useRef(e.dirty);t.current=e.dirty;const[n,r]=d.useState(!1),[o,i]=d.useState(!1),[s,a]=d.useState(null),[l,c]=d.useState(null),[f,p]=d.useState([]),[h,m]=d.useState([]),x=d.useRef(e.doc.captions);x.current=e.doc.captions;const[v,k]=d.useState(null),[g,y]=d.useState(null),[w,b]=d.useState(null),[S,E]=d.useState([]),[T,I]=d.useState(null),[R,F]=d.useState(null),[A,W]=d.useState(!1),[M,$]=d.useState(1),[V,D]=d.useState(null),[L,j]=d.useState(!1),[C,P]=d.useState([]),[N,B]=d.useState(null),z=d.useRef(null),[Z,H]=d.useState(!1),[G,O]=d.useState(null),[X,ae]=d.useState(!1),[oe,Y]=d.useState(),q=d.useRef(null);d.useEffect(()=>()=>{q.current!==null&&window.clearInterval(q.current)},[]);const[xe,Se]=d.useState(null),de=d.useRef(null),K=d.useRef(null),ee=d.useRef(null),ue=d.useRef(null),[se,Re]=d.useState(null),[Ie,ze]=d.useState(null),Je=d.useCallback(Q=>{var Oe;if(ee.current=Q,ze(Q),(Oe=ue.current)==null||Oe.disconnect(),ue.current=null,!Q)return;const te=()=>Re({w:Math.max(0,Q.clientWidth-ld*2),h:Math.max(0,Q.clientHeight-ld*2)});te();const ce=new ResizeObserver(te);ce.observe(Q),ue.current=ce},[]),[ke,Ee]=d.useState(1),je=d.useRef(ke);je.current=ke;const _e=d.useRef(null),Le=d.useCallback((Q,te)=>{const ce=ee.current,Oe=Math.min(8,Math.max(.25,Q)),mt=je.current;if(ce&&Oe!==mt){const Ct=ce.getBoundingClientRect();_e.current={prev:mt,ax:((te==null?void 0:te.x)??Ct.left+Ct.width/2)-Ct.left,ay:((te==null?void 0:te.y)??Ct.top+Ct.height/2)-Ct.top,sl:ce.scrollLeft,st:ce.scrollTop}}Ee(Oe)},[]);d.useLayoutEffect(()=>{const Q=ee.current,te=_e.current;if(!Q||!te)return;_e.current=null;const ce=ke/te.prev;Q.scrollLeft=(te.sl+te.ax)*ce-te.ax,Q.scrollTop=(te.st+te.ay)*ce-te.ay},[ke]),d.useEffect(()=>{const Q=Ie;if(!Q)return;const te=ce=>{(ce.ctrlKey||ce.metaKey)&&(ce.preventDefault(),Le(je.current*Math.exp(-ce.deltaY*.01),{x:ce.clientX,y:ce.clientY}))};return Q.addEventListener("wheel",te,{passive:!1}),()=>Q.removeEventListener("wheel",te)},[Ie,Le]);const dt=d.useRef(null);d.useEffect(()=>{const Q=ce=>{const Oe=dt.current,mt=ee.current;!Oe||!mt||(mt.scrollLeft=Oe.sl-(ce.clientX-Oe.x),mt.scrollTop=Oe.st-(ce.clientY-Oe.y))},te=()=>{dt.current=null};return window.addEventListener("mousemove",Q),window.addEventListener("mouseup",te),()=>{window.removeEventListener("mousemove",Q),window.removeEventListener("mouseup",te)}},[]);const[Zt,hn]=d.useState(!1),[Un,_t]=d.useState(()=>{const Q=Number(window.localStorage.getItem(iy));return Number.isFinite(Q)&&Q>0?sy(Q):300}),Zn=d.useRef(null);d.useEffect(()=>{const Q=ce=>{const Oe=Zn.current;Oe&&_t(sy(Oe.startW+(ce.clientX-Oe.startX)))},te=()=>{Zn.current&&(Zn.current=null,_t(ce=>(window.localStorage.setItem(iy,String(ce)),ce)))};return window.addEventListener("mousemove",Q),window.addEventListener("mouseup",te),()=>{window.removeEventListener("mousemove",Q),window.removeEventListener("mouseup",te)}},[]);const[Kt,mn]=d.useState(!1),[Yt,ft]=d.useState(!1),[gn,zt]=d.useState(!1),[Pn,Kn]=d.useState(!1),[Fn,Ir]=d.useState(!1),[lr,ur]=d.useState(!1);d.useEffect(()=>{if(!Pn)return;const Q=te=>{te.key==="Escape"&&(te.stopPropagation(),Kn(!1))};return window.addEventListener("keydown",Q,!0),()=>window.removeEventListener("keydown",Q,!0)},[Pn]);const[_,U]=d.useState(null),[re,fe]=d.useState(null),[we,be]=d.useState(!0),Pe=d.useCallback(Q=>{const te=Fj({rate:M,playing:A},Q);$(te.rate);const ce=K.current;ce&&(te.playing&&!A&&ce.play(),!te.playing&&A&&ce.pause())},[M,A]);d.useEffect(()=>{const Q=K.current;if(!Q)return;const te=()=>W(!0),ce=()=>W(!1);return Q.addEventListener("play",te),Q.addEventListener("pause",ce),()=>{Q.removeEventListener("play",te),Q.removeEventListener("pause",ce)}});const Me=d.useCallback(()=>{if(q.current!==null)return;const Q=window.setInterval(()=>{(async()=>{try{const ce=await(await fetch("/api/render/status")).json();if(ce.running||ce.exitCode===null){O(Oe=>({running:ce.running,lines:ce.lines??[],startedAt:ce.startedAt??(Oe==null?void 0:Oe.startedAt)}));return}if(q.current!==null&&(window.clearInterval(q.current),q.current=null),ce.exitCode===0){const mt=await(await fetch("/api/production")).json(),Ct=ny(mt.renderProps);y(Ct),H(!!mt.canRender);const No=jL(mt.overrides,t.current);if(No.load){const Yn=x.current,vn=fv(No.load,Ct);e.load(vn.doc),ry(vn.unresolved),p(vn.unresolved);const yn=RA(TA(Yn,vn.doc.captions));for(const rc of yn)console.warn(`ossclip §137: ${rc}`);m(yn)}else p([]),m([]);No.notifyDiscard&&r(!0),O(Yn=>({running:!1,lines:ce.lines??[],succeeded:!0,startedAt:ce.startedAt??(Yn==null?void 0:Yn.startedAt),finishedAt:Date.now()})),fetch("/api/reveal-output",{method:"POST"}).catch(()=>{})}else O({running:!1,lines:ce.lines??[],failed:ce.exitCode,cancelled:ce.cancelled})}catch{q.current===null&&Me()}})()},1e3);q.current=Q},[]),Ve=d.useCallback(async()=>{const Q=await fetch("/api/production");if(!Q.ok)throw new Error(`GET /api/production failed: ${Q.status}`);const te=await Q.json();if(te.defaultOutPath&&Y(te.defaultOutPath),P(te.recent??[]),te.noWorkdir){p([]),m([]),j(!0);return}const ce=ny(te.renderProps);y(ce);const Oe=z.current,mt=te.workdir??null;z.current=mt,B(mt),H(!!te.canRender);const Ct=fv(te.overrides,ce);e.load(Ct.doc),ry(Ct.unresolved),p(Ct.unresolved),m([]),fetch("/api/usage").then(async yn=>b(yn.ok?await yn.json():null)).catch(()=>b(null)),fetch("/api/cleanup").then(async yn=>E(yn.ok?(await yn.json()).cutlist??[]:[])).catch(()=>E([]));const Yn=await(await fetch("/api/render/status")).json(),vn=PL(Oe,mt)?FL(Yn):null;vn&&(O(vn),vn.running?Me():be(!1))},[Me]);d.useEffect(()=>{Ve().catch(Q=>I(Q instanceof Error?Q.message:String(Q)))},[]);const De=d.useCallback(async Q=>{if(e.dirty&&!window.confirm("Unsaved edits will be lost — switch projects anyway?"))return null;try{const te=await fetch("/api/workdir",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:Q})}),ce=await te.json().catch(()=>({}));return te.ok?(F(null),D(null),Se(null),O(null),Ee(1),y(null),j(!1),await Ve(),null):ce.error??`open failed: ${te.status}`}catch(te){return te instanceof Error?te.message:String(te)}},[e.dirty,Ve]),ge=d.useMemo(()=>{if(!g)return{lines:[],dropped:[]};const Q=g.baseCaptionLines??g.captionLines??[];return u$(Q,IA(e.doc.captions))},[g,e.doc.captions]),Ce=d.useMemo(()=>g?d$(ge.lines,e.doc.captionRangeEdits):{lines:[],dropped:[]},[g,ge,e.doc.captionRangeEdits]),Et=d.useMemo(()=>g?f$(Ce.lines,e.doc.captionWordsHidden):{lines:[],dropped:[]},[g,Ce,e.doc.captionWordsHidden]),_n=d.useMemo(()=>g?X1(Et.lines,e.doc.captionLineTiming):{lines:[],dropped:[]},[g,Et,e.doc.captionLineTiming]),Qu=d.useMemo(()=>Ib(f),[f]),Wi=d.useMemo(()=>[...jA(ge.dropped),...FA(Ce.dropped),...PA(Et.dropped),..._A(_n.dropped)],[ge,Ce,Et,_n]),Ju=Wi.join(`
|
|
163
|
-
`),Nb=Wi.length>0&&Ju!==v;d.useEffect(()=>{if(Wi.length!==0)for(const Q of Wi)console.warn(`ossclip §137: ${Q}`)},[Ju]);const cr=d.useMemo(()=>g?M$(S,e.doc.cleanup,e.doc.cuts,g.spans??[]):null,[g,S,e.doc.cleanup,e.doc.cuts]),Mn=d.useMemo(()=>$$(cr),[cr]),Tr=d.useMemo(()=>{if(!g)return null;const Q=(g.baseSceneCues??g.sceneCues??[]).filter(wn=>wn.kind!=="plain"),te=g.baseTheme??g.theme??_M,{cues:ce}=Tf(Q,e.doc),{cues:Oe}=o$(ce,e.doc),mt=b$(Oe,{outputDurationSec:g.outputDurationSec,clipStarts:(g.spans??[]).map(wn=>wn.outIn)}),Ct=dh(mt,e.doc.splits),{cues:No}=Tf(Ct,e.doc),{cues:Yn}=G1(No,e.doc);let vn=V?Yn.map(wn=>wn.id===V.sceneId?{...wn,video:{...wn.video,...V.patch}}:wn):Yn;xe&&(vn=vn.map(wn=>wn.id===xe.sceneId?{...wn,graphicRect:xe.rect}:wn));const yn={...g,sceneCues:vn,captionLines:_n.lines,theme:h$(te,e.doc),captionsHidden:g.captionsHiddenByFlag===!0||e.doc.captionsHidden===!0,videoFileName:`/media/${g.videoFileName}`};if(!cr)return{props:yn,reports:[]};const{fields:rc,reports:Wb}=A$(yn,cr.oldMap,cr.newMap);return{props:{...yn,...rc},reports:Wb}},[g,e.doc,V,xe,_n,cr]),$e=Tr===null?null:Tr.props,Lb=((Tr==null?void 0:Tr.reports)??[]).join(`
|
|
164
|
-
`);d.useEffect(()=>{if(!(!Tr||Tr.reports.length===0))for(const Q of Tr.reports)console.warn(`ossclip cut preview: ${Q}`)},[Lb]);const ec=d.useRef(null);d.useEffect(()=>{if(!g){ec.current=null;return}const Q=cr?cr.newMap:Xu(g.spans??[]),te=ec.current;if(ec.current={props:g,map:Q},!te||te.props!==g||J1(te.map,Q,1e-6))return;const ce=K.current;if(!ce)return;const Oe=g.settings.fps,mt=te.map.toSource(ce.getCurrentFrame()/Oe),Ct=Q.toOutput(mt)??Q.toOutputClamped(mt);ce.seekTo(Math.round(Ct*Oe))},[cr,g]);const yh=()=>{_L({dirty:e.dirty,renderRunning:(G==null?void 0:G.running)===!0,save:e.save,onBlocked:()=>i(!0),onSaveError:Q=>I(Q)})},wh=d.useCallback(async Q=>{try{e.dirty&&await e.save();const te=await fetch("/api/render",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Q?{out:Q}:{})});if(!te.ok){const ce=await te.json().catch(()=>({}));throw new Error(ce.error??`render failed to start: ${te.status}`)}O({running:!0,lines:[],startedAt:Date.now()}),be(!0),a(null),Me()}catch(te){a(te instanceof Error?te.message:String(te))}},[e,Me]),tc=d.useMemo(()=>{if(!g)return[];const Q=(g.baseSceneCues??g.sceneCues??[]).filter(te=>te.kind!=="plain");return ML(Q,e.doc,Mn.toLive)},[g,e.doc,Mn]),Rr=d.useMemo(()=>R?($e==null?void 0:$e.sceneCues.find(Q=>Q.id===R.sceneId))??tc.find(Q=>Q.id===R.sceneId)??null:null,[$e,R,tc]),Db=d.useMemo(()=>{if(!Rr||!$e)return;const Q=$e.captionLines.filter(ce=>ce.start<Rr.endSec&&ce.end>Rr.startSec).flatMap(ce=>ce.words).filter(ce=>ce.start<Rr.endSec&&ce.end>Rr.startSec).map(ce=>ce.text);if(Q.length===0)return;const te=Q.join(" ");return te.length>90?`${te.slice(0,90)}…`:te},[Rr,$e]);if(T)return u.jsx("div",{style:ad,children:u.jsxs("div",{style:{padding:24,color:"#FF5C5C",fontFamily:"ui-monospace, monospace"},children:["Couldn't load the production: ",T]})});if(!$e)return u.jsx("div",{style:ad,children:L?u.jsx($v,{recent:C,required:!0,onOpen:De,onClose:()=>{}}):u.jsx("div",{style:{padding:24,color:"#9A9AA3"},children:"Loading production…"})});const zb=$e.settings.width/$e.settings.height,Ob=se?Math.max(220,Math.min(se.w,se.h*zb)):380,Bb=Math.round(Ob*ke),nc=u.jsx("button",{"data-testid":"render-logs-toggle",style:{...it,padding:"2px 8px"},onClick:()=>be(Q=>!Q),title:we?"Collapse the log":"Expand the log",children:we?"▾ logs":"▸ logs"});return u.jsxs("div",{style:ad,children:[u.jsxs("div",{style:DL,children:[u.jsx("span",{style:zL,children:"ossclip"}),N?u.jsx("span",{"data-testid":"workdir-label",style:OL,title:N,children:N.split("/").filter(Boolean).slice(-2).join("/")}):null,u.jsxs("div",{style:{display:"flex",gap:8},children:[u.jsx("button",{"data-testid":"open-button",style:it,onClick:()=>j(!0),title:N?`Open another project — currently ${N}`:"Open another project",children:"Open"}),u.jsx("button",{"data-testid":"undo-button",style:it,onClick:()=>e.undo(),disabled:!e.canUndo,title:"Undo (⌘Z)","aria-label":"Undo",children:u.jsx(NL,{})}),u.jsx("button",{"data-testid":"redo-button",style:it,onClick:()=>e.redo(),disabled:!e.canRedo,title:"Redo (⌘⇧Z)","aria-label":"Redo",children:u.jsx(LL,{})}),u.jsx("button",{"data-testid":"transcript-toggle",style:{...it,...Zt?{borderColor:"#5b8cff"}:{}},onClick:()=>hn(Q=>!Q),title:"Find and retype caption words across the whole transcript",children:"Transcript"}),u.jsx("button",{"data-testid":"cover-button",style:{...it,...Fn?{borderColor:"#5b8cff"}:{}},onClick:()=>Ir(!0),title:"Retype the cover headline or re-cut its frame — seconds, no re-render",children:"Cover"}),u.jsx("button",{"data-testid":"cleanup-button",style:{...it,...lr?{borderColor:"#5b8cff"}:{}},onClick:()=>ur(!0),title:"Review what produce removed — keep whole categories; the preview plays your choices immediately",children:"Cleanup"}),u.jsxs("div",{style:{position:"relative"},children:[u.jsx("button",{"data-testid":"youtube-menu",style:{...it,...Pn||Yt||gn?{borderColor:"#5b8cff"}:{}},onClick:()=>Kn(Q=>!Q),title:"AI thumbnail and SEO metadata for the YouTube upload","aria-haspopup":"menu","aria-expanded":Pn,children:"YouTube ▾"}),Pn?u.jsxs(u.Fragment,{children:[u.jsx("div",{style:VL,onMouseDown:()=>Kn(!1)}),u.jsxs("div",{style:HL,role:"menu",children:[u.jsx("button",{"data-testid":"youtube-menu-thumbnail",style:oy,role:"menuitem",onClick:()=>{Kn(!1),ft(!0)},children:"Thumbnail"}),u.jsx("button",{"data-testid":"youtube-menu-seo",style:oy,role:"menuitem",onClick:()=>{Kn(!1),zt(!0)},children:"SEO metadata"})]})]}):null]}),u.jsx("button",{style:{...it,...e.dirty?WL:{}},onClick:yh,disabled:!e.dirty||(G==null?void 0:G.running)===!0,title:(G==null?void 0:G.running)===!0?"Can't save while a render is running":void 0,children:"Save"}),u.jsxs("div",{style:{display:"inline-flex",alignItems:"center"},children:[u.jsx("button",{"data-testid":"render-button",style:{...it,borderTopRightRadius:0,borderBottomRightRadius:0,borderRight:"none"},onClick:()=>void wh(),disabled:!Z||(G==null?void 0:G.running)===!0,title:Z?"Saves if needed, then replays the last completed produce command — pipeline flags come from that run; your saved edits apply on top":"No command.json in this workdir — run `ossclip produce` once in a terminal; it records the invocation and Render replays it",children:G!=null&&G.running?"Rendering…":"Render"}),u.jsx("button",{"data-testid":"render-destination-button",style:{...it,borderTopLeftRadius:0,borderBottomLeftRadius:0,padding:"7px 8px"},onClick:()=>ae(!0),disabled:!Z||(G==null?void 0:G.running)===!0,title:"Choose export file destination (Browse…)",children:"▾"})]})]}),u.jsx("span",{style:{...BL,color:e.dirty?"#FFE14D":"#5FBF77"},...e.dirty?{"data-testid":"dirty"}:{},children:e.dirty?"● Unsaved changes":"✓ Saved"}),u.jsx("button",{"data-testid":"shortcuts-button",style:{...it,padding:"7px 10px"},onClick:()=>mn(Q=>!Q),title:"Keyboard shortcuts (?)",children:"?"})]}),Kt?u.jsx(rN,{onClose:()=>mn(!1)}):null,Yt?u.jsx(S5,{onClose:()=>ft(!1)}):null,lr?u.jsx(N5,{cutlist:S,edits:e,onClose:()=>ur(!1)}):null,gn?u.jsx(J5,{onClose:()=>zt(!1)}):null,Fn?u.jsx(gL,{onClose:()=>Ir(!1),playheadSec:()=>{var Q;return Mn.fromLive((((Q=K.current)==null?void 0:Q.getCurrentFrame())??0)/$e.settings.fps)}}):null,X?u.jsx(i5,{defaultOutPath:oe,onCancel:()=>ae(!1),onConfirm:Q=>{ae(!1),wh(Q)}}):null,_?u.jsx(hN,{plan:_,onCancel:()=>U(null),onConfirm:Q=>{if(Q==="graphic")e.hideScene(_.sceneId);else{const te=ob(Mn,_.startSec,_.endSec);te.kind==="degenerate"?c("Can't cut this window: it isn't in the last render yet — render once (or re-remove the pause) to cut it."):(te.kind==="shrunk"&&console.warn(`ossclip cut preview: ${te.report}`),e.cutChunk(te.startSec,te.endSec))}U(null)}}):null,re?u.jsx(RN,{plan:re,onCancel:()=>fe(null),onConfirm:Q=>{Q==="caption"?e.hideCaptionWords(re.words):e.cutWords(re.words,re.startSec,re.endSec),fe(null)}}):null,L?u.jsx($v,{recent:C,required:!1,onOpen:De,onClose:()=>j(!1)}):null,G?u.jsxs("div",{"data-testid":"render-log",style:{...JL,borderColor:G.failed!==void 0?"#FF5C5C":"#2A2A33"},children:[G.failed!==void 0?u.jsxs("div",{style:{color:G.cancelled?"#9A9AA3":"#FF5C5C",marginBottom:4},"data-testid":G.cancelled?"render-cancelled":"render-failed",children:[G.cancelled?"render cancelled":`render failed (exit ${G.failed})`,u.jsx("button",{style:{...it,marginLeft:10,padding:"2px 8px"},onClick:()=>O(null),children:"Dismiss"}),u.jsx("span",{style:{marginLeft:6},children:nc})]}):null,G.succeeded?u.jsxs("div",{"data-testid":"render-succeeded",style:ay,children:[u.jsxs("span",{style:{color:"#5FBF77"},children:["✓ done",G.startedAt!=null&&G.finishedAt!==void 0?` · ${ty(G.startedAt,G.finishedAt)}`:""]}),u.jsx("button",{"data-testid":"render-open-folder",style:{...it,padding:"2px 8px"},onClick:()=>void fetch("/api/reveal-output",{method:"POST"}).catch(()=>{}),title:"Reveal the rendered file in your file manager",children:"Open folder"}),u.jsx("button",{style:{...it,padding:"2px 8px"},onClick:()=>O(null),children:"Dismiss"}),nc]}):null,G.running?u.jsxs("div",{"data-testid":"render-status",style:ay,children:[u.jsx("style",{children:"@keyframes ossclip-spin { to { transform: rotate(360deg) } }"}),u.jsx("span",{style:eD,"aria-hidden":!0}),u.jsxs("span",{style:{color:"#EDEDF2"},children:["rendering",G.startedAt!=null?` · ${ty(G.startedAt,Date.now())}`:"",tl(G.lines)!==null?` · ${tl(G.lines)}%`:""]}),tl(G.lines)!==null?u.jsx("div",{style:tD,children:u.jsx("div",{"data-testid":"render-progress-bar",style:{...nD,width:`${tl(G.lines)}%`}})}):null,u.jsx("button",{"data-testid":"render-cancel",style:{...it,padding:"2px 8px"},onClick:()=>void fetch("/api/render/cancel",{method:"POST"}),children:"Cancel"}),nc]}):null,we?u.jsxs(u.Fragment,{children:[RL(G.lines).map(Q=>u.jsx("div",{"data-testid":"render-pinned",style:{color:"#C9C9D4"},children:Q},Q)),u.jsx(AL,{lines:G.lines})]}):null]}):null,n?u.jsxs("div",{"data-testid":"reanchor-notice",style:Ko,children:["Render re-anchored your saved cuts and splits — edits made while it ran were dropped, not merged, to avoid overwriting that anchor.",u.jsx("button",{style:{...it,marginLeft:10,padding:"2px 8px"},onClick:()=>r(!1),children:"Dismiss"})]}):null,Qu.length>0||h.length>0?u.jsxs("div",{"data-testid":"caption-migration-notice",style:Ko,children:[[...Qu,...h].map((Q,te)=>u.jsx("div",{children:Q},te)),u.jsx("button",{style:{...it,marginLeft:10,padding:"2px 8px"},onClick:()=>{p([]),m([])},children:"Dismiss"})]}):null,Nb?u.jsxs("div",{"data-testid":"caption-dropped-notice",style:Ko,children:[Wi.map((Q,te)=>u.jsx("div",{children:Q},te)),u.jsx("button",{style:{...it,marginLeft:10,padding:"2px 8px"},onClick:()=>k(Ju),children:"Dismiss"})]}):null,o?u.jsxs("div",{"data-testid":"save-blocked-notice",style:Ko,children:["Can't save while a render is running — it's writing its own overrides.json right now. Wait for it to finish (or cancel it) before saving.",u.jsx("button",{style:{...it,marginLeft:10,padding:"2px 8px"},onClick:()=>i(!1),children:"Dismiss"})]}):null,s!==null?u.jsxs("div",{"data-testid":"render-refused-notice",style:Ko,children:["Render didn't start: ",s,u.jsx("button",{style:{...it,marginLeft:10,padding:"2px 8px"},onClick:()=>a(null),children:"Dismiss"})]}):null,l!==null?u.jsxs("div",{"data-testid":"clock-refused-notice",style:Ko,children:[l,u.jsx("button",{style:{...it,marginLeft:10,padding:"2px 8px"},onClick:()=>c(null),children:"Dismiss"})]}):null,u.jsxs("div",{style:UL,children:[Zt?u.jsxs(u.Fragment,{children:[u.jsx(M3,{baseLines:(g==null?void 0:g.baseCaptionLines)??(g==null?void 0:g.captionLines)??[],liveLines:Ce.lines,timingLines:Et.lines,fps:$e.settings.fps,playerRef:K,edits:e,onDeleteWords:fe,width:Un,workdir:N,toPlayerSec:Mn.toLive,fromPlayerSec:Mn.fromLive}),u.jsx("div",{"data-testid":"transcript-divider",style:ZL,title:"Drag to resize the transcript pane",onMouseDown:Q=>{Q.preventDefault(),Zn.current={startX:Q.clientX,startW:Un}}})]}):null,u.jsxs("div",{style:KL,children:[u.jsx("div",{ref:Je,style:YL,onMouseDown:Q=>{if(Q.altKey||Q.button===1){Q.preventDefault();const te=ee.current;te&&(dt.current={x:Q.clientX,y:Q.clientY,sl:te.scrollLeft,st:te.scrollTop})}},children:u.jsx("div",{style:{margin:"auto",padding:ld},children:u.jsxs("div",{ref:de,"data-testid":"stage","data-playing":A?"true":"false","data-rate":M,style:{position:"relative",display:"inline-block"},children:[u.jsx(Ej,{ref:K,component:wA,inputProps:$e,durationInFrames:Math.max(1,Math.round($e.outputDurationSec*$e.settings.fps)),fps:$e.settings.fps,compositionWidth:$e.settings.width,compositionHeight:$e.settings.height,style:{width:Bb},controls:!0,clickToPlay:!1,playbackRate:M}),u.jsx(OA,{stageRef:de,selection:R,onSelect:F,edits:e,onSave:yh,settings:$e.settings,cues:$e.sceneCues,playerRef:K,cue:Rr,onTransport:Pe,onVideoPreview:D,onGraphicPreview:Se,onToggleHelp:()=>mn(Q=>!Q),onRequestDelete:U,fromLive:Mn.fromLive,hasOldClockPreimage:Mn.hasOldClockPreimage,onClockRefused:c}),u.jsx("button",{"data-testid":"rate-chip",onClick:()=>Pe("L"),title:"Playback rate — click to speed up (J/K/L on the keyboard)",style:rD,children:M<0?`◂◂ ${Math.abs(M)}×`:`${M}×`})]})})}),u.jsxs("div",{style:GL,children:[u.jsx("button",{"data-testid":"view-zoom-out",style:ud,onClick:()=>Le(ke/2),disabled:ke<=.25,title:"Zoom the preview out — below 100% shrinks under the fitted size",children:"−"}),u.jsxs("span",{"data-testid":"view-zoom-level",style:XL,children:[Math.round(ke*100),"%"]}),u.jsx("button",{"data-testid":"view-zoom-in",style:ud,onClick:()=>Le(ke*2),disabled:ke>=8,title:"Zoom the preview in — a viewing magnifier, it never edits the video",children:"+"}),u.jsx("button",{"data-testid":"view-zoom-fit",style:{...ud,width:"auto",padding:"0 8px"},onClick:()=>Le(1),disabled:Math.abs(ke-1)<.001,title:"Fit the preview to the window",children:"fit"}),u.jsx("span",{style:qL,children:"⌥-drag pans"})]})]}),u.jsx("div",{style:QL,children:u.jsx(WA,{selection:R,cue:Rr,frame:{width:$e.settings.width,height:$e.settings.height},allSceneIds:$e.sceneCues.map(Q=>Q.id),edits:e,onSelect:F,resolvedTheme:$e.theme,anchorText:Db,onVideoPreview:D,runInfo:w,captionsHiddenByFlag:(g==null?void 0:g.captionsHiddenByFlag)===!0,fromLive:Mn.fromLive,hasOldClockPreimage:Mn.hasOldClockPreimage,onClockRefused:c})})]}),u.jsx(s3,{cues:$e.sceneCues,ghosts:tc,cuts:e.doc.cuts,spans:$e.spans??[],cleanup:S,durationSec:$e.outputDurationSec,fps:$e.settings.fps,playerRef:K,selection:R,onSelect:F,edits:e,videoSrc:$e.videoFileName,toLive:Mn.toLive,toSourceSec:Q=>{var te;for(const ce of $e.spans??[])if(Q>=ce.outIn&&Q<ce.outOut)return ce.srcIn+(Q-ce.outIn);return((te=($e.spans??[])[0])==null?void 0:te.srcIn)??Q}})]})},AL=({lines:e})=>{const t=d.useRef(null),n=d.useRef(!0);return d.useEffect(()=>{const r=t.current;r&&n.current&&(r.scrollTop=r.scrollHeight)},[e]),u.jsx("div",{ref:t,"data-testid":"render-tail",onScroll:r=>{const o=r.currentTarget;n.current=o.scrollTop+o.clientHeight>=o.scrollHeight-8},style:{maxHeight:220,overflowY:"auto"},children:e.map((r,o)=>u.jsx("div",{children:r},o))})},NL=()=>u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{display:"block"},children:[u.jsx("path",{d:"M9 14 4 9l5-5"}),u.jsx("path",{d:"M4 9h10.5a5.5 5.5 0 0 1 0 11H11"})]}),LL=()=>u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{display:"block"},children:[u.jsx("path",{d:"m15 14 5-5-5-5"}),u.jsx("path",{d:"M20 9H9.5a5.5 5.5 0 0 0 0 11H13"})]}),ad={fontFamily:"'Inter', system-ui, sans-serif",background:"#0B0B0E",color:"#EDEDF2",height:"100vh",overflow:"hidden",display:"flex",flexDirection:"column"},DL={display:"flex",alignItems:"center",gap:14,padding:"10px 20px",borderBottom:"1px solid #1E1E24",background:"#111116"},zL={fontWeight:800,fontSize:14,letterSpacing:"0.02em",color:"#FFE14D",marginRight:8},OL={fontSize:12,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#6a6a75",maxWidth:260,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},BL={fontSize:12,fontFamily:"ui-monospace, 'SF Mono', monospace",marginLeft:"auto"},it={fontSize:12,fontWeight:600,color:"#EDEDF2",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:6,padding:"7px 12px",cursor:"pointer"},WL={background:"#FFE14D",color:"#0B0B0E",border:"1px solid #FFE14D"},VL={position:"fixed",inset:0,zIndex:30},HL={position:"absolute",top:"calc(100% + 4px)",left:0,zIndex:31,minWidth:150,background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:6,padding:4,boxShadow:"0 10px 24px rgba(0,0,0,0.5)",display:"flex",flexDirection:"column"},oy={fontSize:12,fontWeight:600,color:"#EDEDF2",background:"transparent",border:"none",borderRadius:4,padding:"8px 10px",cursor:"pointer",textAlign:"left"},UL={display:"flex",flex:1,minHeight:0},ld=32,iy="ossclip.transcriptWidth",sy=e=>Math.min(640,Math.max(220,e)),ZL={width:5,flexShrink:0,cursor:"col-resize",background:"#1E1E24",borderLeft:"1px solid #2A2A33"},KL={position:"relative",flex:1,minWidth:0},YL={position:"absolute",inset:0,display:"flex",overflow:"auto"},GL={position:"absolute",top:10,left:10,zIndex:6,display:"flex",alignItems:"center",gap:6,padding:"4px 6px",background:"rgba(17,17,22,0.85)",border:"1px solid #2A2A33",borderRadius:6},ud={width:22,height:18,fontSize:12,lineHeight:1,color:"#EDEDF2",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:4,cursor:"pointer",padding:0},XL={fontSize:10,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#9A9AA3",minWidth:34,textAlign:"center"},qL={fontSize:10,color:"#55555f",userSelect:"none"},QL={width:260,flexShrink:0,borderLeft:"1px solid #1E1E24",background:"#111116",overflowY:"auto"},JL={fontSize:11,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#9A9AA3",background:"#0F0F14",borderBottom:"1px solid #2A2A33",padding:"6px 20px",whiteSpace:"pre-wrap",flexShrink:0},Ko={display:"flex",alignItems:"center",fontSize:12,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#FFE14D",background:"#0F0F14",borderBottom:"1px solid #2A2A33",padding:"6px 20px",flexShrink:0},ay={display:"flex",alignItems:"center",gap:10,marginBottom:4},eD={width:12,height:12,flexShrink:0,border:"2px solid #2A2A33",borderTopColor:"#FFE14D",borderRadius:"50%",animation:"ossclip-spin 0.8s linear infinite"},tD={flex:1,maxWidth:260,height:4,background:"#1E1E24",borderRadius:2,overflow:"hidden"},nD={height:"100%",background:"#FFE14D",borderRadius:2,transition:"width 0.6s ease"},rD={position:"absolute",top:8,right:8,zIndex:5,fontSize:11,fontWeight:700,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#FFE14D",background:"rgba(11,11,14,0.75)",border:"1px solid #2A2A33",borderRadius:6,padding:"3px 8px",cursor:"pointer"};cd.createRoot(document.getElementById("root")).render(u.jsx(le.StrictMode,{children:u.jsx($L,{})}));
|