ossclip 0.1.35 → 0.1.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/editor-dist/assets/index-pWbFr8vc.js +168 -0
- package/editor-dist/index.html +1 -1
- package/package.json +4 -4
- package/src/cover.ts +18 -0
- package/src/edit.ts +67 -2
- package/src/interactive/produce-wizard.ts +7 -1
- package/src/produce.ts +185 -1
- package/src/program.ts +21 -0
- package/editor-dist/assets/index-DSB_SCmp.js +0 -166
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
var Ck=Object.defineProperty;var Ik=(e,t,n)=>t in e?Ck(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Oe=(e,t,n)=>Ik(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 Tk(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var j0={exports:{}},Nu={},R0={exports:{}},Me={};/**
|
|
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 wa=Symbol.for("react.element"),jk=Symbol.for("react.portal"),Rk=Symbol.for("react.fragment"),Fk=Symbol.for("react.strict_mode"),Pk=Symbol.for("react.profiler"),$k=Symbol.for("react.provider"),Mk=Symbol.for("react.context"),_k=Symbol.for("react.forward_ref"),Ak=Symbol.for("react.suspense"),Nk=Symbol.for("react.memo"),Lk=Symbol.for("react.lazy"),Sm=Symbol.iterator;function Ok(e){return e===null||typeof e!="object"?null:(e=Sm&&e[Sm]||e["@@iterator"],typeof e=="function"?e:null)}var F0={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},P0=Object.assign,$0={};function Ki(e,t,n){this.props=e,this.context=t,this.refs=$0,this.updater=n||F0}Ki.prototype.isReactComponent={};Ki.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")};Ki.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function M0(){}M0.prototype=Ki.prototype;function yp(e,t,n){this.props=e,this.context=t,this.refs=$0,this.updater=n||F0}var vp=yp.prototype=new M0;vp.constructor=yp;P0(vp,Ki.prototype);vp.isPureReactComponent=!0;var km=Array.isArray,_0=Object.prototype.hasOwnProperty,wp={current:null},A0={key:!0,ref:!0,__self:!0,__source:!0};function N0(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)_0.call(t,r)&&!A0.hasOwnProperty(r)&&(o[r]=t[r]);var a=arguments.length-2;if(a===1)o.children=n;else if(1<a){for(var l=Array(a),c=0;c<a;c++)l[c]=arguments[c+2];o.children=l}if(e&&e.defaultProps)for(r in a=e.defaultProps,a)o[r]===void 0&&(o[r]=a[r]);return{$$typeof:wa,type:e,key:i,ref:s,props:o,_owner:wp.current}}function Dk(e,t){return{$$typeof:wa,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function xp(e){return typeof e=="object"&&e!==null&&e.$$typeof===wa}function zk(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Em=/\/+/g;function Hc(e,t){return typeof e=="object"&&e!==null&&e.key!=null?zk(""+e.key):t.toString(36)}function Al(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 wa:case jk:s=!0}}if(s)return s=e,o=o(s),e=r===""?"."+Hc(s,0):r,km(o)?(n="",e!=null&&(n=e.replace(Em,"$&/")+"/"),Al(o,t,n,"",function(c){return c})):o!=null&&(xp(o)&&(o=Dk(o,n+(!o.key||s&&s.key===o.key?"":(""+o.key).replace(Em,"$&/")+"/")+e)),t.push(o)),1;if(s=0,r=r===""?".":r+":",km(e))for(var a=0;a<e.length;a++){i=e[a];var l=r+Hc(i,a);s+=Al(i,t,n,l,o)}else if(l=Ok(e),typeof l=="function")for(e=l.call(e),a=0;!(i=e.next()).done;)i=i.value,l=r+Hc(i,a++),s+=Al(i,t,n,l,o);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return s}function Ha(e,t,n){if(e==null)return e;var r=[],o=0;return Al(e,r,"","",function(i){return t.call(n,i,o++)}),r}function Bk(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 an={current:null},Nl={transition:null},Wk={ReactCurrentDispatcher:an,ReactCurrentBatchConfig:Nl,ReactCurrentOwner:wp};function L0(){throw Error("act(...) is not supported in production builds of React.")}Me.Children={map:Ha,forEach:function(e,t,n){Ha(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Ha(e,function(){t++}),t},toArray:function(e){return Ha(e,function(t){return t})||[]},only:function(e){if(!xp(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Me.Component=Ki;Me.Fragment=Rk;Me.Profiler=Pk;Me.PureComponent=yp;Me.StrictMode=Fk;Me.Suspense=Ak;Me.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Wk;Me.act=L0;Me.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=P0({},e.props),o=e.key,i=e.ref,s=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,s=wp.current),t.key!==void 0&&(o=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)_0.call(t,l)&&!A0.hasOwnProperty(l)&&(r[l]=t[l]===void 0&&a!==void 0?a[l]:t[l])}var l=arguments.length-2;if(l===1)r.children=n;else if(1<l){a=Array(l);for(var c=0;c<l;c++)a[c]=arguments[c+2];r.children=a}return{$$typeof:wa,type:e.type,key:o,ref:i,props:r,_owner:s}};Me.createContext=function(e){return e={$$typeof:Mk,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:$k,_context:e},e.Consumer=e};Me.createElement=N0;Me.createFactory=function(e){var t=N0.bind(null,e);return t.type=e,t};Me.createRef=function(){return{current:null}};Me.forwardRef=function(e){return{$$typeof:_k,render:e}};Me.isValidElement=xp;Me.lazy=function(e){return{$$typeof:Lk,_payload:{_status:-1,_result:e},_init:Bk}};Me.memo=function(e,t){return{$$typeof:Nk,type:e,compare:t===void 0?null:t}};Me.startTransition=function(e){var t=Nl.transition;Nl.transition={};try{e()}finally{Nl.transition=t}};Me.unstable_act=L0;Me.useCallback=function(e,t){return an.current.useCallback(e,t)};Me.useContext=function(e){return an.current.useContext(e)};Me.useDebugValue=function(){};Me.useDeferredValue=function(e){return an.current.useDeferredValue(e)};Me.useEffect=function(e,t){return an.current.useEffect(e,t)};Me.useId=function(){return an.current.useId()};Me.useImperativeHandle=function(e,t,n){return an.current.useImperativeHandle(e,t,n)};Me.useInsertionEffect=function(e,t){return an.current.useInsertionEffect(e,t)};Me.useLayoutEffect=function(e,t){return an.current.useLayoutEffect(e,t)};Me.useMemo=function(e,t){return an.current.useMemo(e,t)};Me.useReducer=function(e,t,n){return an.current.useReducer(e,t,n)};Me.useRef=function(e){return an.current.useRef(e)};Me.useState=function(e){return an.current.useState(e)};Me.useSyncExternalStore=function(e,t,n){return an.current.useSyncExternalStore(e,t,n)};Me.useTransition=function(){return an.current.useTransition()};Me.version="18.3.1";R0.exports=Me;var d=R0.exports;const me=Tk(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 Vk=d,Hk=Symbol.for("react.element"),Uk=Symbol.for("react.fragment"),Zk=Object.prototype.hasOwnProperty,Kk=Vk.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Yk={key:!0,ref:!0,__self:!0,__source:!0};function O0(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)Zk.call(t,r)&&!Yk.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:Hk,type:e,key:i,ref:s,props:o,_owner:Kk.current}}Nu.Fragment=Uk;Nu.jsx=O0;Nu.jsxs=O0;j0.exports=Nu;var u=j0.exports,Jd={},D0={exports:{}},jn={},z0={exports:{}},B0={};/**
|
|
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(T,W){var B=T.length;T.push(W);e:for(;0<B;){var D=B-1>>>1,se=T[D];if(0<o(se,W))T[D]=W,T[B]=se,B=D;else break e}}function n(T){return T.length===0?null:T[0]}function r(T){if(T.length===0)return null;var W=T[0],B=T.pop();if(B!==W){T[0]=B;e:for(var D=0,se=T.length,ie=se>>>1;D<ie;){var L=2*(D+1)-1,V=T[L],ue=L+1,oe=T[ue];if(0>o(V,B))ue<se&&0>o(oe,V)?(T[D]=oe,T[ue]=B,D=ue):(T[D]=V,T[L]=B,D=L);else if(ue<se&&0>o(oe,B))T[D]=oe,T[ue]=B,D=ue;else break e}}return W}function o(T,W){var B=T.sortIndex-W.sortIndex;return B!==0?B:T.id-W.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,a=s.now();e.unstable_now=function(){return s.now()-a}}var l=[],c=[],f=1,p=null,m=3,g=!1,w=!1,x=!1,k=typeof setTimeout=="function"?setTimeout:null,h=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 v(T){for(var W=n(c);W!==null;){if(W.callback===null)r(c);else if(W.startTime<=T)r(c),W.sortIndex=W.expirationTime,t(l,W);else break;W=n(c)}}function b(T){if(x=!1,v(T),!w)if(n(l)!==null)w=!0,Y(S);else{var W=n(c);W!==null&&A(b,W.startTime-T)}}function S(T,W){w=!1,x&&(x=!1,h(I),I=-1),g=!0;var B=m;try{for(v(W),p=n(l);p!==null&&(!(p.expirationTime>W)||T&&!N());){var D=p.callback;if(typeof D=="function"){p.callback=null,m=p.priorityLevel;var se=D(p.expirationTime<=W);W=e.unstable_now(),typeof se=="function"?p.callback=se:p===n(l)&&r(l),v(W)}else r(l);p=n(l)}if(p!==null)var ie=!0;else{var L=n(c);L!==null&&A(b,L.startTime-W),ie=!1}return ie}finally{p=null,m=B,g=!1}}var E=!1,C=null,I=-1,j=5,F=-1;function N(){return!(e.unstable_now()-F<j)}function K(){if(C!==null){var T=e.unstable_now();F=T;var W=!0;try{W=C(!0,T)}finally{W?M():(E=!1,C=null)}}else E=!1}var M;if(typeof y=="function")M=function(){y(K)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,U=$.port2;$.port1.onmessage=K,M=function(){U.postMessage(null)}}else M=function(){k(K,0)};function Y(T){C=T,E||(E=!0,M())}function A(T,W){I=k(function(){T(e.unstable_now())},W)}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(T){T.callback=null},e.unstable_continueExecution=function(){w||g||(w=!0,Y(S))},e.unstable_forceFrameRate=function(T){0>T||125<T?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):j=0<T?Math.floor(1e3/T):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function(T){switch(m){case 1:case 2:case 3:var W=3;break;default:W=m}var B=m;m=W;try{return T()}finally{m=B}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(T,W){switch(T){case 1:case 2:case 3:case 4:case 5:break;default:T=3}var B=m;m=T;try{return W()}finally{m=B}},e.unstable_scheduleCallback=function(T,W,B){var D=e.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?D+B:D):B=D,T){case 1:var se=-1;break;case 2:se=250;break;case 5:se=1073741823;break;case 4:se=1e4;break;default:se=5e3}return se=B+se,T={id:f++,callback:W,priorityLevel:T,startTime:B,expirationTime:se,sortIndex:-1},B>D?(T.sortIndex=B,t(c,T),n(l)===null&&T===n(c)&&(x?(h(I),I=-1):x=!0,A(b,B-D))):(T.sortIndex=se,t(l,T),w||g||(w=!0,Y(S))),T},e.unstable_shouldYield=N,e.unstable_wrapCallback=function(T){var W=m;return function(){var B=m;m=W;try{return T.apply(this,arguments)}finally{m=B}}}})(B0);z0.exports=B0;var Gk=z0.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 Xk=d,In=Gk;function de(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 W0=new Set,Gs={};function Ho(e,t){Li(e,t),Li(e+"Capture",t)}function Li(e,t){for(Gs[e]=t,e=0;e<t.length;e++)W0.add(t[e])}var Fr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Qd=Object.prototype.hasOwnProperty,qk=/^[: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]*$/,Cm={},Im={};function Jk(e){return Qd.call(Im,e)?!0:Qd.call(Cm,e)?!1:qk.test(e)?Im[e]=!0:(Cm[e]=!0,!1)}function Qk(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 eE(e,t,n,r){if(t===null||typeof t>"u"||Qk(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 ln(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 Bt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Bt[e]=new ln(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Bt[t]=new ln(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Bt[e]=new ln(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Bt[e]=new ln(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){Bt[e]=new ln(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Bt[e]=new ln(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Bt[e]=new ln(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Bt[e]=new ln(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Bt[e]=new ln(e,5,!1,e.toLowerCase(),null,!1,!1)});var bp=/[\-:]([a-z])/g;function Sp(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(bp,Sp);Bt[t]=new ln(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(bp,Sp);Bt[t]=new ln(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(bp,Sp);Bt[t]=new ln(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Bt[e]=new ln(e,1,!1,e.toLowerCase(),null,!1,!1)});Bt.xlinkHref=new ln("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Bt[e]=new ln(e,1,!1,e.toLowerCase(),null,!0,!0)});function kp(e,t,n,r){var o=Bt.hasOwnProperty(t)?Bt[t]:null;(o!==null?o.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(eE(t,n,o,r)&&(n=null),r||o===null?Jk(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 _r=Xk.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Ua=Symbol.for("react.element"),pi=Symbol.for("react.portal"),hi=Symbol.for("react.fragment"),Ep=Symbol.for("react.strict_mode"),ef=Symbol.for("react.profiler"),V0=Symbol.for("react.provider"),H0=Symbol.for("react.context"),Cp=Symbol.for("react.forward_ref"),tf=Symbol.for("react.suspense"),nf=Symbol.for("react.suspense_list"),Ip=Symbol.for("react.memo"),Kr=Symbol.for("react.lazy"),U0=Symbol.for("react.offscreen"),Tm=Symbol.iterator;function ps(e){return e===null||typeof e!="object"?null:(e=Tm&&e[Tm]||e["@@iterator"],typeof e=="function"?e:null)}var ct=Object.assign,Uc;function Fs(e){if(Uc===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Uc=t&&t[1]||""}return`
|
|
34
|
-
`+Uc+e}var Zc=!1;function Kc(e,t){if(!e||Zc)return"";Zc=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var r=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){r=c}e.call(t.prototype)}else{try{throw Error()}catch(c){r=c}e()}}catch(c){if(c&&r&&typeof c.stack=="string"){for(var o=c.stack.split(`
|
|
35
|
-
`),i=r.stack.split(`
|
|
36
|
-
`),s=o.length-1,a=i.length-1;1<=s&&0<=a&&o[s]!==i[a];)a--;for(;1<=s&&0<=a;s--,a--)if(o[s]!==i[a]){if(s!==1||a!==1)do if(s--,a--,0>a||o[s]!==i[a]){var l=`
|
|
37
|
-
`+o[s].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}while(1<=s&&0<=a);break}}}finally{Zc=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Fs(e):""}function tE(e){switch(e.tag){case 5:return Fs(e.type);case 16:return Fs("Lazy");case 13:return Fs("Suspense");case 19:return Fs("SuspenseList");case 0:case 2:case 15:return e=Kc(e.type,!1),e;case 11:return e=Kc(e.type.render,!1),e;case 1:return e=Kc(e.type,!0),e;default:return""}}function rf(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 hi:return"Fragment";case pi:return"Portal";case ef:return"Profiler";case Ep:return"StrictMode";case tf:return"Suspense";case nf:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case H0:return(e.displayName||"Context")+".Consumer";case V0:return(e._context.displayName||"Context")+".Provider";case Cp:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ip:return t=e.displayName||null,t!==null?t:rf(e.type)||"Memo";case Kr:t=e._payload,e=e._init;try{return rf(e(t))}catch{}}return null}function nE(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 rf(t);case 8:return t===Ep?"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 fo(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Z0(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function rE(e){var t=Z0(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 Za(e){e._valueTracker||(e._valueTracker=rE(e))}function K0(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Z0(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Jl(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 of(e,t){var n=t.checked;return ct({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function jm(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=fo(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 Y0(e,t){t=t.checked,t!=null&&kp(e,"checked",t,!1)}function sf(e,t){Y0(e,t);var n=fo(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")?af(e,t.type,n):t.hasOwnProperty("defaultValue")&&af(e,t.type,fo(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Rm(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 af(e,t,n){(t!=="number"||Jl(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Ps=Array.isArray;function ji(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=""+fo(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 lf(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(de(91));return ct({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Fm(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(de(92));if(Ps(n)){if(1<n.length)throw Error(de(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:fo(n)}}function G0(e,t){var n=fo(t.value),r=fo(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 Pm(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function X0(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 uf(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?X0(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Ka,q0=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(Ka=Ka||document.createElement("div"),Ka.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Ka.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Xs(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ls={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},oE=["Webkit","ms","Moz","O"];Object.keys(Ls).forEach(function(e){oE.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ls[t]=Ls[e]})});function J0(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Ls.hasOwnProperty(e)&&Ls[e]?(""+t).trim():t+"px"}function Q0(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=J0(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var iE=ct({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 cf(e,t){if(t){if(iE[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(de(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(de(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(de(61))}if(t.style!=null&&typeof t.style!="object")throw Error(de(62))}}function df(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 ff=null;function Tp(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var pf=null,Ri=null,Fi=null;function $m(e){if(e=Sa(e)){if(typeof pf!="function")throw Error(de(280));var t=e.stateNode;t&&(t=Bu(t),pf(e.stateNode,e.type,t))}}function ew(e){Ri?Fi?Fi.push(e):Fi=[e]:Ri=e}function tw(){if(Ri){var e=Ri,t=Fi;if(Fi=Ri=null,$m(e),t)for(e=0;e<t.length;e++)$m(t[e])}}function nw(e,t){return e(t)}function rw(){}var Yc=!1;function ow(e,t,n){if(Yc)return e(t,n);Yc=!0;try{return nw(e,t,n)}finally{Yc=!1,(Ri!==null||Fi!==null)&&(rw(),tw())}}function qs(e,t){var n=e.stateNode;if(n===null)return null;var r=Bu(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(de(231,t,typeof n));return n}var hf=!1;if(Fr)try{var hs={};Object.defineProperty(hs,"passive",{get:function(){hf=!0}}),window.addEventListener("test",hs,hs),window.removeEventListener("test",hs,hs)}catch{hf=!1}function sE(e,t,n,r,o,i,s,a,l){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(f){this.onError(f)}}var Os=!1,Ql=null,eu=!1,mf=null,aE={onError:function(e){Os=!0,Ql=e}};function lE(e,t,n,r,o,i,s,a,l){Os=!1,Ql=null,sE.apply(aE,arguments)}function uE(e,t,n,r,o,i,s,a,l){if(lE.apply(this,arguments),Os){if(Os){var c=Ql;Os=!1,Ql=null}else throw Error(de(198));eu||(eu=!0,mf=c)}}function Uo(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 iw(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 Mm(e){if(Uo(e)!==e)throw Error(de(188))}function cE(e){var t=e.alternate;if(!t){if(t=Uo(e),t===null)throw Error(de(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 Mm(o),e;if(i===r)return Mm(o),t;i=i.sibling}throw Error(de(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(de(189))}}if(n.alternate!==r)throw Error(de(190))}if(n.tag!==3)throw Error(de(188));return n.stateNode.current===n?e:t}function sw(e){return e=cE(e),e!==null?aw(e):null}function aw(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=aw(e);if(t!==null)return t;e=e.sibling}return null}var lw=In.unstable_scheduleCallback,_m=In.unstable_cancelCallback,dE=In.unstable_shouldYield,fE=In.unstable_requestPaint,yt=In.unstable_now,pE=In.unstable_getCurrentPriorityLevel,jp=In.unstable_ImmediatePriority,uw=In.unstable_UserBlockingPriority,tu=In.unstable_NormalPriority,hE=In.unstable_LowPriority,cw=In.unstable_IdlePriority,Lu=null,gr=null;function mE(e){if(gr&&typeof gr.onCommitFiberRoot=="function")try{gr.onCommitFiberRoot(Lu,e,void 0,(e.current.flags&128)===128)}catch{}}var tr=Math.clz32?Math.clz32:vE,gE=Math.log,yE=Math.LN2;function vE(e){return e>>>=0,e===0?32:31-(gE(e)/yE|0)|0}var Ya=64,Ga=4194304;function $s(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 nu(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=$s(a):(i&=s,i!==0&&(r=$s(i)))}else s=n&~o,s!==0?r=$s(s):i!==0&&(r=$s(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-tr(t),o=1<<n,r|=e[n],t&=~o;return r}function wE(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 xE(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,o=e.expirationTimes,i=e.pendingLanes;0<i;){var s=31-tr(i),a=1<<s,l=o[s];l===-1?(!(a&n)||a&r)&&(o[s]=wE(a,t)):l<=t&&(e.expiredLanes|=a),i&=~a}}function gf(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function dw(){var e=Ya;return Ya<<=1,!(Ya&4194240)&&(Ya=64),e}function Gc(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function xa(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-tr(t),e[t]=n}function bE(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-tr(n),i=1<<o;t[o]=0,r[o]=-1,e[o]=-1,n&=~i}}function Rp(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-tr(n),o=1<<r;o&t|e[r]&t&&(e[r]|=t),n&=~o}}var Be=0;function fw(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var pw,Fp,hw,mw,gw,yf=!1,Xa=[],no=null,ro=null,oo=null,Js=new Map,Qs=new Map,Gr=[],SE="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 Am(e,t){switch(e){case"focusin":case"focusout":no=null;break;case"dragenter":case"dragleave":ro=null;break;case"mouseover":case"mouseout":oo=null;break;case"pointerover":case"pointerout":Js.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Qs.delete(t.pointerId)}}function ms(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=Sa(t),t!==null&&Fp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function kE(e,t,n,r,o){switch(t){case"focusin":return no=ms(no,e,t,n,r,o),!0;case"dragenter":return ro=ms(ro,e,t,n,r,o),!0;case"mouseover":return oo=ms(oo,e,t,n,r,o),!0;case"pointerover":var i=o.pointerId;return Js.set(i,ms(Js.get(i)||null,e,t,n,r,o)),!0;case"gotpointercapture":return i=o.pointerId,Qs.set(i,ms(Qs.get(i)||null,e,t,n,r,o)),!0}return!1}function yw(e){var t=Ro(e.target);if(t!==null){var n=Uo(t);if(n!==null){if(t=n.tag,t===13){if(t=iw(n),t!==null){e.blockedOn=t,gw(e.priority,function(){hw(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 Ll(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=vf(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);ff=r,n.target.dispatchEvent(r),ff=null}else return t=Sa(n),t!==null&&Fp(t),e.blockedOn=n,!1;t.shift()}return!0}function Nm(e,t,n){Ll(e)&&n.delete(t)}function EE(){yf=!1,no!==null&&Ll(no)&&(no=null),ro!==null&&Ll(ro)&&(ro=null),oo!==null&&Ll(oo)&&(oo=null),Js.forEach(Nm),Qs.forEach(Nm)}function gs(e,t){e.blockedOn===t&&(e.blockedOn=null,yf||(yf=!0,In.unstable_scheduleCallback(In.unstable_NormalPriority,EE)))}function ea(e){function t(o){return gs(o,e)}if(0<Xa.length){gs(Xa[0],e);for(var n=1;n<Xa.length;n++){var r=Xa[n];r.blockedOn===e&&(r.blockedOn=null)}}for(no!==null&&gs(no,e),ro!==null&&gs(ro,e),oo!==null&&gs(oo,e),Js.forEach(t),Qs.forEach(t),n=0;n<Gr.length;n++)r=Gr[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Gr.length&&(n=Gr[0],n.blockedOn===null);)yw(n),n.blockedOn===null&&Gr.shift()}var Pi=_r.ReactCurrentBatchConfig,ru=!0;function CE(e,t,n,r){var o=Be,i=Pi.transition;Pi.transition=null;try{Be=1,Pp(e,t,n,r)}finally{Be=o,Pi.transition=i}}function IE(e,t,n,r){var o=Be,i=Pi.transition;Pi.transition=null;try{Be=4,Pp(e,t,n,r)}finally{Be=o,Pi.transition=i}}function Pp(e,t,n,r){if(ru){var o=vf(e,t,n,r);if(o===null)id(e,t,r,ou,n),Am(e,r);else if(kE(o,e,t,n,r))r.stopPropagation();else if(Am(e,r),t&4&&-1<SE.indexOf(e)){for(;o!==null;){var i=Sa(o);if(i!==null&&pw(i),i=vf(e,t,n,r),i===null&&id(e,t,r,ou,n),i===o)break;o=i}o!==null&&r.stopPropagation()}else id(e,t,r,null,n)}}var ou=null;function vf(e,t,n,r){if(ou=null,e=Tp(r),e=Ro(e),e!==null)if(t=Uo(e),t===null)e=null;else if(n=t.tag,n===13){if(e=iw(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 ou=e,null}function vw(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(pE()){case jp:return 1;case uw:return 4;case tu:case hE:return 16;case cw:return 536870912;default:return 16}default:return 16}}var Qr=null,$p=null,Ol=null;function ww(){if(Ol)return Ol;var e,t=$p,n=t.length,r,o="value"in Qr?Qr.value:Qr.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 Ol=o.slice(e,1<r?1-r:void 0)}function Dl(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 qa(){return!0}function Lm(){return!1}function Rn(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)?qa:Lm,this.isPropagationStopped=Lm,this}return ct(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=qa)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=qa)},persist:function(){},isPersistent:qa}),t}var Yi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Mp=Rn(Yi),ba=ct({},Yi,{view:0,detail:0}),TE=Rn(ba),Xc,qc,ys,Ou=ct({},ba,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:_p,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!==ys&&(ys&&e.type==="mousemove"?(Xc=e.screenX-ys.screenX,qc=e.screenY-ys.screenY):qc=Xc=0,ys=e),Xc)},movementY:function(e){return"movementY"in e?e.movementY:qc}}),Om=Rn(Ou),jE=ct({},Ou,{dataTransfer:0}),RE=Rn(jE),FE=ct({},ba,{relatedTarget:0}),Jc=Rn(FE),PE=ct({},Yi,{animationName:0,elapsedTime:0,pseudoElement:0}),$E=Rn(PE),ME=ct({},Yi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),_E=Rn(ME),AE=ct({},Yi,{data:0}),Dm=Rn(AE),NE={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},LE={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"},OE={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function DE(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=OE[e])?!!t[e]:!1}function _p(){return DE}var zE=ct({},ba,{key:function(e){if(e.key){var t=NE[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Dl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?LE[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:_p,charCode:function(e){return e.type==="keypress"?Dl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Dl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),BE=Rn(zE),WE=ct({},Ou,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),zm=Rn(WE),VE=ct({},ba,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:_p}),HE=Rn(VE),UE=ct({},Yi,{propertyName:0,elapsedTime:0,pseudoElement:0}),ZE=Rn(UE),KE=ct({},Ou,{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}),YE=Rn(KE),GE=[9,13,27,32],Ap=Fr&&"CompositionEvent"in window,Ds=null;Fr&&"documentMode"in document&&(Ds=document.documentMode);var XE=Fr&&"TextEvent"in window&&!Ds,xw=Fr&&(!Ap||Ds&&8<Ds&&11>=Ds),Bm=" ",Wm=!1;function bw(e,t){switch(e){case"keyup":return GE.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Sw(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var mi=!1;function qE(e,t){switch(e){case"compositionend":return Sw(t);case"keypress":return t.which!==32?null:(Wm=!0,Bm);case"textInput":return e=t.data,e===Bm&&Wm?null:e;default:return null}}function JE(e,t){if(mi)return e==="compositionend"||!Ap&&bw(e,t)?(e=ww(),Ol=$p=Qr=null,mi=!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 xw&&t.locale!=="ko"?null:t.data;default:return null}}var QE={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 Vm(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!QE[e.type]:t==="textarea"}function kw(e,t,n,r){ew(r),t=iu(t,"onChange"),0<t.length&&(n=new Mp("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var zs=null,ta=null;function eC(e){_w(e,0)}function Du(e){var t=vi(e);if(K0(t))return e}function tC(e,t){if(e==="change")return t}var Ew=!1;if(Fr){var Qc;if(Fr){var ed="oninput"in document;if(!ed){var Hm=document.createElement("div");Hm.setAttribute("oninput","return;"),ed=typeof Hm.oninput=="function"}Qc=ed}else Qc=!1;Ew=Qc&&(!document.documentMode||9<document.documentMode)}function Um(){zs&&(zs.detachEvent("onpropertychange",Cw),ta=zs=null)}function Cw(e){if(e.propertyName==="value"&&Du(ta)){var t=[];kw(t,ta,e,Tp(e)),ow(eC,t)}}function nC(e,t,n){e==="focusin"?(Um(),zs=t,ta=n,zs.attachEvent("onpropertychange",Cw)):e==="focusout"&&Um()}function rC(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Du(ta)}function oC(e,t){if(e==="click")return Du(t)}function iC(e,t){if(e==="input"||e==="change")return Du(t)}function sC(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var rr=typeof Object.is=="function"?Object.is:sC;function na(e,t){if(rr(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(!Qd.call(t,o)||!rr(e[o],t[o]))return!1}return!0}function Zm(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Km(e,t){var n=Zm(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=Zm(n)}}function Iw(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Iw(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Tw(){for(var e=window,t=Jl();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Jl(e.document)}return t}function Np(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 aC(e){var t=Tw(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Iw(n.ownerDocument.documentElement,n)){if(r!==null&&Np(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=Km(n,i);var s=Km(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 lC=Fr&&"documentMode"in document&&11>=document.documentMode,gi=null,wf=null,Bs=null,xf=!1;function Ym(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;xf||gi==null||gi!==Jl(r)||(r=gi,"selectionStart"in r&&Np(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}),Bs&&na(Bs,r)||(Bs=r,r=iu(wf,"onSelect"),0<r.length&&(t=new Mp("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=gi)))}function Ja(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var yi={animationend:Ja("Animation","AnimationEnd"),animationiteration:Ja("Animation","AnimationIteration"),animationstart:Ja("Animation","AnimationStart"),transitionend:Ja("Transition","TransitionEnd")},td={},jw={};Fr&&(jw=document.createElement("div").style,"AnimationEvent"in window||(delete yi.animationend.animation,delete yi.animationiteration.animation,delete yi.animationstart.animation),"TransitionEvent"in window||delete yi.transitionend.transition);function zu(e){if(td[e])return td[e];if(!yi[e])return e;var t=yi[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in jw)return td[e]=t[n];return e}var Rw=zu("animationend"),Fw=zu("animationiteration"),Pw=zu("animationstart"),$w=zu("transitionend"),Mw=new Map,Gm="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 go(e,t){Mw.set(e,t),Ho(t,[e])}for(var nd=0;nd<Gm.length;nd++){var rd=Gm[nd],uC=rd.toLowerCase(),cC=rd[0].toUpperCase()+rd.slice(1);go(uC,"on"+cC)}go(Rw,"onAnimationEnd");go(Fw,"onAnimationIteration");go(Pw,"onAnimationStart");go("dblclick","onDoubleClick");go("focusin","onFocus");go("focusout","onBlur");go($w,"onTransitionEnd");Li("onMouseEnter",["mouseout","mouseover"]);Li("onMouseLeave",["mouseout","mouseover"]);Li("onPointerEnter",["pointerout","pointerover"]);Li("onPointerLeave",["pointerout","pointerover"]);Ho("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Ho("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Ho("onBeforeInput",["compositionend","keypress","textInput","paste"]);Ho("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Ho("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Ho("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ms="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(" "),dC=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ms));function Xm(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,uE(r,t,void 0,e),e.currentTarget=null}function _w(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],o=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var s=r.length-1;0<=s;s--){var a=r[s],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==i&&o.isPropagationStopped())break e;Xm(o,a,c),i=l}else for(s=0;s<r.length;s++){if(a=r[s],l=a.instance,c=a.currentTarget,a=a.listener,l!==i&&o.isPropagationStopped())break e;Xm(o,a,c),i=l}}}if(eu)throw e=mf,eu=!1,mf=null,e}function Ge(e,t){var n=t[Cf];n===void 0&&(n=t[Cf]=new Set);var r=e+"__bubble";n.has(r)||(Aw(t,e,2,!1),n.add(r))}function od(e,t,n){var r=0;t&&(r|=4),Aw(n,e,r,t)}var Qa="_reactListening"+Math.random().toString(36).slice(2);function ra(e){if(!e[Qa]){e[Qa]=!0,W0.forEach(function(n){n!=="selectionchange"&&(dC.has(n)||od(n,!1,e),od(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Qa]||(t[Qa]=!0,od("selectionchange",!1,t))}}function Aw(e,t,n,r){switch(vw(t)){case 1:var o=CE;break;case 4:o=IE;break;default:o=Pp}n=o.bind(null,t,n,e),o=void 0,!hf||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 id(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=Ro(a),s===null)return;if(l=s.tag,l===5||l===6){r=i=s;continue e}a=a.parentNode}}r=r.return}ow(function(){var c=i,f=Tp(n),p=[];e:{var m=Mw.get(e);if(m!==void 0){var g=Mp,w=e;switch(e){case"keypress":if(Dl(n)===0)break e;case"keydown":case"keyup":g=BE;break;case"focusin":w="focus",g=Jc;break;case"focusout":w="blur",g=Jc;break;case"beforeblur":case"afterblur":g=Jc;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":g=Om;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":g=RE;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":g=HE;break;case Rw:case Fw:case Pw:g=$E;break;case $w:g=ZE;break;case"scroll":g=TE;break;case"wheel":g=YE;break;case"copy":case"cut":case"paste":g=_E;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":g=zm}var x=(t&4)!==0,k=!x&&e==="scroll",h=x?m!==null?m+"Capture":null:m;x=[];for(var y=c,v;y!==null;){v=y;var b=v.stateNode;if(v.tag===5&&b!==null&&(v=b,h!==null&&(b=qs(y,h),b!=null&&x.push(oa(y,b,v)))),k)break;y=y.return}0<x.length&&(m=new g(m,w,null,n,f),p.push({event:m,listeners:x}))}}if(!(t&7)){e:{if(m=e==="mouseover"||e==="pointerover",g=e==="mouseout"||e==="pointerout",m&&n!==ff&&(w=n.relatedTarget||n.fromElement)&&(Ro(w)||w[Pr]))break e;if((g||m)&&(m=f.window===f?f:(m=f.ownerDocument)?m.defaultView||m.parentWindow:window,g?(w=n.relatedTarget||n.toElement,g=c,w=w?Ro(w):null,w!==null&&(k=Uo(w),w!==k||w.tag!==5&&w.tag!==6)&&(w=null)):(g=null,w=c),g!==w)){if(x=Om,b="onMouseLeave",h="onMouseEnter",y="mouse",(e==="pointerout"||e==="pointerover")&&(x=zm,b="onPointerLeave",h="onPointerEnter",y="pointer"),k=g==null?m:vi(g),v=w==null?m:vi(w),m=new x(b,y+"leave",g,n,f),m.target=k,m.relatedTarget=v,b=null,Ro(f)===c&&(x=new x(h,y+"enter",w,n,f),x.target=v,x.relatedTarget=k,b=x),k=b,g&&w)t:{for(x=g,h=w,y=0,v=x;v;v=ei(v))y++;for(v=0,b=h;b;b=ei(b))v++;for(;0<y-v;)x=ei(x),y--;for(;0<v-y;)h=ei(h),v--;for(;y--;){if(x===h||h!==null&&x===h.alternate)break t;x=ei(x),h=ei(h)}x=null}else x=null;g!==null&&qm(p,m,g,x,!1),w!==null&&k!==null&&qm(p,k,w,x,!0)}}e:{if(m=c?vi(c):window,g=m.nodeName&&m.nodeName.toLowerCase(),g==="select"||g==="input"&&m.type==="file")var S=tC;else if(Vm(m))if(Ew)S=iC;else{S=rC;var E=nC}else(g=m.nodeName)&&g.toLowerCase()==="input"&&(m.type==="checkbox"||m.type==="radio")&&(S=oC);if(S&&(S=S(e,c))){kw(p,S,n,f);break e}E&&E(e,m,c),e==="focusout"&&(E=m._wrapperState)&&E.controlled&&m.type==="number"&&af(m,"number",m.value)}switch(E=c?vi(c):window,e){case"focusin":(Vm(E)||E.contentEditable==="true")&&(gi=E,wf=c,Bs=null);break;case"focusout":Bs=wf=gi=null;break;case"mousedown":xf=!0;break;case"contextmenu":case"mouseup":case"dragend":xf=!1,Ym(p,n,f);break;case"selectionchange":if(lC)break;case"keydown":case"keyup":Ym(p,n,f)}var C;if(Ap)e:{switch(e){case"compositionstart":var I="onCompositionStart";break e;case"compositionend":I="onCompositionEnd";break e;case"compositionupdate":I="onCompositionUpdate";break e}I=void 0}else mi?bw(e,n)&&(I="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(I="onCompositionStart");I&&(xw&&n.locale!=="ko"&&(mi||I!=="onCompositionStart"?I==="onCompositionEnd"&&mi&&(C=ww()):(Qr=f,$p="value"in Qr?Qr.value:Qr.textContent,mi=!0)),E=iu(c,I),0<E.length&&(I=new Dm(I,e,null,n,f),p.push({event:I,listeners:E}),C?I.data=C:(C=Sw(n),C!==null&&(I.data=C)))),(C=XE?qE(e,n):JE(e,n))&&(c=iu(c,"onBeforeInput"),0<c.length&&(f=new Dm("onBeforeInput","beforeinput",null,n,f),p.push({event:f,listeners:c}),f.data=C))}_w(p,t)})}function oa(e,t,n){return{instance:e,listener:t,currentTarget:n}}function iu(e,t){for(var n=t+"Capture",r=[];e!==null;){var o=e,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=qs(e,n),i!=null&&r.unshift(oa(e,i,o)),i=qs(e,t),i!=null&&r.push(oa(e,i,o))),e=e.return}return r}function ei(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function qm(e,t,n,r,o){for(var i=t._reactName,s=[];n!==null&&n!==r;){var a=n,l=a.alternate,c=a.stateNode;if(l!==null&&l===r)break;a.tag===5&&c!==null&&(a=c,o?(l=qs(n,i),l!=null&&s.unshift(oa(n,l,a))):o||(l=qs(n,i),l!=null&&s.push(oa(n,l,a)))),n=n.return}s.length!==0&&e.push({event:t,listeners:s})}var fC=/\r\n?/g,pC=/\u0000|\uFFFD/g;function Jm(e){return(typeof e=="string"?e:""+e).replace(fC,`
|
|
38
|
-
`).replace(pC,"")}function el(e,t,n){if(t=Jm(t),Jm(e)!==t&&n)throw Error(de(425))}function su(){}var bf=null,Sf=null;function kf(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 Ef=typeof setTimeout=="function"?setTimeout:void 0,hC=typeof clearTimeout=="function"?clearTimeout:void 0,Qm=typeof Promise=="function"?Promise:void 0,mC=typeof queueMicrotask=="function"?queueMicrotask:typeof Qm<"u"?function(e){return Qm.resolve(null).then(e).catch(gC)}:Ef;function gC(e){setTimeout(function(){throw e})}function sd(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),ea(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=o}while(n);ea(t)}function io(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 eg(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 Gi=Math.random().toString(36).slice(2),hr="__reactFiber$"+Gi,ia="__reactProps$"+Gi,Pr="__reactContainer$"+Gi,Cf="__reactEvents$"+Gi,yC="__reactListeners$"+Gi,vC="__reactHandles$"+Gi;function Ro(e){var t=e[hr];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Pr]||n[hr]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=eg(e);e!==null;){if(n=e[hr])return n;e=eg(e)}return t}e=n,n=e.parentNode}return null}function Sa(e){return e=e[hr]||e[Pr],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function vi(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(de(33))}function Bu(e){return e[ia]||null}var If=[],wi=-1;function yo(e){return{current:e}}function qe(e){0>wi||(e.current=If[wi],If[wi]=null,wi--)}function Ke(e,t){wi++,If[wi]=e.current,e.current=t}var po={},qt=yo(po),mn=yo(!1),No=po;function Oi(e,t){var n=e.type.contextTypes;if(!n)return po;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 gn(e){return e=e.childContextTypes,e!=null}function au(){qe(mn),qe(qt)}function tg(e,t,n){if(qt.current!==po)throw Error(de(168));Ke(qt,t),Ke(mn,n)}function Nw(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(de(108,nE(e)||"Unknown",o));return ct({},n,r)}function lu(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||po,No=qt.current,Ke(qt,e),Ke(mn,mn.current),!0}function ng(e,t,n){var r=e.stateNode;if(!r)throw Error(de(169));n?(e=Nw(e,t,No),r.__reactInternalMemoizedMergedChildContext=e,qe(mn),qe(qt),Ke(qt,e)):qe(mn),Ke(mn,n)}var Er=null,Wu=!1,ad=!1;function Lw(e){Er===null?Er=[e]:Er.push(e)}function wC(e){Wu=!0,Lw(e)}function vo(){if(!ad&&Er!==null){ad=!0;var e=0,t=Be;try{var n=Er;for(Be=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Er=null,Wu=!1}catch(o){throw Er!==null&&(Er=Er.slice(e+1)),lw(jp,vo),o}finally{Be=t,ad=!1}}return null}var xi=[],bi=0,uu=null,cu=0,On=[],Dn=0,Lo=null,Ir=1,Tr="";function To(e,t){xi[bi++]=cu,xi[bi++]=uu,uu=e,cu=t}function Ow(e,t,n){On[Dn++]=Ir,On[Dn++]=Tr,On[Dn++]=Lo,Lo=e;var r=Ir;e=Tr;var o=32-tr(r)-1;r&=~(1<<o),n+=1;var i=32-tr(t)+o;if(30<i){var s=o-o%5;i=(r&(1<<s)-1).toString(32),r>>=s,o-=s,Ir=1<<32-tr(t)+o|n<<o|r,Tr=i+e}else Ir=1<<i|n<<o|r,Tr=e}function Lp(e){e.return!==null&&(To(e,1),Ow(e,1,0))}function Op(e){for(;e===uu;)uu=xi[--bi],xi[bi]=null,cu=xi[--bi],xi[bi]=null;for(;e===Lo;)Lo=On[--Dn],On[Dn]=null,Tr=On[--Dn],On[Dn]=null,Ir=On[--Dn],On[Dn]=null}var Cn=null,En=null,tt=!1,er=null;function Dw(e,t){var n=Wn(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 rg(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Cn=e,En=io(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Cn=e,En=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Lo!==null?{id:Ir,overflow:Tr}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Wn(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Cn=e,En=null,!0):!1;default:return!1}}function Tf(e){return(e.mode&1)!==0&&(e.flags&128)===0}function jf(e){if(tt){var t=En;if(t){var n=t;if(!rg(e,t)){if(Tf(e))throw Error(de(418));t=io(n.nextSibling);var r=Cn;t&&rg(e,t)?Dw(r,n):(e.flags=e.flags&-4097|2,tt=!1,Cn=e)}}else{if(Tf(e))throw Error(de(418));e.flags=e.flags&-4097|2,tt=!1,Cn=e}}}function og(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Cn=e}function tl(e){if(e!==Cn)return!1;if(!tt)return og(e),tt=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!kf(e.type,e.memoizedProps)),t&&(t=En)){if(Tf(e))throw zw(),Error(de(418));for(;t;)Dw(e,t),t=io(t.nextSibling)}if(og(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(de(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){En=io(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}En=null}}else En=Cn?io(e.stateNode.nextSibling):null;return!0}function zw(){for(var e=En;e;)e=io(e.nextSibling)}function Di(){En=Cn=null,tt=!1}function Dp(e){er===null?er=[e]:er.push(e)}var xC=_r.ReactCurrentBatchConfig;function vs(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(de(309));var r=n.stateNode}if(!r)throw Error(de(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(de(284));if(!n._owner)throw Error(de(290,e))}return e}function nl(e,t){throw e=Object.prototype.toString.call(t),Error(de(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function ig(e){var t=e._init;return t(e._payload)}function Bw(e){function t(h,y){if(e){var v=h.deletions;v===null?(h.deletions=[y],h.flags|=16):v.push(y)}}function n(h,y){if(!e)return null;for(;y!==null;)t(h,y),y=y.sibling;return null}function r(h,y){for(h=new Map;y!==null;)y.key!==null?h.set(y.key,y):h.set(y.index,y),y=y.sibling;return h}function o(h,y){return h=uo(h,y),h.index=0,h.sibling=null,h}function i(h,y,v){return h.index=v,e?(v=h.alternate,v!==null?(v=v.index,v<y?(h.flags|=2,y):v):(h.flags|=2,y)):(h.flags|=1048576,y)}function s(h){return e&&h.alternate===null&&(h.flags|=2),h}function a(h,y,v,b){return y===null||y.tag!==6?(y=hd(v,h.mode,b),y.return=h,y):(y=o(y,v),y.return=h,y)}function l(h,y,v,b){var S=v.type;return S===hi?f(h,y,v.props.children,b,v.key):y!==null&&(y.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Kr&&ig(S)===y.type)?(b=o(y,v.props),b.ref=vs(h,y,v),b.return=h,b):(b=Zl(v.type,v.key,v.props,null,h.mode,b),b.ref=vs(h,y,v),b.return=h,b)}function c(h,y,v,b){return y===null||y.tag!==4||y.stateNode.containerInfo!==v.containerInfo||y.stateNode.implementation!==v.implementation?(y=md(v,h.mode,b),y.return=h,y):(y=o(y,v.children||[]),y.return=h,y)}function f(h,y,v,b,S){return y===null||y.tag!==7?(y=Ao(v,h.mode,b,S),y.return=h,y):(y=o(y,v),y.return=h,y)}function p(h,y,v){if(typeof y=="string"&&y!==""||typeof y=="number")return y=hd(""+y,h.mode,v),y.return=h,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case Ua:return v=Zl(y.type,y.key,y.props,null,h.mode,v),v.ref=vs(h,null,y),v.return=h,v;case pi:return y=md(y,h.mode,v),y.return=h,y;case Kr:var b=y._init;return p(h,b(y._payload),v)}if(Ps(y)||ps(y))return y=Ao(y,h.mode,v,null),y.return=h,y;nl(h,y)}return null}function m(h,y,v,b){var S=y!==null?y.key:null;if(typeof v=="string"&&v!==""||typeof v=="number")return S!==null?null:a(h,y,""+v,b);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Ua:return v.key===S?l(h,y,v,b):null;case pi:return v.key===S?c(h,y,v,b):null;case Kr:return S=v._init,m(h,y,S(v._payload),b)}if(Ps(v)||ps(v))return S!==null?null:f(h,y,v,b,null);nl(h,v)}return null}function g(h,y,v,b,S){if(typeof b=="string"&&b!==""||typeof b=="number")return h=h.get(v)||null,a(y,h,""+b,S);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case Ua:return h=h.get(b.key===null?v:b.key)||null,l(y,h,b,S);case pi:return h=h.get(b.key===null?v:b.key)||null,c(y,h,b,S);case Kr:var E=b._init;return g(h,y,v,E(b._payload),S)}if(Ps(b)||ps(b))return h=h.get(v)||null,f(y,h,b,S,null);nl(y,b)}return null}function w(h,y,v,b){for(var S=null,E=null,C=y,I=y=0,j=null;C!==null&&I<v.length;I++){C.index>I?(j=C,C=null):j=C.sibling;var F=m(h,C,v[I],b);if(F===null){C===null&&(C=j);break}e&&C&&F.alternate===null&&t(h,C),y=i(F,y,I),E===null?S=F:E.sibling=F,E=F,C=j}if(I===v.length)return n(h,C),tt&&To(h,I),S;if(C===null){for(;I<v.length;I++)C=p(h,v[I],b),C!==null&&(y=i(C,y,I),E===null?S=C:E.sibling=C,E=C);return tt&&To(h,I),S}for(C=r(h,C);I<v.length;I++)j=g(C,h,I,v[I],b),j!==null&&(e&&j.alternate!==null&&C.delete(j.key===null?I:j.key),y=i(j,y,I),E===null?S=j:E.sibling=j,E=j);return e&&C.forEach(function(N){return t(h,N)}),tt&&To(h,I),S}function x(h,y,v,b){var S=ps(v);if(typeof S!="function")throw Error(de(150));if(v=S.call(v),v==null)throw Error(de(151));for(var E=S=null,C=y,I=y=0,j=null,F=v.next();C!==null&&!F.done;I++,F=v.next()){C.index>I?(j=C,C=null):j=C.sibling;var N=m(h,C,F.value,b);if(N===null){C===null&&(C=j);break}e&&C&&N.alternate===null&&t(h,C),y=i(N,y,I),E===null?S=N:E.sibling=N,E=N,C=j}if(F.done)return n(h,C),tt&&To(h,I),S;if(C===null){for(;!F.done;I++,F=v.next())F=p(h,F.value,b),F!==null&&(y=i(F,y,I),E===null?S=F:E.sibling=F,E=F);return tt&&To(h,I),S}for(C=r(h,C);!F.done;I++,F=v.next())F=g(C,h,I,F.value,b),F!==null&&(e&&F.alternate!==null&&C.delete(F.key===null?I:F.key),y=i(F,y,I),E===null?S=F:E.sibling=F,E=F);return e&&C.forEach(function(K){return t(h,K)}),tt&&To(h,I),S}function k(h,y,v,b){if(typeof v=="object"&&v!==null&&v.type===hi&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case Ua:e:{for(var S=v.key,E=y;E!==null;){if(E.key===S){if(S=v.type,S===hi){if(E.tag===7){n(h,E.sibling),y=o(E,v.props.children),y.return=h,h=y;break e}}else if(E.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Kr&&ig(S)===E.type){n(h,E.sibling),y=o(E,v.props),y.ref=vs(h,E,v),y.return=h,h=y;break e}n(h,E);break}else t(h,E);E=E.sibling}v.type===hi?(y=Ao(v.props.children,h.mode,b,v.key),y.return=h,h=y):(b=Zl(v.type,v.key,v.props,null,h.mode,b),b.ref=vs(h,y,v),b.return=h,h=b)}return s(h);case pi:e:{for(E=v.key;y!==null;){if(y.key===E)if(y.tag===4&&y.stateNode.containerInfo===v.containerInfo&&y.stateNode.implementation===v.implementation){n(h,y.sibling),y=o(y,v.children||[]),y.return=h,h=y;break e}else{n(h,y);break}else t(h,y);y=y.sibling}y=md(v,h.mode,b),y.return=h,h=y}return s(h);case Kr:return E=v._init,k(h,y,E(v._payload),b)}if(Ps(v))return w(h,y,v,b);if(ps(v))return x(h,y,v,b);nl(h,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,y!==null&&y.tag===6?(n(h,y.sibling),y=o(y,v),y.return=h,h=y):(n(h,y),y=hd(v,h.mode,b),y.return=h,h=y),s(h)):n(h,y)}return k}var zi=Bw(!0),Ww=Bw(!1),du=yo(null),fu=null,Si=null,zp=null;function Bp(){zp=Si=fu=null}function Wp(e){var t=du.current;qe(du),e._currentValue=t}function Rf(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 $i(e,t){fu=e,zp=Si=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(hn=!0),e.firstContext=null)}function Un(e){var t=e._currentValue;if(zp!==e)if(e={context:e,memoizedValue:t,next:null},Si===null){if(fu===null)throw Error(de(308));Si=e,fu.dependencies={lanes:0,firstContext:e}}else Si=Si.next=e;return t}var Fo=null;function Vp(e){Fo===null?Fo=[e]:Fo.push(e)}function Vw(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,Vp(t)):(n.next=o.next,o.next=n),t.interleaved=n,$r(e,r)}function $r(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 Yr=!1;function Hp(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Hw(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 Rr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function so(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ae&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,$r(e,n)}return o=r.interleaved,o===null?(t.next=t,Vp(r)):(t.next=o.next,o.next=t),r.interleaved=t,$r(e,n)}function zl(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,Rp(e,n)}}function sg(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 pu(e,t,n,r){var o=e.updateQueue;Yr=!1;var i=o.firstBaseUpdate,s=o.lastBaseUpdate,a=o.shared.pending;if(a!==null){o.shared.pending=null;var l=a,c=l.next;l.next=null,s===null?i=c:s.next=c,s=l;var f=e.alternate;f!==null&&(f=f.updateQueue,a=f.lastBaseUpdate,a!==s&&(a===null?f.firstBaseUpdate=c:a.next=c,f.lastBaseUpdate=l))}if(i!==null){var p=o.baseState;s=0,f=c=l=null,a=i;do{var m=a.lane,g=a.eventTime;if((r&m)===m){f!==null&&(f=f.next={eventTime:g,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var w=e,x=a;switch(m=t,g=n,x.tag){case 1:if(w=x.payload,typeof w=="function"){p=w.call(g,p,m);break e}p=w;break e;case 3:w.flags=w.flags&-65537|128;case 0:if(w=x.payload,m=typeof w=="function"?w.call(g,p,m):w,m==null)break e;p=ct({},p,m);break e;case 2:Yr=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,m=o.effects,m===null?o.effects=[a]:m.push(a))}else g={eventTime:g,lane:m,tag:a.tag,payload:a.payload,callback:a.callback,next:null},f===null?(c=f=g,l=p):f=f.next=g,s|=m;if(a=a.next,a===null){if(a=o.shared.pending,a===null)break;m=a,a=m.next,m.next=null,o.lastBaseUpdate=m,o.shared.pending=null}}while(!0);if(f===null&&(l=p),o.baseState=l,o.firstBaseUpdate=c,o.lastBaseUpdate=f,t=o.shared.interleaved,t!==null){o=t;do s|=o.lane,o=o.next;while(o!==t)}else i===null&&(o.shared.lanes=0);Do|=s,e.lanes=s,e.memoizedState=p}}function ag(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(de(191,o));o.call(r)}}}var ka={},yr=yo(ka),sa=yo(ka),aa=yo(ka);function Po(e){if(e===ka)throw Error(de(174));return e}function Up(e,t){switch(Ke(aa,t),Ke(sa,e),Ke(yr,ka),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:uf(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=uf(t,e)}qe(yr),Ke(yr,t)}function Bi(){qe(yr),qe(sa),qe(aa)}function Uw(e){Po(aa.current);var t=Po(yr.current),n=uf(t,e.type);t!==n&&(Ke(sa,e),Ke(yr,n))}function Zp(e){sa.current===e&&(qe(yr),qe(sa))}var lt=yo(0);function hu(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 ld=[];function Kp(){for(var e=0;e<ld.length;e++)ld[e]._workInProgressVersionPrimary=null;ld.length=0}var Bl=_r.ReactCurrentDispatcher,ud=_r.ReactCurrentBatchConfig,Oo=0,ut=null,It=null,$t=null,mu=!1,Ws=!1,la=0,bC=0;function Ht(){throw Error(de(321))}function Yp(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!rr(e[n],t[n]))return!1;return!0}function Gp(e,t,n,r,o,i){if(Oo=i,ut=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Bl.current=e===null||e.memoizedState===null?CC:IC,e=n(r,o),Ws){i=0;do{if(Ws=!1,la=0,25<=i)throw Error(de(301));i+=1,$t=It=null,t.updateQueue=null,Bl.current=TC,e=n(r,o)}while(Ws)}if(Bl.current=gu,t=It!==null&&It.next!==null,Oo=0,$t=It=ut=null,mu=!1,t)throw Error(de(300));return e}function Xp(){var e=la!==0;return la=0,e}function fr(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return $t===null?ut.memoizedState=$t=e:$t=$t.next=e,$t}function Zn(){if(It===null){var e=ut.alternate;e=e!==null?e.memoizedState:null}else e=It.next;var t=$t===null?ut.memoizedState:$t.next;if(t!==null)$t=t,It=e;else{if(e===null)throw Error(de(310));It=e,e={memoizedState:It.memoizedState,baseState:It.baseState,baseQueue:It.baseQueue,queue:It.queue,next:null},$t===null?ut.memoizedState=$t=e:$t=$t.next=e}return $t}function ua(e,t){return typeof t=="function"?t(e):t}function cd(e){var t=Zn(),n=t.queue;if(n===null)throw Error(de(311));n.lastRenderedReducer=e;var r=It,o=r.baseQueue,i=n.pending;if(i!==null){if(o!==null){var s=o.next;o.next=i.next,i.next=s}r.baseQueue=o=i,n.pending=null}if(o!==null){i=o.next,r=r.baseState;var a=s=null,l=null,c=i;do{var f=c.lane;if((Oo&f)===f)l!==null&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:e(r,c.action);else{var p={lane:f,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(a=l=p,s=r):l=l.next=p,ut.lanes|=f,Do|=f}c=c.next}while(c!==null&&c!==i);l===null?s=r:l.next=a,rr(r,t.memoizedState)||(hn=!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,ut.lanes|=i,Do|=i,o=o.next;while(o!==e)}else o===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function dd(e){var t=Zn(),n=t.queue;if(n===null)throw Error(de(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);rr(i,t.memoizedState)||(hn=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function Zw(){}function Kw(e,t){var n=ut,r=Zn(),o=t(),i=!rr(r.memoizedState,o);if(i&&(r.memoizedState=o,hn=!0),r=r.queue,qp(Xw.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||$t!==null&&$t.memoizedState.tag&1){if(n.flags|=2048,ca(9,Gw.bind(null,n,r,o,t),void 0,null),Mt===null)throw Error(de(349));Oo&30||Yw(n,t,o)}return o}function Yw(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=ut.updateQueue,t===null?(t={lastEffect:null,stores:null},ut.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Gw(e,t,n,r){t.value=n,t.getSnapshot=r,qw(t)&&Jw(e)}function Xw(e,t,n){return n(function(){qw(t)&&Jw(e)})}function qw(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!rr(e,n)}catch{return!0}}function Jw(e){var t=$r(e,1);t!==null&&nr(t,e,1,-1)}function lg(e){var t=fr();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ua,lastRenderedState:e},t.queue=e,e=e.dispatch=EC.bind(null,ut,e),[t.memoizedState,e]}function ca(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=ut.updateQueue,t===null?(t={lastEffect:null,stores:null},ut.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 Qw(){return Zn().memoizedState}function Wl(e,t,n,r){var o=fr();ut.flags|=e,o.memoizedState=ca(1|t,n,void 0,r===void 0?null:r)}function Vu(e,t,n,r){var o=Zn();r=r===void 0?null:r;var i=void 0;if(It!==null){var s=It.memoizedState;if(i=s.destroy,r!==null&&Yp(r,s.deps)){o.memoizedState=ca(t,n,i,r);return}}ut.flags|=e,o.memoizedState=ca(1|t,n,i,r)}function ug(e,t){return Wl(8390656,8,e,t)}function qp(e,t){return Vu(2048,8,e,t)}function ex(e,t){return Vu(4,2,e,t)}function tx(e,t){return Vu(4,4,e,t)}function nx(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 rx(e,t,n){return n=n!=null?n.concat([e]):null,Vu(4,4,nx.bind(null,t,e),n)}function Jp(){}function ox(e,t){var n=Zn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Yp(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ix(e,t){var n=Zn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Yp(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function sx(e,t,n){return Oo&21?(rr(n,t)||(n=dw(),ut.lanes|=n,Do|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,hn=!0),e.memoizedState=n)}function SC(e,t){var n=Be;Be=n!==0&&4>n?n:4,e(!0);var r=ud.transition;ud.transition={};try{e(!1),t()}finally{Be=n,ud.transition=r}}function ax(){return Zn().memoizedState}function kC(e,t,n){var r=lo(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},lx(e))ux(t,n);else if(n=Vw(e,t,n,r),n!==null){var o=sn();nr(n,e,r,o),cx(n,t,r)}}function EC(e,t,n){var r=lo(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(lx(e))ux(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,rr(a,s)){var l=t.interleaved;l===null?(o.next=o,Vp(t)):(o.next=l.next,l.next=o),t.interleaved=o;return}}catch{}finally{}n=Vw(e,t,o,r),n!==null&&(o=sn(),nr(n,e,r,o),cx(n,t,r))}}function lx(e){var t=e.alternate;return e===ut||t!==null&&t===ut}function ux(e,t){Ws=mu=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function cx(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Rp(e,n)}}var gu={readContext:Un,useCallback:Ht,useContext:Ht,useEffect:Ht,useImperativeHandle:Ht,useInsertionEffect:Ht,useLayoutEffect:Ht,useMemo:Ht,useReducer:Ht,useRef:Ht,useState:Ht,useDebugValue:Ht,useDeferredValue:Ht,useTransition:Ht,useMutableSource:Ht,useSyncExternalStore:Ht,useId:Ht,unstable_isNewReconciler:!1},CC={readContext:Un,useCallback:function(e,t){return fr().memoizedState=[e,t===void 0?null:t],e},useContext:Un,useEffect:ug,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Wl(4194308,4,nx.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Wl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Wl(4,2,e,t)},useMemo:function(e,t){var n=fr();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=fr();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=kC.bind(null,ut,e),[r.memoizedState,e]},useRef:function(e){var t=fr();return e={current:e},t.memoizedState=e},useState:lg,useDebugValue:Jp,useDeferredValue:function(e){return fr().memoizedState=e},useTransition:function(){var e=lg(!1),t=e[0];return e=SC.bind(null,e[1]),fr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ut,o=fr();if(tt){if(n===void 0)throw Error(de(407));n=n()}else{if(n=t(),Mt===null)throw Error(de(349));Oo&30||Yw(r,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,ug(Xw.bind(null,r,i,e),[e]),r.flags|=2048,ca(9,Gw.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=fr(),t=Mt.identifierPrefix;if(tt){var n=Tr,r=Ir;n=(r&~(1<<32-tr(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=la++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=bC++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},IC={readContext:Un,useCallback:ox,useContext:Un,useEffect:qp,useImperativeHandle:rx,useInsertionEffect:ex,useLayoutEffect:tx,useMemo:ix,useReducer:cd,useRef:Qw,useState:function(){return cd(ua)},useDebugValue:Jp,useDeferredValue:function(e){var t=Zn();return sx(t,It.memoizedState,e)},useTransition:function(){var e=cd(ua)[0],t=Zn().memoizedState;return[e,t]},useMutableSource:Zw,useSyncExternalStore:Kw,useId:ax,unstable_isNewReconciler:!1},TC={readContext:Un,useCallback:ox,useContext:Un,useEffect:qp,useImperativeHandle:rx,useInsertionEffect:ex,useLayoutEffect:tx,useMemo:ix,useReducer:dd,useRef:Qw,useState:function(){return dd(ua)},useDebugValue:Jp,useDeferredValue:function(e){var t=Zn();return It===null?t.memoizedState=e:sx(t,It.memoizedState,e)},useTransition:function(){var e=dd(ua)[0],t=Zn().memoizedState;return[e,t]},useMutableSource:Zw,useSyncExternalStore:Kw,useId:ax,unstable_isNewReconciler:!1};function Jn(e,t){if(e&&e.defaultProps){t=ct({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Ff(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:ct({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Hu={isMounted:function(e){return(e=e._reactInternals)?Uo(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=sn(),o=lo(e),i=Rr(r,o);i.payload=t,n!=null&&(i.callback=n),t=so(e,i,o),t!==null&&(nr(t,e,o,r),zl(t,e,o))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=sn(),o=lo(e),i=Rr(r,o);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=so(e,i,o),t!==null&&(nr(t,e,o,r),zl(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=sn(),r=lo(e),o=Rr(n,r);o.tag=2,t!=null&&(o.callback=t),t=so(e,o,r),t!==null&&(nr(t,e,r,n),zl(t,e,r))}};function cg(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?!na(n,r)||!na(o,i):!0}function dx(e,t,n){var r=!1,o=po,i=t.contextType;return typeof i=="object"&&i!==null?i=Un(i):(o=gn(t)?No:qt.current,r=t.contextTypes,i=(r=r!=null)?Oi(e,o):po),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Hu,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=i),t}function dg(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&&Hu.enqueueReplaceState(t,t.state,null)}function Pf(e,t,n,r){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs={},Hp(e);var i=t.contextType;typeof i=="object"&&i!==null?o.context=Un(i):(i=gn(t)?No:qt.current,o.context=Oi(e,i)),o.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Ff(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&&Hu.enqueueReplaceState(o,o.state,null),pu(e,n,o,r),o.state=e.memoizedState),typeof o.componentDidMount=="function"&&(e.flags|=4194308)}function Wi(e,t){try{var n="",r=t;do n+=tE(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 fd(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function $f(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var jC=typeof WeakMap=="function"?WeakMap:Map;function fx(e,t,n){n=Rr(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){vu||(vu=!0,Wf=r),$f(e,t)},n}function px(e,t,n){n=Rr(-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(){$f(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){$f(e,t),typeof r!="function"&&(ao===null?ao=new Set([this]):ao.add(this));var s=t.stack;this.componentDidCatch(t.value,{componentStack:s!==null?s:""})}),n}function fg(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new jC;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=WC.bind(null,e,t,n),t.then(e,e))}function pg(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 hg(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=Rr(-1,1),t.tag=2,so(n,t,1))),n.lanes|=1),e)}var RC=_r.ReactCurrentOwner,hn=!1;function on(e,t,n,r){t.child=e===null?Ww(t,null,n,r):zi(t,e.child,n,r)}function mg(e,t,n,r,o){n=n.render;var i=t.ref;return $i(t,o),r=Gp(e,t,n,r,i,o),n=Xp(),e!==null&&!hn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Mr(e,t,o)):(tt&&n&&Lp(t),t.flags|=1,on(e,t,r,o),t.child)}function gg(e,t,n,r,o){if(e===null){var i=n.type;return typeof i=="function"&&!sh(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,hx(e,t,i,r,o)):(e=Zl(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:na,n(s,r)&&e.ref===t.ref)return Mr(e,t,o)}return t.flags|=1,e=uo(i,r),e.ref=t.ref,e.return=t,t.child=e}function hx(e,t,n,r,o){if(e!==null){var i=e.memoizedProps;if(na(i,r)&&e.ref===t.ref)if(hn=!1,t.pendingProps=r=i,(e.lanes&o)!==0)e.flags&131072&&(hn=!0);else return t.lanes=e.lanes,Mr(e,t,o)}return Mf(e,t,n,r,o)}function mx(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},Ke(Ei,kn),kn|=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,Ke(Ei,kn),kn|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,Ke(Ei,kn),kn|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,Ke(Ei,kn),kn|=r;return on(e,t,o,n),t.child}function gx(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Mf(e,t,n,r,o){var i=gn(n)?No:qt.current;return i=Oi(t,i),$i(t,o),n=Gp(e,t,n,r,i,o),r=Xp(),e!==null&&!hn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Mr(e,t,o)):(tt&&r&&Lp(t),t.flags|=1,on(e,t,n,o),t.child)}function yg(e,t,n,r,o){if(gn(n)){var i=!0;lu(t)}else i=!1;if($i(t,o),t.stateNode===null)Vl(e,t),dx(t,n,r),Pf(t,n,r,o),r=!0;else if(e===null){var s=t.stateNode,a=t.memoizedProps;s.props=a;var l=s.context,c=n.contextType;typeof c=="object"&&c!==null?c=Un(c):(c=gn(n)?No:qt.current,c=Oi(t,c));var f=n.getDerivedStateFromProps,p=typeof f=="function"||typeof s.getSnapshotBeforeUpdate=="function";p||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==r||l!==c)&&dg(t,s,r,c),Yr=!1;var m=t.memoizedState;s.state=m,pu(t,r,s,o),l=t.memoizedState,a!==r||m!==l||mn.current||Yr?(typeof f=="function"&&(Ff(t,n,f,r),l=t.memoizedState),(a=Yr||cg(t,n,a,r,m,l,c))?(p||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(t.flags|=4194308)):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),s.props=r,s.state=l,s.context=c,r=a):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{s=t.stateNode,Hw(e,t),a=t.memoizedProps,c=t.type===t.elementType?a:Jn(t.type,a),s.props=c,p=t.pendingProps,m=s.context,l=n.contextType,typeof l=="object"&&l!==null?l=Un(l):(l=gn(n)?No:qt.current,l=Oi(t,l));var g=n.getDerivedStateFromProps;(f=typeof g=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==p||m!==l)&&dg(t,s,r,l),Yr=!1,m=t.memoizedState,s.state=m,pu(t,r,s,o);var w=t.memoizedState;a!==p||m!==w||mn.current||Yr?(typeof g=="function"&&(Ff(t,n,g,r),w=t.memoizedState),(c=Yr||cg(t,n,c,r,m,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&&m===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=w),s.props=r,s.state=w,s.context=l,r=c):(typeof s.componentDidUpdate!="function"||a===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),r=!1)}return _f(e,t,n,r,i,o)}function _f(e,t,n,r,o,i){gx(e,t);var s=(t.flags&128)!==0;if(!r&&!s)return o&&ng(t,n,!1),Mr(e,t,i);r=t.stateNode,RC.current=t;var a=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&s?(t.child=zi(t,e.child,null,i),t.child=zi(t,null,a,i)):on(e,t,a,i),t.memoizedState=r.state,o&&ng(t,n,!0),t.child}function yx(e){var t=e.stateNode;t.pendingContext?tg(e,t.pendingContext,t.pendingContext!==t.context):t.context&&tg(e,t.context,!1),Up(e,t.containerInfo)}function vg(e,t,n,r,o){return Di(),Dp(o),t.flags|=256,on(e,t,n,r),t.child}var Af={dehydrated:null,treeContext:null,retryLane:0};function Nf(e){return{baseLanes:e,cachePool:null,transitions:null}}function vx(e,t,n){var r=t.pendingProps,o=lt.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),Ke(lt,o&1),e===null)return jf(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=Ku(s,r,0,null),e=Ao(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Nf(n),t.memoizedState=Af,e):Qp(t,s));if(o=e.memoizedState,o!==null&&(a=o.dehydrated,a!==null))return FC(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=uo(o,l),r.subtreeFlags=o.subtreeFlags&14680064),a!==null?i=uo(a,i):(i=Ao(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?Nf(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=e.childLanes&~n,t.memoizedState=Af,r}return i=e.child,e=i.sibling,r=uo(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 Qp(e,t){return t=Ku({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function rl(e,t,n,r){return r!==null&&Dp(r),zi(t,e.child,null,n),e=Qp(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function FC(e,t,n,r,o,i,s){if(n)return t.flags&256?(t.flags&=-257,r=fd(Error(de(422))),rl(e,t,s,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,o=t.mode,r=Ku({mode:"visible",children:r.children},o,0,null),i=Ao(i,o,s,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&zi(t,e.child,null,s),t.child.memoizedState=Nf(s),t.memoizedState=Af,i);if(!(t.mode&1))return rl(e,t,s,null);if(o.data==="$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var a=r.dgst;return r=a,i=Error(de(419)),r=fd(i,r,void 0),rl(e,t,s,r)}if(a=(s&e.childLanes)!==0,hn||a){if(r=Mt,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,$r(e,o),nr(r,e,o,-1))}return ih(),r=fd(Error(de(421))),rl(e,t,s,r)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=VC.bind(null,e),o._reactRetry=t,null):(e=i.treeContext,En=io(o.nextSibling),Cn=t,tt=!0,er=null,e!==null&&(On[Dn++]=Ir,On[Dn++]=Tr,On[Dn++]=Lo,Ir=e.id,Tr=e.overflow,Lo=t),t=Qp(t,r.children),t.flags|=4096,t)}function wg(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Rf(e.return,t,n)}function pd(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 wx(e,t,n){var r=t.pendingProps,o=r.revealOrder,i=r.tail;if(on(e,t,r.children,n),r=lt.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&&wg(e,n,t);else if(e.tag===19)wg(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(Ke(lt,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&&hu(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),pd(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&&hu(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}pd(t,!0,n,null,i);break;case"together":pd(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Vl(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),Do|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(de(153));if(t.child!==null){for(e=t.child,n=uo(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=uo(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function PC(e,t,n){switch(t.tag){case 3:yx(t),Di();break;case 5:Uw(t);break;case 1:gn(t.type)&&lu(t);break;case 4:Up(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;Ke(du,r._currentValue),r._currentValue=o;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(Ke(lt,lt.current&1),t.flags|=128,null):n&t.child.childLanes?vx(e,t,n):(Ke(lt,lt.current&1),e=Mr(e,t,n),e!==null?e.sibling:null);Ke(lt,lt.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return wx(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),Ke(lt,lt.current),r)break;return null;case 22:case 23:return t.lanes=0,mx(e,t,n)}return Mr(e,t,n)}var xx,Lf,bx,Sx;xx=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}};Lf=function(){};bx=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,Po(yr.current);var i=null;switch(n){case"input":o=of(e,o),r=of(e,r),i=[];break;case"select":o=ct({},o,{value:void 0}),r=ct({},r,{value:void 0}),i=[];break;case"textarea":o=lf(e,o),r=lf(e,r),i=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=su)}cf(n,r);var s;n=null;for(c in o)if(!r.hasOwnProperty(c)&&o.hasOwnProperty(c)&&o[c]!=null)if(c==="style"){var a=o[c];for(s in a)a.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(Gs.hasOwnProperty(c)?i||(i=[]):(i=i||[]).push(c,null));for(c in r){var l=r[c];if(a=o!=null?o[c]:void 0,r.hasOwnProperty(c)&&l!==a&&(l!=null||a!=null))if(c==="style")if(a){for(s in a)!a.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in l)l.hasOwnProperty(s)&&a[s]!==l[s]&&(n||(n={}),n[s]=l[s])}else n||(i||(i=[]),i.push(c,n)),n=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(i=i||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(i=i||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(Gs.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&Ge("scroll",e),i||a===l||(i=[])):(i=i||[]).push(c,l))}n&&(i=i||[]).push("style",n);var c=i;(t.updateQueue=c)&&(t.flags|=4)}};Sx=function(e,t,n,r){n!==r&&(t.flags|=4)};function ws(e,t){if(!tt)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 Ut(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 $C(e,t,n){var r=t.pendingProps;switch(Op(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ut(t),null;case 1:return gn(t.type)&&au(),Ut(t),null;case 3:return r=t.stateNode,Bi(),qe(mn),qe(qt),Kp(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(tl(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,er!==null&&(Uf(er),er=null))),Lf(e,t),Ut(t),null;case 5:Zp(t);var o=Po(aa.current);if(n=t.type,e!==null&&t.stateNode!=null)bx(e,t,n,r,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(de(166));return Ut(t),null}if(e=Po(yr.current),tl(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[hr]=t,r[ia]=i,e=(t.mode&1)!==0,n){case"dialog":Ge("cancel",r),Ge("close",r);break;case"iframe":case"object":case"embed":Ge("load",r);break;case"video":case"audio":for(o=0;o<Ms.length;o++)Ge(Ms[o],r);break;case"source":Ge("error",r);break;case"img":case"image":case"link":Ge("error",r),Ge("load",r);break;case"details":Ge("toggle",r);break;case"input":jm(r,i),Ge("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},Ge("invalid",r);break;case"textarea":Fm(r,i),Ge("invalid",r)}cf(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&&el(r.textContent,a,e),o=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(i.suppressHydrationWarning!==!0&&el(r.textContent,a,e),o=["children",""+a]):Gs.hasOwnProperty(s)&&a!=null&&s==="onScroll"&&Ge("scroll",r)}switch(n){case"input":Za(r),Rm(r,i,!0);break;case"textarea":Za(r),Pm(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=su)}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=X0(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[hr]=t,e[ia]=r,xx(e,t,!1,!1),t.stateNode=e;e:{switch(s=df(n,r),n){case"dialog":Ge("cancel",e),Ge("close",e),o=r;break;case"iframe":case"object":case"embed":Ge("load",e),o=r;break;case"video":case"audio":for(o=0;o<Ms.length;o++)Ge(Ms[o],e);o=r;break;case"source":Ge("error",e),o=r;break;case"img":case"image":case"link":Ge("error",e),Ge("load",e),o=r;break;case"details":Ge("toggle",e),o=r;break;case"input":jm(e,r),o=of(e,r),Ge("invalid",e);break;case"option":o=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},o=ct({},r,{value:void 0}),Ge("invalid",e);break;case"textarea":Fm(e,r),o=lf(e,r),Ge("invalid",e);break;default:o=r}cf(n,o),a=o;for(i in a)if(a.hasOwnProperty(i)){var l=a[i];i==="style"?Q0(e,l):i==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&q0(e,l)):i==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&Xs(e,l):typeof l=="number"&&Xs(e,""+l):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Gs.hasOwnProperty(i)?l!=null&&i==="onScroll"&&Ge("scroll",e):l!=null&&kp(e,i,l,s))}switch(n){case"input":Za(e),Rm(e,r,!1);break;case"textarea":Za(e),Pm(e);break;case"option":r.value!=null&&e.setAttribute("value",""+fo(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?ji(e,!!r.multiple,i,!1):r.defaultValue!=null&&ji(e,!!r.multiple,r.defaultValue,!0);break;default:typeof o.onClick=="function"&&(e.onclick=su)}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 Ut(t),null;case 6:if(e&&t.stateNode!=null)Sx(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(de(166));if(n=Po(aa.current),Po(yr.current),tl(t)){if(r=t.stateNode,n=t.memoizedProps,r[hr]=t,(i=r.nodeValue!==n)&&(e=Cn,e!==null))switch(e.tag){case 3:el(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&el(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[hr]=t,t.stateNode=r}return Ut(t),null;case 13:if(qe(lt),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(tt&&En!==null&&t.mode&1&&!(t.flags&128))zw(),Di(),t.flags|=98560,i=!1;else if(i=tl(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(de(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(de(317));i[hr]=t}else Di(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ut(t),i=!1}else er!==null&&(Uf(er),er=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||lt.current&1?Tt===0&&(Tt=3):ih())),t.updateQueue!==null&&(t.flags|=4),Ut(t),null);case 4:return Bi(),Lf(e,t),e===null&&ra(t.stateNode.containerInfo),Ut(t),null;case 10:return Wp(t.type._context),Ut(t),null;case 17:return gn(t.type)&&au(),Ut(t),null;case 19:if(qe(lt),i=t.memoizedState,i===null)return Ut(t),null;if(r=(t.flags&128)!==0,s=i.rendering,s===null)if(r)ws(i,!1);else{if(Tt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=hu(e),s!==null){for(t.flags|=128,ws(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 Ke(lt,lt.current&1|2),t.child}e=e.sibling}i.tail!==null&&yt()>Vi&&(t.flags|=128,r=!0,ws(i,!1),t.lanes=4194304)}else{if(!r)if(e=hu(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ws(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!tt)return Ut(t),null}else 2*yt()-i.renderingStartTime>Vi&&n!==1073741824&&(t.flags|=128,r=!0,ws(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=yt(),t.sibling=null,n=lt.current,Ke(lt,r?n&1|2:n&1),t):(Ut(t),null);case 22:case 23:return oh(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?kn&1073741824&&(Ut(t),t.subtreeFlags&6&&(t.flags|=8192)):Ut(t),null;case 24:return null;case 25:return null}throw Error(de(156,t.tag))}function MC(e,t){switch(Op(t),t.tag){case 1:return gn(t.type)&&au(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Bi(),qe(mn),qe(qt),Kp(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Zp(t),null;case 13:if(qe(lt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(de(340));Di()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return qe(lt),null;case 4:return Bi(),null;case 10:return Wp(t.type._context),null;case 22:case 23:return oh(),null;case 24:return null;default:return null}}var ol=!1,Yt=!1,_C=typeof WeakSet=="function"?WeakSet:Set,ve=null;function ki(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ft(e,t,r)}else n.current=null}function Of(e,t,n){try{n()}catch(r){ft(e,t,r)}}var xg=!1;function AC(e,t){if(bf=ru,e=Tw(),Np(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,a=-1,l=-1,c=0,f=0,p=e,m=null;t:for(;;){for(var g;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),(g=p.firstChild)!==null;)m=p,p=g;for(;;){if(p===e)break t;if(m===n&&++c===o&&(a=s),m===i&&++f===r&&(l=s),(g=p.nextSibling)!==null)break;p=m,m=p.parentNode}p=g}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Sf={focusedElem:e,selectionRange:n},ru=!1,ve=t;ve!==null;)if(t=ve,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ve=e;else for(;ve!==null;){t=ve;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 x=w.memoizedProps,k=w.memoizedState,h=t.stateNode,y=h.getSnapshotBeforeUpdate(t.elementType===t.type?x:Jn(t.type,x),k);h.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var v=t.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(de(163))}}catch(b){ft(t,t.return,b)}if(e=t.sibling,e!==null){e.return=t.return,ve=e;break}ve=t.return}return w=xg,xg=!1,w}function Vs(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&&Of(t,n,i)}o=o.next}while(o!==r)}}function Uu(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 Df(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 kx(e){var t=e.alternate;t!==null&&(e.alternate=null,kx(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[hr],delete t[ia],delete t[Cf],delete t[yC],delete t[vC])),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 Ex(e){return e.tag===5||e.tag===3||e.tag===4}function bg(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ex(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 zf(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=su));else if(r!==4&&(e=e.child,e!==null))for(zf(e,t,n),e=e.sibling;e!==null;)zf(e,t,n),e=e.sibling}function Bf(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(Bf(e,t,n),e=e.sibling;e!==null;)Bf(e,t,n),e=e.sibling}var Ot=null,Qn=!1;function Br(e,t,n){for(n=n.child;n!==null;)Cx(e,t,n),n=n.sibling}function Cx(e,t,n){if(gr&&typeof gr.onCommitFiberUnmount=="function")try{gr.onCommitFiberUnmount(Lu,n)}catch{}switch(n.tag){case 5:Yt||ki(n,t);case 6:var r=Ot,o=Qn;Ot=null,Br(e,t,n),Ot=r,Qn=o,Ot!==null&&(Qn?(e=Ot,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ot.removeChild(n.stateNode));break;case 18:Ot!==null&&(Qn?(e=Ot,n=n.stateNode,e.nodeType===8?sd(e.parentNode,n):e.nodeType===1&&sd(e,n),ea(e)):sd(Ot,n.stateNode));break;case 4:r=Ot,o=Qn,Ot=n.stateNode.containerInfo,Qn=!0,Br(e,t,n),Ot=r,Qn=o;break;case 0:case 11:case 14:case 15:if(!Yt&&(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)&&Of(n,t,s),o=o.next}while(o!==r)}Br(e,t,n);break;case 1:if(!Yt&&(ki(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){ft(n,t,a)}Br(e,t,n);break;case 21:Br(e,t,n);break;case 22:n.mode&1?(Yt=(r=Yt)||n.memoizedState!==null,Br(e,t,n),Yt=r):Br(e,t,n);break;default:Br(e,t,n)}}function Sg(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new _C),t.forEach(function(r){var o=HC.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function Xn(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:Ot=a.stateNode,Qn=!1;break e;case 3:Ot=a.stateNode.containerInfo,Qn=!0;break e;case 4:Ot=a.stateNode.containerInfo,Qn=!0;break e}a=a.return}if(Ot===null)throw Error(de(160));Cx(i,s,o),Ot=null,Qn=!1;var l=o.alternate;l!==null&&(l.return=null),o.return=null}catch(c){ft(o,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Ix(t,e),t=t.sibling}function Ix(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Xn(t,e),cr(e),r&4){try{Vs(3,e,e.return),Uu(3,e)}catch(x){ft(e,e.return,x)}try{Vs(5,e,e.return)}catch(x){ft(e,e.return,x)}}break;case 1:Xn(t,e),cr(e),r&512&&n!==null&&ki(n,n.return);break;case 5:if(Xn(t,e),cr(e),r&512&&n!==null&&ki(n,n.return),e.flags&32){var o=e.stateNode;try{Xs(o,"")}catch(x){ft(e,e.return,x)}}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&&Y0(o,i),df(a,s);var c=df(a,i);for(s=0;s<l.length;s+=2){var f=l[s],p=l[s+1];f==="style"?Q0(o,p):f==="dangerouslySetInnerHTML"?q0(o,p):f==="children"?Xs(o,p):kp(o,f,p,c)}switch(a){case"input":sf(o,i);break;case"textarea":G0(o,i);break;case"select":var m=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var g=i.value;g!=null?ji(o,!!i.multiple,g,!1):m!==!!i.multiple&&(i.defaultValue!=null?ji(o,!!i.multiple,i.defaultValue,!0):ji(o,!!i.multiple,i.multiple?[]:"",!1))}o[ia]=i}catch(x){ft(e,e.return,x)}}break;case 6:if(Xn(t,e),cr(e),r&4){if(e.stateNode===null)throw Error(de(162));o=e.stateNode,i=e.memoizedProps;try{o.nodeValue=i}catch(x){ft(e,e.return,x)}}break;case 3:if(Xn(t,e),cr(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{ea(t.containerInfo)}catch(x){ft(e,e.return,x)}break;case 4:Xn(t,e),cr(e);break;case 13:Xn(t,e),cr(e),o=e.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(nh=yt())),r&4&&Sg(e);break;case 22:if(f=n!==null&&n.memoizedState!==null,e.mode&1?(Yt=(c=Yt)||f,Xn(t,e),Yt=c):Xn(t,e),cr(e),r&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!f&&e.mode&1)for(ve=e,f=e.child;f!==null;){for(p=ve=f;ve!==null;){switch(m=ve,g=m.child,m.tag){case 0:case 11:case 14:case 15:Vs(4,m,m.return);break;case 1:ki(m,m.return);var w=m.stateNode;if(typeof w.componentWillUnmount=="function"){r=m,n=m.return;try{t=r,w.props=t.memoizedProps,w.state=t.memoizedState,w.componentWillUnmount()}catch(x){ft(r,n,x)}}break;case 5:ki(m,m.return);break;case 22:if(m.memoizedState!==null){Eg(p);continue}}g!==null?(g.return=m,ve=g):Eg(p)}f=f.sibling}e:for(f=null,p=e;;){if(p.tag===5){if(f===null){f=p;try{o=p.stateNode,c?(i=o.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(a=p.stateNode,l=p.memoizedProps.style,s=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=J0("display",s))}catch(x){ft(e,e.return,x)}}}else if(p.tag===6){if(f===null)try{p.stateNode.nodeValue=c?"":p.memoizedProps}catch(x){ft(e,e.return,x)}}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:Xn(t,e),cr(e),r&4&&Sg(e);break;case 21:break;default:Xn(t,e),cr(e)}}function cr(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Ex(n)){var r=n;break e}n=n.return}throw Error(de(160))}switch(r.tag){case 5:var o=r.stateNode;r.flags&32&&(Xs(o,""),r.flags&=-33);var i=bg(e);Bf(e,i,o);break;case 3:case 4:var s=r.stateNode.containerInfo,a=bg(e);zf(e,a,s);break;default:throw Error(de(161))}}catch(l){ft(e,e.return,l)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function NC(e,t,n){ve=e,Tx(e)}function Tx(e,t,n){for(var r=(e.mode&1)!==0;ve!==null;){var o=ve,i=o.child;if(o.tag===22&&r){var s=o.memoizedState!==null||ol;if(!s){var a=o.alternate,l=a!==null&&a.memoizedState!==null||Yt;a=ol;var c=Yt;if(ol=s,(Yt=l)&&!c)for(ve=o;ve!==null;)s=ve,l=s.child,s.tag===22&&s.memoizedState!==null?Cg(o):l!==null?(l.return=s,ve=l):Cg(o);for(;i!==null;)ve=i,Tx(i),i=i.sibling;ve=o,ol=a,Yt=c}kg(e)}else o.subtreeFlags&8772&&i!==null?(i.return=o,ve=i):kg(e)}}function kg(e){for(;ve!==null;){var t=ve;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Yt||Uu(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Yt)if(n===null)r.componentDidMount();else{var o=t.elementType===t.type?n.memoizedProps:Jn(t.type,n.memoizedProps);r.componentDidUpdate(o,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&ag(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}ag(t,s,n)}break;case 5:var a=t.stateNode;if(n===null&&t.flags&4){n=a;var l=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var c=t.alternate;if(c!==null){var f=c.memoizedState;if(f!==null){var p=f.dehydrated;p!==null&&ea(p)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(de(163))}Yt||t.flags&512&&Df(t)}catch(m){ft(t,t.return,m)}}if(t===e){ve=null;break}if(n=t.sibling,n!==null){n.return=t.return,ve=n;break}ve=t.return}}function Eg(e){for(;ve!==null;){var t=ve;if(t===e){ve=null;break}var n=t.sibling;if(n!==null){n.return=t.return,ve=n;break}ve=t.return}}function Cg(e){for(;ve!==null;){var t=ve;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Uu(4,t)}catch(l){ft(t,n,l)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var o=t.return;try{r.componentDidMount()}catch(l){ft(t,o,l)}}var i=t.return;try{Df(t)}catch(l){ft(t,i,l)}break;case 5:var s=t.return;try{Df(t)}catch(l){ft(t,s,l)}}}catch(l){ft(t,t.return,l)}if(t===e){ve=null;break}var a=t.sibling;if(a!==null){a.return=t.return,ve=a;break}ve=t.return}}var LC=Math.ceil,yu=_r.ReactCurrentDispatcher,eh=_r.ReactCurrentOwner,Hn=_r.ReactCurrentBatchConfig,Ae=0,Mt=null,bt=null,Dt=0,kn=0,Ei=yo(0),Tt=0,da=null,Do=0,Zu=0,th=0,Hs=null,pn=null,nh=0,Vi=1/0,kr=null,vu=!1,Wf=null,ao=null,il=!1,eo=null,wu=0,Us=0,Vf=null,Hl=-1,Ul=0;function sn(){return Ae&6?yt():Hl!==-1?Hl:Hl=yt()}function lo(e){return e.mode&1?Ae&2&&Dt!==0?Dt&-Dt:xC.transition!==null?(Ul===0&&(Ul=dw()),Ul):(e=Be,e!==0||(e=window.event,e=e===void 0?16:vw(e.type)),e):1}function nr(e,t,n,r){if(50<Us)throw Us=0,Vf=null,Error(de(185));xa(e,n,r),(!(Ae&2)||e!==Mt)&&(e===Mt&&(!(Ae&2)&&(Zu|=n),Tt===4&&Xr(e,Dt)),yn(e,r),n===1&&Ae===0&&!(t.mode&1)&&(Vi=yt()+500,Wu&&vo()))}function yn(e,t){var n=e.callbackNode;xE(e,t);var r=nu(e,e===Mt?Dt:0);if(r===0)n!==null&&_m(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&_m(n),t===1)e.tag===0?wC(Ig.bind(null,e)):Lw(Ig.bind(null,e)),mC(function(){!(Ae&6)&&vo()}),n=null;else{switch(fw(r)){case 1:n=jp;break;case 4:n=uw;break;case 16:n=tu;break;case 536870912:n=cw;break;default:n=tu}n=Ax(n,jx.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function jx(e,t){if(Hl=-1,Ul=0,Ae&6)throw Error(de(327));var n=e.callbackNode;if(Mi()&&e.callbackNode!==n)return null;var r=nu(e,e===Mt?Dt:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=xu(e,r);else{t=r;var o=Ae;Ae|=2;var i=Fx();(Mt!==e||Dt!==t)&&(kr=null,Vi=yt()+500,_o(e,t));do try{zC();break}catch(a){Rx(e,a)}while(!0);Bp(),yu.current=i,Ae=o,bt!==null?t=0:(Mt=null,Dt=0,t=Tt)}if(t!==0){if(t===2&&(o=gf(e),o!==0&&(r=o,t=Hf(e,o))),t===1)throw n=da,_o(e,0),Xr(e,r),yn(e,yt()),n;if(t===6)Xr(e,r);else{if(o=e.current.alternate,!(r&30)&&!OC(o)&&(t=xu(e,r),t===2&&(i=gf(e),i!==0&&(r=i,t=Hf(e,i))),t===1))throw n=da,_o(e,0),Xr(e,r),yn(e,yt()),n;switch(e.finishedWork=o,e.finishedLanes=r,t){case 0:case 1:throw Error(de(345));case 2:jo(e,pn,kr);break;case 3:if(Xr(e,r),(r&130023424)===r&&(t=nh+500-yt(),10<t)){if(nu(e,0)!==0)break;if(o=e.suspendedLanes,(o&r)!==r){sn(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=Ef(jo.bind(null,e,pn,kr),t);break}jo(e,pn,kr);break;case 4:if(Xr(e,r),(r&4194240)===r)break;for(t=e.eventTimes,o=-1;0<r;){var s=31-tr(r);i=1<<s,s=t[s],s>o&&(o=s),r&=~i}if(r=o,r=yt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*LC(r/1960))-r,10<r){e.timeoutHandle=Ef(jo.bind(null,e,pn,kr),r);break}jo(e,pn,kr);break;case 5:jo(e,pn,kr);break;default:throw Error(de(329))}}}return yn(e,yt()),e.callbackNode===n?jx.bind(null,e):null}function Hf(e,t){var n=Hs;return e.current.memoizedState.isDehydrated&&(_o(e,t).flags|=256),e=xu(e,t),e!==2&&(t=pn,pn=n,t!==null&&Uf(t)),e}function Uf(e){pn===null?pn=e:pn.push.apply(pn,e)}function OC(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(!rr(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 Xr(e,t){for(t&=~th,t&=~Zu,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-tr(t),r=1<<n;e[n]=-1,t&=~r}}function Ig(e){if(Ae&6)throw Error(de(327));Mi();var t=nu(e,0);if(!(t&1))return yn(e,yt()),null;var n=xu(e,t);if(e.tag!==0&&n===2){var r=gf(e);r!==0&&(t=r,n=Hf(e,r))}if(n===1)throw n=da,_o(e,0),Xr(e,t),yn(e,yt()),n;if(n===6)throw Error(de(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,jo(e,pn,kr),yn(e,yt()),null}function rh(e,t){var n=Ae;Ae|=1;try{return e(t)}finally{Ae=n,Ae===0&&(Vi=yt()+500,Wu&&vo())}}function zo(e){eo!==null&&eo.tag===0&&!(Ae&6)&&Mi();var t=Ae;Ae|=1;var n=Hn.transition,r=Be;try{if(Hn.transition=null,Be=1,e)return e()}finally{Be=r,Hn.transition=n,Ae=t,!(Ae&6)&&vo()}}function oh(){kn=Ei.current,qe(Ei)}function _o(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,hC(n)),bt!==null)for(n=bt.return;n!==null;){var r=n;switch(Op(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&au();break;case 3:Bi(),qe(mn),qe(qt),Kp();break;case 5:Zp(r);break;case 4:Bi();break;case 13:qe(lt);break;case 19:qe(lt);break;case 10:Wp(r.type._context);break;case 22:case 23:oh()}n=n.return}if(Mt=e,bt=e=uo(e.current,null),Dt=kn=t,Tt=0,da=null,th=Zu=Do=0,pn=Hs=null,Fo!==null){for(t=0;t<Fo.length;t++)if(n=Fo[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}Fo=null}return e}function Rx(e,t){do{var n=bt;try{if(Bp(),Bl.current=gu,mu){for(var r=ut.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}mu=!1}if(Oo=0,$t=It=ut=null,Ws=!1,la=0,eh.current=null,n===null||n.return===null){Tt=1,da=t,bt=null;break}e:{var i=e,s=n.return,a=n,l=t;if(t=Dt,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,f=a,p=f.tag;if(!(f.mode&1)&&(p===0||p===11||p===15)){var m=f.alternate;m?(f.updateQueue=m.updateQueue,f.memoizedState=m.memoizedState,f.lanes=m.lanes):(f.updateQueue=null,f.memoizedState=null)}var g=pg(s);if(g!==null){g.flags&=-257,hg(g,s,a,i,t),g.mode&1&&fg(i,c,t),t=g,l=c;var w=t.updateQueue;if(w===null){var x=new Set;x.add(l),t.updateQueue=x}else w.add(l);break e}else{if(!(t&1)){fg(i,c,t),ih();break e}l=Error(de(426))}}else if(tt&&a.mode&1){var k=pg(s);if(k!==null){!(k.flags&65536)&&(k.flags|=256),hg(k,s,a,i,t),Dp(Wi(l,a));break e}}i=l=Wi(l,a),Tt!==4&&(Tt=2),Hs===null?Hs=[i]:Hs.push(i),i=s;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var h=fx(i,l,t);sg(i,h);break e;case 1:a=l;var y=i.type,v=i.stateNode;if(!(i.flags&128)&&(typeof y.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(ao===null||!ao.has(v)))){i.flags|=65536,t&=-t,i.lanes|=t;var b=px(i,a,t);sg(i,b);break e}}i=i.return}while(i!==null)}$x(n)}catch(S){t=S,bt===n&&n!==null&&(bt=n=n.return);continue}break}while(!0)}function Fx(){var e=yu.current;return yu.current=gu,e===null?gu:e}function ih(){(Tt===0||Tt===3||Tt===2)&&(Tt=4),Mt===null||!(Do&268435455)&&!(Zu&268435455)||Xr(Mt,Dt)}function xu(e,t){var n=Ae;Ae|=2;var r=Fx();(Mt!==e||Dt!==t)&&(kr=null,_o(e,t));do try{DC();break}catch(o){Rx(e,o)}while(!0);if(Bp(),Ae=n,yu.current=r,bt!==null)throw Error(de(261));return Mt=null,Dt=0,Tt}function DC(){for(;bt!==null;)Px(bt)}function zC(){for(;bt!==null&&!dE();)Px(bt)}function Px(e){var t=_x(e.alternate,e,kn);e.memoizedProps=e.pendingProps,t===null?$x(e):bt=t,eh.current=null}function $x(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=MC(n,t),n!==null){n.flags&=32767,bt=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Tt=6,bt=null;return}}else if(n=$C(n,t,kn),n!==null){bt=n;return}if(t=t.sibling,t!==null){bt=t;return}bt=t=e}while(t!==null);Tt===0&&(Tt=5)}function jo(e,t,n){var r=Be,o=Hn.transition;try{Hn.transition=null,Be=1,BC(e,t,n,r)}finally{Hn.transition=o,Be=r}return null}function BC(e,t,n,r){do Mi();while(eo!==null);if(Ae&6)throw Error(de(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(de(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(bE(e,i),e===Mt&&(bt=Mt=null,Dt=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||il||(il=!0,Ax(tu,function(){return Mi(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Hn.transition,Hn.transition=null;var s=Be;Be=1;var a=Ae;Ae|=4,eh.current=null,AC(e,n),Ix(n,e),aC(Sf),ru=!!bf,Sf=bf=null,e.current=n,NC(n),fE(),Ae=a,Be=s,Hn.transition=i}else e.current=n;if(il&&(il=!1,eo=e,wu=o),i=e.pendingLanes,i===0&&(ao=null),mE(n.stateNode),yn(e,yt()),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(vu)throw vu=!1,e=Wf,Wf=null,e;return wu&1&&e.tag!==0&&Mi(),i=e.pendingLanes,i&1?e===Vf?Us++:(Us=0,Vf=e):Us=0,vo(),null}function Mi(){if(eo!==null){var e=fw(wu),t=Hn.transition,n=Be;try{if(Hn.transition=null,Be=16>e?16:e,eo===null)var r=!1;else{if(e=eo,eo=null,wu=0,Ae&6)throw Error(de(331));var o=Ae;for(Ae|=4,ve=e.current;ve!==null;){var i=ve,s=i.child;if(ve.flags&16){var a=i.deletions;if(a!==null){for(var l=0;l<a.length;l++){var c=a[l];for(ve=c;ve!==null;){var f=ve;switch(f.tag){case 0:case 11:case 15:Vs(8,f,i)}var p=f.child;if(p!==null)p.return=f,ve=p;else for(;ve!==null;){f=ve;var m=f.sibling,g=f.return;if(kx(f),f===c){ve=null;break}if(m!==null){m.return=g,ve=m;break}ve=g}}}var w=i.alternate;if(w!==null){var x=w.child;if(x!==null){w.child=null;do{var k=x.sibling;x.sibling=null,x=k}while(x!==null)}}ve=i}}if(i.subtreeFlags&2064&&s!==null)s.return=i,ve=s;else e:for(;ve!==null;){if(i=ve,i.flags&2048)switch(i.tag){case 0:case 11:case 15:Vs(9,i,i.return)}var h=i.sibling;if(h!==null){h.return=i.return,ve=h;break e}ve=i.return}}var y=e.current;for(ve=y;ve!==null;){s=ve;var v=s.child;if(s.subtreeFlags&2064&&v!==null)v.return=s,ve=v;else e:for(s=y;ve!==null;){if(a=ve,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:Uu(9,a)}}catch(S){ft(a,a.return,S)}if(a===s){ve=null;break e}var b=a.sibling;if(b!==null){b.return=a.return,ve=b;break e}ve=a.return}}if(Ae=o,vo(),gr&&typeof gr.onPostCommitFiberRoot=="function")try{gr.onPostCommitFiberRoot(Lu,e)}catch{}r=!0}return r}finally{Be=n,Hn.transition=t}}return!1}function Tg(e,t,n){t=Wi(n,t),t=fx(e,t,1),e=so(e,t,1),t=sn(),e!==null&&(xa(e,1,t),yn(e,t))}function ft(e,t,n){if(e.tag===3)Tg(e,e,n);else for(;t!==null;){if(t.tag===3){Tg(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(ao===null||!ao.has(r))){e=Wi(n,e),e=px(t,e,1),t=so(t,e,1),e=sn(),t!==null&&(xa(t,1,e),yn(t,e));break}}t=t.return}}function WC(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=sn(),e.pingedLanes|=e.suspendedLanes&n,Mt===e&&(Dt&n)===n&&(Tt===4||Tt===3&&(Dt&130023424)===Dt&&500>yt()-nh?_o(e,0):th|=n),yn(e,t)}function Mx(e,t){t===0&&(e.mode&1?(t=Ga,Ga<<=1,!(Ga&130023424)&&(Ga=4194304)):t=1);var n=sn();e=$r(e,t),e!==null&&(xa(e,t,n),yn(e,n))}function VC(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Mx(e,n)}function HC(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(de(314))}r!==null&&r.delete(t),Mx(e,n)}var _x;_x=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||mn.current)hn=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return hn=!1,PC(e,t,n);hn=!!(e.flags&131072)}else hn=!1,tt&&t.flags&1048576&&Ow(t,cu,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Vl(e,t),e=t.pendingProps;var o=Oi(t,qt.current);$i(t,n),o=Gp(null,t,r,e,o,n);var i=Xp();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,gn(r)?(i=!0,lu(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,Hp(t),o.updater=Hu,t.stateNode=o,o._reactInternals=t,Pf(t,r,e,n),t=_f(null,t,r,!0,i,n)):(t.tag=0,tt&&i&&Lp(t),on(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Vl(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=ZC(r),e=Jn(r,e),o){case 0:t=Mf(null,t,r,e,n);break e;case 1:t=yg(null,t,r,e,n);break e;case 11:t=mg(null,t,r,e,n);break e;case 14:t=gg(null,t,r,Jn(r.type,e),n);break e}throw Error(de(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Jn(r,o),Mf(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Jn(r,o),yg(e,t,r,o,n);case 3:e:{if(yx(t),e===null)throw Error(de(387));r=t.pendingProps,i=t.memoizedState,o=i.element,Hw(e,t),pu(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=Wi(Error(de(423)),t),t=vg(e,t,r,n,o);break e}else if(r!==o){o=Wi(Error(de(424)),t),t=vg(e,t,r,n,o);break e}else for(En=io(t.stateNode.containerInfo.firstChild),Cn=t,tt=!0,er=null,n=Ww(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Di(),r===o){t=Mr(e,t,n);break e}on(e,t,r,n)}t=t.child}return t;case 5:return Uw(t),e===null&&jf(t),r=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,s=o.children,kf(r,o)?s=null:i!==null&&kf(r,i)&&(t.flags|=32),gx(e,t),on(e,t,s,n),t.child;case 6:return e===null&&jf(t),null;case 13:return vx(e,t,n);case 4:return Up(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=zi(t,null,r,n):on(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Jn(r,o),mg(e,t,r,o,n);case 7:return on(e,t,t.pendingProps,n),t.child;case 8:return on(e,t,t.pendingProps.children,n),t.child;case 12:return on(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,Ke(du,r._currentValue),r._currentValue=s,i!==null)if(rr(i.value,s)){if(i.children===o.children&&!mn.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=Rr(-1,n&-n),l.tag=2;var c=i.updateQueue;if(c!==null){c=c.shared;var f=c.pending;f===null?l.next=l:(l.next=f.next,f.next=l),c.pending=l}}i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),Rf(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(de(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),Rf(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}on(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,$i(t,n),o=Un(o),r=r(o),t.flags|=1,on(e,t,r,n),t.child;case 14:return r=t.type,o=Jn(r,t.pendingProps),o=Jn(r.type,o),gg(e,t,r,o,n);case 15:return hx(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Jn(r,o),Vl(e,t),t.tag=1,gn(r)?(e=!0,lu(t)):e=!1,$i(t,n),dx(t,r,o),Pf(t,r,o,n),_f(null,t,r,!0,e,n);case 19:return wx(e,t,n);case 22:return mx(e,t,n)}throw Error(de(156,t.tag))};function Ax(e,t){return lw(e,t)}function UC(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 Wn(e,t,n,r){return new UC(e,t,n,r)}function sh(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ZC(e){if(typeof e=="function")return sh(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Cp)return 11;if(e===Ip)return 14}return 2}function uo(e,t){var n=e.alternate;return n===null?(n=Wn(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 Zl(e,t,n,r,o,i){var s=2;if(r=e,typeof e=="function")sh(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case hi:return Ao(n.children,o,i,t);case Ep:s=8,o|=8;break;case ef:return e=Wn(12,n,t,o|2),e.elementType=ef,e.lanes=i,e;case tf:return e=Wn(13,n,t,o),e.elementType=tf,e.lanes=i,e;case nf:return e=Wn(19,n,t,o),e.elementType=nf,e.lanes=i,e;case U0:return Ku(n,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case V0:s=10;break e;case H0:s=9;break e;case Cp:s=11;break e;case Ip:s=14;break e;case Kr:s=16,r=null;break e}throw Error(de(130,e==null?e:typeof e,""))}return t=Wn(s,n,t,o),t.elementType=e,t.type=r,t.lanes=i,t}function Ao(e,t,n,r){return e=Wn(7,e,r,t),e.lanes=n,e}function Ku(e,t,n,r){return e=Wn(22,e,r,t),e.elementType=U0,e.lanes=n,e.stateNode={isHidden:!1},e}function hd(e,t,n){return e=Wn(6,e,null,t),e.lanes=n,e}function md(e,t,n){return t=Wn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function KC(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=Gc(0),this.expirationTimes=Gc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Gc(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function ah(e,t,n,r,o,i,s,a,l){return e=new KC(e,t,n,a,l),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Wn(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Hp(i),e}function YC(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:pi,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function Nx(e){if(!e)return po;e=e._reactInternals;e:{if(Uo(e)!==e||e.tag!==1)throw Error(de(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(gn(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(de(171))}if(e.tag===1){var n=e.type;if(gn(n))return Nw(e,n,t)}return t}function Lx(e,t,n,r,o,i,s,a,l){return e=ah(n,r,!0,e,o,i,s,a,l),e.context=Nx(null),n=e.current,r=sn(),o=lo(n),i=Rr(r,o),i.callback=t??null,so(n,i,o),e.current.lanes=o,xa(e,o,r),yn(e,r),e}function Yu(e,t,n,r){var o=t.current,i=sn(),s=lo(o);return n=Nx(n),t.context===null?t.context=n:t.pendingContext=n,t=Rr(i,s),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=so(o,t,s),e!==null&&(nr(e,o,s,i),zl(e,o,s)),s}function bu(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 jg(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function lh(e,t){jg(e,t),(e=e.alternate)&&jg(e,t)}function GC(){return null}var Ox=typeof reportError=="function"?reportError:function(e){console.error(e)};function uh(e){this._internalRoot=e}Gu.prototype.render=uh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(de(409));Yu(e,t,null,null)};Gu.prototype.unmount=uh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;zo(function(){Yu(null,e,null,null)}),t[Pr]=null}};function Gu(e){this._internalRoot=e}Gu.prototype.unstable_scheduleHydration=function(e){if(e){var t=mw();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Gr.length&&t!==0&&t<Gr[n].priority;n++);Gr.splice(n,0,e),n===0&&yw(e)}};function ch(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Xu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Rg(){}function XC(e,t,n,r,o){if(o){if(typeof r=="function"){var i=r;r=function(){var c=bu(s);i.call(c)}}var s=Lx(t,r,e,0,null,!1,!1,"",Rg);return e._reactRootContainer=s,e[Pr]=s.current,ra(e.nodeType===8?e.parentNode:e),zo(),s}for(;o=e.lastChild;)e.removeChild(o);if(typeof r=="function"){var a=r;r=function(){var c=bu(l);a.call(c)}}var l=ah(e,0,!1,null,null,!1,!1,"",Rg);return e._reactRootContainer=l,e[Pr]=l.current,ra(e.nodeType===8?e.parentNode:e),zo(function(){Yu(t,l,n,r)}),l}function qu(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=bu(s);a.call(l)}}Yu(t,s,e,o)}else s=XC(n,t,e,o,r);return bu(s)}pw=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=$s(t.pendingLanes);n!==0&&(Rp(t,n|1),yn(t,yt()),!(Ae&6)&&(Vi=yt()+500,vo()))}break;case 13:zo(function(){var r=$r(e,1);if(r!==null){var o=sn();nr(r,e,1,o)}}),lh(e,1)}};Fp=function(e){if(e.tag===13){var t=$r(e,134217728);if(t!==null){var n=sn();nr(t,e,134217728,n)}lh(e,134217728)}};hw=function(e){if(e.tag===13){var t=lo(e),n=$r(e,t);if(n!==null){var r=sn();nr(n,e,t,r)}lh(e,t)}};mw=function(){return Be};gw=function(e,t){var n=Be;try{return Be=e,t()}finally{Be=n}};pf=function(e,t,n){switch(t){case"input":if(sf(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=Bu(r);if(!o)throw Error(de(90));K0(r),sf(r,o)}}}break;case"textarea":G0(e,n);break;case"select":t=n.value,t!=null&&ji(e,!!n.multiple,t,!1)}};nw=rh;rw=zo;var qC={usingClientEntryPoint:!1,Events:[Sa,vi,Bu,ew,tw,rh]},xs={findFiberByHostInstance:Ro,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},JC={bundleType:xs.bundleType,version:xs.version,rendererPackageName:xs.rendererPackageName,rendererConfig:xs.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:_r.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=sw(e),e===null?null:e.stateNode},findFiberByHostInstance:xs.findFiberByHostInstance||GC,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 sl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!sl.isDisabled&&sl.supportsFiber)try{Lu=sl.inject(JC),gr=sl}catch{}}jn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=qC;jn.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!ch(t))throw Error(de(200));return YC(e,t,null,n)};jn.createRoot=function(e,t){if(!ch(e))throw Error(de(299));var n=!1,r="",o=Ox;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=ah(e,1,!1,null,null,n,!1,r,o),e[Pr]=t.current,ra(e.nodeType===8?e.parentNode:e),new uh(t)};jn.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(de(188)):(e=Object.keys(e).join(","),Error(de(268,e)));return e=sw(t),e=e===null?null:e.stateNode,e};jn.flushSync=function(e){return zo(e)};jn.hydrate=function(e,t,n){if(!Xu(t))throw Error(de(200));return qu(null,e,t,!0,n)};jn.hydrateRoot=function(e,t,n){if(!ch(e))throw Error(de(405));var r=n!=null&&n.hydratedSources||null,o=!1,i="",s=Ox;if(n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=Lx(t,null,e,1,n??null,o,!1,i,s),e[Pr]=t.current,ra(e),r)for(e=0;e<r.length;e++)n=r[e],o=n._getVersion,o=o(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,o]:t.mutableSourceEagerHydrationData.push(n,o);return new Gu(t)};jn.render=function(e,t,n){if(!Xu(t))throw Error(de(200));return qu(null,e,t,!1,n)};jn.unmountComponentAtNode=function(e){if(!Xu(e))throw Error(de(40));return e._reactRootContainer?(zo(function(){qu(null,null,e,!1,function(){e._reactRootContainer=null,e[Pr]=null})}),!0):!1};jn.unstable_batchedUpdates=rh;jn.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Xu(n))throw Error(de(200));if(e==null||e._reactInternals===void 0)throw Error(de(38));return qu(e,t,n,!1,r)};jn.version="18.3.1-next-f1338f8080-20240426";function Dx(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Dx)}catch(e){console.error(e)}}Dx(),D0.exports=jn;var Zf=D0.exports,Fg=Zf;Jd.createRoot=Fg.createRoot,Jd.hydrateRoot=Fg.hydrateRoot;var QC=Object.defineProperty,zx=(e,t)=>{for(var n in t)QC(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 Zo=d.createContext(!1),Kf=({children:e})=>u.jsx(Zo.Provider,{value:!0,children:e}),Bx=d.createContext({setError:()=>{},clearError:()=>{}}),Pg=()=>{try{return typeof __webpack_module__>"u"?null:__webpack_module__.hot??null}catch{return null}};class e2 extends me.Component{constructor(){super(...arguments);Oe(this,"state",{hasError:!1});Oe(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=Pg();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=Pg();r&&r.removeStatusHandler(n)}render(){return this.state.hasError?null:this.props.children}}var Xi=d.createContext({compositions:[],folders:[],currentCompositionMetadata:null,canvasContent:null}),Ea=d.createContext({registerComposition:()=>{},unregisterComposition:()=>{},registerFolder:()=>{},unregisterFolder:()=>{},setCanvasContent:()=>{},onlyRenderComposition:null}),Ca=d.createContext({getNonce:()=>0}),Kl=0;try{typeof __webpack_module__<"u"&&__webpack_module__.hot&&__webpack_module__.hot.addStatusHandler(e=>{e==="idle"&&Kl++})}catch{}var Ju=()=>{const t=d.useContext(Ca).getNonce(),n=d.useRef(t);n.current=t;const r=d.useRef([[Kl,t]]),o=d.useCallback(()=>(Kl!==r.current[r.current.length-1][0]&&(r.current=[...r.current,[Kl,n.current]]),r.current),[r]);return d.useMemo(()=>({get:o}),[o])};function qi(e){return!!e}var Wx=()=>/^([a-zA-Z0-9-\u4E00-\u9FFF])+$/g,Vx=e=>e.match(Wx()),t2=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(!Vx(e))throw new Error(`Folder name can only contain a-z, A-Z, 0-9 and -. You passed ${e}`)},n2=`Folder name must match ${String(Wx())}`,Yf=d.createContext({folderName:null,parentName:null}),r2=e=>{const{name:t,children:n}=e,r=d.useContext(Yf),{registerFolder:o,unregisterFolder:i}=d.useContext(Ea),s=Ju(),a=e.stack??null;t2(t);const l=[r.parentName,r.folderName].filter(qi),c=l.length===0?null:l.join("/"),f=d.useMemo(()=>({folderName:t,parentName:c}),[t,c]);return d.useEffect(()=>(o(t,c,s.get(),a),()=>{i(t,c)}),[t,r.folderName,c,o,i,s,a]),u.jsx(Yf.Provider,{value:f,children:n})};function $g(){return["NOD","E_EN","V"].join("")}var Mg=()=>["e","nv"].join(""),Vn=()=>{const e=typeof window<"u"&&window.remotion_isPlayer,t=typeof window<"u"&&typeof window.process<"u"&&typeof window.process.env<"u"&&(window.process[Mg()][$g()]==="test"||window.process[Mg()][$g()]==="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}},Gf="remotion-date:",fa="remotion-file:",o2=({data:e,indent:t,staticBase:n})=>{let r=!1,o=!1,i=!1,s=!1;try{return{serializedString:JSON.stringify(e,function(l,c){const f=this[l];return f instanceof Date?(r=!0,`${Gf}${f.toISOString()}`):f instanceof Map?(i=!0,c):f instanceof Set?(s=!0,c):typeof f=="string"&&n!==null&&f.startsWith(n)?(o=!0,`${fa}${f.replace(n+"/","")}`):c},t),customDateUsed:r,customFileUsed:o,mapUsed:i,setUsed:s}}catch(a){throw new Error("Could not serialize the passed input props to JSON: "+a.message)}},Hx=e=>JSON.parse(e,(t,n)=>typeof n=="string"&&n.startsWith(Gf)?new Date(n.replace(Gf,"")):typeof n=="string"&&n.startsWith(fa)?`${window.remotion_staticBase}/${n.replace(fa,"")}`:n),i2=e=>Hx(o2({data:e,indent:2,staticBase:window.remotion_staticBase}).serializedString),Xf=e=>Vn().isStudio?i2(e):e,Ux=d.createContext(!1),s2=({children:e})=>u.jsx(Ux.Provider,{value:!0,children:e}),dh=()=>d.useContext(Ux),Wr=({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}`))},a2=(e,t)=>{const{style:n,...r}=e,o=d.useMemo(()=>({position:"absolute",top:Wr({className:r.className,classPrefix:["top-","inset-"],type:"prefix"})?void 0:0,left:Wr({className:r.className,classPrefix:["left-","inset-"],type:"prefix"})?void 0:0,right:Wr({className:r.className,classPrefix:["right-","inset-"],type:"prefix"})?void 0:0,bottom:Wr({className:r.className,classPrefix:["bottom-","inset-"],type:"prefix"})?void 0:0,width:Wr({className:r.className,classPrefix:["w-"],type:"prefix"})?void 0:"100%",height:Wr({className:r.className,classPrefix:["h-"],type:"prefix"})?void 0:"100%",display:Wr({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:Wr({className:r.className,classPrefix:["flex-row","flex-col","flex-row-reverse","flex-col-reverse"],type:"exact"})?void 0:"column",...n}),[r.className,n]);return u.jsx("div",{ref:t,style:o,...r})},Tn=d.forwardRef(a2),l2={transform:"rotate(90deg)"},_g=40,u2={color:"white",fontSize:14,fontFamily:"sans-serif"},c2={justifyContent:"center",alignItems:"center"},d2=()=>u.jsxs(Tn,{style:c2,id:"remotion-comp-loading",children:[u.jsx("style",{type:"text/css",children:`
|
|
42
|
-
@keyframes anim {
|
|
43
|
-
from {
|
|
44
|
-
opacity: 0
|
|
45
|
-
}
|
|
46
|
-
to {
|
|
47
|
-
opacity: 1
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
#remotion-comp-loading {
|
|
51
|
-
animation: anim 2s;
|
|
52
|
-
animation-fill-mode: forwards;
|
|
53
|
-
}
|
|
54
|
-
`}),u.jsx("svg",{width:_g,height:_g,viewBox:"-100 -100 400 400",style:l2,children:u.jsx("path",{fill:"#555",stroke:"#555",strokeWidth:"100",strokeLinejoin:"round",d:"M 2 172 a 196 100 0 0 0 195 5 A 196 240 0 0 0 100 2.259 A 196 240 0 0 0 2 172 z"})}),u.jsxs("p",{style:u2,children:["Resolving ","<Suspense>","..."]})]}),bn=null,qf=()=>{if(!bn){if(typeof document>"u")throw new Error("Tried to call an API that only works in the browser from outside the browser");bn=document.createElement("div"),bn.style.position="absolute",bn.style.top="0px",bn.style.left="0px",bn.style.right="0px",bn.style.bottom="0px",bn.style.width="100%",bn.style.height="100%",bn.style.display="flex",bn.style.flexDirection="column";const e=document.createElement("div");e.style.position="fixed",e.style.top="-999999px",e.appendChild(bn),document.body.appendChild(e)}return bn},Jf=()=>"remotion_inputPropsOverride"+window.location.origin,Zx=()=>{if(typeof localStorage>"u")return null;const e=localStorage.getItem(Jf());return e?JSON.parse(e):null},f2=e=>{if(!(typeof localStorage>"u")){if(e===null){localStorage.removeItem(Jf());return}localStorage.setItem(Jf(),JSON.stringify(e))}},Ag=!1,p2=()=>{Ag||(Ag=!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()"))},h2=()=>{if(typeof window>"u")return p2(),{};if(Vn().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=Zx();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?Hx(t):{}},fh=d.createContext({props:{},updateProps:()=>{throw new Error("Not implemented")}}),m2=me.createRef(),Kx=({children:e})=>{const[t,n]=me.useState({}),r=d.useCallback(({defaultProps:i,id:s,newProps:a})=>{n(l=>({...l,[s]:typeof a=="function"?a(l[s]??i):a}))},[]),o=d.useMemo(()=>({props:t,updateProps:r}),[t,r]);return u.jsx(fh.Provider,{value:o,children:e})},Yx=me.createContext(null),vt=()=>{const e=d.useContext(Yx),[t]=d.useState(()=>Vn());return e??t};function Su(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 Qu(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 ec(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 tc=d.createContext(null),g2=d.createRef(),y2=e=>!!e.calculateMetadata,ph=e=>{const t=d.useContext(tc),{props:n}=d.useContext(fh),{compositions:r,canvasContent:o,currentCompositionMetadata:i}=d.useContext(Xi),s=(o==null?void 0:o.type)==="composition"?o.compositionId:null,a=e??s,l=r.find(p=>p.id===a),c=d.useMemo(()=>l?n[l.id]??{}:{},[n,l]),f=vt();return d.useMemo(()=>l?i?{type:"success",metadataSource:null,result:{...i,id:l.id,defaultProps:l.defaultProps??{}}}:y2(l)?!t||!t[l.id]?null:t[l.id]:(Qu(l.durationInFrames,{allowFloats:!1,component:`in <Composition id="${l.id}">`}),ec(l.fps,`in <Composition id="${l.id}">`),Su(l.width,"width",`in <Composition id="${l.id}">`),Su(l.height,"height",`in <Composition id="${l.id}">`),{type:"success",metadataSource:null,result:{width:l.width,height:l.height,fps:l.fps,id:l.id,durationInFrames:l.durationInFrames,defaultProps:l.defaultProps??{},props:{...l.defaultProps??{},...c??{},...typeof window>"u"||f.isPlayer||!window.remotion_inputProps?{}:h2()??{}},defaultCodec:null,defaultOutName:null,defaultVideoImageFormat:null,defaultPixelFormat:null,defaultProResProfile:null,defaultSampleRate:null}}):null,[l,t,i,c,f.isPlayer])},Gx=e=>{const t=e.stack??"";return t.startsWith("Error:")?t:`${e.message}
|
|
55
|
-
${t}`},v2=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 hh(e,t){let n;throw v2(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=Gx(n)),n}function pa(e){return hh(typeof window<"u"?window:void 0,e)}var w2=["trace","verbose","info","warn","error"],Ng=e=>w2.indexOf(e),nc=(e,t)=>Ng(e)<=Ng(t),Ia=({args:e,logLevel:t,tag:n})=>{const r=[...e];return Vn().isRendering&&!Vn().isClientSideRendering&&r.unshift(Symbol.for(`__remotion_level_${t}`)),n&&Vn().isRendering&&!Vn().isClientSideRendering&&r.unshift(Symbol.for(`__remotion_tag_${n}`)),r},x2=(e,...t)=>{if(nc(e.logLevel,"verbose"))return console.debug(...Ia({args:t,logLevel:"verbose",tag:e.tag}))},b2=(e,...t)=>{if(nc(e.logLevel,"trace"))return console.debug(...Ia({args:t,logLevel:"trace",tag:e.tag}))},S2=(e,...t)=>{if(nc(e.logLevel,"info"))return console.log(...Ia({args:t,logLevel:"info",tag:e.tag}))},k2=(e,...t)=>{if(nc(e.logLevel,"warn"))return console.warn(...Ia({args:t,logLevel:"warn",tag:e.tag}))},E2=(e,...t)=>console.error(...Ia({args:t,logLevel:"error",tag:e.tag})),_t={trace:b2,verbose:x2,info:S2,warn:k2,error:E2};typeof window<"u"&&(window.remotion_renderReady=!1,window.remotion_delayRenderTimeouts||(window.remotion_delayRenderTimeouts={}),window.remotion_delayRenderHandles=[]);var C2="The delayRender was called:",I2="Retries left: ",T2="- Rendering the frame will be retried.",j2="handle was cleared after",R2=3e4,Xx=({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??R2)-2e3,l=((r==null?void 0:r.retries)??0)-(e.remotion_attempt-1);e.remotion_delayRenderTimeouts[o]={label:n??null,startTime:Date.now(),timeout:setTimeout(()=>{const c=["A delayRender()",n?`"${n}"`:null,`was called but not cleared after ${a}ms. See https://remotion.dev/docs/timeout for help.`,l>0?I2+l:null,l>0?T2:null,C2,i].filter(qi).join(" ");t.isClientSideRendering?e.remotion_cancelledError=Gx(Error(c)):hh(e,Error(c))},a)}}return e.remotion_renderReady=!1,o},F2=(e,t)=>typeof window>"u"?Math.random():Xx({scope:window,environment:Vn(),label:e??null,options:{}}),qx=({scope:e,handle:t,environment:n,logLevel:r})=>{if(typeof t>"u")throw new TypeError("The continueRender() method must be called with a parameter that is the return value of delayRender(). No value was passed.");if(typeof t!="number")throw new TypeError("The parameter passed into continueRender() must be the return value of delayRender() which is a number. Got: "+JSON.stringify(t));const o=e.remotion_delayRenderHandles.includes(t),i=e.remotion_delayRenderTimeouts[t];if(o&&n.isRendering&&i){const{label:s,startTime:a,timeout:l}=i;clearTimeout(l);const c=[s?`"${s}"`:"A handle",j2,`${Date.now()-a}ms`].filter(qi).join(" ");_t.verbose({logLevel:r,tag:"delayRender()"},c),delete e.remotion_delayRenderTimeouts[t]}e.remotion_delayRenderHandles=e.remotion_delayRenderHandles.filter(s=>s!==t),e.remotion_delayRenderHandles.length===0&&(e.remotion_renderReady=!0)},P2=e=>{typeof window>"u"||qx({scope:window,handle:e,environment:Vn(),logLevel:window.remotion_logLevel??"info"})},Ko=d.createContext({logLevel:"info",mountTime:0}),wr=()=>{const{logLevel:e}=d.useContext(Ko);if(e===null)throw new Error("useLogLevel must be used within a LogLevelProvider");return e},Ta=()=>{const{mountTime:e}=d.useContext(Ko);if(e===null)throw new Error("useMountTime must be used within a LogLevelProvider");return e},Jx=d.createContext(null),or=()=>{const e=vt(),t=d.useContext(Jx)??(typeof window<"u"?window:void 0),n=wr(),r=d.useCallback((s,a)=>t?Xx({scope:t,environment:e,label:s??null,options:a??{}}):Math.random(),[e,t]),o=d.useCallback(s=>{t&&qx({scope:t,handle:s,environment:e,logLevel:n})},[e,n,t]),i=d.useCallback(s=>hh(t??(typeof window<"u"?window:void 0),s),[t]);return{delayRender:r,continueRender:o,cancelRender:i}},Qx=({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 me.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 me.lazy(e.lazyComponent)}throw new Error("You must pass either 'component' or 'lazyComponent'")},[e.lazyComponent])},rc=()=>{const{canvasContent:e,compositions:t,currentCompositionMetadata:n}=d.useContext(Xi),r=t.find(i=>(e==null?void 0:e.type)==="composition"&&i.id===e.compositionId),o=ph((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])},e1=()=>/^([a-zA-Z0-9-\u4E00-\u9FFF])+$/g,t1=e=>e.match(e1()),$2=e=>{if(!t1(e))throw new Error(`Composition id can only contain a-z, A-Z, 0-9, CJK characters and -. You passed ${e}`)},M2=`Composition ID must match ${String(e1())}`,_2=(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}"`:""}`)}},A2=()=>{const{continueRender:e,delayRender:t}=or();return d.useEffect(()=>{const n=t("Waiting for Root component to unsuspend");return()=>e(n)},[e,t]),null},N2=({width:e,height:t,fps:n,durationInFrames:r,id:o,defaultProps:i,schema:s,...a})=>{const l=d.useContext(Ea),{registerComposition:c,unregisterComposition:f}=l,p=rc(),m=Qx({compProps:a,componentName:"Composition",noSuspense:!1}),g=Ju(),w=dh(),x=vt(),k=d.useContext(Zo);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:h,parentName:y}=d.useContext(Yf),v=a.stack??null,b="component"in a?a.component:null;d.useEffect(()=>{if(!o)throw new Error("No id for composition passed.");return $2(o),_2(i,"defaultProps",o),c({durationInFrames:r??void 0,fps:n??void 0,height:t??void 0,width:e??void 0,id:o,folderName:h,component:m,defaultProps:Xf(i??{}),nonce:g.get(),parentFolderName:y,componentFromProps:b,schema:s??null,calculateMetadata:a.calculateMetadata??null,stack:v}),()=>{f(o)}},[r,n,t,m,o,h,i,e,g,y,b,s,a.calculateMetadata,v,c,f]);const S=ph(o),{setError:E,clearError:C}=d.useContext(Bx),I=d.useCallback(F=>{E(F)},[E]),j=d.useCallback(()=>{C()},[C]);if(x.isStudio&&p&&p.component===m&&p.id===o){const F=m;return S===null||S.type!=="success"&&S.type!=="success-and-refreshing"?null:Zf.createPortal(u.jsx(Kf,{children:u.jsx(e2,{onError:I,onClear:j,children:u.jsx(d.Suspense,{fallback:u.jsx(d2,{}),children:u.jsx(F,{...S.result.props??{}})})})}),qf())}if(x.isRendering&&p&&p.component===m&&p.id===o){const F=m;return S===null||S.type!=="success"&&S.type!=="success-and-refreshing"?null:Zf.createPortal(u.jsx(Kf,{children:u.jsx(d.Suspense,{fallback:u.jsx(A2,{}),children:u.jsx(F,{...S.result.props??{}})})}),qf())}return null},ku=e=>{const{onlyRenderComposition:t}=d.useContext(Ea);return t&&t!==e.id?null:u.jsx(N2,{...e})},n1=[],r1=null,L2=()=>n1,un=e=>{n1.push(e)},O2=e=>{r1=e},D2=()=>r1,z2=e=>{const t=me.Children.toArray(e);if(t.length!==1)return null;const n=t[0];return!me.isValidElement(n)||typeof n.type!="function"&&typeof n.type!="object"?null:n.type},_s="4.0.499",B2=()=>{if(typeof globalThis>"u")return;const e=()=>{globalThis.remotion_imported=_s,typeof window<"u"&&(window.remotion_imported=_s)},t=globalThis.remotion_imported||typeof window<"u"&&window.remotion_imported;if(t){if(t===_s)return;if(typeof t=="string"&&t.includes("webcodecs")){e();return}throw new TypeError(`🚨 Multiple versions of Remotion detected: ${[_s,typeof t=="string"?t:"an older version"].filter(qi).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()},Rt=d.createContext(null),Qf={};zx(Qf,{useTimelineSetFrame:()=>c1,useTimelinePosition:()=>xo,useTimelineContext:()=>wo,usePlayingState:()=>d1,usePlaybackRate:()=>vh,useAbsoluteTimelinePosition:()=>u1,persistCurrentFrame:()=>o1,getInitialFrameState:()=>i1,getFrameForComposition:()=>s1,clampFrameToCompositionRange:()=>a1});function Lg(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 W2(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 Yo=(e,t)=>{if(e===null)return Math.random();if(typeof e=="string")return Lg(W2(e));if(typeof e=="number")return Lg(e*1e10);throw new Error("random() argument must be a number or a string")},Ji=d.createContext({setFrame:()=>{throw new Error("default")},setPlaying:()=>{throw new Error("default")}}),Qi=d.createContext(null),mh=d.createContext(null),gh=d.createContext(null),V2=({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(Yo(null))),[c,f]=d.useState(()=>i1()),p=t??c,{delayRender:m,continueRender:g}=or();typeof window<"u"&&d.useLayoutEffect(()=>{window.remotion_setFrame=(h,y,v)=>{window.remotion_attempt=v;const b=m(`Setting the current frame to ${h}`);let S=!0;f(E=>(E[y]??window.remotion_initialFrame)===h?(S=!1,E):{...E,[y]:h}),S?requestAnimationFrame(()=>g(b)):g(b)},window.remotion_isPlayer=!1},[g,m]);const w=d.useMemo(()=>({frame:p,playing:n,imperativePlaying:o,rootId:l,audioAndVideoTags:a}),[p,n,l]),x=d.useMemo(()=>({playbackRate:i,setPlaybackRate:s}),[i]),k=d.useMemo(()=>({setFrame:f,setPlaying:r}),[]);return u.jsx(gh.Provider,{value:w,children:u.jsx(mh.Provider,{value:x,children:u.jsx(Qi.Provider,{value:w,children:u.jsx(Ji.Provider,{value:k,children:e})})})})},yh=()=>"remotion.time-all",o1=e=>{localStorage.setItem(yh(),JSON.stringify(e))},i1=()=>{const e=localStorage.getItem(yh())??"{}";return JSON.parse(e)},s1=e=>{const t=localStorage.getItem(yh())??"{}",n=JSON.parse(t);return n[e]!==void 0?Number(n[e]):typeof window>"u"?0:window.remotion_initialFrame??0},a1=(e,t)=>Math.max(0,Math.min(Math.max(0,t-1),e)),l1=e=>{const t=rc(),n=vt();if(!t)return typeof window>"u"?0:window.remotion_initialFrame??0;const r=e.frame[t.id]??(n.isPlayer?0:s1(t.id));return a1(r,t.durationInFrames)},wo=()=>{const e=d.useContext(Qi);if(e===null)throw new Error("TimelineContext is not available. This hook must be used inside a <Player> or the Remotion Studio.");return e},vh=()=>{const e=d.useContext(mh);if(e===null)throw new Error("PlaybackRateContext is not available. This hook must be used inside a <Player> or the Remotion Studio.");return e},xo=()=>{const e=wo();return l1(e)},u1=()=>{const e=d.useContext(gh);if(e===null)throw new Error("AbsoluteTimeContext is not available. This hook must be used inside a <Player> or the Remotion Studio.");return l1(e)},c1=()=>{const{setFrame:e}=d.useContext(Ji);return e},d1=()=>{const{playing:e,imperativePlaying:t}=wo(),{setPlaying:n}=d.useContext(Ji);return d.useMemo(()=>[e,n,t],[t,e,n])},Nt=()=>{const e=d.useContext(Zo),t=vt();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=xo(),r=d.useContext(Rt),o=r?r.cumulatedFrom+r.relativeFrom:0;return n-o},oc=()=>{const e=d.useContext(Rt),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=rc();return d.useMemo(()=>{if(!o)return null;const{id:i,durationInFrames:s,fps:a,height:l,width:c,defaultProps:f,props:p,defaultCodec:m,defaultOutName:g,defaultVideoImageFormat:w,defaultPixelFormat:x,defaultProResProfile:k,defaultSampleRate:h}=o;return{id:i,width:t??c,height:n??l,fps:a,durationInFrames:r??s,defaultProps:f,props:p,defaultCodec:m,defaultOutName:g,defaultVideoImageFormat:w,defaultPixelFormat:x,defaultProResProfile:k,defaultSampleRate:h}},[r,n,t,o])},pt=()=>{const e=oc(),t=d.useContext(Zo),n=dh();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},ja=({frame:e,children:t,active:n=!0})=>{const r=Nt(),o=pt();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=wo(),a=d.useContext(Rt),l=(a==null?void 0:a.relativeFrom)??0,c=d.useMemo(()=>i?{...s,playing:!1,imperativePlaying:{current:!1},frame:{[o.id]:e+l}}:s,[i,s,o.id,e,l]),f=d.useMemo(()=>a?i?{...a,cumulatedFrom:0}:a:null,[a,i]);return u.jsx(Qi.Provider,{value:c,children:u.jsx(Rt.Provider,{value:f,children:t})})},xr={"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}},H2=xr,ic={"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}},bo={"style.borderWidth":{type:"number",default:void 0,min:0,step:1,description:"Border width",hiddenFromList:!1},"style.borderStyle":{type:"enum",default:"none",description:"Border style",variants:{none:{},hidden:{},solid:{},dashed:{},dotted:{},double:{},groove:{},ridge:{},inset:{},outset:{}}},"style.borderColor":{type:"color",default:void 0,description:"Border color"}},So={"style.backgroundColor":{type:"color",default:"transparent",description:"Color"}},f1={children:{type:"text-content",default:"",description:"Text",keyframable:!1}},es={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}},p1={...es},h1={...xr,...So,...bo,...p1},wh={type:"boolean",default:!1,description:"Hidden"},m1={type:"hidden"},xh={type:"hidden"},U2=e=>({name:xh,...e}),bh={type:"number",default:void 0,min:1,step:1,hiddenFromList:!0},g1={type:"number",default:0,step:1,hiddenFromList:!0},y1={type:"number",default:0,min:0,step:1,hiddenFromList:!0},Sh={type:"number",default:null,step:1,hiddenFromList:!0},Ar={durationInFrames:bh,from:g1,trimBefore:y1,freeze:Sh,hidden:wh,name:xh,showInTimeline:m1},Hi={...Ar,layout:{type:"enum",default:"absolute-fill",description:"Layout",variants:{"absolute-fill":h1,none:{}}}},Z2={durationInFrames:bh,trimBefore:y1,freeze:Sh,hidden:wh,name:xh,showInTimeline:m1},K2={...Z2,layout:Hi.layout},Y2={...Hi,layout:{...Hi.layout,default:"none"}},ts=me.createContext({registerSequence:()=>{throw new Error("SequenceManagerContext not initialized")},unregisterSequence:()=>{throw new Error("SequenceManagerContext not initialized")},sequences:[]}),sc=me.createContext({current:[]}),Cr=e=>`${e.absolutePath}\0${e.nodePath.join(".")}\0${e.sequenceKeys.join(".")}\0${e.effectKeys.map(t=>t.join(".")).join(".")}`,ac=me.createContext({propStatuses:{}}),lc=me.createContext({current:{}}),uc=me.createContext({getDragOverrides:()=>{throw new Error("VisualModeDragOverridesContext not initialized")},getEffectDragOverrides:()=>{throw new Error("VisualModeDragOverridesContext not initialized")}}),v1=me.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")}}),gd=(e,t)=>`${Cr(e)}.effects.${t}`,G2=({children:e})=>{const[t,n]=d.useState([]),r=d.useRef(t);r.current=t;const[o,i]=d.useState({}),s=d.useRef(o);s.current=o;const[a,l]=d.useState({}),[c,f]=d.useState({}),p=d.useRef(c);p.current=c;const m=d.useCallback((j,F,N)=>{i(K=>({...K,[Cr(j)]:{...K[Cr(j)],[F]:N}}))},[]),g=d.useCallback(j=>{i(F=>{const N=Cr(j);if(!F[N])return F;const K={...F};return delete K[N],K})},[]),w=d.useCallback((j,F,N,K)=>{l(M=>{const $=gd(j,F);return{...M,[$]:{...M[$],[N]:K}}})},[]),x=d.useCallback((j,F)=>{l(N=>{const K=gd(j,F);if(!N[K])return N;const M={...N};return delete M[K],M})},[]),k=d.useCallback((j,F)=>{f(N=>{const K=Cr(j),M=N[K],$=F(M);return M===$?N:{...N,[K]:$}})},[]),h=d.useCallback(j=>{n(F=>[...F,j])},[]),y=d.useCallback(j=>{n(F=>F.filter(N=>N.id!==j))},[]),v=d.useMemo(()=>({registerSequence:h,sequences:t,unregisterSequence:y}),[h,t,y]),b=d.useCallback(j=>o[Cr(j)]??{},[o]),S=d.useCallback((j,F)=>a[gd(j,F)]??{},[a]),E=d.useMemo(()=>({propStatuses:c}),[c]),C=d.useMemo(()=>({getDragOverrides:b,getEffectDragOverrides:S}),[b,S]),I=d.useMemo(()=>({setDragOverrides:m,clearDragOverrides:g,setEffectDragOverrides:w,clearEffectDragOverrides:x,setPropStatuses:k}),[m,g,w,x,k]);return u.jsx(sc.Provider,{value:r,children:u.jsx(ts.Provider,{value:v,children:u.jsx(lc.Provider,{value:p,children:u.jsx(ac.Provider,{value:E,children:u.jsx(uc.Provider,{value:C,children:u.jsx(v1.Provider,{value:I,children:e})})})})})})},cc=d.createContext(!1),X2=({children:e})=>u.jsx(cc.Provider,{value:!0,children:e}),w1=({children:e})=>u.jsx(cc.Provider,{value:!1,children:e}),q2=()=>{if(!me.useContext(cc))throw new Error("This component must be inside a <Series /> component.")},x1=d.createContext({premountFramesRemaining:0}),J2=!1,Ra=e=>e??J2,Fa=({from:e,durationInFrames:t,premountFor:n,postmountFor:r,style:o,styleWhilePremounted:i,styleWhilePostmounted:s,hideWhilePremounted:a})=>{const l=d.useContext(x1),c=Nt()-l.premountFramesRemaining,f=vt(),{fps:p}=pt(),m=n??0,g=r??0,w=Math.ceil(e+t-1),x=!f.isRendering&&c<e&&c>=e-m,k=!f.isRendering&&c>w&&c<=w+g,h=x||k,y=x?e:k?e+t-1:0,v=d.useMemo(()=>h?{...o,...a==="opacity"?{opacity:0}:{display:"none"},pointerEvents:"none",...x?i:{},...k?s:{}}:o,[h,a,k,x,o,s,i]);return{effectivePremountFor:m,effectivePostmountFor:g,premountingActive:x,postmountingActive:k,isPremountingOrPostmounting:h,freezeFrame:y,premountingStyle:v}},Q2=(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},eI=4,tI=.001,nI=1e-7,rI=10,As=11,al=1/(As-1),oI=typeof Float32Array=="function";function b1(e,t){return 1-3*t+3*e}function S1(e,t){return 3*t-6*e}function k1(e){return 3*e}function Eu(e,t,n){return((b1(t,n)*e+S1(t,n))*e+k1(t))*e}function E1(e,t,n){return 3*b1(t,n)*e*e+2*S1(t,n)*e+k1(t)}function iI({aX:e,_aA:t,_aB:n,mX1:r,mX2:o}){let i,s,a=0,l=t,c=n;do s=l+(c-l)/2,i=Eu(s,r,o)-e,i>0?c=s:l=s;while(Math.abs(i)>nI&&++a<rI);return s}function sI(e,t,n,r){let o=t;for(let i=0;i<eI;++i){const s=E1(o,n,r);if(s===0)return o;const a=Eu(o,n,r)-e;o-=a/s}return o}function C1(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=oI?new Float32Array(As):new Array(As);if(e!==t||n!==r)for(let s=0;s<As;++s)o[s]=Eu(s*al,e,n);function i(s){let a=0,l=1;const c=As-1;for(;l!==c&&o[l]<=s;++l)a+=al;--l;const f=(s-o[l])/(o[l+1]-o[l]),p=a+f*al,m=E1(p,e,n);return m>=tI?sI(s,p,e,n):m===0?p:iI({aX:s,_aA:a,_aB:a+al,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:Eu(i(a),t,r)}}var aI=e=>Math.round(e*1e6)/1e6,lI=new Set(["deg","rad","grad","turn"]),I1=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"]),T1=/^([+-]?(?:\d+\.?\d*|\.\d+))([a-zA-Z%]+)?$/,j1=new Set(["left","center","right","top","bottom"]),Ci=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:"%"}}],bs={value:50,unit:"%"},Og=e=>String(aI(e)),uI=(e,t)=>{const n=T1.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(lI.has(r))return{kind:"rotate",value:o,unit:r};if(I1.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`)},R1=({component:e,value:t,allowPercentage:n})=>{const r=T1.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||!I1.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}},yd=(e,t)=>{const n=e.toLowerCase();return j1.has(n)?{type:"keyword",keyword:n}:{type:"length-percentage",parsed:R1({component:e,value:t,allowPercentage:!0})}},cI=(e,t,n)=>{const r=[];for(const o of Ci(e))for(const i of Ci(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]},dI=(e,t)=>{if(e.length===1){const a=yd(e[0],t);return a.type==="length-percentage"?[a.parsed,bs]:a.keyword==="top"||a.keyword==="bottom"?[bs,Ci(a.keyword)[0].value]:[Ci(a.keyword)[0].value,bs]}const n=yd(e[0],t),r=yd(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 cI(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[Ci(o.keyword)[0].value,i]}return o.keyword==="top"||o.keyword==="bottom"?[i,Ci(o.keyword)[0].value]:s?[bs,i]:[i,bs]},fI=(e,t)=>{const[n,r]=dI(t.slice(0,2),e),o=t[2]===void 0?{value:0,unit:null}:R1({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}},pI=e=>{var o,i,s,a,l,c;if(typeof e=="number"){if(!Number.isFinite(e))throw new Error(`outputRange must contain only finite numbers, but got [${e}]`);return{kind:"scale",values:[e,e,1],units:[null,null,null],dimensions:1}}const t=e.trim().split(/\s+/);if(t.length<1||t.length>3||t[0]==="")throw new TypeError(`String outputRange values must contain 1 to 3 components, but got "${e}"`);if(t.some(f=>j1.has(f.toLowerCase())))return fI(e,t);const n=t.map(f=>uI(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,m=((i=n[2])==null?void 0:i.value)??1;return{kind:r,values:[f,p,m],units:[null,null,null],dimensions:n.length}}return{kind:r,values:[n[0].value,((s=n[1])==null?void 0:s.value)??0,((a=n[2])==null?void 0:a.value)??0],units:[n[0].unit,((l=n[1])==null?void 0:l.unit)??null,((c=n[2])==null?void 0:c.unit)??null],dimensions:n.length}},hI=({kind:e,values:t,units:n,dimensions:r})=>e==="scale"?t.slice(0,r).map(o=>Og(o)).join(" "):t.slice(0,r).map((o,i)=>`${Og(o)}${n[i]}`).join(" "),Dg=e=>e===0?0:Math.sign(e)*e*e,mI=e=>e===0?0:Math.sign(e)*Math.sqrt(Math.abs(e));function gI(e,t,n,r){const{extrapolateLeft:o,extrapolateRight:i,easing:s,output:a}=r;let l=e;const[c,f]=t,[p,m]=n;if(l<c){if(o==="identity")return l;if(o==="clamp")l=c;else if(o==="wrap"){const g=f-c;l=((l-c)%g+g)%g+c}}if(l>f){if(i==="identity")return l;if(i==="clamp")l=f;else if(i==="wrap"){const g=f-c;l=((l-c)%g+g)%g+c}}if(p===m)return p;if(l=(l-c)/(f-c),l=s(l),a==="perceptual-scale"){const g=Dg(p),w=Dg(m);l=mI(l*(w-g)+g)}else l=l*(m-p)+p;return l}function yI(e,t){let n;for(n=1;n<t.length-1&&!(t[n]>=e);++n);return n-1}var vI=e=>e,wI=e=>e??"linear",F1=e=>e.remotionShouldExtendRight===!0,zg=({easing:e,segmentIndex:t})=>e===void 0?vI:typeof e=="function"?e:e[t],Bg=({input:e,inputRange:t,outputRange:n,easing:r,extrapolateLeft:o,extrapolateRight:i,output:s})=>gI(e,t,n,{easing:r,extrapolateLeft:o,extrapolateRight:e>t[1]&&i==="clamp"&&F1(r)?"extend":i,output:s}),kh=({input:e,inputRange:t,outputRange:n,options:r})=>{const o=wI(r==null?void 0:r.output);if(t.length===1)return n[0];const i=r==null?void 0:r.easing;let s="extend";(r==null?void 0:r.extrapolateLeft)!==void 0&&(s=r.extrapolateLeft);let a="extend";(r==null?void 0:r.extrapolateRight)!==void 0&&(a=r.extrapolateRight);const l=(r==null?void 0:r.posterize)===void 0?e:Math.floor(e/r.posterize)*r.posterize,c=yI(l,t),f=zg({easing:i,segmentIndex:c});let p=Bg({input:l,inputRange:[t[c],t[c+1]],outputRange:[n[c],n[c+1]],easing:f,extrapolateLeft:s,extrapolateRight:a,output:o});for(let m=0;m<c;m++){const g=zg({easing:i,segmentIndex:m});if(!F1(g))continue;const w=t[m+1];if(l<=w)continue;const x=Bg({input:l,inputRange:[t[m],w],outputRange:[n[m],n[m+1]],easing:g,extrapolateLeft:s,extrapolateRight:"extend",output:o});p+=x-n[m+1]}return p},xI=({input:e,inputRange:t,outputRange:n,options:r})=>{var c;const o=n.map(pI),i=(c=o[0])==null?void 0:c.kind;if(i===void 0)throw new Error("outputRange must have at least 1 element");for(const f of o)if(f.kind!==i)throw new TypeError(`Cannot interpolate ${i} values with ${f.kind} values`);const s=Math.max(...o.map(f=>f.dimensions)),a=[null,null,null];if(i!=="scale")for(let f=0;f<s;f++){for(const p of o){const m=p.units[f];if(m!==null){if(a[f]===null){a[f]=m;continue}if(a[f]!==m)throw new TypeError(`Cannot interpolate ${i} values with different units on axis ${f+1}: ${a[f]} and ${m}`)}}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]=kh({input:e,inputRange:t,outputRange:o.map(p=>p.values[f]),options:r});return hI({kind:i,values:l,units:a,dimensions:s})},bI=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},SI=({input:e,inputRange:t,outputRange:n,options:r})=>{const o=bI(n);return new Array(o).fill(!0).map((i,s)=>kh({input:e,inputRange:t,outputRange:n.map(a=>a[s]),options:r}))};function kI(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 Wg(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 EI(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 CI(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 II(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 ns(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(Wg("inputRange",t),kI(t),EI(r==null?void 0:r.easing,t.length),CI(r==null?void 0:r.posterize),II(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 xI({input:e,inputRange:t,outputRange:n,options:r})}if(n.every(i=>Array.isArray(i)))return SI({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 Wg("outputRange",n),kh({input:e,inputRange:t,outputRange:n,options:r})}var TI=({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}`)},jI=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)}},RI={damping:10,mass:1,stiffness:100,overshootClamping:!1},vd={};function FI({animation:e,now:t,config:n}){const{toValue:r,lastTimestamp:o,current:i,velocity:s}=e,a=Math.min(t-o,64);if(n.damping<=0)throw new Error("Spring damping must be greater than 0, otherwise the spring() animation will never end, causing an infinite loop.");const l=n.damping,c=n.mass,f=n.stiffness,p=[r,o,i,s,l,c,f,t].join("-");if(vd[p])return vd[p];const m=-s,g=r-i,w=l/(2*Math.sqrt(f*c)),x=Math.sqrt(f/c),k=x*Math.sqrt(1-w**2),h=a/1e3,y=Math.sin(k*h),v=Math.cos(k*h),b=Math.exp(-w*x*h),S=b*(y*((m+w*x*g)/k)+g*v),E=r-S,C=w*x*S-b*(v*(m+w*x*g)-k*g*y),I=Math.exp(-x*h),j=r-I*(g+(m+x*g)*h),F=I*(m*(h*x-1)+h*g*x*x),N={toValue:r,prevPosition:i,lastTimestamp:t,current:w<1?E:j,velocity:w<1?C:F};return vd[p]=N,N}var wd={};function P1({frame:e,fps:t,config:n={}}){const i=[e,t,n.damping,n.mass,n.overshootClamping,n.stiffness].join("-");if(wd[i])return wd[i];let s={lastTimestamp:0,current:0,toValue:1,velocity:0,prevPosition:0};const a=Math.max(0,e),l=a%1;for(let c=0;c<=Math.floor(a);c++){c===Math.floor(a)&&(c+=l);const f=c/t*1e3;s=FI({animation:s,now:f,config:{...RI,...n}})}return wd[i]=s,s}var xd=new Map;function $1({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(xd.has(r))return xd.get(r);ec(e,"to the measureSpring() function");let o=0,i=0;const s=()=>P1({fps:e,frame:o,config:t});let a=s();const l=()=>Math.abs(a.current-a.toValue);let c=l();for(;c>=n;)o++,a=s(),c=l();i=o;for(let f=0;f<20;f++)o++,a=s(),c=l(),c>=n&&(f=0,i=o+1);return xd.set(r,i),i}function ep({frame:e,fps:t,config:n={},from:r=0,to:o=1,durationInFrames:i,durationRestThreshold:s,delay:a=0,reverse:l=!1}){jI(i),TI({frame:e,durationInFrames:1/0,allowFloats:!0}),ec(t,"to spring()");const c=l||typeof i<"u",f=c?$1({fps:t,config:n,threshold:s}):void 0,p=c?{get:()=>f}:{get:()=>{throw new Error("did not calculate natural duration, this is an error with Remotion. Please report")}},g=(l?(i??p.get())-e:e)+(l?a:-a),w=i===void 0?g:g/(i/p.get());if(i&&g>i)return o;const x=P1({fps:t,frame:w,config:n}),k=n.overshootClamping?o>=r?Math.min(x.current,o):Math.max(x.current,o):x.current;return r===0&&o===1?k:ns(k,[0,1],[r,o])}var Vg=e=>Math.min(1,Math.max(0,e)),Ss=30;class Cu{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 Cu.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=Vg(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:ep(t?{fps:Ss,frame:i*$1({fps:Ss,config:r,threshold:n}),config:r}:{fps:Ss,frame:i*Ss,config:r,durationInFrames:Ss,durationRestThreshold:n}),{remotionShouldExtendRight:t})}static bounce(t){const n=Vg(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 C1(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 qn="[-+]?\\d*\\.?\\d+",ll=qn+"%";function ul(...e){return"\\(\\s*("+e.join(")\\s*,\\s*(")+")\\s*\\)"}var cl="(?:none|[-+]?\\d*\\.?\\d+(?:%|deg|rad|grad|turn)?)";function ks(e){return new RegExp(e+"\\(\\s*("+cl+")\\s+("+cl+")\\s+("+cl+")(?:\\s*\\/\\s*("+cl+"))?\\s*\\)")}function PI(){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"+ul(qn,qn,qn)),e.rgba=new RegExp("rgba"+ul(qn,qn,qn,qn)),e.hsl=new RegExp("hsl"+ul(qn,ll,ll)),e.hsla=new RegExp("hsla"+ul(qn,ll,ll,qn)),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=ks("oklch"),e.oklab=ks("oklab"),e.lab=ks("lab"),e.lch=ks("lch"),e.hwb=ks("hwb")),e}function _i(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 Hg(e,t,n){const r=n<.5?n*(1+t):n+t-n*t,o=2*n-r,i=_i(o,r,e+1/3),s=_i(o,r,e),a=_i(o,r,e-1/3);return Math.round(i*255)<<24|Math.round(s*255)<<16|Math.round(a*255)<<8}function ti(e){const t=Number.parseInt(e,10);return t<0?0:t>255?255:t}function Ug(e){return(Number.parseFloat(e)%360+360)%360/360}function Zg(e){const t=Number.parseFloat(e);return t<0?0:t>1?255:Math.round(t*255)}function dl(e){const t=Number.parseFloat(e);return t<0?0:t>100?1:t/100}function Nn(e,t){return e==="none"?0:e.endsWith("%")?Number.parseFloat(e)/100*t:Number.parseFloat(e)}function bd(e){return e==="none"?0:e.endsWith("rad")?Number.parseFloat(e)*180/Math.PI:e.endsWith("grad")?Number.parseFloat(e)*.9:e.endsWith("turn")?Number.parseFloat(e)*360:Number.parseFloat(e)}function Es(e){return e===void 0||e==="none"?1:e.endsWith("%")?Math.max(0,Math.min(1,Number.parseFloat(e)/100)):Math.max(0,Math.min(1,Number.parseFloat(e)))}function Ai(e){return e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055}function fl(e){return Math.max(0,Math.min(1,e))}function Cs(e,t,n,r){const o=Math.round(fl(e)*255),i=Math.round(fl(t)*255),s=Math.round(fl(n)*255),a=Math.round(fl(r)*255);return(o<<24|i<<16|s<<8|a)>>>0}function Kg(e,t,n){const r=e+.3963377774*t+.2158037573*n,o=e-.1055613458*t-.0638541728*n,i=e-.0894841775*t-1.291485548*n,s=r*r*r,a=o*o*o,l=i*i*i,c=4.0767416621*s-3.3077115913*a+.2309699292*l,f=-1.2684380046*s+2.6097574011*a-.3413193965*l,p=-.0041960863*s-.7034186147*a+1.707614701*l;return[Ai(c),Ai(f),Ai(p)]}function Yg(e,t,n){const r=.008856451679035631,o=24389/27,i=.95047,s=1,a=1.08883,l=(e+16)/116,c=t/500+l,f=l-n/200,p=c*c*c,m=f*f*f,g=p>r?p:(116*c-16)/o,w=e>o*r?((e+16)/116)**3:e/o,x=m>r?m:(116*f-16)/o,k=g*i,h=w*s,y=x*a,v=3.2404542*k-1.5371385*h-.4985314*y,b=-.969266*k+1.8760108*h+.041556*y,S=.0556434*k-.2040259*h+1.0572252*y;return[Ai(v),Ai(b),Ai(S)]}function $I(e,t,n){if(t+n>=1){const c=t/(t+n);return[c,c,c]}const r=1,o=0,i=_i(o,r,e+1/3),s=_i(o,r,e),a=_i(o,r,e-1/3),l=1-t-n;return[i*l+t,s*l+t,a*l+t]}var Gg={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 MI(e){const t=PI();let n;if(t.hex6&&(n=t.hex6.exec(e)))return Number.parseInt(n[1]+"ff",16)>>>0;if(Gg[e]!==void 0)return Gg[e];if(t.rgb&&(n=t.rgb.exec(e)))return(ti(n[1])<<24|ti(n[2])<<16|ti(n[3])<<8|255)>>>0;if(t.rgba&&(n=t.rgba.exec(e)))return(ti(n[1])<<24|ti(n[2])<<16|ti(n[3])<<8|Zg(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(Hg(Ug(n[1]),dl(n[2]),dl(n[3]))|255)>>>0;if(t.hsla&&(n=t.hsla.exec(e)))return(Hg(Ug(n[1]),dl(n[2]),dl(n[3]))|Zg(n[4]))>>>0;if(t.oklch&&(n=t.oklch.exec(e))){const r=Nn(n[1],1),o=Nn(n[2],.4),i=bd(n[3]),s=Es(n[4]),a=i*Math.PI/180,[l,c,f]=Kg(r,o*Math.cos(a),o*Math.sin(a));return Cs(l,c,f,s)}if(t.oklab&&(n=t.oklab.exec(e))){const r=Nn(n[1],1),o=Nn(n[2],.4),i=Nn(n[3],.4),s=Es(n[4]),[a,l,c]=Kg(r,o,i);return Cs(a,l,c,s)}if(t.lab&&(n=t.lab.exec(e))){const r=Nn(n[1],100),o=Nn(n[2],125),i=Nn(n[3],125),s=Es(n[4]),[a,l,c]=Yg(r,o,i);return Cs(a,l,c,s)}if(t.lch&&(n=t.lch.exec(e))){const r=Nn(n[1],100),o=Nn(n[2],150),i=bd(n[3]),s=Es(n[4]),a=i*Math.PI/180,[l,c,f]=Yg(r,o*Math.cos(a),o*Math.sin(a));return Cs(l,c,f,s)}if(t.hwb&&(n=t.hwb.exec(e))){const r=bd(n[1]),o=Nn(n[2],1),i=Nn(n[3],1),s=Es(n[4]),[a,l,c]=$I(r/360,o,i);return Cs(a,l,c,s)}throw new Error(`invalid color string ${e} provided`)}var Xg=e=>(e>>24&255)/255,_I=e=>e>>16&255,AI=e=>e>>8&255,NI=e=>e&255,LI=(e,t,n,r)=>`rgba(${e}, ${t}, ${n}, ${r})`;function OI(e){const t=MI(e);return(t<<24|t>>>8)>>>0}var DI=(e,t,n,r)=>{const[o,i,s,a]=[_I,AI,NI,Xg].map(l=>{const c=ns(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===Xg?Number(c.toFixed(3)):Math.round(c)});return LI(o,i,s,a)},zI=(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=>OI(i));return DI(e,t,o,r)},qg=({easing:e,forceSpringAllowTail:t})=>{switch(e.type){case"linear":return Cu.linear;case"spring":return Cu.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 C1(e.x1,e.y1,e.x2,e.y2);default:throw new TypeError(`Unsupported easing: ${JSON.stringify(e)}`)}},Pa=({frame:e,forceSpringAllowTail:t,status:n})=>{const{keyframes:r,easing:o,clamping:i,interpolationFunction:s}=n;if(r.length===0)return null;const a=[...r].sort((f,p)=>f.frame-p.frame),l=a.map(f=>f.frame),c=a.map(f=>f.value);if(s==="interpolateColors"){if(!c.every(f=>typeof f=="string"))return null;if(r.length===1)return c[0];try{return zI(e,l,c,{easing:o.map(f=>qg({easing:f,forceSpringAllowTail:t})),posterize:n.posterize})}catch{return null}}if(s!=="interpolate")return null;try{return ns(e,l,c,{easing:o.map(f=>qg({easing:f,forceSpringAllowTail:t})),extrapolateLeft:i.left,extrapolateRight:i.right,output:n.output,posterize:n.posterize})}catch{return null}},dc=({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=Pa({forceSpringAllowTail:null,frame:t,status:e.status});return n===null?{type:"none"}:{type:"resolved",value:n}},M1=({propStatus:e,dragOverrideValue:t,defaultValue:n,frame:r=null,shouldResortToDefaultValueIfUndefined:o=!1})=>{const i=dc({dragOverrideValue:t,frame:r});return i.type==="resolved"&&i.value!==void 0?i.value:e.status==="keyframed"?r!==null?Pa({forceSpringAllowTail:null,frame:r,status:e}):o?n:void 0:e.codeValue===void 0&&o?n:e.codeValue},Eh=d.createContext({overrideIdToNodePathMappings:{}}),BI=d.createContext({setOverrideIdToNodePath:()=>{throw new Error("OverrideIdsToNodePathsSettersContext not initialized")}}),WI=({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=dc({dragOverrideValue:s,frame:r});a.type==="resolved"&&(o[i]=a.value)}return{params:o,effectKey:e.definition.calculateKey(o)}},VI=(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=Pa({forceSpringAllowTail:null,frame:t,status:i});s!==null&&(n[o]=s,r=!0)}}return r?n:null},$a=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)},_1=({propStatuses:e,nodePath:t,effectIndex:n})=>{const r=e[Cr(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"}},A1=(e,t)=>{const n=e[Cr(t)];if(n&&n.canUpdate)return n.props},Ma=({effects:e,overrideId:t})=>{const n=d.useRef(null),{propStatuses:r}=d.useContext(ac),{getEffectDragOverrides:o}=d.useContext(uc),i=Nt(),{overrideIdToNodePathMappings:s}=d.useContext(Eh),a=n.current,l=t?s[t]??null:null,c=e.map((m,g)=>{if(l===null)return{descriptor:m,params:m.params,effectKey:m.effectKey};const w=_1({propStatuses:r,nodePath:l,effectIndex:g}),x=w.type==="can-update-effect"?VI(w.props,i):null,k=o(l,g),h=Object.keys(k).length===0?null:k,{params:y,effectKey:v}=WI({descriptor:m,propStatusOverrides:x,dragOverrides:h,frame:i});return{descriptor:m,params:y,effectKey:v}});if(a!==null&&a.length===c.length&&a.every((m,g)=>m.definition===c[g].descriptor.definition&&m.effectKey===c[g].effectKey))return a;const p=c.map(({descriptor:m,params:g,effectKey:w})=>({definition:m.definition,effectKey:w,params:g,memoized:!0}));return n.current=p,p},Ch=(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,Ch(s,t))}else n[r]=o}return n},Ih=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=Ih(i);for(const a of Object.keys(s))n(a,s[a])}}return t},N1=({schema:e,key:t,value:n})=>{const r=e[t];if(!r)throw new Error("Key "+JSON.stringify(t)+" not found in schema");if(typeof n!="string")throw new Error("Value must be a string, but is "+JSON.stringify(n));if(r.type!=="enum")throw new Error("Key "+JSON.stringify(t)+" is not an enum");if(!r.variants[n])throw new Error("Value for "+JSON.stringify(t)+" must be one of "+Object.keys(r.variants).map(a=>JSON.stringify(a)).join(", ")+", got "+JSON.stringify(n));const i=Object.keys(r.variants).filter(a=>a!==n),s=new Set;for(const a of i){const l=r.variants[a],c=Object.keys(l);for(const f of c)s.add(f)}return[...s]},Jg={type:"linear"},HI=({insertedKeyframeIndex:e,easingLength:t,keyframeCount:n})=>!(e>0&&e<n-1)||t===0?null:Math.min(e-1,t-1),UI=e=>({type:"static",value:e}),ZI=({status:e,frame:t,value:n})=>{const r=e.keyframes.findIndex(s=>s.frame===t),o=r===-1?[...e.keyframes,{frame:t,value:n}].sort((s,a)=>s.frame-a.frame):e.keyframes.map((s,a)=>a===r?{frame:t,value:n}:s),i=[...e.easing];if(r===-1){const s=o.findIndex(c=>c.frame===t),a=HI({insertedKeyframeIndex:s,easingLength:i.length,keyframeCount:o.length}),l=a===null?Jg:i[a];i.splice(s,0,l)}for(;i.length<o.length-1;)i.push(Jg);return i.length>o.length-1&&(i.length=o.length-1),{type:"keyframed",status:{...e,keyframes:o,easing:i}}},KI=e=>{if((e==null?void 0:e.type)==="static")return e.value},YI=e=>e!==null&&e.status==="keyframed",L1=(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=L1(r,t);if(o)return o}},O1=({schema:e,currentValue:t,overrideValues:n,propStatus:r,frame:o})=>{var a;const i={},s=new Set;for(const l of Object.keys(t)){const c=(r==null?void 0:r[l])??null,f=L1(e,l);if((f==null?void 0:f.type)==="hidden")continue;let p;if(c===null)p=t[l];else if(YI(c))if((f==null?void 0:f.type)==="array"||(f==null?void 0:f.keyframable)===!1)p=t[l];else{const m=dc({dragOverrideValue:n[l],frame:o});m.type==="resolved"?p=m.value:o!==null?p=Pa({forceSpringAllowTail:null,frame:o,status:c})??t[l]:p=t[l]}else c.status==="computed"?p=t[l]:p=M1({propStatus:c,dragOverrideValue:n[l],defaultValue:f==null?void 0:f.default,frame:o,shouldResortToDefaultValueIfUndefined:!1});(f==null?void 0:f.type)==="asset"&&typeof p=="string"&&p.startsWith(fa)&&(p=`${window.remotion_staticBase}/${p.slice(fa.length)}`),p===void 0&&s.add(l),i[l]=p}for(const l of Object.keys(n))if(((a=e[l])==null?void 0:a.type)==="enum"){const c=N1({schema:e,key:l,value:i[l]});for(const f of c)s.add(f)}return{merged:i,propsToDelete:s}},D1=(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},z1=({flatSchema:e,key:t,props:n})=>{var o;const r=D1(n,t);if(!(((o=e[t])==null?void 0:o.type)==="text-content"&&typeof r!="string"))return r},GI=(e,t,n)=>{const r={};for(const o of t)r[o]=n?z1({flatSchema:n,key:o,props:e}):D1(e,o);return r},XI=(e,t)=>Object.keys(Ch(e,n=>t[n])),qI=({flatSchema:e,props:t,valuesDotNotation:n,schemaKeys:r,propsToDelete:o})=>{var a;const i={...t};for(const l of r){const c=n[l];if(((a=e[l])==null?void 0:a.type)==="text-content"&&c===void 0)continue;const f=l.split(".");if(f.length===1){i[l]=c;continue}let p=i;for(let m=0;m<f.length-1;m++){const g=f[m];typeof p[g]=="object"&&p[g]!==null?p[g]={...p[g]}:p[g]={},p=p[g]}p[f[f.length-1]]=c}const s=new Set([...o].filter(l=>{var c;return!(((c=e[l])==null?void 0:c.type)==="text-content"&&n[l]===void 0)}));return Q2(i,s),i},Qg={},Nr=({Component:e,componentName:t,componentIdentity:n,schema:r,supportsEffects:o})=>{const i=U2(r),s=Ih(i),a=Object.keys(s),l=d.forwardRef((c,f)=>{const p=vt();if(!p.isStudio||p.isReadOnlyStudio||p.isRendering)return me.createElement(e,{...c,controls:null,ref:f});const{propStatuses:m}=d.useContext(ac),{getDragOverrides:g}=d.useContext(uc),w=d.useContext(Eh),x=Nt();if(c.controls)return me.createElement(e,{...c,ref:f});const[k]=d.useState(()=>{const{stack:j}=c;if(!j)return String(Math.random());const F=Qg[j];if(F)return F;const N=String(Math.random());return Qg[j]=N,N}),h=w.overrideIdToNodePathMappings[k]??null,y=a.map(j=>z1({flatSchema:s,key:j,props:c})),v=d.useMemo(()=>GI(c,a,s),y),b=d.useMemo(()=>({schema:i,currentRuntimeValueDotNotation:v,overrideId:k,supportsEffects:o,componentIdentity:n,componentName:t}),[v,k]),{merged:S,propsToDelete:E}=d.useMemo(()=>O1({schema:i,currentValue:v,overrideValues:h===null?{}:g(h),propStatus:h===null?void 0:A1(m,h),frame:x}),[v,g,h,m,x]),C=XI(i,S),I=qI({flatSchema:s,props:c,valuesDotNotation:S,schemaKeys:C,propsToDelete:E});return me.createElement(e,{...I,controls:b,ref:f})});return l.displayName=`withInteractivitySchema(${e.displayName||e.name||"Component"})`,l},Sd=[],JI=({from:e=0,trimBefore:t=0,freeze:n,durationInFrames:r=1/0,children:o,name:i,height:s,width:a,showInTimeline:l=!0,hidden:c=!1,controls:f,_remotionInternalEffects:p,_remotionInternalLoopDisplay:m,_remotionInternalStack:g,_remotionInternalDocumentationLink:w,_remotionInternalSingleChildComponent:x,_remotionInternalPremountDisplay:k,_remotionInternalPostmountDisplay:h,_remotionInternalIsMedia:y,outlineRef:v,...b},S)=>{const{layout:E="absolute-fill"}=b,[C]=d.useState(()=>String(Math.random())),I=d.useContext(Rt),{rootId:j}=wo(),F=I?I.cumulatedFrom+I.relativeFrom:0,N=Ju();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 K=xo(),M=pt(),$=e-t,U=((I==null?void 0:I.absoluteFrom)??0)+$,Y=I?Math.min(I.durationInFrames-$,r):r,A=Math.max(0,Math.min(M.durationInFrames-e,Y)),{registerSequence:T,unregisterSequence:W}=d.useContext(ts),B=d.useRef(null),D=b.layout==="none"?v??null:v??B,se=d.useMemo(()=>(I==null?void 0:I.premounting)||!!b._remotionInternalIsPremounting,[b._remotionInternalIsPremounting,I==null?void 0:I.premounting]),ie=d.useMemo(()=>(I==null?void 0:I.postmounting)||!!b._remotionInternalIsPostmounting,[b._remotionInternalIsPostmounting,I==null?void 0:I.postmounting]),L=F+$,V=I?I.cumulatedFrom+I.relativeFrom:0,ue=I?V-I.cumulatedNegativeFrom:0,oe=Math.max(0,ue,L),J=L-oe,ae=d.useMemo(()=>({absoluteFrom:U,cumulatedFrom:F,relativeFrom:$,cumulatedNegativeFrom:J,durationInFrames:A,parentFrom:(I==null?void 0:I.relativeFrom)??0,id:C,height:s??(I==null?void 0:I.height)??null,width:a??(I==null?void 0:I.width)??null,premounting:se,postmounting:ie,premountDisplay:k??null,postmountDisplay:h??null}),[F,U,$,A,I,C,s,a,se,ie,k,h,J]),fe=d.useMemo(()=>i??"",[i]),pe=w??"https://www.remotion.dev/docs/sequence",q=vt(),R=d.useContext(cc),G=(b==null?void 0:b.stack)??null,P=d.useRef(null);P.current=g??G;const z=typeof n=="number"?n:null,Z=t===0?null:t,O=(I==null?void 0:I.cumulatedNegativeFrom)??0,re=y&&y.type!=="image"?y.data.startMediaFrom+O-J:null,te=y&&y.type!=="image"?y.data.startMediaFrom+O:null,Se=y&&y.type!=="image"&&te!==null?z===null?null:te+(m?z%m.durationInFrames:z)*y.data.playbackRate:null;d.useEffect(()=>{if(q.isStudio)return y?(y.type==="image"?T({type:"image",controls:f??null,effects:p??Sd,displayName:fe,documentationLink:pe,duration:A,from:e,trimBefore:Z,id:C,loopDisplay:m,nonce:N.get(),parent:(I==null?void 0:I.id)??null,postmountDisplay:h??null,premountDisplay:k??null,rootId:j,showInTimeline:l,src:y.src,getStack:()=>P.current,refForOutline:D??null,isInsideSeries:R,frozenFrame:z,singleChildComponent:x??null}):T({type:y.type,controls:f??null,effects:p??Sd,displayName:fe,documentationLink:pe,doesVolumeChange:y.data.doesVolumeChange,duration:A,from:e,trimBefore:Z,id:C,loopDisplay:m,nonce:N.get(),parent:(I==null?void 0:I.id)??null,playbackRate:y.data.playbackRate,postmountDisplay:h??null,premountDisplay:k??null,rootId:j,showInTimeline:l,src:y.data.src,getStack:()=>P.current,startMediaFrom:re??y.data.startMediaFrom,mediaFrameAtSequenceZero:te,volume:y.data.volumes,refForOutline:D??null,isInsideSeries:R,frozenFrame:z,frozenMediaFrame:Se,singleChildComponent:x??null}),()=>{W(C)}):(T({from:e,trimBefore:Z,duration:A,id:C,displayName:fe,documentationLink:pe,parent:(I==null?void 0:I.id)??null,type:"sequence",rootId:j,showInTimeline:l,nonce:N.get(),loopDisplay:m,getStack:()=>P.current,premountDisplay:k??null,postmountDisplay:h??null,controls:f??null,effects:p??Sd,refForOutline:D??null,isInsideSeries:R,frozenFrame:z,singleChildComponent:x??null}),()=>{W(C)})},[r,C,i,T,fe,W,I==null?void 0:I.id,A,j,e,t,Z,l,N,m,k,h,q.isStudio,f,p,y,pe,D,R,z,re,te,Se,x]);const Ie=Math.ceil(F+e+r-1),_e=K<F+e||K>Ie?null:o,we=_e===null||typeof n>"u"||n===null?_e:u.jsx(ja,{frame:n,children:_e}),ke=b.layout==="none"?void 0:b.style,he=d.useCallback(Te=>{B.current=Te,typeof S=="function"?S(Te):S&&(S.current=Te)},[S]),Ne=d.useMemo(()=>({flexDirection:void 0,...a?{width:a}:{},...s?{height:s}:{},...ke??{}}),[s,ke,a]);if(S!==null&&E==="none")throw new TypeError('It is not supported to pass both a `ref` and `layout="none"` to <Sequence />.');return c?null:u.jsx(Rt.Provider,{value:ae,children:we===null?null:b.layout==="none"?we:u.jsx(Tn,{ref:he,style:Ne,className:b.className,children:we})})},QI=d.forwardRef(JI),eT=(e,t)=>{if(e.layout==="none")throw new Error('`<Sequence>` with `premountFor` and `postmountFor` props does not support layout="none"');const{style:n,from:r=0,durationInFrames:o=1/0,premountFor:i=0,postmountFor:s=0,styleWhilePremounted:a,styleWhilePostmounted:l,...c}=e,{freezeFrame:f,isPremountingOrPostmounting:p,postmountingActive:m,premountingActive:g,premountingStyle:w}=Fa({from:r,durationInFrames:o,premountFor:i,postmountFor:s,style:n??null,styleWhilePremounted:a??null,styleWhilePostmounted:l??null,hideWhilePremounted:"opacity"});return u.jsx(ja,{frame:f,active:p,children:u.jsx(fc,{ref:t,from:r,durationInFrames:o,style:w??void 0,_remotionInternalPremountDisplay:i,_remotionInternalPostmountDisplay:s,_remotionInternalIsPremounting:g,_remotionInternalIsPostmounting:m,...c})})},tT=d.forwardRef(eT),nT=(e,t)=>{const n=vt(),{fps:r}=pt();if(e.layout!=="none"&&!n.isRendering){const o=e.premountFor;if(o||e.postmountFor)return u.jsx(tT,{ref:t,...e,premountFor:o})}return u.jsx(QI,{...e,ref:t})},fc=d.forwardRef(nT),B1=fc,Ft=Nr({Component:fc,componentName:"<Sequence>",componentIdentity:"dev.remotion.remotion.Sequence",schema:Hi,supportsEffects:!1});Nr({Component:fc,componentName:"<Sequence>",componentIdentity:null,schema:K2,supportsEffects:!1});var W1=(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)}},rT="https://remotion.dev/docs/troubleshooting/webgl2-context",V1=(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 ${rT}`,oT=e=>new Error(V1("WebGL",e)),H1=e=>new Error(V1("WebGL2",e));class iT{constructor(t,n){Oe(this,"width");Oe(this,"height");Oe(this,"pairs",new Map);Oe(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 H1("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 sT=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},pl=null,aT=()=>pl||(pl=(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()})(),pl),U1=(e,t)=>({pool:new iT(e,t),setupCache:new WeakMap,cleanupRegistry:[],currentRunId:0}),tp=e=>{e.currentRunId++;for(const t of e.cleanupRegistry)t.definition.cleanup(t.state)},lT=(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},_a=async({state:e,source:t,effects:n,output:r,width:o,height:i})=>{const s=++e.currentRunId,a=()=>e.currentRunId!==s,l=n.filter(k=>!k.params.disabled),c=sT(l);let f=t,p=null;if(c.length===0){if(t===r)return!0;const k=r.getContext("2d");if(!k)throw new Error("Failed to acquire 2D context for output canvas");return k.clearRect(0,0,o,i),k.drawImage(f,0,0,o,i),!0}let m=!1;for(const k of c)if(k.backend==="webgpu"){m=!0;break}const g=m?await aT():null;if(a())return!1;let w=!0;for(let k=0;k<c.length;k++){const h=c[k],[y,v]=e.pool.getPair(h.backend);let b=y;for(const E of h.effects){const C=E.definition,I=lT(e,C,b);C.apply({source:f,target:b,state:I,params:E.params,width:o,height:i,gpuDevice:g,flipSourceY:h.backend==="webgl2"?w:!1}),h.backend==="webgl2"&&(w=!0,e.pool.assertContextNotLost(b)),f=b,b=b===y?v:y}p=f??p;const S=c[k+1];if(S&&S.backend!==h.backend&&p)if(h.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 x=r.getContext("2d");if(!x)throw new Error("Failed to acquire 2D context for output canvas");return x.clearRect(0,0,o,i),x.drawImage(p,0,0,o,i),!0},Aa=()=>{const e=d.useRef(null),t=d.useRef(null);return d.useEffect(()=>()=>{e.current&&tp(e.current)},[]),d.useMemo(()=>({get:(n,r)=>((!t.current||t.current.width!==n||t.current.height!==r)&&(e.current&&tp(e.current),e.current=U1(n,r),t.current={width:n,height:r}),e.current)}),[])},uT=({width:e,height:t,fit:n,className:r,style:o,effects:i,...s},a)=>{const l=d.useRef(null),c=Aa(),f=d.useMemo(()=>typeof document>"u"?null:document.createElement("canvas"),[]),p=d.useCallback(m=>{const g=l.current,w=e??m.displayWidth,x=t??m.displayHeight;if(!g)throw new Error("Canvas ref is not set");if(!f)throw new Error("Source canvas is not available");f.width=w,f.height=x;const k=f.getContext("2d");if(!k)throw new Error("Could not get 2d context for source canvas");return k.drawImage(m,...W1(n,{height:m.displayHeight,width:m.displayWidth},{width:w,height:x})),g.width=w,g.height=x,_a({state:c.get(w,x),source:f,effects:i,output:g,width:w,height:x})},[c,i,n,t,f,e]);return d.useImperativeHandle(a,()=>({draw:p,getCanvas:()=>{if(!l.current)throw new Error("Canvas ref is not set");return l.current},clear:()=>{var g;const m=(g=l.current)==null?void 0:g.getContext("2d");if(!m)throw new Error("Could not get 2d context");m.clearRect(0,0,l.current.width,l.current.height)}}),[p]),u.jsx("canvas",{ref:l,className:r,style:o,...s})},cT=me.forwardRef(uT),Z1=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}},dT=5,ey=({loopBehavior:e,durationFound:t,timeInSec:n})=>e==="loop"?t?n%t:n:Math.min(n,t||1/0),fT=async({resolvedSrc:e,signal:t,requestInit:n,currentTime:r,initialLoopBehavior:o})=>{const{decoder:i,selectedTrack:s}=await Z1({resolvedSrc:e,signal:t,requestInit:n,contentType:null}),a=[];let l=null;const c=async g=>{const w=a.find(k=>k.frameIndex===g);if(w&&w.frame)return w;const x=await i.decode({frameIndex:g,completeFramesOnly:!0});return w?w.frame=x.image:a.push({frame:x.image,frameIndex:g,timeInSeconds:x.image.timestamp/1e6}),{frame:x.image,frameIndex:g,timeInSeconds:x.image.timestamp/1e6}},f=g=>{const x=a.filter(k=>k.frame).sort((k,h)=>{const y=Math.abs(k.timeInSeconds-g),v=Math.abs(h.timeInSeconds-g);return y-v});for(let k=0;k<x.length;k++){if(k<dT)continue;const h=x[k];h.frame=null}},p=async({timeInSec:g,loopBehavior:w})=>{const x=ey({durationFound:l,loopBehavior:w,timeInSec:g}),h=a.filter(v=>v.timeInSeconds<=x).map(v=>v.frameIndex).reduce((v,b)=>Math.max(v,b),0);let y=h;for(;;){const v=await c(y);if(y++,!v.frame)throw new Error("No frame found");if(!v.frame.duration||(y===s.frameCount&&l===null&&(l=(v.frame.timestamp+v.frame.duration)/1e6),v.timeInSeconds>x||y===s.frameCount))break}s.frameCount-h<3&&w==="loop"&&await c(0),f(x)};return await p({timeInSec:r,loopBehavior:o}),await p({timeInSec:r,loopBehavior:o}),{close:()=>{var g;for(const w of a)(g=w.frame)==null||g.close(),w.frame=null;i.close()},getFrame:async(g,w)=>{if(l!==null&&g>l&&w==="clear-after-finish")return null;const x=ey({loopBehavior:w,durationFound:l,timeInSec:g});await p({timeInSec:x,loopBehavior:w});const h=a.filter(y=>y.frame).reduce((y,v)=>{const b=Math.abs(y.timeInSeconds-x),S=Math.abs(v.timeInSeconds-x);return b<S?y:v});if(!h.frame)throw new Error("No frame found");return h},frameCount:s.frameCount}},pT=({frame:e,playbackRate:t,fps:n})=>e*t/n,hT=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})},mT=e=>typeof window>"u"?e:new URL(e,window.origin).href,gT={src:{type:"asset",default:void 0,description:"Source",keyframable:!1},...Ar,...es,playbackRate:{type:"number",min:0,max:10,step:.1,default:1,description:"Playback rate",hiddenFromList:!1,keyframable:!1},...xr,...So,...bo},yT=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},K1=d.forwardRef(({src:e,width:t,height:n,onError:r,loopBehavior:o="loop",playbackRate:i=1,fit:s="fill",requestInit:a,effects:l,controls:c,...f},p)=>{const m=mT(e),[g,w]=d.useState(null),{delayRender:x,continueRender:k}=or(),[h]=d.useState(()=>x(`Rendering <AnimatedImage/> with src="${m}"`)),y=Nt(),{fps:v}=pt(),b=pT({frame:y,playbackRate:i,fps:v}),S=d.useRef(b);S.current=b;const E=hT(a),C=d.useRef(a);C.current=a;const I=d.useRef(null),j=Ma({effects:l,overrideId:(c==null?void 0:c.overrideId)??null});d.useImperativeHandle(p,()=>{var K;const N=(K=I.current)==null?void 0:K.getCanvas();if(!N)throw new Error("Canvas ref is not set");return N},[]);const[F]=d.useState(()=>o);return d.useEffect(()=>{const N=new AbortController;let K=!1,M=!1;const $=()=>{M||(M=!0,k(h))};return fT({resolvedSrc:m,signal:N.signal,requestInit:C.current,currentTime:S.current,initialLoopBehavior:F}).then(U=>{if(K){U.close();return}w(U),$()}).catch(U=>{if(!K){if(U.name==="AbortError"){$();return}r?(r==null||r(U),$()):pa(U)}}),()=>{K=!0,N.abort(),$()}},[m,h,r,E,F,k]),d.useEffect(()=>()=>{g==null||g.close()},[g]),d.useLayoutEffect(()=>{if(!g)return;const N=x(`Rendering frame at ${b} of <AnimatedImage src="${e}"/>`);let K=!1;return g.getFrame(b,o).then(async M=>{var U,Y;if(K)return;if(M===null){(U=I.current)==null||U.clear(),k(N);return}await((Y=I.current)==null?void 0:Y.draw(M.frame))&&!K&&k(N)}).catch(M=>{K||(r?(r(M),k(N)):pa(M))}),()=>{K=!0,k(N)}},[b,g,o,r,e,k,x,j,s,t,n]),u.jsx(cT,{ref:I,width:t,height:n,fit:s,effects:j,...f})});K1.displayName="AnimatedImageContent";var vT=({src:e,width:t,height:n,onError:r,fit:o,playbackRate:i,loopBehavior:s,id:a,className:l,style:c,durationInFrames:f,from:p,premountFor:m,postmountFor:g,styleWhilePremounted:w,styleWhilePostmounted:x,requestInit:k,effects:h=[],controls:y,ref:v,...b})=>{const S=d.useRef(null),E=$a(h);d.useImperativeHandle(v,()=>S.current,[]);const{effectivePostmountFor:C,effectivePremountFor:I,freezeFrame:j,isPremountingOrPostmounting:F,postmountingActive:N,premountingActive:K,premountingStyle:M}=Fa({from:p??0,durationInFrames:f??1/0,premountFor:m??null,postmountFor:g??null,style:c??null,styleWhilePremounted:w??null,styleWhilePostmounted:x??null,hideWhilePremounted:"display-none"}),$=yT(b),U={src:e,width:t,height:n,onError:r,fit:o,playbackRate:i,loopBehavior:s,id:a,className:l,style:M??void 0,requestInit:k,...$};return u.jsx(ja,{frame:j,active:F,children:u.jsx(Ft,{layout:"none",from:p??0,durationInFrames:f??1/0,name:"<AnimatedImage>",_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/animatedimage",controls:y,_remotionInternalEffects:E,_remotionInternalPremountDisplay:I||null,_remotionInternalPostmountDisplay:C||null,_remotionInternalIsPremounting:K,_remotionInternalIsPostmounting:N,...b,outlineRef:S,children:u.jsx(K1,{...U,ref:S,effects:h,controls:y})})})},Y1=Nr({Component:vT,componentName:"<AnimatedImage>",componentIdentity:"dev.remotion.remotion.AnimatedImage",schema:gT,supportsEffects:!0});Y1.displayName="AnimatedImage";un(Y1);var wT={type:"boolean",default:!1,description:"Disabled"},xT=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:wT,...e.schema}};return(i={})=>(n(i),{definition:r,params:i,effectKey:r.calculateKey(i),memoized:!1})},bT=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.')},ST=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")},G1=e=>{e.type==="artifact"&&(bT(e.filename),e.contentType!=="thumbnail"&&ST(e.content))},Go=d.createContext({registerRenderAsset:()=>{},unregisterRenderAsset:()=>{},renderAssets:[]}),kT=({children:e,collectAssets:t})=>{const[n,r]=d.useState([]),o=d.useRef([]),i=d.useCallback(l=>{G1(l),o.current=[...o.current,l],r(o.current)},[]);t&&d.useImperativeHandle(t,()=>({collectAssets:()=>{const l=o.current;return o.current=[],r([]),l}}),[]);const s=d.useCallback(l=>{o.current=o.current.filter(c=>c.id!==l),r(o.current)},[]);d.useLayoutEffect(()=>{typeof window<"u"&&(window.remotion_collectAssets=()=>{const l=o.current;return o.current=[],r([]),l})},[]);const a=d.useMemo(()=>({registerRenderAsset:i,unregisterRenderAsset:s,renderAssets:n}),[n,i,s]);return u.jsx(Go.Provider,{value:a,children:e})},vr=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,pc=({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))},X1=d.createContext(null),ET=()=>me.useContext(X1),hc=({durationInFrames:e,times:t=1/0,children:n,name:r,showInTimeline:o,...i})=>{const s=Nt(),{durationInFrames:a}=pt();if(Qu(e,{component:"of the <Loop /> component",allowFloats:!0}),typeof t!="number")throw new TypeError(`You passed to "times" an argument of type ${typeof t}, but it must be a number.`);if(t!==1/0&&t%1!==0)throw new TypeError(`The "times" prop of a loop must be an integer, but got ${t}.`);if(t<0)throw new TypeError(`The "times" prop of a loop must be at least 0, but got ${t}`);const l=Math.ceil(a/e),c=Math.min(l,t),f=i.layout==="none"?void 0:i.style,p=e*(c-1),g=Math.floor(s/e)*e,w=Math.min(g,p),x=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 u.jsx(X1.Provider,{value:k,children:u.jsx(Ft,{durationInFrames:e,from:w,name:r??"<Loop>",_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/loop",_remotionInternalLoopDisplay:x,layout:i.layout,style:f,showInTimeline:o,children:n})})};hc.useLoop=ET;var Gt=({logLevel:e,tag:t,message:n,mountTime:r})=>{const o=[r?Date.now()-r+"ms ":null,t].filter(Boolean).join(" ");_t.trace({logLevel:e,tag:null},`[${o}]`,n)},mc=d.createContext({}),ty={},kd=[],q1=({children:e})=>{const[t,n]=d.useState(()=>ty);return d.useEffect(()=>{const r=()=>{n(ty)};return kd.push(r),()=>{kd=kd.filter(o=>o!==r)}},[]),u.jsx(mc.Provider,{value:t,children:e})},J1=e=>{const t=e.indexOf("#");return t===-1?null:t},CT=e=>{const t=J1(e);return t===null?e:e.slice(0,t)},Xo=e=>{const t=d.useContext(mc),n=J1(e),r=CT(e);return t[r]?n!==null?t[r]+e.slice(n):t[r]:e},gc=(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`)},IT=(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.")},TT=(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.")},yc=({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"?TT(n,r):(typeof e<"u"||typeof t<"u")&&IT(e,t)},vc=({startFrom:e,endAt:t,trimBefore:n,trimAfter:r})=>({trimBeforeValue:n??e??void 0,trimAfterValue:r??t??void 0}),jT=(e,t)=>{switch(t.type){case"got-duration":{const n=vr(t.src);return e[n]===t.durationInSeconds?e:{...e,[n]:t.durationInSeconds}}default:return e}},Th=d.createContext({durations:{},setDurations:()=>{throw new Error("context missing")}}),Q1=({children:e})=>{const[t,n]=d.useReducer(jT,{}),r=d.useMemo(()=>({durations:t,setDurations:n}),[t]);return u.jsx(Th.Provider,{value:r,children:e})},jh=({crossOrigin:e,requestsVideoFrame:t,isClientSideRendering:n})=>{if(e!=null)return e;if(n||t)return"anonymous"},Iu=({mediaRef:e,mediaType:t,onAutoPlayError:n,logLevel:r,mountTime:o,reason:i,isPlayer:s})=>{const{current:a}=e;if(!a)return;Gt({logLevel:r,tag:"play",message:`Attempting to play ${a.src}. Reason: ${i}`,mountTime:o});const l=a.play();l.catch&&l.catch(c=>{if(a&&!c.message.includes("request was interrupted by a call to pause")&&!c.message.includes("The operation was aborted.")&&!c.message.includes("The fetching process for the media resource was aborted by the user agent")&&!c.message.includes("request was interrupted by a new load request")&&!c.message.includes("because the media was removed from the document")&&!(c.message.includes("user didn't interact with the document")&&a.muted)&&(console.log(`Could not play ${t} due to following error: `,c),!a.muted)){if(n){n();return}t==="video"&&s&&(_t.info({logLevel:r,tag:"<"+t+">"},"The video will be muted and we'll retry playing it."),_t.info({logLevel:r,tag:"<"+t+">"},"Use onAutoPlayError() to handle this error yourself."),a.muted=!0,a.play())}})},Rh=({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}}},ny=!1,RT=e=>{ny||(ny=!0,typeof window<"u"&&_t.warn({logLevel:e,tag:null},"AudioContext is not supported in this browser"))},FT=({logLevel:e,latencyHint:t,audioEnabled:n,sampleRate:r})=>{const o=vt(),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 RT(e),null;const a=new AudioContext({latencyHint:t,sampleRate:r}),l=a.createGain();l.connect(a.destination),_t.trace({logLevel:e,tag:"audio"},"Creating new audio context"),a.suspend();let c=null;return{audioContext:a,gainNode:l,getState:()=>{const g=a.state;return c==="running"&&g!=="running"?"suspended-to-running":c==="suspended"&&g!=="suspended"?"running-to-suspended":g},resume:()=>{c="running";const g=a.resume();return g.finally(()=>{c==="running"&&(c=null)}),g},suspend:()=>{c="suspended";const g=a.suspend();return g.finally(()=>{c==="suspended"&&(c=null)}),g}}},[e,t,o.isRendering,n,r])},PT=(e,t)=>new Promise(n=>{const r=e.currentTime,i=e.getOutputTimestamp().performanceTime,s=performance.now(),a=()=>{var p;const{currentTime:l}=e,c=e.getOutputTimestamp(),f=performance.now()-s;if(i!==void 0&&c.performanceTime!==void 0&&c.performanceTime>i&&c.contextTime!==void 0&&c.contextTime>r){_t.verbose({logLevel:t,tag:"audio"},`waitUntilActuallyResumed: getOutputTimestamp.performanceTime advanced from ${i.toFixed(6)} to ${c.performanceTime.toFixed(6)} after ${f.toFixed(1)}ms. currentTime=${l.toFixed(6)} (advanced by ${(l-r).toFixed(6)}), getOutputTimestamp.performanceTime=${((p=c.performanceTime)==null?void 0:p.toFixed(1))??"undefined"}`),n();return}requestAnimationFrame(a)};requestAnimationFrame(a)}),Ed="data:audio/mp3;base64,/+MYxAAJcAV8AAgAABn//////+/gQ5BAMA+D4Pg+BAQBAEAwD4Pg+D4EBAEAQDAPg++hYBH///hUFQVBUFREDQNHmf///////+MYxBUGkAGIMAAAAP/29Xt6lUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV/+MYxDUAAANIAAAAAFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",$T=(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},MT=(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,rs=d.createContext(null),wc=d.createContext(null),_T=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}`)},eb=({children:e,audioLatencyHint:t,audioEnabled:n,previewSampleRate:r})=>{const o=wr(),i=r??48e3;d.useEffect(()=>{typeof window>"u"||(window.remotion_sampleRate=i)},[i]);const s=FT({logLevel:o,latencyHint:t,audioEnabled:n,sampleRate:i}),a=d.useRef(!1),l=d.useRef(null),c=d.useMemo(()=>({value:0}),[]),f=d.useRef([]),p=d.useMemo(()=>({dispatch:b=>{f.current.forEach(S=>S(b))},subscribe:b=>(f.current.push(b),{remove:()=>{f.current=f.current.filter(S=>S!==b)}})}),[]),m=d.useRef({scheduledEndTime:null,mediaEndTime:null}),g=d.useRef(new Map),w=d.useCallback(b=>{g.current.delete(b)},[]),x=d.useMemo(()=>({node:b,mediaTimestamp:S,sourceOffset:E,scheduledTime:C,duration:I,offset:j,originalUnloopedMediaTimestamp:F})=>{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 K=_T(N);I>0&&(K?g.current.set(b,{scheduledTime:C,offset:j,duration:I}):b.start(C,j,I));const M=C+I/b.playbackRate.value,$=S+j-E,U=$+I,Y=s.audioContext.baseLatency+s.audioContext.outputLatency,A=C-s.audioContext.currentTime,T=m.current,W=T.scheduledEndTime!==null&&Math.abs(C-T.scheduledEndTime)>.001,B=T.mediaEndTime!==null&&Math.abs($-T.mediaEndTime)>.001;return _t.verbose({logLevel:o,tag:"audio-scheduling"},"scheduled %c%s%c %s %c%s%c %s %c%s%c %s %s %s %s %s",W?"color: red; font-weight: bold":"",C.toFixed(4),"",M.toFixed(4),B?"color: red; font-weight: bold":"",$.toFixed(4),"",U.toFixed(4),I<0||A<0?"color: red; font-weight: bold":"color: blue; font-weight: bold",I<0?"missed "+Math.abs(j).toFixed(2)+"s":Math.abs(A).toFixed(2)+(A<0?" delay":" ahead"),"","current="+s.audioContext.currentTime.toFixed(4),"offset="+j.toFixed(4),"latency="+Y.toFixed(4),"state="+s.audioContext.state,F!==$?"original_ts="+F.toFixed(4):"","action="+(K?"schedule":"start"),""),T.scheduledEndTime=M,T.mediaEndTime=U,I>0?{type:"started",scheduledTime:C}:{type:"not-started",reason:"missed "+Math.abs(j).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),g.current.forEach((S,E)=>{E.start(S.scheduledTime,S.offset,S.duration)}),g.current.clear();const b=s.resume();return l.current=new Promise(S=>{PT(s.audioContext,o).then(S),b.catch(E=>{_t.warn({logLevel:o,tag:"audio"},"AudioContext resume rejected, continuing without audio sync",E),S()})}).finally(()=>{l.current=null}),b.catch(()=>{})},[s,o]),h=d.useCallback(()=>l.current,[]),y=d.useCallback(()=>!s||!a.current?Promise.resolve():(a.current=!1,s.suspend()),[s]),v=d.useMemo(()=>({audioContext:(s==null?void 0:s.audioContext)??null,getAudioContextState:()=>(s==null?void 0:s.getState())??null,gainNode:(s==null?void 0:s.gainNode)??null,audioSyncAnchor:c,audioSyncAnchorEmitter:p,scheduleAudioNode:x,resume:k,suspend:y,getIsResumingAudioContext:h,unscheduleAudioNode:w}),[s,c,p,x,k,y,h,w]);return u.jsx(rs.Provider,{value:v,children:e})},tb=({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=wr(),i=Ta(),s=vt(),a=d.useContext(rs),l=(a==null?void 0:a.audioContext)??null,c=a==null?void 0:a.resume,[f]=d.useState(()=>new Array(t).fill(!0).map(()=>{const b=d.createRef();return{id:Math.random(),ref:b,mediaElementSourceNode:Rh({audioContext:l,ref:b})}}));for(const{mediaElementSourceNode:b}of f)b==null||b.setAudioContext(l);(me.useInsertionEffect??me.useLayoutEffect)(()=>()=>{requestAnimationFrame(()=>{f.forEach(({mediaElementSourceNode:b})=>{b==null||b.cleanup()})})},[f]);const m=d.useRef(new Array(t).fill(!1)),g=d.useCallback(()=>{f.forEach(({ref:b,id:S})=>{var I;const E=(I=n.current)==null?void 0:I.find(j=>j.id===S),{current:C}=b;if(C){if(E===void 0){C.src!==Ed&&(C.src=Ed);return}if(!E)throw new TypeError("Expected audio data to be there");Object.keys(E.props).forEach(j=>{MT(j,E.props[j],C[j])&&(C[j]=E.props[j])})}})},[f]),w=d.useCallback(b=>{var Y,A;const{aud:S,audioId:E,premounting:C,postmounting:I}=b,j=(Y=n.current)==null?void 0:Y.find(T=>T.audioId===E);if(j)return j;const F=m.current.findIndex(T=>T===!1);if(F===-1)throw new Error(`Tried to simultaneously mount ${t+1} <Html5Audio /> tags at the same time. With the current settings, the maximum amount of <Html5Audio /> tags is limited to ${t} at the same time. Remotion pre-mounts silent audio tags to help avoid browser autoplay restrictions. See https://remotion.dev/docs/player/autoplay#using-the-numberofsharedaudiotags-prop for more information on how to increase this limit.`);const{id:N,ref:K,mediaElementSourceNode:M}=f[F],$=[...m.current];$[F]=N,m.current=$;const U={props:S,id:N,el:K,audioId:E,mediaElementSourceNode:M,premounting:C,audioMounted:!!K.current,postmounting:I,cleanupOnMediaTagUnmount:()=>{}};return(A=n.current)==null||A.push(U),g(),U},[t,f,g]),x=d.useCallback(b=>{var C;const S=[...m.current],E=f.findIndex(I=>I.id===b);if(E===-1)throw new TypeError(`Unknown audio ref ${b}; refs: ${f.map(I=>I.id).join(", ")}`);S[E]=!1,m.current=S,n.current=(C=n.current)==null?void 0:C.filter(I=>I.id!==b),g()},[f,g]),k=d.useCallback(({aud:b,audioId:S,id:E,premounting:C,postmounting:I})=>{var F;let j=!1;n.current=(F=n.current)==null?void 0:F.map(N=>{const K=!!N.el.current;return N.audioMounted!==K&&(j=!0),N.id===E?$T(b,N.props)&&N.premounting===C&&N.postmounting===I?N.audioMounted===K?N:{...N,audioMounted:K}:(j=!0,{...N,props:b,premounting:C,postmounting:I,audioId:S,audioMounted:K}):N.audioMounted===K?N:{...N,audioMounted:K}}),j&&g()},[g]),h=d.useCallback(()=>{f.forEach(b=>{const S=n.current.find(E=>E.el===b.ref);S!=null&&S.premounting||Iu({mediaRef:b.ref,mediaType:"audio",onAutoPlayError:null,logLevel:o,mountTime:i,reason:"playing all audios",isPlayer:s.isPlayer})}),c==null||c()},[o,i,f,s.isPlayer,c]),y=d.useMemo(()=>({registerAudio:w,unregisterAudio:x,updateAudio:k,playAllAudios:h,numberOfAudioTags:t}),[t,h,w,x,k]),v=d.useMemo(()=>f.map(({id:b,ref:S})=>u.jsx("audio",{ref:S,preload:"metadata",src:Ed},b)),[f]);return u.jsxs(wc.Provider,{value:y,children:[v,e]})},AT=({aud:e,audioId:t,premounting:n,postmounting:r})=>{var l;const o=d.useContext(rs),i=d.useContext(wc),[s]=d.useState(()=>{if(i&&i.numberOfAudioTags>0)return i.registerAudio({aud:e,audioId:t,premounting:n,postmounting:r});const c=me.createRef(),f=Rh({audioContext:(o==null?void 0:o.audioContext)??null,ref:c});return{el:c,id:Math.random(),props:e,audioId:t,mediaElementSourceNode:f,premounting:n,audioMounted:!!c.current,postmounting:r,cleanupOnMediaTagUnmount:()=>{f==null||f.cleanup()}}});(l=s.mediaElementSourceNode)==null||l.setAudioContext((o==null?void 0:o.audioContext)??null);const a=me.useInsertionEffect??me.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},NT=1e-5,Tu=(e,t)=>Math.abs(e-t)<NT,nb=(e,t)=>Math.round(e/t*100)/100,np=()=>typeof window>"u"||!/AppleWebKit/.test(window.navigator.userAgent)?!1:!window.navigator.userAgent.includes("Chrome/"),xc=()=>typeof window>"u"?!1:/iP(ad|od|hone)/i.test(window.navigator.userAgent)&&np(),LT=e=>xc()&&e.startsWith("blob:"),rp=({actualFrom:e,fps:t})=>nb(Math.max(0,-e),t),op=({duration:e,fps:t})=>nb(e,t),OT=({actualSrc:e,actualFrom:t,duration:n,fps:r})=>{if(LT(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=${rp({actualFrom:t,fps:r})}`;return Number.isFinite(n)?`${i},${op({duration:n,fps:r})}`:i},DT=({prevStartFrom:e,newStartFrom:t,prevDuration:n,newDuration:r,fps:o})=>{const i=rp({actualFrom:e,fps:o}),s=rp({actualFrom:t,fps:o}),a=op({duration:n,fps:o}),l=op({duration:r,fps:o});return!(s<i||l>a)},zT=({actualSrc:e,actualFrom:t,duration:n,fps:r})=>{const o=d.useRef(t),i=d.useRef(n),s=d.useRef(e);return(!DT({prevStartFrom:o.current,newStartFrom:t,prevDuration:i.current,newDuration:n,fps:r})||e!==s.current)&&(o.current=t,i.current=n,s.current=e),OT({actualSrc:s.current,actualFrom:o.current,duration:i.current,fps:r})},ry=!1,BT=e=>{ry||(ry=!0,_t.warn({logLevel:e,tag:null},"In Safari, setting a volume and a playback rate at the same time is buggy."),_t.warn({logLevel:e,tag:null},"In Desktop Safari, only volumes <= 1 will be applied."),_t.warn({logLevel:e,tag:null},e,"In Mobile Safari, the volume will be ignored and set to 1 if a playbackRate is set."))},rb=({mediaRef:e,volume:t,logLevel:n,source:r,shouldUseWebAudioApi:o})=>{var m,g,w;const i=d.useRef(null),s=d.useRef(t);s.current=t;const a=d.useContext(rs);if(!a)throw new Error("useAmplification must be used within a SharedAudioContext");const{audioContext:l,gainNode:c}=a;if(typeof window<"u"&&d.useLayoutEffect(()=>{var k,h;if(!l||!e.current||!o)return;if(e.current.playbackRate!==1&&np()){BT(n);return}if(!r||!c)return;const x=new GainNode(l,{gain:s.current});return r.attemptToConnect(),r.get().connect(x),x.connect(c),i.current={gainNode:x},_t.trace({logLevel:n,tag:null},`Starting to amplify ${(k=e.current)==null?void 0:k.src}. Gain = ${s.current}, playbackRate = ${(h=e.current)==null?void 0:h.playbackRate}`),()=>{i.current=null,x.disconnect(),r.get().disconnect()}},[n,e,l,r,o,c]),i.current){const x=t;Tu(i.current.gainNode.gain.value,x)||(i.current.gainNode.gain.value=x,_t.trace({logLevel:n,tag:null},`Setting gain to ${x} for ${(m=e.current)==null?void 0:m.src}`))}return(np()&&e.current&&((g=e.current)==null?void 0:g.playbackRate)!==1||!o)&&e.current&&!Tu(t,(w=e.current)==null?void 0:w.volume)&&(e.current.volume=Math.min(t,1)),i},Bo=()=>{const e=d.useContext(Rt);return(e==null?void 0:e.cumulatedNegativeFrom)??0},os=e=>{const t=hc.useLoop(),n=Nt(),r=Bo();return e==="repeat"||t===null?n+r:n+r+t.durationInFrames*t.iteration},ob=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]},WT=({compositionDurationInFrames:e,playbackRate:t,trimBefore:n,trimAfter:r,parentSequenceDurationInFrames:o,loop:i})=>{if(i)return e;const s=pc({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},qo=({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)},oy={},VT=e=>{oy[e]||(console.warn(e),oy[e]=!0)},ib=({volume:e,mediaVolume:t,mediaType:n,src:r,displayName:o,trimBefore:i,trimAfter:s,playbackRate:a,sequenceDurationInFrames:l,mediaStartsAt:c,loop:f})=>{if(!r)throw new Error("No src passed");const p=d.useContext(Rt),[m]=d.useState(()=>e),g=WT({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,g+c))).fill(!0).map((b,S)=>qo({frame:S+c,volume:e,mediaVolume:t})).join(","),[g,c,e,t]);d.useEffect(()=>{typeof e=="number"&&e!==m&&VT(`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`)},[m,n,r,e]);const x=typeof e=="function",k=Ju(),{rootId:h}=wo(),y=0-c+(i??0);return d.useMemo(()=>({volumes:w,duration:g,doesVolumeChange:x,nonce:k,rootId:h,finalDisplayName:o??ob(r),startMediaFrom:y,src:r,playbackRate:a}),[w,g,x,k,h,o,r,y,a])},Fh=({volume:e,mediaVolume:t,src:n,mediaType:r,playbackRate:o,displayName:i,id:s,getStack:a,showInTimeline:l,premountDisplay:c,postmountDisplay:f,loopDisplay:p,documentationLink:m,refForOutline:g})=>{const w=d.useContext(Rt),x=Bo(),{registerSequence:k,unregisterSequence:h}=d.useContext(ts),{durationInFrames:y}=pt(),v=Bo(),{volumes:b,duration:S,doesVolumeChange:E,nonce:C,rootId:I,finalDisplayName:j}=ib({volume:e,mediaVolume:t,mediaType:r,src:n,displayName:i,trimAfter:void 0,trimBefore:void 0,playbackRate:o,sequenceDurationInFrames:y,mediaStartsAt:v,loop:!1}),{isStudio:F}=vt();d.useEffect(()=>{var N,K;if(!n)throw new Error("No src passed");if(!(!F&&((K=(N=window.process)==null?void 0:N.env)==null?void 0:K.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:j,documentationLink:m,rootId:I,volume:b,showInTimeline:!0,nonce:C.get(),startMediaFrom:0-x,mediaFrameAtSequenceZero:null,doesVolumeChange:E,loopDisplay:p,playbackRate:o,getStack:a,premountDisplay:c,postmountDisplay:f,controls:null,effects:[],refForOutline:g,isInsideSeries:!1,frozenFrame:null,frozenMediaFrame:null}),()=>{h(s)}},[S,s,w,n,k,h,b,E,C,r,x,o,a,l,c,f,p,m,I,j,F,g])},HT=(e,t)=>{const[n,r]=d.useState([]),[o,i]=d.useState([]),[s,a]=d.useState([]),c=vt().isRendering,f=d.useRef(!1),p=d.useCallback(w=>{if(c)return{unblock:()=>{}};let x=!1;return r(k=>[...k,w]),{unblock:()=>{x||(x=!0,r(k=>{const h=k.filter(y=>y!==w);return h.length===k.length?k:h}))}}},[c]),m=d.useCallback(w=>(i(x=>[...x,w]),{remove:()=>{i(x=>x.filter(k=>k!==w))}}),[]),g=d.useCallback(w=>(a(x=>[...x,w]),{remove:()=>{a(x=>x.filter(k=>k!==w))}}),[]);return d.useEffect(()=>{c||n.length>0&&!f.current&&(f.current=!0,o.forEach(w=>w()),Gt({logLevel:e,message:"Player is entering buffer state",mountTime:t,tag:"player"}))},[n]),typeof window<"u"&&d.useLayoutEffect(()=>{c||n.length===0&&f.current&&(f.current=!1,s.forEach(w=>w()),Gt({logLevel:e,message:"Player is exiting buffer state",mountTime:t,tag:"player"}))},[n]),d.useMemo(()=>({addBlock:p,listenForBuffering:m,listenForResume:g,buffering:f}),[p,f,m,g])},is=me.createContext(null),sb=({children:e})=>{const{logLevel:t,mountTime:n}=d.useContext(Ko),r=HT(t??"info",n);return u.jsx(is.Provider,{value:r,children:e})},ab=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},bc=()=>{const e=d.useContext(is),t=wr(),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");_t.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,_t.trace({logLevel:t,tag:"[buffer-state]"},"Removing buffer handle"),r())}}}}),[n,t])},UT=()=>/^((?!chrome|android).)*safari/i.test(window.navigator.userAgent),ZT=({mediaRef:e,mediaType:t,onVariableFpsVideoDetected:n,pauseWhenBuffering:r,logLevel:o,mountTime:i})=>{const s=d.useRef(!1),{delayPlayback:a}=bc(),l=d.useCallback(c=>{var w;if(t!=="video"||!r)return;const f=e.current;if(!f)return;if(f.readyState>=f.HAVE_FUTURE_DATA&&!UT()){Gt({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){Gt({logLevel:o,message:"Not using buffer until first frame, because requestVideoFrameCallback is not supported",mountTime:i,tag:"buffer"});return}s.current=!0,Gt({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(),m=()=>{p.unblock(),f.removeEventListener("ended",m,{once:!0}),f.removeEventListener("pause",m,{once:!0}),s.current=!1},g=()=>{m()};f.requestVideoFrameCallback((x,k)=>{Math.abs(k.mediaTime-c)>.5&&n(),m()}),f.addEventListener("ended",g,{once:!0}),f.addEventListener("pause",g,{once:!0}),f.addEventListener("canplay",g,{once:!0})},[a,o,e,t,i,n,r]);return d.useMemo(()=>({isBuffering:()=>s.current,bufferUntilFirstFrame:l}),[l])},KT=e=>{const{duration:t,currentTime:n,paused:r,ended:o,desiredUnclampedTime:i,mediaTagTime:s,mediaTagLastUpdate:a,rvcTime:l,rvcLastUpdate:c,isVariableFpsVideo:f,acceptableTimeShift:p,lastSeekDueToShift:m,playing:g,playbackRate:w,mediaTagBufferingOrStalled:x,playerBuffering:k,absoluteFrame:h,onlyWarnForMediaSeekingError:y,isPremounting:v,isPostmounting:b,pauseWhenBuffering:S}=e,E=!Number.isNaN(t)&&Number.isFinite(t)?Math.min(t,i):i,C=Math.abs(E-s),I=l?Math.abs(E-l):null,j=c&&l>a?I:C,F=I&&!f?j:C;if(F>p&&m!==E)return{type:"seek-due-to-shift",shouldBeTime:E,why:`because time shift is too big. shouldBeTime = ${E}, isTime = ${s}, requestVideoCallbackTime = ${l}, timeShift = ${F}${f?", isVariableFpsVideo = true":""}, isPremounting = ${v}, isPostmounting = ${b}, pauseWhenBuffering = ${S}`,bufferUntilFirstFrame:g&&w>0,playReason:g&&r?"player is playing but media tag is paused, and just seeked":null,warnAboutNonSeekable:!y};const N=g?.15:.01,K=Math.abs(n-E)>N;if(!g||k&&!x)return{type:"seek-if-not-playing",shouldBeTime:E,why:K?`not playing or something else is buffering. time offset is over seek threshold (${N})`:null};if(!g||k)return{type:"none"};const $=r&&!o;if($||h===0){const Y=$?"media tag is paused":"absolute frame is 0";return{type:"play-and-seek",shouldBeTime:E,why:K?`is over timeshift threshold (threshold = ${N}) and ${Y}`:null,playReason:`player is playing and ${Y}`,bufferUntilFirstFrame:!f&&w>0}}return{type:"none"}},YT=e=>{var r,o;const t=me.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},Yl=({mediaRef:e,time:t,logLevel:n,why:r,mountTime:o})=>{const i=xc()?Number(t.toFixed(1)):t;return Gt({logLevel:n,tag:"seek",message:`Seeking from ${e.currentTime} to ${i}. src= ${e.src} Reason: ${r}`,mountTime:o}),e.currentTime=i,i},GT=({element:e,shouldBuffer:t,isPremounting:n,isPostmounting:r,logLevel:o,mountTime:i,src:s})=>{const a=bc(),[l,c]=d.useState(!1);return d.useEffect(()=>{let f=[];const{current:p}=e;if(!p||!t)return;if(n||r){if((n||r)&&p.readyState<p.HAVE_FUTURE_DATA&&!navigator.userAgent.includes("Firefox/")){Gt({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 x=p.playbackRate;p.load(),p.playbackRate=x}return}const m=x=>{let k=!1;f.forEach(h=>{h(x),k=!0}),f=[],c(h=>(h&&(k=!0),!1)),k&&Gt({logLevel:o,message:`Unmarking as buffering: ${p.src}. Reason: ${x}`,tag:"buffer",mountTime:i})},g=x=>{c(!0),Gt({logLevel:o,message:`Marking as buffering: ${p.src}. Reason: ${x}`,tag:"buffer",mountTime:i});const{unblock:k}=a.delayPlayback(),h=()=>{m('"canplay" was fired'),w()},y=()=>{m('"error" event was occurred'),w()};p.addEventListener("canplay",h,{once:!0}),f.push(()=>{p.removeEventListener("canplay",h)}),p.addEventListener("error",y,{once:!0}),f.push(()=>{p.removeEventListener("error",y)}),f.push(v=>{Gt({logLevel:o,message:`Unblocking ${p.src} from buffer. Reason: ${v}`,tag:"buffer",mountTime:i}),k()})},w=()=>{if(p.readyState<p.HAVE_FUTURE_DATA){if(g(`readyState is ${p.readyState}, which is less than HAVE_FUTURE_DATA`),!navigator.userAgent.includes("Firefox/")){Gt({logLevel:o,message:`Calling .load() on ${s} because readyState is ${p.readyState} and it is not Firefox. ${p.playbackRate}`,tag:"load",mountTime:i});const x=p.playbackRate;p.load(),p.playbackRate=x}}else{const x=()=>{g('"waiting" event was fired')};p.addEventListener("waiting",x),f.push(()=>{p.removeEventListener("waiting",x)})}};return w(),()=>{m("element was unmounted or prop changed")}},[a,s,e,n,r,o,t,i]),l},XT=({mediaRef:e,mediaType:t,lastSeek:n,onVariableFpsVideoDetected:r})=>{const o=d.useRef(null);return d.useEffect(()=>{const{current:i}=e;if(i)o.current={time:i.currentTime,lastUpdate:performance.now()};else{o.current=null;return}if(t!=="video"){o.current=null;return}const s=i;if(!s.requestVideoFrameCallback)return;let a=()=>{};const l=()=>{if(!s)return;const c=s.requestVideoFrameCallback((f,p)=>{if(o.current!==null){const m=Math.abs(o.current.time-p.mediaTime),g=Math.abs(n.current===null?1/0:p.mediaTime-n.current);m>.5&&g>.5&&p.mediaTime>o.current.time&&r()}o.current={time:p.mediaTime,lastUpdate:performance.now()},l()});a=()=>{s.cancelVideoFrameCallback(c),a=()=>{}}};return l(),()=>{a()}},[n,e,t,r]),o},lb=({frame:e,playbackRate:t,startFrom:n})=>ns(e,[-1,n,n+1],[-1,n,n+t]),ub=({fps:e,frame:t,playbackRate:n,startFrom:r})=>{const o=lb({frame:t,playbackRate:n,startFrom:r}),i=1e3/e;return o*i/1e3},iy={},qT=(e,t)=>{if(e===null||e.seekable.length===0||e.seekable.length>1||iy[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),iy[e.src]=!0}},cb=({mediaRef:e,src:t,mediaType:n,playbackRate:r,preservePitch:o=!0,onlyWarnForMediaSeekingError:i,acceptableTimeshift:s,pauseWhenBuffering:a,isPremounting:l,isPostmounting:c,onAutoPlayError:f})=>{const{playbackRate:p}=vh(),m=Nt(),g=xo(),[w]=d1(),x=d.useContext(is),{fps:k}=pt(),h=Bo(),y=d.useRef(null),v=d.useRef(null),b=wr(),S=Ta();if(!x)throw new Error("useMediaPlayback must be used inside a <BufferingContext>");const E=d.useRef({}),C=d.useCallback(()=>{t&&(E.current[t]||(_t.verbose({logLevel:b,tag:null},`Detected ${t} as a variable FPS video. Disabling buffering while seeking.`),E.current[t]=!0))},[b,t]),I=XT({mediaRef:e,mediaType:n,lastSeek:v,onVariableFpsVideoDetected:C}),j=YT(e),F=ub({frame:m,playbackRate:r,startFrom:-h,fps:k}),N=GT({element:e,shouldBuffer:a,isPremounting:l,isPostmounting:c,logLevel:b,mountTime:S,src:t??null}),{bufferUntilFirstFrame:K,isBuffering:M}=ZT({mediaRef:e,mediaType:n,onVariableFpsVideoDetected:C,pauseWhenBuffering:a,logLevel:b,mountTime:S}),$=r*p,U=(()=>{var D;return(D=e.current)!=null&&D.duration?Math.min(e.current.duration,s??.65):s??.65})(),Y=ab(x);d.useEffect(()=>{var B,D,se,ie,L;if((B=e.current)!=null&&B.paused)return;if(!w){Gt({logLevel:b,tag:"pause",message:`Pausing ${(D=e.current)==null?void 0:D.src} because ${l?"media is premounting":c?"media is postmounting":"Player is not playing"}`,mountTime:S}),(se=e.current)==null||se.pause();return}const T=N||M();x.buffering.current&&!T&&(Gt({logLevel:b,tag:"pause",message:`Pausing ${(ie=e.current)==null?void 0:ie.src} because player is buffering but media tag is not`,mountTime:S}),(L=e.current)==null||L.pause())},[M,N,x,Y,l,b,e,n,S,w,c]);const A=vt();d.useLayoutEffect(()=>{const T=Math.max(0,$);e.current&&e.current.playbackRate!==T&&(e.current.playbackRate=T),e.current&&e.current.preservesPitch!==o&&(e.current.preservesPitch=o)},[e,$,o]),d.useEffect(()=>{var D,se;const T=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 ${T} element.`);const{current:W}=e,B=KT({duration:W.duration,currentTime:W.currentTime,paused:W.paused,ended:W.ended,desiredUnclampedTime:F,mediaTagTime:j.current.time,mediaTagLastUpdate:j.current.lastUpdate,rvcTime:((D=I.current)==null?void 0:D.time)??null,rvcLastUpdate:((se=I.current)==null?void 0:se.lastUpdate)??null,isVariableFpsVideo:!!E.current[t],acceptableTimeShift:U,lastSeekDueToShift:y.current,playing:w,playbackRate:$,mediaTagBufferingOrStalled:N||M(),playerBuffering:x.buffering.current,absoluteFrame:g,onlyWarnForMediaSeekingError:i,isPremounting:l,isPostmounting:c,pauseWhenBuffering:a});if(B.type!=="none"){if(B.type==="seek-due-to-shift"){v.current=Yl({mediaRef:W,time:B.shouldBeTime,logLevel:b,why:B.why,mountTime:S}),y.current=v.current,B.bufferUntilFirstFrame&&K(B.shouldBeTime),B.playReason!==null&&Iu({mediaRef:e,mediaType:n,onAutoPlayError:f,logLevel:b,mountTime:S,reason:B.playReason,isPlayer:A.isPlayer}),B.warnAboutNonSeekable&&qT(W);return}if(B.type==="seek-if-not-playing"){B.why!==null&&(v.current=Yl({mediaRef:W,time:B.shouldBeTime,logLevel:b,why:B.why,mountTime:S}));return}B.why!==null&&(v.current=Yl({mediaRef:W,time:B.shouldBeTime,logLevel:b,why:B.why,mountTime:S})),Iu({mediaRef:e,mediaType:n,onAutoPlayError:f,logLevel:b,mountTime:S,reason:B.playReason,isPlayer:A.isPlayer}),B.bufferUntilFirstFrame&&K(B.shouldBeTime)}},[g,U,K,x.buffering,I,b,F,M,N,e,n,i,$,w,t,f,l,c,a,S,j,A.isPlayer])},db=({mediaRef:e,id:t,mediaType:n,onAutoPlayError:r,isPremounting:o,isPostmounting:i})=>{const{audioAndVideoTags:s,imperativePlaying:a}=wo(),l=wr(),c=Ta(),f=vt();d.useEffect(()=>{const p={id:t,play:m=>{if(a.current&&!(o||i))return Iu({mediaRef:e,mediaType:n,onAutoPlayError:r,logLevel:l,mountTime:c,reason:m,isPlayer:f.isPlayer})}};return s.current.push(p),()=>{s.current=s.current.filter(m=>m.id!==t)}},[s,t,e,n,r,a,o,i,l,c,f.isPlayer])},Ph=d.createContext({playerMuted:!1,mediaVolume:1}),$h=d.createContext({setPlayerMuted:()=>{throw new Error("default")},setMediaVolume:()=>{throw new Error("default")}}),Mh=()=>{const{mediaVolume:e}=d.useContext(Ph),{setMediaVolume:t}=d.useContext($h);return d.useMemo(()=>[e,t],[e,t])},_h=()=>{const{playerMuted:e}=d.useContext(Ph),{setPlayerMuted:t}=d.useContext($h);return d.useMemo(()=>[e,t],[e,t])},ss=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.`)},JT=(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=wr(),{volume:o,muted:i,playbackRate:s,preservePitch:a,shouldPreMountAudioTags:l,src:c,onDuration:f,acceptableTimeShiftInSeconds:p,_remotionInternalNeedsDurationCalculation:m,_remotionInternalNativeLoopPassed:g,_remotionInternalStack:w,allowAmplificationDuringRender:x,name:k,pauseWhenBuffering:h,showInTimeline:y,loopVolumeCurveBehavior:v,stack:b,crossOrigin:S,delayRenderRetries:E,delayRenderTimeoutInMilliseconds:C,toneFrequency:I,useWebAudioApi:j,onError:F,onNativeError:N,audioStreamIndex:K,...M}=e,[$]=Mh(),[U]=_h(),Y=os(v??"repeat");if(!c)throw new TypeError("No 'src' was passed to <Html5Audio>.");const A=Xo(c),T=d.useContext(Rt),[W]=d.useState(()=>String(Math.random())),B=qo({frame:Y,volume:o,mediaVolume:$});ss(B);const D=jh({crossOrigin:S,requestsVideoFrame:!1,isClientSideRendering:!1}),se=d.useMemo(()=>({muted:i||U||B<=0,src:A,loop:g,crossOrigin:D,...M}),[g,U,i,M,A,B,D]),ie=d.useMemo(()=>`audio-${Yo(c??"")}-${T==null?void 0:T.relativeFrom}-${T==null?void 0:T.cumulatedFrom}-${T==null?void 0:T.durationInFrames}-muted:${e.muted}-loop:${e.loop}`,[c,T==null?void 0:T.relativeFrom,T==null?void 0:T.cumulatedFrom,T==null?void 0:T.durationInFrames,e.muted,e.loop]),{el:L,mediaElementSourceNode:V,cleanupOnMediaTagUnmount:ue}=AT({aud:se,audioId:ie,premounting:!!(T!=null&&T.premounting),postmounting:!!(T!=null&&T.postmounting)}),oe=d.useCallback(()=>w??null,[w]);Fh({volume:o,mediaVolume:$,src:c,mediaType:"audio",playbackRate:s??1,displayName:k??null,id:W,getStack:oe,showInTimeline:y,premountDisplay:(T==null?void 0:T.premountDisplay)??null,postmountDisplay:(T==null?void 0:T.postmountDisplay)??null,loopDisplay:void 0,documentationLink:"https://www.remotion.dev/docs/html5-audio",refForOutline:null}),cb({mediaRef:L,src:c,mediaType:"audio",playbackRate:s??1,preservePitch:a,onlyWarnForMediaSeekingError:!1,acceptableTimeshift:p??null,isPremounting:!!(T!=null&&T.premounting),isPostmounting:!!(T!=null&&T.postmounting),pauseWhenBuffering:h,onAutoPlayError:null}),db({id:W,isPostmounting:!!(T!=null&&T.postmounting),isPremounting:!!(T!=null&&T.premounting),mediaRef:L,mediaType:"audio",onAutoPlayError:null}),rb({logLevel:r,mediaRef:L,source:V,volume:B,shouldUseWebAudioApi:j??!1}),(me.useInsertionEffect??me.useLayoutEffect)(()=>()=>{requestAnimationFrame(()=>{ue()})},[ue]),d.useImperativeHandle(t,()=>L.current,[L]);const ae=d.useRef(f);return ae.current=f,d.useEffect(()=>{var q;const{current:fe}=L;if(!fe)return;if(fe.duration){(q=ae.current)==null||q.call(ae,fe.src,fe.duration);return}const pe=()=>{var R;(R=ae.current)==null||R.call(ae,fe.src,fe.duration)};return fe.addEventListener("loadedmetadata",pe),()=>{fe.removeEventListener("loadedmetadata",pe)}},[L,c]),n?null:u.jsx("audio",{ref:L,preload:"metadata",crossOrigin:D,...se})},fb=d.forwardRef(JT),QT=(e,t)=>{const n=d.useRef(null),{volume:r,playbackRate:o,allowAmplificationDuringRender:i,onDuration:s,toneFrequency:a,_remotionInternalNeedsDurationCalculation:l,_remotionInternalNativeLoopPassed:c,acceptableTimeShiftInSeconds:f,name:p,onNativeError:m,delayRenderRetries:g,delayRenderTimeoutInMilliseconds:w,loopVolumeCurveBehavior:x,pauseWhenBuffering:k,audioStreamIndex:h,preservePitch:y,...v}=e,b=xo(),S=os(x??"repeat"),E=Nt(),C=d.useContext(Rt),{registerRenderAsset:I,unregisterRenderAsset:j}=d.useContext(Go),{delayRender:F,continueRender:N}=or(),K=d.useMemo(()=>`audio-${Yo(e.src??"")}-${C==null?void 0:C.relativeFrom}-${C==null?void 0:C.cumulatedFrom}-${C==null?void 0:C.durationInFrames}`,[e.src,C==null?void 0:C.relativeFrom,C==null?void 0:C.cumulatedFrom,C==null?void 0:C.durationInFrames]),M=qo({volume:r,frame:S,mediaVolume:1});ss(M),d.useImperativeHandle(t,()=>n.current,[]),d.useEffect(()=>{if(!e.src)throw new Error("No src passed");if(window.remotion_audioEnabled&&!e.muted&&!(M<=0))return I({type:"audio",src:vr(e.src),id:K,frame:b,volume:M,mediaFrame:E,playbackRate:e.playbackRate??1,toneFrequency:a??1,audioStartFrame:Math.max(0,-((C==null?void 0:C.cumulatedNegativeFrom)??0)),audioStreamIndex:h??0}),()=>j(K)},[e.muted,e.src,I,b,K,j,M,S,E,o,e.playbackRate,a,C==null?void 0:C.cumulatedNegativeFrom,h]);const{src:$}=e,U=t||l;return d.useLayoutEffect(()=>{var W,B;if(((B=(W=window.process)==null?void 0:W.env)==null?void 0:B.NODE_ENV)==="test"||!U)return;const Y=F("Loading <Html5Audio> duration with src="+$,{retries:g??void 0,timeoutInMilliseconds:w??void 0}),{current:A}=n,T=()=>{A!=null&&A.duration&&s(A.src,A.duration),N(Y)};return A!=null&&A.duration?(s(A.src,A.duration),N(Y)):A==null||A.addEventListener("loadedmetadata",T,{once:!0}),()=>{A==null||A.removeEventListener("loadedmetadata",T),N(Y)}},[$,s,U,g,w,N,F]),U?u.jsx("audio",{ref:n,...v,onError:m}):null},ej=d.forwardRef(QT),tj=(e,t)=>{const n=d.useContext(wc),r=e,{startFrom:o,endAt:i,trimBefore:s,trimAfter:a,name:l,stack:c,pauseWhenBuffering:f,showInTimeline:p,onError:m,freeze:g,...w}=r,{loop:x,freeze:k,...h}=r,{fps:y}=pt(),v=vt(),b=Ra(f);if(v.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 g<"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(Th);if(typeof e.src!="string")throw new TypeError(`The \`<Html5Audio>\` tag requires a string for \`src\`, but got ${JSON.stringify(e.src)} instead.`);const C=Xo(e.src),I=d.useCallback(M=>{console.log(M.currentTarget.error);const $=`Could not play audio with src ${C}: ${M.currentTarget.error}. See https://remotion.dev/docs/media-playback-error for help.`;if(x){if(m){m(new Error($));return}pa(new Error($))}else m==null||m(new Error($)),console.warn($)},[x,m,C]),j=d.useCallback((M,$)=>{E({type:"got-duration",durationInSeconds:$,src:M})},[E]),F=S[vr(C)]??S[vr(e.src)];yc({startFrom:o,endAt:i,trimBefore:s,trimAfter:a});const{trimBeforeValue:N,trimAfterValue:K}=vc({startFrom:o,endAt:i,trimBefore:s,trimAfter:a});if(x&&F!==void 0){if(!Number.isFinite(F))return u.jsx(Zs,{...h,ref:t,_remotionInternalNativeLoopPassed:!0});const M=F*y;return u.jsx(hc,{layout:"none",durationInFrames:pc({trimAfter:K,mediaDurationInFrames:M,playbackRate:e.playbackRate??1,trimBefore:N}),children:u.jsx(Zs,{...h,ref:t,_remotionInternalNativeLoopPassed:!0})})}return typeof N<"u"||typeof K<"u"?u.jsx(Ft,{layout:"none",from:0-(N??0),showInTimeline:!1,durationInFrames:K,name:l,children:u.jsx(Zs,{_remotionInternalNeedsDurationCalculation:!!x,pauseWhenBuffering:b,...w,ref:t})}):(gc({playbackRate:e.playbackRate,preservePitch:e.preservePitch,volume:e.volume},"Html5Audio"),v.isRendering?u.jsx(ej,{onDuration:j,...e,ref:t,onNativeError:I,_remotionInternalNeedsDurationCalculation:!!x}):u.jsx(fb,{_remotionInternalNativeLoopPassed:e._remotionInternalNativeLoopPassed??!1,_remotionInternalStack:c??null,shouldPreMountAudioTags:n!==null&&n.numberOfAudioTags>0,...e,ref:t,onNativeError:I,onDuration:j,pauseWhenBuffering:b,_remotionInternalNeedsDurationCalculation:!!x,showInTimeline:p??!0}))},Zs=d.forwardRef(tj);un(Zs);var nj=Zs,rj=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},oj={...Ar,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},...xr,...So,...bo},ij=({color:e,width:t,height:n,effects:r=[],className:o,style:i,pixelDensity:s,overrideId:a,reference:l})=>{const{delayRender:c,continueRender:f,cancelRender:p}=or(),m=rj(s),g=Math.ceil(t*m),w=Math.ceil(n*m),[x,k]=d.useState(null),h=Ma({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},[]),v=Aa(),b=d.useCallback(E=>{k(E),typeof l=="function"?l(E):l&&(l.current=E)},[l]);d.useEffect(()=>{if(!x||!y)return;const E=c("Solid effect chain");if(!v)return f(E),()=>{f(E)};const C=y.getContext("2d",{colorSpace:"srgb"});if(!C){p(new Error("Failed to acquire 2D context for <Solid> source"));return}return C.clearRect(0,0,1,1),e!==void 0&&(C.fillStyle=e,C.fillRect(0,0,1,1)),_a({state:v.get(g,w),source:y,effects:h,output:x,width:g,height:w}).then(I=>{I&&f(E)}).catch(I=>{p(I)}),()=>{f(E)}},[e,x,y,v,g,w,c,f,p,h]);const S=d.useMemo(()=>({width:t,height:n,...i??{}}),[n,i,t]);return u.jsx("canvas",{ref:b,width:g,height:w,className:o,style:S})},sj=d.forwardRef(({effects:e=[],controls:t,color:n,height:r,width:o,className:i,durationInFrames:s,style:a,name:l,from:c,trimBefore:f,freeze:p,hidden:m,showInTimeline:g,pixelDensity:w,...x},k)=>{const h=$a(e),y=d.useRef(null);return d.useImperativeHandle(k,()=>y.current,[]),u.jsx(Ft,{layout:"none",from:c,trimBefore:f,freeze:p,hidden:m,showInTimeline:g,controls:t,_remotionInternalEffects:h,durationInFrames:s,name:l??"<Solid>",outlineRef:y,_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/solid",...x,children:u.jsx(ij,{reference:y,overrideId:(t==null?void 0:t.overrideId)??null,color:n,height:r,width:o,className:i,style:a,effects:e,pixelDensity:w})})}),pb=Nr({Component:sj,componentName:"<Solid>",componentIdentity:"dev.remotion.remotion.Solid",schema:oj,supportsEffects:!0});pb.displayName="Solid";un(pb);var hl=null,hb=()=>{if(hl!==null)return hl;if(typeof document>"u")return!1;const e=document.createElement("canvas"),t=e.getContext("2d");return hl=typeof(t==null?void 0:t.drawElementImage)=="function"&&typeof e.requestPaint=="function"&&typeof e.captureElementImage=="function"&&"transferControlToOffscreen"in HTMLCanvasElement.prototype,hl},aj="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 lj(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 uj(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 ml=e=>e instanceof DOMException&&e.name==="InvalidStateError",sy="HtmlInCanvas: Expected the element to be inside the viewport during rendering, but Chrome had no cached paint record for it.",ay=({target:e,width:t,height:n})=>{e.width!==t&&(e.width=t),e.height!==n&&(e.height=n)},cj=({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()},ly=d.createContext(null),mb=d.forwardRef(({width:e,height:t,effects:n,children:r,onPaint:o,onInit:i,pixelDensity:s,controls:a,style:l},c)=>{const f=d.useContext(ly);lj(e,t);const p=uj(s),m=Math.ceil(e*p),g=Math.ceil(t*p),{delayRender:w,continueRender:x,cancelRender:k}=or(),{isClientSideRendering:h,isRendering:y}=vt(),v=!y||h,b=o===void 0&&i===void 0;hb()||k(new Error(aj));const S=d.useRef(null),E=d.useRef(null),C=d.useRef(null),I=`${e}x${t}@${p}-${b?"direct":"offscreen"}`,j=d.useCallback(L=>{S.current=L,typeof c=="function"?c(L):c&&(c.current=L)},[c]),F=Aa(),N=Ma({effects:n,overrideId:(a==null?void 0:a.overrideId)??null}),K=d.useRef(N);K.current=N;const M=d.useRef(o);M.current=o;const $=d.useRef(i);$.current=i;const U=d.useRef(!1),Y=d.useRef(null),A=d.useRef(!1),T=d.useRef(f);T.current=f;const W=d.useCallback(async()=>{var ue;const L=C.current;if(!L)throw new Error("Canvas or scene element not found");const V=E.current;if(!V)throw new Error("HtmlInCanvas: paint target is not ready because the canvas is remounting");ay({target:V,width:m,height:g});try{const oe=S.current;if(!oe)throw new Error("Canvas not found");const J=w("onPaint");if(!U.current){const fe=$.current;if(!fe)U.current=!0;else{let pe;try{pe=oe.captureElementImage(L)}catch(q){if(ml(q)&&v){x(J);return}throw ml(q)?new Error(sy):q}U.current=!0;try{if(V instanceof HTMLCanvasElement)throw new Error("HtmlInCanvas: onInit requires an OffscreenCanvas paint target");const q=await fe({canvas:V,element:L,elementImage:pe,pixelDensity:p});if(typeof q!="function")throw new Error("HtmlInCanvas: when `onInit` is provided, it must return a cleanup function, or a Promise that resolves to one.");A.current?q():Y.current=q}finally{pe.close()}}}let ae;try{ae=oe.captureElementImage(L)}catch(fe){if(ml(fe)&&v){x(J);return}throw ml(fe)?new Error(sy):fe}try{const fe=M.current;if(fe){if(V instanceof HTMLCanvasElement)throw new Error("HtmlInCanvas: onPaint requires an OffscreenCanvas paint target");const pe=fe({canvas:V,element:L,elementImage:ae,pixelDensity:p});pe&&await pe}else cj({canvas:V,element:L,elementImage:ae,pixelDensity:p});await _a({state:F.get(m,g),source:V,effects:K.current,output:V,width:m,height:g})}finally{ae.close()}(ue=T.current)==null||ue.requestParentPaint(),x(J)}catch(oe){k(oe)}},[g,m,F,x,k,w,p,v]);d.useLayoutEffect(()=>{const L=S.current;if(!L)throw new Error("Canvas not found");L.layoutSubtree=!0;const V=b?L:L.transferControlToOffscreen();return E.current=V,ay({target:V,width:m,height:g}),U.current=!1,A.current=!1,L.addEventListener("paint",W),()=>{var ue;L.removeEventListener("paint",W),E.current=null,U.current=!1,A.current=!0,(ue=Y.current)==null||ue.call(Y),Y.current=null}},[W,k,m,g,b]);const B=d.useRef(!1);d.useLayoutEffect(()=>{var V;if(!B.current){B.current=!0;return}const L=S.current;L&&((V=L.requestPaint)==null||V.call(L))},[o,N]),d.useLayoutEffect(()=>{const L=S.current;if(!L)return;const V=w("waiting for first paint after canvas resize");return L.addEventListener("paint",()=>{x(V)},{once:!0}),()=>{x(V)}},[e,t,x,w,I]);const D=d.useMemo(()=>({width:e,height:t}),[e,t]),se=d.useMemo(()=>({width:e,height:t,...l??{}}),[t,l,e]),ie=d.useMemo(()=>({requestParentPaint:()=>{var L,V;(V=(L=S.current)==null?void 0:L.requestPaint)==null||V.call(L)}}),[]);return u.jsx(ly.Provider,{value:ie,children:u.jsx("canvas",{ref:j,width:m,height:g,style:se,children:u.jsx("div",{ref:C,style:D,children:r})},I)})});mb.displayName="HtmlInCanvasContent";var gb=d.forwardRef(({width:e,height:t,effects:n=[],children:r,onPaint:o,onInit:i,pixelDensity:s,controls:a,style:l,durationInFrames:c,name:f,...p},m)=>{const g=$a(n),w=d.useRef(null),x=d.useCallback(k=>{w.current=k,typeof m=="function"?m(k):m&&(m.current=k)},[m]);return u.jsx(Ft,{durationInFrames:c,name:f??"<HtmlInCanvas>",_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/remotion/html-in-canvas",controls:a,_remotionInternalEffects:g,outlineRef:w,layout:"none",...p,children:u.jsx(mb,{ref:x,width:e,height:t,effects:n,onPaint:o,onInit:i,pixelDensity:s,controls:a,style:l,children:r})})});gb.displayName="HtmlInCanvas";var dj={...Ar,pixelDensity:{type:"number",min:1,max:3,step:.1,default:1,description:"Pixel density",hiddenFromList:!1},...xr,...So,...bo},fj=Nr({Component:gb,componentName:"<HtmlInCanvas>",componentIdentity:"dev.remotion.remotion.HtmlInCanvas",schema:dj,supportsEffects:!0}),yb=Object.assign(fj,{isSupported:hb});yb.displayName="HtmlInCanvas";un(yb);function jr(e){return e.startsWith("data:")&&e.length>100?e.slice(0,60)+"...["+e.length+" chars total]":e}var pj={...Ar,...es,fit:{type:"enum",default:"fill",description:"Fit",variants:{fill:{},contain:{},cover:{}}},...xr,...So,...bo},hj=()=>{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},mj=({src:e,signal:t})=>new Promise((n,r)=>{const o=new Image;let i=!1;function s(){o.onload=null,o.onerror=null}function a(c){i||(i=!0,s(),c())}function l(){a(()=>r(hj()))}if(o.onload=()=>{var c;Promise.resolve((c=o.decode)==null?void 0:c.call(o)).catch(()=>{}).then(()=>{const f=o.naturalWidth||o.width,p=o.naturalHeight||o.height;if(f<=0||p<=0){a(()=>r(new Error(`Could not determine dimensions for <CanvasImage> with src="${jr(e)}"`)));return}a(()=>n({element:o,width:f,height:p}))})},o.onerror=()=>{a(()=>r(new Error(`Could not load <CanvasImage> with src="${jr(e)}"`)))},t.addEventListener("abort",l,{once:!0}),t.aborted){l();return}o.crossOrigin="anonymous",o.src=e});function gj(e){return 1e3*2**(e-1)}var yj=({onFrame:e})=>{if(typeof requestAnimationFrame>"u")return e(),()=>{};const t=requestAnimationFrame(e);return()=>cancelAnimationFrame(t)},vb=d.forwardRef(({src:e,width:t,height:n,fit:r="fill",effects:o,controls:i,onError:s,className:a,style:l,id:c,pauseWhenLoading:f,maxRetries:p=2,delayRenderRetries:m,delayRenderTimeoutInMilliseconds:g,refForOutline:w,...x},k)=>{const{delayRender:h,continueRender:y,cancelRender:v}=or(),{delayPlayback:b}=bc(),[S,E]=d.useState(null),[C,I]=d.useState(null),j=Xo(e),F=Aa(),N=Ma({effects:o,overrideId:(i==null?void 0:i.overrideId)??null}),K=d.useContext(Rt),M=d.useRef(null),[$,U]=d.useState(!1),Y=!!(K!=null&&K.premounting),A=!!(K!=null&&K.postmounting),T=d.useCallback(({markAsReady:D})=>{const se=M.current;!se||se.continued||(se.continued=!0,D&&U(!1),y(se.handle),M.current=null)},[y]),W=d.useMemo(()=>typeof document>"u"?null:document.createElement("canvas"),[]),B=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||!$||Y||A))return b().unblock},[b,$,A,Y,f]),d.useLayoutEffect(()=>{const D=h(`Rendering <CanvasImage> with src="${jr(j)}"`,{retries:m??void 0,timeoutInMilliseconds:g??void 0}),se=new AbortController;let ie=!1,L=0,V=null;I(null),U(!0),M.current={handle:D,continued:!1};const ue=()=>{mj({src:j,signal:se.signal}).then(oe=>{ie||I(oe)}).catch(oe=>{if(oe.name==="AbortError"){T({markAsReady:!1});return}if(L++,L<=p){const J=gj(L);console.warn(`Could not load <CanvasImage> with src="${jr(j)}", retrying in ${J}ms`),V=setTimeout(()=>{ie||ue()},J)}else s?(s(oe),T({markAsReady:!0})):v(oe)})};return ue(),()=>{ie=!0,V!==null&&clearTimeout(V),se.abort(),T({markAsReady:!1})}},[j,v,T,h,m,g,p,s]),d.useLayoutEffect(()=>{if(!C||!S||!W)return;const D=h(`Applying effects to <CanvasImage> with src="${jr(j)}"`);let se=!1,ie=!1,L=()=>{};const V=()=>{ie||(ie=!0,y(D))},ue=t??C.width,oe=n??C.height,J=W.getContext("2d",{colorSpace:"srgb"});return J?(W.width=ue,W.height=oe,S.width=ue,S.height=oe,J.clearRect(0,0,ue,oe),J.drawImage(C.element,...W1(r,{width:C.width,height:C.height},{width:ue,height:oe})),_a({state:F.get(ue,oe),source:W,effects:N,output:S,width:ue,height:oe}).then(ae=>{ae&&!se&&(L=yj({onFrame:()=>{se||(V(),T({markAsReady:!0}))}}))}).catch(ae=>{se||(s?(s(ae),V(),T({markAsReady:!0})):v(ae))}),()=>{se=!0,L(),V()}):(v(new Error("Could not get 2D context for <CanvasImage> source canvas")),V(),()=>{V()})},[j,v,F,y,T,h,r,n,C,N,s,S,W,t]),u.jsx("canvas",{...x,ref:B,width:t,height:n,className:a,style:l,id:c})});vb.displayName="CanvasImageContent";var vj=d.forwardRef(({src:e,width:t,height:n,fit:r,effects:o=[],className:i,style:s,id:a,onError:l,pauseWhenLoading:c,maxRetries:f,delayRenderRetries:p,delayRenderTimeoutInMilliseconds:m,durationInFrames:g,from:w,trimBefore:x,freeze:k,premountFor:h,postmountFor:y,styleWhilePremounted:v,styleWhilePostmounted:b,hidden:S,name:E,showInTimeline:C,stack:I,controls:j,_remotionInternalDocumentationLink:F,outlineRef:N,...K},M)=>{if(!e)throw new Error('No "src" prop was passed to <CanvasImage>.');const $=$a(o),U=d.useRef(null);d.useImperativeHandle(M,()=>U.current,[]);const{effectivePostmountFor:Y,effectivePremountFor:A,freezeFrame:T,isPremountingOrPostmounting:W,postmountingActive:B,premountingActive:D,premountingStyle:se}=Fa({from:w??0,durationInFrames:g??1/0,premountFor:h??null,postmountFor:y??null,style:s??null,styleWhilePremounted:v??null,styleWhilePostmounted:b??null,hideWhilePremounted:"display-none"});return u.jsx(ja,{frame:T,active:W,children:u.jsx(Ft,{layout:"none",from:w??0,trimBefore:x,durationInFrames:g??1/0,freeze:k,hidden:S,showInTimeline:C??!0,name:E??"<CanvasImage>",_remotionInternalDocumentationLink:F??"https://www.remotion.dev/docs/canvasimage",controls:j,_remotionInternalEffects:$,_remotionInternalIsMedia:{type:"image",src:e},_remotionInternalStack:I,_remotionInternalPremountDisplay:A||null,_remotionInternalPostmountDisplay:Y||null,_remotionInternalIsPremounting:D,_remotionInternalIsPostmounting:B,outlineRef:N??U,children:u.jsx(vb,{ref:U,src:e,width:t,height:n,fit:r,effects:o,controls:j,className:i,style:se??void 0,id:a,onError:l,pauseWhenLoading:c,maxRetries:f,delayRenderRetries:p,delayRenderTimeoutInMilliseconds:m,refForOutline:N??null,...K})})})}),Ah=Nr({Component:vj,componentName:"<CanvasImage>",componentIdentity:"dev.remotion.remotion.CanvasImage",schema:pj,supportsEffects:!0});Ah.displayName="CanvasImage";un(Ah);var wj=({onLoad:e,onError:t,delayRenderRetries:n,delayRenderTimeoutInMilliseconds:r,...o},i)=>{const{delayRender:s,continueRender:a}=or(),[l]=d.useState(()=>s(`Loading <IFrame> with source ${o.src}`,{retries:n??void 0,timeoutInMilliseconds:r??void 0})),c=d.useCallback(p=>{a(l),e==null||e(p)},[l,e,a]),f=d.useCallback(p=>{a(l),t?t(p):console.error("Error loading iframe:",p,"Handle the event using the onError() prop to make this message disappear.")},[l,t,a]);return u.jsx("iframe",{referrerPolicy:"strict-origin-when-cross-origin",...o,ref:i,onError:f,onLoad:c})};d.forwardRef(wj);function xj(e){return 1e3*2**(e-1)}var bj=({onError:e,maxRetries:t=2,src:n,pauseWhenLoading:r,delayRenderRetries:o,delayRenderTimeoutInMilliseconds:i,onImageFrame:s,crossOrigin:a,decoding:l,ref:c,refForOutline:f,...p})=>{const m=d.useRef(null),g=d.useRef({}),{delayPlayback:w}=bc(),x=d.useContext(Rt),[k,h]=d.useState(!1),y=d.useCallback($=>{m.current=$,f.current=$,typeof c=="function"?c($):c&&(c.current=$)},[c,f]),v=Xo(n),b=d.useCallback($=>{if(!m.current)return;const U=m.current.src;setTimeout(()=>{var A;if(!m.current)return;const Y=(A=m.current)==null?void 0:A.src;Y===U&&(m.current.removeAttribute("src"),m.current.setAttribute("src",Y))},$)},[]),{delayRender:S,continueRender:E,cancelRender:C}=or(),I=!!(x!=null&&x.premounting),j=!!(x!=null&&x.postmounting),F=d.useCallback($=>{var U,Y,A,T,W,B,D;if(g.current){if(g.current[(U=m.current)==null?void 0:U.src]=(g.current[(Y=m.current)==null?void 0:Y.src]??0)+1,e&&(g.current[(A=m.current)==null?void 0:A.src]??0)>t){e($);return}if((g.current[(T=m.current)==null?void 0:T.src]??0)<=t){const se=xj(g.current[(W=m.current)==null?void 0:W.src]??0);console.warn(`Could not load image with source ${jr((B=m.current)==null?void 0:B.src)}, retrying again in ${se}ms`),b(se);return}try{C("Error loading image with src: "+jr((D=m.current)==null?void 0:D.src))}catch{}}},[C,t,e,b]);typeof window<"u"&&(d.useLayoutEffect(()=>{if(!(!r||!k||I||j))return w().unblock},[w,k,j,I,r]),d.useLayoutEffect(()=>{var T,W;if(((W=(T=window.process)==null?void 0:T.env)==null?void 0:W.NODE_ENV)==="test"){m.current&&(m.current.src=v);return}const{current:$}=m;if(!$)return;h(!0);const U=S("Loading <Img> with src="+jr(v),{retries:o??void 0,timeoutInMilliseconds:i??void 0});let Y=!1;const A=()=>{var B,D,se;if(Y){E(U);return}(g.current[(B=m.current)==null?void 0:B.src]??0)>0&&(delete g.current[(D=m.current)==null?void 0:D.src],console.info(`Retry successful - ${jr((se=m.current)==null?void 0:se.src)} is now loaded`)),$&&(s==null||s($)),h(!1),E(U)};if(!m.current){A();return}return $.src=v,$.decode().then(A).catch(B=>{console.warn(B),$.complete&&$.naturalWidth>0&&$.naturalHeight>0?A():$.addEventListener("load",A)}),()=>{Y=!0,$.removeEventListener("load",A),E(U)}},[v,o,i,s,E,S]));const{isClientSideRendering:N,isRendering:K}=vt(),M=jh({crossOrigin:a,requestsVideoFrame:!1,isClientSideRendering:N});return u.jsx("img",{...p,ref:y,crossOrigin:M,onError:F,decoding:K?"sync":l})},Sj=({hidden:e,name:t,stack:n,showInTimeline:r,src:o,from:i,trimBefore:s,durationInFrames:a,freeze:l,premountFor:c,postmountFor:f,style:p,styleWhilePremounted:m,styleWhilePostmounted:g,controls:w,outlineRef:x,...k})=>{if(!o)throw new Error('No "src" prop was passed to <Img>.');const{effectivePostmountFor:h,effectivePremountFor:y,freezeFrame:v,isPremountingOrPostmounting:b,postmountingActive:S,premountingActive:E,premountingStyle:C}=Fa({from:i??0,durationInFrames:a??1/0,premountFor:c??null,postmountFor:f??null,style:p??null,styleWhilePremounted:m??null,styleWhilePostmounted:g??null,hideWhilePremounted:"display-none"});return u.jsx(ja,{frame:v,active:b,children:u.jsx(Ft,{layout:"none",from:i??0,trimBefore:s,durationInFrames:a??1/0,freeze:l,_remotionInternalStack:n,_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/img",_remotionInternalIsMedia:{type:"image",src:o},_remotionInternalPremountDisplay:y||null,_remotionInternalPostmountDisplay:h||null,_remotionInternalIsPremounting:E,_remotionInternalIsPostmounting:S,name:t??"<Img>",controls:w,showInTimeline:r??!0,hidden:e,outlineRef:x,children:u.jsx(bj,{src:o,refForOutline:x,style:C??void 0,...k})})})},kj=Ah,Ej={src:{type:"asset",default:void 0,description:"Source",keyframable:!1},...Ar,...es,...xr,...So,...bo},Cj=new Set(["alt","crossOrigin","decoding","fetchPriority","loading","onError","onImageFrame","onLoad","sizes","srcSet","useMap"]),Ij=e=>Object.keys(e).filter(t=>e[t]!==void 0&&Cj.has(t)),Tj=e=>e.map(t=>`"${t}"`).join(", "),jj=({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=Ij(e);if(t!=null&&o.unshift("ref"),o.length!==0)throw new Error(`The ${Tj(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"}.`)},Rj=e=>{const t=e==null?void 0:e.objectFit;if(t==="fill"||t==="contain"||t==="cover")return t},Fj=({effects:e=[],ref:t,hidden:n,name:r,stack:o,showInTimeline:i,src:s,from:a,trimBefore:l,durationInFrames:c,freeze:f,premountFor:p,postmountFor:m,styleWhilePremounted:g,styleWhilePostmounted:w,controls:x,width:k,height:h,className:y,style:v,id:b,pauseWhenLoading:S,maxRetries:E,delayRenderRetries:C,delayRenderTimeoutInMilliseconds:I,...j})=>{const F=d.useRef(null),N=Ra(S);if(e.length===0)return u.jsx(Sj,{...j,ref:t,hidden:n,name:r,stack:o,showInTimeline:i,src:s,from:a,trimBefore:l,durationInFrames:c,freeze:f,premountFor:p,postmountFor:m,styleWhilePremounted:g,styleWhilePostmounted:w,controls:x,width:k,height:h,className:y,style:v,id:b,pauseWhenLoading:N,maxRetries:E,delayRenderRetries:C,delayRenderTimeoutInMilliseconds:I,outlineRef:F});if(!s)throw new Error('No "src" prop was passed to <Img>.');jj({props:j,ref:t,width:k,height:h});const K=typeof k=="number"?k:void 0,M=typeof h=="number"?h:void 0,$=j,U=Rj(v)??"fill";return u.jsx(kj,{src:s,width:K,height:M,fit:U,effects:e,className:y,style:v,id:b,pauseWhenLoading:N,maxRetries:E,delayRenderRetries:C,delayRenderTimeoutInMilliseconds:I,from:a,trimBefore:l,durationInFrames:c,freeze:f,premountFor:p,postmountFor:m,styleWhilePremounted:g,styleWhilePostmounted:w,hidden:n,name:r??"<Img>",showInTimeline:i,stack:o,_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/img",controls:x,outlineRef:F,...$})},Sc=Nr({Component:Fj,componentName:"<Img>",componentIdentity:"dev.remotion.remotion.Img",schema:Ej,supportsEffects:!0});un(Sc);var Pj=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}`)},wb=({packageName:e,componentName:t})=>`${Pj(e)}.${t}`,Nh={...Ar,...xr},$j={...Nh,...So},xb={...$j,...bo},Mj={...xb,...ic,...f1},_j={...Nh,...ic,...f1},Aj=(e,t)=>{typeof e=="function"?e(t):e&&(e.current=t)},bb=e=>{const t=Nr(e);return un(t),t},ju=(e,t,n)=>{const r=d.forwardRef((i,s)=>{const{durationInFrames:a,from:l,trimBefore:c,freeze:f,hidden:p,name:m,showInTimeline:g,stack:w,controls:x,...k}=i,h=d.useRef(null),y=d.useCallback(v=>{h.current=v,Aj(s,v)},[s]);return u.jsx(Ft,{layout:"none",from:l??0,trimBefore:c,durationInFrames:a??1/0,freeze:f,hidden:p,name:m??t,showInTimeline:g??!0,controls:x,_remotionInternalStack:w,_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/interactive",outlineRef:h,children:me.createElement(e,{...k,ref:y})})});r.displayName=t;const o=bb({Component:r,componentName:t,componentIdentity:wb({packageName:"remotion",componentName:t.slice(1,-1)}),schema:n,supportsEffects:!1});return o.displayName=t,o},Ve=(e,t)=>ju(e,t,Mj),ni=(e,t)=>ju(e,t,Nh),Zr={baseSchema:Ar,transformSchema:xr,textSchema:ic,backgroundSchema:So,borderSchema:bo,premountSchema:es,sequenceSchema:Hi,withSchema:bb,_internalMakeRemotionComponentIdentity:wb,A:Ve("a","<Interactive.A>"),Article:Ve("article","<Interactive.Article>"),Aside:Ve("aside","<Interactive.Aside>"),Button:Ve("button","<Interactive.Button>"),Circle:ni("circle","<Interactive.Circle>"),Code:Ve("code","<Interactive.Code>"),Div:Ve("div","<Interactive.Div>"),Ellipse:ni("ellipse","<Interactive.Ellipse>"),Em:Ve("em","<Interactive.Em>"),Footer:Ve("footer","<Interactive.Footer>"),G:ni("g","<Interactive.G>"),H1:Ve("h1","<Interactive.H1>"),H2:Ve("h2","<Interactive.H2>"),H3:Ve("h3","<Interactive.H3>"),H4:Ve("h4","<Interactive.H4>"),H5:Ve("h5","<Interactive.H5>"),H6:Ve("h6","<Interactive.H6>"),Header:Ve("header","<Interactive.Header>"),Label:Ve("label","<Interactive.Label>"),Li:Ve("li","<Interactive.Li>"),Line:ni("line","<Interactive.Line>"),Main:Ve("main","<Interactive.Main>"),Nav:Ve("nav","<Interactive.Nav>"),Ol:Ve("ol","<Interactive.Ol>"),P:Ve("p","<Interactive.P>"),Path:ni("path","<Interactive.Path>"),Pre:Ve("pre","<Interactive.Pre>"),Rect:ni("rect","<Interactive.Rect>"),Section:Ve("section","<Interactive.Section>"),Small:Ve("small","<Interactive.Small>"),Span:Ve("span","<Interactive.Span>"),Strong:Ve("strong","<Interactive.Strong>"),Svg:ju("svg","<Interactive.Svg>",xb),Text:ju("text","<Interactive.Text>",_j),Ul:Ve("ul","<Interactive.Ul>")},Nj=async({resolvedSrc:e,signal:t,requestInit:n,contentType:r})=>{const{decoder:o,selectedTrack:i}=await Z1({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()}},Sb=me.createRef(),Lj=({children:e,onlyRenderComposition:t,currentCompositionMetadata:n,initialCompositions:r,initialCanvasContent:o})=>{const[i,s]=d.useState([]),[a,l]=d.useState(o),[c,f]=d.useState(r),p=d.useRef(c),m=d.useCallback(v=>{f(b=>{const S=v(b);return p.current=S,S})},[]),g=d.useCallback(v=>{m(b=>{if(b.find(S=>S.id===v.id))throw new Error(`Multiple composition with id ${v.id} are registered.`);return[...b,v]})},[m]),w=d.useCallback(v=>{f(b=>b.filter(S=>S.id!==v))},[]),x=d.useCallback((v,b,S,E)=>{s(C=>[...C,{name:v,parent:b,nonce:S,stack:E}])},[]),k=d.useCallback((v,b)=>{s(S=>S.filter(E=>!(E.name===v&&E.parent===b)))},[]);d.useImperativeHandle(Sb,()=>({getCompositions:()=>p.current}),[]);const h=d.useMemo(()=>({registerComposition:g,unregisterComposition:w,registerFolder:x,unregisterFolder:k,setCanvasContent:l,onlyRenderComposition:t}),[g,x,w,k,t]),y=d.useMemo(()=>({compositions:c,folders:i,currentCompositionMetadata:n,canvasContent:a}),[c,i,n,a]);return u.jsx(Xi.Provider,{value:y,children:u.jsx(Ea.Provider,{value:h,children:e})})},kb={};zx(kb,{makeDefaultPreviewCSS:()=>Dj,injectCSS:()=>Oj,OBJECTFIT_CONTAIN_CLASS_NAME:()=>ha});var gl={},Oj=e=>{if(typeof document>"u")return()=>{};if(gl[e])return()=>{};const t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");return n.appendChild(document.createTextNode(e)),t.prepend(n),gl[e]=n,()=>{const r=gl[e];r&&(r.parentNode&&r.parentNode.removeChild(r),delete gl[e])}},ha="__remotion_objectfitcontain",Dj=(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} .${ha} {
|
|
66
|
-
object-fit: contain;
|
|
67
|
-
}
|
|
68
|
-
`:`
|
|
69
|
-
* {
|
|
70
|
-
box-sizing: border-box;
|
|
71
|
-
}
|
|
72
|
-
body {
|
|
73
|
-
margin: 0;
|
|
74
|
-
background-color: ${t};
|
|
75
|
-
}
|
|
76
|
-
.${ha} {
|
|
77
|
-
object-fit: contain;
|
|
78
|
-
}
|
|
79
|
-
`,Eb="__remotion-studio-container",zj=()=>document.getElementById(Eb),Bj=me.createContext(null),Wj=null,Cd=[],Vj=()=>Wj,Hj=e=>(Cd.push(e),()=>{Cd=Cd.filter(t=>t!==e)}),Lh=d.createContext(null),Uj=()=>{const e=d.useContext(Lh);return!e||e.videoEnabled===null?window.remotion_videoEnabled:e.videoEnabled},Zj=()=>{const e=d.useContext(Lh);return!e||e.audioEnabled===null?window.remotion_audioEnabled:e.audioEnabled},Kj=({children:e,videoEnabled:t,audioEnabled:n})=>{const r=d.useMemo(()=>({videoEnabled:t,audioEnabled:n}),[t,n]);return u.jsx(Lh.Provider,{value:r,children:e})},Yj=({children:e,numberOfAudioTags:t,logLevel:n,audioLatencyHint:r,previewSampleRate:o,videoEnabled:i,audioEnabled:s,frameState:a})=>{const l=d.useMemo(()=>{let f=0;return{getNonce:()=>f++}},[]),c=d.useMemo(()=>({logLevel:n,mountTime:Date.now()}),[n]);return u.jsx(Ko.Provider,{value:c,children:u.jsx(Ca.Provider,{value:l,children:u.jsx(V2,{frameState:a,children:u.jsx(Kj,{videoEnabled:i,audioEnabled:s,children:u.jsx(Kx,{children:u.jsx(q1,{children:u.jsx(G2,{children:u.jsx(Q1,{children:u.jsx(sb,{children:u.jsx(eb,{audioLatencyHint:r,audioEnabled:s,previewSampleRate:o,children:u.jsx(tb,{numberOfAudioTags:t,children:e})})})})})})})})})})})},uy=["h264","h265","vp8","vp9","av1","mp3","aac","wav","prores","h264-mkv","h264-ts","gif"];function Gj(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(!uy.includes(e))throw new Error(`The "${n}" prop ${t} must be one of ${uy.join(", ")}, but you passed ${e}.`)}}var Xj=({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;Su(l,"width",e!=null&&e.width?s:a);const c=(e==null?void 0:e.height)??r??void 0;Su(c,"height",e!=null&&e.height?s:a);const f=(e==null?void 0:e.fps)??n??null;ec(f,e!=null&&e.fps?s:a);const p=(e==null?void 0:e.durationInFrames)??i??null;Qu(p,{allowFloats:!1,component:`of the "<Composition />" component with the id "${t}"`});const m=e==null?void 0:e.defaultCodec;Gj(m,s,"defaultCodec");const g=e==null?void 0:e.defaultOutName,w=e==null?void 0:e.defaultVideoImageFormat,x=e==null?void 0:e.defaultPixelFormat,k=e==null?void 0:e.defaultProResProfile,h=e==null?void 0:e.defaultSampleRate;return{width:l,height:c,fps:f,durationInFrames:p,defaultCodec:m,defaultOutName:g,defaultVideoImageFormat:w,defaultPixelFormat:x,defaultProResProfile:k,defaultSampleRate:h}},cy=({calculated:e,compositionDurationInFrames:t,compositionFps:n,compositionHeight:r,compositionId:o,compositionWidth:i,defaultProps:s,originalProps:a})=>{const l=Xj({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:Xf(s??{}),props:Xf((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}}},Cb=({calculateMetadata:e,signal:t,defaultProps:n,inputProps:r,compositionId:o,compositionDurationInFrames:i,compositionFps:s,compositionHeight:a,compositionWidth:l})=>{const c=e?e({defaultProps:n,props:r,abortSignal:t,compositionId:o,isRendering:Vn().isRendering}):null;return c!==null&&typeof c=="object"&&"then"in c?c.then(f=>cy({calculated:f,compositionDurationInFrames:i,compositionFps:s,compositionHeight:a,compositionWidth:l,compositionId:o,defaultProps:n,originalProps:r})):cy({calculated:c,compositionDurationInFrames:i,compositionFps:s,compositionHeight:a,compositionWidth:l,compositionId:o,defaultProps:n,originalProps:r})},Ib=e=>{const t=Cb(e);return typeof t=="object"&&"then"in t?t.then(({videoConfig:n})=>n):t.videoConfig},qj=e=>{try{return{type:"success",result:Cb(e)}}catch(t){return{type:"error",error:t}}},Jj=e=>{try{return{type:"success",result:Ib(e)}}catch(t){return{type:"error",error:t}}},Qj=me.createContext(()=>{}),eR=()=>{if(Vn().isRendering){const e=window.remotion_envVariables;return e?{...JSON.parse(e),NODE_ENV:"production"}:{}}return{NODE_ENV:"production"}},tR=()=>{const e=eR();window.process||(window.process={}),window.process.env||(window.process.env={}),Object.keys(e).forEach(t=>{window.process.env[t]=e[t]})},nR=me.createContext(null),rR=d.createContext({setSize:()=>{},size:{size:"auto",translation:{x:0,y:0}}}),oR=({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)},iR=me.createContext(null),sR=({src:e,transparent:t,currentTime:n,toneMapped:r})=>`http://localhost:${window.remotion_proxyPort}/proxy?src=${encodeURIComponent(vr(e))}&time=${encodeURIComponent(Math.max(0,n))}&transparent=${String(t)}&toneMapped=${String(r)}`,aR=({onError:e,volume:t,playbackRate:n,src:r,muted:o,allowAmplificationDuringRender:i,transparent:s,toneMapped:a,toneFrequency:l,name:c,loopVolumeCurveBehavior:f,delayRenderRetries:p,delayRenderTimeoutInMilliseconds:m,onVideoFrame:g,crossOrigin:w,audioStreamIndex:x,preservePitch:k,...h})=>{const y=xo(),v=Nt(),b=os(f),S=oc(),E=d.useContext(Rt),C=Bo(),{registerRenderAsset:I,unregisterRenderAsset:j}=d.useContext(Go);if(!r)throw new TypeError("No `src` was passed to <OffthreadVideo>.");const F=d.useMemo(()=>`offthreadvideo-${Yo(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=qo({volume:t,frame:b,mediaVolume:1});ss(N),d.useEffect(()=>{if(!r)throw new Error("No src passed");if(window.remotion_audioEnabled&&!o&&!(N<=0))return I({type:"video",src:vr(r),id:F,frame:y,volume:N,mediaFrame:v,playbackRate:n,toneFrequency:l,audioStartFrame:Math.max(0,-((E==null?void 0:E.cumulatedNegativeFrom)??0)),audioStreamIndex:x}),()=>j(F)},[o,r,I,F,j,N,v,y,n,l,E==null?void 0:E.cumulatedNegativeFrom,x]);const K=d.useMemo(()=>lb({frame:v,playbackRate:n||1,startFrom:-C})/S.fps,[v,C,n,S.fps]),M=d.useMemo(()=>sR({src:r,currentTime:K,transparent:s,toneMapped:a}),[a,K,r,s]),[$,U]=d.useState(null),{delayRender:Y,continueRender:A}=or();d.useLayoutEffect(()=>{if(!window.remotion_videoEnabled)return;const D=[];U(null);const se=new AbortController,ie=Y(`Fetching ${M} from server`,{retries:p??void 0,timeoutInMilliseconds:m??void 0});return(async()=>{try{const V=await fetch(M,{signal:se.signal,cache:"no-store"});if(V.status!==200){if(V.status===500){const J=await V.json();if(J.error){const ae=J.error.replace(/^Error: /,"");throw new Error(ae)}}throw new Error(`Server returned status ${V.status} while fetching ${M}`)}const ue=await V.blob(),oe=URL.createObjectURL(ue);D.push(()=>URL.revokeObjectURL(oe)),U({src:oe,handle:ie})}catch(V){if(V.message.includes("aborted")){A(ie);return}if(se.signal.aborted){A(ie);return}V.message.includes("Failed to fetch")&&(V=new Error(`Failed to fetch ${M}. This could be caused by Chrome rejecting the request because the disk space is low. Consider increasing the disk size of your environment.`,{cause:V})),e?e(V):pa(V)}})(),D.push(()=>{se.signal.aborted||se.abort()}),()=>{D.forEach(V=>V())}},[M,p,m,e,A,Y]);const T=d.useCallback(()=>{e?e==null||e(new Error("Failed to load image with src "+$)):pa("Failed to load image with src "+$)},[$,e]),W=d.useMemo(()=>[ha,h.className].filter(qi).join(" "),[h.className]),B=d.useCallback(D=>{g&&g(D)},[g]);return!$||!window.remotion_videoEnabled?null:(A($.handle),u.jsx(Sc,{src:$.src,delayRenderRetries:p,delayRenderTimeoutInMilliseconds:m,onImageFrame:B,...h,onError:T,className:W}))},Tb=({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 Ii extends Error{constructor({message:n,src:r}){super(n);Oe(this,"src");this.name="MediaPlaybackError",this.src=r}}var lR=(e,t)=>{const n=d.useContext(rs);if(!n)throw new Error("SharedAudioContext not found");const r=d.useRef(null),o=d.useMemo(()=>n.audioContext?Rh({audioContext:n.audioContext,ref:r}):null,[n.audioContext]);(me.useInsertionEffect??me.useLayoutEffect)(()=>()=>{requestAnimationFrame(()=>{o==null||o.cleanup()})},[o]);const{volume:s,muted:a,playbackRate:l,preservePitch:c,onlyWarnForMediaSeekingError:f,src:p,onDuration:m,acceptableTimeShift:g,acceptableTimeShiftInSeconds:w,toneFrequency:x,name:k,_remotionInternalNativeLoopPassed:h,_remotionInternalStack:y,style:v,pauseWhenBuffering:b,showInTimeline:S,loopVolumeCurveBehavior:E,onError:C,onAutoPlayError:I,onVideoFrame:j,crossOrigin:F,delayRenderRetries:N,delayRenderTimeoutInMilliseconds:K,allowAmplificationDuringRender:M,useWebAudioApi:$,audioStreamIndex:U,...Y}=e,A=os(E??"repeat"),{fps:T,durationInFrames:W}=pt(),B=d.useContext(Rt),D=wr(),se=Ta(),[ie]=d.useState(()=>String(Math.random()));if(typeof g<"u")throw new Error("acceptableTimeShift has been removed. Use acceptableTimeShiftInSeconds instead.");const[L]=Mh(),[V]=_h(),ue=qo({frame:A,volume:s,mediaVolume:L});ss(ue);const oe=d.useCallback(()=>y??null,[y]);Fh({volume:s,mediaVolume:L,mediaType:"video",src:p,playbackRate:e.playbackRate??1,displayName:k??null,id:ie,getStack:oe,showInTimeline:S,premountDisplay:(B==null?void 0:B.premountDisplay)??null,postmountDisplay:(B==null?void 0:B.postmountDisplay)??null,loopDisplay:void 0,documentationLink:f?"https://www.remotion.dev/docs/offthreadvideo":"https://www.remotion.dev/docs/html5-video",refForOutline:r}),cb({mediaRef:r,src:p,mediaType:"video",playbackRate:e.playbackRate??1,preservePitch:c,onlyWarnForMediaSeekingError:f,acceptableTimeshift:w??null,isPremounting:!!(B!=null&&B.premounting),isPostmounting:!!(B!=null&&B.postmounting),pauseWhenBuffering:b,onAutoPlayError:I??null}),db({id:ie,isPostmounting:!!(B!=null&&B.postmounting),isPremounting:!!(B!=null&&B.premounting),mediaRef:r,mediaType:"video",onAutoPlayError:I??null}),rb({logLevel:D,mediaRef:r,volume:ue,source:o,shouldUseWebAudioApi:$??!1});const J=B?B.relativeFrom:0,ae=B?Math.min(B.durationInFrames,W):W,fe=Xo(p),pe=zT({actualSrc:fe,actualFrom:J,duration:ae,fps:T});d.useImperativeHandle(t,()=>r.current,[]),d.useState(()=>Gt({logLevel:D,message:`Mounting video with source = ${pe}, v=${_s}, user agent=${typeof navigator>"u"?"server":navigator.userAgent}`,tag:"video",mountTime:se})),d.useEffect(()=>{const{current:P}=r;if(!P)return;const z=()=>{var Z;if(P.error){if(console.error("Error occurred in video",P==null?void 0:P.error),C){const O=new Ii({message:`Code ${P.error.code}: ${P.error.message}`,src:p});C(O);return}throw new Ii({message:`The browser threw an error while playing the video ${p}: Code ${P.error.code} - ${(Z=P==null?void 0:P.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:p})}else{if(C){const O=new Ii({message:`The browser threw an error while playing the video ${p}`,src:p});C(O);return}throw new Ii({message:"The browser threw an error while playing the video",src:p})}};return P.addEventListener("error",z,{once:!0}),()=>{P.removeEventListener("error",z)}},[C,p]);const q=d.useRef(m);q.current=m,Tb({ref:r,onVideoFrame:j}),d.useEffect(()=>{var Z;const{current:P}=r;if(!P)return;if(P.duration){(Z=q.current)==null||Z.call(q,p,P.duration);return}const z=()=>{var O;(O=q.current)==null||O.call(q,p,P.duration)};return P.addEventListener("loadedmetadata",z),()=>{P.removeEventListener("loadedmetadata",z)}},[p]),d.useEffect(()=>{const{current:P}=r;P&&(xc()?P.preload="metadata":P.preload="auto")},[]);const R=d.useMemo(()=>({...v}),[v]),G=jh({crossOrigin:F,requestsVideoFrame:!!j,isClientSideRendering:!1});return u.jsx("video",{...Y,ref:r,muted:a||V||ue<=0,playsInline:!0,src:pe,loop:h,style:R,disableRemotePlayback:!0,crossOrigin:G,controls:!1})},Oh=d.forwardRef(lR),Dh=e=>{const{startFrom:t,endAt:n,trimBefore:r,trimAfter:o,name:i,pauseWhenBuffering:s,stack:a,showInTimeline:l,...c}=e,f=vt(),p=Ra(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 m=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.`);yc({startFrom:t,endAt:n,trimBefore:r,trimAfter:o});const{trimBeforeValue:g,trimAfterValue:w}=vc({startFrom:t,endAt:n,trimBefore:r,trimAfter:o});if(typeof g<"u"||typeof w<"u")return u.jsx(Ft,{layout:"none",from:0-(g??0),showInTimeline:!1,durationInFrames:w,name:i,children:u.jsx(Dh,{pauseWhenBuffering:p,...c,trimAfter:void 0,name:void 0,showInTimeline:l,trimBefore:void 0,stack:void 0,startFrom:void 0,endAt:void 0})});if(gc(e,"Video"),f.isRendering)return u.jsx(aR,{pauseWhenBuffering:p,...c,trimAfter:void 0,name:void 0,showInTimeline:l,trimBefore:void 0,stack:void 0,startFrom:void 0,endAt:void 0});const{transparent:x,toneMapped:k,onAutoPlayError:h,onVideoFrame:y,crossOrigin:v,delayRenderRetries:b,delayRenderTimeoutInMilliseconds:S,...E}=c;return u.jsx(Oh,{_remotionInternalStack:a??null,onDuration:m,onlyWarnForMediaSeekingError:!0,pauseWhenBuffering:p,showInTimeline:l??!0,onAutoPlayError:h??void 0,onVideoFrame:y??null,crossOrigin:v,...E,_remotionInternalNativeLoopPassed:!1})},jb=({src:e,acceptableTimeShiftInSeconds:t,allowAmplificationDuringRender:n,audioStreamIndex:r,crossOrigin:o,delayRenderRetries:i,delayRenderTimeoutInMilliseconds:s,loopVolumeCurveBehavior:a,muted:l,name:c,onAutoPlayError:f,onError:p,onVideoFrame:m,pauseWhenBuffering:g,playbackRate:w,preservePitch:x,showInTimeline:k,style:h,toneFrequency:y,toneMapped:v,transparent:b,trimAfter:S,trimBefore:E,useWebAudioApi:C,volume:I,_remotionInternalNativeLoopPassed:j,endAt:F,stack:N,startFrom:K,imageFormat:M,...$})=>{if(M)throw new TypeError("The `<OffthreadVideo>` tag does no longer accept `imageFormat`. Use the `transparent` prop if you want to render a transparent video.");return u.jsx(Dh,{acceptableTimeShiftInSeconds:t,allowAmplificationDuringRender:n??!0,audioStreamIndex:r??0,crossOrigin:o,delayRenderRetries:i,delayRenderTimeoutInMilliseconds:s,loopVolumeCurveBehavior:a??"repeat",muted:l??!1,name:c,onAutoPlayError:f??null,onError:p,onVideoFrame:m,pauseWhenBuffering:Ra(g),playbackRate:w??1,preservePitch:x,toneFrequency:y??1,showInTimeline:k??!0,src:e,stack:N,startFrom:K,_remotionInternalNativeLoopPassed:j??!1,endAt:F,style:h,toneMapped:v??!0,transparent:b??!1,trimAfter:S,trimBefore:E,useWebAudioApi:C??!1,volume:I,...$})};un(jb);var uR="remotion_staticFilesChanged";function cR(){const e=me.useContext(Xi),t=me.useContext(Qi),n=me.useContext(Ji),r=me.useContext(Rt),o=me.useContext(Ca),i=me.useContext(Zo),s=me.useContext(mc),a=me.useContext(tc),l=me.useContext(Go),c=me.useContext(ts),f=me.useContext(sc),p=me.useContext(lc),m=me.useContext(is),g=me.useContext(Ko);return d.useMemo(()=>({compositionManagerCtx:e,timelineContext:t,setTimelineContext:n,sequenceContext:r,nonceContext:o,canUseRemotionHooksContext:i,preloadContext:s,resolveCompositionContext:a,renderAssetManagerContext:l,sequenceManagerContext:c,sequenceManagerRefContext:f,visualModePropStatusesRefContext:p,bufferManagerContext:m,logLevelContext:g}),[e,o,r,n,t,i,s,a,l,c,f,p,m,g])}var dR=e=>{const{children:t,contexts:n}=e;return u.jsx(Ko.Provider,{value:n.logLevelContext,children:u.jsx(Zo.Provider,{value:n.canUseRemotionHooksContext,children:u.jsx(Ca.Provider,{value:n.nonceContext,children:u.jsx(mc.Provider,{value:n.preloadContext,children:u.jsx(Xi.Provider,{value:n.compositionManagerCtx,children:u.jsx(sc.Provider,{value:n.sequenceManagerRefContext,children:u.jsx(ts.Provider,{value:n.sequenceManagerContext,children:u.jsx(lc.Provider,{value:n.visualModePropStatusesRefContext,children:u.jsx(Go.Provider,{value:n.renderAssetManagerContext,children:u.jsx(tc.Provider,{value:n.resolveCompositionContext,children:u.jsx(Qi.Provider,{value:n.timelineContext,children:u.jsx(Ji.Provider,{value:n.setTimelineContext,children:u.jsx(Rt.Provider,{value:n.sequenceContext,children:u.jsx(is.Provider,{value:n.bufferManagerContext,children:t})})})})})})})})})})})})})})},fR=d.createRef(),xe={MaxMediaCacheSizeContext:Bj,useUnsafeVideoConfig:oc,useFrameForVolumeProp:os,useTimelinePosition:xo,useAbsoluteTimelinePosition:u1,evaluateVolume:qo,getAbsoluteSrc:vr,getAnimatedImageDurationInSeconds:Nj,getAssetDisplayName:ob,Timeline:Qf,validateMediaTrimProps:yc,validateMediaProps:gc,resolveTrimProps:vc,VideoForPreview:Oh,CompositionManager:Xi,CompositionSetters:Ea,VisualModePropStatusesContext:ac,VisualModePropStatusesRefContext:lc,VisualModeDragOverridesContext:uc,VisualModeSettersContext:v1,SequenceManager:ts,SequenceManagerRefContext:sc,SequenceStackTracesUpdateContext:Qj,baseSchema:Ar,sequenceSchema:Hi,SequenceWithoutSchema:B1,sequenceStyleSchema:h1,sequenceVisualStyleSchema:H2,sequencePremountSchema:p1,textSchema:ic,transformSchema:xr,premountSchema:es,flattenActiveSchema:Ch,getFlatSchemaWithAllKeys:Ih,RemotionRootContexts:Yj,CompositionManagerProvider:Lj,useVideo:rc,getRoot:Vj,useMediaVolumeState:Mh,usePlayerMutedState:_h,useMediaInTimeline:Fh,useLazyComponent:Qx,truthy:qi,SequenceContext:Rt,PremountContext:x1,usePremounting:Fa,useRemotionContexts:cR,RemotionContextProvider:dR,CSSUtils:kb,setupEnvVariables:tR,MediaVolumeContext:Ph,SetMediaVolumeContext:$h,getRemotionEnvironment:Vn,SharedAudioContext:rs,SharedAudioContextProvider:eb,SharedAudioTagsContext:wc,SharedAudioTagsContextProvider:tb,invalidCompositionErrorMessage:M2,invalidFolderNameErrorMessage:n2,calculateMediaDuration:pc,isCompositionIdValid:t1,isFolderNameValid:Vx,getPreviewDomElement:zj,compositionsRef:Sb,portalNode:qf,waitForRoot:Hj,SetTimelineContext:Ji,CanUseRemotionHooksProvider:Kf,CanUseRemotionHooks:Zo,PrefetchProvider:q1,DurationsContextProvider:Q1,IsPlayerContextProvider:s2,useIsPlayer:dh,EditorPropsProvider:Kx,EditorPropsContext:fh,usePreload:Xo,NonceContext:Ca,resolveVideoConfig:Ib,resolveVideoConfigOrCatch:Jj,resolveVideoConfigWithMetadataOrCatch:qj,ResolveCompositionContext:tc,useResolvedVideoConfig:ph,resolveCompositionsRef:g2,REMOTION_STUDIO_CONTAINER_ELEMENT:Eb,RenderAssetManager:Go,persistCurrentFrame:o1,usePlaybackRate:vh,useTimelineContext:wo,useTimelineSetFrame:c1,isIosSafari:xc,WATCH_REMOTION_STATIC_FILES:uR,addSequenceStackTraces:un,useMediaStartsAt:Bo,BufferingProvider:sb,BufferingContextReact:is,getComponentsToAddStacksTo:L2,getSequenceComponent:D2,getSingleChildComponent:z2,CurrentScaleContext:nR,PixelDensityContext:iR,PreviewSizeContext:rR,calculateScale:oR,validateRenderAsset:G1,Log:_t,LogLevelContext:Ko,useLogLevel:wr,playbackLogging:Gt,timeValueRef:m2,compositionSelectorRef:fR,RemotionEnvironmentContext:Yx,warnAboutTooHighVolume:ss,AudioForPreview:fb,OBJECTFIT_CONTAIN_CLASS_NAME:ha,InnerOffthreadVideo:Dh,useBasicMediaInTimeline:ib,getInputPropsOverride:Zx,setInputPropsOverride:f2,useVideoEnabled:Uj,useAudioEnabled:Zj,useIsPlayerBuffering:ab,TimelinePosition:Qf,DelayRenderContextType:Jx,TimelineContext:Qi,PlaybackRateContext:mh,AbsoluteTimeContext:gh,RenderAssetManagerProvider:kT,getEffectiveVisualModeValue:M1,CompositionRenderErrorContext:Bx,useEffectChainState:Aa,createEffectChainState:U1,cleanupEffectChainState:tp,runEffectChain:_a,useMemoizedEffects:Ma,useMemoizedEffectDefinitions:$a,createEffect:xT,createWebGLContextError:oT,createWebGL2ContextError:H1,computeEffectiveSchemaValuesDotNotation:O1,interpolateKeyframedStatus:Pa,makeStaticDragOverride:UI,makeKeyframedDragOverride:ZI,resolveDragOverrideValue:dc,getStaticDragOverrideValue:KI,OverrideIdsToNodePathsGettersContext:Eh,OverrideIdsToNodePathsSettersContext:BI,findPropsToDelete:N1,makeSequencePropsSubscriptionKey:Cr,getPropStatusesCtx:A1,getEffectPropStatusesCtx:_1,hiddenField:wh,durationInFramesField:bh,freezeField:Sh,fromField:g1},Rb=e=>me.Children.toArray(e).reduce((n,r)=>r.type===me.Fragment?n.concat(Rb(r.props.children)):(n.push(r),n),[]),pR={durationInFrames:Zr.baseSchema.durationInFrames,name:Zr.sequenceSchema.name,hidden:Zr.sequenceSchema.hidden,showInTimeline:Zr.sequenceSchema.showInTimeline,freeze:Zr.baseSchema.freeze,trimBefore:Zr.sequenceSchema.trimBefore,layout:Zr.sequenceSchema.layout},hR=d.forwardRef(({offset:e=0,className:t="",stack:n=null,_remotionInternalRender:r=null,...o},i)=>(q2(),r?r({...o,offset:e,className:t||void 0,stack:n},i):u.jsx(w1,{children:o.children}))),Fb=Zr.withSchema({Component:hR,componentName:"<Series.Sequence>",componentIdentity:"dev.remotion.remotion.Series.Sequence",schema:pR,supportsEffects:!1}),mR=B1,dy=({durationInFrames:e,offset:t,index:n,childrenLength:r})=>{const o=`index = ${n}, duration = ${e}`;(n!==r-1||e!==1/0)&&Qu(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},gR=e=>{const t=d.useMemo(()=>{const n=Rb(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!==Fb)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 dy({durationInFrames:l.props.durationInFrames,offset:l.props.offset,index:o,childrenLength:n.length}),me.cloneElement(l,{_remotionInternalRender:(c,f)=>{const p=c.durationInFrames,{durationInFrames:m,children:g,offset:w,controls:x,stack:k,from:h,name:y,...v}=c,b=dy({durationInFrames:p,offset:w,index:o,childrenLength:n.length}),S=i+b,E=i+p+b;return u.jsxs(u.Fragment,{children:[u.jsx(mR,{ref:f,name:y||"<Series.Sequence>",_remotionInternalDocumentationLink:y?void 0:"https://www.remotion.dev/docs/series",_remotionInternalStack:k??void 0,controls:x??void 0,from:S,durationInFrames:p,...v,children:u.jsx(w1,{children:g})}),r(o+1,E)]})}})};return r(0,0)},[e.children]);return u.jsx(X2,{children:u.jsx(Ft,{layout:"none",name:"<Series>",_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/series",...e,children:t})})},yR=Object.assign(Nr({Component:gR,componentName:"<Series>",componentIdentity:"dev.remotion.remotion.Series",schema:Y2,supportsEffects:!1}),{Sequence:Fb});un(yR);var vR={"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";"},fy={},wR=e=>{fy[e]||(console.warn(e),fy[e]=!0)},xR=e=>{for(const t of Object.keys(vR))if(e.includes(t))return{containsHex:!0,hexCode:t};return{containsHex:!1}},ip=e=>e.startsWith("/")?ip(e.substring(1)):e,bR=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}/${ip(e)}`}return`/${ip(e)}`},SR=e=>e.split("/").map(o=>encodeURIComponent(o)).join("/"),Na=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=xR(e);t.containsHex&&wR(`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=SR(e),r=bR(n);return r.startsWith("/")?r:`/${r}`},kR=e=>{const t={...e,durationInFrames:1,fps:1};return me.createElement(ku,t)};un(kR);var py=e=>Math.round(e*1e5)/1e5,Id=({element:e,desiredTime:t,logLevel:n,mountTime:r})=>{if(Tu(e.currentTime,t))return{wait:Promise.resolve(t),cancel:()=>{}};Yl({logLevel:n,mediaRef:e,time:t,why:"Seeking during rendering",mountTime:r});let o,i=null;const s=new Promise(l=>{o=e.requestVideoFrameCallback((c,f)=>{const p=f.expectedDisplayTime-c;if(p<=0){l(f.mediaTime);return}setTimeout(()=>{l(f.mediaTime)},p+150)})}),a=new Promise(l=>{const c=()=>{l()};e.addEventListener("seeked",c,{once:!0}),i=()=>{e.removeEventListener("seeked",c)}});return{wait:Promise.all([s,a]).then(([l])=>l),cancel:()=>{i==null||i(),e.cancelVideoFrameCallback(o)}}},ER=({element:e,desiredTime:t,fps:n,logLevel:r,mountTime:o})=>{const i=1/n/2;let s=()=>{};return Number.isFinite(e.duration)&&e.currentTime>=e.duration&&t>=e.duration?{prom:Promise.resolve(),cancel:()=>{}}:{prom:new Promise((l,c)=>{const f=Id({element:e,desiredTime:t+i,logLevel:r,mountTime:o});f.wait.then(p=>{if(Math.abs(t-p)<=i)return l();const g=t>p?1:-1,w=Id({element:e,desiredTime:p+i*g,logLevel:r,mountTime:o});s=w.cancel,w.wait.then(x=>{const k=Math.abs(t-x);if(py(k)<=py(i))return l();const h=Id({element:e,desiredTime:t+i,logLevel:r,mountTime:o});return s=h.cancel,h.wait.then(()=>{l()}).catch(y=>{c(y)})}).catch(x=>{c(x)})}),s=f.cancel}),cancel:()=>{s()}}},CR=({onError:e,volume:t,allowAmplificationDuringRender:n,playbackRate:r,onDuration:o,toneFrequency:i,name:s,acceptableTimeShiftInSeconds:a,delayRenderRetries:l,delayRenderTimeoutInMilliseconds:c,loopVolumeCurveBehavior:f,audioStreamIndex:p,onVideoFrame:m,preservePitch:g,...w},x)=>{const k=xo(),h=Nt(),y=os(f??"repeat"),v=oc(),b=d.useRef(null),S=d.useContext(Rt),E=Bo(),C=vt(),I=wr(),j=Ta(),{delayRender:F,continueRender:N}=or(),{registerRenderAsset:K,unregisterRenderAsset:M}=d.useContext(Go),$=d.useMemo(()=>`video-${Yo(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(!v)throw new Error("No video config found");const U=qo({volume:t,frame:y,mediaVolume:1});ss(U),d.useEffect(()=>{if(!w.src)throw new Error("No src passed");if(!w.muted&&!(U<=0)&&window.remotion_audioEnabled)return K({type:"video",src:vr(w.src),id:$,frame:k,volume:U,mediaFrame:h,playbackRate:r??1,toneFrequency:i??1,audioStartFrame:Math.max(0,-((S==null?void 0:S.cumulatedNegativeFrom)??0)),audioStreamIndex:p??0}),()=>M($)},[w.muted,w.src,K,$,M,U,h,k,r,i,S==null?void 0:S.cumulatedNegativeFrom,p]),d.useImperativeHandle(x,()=>b.current,[]),Tb({ref:b,onVideoFrame:m}),d.useEffect(()=>{var ie,L;if(!window.remotion_videoEnabled)return;const{current:A}=b;if(!A)return;const T=ub({frame:h,playbackRate:r||1,startFrom:-E,fps:v.fps}),W=F(`Rendering <Html5Video /> with src="${w.src}" at time ${T}`,{retries:l??void 0,timeoutInMilliseconds:c??void 0});if(((L=(ie=window.process)==null?void 0:ie.env)==null?void 0:L.NODE_ENV)==="test"){N(W);return}if(Tu(A.currentTime,T)){if(A.readyState>=2){N(W);return}const V=()=>{N(W)};return A.addEventListener("loadeddata",V,{once:!0}),()=>{A.removeEventListener("loadeddata",V)}}const B=()=>{N(W)},D=ER({element:A,desiredTime:T,fps:v.fps,logLevel:I,mountTime:j});D.prom.then(()=>{N(W)}),A.addEventListener("ended",B,{once:!0});const se=()=>{var V;if(A!=null&&A.error){if(console.error("Error occurred in video",A==null?void 0:A.error),e)return;throw new Ii({message:`The browser threw an error while playing the video ${w.src}: Code ${A.error.code} - ${(V=A==null?void 0:A.error)==null?void 0:V.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 Ii({message:"The browser threw an error",src:w.src})};return A.addEventListener("error",se,{once:!0}),()=>{D.cancel(),A.removeEventListener("ended",B),A.removeEventListener("error",se),N(W)}},[y,w.src,r,v.fps,h,E,e,l,c,I,j,N,F]);const{src:Y}=w;return C.isRendering&&d.useLayoutEffect(()=>{var B,D;if(((D=(B=window.process)==null?void 0:B.env)==null?void 0:D.NODE_ENV)==="test")return;const A=F("Loading <Html5Video> duration with src="+Y,{retries:l??void 0,timeoutInMilliseconds:c??void 0}),{current:T}=b,W=()=>{T!=null&&T.duration&&o(Y,T.duration),N(A)};return T!=null&&T.duration?(o(Y,T.duration),N(A)):T==null||T.addEventListener("loadedmetadata",W,{once:!0}),()=>{T==null||T.removeEventListener("loadedmetadata",W),N(A)}},[Y,o,l,c,N,F]),u.jsx("video",{ref:b,disableRemotePlayback:!0,...w})},IR=d.forwardRef(CR),TR=(e,t)=>{const{startFrom:n,endAt:r,trimBefore:o,trimAfter:i,name:s,pauseWhenBuffering:a,stack:l,_remotionInternalNativeLoopPassed:c,showInTimeline:f,onAutoPlayError:p,onVideoFrame:m,...g}=e,{loop:w,...x}=e,{fps:k}=pt(),h=vt(),y=Ra(a);if(h.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:v,setDurations:b}=d.useContext(Th);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=Xo(e.src),E=d.useCallback((F,N)=>{b({type:"got-duration",durationInSeconds:N,src:F})},[b]),C=v[vr(S)]??v[vr(e.src)];yc({startFrom:n,endAt:r,trimBefore:o,trimAfter:i});const{trimBeforeValue:I,trimAfterValue:j}=vc({startFrom:n,endAt:r,trimBefore:o,trimAfter:i});if(w&&C!==void 0){if(!Number.isFinite(C))return u.jsx(Gl,{...x,ref:t,stack:l,_remotionInternalNativeLoopPassed:!0});const F=C*k;return u.jsx(hc,{durationInFrames:pc({trimAfter:j,mediaDurationInFrames:F,playbackRate:e.playbackRate??1,trimBefore:I}),layout:"none",name:s,showInTimeline:!1,children:u.jsx(Gl,{...x,ref:t,stack:l,_remotionInternalNativeLoopPassed:!0})})}return typeof I<"u"||typeof j<"u"?u.jsx(Ft,{layout:"none",from:0-(I??0),showInTimeline:!1,durationInFrames:j===void 0?void 0:j/(e.playbackRate??1),name:s,children:u.jsx(Gl,{pauseWhenBuffering:y,onVideoFrame:m,...g,ref:t,stack:l})}):(gc({playbackRate:e.playbackRate,preservePitch:e.preservePitch,volume:e.volume},"Html5Video"),h.isRendering?u.jsx(IR,{onDuration:E,onVideoFrame:m??null,...g,ref:t}):u.jsx(Oh,{onlyWarnForMediaSeekingError:!1,...g,ref:t,onVideoFrame:m??null,pauseWhenBuffering:y,onDuration:E,_remotionInternalStack:l??null,_remotionInternalNativeLoopPassed:c??!1,showInTimeline:f??!0,onAutoPlayError:p??void 0}))},Gl=d.forwardRef(TR);un(Gl);B2();var jR={},RR=new Proxy(jR,{get(e,t){return t==="Bundling"||t==="Rendering"||t==="Log"||t==="Puppeteer"||t==="Output"?RR:()=>{console.warn("⚠️ The CLI configuration has been extracted from Remotion Core."),console.warn("Update the import from the config file:"),console.warn(),console.warn("- Delete:"),console.warn('import {Config} from "remotion";'),console.warn("+ Replace:"),console.warn('import {Config} from "@remotion/cli/config";'),console.warn(),console.warn("For more information, see https://www.remotion.dev/docs/4-0-migration."),process.exit(1)}}});Ft.displayName="Sequence";un(Ft);O2(Ft);un(ku);un(r2);typeof window<"u"&&(window.remotion_renderReady=!1,window.remotion_delayRenderTimeouts||(window.remotion_delayRenderTimeouts={}),window.remotion_delayRenderHandles=[]);var FR={"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}},PR={"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"}},$R={"style.backgroundColor":{type:"color",default:"transparent",description:"Color"}},MR={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}},_R={...MR},AR={...FR,...$R,...PR,..._R},NR={layout:{type:"enum",default:"absolute-fill",description:"Layout",variants:{"absolute-fill":AR,none:{}}}};({...NR.layout});var LR=(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 OR(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 DR(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 zR(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 kc={validateFps:zR,validateDimension:OR,validateDurationInFrames:DR,validateDefaultAndInputProps:LR};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 zt=25,sp=16,BR=()=>u.jsx("svg",{width:zt,height:zt,viewBox:"0 0 25 25",fill:"none",children:u.jsx("path",{d:"M8 6.375C7.40904 8.17576 7.06921 10.2486 7.01438 12.3871C6.95955 14.5255 7.19163 16.6547 7.6875 18.5625C9.95364 18.2995 12.116 17.6164 14.009 16.5655C15.902 15.5147 17.4755 14.124 18.6088 12.5C17.5158 10.8949 15.9949 9.51103 14.1585 8.45082C12.3222 7.3906 10.2174 6.68116 8 6.375Z",fill:"white",stroke:"white",strokeWidth:"6.25",strokeLinejoin:"round"})}),WR=()=>u.jsxs("svg",{viewBox:"0 0 100 100",width:zt,height:zt,children:[u.jsx("rect",{x:"25",y:"20",width:"20",height:"60",fill:"#fff",ry:"5",rx:"5"}),u.jsx("rect",{x:"55",y:"20",width:"20",height:"60",fill:"#fff",ry:"5",rx:"5"})]}),VR=({isFullscreen:e})=>{const r=e?0:3,o=e?6*1.6:6/2,i=e?6*1.6:6*2;return u.jsxs("svg",{viewBox:"0 0 32 32",height:sp,width:sp,children:[u.jsx("path",{d:`
|
|
81
|
-
M ${r} ${i}
|
|
82
|
-
L ${o} ${o}
|
|
83
|
-
L ${i} ${r}
|
|
84
|
-
`,stroke:"#fff",strokeWidth:6,fill:"none"}),u.jsx("path",{d:`
|
|
85
|
-
M ${32-r} ${i}
|
|
86
|
-
L ${32-o} ${o}
|
|
87
|
-
L ${32-i} ${r}
|
|
88
|
-
`,stroke:"#fff",strokeWidth:6,fill:"none"}),u.jsx("path",{d:`
|
|
89
|
-
M ${r} ${32-i}
|
|
90
|
-
L ${o} ${32-o}
|
|
91
|
-
L ${i} ${32-r}
|
|
92
|
-
`,stroke:"#fff",strokeWidth:6,fill:"none"}),u.jsx("path",{d:`
|
|
93
|
-
M ${32-r} ${32-i}
|
|
94
|
-
L ${32-o} ${32-o}
|
|
95
|
-
L ${32-i} ${32-r}
|
|
96
|
-
`,stroke:"#fff",strokeWidth:6,fill:"none"})]})},HR=()=>u.jsx("svg",{width:zt,height:zt,viewBox:"0 0 24 24",children:u.jsx("path",{d:"M3.63 3.63a.996.996 0 000 1.41L7.29 8.7 7 9H4c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h3l3.29 3.29c.63.63 1.71.18 1.71-.71v-4.17l4.18 4.18c-.49.37-1.02.68-1.6.91-.36.15-.58.53-.58.92 0 .72.73 1.18 1.39.91.8-.33 1.55-.77 2.22-1.31l1.34 1.34a.996.996 0 101.41-1.41L5.05 3.63c-.39-.39-1.02-.39-1.42 0zM19 12c0 .82-.15 1.61-.41 2.34l1.53 1.53c.56-1.17.88-2.48.88-3.87 0-3.83-2.4-7.11-5.78-8.4-.59-.23-1.22.23-1.22.86v.19c0 .38.25.71.61.85C17.18 6.54 19 9.06 19 12zm-8.71-6.29l-.17.17L12 7.76V6.41c0-.89-1.08-1.33-1.71-.7zM16.5 12A4.5 4.5 0 0014 7.97v1.79l2.48 2.48c.01-.08.02-.16.02-.24z",fill:"#fff"})}),UR=()=>u.jsx("svg",{width:zt,height:zt,viewBox:"0 0 24 24",children:u.jsx("path",{d:"M3 10v4c0 .55.45 1 1 1h3l3.29 3.29c.63.63 1.71.18 1.71-.71V6.41c0-.89-1.08-1.34-1.71-.71L7 9H4c-.55 0-1 .45-1 1zm13.5 2A4.5 4.5 0 0014 7.97v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 4.45v.2c0 .38.25.71.6.85C17.18 6.53 19 9.06 19 12s-1.82 5.47-4.4 6.5c-.36.14-.6.47-.6.85v.2c0 .63.63 1.07 1.21.85C18.6 19.11 21 15.84 21 12s-2.4-7.11-5.79-8.4c-.58-.23-1.21.22-1.21.85z",fill:"#fff"})}),hy="__remotion_buffering_indicator",my="__remotion_buffering_animation",ZR={width:zt,height:zt,overflow:"hidden",lineHeight:"normal",fontSize:"inherit"},KR={width:14,height:14,overflow:"hidden",lineHeight:"normal",fontSize:"inherit"},YR=({type:e})=>{const t=e==="player"?ZR:KR;return u.jsxs(u.Fragment,{children:[u.jsx("style",{type:"text/css",children:`
|
|
97
|
-
@keyframes ${my} {
|
|
98
|
-
0% {
|
|
99
|
-
rotate: 0deg;
|
|
100
|
-
}
|
|
101
|
-
100% {
|
|
102
|
-
rotate: 360deg;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.${hy} {
|
|
107
|
-
animation: ${my} 1s linear infinite;
|
|
108
|
-
}
|
|
109
|
-
`}),u.jsx("div",{style:t,children:u.jsx("svg",{viewBox:e==="player"?"0 0 22 22":"0 0 18 18",style:t,className:hy,children:u.jsx("path",{d:e==="player"?"M 11 4 A 7 7 0 0 1 15.1145 16.66312":"M 9 2 A 7 7 0 0 1 13.1145 14.66312",stroke:"white",strokeLinecap:"round",fill:"none",strokeWidth:3})})})]})},GR=({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},Pb=({previewSize:e,compositionWidth:t,compositionHeight:n,canvasSize:r})=>{const o=xe.calculateScale({canvasSize:r,compositionHeight:n,compositionWidth:t,previewSize:e}),i=0-(1-o)/2,s=i*t,a=i*n,l=t*o,c=n*o,f=r.width/2-l/2,p=r.height/2-c/2;return{centerX:f,centerY:p,xCorrection:s,yCorrection:a,scale:o}},$b=({config:e,style:t,canvasSize:n,overflowVisible:r,layout:o})=>e?{position:"relative",overflow:r?"visible":"hidden",...GR({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}:{},Mb=({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"}:{},_b=({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"}},Ab=me.createContext(void 0),Nb=me.createContext(void 0);class XR{constructor(){Oe(this,"listeners",{ended:[],error:[],pause:[],play:[],ratechange:[],scalechange:[],seeked:[],timeupdate:[],frameupdate:[],fullscreenchange:[],volumechange:[],mutechange:[],waiting:[],resume:[]});Oe(this,"dispatchSeek",t=>{this.dispatchEvent("seeked",{frame:t})});Oe(this,"dispatchVolumeChange",t=>{this.dispatchEvent("volumechange",{volume:t})});Oe(this,"dispatchPause",()=>{this.dispatchEvent("pause",void 0)});Oe(this,"dispatchPlay",()=>{this.dispatchEvent("play",void 0)});Oe(this,"dispatchEnded",()=>{this.dispatchEvent("ended",void 0)});Oe(this,"dispatchRateChange",t=>{this.dispatchEvent("ratechange",{playbackRate:t})});Oe(this,"dispatchScaleChange",t=>{this.dispatchEvent("scalechange",{scale:t})});Oe(this,"dispatchError",t=>{this.dispatchEvent("error",{error:t})});Oe(this,"dispatchTimeUpdate",t=>{this.dispatchEvent("timeupdate",t)});Oe(this,"dispatchFrameUpdate",t=>{this.dispatchEvent("frameupdate",t)});Oe(this,"dispatchFullscreenChange",t=>{this.dispatchEvent("fullscreenchange",t)});Oe(this,"dispatchMuteChange",t=>{this.dispatchEvent("mutechange",t)});Oe(this,"dispatchWaiting",t=>{this.dispatchEvent("waiting",t)});Oe(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 qR{constructor(){Oe(this,"listeners",{error:[],waiting:[],resume:[]});Oe(this,"dispatchError",t=>{this.dispatchEvent("error",{error:t})});Oe(this,"dispatchWaiting",t=>{this.dispatchEvent("waiting",t)});Oe(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 Lb=e=>{const t=d.useContext(xe.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])},JR=({children:e,currentPlaybackRate:t})=>{const[n]=d.useState(()=>new XR);if(!d.useContext(xe.BufferingContextReact))throw new Error("BufferingContextReact not found");return d.useEffect(()=>{t&&n.dispatchRateChange(t)},[n,t]),Lb(n),u.jsx(Ab.Provider,{value:n,children:e})},zh=(e,t)=>{const[n,r]=d.useState(!1);return d.useEffect(()=>{const{current:o}=e;if(!o)return;let i;const s=()=>{t&&(clearTimeout(i),i=setTimeout(()=>{r(!1)},t===!0?3e3:t))},a=()=>{r(!0),s()},l=()=>{r(!1),clearTimeout(i)},c=()=>{r(!0),s()};return o.addEventListener("mouseenter",a),o.addEventListener("mouseleave",l),o.addEventListener("mousemove",c),()=>{o.removeEventListener("mouseenter",a),o.removeEventListener("mouseleave",l),o.removeEventListener("mousemove",c),clearTimeout(i)}},[t,e]),n},Ec=()=>{const[e,t,n]=xe.Timeline.usePlayingState(),[r,o]=d.useState(!1),i=xe.Timeline.useTimelinePosition(),s=d.useRef(i),a=xe.Timeline.useTimelineSetFrame(),l=xe.Timeline.useTimelineSetFrame(),c=d.useContext(xe.SharedAudioContext),f=d.useContext(xe.SharedAudioTagsContext),{audioAndVideoTags:p}=xe.useTimelineContext(),m=d.useRef(i);m.current=i;const g=xe.useVideo(),w=xe.useUnsafeVideoConfig(),x=d.useContext(Ab),k=((w==null?void 0:w.durationInFrames)??1)-1,h=i===k,y=i===0;if(!x)throw new TypeError("Expected Player event emitter context");const v=d.useContext(xe.BufferingContextReact);if(!v)throw new Error("Missing the buffering context. Most likely you have a Remotion version mismatch.");const{buffering:b}=v,S=d.useCallback(A=>{const T=w?xe.TimelinePosition.clampFrameToCompositionRange(A,w.durationInFrames):Math.max(0,A);g!=null&&g.id&&l(W=>({...W,[g.id]:T})),m.current=T,x.dispatchSeek(T)},[w,x,l,g==null?void 0:g.id]),E=d.useCallback(A=>{n.current||(o(!0),h&&S(0),c==null||c.resume(),f&&f.numberOfAudioTags>0&&A&&f.playAllAudios(),p.current.forEach(T=>T.play("player play() was called and playing audio from a click")),n.current=!0,t(!0),s.current=m.current,x.dispatchPlay())},[n,h,c,f,t,x,S,p]),C=d.useCallback(()=>{n.current&&(n.current=!1,t(!1),x.dispatchPause(),c==null||c.suspend())},[x,n,t,c]),I=d.useCallback(()=>{n.current&&(n.current=!1,m.current=s.current,w&&(l(A=>({...A,[w.id]:s.current})),t(!1),x.dispatchPause()))},[w,x,n,t,l]),j=g==null?void 0:g.id,F=d.useCallback(A=>{if(!j)return null;n.current||a(T=>{const W=T[j]??window.remotion_initialFrame??0,B=Math.max(0,W-A);return W===B?T:{...T,[j]:B}})},[n,a,j]),N=d.useCallback(A=>{if(!j)return null;n.current||a(T=>{const W=T[j]??window.remotion_initialFrame??0,B=Math.min(k,W+A);return W===B?T:{...T,[j]:B}})},[j,n,k,a]),K=d.useCallback(A=>{n.current?C():E(A)},[n,C,E]),M=d.useCallback(()=>n.current,[n]),$=d.useCallback(()=>m.current,[m]),U=d.useCallback(()=>b.current,[b]);return d.useMemo(()=>({frameBack:F,frameForward:N,isLastFrame:h,emitter:x,playing:e,play:E,pause:C,seek:S,isFirstFrame:y,getCurrentFrame:$,isPlaying:M,isBuffering:U,pauseAndReturnToPlayStart:I,hasPlayed:r,toggle:K}),[x,F,N,r,y,h,$,C,I,E,e,S,K,M,U])},QR=({browserMediaControlsBehavior:e,videoConfig:t,playbackRate:n})=>{const{playing:r,pause:o,play:i,emitter:s,getCurrentFrame:a,seek:l}=Ec(),c=d.useRef(!1);d.useEffect(()=>{r&&(c.current=!0)},[r]),d.useEffect(()=>{navigator.mediaSession&&e.mode!=="do-nothing"&&(r?navigator.mediaSession.playbackState="playing":c.current&&(navigator.mediaSession.playbackState="paused"))},[e.mode,r]),d.useEffect(()=>{if(!navigator.mediaSession||e.mode==="do-nothing")return;const f=()=>{t&&navigator.mediaSession&&navigator.mediaSession.setPositionState({duration:t.durationInFrames/t.fps,playbackRate:n,position:a()/t.fps})};return s.addEventListener("timeupdate",f),()=>{s.removeEventListener("timeupdate",f)}},[e.mode,s,a,n,t]),d.useEffect(()=>{if(navigator.mediaSession&&e.mode!=="do-nothing")return navigator.mediaSession.setActionHandler("play",()=>{e.mode==="register-media-session"&&i()}),navigator.mediaSession.setActionHandler("pause",()=>{e.mode==="register-media-session"&&o()}),navigator.mediaSession.setActionHandler("seekto",f=>{e.mode==="register-media-session"&&f.seekTime!==void 0&&t&&l(Math.round(f.seekTime*t.fps))}),navigator.mediaSession.setActionHandler("seekbackward",()=>{e.mode==="register-media-session"&&t&&l(Math.max(0,Math.round((a()-10)*t.fps)))}),navigator.mediaSession.setActionHandler("seekforward",()=>{e.mode==="register-media-session"&&t&&l(Math.max(t.durationInFrames-1,Math.round((a()+10)*t.fps)))}),navigator.mediaSession.setActionHandler("previoustrack",()=>{e.mode==="register-media-session"&&l(0)}),()=>{navigator.mediaSession.metadata=null,navigator.mediaSession.setActionHandler("play",null),navigator.mediaSession.setActionHandler("pause",null),navigator.mediaSession.setActionHandler("seekto",null),navigator.mediaSession.setActionHandler("seekbackward",null),navigator.mediaSession.setActionHandler("seekforward",null),navigator.mediaSession.setActionHandler("previoustrack",null)}},[e.mode,a,o,i,l,t])},eF=({time:e,currentFrame:t,playbackSpeed:n,fps:r,actualLastFrame:o,actualFirstFrame:i,framesAdvanced:s,shouldLoop:a})=>{const c=(n<0?Math.ceil:Math.floor)(e*n/(1e3/r))-s,f=c+t,p=t>o||t<i,m=f>o||f<i,g=!a&&m&&!p;return n>0?m?{nextFrame:i,framesToAdvance:c,hasEnded:g}:{nextFrame:f,framesToAdvance:c,hasEnded:g}:m?{nextFrame:o,framesToAdvance:c,hasEnded:g}:{nextFrame:f,framesToAdvance:c,hasEnded:g}},gy=()=>typeof document>"u"?!1:document.visibilityState==="hidden",tF=()=>{const e=d.useRef(gy());return d.useEffect(()=>{const t=()=>{e.current=gy()};return document.addEventListener("visibilitychange",t),()=>{document.removeEventListener("visibilitychange",t)}},[]),e},nF=.1,yy=({audioContext:e,audioSyncAnchor:t,absoluteTimeInSeconds:n,globalPlaybackRate:r,logLevel:o,force:i})=>{const s=e.currentTime-n/r,a=s-t.value,{outputLatency:l}=e,c=l===0?.3:l,f=e.baseLatency+c;return Math.abs(a)<nF+f&&!i||Math.abs(a)<Number.EPSILON?!1:(xe.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)},rF=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}`)},oF=({loop:e,playbackRate:t,moveToBeginningWhenEnded:n,inFrame:r,outFrame:o,browserMediaControlsBehavior:i,getCurrentFrame:s,muted:a})=>{const l=xe.useUnsafeVideoConfig(),c=xe.Timeline.useTimelinePosition(),{playing:f,pause:p,emitter:m,isPlaying:g}=Ec(),w=xe.Timeline.useTimelineSetFrame(),x=d.useContext(xe.SharedAudioContext),k=xe.useLogLevel(),h=tF(),y=d.useRef(0),v=d.useContext(xe.BufferingContextReact);if(!v)throw new Error("Missing the buffering context. Most likely you have a Remotion version mismatch.");QR({browserMediaControlsBehavior:i,playbackRate:t,videoConfig:l}),d.useLayoutEffect(()=>{if(!x||!x.audioContext||!l||a)return;yy({audioContext:x.audioContext,audioSyncAnchor:x.audioSyncAnchor,absoluteTimeInSeconds:c/l.fps,globalPlaybackRate:t,logLevel:k,force:!1})&&x.audioSyncAnchorEmitter.dispatch("changed")},[l,c,k,t,x,a]),d.useLayoutEffect(()=>{const b=x==null?void 0:x.audioContext;if(!b||!l||a)return;const S=()=>{const E=x==null?void 0:x.getAudioContextState();E&&rF(E)&&yy({audioContext:b,audioSyncAnchor:x.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,x]),d.useEffect(()=>{var M;if(!l)return;if(!f){(M=x==null?void 0:x.suspend)==null||M.call(x);return}let b=!1,S=null,E=performance.now(),C=0;const I=()=>{S!==null&&(S.type==="raf"?cancelAnimationFrame(S.id):clearTimeout(S.id))},j=()=>{b=!0,I()},F=()=>{var D,se;if(b)return;if(!g()){(D=x==null?void 0:x.suspend)==null||D.call(x);return}!a&&!v.buffering.current&&((se=x==null?void 0:x.resume)==null||se.call(x));const $=performance.now()-E,U=o??l.durationInFrames-1,Y=r??0,A=s(),{nextFrame:T,framesToAdvance:W,hasEnded:B}=eF({time:$,currentFrame:A,playbackSpeed:t,fps:l.fps,actualFirstFrame:Y,actualLastFrame:U,framesAdvanced:C,shouldLoop:e});if(C+=W,T!==s()&&(!B||n)&&!v.buffering.current&&w(ie=>({...ie,[l.id]:T})),B){j(),p(),m.dispatchEnded();return}N()},N=()=>{var U,Y;const $=((U=x==null?void 0:x.getIsResumingAudioContext)==null?void 0:U.call(x))??null;if($!==null&&!a){$.then(()=>{E=performance.now(),C=0,N()});return}if(v.buffering.current){a||(Y=x==null?void 0:x.suspend)==null||Y.call(x);const A=v.listenForResume(()=>{A.remove(),E=performance.now(),C=0,N()});return}if(h.current){S={type:"timeout",id:setTimeout(F,1e3/l.fps)};return}S={type:"raf",id:requestAnimationFrame(F)}};N();const K=()=>{document.visibilityState!=="visible"&&(I(),F())};return window.addEventListener("visibilitychange",K),()=>{window.removeEventListener("visibilitychange",K),j()}},[l,e,p,f,w,m,t,r,o,n,h,s,v,g,x,k,a]),d.useEffect(()=>{const b=performance.now(),S=b-y.current;if(S>=250){m.dispatchTimeUpdate({frame:c}),y.current=b;return}const E=setTimeout(()=>{m.dispatchTimeUpdate({frame:c}),y.current=performance.now()},250-S);return()=>clearTimeout(E)},[m,c]),d.useEffect(()=>{m.dispatchFrameUpdate({frame:c})},[m,c])},Td=[],jd=e=>e?"current"in e?e.current:e:null,Bh=(e,t)=>{const[n,r]=d.useState(()=>{const s=jd(e);if(!s)return null;const a=s.getClientRects();return a[0]?{width:a[0].width,height:a[0].height,left:a[0].x,top:a[0].y,windowSize:{height:window.innerHeight,width:window.innerWidth}}:null}),o=d.useMemo(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(s=>{const{contentRect:a,target:l}=s[0],c=l.getClientRects();if(!(c!=null&&c[0])){r(null);return}const f=a.width===0?1:c[0].width/a.width,p=a.height===0?1:c[0].height/a.height,m=t.shouldApplyCssTransforms||f===0?c[0].width:c[0].width*(1/f),g=t.shouldApplyCssTransforms||p===0?c[0].height:c[0].height*(1/p);r(w=>w&&w.width===m&&w.height===g&&w.left===c[0].x&&w.top===c[0].y&&w.windowSize.height===window.innerHeight&&w.windowSize.width===window.innerWidth?w:{width:m,height:g,left:c[0].x,top:c[0].y,windowSize:{height:window.innerHeight,width:window.innerWidth}})}),[t.shouldApplyCssTransforms]),i=d.useCallback(()=>{const s=jd(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=jd(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(()=>(Td.push(i),()=>{Td=Td.filter(s=>s!==i)}),[i]),d.useMemo(()=>n?{...n,refresh:i}:null,[n,i])},Wh=e=>e??"__remotion-player",iF={display:"flex",justifyContent:"center",alignItems:"center",flex:1,height:"100%",width:"100%"};class Ob extends me.Component{constructor(){super(...arguments);Oe(this,"state",{hasError:null})}static getDerivedStateFromError(n){return{hasError:n}}componentDidCatch(n){this.props.onError(n)}render(){return this.state.hasError?u.jsx("div",{style:iF,children:this.props.errorFallback({error:this.state.hasError})}):this.props.children}}var sF=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}},Rd={backgroundColor:"red",position:"absolute",padding:12,fontFamily:"Arial"},aF=["28d262b44cc61fa750f1686b16ad0604dabfe193fbc263eec05c89b7ad4c2cd6","4db1b0a94be33165dfefcb3ba03d04c7a2666dd27c496d3dc9fa41858e94925e","fbc48530bbf245da790f63675e84e06bab38c3b114fab07eb350025119922bdc","7baf10a8932757b1b3a22b3fce10a048747ac2f8eaf638603487e3705b07eb83","8a6c21a598d8c667272b5207c051b85997bf5b45d5fb712378be3f27cd72c6a6","a2f7aaac9c50a9255e7fc376110c4e0bfe153722dc66ed3c5d3bf2a135f65518"],vy=!1,lF=()=>{const[e,t]=me.useState(!1);return d.useEffect(()=>{vy||(vy=!0,sF().then(n=>{n&&aF.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,Rd,{zIndex:"9999",cssText:`${Rd.cssText} !important;`}),i.innerHTML=`
|
|
110
|
-
<a href="https://github.com/remotion-dev/remotion/pull/4589" style="color: white;">
|
|
111
|
-
Remotion Unlicensed – Contact hi@remotion.dev
|
|
112
|
-
</a>
|
|
113
|
-
`,document.body.appendChild(i)}},r=new MutationObserver(()=>n());return r.observe(document.body,{childList:!0,subtree:!0}),()=>{r.disconnect()}},[e]),e?u.jsx("div",{style:Rd,className:"warning-banner",children:u.jsx("a",{style:{color:"white"},href:"https://github.com/remotion-dev/remotion/pull/4589",children:"Remotion Unlicensed – Contact hi@remotion.dev"})}):null},wy=({playing:e,buffering:t})=>e&&t?u.jsx(YR,{type:"player"}):e?u.jsx(WR,{}):u.jsx(BR,{}),ri=12,xy=5,uF=({volume:e,isVertical:t,onBlur:n,inputRef:r,setVolume:o})=>{const i=d.useMemo(()=>{const m={paddingLeft:5,height:zt,width:$o,display:"inline-flex",alignItems:"center"};return t?{...m,position:"absolute",transform:`rotate(-90deg) translateX(${$o/2+zt/2}px)`}:{...m}},[t]),s=typeof me.useId>"u"?"volume-slider":me.useId(),[a]=d.useState(()=>`__remotion-volume-slider-${Yo(s)}`.replace(".","")),l=d.useCallback(p=>{o(parseFloat(p.target.value))},[o]),c=d.useMemo(()=>{const p={WebkitAppearance:"none",backgroundColor:"rgba(255, 255, 255, 0.5)",borderRadius:xy/2,cursor:"pointer",height:xy,width:$o,backgroundImage:`linear-gradient(
|
|
114
|
-
to right,
|
|
115
|
-
white ${e*100}%, rgba(255, 255, 255, 0) ${e*100}%
|
|
116
|
-
)`};return t?{...p,bottom:zt+$o/2}:p},[t,e]),f=`
|
|
117
|
-
.${a}::-webkit-slider-thumb {
|
|
118
|
-
-webkit-appearance: none;
|
|
119
|
-
background-color: white;
|
|
120
|
-
border-radius: ${ri/2}px;
|
|
121
|
-
box-shadow: 0 0 2px black;
|
|
122
|
-
height: ${ri}px;
|
|
123
|
-
width: ${ri}px;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.${a}::-moz-range-thumb {
|
|
127
|
-
-webkit-appearance: none;
|
|
128
|
-
background-color: white;
|
|
129
|
-
border-radius: ${ri/2}px;
|
|
130
|
-
box-shadow: 0 0 2px black;
|
|
131
|
-
height: ${ri}px;
|
|
132
|
-
width: ${ri}px;
|
|
133
|
-
}
|
|
134
|
-
`;return u.jsxs("div",{style:i,children:[u.jsx("style",{dangerouslySetInnerHTML:{__html:f}}),u.jsx("input",{ref:r,"aria-label":"Change volume",className:a,max:1,min:0,onBlur:n,onChange:l,step:.01,type:"range",value:e,style:c})]})},cF=e=>u.jsx(uF,{...e}),$o=100,dF=({displayVerticalVolumeSlider:e,renderMuteButton:t,renderVolumeSlider:n})=>{const[r,o]=xe.usePlayerMutedState(),[i,s]=xe.useMediaVolumeState(),[a,l]=d.useState(!1),c=d.useRef(null),f=d.useRef(null),p=zh(c,!1),m=d.useCallback(()=>{setTimeout(()=>{f.current&&document.activeElement!==f.current&&l(!1)},10)},[]),g=i===0,w=d.useCallback(()=>{if(g){s(1),o(!1);return}o(b=>!b)},[g,o,s]),x=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:zt,height:zt,cursor:"pointer",appearance:"none",background:"none",border:"none",padding:0}),[]),h=d.useCallback(({muted:b,volume:S})=>{const E=b||S===0;return u.jsx("button",{"aria-label":E?"Unmute sound":"Mute sound",title:E?"Unmute sound":"Mute sound",onClick:w,onBlur:m,onFocus:()=>l(!0),style:k,type:"button",children:E?u.jsx(HR,{}):u.jsx(UR,{})})},[m,w,k]),y=d.useMemo(()=>t?t({muted:r,volume:i}):h({muted:r,volume:i}),[r,i,h,t]),v=d.useMemo(()=>(a||p)&&!r&&!xe.isIosSafari()?(n??cF)({isVertical:e,volume:i,onBlur:()=>l(!1),inputRef:f,setVolume:s}):null,[e,a,p,r,i,n,s]);return u.jsxs("div",{ref:c,style:x,children:[y,v]})};function fF(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 pF=35,hF=70,mF={height:30,paddingRight:15,paddingLeft:12,display:"flex",flexDirection:"row",alignItems:"center"},gF={width:22,display:"flex",alignItems:"center"},yF={width:14,height:14,color:"black"},vF=()=>u.jsx("svg",{viewBox:"0 0 512 512",style:yF,children:u.jsx("path",{fill:"currentColor",d:"M435.848 83.466L172.804 346.51l-96.652-96.652c-4.686-4.686-12.284-4.686-16.971 0l-28.284 28.284c-4.686 4.686-4.686 12.284 0 16.971l133.421 133.421c4.686 4.686 12.284 4.686 16.971 0l299.813-299.813c4.686-4.686 4.686-12.284 0-16.971l-28.284-28.284c-4.686-4.686-12.284-4.686-16.97 0z"})}),wF=e=>{const t=e.toString();return t.includes(".")?t:t+".0"},xF=({rate:e,onSelect:t,selectedRate:n,keyboardSelectedRate:r})=>{const o=d.useCallback(p=>{p.stopPropagation(),p.preventDefault(),t(e)},[t,e]),[i,s]=d.useState(!1),a=d.useCallback(()=>{s(!0)},[]),l=d.useCallback(()=>{s(!1)},[]),c=r===e,f=d.useMemo(()=>({...mF,backgroundColor:i||c?"#eee":"transparent"}),[i,c]);return u.jsxs("div",{onPointerEnter:a,onPointerLeave:l,tabIndex:0,style:f,onClick:o,children:[u.jsx("div",{style:gF,children:e===n?u.jsx(vF,{}):null}),wF(e),"x"]},e)},bF=({setIsComponentVisible:e,playbackRates:t,canvasSize:n})=>{const{setPlaybackRate:r,playbackRate:o}=xe.usePlaybackRate(),[i,s]=d.useState(o);d.useEffect(()=>{const c=f=>{if(f.preventDefault(),f.key==="ArrowUp"){const p=t.findIndex(m=>m===i);if(p===0)return;s(p===-1?t[0]:t[p-1])}else if(f.key==="ArrowDown"){const p=t.findIndex(m=>m===i);if(p===t.length-1)return;s(p===-1?t[t.length-1]:t[p+1])}else f.key==="Enter"&&(r(i),e(!1))};return window.addEventListener("keydown",c),()=>{window.removeEventListener("keydown",c)}},[t,i,r,e]);const a=d.useCallback(c=>{r(c),e(!1)},[e,r]),l=d.useMemo(()=>({position:"absolute",right:0,width:125,maxHeight:n.height-hF-pF,bottom:35,background:"#fff",borderRadius:4,overflow:"auto",color:"black",textAlign:"left"}),[n.height]);return u.jsx("div",{style:l,children:t.map(c=>u.jsx(xF,{selectedRate:o,onSelect:a,rate:c,keyboardSelectedRate:i},c))})},SF={fontSize:13,fontWeight:"bold",color:"white",border:"2px solid white",borderRadius:20,paddingLeft:8,paddingRight:8,paddingTop:2,paddingBottom:2},ap={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"},kF={...ap,position:"relative"},EF=({playbackRates:e,canvasSize:t})=>{const{ref:n,isComponentVisible:r,setIsComponentVisible:o}=fF(!1),{playbackRate:i}=xe.usePlaybackRate(),s=d.useCallback(a=>{a.stopPropagation(),a.preventDefault(),o(l=>!l)},[o]);return u.jsx("div",{ref:n,children:u.jsxs("button",{type:"button","aria-label":"Change playback rate",style:kF,onClick:s,children:[u.jsxs("div",{style:SF,children:[i,"x"]}),r&&u.jsx(bF,{canvasSize:t,playbackRates:e,setIsComponentVisible:o})]})})},by=(e,t,n)=>Math.round(ns(e,[0,n],[0,t-1],{extrapolateLeft:"clamp",extrapolateRight:"clamp"})),Ti=5,Is=12,lp=4,CF={userSelect:"none",WebkitUserSelect:"none",paddingTop:lp,paddingBottom:lp,boxSizing:"border-box",cursor:"pointer",position:"relative",touchAction:"none"},IF={height:Ti,backgroundColor:"rgba(255, 255, 255, 0.25)",width:"100%",borderRadius:Ti/2},TF=e=>{let t=e;for(;t.parentElement;)t=t.parentElement;return t},jF=({durationInFrames:e,onSeekEnd:t,onSeekStart:n,inFrame:r,outFrame:o})=>{const i=d.useRef(null),s=zh(i,!1),a=Bh(i,{triggerOnWindowResize:!0,shouldApplyCssTransforms:!0}),{seek:l,play:c,pause:f,playing:p}=Ec(),m=xe.Timeline.useTimelinePosition(),[g,w]=d.useState({dragging:!1}),x=(a==null?void 0:a.width)??0,k=d.useCallback(E=>{var j;if(E.button!==0)return;const C=(j=i.current)==null?void 0:j.getBoundingClientRect().left,I=by(E.clientX-C,e,x);f(),l(I),w({dragging:!0,wasPlaying:p}),n()},[e,x,f,l,p,n]),h=d.useCallback(E=>{var j;if(!a)throw new Error("Player has no size");if(!g.dragging)return;const C=(j=i.current)==null?void 0:j.getBoundingClientRect().left,I=by(E.clientX-C,e,a.width);l(I)},[g.dragging,e,l,a]),y=d.useCallback(()=>{w({dragging:!1}),g.dragging&&(g.wasPlaying?c():f(),t())},[g,t,f,c]);d.useEffect(()=>{if(!g.dragging)return;const E=TF(i.current);return E.addEventListener("pointermove",h),E.addEventListener("pointerup",y),()=>{E.removeEventListener("pointermove",h),E.removeEventListener("pointerup",y)}},[g.dragging,h,y]);const v=d.useMemo(()=>({height:Is,width:Is,borderRadius:Is/2,position:"absolute",top:lp-Is/2+5/2,backgroundColor:"white",left:Math.max(0,m/Math.max(1,e-1)*x-Is/2),boxShadow:"0 0 2px black",opacity:Number(s||g.dragging)}),[s,g.dragging,e,m,x]),b=d.useMemo(()=>({height:Ti,backgroundColor:"rgba(255, 255, 255, 1)",width:(m-(r??0))/(e-1)*x,marginLeft:(r??0)/(e-1)*x,borderRadius:Ti/2}),[e,m,r,x]),S=d.useMemo(()=>({height:Ti,backgroundColor:"rgba(255, 255, 255, 0.25)",width:((o??e-1)-(r??0))/(e-1)*100+"%",marginLeft:(r??0)/(e-1)*100+"%",borderRadius:Ti/2,position:"absolute"}),[e,r,o]);return u.jsxs("div",{ref:i,onPointerDown:k,style:CF,children:[u.jsxs("div",{style:IF,children:[u.jsx("div",{style:S}),u.jsx("div",{style:b})]}),u.jsx("div",{style:v})]})},Sy=e=>{const t=Math.floor(e/60),n=Math.floor(e-t*60);return`${String(t)}:${String(n).padStart(2,"0")}`},RF=({durationInFrames:e,maxTimeLabelWidth:t,fps:n})=>{const r=xe.Timeline.useTimelinePosition(),o=d.useMemo(()=>({color:"white",fontFamily:"sans-serif",fontSize:14,maxWidth:t===null?void 0:t,overflow:"hidden",textOverflow:"ellipsis"}),[t]),s=r===e-1?r+1:r;return u.jsxs("div",{style:o,children:[Sy(s/n)," / ",Sy(e/n)]})},FF=10,up=12,PF=({allowFullscreen:e,playerWidth:t})=>d.useMemo(()=>{const r=zt,o=zt,i=e?sp:0,s=o+r+i+up*2+FF*2,a=t-s,l=Math.max(a,0),c=l-$o,p=(c<$o?l:c)+s+$o,m=t<p;return{maxTimeLabelWidth:l===0?null:l,displayVerticalVolumeSlider:m}},[e,t]),$F=[0,.013,.049,.104,.175,.259,.352,.45,.55,.648,.741,.825,.896,.951,.987],MF=[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],_F=1/.7,AF={boxSizing:"border-box",position:"absolute",bottom:0,width:"100%",paddingTop:40,paddingBottom:10,backgroundImage:`linear-gradient(to bottom,${$F.map((e,t)=>`hsla(0, 0%, 0%, ${e}) ${MF[t]*_F}%`).join(", ")}, hsl(0, 0%, 0%) 100%)`,backgroundSize:"auto 145px",display:"flex",paddingRight:up,paddingLeft:up,flexDirection:"column",transition:"opacity 0.3s"},NF={display:"flex",flexDirection:"row",width:"100%",alignItems:"center",justifyContent:"center",userSelect:"none",WebkitUserSelect:"none"},LF={display:"flex",flexDirection:"row",userSelect:"none",WebkitUserSelect:"none",alignItems:"center"},Ts={width:12},OF={height:8},DF={flex:1},zF={},BF=({durationInFrames:e,isFullscreen:t,fps:n,showVolumeControls:r,onFullscreenButtonClick:o,allowFullscreen:i,onExitFullscreenButtonClick:s,spaceKeyToPlayOrPause:a,onSeekEnd:l,onSeekStart:c,inFrame:f,outFrame:p,initiallyShowControls:m,canvasSize:g,renderPlayPauseButton:w,renderFullscreenButton:x,alwaysShowControls:k,showPlaybackRateControl:h,containerRef:y,buffering:v,hideControlsWhenPointerDoesntMove:b,onPointerDown:S,onDoubleClick:E,renderMuteButton:C,renderVolumeSlider:I,playing:j,toggle:F,renderCustomControls:N})=>{const K=d.useRef(null),[M,$]=d.useState(!1),U=zh(y,b),{maxTimeLabelWidth:Y,displayVerticalVolumeSlider:A}=PF({allowFullscreen:i,playerWidth:(g==null?void 0:g.width)??0}),[T,W]=d.useState(()=>{if(typeof m=="boolean")return m;if(typeof m=="number"){if(m%1!==0)throw new Error("initiallyShowControls must be an integer or a boolean");if(Number.isNaN(m))throw new Error("initiallyShowControls must not be NaN");if(!Number.isFinite(m))throw new Error("initiallyShowControls must be finite");if(m<=0)throw new Error("initiallyShowControls must be a positive integer");return m}throw new TypeError("initiallyShowControls must be a number or a boolean")}),B=d.useMemo(()=>({...AF,opacity:Number(U||!j||T||k)}),[U,T,j,k]);d.useEffect(()=>{K.current&&a&&K.current.focus({preventScroll:!0})},[j,a]),d.useEffect(()=>{$((typeof document<"u"&&(document.fullscreenEnabled||document.webkitFullscreenEnabled))??!1)},[]),d.useEffect(()=>{if(T===!1)return;const J=setTimeout(()=>{W(!1)},T===!0?2e3:T);return()=>{clearInterval(J)}},[T]);const D=d.useMemo(()=>{if(h===!0)return[.5,.8,1,1.2,1.5,1.8,2,2.5,3];if(Array.isArray(h)){for(const oe of h){if(typeof oe!="number")throw new Error("Every item in showPlaybackRateControl must be a number");if(oe<=0)throw new Error("Every item in showPlaybackRateControl must be positive")}return h}return null},[h]),se=N?N():null,ie=d.useRef(null),L=d.useRef(null),V=d.useCallback(oe=>{(oe.target===ie.current||oe.target===L.current)&&(S==null||S(oe))},[S]),ue=d.useCallback(oe=>{(oe.target===ie.current||oe.target===L.current)&&(E==null||E(oe))},[E]);return u.jsxs("div",{ref:ie,style:B,onPointerDown:V,onDoubleClick:ue,children:[u.jsxs("div",{ref:L,style:NF,children:[u.jsxs("div",{style:LF,children:[u.jsx("button",{ref:K,type:"button",style:ap,onClick:F,"aria-label":j?"Pause video":"Play video",title:j?"Pause video":"Play video",children:w===null?u.jsx(wy,{buffering:v,playing:j}):w({playing:j,isBuffering:v})??u.jsx(wy,{buffering:v,playing:j})}),r?u.jsxs(u.Fragment,{children:[u.jsx("div",{style:Ts}),u.jsx(dF,{renderMuteButton:C,renderVolumeSlider:I,displayVerticalVolumeSlider:A})]}):null,u.jsx("div",{style:Ts}),u.jsx(RF,{durationInFrames:e,fps:n,maxTimeLabelWidth:Y}),u.jsx("div",{style:Ts})]}),u.jsx("div",{style:DF}),se,se&&D&&g?u.jsx("div",{style:Ts}):null,D&&g&&u.jsx(EF,{canvasSize:g,playbackRates:D}),D&&M&&i?u.jsx("div",{style:Ts}):null,u.jsx("div",{style:zF,children:M&&i?u.jsx("button",{type:"button","aria-label":t?"Exit fullscreen":"Enter Fullscreen",title:t?"Exit fullscreen":"Enter Fullscreen",style:ap,onClick:t?s:o,children:x===null?u.jsx(VR,{isFullscreen:t}):x({isFullscreen:t})}):null})]}),u.jsx("div",{style:OF}),u.jsx(jF,{onSeekEnd:l,onSeekStart:c,durationInFrames:e,inFrame:f,outFrame:p})]})},Db=typeof document>"u",WF=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}}},VF=e=>new Promise(t=>setTimeout(t,e)),HF=()=>{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])},UF=(e,t,n)=>{const r=HF(),o=d.useCallback(async l=>{if(l instanceof PointerEvent?l.pointerType==="touch":l.nativeEvent.pointerType==="touch"){e(l);return}r.clearPendingPromises();const c=WF(VF(200));r.appendPendingPromise(c);try{await c.promise,r.removePendingPromise(c),e(l)}catch(f){const p=f;if(r.removePendingPromise(c),!p.isCanceled)throw p.error}},[r,e]),i=d.useCallback(()=>{document.addEventListener("pointerup",l=>{o(l)},{once:!0})},[o]),s=d.useCallback(()=>{r.clearPendingPromises(),t()},[r,t]);return d.useMemo(()=>n?{handlePointerDown:i,handleDoubleClick:s}:{handlePointerDown:e,handleDoubleClick:()=>{}},[n,s,i,e])},cp=me.version.split(".")[0];if(cp==="0")throw new Error(`Version ${cp} of "react" is not supported by Remotion`);var ZF=parseInt(cp,10)>=18,KF=({controls:e,style:t,loop:n,autoPlay:r,allowFullscreen:o,inputProps:i,clickToPlay:s,showVolumeControls:a,doubleClickToFullscreen:l,spaceKeyToPlayOrPause:c,errorFallback:f,playbackRate:p,renderLoading:m,renderPoster:g,className:w,moveToBeginningWhenEnded:x,showPosterWhenUnplayed:k,showPosterWhenEnded:h,showPosterWhenPaused:y,showPosterWhenBuffering:v,showPosterWhenBufferingAndPaused:b,inFrame:S,outFrame:E,initiallyShowControls:C,renderFullscreen:I,renderPlayPauseButton:j,renderMuteButton:F,renderVolumeSlider:N,renderCustomControls:K,alwaysShowControls:M,showPlaybackRateControl:$,posterFillMode:U,bufferStateDelayInMilliseconds:Y,hideControlsWhenPointerDoesntMove:A,overflowVisible:T,browserMediaControlsBehavior:W,overrideInternalClassName:B,noSuspense:D},se)=>{const ie=xe.useUnsafeVideoConfig(),L=xe.useVideo(),V=d.useRef(null),ue=Bh(V,{triggerOnWindowResize:!1,shouldApplyCssTransforms:!1}),[oe,J]=d.useState(!1),[ae,fe]=d.useState(r),[pe,q]=d.useState(()=>!1),[R,G]=d.useState(!1),P=d.useMemo(()=>typeof document>"u"?!1:!!(document.fullscreenEnabled||document.webkitFullscreenEnabled),[]),z=Ec(),Z=z.toggle,{playerMuted:O,mediaVolume:re}=d.useContext(xe.MediaVolumeContext);d.useEffect(()=>{z.emitter.dispatchVolumeChange(re)},[z.emitter,re]);const te=O||re===0;d.useEffect(()=>{z.emitter.dispatchMuteChange({isMuted:te})},[z.emitter,te]),oF({loop:n,playbackRate:p,moveToBeginningWhenEnded:x,inFrame:S,outFrame:E,getCurrentFrame:z.getCurrentFrame,browserMediaControlsBehavior:W,muted:te}),d.useEffect(()=>{oe&&!z.playing&&(J(!1),z.play())},[oe,z]),d.useEffect(()=>{const{current:H}=V;if(!H)return;const ne=()=>{const ge=document.fullscreenElement===H||document.webkitFullscreenElement===H;q(ge)};return document.addEventListener("fullscreenchange",ne),document.addEventListener("webkitfullscreenchange",ne),()=>{document.removeEventListener("fullscreenchange",ne),document.removeEventListener("webkitfullscreenchange",ne)}},[]);const Se=d.useCallback(H=>{Z(H)},[Z]),Ie=d.useCallback(()=>{if(!o)throw new Error("allowFullscreen is false");if(!P)throw new Error("Browser doesnt support fullscreen");if(!V.current)throw new Error("No player ref found");V.current.webkitRequestFullScreen?V.current.webkitRequestFullScreen():V.current.requestFullscreen()},[o,P]),_e=d.useCallback(()=>{document.webkitExitFullscreen?document.webkitExitFullscreen():document.exitFullscreen()},[]);d.useEffect(()=>{const{current:H}=V;if(!H)return;const ne=()=>{const ge=document.webkitFullscreenElement??document.fullscreenElement;ge&&ge===V.current?z.emitter.dispatchFullscreenChange({isFullscreen:!0}):z.emitter.dispatchFullscreenChange({isFullscreen:!1})};return H.addEventListener("webkitfullscreenchange",ne),H.addEventListener("fullscreenchange",ne),()=>{H.removeEventListener("webkitfullscreenchange",ne),H.removeEventListener("fullscreenchange",ne)}},[z.emitter]);const we=(ie==null?void 0:ie.durationInFrames)??1,ke=d.useMemo(()=>!ie||!ue?null:Pb({canvasSize:ue,compositionHeight:ie.height,compositionWidth:ie.width,previewSize:"auto"}),[ue,ie]),he=(ke==null?void 0:ke.scale)??1,Ne=d.useRef(!1);d.useEffect(()=>{if(!Ne.current){Ne.current=!0;return}z.emitter.dispatchScaleChange(he)},[z.emitter,he]);const{setMediaVolume:Te,setPlayerMuted:Ue}=d.useContext(xe.SetMediaVolumeContext),[Je,Pt]=d.useState(!1);d.useEffect(()=>{let H=null,ne=!1;const ge=()=>{ne=!1,requestAnimationFrame(()=>{Y===0?Pt(!0):H=setTimeout(()=>{ne||Pt(!0)},Y)})},Ee=()=>{requestAnimationFrame(()=>{ne=!0,Pt(!1),H&&clearTimeout(H)})};return z.emitter.addEventListener("waiting",ge),z.emitter.addEventListener("resume",Ee),()=>{z.emitter.removeEventListener("waiting",ge),z.emitter.removeEventListener("resume",Ee),Pt(!1),H&&clearTimeout(H),ne=!0}},[Y,z.emitter]),d.useImperativeHandle(se,()=>{const H={play:z.play,pause:()=>{J(!1),z.pause()},toggle:Se,getContainerNode:()=>V.current,getCurrentFrame:z.getCurrentFrame,isPlaying:z.isPlaying,seekTo:ne=>{const ge=we-1,Ee=Math.max(0,Math.min(ge,ne));z.isPlaying()&&(J(Ee!==ge||n),z.pause()),Ee===ge&&!n&&z.emitter.dispatchEnded(),z.seek(Ee)},isFullscreen:()=>{const{current:ne}=V;return ne?document.fullscreenElement===ne||document.webkitFullscreenElement===ne:!1},requestFullscreen:Ie,exitFullscreen:_e,getVolume:()=>O?0:re,setVolume:ne=>{if(typeof ne!="number")throw new TypeError(`setVolume() takes a number, got value of type ${typeof ne}`);if(isNaN(ne))throw new TypeError("setVolume() got a number that is NaN. Volume must be between 0 and 1.");if(ne<0||ne>1)throw new TypeError(`setVolume() got a number that is out of range. Must be between 0 and 1, got ${ne}`);Te(ne)},isMuted:()=>te,mute:()=>{Ue(!0)},unmute:()=>{Ue(!1)},getScale:()=>he,pauseAndReturnToPlayStart:()=>{z.pauseAndReturnToPlayStart()}};return Object.assign(z.emitter,H)},[we,_e,n,O,te,re,z,Ie,Ue,Te,Se,he]);const mt=L?L.component:null,Le=d.useMemo(()=>$b({canvasSize:ue,config:ie,style:t,overflowVisible:T,layout:ke}),[ue,ie,ke,T,t]),Qe=d.useMemo(()=>_b({config:ie,layout:ke,scale:he,overflowVisible:T}),[ie,ke,T,he]),Fn=d.useMemo(()=>Mb({config:ie,layout:ke,scale:he,overflowVisible:T}),[ie,ke,T,he]),Ye=z.pause,Pn=z.emitter.dispatchError,cn=d.useCallback(H=>{Ye(),Pn(H)},[Pn,Ye]),Jt=d.useCallback(H=>{H.stopPropagation(),Ie()},[Ie]),$n=d.useCallback(H=>{H.stopPropagation(),_e()},[_e]),Mn=d.useCallback(H=>{(H instanceof MouseEvent?H.button===2:H.nativeEvent.button)||Se(H)},[Se]),sr=d.useCallback(()=>{G(!0)},[]),gt=d.useCallback(()=>{G(!1)},[]),Qt=d.useCallback(()=>{pe?_e():Ie()},[_e,pe,Ie]),{handlePointerDown:dn,handleDoubleClick:Lt}=UF(Mn,Qt,l&&o&&P);d.useEffect(()=>{ae&&(z.play(),fe(!1))},[ae,z]);const Kn=d.useMemo(()=>m?m({height:Le.height,width:Le.width,isBuffering:Je}):null,[Le.height,Le.width,m,Je]),it=d.useMemo(()=>({type:"scale",scale:he}),[he]);if(!ie)return null;const _n=g?g({height:U==="player-size"?Le.height:ie.height,width:U==="player-size"?Le.width:ie.width,isBuffering:Je}):null;if(_n===void 0)throw new TypeError("renderPoster() must return a React element, but undefined was returned");const Lr=_n&&[y&&!z.isPlaying()&&!R,h&&z.isLastFrame&&!z.isPlaying(),k&&!z.hasPlayed&&!z.isPlaying(),v&&Je&&z.isPlaying(),b&&Je&&!z.isPlaying()].some(Boolean),{left:ar,top:ko,width:Or,height:Dr,...Qo}=Qe,_=u.jsxs(u.Fragment,{children:[u.jsxs("div",{style:Qe,onPointerDown:s?dn:void 0,onDoubleClick:l?Lt:void 0,children:[u.jsxs("div",{style:Fn,className:Wh(B),children:[mt?u.jsx(Ob,{onError:cn,errorFallback:f,children:u.jsx(xe.CurrentScaleContext.Provider,{value:it,children:u.jsx(mt,{...(L==null?void 0:L.props)??{},...i??{}})})}):null,Lr&&U==="composition-size"?u.jsx("div",{style:{...Qo,width:ie.width,height:ie.height},onPointerDown:s?dn:void 0,onDoubleClick:l?Lt:void 0,children:_n}):null]}),u.jsx(lF,{})]}),Lr&&U==="player-size"?u.jsx("div",{style:Qe,onPointerDown:s?dn:void 0,onDoubleClick:l?Lt:void 0,children:_n}):null,e?u.jsx(BF,{fps:ie.fps,playing:z.playing,toggle:z.toggle,durationInFrames:ie.durationInFrames,containerRef:V,onFullscreenButtonClick:Jt,isFullscreen:pe,allowFullscreen:o,showVolumeControls:a,onExitFullscreenButtonClick:$n,spaceKeyToPlayOrPause:c,onSeekEnd:gt,onSeekStart:sr,inFrame:S,outFrame:E,initiallyShowControls:C,canvasSize:ue,renderFullscreenButton:I,renderPlayPauseButton:j,alwaysShowControls:M,showPlaybackRateControl:$,buffering:Je,hideControlsWhenPointerDoesntMove:A,onDoubleClick:l?Lt:void 0,onPointerDown:s?dn:void 0,renderMuteButton:F,renderVolumeSlider:N,renderCustomControls:K}):null]});return D||Db&&!ZF?u.jsx("div",{ref:V,style:Le,className:w,children:_}):u.jsx("div",{ref:V,style:Le,className:w,children:u.jsx(d.Suspense,{fallback:Kn,children:_})})},YF=d.forwardRef(KF),zb="remotion.volumePreference",GF=(e,t,n)=>{if(!(typeof window>"u"))try{window.localStorage.setItem(n??zb,String(e))}catch(r){xe.Log.error({logLevel:t,tag:null},"Could not persist volume",r)}},XF=e=>{if(typeof window>"u")return 1;try{const t=window.localStorage.getItem(e??zb);return t?Number(t):1}catch{return 1}},Vh="player-comp",Bb=({children:e,timelineContext:t,playbackRateContext:n,fps:r,compositionHeight:o,compositionWidth:i,durationInFrames:s,component:a,numberOfSharedAudioTags:l,initiallyMuted:c,logLevel:f,audioLatencyHint:p,sampleRate:m,volumePersistenceKey:g,initialVolume:w,inputProps:x,audioEnabled:k})=>{const h=w===void 0,y=d.useMemo(()=>({compositions:[{component:a,durationInFrames:s,height:o,width:i,fps:r,id:Vh,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:x},canvasContent:{type:"composition",compositionId:"player-comp"}}),[a,s,o,i,r,x]),[v,b]=d.useState(()=>c),[S,E]=d.useState(()=>h?XF(g??null):w),C=d.useMemo(()=>({playerMuted:v,mediaVolume:S}),[v,S]),I=d.useRef(!1),j=I.current||k&&!v&&S>0;I.current=j;const F=d.useCallback($=>{E($),h&&GF($,f,g??null)},[h,f,g]),N=d.useMemo(()=>({setPlayerMuted:b,setMediaVolume:F}),[F]),K=d.useMemo(()=>({logLevel:f,mountTime:Date.now()}),[f]),M=d.useMemo(()=>({isPlayer:!0,isRendering:!1,isStudio:!1,isClientSideRendering:!1,isReadOnlyStudio:!1}),[]);return u.jsx(xe.RemotionEnvironmentContext.Provider,{value:M,children:u.jsx(xe.LogLevelContext.Provider,{value:K,children:u.jsx(xe.CanUseRemotionHooksProvider,{children:u.jsx(xe.AbsoluteTimeContext.Provider,{value:t,children:u.jsx(xe.PlaybackRateContext.Provider,{value:n,children:u.jsx(xe.TimelineContext.Provider,{value:t,children:u.jsx(xe.CompositionManager.Provider,{value:y,children:u.jsx(xe.PrefetchProvider,{children:u.jsx(xe.DurationsContextProvider,{children:u.jsx(xe.MediaVolumeContext.Provider,{value:C,children:u.jsx(xe.SetMediaVolumeContext.Provider,{value:N,children:u.jsx(xe.BufferingProvider,{children:u.jsx(xe.SharedAudioContextProvider,{audioLatencyHint:p,audioEnabled:j,previewSampleRate:m,children:u.jsx(xe.SharedAudioTagsContextProvider,{numberOfAudioTags:l,children:e})})})})})})})})})})})})})})},ky=!1,qF=(e,t)=>{e||ky||(ky=!0,xe.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."))},Ey=(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},JF=({inFrame:e,durationInFrames:t,outFrame:n})=>{const r=Ey(e,"inFrame"),o=Ey(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)}},QF=({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)}`)}},eP=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.")}},tP=kc.validateFps,Cy=kc.validateDimension,nP=kc.validateDurationInFrames,rP=kc.validateDefaultAndInputProps,oP=e=>"component"in e?e.component:null,iP=({durationInFrames:e,compositionHeight:t,compositionWidth:n,fps:r,inputProps:o,style:i,controls:s=!1,loop:a=!1,autoPlay:l=!1,showVolumeControls:c=!0,allowFullscreen:f=!0,clickToPlay:p,doubleClickToFullscreen:m=!1,spaceKeyToPlayOrPause:g=!0,moveToBeginningWhenEnded:w=!0,numberOfSharedAudioTags:x=5,errorFallback:k=()=>"⚠️",playbackRate:h=1,renderLoading:y,className:v,showPosterWhenUnplayed:b,showPosterWhenEnded:S,showPosterWhenPaused:E,showPosterWhenBuffering:C,showPosterWhenBufferingAndPaused:I,initialFrame:j,renderPoster:F,inFrame:N,outFrame:K,initiallyShowControls:M,renderFullscreenButton:$,renderPlayPauseButton:U,renderVolumeSlider:Y,renderCustomControls:A,alwaysShowControls:T=!1,initiallyMuted:W=!1,showPlaybackRateControl:B=!1,posterFillMode:D="player-size",bufferStateDelayInMilliseconds:se,hideControlsWhenPointerDoesntMove:ie=!0,overflowVisible:L=!1,renderMuteButton:V,browserMediaControlsBehavior:ue,overrideInternalClassName:oe,logLevel:J="info",noSuspense:ae,acknowledgeRemotionLicense:fe,audioLatencyHint:pe="playback",sampleRate:q=48e3,volumePersistenceKey:R,initialVolume:G,...P},z)=>{if(typeof window<"u"&&(window.remotion_isPlayer=!0),P.defaultProps!==void 0)throw new Error("The <Player /> component does not accept `defaultProps`, but some were passed. Use `inputProps` instead.");const Z=oP(P);if((Z==null?void 0:Z.type)===ku)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(Z===ku)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(()=>qF(!!fe,J));const O=xe.useLazyComponent({compProps:P,componentName:"Player",noSuspense:!!ae});QF({initialFrame:j,durationInFrames:e});const[re,te]=d.useState(()=>({[Vh]:j??0})),[Se,Ie]=d.useState(!1),[_e]=d.useState("player-comp"),we=d.useRef(null),ke=d.useRef([]),he=d.useRef(!1),[Ne,Te]=d.useState(h);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(Cy(t,"compositionHeight","of the <Player /> component"),Cy(n,"compositionWidth","of the <Player /> component"),nP(e,{component:"of the <Player/> component",allowFloats:!1}),tP(r,"as a prop of the <Player/> component",!1),rP(o,"inputProps",null),JF({durationInFrames:e,inFrame:N,outFrame:K}),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 m!="boolean"&&typeof m<"u")throw new TypeError(`'doubleClickToFullscreen' must be a boolean or undefined but got '${typeof m}' instead`);if(typeof c!="boolean"&&typeof c<"u")throw new TypeError(`'showVolumeControls' must be a boolean or undefined but got '${typeof c}' instead`);if(typeof f!="boolean"&&typeof f<"u")throw new TypeError(`'allowFullscreen' must be a boolean or undefined but got '${typeof f}' instead`);if(typeof p!="boolean"&&typeof p<"u")throw new TypeError(`'clickToPlay' must be a boolean or undefined but got '${typeof p}' instead`);if(typeof g!="boolean"&&typeof g<"u")throw new TypeError(`'spaceKeyToPlayOrPause' must be a boolean or undefined but got '${typeof g}' instead`);if(typeof q!="number"||!Number.isFinite(q)||Number.isNaN(q)||q<=0||q%1!==0)throw new TypeError(`'sampleRate' must be a positive integer but got '${q}' instead`);if(typeof G<"u"&&typeof G!="number")throw new TypeError(`'initialVolume' must be a number or undefined but got '${typeof G}' instead`);if(typeof G=="number"&&(!Number.isFinite(G)||Number.isNaN(G)||G<0||G>1))throw new TypeError(`'initialVolume' must be between 0 and 1 but got '${G}' instead`);if(typeof x!="number"||x%1!==0||!Number.isFinite(x)||Number.isNaN(x)||x<0)throw new TypeError(`'numberOfSharedAudioTags' must be an integer but got '${x}' instead`);eP(Ne),d.useEffect(()=>{Te(h)},[h]),d.useImperativeHandle(z,()=>we.current,[]),d.useState(()=>{xe.playbackLogging({logLevel:J,message:`[player] Mounting <Player>. User agent = ${typeof navigator>"u"?"server":navigator.userAgent}`,tag:"player",mountTime:Date.now()})});const Ue=d.useMemo(()=>({frame:re,playing:Se,rootId:_e,imperativePlaying:he,audioAndVideoTags:ke}),[re,Se,_e]),Je=d.useMemo(()=>({playbackRate:Ne,setPlaybackRate:Te}),[Ne]),Pt=d.useMemo(()=>({setFrame:te,setPlaying:Ie}),[te]);typeof window<"u"&&d.useLayoutEffect(()=>{xe.CSSUtils.injectCSS(xe.CSSUtils.makeDefaultPreviewCSS(`.${Wh(oe)}`,"#fff"))},[oe]);const mt=d.useMemo(()=>o??{},[o]),Le=d.useMemo(()=>ue??{mode:"prevent-media-session"},[ue]);return u.jsx(xe.IsPlayerContextProvider,{children:u.jsx(Bb,{timelineContext:Ue,playbackRateContext:Je,component:O,compositionHeight:t,compositionWidth:n,durationInFrames:e,fps:r,numberOfSharedAudioTags:x,initiallyMuted:W,logLevel:J,audioLatencyHint:pe,sampleRate:q,volumePersistenceKey:R,initialVolume:G,inputProps:mt,audioEnabled:!0,children:u.jsx(xe.SetTimelineContext.Provider,{value:Pt,children:u.jsx(JR,{currentPlaybackRate:Ne,children:u.jsx(YF,{ref:we,posterFillMode:D,renderLoading:y,autoPlay:!!l,loop:!!a,controls:!!s,errorFallback:k,style:i,inputProps:mt,allowFullscreen:!!f,moveToBeginningWhenEnded:!!w,clickToPlay:typeof p=="boolean"?p:!!s,showVolumeControls:!!c,doubleClickToFullscreen:!!m,spaceKeyToPlayOrPause:!!g,playbackRate:Ne,className:v??void 0,showPosterWhenUnplayed:!!b,showPosterWhenEnded:!!S,showPosterWhenPaused:!!E,showPosterWhenBuffering:!!C,showPosterWhenBufferingAndPaused:!!I,renderPoster:F,inFrame:N??null,outFrame:K??null,initiallyShowControls:M??!0,renderFullscreen:$??null,renderPlayPauseButton:U??null,renderMuteButton:V??null,renderVolumeSlider:Y??null,renderCustomControls:A??null,alwaysShowControls:T,showPlaybackRateControl:B,bufferStateDelayInMilliseconds:se??300,hideControlsWhenPointerDoesntMove:ie,overflowVisible:L,browserMediaControlsBehavior:Le,overrideInternalClassName:oe??void 0,noSuspense:!!ae})})})})})},sP=d.forwardRef,aP=sP(iP),lP=()=>{const e=d.useContext(Nb);if(!e)throw new TypeError("Expected Player event emitter context");return d.useMemo(()=>({emitter:e}),[e])},dp=me.version.split(".")[0];if(dp==="0")throw new Error(`Version ${dp} of "react" is not supported by Remotion`);var uP=parseInt(dp,10)>=18,cP=({style:e,inputProps:t,errorFallback:n,renderLoading:r,className:o,overflowVisible:i,noSuspense:s,overrideInternalClassName:a},l)=>{const c=xe.useUnsafeVideoConfig(),f=xe.useVideo(),p=d.useRef(null),m=Bh(p,{triggerOnWindowResize:!1,shouldApplyCssTransforms:!1}),g=d.useMemo(()=>!c||!m?null:Pb({canvasSize:m,compositionHeight:c.height,compositionWidth:c.width,previewSize:"auto"}),[m,c]),w=(g==null?void 0:g.scale)??1,x=lP();Lb(x.emitter),d.useImperativeHandle(l,()=>{const I={getContainerNode:()=>p.current,getScale:()=>w};return Object.assign(x.emitter,I)},[w,x.emitter]);const k=f?f.component:null,h=d.useMemo(()=>$b({config:c,style:e,canvasSize:m,overflowVisible:i,layout:g}),[m,c,g,i,e]),y=d.useMemo(()=>_b({config:c,layout:g,scale:w,overflowVisible:i}),[c,g,i,w]),v=d.useMemo(()=>Mb({config:c,layout:g,scale:w,overflowVisible:i}),[c,g,i,w]),b=d.useCallback(I=>{x.emitter.dispatchError(I)},[x.emitter]),S=d.useMemo(()=>r?r({height:h.height,width:h.width,isBuffering:!1}):null,[h.height,h.width,r]),E=d.useMemo(()=>({type:"scale",scale:w}),[w]);if(!c)return null;const C=u.jsx("div",{style:y,children:u.jsx("div",{style:v,className:Wh(a),children:k?u.jsx(Ob,{onError:b,errorFallback:n,children:u.jsx(xe.CurrentScaleContext.Provider,{value:E,children:u.jsx(k,{...(f==null?void 0:f.props)??{},...t??{}})})}):null})});return s||Db&&!uP?u.jsx("div",{ref:p,style:h,className:o,children:C}):u.jsx("div",{ref:p,style:h,className:o,children:u.jsx(d.Suspense,{fallback:S,children:C})})},dP=d.forwardRef(cP),fP=({frameToDisplay:e,style:t,inputProps:n,compositionHeight:r,compositionWidth:o,durationInFrames:i,fps:s,className:a,errorFallback:l=()=>"⚠️",renderLoading:c,overflowVisible:f=!1,overrideInternalClassName:p,logLevel:m="info",noSuspense:g,...w},x)=>{typeof window<"u"&&d.useLayoutEffect(()=>{window.remotion_isPlayer=!0},[]);const[k]=d.useState(()=>String(Yo(null))),h=d.useRef(null),y=d.useMemo(()=>({playing:!1,frame:{[Vh]:e},rootId:k,imperativePlaying:{current:!1},audioAndVideoTags:{current:[]}}),[e,k]),v=d.useMemo(()=>({playbackRate:1,setPlaybackRate:()=>{throw new Error("thumbnail")}}),[]);d.useImperativeHandle(x,()=>h.current,[]);const b=xe.useLazyComponent({compProps:w,componentName:"Thumbnail",noSuspense:!!g}),[S]=d.useState(()=>new qR),E=d.useMemo(()=>n??{},[n]);return u.jsx(xe.IsPlayerContextProvider,{children:u.jsx(Bb,{timelineContext:y,playbackRateContext:v,component:b,compositionHeight:r,compositionWidth:o,durationInFrames:i,fps:s,numberOfSharedAudioTags:0,initiallyMuted:!0,logLevel:m,audioLatencyHint:"playback",sampleRate:48e3,inputProps:E,audioEnabled:!1,children:u.jsx(Nb.Provider,{value:S,children:u.jsx(dP,{ref:h,className:a,errorFallback:l,inputProps:E,renderLoading:c,style:t,overflowVisible:f,overrideInternalClassName:p,noSuspense:!!g})})})})},pP=d.forwardRef;pP(fP);const Ni=[1,1.5,2,4];function Iy(e){return Ni.find(t=>t>e+1e-9)??Ni[Ni.length-1]}function hP(e,t){switch(t){case"L":return e.playing&&e.rate>0?{rate:Iy(e.rate),playing:!0}:{rate:Ni[0],playing:!0};case"J":return e.playing&&e.rate<0?{rate:-Iy(-e.rate),playing:!0}:{rate:-Ni[0],playing:!0};case"K":return{rate:Ni[0],playing:!e.playing}}}function Cc(e,t,n){const r=Math.round(e*n),o=Math.round(t*n);return{from:r,durationInFrames:Math.max(1,o-r)}}function mP(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 gP(e,t,n,r){const o=t?t.scale:n,i=[];let s=!1;for(let a=0;a<e.length;a++){const l=e[a-1],c=l?e[a].srcIn-l.srcOut:0;a>0&&c>=r&&(s=!s);const f=t?t.allowed[a]!==!1:!0;i.push(s&&f?o:1)}return i}const yP=({src:e,spans:t,punchInScale:n=1.07,punch:r=null,punchThresholdSec:o=.15,audioFadeSec:i=.01,background:s="black"})=>{const{fps:a}=pt(),l=d.useMemo(()=>gP(t,r,n,o),[t,r,n,o]),c=Math.max(1,Math.round(i*a));return u.jsx(Tn,{style:{backgroundColor:s},children:t.map((f,p)=>{const{from:m,durationInFrames:g}=Cc(f.outIn,f.outOut,a);return u.jsx(Ft,{from:m,durationInFrames:g,premountFor:a,children:u.jsx(Tn,{style:{transform:`scale(${l[p]})`},children:u.jsx(jb,{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)/c,(g-w)/c))})})},p)})})};function Q(e,t,n){function r(a,l){var c;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(c=a._zod).traits??(c.traits=new Set),a._zod.traits.add(e),t(a,l);for(const f in s.prototype)f in a||Object.defineProperty(a,f,{value:s.prototype[f].bind(a)});a._zod.constr=s,a._zod.def=l}const o=(n==null?void 0:n.Parent)??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function s(a){var l;const c=n!=null&&n.Parent?new i:this;r(c,a),(l=c._zod).deferred??(l.deferred=[]);for(const f of c._zod.deferred)f();return c}return Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>{var l,c;return n!=null&&n.Parent&&a instanceof n.Parent?!0:(c=(l=a==null?void 0:a._zod)==null?void 0:l.traits)==null?void 0:c.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}class ma extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const Wb={};function ho(e){return Wb}function Vb(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 vP(e,t){return typeof t=="bigint"?t.toString():t}function Hb(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Hh(e){return e==null}function Uh(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function wP(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 nt(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 Zh(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function js(e){return JSON.stringify(e)}const Ub=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function fp(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const xP=Hb(()=>{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 Ru(e){if(fp(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(fp(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}const bP=new Set(["string","number","symbol"]);function La(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Jo(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 Ce(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 SP(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const kP={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 EP(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 Jo(e,{...e._zod.def,shape:n,checks:[]})}function CP(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 Jo(e,{...e._zod.def,shape:n,checks:[]})}function IP(e,t){if(!Ru(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 Zh(this,"shape",r),r},checks:[]};return Jo(e,n)}function TP(e,t){return Jo(e,{...e._zod.def,get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return Zh(this,"shape",n),n},catchall:t._zod.def.catchall,checks:[]})}function jP(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 Jo(t,{...t._zod.def,shape:o,checks:[]})}function RP(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 Jo(t,{...t._zod.def,shape:o,checks:[]})}function Ks(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 Mo(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function yl(e){return typeof e=="string"?e:e==null?void 0:e.message}function mo(e,t,n){var o,i,s,a,l,c;const r={...e,path:e.path??[]};if(!e.message){const f=yl((s=(i=(o=e.inst)==null?void 0:o._zod.def)==null?void 0:i.error)==null?void 0:s.call(i,e))??yl((a=t==null?void 0:t.error)==null?void 0:a.call(t,e))??yl((l=n.customError)==null?void 0:l.call(n,e))??yl((c=n.localeError)==null?void 0:c.call(n,e))??"Invalid input";r.message=f}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function Kh(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function ga(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const Zb=(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,vP,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Kb=Q("$ZodError",Zb),Yb=Q("$ZodError",Zb,{Parent:Error});function FP(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 PP(e,t){const n=t||function(i){return i.message},r={_errors:[]},o=i=>{for(const s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>o({issues:a}));else if(s.code==="invalid_key")o({issues:s.issues});else if(s.code==="invalid_element")o({issues:s.issues});else if(s.path.length===0)r._errors.push(n(s));else{let a=r,l=0;for(;l<s.path.length;){const c=s.path[l];l===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(s))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return o(e),r}const $P=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 ma;if(s.issues.length){const a=new((o==null?void 0:o.Err)??e)(s.issues.map(l=>mo(l,i,ho())));throw Ub(a,o==null?void 0:o.callee),a}return s.value},MP=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=>mo(l,i,ho())));throw Ub(a,o==null?void 0:o.callee),a}return s.value},Gb=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 ma;return i.issues.length?{success:!1,error:new(e??Kb)(i.issues.map(s=>mo(s,o,ho())))}:{success:!0,data:i.value}},_P=Gb(Yb),Xb=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=>mo(s,o,ho())))}:{success:!0,data:i.value}},AP=Xb(Yb),NP=/^[cC][^\s-]{8,}$/,LP=/^[0-9a-z]+$/,OP=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,DP=/^[0-9a-vA-V]{20}$/,zP=/^[A-Za-z0-9]{27}$/,BP=/^[a-zA-Z0-9_-]{21}$/,WP=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,VP=/^([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})$/,Ty=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)$/,HP=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,UP="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function ZP(){return new RegExp(UP,"u")}const KP=/^(?:(?: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])$/,YP=/^(([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})$/,GP=/^((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])$/,XP=/^(([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])$/,qP=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,qb=/^[A-Za-z0-9_-]*$/,JP=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,QP=/^\+(?:[0-9]){6,14}[0-9]$/,Jb="(?:(?:\\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])))",e$=new RegExp(`^${Jb}$`);function Qb(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 t$(e){return new RegExp(`^${Qb(e)}$`)}function n$(e){const t=Qb({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(`^${Jb}T(?:${r})$`)}const r$=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}$`)},o$=/^\d+$/,i$=/^-?\d+(?:\.\d+)?/i,s$=/true|false/i,a$=/^[^A-Z]*$/,l$=/^[^a-z]*$/,vn=Q("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),eS={number:"number",bigint:"bigint",object:"date"},tS=Q("$ZodCheckLessThan",(e,t)=>{vn.init(e,t);const n=eS[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})}}),nS=Q("$ZodCheckGreaterThan",(e,t)=>{vn.init(e,t);const n=eS[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})}}),u$=Q("$ZodCheckMultipleOf",(e,t)=>{vn.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):wP(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})}}),c$=Q("$ZodCheckNumberFormat",(e,t)=>{var s;vn.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]=kP[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=o$)}),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})}}),d$=Q("$ZodCheckMaxLength",(e,t)=>{var n;vn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Hh(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=Kh(o);r.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),f$=Q("$ZodCheckMinLength",(e,t)=>{var n;vn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Hh(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=Kh(o);r.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),p$=Q("$ZodCheckLengthEquals",(e,t)=>{var n;vn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Hh(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=Kh(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})}}),Ic=Q("$ZodCheckStringFormat",(e,t)=>{var n,r;vn.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=()=>{})}),h$=Q("$ZodCheckRegex",(e,t)=>{Ic.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})}}),m$=Q("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=a$),Ic.init(e,t)}),g$=Q("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=l$),Ic.init(e,t)}),y$=Q("$ZodCheckIncludes",(e,t)=>{vn.init(e,t);const n=La(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})}}),v$=Q("$ZodCheckStartsWith",(e,t)=>{vn.init(e,t);const n=new RegExp(`^${La(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})}}),w$=Q("$ZodCheckEndsWith",(e,t)=>{vn.init(e,t);const n=new RegExp(`.*${La(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})}}),x$=Q("$ZodCheckOverwrite",(e,t)=>{vn.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class b${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 S$={major:4,minor:0,patch:0},rt=Q("$ZodType",(e,t)=>{var o;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=S$;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const i of r)for(const s of i._zod.onattach)s(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),(o=e._zod.deferred)==null||o.push(()=>{e._zod.run=e._zod.parse});else{const i=(s,a,l)=>{let c=Ks(s),f;for(const p of a){if(p._zod.def.when){if(!p._zod.def.when(s))continue}else if(c)continue;const m=s.issues.length,g=p._zod.check(s);if(g instanceof Promise&&(l==null?void 0:l.async)===!1)throw new ma;if(f||g instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await g,s.issues.length!==m&&(c||(c=Ks(s,m)))});else{if(s.issues.length===m)continue;c||(c=Ks(s,m))}}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 ma;return l.then(c=>i(c,r,a))}return i(l,r,a)}}e["~standard"]={validate:i=>{var s;try{const a=_P(e,i);return a.success?{value:a.data}:{issues:(s=a.error)==null?void 0:s.issues}}catch{return AP(e,i).then(l=>{var c;return l.success?{value:l.data}:{issues:(c=l.error)==null?void 0:c.issues}})}},vendor:"zod",version:1}}),Yh=Q("$ZodString",(e,t)=>{var n;rt.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??r$(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}}),ot=Q("$ZodStringFormat",(e,t)=>{Ic.init(e,t),Yh.init(e,t)}),k$=Q("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=VP),ot.init(e,t)}),E$=Q("$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=Ty(r))}else t.pattern??(t.pattern=Ty());ot.init(e,t)}),C$=Q("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=HP),ot.init(e,t)}),I$=Q("$ZodURL",(e,t)=>{ot.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:JP.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})}}}),T$=Q("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=ZP()),ot.init(e,t)}),j$=Q("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=BP),ot.init(e,t)}),R$=Q("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=NP),ot.init(e,t)}),F$=Q("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=LP),ot.init(e,t)}),P$=Q("$ZodULID",(e,t)=>{t.pattern??(t.pattern=OP),ot.init(e,t)}),$$=Q("$ZodXID",(e,t)=>{t.pattern??(t.pattern=DP),ot.init(e,t)}),M$=Q("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=zP),ot.init(e,t)}),_$=Q("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=n$(t)),ot.init(e,t)}),A$=Q("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=e$),ot.init(e,t)}),N$=Q("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=t$(t)),ot.init(e,t)}),L$=Q("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=WP),ot.init(e,t)}),O$=Q("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=KP),ot.init(e,t),e._zod.onattach.push(n=>{const r=n._zod.bag;r.format="ipv4"})}),D$=Q("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=YP),ot.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})}}}),z$=Q("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=GP),ot.init(e,t)}),B$=Q("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=XP),ot.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 rS(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const W$=Q("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=qP),ot.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64"}),e._zod.check=n=>{rS(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function V$(e){if(!qb.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return rS(n)}const H$=Q("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=qb),ot.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64url"}),e._zod.check=n=>{V$(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),U$=Q("$ZodE164",(e,t)=>{t.pattern??(t.pattern=QP),ot.init(e,t)});function Z$(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 K$=Q("$ZodJWT",(e,t)=>{ot.init(e,t),e._zod.check=n=>{Z$(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),oS=Q("$ZodNumber",(e,t)=>{rt.init(e,t),e._zod.pattern=e._zod.bag.pattern??i$,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}}),Y$=Q("$ZodNumber",(e,t)=>{c$.init(e,t),oS.init(e,t)}),G$=Q("$ZodBoolean",(e,t)=>{rt.init(e,t),e._zod.pattern=s$,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}}),X$=Q("$ZodUnknown",(e,t)=>{rt.init(e,t),e._zod.parse=n=>n}),q$=Q("$ZodNever",(e,t)=>{rt.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function jy(e,t,n){e.issues.length&&t.issues.push(...Mo(n,e.issues)),t.value[n]=e.value}const J$=Q("$ZodArray",(e,t)=>{rt.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const i=[];for(let s=0;s<o.length;s++){const a=o[s],l=t.element._zod.run({value:a,issues:[]},r);l instanceof Promise?i.push(l.then(c=>jy(c,n,s))):jy(l,n,s)}return i.length?Promise.all(i).then(()=>n):n}});function vl(e,t,n){e.issues.length&&t.issues.push(...Mo(n,e.issues)),t.value[n]=e.value}function Ry(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(...Mo(n,e.issues)):e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}const Q$=Q("$ZodObject",(e,t)=>{rt.init(e,t);const n=Hb(()=>{const p=Object.keys(t.shape);for(const g of p)if(!(t.shape[g]instanceof rt))throw new Error(`Invalid element at key "${g}": expected a Zod schema`);const m=SP(t.shape);return{shape:t.shape,keys:p,keySet:new Set(p),numKeys:p.length,optionalKeys:new Set(m)}});nt(e._zod,"propValues",()=>{const p=t.shape,m={};for(const g in p){const w=p[g]._zod;if(w.values){m[g]??(m[g]=new Set);for(const x of w.values)m[g].add(x)}}return m});const r=p=>{const m=new b$(["shape","payload","ctx"]),g=n.value,w=y=>{const v=js(y);return`shape[${v}]._zod.run({ value: input[${v}], issues: [] }, ctx)`};m.write("const input = payload.value;");const x=Object.create(null);let k=0;for(const y of g.keys)x[y]=`key_${k++}`;m.write("const newResult = {}");for(const y of g.keys)if(g.optionalKeys.has(y)){const v=x[y];m.write(`const ${v} = ${w(y)};`);const b=js(y);m.write(`
|
|
137
|
-
if (${v}.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
|
-
${v}.issues.map((iss) => ({
|
|
145
|
-
...iss,
|
|
146
|
-
path: iss.path ? [${b}, ...iss.path] : [${b}],
|
|
147
|
-
}))
|
|
148
|
-
);
|
|
149
|
-
}
|
|
150
|
-
} else if (${v}.value === undefined) {
|
|
151
|
-
if (${b} in input) newResult[${b}] = undefined;
|
|
152
|
-
} else {
|
|
153
|
-
newResult[${b}] = ${v}.value;
|
|
154
|
-
}
|
|
155
|
-
`)}else{const v=x[y];m.write(`const ${v} = ${w(y)};`),m.write(`
|
|
156
|
-
if (${v}.issues.length) payload.issues = payload.issues.concat(${v}.issues.map(iss => ({
|
|
157
|
-
...iss,
|
|
158
|
-
path: iss.path ? [${js(y)}, ...iss.path] : [${js(y)}]
|
|
159
|
-
})));`),m.write(`newResult[${js(y)}] = ${v}.value`)}m.write("payload.value = newResult;"),m.write("return payload;");const h=m.compile();return(y,v)=>h(p,y,v)};let o;const i=fp,s=!Wb.jitless,l=s&&xP.value,c=t.catchall;let f;e._zod.parse=(p,m)=>{f??(f=n.value);const g=p.value;if(!i(g))return p.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),p;const w=[];if(s&&l&&(m==null?void 0:m.async)===!1&&m.jitless!==!0)o||(o=r(t.shape)),p=o(p,m);else{p.value={};const v=f.shape;for(const b of f.keys){const S=v[b],E=S._zod.run({value:g[b],issues:[]},m),C=S._zod.optin==="optional"&&S._zod.optout==="optional";E instanceof Promise?w.push(E.then(I=>C?Ry(I,p,b,g):vl(I,p,b))):C?Ry(E,p,b,g):vl(E,p,b)}}if(!c)return w.length?Promise.all(w).then(()=>p):p;const x=[],k=f.keySet,h=c._zod,y=h.def.type;for(const v of Object.keys(g)){if(k.has(v))continue;if(y==="never"){x.push(v);continue}const b=h.run({value:g[v],issues:[]},m);b instanceof Promise?w.push(b.then(S=>vl(S,p,v))):vl(b,p,v)}return x.length&&p.issues.push({code:"unrecognized_keys",keys:x,input:g,inst:e}),w.length?Promise.all(w).then(()=>p):p}});function Fy(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=>mo(i,r,ho())))}),t}const eM=Q("$ZodUnion",(e,t)=>{rt.init(e,t),nt(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),nt(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),nt(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),nt(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=>Uh(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=>Fy(s,n,e,r)):Fy(i,n,e,r)}}),tM=Q("$ZodIntersection",(e,t)=>{rt.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,i=t.left._zod.run({value:o,issues:[]},r),s=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([l,c])=>Py(n,l,c)):Py(n,i,s)}});function pp(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(Ru(e)&&Ru(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=pp(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=pp(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 Py(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),Ks(e))return e;const r=pp(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 nM=Q("$ZodRecord",(e,t)=>{rt.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Ru(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const i=[];if(t.keyType._zod.values){const s=t.keyType._zod.values;n.value={};for(const l of s)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){const c=t.valueType._zod.run({value:o[l],issues:[]},r);c instanceof Promise?i.push(c.then(f=>{f.issues.length&&n.issues.push(...Mo(l,f.issues)),n.value[l]=f.value})):(c.issues.length&&n.issues.push(...Mo(l,c.issues)),n.value[l]=c.value)}let a;for(const l in o)s.has(l)||(a=a??[],a.push(l));a&&a.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:a})}else{n.value={};for(const s of Reflect.ownKeys(o)){if(s==="__proto__")continue;const a=t.keyType._zod.run({value:s,issues:[]},r);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){n.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map(c=>mo(c,r,ho())),input:s,path:[s],inst:e}),n.value[a.value]=a.value;continue}const l=t.valueType._zod.run({value:o[s],issues:[]},r);l instanceof Promise?i.push(l.then(c=>{c.issues.length&&n.issues.push(...Mo(s,c.issues)),n.value[a.value]=c.value})):(l.issues.length&&n.issues.push(...Mo(s,l.issues)),n.value[a.value]=l.value)}}return i.length?Promise.all(i).then(()=>n):n}}),rM=Q("$ZodEnum",(e,t)=>{rt.init(e,t);const n=Vb(t.entries);e._zod.values=new Set(n),e._zod.pattern=new RegExp(`^(${n.filter(r=>bP.has(typeof r)).map(r=>typeof r=="string"?La(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}}),oM=Q("$ZodLiteral",(e,t)=>{rt.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?La(n):n?n.toString():String(n)).join("|")})$`),e._zod.parse=(n,r)=>{const o=n.value;return e._zod.values.has(o)||n.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),n}}),iM=Q("$ZodTransform",(e,t)=>{rt.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 ma;return n.value=o,n}}),sM=Q("$ZodOptional",(e,t)=>{rt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",nt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),nt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Uh(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)}),aM=Q("$ZodNullable",(e,t)=>{rt.init(e,t),nt(e._zod,"optin",()=>t.innerType._zod.optin),nt(e._zod,"optout",()=>t.innerType._zod.optout),nt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Uh(n.source)}|null)$`):void 0}),nt(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)}),lM=Q("$ZodDefault",(e,t)=>{rt.init(e,t),e._zod.optin="optional",nt(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=>$y(i,t)):$y(o,t)}});function $y(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const uM=Q("$ZodPrefault",(e,t)=>{rt.init(e,t),e._zod.optin="optional",nt(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))}),cM=Q("$ZodNonOptional",(e,t)=>{rt.init(e,t),nt(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=>My(i,e)):My(o,e)}});function My(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 dM=Q("$ZodCatch",(e,t)=>{rt.init(e,t),e._zod.optin="optional",nt(e._zod,"optout",()=>t.innerType._zod.optout),nt(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=>mo(s,r,ho()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(i=>mo(i,r,ho()))},input:n.value}),n.issues=[]),n)}}),fM=Q("$ZodPipe",(e,t)=>{rt.init(e,t),nt(e._zod,"values",()=>t.in._zod.values),nt(e._zod,"optin",()=>t.in._zod.optin),nt(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=>_y(i,t,r)):_y(o,t,r)}});function _y(e,t,n){return Ks(e)?e:t.out._zod.run({value:e.value,issues:e.issues},n)}const pM=Q("$ZodReadonly",(e,t)=>{rt.init(e,t),nt(e._zod,"propValues",()=>t.innerType._zod.propValues),nt(e._zod,"values",()=>t.innerType._zod.values),nt(e._zod,"optin",()=>t.innerType._zod.optin),nt(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(Ay):Ay(o)}});function Ay(e){return e.value=Object.freeze(e.value),e}const hM=Q("$ZodCustom",(e,t)=>{vn.init(e,t),rt.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=>Ny(i,n,r,e));Ny(o,n,r,e)}});function Ny(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(ga(o))}}class iS{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 mM(){return new iS}const Ns=mM();function gM(e,t){return new e({type:"string",...Ce(t)})}function yM(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Ce(t)})}function Ly(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Ce(t)})}function vM(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Ce(t)})}function wM(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ce(t)})}function xM(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ce(t)})}function bM(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ce(t)})}function SM(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Ce(t)})}function kM(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Ce(t)})}function EM(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ce(t)})}function CM(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Ce(t)})}function IM(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ce(t)})}function TM(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Ce(t)})}function jM(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Ce(t)})}function RM(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ce(t)})}function FM(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ce(t)})}function PM(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ce(t)})}function $M(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ce(t)})}function MM(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ce(t)})}function _M(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Ce(t)})}function AM(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Ce(t)})}function NM(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Ce(t)})}function LM(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Ce(t)})}function OM(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ce(t)})}function DM(e,t){return new e({type:"string",format:"date",check:"string_format",...Ce(t)})}function zM(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Ce(t)})}function BM(e,t){return new e({type:"string",format:"duration",check:"string_format",...Ce(t)})}function WM(e,t){return new e({type:"number",checks:[],...Ce(t)})}function VM(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Ce(t)})}function HM(e,t){return new e({type:"boolean",...Ce(t)})}function UM(e){return new e({type:"unknown"})}function ZM(e,t){return new e({type:"never",...Ce(t)})}function Oy(e,t){return new tS({check:"less_than",...Ce(t),value:e,inclusive:!1})}function Fd(e,t){return new tS({check:"less_than",...Ce(t),value:e,inclusive:!0})}function Dy(e,t){return new nS({check:"greater_than",...Ce(t),value:e,inclusive:!1})}function Pd(e,t){return new nS({check:"greater_than",...Ce(t),value:e,inclusive:!0})}function zy(e,t){return new u$({check:"multiple_of",...Ce(t),value:e})}function sS(e,t){return new d$({check:"max_length",...Ce(t),maximum:e})}function Fu(e,t){return new f$({check:"min_length",...Ce(t),minimum:e})}function aS(e,t){return new p$({check:"length_equals",...Ce(t),length:e})}function KM(e,t){return new h$({check:"string_format",format:"regex",...Ce(t),pattern:e})}function YM(e){return new m$({check:"string_format",format:"lowercase",...Ce(e)})}function GM(e){return new g$({check:"string_format",format:"uppercase",...Ce(e)})}function XM(e,t){return new y$({check:"string_format",format:"includes",...Ce(t),includes:e})}function qM(e,t){return new v$({check:"string_format",format:"starts_with",...Ce(t),prefix:e})}function JM(e,t){return new w$({check:"string_format",format:"ends_with",...Ce(t),suffix:e})}function Oa(e){return new x$({check:"overwrite",tx:e})}function QM(e){return Oa(t=>t.normalize(e))}function e_(){return Oa(e=>e.trim())}function t_(){return Oa(e=>e.toLowerCase())}function n_(){return Oa(e=>e.toUpperCase())}function r_(e,t,n){return new e({type:"array",element:t,...Ce(n)})}function o_(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Ce(n)})}class By{constructor(t){this.counter=0,this.metadataRegistry=(t==null?void 0:t.metadata)??Ns,this.target=(t==null?void 0:t.target)??"draft-2020-12",this.unrepresentable=(t==null?void 0:t.unrepresentable)??"throw",this.override=(t==null?void 0:t.override)??(()=>{}),this.io=(t==null?void 0:t.io)??"output",this.seen=new Map}process(t,n={path:[],schemaPath:[]}){var p,m,g;var r;const o=t._zod.def,i={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},s=this.seen.get(t);if(s)return s.count++,n.schemaPath.includes(t)&&(s.cycle=n.path),s.schema;const a={schema:{},count:1,cycle:void 0,path:n.path};this.seen.set(t,a);const l=(m=(p=t._zod).toJSONSchema)==null?void 0:m.call(p);if(l)a.schema=l;else{const w={...n,schemaPath:[...n.schemaPath,t],path:n.path},x=t._zod.parent;if(x)a.ref=x,this.process(x,w),this.seen.get(x).isParent=!0;else{const k=a.schema;switch(o.type){case"string":{const h=k;h.type="string";const{minimum:y,maximum:v,format:b,patterns:S,contentEncoding:E}=t._zod.bag;if(typeof y=="number"&&(h.minLength=y),typeof v=="number"&&(h.maxLength=v),b&&(h.format=i[b]??b,h.format===""&&delete h.format),E&&(h.contentEncoding=E),S&&S.size>0){const C=[...S];C.length===1?h.pattern=C[0].source:C.length>1&&(a.schema.allOf=[...C.map(I=>({...this.target==="draft-7"?{type:"string"}:{},pattern:I.source}))])}break}case"number":{const h=k,{minimum:y,maximum:v,format:b,multipleOf:S,exclusiveMaximum:E,exclusiveMinimum:C}=t._zod.bag;typeof b=="string"&&b.includes("int")?h.type="integer":h.type="number",typeof C=="number"&&(h.exclusiveMinimum=C),typeof y=="number"&&(h.minimum=y,typeof C=="number"&&(C>=y?delete h.minimum:delete h.exclusiveMinimum)),typeof E=="number"&&(h.exclusiveMaximum=E),typeof v=="number"&&(h.maximum=v,typeof E=="number"&&(E<=v?delete h.maximum:delete h.exclusiveMaximum)),typeof S=="number"&&(h.multipleOf=S);break}case"boolean":{const h=k;h.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{k.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{k.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{const h=k,{minimum:y,maximum:v}=t._zod.bag;typeof y=="number"&&(h.minItems=y),typeof v=="number"&&(h.maxItems=v),h.type="array",h.items=this.process(o.element,{...w,path:[...w.path,"items"]});break}case"object":{const h=k;h.type="object",h.properties={};const y=o.shape;for(const S in y)h.properties[S]=this.process(y[S],{...w,path:[...w.path,"properties",S]});const v=new Set(Object.keys(y)),b=new Set([...v].filter(S=>{const E=o.shape[S]._zod;return this.io==="input"?E.optin===void 0:E.optout===void 0}));b.size>0&&(h.required=Array.from(b)),((g=o.catchall)==null?void 0:g._zod.def.type)==="never"?h.additionalProperties=!1:o.catchall?o.catchall&&(h.additionalProperties=this.process(o.catchall,{...w,path:[...w.path,"additionalProperties"]})):this.io==="output"&&(h.additionalProperties=!1);break}case"union":{const h=k;h.anyOf=o.options.map((y,v)=>this.process(y,{...w,path:[...w.path,"anyOf",v]}));break}case"intersection":{const h=k,y=this.process(o.left,{...w,path:[...w.path,"allOf",0]}),v=this.process(o.right,{...w,path:[...w.path,"allOf",1]}),b=E=>"allOf"in E&&Object.keys(E).length===1,S=[...b(y)?y.allOf:[y],...b(v)?v.allOf:[v]];h.allOf=S;break}case"tuple":{const h=k;h.type="array";const y=o.items.map((S,E)=>this.process(S,{...w,path:[...w.path,"prefixItems",E]}));if(this.target==="draft-2020-12"?h.prefixItems=y:h.items=y,o.rest){const S=this.process(o.rest,{...w,path:[...w.path,"items"]});this.target==="draft-2020-12"?h.items=S:h.additionalItems=S}o.rest&&(h.items=this.process(o.rest,{...w,path:[...w.path,"items"]}));const{minimum:v,maximum:b}=t._zod.bag;typeof v=="number"&&(h.minItems=v),typeof b=="number"&&(h.maxItems=b);break}case"record":{const h=k;h.type="object",h.propertyNames=this.process(o.keyType,{...w,path:[...w.path,"propertyNames"]}),h.additionalProperties=this.process(o.valueType,{...w,path:[...w.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{const h=k,y=Vb(o.entries);y.every(v=>typeof v=="number")&&(h.type="number"),y.every(v=>typeof v=="string")&&(h.type="string"),h.enum=y;break}case"literal":{const h=k,y=[];for(const v of o.values)if(v===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof v=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");y.push(Number(v))}else y.push(v);if(y.length!==0)if(y.length===1){const v=y[0];h.type=v===null?"null":typeof v,h.const=v}else y.every(v=>typeof v=="number")&&(h.type="number"),y.every(v=>typeof v=="string")&&(h.type="string"),y.every(v=>typeof v=="boolean")&&(h.type="string"),y.every(v=>v===null)&&(h.type="null"),h.enum=y;break}case"file":{const h=k,y={type:"string",format:"binary",contentEncoding:"binary"},{minimum:v,maximum:b,mime:S}=t._zod.bag;v!==void 0&&(y.minLength=v),b!==void 0&&(y.maxLength=b),S?S.length===1?(y.contentMediaType=S[0],Object.assign(h,y)):h.anyOf=S.map(E=>({...y,contentMediaType:E})):Object.assign(h,y);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{const h=this.process(o.innerType,w);k.anyOf=[h,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,w),a.ref=o.innerType;break}case"success":{const h=k;h.type="boolean";break}case"default":{this.process(o.innerType,w),a.ref=o.innerType,k.default=JSON.parse(JSON.stringify(o.defaultValue));break}case"prefault":{this.process(o.innerType,w),a.ref=o.innerType,this.io==="input"&&(k._prefault=JSON.parse(JSON.stringify(o.defaultValue)));break}case"catch":{this.process(o.innerType,w),a.ref=o.innerType;let h;try{h=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}k.default=h;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{const h=k,y=t._zod.pattern;if(!y)throw new Error("Pattern not found in template literal");h.type="string",h.pattern=y.source;break}case"pipe":{const h=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(h,w),a.ref=h;break}case"readonly":{this.process(o.innerType,w),a.ref=o.innerType,k.readOnly=!0;break}case"promise":{this.process(o.innerType,w),a.ref=o.innerType;break}case"optional":{this.process(o.innerType,w),a.ref=o.innerType;break}case"lazy":{const h=t._zod.innerType;this.process(h,w),a.ref=h;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}}}}const c=this.metadataRegistry.get(t);return c&&Object.assign(a.schema,c),this.io==="input"&&kt(t)&&(delete a.schema.examples,delete a.schema.default),this.io==="input"&&a.schema._prefault&&((r=a.schema).default??(r.default=a.schema._prefault)),delete a.schema._prefault,this.seen.get(t).schema}emit(t,n){var f,p,m,g,w,x;const r={cycles:(n==null?void 0:n.cycles)??"ref",reused:(n==null?void 0:n.reused)??"inline",external:(n==null?void 0:n.external)??void 0},o=this.seen.get(t);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=k=>{var S;const h=this.target==="draft-2020-12"?"$defs":"definitions";if(r.external){const E=(S=r.external.registry.get(k[0]))==null?void 0:S.id,C=r.external.uri??(j=>j);if(E)return{ref:C(E)};const I=k[1].defId??k[1].schema.id??`schema${this.counter++}`;return k[1].defId=I,{defId:I,ref:`${C("__shared")}#/${h}/${I}`}}if(k[1]===o)return{ref:"#"};const v=`#/${h}/`,b=k[1].schema.id??`__schema${this.counter++}`;return{defId:b,ref:v+b}},s=k=>{if(k[1].schema.$ref)return;const h=k[1],{ref:y,defId:v}=i(k);h.def={...h.schema},v&&(h.defId=v);const b=h.schema;for(const S in b)delete b[S];b.$ref=y};if(r.cycles==="throw")for(const k of this.seen.entries()){const h=k[1];if(h.cycle)throw new Error(`Cycle detected: #/${(f=h.cycle)==null?void 0:f.join("/")}/<root>
|
|
160
|
-
|
|
161
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const k of this.seen.entries()){const h=k[1];if(t===k[0]){s(k);continue}if(r.external){const v=(p=r.external.registry.get(k[0]))==null?void 0:p.id;if(t!==k[0]&&v){s(k);continue}}if((m=this.metadataRegistry.get(k[0]))==null?void 0:m.id){s(k);continue}if(h.cycle){s(k);continue}if(h.count>1&&r.reused==="ref"){s(k);continue}}const a=(k,h)=>{const y=this.seen.get(k),v=y.def??y.schema,b={...v};if(y.ref===null)return;const S=y.ref;if(y.ref=null,S){a(S,h);const E=this.seen.get(S).schema;E.$ref&&h.target==="draft-7"?(v.allOf=v.allOf??[],v.allOf.push(E)):(Object.assign(v,E),Object.assign(v,b))}y.isParent||this.override({zodSchema:k,jsonSchema:v,path:y.path??[]})};for(const k of[...this.seen.entries()].reverse())a(k[0],{target:this.target});const l={};if(this.target==="draft-2020-12"?l.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?l.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),(g=r.external)!=null&&g.uri){const k=(w=r.external.registry.get(t))==null?void 0:w.id;if(!k)throw new Error("Schema is missing an `id` property");l.$id=r.external.uri(k)}Object.assign(l,o.def);const c=((x=r.external)==null?void 0:x.defs)??{};for(const k of this.seen.entries()){const h=k[1];h.def&&h.defId&&(c[h.defId]=h.def)}r.external||Object.keys(c).length>0&&(this.target==="draft-2020-12"?l.$defs=c:l.definitions=c);try{return JSON.parse(JSON.stringify(l))}catch{throw new Error("Error converting schema to JSON.")}}}function i_(e,t){if(e instanceof iS){const r=new By(t),o={};for(const a of e._idmap.entries()){const[l,c]=a;r.process(c)}const i={},s={registry:e,uri:t==null?void 0:t.uri,defs:o};for(const a of e._idmap.entries()){const[l,c]=a;i[l]=r.emit(c,{...t,external:s})}if(Object.keys(o).length>0){const a=r.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[a]:o}}return{schemas:i}}const n=new By(t);return n.process(e),n.emit(e,t)}function kt(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const o=e._zod.def;switch(o.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return kt(o.element,n);case"object":{for(const i in o.shape)if(kt(o.shape[i],n))return!0;return!1}case"union":{for(const i of o.options)if(kt(i,n))return!0;return!1}case"intersection":return kt(o.left,n)||kt(o.right,n);case"tuple":{for(const i of o.items)if(kt(i,n))return!0;return!!(o.rest&&kt(o.rest,n))}case"record":return kt(o.keyType,n)||kt(o.valueType,n);case"map":return kt(o.keyType,n)||kt(o.valueType,n);case"set":return kt(o.valueType,n);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return kt(o.innerType,n);case"lazy":return kt(o.getter(),n);case"default":return kt(o.innerType,n);case"prefault":return kt(o.innerType,n);case"custom":return!1;case"transform":return!0;case"pipe":return kt(o.in,n)||kt(o.out,n);case"success":return!1;case"catch":return!1}throw new Error(`Unknown schema type: ${o.type}`)}const s_=Q("ZodISODateTime",(e,t)=>{_$.init(e,t),dt.init(e,t)});function a_(e){return OM(s_,e)}const l_=Q("ZodISODate",(e,t)=>{A$.init(e,t),dt.init(e,t)});function u_(e){return DM(l_,e)}const c_=Q("ZodISOTime",(e,t)=>{N$.init(e,t),dt.init(e,t)});function d_(e){return zM(c_,e)}const f_=Q("ZodISODuration",(e,t)=>{L$.init(e,t),dt.init(e,t)});function p_(e){return BM(f_,e)}const h_=(e,t)=>{Kb.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>PP(e,n)},flatten:{value:n=>FP(e,n)},addIssue:{value:n=>e.issues.push(n)},addIssues:{value:n=>e.issues.push(...n)},isEmpty:{get(){return e.issues.length===0}}})},Tc=Q("ZodError",h_,{Parent:Error}),m_=$P(Tc),g_=MP(Tc),y_=Gb(Tc),v_=Xb(Tc),ht=Q("ZodType",(e,t)=>(rt.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)=>Jo(e,n,r),e.brand=()=>e,e.register=(n,r)=>(n.add(e,r),e),e.parse=(n,r)=>m_(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>y_(e,n,r),e.parseAsync=async(n,r)=>g_(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>v_(e,n,r),e.spa=e.safeParseAsync,e.refine=(n,r)=>e.check(cA(n,r)),e.superRefine=n=>e.check(dA(n)),e.overwrite=n=>e.check(Oa(n)),e.optional=()=>Hy(e),e.nullable=()=>Uy(e),e.nullish=()=>Hy(Uy(e)),e.nonoptional=n=>nA(e,n),e.array=()=>Xe(e),e.or=n=>jc([e,n]),e.and=n=>U_(e,n),e.transform=n=>Zy(e,X_(n)),e.default=n=>Q_(e,n),e.prefault=n=>tA(e,n),e.catch=n=>oA(e,n),e.pipe=n=>Zy(e,n),e.readonly=()=>aA(e),e.describe=n=>{const r=e.clone();return Ns.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=Ns.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Ns.get(e);const r=e.clone();return Ns.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),lS=Q("_ZodString",(e,t)=>{Yh.init(e,t),ht.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(KM(...r)),e.includes=(...r)=>e.check(XM(...r)),e.startsWith=(...r)=>e.check(qM(...r)),e.endsWith=(...r)=>e.check(JM(...r)),e.min=(...r)=>e.check(Fu(...r)),e.max=(...r)=>e.check(sS(...r)),e.length=(...r)=>e.check(aS(...r)),e.nonempty=(...r)=>e.check(Fu(1,...r)),e.lowercase=r=>e.check(YM(r)),e.uppercase=r=>e.check(GM(r)),e.trim=()=>e.check(e_()),e.normalize=(...r)=>e.check(QM(...r)),e.toLowerCase=()=>e.check(t_()),e.toUpperCase=()=>e.check(n_())}),w_=Q("ZodString",(e,t)=>{Yh.init(e,t),lS.init(e,t),e.email=n=>e.check(yM(x_,n)),e.url=n=>e.check(SM(b_,n)),e.jwt=n=>e.check(LM(N_,n)),e.emoji=n=>e.check(kM(S_,n)),e.guid=n=>e.check(Ly(Wy,n)),e.uuid=n=>e.check(vM(wl,n)),e.uuidv4=n=>e.check(wM(wl,n)),e.uuidv6=n=>e.check(xM(wl,n)),e.uuidv7=n=>e.check(bM(wl,n)),e.nanoid=n=>e.check(EM(k_,n)),e.guid=n=>e.check(Ly(Wy,n)),e.cuid=n=>e.check(CM(E_,n)),e.cuid2=n=>e.check(IM(C_,n)),e.ulid=n=>e.check(TM(I_,n)),e.base64=n=>e.check(_M(M_,n)),e.base64url=n=>e.check(AM(__,n)),e.xid=n=>e.check(jM(T_,n)),e.ksuid=n=>e.check(RM(j_,n)),e.ipv4=n=>e.check(FM(R_,n)),e.ipv6=n=>e.check(PM(F_,n)),e.cidrv4=n=>e.check($M(P_,n)),e.cidrv6=n=>e.check(MM($_,n)),e.e164=n=>e.check(NM(A_,n)),e.datetime=n=>e.check(a_(n)),e.date=n=>e.check(u_(n)),e.time=n=>e.check(d_(n)),e.duration=n=>e.check(p_(n))});function ye(e){return gM(w_,e)}const dt=Q("ZodStringFormat",(e,t)=>{ot.init(e,t),lS.init(e,t)}),x_=Q("ZodEmail",(e,t)=>{C$.init(e,t),dt.init(e,t)}),Wy=Q("ZodGUID",(e,t)=>{k$.init(e,t),dt.init(e,t)}),wl=Q("ZodUUID",(e,t)=>{E$.init(e,t),dt.init(e,t)}),b_=Q("ZodURL",(e,t)=>{I$.init(e,t),dt.init(e,t)}),S_=Q("ZodEmoji",(e,t)=>{T$.init(e,t),dt.init(e,t)}),k_=Q("ZodNanoID",(e,t)=>{j$.init(e,t),dt.init(e,t)}),E_=Q("ZodCUID",(e,t)=>{R$.init(e,t),dt.init(e,t)}),C_=Q("ZodCUID2",(e,t)=>{F$.init(e,t),dt.init(e,t)}),I_=Q("ZodULID",(e,t)=>{P$.init(e,t),dt.init(e,t)}),T_=Q("ZodXID",(e,t)=>{$$.init(e,t),dt.init(e,t)}),j_=Q("ZodKSUID",(e,t)=>{M$.init(e,t),dt.init(e,t)}),R_=Q("ZodIPv4",(e,t)=>{O$.init(e,t),dt.init(e,t)}),F_=Q("ZodIPv6",(e,t)=>{D$.init(e,t),dt.init(e,t)}),P_=Q("ZodCIDRv4",(e,t)=>{z$.init(e,t),dt.init(e,t)}),$_=Q("ZodCIDRv6",(e,t)=>{B$.init(e,t),dt.init(e,t)}),M_=Q("ZodBase64",(e,t)=>{W$.init(e,t),dt.init(e,t)}),__=Q("ZodBase64URL",(e,t)=>{H$.init(e,t),dt.init(e,t)}),A_=Q("ZodE164",(e,t)=>{U$.init(e,t),dt.init(e,t)}),N_=Q("ZodJWT",(e,t)=>{K$.init(e,t),dt.init(e,t)}),uS=Q("ZodNumber",(e,t)=>{oS.init(e,t),ht.init(e,t),e.gt=(r,o)=>e.check(Dy(r,o)),e.gte=(r,o)=>e.check(Pd(r,o)),e.min=(r,o)=>e.check(Pd(r,o)),e.lt=(r,o)=>e.check(Oy(r,o)),e.lte=(r,o)=>e.check(Fd(r,o)),e.max=(r,o)=>e.check(Fd(r,o)),e.int=r=>e.check(Vy(r)),e.safe=r=>e.check(Vy(r)),e.positive=r=>e.check(Dy(0,r)),e.nonnegative=r=>e.check(Pd(0,r)),e.negative=r=>e.check(Oy(0,r)),e.nonpositive=r=>e.check(Fd(0,r)),e.multipleOf=(r,o)=>e.check(zy(r,o)),e.step=(r,o)=>e.check(zy(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 ce(e){return WM(uS,e)}const L_=Q("ZodNumberFormat",(e,t)=>{Y$.init(e,t),uS.init(e,t)});function Vy(e){return VM(L_,e)}const O_=Q("ZodBoolean",(e,t)=>{G$.init(e,t),ht.init(e,t)});function Xt(e){return HM(O_,e)}const D_=Q("ZodUnknown",(e,t)=>{X$.init(e,t),ht.init(e,t)});function Ui(){return UM(D_)}const z_=Q("ZodNever",(e,t)=>{q$.init(e,t),ht.init(e,t)});function cS(e){return ZM(z_,e)}const B_=Q("ZodArray",(e,t)=>{J$.init(e,t),ht.init(e,t),e.element=t.element,e.min=(n,r)=>e.check(Fu(n,r)),e.nonempty=n=>e.check(Fu(1,n)),e.max=(n,r)=>e.check(sS(n,r)),e.length=(n,r)=>e.check(aS(n,r)),e.unwrap=()=>e.element});function Xe(e,t){return r_(B_,e,t)}const W_=Q("ZodObject",(e,t)=>{Q$.init(e,t),ht.init(e,t),nt(e,"shape",()=>t.shape),e.keyof=()=>ir(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Ui()}),e.loose=()=>e.clone({...e._zod.def,catchall:Ui()}),e.strict=()=>e.clone({...e._zod.def,catchall:cS()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>IP(e,n),e.merge=n=>TP(e,n),e.pick=n=>EP(e,n),e.omit=n=>CP(e,n),e.partial=(...n)=>jP(fS,e,n[0]),e.required=(...n)=>RP(pS,e,n[0])});function be(e,t){const n={type:"object",get shape(){return Zh(this,"shape",{...e}),this.shape},...Ce(t)};return new W_(n)}const V_=Q("ZodUnion",(e,t)=>{eM.init(e,t),ht.init(e,t),e.options=t.options});function jc(e,t){return new V_({type:"union",options:e,...Ce(t)})}const H_=Q("ZodIntersection",(e,t)=>{tM.init(e,t),ht.init(e,t)});function U_(e,t){return new H_({type:"intersection",left:e,right:t})}const dS=Q("ZodRecord",(e,t)=>{nM.init(e,t),ht.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function zn(e,t,n){return new dS({type:"record",keyType:e,valueType:t,...Ce(n)})}function Z_(e,t,n){return new dS({type:"record",keyType:jc([e,cS()]),valueType:t,...Ce(n)})}const hp=Q("ZodEnum",(e,t)=>{rM.init(e,t),ht.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 hp({...t,checks:[],...Ce(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 hp({...t,checks:[],...Ce(o),entries:i})}});function ir(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new hp({type:"enum",entries:n,...Ce(t)})}const K_=Q("ZodLiteral",(e,t)=>{oM.init(e,t),ht.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Y_(e,t){return new K_({type:"literal",values:Array.isArray(e)?e:[e],...Ce(t)})}const G_=Q("ZodTransform",(e,t)=>{iM.init(e,t),ht.init(e,t),e._zod.parse=(n,r)=>{n.addIssue=i=>{if(typeof i=="string")n.issues.push(ga(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(ga(s))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function X_(e){return new G_({type:"transform",transform:e})}const fS=Q("ZodOptional",(e,t)=>{sM.init(e,t),ht.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Hy(e){return new fS({type:"optional",innerType:e})}const q_=Q("ZodNullable",(e,t)=>{aM.init(e,t),ht.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Uy(e){return new q_({type:"nullable",innerType:e})}const J_=Q("ZodDefault",(e,t)=>{lM.init(e,t),ht.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Q_(e,t){return new J_({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const eA=Q("ZodPrefault",(e,t)=>{uM.init(e,t),ht.init(e,t),e.unwrap=()=>e._zod.def.innerType});function tA(e,t){return new eA({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const pS=Q("ZodNonOptional",(e,t)=>{cM.init(e,t),ht.init(e,t),e.unwrap=()=>e._zod.def.innerType});function nA(e,t){return new pS({type:"nonoptional",innerType:e,...Ce(t)})}const rA=Q("ZodCatch",(e,t)=>{dM.init(e,t),ht.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function oA(e,t){return new rA({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const iA=Q("ZodPipe",(e,t)=>{fM.init(e,t),ht.init(e,t),e.in=t.in,e.out=t.out});function Zy(e,t){return new iA({type:"pipe",in:e,out:t})}const sA=Q("ZodReadonly",(e,t)=>{pM.init(e,t),ht.init(e,t)});function aA(e){return new sA({type:"readonly",innerType:e})}const lA=Q("ZodCustom",(e,t)=>{hM.init(e,t),ht.init(e,t)});function uA(e){const t=new vn({check:"custom"});return t._zod.check=e,t}function cA(e,t={}){return o_(lA,e,t)}function dA(e){const t=uA(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(ga(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(ga(o))}},e(n.value,n)));return t}const Rc=ir(["full-bleed","video-top","pip-bubble","graphic-only","blurred-behind","lower-third","split-left","split-right"]),Fc=ir(["TitleCard","StatCard","RuleCard","StrikethroughReveal","FlowDiagram","TerminalMock","ChatMock","ScreenshotFrame","BulletList"]),Gh=be({startWord:ce().int().nonnegative(),endWord:ce().int().nonnegative()}),fA=be({id:ye(),anchor:Gh,layout:Rc,component:Fc,props:zn(ye(),Ui()),overrides:zn(ye(),Ui()).default({}),rationale:ye().optional()});be({id:ye(),kind:ir(["graphic","plain"]).optional(),kept:be({srcIn:ce().nonnegative(),srcOut:ce().nonnegative()}).optional(),anchor:Gh.optional(),layout:Rc,component:Fc.optional(),props:zn(ye(),Ui()).optional(),startSec:ce().nonnegative(),endSec:ce().nonnegative(),graphicRect:be({x:ce(),y:ce(),w:ce(),h:ce()}).optional(),elements:zn(ye(),be({dx:ce().optional(),dy:ce().optional(),scale:ce().positive().optional(),hidden:Xt().optional()})).optional(),video:be({scale:ce().positive().max(4).optional(),dy:ce().optional(),dx:ce().optional(),autoZoom:Xt().optional()}).optional(),pip:be({cornerRadius:ce().min(0).max(1).optional(),x:ce().min(0).max(1).optional(),y:ce().min(0).max(1).optional()}).optional(),captionY:ce().min(0).max(1).optional(),captionScale:ce().min(.2).max(3).optional(),pinned:Xt().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'})});be({centerYFrac:ce().min(0).max(1),sizeFrac:ce().min(0).max(1).optional(),centerXFrac:ce().min(0).max(1).optional(),sourceAspect:ce().positive().optional(),subject:ir(["face","screen"]).optional()});const Pc=be({bg:ye().default("#0B0B0E"),fg:ye().default("#FFFFFF"),accent:ye().default("#FFE14D"),muted:ye().default("#9A9AA3"),success:ye().default("#5FBF77"),cardBg:ye().default("#15151B"),cardBorder:ye().default("#2A2A33"),danger:ye().default("#FF5C5C"),radiusPx:ce().default(24),fontDisplay:ye().default("'Inter', 'Helvetica Neue', 'Arial Black', Arial, sans-serif"),fontMono:ye().default("'SF Mono', 'Cascadia Code', Consolas, monospace")}),pA=Pc.parse({}),hA=be({eyebrow:ye().max(28).optional(),title:ye().min(1).max(48).describe("the claim WITHOUT the emphasis token — never repeat the emphasis here"),emphasis:ye().max(16).optional().describe("the number/punch token pulled OUT of the title (e.g. '861%') — not a duplicate of it"),sub:ye().max(64).optional()}),mA=be({label:ye().min(1).max(28),value:ye().min(1).max(12),caption:ye().max(40).optional(),inverted:Xt().default(!1)}),gA=be({kicker:ye().min(1).max(24),text:ye().min(1).max(40),struck:ye().max(40).optional()}),yA=be({lines:Xe(be({text:ye().min(1).max(32),struck:Xt().default(!1),mark:ir(["none","cross","check"]).default("none")})).min(1).max(4)}),vA=be({title:ye().max(28).optional(),items:Xe(ye().min(1).max(36)).min(2).max(5)}),wA=be({nodes:Xe(ye().min(1).max(16)).min(2).max(5),emphasizeLast:Xt().default(!0)}),xA=be({windows:Xe(be({title:ye().max(24),lines:Xe(ye().max(40)).min(1).max(6)})).min(1).max(5),fanOut:ye().max(20).optional()}),bA=be({messages:Xe(be({from:ir(["user","agent"]),text:ye().min(1).max(60)})).min(1).max(4),keyword:ye().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'.")}),SA=be({src:ye().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:ye().max(32).optional(),kenBurns:Xt().default(!0)}),hS={TitleCard:{propsSchema:hA,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:mA,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:gA,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:yA,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:wA,defaultProps:{nodes:["A","B"]},defaultLayout:"graphic-only",altLayouts:[],whenToUse:"A causal chain or pipeline as chips with arrows (TEAM → AI AGENTS → CHURN)."},TerminalMock:{propsSchema:xA,defaultProps:{windows:[{title:"terminal-01",lines:["$ run"]}]},defaultLayout:"graphic-only",altLayouts:[],whenToUse:"Anything about running code/processes/agents — stylized terminal windows."},ChatMock:{propsSchema:bA,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:SA,defaultProps:{},defaultLayout:"video-top",altLayouts:["blurred-behind"],whenToUse:"Reference to a document/PR/review — a framed screenshot look with a label chip."},BulletList:{propsSchema:vA,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 Ky(e,t,n={}){const r=hS[e],o={...r.defaultProps,...t,...n},i=r.propsSchema.safeParse(o);return i.success?i.data:null}function kA(e){const t=hS[e];if(!t)return[];const n=i_(t.propsSchema),r=[];for(const[o,i]of Object.entries(n.properties??{})){if(Array.isArray(i.enum)&&i.enum.every(s=>typeof s=="string")){r.push({key:o,kind:"enum",options:i.enum});continue}i.type==="boolean"&&r.push({key:o,kind:"boolean",fallback:i.default===!0})}return r}const EA=be({text:ye(),start:ce().nonnegative(),end:ce().nonnegative(),conf:ce().min(0).max(1).optional()}),CA=be({language:ye().default("en"),words:Xe(EA)}),IA=ir(["exact","light","standard","aggressive"]),mS=ir(["silence","pause","filler","retake","user","clip"]),Yy=be({srcIn:ce().nonnegative(),srcOut:ce().nonnegative(),kind:ir(["keep","remove"]),reason:mS.optional(),confidence:ce().min(0).max(1).optional()}),xl=be({start:ce(),end:ce()}),TA=be({silences:Xe(xl),gaps:Xe(xl),cuttable:Xe(xl),breaths:Xe(xl).default([]),fillers:Xe(be({wordIndex:ce().int(),text:ye(),start:ce(),end:ce()}))}),jA=be({duration:ce().positive(),width:ce().int().positive(),height:ce().int().positive(),fps:ce().positive(),hasAudio:Xt(),rotation:ce().int().optional()}),RA=be({width:ce().int().positive().default(1080),height:ce().int().positive().default(1920),fps:ce().positive().default(30)}),FA=be({level:ir(["subtle","normal","meme"]),placements:Xe(be({soundId:ye(),word:ce().int().nonnegative(),sceneId:ye().optional(),gain:ce().min(0).max(2).optional(),rationale:ye().optional()}))});be({version:Y_(1),source:be({path:ye(),probe:jA,audioPath:ye().optional(),mezzaninePath:ye().optional(),face:be({centerXFrac:ce(),centerYFrac:ce(),sizeFrac:ce(),framesSampled:ce().int(),framesDetected:ce().int()}).nullable().optional()}),cleanup:IA,intent:ye().optional(),transcript:CA.optional(),repairs:Xe(be({startWord:ce().int(),endWord:ce().int(),heard:ye(),correction:ye(),applied:Xt(),rejected:ye().optional()})).optional(),analysis:TA.optional(),cutlist:Xe(Yy).optional(),cutlistProposed:Xe(Yy).optional(),clip:be({targetSec:ce().positive(),startWord:ce().int().nonnegative(),endWord:ce().int().nonnegative(),startSec:ce().nonnegative(),endSec:ce().nonnegative(),reason:ye()}).optional(),scenes:Xe(fA).optional(),sfx:FA.optional(),producer:be({provider:ye(),models:Xe(ye()).default([]),cached:Xt().default(!1),at:ye().optional()}).optional(),theme:Pc.optional(),render:RA});const PA=be({dx:ce().optional(),dy:ce().optional(),scale:ce().positive().optional(),hidden:Xt().optional()}),$A=jc([be({startSec:ce().finite().nonnegative(),endSec:ce().finite().nonnegative()}),be({srcStart:ce().finite().nonnegative(),srcEnd:ce().finite().nonnegative()}).refine(e=>e.srcEnd>e.srcStart,{message:"srcEnd must be after srcStart"})]);function Xh(e){return"srcStart"in e}const gS=be({props:zn(ye(),Ui()).default({}),elements:zn(ye(),PA).default({}),timing:$A.optional(),component:Fc.optional(),layout:Rc.optional(),video:be({scale:ce().positive().max(4).optional(),dy:ce().optional(),dx:ce().optional(),autoZoom:Xt().optional()}).optional(),pip:be({cornerRadius:ce().min(0).max(1).optional(),x:ce().min(0).max(1).optional(),y:ce().min(0).max(1).optional()}).optional(),captionY:ce().min(0).max(1).optional(),captionScale:ce().min(.2).max(3).optional(),graphicRect:be({x:ce().min(0).max(1),y:ce().min(0).max(1),w:ce().min(.08).max(1),h:ce().min(.05).max(1)}).optional(),anchor:Gh.optional(),hidden:Xt().optional()}),MA=be({text:ye().min(1).max(80),was:ye()}),_A=be({fromKey:ye().regex(/^w\d+$/),toKey:ye().regex(/^w\d+$/),text:ye().min(1).max(400),was:ye()});function Gy(e,t,n){var r;return((r=e[t])==null?void 0:r.was)??n}function Xy(e,t,n,r){var o;return((o=e.find(i=>i.fromKey===t&&i.toKey===n))==null?void 0:o.was)??r}function yS(e){return String(Math.round(e*1e3))}const AA=jc([be({at:ce().finite().nonnegative().optional(),src:ce().finite().nonnegative().optional(),id:ye().min(1)}).refine(e=>e.at!==void 0||e.src!==void 0,{message:"a split needs `at` or `src`"}),ce().finite().nonnegative().transform(e=>({at:e,src:void 0,id:yS(e)}))]);function qh(e){return e.flatMap(t=>t.at!==void 0?[{at:t.at,id:t.id}]:[])}function NA(e,t){const n=[],r=[];for(const o of e)if(o.src!==void 0){const i=t.toOutput(o.src);if(i===null){r.push(`split "${o.id}" sits in removed material (source ${o.src.toFixed(3)}s) — inert until that material is kept again`);continue}n.push({at:i,id:o.id})}else o.at!==void 0&&n.push({at:o.at,id:o.id});return{points:n,reports:r}}function LA(e,t){const n=yS(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}}function OA(e){return`${e.soundId}@${e.word}`}const DA=be({word:ce().int().nonnegative().optional(),soundId:ye().min(1).optional(),gain:ce().min(0).max(2).optional(),muted:Xt().optional()}),zA=be({id:ye().regex(/^[A-Za-z0-9_-]+$/),soundId:ye().min(1),word:ce().int().nonnegative(),gain:ce().min(0).max(2).optional()}),BA=be({theme:Pc.partial().default({}),captionsHidden:Xt().optional(),scenes:zn(ye(),gS).default({}),captions:zn(ye(),MA).default({}),captionWordsHidden:zn(ye(),be({was:ye()})).default({}),captionRangeEdits:Xe(_A).default([]),captionLineTiming:zn(ye(),be({lead:ce().min(-30).max(30),tail:ce().min(-30).max(30)})).default({}),captionLineWindows:zn(ye(),be({srcStart:ce(),srcEnd:ce()}).refine(e=>e.srcEnd-e.srcStart>=$u,{message:"caption window must be at least 50ms (MIN_CAPTION_SEC) wide, ordered start → end"})).default({}),splits:Xe(AA).default([]),cuts:Xe(be({startSec:ce().nonnegative(),endSec:ce().nonnegative(),src:be({startSec:ce().nonnegative(),endSec:ce().nonnegative()}).optional()})).default([]),cleanup:be({reasons:Z_(mS,Xt()).default({}),kept:Xe(be({srcIn:ce().nonnegative(),srcOut:ce().nonnegative()})).default([]),dismissed:Xe(be({srcIn:ce().nonnegative(),srcOut:ce().nonnegative()})).default([])}).default({reasons:{},kept:[],dismissed:[]}),sfx:be({edits:zn(ye(),DA).default({}),added:Xe(zA).default([])}).optional()}),WA=()=>BA.parse({});function VA(e,t){return Ky(e,{},t)??Ky(e,{},{})}function HA(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 UA(e,t){if(!Xh(e))return{startSec:e.startSec,endSec:e.endSec};const n=t.toOutput(e.srcStart),r=t.toOutput(e.srcEnd);return n===null||r===null?null:{startSec:n,endSec:r}}function qy(e,t){const n=Object.keys(e.scenes).filter(i=>{var a;const s=(a=e.scenes[i])==null?void 0:a.timing;return s!==void 0&&Xh(s)});if(n.length===0)return{doc:e,reports:[]};const r=[],o={...e.scenes};for(const i of n){const s=o[i],a=UA(s.timing,t);if(a===null){const{timing:l,...c}=s;o[i]=c,r.push(`pinned timing for "${i}" is not in this cut — pin inert`);continue}o[i]={...s,timing:a}}return{doc:{...e,scenes:o},reports:r}}function Xl(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=HA(t.scenes,i.id);if(!s)return i;const a=s.component!==void 0&&s.component!==i.component,l=s.component??i.component,c=s.component!==void 0&&a?VA(s.component,s.props):{...i.props,...s.props},f=s.layout!==void 0&&s.layout!==i.layout,{graphicRect:p,...m}=i;return{...f?m:i,component:l,layout:s.layout??i.layout,props:c,...Object.keys(s.elements).length>0?{elements:s.elements}:{},...s.video?{video:s.video}:{},...s.pip?{pip:s.pip}:{},...s.captionY!==void 0?{captionY:s.captionY}:{},...s.captionScale!==void 0?{captionScale:s.captionScale}:{},...s.graphicRect?{graphicRect:s.graphicRect}:{},...s.timing&&!Xh(s.timing)&&!i.pinned?{startSec:s.timing.startSec,endSec:s.timing.endSec,pinned:!0}:{}}}),orphans:r}}const Zi=.3;function Pu(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+Zi&&r.at<=s.endSec-Zi);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 vS(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 ZA(e,t,n=qh(t.splits)){return vS(Pu(e,n),t)}function KA(e,t){const n=new Map;for(const o of t)o.anchor&&n.set(o.id,o.anchor);const r={};for(const[o,i]of Object.entries(e.scenes)){const s=n.get(o);r[o]=s?{...i,anchor:s}:i}return{...e,scenes:r}}function Sn(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 ya(e){return/^\d+$/.test(e)}function Ze(e){return!e||!Number.isFinite(e.srcStart)?null:Sn(e.srcStart)}const YA=8;function GA(e,t,n){var i,s;if(!ya(e))return{to:e};const r=Number(e);if(((i=n[r])==null?void 0:i.text)===t.was)return Jy(n[r]);const o=[];for(let a=1;a<=YA;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"}:Jy(n[o[0]])}function Jy(e){const t=Ze(e);return t===null?{to:null,reason:"unanchorable"}:{to:t}}function XA(e,t){const n=t.flatMap(a=>a.words),r={},o=[],i=Object.entries(e).map(([a,l])=>({key:a,edit:l,legacy:ya(a),claim:GA(a,l,n)})),s=new Map;for(const a of i){if(a.claim.to===null)continue;const l=s.get(a.claim.to);l?l.push(a):s.set(a.claim.to,[a])}for(const a of i){if(a.claim.to===null){o.push({key:a.key,was:a.edit.was,reason:a.claim.reason});continue}const l=s.get(a.claim.to),c=l.length===1?l[0]:l.find(f=>!f.legacy);if(c===a){r[a.claim.to]=a.edit;continue}o.push({key:a.key,was:a.edit.was,reason:c===void 0?"collision":"superseded"})}return{edits:r,unresolved:o}}function qA(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 wS(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=Ze(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 JA(e,t,n,r){const o=e.map(l=>l.length+1),i=o.reduce((l,c)=>l+c,0),s=[];let a=t;for(let l=0;l<e.length;l++){const c=(n-t)*o[l]/i,f=l===e.length-1?n:a+c;s.push({text:e[l],start:a,end:f,srcStart:r[l]}),a=f}return s}function xS(e,t){const n=[];if(t.length===0)return{lines:[...e],dropped:n};let r=[...e];const o=new Set,i=new Set;for(const s of t){const a=`${s.fromKey}..${s.toKey}`,l=[];for(let M=0;M<r.length;M++)for(let $=0;$<r[M].words.length;$++)l.push({line:M,word:$,w:r[M].words[$]});const c=l.findIndex(M=>Ze(M.w)===s.fromKey);if(o.has(a)||i.has(s.fromKey)){n.push({key:a,expected:s.was,found:c===-1?null:l[c].w.text,reason:"duplicate-anchor"});continue}if(c===-1){n.push({key:a,expected:s.was,found:null});continue}let f=-1;for(let M=c;M<l.length;M++)if(Ze(l[M].w)===s.toKey){f=M;break}if(f===-1){n.push({key:a,expected:s.was,found:null});continue}const p=l.slice(c,f+1),m=p.map(M=>M.w.text).join(" ").normalize("NFC");if(m!==s.was.normalize("NFC")){n.push({key:a,expected:s.was,found:m});continue}const g=s.text.trim().split(/\s+/).filter(Boolean);if(g.length===0){n.push({key:a,expected:s.was,found:m});continue}o.add(a);for(const M of p){const $=Ze(M.w);$!==null&&i.add($)}if(g.length===p.length){const M=new Map(p.map(($,U)=>[`${$.line}:${$.word}`,g[U]]));r=r.map(($,U)=>({...$,words:$.words.map((Y,A)=>{const T=M.get(`${U}:${A}`);return T===void 0?Y:{...Y,text:T}})}));continue}const w=[],x=new Map;for(const M of p){const $=x.get(M.line);$?($.last=M.word,$.words.push(M.w)):(w.push(M.line),x.set(M.line,{first:M.word,last:M.word,words:[M.w]}))}const k=w.map(M=>x.get(M).words.reduce(($,U)=>$+(U.end-U.start),0)),h=k.reduce((M,$)=>M+$,0),y=h>0?k:k.map(()=>1),v=h>0?h:k.length,b=y.map(M=>g.length*M/v),S=b.map(M=>Math.floor(M));let E=g.length-S.reduce((M,$)=>M+$,0);const C=b.map((M,$)=>({i:$,rem:M-Math.floor(M)})).sort((M,$)=>$.rem-M.rem||M.i-$.i);for(let M=0;E>0;M=(M+1)%C.length)S[C[M].i]++,E--;const I=p[0].w.srcStart,j=p[p.length-1].w.srcStart,F=g.map((M,$)=>g.length===1?I:I+(j-I)*$/(g.length-1));let N=0;const K=[];for(let M=0;M<r.length;M++){const $=r[M],U=x.get(M);if(!U){K.push($);continue}const Y=S[w.indexOf(M)],A=g.slice(N,N+Y),T=F.slice(N,N+Y);N+=Y;const W=Y===0?[]:JA(A,U.words[0].start,U.words[U.words.length-1].end,T),B=[...$.words.slice(0,U.first),...W,...$.words.slice(U.last+1)];B.length!==0&&K.push({...$,words:B})}r=K}return{lines:r,dropped:n}}function bS(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 m of i.words){const g=Ze(m),w=g===null?void 0:t[g];if(g===null||!w){s.push(m);continue}if(r.has(g)){n.push({key:g,expected:w.was,found:m.text,reason:"duplicate-anchor"}),s.push(m);continue}if(r.add(g),m.text!==w.was){n.push({key:g,expected:w.was,found:m.text}),s.push(m);continue}}if(s.length===i.words.length){o.push(i);continue}if(s.length===0)continue;const a=i.words[i.words.length-1],l=s[0],c=s[s.length-1],f=l===i.words[0]?i.start:l.start,p=c===a?i.end:Math.max(c.end,c.end+(i.end-a.end));o.push({words:s,start:f,end:p})}for(const[i,s]of Object.entries(t))r.has(i)||n.push({key:i,expected:s.was,found:null});return{lines:o,dropped:n}}const $u=.05;function SS(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 kS(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],m=Ze(p.words[0]),g=m===null?void 0:t[m];if(!(m===null||!g)){if(s.has(m)){n.push({key:m,expected:"",found:p.words[0].text,reason:"duplicate-anchor"});continue}s.add(m),i[f]=p.end+g.tail,f+1<r&&e[f+1].start===p.end&&(o[f+1]=i[f]),o[f]=p.start+g.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]+$u),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]-$u),a)}const c=e.map((f,p)=>{const m=o[p],g=i[p];return m===f.start&&g===f.end?f:{...f,start:m,end:g,words:SS(f.words,f.start,f.end,m,g)}});for(const f of Object.keys(t))s.has(f)||n.push({key:f,expected:"",found:null});return{lines:c,dropped:n}}function ES(e,t,n){const r=[];if(e.length===0){for(const s of Object.keys(t))r.push({key:s,expected:"",found:null});return{lines:[],dropped:r}}if(Object.keys(t).length===0)return{lines:[...e],dropped:r};const o=new Set,i=e.map(s=>{const a=Ze(s.words[0]),l=a===null?void 0:t[a];if(a===null||!l)return s;if(o.has(a))return r.push({key:a,expected:"",found:s.words[0].text,reason:"duplicate-anchor"}),s;o.add(a);const c=n.toOutputClamped(l.srcStart),f=Math.max(n.toOutputClamped(l.srcEnd),c+$u);return c===s.start&&f===s.end?s:{...s,start:c,end:f,words:SS(s.words,s.start,s.end,c,f)}});for(const s of Object.keys(t))o.has(s)||r.push({key:s,expected:"",found:null});return{lines:i,dropped:r}}function QA(e,t){return Pc.parse({...e,...t.theme})}function Qy(e,t,n,r){const o=e.scenes[t]??gS.parse({});return{...e,scenes:{...e.scenes,[t]:{...o,elements:{...o.elements,[n]:{...o.elements[n],...r}}}}}}function e4(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 t4(e,t,n){const r=e.scenes[t],o=r==null?void 0:r.elements[n];if(!r||!(o!=null&&o.hidden))return e;const{hidden:i,...s}=o,{[n]:a,...l}=r.elements,c=Object.keys(s).length>0?{...r.elements,[n]:s}:l;return{...e,scenes:{...e.scenes,[t]:{...r,elements:c}}}}function n4(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 r4(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 CS(e){const t=e.indexOf("@");return t===-1?e:e.slice(0,t)}const o4=.6;function i4(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 s4(e,t){const n=t.outputDurationSec,r=[...e].sort((f,p)=>f.startSec-p.startSec);if(n<=0)return r;const o=i4(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(g=>g>f.start+1e-9&&g<f.end-1e-9),m=[f.start,...p,f.end];for(let g=0;g<m.length-1;g++){const w=m[g],x=m[g+1];if(x-w<o4)continue;let k=0;for(let h=0;h<o.length;h++)o[h]<=w+1e-9&&(k=h);a.push({start:w,end:x,clip:k})}}const l=new Map,c=a.map(f=>{const p=l.get(f.clip)??0;return l.set(f.clip,p+1),{id:p===0?`take-${f.clip}`:`take-${f.clip}-${p}`,kind:"plain",layout:"full-bleed",startSec:f.start,endSec:f.end}});return[...r,...c].sort((f,p)=>f.startSec-p.startSec)}function a4(e){const t=new Map;for(const n of e){const r=n.id.split("@")[0],o=t.get(r);(o===void 0||n.startSec<o)&&t.set(r,n.startSec)}return t}const l4=1.05;function u4(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 c4(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 $c{constructor(t){Oe(this,"spans");Oe(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 to(e){return new $c(e.map(t=>({srcIn:t.srcIn,srcOut:t.srcOut,kind:"keep"})))}function IS(e,t,n){return Math.abs(e.outputDuration-t.outputDuration)>n||e.spans.length!==t.spans.length?!1:e.spans.every((r,o)=>{const i=t.spans[o];return Math.abs(r.srcIn-i.srcIn)<=n&&Math.abs(r.srcOut-i.srcOut)<=n&&Math.abs(r.outIn-i.outIn)<=n&&Math.abs(r.outOut-i.outOut)<=n})}function ev(e,t){const n=o=>o.words;if(e.every(o=>n(o).every(i=>i.srcStart!==void 0)))return[...e];const r=to(t);return e.map(o=>({...o,words:n(o).map(i=>i.srcStart===void 0?{...i,srcStart:r.toSource(i.start)}:i)}))}const d4=/[\p{Script=Arabic}\p{Script=Hebrew}\p{Script=Syriac}\p{Script=Thaana}\p{Script=Nko}]/u,f4=new RegExp("\\p{L}","u");function Jh(e){for(const t of e){if(d4.test(t))return"rtl";if(f4.test(t))return"ltr"}return"ltr"}const va="Noto Nastaliq Urdu",TS="fonts/NotoNastaliqUrdu-Bold.ttf";function p4(e){return e.some(t=>Jh(t.words.map(n=>n.text).join(" "))==="rtl")}const h4=1.5,tv=.7;function m4(e,t={}){const n=[...t.breakpoints??[]].sort((r,o)=>r-o);return e.map((r,o)=>{if(r.end-r.start>=tv)return r;let i=r.start+tv;const s=e[o+1];s&&(i=Math.min(i,s.start));const a=n.find(l=>l>r.start+1e-6);return a!==void 0&&(i=Math.min(i,a)),t.maxEnd!==void 0&&(i=Math.min(i,t.maxEnd)),i<=r.end?r:{...r,end:i}})}function g4(e){return e?{maxWordsPerLine:6,maxLineDuration:2.4}:{maxWordsPerLine:3,maxLineDuration:1.2}}function y4(e,t,n={}){var m,g;const r=n.maxWordsPerLine??3,o=n.maxLineDuration??1.2,i=n.maxGap??.6,s=n.hold??.35,a=[...n.breakpoints??[]].sort((w,x)=>w-x),l=[];for(const w of e.words){const x=t.mapWord(w);if(x){const k=Math.max(x.start,x.end-h4);l.push({text:w.text,start:k,end:x.end,srcStart:w.start})}}const c=[];let f=[];const p=()=>{f.length!==0&&(c.push({words:f,start:f[0].start,end:f[f.length-1].end}),f=[])};for(const w of l){const x=((m=f[0])==null?void 0:m.start)??w.start,k=(g=f[f.length-1])==null?void 0:g.end,h=f.length>0&&a.some(y=>y>x+1e-6&&y<=w.start+1e-6);(f.length>=r||w.end-x>o||k!==void 0&&w.start-k>i||h)&&p(),f.push(w)}p();for(let w=0;w<c.length;w++){const x=c[w],k=c[w+1],h=x.words[x.words.length-1].end,y=a.find(b=>b>x.start+1e-6);let v=x.end+s;k&&(v=Math.min(v,k.start)),y!==void 0&&(v=Math.min(v,y)),x.end=Math.min(Math.max(v,h),t.outputDuration)}return m4(c,{breakpoints:a,maxEnd:t.outputDuration})}const jS=9,v4=new Set(["a","an","and","as","at","but","by","for","from","in","is","it","of","on","or","the","to","with","that","this","my","your","so","had","has","have","was","were","will","can","should","i"]);function w4(e,t=jS){const n=e.trim().replace(/\s+/g," ");if(!n)return n;const r=a=>a.split(" ").filter(Boolean);if(r(n).length<=t)return n;const o=n.split(/\s*[—–:]\s*|\s+-\s+/)[0].trim(),i=r(o).length>=3?o:n,s=r(i).slice(0,t);for(;s.length>3&&v4.has(s[s.length-1].toLowerCase().replace(/\W/g,""));)s.pop();return s.join(" ").replace(/[,;:—–-]+$/,"")}function Mc(e){return e!=="user"&&e!=="clip"}function Qh(e,t){if(!t)return[];const n=t.kept??[];return e.filter(r=>{var o;return r.kind==="remove"&&Mc(r.reason)&&(r.reason!==void 0&&((o=t.reasons)==null?void 0:o[r.reason])===!1||n.some(i=>i.srcIn<r.srcOut&&i.srcOut>r.srcIn))})}function em(e,t){const n=(t==null?void 0:t.dismissed)??[];return n.length===0?[]:e.filter(r=>r.kind==="remove"&&Mc(r.reason)&&n.some(o=>o.srcIn<r.srcOut&&o.srcOut>r.srcIn))}function x4(e,t){const n=new Set([...Qh(e,t),...em(e,t)]);if(n.size===0)return[...e];const r=[];for(const o of e){const i=n.has(o)?{srcIn:o.srcIn,srcOut:o.srcOut,kind:"keep"}:o,s=r[r.length-1];if(s!==void 0&&s.kind==="keep"&&i.kind==="keep"){s.srcOut=i.srcOut;continue}r.push(i.kind==="keep"?{srcIn:i.srcIn,srcOut:i.srcOut,kind:"keep"}:i)}return r}function b4(e){return`take-kept-${Math.round(e*1e3)}`}const bl=.05;function S4(e,t,n){const r=[...e],o=[];for(const i of t){const s=b4(i.srcIn),a=`kept range ${i.srcIn.toFixed(3)}–${i.srcOut.toFixed(3)}s`;if(r.some(h=>h.id===s||h.id.startsWith(`${s}@`)))continue;if(i.srcOut-i.srcIn<Zi){o.push(`${a} is shorter than ${Zi}s — shown in the lane only`);continue}const l=n.toOutput(i.srcIn),c=n.toOutput(i.srcOut);if(l===null||c===null||c<=l){o.push(`${a} is not in this cut — no block carved`);continue}const f=r.findIndex(h=>h.startSec<=l+1e-6&&h.endSec>l+1e-6),p=f===-1?void 0:r[f];if(p===void 0){if(r.some(S=>S.startSec<c-1e-6&&S.endSec>l+1e-6)){o.push(`${a} straddles existing cues — no block carved`);continue}const y=[...r].filter(S=>S.kind==="plain").sort((S,E)=>Math.abs(S.startSec-l)-Math.abs(E.startSec-l))[0],v={id:s,kind:"plain",layout:(y==null?void 0:y.layout)??"video-top",...(y==null?void 0:y.video)!==void 0?{video:y.video}:{},startSec:l,endSec:c,...i.dismissed===!0?{}:{kept:{srcIn:i.srcIn,srcOut:i.srcOut}}},b=r.findIndex(S=>S.startSec>=c-1e-6);r.splice(b===-1?r.length:b,0,v);continue}if(p.kind!=="plain"){o.push(`${a} sits under graphic "${p.id}" — the graphic keeps the window`);continue}const m=Math.min(c,p.endSec);m<c-1e-6&&o.push(`${a} crosses out of take "${p.id}" — carved up to its edge (${m.toFixed(3)}s)`);const g={...p,id:s,startSec:Math.max(p.startSec,l),endSec:m,...i.dismissed===!0?{}:{kept:{srcIn:i.srcIn,srcOut:i.srcOut}}},w=l-p.startSec,x=p.endSec-m,k=[...w>=bl?[{...p,endSec:l}]:[],w>=bl?g:{...g,startSec:p.startSec},...x>=bl?[{...p,startSec:m}]:[]];if(x<bl){const h=k[k.length-1];k[k.length-1]={...h,endSec:p.endSec}}r.splice(f,1,...k)}return{cues:r,reports:o}}function k4(e,t,n,r,o){const i=n.toSource(t),s=r.toOutput(i);if(s!==null)return s;const a=r.toOutputClamped(i);return o.push(`${e} at ${t.toFixed(3)}s fell inside the new cut — snapped to ${a.toFixed(3)}s`),a}function E4(e,t){const n=[...t].sort((o,i)=>o.start-i.start);if(n.length===0)return[...e];const r=[];for(const o of e){if(o.kind!=="keep"){r.push(o);continue}let i=o.srcIn;for(const s of n){const a=Math.max(i,s.start),l=Math.min(o.srcOut,s.end);a>=l||(a>i&&r.push({srcIn:i,srcOut:a,kind:"keep"}),r.push({srcIn:a,srcOut:l,kind:"remove",reason:"user",confidence:1}),i=l)}i<o.srcOut&&r.push({srcIn:i,srcOut:o.srcOut,kind:"keep"})}return r}const tm=1e-6;function C4(e,t,n,r){var a,l;const o=Object.values((t==null?void 0:t.reasons)??{}).some(c=>c===!1)||(((a=t==null?void 0:t.kept)==null?void 0:a.length)??0)>0||(((l=t==null?void 0:t.dismissed)==null?void 0:l.length)??0)>0,i=n.flatMap(c=>c.src!==void 0&&c.src.endSec>c.src.startSec?[{start:c.src.startSec,end:c.src.endSec}]:[]);if(!(o||i.length>0)||r.length===0||e.length===0&&i.length===0)return null;try{const c=e.length>0?x4(e,t):r.map(m=>({srcIn:m.srcIn,srcOut:m.srcOut,kind:"keep"})),f=new $c(E4(c,i)),p=to(r);return IS(p,f,tm)?null:{oldMap:p,newMap:f}}catch{return null}}function I4(e,t={}){if(e===null){const o=i=>i;return{toLive:o,fromLive:o,hasOldClockPreimage:()=>!0,toSourceSec:t.identityToSource??null,oldToSourceSec:t.identityToSource??null}}const{oldMap:n,newMap:r}=e;return{toLive:o=>{const i=n.toSource(o);return r.toOutput(i)??r.toOutputClamped(i)},fromLive:o=>{const i=r.toSource(o);return n.toOutput(i)??n.toOutputClamped(i)},hasOldClockPreimage:o=>n.toOutput(r.toSource(o))!==null,toSourceSec:o=>r.toSource(o),oldToSourceSec:o=>n.toSource(o)}}function RS(e,t,n){const r=e.fromLive(t),o=e.fromLive(n);return o-r<tm?{kind:"degenerate"}:e.hasOldClockPreimage(t)&&e.hasOldClockPreimage(n)?{kind:"exact",startSec:r,endSec:o}:{kind:"shrunk",startSec:r,endSec:o,report:`cut ${t.toFixed(3)}s–${n.toFixed(3)}s trimmed to the last render's ${r.toFixed(3)}s–${o.toFixed(3)}s — the revived material at its edge isn't in the last render yet`}}function T4(e,t,n){const r=[],o=(s,a)=>k4(s,a,t,n,r),i={spans:n.spans.map(s=>({...s})),outputDurationSec:n.outputDuration,captionLines:e.captionLines.map((s,a)=>({...s,start:o(`caption line ${a+1} start`,s.start),end:o(`caption line ${a+1} end`,s.end),words:s.words.map(l=>({...l,start:o(`caption word "${l.text}" start`,l.start),end:o(`caption word "${l.text}" end`,l.end)}))})),sceneCues:e.sceneCues.flatMap(s=>{const a=o(`scene "${s.id}" start`,s.startSec),l=o(`scene "${s.id}" end`,s.endSec);return l-a<tm?(r.push(`scene "${s.id}" removed from the live preview by a cut`),[]):[{...s,startSec:a,endSec:l}]}),punch:{scale:1,allowed:[]}};return e.zoomPlan&&(i.zoomPlan=e.zoomPlan.map((s,a)=>({...s,startSec:o(`zoom segment ${a+1} start`,s.startSec),endSec:o(`zoom segment ${a+1} end`,s.endSec)}))),e.ctaWindow&&(i.ctaWindow={startSec:o("CTA window start",e.ctaWindow.startSec),endSec:o("CTA window end",e.ctaWindow.endSec)}),e.sourceTextRegions&&(i.sourceTextRegions=e.sourceTextRegions.map((s,a)=>({...s,startSec:o(`source text region ${a+1} start`,s.startSec),endSec:o(`source text region ${a+1} end`,s.endSec)}))),{fields:i,reports:r}}function Sl(e){const t=/^w(-?\d+)$/.exec(e);return t?Number(t[1]):null}function j4(e,t){const n=[];if(t.length===0)return{doc:e,reports:n};const r=new Map;for(const s of t)r.set(s.fromMs,s.toMs);const o=(s,a)=>{const l={},c=Object.entries(s).sort((f,p)=>(Sl(f[0])??0)-(Sl(p[0])??0));for(const[f,p]of c){const m=Sl(f),g=m===null?void 0:r.get(m),w=g===void 0?f:`w${g}`;if(!(w in l)){l[w]=p;continue}f in l?n.push(`${a} entry ${f} collided on both ${w} and its own key — dropped`):(l[f]=p,n.push(`${a} entry ${f} could not move to ${w} — another entry is already there; left where it was`))}return l},i=s=>{const a=Sl(s),l=a===null?void 0:r.get(a);return l===void 0?s:`w${l}`};return{doc:{...e,captions:o(e.captions,"caption retype"),captionWordsHidden:o(e.captionWordsHidden,"caption hide"),captionLineTiming:o(e.captionLineTiming,"caption timing"),captionLineWindows:o(e.captionLineWindows,"caption window"),captionRangeEdits:e.captionRangeEdits.map(s=>({...s,fromKey:i(s.fromKey),toKey:i(s.toKey)}))},reports:n}}const wn={width:1080,height:1920};wn.width;wn.height;const Da={centerYFrac:.38,sizeFrac:.22},R4=.35,F4=.45,FS=1-1/l4,P4=.4*FS,$4=.6*FS;function PS(e,t,n=wn){const r=e.w*n.width,o=e.h*n.height;return Math.max(o,r/(t.sourceAspect??n.width/n.height))}function M4(e,t,n=wn){if(t.subject==="screen")return .5;const r=e.h*n.height,o=PS(e,t,n),i=o-r;if(i<=1)return .5;const s=t.sizeFrac??Da.sizeFrac,a=(t.centerYFrac-s/2-R4*s)*o,l=(t.centerYFrac+s/2)*o,c=(a+l)/2-F4*r,f=a-P4*r,p=l+$4*r-r,m=p<=f?Math.min(Math.max(c,p),f):p;return Math.min(1,Math.max(0,m/i))}function _4(e,t,n,r,o=wn){if(r.length===0)return e;const i=t.h*o.height,s=PS(t,n,o);if(s-i<=1)return e;const l=i/s,c=1-l;if(c<=0)return e;let f=e*c;for(let p=0;p<r.length+1;p++){const m=r.find(v=>{const b=v.y,S=v.y+v.h,E=f+l,C=b<f&&f<S,I=b<E&&E<S;return C||I});if(!m)break;const g=[],w=m.y+m.h;w<=c&&g.push(w);const x=m.y-l;if(x>=0&&g.push(x),m.h<=l){const v=Math.max(0,m.y+m.h-l),b=Math.min(c,m.y);v<=b&&g.push(Math.min(Math.max(f,v),b))}const k=n.sizeFrac??Da.sizeFrac,h=n.centerYFrac+k/2,y=g.filter(v=>v+l>=h);if(y.length===0)return e;f=y.reduce((v,b)=>Math.abs(b-f)<Math.abs(v-f)?b:v)}return Math.min(1,Math.max(0,f/c))}function A4(e,t,n=wn){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 N4={top:.12,bottom:.22,right:.16,left:.04},L4={top:.06,bottom:.12,right:.05,left:.05};function pr(e=wn){return e.width>e.height?L4:N4}function O4(e=wn){const t=pr(e);return{x:t.left,y:t.top,w:1-t.left-t.right,h:1-t.top-t.bottom}}const D4=.08,z4=.05;function Mu(e,t=wn){const n=O4(t),r=1e-9,o=(c,f,p)=>c<f-r?f:c>p+r?p:c,i=o(e.w,D4,n.w),s=o(e.h,z4,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 nv=.045;function B4(e){return e.width>e.height?44:64}const Sr={x:0,y:0,w:1,h:1},$d=.3,oi={x:.5-$d/2,y:.66,w:$d,h:$d*1080/1920};function Wo(e,t=Da,n=[],r=wn){const o=a=>_4(M4(a,t,r),a,t,n,r),i=a=>A4(a,t,r),s=r.width>r.height;switch(e){case"full-bleed":return{video:{rect:Sr,cornerRadius:0,blurPx:0,dim:0,opacity:1,objectPosY:o(Sr),objectPosX:i(Sr)},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:Sr,cornerRadius:0,blurPx:0,dim:0,opacity:1,objectPosY:o(Sr),objectPosX:i(Sr)},graphic:a,captionAnchor:s?.62:.49}}case"split-left":case"split-right":{if(s){const l=e==="split-left",c={x:l?0:.5,y:0,w:.5,h:1};return{video:{rect:c,cornerRadius:0,blurPx:0,dim:0,opacity:1,objectPosY:o(c),objectPosX:i(c)},graphic:l?{x:.55,y:.2,w:.4,h:.56}:{x:.05,y:.2,w:.4,h:.56},captionAnchor:.82}}const a={x:0,y:0,w:1,h:.5};return{video:{rect:a,cornerRadius:0,blurPx:0,dim:0,opacity:1,objectPosY:o(a),objectPosX:i(a)},graphic:{x:.04,y:.58,w:.8,h:.2},captionAnchor:.53}}case"video-top":{const a={x:0,y:0,w:1,h:.42};return{video:{rect:a,cornerRadius:0,blurPx:0,dim:0,opacity:1,objectPosY:o(a),objectPosX:i(a)},graphic:{x:.04,y:.54,w:.8,h:.24},captionAnchor:.48}}case"pip-bubble":return{video:{rect:oi,cornerRadius:1,blurPx:0,dim:0,opacity:1,objectPosY:o(oi),objectPosX:i(oi)},graphic:{x:.06,y:.14,w:.78,h:.42},captionAnchor:s?.78:.61};case"graphic-only":return{video:{rect:oi,cornerRadius:1,blurPx:0,dim:0,opacity:0,objectPosY:o(oi),objectPosX:i(oi)},graphic:{x:.04,y:.14,w:.8,h:.54},captionAnchor:s?.8:.73};case"blurred-behind":return{video:{rect:Sr,cornerRadius:0,blurPx:22,dim:.55,opacity:1,objectPosY:o(Sr),objectPosX:i(Sr)},graphic:{x:.07,y:.24,w:.77,h:.36},captionAnchor:s?.8:.69}}}const W4={x:.07,y:.24,w:.77,h:.36};function $S(e,t=wn){return e.graphicRect?Mu(e.graphicRect,t):Wo(e.layout,Da,[],t).graphic??W4}const MS=.35;function co(e,t){for(const n of e)if(t>=n.startSec&&t<n.endSec)return n;return null}function Bn(e,t,n){return e+(t-e)*n}function V4(e,t,n){return{x:Bn(e.x,t.x,n),y:Bn(e.y,t.y,n),w:Bn(e.w,t.w,n),h:Bn(e.h,t.h,n)}}function rv(e,t,n){return{rect:V4(e.rect,t.rect,n),cornerRadius:Bn(e.cornerRadius,t.cornerRadius,n),blurPx:Bn(e.blurPx,t.blurPx,n),dim:Bn(e.dim,t.dim,n),opacity:Bn(e.opacity,t.opacity,n),objectPosY:Bn(e.objectPosY,t.objectPosY,n),objectPosX:Bn(e.objectPosX,t.objectPosX,n)}}function _u(e){return e*e*(3-2*e)}function _S(e){return e.filter(t=>!(t.kind==="plain"&&t.layout==="full-bleed"))}function Md(e,t,n,r){const o=Wo(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 H4(e,t,n=Da,r=[],o=wn){const i=_S(e),s=r.filter(h=>t>=h.startSec&&t<h.endSec),a=Wo("full-bleed",n,s,o).video,l=co(i,t);if(!l)return a;const c=Md(l,n,s,o),f=Math.min(MS,(l.endSec-l.startSec)/2),p=t-l.startSec,m=l.endSec-t,g=co(i,l.startSec-.001),w=co(i,l.endSec+.001),x=g?Md(g,n,s,o):a,k=w?Md(w,n,s,o):a;return p<f?rv(x,c,_u(p/f)):m<f?rv(c,k,_u(1-m/f)):c}function U4(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 _d(e){return e==="pip-bubble"||e==="graphic-only"?1:0}function Z4(e,t){const n=_S(e),r=co(n,t);if(!r)return 0;const o=_d(r.layout),i=Math.min(MS,(r.endSec-r.startSec)/2),s=co(n,r.startSec-.001),a=co(n,r.endSec+.001),l=s?_d(s.layout):0,c=a?_d(a.layout):0,f=t-r.startSec,p=r.endSec-t;return f<i?Bn(l,o,_u(f/i)):p<i?Bn(o,c,_u(1-p/i)):o}function K4(e,t,n){return e.filter(r=>(r.startSec??Number.NEGATIVE_INFINITY)<n&&(r.endSec??Number.POSITIVE_INFINITY)>t)}function Y4(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 G4(e,t,n,r=wn){const o=Wo(e,void 0,[],r),i=pr(r),s=o.captionAnchor,a=l=>{const c={y:l-nv,h:nv*2};if(c.y<i.top||c.y+c.h>1-i.bottom||Y4(c,t)>0)return!1;const f=n??o.graphic;return!(f&&Math.min(c.y+c.h,f.y+f.h)-Math.max(c.y,f.y)>0)};if(a(s))return s;for(let l=.02;l<=.6;l+=.02)for(const c of[s-l,s+l])if(a(c))return c;return s}const X4=.3,q4=.3,J4=.133,nm=e=>e*(2-e);function AS(e,t=X4,n=q4){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 ov=.4;function Q4(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 e3(e,t){return t?e>=t.startSec-ov&&e<=t.endSec+ov:!1}function t3(e,t){return e??B4(t)}function n3(e){return e*10/64}function r3(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 o3(e,t){return e==="rtl"?`'${va}', ${t}`:t}function i3(e){return e==="rtl"?1.9:1.15}const s3=()=>{const[e]=me.useState(()=>F2(`load ${va}`));return me.useEffect(()=>{let t=!1;const n=()=>{t||(t=!0,P2(e))};return new FontFace(va,`url("${Na(TS)}") format("truetype")`,{weight:"900"}).load().then(o=>{document.fonts.add(o),n()},n),n},[e]),null},a3=({line:e,wordOffset:t,verticalAnchor:n,fontSizePx:r,activeColor:o,fontFamily:i,textColor:s,ctaKeyword:a,ctaWindow:l})=>{const c=Nt(),{fps:f,width:p,height:m}=pt(),g=pr({width:p,height:m}),w=e.start+c/f,x=Jh(e.words.map(k=>k.text).join(" "));return u.jsx(Tn,{style:{pointerEvents:"none"},children:u.jsx("div",{style:{position:"absolute",top:`${n*100}%`,left:0,right:0,transform:"translateY(-50%)",direction:x,display:"flex",justifyContent:"center",gap:"0.28em",flexWrap:"wrap",paddingLeft:`${g.left*100}%`,paddingRight:`${g.right*100}%`,fontFamily:o3(x,i),fontWeight:900,fontSize:r,lineHeight:i3(x),textAlign:"center",color:s,WebkitTextStroke:`${n3(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,h)=>{const y=Math.max(k.end,k.start+.12),v=w>=k.start&&w<=y,b=v?Math.min(1,(w-k.start)/J4):0,S=nm(b);return u.jsx("span",{"data-caption-word":t+h,"data-caption-text":k.text,"data-caption-src":Ze(k)===null?void 0:k.srcStart,style:{display:"inline-block",pointerEvents:"auto",transform:S>0?`scale(${1+.08*S})`:"scale(1)",color:v?o:s},children:Q4(k.text,e3(k.start,l)?a:void 0)},h)})})})},l3=({lines:e,cues:t=[],verticalAnchor:n=.76,fontSizePx:r,activeColor:o="#FFE14D",theme:i,ctaKeyword:s,ctaWindow:a,sourceTextRegions:l=[]})=>{const{fps:c,width:f,height:p}=pt(),m={width:f,height:p},g=t3(r,m),{fontFamily:w,color:x}=r3(i),k=[];let h=0;for(const y of e)k.push(h),h+=y.words.length;return u.jsxs(Tn,{children:[p4(e)?u.jsx(s3,{}):null,e.map((y,v)=>{const b=t.length>0?co(t,y.start):null,S=(b==null?void 0:b.captionY)!==void 0?b.captionY:t.length>0||l.length>0?G4((b==null?void 0:b.layout)??"full-bleed",K4(l,y.start,y.end),b==null?void 0:b.graphicRect,m):n,{from:E,durationInFrames:C}=Cc(y.start,y.end,c);return u.jsx(Ft,{from:E,durationInFrames:C,children:u.jsx(a3,{line:y,wordOffset:k[v],verticalAnchor:S,fontSizePx:g*((b==null?void 0:b.captionScale)??1),activeColor:o,fontFamily:w,textColor:x,ctaKeyword:s,ctaWindow:a})},v)})]})};function NS(e,t,n,r=.5,o=.5){const i=Math.max(1,e.width),s=Math.max(1,e.height),a=Math.max(1,t.w),l=Math.max(1,t.h),c=Math.max(n.width/a,n.height/l),f=-t.x*c+(n.width-a*c)*iv(r),p=-t.y*c+(n.height-l*c)*iv(o);return{width:i*c,height:s*c,left:f,top:p}}function iv(e){return Number.isFinite(e)?Math.min(1,Math.max(0,e)):.5}function LS(e,t,n){const r=Math.max(1,e.width),o=Math.max(1,e.height),i=Math.max(1,t.w),s=Math.max(1,t.h),a=Math.min(n.width/i,n.height/s),l=-t.x*a+(n.width-i*a)/2,c=-t.y*a+(n.height-s*a)/2;return{width:r*a,height:o*a,left:l,top:c}}function u3(e,t){return LS(e,{x:0,y:0,w:e.width,h:e.height},t)}function OS(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 c3(e,t,n,r,o,i){return e==="fit"?LS(t,n,r):NS(t,n,r,o,i)}function d3(e,t,n,r){return e.length===0?{x:0,y:0,w:r.width,h:r.height,full:!0}:c4(e,OS(t,n),r)}function f3(e,t,n){if(e.length===0)return null;const r=OS(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 p3(e,t,n,r,o,i,s,a,l){if(!o)return null;if(e&&e.length>0){const f=f3(e,n,r);if(f)return NS(o,f.window,s,f.bias.x,f.bias.y)}if(!t||t.length<2)return null;const c=d3(t,n,r,o);return c.full?null:c3(i,o,c,s,a,l)}const h3=({cues:e,theme:t,face:n,zoomPlan:r,sourceTextRegions:o,contentTimeline:i,framingTimeline:s,spans:a,sourceSize:l,contentCropMode:c="cover",sourceFit:f="cover",children:p})=>{const m=Nt(),{fps:g,width:w,height:x}=pt(),k=m/g,y=H4(e,k,n??void 0,o??[],{width:w,height:x}),v=Z4(e,k),b=y.rect.w*w,S=y.rect.h*x,E=y.cornerRadius*Math.min(b,S)/2,C=co(e,k),I=C==null?void 0:C.video,j=r&&r.length>0?u4(r,k):1,F=Math.max(0,y.opacity*(1-.6*y.cornerRadius)),N=(I==null?void 0:I.autoZoom)!==!1,K=f==="contain"&&l!==void 0,M=N&&!K?1+(j-1)*F:1,$=(I==null?void 0:I.scale)??1,U=(I==null?void 0:I.dx)??0,Y=(I==null?void 0:I.dy)??0,A=U4(M,$,U,Y);return u.jsxs(Tn,{children:[u.jsx(Tn,{style:{background:t.bg,opacity:v}}),u.jsxs("div",{"data-edit-video":C==null?void 0:C.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:K?t.bg:void 0,boxShadow:y.cornerRadius>.5?"0 18px 60px rgba(0,0,0,0.55)":void 0},children:[u.jsx("div",{style:{position:"absolute",inset:0,filter:y.blurPx>.5?`blur(${y.blurPx}px)`:void 0,transform:A,transformOrigin:"50% 40%","--ossclip-obj-y":`${y.objectPosY*100}%`,"--ossclip-obj-x":`${y.objectPosX*100}%`},children:K?u.jsx(m3,{source:l,slot:{width:b,height:S},children:p}):u.jsx(g3,{timeline:i,framing:s,spans:a,sourceSize:l,mode:c,tSec:k,slot:{width:b,height:S},posX:y.objectPosX,posY:y.objectPosY,children:p})}),u.jsx("div",{style:{position:"absolute",inset:0,background:"black",opacity:y.dim}})]})]})},m3=({source:e,slot:t,children:n})=>{const r=u3(e,t);return u.jsx("div",{style:{position:"absolute",width:r.width,height:r.height,left:r.left,top:r.top},children:n})},g3=({timeline:e,framing:t,spans:n,sourceSize:r,mode:o,tSec:i,slot:s,posX:a,posY:l,children:c})=>{const f=p3(t,e,n??[],i,r,o,s,a,l);return f?u.jsx("div",{style:{position:"absolute",width:f.width,height:f.height,left:f.left,top:f.top},children:c}):u.jsx("div",{style:{position:"absolute",inset:0},children:c})},rm=.94,y3=new Set(["FlowDiagram","StrikethroughReveal","ChatMock","BulletList"]),sv=2.4,kl=.45,_c=.58,Kt=.72,v3=.62;function fi(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 et=e=>typeof e=="string"?e:"",qr=e=>Array.isArray(e)?e:[];function w3(e,t,n,r=1/0){switch(e){case"TitleCard":{const o=n-80,i=et(t.emphasis),s=28;let a=0,l=0;et(t.eyebrow)&&(a+=34*1.2,l++),i&&(a+=210*.95,l++);const c=i?64:96;return a+=fi(et(t.title).length,c,o,1.05,Kt),l++,et(t.sub)&&(a+=fi(et(t.sub).length,40,o,1.2,_c),l++),a+s*Math.max(0,l-1)}case"StatCard":{const o=fi(et(t.label).length,42,n*.55,1.15,Kt);let i=88+Math.max(o,110*1.15)+4;return et(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+=fi(et(t.text).length,72,o,1.02,Kt),et(t.struck)&&(i+=26+fi(et(t.struck).length,44,o,1.2,Kt)),i}case"StrikethroughReveal":{const o=qr(t.lines).map(a=>et(a==null?void 0:a.text)),i=VS(o,n,r),s=o.reduce((a,l)=>a+WS(l,i,n).length,0);return s*i*1.08+i*.2*Math.max(0,s-1)}case"FlowDiagram":{const o=qr(t.nodes).map(l=>et(l)),i=Math.max(1,o.length),{mode:s,fontSize:a}=XS(o,n,r);return s==="row"?a*Ys+4:a*(Ys*i+GS*(i-1))}case"TerminalMock":{const o=qr(t.windows);let i=0;for(const s of o){const a=qr(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),et(t.fanOut)&&(i+=22+40*1.2),i}case"ChatMock":{const o=KS(t).map(s=>s.text),i=YS(o,{widthPx:n,heightPx:r});return ZS(o,i,n)}case"ScreenshotFrame":{const o=n*.94;return(et(t.src)?o*9/16:480)+4}case"BulletList":{const o=qr(t.items).map(s=>et(s)),i=BS(o,n,r,!!et(t.title),et(t.title));return E3(o.length,i,!!et(t.title))}}}const Vr=e=>et(e).split(/\s+/).reduce((t,n)=>Math.max(t,n.length),0);function x3(e,t){switch(e){case"RuleCard":{const n=Vr(t.kicker)*30*(Kt+.28),r=Vr(t.text)*72*Kt,o=Vr(t.struck)*44*(Kt+.04),i=Math.max(n,r,o);return i>0?156+i:0}case"TitleCard":{const n=et(t.emphasis)?64:96,r=Vr(t.eyebrow)*34*(Kt+.35),o=Vr(t.emphasis)*210*Kt,i=Vr(t.title)*n*(Kt+.02),s=Vr(t.sub)*40*_c,a=Math.max(r,o,i,s);return a>0?80+a:0}case"TerminalMock":{let n=0;for(const r of qr(t.windows))for(const o of qr(r==null?void 0:r.lines))n=Math.max(n,et(o).length);return n>0?108+n*27*v3:0}case"StatCard":{const n=et(t.value).length*110*Kt;return n===0?0:164+Vr(t.label)*42*Kt+40+n}default:return 0}}const av=36,b3=120,DS=1.6,zS=.88,S3=(Kt+.28)*.36,k3=1.1;function E3(e,t,n){return(Math.max(1,e)*DS+(n?zS:0))*t}function BS(e,t=831,n=1/0,r=!1,o=""){const i=e.reduce((l,c)=>Math.max(l,c.length),0);if(i===0)return av;const s=Math.min(t/(i*Kt+k3),o?t/(o.length*S3):1/0),a=n*rm/(Math.max(1,e.length)*DS+(r?zS:0));return Math.max(av,Math.min(b3,Math.floor(Math.min(s,a))))}const C3=92,I3=44,T3=150,j3=[" → "," -> "," → "," > "];function WS(e,t,n){const r=o=>o.length*t*Kt<=n;if(r(e))return[e];for(const o of j3){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 VS(e,t=831,n=1/0){const r=e.reduce((s,a)=>Math.max(s,a.length),0);if(r===0)return C3;const o=t/(r*Kt),i=n/(Math.max(1,e.length)*1.28);return Math.max(I3,Math.min(T3,Math.floor(Math.min(o,i))))}const lv=22,uv=44,R3=96,cv=22,HS=.85,US=.82;function ZS(e,t,n){const o=(n-80)*US-2*t*HS;let i=0;for(const s of e)i+=fi(s.length,t,o,1.2,_c)+t*1.2+4;return i+t*.5*Math.max(0,e.length-1)}function KS(e){const t=et(e.keyword);return t?[{from:"user",text:`"${t.toUpperCase()}"`}]:qr(e.messages).map(n=>{const r=n??{};return{from:r.from==="agent"?"agent":"user",text:et(r.text)}})}function YS(e,t={}){const n=t.widthPx??831,r=t.heightPx??1/0,o=n-80,i=e.reduce((p,m)=>Math.max(p,m.length),0);if(i===0)return uv;const s=e.flatMap(p=>p.split(/\s+/)).reduce((p,m)=>Math.max(p,m.length),0),a=p=>o*US/(p*_c+2*HS),l=Math.min(i,cv),c=i>cv?uv:R3;let f=Math.floor(Math.min(a(l),a(s),c));for(;f>lv&&ZS(e,f,n)>r*rm;)f-=1;return Math.max(lv,f)}const dv=26,F3=22,P3=76,Ys=2.1,GS=2.05;function XS(e,t,n=1/0){const r=e.reduce((x,k)=>x+k.length,0),o=Math.max(1,e.length),i=.78,s=1.6,a=1.8,l=t-20,c=Math.floor(Math.min(l/(i*r+s*o+a*(o-1)),n/Ys)),f=Math.max(...e.map(x=>x.length),1),p=Ys*o+GS*(o-1),m=Math.floor(Math.min(l/(i*f+s),n/p,P3)),g=c>=dv;return m>=F3?g?c*Ys>=m*p?{mode:"row",fontSize:c}:{mode:"stack",fontSize:m}:{mode:"stack",fontSize:m}:{mode:"row",fontSize:Math.max(dv,c)}}function $3(e,t,n){if(y3.has(e))return 1;const r=n.heightPx*rm,o=c=>w3(e,t,n.widthPx/c)*c<=r;if(!o(kl))return kl;const i=x3(e,t),s=i>0?n.widthPx/i:sv;let a=kl,l=Math.max(kl,Math.min(sv,s));if(l<=a)return a;for(let c=0;c<24;c++){const f=(a+l)/2;o(f)?a=f:l=f}return a}function At(e=0){const t=Nt(),{fps:n}=pt();return ep({frame:t-e,fps:n,config:{damping:200,stiffness:130},durationInFrames:Math.round(n*.5)})}function mr(e,t=26){return{opacity:e,transform:`translateY(${(1-e)*t}px)`}}function Vo(e){return{opacity:e,transform:`scale(${.9+.1*e})`}}function M3(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 jt(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 _3=({props:e,theme:t,edits:n})=>{var l;const r=At(0),o=At(5),i=At(10),s=(l=e.emphasis)==null?void 0:l.trim(),a=!!s&&s.toLowerCase().includes(e.title.trim().toLowerCase());return u.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:28,textAlign:"center",fontFamily:t.fontDisplay,color:t.fg,padding:"0 40px"},children:[e.eyebrow?u.jsx("div",{"data-edit-id":"eyebrow",style:{...mr(r),fontSize:34,fontWeight:700,letterSpacing:"0.35em",color:t.muted,textTransform:"uppercase",...jt(n,"eyebrow")},children:e.eyebrow}):null,s?u.jsx("div",{"data-edit-id":"emphasis",style:{...mr(o,40),fontSize:210,fontWeight:900,lineHeight:.95,...jt(n,"emphasis")},children:s}):null,a?null:u.jsx("div",{"data-edit-id":"title",style:{...mr(s?i:o,34),fontSize:s?64:96,fontWeight:900,lineHeight:1.05,textTransform:"uppercase",letterSpacing:"0.02em",...jt(n,"title")},children:e.title}),e.sub?u.jsx("div",{"data-edit-id":"sub",style:{...mr(i),fontSize:40,fontWeight:600,color:t.muted,...jt(n,"sub")},children:e.sub}):null]})},A3=({props:e,theme:t,edits:n})=>{const r=At(0),o=At(6),i=e.inverted;return u.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:30,fontFamily:t.fontDisplay,width:"100%",padding:"0 30px"},children:[u.jsxs("div",{style:{...Vo(r),display:"flex",alignItems:"center",justifyContent:"space-between",gap:40,width:"100%",background:i?t.fg:t.cardBg,color:i?t.bg:t.fg,border:`2px solid ${i?t.fg:t.cardBorder}`,borderRadius:t.radiusPx,padding:"44px 52px"},children:[u.jsx("div",{"data-edit-id":"label",style:{fontSize:42,fontWeight:800,textTransform:"uppercase",letterSpacing:"0.06em",lineHeight:1.15,maxWidth:"55%",...jt(n,"label")},children:e.label}),u.jsx("div",{"data-edit-id":"value",style:{fontSize:110,fontWeight:900,whiteSpace:"nowrap",...jt(n,"value")},children:e.value})]}),e.caption?u.jsx("div",{"data-edit-id":"caption",style:{...mr(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",...jt(n,"caption")},children:e.caption}):null]})},N3=({props:e,theme:t,edits:n})=>{const r=At(0),o=At(8);return u.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:26,fontFamily:t.fontDisplay,width:"100%",padding:"0 30px"},children:[u.jsxs("div",{style:{...Vo(r),width:"100%",background:t.fg,color:t.bg,borderRadius:t.radiusPx,padding:"40px 48px",textAlign:"left"},children:[u.jsx("div",{"data-edit-id":"kicker",style:{fontSize:30,fontWeight:800,letterSpacing:"0.28em",textTransform:"uppercase",color:"#55555E",marginBottom:14,fontFamily:t.fontMono,...jt(n,"kicker")},children:e.kicker}),u.jsx("div",{"data-edit-id":"text",style:{fontSize:72,fontWeight:900,lineHeight:1.02,textTransform:"uppercase",...jt(n,"text")},children:e.text})]}),e.struck?u.jsx("div",{"data-edit-id":"struck",style:{...mr(o),fontSize:44,fontWeight:800,color:t.muted,textDecoration:"line-through",textDecorationThickness:6,textDecorationColor:t.danger,textTransform:"uppercase",letterSpacing:"0.04em",...jt(n,"struck")},children:e.struck}):null]})},L3=({text:e,struck:t,mark:n,delay:r,fontSize:o,theme:i,editId:s,edits:a})=>{const l=At(r),c=At(r+8);return u.jsxs("div",{"data-edit-id":s,style:{...mr(l,30),position:"relative",display:"inline-block",...jt(a,s)},children:[u.jsxs("span",{style:{fontSize:o,fontWeight:900,textTransform:"uppercase",lineHeight:1.08,whiteSpace:"nowrap",color:t?i.muted:i.fg},children:[n!=="none"?u.jsx("span",{style:{color:n==="cross"?i.danger:i.success,marginRight:"0.3em"},children:n==="cross"?"✗":"✓"}):null,e]}),t?u.jsx("div",{style:{position:"absolute",left:"-2%",top:"50%",height:o*.11,width:`${c*104}%`,background:i.danger,borderRadius:o*.055,transform:"translateY(-50%) rotate(-2deg)"}}):null]})},O3=({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=VS(i,n,r),a=e.lines.flatMap((l,c)=>WS(l.text,s,n??831).map((f,p)=>({text:f,struck:l.struck,mark:p===0?l.mark??"none":"none",lineIndex:c})));return u.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:s*.2,textAlign:"center",fontFamily:t.fontDisplay},children:a.map((l,c)=>u.jsx(L3,{text:l.text,struck:l.struck,mark:l.mark,delay:c*6,fontSize:s,theme:t,editId:`line-${l.lineIndex}`,edits:o},c))})},D3=({text:e,emphasized:t,delay:n,fontSize:r,theme:o,editId:i,edits:s})=>{const a=At(n);return u.jsx("div",{"data-edit-id":i,style:{...Vo(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,...jt(s,i)},children:e})},z3=({delay:e,fontSize:t,theme:n,down:r=!1})=>{const o=At(e);return u.jsx("div",{style:{opacity:o,color:n.muted,fontSize:t*1.15,fontWeight:700,lineHeight:1,paddingLeft:r?0:t*.55},children:r?"↓":"→"})};function B3(e,t=W3,n){return XS(e,t,n)}const W3=864,V3=({props:e,theme:t,widthPx:n,heightPx:r,edits:o})=>{const{mode:i,fontSize:s}=B3(e.nodes,n,r),a=i==="row";return u.jsx("div",{style:{display:"flex",flexDirection:a?"row":"column",flexWrap:"nowrap",alignItems:"center",justifyContent:"center",gap:a?0:s*.45,padding:"0 10px"},children:e.nodes.map((l,c)=>u.jsxs("div",{style:{display:"flex",flexDirection:a?"row":"column",alignItems:"center",gap:a?s*.55:s*.45},children:[c>0?u.jsx(z3,{delay:c*6+3,fontSize:s,theme:t,down:!a}):null,u.jsx(D3,{text:l,emphasized:e.emphasizeLast&&c===e.nodes.length-1,delay:c*6,fontSize:s,theme:t,editId:`node-${c}`,edits:o})]},c))})},H3=({title:e,lines:t,delay:n,theme:r,editId:o,edits:i})=>{const s=At(n);return u.jsxs("div",{"data-edit-id":o,style:{...Vo(s),background:r.cardBg,border:`2px solid ${r.cardBorder}`,borderRadius:r.radiusPx/2,overflow:"hidden",width:"100%",fontFamily:r.fontMono,...jt(i,o)},children:[u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 20px",borderBottom:`2px solid ${r.cardBorder}`},children:[["#FF5F57","#FEBC2E","#28C840"].map(a=>u.jsx("div",{style:{width:16,height:16,borderRadius:8,background:a}},a)),u.jsx("div",{style:{marginLeft:10,fontSize:24,color:r.muted},children:e})]}),u.jsx("div",{style:{padding:"18px 22px",display:"flex",flexDirection:"column",gap:8},children:t.map((a,l)=>u.jsx("div",{style:{fontSize:27,color:r.fg,whiteSpace:"pre"},children:a},l))})]})},U3=({props:e,theme:t,edits:n})=>{const r=At(e.windows.length*6+4);return u.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:22,width:"100%",padding:"0 30px"},children:[e.windows.map((o,i)=>u.jsx(H3,{title:o.title,lines:o.lines,delay:i*6,theme:t,editId:`window-${i}`,edits:n},i)),e.fanOut?u.jsxs("div",{"data-edit-id":"fanOut",style:{...mr(r),fontFamily:t.fontDisplay,fontSize:40,fontWeight:900,letterSpacing:"0.2em",color:t.fg,textTransform:"uppercase",...jt(n,"fanOut")},children:["⌄ ",e.fanOut]}):null]})},Z3=({from:e,text:t,delay:n,fontSize:r,theme:o,editId:i,edits:s})=>{const a=At(n),l=e==="user";return u.jsx("div",{"data-edit-id":i,style:{...Vo(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,...jt(s,i)},children:t})},K3=({props:e,theme:t,widthPx:n,heightPx:r,edits:o})=>{const i=KS(e),s=YS(i.map(a=>a.text),{widthPx:n,heightPx:r});return u.jsx("div",{style:{display:"flex",flexDirection:"column",gap:s*.5,width:"100%",padding:"0 40px"},children:i.map((a,l)=>u.jsx(Z3,{from:a.from,text:a.text,delay:l*8,fontSize:s,theme:t,editId:`message-${l}`,edits:o},l))})},Y3=({props:e,theme:t,edits:n})=>{const r=At(0),o=At(8),i=Nt(),{fps:s}=pt(),a=e.kenBurns?ns(i,[0,s*8],[1,1.08],{extrapolateRight:"clamp"}):1,l=e.src?/^https?:\/\//.test(e.src)?e.src:Na(e.src):null;return u.jsxs("div",{"data-edit-id":"src",style:{...Vo(r),position:"relative",width:"94%",...jt(n,"src")},children:[u.jsx("div",{style:{overflow:"hidden",borderRadius:t.radiusPx/2,border:`2px solid ${t.cardBorder}`,background:t.cardBg,boxShadow:"0 24px 80px rgba(0,0,0,0.5)"},children:l?u.jsx(Sc,{src:l,style:{width:"100%",display:"block",transform:`scale(${a})`}}):u.jsx("div",{style:{height:420,display:"flex",flexDirection:"column",gap:14,padding:30,transform:`scale(${a})`},children:[.9,.75,.85,.6,.8,.5].map((c,f)=>u.jsx("div",{style:{height:22,width:`${c*100}%`,borderRadius:6,background:f%3===0?t.cardBorder:"#22222B"}},f))})}),e.label?u.jsx("div",{"data-edit-id":"label",style:{...Vo(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",...jt(n,"label")},children:e.label}):null]})},G3=({text:e,index:t,fontSize:n,theme:r,edits:o})=>{const i=`item-${t}`,s=At(t*7);return u.jsxs("div",{"data-edit-id":i,style:{...mr(s,26),display:"flex",alignItems:"baseline",gap:n*.35,...jt(o,i)},children:[u.jsx("span",{style:{fontSize:n*.75,color:r.accent,fontWeight:900},children:"▸"}),u.jsx("span",{style:{fontSize:n,fontWeight:900,textTransform:"uppercase",lineHeight:1.15,whiteSpace:"nowrap",color:r.fg},children:e})]})},X3=({props:e,theme:t,widthPx:n,heightPx:r,edits:o})=>{const i=BS(e.items,n,r,!!e.title,e.title),s=At(0);return u.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:i*.45,fontFamily:t.fontDisplay},children:[e.title?u.jsx("div",{"data-edit-id":"title",style:{...mr(s,20),fontSize:i*.36,fontWeight:700,letterSpacing:"0.28em",textTransform:"uppercase",color:t.muted,...jt(o,"title")},children:e.title}):null,e.items.map((a,l)=>u.jsx(G3,{text:a,index:l,fontSize:i,theme:t,edits:o},l))]})},q3={TitleCard:_3,StatCard:A3,RuleCard:N3,StrikethroughReveal:O3,FlowDiagram:V3,TerminalMock:U3,ChatMock:K3,ScreenshotFrame:Y3,BulletList:X3},J3=new Set(["lower-third","full-bleed"]),Q3=.55,eN=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}, ${Q3})`},tN=e=>({width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",opacity:e,transform:e<1?`translateY(${(1-e)*18}px)`:void 0}),nN=({durationInFrames:e,children:t})=>{const n=Nt(),{fps:r}=pt(),{exitSec:o}=AS(e/r),i=(e-n)/r,s=o<=0?1:Math.min(1,Math.max(0,i/o));return u.jsx("div",{style:tN(nm(s)),children:t})},rN=({durationInFrames:e,themeBg:t,radiusPx:n})=>{const r=Nt(),{fps:o}=pt(),{enterSec:i}=AS(e/o),s=i<=0?1:Math.min(1,Math.max(0,r/o/i)),a=nm(s);return u.jsx("div",{style:{position:"absolute",inset:0,background:eN(t),backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)",borderRadius:n,opacity:a,transform:a<1?`translateY(${(1-a)*18}px)`:void 0}})},oN=({cues:e,theme:t})=>{const{fps:n,width:r,height:o}=pt();return u.jsx(Tn,{style:{pointerEvents:"none"},children:e.map(i=>{if(i.kind==="plain"||!i.component||!i.props)return null;const s=$S(i,{width:r,height:o}),a=q3[i.component],{from:l,durationInFrames:c}=Cc(i.startSec,i.endSec,n),f=s.w*r,p=s.h*o,m=J3.has(i.layout),g=m?Math.min(24,Math.round(p*.12)):0,w=f-g*2,x=p-g*2,k=$3(i.component,i.props,{widthPx:w,heightPx:x});return u.jsx(Ft,{from:l,durationInFrames:c,children:u.jsx("div",{"data-edit-scene":i.id,style:{position:"absolute",left:`${s.x*100}%`,top:`${s.y*100}%`,width:`${s.w*100}%`,height:`${s.h*100}%`,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"auto",overflow:"hidden"},children:u.jsxs(nN,{durationInFrames:c,children:[m?u.jsx(rN,{durationInFrames:c,themeBg:t.bg,radiusPx:t.radiusPx}):null,u.jsx("div",{style:{width:w/k,transform:`scale(${k})`,position:"relative"},children:u.jsx(a,{props:i.props,theme:t,widthPx:w/k,heightPx:x/k,edits:M3(i.elements,k)})})]})})},i.id)})})},iN="made with ossclip",sN=.45,aN=.024;function lN(e=wn){const t=pr(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)*aN),opacity:sN,text:iN}}function uN(e){return e===!0}const cN=({theme:e,frame:t})=>{const n=lN(t);return u.jsx("div",{style:{position:"absolute",left:n.xPx,top:n.yPx,fontFamily:e.fontDisplay,fontSize:n.fontPx,fontWeight:600,letterSpacing:"0.02em",color:e.fg,opacity:n.opacity,pointerEvents:"none",whiteSpace:"nowrap"},children:n.text})},dN=4;function fN(e){if(typeof e!="object"||e===null)return null;const t=e;return typeof t.fileName!="string"||t.fileName.length===0||typeof t.durationSec!="number"||!Number.isFinite(t.durationSec)||t.durationSec<=0?null:{fileName:t.fileName,durationSec:t.durationSec}}function pN(e,t){return Cc(0,e,t)}function hN(e,t){const n=Math.min(dN,t),r=t-e;return r>=n?1:Math.min(1,Math.max(0,r/n))}const mN=({cover:e,durationInFrames:t})=>{const n=Nt();return u.jsx(Tn,{style:{backgroundColor:"black",opacity:hN(n,t)},children:u.jsx(Sc,{src:/^https?:\/\//.test(e.fileName)?e.fileName:Na(e.fileName),style:{width:"100%",height:"100%",objectFit:"cover"}})})},gN=({cover:e})=>{const{fps:t}=pt(),{from:n,durationInFrames:r}=pN(e.durationSec,t);return u.jsx(Ft,{from:n,durationInFrames:r,layout:"none",children:u.jsx(Tn,{style:{pointerEvents:"none"},children:u.jsx(mN,{cover:e,durationInFrames:r})})})},yN=1;function vN(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(typeof n!="object"||n===null)continue;const r=n;typeof r.soundFile!="string"||r.soundFile.length===0||typeof r.atSec!="number"||!Number.isFinite(r.atSec)||r.atSec<0||r.gain!==void 0&&(typeof r.gain!="number"||!Number.isFinite(r.gain))||t.push({soundFile:r.soundFile,atSec:r.atSec,gain:Math.min(yN,Math.max(0,r.gain??1))})}return t}function wN(e,t,n){const r=[];for(const o of e){const i=Math.round(o.atSec*t);i<0||i>=n||r.push({...o,from:i})}return r}const xN=({cues:e})=>{const{fps:t,durationInFrames:n}=pt();return u.jsx(u.Fragment,{children:wN(e,t,n).map((r,o)=>u.jsx(Ft,{from:r.from,layout:"none",children:u.jsx(nj,{src:/^https?:\/\//.test(r.soundFile)?r.soundFile:Na(r.soundFile),volume:r.gain})},`${r.from}-${o}`))})};function bN(e){return e!==!0}const SN=({videoFileName:e,spans:t,captionLines:n,sceneCues:r,theme:o,settings:i,face:s,zoomPlan:a,ctaKeyword:l,ctaWindow:c,sourceTextRegions:f,contentTimeline:p,framingTimeline:m,sourceSize:g,contentCropMode:w,sourceFit:x,watermark:k,captionsHidden:h,staticCamera:y,punch:v,coverInVideo:b,sfxCues:S})=>{if(!e)return u.jsx(Tn,{style:{backgroundColor:"#111",color:"#888",alignItems:"center",justifyContent:"center",fontFamily:"monospace",fontSize:40},children:"no production loaded"});const E=/^https?:\/\//.test(e)?e:Na(e),C=x==="contain"||y===!0?null:mP(v),I=fN(b),j=vN(S);return u.jsxs(Tn,{style:{backgroundColor:"black"},children:[u.jsx(h3,{cues:r,theme:o,face:s,zoomPlan:a,sourceTextRegions:f,contentTimeline:p,framingTimeline:m,spans:t,sourceSize:g,contentCropMode:w,sourceFit:x,children:u.jsx(yP,{src:E,spans:t,...C?{punch:C}:{},...x==="contain"?{punchInScale:1,background:"transparent"}:{},...y===!0?{punchInScale:1}:{}})}),u.jsx(oN,{cues:r,theme:o}),j.length>0?u.jsx(xN,{cues:j}):null,bN(h)?u.jsx(l3,{lines:n,cues:r,activeColor:o.accent,theme:o,ctaKeyword:l,ctaWindow:c,sourceTextRegions:f}):null,uN(k)?u.jsx(cN,{theme:o,frame:{width:i.width,height:i.height}}):null,I?u.jsx(gN,{cover:I}):null]})},kN=600,EN=()=>({doc:WA(),past:[],future:[],dirty:!1,savedAt:0,lastCoalesce:null}),dr=(e,t)=>e.scenes[t]??{props:{},elements:{}},ii=e=>e.sfx??{edits:{},added:[]},si=(e,t)=>{if(Object.keys(t.edits).length>0||t.added.length>0)return{...e,sfx:t};if(e.sfx===void 0)return e;const{sfx:n,...r}=e;return r};function CN(e,t,n){const r=e.replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=`${r===""?"sfx":r}-${Math.max(0,Math.trunc(t))}`,i=new Set(n.map(s=>s.id));if(!i.has(o))return o;for(let s=2;;s++){const a=`${o}-${s}`;if(!i.has(a))return a}}function IN(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<kN;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=dr(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(Qy(e.doc,t.sceneId,t.elementId,t.patch),t.coalesce);case"clearElement":return n(e4(e.doc,t.sceneId,t.elementId));case"hideElement":return n(Qy(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(t4(e.doc,t.sceneId,t.elementId)):e}case"patchTiming":{const o=dr(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,timing:t.timing}}})}case"clearTiming":return n(n4(e.doc,t.sceneId));case"patchVideo":{const o=dr(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=dr(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=dr(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,captionY:t.y}}},t.coalesce)}case"patchCaptionScale":{const o=dr(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 t.at===void 0&&t.src===void 0||e.doc.splits.some(i=>t.src!==void 0&&i.src!==void 0?Math.abs(i.src-t.src)<.001:t.at!==void 0&&i.at!==void 0?Math.abs(i.at-t.at)<.001:!1)?e:n({...e.doc,splits:[...e.doc.splits,{...t.at!==void 0?{at:t.at}:{},...t.src!==void 0?{src:t.src}:{},id:LA(t.src??t.at,e.doc.splits)}].sort((i,s)=>(i.at??i.src??0)-(s.at??s.src??0))});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=dr(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:t.src===void 0||i.src.startSec!==t.src.startSec||i.src.endSec!==t.src.endSec);return n({...e.doc,cuts:[...o,{startSec:t.startSec,endSec:t.endSec,...t.src?{src:t.src}:{}}]})}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=dr(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,component:t.component}}})}case"patchLayout":{const{graphicRect:o,...i}=dr(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...i,layout:t.layout}}})}case"patchGraphicRect":{const o=dr(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,graphicRect:t.rect}}},t.coalesce)}case"clearGraphicRect":return n(r4(e.doc,t.sceneId));case"patchCaption":{const o=Sn(t.srcStart),i=Gy(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=Sn(t.fromSrcStart),i=Sn(t.toSrcStart),s=t.text.trim();if(!s)return e;const a=Xy(e.doc.captionRangeEdits,o,i,t.was);if(s===a){const k=e.doc.captionRangeEdits.filter(h=>h.fromKey!==o||h.toKey!==i);return k.length===e.doc.captionRangeEdits.length?e:n({...e.doc,captionRangeEdits:k})}const l=Math.min(Math.round(t.fromSrcStart*1e3),Math.round(t.toSrcStart*1e3)),c=Math.max(Math.round(t.fromSrcStart*1e3),Math.round(t.toSrcStart*1e3)),f=k=>{if(ya(k))return!1;const h=Number(k.slice(1));return h>=l&&h<=c},p=Object.fromEntries(Object.entries(e.doc.captions).filter(([k])=>!f(k))),m=Object.fromEntries(Object.entries(e.doc.captionWordsHidden).filter(([k])=>!f(k))),g=Object.fromEntries(Object.entries(e.doc.captionLineTiming).filter(([k])=>!f(k))),w=Object.fromEntries(Object.entries(e.doc.captionLineWindows).filter(([k])=>!f(k))),x=[...e.doc.captionRangeEdits.filter(k=>{const h=Math.min(Number(k.fromKey.slice(1)),Number(k.toKey.slice(1)));return Math.max(Number(k.fromKey.slice(1)),Number(k.toKey.slice(1)))<l||h>c}),{fromKey:o,toKey:i,text:s,was:a}];return n({...e.doc,captions:p,captionWordsHidden:m,captionLineTiming:g,captionLineWindows:w,captionRangeEdits:x})}case"patchCaptionAllOccurrences":{let o=e.doc.captions,i=!1;for(const s of t.entries){const a=Sn(s.srcStart),l=Gy(o,a,s.was);if(t.text===l){if(!(a in o))continue;const{[a]:f,...p}=o;o=p,i=!0;continue}const c=o[a];c!==void 0&&c.text===t.text&&c.was===l||(o={...o,[a]:{text:t.text,was:l}},i=!0)}return i?n({...e.doc,captions:o}):e}case"patchCaptionRangeAllOccurrences":{const o=t.text.trim();if(!o)return e;let i=e.doc,s=!1;for(const a of t.entries){const l=Sn(a.fromSrcStart),c=Sn(a.toSrcStart),f=Xy(i.captionRangeEdits,l,c,a.was);if(o===f){const w=i.captionRangeEdits.filter(x=>x.fromKey!==l||x.toKey!==c);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)),m=Math.max(Math.round(a.fromSrcStart*1e3),Math.round(a.toSrcStart*1e3)),g=w=>{if(ya(w))return!1;const x=Number(w.slice(1));return x>=p&&x<=m};i={...i,captions:Object.fromEntries(Object.entries(i.captions).filter(([w])=>!g(w))),captionWordsHidden:Object.fromEntries(Object.entries(i.captionWordsHidden).filter(([w])=>!g(w))),captionLineTiming:Object.fromEntries(Object.entries(i.captionLineTiming).filter(([w])=>!g(w))),captionLineWindows:Object.fromEntries(Object.entries(i.captionLineWindows).filter(([w])=>!g(w))),captionRangeEdits:[...i.captionRangeEdits.filter(w=>{const x=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||x>m}),{fromKey:l,toKey:c,text:o,was:f}]},s=!0}return s?n(i):e}case"patchCaptionLineTiming":{let o=e.doc.captionLineTiming,i=!1;for(const s of t.entries){const a=Sn(s.srcStart);if(Math.abs(s.lead)<.001&&Math.abs(s.tail)<.001){if(!(a in o))continue;const{[a]:c,...f}=o;o=f,i=!0;continue}const l=o[a];l!==void 0&&l.lead===s.lead&&l.tail===s.tail||(o={...o,[a]:{lead:s.lead,tail:s.tail}},i=!0)}return i?n({...e.doc,captionLineTiming:o}):e}case"patchCaptionLineWindows":{let o=e.doc.captionLineWindows,i=!1;for(const s of t.entries){const a=Sn(s.srcStart);if(s.window===null){if(!(a in o))continue;const{[a]:c,...f}=o;o=f,i=!0;continue}const l=o[a];l!==void 0&&l.srcStart===s.window.srcStart&&l.srcEnd===s.window.srcEnd||(o={...o,[a]:{...s.window}},i=!0)}return i?n({...e.doc,captionLineWindows:o}):e}case"hideCaptionWords":{const o={...e.doc.captionWordsHidden};let i=!1;for(const s of t.words){const a=Sn(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=Sn(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=Sn(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:t.src===void 0||s.src.startSec!==t.src.startSec||s.src.endSec!==t.src.endSec);return n({...e.doc,captionWordsHidden:o,cuts:[...i,{startSec:t.startSec,endSec:t.endSec,...t.src?{src:t.src}:{}}]})}case"setReasonEnabled":{const{reasons:o}=e.doc.cleanup;if(t.enabled){if(!(t.reason in o))return e;const{[t.reason]:i,...s}=o;return n({...e.doc,cleanup:{...e.doc.cleanup,reasons:s}})}return o[t.reason]===!1?e:n({...e.doc,cleanup:{...e.doc.cleanup,reasons:{...o,[t.reason]:!1}}})}case"toggleKept":{if(!(t.srcOut>t.srcIn))return e;const{kept:o}=e.doc.cleanup,i=o.filter(a=>!(a.srcIn<t.srcOut&&a.srcOut>t.srcIn)),s=i.length<o.length?{...e.doc.cleanup,kept:i}:{...e.doc.cleanup,kept:[...o,{srcIn:t.srcIn,srcOut:t.srcOut}]};return n({...e.doc,cleanup:s})}case"dismissRemoval":{if(!(t.srcOut>t.srcIn))return e;const{kept:o,dismissed:i}=e.doc.cleanup;return i.some(s=>s.srcIn<t.srcOut&&s.srcOut>t.srcIn)?e:n({...e.doc,cleanup:{...e.doc.cleanup,kept:o.filter(s=>!(s.srcIn<t.srcOut&&s.srcOut>t.srcIn)),dismissed:[...i,{srcIn:t.srcIn,srcOut:t.srcOut}]}})}case"restoreDismissed":{const{dismissed:o}=e.doc.cleanup,i=o.filter(s=>!(s.srcIn<t.srcOut&&s.srcOut>t.srcIn));return i.length===o.length?e:n({...e.doc,cleanup:{...e.doc.cleanup,dismissed:i}})}case"rekeyCaptionKeys":{if(t.mapping.length===0)return e;const{doc:o,reports:i}=j4(e.doc,t.mapping);for(const s of i)console.warn(`caption re-key: ${s}`);return n(o)}case"patchSfx":{const o=ii(e.doc),i=o.edits[t.key],s={...i};if(t.patch.word!==void 0&&(t.patch.word===t.planned.word?delete s.word:s.word=t.patch.word),t.patch.soundId!==void 0&&(t.patch.soundId===t.planned.soundId?delete s.soundId:s.soundId=t.patch.soundId),t.patch.gain!==void 0&&(t.patch.gain===(t.planned.gain??1)?delete s.gain:s.gain=t.patch.gain),i!==void 0&&i.word===s.word&&i.soundId===s.soundId&&i.gain===s.gain&&i.muted===s.muted)return e;const l={...o.edits};if(Object.keys(s).length===0){if(i===void 0)return e;delete l[t.key]}else l[t.key]=s;return n(si(e.doc,{...o,edits:l}),t.coalesce)}case"muteSfx":{const o=ii(e.doc),i=o.edits[t.key];return(i==null?void 0:i.muted)===!0?e:n(si(e.doc,{...o,edits:{...o.edits,[t.key]:{...i,muted:!0}}}))}case"restoreSfx":{const o=ii(e.doc),i=o.edits[t.key];if((i==null?void 0:i.muted)!==!0)return e;const{muted:s,...a}=i,l={...o.edits};return Object.keys(a).length===0?delete l[t.key]:l[t.key]=a,n(si(e.doc,{...o,edits:l}))}case"addSfx":{const o=ii(e.doc);return n(si(e.doc,{...o,added:[...o.added,{id:CN(t.soundId,t.word,o.added),soundId:t.soundId,word:t.word,...t.gain!==void 0?{gain:t.gain}:{}}]}))}case"patchSfxAdded":{const o=ii(e.doc),i=o.added.findIndex(c=>c.id===t.id);if(i===-1)return e;const s=o.added[i],a={...s,...t.patch.soundId!==void 0?{soundId:t.patch.soundId}:{},...t.patch.word!==void 0?{word:t.patch.word}:{},...t.patch.gain!==void 0?{gain:t.patch.gain}:{}};if(a.soundId===s.soundId&&a.word===s.word&&a.gain===s.gain)return e;const l=o.added.slice();return l[i]=a,n(si(e.doc,{...o,added:l}),t.coalesce)}case"removeSfxAdded":{const o=ii(e.doc),i=o.added.filter(s=>s.id!==t.id);return i.length===o.added.length?e:n(si(e.doc,{...o,added:i}))}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 TN(){const[e,t]=d.useReducer(IN,void 0,EN),n=d.useRef([]),r=async()=>{const o=KA(e.doc,n.current),i=await fetch("/api/overrides",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(o)});if(!i.ok){const s=await i.json().catch(()=>({}));throw new Error(s.error??"save failed")}t({type:"saved"})};return{doc:e.doc,dirty:e.dirty,canUndo:e.past.length>0,canRedo:e.future.length>0,load:o=>t({type:"load",doc:o}),undo:()=>t({type:"undo"}),redo:()=>t({type:"redo"}),save:r,syncCues:o=>{n.current=o},patchProps:(o,i,s)=>t({type:"patchProps",sceneId:o,patch:i,coalesce:s}),patchElement:(o,i,s,a)=>t({type:"patchElement",sceneId:o,elementId:i,patch:s,coalesce:a}),clearElement:(o,i)=>t({type:"clearElement",sceneId:o,elementId:i}),hideElement:(o,i)=>t({type:"hideElement",sceneId:o,elementId:i}),restoreElement:(o,i)=>t({type:"restoreElement",sceneId:o,elementId:i}),patchTiming:(o,i)=>t({type:"patchTiming",sceneId:o,timing:i}),clearTiming:o=>t({type:"clearTiming",sceneId:o}),patchVideo:(o,i,s)=>t({type:"patchVideo",sceneId:o,patch:i,coalesce:s}),clearVideo:o=>t({type:"clearVideo",sceneId:o}),patchPip:(o,i,s)=>t({type:"patchPip",sceneId:o,patch:i,coalesce:s}),clearPip:o=>t({type:"clearPip",sceneId:o}),patchCaptionY:(o,i,s)=>t({type:"patchCaptionY",sceneId:o,y:i,coalesce:s}),patchCaptionScale:(o,i,s)=>t({type:"patchCaptionScale",sceneId:o,scale:i,coalesce:s}),clearCaptionStyle:o=>t({type:"clearCaptionStyle",sceneId:o}),patchCaptionStyleAll:(o,i)=>t({type:"patchCaptionStyleAll",sceneIds:o,...i}),addSplit:o=>t({type:"addSplit",at:o.at,src:o.src}),setCaptionsHidden:o=>t({type:"setCaptionsHidden",hidden:o}),hideScene:o=>t({type:"hideScene",sceneId:o}),restoreScene:o=>t({type:"restoreScene",sceneId:o}),cutChunk:(o,i,s)=>t({type:"cutChunk",startSec:o,endSec:i,src:s}),restoreChunk:o=>t({type:"restoreChunk",index:o}),patchGraphicRect:(o,i,s)=>t({type:"patchGraphicRect",sceneId:o,rect:i,coalesce:s}),clearGraphicRect:o=>t({type:"clearGraphicRect",sceneId:o}),patchComponent:(o,i)=>t({type:"patchComponent",sceneId:o,component:i}),patchLayout:(o,i)=>t({type:"patchLayout",sceneId:o,layout:i}),patchCaption:(o,i,s)=>t({type:"patchCaption",srcStart:o,text:i,was:s}),patchCaptionRange:(o,i,s,a)=>t({type:"patchCaptionRange",fromSrcStart:o,toSrcStart:i,text:s,was:a}),patchCaptionAllOccurrences:(o,i)=>t({type:"patchCaptionAllOccurrences",entries:o,text:i}),patchCaptionRangeAllOccurrences:(o,i)=>t({type:"patchCaptionRangeAllOccurrences",entries:o,text:i}),patchCaptionLineTiming:o=>t({type:"patchCaptionLineTiming",entries:o}),patchCaptionLineWindows:o=>t({type:"patchCaptionLineWindows",entries:o}),hideCaptionWords:o=>t({type:"hideCaptionWords",words:o}),restoreCaptionWords:o=>t({type:"restoreCaptionWords",srcStarts:o}),cutWords:(o,i,s,a)=>t({type:"cutWords",words:o,startSec:i,endSec:s,src:a}),setReasonEnabled:(o,i)=>t({type:"setReasonEnabled",reason:o,enabled:i}),toggleKept:(o,i)=>t({type:"toggleKept",srcIn:o,srcOut:i}),dismissRemoval:(o,i)=>t({type:"dismissRemoval",srcIn:o,srcOut:i}),restoreDismissed:(o,i)=>t({type:"restoreDismissed",srcIn:o,srcOut:i}),rekeyCaptionKeys:o=>t({type:"rekeyCaptionKeys",mapping:o}),patchSfx:(o,i,s,a)=>t({type:"patchSfx",key:o,patch:i,planned:s,coalesce:a}),muteSfx:o=>t({type:"muteSfx",key:o}),restoreSfx:o=>t({type:"restoreSfx",key:o}),addSfx:(o,i,s)=>t({type:"addSfx",soundId:o,word:i,gain:s}),patchSfxAdded:(o,i,s)=>t({type:"patchSfxAdded",id:o,patch:i,coalesce:s}),removeSfxAdded:o=>t({type:"removeSfxAdded",id:o}),patchTheme:o=>t({type:"patchTheme",patch:o})}}function jN(e){const t=e.spans;if(t===void 0)return{};let n;try{n=to(t).spans.length}catch{return{}}if(n===0)return{};const r={};return e.captionLines&&(r.captionLines=ev(e.captionLines,t)),e.baseCaptionLines&&(r.baseCaptionLines=ev(e.baseCaptionLines,t)),r}function fv(e,t){const n=t.baseCaptionLines??t.captionLines??[],r=XA(e.captions,n);return{doc:{...e,captions:qA(e.captions,r)},unresolved:r.unresolved}}function qS(e){const t={};for(const[n,r]of Object.entries(e))ya(n)||(t[n]=r);return t}function RN(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 FN(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 JS(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 PN(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 $N(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 MN(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 Ad(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 _N(e){if(e===void 0||e.trim()==="")return null;const t=Number(e);return Ze({srcStart:t})===null?null:t}function AN(e,t,n){if(Object.keys(t).length===0)return{lines:[...e],dropped:[]};let r=null;try{r=n.length>0?to(n):null}catch{r=null}return r===null?{lines:[...e],dropped:Object.keys(t).map(o=>({key:o,expected:"",found:null}))}:ES(e,t,r)}function NN(e,t,n,r){const o=y4(e,t,{breakpoints:r.breakpoints,...g4(r.landscape)}),i=wS(o,qS(n.captions)).lines,s=xS(i,n.captionRangeEdits).lines,a=bS(s,n.captionWordsHidden).lines,l=kS(a,n.captionLineTiming),c=ES(l.lines,n.captionLineWindows,t);return{baseLines:o,liveLines:s,timingLines:a,lines:c.lines,dropped:[...l.dropped,...c.dropped]}}function QS(e){return`/api/sfx/audio?id=${encodeURIComponent(e)}`}function LN(e,t){if(t===null)return[];const n=[];for(let r=0;r<e.length;r++){const o=t.mapWord(e[r]);o!==null&&n.push({word:r,atSec:o.start})}return n}function ek(e,t){let n=null,r=1/0;for(const o of e){const i=Math.abs(o.atSec-t);i<r&&(n=o,r=i)}return n===null?null:n.word}function ON(e,t,n,r=new Map){if(e===null)return[];const o=new Map(n.map(a=>[a.word,a.atSec])),i=[],s=new Set;for(const a of e.placements){const l=OA(a),c=s.has(l)||t==null?void 0:t.edits[l];s.add(l);const f=(c==null?void 0:c.word)??a.word,p=(c==null?void 0:c.word)!==void 0?void 0:a.sceneId,m=p===void 0?void 0:r.get(p),g=m??o.get(f);g!==void 0&&i.push({key:l,kind:"planned",soundId:(c==null?void 0:c.soundId)??a.soundId,word:f,gain:(c==null?void 0:c.gain)??a.gain??1,muted:(c==null?void 0:c.muted)===!0,atSec:g,...m!==void 0&&p!==void 0?{sceneId:p}:{},planned:{soundId:a.soundId,word:a.word,...a.gain!==void 0?{gain:a.gain}:{}}})}for(const a of(t==null?void 0:t.added)??[]){const l=o.get(a.word);l!==void 0&&i.push({key:a.id,kind:"added",soundId:a.soundId,word:a.word,gain:a.gain??1,muted:!1,atSec:l})}return i.map((a,l)=>({m:a,i:l})).sort((a,l)=>a.m.atSec-l.m.atSec||a.i-l.i).map(a=>a.m)}function pv(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 hv(e){const t=e==null?void 0:e.closest("[data-edit-video]");return(t==null?void 0:t.dataset.editVideo)||null}function mv(e,t,n){const r=e.querySelectorAll(`[data-edit-scene="${t}"] [data-edit-id="${n}"]`);if(r.length===0)return null;let o=1/0,i=1/0,s=-1/0,a=-1/0;return r.forEach(l=>{const c=l.getBoundingClientRect();o=Math.min(o,c.left),i=Math.min(i,c.top),s=Math.max(s,c.right),a=Math.max(a,c.bottom)}),new DOMRect(o,i,s-o,a-i)}const gv=.015,DN=1e-9;function ai(e,t){let n=null,r=1/0;for(const o of e){const i=Math.abs(o.feature-o.target);i<=t+DN&&i<r&&(n=o,r=i)}return n}function yv(e,t,n,r){const o={...e},i=[];if(t==="move"){const s=e.x+e.w/2,a=e.x+e.w,l=.5-e.w/2,c=l>=n.left&&l+e.w<=1-n.right,f=ai([...c?[{target:.5,feature:s}]:[],{target:n.left,feature:e.x},{target:1-n.right,feature:a}],r);f&&(o.x=e.x+(f.target-f.feature),i.push({axis:"x",at:f.target}));const p=e.y+e.h/2,m=e.y+e.h,g=.5-e.h/2,w=g>=n.top&&g+e.h<=1-n.bottom,x=ai([...w?[{target:.5,feature:p}]:[],{target:n.top,feature:e.y},{target:1-n.bottom,feature:m}],r);return x&&(o.y=e.y+(x.target-x.feature),i.push({axis:"y",at:x.target})),{rect:o,guides:i}}if(t.includes("w")){const s=ai([{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=ai([{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=ai([{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=ai([{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 zN(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=CS(e.id);return{sceneId:e.id,rootId:o,isSplitHalf:o!==e.id,startSec:e.startSec,endSec:e.endSec,targets:n}}function vv(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 wv=64,El=9,Cl=e=>Math.round(e*10)/10,li=e=>Math.round(e*1e4)/1e4,tk={position:"absolute",width:10,height:10,background:"#5b8cff",border:"1px solid #0B0B0E",borderRadius:2,pointerEvents:"auto",zIndex:6},xv={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"}},BN={...tk,background:"#ffe14d"},WN={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}},VN={position:"absolute",cursor:"move",pointerEvents:"auto",zIndex:5},nk=/^(line|node|message|window|item)-(\d+)$/;function HN(e,t,n){const r=nk.exec(e);if(!r)return null;const o=r[1],i=Number(r[2]);if(o==="message"&&i===0&&typeof t.keyword=="string"&&t.keyword){const f=n.trim().replace(/^"(.*)"$/,"$1").toLowerCase();return f?{keyword:f}:null}const s=o==="line"?"lines":o==="node"?"nodes":o==="item"?"items":o==="window"?"windows":"messages",a=t[s];if(!Array.isArray(a)||i<0||i>=a.length)return null;const l=a.slice(),c=l[i];if(o==="node"||o==="item")l[i]=n;else if(o==="window"){if(typeof c!="object"||c===null)return null;const f=n.split(`
|
|
162
|
-
`).slice(0,6).map(p=>p.slice(0,40));l[i]={...c,lines:f}}else{if(typeof c!="object"||c===null)return null;l[i]={...c,text:n}}return{[s]:l}}function UN(e,t){const n=nk.exec(e);if(!n){const c=t[e];return typeof c=="string"?c:null}const r=n[1],o=Number(n[2]);if(r==="message"&&o===0&&typeof t.keyword=="string"&&t.keyword)return t.keyword;const s=t[r==="line"?"lines":r==="node"?"nodes":r==="item"?"items":r==="window"?"windows":"messages"];if(!Array.isArray(s)||o<0||o>=s.length)return null;const a=s[o];if(r==="node"||r==="item")return typeof a=="string"?a:null;if(r==="window"){const c=a==null?void 0:a.lines;return Array.isArray(c)&&c.every(f=>typeof f=="string")?c.join(`
|
|
163
|
-
`):null}const l=a==null?void 0:a.text;return typeof l=="string"?l:null}function rk(){const e=document.activeElement;(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&e.blur()}const ZN=({stageRef:e,selection:t,onSelect:n,edits:r,onSave:o,settings:i,playerRef:s,onTransport:a,onVideoPreview:l,onGraphicPreview:c,cue:f,cues:p,onToggleHelp:m,onRequestDelete:g,fromLive:w=y=>y,hasOldClockPreimage:x=()=>!0,toSourceSec:k=null,onClockRefused:h=()=>{}})=>{const[y,v]=d.useState(null),b=d.useRef(null),S=d.useRef(0),E=d.useRef(null),C=d.useRef(0),I=d.useRef(null),j=d.useRef(0),F=d.useRef(null),[N,K]=d.useState(!1),[M,$]=d.useState([]),U=d.useRef(null),[Y,A]=d.useState(null),[T,W]=d.useState(null),B=d.useRef(null),[D,se]=d.useState({dx:0,dy:0}),ie=d.useRef(null),L=d.useRef(t),V=d.useCallback(J=>{L.current=J,n(J)},[n]);d.useEffect(()=>{L.current=t},[t]);const ue=(J,ae)=>{const fe=[];let pe=null;for(let q=0;q<25;q++){const R=document.elementFromPoint(J,ae);if(!R||R===document.documentElement||R===document.body){pe=R;break}if(pe=R,R.hasAttribute("data-edit-id")||R.hasAttribute("data-edit-scene")||R.hasAttribute("data-caption-word")||R.closest("[data-edit-video]")!==null||["BUTTON","INPUT","SELECT","TEXTAREA"].includes(R.tagName)||!(R instanceof HTMLElement))break;fe.push({el:R,prev:R.style.pointerEvents}),R.style.pointerEvents="none"}return fe.forEach(({el:q,prev:R})=>{q.style.pointerEvents=R}),pe},oe=d.useCallback(()=>{var R,G;const J=e.current,ae=(R=s.current)==null?void 0:R.getScale(),fe=((G=J==null?void 0:J.querySelector(".__remotion-player"))==null?void 0:G.getBoundingClientRect())??(J==null?void 0:J.getBoundingClientRect());if(!fe||!ae||ae<=0)return null;const pe=i.width*ae,q=i.height*ae;return{left:fe.left+(fe.width-pe)/2,top:fe.top+(fe.height-q)/2,w:pe,h:q}},[e,s,i]);return d.useEffect(()=>{if(!t){v(null);return}let J;const ae=()=>{var pe;const fe=e.current;if(fe){const q=t.elementId?mv(fe,t.sceneId,t.elementId):((pe=fe.querySelector(`[data-edit-scene="${t.sceneId}"]`))==null?void 0:pe.getBoundingClientRect())??null;v(q)}J=requestAnimationFrame(ae)};return J=requestAnimationFrame(ae),()=>cancelAnimationFrame(J)},[e,t]),d.useEffect(()=>{const J=ae=>{var q,R;const fe=e.current;if(!fe||!fe.contains(ae.target)||ae.altKey||ae.button!==0)return;(((q=L.current)==null?void 0:q.elementId)&&((R=ie.current)==null?void 0:R.contains(ae.target))||pv(ue(ae.clientX,ae.clientY))!==null)&&ae.stopPropagation()};return window.addEventListener("pointerdown",J,!0),()=>window.removeEventListener("pointerdown",J,!0)},[e]),d.useEffect(()=>{const J=ae=>{var O,re,te,Se,Ie,_e,we;const fe=e.current;if(!fe||!fe.contains(ae.target))return;const pe=document.activeElement;if((pe instanceof HTMLInputElement||pe instanceof HTMLTextAreaElement)&&pe.contains(ae.target)||(rk(),ae.altKey||ae.button!==0))return;const q=ae.target instanceof Element?ae.target.closest("[data-el-handle]"):null,R=L.current;if(q&&(R!=null&&R.elementId)){const ke=mv(fe,R.sceneId,R.elementId);if(ke){const he=ke.left+ke.width/2,Ne=ke.top+ke.height/2,Te=Math.hypot(ae.clientX-he,ae.clientY-Ne);if(Te>2){const Ue=((re=(O=r.doc.scenes[R.sceneId])==null?void 0:O.elements[R.elementId])==null?void 0:re.scale)??1;U.current={sceneId:R.sceneId,elementId:R.elementId,cx:he,cy:Ne,startDist:Te,prior:Ue,factor:1},A(1)}}return}if((te=L.current)!=null&&te.elementId&&((Se=ie.current)!=null&&Se.contains(ae.target))){B.current={x:ae.clientX,y:ae.clientY,dx:0,dy:0},se({dx:0,dy:0});return}const G=ae.target instanceof Element?ae.target.closest("[data-box-handle]"):null,P=L.current;if(G&&P&&!P.elementId){const ke=fe.querySelector(`[data-edit-scene="${P.sceneId}"]`),he=oe();if(ke&&he){const Ne=ke.getBoundingClientRect();F.current=null,I.current={sceneId:P.sceneId,handle:G.dataset.boxHandle,x:ae.clientX,y:ae.clientY,dx:0,dy:0,start:{x:(Ne.left-he.left)/he.w,y:(Ne.top-he.top)/he.h,w:Ne.width/he.w,h:Ne.height/he.h}},K(!0)}return}const z=ue(ae.clientX,ae.clientY),Z=pv(z);if(!Z){const ke=z==null?void 0:z.closest("[data-edit-scene]");if(ke){V({sceneId:ke.dataset.editScene,elementId:null});return}const he=hv(z),Ne=fe.getBoundingClientRect().bottom;if(he&&ae.clientY<Ne-wv){V({sceneId:he,elementId:null});const Te=p.find(Je=>Je.id===he);if((Te==null?void 0:Te.layout)==="pip-bubble"&&!ae.altKey){const Je=Wo("pip-bubble",void 0,[],i).video.rect;E.current={sceneId:he,x:ae.clientX,y:ae.clientY,base:{x:((Ie=Te.pip)==null?void 0:Ie.x)??Je.x,y:((_e=Te.pip)==null?void 0:_e.y)??Je.y},slot:{w:Je.w,h:Je.h}};return}const Ue=(we=r.doc.scenes[he])==null?void 0:we.video;b.current={sceneId:he,x:ae.clientX,y:ae.clientY,dx:0,dy:0,baseDx:(Ue==null?void 0:Ue.dx)??0,baseDy:(Ue==null?void 0:Ue.dy)??0};return}V(null);return}V({sceneId:Z.sceneId,elementId:Z.elementId}),B.current={x:ae.clientX,y:ae.clientY,dx:0,dy:0},se({dx:0,dy:0})};return window.addEventListener("mousedown",J),()=>window.removeEventListener("mousedown",J)},[e,V,r,oe,p,i]),d.useEffect(()=>{const J=()=>{var R,G;const pe=(R=s.current)==null?void 0:R.getScale(),q=(G=e.current)==null?void 0:G.getBoundingClientRect();return pe&&pe>0?1/pe:q&&q.width>0?i.width/q.width:1},ae=pe=>{const q=e.current;if(q&&!(I.current||U.current))if(E.current)q.style.cursor="move";else if(b.current)q.style.cursor="grabbing";else{const O=pe.target instanceof Element?pe.target:null,re=O!==null&&q.contains(O)&&!O.closest("button, input, select, textarea, [data-edit-id], [data-edit-scene], [data-caption-word]")&&pe.clientY<q.getBoundingClientRect().bottom-wv,te=re&&(()=>{var Ie;const Se=hv(O);return Se!==null&&((Ie=p.find(_e=>_e.id===Se))==null?void 0:Ie.layout)==="pip-bubble"})();q.style.cursor=re?te?"move":"grab":""}const R=U.current;if(R){const re=Math.hypot(pe.clientX-R.cx,pe.clientY-R.cy)/R.startDist;R.factor=Math.min(4/R.prior,Math.max(.05/R.prior,re)),A(R.factor);return}const G=I.current;if(G){G.dx=pe.clientX-G.x,G.dy=pe.clientY-G.y,F.current=pe.altKey,j.current||(j.current=requestAnimationFrame(()=>{j.current=0;const O=I.current,re=oe();if(!O||!re)return;const te=Mu(vv(O.start,O.handle,O.dx/re.w,O.dy/re.h),i);if(pe.altKey)$([]),c({sceneId:O.sceneId,rect:te});else{const Se=yv(te,O.handle,pr(i),gv);$(Se.guides),c({sceneId:O.sceneId,rect:Se.rect})}}));return}if(E.current){C.current||(C.current=requestAnimationFrame(()=>{C.current=0;const O=E.current,re=oe();if(!O||!re)return;const te=(pe.clientX-O.x)/re.w,Se=(pe.clientY-O.y)/re.h;r.patchPip(O.sceneId,{x:li(Math.min(Math.max(O.base.x+te,0),1-O.slot.w)),y:li(Math.min(Math.max(O.base.y+Se,0),1-O.slot.h))},`pip:${O.sceneId}:drag`)}));return}const z=b.current;if(z){z.dx=pe.clientX-z.x,z.dy=pe.clientY-z.y,S.current||(S.current=requestAnimationFrame(()=>{S.current=0;const O=b.current;if(!O)return;const re=J();l({sceneId:O.sceneId,patch:{dx:O.baseDx+O.dx*re,dy:O.baseDy+O.dy*re}})}));return}const Z=B.current;Z&&(Z.dx=pe.clientX-Z.x,Z.dy=pe.clientY-Z.y,se({dx:Z.dx,dy:Z.dy}))},fe=pe=>{const q=U.current;if(q){U.current=null,A(null),Math.abs(q.factor-1)>.001&&r.patchElement(q.sceneId,q.elementId,{scale:Math.round(q.prior*q.factor*1e3)/1e3});return}const R=I.current;if(R){if(I.current=null,K(!1),$([]),j.current&&(cancelAnimationFrame(j.current),j.current=0),R.dx!==0||R.dy!==0){const O=oe();if(O){let re=Mu(vv(R.start,R.handle,R.dx/O.w,R.dy/O.h),i);(F.current??pe.altKey)||(re=yv(re,R.handle,pr(i),gv).rect),r.patchGraphicRect(R.sceneId,{x:li(re.x),y:li(re.y),w:li(re.w),h:li(re.h)})}}F.current=null,c(null);return}if(E.current){E.current=null,C.current&&(cancelAnimationFrame(C.current),C.current=0);return}const P=b.current;if(P){if(b.current=null,S.current&&(cancelAnimationFrame(S.current),S.current=0),P.dx!==0||P.dy!==0){const O=J();r.patchVideo(P.sceneId,{dx:Cl(P.baseDx+P.dx*O),dy:Cl(P.baseDy+P.dy*O)})}l(null);return}const z=B.current,Z=L.current;if(!z||!(Z!=null&&Z.elementId)){B.current=null;return}if(z.dx!==0||z.dy!==0){const O=J(),re=r.doc.scenes[Z.sceneId],te=re==null?void 0:re.elements[Z.elementId];r.patchElement(Z.sceneId,Z.elementId,{dx:Cl(((te==null?void 0:te.dx)??0)+z.dx*O),dy:Cl(((te==null?void 0:te.dy)??0)+z.dy*O)})}B.current=null,se({dx:0,dy:0})};return window.addEventListener("mousemove",ae),window.addEventListener("mouseup",fe),()=>{window.removeEventListener("mousemove",ae),window.removeEventListener("mouseup",fe)}},[r,e,i,s,l,c,oe,p]),d.useEffect(()=>{const J=ae=>{var G;const fe=e.current;if(!fe||!fe.contains(ae.target))return;const pe=(G=ue(ae.clientX,ae.clientY))==null?void 0:G.closest("[data-caption-word]");if(!pe)return;ae.preventDefault();const q=_N(pe.dataset.captionSrc),R=pe.dataset.captionText??"";q===null||!R||W({srcStart:q,was:R,draft:R,rect:pe.getBoundingClientRect()})};return window.addEventListener("dblclick",J),()=>window.removeEventListener("dblclick",J)},[e]),d.useEffect(()=>{const J=()=>{const q=document.activeElement;return q instanceof HTMLInputElement||q instanceof HTMLTextAreaElement||q instanceof HTMLSelectElement||q instanceof HTMLElement&&q.isContentEditable},ae=()=>{const q=document.activeElement;return q instanceof HTMLTextAreaElement||q instanceof HTMLElement&&q.isContentEditable?!0:q instanceof HTMLInputElement&&!["range","checkbox","radio","button"].includes(q.type)},fe=()=>{const q=document.activeElement;q instanceof HTMLElement&&!ae()&&q.blur()},pe=q=>{var G,P,z;if(T!==null)return;const R=q.metaKey||q.ctrlKey;if(q.key==="Escape"){if(J()){(G=document.activeElement)==null||G.blur();return}V(null)}else if(R&&q.key.toLowerCase()==="z")q.preventDefault(),q.shiftKey?r.redo():r.undo();else if(R&&q.key.toLowerCase()==="y")q.preventDefault(),r.redo();else if(R&&q.key.toLowerCase()==="s")q.preventDefault(),o();else if(q.key===" "&&!R){if(ae())return;const Z=document.activeElement;if(Z instanceof HTMLElement&&Z.tagName==="BUTTON"&&((P=e.current)!=null&&P.contains(Z)))return;fe(),q.preventDefault(),(z=s.current)==null||z.toggle()}else if(!R&&["j","k","l"].includes(q.key.toLowerCase())){if(ae())return;fe(),q.preventDefault(),a(q.key.toUpperCase())}else if(!R&&!q.altKey&&(q.key==="ArrowLeft"||q.key==="ArrowRight")){if(J())return;q.preventDefault();const Z=s.current;if(!Z)return;Z.seekTo(Math.max(0,Z.getCurrentFrame()+(q.key==="ArrowRight"?1:-1)))}else if(R&&q.key.toLowerCase()==="b"){{const Ie=document.activeElement;if(Ie instanceof HTMLTextAreaElement||Ie instanceof HTMLElement&&Ie.isContentEditable)return;Ie instanceof HTMLElement&&Ie.blur()}q.preventDefault();const Z=s.current;if(!Z)return;const O=Z.getCurrentFrame()/i.fps;if(!p.find(Ie=>O>=Ie.startSec+Zi&&O<=Ie.endSec-Zi))return;const te=k===null?void 0:Math.round(k(O)*1e3)/1e3,Se=x(O)?Math.round(w(O)*1e3)/1e3:void 0;if(Se===void 0&&te===void 0){h("Can't split here: this moment isn't anchorable yet — render once and try again.");return}r.addSplit({at:Se,src:te})}else if(!R&&q.altKey&&(q.key==="ArrowLeft"||q.key==="ArrowRight")){if(ae())return;const Z=L.current,O=Z?(()=>{const re=p.findIndex(te=>te.id===Z.sceneId);return re===-1?void 0:p[re+(q.key==="ArrowRight"?1:-1)]})():p[q.key==="ArrowRight"?0:p.length-1];if(!O)return;q.preventDefault(),V({sceneId:O.id,elementId:null})}else if(R&&(q.key==="ArrowLeft"||q.key==="ArrowRight")){if(ae())return;q.preventDefault();const Z=s.current;if(!Z)return;const O=Z.getCurrentFrame()/i.fps,re=p.findIndex(Se=>O>=Se.startSec&&O<Se.endSec),te=p[(re===-1?0:re)+(q.key==="ArrowRight"?1:-1)];if(!te)return;Z.seekTo(Math.round(te.startSec*i.fps)),V({sceneId:te.id,elementId:null})}else if(!R&&!q.altKey&&q.key==="?"){if(J())return;q.preventDefault(),m()}else if(!R&&(q.key==="Delete"||q.key==="Backspace")){if(J())return;const Z=L.current;if(!Z||Z.elementId!==null||!f||f.id!==Z.sceneId)return;const O=zN(f,r.doc);if(!O)return;q.preventDefault(),g(O)}};return window.addEventListener("keydown",pe),()=>window.removeEventListener("keydown",pe)},[V,r,T,o,s,e,a,f,p,i,m,g,w,x,k,h]),u.jsxs("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:[D.dx!==0||D.dy!==0||N?u.jsx("div",{"data-testid":"safe-area-guide",style:{position:"absolute",left:`${pr(i).left*100}%`,top:`${pr(i).top*100}%`,right:`${pr(i).right*100}%`,bottom:`${pr(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,M.map(J=>u.jsx("div",{"data-testid":`guide-${J.axis}`,style:{position:"absolute",pointerEvents:"none",background:"#FFE14D",...J.axis==="x"?{left:`${J.at*100}%`,top:0,bottom:0,width:1}:{top:`${J.at*100}%`,left:0,right:0,height:1}}},J.axis)),y&&t?u.jsxs("div",{ref:ie,"data-testid":"overlay-box",style:{position:"fixed",pointerEvents:"auto",left:y.left+D.dx-El/2+y.width*(1-(Y??1))/2,top:y.top+D.dy-El/2+y.height*(1-(Y??1))/2,width:y.width*(Y??1)+El,height:y.height*(Y??1)+El,border:t.elementId?"2px dashed #ffe14d":"2px dashed #5b8cff",borderRadius:4,boxShadow:"0 0 0 1px rgba(0,0,0,0.35)",cursor:t.elementId?"grab":"default"},children:[t.elementId?u.jsx("div",{style:{position:"absolute",bottom:"100%",left:0,marginBottom:4,fontSize:10,fontFamily:"ui-monospace, 'SF Mono', monospace",letterSpacing:"0.04em",textTransform:"uppercase",color:"#0B0B0E",background:"#ffe14d",padding:"2px 6px",borderRadius:3,whiteSpace:"nowrap"},children:t.elementId}):null,t.elementId?["nw","ne","se","sw"].map(J=>u.jsx("div",{"data-el-handle":J,"data-testid":`el-handle-${J}`,style:{...BN,...xv[J]}},J)):null,!t.elementId&&f&&f.kind!=="plain"?u.jsxs(u.Fragment,{children:[["top","bottom","left","right"].map(J=>u.jsx("div",{"data-box-handle":"move","data-testid":J==="top"?"box-handle-move":`box-handle-move-${J}`,style:{...VN,...WN[J]}},J)),["nw","n","ne","e","se","s","sw","w"].map(J=>u.jsx("div",{"data-box-handle":J,"data-testid":`box-handle-${J}`,style:{...tk,...xv[J]}},J))]}):null]}):null,T?u.jsx("input",{autoFocus:!0,"data-testid":"caption-edit",value:T.draft,onChange:J=>W({...T,draft:J.target.value}),onBlur:()=>{const J=T.draft.trim();J&&r.patchCaption(T.srcStart,J,T.was),W(null)},onKeyDown:J=>{J.key==="Enter"&&J.target.blur(),J.key==="Escape"&&W(null)},style:{position:"fixed",pointerEvents:"auto",left:T.rect.left-4,top:T.rect.top-4,width:Math.max(T.rect.width+40,90),height:T.rect.height+8,fontSize:Math.max(13,Math.min(T.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]})},rn={display:"flex",flexDirection:"column",gap:6},Rs={display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},De={fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"#9A9AA3"},Jr={fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",fontSize:13,background:"#0F0F14",border:"1px solid #2A2A33",borderRadius:6,color:"#fff",padding:"6px 8px",width:"100%"},mp={...Jr,fontFamily:"'Inter', system-ui, sans-serif"},He={display:"flex",flexDirection:"column",gap:14,padding:"16px 18px",borderBottom:"1px solid #22222a"},Et={fontSize:12,fontWeight:600,color:"#FF5C5C",background:"transparent",border:"1px solid #452626",borderRadius:6,padding:"7px 10px",cursor:"pointer"},Ct=()=>{var e,t;(t=(e=document.activeElement)==null?void 0:e.blur)==null||t.call(e)},KN=e=>String(Math.round(e*1e3)/1e3),bv=e=>Math.round(e*1e3)/1e3,ok=e=>{var t;try{(t=new Audio(QS(e)).play())==null||t.catch(()=>{})}catch{}},ik=(e,t)=>{const n=e.map(r=>u.jsxs("option",{value:r.id,children:[r.id," — ",r.whenToUse]},r.id));return t!==null&&!e.some(r=>r.id===t)&&n.unshift(u.jsxs("option",{value:t,children:[t," — not in the library any more"]},t)),n},Sv=({edits:e,library:t,wordAtPlayhead:n})=>{var l;const[r,o]=me.useState(""),[i,s]=me.useState(!1),a=r||((l=t[0])==null?void 0:l.id)||"";return u.jsxs("div",{style:He,"data-testid":"sfx-add-section",children:[u.jsx("span",{style:De,children:"Add a sound"}),t.length===0?u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"No sounds installed — drop a pack in ~/.ossclip/sfx."}):u.jsxs(u.Fragment,{children:[u.jsx("select",{"data-testid":"sfx-add-sound",style:Jr,value:a,onChange:c=>o(c.target.value),children:ik(t,null)}),u.jsxs("div",{style:{display:"flex",gap:8},children:[u.jsx("button",{"data-testid":"sfx-add",style:{...Et,color:"#EDEDF2",borderColor:"#2A2A33"},onClick:()=>{Ct();const c=n();if(c===null){s(!0);return}s(!1),e.addSfx(a,c)},children:"Add at playhead"}),u.jsx("button",{"data-testid":"sfx-add-preview",style:{...Et,color:"#EDEDF2",borderColor:"#2A2A33"},onClick:()=>{Ct(),ok(a)},children:"▸ Hear it"})]}),i?u.jsx("div",{"data-testid":"sfx-add-refused",style:{fontSize:12,color:"#FFE14D"},children:"No transcript word under the playhead — a sound effect is anchored to a word, so park the playhead over speech and try again."}):null]})]})},fn=({id:e,value:t,onCommit:n,min:r,max:o,dragStep:i})=>{const[s,a]=me.useState(null),[l,c]=me.useState(!1),f=me.useRef(null),p=me.useRef(null),m=r??-1/0,g=o??1/0,w=i??(r!==void 0&&o!==void 0?(o-r)/240:.5),x=s!==null;return u.jsxs("div",{style:rn,children:[u.jsx("span",{style:De,children:e}),u.jsx("input",{type:"text",inputMode:"decimal",ref:f,"data-testid":`field-${e}`,style:{...Jr,...x?{}:{cursor:"ew-resize",touchAction:"none"},...l?{borderColor:"#FFE14D",color:"#FFE14D"}:{}},value:s??(Number.isFinite(t)?KN(t):"0"),onFocus:k=>a(k.target.value),onBlur:()=>a(null),onPointerDown:k=>{x||(k.preventDefault(),p.current={x:k.clientX,v:Number.isFinite(t)?t:0,moved:!1},k.currentTarget.setPointerCapture(k.pointerId),c(!0))},onPointerMove:k=>{const h=p.current;if(!h)return;const y=k.clientX-h.x;if(!h.moved&&Math.abs(y)<=2)return;h.moved=!0;const v=Math.round(Math.min(g,Math.max(m,h.v+y*w))*1e3)/1e3;n(v)},onPointerUp:()=>{var h,y,v;const k=((h=p.current)==null?void 0:h.moved)===!0;p.current=null,c(!1),k||((y=f.current)==null||y.focus(),(v=f.current)==null||v.select())},onPointerCancel:()=>{p.current=null,c(!1)},onChange:k=>{a(k.target.value);const h=k.target.value.trim();if(h==="")return;const y=Number(h.replace(",","."));Number.isFinite(y)&&n(Math.min(g,Math.max(m,y)))}})]})},Il=({id:e,value:t,isColor:n,onCommit:r})=>u.jsxs("div",{style:rn,children:[u.jsx("span",{style:De,children:e}),u.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[n?u.jsx("input",{type:"color",value:t,onChange:o=>r(o.target.value),style:{width:28,height:28,border:"1px solid #2A2A33",borderRadius:6,padding:0,background:"none"}}):null,u.jsx("input",{"data-testid":`theme-${e}`,style:{...mp,flex:1},value:t,onChange:o=>r(o.target.value)})]})]}),YN=({selection:e,cue:t,frame:n,allSceneIds:r,edits:o,onSelect:i,resolvedTheme:s,anchorText:a,onVideoPreview:l,runInfo:c,captionsHiddenByFlag:f,fromLive:p=v=>v,hasOldClockPreimage:m=()=>!0,toSourceSec:g=null,onClockRefused:w=()=>{},sfxMarker:x=null,sfxLibrary:k=[],sfxEnabled:h=!1,sfxWordAtPlayhead:y=()=>null})=>{var j,F,N,K,M,$,U,Y,A,T,W,B;if(x){const D=x,se=D.kind==="added",ie=(L,V)=>{se?o.patchSfxAdded(D.key,L,V):D.planned&&o.patchSfx(D.key,L,D.planned,V)};return u.jsxs("div",{children:[u.jsxs("div",{style:He,children:[u.jsx("span",{style:De,children:"Sound effect"}),u.jsxs("div",{style:{fontSize:15,fontWeight:700,fontFamily:"ui-monospace, monospace"},children:[D.soundId,D.muted?u.jsx("span",{style:{color:"#9A9AA3",fontWeight:400},children:" (muted)"}):null,se?u.jsx("span",{style:{color:"#9A9AA3",fontWeight:400},children:" (added)"}):null]}),u.jsxs("div",{style:{fontSize:12,color:"#9A9AA3"},children:["anchored to word ",D.word," · drag the diamond to retime"]})]}),u.jsxs("div",{style:He,children:[u.jsxs("div",{style:rn,children:[u.jsx("span",{style:De,children:"Sound"}),u.jsx("select",{"data-testid":"sfx-sound",style:Jr,value:D.soundId,onChange:L=>ie({soundId:L.target.value}),children:ik(k,D.soundId)})]}),u.jsx("button",{"data-testid":"sfx-preview",style:{...Et,color:"#EDEDF2",borderColor:"#2A2A33"},onClick:()=>{Ct(),ok(D.soundId)},children:"▸ Hear it"})]}),u.jsx("div",{style:He,children:u.jsxs("div",{style:rn,children:[u.jsxs("span",{style:De,children:["gain"," ",u.jsxs("span",{style:{color:"#EDEDF2"},children:[D.gain.toFixed(2),"×"]})]}),u.jsx("input",{type:"range","data-testid":"sfx-gain-slider",min:0,max:2,step:.05,value:D.gain,onChange:L=>ie({gain:Number(L.target.value)},`sfx:${D.key}:gain`)})]})}),u.jsx("div",{style:He,children:se?u.jsx("button",{"data-testid":"sfx-delete",style:Et,onClick:()=>{Ct(),o.removeSfxAdded(D.key)},children:"Delete this sound"}):D.muted?u.jsxs(u.Fragment,{children:[u.jsx("button",{"data-testid":"sfx-restore",style:{...Et,color:"#EDEDF2",borderColor:"#2A2A33"},onClick:()=>{Ct(),o.restoreSfx(D.key)},children:"Restore this sound"}),u.jsx("div",{style:{fontSize:12,color:"#9A9AA3",marginTop:8},children:"Muted: it stays in the plan and out of the render."})]}):u.jsxs(u.Fragment,{children:[u.jsx("button",{"data-testid":"sfx-mute",style:Et,onClick:()=>{Ct(),o.muteSfx(D.key)},children:"Delete this sound"}),u.jsx("div",{style:{fontSize:12,color:"#9A9AA3",marginTop:8},children:"It stays in the lane as a ghost you can restore."})]})}),u.jsx(Sv,{edits:o,library:k,wordAtPlayhead:y})]})}if(e!=null&&e.elementId&&t){const D=e.elementId,se=((j=t.elements)==null?void 0:j[D])??{},ie=t.props?UN(D,t.props):null,L=/^window-\d+$/.test(D);return u.jsxs("div",{children:[u.jsxs("div",{style:He,children:[u.jsx("span",{style:De,children:"Selected"}),u.jsx("div",{style:{fontSize:15,fontWeight:700,fontFamily:"ui-monospace, monospace"},children:D})]}),(()=>{var fe;const V=/^line-(\d+)$/.exec(D),ue=(fe=t.props)==null?void 0:fe.lines;if(t.component!=="StrikethroughReveal"||!V||!Array.isArray(ue))return null;const oe=Number(V[1]),J=ue[oe];if(!J)return null;const ae=J.struck?"struck":(J.mark??"none")!=="none"?J.mark:"plain";return u.jsx("div",{style:He,children:u.jsxs("div",{style:rn,children:[u.jsx("span",{style:De,children:"Line style"}),u.jsxs("select",{"data-testid":"line-style",style:Jr,value:ae,onChange:pe=>{const q=pe.target.value,R=ue.slice();R[oe]={...R[oe],struck:q==="struck",mark:q==="cross"||q==="check"?q:"none"},o.patchProps(e.sceneId,{lines:R})},children:[u.jsx("option",{value:"plain",children:"plain"}),u.jsx("option",{value:"struck",children:"struck through"}),u.jsx("option",{value:"cross",children:"✗ wrong"}),u.jsx("option",{value:"check",children:"✓ right"})]})]})})})(),ie!==null?u.jsx("div",{style:He,children:u.jsxs("div",{style:rn,children:[u.jsx("span",{style:De,children:"Text"}),(()=>{const V=ue=>{const oe=t.props??{},J=/^(line|node|message|window|item)-\d+$/.test(D)?HN(D,oe,ue):{[D]:ue};J&&o.patchProps(e.sceneId,J,`text:${e.sceneId}:${D}`)};return L?u.jsx("textarea",{style:{...mp,resize:"vertical",fontFamily:"inherit"},"data-testid":"element-text",rows:Math.min(6,Math.max(2,ie.split(`
|
|
164
|
-
`).length)),value:ie,onChange:ue=>V(ue.target.value)}):u.jsx("input",{style:mp,"data-testid":"element-text",value:ie,onChange:ue=>V(ue.target.value)})})()]})}):null,u.jsxs("div",{style:He,children:[u.jsxs("div",{style:rn,children:[u.jsxs("span",{style:De,children:["scale"," ",u.jsxs("span",{style:{color:"#EDEDF2"},children:[(se.scale??1).toFixed(2),"×"]})]}),u.jsx("input",{type:"range","data-testid":"el-scale-slider",min:.1,max:3,step:.01,value:se.scale??1,onChange:V=>o.patchElement(e.sceneId,D,{scale:Number(V.target.value)},`element:${e.sceneId}:${D}:scale`)})]}),u.jsxs("div",{style:Rs,children:[u.jsx(fn,{id:"x",value:se.dx??0,dragStep:1,onCommit:V=>o.patchElement(e.sceneId,D,{dx:V},`element:${e.sceneId}:${D}:dx`)}),u.jsx(fn,{id:"y",value:se.dy??0,dragStep:1,onCommit:V=>o.patchElement(e.sceneId,D,{dy:V},`element:${e.sceneId}:${D}:dy`)})]}),u.jsx(fn,{id:"scale",value:se.scale??1,min:.05,max:4,dragStep:.01,onCommit:V=>o.patchElement(e.sceneId,D,{scale:V},`element:${e.sceneId}:${D}:scale`)})]}),u.jsxs("div",{style:He,children:[u.jsx("button",{style:Et,onClick:()=>{Ct(),o.clearElement(e.sceneId,D)},children:"Reset element"}),u.jsx("button",{"data-testid":"delete-element",style:{...Et,marginTop:8},onClick:()=>{Ct(),o.hideElement(e.sceneId,D),i({sceneId:e.sceneId,elementId:null})},children:"Delete element"})]})]})}if(e&&t){const D=t.kind==="plain";if(((F=o.doc.scenes[e.sceneId])==null?void 0:F.hidden)===!0)return u.jsx("div",{children:u.jsxs("div",{style:He,children:[u.jsx("span",{style:De,children:"Scene"}),u.jsxs("div",{style:{fontSize:15,fontWeight:700,fontFamily:"ui-monospace, monospace"},children:[e.sceneId," ",u.jsx("span",{style:{color:"#9A9AA3",fontWeight:400},children:"(deleted)"})]}),u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Its window plays as a plain take. Restore brings the graphic back."}),u.jsx("button",{"data-testid":"restore-scene",style:{...Et,color:"#5FBF77",border:"1px solid #24402c"},onClick:()=>{Ct(),o.restoreScene(e.sceneId)},children:"Restore scene"})]})});const se=o.doc.cuts.findIndex(L=>L.src===void 0&&L.startSec===t.startSec&&L.endSec===t.endSec);if(se!==-1)return u.jsx("div",{children:u.jsxs("div",{style:He,children:[u.jsx("span",{style:De,children:D?"Take":"Scene"}),u.jsxs("div",{style:{fontSize:15,fontWeight:700,fontFamily:"ui-monospace, monospace"},children:[e.sceneId," ",u.jsx("span",{style:{color:"#9A9AA3",fontWeight:400},children:"(marked for removal)"})]}),u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Struck through on the timeline. It disappears from the output on the next produce/Render — this preview still plays it (the editor doesn't re-derive a second cut timeline just to show one early)."}),u.jsx("button",{"data-testid":"restore-chunk",style:{...Et,color:"#5FBF77",border:"1px solid #24402c"},onClick:()=>{Ct(),o.restoreChunk(se)},children:"Restore"})]})});const ie=Object.entries(t.elements??{}).filter(([,L])=>L.hidden===!0).map(([L])=>{var oe,J;const ue=((J=(oe=o.doc.scenes[e.sceneId])==null?void 0:oe.elements[L])==null?void 0:J.hidden)===!0?e.sceneId:CS(e.sceneId);return{id:L,owningSceneId:ue}});return u.jsxs("div",{children:[u.jsxs("div",{style:He,children:[u.jsx("span",{style:De,children:D?"Take":"Scene"}),u.jsx("div",{style:{fontSize:15,fontWeight:700,fontFamily:"ui-monospace, monospace"},children:e.sceneId}),D?u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"A continuous stretch of the talking head — no graphic. Frame it below; its window follows the cut."}):null]}),u.jsxs("div",{style:He,children:[!D&&t.component?u.jsxs("div",{style:rn,children:[u.jsx("span",{style:De,children:"Component"}),u.jsx("select",{style:Jr,value:t.component,onChange:L=>o.patchComponent(e.sceneId,L.target.value),children:Fc.options.map(L=>u.jsx("option",{value:L,children:L},L))})]}):null,!D&&t.component?kA(t.component).map(L=>{var V,ue,oe;return L.kind==="boolean"?u.jsxs("div",{style:rn,children:[u.jsx("span",{style:De,children:L.key}),u.jsx("input",{type:"checkbox","data-testid":`prop-${L.key}`,checked:typeof((V=t.props)==null?void 0:V[L.key])=="boolean"?t.props[L.key]:L.fallback===!0,onChange:J=>o.patchProps(e.sceneId,{[L.key]:J.target.checked})})]},L.key):u.jsxs("div",{style:rn,children:[u.jsx("span",{style:De,children:L.key}),u.jsx("select",{style:Jr,"data-testid":`prop-${L.key}`,value:String(((ue=t.props)==null?void 0:ue[L.key])??((oe=L.options)==null?void 0:oe[0])??""),onChange:J=>o.patchProps(e.sceneId,{[L.key]:J.target.value}),children:(L.options??[]).map(J=>u.jsx("option",{value:J,children:J},J))})]},L.key)}):null,u.jsxs("div",{style:rn,children:[u.jsx("span",{style:De,children:"Layout"}),u.jsx("select",{style:Jr,"data-testid":"layout-select",value:t.layout,onChange:L=>o.patchLayout(e.sceneId,L.target.value),children:Rc.options.map(L=>u.jsx("option",{value:L,children:L},L))})]})]}),u.jsxs("div",{style:He,children:[u.jsx("span",{style:De,children:"Video framing"}),u.jsxs("div",{style:rn,children:[u.jsxs("span",{style:De,children:["zoom"," ",u.jsxs("span",{style:{color:"#EDEDF2"},children:[(((N=t.video)==null?void 0:N.scale)??1).toFixed(2),"×"]})]}),u.jsx("input",{type:"range","data-testid":"zoom-slider",min:.5,max:3,step:.01,value:((K=t.video)==null?void 0:K.scale)??1,onChange:L=>l({sceneId:e.sceneId,patch:{scale:Number(L.target.value)}}),onPointerUp:L=>{const V=Number(L.target.value);o.patchVideo(e.sceneId,{scale:V},`video:${e.sceneId}:scale`),l(null)},onKeyUp:L=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(L.key))return;const ue=Number(L.target.value);o.patchVideo(e.sceneId,{scale:ue},`video:${e.sceneId}:scale`),l(null)}})]}),u.jsxs("label",{style:{display:"flex",gap:8,alignItems:"center",fontSize:12,color:"#9A9AA3",cursor:"pointer"},children:[u.jsx("input",{type:"checkbox","data-testid":"auto-zoom",checked:((M=t.video)==null?void 0:M.autoZoom)!==!1,onChange:L=>o.patchVideo(e.sceneId,{autoZoom:L.target.checked})}),"auto zoom (the slow push composes on top of your zoom)"]}),u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Pan: drag the picture on the stage."}),u.jsx(fn,{id:"scale",value:(($=t.video)==null?void 0:$.scale)??1,min:.05,max:4,dragStep:.01,onCommit:L=>o.patchVideo(e.sceneId,{scale:L},`video:${e.sceneId}:scale`)}),u.jsxs("div",{style:Rs,children:[u.jsx(fn,{id:"dx",value:((U=t.video)==null?void 0:U.dx)??0,dragStep:1,onCommit:L=>o.patchVideo(e.sceneId,{dx:L},`video:${e.sceneId}:dx`)}),u.jsx(fn,{id:"dy",value:((Y=t.video)==null?void 0:Y.dy)??0,dragStep:1,onCommit:L=>o.patchVideo(e.sceneId,{dy:L},`video:${e.sceneId}:dy`)})]}),t.video?u.jsx("button",{style:Et,onClick:()=>{Ct(),o.clearVideo(e.sceneId)},children:"Reset framing"}):null]}),t.layout==="pip-bubble"?(()=>{const L=Wo("pip-bubble",void 0,[],n).video,V=t.pip??{},ue=V.cornerRadius??L.cornerRadius;return u.jsxs("div",{style:He,children:[u.jsx("span",{style:De,children:"PiP bubble"}),u.jsxs("div",{style:rn,children:[u.jsxs("span",{style:De,children:["roundness"," ",u.jsx("span",{style:{color:"#EDEDF2"},children:ue.toFixed(2)})]}),u.jsx("input",{type:"range","data-testid":"pip-roundness",min:0,max:1,step:.01,value:ue,onChange:oe=>o.patchPip(e.sceneId,{cornerRadius:Number(oe.target.value)},`pip:${e.sceneId}:cornerRadius`)})]}),u.jsxs("div",{style:Rs,children:[u.jsx(fn,{id:"pip-x",value:V.x??L.rect.x,min:0,max:1-L.rect.w,dragStep:.002,onCommit:oe=>o.patchPip(e.sceneId,{x:oe},`pip:${e.sceneId}:x`)}),u.jsx(fn,{id:"pip-y",value:V.y??L.rect.y,min:0,max:1-L.rect.h,dragStep:.002,onCommit:oe=>o.patchPip(e.sceneId,{y:oe},`pip:${e.sceneId}:y`)})]}),t.pip?u.jsx("button",{"data-testid":"reset-pip",style:Et,onClick:()=>{Ct(),o.clearPip(e.sceneId)},children:"Reset bubble"}):null]})})():null,(()=>{var ue;if(D)return null;const L=$S(t,n),V=oe=>J=>o.patchGraphicRect(e.sceneId,Mu({...L,[oe]:J},n),`box:${e.sceneId}:${oe}`);return u.jsxs("div",{style:He,children:[u.jsx("span",{style:De,children:"Graphic box"}),u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Frame fractions — or drag the handles on the stage."}),u.jsxs("div",{style:Rs,children:[u.jsx(fn,{id:"box-x",value:L.x,min:0,max:1,dragStep:.002,onCommit:V("x")}),u.jsx(fn,{id:"box-y",value:L.y,min:0,max:1,dragStep:.002,onCommit:V("y")})]}),u.jsxs("div",{style:Rs,children:[u.jsx(fn,{id:"box-w",value:L.w,min:.08,max:1,dragStep:.002,onCommit:V("w")}),u.jsx(fn,{id:"box-h",value:L.h,min:.05,max:1,dragStep:.002,onCommit:V("h")})]}),(ue=o.doc.scenes[e.sceneId])!=null&&ue.graphicRect?u.jsx("button",{"data-testid":"reset-box",style:Et,onClick:()=>{Ct(),o.clearGraphicRect(e.sceneId)},children:"Reset box"}):null]})})(),(()=>{const L=Wo(t.layout,void 0,[],n).captionAnchor,V=t.captionY??L,ue=t.captionScale??1,oe=o.doc.scenes[e.sceneId];return u.jsxs("div",{style:He,children:[u.jsx("span",{style:De,children:"Captions"}),o.doc.captionsHidden===!0||f===!0?u.jsxs("div",{"data-testid":"captions-hidden-hint",style:{fontSize:12,color:"#FFE14D"},children:["Captions are hidden globally",f===!0?" (--no-captions)":" (Theme panel)"," — these settings are kept and apply when captions are shown again."]}):null,u.jsxs("div",{style:rn,children:[u.jsxs("span",{style:De,children:["position"," ",u.jsx("span",{style:{color:"#EDEDF2"},children:V.toFixed(2)})]}),u.jsx("input",{type:"range","data-testid":"caption-y-slider",min:.05,max:.95,step:.01,value:V,onChange:J=>o.patchCaptionY(e.sceneId,Number(J.target.value),`captionY:${e.sceneId}`)})]}),u.jsxs("div",{style:rn,children:[u.jsxs("span",{style:De,children:["scale"," ",u.jsxs("span",{style:{color:"#EDEDF2"},children:[ue.toFixed(2),"×"]})]}),u.jsx("input",{type:"range","data-testid":"caption-scale-slider",min:.2,max:3,step:.01,value:ue,onChange:J=>o.patchCaptionScale(e.sceneId,Number(J.target.value),`captionScale:${e.sceneId}`)})]}),u.jsx(fn,{id:"caption-scale",value:ue,min:.2,max:3,dragStep:.01,onCommit:J=>o.patchCaptionScale(e.sceneId,J,`captionScale:${e.sceneId}`)}),u.jsx("button",{"data-testid":"caption-y-all",style:{...Et,color:"#EDEDF2",border:"1px solid #2A2A33"},title:"Write this scene's caption position and scale to every scene — one undo step",onClick:()=>{Ct(),o.patchCaptionStyleAll(r,{y:V,scale:ue})},children:"Apply to all scenes"}),(oe==null?void 0:oe.captionY)!==void 0||(oe==null?void 0:oe.captionScale)!==void 0?u.jsx("button",{"data-testid":"reset-caption-y",style:Et,onClick:()=>{Ct(),o.clearCaptionStyle(e.sceneId)},children:"Reset captions"}):null]})})(),u.jsxs("div",{style:He,children:[u.jsx("span",{style:De,children:"Timing"}),u.jsxs("div",{"data-testid":"timing-range",style:{fontSize:13,fontFamily:"ui-monospace, 'SF Mono', monospace"},children:[t.startSec.toFixed(2),"s – ",t.endSec.toFixed(2),"s",u.jsxs("span",{style:{color:"#9A9AA3"},children:[" ","(",(t.endSec-t.startSec).toFixed(2),"s)"]})]}),u.jsx("div",{style:{fontSize:12,color:t.pinned?"#FFE14D":"#9A9AA3"},children:D?"Derived from the cut — not movable":t.pinned?"Pinned to these times":"Tracking transcript"}),!t.pinned&&a?u.jsxs("div",{style:{fontSize:12,color:"#9A9AA3",fontStyle:"italic"},children:["“",a,"”"]}):null,t.pinned?u.jsx("button",{style:Et,onClick:()=>{Ct(),o.clearTiming(e.sceneId)},children:"Un-pin (re-anchor to words)"}):null]}),D?null:u.jsx("div",{style:He,children:u.jsx("button",{"data-testid":"delete-scene",style:Et,onClick:()=>{Ct(),o.hideScene(e.sceneId)},children:"Delete scene"})}),ie.length>0?u.jsxs("div",{style:He,children:[u.jsx("span",{style:De,children:"Hidden elements"}),ie.map(({id:L,owningSceneId:V})=>u.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[u.jsx("span",{style:{fontSize:13,fontFamily:"ui-monospace, monospace",color:"#C9C9D4"},children:L}),u.jsx("button",{"data-testid":`restore-element-${L}`,style:{...Et,color:"#5FBF77",border:"1px solid #24402c",padding:"4px 8px"},onClick:()=>{Ct(),o.restoreElement(V,L)},children:"Restore"})]},L))]}):null,u.jsxs("div",{style:He,children:[u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Removes this window from the output. The preview stops playing it immediately — Restore lives on the seam it leaves on the timeline."}),u.jsx("button",{"data-testid":"cut-chunk",style:Et,onClick:()=>{Ct();const L=RS({fromLive:p,hasOldClockPreimage:m},t.startSec,t.endSec);if(g!==null){const V={startSec:bv(g(t.startSec)),endSec:bv(g(t.endSec))},ue=L.kind==="degenerate"?{startSec:p(t.startSec),endSec:p(t.endSec)}:{startSec:L.startSec,endSec:L.endSec};o.cutChunk(ue.startSec,ue.endSec,V);return}if(L.kind==="degenerate"){w("Can't cut this window: it isn't in the last render yet — render once (or re-remove the pause) to cut it.");return}L.kind==="shrunk"&&console.warn(`ossclip cut preview: ${L.report}`),o.cutChunk(L.startSec,L.endSec)},children:"Delete this chunk"})]})]})}const v=o.doc.theme,b=(D,se)=>o.patchTheme({[D]:se}),S=D=>`${Math.floor(D/60)}:${String(Math.floor(D%60)).padStart(2,"0")}`,E=((A=c==null?void 0:c.usage)==null?void 0:A.totals)??null,C=((T=c==null?void 0:c.production)==null?void 0:T.producer)??null,I=((W=c==null?void 0:c.production)==null?void 0:W.clip)??null;return u.jsxs("div",{children:[u.jsxs("div",{style:He,children:[u.jsx("span",{style:De,children:"Theme"}),u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Nothing selected — global tokens."})]}),u.jsxs("div",{style:He,children:[u.jsx(Il,{id:"accent",value:v.accent??s.accent,isColor:!0,onCommit:D=>b("accent",D)}),u.jsx(Il,{id:"bg",value:v.bg??s.bg,isColor:!0,onCommit:D=>b("bg",D)}),u.jsx(Il,{id:"fg",value:v.fg??s.fg,isColor:!0,onCommit:D=>b("fg",D)}),u.jsx(fn,{id:"radiusPx",value:v.radiusPx??s.radiusPx,min:0,dragStep:.5,onCommit:D=>b("radiusPx",D)}),u.jsx(Il,{id:"fontDisplay",value:v.fontDisplay??s.fontDisplay,isColor:!1,onCommit:D=>b("fontDisplay",D)})]}),u.jsxs("div",{style:He,children:[u.jsx("span",{style:De,children:"Captions"}),u.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,color:"#EDEDF2",cursor:"pointer"},children:[u.jsx("input",{type:"checkbox","data-testid":"captions-visible-toggle",checked:o.doc.captionsHidden!==!0&&f!==!0,disabled:f===!0&&o.doc.captionsHidden!==!0,onChange:D=>o.setCaptionsHidden(!D.target.checked)}),"Show captions"]}),o.doc.captionsHidden===!0?u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Hidden everywhere — the CTA keyword styling rides the caption track, so it is hidden too. Per-scene caption position/scale edits are kept."}):null,f===!0?u.jsx("div",{"data-testid":"captions-flag-note",style:{fontSize:12,color:"#FFE14D"},children:"This project was produced with --no-captions, which Render replays — the toggle can't bring captions back here; re-run produce without the flag."}):null]}),h?u.jsx(Sv,{edits:o,library:k,wordAtPlayhead:y}):null,C||E?u.jsxs("div",{style:He,"data-testid":"run-info",children:[u.jsx("span",{style:De,children:"This video"}),C?u.jsxs("div",{style:{fontSize:12,color:"#C9C9D4"},children:["planned by ",u.jsx("span",{style:{color:"#EDEDF2"},children:C.provider}),C.models.length>0?` (${C.models.join(", ")})`:"",C.cached?" · reused from cache":"",C.at?` · ${new Date(C.at).toLocaleString()}`:""]}):null,E?u.jsxs("div",{style:{fontSize:12,color:"#C9C9D4"},children:[E.calls," LLM call",E.calls===1?"":"s"," ·"," ",E.inputTokens.toLocaleString()," in / ",E.outputTokens.toLocaleString()," out tokens",E.anyEstimated?" (partly estimated)":""]}):null,E&&E.equivalentUsd!==null?u.jsx("div",{style:{fontSize:12,color:"#C9C9D4"},children:E.allUnbilled?`~$${E.equivalentUsd.toFixed(2)} of API-rate work, covered by the subscription`:E.billedUsd!==null?`~$${E.billedUsd.toFixed(2)} charged at API rates`:`~$${E.equivalentUsd.toFixed(2)} at API rates`}):null,I?u.jsxs("div",{style:{fontSize:12,color:"#C9C9D4"},children:["clip: ",S(I.startSec),"–",S(I.endSec),(B=c==null?void 0:c.production)!=null&&B.sourceDuration?` of ${S(c.production.sourceDuration)}`:""," ","(--clip ",I.targetSec,")"]}):null]}):null,u.jsx("div",{style:He,children:u.jsx("div",{"data-testid":"ai-disclaimer",style:{fontSize:12,color:"#9A9AA3"},children:"AI can make mistakes. The cut, captions and graphics are generated — review them before publishing."})})]})},Nd=1.2,Au=.05;function kv(e,t,n,r){return n<=0||r<=0?0:Math.min(1,Math.max(0,(e-t)/n))*r}const GN=16,XN=e=>Math.min(GN,Math.max(1,e));function qN(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 om=e=>e.filter(t=>t.kind!=="plain");function JN(e,t,n,r){const o=om(e),i=o.findIndex(g=>g.id===t),s=o[i];if(!s)return null;const a=s.endSec-s.startSec,l=i>0?o[i-1]:void 0,c=i<o.length-1?o[i+1]:void 0,f=l?l.endSec+Au:0,p=c?c.startSec-Au:r,m=Math.min(Math.max(s.startSec+n,f),Math.max(f,p-a));return{startSec:m,endSec:m+a}}const Ev=e=>Math.round(e*1e3)/1e3;function Cv(e,t,n){if(!n)return{startSec:e,endSec:t};const r=Ev(n(e)),o=Ev(n(t));return o>r?{srcStart:r,srcEnd:o}:{startSec:e,endSec:t}}function QN(e,t,n,r,o){const i=om(e),s=i.findIndex(g=>g.id===t),a=s>0?i[s-1]:void 0,l=s>=0&&s<i.length-1?i[s+1]:void 0,c=a?a.endSec+Au:0,f=l?l.startSec-Au:o;let p=Math.min(Math.max(n,c),Math.max(c,f-Nd)),m=Math.max(Math.min(r,f),p+Nd);return m>f&&(m=f,p=Math.max(c,m-Nd)),{startSec:p,endSec:m}}function Iv(e,t,n,r){const o=[0,r,n];for(const a of om(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 Tl(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 sk(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 Ld(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 im={silence:"#4DA3FF",pause:"#B78CFF",filler:"#FFB84D",retake:"#FF7AB8",user:"#6BDD8B",clip:"#4DDCD4"},eL="#8a8a95";function tL(e){const t=`${(e.srcOut-e.srcIn).toFixed(1)}s removed`;return e.reason?`${e.reason} · ${t}`:t}const nL=1e-6;function rL(e,t,n){if(t.length===0)return[];const r=new Set(Qh(e,n)),o=new Set(em(e,n)),i=[];for(const s of e){if(o.has(s)||s.kind!=="remove"||s.srcOut<=s.srcIn)continue;const a=sk(t,s.srcIn),l=i.filter(c=>Math.abs(c.outSec-a)<nL).length;i.push({srcIn:s.srcIn,srcOut:s.srcOut,reason:s.reason,outSec:a,label:tL(s),color:s.reason?im[s.reason]:eL,stackIndex:l,vetoable:Mc(s.reason),vetoed:r.has(s)})}return i}const oL={silence:"Silences",pause:"Pauses",filler:"Fillers",retake:"Retakes",user:"Your cuts",clip:"Clip window"};function iL(e){const t=new Map;for(const n of e){if(n.kind!=="remove"||n.reason===void 0||!Mc(n.reason)||n.srcOut<=n.srcIn)continue;const r=t.get(n.reason)??{reason:n.reason,count:0,seconds:0};r.count+=1,r.seconds+=n.srcOut-n.srcIn,t.set(n.reason,r)}return Object.keys(im).map(n=>t.get(n)).filter(n=>n!==void 0)}function sL(e){return{keep:e.vetoed?"Re-remove":"Keep this (preview plays it)",dismiss:e.reason!==void 0?`Not a ${e.reason} — remove marker`:"Remove marker — keep as footage"}}const aL=({x:e,y:t,items:n,onClose:r})=>{d.useEffect(()=>{const i=a=>{a.key==="Escape"&&(a.stopPropagation(),r())},s=()=>r();return window.addEventListener("keydown",i,!0),window.addEventListener("mousedown",s),window.addEventListener("scroll",s,!0),window.addEventListener("contextmenu",s),()=>{window.removeEventListener("keydown",i,!0),window.removeEventListener("mousedown",s),window.removeEventListener("scroll",s,!0),window.removeEventListener("contextmenu",s)}},[r]);const o=Math.min(e,(typeof window<"u"?window.innerWidth:1280)-200);return u.jsx("div",{"data-testid":"context-menu",role:"menu",style:{...lL,left:o,top:t},onMouseDown:i=>i.stopPropagation(),onContextMenu:i=>i.preventDefault(),children:n.map(i=>u.jsx("button",{role:"menuitem","data-testid":`context-menu-item-${i.label}`,style:uL,onMouseDown:s=>s.stopPropagation(),onClick:()=>{i.onPick(),r()},onMouseEnter:s=>{s.currentTarget.style.background="#22222c"},onMouseLeave:s=>{s.currentTarget.style.background="transparent"},children:i.label},i.label))})},lL={position:"fixed",zIndex:80,minWidth:180,background:"#16161d",border:"1px solid #2C2C38",borderRadius:6,padding:4,boxShadow:"0 10px 32px rgba(0,0,0,0.55)"},uL={display:"block",width:"100%",textAlign:"left",background:"transparent",border:"none",borderRadius:4,padding:"7px 10px",color:"#EDEDF2",fontSize:12,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",cursor:"pointer",whiteSpace:"nowrap"},cL=.75;function dL(e,t,n){return t>e?t-e>cL?[]:n.filter(r=>!r.muted&&r.atSec>e&&r.atSec<=t):[]}function fL(e){return Number.isFinite(e)?Math.min(1,Math.max(0,e)):1}function pL(e){const t=[];for(const n of e)n.muted||t.includes(n.soundId)||t.push(n.soundId);return t}const hL=10,Tv=4,jv=8,Rv=8,mL=300,gL=e=>{const t=Math.max(0,Math.round(e));return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`},yL=(e,t)=>{const[n,r]=me.useState({}),o=me.useRef({}),i=t.map(s=>s.toFixed(1)).join(",");return me.useEffect(()=>{if(!e||t.length===0)return;const s=[...new Set(t.map(p=>p.toFixed(1)))].filter(p=>o.current[p]===void 0);if(s.length===0)return;let a=!1;const l=document.createElement("video");l.src=e,l.muted=!0,l.preload="auto";const c=document.createElement("canvas");return(async()=>{await new Promise((m,g)=>{l.onloadedmetadata=()=>m(),l.onerror=()=>g(new Error("no video for thumbnails"))}),c.width=168,c.height=Math.max(1,Math.round(168*l.videoHeight/Math.max(1,l.videoWidth)));const p=c.getContext("2d");if(p){for(const m of s){if(a)return;await new Promise(g=>{l.onseeked=()=>g(),l.currentTime=Math.max(0,Number(m))}),p.drawImage(l,0,0,c.width,c.height),o.current[m]=c.toDataURL("image/jpeg",.6)}a||r({...o.current})}})().catch(()=>{}),()=>{a=!0,l.removeAttribute("src"),l.load()}},[e,i]),n},vL=(e,t,n,r)=>{const o=d.useRef({markers:[],enabled:!1});o.current={markers:n??[],enabled:r&&n!==null};const i=d.useRef(new Map),a=(n===null||!r?[]:pL(n)).join(",");d.useEffect(()=>{const l=i.current;for(const c of a===""?[]:a.split(","))if(!l.has(c))try{const f=new Audio(QS(c));f.preload="auto",l.set(c,f)}catch{}},[a]),d.useEffect(()=>{var w;const l=e.current;if(!l)return;let c=((w=l.isPlaying)==null?void 0:w.call(l))??!1,f=null;const p=x=>{var b;if(!c)return;const k=x.detail.frame/t,h=f;f=k;const{markers:y,enabled:v}=o.current;if(!(h===null||!v))for(const S of dL(h,k,y)){const E=i.current.get(S.soundId);if(E)try{E.volume=fL(S.gain),E.currentTime=0,(b=E.play())==null||b.catch(()=>{})}catch{}}},m=()=>{c=!0,f=null},g=()=>{c=!1,f=null};return l.addEventListener("frameupdate",p),l.addEventListener("play",m),l.addEventListener("pause",g),()=>{l.removeEventListener("frameupdate",p),l.removeEventListener("play",m),l.removeEventListener("pause",g)}},[e,t])},wL=({cues:e,ghosts:t,cuts:n=[],spans:r=[],cleanup:o=[],durationSec:i,fps:s,playerRef:a,selection:l,onSelect:c,edits:f,videoSrc:p,toSourceSec:m,pinSourceSec:g=null,toLive:w=b=>b,onRevived:x,sfxMarkers:k=null,sfxWords:h=[],sfxSelected:y=null,onSelectSfx:v})=>{const b=d.useRef(null),S=d.useRef(null),E=d.useRef(!1),C=d.useRef(null),[I,j]=d.useState(0),F=d.useRef(I);F.current=I;const[N,K]=d.useState(null),M=d.useRef(null),[$,U]=d.useState(null),Y=d.useRef($);Y.current=$;const[A,T]=d.useState(null),[W,B]=d.useState(1),D=me.useMemo(()=>m?e.filter(R=>R.kind==="plain").map(R=>m((R.startSec+R.endSec)/2)):[],[e,m]),se=yL(p,D),[ie,L]=d.useState(!0);vL(a,s,k,ie);const V=d.useRef(null),ue=d.useRef(null),oe=d.useCallback((R,G)=>{const P=V.current;B(z=>{const Z=XN(R);if(Z===z||!P)return Z;const O=P.getBoundingClientRect();return ue.current={prevZoom:z,anchorX:G!==void 0?G-O.left:O.width/2},Z})},[]);d.useLayoutEffect(()=>{const R=V.current,G=ue.current;!R||!G||(ue.current=null,R.scrollLeft=qN(G.prevZoom,W,R.clientWidth,R.scrollLeft,G.anchorX))},[W]);const J=d.useRef(W);J.current=W,d.useEffect(()=>{const R=V.current;if(!R)return;const G=P=>{P.ctrlKey||P.metaKey?(P.preventDefault(),oe(J.current*Math.exp(-P.deltaY*.01),P.clientX)):R.scrollWidth>R.clientWidth&&(P.preventDefault(),R.scrollLeft+=P.deltaY+P.deltaX)};return R.addEventListener("wheel",G,{passive:!1}),()=>R.removeEventListener("wheel",G)},[oe]),d.useEffect(()=>{const R=a.current;if(!R)return;j(R.getCurrentFrame());const G=P=>j(P.detail.frame);return R.addEventListener("frameupdate",G),()=>R.removeEventListener("frameupdate",G)},[a]),d.useEffect(()=>{const R=V.current;if(!R||i<=0||R.scrollWidth<=R.clientWidth||E.current||C.current!==null||S.current!==null)return;const G=I/s/i*R.scrollWidth,{scrollLeft:P,clientWidth:z}=R;(G<P||G>P+z)&&(R.scrollLeft=Math.max(0,Math.min(R.scrollWidth-z,G-z*.1)))},[I,s,i]),d.useEffect(()=>{var G,P;if(!l||E.current||C.current!==null||S.current!==null)return;const R=(G=V.current)==null?void 0:G.querySelector(`[data-testid="timeline-block-${l.sceneId}"]`);(P=R==null?void 0:R.scrollIntoView)==null||P.call(R,{inline:"nearest",block:"nearest"})},[l]);const ae=d.useCallback(R=>{var z;const G=b.current;if(!G||i<=0)return;const P=G.getBoundingClientRect();(z=a.current)==null||z.seekTo(Math.round(kv(R,P.left,P.width,i)*s))},[a,i,s]),fe=d.useCallback((R,G)=>P=>{P.stopPropagation(),P.preventDefault();const z=b.current;z&&(S.current={sceneId:R.id,edge:G,startContentX:P.clientX-z.getBoundingClientRect().left,origStart:R.startSec,origEnd:R.endSec},T({sceneId:R.id,startSec:R.startSec,endSec:R.endSec,snapped:null}))},[]),pe=d.useRef(0);d.useEffect(()=>{const R=z=>{const Z=V.current;if(!Z||Z.scrollWidth<=Z.clientWidth)return;const O=Date.now();if(O-pe.current<mL)return;const re=Z.getBoundingClientRect(),te=Z.scrollWidth-Z.clientWidth;z>=re.right-Rv&&Z.scrollLeft<te?(Z.scrollLeft=Math.min(te,Z.scrollLeft+Z.clientWidth),pe.current=O):z<=re.left+Rv&&Z.scrollLeft>0&&(Z.scrollLeft=Math.max(0,Z.scrollLeft-Z.clientWidth),pe.current=O)},G=z=>{var Ue,Je,Pt;(E.current||((Ue=C.current)==null?void 0:Ue.moved)===!0||((Je=M.current)==null?void 0:Je.moved)===!0||S.current!==null)&&R(z.clientX);const O=M.current;if(O){if(!O.moved&&Math.abs(z.clientX-O.startX)<Tv)return;O.moved=!0;const mt=b.current,Le=mt==null?void 0:mt.getBoundingClientRect();if(!Le||i<=0)return;const Qe=ek(h,kv(z.clientX,Le.left,Le.width,i));if(Qe===null)return;const Fn=(Pt=h.find(Ye=>Ye.word===Qe))==null?void 0:Pt.atSec;if(Fn===void 0)return;U({key:O.marker.key,word:Qe,atSec:Fn});return}if(E.current){ae(z.clientX);return}const re=C.current;if(re&&i>0){if(!re.moved&&Math.abs(z.clientX-re.startX)<Tv)return;if(re.moved=!0,re.scrub){ae(z.clientX);return}const mt=b.current,Le=mt==null?void 0:mt.getBoundingClientRect(),Qe=Le?(z.clientX-Le.left-re.startContentX)/Le.width*i:0;let Fn=Qe,Ye=null;const Pn=Le&&Le.width>0&&!z.altKey?e.find(Jt=>Jt.id===re.sceneId):void 0;if(Pn&&Le){const Jt=jv/(Le.width/i),$n=Iv(e,re.sceneId,F.current/s,i),Mn=Pn.startSec+Qe,sr=Pn.endSec+Qe,gt=Tl(Mn,$n,Jt),Qt=Tl(sr,$n,Jt),dn=gt.snapped===null?1/0:Math.abs(gt.sec-Mn),Lt=Qt.snapped===null?1/0:Math.abs(Qt.sec-sr);dn<=Lt&>.snapped!==null?(Fn=Qe+(gt.sec-Mn),Ye=gt.snapped):Qt.snapped!==null&&(Fn=Qe+(Qt.sec-sr),Ye=Qt.snapped)}const cn=JN(e,re.sceneId,Fn,i);if(cn){const Jt=Ye!==null&&(Math.abs(cn.startSec-Ye)<1e-6||Math.abs(cn.endSec-Ye)<1e-6)?Ye:null;T({sceneId:re.sceneId,...cn,snapped:Jt})}return}const te=S.current;if(!te||i<=0)return;const Se=b.current;if(!Se)return;const Ie=Se.getBoundingClientRect(),_e=(z.clientX-Ie.left-te.startContentX)/Ie.width*i;let we=te.edge==="start"?te.origStart+_e:te.origStart,ke=te.edge==="end"?te.origEnd+_e:te.origEnd,he=null;if(!z.altKey&&Ie.width>0){const mt=jv/(Ie.width/i),Le=Iv(e,te.sceneId,F.current/s,i);if(te.edge==="start"){const Qe=Tl(we,Le,mt);we=Qe.sec,he=Qe.snapped}else{const Qe=Tl(ke,Le,mt);ke=Qe.sec,he=Qe.snapped}}const Ne=QN(e,te.sceneId,we,ke,i),Te=he!==null&&(Math.abs(Ne.startSec-he)<1e-6||Math.abs(Ne.endSec-he)<1e-6)?he:null;T({sceneId:te.sceneId,...Ne,snapped:Te})},P=z=>{E.current=!1;const Z=M.current;if(Z){M.current=null;const te=Y.current;if(U(null),Z.moved&&te&&te.key===Z.marker.key){const Se=Z.marker;te.word!==Se.word&&(Se.kind==="added"?f.patchSfxAdded(Se.key,{word:te.word}):Se.planned&&f.patchSfx(Se.key,{word:te.word},Se.planned))}return}const O=C.current;if(O){C.current=null,O.moved&&!O.scrub&&T(te=>(te&&te.sceneId===O.sceneId&&f.patchTiming(O.sceneId,Cv(te.startSec,te.endSec,g)),null));return}const re=S.current;re&&(T(te=>(te&&te.sceneId===re.sceneId&&(te.startSec!==re.origStart||te.endSec!==re.origEnd)&&f.patchTiming(re.sceneId,Cv(te.startSec,te.endSec,g)),null)),S.current=null)};return window.addEventListener("mousemove",G),window.addEventListener("mouseup",P),()=>{window.removeEventListener("mousemove",G),window.removeEventListener("mouseup",P)}},[e,i,f,ae,s,g,h]);const q=i>0?Math.min(1,I/s/i)*100:0;return u.jsxs("div",{style:xL,onMouseDownCapture:rk,children:[N!==null?(()=>{const R=sL(N.seam),{srcIn:G,srcOut:P}=N.seam;return u.jsx(aL,{x:N.x,y:N.y,onClose:()=>K(null),items:[{label:R.keep,onPick:()=>{f.toggleKept(G,P),N.seam.vetoed||x==null||x(G,P)}},{label:R.dismiss,onPick:()=>{f.dismissRemoval(G,P),x==null||x(G,P)}}]})})():null,u.jsxs("div",{style:bL,children:[k===null?null:u.jsx("button",{"data-testid":"sfx-preview-toggle",style:{...jl,marginRight:"auto",width:"auto",padding:"0 6px",color:ie?Fl:"#9A9AA3",borderColor:ie?Fl:"#2A2A33"},"aria-pressed":ie,onClick:()=>L(R=>!R),title:ie?"Sound effects play with the preview — click to mute them":"Sound effects are muted in the preview — click to hear them",children:ie?"♪ sfx on":"♪ sfx off"}),u.jsx("span",{style:kL,children:"ctrl+scroll to zoom"}),u.jsx("button",{"data-testid":"zoom-out",style:jl,onClick:()=>oe(W/2),disabled:W<=1,title:"Zoom out (ctrl/cmd + scroll on the timeline)",children:"−"}),u.jsxs("span",{"data-testid":"zoom-level",style:SL,children:[Math.round(W*10)/10,"×"]}),u.jsx("button",{"data-testid":"zoom-in",style:jl,onClick:()=>oe(W*2),disabled:W>=16,title:"Zoom in (ctrl/cmd + scroll on the timeline)",children:"+"}),u.jsx("button",{"data-testid":"zoom-fit",style:{...jl,width:"auto",padding:"0 8px"},onClick:()=>oe(1),disabled:W<=1,title:"Fit the whole clip in view",children:"fit"})]}),u.jsx("div",{ref:V,"data-testid":"timeline-scroller",style:EL,children:u.jsxs("div",{style:{width:`${W*100}%`,minWidth:"100%",paddingBottom:6},children:[(()=>{const R=rL(o,r,f.doc.cleanup);return R.length===0?null:u.jsxs("div",{"data-testid":"marker-lane",style:$L,children:[R.map(G=>{const P=i>0?Math.min(100,Math.max(0,G.outSec/i*100)):0,z=G.vetoed?`${G.label} — kept: playing in the preview (click to re-remove)`:G.vetoable?`${G.label} — click to keep this; the preview updates immediately`:G.label;return u.jsx("div",{"data-testid":`timeline-removal-${G.srcIn}-${G.srcOut}`,...G.vetoed?{"data-vetoed":"true"}:{},title:z,...G.vetoable?{onMouseDown:Z=>{Z.button!==2&&(Z.stopPropagation(),Z.preventDefault(),f.toggleKept(G.srcIn,G.srcOut),G.vetoed||x==null||x(G.srcIn,G.srcOut))},onContextMenu:Z=>{Z.preventDefault(),Z.stopPropagation(),K({x:Z.clientX,y:Z.clientY,seam:G})}}:{},style:{...ML,...G.vetoable?{cursor:"pointer"}:{},left:`${P}%`,...P>90?{transform:"translateX(-100%)"}:{},marginLeft:G.stackIndex*10,zIndex:2+G.stackIndex,...G.vetoed?{background:"transparent",border:`1px dashed ${G.color}`,color:G.color,opacity:.7}:{background:`${G.color}30`,border:`1px solid ${G.color}`,color:"#EDEDF2"}},children:G.vetoed?`kept · ${G.label}`:G.label},`removal-${G.srcIn}-${G.srcOut}`)}),R.filter(G=>G.vetoed&&i>0).map(G=>{const P=Math.min(100,Math.max(0,G.outSec/i*100)),z=Math.min(100-P,(G.srcOut-G.srcIn)/i*100);return u.jsx("div",{"data-testid":`timeline-kept-band-${G.srcIn}-${G.srcOut}`,style:{...LL,left:`${P}%`,width:`${z}%`,borderColor:G.color}},`kept-band-${G.srcIn}-${G.srcOut}`)})]})})(),k===null?null:u.jsx("div",{"data-testid":"sfx-lane",style:_L,children:k.map(R=>{const G=($==null?void 0:$.key)===R.key,P=G?$.atSec:R.atSec,z=G?$.word:R.word,Z=i>0?Math.min(100,Math.max(0,P/i*100)):0,O=y===R.key;return u.jsx("div",{"data-testid":`sfx-marker-${R.key}`,...R.muted?{"data-muted":"true"}:{},...O?{"data-selected":"true"}:{},title:`${R.soundId} · word ${z} · gain ${R.gain}`+(R.muted?" · muted (restore it in the panel)":"")+(R.kind==="added"?" · added by you":"")+" — drag to another word",onMouseDown:re=>{re.button!==2&&(re.stopPropagation(),re.preventDefault(),v==null||v(R.key),M.current={marker:R,startX:re.clientX,moved:!1})},style:{...AL,left:`${Z}%`,zIndex:O||G?3:2},children:u.jsx("div",{style:{...NL,border:`1px solid ${O?"#5b8cff":Fl}`,background:R.muted?"transparent":Fl,opacity:R.muted?.45:1,...R.kind==="added"?{borderStyle:"dashed"}:{}}})},R.key)})}),u.jsx("div",{"data-testid":"ruler",style:CL,onMouseDown:R=>{R.preventDefault(),ae(R.clientX),E.current=!0},children:(()=>{var re;if(i<=0)return u.jsx("span",{style:Od,children:"0:00"});const G=(((re=V.current)==null?void 0:re.clientWidth)??1200)*W/i;let z=[.5,1,2,5,10,15,30,60,120,300,600].find(te=>te*G>=70)??600;for(;i/(z/5)>600;)z*=2;const Z=z/5,O=[];for(let te=0;te<=i+1e-6;te+=Z){const Se=Math.round(te/Z)%5===0,Ie=`${te/i*100}%`;O.push(u.jsx("div",{style:{position:"absolute",left:Ie,bottom:0,width:1,height:Se?8:4,background:Se?"#3A3A44":"#26262e",pointerEvents:"none"}},te.toFixed(3))),Se&&te+Z<=i&&O.push(u.jsx("span",{style:{...Od,position:"absolute",left:Ie,top:0,transform:te===0?void 0:"translateX(-50%)",pointerEvents:"none"},children:gL(te)},`l${te.toFixed(3)}`))}return u.jsxs(u.Fragment,{children:[O,u.jsx("span",{style:{...Od,position:"absolute",right:2,top:0,pointerEvents:"none"},children:Ld(i,s)})]})})()}),u.jsxs("div",{ref:b,style:IL,onMouseDown:R=>{R.preventDefault(),ae(R.clientX),E.current=!0},children:[e.map(R=>{const G=R.kind==="plain",P=(A==null?void 0:A.sceneId)===R.id,z=P?A.startSec:R.startSec,Z=P?A.endSec:R.endSec,O=i>0?z/i*100:0,re=i>0?Math.max(0,(Z-z)/i*100):0,te=(l==null?void 0:l.sceneId)===R.id,Se=G&&m?se[m((R.startSec+R.endSec)/2).toFixed(1)]:void 0;return u.jsxs("div",{"data-testid":`timeline-block-${R.id}`,onMouseDown:Ie=>{var _e;Ie.stopPropagation(),Ie.preventDefault(),c({sceneId:R.id,elementId:null}),C.current={sceneId:R.id,startX:Ie.clientX,startContentX:Ie.clientX-(((_e=b.current)==null?void 0:_e.getBoundingClientRect().left)??0),moved:!1,scrub:G}},style:{...Fv,left:`${O}%`,width:`${re}%`,zIndex:P?4:te?3:1,border:te?"2px solid #5b8cff":R.kept!==void 0?"1px dashed #B78CFF":G?"1px solid #22222a":"1px solid #2A2A33",backgroundColor:te?"#1c2333":R.kept!==void 0?"#1a1524":G?"#131318":"#1A1A21",...Se?{backgroundImage:`linear-gradient(rgba(10,10,14,0.35), rgba(10,10,14,0.6)), url(${Se})`,backgroundSize:"auto 100%, auto 100%",backgroundRepeat:"repeat-x"}:{}},children:[u.jsx("span",{style:G?Se?{...Rl,color:"#D8D8DE",textShadow:"0 1px 2px rgba(0,0,0,0.9)"}:{...Rl,color:"#55555f"}:Rl,children:R.kept!==void 0?"KEPT":R.id}),!G&&R.pinned?u.jsx("span",{style:TL,children:"PIN"}):null,G?null:u.jsxs(u.Fragment,{children:[u.jsx("div",{onMouseDown:fe(R,"start"),style:{...Pv,left:0,cursor:"ew-resize"}}),u.jsx("div",{onMouseDown:fe(R,"end"),style:{...Pv,right:0,cursor:"ew-resize"}})]})]},R.id)}),t.map(R=>{const G=i>0?R.startSec/i*100:0,P=i>0?Math.max(0,(R.endSec-R.startSec)/i*100):0,z=(l==null?void 0:l.sceneId)===R.id;return u.jsx("div",{"data-testid":`timeline-block-${R.id}`,onMouseDown:Z=>{Z.stopPropagation(),Z.preventDefault(),c({sceneId:R.id,elementId:null})},style:{...Fv,left:`${G}%`,width:`${P}%`,zIndex:z?3:2,border:z?"2px dashed #5b8cff":"1px dashed #6a6a75",background:"transparent"},children:u.jsx("span",{style:{...Rl,color:"#6a6a75",textDecoration:"line-through"},children:R.id})},`ghost-${R.id}`)}),n.map((R,G)=>{const P=Z=>i>0?Math.min(100,Math.max(0,Z/i*100)):0;if(!R.src){const Z=Math.min(Math.max(w(R.startSec),0),i),O=Math.min(Math.max(w(R.endSec),0),i),re=P(Z),te=i>0?Math.max(0,(O-Z)/i*100):0;return u.jsx("div",{"data-testid":`timeline-cut-${R.startSec}-${R.endSec}`,style:{...jL,left:`${re}%`,width:`${te}%`},children:u.jsx("div",{style:RL})},`cut-${G}-${R.startSec}-${R.endSec}`)}if(r.length===0)return null;const z=P(sk(r,R.src.startSec));return u.jsx("div",{"data-testid":`timeline-cut-seam-${R.startSec}-${R.endSec}`,title:"Restore cut — the material returns on the next produce/Render",onMouseDown:Z=>{Z.stopPropagation(),Z.preventDefault(),f.restoreChunk(G)},style:{...FL,left:`${z}%`},children:u.jsx("div",{style:PL})},`cut-${G}-${R.startSec}-${R.endSec}`)}),A?u.jsxs("div",{"data-testid":"drag-readout",style:{...$v,left:`${i>0?A.startSec/i*100:0}%`,transform:i>0&&A.startSec/i>.85?"translateX(-100%)":$v.transform},children:[Ld(A.startSec,s)," – ",Ld(A.endSec,s)]}):null,(A==null?void 0:A.snapped)!==null&&(A==null?void 0:A.snapped)!==void 0?u.jsx("div",{"data-testid":"snap-tick",style:{...OL,left:`${i>0?A.snapped/i*100:0}%`}}):null,u.jsx("div",{"data-testid":"playhead",style:{...DL,left:`${q}%`},children:u.jsx("div",{"data-testid":"playhead-grab",onMouseDown:R=>{R.stopPropagation(),R.preventDefault(),E.current=!0},style:zL})})]})]})})]})},xL={flexShrink:0,borderTop:"1px solid #1E1E24",background:"#111116",padding:"6px 20px 8px"},bL={display:"flex",justifyContent:"flex-end",alignItems:"center",gap:6,marginBottom:4},jl={width:22,height:18,fontSize:12,lineHeight:1,color:"#EDEDF2",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:4,cursor:"pointer",padding:0},SL={fontSize:10,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#9A9AA3",minWidth:26,textAlign:"center"},kL={fontSize:10,color:"#55555f",marginRight:4,userSelect:"none"},EL={overflowX:"auto",overflowY:"hidden"},CL={position:"relative",height:18,padding:"0 2px",marginBottom:4,borderBottom:"1px solid #1E1E24",cursor:"ew-resize",userSelect:"none"},Od={fontSize:10,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#9A9AA3"},IL={position:"relative",height:44,background:"#0F0F14",border:"1px solid #2A2A33",borderRadius:6,overflow:"visible",userSelect:"none"},Fv={position:"absolute",top:3,bottom:3,borderRadius:4,boxSizing:"border-box",cursor:"pointer",display:"flex",alignItems:"center",overflow:"hidden"},Rl={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"},TL={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"},jL={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)"},RL={position:"absolute",left:0,right:0,top:"50%",height:2,background:"rgba(255,92,92,0.8)"},FL={position:"absolute",top:-4,bottom:-4,width:12,marginLeft:-6,zIndex:4,cursor:"pointer",pointerEvents:"auto"},PL={position:"absolute",left:"50%",top:0,bottom:0,width:2,background:"#FF5C5C",pointerEvents:"none"},$L={position:"relative",height:22,marginBottom:2},ML={position:"absolute",top:2,height:16,display:"flex",alignItems:"center",padding:"0 6px",borderRadius:4,fontSize:10,lineHeight:"16px",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",whiteSpace:"nowrap",maxWidth:140,overflow:"hidden",textOverflow:"ellipsis",userSelect:"none"},Fl="#4ECDC4",_L={position:"relative",height:14,marginBottom:2},AL={position:"absolute",top:0,bottom:0,width:14,marginLeft:-7,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer"},NL={width:8,height:8,transform:"rotate(45deg)",borderRadius:1,pointerEvents:"none"},LL={position:"absolute",bottom:0,height:0,borderBottom:"2px dotted",opacity:.6,pointerEvents:"none"},Pv={position:"absolute",top:0,bottom:0,width:hL},OL={position:"absolute",top:-4,bottom:-4,width:1,zIndex:6,background:"#FFE14D",pointerEvents:"none"},$v={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"},DL={position:"absolute",top:-26,bottom:-4,width:2,zIndex:5,background:"#FFE14D",pointerEvents:"none"},zL={position:"absolute",top:0,bottom:0,left:-4,width:10,pointerEvents:"auto",cursor:"ew-resize"};function BL(e,t,n){const r=e.filter(m=>Ze(m.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(m=>{const g=Ze(m.word);return g!==null&&g in n.captionWordsHidden})||l.push("caption");const f=n.cuts.some(m=>m.src===void 0&&m.startSec===s&&m.endSec===a),p=e.some(m=>m.synthetic);return!f&&!p&&l.push("caption-video"),l.length===0?null:{startSec:s,endSec:a,words:r.map(m=>({srcStart:m.word.srcStart,was:m.live})),targets:l}}function WL(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?Ze(s[0].word):null,c=[];for(let f=0;f+o<=e.length;){if(f>t-o&&f<=n){f=n+1;continue}const p=e.slice(f,f+o),m=p.every(w=>Ze(w.word)!==null&&r(w.word)===void 0),g=l!==null&&Ze(p[0].word)===l;if(m&&!g&&i(p)===a){c.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 c}function VL(e,t,n,r,o){const i=Math.max(0,Math.floor(o)),s=new Float32Array(i);if(i===0||!(r>n)||!(t>0)||e.length===0)return{buckets:s,fromSec:n,toSec:r};const a=r-n;for(let l=0;l<i;l++){const c=Math.max(0,Math.ceil((n+a*l/i)*t)),f=Math.min(e.length,Math.ceil((n+a*(l+1)/i)*t));let p=0;for(let m=c;m<f;m++){const g=Math.abs(e[m]);g>p&&(p=g)}s[l]=p}return{buckets:s,fromSec:n,toSec:r}}const Eo=560,Ln=48,Mv=10;let Pl=null;const HL=e=>((Pl===null||Pl.key!==e)&&(Pl={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)}),Pl.promise),_v=6,Av=8,UL=e=>{const t=e.anchorTop+e.anchorHeight+_v,n=e.anchorTop-e.menuH-_v,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(Av,Math.min(i,e.clientWidth-e.menuW-Av));return{top:o,left:s}},Nv="transcript-word-",Lv=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},Ov=(e,t)=>{const n=Math.max(0,e.start-Mv),r=e.end+Mv;return{start:n,end:Number.isFinite(t)&&t>0?Math.min(r,Math.max(t,n)):r}},Dv=.001,ZL=e=>{const t=e.span.end-e.span.start,n=t>0?(e.newSpan.end-e.newSpan.start)/t:1,r=o=>e.newSpan.start+(o-e.span.start)*n;return e.lines.map(o=>{const i=r(o.srcStart),s=r(o.srcEnd),a=Math.abs(i-o.srcStart)<Dv&&Math.abs(s-o.srcEnd)<Dv;return{srcStart:o.srcStart,window:a?null:{srcStart:i,srcEnd:s}}})},KL=e=>{const t=new Set;for(let n=0;n<e.length;n++)for(let r=n+1;r<e.length;r++){const o=e[n],i=e[r];o.srcStart<i.srcEnd&&i.srcStart<o.srcEnd&&(t.add(o.key),t.add(i.key))}return t},YL=(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)}},GL=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))}},Dd=(e,t)=>{const n=e[t],r=n==null?void 0:n.words[0],o=Ze(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)}},XL=(e,t)=>{const n=[];let r=0;for(const o of e){const i=new Set(o.words.map(l=>Ze(l)).filter(l=>l!==null)),s=t[r],a=l=>{const c=Ze(l);return c!==null&&i.has(c)};s!==void 0&&s.words.some(a)?(n.push(r),r++):n.push(null)}return n},qL=({baseLines:e,liveLines:t,timingLines:n,fps:r,playerRef:o,edits:i,onDeleteWords:s,width:a,workdir:l,toPlayerSec:c=p=>p,fromPlayerSec:f=p=>p})=>{const[p,m]=d.useState(""),[g,w]=d.useState(null),[x,k]=d.useState(null),[h,y]=d.useState(null),[v,b]=d.useState(null),[S,E]=d.useState(!1),[C,I]=d.useState(!1),[j,F]=d.useState(null),[N,K]=d.useState(0),M=d.useRef(null),$=d.useRef(null),[U,Y]=d.useState(null),[A,T]=d.useState(null),[W,B]=d.useState(null),[D,se]=d.useState(!1),[ie,L]=d.useState(null),[V,ue]=d.useState(!1),oe=d.useRef(null),J=d.useRef(null),ae=d.useMemo(()=>{const _=new Map;for(const H of e)for(const ne of H.words){const ge=Ze(ne);if(ge===null)continue;const Ee=_.get(ge);Ee?Ee.push(ne.text):_.set(ge,[ne.text])}return _},[e]),fe=d.useMemo(()=>{var ge;const _=[];let H=0;const ne=new Map;for(let Ee=0;Ee<t.length;Ee++){const je=t[Ee];for(let Fe=0;Fe<je.words.length;Fe++){const Pe=je.words[Fe],ze=Ze(Pe);let Wt;if(ze!==null){const en=ne.get(ze)??0;ne.set(ze,en+1),Wt=(ge=ae.get(ze))==null?void 0:ge[en]}_.push({index:H,base:Wt??Pe.text,live:Pe.text,synthetic:ze!==null&&Wt===void 0,start:Pe.start,end:Pe.end,lineIndex:Ee,word:Pe}),H++}}return _},[ae,t]);d.useEffect(()=>{k(null),y(null)},[fe.length]);const pe=d.useMemo(()=>new Set(Object.keys(i.doc.captionWordsHidden)),[i.doc.captionWordsHidden]),q=_=>{const H=Ze(_.word);return H!==null&&pe.has(H)},R=d.useMemo(()=>Jh(fe.map(_=>_.live).join(" ")),[fe]);d.useEffect(()=>{if(R!=="rtl"||typeof FontFace>"u"||!document.fonts)return;let _=!1;for(const H of document.fonts)H.family===va&&(_=!0);if(!_)try{new FontFace(va,`url("/media/${TS}") format("truetype")`).load().then(ne=>document.fonts.add(ne),()=>{})}catch{}},[R]),d.useEffect(()=>{const _=o.current;if(!_)return;const H=ne=>{const ge=f(ne.detail.frame/r),Ee=fe.find(je=>ge>=je.start&&ge<je.end);B(je=>Ee?Ee.index===je?je:Ee.index:je)};return _.addEventListener("frameupdate",H),()=>_.removeEventListener("frameupdate",H)},[o,r,fe,f]),d.useEffect(()=>{var _,H,ne;W!==null&&((ne=(H=(_=oe.current)==null?void 0:_.querySelector(`[data-testid="transcript-word-${W}"]`))==null?void 0:H.scrollIntoView)==null||ne.call(H,{block:"nearest"}))},[W]);const G=p.trim().normalize("NFC").toLowerCase(),P=d.useMemo(()=>G?fe.filter(_=>_.live.normalize("NFC").toLowerCase().includes(G)).map(_=>_.index):[],[G,fe]),z=d.useMemo(()=>G?new Set(P):null,[G,P]),[Z,O]=d.useState(0),re=_=>{var H,ne,ge;(ge=(ne=(H=oe.current)==null?void 0:H.querySelector(`[data-testid="transcript-word-${_}"]`))==null?void 0:ne.scrollIntoView)==null||ge.call(ne,{block:"center"})};d.useEffect(()=>{O(0),P.length>0&&re(P[0])},[P]);const te=_=>{if(P.length===0)return;const H=(Z+_+P.length)%P.length;O(H),re(P[H])},Se=_=>{const H=_.draft.trim();H&&i.patchCaption(_.srcStart,H,_.base),w(null)},Ie=_=>{Ze(_.word)!==null&&_e(_.word)===void 0&&w({index:_.index,draft:_.live,srcStart:_.word.srcStart,base:_.base})},_e=_=>{const H=Ze(_);if(H===null)return;const ne=Number(H.slice(1));return i.doc.captionRangeEdits.find(ge=>{const Ee=Number(ge.fromKey.slice(1)),je=Number(ge.toKey.slice(1));return ne>=Math.min(Ee,je)&&ne<=Math.max(Ee,je)})},we=x===null?null:Math.min(x.anchor,x.focus),ke=x===null?null:Math.max(x.anchor,x.focus),he=we===null||ke===null?[]:fe.slice(we,ke+1),Ne=he.length>0&&he.every(q),Te=he.some(_=>Ze(_.word)===null),Ue=he.map(_=>_e(_.word)).find(_=>_!==void 0),Je=_=>{var ze,Wt,en;if(g!==null||h!==null||v!==null)return;const H=oe.current;if(!H)return;const ne=(ze=document.getSelection)==null?void 0:ze.call(document);if(!ne||ne.isCollapsed)return;const{anchorNode:ge,focusNode:Ee}=ne;if(!ge||!Ee||!H.contains(ge)||!H.contains(Ee))return;const je=Ee.nodeType===3?Ee.parentElement:Ee;if((Wt=je==null?void 0:je.closest)!=null&&Wt.call(je,"input, textarea"))return;const Fe=Lv(ge),Pe=Lv(Ee);Fe===null||Pe===null||_.detail>=2&&Fe===Pe||(k({anchor:Math.min(Fe,Pe),focus:Math.max(Fe,Pe)}),(en=ne.removeAllRanges)==null||en.call(ne))};d.useLayoutEffect(()=>{if(we===null||ke===null){L(null);return}const _=oe.current,H=(_==null?void 0:_.querySelector(`[data-testid="transcript-word-${we}"]`))??null,ne=(_==null?void 0:_.querySelector(`[data-testid="transcript-word-${ke}"]`))??null;if(!_||ne===null){L(null);return}const ge=H!==null&&H.offsetTop===ne.offsetTop,Ee=ge?Math.min(H.offsetLeft,ne.offsetLeft):ne.offsetLeft,je=ge?Math.max(H.offsetLeft+H.offsetWidth,ne.offsetLeft+ne.offsetWidth):ne.offsetLeft+ne.offsetWidth,Fe=J.current,Pe=UL({anchorTop:ne.offsetTop,anchorHeight:ne.offsetHeight,anchorLeft:Ee,anchorWidth:je-Ee,menuW:(Fe==null?void 0:Fe.offsetWidth)??0,menuH:(Fe==null?void 0:Fe.offsetHeight)??0,scrollTop:_.scrollTop,clientWidth:_.clientWidth,clientHeight:_.clientHeight});L(ze=>ze!==null&&ze.top===Pe.top&&ze.left===Pe.left?ze:Pe)},[we,ke,a,g,h,v,ie]),d.useEffect(()=>{ue(!1),b(null)},[we,ke]),d.useEffect(()=>{h!==null&&(we!==h.selLo||ke!==h.selHi)&&y(null)},[h,we,ke]);const Pt=d.useMemo(()=>h!==null&&we!==null&&ke!==null?WL(fe,we,ke,_e):[],[h,we,ke,fe,i.doc.captionRangeEdits]),mt=()=>{if(he.length===0||Te)return;const _=BL(he.map(H=>({word:H.word,live:H.live,synthetic:H.synthetic})),we!==null&&we>0?fe[we-1].end:null,i.doc);_!==null&&(s(_),k(null))},Le=()=>{if(he.length===0||Te)return;const _=Ue;if(_!==void 0){const H=Math.min(Number(_.fromKey.slice(1)),Number(_.toKey.slice(1))),ne=Math.max(Number(_.fromKey.slice(1)),Number(_.toKey.slice(1))),ge=fe.filter(Ee=>{const je=Ze(Ee.word);if(je===null)return!1;const Fe=Number(je.slice(1));return Fe>=H&&Fe<=ne});if(ge.length===0)return;k({anchor:ge[0].index,focus:ge[ge.length-1].index}),y({draft:ge.map(Ee=>Ee.live).join(" ").normalize("NFC"),fromSrcStart:Number(_.fromKey.slice(1))/1e3,toSrcStart:Number(_.toKey.slice(1))/1e3,was:ge.map(Ee=>Ee.base).join(" ").normalize("NFC"),rawWas:ge.map(Ee=>Ee.base).join(" "),covered:!0,selLo:ge[0].index,selHi:ge[ge.length-1].index});return}y({draft:he.map(H=>H.live).join(" ").normalize("NFC"),fromSrcStart:he[0].word.srcStart,toSrcStart:he[he.length-1].word.srcStart,was:he.map(H=>H.base).join(" ").normalize("NFC"),rawWas:he.map(H=>H.base).join(" "),covered:!1,selLo:we,selHi:ke})},Qe=_=>{const H=_.draft.trim();if(H){const ne=H.split(/\s+/).filter(Boolean);!_.covered&&_.fromSrcStart===_.toSrcStart&&ne.length===1?i.patchCaption(_.fromSrcStart,H,_.rawWas):i.patchCaptionRange(_.fromSrcStart,_.toSrcStart,H,_.was),k(null)}y(null)},Fn=_=>{const H=_.draft.trim();if(H){const ne=H.split(/\s+/).filter(Boolean);!_.covered&&_.fromSrcStart===_.toSrcStart&&ne.length===1?i.patchCaptionAllOccurrences([{srcStart:_.fromSrcStart,was:_.rawWas},...Pt.map(ge=>({srcStart:ge.fromSrcStart,was:ge.rawWas}))],H):i.patchCaptionRangeAllOccurrences([{fromSrcStart:_.fromSrcStart,toSrcStart:_.toSrcStart,was:_.was},...Pt],H),k(null)}y(null)},Ye=()=>{he.length===0||Te||(i.hideCaptionWords(he.filter(_=>!q(_)).map(_=>({srcStart:_.word.srcStart,was:_.live}))),k(null))},Pn=()=>{he.length!==0&&(i.restoreCaptionWords(he.filter(q).map(_=>_.word.srcStart)),k(null))},cn=d.useMemo(()=>XL(t,n),[t,n]),Jt=_=>{var ne;const H=cn[_]??null;return H===null?null:Ze((ne=n[H])==null?void 0:ne.words[0])},$n=_=>{const H=Jt(_);if(H===null)return;const ne=i.doc.captionLineWindows[H];if(ne!==void 0)return`caption placed at ${ne.srcStart.toFixed(2)}s–${ne.srcEnd.toFixed(2)}s of the source — Timing to change`;const ge=i.doc.captionLineTiming[H];return ge===void 0?void 0:`caption timing adjusted (${Math.round(ge.lead*1e3)}ms in / ${Math.round(ge.tail*1e3)}ms out) — Timing to change`},Mn=he.length===0?0:he[he.length-1].lineIndex-he[0].lineIndex+1,sr=()=>{if(he.length===0||Te)return;const _=n,H=cn[he[0].lineIndex]??null,ne=cn[he[he.length-1].lineIndex]??null;if(H===null||ne===null)return;const ge=[];for(let Pe=H;Pe<=ne;Pe++){const ze=Dd(_,Pe);if(ze===null)return;ge.push(ze)}const Ee=ge[0],je=ge[ge.length-1],Fe={start:Ee.srcStart,end:je.srcEnd};b({track:_,from:H,to:ne,span:Fe,newSpan:(()=>{var Wt,en;const Pe=Ov(Fe,N),ze=i.doc.captionLineWindows;return YL({start:((Wt=ze[Ee.key])==null?void 0:Wt.srcStart)??Fe.start,end:((en=ze[je.key])==null?void 0:en.srcEnd)??Fe.end},Pe.start,Pe.end)})()})},gt=d.useMemo(()=>{if(v===null)return null;const _=[];for(let H=v.from;H<=v.to;H++){const ne=Dd(v.track,H);if(ne===null)return null;_.push(ne)}return _},[v]),Qt=d.useMemo(()=>v===null||gt===null?null:ZL({lines:gt,span:v.span,newSpan:v.newSpan}),[v,gt]),dn=d.useMemo(()=>{const _=new Map;for(const ne of Qt??[])ne.window!==null&&_.set(Sn(ne.srcStart),ne.window);const H=[];for(let ne=0;ne<n.length;ne++){const ge=Dd(n,ne);if(ge===null)continue;const Ee=_.get(ge.key)??i.doc.captionLineWindows[ge.key];H.push({key:ge.key,srcStart:(Ee==null?void 0:Ee.srcStart)??ge.srcStart,srcEnd:(Ee==null?void 0:Ee.srcEnd)??ge.srcEnd})}return H},[n,i.doc.captionLineWindows,Qt]),Lt=d.useMemo(()=>KL(dn),[dn]),Kn=v===null?0:v.to-v.from+1,it=d.useMemo(()=>v===null?null:Ov(v.span,N),[v,N]);d.useEffect(()=>{T(null),K(0)},[l]),d.useEffect(()=>{if(v===null||A!==null)return;let _=!1;return HL(l).then(H=>{!_&&H!==null&&(T(H),H.sampleRate>0&&K(H.channel.length/H.sampleRate))}),()=>{_=!0}},[v,A,l]);const _n=_=>it===null?0:(_-it.start)/(it.end-it.start)*Eo;d.useEffect(()=>{var en;if(v===null||it===null)return;const _=M.current,H=((en=_==null?void 0:_.getContext)==null?void 0:en.call(_,"2d"))??null;if(!_||!H)return;const ne=_n;H.fillStyle="#0F0F14",H.fillRect(0,0,Eo,Ln);const ge=Math.floor(Eo/2),Ee=A===null?new Float32Array(ge):VL(A.channel,A.sampleRate,it.start,it.end,ge).buckets;H.fillStyle="#4a4a58";const je=Eo/ge;for(let Vt=0;Vt<ge;Vt++){const Yn=Math.max(1,Ee[Vt]*(Ln-4));H.fillRect(Vt*je,(Ln-Yn)/2,Math.max(1,je-1),Yn)}const Fe=new Set((gt==null?void 0:gt.map(Vt=>Vt.key))??[]);for(const Vt of dn){if(Fe.has(Vt.key))continue;const Yn=ne(Vt.srcStart),as=Math.max(1,ne(Vt.srcEnd)-Yn);H.fillStyle=Lt.has(Vt.key)?"rgba(240, 165, 60, 0.28)":"rgba(255, 255, 255, 0.05)",H.fillRect(Yn,0,as,Ln)}const Pe=ne(v.newSpan.start),ze=ne(v.newSpan.end),Wt=(gt==null?void 0:gt.some(Vt=>Lt.has(Vt.key)))??!1;H.fillStyle=Wt?"rgba(240, 165, 60, 0.22)":"rgba(255, 225, 77, 0.18)",H.fillRect(Pe,0,Math.max(1,ze-Pe),Ln),H.fillStyle=Wt?"#F0A53C":"#FFE14D",H.fillRect(Pe-1,0,2,Ln),H.fillRect(ze-1,0,2,Ln)},[v,it,gt,dn,Lt,A]);const Lr=it===null?0:(it.end-it.start)/Eo,ar=v===null||it===null?null:{lead:_n(v.newSpan.start),tail:_n(v.newSpan.end)},ko=_=>H=>{v!==null&&(H.preventDefault(),Y({edge:_,startX:H.clientX,span:v.newSpan}))};d.useEffect(()=>{if(U===null||v===null||it===null)return;const _=ne=>{b({...v,newSpan:GL({edge:U.edge,span:U.span,dSec:(ne.clientX-U.startX)*Lr,lo:it.start,hi:it.end})})},H=()=>Y(null);return window.addEventListener("pointermove",_),window.addEventListener("pointerup",H),window.addEventListener("pointercancel",H),window.addEventListener("blur",H),()=>{window.removeEventListener("pointermove",_),window.removeEventListener("pointerup",H),window.removeEventListener("pointercancel",H),window.removeEventListener("blur",H)}},[U,v,it,Lr]),d.useEffect(()=>{v===null&&U!==null&&Y(null)},[v,U]);const Or=()=>{var H;const _=$.current;if(!(_===null||v===null)){if(S){_.pause(),E(!1),F(null);return}_.currentTime=v.newSpan.start;try{const ne=(H=_.play)==null?void 0:H.call(_);ne&&typeof ne.catch=="function"&&ne.catch(()=>{})}catch{}E(!0),F(v.newSpan.start)}},Dr=()=>{const _=$.current;if(!(_===null||v===null||!S)){if(_.currentTime<v.newSpan.end){F(_.currentTime);return}if(C){_.currentTime=v.newSpan.start,F(v.newSpan.start);return}_.pause(),E(!1),F(null)}};d.useEffect(()=>{var _;v!==null||!S||((_=$.current)==null||_.pause(),E(!1),F(null))},[v,S]);const Qo=_=>{i.patchCaptionLineWindows(_),b(null)};return u.jsxs("div",{"data-testid":"transcript-panel",style:{...JL,width:a},children:[u.jsxs("div",{style:QL,children:[u.jsx("span",{style:e5,children:"Transcript"}),u.jsxs("div",{style:g5,children:[u.jsx("span",{style:Bv,children:"Click to jump · double-click to retype · drag to select"}),u.jsx("button",{"data-testid":"transcript-help-toggle",style:y5,onClick:()=>se(_=>!_),title:"What each gesture does","aria-label":"Transcript help","aria-expanded":D,children:"?"})]}),D?u.jsx("div",{"data-testid":"transcript-help",style:Bv,children:"Drag across words — or shift-click — to mark a run. Its toolbar offers Edit (rewrite freely — word count may change, captions only; works on a single word too, the way to split a merged one), Timing (whole CAPTIONS — drag the waveform handles to move when they come in and go out, or drag between them to shift them all, taking the time from the captions either side) and Delete — from the captions only (restorable — the word stays here and in the audio) or from the video too, on the next Render. Double-click retype stays 1:1 — word count and timing fixed, so scene anchors and the caption highlight keep working."}):null,u.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[u.jsx("input",{"data-testid":"transcript-search",style:{...t5,flex:1},placeholder:"Find a word…",value:p,onChange:_=>m(_.target.value),onKeyDown:_=>{_.key==="Enter"&&(_.preventDefault(),te(_.shiftKey?-1:1))}}),u.jsx("button",{"data-testid":"transcript-prev",style:Wv,onClick:()=>te(-1),disabled:P.length===0,title:"Previous match (⇧Enter)","aria-label":"Previous match",children:"‹"}),u.jsx("button",{"data-testid":"transcript-next",style:Wv,onClick:()=>te(1),disabled:P.length===0,title:"Next match (Enter)","aria-label":"Next match",children:"›"})]}),z?u.jsx("div",{"data-testid":"transcript-match-count",style:{fontSize:11,color:"#9A9AA3"},children:P.length===0?"0 matches":`${Z+1}/${P.length} match${P.length===1?"":"es"}`}):null]}),u.jsxs("div",{style:n5,"data-testid":"transcript-body",dir:R,ref:oe,onMouseUp:Je,tabIndex:0,onKeyDown:_=>{if(!(g!==null||h!==null)){if(v!==null){_.key==="Escape"&&(_.stopPropagation(),b(null));return}if(_.key==="Escape"){if(x===null)return;_.stopPropagation(),k(null),y(null);return}(_.key==="Delete"||_.key==="Backspace")&&x!==null&&(_.preventDefault(),_.stopPropagation(),Ne?Pn():mt())}},children:[fe.map((_,H)=>{const ne=_e(_.word),ge=$n(_.lineIndex),Ee=(()=>{const Fe=Jt(_.lineIndex);return Fe!==null&&Lt.has(Fe)})(),je=q(_)?"hidden from captions — select and Restore":ne!==void 0?`part of a rewritten range (was “${ne.was}”) — select it and use Edit`:_.synthetic?`rewritten (was “${_.base}”) — select and Edit to change`:_.live!==_.base?`edited (was “${_.base}”) — double-click to retype`:"click to jump · double-click to retype";return u.jsxs(me.Fragment,{children:[H>0?" ":null,(g==null?void 0:g.index)===_.index?u.jsx("input",{autoFocus:!0,"data-testid":"transcript-edit",style:S5,value:g.draft,onChange:Fe=>w({...g,draft:Fe.target.value}),onBlur:()=>Se(g),onKeyDown:Fe=>{Fe.key==="Enter"&&Fe.target.blur(),Fe.key==="Escape"&&w(null)}}):u.jsx("span",{"data-testid":`transcript-word-${_.index}`,onClick:Fe=>{var Pe;if(h!==null&&y(null),v!==null&&b(null),Fe.shiftKey){k(ze=>ze===null?{anchor:_.index,focus:_.index}:{...ze,focus:_.index});return}(Pe=o.current)==null||Pe.seekTo(Math.ceil(c(_.start)*r)),k({anchor:_.index,focus:_.index})},onDoubleClick:()=>Ie(_),title:`${je}${ge===void 0?"":` · ${ge}`}${Ee?" · overlaps another caption":""}`,style:{...r5,...ge!==void 0?d5:{},...q(_)?c5:{},..._.live!==_.base||_.synthetic?s5:{},...Ee?l5:{},...W===_.index?a5:{},...we!==null&&_.index>=we&&_.index<=ke?u5:{},...z!=null&&z.has(_.index)?o5:{},...P[Z]===_.index?i5:{}},children:_.live})]},_.index)}),x!==null&&ie!==null&&g===null&&h===null&&v===null?u.jsxs("div",{"data-testid":"transcript-selection-menu",role:"menu",ref:J,dir:"ltr",style:{...ql,top:ie.top,left:ie.left},children:[u.jsx(ui,{"data-testid":"transcript-edit-range",onClick:Le,disabled:Te,title:Te?"A selected word has no source anchor (this project predates them) — re-run produce first":Ue!==void 0?"Re-edit the rewritten range this selection touches":he.length===1?"Retype this word (1:1 — same as double-click)":"Rewrite these words as free text — word count may change",children:"Edit"}),u.jsx(ui,{"data-testid":"transcript-timing",onClick:sr,disabled:he.length===0||Te,title:Te?"A selected word has no source anchor (this project predates them) — re-run produce first":Mn===1?"Adjust when this caption appears and leaves":`Adjust when these ${Mn} captions appear and leave`,children:"Timing"}),Ne?u.jsx(ui,{"data-testid":"transcript-restore",onClick:Pn,title:"Show these words in the captions again",children:"Restore"}):u.jsxs("span",{style:{position:"relative"},children:[u.jsx(ui,{"data-testid":"transcript-delete-menu",onClick:()=>ue(_=>!_),title:"Delete these words — from the captions only, or from the video too",children:"Delete ▾"}),V?u.jsxs("div",{"data-testid":"transcript-delete-flyout",dir:"ltr",style:v5,children:[u.jsx(ui,{"data-testid":"transcript-hide",onClick:()=>{ue(!1),Ye()},disabled:Te,title:Te?"A selected word has no source anchor (this project predates them) — re-run produce first":"Hide these words from the captions — restorable, the words stay here and in the audio",children:"Delete captions"}),u.jsx(ui,{"data-testid":"transcript-delete",onClick:()=>{ue(!1),mt()},disabled:Te,title:Te?"A selected word has no source anchor (this project predates them) — re-run produce first":"Delete these words — from the captions only, or from the video too",children:"Delete + video…"})]}):null]}),u.jsxs("span",{style:Vv,children:[he.length," word",he.length===1?"":"s"]})]}):null,h!==null&&ie!==null?u.jsxs("div",{"data-testid":"transcript-range-popover",ref:J,dir:"ltr",style:{...ql,top:ie.top,left:ie.left,flexDirection:"column",alignItems:"stretch",gap:6},children:[u.jsx("textarea",{autoFocus:!0,"data-testid":"transcript-range-edit",rows:3,dir:"auto",style:x5,value:h.draft,onChange:_=>y({...h,draft:_.target.value}),onKeyDown:_=>{_.key==="Enter"&&!_.shiftKey&&(_.preventDefault(),Qe(h)),_.key==="Escape"&&y(null)}}),u.jsxs("div",{style:{display:"flex",gap:6},children:[u.jsx("button",{"data-testid":"transcript-apply",style:Hr,onClick:()=>Qe(h),title:"Rewrite this selection (Enter)",children:"Apply"}),Pt.length>0?u.jsxs("button",{"data-testid":"transcript-apply-all",style:Hr,onClick:()=>Fn(h),title:"Rewrite this selection AND every other place the same words occur — one undo step",children:["Apply to all (",Pt.length,")"]}):null,u.jsx("button",{style:Hr,onClick:()=>y(null),title:"Discard the rewrite (Esc)",children:"Cancel"})]})]}):null,u.jsx("audio",{"data-testid":"transcript-timing-audio",ref:$,src:"/media/audio.wav",preload:"none",onTimeUpdate:Dr,onLoadedMetadata:_=>{const H=_.currentTarget.duration;Number.isFinite(H)&&H>0&&K(H)}}),v!==null&&it!==null&&ie!==null?u.jsxs("div",{"data-testid":"transcript-timing-popover",ref:J,dir:"ltr",style:{...ql,top:ie.top,left:ie.left,flexDirection:"column",alignItems:"stretch",gap:6},children:[u.jsxs("div",{style:{position:"relative",width:Eo,height:Ln},children:[u.jsx("canvas",{"data-testid":"transcript-timing-canvas",ref:M,width:Eo,height:Ln,style:{display:"block",borderRadius:4}}),ar!==null?u.jsxs(u.Fragment,{children:[u.jsx("div",{"data-testid":"transcript-timing-band",title:Kn===1?"Drag to move this caption onto the audio it belongs to, its duration intact":"Drag to move these captions onto the audio they belong to, every duration intact",onPointerDown:ko("band"),style:{...p5,left:ar.lead,width:Math.max(0,ar.tail-ar.lead),cursor:(U==null?void 0:U.edge)==="band"?"grabbing":"grab"}}),u.jsx(zv,{"data-testid":"transcript-timing-handle-lead",title:Kn===1?"Drag to move when this caption comes in":"Drag to move when the first caption comes in",x:ar.lead,active:(U==null?void 0:U.edge)==="lead",onPointerDown:ko("lead")}),u.jsx(zv,{"data-testid":"transcript-timing-handle-tail",title:Kn===1?"Drag to move when this caption goes out":"Drag to move when the last caption goes out",x:ar.tail,active:(U==null?void 0:U.edge)==="tail",onPointerDown:ko("tail")}),j!==null?u.jsx("div",{"data-testid":"transcript-timing-playhead",style:{...h5,left:_n(j)}}):null]}):null]}),u.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[u.jsx("button",{"data-testid":"transcript-timing-play",style:Hr,onClick:Or,title:S?"Pause":Kn===1?"Play the audio under this caption's window":"Play the audio under these captions' window",children:S?"Pause":"Play"}),u.jsx("button",{"data-testid":"transcript-timing-loop",style:C?{...Hr,...b5}:Hr,"aria-pressed":C,onClick:()=>I(_=>!_),title:C?"Stop at the end of the selection instead of repeating it":"Repeat the selection so the same seconds can be checked against the words",children:"Loop"}),u.jsxs("span",{"data-testid":"transcript-timing-span",style:Vv,children:[v.newSpan.start.toFixed(2),"s – ",v.newSpan.end.toFixed(2),"s",` · ${Kn} caption${Kn===1?"":"s"}`,(gt??[]).some(_=>Lt.has(_.key))?" · overlaps":""]}),u.jsx("button",{"data-testid":"transcript-timing-apply",style:Hr,onClick:()=>{Qt!==null&&Qo(Qt)},title:Kn===1?"Store where this caption sits in the source audio":"Store where these captions sit in the source audio — one undo step for the whole gesture",children:"Apply"}),u.jsx("button",{"data-testid":"transcript-timing-cancel",style:Hr,onClick:()=>b(null),title:"Discard the placement (Esc)",children:"Cancel"})]})]}):null]})]})},ui=({children:e,...t})=>{const[n,r]=d.useState(!1);return u.jsx("button",{role:"menuitem",...t,style:{...w5,...n&&!t.disabled?{background:"#34343F"}:{},...t.disabled?{opacity:.5,cursor:"default"}:{}},onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:e})},zv=({x:e,active:t,...n})=>{const[r,o]=d.useState(!1);return u.jsx("div",{...n,style:{...f5,left:e-ak/2},onPointerEnter:()=>o(!0),onPointerLeave:()=>o(!1),children:u.jsx("div",{style:{...m5,background:t?"#fff":r?"#FFF0A0":"#FFE14D",width:t?4:2}})})},JL={flexShrink:0,display:"flex",flexDirection:"column",background:"#111116",minHeight:0},QL={display:"flex",flexDirection:"column",gap:8,padding:"14px 14px 10px",borderBottom:"1px solid #1E1E24"},e5={fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"#9A9AA3"},Bv={fontSize:11,lineHeight:1.45,color:"#6a6a75"},t5={fontFamily:"'Inter', system-ui, sans-serif",fontSize:13,background:"#0F0F14",border:"1px solid #2A2A33",borderRadius:6,color:"#fff",padding:"6px 8px"},n5={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"},r5={cursor:"pointer",borderRadius:3,padding:"2px 4px",unicodeBidi:"isolate"},o5={background:"#2b2b1a",outline:"1px solid #6b6432"},i5={background:"#3d3a17",outline:"2px solid #FFE14D",color:"#fff"},Wv={width:26,height:30,fontSize:16,lineHeight:1,color:"#EDEDF2",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:6,cursor:"pointer",padding:0},s5={color:"#FFE14D"},a5={background:"#2E5CFF30",color:"#F2F4FF",borderRadius:4},l5={color:"#F0A53C"},u5={background:"#FFE14D",color:"#111",borderRadius:0,boxShadow:"-4px 0 0 0 #FFE14D, 4px 0 0 0 #FFE14D"},c5={textDecoration:"line-through",color:"#6a6a75"},d5={borderBottom:"1px dotted #9A9AA3"},ak=12,f5={position:"absolute",top:0,width:ak,height:Ln,cursor:"ew-resize",touchAction:"none",display:"flex",justifyContent:"center"},p5={position:"absolute",top:0,height:Ln,touchAction:"none"},h5={position:"absolute",top:0,width:1,height:Ln,background:"#FFFFFF",pointerEvents:"none"},m5={height:"100%",borderRadius:1,pointerEvents:"none"},g5={display:"flex",gap:6,alignItems:"center",justifyContent:"space-between"},y5={width:20,height:20,fontSize:11,lineHeight:1,color:"#9A9AA3",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:6,cursor:"pointer",padding:0,flexShrink:0},ql={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},v5={...ql,top:"100%",left:0,marginTop:4,zIndex:32,minWidth:170,flexDirection:"column",alignItems:"stretch"},Vv={fontSize:11,color:"#9A9AA3",paddingInline:"6px 8px",whiteSpace:"nowrap"},w5={fontSize:12,fontWeight:600,color:"#EDEDF2",background:"transparent",border:"none",borderRadius:6,padding:"6px 10px",cursor:"pointer",textAlign:"left",whiteSpace:"nowrap"},x5={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"},Hr={fontSize:11,color:"#EDEDF2",background:"#34343F",border:"1px solid #45454F",borderRadius:6,cursor:"pointer",padding:"4px 8px"},b5={color:"#111",background:"#FFE14D",borderColor:"#FFE14D"},S5={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"},k5=[{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"]]}],E5=({onClose:e})=>(d.useEffect(()=>{const t=n=>{n.key==="Escape"&&(n.stopPropagation(),e())};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e]),u.jsx("div",{style:C5,onMouseDown:e,children:u.jsxs("div",{"data-testid":"shortcuts-modal",style:I5,onMouseDown:t=>t.stopPropagation(),children:[u.jsxs("div",{style:T5,children:[u.jsx("span",{style:j5,children:"keybinds"}),u.jsx("span",{style:R5,children:"esc close"})]}),u.jsx("div",{style:F5,children:"available commands and configured shortcuts"}),k5.map(t=>u.jsxs("div",{style:{marginTop:18},children:[u.jsx("div",{style:P5,children:t.title}),t.rows.map(([n,r])=>u.jsxs("div",{style:$5,children:[u.jsx("span",{style:M5,children:n}),u.jsx("span",{style:_5,children:r})]},n))]},t.title))]})})),C5={position:"fixed",inset:0,zIndex:30,background:"rgba(5,5,8,0.6)",display:"flex",alignItems:"center",justifyContent:"center"},I5={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"},T5={display:"flex",justifyContent:"space-between",alignItems:"center"},j5={fontSize:18,fontWeight:700,color:"#EDEDF2"},R5={fontSize:13,fontWeight:700,color:"#0B0B0E",background:"#a8c7fa",borderRadius:4,padding:"3px 10px"},F5={fontSize:13,color:"#6a6a75",marginTop:4},P5={fontSize:14,fontWeight:700,color:"#8ab4f8",marginBottom:6},$5={display:"flex",gap:16,padding:"3px 0"},M5={width:290,flexShrink:0,color:"#c5a3ff",fontWeight:600,fontSize:13},_5={color:"#C9C9D4",fontSize:13},Hv={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`}},A5=({plan:e,onConfirm:t,onCancel:n})=>{const[r,o]=d.useState(e.targets[0]),i=d.useRef(null),s=d.useRef(null);return d.useEffect(()=>{const a=l=>{if(l.key==="Escape"){l.stopPropagation(),n();return}if(l.key!=="Tab")return;const c=i.current;if(!c)return;const f=c.querySelectorAll("input, button"),p=f[0],m=f[f.length-1];!p||!m||(l.shiftKey&&document.activeElement===p?(l.preventDefault(),m.focus()):!l.shiftKey&&document.activeElement===m&&(l.preventDefault(),p.focus()))};return window.addEventListener("keydown",a,!0),()=>window.removeEventListener("keydown",a,!0)},[n]),d.useEffect(()=>{var l;const a=document.activeElement;return(l=s.current)==null||l.focus(),()=>{var c;return(c=a==null?void 0:a.focus)==null?void 0:c.call(a)}},[]),u.jsx("div",{style:N5,onMouseDown:n,children:u.jsxs("form",{ref:i,"data-testid":"delete-scene-modal",role:"dialog","aria-modal":"true","aria-label":`Delete ${e.rootId}`,style:L5,onMouseDown:a=>a.stopPropagation(),onSubmit:a=>{a.preventDefault(),t(r)},children:[u.jsxs("div",{style:O5,children:[u.jsxs("span",{style:D5,children:["delete ",e.rootId,e.isSplitHalf?u.jsx("span",{style:z5,children:"half"}):null,"?"]}),u.jsx("span",{style:B5,children:"esc cancel"})]}),u.jsx("div",{style:W5,children:"undoable with ⌘Z, like every other edit"}),u.jsx("div",{style:{marginTop:16},children:e.targets.map(a=>u.jsxs("label",{style:V5,"data-testid":`delete-option-${a}`,children:[u.jsx("input",{type:"radio",name:"delete-target",value:a,checked:r===a,onChange:()=>o(a),style:H5}),u.jsxs("span",{children:[u.jsx("span",{style:U5,children:Hv[a].label}),u.jsx("span",{style:Z5,children:Hv[a].detail(e)})]})]},a))}),u.jsxs("div",{style:K5,children:[u.jsx("button",{type:"button","data-testid":"delete-cancel",style:lk,onClick:n,children:"Cancel"}),u.jsx("button",{ref:s,type:"submit","data-testid":"delete-confirm",style:Y5,children:"Delete"})]})]})})},N5={position:"fixed",inset:0,zIndex:30,background:"rgba(5,5,8,0.6)",display:"flex",alignItems:"center",justifyContent:"center"},L5={width:420,maxWidth:"90vw",background:"#12121A",border:"1px solid #3A3A48",borderRadius:8,padding:"18px 22px 20px",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace"},O5={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12},D5={fontSize:16,fontWeight:700,color:"#EDEDF2"},z5={fontSize:11,fontWeight:700,color:"#0B0B0E",background:"#c5a3ff",borderRadius:4,padding:"2px 6px",marginLeft:6},B5={fontSize:12,fontWeight:700,color:"#0B0B0E",background:"#a8c7fa",borderRadius:4,padding:"3px 10px",whiteSpace:"nowrap"},W5={fontSize:12,color:"#6a6a75",marginTop:4},V5={display:"flex",alignItems:"flex-start",gap:10,padding:"8px 0",cursor:"pointer"},H5={accentColor:"#8ab4f8",marginTop:2,cursor:"pointer"},U5={display:"block",fontSize:13,fontWeight:600,color:"#EDEDF2"},Z5={display:"block",fontSize:12,color:"#9A9AA3",marginTop:2},K5={display:"flex",justifyContent:"flex-end",gap:8,marginTop:14},lk={fontSize:12,fontWeight:600,color:"#C9C9D4",background:"transparent",border:"1px solid #2A2A33",borderRadius:6,padding:"7px 12px",cursor:"pointer",fontFamily:"inherit"},Y5={...lk,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`}},G5=({plan:e,onConfirm:t,onCancel:n})=>{const[r,o]=d.useState(e.targets[0]),i=d.useRef(null),s=d.useRef(null);d.useEffect(()=>{const l=c=>{if(c.key==="Escape"){c.stopPropagation(),n();return}if(c.key!=="Tab")return;const f=i.current;if(!f)return;const p=f.querySelectorAll("input, button"),m=p[0],g=p[p.length-1];!m||!g||(c.shiftKey&&document.activeElement===m?(c.preventDefault(),g.focus()):!c.shiftKey&&document.activeElement===g&&(c.preventDefault(),m.focus()))};return window.addEventListener("keydown",l,!0),()=>window.removeEventListener("keydown",l,!0)},[n]),d.useEffect(()=>{var c;const l=document.activeElement;return(c=s.current)==null||c.focus(),()=>{var f;return(f=l==null?void 0:l.focus)==null?void 0:f.call(l)}},[]);const a=e.words.length;return u.jsx("div",{style:X5,onMouseDown:n,children:u.jsxs("form",{ref:i,"data-testid":"delete-words-modal",role:"dialog","aria-modal":"true","aria-label":`Delete ${a} word${a===1?"":"s"}`,style:q5,onMouseDown:l=>l.stopPropagation(),onSubmit:l=>{l.preventDefault(),t(r)},children:[u.jsxs("div",{style:J5,children:[u.jsxs("span",{style:Q5,children:["delete ",a," word",a===1?"":"s","?"]}),u.jsx("span",{style:eO,children:"esc cancel"})]}),u.jsx("div",{style:tO,children:"undoable with ⌘Z, like every other edit"}),u.jsx("div",{style:{marginTop:16},children:e.targets.map(l=>u.jsxs("label",{style:nO,"data-testid":`delete-words-option-${l}`,children:[u.jsx("input",{type:"radio",name:"delete-words-target",value:l,checked:r===l,onChange:()=>o(l),style:rO}),u.jsxs("span",{children:[u.jsx("span",{style:oO,children:Uv[l].label}),u.jsx("span",{style:iO,children:Uv[l].detail(e)})]})]},l))}),u.jsxs("div",{style:sO,children:[u.jsx("button",{type:"button","data-testid":"delete-words-cancel",style:uk,onClick:n,children:"Cancel"}),u.jsx("button",{ref:s,type:"submit","data-testid":"delete-words-confirm",style:aO,children:"Delete"})]})]})})},X5={position:"fixed",inset:0,zIndex:30,background:"rgba(5,5,8,0.6)",display:"flex",alignItems:"center",justifyContent:"center"},q5={width:420,maxWidth:"90vw",background:"#12121A",border:"1px solid #3A3A48",borderRadius:8,padding:"18px 22px 20px",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace"},J5={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12},Q5={fontSize:16,fontWeight:700,color:"#EDEDF2"},eO={fontSize:12,fontWeight:700,color:"#0B0B0E",background:"#a8c7fa",borderRadius:4,padding:"3px 10px",whiteSpace:"nowrap"},tO={fontSize:12,color:"#6a6a75",marginTop:4},nO={display:"flex",alignItems:"flex-start",gap:10,padding:"8px 0",cursor:"pointer"},rO={accentColor:"#8ab4f8",marginTop:2,cursor:"pointer"},oO={display:"block",fontSize:13,fontWeight:600,color:"#EDEDF2"},iO={display:"block",fontSize:12,color:"#9A9AA3",marginTop:2},sO={display:"flex",justifyContent:"flex-end",gap:8,marginTop:14},uk={fontSize:12,fontWeight:600,color:"#C9C9D4",background:"transparent",border:"1px solid #2A2A33",borderRadius:6,padding:"7px 12px",cursor:"pointer",fontFamily:"inherit"},aO={...uk,color:"#FF5C5C",border:"1px solid #452626"},lO=(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("/")}},Zv=e=>e.scrollTop+e.clientHeight<e.scrollHeight-1,uO=(e,t,n)=>n<=0?-1:Math.max(0,Math.min(n-1,e+t)),Kv=({recent:e,required:t,onOpen:n,onClose:r})=>{const[o,i]=d.useState(null),[s,a]=d.useState(null),[l,c]=d.useState(!1),f=d.useRef(null),p=d.useRef(null),[m,g]=d.useState(!1),[w,x]=d.useState(!1),k=()=>{g(f.current?Zv(f.current):!1)},h=()=>{x(p.current?Zv(p.current):!1)},y=async S=>{try{const E=await fetch(`/api/fs${S?`?dir=${encodeURIComponent(S)}`:""}`),C=await E.json();if(!E.ok)throw new Error(C.error??`listing failed: ${E.status}`);i(C)}catch(E){a(E instanceof Error?E.message:String(E))}};d.useEffect(()=>{y()},[]),d.useEffect(()=>{const S=()=>{k(),h()};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 v=S=>{var F;const E=S.key==="ArrowDown"?1:S.key==="ArrowUp"?-1:0;if(E===0&&S.key!=="Home"&&S.key!=="End")return;const C=Array.from(S.currentTarget.querySelectorAll("button"));if(C.length===0)return;const I=C.indexOf(document.activeElement),j=S.key==="Home"?0:S.key==="End"?C.length-1:uO(I,E,C.length);S.preventDefault(),(F=C[j])==null||F.focus()},b=S=>{c(!0),a(null),n(S).then(E=>{c(!1),E&&a(E)})};return u.jsx("div",{style:cO,onMouseDown:t?void 0:r,children:u.jsxs("div",{"data-testid":"project-picker",style:dO,onMouseDown:S=>S.stopPropagation(),children:[u.jsxs("div",{style:fO,children:[u.jsx("span",{style:pO,children:t?"open a project":"switch project"}),t?null:u.jsx("button",{"data-testid":"project-picker-close",style:hO,onClick:r,children:"esc close"})]}),u.jsx("div",{style:mO,children:"A project is a work directory a `ossclip produce` run wrote — the folder holding render-props.json."}),s?u.jsx("div",{"data-testid":"project-picker-error",style:gO,children:s}):null,e.length>0?u.jsxs("div",{style:{marginTop:16,flexShrink:0},children:[u.jsx("div",{style:Yv,children:"recent"}),u.jsx("div",{ref:p,className:"ossclip-scroll-list",style:w?{...Gv,...qv}:Gv,onScroll:h,onKeyDown:v,"data-testid":"project-recent-list",children:e.map(S=>{const{head:E,tail:C}=lO(S);return u.jsxs("button",{"data-testid":"project-recent",className:"ossclip-picker-row",style:{...zd,...bO},disabled:l,onClick:()=>b(S),title:S,children:[u.jsx("span",{style:{color:"#FFE14D",flexShrink:0},children:"▸"}),u.jsxs("span",{style:SO,children:[u.jsx("span",{style:kO,children:C}),E?u.jsx("span",{style:EO,children:E}):null]})]},S)})})]}):null,u.jsxs("div",{style:xO,children:[u.jsx("div",{style:Yv,children:"browse"}),u.jsxs("div",{style:{color:"#6a6a75",fontSize:12,marginBottom:6},children:["Folders only — hidden ones are omitted, and any projects produced inside a folder show up directly as ",u.jsx("span",{style:{color:"#FFE14D"},children:"▸ .ossclip/…"})," entries."]}),o?u.jsxs(u.Fragment,{children:[u.jsxs("div",{style:yO,children:[u.jsx("span",{style:vO,title:o.dir,children:o.dir}),o.isWorkdir?u.jsx("button",{"data-testid":"project-open-current",style:wO,disabled:l,onClick:()=>b(o.dir),children:"open this project"}):null]}),u.jsxs("div",{ref:f,className:"ossclip-scroll-list",style:m?{...Xv,...qv}:Xv,onScroll:k,onKeyDown:v,"data-testid":"project-fs-list",children:[o.parent?u.jsxs("button",{"data-testid":"project-fs-up",className:"ossclip-picker-row",style:zd,disabled:l,onClick:()=>void y(o.parent),children:[u.jsx("span",{style:{color:"#6a6a75",flexShrink:0},children:"↑"}),u.jsx("span",{style:Jv,children:".."})]}):null,o.entries.map(S=>u.jsxs("button",{"data-testid":S.isWorkdir?"project-fs-workdir":"project-fs-dir",className:`ossclip-picker-row${S.isWorkdir?" is-workdir":""}`,style:zd,disabled:l,onClick:()=>S.isWorkdir?b(S.path):void y(S.path),title:S.path,children:[u.jsx("span",{style:{flexShrink:0,color:S.isWorkdir?"#FFE14D":"#6a6a75"},children:S.isWorkdir?"▸":"▪"}),u.jsxs("span",{style:Jv,children:[S.name,S.isWorkdir?null:u.jsx("span",{style:{color:"#55555f"},children:"/"})]}),S.isWorkdir?u.jsx("span",{style:CO,children:"project"}):null]},S.path)),o.entries.length===0?u.jsx("div",{style:{color:"#6a6a75",fontSize:12,padding:"6px 8px"},children:"no folders here"}):null]})]}):u.jsx("div",{style:{color:"#6a6a75",fontSize:13},children:"loading…"})]})]})})},cO={position:"fixed",inset:0,zIndex:30,background:"rgba(5,5,8,0.6)",display:"flex",alignItems:"center",justifyContent:"center"},dO={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"},fO={display:"flex",justifyContent:"space-between",alignItems:"center"},pO={fontSize:18,fontWeight:700,color:"#EDEDF2"},hO={fontSize:13,fontWeight:700,color:"#0B0B0E",background:"#a8c7fa",border:"none",borderRadius:4,padding:"3px 10px",cursor:"pointer"},mO={fontSize:13,color:"#6a6a75",marginTop:4},gO={marginTop:12,fontSize:13,color:"#FF5C5C"},Yv={fontSize:14,fontWeight:700,color:"#8ab4f8",marginBottom:6},yO={display:"flex",alignItems:"center",gap:10,marginBottom:6},vO={fontSize:12,color:"#9A9AA3",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},wO={flexShrink:0,fontSize:12,fontWeight:700,color:"#0B0B0E",background:"#FFE14D",border:"1px solid #FFE14D",borderRadius:6,padding:"4px 10px",cursor:"pointer"},xO={marginTop:16,display:"flex",flexDirection:"column",flex:1,minHeight:0},Gv={maxHeight:218,overflowY:"auto",overscrollBehavior:"contain",flexShrink:0,display:"flex",flexDirection:"column",gap:2},Xv={flex:1,minHeight:0,overflowY:"auto",overscrollBehavior:"contain",display:"flex",flexDirection:"column",gap:2},qv={maskImage:"linear-gradient(to bottom, black calc(100% - 24px), transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black calc(100% - 24px), transparent 100%)"},zd={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"},Jv={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},bO={minHeight:46,alignItems:"center"},SO={display:"flex",flexDirection:"column",minWidth:0},kO={color:"#EDEDF2",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},EO={fontSize:11,color:"#6a6a75",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},CO={marginLeft:10,fontSize:11,fontWeight:700,color:"#FFE14D"},IO=({defaultOutPath:e,onCancel:t,onConfirm:n})=>{const[r,o]=d.useState(e??""),[i,s]=me.useState(!1),[a,l]=d.useState(!1);d.useEffect(()=>{const f=p=>{p.key==="Escape"?(p.stopPropagation(),t()):p.key==="Enter"&&!a&&(p.preventDefault(),n(r.trim()?r.trim():void 0,i))};return window.addEventListener("keydown",f,!0),()=>window.removeEventListener("keydown",f,!0)},[t,n,r,a,i]);const c=async()=>{l(!0);try{const f=await fetch("/api/pick-save-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({defaultPath:r||e})});if(f.ok){const p=await f.json();p.path&&o(p.path)}}catch{}finally{l(!1)}};return u.jsx("div",{style:TO,onMouseDown:t,children:u.jsxs("div",{"data-testid":"render-modal",style:jO,onMouseDown:f=>f.stopPropagation(),children:[u.jsxs("div",{style:RO,children:[u.jsx("div",{style:FO,children:"🎬 Render Master Video"}),u.jsx("button",{style:PO,onClick:t,children:"✕"})]}),u.jsx("div",{style:$O,children:"Choose where to export your rendered master cut, or keep the default location."}),u.jsxs("div",{style:{marginTop:20},children:[u.jsx("label",{style:MO,children:"Export File Destination"}),u.jsxs("div",{style:_O,children:[u.jsx("input",{"data-testid":"render-outpath-input",type:"text",value:r,onChange:f=>o(f.target.value),placeholder:"e.g. /Users/name/Movies/final-cut.mp4",style:AO,autoFocus:!0}),u.jsx("button",{"data-testid":"render-browse-btn",style:NO,onClick:c,disabled:a,title:"Open native file picker to choose destination",children:a?"Browsing…":"📁 Browse…"})]})]}),u.jsxs("div",{style:LO,children:[u.jsx("button",{style:OO,onClick:t,children:"Cancel"}),u.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,margin:"12px 0",fontSize:13,opacity:.85},children:[u.jsx("input",{type:"checkbox","data-testid":"render-replan",checked:i,onChange:f=>s(f.target.checked)}),"Re-plan graphics with the LLM (discards the reviewed plan)"]}),u.jsx("button",{"data-testid":"render-confirm-btn",style:DO,onClick:()=>n(r.trim()?r.trim():void 0,i),children:"Start Render ⚡"})]})]})})},TO={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},jO={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"},RO={display:"flex",justifyContent:"space-between",alignItems:"center"},FO={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},PO={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},$O={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},MO={display:"block",fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.04em"},_O={display:"flex",gap:8},AO={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"},NO={background:"#1E1E2A",border:"1px solid #3A3A48",borderRadius:6,color:"#EDEDF2",padding:"0 16px",fontSize:13,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap"},LO={display:"flex",justifyContent:"flex-end",gap:12,marginTop:24},OO={background:"transparent",border:"1px solid #2C2C38",borderRadius:6,color:"#C9C9D4",padding:"9px 18px",fontSize:13,fontWeight:600,cursor:"pointer"},DO={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 zO(e){switch(e){case"override":return"Project override";case"flag":case"config":return"Your default portrait"}}function BO(e){const t=/^data:([^;,]+);base64,(.+)$/s.exec(e);return t?{mimeType:t[1],data:t[2]}:null}function WO(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 Qv=60,VO=({onClose:e})=>{const[t,n]=d.useState(null),[r,o]=d.useState(null),[i,s]=d.useState(""),[a,l]=d.useState(""),[c,f]=d.useState(""),[p,m]=d.useState(null),[g,w]=d.useState(!1),[x,k]=d.useState(null),[h,y]=d.useState(null),v=d.useRef(null);d.useEffect(()=>{const j=F=>{F.key==="Escape"&&(F.stopPropagation(),e())};return window.addEventListener("keydown",j,!0),()=>window.removeEventListener("keydown",j,!0)},[e]),d.useEffect(()=>{(async()=>{try{const j=await fetch("/api/thumbnail"),F=await j.json();if(!j.ok)throw new Error(F.error??`GET /api/thumbnail failed: ${j.status}`);n(F),m(F.imageUrl),F.concept&&(s(F.concept.overlayText),l(F.concept.scene),f(F.concept.styleNotes))}catch(j){o(j instanceof Error?j.message:String(j))}})()},[]);const b=async()=>{w(!0),k(null);try{const j=await fetch("/api/thumbnail/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({concept:{scene:a,overlayText:i,styleNotes:c}})}),F=await j.json();if(!j.ok||F.ok!==!0){k(F.error??`regenerate failed: ${j.status}`);return}m(F.imageUrl??null)}catch(j){k(j instanceof Error?j.message:String(j))}finally{w(!1)}},S=j=>{n(F=>F&&{...F,portrait:j})},E=async j=>{y(null);try{const F=await new Promise(($,U)=>{const Y=new FileReader;Y.onload=()=>$(String(Y.result)),Y.onerror=()=>U(new Error("could not read the image file")),Y.readAsDataURL(j)}),N=BO(F);if(N===null){y("could not read the image file");return}const K=await fetch("/api/thumbnail/portrait",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(N)}),M=await K.json();if(!K.ok||M.ok!==!0){y(M.error??`swap failed: ${K.status}`);return}S(M.portrait??null)}catch(F){y(F instanceof Error?F.message:String(F))}},C=async()=>{y(null);try{const j=await fetch("/api/thumbnail/portrait",{method:"DELETE"}),F=await j.json();if(!j.ok||F.ok!==!0){y(F.error??`reset failed: ${j.status}`);return}S(F.portrait??null)}catch(j){y(j instanceof Error?j.message:String(j))}},I=(t==null?void 0:t.status)==="unavailable";return u.jsx("div",{style:HO,onMouseDown:e,children:u.jsxs("div",{"data-testid":"thumbnail-modal",style:UO,onMouseDown:j=>j.stopPropagation(),children:[u.jsxs("div",{style:ZO,children:[u.jsx("div",{style:KO,children:"AI Thumbnail"}),u.jsx("button",{style:YO,onClick:e,"aria-label":"Close",children:"✕"})]}),r?u.jsxs("div",{"data-testid":"thumbnail-load-error",style:Hd,children:["Couldn't load the thumbnail state: ",r]}):t===null?u.jsx("div",{style:Bd,children:"Loading…"}):I?u.jsx("div",{"data-testid":"thumbnail-unavailable",style:{...Bd,marginTop:12},children:WO(t.reason)}):u.jsxs(u.Fragment,{children:[t.status==="skipped"?u.jsx("div",{"data-testid":"thumbnail-skipped-note",style:{...Bd,marginTop:8},children:"Thumbnail was skipped at the concept approval prompt — regenerating replaces that decision."}):null,u.jsx("div",{style:GO,children:p?u.jsx("img",{"data-testid":"thumbnail-image",src:p,alt:"Current AI thumbnail",style:XO}):u.jsx("div",{"data-testid":"thumbnail-placeholder",style:qO,children:"No thumbnail generated yet — edit the concept and hit Regenerate."})}),t.portrait?u.jsxs("div",{"data-testid":"portrait-strip",style:JO,children:[u.jsx("img",{"data-testid":"portrait-preview",src:t.portrait.url,alt:"Portrait reference",style:QO}),u.jsxs("div",{style:{flex:1,minWidth:0},children:[u.jsx("div",{"data-testid":"portrait-source",style:eD,children:zO(t.portrait.source)}),u.jsx("div",{style:t0,children:"The swap applies to this project only and is used by future renders too."})]}),u.jsx("button",{"data-testid":"portrait-swap-btn",style:e0,onClick:()=>{var j;return(j=v.current)==null?void 0:j.click()},disabled:g,children:"Swap face…"}),t.portrait.source==="override"?u.jsx("button",{"data-testid":"portrait-reset-btn",style:e0,onClick:()=>void C(),disabled:g,children:"Use default"}):null,u.jsx("input",{ref:v,"data-testid":"portrait-file-input",type:"file",accept:"image/png,image/jpeg,image/webp",style:{display:"none"},onChange:j=>{var N;const F=(N=j.target.files)==null?void 0:N[0];j.target.value="",F&&E(F)}})]}):null,h?u.jsx("div",{"data-testid":"portrait-error",style:Hd,children:h}):null,u.jsxs("div",{style:{marginTop:16},children:[u.jsxs("label",{style:Wd,children:["Overlay text — the words ON the image (",Qv," chars, 4–9 words)"]}),u.jsx("input",{"data-testid":"thumbnail-overlay-input",type:"text",maxLength:Qv,value:i,onChange:j=>s(j.target.value),style:Vd})]}),u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Wd,children:"Scene — what the image shows"}),u.jsx("textarea",{"data-testid":"thumbnail-scene-input",value:a,onChange:j=>l(j.target.value),rows:3,style:{...Vd,resize:"vertical"}})]}),u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Wd,children:"Style notes — palette, lighting, mood"}),u.jsx("textarea",{"data-testid":"thumbnail-style-input",value:c,onChange:j=>f(j.target.value),rows:3,style:{...Vd,resize:"vertical"}})]}),x?u.jsx("div",{"data-testid":"thumbnail-error",style:Hd,children:x}):null,u.jsxs("div",{style:tD,children:[u.jsx("div",{style:t0,children:"Regenerating replaces the video's .thumbnail.png and saves this concept for future renders."}),u.jsx("button",{"data-testid":"thumbnail-regenerate-btn",style:{...nD,...g?{opacity:.6,cursor:"default"}:{}},onClick:()=>void b(),disabled:g,children:g?"Generating…":"Regenerate"})]})]})]})})},HO={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},UO={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"},ZO={display:"flex",justifyContent:"space-between",alignItems:"center"},KO={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},YO={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},Bd={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},GO={marginTop:16,border:"1px solid #2C2C38",borderRadius:6,background:"#09090D",aspectRatio:"16 / 9",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},XO={width:"100%",height:"100%",objectFit:"contain"},qO={color:"#8B8B9E",fontSize:13,padding:16,textAlign:"center"},JO={display:"flex",alignItems:"center",gap:12,marginTop:12,padding:"10px 12px",border:"1px solid #2C2C38",borderRadius:6,background:"#09090D"},QO={width:44,height:44,borderRadius:6,objectFit:"cover",flexShrink:0,border:"1px solid #2C2C38"},eD={fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:2},e0={background:"transparent",border:"1px solid #3A3A48",borderRadius:6,color:"#C9C9D4",padding:"7px 12px",fontSize:12,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap"},Wd={display:"block",fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.04em"},Vd={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"},Hd={marginTop:12,color:"#FF5C5C",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",whiteSpace:"pre-wrap"},tD={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,marginTop:20},t0={fontSize:12,color:"#8B8B9E",lineHeight:1.4},nD={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)"},rD=({cutlist:e,edits:t,onClose:n})=>{d.useEffect(()=>{const i=s=>{s.key==="Escape"&&(s.stopPropagation(),n())};return window.addEventListener("keydown",i,!0),()=>window.removeEventListener("keydown",i,!0)},[n]);const r=iL(e),o=t.doc.cleanup.kept.length;return u.jsx("div",{style:iD,onMouseDown:n,children:u.jsxs("div",{"data-testid":"cleanup-modal",style:sD,onMouseDown:i=>i.stopPropagation(),children:[u.jsxs("div",{style:aD,children:[u.jsx("div",{style:lD,children:"Cleanup"}),u.jsx("button",{style:uD,onClick:n,"aria-label":"Close",children:"✕"})]}),u.jsx("div",{style:Ud,children:'What produce removed, by reason. Untick a category to keep it — the preview plays your choice immediately and the next render applies it. Individual removals can be kept by clicking their marker above the timeline; right-click a marker to say the classification was wrong ("not a retake").'}),r.length===0?u.jsx("div",{"data-testid":"cleanup-empty",style:{...Ud,marginTop:16},children:"This run proposed no removals to review."}):u.jsx("div",{style:{marginTop:16},children:r.map(i=>{const s=t.doc.cleanup.reasons[i.reason]!==!1;return u.jsxs("label",{"data-testid":`cleanup-reason-${i.reason}`,style:n0,children:[u.jsx("input",{type:"checkbox","data-testid":`cleanup-checkbox-${i.reason}`,checked:s,onChange:a=>t.setReasonEnabled(i.reason,a.target.checked)}),u.jsx("span",{style:{...cD,background:im[i.reason]}}),u.jsxs("span",{style:{...r0,...s?{}:{color:"#8B8B9E"}},children:[oL[i.reason]," — ",i.count," removal",i.count===1?"":"s"," ","· ",i.seconds.toFixed(1),"s"]}),s?null:u.jsx("span",{"data-testid":`cleanup-declined-${i.reason}`,style:dD,children:"kept — live in the preview"})]},i.reason)})}),o>0?u.jsxs("div",{"data-testid":"cleanup-kept-note",style:{...fD,marginTop:12},children:[o," individual removal",o===1?"":"s"," kept via timeline markers."]}):null,t.doc.cleanup.dismissed.length>0?u.jsxs("div",{style:{marginTop:16},children:[u.jsx("div",{style:{...Ud,marginBottom:6},children:"Dismissed markers — the material is ordinary footage now. Restore one to bring the proposal (and its marker) back."}),t.doc.cleanup.dismissed.map(i=>u.jsxs("div",{"data-testid":`cleanup-dismissed-${i.srcIn}-${i.srcOut}`,style:n0,children:[u.jsxs("span",{style:r0,children:[i.srcIn.toFixed(1),"s – ",i.srcOut.toFixed(1),"s (",(i.srcOut-i.srcIn).toFixed(1),"s)"]}),u.jsx("button",{"data-testid":`cleanup-restore-dismissed-${i.srcIn}-${i.srcOut}`,style:oD,onClick:()=>t.restoreDismissed(i.srcIn,i.srcOut),children:"Restore proposal"})]},`${i.srcIn}-${i.srcOut}`))]}):null]})})},oD={fontSize:12,fontWeight:600,color:"#C9C9D4",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:6,padding:"5px 10px",cursor:"pointer",whiteSpace:"nowrap"},iD={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},sD={width:460,maxWidth:"92vw",maxHeight:"90vh",overflowY:"auto",background:"#12121A",border:"1px solid #3A3A48",borderRadius:10,padding:"24px 28px",boxShadow:"0 20px 40px rgba(0,0,0,0.6)",fontFamily:"ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},aD={display:"flex",justifyContent:"space-between",alignItems:"center"},lD={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},uD={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},Ud={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},n0={display:"flex",alignItems:"center",gap:10,padding:"8px 10px",border:"1px solid #2C2C38",borderRadius:6,background:"#09090D",marginBottom:8,cursor:"pointer"},cD={width:10,height:10,borderRadius:2,flexShrink:0},r0={fontSize:13,color:"#EDEDF2",flex:1,minWidth:0},dD={fontSize:11,color:"#FFE14D",whiteSpace:"nowrap"},fD={fontSize:12,color:"#8B8B9E",lineHeight:1.4},o0=3,i0=5,Zd=500;function pD(e){return e.split(/\s+/).filter(t=>t.replace(/^#+/,"").length>0).map(t=>t.startsWith("#")?t:`#${t}`)}function hD(e){return e.map(t=>t.startsWith("#")?t:`#${t}`).join(" ")}function ck(e){return e.split(",").map(t=>t.trim()).filter(t=>t.length>0)}function dk(e){return e.join(", ")}function mD(e){return dk(ck(e)).length}function gD(e){const t=Math.max(0,Math.floor(e));return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function yD(e){return`[${{browse:"Browse",search:"Search",benefit:"Benefit",alt:"Alt"}[e]}]`}const vD="This run never generated YouTube metadata. Run produce with --youtube (and an LLM provider) once — the pack lands here afterwards.",wD=({onClose:e})=>{var K;const[t,n]=d.useState(null),[r,o]=d.useState(null),[i,s]=d.useState([]),[a,l]=d.useState(null),[c,f]=d.useState(""),[p,m]=d.useState(""),[g,w]=d.useState(""),[x,k]=d.useState(null),[h,y]=d.useState(null),[v,b]=d.useState(null),[S,E]=d.useState(!1),[C,I]=d.useState(null);d.useEffect(()=>{const M=$=>{$.key==="Escape"&&($.stopPropagation(),e())};return window.addEventListener("keydown",M,!0),()=>window.removeEventListener("keydown",M,!0)},[e]);const j=d.useCallback(async()=>{try{const M=await fetch("/api/youtube"),$=await M.json();if(!M.ok)throw new Error($.error??`GET /api/youtube failed: ${M.status}`);n($),$.pack&&(s($.pack.titles),l($.pack.titleAngles??null),f($.pack.description),m(hD($.pack.hashtags)),w(dk($.pack.tags)),k($.pack.hook60??null),y($.pack.linkedinPost??null),b($.pack.communityPost??null))}catch(M){o(M instanceof Error?M.message:String(M))}},[]);d.useEffect(()=>{j()},[j]);const F=async()=>{var M;E(!0),I(null);try{const $=await fetch("/api/youtube",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({pack:{titles:i,...a!==null?{titleAngles:a}:{},description:c,hashtags:pD(p),tags:ck(g),...(M=t==null?void 0:t.pack)!=null&&M.chapters?{chapters:t.pack.chapters}:{},...x!==null?{hook60:x}:{},...h!==null?{linkedinPost:h}:{},...v!==null?{communityPost:v}:{}}})}),U=await $.json();if(!$.ok||U.ok!==!0){I(U.error??`save failed: ${$.status}`);return}await j()}catch($){I($ instanceof Error?$.message:String($))}finally{E(!1)}},N=mD(g);return u.jsx("div",{style:xD,onMouseDown:e,children:u.jsxs("div",{"data-testid":"youtube-modal",style:bD,onMouseDown:M=>M.stopPropagation(),children:[u.jsxs("div",{style:SD,children:[u.jsx("div",{style:kD,children:"YouTube SEO metadata"}),u.jsx("button",{style:ED,onClick:e,"aria-label":"Close",children:"✕"})]}),r?u.jsxs("div",{"data-testid":"youtube-load-error",style:l0,children:["Couldn't load the YouTube pack: ",r]}):t===null?u.jsx("div",{style:s0,children:"Loading…"}):t.available?u.jsxs(u.Fragment,{children:[u.jsxs("div",{style:{marginTop:16},children:[u.jsxs("label",{style:Ur,children:["Title options (",o0,"–",i0,", up to 100 chars each)"]}),i.map((M,$)=>u.jsxs("div",{style:CD,children:[(a==null?void 0:a[$])!==void 0?u.jsx("span",{"data-testid":`youtube-title-angle-${$}`,style:ID,children:yD(a[$])}):null,u.jsx("input",{"data-testid":`youtube-title-input-${$}`,type:"text",maxLength:100,value:M,onChange:U=>s(Y=>Y.map((A,T)=>T===$?U.target.value:A)),style:Co}),u.jsx("button",{"data-testid":`youtube-title-remove-${$}`,style:a0,disabled:i.length<=o0,onClick:()=>{s(U=>U.filter((Y,A)=>A!==$)),l(U=>U&&U.filter((Y,A)=>A!==$))},"aria-label":`Remove title ${$+1}`,children:"✕"})]},$)),u.jsx("button",{"data-testid":"youtube-title-add",style:a0,disabled:i.length>=i0,onClick:()=>{s(M=>[...M,""]),l(M=>M&&[...M,"alt"])},children:"+ Add title"})]}),u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Ur,children:"Description"}),u.jsx("textarea",{"data-testid":"youtube-description-input",value:c,onChange:M=>f(M.target.value),rows:6,style:{...Co,resize:"vertical"}})]}),u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Ur,children:"Hashtags — space-separated, # added if missing"}),u.jsx("input",{"data-testid":"youtube-hashtags-input",type:"text",value:p,onChange:M=>m(M.target.value),style:Co})]}),u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Ur,children:"Tags — comma-separated"}),u.jsx("input",{"data-testid":"youtube-tags-input",type:"text",value:g,onChange:M=>w(M.target.value),style:Co}),u.jsxs("div",{"data-testid":"youtube-tags-counter",style:{...TD,...N>Zd?{color:"#FFB84D"}:{}},children:[N," / ",Zd,N>Zd?" — tags past the budget are dropped on save":""]})]}),(K=t.pack)!=null&&K.chapters&&t.pack.chapters.length>0?u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Ur,children:"Chapters (read-only — embedded in the description on save/render)"}),u.jsx("div",{"data-testid":"youtube-chapters",style:jD,children:t.pack.chapters.map((M,$)=>u.jsxs("div",{children:[gD(M.atSec)," ",M.title]},$))}),u.jsx("div",{style:u0,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,x!==null?u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Ur,children:"First-60s hook strategy (for you — never uploaded)"}),u.jsx("textarea",{"data-testid":"youtube-hook60-input",value:x,onChange:M=>k(M.target.value),rows:3,style:{...Co,resize:"vertical"}})]}):null,h!==null?u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Ur,children:"LinkedIn post"}),u.jsx("textarea",{"data-testid":"youtube-linkedin-input",value:h,onChange:M=>y(M.target.value),rows:6,style:{...Co,resize:"vertical"}})]}):null,v!==null?u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Ur,children:"Community post"}),u.jsx("textarea",{"data-testid":"youtube-community-input",value:v,onChange:M=>b(M.target.value),rows:3,style:{...Co,resize:"vertical"}})]}):null,C?u.jsx("div",{"data-testid":"youtube-error",style:l0,children:C}):null,u.jsxs("div",{style:RD,children:[u.jsx("div",{style:u0,children:"Saves for future renders and rewrites the .youtube.md file now. Delete youtube-pack-approved.json in the workdir to let the AI regenerate."}),u.jsx("button",{"data-testid":"youtube-save-btn",style:{...FD,...S?{opacity:.6,cursor:"default"}:{}},onClick:()=>void F(),disabled:S,children:S?"Saving…":"Save"})]})]}):u.jsx("div",{"data-testid":"youtube-unavailable",style:{...s0,marginTop:12},children:vD})]})})},xD={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},bD={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"},SD={display:"flex",justifyContent:"space-between",alignItems:"center"},kD={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},ED={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},s0={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},Ur={display:"block",fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.04em"},Co={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"},CD={display:"flex",gap:8,alignItems:"center",marginBottom:8},ID={fontSize:11,fontWeight:700,color:"#8B8B9E",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",whiteSpace:"nowrap",minWidth:62},a0={fontSize:12,fontWeight:600,color:"#C9C9D4",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:6,padding:"6px 10px",cursor:"pointer",whiteSpace:"nowrap"},TD={marginTop:6,fontSize:12,color:"#8B8B9E",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace"},jD={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},l0={marginTop:12,color:"#FF5C5C",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",whiteSpace:"pre-wrap"},RD={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,marginTop:20},u0={fontSize:12,color:"#8B8B9E",lineHeight:1.4,marginTop:6},FD={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 PD(e){switch(e){case"no-destination":return"This workdir has no cover.json and no recorded --out, so there is nowhere to write a cover. Run `ossclip produce` once with an output path, or `ossclip cover --out <path>` from a terminal.";default:return"The cover is unavailable for this project."}}function $D(e){const t=e.trim().replace(/\s+/g," "),n=w4(t);return{preview:n,trimmed:n!==t}}function fk(e){if(e.trim()==="")return{ok:!0};const t=Number(e);return!Number.isFinite(t)||t<0?{ok:!1,message:`"${e}" is not a timestamp in seconds — 0 or more, please.`}:{ok:!0,atSec:t}}function c0(e){return e!==null&&e.frame.sourceVideo!==null?{enabled:!0}:{enabled:!1,note:"There is no record of the original take for this project, so only the finished video can be read. The next `ossclip produce` records one."}}function MD(e){return e==="final"?"A frame from the finished video carries the burned-in captions, graphics and watermark.":"The original take — clean, framed the way produce framed it. Needs a cover.json."}function d0(e){return{...e.typed===(e.persistedText??"")?{}:{text:e.typed},...e.atSec===void 0?{}:{atSec:e.atSec},from:e.from}}function _D(e){if(e.from==="final")return{atSec:e.playheadOutSec,note:null};const t=new $c(e.cutlist);if(t.spans.length===0)return{atSec:e.playheadOutSec,note:`Couldn't convert to the original take's clock — this render recorded no cutlist, so ${e.playheadOutSec.toFixed(1)}s of the finished video is being used as-is.`};const n=t.toSource(e.playheadOutSec);return{atSec:n,note:`${e.playheadOutSec.toFixed(1)}s of the finished video is ${n.toFixed(1)}s of the original take.`}}function AD(e){return`That moment isn't in the rendered video yet — snapped to the nearest rendered moment, ${e.toFixed(2)}s. The mp4 genuinely lacks the frame until the next render; render once to take a cover from it, or read it off the original take by typing that take's own seconds.`}function ND(e){if(e.prevFrom===e.nextFrom)return null;const t=fk(e.atRaw);if(!t.ok||t.atSec===void 0)return null;const n=new $c(e.cutlist);if(n.spans.length===0)return{atRaw:e.atRaw,note:"Couldn't convert between clocks — this render recorded no cutlist; the seconds are unchanged."};if(e.nextFrom==="source"){const i=n.toSource(t.atSec);return{atRaw:i.toFixed(2),note:`${t.atSec.toFixed(1)}s of the finished video is ${i.toFixed(1)}s of the original take.`}}const r=n.toOutput(t.atSec);if(r!==null)return{atRaw:r.toFixed(2),note:`${t.atSec.toFixed(1)}s of the original take is ${r.toFixed(1)}s of the finished video.`};const o=n.toOutputClamped(t.atSec);return{atRaw:o.toFixed(2),note:`${t.atSec.toFixed(1)}s of the original take was cut from the finished video — snapped to the nearest kept moment, ${o.toFixed(1)}s.`}}const LD=({onClose:e,playheadSec:t})=>{const[n,r]=d.useState(null),[o,i]=d.useState(null),[s,a]=d.useState(""),[l,c]=d.useState(""),[f,p]=d.useState("final"),[m,g]=d.useState(null),[w,x]=d.useState(!1),[k,h]=d.useState(null),[y,v]=d.useState([]),[b,S]=d.useState([]),[E,C]=d.useState(null),[I,j]=d.useState(null);d.useEffect(()=>{const Y=A=>{A.key==="Escape"&&(A.stopPropagation(),e())};return window.addEventListener("keydown",Y,!0),()=>window.removeEventListener("keydown",Y,!0)},[e]),d.useEffect(()=>{(async()=>{try{const Y=await fetch("/api/cover"),A=await Y.json();if(!Y.ok)throw new Error(A.error??`GET /api/cover failed: ${Y.status}`);r(A),g(A.imageUrl),S(A.cutlist??[]),A.provenance&&(a(A.provenance.text),c0(A.provenance).enabled&&p(A.provenance.frame.source))}catch(Y){i(Y instanceof Error?Y.message:String(Y))}})()},[]);const F=fk(l),N=$D(s),K=c0((n==null?void 0:n.provenance)??null),M=async()=>{var Y;if(F.ok){x(!0),h(null),v([]);try{const A=await fetch("/api/cover/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d0({typed:s,persistedText:((Y=n==null?void 0:n.provenance)==null?void 0:Y.text)??null,atSec:F.atSec,from:f}))}),T=await A.json();if(!A.ok||T.ok!==!0){h(T.error??`regenerate failed: ${A.status}`);return}if(g(T.imageUrl??null),j(null),v(T.notes??[]),T.provenance){const W=T.provenance;r(B=>B&&{...B,provenance:W,status:"ready"}),a(W.text)}}catch(A){h(A instanceof Error?A.message:String(A))}finally{x(!1)}}},$=async()=>{var Y;if(F.ok){x(!0),h(null),v([]);try{const A=await fetch("/api/cover/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d0({typed:s,persistedText:((Y=n==null?void 0:n.provenance)==null?void 0:Y.text)??null,atSec:F.atSec,from:f}))}),T=await A.json();if(!A.ok||T.ok!==!0){h(T.error??`preview failed: ${A.status}`);return}j(T.previewImageUrl??null),v(T.notes??[])}catch(A){h(A instanceof Error?A.message:String(A))}finally{x(!1)}}},U=(n==null?void 0:n.status)==="unavailable";return u.jsx("div",{style:OD,onMouseDown:e,children:u.jsxs("div",{"data-testid":"cover-modal",style:DD,onMouseDown:Y=>Y.stopPropagation(),children:[u.jsxs("div",{style:zD,children:[u.jsx("div",{style:BD,children:"Cover image"}),u.jsx("button",{style:WD,onClick:e,"aria-label":"Close",children:"✕"})]}),o?u.jsxs("div",{"data-testid":"cover-load-error",style:Kd,children:["Couldn't load the cover state: ",o]}):n===null?u.jsx("div",{style:f0,children:"Loading…"}):U?u.jsx("div",{"data-testid":"cover-unavailable",style:{...f0,marginTop:12},children:PD(n.reason)}):u.jsxs(u.Fragment,{children:[u.jsx("div",{style:VD,children:I?u.jsx("img",{"data-testid":"cover-image",src:I,alt:"Cover preview",style:p0}):m?u.jsx("img",{"data-testid":"cover-image",src:m,alt:"Current cover",style:p0}):u.jsx("div",{"data-testid":"cover-placeholder",style:UD,children:"No cover on disk yet — set a headline and hit Apply."})}),I?u.jsx("div",{"data-testid":"cover-preview-badge",style:HD,children:"Preview — not saved. The cover on disk is unchanged; Apply writes it for real."}):null,u.jsxs("div",{style:{marginTop:16},children:[u.jsxs("label",{style:h0,children:["Headline — at most ",jS," words (§35)"]}),u.jsx("input",{"data-testid":"cover-text-input",type:"text",value:s,onChange:Y=>a(Y.target.value),style:m0}),N.trimmed?u.jsxs("div",{"data-testid":"cover-headline-preview",style:{...Io,marginTop:6},children:["Will render as: “",N.preview,"”"]}):null]}),u.jsxs("div",{style:{marginTop:16},children:[u.jsx("label",{style:h0,children:"Frame"}),u.jsxs("div",{style:g0,children:[u.jsx("button",{"data-testid":"cover-playhead-btn",style:$l,onClick:()=>{const Y=t(),A=_D({playheadOutSec:Y.sec,from:f,cutlist:b});c(A.atSec.toFixed(2)),C(Y.snapped?[AD(Y.sec),A.note].filter(T=>T!==null).join(" "):A.note)},disabled:w,children:"Use current playhead"}),u.jsx("input",{"data-testid":"cover-at-input",type:"text",inputMode:"decimal",placeholder:"seconds — blank keeps the current still",value:l,onChange:Y=>{c(Y.target.value),C(null)},style:{...m0,flex:1}})]}),F.ok?null:u.jsx("div",{"data-testid":"cover-at-error",style:Kd,children:F.message}),E?u.jsx("div",{"data-testid":"cover-clock-note",style:{...Io,marginTop:6},children:E}):null,u.jsx("div",{style:{...g0,marginTop:10},children:["final","source"].map(Y=>{const A=Y==="source"&&!K.enabled;return u.jsx("button",{"data-testid":`cover-from-${Y}`,style:{...$l,...f===Y?ZD:{},...A?{opacity:.5,cursor:"default"}:{}},onClick:()=>{const T=ND({atRaw:l,prevFrom:f,nextFrom:Y,cutlist:b});T!==null&&(c(T.atRaw),C(T.note)),p(Y)},disabled:w||A,"aria-pressed":f===Y,children:Y==="final"?"Finished video":"Original take"},Y)})}),u.jsx("div",{"data-testid":"cover-from-note",style:{...Io,marginTop:6},children:MD(f)}),K.note?u.jsx("div",{"data-testid":"cover-from-disabled-note",style:{...Io,marginTop:4},children:K.note}):null,u.jsx("div",{style:{...Io,marginTop:4},children:"Leave the seconds blank and the cover re-uses the still it already has — no frame extraction at all, and this choice does not apply."})]}),y.length>0?u.jsx("div",{"data-testid":"cover-notes",style:{...Io,marginTop:12},children:y.map(Y=>u.jsx("div",{children:Y},Y))}):null,k?u.jsx("div",{"data-testid":"cover-error",style:Kd,children:k}):null,u.jsxs("div",{style:KD,children:[u.jsx("div",{style:Io,children:n.outPath?`Writes ${n.outPath} — the video itself is untouched.`:"The video itself is untouched."}),u.jsxs("div",{style:{display:"flex",gap:8},children:[u.jsx("button",{"data-testid":"cover-cancel-btn",style:$l,onClick:e,children:"Cancel"}),u.jsx("button",{"data-testid":"cover-preview-btn",style:{...$l,...w||!F.ok?{opacity:.6,cursor:"default"}:{}},onClick:()=>void $(),disabled:w||!F.ok,children:"Preview"}),u.jsx("button",{"data-testid":"cover-apply-btn",style:{...YD,...w||!F.ok?{opacity:.6,cursor:"default"}:{}},onClick:()=>void M(),disabled:w||!F.ok,children:w?"Rebuilding…":"Apply"})]})]})]})]})})},OD={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},DD={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"},zD={display:"flex",justifyContent:"space-between",alignItems:"center"},BD={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},WD={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},f0={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},VD={marginTop:16,border:"1px solid #2C2C38",borderRadius:6,background:"#09090D",maxHeight:320,minHeight:180,display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},p0={maxWidth:"100%",maxHeight:320,objectFit:"contain"},HD={marginTop:8,padding:"6px 10px",borderRadius:6,border:"1px solid #8a6d1a",background:"rgba(255,196,0,0.08)",color:"#FFC400",fontSize:12,fontWeight:600,lineHeight:1.4},UD={color:"#8B8B9E",fontSize:13,padding:16,textAlign:"center"},h0={display:"block",fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.04em"},m0={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"},g0={display:"flex",alignItems:"center",gap:8},$l={background:"transparent",border:"1px solid #3A3A48",borderRadius:6,color:"#C9C9D4",padding:"9px 12px",fontSize:12,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap"},ZD={borderColor:"#5b8cff",color:"#EDEDF2"},Kd={marginTop:12,color:"#FF5C5C",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",whiteSpace:"pre-wrap"},KD={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,marginTop:20},Io={fontSize:12,color:"#8B8B9E",lineHeight:1.4,wordBreak:"break-all"},YD={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 GD(e){return e==="linkedin-page"?"linkedin":e}function XD(e){const t=[],n=new Map;for(const r of e){const o=GD(r.provider),i=n.get(o);i===void 0?(t.push(o),n.set(o,[r])):i.push(r)}return t.map(r=>{const o=n.get(r),i=o[0].caption;return{network:r,channels:o,caption:i,mixed:o.some(s=>s.caption!==i)}})}const qD={x:280,linkedin:1500,instagram:2200,tiktok:2200,facebook:2200,youtube:5e3};function JD(e){return qD[e]??1500}const QD='Publishing goes through your own self-hosted Postiz instance (postiz.com): set "postizUrl" in ~/.ossclip/config.json and OSSCLIP_POSTIZ_API_KEY in ~/.ossclip/.env, then restart the editor.',ez="No captions to post yet — run produce with --youtube (or approve a pack in the SEO panel) so publish has copy to send.",tz="No finished render to publish — render first.";function gp(e){const t=Math.round(e);return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function y0(e){if(e===null)return"Encoding & publishing…";if(e.phase==="uploading")return"Uploading…";const t=e.pct!==null?`${e.pct}%`:"…",n=e.etaSec!==null?` · ~${gp(e.etaSec)} left`:"";return`Encoding${e.file!=null?` ${e.file}`:""} ${t}${n}`}function nz(e,t){return typeof e!="number"||typeof t!="number"||e<=t?null:`video ${gp(e)} > ${gp(t)} cap`}function rz(e){return`⚠ ${e} word${e===1?"":"s"} not in the take`}function oz(e){if(e.trim().length===0)return null;const t=Date.parse(e);return Number.isNaN(t)?null:new Date(t).toISOString()}function v0(e){const t=n=>String(n).padStart(2,"0");return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}T${t(e.getHours())}:${t(e.getMinutes())}`}const iz=[{label:"In an hour",at:e=>v0(new Date(e.getTime()+36e5))},{label:"Tomorrow 9am",at:e=>{const t=new Date(e);return t.setDate(t.getDate()+1),t.setHours(9,0,0,0),v0(t)}}],sz=({onClose:e})=>{const[t,n]=d.useState(null),[r,o]=d.useState(null),[i,s]=d.useState({}),[a,l]=d.useState({}),[c,f]=d.useState(""),p=me.useRef(null),[m,g]=d.useState(!1),[w,x]=d.useState(null),[k,h]=d.useState(null),[y,v]=d.useState(null),[b,S]=d.useState({}),[E,C]=d.useState(null),[I,j]=d.useState({}),[F,N]=d.useState({}),[K,M]=d.useState(""),[$,U]=d.useState(null),[Y,A]=d.useState(!1),[T,W]=d.useState(null),[B,D]=d.useState(null);d.useEffect(()=>{const P=z=>{z.key==="Escape"&&(z.stopPropagation(),e())};return window.addEventListener("keydown",P,!0),()=>window.removeEventListener("keydown",P,!0)},[e]);const se=d.useCallback(async()=>{try{const P=await fetch("/api/publish"),z=await P.json();if(!P.ok)throw new Error(z.error??`GET /api/publish failed: ${P.status}`);n(z),z.integrations&&l(Object.fromEntries(z.integrations.map(Z=>[Z.id,Z.caption])))}catch(P){o(P instanceof Error?P.message:String(P))}},[]);d.useEffect(()=>{se()},[se]);const ie=Object.entries(i).filter(([,P])=>P).map(([P])=>P),L=Object.fromEntries(((t==null?void 0:t.integrations)??[]).map(P=>[P.id,P.durationCapSec??null])),V=XD(((t==null?void 0:t.integrations)??[]).map(P=>({...P,caption:a[P.id]??P.caption}))),ue=oz(c),oe=c.trim().length>0&&ue===null,J=((t==null?void 0:t.receipt)??null)!==null||y!==null,ae=async()=>{g(!0),h(null);const P=()=>{fetch("/api/publish/progress").then(Z=>Z.json()).then(Z=>x(Z.progress??null)).catch(()=>{})};P();const z=window.setInterval(P,1e3);try{const Z=await fetch("/api/publish",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({integrationIds:ie,...ue!==null?{at:ue}:{},captions:Object.fromEntries(ie.map(re=>[re,a[re]??""])),...J?{force:!0}:{}})}),O=await Z.json();if(!Z.ok||O.ok!==!0||!O.receipt){h(O.error??`publish failed: ${Z.status}`);return}v(O.receipt)}catch(Z){h(Z instanceof Error?Z.message:String(Z))}finally{window.clearInterval(z),x(null),g(!1)}},fe=async(P,z,Z,O)=>{j(re=>({...re,[P]:{}})),N(re=>({...re,[P]:!1}));try{const re=await fetch("/api/publish/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({network:P,instruction:O,currentCaption:Z})}),te=await re.json();if(!re.ok||te.ok!==!0||typeof te.caption!="string"){j(Ie=>({...Ie,[P]:{error:te.error??`regenerate failed: ${re.status}`}}));return}const Se=te.caption;l(Ie=>({...Ie,...Object.fromEntries(z.map(_e=>[_e,Se]))})),j(Ie=>({...Ie,[P]:{usage:te.usage,notes:te.notes??[]}}))}catch(re){j(te=>({...te,[P]:{error:re instanceof Error?re.message:String(re)}}))}},pe=async(P,z,Z)=>{const O=(b[P]??"").trim();if(O.length!==0){C(P);try{await fe(P,z,Z,O)}finally{C(null)}}},q=async()=>{const P=K.trim();if(P.length===0)return;const z=V.filter(Z=>Z.channels.some(O=>i[O.id]===!0));if(z.length!==0)try{for(let Z=0;Z<z.length;Z++){const O=z[Z],re=O.channels.map(Ie=>Ie.id),te=(b[O.network]??"").trim(),Se=te.length>0?te:P;U({network:O.network,index:Z+1,total:z.length}),C(O.network),await fe(O.network,re,a[re[0]]??O.caption,Se)}}finally{C(null),U(null)}},R=async()=>{A(!0),W(null);try{const P=await fetch("/api/youtube/generate",{method:"POST"}),z=await P.json();if(!P.ok||z.ok!==!0){W(z.error??`generate failed: ${P.status}`);return}D(z.usage??null),await se()}catch(P){W(P instanceof Error?P.message:String(P))}finally{A(!1)}},G=y??(t==null?void 0:t.receipt)??null;return u.jsx("div",{style:az,onMouseDown:e,children:u.jsxs("div",{"data-testid":"publish-modal",style:lz,onMouseDown:P=>P.stopPropagation(),children:[u.jsxs("div",{style:uz,children:[u.jsx("div",{style:cz,children:"Publish to social"}),u.jsx("button",{style:dz,onClick:e,"aria-label":"Close",children:"✕"})]}),r?u.jsxs("div",{"data-testid":"publish-load-error",style:Ml,children:["Couldn't load publish state: ",r]}):t===null?u.jsx("div",{style:Zt,children:"Loading…"}):t.configured?t.reachable===!1?u.jsxs("div",{"data-testid":"publish-unreachable",style:{...Zt,marginTop:12},children:["Postiz didn't answer: ",t.reason]}):t.packAvailable?t.outPathExists?y!==null?u.jsxs("div",{"data-testid":"publish-done",style:{...Zt,marginTop:12},children:[y.when.kind==="now"?`Published to ${y.targets.length} account(s).`:`Scheduled for ${y.when.iso} on ${y.targets.length} account(s).`,y.postIds.length>0?` Posts: ${y.postIds.join(", ")}.`:""," Track it in your Postiz launches view."]}):u.jsxs(u.Fragment,{children:[B!==null?u.jsx("div",{"data-testid":"publish-generate-usage",style:{...Zt,marginTop:8},children:B}):null,G!==null?u.jsxs("div",{"data-testid":"publish-receipt-note",style:{...Zt,marginTop:8},children:["This project already published on ",G.publishedAt," to"," ",G.targets.map(P=>P.provider).join(", ")," — publishing again will post it again."]}):null,u.jsxs("div",{style:{marginTop:16},children:[u.jsx("label",{style:w0,children:"Accounts"}),(t.integrations??[]).length===0?u.jsx("div",{style:Zt,children:"No accounts connected in Postiz yet — connect them there first."}):null,u.jsxs("div",{style:{display:"flex",gap:6,marginBottom:8},children:[u.jsx("input",{"data-testid":"publish-regen-all-instruction",placeholder:'One instruction for every selected network, e.g. "shorter, no hashtags"',value:K,onChange:P=>M(P.target.value),style:{...Yd,flex:1,padding:"6px 10px",fontSize:12}}),u.jsx("button",{type:"button","data-testid":"publish-regen-all",disabled:E!==null||$!==null||K.trim().length===0||ie.length===0,onClick:()=>void q(),style:ci,children:"Regenerate selected captions"})]}),$!==null?u.jsxs("div",{"data-testid":"publish-regen-all-progress",style:{...Zt,marginBottom:8},children:["Regenerating ",$.network,"… ",$.index,"/",$.total]}):null,V.map(P=>{var Se,Ie,_e;const z=P.channels.map(we=>we.id),Z=z.filter(we=>i[we]===!0),O=Z.length>0,re=JD(P.channels[0].provider),te=a[z[0]]??P.caption;return u.jsxs("div",{style:hz,children:[u.jsxs("div",{style:mz,children:[u.jsx("span",{style:gz,children:P.network}),u.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:P.channels.map(we=>{const ke=i[we.id]===!0,he=nz(t.durationSec,L[we.id]);return u.jsxs("button",{type:"button","data-testid":`publish-chip-${we.id}`,"aria-pressed":ke,disabled:he!==null,title:he??void 0,onClick:()=>s(Ne=>({...Ne,[we.id]:!ke})),style:{...ci,...ke?pz:{},...he!==null?fz:{}},children:[we.name,he!==null?` — ${he}`:""]},we.id)})})]}),O?u.jsxs(u.Fragment,{children:[P.mixed?u.jsx("div",{"data-testid":`publish-mixed-${P.network}`,style:{...Zt,marginBottom:6},children:"These channels had different captions — editing here sets one for every channel you pick in this group."}):null,u.jsx("textarea",{"data-testid":`publish-caption-${P.network}`,value:te,rows:4,onChange:we=>l(ke=>({...ke,...Object.fromEntries(z.map(he=>[he,we.target.value]))})),style:yz}),u.jsxs("div",{"data-testid":`publish-count-${P.network}`,style:{...wz,...te.length>re?{color:"#FF5C5C"}:{}},children:[te.length," / ",re,Z.length>1?` · posts to ${Z.length} channels`:""]}),u.jsxs("div",{style:{display:"flex",gap:6,marginTop:6},children:[u.jsx("input",{"data-testid":`publish-regen-instruction-${P.network}`,placeholder:'Fix the caption, e.g. "the 50 teams figure was an example, not a fact"',value:b[P.network]??"",onChange:we=>S(ke=>({...ke,[P.network]:we.target.value})),style:{...Yd,flex:1,padding:"6px 10px",fontSize:12}}),u.jsx("button",{type:"button","data-testid":`publish-regen-${P.network}`,disabled:E!==null||$!==null||(b[P.network]??"").trim().length===0,onClick:()=>void pe(P.network,z,te),style:ci,children:E===P.network?"Regenerating…":"Regenerate"})]}),((Se=I[P.network])==null?void 0:Se.error)!==void 0?u.jsx("div",{"data-testid":`publish-regen-error-${P.network}`,style:Ml,children:I[P.network].error}):null,((Ie=I[P.network])==null?void 0:Ie.usage)!==void 0?u.jsx("div",{"data-testid":`publish-regen-usage-${P.network}`,style:{...Zt,marginTop:4},children:I[P.network].usage}):null,(((_e=I[P.network])==null?void 0:_e.notes)??[]).length>0?u.jsxs(u.Fragment,{children:[u.jsxs("button",{type:"button","data-testid":`publish-regen-notes-toggle-${P.network}`,"aria-expanded":F[P.network]===!0,onClick:()=>N(we=>({...we,[P.network]:we[P.network]!==!0})),style:vz,children:[rz(I[P.network].notes.length)," ",F[P.network]===!0?"▾":"▸"]}),F[P.network]===!0?I[P.network].notes.map(we=>u.jsx("div",{"data-testid":`publish-regen-note-${P.network}`,style:{...Zt,marginTop:2,color:"#E5B300"},children:we},we)):null]}):null]}):null]},P.network)})]}),u.jsxs("div",{style:{marginTop:16},children:[u.jsx("label",{style:w0,children:"When"}),u.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[u.jsx("input",{ref:p,"data-testid":"publish-schedule",type:"datetime-local",value:c,onChange:P=>f(P.target.value),onClick:()=>{var P,z;try{(z=(P=p.current)==null?void 0:P.showPicker)==null||z.call(P)}catch{}},style:{...Yd,width:"auto",cursor:"pointer"}}),iz.map(P=>u.jsx("button",{type:"button","data-testid":`publish-when-${P.label.replace(/\s+/g,"-").toLowerCase()}`,onClick:()=>f(P.at(new Date)),style:ci,children:P.label},P.label)),c.trim().length>0?u.jsx("button",{type:"button","data-testid":"publish-when-clear",onClick:()=>f(""),style:ci,children:"Clear"}):null,u.jsx("span",{style:Zt,children:ue===null?"empty = publish now":`scheduled: ${ue}`})]})]}),k?u.jsx("div",{"data-testid":"publish-error",style:Ml,children:k}):null,m?u.jsx("div",{"data-testid":"publish-busy-note",style:{...Zt,marginTop:12},children:"Encoding the delivery file and uploading through Postiz — this can take a few minutes for a long video."}):null,m?u.jsx("div",{"data-testid":"publish-progress",style:{...Zt,marginTop:4},children:y0(w)}):null,u.jsxs("div",{style:xz,children:[u.jsx("div",{style:bz,children:"Sends through your Postiz instance, on your accounts — nothing goes anywhere until you press the button."}),u.jsx("button",{"data-testid":"publish-send",style:Sz,disabled:m||ie.length===0||oe,onClick:()=>void ae(),children:m?y0(w):J?"Publish again":ue!==null?"Schedule":"Publish now"})]})]}):u.jsx("div",{"data-testid":"publish-no-render",style:{...Zt,marginTop:12},children:tz}):u.jsxs("div",{"data-testid":"publish-no-pack",style:{...Zt,marginTop:12},children:[ez,u.jsx("div",{style:{marginTop:10},children:u.jsx("button",{type:"button","data-testid":"publish-generate-pack",disabled:Y,onClick:()=>void R(),style:ci,children:Y?"Generating captions… (one LLM call)":"Generate captions"})}),T!==null?u.jsx("div",{"data-testid":"publish-generate-error",style:Ml,children:T}):null]}):u.jsx("div",{"data-testid":"publish-unconfigured",style:{...Zt,marginTop:12},children:QD})]})})},az={position:"fixed",inset:0,background:"rgba(0,0,0,0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:60},lz={width:640,maxWidth:"calc(100vw - 48px)",maxHeight:"calc(100vh - 96px)",overflowY:"auto",background:"#121218",border:"1px solid #2C2C38",borderRadius:10,padding:24,boxShadow:"0 24px 80px rgba(0,0,0,0.55)"},uz={display:"flex",justifyContent:"space-between",alignItems:"center"},cz={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},dz={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},Zt={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},ci={background:"transparent",border:"1px solid #3a3a44",borderRadius:999,color:"#c9c9d4",cursor:"pointer",fontSize:12,padding:"4px 10px"},fz={opacity:.45,cursor:"not-allowed"},pz={background:"#5b8cff",borderColor:"#5b8cff",color:"#0b0b0f",fontWeight:700},w0={display:"block",fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.04em"},Yd={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"},hz={border:"1px solid #2C2C38",borderRadius:6,background:"#09090D",padding:"10px 14px",marginBottom:8},mz={display:"flex",gap:10,alignItems:"center",cursor:"pointer"},gz={fontSize:11,fontWeight:700,color:"#8B8B9E",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",textTransform:"uppercase",letterSpacing:"0.04em",minWidth:72},yz={width:"100%",boxSizing:"border-box",marginTop:8,background:"#121218",border:"1px solid #2C2C38",borderRadius:6,padding:"8px 12px",color:"#EDEDF2",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",outline:"none",resize:"vertical"},vz={background:"transparent",border:"none",padding:0,marginTop:4,cursor:"pointer",textAlign:"left",fontSize:12,color:"#E5B300",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace"},wz={marginTop:4,fontSize:12,color:"#8B8B9E",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace"},Ml={marginTop:12,color:"#FF5C5C",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",whiteSpace:"pre-wrap"},xz={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,marginTop:20},bz={fontSize:12,color:"#8B8B9E",lineHeight:1.4},Sz={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 _l(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 kz(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 x0(e,t){const n=Math.max(0,Math.floor((t-e)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function Ez(e,t){return e?{load:e,notifyDiscard:t}:{load:null,notifyDiscard:!1}}function Cz(e,t){return e===null||e===t}function Iz(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 Tz(e){if(e.dirty){if(e.renderRunning){e.onBlocked();return}e.save().catch(t=>e.onSaveError(t instanceof Error?t.message:String(t)))}}function jz(e,t,n=r=>r){const{cues:r}=Xl(e,t);return Pu(r,qh(t.splits)).filter(i=>{var s;return((s=t.scenes[i.id])==null?void 0:s.hidden)===!0}).map(i=>({...i,startSec:n(i.startSec),endSec:n(i.endSec)}))}const b0=e=>e,S0=e=>({...e,...jN(e)}),k0=e=>{const t=JS(e);e.forEach((n,r)=>{console.warn(`ossclip §137: dropped caption edit ${JSON.stringify(n)} — ${t[r]}`)})},Rz=()=>{const e=TN(),t=d.useRef(e.dirty);t.current=e.dirty;const[n,r]=d.useState(!1),[o,i]=d.useState(!1),[s,a]=d.useState(null),[l,c]=d.useState(null),[f,p]=d.useState([]),[m,g]=d.useState([]),w=d.useRef(e.doc.captions);w.current=e.doc.captions;const[x,k]=d.useState(null),[h,y]=d.useState(null),[v,b]=d.useState(null),[S,E]=d.useState([]),[C,I]=d.useState(null),[j,F]=d.useState({sfx:null,words:null}),[N,K]=d.useState([]),[M,$]=d.useState(null),U=d.useRef(!1),Y=d.useCallback((X,ee)=>{U.current||(U.current=!0,(async()=>{try{const le=await fetch("/api/retranscribe-range",{method:"POST",body:JSON.stringify({srcIn:X,srcOut:ee})}),Re=await le.json();if(!Re.ok){console.warn(`re-transcribe failed: ${Re.error??le.status}`);return}for(const Gn of Re.reports??[])console.warn(`re-transcribe: ${Gn}`);e.rekeyCaptionKeys(Re.mapping??[]);const An=(await(await fetch("/api/transcript")).json()).transcript;An&&Array.isArray(An.words)&&I({language:typeof An.language=="string"?An.language:"en",words:An.words})}catch(le){console.warn(`re-transcribe failed: ${le instanceof Error?le.message:String(le)}`)}finally{U.current=!1}})())},[e]),[A,T]=d.useState(null),[W,B]=d.useState(null),D=d.useCallback(X=>{B(X),$(null)},[]),se=d.useCallback(X=>{$(X),X!==null&&B(null)},[]),[ie,L]=d.useState(!1),[V,ue]=d.useState(1),[oe,J]=d.useState(null),[ae,fe]=d.useState(!1),[pe,q]=d.useState([]),[R,G]=d.useState(null),P=d.useRef(null),[z,Z]=d.useState(!1),[O,re]=d.useState(null),[te,Se]=d.useState(!1),[Ie,_e]=d.useState(),we=d.useRef(null);d.useEffect(()=>()=>{we.current!==null&&window.clearInterval(we.current)},[]);const[ke,he]=d.useState(null),Ne=d.useRef(null),Te=d.useRef(null),Ue=d.useRef(null),Je=d.useRef(null),[Pt,mt]=d.useState(null),[Le,Qe]=d.useState(null),Fn=d.useCallback(X=>{var Re;if(Ue.current=X,Qe(X),(Re=Je.current)==null||Re.disconnect(),Je.current=null,!X)return;const ee=()=>mt({w:Math.max(0,X.clientWidth-Xd*2),h:Math.max(0,X.clientHeight-Xd*2)});ee();const le=new ResizeObserver(ee);le.observe(X),Je.current=le},[]),[Ye,Pn]=d.useState(1),cn=d.useRef(Ye);cn.current=Ye;const Jt=d.useRef(null),$n=d.useCallback((X,ee)=>{const le=Ue.current,Re=Math.min(8,Math.max(.25,X)),We=cn.current;if(le&&Re!==We){const wt=le.getBoundingClientRect();Jt.current={prev:We,ax:((ee==null?void 0:ee.x)??wt.left+wt.width/2)-wt.left,ay:((ee==null?void 0:ee.y)??wt.top+wt.height/2)-wt.top,sl:le.scrollLeft,st:le.scrollTop}}Pn(Re)},[]);d.useLayoutEffect(()=>{const X=Ue.current,ee=Jt.current;if(!X||!ee)return;Jt.current=null;const le=Ye/ee.prev;X.scrollLeft=(ee.sl+ee.ax)*le-ee.ax,X.scrollTop=(ee.st+ee.ay)*le-ee.ay},[Ye]),d.useEffect(()=>{const X=Le;if(!X)return;const ee=le=>{(le.ctrlKey||le.metaKey)&&(le.preventDefault(),$n(cn.current*Math.exp(-le.deltaY*.01),{x:le.clientX,y:le.clientY}))};return X.addEventListener("wheel",ee,{passive:!1}),()=>X.removeEventListener("wheel",ee)},[Le,$n]);const Mn=d.useRef(null);d.useEffect(()=>{const X=le=>{const Re=Mn.current,We=Ue.current;!Re||!We||(We.scrollLeft=Re.sl-(le.clientX-Re.x),We.scrollTop=Re.st-(le.clientY-Re.y))},ee=()=>{Mn.current=null};return window.addEventListener("mousemove",X),window.addEventListener("mouseup",ee),()=>{window.removeEventListener("mousemove",X),window.removeEventListener("mouseup",ee)}},[]);const[sr,gt]=d.useState(!1),[Qt,dn]=d.useState(()=>{const X=Number(window.localStorage.getItem(C0));return Number.isFinite(X)&&X>0?I0(X):300}),Lt=d.useRef(null);d.useEffect(()=>{const X=le=>{const Re=Lt.current;Re&&dn(I0(Re.startW+(le.clientX-Re.startX)))},ee=()=>{Lt.current&&(Lt.current=null,dn(le=>(window.localStorage.setItem(C0,String(le)),le)))};return window.addEventListener("mousemove",X),window.addEventListener("mouseup",ee),()=>{window.removeEventListener("mousemove",X),window.removeEventListener("mouseup",ee)}},[]);const[Kn,it]=d.useState(!1),[_n,Lr]=d.useState(!1),[ar,ko]=d.useState(!1),[Or,Dr]=d.useState(!1),[Qo,_]=d.useState(!1),[H,ne]=d.useState(!1),[ge,Ee]=d.useState(!1);d.useEffect(()=>{if(!Or)return;const X=ee=>{ee.key==="Escape"&&(ee.stopPropagation(),Dr(!1))};return window.addEventListener("keydown",X,!0),()=>window.removeEventListener("keydown",X,!0)},[Or]);const[je,Fe]=d.useState(null),[Pe,ze]=d.useState(null),[Wt,en]=d.useState(!0),Vt=d.useCallback(X=>{const ee=hP({rate:V,playing:ie},X);ue(ee.rate);const le=Te.current;le&&(ee.playing&&!ie&&le.play(),!ee.playing&&ie&&le.pause())},[V,ie]);d.useEffect(()=>{const X=Te.current;if(!X)return;const ee=()=>L(!0),le=()=>L(!1);return X.addEventListener("play",ee),X.addEventListener("pause",le),()=>{X.removeEventListener("play",ee),X.removeEventListener("pause",le)}});const Yn=d.useCallback(()=>{if(we.current!==null)return;const X=window.setInterval(()=>{(async()=>{try{const le=await(await fetch("/api/render/status")).json();if(le.running||le.exitCode===null){re(Re=>({running:le.running,lines:le.lines??[],startedAt:le.startedAt??(Re==null?void 0:Re.startedAt)}));return}if(we.current!==null&&(window.clearInterval(we.current),we.current=null),le.exitCode===0){const We=await(await fetch("/api/production")).json(),wt=S0(We.renderProps);y(wt),Z(!!We.canRender);const An=Ez(We.overrides,t.current);if(An.load){const Gn=w.current,ur=fv(An.load,wt);e.load(ur.doc),k0(ur.unresolved),p(ur.unresolved);const St=FN(RN(Gn,ur.doc.captions));for(const ds of St)console.warn(`ossclip §137: ${ds}`);g(St)}else p([]),g([]);An.notifyDiscard&&r(!0),re(Gn=>({running:!1,lines:le.lines??[],succeeded:!0,startedAt:le.startedAt??(Gn==null?void 0:Gn.startedAt),finishedAt:Date.now()})),fetch("/api/reveal-output",{method:"POST"}).catch(()=>{})}else re({running:!1,lines:le.lines??[],failed:le.exitCode,cancelled:le.cancelled})}catch{we.current===null&&Yn()}})()},1e3);we.current=X},[]),as=d.useCallback(async()=>{const X=await fetch("/api/production");if(!X.ok)throw new Error(`GET /api/production failed: ${X.status}`);const ee=await X.json();if(ee.defaultOutPath&&_e(ee.defaultOutPath),q(ee.recent??[]),ee.noWorkdir){p([]),g([]),fe(!0);return}const le=S0(ee.renderProps);y(le);const Re=P.current,We=ee.workdir??null;P.current=We,G(We),Z(!!ee.canRender);const wt=fv(ee.overrides,le);e.load(wt.doc),k0(wt.unresolved),p(wt.unresolved),g([]),fetch("/api/usage").then(async St=>b(St.ok?await St.json():null)).catch(()=>b(null)),fetch("/api/cleanup").then(async St=>E(St.ok?(await St.json()).cutlist??[]:[])).catch(()=>E([])),fetch("/api/transcript").then(async St=>{const br=(St.ok?await St.json():{transcript:null}).transcript;I(br&&Array.isArray(br.words)?{language:typeof br.language=="string"?br.language:"en",words:br.words}:null)}).catch(()=>I(null)),fetch("/api/sfx/plan").then(async St=>F(St.ok?await St.json():{sfx:null,words:null})).catch(()=>F({sfx:null,words:null})),fetch("/api/sfx/library").then(async St=>K(St.ok?(await St.json()).sounds??[]:[])).catch(()=>K([])),$(null);const Gn=await(await fetch("/api/render/status")).json(),ur=Cz(Re,We)?Iz(Gn):null;ur&&(re(ur),ur.running?Yn():en(!1))},[Yn]);d.useEffect(()=>{as().catch(X=>T(X instanceof Error?X.message:String(X)))},[]);const sm=d.useCallback(async X=>{if(e.dirty&&!window.confirm("Unsaved edits will be lost — switch projects anyway?"))return null;try{const ee=await fetch("/api/workdir",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:X})}),le=await ee.json().catch(()=>({}));return ee.ok?(B(null),J(null),he(null),re(null),Pn(1),y(null),fe(!1),await as(),null):le.error??`open failed: ${ee.status}`}catch(ee){return ee instanceof Error?ee.message:String(ee)}},[e.dirty,as]),za=d.useMemo(()=>{if(!h)return{lines:[],dropped:[]};const X=h.baseCaptionLines??h.captionLines??[];return wS(X,qS(e.doc.captions))},[h,e.doc.captions]),ls=d.useMemo(()=>h?xS(za.lines,e.doc.captionRangeEdits):{lines:[],dropped:[]},[h,za,e.doc.captionRangeEdits]),us=d.useMemo(()=>h?bS(ls.lines,e.doc.captionWordsHidden):{lines:[],dropped:[]},[h,ls,e.doc.captionWordsHidden]),Ba=d.useMemo(()=>h?kS(us.lines,e.doc.captionLineTiming):{lines:[],dropped:[]},[h,us,e.doc.captionLineTiming]),Wa=d.useMemo(()=>h?AN(Ba.lines,e.doc.captionLineWindows,h.spans??[]):{lines:[],dropped:[]},[h,Ba,e.doc.captionLineWindows]),am=d.useMemo(()=>JS(f),[f]),tn=d.useMemo(()=>h?C4(S,e.doc.cleanup,e.doc.cuts,h.spans??[]):null,[h,S,e.doc.cleanup,e.doc.cuts]),st=d.useMemo(()=>{let X;try{const ee=(h==null?void 0:h.spans)??[];if(ee.length>0){const le=to(ee);X=Re=>le.toSource(Re)}}catch{X=void 0}return I4(tn,{identityToSource:X})},[tn,h]),nn=d.useMemo(()=>{if(!h)return null;const X=()=>{try{const xt=h.spans??[];return xt.length>0?to(xt):null}catch{return null}},ee=(h.baseSceneCues??h.sceneCues??[]).filter(xt=>xt.kind!=="plain"),le=h.baseTheme??h.theme??pA,Re=X(),We=Re?qy(e.doc,Re).doc:e.doc,{cues:wt}=Xl(ee,We),{cues:An}=ZA(wt,e.doc),Gn=s4(An,{outputDurationSec:h.outputDurationSec,clipStarts:(h.spans??[]).map(xt=>xt.outIn)}),ur=Pu(Gn,qh(e.doc.splits)),{cues:St}=Xl(ur,We),{cues:ds}=vS(St,e.doc);let br=oe?ds.map(xt=>xt.id===oe.sceneId?{...xt,video:{...xt.video,...oe.patch}}:xt):ds;ke&&(br=br.map(xt=>xt.id===ke.sceneId?{...xt,graphicRect:ke.rect}:xt));const Bc={...h,sceneCues:br,captionLines:Wa.lines,theme:QA(le,e.doc),captionsHidden:h.captionsHiddenByFlag===!0||e.doc.captionsHidden===!0,videoFileName:`/media/${h.videoFileName}`,...h.coverInVideo?{coverInVideo:{...h.coverInVideo,fileName:`/media/${h.coverInVideo.fileName}`}}:{}},dm=(xt,fm,fs)=>{var xm,bm;const Sk=Qh(S,e.doc.cleanup).map(xn=>({srcIn:xn.srcIn,srcOut:xn.srcOut})),kk=em(S,e.doc.cleanup).map(xn=>({srcIn:xn.srcIn,srcOut:xn.srcOut,dismissed:!0})),pm=e.doc.splits.filter(xn=>xn.at===void 0&&xn.src!==void 0),Wc=[...Sk,...kk],hm=C!==null&&(Wc.length>0||tn!==null);if(fs===null||Wc.length===0&&pm.length===0&&!hm)return{props:xt,reports:fm};const mm=S4(xt.sceneCues??[],Wc,fs),gm=NA(pm,fs),Ek=Pu(mm.cues,gm.points),ym=qy(e.doc,fs),{cues:vm}=Xl(Ek,ym.doc);let wm=xt.captionLines,Vc;return hm&&C!==null&&(Vc=NN(C,fs,e.doc,{breakpoints:vm.filter(xn=>xn.kind!=="plain").flatMap(xn=>[xn.startSec,xn.endSec]),landscape:(((xm=h.settings)==null?void 0:xm.width)??1080)>(((bm=h.settings)==null?void 0:bm.height)??1920)}),wm=Vc.lines),{props:{...xt,sceneCues:vm,captionLines:wm},reports:[...fm,...mm.reports,...gm.reports,...ym.reports],transcript:Vc}};if(!tn)return dm(Bc,[],Re);const{fields:xk,reports:bk}=T4(Bc,tn.oldMap,tn.newMap);return dm({...Bc,...xk},bk,tn.newMap)},[h,e.doc,oe,ke,Wa,tn,S,C]),$e=nn===null?null:nn.props,lr=nn==null?void 0:nn.transcript,cs=d.useMemo(()=>{var ee;const X=[...PN(za.dropped),...MN(ls.dropped),...$N(us.dropped),...Ad(Ba.dropped),...Ad(Wa.dropped)];for(const le of Ad(((ee=nn==null?void 0:nn.transcript)==null?void 0:ee.dropped)??[]))X.includes(le)||X.push(le);return X},[za,ls,us,Ba,Wa,nn]),Va=d.useMemo(()=>{const X=j.words;if(X===null||X.length===0)return[];let ee=(tn==null?void 0:tn.newMap)??null;if(ee===null)try{const le=(h==null?void 0:h.spans)??[];ee=le.length>0?to(le):null}catch{ee=null}return LN(X,ee)},[j,tn,h]),lm=d.useMemo(()=>a4(($e==null?void 0:$e.sceneCues)??[]),[$e]),Ac=d.useMemo(()=>ON(j.sfx,e.doc.sfx,Va,lm),[j.sfx,e.doc.sfx,Va,lm]),pk=d.useMemo(()=>Ac.find(X=>X.key===M)??null,[Ac,M]),Nc=cs.join(`
|
|
165
|
-
`),hk=cs.length>0&&Nc!==x;d.useEffect(()=>{if(cs.length!==0)for(const X of cs)console.warn(`ossclip §137: ${X}`)},[Nc]);const Lc=$e==null?void 0:$e.sceneCues;d.useEffect(()=>{Lc&&e.syncCues(Lc)},[Lc]);const mk=((nn==null?void 0:nn.reports)??[]).join(`
|
|
166
|
-
`);d.useEffect(()=>{if(!(!nn||nn.reports.length===0))for(const X of nn.reports)console.warn(`ossclip cut preview: ${X}`)},[mk]);const Oc=d.useRef(null);d.useEffect(()=>{if(!h){Oc.current=null;return}const X=tn?tn.newMap:to(h.spans??[]),ee=Oc.current;if(Oc.current={props:h,map:X},!ee||ee.props!==h||IS(ee.map,X,1e-6))return;const le=Te.current;if(!le)return;const Re=h.settings.fps,We=ee.map.toSource(le.getCurrentFrame()/Re),wt=X.toOutput(We)??X.toOutputClamped(We);le.seekTo(Math.round(wt*Re))},[tn,h]);const um=()=>{Tz({dirty:e.dirty,renderRunning:(O==null?void 0:O.running)===!0,save:e.save,onBlocked:()=>i(!0),onSaveError:X=>T(X)})},cm=d.useCallback(async(X,ee)=>{try{e.dirty&&await e.save();const le=await fetch("/api/render",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...X?{out:X}:{},...ee===!0?{replan:!0}:{}})});if(!le.ok){const Re=await le.json().catch(()=>({}));throw new Error(Re.error??`render failed to start: ${le.status}`)}re({running:!0,lines:[],startedAt:Date.now()}),en(!0),a(null),Yn()}catch(le){a(le instanceof Error?le.message:String(le))}},[e,Yn]),Dc=d.useMemo(()=>{if(!h)return[];const X=(h.baseSceneCues??h.sceneCues??[]).filter(ee=>ee.kind!=="plain");return jz(X,e.doc,st.toLive)},[h,e.doc,st]),zr=d.useMemo(()=>W?($e==null?void 0:$e.sceneCues.find(X=>X.id===W.sceneId))??Dc.find(X=>X.id===W.sceneId)??null:null,[$e,W,Dc]),gk=d.useMemo(()=>{if(!zr||!$e)return;const X=$e.captionLines.filter(le=>le.start<zr.endSec&&le.end>zr.startSec).flatMap(le=>le.words).filter(le=>le.start<zr.endSec&&le.end>zr.startSec).map(le=>le.text);if(X.length===0)return;const ee=X.join(" ");return ee.length>90?`${ee.slice(0,90)}…`:ee},[zr,$e]);if(A)return u.jsx("div",{style:Gd,children:u.jsxs("div",{style:{padding:24,color:"#FF5C5C",fontFamily:"ui-monospace, monospace"},children:["Couldn't load the production: ",A]})});if(!$e)return u.jsx("div",{style:Gd,children:ae?u.jsx(Kv,{recent:pe,required:!0,onOpen:sm,onClose:()=>{}}):u.jsx("div",{style:{padding:24,color:"#9A9AA3"},children:"Loading production…"})});const yk=$e.settings.width/$e.settings.height,vk=Pt?Math.max(220,Math.min(Pt.w,Pt.h*yk)):380,wk=Math.round(vk*Ye),zc=u.jsx("button",{"data-testid":"render-logs-toggle",style:{...at,padding:"2px 8px"},onClick:()=>en(X=>!X),title:Wt?"Collapse the log":"Expand the log",children:Wt?"▾ logs":"▸ logs"});return u.jsxs("div",{style:Gd,children:[u.jsxs("div",{style:Mz,children:[u.jsx("span",{style:_z,children:"ossclip"}),R?u.jsx("span",{"data-testid":"workdir-label",style:Az,title:R,children:R.split("/").filter(Boolean).slice(-2).join("/")}):null,u.jsxs("div",{style:{display:"flex",gap:8},children:[u.jsx("button",{"data-testid":"open-button",style:at,onClick:()=>fe(!0),title:R?`Open another project — currently ${R}`:"Open another project",children:"Open"}),u.jsx("button",{"data-testid":"undo-button",style:at,onClick:()=>e.undo(),disabled:!e.canUndo,title:"Undo (⌘Z)","aria-label":"Undo",children:u.jsx(Pz,{})}),u.jsx("button",{"data-testid":"redo-button",style:at,onClick:()=>e.redo(),disabled:!e.canRedo,title:"Redo (⌘⇧Z)","aria-label":"Redo",children:u.jsx($z,{})}),u.jsx("button",{"data-testid":"transcript-toggle",style:{...at,...sr?{borderColor:"#5b8cff"}:{}},onClick:()=>gt(X=>!X),title:"Find and retype caption words across the whole transcript",children:"Transcript"}),u.jsx("button",{"data-testid":"cover-button",style:{...at,...Qo?{borderColor:"#5b8cff"}:{}},onClick:()=>_(!0),title:"Retype the cover headline or re-cut its frame — seconds, no re-render",children:"Cover"}),u.jsx("button",{"data-testid":"cleanup-button",style:{...at,...ge?{borderColor:"#5b8cff"}:{}},onClick:()=>Ee(!0),title:"Review what produce removed — keep whole categories; the preview plays your choices immediately",children:"Cleanup"}),u.jsxs("div",{style:{position:"relative"},children:[u.jsx("button",{"data-testid":"youtube-menu",style:{...at,...Or||_n||ar?{borderColor:"#5b8cff"}:{}},onClick:()=>Dr(X=>!X),title:"AI thumbnail and SEO metadata for the YouTube upload","aria-haspopup":"menu","aria-expanded":Or,children:"YouTube ▾"}),Or?u.jsxs(u.Fragment,{children:[u.jsx("div",{style:Oz,onMouseDown:()=>Dr(!1)}),u.jsxs("div",{style:Dz,role:"menu",children:[u.jsx("button",{"data-testid":"youtube-menu-thumbnail",style:E0,role:"menuitem",onClick:()=>{Dr(!1),Lr(!0)},children:"Thumbnail"}),u.jsx("button",{"data-testid":"youtube-menu-seo",style:E0,role:"menuitem",onClick:()=>{Dr(!1),ko(!0)},children:"SEO metadata"})]})]}):null]}),u.jsx("button",{"data-testid":"publish-button",style:{...at,...H?{borderColor:"#5b8cff"}:{}},onClick:()=>ne(!0),title:"Push the finished render to your social accounts via your Postiz instance",children:"Publish"}),u.jsx("button",{style:{...at,...e.dirty?Lz:{}},onClick:um,disabled:!e.dirty||(O==null?void 0:O.running)===!0,title:(O==null?void 0:O.running)===!0?"Can't save while a render is running":void 0,children:"Save"}),u.jsxs("div",{style:{display:"inline-flex",alignItems:"center"},children:[u.jsx("button",{"data-testid":"render-button",style:{...at,borderTopRightRadius:0,borderBottomRightRadius:0,borderRight:"none"},onClick:()=>void cm(),disabled:!z||(O==null?void 0:O.running)===!0,title:z?"Saves if needed, then replays the last completed produce command — pipeline flags come from that run; your saved edits apply on top":"No command.json in this workdir — run `ossclip produce` once in a terminal; it records the invocation and Render replays it",children:O!=null&&O.running?"Rendering…":"Render"}),u.jsx("button",{"data-testid":"render-destination-button",style:{...at,borderTopLeftRadius:0,borderBottomLeftRadius:0,padding:"7px 8px"},onClick:()=>Se(!0),disabled:!z||(O==null?void 0:O.running)===!0,title:"Choose export file destination (Browse…)",children:"▾"})]})]}),u.jsx("span",{style:{...Nz,color:e.dirty?"#FFE14D":"#5FBF77"},...e.dirty?{"data-testid":"dirty"}:{},children:e.dirty?"● Unsaved changes":"✓ Saved"}),u.jsx("button",{"data-testid":"shortcuts-button",style:{...at,padding:"7px 10px"},onClick:()=>it(X=>!X),title:"Keyboard shortcuts (?)",children:"?"})]}),Kn?u.jsx(E5,{onClose:()=>it(!1)}):null,_n?u.jsx(VO,{onClose:()=>Lr(!1)}):null,ge?u.jsx(rD,{cutlist:S,edits:e,onClose:()=>Ee(!1)}):null,ar?u.jsx(wD,{onClose:()=>ko(!1)}):null,H?u.jsx(sz,{onClose:()=>ne(!1)}):null,Qo?u.jsx(LD,{onClose:()=>_(!1),playheadSec:()=>{var ee;const X=(((ee=Te.current)==null?void 0:ee.getCurrentFrame())??0)/$e.settings.fps;return{sec:st.fromLive(X),snapped:!st.hasOldClockPreimage(X)}}}):null,te?u.jsx(IO,{defaultOutPath:Ie,onCancel:()=>Se(!1),onConfirm:(X,ee)=>{Se(!1),cm(X,ee)}}):null,je?u.jsx(A5,{plan:je,onCancel:()=>Fe(null),onConfirm:X=>{if(X==="graphic")e.hideScene(je.sceneId);else{const ee=RS(st,je.startSec,je.endSec);if(st.toSourceSec!==null){const le=st.toSourceSec,Re={startSec:Math.round(le(je.startSec)*1e3)/1e3,endSec:Math.round(le(je.endSec)*1e3)/1e3},We=ee.kind==="degenerate"?{startSec:st.fromLive(je.startSec),endSec:st.fromLive(je.endSec)}:{startSec:ee.startSec,endSec:ee.endSec};e.cutChunk(We.startSec,We.endSec,Re)}else ee.kind==="degenerate"?c("Can't cut this window: it isn't in the last render yet — render once (or re-remove the pause) to cut it."):(ee.kind==="shrunk"&&console.warn(`ossclip cut preview: ${ee.report}`),e.cutChunk(ee.startSec,ee.endSec))}Fe(null)}}):null,Pe?u.jsx(G5,{plan:Pe,onCancel:()=>ze(null),onConfirm:X=>{if(X==="caption")e.hideCaptionWords(Pe.words);else{const ee=lr?st.toSourceSec:st.oldToSourceSec,le=wt=>Math.round(wt*1e3)/1e3,Re=ee===null?void 0:{startSec:le(ee(Pe.startSec)),endSec:le(ee(Pe.endSec))},We=lr?{startSec:le(st.fromLive(Pe.startSec)),endSec:le(st.fromLive(Pe.endSec))}:{startSec:Pe.startSec,endSec:Pe.endSec};e.cutWords(Pe.words,We.startSec,We.endSec,Re)}ze(null)}}):null,ae?u.jsx(Kv,{recent:pe,required:!1,onOpen:sm,onClose:()=>fe(!1)}):null,O?u.jsxs("div",{"data-testid":"render-log",style:{...Yz,borderColor:O.failed!==void 0?"#FF5C5C":"#2A2A33"},children:[O.failed!==void 0?u.jsxs("div",{style:{color:O.cancelled?"#9A9AA3":"#FF5C5C",marginBottom:4},"data-testid":O.cancelled?"render-cancelled":"render-failed",children:[O.cancelled?"render cancelled":`render failed (exit ${O.failed})`,u.jsx("button",{style:{...at,marginLeft:10,padding:"2px 8px"},onClick:()=>re(null),children:"Dismiss"}),u.jsx("span",{style:{marginLeft:6},children:zc})]}):null,O.succeeded?u.jsxs("div",{"data-testid":"render-succeeded",style:T0,children:[u.jsxs("span",{style:{color:"#5FBF77"},children:["✓ done",O.startedAt!=null&&O.finishedAt!==void 0?` · ${x0(O.startedAt,O.finishedAt)}`:""]}),u.jsx("button",{"data-testid":"render-open-folder",style:{...at,padding:"2px 8px"},onClick:()=>void fetch("/api/reveal-output",{method:"POST"}).catch(()=>{}),title:"Reveal the rendered file in your file manager",children:"Open folder"}),u.jsx("button",{style:{...at,padding:"2px 8px"},onClick:()=>re(null),children:"Dismiss"}),zc]}):null,O.running?u.jsxs("div",{"data-testid":"render-status",style:T0,children:[u.jsx("style",{children:"@keyframes ossclip-spin { to { transform: rotate(360deg) } }"}),u.jsx("span",{style:Gz,"aria-hidden":!0}),u.jsxs("span",{style:{color:"#EDEDF2"},children:["rendering",O.startedAt!=null?` · ${x0(O.startedAt,Date.now())}`:"",_l(O.lines)!==null?` · ${_l(O.lines)}%`:""]}),_l(O.lines)!==null?u.jsx("div",{style:Xz,children:u.jsx("div",{"data-testid":"render-progress-bar",style:{...qz,width:`${_l(O.lines)}%`}})}):null,u.jsx("button",{"data-testid":"render-cancel",style:{...at,padding:"2px 8px"},onClick:()=>void fetch("/api/render/cancel",{method:"POST"}),children:"Cancel"}),zc]}):null,Wt?u.jsxs(u.Fragment,{children:[kz(O.lines).map(X=>u.jsx("div",{"data-testid":"render-pinned",style:{color:"#C9C9D4"},children:X},X)),u.jsx(Fz,{lines:O.lines})]}):null]}):null,n?u.jsxs("div",{"data-testid":"reanchor-notice",style:di,children:["Render re-anchored your saved cuts and splits — edits made while it ran were dropped, not merged, to avoid overwriting that anchor.",u.jsx("button",{style:{...at,marginLeft:10,padding:"2px 8px"},onClick:()=>r(!1),children:"Dismiss"})]}):null,am.length>0||m.length>0?u.jsxs("div",{"data-testid":"caption-migration-notice",style:di,children:[[...am,...m].map((X,ee)=>u.jsx("div",{children:X},ee)),u.jsx("button",{style:{...at,marginLeft:10,padding:"2px 8px"},onClick:()=>{p([]),g([])},children:"Dismiss"})]}):null,hk?u.jsxs("div",{"data-testid":"caption-dropped-notice",style:di,children:[cs.map((X,ee)=>u.jsx("div",{children:X},ee)),u.jsx("button",{style:{...at,marginLeft:10,padding:"2px 8px"},onClick:()=>k(Nc),children:"Dismiss"})]}):null,o?u.jsxs("div",{"data-testid":"save-blocked-notice",style:di,children:["Can't save while a render is running — it's writing its own overrides.json right now. Wait for it to finish (or cancel it) before saving.",u.jsx("button",{style:{...at,marginLeft:10,padding:"2px 8px"},onClick:()=>i(!1),children:"Dismiss"})]}):null,s!==null?u.jsxs("div",{"data-testid":"render-refused-notice",style:di,children:["Render didn't start: ",s,u.jsx("button",{style:{...at,marginLeft:10,padding:"2px 8px"},onClick:()=>a(null),children:"Dismiss"})]}):null,l!==null?u.jsxs("div",{"data-testid":"clock-refused-notice",style:di,children:[l,u.jsx("button",{style:{...at,marginLeft:10,padding:"2px 8px"},onClick:()=>c(null),children:"Dismiss"})]}):null,u.jsxs("div",{style:zz,children:[sr?u.jsxs(u.Fragment,{children:[u.jsx(qL,{baseLines:lr?lr.baseLines:(h==null?void 0:h.baseCaptionLines)??(h==null?void 0:h.captionLines)??[],liveLines:lr?lr.liveLines:ls.lines,timingLines:lr?lr.timingLines:us.lines,fps:$e.settings.fps,playerRef:Te,edits:e,onDeleteWords:ze,width:Qt,workdir:R,toPlayerSec:lr?b0:st.toLive,fromPlayerSec:lr?b0:st.fromLive}),u.jsx("div",{"data-testid":"transcript-divider",style:Bz,title:"Drag to resize the transcript pane",onMouseDown:X=>{X.preventDefault(),Lt.current={startX:X.clientX,startW:Qt}}})]}):null,u.jsxs("div",{style:Wz,children:[u.jsx("div",{ref:Fn,style:Vz,onMouseDown:X=>{if(X.altKey||X.button===1){X.preventDefault();const ee=Ue.current;ee&&(Mn.current={x:X.clientX,y:X.clientY,sl:ee.scrollLeft,st:ee.scrollTop})}},children:u.jsx("div",{style:{margin:"auto",padding:Xd},children:u.jsxs("div",{ref:Ne,"data-testid":"stage","data-playing":ie?"true":"false","data-rate":V,style:{position:"relative",display:"inline-block"},children:[u.jsx(aP,{ref:Te,component:SN,inputProps:$e,durationInFrames:Math.max(1,Math.round($e.outputDurationSec*$e.settings.fps)),fps:$e.settings.fps,compositionWidth:$e.settings.width,compositionHeight:$e.settings.height,style:{width:wk},controls:!0,clickToPlay:!1,playbackRate:V}),u.jsx(ZN,{stageRef:Ne,selection:W,onSelect:D,edits:e,onSave:um,settings:$e.settings,cues:$e.sceneCues,playerRef:Te,cue:zr,onTransport:Vt,onVideoPreview:J,onGraphicPreview:he,onToggleHelp:()=>it(X=>!X),onRequestDelete:Fe,fromLive:st.fromLive,hasOldClockPreimage:st.hasOldClockPreimage,toSourceSec:st.toSourceSec,onClockRefused:c}),u.jsx("button",{"data-testid":"rate-chip",onClick:()=>Vt("L"),title:"Playback rate — click to speed up (J/K/L on the keyboard)",style:Jz,children:V<0?`◂◂ ${Math.abs(V)}×`:`${V}×`})]})})}),u.jsxs("div",{style:Hz,children:[u.jsx("button",{"data-testid":"view-zoom-out",style:qd,onClick:()=>$n(Ye/2),disabled:Ye<=.25,title:"Zoom the preview out — below 100% shrinks under the fitted size",children:"−"}),u.jsxs("span",{"data-testid":"view-zoom-level",style:Uz,children:[Math.round(Ye*100),"%"]}),u.jsx("button",{"data-testid":"view-zoom-in",style:qd,onClick:()=>$n(Ye*2),disabled:Ye>=8,title:"Zoom the preview in — a viewing magnifier, it never edits the video",children:"+"}),u.jsx("button",{"data-testid":"view-zoom-fit",style:{...qd,width:"auto",padding:"0 8px"},onClick:()=>$n(1),disabled:Math.abs(Ye-1)<.001,title:"Fit the preview to the window",children:"fit"}),u.jsx("span",{style:Zz,children:"⌥-drag pans"})]})]}),u.jsx("div",{style:Kz,children:u.jsx(YN,{selection:W,cue:zr,frame:{width:$e.settings.width,height:$e.settings.height},allSceneIds:$e.sceneCues.map(X=>X.id),edits:e,onSelect:D,resolvedTheme:$e.theme,anchorText:gk,onVideoPreview:J,runInfo:v,captionsHiddenByFlag:(h==null?void 0:h.captionsHiddenByFlag)===!0,fromLive:st.fromLive,hasOldClockPreimage:st.hasOldClockPreimage,toSourceSec:st.toSourceSec,onClockRefused:c,sfxMarker:pk,sfxLibrary:N,sfxEnabled:j.sfx!==null,sfxWordAtPlayhead:()=>{var ee;const X=(((ee=Te.current)==null?void 0:ee.getCurrentFrame())??0)/$e.settings.fps;return ek(Va,X)}})})]}),u.jsx(wL,{cues:$e.sceneCues,ghosts:Dc,cuts:e.doc.cuts,spans:$e.spans??[],cleanup:S,durationSec:$e.outputDurationSec,fps:$e.settings.fps,playerRef:Te,selection:W,onSelect:D,edits:e,onRevived:Y,videoSrc:$e.videoFileName,toLive:st.toLive,pinSourceSec:st.toSourceSec,sfxMarkers:j.sfx===null?null:Ac,sfxWords:Va,sfxSelected:M,onSelectSfx:se,toSourceSec:X=>{var ee;for(const le of $e.spans??[])if(X>=le.outIn&&X<le.outOut)return le.srcIn+(X-le.outIn);return((ee=($e.spans??[])[0])==null?void 0:ee.srcIn)??X}})]})},Fz=({lines:e})=>{const t=d.useRef(null),n=d.useRef(!0);return d.useEffect(()=>{const r=t.current;r&&n.current&&(r.scrollTop=r.scrollHeight)},[e]),u.jsx("div",{ref:t,"data-testid":"render-tail",onScroll:r=>{const o=r.currentTarget;n.current=o.scrollTop+o.clientHeight>=o.scrollHeight-8},style:{maxHeight:220,overflowY:"auto"},children:e.map((r,o)=>u.jsx("div",{children:r},o))})},Pz=()=>u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{display:"block"},children:[u.jsx("path",{d:"M9 14 4 9l5-5"}),u.jsx("path",{d:"M4 9h10.5a5.5 5.5 0 0 1 0 11H11"})]}),$z=()=>u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{display:"block"},children:[u.jsx("path",{d:"m15 14 5-5-5-5"}),u.jsx("path",{d:"M20 9H9.5a5.5 5.5 0 0 0 0 11H13"})]}),Gd={fontFamily:"'Inter', system-ui, sans-serif",background:"#0B0B0E",color:"#EDEDF2",height:"100vh",overflow:"hidden",display:"flex",flexDirection:"column"},Mz={display:"flex",alignItems:"center",gap:14,padding:"10px 20px",borderBottom:"1px solid #1E1E24",background:"#111116"},_z={fontWeight:800,fontSize:14,letterSpacing:"0.02em",color:"#FFE14D",marginRight:8},Az={fontSize:12,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#6a6a75",maxWidth:260,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},Nz={fontSize:12,fontFamily:"ui-monospace, 'SF Mono', monospace",marginLeft:"auto"},at={fontSize:12,fontWeight:600,color:"#EDEDF2",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:6,padding:"7px 12px",cursor:"pointer"},Lz={background:"#FFE14D",color:"#0B0B0E",border:"1px solid #FFE14D"},Oz={position:"fixed",inset:0,zIndex:30},Dz={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"},E0={fontSize:12,fontWeight:600,color:"#EDEDF2",background:"transparent",border:"none",borderRadius:4,padding:"8px 10px",cursor:"pointer",textAlign:"left"},zz={display:"flex",flex:1,minHeight:0},Xd=32,C0="ossclip.transcriptWidth",I0=e=>Math.min(640,Math.max(220,e)),Bz={width:5,flexShrink:0,cursor:"col-resize",background:"#1E1E24",borderLeft:"1px solid #2A2A33"},Wz={position:"relative",flex:1,minWidth:0},Vz={position:"absolute",inset:0,display:"flex",overflow:"auto"},Hz={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},qd={width:22,height:18,fontSize:12,lineHeight:1,color:"#EDEDF2",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:4,cursor:"pointer",padding:0},Uz={fontSize:10,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#9A9AA3",minWidth:34,textAlign:"center"},Zz={fontSize:10,color:"#55555f",userSelect:"none"},Kz={width:260,flexShrink:0,borderLeft:"1px solid #1E1E24",background:"#111116",overflowY:"auto"},Yz={fontSize:11,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#9A9AA3",background:"#0F0F14",borderBottom:"1px solid #2A2A33",padding:"6px 20px",whiteSpace:"pre-wrap",flexShrink:0},di={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},T0={display:"flex",alignItems:"center",gap:10,marginBottom:4},Gz={width:12,height:12,flexShrink:0,border:"2px solid #2A2A33",borderTopColor:"#FFE14D",borderRadius:"50%",animation:"ossclip-spin 0.8s linear infinite"},Xz={flex:1,maxWidth:260,height:4,background:"#1E1E24",borderRadius:2,overflow:"hidden"},qz={height:"100%",background:"#FFE14D",borderRadius:2,transition:"width 0.6s ease"},Jz={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"};Jd.createRoot(document.getElementById("root")).render(u.jsx(me.StrictMode,{children:u.jsx(Rz,{})}));
|