ossclip 0.1.25 → 0.1.26

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.
@@ -0,0 +1,163 @@
1
+ var ob=Object.defineProperty;var ib=(e,t,n)=>t in e?ob(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var $e=(e,t,n)=>ib(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 sb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Mv={exports:{}},Yl={},$v={exports:{}},ke={};/**
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 Bs=Symbol.for("react.element"),ab=Symbol.for("react.portal"),lb=Symbol.for("react.fragment"),ub=Symbol.for("react.strict_mode"),cb=Symbol.for("react.profiler"),db=Symbol.for("react.provider"),fb=Symbol.for("react.context"),pb=Symbol.for("react.forward_ref"),hb=Symbol.for("react.suspense"),mb=Symbol.for("react.memo"),gb=Symbol.for("react.lazy"),Jp=Symbol.iterator;function vb(e){return e===null||typeof e!="object"?null:(e=Jp&&e[Jp]||e["@@iterator"],typeof e=="function"?e:null)}var Av={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Nv=Object.assign,Lv={};function bi(e,t,n){this.props=e,this.context=t,this.refs=Lv,this.updater=n||Av}bi.prototype.isReactComponent={};bi.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")};bi.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function zv(){}zv.prototype=bi.prototype;function ff(e,t,n){this.props=e,this.context=t,this.refs=Lv,this.updater=n||Av}var pf=ff.prototype=new zv;pf.constructor=ff;Nv(pf,bi.prototype);pf.isPureReactComponent=!0;var eh=Array.isArray,Dv=Object.prototype.hasOwnProperty,hf={current:null},Ov={key:!0,ref:!0,__self:!0,__source:!0};function Bv(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)Dv.call(t,r)&&!Ov.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),u=0;u<a;u++)l[u]=arguments[u+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:Bs,type:e,key:i,ref:s,props:o,_owner:hf.current}}function yb(e,t){return{$$typeof:Bs,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function mf(e){return typeof e=="object"&&e!==null&&e.$$typeof===Bs}function wb(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var th=/\/+/g;function Vu(e,t){return typeof e=="object"&&e!==null&&e.key!=null?wb(""+e.key):t.toString(36)}function Ka(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 Bs:case ab:s=!0}}if(s)return s=e,o=o(s),e=r===""?"."+Vu(s,0):r,eh(o)?(n="",e!=null&&(n=e.replace(th,"$&/")+"/"),Ka(o,t,n,"",function(u){return u})):o!=null&&(mf(o)&&(o=yb(o,n+(!o.key||s&&s.key===o.key?"":(""+o.key).replace(th,"$&/")+"/")+e)),t.push(o)),1;if(s=0,r=r===""?".":r+":",eh(e))for(var a=0;a<e.length;a++){i=e[a];var l=r+Vu(i,a);s+=Ka(i,t,n,l,o)}else if(l=vb(e),typeof l=="function")for(e=l.call(e),a=0;!(i=e.next()).done;)i=i.value,l=r+Vu(i,a++),s+=Ka(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 sa(e,t,n){if(e==null)return e;var r=[],o=0;return Ka(e,r,"","",function(i){return t.call(n,i,o++)}),r}function xb(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},Ya={transition:null},bb={ReactCurrentDispatcher:Vt,ReactCurrentBatchConfig:Ya,ReactCurrentOwner:hf};function Wv(){throw Error("act(...) is not supported in production builds of React.")}ke.Children={map:sa,forEach:function(e,t,n){sa(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return sa(e,function(){t++}),t},toArray:function(e){return sa(e,function(t){return t})||[]},only:function(e){if(!mf(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};ke.Component=bi;ke.Fragment=lb;ke.Profiler=cb;ke.PureComponent=ff;ke.StrictMode=ub;ke.Suspense=hb;ke.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=bb;ke.act=Wv;ke.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=Nv({},e.props),o=e.key,i=e.ref,s=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,s=hf.current),t.key!==void 0&&(o=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)Dv.call(t,l)&&!Ov.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 u=0;u<l;u++)a[u]=arguments[u+2];r.children=a}return{$$typeof:Bs,type:e.type,key:o,ref:i,props:r,_owner:s}};ke.createContext=function(e){return e={$$typeof:fb,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:db,_context:e},e.Consumer=e};ke.createElement=Bv;ke.createFactory=function(e){var t=Bv.bind(null,e);return t.type=e,t};ke.createRef=function(){return{current:null}};ke.forwardRef=function(e){return{$$typeof:pb,render:e}};ke.isValidElement=mf;ke.lazy=function(e){return{$$typeof:gb,_payload:{_status:-1,_result:e},_init:xb}};ke.memo=function(e,t){return{$$typeof:mb,type:e,compare:t===void 0?null:t}};ke.startTransition=function(e){var t=Ya.transition;Ya.transition={};try{e()}finally{Ya.transition=t}};ke.unstable_act=Wv;ke.useCallback=function(e,t){return Vt.current.useCallback(e,t)};ke.useContext=function(e){return Vt.current.useContext(e)};ke.useDebugValue=function(){};ke.useDeferredValue=function(e){return Vt.current.useDeferredValue(e)};ke.useEffect=function(e,t){return Vt.current.useEffect(e,t)};ke.useId=function(){return Vt.current.useId()};ke.useImperativeHandle=function(e,t,n){return Vt.current.useImperativeHandle(e,t,n)};ke.useInsertionEffect=function(e,t){return Vt.current.useInsertionEffect(e,t)};ke.useLayoutEffect=function(e,t){return Vt.current.useLayoutEffect(e,t)};ke.useMemo=function(e,t){return Vt.current.useMemo(e,t)};ke.useReducer=function(e,t,n){return Vt.current.useReducer(e,t,n)};ke.useRef=function(e){return Vt.current.useRef(e)};ke.useState=function(e){return Vt.current.useState(e)};ke.useSyncExternalStore=function(e,t,n){return Vt.current.useSyncExternalStore(e,t,n)};ke.useTransition=function(){return Vt.current.useTransition()};ke.version="18.3.1";$v.exports=ke;var d=$v.exports;const oe=sb(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 Sb=d,kb=Symbol.for("react.element"),Eb=Symbol.for("react.fragment"),Cb=Object.prototype.hasOwnProperty,Ib=Sb.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Tb={key:!0,ref:!0,__self:!0,__source:!0};function Vv(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)Cb.call(t,r)&&!Tb.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:kb,type:e,key:i,ref:s,props:o,_owner:Ib.current}}Yl.Fragment=Eb;Yl.jsx=Vv;Yl.jsxs=Vv;Mv.exports=Yl;var c=Mv.exports,Kc={},Hv={exports:{}},dn={},Uv={exports:{}},Zv={};/**
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(C,A){var M=C.length;C.push(A);e:for(;0<M;){var D=M-1>>>1,B=C[D];if(0<o(B,A))C[D]=A,C[M]=B,M=D;else break e}}function n(C){return C.length===0?null:C[0]}function r(C){if(C.length===0)return null;var A=C[0],M=C.pop();if(M!==A){C[0]=M;e:for(var D=0,B=C.length,Z=B>>>1;D<Z;){var L=2*(D+1)-1,z=C[L],Q=L+1,G=C[Q];if(0>o(z,M))Q<B&&0>o(G,z)?(C[D]=G,C[Q]=M,D=Q):(C[D]=z,C[L]=M,D=L);else if(Q<B&&0>o(G,M))C[D]=G,C[Q]=M,D=Q;else break e}}return A}function o(C,A){var M=C.sortIndex-A.sortIndex;return M!==0?M:C.id-A.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=[],u=[],f=1,p=null,h=3,m=!1,w=!1,g=!1,k=typeof setTimeout=="function"?setTimeout:null,v=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 x(C){for(var A=n(u);A!==null;){if(A.callback===null)r(u);else if(A.startTime<=C)r(u),A.sortIndex=A.expirationTime,t(l,A);else break;A=n(u)}}function b(C){if(g=!1,x(C),!w)if(n(l)!==null)w=!0,O(S);else{var A=n(u);A!==null&&I(b,A.startTime-C)}}function S(C,A){w=!1,g&&(g=!1,v(R),R=-1),m=!0;var M=h;try{for(x(A),p=n(l);p!==null&&(!(p.expirationTime>A)||C&&!N());){var D=p.callback;if(typeof D=="function"){p.callback=null,h=p.priorityLevel;var B=D(p.expirationTime<=A);A=e.unstable_now(),typeof B=="function"?p.callback=B:p===n(l)&&r(l),x(A)}else r(l);p=n(l)}if(p!==null)var Z=!0;else{var L=n(u);L!==null&&I(b,L.startTime-A),Z=!1}return Z}finally{p=null,h=M,m=!1}}var E=!1,T=null,R=-1,P=5,$=-1;function N(){return!(e.unstable_now()-$<P)}function W(){if(T!==null){var C=e.unstable_now();$=C;var A=!0;try{A=T(!0,C)}finally{A?j():(E=!1,T=null)}}else E=!1}var j;if(typeof y=="function")j=function(){y(W)};else if(typeof MessageChannel<"u"){var _=new MessageChannel,H=_.port2;_.port1.onmessage=W,j=function(){H.postMessage(null)}}else j=function(){k(W,0)};function O(C){T=C,E||(E=!0,j())}function I(C,A){R=k(function(){C(e.unstable_now())},A)}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(C){C.callback=null},e.unstable_continueExecution=function(){w||m||(w=!0,O(S))},e.unstable_forceFrameRate=function(C){0>C||125<C?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<C?Math.floor(1e3/C):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function(C){switch(h){case 1:case 2:case 3:var A=3;break;default:A=h}var M=h;h=A;try{return C()}finally{h=M}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(C,A){switch(C){case 1:case 2:case 3:case 4:case 5:break;default:C=3}var M=h;h=C;try{return A()}finally{h=M}},e.unstable_scheduleCallback=function(C,A,M){var D=e.unstable_now();switch(typeof M=="object"&&M!==null?(M=M.delay,M=typeof M=="number"&&0<M?D+M:D):M=D,C){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=M+B,C={id:f++,callback:A,priorityLevel:C,startTime:M,expirationTime:B,sortIndex:-1},M>D?(C.sortIndex=M,t(u,C),n(l)===null&&C===n(u)&&(g?(v(R),R=-1):g=!0,I(b,M-D))):(C.sortIndex=B,t(l,C),w||m||(w=!0,O(S))),C},e.unstable_shouldYield=N,e.unstable_wrapCallback=function(C){var A=h;return function(){var M=h;h=A;try{return C.apply(this,arguments)}finally{h=M}}}})(Zv);Uv.exports=Zv;var Rb=Uv.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 jb=d,cn=Rb;function te(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 Kv=new Set,vs={};function xo(e,t){fi(e,t),fi(e+"Capture",t)}function fi(e,t){for(vs[e]=t,e=0;e<t.length;e++)Kv.add(t[e])}var fr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Yc=Object.prototype.hasOwnProperty,Pb=/^[: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]*$/,nh={},rh={};function _b(e){return Yc.call(rh,e)?!0:Yc.call(nh,e)?!1:Pb.test(e)?rh[e]=!0:(nh[e]=!0,!1)}function Fb(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 Mb(e,t,n,r){if(t===null||typeof t>"u"||Fb(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 Ct={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ct[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];Ct[t]=new Ht(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ct[e]=new Ht(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ct[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){Ct[e]=new Ht(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ct[e]=new Ht(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ct[e]=new Ht(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ct[e]=new Ht(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ct[e]=new Ht(e,5,!1,e.toLowerCase(),null,!1,!1)});var gf=/[\-:]([a-z])/g;function vf(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(gf,vf);Ct[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(gf,vf);Ct[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(gf,vf);Ct[t]=new Ht(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ct[e]=new Ht(e,1,!1,e.toLowerCase(),null,!1,!1)});Ct.xlinkHref=new Ht("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ct[e]=new Ht(e,1,!1,e.toLowerCase(),null,!0,!0)});function yf(e,t,n,r){var o=Ct.hasOwnProperty(t)?Ct[t]:null;(o!==null?o.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(Mb(t,n,o,r)&&(n=null),r||o===null?_b(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 gr=jb.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,aa=Symbol.for("react.element"),Wo=Symbol.for("react.portal"),Vo=Symbol.for("react.fragment"),wf=Symbol.for("react.strict_mode"),Gc=Symbol.for("react.profiler"),Yv=Symbol.for("react.provider"),Gv=Symbol.for("react.context"),xf=Symbol.for("react.forward_ref"),Xc=Symbol.for("react.suspense"),qc=Symbol.for("react.suspense_list"),bf=Symbol.for("react.memo"),Cr=Symbol.for("react.lazy"),Xv=Symbol.for("react.offscreen"),oh=Symbol.iterator;function Ai(e){return e===null||typeof e!="object"?null:(e=oh&&e[oh]||e["@@iterator"],typeof e=="function"?e:null)}var et=Object.assign,Hu;function Ji(e){if(Hu===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Hu=t&&t[1]||""}return`
34
+ `+Hu+e}var Uu=!1;function Zu(e,t){if(!e||Uu)return"";Uu=!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(u){var r=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){r=u}e.call(t.prototype)}else{try{throw Error()}catch(u){r=u}e()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var o=u.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{Uu=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Ji(e):""}function $b(e){switch(e.tag){case 5:return Ji(e.type);case 16:return Ji("Lazy");case 13:return Ji("Suspense");case 19:return Ji("SuspenseList");case 0:case 2:case 15:return e=Zu(e.type,!1),e;case 11:return e=Zu(e.type.render,!1),e;case 1:return e=Zu(e.type,!0),e;default:return""}}function Qc(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 Vo:return"Fragment";case Wo:return"Portal";case Gc:return"Profiler";case wf:return"StrictMode";case Xc:return"Suspense";case qc:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Gv:return(e.displayName||"Context")+".Consumer";case Yv:return(e._context.displayName||"Context")+".Provider";case xf:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case bf:return t=e.displayName||null,t!==null?t:Qc(e.type)||"Memo";case Cr:t=e._payload,e=e._init;try{return Qc(e(t))}catch{}}return null}function Ab(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 Qc(t);case 8:return t===wf?"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 Br(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function qv(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Nb(e){var t=qv(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 la(e){e._valueTracker||(e._valueTracker=Nb(e))}function Qv(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=qv(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function cl(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 Jc(e,t){var n=t.checked;return et({},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=Br(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 Jv(e,t){t=t.checked,t!=null&&yf(e,"checked",t,!1)}function ed(e,t){Jv(e,t);var n=Br(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")?td(e,t.type,n):t.hasOwnProperty("defaultValue")&&td(e,t.type,Br(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function sh(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 td(e,t,n){(t!=="number"||cl(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var es=Array.isArray;function ri(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=""+Br(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 nd(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(te(91));return et({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function ah(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(te(92));if(es(n)){if(1<n.length)throw Error(te(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Br(n)}}function ey(e,t){var n=Br(t.value),r=Br(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 lh(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function ty(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 rd(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?ty(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var ua,ny=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(ua=ua||document.createElement("div"),ua.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=ua.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ys(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var is={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},Lb=["Webkit","ms","Moz","O"];Object.keys(is).forEach(function(e){Lb.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),is[t]=is[e]})});function ry(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||is.hasOwnProperty(e)&&is[e]?(""+t).trim():t+"px"}function oy(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=ry(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var zb=et({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 od(e,t){if(t){if(zb[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(te(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(te(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(te(61))}if(t.style!=null&&typeof t.style!="object")throw Error(te(62))}}function id(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 sd=null;function Sf(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ad=null,oi=null,ii=null;function uh(e){if(e=Hs(e)){if(typeof ad!="function")throw Error(te(280));var t=e.stateNode;t&&(t=Jl(t),ad(e.stateNode,e.type,t))}}function iy(e){oi?ii?ii.push(e):ii=[e]:oi=e}function sy(){if(oi){var e=oi,t=ii;if(ii=oi=null,uh(e),t)for(e=0;e<t.length;e++)uh(t[e])}}function ay(e,t){return e(t)}function ly(){}var Ku=!1;function uy(e,t,n){if(Ku)return e(t,n);Ku=!0;try{return ay(e,t,n)}finally{Ku=!1,(oi!==null||ii!==null)&&(ly(),sy())}}function ws(e,t){var n=e.stateNode;if(n===null)return null;var r=Jl(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(te(231,t,typeof n));return n}var ld=!1;if(fr)try{var Ni={};Object.defineProperty(Ni,"passive",{get:function(){ld=!0}}),window.addEventListener("test",Ni,Ni),window.removeEventListener("test",Ni,Ni)}catch{ld=!1}function Db(e,t,n,r,o,i,s,a,l){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(f){this.onError(f)}}var ss=!1,dl=null,fl=!1,ud=null,Ob={onError:function(e){ss=!0,dl=e}};function Bb(e,t,n,r,o,i,s,a,l){ss=!1,dl=null,Db.apply(Ob,arguments)}function Wb(e,t,n,r,o,i,s,a,l){if(Bb.apply(this,arguments),ss){if(ss){var u=dl;ss=!1,dl=null}else throw Error(te(198));fl||(fl=!0,ud=u)}}function bo(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 cy(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 ch(e){if(bo(e)!==e)throw Error(te(188))}function Vb(e){var t=e.alternate;if(!t){if(t=bo(e),t===null)throw Error(te(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 ch(o),e;if(i===r)return ch(o),t;i=i.sibling}throw Error(te(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(te(189))}}if(n.alternate!==r)throw Error(te(190))}if(n.tag!==3)throw Error(te(188));return n.stateNode.current===n?e:t}function dy(e){return e=Vb(e),e!==null?fy(e):null}function fy(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=fy(e);if(t!==null)return t;e=e.sibling}return null}var py=cn.unstable_scheduleCallback,dh=cn.unstable_cancelCallback,Hb=cn.unstable_shouldYield,Ub=cn.unstable_requestPaint,st=cn.unstable_now,Zb=cn.unstable_getCurrentPriorityLevel,kf=cn.unstable_ImmediatePriority,hy=cn.unstable_UserBlockingPriority,pl=cn.unstable_NormalPriority,Kb=cn.unstable_LowPriority,my=cn.unstable_IdlePriority,Gl=null,Xn=null;function Yb(e){if(Xn&&typeof Xn.onCommitFiberRoot=="function")try{Xn.onCommitFiberRoot(Gl,e,void 0,(e.current.flags&128)===128)}catch{}}var An=Math.clz32?Math.clz32:qb,Gb=Math.log,Xb=Math.LN2;function qb(e){return e>>>=0,e===0?32:31-(Gb(e)/Xb|0)|0}var ca=64,da=4194304;function ts(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 hl(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=ts(a):(i&=s,i!==0&&(r=ts(i)))}else s=n&~o,s!==0?r=ts(s):i!==0&&(r=ts(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-An(t),o=1<<n,r|=e[n],t&=~o;return r}function Qb(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 Jb(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,o=e.expirationTimes,i=e.pendingLanes;0<i;){var s=31-An(i),a=1<<s,l=o[s];l===-1?(!(a&n)||a&r)&&(o[s]=Qb(a,t)):l<=t&&(e.expiredLanes|=a),i&=~a}}function cd(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function gy(){var e=ca;return ca<<=1,!(ca&4194240)&&(ca=64),e}function Yu(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ws(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-An(t),e[t]=n}function eS(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-An(n),i=1<<o;t[o]=0,r[o]=-1,e[o]=-1,n&=~i}}function Ef(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-An(n),o=1<<r;o&t|e[r]&t&&(e[r]|=t),n&=~o}}var Ne=0;function vy(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var yy,Cf,wy,xy,by,dd=!1,fa=[],Fr=null,Mr=null,$r=null,xs=new Map,bs=new Map,Tr=[],tS="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 fh(e,t){switch(e){case"focusin":case"focusout":Fr=null;break;case"dragenter":case"dragleave":Mr=null;break;case"mouseover":case"mouseout":$r=null;break;case"pointerover":case"pointerout":xs.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":bs.delete(t.pointerId)}}function Li(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=Hs(t),t!==null&&Cf(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function nS(e,t,n,r,o){switch(t){case"focusin":return Fr=Li(Fr,e,t,n,r,o),!0;case"dragenter":return Mr=Li(Mr,e,t,n,r,o),!0;case"mouseover":return $r=Li($r,e,t,n,r,o),!0;case"pointerover":var i=o.pointerId;return xs.set(i,Li(xs.get(i)||null,e,t,n,r,o)),!0;case"gotpointercapture":return i=o.pointerId,bs.set(i,Li(bs.get(i)||null,e,t,n,r,o)),!0}return!1}function Sy(e){var t=oo(e.target);if(t!==null){var n=bo(t);if(n!==null){if(t=n.tag,t===13){if(t=cy(n),t!==null){e.blockedOn=t,by(e.priority,function(){wy(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 Ga(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=fd(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);sd=r,n.target.dispatchEvent(r),sd=null}else return t=Hs(n),t!==null&&Cf(t),e.blockedOn=n,!1;t.shift()}return!0}function ph(e,t,n){Ga(e)&&n.delete(t)}function rS(){dd=!1,Fr!==null&&Ga(Fr)&&(Fr=null),Mr!==null&&Ga(Mr)&&(Mr=null),$r!==null&&Ga($r)&&($r=null),xs.forEach(ph),bs.forEach(ph)}function zi(e,t){e.blockedOn===t&&(e.blockedOn=null,dd||(dd=!0,cn.unstable_scheduleCallback(cn.unstable_NormalPriority,rS)))}function Ss(e){function t(o){return zi(o,e)}if(0<fa.length){zi(fa[0],e);for(var n=1;n<fa.length;n++){var r=fa[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Fr!==null&&zi(Fr,e),Mr!==null&&zi(Mr,e),$r!==null&&zi($r,e),xs.forEach(t),bs.forEach(t),n=0;n<Tr.length;n++)r=Tr[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Tr.length&&(n=Tr[0],n.blockedOn===null);)Sy(n),n.blockedOn===null&&Tr.shift()}var si=gr.ReactCurrentBatchConfig,ml=!0;function oS(e,t,n,r){var o=Ne,i=si.transition;si.transition=null;try{Ne=1,If(e,t,n,r)}finally{Ne=o,si.transition=i}}function iS(e,t,n,r){var o=Ne,i=si.transition;si.transition=null;try{Ne=4,If(e,t,n,r)}finally{Ne=o,si.transition=i}}function If(e,t,n,r){if(ml){var o=fd(e,t,n,r);if(o===null)oc(e,t,r,gl,n),fh(e,r);else if(nS(o,e,t,n,r))r.stopPropagation();else if(fh(e,r),t&4&&-1<tS.indexOf(e)){for(;o!==null;){var i=Hs(o);if(i!==null&&yy(i),i=fd(e,t,n,r),i===null&&oc(e,t,r,gl,n),i===o)break;o=i}o!==null&&r.stopPropagation()}else oc(e,t,r,null,n)}}var gl=null;function fd(e,t,n,r){if(gl=null,e=Sf(r),e=oo(e),e!==null)if(t=bo(e),t===null)e=null;else if(n=t.tag,n===13){if(e=cy(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 gl=e,null}function ky(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(Zb()){case kf:return 1;case hy:return 4;case pl:case Kb:return 16;case my:return 536870912;default:return 16}default:return 16}}var Pr=null,Tf=null,Xa=null;function Ey(){if(Xa)return Xa;var e,t=Tf,n=t.length,r,o="value"in Pr?Pr.value:Pr.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 Xa=o.slice(e,1<r?1-r:void 0)}function qa(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 pa(){return!0}function hh(){return!1}function fn(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)?pa:hh,this.isPropagationStopped=hh,this}return et(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=pa)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=pa)},persist:function(){},isPersistent:pa}),t}var Si={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Rf=fn(Si),Vs=et({},Si,{view:0,detail:0}),sS=fn(Vs),Gu,Xu,Di,Xl=et({},Vs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:jf,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!==Di&&(Di&&e.type==="mousemove"?(Gu=e.screenX-Di.screenX,Xu=e.screenY-Di.screenY):Xu=Gu=0,Di=e),Gu)},movementY:function(e){return"movementY"in e?e.movementY:Xu}}),mh=fn(Xl),aS=et({},Xl,{dataTransfer:0}),lS=fn(aS),uS=et({},Vs,{relatedTarget:0}),qu=fn(uS),cS=et({},Si,{animationName:0,elapsedTime:0,pseudoElement:0}),dS=fn(cS),fS=et({},Si,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),pS=fn(fS),hS=et({},Si,{data:0}),gh=fn(hS),mS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},gS={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"},vS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function yS(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=vS[e])?!!t[e]:!1}function jf(){return yS}var wS=et({},Vs,{key:function(e){if(e.key){var t=mS[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=qa(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?gS[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:jf,charCode:function(e){return e.type==="keypress"?qa(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?qa(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),xS=fn(wS),bS=et({},Xl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),vh=fn(bS),SS=et({},Vs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:jf}),kS=fn(SS),ES=et({},Si,{propertyName:0,elapsedTime:0,pseudoElement:0}),CS=fn(ES),IS=et({},Xl,{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}),TS=fn(IS),RS=[9,13,27,32],Pf=fr&&"CompositionEvent"in window,as=null;fr&&"documentMode"in document&&(as=document.documentMode);var jS=fr&&"TextEvent"in window&&!as,Cy=fr&&(!Pf||as&&8<as&&11>=as),yh=" ",wh=!1;function Iy(e,t){switch(e){case"keyup":return RS.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ty(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ho=!1;function PS(e,t){switch(e){case"compositionend":return Ty(t);case"keypress":return t.which!==32?null:(wh=!0,yh);case"textInput":return e=t.data,e===yh&&wh?null:e;default:return null}}function _S(e,t){if(Ho)return e==="compositionend"||!Pf&&Iy(e,t)?(e=Ey(),Xa=Tf=Pr=null,Ho=!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 Cy&&t.locale!=="ko"?null:t.data;default:return null}}var FS={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 xh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!FS[e.type]:t==="textarea"}function Ry(e,t,n,r){iy(r),t=vl(t,"onChange"),0<t.length&&(n=new Rf("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var ls=null,ks=null;function MS(e){Dy(e,0)}function ql(e){var t=Ko(e);if(Qv(t))return e}function $S(e,t){if(e==="change")return t}var jy=!1;if(fr){var Qu;if(fr){var Ju="oninput"in document;if(!Ju){var bh=document.createElement("div");bh.setAttribute("oninput","return;"),Ju=typeof bh.oninput=="function"}Qu=Ju}else Qu=!1;jy=Qu&&(!document.documentMode||9<document.documentMode)}function Sh(){ls&&(ls.detachEvent("onpropertychange",Py),ks=ls=null)}function Py(e){if(e.propertyName==="value"&&ql(ks)){var t=[];Ry(t,ks,e,Sf(e)),uy(MS,t)}}function AS(e,t,n){e==="focusin"?(Sh(),ls=t,ks=n,ls.attachEvent("onpropertychange",Py)):e==="focusout"&&Sh()}function NS(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ql(ks)}function LS(e,t){if(e==="click")return ql(t)}function zS(e,t){if(e==="input"||e==="change")return ql(t)}function DS(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var zn=typeof Object.is=="function"?Object.is:DS;function Es(e,t){if(zn(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(!Yc.call(t,o)||!zn(e[o],t[o]))return!1}return!0}function kh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Eh(e,t){var n=kh(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=kh(n)}}function _y(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?_y(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Fy(){for(var e=window,t=cl();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=cl(e.document)}return t}function _f(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 OS(e){var t=Fy(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&_y(n.ownerDocument.documentElement,n)){if(r!==null&&_f(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=Eh(n,i);var s=Eh(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 BS=fr&&"documentMode"in document&&11>=document.documentMode,Uo=null,pd=null,us=null,hd=!1;function Ch(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;hd||Uo==null||Uo!==cl(r)||(r=Uo,"selectionStart"in r&&_f(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}),us&&Es(us,r)||(us=r,r=vl(pd,"onSelect"),0<r.length&&(t=new Rf("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Uo)))}function ha(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Zo={animationend:ha("Animation","AnimationEnd"),animationiteration:ha("Animation","AnimationIteration"),animationstart:ha("Animation","AnimationStart"),transitionend:ha("Transition","TransitionEnd")},ec={},My={};fr&&(My=document.createElement("div").style,"AnimationEvent"in window||(delete Zo.animationend.animation,delete Zo.animationiteration.animation,delete Zo.animationstart.animation),"TransitionEvent"in window||delete Zo.transitionend.transition);function Ql(e){if(ec[e])return ec[e];if(!Zo[e])return e;var t=Zo[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in My)return ec[e]=t[n];return e}var $y=Ql("animationend"),Ay=Ql("animationiteration"),Ny=Ql("animationstart"),Ly=Ql("transitionend"),zy=new Map,Ih="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 Ur(e,t){zy.set(e,t),xo(t,[e])}for(var tc=0;tc<Ih.length;tc++){var nc=Ih[tc],WS=nc.toLowerCase(),VS=nc[0].toUpperCase()+nc.slice(1);Ur(WS,"on"+VS)}Ur($y,"onAnimationEnd");Ur(Ay,"onAnimationIteration");Ur(Ny,"onAnimationStart");Ur("dblclick","onDoubleClick");Ur("focusin","onFocus");Ur("focusout","onBlur");Ur(Ly,"onTransitionEnd");fi("onMouseEnter",["mouseout","mouseover"]);fi("onMouseLeave",["mouseout","mouseover"]);fi("onPointerEnter",["pointerout","pointerover"]);fi("onPointerLeave",["pointerout","pointerover"]);xo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));xo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));xo("onBeforeInput",["compositionend","keypress","textInput","paste"]);xo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));xo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));xo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ns="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(" "),HS=new Set("cancel close invalid load scroll toggle".split(" ").concat(ns));function Th(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,Wb(r,t,void 0,e),e.currentTarget=null}function Dy(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,u=a.currentTarget;if(a=a.listener,l!==i&&o.isPropagationStopped())break e;Th(o,a,u),i=l}else for(s=0;s<r.length;s++){if(a=r[s],l=a.instance,u=a.currentTarget,a=a.listener,l!==i&&o.isPropagationStopped())break e;Th(o,a,u),i=l}}}if(fl)throw e=ud,fl=!1,ud=null,e}function Be(e,t){var n=t[wd];n===void 0&&(n=t[wd]=new Set);var r=e+"__bubble";n.has(r)||(Oy(t,e,2,!1),n.add(r))}function rc(e,t,n){var r=0;t&&(r|=4),Oy(n,e,r,t)}var ma="_reactListening"+Math.random().toString(36).slice(2);function Cs(e){if(!e[ma]){e[ma]=!0,Kv.forEach(function(n){n!=="selectionchange"&&(HS.has(n)||rc(n,!1,e),rc(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ma]||(t[ma]=!0,rc("selectionchange",!1,t))}}function Oy(e,t,n,r){switch(ky(t)){case 1:var o=oS;break;case 4:o=iS;break;default:o=If}n=o.bind(null,t,n,e),o=void 0,!ld||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 oc(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=oo(a),s===null)return;if(l=s.tag,l===5||l===6){r=i=s;continue e}a=a.parentNode}}r=r.return}uy(function(){var u=i,f=Sf(n),p=[];e:{var h=zy.get(e);if(h!==void 0){var m=Rf,w=e;switch(e){case"keypress":if(qa(n)===0)break e;case"keydown":case"keyup":m=xS;break;case"focusin":w="focus",m=qu;break;case"focusout":w="blur",m=qu;break;case"beforeblur":case"afterblur":m=qu;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=mh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=lS;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=kS;break;case $y:case Ay:case Ny:m=dS;break;case Ly:m=CS;break;case"scroll":m=sS;break;case"wheel":m=TS;break;case"copy":case"cut":case"paste":m=pS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=vh}var g=(t&4)!==0,k=!g&&e==="scroll",v=g?h!==null?h+"Capture":null:h;g=[];for(var y=u,x;y!==null;){x=y;var b=x.stateNode;if(x.tag===5&&b!==null&&(x=b,v!==null&&(b=ws(y,v),b!=null&&g.push(Is(y,b,x)))),k)break;y=y.return}0<g.length&&(h=new m(h,w,null,n,f),p.push({event:h,listeners:g}))}}if(!(t&7)){e:{if(h=e==="mouseover"||e==="pointerover",m=e==="mouseout"||e==="pointerout",h&&n!==sd&&(w=n.relatedTarget||n.fromElement)&&(oo(w)||w[pr]))break e;if((m||h)&&(h=f.window===f?f:(h=f.ownerDocument)?h.defaultView||h.parentWindow:window,m?(w=n.relatedTarget||n.toElement,m=u,w=w?oo(w):null,w!==null&&(k=bo(w),w!==k||w.tag!==5&&w.tag!==6)&&(w=null)):(m=null,w=u),m!==w)){if(g=mh,b="onMouseLeave",v="onMouseEnter",y="mouse",(e==="pointerout"||e==="pointerover")&&(g=vh,b="onPointerLeave",v="onPointerEnter",y="pointer"),k=m==null?h:Ko(m),x=w==null?h:Ko(w),h=new g(b,y+"leave",m,n,f),h.target=k,h.relatedTarget=x,b=null,oo(f)===u&&(g=new g(v,y+"enter",w,n,f),g.target=x,g.relatedTarget=k,b=g),k=b,m&&w)t:{for(g=m,v=w,y=0,x=g;x;x=Fo(x))y++;for(x=0,b=v;b;b=Fo(b))x++;for(;0<y-x;)g=Fo(g),y--;for(;0<x-y;)v=Fo(v),x--;for(;y--;){if(g===v||v!==null&&g===v.alternate)break t;g=Fo(g),v=Fo(v)}g=null}else g=null;m!==null&&Rh(p,h,m,g,!1),w!==null&&k!==null&&Rh(p,k,w,g,!0)}}e:{if(h=u?Ko(u):window,m=h.nodeName&&h.nodeName.toLowerCase(),m==="select"||m==="input"&&h.type==="file")var S=$S;else if(xh(h))if(jy)S=zS;else{S=NS;var E=AS}else(m=h.nodeName)&&m.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(S=LS);if(S&&(S=S(e,u))){Ry(p,S,n,f);break e}E&&E(e,h,u),e==="focusout"&&(E=h._wrapperState)&&E.controlled&&h.type==="number"&&td(h,"number",h.value)}switch(E=u?Ko(u):window,e){case"focusin":(xh(E)||E.contentEditable==="true")&&(Uo=E,pd=u,us=null);break;case"focusout":us=pd=Uo=null;break;case"mousedown":hd=!0;break;case"contextmenu":case"mouseup":case"dragend":hd=!1,Ch(p,n,f);break;case"selectionchange":if(BS)break;case"keydown":case"keyup":Ch(p,n,f)}var T;if(Pf)e:{switch(e){case"compositionstart":var R="onCompositionStart";break e;case"compositionend":R="onCompositionEnd";break e;case"compositionupdate":R="onCompositionUpdate";break e}R=void 0}else Ho?Iy(e,n)&&(R="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(R="onCompositionStart");R&&(Cy&&n.locale!=="ko"&&(Ho||R!=="onCompositionStart"?R==="onCompositionEnd"&&Ho&&(T=Ey()):(Pr=f,Tf="value"in Pr?Pr.value:Pr.textContent,Ho=!0)),E=vl(u,R),0<E.length&&(R=new gh(R,e,null,n,f),p.push({event:R,listeners:E}),T?R.data=T:(T=Ty(n),T!==null&&(R.data=T)))),(T=jS?PS(e,n):_S(e,n))&&(u=vl(u,"onBeforeInput"),0<u.length&&(f=new gh("onBeforeInput","beforeinput",null,n,f),p.push({event:f,listeners:u}),f.data=T))}Dy(p,t)})}function Is(e,t,n){return{instance:e,listener:t,currentTarget:n}}function vl(e,t){for(var n=t+"Capture",r=[];e!==null;){var o=e,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=ws(e,n),i!=null&&r.unshift(Is(e,i,o)),i=ws(e,t),i!=null&&r.push(Is(e,i,o))),e=e.return}return r}function Fo(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Rh(e,t,n,r,o){for(var i=t._reactName,s=[];n!==null&&n!==r;){var a=n,l=a.alternate,u=a.stateNode;if(l!==null&&l===r)break;a.tag===5&&u!==null&&(a=u,o?(l=ws(n,i),l!=null&&s.unshift(Is(n,l,a))):o||(l=ws(n,i),l!=null&&s.push(Is(n,l,a)))),n=n.return}s.length!==0&&e.push({event:t,listeners:s})}var US=/\r\n?/g,ZS=/\u0000|\uFFFD/g;function jh(e){return(typeof e=="string"?e:""+e).replace(US,`
38
+ `).replace(ZS,"")}function ga(e,t,n){if(t=jh(t),jh(e)!==t&&n)throw Error(te(425))}function yl(){}var md=null,gd=null;function vd(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 yd=typeof setTimeout=="function"?setTimeout:void 0,KS=typeof clearTimeout=="function"?clearTimeout:void 0,Ph=typeof Promise=="function"?Promise:void 0,YS=typeof queueMicrotask=="function"?queueMicrotask:typeof Ph<"u"?function(e){return Ph.resolve(null).then(e).catch(GS)}:yd;function GS(e){setTimeout(function(){throw e})}function ic(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),Ss(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=o}while(n);Ss(t)}function Ar(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 _h(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 ki=Math.random().toString(36).slice(2),Kn="__reactFiber$"+ki,Ts="__reactProps$"+ki,pr="__reactContainer$"+ki,wd="__reactEvents$"+ki,XS="__reactListeners$"+ki,qS="__reactHandles$"+ki;function oo(e){var t=e[Kn];if(t)return t;for(var n=e.parentNode;n;){if(t=n[pr]||n[Kn]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=_h(e);e!==null;){if(n=e[Kn])return n;e=_h(e)}return t}e=n,n=e.parentNode}return null}function Hs(e){return e=e[Kn]||e[pr],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Ko(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(te(33))}function Jl(e){return e[Ts]||null}var xd=[],Yo=-1;function Zr(e){return{current:e}}function Ve(e){0>Yo||(e.current=xd[Yo],xd[Yo]=null,Yo--)}function Oe(e,t){Yo++,xd[Yo]=e.current,e.current=t}var Wr={},Nt=Zr(Wr),Xt=Zr(!1),fo=Wr;function pi(e,t){var n=e.type.contextTypes;if(!n)return Wr;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 qt(e){return e=e.childContextTypes,e!=null}function wl(){Ve(Xt),Ve(Nt)}function Fh(e,t,n){if(Nt.current!==Wr)throw Error(te(168));Oe(Nt,t),Oe(Xt,n)}function By(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(te(108,Ab(e)||"Unknown",o));return et({},n,r)}function xl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Wr,fo=Nt.current,Oe(Nt,e),Oe(Xt,Xt.current),!0}function Mh(e,t,n){var r=e.stateNode;if(!r)throw Error(te(169));n?(e=By(e,t,fo),r.__reactInternalMemoizedMergedChildContext=e,Ve(Xt),Ve(Nt),Oe(Nt,e)):Ve(Xt),Oe(Xt,n)}var sr=null,eu=!1,sc=!1;function Wy(e){sr===null?sr=[e]:sr.push(e)}function QS(e){eu=!0,Wy(e)}function Kr(){if(!sc&&sr!==null){sc=!0;var e=0,t=Ne;try{var n=sr;for(Ne=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}sr=null,eu=!1}catch(o){throw sr!==null&&(sr=sr.slice(e+1)),py(kf,Kr),o}finally{Ne=t,sc=!1}}return null}var Go=[],Xo=0,bl=null,Sl=0,yn=[],wn=0,po=null,lr=1,ur="";function no(e,t){Go[Xo++]=Sl,Go[Xo++]=bl,bl=e,Sl=t}function Vy(e,t,n){yn[wn++]=lr,yn[wn++]=ur,yn[wn++]=po,po=e;var r=lr;e=ur;var o=32-An(r)-1;r&=~(1<<o),n+=1;var i=32-An(t)+o;if(30<i){var s=o-o%5;i=(r&(1<<s)-1).toString(32),r>>=s,o-=s,lr=1<<32-An(t)+o|n<<o|r,ur=i+e}else lr=1<<i|n<<o|r,ur=e}function Ff(e){e.return!==null&&(no(e,1),Vy(e,1,0))}function Mf(e){for(;e===bl;)bl=Go[--Xo],Go[Xo]=null,Sl=Go[--Xo],Go[Xo]=null;for(;e===po;)po=yn[--wn],yn[wn]=null,ur=yn[--wn],yn[wn]=null,lr=yn[--wn],yn[wn]=null}var un=null,ln=null,Ye=!1,$n=null;function Hy(e,t){var n=bn(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 $h(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,un=e,ln=Ar(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,un=e,ln=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=po!==null?{id:lr,overflow:ur}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=bn(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,un=e,ln=null,!0):!1;default:return!1}}function bd(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Sd(e){if(Ye){var t=ln;if(t){var n=t;if(!$h(e,t)){if(bd(e))throw Error(te(418));t=Ar(n.nextSibling);var r=un;t&&$h(e,t)?Hy(r,n):(e.flags=e.flags&-4097|2,Ye=!1,un=e)}}else{if(bd(e))throw Error(te(418));e.flags=e.flags&-4097|2,Ye=!1,un=e}}}function Ah(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;un=e}function va(e){if(e!==un)return!1;if(!Ye)return Ah(e),Ye=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!vd(e.type,e.memoizedProps)),t&&(t=ln)){if(bd(e))throw Uy(),Error(te(418));for(;t;)Hy(e,t),t=Ar(t.nextSibling)}if(Ah(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(te(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){ln=Ar(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}ln=null}}else ln=un?Ar(e.stateNode.nextSibling):null;return!0}function Uy(){for(var e=ln;e;)e=Ar(e.nextSibling)}function hi(){ln=un=null,Ye=!1}function $f(e){$n===null?$n=[e]:$n.push(e)}var JS=gr.ReactCurrentBatchConfig;function Oi(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(te(309));var r=n.stateNode}if(!r)throw Error(te(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(te(284));if(!n._owner)throw Error(te(290,e))}return e}function ya(e,t){throw e=Object.prototype.toString.call(t),Error(te(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Nh(e){var t=e._init;return t(e._payload)}function Zy(e){function t(v,y){if(e){var x=v.deletions;x===null?(v.deletions=[y],v.flags|=16):x.push(y)}}function n(v,y){if(!e)return null;for(;y!==null;)t(v,y),y=y.sibling;return null}function r(v,y){for(v=new Map;y!==null;)y.key!==null?v.set(y.key,y):v.set(y.index,y),y=y.sibling;return v}function o(v,y){return v=Dr(v,y),v.index=0,v.sibling=null,v}function i(v,y,x){return v.index=x,e?(x=v.alternate,x!==null?(x=x.index,x<y?(v.flags|=2,y):x):(v.flags|=2,y)):(v.flags|=1048576,y)}function s(v){return e&&v.alternate===null&&(v.flags|=2),v}function a(v,y,x,b){return y===null||y.tag!==6?(y=pc(x,v.mode,b),y.return=v,y):(y=o(y,x),y.return=v,y)}function l(v,y,x,b){var S=x.type;return S===Vo?f(v,y,x.props.children,b,x.key):y!==null&&(y.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Cr&&Nh(S)===y.type)?(b=o(y,x.props),b.ref=Oi(v,y,x),b.return=v,b):(b=ol(x.type,x.key,x.props,null,v.mode,b),b.ref=Oi(v,y,x),b.return=v,b)}function u(v,y,x,b){return y===null||y.tag!==4||y.stateNode.containerInfo!==x.containerInfo||y.stateNode.implementation!==x.implementation?(y=hc(x,v.mode,b),y.return=v,y):(y=o(y,x.children||[]),y.return=v,y)}function f(v,y,x,b,S){return y===null||y.tag!==7?(y=co(x,v.mode,b,S),y.return=v,y):(y=o(y,x),y.return=v,y)}function p(v,y,x){if(typeof y=="string"&&y!==""||typeof y=="number")return y=pc(""+y,v.mode,x),y.return=v,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case aa:return x=ol(y.type,y.key,y.props,null,v.mode,x),x.ref=Oi(v,null,y),x.return=v,x;case Wo:return y=hc(y,v.mode,x),y.return=v,y;case Cr:var b=y._init;return p(v,b(y._payload),x)}if(es(y)||Ai(y))return y=co(y,v.mode,x,null),y.return=v,y;ya(v,y)}return null}function h(v,y,x,b){var S=y!==null?y.key:null;if(typeof x=="string"&&x!==""||typeof x=="number")return S!==null?null:a(v,y,""+x,b);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case aa:return x.key===S?l(v,y,x,b):null;case Wo:return x.key===S?u(v,y,x,b):null;case Cr:return S=x._init,h(v,y,S(x._payload),b)}if(es(x)||Ai(x))return S!==null?null:f(v,y,x,b,null);ya(v,x)}return null}function m(v,y,x,b,S){if(typeof b=="string"&&b!==""||typeof b=="number")return v=v.get(x)||null,a(y,v,""+b,S);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case aa:return v=v.get(b.key===null?x:b.key)||null,l(y,v,b,S);case Wo:return v=v.get(b.key===null?x:b.key)||null,u(y,v,b,S);case Cr:var E=b._init;return m(v,y,x,E(b._payload),S)}if(es(b)||Ai(b))return v=v.get(x)||null,f(y,v,b,S,null);ya(y,b)}return null}function w(v,y,x,b){for(var S=null,E=null,T=y,R=y=0,P=null;T!==null&&R<x.length;R++){T.index>R?(P=T,T=null):P=T.sibling;var $=h(v,T,x[R],b);if($===null){T===null&&(T=P);break}e&&T&&$.alternate===null&&t(v,T),y=i($,y,R),E===null?S=$:E.sibling=$,E=$,T=P}if(R===x.length)return n(v,T),Ye&&no(v,R),S;if(T===null){for(;R<x.length;R++)T=p(v,x[R],b),T!==null&&(y=i(T,y,R),E===null?S=T:E.sibling=T,E=T);return Ye&&no(v,R),S}for(T=r(v,T);R<x.length;R++)P=m(T,v,R,x[R],b),P!==null&&(e&&P.alternate!==null&&T.delete(P.key===null?R:P.key),y=i(P,y,R),E===null?S=P:E.sibling=P,E=P);return e&&T.forEach(function(N){return t(v,N)}),Ye&&no(v,R),S}function g(v,y,x,b){var S=Ai(x);if(typeof S!="function")throw Error(te(150));if(x=S.call(x),x==null)throw Error(te(151));for(var E=S=null,T=y,R=y=0,P=null,$=x.next();T!==null&&!$.done;R++,$=x.next()){T.index>R?(P=T,T=null):P=T.sibling;var N=h(v,T,$.value,b);if(N===null){T===null&&(T=P);break}e&&T&&N.alternate===null&&t(v,T),y=i(N,y,R),E===null?S=N:E.sibling=N,E=N,T=P}if($.done)return n(v,T),Ye&&no(v,R),S;if(T===null){for(;!$.done;R++,$=x.next())$=p(v,$.value,b),$!==null&&(y=i($,y,R),E===null?S=$:E.sibling=$,E=$);return Ye&&no(v,R),S}for(T=r(v,T);!$.done;R++,$=x.next())$=m(T,v,R,$.value,b),$!==null&&(e&&$.alternate!==null&&T.delete($.key===null?R:$.key),y=i($,y,R),E===null?S=$:E.sibling=$,E=$);return e&&T.forEach(function(W){return t(v,W)}),Ye&&no(v,R),S}function k(v,y,x,b){if(typeof x=="object"&&x!==null&&x.type===Vo&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case aa:e:{for(var S=x.key,E=y;E!==null;){if(E.key===S){if(S=x.type,S===Vo){if(E.tag===7){n(v,E.sibling),y=o(E,x.props.children),y.return=v,v=y;break e}}else if(E.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Cr&&Nh(S)===E.type){n(v,E.sibling),y=o(E,x.props),y.ref=Oi(v,E,x),y.return=v,v=y;break e}n(v,E);break}else t(v,E);E=E.sibling}x.type===Vo?(y=co(x.props.children,v.mode,b,x.key),y.return=v,v=y):(b=ol(x.type,x.key,x.props,null,v.mode,b),b.ref=Oi(v,y,x),b.return=v,v=b)}return s(v);case Wo:e:{for(E=x.key;y!==null;){if(y.key===E)if(y.tag===4&&y.stateNode.containerInfo===x.containerInfo&&y.stateNode.implementation===x.implementation){n(v,y.sibling),y=o(y,x.children||[]),y.return=v,v=y;break e}else{n(v,y);break}else t(v,y);y=y.sibling}y=hc(x,v.mode,b),y.return=v,v=y}return s(v);case Cr:return E=x._init,k(v,y,E(x._payload),b)}if(es(x))return w(v,y,x,b);if(Ai(x))return g(v,y,x,b);ya(v,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,y!==null&&y.tag===6?(n(v,y.sibling),y=o(y,x),y.return=v,v=y):(n(v,y),y=pc(x,v.mode,b),y.return=v,v=y),s(v)):n(v,y)}return k}var mi=Zy(!0),Ky=Zy(!1),kl=Zr(null),El=null,qo=null,Af=null;function Nf(){Af=qo=El=null}function Lf(e){var t=kl.current;Ve(kl),e._currentValue=t}function kd(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 ai(e,t){El=e,Af=qo=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Gt=!0),e.firstContext=null)}function En(e){var t=e._currentValue;if(Af!==e)if(e={context:e,memoizedValue:t,next:null},qo===null){if(El===null)throw Error(te(308));qo=e,El.dependencies={lanes:0,firstContext:e}}else qo=qo.next=e;return t}var io=null;function zf(e){io===null?io=[e]:io.push(e)}function Yy(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,zf(t)):(n.next=o.next,o.next=n),t.interleaved=n,hr(e,r)}function hr(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 Ir=!1;function Df(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Gy(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 dr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Nr(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Re&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,hr(e,n)}return o=r.interleaved,o===null?(t.next=t,zf(r)):(t.next=o.next,o.next=t),r.interleaved=t,hr(e,n)}function Qa(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,Ef(e,n)}}function Lh(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 Cl(e,t,n,r){var o=e.updateQueue;Ir=!1;var i=o.firstBaseUpdate,s=o.lastBaseUpdate,a=o.shared.pending;if(a!==null){o.shared.pending=null;var l=a,u=l.next;l.next=null,s===null?i=u:s.next=u,s=l;var f=e.alternate;f!==null&&(f=f.updateQueue,a=f.lastBaseUpdate,a!==s&&(a===null?f.firstBaseUpdate=u:a.next=u,f.lastBaseUpdate=l))}if(i!==null){var p=o.baseState;s=0,f=u=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 w=e,g=a;switch(h=t,m=n,g.tag){case 1:if(w=g.payload,typeof w=="function"){p=w.call(m,p,h);break e}p=w;break e;case 3:w.flags=w.flags&-65537|128;case 0:if(w=g.payload,h=typeof w=="function"?w.call(m,p,h):w,h==null)break e;p=et({},p,h);break e;case 2:Ir=!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?(u=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=u,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);mo|=s,e.lanes=s,e.memoizedState=p}}function zh(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(te(191,o));o.call(r)}}}var Us={},qn=Zr(Us),Rs=Zr(Us),js=Zr(Us);function so(e){if(e===Us)throw Error(te(174));return e}function Of(e,t){switch(Oe(js,t),Oe(Rs,e),Oe(qn,Us),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:rd(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=rd(t,e)}Ve(qn),Oe(qn,t)}function gi(){Ve(qn),Ve(Rs),Ve(js)}function Xy(e){so(js.current);var t=so(qn.current),n=rd(t,e.type);t!==n&&(Oe(Rs,e),Oe(qn,n))}function Bf(e){Rs.current===e&&(Ve(qn),Ve(Rs))}var Qe=Zr(0);function Il(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 ac=[];function Wf(){for(var e=0;e<ac.length;e++)ac[e]._workInProgressVersionPrimary=null;ac.length=0}var Ja=gr.ReactCurrentDispatcher,lc=gr.ReactCurrentBatchConfig,ho=0,Je=null,ft=null,yt=null,Tl=!1,cs=!1,Ps=0,ek=0;function _t(){throw Error(te(321))}function Vf(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!zn(e[n],t[n]))return!1;return!0}function Hf(e,t,n,r,o,i){if(ho=i,Je=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Ja.current=e===null||e.memoizedState===null?ok:ik,e=n(r,o),cs){i=0;do{if(cs=!1,Ps=0,25<=i)throw Error(te(301));i+=1,yt=ft=null,t.updateQueue=null,Ja.current=sk,e=n(r,o)}while(cs)}if(Ja.current=Rl,t=ft!==null&&ft.next!==null,ho=0,yt=ft=Je=null,Tl=!1,t)throw Error(te(300));return e}function Uf(){var e=Ps!==0;return Ps=0,e}function Un(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return yt===null?Je.memoizedState=yt=e:yt=yt.next=e,yt}function Cn(){if(ft===null){var e=Je.alternate;e=e!==null?e.memoizedState:null}else e=ft.next;var t=yt===null?Je.memoizedState:yt.next;if(t!==null)yt=t,ft=e;else{if(e===null)throw Error(te(310));ft=e,e={memoizedState:ft.memoizedState,baseState:ft.baseState,baseQueue:ft.baseQueue,queue:ft.queue,next:null},yt===null?Je.memoizedState=yt=e:yt=yt.next=e}return yt}function _s(e,t){return typeof t=="function"?t(e):t}function uc(e){var t=Cn(),n=t.queue;if(n===null)throw Error(te(311));n.lastRenderedReducer=e;var r=ft,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,u=i;do{var f=u.lane;if((ho&f)===f)l!==null&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var p={lane:f,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};l===null?(a=l=p,s=r):l=l.next=p,Je.lanes|=f,mo|=f}u=u.next}while(u!==null&&u!==i);l===null?s=r:l.next=a,zn(r,t.memoizedState)||(Gt=!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,Je.lanes|=i,mo|=i,o=o.next;while(o!==e)}else o===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function cc(e){var t=Cn(),n=t.queue;if(n===null)throw Error(te(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);zn(i,t.memoizedState)||(Gt=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function qy(){}function Qy(e,t){var n=Je,r=Cn(),o=t(),i=!zn(r.memoizedState,o);if(i&&(r.memoizedState=o,Gt=!0),r=r.queue,Zf(t0.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||yt!==null&&yt.memoizedState.tag&1){if(n.flags|=2048,Fs(9,e0.bind(null,n,r,o,t),void 0,null),wt===null)throw Error(te(349));ho&30||Jy(n,t,o)}return o}function Jy(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Je.updateQueue,t===null?(t={lastEffect:null,stores:null},Je.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function e0(e,t,n,r){t.value=n,t.getSnapshot=r,n0(t)&&r0(e)}function t0(e,t,n){return n(function(){n0(t)&&r0(e)})}function n0(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!zn(e,n)}catch{return!0}}function r0(e){var t=hr(e,1);t!==null&&Nn(t,e,1,-1)}function Dh(e){var t=Un();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:_s,lastRenderedState:e},t.queue=e,e=e.dispatch=rk.bind(null,Je,e),[t.memoizedState,e]}function Fs(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Je.updateQueue,t===null?(t={lastEffect:null,stores:null},Je.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 o0(){return Cn().memoizedState}function el(e,t,n,r){var o=Un();Je.flags|=e,o.memoizedState=Fs(1|t,n,void 0,r===void 0?null:r)}function tu(e,t,n,r){var o=Cn();r=r===void 0?null:r;var i=void 0;if(ft!==null){var s=ft.memoizedState;if(i=s.destroy,r!==null&&Vf(r,s.deps)){o.memoizedState=Fs(t,n,i,r);return}}Je.flags|=e,o.memoizedState=Fs(1|t,n,i,r)}function Oh(e,t){return el(8390656,8,e,t)}function Zf(e,t){return tu(2048,8,e,t)}function i0(e,t){return tu(4,2,e,t)}function s0(e,t){return tu(4,4,e,t)}function a0(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,tu(4,4,a0.bind(null,t,e),n)}function Kf(){}function u0(e,t){var n=Cn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Vf(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function c0(e,t){var n=Cn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Vf(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function d0(e,t,n){return ho&21?(zn(n,t)||(n=gy(),Je.lanes|=n,mo|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Gt=!0),e.memoizedState=n)}function tk(e,t){var n=Ne;Ne=n!==0&&4>n?n:4,e(!0);var r=lc.transition;lc.transition={};try{e(!1),t()}finally{Ne=n,lc.transition=r}}function f0(){return Cn().memoizedState}function nk(e,t,n){var r=zr(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},p0(e))h0(t,n);else if(n=Yy(e,t,n,r),n!==null){var o=Wt();Nn(n,e,r,o),m0(n,t,r)}}function rk(e,t,n){var r=zr(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(p0(e))h0(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,zn(a,s)){var l=t.interleaved;l===null?(o.next=o,zf(t)):(o.next=l.next,l.next=o),t.interleaved=o;return}}catch{}finally{}n=Yy(e,t,o,r),n!==null&&(o=Wt(),Nn(n,e,r,o),m0(n,t,r))}}function p0(e){var t=e.alternate;return e===Je||t!==null&&t===Je}function h0(e,t){cs=Tl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function m0(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ef(e,n)}}var Rl={readContext:En,useCallback:_t,useContext:_t,useEffect:_t,useImperativeHandle:_t,useInsertionEffect:_t,useLayoutEffect:_t,useMemo:_t,useReducer:_t,useRef:_t,useState:_t,useDebugValue:_t,useDeferredValue:_t,useTransition:_t,useMutableSource:_t,useSyncExternalStore:_t,useId:_t,unstable_isNewReconciler:!1},ok={readContext:En,useCallback:function(e,t){return Un().memoizedState=[e,t===void 0?null:t],e},useContext:En,useEffect:Oh,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,el(4194308,4,a0.bind(null,t,e),n)},useLayoutEffect:function(e,t){return el(4194308,4,e,t)},useInsertionEffect:function(e,t){return el(4,2,e,t)},useMemo:function(e,t){var n=Un();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Un();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=nk.bind(null,Je,e),[r.memoizedState,e]},useRef:function(e){var t=Un();return e={current:e},t.memoizedState=e},useState:Dh,useDebugValue:Kf,useDeferredValue:function(e){return Un().memoizedState=e},useTransition:function(){var e=Dh(!1),t=e[0];return e=tk.bind(null,e[1]),Un().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Je,o=Un();if(Ye){if(n===void 0)throw Error(te(407));n=n()}else{if(n=t(),wt===null)throw Error(te(349));ho&30||Jy(r,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,Oh(t0.bind(null,r,i,e),[e]),r.flags|=2048,Fs(9,e0.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Un(),t=wt.identifierPrefix;if(Ye){var n=ur,r=lr;n=(r&~(1<<32-An(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Ps++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=ek++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},ik={readContext:En,useCallback:u0,useContext:En,useEffect:Zf,useImperativeHandle:l0,useInsertionEffect:i0,useLayoutEffect:s0,useMemo:c0,useReducer:uc,useRef:o0,useState:function(){return uc(_s)},useDebugValue:Kf,useDeferredValue:function(e){var t=Cn();return d0(t,ft.memoizedState,e)},useTransition:function(){var e=uc(_s)[0],t=Cn().memoizedState;return[e,t]},useMutableSource:qy,useSyncExternalStore:Qy,useId:f0,unstable_isNewReconciler:!1},sk={readContext:En,useCallback:u0,useContext:En,useEffect:Zf,useImperativeHandle:l0,useInsertionEffect:i0,useLayoutEffect:s0,useMemo:c0,useReducer:cc,useRef:o0,useState:function(){return cc(_s)},useDebugValue:Kf,useDeferredValue:function(e){var t=Cn();return ft===null?t.memoizedState=e:d0(t,ft.memoizedState,e)},useTransition:function(){var e=cc(_s)[0],t=Cn().memoizedState;return[e,t]},useMutableSource:qy,useSyncExternalStore:Qy,useId:f0,unstable_isNewReconciler:!1};function Fn(e,t){if(e&&e.defaultProps){t=et({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Ed(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:et({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var nu={isMounted:function(e){return(e=e._reactInternals)?bo(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Wt(),o=zr(e),i=dr(r,o);i.payload=t,n!=null&&(i.callback=n),t=Nr(e,i,o),t!==null&&(Nn(t,e,o,r),Qa(t,e,o))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Wt(),o=zr(e),i=dr(r,o);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Nr(e,i,o),t!==null&&(Nn(t,e,o,r),Qa(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Wt(),r=zr(e),o=dr(n,r);o.tag=2,t!=null&&(o.callback=t),t=Nr(e,o,r),t!==null&&(Nn(t,e,r,n),Qa(t,e,r))}};function Bh(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?!Es(n,r)||!Es(o,i):!0}function g0(e,t,n){var r=!1,o=Wr,i=t.contextType;return typeof i=="object"&&i!==null?i=En(i):(o=qt(t)?fo:Nt.current,r=t.contextTypes,i=(r=r!=null)?pi(e,o):Wr),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=nu,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=i),t}function Wh(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&&nu.enqueueReplaceState(t,t.state,null)}function Cd(e,t,n,r){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs={},Df(e);var i=t.contextType;typeof i=="object"&&i!==null?o.context=En(i):(i=qt(t)?fo:Nt.current,o.context=pi(e,i)),o.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Ed(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&&nu.enqueueReplaceState(o,o.state,null),Cl(e,n,o,r),o.state=e.memoizedState),typeof o.componentDidMount=="function"&&(e.flags|=4194308)}function vi(e,t){try{var n="",r=t;do n+=$b(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 dc(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Id(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var ak=typeof WeakMap=="function"?WeakMap:Map;function v0(e,t,n){n=dr(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Pl||(Pl=!0,Nd=r),Id(e,t)},n}function y0(e,t,n){n=dr(-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(){Id(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Id(e,t),typeof r!="function"&&(Lr===null?Lr=new Set([this]):Lr.add(this));var s=t.stack;this.componentDidCatch(t.value,{componentStack:s!==null?s:""})}),n}function Vh(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new ak;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=bk.bind(null,e,t,n),t.then(e,e))}function Hh(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 Uh(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=dr(-1,1),t.tag=2,Nr(n,t,1))),n.lanes|=1),e)}var lk=gr.ReactCurrentOwner,Gt=!1;function Bt(e,t,n,r){t.child=e===null?Ky(t,null,n,r):mi(t,e.child,n,r)}function Zh(e,t,n,r,o){n=n.render;var i=t.ref;return ai(t,o),r=Hf(e,t,n,r,i,o),n=Uf(),e!==null&&!Gt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,mr(e,t,o)):(Ye&&n&&Ff(t),t.flags|=1,Bt(e,t,r,o),t.child)}function Kh(e,t,n,r,o){if(e===null){var i=n.type;return typeof i=="function"&&!tp(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,w0(e,t,i,r,o)):(e=ol(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:Es,n(s,r)&&e.ref===t.ref)return mr(e,t,o)}return t.flags|=1,e=Dr(i,r),e.ref=t.ref,e.return=t,t.child=e}function w0(e,t,n,r,o){if(e!==null){var i=e.memoizedProps;if(Es(i,r)&&e.ref===t.ref)if(Gt=!1,t.pendingProps=r=i,(e.lanes&o)!==0)e.flags&131072&&(Gt=!0);else return t.lanes=e.lanes,mr(e,t,o)}return Td(e,t,n,r,o)}function x0(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},Oe(Jo,an),an|=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,Oe(Jo,an),an|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,Oe(Jo,an),an|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,Oe(Jo,an),an|=r;return Bt(e,t,o,n),t.child}function b0(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Td(e,t,n,r,o){var i=qt(n)?fo:Nt.current;return i=pi(t,i),ai(t,o),n=Hf(e,t,n,r,i,o),r=Uf(),e!==null&&!Gt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,mr(e,t,o)):(Ye&&r&&Ff(t),t.flags|=1,Bt(e,t,n,o),t.child)}function Yh(e,t,n,r,o){if(qt(n)){var i=!0;xl(t)}else i=!1;if(ai(t,o),t.stateNode===null)tl(e,t),g0(t,n,r),Cd(t,n,r,o),r=!0;else if(e===null){var s=t.stateNode,a=t.memoizedProps;s.props=a;var l=s.context,u=n.contextType;typeof u=="object"&&u!==null?u=En(u):(u=qt(n)?fo:Nt.current,u=pi(t,u));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!==u)&&Wh(t,s,r,u),Ir=!1;var h=t.memoizedState;s.state=h,Cl(t,r,s,o),l=t.memoizedState,a!==r||h!==l||Xt.current||Ir?(typeof f=="function"&&(Ed(t,n,f,r),l=t.memoizedState),(a=Ir||Bh(t,n,a,r,h,l,u))?(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=u,r=a):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{s=t.stateNode,Gy(e,t),a=t.memoizedProps,u=t.type===t.elementType?a:Fn(t.type,a),s.props=u,p=t.pendingProps,h=s.context,l=n.contextType,typeof l=="object"&&l!==null?l=En(l):(l=qt(n)?fo:Nt.current,l=pi(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)&&Wh(t,s,r,l),Ir=!1,h=t.memoizedState,s.state=h,Cl(t,r,s,o);var w=t.memoizedState;a!==p||h!==w||Xt.current||Ir?(typeof m=="function"&&(Ed(t,n,m,r),w=t.memoizedState),(u=Ir||Bh(t,n,u,r,h,w,l)||!1)?(f||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,w,l),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,w,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=w),s.props=r,s.state=w,s.context=l,r=u):(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 Rd(e,t,n,r,i,o)}function Rd(e,t,n,r,o,i){b0(e,t);var s=(t.flags&128)!==0;if(!r&&!s)return o&&Mh(t,n,!1),mr(e,t,i);r=t.stateNode,lk.current=t;var a=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&s?(t.child=mi(t,e.child,null,i),t.child=mi(t,null,a,i)):Bt(e,t,a,i),t.memoizedState=r.state,o&&Mh(t,n,!0),t.child}function S0(e){var t=e.stateNode;t.pendingContext?Fh(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Fh(e,t.context,!1),Of(e,t.containerInfo)}function Gh(e,t,n,r,o){return hi(),$f(o),t.flags|=256,Bt(e,t,n,r),t.child}var jd={dehydrated:null,treeContext:null,retryLane:0};function Pd(e){return{baseLanes:e,cachePool:null,transitions:null}}function k0(e,t,n){var r=t.pendingProps,o=Qe.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),Oe(Qe,o&1),e===null)return Sd(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=iu(s,r,0,null),e=co(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Pd(n),t.memoizedState=jd,e):Yf(t,s));if(o=e.memoizedState,o!==null&&(a=o.dehydrated,a!==null))return uk(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=Dr(o,l),r.subtreeFlags=o.subtreeFlags&14680064),a!==null?i=Dr(a,i):(i=co(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?Pd(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=e.childLanes&~n,t.memoizedState=jd,r}return i=e.child,e=i.sibling,r=Dr(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 Yf(e,t){return t=iu({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function wa(e,t,n,r){return r!==null&&$f(r),mi(t,e.child,null,n),e=Yf(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function uk(e,t,n,r,o,i,s){if(n)return t.flags&256?(t.flags&=-257,r=dc(Error(te(422))),wa(e,t,s,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,o=t.mode,r=iu({mode:"visible",children:r.children},o,0,null),i=co(i,o,s,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&mi(t,e.child,null,s),t.child.memoizedState=Pd(s),t.memoizedState=jd,i);if(!(t.mode&1))return wa(e,t,s,null);if(o.data==="$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var a=r.dgst;return r=a,i=Error(te(419)),r=dc(i,r,void 0),wa(e,t,s,r)}if(a=(s&e.childLanes)!==0,Gt||a){if(r=wt,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,hr(e,o),Nn(r,e,o,-1))}return ep(),r=dc(Error(te(421))),wa(e,t,s,r)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=Sk.bind(null,e),o._reactRetry=t,null):(e=i.treeContext,ln=Ar(o.nextSibling),un=t,Ye=!0,$n=null,e!==null&&(yn[wn++]=lr,yn[wn++]=ur,yn[wn++]=po,lr=e.id,ur=e.overflow,po=t),t=Yf(t,r.children),t.flags|=4096,t)}function Xh(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),kd(e.return,t,n)}function fc(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 E0(e,t,n){var r=t.pendingProps,o=r.revealOrder,i=r.tail;if(Bt(e,t,r.children,n),r=Qe.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&&Xh(e,n,t);else if(e.tag===19)Xh(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(Oe(Qe,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&&Il(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),fc(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&&Il(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}fc(t,!0,n,null,i);break;case"together":fc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function tl(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function mr(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),mo|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(te(153));if(t.child!==null){for(e=t.child,n=Dr(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Dr(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function ck(e,t,n){switch(t.tag){case 3:S0(t),hi();break;case 5:Xy(t);break;case 1:qt(t.type)&&xl(t);break;case 4:Of(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;Oe(kl,r._currentValue),r._currentValue=o;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(Oe(Qe,Qe.current&1),t.flags|=128,null):n&t.child.childLanes?k0(e,t,n):(Oe(Qe,Qe.current&1),e=mr(e,t,n),e!==null?e.sibling:null);Oe(Qe,Qe.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return E0(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),Oe(Qe,Qe.current),r)break;return null;case 22:case 23:return t.lanes=0,x0(e,t,n)}return mr(e,t,n)}var C0,_d,I0,T0;C0=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}};_d=function(){};I0=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,so(qn.current);var i=null;switch(n){case"input":o=Jc(e,o),r=Jc(e,r),i=[];break;case"select":o=et({},o,{value:void 0}),r=et({},r,{value:void 0}),i=[];break;case"textarea":o=nd(e,o),r=nd(e,r),i=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=yl)}od(n,r);var s;n=null;for(u in o)if(!r.hasOwnProperty(u)&&o.hasOwnProperty(u)&&o[u]!=null)if(u==="style"){var a=o[u];for(s in a)a.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(vs.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var l=r[u];if(a=o!=null?o[u]:void 0,r.hasOwnProperty(u)&&l!==a&&(l!=null||a!=null))if(u==="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(u,n)),n=l;else u==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(i=i||[]).push(u,l)):u==="children"?typeof l!="string"&&typeof l!="number"||(i=i||[]).push(u,""+l):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(vs.hasOwnProperty(u)?(l!=null&&u==="onScroll"&&Be("scroll",e),i||a===l||(i=[])):(i=i||[]).push(u,l))}n&&(i=i||[]).push("style",n);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};T0=function(e,t,n,r){n!==r&&(t.flags|=4)};function Bi(e,t){if(!Ye)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 Ft(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 dk(e,t,n){var r=t.pendingProps;switch(Mf(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ft(t),null;case 1:return qt(t.type)&&wl(),Ft(t),null;case 3:return r=t.stateNode,gi(),Ve(Xt),Ve(Nt),Wf(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(va(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,$n!==null&&(Dd($n),$n=null))),_d(e,t),Ft(t),null;case 5:Bf(t);var o=so(js.current);if(n=t.type,e!==null&&t.stateNode!=null)I0(e,t,n,r,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(te(166));return Ft(t),null}if(e=so(qn.current),va(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[Kn]=t,r[Ts]=i,e=(t.mode&1)!==0,n){case"dialog":Be("cancel",r),Be("close",r);break;case"iframe":case"object":case"embed":Be("load",r);break;case"video":case"audio":for(o=0;o<ns.length;o++)Be(ns[o],r);break;case"source":Be("error",r);break;case"img":case"image":case"link":Be("error",r),Be("load",r);break;case"details":Be("toggle",r);break;case"input":ih(r,i),Be("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},Be("invalid",r);break;case"textarea":ah(r,i),Be("invalid",r)}od(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&&ga(r.textContent,a,e),o=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(i.suppressHydrationWarning!==!0&&ga(r.textContent,a,e),o=["children",""+a]):vs.hasOwnProperty(s)&&a!=null&&s==="onScroll"&&Be("scroll",r)}switch(n){case"input":la(r),sh(r,i,!0);break;case"textarea":la(r),lh(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=yl)}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=ty(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[Kn]=t,e[Ts]=r,C0(e,t,!1,!1),t.stateNode=e;e:{switch(s=id(n,r),n){case"dialog":Be("cancel",e),Be("close",e),o=r;break;case"iframe":case"object":case"embed":Be("load",e),o=r;break;case"video":case"audio":for(o=0;o<ns.length;o++)Be(ns[o],e);o=r;break;case"source":Be("error",e),o=r;break;case"img":case"image":case"link":Be("error",e),Be("load",e),o=r;break;case"details":Be("toggle",e),o=r;break;case"input":ih(e,r),o=Jc(e,r),Be("invalid",e);break;case"option":o=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},o=et({},r,{value:void 0}),Be("invalid",e);break;case"textarea":ah(e,r),o=nd(e,r),Be("invalid",e);break;default:o=r}od(n,o),a=o;for(i in a)if(a.hasOwnProperty(i)){var l=a[i];i==="style"?oy(e,l):i==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&ny(e,l)):i==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&ys(e,l):typeof l=="number"&&ys(e,""+l):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(vs.hasOwnProperty(i)?l!=null&&i==="onScroll"&&Be("scroll",e):l!=null&&yf(e,i,l,s))}switch(n){case"input":la(e),sh(e,r,!1);break;case"textarea":la(e),lh(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Br(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?ri(e,!!r.multiple,i,!1):r.defaultValue!=null&&ri(e,!!r.multiple,r.defaultValue,!0);break;default:typeof o.onClick=="function"&&(e.onclick=yl)}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 Ft(t),null;case 6:if(e&&t.stateNode!=null)T0(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(te(166));if(n=so(js.current),so(qn.current),va(t)){if(r=t.stateNode,n=t.memoizedProps,r[Kn]=t,(i=r.nodeValue!==n)&&(e=un,e!==null))switch(e.tag){case 3:ga(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&ga(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Kn]=t,t.stateNode=r}return Ft(t),null;case 13:if(Ve(Qe),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Ye&&ln!==null&&t.mode&1&&!(t.flags&128))Uy(),hi(),t.flags|=98560,i=!1;else if(i=va(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(te(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(te(317));i[Kn]=t}else hi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ft(t),i=!1}else $n!==null&&(Dd($n),$n=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||Qe.current&1?pt===0&&(pt=3):ep())),t.updateQueue!==null&&(t.flags|=4),Ft(t),null);case 4:return gi(),_d(e,t),e===null&&Cs(t.stateNode.containerInfo),Ft(t),null;case 10:return Lf(t.type._context),Ft(t),null;case 17:return qt(t.type)&&wl(),Ft(t),null;case 19:if(Ve(Qe),i=t.memoizedState,i===null)return Ft(t),null;if(r=(t.flags&128)!==0,s=i.rendering,s===null)if(r)Bi(i,!1);else{if(pt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=Il(e),s!==null){for(t.flags|=128,Bi(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 Oe(Qe,Qe.current&1|2),t.child}e=e.sibling}i.tail!==null&&st()>yi&&(t.flags|=128,r=!0,Bi(i,!1),t.lanes=4194304)}else{if(!r)if(e=Il(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Bi(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!Ye)return Ft(t),null}else 2*st()-i.renderingStartTime>yi&&n!==1073741824&&(t.flags|=128,r=!0,Bi(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=st(),t.sibling=null,n=Qe.current,Oe(Qe,r?n&1|2:n&1),t):(Ft(t),null);case 22:case 23:return Jf(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?an&1073741824&&(Ft(t),t.subtreeFlags&6&&(t.flags|=8192)):Ft(t),null;case 24:return null;case 25:return null}throw Error(te(156,t.tag))}function fk(e,t){switch(Mf(t),t.tag){case 1:return qt(t.type)&&wl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return gi(),Ve(Xt),Ve(Nt),Wf(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Bf(t),null;case 13:if(Ve(Qe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(te(340));hi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ve(Qe),null;case 4:return gi(),null;case 10:return Lf(t.type._context),null;case 22:case 23:return Jf(),null;case 24:return null;default:return null}}var xa=!1,$t=!1,pk=typeof WeakSet=="function"?WeakSet:Set,le=null;function Qo(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ot(e,t,r)}else n.current=null}function Fd(e,t,n){try{n()}catch(r){ot(e,t,r)}}var qh=!1;function hk(e,t){if(md=ml,e=Fy(),_f(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,u=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&&++u===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(gd={focusedElem:e,selectionRange:n},ml=!1,le=t;le!==null;)if(t=le,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,le=e;else for(;le!==null;){t=le;try{var w=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(w!==null){var g=w.memoizedProps,k=w.memoizedState,v=t.stateNode,y=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:Fn(t.type,g),k);v.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var x=t.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(te(163))}}catch(b){ot(t,t.return,b)}if(e=t.sibling,e!==null){e.return=t.return,le=e;break}le=t.return}return w=qh,qh=!1,w}function ds(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&&Fd(t,n,i)}o=o.next}while(o!==r)}}function ru(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 Md(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 R0(e){var t=e.alternate;t!==null&&(e.alternate=null,R0(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Kn],delete t[Ts],delete t[wd],delete t[XS],delete t[qS])),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 j0(e){return e.tag===5||e.tag===3||e.tag===4}function Qh(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||j0(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 $d(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=yl));else if(r!==4&&(e=e.child,e!==null))for($d(e,t,n),e=e.sibling;e!==null;)$d(e,t,n),e=e.sibling}function Ad(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(Ad(e,t,n),e=e.sibling;e!==null;)Ad(e,t,n),e=e.sibling}var St=null,Mn=!1;function xr(e,t,n){for(n=n.child;n!==null;)P0(e,t,n),n=n.sibling}function P0(e,t,n){if(Xn&&typeof Xn.onCommitFiberUnmount=="function")try{Xn.onCommitFiberUnmount(Gl,n)}catch{}switch(n.tag){case 5:$t||Qo(n,t);case 6:var r=St,o=Mn;St=null,xr(e,t,n),St=r,Mn=o,St!==null&&(Mn?(e=St,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):St.removeChild(n.stateNode));break;case 18:St!==null&&(Mn?(e=St,n=n.stateNode,e.nodeType===8?ic(e.parentNode,n):e.nodeType===1&&ic(e,n),Ss(e)):ic(St,n.stateNode));break;case 4:r=St,o=Mn,St=n.stateNode.containerInfo,Mn=!0,xr(e,t,n),St=r,Mn=o;break;case 0:case 11:case 14:case 15:if(!$t&&(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)&&Fd(n,t,s),o=o.next}while(o!==r)}xr(e,t,n);break;case 1:if(!$t&&(Qo(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){ot(n,t,a)}xr(e,t,n);break;case 21:xr(e,t,n);break;case 22:n.mode&1?($t=(r=$t)||n.memoizedState!==null,xr(e,t,n),$t=r):xr(e,t,n);break;default:xr(e,t,n)}}function Jh(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new pk),t.forEach(function(r){var o=kk.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function jn(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:St=a.stateNode,Mn=!1;break e;case 3:St=a.stateNode.containerInfo,Mn=!0;break e;case 4:St=a.stateNode.containerInfo,Mn=!0;break e}a=a.return}if(St===null)throw Error(te(160));P0(i,s,o),St=null,Mn=!1;var l=o.alternate;l!==null&&(l.return=null),o.return=null}catch(u){ot(o,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)_0(t,e),t=t.sibling}function _0(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(jn(t,e),Vn(e),r&4){try{ds(3,e,e.return),ru(3,e)}catch(g){ot(e,e.return,g)}try{ds(5,e,e.return)}catch(g){ot(e,e.return,g)}}break;case 1:jn(t,e),Vn(e),r&512&&n!==null&&Qo(n,n.return);break;case 5:if(jn(t,e),Vn(e),r&512&&n!==null&&Qo(n,n.return),e.flags&32){var o=e.stateNode;try{ys(o,"")}catch(g){ot(e,e.return,g)}}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&&Jv(o,i),id(a,s);var u=id(a,i);for(s=0;s<l.length;s+=2){var f=l[s],p=l[s+1];f==="style"?oy(o,p):f==="dangerouslySetInnerHTML"?ny(o,p):f==="children"?ys(o,p):yf(o,f,p,u)}switch(a){case"input":ed(o,i);break;case"textarea":ey(o,i);break;case"select":var h=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var m=i.value;m!=null?ri(o,!!i.multiple,m,!1):h!==!!i.multiple&&(i.defaultValue!=null?ri(o,!!i.multiple,i.defaultValue,!0):ri(o,!!i.multiple,i.multiple?[]:"",!1))}o[Ts]=i}catch(g){ot(e,e.return,g)}}break;case 6:if(jn(t,e),Vn(e),r&4){if(e.stateNode===null)throw Error(te(162));o=e.stateNode,i=e.memoizedProps;try{o.nodeValue=i}catch(g){ot(e,e.return,g)}}break;case 3:if(jn(t,e),Vn(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Ss(t.containerInfo)}catch(g){ot(e,e.return,g)}break;case 4:jn(t,e),Vn(e);break;case 13:jn(t,e),Vn(e),o=e.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(qf=st())),r&4&&Jh(e);break;case 22:if(f=n!==null&&n.memoizedState!==null,e.mode&1?($t=(u=$t)||f,jn(t,e),$t=u):jn(t,e),Vn(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!f&&e.mode&1)for(le=e,f=e.child;f!==null;){for(p=le=f;le!==null;){switch(h=le,m=h.child,h.tag){case 0:case 11:case 14:case 15:ds(4,h,h.return);break;case 1:Qo(h,h.return);var w=h.stateNode;if(typeof w.componentWillUnmount=="function"){r=h,n=h.return;try{t=r,w.props=t.memoizedProps,w.state=t.memoizedState,w.componentWillUnmount()}catch(g){ot(r,n,g)}}break;case 5:Qo(h,h.return);break;case 22:if(h.memoizedState!==null){tm(p);continue}}m!==null?(m.return=h,le=m):tm(p)}f=f.sibling}e:for(f=null,p=e;;){if(p.tag===5){if(f===null){f=p;try{o=p.stateNode,u?(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=ry("display",s))}catch(g){ot(e,e.return,g)}}}else if(p.tag===6){if(f===null)try{p.stateNode.nodeValue=u?"":p.memoizedProps}catch(g){ot(e,e.return,g)}}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:jn(t,e),Vn(e),r&4&&Jh(e);break;case 21:break;default:jn(t,e),Vn(e)}}function Vn(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(j0(n)){var r=n;break e}n=n.return}throw Error(te(160))}switch(r.tag){case 5:var o=r.stateNode;r.flags&32&&(ys(o,""),r.flags&=-33);var i=Qh(e);Ad(e,i,o);break;case 3:case 4:var s=r.stateNode.containerInfo,a=Qh(e);$d(e,a,s);break;default:throw Error(te(161))}}catch(l){ot(e,e.return,l)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function mk(e,t,n){le=e,F0(e)}function F0(e,t,n){for(var r=(e.mode&1)!==0;le!==null;){var o=le,i=o.child;if(o.tag===22&&r){var s=o.memoizedState!==null||xa;if(!s){var a=o.alternate,l=a!==null&&a.memoizedState!==null||$t;a=xa;var u=$t;if(xa=s,($t=l)&&!u)for(le=o;le!==null;)s=le,l=s.child,s.tag===22&&s.memoizedState!==null?nm(o):l!==null?(l.return=s,le=l):nm(o);for(;i!==null;)le=i,F0(i),i=i.sibling;le=o,xa=a,$t=u}em(e)}else o.subtreeFlags&8772&&i!==null?(i.return=o,le=i):em(e)}}function em(e){for(;le!==null;){var t=le;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:$t||ru(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!$t)if(n===null)r.componentDidMount();else{var o=t.elementType===t.type?n.memoizedProps:Fn(t.type,n.memoizedProps);r.componentDidUpdate(o,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&zh(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}zh(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 u=t.alternate;if(u!==null){var f=u.memoizedState;if(f!==null){var p=f.dehydrated;p!==null&&Ss(p)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(te(163))}$t||t.flags&512&&Md(t)}catch(h){ot(t,t.return,h)}}if(t===e){le=null;break}if(n=t.sibling,n!==null){n.return=t.return,le=n;break}le=t.return}}function tm(e){for(;le!==null;){var t=le;if(t===e){le=null;break}var n=t.sibling;if(n!==null){n.return=t.return,le=n;break}le=t.return}}function nm(e){for(;le!==null;){var t=le;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{ru(4,t)}catch(l){ot(t,n,l)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var o=t.return;try{r.componentDidMount()}catch(l){ot(t,o,l)}}var i=t.return;try{Md(t)}catch(l){ot(t,i,l)}break;case 5:var s=t.return;try{Md(t)}catch(l){ot(t,s,l)}}}catch(l){ot(t,t.return,l)}if(t===e){le=null;break}var a=t.sibling;if(a!==null){a.return=t.return,le=a;break}le=t.return}}var gk=Math.ceil,jl=gr.ReactCurrentDispatcher,Gf=gr.ReactCurrentOwner,kn=gr.ReactCurrentBatchConfig,Re=0,wt=null,ut=null,kt=0,an=0,Jo=Zr(0),pt=0,Ms=null,mo=0,ou=0,Xf=0,fs=null,Yt=null,qf=0,yi=1/0,ir=null,Pl=!1,Nd=null,Lr=null,ba=!1,_r=null,_l=0,ps=0,Ld=null,nl=-1,rl=0;function Wt(){return Re&6?st():nl!==-1?nl:nl=st()}function zr(e){return e.mode&1?Re&2&&kt!==0?kt&-kt:JS.transition!==null?(rl===0&&(rl=gy()),rl):(e=Ne,e!==0||(e=window.event,e=e===void 0?16:ky(e.type)),e):1}function Nn(e,t,n,r){if(50<ps)throw ps=0,Ld=null,Error(te(185));Ws(e,n,r),(!(Re&2)||e!==wt)&&(e===wt&&(!(Re&2)&&(ou|=n),pt===4&&Rr(e,kt)),Qt(e,r),n===1&&Re===0&&!(t.mode&1)&&(yi=st()+500,eu&&Kr()))}function Qt(e,t){var n=e.callbackNode;Jb(e,t);var r=hl(e,e===wt?kt:0);if(r===0)n!==null&&dh(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&dh(n),t===1)e.tag===0?QS(rm.bind(null,e)):Wy(rm.bind(null,e)),YS(function(){!(Re&6)&&Kr()}),n=null;else{switch(vy(r)){case 1:n=kf;break;case 4:n=hy;break;case 16:n=pl;break;case 536870912:n=my;break;default:n=pl}n=O0(n,M0.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function M0(e,t){if(nl=-1,rl=0,Re&6)throw Error(te(327));var n=e.callbackNode;if(li()&&e.callbackNode!==n)return null;var r=hl(e,e===wt?kt:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Fl(e,r);else{t=r;var o=Re;Re|=2;var i=A0();(wt!==e||kt!==t)&&(ir=null,yi=st()+500,uo(e,t));do try{wk();break}catch(a){$0(e,a)}while(!0);Nf(),jl.current=i,Re=o,ut!==null?t=0:(wt=null,kt=0,t=pt)}if(t!==0){if(t===2&&(o=cd(e),o!==0&&(r=o,t=zd(e,o))),t===1)throw n=Ms,uo(e,0),Rr(e,r),Qt(e,st()),n;if(t===6)Rr(e,r);else{if(o=e.current.alternate,!(r&30)&&!vk(o)&&(t=Fl(e,r),t===2&&(i=cd(e),i!==0&&(r=i,t=zd(e,i))),t===1))throw n=Ms,uo(e,0),Rr(e,r),Qt(e,st()),n;switch(e.finishedWork=o,e.finishedLanes=r,t){case 0:case 1:throw Error(te(345));case 2:ro(e,Yt,ir);break;case 3:if(Rr(e,r),(r&130023424)===r&&(t=qf+500-st(),10<t)){if(hl(e,0)!==0)break;if(o=e.suspendedLanes,(o&r)!==r){Wt(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=yd(ro.bind(null,e,Yt,ir),t);break}ro(e,Yt,ir);break;case 4:if(Rr(e,r),(r&4194240)===r)break;for(t=e.eventTimes,o=-1;0<r;){var s=31-An(r);i=1<<s,s=t[s],s>o&&(o=s),r&=~i}if(r=o,r=st()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*gk(r/1960))-r,10<r){e.timeoutHandle=yd(ro.bind(null,e,Yt,ir),r);break}ro(e,Yt,ir);break;case 5:ro(e,Yt,ir);break;default:throw Error(te(329))}}}return Qt(e,st()),e.callbackNode===n?M0.bind(null,e):null}function zd(e,t){var n=fs;return e.current.memoizedState.isDehydrated&&(uo(e,t).flags|=256),e=Fl(e,t),e!==2&&(t=Yt,Yt=n,t!==null&&Dd(t)),e}function Dd(e){Yt===null?Yt=e:Yt.push.apply(Yt,e)}function vk(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(!zn(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 Rr(e,t){for(t&=~Xf,t&=~ou,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-An(t),r=1<<n;e[n]=-1,t&=~r}}function rm(e){if(Re&6)throw Error(te(327));li();var t=hl(e,0);if(!(t&1))return Qt(e,st()),null;var n=Fl(e,t);if(e.tag!==0&&n===2){var r=cd(e);r!==0&&(t=r,n=zd(e,r))}if(n===1)throw n=Ms,uo(e,0),Rr(e,t),Qt(e,st()),n;if(n===6)throw Error(te(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,ro(e,Yt,ir),Qt(e,st()),null}function Qf(e,t){var n=Re;Re|=1;try{return e(t)}finally{Re=n,Re===0&&(yi=st()+500,eu&&Kr())}}function go(e){_r!==null&&_r.tag===0&&!(Re&6)&&li();var t=Re;Re|=1;var n=kn.transition,r=Ne;try{if(kn.transition=null,Ne=1,e)return e()}finally{Ne=r,kn.transition=n,Re=t,!(Re&6)&&Kr()}}function Jf(){an=Jo.current,Ve(Jo)}function uo(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,KS(n)),ut!==null)for(n=ut.return;n!==null;){var r=n;switch(Mf(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&wl();break;case 3:gi(),Ve(Xt),Ve(Nt),Wf();break;case 5:Bf(r);break;case 4:gi();break;case 13:Ve(Qe);break;case 19:Ve(Qe);break;case 10:Lf(r.type._context);break;case 22:case 23:Jf()}n=n.return}if(wt=e,ut=e=Dr(e.current,null),kt=an=t,pt=0,Ms=null,Xf=ou=mo=0,Yt=fs=null,io!==null){for(t=0;t<io.length;t++)if(n=io[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}io=null}return e}function $0(e,t){do{var n=ut;try{if(Nf(),Ja.current=Rl,Tl){for(var r=Je.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}Tl=!1}if(ho=0,yt=ft=Je=null,cs=!1,Ps=0,Gf.current=null,n===null||n.return===null){pt=1,Ms=t,ut=null;break}e:{var i=e,s=n.return,a=n,l=t;if(t=kt,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var u=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=Hh(s);if(m!==null){m.flags&=-257,Uh(m,s,a,i,t),m.mode&1&&Vh(i,u,t),t=m,l=u;var w=t.updateQueue;if(w===null){var g=new Set;g.add(l),t.updateQueue=g}else w.add(l);break e}else{if(!(t&1)){Vh(i,u,t),ep();break e}l=Error(te(426))}}else if(Ye&&a.mode&1){var k=Hh(s);if(k!==null){!(k.flags&65536)&&(k.flags|=256),Uh(k,s,a,i,t),$f(vi(l,a));break e}}i=l=vi(l,a),pt!==4&&(pt=2),fs===null?fs=[i]:fs.push(i),i=s;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var v=v0(i,l,t);Lh(i,v);break e;case 1:a=l;var y=i.type,x=i.stateNode;if(!(i.flags&128)&&(typeof y.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Lr===null||!Lr.has(x)))){i.flags|=65536,t&=-t,i.lanes|=t;var b=y0(i,a,t);Lh(i,b);break e}}i=i.return}while(i!==null)}L0(n)}catch(S){t=S,ut===n&&n!==null&&(ut=n=n.return);continue}break}while(!0)}function A0(){var e=jl.current;return jl.current=Rl,e===null?Rl:e}function ep(){(pt===0||pt===3||pt===2)&&(pt=4),wt===null||!(mo&268435455)&&!(ou&268435455)||Rr(wt,kt)}function Fl(e,t){var n=Re;Re|=2;var r=A0();(wt!==e||kt!==t)&&(ir=null,uo(e,t));do try{yk();break}catch(o){$0(e,o)}while(!0);if(Nf(),Re=n,jl.current=r,ut!==null)throw Error(te(261));return wt=null,kt=0,pt}function yk(){for(;ut!==null;)N0(ut)}function wk(){for(;ut!==null&&!Hb();)N0(ut)}function N0(e){var t=D0(e.alternate,e,an);e.memoizedProps=e.pendingProps,t===null?L0(e):ut=t,Gf.current=null}function L0(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=fk(n,t),n!==null){n.flags&=32767,ut=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{pt=6,ut=null;return}}else if(n=dk(n,t,an),n!==null){ut=n;return}if(t=t.sibling,t!==null){ut=t;return}ut=t=e}while(t!==null);pt===0&&(pt=5)}function ro(e,t,n){var r=Ne,o=kn.transition;try{kn.transition=null,Ne=1,xk(e,t,n,r)}finally{kn.transition=o,Ne=r}return null}function xk(e,t,n,r){do li();while(_r!==null);if(Re&6)throw Error(te(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(te(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(eS(e,i),e===wt&&(ut=wt=null,kt=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||ba||(ba=!0,O0(pl,function(){return li(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=kn.transition,kn.transition=null;var s=Ne;Ne=1;var a=Re;Re|=4,Gf.current=null,hk(e,n),_0(n,e),OS(gd),ml=!!md,gd=md=null,e.current=n,mk(n),Ub(),Re=a,Ne=s,kn.transition=i}else e.current=n;if(ba&&(ba=!1,_r=e,_l=o),i=e.pendingLanes,i===0&&(Lr=null),Yb(n.stateNode),Qt(e,st()),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(Pl)throw Pl=!1,e=Nd,Nd=null,e;return _l&1&&e.tag!==0&&li(),i=e.pendingLanes,i&1?e===Ld?ps++:(ps=0,Ld=e):ps=0,Kr(),null}function li(){if(_r!==null){var e=vy(_l),t=kn.transition,n=Ne;try{if(kn.transition=null,Ne=16>e?16:e,_r===null)var r=!1;else{if(e=_r,_r=null,_l=0,Re&6)throw Error(te(331));var o=Re;for(Re|=4,le=e.current;le!==null;){var i=le,s=i.child;if(le.flags&16){var a=i.deletions;if(a!==null){for(var l=0;l<a.length;l++){var u=a[l];for(le=u;le!==null;){var f=le;switch(f.tag){case 0:case 11:case 15:ds(8,f,i)}var p=f.child;if(p!==null)p.return=f,le=p;else for(;le!==null;){f=le;var h=f.sibling,m=f.return;if(R0(f),f===u){le=null;break}if(h!==null){h.return=m,le=h;break}le=m}}}var w=i.alternate;if(w!==null){var g=w.child;if(g!==null){w.child=null;do{var k=g.sibling;g.sibling=null,g=k}while(g!==null)}}le=i}}if(i.subtreeFlags&2064&&s!==null)s.return=i,le=s;else e:for(;le!==null;){if(i=le,i.flags&2048)switch(i.tag){case 0:case 11:case 15:ds(9,i,i.return)}var v=i.sibling;if(v!==null){v.return=i.return,le=v;break e}le=i.return}}var y=e.current;for(le=y;le!==null;){s=le;var x=s.child;if(s.subtreeFlags&2064&&x!==null)x.return=s,le=x;else e:for(s=y;le!==null;){if(a=le,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:ru(9,a)}}catch(S){ot(a,a.return,S)}if(a===s){le=null;break e}var b=a.sibling;if(b!==null){b.return=a.return,le=b;break e}le=a.return}}if(Re=o,Kr(),Xn&&typeof Xn.onPostCommitFiberRoot=="function")try{Xn.onPostCommitFiberRoot(Gl,e)}catch{}r=!0}return r}finally{Ne=n,kn.transition=t}}return!1}function om(e,t,n){t=vi(n,t),t=v0(e,t,1),e=Nr(e,t,1),t=Wt(),e!==null&&(Ws(e,1,t),Qt(e,t))}function ot(e,t,n){if(e.tag===3)om(e,e,n);else for(;t!==null;){if(t.tag===3){om(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Lr===null||!Lr.has(r))){e=vi(n,e),e=y0(t,e,1),t=Nr(t,e,1),e=Wt(),t!==null&&(Ws(t,1,e),Qt(t,e));break}}t=t.return}}function bk(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Wt(),e.pingedLanes|=e.suspendedLanes&n,wt===e&&(kt&n)===n&&(pt===4||pt===3&&(kt&130023424)===kt&&500>st()-qf?uo(e,0):Xf|=n),Qt(e,t)}function z0(e,t){t===0&&(e.mode&1?(t=da,da<<=1,!(da&130023424)&&(da=4194304)):t=1);var n=Wt();e=hr(e,t),e!==null&&(Ws(e,t,n),Qt(e,n))}function Sk(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),z0(e,n)}function kk(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(te(314))}r!==null&&r.delete(t),z0(e,n)}var D0;D0=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Xt.current)Gt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Gt=!1,ck(e,t,n);Gt=!!(e.flags&131072)}else Gt=!1,Ye&&t.flags&1048576&&Vy(t,Sl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;tl(e,t),e=t.pendingProps;var o=pi(t,Nt.current);ai(t,n),o=Hf(null,t,r,e,o,n);var i=Uf();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,qt(r)?(i=!0,xl(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,Df(t),o.updater=nu,t.stateNode=o,o._reactInternals=t,Cd(t,r,e,n),t=Rd(null,t,r,!0,i,n)):(t.tag=0,Ye&&i&&Ff(t),Bt(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(tl(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=Ck(r),e=Fn(r,e),o){case 0:t=Td(null,t,r,e,n);break e;case 1:t=Yh(null,t,r,e,n);break e;case 11:t=Zh(null,t,r,e,n);break e;case 14:t=Kh(null,t,r,Fn(r.type,e),n);break e}throw Error(te(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Fn(r,o),Td(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Fn(r,o),Yh(e,t,r,o,n);case 3:e:{if(S0(t),e===null)throw Error(te(387));r=t.pendingProps,i=t.memoizedState,o=i.element,Gy(e,t),Cl(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=vi(Error(te(423)),t),t=Gh(e,t,r,n,o);break e}else if(r!==o){o=vi(Error(te(424)),t),t=Gh(e,t,r,n,o);break e}else for(ln=Ar(t.stateNode.containerInfo.firstChild),un=t,Ye=!0,$n=null,n=Ky(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(hi(),r===o){t=mr(e,t,n);break e}Bt(e,t,r,n)}t=t.child}return t;case 5:return Xy(t),e===null&&Sd(t),r=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,s=o.children,vd(r,o)?s=null:i!==null&&vd(r,i)&&(t.flags|=32),b0(e,t),Bt(e,t,s,n),t.child;case 6:return e===null&&Sd(t),null;case 13:return k0(e,t,n);case 4:return Of(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=mi(t,null,r,n):Bt(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Fn(r,o),Zh(e,t,r,o,n);case 7:return Bt(e,t,t.pendingProps,n),t.child;case 8:return Bt(e,t,t.pendingProps.children,n),t.child;case 12:return Bt(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,Oe(kl,r._currentValue),r._currentValue=s,i!==null)if(zn(i.value,s)){if(i.children===o.children&&!Xt.current){t=mr(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=dr(-1,n&-n),l.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var f=u.pending;f===null?l.next=l:(l.next=f.next,f.next=l),u.pending=l}}i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),kd(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(te(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),kd(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}Bt(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,ai(t,n),o=En(o),r=r(o),t.flags|=1,Bt(e,t,r,n),t.child;case 14:return r=t.type,o=Fn(r,t.pendingProps),o=Fn(r.type,o),Kh(e,t,r,o,n);case 15:return w0(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Fn(r,o),tl(e,t),t.tag=1,qt(r)?(e=!0,xl(t)):e=!1,ai(t,n),g0(t,r,o),Cd(t,r,o,n),Rd(null,t,r,!0,e,n);case 19:return E0(e,t,n);case 22:return x0(e,t,n)}throw Error(te(156,t.tag))};function O0(e,t){return py(e,t)}function Ek(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 bn(e,t,n,r){return new Ek(e,t,n,r)}function tp(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ck(e){if(typeof e=="function")return tp(e)?1:0;if(e!=null){if(e=e.$$typeof,e===xf)return 11;if(e===bf)return 14}return 2}function Dr(e,t){var n=e.alternate;return n===null?(n=bn(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 ol(e,t,n,r,o,i){var s=2;if(r=e,typeof e=="function")tp(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case Vo:return co(n.children,o,i,t);case wf:s=8,o|=8;break;case Gc:return e=bn(12,n,t,o|2),e.elementType=Gc,e.lanes=i,e;case Xc:return e=bn(13,n,t,o),e.elementType=Xc,e.lanes=i,e;case qc:return e=bn(19,n,t,o),e.elementType=qc,e.lanes=i,e;case Xv:return iu(n,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Yv:s=10;break e;case Gv:s=9;break e;case xf:s=11;break e;case bf:s=14;break e;case Cr:s=16,r=null;break e}throw Error(te(130,e==null?e:typeof e,""))}return t=bn(s,n,t,o),t.elementType=e,t.type=r,t.lanes=i,t}function co(e,t,n,r){return e=bn(7,e,r,t),e.lanes=n,e}function iu(e,t,n,r){return e=bn(22,e,r,t),e.elementType=Xv,e.lanes=n,e.stateNode={isHidden:!1},e}function pc(e,t,n){return e=bn(6,e,null,t),e.lanes=n,e}function hc(e,t,n){return t=bn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Ik(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=Yu(0),this.expirationTimes=Yu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Yu(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function np(e,t,n,r,o,i,s,a,l){return e=new Ik(e,t,n,a,l),t===1?(t=1,i===!0&&(t|=8)):t=0,i=bn(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Df(i),e}function Tk(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Wo,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function B0(e){if(!e)return Wr;e=e._reactInternals;e:{if(bo(e)!==e||e.tag!==1)throw Error(te(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(qt(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(te(171))}if(e.tag===1){var n=e.type;if(qt(n))return By(e,n,t)}return t}function W0(e,t,n,r,o,i,s,a,l){return e=np(n,r,!0,e,o,i,s,a,l),e.context=B0(null),n=e.current,r=Wt(),o=zr(n),i=dr(r,o),i.callback=t??null,Nr(n,i,o),e.current.lanes=o,Ws(e,o,r),Qt(e,r),e}function su(e,t,n,r){var o=t.current,i=Wt(),s=zr(o);return n=B0(n),t.context===null?t.context=n:t.pendingContext=n,t=dr(i,s),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Nr(o,t,s),e!==null&&(Nn(e,o,s,i),Qa(e,o,s)),s}function Ml(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 rp(e,t){im(e,t),(e=e.alternate)&&im(e,t)}function Rk(){return null}var V0=typeof reportError=="function"?reportError:function(e){console.error(e)};function op(e){this._internalRoot=e}au.prototype.render=op.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(te(409));su(e,t,null,null)};au.prototype.unmount=op.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;go(function(){su(null,e,null,null)}),t[pr]=null}};function au(e){this._internalRoot=e}au.prototype.unstable_scheduleHydration=function(e){if(e){var t=xy();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Tr.length&&t!==0&&t<Tr[n].priority;n++);Tr.splice(n,0,e),n===0&&Sy(e)}};function ip(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function lu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function sm(){}function jk(e,t,n,r,o){if(o){if(typeof r=="function"){var i=r;r=function(){var u=Ml(s);i.call(u)}}var s=W0(t,r,e,0,null,!1,!1,"",sm);return e._reactRootContainer=s,e[pr]=s.current,Cs(e.nodeType===8?e.parentNode:e),go(),s}for(;o=e.lastChild;)e.removeChild(o);if(typeof r=="function"){var a=r;r=function(){var u=Ml(l);a.call(u)}}var l=np(e,0,!1,null,null,!1,!1,"",sm);return e._reactRootContainer=l,e[pr]=l.current,Cs(e.nodeType===8?e.parentNode:e),go(function(){su(t,l,n,r)}),l}function uu(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=Ml(s);a.call(l)}}su(t,s,e,o)}else s=jk(n,t,e,o,r);return Ml(s)}yy=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=ts(t.pendingLanes);n!==0&&(Ef(t,n|1),Qt(t,st()),!(Re&6)&&(yi=st()+500,Kr()))}break;case 13:go(function(){var r=hr(e,1);if(r!==null){var o=Wt();Nn(r,e,1,o)}}),rp(e,1)}};Cf=function(e){if(e.tag===13){var t=hr(e,134217728);if(t!==null){var n=Wt();Nn(t,e,134217728,n)}rp(e,134217728)}};wy=function(e){if(e.tag===13){var t=zr(e),n=hr(e,t);if(n!==null){var r=Wt();Nn(n,e,t,r)}rp(e,t)}};xy=function(){return Ne};by=function(e,t){var n=Ne;try{return Ne=e,t()}finally{Ne=n}};ad=function(e,t,n){switch(t){case"input":if(ed(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=Jl(r);if(!o)throw Error(te(90));Qv(r),ed(r,o)}}}break;case"textarea":ey(e,n);break;case"select":t=n.value,t!=null&&ri(e,!!n.multiple,t,!1)}};ay=Qf;ly=go;var Pk={usingClientEntryPoint:!1,Events:[Hs,Ko,Jl,iy,sy,Qf]},Wi={findFiberByHostInstance:oo,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},_k={bundleType:Wi.bundleType,version:Wi.version,rendererPackageName:Wi.rendererPackageName,rendererConfig:Wi.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:gr.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=dy(e),e===null?null:e.stateNode},findFiberByHostInstance:Wi.findFiberByHostInstance||Rk,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 Sa=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Sa.isDisabled&&Sa.supportsFiber)try{Gl=Sa.inject(_k),Xn=Sa}catch{}}dn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Pk;dn.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!ip(t))throw Error(te(200));return Tk(e,t,null,n)};dn.createRoot=function(e,t){if(!ip(e))throw Error(te(299));var n=!1,r="",o=V0;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=np(e,1,!1,null,null,n,!1,r,o),e[pr]=t.current,Cs(e.nodeType===8?e.parentNode:e),new op(t)};dn.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(te(188)):(e=Object.keys(e).join(","),Error(te(268,e)));return e=dy(t),e=e===null?null:e.stateNode,e};dn.flushSync=function(e){return go(e)};dn.hydrate=function(e,t,n){if(!lu(t))throw Error(te(200));return uu(null,e,t,!0,n)};dn.hydrateRoot=function(e,t,n){if(!ip(e))throw Error(te(405));var r=n!=null&&n.hydratedSources||null,o=!1,i="",s=V0;if(n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=W0(t,null,e,1,n??null,o,!1,i,s),e[pr]=t.current,Cs(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 au(t)};dn.render=function(e,t,n){if(!lu(t))throw Error(te(200));return uu(null,e,t,!1,n)};dn.unmountComponentAtNode=function(e){if(!lu(e))throw Error(te(40));return e._reactRootContainer?(go(function(){uu(null,null,e,!1,function(){e._reactRootContainer=null,e[pr]=null})}),!0):!1};dn.unstable_batchedUpdates=Qf;dn.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!lu(n))throw Error(te(200));if(e==null||e._reactInternals===void 0)throw Error(te(38));return uu(e,t,n,!1,r)};dn.version="18.3.1-next-f1338f8080-20240426";function H0(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(H0)}catch(e){console.error(e)}}H0(),Hv.exports=dn;var Od=Hv.exports,am=Od;Kc.createRoot=am.createRoot,Kc.hydrateRoot=am.hydrateRoot;var Fk=Object.defineProperty,U0=(e,t)=>{for(var n in t)Fk(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 So=d.createContext(!1),Bd=({children:e})=>c.jsx(So.Provider,{value:!0,children:e}),Z0=d.createContext({setError:()=>{},clearError:()=>{}}),lm=()=>{try{return typeof __webpack_module__>"u"?null:__webpack_module__.hot??null}catch{return null}};class Mk extends oe.Component{constructor(){super(...arguments);$e(this,"state",{hasError:!1});$e(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=lm();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=lm();r&&r.removeStatusHandler(n)}render(){return this.state.hasError?null:this.props.children}}var Ei=d.createContext({compositions:[],folders:[],currentCompositionMetadata:null,canvasContent:null}),Zs=d.createContext({registerComposition:()=>{},unregisterComposition:()=>{},registerFolder:()=>{},unregisterFolder:()=>{},setCanvasContent:()=>{},onlyRenderComposition:null}),Ks=d.createContext({getNonce:()=>0}),il=0;try{typeof __webpack_module__<"u"&&__webpack_module__.hot&&__webpack_module__.hot.addStatusHandler(e=>{e==="idle"&&il++})}catch{}var cu=()=>{const t=d.useContext(Ks).getNonce(),n=d.useRef(t);n.current=t;const r=d.useRef([[il,t]]),o=d.useCallback(()=>(il!==r.current[r.current.length-1][0]&&(r.current=[...r.current,[il,n.current]]),r.current),[r]);return d.useMemo(()=>({get:o}),[o])};function Ci(e){return!!e}var K0=()=>/^([a-zA-Z0-9-\u4E00-\u9FFF])+$/g,Y0=e=>e.match(K0()),$k=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(!Y0(e))throw new Error(`Folder name can only contain a-z, A-Z, 0-9 and -. You passed ${e}`)},Ak=`Folder name must match ${String(K0())}`,Wd=d.createContext({folderName:null,parentName:null}),Nk=e=>{const{name:t,children:n}=e,r=d.useContext(Wd),{registerFolder:o,unregisterFolder:i}=d.useContext(Zs),s=cu(),a=e.stack??null;$k(t);const l=[r.parentName,r.folderName].filter(Ci),u=l.length===0?null:l.join("/"),f=d.useMemo(()=>({folderName:t,parentName:u}),[t,u]);return d.useEffect(()=>(o(t,u,s.get(),a),()=>{i(t,u)}),[t,r.folderName,u,o,i,s,a]),c.jsx(Wd.Provider,{value:f,children:n})};function um(){return["NOD","E_EN","V"].join("")}var cm=()=>["e","nv"].join(""),Sn=()=>{const e=typeof window<"u"&&window.remotion_isPlayer,t=typeof window<"u"&&typeof window.process<"u"&&typeof window.process.env<"u"&&(window.process[cm()][um()]==="test"||window.process[cm()][um()]==="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}},Vd="remotion-date:",$s="remotion-file:",Lk=({data:e,indent:t,staticBase:n})=>{let r=!1,o=!1,i=!1,s=!1;try{return{serializedString:JSON.stringify(e,function(l,u){const f=this[l];return f instanceof Date?(r=!0,`${Vd}${f.toISOString()}`):f instanceof Map?(i=!0,u):f instanceof Set?(s=!0,u):typeof f=="string"&&n!==null&&f.startsWith(n)?(o=!0,`${$s}${f.replace(n+"/","")}`):u},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)}},G0=e=>JSON.parse(e,(t,n)=>typeof n=="string"&&n.startsWith(Vd)?new Date(n.replace(Vd,"")):typeof n=="string"&&n.startsWith($s)?`${window.remotion_staticBase}/${n.replace($s,"")}`:n),zk=e=>G0(Lk({data:e,indent:2,staticBase:window.remotion_staticBase}).serializedString),Hd=e=>Sn().isStudio?zk(e):e,X0=d.createContext(!1),Dk=({children:e})=>c.jsx(X0.Provider,{value:!0,children:e}),sp=()=>d.useContext(X0),br=({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}`))},Ok=(e,t)=>{const{style:n,...r}=e,o=d.useMemo(()=>({position:"absolute",top:br({className:r.className,classPrefix:["top-","inset-"],type:"prefix"})?void 0:0,left:br({className:r.className,classPrefix:["left-","inset-"],type:"prefix"})?void 0:0,right:br({className:r.className,classPrefix:["right-","inset-"],type:"prefix"})?void 0:0,bottom:br({className:r.className,classPrefix:["bottom-","inset-"],type:"prefix"})?void 0:0,width:br({className:r.className,classPrefix:["w-"],type:"prefix"})?void 0:"100%",height:br({className:r.className,classPrefix:["h-"],type:"prefix"})?void 0:"100%",display:br({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:br({className:r.className,classPrefix:["flex-row","flex-col","flex-row-reverse","flex-col-reverse"],type:"exact"})?void 0:"column",...n}),[r.className,n]);return c.jsx("div",{ref:t,style:o,...r})},Dn=d.forwardRef(Ok),Bk={transform:"rotate(90deg)"},dm=40,Wk={color:"white",fontSize:14,fontFamily:"sans-serif"},Vk={justifyContent:"center",alignItems:"center"},Hk=()=>c.jsxs(Dn,{style:Vk,id:"remotion-comp-loading",children:[c.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
+ `}),c.jsx("svg",{width:dm,height:dm,viewBox:"-100 -100 400 400",style:Bk,children:c.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"})}),c.jsxs("p",{style:Wk,children:["Resolving ","<Suspense>","..."]})]}),nn=null,Ud=()=>{if(!nn){if(typeof document>"u")throw new Error("Tried to call an API that only works in the browser from outside the browser");nn=document.createElement("div"),nn.style.position="absolute",nn.style.top="0px",nn.style.left="0px",nn.style.right="0px",nn.style.bottom="0px",nn.style.width="100%",nn.style.height="100%",nn.style.display="flex",nn.style.flexDirection="column";const e=document.createElement("div");e.style.position="fixed",e.style.top="-999999px",e.appendChild(nn),document.body.appendChild(e)}return nn},Zd=()=>"remotion_inputPropsOverride"+window.location.origin,q0=()=>{if(typeof localStorage>"u")return null;const e=localStorage.getItem(Zd());return e?JSON.parse(e):null},Uk=e=>{if(!(typeof localStorage>"u")){if(e===null){localStorage.removeItem(Zd());return}localStorage.setItem(Zd(),JSON.stringify(e))}},fm=!1,Zk=()=>{fm||(fm=!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()"))},Kk=()=>{if(typeof window>"u")return Zk(),{};if(Sn().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=q0();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?G0(t):{}},ap=d.createContext({props:{},updateProps:()=>{throw new Error("Not implemented")}}),Yk=oe.createRef(),Q0=({children:e})=>{const[t,n]=oe.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 c.jsx(ap.Provider,{value:o,children:e})},J0=oe.createContext(null),at=()=>{const e=d.useContext(J0),[t]=d.useState(()=>Sn());return e??t};function $l(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 du(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 fu(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 pu=d.createContext(null),Gk=d.createRef(),Xk=e=>!!e.calculateMetadata,lp=e=>{const t=d.useContext(pu),{props:n}=d.useContext(ap),{compositions:r,canvasContent:o,currentCompositionMetadata:i}=d.useContext(Ei),s=(o==null?void 0:o.type)==="composition"?o.compositionId:null,a=e??s,l=r.find(p=>p.id===a),u=d.useMemo(()=>l?n[l.id]??{}:{},[n,l]),f=at();return d.useMemo(()=>l?i?{type:"success",metadataSource:null,result:{...i,id:l.id,defaultProps:l.defaultProps??{}}}:Xk(l)?!t||!t[l.id]?null:t[l.id]:(du(l.durationInFrames,{allowFloats:!1,component:`in <Composition id="${l.id}">`}),fu(l.fps,`in <Composition id="${l.id}">`),$l(l.width,"width",`in <Composition id="${l.id}">`),$l(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??{},...u??{},...typeof window>"u"||f.isPlayer||!window.remotion_inputProps?{}:Kk()??{}},defaultCodec:null,defaultOutName:null,defaultVideoImageFormat:null,defaultPixelFormat:null,defaultProResProfile:null,defaultSampleRate:null}}):null,[l,t,i,u,f.isPlayer])},ew=e=>{const t=e.stack??"";return t.startsWith("Error:")?t:`${e.message}
55
+ ${t}`},qk=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 up(e,t){let n;throw qk(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=ew(n)),n}function As(e){return up(typeof window<"u"?window:void 0,e)}var Qk=["trace","verbose","info","warn","error"],pm=e=>Qk.indexOf(e),hu=(e,t)=>pm(e)<=pm(t),Ys=({args:e,logLevel:t,tag:n})=>{const r=[...e];return Sn().isRendering&&!Sn().isClientSideRendering&&r.unshift(Symbol.for(`__remotion_level_${t}`)),n&&Sn().isRendering&&!Sn().isClientSideRendering&&r.unshift(Symbol.for(`__remotion_tag_${n}`)),r},Jk=(e,...t)=>{if(hu(e.logLevel,"verbose"))return console.debug(...Ys({args:t,logLevel:"verbose",tag:e.tag}))},eE=(e,...t)=>{if(hu(e.logLevel,"trace"))return console.debug(...Ys({args:t,logLevel:"trace",tag:e.tag}))},tE=(e,...t)=>{if(hu(e.logLevel,"info"))return console.log(...Ys({args:t,logLevel:"info",tag:e.tag}))},nE=(e,...t)=>{if(hu(e.logLevel,"warn"))return console.warn(...Ys({args:t,logLevel:"warn",tag:e.tag}))},rE=(e,...t)=>console.error(...Ys({args:t,logLevel:"error",tag:e.tag})),xt={trace:eE,verbose:Jk,info:tE,warn:nE,error:rE};typeof window<"u"&&(window.remotion_renderReady=!1,window.remotion_delayRenderTimeouts||(window.remotion_delayRenderTimeouts={}),window.remotion_delayRenderHandles=[]);var oE="The delayRender was called:",iE="Retries left: ",sE="- Rendering the frame will be retried.",aE="handle was cleared after",lE=3e4,tw=({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??lE)-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 u=["A delayRender()",n?`"${n}"`:null,`was called but not cleared after ${a}ms. See https://remotion.dev/docs/timeout for help.`,l>0?iE+l:null,l>0?sE:null,oE,i].filter(Ci).join(" ");t.isClientSideRendering?e.remotion_cancelledError=ew(Error(u)):up(e,Error(u))},a)}}return e.remotion_renderReady=!1,o},uE=(e,t)=>typeof window>"u"?Math.random():tw({scope:window,environment:Sn(),label:e??null,options:{}}),nw=({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 u=[s?`"${s}"`:"A handle",aE,`${Date.now()-a}ms`].filter(Ci).join(" ");xt.verbose({logLevel:r,tag:"delayRender()"},u),delete e.remotion_delayRenderTimeouts[t]}e.remotion_delayRenderHandles=e.remotion_delayRenderHandles.filter(s=>s!==t),e.remotion_delayRenderHandles.length===0&&(e.remotion_renderReady=!0)},cE=e=>{typeof window>"u"||nw({scope:window,handle:e,environment:Sn(),logLevel:window.remotion_logLevel??"info"})},ko=d.createContext({logLevel:"info",mountTime:0}),er=()=>{const{logLevel:e}=d.useContext(ko);if(e===null)throw new Error("useLogLevel must be used within a LogLevelProvider");return e},Gs=()=>{const{mountTime:e}=d.useContext(ko);if(e===null)throw new Error("useMountTime must be used within a LogLevelProvider");return e},rw=d.createContext(null),On=()=>{const e=at(),t=d.useContext(rw)??(typeof window<"u"?window:void 0),n=er(),r=d.useCallback((s,a)=>t?tw({scope:t,environment:e,label:s??null,options:a??{}}):Math.random(),[e,t]),o=d.useCallback(s=>{t&&nw({scope:t,handle:s,environment:e,logLevel:n})},[e,n,t]),i=d.useCallback(s=>up(t??(typeof window<"u"?window:void 0),s),[t]);return{delayRender:r,continueRender:o,cancelRender:i}},ow=({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 oe.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 oe.lazy(e.lazyComponent)}throw new Error("You must pass either 'component' or 'lazyComponent'")},[e.lazyComponent])},mu=()=>{const{canvasContent:e,compositions:t,currentCompositionMetadata:n}=d.useContext(Ei),r=t.find(i=>(e==null?void 0:e.type)==="composition"&&i.id===e.compositionId),o=lp((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])},iw=()=>/^([a-zA-Z0-9-\u4E00-\u9FFF])+$/g,sw=e=>e.match(iw()),dE=e=>{if(!sw(e))throw new Error(`Composition id can only contain a-z, A-Z, 0-9, CJK characters and -. You passed ${e}`)},fE=`Composition ID must match ${String(iw())}`,pE=(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}"`:""}`)}},hE=()=>{const{continueRender:e,delayRender:t}=On();return d.useEffect(()=>{const n=t("Waiting for Root component to unsuspend");return()=>e(n)},[e,t]),null},mE=({width:e,height:t,fps:n,durationInFrames:r,id:o,defaultProps:i,schema:s,...a})=>{const l=d.useContext(Zs),{registerComposition:u,unregisterComposition:f}=l,p=mu(),h=ow({compProps:a,componentName:"Composition",noSuspense:!1}),m=cu(),w=sp(),g=at(),k=d.useContext(So);if(typeof window<"u"&&(window.remotion_seenCompositionIds=Array.from(new Set([...window.remotion_seenCompositionIds??[],o]))),k)throw w?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:v,parentName:y}=d.useContext(Wd),x=a.stack??null,b="component"in a?a.component:null;d.useEffect(()=>{if(!o)throw new Error("No id for composition passed.");return dE(o),pE(i,"defaultProps",o),u({durationInFrames:r??void 0,fps:n??void 0,height:t??void 0,width:e??void 0,id:o,folderName:v,component:h,defaultProps:Hd(i??{}),nonce:m.get(),parentFolderName:y,componentFromProps:b,schema:s??null,calculateMetadata:a.calculateMetadata??null,stack:x}),()=>{f(o)}},[r,n,t,h,o,v,i,e,m,y,b,s,a.calculateMetadata,x,u,f]);const S=lp(o),{setError:E,clearError:T}=d.useContext(Z0),R=d.useCallback($=>{E($)},[E]),P=d.useCallback(()=>{T()},[T]);if(g.isStudio&&p&&p.component===h&&p.id===o){const $=h;return S===null||S.type!=="success"&&S.type!=="success-and-refreshing"?null:Od.createPortal(c.jsx(Bd,{children:c.jsx(Mk,{onError:R,onClear:P,children:c.jsx(d.Suspense,{fallback:c.jsx(Hk,{}),children:c.jsx($,{...S.result.props??{}})})})}),Ud())}if(g.isRendering&&p&&p.component===h&&p.id===o){const $=h;return S===null||S.type!=="success"&&S.type!=="success-and-refreshing"?null:Od.createPortal(c.jsx(Bd,{children:c.jsx(d.Suspense,{fallback:c.jsx(hE,{}),children:c.jsx($,{...S.result.props??{}})})}),Ud())}return null},Al=e=>{const{onlyRenderComposition:t}=d.useContext(Zs);return t&&t!==e.id?null:c.jsx(mE,{...e})},aw=[],lw=null,gE=()=>aw,Ut=e=>{aw.push(e)},vE=e=>{lw=e},yE=()=>lw,wE=e=>{const t=oe.Children.toArray(e);if(t.length!==1)return null;const n=t[0];return!oe.isValidElement(n)||typeof n.type!="function"&&typeof n.type!="object"?null:n.type},rs="4.0.499",xE=()=>{if(typeof globalThis>"u")return;const e=()=>{globalThis.remotion_imported=rs,typeof window<"u"&&(window.remotion_imported=rs)},t=globalThis.remotion_imported||typeof window<"u"&&window.remotion_imported;if(t){if(t===rs)return;if(typeof t=="string"&&t.includes("webcodecs")){e();return}throw new TypeError(`🚨 Multiple versions of Remotion detected: ${[rs,typeof t=="string"?t:"an older version"].filter(Ci).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()},mt=d.createContext(null),Kd={};U0(Kd,{useTimelineSetFrame:()=>mw,useTimelinePosition:()=>Gr,useTimelineContext:()=>Yr,usePlayingState:()=>gw,usePlaybackRate:()=>pp,useAbsoluteTimelinePosition:()=>hw,persistCurrentFrame:()=>uw,getInitialFrameState:()=>cw,getFrameForComposition:()=>dw,clampFrameToCompositionRange:()=>fw});function hm(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 bE(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 Eo=(e,t)=>{if(e===null)return Math.random();if(typeof e=="string")return hm(bE(e));if(typeof e=="number")return hm(e*1e10);throw new Error("random() argument must be a number or a string")},Ii=d.createContext({setFrame:()=>{throw new Error("default")},setPlaying:()=>{throw new Error("default")}}),Ti=d.createContext(null),cp=d.createContext(null),dp=d.createContext(null),SE=({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(Eo(null))),[u,f]=d.useState(()=>cw()),p=t??u,{delayRender:h,continueRender:m}=On();typeof window<"u"&&d.useLayoutEffect(()=>{window.remotion_setFrame=(v,y,x)=>{window.remotion_attempt=x;const b=h(`Setting the current frame to ${v}`);let S=!0;f(E=>(E[y]??window.remotion_initialFrame)===v?(S=!1,E):{...E,[y]:v}),S?requestAnimationFrame(()=>m(b)):m(b)},window.remotion_isPlayer=!1},[m,h]);const w=d.useMemo(()=>({frame:p,playing:n,imperativePlaying:o,rootId:l,audioAndVideoTags:a}),[p,n,l]),g=d.useMemo(()=>({playbackRate:i,setPlaybackRate:s}),[i]),k=d.useMemo(()=>({setFrame:f,setPlaying:r}),[]);return c.jsx(dp.Provider,{value:w,children:c.jsx(cp.Provider,{value:g,children:c.jsx(Ti.Provider,{value:w,children:c.jsx(Ii.Provider,{value:k,children:e})})})})},fp=()=>"remotion.time-all",uw=e=>{localStorage.setItem(fp(),JSON.stringify(e))},cw=()=>{const e=localStorage.getItem(fp())??"{}";return JSON.parse(e)},dw=e=>{const t=localStorage.getItem(fp())??"{}",n=JSON.parse(t);return n[e]!==void 0?Number(n[e]):typeof window>"u"?0:window.remotion_initialFrame??0},fw=(e,t)=>Math.max(0,Math.min(Math.max(0,t-1),e)),pw=e=>{const t=mu(),n=at();if(!t)return typeof window>"u"?0:window.remotion_initialFrame??0;const r=e.frame[t.id]??(n.isPlayer?0:dw(t.id));return fw(r,t.durationInFrames)},Yr=()=>{const e=d.useContext(Ti);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(cp);if(e===null)throw new Error("PlaybackRateContext is not available. This hook must be used inside a <Player> or the Remotion Studio.");return e},Gr=()=>{const e=Yr();return pw(e)},hw=()=>{const e=d.useContext(dp);if(e===null)throw new Error("AbsoluteTimeContext is not available. This hook must be used inside a <Player> or the Remotion Studio.");return pw(e)},mw=()=>{const{setFrame:e}=d.useContext(Ii);return e},gw=()=>{const{playing:e,imperativePlaying:t}=Yr(),{setPlaying:n}=d.useContext(Ii);return d.useMemo(()=>[e,n,t],[t,e,n])},It=()=>{const e=d.useContext(So),t=at();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=Gr(),r=d.useContext(mt),o=r?r.cumulatedFrom+r.relativeFrom:0;return n-o},gu=()=>{const e=d.useContext(mt),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=mu();return d.useMemo(()=>{if(!o)return null;const{id:i,durationInFrames:s,fps:a,height:l,width:u,defaultProps:f,props:p,defaultCodec:h,defaultOutName:m,defaultVideoImageFormat:w,defaultPixelFormat:g,defaultProResProfile:k,defaultSampleRate:v}=o;return{id:i,width:t??u,height:n??l,fps:a,durationInFrames:r??s,defaultProps:f,props:p,defaultCodec:h,defaultOutName:m,defaultVideoImageFormat:w,defaultPixelFormat:g,defaultProResProfile:k,defaultSampleRate:v}},[r,n,t,o])},ct=()=>{const e=gu(),t=d.useContext(So),n=sp();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},Xs=({frame:e,children:t,active:n=!0})=>{const r=It(),o=ct();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=Yr(),a=d.useContext(mt),l=(a==null?void 0:a.relativeFrom)??0,u=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 c.jsx(Ti.Provider,{value:u,children:c.jsx(mt.Provider,{value:f,children:t})})},tr={"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}},kE=tr,vu={"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}},Xr={"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"}},qr={"style.backgroundColor":{type:"color",default:"transparent",description:"Color"}},vw={children:{type:"text-content",default:"",description:"Text",keyframable:!1}},Ri={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}},yw={...Ri},ww={...tr,...qr,...Xr,...yw},hp={type:"boolean",default:!1,description:"Hidden"},xw={type:"hidden"},mp={type:"hidden"},EE=e=>({name:mp,...e}),gp={type:"number",default:void 0,min:1,step:1,hiddenFromList:!0},bw={type:"number",default:0,step:1,hiddenFromList:!0},Sw={type:"number",default:0,min:0,step:1,hiddenFromList:!0},vp={type:"number",default:null,step:1,hiddenFromList:!0},vr={durationInFrames:gp,from:bw,trimBefore:Sw,freeze:vp,hidden:hp,name:mp,showInTimeline:xw},wi={...vr,layout:{type:"enum",default:"absolute-fill",description:"Layout",variants:{"absolute-fill":ww,none:{}}}},CE={durationInFrames:gp,trimBefore:Sw,freeze:vp,hidden:hp,name:mp,showInTimeline:xw},IE={...CE,layout:wi.layout},TE={...wi,layout:{...wi.layout,default:"none"}},ji=oe.createContext({registerSequence:()=>{throw new Error("SequenceManagerContext not initialized")},unregisterSequence:()=>{throw new Error("SequenceManagerContext not initialized")},sequences:[]}),yu=oe.createContext({current:[]}),ar=e=>`${e.absolutePath}\0${e.nodePath.join(".")}\0${e.sequenceKeys.join(".")}\0${e.effectKeys.map(t=>t.join(".")).join(".")}`,wu=oe.createContext({propStatuses:{}}),xu=oe.createContext({current:{}}),bu=oe.createContext({getDragOverrides:()=>{throw new Error("VisualModeDragOverridesContext not initialized")},getEffectDragOverrides:()=>{throw new Error("VisualModeDragOverridesContext not initialized")}}),kw=oe.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")}}),mc=(e,t)=>`${ar(e)}.effects.${t}`,RE=({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({}),[u,f]=d.useState({}),p=d.useRef(u);p.current=u;const h=d.useCallback((P,$,N)=>{i(W=>({...W,[ar(P)]:{...W[ar(P)],[$]:N}}))},[]),m=d.useCallback(P=>{i($=>{const N=ar(P);if(!$[N])return $;const W={...$};return delete W[N],W})},[]),w=d.useCallback((P,$,N,W)=>{l(j=>{const _=mc(P,$);return{...j,[_]:{...j[_],[N]:W}}})},[]),g=d.useCallback((P,$)=>{l(N=>{const W=mc(P,$);if(!N[W])return N;const j={...N};return delete j[W],j})},[]),k=d.useCallback((P,$)=>{f(N=>{const W=ar(P),j=N[W],_=$(j);return j===_?N:{...N,[W]:_}})},[]),v=d.useCallback(P=>{n($=>[...$,P])},[]),y=d.useCallback(P=>{n($=>$.filter(N=>N.id!==P))},[]),x=d.useMemo(()=>({registerSequence:v,sequences:t,unregisterSequence:y}),[v,t,y]),b=d.useCallback(P=>o[ar(P)]??{},[o]),S=d.useCallback((P,$)=>a[mc(P,$)]??{},[a]),E=d.useMemo(()=>({propStatuses:u}),[u]),T=d.useMemo(()=>({getDragOverrides:b,getEffectDragOverrides:S}),[b,S]),R=d.useMemo(()=>({setDragOverrides:h,clearDragOverrides:m,setEffectDragOverrides:w,clearEffectDragOverrides:g,setPropStatuses:k}),[h,m,w,g,k]);return c.jsx(yu.Provider,{value:r,children:c.jsx(ji.Provider,{value:x,children:c.jsx(xu.Provider,{value:p,children:c.jsx(wu.Provider,{value:E,children:c.jsx(bu.Provider,{value:T,children:c.jsx(kw.Provider,{value:R,children:e})})})})})})},Su=d.createContext(!1),jE=({children:e})=>c.jsx(Su.Provider,{value:!0,children:e}),Ew=({children:e})=>c.jsx(Su.Provider,{value:!1,children:e}),PE=()=>{if(!oe.useContext(Su))throw new Error("This component must be inside a <Series /> component.")},Cw=d.createContext({premountFramesRemaining:0}),_E=!1,qs=e=>e??_E,Qs=({from:e,durationInFrames:t,premountFor:n,postmountFor:r,style:o,styleWhilePremounted:i,styleWhilePostmounted:s,hideWhilePremounted:a})=>{const l=d.useContext(Cw),u=It()-l.premountFramesRemaining,f=at(),{fps:p}=ct(),h=n??0,m=r??0,w=Math.ceil(e+t-1),g=!f.isRendering&&u<e&&u>=e-h,k=!f.isRendering&&u>w&&u<=w+m,v=g||k,y=g?e:k?e+t-1:0,x=d.useMemo(()=>v?{...o,...a==="opacity"?{opacity:0}:{display:"none"},pointerEvents:"none",...g?i:{},...k?s:{}}:o,[v,a,k,g,o,s,i]);return{effectivePremountFor:h,effectivePostmountFor:m,premountingActive:g,postmountingActive:k,isPremountingOrPostmounting:v,freezeFrame:y,premountingStyle:x}},FE=(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},ME=4,$E=.001,AE=1e-7,NE=10,os=11,ka=1/(os-1),LE=typeof Float32Array=="function";function Iw(e,t){return 1-3*t+3*e}function Tw(e,t){return 3*t-6*e}function Rw(e){return 3*e}function Nl(e,t,n){return((Iw(t,n)*e+Tw(t,n))*e+Rw(t))*e}function jw(e,t,n){return 3*Iw(t,n)*e*e+2*Tw(t,n)*e+Rw(t)}function zE({aX:e,_aA:t,_aB:n,mX1:r,mX2:o}){let i,s,a=0,l=t,u=n;do s=l+(u-l)/2,i=Nl(s,r,o)-e,i>0?u=s:l=s;while(Math.abs(i)>AE&&++a<NE);return s}function DE(e,t,n,r){let o=t;for(let i=0;i<ME;++i){const s=jw(o,n,r);if(s===0)return o;const a=Nl(o,n,r)-e;o-=a/s}return o}function Pw(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=LE?new Float32Array(os):new Array(os);if(e!==t||n!==r)for(let s=0;s<os;++s)o[s]=Nl(s*ka,e,n);function i(s){let a=0,l=1;const u=os-1;for(;l!==u&&o[l]<=s;++l)a+=ka;--l;const f=(s-o[l])/(o[l+1]-o[l]),p=a+f*ka,h=jw(p,e,n);return h>=$E?DE(s,p,e,n):h===0?p:zE({aX:s,_aA:a,_aB:a+ka,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:Nl(i(a),t,r)}}var OE=e=>Math.round(e*1e6)/1e6,BE=new Set(["deg","rad","grad","turn"]),_w=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"]),Fw=/^([+-]?(?:\d+\.?\d*|\.\d+))([a-zA-Z%]+)?$/,Mw=new Set(["left","center","right","top","bottom"]),ei=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:"%"}}],Vi={value:50,unit:"%"},mm=e=>String(OE(e)),WE=(e,t)=>{const n=Fw.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(BE.has(r))return{kind:"rotate",value:o,unit:r};if(_w.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`)},$w=({component:e,value:t,allowPercentage:n})=>{const r=Fw.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||!_w.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}},gc=(e,t)=>{const n=e.toLowerCase();return Mw.has(n)?{type:"keyword",keyword:n}:{type:"length-percentage",parsed:$w({component:e,value:t,allowPercentage:!0})}},VE=(e,t,n)=>{const r=[];for(const o of ei(e))for(const i of ei(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]},HE=(e,t)=>{if(e.length===1){const a=gc(e[0],t);return a.type==="length-percentage"?[a.parsed,Vi]:a.keyword==="top"||a.keyword==="bottom"?[Vi,ei(a.keyword)[0].value]:[ei(a.keyword)[0].value,Vi]}const n=gc(e[0],t),r=gc(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 VE(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[ei(o.keyword)[0].value,i]}return o.keyword==="top"||o.keyword==="bottom"?[i,ei(o.keyword)[0].value]:s?[Vi,i]:[i,Vi]},UE=(e,t)=>{const[n,r]=HE(t.slice(0,2),e),o=t[2]===void 0?{value:0,unit:null}:$w({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}},ZE=e=>{var o,i,s,a,l,u;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=>Mw.has(f.toLowerCase())))return UE(e,t);const n=t.map(f=>WE(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,((u=n[2])==null?void 0:u.unit)??null],dimensions:n.length}},KE=({kind:e,values:t,units:n,dimensions:r})=>e==="scale"?t.slice(0,r).map(o=>mm(o)).join(" "):t.slice(0,r).map((o,i)=>`${mm(o)}${n[i]}`).join(" "),gm=e=>e===0?0:Math.sign(e)*e*e,YE=e=>e===0?0:Math.sign(e)*Math.sqrt(Math.abs(e));function GE(e,t,n,r){const{extrapolateLeft:o,extrapolateRight:i,easing:s,output:a}=r;let l=e;const[u,f]=t,[p,h]=n;if(l<u){if(o==="identity")return l;if(o==="clamp")l=u;else if(o==="wrap"){const m=f-u;l=((l-u)%m+m)%m+u}}if(l>f){if(i==="identity")return l;if(i==="clamp")l=f;else if(i==="wrap"){const m=f-u;l=((l-u)%m+m)%m+u}}if(p===h)return p;if(l=(l-u)/(f-u),l=s(l),a==="perceptual-scale"){const m=gm(p),w=gm(h);l=YE(l*(w-m)+m)}else l=l*(h-p)+p;return l}function XE(e,t){let n;for(n=1;n<t.length-1&&!(t[n]>=e);++n);return n-1}var qE=e=>e,QE=e=>e??"linear",Aw=e=>e.remotionShouldExtendRight===!0,vm=({easing:e,segmentIndex:t})=>e===void 0?qE:typeof e=="function"?e:e[t],ym=({input:e,inputRange:t,outputRange:n,easing:r,extrapolateLeft:o,extrapolateRight:i,output:s})=>GE(e,t,n,{easing:r,extrapolateLeft:o,extrapolateRight:e>t[1]&&i==="clamp"&&Aw(r)?"extend":i,output:s}),yp=({input:e,inputRange:t,outputRange:n,options:r})=>{const o=QE(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,u=XE(l,t),f=vm({easing:i,segmentIndex:u});let p=ym({input:l,inputRange:[t[u],t[u+1]],outputRange:[n[u],n[u+1]],easing:f,extrapolateLeft:s,extrapolateRight:a,output:o});for(let h=0;h<u;h++){const m=vm({easing:i,segmentIndex:h});if(!Aw(m))continue;const w=t[h+1];if(l<=w)continue;const g=ym({input:l,inputRange:[t[h],w],outputRange:[n[h],n[h+1]],easing:m,extrapolateLeft:s,extrapolateRight:"extend",output:o});p+=g-n[h+1]}return p},JE=({input:e,inputRange:t,outputRange:n,options:r})=>{var u;const o=n.map(ZE),i=(u=o[0])==null?void 0:u.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]=yp({input:e,inputRange:t,outputRange:o.map(p=>p.values[f]),options:r});return KE({kind:i,values:l,units:a,dimensions:s})},eC=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},tC=({input:e,inputRange:t,outputRange:n,options:r})=>{const o=eC(n);return new Array(o).fill(!0).map((i,s)=>yp({input:e,inputRange:t,outputRange:n.map(a=>a[s]),options:r}))};function nC(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 wm(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 rC(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 oC(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 iC(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 Pi(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(wm("inputRange",t),nC(t),rC(r==null?void 0:r.easing,t.length),oC(r==null?void 0:r.posterize),iC(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 JE({input:e,inputRange:t,outputRange:n,options:r})}if(n.every(i=>Array.isArray(i)))return tC({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 wm("outputRange",n),yp({input:e,inputRange:t,outputRange:n,options:r})}var sC=({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}`)},aC=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)}},lC={damping:10,mass:1,stiffness:100,overshootClamping:!1},vc={};function uC({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,u=n.mass,f=n.stiffness,p=[r,o,i,s,l,u,f,t].join("-");if(vc[p])return vc[p];const h=-s,m=r-i,w=l/(2*Math.sqrt(f*u)),g=Math.sqrt(f/u),k=g*Math.sqrt(1-w**2),v=a/1e3,y=Math.sin(k*v),x=Math.cos(k*v),b=Math.exp(-w*g*v),S=b*(y*((h+w*g*m)/k)+m*x),E=r-S,T=w*g*S-b*(x*(h+w*g*m)-k*m*y),R=Math.exp(-g*v),P=r-R*(m+(h+g*m)*v),$=R*(h*(v*g-1)+v*m*g*g),N={toValue:r,prevPosition:i,lastTimestamp:t,current:w<1?E:P,velocity:w<1?T:$};return vc[p]=N,N}var yc={};function Nw({frame:e,fps:t,config:n={}}){const i=[e,t,n.damping,n.mass,n.overshootClamping,n.stiffness].join("-");if(yc[i])return yc[i];let s={lastTimestamp:0,current:0,toValue:1,velocity:0,prevPosition:0};const a=Math.max(0,e),l=a%1;for(let u=0;u<=Math.floor(a);u++){u===Math.floor(a)&&(u+=l);const f=u/t*1e3;s=uC({animation:s,now:f,config:{...lC,...n}})}return yc[i]=s,s}var wc=new Map;function Lw({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(wc.has(r))return wc.get(r);fu(e,"to the measureSpring() function");let o=0,i=0;const s=()=>Nw({fps:e,frame:o,config:t});let a=s();const l=()=>Math.abs(a.current-a.toValue);let u=l();for(;u>=n;)o++,a=s(),u=l();i=o;for(let f=0;f<20;f++)o++,a=s(),u=l(),u>=n&&(f=0,i=o+1);return wc.set(r,i),i}function Yd({frame:e,fps:t,config:n={},from:r=0,to:o=1,durationInFrames:i,durationRestThreshold:s,delay:a=0,reverse:l=!1}){aC(i),sC({frame:e,durationInFrames:1/0,allowFloats:!0}),fu(t,"to spring()");const u=l||typeof i<"u",f=u?Lw({fps:t,config:n,threshold:s}):void 0,p=u?{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),w=i===void 0?m:m/(i/p.get());if(i&&m>i)return o;const g=Nw({fps:t,frame:w,config:n}),k=n.overshootClamping?o>=r?Math.min(g.current,o):Math.max(g.current,o):g.current;return r===0&&o===1?k:Pi(k,[0,1],[r,o])}var xm=e=>Math.min(1,Math.max(0,e)),Hi=30;class Ll{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 Ll.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=xm(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:Yd(t?{fps:Hi,frame:i*Lw({fps:Hi,config:r,threshold:n}),config:r}:{fps:Hi,frame:i*Hi,config:r,durationInFrames:Hi,durationRestThreshold:n}),{remotionShouldExtendRight:t})}static bounce(t){const n=xm(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 Pw(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 Pn="[-+]?\\d*\\.?\\d+",Ea=Pn+"%";function Ca(...e){return"\\(\\s*("+e.join(")\\s*,\\s*(")+")\\s*\\)"}var Ia="(?:none|[-+]?\\d*\\.?\\d+(?:%|deg|rad|grad|turn)?)";function Ui(e){return new RegExp(e+"\\(\\s*("+Ia+")\\s+("+Ia+")\\s+("+Ia+")(?:\\s*\\/\\s*("+Ia+"))?\\s*\\)")}function cC(){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"+Ca(Pn,Pn,Pn)),e.rgba=new RegExp("rgba"+Ca(Pn,Pn,Pn,Pn)),e.hsl=new RegExp("hsl"+Ca(Pn,Ea,Ea)),e.hsla=new RegExp("hsla"+Ca(Pn,Ea,Ea,Pn)),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=Ui("oklch"),e.oklab=Ui("oklab"),e.lab=Ui("lab"),e.lch=Ui("lch"),e.hwb=Ui("hwb")),e}function ui(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 bm(e,t,n){const r=n<.5?n*(1+t):n+t-n*t,o=2*n-r,i=ui(o,r,e+1/3),s=ui(o,r,e),a=ui(o,r,e-1/3);return Math.round(i*255)<<24|Math.round(s*255)<<16|Math.round(a*255)<<8}function Mo(e){const t=Number.parseInt(e,10);return t<0?0:t>255?255:t}function Sm(e){return(Number.parseFloat(e)%360+360)%360/360}function km(e){const t=Number.parseFloat(e);return t<0?0:t>1?255:Math.round(t*255)}function Ta(e){const t=Number.parseFloat(e);return t<0?0:t>100?1:t/100}function gn(e,t){return e==="none"?0:e.endsWith("%")?Number.parseFloat(e)/100*t:Number.parseFloat(e)}function xc(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 Zi(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 ci(e){return e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055}function Ra(e){return Math.max(0,Math.min(1,e))}function Ki(e,t,n,r){const o=Math.round(Ra(e)*255),i=Math.round(Ra(t)*255),s=Math.round(Ra(n)*255),a=Math.round(Ra(r)*255);return(o<<24|i<<16|s<<8|a)>>>0}function Em(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,u=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[ci(u),ci(f),ci(p)]}function Cm(e,t,n){const r=.008856451679035631,o=24389/27,i=.95047,s=1,a=1.08883,l=(e+16)/116,u=t/500+l,f=l-n/200,p=u*u*u,h=f*f*f,m=p>r?p:(116*u-16)/o,w=e>o*r?((e+16)/116)**3:e/o,g=h>r?h:(116*f-16)/o,k=m*i,v=w*s,y=g*a,x=3.2404542*k-1.5371385*v-.4985314*y,b=-.969266*k+1.8760108*v+.041556*y,S=.0556434*k-.2040259*v+1.0572252*y;return[ci(x),ci(b),ci(S)]}function dC(e,t,n){if(t+n>=1){const u=t/(t+n);return[u,u,u]}const r=1,o=0,i=ui(o,r,e+1/3),s=ui(o,r,e),a=ui(o,r,e-1/3),l=1-t-n;return[i*l+t,s*l+t,a*l+t]}var Im={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 fC(e){const t=cC();let n;if(t.hex6&&(n=t.hex6.exec(e)))return Number.parseInt(n[1]+"ff",16)>>>0;if(Im[e]!==void 0)return Im[e];if(t.rgb&&(n=t.rgb.exec(e)))return(Mo(n[1])<<24|Mo(n[2])<<16|Mo(n[3])<<8|255)>>>0;if(t.rgba&&(n=t.rgba.exec(e)))return(Mo(n[1])<<24|Mo(n[2])<<16|Mo(n[3])<<8|km(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(bm(Sm(n[1]),Ta(n[2]),Ta(n[3]))|255)>>>0;if(t.hsla&&(n=t.hsla.exec(e)))return(bm(Sm(n[1]),Ta(n[2]),Ta(n[3]))|km(n[4]))>>>0;if(t.oklch&&(n=t.oklch.exec(e))){const r=gn(n[1],1),o=gn(n[2],.4),i=xc(n[3]),s=Zi(n[4]),a=i*Math.PI/180,[l,u,f]=Em(r,o*Math.cos(a),o*Math.sin(a));return Ki(l,u,f,s)}if(t.oklab&&(n=t.oklab.exec(e))){const r=gn(n[1],1),o=gn(n[2],.4),i=gn(n[3],.4),s=Zi(n[4]),[a,l,u]=Em(r,o,i);return Ki(a,l,u,s)}if(t.lab&&(n=t.lab.exec(e))){const r=gn(n[1],100),o=gn(n[2],125),i=gn(n[3],125),s=Zi(n[4]),[a,l,u]=Cm(r,o,i);return Ki(a,l,u,s)}if(t.lch&&(n=t.lch.exec(e))){const r=gn(n[1],100),o=gn(n[2],150),i=xc(n[3]),s=Zi(n[4]),a=i*Math.PI/180,[l,u,f]=Cm(r,o*Math.cos(a),o*Math.sin(a));return Ki(l,u,f,s)}if(t.hwb&&(n=t.hwb.exec(e))){const r=xc(n[1]),o=gn(n[2],1),i=gn(n[3],1),s=Zi(n[4]),[a,l,u]=dC(r/360,o,i);return Ki(a,l,u,s)}throw new Error(`invalid color string ${e} provided`)}var Tm=e=>(e>>24&255)/255,pC=e=>e>>16&255,hC=e=>e>>8&255,mC=e=>e&255,gC=(e,t,n,r)=>`rgba(${e}, ${t}, ${n}, ${r})`;function vC(e){const t=fC(e);return(t<<24|t>>>8)>>>0}var yC=(e,t,n,r)=>{const[o,i,s,a]=[pC,hC,mC,Tm].map(l=>{const u=Pi(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===Tm?Number(u.toFixed(3)):Math.round(u)});return gC(o,i,s,a)},wC=(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=>vC(i));return yC(e,t,o,r)},Rm=({easing:e,forceSpringAllowTail:t})=>{switch(e.type){case"linear":return Ll.linear;case"spring":return Ll.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 Pw(e.x1,e.y1,e.x2,e.y2);default:throw new TypeError(`Unsupported easing: ${JSON.stringify(e)}`)}},Js=({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),u=a.map(f=>f.value);if(s==="interpolateColors"){if(!u.every(f=>typeof f=="string"))return null;if(r.length===1)return u[0];try{return wC(e,l,u,{easing:o.map(f=>Rm({easing:f,forceSpringAllowTail:t})),posterize:n.posterize})}catch{return null}}if(s!=="interpolate")return null;try{return Pi(e,l,u,{easing:o.map(f=>Rm({easing:f,forceSpringAllowTail:t})),extrapolateLeft:i.left,extrapolateRight:i.right,output:n.output,posterize:n.posterize})}catch{return null}},ku=({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=Js({forceSpringAllowTail:null,frame:t,status:e.status});return n===null?{type:"none"}:{type:"resolved",value:n}},zw=({propStatus:e,dragOverrideValue:t,defaultValue:n,frame:r=null,shouldResortToDefaultValueIfUndefined:o=!1})=>{const i=ku({dragOverrideValue:t,frame:r});return i.type==="resolved"&&i.value!==void 0?i.value:e.status==="keyframed"?r!==null?Js({forceSpringAllowTail:null,frame:r,status:e}):o?n:void 0:e.codeValue===void 0&&o?n:e.codeValue},wp=d.createContext({overrideIdToNodePathMappings:{}}),xC=d.createContext({setOverrideIdToNodePath:()=>{throw new Error("OverrideIdsToNodePathsSettersContext not initialized")}}),bC=({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=ku({dragOverrideValue:s,frame:r});a.type==="resolved"&&(o[i]=a.value)}return{params:o,effectKey:e.definition.calculateKey(o)}},SC=(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=Js({forceSpringAllowTail:null,frame:t,status:i});s!==null&&(n[o]=s,r=!0)}}return r?n:null},ea=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)},Dw=({propStatuses:e,nodePath:t,effectIndex:n})=>{const r=e[ar(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"}},Ow=(e,t)=>{const n=e[ar(t)];if(n&&n.canUpdate)return n.props},ta=({effects:e,overrideId:t})=>{const n=d.useRef(null),{propStatuses:r}=d.useContext(wu),{getEffectDragOverrides:o}=d.useContext(bu),i=It(),{overrideIdToNodePathMappings:s}=d.useContext(wp),a=n.current,l=t?s[t]??null:null,u=e.map((h,m)=>{if(l===null)return{descriptor:h,params:h.params,effectKey:h.effectKey};const w=Dw({propStatuses:r,nodePath:l,effectIndex:m}),g=w.type==="can-update-effect"?SC(w.props,i):null,k=o(l,m),v=Object.keys(k).length===0?null:k,{params:y,effectKey:x}=bC({descriptor:h,propStatusOverrides:g,dragOverrides:v,frame:i});return{descriptor:h,params:y,effectKey:x}});if(a!==null&&a.length===u.length&&a.every((h,m)=>h.definition===u[m].descriptor.definition&&h.effectKey===u[m].effectKey))return a;const p=u.map(({descriptor:h,params:m,effectKey:w})=>({definition:h.definition,effectKey:w,params:m,memoized:!0}));return n.current=p,p},xp=(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,xp(s,t))}else n[r]=o}return n},bp=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=bp(i);for(const a of Object.keys(s))n(a,s[a])}}return t},Bw=({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],u=Object.keys(l);for(const f of u)s.add(f)}return[...s]},jm={type:"linear"},kC=({insertedKeyframeIndex:e,easingLength:t,keyframeCount:n})=>!(e>0&&e<n-1)||t===0?null:Math.min(e-1,t-1),EC=e=>({type:"static",value:e}),CC=({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(u=>u.frame===t),a=kC({insertedKeyframeIndex:s,easingLength:i.length,keyframeCount:o.length}),l=a===null?jm:i[a];i.splice(s,0,l)}for(;i.length<o.length-1;)i.push(jm);return i.length>o.length-1&&(i.length=o.length-1),{type:"keyframed",status:{...e,keyframes:o,easing:i}}},IC=e=>{if((e==null?void 0:e.type)==="static")return e.value},TC=e=>e!==null&&e.status==="keyframed",Ww=(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=Ww(r,t);if(o)return o}},Vw=({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 u=(r==null?void 0:r[l])??null,f=Ww(e,l);if((f==null?void 0:f.type)==="hidden")continue;let p;if(u===null)p=t[l];else if(TC(u))if((f==null?void 0:f.type)==="array"||(f==null?void 0:f.keyframable)===!1)p=t[l];else{const h=ku({dragOverrideValue:n[l],frame:o});h.type==="resolved"?p=h.value:o!==null?p=Js({forceSpringAllowTail:null,frame:o,status:u})??t[l]:p=t[l]}else u.status==="computed"?p=t[l]:p=zw({propStatus:u,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($s)&&(p=`${window.remotion_staticBase}/${p.slice($s.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 u=Bw({schema:e,key:l,value:i[l]});for(const f of u)s.add(f)}return{merged:i,propsToDelete:s}},Hw=(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},Uw=({flatSchema:e,key:t,props:n})=>{var o;const r=Hw(n,t);if(!(((o=e[t])==null?void 0:o.type)==="text-content"&&typeof r!="string"))return r},RC=(e,t,n)=>{const r={};for(const o of t)r[o]=n?Uw({flatSchema:n,key:o,props:e}):Hw(e,o);return r},jC=(e,t)=>Object.keys(xp(e,n=>t[n])),PC=({flatSchema:e,props:t,valuesDotNotation:n,schemaKeys:r,propsToDelete:o})=>{var a;const i={...t};for(const l of r){const u=n[l];if(((a=e[l])==null?void 0:a.type)==="text-content"&&u===void 0)continue;const f=l.split(".");if(f.length===1){i[l]=u;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]]=u}const s=new Set([...o].filter(l=>{var u;return!(((u=e[l])==null?void 0:u.type)==="text-content"&&n[l]===void 0)}));return FE(i,s),i},Pm={},yr=({Component:e,componentName:t,componentIdentity:n,schema:r,supportsEffects:o})=>{const i=EE(r),s=bp(i),a=Object.keys(s),l=d.forwardRef((u,f)=>{const p=at();if(!p.isStudio||p.isReadOnlyStudio||p.isRendering)return oe.createElement(e,{...u,controls:null,ref:f});const{propStatuses:h}=d.useContext(wu),{getDragOverrides:m}=d.useContext(bu),w=d.useContext(wp),g=It();if(u.controls)return oe.createElement(e,{...u,ref:f});const[k]=d.useState(()=>{const{stack:P}=u;if(!P)return String(Math.random());const $=Pm[P];if($)return $;const N=String(Math.random());return Pm[P]=N,N}),v=w.overrideIdToNodePathMappings[k]??null,y=a.map(P=>Uw({flatSchema:s,key:P,props:u})),x=d.useMemo(()=>RC(u,a,s),y),b=d.useMemo(()=>({schema:i,currentRuntimeValueDotNotation:x,overrideId:k,supportsEffects:o,componentIdentity:n,componentName:t}),[x,k]),{merged:S,propsToDelete:E}=d.useMemo(()=>Vw({schema:i,currentValue:x,overrideValues:v===null?{}:m(v),propStatus:v===null?void 0:Ow(h,v),frame:g}),[x,m,v,h,g]),T=jC(i,S),R=PC({flatSchema:s,props:u,valuesDotNotation:S,schemaKeys:T,propsToDelete:E});return oe.createElement(e,{...R,controls:b,ref:f})});return l.displayName=`withInteractivitySchema(${e.displayName||e.name||"Component"})`,l},bc=[],_C=({from:e=0,trimBefore:t=0,freeze:n,durationInFrames:r=1/0,children:o,name:i,height:s,width:a,showInTimeline:l=!0,hidden:u=!1,controls:f,_remotionInternalEffects:p,_remotionInternalLoopDisplay:h,_remotionInternalStack:m,_remotionInternalDocumentationLink:w,_remotionInternalSingleChildComponent:g,_remotionInternalPremountDisplay:k,_remotionInternalPostmountDisplay:v,_remotionInternalIsMedia:y,outlineRef:x,...b},S)=>{const{layout:E="absolute-fill"}=b,[T]=d.useState(()=>String(Math.random())),R=d.useContext(mt),{rootId:P}=Yr(),$=R?R.cumulatedFrom+R.relativeFrom:0,N=cu();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=Gr(),j=ct(),_=e-t,H=((R==null?void 0:R.absoluteFrom)??0)+_,O=R?Math.min(R.durationInFrames-_,r):r,I=Math.max(0,Math.min(j.durationInFrames-e,O)),{registerSequence:C,unregisterSequence:A}=d.useContext(ji),M=d.useRef(null),D=b.layout==="none"?x??null:x??M,B=d.useMemo(()=>(R==null?void 0:R.premounting)||!!b._remotionInternalIsPremounting,[b._remotionInternalIsPremounting,R==null?void 0:R.premounting]),Z=d.useMemo(()=>(R==null?void 0:R.postmounting)||!!b._remotionInternalIsPostmounting,[b._remotionInternalIsPostmounting,R==null?void 0:R.postmounting]),L=$+_,z=R?R.cumulatedFrom+R.relativeFrom:0,Q=R?z-R.cumulatedNegativeFrom:0,G=Math.max(0,Q,L),V=L-G,K=d.useMemo(()=>({absoluteFrom:H,cumulatedFrom:$,relativeFrom:_,cumulatedNegativeFrom:V,durationInFrames:I,parentFrom:(R==null?void 0:R.relativeFrom)??0,id:T,height:s??(R==null?void 0:R.height)??null,width:a??(R==null?void 0:R.width)??null,premounting:B,postmounting:Z,premountDisplay:k??null,postmountDisplay:v??null}),[$,H,_,I,R,T,s,a,B,Z,k,v,V]),de=d.useMemo(()=>i??"",[i]),ve=w??"https://www.remotion.dev/docs/sequence",ue=at(),se=d.useContext(Su),ee=(b==null?void 0:b.stack)??null,X=d.useRef(null);X.current=m??ee;const J=typeof n=="number"?n:null,ie=t===0?null:t,Fe=(R==null?void 0:R.cumulatedNegativeFrom)??0,Ee=y&&y.type!=="image"?y.data.startMediaFrom+Fe-V:null,be=y&&y.type!=="image"?y.data.startMediaFrom+Fe:null,Me=y&&y.type!=="image"&&be!==null?J===null?null:be+(h?J%h.durationInFrames:J)*y.data.playbackRate:null;d.useEffect(()=>{if(ue.isStudio)return y?(y.type==="image"?C({type:"image",controls:f??null,effects:p??bc,displayName:de,documentationLink:ve,duration:I,from:e,trimBefore:ie,id:T,loopDisplay:h,nonce:N.get(),parent:(R==null?void 0:R.id)??null,postmountDisplay:v??null,premountDisplay:k??null,rootId:P,showInTimeline:l,src:y.src,getStack:()=>X.current,refForOutline:D??null,isInsideSeries:se,frozenFrame:J,singleChildComponent:g??null}):C({type:y.type,controls:f??null,effects:p??bc,displayName:de,documentationLink:ve,doesVolumeChange:y.data.doesVolumeChange,duration:I,from:e,trimBefore:ie,id:T,loopDisplay:h,nonce:N.get(),parent:(R==null?void 0:R.id)??null,playbackRate:y.data.playbackRate,postmountDisplay:v??null,premountDisplay:k??null,rootId:P,showInTimeline:l,src:y.data.src,getStack:()=>X.current,startMediaFrom:Ee??y.data.startMediaFrom,mediaFrameAtSequenceZero:be,volume:y.data.volumes,refForOutline:D??null,isInsideSeries:se,frozenFrame:J,frozenMediaFrame:Me,singleChildComponent:g??null}),()=>{A(T)}):(C({from:e,trimBefore:ie,duration:I,id:T,displayName:de,documentationLink:ve,parent:(R==null?void 0:R.id)??null,type:"sequence",rootId:P,showInTimeline:l,nonce:N.get(),loopDisplay:h,getStack:()=>X.current,premountDisplay:k??null,postmountDisplay:v??null,controls:f??null,effects:p??bc,refForOutline:D??null,isInsideSeries:se,frozenFrame:J,singleChildComponent:g??null}),()=>{A(T)})},[r,T,i,C,de,A,R==null?void 0:R.id,I,P,e,t,ie,l,N,h,k,v,ue.isStudio,f,p,y,ve,D,se,J,Ee,be,Me,g]);const xe=Math.ceil($+e+r-1),Te=W<$+e||W>xe?null:o,je=Te===null||typeof n>"u"||n===null?Te:c.jsx(Xs,{frame:n,children:Te}),Ce=b.layout==="none"?void 0:b.style,Le=d.useCallback(Lt=>{M.current=Lt,typeof S=="function"?S(Lt):S&&(S.current=Lt)},[S]),Rt=d.useMemo(()=>({flexDirection:void 0,...a?{width:a}:{},...s?{height:s}:{},...Ce??{}}),[s,Ce,a]);if(S!==null&&E==="none")throw new TypeError('It is not supported to pass both a `ref` and `layout="none"` to <Sequence />.');return u?null:c.jsx(mt.Provider,{value:K,children:je===null?null:b.layout==="none"?je:c.jsx(Dn,{ref:Le,style:Rt,className:b.className,children:je})})},FC=d.forwardRef(_C),MC=(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,...u}=e,{freezeFrame:f,isPremountingOrPostmounting:p,postmountingActive:h,premountingActive:m,premountingStyle:w}=Qs({from:r,durationInFrames:o,premountFor:i,postmountFor:s,style:n??null,styleWhilePremounted:a??null,styleWhilePostmounted:l??null,hideWhilePremounted:"opacity"});return c.jsx(Xs,{frame:f,active:p,children:c.jsx(Eu,{ref:t,from:r,durationInFrames:o,style:w??void 0,_remotionInternalPremountDisplay:i,_remotionInternalPostmountDisplay:s,_remotionInternalIsPremounting:m,_remotionInternalIsPostmounting:h,...u})})},$C=d.forwardRef(MC),AC=(e,t)=>{const n=at(),{fps:r}=ct();if(e.layout!=="none"&&!n.isRendering){const o=e.premountFor;if(o||e.postmountFor)return c.jsx($C,{ref:t,...e,premountFor:o})}return c.jsx(FC,{...e,ref:t})},Eu=d.forwardRef(AC),Zw=Eu,Tt=yr({Component:Eu,componentName:"<Sequence>",componentIdentity:"dev.remotion.remotion.Sequence",schema:wi,supportsEffects:!1});yr({Component:Eu,componentName:"<Sequence>",componentIdentity:null,schema:IE,supportsEffects:!1});var Kw=(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)}},NC="https://remotion.dev/docs/troubleshooting/webgl2-context",Yw=(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 ${NC}`,LC=e=>new Error(Yw("WebGL",e)),Gw=e=>new Error(Yw("WebGL2",e));class zC{constructor(t,n){$e(this,"width");$e(this,"height");$e(this,"pairs",new Map);$e(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 Gw("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 DC=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},ja=null,OC=()=>ja||(ja=(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()})(),ja),Xw=(e,t)=>({pool:new zC(e,t),setupCache:new WeakMap,cleanupRegistry:[],currentRunId:0}),Gd=e=>{e.currentRunId++;for(const t of e.cleanupRegistry)t.definition.cleanup(t.state)},BC=(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},na=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),u=DC(l);let f=t,p=null;if(u.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 u)if(k.backend==="webgpu"){h=!0;break}const m=h?await OC():null;if(a())return!1;let w=!0;for(let k=0;k<u.length;k++){const v=u[k],[y,x]=e.pool.getPair(v.backend);let b=y;for(const E of v.effects){const T=E.definition,R=BC(e,T,b);T.apply({source:f,target:b,state:R,params:E.params,width:o,height:i,gpuDevice:m,flipSourceY:v.backend==="webgl2"?w:!1}),v.backend==="webgl2"&&(w=!0,e.pool.assertContextNotLost(b)),f=b,b=b===y?x:y}p=f??p;const S=u[k+1];if(S&&S.backend!==v.backend&&p)if(v.backend==="2d"&&S.backend==="webgl2")f=p,w=!0;else{const E=await createImageBitmap(p);if(a())return E.close(),!1;f=E,S.backend==="webgl2"&&(w=!1)}}if(!p)return!0;const g=r.getContext("2d");if(!g)throw new Error("Failed to acquire 2D context for output canvas");return g.clearRect(0,0,o,i),g.drawImage(p,0,0,o,i),!0},ra=()=>{const e=d.useRef(null),t=d.useRef(null);return d.useEffect(()=>()=>{e.current&&Gd(e.current)},[]),d.useMemo(()=>({get:(n,r)=>((!t.current||t.current.width!==n||t.current.height!==r)&&(e.current&&Gd(e.current),e.current=Xw(n,r),t.current={width:n,height:r}),e.current)}),[])},WC=({width:e,height:t,fit:n,className:r,style:o,effects:i,...s},a)=>{const l=d.useRef(null),u=ra(),f=d.useMemo(()=>typeof document>"u"?null:document.createElement("canvas"),[]),p=d.useCallback(h=>{const m=l.current,w=e??h.displayWidth,g=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=w,f.height=g;const k=f.getContext("2d");if(!k)throw new Error("Could not get 2d context for source canvas");return k.drawImage(h,...Kw(n,{height:h.displayHeight,width:h.displayWidth},{width:w,height:g})),m.width=w,m.height=g,na({state:u.get(w,g),source:f,effects:i,output:m,width:w,height:g})},[u,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]),c.jsx("canvas",{ref:l,className:r,style:o,...s})},VC=oe.forwardRef(WC),qw=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}},HC=5,_m=({loopBehavior:e,durationFound:t,timeInSec:n})=>e==="loop"?t?n%t:n:Math.min(n,t||1/0),UC=async({resolvedSrc:e,signal:t,requestInit:n,currentTime:r,initialLoopBehavior:o})=>{const{decoder:i,selectedTrack:s}=await qw({resolvedSrc:e,signal:t,requestInit:n,contentType:null}),a=[];let l=null;const u=async m=>{const w=a.find(k=>k.frameIndex===m);if(w&&w.frame)return w;const g=await i.decode({frameIndex:m,completeFramesOnly:!0});return w?w.frame=g.image:a.push({frame:g.image,frameIndex:m,timeInSeconds:g.image.timestamp/1e6}),{frame:g.image,frameIndex:m,timeInSeconds:g.image.timestamp/1e6}},f=m=>{const g=a.filter(k=>k.frame).sort((k,v)=>{const y=Math.abs(k.timeInSeconds-m),x=Math.abs(v.timeInSeconds-m);return y-x});for(let k=0;k<g.length;k++){if(k<HC)continue;const v=g[k];v.frame=null}},p=async({timeInSec:m,loopBehavior:w})=>{const g=_m({durationFound:l,loopBehavior:w,timeInSec:m}),v=a.filter(x=>x.timeInSeconds<=g).map(x=>x.frameIndex).reduce((x,b)=>Math.max(x,b),0);let y=v;for(;;){const x=await u(y);if(y++,!x.frame)throw new Error("No frame found");if(!x.frame.duration||(y===s.frameCount&&l===null&&(l=(x.frame.timestamp+x.frame.duration)/1e6),x.timeInSeconds>g||y===s.frameCount))break}s.frameCount-v<3&&w==="loop"&&await u(0),f(g)};return await p({timeInSec:r,loopBehavior:o}),await p({timeInSec:r,loopBehavior:o}),{close:()=>{var m;for(const w of a)(m=w.frame)==null||m.close(),w.frame=null;i.close()},getFrame:async(m,w)=>{if(l!==null&&m>l&&w==="clear-after-finish")return null;const g=_m({loopBehavior:w,durationFound:l,timeInSec:m});await p({timeInSec:g,loopBehavior:w});const v=a.filter(y=>y.frame).reduce((y,x)=>{const b=Math.abs(y.timeInSeconds-g),S=Math.abs(x.timeInSeconds-g);return b<S?y:x});if(!v.frame)throw new Error("No frame found");return v},frameCount:s.frameCount}},ZC=({frame:e,playbackRate:t,fps:n})=>e*t/n,KC=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})},YC=e=>typeof window>"u"?e:new URL(e,window.origin).href,GC={src:{type:"asset",default:void 0,description:"Source",keyframable:!1},...vr,...Ri,playbackRate:{type:"number",min:0,max:10,step:.1,default:1,description:"Playback rate",hiddenFromList:!1,keyframable:!1},...tr,...qr,...Xr},XC=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},Qw=d.forwardRef(({src:e,width:t,height:n,onError:r,loopBehavior:o="loop",playbackRate:i=1,fit:s="fill",requestInit:a,effects:l,controls:u,...f},p)=>{const h=YC(e),[m,w]=d.useState(null),{delayRender:g,continueRender:k}=On(),[v]=d.useState(()=>g(`Rendering <AnimatedImage/> with src="${h}"`)),y=It(),{fps:x}=ct(),b=ZC({frame:y,playbackRate:i,fps:x}),S=d.useRef(b);S.current=b;const E=KC(a),T=d.useRef(a);T.current=a;const R=d.useRef(null),P=ta({effects:l,overrideId:(u==null?void 0:u.overrideId)??null});d.useImperativeHandle(p,()=>{var W;const N=(W=R.current)==null?void 0:W.getCanvas();if(!N)throw new Error("Canvas ref is not set");return N},[]);const[$]=d.useState(()=>o);return d.useEffect(()=>{const N=new AbortController;let W=!1,j=!1;const _=()=>{j||(j=!0,k(v))};return UC({resolvedSrc:h,signal:N.signal,requestInit:T.current,currentTime:S.current,initialLoopBehavior:$}).then(H=>{if(W){H.close();return}w(H),_()}).catch(H=>{if(!W){if(H.name==="AbortError"){_();return}r?(r==null||r(H),_()):As(H)}}),()=>{W=!0,N.abort(),_()}},[h,v,r,E,$,k]),d.useEffect(()=>()=>{m==null||m.close()},[m]),d.useLayoutEffect(()=>{if(!m)return;const N=g(`Rendering frame at ${b} of <AnimatedImage src="${e}"/>`);let W=!1;return m.getFrame(b,o).then(async j=>{var H,O;if(W)return;if(j===null){(H=R.current)==null||H.clear(),k(N);return}await((O=R.current)==null?void 0:O.draw(j.frame))&&!W&&k(N)}).catch(j=>{W||(r?(r(j),k(N)):As(j))}),()=>{W=!0,k(N)}},[b,m,o,r,e,k,g,P,s,t,n]),c.jsx(VC,{ref:R,width:t,height:n,fit:s,effects:P,...f})});Qw.displayName="AnimatedImageContent";var qC=({src:e,width:t,height:n,onError:r,fit:o,playbackRate:i,loopBehavior:s,id:a,className:l,style:u,durationInFrames:f,from:p,premountFor:h,postmountFor:m,styleWhilePremounted:w,styleWhilePostmounted:g,requestInit:k,effects:v=[],controls:y,ref:x,...b})=>{const S=d.useRef(null),E=ea(v);d.useImperativeHandle(x,()=>S.current,[]);const{effectivePostmountFor:T,effectivePremountFor:R,freezeFrame:P,isPremountingOrPostmounting:$,postmountingActive:N,premountingActive:W,premountingStyle:j}=Qs({from:p??0,durationInFrames:f??1/0,premountFor:h??null,postmountFor:m??null,style:u??null,styleWhilePremounted:w??null,styleWhilePostmounted:g??null,hideWhilePremounted:"display-none"}),_=XC(b),H={src:e,width:t,height:n,onError:r,fit:o,playbackRate:i,loopBehavior:s,id:a,className:l,style:j??void 0,requestInit:k,..._};return c.jsx(Xs,{frame:P,active:$,children:c.jsx(Tt,{layout:"none",from:p??0,durationInFrames:f??1/0,name:"<AnimatedImage>",_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/animatedimage",controls:y,_remotionInternalEffects:E,_remotionInternalPremountDisplay:R||null,_remotionInternalPostmountDisplay:T||null,_remotionInternalIsPremounting:W,_remotionInternalIsPostmounting:N,...b,outlineRef:S,children:c.jsx(Qw,{...H,ref:S,effects:v,controls:y})})})},Jw=yr({Component:qC,componentName:"<AnimatedImage>",componentIdentity:"dev.remotion.remotion.AnimatedImage",schema:GC,supportsEffects:!0});Jw.displayName="AnimatedImage";Ut(Jw);var QC={type:"boolean",default:!1,description:"Disabled"},JC=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:QC,...e.schema}};return(i={})=>(n(i),{definition:r,params:i,effectKey:r.calculateKey(i),memoized:!1})},e2=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.')},t2=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")},ex=e=>{e.type==="artifact"&&(e2(e.filename),e.contentType!=="thumbnail"&&t2(e.content))},Co=d.createContext({registerRenderAsset:()=>{},unregisterRenderAsset:()=>{},renderAssets:[]}),n2=({children:e,collectAssets:t})=>{const[n,r]=d.useState([]),o=d.useRef([]),i=d.useCallback(l=>{ex(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(u=>u.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 c.jsx(Co.Provider,{value:a,children:e})},Jn=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,Cu=({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))},tx=d.createContext(null),r2=()=>oe.useContext(tx),Iu=({durationInFrames:e,times:t=1/0,children:n,name:r,showInTimeline:o,...i})=>{const s=It(),{durationInFrames:a}=ct();if(du(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),u=Math.min(l,t),f=i.layout==="none"?void 0:i.style,p=e*(u-1),m=Math.floor(s/e)*e,w=Math.min(m,p),g=d.useMemo(()=>({numberOfTimes:Math.min(a/e,t),startOffset:-w,durationInFrames:e}),[a,e,w,t]),k=d.useMemo(()=>({iteration:Math.floor(s/e),durationInFrames:e}),[s,e]);return c.jsx(tx.Provider,{value:k,children:c.jsx(Tt,{durationInFrames:e,from:w,name:r??"<Loop>",_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/loop",_remotionInternalLoopDisplay:g,layout:i.layout,style:f,showInTimeline:o,children:n})})};Iu.useLoop=r2;var At=({logLevel:e,tag:t,message:n,mountTime:r})=>{const o=[r?Date.now()-r+"ms ":null,t].filter(Boolean).join(" ");xt.trace({logLevel:e,tag:null},`[${o}]`,n)},Tu=d.createContext({}),Fm={},Sc=[],nx=({children:e})=>{const[t,n]=d.useState(()=>Fm);return d.useEffect(()=>{const r=()=>{n(Fm)};return Sc.push(r),()=>{Sc=Sc.filter(o=>o!==r)}},[]),c.jsx(Tu.Provider,{value:t,children:e})},rx=e=>{const t=e.indexOf("#");return t===-1?null:t},o2=e=>{const t=rx(e);return t===null?e:e.slice(0,t)},Io=e=>{const t=d.useContext(Tu),n=rx(e),r=o2(e);return t[r]?n!==null?t[r]+e.slice(n):t[r]:e},Ru=(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`)},i2=(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.")},s2=(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.")},ju=({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"?s2(n,r):(typeof e<"u"||typeof t<"u")&&i2(e,t)},Pu=({startFrom:e,endAt:t,trimBefore:n,trimAfter:r})=>({trimBeforeValue:n??e??void 0,trimAfterValue:r??t??void 0}),a2=(e,t)=>{switch(t.type){case"got-duration":{const n=Jn(t.src);return e[n]===t.durationInSeconds?e:{...e,[n]:t.durationInSeconds}}default:return e}},Sp=d.createContext({durations:{},setDurations:()=>{throw new Error("context missing")}}),ox=({children:e})=>{const[t,n]=d.useReducer(a2,{}),r=d.useMemo(()=>({durations:t,setDurations:n}),[t]);return c.jsx(Sp.Provider,{value:r,children:e})},kp=({crossOrigin:e,requestsVideoFrame:t,isClientSideRendering:n})=>{if(e!=null)return e;if(n||t)return"anonymous"},zl=({mediaRef:e,mediaType:t,onAutoPlayError:n,logLevel:r,mountTime:o,reason:i,isPlayer:s})=>{const{current:a}=e;if(!a)return;At({logLevel:r,tag:"play",message:`Attempting to play ${a.src}. Reason: ${i}`,mountTime:o});const l=a.play();l.catch&&l.catch(u=>{if(a&&!u.message.includes("request was interrupted by a call to pause")&&!u.message.includes("The operation was aborted.")&&!u.message.includes("The fetching process for the media resource was aborted by the user agent")&&!u.message.includes("request was interrupted by a new load request")&&!u.message.includes("because the media was removed from the document")&&!(u.message.includes("user didn't interact with the document")&&a.muted)&&(console.log(`Could not play ${t} due to following error: `,u),!a.muted)){if(n){n();return}t==="video"&&s&&(xt.info({logLevel:r,tag:"<"+t+">"},"The video will be muted and we'll retry playing it."),xt.info({logLevel:r,tag:"<"+t+">"},"Use onAutoPlayError() to handle this error yourself."),a.muted=!0,a.play())}})},Ep=({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}}},Mm=!1,l2=e=>{Mm||(Mm=!0,typeof window<"u"&&xt.warn({logLevel:e,tag:null},"AudioContext is not supported in this browser"))},u2=({logLevel:e,latencyHint:t,audioEnabled:n,sampleRate:r})=>{const o=at(),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 l2(e),null;const a=new AudioContext({latencyHint:t,sampleRate:r}),l=a.createGain();l.connect(a.destination),xt.trace({logLevel:e,tag:"audio"},"Creating new audio context"),a.suspend();let u=null;return{audioContext:a,gainNode:l,getState:()=>{const m=a.state;return u==="running"&&m!=="running"?"suspended-to-running":u==="suspended"&&m!=="suspended"?"running-to-suspended":m},resume:()=>{u="running";const m=a.resume();return m.finally(()=>{u==="running"&&(u=null)}),m},suspend:()=>{u="suspended";const m=a.suspend();return m.finally(()=>{u==="suspended"&&(u=null)}),m}}},[e,t,o.isRendering,n,r])},c2=(e,t)=>new Promise(n=>{const r=e.currentTime,i=e.getOutputTimestamp().performanceTime,s=performance.now(),a=()=>{var p;const{currentTime:l}=e,u=e.getOutputTimestamp(),f=performance.now()-s;if(i!==void 0&&u.performanceTime!==void 0&&u.performanceTime>i&&u.contextTime!==void 0&&u.contextTime>r){xt.verbose({logLevel:t,tag:"audio"},`waitUntilActuallyResumed: getOutputTimestamp.performanceTime advanced from ${i.toFixed(6)} to ${u.performanceTime.toFixed(6)} after ${f.toFixed(1)}ms. currentTime=${l.toFixed(6)} (advanced by ${(l-r).toFixed(6)}), getOutputTimestamp.performanceTime=${((p=u.performanceTime)==null?void 0:p.toFixed(1))??"undefined"}`),n();return}requestAnimationFrame(a)};requestAnimationFrame(a)}),kc="data:audio/mp3;base64,/+MYxAAJcAV8AAgAABn//////+/gQ5BAMA+D4Pg+BAQBAEAwD4Pg+D4EBAEAQDAPg++hYBH///hUFQVBUFREDQNHmf///////+MYxBUGkAGIMAAAAP/29Xt6lUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV/+MYxDUAAANIAAAAAFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",d2=(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},f2=(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,_i=d.createContext(null),_u=d.createContext(null),p2=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}`)},ix=({children:e,audioLatencyHint:t,audioEnabled:n,previewSampleRate:r})=>{const o=er(),i=r??48e3;d.useEffect(()=>{typeof window>"u"||(window.remotion_sampleRate=i)},[i]);const s=u2({logLevel:o,latencyHint:t,audioEnabled:n,sampleRate:i}),a=d.useRef(!1),l=d.useRef(null),u=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),w=d.useCallback(b=>{m.current.delete(b)},[]),g=d.useMemo(()=>({node:b,mediaTimestamp:S,sourceOffset:E,scheduledTime:T,duration:R,offset:P,originalUnloopedMediaTimestamp:$})=>{if(!s)throw new Error("Audio context not found");const N=s.getState();if(N==="closed")return{type:"not-started",reason:"audio context is closed"};const W=p2(N);R>0&&(W?m.current.set(b,{scheduledTime:T,offset:P,duration:R}):b.start(T,P,R));const j=T+R/b.playbackRate.value,_=S+P-E,H=_+R,O=s.audioContext.baseLatency+s.audioContext.outputLatency,I=T-s.audioContext.currentTime,C=h.current,A=C.scheduledEndTime!==null&&Math.abs(T-C.scheduledEndTime)>.001,M=C.mediaEndTime!==null&&Math.abs(_-C.mediaEndTime)>.001;return xt.verbose({logLevel:o,tag:"audio-scheduling"},"scheduled %c%s%c %s %c%s%c %s %c%s%c %s %s %s %s %s",A?"color: red; font-weight: bold":"",T.toFixed(4),"",j.toFixed(4),M?"color: red; font-weight: bold":"",_.toFixed(4),"",H.toFixed(4),R<0||I<0?"color: red; font-weight: bold":"color: blue; font-weight: bold",R<0?"missed "+Math.abs(P).toFixed(2)+"s":Math.abs(I).toFixed(2)+(I<0?" delay":" ahead"),"","current="+s.audioContext.currentTime.toFixed(4),"offset="+P.toFixed(4),"latency="+O.toFixed(4),"state="+s.audioContext.state,$!==_?"original_ts="+$.toFixed(4):"","action="+(W?"schedule":"start"),""),C.scheduledEndTime=j,C.mediaEndTime=H,R>0?{type:"started",scheduledTime:T}:{type:"not-started",reason:"missed "+Math.abs(P).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=>{c2(s.audioContext,o).then(S),b.catch(E=>{xt.warn({logLevel:o,tag:"audio"},"AudioContext resume rejected, continuing without audio sync",E),S()})}).finally(()=>{l.current=null}),b.catch(()=>{})},[s,o]),v=d.useCallback(()=>l.current,[]),y=d.useCallback(()=>!s||!a.current?Promise.resolve():(a.current=!1,s.suspend()),[s]),x=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:u,audioSyncAnchorEmitter:p,scheduleAudioNode:g,resume:k,suspend:y,getIsResumingAudioContext:v,unscheduleAudioNode:w}),[s,u,p,g,k,y,v,w]);return c.jsx(_i.Provider,{value:x,children:e})},sx=({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=er(),i=Gs(),s=at(),a=d.useContext(_i),l=(a==null?void 0:a.audioContext)??null,u=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:Ep({audioContext:l,ref:b})}}));for(const{mediaElementSourceNode:b}of f)b==null||b.setAudioContext(l);(oe.useInsertionEffect??oe.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 R;const E=(R=n.current)==null?void 0:R.find(P=>P.id===S),{current:T}=b;if(T){if(E===void 0){T.src!==kc&&(T.src=kc);return}if(!E)throw new TypeError("Expected audio data to be there");Object.keys(E.props).forEach(P=>{f2(P,E.props[P],T[P])&&(T[P]=E.props[P])})}})},[f]),w=d.useCallback(b=>{var O,I;const{aud:S,audioId:E,premounting:T,postmounting:R}=b,P=(O=n.current)==null?void 0:O.find(C=>C.audioId===E);if(P)return P;const $=h.current.findIndex(C=>C===!1);if($===-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:N,ref:W,mediaElementSourceNode:j}=f[$],_=[...h.current];_[$]=N,h.current=_;const H={props:S,id:N,el:W,audioId:E,mediaElementSourceNode:j,premounting:T,audioMounted:!!W.current,postmounting:R,cleanupOnMediaTagUnmount:()=>{}};return(I=n.current)==null||I.push(H),m(),H},[t,f,m]),g=d.useCallback(b=>{var T;const S=[...h.current],E=f.findIndex(R=>R.id===b);if(E===-1)throw new TypeError(`Unknown audio ref ${b}; refs: ${f.map(R=>R.id).join(", ")}`);S[E]=!1,h.current=S,n.current=(T=n.current)==null?void 0:T.filter(R=>R.id!==b),m()},[f,m]),k=d.useCallback(({aud:b,audioId:S,id:E,premounting:T,postmounting:R})=>{var $;let P=!1;n.current=($=n.current)==null?void 0:$.map(N=>{const W=!!N.el.current;return N.audioMounted!==W&&(P=!0),N.id===E?d2(b,N.props)&&N.premounting===T&&N.postmounting===R?N.audioMounted===W?N:{...N,audioMounted:W}:(P=!0,{...N,props:b,premounting:T,postmounting:R,audioId:S,audioMounted:W}):N.audioMounted===W?N:{...N,audioMounted:W}}),P&&m()},[m]),v=d.useCallback(()=>{f.forEach(b=>{const S=n.current.find(E=>E.el===b.ref);S!=null&&S.premounting||zl({mediaRef:b.ref,mediaType:"audio",onAutoPlayError:null,logLevel:o,mountTime:i,reason:"playing all audios",isPlayer:s.isPlayer})}),u==null||u()},[o,i,f,s.isPlayer,u]),y=d.useMemo(()=>({registerAudio:w,unregisterAudio:g,updateAudio:k,playAllAudios:v,numberOfAudioTags:t}),[t,v,w,g,k]),x=d.useMemo(()=>f.map(({id:b,ref:S})=>c.jsx("audio",{ref:S,preload:"metadata",src:kc},b)),[f]);return c.jsxs(_u.Provider,{value:y,children:[x,e]})},h2=({aud:e,audioId:t,premounting:n,postmounting:r})=>{var l;const o=d.useContext(_i),i=d.useContext(_u),[s]=d.useState(()=>{if(i&&i.numberOfAudioTags>0)return i.registerAudio({aud:e,audioId:t,premounting:n,postmounting:r});const u=oe.createRef(),f=Ep({audioContext:(o==null?void 0:o.audioContext)??null,ref:u});return{el:u,id:Math.random(),props:e,audioId:t,mediaElementSourceNode:f,premounting:n,audioMounted:!!u.current,postmounting:r,cleanupOnMediaTagUnmount:()=>{f==null||f.cleanup()}}});(l=s.mediaElementSourceNode)==null||l.setAudioContext((o==null?void 0:o.audioContext)??null);const a=oe.useInsertionEffect??oe.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},m2=1e-5,Dl=(e,t)=>Math.abs(e-t)<m2,ax=(e,t)=>Math.round(e/t*100)/100,Xd=()=>typeof window>"u"||!/AppleWebKit/.test(window.navigator.userAgent)?!1:!window.navigator.userAgent.includes("Chrome/"),Fu=()=>typeof window>"u"?!1:/iP(ad|od|hone)/i.test(window.navigator.userAgent)&&Xd(),g2=e=>Fu()&&e.startsWith("blob:"),qd=({actualFrom:e,fps:t})=>ax(Math.max(0,-e),t),Qd=({duration:e,fps:t})=>ax(e,t),v2=({actualSrc:e,actualFrom:t,duration:n,fps:r})=>{if(g2(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=${qd({actualFrom:t,fps:r})}`;return Number.isFinite(n)?`${i},${Qd({duration:n,fps:r})}`:i},y2=({prevStartFrom:e,newStartFrom:t,prevDuration:n,newDuration:r,fps:o})=>{const i=qd({actualFrom:e,fps:o}),s=qd({actualFrom:t,fps:o}),a=Qd({duration:n,fps:o}),l=Qd({duration:r,fps:o});return!(s<i||l>a)},w2=({actualSrc:e,actualFrom:t,duration:n,fps:r})=>{const o=d.useRef(t),i=d.useRef(n),s=d.useRef(e);return(!y2({prevStartFrom:o.current,newStartFrom:t,prevDuration:i.current,newDuration:n,fps:r})||e!==s.current)&&(o.current=t,i.current=n,s.current=e),v2({actualSrc:s.current,actualFrom:o.current,duration:i.current,fps:r})},$m=!1,x2=e=>{$m||($m=!0,xt.warn({logLevel:e,tag:null},"In Safari, setting a volume and a playback rate at the same time is buggy."),xt.warn({logLevel:e,tag:null},"In Desktop Safari, only volumes <= 1 will be applied."),xt.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,w;const i=d.useRef(null),s=d.useRef(t);s.current=t;const a=d.useContext(_i);if(!a)throw new Error("useAmplification must be used within a SharedAudioContext");const{audioContext:l,gainNode:u}=a;if(typeof window<"u"&&d.useLayoutEffect(()=>{var k,v;if(!l||!e.current||!o)return;if(e.current.playbackRate!==1&&Xd()){x2(n);return}if(!r||!u)return;const g=new GainNode(l,{gain:s.current});return r.attemptToConnect(),r.get().connect(g),g.connect(u),i.current={gainNode:g},xt.trace({logLevel:n,tag:null},`Starting to amplify ${(k=e.current)==null?void 0:k.src}. Gain = ${s.current}, playbackRate = ${(v=e.current)==null?void 0:v.playbackRate}`),()=>{i.current=null,g.disconnect(),r.get().disconnect()}},[n,e,l,r,o,u]),i.current){const g=t;Dl(i.current.gainNode.gain.value,g)||(i.current.gainNode.gain.value=g,xt.trace({logLevel:n,tag:null},`Setting gain to ${g} for ${(h=e.current)==null?void 0:h.src}`))}return(Xd()&&e.current&&((m=e.current)==null?void 0:m.playbackRate)!==1||!o)&&e.current&&!Dl(t,(w=e.current)==null?void 0:w.volume)&&(e.current.volume=Math.min(t,1)),i},vo=()=>{const e=d.useContext(mt);return(e==null?void 0:e.cumulatedNegativeFrom)??0},Fi=e=>{const t=Iu.useLoop(),n=It(),r=vo();return e==="repeat"||t===null?n+r:n+r+t.durationInFrames*t.iteration},ux=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]},b2=({compositionDurationInFrames:e,playbackRate:t,trimBefore:n,trimAfter:r,parentSequenceDurationInFrames:o,loop:i})=>{if(i)return e;const s=Cu({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},To=({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)},Am={},S2=e=>{Am[e]||(console.warn(e),Am[e]=!0)},cx=({volume:e,mediaVolume:t,mediaType:n,src:r,displayName:o,trimBefore:i,trimAfter:s,playbackRate:a,sequenceDurationInFrames:l,mediaStartsAt:u,loop:f})=>{if(!r)throw new Error("No src passed");const p=d.useContext(mt),[h]=d.useState(()=>e),m=b2({compositionDurationInFrames:l,playbackRate:a,trimBefore:i,trimAfter:s,parentSequenceDurationInFrames:(p==null?void 0:p.durationInFrames)??null,loop:f}),w=d.useMemo(()=>typeof e=="number"?e:new Array(Math.floor(Math.max(0,m+u))).fill(!0).map((b,S)=>To({frame:S+u,volume:e,mediaVolume:t})).join(","),[m,u,e,t]);d.useEffect(()=>{typeof e=="number"&&e!==h&&S2(`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 g=typeof e=="function",k=cu(),{rootId:v}=Yr(),y=0-u+(i??0);return d.useMemo(()=>({volumes:w,duration:m,doesVolumeChange:g,nonce:k,rootId:v,finalDisplayName:o??ux(r),startMediaFrom:y,src:r,playbackRate:a}),[w,m,g,k,v,o,r,y,a])},Cp=({volume:e,mediaVolume:t,src:n,mediaType:r,playbackRate:o,displayName:i,id:s,getStack:a,showInTimeline:l,premountDisplay:u,postmountDisplay:f,loopDisplay:p,documentationLink:h,refForOutline:m})=>{const w=d.useContext(mt),g=vo(),{registerSequence:k,unregisterSequence:v}=d.useContext(ji),{durationInFrames:y}=ct(),x=vo(),{volumes:b,duration:S,doesVolumeChange:E,nonce:T,rootId:R,finalDisplayName:P}=cx({volume:e,mediaVolume:t,mediaType:r,src:n,displayName:i,trimAfter:void 0,trimBefore:void 0,playbackRate:o,sequenceDurationInFrames:y,mediaStartsAt:x,loop:!1}),{isStudio:$}=at();d.useEffect(()=>{var N,W;if(!n)throw new Error("No src passed");if(!(!$&&((W=(N=window.process)==null?void 0:N.env)==null?void 0:W.NODE_ENV)!=="test")&&l)return k({type:r,src:n,id:s,duration:S,from:0,trimBefore:null,parent:(w==null?void 0:w.id)??null,displayName:P,documentationLink:h,rootId:R,volume:b,showInTimeline:!0,nonce:T.get(),startMediaFrom:0-g,mediaFrameAtSequenceZero:null,doesVolumeChange:E,loopDisplay:p,playbackRate:o,getStack:a,premountDisplay:u,postmountDisplay:f,controls:null,effects:[],refForOutline:m,isInsideSeries:!1,frozenFrame:null,frozenMediaFrame:null}),()=>{v(s)}},[S,s,w,n,k,v,b,E,T,r,g,o,a,l,u,f,p,h,R,P,$,m])},k2=(e,t)=>{const[n,r]=d.useState([]),[o,i]=d.useState([]),[s,a]=d.useState([]),u=at().isRendering,f=d.useRef(!1),p=d.useCallback(w=>{if(u)return{unblock:()=>{}};let g=!1;return r(k=>[...k,w]),{unblock:()=>{g||(g=!0,r(k=>{const v=k.filter(y=>y!==w);return v.length===k.length?k:v}))}}},[u]),h=d.useCallback(w=>(i(g=>[...g,w]),{remove:()=>{i(g=>g.filter(k=>k!==w))}}),[]),m=d.useCallback(w=>(a(g=>[...g,w]),{remove:()=>{a(g=>g.filter(k=>k!==w))}}),[]);return d.useEffect(()=>{u||n.length>0&&!f.current&&(f.current=!0,o.forEach(w=>w()),At({logLevel:e,message:"Player is entering buffer state",mountTime:t,tag:"player"}))},[n]),typeof window<"u"&&d.useLayoutEffect(()=>{u||n.length===0&&f.current&&(f.current=!1,s.forEach(w=>w()),At({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])},Mi=oe.createContext(null),dx=({children:e})=>{const{logLevel:t,mountTime:n}=d.useContext(ko),r=k2(t??"info",n);return c.jsx(Mi.Provider,{value:r,children:e})},fx=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},Mu=()=>{const e=d.useContext(Mi),t=er(),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");xt.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,xt.trace({logLevel:t,tag:"[buffer-state]"},"Removing buffer handle"),r())}}}}),[n,t])},E2=()=>/^((?!chrome|android).)*safari/i.test(window.navigator.userAgent),C2=({mediaRef:e,mediaType:t,onVariableFpsVideoDetected:n,pauseWhenBuffering:r,logLevel:o,mountTime:i})=>{const s=d.useRef(!1),{delayPlayback:a}=Mu(),l=d.useCallback(u=>{var w;if(t!=="video"||!r)return;const f=e.current;if(!f)return;if(f.readyState>=f.HAVE_FUTURE_DATA&&!E2()){At({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){At({logLevel:o,message:"Not using buffer until first frame, because requestVideoFrameCallback is not supported",mountTime:i,tag:"buffer"});return}s.current=!0,At({logLevel:o,message:`Buffering ${(w=e.current)==null?void 0:w.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((g,k)=>{Math.abs(k.mediaTime-u)>.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])},I2=e=>{const{duration:t,currentTime:n,paused:r,ended:o,desiredUnclampedTime:i,mediaTagTime:s,mediaTagLastUpdate:a,rvcTime:l,rvcLastUpdate:u,isVariableFpsVideo:f,acceptableTimeShift:p,lastSeekDueToShift:h,playing:m,playbackRate:w,mediaTagBufferingOrStalled:g,playerBuffering:k,absoluteFrame:v,onlyWarnForMediaSeekingError:y,isPremounting:x,isPostmounting:b,pauseWhenBuffering:S}=e,E=!Number.isNaN(t)&&Number.isFinite(t)?Math.min(t,i):i,T=Math.abs(E-s),R=l?Math.abs(E-l):null,P=u&&l>a?R:T,$=R&&!f?P:T;if($>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?", isVariableFpsVideo = true":""}, isPremounting = ${x}, isPostmounting = ${b}, pauseWhenBuffering = ${S}`,bufferUntilFirstFrame:m&&w>0,playReason:m&&r?"player is playing but media tag is paused, and just seeked":null,warnAboutNonSeekable:!y};const N=m?.15:.01,W=Math.abs(n-E)>N;if(!m||k&&!g)return{type:"seek-if-not-playing",shouldBeTime:E,why:W?`not playing or something else is buffering. time offset is over seek threshold (${N})`:null};if(!m||k)return{type:"none"};const _=r&&!o;if(_||v===0){const O=_?"media tag is paused":"absolute frame is 0";return{type:"play-and-seek",shouldBeTime:E,why:W?`is over timeshift threshold (threshold = ${N}) and ${O}`:null,playReason:`player is playing and ${O}`,bufferUntilFirstFrame:!f&&w>0}}return{type:"none"}},T2=e=>{var r,o;const t=oe.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},sl=({mediaRef:e,time:t,logLevel:n,why:r,mountTime:o})=>{const i=Fu()?Number(t.toFixed(1)):t;return At({logLevel:n,tag:"seek",message:`Seeking from ${e.currentTime} to ${i}. src= ${e.src} Reason: ${r}`,mountTime:o}),e.currentTime=i,i},R2=({element:e,shouldBuffer:t,isPremounting:n,isPostmounting:r,logLevel:o,mountTime:i,src:s})=>{const a=Mu(),[l,u]=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/")){At({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 g=p.playbackRate;p.load(),p.playbackRate=g}return}const h=g=>{let k=!1;f.forEach(v=>{v(g),k=!0}),f=[],u(v=>(v&&(k=!0),!1)),k&&At({logLevel:o,message:`Unmarking as buffering: ${p.src}. Reason: ${g}`,tag:"buffer",mountTime:i})},m=g=>{u(!0),At({logLevel:o,message:`Marking as buffering: ${p.src}. Reason: ${g}`,tag:"buffer",mountTime:i});const{unblock:k}=a.delayPlayback(),v=()=>{h('"canplay" was fired'),w()},y=()=>{h('"error" event was occurred'),w()};p.addEventListener("canplay",v,{once:!0}),f.push(()=>{p.removeEventListener("canplay",v)}),p.addEventListener("error",y,{once:!0}),f.push(()=>{p.removeEventListener("error",y)}),f.push(x=>{At({logLevel:o,message:`Unblocking ${p.src} from buffer. Reason: ${x}`,tag:"buffer",mountTime:i}),k()})},w=()=>{if(p.readyState<p.HAVE_FUTURE_DATA){if(m(`readyState is ${p.readyState}, which is less than HAVE_FUTURE_DATA`),!navigator.userAgent.includes("Firefox/")){At({logLevel:o,message:`Calling .load() on ${s} because readyState is ${p.readyState} and it is not Firefox. ${p.playbackRate}`,tag:"load",mountTime:i});const g=p.playbackRate;p.load(),p.playbackRate=g}}else{const g=()=>{m('"waiting" event was fired')};p.addEventListener("waiting",g),f.push(()=>{p.removeEventListener("waiting",g)})}};return w(),()=>{h("element was unmounted or prop changed")}},[a,s,e,n,r,o,t,i]),l},j2=({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 u=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(u),a=()=>{}}};return l(),()=>{a()}},[n,e,t,r]),o},px=({frame:e,playbackRate:t,startFrom:n})=>Pi(e,[-1,n,n+1],[-1,n,n+t]),hx=({fps:e,frame:t,playbackRate:n,startFrom:r})=>{const o=px({frame:t,playbackRate:n,startFrom:r}),i=1e3/e;return o*i/1e3},Nm={},P2=(e,t)=>{if(e===null||e.seekable.length===0||e.seekable.length>1||Nm[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),Nm[e.src]=!0}},mx=({mediaRef:e,src:t,mediaType:n,playbackRate:r,preservePitch:o=!0,onlyWarnForMediaSeekingError:i,acceptableTimeshift:s,pauseWhenBuffering:a,isPremounting:l,isPostmounting:u,onAutoPlayError:f})=>{const{playbackRate:p}=pp(),h=It(),m=Gr(),[w]=gw(),g=d.useContext(Mi),{fps:k}=ct(),v=vo(),y=d.useRef(null),x=d.useRef(null),b=er(),S=Gs();if(!g)throw new Error("useMediaPlayback must be used inside a <BufferingContext>");const E=d.useRef({}),T=d.useCallback(()=>{t&&(E.current[t]||(xt.verbose({logLevel:b,tag:null},`Detected ${t} as a variable FPS video. Disabling buffering while seeking.`),E.current[t]=!0))},[b,t]),R=j2({mediaRef:e,mediaType:n,lastSeek:x,onVariableFpsVideoDetected:T}),P=T2(e),$=hx({frame:h,playbackRate:r,startFrom:-v,fps:k}),N=R2({element:e,shouldBuffer:a,isPremounting:l,isPostmounting:u,logLevel:b,mountTime:S,src:t??null}),{bufferUntilFirstFrame:W,isBuffering:j}=C2({mediaRef:e,mediaType:n,onVariableFpsVideoDetected:T,pauseWhenBuffering:a,logLevel:b,mountTime:S}),_=r*p,H=(()=>{var D;return(D=e.current)!=null&&D.duration?Math.min(e.current.duration,s??.65):s??.65})(),O=fx(g);d.useEffect(()=>{var M,D,B,Z,L;if((M=e.current)!=null&&M.paused)return;if(!w){At({logLevel:b,tag:"pause",message:`Pausing ${(D=e.current)==null?void 0:D.src} because ${l?"media is premounting":u?"media is postmounting":"Player is not playing"}`,mountTime:S}),(B=e.current)==null||B.pause();return}const C=N||j();g.buffering.current&&!C&&(At({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}),(L=e.current)==null||L.pause())},[j,N,g,O,l,b,e,n,S,w,u]);const I=at();d.useLayoutEffect(()=>{const C=Math.max(0,_);e.current&&e.current.playbackRate!==C&&(e.current.playbackRate=C),e.current&&e.current.preservesPitch!==o&&(e.current.preservesPitch=o)},[e,_,o]),d.useEffect(()=>{var D,B;const C=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 ${C} element.`);const{current:A}=e,M=I2({duration:A.duration,currentTime:A.currentTime,paused:A.paused,ended:A.ended,desiredUnclampedTime:$,mediaTagTime:P.current.time,mediaTagLastUpdate:P.current.lastUpdate,rvcTime:((D=R.current)==null?void 0:D.time)??null,rvcLastUpdate:((B=R.current)==null?void 0:B.lastUpdate)??null,isVariableFpsVideo:!!E.current[t],acceptableTimeShift:H,lastSeekDueToShift:y.current,playing:w,playbackRate:_,mediaTagBufferingOrStalled:N||j(),playerBuffering:g.buffering.current,absoluteFrame:m,onlyWarnForMediaSeekingError:i,isPremounting:l,isPostmounting:u,pauseWhenBuffering:a});if(M.type!=="none"){if(M.type==="seek-due-to-shift"){x.current=sl({mediaRef:A,time:M.shouldBeTime,logLevel:b,why:M.why,mountTime:S}),y.current=x.current,M.bufferUntilFirstFrame&&W(M.shouldBeTime),M.playReason!==null&&zl({mediaRef:e,mediaType:n,onAutoPlayError:f,logLevel:b,mountTime:S,reason:M.playReason,isPlayer:I.isPlayer}),M.warnAboutNonSeekable&&P2(A);return}if(M.type==="seek-if-not-playing"){M.why!==null&&(x.current=sl({mediaRef:A,time:M.shouldBeTime,logLevel:b,why:M.why,mountTime:S}));return}M.why!==null&&(x.current=sl({mediaRef:A,time:M.shouldBeTime,logLevel:b,why:M.why,mountTime:S})),zl({mediaRef:e,mediaType:n,onAutoPlayError:f,logLevel:b,mountTime:S,reason:M.playReason,isPlayer:I.isPlayer}),M.bufferUntilFirstFrame&&W(M.shouldBeTime)}},[m,H,W,g.buffering,R,b,$,j,N,e,n,i,_,w,t,f,l,u,a,S,P,I.isPlayer])},gx=({mediaRef:e,id:t,mediaType:n,onAutoPlayError:r,isPremounting:o,isPostmounting:i})=>{const{audioAndVideoTags:s,imperativePlaying:a}=Yr(),l=er(),u=Gs(),f=at();d.useEffect(()=>{const p={id:t,play:h=>{if(a.current&&!(o||i))return zl({mediaRef:e,mediaType:n,onAutoPlayError:r,logLevel:l,mountTime:u,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,u,f.isPlayer])},Ip=d.createContext({playerMuted:!1,mediaVolume:1}),Tp=d.createContext({setPlayerMuted:()=>{throw new Error("default")},setMediaVolume:()=>{throw new Error("default")}}),Rp=()=>{const{mediaVolume:e}=d.useContext(Ip),{setMediaVolume:t}=d.useContext(Tp);return d.useMemo(()=>[e,t],[e,t])},jp=()=>{const{playerMuted:e}=d.useContext(Ip),{setPlayerMuted:t}=d.useContext(Tp);return d.useMemo(()=>[e,t],[e,t])},$i=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.`)},_2=(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=er(),{volume:o,muted:i,playbackRate:s,preservePitch:a,shouldPreMountAudioTags:l,src:u,onDuration:f,acceptableTimeShiftInSeconds:p,_remotionInternalNeedsDurationCalculation:h,_remotionInternalNativeLoopPassed:m,_remotionInternalStack:w,allowAmplificationDuringRender:g,name:k,pauseWhenBuffering:v,showInTimeline:y,loopVolumeCurveBehavior:x,stack:b,crossOrigin:S,delayRenderRetries:E,delayRenderTimeoutInMilliseconds:T,toneFrequency:R,useWebAudioApi:P,onError:$,onNativeError:N,audioStreamIndex:W,...j}=e,[_]=Rp(),[H]=jp(),O=Fi(x??"repeat");if(!u)throw new TypeError("No 'src' was passed to <Html5Audio>.");const I=Io(u),C=d.useContext(mt),[A]=d.useState(()=>String(Math.random())),M=To({frame:O,volume:o,mediaVolume:_});$i(M);const D=kp({crossOrigin:S,requestsVideoFrame:!1,isClientSideRendering:!1}),B=d.useMemo(()=>({muted:i||H||M<=0,src:I,loop:m,crossOrigin:D,...j}),[m,H,i,j,I,M,D]),Z=d.useMemo(()=>`audio-${Eo(u??"")}-${C==null?void 0:C.relativeFrom}-${C==null?void 0:C.cumulatedFrom}-${C==null?void 0:C.durationInFrames}-muted:${e.muted}-loop:${e.loop}`,[u,C==null?void 0:C.relativeFrom,C==null?void 0:C.cumulatedFrom,C==null?void 0:C.durationInFrames,e.muted,e.loop]),{el:L,mediaElementSourceNode:z,cleanupOnMediaTagUnmount:Q}=h2({aud:B,audioId:Z,premounting:!!(C!=null&&C.premounting),postmounting:!!(C!=null&&C.postmounting)}),G=d.useCallback(()=>w??null,[w]);Cp({volume:o,mediaVolume:_,src:u,mediaType:"audio",playbackRate:s??1,displayName:k??null,id:A,getStack:G,showInTimeline:y,premountDisplay:(C==null?void 0:C.premountDisplay)??null,postmountDisplay:(C==null?void 0:C.postmountDisplay)??null,loopDisplay:void 0,documentationLink:"https://www.remotion.dev/docs/html5-audio",refForOutline:null}),mx({mediaRef:L,src:u,mediaType:"audio",playbackRate:s??1,preservePitch:a,onlyWarnForMediaSeekingError:!1,acceptableTimeshift:p??null,isPremounting:!!(C!=null&&C.premounting),isPostmounting:!!(C!=null&&C.postmounting),pauseWhenBuffering:v,onAutoPlayError:null}),gx({id:A,isPostmounting:!!(C!=null&&C.postmounting),isPremounting:!!(C!=null&&C.premounting),mediaRef:L,mediaType:"audio",onAutoPlayError:null}),lx({logLevel:r,mediaRef:L,source:z,volume:M,shouldUseWebAudioApi:P??!1}),(oe.useInsertionEffect??oe.useLayoutEffect)(()=>()=>{requestAnimationFrame(()=>{Q()})},[Q]),d.useImperativeHandle(t,()=>L.current,[L]);const K=d.useRef(f);return K.current=f,d.useEffect(()=>{var ue;const{current:de}=L;if(!de)return;if(de.duration){(ue=K.current)==null||ue.call(K,de.src,de.duration);return}const ve=()=>{var se;(se=K.current)==null||se.call(K,de.src,de.duration)};return de.addEventListener("loadedmetadata",ve),()=>{de.removeEventListener("loadedmetadata",ve)}},[L,u]),n?null:c.jsx("audio",{ref:L,preload:"metadata",crossOrigin:D,...B})},vx=d.forwardRef(_2),F2=(e,t)=>{const n=d.useRef(null),{volume:r,playbackRate:o,allowAmplificationDuringRender:i,onDuration:s,toneFrequency:a,_remotionInternalNeedsDurationCalculation:l,_remotionInternalNativeLoopPassed:u,acceptableTimeShiftInSeconds:f,name:p,onNativeError:h,delayRenderRetries:m,delayRenderTimeoutInMilliseconds:w,loopVolumeCurveBehavior:g,pauseWhenBuffering:k,audioStreamIndex:v,preservePitch:y,...x}=e,b=Gr(),S=Fi(g??"repeat"),E=It(),T=d.useContext(mt),{registerRenderAsset:R,unregisterRenderAsset:P}=d.useContext(Co),{delayRender:$,continueRender:N}=On(),W=d.useMemo(()=>`audio-${Eo(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]),j=To({volume:r,frame:S,mediaVolume:1});$i(j),d.useImperativeHandle(t,()=>n.current,[]),d.useEffect(()=>{if(!e.src)throw new Error("No src passed");if(window.remotion_audioEnabled&&!e.muted&&!(j<=0))return R({type:"audio",src:Jn(e.src),id:W,frame:b,volume:j,mediaFrame:E,playbackRate:e.playbackRate??1,toneFrequency:a??1,audioStartFrame:Math.max(0,-((T==null?void 0:T.cumulatedNegativeFrom)??0)),audioStreamIndex:v??0}),()=>P(W)},[e.muted,e.src,R,b,W,P,j,S,E,o,e.playbackRate,a,T==null?void 0:T.cumulatedNegativeFrom,v]);const{src:_}=e,H=t||l;return d.useLayoutEffect(()=>{var A,M;if(((M=(A=window.process)==null?void 0:A.env)==null?void 0:M.NODE_ENV)==="test"||!H)return;const O=$("Loading <Html5Audio> duration with src="+_,{retries:m??void 0,timeoutInMilliseconds:w??void 0}),{current:I}=n,C=()=>{I!=null&&I.duration&&s(I.src,I.duration),N(O)};return I!=null&&I.duration?(s(I.src,I.duration),N(O)):I==null||I.addEventListener("loadedmetadata",C,{once:!0}),()=>{I==null||I.removeEventListener("loadedmetadata",C),N(O)}},[_,s,H,m,w,N,$]),H?c.jsx("audio",{ref:n,...x,onError:h}):null},M2=d.forwardRef(F2),$2=(e,t)=>{const n=d.useContext(_u),r=e,{startFrom:o,endAt:i,trimBefore:s,trimAfter:a,name:l,stack:u,pauseWhenBuffering:f,showInTimeline:p,onError:h,freeze:m,...w}=r,{loop:g,freeze:k,...v}=r,{fps:y}=ct(),x=at(),b=qs(f);if(x.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(Sp);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=Io(e.src),R=d.useCallback(j=>{console.log(j.currentTarget.error);const _=`Could not play audio with src ${T}: ${j.currentTarget.error}. See https://remotion.dev/docs/media-playback-error for help.`;if(g){if(h){h(new Error(_));return}As(new Error(_))}else h==null||h(new Error(_)),console.warn(_)},[g,h,T]),P=d.useCallback((j,_)=>{E({type:"got-duration",durationInSeconds:_,src:j})},[E]),$=S[Jn(T)]??S[Jn(e.src)];ju({startFrom:o,endAt:i,trimBefore:s,trimAfter:a});const{trimBeforeValue:N,trimAfterValue:W}=Pu({startFrom:o,endAt:i,trimBefore:s,trimAfter:a});if(g&&$!==void 0){if(!Number.isFinite($))return c.jsx(al,{...v,ref:t,_remotionInternalNativeLoopPassed:!0});const j=$*y;return c.jsx(Iu,{layout:"none",durationInFrames:Cu({trimAfter:W,mediaDurationInFrames:j,playbackRate:e.playbackRate??1,trimBefore:N}),children:c.jsx(al,{...v,ref:t,_remotionInternalNativeLoopPassed:!0})})}return typeof N<"u"||typeof W<"u"?c.jsx(Tt,{layout:"none",from:0-(N??0),showInTimeline:!1,durationInFrames:W,name:l,children:c.jsx(al,{_remotionInternalNeedsDurationCalculation:!!g,pauseWhenBuffering:b,...w,ref:t})}):(Ru({playbackRate:e.playbackRate,preservePitch:e.preservePitch,volume:e.volume},"Html5Audio"),x.isRendering?c.jsx(M2,{onDuration:P,...e,ref:t,onNativeError:R,_remotionInternalNeedsDurationCalculation:!!g}):c.jsx(vx,{_remotionInternalNativeLoopPassed:e._remotionInternalNativeLoopPassed??!1,_remotionInternalStack:u??null,shouldPreMountAudioTags:n!==null&&n.numberOfAudioTags>0,...e,ref:t,onNativeError:R,onDuration:P,pauseWhenBuffering:b,_remotionInternalNeedsDurationCalculation:!!g,showInTimeline:p??!0}))},al=d.forwardRef($2);Ut(al);var A2=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},N2={...vr,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},...tr,...qr,...Xr},L2=({color:e,width:t,height:n,effects:r=[],className:o,style:i,pixelDensity:s,overrideId:a,reference:l})=>{const{delayRender:u,continueRender:f,cancelRender:p}=On(),h=A2(s),m=Math.ceil(t*h),w=Math.ceil(n*h),[g,k]=d.useState(null),v=ta({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},[]),x=ra(),b=d.useCallback(E=>{k(E),typeof l=="function"?l(E):l&&(l.current=E)},[l]);d.useEffect(()=>{if(!g||!y)return;const E=u("Solid effect chain");if(!x)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)),na({state:x.get(m,w),source:y,effects:v,output:g,width:m,height:w}).then(R=>{R&&f(E)}).catch(R=>{p(R)}),()=>{f(E)}},[e,g,y,x,m,w,u,f,p,v]);const S=d.useMemo(()=>({width:t,height:n,...i??{}}),[n,i,t]);return c.jsx("canvas",{ref:b,width:m,height:w,className:o,style:S})},z2=d.forwardRef(({effects:e=[],controls:t,color:n,height:r,width:o,className:i,durationInFrames:s,style:a,name:l,from:u,trimBefore:f,freeze:p,hidden:h,showInTimeline:m,pixelDensity:w,...g},k)=>{const v=ea(e),y=d.useRef(null);return d.useImperativeHandle(k,()=>y.current,[]),c.jsx(Tt,{layout:"none",from:u,trimBefore:f,freeze:p,hidden:h,showInTimeline:m,controls:t,_remotionInternalEffects:v,durationInFrames:s,name:l??"<Solid>",outlineRef:y,_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/solid",...g,children:c.jsx(L2,{reference:y,overrideId:(t==null?void 0:t.overrideId)??null,color:n,height:r,width:o,className:i,style:a,effects:e,pixelDensity:w})})}),yx=yr({Component:z2,componentName:"<Solid>",componentIdentity:"dev.remotion.remotion.Solid",schema:N2,supportsEffects:!0});yx.displayName="Solid";Ut(yx);var Pa=null,wx=()=>{if(Pa!==null)return Pa;if(typeof document>"u")return!1;const e=document.createElement("canvas"),t=e.getContext("2d");return Pa=typeof(t==null?void 0:t.drawElementImage)=="function"&&typeof e.requestPaint=="function"&&typeof e.captureElementImage=="function"&&"transferControlToOffscreen"in HTMLCanvasElement.prototype,Pa},D2="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 O2(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 B2(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 _a=e=>e instanceof DOMException&&e.name==="InvalidStateError",Lm="HtmlInCanvas: Expected the element to be inside the viewport during rendering, but Chrome had no cached paint record for it.",zm=({target:e,width:t,height:n})=>{e.width!==t&&(e.width=t),e.height!==n&&(e.height=n)},W2=({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()},Dm=d.createContext(null),xx=d.forwardRef(({width:e,height:t,effects:n,children:r,onPaint:o,onInit:i,pixelDensity:s,controls:a,style:l},u)=>{const f=d.useContext(Dm);O2(e,t);const p=B2(s),h=Math.ceil(e*p),m=Math.ceil(t*p),{delayRender:w,continueRender:g,cancelRender:k}=On(),{isClientSideRendering:v,isRendering:y}=at(),x=!y||v,b=o===void 0&&i===void 0;wx()||k(new Error(D2));const S=d.useRef(null),E=d.useRef(null),T=d.useRef(null),R=`${e}x${t}@${p}-${b?"direct":"offscreen"}`,P=d.useCallback(L=>{S.current=L,typeof u=="function"?u(L):u&&(u.current=L)},[u]),$=ra(),N=ta({effects:n,overrideId:(a==null?void 0:a.overrideId)??null}),W=d.useRef(N);W.current=N;const j=d.useRef(o);j.current=o;const _=d.useRef(i);_.current=i;const H=d.useRef(!1),O=d.useRef(null),I=d.useRef(!1),C=d.useRef(f);C.current=f;const A=d.useCallback(async()=>{var Q;const L=T.current;if(!L)throw new Error("Canvas or scene element not found");const z=E.current;if(!z)throw new Error("HtmlInCanvas: paint target is not ready because the canvas is remounting");zm({target:z,width:h,height:m});try{const G=S.current;if(!G)throw new Error("Canvas not found");const V=w("onPaint");if(!H.current){const de=_.current;if(!de)H.current=!0;else{let ve;try{ve=G.captureElementImage(L)}catch(ue){if(_a(ue)&&x){g(V);return}throw _a(ue)?new Error(Lm):ue}H.current=!0;try{if(z instanceof HTMLCanvasElement)throw new Error("HtmlInCanvas: onInit requires an OffscreenCanvas paint target");const ue=await de({canvas:z,element:L,elementImage:ve,pixelDensity:p});if(typeof ue!="function")throw new Error("HtmlInCanvas: when `onInit` is provided, it must return a cleanup function, or a Promise that resolves to one.");I.current?ue():O.current=ue}finally{ve.close()}}}let K;try{K=G.captureElementImage(L)}catch(de){if(_a(de)&&x){g(V);return}throw _a(de)?new Error(Lm):de}try{const de=j.current;if(de){if(z instanceof HTMLCanvasElement)throw new Error("HtmlInCanvas: onPaint requires an OffscreenCanvas paint target");const ve=de({canvas:z,element:L,elementImage:K,pixelDensity:p});ve&&await ve}else W2({canvas:z,element:L,elementImage:K,pixelDensity:p});await na({state:$.get(h,m),source:z,effects:W.current,output:z,width:h,height:m})}finally{K.close()}(Q=C.current)==null||Q.requestParentPaint(),g(V)}catch(G){k(G)}},[m,h,$,g,k,w,p,x]);d.useLayoutEffect(()=>{const L=S.current;if(!L)throw new Error("Canvas not found");L.layoutSubtree=!0;const z=b?L:L.transferControlToOffscreen();return E.current=z,zm({target:z,width:h,height:m}),H.current=!1,I.current=!1,L.addEventListener("paint",A),()=>{var Q;L.removeEventListener("paint",A),E.current=null,H.current=!1,I.current=!0,(Q=O.current)==null||Q.call(O),O.current=null}},[A,k,h,m,b]);const M=d.useRef(!1);d.useLayoutEffect(()=>{var z;if(!M.current){M.current=!0;return}const L=S.current;L&&((z=L.requestPaint)==null||z.call(L))},[o,N]),d.useLayoutEffect(()=>{const L=S.current;if(!L)return;const z=w("waiting for first paint after canvas resize");return L.addEventListener("paint",()=>{g(z)},{once:!0}),()=>{g(z)}},[e,t,g,w,R]);const D=d.useMemo(()=>({width:e,height:t}),[e,t]),B=d.useMemo(()=>({width:e,height:t,...l??{}}),[t,l,e]),Z=d.useMemo(()=>({requestParentPaint:()=>{var L,z;(z=(L=S.current)==null?void 0:L.requestPaint)==null||z.call(L)}}),[]);return c.jsx(Dm.Provider,{value:Z,children:c.jsx("canvas",{ref:P,width:h,height:m,style:B,children:c.jsx("div",{ref:T,style:D,children:r})},R)})});xx.displayName="HtmlInCanvasContent";var bx=d.forwardRef(({width:e,height:t,effects:n=[],children:r,onPaint:o,onInit:i,pixelDensity:s,controls:a,style:l,durationInFrames:u,name:f,...p},h)=>{const m=ea(n),w=d.useRef(null),g=d.useCallback(k=>{w.current=k,typeof h=="function"?h(k):h&&(h.current=k)},[h]);return c.jsx(Tt,{durationInFrames:u,name:f??"<HtmlInCanvas>",_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/remotion/html-in-canvas",controls:a,_remotionInternalEffects:m,outlineRef:w,layout:"none",...p,children:c.jsx(xx,{ref:g,width:e,height:t,effects:n,onPaint:o,onInit:i,pixelDensity:s,controls:a,style:l,children:r})})});bx.displayName="HtmlInCanvas";var V2={...vr,pixelDensity:{type:"number",min:1,max:3,step:.1,default:1,description:"Pixel density",hiddenFromList:!1},...tr,...qr,...Xr},H2=yr({Component:bx,componentName:"<HtmlInCanvas>",componentIdentity:"dev.remotion.remotion.HtmlInCanvas",schema:V2,supportsEffects:!0}),Sx=Object.assign(H2,{isSupported:wx});Sx.displayName="HtmlInCanvas";Ut(Sx);function cr(e){return e.startsWith("data:")&&e.length>100?e.slice(0,60)+"...["+e.length+" chars total]":e}var U2={...vr,...Ri,fit:{type:"enum",default:"fill",description:"Fit",variants:{fill:{},contain:{},cover:{}}},...tr,...qr,...Xr},Z2=()=>{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},K2=({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(u){i||(i=!0,s(),u())}function l(){a(()=>r(Z2()))}if(o.onload=()=>{var u;Promise.resolve((u=o.decode)==null?void 0:u.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="${cr(e)}"`)));return}a(()=>n({element:o,width:f,height:p}))})},o.onerror=()=>{a(()=>r(new Error(`Could not load <CanvasImage> with src="${cr(e)}"`)))},t.addEventListener("abort",l,{once:!0}),t.aborted){l();return}o.crossOrigin="anonymous",o.src=e});function Y2(e){return 1e3*2**(e-1)}var G2=({onFrame:e})=>{if(typeof requestAnimationFrame>"u")return e(),()=>{};const t=requestAnimationFrame(e);return()=>cancelAnimationFrame(t)},kx=d.forwardRef(({src:e,width:t,height:n,fit:r="fill",effects:o,controls:i,onError:s,className:a,style:l,id:u,pauseWhenLoading:f,maxRetries:p=2,delayRenderRetries:h,delayRenderTimeoutInMilliseconds:m,refForOutline:w,...g},k)=>{const{delayRender:v,continueRender:y,cancelRender:x}=On(),{delayPlayback:b}=Mu(),[S,E]=d.useState(null),[T,R]=d.useState(null),P=Io(e),$=ra(),N=ta({effects:o,overrideId:(i==null?void 0:i.overrideId)??null}),W=d.useContext(mt),j=d.useRef(null),[_,H]=d.useState(!1),O=!!(W!=null&&W.premounting),I=!!(W!=null&&W.postmounting),C=d.useCallback(({markAsReady:D})=>{const B=j.current;!B||B.continued||(B.continued=!0,D&&H(!1),y(B.handle),j.current=null)},[y]),A=d.useMemo(()=>typeof document>"u"?null:document.createElement("canvas"),[]),M=d.useCallback(D=>{E(D),w&&(w.current=D),typeof k=="function"?k(D):k&&(k.current=D)},[k,w]);return d.useLayoutEffect(()=>{if(!(!f||!_||O||I))return b().unblock},[b,_,I,O,f]),d.useLayoutEffect(()=>{const D=v(`Rendering <CanvasImage> with src="${cr(P)}"`,{retries:h??void 0,timeoutInMilliseconds:m??void 0}),B=new AbortController;let Z=!1,L=0,z=null;R(null),H(!0),j.current={handle:D,continued:!1};const Q=()=>{K2({src:P,signal:B.signal}).then(G=>{Z||R(G)}).catch(G=>{if(G.name==="AbortError"){C({markAsReady:!1});return}if(L++,L<=p){const V=Y2(L);console.warn(`Could not load <CanvasImage> with src="${cr(P)}", retrying in ${V}ms`),z=setTimeout(()=>{Z||Q()},V)}else s?(s(G),C({markAsReady:!0})):x(G)})};return Q(),()=>{Z=!0,z!==null&&clearTimeout(z),B.abort(),C({markAsReady:!1})}},[P,x,C,v,h,m,p,s]),d.useLayoutEffect(()=>{if(!T||!S||!A)return;const D=v(`Applying effects to <CanvasImage> with src="${cr(P)}"`);let B=!1,Z=!1,L=()=>{};const z=()=>{Z||(Z=!0,y(D))},Q=t??T.width,G=n??T.height,V=A.getContext("2d",{colorSpace:"srgb"});return V?(A.width=Q,A.height=G,S.width=Q,S.height=G,V.clearRect(0,0,Q,G),V.drawImage(T.element,...Kw(r,{width:T.width,height:T.height},{width:Q,height:G})),na({state:$.get(Q,G),source:A,effects:N,output:S,width:Q,height:G}).then(K=>{K&&!B&&(L=G2({onFrame:()=>{B||(z(),C({markAsReady:!0}))}}))}).catch(K=>{B||(s?(s(K),z(),C({markAsReady:!0})):x(K))}),()=>{B=!0,L(),z()}):(x(new Error("Could not get 2D context for <CanvasImage> source canvas")),z(),()=>{z()})},[P,x,$,y,C,v,r,n,T,N,s,S,A,t]),c.jsx("canvas",{...g,ref:M,width:t,height:n,className:a,style:l,id:u})});kx.displayName="CanvasImageContent";var X2=d.forwardRef(({src:e,width:t,height:n,fit:r,effects:o=[],className:i,style:s,id:a,onError:l,pauseWhenLoading:u,maxRetries:f,delayRenderRetries:p,delayRenderTimeoutInMilliseconds:h,durationInFrames:m,from:w,trimBefore:g,freeze:k,premountFor:v,postmountFor:y,styleWhilePremounted:x,styleWhilePostmounted:b,hidden:S,name:E,showInTimeline:T,stack:R,controls:P,_remotionInternalDocumentationLink:$,outlineRef:N,...W},j)=>{if(!e)throw new Error('No "src" prop was passed to <CanvasImage>.');const _=ea(o),H=d.useRef(null);d.useImperativeHandle(j,()=>H.current,[]);const{effectivePostmountFor:O,effectivePremountFor:I,freezeFrame:C,isPremountingOrPostmounting:A,postmountingActive:M,premountingActive:D,premountingStyle:B}=Qs({from:w??0,durationInFrames:m??1/0,premountFor:v??null,postmountFor:y??null,style:s??null,styleWhilePremounted:x??null,styleWhilePostmounted:b??null,hideWhilePremounted:"display-none"});return c.jsx(Xs,{frame:C,active:A,children:c.jsx(Tt,{layout:"none",from:w??0,trimBefore:g,durationInFrames:m??1/0,freeze:k,hidden:S,showInTimeline:T??!0,name:E??"<CanvasImage>",_remotionInternalDocumentationLink:$??"https://www.remotion.dev/docs/canvasimage",controls:P,_remotionInternalEffects:_,_remotionInternalIsMedia:{type:"image",src:e},_remotionInternalStack:R,_remotionInternalPremountDisplay:I||null,_remotionInternalPostmountDisplay:O||null,_remotionInternalIsPremounting:D,_remotionInternalIsPostmounting:M,outlineRef:N??H,children:c.jsx(kx,{ref:H,src:e,width:t,height:n,fit:r,effects:o,controls:P,className:i,style:B??void 0,id:a,onError:l,pauseWhenLoading:u,maxRetries:f,delayRenderRetries:p,delayRenderTimeoutInMilliseconds:h,refForOutline:N??null,...W})})})}),Pp=yr({Component:X2,componentName:"<CanvasImage>",componentIdentity:"dev.remotion.remotion.CanvasImage",schema:U2,supportsEffects:!0});Pp.displayName="CanvasImage";Ut(Pp);var q2=({onLoad:e,onError:t,delayRenderRetries:n,delayRenderTimeoutInMilliseconds:r,...o},i)=>{const{delayRender:s,continueRender:a}=On(),[l]=d.useState(()=>s(`Loading <IFrame> with source ${o.src}`,{retries:n??void 0,timeoutInMilliseconds:r??void 0})),u=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 c.jsx("iframe",{referrerPolicy:"strict-origin-when-cross-origin",...o,ref:i,onError:f,onLoad:u})};d.forwardRef(q2);function Q2(e){return 1e3*2**(e-1)}var J2=({onError:e,maxRetries:t=2,src:n,pauseWhenLoading:r,delayRenderRetries:o,delayRenderTimeoutInMilliseconds:i,onImageFrame:s,crossOrigin:a,decoding:l,ref:u,refForOutline:f,...p})=>{const h=d.useRef(null),m=d.useRef({}),{delayPlayback:w}=Mu(),g=d.useContext(mt),[k,v]=d.useState(!1),y=d.useCallback(_=>{h.current=_,f.current=_,typeof u=="function"?u(_):u&&(u.current=_)},[u,f]),x=Io(n),b=d.useCallback(_=>{if(!h.current)return;const H=h.current.src;setTimeout(()=>{var I;if(!h.current)return;const O=(I=h.current)==null?void 0:I.src;O===H&&(h.current.removeAttribute("src"),h.current.setAttribute("src",O))},_)},[]),{delayRender:S,continueRender:E,cancelRender:T}=On(),R=!!(g!=null&&g.premounting),P=!!(g!=null&&g.postmounting),$=d.useCallback(_=>{var H,O,I,C,A,M,D;if(m.current){if(m.current[(H=h.current)==null?void 0:H.src]=(m.current[(O=h.current)==null?void 0:O.src]??0)+1,e&&(m.current[(I=h.current)==null?void 0:I.src]??0)>t){e(_);return}if((m.current[(C=h.current)==null?void 0:C.src]??0)<=t){const B=Q2(m.current[(A=h.current)==null?void 0:A.src]??0);console.warn(`Could not load image with source ${cr((M=h.current)==null?void 0:M.src)}, retrying again in ${B}ms`),b(B);return}try{T("Error loading image with src: "+cr((D=h.current)==null?void 0:D.src))}catch{}}},[T,t,e,b]);typeof window<"u"&&(d.useLayoutEffect(()=>{if(!(!r||!k||R||P))return w().unblock},[w,k,P,R,r]),d.useLayoutEffect(()=>{var C,A;if(((A=(C=window.process)==null?void 0:C.env)==null?void 0:A.NODE_ENV)==="test"){h.current&&(h.current.src=x);return}const{current:_}=h;if(!_)return;v(!0);const H=S("Loading <Img> with src="+cr(x),{retries:o??void 0,timeoutInMilliseconds:i??void 0});let O=!1;const I=()=>{var M,D,B;if(O){E(H);return}(m.current[(M=h.current)==null?void 0:M.src]??0)>0&&(delete m.current[(D=h.current)==null?void 0:D.src],console.info(`Retry successful - ${cr((B=h.current)==null?void 0:B.src)} is now loaded`)),_&&(s==null||s(_)),v(!1),E(H)};if(!h.current){I();return}return _.src=x,_.decode().then(I).catch(M=>{console.warn(M),_.complete&&_.naturalWidth>0&&_.naturalHeight>0?I():_.addEventListener("load",I)}),()=>{O=!0,_.removeEventListener("load",I),E(H)}},[x,o,i,s,E,S]));const{isClientSideRendering:N,isRendering:W}=at(),j=kp({crossOrigin:a,requestsVideoFrame:!1,isClientSideRendering:N});return c.jsx("img",{...p,ref:y,crossOrigin:j,onError:$,decoding:W?"sync":l})},eI=({hidden:e,name:t,stack:n,showInTimeline:r,src:o,from:i,trimBefore:s,durationInFrames:a,freeze:l,premountFor:u,postmountFor:f,style:p,styleWhilePremounted:h,styleWhilePostmounted:m,controls:w,outlineRef:g,...k})=>{if(!o)throw new Error('No "src" prop was passed to <Img>.');const{effectivePostmountFor:v,effectivePremountFor:y,freezeFrame:x,isPremountingOrPostmounting:b,postmountingActive:S,premountingActive:E,premountingStyle:T}=Qs({from:i??0,durationInFrames:a??1/0,premountFor:u??null,postmountFor:f??null,style:p??null,styleWhilePremounted:h??null,styleWhilePostmounted:m??null,hideWhilePremounted:"display-none"});return c.jsx(Xs,{frame:x,active:b,children:c.jsx(Tt,{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:v||null,_remotionInternalIsPremounting:E,_remotionInternalIsPostmounting:S,name:t??"<Img>",controls:w,showInTimeline:r??!0,hidden:e,outlineRef:g,children:c.jsx(J2,{src:o,refForOutline:g,style:T??void 0,...k})})})},tI=Pp,nI={src:{type:"asset",default:void 0,description:"Source",keyframable:!1},...vr,...Ri,...tr,...qr,...Xr},rI=new Set(["alt","crossOrigin","decoding","fetchPriority","loading","onError","onImageFrame","onLoad","sizes","srcSet","useMap"]),oI=e=>Object.keys(e).filter(t=>e[t]!==void 0&&rI.has(t)),iI=e=>e.map(t=>`"${t}"`).join(", "),sI=({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=oI(e);if(t!=null&&o.unshift("ref"),o.length!==0)throw new Error(`The ${iI(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"}.`)},aI=e=>{const t=e==null?void 0:e.objectFit;if(t==="fill"||t==="contain"||t==="cover")return t},lI=({effects:e=[],ref:t,hidden:n,name:r,stack:o,showInTimeline:i,src:s,from:a,trimBefore:l,durationInFrames:u,freeze:f,premountFor:p,postmountFor:h,styleWhilePremounted:m,styleWhilePostmounted:w,controls:g,width:k,height:v,className:y,style:x,id:b,pauseWhenLoading:S,maxRetries:E,delayRenderRetries:T,delayRenderTimeoutInMilliseconds:R,...P})=>{const $=d.useRef(null),N=qs(S);if(e.length===0)return c.jsx(eI,{...P,ref:t,hidden:n,name:r,stack:o,showInTimeline:i,src:s,from:a,trimBefore:l,durationInFrames:u,freeze:f,premountFor:p,postmountFor:h,styleWhilePremounted:m,styleWhilePostmounted:w,controls:g,width:k,height:v,className:y,style:x,id:b,pauseWhenLoading:N,maxRetries:E,delayRenderRetries:T,delayRenderTimeoutInMilliseconds:R,outlineRef:$});if(!s)throw new Error('No "src" prop was passed to <Img>.');sI({props:P,ref:t,width:k,height:v});const W=typeof k=="number"?k:void 0,j=typeof v=="number"?v:void 0,_=P,H=aI(x)??"fill";return c.jsx(tI,{src:s,width:W,height:j,fit:H,effects:e,className:y,style:x,id:b,pauseWhenLoading:N,maxRetries:E,delayRenderRetries:T,delayRenderTimeoutInMilliseconds:R,from:a,trimBefore:l,durationInFrames:u,freeze:f,premountFor:p,postmountFor:h,styleWhilePremounted:m,styleWhilePostmounted:w,hidden:n,name:r??"<Img>",showInTimeline:i,stack:o,_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/img",controls:g,outlineRef:$,..._})},_p=yr({Component:lI,componentName:"<Img>",componentIdentity:"dev.remotion.remotion.Img",schema:nI,supportsEffects:!0});Ut(_p);var uI=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}`)},Ex=({packageName:e,componentName:t})=>`${uI(e)}.${t}`,Fp={...vr,...tr},cI={...Fp,...qr},Cx={...cI,...Xr},dI={...Cx,...vu,...vw},fI={...Fp,...vu,...vw},pI=(e,t)=>{typeof e=="function"?e(t):e&&(e.current=t)},Ix=e=>{const t=yr(e);return Ut(t),t},Ol=(e,t,n)=>{const r=d.forwardRef((i,s)=>{const{durationInFrames:a,from:l,trimBefore:u,freeze:f,hidden:p,name:h,showInTimeline:m,stack:w,controls:g,...k}=i,v=d.useRef(null),y=d.useCallback(x=>{v.current=x,pI(s,x)},[s]);return c.jsx(Tt,{layout:"none",from:l??0,trimBefore:u,durationInFrames:a??1/0,freeze:f,hidden:p,name:h??t,showInTimeline:m??!0,controls:g,_remotionInternalStack:w,_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/interactive",outlineRef:v,children:oe.createElement(e,{...k,ref:y})})});r.displayName=t;const o=Ix({Component:r,componentName:t,componentIdentity:Ex({packageName:"remotion",componentName:t.slice(1,-1)}),schema:n,supportsEffects:!1});return o.displayName=t,o},De=(e,t)=>Ol(e,t,dI),$o=(e,t)=>Ol(e,t,Fp),Er={baseSchema:vr,transformSchema:tr,textSchema:vu,backgroundSchema:qr,borderSchema:Xr,premountSchema:Ri,sequenceSchema:wi,withSchema:Ix,_internalMakeRemotionComponentIdentity:Ex,A:De("a","<Interactive.A>"),Article:De("article","<Interactive.Article>"),Aside:De("aside","<Interactive.Aside>"),Button:De("button","<Interactive.Button>"),Circle:$o("circle","<Interactive.Circle>"),Code:De("code","<Interactive.Code>"),Div:De("div","<Interactive.Div>"),Ellipse:$o("ellipse","<Interactive.Ellipse>"),Em:De("em","<Interactive.Em>"),Footer:De("footer","<Interactive.Footer>"),G:$o("g","<Interactive.G>"),H1:De("h1","<Interactive.H1>"),H2:De("h2","<Interactive.H2>"),H3:De("h3","<Interactive.H3>"),H4:De("h4","<Interactive.H4>"),H5:De("h5","<Interactive.H5>"),H6:De("h6","<Interactive.H6>"),Header:De("header","<Interactive.Header>"),Label:De("label","<Interactive.Label>"),Li:De("li","<Interactive.Li>"),Line:$o("line","<Interactive.Line>"),Main:De("main","<Interactive.Main>"),Nav:De("nav","<Interactive.Nav>"),Ol:De("ol","<Interactive.Ol>"),P:De("p","<Interactive.P>"),Path:$o("path","<Interactive.Path>"),Pre:De("pre","<Interactive.Pre>"),Rect:$o("rect","<Interactive.Rect>"),Section:De("section","<Interactive.Section>"),Small:De("small","<Interactive.Small>"),Span:De("span","<Interactive.Span>"),Strong:De("strong","<Interactive.Strong>"),Svg:Ol("svg","<Interactive.Svg>",Cx),Text:Ol("text","<Interactive.Text>",fI),Ul:De("ul","<Interactive.Ul>")},hI=async({resolvedSrc:e,signal:t,requestInit:n,contentType:r})=>{const{decoder:o,selectedTrack:i}=await qw({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()}},Tx=oe.createRef(),mI=({children:e,onlyRenderComposition:t,currentCompositionMetadata:n,initialCompositions:r,initialCanvasContent:o})=>{const[i,s]=d.useState([]),[a,l]=d.useState(o),[u,f]=d.useState(r),p=d.useRef(u),h=d.useCallback(x=>{f(b=>{const S=x(b);return p.current=S,S})},[]),m=d.useCallback(x=>{h(b=>{if(b.find(S=>S.id===x.id))throw new Error(`Multiple composition with id ${x.id} are registered.`);return[...b,x]})},[h]),w=d.useCallback(x=>{f(b=>b.filter(S=>S.id!==x))},[]),g=d.useCallback((x,b,S,E)=>{s(T=>[...T,{name:x,parent:b,nonce:S,stack:E}])},[]),k=d.useCallback((x,b)=>{s(S=>S.filter(E=>!(E.name===x&&E.parent===b)))},[]);d.useImperativeHandle(Tx,()=>({getCompositions:()=>p.current}),[]);const v=d.useMemo(()=>({registerComposition:m,unregisterComposition:w,registerFolder:g,unregisterFolder:k,setCanvasContent:l,onlyRenderComposition:t}),[m,g,w,k,t]),y=d.useMemo(()=>({compositions:u,folders:i,currentCompositionMetadata:n,canvasContent:a}),[u,i,n,a]);return c.jsx(Ei.Provider,{value:y,children:c.jsx(Zs.Provider,{value:v,children:e})})},Rx={};U0(Rx,{makeDefaultPreviewCSS:()=>vI,injectCSS:()=>gI,OBJECTFIT_CONTAIN_CLASS_NAME:()=>Ns});var Fa={},gI=e=>{if(typeof document>"u")return()=>{};if(Fa[e])return()=>{};const t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");return n.appendChild(document.createTextNode(e)),t.prepend(n),Fa[e]=n,()=>{const r=Fa[e];r&&(r.parentNode&&r.parentNode.removeChild(r),delete Fa[e])}},Ns="__remotion_objectfitcontain",vI=(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} .${Ns} {
66
+ object-fit: contain;
67
+ }
68
+ `:`
69
+ * {
70
+ box-sizing: border-box;
71
+ }
72
+ body {
73
+ margin: 0;
74
+ background-color: ${t};
75
+ }
76
+ .${Ns} {
77
+ object-fit: contain;
78
+ }
79
+ `,jx="__remotion-studio-container",yI=()=>document.getElementById(jx),wI=oe.createContext(null),xI=null,Ec=[],bI=()=>xI,SI=e=>(Ec.push(e),()=>{Ec=Ec.filter(t=>t!==e)}),Mp=d.createContext(null),kI=()=>{const e=d.useContext(Mp);return!e||e.videoEnabled===null?window.remotion_videoEnabled:e.videoEnabled},EI=()=>{const e=d.useContext(Mp);return!e||e.audioEnabled===null?window.remotion_audioEnabled:e.audioEnabled},CI=({children:e,videoEnabled:t,audioEnabled:n})=>{const r=d.useMemo(()=>({videoEnabled:t,audioEnabled:n}),[t,n]);return c.jsx(Mp.Provider,{value:r,children:e})},II=({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++}},[]),u=d.useMemo(()=>({logLevel:n,mountTime:Date.now()}),[n]);return c.jsx(ko.Provider,{value:u,children:c.jsx(Ks.Provider,{value:l,children:c.jsx(SE,{frameState:a,children:c.jsx(CI,{videoEnabled:i,audioEnabled:s,children:c.jsx(Q0,{children:c.jsx(nx,{children:c.jsx(RE,{children:c.jsx(ox,{children:c.jsx(dx,{children:c.jsx(ix,{audioLatencyHint:r,audioEnabled:s,previewSampleRate:o,children:c.jsx(sx,{numberOfAudioTags:t,children:e})})})})})})})})})})})},Om=["h264","h265","vp8","vp9","av1","mp3","aac","wav","prores","h264-mkv","h264-ts","gif"];function TI(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(!Om.includes(e))throw new Error(`The "${n}" prop ${t} must be one of ${Om.join(", ")}, but you passed ${e}.`)}}var RI=({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;$l(l,"width",e!=null&&e.width?s:a);const u=(e==null?void 0:e.height)??r??void 0;$l(u,"height",e!=null&&e.height?s:a);const f=(e==null?void 0:e.fps)??n??null;fu(f,e!=null&&e.fps?s:a);const p=(e==null?void 0:e.durationInFrames)??i??null;du(p,{allowFloats:!1,component:`of the "<Composition />" component with the id "${t}"`});const h=e==null?void 0:e.defaultCodec;TI(h,s,"defaultCodec");const m=e==null?void 0:e.defaultOutName,w=e==null?void 0:e.defaultVideoImageFormat,g=e==null?void 0:e.defaultPixelFormat,k=e==null?void 0:e.defaultProResProfile,v=e==null?void 0:e.defaultSampleRate;return{width:l,height:u,fps:f,durationInFrames:p,defaultCodec:h,defaultOutName:m,defaultVideoImageFormat:w,defaultPixelFormat:g,defaultProResProfile:k,defaultSampleRate:v}},Bm=({calculated:e,compositionDurationInFrames:t,compositionFps:n,compositionHeight:r,compositionId:o,compositionWidth:i,defaultProps:s,originalProps:a})=>{const l=RI({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:Hd(s??{}),props:Hd((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}}},Px=({calculateMetadata:e,signal:t,defaultProps:n,inputProps:r,compositionId:o,compositionDurationInFrames:i,compositionFps:s,compositionHeight:a,compositionWidth:l})=>{const u=e?e({defaultProps:n,props:r,abortSignal:t,compositionId:o,isRendering:Sn().isRendering}):null;return u!==null&&typeof u=="object"&&"then"in u?u.then(f=>Bm({calculated:f,compositionDurationInFrames:i,compositionFps:s,compositionHeight:a,compositionWidth:l,compositionId:o,defaultProps:n,originalProps:r})):Bm({calculated:u,compositionDurationInFrames:i,compositionFps:s,compositionHeight:a,compositionWidth:l,compositionId:o,defaultProps:n,originalProps:r})},_x=e=>{const t=Px(e);return typeof t=="object"&&"then"in t?t.then(({videoConfig:n})=>n):t.videoConfig},jI=e=>{try{return{type:"success",result:Px(e)}}catch(t){return{type:"error",error:t}}},PI=e=>{try{return{type:"success",result:_x(e)}}catch(t){return{type:"error",error:t}}},_I=oe.createContext(()=>{}),FI=()=>{if(Sn().isRendering){const e=window.remotion_envVariables;return e?{...JSON.parse(e),NODE_ENV:"production"}:{}}return{NODE_ENV:"production"}},MI=()=>{const e=FI();window.process||(window.process={}),window.process.env||(window.process.env={}),Object.keys(e).forEach(t=>{window.process.env[t]=e[t]})},$I=oe.createContext(null),AI=d.createContext({setSize:()=>{},size:{size:"auto",translation:{x:0,y:0}}}),NI=({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)},LI=oe.createContext(null),zI=({src:e,transparent:t,currentTime:n,toneMapped:r})=>`http://localhost:${window.remotion_proxyPort}/proxy?src=${encodeURIComponent(Jn(e))}&time=${encodeURIComponent(Math.max(0,n))}&transparent=${String(t)}&toneMapped=${String(r)}`,DI=({onError:e,volume:t,playbackRate:n,src:r,muted:o,allowAmplificationDuringRender:i,transparent:s,toneMapped:a,toneFrequency:l,name:u,loopVolumeCurveBehavior:f,delayRenderRetries:p,delayRenderTimeoutInMilliseconds:h,onVideoFrame:m,crossOrigin:w,audioStreamIndex:g,preservePitch:k,...v})=>{const y=Gr(),x=It(),b=Fi(f),S=gu(),E=d.useContext(mt),T=vo(),{registerRenderAsset:R,unregisterRenderAsset:P}=d.useContext(Co);if(!r)throw new TypeError("No `src` was passed to <OffthreadVideo>.");const $=d.useMemo(()=>`offthreadvideo-${Eo(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 N=To({volume:t,frame:b,mediaVolume:1});$i(N),d.useEffect(()=>{if(!r)throw new Error("No src passed");if(window.remotion_audioEnabled&&!o&&!(N<=0))return R({type:"video",src:Jn(r),id:$,frame:y,volume:N,mediaFrame:x,playbackRate:n,toneFrequency:l,audioStartFrame:Math.max(0,-((E==null?void 0:E.cumulatedNegativeFrom)??0)),audioStreamIndex:g}),()=>P($)},[o,r,R,$,P,N,x,y,n,l,E==null?void 0:E.cumulatedNegativeFrom,g]);const W=d.useMemo(()=>px({frame:x,playbackRate:n||1,startFrom:-T})/S.fps,[x,T,n,S.fps]),j=d.useMemo(()=>zI({src:r,currentTime:W,transparent:s,toneMapped:a}),[a,W,r,s]),[_,H]=d.useState(null),{delayRender:O,continueRender:I}=On();d.useLayoutEffect(()=>{if(!window.remotion_videoEnabled)return;const D=[];H(null);const B=new AbortController,Z=O(`Fetching ${j} from server`,{retries:p??void 0,timeoutInMilliseconds:h??void 0});return(async()=>{try{const z=await fetch(j,{signal:B.signal,cache:"no-store"});if(z.status!==200){if(z.status===500){const V=await z.json();if(V.error){const K=V.error.replace(/^Error: /,"");throw new Error(K)}}throw new Error(`Server returned status ${z.status} while fetching ${j}`)}const Q=await z.blob(),G=URL.createObjectURL(Q);D.push(()=>URL.revokeObjectURL(G)),H({src:G,handle:Z})}catch(z){if(z.message.includes("aborted")){I(Z);return}if(B.signal.aborted){I(Z);return}z.message.includes("Failed to fetch")&&(z=new Error(`Failed to fetch ${j}. This could be caused by Chrome rejecting the request because the disk space is low. Consider increasing the disk size of your environment.`,{cause:z})),e?e(z):As(z)}})(),D.push(()=>{B.signal.aborted||B.abort()}),()=>{D.forEach(z=>z())}},[j,p,h,e,I,O]);const C=d.useCallback(()=>{e?e==null||e(new Error("Failed to load image with src "+_)):As("Failed to load image with src "+_)},[_,e]),A=d.useMemo(()=>[Ns,v.className].filter(Ci).join(" "),[v.className]),M=d.useCallback(D=>{m&&m(D)},[m]);return!_||!window.remotion_videoEnabled?null:(I(_.handle),c.jsx(_p,{src:_.src,delayRenderRetries:p,delayRenderTimeoutInMilliseconds:h,onImageFrame:M,...v,onError:C,className:A}))},Fx=({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 ti extends Error{constructor({message:n,src:r}){super(n);$e(this,"src");this.name="MediaPlaybackError",this.src=r}}var OI=(e,t)=>{const n=d.useContext(_i);if(!n)throw new Error("SharedAudioContext not found");const r=d.useRef(null),o=d.useMemo(()=>n.audioContext?Ep({audioContext:n.audioContext,ref:r}):null,[n.audioContext]);(oe.useInsertionEffect??oe.useLayoutEffect)(()=>()=>{requestAnimationFrame(()=>{o==null||o.cleanup()})},[o]);const{volume:s,muted:a,playbackRate:l,preservePitch:u,onlyWarnForMediaSeekingError:f,src:p,onDuration:h,acceptableTimeShift:m,acceptableTimeShiftInSeconds:w,toneFrequency:g,name:k,_remotionInternalNativeLoopPassed:v,_remotionInternalStack:y,style:x,pauseWhenBuffering:b,showInTimeline:S,loopVolumeCurveBehavior:E,onError:T,onAutoPlayError:R,onVideoFrame:P,crossOrigin:$,delayRenderRetries:N,delayRenderTimeoutInMilliseconds:W,allowAmplificationDuringRender:j,useWebAudioApi:_,audioStreamIndex:H,...O}=e,I=Fi(E??"repeat"),{fps:C,durationInFrames:A}=ct(),M=d.useContext(mt),D=er(),B=Gs(),[Z]=d.useState(()=>String(Math.random()));if(typeof m<"u")throw new Error("acceptableTimeShift has been removed. Use acceptableTimeShiftInSeconds instead.");const[L]=Rp(),[z]=jp(),Q=To({frame:I,volume:s,mediaVolume:L});$i(Q);const G=d.useCallback(()=>y??null,[y]);Cp({volume:s,mediaVolume:L,mediaType:"video",src:p,playbackRate:e.playbackRate??1,displayName:k??null,id:Z,getStack:G,showInTimeline:S,premountDisplay:(M==null?void 0:M.premountDisplay)??null,postmountDisplay:(M==null?void 0:M.postmountDisplay)??null,loopDisplay:void 0,documentationLink:f?"https://www.remotion.dev/docs/offthreadvideo":"https://www.remotion.dev/docs/html5-video",refForOutline:r}),mx({mediaRef:r,src:p,mediaType:"video",playbackRate:e.playbackRate??1,preservePitch:u,onlyWarnForMediaSeekingError:f,acceptableTimeshift:w??null,isPremounting:!!(M!=null&&M.premounting),isPostmounting:!!(M!=null&&M.postmounting),pauseWhenBuffering:b,onAutoPlayError:R??null}),gx({id:Z,isPostmounting:!!(M!=null&&M.postmounting),isPremounting:!!(M!=null&&M.premounting),mediaRef:r,mediaType:"video",onAutoPlayError:R??null}),lx({logLevel:D,mediaRef:r,volume:Q,source:o,shouldUseWebAudioApi:_??!1});const V=M?M.relativeFrom:0,K=M?Math.min(M.durationInFrames,A):A,de=Io(p),ve=w2({actualSrc:de,actualFrom:V,duration:K,fps:C});d.useImperativeHandle(t,()=>r.current,[]),d.useState(()=>At({logLevel:D,message:`Mounting video with source = ${ve}, v=${rs}, user agent=${typeof navigator>"u"?"server":navigator.userAgent}`,tag:"video",mountTime:B})),d.useEffect(()=>{const{current:X}=r;if(!X)return;const J=()=>{var ie;if(X.error){if(console.error("Error occurred in video",X==null?void 0:X.error),T){const Fe=new ti({message:`Code ${X.error.code}: ${X.error.message}`,src:p});T(Fe);return}throw new ti({message:`The browser threw an error while playing the video ${p}: Code ${X.error.code} - ${(ie=X==null?void 0:X.error)==null?void 0:ie.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 Fe=new ti({message:`The browser threw an error while playing the video ${p}`,src:p});T(Fe);return}throw new ti({message:"The browser threw an error while playing the video",src:p})}};return X.addEventListener("error",J,{once:!0}),()=>{X.removeEventListener("error",J)}},[T,p]);const ue=d.useRef(h);ue.current=h,Fx({ref:r,onVideoFrame:P}),d.useEffect(()=>{var ie;const{current:X}=r;if(!X)return;if(X.duration){(ie=ue.current)==null||ie.call(ue,p,X.duration);return}const J=()=>{var Fe;(Fe=ue.current)==null||Fe.call(ue,p,X.duration)};return X.addEventListener("loadedmetadata",J),()=>{X.removeEventListener("loadedmetadata",J)}},[p]),d.useEffect(()=>{const{current:X}=r;X&&(Fu()?X.preload="metadata":X.preload="auto")},[]);const se=d.useMemo(()=>({...x}),[x]),ee=kp({crossOrigin:$,requestsVideoFrame:!!P,isClientSideRendering:!1});return c.jsx("video",{...O,ref:r,muted:a||z||Q<=0,playsInline:!0,src:ve,loop:v,style:se,disableRemotePlayback:!0,crossOrigin:ee,controls:!1})},$p=d.forwardRef(OI),Ap=e=>{const{startFrom:t,endAt:n,trimBefore:r,trimAfter:o,name:i,pauseWhenBuffering:s,stack:a,showInTimeline:l,...u}=e,f=at(),p=qs(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.`);ju({startFrom:t,endAt:n,trimBefore:r,trimAfter:o});const{trimBeforeValue:m,trimAfterValue:w}=Pu({startFrom:t,endAt:n,trimBefore:r,trimAfter:o});if(typeof m<"u"||typeof w<"u")return c.jsx(Tt,{layout:"none",from:0-(m??0),showInTimeline:!1,durationInFrames:w,name:i,children:c.jsx(Ap,{pauseWhenBuffering:p,...u,trimAfter:void 0,name:void 0,showInTimeline:l,trimBefore:void 0,stack:void 0,startFrom:void 0,endAt:void 0})});if(Ru(e,"Video"),f.isRendering)return c.jsx(DI,{pauseWhenBuffering:p,...u,trimAfter:void 0,name:void 0,showInTimeline:l,trimBefore:void 0,stack:void 0,startFrom:void 0,endAt:void 0});const{transparent:g,toneMapped:k,onAutoPlayError:v,onVideoFrame:y,crossOrigin:x,delayRenderRetries:b,delayRenderTimeoutInMilliseconds:S,...E}=u;return c.jsx($p,{_remotionInternalStack:a??null,onDuration:h,onlyWarnForMediaSeekingError:!0,pauseWhenBuffering:p,showInTimeline:l??!0,onAutoPlayError:v??void 0,onVideoFrame:y??null,crossOrigin:x,...E,_remotionInternalNativeLoopPassed:!1})},Mx=({src:e,acceptableTimeShiftInSeconds:t,allowAmplificationDuringRender:n,audioStreamIndex:r,crossOrigin:o,delayRenderRetries:i,delayRenderTimeoutInMilliseconds:s,loopVolumeCurveBehavior:a,muted:l,name:u,onAutoPlayError:f,onError:p,onVideoFrame:h,pauseWhenBuffering:m,playbackRate:w,preservePitch:g,showInTimeline:k,style:v,toneFrequency:y,toneMapped:x,transparent:b,trimAfter:S,trimBefore:E,useWebAudioApi:T,volume:R,_remotionInternalNativeLoopPassed:P,endAt:$,stack:N,startFrom:W,imageFormat:j,..._})=>{if(j)throw new TypeError("The `<OffthreadVideo>` tag does no longer accept `imageFormat`. Use the `transparent` prop if you want to render a transparent video.");return c.jsx(Ap,{acceptableTimeShiftInSeconds:t,allowAmplificationDuringRender:n??!0,audioStreamIndex:r??0,crossOrigin:o,delayRenderRetries:i,delayRenderTimeoutInMilliseconds:s,loopVolumeCurveBehavior:a??"repeat",muted:l??!1,name:u,onAutoPlayError:f??null,onError:p,onVideoFrame:h,pauseWhenBuffering:qs(m),playbackRate:w??1,preservePitch:g,toneFrequency:y??1,showInTimeline:k??!0,src:e,stack:N,startFrom:W,_remotionInternalNativeLoopPassed:P??!1,endAt:$,style:v,toneMapped:x??!0,transparent:b??!1,trimAfter:S,trimBefore:E,useWebAudioApi:T??!1,volume:R,..._})};Ut(Mx);var BI="remotion_staticFilesChanged";function WI(){const e=oe.useContext(Ei),t=oe.useContext(Ti),n=oe.useContext(Ii),r=oe.useContext(mt),o=oe.useContext(Ks),i=oe.useContext(So),s=oe.useContext(Tu),a=oe.useContext(pu),l=oe.useContext(Co),u=oe.useContext(ji),f=oe.useContext(yu),p=oe.useContext(xu),h=oe.useContext(Mi),m=oe.useContext(ko);return d.useMemo(()=>({compositionManagerCtx:e,timelineContext:t,setTimelineContext:n,sequenceContext:r,nonceContext:o,canUseRemotionHooksContext:i,preloadContext:s,resolveCompositionContext:a,renderAssetManagerContext:l,sequenceManagerContext:u,sequenceManagerRefContext:f,visualModePropStatusesRefContext:p,bufferManagerContext:h,logLevelContext:m}),[e,o,r,n,t,i,s,a,l,u,f,p,h,m])}var VI=e=>{const{children:t,contexts:n}=e;return c.jsx(ko.Provider,{value:n.logLevelContext,children:c.jsx(So.Provider,{value:n.canUseRemotionHooksContext,children:c.jsx(Ks.Provider,{value:n.nonceContext,children:c.jsx(Tu.Provider,{value:n.preloadContext,children:c.jsx(Ei.Provider,{value:n.compositionManagerCtx,children:c.jsx(yu.Provider,{value:n.sequenceManagerRefContext,children:c.jsx(ji.Provider,{value:n.sequenceManagerContext,children:c.jsx(xu.Provider,{value:n.visualModePropStatusesRefContext,children:c.jsx(Co.Provider,{value:n.renderAssetManagerContext,children:c.jsx(pu.Provider,{value:n.resolveCompositionContext,children:c.jsx(Ti.Provider,{value:n.timelineContext,children:c.jsx(Ii.Provider,{value:n.setTimelineContext,children:c.jsx(mt.Provider,{value:n.sequenceContext,children:c.jsx(Mi.Provider,{value:n.bufferManagerContext,children:t})})})})})})})})})})})})})})},HI=d.createRef(),pe={MaxMediaCacheSizeContext:wI,useUnsafeVideoConfig:gu,useFrameForVolumeProp:Fi,useTimelinePosition:Gr,useAbsoluteTimelinePosition:hw,evaluateVolume:To,getAbsoluteSrc:Jn,getAnimatedImageDurationInSeconds:hI,getAssetDisplayName:ux,Timeline:Kd,validateMediaTrimProps:ju,validateMediaProps:Ru,resolveTrimProps:Pu,VideoForPreview:$p,CompositionManager:Ei,CompositionSetters:Zs,VisualModePropStatusesContext:wu,VisualModePropStatusesRefContext:xu,VisualModeDragOverridesContext:bu,VisualModeSettersContext:kw,SequenceManager:ji,SequenceManagerRefContext:yu,SequenceStackTracesUpdateContext:_I,baseSchema:vr,sequenceSchema:wi,SequenceWithoutSchema:Zw,sequenceStyleSchema:ww,sequenceVisualStyleSchema:kE,sequencePremountSchema:yw,textSchema:vu,transformSchema:tr,premountSchema:Ri,flattenActiveSchema:xp,getFlatSchemaWithAllKeys:bp,RemotionRootContexts:II,CompositionManagerProvider:mI,useVideo:mu,getRoot:bI,useMediaVolumeState:Rp,usePlayerMutedState:jp,useMediaInTimeline:Cp,useLazyComponent:ow,truthy:Ci,SequenceContext:mt,PremountContext:Cw,usePremounting:Qs,useRemotionContexts:WI,RemotionContextProvider:VI,CSSUtils:Rx,setupEnvVariables:MI,MediaVolumeContext:Ip,SetMediaVolumeContext:Tp,getRemotionEnvironment:Sn,SharedAudioContext:_i,SharedAudioContextProvider:ix,SharedAudioTagsContext:_u,SharedAudioTagsContextProvider:sx,invalidCompositionErrorMessage:fE,invalidFolderNameErrorMessage:Ak,calculateMediaDuration:Cu,isCompositionIdValid:sw,isFolderNameValid:Y0,getPreviewDomElement:yI,compositionsRef:Tx,portalNode:Ud,waitForRoot:SI,SetTimelineContext:Ii,CanUseRemotionHooksProvider:Bd,CanUseRemotionHooks:So,PrefetchProvider:nx,DurationsContextProvider:ox,IsPlayerContextProvider:Dk,useIsPlayer:sp,EditorPropsProvider:Q0,EditorPropsContext:ap,usePreload:Io,NonceContext:Ks,resolveVideoConfig:_x,resolveVideoConfigOrCatch:PI,resolveVideoConfigWithMetadataOrCatch:jI,ResolveCompositionContext:pu,useResolvedVideoConfig:lp,resolveCompositionsRef:Gk,REMOTION_STUDIO_CONTAINER_ELEMENT:jx,RenderAssetManager:Co,persistCurrentFrame:uw,usePlaybackRate:pp,useTimelineContext:Yr,useTimelineSetFrame:mw,isIosSafari:Fu,WATCH_REMOTION_STATIC_FILES:BI,addSequenceStackTraces:Ut,useMediaStartsAt:vo,BufferingProvider:dx,BufferingContextReact:Mi,getComponentsToAddStacksTo:gE,getSequenceComponent:yE,getSingleChildComponent:wE,CurrentScaleContext:$I,PixelDensityContext:LI,PreviewSizeContext:AI,calculateScale:NI,validateRenderAsset:ex,Log:xt,LogLevelContext:ko,useLogLevel:er,playbackLogging:At,timeValueRef:Yk,compositionSelectorRef:HI,RemotionEnvironmentContext:J0,warnAboutTooHighVolume:$i,AudioForPreview:vx,OBJECTFIT_CONTAIN_CLASS_NAME:Ns,InnerOffthreadVideo:Ap,useBasicMediaInTimeline:cx,getInputPropsOverride:q0,setInputPropsOverride:Uk,useVideoEnabled:kI,useAudioEnabled:EI,useIsPlayerBuffering:fx,TimelinePosition:Kd,DelayRenderContextType:rw,TimelineContext:Ti,PlaybackRateContext:cp,AbsoluteTimeContext:dp,RenderAssetManagerProvider:n2,getEffectiveVisualModeValue:zw,CompositionRenderErrorContext:Z0,useEffectChainState:ra,createEffectChainState:Xw,cleanupEffectChainState:Gd,runEffectChain:na,useMemoizedEffects:ta,useMemoizedEffectDefinitions:ea,createEffect:JC,createWebGLContextError:LC,createWebGL2ContextError:Gw,computeEffectiveSchemaValuesDotNotation:Vw,interpolateKeyframedStatus:Js,makeStaticDragOverride:EC,makeKeyframedDragOverride:CC,resolveDragOverrideValue:ku,getStaticDragOverrideValue:IC,OverrideIdsToNodePathsGettersContext:wp,OverrideIdsToNodePathsSettersContext:xC,findPropsToDelete:Bw,makeSequencePropsSubscriptionKey:ar,getPropStatusesCtx:Ow,getEffectPropStatusesCtx:Dw,hiddenField:hp,durationInFramesField:gp,freezeField:vp,fromField:bw},$x=e=>oe.Children.toArray(e).reduce((n,r)=>r.type===oe.Fragment?n.concat($x(r.props.children)):(n.push(r),n),[]),UI={durationInFrames:Er.baseSchema.durationInFrames,name:Er.sequenceSchema.name,hidden:Er.sequenceSchema.hidden,showInTimeline:Er.sequenceSchema.showInTimeline,freeze:Er.baseSchema.freeze,trimBefore:Er.sequenceSchema.trimBefore,layout:Er.sequenceSchema.layout},ZI=d.forwardRef(({offset:e=0,className:t="",stack:n=null,_remotionInternalRender:r=null,...o},i)=>(PE(),r?r({...o,offset:e,className:t||void 0,stack:n},i):c.jsx(Ew,{children:o.children}))),Ax=Er.withSchema({Component:ZI,componentName:"<Series.Sequence>",componentIdentity:"dev.remotion.remotion.Series.Sequence",schema:UI,supportsEffects:!1}),KI=Zw,Wm=({durationInFrames:e,offset:t,index:n,childrenLength:r})=>{const o=`index = ${n}, duration = ${e}`;(n!==r-1||e!==1/0)&&du(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},YI=e=>{const t=d.useMemo(()=>{const n=$x(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!==Ax)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 Wm({durationInFrames:l.props.durationInFrames,offset:l.props.offset,index:o,childrenLength:n.length}),oe.cloneElement(l,{_remotionInternalRender:(u,f)=>{const p=u.durationInFrames,{durationInFrames:h,children:m,offset:w,controls:g,stack:k,from:v,name:y,...x}=u,b=Wm({durationInFrames:p,offset:w,index:o,childrenLength:n.length}),S=i+b,E=i+p+b;return c.jsxs(c.Fragment,{children:[c.jsx(KI,{ref:f,name:y||"<Series.Sequence>",_remotionInternalDocumentationLink:y?void 0:"https://www.remotion.dev/docs/series",_remotionInternalStack:k??void 0,controls:g??void 0,from:S,durationInFrames:p,...x,children:c.jsx(Ew,{children:m})}),r(o+1,E)]})}})};return r(0,0)},[e.children]);return c.jsx(jE,{children:c.jsx(Tt,{layout:"none",name:"<Series>",_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/series",...e,children:t})})},GI=Object.assign(yr({Component:YI,componentName:"<Series>",componentIdentity:"dev.remotion.remotion.Series",schema:TE,supportsEffects:!1}),{Sequence:Ax});Ut(GI);var XI={"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";"},Vm={},qI=e=>{Vm[e]||(console.warn(e),Vm[e]=!0)},QI=e=>{for(const t of Object.keys(XI))if(e.includes(t))return{containsHex:!0,hexCode:t};return{containsHex:!1}},Jd=e=>e.startsWith("/")?Jd(e.substring(1)):e,JI=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}/${Jd(e)}`}return`/${Jd(e)}`},eT=e=>e.split("/").map(o=>encodeURIComponent(o)).join("/"),Np=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=QI(e);t.containsHex&&qI(`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=eT(e),r=JI(n);return r.startsWith("/")?r:`/${r}`},tT=e=>{const t={...e,durationInFrames:1,fps:1};return oe.createElement(Al,t)};Ut(tT);var Hm=e=>Math.round(e*1e5)/1e5,Cc=({element:e,desiredTime:t,logLevel:n,mountTime:r})=>{if(Dl(e.currentTime,t))return{wait:Promise.resolve(t),cancel:()=>{}};sl({logLevel:n,mediaRef:e,time:t,why:"Seeking during rendering",mountTime:r});let o,i=null;const s=new Promise(l=>{o=e.requestVideoFrameCallback((u,f)=>{const p=f.expectedDisplayTime-u;if(p<=0){l(f.mediaTime);return}setTimeout(()=>{l(f.mediaTime)},p+150)})}),a=new Promise(l=>{const u=()=>{l()};e.addEventListener("seeked",u,{once:!0}),i=()=>{e.removeEventListener("seeked",u)}});return{wait:Promise.all([s,a]).then(([l])=>l),cancel:()=>{i==null||i(),e.cancelVideoFrameCallback(o)}}},nT=({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,u)=>{const f=Cc({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,w=Cc({element:e,desiredTime:p+i*m,logLevel:r,mountTime:o});s=w.cancel,w.wait.then(g=>{const k=Math.abs(t-g);if(Hm(k)<=Hm(i))return l();const v=Cc({element:e,desiredTime:t+i,logLevel:r,mountTime:o});return s=v.cancel,v.wait.then(()=>{l()}).catch(y=>{u(y)})}).catch(g=>{u(g)})}),s=f.cancel}),cancel:()=>{s()}}},rT=({onError:e,volume:t,allowAmplificationDuringRender:n,playbackRate:r,onDuration:o,toneFrequency:i,name:s,acceptableTimeShiftInSeconds:a,delayRenderRetries:l,delayRenderTimeoutInMilliseconds:u,loopVolumeCurveBehavior:f,audioStreamIndex:p,onVideoFrame:h,preservePitch:m,...w},g)=>{const k=Gr(),v=It(),y=Fi(f??"repeat"),x=gu(),b=d.useRef(null),S=d.useContext(mt),E=vo(),T=at(),R=er(),P=Gs(),{delayRender:$,continueRender:N}=On(),{registerRenderAsset:W,unregisterRenderAsset:j}=d.useContext(Co),_=d.useMemo(()=>`video-${Eo(w.src??"")}-${S==null?void 0:S.cumulatedFrom}-${S==null?void 0:S.relativeFrom}-${S==null?void 0:S.durationInFrames}`,[w.src,S==null?void 0:S.cumulatedFrom,S==null?void 0:S.relativeFrom,S==null?void 0:S.durationInFrames]);if(!x)throw new Error("No video config found");const H=To({volume:t,frame:y,mediaVolume:1});$i(H),d.useEffect(()=>{if(!w.src)throw new Error("No src passed");if(!w.muted&&!(H<=0)&&window.remotion_audioEnabled)return W({type:"video",src:Jn(w.src),id:_,frame:k,volume:H,mediaFrame:v,playbackRate:r??1,toneFrequency:i??1,audioStartFrame:Math.max(0,-((S==null?void 0:S.cumulatedNegativeFrom)??0)),audioStreamIndex:p??0}),()=>j(_)},[w.muted,w.src,W,_,j,H,v,k,r,i,S==null?void 0:S.cumulatedNegativeFrom,p]),d.useImperativeHandle(g,()=>b.current,[]),Fx({ref:b,onVideoFrame:h}),d.useEffect(()=>{var Z,L;if(!window.remotion_videoEnabled)return;const{current:I}=b;if(!I)return;const C=hx({frame:v,playbackRate:r||1,startFrom:-E,fps:x.fps}),A=$(`Rendering <Html5Video /> with src="${w.src}" at time ${C}`,{retries:l??void 0,timeoutInMilliseconds:u??void 0});if(((L=(Z=window.process)==null?void 0:Z.env)==null?void 0:L.NODE_ENV)==="test"){N(A);return}if(Dl(I.currentTime,C)){if(I.readyState>=2){N(A);return}const z=()=>{N(A)};return I.addEventListener("loadeddata",z,{once:!0}),()=>{I.removeEventListener("loadeddata",z)}}const M=()=>{N(A)},D=nT({element:I,desiredTime:C,fps:x.fps,logLevel:R,mountTime:P});D.prom.then(()=>{N(A)}),I.addEventListener("ended",M,{once:!0});const B=()=>{var z;if(I!=null&&I.error){if(console.error("Error occurred in video",I==null?void 0:I.error),e)return;throw new ti({message:`The browser threw an error while playing the video ${w.src}: Code ${I.error.code} - ${(z=I==null?void 0:I.error)==null?void 0:z.message}. See https://remotion.dev/docs/media-playback-error for help. Pass an onError() prop to handle the error.`,src:w.src})}else throw new ti({message:"The browser threw an error",src:w.src})};return I.addEventListener("error",B,{once:!0}),()=>{D.cancel(),I.removeEventListener("ended",M),I.removeEventListener("error",B),N(A)}},[y,w.src,r,x.fps,v,E,e,l,u,R,P,N,$]);const{src:O}=w;return T.isRendering&&d.useLayoutEffect(()=>{var M,D;if(((D=(M=window.process)==null?void 0:M.env)==null?void 0:D.NODE_ENV)==="test")return;const I=$("Loading <Html5Video> duration with src="+O,{retries:l??void 0,timeoutInMilliseconds:u??void 0}),{current:C}=b,A=()=>{C!=null&&C.duration&&o(O,C.duration),N(I)};return C!=null&&C.duration?(o(O,C.duration),N(I)):C==null||C.addEventListener("loadedmetadata",A,{once:!0}),()=>{C==null||C.removeEventListener("loadedmetadata",A),N(I)}},[O,o,l,u,N,$]),c.jsx("video",{ref:b,disableRemotePlayback:!0,...w})},oT=d.forwardRef(rT),iT=(e,t)=>{const{startFrom:n,endAt:r,trimBefore:o,trimAfter:i,name:s,pauseWhenBuffering:a,stack:l,_remotionInternalNativeLoopPassed:u,showInTimeline:f,onAutoPlayError:p,onVideoFrame:h,...m}=e,{loop:w,...g}=e,{fps:k}=ct(),v=at(),y=qs(a);if(v.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:x,setDurations:b}=d.useContext(Sp);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=Io(e.src),E=d.useCallback(($,N)=>{b({type:"got-duration",durationInSeconds:N,src:$})},[b]),T=x[Jn(S)]??x[Jn(e.src)];ju({startFrom:n,endAt:r,trimBefore:o,trimAfter:i});const{trimBeforeValue:R,trimAfterValue:P}=Pu({startFrom:n,endAt:r,trimBefore:o,trimAfter:i});if(w&&T!==void 0){if(!Number.isFinite(T))return c.jsx(ll,{...g,ref:t,stack:l,_remotionInternalNativeLoopPassed:!0});const $=T*k;return c.jsx(Iu,{durationInFrames:Cu({trimAfter:P,mediaDurationInFrames:$,playbackRate:e.playbackRate??1,trimBefore:R}),layout:"none",name:s,showInTimeline:!1,children:c.jsx(ll,{...g,ref:t,stack:l,_remotionInternalNativeLoopPassed:!0})})}return typeof R<"u"||typeof P<"u"?c.jsx(Tt,{layout:"none",from:0-(R??0),showInTimeline:!1,durationInFrames:P===void 0?void 0:P/(e.playbackRate??1),name:s,children:c.jsx(ll,{pauseWhenBuffering:y,onVideoFrame:h,...m,ref:t,stack:l})}):(Ru({playbackRate:e.playbackRate,preservePitch:e.preservePitch,volume:e.volume},"Html5Video"),v.isRendering?c.jsx(oT,{onDuration:E,onVideoFrame:h??null,...m,ref:t}):c.jsx($p,{onlyWarnForMediaSeekingError:!1,...m,ref:t,onVideoFrame:h??null,pauseWhenBuffering:y,onDuration:E,_remotionInternalStack:l??null,_remotionInternalNativeLoopPassed:u??!1,showInTimeline:f??!0,onAutoPlayError:p??void 0}))},ll=d.forwardRef(iT);Ut(ll);xE();var sT={},aT=new Proxy(sT,{get(e,t){return t==="Bundling"||t==="Rendering"||t==="Log"||t==="Puppeteer"||t==="Output"?aT:()=>{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)}}});Tt.displayName="Sequence";Ut(Tt);vE(Tt);Ut(Al);Ut(Nk);typeof window<"u"&&(window.remotion_renderReady=!1,window.remotion_delayRenderTimeouts||(window.remotion_delayRenderTimeouts={}),window.remotion_delayRenderHandles=[]);var lT={"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}},uT={"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"}},cT={"style.backgroundColor":{type:"color",default:"transparent",description:"Color"}},dT={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}},fT={...dT},pT={...lT,...cT,...uT,...fT},hT={layout:{type:"enum",default:"absolute-fill",description:"Layout",variants:{"absolute-fill":pT,none:{}}}};({...hT.layout});var mT=(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 gT(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 vT(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 yT(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 $u={validateFps:yT,validateDimension:gT,validateDurationInFrames:vT,validateDefaultAndInputProps:mT};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 Et=25,ef=16,wT=()=>c.jsx("svg",{width:Et,height:Et,viewBox:"0 0 25 25",fill:"none",children:c.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"})}),xT=()=>c.jsxs("svg",{viewBox:"0 0 100 100",width:Et,height:Et,children:[c.jsx("rect",{x:"25",y:"20",width:"20",height:"60",fill:"#fff",ry:"5",rx:"5"}),c.jsx("rect",{x:"55",y:"20",width:"20",height:"60",fill:"#fff",ry:"5",rx:"5"})]}),bT=({isFullscreen:e})=>{const r=e?0:3,o=e?6*1.6:6/2,i=e?6*1.6:6*2;return c.jsxs("svg",{viewBox:"0 0 32 32",height:ef,width:ef,children:[c.jsx("path",{d:`
81
+ M ${r} ${i}
82
+ L ${o} ${o}
83
+ L ${i} ${r}
84
+ `,stroke:"#fff",strokeWidth:6,fill:"none"}),c.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"}),c.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"}),c.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"})]})},ST=()=>c.jsx("svg",{width:Et,height:Et,viewBox:"0 0 24 24",children:c.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"})}),kT=()=>c.jsx("svg",{width:Et,height:Et,viewBox:"0 0 24 24",children:c.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"})}),Um="__remotion_buffering_indicator",Zm="__remotion_buffering_animation",ET={width:Et,height:Et,overflow:"hidden",lineHeight:"normal",fontSize:"inherit"},CT={width:14,height:14,overflow:"hidden",lineHeight:"normal",fontSize:"inherit"},IT=({type:e})=>{const t=e==="player"?ET:CT;return c.jsxs(c.Fragment,{children:[c.jsx("style",{type:"text/css",children:`
97
+ @keyframes ${Zm} {
98
+ 0% {
99
+ rotate: 0deg;
100
+ }
101
+ 100% {
102
+ rotate: 360deg;
103
+ }
104
+ }
105
+
106
+ .${Um} {
107
+ animation: ${Zm} 1s linear infinite;
108
+ }
109
+ `}),c.jsx("div",{style:t,children:c.jsx("svg",{viewBox:e==="player"?"0 0 22 22":"0 0 18 18",style:t,className:Um,children:c.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})})})]})},TT=({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},Nx=({previewSize:e,compositionWidth:t,compositionHeight:n,canvasSize:r})=>{const o=pe.calculateScale({canvasSize:r,compositionHeight:n,compositionWidth:t,previewSize:e}),i=0-(1-o)/2,s=i*t,a=i*n,l=t*o,u=n*o,f=r.width/2-l/2,p=r.height/2-u/2;return{centerX:f,centerY:p,xCorrection:s,yCorrection:a,scale:o}},Lx=({config:e,style:t,canvasSize:n,overflowVisible:r,layout:o})=>e?{position:"relative",overflow:r?"visible":"hidden",...TT({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}:{},zx=({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"}:{},Dx=({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"}},Ox=oe.createContext(void 0),Bx=oe.createContext(void 0);class RT{constructor(){$e(this,"listeners",{ended:[],error:[],pause:[],play:[],ratechange:[],scalechange:[],seeked:[],timeupdate:[],frameupdate:[],fullscreenchange:[],volumechange:[],mutechange:[],waiting:[],resume:[]});$e(this,"dispatchSeek",t=>{this.dispatchEvent("seeked",{frame:t})});$e(this,"dispatchVolumeChange",t=>{this.dispatchEvent("volumechange",{volume:t})});$e(this,"dispatchPause",()=>{this.dispatchEvent("pause",void 0)});$e(this,"dispatchPlay",()=>{this.dispatchEvent("play",void 0)});$e(this,"dispatchEnded",()=>{this.dispatchEvent("ended",void 0)});$e(this,"dispatchRateChange",t=>{this.dispatchEvent("ratechange",{playbackRate:t})});$e(this,"dispatchScaleChange",t=>{this.dispatchEvent("scalechange",{scale:t})});$e(this,"dispatchError",t=>{this.dispatchEvent("error",{error:t})});$e(this,"dispatchTimeUpdate",t=>{this.dispatchEvent("timeupdate",t)});$e(this,"dispatchFrameUpdate",t=>{this.dispatchEvent("frameupdate",t)});$e(this,"dispatchFullscreenChange",t=>{this.dispatchEvent("fullscreenchange",t)});$e(this,"dispatchMuteChange",t=>{this.dispatchEvent("mutechange",t)});$e(this,"dispatchWaiting",t=>{this.dispatchEvent("waiting",t)});$e(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 jT{constructor(){$e(this,"listeners",{error:[],waiting:[],resume:[]});$e(this,"dispatchError",t=>{this.dispatchEvent("error",{error:t})});$e(this,"dispatchWaiting",t=>{this.dispatchEvent("waiting",t)});$e(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 Wx=e=>{const t=d.useContext(pe.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])},PT=({children:e,currentPlaybackRate:t})=>{const[n]=d.useState(()=>new RT);if(!d.useContext(pe.BufferingContextReact))throw new Error("BufferingContextReact not found");return d.useEffect(()=>{t&&n.dispatchRateChange(t)},[n,t]),Wx(n),c.jsx(Ox.Provider,{value:n,children:e})},Lp=(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)},u=()=>{r(!0),s()};return o.addEventListener("mouseenter",a),o.addEventListener("mouseleave",l),o.addEventListener("mousemove",u),()=>{o.removeEventListener("mouseenter",a),o.removeEventListener("mouseleave",l),o.removeEventListener("mousemove",u),clearTimeout(i)}},[t,e]),n},Au=()=>{const[e,t,n]=pe.Timeline.usePlayingState(),[r,o]=d.useState(!1),i=pe.Timeline.useTimelinePosition(),s=d.useRef(i),a=pe.Timeline.useTimelineSetFrame(),l=pe.Timeline.useTimelineSetFrame(),u=d.useContext(pe.SharedAudioContext),f=d.useContext(pe.SharedAudioTagsContext),{audioAndVideoTags:p}=pe.useTimelineContext(),h=d.useRef(i);h.current=i;const m=pe.useVideo(),w=pe.useUnsafeVideoConfig(),g=d.useContext(Ox),k=((w==null?void 0:w.durationInFrames)??1)-1,v=i===k,y=i===0;if(!g)throw new TypeError("Expected Player event emitter context");const x=d.useContext(pe.BufferingContextReact);if(!x)throw new Error("Missing the buffering context. Most likely you have a Remotion version mismatch.");const{buffering:b}=x,S=d.useCallback(I=>{const C=w?pe.TimelinePosition.clampFrameToCompositionRange(I,w.durationInFrames):Math.max(0,I);m!=null&&m.id&&l(A=>({...A,[m.id]:C})),h.current=C,g.dispatchSeek(C)},[w,g,l,m==null?void 0:m.id]),E=d.useCallback(I=>{n.current||(o(!0),v&&S(0),u==null||u.resume(),f&&f.numberOfAudioTags>0&&I&&f.playAllAudios(),p.current.forEach(C=>C.play("player play() was called and playing audio from a click")),n.current=!0,t(!0),s.current=h.current,g.dispatchPlay())},[n,v,u,f,t,g,S,p]),T=d.useCallback(()=>{n.current&&(n.current=!1,t(!1),g.dispatchPause(),u==null||u.suspend())},[g,n,t,u]),R=d.useCallback(()=>{n.current&&(n.current=!1,h.current=s.current,w&&(l(I=>({...I,[w.id]:s.current})),t(!1),g.dispatchPause()))},[w,g,n,t,l]),P=m==null?void 0:m.id,$=d.useCallback(I=>{if(!P)return null;n.current||a(C=>{const A=C[P]??window.remotion_initialFrame??0,M=Math.max(0,A-I);return A===M?C:{...C,[P]:M}})},[n,a,P]),N=d.useCallback(I=>{if(!P)return null;n.current||a(C=>{const A=C[P]??window.remotion_initialFrame??0,M=Math.min(k,A+I);return A===M?C:{...C,[P]:M}})},[P,n,k,a]),W=d.useCallback(I=>{n.current?T():E(I)},[n,T,E]),j=d.useCallback(()=>n.current,[n]),_=d.useCallback(()=>h.current,[h]),H=d.useCallback(()=>b.current,[b]);return d.useMemo(()=>({frameBack:$,frameForward:N,isLastFrame:v,emitter:g,playing:e,play:E,pause:T,seek:S,isFirstFrame:y,getCurrentFrame:_,isPlaying:j,isBuffering:H,pauseAndReturnToPlayStart:R,hasPlayed:r,toggle:W}),[g,$,N,r,y,v,_,T,R,E,e,S,W,j,H])},_T=({browserMediaControlsBehavior:e,videoConfig:t,playbackRate:n})=>{const{playing:r,pause:o,play:i,emitter:s,getCurrentFrame:a,seek:l}=Au(),u=d.useRef(!1);d.useEffect(()=>{r&&(u.current=!0)},[r]),d.useEffect(()=>{navigator.mediaSession&&e.mode!=="do-nothing"&&(r?navigator.mediaSession.playbackState="playing":u.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])},FT=({time:e,currentFrame:t,playbackSpeed:n,fps:r,actualLastFrame:o,actualFirstFrame:i,framesAdvanced:s,shouldLoop:a})=>{const u=(n<0?Math.ceil:Math.floor)(e*n/(1e3/r))-s,f=u+t,p=t>o||t<i,h=f>o||f<i,m=!a&&h&&!p;return n>0?h?{nextFrame:i,framesToAdvance:u,hasEnded:m}:{nextFrame:f,framesToAdvance:u,hasEnded:m}:h?{nextFrame:o,framesToAdvance:u,hasEnded:m}:{nextFrame:f,framesToAdvance:u,hasEnded:m}},Km=()=>typeof document>"u"?!1:document.visibilityState==="hidden",MT=()=>{const e=d.useRef(Km());return d.useEffect(()=>{const t=()=>{e.current=Km()};return document.addEventListener("visibilitychange",t),()=>{document.removeEventListener("visibilitychange",t)}},[]),e},$T=.1,Ym=({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,u=l===0?.3:l,f=e.baseLatency+u;return Math.abs(a)<$T+f&&!i||Math.abs(a)<Number.EPSILON?!1:(pe.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)},AT=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}`)},NT=({loop:e,playbackRate:t,moveToBeginningWhenEnded:n,inFrame:r,outFrame:o,browserMediaControlsBehavior:i,getCurrentFrame:s,muted:a})=>{const l=pe.useUnsafeVideoConfig(),u=pe.Timeline.useTimelinePosition(),{playing:f,pause:p,emitter:h,isPlaying:m}=Au(),w=pe.Timeline.useTimelineSetFrame(),g=d.useContext(pe.SharedAudioContext),k=pe.useLogLevel(),v=MT(),y=d.useRef(0),x=d.useContext(pe.BufferingContextReact);if(!x)throw new Error("Missing the buffering context. Most likely you have a Remotion version mismatch.");_T({browserMediaControlsBehavior:i,playbackRate:t,videoConfig:l}),d.useLayoutEffect(()=>{if(!g||!g.audioContext||!l||a)return;Ym({audioContext:g.audioContext,audioSyncAnchor:g.audioSyncAnchor,absoluteTimeInSeconds:u/l.fps,globalPlaybackRate:t,logLevel:k,force:!1})&&g.audioSyncAnchorEmitter.dispatch("changed")},[l,u,k,t,g,a]),d.useLayoutEffect(()=>{const b=g==null?void 0:g.audioContext;if(!b||!l||a)return;const S=()=>{const E=g==null?void 0:g.getAudioContextState();E&&AT(E)&&Ym({audioContext:b,audioSyncAnchor:g.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,g]),d.useEffect(()=>{var j;if(!l)return;if(!f){(j=g==null?void 0:g.suspend)==null||j.call(g);return}let b=!1,S=null,E=performance.now(),T=0;const R=()=>{S!==null&&(S.type==="raf"?cancelAnimationFrame(S.id):clearTimeout(S.id))},P=()=>{b=!0,R()},$=()=>{var D,B;if(b)return;if(!m()){(D=g==null?void 0:g.suspend)==null||D.call(g);return}!a&&!x.buffering.current&&((B=g==null?void 0:g.resume)==null||B.call(g));const _=performance.now()-E,H=o??l.durationInFrames-1,O=r??0,I=s(),{nextFrame:C,framesToAdvance:A,hasEnded:M}=FT({time:_,currentFrame:I,playbackSpeed:t,fps:l.fps,actualFirstFrame:O,actualLastFrame:H,framesAdvanced:T,shouldLoop:e});if(T+=A,C!==s()&&(!M||n)&&!x.buffering.current&&w(Z=>({...Z,[l.id]:C})),M){P(),p(),h.dispatchEnded();return}N()},N=()=>{var H,O;const _=((H=g==null?void 0:g.getIsResumingAudioContext)==null?void 0:H.call(g))??null;if(_!==null&&!a){_.then(()=>{E=performance.now(),T=0,N()});return}if(x.buffering.current){a||(O=g==null?void 0:g.suspend)==null||O.call(g);const I=x.listenForResume(()=>{I.remove(),E=performance.now(),T=0,N()});return}if(v.current){S={type:"timeout",id:setTimeout($,1e3/l.fps)};return}S={type:"raf",id:requestAnimationFrame($)}};N();const W=()=>{document.visibilityState!=="visible"&&(R(),$())};return window.addEventListener("visibilitychange",W),()=>{window.removeEventListener("visibilitychange",W),P()}},[l,e,p,f,w,h,t,r,o,n,v,s,x,m,g,k,a]),d.useEffect(()=>{const b=performance.now(),S=b-y.current;if(S>=250){h.dispatchTimeUpdate({frame:u}),y.current=b;return}const E=setTimeout(()=>{h.dispatchTimeUpdate({frame:u}),y.current=performance.now()},250-S);return()=>clearTimeout(E)},[h,u]),d.useEffect(()=>{h.dispatchFrameUpdate({frame:u})},[h,u])},Ic=[],Tc=e=>e?"current"in e?e.current:e:null,zp=(e,t)=>{const[n,r]=d.useState(()=>{const s=Tc(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],u=l.getClientRects();if(!(u!=null&&u[0])){r(null);return}const f=a.width===0?1:u[0].width/a.width,p=a.height===0?1:u[0].height/a.height,h=t.shouldApplyCssTransforms||f===0?u[0].width:u[0].width*(1/f),m=t.shouldApplyCssTransforms||p===0?u[0].height:u[0].height*(1/p);r(w=>w&&w.width===h&&w.height===m&&w.left===u[0].x&&w.top===u[0].y&&w.windowSize.height===window.innerHeight&&w.windowSize.width===window.innerWidth?w:{width:h,height:m,left:u[0].x,top:u[0].y,windowSize:{height:window.innerHeight,width:window.innerWidth}})}),[t.shouldApplyCssTransforms]),i=d.useCallback(()=>{const s=Tc(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=Tc(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(()=>(Ic.push(i),()=>{Ic=Ic.filter(s=>s!==i)}),[i]),d.useMemo(()=>n?{...n,refresh:i}:null,[n,i])},Dp=e=>e??"__remotion-player",LT={display:"flex",justifyContent:"center",alignItems:"center",flex:1,height:"100%",width:"100%"};class Vx extends oe.Component{constructor(){super(...arguments);$e(this,"state",{hasError:null})}static getDerivedStateFromError(n){return{hasError:n}}componentDidCatch(n){this.props.onError(n)}render(){return this.state.hasError?c.jsx("div",{style:LT,children:this.props.errorFallback({error:this.state.hasError})}):this.props.children}}var zT=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}},Rc={backgroundColor:"red",position:"absolute",padding:12,fontFamily:"Arial"},DT=["28d262b44cc61fa750f1686b16ad0604dabfe193fbc263eec05c89b7ad4c2cd6","4db1b0a94be33165dfefcb3ba03d04c7a2666dd27c496d3dc9fa41858e94925e","fbc48530bbf245da790f63675e84e06bab38c3b114fab07eb350025119922bdc","7baf10a8932757b1b3a22b3fce10a048747ac2f8eaf638603487e3705b07eb83","8a6c21a598d8c667272b5207c051b85997bf5b45d5fb712378be3f27cd72c6a6","a2f7aaac9c50a9255e7fc376110c4e0bfe153722dc66ed3c5d3bf2a135f65518"],Gm=!1,OT=()=>{const[e,t]=oe.useState(!1);return d.useEffect(()=>{Gm||(Gm=!0,zT().then(n=>{n&&DT.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,Rc,{zIndex:"9999",cssText:`${Rc.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?c.jsx("div",{style:Rc,className:"warning-banner",children:c.jsx("a",{style:{color:"white"},href:"https://github.com/remotion-dev/remotion/pull/4589",children:"Remotion Unlicensed – Contact hi@remotion.dev"})}):null},Xm=({playing:e,buffering:t})=>e&&t?c.jsx(IT,{type:"player"}):e?c.jsx(xT,{}):c.jsx(wT,{}),Ao=12,qm=5,BT=({volume:e,isVertical:t,onBlur:n,inputRef:r,setVolume:o})=>{const i=d.useMemo(()=>{const h={paddingLeft:5,height:Et,width:ao,display:"inline-flex",alignItems:"center"};return t?{...h,position:"absolute",transform:`rotate(-90deg) translateX(${ao/2+Et/2}px)`}:{...h}},[t]),s=typeof oe.useId>"u"?"volume-slider":oe.useId(),[a]=d.useState(()=>`__remotion-volume-slider-${Eo(s)}`.replace(".","")),l=d.useCallback(p=>{o(parseFloat(p.target.value))},[o]),u=d.useMemo(()=>{const p={WebkitAppearance:"none",backgroundColor:"rgba(255, 255, 255, 0.5)",borderRadius:qm/2,cursor:"pointer",height:qm,width:ao,backgroundImage:`linear-gradient(
114
+ to right,
115
+ white ${e*100}%, rgba(255, 255, 255, 0) ${e*100}%
116
+ )`};return t?{...p,bottom:Et+ao/2}:p},[t,e]),f=`
117
+ .${a}::-webkit-slider-thumb {
118
+ -webkit-appearance: none;
119
+ background-color: white;
120
+ border-radius: ${Ao/2}px;
121
+ box-shadow: 0 0 2px black;
122
+ height: ${Ao}px;
123
+ width: ${Ao}px;
124
+ }
125
+
126
+ .${a}::-moz-range-thumb {
127
+ -webkit-appearance: none;
128
+ background-color: white;
129
+ border-radius: ${Ao/2}px;
130
+ box-shadow: 0 0 2px black;
131
+ height: ${Ao}px;
132
+ width: ${Ao}px;
133
+ }
134
+ `;return c.jsxs("div",{style:i,children:[c.jsx("style",{dangerouslySetInnerHTML:{__html:f}}),c.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:u})]})},WT=e=>c.jsx(BT,{...e}),ao=100,VT=({displayVerticalVolumeSlider:e,renderMuteButton:t,renderVolumeSlider:n})=>{const[r,o]=pe.usePlayerMutedState(),[i,s]=pe.useMediaVolumeState(),[a,l]=d.useState(!1),u=d.useRef(null),f=d.useRef(null),p=Lp(u,!1),h=d.useCallback(()=>{setTimeout(()=>{f.current&&document.activeElement!==f.current&&l(!1)},10)},[]),m=i===0,w=d.useCallback(()=>{if(m){s(1),o(!1);return}o(b=>!b)},[m,o,s]),g=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:Et,height:Et,cursor:"pointer",appearance:"none",background:"none",border:"none",padding:0}),[]),v=d.useCallback(({muted:b,volume:S})=>{const E=b||S===0;return c.jsx("button",{"aria-label":E?"Unmute sound":"Mute sound",title:E?"Unmute sound":"Mute sound",onClick:w,onBlur:h,onFocus:()=>l(!0),style:k,type:"button",children:E?c.jsx(ST,{}):c.jsx(kT,{})})},[h,w,k]),y=d.useMemo(()=>t?t({muted:r,volume:i}):v({muted:r,volume:i}),[r,i,v,t]),x=d.useMemo(()=>(a||p)&&!r&&!pe.isIosSafari()?(n??WT)({isVertical:e,volume:i,onBlur:()=>l(!1),inputRef:f,setVolume:s}):null,[e,a,p,r,i,n,s]);return c.jsxs("div",{ref:u,style:g,children:[y,x]})};function HT(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 UT=35,ZT=70,KT={height:30,paddingRight:15,paddingLeft:12,display:"flex",flexDirection:"row",alignItems:"center"},YT={width:22,display:"flex",alignItems:"center"},GT={width:14,height:14,color:"black"},XT=()=>c.jsx("svg",{viewBox:"0 0 512 512",style:GT,children:c.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"})}),qT=e=>{const t=e.toString();return t.includes(".")?t:t+".0"},QT=({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)},[]),u=r===e,f=d.useMemo(()=>({...KT,backgroundColor:i||u?"#eee":"transparent"}),[i,u]);return c.jsxs("div",{onPointerEnter:a,onPointerLeave:l,tabIndex:0,style:f,onClick:o,children:[c.jsx("div",{style:YT,children:e===n?c.jsx(XT,{}):null}),qT(e),"x"]},e)},JT=({setIsComponentVisible:e,playbackRates:t,canvasSize:n})=>{const{setPlaybackRate:r,playbackRate:o}=pe.usePlaybackRate(),[i,s]=d.useState(o);d.useEffect(()=>{const u=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",u),()=>{window.removeEventListener("keydown",u)}},[t,i,r,e]);const a=d.useCallback(u=>{r(u),e(!1)},[e,r]),l=d.useMemo(()=>({position:"absolute",right:0,width:125,maxHeight:n.height-ZT-UT,bottom:35,background:"#fff",borderRadius:4,overflow:"auto",color:"black",textAlign:"left"}),[n.height]);return c.jsx("div",{style:l,children:t.map(u=>c.jsx(QT,{selectedRate:o,onSelect:a,rate:u,keyboardSelectedRate:i},u))})},eR={fontSize:13,fontWeight:"bold",color:"white",border:"2px solid white",borderRadius:20,paddingLeft:8,paddingRight:8,paddingTop:2,paddingBottom:2},tf={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"},tR={...tf,position:"relative"},nR=({playbackRates:e,canvasSize:t})=>{const{ref:n,isComponentVisible:r,setIsComponentVisible:o}=HT(!1),{playbackRate:i}=pe.usePlaybackRate(),s=d.useCallback(a=>{a.stopPropagation(),a.preventDefault(),o(l=>!l)},[o]);return c.jsx("div",{ref:n,children:c.jsxs("button",{type:"button","aria-label":"Change playback rate",style:tR,onClick:s,children:[c.jsxs("div",{style:eR,children:[i,"x"]}),r&&c.jsx(JT,{canvasSize:t,playbackRates:e,setIsComponentVisible:o})]})})},Qm=(e,t,n)=>Math.round(Pi(e,[0,n],[0,t-1],{extrapolateLeft:"clamp",extrapolateRight:"clamp"})),ni=5,Yi=12,nf=4,rR={userSelect:"none",WebkitUserSelect:"none",paddingTop:nf,paddingBottom:nf,boxSizing:"border-box",cursor:"pointer",position:"relative",touchAction:"none"},oR={height:ni,backgroundColor:"rgba(255, 255, 255, 0.25)",width:"100%",borderRadius:ni/2},iR=e=>{let t=e;for(;t.parentElement;)t=t.parentElement;return t},sR=({durationInFrames:e,onSeekEnd:t,onSeekStart:n,inFrame:r,outFrame:o})=>{const i=d.useRef(null),s=Lp(i,!1),a=zp(i,{triggerOnWindowResize:!0,shouldApplyCssTransforms:!0}),{seek:l,play:u,pause:f,playing:p}=Au(),h=pe.Timeline.useTimelinePosition(),[m,w]=d.useState({dragging:!1}),g=(a==null?void 0:a.width)??0,k=d.useCallback(E=>{var P;if(E.button!==0)return;const T=(P=i.current)==null?void 0:P.getBoundingClientRect().left,R=Qm(E.clientX-T,e,g);f(),l(R),w({dragging:!0,wasPlaying:p}),n()},[e,g,f,l,p,n]),v=d.useCallback(E=>{var P;if(!a)throw new Error("Player has no size");if(!m.dragging)return;const T=(P=i.current)==null?void 0:P.getBoundingClientRect().left,R=Qm(E.clientX-T,e,a.width);l(R)},[m.dragging,e,l,a]),y=d.useCallback(()=>{w({dragging:!1}),m.dragging&&(m.wasPlaying?u():f(),t())},[m,t,f,u]);d.useEffect(()=>{if(!m.dragging)return;const E=iR(i.current);return E.addEventListener("pointermove",v),E.addEventListener("pointerup",y),()=>{E.removeEventListener("pointermove",v),E.removeEventListener("pointerup",y)}},[m.dragging,v,y]);const x=d.useMemo(()=>({height:Yi,width:Yi,borderRadius:Yi/2,position:"absolute",top:nf-Yi/2+5/2,backgroundColor:"white",left:Math.max(0,h/Math.max(1,e-1)*g-Yi/2),boxShadow:"0 0 2px black",opacity:Number(s||m.dragging)}),[s,m.dragging,e,h,g]),b=d.useMemo(()=>({height:ni,backgroundColor:"rgba(255, 255, 255, 1)",width:(h-(r??0))/(e-1)*g,marginLeft:(r??0)/(e-1)*g,borderRadius:ni/2}),[e,h,r,g]),S=d.useMemo(()=>({height:ni,backgroundColor:"rgba(255, 255, 255, 0.25)",width:((o??e-1)-(r??0))/(e-1)*100+"%",marginLeft:(r??0)/(e-1)*100+"%",borderRadius:ni/2,position:"absolute"}),[e,r,o]);return c.jsxs("div",{ref:i,onPointerDown:k,style:rR,children:[c.jsxs("div",{style:oR,children:[c.jsx("div",{style:S}),c.jsx("div",{style:b})]}),c.jsx("div",{style:x})]})},Jm=e=>{const t=Math.floor(e/60),n=Math.floor(e-t*60);return`${String(t)}:${String(n).padStart(2,"0")}`},aR=({durationInFrames:e,maxTimeLabelWidth:t,fps:n})=>{const r=pe.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 c.jsxs("div",{style:o,children:[Jm(s/n)," / ",Jm(e/n)]})},lR=10,rf=12,uR=({allowFullscreen:e,playerWidth:t})=>d.useMemo(()=>{const r=Et,o=Et,i=e?ef:0,s=o+r+i+rf*2+lR*2,a=t-s,l=Math.max(a,0),u=l-ao,p=(u<ao?l:u)+s+ao,h=t<p;return{maxTimeLabelWidth:l===0?null:l,displayVerticalVolumeSlider:h}},[e,t]),cR=[0,.013,.049,.104,.175,.259,.352,.45,.55,.648,.741,.825,.896,.951,.987],dR=[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],fR=1/.7,pR={boxSizing:"border-box",position:"absolute",bottom:0,width:"100%",paddingTop:40,paddingBottom:10,backgroundImage:`linear-gradient(to bottom,${cR.map((e,t)=>`hsla(0, 0%, 0%, ${e}) ${dR[t]*fR}%`).join(", ")}, hsl(0, 0%, 0%) 100%)`,backgroundSize:"auto 145px",display:"flex",paddingRight:rf,paddingLeft:rf,flexDirection:"column",transition:"opacity 0.3s"},hR={display:"flex",flexDirection:"row",width:"100%",alignItems:"center",justifyContent:"center",userSelect:"none",WebkitUserSelect:"none"},mR={display:"flex",flexDirection:"row",userSelect:"none",WebkitUserSelect:"none",alignItems:"center"},Gi={width:12},gR={height:8},vR={flex:1},yR={},wR=({durationInFrames:e,isFullscreen:t,fps:n,showVolumeControls:r,onFullscreenButtonClick:o,allowFullscreen:i,onExitFullscreenButtonClick:s,spaceKeyToPlayOrPause:a,onSeekEnd:l,onSeekStart:u,inFrame:f,outFrame:p,initiallyShowControls:h,canvasSize:m,renderPlayPauseButton:w,renderFullscreenButton:g,alwaysShowControls:k,showPlaybackRateControl:v,containerRef:y,buffering:x,hideControlsWhenPointerDoesntMove:b,onPointerDown:S,onDoubleClick:E,renderMuteButton:T,renderVolumeSlider:R,playing:P,toggle:$,renderCustomControls:N})=>{const W=d.useRef(null),[j,_]=d.useState(!1),H=Lp(y,b),{maxTimeLabelWidth:O,displayVerticalVolumeSlider:I}=uR({allowFullscreen:i,playerWidth:(m==null?void 0:m.width)??0}),[C,A]=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")}),M=d.useMemo(()=>({...pR,opacity:Number(H||!P||C||k)}),[H,C,P,k]);d.useEffect(()=>{W.current&&a&&W.current.focus({preventScroll:!0})},[P,a]),d.useEffect(()=>{_((typeof document<"u"&&(document.fullscreenEnabled||document.webkitFullscreenEnabled))??!1)},[]),d.useEffect(()=>{if(C===!1)return;const V=setTimeout(()=>{A(!1)},C===!0?2e3:C);return()=>{clearInterval(V)}},[C]);const D=d.useMemo(()=>{if(v===!0)return[.5,.8,1,1.2,1.5,1.8,2,2.5,3];if(Array.isArray(v)){for(const G of v){if(typeof G!="number")throw new Error("Every item in showPlaybackRateControl must be a number");if(G<=0)throw new Error("Every item in showPlaybackRateControl must be positive")}return v}return null},[v]),B=N?N():null,Z=d.useRef(null),L=d.useRef(null),z=d.useCallback(G=>{(G.target===Z.current||G.target===L.current)&&(S==null||S(G))},[S]),Q=d.useCallback(G=>{(G.target===Z.current||G.target===L.current)&&(E==null||E(G))},[E]);return c.jsxs("div",{ref:Z,style:M,onPointerDown:z,onDoubleClick:Q,children:[c.jsxs("div",{ref:L,style:hR,children:[c.jsxs("div",{style:mR,children:[c.jsx("button",{ref:W,type:"button",style:tf,onClick:$,"aria-label":P?"Pause video":"Play video",title:P?"Pause video":"Play video",children:w===null?c.jsx(Xm,{buffering:x,playing:P}):w({playing:P,isBuffering:x})??c.jsx(Xm,{buffering:x,playing:P})}),r?c.jsxs(c.Fragment,{children:[c.jsx("div",{style:Gi}),c.jsx(VT,{renderMuteButton:T,renderVolumeSlider:R,displayVerticalVolumeSlider:I})]}):null,c.jsx("div",{style:Gi}),c.jsx(aR,{durationInFrames:e,fps:n,maxTimeLabelWidth:O}),c.jsx("div",{style:Gi})]}),c.jsx("div",{style:vR}),B,B&&D&&m?c.jsx("div",{style:Gi}):null,D&&m&&c.jsx(nR,{canvasSize:m,playbackRates:D}),D&&j&&i?c.jsx("div",{style:Gi}):null,c.jsx("div",{style:yR,children:j&&i?c.jsx("button",{type:"button","aria-label":t?"Exit fullscreen":"Enter Fullscreen",title:t?"Exit fullscreen":"Enter Fullscreen",style:tf,onClick:t?s:o,children:g===null?c.jsx(bT,{isFullscreen:t}):g({isFullscreen:t})}):null})]}),c.jsx("div",{style:gR}),c.jsx(sR,{onSeekEnd:l,onSeekStart:u,durationInFrames:e,inFrame:f,outFrame:p})]})},Hx=typeof document>"u",xR=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}}},bR=e=>new Promise(t=>setTimeout(t,e)),SR=()=>{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])},kR=(e,t,n)=>{const r=SR(),o=d.useCallback(async l=>{if(l instanceof PointerEvent?l.pointerType==="touch":l.nativeEvent.pointerType==="touch"){e(l);return}r.clearPendingPromises();const u=xR(bR(200));r.appendPendingPromise(u);try{await u.promise,r.removePendingPromise(u),e(l)}catch(f){const p=f;if(r.removePendingPromise(u),!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])},of=oe.version.split(".")[0];if(of==="0")throw new Error(`Version ${of} of "react" is not supported by Remotion`);var ER=parseInt(of,10)>=18,CR=({controls:e,style:t,loop:n,autoPlay:r,allowFullscreen:o,inputProps:i,clickToPlay:s,showVolumeControls:a,doubleClickToFullscreen:l,spaceKeyToPlayOrPause:u,errorFallback:f,playbackRate:p,renderLoading:h,renderPoster:m,className:w,moveToBeginningWhenEnded:g,showPosterWhenUnplayed:k,showPosterWhenEnded:v,showPosterWhenPaused:y,showPosterWhenBuffering:x,showPosterWhenBufferingAndPaused:b,inFrame:S,outFrame:E,initiallyShowControls:T,renderFullscreen:R,renderPlayPauseButton:P,renderMuteButton:$,renderVolumeSlider:N,renderCustomControls:W,alwaysShowControls:j,showPlaybackRateControl:_,posterFillMode:H,bufferStateDelayInMilliseconds:O,hideControlsWhenPointerDoesntMove:I,overflowVisible:C,browserMediaControlsBehavior:A,overrideInternalClassName:M,noSuspense:D},B)=>{const Z=pe.useUnsafeVideoConfig(),L=pe.useVideo(),z=d.useRef(null),Q=zp(z,{triggerOnWindowResize:!1,shouldApplyCssTransforms:!1}),[G,V]=d.useState(!1),[K,de]=d.useState(r),[ve,ue]=d.useState(()=>!1),[se,ee]=d.useState(!1),X=d.useMemo(()=>typeof document>"u"?!1:!!(document.fullscreenEnabled||document.webkitFullscreenEnabled),[]),J=Au(),ie=J.toggle,{playerMuted:Fe,mediaVolume:Ee}=d.useContext(pe.MediaVolumeContext);d.useEffect(()=>{J.emitter.dispatchVolumeChange(Ee)},[J.emitter,Ee]);const be=Fe||Ee===0;d.useEffect(()=>{J.emitter.dispatchMuteChange({isMuted:be})},[J.emitter,be]),NT({loop:n,playbackRate:p,moveToBeginningWhenEnded:g,inFrame:S,outFrame:E,getCurrentFrame:J.getCurrentFrame,browserMediaControlsBehavior:A,muted:be}),d.useEffect(()=>{G&&!J.playing&&(V(!1),J.play())},[G,J]),d.useEffect(()=>{const{current:fe}=z;if(!fe)return;const Pe=()=>{const Zt=document.fullscreenElement===fe||document.webkitFullscreenElement===fe;ue(Zt)};return document.addEventListener("fullscreenchange",Pe),document.addEventListener("webkitfullscreenchange",Pe),()=>{document.removeEventListener("fullscreenchange",Pe),document.removeEventListener("webkitfullscreenchange",Pe)}},[]);const Me=d.useCallback(fe=>{ie(fe)},[ie]),xe=d.useCallback(()=>{if(!o)throw new Error("allowFullscreen is false");if(!X)throw new Error("Browser doesnt support fullscreen");if(!z.current)throw new Error("No player ref found");z.current.webkitRequestFullScreen?z.current.webkitRequestFullScreen():z.current.requestFullscreen()},[o,X]),Te=d.useCallback(()=>{document.webkitExitFullscreen?document.webkitExitFullscreen():document.exitFullscreen()},[]);d.useEffect(()=>{const{current:fe}=z;if(!fe)return;const Pe=()=>{const Zt=document.webkitFullscreenElement??document.fullscreenElement;Zt&&Zt===z.current?J.emitter.dispatchFullscreenChange({isFullscreen:!0}):J.emitter.dispatchFullscreenChange({isFullscreen:!1})};return fe.addEventListener("webkitfullscreenchange",Pe),fe.addEventListener("fullscreenchange",Pe),()=>{fe.removeEventListener("webkitfullscreenchange",Pe),fe.removeEventListener("fullscreenchange",Pe)}},[J.emitter]);const je=(Z==null?void 0:Z.durationInFrames)??1,Ce=d.useMemo(()=>!Z||!Q?null:Nx({canvasSize:Q,compositionHeight:Z.height,compositionWidth:Z.width,previewSize:"auto"}),[Q,Z]),Le=(Ce==null?void 0:Ce.scale)??1,Rt=d.useRef(!1);d.useEffect(()=>{if(!Rt.current){Rt.current=!0;return}J.emitter.dispatchScaleChange(Le)},[J.emitter,Le]);const{setMediaVolume:Lt,setPlayerMuted:pn}=d.useContext(pe.SetMediaVolumeContext),[zt,In]=d.useState(!1);d.useEffect(()=>{let fe=null,Pe=!1;const Zt=()=>{Pe=!1,requestAnimationFrame(()=>{O===0?In(!0):fe=setTimeout(()=>{Pe||In(!0)},O)})},Bn=()=>{requestAnimationFrame(()=>{Pe=!0,In(!1),fe&&clearTimeout(fe)})};return J.emitter.addEventListener("waiting",Zt),J.emitter.addEventListener("resume",Bn),()=>{J.emitter.removeEventListener("waiting",Zt),J.emitter.removeEventListener("resume",Bn),In(!1),fe&&clearTimeout(fe),Pe=!0}},[O,J.emitter]),d.useImperativeHandle(B,()=>{const fe={play:J.play,pause:()=>{V(!1),J.pause()},toggle:Me,getContainerNode:()=>z.current,getCurrentFrame:J.getCurrentFrame,isPlaying:J.isPlaying,seekTo:Pe=>{const Zt=je-1,Bn=Math.max(0,Math.min(Zt,Pe));J.isPlaying()&&(V(Bn!==Zt||n),J.pause()),Bn===Zt&&!n&&J.emitter.dispatchEnded(),J.seek(Bn)},isFullscreen:()=>{const{current:Pe}=z;return Pe?document.fullscreenElement===Pe||document.webkitFullscreenElement===Pe:!1},requestFullscreen:xe,exitFullscreen:Te,getVolume:()=>Fe?0:Ee,setVolume:Pe=>{if(typeof Pe!="number")throw new TypeError(`setVolume() takes a number, got value of type ${typeof Pe}`);if(isNaN(Pe))throw new TypeError("setVolume() got a number that is NaN. Volume must be between 0 and 1.");if(Pe<0||Pe>1)throw new TypeError(`setVolume() got a number that is out of range. Must be between 0 and 1, got ${Pe}`);Lt(Pe)},isMuted:()=>be,mute:()=>{pn(!0)},unmute:()=>{pn(!1)},getScale:()=>Le,pauseAndReturnToPlayStart:()=>{J.pauseAndReturnToPlayStart()}};return Object.assign(J.emitter,fe)},[je,Te,n,Fe,be,Ee,J,xe,pn,Lt,Me,Le]);const Tn=L?L.component:null,He=d.useMemo(()=>Lx({canvasSize:Q,config:Z,style:t,overflowVisible:C,layout:Ce}),[Q,Z,Ce,C,t]),hn=d.useMemo(()=>Dx({config:Z,layout:Ce,scale:Le,overflowVisible:C}),[Z,Ce,C,Le]),tn=d.useMemo(()=>zx({config:Z,layout:Ce,scale:Le,overflowVisible:C}),[Z,Ce,C,Le]),it=J.pause,jt=J.emitter.dispatchError,gt=d.useCallback(fe=>{it(),jt(fe)},[jt,it]),Rn=d.useCallback(fe=>{fe.stopPropagation(),xe()},[xe]),wr=d.useCallback(fe=>{fe.stopPropagation(),Te()},[Te]),Dt=d.useCallback(fe=>{(fe instanceof MouseEvent?fe.button===2:fe.nativeEvent.button)||Me(fe)},[Me]),nr=d.useCallback(()=>{ee(!0)},[]),Qr=d.useCallback(()=>{ee(!1)},[]),Po=d.useCallback(()=>{ve?Te():xe()},[Te,ve,xe]),{handlePointerDown:F,handleDoubleClick:U}=kR(Dt,Po,l&&o&&X);d.useEffect(()=>{K&&(J.play(),de(!1))},[K,J]);const ne=d.useMemo(()=>h?h({height:He.height,width:He.width,isBuffering:zt}):null,[He.height,He.width,h,zt]),ce=d.useMemo(()=>({type:"scale",scale:Le}),[Le]);if(!Z)return null;const me=m?m({height:H==="player-size"?He.height:Z.height,width:H==="player-size"?He.width:Z.width,isBuffering:zt}):null;if(me===void 0)throw new TypeError("renderPoster() must return a React element, but undefined was returned");const ye=me&&[y&&!J.isPlaying()&&!se,v&&J.isLastFrame&&!J.isPlaying(),k&&!J.hasPlayed&&!J.isPlaying(),x&&zt&&J.isPlaying(),b&&zt&&!J.isPlaying()].some(Boolean),{left:Se,top:_e,width:qe,height:Ae,...ze}=hn,Jr=c.jsxs(c.Fragment,{children:[c.jsxs("div",{style:hn,onPointerDown:s?F:void 0,onDoubleClick:l?U:void 0,children:[c.jsxs("div",{style:tn,className:Dp(M),children:[Tn?c.jsx(Vx,{onError:gt,errorFallback:f,children:c.jsx(pe.CurrentScaleContext.Provider,{value:ce,children:c.jsx(Tn,{...(L==null?void 0:L.props)??{},...i??{}})})}):null,ye&&H==="composition-size"?c.jsx("div",{style:{...ze,width:Z.width,height:Z.height},onPointerDown:s?F:void 0,onDoubleClick:l?U:void 0,children:me}):null]}),c.jsx(OT,{})]}),ye&&H==="player-size"?c.jsx("div",{style:hn,onPointerDown:s?F:void 0,onDoubleClick:l?U:void 0,children:me}):null,e?c.jsx(wR,{fps:Z.fps,playing:J.playing,toggle:J.toggle,durationInFrames:Z.durationInFrames,containerRef:z,onFullscreenButtonClick:Rn,isFullscreen:ve,allowFullscreen:o,showVolumeControls:a,onExitFullscreenButtonClick:wr,spaceKeyToPlayOrPause:u,onSeekEnd:Qr,onSeekStart:nr,inFrame:S,outFrame:E,initiallyShowControls:T,canvasSize:Q,renderFullscreenButton:R,renderPlayPauseButton:P,alwaysShowControls:j,showPlaybackRateControl:_,buffering:zt,hideControlsWhenPointerDoesntMove:I,onDoubleClick:l?U:void 0,onPointerDown:s?F:void 0,renderMuteButton:$,renderVolumeSlider:N,renderCustomControls:W}):null]});return D||Hx&&!ER?c.jsx("div",{ref:z,style:He,className:w,children:Jr}):c.jsx("div",{ref:z,style:He,className:w,children:c.jsx(d.Suspense,{fallback:ne,children:Jr})})},IR=d.forwardRef(CR),Ux="remotion.volumePreference",TR=(e,t,n)=>{if(!(typeof window>"u"))try{window.localStorage.setItem(n??Ux,String(e))}catch(r){pe.Log.error({logLevel:t,tag:null},"Could not persist volume",r)}},RR=e=>{if(typeof window>"u")return 1;try{const t=window.localStorage.getItem(e??Ux);return t?Number(t):1}catch{return 1}},Op="player-comp",Zx=({children:e,timelineContext:t,playbackRateContext:n,fps:r,compositionHeight:o,compositionWidth:i,durationInFrames:s,component:a,numberOfSharedAudioTags:l,initiallyMuted:u,logLevel:f,audioLatencyHint:p,sampleRate:h,volumePersistenceKey:m,initialVolume:w,inputProps:g,audioEnabled:k})=>{const v=w===void 0,y=d.useMemo(()=>({compositions:[{component:a,durationInFrames:s,height:o,width:i,fps:r,id:Op,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:g},canvasContent:{type:"composition",compositionId:"player-comp"}}),[a,s,o,i,r,g]),[x,b]=d.useState(()=>u),[S,E]=d.useState(()=>v?RR(m??null):w),T=d.useMemo(()=>({playerMuted:x,mediaVolume:S}),[x,S]),R=d.useRef(!1),P=R.current||k&&!x&&S>0;R.current=P;const $=d.useCallback(_=>{E(_),v&&TR(_,f,m??null)},[v,f,m]),N=d.useMemo(()=>({setPlayerMuted:b,setMediaVolume:$}),[$]),W=d.useMemo(()=>({logLevel:f,mountTime:Date.now()}),[f]),j=d.useMemo(()=>({isPlayer:!0,isRendering:!1,isStudio:!1,isClientSideRendering:!1,isReadOnlyStudio:!1}),[]);return c.jsx(pe.RemotionEnvironmentContext.Provider,{value:j,children:c.jsx(pe.LogLevelContext.Provider,{value:W,children:c.jsx(pe.CanUseRemotionHooksProvider,{children:c.jsx(pe.AbsoluteTimeContext.Provider,{value:t,children:c.jsx(pe.PlaybackRateContext.Provider,{value:n,children:c.jsx(pe.TimelineContext.Provider,{value:t,children:c.jsx(pe.CompositionManager.Provider,{value:y,children:c.jsx(pe.PrefetchProvider,{children:c.jsx(pe.DurationsContextProvider,{children:c.jsx(pe.MediaVolumeContext.Provider,{value:T,children:c.jsx(pe.SetMediaVolumeContext.Provider,{value:N,children:c.jsx(pe.BufferingProvider,{children:c.jsx(pe.SharedAudioContextProvider,{audioLatencyHint:p,audioEnabled:P,previewSampleRate:h,children:c.jsx(pe.SharedAudioTagsContextProvider,{numberOfAudioTags:l,children:e})})})})})})})})})})})})})})},eg=!1,jR=(e,t)=>{e||eg||(eg=!0,pe.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."))},tg=(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},PR=({inFrame:e,durationInFrames:t,outFrame:n})=>{const r=tg(e,"inFrame"),o=tg(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)}},_R=({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)}`)}},FR=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.")}},MR=$u.validateFps,ng=$u.validateDimension,$R=$u.validateDurationInFrames,AR=$u.validateDefaultAndInputProps,NR=e=>"component"in e?e.component:null,LR=({durationInFrames:e,compositionHeight:t,compositionWidth:n,fps:r,inputProps:o,style:i,controls:s=!1,loop:a=!1,autoPlay:l=!1,showVolumeControls:u=!0,allowFullscreen:f=!0,clickToPlay:p,doubleClickToFullscreen:h=!1,spaceKeyToPlayOrPause:m=!0,moveToBeginningWhenEnded:w=!0,numberOfSharedAudioTags:g=5,errorFallback:k=()=>"⚠️",playbackRate:v=1,renderLoading:y,className:x,showPosterWhenUnplayed:b,showPosterWhenEnded:S,showPosterWhenPaused:E,showPosterWhenBuffering:T,showPosterWhenBufferingAndPaused:R,initialFrame:P,renderPoster:$,inFrame:N,outFrame:W,initiallyShowControls:j,renderFullscreenButton:_,renderPlayPauseButton:H,renderVolumeSlider:O,renderCustomControls:I,alwaysShowControls:C=!1,initiallyMuted:A=!1,showPlaybackRateControl:M=!1,posterFillMode:D="player-size",bufferStateDelayInMilliseconds:B,hideControlsWhenPointerDoesntMove:Z=!0,overflowVisible:L=!1,renderMuteButton:z,browserMediaControlsBehavior:Q,overrideInternalClassName:G,logLevel:V="info",noSuspense:K,acknowledgeRemotionLicense:de,audioLatencyHint:ve="playback",sampleRate:ue=48e3,volumePersistenceKey:se,initialVolume:ee,...X},J)=>{if(typeof window<"u"&&(window.remotion_isPlayer=!0),X.defaultProps!==void 0)throw new Error("The <Player /> component does not accept `defaultProps`, but some were passed. Use `inputProps` instead.");const ie=NR(X);if((ie==null?void 0:ie.type)===Al)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(ie===Al)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(()=>jR(!!de,V));const Fe=pe.useLazyComponent({compProps:X,componentName:"Player",noSuspense:!!K});_R({initialFrame:P,durationInFrames:e});const[Ee,be]=d.useState(()=>({[Op]:P??0})),[Me,xe]=d.useState(!1),[Te]=d.useState("player-comp"),je=d.useRef(null),Ce=d.useRef([]),Le=d.useRef(!1),[Rt,Lt]=d.useState(v);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(ng(t,"compositionHeight","of the <Player /> component"),ng(n,"compositionWidth","of the <Player /> component"),$R(e,{component:"of the <Player/> component",allowFloats:!1}),MR(r,"as a prop of the <Player/> component",!1),AR(o,"inputProps",null),PR({durationInFrames:e,inFrame:N,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 u!="boolean"&&typeof u<"u")throw new TypeError(`'showVolumeControls' must be a boolean or undefined but got '${typeof u}' 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 ue!="number"||!Number.isFinite(ue)||Number.isNaN(ue)||ue<=0||ue%1!==0)throw new TypeError(`'sampleRate' must be a positive integer but got '${ue}' instead`);if(typeof ee<"u"&&typeof ee!="number")throw new TypeError(`'initialVolume' must be a number or undefined but got '${typeof ee}' instead`);if(typeof ee=="number"&&(!Number.isFinite(ee)||Number.isNaN(ee)||ee<0||ee>1))throw new TypeError(`'initialVolume' must be between 0 and 1 but got '${ee}' instead`);if(typeof g!="number"||g%1!==0||!Number.isFinite(g)||Number.isNaN(g)||g<0)throw new TypeError(`'numberOfSharedAudioTags' must be an integer but got '${g}' instead`);FR(Rt),d.useEffect(()=>{Lt(v)},[v]),d.useImperativeHandle(J,()=>je.current,[]),d.useState(()=>{pe.playbackLogging({logLevel:V,message:`[player] Mounting <Player>. User agent = ${typeof navigator>"u"?"server":navigator.userAgent}`,tag:"player",mountTime:Date.now()})});const pn=d.useMemo(()=>({frame:Ee,playing:Me,rootId:Te,imperativePlaying:Le,audioAndVideoTags:Ce}),[Ee,Me,Te]),zt=d.useMemo(()=>({playbackRate:Rt,setPlaybackRate:Lt}),[Rt]),In=d.useMemo(()=>({setFrame:be,setPlaying:xe}),[be]);typeof window<"u"&&d.useLayoutEffect(()=>{pe.CSSUtils.injectCSS(pe.CSSUtils.makeDefaultPreviewCSS(`.${Dp(G)}`,"#fff"))},[G]);const Tn=d.useMemo(()=>o??{},[o]),He=d.useMemo(()=>Q??{mode:"prevent-media-session"},[Q]);return c.jsx(pe.IsPlayerContextProvider,{children:c.jsx(Zx,{timelineContext:pn,playbackRateContext:zt,component:Fe,compositionHeight:t,compositionWidth:n,durationInFrames:e,fps:r,numberOfSharedAudioTags:g,initiallyMuted:A,logLevel:V,audioLatencyHint:ve,sampleRate:ue,volumePersistenceKey:se,initialVolume:ee,inputProps:Tn,audioEnabled:!0,children:c.jsx(pe.SetTimelineContext.Provider,{value:In,children:c.jsx(PT,{currentPlaybackRate:Rt,children:c.jsx(IR,{ref:je,posterFillMode:D,renderLoading:y,autoPlay:!!l,loop:!!a,controls:!!s,errorFallback:k,style:i,inputProps:Tn,allowFullscreen:!!f,moveToBeginningWhenEnded:!!w,clickToPlay:typeof p=="boolean"?p:!!s,showVolumeControls:!!u,doubleClickToFullscreen:!!h,spaceKeyToPlayOrPause:!!m,playbackRate:Rt,className:x??void 0,showPosterWhenUnplayed:!!b,showPosterWhenEnded:!!S,showPosterWhenPaused:!!E,showPosterWhenBuffering:!!T,showPosterWhenBufferingAndPaused:!!R,renderPoster:$,inFrame:N??null,outFrame:W??null,initiallyShowControls:j??!0,renderFullscreen:_??null,renderPlayPauseButton:H??null,renderMuteButton:z??null,renderVolumeSlider:O??null,renderCustomControls:I??null,alwaysShowControls:C,showPlaybackRateControl:M,bufferStateDelayInMilliseconds:B??300,hideControlsWhenPointerDoesntMove:Z,overflowVisible:L,browserMediaControlsBehavior:He,overrideInternalClassName:G??void 0,noSuspense:!!K})})})})})},zR=d.forwardRef,DR=zR(LR),OR=()=>{const e=d.useContext(Bx);if(!e)throw new TypeError("Expected Player event emitter context");return d.useMemo(()=>({emitter:e}),[e])},sf=oe.version.split(".")[0];if(sf==="0")throw new Error(`Version ${sf} of "react" is not supported by Remotion`);var BR=parseInt(sf,10)>=18,WR=({style:e,inputProps:t,errorFallback:n,renderLoading:r,className:o,overflowVisible:i,noSuspense:s,overrideInternalClassName:a},l)=>{const u=pe.useUnsafeVideoConfig(),f=pe.useVideo(),p=d.useRef(null),h=zp(p,{triggerOnWindowResize:!1,shouldApplyCssTransforms:!1}),m=d.useMemo(()=>!u||!h?null:Nx({canvasSize:h,compositionHeight:u.height,compositionWidth:u.width,previewSize:"auto"}),[h,u]),w=(m==null?void 0:m.scale)??1,g=OR();Wx(g.emitter),d.useImperativeHandle(l,()=>{const R={getContainerNode:()=>p.current,getScale:()=>w};return Object.assign(g.emitter,R)},[w,g.emitter]);const k=f?f.component:null,v=d.useMemo(()=>Lx({config:u,style:e,canvasSize:h,overflowVisible:i,layout:m}),[h,u,m,i,e]),y=d.useMemo(()=>Dx({config:u,layout:m,scale:w,overflowVisible:i}),[u,m,i,w]),x=d.useMemo(()=>zx({config:u,layout:m,scale:w,overflowVisible:i}),[u,m,i,w]),b=d.useCallback(R=>{g.emitter.dispatchError(R)},[g.emitter]),S=d.useMemo(()=>r?r({height:v.height,width:v.width,isBuffering:!1}):null,[v.height,v.width,r]),E=d.useMemo(()=>({type:"scale",scale:w}),[w]);if(!u)return null;const T=c.jsx("div",{style:y,children:c.jsx("div",{style:x,className:Dp(a),children:k?c.jsx(Vx,{onError:b,errorFallback:n,children:c.jsx(pe.CurrentScaleContext.Provider,{value:E,children:c.jsx(k,{...(f==null?void 0:f.props)??{},...t??{}})})}):null})});return s||Hx&&!BR?c.jsx("div",{ref:p,style:v,className:o,children:T}):c.jsx("div",{ref:p,style:v,className:o,children:c.jsx(d.Suspense,{fallback:S,children:T})})},VR=d.forwardRef(WR),HR=({frameToDisplay:e,style:t,inputProps:n,compositionHeight:r,compositionWidth:o,durationInFrames:i,fps:s,className:a,errorFallback:l=()=>"⚠️",renderLoading:u,overflowVisible:f=!1,overrideInternalClassName:p,logLevel:h="info",noSuspense:m,...w},g)=>{typeof window<"u"&&d.useLayoutEffect(()=>{window.remotion_isPlayer=!0},[]);const[k]=d.useState(()=>String(Eo(null))),v=d.useRef(null),y=d.useMemo(()=>({playing:!1,frame:{[Op]:e},rootId:k,imperativePlaying:{current:!1},audioAndVideoTags:{current:[]}}),[e,k]),x=d.useMemo(()=>({playbackRate:1,setPlaybackRate:()=>{throw new Error("thumbnail")}}),[]);d.useImperativeHandle(g,()=>v.current,[]);const b=pe.useLazyComponent({compProps:w,componentName:"Thumbnail",noSuspense:!!m}),[S]=d.useState(()=>new jT),E=d.useMemo(()=>n??{},[n]);return c.jsx(pe.IsPlayerContextProvider,{children:c.jsx(Zx,{timelineContext:y,playbackRateContext:x,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:c.jsx(Bx.Provider,{value:S,children:c.jsx(VR,{ref:v,className:a,errorFallback:l,inputProps:E,renderLoading:u,style:t,overflowVisible:f,overrideInternalClassName:p,noSuspense:!!m})})})})},UR=d.forwardRef;UR(HR);const di=[1,1.5,2,4];function rg(e){return di.find(t=>t>e+1e-9)??di[di.length-1]}function ZR(e,t){switch(t){case"L":return e.playing&&e.rate>0?{rate:rg(e.rate),playing:!0}:{rate:di[0],playing:!0};case"J":return e.playing&&e.rate<0?{rate:-rg(-e.rate),playing:!0}:{rate:-di[0],playing:!0};case"K":return{rate:di[0],playing:!e.playing}}}function Bp(e,t,n){const r=Math.round(e*n),o=Math.round(t*n);return{from:r,durationInFrames:Math.max(1,o-r)}}function KR(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 YR(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],u=l?e[a].srcIn-l.srcOut:0;a>0&&u>=r&&(s=!s);const f=t?t.allowed[a]!==!1:!0;i.push(s&&f?o:1)}return i}const GR=({src:e,spans:t,punchInScale:n=1.07,punch:r=null,punchThresholdSec:o=.15,audioFadeSec:i=.01,background:s="black"})=>{const{fps:a}=ct(),l=d.useMemo(()=>YR(t,r,n,o),[t,r,n,o]),u=Math.max(1,Math.round(i*a));return c.jsx(Dn,{style:{backgroundColor:s},children:t.map((f,p)=>{const{from:h,durationInFrames:m}=Bp(f.outIn,f.outOut,a);return c.jsx(Tt,{from:h,durationInFrames:m,premountFor:a,children:c.jsx(Dn,{style:{transform:`scale(${l[p]})`},children:c.jsx(Mx,{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:w=>Math.max(0,Math.min(1,(w+1)/u,(m-w)/u))})})},p)})})};function Y(e,t,n){function r(a,l){var u;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(u=a._zod).traits??(u.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 u=n!=null&&n.Parent?new i:this;r(u,a),(l=u._zod).deferred??(l.deferred=[]);for(const f of u._zod.deferred)f();return u}return Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>{var l,u;return n!=null&&n.Parent&&a instanceof n.Parent?!0:(u=(l=a==null?void 0:a._zod)==null?void 0:l.traits)==null?void 0:u.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}class Ls extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const Kx={};function Vr(e){return Kx}function XR(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 qR(e,t){return typeof t=="bigint"?t.toString():t}function Yx(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Wp(e){return e==null}function Vp(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function QR(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 Ge(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 Hp(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Xi(e){return JSON.stringify(e)}const Gx=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function af(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const JR=Yx(()=>{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 Bl(e){if(af(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(af(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}const ej=new Set(["string","number","symbol"]);function Nu(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ro(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 he(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 tj(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const nj={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 rj(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 Ro(e,{...e._zod.def,shape:n,checks:[]})}function oj(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 Ro(e,{...e._zod.def,shape:n,checks:[]})}function ij(e,t){if(!Bl(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 Hp(this,"shape",r),r},checks:[]};return Ro(e,n)}function sj(e,t){return Ro(e,{...e._zod.def,get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return Hp(this,"shape",n),n},catchall:t._zod.def.catchall,checks:[]})}function aj(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 Ro(t,{...t._zod.def,shape:o,checks:[]})}function lj(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 Ro(t,{...t._zod.def,shape:o,checks:[]})}function hs(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 lo(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Ma(e){return typeof e=="string"?e:e==null?void 0:e.message}function Hr(e,t,n){var o,i,s,a,l,u;const r={...e,path:e.path??[]};if(!e.message){const f=Ma((s=(i=(o=e.inst)==null?void 0:o._zod.def)==null?void 0:i.error)==null?void 0:s.call(i,e))??Ma((a=t==null?void 0:t.error)==null?void 0:a.call(t,e))??Ma((l=n.customError)==null?void 0:l.call(n,e))??Ma((u=n.localeError)==null?void 0:u.call(n,e))??"Invalid input";r.message=f}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function Up(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function zs(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const Xx=(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,qR,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},qx=Y("$ZodError",Xx),Qx=Y("$ZodError",Xx,{Parent:Error});function uj(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 cj(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 u=s.path[l];l===s.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(n(s))):a[u]=a[u]||{_errors:[]},a=a[u],l++}}};return o(e),r}const dj=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 Ls;if(s.issues.length){const a=new((o==null?void 0:o.Err)??e)(s.issues.map(l=>Hr(l,i,Vr())));throw Gx(a,o==null?void 0:o.callee),a}return s.value},fj=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=>Hr(l,i,Vr())));throw Gx(a,o==null?void 0:o.callee),a}return s.value},Jx=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 Ls;return i.issues.length?{success:!1,error:new(e??qx)(i.issues.map(s=>Hr(s,o,Vr())))}:{success:!0,data:i.value}},pj=Jx(Qx),e1=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=>Hr(s,o,Vr())))}:{success:!0,data:i.value}},hj=e1(Qx),mj=/^[cC][^\s-]{8,}$/,gj=/^[0-9a-z]+$/,vj=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,yj=/^[0-9a-vA-V]{20}$/,wj=/^[A-Za-z0-9]{27}$/,xj=/^[a-zA-Z0-9_-]{21}$/,bj=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Sj=/^([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})$/,og=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)$/,kj=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ej="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Cj(){return new RegExp(Ej,"u")}const Ij=/^(?:(?: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])$/,Tj=/^(([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})$/,Rj=/^((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])$/,jj=/^(([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])$/,Pj=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,t1=/^[A-Za-z0-9_-]*$/,_j=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,Fj=/^\+(?:[0-9]){6,14}[0-9]$/,n1="(?:(?:\\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])))",Mj=new RegExp(`^${n1}$`);function r1(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 $j(e){return new RegExp(`^${r1(e)}$`)}function Aj(e){const t=r1({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(`^${n1}T(?:${r})$`)}const Nj=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}$`)},Lj=/^\d+$/,zj=/^-?\d+(?:\.\d+)?/i,Dj=/true|false/i,Oj=/^[^A-Z]*$/,Bj=/^[^a-z]*$/,Jt=Y("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),o1={number:"number",bigint:"bigint",object:"date"},i1=Y("$ZodCheckLessThan",(e,t)=>{Jt.init(e,t);const n=o1[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})}}),s1=Y("$ZodCheckGreaterThan",(e,t)=>{Jt.init(e,t);const n=o1[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})}}),Wj=Y("$ZodCheckMultipleOf",(e,t)=>{Jt.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):QR(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})}}),Vj=Y("$ZodCheckNumberFormat",(e,t)=>{var s;Jt.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]=nj[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=Lj)}),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})}}),Hj=Y("$ZodCheckMaxLength",(e,t)=>{var n;Jt.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Wp(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=Up(o);r.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Uj=Y("$ZodCheckMinLength",(e,t)=>{var n;Jt.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Wp(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=Up(o);r.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Zj=Y("$ZodCheckLengthEquals",(e,t)=>{var n;Jt.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Wp(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=Up(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})}}),Lu=Y("$ZodCheckStringFormat",(e,t)=>{var n,r;Jt.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=()=>{})}),Kj=Y("$ZodCheckRegex",(e,t)=>{Lu.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})}}),Yj=Y("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Oj),Lu.init(e,t)}),Gj=Y("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Bj),Lu.init(e,t)}),Xj=Y("$ZodCheckIncludes",(e,t)=>{Jt.init(e,t);const n=Nu(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})}}),qj=Y("$ZodCheckStartsWith",(e,t)=>{Jt.init(e,t);const n=new RegExp(`^${Nu(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})}}),Qj=Y("$ZodCheckEndsWith",(e,t)=>{Jt.init(e,t);const n=new RegExp(`.*${Nu(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})}}),Jj=Y("$ZodCheckOverwrite",(e,t)=>{Jt.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class eP{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 tP={major:4,minor:0,patch:0},tt=Y("$ZodType",(e,t)=>{var o;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=tP;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 u=hs(s),f;for(const p of a){if(p._zod.def.when){if(!p._zod.def.when(s))continue}else if(u)continue;const h=s.issues.length,m=p._zod.check(s);if(m instanceof Promise&&(l==null?void 0:l.async)===!1)throw new Ls;if(f||m instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await m,s.issues.length!==h&&(u||(u=hs(s,h)))});else{if(s.issues.length===h)continue;u||(u=hs(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 Ls;return l.then(u=>i(u,r,a))}return i(l,r,a)}}e["~standard"]={validate:i=>{var s;try{const a=pj(e,i);return a.success?{value:a.data}:{issues:(s=a.error)==null?void 0:s.issues}}catch{return hj(e,i).then(l=>{var u;return l.success?{value:l.data}:{issues:(u=l.error)==null?void 0:u.issues}})}},vendor:"zod",version:1}}),Zp=Y("$ZodString",(e,t)=>{var n;tt.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??Nj(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}}),Xe=Y("$ZodStringFormat",(e,t)=>{Lu.init(e,t),Zp.init(e,t)}),nP=Y("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Sj),Xe.init(e,t)}),rP=Y("$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=og(r))}else t.pattern??(t.pattern=og());Xe.init(e,t)}),oP=Y("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=kj),Xe.init(e,t)}),iP=Y("$ZodURL",(e,t)=>{Xe.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:_j.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})}}}),sP=Y("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Cj()),Xe.init(e,t)}),aP=Y("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=xj),Xe.init(e,t)}),lP=Y("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=mj),Xe.init(e,t)}),uP=Y("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=gj),Xe.init(e,t)}),cP=Y("$ZodULID",(e,t)=>{t.pattern??(t.pattern=vj),Xe.init(e,t)}),dP=Y("$ZodXID",(e,t)=>{t.pattern??(t.pattern=yj),Xe.init(e,t)}),fP=Y("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=wj),Xe.init(e,t)}),pP=Y("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Aj(t)),Xe.init(e,t)}),hP=Y("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Mj),Xe.init(e,t)}),mP=Y("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=$j(t)),Xe.init(e,t)}),gP=Y("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=bj),Xe.init(e,t)}),vP=Y("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Ij),Xe.init(e,t),e._zod.onattach.push(n=>{const r=n._zod.bag;r.format="ipv4"})}),yP=Y("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Tj),Xe.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})}}}),wP=Y("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Rj),Xe.init(e,t)}),xP=Y("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=jj),Xe.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 a1(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const bP=Y("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Pj),Xe.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64"}),e._zod.check=n=>{a1(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function SP(e){if(!t1.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return a1(n)}const kP=Y("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=t1),Xe.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64url"}),e._zod.check=n=>{SP(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),EP=Y("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Fj),Xe.init(e,t)});function CP(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 IP=Y("$ZodJWT",(e,t)=>{Xe.init(e,t),e._zod.check=n=>{CP(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),l1=Y("$ZodNumber",(e,t)=>{tt.init(e,t),e._zod.pattern=e._zod.bag.pattern??zj,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}}),TP=Y("$ZodNumber",(e,t)=>{Vj.init(e,t),l1.init(e,t)}),RP=Y("$ZodBoolean",(e,t)=>{tt.init(e,t),e._zod.pattern=Dj,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}}),jP=Y("$ZodUnknown",(e,t)=>{tt.init(e,t),e._zod.parse=n=>n}),PP=Y("$ZodNever",(e,t)=>{tt.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(...lo(n,e.issues)),t.value[n]=e.value}const _P=Y("$ZodArray",(e,t)=>{tt.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(u=>ig(u,n,s))):ig(l,n,s)}return i.length?Promise.all(i).then(()=>n):n}});function $a(e,t,n){e.issues.length&&t.issues.push(...lo(n,e.issues)),t.value[n]=e.value}function sg(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(...lo(n,e.issues)):e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}const FP=Y("$ZodObject",(e,t)=>{tt.init(e,t);const n=Yx(()=>{const p=Object.keys(t.shape);for(const m of p)if(!(t.shape[m]instanceof tt))throw new Error(`Invalid element at key "${m}": expected a Zod schema`);const h=tj(t.shape);return{shape:t.shape,keys:p,keySet:new Set(p),numKeys:p.length,optionalKeys:new Set(h)}});Ge(e._zod,"propValues",()=>{const p=t.shape,h={};for(const m in p){const w=p[m]._zod;if(w.values){h[m]??(h[m]=new Set);for(const g of w.values)h[m].add(g)}}return h});const r=p=>{const h=new eP(["shape","payload","ctx"]),m=n.value,w=y=>{const x=Xi(y);return`shape[${x}]._zod.run({ value: input[${x}], issues: [] }, ctx)`};h.write("const input = payload.value;");const g=Object.create(null);let k=0;for(const y of m.keys)g[y]=`key_${k++}`;h.write("const newResult = {}");for(const y of m.keys)if(m.optionalKeys.has(y)){const x=g[y];h.write(`const ${x} = ${w(y)};`);const b=Xi(y);h.write(`
137
+ if (${x}.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
+ ${x}.issues.map((iss) => ({
145
+ ...iss,
146
+ path: iss.path ? [${b}, ...iss.path] : [${b}],
147
+ }))
148
+ );
149
+ }
150
+ } else if (${x}.value === undefined) {
151
+ if (${b} in input) newResult[${b}] = undefined;
152
+ } else {
153
+ newResult[${b}] = ${x}.value;
154
+ }
155
+ `)}else{const x=g[y];h.write(`const ${x} = ${w(y)};`),h.write(`
156
+ if (${x}.issues.length) payload.issues = payload.issues.concat(${x}.issues.map(iss => ({
157
+ ...iss,
158
+ path: iss.path ? [${Xi(y)}, ...iss.path] : [${Xi(y)}]
159
+ })));`),h.write(`newResult[${Xi(y)}] = ${x}.value`)}h.write("payload.value = newResult;"),h.write("return payload;");const v=h.compile();return(y,x)=>v(p,y,x)};let o;const i=af,s=!Kx.jitless,l=s&&JR.value,u=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 w=[];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 x=f.shape;for(const b of f.keys){const S=x[b],E=S._zod.run({value:m[b],issues:[]},h),T=S._zod.optin==="optional"&&S._zod.optout==="optional";E instanceof Promise?w.push(E.then(R=>T?sg(R,p,b,m):$a(R,p,b))):T?sg(E,p,b,m):$a(E,p,b)}}if(!u)return w.length?Promise.all(w).then(()=>p):p;const g=[],k=f.keySet,v=u._zod,y=v.def.type;for(const x of Object.keys(m)){if(k.has(x))continue;if(y==="never"){g.push(x);continue}const b=v.run({value:m[x],issues:[]},h);b instanceof Promise?w.push(b.then(S=>$a(S,p,x))):$a(b,p,x)}return g.length&&p.issues.push({code:"unrecognized_keys",keys:g,input:m,inst:e}),w.length?Promise.all(w).then(()=>p):p}});function ag(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=>Hr(i,r,Vr())))}),t}const MP=Y("$ZodUnion",(e,t)=>{tt.init(e,t),Ge(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),Ge(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),Ge(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),Ge(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=>Vp(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=>ag(s,n,e,r)):ag(i,n,e,r)}}),$P=Y("$ZodIntersection",(e,t)=>{tt.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,u])=>lg(n,l,u)):lg(n,i,s)}});function lf(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(Bl(e)&&Bl(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=lf(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=lf(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 lg(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),hs(e))return e;const r=lf(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 AP=Y("$ZodRecord",(e,t)=>{tt.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Bl(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 u=t.valueType._zod.run({value:o[l],issues:[]},r);u instanceof Promise?i.push(u.then(f=>{f.issues.length&&n.issues.push(...lo(l,f.issues)),n.value[l]=f.value})):(u.issues.length&&n.issues.push(...lo(l,u.issues)),n.value[l]=u.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(u=>Hr(u,r,Vr())),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(u=>{u.issues.length&&n.issues.push(...lo(s,u.issues)),n.value[a.value]=u.value})):(l.issues.length&&n.issues.push(...lo(s,l.issues)),n.value[a.value]=l.value)}}return i.length?Promise.all(i).then(()=>n):n}}),NP=Y("$ZodEnum",(e,t)=>{tt.init(e,t);const n=XR(t.entries);e._zod.values=new Set(n),e._zod.pattern=new RegExp(`^(${n.filter(r=>ej.has(typeof r)).map(r=>typeof r=="string"?Nu(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}}),LP=Y("$ZodTransform",(e,t)=>{tt.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 Ls;return n.value=o,n}}),zP=Y("$ZodOptional",(e,t)=>{tt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Ge(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Ge(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Vp(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)}),DP=Y("$ZodNullable",(e,t)=>{tt.init(e,t),Ge(e._zod,"optin",()=>t.innerType._zod.optin),Ge(e._zod,"optout",()=>t.innerType._zod.optout),Ge(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Vp(n.source)}|null)$`):void 0}),Ge(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)}),OP=Y("$ZodDefault",(e,t)=>{tt.init(e,t),e._zod.optin="optional",Ge(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=>ug(i,t)):ug(o,t)}});function ug(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const BP=Y("$ZodPrefault",(e,t)=>{tt.init(e,t),e._zod.optin="optional",Ge(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))}),WP=Y("$ZodNonOptional",(e,t)=>{tt.init(e,t),Ge(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=>cg(i,e)):cg(o,e)}});function cg(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 VP=Y("$ZodCatch",(e,t)=>{tt.init(e,t),e._zod.optin="optional",Ge(e._zod,"optout",()=>t.innerType._zod.optout),Ge(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=>Hr(s,r,Vr()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(i=>Hr(i,r,Vr()))},input:n.value}),n.issues=[]),n)}}),HP=Y("$ZodPipe",(e,t)=>{tt.init(e,t),Ge(e._zod,"values",()=>t.in._zod.values),Ge(e._zod,"optin",()=>t.in._zod.optin),Ge(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=>dg(i,t,r)):dg(o,t,r)}});function dg(e,t,n){return hs(e)?e:t.out._zod.run({value:e.value,issues:e.issues},n)}const UP=Y("$ZodReadonly",(e,t)=>{tt.init(e,t),Ge(e._zod,"propValues",()=>t.innerType._zod.propValues),Ge(e._zod,"values",()=>t.innerType._zod.values),Ge(e._zod,"optin",()=>t.innerType._zod.optin),Ge(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(fg):fg(o)}});function fg(e){return e.value=Object.freeze(e.value),e}const ZP=Y("$ZodCustom",(e,t)=>{Jt.init(e,t),tt.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=>pg(i,n,r,e));pg(o,n,r,e)}});function pg(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(zs(o))}}class KP{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 YP(){return new KP}const Aa=YP();function GP(e,t){return new e({type:"string",...he(t)})}function XP(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...he(t)})}function hg(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...he(t)})}function qP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...he(t)})}function QP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...he(t)})}function JP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...he(t)})}function e_(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...he(t)})}function t_(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...he(t)})}function n_(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...he(t)})}function r_(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...he(t)})}function o_(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...he(t)})}function i_(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...he(t)})}function s_(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...he(t)})}function a_(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...he(t)})}function l_(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...he(t)})}function u_(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...he(t)})}function c_(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...he(t)})}function d_(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...he(t)})}function f_(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...he(t)})}function p_(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...he(t)})}function h_(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...he(t)})}function m_(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...he(t)})}function g_(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...he(t)})}function v_(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...he(t)})}function y_(e,t){return new e({type:"string",format:"date",check:"string_format",...he(t)})}function w_(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...he(t)})}function x_(e,t){return new e({type:"string",format:"duration",check:"string_format",...he(t)})}function b_(e,t){return new e({type:"number",checks:[],...he(t)})}function S_(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...he(t)})}function k_(e,t){return new e({type:"boolean",...he(t)})}function E_(e){return new e({type:"unknown"})}function C_(e,t){return new e({type:"never",...he(t)})}function mg(e,t){return new i1({check:"less_than",...he(t),value:e,inclusive:!1})}function jc(e,t){return new i1({check:"less_than",...he(t),value:e,inclusive:!0})}function gg(e,t){return new s1({check:"greater_than",...he(t),value:e,inclusive:!1})}function Pc(e,t){return new s1({check:"greater_than",...he(t),value:e,inclusive:!0})}function vg(e,t){return new Wj({check:"multiple_of",...he(t),value:e})}function u1(e,t){return new Hj({check:"max_length",...he(t),maximum:e})}function Wl(e,t){return new Uj({check:"min_length",...he(t),minimum:e})}function c1(e,t){return new Zj({check:"length_equals",...he(t),length:e})}function I_(e,t){return new Kj({check:"string_format",format:"regex",...he(t),pattern:e})}function T_(e){return new Yj({check:"string_format",format:"lowercase",...he(e)})}function R_(e){return new Gj({check:"string_format",format:"uppercase",...he(e)})}function j_(e,t){return new Xj({check:"string_format",format:"includes",...he(t),includes:e})}function P_(e,t){return new qj({check:"string_format",format:"starts_with",...he(t),prefix:e})}function __(e,t){return new Qj({check:"string_format",format:"ends_with",...he(t),suffix:e})}function oa(e){return new Jj({check:"overwrite",tx:e})}function F_(e){return oa(t=>t.normalize(e))}function M_(){return oa(e=>e.trim())}function $_(){return oa(e=>e.toLowerCase())}function A_(){return oa(e=>e.toUpperCase())}function N_(e,t,n){return new e({type:"array",element:t,...he(n)})}function L_(e,t,n){return new e({type:"custom",check:"custom",fn:t,...he(n)})}const z_=Y("ZodISODateTime",(e,t)=>{pP.init(e,t),nt.init(e,t)});function D_(e){return v_(z_,e)}const O_=Y("ZodISODate",(e,t)=>{hP.init(e,t),nt.init(e,t)});function B_(e){return y_(O_,e)}const W_=Y("ZodISOTime",(e,t)=>{mP.init(e,t),nt.init(e,t)});function V_(e){return w_(W_,e)}const H_=Y("ZodISODuration",(e,t)=>{gP.init(e,t),nt.init(e,t)});function U_(e){return x_(H_,e)}const Z_=(e,t)=>{qx.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>cj(e,n)},flatten:{value:n=>uj(e,n)},addIssue:{value:n=>e.issues.push(n)},addIssues:{value:n=>e.issues.push(...n)},isEmpty:{get(){return e.issues.length===0}}})},zu=Y("ZodError",Z_,{Parent:Error}),K_=dj(zu),Y_=fj(zu),G_=Jx(zu),X_=e1(zu),lt=Y("ZodType",(e,t)=>(tt.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)=>Ro(e,n,r),e.brand=()=>e,e.register=(n,r)=>(n.add(e,r),e),e.parse=(n,r)=>K_(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>G_(e,n,r),e.parseAsync=async(n,r)=>Y_(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>X_(e,n,r),e.spa=e.safeParseAsync,e.refine=(n,r)=>e.check(BF(n,r)),e.superRefine=n=>e.check(WF(n)),e.overwrite=n=>e.check(oa(n)),e.optional=()=>xg(e),e.nullable=()=>bg(e),e.nullish=()=>xg(bg(e)),e.nonoptional=n=>MF(e,n),e.array=()=>Qn(e),e.or=n=>p1([e,n]),e.and=n=>EF(e,n),e.transform=n=>Sg(e,TF(n)),e.default=n=>PF(e,n),e.prefault=n=>FF(e,n),e.catch=n=>AF(e,n),e.pipe=n=>Sg(e,n),e.readonly=()=>zF(e),e.describe=n=>{const r=e.clone();return Aa.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=Aa.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Aa.get(e);const r=e.clone();return Aa.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),d1=Y("_ZodString",(e,t)=>{Zp.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(I_(...r)),e.includes=(...r)=>e.check(j_(...r)),e.startsWith=(...r)=>e.check(P_(...r)),e.endsWith=(...r)=>e.check(__(...r)),e.min=(...r)=>e.check(Wl(...r)),e.max=(...r)=>e.check(u1(...r)),e.length=(...r)=>e.check(c1(...r)),e.nonempty=(...r)=>e.check(Wl(1,...r)),e.lowercase=r=>e.check(T_(r)),e.uppercase=r=>e.check(R_(r)),e.trim=()=>e.check(M_()),e.normalize=(...r)=>e.check(F_(...r)),e.toLowerCase=()=>e.check($_()),e.toUpperCase=()=>e.check(A_())}),q_=Y("ZodString",(e,t)=>{Zp.init(e,t),d1.init(e,t),e.email=n=>e.check(XP(Q_,n)),e.url=n=>e.check(t_(J_,n)),e.jwt=n=>e.check(g_(hF,n)),e.emoji=n=>e.check(n_(eF,n)),e.guid=n=>e.check(hg(yg,n)),e.uuid=n=>e.check(qP(Na,n)),e.uuidv4=n=>e.check(QP(Na,n)),e.uuidv6=n=>e.check(JP(Na,n)),e.uuidv7=n=>e.check(e_(Na,n)),e.nanoid=n=>e.check(r_(tF,n)),e.guid=n=>e.check(hg(yg,n)),e.cuid=n=>e.check(o_(nF,n)),e.cuid2=n=>e.check(i_(rF,n)),e.ulid=n=>e.check(s_(oF,n)),e.base64=n=>e.check(p_(dF,n)),e.base64url=n=>e.check(h_(fF,n)),e.xid=n=>e.check(a_(iF,n)),e.ksuid=n=>e.check(l_(sF,n)),e.ipv4=n=>e.check(u_(aF,n)),e.ipv6=n=>e.check(c_(lF,n)),e.cidrv4=n=>e.check(d_(uF,n)),e.cidrv6=n=>e.check(f_(cF,n)),e.e164=n=>e.check(m_(pF,n)),e.datetime=n=>e.check(D_(n)),e.date=n=>e.check(B_(n)),e.time=n=>e.check(V_(n)),e.duration=n=>e.check(U_(n))});function ge(e){return GP(q_,e)}const nt=Y("ZodStringFormat",(e,t)=>{Xe.init(e,t),d1.init(e,t)}),Q_=Y("ZodEmail",(e,t)=>{oP.init(e,t),nt.init(e,t)}),yg=Y("ZodGUID",(e,t)=>{nP.init(e,t),nt.init(e,t)}),Na=Y("ZodUUID",(e,t)=>{rP.init(e,t),nt.init(e,t)}),J_=Y("ZodURL",(e,t)=>{iP.init(e,t),nt.init(e,t)}),eF=Y("ZodEmoji",(e,t)=>{sP.init(e,t),nt.init(e,t)}),tF=Y("ZodNanoID",(e,t)=>{aP.init(e,t),nt.init(e,t)}),nF=Y("ZodCUID",(e,t)=>{lP.init(e,t),nt.init(e,t)}),rF=Y("ZodCUID2",(e,t)=>{uP.init(e,t),nt.init(e,t)}),oF=Y("ZodULID",(e,t)=>{cP.init(e,t),nt.init(e,t)}),iF=Y("ZodXID",(e,t)=>{dP.init(e,t),nt.init(e,t)}),sF=Y("ZodKSUID",(e,t)=>{fP.init(e,t),nt.init(e,t)}),aF=Y("ZodIPv4",(e,t)=>{vP.init(e,t),nt.init(e,t)}),lF=Y("ZodIPv6",(e,t)=>{yP.init(e,t),nt.init(e,t)}),uF=Y("ZodCIDRv4",(e,t)=>{wP.init(e,t),nt.init(e,t)}),cF=Y("ZodCIDRv6",(e,t)=>{xP.init(e,t),nt.init(e,t)}),dF=Y("ZodBase64",(e,t)=>{bP.init(e,t),nt.init(e,t)}),fF=Y("ZodBase64URL",(e,t)=>{kP.init(e,t),nt.init(e,t)}),pF=Y("ZodE164",(e,t)=>{EP.init(e,t),nt.init(e,t)}),hF=Y("ZodJWT",(e,t)=>{IP.init(e,t),nt.init(e,t)}),f1=Y("ZodNumber",(e,t)=>{l1.init(e,t),lt.init(e,t),e.gt=(r,o)=>e.check(gg(r,o)),e.gte=(r,o)=>e.check(Pc(r,o)),e.min=(r,o)=>e.check(Pc(r,o)),e.lt=(r,o)=>e.check(mg(r,o)),e.lte=(r,o)=>e.check(jc(r,o)),e.max=(r,o)=>e.check(jc(r,o)),e.int=r=>e.check(wg(r)),e.safe=r=>e.check(wg(r)),e.positive=r=>e.check(gg(0,r)),e.nonnegative=r=>e.check(Pc(0,r)),e.negative=r=>e.check(mg(0,r)),e.nonpositive=r=>e.check(jc(0,r)),e.multipleOf=(r,o)=>e.check(vg(r,o)),e.step=(r,o)=>e.check(vg(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 we(e){return b_(f1,e)}const mF=Y("ZodNumberFormat",(e,t)=>{TP.init(e,t),f1.init(e,t)});function wg(e){return S_(mF,e)}const gF=Y("ZodBoolean",(e,t)=>{RP.init(e,t),lt.init(e,t)});function Ln(e){return k_(gF,e)}const vF=Y("ZodUnknown",(e,t)=>{jP.init(e,t),lt.init(e,t)});function xi(){return E_(vF)}const yF=Y("ZodNever",(e,t)=>{PP.init(e,t),lt.init(e,t)});function wF(e){return C_(yF,e)}const xF=Y("ZodArray",(e,t)=>{_P.init(e,t),lt.init(e,t),e.element=t.element,e.min=(n,r)=>e.check(Wl(n,r)),e.nonempty=n=>e.check(Wl(1,n)),e.max=(n,r)=>e.check(u1(n,r)),e.length=(n,r)=>e.check(c1(n,r)),e.unwrap=()=>e.element});function Qn(e,t){return N_(xF,e,t)}const bF=Y("ZodObject",(e,t)=>{FP.init(e,t),lt.init(e,t),Ge(e,"shape",()=>t.shape),e.keyof=()=>jo(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:xi()}),e.loose=()=>e.clone({...e._zod.def,catchall:xi()}),e.strict=()=>e.clone({...e._zod.def,catchall:wF()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>ij(e,n),e.merge=n=>sj(e,n),e.pick=n=>rj(e,n),e.omit=n=>oj(e,n),e.partial=(...n)=>aj(h1,e,n[0]),e.required=(...n)=>lj(m1,e,n[0])});function Ie(e,t){const n={type:"object",get shape(){return Hp(this,"shape",{...e}),this.shape},...he(t)};return new bF(n)}const SF=Y("ZodUnion",(e,t)=>{MP.init(e,t),lt.init(e,t),e.options=t.options});function p1(e,t){return new SF({type:"union",options:e,...he(t)})}const kF=Y("ZodIntersection",(e,t)=>{$P.init(e,t),lt.init(e,t)});function EF(e,t){return new kF({type:"intersection",left:e,right:t})}const CF=Y("ZodRecord",(e,t)=>{AP.init(e,t),lt.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function Yn(e,t,n){return new CF({type:"record",keyType:e,valueType:t,...he(n)})}const uf=Y("ZodEnum",(e,t)=>{NP.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 uf({...t,checks:[],...he(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 uf({...t,checks:[],...he(o),entries:i})}});function jo(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new uf({type:"enum",entries:n,...he(t)})}const IF=Y("ZodTransform",(e,t)=>{LP.init(e,t),lt.init(e,t),e._zod.parse=(n,r)=>{n.addIssue=i=>{if(typeof i=="string")n.issues.push(zs(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(zs(s))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function TF(e){return new IF({type:"transform",transform:e})}const h1=Y("ZodOptional",(e,t)=>{zP.init(e,t),lt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function xg(e){return new h1({type:"optional",innerType:e})}const RF=Y("ZodNullable",(e,t)=>{DP.init(e,t),lt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function bg(e){return new RF({type:"nullable",innerType:e})}const jF=Y("ZodDefault",(e,t)=>{OP.init(e,t),lt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function PF(e,t){return new jF({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const _F=Y("ZodPrefault",(e,t)=>{BP.init(e,t),lt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function FF(e,t){return new _F({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const m1=Y("ZodNonOptional",(e,t)=>{WP.init(e,t),lt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function MF(e,t){return new m1({type:"nonoptional",innerType:e,...he(t)})}const $F=Y("ZodCatch",(e,t)=>{VP.init(e,t),lt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function AF(e,t){return new $F({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const NF=Y("ZodPipe",(e,t)=>{HP.init(e,t),lt.init(e,t),e.in=t.in,e.out=t.out});function Sg(e,t){return new NF({type:"pipe",in:e,out:t})}const LF=Y("ZodReadonly",(e,t)=>{UP.init(e,t),lt.init(e,t)});function zF(e){return new LF({type:"readonly",innerType:e})}const DF=Y("ZodCustom",(e,t)=>{ZP.init(e,t),lt.init(e,t)});function OF(e){const t=new Jt({check:"custom"});return t._zod.check=e,t}function BF(e,t={}){return L_(DF,e,t)}function WF(e){const t=OF(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(zs(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(zs(o))}},e(n.value,n)));return t}const Du=jo(["full-bleed","video-top","pip-bubble","graphic-only","blurred-behind","lower-third","split-left","split-right"]),Ou=jo(["TitleCard","StatCard","RuleCard","StrikethroughReveal","FlowDiagram","TerminalMock","ChatMock","ScreenshotFrame","BulletList"]),VF=Ie({startWord:we().int().nonnegative(),endWord:we().int().nonnegative()});Ie({id:ge(),anchor:VF,layout:Du,component:Ou,props:Yn(ge(),xi()),overrides:Yn(ge(),xi()).default({}),rationale:ge().optional()});Ie({id:ge(),kind:jo(["graphic","plain"]).optional(),layout:Du,component:Ou.optional(),props:Yn(ge(),xi()).optional(),startSec:we().nonnegative(),endSec:we().nonnegative(),graphicRect:Ie({x:we(),y:we(),w:we(),h:we()}).optional(),elements:Yn(ge(),Ie({dx:we().optional(),dy:we().optional(),scale:we().positive().optional(),hidden:Ln().optional()})).optional(),video:Ie({scale:we().positive().max(4).optional(),dy:we().optional(),dx:we().optional(),autoZoom:Ln().optional()}).optional(),pip:Ie({cornerRadius:we().min(0).max(1).optional(),x:we().min(0).max(1).optional(),y:we().min(0).max(1).optional()}).optional(),captionY:we().min(0).max(1).optional(),captionScale:we().min(.2).max(3).optional(),pinned:Ln().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'})});Ie({centerYFrac:we().min(0).max(1),sizeFrac:we().min(0).max(1).optional(),centerXFrac:we().min(0).max(1).optional(),sourceAspect:we().positive().optional(),subject:jo(["face","screen"]).optional()});const Kp=Ie({bg:ge().default("#0B0B0E"),fg:ge().default("#FFFFFF"),accent:ge().default("#FFE14D"),muted:ge().default("#9A9AA3"),success:ge().default("#5FBF77"),cardBg:ge().default("#15151B"),cardBorder:ge().default("#2A2A33"),danger:ge().default("#FF5C5C"),radiusPx:we().default(24),fontDisplay:ge().default("'Inter', 'Helvetica Neue', 'Arial Black', Arial, sans-serif"),fontMono:ge().default("'SF Mono', 'Cascadia Code', Consolas, monospace")}),HF=Kp.parse({}),UF=Ie({eyebrow:ge().max(28).optional(),title:ge().min(1).max(48).describe("the claim WITHOUT the emphasis token — never repeat the emphasis here"),emphasis:ge().max(16).optional().describe("the number/punch token pulled OUT of the title (e.g. '861%') — not a duplicate of it"),sub:ge().max(64).optional()}),ZF=Ie({label:ge().min(1).max(28),value:ge().min(1).max(12),caption:ge().max(40).optional(),inverted:Ln().default(!1)}),KF=Ie({kicker:ge().min(1).max(24),text:ge().min(1).max(40),struck:ge().max(40).optional()}),YF=Ie({lines:Qn(Ie({text:ge().min(1).max(32),struck:Ln().default(!1),mark:jo(["none","cross","check"]).default("none")})).min(1).max(4)}),GF=Ie({title:ge().max(28).optional(),items:Qn(ge().min(1).max(36)).min(2).max(5)}),XF=Ie({nodes:Qn(ge().min(1).max(16)).min(2).max(5),emphasizeLast:Ln().default(!0)}),qF=Ie({windows:Qn(Ie({title:ge().max(24),lines:Qn(ge().max(40)).min(1).max(6)})).min(1).max(5),fanOut:ge().max(20).optional()}),QF=Ie({messages:Qn(Ie({from:jo(["user","agent"]),text:ge().min(1).max(60)})).min(1).max(4),keyword:ge().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'.")}),JF=Ie({src:ge().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:ge().max(32).optional(),kenBurns:Ln().default(!0)}),eM={TitleCard:{propsSchema:UF,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:ZF,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:KF,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:YF,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:XF,defaultProps:{nodes:["A","B"]},defaultLayout:"graphic-only",altLayouts:[],whenToUse:"A causal chain or pipeline as chips with arrows (TEAM → AI AGENTS → CHURN)."},TerminalMock:{propsSchema:qF,defaultProps:{windows:[{title:"terminal-01",lines:["$ run"]}]},defaultLayout:"graphic-only",altLayouts:[],whenToUse:"Anything about running code/processes/agents — stylized terminal windows."},ChatMock:{propsSchema:QF,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:JF,defaultProps:{},defaultLayout:"video-top",altLayouts:["blurred-behind"],whenToUse:"Reference to a document/PR/review — a framed screenshot look with a label chip."},BulletList:{propsSchema:GF,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 kg(e,t,n={}){const r=eM[e],o={...r.defaultProps,...t,...n},i=r.propsSchema.safeParse(o);return i.success?i.data:null}const tM=Ie({dx:we().optional(),dy:we().optional(),scale:we().positive().optional(),hidden:Ln().optional()}),g1=Ie({props:Yn(ge(),xi()).default({}),elements:Yn(ge(),tM).default({}),timing:Ie({startSec:we().nonnegative(),endSec:we().nonnegative()}).optional(),component:Ou.optional(),layout:Du.optional(),video:Ie({scale:we().positive().max(4).optional(),dy:we().optional(),dx:we().optional(),autoZoom:Ln().optional()}).optional(),pip:Ie({cornerRadius:we().min(0).max(1).optional(),x:we().min(0).max(1).optional(),y:we().min(0).max(1).optional()}).optional(),captionY:we().min(0).max(1).optional(),captionScale:we().min(.2).max(3).optional(),graphicRect:Ie({x:we().min(0).max(1),y:we().min(0).max(1),w:we().min(.08).max(1),h:we().min(.05).max(1)}).optional(),hidden:Ln().optional()}),nM=Ie({text:ge().min(1).max(80),was:ge()}),rM=Ie({fromKey:ge().regex(/^w\d+$/),toKey:ge().regex(/^w\d+$/),text:ge().min(1).max(400),was:ge()});function Eg(e,t,n){var r;return((r=e[t])==null?void 0:r.was)??n}function Cg(e,t,n,r){var o;return((o=e.find(i=>i.fromKey===t&&i.toKey===n))==null?void 0:o.was)??r}function v1(e){return String(Math.round(e*1e3))}const oM=p1([Ie({at:we().finite().nonnegative(),id:ge().min(1)}),we().finite().nonnegative().transform(e=>({at:e,id:v1(e)}))]);function iM(e,t){const n=v1(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 sM=Ie({theme:Kp.partial().default({}),captionsHidden:Ln().optional(),scenes:Yn(ge(),g1).default({}),captions:Yn(ge(),nM).default({}),captionWordsHidden:Yn(ge(),Ie({was:ge()})).default({}),captionRangeEdits:Qn(rM).default([]),captionLineTiming:Yn(ge(),Ie({lead:we().min(-30).max(30),tail:we().min(-30).max(30)})).default({}),splits:Qn(oM).default([]),cuts:Qn(Ie({startSec:we().nonnegative(),endSec:we().nonnegative(),src:Ie({startSec:we().nonnegative(),endSec:we().nonnegative()}).optional()})).default([])}),aM=()=>sM.parse({});function lM(e,t){return kg(e,{},t)??kg(e,{},{})}function uM(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 cf(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=uM(t.scenes,i.id);if(!s)return i;const a=s.component!==void 0&&s.component!==i.component,l=s.component??i.component,u=s.component!==void 0&&a?lM(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:u,...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 Vl=.3;function Yp(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+Vl&&r.at<=s.endSec-Vl);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 y1(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 cM(e,t){return y1(Yp(e,t.splits),t)}function vn(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 Ds(e){return/^\d+$/.test(e)}function We(e){return!e||!Number.isFinite(e.srcStart)?null:vn(e.srcStart)}const dM=8;function fM(e,t,n){var i,s;if(!Ds(e))return{to:e};const r=Number(e);if(((i=n[r])==null?void 0:i.text)===t.was)return Ig(n[r]);const o=[];for(let a=1;a<=dM;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"}:Ig(n[o[0]])}function Ig(e){const t=We(e);return t===null?{to:null,reason:"unanchorable"}:{to:t}}function pM(e,t){const n=t.flatMap(a=>a.words),r={},o=[],i=Object.entries(e).map(([a,l])=>({key:a,edit:l,legacy:Ds(a),claim:fM(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),u=l.length===1?l[0]:l.find(f=>!f.legacy);if(u===a){r[a.claim.to]=a.edit;continue}o.push({key:a.key,was:a.edit.was,reason:u===void 0?"collision":"superseded"})}return{edits:r,unresolved:o}}function hM(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 mM(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=We(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 gM(e,t,n,r){const o=e.map(l=>l.length+1),i=o.reduce((l,u)=>l+u,0),s=[];let a=t;for(let l=0;l<e.length;l++){const u=(n-t)*o[l]/i,f=l===e.length-1?n:a+u;s.push({text:e[l],start:a,end:f,srcStart:r[l]}),a=f}return s}function vM(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 j=0;j<r.length;j++)for(let _=0;_<r[j].words.length;_++)l.push({line:j,word:_,w:r[j].words[_]});const u=l.findIndex(j=>We(j.w)===s.fromKey);if(o.has(a)||i.has(s.fromKey)){n.push({key:a,expected:s.was,found:u===-1?null:l[u].w.text,reason:"duplicate-anchor"});continue}if(u===-1){n.push({key:a,expected:s.was,found:null});continue}let f=-1;for(let j=u;j<l.length;j++)if(We(l[j].w)===s.toKey){f=j;break}if(f===-1){n.push({key:a,expected:s.was,found:null});continue}const p=l.slice(u,f+1),h=p.map(j=>j.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 j of p){const _=We(j.w);_!==null&&i.add(_)}if(m.length===p.length){const j=new Map(p.map((_,H)=>[`${_.line}:${_.word}`,m[H]]));r=r.map((_,H)=>({..._,words:_.words.map((O,I)=>{const C=j.get(`${H}:${I}`);return C===void 0?O:{...O,text:C}})}));continue}const w=[],g=new Map;for(const j of p){const _=g.get(j.line);_?(_.last=j.word,_.words.push(j.w)):(w.push(j.line),g.set(j.line,{first:j.word,last:j.word,words:[j.w]}))}const k=w.map(j=>g.get(j).words.reduce((_,H)=>_+(H.end-H.start),0)),v=k.reduce((j,_)=>j+_,0),y=v>0?k:k.map(()=>1),x=v>0?v:k.length,b=y.map(j=>m.length*j/x),S=b.map(j=>Math.floor(j));let E=m.length-S.reduce((j,_)=>j+_,0);const T=b.map((j,_)=>({i:_,rem:j-Math.floor(j)})).sort((j,_)=>_.rem-j.rem||j.i-_.i);for(let j=0;E>0;j=(j+1)%T.length)S[T[j].i]++,E--;const R=p[0].w.srcStart,P=p[p.length-1].w.srcStart,$=m.map((j,_)=>m.length===1?R:R+(P-R)*_/(m.length-1));let N=0;const W=[];for(let j=0;j<r.length;j++){const _=r[j],H=g.get(j);if(!H){W.push(_);continue}const O=S[w.indexOf(j)],I=m.slice(N,N+O),C=$.slice(N,N+O);N+=O;const A=O===0?[]:gM(I,H.words[0].start,H.words[H.words.length-1].end,C),M=[..._.words.slice(0,H.first),...A,..._.words.slice(H.last+1)];M.length!==0&&W.push({..._,words:M})}r=W}return{lines:r,dropped:n}}function yM(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=We(h),w=m===null?void 0:t[m];if(m===null||!w){s.push(h);continue}if(r.has(m)){n.push({key:m,expected:w.was,found:h.text,reason:"duplicate-anchor"}),s.push(h);continue}if(r.add(m),h.text!==w.was){n.push({key:m,expected:w.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],u=s[s.length-1],f=l===i.words[0]?i.start:l.start,p=u===a?i.end:Math.max(u.end,u.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 Hl=.05;function wM(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 w1(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=We(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]+Hl),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]-Hl),a)}const u=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:wM(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:u,dropped:n}}function xM(e,t){return Kp.parse({...e,...t.theme})}function Tg(e,t,n,r){const o=e.scenes[t]??g1.parse({});return{...e,scenes:{...e.scenes,[t]:{...o,elements:{...o.elements,[n]:{...o.elements[n],...r}}}}}}function bM(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 SM(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,u=Object.keys(s).length>0?{...r.elements,[n]:s}:l;return{...e,scenes:{...e.scenes,[t]:{...r,elements:u}}}}function kM(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 EM(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 x1(e){const t=e.indexOf("@");return t===-1?e:e.slice(0,t)}const CM=.6;function IM(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 TM(e,t){const n=t.outputDurationSec,r=[...e].sort((f,p)=>f.startSec-p.startSec);if(n<=0)return r;const o=IM(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 w=h[m],g=h[m+1];if(g-w<CM)continue;let k=0;for(let v=0;v<o.length;v++)o[v]<=w+1e-9&&(k=v);a.push({start:w,end:g,clip:k})}}const l=new Map,u=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,...u].sort((f,p)=>f.startSec-p.startSec)}const RM=1.05;function jM(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 PM(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 _M{constructor(t){$e(this,"spans");$e(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 b1(e){return new _M(e.map(t=>({srcIn:t.srcIn,srcOut:t.srcOut,kind:"keep"})))}function Rg(e,t){const n=o=>o.words;if(e.every(o=>n(o).every(i=>i.srcStart!==void 0)))return[...e];const r=b1(t);return e.map(o=>({...o,words:n(o).map(i=>i.srcStart===void 0?{...i,srcStart:r.toSource(i.start)}:i)}))}const FM=/[\p{Script=Arabic}\p{Script=Hebrew}\p{Script=Syriac}\p{Script=Thaana}\p{Script=Nko}]/u,MM=new RegExp("\\p{L}","u");function Gp(e){for(const t of e){if(FM.test(t))return"rtl";if(MM.test(t))return"ltr"}return"ltr"}const Os="Noto Nastaliq Urdu",S1="fonts/NotoNastaliqUrdu-Bold.ttf";function $M(e){return e.some(t=>Gp(t.words.map(n=>n.text).join(" "))==="rtl")}const en={width:1080,height:1920};en.width;en.height;const ia={centerYFrac:.38,sizeFrac:.22},AM=.35,NM=.45,k1=1-1/RM,LM=.4*k1,zM=.6*k1;function E1(e,t,n=en){const r=e.w*n.width,o=e.h*n.height;return Math.max(o,r/(t.sourceAspect??n.width/n.height))}function DM(e,t,n=en){if(t.subject==="screen")return .5;const r=e.h*n.height,o=E1(e,t,n),i=o-r;if(i<=1)return .5;const s=t.sizeFrac??ia.sizeFrac,a=(t.centerYFrac-s/2-AM*s)*o,l=(t.centerYFrac+s/2)*o,u=(a+l)/2-NM*r,f=a-LM*r,p=l+zM*r-r,h=p<=f?Math.min(Math.max(u,p),f):p;return Math.min(1,Math.max(0,h/i))}function OM(e,t,n,r,o=en){if(r.length===0)return e;const i=t.h*o.height,s=E1(t,n,o);if(s-i<=1)return e;const l=i/s,u=1-l;if(u<=0)return e;let f=e*u;for(let p=0;p<r.length+1;p++){const h=r.find(x=>{const b=x.y,S=x.y+x.h,E=f+l,T=b<f&&f<S,R=b<E&&E<S;return T||R});if(!h)break;const m=[],w=h.y+h.h;w<=u&&m.push(w);const g=h.y-l;if(g>=0&&m.push(g),h.h<=l){const x=Math.max(0,h.y+h.h-l),b=Math.min(u,h.y);x<=b&&m.push(Math.min(Math.max(f,x),b))}const k=n.sizeFrac??ia.sizeFrac,v=n.centerYFrac+k/2,y=m.filter(x=>x+l>=v);if(y.length===0)return e;f=y.reduce((x,b)=>Math.abs(b-f)<Math.abs(x-f)?b:x)}return Math.min(1,Math.max(0,f/u))}function BM(e,t,n=en){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 WM={top:.12,bottom:.22,right:.16,left:.04},VM={top:.06,bottom:.12,right:.05,left:.05};function Zn(e=en){return e.width>e.height?VM:WM}function HM(e=en){const t=Zn(e);return{x:t.left,y:t.top,w:1-t.left-t.right,h:1-t.top-t.bottom}}const UM=.08,ZM=.05;function Ul(e,t=en){const n=HM(t),r=1e-9,o=(u,f,p)=>u<f-r?f:u>p+r?p:u,i=o(e.w,UM,n.w),s=o(e.h,ZM,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 jg=.045;function KM(e){return e.width>e.height?44:64}const or={x:0,y:0,w:1,h:1},_c=.3,No={x:.5-_c/2,y:.66,w:_c,h:_c*1080/1920};function yo(e,t=ia,n=[],r=en){const o=a=>OM(DM(a,t,r),a,t,n,r),i=a=>BM(a,t,r),s=r.width>r.height;switch(e){case"full-bleed":return{video:{rect:or,cornerRadius:0,blurPx:0,dim:0,opacity:1,objectPosY:o(or),objectPosX:i(or)},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:or,cornerRadius:0,blurPx:0,dim:0,opacity:1,objectPosY:o(or),objectPosX:i(or)},graphic:a,captionAnchor:s?.62:.49}}case"split-left":case"split-right":{if(s){const l=e==="split-left",u={x:l?0:.5,y:0,w:.5,h:1};return{video:{rect:u,cornerRadius:0,blurPx:0,dim:0,opacity:1,objectPosY:o(u),objectPosX:i(u)},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:No,cornerRadius:1,blurPx:0,dim:0,opacity:1,objectPosY:o(No),objectPosX:i(No)},graphic:{x:.06,y:.14,w:.78,h:.42},captionAnchor:s?.78:.61};case"graphic-only":return{video:{rect:No,cornerRadius:1,blurPx:0,dim:0,opacity:0,objectPosY:o(No),objectPosX:i(No)},graphic:{x:.04,y:.14,w:.8,h:.54},captionAnchor:s?.8:.73};case"blurred-behind":return{video:{rect:or,cornerRadius:0,blurPx:22,dim:.55,opacity:1,objectPosY:o(or),objectPosX:i(or)},graphic:{x:.07,y:.24,w:.77,h:.36},captionAnchor:s?.8:.69}}}const YM={x:.07,y:.24,w:.77,h:.36};function C1(e,t=en){return e.graphicRect?Ul(e.graphicRect,t):yo(e.layout,ia,[],t).graphic??YM}const I1=.35;function Or(e,t){for(const n of e)if(t>=n.startSec&&t<n.endSec)return n;return null}function xn(e,t,n){return e+(t-e)*n}function GM(e,t,n){return{x:xn(e.x,t.x,n),y:xn(e.y,t.y,n),w:xn(e.w,t.w,n),h:xn(e.h,t.h,n)}}function Pg(e,t,n){return{rect:GM(e.rect,t.rect,n),cornerRadius:xn(e.cornerRadius,t.cornerRadius,n),blurPx:xn(e.blurPx,t.blurPx,n),dim:xn(e.dim,t.dim,n),opacity:xn(e.opacity,t.opacity,n),objectPosY:xn(e.objectPosY,t.objectPosY,n),objectPosX:xn(e.objectPosX,t.objectPosX,n)}}function Zl(e){return e*e*(3-2*e)}function T1(e){return e.filter(t=>!(t.kind==="plain"&&t.layout==="full-bleed"))}function Fc(e,t,n,r){const o=yo(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 XM(e,t,n=ia,r=[],o=en){const i=T1(e),s=r.filter(v=>t>=v.startSec&&t<v.endSec),a=yo("full-bleed",n,s,o).video,l=Or(i,t);if(!l)return a;const u=Fc(l,n,s,o),f=Math.min(I1,(l.endSec-l.startSec)/2),p=t-l.startSec,h=l.endSec-t,m=Or(i,l.startSec-.001),w=Or(i,l.endSec+.001),g=m?Fc(m,n,s,o):a,k=w?Fc(w,n,s,o):a;return p<f?Pg(g,u,Zl(p/f)):h<f?Pg(u,k,Zl(1-h/f)):u}function qM(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 Mc(e){return e==="pip-bubble"||e==="graphic-only"?1:0}function QM(e,t){const n=T1(e),r=Or(n,t);if(!r)return 0;const o=Mc(r.layout),i=Math.min(I1,(r.endSec-r.startSec)/2),s=Or(n,r.startSec-.001),a=Or(n,r.endSec+.001),l=s?Mc(s.layout):0,u=a?Mc(a.layout):0,f=t-r.startSec,p=r.endSec-t;return f<i?xn(l,o,Zl(f/i)):p<i?xn(o,u,Zl(1-p/i)):o}function JM(e,t,n){return e.filter(r=>(r.startSec??Number.NEGATIVE_INFINITY)<n&&(r.endSec??Number.POSITIVE_INFINITY)>t)}function e4(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 t4(e,t,n,r=en){const o=yo(e,void 0,[],r),i=Zn(r),s=o.captionAnchor,a=l=>{const u={y:l-jg,h:jg*2};if(u.y<i.top||u.y+u.h>1-i.bottom||e4(u,t)>0)return!1;const f=n??o.graphic;return!(f&&Math.min(u.y+u.h,f.y+f.h)-Math.max(u.y,f.y)>0)};if(a(s))return s;for(let l=.02;l<=.6;l+=.02)for(const u of[s-l,s+l])if(a(u))return u;return s}const n4=.3,r4=.3,o4=.133,Xp=e=>e*(2-e);function R1(e,t=n4,n=r4){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 _g=.4;function i4(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 s4(e,t){return t?e>=t.startSec-_g&&e<=t.endSec+_g:!1}function a4(e,t){return e??KM(t)}function l4(e){return e*10/64}function u4(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 c4(e,t){return e==="rtl"?`'${Os}', ${t}`:t}function d4(e){return e==="rtl"?1.9:1.15}const f4=()=>{const[e]=oe.useState(()=>uE(`load ${Os}`));return oe.useEffect(()=>{let t=!1;const n=()=>{t||(t=!0,cE(e))};return new FontFace(Os,`url("${Np(S1)}") format("truetype")`,{weight:"900"}).load().then(o=>{document.fonts.add(o),n()},n),n},[e]),null},p4=({line:e,wordOffset:t,verticalAnchor:n,fontSizePx:r,activeColor:o,fontFamily:i,textColor:s,ctaKeyword:a,ctaWindow:l})=>{const u=It(),{fps:f,width:p,height:h}=ct(),m=Zn({width:p,height:h}),w=e.start+u/f,g=Gp(e.words.map(k=>k.text).join(" "));return c.jsx(Dn,{style:{pointerEvents:"none"},children:c.jsx("div",{style:{position:"absolute",top:`${n*100}%`,left:0,right:0,transform:"translateY(-50%)",direction:g,display:"flex",justifyContent:"center",gap:"0.28em",flexWrap:"wrap",paddingLeft:`${m.left*100}%`,paddingRight:`${m.right*100}%`,fontFamily:c4(g,i),fontWeight:900,fontSize:r,lineHeight:d4(g),textAlign:"center",color:s,WebkitTextStroke:`${l4(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,v)=>{const y=Math.max(k.end,k.start+.12),x=w>=k.start&&w<=y,b=x?Math.min(1,(w-k.start)/o4):0,S=Xp(b);return c.jsx("span",{"data-caption-word":t+v,"data-caption-text":k.text,"data-caption-src":We(k)===null?void 0:k.srcStart,style:{display:"inline-block",pointerEvents:"auto",transform:S>0?`scale(${1+.08*S})`:"scale(1)",color:x?o:s},children:i4(k.text,s4(k.start,l)?a:void 0)},v)})})})},h4=({lines:e,cues:t=[],verticalAnchor:n=.76,fontSizePx:r,activeColor:o="#FFE14D",theme:i,ctaKeyword:s,ctaWindow:a,sourceTextRegions:l=[]})=>{const{fps:u,width:f,height:p}=ct(),h={width:f,height:p},m=a4(r,h),{fontFamily:w,color:g}=u4(i),k=[];let v=0;for(const y of e)k.push(v),v+=y.words.length;return c.jsxs(Dn,{children:[$M(e)?c.jsx(f4,{}):null,e.map((y,x)=>{const b=t.length>0?Or(t,y.start):null,S=(b==null?void 0:b.captionY)!==void 0?b.captionY:t.length>0||l.length>0?t4((b==null?void 0:b.layout)??"full-bleed",JM(l,y.start,y.end),b==null?void 0:b.graphicRect,h):n,{from:E,durationInFrames:T}=Bp(y.start,y.end,u);return c.jsx(Tt,{from:E,durationInFrames:T,children:c.jsx(p4,{line:y,wordOffset:k[x],verticalAnchor:S,fontSizePx:m*((b==null?void 0:b.captionScale)??1),activeColor:o,fontFamily:w,textColor:g,ctaKeyword:s,ctaWindow:a})},x)})]})};function j1(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),u=Math.max(n.width/a,n.height/l),f=-t.x*u+(n.width-a*u)*Fg(r),p=-t.y*u+(n.height-l*u)*Fg(o);return{width:i*u,height:s*u,left:f,top:p}}function Fg(e){return Number.isFinite(e)?Math.min(1,Math.max(0,e)):.5}function P1(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,u=-t.y*a+(n.height-s*a)/2;return{width:r*a,height:o*a,left:l,top:u}}function m4(e,t){return P1(e,{x:0,y:0,w:e.width,h:e.height},t)}function _1(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 g4(e,t,n,r,o,i){return e==="fit"?P1(t,n,r):j1(t,n,r,o,i)}function v4(e,t,n,r){return e.length===0?{x:0,y:0,w:r.width,h:r.height,full:!0}:PM(e,_1(t,n),r)}function y4(e,t,n){if(e.length===0)return null;const r=_1(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 w4(e,t,n,r,o,i,s,a,l){if(!o)return null;if(e&&e.length>0){const f=y4(e,n,r);if(f)return j1(o,f.window,s,f.bias.x,f.bias.y)}if(!t||t.length<2)return null;const u=v4(t,n,r,o);return u.full?null:g4(i,o,u,s,a,l)}const x4=({cues:e,theme:t,face:n,zoomPlan:r,sourceTextRegions:o,contentTimeline:i,framingTimeline:s,spans:a,sourceSize:l,contentCropMode:u="cover",sourceFit:f="cover",children:p})=>{const h=It(),{fps:m,width:w,height:g}=ct(),k=h/m,y=XM(e,k,n??void 0,o??[],{width:w,height:g}),x=QM(e,k),b=y.rect.w*w,S=y.rect.h*g,E=y.cornerRadius*Math.min(b,S)/2,T=Or(e,k),R=T==null?void 0:T.video,P=r&&r.length>0?jM(r,k):1,$=Math.max(0,y.opacity*(1-.6*y.cornerRadius)),N=(R==null?void 0:R.autoZoom)!==!1,W=f==="contain"&&l!==void 0,j=N&&!W?1+(P-1)*$:1,_=(R==null?void 0:R.scale)??1,H=(R==null?void 0:R.dx)??0,O=(R==null?void 0:R.dy)??0,I=qM(j,_,H,O);return c.jsxs(Dn,{children:[c.jsx(Dn,{style:{background:t.bg,opacity:x}}),c.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:[c.jsx("div",{style:{position:"absolute",inset:0,filter:y.blurPx>.5?`blur(${y.blurPx}px)`:void 0,transform:I,transformOrigin:"50% 40%","--ossclip-obj-y":`${y.objectPosY*100}%`,"--ossclip-obj-x":`${y.objectPosX*100}%`},children:W?c.jsx(b4,{source:l,slot:{width:b,height:S},children:p}):c.jsx(S4,{timeline:i,framing:s,spans:a,sourceSize:l,mode:u,tSec:k,slot:{width:b,height:S},posX:y.objectPosX,posY:y.objectPosY,children:p})}),c.jsx("div",{style:{position:"absolute",inset:0,background:"black",opacity:y.dim}})]})]})},b4=({source:e,slot:t,children:n})=>{const r=m4(e,t);return c.jsx("div",{style:{position:"absolute",width:r.width,height:r.height,left:r.left,top:r.top},children:n})},S4=({timeline:e,framing:t,spans:n,sourceSize:r,mode:o,tSec:i,slot:s,posX:a,posY:l,children:u})=>{const f=w4(t,e,n??[],i,r,o,s,a,l);return f?c.jsx("div",{style:{position:"absolute",width:f.width,height:f.height,left:f.left,top:f.top},children:u}):c.jsx("div",{style:{position:"absolute",inset:0},children:u})},qp=.94,k4=new Set(["FlowDiagram","StrikethroughReveal","ChatMock","BulletList"]),Mg=2.4,La=.45,Bu=.58,Mt=.72,E4=.62;function Bo(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 Ke=e=>typeof e=="string"?e:"",jr=e=>Array.isArray(e)?e:[];function C4(e,t,n,r=1/0){switch(e){case"TitleCard":{const o=n-80,i=Ke(t.emphasis),s=28;let a=0,l=0;Ke(t.eyebrow)&&(a+=34*1.2,l++),i&&(a+=210*.95,l++);const u=i?64:96;return a+=Bo(Ke(t.title).length,u,o,1.05,Mt),l++,Ke(t.sub)&&(a+=Bo(Ke(t.sub).length,40,o,1.2,Bu),l++),a+s*Math.max(0,l-1)}case"StatCard":{const o=Bo(Ke(t.label).length,42,n*.55,1.15,Mt);let i=88+Math.max(o,110*1.15)+4;return Ke(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+=Bo(Ke(t.text).length,72,o,1.02,Mt),Ke(t.struck)&&(i+=26+Bo(Ke(t.struck).length,44,o,1.2,Mt)),i}case"StrikethroughReveal":{const o=jr(t.lines).map(a=>Ke(a==null?void 0:a.text)),i=N1(o,n,r),s=o.reduce((a,l)=>a+A1(l,i,n).length,0);return s*i*1.08+i*.2*Math.max(0,s-1)}case"FlowDiagram":{const o=jr(t.nodes).map(l=>Ke(l)),i=Math.max(1,o.length),{mode:s,fontSize:a}=V1(o,n,r);return s==="row"?a*ms+4:a*(ms*i+W1*(i-1))}case"TerminalMock":{const o=jr(t.windows);let i=0;for(const s of o){const a=jr(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),Ke(t.fanOut)&&(i+=22+40*1.2),i}case"ChatMock":{const o=O1(t).map(s=>s.text),i=B1(o,{widthPx:n,heightPx:r});return D1(o,i,n)}case"ScreenshotFrame":{const o=n*.94;return(Ke(t.src)?o*9/16:480)+4}case"BulletList":{const o=jr(t.items).map(s=>Ke(s)),i=$1(o,n,r,!!Ke(t.title),Ke(t.title));return P4(o.length,i,!!Ke(t.title))}}}const Sr=e=>Ke(e).split(/\s+/).reduce((t,n)=>Math.max(t,n.length),0);function I4(e,t){switch(e){case"RuleCard":{const n=Sr(t.kicker)*30*(Mt+.28),r=Sr(t.text)*72*Mt,o=Sr(t.struck)*44*(Mt+.04),i=Math.max(n,r,o);return i>0?156+i:0}case"TitleCard":{const n=Ke(t.emphasis)?64:96,r=Sr(t.eyebrow)*34*(Mt+.35),o=Sr(t.emphasis)*210*Mt,i=Sr(t.title)*n*(Mt+.02),s=Sr(t.sub)*40*Bu,a=Math.max(r,o,i,s);return a>0?80+a:0}case"TerminalMock":{let n=0;for(const r of jr(t.windows))for(const o of jr(r==null?void 0:r.lines))n=Math.max(n,Ke(o).length);return n>0?108+n*27*E4:0}case"StatCard":{const n=Ke(t.value).length*110*Mt;return n===0?0:164+Sr(t.label)*42*Mt+40+n}default:return 0}}const $g=36,T4=120,F1=1.6,M1=.88,R4=(Mt+.28)*.36,j4=1.1;function P4(e,t,n){return(Math.max(1,e)*F1+(n?M1:0))*t}function $1(e,t=831,n=1/0,r=!1,o=""){const i=e.reduce((l,u)=>Math.max(l,u.length),0);if(i===0)return $g;const s=Math.min(t/(i*Mt+j4),o?t/(o.length*R4):1/0),a=n*qp/(Math.max(1,e.length)*F1+(r?M1:0));return Math.max($g,Math.min(T4,Math.floor(Math.min(s,a))))}const _4=92,F4=44,M4=150,$4=[" → "," -> "," → "," > "];function A1(e,t,n){const r=o=>o.length*t*Mt<=n;if(r(e))return[e];for(const o of $4){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 N1(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*Mt),i=n/(Math.max(1,e.length)*1.28);return Math.max(F4,Math.min(M4,Math.floor(Math.min(o,i))))}const Ag=22,Ng=44,A4=96,Lg=22,L1=.85,z1=.82;function D1(e,t,n){const o=(n-80)*z1-2*t*L1;let i=0;for(const s of e)i+=Bo(s.length,t,o,1.2,Bu)+t*1.2+4;return i+t*.5*Math.max(0,e.length-1)}function O1(e){const t=Ke(e.keyword);return t?[{from:"user",text:`"${t.toUpperCase()}"`}]:jr(e.messages).map(n=>{const r=n??{};return{from:r.from==="agent"?"agent":"user",text:Ke(r.text)}})}function B1(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 Ng;const s=e.flatMap(p=>p.split(/\s+/)).reduce((p,h)=>Math.max(p,h.length),0),a=p=>o*z1/(p*Bu+2*L1),l=Math.min(i,Lg),u=i>Lg?Ng:A4;let f=Math.floor(Math.min(a(l),a(s),u));for(;f>Ag&&D1(e,f,n)>r*qp;)f-=1;return Math.max(Ag,f)}const zg=26,N4=22,L4=76,ms=2.1,W1=2.05;function V1(e,t,n=1/0){const r=e.reduce((g,k)=>g+k.length,0),o=Math.max(1,e.length),i=.78,s=1.6,a=1.8,l=t-20,u=Math.floor(Math.min(l/(i*r+s*o+a*(o-1)),n/ms)),f=Math.max(...e.map(g=>g.length),1),p=ms*o+W1*(o-1),h=Math.floor(Math.min(l/(i*f+s),n/p,L4)),m=u>=zg;return h>=N4?m?u*ms>=h*p?{mode:"row",fontSize:u}:{mode:"stack",fontSize:h}:{mode:"stack",fontSize:h}:{mode:"row",fontSize:Math.max(zg,u)}}function z4(e,t,n){if(k4.has(e))return 1;const r=n.heightPx*qp,o=u=>C4(e,t,n.widthPx/u)*u<=r;if(!o(La))return La;const i=I4(e,t),s=i>0?n.widthPx/i:Mg;let a=La,l=Math.max(La,Math.min(Mg,s));if(l<=a)return a;for(let u=0;u<24;u++){const f=(a+l)/2;o(f)?a=f:l=f}return a}function bt(e=0){const t=It(),{fps:n}=ct();return Yd({frame:t-e,fps:n,config:{damping:200,stiffness:130},durationInFrames:Math.round(n*.5)})}function Gn(e,t=26){return{opacity:e,transform:`translateY(${(1-e)*t}px)`}}function wo(e){return{opacity:e,transform:`scale(${.9+.1*e})`}}function D4(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 ht(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 O4=({props:e,theme:t,edits:n})=>{var l;const r=bt(0),o=bt(5),i=bt(10),s=(l=e.emphasis)==null?void 0:l.trim(),a=!!s&&s.toLowerCase().includes(e.title.trim().toLowerCase());return c.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?c.jsx("div",{"data-edit-id":"eyebrow",style:{...Gn(r),fontSize:34,fontWeight:700,letterSpacing:"0.35em",color:t.muted,textTransform:"uppercase",...ht(n,"eyebrow")},children:e.eyebrow}):null,s?c.jsx("div",{"data-edit-id":"emphasis",style:{...Gn(o,40),fontSize:210,fontWeight:900,lineHeight:.95,...ht(n,"emphasis")},children:s}):null,a?null:c.jsx("div",{"data-edit-id":"title",style:{...Gn(s?i:o,34),fontSize:s?64:96,fontWeight:900,lineHeight:1.05,textTransform:"uppercase",letterSpacing:"0.02em",...ht(n,"title")},children:e.title}),e.sub?c.jsx("div",{"data-edit-id":"sub",style:{...Gn(i),fontSize:40,fontWeight:600,color:t.muted,...ht(n,"sub")},children:e.sub}):null]})},B4=({props:e,theme:t,edits:n})=>{const r=bt(0),o=bt(6),i=e.inverted;return c.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:30,fontFamily:t.fontDisplay,width:"100%",padding:"0 30px"},children:[c.jsxs("div",{style:{...wo(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:[c.jsx("div",{"data-edit-id":"label",style:{fontSize:42,fontWeight:800,textTransform:"uppercase",letterSpacing:"0.06em",lineHeight:1.15,maxWidth:"55%",...ht(n,"label")},children:e.label}),c.jsx("div",{"data-edit-id":"value",style:{fontSize:110,fontWeight:900,whiteSpace:"nowrap",...ht(n,"value")},children:e.value})]}),e.caption?c.jsx("div",{"data-edit-id":"caption",style:{...Gn(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",...ht(n,"caption")},children:e.caption}):null]})},W4=({props:e,theme:t,edits:n})=>{const r=bt(0),o=bt(8);return c.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:26,fontFamily:t.fontDisplay,width:"100%",padding:"0 30px"},children:[c.jsxs("div",{style:{...wo(r),width:"100%",background:t.fg,color:t.bg,borderRadius:t.radiusPx,padding:"40px 48px",textAlign:"left"},children:[c.jsx("div",{"data-edit-id":"kicker",style:{fontSize:30,fontWeight:800,letterSpacing:"0.28em",textTransform:"uppercase",color:"#55555E",marginBottom:14,fontFamily:t.fontMono,...ht(n,"kicker")},children:e.kicker}),c.jsx("div",{"data-edit-id":"text",style:{fontSize:72,fontWeight:900,lineHeight:1.02,textTransform:"uppercase",...ht(n,"text")},children:e.text})]}),e.struck?c.jsx("div",{"data-edit-id":"struck",style:{...Gn(o),fontSize:44,fontWeight:800,color:t.muted,textDecoration:"line-through",textDecorationThickness:6,textDecorationColor:t.danger,textTransform:"uppercase",letterSpacing:"0.04em",...ht(n,"struck")},children:e.struck}):null]})},V4=({text:e,struck:t,mark:n,delay:r,fontSize:o,theme:i,editId:s,edits:a})=>{const l=bt(r),u=bt(r+8);return c.jsxs("div",{"data-edit-id":s,style:{...Gn(l,30),position:"relative",display:"inline-block",...ht(a,s)},children:[c.jsxs("span",{style:{fontSize:o,fontWeight:900,textTransform:"uppercase",lineHeight:1.08,whiteSpace:"nowrap",color:t?i.muted:i.fg},children:[n!=="none"?c.jsx("span",{style:{color:n==="cross"?i.danger:i.success,marginRight:"0.3em"},children:n==="cross"?"✗":"✓"}):null,e]}),t?c.jsx("div",{style:{position:"absolute",left:"-2%",top:"50%",height:o*.11,width:`${u*104}%`,background:i.danger,borderRadius:o*.055,transform:"translateY(-50%) rotate(-2deg)"}}):null]})},H4=({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=N1(i,n,r),a=e.lines.flatMap((l,u)=>A1(l.text,s,n??831).map((f,p)=>({text:f,struck:l.struck,mark:p===0?l.mark??"none":"none",lineIndex:u})));return c.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:s*.2,textAlign:"center",fontFamily:t.fontDisplay},children:a.map((l,u)=>c.jsx(V4,{text:l.text,struck:l.struck,mark:l.mark,delay:u*6,fontSize:s,theme:t,editId:`line-${l.lineIndex}`,edits:o},u))})},U4=({text:e,emphasized:t,delay:n,fontSize:r,theme:o,editId:i,edits:s})=>{const a=bt(n);return c.jsx("div",{"data-edit-id":i,style:{...wo(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,...ht(s,i)},children:e})},Z4=({delay:e,fontSize:t,theme:n,down:r=!1})=>{const o=bt(e);return c.jsx("div",{style:{opacity:o,color:n.muted,fontSize:t*1.15,fontWeight:700,lineHeight:1,paddingLeft:r?0:t*.55},children:r?"↓":"→"})};function K4(e,t=Y4,n){return V1(e,t,n)}const Y4=864,G4=({props:e,theme:t,widthPx:n,heightPx:r,edits:o})=>{const{mode:i,fontSize:s}=K4(e.nodes,n,r),a=i==="row";return c.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,u)=>c.jsxs("div",{style:{display:"flex",flexDirection:a?"row":"column",alignItems:"center",gap:a?s*.55:s*.45},children:[u>0?c.jsx(Z4,{delay:u*6+3,fontSize:s,theme:t,down:!a}):null,c.jsx(U4,{text:l,emphasized:e.emphasizeLast&&u===e.nodes.length-1,delay:u*6,fontSize:s,theme:t,editId:`node-${u}`,edits:o})]},u))})},X4=({title:e,lines:t,delay:n,theme:r,editId:o,edits:i})=>{const s=bt(n);return c.jsxs("div",{"data-edit-id":o,style:{...wo(s),background:r.cardBg,border:`2px solid ${r.cardBorder}`,borderRadius:r.radiusPx/2,overflow:"hidden",width:"100%",fontFamily:r.fontMono,...ht(i,o)},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 20px",borderBottom:`2px solid ${r.cardBorder}`},children:[["#FF5F57","#FEBC2E","#28C840"].map(a=>c.jsx("div",{style:{width:16,height:16,borderRadius:8,background:a}},a)),c.jsx("div",{style:{marginLeft:10,fontSize:24,color:r.muted},children:e})]}),c.jsx("div",{style:{padding:"18px 22px",display:"flex",flexDirection:"column",gap:8},children:t.map((a,l)=>c.jsx("div",{style:{fontSize:27,color:r.fg,whiteSpace:"pre"},children:a},l))})]})},q4=({props:e,theme:t,edits:n})=>{const r=bt(e.windows.length*6+4);return c.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:22,width:"100%",padding:"0 30px"},children:[e.windows.map((o,i)=>c.jsx(X4,{title:o.title,lines:o.lines,delay:i*6,theme:t,editId:`window-${i}`,edits:n},i)),e.fanOut?c.jsxs("div",{"data-edit-id":"fanOut",style:{...Gn(r),fontFamily:t.fontDisplay,fontSize:40,fontWeight:900,letterSpacing:"0.2em",color:t.fg,textTransform:"uppercase",...ht(n,"fanOut")},children:["⌄ ",e.fanOut]}):null]})},Q4=({from:e,text:t,delay:n,fontSize:r,theme:o,editId:i,edits:s})=>{const a=bt(n),l=e==="user";return c.jsx("div",{"data-edit-id":i,style:{...wo(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,...ht(s,i)},children:t})},J4=({props:e,theme:t,widthPx:n,heightPx:r,edits:o})=>{const i=O1(e),s=B1(i.map(a=>a.text),{widthPx:n,heightPx:r});return c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:s*.5,width:"100%",padding:"0 40px"},children:i.map((a,l)=>c.jsx(Q4,{from:a.from,text:a.text,delay:l*8,fontSize:s,theme:t,editId:`message-${l}`,edits:o},l))})},e$=({props:e,theme:t,edits:n})=>{const r=bt(0),o=bt(8),i=It(),{fps:s}=ct(),a=e.kenBurns?Pi(i,[0,s*8],[1,1.08],{extrapolateRight:"clamp"}):1,l=e.src?/^https?:\/\//.test(e.src)?e.src:Np(e.src):null;return c.jsxs("div",{"data-edit-id":"image",style:{...wo(r),position:"relative",width:"94%",...ht(n,"image")},children:[c.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?c.jsx(_p,{src:l,style:{width:"100%",display:"block",transform:`scale(${a})`}}):c.jsx("div",{style:{height:420,display:"flex",flexDirection:"column",gap:14,padding:30,transform:`scale(${a})`},children:[.9,.75,.85,.6,.8,.5].map((u,f)=>c.jsx("div",{style:{height:22,width:`${u*100}%`,borderRadius:6,background:f%3===0?t.cardBorder:"#22222B"}},f))})}),e.label?c.jsx("div",{"data-edit-id":"label",style:{...wo(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",...ht(n,"label")},children:e.label}):null]})},t$=({text:e,index:t,fontSize:n,theme:r,edits:o})=>{const i=`item-${t}`,s=bt(t*7);return c.jsxs("div",{"data-edit-id":i,style:{...Gn(s,26),display:"flex",alignItems:"baseline",gap:n*.35,...ht(o,i)},children:[c.jsx("span",{style:{fontSize:n*.75,color:r.accent,fontWeight:900},children:"▸"}),c.jsx("span",{style:{fontSize:n,fontWeight:900,textTransform:"uppercase",lineHeight:1.15,whiteSpace:"nowrap",color:r.fg},children:e})]})},n$=({props:e,theme:t,widthPx:n,heightPx:r,edits:o})=>{const i=$1(e.items,n,r,!!e.title,e.title),s=bt(0);return c.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:i*.45,fontFamily:t.fontDisplay},children:[e.title?c.jsx("div",{"data-edit-id":"title",style:{...Gn(s,20),fontSize:i*.36,fontWeight:700,letterSpacing:"0.28em",textTransform:"uppercase",color:t.muted,...ht(o,"title")},children:e.title}):null,e.items.map((a,l)=>c.jsx(t$,{text:a,index:l,fontSize:i,theme:t,edits:o},l))]})},r$={TitleCard:O4,StatCard:B4,RuleCard:W4,StrikethroughReveal:H4,FlowDiagram:G4,TerminalMock:q4,ChatMock:J4,ScreenshotFrame:e$,BulletList:n$},o$=new Set(["lower-third","full-bleed"]),i$=.55,s$=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}, ${i$})`},a$=e=>({width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",opacity:e,transform:e<1?`translateY(${(1-e)*18}px)`:void 0}),l$=({durationInFrames:e,children:t})=>{const n=It(),{fps:r}=ct(),{exitSec:o}=R1(e/r),i=(e-n)/r,s=o<=0?1:Math.min(1,Math.max(0,i/o));return c.jsx("div",{style:a$(Xp(s)),children:t})},u$=({durationInFrames:e,themeBg:t,radiusPx:n})=>{const r=It(),{fps:o}=ct(),{enterSec:i}=R1(e/o),s=i<=0?1:Math.min(1,Math.max(0,r/o/i)),a=Xp(s);return c.jsx("div",{style:{position:"absolute",inset:0,background:s$(t),backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)",borderRadius:n,opacity:a,transform:a<1?`translateY(${(1-a)*18}px)`:void 0}})},c$=({cues:e,theme:t})=>{const{fps:n,width:r,height:o}=ct();return c.jsx(Dn,{style:{pointerEvents:"none"},children:e.map(i=>{if(i.kind==="plain"||!i.component||!i.props)return null;const s=C1(i,{width:r,height:o}),a=r$[i.component],{from:l,durationInFrames:u}=Bp(i.startSec,i.endSec,n),f=s.w*r,p=s.h*o,h=o$.has(i.layout),m=h?Math.min(24,Math.round(p*.12)):0,w=f-m*2,g=p-m*2,k=z4(i.component,i.props,{widthPx:w,heightPx:g});return c.jsx(Tt,{from:l,durationInFrames:u,children:c.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:c.jsxs(l$,{durationInFrames:u,children:[h?c.jsx(u$,{durationInFrames:u,themeBg:t.bg,radiusPx:t.radiusPx}):null,c.jsx("div",{style:{width:w/k,transform:`scale(${k})`,position:"relative"},children:c.jsx(a,{props:i.props,theme:t,widthPx:w/k,heightPx:g/k,edits:D4(i.elements,k)})})]})})},i.id)})})},d$="made with ossclip",f$=.45,p$=.024;function h$(e=en){const t=Zn(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)*p$),opacity:f$,text:d$}}function m$(e){return e===!0}const g$=({theme:e,frame:t})=>{const n=h$(t);return c.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 v$(e){return e!==!0}const y$=({videoFileName:e,spans:t,captionLines:n,sceneCues:r,theme:o,settings:i,face:s,zoomPlan:a,ctaKeyword:l,ctaWindow:u,sourceTextRegions:f,contentTimeline:p,framingTimeline:h,sourceSize:m,contentCropMode:w,sourceFit:g,watermark:k,captionsHidden:v,staticCamera:y,punch:x})=>{if(!e)return c.jsx(Dn,{style:{backgroundColor:"#111",color:"#888",alignItems:"center",justifyContent:"center",fontFamily:"monospace",fontSize:40},children:"no production loaded"});const b=/^https?:\/\//.test(e)?e:Np(e),S=g==="contain"||y===!0?null:KR(x);return c.jsxs(Dn,{style:{backgroundColor:"black"},children:[c.jsx(x4,{cues:r,theme:o,face:s,zoomPlan:a,sourceTextRegions:f,contentTimeline:p,framingTimeline:h,spans:t,sourceSize:m,contentCropMode:w,sourceFit:g,children:c.jsx(GR,{src:b,spans:t,...S?{punch:S}:{},...g==="contain"?{punchInScale:1,background:"transparent"}:{},...y===!0?{punchInScale:1}:{}})}),c.jsx(c$,{cues:r,theme:o}),v$(v)?c.jsx(h4,{lines:n,cues:r,activeColor:o.accent,theme:o,ctaKeyword:l,ctaWindow:u,sourceTextRegions:f}):null,m$(k)?c.jsx(g$,{theme:o,frame:{width:i.width,height:i.height}}):null]})},w$=600,x$=()=>({doc:aM(),past:[],future:[],dirty:!1,savedAt:0,lastCoalesce:null}),Hn=(e,t)=>e.scenes[t]??{props:{},elements:{}};function b$(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<w$;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=Hn(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(Tg(e.doc,t.sceneId,t.elementId,t.patch),t.coalesce);case"clearElement":return n(bM(e.doc,t.sceneId,t.elementId));case"hideElement":return n(Tg(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(SM(e.doc,t.sceneId,t.elementId)):e}case"patchTiming":{const o=Hn(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(kM(e.doc,t.sceneId));case"patchVideo":{const o=Hn(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=Hn(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=Hn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,captionY:t.y}}},t.coalesce)}case"patchCaptionScale":{const o=Hn(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:iM(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=Hn(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=Hn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,component:t.component}}})}case"patchLayout":{const{graphicRect:o,...i}=Hn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...i,layout:t.layout}}})}case"patchGraphicRect":{const o=Hn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,graphicRect:t.rect}}},t.coalesce)}case"clearGraphicRect":return n(EM(e.doc,t.sceneId));case"patchCaption":{const o=vn(t.srcStart),i=Eg(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=vn(t.fromSrcStart),i=vn(t.toSrcStart),s=t.text.trim();if(!s)return e;const a=Cg(e.doc.captionRangeEdits,o,i,t.was);if(s===a){const g=e.doc.captionRangeEdits.filter(k=>k.fromKey!==o||k.toKey!==i);return g.length===e.doc.captionRangeEdits.length?e:n({...e.doc,captionRangeEdits:g})}const l=Math.min(Math.round(t.fromSrcStart*1e3),Math.round(t.toSrcStart*1e3)),u=Math.max(Math.round(t.fromSrcStart*1e3),Math.round(t.toSrcStart*1e3)),f=g=>{if(Ds(g))return!1;const k=Number(g.slice(1));return k>=l&&k<=u},p=Object.fromEntries(Object.entries(e.doc.captions).filter(([g])=>!f(g))),h=Object.fromEntries(Object.entries(e.doc.captionWordsHidden).filter(([g])=>!f(g))),m=Object.fromEntries(Object.entries(e.doc.captionLineTiming).filter(([g])=>!f(g))),w=[...e.doc.captionRangeEdits.filter(g=>{const k=Math.min(Number(g.fromKey.slice(1)),Number(g.toKey.slice(1)));return Math.max(Number(g.fromKey.slice(1)),Number(g.toKey.slice(1)))<l||k>u}),{fromKey:o,toKey:i,text:s,was:a}];return n({...e.doc,captions:p,captionWordsHidden:h,captionLineTiming:m,captionRangeEdits:w})}case"patchCaptionAllOccurrences":{let o=e.doc.captions,i=!1;for(const s of t.entries){const a=vn(s.srcStart),l=Eg(o,a,s.was);if(t.text===l){if(!(a in o))continue;const{[a]:f,...p}=o;o=p,i=!0;continue}const u=o[a];u!==void 0&&u.text===t.text&&u.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=vn(a.fromSrcStart),u=vn(a.toSrcStart),f=Cg(i.captionRangeEdits,l,u,a.was);if(o===f){const w=i.captionRangeEdits.filter(g=>g.fromKey!==l||g.toKey!==u);if(w.length===i.captionRangeEdits.length)continue;i={...i,captionRangeEdits:w},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=w=>{if(Ds(w))return!1;const g=Number(w.slice(1));return g>=p&&g<=h};i={...i,captions:Object.fromEntries(Object.entries(i.captions).filter(([w])=>!m(w))),captionWordsHidden:Object.fromEntries(Object.entries(i.captionWordsHidden).filter(([w])=>!m(w))),captionLineTiming:Object.fromEntries(Object.entries(i.captionLineTiming).filter(([w])=>!m(w))),captionRangeEdits:[...i.captionRangeEdits.filter(w=>{const g=Math.min(Number(w.fromKey.slice(1)),Number(w.toKey.slice(1)));return Math.max(Number(w.fromKey.slice(1)),Number(w.toKey.slice(1)))<p||g>h}),{fromKey:l,toKey:u,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=vn(s.srcStart);if(Math.abs(s.lead)<.001&&Math.abs(s.tail)<.001){if(!(a in o))continue;const{[a]:u,...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=vn(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=vn(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=vn(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"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 S$(){const[e,t]=d.useReducer(b$,void 0,x$),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}),patchTheme:r=>t({type:"patchTheme",patch:r})}}function Dg(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 Og(e){const t=e==null?void 0:e.closest("[data-edit-video]");return(t==null?void 0:t.dataset.editVideo)||null}function Bg(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 u=l.getBoundingClientRect();o=Math.min(o,u.left),i=Math.min(i,u.top),s=Math.max(s,u.right),a=Math.max(a,u.bottom)}),new DOMRect(o,i,s-o,a-i)}const Wg=.015,k$=1e-9;function Lo(e,t){let n=null,r=1/0;for(const o of e){const i=Math.abs(o.feature-o.target);i<=t+k$&&i<r&&(n=o,r=i)}return n}function Vg(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,u=l>=n.left&&l+e.w<=1-n.right,f=Lo([...u?[{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,w=m>=n.top&&m+e.h<=1-n.bottom,g=Lo([...w?[{target:.5,feature:p}]:[],{target:n.top,feature:e.y},{target:1-n.bottom,feature:h}],r);return g&&(o.y=e.y+(g.target-g.feature),i.push({axis:"y",at:g.target})),{rect:o,guides:i}}if(t.includes("w")){const s=Lo([{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=Lo([{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=Lo([{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=Lo([{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 E$(e){const t=e.spans;if(t===void 0)return{};let n;try{n=b1(t).spans.length}catch{return{}}if(n===0)return{};const r={};return e.captionLines&&(r.captionLines=Rg(e.captionLines,t)),e.baseCaptionLines&&(r.baseCaptionLines=Rg(e.baseCaptionLines,t)),r}function Hg(e,t){const n=t.baseCaptionLines??t.captionLines??[],r=pM(e.captions,n);return{doc:{...e,captions:hM(e.captions,r)},unresolved:r.unresolved}}function C$(e){const t={};for(const[n,r]of Object.entries(e))Ds(n)||(t[n]=r);return t}function I$(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 T$(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 H1(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 R$(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 j$(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 P$(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 _$(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 F$(e){if(e===void 0||e.trim()==="")return null;const t=Number(e);return We({srcStart:t})===null?null:t}function M$(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=x1(e.id);return{sceneId:e.id,rootId:o,isSplitHalf:o!==e.id,startSec:e.startSec,endSec:e.endSec,targets:n}}function Ug(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 Zg=64,za=9,Da=e=>Math.round(e*10)/10,zo=e=>Math.round(e*1e4)/1e4,U1={position:"absolute",width:10,height:10,background:"#5b8cff",border:"1px solid #0B0B0E",borderRadius:2,pointerEvents:"auto",zIndex:6},Kg={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"}},$$={...U1,background:"#ffe14d"},A$={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}},N$={position:"absolute",cursor:"move",pointerEvents:"auto",zIndex:5},Z1=/^(line|node|message|window|item)-(\d+)$/;function L$(e,t,n){const r=Z1.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(),u=l[i];if(o==="node"||o==="item")l[i]=n;else if(o==="window"){if(typeof u!="object"||u===null)return null;const f=n.split(`
160
+ `).slice(0,6).map(p=>p.slice(0,40));l[i]={...u,lines:f}}else{if(typeof u!="object"||u===null)return null;l[i]={...u,text:n}}return{[s]:l}}function z$(e,t){const n=Z1.exec(e);if(!n){const u=t[e];return typeof u=="string"?u: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 u=a==null?void 0:a.lines;return Array.isArray(u)&&u.every(f=>typeof f=="string")?u.join(`
161
+ `):null}const l=a==null?void 0:a.text;return typeof l=="string"?l:null}function K1(){const e=document.activeElement;(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&e.blur()}const D$=({stageRef:e,selection:t,onSelect:n,edits:r,onSave:o,settings:i,playerRef:s,onTransport:a,onVideoPreview:l,onGraphicPreview:u,cue:f,cues:p,onToggleHelp:h,onRequestDelete:m})=>{const[w,g]=d.useState(null),k=d.useRef(null),v=d.useRef(0),y=d.useRef(null),x=d.useRef(0),b=d.useRef(null),S=d.useRef(0),E=d.useRef(null),[T,R]=d.useState(!1),[P,$]=d.useState([]),N=d.useRef(null),[W,j]=d.useState(null),[_,H]=d.useState(null),O=d.useRef(null),[I,C]=d.useState({dx:0,dy:0}),A=d.useRef(null),M=d.useRef(t),D=d.useCallback(L=>{M.current=L,n(L)},[n]);d.useEffect(()=>{M.current=t},[t]);const B=(L,z)=>{const Q=[];let G=null;for(let V=0;V<25;V++){const K=document.elementFromPoint(L,z);if(!K||K===document.documentElement||K===document.body){G=K;break}if(G=K,K.hasAttribute("data-edit-id")||K.hasAttribute("data-edit-scene")||K.hasAttribute("data-caption-word")||K.closest("[data-edit-video]")!==null||["BUTTON","INPUT","SELECT","TEXTAREA"].includes(K.tagName)||!(K instanceof HTMLElement))break;Q.push({el:K,prev:K.style.pointerEvents}),K.style.pointerEvents="none"}return Q.forEach(({el:V,prev:K})=>{V.style.pointerEvents=K}),G},Z=d.useCallback(()=>{var K,de;const L=e.current,z=(K=s.current)==null?void 0:K.getScale(),Q=((de=L==null?void 0:L.querySelector(".__remotion-player"))==null?void 0:de.getBoundingClientRect())??(L==null?void 0:L.getBoundingClientRect());if(!Q||!z||z<=0)return null;const G=i.width*z,V=i.height*z;return{left:Q.left+(Q.width-G)/2,top:Q.top+(Q.height-V)/2,w:G,h:V}},[e,s,i]);return d.useEffect(()=>{if(!t){g(null);return}let L;const z=()=>{var G;const Q=e.current;if(Q){const V=t.elementId?Bg(Q,t.sceneId,t.elementId):((G=Q.querySelector(`[data-edit-scene="${t.sceneId}"]`))==null?void 0:G.getBoundingClientRect())??null;g(V)}L=requestAnimationFrame(z)};return L=requestAnimationFrame(z),()=>cancelAnimationFrame(L)},[e,t]),d.useEffect(()=>{const L=z=>{var V,K;const Q=e.current;if(!Q||!Q.contains(z.target)||z.altKey||z.button!==0)return;(((V=M.current)==null?void 0:V.elementId)&&((K=A.current)==null?void 0:K.contains(z.target))||Dg(B(z.clientX,z.clientY))!==null)&&z.stopPropagation()};return window.addEventListener("pointerdown",L,!0),()=>window.removeEventListener("pointerdown",L,!0)},[e]),d.useEffect(()=>{const L=z=>{var ee,X,J,ie,Fe,Ee,be;const Q=e.current;if(!Q||!Q.contains(z.target))return;const G=document.activeElement;if((G instanceof HTMLInputElement||G instanceof HTMLTextAreaElement)&&G.contains(z.target)||(K1(),z.altKey||z.button!==0))return;const V=z.target instanceof Element?z.target.closest("[data-el-handle]"):null,K=M.current;if(V&&(K!=null&&K.elementId)){const Me=Bg(Q,K.sceneId,K.elementId);if(Me){const xe=Me.left+Me.width/2,Te=Me.top+Me.height/2,je=Math.hypot(z.clientX-xe,z.clientY-Te);if(je>2){const Ce=((X=(ee=r.doc.scenes[K.sceneId])==null?void 0:ee.elements[K.elementId])==null?void 0:X.scale)??1;N.current={sceneId:K.sceneId,elementId:K.elementId,cx:xe,cy:Te,startDist:je,prior:Ce,factor:1},j(1)}}return}if((J=M.current)!=null&&J.elementId&&((ie=A.current)!=null&&ie.contains(z.target))){O.current={x:z.clientX,y:z.clientY,dx:0,dy:0},C({dx:0,dy:0});return}const de=z.target instanceof Element?z.target.closest("[data-box-handle]"):null,ve=M.current;if(de&&ve&&!ve.elementId){const Me=Q.querySelector(`[data-edit-scene="${ve.sceneId}"]`),xe=Z();if(Me&&xe){const Te=Me.getBoundingClientRect();E.current=null,b.current={sceneId:ve.sceneId,handle:de.dataset.boxHandle,x:z.clientX,y:z.clientY,dx:0,dy:0,start:{x:(Te.left-xe.left)/xe.w,y:(Te.top-xe.top)/xe.h,w:Te.width/xe.w,h:Te.height/xe.h}},R(!0)}return}const ue=B(z.clientX,z.clientY),se=Dg(ue);if(!se){const Me=ue==null?void 0:ue.closest("[data-edit-scene]");if(Me){D({sceneId:Me.dataset.editScene,elementId:null});return}const xe=Og(ue),Te=Q.getBoundingClientRect().bottom;if(xe&&z.clientY<Te-Zg){D({sceneId:xe,elementId:null});const je=p.find(Le=>Le.id===xe);if((je==null?void 0:je.layout)==="pip-bubble"&&!z.altKey){const Le=yo("pip-bubble",void 0,[],i).video.rect;y.current={sceneId:xe,x:z.clientX,y:z.clientY,base:{x:((Fe=je.pip)==null?void 0:Fe.x)??Le.x,y:((Ee=je.pip)==null?void 0:Ee.y)??Le.y},slot:{w:Le.w,h:Le.h}};return}const Ce=(be=r.doc.scenes[xe])==null?void 0:be.video;k.current={sceneId:xe,x:z.clientX,y:z.clientY,dx:0,dy:0,baseDx:(Ce==null?void 0:Ce.dx)??0,baseDy:(Ce==null?void 0:Ce.dy)??0};return}D(null);return}D({sceneId:se.sceneId,elementId:se.elementId}),O.current={x:z.clientX,y:z.clientY,dx:0,dy:0},C({dx:0,dy:0})};return window.addEventListener("mousedown",L),()=>window.removeEventListener("mousedown",L)},[e,D,r,Z,p,i]),d.useEffect(()=>{const L=()=>{var K,de;const G=(K=s.current)==null?void 0:K.getScale(),V=(de=e.current)==null?void 0:de.getBoundingClientRect();return G&&G>0?1/G:V&&V.width>0?i.width/V.width:1},z=G=>{const V=e.current;if(V&&!(b.current||N.current))if(y.current)V.style.cursor="move";else if(k.current)V.style.cursor="grabbing";else{const ee=G.target instanceof Element?G.target:null,X=ee!==null&&V.contains(ee)&&!ee.closest("button, input, select, textarea, [data-edit-id], [data-edit-scene], [data-caption-word]")&&G.clientY<V.getBoundingClientRect().bottom-Zg,J=X&&(()=>{var Fe;const ie=Og(ee);return ie!==null&&((Fe=p.find(Ee=>Ee.id===ie))==null?void 0:Fe.layout)==="pip-bubble"})();V.style.cursor=X?J?"move":"grab":""}const K=N.current;if(K){const X=Math.hypot(G.clientX-K.cx,G.clientY-K.cy)/K.startDist;K.factor=Math.min(4/K.prior,Math.max(.05/K.prior,X)),j(K.factor);return}const de=b.current;if(de){de.dx=G.clientX-de.x,de.dy=G.clientY-de.y,E.current=G.altKey,S.current||(S.current=requestAnimationFrame(()=>{S.current=0;const ee=b.current,X=Z();if(!ee||!X)return;const J=Ul(Ug(ee.start,ee.handle,ee.dx/X.w,ee.dy/X.h),i);if(G.altKey)$([]),u({sceneId:ee.sceneId,rect:J});else{const ie=Vg(J,ee.handle,Zn(i),Wg);$(ie.guides),u({sceneId:ee.sceneId,rect:ie.rect})}}));return}if(y.current){x.current||(x.current=requestAnimationFrame(()=>{x.current=0;const ee=y.current,X=Z();if(!ee||!X)return;const J=(G.clientX-ee.x)/X.w,ie=(G.clientY-ee.y)/X.h;r.patchPip(ee.sceneId,{x:zo(Math.min(Math.max(ee.base.x+J,0),1-ee.slot.w)),y:zo(Math.min(Math.max(ee.base.y+ie,0),1-ee.slot.h))},`pip:${ee.sceneId}:drag`)}));return}const ue=k.current;if(ue){ue.dx=G.clientX-ue.x,ue.dy=G.clientY-ue.y,v.current||(v.current=requestAnimationFrame(()=>{v.current=0;const ee=k.current;if(!ee)return;const X=L();l({sceneId:ee.sceneId,patch:{dx:ee.baseDx+ee.dx*X,dy:ee.baseDy+ee.dy*X}})}));return}const se=O.current;se&&(se.dx=G.clientX-se.x,se.dy=G.clientY-se.y,C({dx:se.dx,dy:se.dy}))},Q=G=>{const V=N.current;if(V){N.current=null,j(null),Math.abs(V.factor-1)>.001&&r.patchElement(V.sceneId,V.elementId,{scale:Math.round(V.prior*V.factor*1e3)/1e3});return}const K=b.current;if(K){if(b.current=null,R(!1),$([]),S.current&&(cancelAnimationFrame(S.current),S.current=0),K.dx!==0||K.dy!==0){const ee=Z();if(ee){let X=Ul(Ug(K.start,K.handle,K.dx/ee.w,K.dy/ee.h),i);(E.current??G.altKey)||(X=Vg(X,K.handle,Zn(i),Wg).rect),r.patchGraphicRect(K.sceneId,{x:zo(X.x),y:zo(X.y),w:zo(X.w),h:zo(X.h)})}}E.current=null,u(null);return}if(y.current){y.current=null,x.current&&(cancelAnimationFrame(x.current),x.current=0);return}const ve=k.current;if(ve){if(k.current=null,v.current&&(cancelAnimationFrame(v.current),v.current=0),ve.dx!==0||ve.dy!==0){const ee=L();r.patchVideo(ve.sceneId,{dx:Da(ve.baseDx+ve.dx*ee),dy:Da(ve.baseDy+ve.dy*ee)})}l(null);return}const ue=O.current,se=M.current;if(!ue||!(se!=null&&se.elementId)){O.current=null;return}if(ue.dx!==0||ue.dy!==0){const ee=L(),X=r.doc.scenes[se.sceneId],J=X==null?void 0:X.elements[se.elementId];r.patchElement(se.sceneId,se.elementId,{dx:Da(((J==null?void 0:J.dx)??0)+ue.dx*ee),dy:Da(((J==null?void 0:J.dy)??0)+ue.dy*ee)})}O.current=null,C({dx:0,dy:0})};return window.addEventListener("mousemove",z),window.addEventListener("mouseup",Q),()=>{window.removeEventListener("mousemove",z),window.removeEventListener("mouseup",Q)}},[r,e,i,s,l,u,Z,p]),d.useEffect(()=>{const L=z=>{var de;const Q=e.current;if(!Q||!Q.contains(z.target))return;const G=(de=B(z.clientX,z.clientY))==null?void 0:de.closest("[data-caption-word]");if(!G)return;z.preventDefault();const V=F$(G.dataset.captionSrc),K=G.dataset.captionText??"";V===null||!K||H({srcStart:V,was:K,draft:K,rect:G.getBoundingClientRect()})};return window.addEventListener("dblclick",L),()=>window.removeEventListener("dblclick",L)},[e]),d.useEffect(()=>{const L=()=>{const V=document.activeElement;return V instanceof HTMLInputElement||V instanceof HTMLTextAreaElement||V instanceof HTMLSelectElement||V instanceof HTMLElement&&V.isContentEditable},z=()=>{const V=document.activeElement;return V instanceof HTMLTextAreaElement||V instanceof HTMLElement&&V.isContentEditable?!0:V instanceof HTMLInputElement&&!["range","checkbox","radio","button"].includes(V.type)},Q=()=>{const V=document.activeElement;V instanceof HTMLElement&&!z()&&V.blur()},G=V=>{var de,ve,ue;if(_!==null)return;const K=V.metaKey||V.ctrlKey;if(V.key==="Escape"){if(L()){(de=document.activeElement)==null||de.blur();return}D(null)}else if(K&&V.key.toLowerCase()==="z")V.preventDefault(),V.shiftKey?r.redo():r.undo();else if(K&&V.key.toLowerCase()==="y")V.preventDefault(),r.redo();else if(K&&V.key.toLowerCase()==="s")V.preventDefault(),o();else if(V.key===" "&&!K){if(z())return;const se=document.activeElement;if(se instanceof HTMLElement&&se.tagName==="BUTTON"&&((ve=e.current)!=null&&ve.contains(se)))return;Q(),V.preventDefault(),(ue=s.current)==null||ue.toggle()}else if(!K&&["j","k","l"].includes(V.key.toLowerCase())){if(z())return;Q(),V.preventDefault(),a(V.key.toUpperCase())}else if(!K&&!V.altKey&&(V.key==="ArrowLeft"||V.key==="ArrowRight")){if(L())return;V.preventDefault();const se=s.current;if(!se)return;se.seekTo(Math.max(0,se.getCurrentFrame()+(V.key==="ArrowRight"?1:-1)))}else if(K&&V.key.toLowerCase()==="b"){if(z())return;V.preventDefault();const se=s.current;if(!se)return;const ee=se.getCurrentFrame()/i.fps;if(!p.find(J=>ee>=J.startSec+Vl&&ee<=J.endSec-Vl))return;r.addSplit(Math.round(ee*1e3)/1e3)}else if(!K&&V.altKey&&(V.key==="ArrowLeft"||V.key==="ArrowRight")){if(z())return;const se=M.current,ee=se?(()=>{const X=p.findIndex(J=>J.id===se.sceneId);return X===-1?void 0:p[X+(V.key==="ArrowRight"?1:-1)]})():p[V.key==="ArrowRight"?0:p.length-1];if(!ee)return;V.preventDefault(),D({sceneId:ee.id,elementId:null})}else if(K&&(V.key==="ArrowLeft"||V.key==="ArrowRight")){if(z())return;V.preventDefault();const se=s.current;if(!se)return;const ee=se.getCurrentFrame()/i.fps,X=p.findIndex(ie=>ee>=ie.startSec&&ee<ie.endSec),J=p[(X===-1?0:X)+(V.key==="ArrowRight"?1:-1)];if(!J)return;se.seekTo(Math.round(J.startSec*i.fps)),D({sceneId:J.id,elementId:null})}else if(!K&&!V.altKey&&V.key==="?"){if(L())return;V.preventDefault(),h()}else if(!K&&(V.key==="Delete"||V.key==="Backspace")){if(L())return;const se=M.current;if(!se||se.elementId!==null||!f||f.id!==se.sceneId)return;const ee=M$(f,r.doc);if(!ee)return;V.preventDefault(),m(ee)}};return window.addEventListener("keydown",G),()=>window.removeEventListener("keydown",G)},[D,r,_,o,s,e,a,f,p,i,h,m]),c.jsxs("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:[I.dx!==0||I.dy!==0||T?c.jsx("div",{"data-testid":"safe-area-guide",style:{position:"absolute",left:`${Zn(i).left*100}%`,top:`${Zn(i).top*100}%`,right:`${Zn(i).right*100}%`,bottom:`${Zn(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,P.map(L=>c.jsx("div",{"data-testid":`guide-${L.axis}`,style:{position:"absolute",pointerEvents:"none",background:"#FFE14D",...L.axis==="x"?{left:`${L.at*100}%`,top:0,bottom:0,width:1}:{top:`${L.at*100}%`,left:0,right:0,height:1}}},L.axis)),w&&t?c.jsxs("div",{ref:A,"data-testid":"overlay-box",style:{position:"fixed",pointerEvents:"auto",left:w.left+I.dx-za/2+w.width*(1-(W??1))/2,top:w.top+I.dy-za/2+w.height*(1-(W??1))/2,width:w.width*(W??1)+za,height:w.height*(W??1)+za,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?c.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(L=>c.jsx("div",{"data-el-handle":L,"data-testid":`el-handle-${L}`,style:{...$$,...Kg[L]}},L)):null,!t.elementId&&f&&f.kind!=="plain"?c.jsxs(c.Fragment,{children:[["top","bottom","left","right"].map(L=>c.jsx("div",{"data-box-handle":"move","data-testid":L==="top"?"box-handle-move":`box-handle-move-${L}`,style:{...N$,...A$[L]}},L)),["nw","n","ne","e","se","s","sw","w"].map(L=>c.jsx("div",{"data-box-handle":L,"data-testid":`box-handle-${L}`,style:{...U1,...Kg[L]}},L))]}):null]}):null,_?c.jsx("input",{autoFocus:!0,"data-testid":"caption-edit",value:_.draft,onChange:L=>H({..._,draft:L.target.value}),onBlur:()=>{const L=_.draft.trim();L&&r.patchCaption(_.srcStart,L,_.was),H(null)},onKeyDown:L=>{L.key==="Enter"&&L.target.blur(),L.key==="Escape"&&H(null)},style:{position:"fixed",pointerEvents:"auto",left:_.rect.left-4,top:_.rect.top-4,width:Math.max(_.rect.width+40,90),height:_.rect.height+8,fontSize:Math.max(13,Math.min(_.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]})},_n={display:"flex",flexDirection:"column",gap:6},qi={display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},Ze={fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"#9A9AA3"},gs={fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",fontSize:13,background:"#0F0F14",border:"1px solid #2A2A33",borderRadius:6,color:"#fff",padding:"6px 8px",width:"100%"},df={...gs,fontFamily:"'Inter', system-ui, sans-serif"},rt={display:"flex",flexDirection:"column",gap:14,padding:"16px 18px",borderBottom:"1px solid #22222a"},rn={fontSize:12,fontWeight:600,color:"#FF5C5C",background:"transparent",border:"1px solid #452626",borderRadius:6,padding:"7px 10px",cursor:"pointer"},on=()=>{var e,t;(t=(e=document.activeElement)==null?void 0:e.blur)==null||t.call(e)},O$=e=>String(Math.round(e*1e3)/1e3),Kt=({id:e,value:t,onCommit:n,min:r,max:o,dragStep:i})=>{const[s,a]=oe.useState(null),[l,u]=oe.useState(!1),f=oe.useRef(null),p=oe.useRef(null),h=r??-1/0,m=o??1/0,w=i??(r!==void 0&&o!==void 0?(o-r)/240:.5),g=s!==null;return c.jsxs("div",{style:_n,children:[c.jsx("span",{style:Ze,children:e}),c.jsx("input",{type:"text",inputMode:"decimal",ref:f,"data-testid":`field-${e}`,style:{...gs,...g?{}:{cursor:"ew-resize",touchAction:"none"},...l?{borderColor:"#FFE14D",color:"#FFE14D"}:{}},value:s??(Number.isFinite(t)?O$(t):"0"),onFocus:k=>a(k.target.value),onBlur:()=>a(null),onPointerDown:k=>{g||(k.preventDefault(),p.current={x:k.clientX,v:Number.isFinite(t)?t:0,moved:!1},k.currentTarget.setPointerCapture(k.pointerId),u(!0))},onPointerMove:k=>{const v=p.current;if(!v)return;const y=k.clientX-v.x;if(!v.moved&&Math.abs(y)<=2)return;v.moved=!0;const x=Math.round(Math.min(m,Math.max(h,v.v+y*w))*1e3)/1e3;n(x)},onPointerUp:()=>{var v,y,x;const k=((v=p.current)==null?void 0:v.moved)===!0;p.current=null,u(!1),k||((y=f.current)==null||y.focus(),(x=f.current)==null||x.select())},onPointerCancel:()=>{p.current=null,u(!1)},onChange:k=>{a(k.target.value);const v=k.target.value.trim();if(v==="")return;const y=Number(v.replace(",","."));Number.isFinite(y)&&n(Math.min(m,Math.max(h,y)))}})]})},Oa=({id:e,value:t,isColor:n,onCommit:r})=>c.jsxs("div",{style:_n,children:[c.jsx("span",{style:Ze,children:e}),c.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[n?c.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,c.jsx("input",{"data-testid":`theme-${e}`,style:{...df,flex:1},value:t,onChange:o=>r(o.target.value)})]})]}),B$=({selection:e,cue:t,frame:n,allSceneIds:r,edits:o,onSelect:i,resolvedTheme:s,anchorText:a,onVideoPreview:l,runInfo:u,captionsHiddenByFlag:f})=>{var v,y,x,b,S,E,T,R,P,$,N,W;if(e!=null&&e.elementId&&t){const j=e.elementId,_=((v=t.elements)==null?void 0:v[j])??{},H=t.props?z$(j,t.props):null,O=/^window-\d+$/.test(j);return c.jsxs("div",{children:[c.jsxs("div",{style:rt,children:[c.jsx("span",{style:Ze,children:"Selected"}),c.jsx("div",{style:{fontSize:15,fontWeight:700,fontFamily:"ui-monospace, monospace"},children:j})]}),(()=>{var B;const I=/^line-(\d+)$/.exec(j),C=(B=t.props)==null?void 0:B.lines;if(t.component!=="StrikethroughReveal"||!I||!Array.isArray(C))return null;const A=Number(I[1]),M=C[A];if(!M)return null;const D=M.struck?"struck":(M.mark??"none")!=="none"?M.mark:"plain";return c.jsx("div",{style:rt,children:c.jsxs("div",{style:_n,children:[c.jsx("span",{style:Ze,children:"Line style"}),c.jsxs("select",{"data-testid":"line-style",style:gs,value:D,onChange:Z=>{const L=Z.target.value,z=C.slice();z[A]={...z[A],struck:L==="struck",mark:L==="cross"||L==="check"?L:"none"},o.patchProps(e.sceneId,{lines:z})},children:[c.jsx("option",{value:"plain",children:"plain"}),c.jsx("option",{value:"struck",children:"struck through"}),c.jsx("option",{value:"cross",children:"✗ wrong"}),c.jsx("option",{value:"check",children:"✓ right"})]})]})})})(),H!==null?c.jsx("div",{style:rt,children:c.jsxs("div",{style:_n,children:[c.jsx("span",{style:Ze,children:"Text"}),(()=>{const I=C=>{const A=t.props??{},M=/^(line|node|message|window|item)-\d+$/.test(j)?L$(j,A,C):{[j]:C};M&&o.patchProps(e.sceneId,M,`text:${e.sceneId}:${j}`)};return O?c.jsx("textarea",{style:{...df,resize:"vertical",fontFamily:"inherit"},"data-testid":"element-text",rows:Math.min(6,Math.max(2,H.split(`
162
+ `).length)),value:H,onChange:C=>I(C.target.value)}):c.jsx("input",{style:df,"data-testid":"element-text",value:H,onChange:C=>I(C.target.value)})})()]})}):null,c.jsxs("div",{style:rt,children:[c.jsxs("div",{style:_n,children:[c.jsxs("span",{style:Ze,children:["scale"," ",c.jsxs("span",{style:{color:"#EDEDF2"},children:[(_.scale??1).toFixed(2),"×"]})]}),c.jsx("input",{type:"range","data-testid":"el-scale-slider",min:.1,max:3,step:.01,value:_.scale??1,onChange:I=>o.patchElement(e.sceneId,j,{scale:Number(I.target.value)},`element:${e.sceneId}:${j}:scale`)})]}),c.jsxs("div",{style:qi,children:[c.jsx(Kt,{id:"x",value:_.dx??0,dragStep:1,onCommit:I=>o.patchElement(e.sceneId,j,{dx:I},`element:${e.sceneId}:${j}:dx`)}),c.jsx(Kt,{id:"y",value:_.dy??0,dragStep:1,onCommit:I=>o.patchElement(e.sceneId,j,{dy:I},`element:${e.sceneId}:${j}:dy`)})]}),c.jsx(Kt,{id:"scale",value:_.scale??1,min:.05,max:4,dragStep:.01,onCommit:I=>o.patchElement(e.sceneId,j,{scale:I},`element:${e.sceneId}:${j}:scale`)})]}),c.jsxs("div",{style:rt,children:[c.jsx("button",{style:rn,onClick:()=>{on(),o.clearElement(e.sceneId,j)},children:"Reset element"}),c.jsx("button",{"data-testid":"delete-element",style:{...rn,marginTop:8},onClick:()=>{on(),o.hideElement(e.sceneId,j),i({sceneId:e.sceneId,elementId:null})},children:"Delete element"})]})]})}if(e&&t){const j=t.kind==="plain";if(((y=o.doc.scenes[e.sceneId])==null?void 0:y.hidden)===!0)return c.jsx("div",{children:c.jsxs("div",{style:rt,children:[c.jsx("span",{style:Ze,children:"Scene"}),c.jsxs("div",{style:{fontSize:15,fontWeight:700,fontFamily:"ui-monospace, monospace"},children:[e.sceneId," ",c.jsx("span",{style:{color:"#9A9AA3",fontWeight:400},children:"(deleted)"})]}),c.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Its window plays as a plain take. Restore brings the graphic back."}),c.jsx("button",{"data-testid":"restore-scene",style:{...rn,color:"#5FBF77",border:"1px solid #24402c"},onClick:()=>{on(),o.restoreScene(e.sceneId)},children:"Restore scene"})]})});const _=o.doc.cuts.findIndex(O=>O.src===void 0&&O.startSec===t.startSec&&O.endSec===t.endSec);if(_!==-1)return c.jsx("div",{children:c.jsxs("div",{style:rt,children:[c.jsx("span",{style:Ze,children:j?"Take":"Scene"}),c.jsxs("div",{style:{fontSize:15,fontWeight:700,fontFamily:"ui-monospace, monospace"},children:[e.sceneId," ",c.jsx("span",{style:{color:"#9A9AA3",fontWeight:400},children:"(marked for removal)"})]}),c.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)."}),c.jsx("button",{"data-testid":"restore-chunk",style:{...rn,color:"#5FBF77",border:"1px solid #24402c"},onClick:()=>{on(),o.restoreChunk(_)},children:"Restore"})]})});const H=Object.entries(t.elements??{}).filter(([,O])=>O.hidden===!0).map(([O])=>{var A,M;const C=((M=(A=o.doc.scenes[e.sceneId])==null?void 0:A.elements[O])==null?void 0:M.hidden)===!0?e.sceneId:x1(e.sceneId);return{id:O,owningSceneId:C}});return c.jsxs("div",{children:[c.jsxs("div",{style:rt,children:[c.jsx("span",{style:Ze,children:j?"Take":"Scene"}),c.jsx("div",{style:{fontSize:15,fontWeight:700,fontFamily:"ui-monospace, monospace"},children:e.sceneId}),j?c.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]}),c.jsxs("div",{style:rt,children:[!j&&t.component?c.jsxs("div",{style:_n,children:[c.jsx("span",{style:Ze,children:"Component"}),c.jsx("select",{style:gs,value:t.component,onChange:O=>o.patchComponent(e.sceneId,O.target.value),children:Ou.options.map(O=>c.jsx("option",{value:O,children:O},O))})]}):null,c.jsxs("div",{style:_n,children:[c.jsx("span",{style:Ze,children:"Layout"}),c.jsx("select",{style:gs,"data-testid":"layout-select",value:t.layout,onChange:O=>o.patchLayout(e.sceneId,O.target.value),children:Du.options.map(O=>c.jsx("option",{value:O,children:O},O))})]})]}),c.jsxs("div",{style:rt,children:[c.jsx("span",{style:Ze,children:"Video framing"}),c.jsxs("div",{style:_n,children:[c.jsxs("span",{style:Ze,children:["zoom"," ",c.jsxs("span",{style:{color:"#EDEDF2"},children:[(((x=t.video)==null?void 0:x.scale)??1).toFixed(2),"×"]})]}),c.jsx("input",{type:"range","data-testid":"zoom-slider",min:.5,max:3,step:.01,value:((b=t.video)==null?void 0:b.scale)??1,onChange:O=>l({sceneId:e.sceneId,patch:{scale:Number(O.target.value)}}),onPointerUp:O=>{const I=Number(O.target.value);o.patchVideo(e.sceneId,{scale:I},`video:${e.sceneId}:scale`),l(null)},onKeyUp:O=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(O.key))return;const C=Number(O.target.value);o.patchVideo(e.sceneId,{scale:C},`video:${e.sceneId}:scale`),l(null)}})]}),c.jsxs("label",{style:{display:"flex",gap:8,alignItems:"center",fontSize:12,color:"#9A9AA3",cursor:"pointer"},children:[c.jsx("input",{type:"checkbox","data-testid":"auto-zoom",checked:((S=t.video)==null?void 0:S.autoZoom)!==!1,onChange:O=>o.patchVideo(e.sceneId,{autoZoom:O.target.checked})}),"auto zoom (the slow push composes on top of your zoom)"]}),c.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Pan: drag the picture on the stage."}),c.jsx(Kt,{id:"scale",value:((E=t.video)==null?void 0:E.scale)??1,min:.05,max:4,dragStep:.01,onCommit:O=>o.patchVideo(e.sceneId,{scale:O},`video:${e.sceneId}:scale`)}),c.jsxs("div",{style:qi,children:[c.jsx(Kt,{id:"dx",value:((T=t.video)==null?void 0:T.dx)??0,dragStep:1,onCommit:O=>o.patchVideo(e.sceneId,{dx:O},`video:${e.sceneId}:dx`)}),c.jsx(Kt,{id:"dy",value:((R=t.video)==null?void 0:R.dy)??0,dragStep:1,onCommit:O=>o.patchVideo(e.sceneId,{dy:O},`video:${e.sceneId}:dy`)})]}),t.video?c.jsx("button",{style:rn,onClick:()=>{on(),o.clearVideo(e.sceneId)},children:"Reset framing"}):null]}),t.layout==="pip-bubble"?(()=>{const O=yo("pip-bubble",void 0,[],n).video,I=t.pip??{},C=I.cornerRadius??O.cornerRadius;return c.jsxs("div",{style:rt,children:[c.jsx("span",{style:Ze,children:"PiP bubble"}),c.jsxs("div",{style:_n,children:[c.jsxs("span",{style:Ze,children:["roundness"," ",c.jsx("span",{style:{color:"#EDEDF2"},children:C.toFixed(2)})]}),c.jsx("input",{type:"range","data-testid":"pip-roundness",min:0,max:1,step:.01,value:C,onChange:A=>o.patchPip(e.sceneId,{cornerRadius:Number(A.target.value)},`pip:${e.sceneId}:cornerRadius`)})]}),c.jsxs("div",{style:qi,children:[c.jsx(Kt,{id:"pip-x",value:I.x??O.rect.x,min:0,max:1-O.rect.w,dragStep:.002,onCommit:A=>o.patchPip(e.sceneId,{x:A},`pip:${e.sceneId}:x`)}),c.jsx(Kt,{id:"pip-y",value:I.y??O.rect.y,min:0,max:1-O.rect.h,dragStep:.002,onCommit:A=>o.patchPip(e.sceneId,{y:A},`pip:${e.sceneId}:y`)})]}),t.pip?c.jsx("button",{"data-testid":"reset-pip",style:rn,onClick:()=>{on(),o.clearPip(e.sceneId)},children:"Reset bubble"}):null]})})():null,(()=>{var C;if(j)return null;const O=C1(t,n),I=A=>M=>o.patchGraphicRect(e.sceneId,Ul({...O,[A]:M},n),`box:${e.sceneId}:${A}`);return c.jsxs("div",{style:rt,children:[c.jsx("span",{style:Ze,children:"Graphic box"}),c.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Frame fractions — or drag the handles on the stage."}),c.jsxs("div",{style:qi,children:[c.jsx(Kt,{id:"box-x",value:O.x,min:0,max:1,dragStep:.002,onCommit:I("x")}),c.jsx(Kt,{id:"box-y",value:O.y,min:0,max:1,dragStep:.002,onCommit:I("y")})]}),c.jsxs("div",{style:qi,children:[c.jsx(Kt,{id:"box-w",value:O.w,min:.08,max:1,dragStep:.002,onCommit:I("w")}),c.jsx(Kt,{id:"box-h",value:O.h,min:.05,max:1,dragStep:.002,onCommit:I("h")})]}),(C=o.doc.scenes[e.sceneId])!=null&&C.graphicRect?c.jsx("button",{"data-testid":"reset-box",style:rn,onClick:()=>{on(),o.clearGraphicRect(e.sceneId)},children:"Reset box"}):null]})})(),(()=>{const O=yo(t.layout,void 0,[],n).captionAnchor,I=t.captionY??O,C=t.captionScale??1,A=o.doc.scenes[e.sceneId];return c.jsxs("div",{style:rt,children:[c.jsx("span",{style:Ze,children:"Captions"}),o.doc.captionsHidden===!0||f===!0?c.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,c.jsxs("div",{style:_n,children:[c.jsxs("span",{style:Ze,children:["position"," ",c.jsx("span",{style:{color:"#EDEDF2"},children:I.toFixed(2)})]}),c.jsx("input",{type:"range","data-testid":"caption-y-slider",min:.05,max:.95,step:.01,value:I,onChange:M=>o.patchCaptionY(e.sceneId,Number(M.target.value),`captionY:${e.sceneId}`)})]}),c.jsxs("div",{style:_n,children:[c.jsxs("span",{style:Ze,children:["scale"," ",c.jsxs("span",{style:{color:"#EDEDF2"},children:[C.toFixed(2),"×"]})]}),c.jsx("input",{type:"range","data-testid":"caption-scale-slider",min:.2,max:3,step:.01,value:C,onChange:M=>o.patchCaptionScale(e.sceneId,Number(M.target.value),`captionScale:${e.sceneId}`)})]}),c.jsx(Kt,{id:"caption-scale",value:C,min:.2,max:3,dragStep:.01,onCommit:M=>o.patchCaptionScale(e.sceneId,M,`captionScale:${e.sceneId}`)}),c.jsx("button",{"data-testid":"caption-y-all",style:{...rn,color:"#EDEDF2",border:"1px solid #2A2A33"},title:"Write this scene's caption position and scale to every scene — one undo step",onClick:()=>{on(),o.patchCaptionStyleAll(r,{y:I,scale:C})},children:"Apply to all scenes"}),(A==null?void 0:A.captionY)!==void 0||(A==null?void 0:A.captionScale)!==void 0?c.jsx("button",{"data-testid":"reset-caption-y",style:rn,onClick:()=>{on(),o.clearCaptionStyle(e.sceneId)},children:"Reset captions"}):null]})})(),c.jsxs("div",{style:rt,children:[c.jsx("span",{style:Ze,children:"Timing"}),c.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",c.jsxs("span",{style:{color:"#9A9AA3"},children:[" ","(",(t.endSec-t.startSec).toFixed(2),"s)"]})]}),c.jsx("div",{style:{fontSize:12,color:t.pinned?"#FFE14D":"#9A9AA3"},children:j?"Derived from the cut — not movable":t.pinned?"Pinned to these times":"Tracking transcript"}),!t.pinned&&a?c.jsxs("div",{style:{fontSize:12,color:"#9A9AA3",fontStyle:"italic"},children:["“",a,"”"]}):null,t.pinned?c.jsx("button",{style:rn,onClick:()=>{on(),o.clearTiming(e.sceneId)},children:"Un-pin (re-anchor to words)"}):null]}),j?null:c.jsx("div",{style:rt,children:c.jsx("button",{"data-testid":"delete-scene",style:rn,onClick:()=>{on(),o.hideScene(e.sceneId)},children:"Delete scene"})}),H.length>0?c.jsxs("div",{style:rt,children:[c.jsx("span",{style:Ze,children:"Hidden elements"}),H.map(({id:O,owningSceneId:I})=>c.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[c.jsx("span",{style:{fontSize:13,fontFamily:"ui-monospace, monospace",color:"#C9C9D4"},children:O}),c.jsx("button",{"data-testid":`restore-element-${O}`,style:{...rn,color:"#5FBF77",border:"1px solid #24402c",padding:"4px 8px"},onClick:()=>{on(),o.restoreElement(I,O)},children:"Restore"})]},O))]}):null,c.jsxs("div",{style:rt,children:[c.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."}),c.jsx("button",{"data-testid":"cut-chunk",style:rn,onClick:()=>{on(),o.cutChunk(t.startSec,t.endSec)},children:"Delete this chunk"})]})]})}const p=o.doc.theme,h=(j,_)=>o.patchTheme({[j]:_}),m=j=>`${Math.floor(j/60)}:${String(Math.floor(j%60)).padStart(2,"0")}`,w=((P=u==null?void 0:u.usage)==null?void 0:P.totals)??null,g=(($=u==null?void 0:u.production)==null?void 0:$.producer)??null,k=((N=u==null?void 0:u.production)==null?void 0:N.clip)??null;return c.jsxs("div",{children:[c.jsxs("div",{style:rt,children:[c.jsx("span",{style:Ze,children:"Theme"}),c.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Nothing selected — global tokens."})]}),c.jsxs("div",{style:rt,children:[c.jsx(Oa,{id:"accent",value:p.accent??s.accent,isColor:!0,onCommit:j=>h("accent",j)}),c.jsx(Oa,{id:"bg",value:p.bg??s.bg,isColor:!0,onCommit:j=>h("bg",j)}),c.jsx(Oa,{id:"fg",value:p.fg??s.fg,isColor:!0,onCommit:j=>h("fg",j)}),c.jsx(Kt,{id:"radiusPx",value:p.radiusPx??s.radiusPx,min:0,dragStep:.5,onCommit:j=>h("radiusPx",j)}),c.jsx(Oa,{id:"fontDisplay",value:p.fontDisplay??s.fontDisplay,isColor:!1,onCommit:j=>h("fontDisplay",j)})]}),c.jsxs("div",{style:rt,children:[c.jsx("span",{style:Ze,children:"Captions"}),c.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,color:"#EDEDF2",cursor:"pointer"},children:[c.jsx("input",{type:"checkbox","data-testid":"captions-visible-toggle",checked:o.doc.captionsHidden!==!0&&f!==!0,disabled:f===!0&&o.doc.captionsHidden!==!0,onChange:j=>o.setCaptionsHidden(!j.target.checked)}),"Show captions"]}),o.doc.captionsHidden===!0?c.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?c.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]}),g||w?c.jsxs("div",{style:rt,"data-testid":"run-info",children:[c.jsx("span",{style:Ze,children:"This video"}),g?c.jsxs("div",{style:{fontSize:12,color:"#C9C9D4"},children:["planned by ",c.jsx("span",{style:{color:"#EDEDF2"},children:g.provider}),g.models.length>0?` (${g.models.join(", ")})`:"",g.cached?" · reused from cache":"",g.at?` · ${new Date(g.at).toLocaleString()}`:""]}):null,w?c.jsxs("div",{style:{fontSize:12,color:"#C9C9D4"},children:[w.calls," LLM call",w.calls===1?"":"s"," ·"," ",w.inputTokens.toLocaleString()," in / ",w.outputTokens.toLocaleString()," out tokens",w.anyEstimated?" (partly estimated)":""]}):null,w&&w.equivalentUsd!==null?c.jsx("div",{style:{fontSize:12,color:"#C9C9D4"},children:w.allUnbilled?`~$${w.equivalentUsd.toFixed(2)} of API-rate work, covered by the subscription`:w.billedUsd!==null?`~$${w.billedUsd.toFixed(2)} charged at API rates`:`~$${w.equivalentUsd.toFixed(2)} at API rates`}):null,k?c.jsxs("div",{style:{fontSize:12,color:"#C9C9D4"},children:["clip: ",m(k.startSec),"–",m(k.endSec),(W=u==null?void 0:u.production)!=null&&W.sourceDuration?` of ${m(u.production.sourceDuration)}`:""," ","(--clip ",k.targetSec,")"]}):null]}):null,c.jsx("div",{style:rt,children:c.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."})})]})},$c=1.2,Kl=.05;function W$(e,t,n,r){return n<=0||r<=0?0:Math.min(1,Math.max(0,(e-t)/n))*r}const V$=16,H$=e=>Math.min(V$,Math.max(1,e));function U$(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 Qp=e=>e.filter(t=>t.kind!=="plain");function Z$(e,t,n,r){const o=Qp(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,u=i<o.length-1?o[i+1]:void 0,f=l?l.endSec+Kl:0,p=u?u.startSec-Kl:r,h=Math.min(Math.max(s.startSec+n,f),Math.max(f,p-a));return{startSec:h,endSec:h+a}}function K$(e,t,n,r,o){const i=Qp(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,u=a?a.endSec+Kl:0,f=l?l.startSec-Kl:o;let p=Math.min(Math.max(n,u),Math.max(u,f-$c)),h=Math.max(Math.min(r,f),p+$c);return h>f&&(h=f,p=Math.max(u,h-$c)),{startSec:p,endSec:h}}function Yg(e,t,n,r){const o=[0,r,n];for(const a of Qp(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 Ba(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 Y$(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 Ac(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 G$=10,X$=4,Gg=8,Xg=8,q$=300,Q$=e=>{const t=Math.max(0,Math.round(e));return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`},J$=(e,t)=>{const[n,r]=oe.useState({}),o=oe.useRef({}),i=t.map(s=>s.toFixed(1)).join(",");return oe.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 u=document.createElement("canvas");return(async()=>{await new Promise((h,m)=>{l.onloadedmetadata=()=>h(),l.onerror=()=>m(new Error("no video for thumbnails"))}),u.width=168,u.height=Math.max(1,Math.round(168*l.videoHeight/Math.max(1,l.videoWidth)));const p=u.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,u.width,u.height),o.current[h]=u.toDataURL("image/jpeg",.6)}a||r({...o.current})}})().catch(()=>{}),()=>{a=!0,l.removeAttribute("src"),l.load()}},[e,i]),n},eA=({cues:e,ghosts:t,cuts:n=[],spans:r=[],durationSec:o,fps:i,playerRef:s,selection:a,onSelect:l,edits:u,videoSrc:f,toSourceSec:p})=>{const h=d.useRef(null),m=d.useRef(null),w=d.useRef(!1),g=d.useRef(null),[k,v]=d.useState(0),y=d.useRef(k);y.current=k;const[x,b]=d.useState(null),[S,E]=d.useState(1),T=oe.useMemo(()=>p?e.filter(I=>I.kind==="plain").map(I=>p((I.startSec+I.endSec)/2)):[],[e,p]),R=J$(f,T),P=d.useRef(null),$=d.useRef(null),N=d.useCallback((I,C)=>{const A=P.current;E(M=>{const D=H$(I);if(D===M||!A)return D;const B=A.getBoundingClientRect();return $.current={prevZoom:M,anchorX:C!==void 0?C-B.left:B.width/2},D})},[]);d.useLayoutEffect(()=>{const I=P.current,C=$.current;!I||!C||($.current=null,I.scrollLeft=U$(C.prevZoom,S,I.clientWidth,I.scrollLeft,C.anchorX))},[S]);const W=d.useRef(S);W.current=S,d.useEffect(()=>{const I=P.current;if(!I)return;const C=A=>{A.ctrlKey||A.metaKey?(A.preventDefault(),N(W.current*Math.exp(-A.deltaY*.01),A.clientX)):I.scrollWidth>I.clientWidth&&(A.preventDefault(),I.scrollLeft+=A.deltaY+A.deltaX)};return I.addEventListener("wheel",C,{passive:!1}),()=>I.removeEventListener("wheel",C)},[N]),d.useEffect(()=>{const I=s.current;if(!I)return;v(I.getCurrentFrame());const C=A=>v(A.detail.frame);return I.addEventListener("frameupdate",C),()=>I.removeEventListener("frameupdate",C)},[s]),d.useEffect(()=>{const I=P.current;if(!I||o<=0||I.scrollWidth<=I.clientWidth)return;const C=k/i/o*I.scrollWidth,{scrollLeft:A,clientWidth:M}=I;(C<A||C>A+M)&&(I.scrollLeft=Math.max(0,Math.min(I.scrollWidth-M,C-M*.1)))},[k,i,o]),d.useEffect(()=>{var C,A;if(!a)return;const I=(C=P.current)==null?void 0:C.querySelector(`[data-testid="timeline-block-${a.sceneId}"]`);(A=I==null?void 0:I.scrollIntoView)==null||A.call(I,{inline:"nearest",block:"nearest"})},[a]);const j=d.useCallback(I=>{var M;const C=h.current;if(!C||o<=0)return;const A=C.getBoundingClientRect();(M=s.current)==null||M.seekTo(Math.round(W$(I,A.left,A.width,o)*i))},[s,o,i]),_=d.useCallback((I,C)=>A=>{A.stopPropagation(),A.preventDefault();const M=h.current;M&&(m.current={sceneId:I.id,edge:C,startContentX:A.clientX-M.getBoundingClientRect().left,origStart:I.startSec,origEnd:I.endSec},b({sceneId:I.id,startSec:I.startSec,endSec:I.endSec,snapped:null}))},[]),H=d.useRef(0);d.useEffect(()=>{const I=M=>{const D=P.current;if(!D||D.scrollWidth<=D.clientWidth)return;const B=Date.now();if(B-H.current<q$)return;const Z=D.getBoundingClientRect(),L=D.scrollWidth-D.clientWidth;M>=Z.right-Xg&&D.scrollLeft<L?(D.scrollLeft=Math.min(L,D.scrollLeft+D.clientWidth),H.current=B):M<=Z.left+Xg&&D.scrollLeft>0&&(D.scrollLeft=Math.max(0,D.scrollLeft-D.clientWidth),H.current=B)},C=M=>{var ue;if((w.current||((ue=g.current)==null?void 0:ue.moved)===!0||m.current!==null)&&I(M.clientX),w.current){j(M.clientX);return}const B=g.current;if(B&&o>0){if(!B.moved&&Math.abs(M.clientX-B.startX)<X$)return;if(B.moved=!0,B.scrub){j(M.clientX);return}const se=h.current,ee=se==null?void 0:se.getBoundingClientRect(),X=ee?(M.clientX-ee.left-B.startContentX)/ee.width*o:0;let J=X,ie=null;const Fe=ee&&ee.width>0&&!M.altKey?e.find(be=>be.id===B.sceneId):void 0;if(Fe&&ee){const be=Gg/(ee.width/o),Me=Yg(e,B.sceneId,y.current/i,o),xe=Fe.startSec+X,Te=Fe.endSec+X,je=Ba(xe,Me,be),Ce=Ba(Te,Me,be),Le=je.snapped===null?1/0:Math.abs(je.sec-xe),Rt=Ce.snapped===null?1/0:Math.abs(Ce.sec-Te);Le<=Rt&&je.snapped!==null?(J=X+(je.sec-xe),ie=je.snapped):Ce.snapped!==null&&(J=X+(Ce.sec-Te),ie=Ce.snapped)}const Ee=Z$(e,B.sceneId,J,o);if(Ee){const be=ie!==null&&(Math.abs(Ee.startSec-ie)<1e-6||Math.abs(Ee.endSec-ie)<1e-6)?ie:null;b({sceneId:B.sceneId,...Ee,snapped:be})}return}const Z=m.current;if(!Z||o<=0)return;const L=h.current;if(!L)return;const z=L.getBoundingClientRect(),Q=(M.clientX-z.left-Z.startContentX)/z.width*o;let G=Z.edge==="start"?Z.origStart+Q:Z.origStart,V=Z.edge==="end"?Z.origEnd+Q:Z.origEnd,K=null;if(!M.altKey&&z.width>0){const se=Gg/(z.width/o),ee=Yg(e,Z.sceneId,y.current/i,o);if(Z.edge==="start"){const X=Ba(G,ee,se);G=X.sec,K=X.snapped}else{const X=Ba(V,ee,se);V=X.sec,K=X.snapped}}const de=K$(e,Z.sceneId,G,V,o),ve=K!==null&&(Math.abs(de.startSec-K)<1e-6||Math.abs(de.endSec-K)<1e-6)?K:null;b({sceneId:Z.sceneId,...de,snapped:ve})},A=M=>{w.current=!1;const D=g.current;if(D){g.current=null,D.moved&&!D.scrub&&b(Z=>(Z&&Z.sceneId===D.sceneId&&u.patchTiming(D.sceneId,Z.startSec,Z.endSec),null));return}const B=m.current;B&&(b(Z=>(Z&&Z.sceneId===B.sceneId&&(Z.startSec!==B.origStart||Z.endSec!==B.origEnd)&&u.patchTiming(B.sceneId,Z.startSec,Z.endSec),null)),m.current=null)};return window.addEventListener("mousemove",C),window.addEventListener("mouseup",A),()=>{window.removeEventListener("mousemove",C),window.removeEventListener("mouseup",A)}},[e,o,u,j,i]);const O=o>0?Math.min(1,k/i/o)*100:0;return c.jsxs("div",{style:tA,onMouseDownCapture:K1,children:[c.jsxs("div",{style:nA,children:[c.jsx("span",{style:oA,children:"ctrl+scroll to zoom"}),c.jsx("button",{"data-testid":"zoom-out",style:Nc,onClick:()=>N(S/2),disabled:S<=1,title:"Zoom out (ctrl/cmd + scroll on the timeline)",children:"−"}),c.jsxs("span",{"data-testid":"zoom-level",style:rA,children:[Math.round(S*10)/10,"×"]}),c.jsx("button",{"data-testid":"zoom-in",style:Nc,onClick:()=>N(S*2),disabled:S>=16,title:"Zoom in (ctrl/cmd + scroll on the timeline)",children:"+"}),c.jsx("button",{"data-testid":"zoom-fit",style:{...Nc,width:"auto",padding:"0 8px"},onClick:()=>N(1),disabled:S<=1,title:"Fit the whole clip in view",children:"fit"})]}),c.jsx("div",{ref:P,"data-testid":"timeline-scroller",style:iA,children:c.jsxs("div",{style:{width:`${S*100}%`,minWidth:"100%",paddingBottom:6},children:[c.jsx("div",{"data-testid":"ruler",style:sA,onMouseDown:I=>{I.preventDefault(),j(I.clientX),w.current=!0},children:(()=>{var Z;if(o<=0)return c.jsx("span",{style:Lc,children:"0:00"});const C=(((Z=P.current)==null?void 0:Z.clientWidth)??1200)*S/o;let M=[.5,1,2,5,10,15,30,60,120,300,600].find(L=>L*C>=70)??600;for(;o/(M/5)>600;)M*=2;const D=M/5,B=[];for(let L=0;L<=o+1e-6;L+=D){const z=Math.round(L/D)%5===0,Q=`${L/o*100}%`;B.push(c.jsx("div",{style:{position:"absolute",left:Q,bottom:0,width:1,height:z?8:4,background:z?"#3A3A44":"#26262e",pointerEvents:"none"}},L.toFixed(3))),z&&L+D<=o&&B.push(c.jsx("span",{style:{...Lc,position:"absolute",left:Q,top:0,transform:L===0?void 0:"translateX(-50%)",pointerEvents:"none"},children:Q$(L)},`l${L.toFixed(3)}`))}return c.jsxs(c.Fragment,{children:[B,c.jsx("span",{style:{...Lc,position:"absolute",right:2,top:0,pointerEvents:"none"},children:Ac(o,i)})]})})()}),c.jsxs("div",{ref:h,style:aA,onMouseDown:I=>{I.preventDefault(),j(I.clientX),w.current=!0},children:[e.map(I=>{const C=I.kind==="plain",A=(x==null?void 0:x.sceneId)===I.id,M=A?x.startSec:I.startSec,D=A?x.endSec:I.endSec,B=o>0?M/o*100:0,Z=o>0?Math.max(0,(D-M)/o*100):0,L=(a==null?void 0:a.sceneId)===I.id,z=C&&p?R[p((I.startSec+I.endSec)/2).toFixed(1)]:void 0;return c.jsxs("div",{"data-testid":`timeline-block-${I.id}`,onMouseDown:Q=>{var G;Q.stopPropagation(),Q.preventDefault(),l({sceneId:I.id,elementId:null}),g.current={sceneId:I.id,startX:Q.clientX,startContentX:Q.clientX-(((G=h.current)==null?void 0:G.getBoundingClientRect().left)??0),moved:!1,scrub:C}},style:{...qg,left:`${B}%`,width:`${Z}%`,zIndex:A?4:L?3:1,border:L?"2px solid #5b8cff":C?"1px solid #22222a":"1px solid #2A2A33",backgroundColor:L?"#1c2333":C?"#131318":"#1A1A21",...z?{backgroundImage:`linear-gradient(rgba(10,10,14,0.35), rgba(10,10,14,0.6)), url(${z})`,backgroundSize:"auto 100%, auto 100%",backgroundRepeat:"repeat-x"}:{}},children:[c.jsx("span",{style:C?z?{...Wa,color:"#D8D8DE",textShadow:"0 1px 2px rgba(0,0,0,0.9)"}:{...Wa,color:"#55555f"}:Wa,children:I.id}),!C&&I.pinned?c.jsx("span",{style:lA,children:"PIN"}):null,C?null:c.jsxs(c.Fragment,{children:[c.jsx("div",{onMouseDown:_(I,"start"),style:{...Qg,left:0,cursor:"ew-resize"}}),c.jsx("div",{onMouseDown:_(I,"end"),style:{...Qg,right:0,cursor:"ew-resize"}})]})]},I.id)}),t.map(I=>{const C=o>0?I.startSec/o*100:0,A=o>0?Math.max(0,(I.endSec-I.startSec)/o*100):0,M=(a==null?void 0:a.sceneId)===I.id;return c.jsx("div",{"data-testid":`timeline-block-${I.id}`,onMouseDown:D=>{D.stopPropagation(),D.preventDefault(),l({sceneId:I.id,elementId:null})},style:{...qg,left:`${C}%`,width:`${A}%`,zIndex:M?3:2,border:M?"2px dashed #5b8cff":"1px dashed #6a6a75",background:"transparent"},children:c.jsx("span",{style:{...Wa,color:"#6a6a75",textDecoration:"line-through"},children:I.id})},`ghost-${I.id}`)}),n.map((I,C)=>{const A=D=>o>0?Math.min(100,Math.max(0,D/o*100)):0;if(!I.src){const D=Math.min(Math.max(I.startSec,0),o),B=Math.min(Math.max(I.endSec,0),o),Z=A(D),L=o>0?Math.max(0,(B-D)/o*100):0;return c.jsx("div",{"data-testid":`timeline-cut-${I.startSec}-${I.endSec}`,style:{...uA,left:`${Z}%`,width:`${L}%`},children:c.jsx("div",{style:cA})},`cut-${C}-${I.startSec}-${I.endSec}`)}if(r.length===0)return null;const M=A(Y$(r,I.src.startSec));return c.jsx("div",{"data-testid":`timeline-cut-seam-${I.startSec}-${I.endSec}`,title:"Restore cut — the material returns on the next produce/Render",onMouseDown:D=>{D.stopPropagation(),D.preventDefault(),u.restoreChunk(C)},style:{...dA,left:`${M}%`},children:c.jsx("div",{style:fA})},`cut-${C}-${I.startSec}-${I.endSec}`)}),x?c.jsxs("div",{"data-testid":"drag-readout",style:{...Jg,left:`${o>0?x.startSec/o*100:0}%`,transform:o>0&&x.startSec/o>.85?"translateX(-100%)":Jg.transform},children:[Ac(x.startSec,i)," – ",Ac(x.endSec,i)]}):null,(x==null?void 0:x.snapped)!==null&&(x==null?void 0:x.snapped)!==void 0?c.jsx("div",{"data-testid":"snap-tick",style:{...pA,left:`${o>0?x.snapped/o*100:0}%`}}):null,c.jsx("div",{"data-testid":"playhead",style:{...hA,left:`${O}%`},children:c.jsx("div",{"data-testid":"playhead-grab",onMouseDown:I=>{I.stopPropagation(),I.preventDefault(),w.current=!0},style:mA})})]})]})})]})},tA={flexShrink:0,borderTop:"1px solid #1E1E24",background:"#111116",padding:"6px 20px 8px"},nA={display:"flex",justifyContent:"flex-end",alignItems:"center",gap:6,marginBottom:4},Nc={width:22,height:18,fontSize:12,lineHeight:1,color:"#EDEDF2",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:4,cursor:"pointer",padding:0},rA={fontSize:10,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#9A9AA3",minWidth:26,textAlign:"center"},oA={fontSize:10,color:"#55555f",marginRight:4,userSelect:"none"},iA={overflowX:"auto",overflowY:"hidden"},sA={position:"relative",height:18,padding:"0 2px",marginBottom:4,borderBottom:"1px solid #1E1E24",cursor:"ew-resize",userSelect:"none"},Lc={fontSize:10,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#9A9AA3"},aA={position:"relative",height:44,background:"#0F0F14",border:"1px solid #2A2A33",borderRadius:6,overflow:"visible",userSelect:"none"},qg={position:"absolute",top:3,bottom:3,borderRadius:4,boxSizing:"border-box",cursor:"pointer",display:"flex",alignItems:"center",overflow:"hidden"},Wa={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"},lA={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"},uA={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)"},cA={position:"absolute",left:0,right:0,top:"50%",height:2,background:"rgba(255,92,92,0.8)"},dA={position:"absolute",top:-4,bottom:-4,width:12,marginLeft:-6,zIndex:4,cursor:"pointer",pointerEvents:"auto"},fA={position:"absolute",left:"50%",top:0,bottom:0,width:2,background:"#FF5C5C",pointerEvents:"none"},Qg={position:"absolute",top:0,bottom:0,width:G$},pA={position:"absolute",top:-4,bottom:-4,width:1,zIndex:6,background:"#FFE14D",pointerEvents:"none"},Jg={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"},hA={position:"absolute",top:-26,bottom:-4,width:2,zIndex:5,background:"#FFE14D",pointerEvents:"none"},mA={position:"absolute",top:0,bottom:0,left:-4,width:10,pointerEvents:"auto",cursor:"ew-resize"};function gA(e,t,n){const r=e.filter(h=>We(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=We(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 vA(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?We(s[0].word):null,u=[];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(w=>We(w.word)!==null&&r(w.word)===void 0),m=l!==null&&We(p[0].word)===l;if(h&&!m&&i(p)===a){u.push({fromSrcStart:p[0].word.srcStart,toSrcStart:p[o-1].word.srcStart,was:p.map(w=>w.base).join(" ").normalize("NFC"),rawWas:p.map(w=>w.base).join(" ")}),f+=o;continue}f++}return u}function yA(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 u=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=u;h<f;h++){const m=Math.abs(e[h]);m>p&&(p=m)}s[l]=p}return{buckets:s,fromSec:n,toSec:r}}const eo=280,sn=48,Va=1;let Ha=null;const wA=e=>((Ha===null||Ha.key!==e)&&(Ha={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)}),Ha.promise),ev=6,tv=8,xA=e=>{const t=e.anchorTop+e.anchorHeight+ev,n=e.anchorTop-e.menuH-ev,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(tv,Math.min(i,e.clientWidth-e.menuW-tv));return{top:o,left:s}},nv="transcript-word-",rv=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^="${nv}"]`))??null;if(n===null)return null;const r=Number(n.getAttribute("data-testid").slice(nv.length));return Number.isInteger(r)?r:null},bA=e=>({lo:e.prev===null?e.track.start:e.prev.end===e.span.start?e.prev.start+Hl:e.prev.end,hi:e.next===null?e.track.end:e.next.start===e.span.end?e.next.end-Hl:e.next.start}),SA=(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)}},kA=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))}},EA=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},Ua=(e,t)=>{const n=e[t],r=n==null?void 0:n.words[0],o=We(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)}},CA=(e,t)=>{const n=[];let r=0;for(const o of e){const i=new Set(o.words.map(l=>We(l)).filter(l=>l!==null)),s=t[r],a=l=>{const u=We(l);return u!==null&&i.has(u)};s!==void 0&&s.words.some(a)?(n.push(r),r++):n.push(null)}return n},IA=({baseLines:e,liveLines:t,timingLines:n,fps:r,playerRef:o,edits:i,onDeleteWords:s,width:a,workdir:l})=>{const[u,f]=d.useState(""),[p,h]=d.useState(null),[m,w]=d.useState(null),[g,k]=d.useState(null),[v,y]=d.useState(null),[x,b]=d.useState(!1),S=d.useRef(null),[E,T]=d.useState(null),[R,P]=d.useState(null),[$,N]=d.useState(null),[W,j]=d.useState(!1),[_,H]=d.useState(null),[O,I]=d.useState(!1),C=d.useRef(null),A=d.useRef(null),M=d.useMemo(()=>{const F=new Map;for(const U of e)for(const ne of U.words){const ce=We(ne);if(ce===null)continue;const me=F.get(ce);me?me.push(ne.text):F.set(ce,[ne.text])}return F},[e]),D=d.useMemo(()=>{var ce;const F=[];let U=0;const ne=new Map;for(let me=0;me<t.length;me++){const ye=t[me];for(let Se=0;Se<ye.words.length;Se++){const _e=ye.words[Se],qe=We(_e);let Ae;if(qe!==null){const ze=ne.get(qe)??0;ne.set(qe,ze+1),Ae=(ce=M.get(qe))==null?void 0:ce[ze]}F.push({index:U,base:Ae??_e.text,live:_e.text,synthetic:qe!==null&&Ae===void 0,start:_e.start,end:_e.end,lineIndex:me,word:_e}),U++}}return F},[M,t]);d.useEffect(()=>{w(null),k(null)},[D.length]);const B=d.useMemo(()=>new Set(Object.keys(i.doc.captionWordsHidden)),[i.doc.captionWordsHidden]),Z=F=>{const U=We(F.word);return U!==null&&B.has(U)},L=d.useMemo(()=>Gp(D.map(F=>F.live).join(" ")),[D]);d.useEffect(()=>{if(L!=="rtl"||typeof FontFace>"u"||!document.fonts)return;let F=!1;for(const U of document.fonts)U.family===Os&&(F=!0);if(!F)try{new FontFace(Os,`url("/media/${S1}") format("truetype")`).load().then(ne=>document.fonts.add(ne),()=>{})}catch{}},[L]),d.useEffect(()=>{const F=o.current;if(!F)return;const U=ne=>{const ce=ne.detail.frame/r,me=D.find(ye=>ce>=ye.start&&ce<ye.end);N(ye=>me?me.index===ye?ye:me.index:ye)};return F.addEventListener("frameupdate",U),()=>F.removeEventListener("frameupdate",U)},[o,r,D]),d.useEffect(()=>{var F,U,ne;$!==null&&((ne=(U=(F=C.current)==null?void 0:F.querySelector(`[data-testid="transcript-word-${$}"]`))==null?void 0:U.scrollIntoView)==null||ne.call(U,{block:"nearest"}))},[$]);const z=u.trim().normalize("NFC").toLowerCase(),Q=d.useMemo(()=>z?D.filter(F=>F.live.normalize("NFC").toLowerCase().includes(z)).map(F=>F.index):[],[z,D]),G=d.useMemo(()=>z?new Set(Q):null,[z,Q]),[V,K]=d.useState(0),de=F=>{var U,ne,ce;(ce=(ne=(U=C.current)==null?void 0:U.querySelector(`[data-testid="transcript-word-${F}"]`))==null?void 0:ne.scrollIntoView)==null||ce.call(ne,{block:"center"})};d.useEffect(()=>{K(0),Q.length>0&&de(Q[0])},[Q]);const ve=F=>{if(Q.length===0)return;const U=(V+F+Q.length)%Q.length;K(U),de(Q[U])},ue=F=>{const U=F.draft.trim();U&&i.patchCaption(F.srcStart,U,F.base),h(null)},se=F=>{We(F.word)!==null&&ee(F.word)===void 0&&h({index:F.index,draft:F.live,srcStart:F.word.srcStart,base:F.base})},ee=F=>{const U=We(F);if(U===null)return;const ne=Number(U.slice(1));return i.doc.captionRangeEdits.find(ce=>{const me=Number(ce.fromKey.slice(1)),ye=Number(ce.toKey.slice(1));return ne>=Math.min(me,ye)&&ne<=Math.max(me,ye)})},X=m===null?null:Math.min(m.anchor,m.focus),J=m===null?null:Math.max(m.anchor,m.focus),ie=X===null||J===null?[]:D.slice(X,J+1),Fe=ie.length>0&&ie.every(Z),Ee=ie.some(F=>We(F.word)===null),be=ie.map(F=>ee(F.word)).find(F=>F!==void 0),Me=F=>{var qe,Ae,ze;if(p!==null||g!==null||v!==null)return;const U=C.current;if(!U)return;const ne=(qe=document.getSelection)==null?void 0:qe.call(document);if(!ne||ne.isCollapsed)return;const{anchorNode:ce,focusNode:me}=ne;if(!ce||!me||!U.contains(ce)||!U.contains(me))return;const ye=me.nodeType===3?me.parentElement:me;if((Ae=ye==null?void 0:ye.closest)!=null&&Ae.call(ye,"input, textarea"))return;const Se=rv(ce),_e=rv(me);Se===null||_e===null||F.detail>=2&&Se===_e||(w({anchor:Math.min(Se,_e),focus:Math.max(Se,_e)}),(ze=ne.removeAllRanges)==null||ze.call(ne))};d.useLayoutEffect(()=>{if(X===null||J===null){H(null);return}const F=C.current,U=(F==null?void 0:F.querySelector(`[data-testid="transcript-word-${X}"]`))??null,ne=(F==null?void 0:F.querySelector(`[data-testid="transcript-word-${J}"]`))??null;if(!F||ne===null){H(null);return}const ce=U!==null&&U.offsetTop===ne.offsetTop,me=ce?Math.min(U.offsetLeft,ne.offsetLeft):ne.offsetLeft,ye=ce?Math.max(U.offsetLeft+U.offsetWidth,ne.offsetLeft+ne.offsetWidth):ne.offsetLeft+ne.offsetWidth,Se=A.current,_e=xA({anchorTop:ne.offsetTop,anchorHeight:ne.offsetHeight,anchorLeft:me,anchorWidth:ye-me,menuW:(Se==null?void 0:Se.offsetWidth)??0,menuH:(Se==null?void 0:Se.offsetHeight)??0,scrollTop:F.scrollTop,clientWidth:F.clientWidth,clientHeight:F.clientHeight});H(qe=>qe!==null&&qe.top===_e.top&&qe.left===_e.left?qe:_e)},[X,J,a,p,g,v,_]),d.useEffect(()=>{I(!1),y(null)},[X,J]),d.useEffect(()=>{g!==null&&(X!==g.selLo||J!==g.selHi)&&k(null)},[g,X,J]);const xe=d.useMemo(()=>g!==null&&X!==null&&J!==null?vA(D,X,J,ee):[],[g,X,J,D,i.doc.captionRangeEdits]),Te=()=>{if(ie.length===0||Ee)return;const F=gA(ie.map(U=>({word:U.word,live:U.live,synthetic:U.synthetic})),X!==null&&X>0?D[X-1].end:null,i.doc);F!==null&&(s(F),w(null))},je=()=>{if(ie.length===0||Ee)return;const F=be;if(F!==void 0){const U=Math.min(Number(F.fromKey.slice(1)),Number(F.toKey.slice(1))),ne=Math.max(Number(F.fromKey.slice(1)),Number(F.toKey.slice(1))),ce=D.filter(me=>{const ye=We(me.word);if(ye===null)return!1;const Se=Number(ye.slice(1));return Se>=U&&Se<=ne});if(ce.length===0)return;w({anchor:ce[0].index,focus:ce[ce.length-1].index}),k({draft:ce.map(me=>me.live).join(" ").normalize("NFC"),fromSrcStart:Number(F.fromKey.slice(1))/1e3,toSrcStart:Number(F.toKey.slice(1))/1e3,was:ce.map(me=>me.base).join(" ").normalize("NFC"),rawWas:ce.map(me=>me.base).join(" "),covered:!0,selLo:ce[0].index,selHi:ce[ce.length-1].index});return}k({draft:ie.map(U=>U.live).join(" ").normalize("NFC"),fromSrcStart:ie[0].word.srcStart,toSrcStart:ie[ie.length-1].word.srcStart,was:ie.map(U=>U.base).join(" ").normalize("NFC"),rawWas:ie.map(U=>U.base).join(" "),covered:!1,selLo:X,selHi:J})},Ce=F=>{const U=F.draft.trim();if(U){const ne=U.split(/\s+/).filter(Boolean);!F.covered&&F.fromSrcStart===F.toSrcStart&&ne.length===1?i.patchCaption(F.fromSrcStart,U,F.rawWas):i.patchCaptionRange(F.fromSrcStart,F.toSrcStart,U,F.was),w(null)}k(null)},Le=F=>{const U=F.draft.trim();if(U){const ne=U.split(/\s+/).filter(Boolean);!F.covered&&F.fromSrcStart===F.toSrcStart&&ne.length===1?i.patchCaptionAllOccurrences([{srcStart:F.fromSrcStart,was:F.rawWas},...xe.map(ce=>({srcStart:ce.fromSrcStart,was:ce.rawWas}))],U):i.patchCaptionRangeAllOccurrences([{fromSrcStart:F.fromSrcStart,toSrcStart:F.toSrcStart,was:F.was},...xe],U),w(null)}k(null)},Rt=()=>{ie.length===0||Ee||(i.hideCaptionWords(ie.filter(F=>!Z(F)).map(F=>({srcStart:F.word.srcStart,was:F.live}))),w(null))},Lt=()=>{ie.length!==0&&(i.restoreCaptionWords(ie.filter(Z).map(F=>F.word.srcStart)),w(null))},pn=d.useMemo(()=>CA(t,n),[t,n]),zt=F=>{var ce;const U=pn[F]??null;if(U===null)return;const ne=We((ce=n[U])==null?void 0:ce.words[0]);return ne===null?void 0:i.doc.captionLineTiming[ne]},In=ie.length===0?0:ie[ie.length-1].lineIndex-ie[0].lineIndex+1,Tn=()=>{var qe,Ae;if(ie.length===0||Ee)return;const F=n,U=pn[ie[0].lineIndex]??null,ne=pn[ie[ie.length-1].lineIndex]??null;if(U===null||ne===null)return;const ce=[];for(let ze=U;ze<=ne;ze++){const Jr=Ua(F,ze);if(Jr===null)return;ce.push(Jr)}const me=ce[0],ye=ce[ce.length-1],Se={start:me.start,end:ye.end},_e=bA({prev:U>0?F[U-1]:null,next:ne<F.length-1?F[ne+1]:null,span:Se,track:{start:F[0].start,end:F[F.length-1].end}});y({track:F,from:U,to:ne,span:Se,bounds:_e,newSpan:SA({start:Se.start+(((qe=i.doc.captionLineTiming[me.key])==null?void 0:qe.lead)??0),end:Se.end+(((Ae=i.doc.captionLineTiming[ye.key])==null?void 0:Ae.tail)??0)},_e.lo,_e.hi)})},He=d.useMemo(()=>{if(v===null)return null;const F=[];for(let U=v.from;U<=v.to;U++){const ne=Ua(v.track,U);if(ne===null)return null;F.push(ne)}return{lines:F,prev:v.from>0?Ua(v.track,v.from-1):null,next:v.to<v.track.length-1?Ua(v.track,v.to+1):null}},[v]),hn=d.useMemo(()=>{var me,ye;if(v===null||He===null)return null;const{lines:F,prev:U,next:ne}=He,ce=i.doc.captionLineTiming;return EA({lines:F,span:v.span,newSpan:v.newSpan,prev:U===null?null:{...U,lead:((me=ce[U.key])==null?void 0:me.lead)??0},next:ne===null?null:{...ne,tail:((ye=ce[ne.key])==null?void 0:ye.tail)??0}})},[v,He,i.doc.captionLineTiming]),tn=d.useMemo(()=>{if(v===null||hn===null)return null;const F={...i.doc.captionLineTiming};for(const U of hn)F[vn(U.srcStart)]={lead:U.lead,tail:U.tail};return w1(v.track,F).lines},[v,hn,i.doc.captionLineTiming]),it=d.useMemo(()=>{if(v===null||tn===null)return null;const F=tn[v.from],U=tn[v.to];return F&&U?{start:F.start,end:U.end}:null},[v,tn]),jt=v===null?0:v.to-v.from+1,gt=d.useMemo(()=>{if(v===null||He===null)return null;const F=He.prev??He.lines[0],U=He.next??He.lines[He.lines.length-1];return{srcStart:F.srcStart,srcEnd:U.srcEnd,outStart:F.start,dur:U.srcEnd-F.srcStart+2*Va}},[v,He]);d.useEffect(()=>{P(null)},[l]),d.useEffect(()=>{if(v===null||R!==null)return;let F=!1;return wA(l).then(U=>{!F&&U!==null&&P(U)}),()=>{F=!0}},[v,R,l]);const Rn=F=>gt===null?0:(F-gt.outStart+Va)/gt.dur*eo;d.useEffect(()=>{var qe;if(v===null||it===null||tn===null||gt===null)return;const F=S.current,U=((qe=F==null?void 0:F.getContext)==null?void 0:qe.call(F,"2d"))??null;if(!F||!U)return;const ne=Rn;U.fillStyle="#0F0F14",U.fillRect(0,0,eo,sn);const ce=Math.floor(eo/2),me=R===null?new Float32Array(ce):yA(R.channel,R.sampleRate,gt.srcStart-Va,gt.srcEnd+Va,ce).buckets;U.fillStyle="#4a4a58";const ye=eo/ce;for(let Ae=0;Ae<ce;Ae++){const ze=Math.max(1,me[Ae]*(sn-4));U.fillRect(Ae*ye,(sn-ze)/2,Math.max(1,ye-1),ze)}U.fillStyle="rgba(255, 225, 77, 0.06)";for(const Ae of[v.from-1,v.to+1]){const ze=tn[Ae];ze&&U.fillRect(ne(ze.start),0,Math.max(1,ne(ze.end)-ne(ze.start)),sn)}const Se=ne(it.start),_e=ne(it.end);U.fillStyle="rgba(255, 225, 77, 0.18)",U.fillRect(Se,0,Math.max(1,_e-Se),sn),U.fillStyle="#7a7a88";for(let Ae=Math.max(0,v.from-1);Ae<=v.to+1;Ae++){const ze=tn[Ae];ze&&(Ae!==v.from&&U.fillRect(ne(ze.start),0,1,sn),Ae!==v.to&&U.fillRect(ne(ze.end),0,1,sn))}U.fillStyle="#FFE14D",U.fillRect(Se-1,0,2,sn),U.fillRect(_e-1,0,2,sn)},[v,it,tn,gt,R]);const wr=gt===null?0:gt.dur/eo,Dt=v===null||it===null||gt===null?null:{lead:Rn(it.start),tail:Rn(it.end)},nr=F=>U=>{v!==null&&(U.preventDefault(),T({edge:F,startX:U.clientX,span:v.newSpan}))};d.useEffect(()=>{if(E===null||v===null)return;const F=ne=>{y({...v,newSpan:kA({edge:E.edge,span:E.span,dSec:(ne.clientX-E.startX)*wr,lo:v.bounds.lo,hi:v.bounds.hi})})},U=()=>T(null);return window.addEventListener("pointermove",F),window.addEventListener("pointerup",U),window.addEventListener("pointercancel",U),window.addEventListener("blur",U),()=>{window.removeEventListener("pointermove",F),window.removeEventListener("pointerup",U),window.removeEventListener("pointercancel",U),window.removeEventListener("blur",U)}},[E,v,wr]),d.useEffect(()=>{v===null&&E!==null&&T(null)},[v,E]);const Qr=()=>{if(it===null)return;const F=o.current;if(F){if(x){F.pause(),b(!1);return}F.seekTo(Math.ceil(it.start*r)),F.play(),b(!0)}};d.useEffect(()=>{if(!x||it===null)return;const F=o.current;if(!F)return;const U=it.end,ne=ce=>{ce.detail.frame/r>=U&&(F.pause(),b(!1))};return F.addEventListener("frameupdate",ne),()=>F.removeEventListener("frameupdate",ne)},[x,it,r,o]),d.useEffect(()=>{const F=o.current;if(!F)return;const U=()=>b(!1);return F.addEventListener("pause",U),()=>F.removeEventListener("pause",U)}),d.useEffect(()=>{var F;v!==null||!x||((F=o.current)==null||F.pause(),b(!1))},[v,x,o]);const Po=F=>{i.patchCaptionLineTiming(F),y(null)};return c.jsxs("div",{"data-testid":"transcript-panel",style:{...TA,width:a},children:[c.jsxs("div",{style:RA,children:[c.jsx("span",{style:jA,children:"Transcript"}),c.jsxs("div",{style:VA,children:[c.jsx("span",{style:iv,children:"Click to jump · double-click to retype · drag to select"}),c.jsx("button",{"data-testid":"transcript-help-toggle",style:HA,onClick:()=>j(F=>!F),title:"What each gesture does","aria-label":"Transcript help","aria-expanded":W,children:"?"})]}),W?c.jsx("div",{"data-testid":"transcript-help",style:iv,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,c.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[c.jsx("input",{"data-testid":"transcript-search",style:{...PA,flex:1},placeholder:"Find a word…",value:u,onChange:F=>f(F.target.value),onKeyDown:F=>{F.key==="Enter"&&(F.preventDefault(),ve(F.shiftKey?-1:1))}}),c.jsx("button",{"data-testid":"transcript-prev",style:sv,onClick:()=>ve(-1),disabled:Q.length===0,title:"Previous match (⇧Enter)","aria-label":"Previous match",children:"‹"}),c.jsx("button",{"data-testid":"transcript-next",style:sv,onClick:()=>ve(1),disabled:Q.length===0,title:"Next match (Enter)","aria-label":"Next match",children:"›"})]}),G?c.jsx("div",{"data-testid":"transcript-match-count",style:{fontSize:11,color:"#9A9AA3"},children:Q.length===0?"0 matches":`${V+1}/${Q.length} match${Q.length===1?"":"es"}`}):null]}),c.jsxs("div",{style:_A,"data-testid":"transcript-body",dir:L,ref:C,onMouseUp:Me,tabIndex:0,onKeyDown:F=>{if(!(p!==null||g!==null)){if(v!==null){F.key==="Escape"&&(F.stopPropagation(),y(null));return}if(F.key==="Escape"){if(m===null)return;F.stopPropagation(),w(null),k(null);return}(F.key==="Delete"||F.key==="Backspace")&&m!==null&&(F.preventDefault(),F.stopPropagation(),Fe?Lt():Te())}},children:[D.map((F,U)=>{const ne=ee(F.word),ce=zt(F.lineIndex),me=Z(F)?"hidden from captions — select and Restore":ne!==void 0?`part of a rewritten range (was “${ne.was}”) — select it and use Edit`:F.synthetic?`rewritten (was “${F.base}”) — select and Edit to change`:F.live!==F.base?`edited (was “${F.base}”) — double-click to retype`:"click to jump · double-click to retype";return c.jsxs(oe.Fragment,{children:[U>0?" ":null,(p==null?void 0:p.index)===F.index?c.jsx("input",{autoFocus:!0,"data-testid":"transcript-edit",style:YA,value:p.draft,onChange:ye=>h({...p,draft:ye.target.value}),onBlur:()=>ue(p),onKeyDown:ye=>{ye.key==="Enter"&&ye.target.blur(),ye.key==="Escape"&&h(null)}}):c.jsx("span",{"data-testid":`transcript-word-${F.index}`,onClick:ye=>{var Se;if(g!==null&&k(null),v!==null&&y(null),ye.shiftKey){w(_e=>_e===null?{anchor:F.index,focus:F.index}:{..._e,focus:F.index});return}(Se=o.current)==null||Se.seekTo(Math.ceil(F.start*r)),w({anchor:F.index,focus:F.index})},onDoubleClick:()=>se(F),title:ce===void 0?me:`${me} · caption timing adjusted (${Math.round(ce.lead*1e3)}ms in / ${Math.round(ce.tail*1e3)}ms out) — Timing to change`,style:{...FA,...ce!==void 0?DA:{},...Z(F)?zA:{},...F.live!==F.base||F.synthetic?AA:{},...X!==null&&F.index>=X&&F.index<=J?LA:{},...G!=null&&G.has(F.index)?MA:{},...Q[V]===F.index?$A:{},...$===F.index?NA:{}},children:F.live})]},F.index)}),m!==null&&_!==null&&p===null&&g===null&&v===null?c.jsxs("div",{"data-testid":"transcript-selection-menu",role:"menu",ref:A,dir:"ltr",style:{...ul,top:_.top,left:_.left},children:[c.jsx(Do,{"data-testid":"transcript-edit-range",onClick:je,disabled:Ee,title:Ee?"A selected word has no source anchor (this project predates them) — re-run produce first":be!==void 0?"Re-edit the rewritten range this selection touches":ie.length===1?"Retype this word (1:1 — same as double-click)":"Rewrite these words as free text — word count may change",children:"Edit"}),c.jsx(Do,{"data-testid":"transcript-timing",onClick:Tn,disabled:ie.length===0||Ee,title:Ee?"A selected word has no source anchor (this project predates them) — re-run produce first":In===1?"Adjust when this caption appears and leaves":`Adjust when these ${In} captions appear and leave`,children:"Timing"}),Fe?c.jsx(Do,{"data-testid":"transcript-restore",onClick:Lt,title:"Show these words in the captions again",children:"Restore"}):c.jsxs("span",{style:{position:"relative"},children:[c.jsx(Do,{"data-testid":"transcript-delete-menu",onClick:()=>I(F=>!F),title:"Delete these words — from the captions only, or from the video too",children:"Delete ▾"}),O?c.jsxs("div",{"data-testid":"transcript-delete-flyout",dir:"ltr",style:UA,children:[c.jsx(Do,{"data-testid":"transcript-hide",onClick:()=>{I(!1),Rt()},disabled:Ee,title:Ee?"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"}),c.jsx(Do,{"data-testid":"transcript-delete",onClick:()=>{I(!1),Te()},disabled:Ee,title:Ee?"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]}),c.jsxs("span",{style:av,children:[ie.length," word",ie.length===1?"":"s"]})]}):null,g!==null&&_!==null?c.jsxs("div",{"data-testid":"transcript-range-popover",ref:A,dir:"ltr",style:{...ul,top:_.top,left:_.left,flexDirection:"column",alignItems:"stretch",gap:6},children:[c.jsx("textarea",{autoFocus:!0,"data-testid":"transcript-range-edit",rows:3,dir:"auto",style:KA,value:g.draft,onChange:F=>k({...g,draft:F.target.value}),onKeyDown:F=>{F.key==="Enter"&&!F.shiftKey&&(F.preventDefault(),Ce(g)),F.key==="Escape"&&k(null)}}),c.jsxs("div",{style:{display:"flex",gap:6},children:[c.jsx("button",{"data-testid":"transcript-apply",style:Oo,onClick:()=>Ce(g),title:"Rewrite this selection (Enter)",children:"Apply"}),xe.length>0?c.jsxs("button",{"data-testid":"transcript-apply-all",style:Oo,onClick:()=>Le(g),title:"Rewrite this selection AND every other place the same words occur — one undo step",children:["Apply to all (",xe.length,")"]}):null,c.jsx("button",{style:Oo,onClick:()=>k(null),title:"Discard the rewrite (Esc)",children:"Cancel"})]})]}):null,v!==null&&it!==null&&_!==null?c.jsxs("div",{"data-testid":"transcript-timing-popover",ref:A,dir:"ltr",style:{...ul,top:_.top,left:_.left,flexDirection:"column",alignItems:"stretch",gap:6},children:[c.jsxs("div",{style:{position:"relative",width:eo,height:sn},children:[c.jsx("canvas",{"data-testid":"transcript-timing-canvas",ref:S,width:eo,height:sn,style:{display:"block",borderRadius:4}}),Dt!==null?c.jsxs(c.Fragment,{children:[c.jsx("div",{"data-testid":"transcript-timing-band",title:jt===1?"Drag to shift this caption, its duration intact":"Drag to shift these captions, every duration intact",onPointerDown:nr("band"),style:{...BA,left:Dt.lead,width:Math.max(0,Dt.tail-Dt.lead),cursor:(E==null?void 0:E.edge)==="band"?"grabbing":"grab"}}),c.jsx(ov,{"data-testid":"transcript-timing-handle-lead",title:jt===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:Dt.lead,active:(E==null?void 0:E.edge)==="lead",onPointerDown:nr("lead")}),c.jsx(ov,{"data-testid":"transcript-timing-handle-tail",title:jt===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:Dt.tail,active:(E==null?void 0:E.edge)==="tail",onPointerDown:nr("tail")})]}):null]}),c.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[c.jsx("button",{"data-testid":"transcript-timing-play",style:Oo,onClick:Qr,title:x?"Pause":jt===1?"Play just this caption's span":"Play just these captions' span",children:x?"Pause":"Play"}),c.jsxs("span",{"data-testid":"transcript-timing-span",style:av,children:[it.start.toFixed(2),"s – ",it.end.toFixed(2),"s",` · ${jt} caption${jt===1?"":"s"}`]}),c.jsx("button",{"data-testid":"transcript-timing-apply",style:Oo,onClick:()=>{hn!==null&&Po(hn)},title:jt===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"}),c.jsx("button",{"data-testid":"transcript-timing-cancel",style:Oo,onClick:()=>y(null),title:"Discard the nudge (Esc)",children:"Cancel"})]})]}):null]})]})},Do=({children:e,...t})=>{const[n,r]=d.useState(!1);return c.jsx("button",{role:"menuitem",...t,style:{...ZA,...n&&!t.disabled?{background:"#34343F"}:{},...t.disabled?{opacity:.5,cursor:"default"}:{}},onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:e})},ov=({x:e,active:t,...n})=>{const[r,o]=d.useState(!1);return c.jsx("div",{...n,style:{...OA,left:e-Y1/2},onPointerEnter:()=>o(!0),onPointerLeave:()=>o(!1),children:c.jsx("div",{style:{...WA,background:t?"#fff":r?"#FFF0A0":"#FFE14D",width:t?4:2}})})},TA={flexShrink:0,display:"flex",flexDirection:"column",background:"#111116",minHeight:0},RA={display:"flex",flexDirection:"column",gap:8,padding:"14px 14px 10px",borderBottom:"1px solid #1E1E24"},jA={fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"#9A9AA3"},iv={fontSize:11,lineHeight:1.45,color:"#6a6a75"},PA={fontFamily:"'Inter', system-ui, sans-serif",fontSize:13,background:"#0F0F14",border:"1px solid #2A2A33",borderRadius:6,color:"#fff",padding:"6px 8px"},_A={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"},FA={cursor:"pointer",borderRadius:3,padding:"2px 4px",unicodeBidi:"isolate"},MA={background:"#2b2b1a",outline:"1px solid #6b6432"},$A={background:"#3d3a17",outline:"2px solid #FFE14D",color:"#fff"},sv={width:26,height:30,fontSize:16,lineHeight:1,color:"#EDEDF2",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:6,cursor:"pointer",padding:0},AA={color:"#FFE14D"},NA={textDecoration:"underline",textUnderlineOffset:4},LA={background:"#FFE14D",color:"#111",borderRadius:0,boxShadow:"-4px 0 0 0 #FFE14D, 4px 0 0 0 #FFE14D"},zA={textDecoration:"line-through",color:"#6a6a75"},DA={borderBottom:"1px dotted #9A9AA3"},Y1=12,OA={position:"absolute",top:0,width:Y1,height:sn,cursor:"ew-resize",touchAction:"none",display:"flex",justifyContent:"center"},BA={position:"absolute",top:0,height:sn,touchAction:"none"},WA={height:"100%",borderRadius:1,pointerEvents:"none"},VA={display:"flex",gap:6,alignItems:"center",justifyContent:"space-between"},HA={width:20,height:20,fontSize:11,lineHeight:1,color:"#9A9AA3",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:6,cursor:"pointer",padding:0,flexShrink:0},ul={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},UA={...ul,top:"100%",left:0,marginTop:4,zIndex:32,minWidth:170,flexDirection:"column",alignItems:"stretch"},av={fontSize:11,color:"#9A9AA3",paddingInline:"6px 8px",whiteSpace:"nowrap"},ZA={fontSize:12,fontWeight:600,color:"#EDEDF2",background:"transparent",border:"none",borderRadius:6,padding:"6px 10px",cursor:"pointer",textAlign:"left",whiteSpace:"nowrap"},KA={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"},Oo={fontSize:11,color:"#EDEDF2",background:"#34343F",border:"1px solid #45454F",borderRadius:6,cursor:"pointer",padding:"4px 8px"},YA={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"},GA=[{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"]]}],XA=({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]),c.jsx("div",{style:qA,onMouseDown:e,children:c.jsxs("div",{"data-testid":"shortcuts-modal",style:QA,onMouseDown:t=>t.stopPropagation(),children:[c.jsxs("div",{style:JA,children:[c.jsx("span",{style:e3,children:"keybinds"}),c.jsx("span",{style:t3,children:"esc close"})]}),c.jsx("div",{style:n3,children:"available commands and configured shortcuts"}),GA.map(t=>c.jsxs("div",{style:{marginTop:18},children:[c.jsx("div",{style:r3,children:t.title}),t.rows.map(([n,r])=>c.jsxs("div",{style:o3,children:[c.jsx("span",{style:i3,children:n}),c.jsx("span",{style:s3,children:r})]},n))]},t.title))]})})),qA={position:"fixed",inset:0,zIndex:30,background:"rgba(5,5,8,0.6)",display:"flex",alignItems:"center",justifyContent:"center"},QA={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"},JA={display:"flex",justifyContent:"space-between",alignItems:"center"},e3={fontSize:18,fontWeight:700,color:"#EDEDF2"},t3={fontSize:13,fontWeight:700,color:"#0B0B0E",background:"#a8c7fa",borderRadius:4,padding:"3px 10px"},n3={fontSize:13,color:"#6a6a75",marginTop:4},r3={fontSize:14,fontWeight:700,color:"#8ab4f8",marginBottom:6},o3={display:"flex",gap:16,padding:"3px 0"},i3={width:290,flexShrink:0,color:"#c5a3ff",fontWeight:600,fontSize:13},s3={color:"#C9C9D4",fontSize:13},lv={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`}},a3=({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 u=i.current;if(!u)return;const f=u.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 u;return(u=a==null?void 0:a.focus)==null?void 0:u.call(a)}},[]),c.jsx("div",{style:l3,onMouseDown:n,children:c.jsxs("form",{ref:i,"data-testid":"delete-scene-modal",role:"dialog","aria-modal":"true","aria-label":`Delete ${e.rootId}`,style:u3,onMouseDown:a=>a.stopPropagation(),onSubmit:a=>{a.preventDefault(),t(r)},children:[c.jsxs("div",{style:c3,children:[c.jsxs("span",{style:d3,children:["delete ",e.rootId,e.isSplitHalf?c.jsx("span",{style:f3,children:"half"}):null,"?"]}),c.jsx("span",{style:p3,children:"esc cancel"})]}),c.jsx("div",{style:h3,children:"undoable with ⌘Z, like every other edit"}),c.jsx("div",{style:{marginTop:16},children:e.targets.map(a=>c.jsxs("label",{style:m3,"data-testid":`delete-option-${a}`,children:[c.jsx("input",{type:"radio",name:"delete-target",value:a,checked:r===a,onChange:()=>o(a),style:g3}),c.jsxs("span",{children:[c.jsx("span",{style:v3,children:lv[a].label}),c.jsx("span",{style:y3,children:lv[a].detail(e)})]})]},a))}),c.jsxs("div",{style:w3,children:[c.jsx("button",{type:"button","data-testid":"delete-cancel",style:G1,onClick:n,children:"Cancel"}),c.jsx("button",{ref:s,type:"submit","data-testid":"delete-confirm",style:x3,children:"Delete"})]})]})})},l3={position:"fixed",inset:0,zIndex:30,background:"rgba(5,5,8,0.6)",display:"flex",alignItems:"center",justifyContent:"center"},u3={width:420,maxWidth:"90vw",background:"#12121A",border:"1px solid #3A3A48",borderRadius:8,padding:"18px 22px 20px",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace"},c3={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12},d3={fontSize:16,fontWeight:700,color:"#EDEDF2"},f3={fontSize:11,fontWeight:700,color:"#0B0B0E",background:"#c5a3ff",borderRadius:4,padding:"2px 6px",marginLeft:6},p3={fontSize:12,fontWeight:700,color:"#0B0B0E",background:"#a8c7fa",borderRadius:4,padding:"3px 10px",whiteSpace:"nowrap"},h3={fontSize:12,color:"#6a6a75",marginTop:4},m3={display:"flex",alignItems:"flex-start",gap:10,padding:"8px 0",cursor:"pointer"},g3={accentColor:"#8ab4f8",marginTop:2,cursor:"pointer"},v3={display:"block",fontSize:13,fontWeight:600,color:"#EDEDF2"},y3={display:"block",fontSize:12,color:"#9A9AA3",marginTop:2},w3={display:"flex",justifyContent:"flex-end",gap:8,marginTop:14},G1={fontSize:12,fontWeight:600,color:"#C9C9D4",background:"transparent",border:"1px solid #2A2A33",borderRadius:6,padding:"7px 12px",cursor:"pointer",fontFamily:"inherit"},x3={...G1,color:"#FF5C5C",border:"1px solid #452626"},uv={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`}},b3=({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=u=>{if(u.key==="Escape"){u.stopPropagation(),n();return}if(u.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||(u.shiftKey&&document.activeElement===h?(u.preventDefault(),m.focus()):!u.shiftKey&&document.activeElement===m&&(u.preventDefault(),h.focus()))};return window.addEventListener("keydown",l,!0),()=>window.removeEventListener("keydown",l,!0)},[n]),d.useEffect(()=>{var u;const l=document.activeElement;return(u=s.current)==null||u.focus(),()=>{var f;return(f=l==null?void 0:l.focus)==null?void 0:f.call(l)}},[]);const a=e.words.length;return c.jsx("div",{style:S3,onMouseDown:n,children:c.jsxs("form",{ref:i,"data-testid":"delete-words-modal",role:"dialog","aria-modal":"true","aria-label":`Delete ${a} word${a===1?"":"s"}`,style:k3,onMouseDown:l=>l.stopPropagation(),onSubmit:l=>{l.preventDefault(),t(r)},children:[c.jsxs("div",{style:E3,children:[c.jsxs("span",{style:C3,children:["delete ",a," word",a===1?"":"s","?"]}),c.jsx("span",{style:I3,children:"esc cancel"})]}),c.jsx("div",{style:T3,children:"undoable with ⌘Z, like every other edit"}),c.jsx("div",{style:{marginTop:16},children:e.targets.map(l=>c.jsxs("label",{style:R3,"data-testid":`delete-words-option-${l}`,children:[c.jsx("input",{type:"radio",name:"delete-words-target",value:l,checked:r===l,onChange:()=>o(l),style:j3}),c.jsxs("span",{children:[c.jsx("span",{style:P3,children:uv[l].label}),c.jsx("span",{style:_3,children:uv[l].detail(e)})]})]},l))}),c.jsxs("div",{style:F3,children:[c.jsx("button",{type:"button","data-testid":"delete-words-cancel",style:X1,onClick:n,children:"Cancel"}),c.jsx("button",{ref:s,type:"submit","data-testid":"delete-words-confirm",style:M3,children:"Delete"})]})]})})},S3={position:"fixed",inset:0,zIndex:30,background:"rgba(5,5,8,0.6)",display:"flex",alignItems:"center",justifyContent:"center"},k3={width:420,maxWidth:"90vw",background:"#12121A",border:"1px solid #3A3A48",borderRadius:8,padding:"18px 22px 20px",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace"},E3={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12},C3={fontSize:16,fontWeight:700,color:"#EDEDF2"},I3={fontSize:12,fontWeight:700,color:"#0B0B0E",background:"#a8c7fa",borderRadius:4,padding:"3px 10px",whiteSpace:"nowrap"},T3={fontSize:12,color:"#6a6a75",marginTop:4},R3={display:"flex",alignItems:"flex-start",gap:10,padding:"8px 0",cursor:"pointer"},j3={accentColor:"#8ab4f8",marginTop:2,cursor:"pointer"},P3={display:"block",fontSize:13,fontWeight:600,color:"#EDEDF2"},_3={display:"block",fontSize:12,color:"#9A9AA3",marginTop:2},F3={display:"flex",justifyContent:"flex-end",gap:8,marginTop:14},X1={fontSize:12,fontWeight:600,color:"#C9C9D4",background:"transparent",border:"1px solid #2A2A33",borderRadius:6,padding:"7px 12px",cursor:"pointer",fontFamily:"inherit"},M3={...X1,color:"#FF5C5C",border:"1px solid #452626"},$3=(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("/")}},cv=e=>e.scrollTop+e.clientHeight<e.scrollHeight-1,A3=(e,t,n)=>n<=0?-1:Math.max(0,Math.min(n-1,e+t)),dv=({recent:e,required:t,onOpen:n,onClose:r})=>{const[o,i]=d.useState(null),[s,a]=d.useState(null),[l,u]=d.useState(!1),f=d.useRef(null),p=d.useRef(null),[h,m]=d.useState(!1),[w,g]=d.useState(!1),k=()=>{m(f.current?cv(f.current):!1)},v=()=>{g(p.current?cv(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(),v()};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 x=S=>{var $;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 R=T.indexOf(document.activeElement),P=S.key==="Home"?0:S.key==="End"?T.length-1:A3(R,E,T.length);S.preventDefault(),($=T[P])==null||$.focus()},b=S=>{u(!0),a(null),n(S).then(E=>{u(!1),E&&a(E)})};return c.jsx("div",{style:N3,onMouseDown:t?void 0:r,children:c.jsxs("div",{"data-testid":"project-picker",style:L3,onMouseDown:S=>S.stopPropagation(),children:[c.jsxs("div",{style:z3,children:[c.jsx("span",{style:D3,children:t?"open a project":"switch project"}),t?null:c.jsx("button",{"data-testid":"project-picker-close",style:O3,onClick:r,children:"esc close"})]}),c.jsx("div",{style:B3,children:"A project is a work directory a `ossclip produce` run wrote — the folder holding render-props.json."}),s?c.jsx("div",{"data-testid":"project-picker-error",style:W3,children:s}):null,e.length>0?c.jsxs("div",{style:{marginTop:16,flexShrink:0},children:[c.jsx("div",{style:fv,children:"recent"}),c.jsx("div",{ref:p,className:"ossclip-scroll-list",style:w?{...pv,...mv}:pv,onScroll:v,onKeyDown:x,"data-testid":"project-recent-list",children:e.map(S=>{const{head:E,tail:T}=$3(S);return c.jsxs("button",{"data-testid":"project-recent",className:"ossclip-picker-row",style:{...zc,...K3},disabled:l,onClick:()=>b(S),title:S,children:[c.jsx("span",{style:{color:"#FFE14D",flexShrink:0},children:"▸"}),c.jsxs("span",{style:Y3,children:[c.jsx("span",{style:G3,children:T}),E?c.jsx("span",{style:X3,children:E}):null]})]},S)})})]}):null,c.jsxs("div",{style:Z3,children:[c.jsx("div",{style:fv,children:"browse"}),c.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 ",c.jsx("span",{style:{color:"#FFE14D"},children:"▸ .ossclip/…"})," entries."]}),o?c.jsxs(c.Fragment,{children:[c.jsxs("div",{style:V3,children:[c.jsx("span",{style:H3,title:o.dir,children:o.dir}),o.isWorkdir?c.jsx("button",{"data-testid":"project-open-current",style:U3,disabled:l,onClick:()=>b(o.dir),children:"open this project"}):null]}),c.jsxs("div",{ref:f,className:"ossclip-scroll-list",style:h?{...hv,...mv}:hv,onScroll:k,onKeyDown:x,"data-testid":"project-fs-list",children:[o.parent?c.jsxs("button",{"data-testid":"project-fs-up",className:"ossclip-picker-row",style:zc,disabled:l,onClick:()=>void y(o.parent),children:[c.jsx("span",{style:{color:"#6a6a75",flexShrink:0},children:"↑"}),c.jsx("span",{style:gv,children:".."})]}):null,o.entries.map(S=>c.jsxs("button",{"data-testid":S.isWorkdir?"project-fs-workdir":"project-fs-dir",className:`ossclip-picker-row${S.isWorkdir?" is-workdir":""}`,style:zc,disabled:l,onClick:()=>S.isWorkdir?b(S.path):void y(S.path),title:S.path,children:[c.jsx("span",{style:{flexShrink:0,color:S.isWorkdir?"#FFE14D":"#6a6a75"},children:S.isWorkdir?"▸":"▪"}),c.jsxs("span",{style:gv,children:[S.name,S.isWorkdir?null:c.jsx("span",{style:{color:"#55555f"},children:"/"})]}),S.isWorkdir?c.jsx("span",{style:q3,children:"project"}):null]},S.path)),o.entries.length===0?c.jsx("div",{style:{color:"#6a6a75",fontSize:12,padding:"6px 8px"},children:"no folders here"}):null]})]}):c.jsx("div",{style:{color:"#6a6a75",fontSize:13},children:"loading…"})]})]})})},N3={position:"fixed",inset:0,zIndex:30,background:"rgba(5,5,8,0.6)",display:"flex",alignItems:"center",justifyContent:"center"},L3={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"},z3={display:"flex",justifyContent:"space-between",alignItems:"center"},D3={fontSize:18,fontWeight:700,color:"#EDEDF2"},O3={fontSize:13,fontWeight:700,color:"#0B0B0E",background:"#a8c7fa",border:"none",borderRadius:4,padding:"3px 10px",cursor:"pointer"},B3={fontSize:13,color:"#6a6a75",marginTop:4},W3={marginTop:12,fontSize:13,color:"#FF5C5C"},fv={fontSize:14,fontWeight:700,color:"#8ab4f8",marginBottom:6},V3={display:"flex",alignItems:"center",gap:10,marginBottom:6},H3={fontSize:12,color:"#9A9AA3",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},U3={flexShrink:0,fontSize:12,fontWeight:700,color:"#0B0B0E",background:"#FFE14D",border:"1px solid #FFE14D",borderRadius:6,padding:"4px 10px",cursor:"pointer"},Z3={marginTop:16,display:"flex",flexDirection:"column",flex:1,minHeight:0},pv={maxHeight:218,overflowY:"auto",overscrollBehavior:"contain",flexShrink:0,display:"flex",flexDirection:"column",gap:2},hv={flex:1,minHeight:0,overflowY:"auto",overscrollBehavior:"contain",display:"flex",flexDirection:"column",gap:2},mv={maskImage:"linear-gradient(to bottom, black calc(100% - 24px), transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black calc(100% - 24px), transparent 100%)"},zc={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"},gv={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},K3={minHeight:46,alignItems:"center"},Y3={display:"flex",flexDirection:"column",minWidth:0},G3={color:"#EDEDF2",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},X3={fontSize:11,color:"#6a6a75",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},q3={marginLeft:10,fontSize:11,fontWeight:700,color:"#FFE14D"},Q3=({defaultOutPath:e,onCancel:t,onConfirm:n})=>{const[r,o]=d.useState(e??""),[i,s]=d.useState(!1);d.useEffect(()=>{const l=u=>{u.key==="Escape"?(u.stopPropagation(),t()):u.key==="Enter"&&!i&&(u.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 u=await l.json();u.path&&o(u.path)}}catch{}finally{s(!1)}};return c.jsx("div",{style:J3,onMouseDown:t,children:c.jsxs("div",{"data-testid":"render-modal",style:eN,onMouseDown:l=>l.stopPropagation(),children:[c.jsxs("div",{style:tN,children:[c.jsx("div",{style:nN,children:"🎬 Render Master Video"}),c.jsx("button",{style:rN,onClick:t,children:"✕"})]}),c.jsx("div",{style:oN,children:"Choose where to export your rendered master cut, or keep the default location."}),c.jsxs("div",{style:{marginTop:20},children:[c.jsx("label",{style:iN,children:"Export File Destination"}),c.jsxs("div",{style:sN,children:[c.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:aN,autoFocus:!0}),c.jsx("button",{"data-testid":"render-browse-btn",style:lN,onClick:a,disabled:i,title:"Open native file picker to choose destination",children:i?"Browsing…":"📁 Browse…"})]})]}),c.jsxs("div",{style:uN,children:[c.jsx("button",{style:cN,onClick:t,children:"Cancel"}),c.jsx("button",{"data-testid":"render-confirm-btn",style:dN,onClick:()=>n(r.trim()?r.trim():void 0),children:"Start Render ⚡"})]})]})})},J3={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},eN={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"},tN={display:"flex",justifyContent:"space-between",alignItems:"center"},nN={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},rN={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},oN={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},iN={display:"block",fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.04em"},sN={display:"flex",gap:8},aN={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"},lN={background:"#1E1E2A",border:"1px solid #3A3A48",borderRadius:6,color:"#EDEDF2",padding:"0 16px",fontSize:13,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap"},uN={display:"flex",justifyContent:"flex-end",gap:12,marginTop:24},cN={background:"transparent",border:"1px solid #2C2C38",borderRadius:6,color:"#C9C9D4",padding:"9px 18px",fontSize:13,fontWeight:600,cursor:"pointer"},dN={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 fN(e){switch(e){case"override":return"Project override";case"flag":case"config":return"Your default portrait"}}function pN(e){const t=/^data:([^;,]+);base64,(.+)$/s.exec(e);return t?{mimeType:t[1],data:t[2]}:null}function hN(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 vv=60,mN=({onClose:e})=>{const[t,n]=d.useState(null),[r,o]=d.useState(null),[i,s]=d.useState(""),[a,l]=d.useState(""),[u,f]=d.useState(""),[p,h]=d.useState(null),[m,w]=d.useState(!1),[g,k]=d.useState(null),[v,y]=d.useState(null),x=d.useRef(null);d.useEffect(()=>{const P=$=>{$.key==="Escape"&&($.stopPropagation(),e())};return window.addEventListener("keydown",P,!0),()=>window.removeEventListener("keydown",P,!0)},[e]),d.useEffect(()=>{(async()=>{try{const P=await fetch("/api/thumbnail"),$=await P.json();if(!P.ok)throw new Error($.error??`GET /api/thumbnail failed: ${P.status}`);n($),h($.imageUrl),$.concept&&(s($.concept.overlayText),l($.concept.scene),f($.concept.styleNotes))}catch(P){o(P instanceof Error?P.message:String(P))}})()},[]);const b=async()=>{w(!0),k(null);try{const P=await fetch("/api/thumbnail/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({concept:{scene:a,overlayText:i,styleNotes:u}})}),$=await P.json();if(!P.ok||$.ok!==!0){k($.error??`regenerate failed: ${P.status}`);return}h($.imageUrl??null)}catch(P){k(P instanceof Error?P.message:String(P))}finally{w(!1)}},S=P=>{n($=>$&&{...$,portrait:P})},E=async P=>{y(null);try{const $=await new Promise((_,H)=>{const O=new FileReader;O.onload=()=>_(String(O.result)),O.onerror=()=>H(new Error("could not read the image file")),O.readAsDataURL(P)}),N=pN($);if(N===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(N)}),j=await W.json();if(!W.ok||j.ok!==!0){y(j.error??`swap failed: ${W.status}`);return}S(j.portrait??null)}catch($){y($ instanceof Error?$.message:String($))}},T=async()=>{y(null);try{const P=await fetch("/api/thumbnail/portrait",{method:"DELETE"}),$=await P.json();if(!P.ok||$.ok!==!0){y($.error??`reset failed: ${P.status}`);return}S($.portrait??null)}catch(P){y(P instanceof Error?P.message:String(P))}},R=(t==null?void 0:t.status)==="unavailable";return c.jsx("div",{style:gN,onMouseDown:e,children:c.jsxs("div",{"data-testid":"thumbnail-modal",style:vN,onMouseDown:P=>P.stopPropagation(),children:[c.jsxs("div",{style:yN,children:[c.jsx("div",{style:wN,children:"AI Thumbnail"}),c.jsx("button",{style:xN,onClick:e,"aria-label":"Close",children:"✕"})]}),r?c.jsxs("div",{"data-testid":"thumbnail-load-error",style:Wc,children:["Couldn't load the thumbnail state: ",r]}):t===null?c.jsx("div",{style:Dc,children:"Loading…"}):R?c.jsx("div",{"data-testid":"thumbnail-unavailable",style:{...Dc,marginTop:12},children:hN(t.reason)}):c.jsxs(c.Fragment,{children:[t.status==="skipped"?c.jsx("div",{"data-testid":"thumbnail-skipped-note",style:{...Dc,marginTop:8},children:"Thumbnail was skipped at the concept approval prompt — regenerating replaces that decision."}):null,c.jsx("div",{style:bN,children:p?c.jsx("img",{"data-testid":"thumbnail-image",src:p,alt:"Current AI thumbnail",style:SN}):c.jsx("div",{"data-testid":"thumbnail-placeholder",style:kN,children:"No thumbnail generated yet — edit the concept and hit Regenerate."})}),t.portrait?c.jsxs("div",{"data-testid":"portrait-strip",style:EN,children:[c.jsx("img",{"data-testid":"portrait-preview",src:t.portrait.url,alt:"Portrait reference",style:CN}),c.jsxs("div",{style:{flex:1,minWidth:0},children:[c.jsx("div",{"data-testid":"portrait-source",style:IN,children:fN(t.portrait.source)}),c.jsx("div",{style:wv,children:"The swap applies to this project only and is used by future renders too."})]}),c.jsx("button",{"data-testid":"portrait-swap-btn",style:yv,onClick:()=>{var P;return(P=x.current)==null?void 0:P.click()},disabled:m,children:"Swap face…"}),t.portrait.source==="override"?c.jsx("button",{"data-testid":"portrait-reset-btn",style:yv,onClick:()=>void T(),disabled:m,children:"Use default"}):null,c.jsx("input",{ref:x,"data-testid":"portrait-file-input",type:"file",accept:"image/png,image/jpeg,image/webp",style:{display:"none"},onChange:P=>{var N;const $=(N=P.target.files)==null?void 0:N[0];P.target.value="",$&&E($)}})]}):null,v?c.jsx("div",{"data-testid":"portrait-error",style:Wc,children:v}):null,c.jsxs("div",{style:{marginTop:16},children:[c.jsxs("label",{style:Oc,children:["Overlay text — the words ON the image (",vv," chars, 4–9 words)"]}),c.jsx("input",{"data-testid":"thumbnail-overlay-input",type:"text",maxLength:vv,value:i,onChange:P=>s(P.target.value),style:Bc})]}),c.jsxs("div",{style:{marginTop:12},children:[c.jsx("label",{style:Oc,children:"Scene — what the image shows"}),c.jsx("textarea",{"data-testid":"thumbnail-scene-input",value:a,onChange:P=>l(P.target.value),rows:3,style:{...Bc,resize:"vertical"}})]}),c.jsxs("div",{style:{marginTop:12},children:[c.jsx("label",{style:Oc,children:"Style notes — palette, lighting, mood"}),c.jsx("textarea",{"data-testid":"thumbnail-style-input",value:u,onChange:P=>f(P.target.value),rows:3,style:{...Bc,resize:"vertical"}})]}),g?c.jsx("div",{"data-testid":"thumbnail-error",style:Wc,children:g}):null,c.jsxs("div",{style:TN,children:[c.jsx("div",{style:wv,children:"Regenerating replaces the video's .thumbnail.png and saves this concept for future renders."}),c.jsx("button",{"data-testid":"thumbnail-regenerate-btn",style:{...RN,...m?{opacity:.6,cursor:"default"}:{}},onClick:()=>void b(),disabled:m,children:m?"Generating…":"Regenerate"})]})]})]})})},gN={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},vN={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"},yN={display:"flex",justifyContent:"space-between",alignItems:"center"},wN={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},xN={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},Dc={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},bN={marginTop:16,border:"1px solid #2C2C38",borderRadius:6,background:"#09090D",aspectRatio:"16 / 9",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},SN={width:"100%",height:"100%",objectFit:"contain"},kN={color:"#8B8B9E",fontSize:13,padding:16,textAlign:"center"},EN={display:"flex",alignItems:"center",gap:12,marginTop:12,padding:"10px 12px",border:"1px solid #2C2C38",borderRadius:6,background:"#09090D"},CN={width:44,height:44,borderRadius:6,objectFit:"cover",flexShrink:0,border:"1px solid #2C2C38"},IN={fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:2},yv={background:"transparent",border:"1px solid #3A3A48",borderRadius:6,color:"#C9C9D4",padding:"7px 12px",fontSize:12,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap"},Oc={display:"block",fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.04em"},Bc={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"},Wc={marginTop:12,color:"#FF5C5C",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",whiteSpace:"pre-wrap"},TN={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,marginTop:20},wv={fontSize:12,color:"#8B8B9E",lineHeight:1.4},RN={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)"},xv=3,bv=5,Vc=500;function jN(e){return e.split(/\s+/).filter(t=>t.replace(/^#+/,"").length>0).map(t=>t.startsWith("#")?t:`#${t}`)}function PN(e){return e.map(t=>t.startsWith("#")?t:`#${t}`).join(" ")}function q1(e){return e.split(",").map(t=>t.trim()).filter(t=>t.length>0)}function Q1(e){return e.join(", ")}function _N(e){return Q1(q1(e)).length}function FN(e){const t=Math.max(0,Math.floor(e));return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function MN(e){return`[${{browse:"Browse",search:"Search",benefit:"Benefit",alt:"Alt"}[e]}]`}const $N="This run never generated YouTube metadata. Run produce with --youtube (and an LLM provider) once — the pack lands here afterwards.",AN=({onClose:e})=>{var W;const[t,n]=d.useState(null),[r,o]=d.useState(null),[i,s]=d.useState([]),[a,l]=d.useState(null),[u,f]=d.useState(""),[p,h]=d.useState(""),[m,w]=d.useState(""),[g,k]=d.useState(null),[v,y]=d.useState(null),[x,b]=d.useState(null),[S,E]=d.useState(!1),[T,R]=d.useState(null);d.useEffect(()=>{const j=_=>{_.key==="Escape"&&(_.stopPropagation(),e())};return window.addEventListener("keydown",j,!0),()=>window.removeEventListener("keydown",j,!0)},[e]);const P=d.useCallback(async()=>{try{const j=await fetch("/api/youtube"),_=await j.json();if(!j.ok)throw new Error(_.error??`GET /api/youtube failed: ${j.status}`);n(_),_.pack&&(s(_.pack.titles),l(_.pack.titleAngles??null),f(_.pack.description),h(PN(_.pack.hashtags)),w(Q1(_.pack.tags)),k(_.pack.hook60??null),y(_.pack.linkedinPost??null),b(_.pack.communityPost??null))}catch(j){o(j instanceof Error?j.message:String(j))}},[]);d.useEffect(()=>{P()},[P]);const $=async()=>{var j;E(!0),R(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:u,hashtags:jN(p),tags:q1(m),...(j=t==null?void 0:t.pack)!=null&&j.chapters?{chapters:t.pack.chapters}:{},...g!==null?{hook60:g}:{},...v!==null?{linkedinPost:v}:{},...x!==null?{communityPost:x}:{}}})}),H=await _.json();if(!_.ok||H.ok!==!0){R(H.error??`save failed: ${_.status}`);return}await P()}catch(_){R(_ instanceof Error?_.message:String(_))}finally{E(!1)}},N=_N(m);return c.jsx("div",{style:NN,onMouseDown:e,children:c.jsxs("div",{"data-testid":"youtube-modal",style:LN,onMouseDown:j=>j.stopPropagation(),children:[c.jsxs("div",{style:zN,children:[c.jsx("div",{style:DN,children:"YouTube SEO metadata"}),c.jsx("button",{style:ON,onClick:e,"aria-label":"Close",children:"✕"})]}),r?c.jsxs("div",{"data-testid":"youtube-load-error",style:Ev,children:["Couldn't load the YouTube pack: ",r]}):t===null?c.jsx("div",{style:Sv,children:"Loading…"}):t.available?c.jsxs(c.Fragment,{children:[c.jsxs("div",{style:{marginTop:16},children:[c.jsxs("label",{style:kr,children:["Title options (",xv,"–",bv,", up to 100 chars each)"]}),i.map((j,_)=>c.jsxs("div",{style:BN,children:[(a==null?void 0:a[_])!==void 0?c.jsx("span",{"data-testid":`youtube-title-angle-${_}`,style:WN,children:MN(a[_])}):null,c.jsx("input",{"data-testid":`youtube-title-input-${_}`,type:"text",maxLength:100,value:j,onChange:H=>s(O=>O.map((I,C)=>C===_?H.target.value:I)),style:to}),c.jsx("button",{"data-testid":`youtube-title-remove-${_}`,style:kv,disabled:i.length<=xv,onClick:()=>{s(H=>H.filter((O,I)=>I!==_)),l(H=>H&&H.filter((O,I)=>I!==_))},"aria-label":`Remove title ${_+1}`,children:"✕"})]},_)),c.jsx("button",{"data-testid":"youtube-title-add",style:kv,disabled:i.length>=bv,onClick:()=>{s(j=>[...j,""]),l(j=>j&&[...j,"alt"])},children:"+ Add title"})]}),c.jsxs("div",{style:{marginTop:12},children:[c.jsx("label",{style:kr,children:"Description"}),c.jsx("textarea",{"data-testid":"youtube-description-input",value:u,onChange:j=>f(j.target.value),rows:6,style:{...to,resize:"vertical"}})]}),c.jsxs("div",{style:{marginTop:12},children:[c.jsx("label",{style:kr,children:"Hashtags — space-separated, # added if missing"}),c.jsx("input",{"data-testid":"youtube-hashtags-input",type:"text",value:p,onChange:j=>h(j.target.value),style:to})]}),c.jsxs("div",{style:{marginTop:12},children:[c.jsx("label",{style:kr,children:"Tags — comma-separated"}),c.jsx("input",{"data-testid":"youtube-tags-input",type:"text",value:m,onChange:j=>w(j.target.value),style:to}),c.jsxs("div",{"data-testid":"youtube-tags-counter",style:{...VN,...N>Vc?{color:"#FFB84D"}:{}},children:[N," / ",Vc,N>Vc?" — tags past the budget are dropped on save":""]})]}),(W=t.pack)!=null&&W.chapters&&t.pack.chapters.length>0?c.jsxs("div",{style:{marginTop:12},children:[c.jsx("label",{style:kr,children:"Chapters (read-only — embedded in the description on save/render)"}),c.jsx("div",{"data-testid":"youtube-chapters",style:HN,children:t.pack.chapters.map((j,_)=>c.jsxs("div",{children:[FN(j.atSec)," ",j.title]},_))}),c.jsx("div",{style:Cv,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,g!==null?c.jsxs("div",{style:{marginTop:12},children:[c.jsx("label",{style:kr,children:"First-60s hook strategy (for you — never uploaded)"}),c.jsx("textarea",{"data-testid":"youtube-hook60-input",value:g,onChange:j=>k(j.target.value),rows:3,style:{...to,resize:"vertical"}})]}):null,v!==null?c.jsxs("div",{style:{marginTop:12},children:[c.jsx("label",{style:kr,children:"LinkedIn post"}),c.jsx("textarea",{"data-testid":"youtube-linkedin-input",value:v,onChange:j=>y(j.target.value),rows:6,style:{...to,resize:"vertical"}})]}):null,x!==null?c.jsxs("div",{style:{marginTop:12},children:[c.jsx("label",{style:kr,children:"Community post"}),c.jsx("textarea",{"data-testid":"youtube-community-input",value:x,onChange:j=>b(j.target.value),rows:3,style:{...to,resize:"vertical"}})]}):null,T?c.jsx("div",{"data-testid":"youtube-error",style:Ev,children:T}):null,c.jsxs("div",{style:UN,children:[c.jsx("div",{style:Cv,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."}),c.jsx("button",{"data-testid":"youtube-save-btn",style:{...ZN,...S?{opacity:.6,cursor:"default"}:{}},onClick:()=>void $(),disabled:S,children:S?"Saving…":"Save"})]})]}):c.jsx("div",{"data-testid":"youtube-unavailable",style:{...Sv,marginTop:12},children:$N})]})})},NN={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},LN={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"},zN={display:"flex",justifyContent:"space-between",alignItems:"center"},DN={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},ON={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},Sv={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},kr={display:"block",fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.04em"},to={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"},BN={display:"flex",gap:8,alignItems:"center",marginBottom:8},WN={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"},VN={marginTop:6,fontSize:12,color:"#8B8B9E",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace"},HN={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},Ev={marginTop:12,color:"#FF5C5C",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",whiteSpace:"pre-wrap"},UN={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,marginTop:20},Cv={fontSize:12,color:"#8B8B9E",lineHeight:1.4,marginTop:6},ZN={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 Za(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 KN(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 Iv(e,t){const n=Math.max(0,Math.floor((t-e)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function YN(e,t){return e?{load:e,notifyDiscard:t}:{load:null,notifyDiscard:!1}}function GN(e,t){return e===null||e===t}function XN(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 qN(e){if(e.dirty){if(e.renderRunning){e.onBlocked();return}e.save().catch(t=>e.onSaveError(t instanceof Error?t.message:String(t)))}}function QN(e,t){const{cues:n}=cf(e,t);return Yp(n,t.splits).filter(o=>{var i;return((i=t.scenes[o.id])==null?void 0:i.hidden)===!0})}const Tv=e=>({...e,...E$(e)}),Rv=e=>{const t=H1(e);e.forEach((n,r)=>{console.warn(`ossclip §137: dropped caption edit ${JSON.stringify(n)} — ${t[r]}`)})},JN=()=>{const e=S$(),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,u]=d.useState([]),[f,p]=d.useState([]),h=d.useRef(e.doc.captions);h.current=e.doc.captions;const[m,w]=d.useState(null),[g,k]=d.useState(null),[v,y]=d.useState(null),[x,b]=d.useState(null),[S,E]=d.useState(null),[T,R]=d.useState(!1),[P,$]=d.useState(1),[N,W]=d.useState(null),[j,_]=d.useState(!1),[H,O]=d.useState([]),[I,C]=d.useState(null),A=d.useRef(null),[M,D]=d.useState(!1),[B,Z]=d.useState(null),[L,z]=d.useState(!1),[Q,G]=d.useState(),V=d.useRef(null);d.useEffect(()=>()=>{V.current!==null&&window.clearInterval(V.current)},[]);const[K,de]=d.useState(null),ve=d.useRef(null),ue=d.useRef(null),se=d.useRef(null),ee=d.useRef(null),[X,J]=d.useState(null),[ie,Fe]=d.useState(null),Ee=d.useCallback(q=>{var Ue;if(se.current=q,Fe(q),(Ue=ee.current)==null||Ue.disconnect(),ee.current=null,!q)return;const re=()=>J({w:Math.max(0,q.clientWidth-Uc*2),h:Math.max(0,q.clientHeight-Uc*2)});re();const ae=new ResizeObserver(re);ae.observe(q),ee.current=ae},[]),[be,Me]=d.useState(1),xe=d.useRef(be);xe.current=be;const Te=d.useRef(null),je=d.useCallback((q,re)=>{const ae=se.current,Ue=Math.min(8,Math.max(.25,q)),Pt=xe.current;if(ae&&Ue!==Pt){const Ot=ae.getBoundingClientRect();Te.current={prev:Pt,ax:((re==null?void 0:re.x)??Ot.left+Ot.width/2)-Ot.left,ay:((re==null?void 0:re.y)??Ot.top+Ot.height/2)-Ot.top,sl:ae.scrollLeft,st:ae.scrollTop}}Me(Ue)},[]);d.useLayoutEffect(()=>{const q=se.current,re=Te.current;if(!q||!re)return;Te.current=null;const ae=be/re.prev;q.scrollLeft=(re.sl+re.ax)*ae-re.ax,q.scrollTop=(re.st+re.ay)*ae-re.ay},[be]),d.useEffect(()=>{const q=ie;if(!q)return;const re=ae=>{(ae.ctrlKey||ae.metaKey)&&(ae.preventDefault(),je(xe.current*Math.exp(-ae.deltaY*.01),{x:ae.clientX,y:ae.clientY}))};return q.addEventListener("wheel",re,{passive:!1}),()=>q.removeEventListener("wheel",re)},[ie,je]);const Ce=d.useRef(null);d.useEffect(()=>{const q=ae=>{const Ue=Ce.current,Pt=se.current;!Ue||!Pt||(Pt.scrollLeft=Ue.sl-(ae.clientX-Ue.x),Pt.scrollTop=Ue.st-(ae.clientY-Ue.y))},re=()=>{Ce.current=null};return window.addEventListener("mousemove",q),window.addEventListener("mouseup",re),()=>{window.removeEventListener("mousemove",q),window.removeEventListener("mouseup",re)}},[]);const[Le,Rt]=d.useState(!1),[Lt,pn]=d.useState(()=>{const q=Number(window.localStorage.getItem(Pv));return Number.isFinite(q)&&q>0?_v(q):300}),zt=d.useRef(null);d.useEffect(()=>{const q=ae=>{const Ue=zt.current;Ue&&pn(_v(Ue.startW+(ae.clientX-Ue.startX)))},re=()=>{zt.current&&(zt.current=null,pn(ae=>(window.localStorage.setItem(Pv,String(ae)),ae)))};return window.addEventListener("mousemove",q),window.addEventListener("mouseup",re),()=>{window.removeEventListener("mousemove",q),window.removeEventListener("mouseup",re)}},[]);const[In,Tn]=d.useState(!1),[He,hn]=d.useState(!1),[tn,it]=d.useState(!1),[jt,gt]=d.useState(!1);d.useEffect(()=>{if(!jt)return;const q=re=>{re.key==="Escape"&&(re.stopPropagation(),gt(!1))};return window.addEventListener("keydown",q,!0),()=>window.removeEventListener("keydown",q,!0)},[jt]);const[Rn,wr]=d.useState(null),[Dt,nr]=d.useState(null),[Qr,Po]=d.useState(!0),F=d.useCallback(q=>{const re=ZR({rate:P,playing:T},q);$(re.rate);const ae=ue.current;ae&&(re.playing&&!T&&ae.play(),!re.playing&&T&&ae.pause())},[P,T]);d.useEffect(()=>{const q=ue.current;if(!q)return;const re=()=>R(!0),ae=()=>R(!1);return q.addEventListener("play",re),q.addEventListener("pause",ae),()=>{q.removeEventListener("play",re),q.removeEventListener("pause",ae)}});const U=d.useCallback(()=>{if(V.current!==null)return;const q=window.setInterval(()=>{(async()=>{try{const ae=await(await fetch("/api/render/status")).json();if(ae.running||ae.exitCode===null){Z(Ue=>({running:ae.running,lines:ae.lines??[],startedAt:ae.startedAt??(Ue==null?void 0:Ue.startedAt)}));return}if(V.current!==null&&(window.clearInterval(V.current),V.current=null),ae.exitCode===0){const Pt=await(await fetch("/api/production")).json(),Ot=Tv(Pt.renderProps);k(Ot),D(!!Pt.canRender);const _o=YN(Pt.overrides,t.current);if(_o.load){const Wn=h.current,mn=Hg(_o.load,Ot);e.load(mn.doc),Rv(mn.unresolved),u(mn.unresolved);const vt=T$(I$(Wn,mn.doc.captions));for(const rb of vt)console.warn(`ossclip §137: ${rb}`);p(vt)}else u([]),p([]);_o.notifyDiscard&&r(!0),Z(Wn=>({running:!1,lines:ae.lines??[],succeeded:!0,startedAt:ae.startedAt??(Wn==null?void 0:Wn.startedAt),finishedAt:Date.now()})),fetch("/api/reveal-output",{method:"POST"}).catch(()=>{})}else Z({running:!1,lines:ae.lines??[],failed:ae.exitCode,cancelled:ae.cancelled})}catch{V.current===null&&U()}})()},1e3);V.current=q},[]),ne=d.useCallback(async()=>{const q=await fetch("/api/production");if(!q.ok)throw new Error(`GET /api/production failed: ${q.status}`);const re=await q.json();if(re.defaultOutPath&&G(re.defaultOutPath),O(re.recent??[]),re.noWorkdir){u([]),p([]),_(!0);return}const ae=Tv(re.renderProps);k(ae);const Ue=A.current,Pt=re.workdir??null;A.current=Pt,C(Pt),D(!!re.canRender);const Ot=Hg(re.overrides,ae);e.load(Ot.doc),Rv(Ot.unresolved),u(Ot.unresolved),p([]),fetch("/api/usage").then(async vt=>y(vt.ok?await vt.json():null)).catch(()=>y(null));const Wn=await(await fetch("/api/render/status")).json(),mn=GN(Ue,Pt)?XN(Wn):null;mn&&(Z(mn),mn.running?U():Po(!1))},[U]);d.useEffect(()=>{ne().catch(q=>b(q instanceof Error?q.message:String(q)))},[]);const ce=d.useCallback(async q=>{if(e.dirty&&!window.confirm("Unsaved edits will be lost — switch projects anyway?"))return null;try{const re=await fetch("/api/workdir",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:q})}),ae=await re.json().catch(()=>({}));return re.ok?(E(null),W(null),de(null),Z(null),Me(1),k(null),_(!1),await ne(),null):ae.error??`open failed: ${re.status}`}catch(re){return re instanceof Error?re.message:String(re)}},[e.dirty,ne]),me=d.useMemo(()=>{if(!g)return{lines:[],dropped:[]};const q=g.baseCaptionLines??g.captionLines??[];return mM(q,C$(e.doc.captions))},[g,e.doc.captions]),ye=d.useMemo(()=>g?vM(me.lines,e.doc.captionRangeEdits):{lines:[],dropped:[]},[g,me,e.doc.captionRangeEdits]),Se=d.useMemo(()=>g?yM(ye.lines,e.doc.captionWordsHidden):{lines:[],dropped:[]},[g,ye,e.doc.captionWordsHidden]),_e=d.useMemo(()=>g?w1(Se.lines,e.doc.captionLineTiming):{lines:[],dropped:[]},[g,Se,e.doc.captionLineTiming]),qe=d.useMemo(()=>H1(l),[l]),Ae=d.useMemo(()=>[...R$(me.dropped),...P$(ye.dropped),...j$(Se.dropped),..._$(_e.dropped)],[me,ye,Se,_e]),ze=Ae.join(`
163
+ `),Jr=Ae.length>0&&ze!==m;d.useEffect(()=>{if(Ae.length!==0)for(const q of Ae)console.warn(`ossclip §137: ${q}`)},[ze]);const fe=d.useMemo(()=>{if(!g)return null;const q=(g.baseSceneCues??g.sceneCues??[]).filter(vt=>vt.kind!=="plain"),re=g.baseTheme??g.theme??HF,{cues:ae}=cf(q,e.doc),{cues:Ue}=cM(ae,e.doc),Pt=TM(Ue,{outputDurationSec:g.outputDurationSec,clipStarts:(g.spans??[]).map(vt=>vt.outIn)}),Ot=Yp(Pt,e.doc.splits),{cues:_o}=cf(Ot,e.doc),{cues:Wn}=y1(_o,e.doc);let mn=N?Wn.map(vt=>vt.id===N.sceneId?{...vt,video:{...vt.video,...N.patch}}:vt):Wn;return K&&(mn=mn.map(vt=>vt.id===K.sceneId?{...vt,graphicRect:K.rect}:vt)),{...g,sceneCues:mn,captionLines:_e.lines,theme:xM(re,e.doc),captionsHidden:g.captionsHiddenByFlag===!0||e.doc.captionsHidden===!0,videoFileName:`/media/${g.videoFileName}`}},[g,e.doc,N,K,_e]),Pe=()=>{qN({dirty:e.dirty,renderRunning:(B==null?void 0:B.running)===!0,save:e.save,onBlocked:()=>i(!0),onSaveError:q=>b(q)})},Zt=d.useCallback(async q=>{try{e.dirty&&await e.save();const re=await fetch("/api/render",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(q?{out:q}:{})});if(!re.ok){const ae=await re.json().catch(()=>({}));throw new Error(ae.error??`render failed to start: ${re.status}`)}Z({running:!0,lines:[],startedAt:Date.now()}),a(null),U()}catch(re){a(re instanceof Error?re.message:String(re))}},[e,U]),Bn=d.useMemo(()=>{if(!g)return[];const q=(g.baseSceneCues??g.sceneCues??[]).filter(re=>re.kind!=="plain");return QN(q,e.doc)},[g,e.doc]),rr=d.useMemo(()=>S?(fe==null?void 0:fe.sceneCues.find(q=>q.id===S.sceneId))??Bn.find(q=>q.id===S.sceneId)??null:null,[fe,S,Bn]),J1=d.useMemo(()=>{if(!rr||!fe)return;const q=fe.captionLines.filter(ae=>ae.start<rr.endSec&&ae.end>rr.startSec).flatMap(ae=>ae.words).filter(ae=>ae.start<rr.endSec&&ae.end>rr.startSec).map(ae=>ae.text);if(q.length===0)return;const re=q.join(" ");return re.length>90?`${re.slice(0,90)}…`:re},[rr,fe]);if(x)return c.jsx("div",{style:Hc,children:c.jsxs("div",{style:{padding:24,color:"#FF5C5C",fontFamily:"ui-monospace, monospace"},children:["Couldn't load the production: ",x]})});if(!fe)return c.jsx("div",{style:Hc,children:j?c.jsx(dv,{recent:H,required:!0,onOpen:ce,onClose:()=>{}}):c.jsx("div",{style:{padding:24,color:"#9A9AA3"},children:"Loading production…"})});const eb=fe.settings.width/fe.settings.height,tb=X?Math.max(220,Math.min(X.w,X.h*eb)):380,nb=Math.round(tb*be),Wu=c.jsx("button",{"data-testid":"render-logs-toggle",style:{...dt,padding:"2px 8px"},onClick:()=>Po(q=>!q),title:Qr?"Collapse the log":"Expand the log",children:Qr?"▾ logs":"▸ logs"});return c.jsxs("div",{style:Hc,children:[c.jsxs("div",{style:r5,children:[c.jsx("span",{style:o5,children:"ossclip"}),I?c.jsx("span",{"data-testid":"workdir-label",style:i5,title:I,children:I.split("/").filter(Boolean).slice(-2).join("/")}):null,c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsx("button",{"data-testid":"open-button",style:dt,onClick:()=>_(!0),title:I?`Open another project — currently ${I}`:"Open another project",children:"Open"}),c.jsx("button",{"data-testid":"undo-button",style:dt,onClick:()=>e.undo(),disabled:!e.canUndo,title:"Undo (⌘Z)","aria-label":"Undo",children:c.jsx(t5,{})}),c.jsx("button",{"data-testid":"redo-button",style:dt,onClick:()=>e.redo(),disabled:!e.canRedo,title:"Redo (⌘⇧Z)","aria-label":"Redo",children:c.jsx(n5,{})}),c.jsx("button",{"data-testid":"transcript-toggle",style:{...dt,...Le?{borderColor:"#5b8cff"}:{}},onClick:()=>Rt(q=>!q),title:"Find and retype caption words across the whole transcript",children:"Transcript"}),c.jsxs("div",{style:{position:"relative"},children:[c.jsx("button",{"data-testid":"youtube-menu",style:{...dt,...jt||He||tn?{borderColor:"#5b8cff"}:{}},onClick:()=>gt(q=>!q),title:"AI thumbnail and SEO metadata for the YouTube upload","aria-haspopup":"menu","aria-expanded":jt,children:"YouTube ▾"}),jt?c.jsxs(c.Fragment,{children:[c.jsx("div",{style:l5,onMouseDown:()=>gt(!1)}),c.jsxs("div",{style:u5,role:"menu",children:[c.jsx("button",{"data-testid":"youtube-menu-thumbnail",style:jv,role:"menuitem",onClick:()=>{gt(!1),hn(!0)},children:"Thumbnail"}),c.jsx("button",{"data-testid":"youtube-menu-seo",style:jv,role:"menuitem",onClick:()=>{gt(!1),it(!0)},children:"SEO metadata"})]})]}):null]}),c.jsx("button",{style:{...dt,...e.dirty?a5:{}},onClick:Pe,disabled:!e.dirty||(B==null?void 0:B.running)===!0,title:(B==null?void 0:B.running)===!0?"Can't save while a render is running":void 0,children:"Save"}),c.jsxs("div",{style:{display:"inline-flex",alignItems:"center"},children:[c.jsx("button",{"data-testid":"render-button",style:{...dt,borderTopRightRadius:0,borderBottomRightRadius:0,borderRight:"none"},onClick:()=>void Zt(),disabled:!M||(B==null?void 0:B.running)===!0,title:M?"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:B!=null&&B.running?"Rendering…":"Render"}),c.jsx("button",{"data-testid":"render-destination-button",style:{...dt,borderTopLeftRadius:0,borderBottomLeftRadius:0,padding:"7px 8px"},onClick:()=>z(!0),disabled:!M||(B==null?void 0:B.running)===!0,title:"Choose export file destination (Browse…)",children:"▾"})]})]}),c.jsx("span",{style:{...s5,color:e.dirty?"#FFE14D":"#5FBF77"},...e.dirty?{"data-testid":"dirty"}:{},children:e.dirty?"● Unsaved changes":"✓ Saved"}),c.jsx("button",{"data-testid":"shortcuts-button",style:{...dt,padding:"7px 10px"},onClick:()=>Tn(q=>!q),title:"Keyboard shortcuts (?)",children:"?"})]}),In?c.jsx(XA,{onClose:()=>Tn(!1)}):null,He?c.jsx(mN,{onClose:()=>hn(!1)}):null,tn?c.jsx(AN,{onClose:()=>it(!1)}):null,L?c.jsx(Q3,{defaultOutPath:Q,onCancel:()=>z(!1),onConfirm:q=>{z(!1),Zt(q)}}):null,Rn?c.jsx(a3,{plan:Rn,onCancel:()=>wr(null),onConfirm:q=>{q==="graphic"?e.hideScene(Rn.sceneId):e.cutChunk(Rn.startSec,Rn.endSec),wr(null)}}):null,Dt?c.jsx(b3,{plan:Dt,onCancel:()=>nr(null),onConfirm:q=>{q==="caption"?e.hideCaptionWords(Dt.words):e.cutWords(Dt.words,Dt.startSec,Dt.endSec),nr(null)}}):null,j?c.jsx(dv,{recent:H,required:!1,onOpen:ce,onClose:()=>_(!1)}):null,B?c.jsxs("div",{"data-testid":"render-log",style:{...y5,borderColor:B.failed!==void 0?"#FF5C5C":"#2A2A33"},children:[B.failed!==void 0?c.jsxs("div",{style:{color:B.cancelled?"#9A9AA3":"#FF5C5C",marginBottom:4},"data-testid":B.cancelled?"render-cancelled":"render-failed",children:[B.cancelled?"render cancelled":`render failed (exit ${B.failed})`,c.jsx("button",{style:{...dt,marginLeft:10,padding:"2px 8px"},onClick:()=>Z(null),children:"Dismiss"}),c.jsx("span",{style:{marginLeft:6},children:Wu})]}):null,B.succeeded?c.jsxs("div",{"data-testid":"render-succeeded",style:Fv,children:[c.jsxs("span",{style:{color:"#5FBF77"},children:["✓ done",B.startedAt!=null&&B.finishedAt!==void 0?` · ${Iv(B.startedAt,B.finishedAt)}`:""]}),c.jsx("button",{"data-testid":"render-open-folder",style:{...dt,padding:"2px 8px"},onClick:()=>void fetch("/api/reveal-output",{method:"POST"}).catch(()=>{}),title:"Reveal the rendered file in your file manager",children:"Open folder"}),c.jsx("button",{style:{...dt,padding:"2px 8px"},onClick:()=>Z(null),children:"Dismiss"}),Wu]}):null,B.running?c.jsxs("div",{"data-testid":"render-status",style:Fv,children:[c.jsx("style",{children:"@keyframes ossclip-spin { to { transform: rotate(360deg) } }"}),c.jsx("span",{style:w5,"aria-hidden":!0}),c.jsxs("span",{style:{color:"#EDEDF2"},children:["rendering",B.startedAt!=null?` · ${Iv(B.startedAt,Date.now())}`:"",Za(B.lines)!==null?` · ${Za(B.lines)}%`:""]}),Za(B.lines)!==null?c.jsx("div",{style:x5,children:c.jsx("div",{"data-testid":"render-progress-bar",style:{...b5,width:`${Za(B.lines)}%`}})}):null,c.jsx("button",{"data-testid":"render-cancel",style:{...dt,padding:"2px 8px"},onClick:()=>void fetch("/api/render/cancel",{method:"POST"}),children:"Cancel"}),Wu]}):null,Qr?c.jsxs(c.Fragment,{children:[KN(B.lines).map(q=>c.jsx("div",{"data-testid":"render-pinned",style:{color:"#C9C9D4"},children:q},q)),c.jsx(e5,{lines:B.lines})]}):null]}):null,n?c.jsxs("div",{"data-testid":"reanchor-notice",style:Qi,children:["Render re-anchored your saved cuts and splits — edits made while it ran were dropped, not merged, to avoid overwriting that anchor.",c.jsx("button",{style:{...dt,marginLeft:10,padding:"2px 8px"},onClick:()=>r(!1),children:"Dismiss"})]}):null,qe.length>0||f.length>0?c.jsxs("div",{"data-testid":"caption-migration-notice",style:Qi,children:[[...qe,...f].map((q,re)=>c.jsx("div",{children:q},re)),c.jsx("button",{style:{...dt,marginLeft:10,padding:"2px 8px"},onClick:()=>{u([]),p([])},children:"Dismiss"})]}):null,Jr?c.jsxs("div",{"data-testid":"caption-dropped-notice",style:Qi,children:[Ae.map((q,re)=>c.jsx("div",{children:q},re)),c.jsx("button",{style:{...dt,marginLeft:10,padding:"2px 8px"},onClick:()=>w(ze),children:"Dismiss"})]}):null,o?c.jsxs("div",{"data-testid":"save-blocked-notice",style:Qi,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.",c.jsx("button",{style:{...dt,marginLeft:10,padding:"2px 8px"},onClick:()=>i(!1),children:"Dismiss"})]}):null,s!==null?c.jsxs("div",{"data-testid":"render-refused-notice",style:Qi,children:["Render didn't start: ",s,c.jsx("button",{style:{...dt,marginLeft:10,padding:"2px 8px"},onClick:()=>a(null),children:"Dismiss"})]}):null,c.jsxs("div",{style:c5,children:[Le?c.jsxs(c.Fragment,{children:[c.jsx(IA,{baseLines:(g==null?void 0:g.baseCaptionLines)??(g==null?void 0:g.captionLines)??[],liveLines:ye.lines,timingLines:Se.lines,fps:fe.settings.fps,playerRef:ue,edits:e,onDeleteWords:nr,width:Lt,workdir:I}),c.jsx("div",{"data-testid":"transcript-divider",style:d5,title:"Drag to resize the transcript pane",onMouseDown:q=>{q.preventDefault(),zt.current={startX:q.clientX,startW:Lt}}})]}):null,c.jsxs("div",{style:f5,children:[c.jsx("div",{ref:Ee,style:p5,onMouseDown:q=>{if(q.altKey||q.button===1){q.preventDefault();const re=se.current;re&&(Ce.current={x:q.clientX,y:q.clientY,sl:re.scrollLeft,st:re.scrollTop})}},children:c.jsx("div",{style:{margin:"auto",padding:Uc},children:c.jsxs("div",{ref:ve,"data-testid":"stage","data-playing":T?"true":"false","data-rate":P,style:{position:"relative",display:"inline-block"},children:[c.jsx(DR,{ref:ue,component:y$,inputProps:fe,durationInFrames:Math.max(1,Math.round(fe.outputDurationSec*fe.settings.fps)),fps:fe.settings.fps,compositionWidth:fe.settings.width,compositionHeight:fe.settings.height,style:{width:nb},controls:!0,clickToPlay:!1,playbackRate:P}),c.jsx(D$,{stageRef:ve,selection:S,onSelect:E,edits:e,onSave:Pe,settings:fe.settings,cues:fe.sceneCues,playerRef:ue,cue:rr,onTransport:F,onVideoPreview:W,onGraphicPreview:de,onToggleHelp:()=>Tn(q=>!q),onRequestDelete:wr}),c.jsx("button",{"data-testid":"rate-chip",onClick:()=>F("L"),title:"Playback rate — click to speed up (J/K/L on the keyboard)",style:S5,children:P<0?`◂◂ ${Math.abs(P)}×`:`${P}×`})]})})}),c.jsxs("div",{style:h5,children:[c.jsx("button",{"data-testid":"view-zoom-out",style:Zc,onClick:()=>je(be/2),disabled:be<=.25,title:"Zoom the preview out — below 100% shrinks under the fitted size",children:"−"}),c.jsxs("span",{"data-testid":"view-zoom-level",style:m5,children:[Math.round(be*100),"%"]}),c.jsx("button",{"data-testid":"view-zoom-in",style:Zc,onClick:()=>je(be*2),disabled:be>=8,title:"Zoom the preview in — a viewing magnifier, it never edits the video",children:"+"}),c.jsx("button",{"data-testid":"view-zoom-fit",style:{...Zc,width:"auto",padding:"0 8px"},onClick:()=>je(1),disabled:Math.abs(be-1)<.001,title:"Fit the preview to the window",children:"fit"}),c.jsx("span",{style:g5,children:"⌥-drag pans"})]})]}),c.jsx("div",{style:v5,children:c.jsx(B$,{selection:S,cue:rr,frame:{width:fe.settings.width,height:fe.settings.height},allSceneIds:fe.sceneCues.map(q=>q.id),edits:e,onSelect:E,resolvedTheme:fe.theme,anchorText:J1,onVideoPreview:W,runInfo:v,captionsHiddenByFlag:(g==null?void 0:g.captionsHiddenByFlag)===!0})})]}),c.jsx(eA,{cues:fe.sceneCues,ghosts:Bn,cuts:e.doc.cuts,spans:fe.spans??[],durationSec:fe.outputDurationSec,fps:fe.settings.fps,playerRef:ue,selection:S,onSelect:E,edits:e,videoSrc:fe.videoFileName,toSourceSec:q=>{var re;for(const ae of fe.spans??[])if(q>=ae.outIn&&q<ae.outOut)return ae.srcIn+(q-ae.outIn);return((re=(fe.spans??[])[0])==null?void 0:re.srcIn)??q}})]})},e5=({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]),c.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)=>c.jsx("div",{children:r},o))})},t5=()=>c.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:[c.jsx("path",{d:"M9 14 4 9l5-5"}),c.jsx("path",{d:"M4 9h10.5a5.5 5.5 0 0 1 0 11H11"})]}),n5=()=>c.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:[c.jsx("path",{d:"m15 14 5-5-5-5"}),c.jsx("path",{d:"M20 9H9.5a5.5 5.5 0 0 0 0 11H13"})]}),Hc={fontFamily:"'Inter', system-ui, sans-serif",background:"#0B0B0E",color:"#EDEDF2",height:"100vh",overflow:"hidden",display:"flex",flexDirection:"column"},r5={display:"flex",alignItems:"center",gap:14,padding:"10px 20px",borderBottom:"1px solid #1E1E24",background:"#111116"},o5={fontWeight:800,fontSize:14,letterSpacing:"0.02em",color:"#FFE14D",marginRight:8},i5={fontSize:12,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#6a6a75",maxWidth:260,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},s5={fontSize:12,fontFamily:"ui-monospace, 'SF Mono', monospace",marginLeft:"auto"},dt={fontSize:12,fontWeight:600,color:"#EDEDF2",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:6,padding:"7px 12px",cursor:"pointer"},a5={background:"#FFE14D",color:"#0B0B0E",border:"1px solid #FFE14D"},l5={position:"fixed",inset:0,zIndex:30},u5={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"},jv={fontSize:12,fontWeight:600,color:"#EDEDF2",background:"transparent",border:"none",borderRadius:4,padding:"8px 10px",cursor:"pointer",textAlign:"left"},c5={display:"flex",flex:1,minHeight:0},Uc=32,Pv="ossclip.transcriptWidth",_v=e=>Math.min(640,Math.max(220,e)),d5={width:5,flexShrink:0,cursor:"col-resize",background:"#1E1E24",borderLeft:"1px solid #2A2A33"},f5={position:"relative",flex:1,minWidth:0},p5={position:"absolute",inset:0,display:"flex",overflow:"auto"},h5={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},Zc={width:22,height:18,fontSize:12,lineHeight:1,color:"#EDEDF2",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:4,cursor:"pointer",padding:0},m5={fontSize:10,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#9A9AA3",minWidth:34,textAlign:"center"},g5={fontSize:10,color:"#55555f",userSelect:"none"},v5={width:260,flexShrink:0,borderLeft:"1px solid #1E1E24",background:"#111116",overflowY:"auto"},y5={fontSize:11,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#9A9AA3",background:"#0F0F14",borderBottom:"1px solid #2A2A33",padding:"6px 20px",whiteSpace:"pre-wrap",flexShrink:0},Qi={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},Fv={display:"flex",alignItems:"center",gap:10,marginBottom:4},w5={width:12,height:12,flexShrink:0,border:"2px solid #2A2A33",borderTopColor:"#FFE14D",borderRadius:"50%",animation:"ossclip-spin 0.8s linear infinite"},x5={flex:1,maxWidth:260,height:4,background:"#1E1E24",borderRadius:2,overflow:"hidden"},b5={height:"100%",background:"#FFE14D",borderRadius:2,transition:"width 0.6s ease"},S5={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"};Kc.createRoot(document.getElementById("root")).render(c.jsx(oe.StrictMode,{children:c.jsx(JN,{})}));