ossclip 0.1.35 → 0.1.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,168 @@
1
+ var Uk=Object.defineProperty;var Zk=(e,t,n)=>t in e?Uk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var We=(e,t,n)=>Zk(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 Kk(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var K0={exports:{}},Zu={},Y0={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 Ia=Symbol.for("react.element"),Yk=Symbol.for("react.portal"),Gk=Symbol.for("react.fragment"),Xk=Symbol.for("react.strict_mode"),qk=Symbol.for("react.profiler"),Jk=Symbol.for("react.provider"),Qk=Symbol.for("react.context"),eE=Symbol.for("react.forward_ref"),tE=Symbol.for("react.suspense"),nE=Symbol.for("react.memo"),rE=Symbol.for("react.lazy"),Nm=Symbol.iterator;function oE(e){return e===null||typeof e!="object"?null:(e=Nm&&e[Nm]||e["@@iterator"],typeof e=="function"?e:null)}var G0={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},X0=Object.assign,q0={};function Gi(e,t,n){this.props=e,this.context=t,this.refs=q0,this.updater=n||G0}Gi.prototype.isReactComponent={};Gi.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")};Gi.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function J0(){}J0.prototype=Gi.prototype;function Fp(e,t,n){this.props=e,this.context=t,this.refs=q0,this.updater=n||G0}var Pp=Fp.prototype=new J0;Pp.constructor=Fp;X0(Pp,Gi.prototype);Pp.isPureReactComponent=!0;var Lm=Array.isArray,Q0=Object.prototype.hasOwnProperty,$p={current:null},ew={key:!0,ref:!0,__self:!0,__source:!0};function tw(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)Q0.call(t,r)&&!ew.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:Ia,type:e,key:i,ref:s,props:o,_owner:$p.current}}function iE(e,t){return{$$typeof:Ia,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Mp(e){return typeof e=="object"&&e!==null&&e.$$typeof===Ia}function sE(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Om=/\/+/g;function rd(e,t){return typeof e=="object"&&e!==null&&e.key!=null?sE(""+e.key):t.toString(36)}function Vl(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 Ia:case Yk:s=!0}}if(s)return s=e,o=o(s),e=r===""?"."+rd(s,0):r,Lm(o)?(n="",e!=null&&(n=e.replace(Om,"$&/")+"/"),Vl(o,t,n,"",function(c){return c})):o!=null&&(Mp(o)&&(o=iE(o,n+(!o.key||s&&s.key===o.key?"":(""+o.key).replace(Om,"$&/")+"/")+e)),t.push(o)),1;if(s=0,r=r===""?".":r+":",Lm(e))for(var a=0;a<e.length;a++){i=e[a];var l=r+rd(i,a);s+=Vl(i,t,n,l,o)}else if(l=oE(e),typeof l=="function")for(e=l.call(e),a=0;!(i=e.next()).done;)i=i.value,l=r+rd(i,a++),s+=Vl(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 Qa(e,t,n){if(e==null)return e;var r=[],o=0;return Vl(e,r,"","",function(i){return t.call(n,i,o++)}),r}function aE(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 un={current:null},Hl={transition:null},lE={ReactCurrentDispatcher:un,ReactCurrentBatchConfig:Hl,ReactCurrentOwner:$p};function nw(){throw Error("act(...) is not supported in production builds of React.")}Me.Children={map:Qa,forEach:function(e,t,n){Qa(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Qa(e,function(){t++}),t},toArray:function(e){return Qa(e,function(t){return t})||[]},only:function(e){if(!Mp(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Me.Component=Gi;Me.Fragment=Gk;Me.Profiler=qk;Me.PureComponent=Fp;Me.StrictMode=Xk;Me.Suspense=tE;Me.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=lE;Me.act=nw;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=X0({},e.props),o=e.key,i=e.ref,s=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,s=$p.current),t.key!==void 0&&(o=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)Q0.call(t,l)&&!ew.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:Ia,type:e.type,key:o,ref:i,props:r,_owner:s}};Me.createContext=function(e){return e={$$typeof:Qk,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:Jk,_context:e},e.Consumer=e};Me.createElement=tw;Me.createFactory=function(e){var t=tw.bind(null,e);return t.type=e,t};Me.createRef=function(){return{current:null}};Me.forwardRef=function(e){return{$$typeof:eE,render:e}};Me.isValidElement=Mp;Me.lazy=function(e){return{$$typeof:rE,_payload:{_status:-1,_result:e},_init:aE}};Me.memo=function(e,t){return{$$typeof:nE,type:e,compare:t===void 0?null:t}};Me.startTransition=function(e){var t=Hl.transition;Hl.transition={};try{e()}finally{Hl.transition=t}};Me.unstable_act=nw;Me.useCallback=function(e,t){return un.current.useCallback(e,t)};Me.useContext=function(e){return un.current.useContext(e)};Me.useDebugValue=function(){};Me.useDeferredValue=function(e){return un.current.useDeferredValue(e)};Me.useEffect=function(e,t){return un.current.useEffect(e,t)};Me.useId=function(){return un.current.useId()};Me.useImperativeHandle=function(e,t,n){return un.current.useImperativeHandle(e,t,n)};Me.useInsertionEffect=function(e,t){return un.current.useInsertionEffect(e,t)};Me.useLayoutEffect=function(e,t){return un.current.useLayoutEffect(e,t)};Me.useMemo=function(e,t){return un.current.useMemo(e,t)};Me.useReducer=function(e,t,n){return un.current.useReducer(e,t,n)};Me.useRef=function(e){return un.current.useRef(e)};Me.useState=function(e){return un.current.useState(e)};Me.useSyncExternalStore=function(e,t,n){return un.current.useSyncExternalStore(e,t,n)};Me.useTransition=function(){return un.current.useTransition()};Me.version="18.3.1";Y0.exports=Me;var d=Y0.exports;const ge=Kk(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 uE=d,cE=Symbol.for("react.element"),dE=Symbol.for("react.fragment"),fE=Object.prototype.hasOwnProperty,pE=uE.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,hE={key:!0,ref:!0,__self:!0,__source:!0};function rw(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)fE.call(t,r)&&!hE.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:cE,type:e,key:i,ref:s,props:o,_owner:pE.current}}Zu.Fragment=dE;Zu.jsx=rw;Zu.jsxs=rw;K0.exports=Zu;var u=K0.exports,ff={},ow={exports:{}},Pn={},iw={exports:{}},sw={};/**
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(R,Z){var B=R.length;R.push(Z);e:for(;0<B;){var ie=B-1>>>1,ue=R[ie];if(0<o(ue,Z))R[ie]=Z,R[B]=ue,B=ie;else break e}}function n(R){return R.length===0?null:R[0]}function r(R){if(R.length===0)return null;var Z=R[0],B=R.pop();if(B!==Z){R[0]=B;e:for(var ie=0,ue=R.length,me=ue>>>1;ie<me;){var re=2*(ie+1)-1,ee=R[re],K=re+1,ce=R[K];if(0>o(ee,B))K<ue&&0>o(ce,ee)?(R[ie]=ce,R[K]=B,ie=K):(R[ie]=ee,R[re]=B,ie=re);else if(K<ue&&0>o(ce,B))R[ie]=ce,R[K]=B,ie=K;else break e}}return Z}function o(R,Z){var B=R.sortIndex-Z.sortIndex;return B!==0?B:R.id-Z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,a=s.now();e.unstable_now=function(){return s.now()-a}}var l=[],c=[],f=1,p=null,h=3,g=!1,w=!1,x=!1,k=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(R){for(var Z=n(c);Z!==null;){if(Z.callback===null)r(c);else if(Z.startTime<=R)r(c),Z.sortIndex=Z.expirationTime,t(l,Z);else break;Z=n(c)}}function S(R){if(x=!1,y(R),!w)if(n(l)!==null)w=!0,z(b);else{var Z=n(c);Z!==null&&O(S,Z.startTime-R)}}function b(R,Z){w=!1,x&&(x=!1,m(j),j=-1),g=!0;var B=h;try{for(y(Z),p=n(l);p!==null&&(!(p.expirationTime>Z)||R&&!L());){var ie=p.callback;if(typeof ie=="function"){p.callback=null,h=p.priorityLevel;var ue=ie(p.expirationTime<=Z);Z=e.unstable_now(),typeof ue=="function"?p.callback=ue:p===n(l)&&r(l),y(Z)}else r(l);p=n(l)}if(p!==null)var me=!0;else{var re=n(c);re!==null&&O(S,re.startTime-Z),me=!1}return me}finally{p=null,h=B,g=!1}}var E=!1,C=null,j=-1,I=5,P=-1;function L(){return!(e.unstable_now()-P<I)}function W(){if(C!==null){var R=e.unstable_now();P=R;var Z=!0;try{Z=C(!0,R)}finally{Z?$():(E=!1,C=null)}}else E=!1}var $;if(typeof v=="function")$=function(){v(W)};else if(typeof MessageChannel<"u"){var A=new MessageChannel,U=A.port2;A.port1.onmessage=W,$=function(){U.postMessage(null)}}else $=function(){k(W,0)};function z(R){C=R,E||(E=!0,$())}function O(R,Z){j=k(function(){R(e.unstable_now())},Z)}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(R){R.callback=null},e.unstable_continueExecution=function(){w||g||(w=!0,z(b))},e.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<R?Math.floor(1e3/R):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function(R){switch(h){case 1:case 2:case 3:var Z=3;break;default:Z=h}var B=h;h=Z;try{return R()}finally{h=B}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(R,Z){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var B=h;h=R;try{return Z()}finally{h=B}},e.unstable_scheduleCallback=function(R,Z,B){var ie=e.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?ie+B:ie):B=ie,R){case 1:var ue=-1;break;case 2:ue=250;break;case 5:ue=1073741823;break;case 4:ue=1e4;break;default:ue=5e3}return ue=B+ue,R={id:f++,callback:Z,priorityLevel:R,startTime:B,expirationTime:ue,sortIndex:-1},B>ie?(R.sortIndex=B,t(c,R),n(l)===null&&R===n(c)&&(x?(m(j),j=-1):x=!0,O(S,B-ie))):(R.sortIndex=ue,t(l,R),w||g||(w=!0,z(b))),R},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(R){var Z=h;return function(){var B=h;h=Z;try{return R.apply(this,arguments)}finally{h=B}}}})(sw);iw.exports=sw;var mE=iw.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 gE=d,Rn=mE;function pe(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 aw=new Set,na={};function Ko(e,t){Di(e,t),Di(e+"Capture",t)}function Di(e,t){for(na[e]=t,e=0;e<t.length;e++)aw.add(t[e])}var _r=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),pf=Object.prototype.hasOwnProperty,yE=/^[: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]*$/,Dm={},zm={};function vE(e){return pf.call(zm,e)?!0:pf.call(Dm,e)?!1:yE.test(e)?zm[e]=!0:(Dm[e]=!0,!1)}function wE(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 xE(e,t,n,r){if(t===null||typeof t>"u"||wE(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 cn(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 Wt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Wt[e]=new cn(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Wt[t]=new cn(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Wt[e]=new cn(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Wt[e]=new cn(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){Wt[e]=new cn(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Wt[e]=new cn(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Wt[e]=new cn(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Wt[e]=new cn(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Wt[e]=new cn(e,5,!1,e.toLowerCase(),null,!1,!1)});var _p=/[\-:]([a-z])/g;function Ap(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(_p,Ap);Wt[t]=new cn(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(_p,Ap);Wt[t]=new cn(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(_p,Ap);Wt[t]=new cn(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Wt[e]=new cn(e,1,!1,e.toLowerCase(),null,!1,!1)});Wt.xlinkHref=new cn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Wt[e]=new cn(e,1,!1,e.toLowerCase(),null,!0,!0)});function Np(e,t,n,r){var o=Wt.hasOwnProperty(t)?Wt[t]:null;(o!==null?o.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(xE(t,n,o,r)&&(n=null),r||o===null?vE(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 Or=gE.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,el=Symbol.for("react.element"),mi=Symbol.for("react.portal"),gi=Symbol.for("react.fragment"),Lp=Symbol.for("react.strict_mode"),hf=Symbol.for("react.profiler"),lw=Symbol.for("react.provider"),uw=Symbol.for("react.context"),Op=Symbol.for("react.forward_ref"),mf=Symbol.for("react.suspense"),gf=Symbol.for("react.suspense_list"),Dp=Symbol.for("react.memo"),Gr=Symbol.for("react.lazy"),cw=Symbol.for("react.offscreen"),Bm=Symbol.iterator;function ws(e){return e===null||typeof e!="object"?null:(e=Bm&&e[Bm]||e["@@iterator"],typeof e=="function"?e:null)}var ct=Object.assign,od;function Ls(e){if(od===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);od=t&&t[1]||""}return`
34
+ `+od+e}var id=!1;function sd(e,t){if(!e||id)return"";id=!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{id=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Ls(e):""}function bE(e){switch(e.tag){case 5:return Ls(e.type);case 16:return Ls("Lazy");case 13:return Ls("Suspense");case 19:return Ls("SuspenseList");case 0:case 2:case 15:return e=sd(e.type,!1),e;case 11:return e=sd(e.type.render,!1),e;case 1:return e=sd(e.type,!0),e;default:return""}}function yf(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 gi:return"Fragment";case mi:return"Portal";case hf:return"Profiler";case Lp:return"StrictMode";case mf:return"Suspense";case gf:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case uw:return(e.displayName||"Context")+".Consumer";case lw:return(e._context.displayName||"Context")+".Provider";case Op:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Dp:return t=e.displayName||null,t!==null?t:yf(e.type)||"Memo";case Gr:t=e._payload,e=e._init;try{return yf(e(t))}catch{}}return null}function SE(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 yf(t);case 8:return t===Lp?"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 ho(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function dw(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function kE(e){var t=dw(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 tl(e){e._valueTracker||(e._valueTracker=kE(e))}function fw(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=dw(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function lu(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 vf(e,t){var n=t.checked;return ct({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Wm(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ho(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 pw(e,t){t=t.checked,t!=null&&Np(e,"checked",t,!1)}function wf(e,t){pw(e,t);var n=ho(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")?xf(e,t.type,n):t.hasOwnProperty("defaultValue")&&xf(e,t.type,ho(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Vm(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 xf(e,t,n){(t!=="number"||lu(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Os=Array.isArray;function Fi(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=""+ho(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 bf(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(pe(91));return ct({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Hm(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(pe(92));if(Os(n)){if(1<n.length)throw Error(pe(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:ho(n)}}function hw(e,t){var n=ho(t.value),r=ho(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 Um(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function mw(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 Sf(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?mw(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var nl,gw=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(nl=nl||document.createElement("div"),nl.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=nl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ra(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Hs={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},EE=["Webkit","ms","Moz","O"];Object.keys(Hs).forEach(function(e){EE.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Hs[t]=Hs[e]})});function yw(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Hs.hasOwnProperty(e)&&Hs[e]?(""+t).trim():t+"px"}function vw(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=yw(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var CE=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 kf(e,t){if(t){if(CE[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(pe(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(pe(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(pe(61))}if(t.style!=null&&typeof t.style!="object")throw Error(pe(62))}}function Ef(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 Cf=null;function zp(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var If=null,Pi=null,$i=null;function Zm(e){if(e=Ra(e)){if(typeof If!="function")throw Error(pe(280));var t=e.stateNode;t&&(t=qu(t),If(e.stateNode,e.type,t))}}function ww(e){Pi?$i?$i.push(e):$i=[e]:Pi=e}function xw(){if(Pi){var e=Pi,t=$i;if($i=Pi=null,Zm(e),t)for(e=0;e<t.length;e++)Zm(t[e])}}function bw(e,t){return e(t)}function Sw(){}var ad=!1;function kw(e,t,n){if(ad)return e(t,n);ad=!0;try{return bw(e,t,n)}finally{ad=!1,(Pi!==null||$i!==null)&&(Sw(),xw())}}function oa(e,t){var n=e.stateNode;if(n===null)return null;var r=qu(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(pe(231,t,typeof n));return n}var jf=!1;if(_r)try{var xs={};Object.defineProperty(xs,"passive",{get:function(){jf=!0}}),window.addEventListener("test",xs,xs),window.removeEventListener("test",xs,xs)}catch{jf=!1}function IE(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 Us=!1,uu=null,cu=!1,Tf=null,jE={onError:function(e){Us=!0,uu=e}};function TE(e,t,n,r,o,i,s,a,l){Us=!1,uu=null,IE.apply(jE,arguments)}function RE(e,t,n,r,o,i,s,a,l){if(TE.apply(this,arguments),Us){if(Us){var c=uu;Us=!1,uu=null}else throw Error(pe(198));cu||(cu=!0,Tf=c)}}function Yo(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 Ew(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 Km(e){if(Yo(e)!==e)throw Error(pe(188))}function FE(e){var t=e.alternate;if(!t){if(t=Yo(e),t===null)throw Error(pe(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 Km(o),e;if(i===r)return Km(o),t;i=i.sibling}throw Error(pe(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(pe(189))}}if(n.alternate!==r)throw Error(pe(190))}if(n.tag!==3)throw Error(pe(188));return n.stateNode.current===n?e:t}function Cw(e){return e=FE(e),e!==null?Iw(e):null}function Iw(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Iw(e);if(t!==null)return t;e=e.sibling}return null}var jw=Rn.unstable_scheduleCallback,Ym=Rn.unstable_cancelCallback,PE=Rn.unstable_shouldYield,$E=Rn.unstable_requestPaint,yt=Rn.unstable_now,ME=Rn.unstable_getCurrentPriorityLevel,Bp=Rn.unstable_ImmediatePriority,Tw=Rn.unstable_UserBlockingPriority,du=Rn.unstable_NormalPriority,_E=Rn.unstable_LowPriority,Rw=Rn.unstable_IdlePriority,Ku=null,wr=null;function AE(e){if(wr&&typeof wr.onCommitFiberRoot=="function")try{wr.onCommitFiberRoot(Ku,e,void 0,(e.current.flags&128)===128)}catch{}}var tr=Math.clz32?Math.clz32:OE,NE=Math.log,LE=Math.LN2;function OE(e){return e>>>=0,e===0?32:31-(NE(e)/LE|0)|0}var rl=64,ol=4194304;function Ds(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 fu(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=Ds(a):(i&=s,i!==0&&(r=Ds(i)))}else s=n&~o,s!==0?r=Ds(s):i!==0&&(r=Ds(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 DE(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 zE(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]=DE(a,t)):l<=t&&(e.expiredLanes|=a),i&=~a}}function Rf(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Fw(){var e=rl;return rl<<=1,!(rl&4194240)&&(rl=64),e}function ld(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function ja(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 Wp(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 Ue=0;function Pw(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var $w,Vp,Mw,_w,Aw,Ff=!1,il=[],oo=null,io=null,so=null,ia=new Map,sa=new Map,Jr=[],WE="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 Gm(e,t){switch(e){case"focusin":case"focusout":oo=null;break;case"dragenter":case"dragleave":io=null;break;case"mouseover":case"mouseout":so=null;break;case"pointerover":case"pointerout":ia.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":sa.delete(t.pointerId)}}function bs(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=Ra(t),t!==null&&Vp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function VE(e,t,n,r,o){switch(t){case"focusin":return oo=bs(oo,e,t,n,r,o),!0;case"dragenter":return io=bs(io,e,t,n,r,o),!0;case"mouseover":return so=bs(so,e,t,n,r,o),!0;case"pointerover":var i=o.pointerId;return ia.set(i,bs(ia.get(i)||null,e,t,n,r,o)),!0;case"gotpointercapture":return i=o.pointerId,sa.set(i,bs(sa.get(i)||null,e,t,n,r,o)),!0}return!1}function Nw(e){var t=$o(e.target);if(t!==null){var n=Yo(t);if(n!==null){if(t=n.tag,t===13){if(t=Ew(n),t!==null){e.blockedOn=t,Aw(e.priority,function(){Mw(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 Ul(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Pf(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Cf=r,n.target.dispatchEvent(r),Cf=null}else return t=Ra(n),t!==null&&Vp(t),e.blockedOn=n,!1;t.shift()}return!0}function Xm(e,t,n){Ul(e)&&n.delete(t)}function HE(){Ff=!1,oo!==null&&Ul(oo)&&(oo=null),io!==null&&Ul(io)&&(io=null),so!==null&&Ul(so)&&(so=null),ia.forEach(Xm),sa.forEach(Xm)}function Ss(e,t){e.blockedOn===t&&(e.blockedOn=null,Ff||(Ff=!0,Rn.unstable_scheduleCallback(Rn.unstable_NormalPriority,HE)))}function aa(e){function t(o){return Ss(o,e)}if(0<il.length){Ss(il[0],e);for(var n=1;n<il.length;n++){var r=il[n];r.blockedOn===e&&(r.blockedOn=null)}}for(oo!==null&&Ss(oo,e),io!==null&&Ss(io,e),so!==null&&Ss(so,e),ia.forEach(t),sa.forEach(t),n=0;n<Jr.length;n++)r=Jr[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Jr.length&&(n=Jr[0],n.blockedOn===null);)Nw(n),n.blockedOn===null&&Jr.shift()}var Mi=Or.ReactCurrentBatchConfig,pu=!0;function UE(e,t,n,r){var o=Ue,i=Mi.transition;Mi.transition=null;try{Ue=1,Hp(e,t,n,r)}finally{Ue=o,Mi.transition=i}}function ZE(e,t,n,r){var o=Ue,i=Mi.transition;Mi.transition=null;try{Ue=4,Hp(e,t,n,r)}finally{Ue=o,Mi.transition=i}}function Hp(e,t,n,r){if(pu){var o=Pf(e,t,n,r);if(o===null)vd(e,t,r,hu,n),Gm(e,r);else if(VE(o,e,t,n,r))r.stopPropagation();else if(Gm(e,r),t&4&&-1<WE.indexOf(e)){for(;o!==null;){var i=Ra(o);if(i!==null&&$w(i),i=Pf(e,t,n,r),i===null&&vd(e,t,r,hu,n),i===o)break;o=i}o!==null&&r.stopPropagation()}else vd(e,t,r,null,n)}}var hu=null;function Pf(e,t,n,r){if(hu=null,e=zp(r),e=$o(e),e!==null)if(t=Yo(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Ew(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 hu=e,null}function Lw(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(ME()){case Bp:return 1;case Tw:return 4;case du:case _E:return 16;case Rw:return 536870912;default:return 16}default:return 16}}var to=null,Up=null,Zl=null;function Ow(){if(Zl)return Zl;var e,t=Up,n=t.length,r,o="value"in to?to.value:to.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 Zl=o.slice(e,1<r?1-r:void 0)}function Kl(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 sl(){return!0}function qm(){return!1}function $n(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)?sl:qm,this.isPropagationStopped=qm,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=sl)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=sl)},persist:function(){},isPersistent:sl}),t}var Xi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Zp=$n(Xi),Ta=ct({},Xi,{view:0,detail:0}),KE=$n(Ta),ud,cd,ks,Yu=ct({},Ta,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Kp,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!==ks&&(ks&&e.type==="mousemove"?(ud=e.screenX-ks.screenX,cd=e.screenY-ks.screenY):cd=ud=0,ks=e),ud)},movementY:function(e){return"movementY"in e?e.movementY:cd}}),Jm=$n(Yu),YE=ct({},Yu,{dataTransfer:0}),GE=$n(YE),XE=ct({},Ta,{relatedTarget:0}),dd=$n(XE),qE=ct({},Xi,{animationName:0,elapsedTime:0,pseudoElement:0}),JE=$n(qE),QE=ct({},Xi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),eC=$n(QE),tC=ct({},Xi,{data:0}),Qm=$n(tC),nC={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},rC={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"},oC={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function iC(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=oC[e])?!!t[e]:!1}function Kp(){return iC}var sC=ct({},Ta,{key:function(e){if(e.key){var t=nC[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Kl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?rC[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Kp,charCode:function(e){return e.type==="keypress"?Kl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Kl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),aC=$n(sC),lC=ct({},Yu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),eg=$n(lC),uC=ct({},Ta,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Kp}),cC=$n(uC),dC=ct({},Xi,{propertyName:0,elapsedTime:0,pseudoElement:0}),fC=$n(dC),pC=ct({},Yu,{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}),hC=$n(pC),mC=[9,13,27,32],Yp=_r&&"CompositionEvent"in window,Zs=null;_r&&"documentMode"in document&&(Zs=document.documentMode);var gC=_r&&"TextEvent"in window&&!Zs,Dw=_r&&(!Yp||Zs&&8<Zs&&11>=Zs),tg=" ",ng=!1;function zw(e,t){switch(e){case"keyup":return mC.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Bw(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var yi=!1;function yC(e,t){switch(e){case"compositionend":return Bw(t);case"keypress":return t.which!==32?null:(ng=!0,tg);case"textInput":return e=t.data,e===tg&&ng?null:e;default:return null}}function vC(e,t){if(yi)return e==="compositionend"||!Yp&&zw(e,t)?(e=Ow(),Zl=Up=to=null,yi=!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 Dw&&t.locale!=="ko"?null:t.data;default:return null}}var wC={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 rg(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!wC[e.type]:t==="textarea"}function Ww(e,t,n,r){ww(r),t=mu(t,"onChange"),0<t.length&&(n=new Zp("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Ks=null,la=null;function xC(e){Qw(e,0)}function Gu(e){var t=xi(e);if(fw(t))return e}function bC(e,t){if(e==="change")return t}var Vw=!1;if(_r){var fd;if(_r){var pd="oninput"in document;if(!pd){var og=document.createElement("div");og.setAttribute("oninput","return;"),pd=typeof og.oninput=="function"}fd=pd}else fd=!1;Vw=fd&&(!document.documentMode||9<document.documentMode)}function ig(){Ks&&(Ks.detachEvent("onpropertychange",Hw),la=Ks=null)}function Hw(e){if(e.propertyName==="value"&&Gu(la)){var t=[];Ww(t,la,e,zp(e)),kw(xC,t)}}function SC(e,t,n){e==="focusin"?(ig(),Ks=t,la=n,Ks.attachEvent("onpropertychange",Hw)):e==="focusout"&&ig()}function kC(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Gu(la)}function EC(e,t){if(e==="click")return Gu(t)}function CC(e,t){if(e==="input"||e==="change")return Gu(t)}function IC(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var rr=typeof Object.is=="function"?Object.is:IC;function ua(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(!pf.call(t,o)||!rr(e[o],t[o]))return!1}return!0}function sg(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function ag(e,t){var n=sg(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=sg(n)}}function Uw(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Uw(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Zw(){for(var e=window,t=lu();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=lu(e.document)}return t}function Gp(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 jC(e){var t=Zw(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Uw(n.ownerDocument.documentElement,n)){if(r!==null&&Gp(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=ag(n,i);var s=ag(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 TC=_r&&"documentMode"in document&&11>=document.documentMode,vi=null,$f=null,Ys=null,Mf=!1;function lg(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Mf||vi==null||vi!==lu(r)||(r=vi,"selectionStart"in r&&Gp(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}),Ys&&ua(Ys,r)||(Ys=r,r=mu($f,"onSelect"),0<r.length&&(t=new Zp("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=vi)))}function al(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var wi={animationend:al("Animation","AnimationEnd"),animationiteration:al("Animation","AnimationIteration"),animationstart:al("Animation","AnimationStart"),transitionend:al("Transition","TransitionEnd")},hd={},Kw={};_r&&(Kw=document.createElement("div").style,"AnimationEvent"in window||(delete wi.animationend.animation,delete wi.animationiteration.animation,delete wi.animationstart.animation),"TransitionEvent"in window||delete wi.transitionend.transition);function Xu(e){if(hd[e])return hd[e];if(!wi[e])return e;var t=wi[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Kw)return hd[e]=t[n];return e}var Yw=Xu("animationend"),Gw=Xu("animationiteration"),Xw=Xu("animationstart"),qw=Xu("transitionend"),Jw=new Map,ug="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 vo(e,t){Jw.set(e,t),Ko(t,[e])}for(var md=0;md<ug.length;md++){var gd=ug[md],RC=gd.toLowerCase(),FC=gd[0].toUpperCase()+gd.slice(1);vo(RC,"on"+FC)}vo(Yw,"onAnimationEnd");vo(Gw,"onAnimationIteration");vo(Xw,"onAnimationStart");vo("dblclick","onDoubleClick");vo("focusin","onFocus");vo("focusout","onBlur");vo(qw,"onTransitionEnd");Di("onMouseEnter",["mouseout","mouseover"]);Di("onMouseLeave",["mouseout","mouseover"]);Di("onPointerEnter",["pointerout","pointerover"]);Di("onPointerLeave",["pointerout","pointerover"]);Ko("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Ko("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Ko("onBeforeInput",["compositionend","keypress","textInput","paste"]);Ko("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Ko("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Ko("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var zs="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(" "),PC=new Set("cancel close invalid load scroll toggle".split(" ").concat(zs));function cg(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,RE(r,t,void 0,e),e.currentTarget=null}function Qw(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;cg(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;cg(o,a,c),i=l}}}if(cu)throw e=Tf,cu=!1,Tf=null,e}function Qe(e,t){var n=t[Of];n===void 0&&(n=t[Of]=new Set);var r=e+"__bubble";n.has(r)||(ex(t,e,2,!1),n.add(r))}function yd(e,t,n){var r=0;t&&(r|=4),ex(n,e,r,t)}var ll="_reactListening"+Math.random().toString(36).slice(2);function ca(e){if(!e[ll]){e[ll]=!0,aw.forEach(function(n){n!=="selectionchange"&&(PC.has(n)||yd(n,!1,e),yd(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ll]||(t[ll]=!0,yd("selectionchange",!1,t))}}function ex(e,t,n,r){switch(Lw(t)){case 1:var o=UE;break;case 4:o=ZE;break;default:o=Hp}n=o.bind(null,t,n,e),o=void 0,!jf||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 vd(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=$o(a),s===null)return;if(l=s.tag,l===5||l===6){r=i=s;continue e}a=a.parentNode}}r=r.return}kw(function(){var c=i,f=zp(n),p=[];e:{var h=Jw.get(e);if(h!==void 0){var g=Zp,w=e;switch(e){case"keypress":if(Kl(n)===0)break e;case"keydown":case"keyup":g=aC;break;case"focusin":w="focus",g=dd;break;case"focusout":w="blur",g=dd;break;case"beforeblur":case"afterblur":g=dd;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=Jm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":g=GE;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":g=cC;break;case Yw:case Gw:case Xw:g=JE;break;case qw:g=fC;break;case"scroll":g=KE;break;case"wheel":g=hC;break;case"copy":case"cut":case"paste":g=eC;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":g=eg}var x=(t&4)!==0,k=!x&&e==="scroll",m=x?h!==null?h+"Capture":null:h;x=[];for(var v=c,y;v!==null;){y=v;var S=y.stateNode;if(y.tag===5&&S!==null&&(y=S,m!==null&&(S=oa(v,m),S!=null&&x.push(da(v,S,y)))),k)break;v=v.return}0<x.length&&(h=new g(h,w,null,n,f),p.push({event:h,listeners:x}))}}if(!(t&7)){e:{if(h=e==="mouseover"||e==="pointerover",g=e==="mouseout"||e==="pointerout",h&&n!==Cf&&(w=n.relatedTarget||n.fromElement)&&($o(w)||w[Ar]))break e;if((g||h)&&(h=f.window===f?f:(h=f.ownerDocument)?h.defaultView||h.parentWindow:window,g?(w=n.relatedTarget||n.toElement,g=c,w=w?$o(w):null,w!==null&&(k=Yo(w),w!==k||w.tag!==5&&w.tag!==6)&&(w=null)):(g=null,w=c),g!==w)){if(x=Jm,S="onMouseLeave",m="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(x=eg,S="onPointerLeave",m="onPointerEnter",v="pointer"),k=g==null?h:xi(g),y=w==null?h:xi(w),h=new x(S,v+"leave",g,n,f),h.target=k,h.relatedTarget=y,S=null,$o(f)===c&&(x=new x(m,v+"enter",w,n,f),x.target=y,x.relatedTarget=k,S=x),k=S,g&&w)t:{for(x=g,m=w,v=0,y=x;y;y=ni(y))v++;for(y=0,S=m;S;S=ni(S))y++;for(;0<v-y;)x=ni(x),v--;for(;0<y-v;)m=ni(m),y--;for(;v--;){if(x===m||m!==null&&x===m.alternate)break t;x=ni(x),m=ni(m)}x=null}else x=null;g!==null&&dg(p,h,g,x,!1),w!==null&&k!==null&&dg(p,k,w,x,!0)}}e:{if(h=c?xi(c):window,g=h.nodeName&&h.nodeName.toLowerCase(),g==="select"||g==="input"&&h.type==="file")var b=bC;else if(rg(h))if(Vw)b=CC;else{b=kC;var E=SC}else(g=h.nodeName)&&g.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(b=EC);if(b&&(b=b(e,c))){Ww(p,b,n,f);break e}E&&E(e,h,c),e==="focusout"&&(E=h._wrapperState)&&E.controlled&&h.type==="number"&&xf(h,"number",h.value)}switch(E=c?xi(c):window,e){case"focusin":(rg(E)||E.contentEditable==="true")&&(vi=E,$f=c,Ys=null);break;case"focusout":Ys=$f=vi=null;break;case"mousedown":Mf=!0;break;case"contextmenu":case"mouseup":case"dragend":Mf=!1,lg(p,n,f);break;case"selectionchange":if(TC)break;case"keydown":case"keyup":lg(p,n,f)}var C;if(Yp)e:{switch(e){case"compositionstart":var j="onCompositionStart";break e;case"compositionend":j="onCompositionEnd";break e;case"compositionupdate":j="onCompositionUpdate";break e}j=void 0}else yi?zw(e,n)&&(j="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(j="onCompositionStart");j&&(Dw&&n.locale!=="ko"&&(yi||j!=="onCompositionStart"?j==="onCompositionEnd"&&yi&&(C=Ow()):(to=f,Up="value"in to?to.value:to.textContent,yi=!0)),E=mu(c,j),0<E.length&&(j=new Qm(j,e,null,n,f),p.push({event:j,listeners:E}),C?j.data=C:(C=Bw(n),C!==null&&(j.data=C)))),(C=gC?yC(e,n):vC(e,n))&&(c=mu(c,"onBeforeInput"),0<c.length&&(f=new Qm("onBeforeInput","beforeinput",null,n,f),p.push({event:f,listeners:c}),f.data=C))}Qw(p,t)})}function da(e,t,n){return{instance:e,listener:t,currentTarget:n}}function mu(e,t){for(var n=t+"Capture",r=[];e!==null;){var o=e,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=oa(e,n),i!=null&&r.unshift(da(e,i,o)),i=oa(e,t),i!=null&&r.push(da(e,i,o))),e=e.return}return r}function ni(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function dg(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=oa(n,i),l!=null&&s.unshift(da(n,l,a))):o||(l=oa(n,i),l!=null&&s.push(da(n,l,a)))),n=n.return}s.length!==0&&e.push({event:t,listeners:s})}var $C=/\r\n?/g,MC=/\u0000|\uFFFD/g;function fg(e){return(typeof e=="string"?e:""+e).replace($C,`
38
+ `).replace(MC,"")}function ul(e,t,n){if(t=fg(t),fg(e)!==t&&n)throw Error(pe(425))}function gu(){}var _f=null,Af=null;function Nf(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 Lf=typeof setTimeout=="function"?setTimeout:void 0,_C=typeof clearTimeout=="function"?clearTimeout:void 0,pg=typeof Promise=="function"?Promise:void 0,AC=typeof queueMicrotask=="function"?queueMicrotask:typeof pg<"u"?function(e){return pg.resolve(null).then(e).catch(NC)}:Lf;function NC(e){setTimeout(function(){throw e})}function wd(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),aa(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=o}while(n);aa(t)}function ao(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 hg(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 qi=Math.random().toString(36).slice(2),yr="__reactFiber$"+qi,fa="__reactProps$"+qi,Ar="__reactContainer$"+qi,Of="__reactEvents$"+qi,LC="__reactListeners$"+qi,OC="__reactHandles$"+qi;function $o(e){var t=e[yr];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Ar]||n[yr]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=hg(e);e!==null;){if(n=e[yr])return n;e=hg(e)}return t}e=n,n=e.parentNode}return null}function Ra(e){return e=e[yr]||e[Ar],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function xi(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(pe(33))}function qu(e){return e[fa]||null}var Df=[],bi=-1;function wo(e){return{current:e}}function et(e){0>bi||(e.current=Df[bi],Df[bi]=null,bi--)}function qe(e,t){bi++,Df[bi]=e.current,e.current=t}var mo={},qt=wo(mo),yn=wo(!1),Do=mo;function zi(e,t){var n=e.type.contextTypes;if(!n)return mo;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 vn(e){return e=e.childContextTypes,e!=null}function yu(){et(yn),et(qt)}function mg(e,t,n){if(qt.current!==mo)throw Error(pe(168));qe(qt,t),qe(yn,n)}function tx(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(pe(108,SE(e)||"Unknown",o));return ct({},n,r)}function vu(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||mo,Do=qt.current,qe(qt,e),qe(yn,yn.current),!0}function gg(e,t,n){var r=e.stateNode;if(!r)throw Error(pe(169));n?(e=tx(e,t,Do),r.__reactInternalMemoizedMergedChildContext=e,et(yn),et(qt),qe(qt,e)):et(yn),qe(yn,n)}var jr=null,Ju=!1,xd=!1;function nx(e){jr===null?jr=[e]:jr.push(e)}function DC(e){Ju=!0,nx(e)}function xo(){if(!xd&&jr!==null){xd=!0;var e=0,t=Ue;try{var n=jr;for(Ue=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}jr=null,Ju=!1}catch(o){throw jr!==null&&(jr=jr.slice(e+1)),jw(Bp,xo),o}finally{Ue=t,xd=!1}}return null}var Si=[],ki=0,wu=null,xu=0,On=[],Dn=0,zo=null,Fr=1,Pr="";function Fo(e,t){Si[ki++]=xu,Si[ki++]=wu,wu=e,xu=t}function rx(e,t,n){On[Dn++]=Fr,On[Dn++]=Pr,On[Dn++]=zo,zo=e;var r=Fr;e=Pr;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,Fr=1<<32-tr(t)+o|n<<o|r,Pr=i+e}else Fr=1<<i|n<<o|r,Pr=e}function Xp(e){e.return!==null&&(Fo(e,1),rx(e,1,0))}function qp(e){for(;e===wu;)wu=Si[--ki],Si[ki]=null,xu=Si[--ki],Si[ki]=null;for(;e===zo;)zo=On[--Dn],On[Dn]=null,Pr=On[--Dn],On[Dn]=null,Fr=On[--Dn],On[Dn]=null}var Tn=null,jn=null,nt=!1,er=null;function ox(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 yg(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,Tn=e,jn=ao(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Tn=e,jn=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=zo!==null?{id:Fr,overflow:Pr}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Wn(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Tn=e,jn=null,!0):!1;default:return!1}}function zf(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Bf(e){if(nt){var t=jn;if(t){var n=t;if(!yg(e,t)){if(zf(e))throw Error(pe(418));t=ao(n.nextSibling);var r=Tn;t&&yg(e,t)?ox(r,n):(e.flags=e.flags&-4097|2,nt=!1,Tn=e)}}else{if(zf(e))throw Error(pe(418));e.flags=e.flags&-4097|2,nt=!1,Tn=e}}}function vg(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Tn=e}function cl(e){if(e!==Tn)return!1;if(!nt)return vg(e),nt=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Nf(e.type,e.memoizedProps)),t&&(t=jn)){if(zf(e))throw ix(),Error(pe(418));for(;t;)ox(e,t),t=ao(t.nextSibling)}if(vg(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(pe(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){jn=ao(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}jn=null}}else jn=Tn?ao(e.stateNode.nextSibling):null;return!0}function ix(){for(var e=jn;e;)e=ao(e.nextSibling)}function Bi(){jn=Tn=null,nt=!1}function Jp(e){er===null?er=[e]:er.push(e)}var zC=Or.ReactCurrentBatchConfig;function Es(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(pe(309));var r=n.stateNode}if(!r)throw Error(pe(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(pe(284));if(!n._owner)throw Error(pe(290,e))}return e}function dl(e,t){throw e=Object.prototype.toString.call(t),Error(pe(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function wg(e){var t=e._init;return t(e._payload)}function sx(e){function t(m,v){if(e){var y=m.deletions;y===null?(m.deletions=[v],m.flags|=16):y.push(v)}}function n(m,v){if(!e)return null;for(;v!==null;)t(m,v),v=v.sibling;return null}function r(m,v){for(m=new Map;v!==null;)v.key!==null?m.set(v.key,v):m.set(v.index,v),v=v.sibling;return m}function o(m,v){return m=fo(m,v),m.index=0,m.sibling=null,m}function i(m,v,y){return m.index=y,e?(y=m.alternate,y!==null?(y=y.index,y<v?(m.flags|=2,v):y):(m.flags|=2,v)):(m.flags|=1048576,v)}function s(m){return e&&m.alternate===null&&(m.flags|=2),m}function a(m,v,y,S){return v===null||v.tag!==6?(v=jd(y,m.mode,S),v.return=m,v):(v=o(v,y),v.return=m,v)}function l(m,v,y,S){var b=y.type;return b===gi?f(m,v,y.props.children,S,y.key):v!==null&&(v.elementType===b||typeof b=="object"&&b!==null&&b.$$typeof===Gr&&wg(b)===v.type)?(S=o(v,y.props),S.ref=Es(m,v,y),S.return=m,S):(S=eu(y.type,y.key,y.props,null,m.mode,S),S.ref=Es(m,v,y),S.return=m,S)}function c(m,v,y,S){return v===null||v.tag!==4||v.stateNode.containerInfo!==y.containerInfo||v.stateNode.implementation!==y.implementation?(v=Td(y,m.mode,S),v.return=m,v):(v=o(v,y.children||[]),v.return=m,v)}function f(m,v,y,S,b){return v===null||v.tag!==7?(v=Oo(y,m.mode,S,b),v.return=m,v):(v=o(v,y),v.return=m,v)}function p(m,v,y){if(typeof v=="string"&&v!==""||typeof v=="number")return v=jd(""+v,m.mode,y),v.return=m,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case el:return y=eu(v.type,v.key,v.props,null,m.mode,y),y.ref=Es(m,null,v),y.return=m,y;case mi:return v=Td(v,m.mode,y),v.return=m,v;case Gr:var S=v._init;return p(m,S(v._payload),y)}if(Os(v)||ws(v))return v=Oo(v,m.mode,y,null),v.return=m,v;dl(m,v)}return null}function h(m,v,y,S){var b=v!==null?v.key:null;if(typeof y=="string"&&y!==""||typeof y=="number")return b!==null?null:a(m,v,""+y,S);if(typeof y=="object"&&y!==null){switch(y.$$typeof){case el:return y.key===b?l(m,v,y,S):null;case mi:return y.key===b?c(m,v,y,S):null;case Gr:return b=y._init,h(m,v,b(y._payload),S)}if(Os(y)||ws(y))return b!==null?null:f(m,v,y,S,null);dl(m,y)}return null}function g(m,v,y,S,b){if(typeof S=="string"&&S!==""||typeof S=="number")return m=m.get(y)||null,a(v,m,""+S,b);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case el:return m=m.get(S.key===null?y:S.key)||null,l(v,m,S,b);case mi:return m=m.get(S.key===null?y:S.key)||null,c(v,m,S,b);case Gr:var E=S._init;return g(m,v,y,E(S._payload),b)}if(Os(S)||ws(S))return m=m.get(y)||null,f(v,m,S,b,null);dl(v,S)}return null}function w(m,v,y,S){for(var b=null,E=null,C=v,j=v=0,I=null;C!==null&&j<y.length;j++){C.index>j?(I=C,C=null):I=C.sibling;var P=h(m,C,y[j],S);if(P===null){C===null&&(C=I);break}e&&C&&P.alternate===null&&t(m,C),v=i(P,v,j),E===null?b=P:E.sibling=P,E=P,C=I}if(j===y.length)return n(m,C),nt&&Fo(m,j),b;if(C===null){for(;j<y.length;j++)C=p(m,y[j],S),C!==null&&(v=i(C,v,j),E===null?b=C:E.sibling=C,E=C);return nt&&Fo(m,j),b}for(C=r(m,C);j<y.length;j++)I=g(C,m,j,y[j],S),I!==null&&(e&&I.alternate!==null&&C.delete(I.key===null?j:I.key),v=i(I,v,j),E===null?b=I:E.sibling=I,E=I);return e&&C.forEach(function(L){return t(m,L)}),nt&&Fo(m,j),b}function x(m,v,y,S){var b=ws(y);if(typeof b!="function")throw Error(pe(150));if(y=b.call(y),y==null)throw Error(pe(151));for(var E=b=null,C=v,j=v=0,I=null,P=y.next();C!==null&&!P.done;j++,P=y.next()){C.index>j?(I=C,C=null):I=C.sibling;var L=h(m,C,P.value,S);if(L===null){C===null&&(C=I);break}e&&C&&L.alternate===null&&t(m,C),v=i(L,v,j),E===null?b=L:E.sibling=L,E=L,C=I}if(P.done)return n(m,C),nt&&Fo(m,j),b;if(C===null){for(;!P.done;j++,P=y.next())P=p(m,P.value,S),P!==null&&(v=i(P,v,j),E===null?b=P:E.sibling=P,E=P);return nt&&Fo(m,j),b}for(C=r(m,C);!P.done;j++,P=y.next())P=g(C,m,j,P.value,S),P!==null&&(e&&P.alternate!==null&&C.delete(P.key===null?j:P.key),v=i(P,v,j),E===null?b=P:E.sibling=P,E=P);return e&&C.forEach(function(W){return t(m,W)}),nt&&Fo(m,j),b}function k(m,v,y,S){if(typeof y=="object"&&y!==null&&y.type===gi&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case el:e:{for(var b=y.key,E=v;E!==null;){if(E.key===b){if(b=y.type,b===gi){if(E.tag===7){n(m,E.sibling),v=o(E,y.props.children),v.return=m,m=v;break e}}else if(E.elementType===b||typeof b=="object"&&b!==null&&b.$$typeof===Gr&&wg(b)===E.type){n(m,E.sibling),v=o(E,y.props),v.ref=Es(m,E,y),v.return=m,m=v;break e}n(m,E);break}else t(m,E);E=E.sibling}y.type===gi?(v=Oo(y.props.children,m.mode,S,y.key),v.return=m,m=v):(S=eu(y.type,y.key,y.props,null,m.mode,S),S.ref=Es(m,v,y),S.return=m,m=S)}return s(m);case mi:e:{for(E=y.key;v!==null;){if(v.key===E)if(v.tag===4&&v.stateNode.containerInfo===y.containerInfo&&v.stateNode.implementation===y.implementation){n(m,v.sibling),v=o(v,y.children||[]),v.return=m,m=v;break e}else{n(m,v);break}else t(m,v);v=v.sibling}v=Td(y,m.mode,S),v.return=m,m=v}return s(m);case Gr:return E=y._init,k(m,v,E(y._payload),S)}if(Os(y))return w(m,v,y,S);if(ws(y))return x(m,v,y,S);dl(m,y)}return typeof y=="string"&&y!==""||typeof y=="number"?(y=""+y,v!==null&&v.tag===6?(n(m,v.sibling),v=o(v,y),v.return=m,m=v):(n(m,v),v=jd(y,m.mode,S),v.return=m,m=v),s(m)):n(m,v)}return k}var Wi=sx(!0),ax=sx(!1),bu=wo(null),Su=null,Ei=null,Qp=null;function eh(){Qp=Ei=Su=null}function th(e){var t=bu.current;et(bu),e._currentValue=t}function Wf(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){Su=e,Qp=Ei=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(gn=!0),e.firstContext=null)}function Un(e){var t=e._currentValue;if(Qp!==e)if(e={context:e,memoizedValue:t,next:null},Ei===null){if(Su===null)throw Error(pe(308));Ei=e,Su.dependencies={lanes:0,firstContext:e}}else Ei=Ei.next=e;return t}var Mo=null;function nh(e){Mo===null?Mo=[e]:Mo.push(e)}function lx(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,nh(t)):(n.next=o.next,o.next=n),t.interleaved=n,Nr(e,r)}function Nr(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 Xr=!1;function rh(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ux(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 Mr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function lo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,De&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,Nr(e,n)}return o=r.interleaved,o===null?(t.next=t,nh(r)):(t.next=o.next,o.next=t),r.interleaved=t,Nr(e,n)}function Yl(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,Wp(e,n)}}function xg(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 ku(e,t,n,r){var o=e.updateQueue;Xr=!1;var i=o.firstBaseUpdate,s=o.lastBaseUpdate,a=o.shared.pending;if(a!==null){o.shared.pending=null;var l=a,c=l.next;l.next=null,s===null?i=c:s.next=c,s=l;var f=e.alternate;f!==null&&(f=f.updateQueue,a=f.lastBaseUpdate,a!==s&&(a===null?f.firstBaseUpdate=c:a.next=c,f.lastBaseUpdate=l))}if(i!==null){var p=o.baseState;s=0,f=c=l=null,a=i;do{var h=a.lane,g=a.eventTime;if((r&h)===h){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(h=t,g=n,x.tag){case 1:if(w=x.payload,typeof w=="function"){p=w.call(g,p,h);break e}p=w;break e;case 3:w.flags=w.flags&-65537|128;case 0:if(w=x.payload,h=typeof w=="function"?w.call(g,p,h):w,h==null)break e;p=ct({},p,h);break e;case 2:Xr=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,h=o.effects,h===null?o.effects=[a]:h.push(a))}else g={eventTime:g,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},f===null?(c=f=g,l=p):f=f.next=g,s|=h;if(a=a.next,a===null){if(a=o.shared.pending,a===null)break;h=a,a=h.next,h.next=null,o.lastBaseUpdate=h,o.shared.pending=null}}while(!0);if(f===null&&(l=p),o.baseState=l,o.firstBaseUpdate=c,o.lastBaseUpdate=f,t=o.shared.interleaved,t!==null){o=t;do s|=o.lane,o=o.next;while(o!==t)}else i===null&&(o.shared.lanes=0);Wo|=s,e.lanes=s,e.memoizedState=p}}function bg(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(pe(191,o));o.call(r)}}}var Fa={},xr=wo(Fa),pa=wo(Fa),ha=wo(Fa);function _o(e){if(e===Fa)throw Error(pe(174));return e}function oh(e,t){switch(qe(ha,t),qe(pa,e),qe(xr,Fa),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Sf(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Sf(t,e)}et(xr),qe(xr,t)}function Vi(){et(xr),et(pa),et(ha)}function cx(e){_o(ha.current);var t=_o(xr.current),n=Sf(t,e.type);t!==n&&(qe(pa,e),qe(xr,n))}function ih(e){pa.current===e&&(et(xr),et(pa))}var lt=wo(0);function Eu(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 bd=[];function sh(){for(var e=0;e<bd.length;e++)bd[e]._workInProgressVersionPrimary=null;bd.length=0}var Gl=Or.ReactCurrentDispatcher,Sd=Or.ReactCurrentBatchConfig,Bo=0,ut=null,It=null,$t=null,Cu=!1,Gs=!1,ma=0,BC=0;function Ut(){throw Error(pe(321))}function ah(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 lh(e,t,n,r,o,i){if(Bo=i,ut=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Gl.current=e===null||e.memoizedState===null?UC:ZC,e=n(r,o),Gs){i=0;do{if(Gs=!1,ma=0,25<=i)throw Error(pe(301));i+=1,$t=It=null,t.updateQueue=null,Gl.current=KC,e=n(r,o)}while(Gs)}if(Gl.current=Iu,t=It!==null&&It.next!==null,Bo=0,$t=It=ut=null,Cu=!1,t)throw Error(pe(300));return e}function uh(){var e=ma!==0;return ma=0,e}function mr(){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(pe(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 ga(e,t){return typeof t=="function"?t(e):t}function kd(e){var t=Zn(),n=t.queue;if(n===null)throw Error(pe(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((Bo&f)===f)l!==null&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:e(r,c.action);else{var p={lane:f,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(a=l=p,s=r):l=l.next=p,ut.lanes|=f,Wo|=f}c=c.next}while(c!==null&&c!==i);l===null?s=r:l.next=a,rr(r,t.memoizedState)||(gn=!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,Wo|=i,o=o.next;while(o!==e)}else o===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Ed(e){var t=Zn(),n=t.queue;if(n===null)throw Error(pe(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)||(gn=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function dx(){}function fx(e,t){var n=ut,r=Zn(),o=t(),i=!rr(r.memoizedState,o);if(i&&(r.memoizedState=o,gn=!0),r=r.queue,ch(mx.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||$t!==null&&$t.memoizedState.tag&1){if(n.flags|=2048,ya(9,hx.bind(null,n,r,o,t),void 0,null),Mt===null)throw Error(pe(349));Bo&30||px(n,t,o)}return o}function px(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 hx(e,t,n,r){t.value=n,t.getSnapshot=r,gx(t)&&yx(e)}function mx(e,t,n){return n(function(){gx(t)&&yx(e)})}function gx(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!rr(e,n)}catch{return!0}}function yx(e){var t=Nr(e,1);t!==null&&nr(t,e,1,-1)}function Sg(e){var t=mr();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ga,lastRenderedState:e},t.queue=e,e=e.dispatch=HC.bind(null,ut,e),[t.memoizedState,e]}function ya(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 vx(){return Zn().memoizedState}function Xl(e,t,n,r){var o=mr();ut.flags|=e,o.memoizedState=ya(1|t,n,void 0,r===void 0?null:r)}function Qu(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&&ah(r,s.deps)){o.memoizedState=ya(t,n,i,r);return}}ut.flags|=e,o.memoizedState=ya(1|t,n,i,r)}function kg(e,t){return Xl(8390656,8,e,t)}function ch(e,t){return Qu(2048,8,e,t)}function wx(e,t){return Qu(4,2,e,t)}function xx(e,t){return Qu(4,4,e,t)}function bx(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 Sx(e,t,n){return n=n!=null?n.concat([e]):null,Qu(4,4,bx.bind(null,t,e),n)}function dh(){}function kx(e,t){var n=Zn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&ah(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Ex(e,t){var n=Zn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&ah(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Cx(e,t,n){return Bo&21?(rr(n,t)||(n=Fw(),ut.lanes|=n,Wo|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,gn=!0),e.memoizedState=n)}function WC(e,t){var n=Ue;Ue=n!==0&&4>n?n:4,e(!0);var r=Sd.transition;Sd.transition={};try{e(!1),t()}finally{Ue=n,Sd.transition=r}}function Ix(){return Zn().memoizedState}function VC(e,t,n){var r=co(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},jx(e))Tx(t,n);else if(n=lx(e,t,n,r),n!==null){var o=ln();nr(n,e,r,o),Rx(n,t,r)}}function HC(e,t,n){var r=co(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(jx(e))Tx(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,nh(t)):(o.next=l.next,l.next=o),t.interleaved=o;return}}catch{}finally{}n=lx(e,t,o,r),n!==null&&(o=ln(),nr(n,e,r,o),Rx(n,t,r))}}function jx(e){var t=e.alternate;return e===ut||t!==null&&t===ut}function Tx(e,t){Gs=Cu=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Rx(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Wp(e,n)}}var Iu={readContext:Un,useCallback:Ut,useContext:Ut,useEffect:Ut,useImperativeHandle:Ut,useInsertionEffect:Ut,useLayoutEffect:Ut,useMemo:Ut,useReducer:Ut,useRef:Ut,useState:Ut,useDebugValue:Ut,useDeferredValue:Ut,useTransition:Ut,useMutableSource:Ut,useSyncExternalStore:Ut,useId:Ut,unstable_isNewReconciler:!1},UC={readContext:Un,useCallback:function(e,t){return mr().memoizedState=[e,t===void 0?null:t],e},useContext:Un,useEffect:kg,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Xl(4194308,4,bx.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Xl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Xl(4,2,e,t)},useMemo:function(e,t){var n=mr();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=mr();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=VC.bind(null,ut,e),[r.memoizedState,e]},useRef:function(e){var t=mr();return e={current:e},t.memoizedState=e},useState:Sg,useDebugValue:dh,useDeferredValue:function(e){return mr().memoizedState=e},useTransition:function(){var e=Sg(!1),t=e[0];return e=WC.bind(null,e[1]),mr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ut,o=mr();if(nt){if(n===void 0)throw Error(pe(407));n=n()}else{if(n=t(),Mt===null)throw Error(pe(349));Bo&30||px(r,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,kg(mx.bind(null,r,i,e),[e]),r.flags|=2048,ya(9,hx.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=mr(),t=Mt.identifierPrefix;if(nt){var n=Pr,r=Fr;n=(r&~(1<<32-tr(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=ma++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=BC++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},ZC={readContext:Un,useCallback:kx,useContext:Un,useEffect:ch,useImperativeHandle:Sx,useInsertionEffect:wx,useLayoutEffect:xx,useMemo:Ex,useReducer:kd,useRef:vx,useState:function(){return kd(ga)},useDebugValue:dh,useDeferredValue:function(e){var t=Zn();return Cx(t,It.memoizedState,e)},useTransition:function(){var e=kd(ga)[0],t=Zn().memoizedState;return[e,t]},useMutableSource:dx,useSyncExternalStore:fx,useId:Ix,unstable_isNewReconciler:!1},KC={readContext:Un,useCallback:kx,useContext:Un,useEffect:ch,useImperativeHandle:Sx,useInsertionEffect:wx,useLayoutEffect:xx,useMemo:Ex,useReducer:Ed,useRef:vx,useState:function(){return Ed(ga)},useDebugValue:dh,useDeferredValue:function(e){var t=Zn();return It===null?t.memoizedState=e:Cx(t,It.memoizedState,e)},useTransition:function(){var e=Ed(ga)[0],t=Zn().memoizedState;return[e,t]},useMutableSource:dx,useSyncExternalStore:fx,useId:Ix,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 Vf(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 ec={isMounted:function(e){return(e=e._reactInternals)?Yo(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=ln(),o=co(e),i=Mr(r,o);i.payload=t,n!=null&&(i.callback=n),t=lo(e,i,o),t!==null&&(nr(t,e,o,r),Yl(t,e,o))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=ln(),o=co(e),i=Mr(r,o);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=lo(e,i,o),t!==null&&(nr(t,e,o,r),Yl(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=ln(),r=co(e),o=Mr(n,r);o.tag=2,t!=null&&(o.callback=t),t=lo(e,o,r),t!==null&&(nr(t,e,r,n),Yl(t,e,r))}};function Eg(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?!ua(n,r)||!ua(o,i):!0}function Fx(e,t,n){var r=!1,o=mo,i=t.contextType;return typeof i=="object"&&i!==null?i=Un(i):(o=vn(t)?Do:qt.current,r=t.contextTypes,i=(r=r!=null)?zi(e,o):mo),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=ec,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=i),t}function Cg(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&&ec.enqueueReplaceState(t,t.state,null)}function Hf(e,t,n,r){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs={},rh(e);var i=t.contextType;typeof i=="object"&&i!==null?o.context=Un(i):(i=vn(t)?Do:qt.current,o.context=zi(e,i)),o.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Vf(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&&ec.enqueueReplaceState(o,o.state,null),ku(e,n,o,r),o.state=e.memoizedState),typeof o.componentDidMount=="function"&&(e.flags|=4194308)}function Hi(e,t){try{var n="",r=t;do n+=bE(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 Cd(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Uf(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var YC=typeof WeakMap=="function"?WeakMap:Map;function Px(e,t,n){n=Mr(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Tu||(Tu=!0,tp=r),Uf(e,t)},n}function $x(e,t,n){n=Mr(-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(){Uf(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Uf(e,t),typeof r!="function"&&(uo===null?uo=new Set([this]):uo.add(this));var s=t.stack;this.componentDidCatch(t.value,{componentStack:s!==null?s:""})}),n}function Ig(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new YC;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=l2.bind(null,e,t,n),t.then(e,e))}function jg(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 Tg(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=Mr(-1,1),t.tag=2,lo(n,t,1))),n.lanes|=1),e)}var GC=Or.ReactCurrentOwner,gn=!1;function an(e,t,n,r){t.child=e===null?ax(t,null,n,r):Wi(t,e.child,n,r)}function Rg(e,t,n,r,o){n=n.render;var i=t.ref;return _i(t,o),r=lh(e,t,n,r,i,o),n=uh(),e!==null&&!gn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Lr(e,t,o)):(nt&&n&&Xp(t),t.flags|=1,an(e,t,r,o),t.child)}function Fg(e,t,n,r,o){if(e===null){var i=n.type;return typeof i=="function"&&!wh(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,Mx(e,t,i,r,o)):(e=eu(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:ua,n(s,r)&&e.ref===t.ref)return Lr(e,t,o)}return t.flags|=1,e=fo(i,r),e.ref=t.ref,e.return=t,t.child=e}function Mx(e,t,n,r,o){if(e!==null){var i=e.memoizedProps;if(ua(i,r)&&e.ref===t.ref)if(gn=!1,t.pendingProps=r=i,(e.lanes&o)!==0)e.flags&131072&&(gn=!0);else return t.lanes=e.lanes,Lr(e,t,o)}return Zf(e,t,n,r,o)}function _x(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},qe(Ii,In),In|=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,qe(Ii,In),In|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,qe(Ii,In),In|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,qe(Ii,In),In|=r;return an(e,t,o,n),t.child}function Ax(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Zf(e,t,n,r,o){var i=vn(n)?Do:qt.current;return i=zi(t,i),_i(t,o),n=lh(e,t,n,r,i,o),r=uh(),e!==null&&!gn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Lr(e,t,o)):(nt&&r&&Xp(t),t.flags|=1,an(e,t,n,o),t.child)}function Pg(e,t,n,r,o){if(vn(n)){var i=!0;vu(t)}else i=!1;if(_i(t,o),t.stateNode===null)ql(e,t),Fx(t,n,r),Hf(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=vn(n)?Do:qt.current,c=zi(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)&&Cg(t,s,r,c),Xr=!1;var h=t.memoizedState;s.state=h,ku(t,r,s,o),l=t.memoizedState,a!==r||h!==l||yn.current||Xr?(typeof f=="function"&&(Vf(t,n,f,r),l=t.memoizedState),(a=Xr||Eg(t,n,a,r,h,l,c))?(p||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(t.flags|=4194308)):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),s.props=r,s.state=l,s.context=c,r=a):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{s=t.stateNode,ux(e,t),a=t.memoizedProps,c=t.type===t.elementType?a:Jn(t.type,a),s.props=c,p=t.pendingProps,h=s.context,l=n.contextType,typeof l=="object"&&l!==null?l=Un(l):(l=vn(n)?Do:qt.current,l=zi(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||h!==l)&&Cg(t,s,r,l),Xr=!1,h=t.memoizedState,s.state=h,ku(t,r,s,o);var w=t.memoizedState;a!==p||h!==w||yn.current||Xr?(typeof g=="function"&&(Vf(t,n,g,r),w=t.memoizedState),(c=Xr||Eg(t,n,c,r,h,w,l)||!1)?(f||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,w,l),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,w,l)),typeof s.componentDidUpdate=="function"&&(t.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof s.componentDidUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=w),s.props=r,s.state=w,s.context=l,r=c):(typeof s.componentDidUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return Kf(e,t,n,r,i,o)}function Kf(e,t,n,r,o,i){Ax(e,t);var s=(t.flags&128)!==0;if(!r&&!s)return o&&gg(t,n,!1),Lr(e,t,i);r=t.stateNode,GC.current=t;var a=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&s?(t.child=Wi(t,e.child,null,i),t.child=Wi(t,null,a,i)):an(e,t,a,i),t.memoizedState=r.state,o&&gg(t,n,!0),t.child}function Nx(e){var t=e.stateNode;t.pendingContext?mg(e,t.pendingContext,t.pendingContext!==t.context):t.context&&mg(e,t.context,!1),oh(e,t.containerInfo)}function $g(e,t,n,r,o){return Bi(),Jp(o),t.flags|=256,an(e,t,n,r),t.child}var Yf={dehydrated:null,treeContext:null,retryLane:0};function Gf(e){return{baseLanes:e,cachePool:null,transitions:null}}function Lx(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),qe(lt,o&1),e===null)return Bf(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=rc(s,r,0,null),e=Oo(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Gf(n),t.memoizedState=Yf,e):fh(t,s));if(o=e.memoizedState,o!==null&&(a=o.dehydrated,a!==null))return XC(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=fo(o,l),r.subtreeFlags=o.subtreeFlags&14680064),a!==null?i=fo(a,i):(i=Oo(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?Gf(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=e.childLanes&~n,t.memoizedState=Yf,r}return i=e.child,e=i.sibling,r=fo(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 fh(e,t){return t=rc({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function fl(e,t,n,r){return r!==null&&Jp(r),Wi(t,e.child,null,n),e=fh(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function XC(e,t,n,r,o,i,s){if(n)return t.flags&256?(t.flags&=-257,r=Cd(Error(pe(422))),fl(e,t,s,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,o=t.mode,r=rc({mode:"visible",children:r.children},o,0,null),i=Oo(i,o,s,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&Wi(t,e.child,null,s),t.child.memoizedState=Gf(s),t.memoizedState=Yf,i);if(!(t.mode&1))return fl(e,t,s,null);if(o.data==="$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var a=r.dgst;return r=a,i=Error(pe(419)),r=Cd(i,r,void 0),fl(e,t,s,r)}if(a=(s&e.childLanes)!==0,gn||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,Nr(e,o),nr(r,e,o,-1))}return vh(),r=Cd(Error(pe(421))),fl(e,t,s,r)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=u2.bind(null,e),o._reactRetry=t,null):(e=i.treeContext,jn=ao(o.nextSibling),Tn=t,nt=!0,er=null,e!==null&&(On[Dn++]=Fr,On[Dn++]=Pr,On[Dn++]=zo,Fr=e.id,Pr=e.overflow,zo=t),t=fh(t,r.children),t.flags|=4096,t)}function Mg(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Wf(e.return,t,n)}function Id(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 Ox(e,t,n){var r=t.pendingProps,o=r.revealOrder,i=r.tail;if(an(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&&Mg(e,n,t);else if(e.tag===19)Mg(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(qe(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&&Eu(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),Id(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&&Eu(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}Id(t,!0,n,null,i);break;case"together":Id(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function ql(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Lr(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Wo|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(pe(153));if(t.child!==null){for(e=t.child,n=fo(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=fo(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function qC(e,t,n){switch(t.tag){case 3:Nx(t),Bi();break;case 5:cx(t);break;case 1:vn(t.type)&&vu(t);break;case 4:oh(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;qe(bu,r._currentValue),r._currentValue=o;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(qe(lt,lt.current&1),t.flags|=128,null):n&t.child.childLanes?Lx(e,t,n):(qe(lt,lt.current&1),e=Lr(e,t,n),e!==null?e.sibling:null);qe(lt,lt.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Ox(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),qe(lt,lt.current),r)break;return null;case 22:case 23:return t.lanes=0,_x(e,t,n)}return Lr(e,t,n)}var Dx,Xf,zx,Bx;Dx=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}};Xf=function(){};zx=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,_o(xr.current);var i=null;switch(n){case"input":o=vf(e,o),r=vf(e,r),i=[];break;case"select":o=ct({},o,{value:void 0}),r=ct({},r,{value:void 0}),i=[];break;case"textarea":o=bf(e,o),r=bf(e,r),i=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=gu)}kf(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"&&(na.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"&&(na.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&Qe("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)}};Bx=function(e,t,n,r){n!==r&&(t.flags|=4)};function Cs(e,t){if(!nt)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 Zt(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 JC(e,t,n){var r=t.pendingProps;switch(qp(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Zt(t),null;case 1:return vn(t.type)&&yu(),Zt(t),null;case 3:return r=t.stateNode,Vi(),et(yn),et(qt),sh(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(cl(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,er!==null&&(op(er),er=null))),Xf(e,t),Zt(t),null;case 5:ih(t);var o=_o(ha.current);if(n=t.type,e!==null&&t.stateNode!=null)zx(e,t,n,r,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(pe(166));return Zt(t),null}if(e=_o(xr.current),cl(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[yr]=t,r[fa]=i,e=(t.mode&1)!==0,n){case"dialog":Qe("cancel",r),Qe("close",r);break;case"iframe":case"object":case"embed":Qe("load",r);break;case"video":case"audio":for(o=0;o<zs.length;o++)Qe(zs[o],r);break;case"source":Qe("error",r);break;case"img":case"image":case"link":Qe("error",r),Qe("load",r);break;case"details":Qe("toggle",r);break;case"input":Wm(r,i),Qe("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},Qe("invalid",r);break;case"textarea":Hm(r,i),Qe("invalid",r)}kf(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&&ul(r.textContent,a,e),o=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(i.suppressHydrationWarning!==!0&&ul(r.textContent,a,e),o=["children",""+a]):na.hasOwnProperty(s)&&a!=null&&s==="onScroll"&&Qe("scroll",r)}switch(n){case"input":tl(r),Vm(r,i,!0);break;case"textarea":tl(r),Um(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=gu)}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=mw(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[yr]=t,e[fa]=r,Dx(e,t,!1,!1),t.stateNode=e;e:{switch(s=Ef(n,r),n){case"dialog":Qe("cancel",e),Qe("close",e),o=r;break;case"iframe":case"object":case"embed":Qe("load",e),o=r;break;case"video":case"audio":for(o=0;o<zs.length;o++)Qe(zs[o],e);o=r;break;case"source":Qe("error",e),o=r;break;case"img":case"image":case"link":Qe("error",e),Qe("load",e),o=r;break;case"details":Qe("toggle",e),o=r;break;case"input":Wm(e,r),o=vf(e,r),Qe("invalid",e);break;case"option":o=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},o=ct({},r,{value:void 0}),Qe("invalid",e);break;case"textarea":Hm(e,r),o=bf(e,r),Qe("invalid",e);break;default:o=r}kf(n,o),a=o;for(i in a)if(a.hasOwnProperty(i)){var l=a[i];i==="style"?vw(e,l):i==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&gw(e,l)):i==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&ra(e,l):typeof l=="number"&&ra(e,""+l):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(na.hasOwnProperty(i)?l!=null&&i==="onScroll"&&Qe("scroll",e):l!=null&&Np(e,i,l,s))}switch(n){case"input":tl(e),Vm(e,r,!1);break;case"textarea":tl(e),Um(e);break;case"option":r.value!=null&&e.setAttribute("value",""+ho(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?Fi(e,!!r.multiple,i,!1):r.defaultValue!=null&&Fi(e,!!r.multiple,r.defaultValue,!0);break;default:typeof o.onClick=="function"&&(e.onclick=gu)}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 Zt(t),null;case 6:if(e&&t.stateNode!=null)Bx(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(pe(166));if(n=_o(ha.current),_o(xr.current),cl(t)){if(r=t.stateNode,n=t.memoizedProps,r[yr]=t,(i=r.nodeValue!==n)&&(e=Tn,e!==null))switch(e.tag){case 3:ul(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&ul(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[yr]=t,t.stateNode=r}return Zt(t),null;case 13:if(et(lt),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(nt&&jn!==null&&t.mode&1&&!(t.flags&128))ix(),Bi(),t.flags|=98560,i=!1;else if(i=cl(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(pe(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(pe(317));i[yr]=t}else Bi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Zt(t),i=!1}else er!==null&&(op(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?jt===0&&(jt=3):vh())),t.updateQueue!==null&&(t.flags|=4),Zt(t),null);case 4:return Vi(),Xf(e,t),e===null&&ca(t.stateNode.containerInfo),Zt(t),null;case 10:return th(t.type._context),Zt(t),null;case 17:return vn(t.type)&&yu(),Zt(t),null;case 19:if(et(lt),i=t.memoizedState,i===null)return Zt(t),null;if(r=(t.flags&128)!==0,s=i.rendering,s===null)if(r)Cs(i,!1);else{if(jt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=Eu(e),s!==null){for(t.flags|=128,Cs(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 qe(lt,lt.current&1|2),t.child}e=e.sibling}i.tail!==null&&yt()>Ui&&(t.flags|=128,r=!0,Cs(i,!1),t.lanes=4194304)}else{if(!r)if(e=Eu(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Cs(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!nt)return Zt(t),null}else 2*yt()-i.renderingStartTime>Ui&&n!==1073741824&&(t.flags|=128,r=!0,Cs(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,qe(lt,r?n&1|2:n&1),t):(Zt(t),null);case 22:case 23:return yh(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?In&1073741824&&(Zt(t),t.subtreeFlags&6&&(t.flags|=8192)):Zt(t),null;case 24:return null;case 25:return null}throw Error(pe(156,t.tag))}function QC(e,t){switch(qp(t),t.tag){case 1:return vn(t.type)&&yu(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Vi(),et(yn),et(qt),sh(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return ih(t),null;case 13:if(et(lt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(pe(340));Bi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return et(lt),null;case 4:return Vi(),null;case 10:return th(t.type._context),null;case 22:case 23:return yh(),null;case 24:return null;default:return null}}var pl=!1,Yt=!1,e2=typeof WeakSet=="function"?WeakSet:Set,xe=null;function Ci(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){pt(e,t,r)}else n.current=null}function qf(e,t,n){try{n()}catch(r){pt(e,t,r)}}var _g=!1;function t2(e,t){if(_f=pu,e=Zw(),Gp(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,a=-1,l=-1,c=0,f=0,p=e,h=null;t:for(;;){for(var 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;)h=p,p=g;for(;;){if(p===e)break t;if(h===n&&++c===o&&(a=s),h===i&&++f===r&&(l=s),(g=p.nextSibling)!==null)break;p=h,h=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(Af={focusedElem:e,selectionRange:n},pu=!1,xe=t;xe!==null;)if(t=xe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,xe=e;else for(;xe!==null;){t=xe;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,m=t.stateNode,v=m.getSnapshotBeforeUpdate(t.elementType===t.type?x:Jn(t.type,x),k);m.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent="":y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(pe(163))}}catch(S){pt(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,xe=e;break}xe=t.return}return w=_g,_g=!1,w}function Xs(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&&qf(t,n,i)}o=o.next}while(o!==r)}}function tc(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 Jf(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 Wx(e){var t=e.alternate;t!==null&&(e.alternate=null,Wx(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[yr],delete t[fa],delete t[Of],delete t[LC],delete t[OC])),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 Vx(e){return e.tag===5||e.tag===3||e.tag===4}function Ag(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Vx(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 Qf(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=gu));else if(r!==4&&(e=e.child,e!==null))for(Qf(e,t,n),e=e.sibling;e!==null;)Qf(e,t,n),e=e.sibling}function ep(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(ep(e,t,n),e=e.sibling;e!==null;)ep(e,t,n),e=e.sibling}var Dt=null,Qn=!1;function Vr(e,t,n){for(n=n.child;n!==null;)Hx(e,t,n),n=n.sibling}function Hx(e,t,n){if(wr&&typeof wr.onCommitFiberUnmount=="function")try{wr.onCommitFiberUnmount(Ku,n)}catch{}switch(n.tag){case 5:Yt||Ci(n,t);case 6:var r=Dt,o=Qn;Dt=null,Vr(e,t,n),Dt=r,Qn=o,Dt!==null&&(Qn?(e=Dt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Dt.removeChild(n.stateNode));break;case 18:Dt!==null&&(Qn?(e=Dt,n=n.stateNode,e.nodeType===8?wd(e.parentNode,n):e.nodeType===1&&wd(e,n),aa(e)):wd(Dt,n.stateNode));break;case 4:r=Dt,o=Qn,Dt=n.stateNode.containerInfo,Qn=!0,Vr(e,t,n),Dt=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)&&qf(n,t,s),o=o.next}while(o!==r)}Vr(e,t,n);break;case 1:if(!Yt&&(Ci(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){pt(n,t,a)}Vr(e,t,n);break;case 21:Vr(e,t,n);break;case 22:n.mode&1?(Yt=(r=Yt)||n.memoizedState!==null,Vr(e,t,n),Yt=r):Vr(e,t,n);break;default:Vr(e,t,n)}}function Ng(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new e2),t.forEach(function(r){var o=c2.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:Dt=a.stateNode,Qn=!1;break e;case 3:Dt=a.stateNode.containerInfo,Qn=!0;break e;case 4:Dt=a.stateNode.containerInfo,Qn=!0;break e}a=a.return}if(Dt===null)throw Error(pe(160));Hx(i,s,o),Dt=null,Qn=!1;var l=o.alternate;l!==null&&(l.return=null),o.return=null}catch(c){pt(o,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Ux(t,e),t=t.sibling}function Ux(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Xn(t,e),pr(e),r&4){try{Xs(3,e,e.return),tc(3,e)}catch(x){pt(e,e.return,x)}try{Xs(5,e,e.return)}catch(x){pt(e,e.return,x)}}break;case 1:Xn(t,e),pr(e),r&512&&n!==null&&Ci(n,n.return);break;case 5:if(Xn(t,e),pr(e),r&512&&n!==null&&Ci(n,n.return),e.flags&32){var o=e.stateNode;try{ra(o,"")}catch(x){pt(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&&pw(o,i),Ef(a,s);var c=Ef(a,i);for(s=0;s<l.length;s+=2){var f=l[s],p=l[s+1];f==="style"?vw(o,p):f==="dangerouslySetInnerHTML"?gw(o,p):f==="children"?ra(o,p):Np(o,f,p,c)}switch(a){case"input":wf(o,i);break;case"textarea":hw(o,i);break;case"select":var h=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var g=i.value;g!=null?Fi(o,!!i.multiple,g,!1):h!==!!i.multiple&&(i.defaultValue!=null?Fi(o,!!i.multiple,i.defaultValue,!0):Fi(o,!!i.multiple,i.multiple?[]:"",!1))}o[fa]=i}catch(x){pt(e,e.return,x)}}break;case 6:if(Xn(t,e),pr(e),r&4){if(e.stateNode===null)throw Error(pe(162));o=e.stateNode,i=e.memoizedProps;try{o.nodeValue=i}catch(x){pt(e,e.return,x)}}break;case 3:if(Xn(t,e),pr(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{aa(t.containerInfo)}catch(x){pt(e,e.return,x)}break;case 4:Xn(t,e),pr(e);break;case 13:Xn(t,e),pr(e),o=e.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(mh=yt())),r&4&&Ng(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),pr(e),r&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!f&&e.mode&1)for(xe=e,f=e.child;f!==null;){for(p=xe=f;xe!==null;){switch(h=xe,g=h.child,h.tag){case 0:case 11:case 14:case 15:Xs(4,h,h.return);break;case 1:Ci(h,h.return);var w=h.stateNode;if(typeof w.componentWillUnmount=="function"){r=h,n=h.return;try{t=r,w.props=t.memoizedProps,w.state=t.memoizedState,w.componentWillUnmount()}catch(x){pt(r,n,x)}}break;case 5:Ci(h,h.return);break;case 22:if(h.memoizedState!==null){Og(p);continue}}g!==null?(g.return=h,xe=g):Og(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=yw("display",s))}catch(x){pt(e,e.return,x)}}}else if(p.tag===6){if(f===null)try{p.stateNode.nodeValue=c?"":p.memoizedProps}catch(x){pt(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),pr(e),r&4&&Ng(e);break;case 21:break;default:Xn(t,e),pr(e)}}function pr(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Vx(n)){var r=n;break e}n=n.return}throw Error(pe(160))}switch(r.tag){case 5:var o=r.stateNode;r.flags&32&&(ra(o,""),r.flags&=-33);var i=Ag(e);ep(e,i,o);break;case 3:case 4:var s=r.stateNode.containerInfo,a=Ag(e);Qf(e,a,s);break;default:throw Error(pe(161))}}catch(l){pt(e,e.return,l)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function n2(e,t,n){xe=e,Zx(e)}function Zx(e,t,n){for(var r=(e.mode&1)!==0;xe!==null;){var o=xe,i=o.child;if(o.tag===22&&r){var s=o.memoizedState!==null||pl;if(!s){var a=o.alternate,l=a!==null&&a.memoizedState!==null||Yt;a=pl;var c=Yt;if(pl=s,(Yt=l)&&!c)for(xe=o;xe!==null;)s=xe,l=s.child,s.tag===22&&s.memoizedState!==null?Dg(o):l!==null?(l.return=s,xe=l):Dg(o);for(;i!==null;)xe=i,Zx(i),i=i.sibling;xe=o,pl=a,Yt=c}Lg(e)}else o.subtreeFlags&8772&&i!==null?(i.return=o,xe=i):Lg(e)}}function Lg(e){for(;xe!==null;){var t=xe;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Yt||tc(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&&bg(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}bg(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&&aa(p)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(pe(163))}Yt||t.flags&512&&Jf(t)}catch(h){pt(t,t.return,h)}}if(t===e){xe=null;break}if(n=t.sibling,n!==null){n.return=t.return,xe=n;break}xe=t.return}}function Og(e){for(;xe!==null;){var t=xe;if(t===e){xe=null;break}var n=t.sibling;if(n!==null){n.return=t.return,xe=n;break}xe=t.return}}function Dg(e){for(;xe!==null;){var t=xe;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{tc(4,t)}catch(l){pt(t,n,l)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var o=t.return;try{r.componentDidMount()}catch(l){pt(t,o,l)}}var i=t.return;try{Jf(t)}catch(l){pt(t,i,l)}break;case 5:var s=t.return;try{Jf(t)}catch(l){pt(t,s,l)}}}catch(l){pt(t,t.return,l)}if(t===e){xe=null;break}var a=t.sibling;if(a!==null){a.return=t.return,xe=a;break}xe=t.return}}var r2=Math.ceil,ju=Or.ReactCurrentDispatcher,ph=Or.ReactCurrentOwner,Hn=Or.ReactCurrentBatchConfig,De=0,Mt=null,bt=null,zt=0,In=0,Ii=wo(0),jt=0,va=null,Wo=0,nc=0,hh=0,qs=null,mn=null,mh=0,Ui=1/0,Ir=null,Tu=!1,tp=null,uo=null,hl=!1,no=null,Ru=0,Js=0,np=null,Jl=-1,Ql=0;function ln(){return De&6?yt():Jl!==-1?Jl:Jl=yt()}function co(e){return e.mode&1?De&2&&zt!==0?zt&-zt:zC.transition!==null?(Ql===0&&(Ql=Fw()),Ql):(e=Ue,e!==0||(e=window.event,e=e===void 0?16:Lw(e.type)),e):1}function nr(e,t,n,r){if(50<Js)throw Js=0,np=null,Error(pe(185));ja(e,n,r),(!(De&2)||e!==Mt)&&(e===Mt&&(!(De&2)&&(nc|=n),jt===4&&Qr(e,zt)),wn(e,r),n===1&&De===0&&!(t.mode&1)&&(Ui=yt()+500,Ju&&xo()))}function wn(e,t){var n=e.callbackNode;zE(e,t);var r=fu(e,e===Mt?zt:0);if(r===0)n!==null&&Ym(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Ym(n),t===1)e.tag===0?DC(zg.bind(null,e)):nx(zg.bind(null,e)),AC(function(){!(De&6)&&xo()}),n=null;else{switch(Pw(r)){case 1:n=Bp;break;case 4:n=Tw;break;case 16:n=du;break;case 536870912:n=Rw;break;default:n=du}n=e1(n,Kx.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Kx(e,t){if(Jl=-1,Ql=0,De&6)throw Error(pe(327));var n=e.callbackNode;if(Ai()&&e.callbackNode!==n)return null;var r=fu(e,e===Mt?zt:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Fu(e,r);else{t=r;var o=De;De|=2;var i=Gx();(Mt!==e||zt!==t)&&(Ir=null,Ui=yt()+500,Lo(e,t));do try{s2();break}catch(a){Yx(e,a)}while(!0);eh(),ju.current=i,De=o,bt!==null?t=0:(Mt=null,zt=0,t=jt)}if(t!==0){if(t===2&&(o=Rf(e),o!==0&&(r=o,t=rp(e,o))),t===1)throw n=va,Lo(e,0),Qr(e,r),wn(e,yt()),n;if(t===6)Qr(e,r);else{if(o=e.current.alternate,!(r&30)&&!o2(o)&&(t=Fu(e,r),t===2&&(i=Rf(e),i!==0&&(r=i,t=rp(e,i))),t===1))throw n=va,Lo(e,0),Qr(e,r),wn(e,yt()),n;switch(e.finishedWork=o,e.finishedLanes=r,t){case 0:case 1:throw Error(pe(345));case 2:Po(e,mn,Ir);break;case 3:if(Qr(e,r),(r&130023424)===r&&(t=mh+500-yt(),10<t)){if(fu(e,0)!==0)break;if(o=e.suspendedLanes,(o&r)!==r){ln(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=Lf(Po.bind(null,e,mn,Ir),t);break}Po(e,mn,Ir);break;case 4:if(Qr(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*r2(r/1960))-r,10<r){e.timeoutHandle=Lf(Po.bind(null,e,mn,Ir),r);break}Po(e,mn,Ir);break;case 5:Po(e,mn,Ir);break;default:throw Error(pe(329))}}}return wn(e,yt()),e.callbackNode===n?Kx.bind(null,e):null}function rp(e,t){var n=qs;return e.current.memoizedState.isDehydrated&&(Lo(e,t).flags|=256),e=Fu(e,t),e!==2&&(t=mn,mn=n,t!==null&&op(t)),e}function op(e){mn===null?mn=e:mn.push.apply(mn,e)}function o2(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 Qr(e,t){for(t&=~hh,t&=~nc,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 zg(e){if(De&6)throw Error(pe(327));Ai();var t=fu(e,0);if(!(t&1))return wn(e,yt()),null;var n=Fu(e,t);if(e.tag!==0&&n===2){var r=Rf(e);r!==0&&(t=r,n=rp(e,r))}if(n===1)throw n=va,Lo(e,0),Qr(e,t),wn(e,yt()),n;if(n===6)throw Error(pe(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Po(e,mn,Ir),wn(e,yt()),null}function gh(e,t){var n=De;De|=1;try{return e(t)}finally{De=n,De===0&&(Ui=yt()+500,Ju&&xo())}}function Vo(e){no!==null&&no.tag===0&&!(De&6)&&Ai();var t=De;De|=1;var n=Hn.transition,r=Ue;try{if(Hn.transition=null,Ue=1,e)return e()}finally{Ue=r,Hn.transition=n,De=t,!(De&6)&&xo()}}function yh(){In=Ii.current,et(Ii)}function Lo(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,_C(n)),bt!==null)for(n=bt.return;n!==null;){var r=n;switch(qp(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&yu();break;case 3:Vi(),et(yn),et(qt),sh();break;case 5:ih(r);break;case 4:Vi();break;case 13:et(lt);break;case 19:et(lt);break;case 10:th(r.type._context);break;case 22:case 23:yh()}n=n.return}if(Mt=e,bt=e=fo(e.current,null),zt=In=t,jt=0,va=null,hh=nc=Wo=0,mn=qs=null,Mo!==null){for(t=0;t<Mo.length;t++)if(n=Mo[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}Mo=null}return e}function Yx(e,t){do{var n=bt;try{if(eh(),Gl.current=Iu,Cu){for(var r=ut.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}Cu=!1}if(Bo=0,$t=It=ut=null,Gs=!1,ma=0,ph.current=null,n===null||n.return===null){jt=1,va=t,bt=null;break}e:{var i=e,s=n.return,a=n,l=t;if(t=zt,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,f=a,p=f.tag;if(!(f.mode&1)&&(p===0||p===11||p===15)){var h=f.alternate;h?(f.updateQueue=h.updateQueue,f.memoizedState=h.memoizedState,f.lanes=h.lanes):(f.updateQueue=null,f.memoizedState=null)}var g=jg(s);if(g!==null){g.flags&=-257,Tg(g,s,a,i,t),g.mode&1&&Ig(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)){Ig(i,c,t),vh();break e}l=Error(pe(426))}}else if(nt&&a.mode&1){var k=jg(s);if(k!==null){!(k.flags&65536)&&(k.flags|=256),Tg(k,s,a,i,t),Jp(Hi(l,a));break e}}i=l=Hi(l,a),jt!==4&&(jt=2),qs===null?qs=[i]:qs.push(i),i=s;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var m=Px(i,l,t);xg(i,m);break e;case 1:a=l;var v=i.type,y=i.stateNode;if(!(i.flags&128)&&(typeof v.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(uo===null||!uo.has(y)))){i.flags|=65536,t&=-t,i.lanes|=t;var S=$x(i,a,t);xg(i,S);break e}}i=i.return}while(i!==null)}qx(n)}catch(b){t=b,bt===n&&n!==null&&(bt=n=n.return);continue}break}while(!0)}function Gx(){var e=ju.current;return ju.current=Iu,e===null?Iu:e}function vh(){(jt===0||jt===3||jt===2)&&(jt=4),Mt===null||!(Wo&268435455)&&!(nc&268435455)||Qr(Mt,zt)}function Fu(e,t){var n=De;De|=2;var r=Gx();(Mt!==e||zt!==t)&&(Ir=null,Lo(e,t));do try{i2();break}catch(o){Yx(e,o)}while(!0);if(eh(),De=n,ju.current=r,bt!==null)throw Error(pe(261));return Mt=null,zt=0,jt}function i2(){for(;bt!==null;)Xx(bt)}function s2(){for(;bt!==null&&!PE();)Xx(bt)}function Xx(e){var t=Qx(e.alternate,e,In);e.memoizedProps=e.pendingProps,t===null?qx(e):bt=t,ph.current=null}function qx(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=QC(n,t),n!==null){n.flags&=32767,bt=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{jt=6,bt=null;return}}else if(n=JC(n,t,In),n!==null){bt=n;return}if(t=t.sibling,t!==null){bt=t;return}bt=t=e}while(t!==null);jt===0&&(jt=5)}function Po(e,t,n){var r=Ue,o=Hn.transition;try{Hn.transition=null,Ue=1,a2(e,t,n,r)}finally{Hn.transition=o,Ue=r}return null}function a2(e,t,n,r){do Ai();while(no!==null);if(De&6)throw Error(pe(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(pe(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(BE(e,i),e===Mt&&(bt=Mt=null,zt=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||hl||(hl=!0,e1(du,function(){return Ai(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Hn.transition,Hn.transition=null;var s=Ue;Ue=1;var a=De;De|=4,ph.current=null,t2(e,n),Ux(n,e),jC(Af),pu=!!_f,Af=_f=null,e.current=n,n2(n),$E(),De=a,Ue=s,Hn.transition=i}else e.current=n;if(hl&&(hl=!1,no=e,Ru=o),i=e.pendingLanes,i===0&&(uo=null),AE(n.stateNode),wn(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(Tu)throw Tu=!1,e=tp,tp=null,e;return Ru&1&&e.tag!==0&&Ai(),i=e.pendingLanes,i&1?e===np?Js++:(Js=0,np=e):Js=0,xo(),null}function Ai(){if(no!==null){var e=Pw(Ru),t=Hn.transition,n=Ue;try{if(Hn.transition=null,Ue=16>e?16:e,no===null)var r=!1;else{if(e=no,no=null,Ru=0,De&6)throw Error(pe(331));var o=De;for(De|=4,xe=e.current;xe!==null;){var i=xe,s=i.child;if(xe.flags&16){var a=i.deletions;if(a!==null){for(var l=0;l<a.length;l++){var c=a[l];for(xe=c;xe!==null;){var f=xe;switch(f.tag){case 0:case 11:case 15:Xs(8,f,i)}var p=f.child;if(p!==null)p.return=f,xe=p;else for(;xe!==null;){f=xe;var h=f.sibling,g=f.return;if(Wx(f),f===c){xe=null;break}if(h!==null){h.return=g,xe=h;break}xe=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)}}xe=i}}if(i.subtreeFlags&2064&&s!==null)s.return=i,xe=s;else e:for(;xe!==null;){if(i=xe,i.flags&2048)switch(i.tag){case 0:case 11:case 15:Xs(9,i,i.return)}var m=i.sibling;if(m!==null){m.return=i.return,xe=m;break e}xe=i.return}}var v=e.current;for(xe=v;xe!==null;){s=xe;var y=s.child;if(s.subtreeFlags&2064&&y!==null)y.return=s,xe=y;else e:for(s=v;xe!==null;){if(a=xe,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:tc(9,a)}}catch(b){pt(a,a.return,b)}if(a===s){xe=null;break e}var S=a.sibling;if(S!==null){S.return=a.return,xe=S;break e}xe=a.return}}if(De=o,xo(),wr&&typeof wr.onPostCommitFiberRoot=="function")try{wr.onPostCommitFiberRoot(Ku,e)}catch{}r=!0}return r}finally{Ue=n,Hn.transition=t}}return!1}function Bg(e,t,n){t=Hi(n,t),t=Px(e,t,1),e=lo(e,t,1),t=ln(),e!==null&&(ja(e,1,t),wn(e,t))}function pt(e,t,n){if(e.tag===3)Bg(e,e,n);else for(;t!==null;){if(t.tag===3){Bg(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(uo===null||!uo.has(r))){e=Hi(n,e),e=$x(t,e,1),t=lo(t,e,1),e=ln(),t!==null&&(ja(t,1,e),wn(t,e));break}}t=t.return}}function l2(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=ln(),e.pingedLanes|=e.suspendedLanes&n,Mt===e&&(zt&n)===n&&(jt===4||jt===3&&(zt&130023424)===zt&&500>yt()-mh?Lo(e,0):hh|=n),wn(e,t)}function Jx(e,t){t===0&&(e.mode&1?(t=ol,ol<<=1,!(ol&130023424)&&(ol=4194304)):t=1);var n=ln();e=Nr(e,t),e!==null&&(ja(e,t,n),wn(e,n))}function u2(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Jx(e,n)}function c2(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(pe(314))}r!==null&&r.delete(t),Jx(e,n)}var Qx;Qx=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||yn.current)gn=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return gn=!1,qC(e,t,n);gn=!!(e.flags&131072)}else gn=!1,nt&&t.flags&1048576&&rx(t,xu,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;ql(e,t),e=t.pendingProps;var o=zi(t,qt.current);_i(t,n),o=lh(null,t,r,e,o,n);var i=uh();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,vn(r)?(i=!0,vu(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,rh(t),o.updater=ec,t.stateNode=o,o._reactInternals=t,Hf(t,r,e,n),t=Kf(null,t,r,!0,i,n)):(t.tag=0,nt&&i&&Xp(t),an(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(ql(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=f2(r),e=Jn(r,e),o){case 0:t=Zf(null,t,r,e,n);break e;case 1:t=Pg(null,t,r,e,n);break e;case 11:t=Rg(null,t,r,e,n);break e;case 14:t=Fg(null,t,r,Jn(r.type,e),n);break e}throw Error(pe(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Jn(r,o),Zf(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Jn(r,o),Pg(e,t,r,o,n);case 3:e:{if(Nx(t),e===null)throw Error(pe(387));r=t.pendingProps,i=t.memoizedState,o=i.element,ux(e,t),ku(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=Hi(Error(pe(423)),t),t=$g(e,t,r,n,o);break e}else if(r!==o){o=Hi(Error(pe(424)),t),t=$g(e,t,r,n,o);break e}else for(jn=ao(t.stateNode.containerInfo.firstChild),Tn=t,nt=!0,er=null,n=ax(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Bi(),r===o){t=Lr(e,t,n);break e}an(e,t,r,n)}t=t.child}return t;case 5:return cx(t),e===null&&Bf(t),r=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,s=o.children,Nf(r,o)?s=null:i!==null&&Nf(r,i)&&(t.flags|=32),Ax(e,t),an(e,t,s,n),t.child;case 6:return e===null&&Bf(t),null;case 13:return Lx(e,t,n);case 4:return oh(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Wi(t,null,r,n):an(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Jn(r,o),Rg(e,t,r,o,n);case 7:return an(e,t,t.pendingProps,n),t.child;case 8:return an(e,t,t.pendingProps.children,n),t.child;case 12:return an(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,qe(bu,r._currentValue),r._currentValue=s,i!==null)if(rr(i.value,s)){if(i.children===o.children&&!yn.current){t=Lr(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=Mr(-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),Wf(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(pe(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),Wf(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}an(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,an(e,t,r,n),t.child;case 14:return r=t.type,o=Jn(r,t.pendingProps),o=Jn(r.type,o),Fg(e,t,r,o,n);case 15:return Mx(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Jn(r,o),ql(e,t),t.tag=1,vn(r)?(e=!0,vu(t)):e=!1,_i(t,n),Fx(t,r,o),Hf(t,r,o,n),Kf(null,t,r,!0,e,n);case 19:return Ox(e,t,n);case 22:return _x(e,t,n)}throw Error(pe(156,t.tag))};function e1(e,t){return jw(e,t)}function d2(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 d2(e,t,n,r)}function wh(e){return e=e.prototype,!(!e||!e.isReactComponent)}function f2(e){if(typeof e=="function")return wh(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Op)return 11;if(e===Dp)return 14}return 2}function fo(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 eu(e,t,n,r,o,i){var s=2;if(r=e,typeof e=="function")wh(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case gi:return Oo(n.children,o,i,t);case Lp:s=8,o|=8;break;case hf:return e=Wn(12,n,t,o|2),e.elementType=hf,e.lanes=i,e;case mf:return e=Wn(13,n,t,o),e.elementType=mf,e.lanes=i,e;case gf:return e=Wn(19,n,t,o),e.elementType=gf,e.lanes=i,e;case cw:return rc(n,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case lw:s=10;break e;case uw:s=9;break e;case Op:s=11;break e;case Dp:s=14;break e;case Gr:s=16,r=null;break e}throw Error(pe(130,e==null?e:typeof e,""))}return t=Wn(s,n,t,o),t.elementType=e,t.type=r,t.lanes=i,t}function Oo(e,t,n,r){return e=Wn(7,e,r,t),e.lanes=n,e}function rc(e,t,n,r){return e=Wn(22,e,r,t),e.elementType=cw,e.lanes=n,e.stateNode={isHidden:!1},e}function jd(e,t,n){return e=Wn(6,e,null,t),e.lanes=n,e}function Td(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 p2(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=ld(0),this.expirationTimes=ld(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ld(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function xh(e,t,n,r,o,i,s,a,l){return e=new p2(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},rh(i),e}function h2(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:mi,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function t1(e){if(!e)return mo;e=e._reactInternals;e:{if(Yo(e)!==e||e.tag!==1)throw Error(pe(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(vn(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(pe(171))}if(e.tag===1){var n=e.type;if(vn(n))return tx(e,n,t)}return t}function n1(e,t,n,r,o,i,s,a,l){return e=xh(n,r,!0,e,o,i,s,a,l),e.context=t1(null),n=e.current,r=ln(),o=co(n),i=Mr(r,o),i.callback=t??null,lo(n,i,o),e.current.lanes=o,ja(e,o,r),wn(e,r),e}function oc(e,t,n,r){var o=t.current,i=ln(),s=co(o);return n=t1(n),t.context===null?t.context=n:t.pendingContext=n,t=Mr(i,s),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=lo(o,t,s),e!==null&&(nr(e,o,s,i),Yl(e,o,s)),s}function Pu(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 Wg(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function bh(e,t){Wg(e,t),(e=e.alternate)&&Wg(e,t)}function m2(){return null}var r1=typeof reportError=="function"?reportError:function(e){console.error(e)};function Sh(e){this._internalRoot=e}ic.prototype.render=Sh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(pe(409));oc(e,t,null,null)};ic.prototype.unmount=Sh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Vo(function(){oc(null,e,null,null)}),t[Ar]=null}};function ic(e){this._internalRoot=e}ic.prototype.unstable_scheduleHydration=function(e){if(e){var t=_w();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Jr.length&&t!==0&&t<Jr[n].priority;n++);Jr.splice(n,0,e),n===0&&Nw(e)}};function kh(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function sc(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Vg(){}function g2(e,t,n,r,o){if(o){if(typeof r=="function"){var i=r;r=function(){var c=Pu(s);i.call(c)}}var s=n1(t,r,e,0,null,!1,!1,"",Vg);return e._reactRootContainer=s,e[Ar]=s.current,ca(e.nodeType===8?e.parentNode:e),Vo(),s}for(;o=e.lastChild;)e.removeChild(o);if(typeof r=="function"){var a=r;r=function(){var c=Pu(l);a.call(c)}}var l=xh(e,0,!1,null,null,!1,!1,"",Vg);return e._reactRootContainer=l,e[Ar]=l.current,ca(e.nodeType===8?e.parentNode:e),Vo(function(){oc(t,l,n,r)}),l}function ac(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=Pu(s);a.call(l)}}oc(t,s,e,o)}else s=g2(n,t,e,o,r);return Pu(s)}$w=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Ds(t.pendingLanes);n!==0&&(Wp(t,n|1),wn(t,yt()),!(De&6)&&(Ui=yt()+500,xo()))}break;case 13:Vo(function(){var r=Nr(e,1);if(r!==null){var o=ln();nr(r,e,1,o)}}),bh(e,1)}};Vp=function(e){if(e.tag===13){var t=Nr(e,134217728);if(t!==null){var n=ln();nr(t,e,134217728,n)}bh(e,134217728)}};Mw=function(e){if(e.tag===13){var t=co(e),n=Nr(e,t);if(n!==null){var r=ln();nr(n,e,t,r)}bh(e,t)}};_w=function(){return Ue};Aw=function(e,t){var n=Ue;try{return Ue=e,t()}finally{Ue=n}};If=function(e,t,n){switch(t){case"input":if(wf(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=qu(r);if(!o)throw Error(pe(90));fw(r),wf(r,o)}}}break;case"textarea":hw(e,n);break;case"select":t=n.value,t!=null&&Fi(e,!!n.multiple,t,!1)}};bw=gh;Sw=Vo;var y2={usingClientEntryPoint:!1,Events:[Ra,xi,qu,ww,xw,gh]},Is={findFiberByHostInstance:$o,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},v2={bundleType:Is.bundleType,version:Is.version,rendererPackageName:Is.rendererPackageName,rendererConfig:Is.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Or.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Cw(e),e===null?null:e.stateNode},findFiberByHostInstance:Is.findFiberByHostInstance||m2,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 ml=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ml.isDisabled&&ml.supportsFiber)try{Ku=ml.inject(v2),wr=ml}catch{}}Pn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=y2;Pn.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!kh(t))throw Error(pe(200));return h2(e,t,null,n)};Pn.createRoot=function(e,t){if(!kh(e))throw Error(pe(299));var n=!1,r="",o=r1;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=xh(e,1,!1,null,null,n,!1,r,o),e[Ar]=t.current,ca(e.nodeType===8?e.parentNode:e),new Sh(t)};Pn.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(pe(188)):(e=Object.keys(e).join(","),Error(pe(268,e)));return e=Cw(t),e=e===null?null:e.stateNode,e};Pn.flushSync=function(e){return Vo(e)};Pn.hydrate=function(e,t,n){if(!sc(t))throw Error(pe(200));return ac(null,e,t,!0,n)};Pn.hydrateRoot=function(e,t,n){if(!kh(e))throw Error(pe(405));var r=n!=null&&n.hydratedSources||null,o=!1,i="",s=r1;if(n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=n1(t,null,e,1,n??null,o,!1,i,s),e[Ar]=t.current,ca(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 ic(t)};Pn.render=function(e,t,n){if(!sc(t))throw Error(pe(200));return ac(null,e,t,!1,n)};Pn.unmountComponentAtNode=function(e){if(!sc(e))throw Error(pe(40));return e._reactRootContainer?(Vo(function(){ac(null,null,e,!1,function(){e._reactRootContainer=null,e[Ar]=null})}),!0):!1};Pn.unstable_batchedUpdates=gh;Pn.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!sc(n))throw Error(pe(200));if(e==null||e._reactInternals===void 0)throw Error(pe(38));return ac(e,t,n,!1,r)};Pn.version="18.3.1-next-f1338f8080-20240426";function o1(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o1)}catch(e){console.error(e)}}o1(),ow.exports=Pn;var ip=ow.exports,Hg=ip;ff.createRoot=Hg.createRoot,ff.hydrateRoot=Hg.hydrateRoot;var w2=Object.defineProperty,i1=(e,t)=>{for(var n in t)w2(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 Go=d.createContext(!1),sp=({children:e})=>u.jsx(Go.Provider,{value:!0,children:e}),s1=d.createContext({setError:()=>{},clearError:()=>{}}),Ug=()=>{try{return typeof __webpack_module__>"u"?null:__webpack_module__.hot??null}catch{return null}};class x2 extends ge.Component{constructor(){super(...arguments);We(this,"state",{hasError:!1});We(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=Ug();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=Ug();r&&r.removeStatusHandler(n)}render(){return this.state.hasError?null:this.props.children}}var Ji=d.createContext({compositions:[],folders:[],currentCompositionMetadata:null,canvasContent:null}),Pa=d.createContext({registerComposition:()=>{},unregisterComposition:()=>{},registerFolder:()=>{},unregisterFolder:()=>{},setCanvasContent:()=>{},onlyRenderComposition:null}),$a=d.createContext({getNonce:()=>0}),tu=0;try{typeof __webpack_module__<"u"&&__webpack_module__.hot&&__webpack_module__.hot.addStatusHandler(e=>{e==="idle"&&tu++})}catch{}var lc=()=>{const t=d.useContext($a).getNonce(),n=d.useRef(t);n.current=t;const r=d.useRef([[tu,t]]),o=d.useCallback(()=>(tu!==r.current[r.current.length-1][0]&&(r.current=[...r.current,[tu,n.current]]),r.current),[r]);return d.useMemo(()=>({get:o}),[o])};function Qi(e){return!!e}var a1=()=>/^([a-zA-Z0-9-\u4E00-\u9FFF])+$/g,l1=e=>e.match(a1()),b2=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(!l1(e))throw new Error(`Folder name can only contain a-z, A-Z, 0-9 and -. You passed ${e}`)},S2=`Folder name must match ${String(a1())}`,ap=d.createContext({folderName:null,parentName:null}),k2=e=>{const{name:t,children:n}=e,r=d.useContext(ap),{registerFolder:o,unregisterFolder:i}=d.useContext(Pa),s=lc(),a=e.stack??null;b2(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(ap.Provider,{value:f,children:n})};function Zg(){return["NOD","E_EN","V"].join("")}var Kg=()=>["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[Kg()][Zg()]==="test"||window.process[Kg()][Zg()]==="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}},lp="remotion-date:",wa="remotion-file:",E2=({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,`${lp}${f.toISOString()}`):f instanceof Map?(i=!0,c):f instanceof Set?(s=!0,c):typeof f=="string"&&n!==null&&f.startsWith(n)?(o=!0,`${wa}${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)}},u1=e=>JSON.parse(e,(t,n)=>typeof n=="string"&&n.startsWith(lp)?new Date(n.replace(lp,"")):typeof n=="string"&&n.startsWith(wa)?`${window.remotion_staticBase}/${n.replace(wa,"")}`:n),C2=e=>u1(E2({data:e,indent:2,staticBase:window.remotion_staticBase}).serializedString),up=e=>Vn().isStudio?C2(e):e,c1=d.createContext(!1),I2=({children:e})=>u.jsx(c1.Provider,{value:!0,children:e}),Eh=()=>d.useContext(c1),Hr=({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}`))},j2=(e,t)=>{const{style:n,...r}=e,o=d.useMemo(()=>({position:"absolute",top:Hr({className:r.className,classPrefix:["top-","inset-"],type:"prefix"})?void 0:0,left:Hr({className:r.className,classPrefix:["left-","inset-"],type:"prefix"})?void 0:0,right:Hr({className:r.className,classPrefix:["right-","inset-"],type:"prefix"})?void 0:0,bottom:Hr({className:r.className,classPrefix:["bottom-","inset-"],type:"prefix"})?void 0:0,width:Hr({className:r.className,classPrefix:["w-"],type:"prefix"})?void 0:"100%",height:Hr({className:r.className,classPrefix:["h-"],type:"prefix"})?void 0:"100%",display:Hr({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:Hr({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})},Fn=d.forwardRef(j2),T2={transform:"rotate(90deg)"},Yg=40,R2={color:"white",fontSize:14,fontFamily:"sans-serif"},F2={justifyContent:"center",alignItems:"center"},P2=()=>u.jsxs(Fn,{style:F2,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:Yg,height:Yg,viewBox:"-100 -100 400 400",style:T2,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:R2,children:["Resolving ","<Suspense>","..."]})]}),En=null,cp=()=>{if(!En){if(typeof document>"u")throw new Error("Tried to call an API that only works in the browser from outside the browser");En=document.createElement("div"),En.style.position="absolute",En.style.top="0px",En.style.left="0px",En.style.right="0px",En.style.bottom="0px",En.style.width="100%",En.style.height="100%",En.style.display="flex",En.style.flexDirection="column";const e=document.createElement("div");e.style.position="fixed",e.style.top="-999999px",e.appendChild(En),document.body.appendChild(e)}return En},dp=()=>"remotion_inputPropsOverride"+window.location.origin,d1=()=>{if(typeof localStorage>"u")return null;const e=localStorage.getItem(dp());return e?JSON.parse(e):null},$2=e=>{if(!(typeof localStorage>"u")){if(e===null){localStorage.removeItem(dp());return}localStorage.setItem(dp(),JSON.stringify(e))}},Gg=!1,M2=()=>{Gg||(Gg=!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()"))},_2=()=>{if(typeof window>"u")return M2(),{};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=d1();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?u1(t):{}},Ch=d.createContext({props:{},updateProps:()=>{throw new Error("Not implemented")}}),A2=ge.createRef(),f1=({children:e})=>{const[t,n]=ge.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(Ch.Provider,{value:o,children:e})},p1=ge.createContext(null),vt=()=>{const e=d.useContext(p1),[t]=d.useState(()=>Vn());return e??t};function $u(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 uc(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 cc(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 dc=d.createContext(null),N2=d.createRef(),L2=e=>!!e.calculateMetadata,Ih=e=>{const t=d.useContext(dc),{props:n}=d.useContext(Ch),{compositions:r,canvasContent:o,currentCompositionMetadata:i}=d.useContext(Ji),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??{}}}:L2(l)?!t||!t[l.id]?null:t[l.id]:(uc(l.durationInFrames,{allowFloats:!1,component:`in <Composition id="${l.id}">`}),cc(l.fps,`in <Composition id="${l.id}">`),$u(l.width,"width",`in <Composition id="${l.id}">`),$u(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?{}:_2()??{}},defaultCodec:null,defaultOutName:null,defaultVideoImageFormat:null,defaultPixelFormat:null,defaultProResProfile:null,defaultSampleRate:null}}):null,[l,t,i,c,f.isPlayer])},h1=e=>{const t=e.stack??"";return t.startsWith("Error:")?t:`${e.message}
55
+ ${t}`},O2=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 jh(e,t){let n;throw O2(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=h1(n)),n}function xa(e){return jh(typeof window<"u"?window:void 0,e)}var D2=["trace","verbose","info","warn","error"],Xg=e=>D2.indexOf(e),fc=(e,t)=>Xg(e)<=Xg(t),Ma=({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},z2=(e,...t)=>{if(fc(e.logLevel,"verbose"))return console.debug(...Ma({args:t,logLevel:"verbose",tag:e.tag}))},B2=(e,...t)=>{if(fc(e.logLevel,"trace"))return console.debug(...Ma({args:t,logLevel:"trace",tag:e.tag}))},W2=(e,...t)=>{if(fc(e.logLevel,"info"))return console.log(...Ma({args:t,logLevel:"info",tag:e.tag}))},V2=(e,...t)=>{if(fc(e.logLevel,"warn"))return console.warn(...Ma({args:t,logLevel:"warn",tag:e.tag}))},H2=(e,...t)=>console.error(...Ma({args:t,logLevel:"error",tag:e.tag})),_t={trace:B2,verbose:z2,info:W2,warn:V2,error:H2};typeof window<"u"&&(window.remotion_renderReady=!1,window.remotion_delayRenderTimeouts||(window.remotion_delayRenderTimeouts={}),window.remotion_delayRenderHandles=[]);var U2="The delayRender was called:",Z2="Retries left: ",K2="- Rendering the frame will be retried.",Y2="handle was cleared after",G2=3e4,m1=({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??G2)-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?Z2+l:null,l>0?K2:null,U2,i].filter(Qi).join(" ");t.isClientSideRendering?e.remotion_cancelledError=h1(Error(c)):jh(e,Error(c))},a)}}return e.remotion_renderReady=!1,o},X2=(e,t)=>typeof window>"u"?Math.random():m1({scope:window,environment:Vn(),label:e??null,options:{}}),g1=({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",Y2,`${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)},q2=e=>{typeof window>"u"||g1({scope:window,handle:e,environment:Vn(),logLevel:window.remotion_logLevel??"info"})},Xo=d.createContext({logLevel:"info",mountTime:0}),Sr=()=>{const{logLevel:e}=d.useContext(Xo);if(e===null)throw new Error("useLogLevel must be used within a LogLevelProvider");return e},_a=()=>{const{mountTime:e}=d.useContext(Xo);if(e===null)throw new Error("useMountTime must be used within a LogLevelProvider");return e},y1=d.createContext(null),or=()=>{const e=vt(),t=d.useContext(y1)??(typeof window<"u"?window:void 0),n=Sr(),r=d.useCallback((s,a)=>t?m1({scope:t,environment:e,label:s??null,options:a??{}}):Math.random(),[e,t]),o=d.useCallback(s=>{t&&g1({scope:t,handle:s,environment:e,logLevel:n})},[e,n,t]),i=d.useCallback(s=>jh(t??(typeof window<"u"?window:void 0),s),[t]);return{delayRender:r,continueRender:o,cancelRender:i}},v1=({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 ge.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 ge.lazy(e.lazyComponent)}throw new Error("You must pass either 'component' or 'lazyComponent'")},[e.lazyComponent])},pc=()=>{const{canvasContent:e,compositions:t,currentCompositionMetadata:n}=d.useContext(Ji),r=t.find(i=>(e==null?void 0:e.type)==="composition"&&i.id===e.compositionId),o=Ih((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])},w1=()=>/^([a-zA-Z0-9-\u4E00-\u9FFF])+$/g,x1=e=>e.match(w1()),J2=e=>{if(!x1(e))throw new Error(`Composition id can only contain a-z, A-Z, 0-9, CJK characters and -. You passed ${e}`)},Q2=`Composition ID must match ${String(w1())}`,eI=(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}"`:""}`)}},tI=()=>{const{continueRender:e,delayRender:t}=or();return d.useEffect(()=>{const n=t("Waiting for Root component to unsuspend");return()=>e(n)},[e,t]),null},nI=({width:e,height:t,fps:n,durationInFrames:r,id:o,defaultProps:i,schema:s,...a})=>{const l=d.useContext(Pa),{registerComposition:c,unregisterComposition:f}=l,p=pc(),h=v1({compProps:a,componentName:"Composition",noSuspense:!1}),g=lc(),w=Eh(),x=vt(),k=d.useContext(Go);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:m,parentName:v}=d.useContext(ap),y=a.stack??null,S="component"in a?a.component:null;d.useEffect(()=>{if(!o)throw new Error("No id for composition passed.");return J2(o),eI(i,"defaultProps",o),c({durationInFrames:r??void 0,fps:n??void 0,height:t??void 0,width:e??void 0,id:o,folderName:m,component:h,defaultProps:up(i??{}),nonce:g.get(),parentFolderName:v,componentFromProps:S,schema:s??null,calculateMetadata:a.calculateMetadata??null,stack:y}),()=>{f(o)}},[r,n,t,h,o,m,i,e,g,v,S,s,a.calculateMetadata,y,c,f]);const b=Ih(o),{setError:E,clearError:C}=d.useContext(s1),j=d.useCallback(P=>{E(P)},[E]),I=d.useCallback(()=>{C()},[C]);if(x.isStudio&&p&&p.component===h&&p.id===o){const P=h;return b===null||b.type!=="success"&&b.type!=="success-and-refreshing"?null:ip.createPortal(u.jsx(sp,{children:u.jsx(x2,{onError:j,onClear:I,children:u.jsx(d.Suspense,{fallback:u.jsx(P2,{}),children:u.jsx(P,{...b.result.props??{}})})})}),cp())}if(x.isRendering&&p&&p.component===h&&p.id===o){const P=h;return b===null||b.type!=="success"&&b.type!=="success-and-refreshing"?null:ip.createPortal(u.jsx(sp,{children:u.jsx(d.Suspense,{fallback:u.jsx(tI,{}),children:u.jsx(P,{...b.result.props??{}})})}),cp())}return null},Mu=e=>{const{onlyRenderComposition:t}=d.useContext(Pa);return t&&t!==e.id?null:u.jsx(nI,{...e})},b1=[],S1=null,rI=()=>b1,dn=e=>{b1.push(e)},oI=e=>{S1=e},iI=()=>S1,sI=e=>{const t=ge.Children.toArray(e);if(t.length!==1)return null;const n=t[0];return!ge.isValidElement(n)||typeof n.type!="function"&&typeof n.type!="object"?null:n.type},Bs="4.0.499",aI=()=>{if(typeof globalThis>"u")return;const e=()=>{globalThis.remotion_imported=Bs,typeof window<"u"&&(window.remotion_imported=Bs)},t=globalThis.remotion_imported||typeof window<"u"&&window.remotion_imported;if(t){if(t===Bs)return;if(typeof t=="string"&&t.includes("webcodecs")){e();return}throw new TypeError(`🚨 Multiple versions of Remotion detected: ${[Bs,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),fp={};i1(fp,{useTimelineSetFrame:()=>R1,useTimelinePosition:()=>So,useTimelineContext:()=>bo,usePlayingState:()=>F1,usePlaybackRate:()=>Ph,useAbsoluteTimelinePosition:()=>T1,persistCurrentFrame:()=>k1,getInitialFrameState:()=>E1,getFrameForComposition:()=>C1,clampFrameToCompositionRange:()=>I1});function qg(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 lI(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 qo=(e,t)=>{if(e===null)return Math.random();if(typeof e=="string")return qg(lI(e));if(typeof e=="number")return qg(e*1e10);throw new Error("random() argument must be a number or a string")},es=d.createContext({setFrame:()=>{throw new Error("default")},setPlaying:()=>{throw new Error("default")}}),ts=d.createContext(null),Th=d.createContext(null),Rh=d.createContext(null),uI=({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(qo(null))),[c,f]=d.useState(()=>E1()),p=t??c,{delayRender:h,continueRender:g}=or();typeof window<"u"&&d.useLayoutEffect(()=>{window.remotion_setFrame=(m,v,y)=>{window.remotion_attempt=y;const S=h(`Setting the current frame to ${m}`);let b=!0;f(E=>(E[v]??window.remotion_initialFrame)===m?(b=!1,E):{...E,[v]:m}),b?requestAnimationFrame(()=>g(S)):g(S)},window.remotion_isPlayer=!1},[g,h]);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(Rh.Provider,{value:w,children:u.jsx(Th.Provider,{value:x,children:u.jsx(ts.Provider,{value:w,children:u.jsx(es.Provider,{value:k,children:e})})})})},Fh=()=>"remotion.time-all",k1=e=>{localStorage.setItem(Fh(),JSON.stringify(e))},E1=()=>{const e=localStorage.getItem(Fh())??"{}";return JSON.parse(e)},C1=e=>{const t=localStorage.getItem(Fh())??"{}",n=JSON.parse(t);return n[e]!==void 0?Number(n[e]):typeof window>"u"?0:window.remotion_initialFrame??0},I1=(e,t)=>Math.max(0,Math.min(Math.max(0,t-1),e)),j1=e=>{const t=pc(),n=vt();if(!t)return typeof window>"u"?0:window.remotion_initialFrame??0;const r=e.frame[t.id]??(n.isPlayer?0:C1(t.id));return I1(r,t.durationInFrames)},bo=()=>{const e=d.useContext(ts);if(e===null)throw new Error("TimelineContext is not available. This hook must be used inside a <Player> or the Remotion Studio.");return e},Ph=()=>{const e=d.useContext(Th);if(e===null)throw new Error("PlaybackRateContext is not available. This hook must be used inside a <Player> or the Remotion Studio.");return e},So=()=>{const e=bo();return j1(e)},T1=()=>{const e=d.useContext(Rh);if(e===null)throw new Error("AbsoluteTimeContext is not available. This hook must be used inside a <Player> or the Remotion Studio.");return j1(e)},R1=()=>{const{setFrame:e}=d.useContext(es);return e},F1=()=>{const{playing:e,imperativePlaying:t}=bo(),{setPlaying:n}=d.useContext(es);return d.useMemo(()=>[e,n,t],[t,e,n])},Nt=()=>{const e=d.useContext(Go),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=So(),r=d.useContext(Rt),o=r?r.cumulatedFrom+r.relativeFrom:0;return n-o},hc=()=>{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=pc();return d.useMemo(()=>{if(!o)return null;const{id:i,durationInFrames:s,fps:a,height:l,width:c,defaultProps:f,props:p,defaultCodec:h,defaultOutName:g,defaultVideoImageFormat:w,defaultPixelFormat:x,defaultProResProfile:k,defaultSampleRate:m}=o;return{id:i,width:t??c,height:n??l,fps:a,durationInFrames:r??s,defaultProps:f,props:p,defaultCodec:h,defaultOutName:g,defaultVideoImageFormat:w,defaultPixelFormat:x,defaultProResProfile:k,defaultSampleRate:m}},[r,n,t,o])},ht=()=>{const e=hc(),t=d.useContext(Go),n=Eh();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},Aa=({frame:e,children:t,active:n=!0})=>{const r=Nt(),o=ht();if(typeof e>"u")throw new Error("The <Freeze /> component requires a 'frame' prop, but none was passed.");if(typeof e!="number")throw new Error(`The 'frame' prop of <Freeze /> must be a number, but is of type ${typeof e}`);if(Number.isNaN(e))throw new Error("The 'frame' prop of <Freeze /> must be a real number, but it is NaN.");if(!Number.isFinite(e))throw new Error(`The 'frame' prop of <Freeze /> must be a finite number, but it is ${e}.`);const i=d.useMemo(()=>{if(typeof n=="boolean")return n;if(typeof n=="function")return n(r)},[n,r]),s=bo(),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(ts.Provider,{value:c,children:u.jsx(Rt.Provider,{value:f,children:t})})},kr={"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}},cI=kr,mc={"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}},ko={"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"}},Eo={"style.backgroundColor":{type:"color",default:"transparent",description:"Color"}},P1={children:{type:"text-content",default:"",description:"Text",keyframable:!1}},ns={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}},$1={...ns},M1={...kr,...Eo,...ko,...$1},$h={type:"boolean",default:!1,description:"Hidden"},_1={type:"hidden"},Mh={type:"hidden"},dI=e=>({name:Mh,...e}),_h={type:"number",default:void 0,min:1,step:1,hiddenFromList:!0},A1={type:"number",default:0,step:1,hiddenFromList:!0},N1={type:"number",default:0,min:0,step:1,hiddenFromList:!0},Ah={type:"number",default:null,step:1,hiddenFromList:!0},Dr={durationInFrames:_h,from:A1,trimBefore:N1,freeze:Ah,hidden:$h,name:Mh,showInTimeline:_1},Zi={...Dr,layout:{type:"enum",default:"absolute-fill",description:"Layout",variants:{"absolute-fill":M1,none:{}}}},fI={durationInFrames:_h,trimBefore:N1,freeze:Ah,hidden:$h,name:Mh,showInTimeline:_1},pI={...fI,layout:Zi.layout},hI={...Zi,layout:{...Zi.layout,default:"none"}},rs=ge.createContext({registerSequence:()=>{throw new Error("SequenceManagerContext not initialized")},unregisterSequence:()=>{throw new Error("SequenceManagerContext not initialized")},sequences:[]}),gc=ge.createContext({current:[]}),Rr=e=>`${e.absolutePath}\0${e.nodePath.join(".")}\0${e.sequenceKeys.join(".")}\0${e.effectKeys.map(t=>t.join(".")).join(".")}`,yc=ge.createContext({propStatuses:{}}),vc=ge.createContext({current:{}}),wc=ge.createContext({getDragOverrides:()=>{throw new Error("VisualModeDragOverridesContext not initialized")},getEffectDragOverrides:()=>{throw new Error("VisualModeDragOverridesContext not initialized")}}),L1=ge.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")}}),Rd=(e,t)=>`${Rr(e)}.effects.${t}`,mI=({children:e})=>{const[t,n]=d.useState([]),r=d.useRef(t);r.current=t;const[o,i]=d.useState({}),s=d.useRef(o);s.current=o;const[a,l]=d.useState({}),[c,f]=d.useState({}),p=d.useRef(c);p.current=c;const h=d.useCallback((I,P,L)=>{i(W=>({...W,[Rr(I)]:{...W[Rr(I)],[P]:L}}))},[]),g=d.useCallback(I=>{i(P=>{const L=Rr(I);if(!P[L])return P;const W={...P};return delete W[L],W})},[]),w=d.useCallback((I,P,L,W)=>{l($=>{const A=Rd(I,P);return{...$,[A]:{...$[A],[L]:W}}})},[]),x=d.useCallback((I,P)=>{l(L=>{const W=Rd(I,P);if(!L[W])return L;const $={...L};return delete $[W],$})},[]),k=d.useCallback((I,P)=>{f(L=>{const W=Rr(I),$=L[W],A=P($);return $===A?L:{...L,[W]:A}})},[]),m=d.useCallback(I=>{n(P=>[...P,I])},[]),v=d.useCallback(I=>{n(P=>P.filter(L=>L.id!==I))},[]),y=d.useMemo(()=>({registerSequence:m,sequences:t,unregisterSequence:v}),[m,t,v]),S=d.useCallback(I=>o[Rr(I)]??{},[o]),b=d.useCallback((I,P)=>a[Rd(I,P)]??{},[a]),E=d.useMemo(()=>({propStatuses:c}),[c]),C=d.useMemo(()=>({getDragOverrides:S,getEffectDragOverrides:b}),[S,b]),j=d.useMemo(()=>({setDragOverrides:h,clearDragOverrides:g,setEffectDragOverrides:w,clearEffectDragOverrides:x,setPropStatuses:k}),[h,g,w,x,k]);return u.jsx(gc.Provider,{value:r,children:u.jsx(rs.Provider,{value:y,children:u.jsx(vc.Provider,{value:p,children:u.jsx(yc.Provider,{value:E,children:u.jsx(wc.Provider,{value:C,children:u.jsx(L1.Provider,{value:j,children:e})})})})})})},xc=d.createContext(!1),gI=({children:e})=>u.jsx(xc.Provider,{value:!0,children:e}),O1=({children:e})=>u.jsx(xc.Provider,{value:!1,children:e}),yI=()=>{if(!ge.useContext(xc))throw new Error("This component must be inside a <Series /> component.")},D1=d.createContext({premountFramesRemaining:0}),vI=!1,Na=e=>e??vI,La=({from:e,durationInFrames:t,premountFor:n,postmountFor:r,style:o,styleWhilePremounted:i,styleWhilePostmounted:s,hideWhilePremounted:a})=>{const l=d.useContext(D1),c=Nt()-l.premountFramesRemaining,f=vt(),{fps:p}=ht(),h=n??0,g=r??0,w=Math.ceil(e+t-1),x=!f.isRendering&&c<e&&c>=e-h,k=!f.isRendering&&c>w&&c<=w+g,m=x||k,v=x?e:k?e+t-1:0,y=d.useMemo(()=>m?{...o,...a==="opacity"?{opacity:0}:{display:"none"},pointerEvents:"none",...x?i:{},...k?s:{}}:o,[m,a,k,x,o,s,i]);return{effectivePremountFor:h,effectivePostmountFor:g,premountingActive:x,postmountingActive:k,isPremountingOrPostmounting:m,freezeFrame:v,premountingStyle:y}},wI=(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},xI=4,bI=.001,SI=1e-7,kI=10,Ws=11,gl=1/(Ws-1),EI=typeof Float32Array=="function";function z1(e,t){return 1-3*t+3*e}function B1(e,t){return 3*t-6*e}function W1(e){return 3*e}function _u(e,t,n){return((z1(t,n)*e+B1(t,n))*e+W1(t))*e}function V1(e,t,n){return 3*z1(t,n)*e*e+2*B1(t,n)*e+W1(t)}function CI({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=_u(s,r,o)-e,i>0?c=s:l=s;while(Math.abs(i)>SI&&++a<kI);return s}function II(e,t,n,r){let o=t;for(let i=0;i<xI;++i){const s=V1(o,n,r);if(s===0)return o;const a=_u(o,n,r)-e;o-=a/s}return o}function H1(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=EI?new Float32Array(Ws):new Array(Ws);if(e!==t||n!==r)for(let s=0;s<Ws;++s)o[s]=_u(s*gl,e,n);function i(s){let a=0,l=1;const c=Ws-1;for(;l!==c&&o[l]<=s;++l)a+=gl;--l;const f=(s-o[l])/(o[l+1]-o[l]),p=a+f*gl,h=V1(p,e,n);return h>=bI?II(s,p,e,n):h===0?p:CI({aX:s,_aA:a,_aB:a+gl,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:_u(i(a),t,r)}}var jI=e=>Math.round(e*1e6)/1e6,TI=new Set(["deg","rad","grad","turn"]),U1=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"]),Z1=/^([+-]?(?:\d+\.?\d*|\.\d+))([a-zA-Z%]+)?$/,K1=new Set(["left","center","right","top","bottom"]),ji=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:"%"}}],js={value:50,unit:"%"},Jg=e=>String(jI(e)),RI=(e,t)=>{const n=Z1.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(TI.has(r))return{kind:"rotate",value:o,unit:r};if(U1.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`)},Y1=({component:e,value:t,allowPercentage:n})=>{const r=Z1.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||!U1.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}},Fd=(e,t)=>{const n=e.toLowerCase();return K1.has(n)?{type:"keyword",keyword:n}:{type:"length-percentage",parsed:Y1({component:e,value:t,allowPercentage:!0})}},FI=(e,t,n)=>{const r=[];for(const o of ji(e))for(const i of ji(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]},PI=(e,t)=>{if(e.length===1){const a=Fd(e[0],t);return a.type==="length-percentage"?[a.parsed,js]:a.keyword==="top"||a.keyword==="bottom"?[js,ji(a.keyword)[0].value]:[ji(a.keyword)[0].value,js]}const n=Fd(e[0],t),r=Fd(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 FI(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[ji(o.keyword)[0].value,i]}return o.keyword==="top"||o.keyword==="bottom"?[i,ji(o.keyword)[0].value]:s?[js,i]:[i,js]},$I=(e,t)=>{const[n,r]=PI(t.slice(0,2),e),o=t[2]===void 0?{value:0,unit:null}:Y1({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}},MI=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=>K1.has(f.toLowerCase())))return $I(e,t);const n=t.map(f=>RI(f,e)),[{kind:r}]=n;for(const f of n)if(f.kind!==r)throw new TypeError(`Cannot interpolate "${e}" because it mixes ${r} and ${f.kind} values`);if(r==="scale"){const f=n[0].value,p=((o=n[1])==null?void 0:o.value)??f,h=((i=n[2])==null?void 0:i.value)??1;return{kind:r,values:[f,p,h],units:[null,null,null],dimensions:n.length}}return{kind:r,values:[n[0].value,((s=n[1])==null?void 0:s.value)??0,((a=n[2])==null?void 0:a.value)??0],units:[n[0].unit,((l=n[1])==null?void 0:l.unit)??null,((c=n[2])==null?void 0:c.unit)??null],dimensions:n.length}},_I=({kind:e,values:t,units:n,dimensions:r})=>e==="scale"?t.slice(0,r).map(o=>Jg(o)).join(" "):t.slice(0,r).map((o,i)=>`${Jg(o)}${n[i]}`).join(" "),Qg=e=>e===0?0:Math.sign(e)*e*e,AI=e=>e===0?0:Math.sign(e)*Math.sqrt(Math.abs(e));function NI(e,t,n,r){const{extrapolateLeft:o,extrapolateRight:i,easing:s,output:a}=r;let l=e;const[c,f]=t,[p,h]=n;if(l<c){if(o==="identity")return l;if(o==="clamp")l=c;else if(o==="wrap"){const 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===h)return p;if(l=(l-c)/(f-c),l=s(l),a==="perceptual-scale"){const g=Qg(p),w=Qg(h);l=AI(l*(w-g)+g)}else l=l*(h-p)+p;return l}function LI(e,t){let n;for(n=1;n<t.length-1&&!(t[n]>=e);++n);return n-1}var OI=e=>e,DI=e=>e??"linear",G1=e=>e.remotionShouldExtendRight===!0,ey=({easing:e,segmentIndex:t})=>e===void 0?OI:typeof e=="function"?e:e[t],ty=({input:e,inputRange:t,outputRange:n,easing:r,extrapolateLeft:o,extrapolateRight:i,output:s})=>NI(e,t,n,{easing:r,extrapolateLeft:o,extrapolateRight:e>t[1]&&i==="clamp"&&G1(r)?"extend":i,output:s}),Nh=({input:e,inputRange:t,outputRange:n,options:r})=>{const o=DI(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=LI(l,t),f=ey({easing:i,segmentIndex:c});let p=ty({input:l,inputRange:[t[c],t[c+1]],outputRange:[n[c],n[c+1]],easing:f,extrapolateLeft:s,extrapolateRight:a,output:o});for(let h=0;h<c;h++){const g=ey({easing:i,segmentIndex:h});if(!G1(g))continue;const w=t[h+1];if(l<=w)continue;const x=ty({input:l,inputRange:[t[h],w],outputRange:[n[h],n[h+1]],easing:g,extrapolateLeft:s,extrapolateRight:"extend",output:o});p+=x-n[h+1]}return p},zI=({input:e,inputRange:t,outputRange:n,options:r})=>{var c;const o=n.map(MI),i=(c=o[0])==null?void 0:c.kind;if(i===void 0)throw new Error("outputRange must have at least 1 element");for(const f of o)if(f.kind!==i)throw new TypeError(`Cannot interpolate ${i} values with ${f.kind} values`);const s=Math.max(...o.map(f=>f.dimensions)),a=[null,null,null];if(i!=="scale")for(let f=0;f<s;f++){for(const p of o){const h=p.units[f];if(h!==null){if(a[f]===null){a[f]=h;continue}if(a[f]!==h)throw new TypeError(`Cannot interpolate ${i} values with different units on axis ${f+1}: ${a[f]} and ${h}`)}}if(a[f]===null)throw new TypeError(`Cannot interpolate ${i} values because axis ${f+1} has no unit`)}const l=[0,0,0];for(let f=0;f<s;f++)l[f]=Nh({input:e,inputRange:t,outputRange:o.map(p=>p.values[f]),options:r});return _I({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},WI=({input:e,inputRange:t,outputRange:n,options:r})=>{const o=BI(n);return new Array(o).fill(!0).map((i,s)=>Nh({input:e,inputRange:t,outputRange:n.map(a=>a[s]),options:r}))};function VI(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 ny(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 HI(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 UI(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 ZI(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 os(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(ny("inputRange",t),VI(t),HI(r==null?void 0:r.easing,t.length),UI(r==null?void 0:r.posterize),ZI(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 zI({input:e,inputRange:t,outputRange:n,options:r})}if(n.every(i=>Array.isArray(i)))return WI({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 ny("outputRange",n),Nh({input:e,inputRange:t,outputRange:n,options:r})}var KI=({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}`)},YI=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)}},GI={damping:10,mass:1,stiffness:100,overshootClamping:!1},Pd={};function XI({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(Pd[p])return Pd[p];const h=-s,g=r-i,w=l/(2*Math.sqrt(f*c)),x=Math.sqrt(f/c),k=x*Math.sqrt(1-w**2),m=a/1e3,v=Math.sin(k*m),y=Math.cos(k*m),S=Math.exp(-w*x*m),b=S*(v*((h+w*x*g)/k)+g*y),E=r-b,C=w*x*b-S*(y*(h+w*x*g)-k*g*v),j=Math.exp(-x*m),I=r-j*(g+(h+x*g)*m),P=j*(h*(m*x-1)+m*g*x*x),L={toValue:r,prevPosition:i,lastTimestamp:t,current:w<1?E:I,velocity:w<1?C:P};return Pd[p]=L,L}var $d={};function X1({frame:e,fps:t,config:n={}}){const i=[e,t,n.damping,n.mass,n.overshootClamping,n.stiffness].join("-");if($d[i])return $d[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=XI({animation:s,now:f,config:{...GI,...n}})}return $d[i]=s,s}var Md=new Map;function q1({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(Md.has(r))return Md.get(r);cc(e,"to the measureSpring() function");let o=0,i=0;const s=()=>X1({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 Md.set(r,i),i}function pp({frame:e,fps:t,config:n={},from:r=0,to:o=1,durationInFrames:i,durationRestThreshold:s,delay:a=0,reverse:l=!1}){YI(i),KI({frame:e,durationInFrames:1/0,allowFloats:!0}),cc(t,"to spring()");const c=l||typeof i<"u",f=c?q1({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=X1({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:os(k,[0,1],[r,o])}var ry=e=>Math.min(1,Math.max(0,e)),Ts=30;class Au{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 Au.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=ry(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:pp(t?{fps:Ts,frame:i*q1({fps:Ts,config:r,threshold:n}),config:r}:{fps:Ts,frame:i*Ts,config:r,durationInFrames:Ts,durationRestThreshold:n}),{remotionShouldExtendRight:t})}static bounce(t){const n=ry(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 H1(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+",yl=qn+"%";function vl(...e){return"\\(\\s*("+e.join(")\\s*,\\s*(")+")\\s*\\)"}var wl="(?:none|[-+]?\\d*\\.?\\d+(?:%|deg|rad|grad|turn)?)";function Rs(e){return new RegExp(e+"\\(\\s*("+wl+")\\s+("+wl+")\\s+("+wl+")(?:\\s*\\/\\s*("+wl+"))?\\s*\\)")}function qI(){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"+vl(qn,qn,qn)),e.rgba=new RegExp("rgba"+vl(qn,qn,qn,qn)),e.hsl=new RegExp("hsl"+vl(qn,yl,yl)),e.hsla=new RegExp("hsla"+vl(qn,yl,yl,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=Rs("oklch"),e.oklab=Rs("oklab"),e.lab=Rs("lab"),e.lch=Rs("lch"),e.hwb=Rs("hwb")),e}function Ni(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 oy(e,t,n){const r=n<.5?n*(1+t):n+t-n*t,o=2*n-r,i=Ni(o,r,e+1/3),s=Ni(o,r,e),a=Ni(o,r,e-1/3);return Math.round(i*255)<<24|Math.round(s*255)<<16|Math.round(a*255)<<8}function ri(e){const t=Number.parseInt(e,10);return t<0?0:t>255?255:t}function iy(e){return(Number.parseFloat(e)%360+360)%360/360}function sy(e){const t=Number.parseFloat(e);return t<0?0:t>1?255:Math.round(t*255)}function xl(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 _d(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 Fs(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 Li(e){return e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055}function bl(e){return Math.max(0,Math.min(1,e))}function Ps(e,t,n,r){const o=Math.round(bl(e)*255),i=Math.round(bl(t)*255),s=Math.round(bl(n)*255),a=Math.round(bl(r)*255);return(o<<24|i<<16|s<<8|a)>>>0}function ay(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[Li(c),Li(f),Li(p)]}function ly(e,t,n){const r=.008856451679035631,o=24389/27,i=.95047,s=1,a=1.08883,l=(e+16)/116,c=t/500+l,f=l-n/200,p=c*c*c,h=f*f*f,g=p>r?p:(116*c-16)/o,w=e>o*r?((e+16)/116)**3:e/o,x=h>r?h:(116*f-16)/o,k=g*i,m=w*s,v=x*a,y=3.2404542*k-1.5371385*m-.4985314*v,S=-.969266*k+1.8760108*m+.041556*v,b=.0556434*k-.2040259*m+1.0572252*v;return[Li(y),Li(S),Li(b)]}function JI(e,t,n){if(t+n>=1){const c=t/(t+n);return[c,c,c]}const r=1,o=0,i=Ni(o,r,e+1/3),s=Ni(o,r,e),a=Ni(o,r,e-1/3),l=1-t-n;return[i*l+t,s*l+t,a*l+t]}var uy={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 QI(e){const t=qI();let n;if(t.hex6&&(n=t.hex6.exec(e)))return Number.parseInt(n[1]+"ff",16)>>>0;if(uy[e]!==void 0)return uy[e];if(t.rgb&&(n=t.rgb.exec(e)))return(ri(n[1])<<24|ri(n[2])<<16|ri(n[3])<<8|255)>>>0;if(t.rgba&&(n=t.rgba.exec(e)))return(ri(n[1])<<24|ri(n[2])<<16|ri(n[3])<<8|sy(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(oy(iy(n[1]),xl(n[2]),xl(n[3]))|255)>>>0;if(t.hsla&&(n=t.hsla.exec(e)))return(oy(iy(n[1]),xl(n[2]),xl(n[3]))|sy(n[4]))>>>0;if(t.oklch&&(n=t.oklch.exec(e))){const r=Nn(n[1],1),o=Nn(n[2],.4),i=_d(n[3]),s=Fs(n[4]),a=i*Math.PI/180,[l,c,f]=ay(r,o*Math.cos(a),o*Math.sin(a));return Ps(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=Fs(n[4]),[a,l,c]=ay(r,o,i);return Ps(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=Fs(n[4]),[a,l,c]=ly(r,o,i);return Ps(a,l,c,s)}if(t.lch&&(n=t.lch.exec(e))){const r=Nn(n[1],100),o=Nn(n[2],150),i=_d(n[3]),s=Fs(n[4]),a=i*Math.PI/180,[l,c,f]=ly(r,o*Math.cos(a),o*Math.sin(a));return Ps(l,c,f,s)}if(t.hwb&&(n=t.hwb.exec(e))){const r=_d(n[1]),o=Nn(n[2],1),i=Nn(n[3],1),s=Fs(n[4]),[a,l,c]=JI(r/360,o,i);return Ps(a,l,c,s)}throw new Error(`invalid color string ${e} provided`)}var cy=e=>(e>>24&255)/255,ej=e=>e>>16&255,tj=e=>e>>8&255,nj=e=>e&255,rj=(e,t,n,r)=>`rgba(${e}, ${t}, ${n}, ${r})`;function oj(e){const t=QI(e);return(t<<24|t>>>8)>>>0}var ij=(e,t,n,r)=>{const[o,i,s,a]=[ej,tj,nj,cy].map(l=>{const c=os(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===cy?Number(c.toFixed(3)):Math.round(c)});return rj(o,i,s,a)},sj=(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=>oj(i));return ij(e,t,o,r)},dy=({easing:e,forceSpringAllowTail:t})=>{switch(e.type){case"linear":return Au.linear;case"spring":return Au.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 H1(e.x1,e.y1,e.x2,e.y2);default:throw new TypeError(`Unsupported easing: ${JSON.stringify(e)}`)}},Oa=({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 sj(e,l,c,{easing:o.map(f=>dy({easing:f,forceSpringAllowTail:t})),posterize:n.posterize})}catch{return null}}if(s!=="interpolate")return null;try{return os(e,l,c,{easing:o.map(f=>dy({easing:f,forceSpringAllowTail:t})),extrapolateLeft:i.left,extrapolateRight:i.right,output:n.output,posterize:n.posterize})}catch{return null}},bc=({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=Oa({forceSpringAllowTail:null,frame:t,status:e.status});return n===null?{type:"none"}:{type:"resolved",value:n}},J1=({propStatus:e,dragOverrideValue:t,defaultValue:n,frame:r=null,shouldResortToDefaultValueIfUndefined:o=!1})=>{const i=bc({dragOverrideValue:t,frame:r});return i.type==="resolved"&&i.value!==void 0?i.value:e.status==="keyframed"?r!==null?Oa({forceSpringAllowTail:null,frame:r,status:e}):o?n:void 0:e.codeValue===void 0&&o?n:e.codeValue},Lh=d.createContext({overrideIdToNodePathMappings:{}}),aj=d.createContext({setOverrideIdToNodePath:()=>{throw new Error("OverrideIdsToNodePathsSettersContext not initialized")}}),lj=({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=bc({dragOverrideValue:s,frame:r});a.type==="resolved"&&(o[i]=a.value)}return{params:o,effectKey:e.definition.calculateKey(o)}},uj=(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=Oa({forceSpringAllowTail:null,frame:t,status:i});s!==null&&(n[o]=s,r=!0)}}return r?n:null},Da=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)},Q1=({propStatuses:e,nodePath:t,effectIndex:n})=>{const r=e[Rr(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"}},eb=(e,t)=>{const n=e[Rr(t)];if(n&&n.canUpdate)return n.props},za=({effects:e,overrideId:t})=>{const n=d.useRef(null),{propStatuses:r}=d.useContext(yc),{getEffectDragOverrides:o}=d.useContext(wc),i=Nt(),{overrideIdToNodePathMappings:s}=d.useContext(Lh),a=n.current,l=t?s[t]??null:null,c=e.map((h,g)=>{if(l===null)return{descriptor:h,params:h.params,effectKey:h.effectKey};const w=Q1({propStatuses:r,nodePath:l,effectIndex:g}),x=w.type==="can-update-effect"?uj(w.props,i):null,k=o(l,g),m=Object.keys(k).length===0?null:k,{params:v,effectKey:y}=lj({descriptor:h,propStatusOverrides:x,dragOverrides:m,frame:i});return{descriptor:h,params:v,effectKey:y}});if(a!==null&&a.length===c.length&&a.every((h,g)=>h.definition===c[g].descriptor.definition&&h.effectKey===c[g].effectKey))return a;const p=c.map(({descriptor:h,params:g,effectKey:w})=>({definition:h.definition,effectKey:w,params:g,memoized:!0}));return n.current=p,p},Oh=(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,Oh(s,t))}else n[r]=o}return n},Dh=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=Dh(i);for(const a of Object.keys(s))n(a,s[a])}}return t},tb=({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]},fy={type:"linear"},cj=({insertedKeyframeIndex:e,easingLength:t,keyframeCount:n})=>!(e>0&&e<n-1)||t===0?null:Math.min(e-1,t-1),dj=e=>({type:"static",value:e}),fj=({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=cj({insertedKeyframeIndex:s,easingLength:i.length,keyframeCount:o.length}),l=a===null?fy:i[a];i.splice(s,0,l)}for(;i.length<o.length-1;)i.push(fy);return i.length>o.length-1&&(i.length=o.length-1),{type:"keyframed",status:{...e,keyframes:o,easing:i}}},pj=e=>{if((e==null?void 0:e.type)==="static")return e.value},hj=e=>e!==null&&e.status==="keyframed",nb=(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=nb(r,t);if(o)return o}},rb=({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=nb(e,l);if((f==null?void 0:f.type)==="hidden")continue;let p;if(c===null)p=t[l];else if(hj(c))if((f==null?void 0:f.type)==="array"||(f==null?void 0:f.keyframable)===!1)p=t[l];else{const h=bc({dragOverrideValue:n[l],frame:o});h.type==="resolved"?p=h.value:o!==null?p=Oa({forceSpringAllowTail:null,frame:o,status:c})??t[l]:p=t[l]}else c.status==="computed"?p=t[l]:p=J1({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(wa)&&(p=`${window.remotion_staticBase}/${p.slice(wa.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=tb({schema:e,key:l,value:i[l]});for(const f of c)s.add(f)}return{merged:i,propsToDelete:s}},ob=(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},ib=({flatSchema:e,key:t,props:n})=>{var o;const r=ob(n,t);if(!(((o=e[t])==null?void 0:o.type)==="text-content"&&typeof r!="string"))return r},mj=(e,t,n)=>{const r={};for(const o of t)r[o]=n?ib({flatSchema:n,key:o,props:e}):ob(e,o);return r},gj=(e,t)=>Object.keys(Oh(e,n=>t[n])),yj=({flatSchema:e,props:t,valuesDotNotation:n,schemaKeys:r,propsToDelete:o})=>{var a;const i={...t};for(const l of r){const c=n[l];if(((a=e[l])==null?void 0:a.type)==="text-content"&&c===void 0)continue;const f=l.split(".");if(f.length===1){i[l]=c;continue}let p=i;for(let h=0;h<f.length-1;h++){const g=f[h];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 wI(i,s),i},py={},zr=({Component:e,componentName:t,componentIdentity:n,schema:r,supportsEffects:o})=>{const i=dI(r),s=Dh(i),a=Object.keys(s),l=d.forwardRef((c,f)=>{const p=vt();if(!p.isStudio||p.isReadOnlyStudio||p.isRendering)return ge.createElement(e,{...c,controls:null,ref:f});const{propStatuses:h}=d.useContext(yc),{getDragOverrides:g}=d.useContext(wc),w=d.useContext(Lh),x=Nt();if(c.controls)return ge.createElement(e,{...c,ref:f});const[k]=d.useState(()=>{const{stack:I}=c;if(!I)return String(Math.random());const P=py[I];if(P)return P;const L=String(Math.random());return py[I]=L,L}),m=w.overrideIdToNodePathMappings[k]??null,v=a.map(I=>ib({flatSchema:s,key:I,props:c})),y=d.useMemo(()=>mj(c,a,s),v),S=d.useMemo(()=>({schema:i,currentRuntimeValueDotNotation:y,overrideId:k,supportsEffects:o,componentIdentity:n,componentName:t}),[y,k]),{merged:b,propsToDelete:E}=d.useMemo(()=>rb({schema:i,currentValue:y,overrideValues:m===null?{}:g(m),propStatus:m===null?void 0:eb(h,m),frame:x}),[y,g,m,h,x]),C=gj(i,b),j=yj({flatSchema:s,props:c,valuesDotNotation:b,schemaKeys:C,propsToDelete:E});return ge.createElement(e,{...j,controls:S,ref:f})});return l.displayName=`withInteractivitySchema(${e.displayName||e.name||"Component"})`,l},Ad=[],vj=({from:e=0,trimBefore:t=0,freeze:n,durationInFrames:r=1/0,children:o,name:i,height:s,width:a,showInTimeline:l=!0,hidden:c=!1,controls:f,_remotionInternalEffects:p,_remotionInternalLoopDisplay:h,_remotionInternalStack:g,_remotionInternalDocumentationLink:w,_remotionInternalSingleChildComponent:x,_remotionInternalPremountDisplay:k,_remotionInternalPostmountDisplay:m,_remotionInternalIsMedia:v,outlineRef:y,...S},b)=>{const{layout:E="absolute-fill"}=S,[C]=d.useState(()=>String(Math.random())),j=d.useContext(Rt),{rootId:I}=bo(),P=j?j.cumulatedFrom+j.relativeFrom:0,L=lc();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 S.style<"u")throw new TypeError('If layout="none", you may not pass a style. Passed: '+JSON.stringify(S.style));if(typeof r!="number")throw new TypeError(`You passed to durationInFrames an argument of type ${typeof r}, but it must be a number.`);if(r<=0)throw new TypeError(`durationInFrames must be positive, but got ${r}`);if(typeof e!="number")throw new TypeError(`You passed to the "from" props of your <Sequence> an argument of type ${typeof e}, but it must be a number.`);if(!Number.isFinite(e))throw new TypeError(`The "from" prop of a sequence must be finite, but got ${e}.`);if(typeof t!="number")throw new TypeError(`You passed to the "trimBefore" prop of your <Sequence> an argument of type ${typeof t}, but it must be a number.`);if(t<0)throw new TypeError(`The "trimBefore" prop of <Sequence /> must be greater than or equal to 0, but got ${t}.`);if(Number.isNaN(t))throw new TypeError('The "trimBefore" prop of <Sequence /> must be a real number, but it is NaN.');if(!Number.isFinite(t))throw new TypeError(`The "trimBefore" prop of <Sequence /> must be finite, but it is ${t}.`);if(typeof n<"u"&&n!==null){if(typeof n!="number")throw new TypeError(`The "freeze" prop of <Sequence /> must be a number, but is of type ${typeof n}.`);if(Number.isNaN(n))throw new TypeError('The "freeze" prop of <Sequence /> must be a real number, but it is NaN.');if(!Number.isFinite(n))throw new TypeError(`The "freeze" prop of <Sequence /> must be finite, but it is ${n}.`)}const W=So(),$=ht(),A=e-t,U=((j==null?void 0:j.absoluteFrom)??0)+A,z=j?Math.min(j.durationInFrames-A,r):r,O=Math.max(0,Math.min($.durationInFrames-e,z)),{registerSequence:R,unregisterSequence:Z}=d.useContext(rs),B=d.useRef(null),ie=S.layout==="none"?y??null:y??B,ue=d.useMemo(()=>(j==null?void 0:j.premounting)||!!S._remotionInternalIsPremounting,[S._remotionInternalIsPremounting,j==null?void 0:j.premounting]),me=d.useMemo(()=>(j==null?void 0:j.postmounting)||!!S._remotionInternalIsPostmounting,[S._remotionInternalIsPostmounting,j==null?void 0:j.postmounting]),re=P+A,ee=j?j.cumulatedFrom+j.relativeFrom:0,K=j?ee-j.cumulatedNegativeFrom:0,ce=Math.max(0,K,re),q=re-ce,X=d.useMemo(()=>({absoluteFrom:U,cumulatedFrom:P,relativeFrom:A,cumulatedNegativeFrom:q,durationInFrames:O,parentFrom:(j==null?void 0:j.relativeFrom)??0,id:C,height:s??(j==null?void 0:j.height)??null,width:a??(j==null?void 0:j.width)??null,premounting:ue,postmounting:me,premountDisplay:k??null,postmountDisplay:m??null}),[P,U,A,O,j,C,s,a,ue,me,k,m,q]),N=d.useMemo(()=>i??"",[i]),G=w??"https://www.remotion.dev/docs/sequence",T=vt(),M=d.useContext(xc),Q=(S==null?void 0:S.stack)??null,ne=d.useRef(null);ne.current=g??Q;const V=typeof n=="number"?n:null,se=t===0?null:t,_=(j==null?void 0:j.cumulatedNegativeFrom)??0,Y=v&&v.type!=="image"?v.data.startMediaFrom+_-q:null,fe=v&&v.type!=="image"?v.data.startMediaFrom+_:null,we=v&&v.type!=="image"&&fe!==null?V===null?null:fe+(h?V%h.durationInFrames:V)*v.data.playbackRate:null;d.useEffect(()=>{if(T.isStudio)return v?(v.type==="image"?R({type:"image",controls:f??null,effects:p??Ad,displayName:N,documentationLink:G,duration:O,from:e,trimBefore:se,id:C,loopDisplay:h,nonce:L.get(),parent:(j==null?void 0:j.id)??null,postmountDisplay:m??null,premountDisplay:k??null,rootId:I,showInTimeline:l,src:v.src,getStack:()=>ne.current,refForOutline:ie??null,isInsideSeries:M,frozenFrame:V,singleChildComponent:x??null}):R({type:v.type,controls:f??null,effects:p??Ad,displayName:N,documentationLink:G,doesVolumeChange:v.data.doesVolumeChange,duration:O,from:e,trimBefore:se,id:C,loopDisplay:h,nonce:L.get(),parent:(j==null?void 0:j.id)??null,playbackRate:v.data.playbackRate,postmountDisplay:m??null,premountDisplay:k??null,rootId:I,showInTimeline:l,src:v.data.src,getStack:()=>ne.current,startMediaFrom:Y??v.data.startMediaFrom,mediaFrameAtSequenceZero:fe,volume:v.data.volumes,refForOutline:ie??null,isInsideSeries:M,frozenFrame:V,frozenMediaFrame:we,singleChildComponent:x??null}),()=>{Z(C)}):(R({from:e,trimBefore:se,duration:O,id:C,displayName:N,documentationLink:G,parent:(j==null?void 0:j.id)??null,type:"sequence",rootId:I,showInTimeline:l,nonce:L.get(),loopDisplay:h,getStack:()=>ne.current,premountDisplay:k??null,postmountDisplay:m??null,controls:f??null,effects:p??Ad,refForOutline:ie??null,isInsideSeries:M,frozenFrame:V,singleChildComponent:x??null}),()=>{Z(C)})},[r,C,i,R,N,Z,j==null?void 0:j.id,O,I,e,t,se,l,L,h,k,m,T.isStudio,f,p,v,G,ie,M,V,Y,fe,we,x]);const Ee=Math.ceil(P+e+r-1),Te=W<P+e||W>Ee?null:o,ze=Te===null||typeof n>"u"||n===null?Te:u.jsx(Aa,{frame:n,children:Te}),be=S.layout==="none"?void 0:S.style,de=d.useCallback(Ae=>{B.current=Ae,typeof b=="function"?b(Ae):b&&(b.current=Ae)},[b]),he=d.useMemo(()=>({flexDirection:void 0,...a?{width:a}:{},...s?{height:s}:{},...be??{}}),[s,be,a]);if(b!==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:X,children:ze===null?null:S.layout==="none"?ze:u.jsx(Fn,{ref:de,style:he,className:S.className,children:ze})})},wj=d.forwardRef(vj),xj=(e,t)=>{if(e.layout==="none")throw new Error('`<Sequence>` with `premountFor` and `postmountFor` props does not support layout="none"');const{style:n,from:r=0,durationInFrames:o=1/0,premountFor:i=0,postmountFor:s=0,styleWhilePremounted:a,styleWhilePostmounted:l,...c}=e,{freezeFrame:f,isPremountingOrPostmounting:p,postmountingActive:h,premountingActive:g,premountingStyle:w}=La({from:r,durationInFrames:o,premountFor:i,postmountFor:s,style:n??null,styleWhilePremounted:a??null,styleWhilePostmounted:l??null,hideWhilePremounted:"opacity"});return u.jsx(Aa,{frame:f,active:p,children:u.jsx(Sc,{ref:t,from:r,durationInFrames:o,style:w??void 0,_remotionInternalPremountDisplay:i,_remotionInternalPostmountDisplay:s,_remotionInternalIsPremounting:g,_remotionInternalIsPostmounting:h,...c})})},bj=d.forwardRef(xj),Sj=(e,t)=>{const n=vt(),{fps:r}=ht();if(e.layout!=="none"&&!n.isRendering){const o=e.premountFor;if(o||e.postmountFor)return u.jsx(bj,{ref:t,...e,premountFor:o})}return u.jsx(wj,{...e,ref:t})},Sc=d.forwardRef(Sj),sb=Sc,Ft=zr({Component:Sc,componentName:"<Sequence>",componentIdentity:"dev.remotion.remotion.Sequence",schema:Zi,supportsEffects:!1});zr({Component:Sc,componentName:"<Sequence>",componentIdentity:null,schema:pI,supportsEffects:!1});var ab=(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)}},kj="https://remotion.dev/docs/troubleshooting/webgl2-context",lb=(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 ${kj}`,Ej=e=>new Error(lb("WebGL",e)),ub=e=>new Error(lb("WebGL2",e));class Cj{constructor(t,n){We(this,"width");We(this,"height");We(this,"pairs",new Map);We(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 ub("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 Ij=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},Sl=null,jj=()=>Sl||(Sl=(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()})(),Sl),cb=(e,t)=>({pool:new Cj(e,t),setupCache:new WeakMap,cleanupRegistry:[],currentRunId:0}),hp=e=>{e.currentRunId++;for(const t of e.cleanupRegistry)t.definition.cleanup(t.state)},Tj=(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},Ba=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=Ij(l);let f=t,p=null;if(c.length===0){if(t===r)return!0;const k=r.getContext("2d");if(!k)throw new Error("Failed to acquire 2D context for output canvas");return k.clearRect(0,0,o,i),k.drawImage(f,0,0,o,i),!0}let h=!1;for(const k of c)if(k.backend==="webgpu"){h=!0;break}const g=h?await jj():null;if(a())return!1;let w=!0;for(let k=0;k<c.length;k++){const m=c[k],[v,y]=e.pool.getPair(m.backend);let S=v;for(const E of m.effects){const C=E.definition,j=Tj(e,C,S);C.apply({source:f,target:S,state:j,params:E.params,width:o,height:i,gpuDevice:g,flipSourceY:m.backend==="webgl2"?w:!1}),m.backend==="webgl2"&&(w=!0,e.pool.assertContextNotLost(S)),f=S,S=S===v?y:v}p=f??p;const b=c[k+1];if(b&&b.backend!==m.backend&&p)if(m.backend==="2d"&&b.backend==="webgl2")f=p,w=!0;else{const E=await createImageBitmap(p);if(a())return E.close(),!1;f=E,b.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},Wa=()=>{const e=d.useRef(null),t=d.useRef(null);return d.useEffect(()=>()=>{e.current&&hp(e.current)},[]),d.useMemo(()=>({get:(n,r)=>((!t.current||t.current.width!==n||t.current.height!==r)&&(e.current&&hp(e.current),e.current=cb(n,r),t.current={width:n,height:r}),e.current)}),[])},Rj=({width:e,height:t,fit:n,className:r,style:o,effects:i,...s},a)=>{const l=d.useRef(null),c=Wa(),f=d.useMemo(()=>typeof document>"u"?null:document.createElement("canvas"),[]),p=d.useCallback(h=>{const g=l.current,w=e??h.displayWidth,x=t??h.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(h,...ab(n,{height:h.displayHeight,width:h.displayWidth},{width:w,height:x})),g.width=w,g.height=x,Ba({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 h=(g=l.current)==null?void 0:g.getContext("2d");if(!h)throw new Error("Could not get 2d context");h.clearRect(0,0,l.current.width,l.current.height)}}),[p]),u.jsx("canvas",{ref:l,className:r,style:o,...s})},Fj=ge.forwardRef(Rj),db=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}},Pj=5,hy=({loopBehavior:e,durationFound:t,timeInSec:n})=>e==="loop"?t?n%t:n:Math.min(n,t||1/0),$j=async({resolvedSrc:e,signal:t,requestInit:n,currentTime:r,initialLoopBehavior:o})=>{const{decoder:i,selectedTrack:s}=await db({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,m)=>{const v=Math.abs(k.timeInSeconds-g),y=Math.abs(m.timeInSeconds-g);return v-y});for(let k=0;k<x.length;k++){if(k<Pj)continue;const m=x[k];m.frame=null}},p=async({timeInSec:g,loopBehavior:w})=>{const x=hy({durationFound:l,loopBehavior:w,timeInSec:g}),m=a.filter(y=>y.timeInSeconds<=x).map(y=>y.frameIndex).reduce((y,S)=>Math.max(y,S),0);let v=m;for(;;){const y=await c(v);if(v++,!y.frame)throw new Error("No frame found");if(!y.frame.duration||(v===s.frameCount&&l===null&&(l=(y.frame.timestamp+y.frame.duration)/1e6),y.timeInSeconds>x||v===s.frameCount))break}s.frameCount-m<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=hy({loopBehavior:w,durationFound:l,timeInSec:g});await p({timeInSec:x,loopBehavior:w});const m=a.filter(v=>v.frame).reduce((v,y)=>{const S=Math.abs(v.timeInSeconds-x),b=Math.abs(y.timeInSeconds-x);return S<b?v:y});if(!m.frame)throw new Error("No frame found");return m},frameCount:s.frameCount}},Mj=({frame:e,playbackRate:t,fps:n})=>e*t/n,_j=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})},Aj=e=>typeof window>"u"?e:new URL(e,window.origin).href,Nj={src:{type:"asset",default:void 0,description:"Source",keyframable:!1},...Dr,...ns,playbackRate:{type:"number",min:0,max:10,step:.1,default:1,description:"Playback rate",hiddenFromList:!1,keyframable:!1},...kr,...Eo,...ko},Lj=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},fb=d.forwardRef(({src:e,width:t,height:n,onError:r,loopBehavior:o="loop",playbackRate:i=1,fit:s="fill",requestInit:a,effects:l,controls:c,...f},p)=>{const h=Aj(e),[g,w]=d.useState(null),{delayRender:x,continueRender:k}=or(),[m]=d.useState(()=>x(`Rendering <AnimatedImage/> with src="${h}"`)),v=Nt(),{fps:y}=ht(),S=Mj({frame:v,playbackRate:i,fps:y}),b=d.useRef(S);b.current=S;const E=_j(a),C=d.useRef(a);C.current=a;const j=d.useRef(null),I=za({effects:l,overrideId:(c==null?void 0:c.overrideId)??null});d.useImperativeHandle(p,()=>{var W;const L=(W=j.current)==null?void 0:W.getCanvas();if(!L)throw new Error("Canvas ref is not set");return L},[]);const[P]=d.useState(()=>o);return d.useEffect(()=>{const L=new AbortController;let W=!1,$=!1;const A=()=>{$||($=!0,k(m))};return $j({resolvedSrc:h,signal:L.signal,requestInit:C.current,currentTime:b.current,initialLoopBehavior:P}).then(U=>{if(W){U.close();return}w(U),A()}).catch(U=>{if(!W){if(U.name==="AbortError"){A();return}r?(r==null||r(U),A()):xa(U)}}),()=>{W=!0,L.abort(),A()}},[h,m,r,E,P,k]),d.useEffect(()=>()=>{g==null||g.close()},[g]),d.useLayoutEffect(()=>{if(!g)return;const L=x(`Rendering frame at ${S} of <AnimatedImage src="${e}"/>`);let W=!1;return g.getFrame(S,o).then(async $=>{var U,z;if(W)return;if($===null){(U=j.current)==null||U.clear(),k(L);return}await((z=j.current)==null?void 0:z.draw($.frame))&&!W&&k(L)}).catch($=>{W||(r?(r($),k(L)):xa($))}),()=>{W=!0,k(L)}},[S,g,o,r,e,k,x,I,s,t,n]),u.jsx(Fj,{ref:j,width:t,height:n,fit:s,effects:I,...f})});fb.displayName="AnimatedImageContent";var Oj=({src:e,width:t,height:n,onError:r,fit:o,playbackRate:i,loopBehavior:s,id:a,className:l,style:c,durationInFrames:f,from:p,premountFor:h,postmountFor:g,styleWhilePremounted:w,styleWhilePostmounted:x,requestInit:k,effects:m=[],controls:v,ref:y,...S})=>{const b=d.useRef(null),E=Da(m);d.useImperativeHandle(y,()=>b.current,[]);const{effectivePostmountFor:C,effectivePremountFor:j,freezeFrame:I,isPremountingOrPostmounting:P,postmountingActive:L,premountingActive:W,premountingStyle:$}=La({from:p??0,durationInFrames:f??1/0,premountFor:h??null,postmountFor:g??null,style:c??null,styleWhilePremounted:w??null,styleWhilePostmounted:x??null,hideWhilePremounted:"display-none"}),A=Lj(S),U={src:e,width:t,height:n,onError:r,fit:o,playbackRate:i,loopBehavior:s,id:a,className:l,style:$??void 0,requestInit:k,...A};return u.jsx(Aa,{frame:I,active:P,children:u.jsx(Ft,{layout:"none",from:p??0,durationInFrames:f??1/0,name:"<AnimatedImage>",_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/animatedimage",controls:v,_remotionInternalEffects:E,_remotionInternalPremountDisplay:j||null,_remotionInternalPostmountDisplay:C||null,_remotionInternalIsPremounting:W,_remotionInternalIsPostmounting:L,...S,outlineRef:b,children:u.jsx(fb,{...U,ref:b,effects:m,controls:v})})})},pb=zr({Component:Oj,componentName:"<AnimatedImage>",componentIdentity:"dev.remotion.remotion.AnimatedImage",schema:Nj,supportsEffects:!0});pb.displayName="AnimatedImage";dn(pb);var Dj={type:"boolean",default:!1,description:"Disabled"},zj=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:Dj,...e.schema}};return(i={})=>(n(i),{definition:r,params:i,effectKey:r.calculateKey(i),memoized:!1})},Bj=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.')},Wj=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")},hb=e=>{e.type==="artifact"&&(Bj(e.filename),e.contentType!=="thumbnail"&&Wj(e.content))},Jo=d.createContext({registerRenderAsset:()=>{},unregisterRenderAsset:()=>{},renderAssets:[]}),Vj=({children:e,collectAssets:t})=>{const[n,r]=d.useState([]),o=d.useRef([]),i=d.useCallback(l=>{hb(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(Jo.Provider,{value:a,children:e})},br=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,kc=({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))},mb=d.createContext(null),Hj=()=>ge.useContext(mb),Ec=({durationInFrames:e,times:t=1/0,children:n,name:r,showInTimeline:o,...i})=>{const s=Nt(),{durationInFrames:a}=ht();if(uc(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(mb.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})})};Ec.useLoop=Hj;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)},Cc=d.createContext({}),my={},Nd=[],gb=({children:e})=>{const[t,n]=d.useState(()=>my);return d.useEffect(()=>{const r=()=>{n(my)};return Nd.push(r),()=>{Nd=Nd.filter(o=>o!==r)}},[]),u.jsx(Cc.Provider,{value:t,children:e})},yb=e=>{const t=e.indexOf("#");return t===-1?null:t},Uj=e=>{const t=yb(e);return t===null?e:e.slice(0,t)},Qo=e=>{const t=d.useContext(Cc),n=yb(e),r=Uj(e);return t[r]?n!==null?t[r]+e.slice(n):t[r]:e},Ic=(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`)},Zj=(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.")},Kj=(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.")},jc=({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"?Kj(n,r):(typeof e<"u"||typeof t<"u")&&Zj(e,t)},Tc=({startFrom:e,endAt:t,trimBefore:n,trimAfter:r})=>({trimBeforeValue:n??e??void 0,trimAfterValue:r??t??void 0}),Yj=(e,t)=>{switch(t.type){case"got-duration":{const n=br(t.src);return e[n]===t.durationInSeconds?e:{...e,[n]:t.durationInSeconds}}default:return e}},zh=d.createContext({durations:{},setDurations:()=>{throw new Error("context missing")}}),vb=({children:e})=>{const[t,n]=d.useReducer(Yj,{}),r=d.useMemo(()=>({durations:t,setDurations:n}),[t]);return u.jsx(zh.Provider,{value:r,children:e})},Bh=({crossOrigin:e,requestsVideoFrame:t,isClientSideRendering:n})=>{if(e!=null)return e;if(n||t)return"anonymous"},Nu=({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())}})},Wh=({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}}},gy=!1,Gj=e=>{gy||(gy=!0,typeof window<"u"&&_t.warn({logLevel:e,tag:null},"AudioContext is not supported in this browser"))},Xj=({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 Gj(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])},qj=(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)}),Ld="data:audio/mp3;base64,/+MYxAAJcAV8AAgAABn//////+/gQ5BAMA+D4Pg+BAQBAEAwD4Pg+D4EBAEAQDAPg++hYBH///hUFQVBUFREDQNHmf///////+MYxBUGkAGIMAAAAP/29Xt6lUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV/+MYxDUAAANIAAAAAFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",Jj=(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},Qj=(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,is=d.createContext(null),Rc=d.createContext(null),eT=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}`)},wb=({children:e,audioLatencyHint:t,audioEnabled:n,previewSampleRate:r})=>{const o=Sr(),i=r??48e3;d.useEffect(()=>{typeof window>"u"||(window.remotion_sampleRate=i)},[i]);const s=Xj({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:S=>{f.current.forEach(b=>b(S))},subscribe:S=>(f.current.push(S),{remove:()=>{f.current=f.current.filter(b=>b!==S)}})}),[]),h=d.useRef({scheduledEndTime:null,mediaEndTime:null}),g=d.useRef(new Map),w=d.useCallback(S=>{g.current.delete(S)},[]),x=d.useMemo(()=>({node:S,mediaTimestamp:b,sourceOffset:E,scheduledTime:C,duration:j,offset:I,originalUnloopedMediaTimestamp:P})=>{if(!s)throw new Error("Audio context not found");const L=s.getState();if(L==="closed")return{type:"not-started",reason:"audio context is closed"};const W=eT(L);j>0&&(W?g.current.set(S,{scheduledTime:C,offset:I,duration:j}):S.start(C,I,j));const $=C+j/S.playbackRate.value,A=b+I-E,U=A+j,z=s.audioContext.baseLatency+s.audioContext.outputLatency,O=C-s.audioContext.currentTime,R=h.current,Z=R.scheduledEndTime!==null&&Math.abs(C-R.scheduledEndTime)>.001,B=R.mediaEndTime!==null&&Math.abs(A-R.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",Z?"color: red; font-weight: bold":"",C.toFixed(4),"",$.toFixed(4),B?"color: red; font-weight: bold":"",A.toFixed(4),"",U.toFixed(4),j<0||O<0?"color: red; font-weight: bold":"color: blue; font-weight: bold",j<0?"missed "+Math.abs(I).toFixed(2)+"s":Math.abs(O).toFixed(2)+(O<0?" delay":" ahead"),"","current="+s.audioContext.currentTime.toFixed(4),"offset="+I.toFixed(4),"latency="+z.toFixed(4),"state="+s.audioContext.state,P!==A?"original_ts="+P.toFixed(4):"","action="+(W?"schedule":"start"),""),R.scheduledEndTime=$,R.mediaEndTime=U,j>0?{type:"started",scheduledTime:C}:{type:"not-started",reason:"missed "+Math.abs(I).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((b,E)=>{E.start(b.scheduledTime,b.offset,b.duration)}),g.current.clear();const S=s.resume();return l.current=new Promise(b=>{qj(s.audioContext,o).then(b),S.catch(E=>{_t.warn({logLevel:o,tag:"audio"},"AudioContext resume rejected, continuing without audio sync",E),b()})}).finally(()=>{l.current=null}),S.catch(()=>{})},[s,o]),m=d.useCallback(()=>l.current,[]),v=d.useCallback(()=>!s||!a.current?Promise.resolve():(a.current=!1,s.suspend()),[s]),y=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:v,getIsResumingAudioContext:m,unscheduleAudioNode:w}),[s,c,p,x,k,v,m,w]);return u.jsx(is.Provider,{value:y,children:e})},xb=({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=Sr(),i=_a(),s=vt(),a=d.useContext(is),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 S=d.createRef();return{id:Math.random(),ref:S,mediaElementSourceNode:Wh({audioContext:l,ref:S})}}));for(const{mediaElementSourceNode:S}of f)S==null||S.setAudioContext(l);(ge.useInsertionEffect??ge.useLayoutEffect)(()=>()=>{requestAnimationFrame(()=>{f.forEach(({mediaElementSourceNode:S})=>{S==null||S.cleanup()})})},[f]);const h=d.useRef(new Array(t).fill(!1)),g=d.useCallback(()=>{f.forEach(({ref:S,id:b})=>{var j;const E=(j=n.current)==null?void 0:j.find(I=>I.id===b),{current:C}=S;if(C){if(E===void 0){C.src!==Ld&&(C.src=Ld);return}if(!E)throw new TypeError("Expected audio data to be there");Object.keys(E.props).forEach(I=>{Qj(I,E.props[I],C[I])&&(C[I]=E.props[I])})}})},[f]),w=d.useCallback(S=>{var z,O;const{aud:b,audioId:E,premounting:C,postmounting:j}=S,I=(z=n.current)==null?void 0:z.find(R=>R.audioId===E);if(I)return I;const P=h.current.findIndex(R=>R===!1);if(P===-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:L,ref:W,mediaElementSourceNode:$}=f[P],A=[...h.current];A[P]=L,h.current=A;const U={props:b,id:L,el:W,audioId:E,mediaElementSourceNode:$,premounting:C,audioMounted:!!W.current,postmounting:j,cleanupOnMediaTagUnmount:()=>{}};return(O=n.current)==null||O.push(U),g(),U},[t,f,g]),x=d.useCallback(S=>{var C;const b=[...h.current],E=f.findIndex(j=>j.id===S);if(E===-1)throw new TypeError(`Unknown audio ref ${S}; refs: ${f.map(j=>j.id).join(", ")}`);b[E]=!1,h.current=b,n.current=(C=n.current)==null?void 0:C.filter(j=>j.id!==S),g()},[f,g]),k=d.useCallback(({aud:S,audioId:b,id:E,premounting:C,postmounting:j})=>{var P;let I=!1;n.current=(P=n.current)==null?void 0:P.map(L=>{const W=!!L.el.current;return L.audioMounted!==W&&(I=!0),L.id===E?Jj(S,L.props)&&L.premounting===C&&L.postmounting===j?L.audioMounted===W?L:{...L,audioMounted:W}:(I=!0,{...L,props:S,premounting:C,postmounting:j,audioId:b,audioMounted:W}):L.audioMounted===W?L:{...L,audioMounted:W}}),I&&g()},[g]),m=d.useCallback(()=>{f.forEach(S=>{const b=n.current.find(E=>E.el===S.ref);b!=null&&b.premounting||Nu({mediaRef:S.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]),v=d.useMemo(()=>({registerAudio:w,unregisterAudio:x,updateAudio:k,playAllAudios:m,numberOfAudioTags:t}),[t,m,w,x,k]),y=d.useMemo(()=>f.map(({id:S,ref:b})=>u.jsx("audio",{ref:b,preload:"metadata",src:Ld},S)),[f]);return u.jsxs(Rc.Provider,{value:v,children:[y,e]})},tT=({aud:e,audioId:t,premounting:n,postmounting:r})=>{var l;const o=d.useContext(is),i=d.useContext(Rc),[s]=d.useState(()=>{if(i&&i.numberOfAudioTags>0)return i.registerAudio({aud:e,audioId:t,premounting:n,postmounting:r});const c=ge.createRef(),f=Wh({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=ge.useInsertionEffect??ge.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,Lu=(e,t)=>Math.abs(e-t)<nT,bb=(e,t)=>Math.round(e/t*100)/100,mp=()=>typeof window>"u"||!/AppleWebKit/.test(window.navigator.userAgent)?!1:!window.navigator.userAgent.includes("Chrome/"),Fc=()=>typeof window>"u"?!1:/iP(ad|od|hone)/i.test(window.navigator.userAgent)&&mp(),rT=e=>Fc()&&e.startsWith("blob:"),gp=({actualFrom:e,fps:t})=>bb(Math.max(0,-e),t),yp=({duration:e,fps:t})=>bb(e,t),oT=({actualSrc:e,actualFrom:t,duration:n,fps:r})=>{if(rT(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=${gp({actualFrom:t,fps:r})}`;return Number.isFinite(n)?`${i},${yp({duration:n,fps:r})}`:i},iT=({prevStartFrom:e,newStartFrom:t,prevDuration:n,newDuration:r,fps:o})=>{const i=gp({actualFrom:e,fps:o}),s=gp({actualFrom:t,fps:o}),a=yp({duration:n,fps:o}),l=yp({duration:r,fps:o});return!(s<i||l>a)},sT=({actualSrc:e,actualFrom:t,duration:n,fps:r})=>{const o=d.useRef(t),i=d.useRef(n),s=d.useRef(e);return(!iT({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})},yy=!1,aT=e=>{yy||(yy=!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."))},Sb=({mediaRef:e,volume:t,logLevel:n,source:r,shouldUseWebAudioApi:o})=>{var h,g,w;const i=d.useRef(null),s=d.useRef(t);s.current=t;const a=d.useContext(is);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,m;if(!l||!e.current||!o)return;if(e.current.playbackRate!==1&&mp()){aT(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 = ${(m=e.current)==null?void 0:m.playbackRate}`),()=>{i.current=null,x.disconnect(),r.get().disconnect()}},[n,e,l,r,o,c]),i.current){const x=t;Lu(i.current.gainNode.gain.value,x)||(i.current.gainNode.gain.value=x,_t.trace({logLevel:n,tag:null},`Setting gain to ${x} for ${(h=e.current)==null?void 0:h.src}`))}return(mp()&&e.current&&((g=e.current)==null?void 0:g.playbackRate)!==1||!o)&&e.current&&!Lu(t,(w=e.current)==null?void 0:w.volume)&&(e.current.volume=Math.min(t,1)),i},Ho=()=>{const e=d.useContext(Rt);return(e==null?void 0:e.cumulatedNegativeFrom)??0},ss=e=>{const t=Ec.useLoop(),n=Nt(),r=Ho();return e==="repeat"||t===null?n+r:n+r+t.durationInFrames*t.iteration},kb=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]},lT=({compositionDurationInFrames:e,playbackRate:t,trimBefore:n,trimAfter:r,parentSequenceDurationInFrames:o,loop:i})=>{if(i)return e;const s=kc({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},ei=({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)},vy={},uT=e=>{vy[e]||(console.warn(e),vy[e]=!0)},Eb=({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),[h]=d.useState(()=>e),g=lT({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((S,b)=>ei({frame:b+c,volume:e,mediaVolume:t})).join(","),[g,c,e,t]);d.useEffect(()=>{typeof e=="number"&&e!==h&&uT(`Remotion: The ${n} with src ${r} has changed it's volume. Prefer the callback syntax for setting volume to get better timeline display: https://www.remotion.dev/docs/audio/volume`)},[h,n,r,e]);const x=typeof e=="function",k=lc(),{rootId:m}=bo(),v=0-c+(i??0);return d.useMemo(()=>({volumes:w,duration:g,doesVolumeChange:x,nonce:k,rootId:m,finalDisplayName:o??kb(r),startMediaFrom:v,src:r,playbackRate:a}),[w,g,x,k,m,o,r,v,a])},Vh=({volume:e,mediaVolume:t,src:n,mediaType:r,playbackRate:o,displayName:i,id:s,getStack:a,showInTimeline:l,premountDisplay:c,postmountDisplay:f,loopDisplay:p,documentationLink:h,refForOutline:g})=>{const w=d.useContext(Rt),x=Ho(),{registerSequence:k,unregisterSequence:m}=d.useContext(rs),{durationInFrames:v}=ht(),y=Ho(),{volumes:S,duration:b,doesVolumeChange:E,nonce:C,rootId:j,finalDisplayName:I}=Eb({volume:e,mediaVolume:t,mediaType:r,src:n,displayName:i,trimAfter:void 0,trimBefore:void 0,playbackRate:o,sequenceDurationInFrames:v,mediaStartsAt:y,loop:!1}),{isStudio:P}=vt();d.useEffect(()=>{var L,W;if(!n)throw new Error("No src passed");if(!(!P&&((W=(L=window.process)==null?void 0:L.env)==null?void 0:W.NODE_ENV)!=="test")&&l)return k({type:r,src:n,id:s,duration:b,from:0,trimBefore:null,parent:(w==null?void 0:w.id)??null,displayName:I,documentationLink:h,rootId:j,volume:S,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}),()=>{m(s)}},[b,s,w,n,k,m,S,E,C,r,x,o,a,l,c,f,p,h,j,I,P,g])},cT=(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 m=k.filter(v=>v!==w);return m.length===k.length?k:m}))}}},[c]),h=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:h,listenForResume:g,buffering:f}),[p,f,h,g])},as=ge.createContext(null),Cb=({children:e})=>{const{logLevel:t,mountTime:n}=d.useContext(Xo),r=cT(t??"info",n);return u.jsx(as.Provider,{value:r,children:e})},Ib=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},Pc=()=>{const e=d.useContext(as),t=Sr(),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])},dT=()=>/^((?!chrome|android).)*safari/i.test(window.navigator.userAgent),fT=({mediaRef:e,mediaType:t,onVariableFpsVideoDetected:n,pauseWhenBuffering:r,logLevel:o,mountTime:i})=>{const s=d.useRef(!1),{delayPlayback:a}=Pc(),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&&!dT()){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(),h=()=>{p.unblock(),f.removeEventListener("ended",h,{once:!0}),f.removeEventListener("pause",h,{once:!0}),s.current=!1},g=()=>{h()};f.requestVideoFrameCallback((x,k)=>{Math.abs(k.mediaTime-c)>.5&&n(),h()}),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])},pT=e=>{const{duration:t,currentTime:n,paused:r,ended:o,desiredUnclampedTime:i,mediaTagTime:s,mediaTagLastUpdate:a,rvcTime:l,rvcLastUpdate:c,isVariableFpsVideo:f,acceptableTimeShift:p,lastSeekDueToShift:h,playing:g,playbackRate:w,mediaTagBufferingOrStalled:x,playerBuffering:k,absoluteFrame:m,onlyWarnForMediaSeekingError:v,isPremounting:y,isPostmounting:S,pauseWhenBuffering:b}=e,E=!Number.isNaN(t)&&Number.isFinite(t)?Math.min(t,i):i,C=Math.abs(E-s),j=l?Math.abs(E-l):null,I=c&&l>a?j:C,P=j&&!f?I:C;if(P>p&&h!==E)return{type:"seek-due-to-shift",shouldBeTime:E,why:`because time shift is too big. shouldBeTime = ${E}, isTime = ${s}, requestVideoCallbackTime = ${l}, timeShift = ${P}${f?", isVariableFpsVideo = true":""}, isPremounting = ${y}, isPostmounting = ${S}, pauseWhenBuffering = ${b}`,bufferUntilFirstFrame:g&&w>0,playReason:g&&r?"player is playing but media tag is paused, and just seeked":null,warnAboutNonSeekable:!v};const L=g?.15:.01,W=Math.abs(n-E)>L;if(!g||k&&!x)return{type:"seek-if-not-playing",shouldBeTime:E,why:W?`not playing or something else is buffering. time offset is over seek threshold (${L})`:null};if(!g||k)return{type:"none"};const A=r&&!o;if(A||m===0){const z=A?"media tag is paused":"absolute frame is 0";return{type:"play-and-seek",shouldBeTime:E,why:W?`is over timeshift threshold (threshold = ${L}) and ${z}`:null,playReason:`player is playing and ${z}`,bufferUntilFirstFrame:!f&&w>0}}return{type:"none"}},hT=e=>{var r,o;const t=ge.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},nu=({mediaRef:e,time:t,logLevel:n,why:r,mountTime:o})=>{const i=Fc()?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},mT=({element:e,shouldBuffer:t,isPremounting:n,isPostmounting:r,logLevel:o,mountTime:i,src:s})=>{const a=Pc(),[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 h=x=>{let k=!1;f.forEach(m=>{m(x),k=!0}),f=[],c(m=>(m&&(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(),m=()=>{h('"canplay" was fired'),w()},v=()=>{h('"error" event was occurred'),w()};p.addEventListener("canplay",m,{once:!0}),f.push(()=>{p.removeEventListener("canplay",m)}),p.addEventListener("error",v,{once:!0}),f.push(()=>{p.removeEventListener("error",v)}),f.push(y=>{Gt({logLevel:o,message:`Unblocking ${p.src} from buffer. Reason: ${y}`,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(),()=>{h("element was unmounted or prop changed")}},[a,s,e,n,r,o,t,i]),l},gT=({mediaRef:e,mediaType:t,lastSeek:n,onVariableFpsVideoDetected:r})=>{const o=d.useRef(null);return d.useEffect(()=>{const{current:i}=e;if(i)o.current={time:i.currentTime,lastUpdate:performance.now()};else{o.current=null;return}if(t!=="video"){o.current=null;return}const s=i;if(!s.requestVideoFrameCallback)return;let a=()=>{};const l=()=>{if(!s)return;const c=s.requestVideoFrameCallback((f,p)=>{if(o.current!==null){const h=Math.abs(o.current.time-p.mediaTime),g=Math.abs(n.current===null?1/0:p.mediaTime-n.current);h>.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},jb=({frame:e,playbackRate:t,startFrom:n})=>os(e,[-1,n,n+1],[-1,n,n+t]),Tb=({fps:e,frame:t,playbackRate:n,startFrom:r})=>{const o=jb({frame:t,playbackRate:n,startFrom:r}),i=1e3/e;return o*i/1e3},wy={},yT=(e,t)=>{if(e===null||e.seekable.length===0||e.seekable.length>1||wy[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),wy[e.src]=!0}},Rb=({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}=Ph(),h=Nt(),g=So(),[w]=F1(),x=d.useContext(as),{fps:k}=ht(),m=Ho(),v=d.useRef(null),y=d.useRef(null),S=Sr(),b=_a();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:S,tag:null},`Detected ${t} as a variable FPS video. Disabling buffering while seeking.`),E.current[t]=!0))},[S,t]),j=gT({mediaRef:e,mediaType:n,lastSeek:y,onVariableFpsVideoDetected:C}),I=hT(e),P=Tb({frame:h,playbackRate:r,startFrom:-m,fps:k}),L=mT({element:e,shouldBuffer:a,isPremounting:l,isPostmounting:c,logLevel:S,mountTime:b,src:t??null}),{bufferUntilFirstFrame:W,isBuffering:$}=fT({mediaRef:e,mediaType:n,onVariableFpsVideoDetected:C,pauseWhenBuffering:a,logLevel:S,mountTime:b}),A=r*p,U=(()=>{var ie;return(ie=e.current)!=null&&ie.duration?Math.min(e.current.duration,s??.65):s??.65})(),z=Ib(x);d.useEffect(()=>{var B,ie,ue,me,re;if((B=e.current)!=null&&B.paused)return;if(!w){Gt({logLevel:S,tag:"pause",message:`Pausing ${(ie=e.current)==null?void 0:ie.src} because ${l?"media is premounting":c?"media is postmounting":"Player is not playing"}`,mountTime:b}),(ue=e.current)==null||ue.pause();return}const R=L||$();x.buffering.current&&!R&&(Gt({logLevel:S,tag:"pause",message:`Pausing ${(me=e.current)==null?void 0:me.src} because player is buffering but media tag is not`,mountTime:b}),(re=e.current)==null||re.pause())},[$,L,x,z,l,S,e,n,b,w,c]);const O=vt();d.useLayoutEffect(()=>{const R=Math.max(0,A);e.current&&e.current.playbackRate!==R&&(e.current.playbackRate=R),e.current&&e.current.preservesPitch!==o&&(e.current.preservesPitch=o)},[e,A,o]),d.useEffect(()=>{var ie,ue;const R=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 ${R} element.`);const{current:Z}=e,B=pT({duration:Z.duration,currentTime:Z.currentTime,paused:Z.paused,ended:Z.ended,desiredUnclampedTime:P,mediaTagTime:I.current.time,mediaTagLastUpdate:I.current.lastUpdate,rvcTime:((ie=j.current)==null?void 0:ie.time)??null,rvcLastUpdate:((ue=j.current)==null?void 0:ue.lastUpdate)??null,isVariableFpsVideo:!!E.current[t],acceptableTimeShift:U,lastSeekDueToShift:v.current,playing:w,playbackRate:A,mediaTagBufferingOrStalled:L||$(),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"){y.current=nu({mediaRef:Z,time:B.shouldBeTime,logLevel:S,why:B.why,mountTime:b}),v.current=y.current,B.bufferUntilFirstFrame&&W(B.shouldBeTime),B.playReason!==null&&Nu({mediaRef:e,mediaType:n,onAutoPlayError:f,logLevel:S,mountTime:b,reason:B.playReason,isPlayer:O.isPlayer}),B.warnAboutNonSeekable&&yT(Z);return}if(B.type==="seek-if-not-playing"){B.why!==null&&(y.current=nu({mediaRef:Z,time:B.shouldBeTime,logLevel:S,why:B.why,mountTime:b}));return}B.why!==null&&(y.current=nu({mediaRef:Z,time:B.shouldBeTime,logLevel:S,why:B.why,mountTime:b})),Nu({mediaRef:e,mediaType:n,onAutoPlayError:f,logLevel:S,mountTime:b,reason:B.playReason,isPlayer:O.isPlayer}),B.bufferUntilFirstFrame&&W(B.shouldBeTime)}},[g,U,W,x.buffering,j,S,P,$,L,e,n,i,A,w,t,f,l,c,a,b,I,O.isPlayer])},Fb=({mediaRef:e,id:t,mediaType:n,onAutoPlayError:r,isPremounting:o,isPostmounting:i})=>{const{audioAndVideoTags:s,imperativePlaying:a}=bo(),l=Sr(),c=_a(),f=vt();d.useEffect(()=>{const p={id:t,play:h=>{if(a.current&&!(o||i))return Nu({mediaRef:e,mediaType:n,onAutoPlayError:r,logLevel:l,mountTime:c,reason:h,isPlayer:f.isPlayer})}};return s.current.push(p),()=>{s.current=s.current.filter(h=>h.id!==t)}},[s,t,e,n,r,a,o,i,l,c,f.isPlayer])},Hh=d.createContext({playerMuted:!1,mediaVolume:1}),Uh=d.createContext({setPlayerMuted:()=>{throw new Error("default")},setMediaVolume:()=>{throw new Error("default")}}),Zh=()=>{const{mediaVolume:e}=d.useContext(Hh),{setMediaVolume:t}=d.useContext(Uh);return d.useMemo(()=>[e,t],[e,t])},Kh=()=>{const{playerMuted:e}=d.useContext(Hh),{setPlayerMuted:t}=d.useContext(Uh);return d.useMemo(()=>[e,t],[e,t])},ls=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.`)},vT=(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=Sr(),{volume:o,muted:i,playbackRate:s,preservePitch:a,shouldPreMountAudioTags:l,src:c,onDuration:f,acceptableTimeShiftInSeconds:p,_remotionInternalNeedsDurationCalculation:h,_remotionInternalNativeLoopPassed:g,_remotionInternalStack:w,allowAmplificationDuringRender:x,name:k,pauseWhenBuffering:m,showInTimeline:v,loopVolumeCurveBehavior:y,stack:S,crossOrigin:b,delayRenderRetries:E,delayRenderTimeoutInMilliseconds:C,toneFrequency:j,useWebAudioApi:I,onError:P,onNativeError:L,audioStreamIndex:W,...$}=e,[A]=Zh(),[U]=Kh(),z=ss(y??"repeat");if(!c)throw new TypeError("No 'src' was passed to <Html5Audio>.");const O=Qo(c),R=d.useContext(Rt),[Z]=d.useState(()=>String(Math.random())),B=ei({frame:z,volume:o,mediaVolume:A});ls(B);const ie=Bh({crossOrigin:b,requestsVideoFrame:!1,isClientSideRendering:!1}),ue=d.useMemo(()=>({muted:i||U||B<=0,src:O,loop:g,crossOrigin:ie,...$}),[g,U,i,$,O,B,ie]),me=d.useMemo(()=>`audio-${qo(c??"")}-${R==null?void 0:R.relativeFrom}-${R==null?void 0:R.cumulatedFrom}-${R==null?void 0:R.durationInFrames}-muted:${e.muted}-loop:${e.loop}`,[c,R==null?void 0:R.relativeFrom,R==null?void 0:R.cumulatedFrom,R==null?void 0:R.durationInFrames,e.muted,e.loop]),{el:re,mediaElementSourceNode:ee,cleanupOnMediaTagUnmount:K}=tT({aud:ue,audioId:me,premounting:!!(R!=null&&R.premounting),postmounting:!!(R!=null&&R.postmounting)}),ce=d.useCallback(()=>w??null,[w]);Vh({volume:o,mediaVolume:A,src:c,mediaType:"audio",playbackRate:s??1,displayName:k??null,id:Z,getStack:ce,showInTimeline:v,premountDisplay:(R==null?void 0:R.premountDisplay)??null,postmountDisplay:(R==null?void 0:R.postmountDisplay)??null,loopDisplay:void 0,documentationLink:"https://www.remotion.dev/docs/html5-audio",refForOutline:null}),Rb({mediaRef:re,src:c,mediaType:"audio",playbackRate:s??1,preservePitch:a,onlyWarnForMediaSeekingError:!1,acceptableTimeshift:p??null,isPremounting:!!(R!=null&&R.premounting),isPostmounting:!!(R!=null&&R.postmounting),pauseWhenBuffering:m,onAutoPlayError:null}),Fb({id:Z,isPostmounting:!!(R!=null&&R.postmounting),isPremounting:!!(R!=null&&R.premounting),mediaRef:re,mediaType:"audio",onAutoPlayError:null}),Sb({logLevel:r,mediaRef:re,source:ee,volume:B,shouldUseWebAudioApi:I??!1}),(ge.useInsertionEffect??ge.useLayoutEffect)(()=>()=>{requestAnimationFrame(()=>{K()})},[K]),d.useImperativeHandle(t,()=>re.current,[re]);const X=d.useRef(f);return X.current=f,d.useEffect(()=>{var T;const{current:N}=re;if(!N)return;if(N.duration){(T=X.current)==null||T.call(X,N.src,N.duration);return}const G=()=>{var M;(M=X.current)==null||M.call(X,N.src,N.duration)};return N.addEventListener("loadedmetadata",G),()=>{N.removeEventListener("loadedmetadata",G)}},[re,c]),n?null:u.jsx("audio",{ref:re,preload:"metadata",crossOrigin:ie,...ue})},Pb=d.forwardRef(vT),wT=(e,t)=>{const n=d.useRef(null),{volume:r,playbackRate:o,allowAmplificationDuringRender:i,onDuration:s,toneFrequency:a,_remotionInternalNeedsDurationCalculation:l,_remotionInternalNativeLoopPassed:c,acceptableTimeShiftInSeconds:f,name:p,onNativeError:h,delayRenderRetries:g,delayRenderTimeoutInMilliseconds:w,loopVolumeCurveBehavior:x,pauseWhenBuffering:k,audioStreamIndex:m,preservePitch:v,...y}=e,S=So(),b=ss(x??"repeat"),E=Nt(),C=d.useContext(Rt),{registerRenderAsset:j,unregisterRenderAsset:I}=d.useContext(Jo),{delayRender:P,continueRender:L}=or(),W=d.useMemo(()=>`audio-${qo(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]),$=ei({volume:r,frame:b,mediaVolume:1});ls($),d.useImperativeHandle(t,()=>n.current,[]),d.useEffect(()=>{if(!e.src)throw new Error("No src passed");if(window.remotion_audioEnabled&&!e.muted&&!($<=0))return j({type:"audio",src:br(e.src),id:W,frame:S,volume:$,mediaFrame:E,playbackRate:e.playbackRate??1,toneFrequency:a??1,audioStartFrame:Math.max(0,-((C==null?void 0:C.cumulatedNegativeFrom)??0)),audioStreamIndex:m??0}),()=>I(W)},[e.muted,e.src,j,S,W,I,$,b,E,o,e.playbackRate,a,C==null?void 0:C.cumulatedNegativeFrom,m]);const{src:A}=e,U=t||l;return d.useLayoutEffect(()=>{var Z,B;if(((B=(Z=window.process)==null?void 0:Z.env)==null?void 0:B.NODE_ENV)==="test"||!U)return;const z=P("Loading <Html5Audio> duration with src="+A,{retries:g??void 0,timeoutInMilliseconds:w??void 0}),{current:O}=n,R=()=>{O!=null&&O.duration&&s(O.src,O.duration),L(z)};return O!=null&&O.duration?(s(O.src,O.duration),L(z)):O==null||O.addEventListener("loadedmetadata",R,{once:!0}),()=>{O==null||O.removeEventListener("loadedmetadata",R),L(z)}},[A,s,U,g,w,L,P]),U?u.jsx("audio",{ref:n,...y,onError:h}):null},xT=d.forwardRef(wT),bT=(e,t)=>{const n=d.useContext(Rc),r=e,{startFrom:o,endAt:i,trimBefore:s,trimAfter:a,name:l,stack:c,pauseWhenBuffering:f,showInTimeline:p,onError:h,freeze:g,...w}=r,{loop:x,freeze:k,...m}=r,{fps:v}=ht(),y=vt(),S=Na(f);if(y.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:b,setDurations:E}=d.useContext(zh);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=Qo(e.src),j=d.useCallback($=>{console.log($.currentTarget.error);const A=`Could not play audio with src ${C}: ${$.currentTarget.error}. See https://remotion.dev/docs/media-playback-error for help.`;if(x){if(h){h(new Error(A));return}xa(new Error(A))}else h==null||h(new Error(A)),console.warn(A)},[x,h,C]),I=d.useCallback(($,A)=>{E({type:"got-duration",durationInSeconds:A,src:$})},[E]),P=b[br(C)]??b[br(e.src)];jc({startFrom:o,endAt:i,trimBefore:s,trimAfter:a});const{trimBeforeValue:L,trimAfterValue:W}=Tc({startFrom:o,endAt:i,trimBefore:s,trimAfter:a});if(x&&P!==void 0){if(!Number.isFinite(P))return u.jsx(Qs,{...m,ref:t,_remotionInternalNativeLoopPassed:!0});const $=P*v;return u.jsx(Ec,{layout:"none",durationInFrames:kc({trimAfter:W,mediaDurationInFrames:$,playbackRate:e.playbackRate??1,trimBefore:L}),children:u.jsx(Qs,{...m,ref:t,_remotionInternalNativeLoopPassed:!0})})}return typeof L<"u"||typeof W<"u"?u.jsx(Ft,{layout:"none",from:0-(L??0),showInTimeline:!1,durationInFrames:W,name:l,children:u.jsx(Qs,{_remotionInternalNeedsDurationCalculation:!!x,pauseWhenBuffering:S,...w,ref:t})}):(Ic({playbackRate:e.playbackRate,preservePitch:e.preservePitch,volume:e.volume},"Html5Audio"),y.isRendering?u.jsx(xT,{onDuration:I,...e,ref:t,onNativeError:j,_remotionInternalNeedsDurationCalculation:!!x}):u.jsx(Pb,{_remotionInternalNativeLoopPassed:e._remotionInternalNativeLoopPassed??!1,_remotionInternalStack:c??null,shouldPreMountAudioTags:n!==null&&n.numberOfAudioTags>0,...e,ref:t,onNativeError:j,onDuration:I,pauseWhenBuffering:S,_remotionInternalNeedsDurationCalculation:!!x,showInTimeline:p??!0}))},Qs=d.forwardRef(bT);dn(Qs);var ST=Qs,kT=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},ET={...Dr,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},...kr,...Eo,...ko},CT=({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(),h=kT(s),g=Math.ceil(t*h),w=Math.ceil(n*h),[x,k]=d.useState(null),m=za({effects:r,overrideId:a??null}),v=d.useMemo(()=>{if(typeof document>"u")return null;const E=document.createElement("canvas");return E.width=1,E.height=1,E},[]),y=Wa(),S=d.useCallback(E=>{k(E),typeof l=="function"?l(E):l&&(l.current=E)},[l]);d.useEffect(()=>{if(!x||!v)return;const E=c("Solid effect chain");if(!y)return f(E),()=>{f(E)};const C=v.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)),Ba({state:y.get(g,w),source:v,effects:m,output:x,width:g,height:w}).then(j=>{j&&f(E)}).catch(j=>{p(j)}),()=>{f(E)}},[e,x,v,y,g,w,c,f,p,m]);const b=d.useMemo(()=>({width:t,height:n,...i??{}}),[n,i,t]);return u.jsx("canvas",{ref:S,width:g,height:w,className:o,style:b})},IT=d.forwardRef(({effects:e=[],controls:t,color:n,height:r,width:o,className:i,durationInFrames:s,style:a,name:l,from:c,trimBefore:f,freeze:p,hidden:h,showInTimeline:g,pixelDensity:w,...x},k)=>{const m=Da(e),v=d.useRef(null);return d.useImperativeHandle(k,()=>v.current,[]),u.jsx(Ft,{layout:"none",from:c,trimBefore:f,freeze:p,hidden:h,showInTimeline:g,controls:t,_remotionInternalEffects:m,durationInFrames:s,name:l??"<Solid>",outlineRef:v,_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/solid",...x,children:u.jsx(CT,{reference:v,overrideId:(t==null?void 0:t.overrideId)??null,color:n,height:r,width:o,className:i,style:a,effects:e,pixelDensity:w})})}),$b=zr({Component:IT,componentName:"<Solid>",componentIdentity:"dev.remotion.remotion.Solid",schema:ET,supportsEffects:!0});$b.displayName="Solid";dn($b);var kl=null,Mb=()=>{if(kl!==null)return kl;if(typeof document>"u")return!1;const e=document.createElement("canvas"),t=e.getContext("2d");return kl=typeof(t==null?void 0:t.drawElementImage)=="function"&&typeof e.requestPaint=="function"&&typeof e.captureElementImage=="function"&&"transferControlToOffscreen"in HTMLCanvasElement.prototype,kl},jT="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 TT(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 RT(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 El=e=>e instanceof DOMException&&e.name==="InvalidStateError",xy="HtmlInCanvas: Expected the element to be inside the viewport during rendering, but Chrome had no cached paint record for it.",by=({target:e,width:t,height:n})=>{e.width!==t&&(e.width=t),e.height!==n&&(e.height=n)},FT=({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()},Sy=d.createContext(null),_b=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(Sy);TT(e,t);const p=RT(s),h=Math.ceil(e*p),g=Math.ceil(t*p),{delayRender:w,continueRender:x,cancelRender:k}=or(),{isClientSideRendering:m,isRendering:v}=vt(),y=!v||m,S=o===void 0&&i===void 0;Mb()||k(new Error(jT));const b=d.useRef(null),E=d.useRef(null),C=d.useRef(null),j=`${e}x${t}@${p}-${S?"direct":"offscreen"}`,I=d.useCallback(re=>{b.current=re,typeof c=="function"?c(re):c&&(c.current=re)},[c]),P=Wa(),L=za({effects:n,overrideId:(a==null?void 0:a.overrideId)??null}),W=d.useRef(L);W.current=L;const $=d.useRef(o);$.current=o;const A=d.useRef(i);A.current=i;const U=d.useRef(!1),z=d.useRef(null),O=d.useRef(!1),R=d.useRef(f);R.current=f;const Z=d.useCallback(async()=>{var K;const re=C.current;if(!re)throw new Error("Canvas or scene element not found");const ee=E.current;if(!ee)throw new Error("HtmlInCanvas: paint target is not ready because the canvas is remounting");by({target:ee,width:h,height:g});try{const ce=b.current;if(!ce)throw new Error("Canvas not found");const q=w("onPaint");if(!U.current){const N=A.current;if(!N)U.current=!0;else{let G;try{G=ce.captureElementImage(re)}catch(T){if(El(T)&&y){x(q);return}throw El(T)?new Error(xy):T}U.current=!0;try{if(ee instanceof HTMLCanvasElement)throw new Error("HtmlInCanvas: onInit requires an OffscreenCanvas paint target");const T=await N({canvas:ee,element:re,elementImage:G,pixelDensity:p});if(typeof T!="function")throw new Error("HtmlInCanvas: when `onInit` is provided, it must return a cleanup function, or a Promise that resolves to one.");O.current?T():z.current=T}finally{G.close()}}}let X;try{X=ce.captureElementImage(re)}catch(N){if(El(N)&&y){x(q);return}throw El(N)?new Error(xy):N}try{const N=$.current;if(N){if(ee instanceof HTMLCanvasElement)throw new Error("HtmlInCanvas: onPaint requires an OffscreenCanvas paint target");const G=N({canvas:ee,element:re,elementImage:X,pixelDensity:p});G&&await G}else FT({canvas:ee,element:re,elementImage:X,pixelDensity:p});await Ba({state:P.get(h,g),source:ee,effects:W.current,output:ee,width:h,height:g})}finally{X.close()}(K=R.current)==null||K.requestParentPaint(),x(q)}catch(ce){k(ce)}},[g,h,P,x,k,w,p,y]);d.useLayoutEffect(()=>{const re=b.current;if(!re)throw new Error("Canvas not found");re.layoutSubtree=!0;const ee=S?re:re.transferControlToOffscreen();return E.current=ee,by({target:ee,width:h,height:g}),U.current=!1,O.current=!1,re.addEventListener("paint",Z),()=>{var K;re.removeEventListener("paint",Z),E.current=null,U.current=!1,O.current=!0,(K=z.current)==null||K.call(z),z.current=null}},[Z,k,h,g,S]);const B=d.useRef(!1);d.useLayoutEffect(()=>{var ee;if(!B.current){B.current=!0;return}const re=b.current;re&&((ee=re.requestPaint)==null||ee.call(re))},[o,L]),d.useLayoutEffect(()=>{const re=b.current;if(!re)return;const ee=w("waiting for first paint after canvas resize");return re.addEventListener("paint",()=>{x(ee)},{once:!0}),()=>{x(ee)}},[e,t,x,w,j]);const ie=d.useMemo(()=>({width:e,height:t}),[e,t]),ue=d.useMemo(()=>({width:e,height:t,...l??{}}),[t,l,e]),me=d.useMemo(()=>({requestParentPaint:()=>{var re,ee;(ee=(re=b.current)==null?void 0:re.requestPaint)==null||ee.call(re)}}),[]);return u.jsx(Sy.Provider,{value:me,children:u.jsx("canvas",{ref:I,width:h,height:g,style:ue,children:u.jsx("div",{ref:C,style:ie,children:r})},j)})});_b.displayName="HtmlInCanvasContent";var Ab=d.forwardRef(({width:e,height:t,effects:n=[],children:r,onPaint:o,onInit:i,pixelDensity:s,controls:a,style:l,durationInFrames:c,name:f,...p},h)=>{const g=Da(n),w=d.useRef(null),x=d.useCallback(k=>{w.current=k,typeof h=="function"?h(k):h&&(h.current=k)},[h]);return u.jsx(Ft,{durationInFrames:c,name:f??"<HtmlInCanvas>",_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/remotion/html-in-canvas",controls:a,_remotionInternalEffects:g,outlineRef:w,layout:"none",...p,children:u.jsx(_b,{ref:x,width:e,height:t,effects:n,onPaint:o,onInit:i,pixelDensity:s,controls:a,style:l,children:r})})});Ab.displayName="HtmlInCanvas";var PT={...Dr,pixelDensity:{type:"number",min:1,max:3,step:.1,default:1,description:"Pixel density",hiddenFromList:!1},...kr,...Eo,...ko},$T=zr({Component:Ab,componentName:"<HtmlInCanvas>",componentIdentity:"dev.remotion.remotion.HtmlInCanvas",schema:PT,supportsEffects:!0}),Nb=Object.assign($T,{isSupported:Mb});Nb.displayName="HtmlInCanvas";dn(Nb);function $r(e){return e.startsWith("data:")&&e.length>100?e.slice(0,60)+"...["+e.length+" chars total]":e}var MT={...Dr,...ns,fit:{type:"enum",default:"fill",description:"Fit",variants:{fill:{},contain:{},cover:{}}},...kr,...Eo,...ko},_T=()=>{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},AT=({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(_T()))}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="${$r(e)}"`)));return}a(()=>n({element:o,width:f,height:p}))})},o.onerror=()=>{a(()=>r(new Error(`Could not load <CanvasImage> with src="${$r(e)}"`)))},t.addEventListener("abort",l,{once:!0}),t.aborted){l();return}o.crossOrigin="anonymous",o.src=e});function NT(e){return 1e3*2**(e-1)}var LT=({onFrame:e})=>{if(typeof requestAnimationFrame>"u")return e(),()=>{};const t=requestAnimationFrame(e);return()=>cancelAnimationFrame(t)},Lb=d.forwardRef(({src:e,width:t,height:n,fit:r="fill",effects:o,controls:i,onError:s,className:a,style:l,id:c,pauseWhenLoading:f,maxRetries:p=2,delayRenderRetries:h,delayRenderTimeoutInMilliseconds:g,refForOutline:w,...x},k)=>{const{delayRender:m,continueRender:v,cancelRender:y}=or(),{delayPlayback:S}=Pc(),[b,E]=d.useState(null),[C,j]=d.useState(null),I=Qo(e),P=Wa(),L=za({effects:o,overrideId:(i==null?void 0:i.overrideId)??null}),W=d.useContext(Rt),$=d.useRef(null),[A,U]=d.useState(!1),z=!!(W!=null&&W.premounting),O=!!(W!=null&&W.postmounting),R=d.useCallback(({markAsReady:ie})=>{const ue=$.current;!ue||ue.continued||(ue.continued=!0,ie&&U(!1),v(ue.handle),$.current=null)},[v]),Z=d.useMemo(()=>typeof document>"u"?null:document.createElement("canvas"),[]),B=d.useCallback(ie=>{E(ie),w&&(w.current=ie),typeof k=="function"?k(ie):k&&(k.current=ie)},[k,w]);return d.useLayoutEffect(()=>{if(!(!f||!A||z||O))return S().unblock},[S,A,O,z,f]),d.useLayoutEffect(()=>{const ie=m(`Rendering <CanvasImage> with src="${$r(I)}"`,{retries:h??void 0,timeoutInMilliseconds:g??void 0}),ue=new AbortController;let me=!1,re=0,ee=null;j(null),U(!0),$.current={handle:ie,continued:!1};const K=()=>{AT({src:I,signal:ue.signal}).then(ce=>{me||j(ce)}).catch(ce=>{if(ce.name==="AbortError"){R({markAsReady:!1});return}if(re++,re<=p){const q=NT(re);console.warn(`Could not load <CanvasImage> with src="${$r(I)}", retrying in ${q}ms`),ee=setTimeout(()=>{me||K()},q)}else s?(s(ce),R({markAsReady:!0})):y(ce)})};return K(),()=>{me=!0,ee!==null&&clearTimeout(ee),ue.abort(),R({markAsReady:!1})}},[I,y,R,m,h,g,p,s]),d.useLayoutEffect(()=>{if(!C||!b||!Z)return;const ie=m(`Applying effects to <CanvasImage> with src="${$r(I)}"`);let ue=!1,me=!1,re=()=>{};const ee=()=>{me||(me=!0,v(ie))},K=t??C.width,ce=n??C.height,q=Z.getContext("2d",{colorSpace:"srgb"});return q?(Z.width=K,Z.height=ce,b.width=K,b.height=ce,q.clearRect(0,0,K,ce),q.drawImage(C.element,...ab(r,{width:C.width,height:C.height},{width:K,height:ce})),Ba({state:P.get(K,ce),source:Z,effects:L,output:b,width:K,height:ce}).then(X=>{X&&!ue&&(re=LT({onFrame:()=>{ue||(ee(),R({markAsReady:!0}))}}))}).catch(X=>{ue||(s?(s(X),ee(),R({markAsReady:!0})):y(X))}),()=>{ue=!0,re(),ee()}):(y(new Error("Could not get 2D context for <CanvasImage> source canvas")),ee(),()=>{ee()})},[I,y,P,v,R,m,r,n,C,L,s,b,Z,t]),u.jsx("canvas",{...x,ref:B,width:t,height:n,className:a,style:l,id:c})});Lb.displayName="CanvasImageContent";var OT=d.forwardRef(({src:e,width:t,height:n,fit:r,effects:o=[],className:i,style:s,id:a,onError:l,pauseWhenLoading:c,maxRetries:f,delayRenderRetries:p,delayRenderTimeoutInMilliseconds:h,durationInFrames:g,from:w,trimBefore:x,freeze:k,premountFor:m,postmountFor:v,styleWhilePremounted:y,styleWhilePostmounted:S,hidden:b,name:E,showInTimeline:C,stack:j,controls:I,_remotionInternalDocumentationLink:P,outlineRef:L,...W},$)=>{if(!e)throw new Error('No "src" prop was passed to <CanvasImage>.');const A=Da(o),U=d.useRef(null);d.useImperativeHandle($,()=>U.current,[]);const{effectivePostmountFor:z,effectivePremountFor:O,freezeFrame:R,isPremountingOrPostmounting:Z,postmountingActive:B,premountingActive:ie,premountingStyle:ue}=La({from:w??0,durationInFrames:g??1/0,premountFor:m??null,postmountFor:v??null,style:s??null,styleWhilePremounted:y??null,styleWhilePostmounted:S??null,hideWhilePremounted:"display-none"});return u.jsx(Aa,{frame:R,active:Z,children:u.jsx(Ft,{layout:"none",from:w??0,trimBefore:x,durationInFrames:g??1/0,freeze:k,hidden:b,showInTimeline:C??!0,name:E??"<CanvasImage>",_remotionInternalDocumentationLink:P??"https://www.remotion.dev/docs/canvasimage",controls:I,_remotionInternalEffects:A,_remotionInternalIsMedia:{type:"image",src:e},_remotionInternalStack:j,_remotionInternalPremountDisplay:O||null,_remotionInternalPostmountDisplay:z||null,_remotionInternalIsPremounting:ie,_remotionInternalIsPostmounting:B,outlineRef:L??U,children:u.jsx(Lb,{ref:U,src:e,width:t,height:n,fit:r,effects:o,controls:I,className:i,style:ue??void 0,id:a,onError:l,pauseWhenLoading:c,maxRetries:f,delayRenderRetries:p,delayRenderTimeoutInMilliseconds:h,refForOutline:L??null,...W})})})}),Yh=zr({Component:OT,componentName:"<CanvasImage>",componentIdentity:"dev.remotion.remotion.CanvasImage",schema:MT,supportsEffects:!0});Yh.displayName="CanvasImage";dn(Yh);var DT=({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(DT);function zT(e){return 1e3*2**(e-1)}var BT=({onError:e,maxRetries:t=2,src:n,pauseWhenLoading:r,delayRenderRetries:o,delayRenderTimeoutInMilliseconds:i,onImageFrame:s,crossOrigin:a,decoding:l,ref:c,refForOutline:f,...p})=>{const h=d.useRef(null),g=d.useRef({}),{delayPlayback:w}=Pc(),x=d.useContext(Rt),[k,m]=d.useState(!1),v=d.useCallback(A=>{h.current=A,f.current=A,typeof c=="function"?c(A):c&&(c.current=A)},[c,f]),y=Qo(n),S=d.useCallback(A=>{if(!h.current)return;const U=h.current.src;setTimeout(()=>{var O;if(!h.current)return;const z=(O=h.current)==null?void 0:O.src;z===U&&(h.current.removeAttribute("src"),h.current.setAttribute("src",z))},A)},[]),{delayRender:b,continueRender:E,cancelRender:C}=or(),j=!!(x!=null&&x.premounting),I=!!(x!=null&&x.postmounting),P=d.useCallback(A=>{var U,z,O,R,Z,B,ie;if(g.current){if(g.current[(U=h.current)==null?void 0:U.src]=(g.current[(z=h.current)==null?void 0:z.src]??0)+1,e&&(g.current[(O=h.current)==null?void 0:O.src]??0)>t){e(A);return}if((g.current[(R=h.current)==null?void 0:R.src]??0)<=t){const ue=zT(g.current[(Z=h.current)==null?void 0:Z.src]??0);console.warn(`Could not load image with source ${$r((B=h.current)==null?void 0:B.src)}, retrying again in ${ue}ms`),S(ue);return}try{C("Error loading image with src: "+$r((ie=h.current)==null?void 0:ie.src))}catch{}}},[C,t,e,S]);typeof window<"u"&&(d.useLayoutEffect(()=>{if(!(!r||!k||j||I))return w().unblock},[w,k,I,j,r]),d.useLayoutEffect(()=>{var R,Z;if(((Z=(R=window.process)==null?void 0:R.env)==null?void 0:Z.NODE_ENV)==="test"){h.current&&(h.current.src=y);return}const{current:A}=h;if(!A)return;m(!0);const U=b("Loading <Img> with src="+$r(y),{retries:o??void 0,timeoutInMilliseconds:i??void 0});let z=!1;const O=()=>{var B,ie,ue;if(z){E(U);return}(g.current[(B=h.current)==null?void 0:B.src]??0)>0&&(delete g.current[(ie=h.current)==null?void 0:ie.src],console.info(`Retry successful - ${$r((ue=h.current)==null?void 0:ue.src)} is now loaded`)),A&&(s==null||s(A)),m(!1),E(U)};if(!h.current){O();return}return A.src=y,A.decode().then(O).catch(B=>{console.warn(B),A.complete&&A.naturalWidth>0&&A.naturalHeight>0?O():A.addEventListener("load",O)}),()=>{z=!0,A.removeEventListener("load",O),E(U)}},[y,o,i,s,E,b]));const{isClientSideRendering:L,isRendering:W}=vt(),$=Bh({crossOrigin:a,requestsVideoFrame:!1,isClientSideRendering:L});return u.jsx("img",{...p,ref:v,crossOrigin:$,onError:P,decoding:W?"sync":l})},WT=({hidden:e,name:t,stack:n,showInTimeline:r,src:o,from:i,trimBefore:s,durationInFrames:a,freeze:l,premountFor:c,postmountFor:f,style:p,styleWhilePremounted:h,styleWhilePostmounted:g,controls:w,outlineRef:x,...k})=>{if(!o)throw new Error('No "src" prop was passed to <Img>.');const{effectivePostmountFor:m,effectivePremountFor:v,freezeFrame:y,isPremountingOrPostmounting:S,postmountingActive:b,premountingActive:E,premountingStyle:C}=La({from:i??0,durationInFrames:a??1/0,premountFor:c??null,postmountFor:f??null,style:p??null,styleWhilePremounted:h??null,styleWhilePostmounted:g??null,hideWhilePremounted:"display-none"});return u.jsx(Aa,{frame:y,active:S,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:v||null,_remotionInternalPostmountDisplay:m||null,_remotionInternalIsPremounting:E,_remotionInternalIsPostmounting:b,name:t??"<Img>",controls:w,showInTimeline:r??!0,hidden:e,outlineRef:x,children:u.jsx(BT,{src:o,refForOutline:x,style:C??void 0,...k})})})},VT=Yh,HT={src:{type:"asset",default:void 0,description:"Source",keyframable:!1},...Dr,...ns,...kr,...Eo,...ko},UT=new Set(["alt","crossOrigin","decoding","fetchPriority","loading","onError","onImageFrame","onLoad","sizes","srcSet","useMap"]),ZT=e=>Object.keys(e).filter(t=>e[t]!==void 0&&UT.has(t)),KT=e=>e.map(t=>`"${t}"`).join(", "),YT=({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=ZT(e);if(t!=null&&o.unshift("ref"),o.length!==0)throw new Error(`The ${KT(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"}.`)},GT=e=>{const t=e==null?void 0:e.objectFit;if(t==="fill"||t==="contain"||t==="cover")return t},XT=({effects:e=[],ref:t,hidden:n,name:r,stack:o,showInTimeline:i,src:s,from:a,trimBefore:l,durationInFrames:c,freeze:f,premountFor:p,postmountFor:h,styleWhilePremounted:g,styleWhilePostmounted:w,controls:x,width:k,height:m,className:v,style:y,id:S,pauseWhenLoading:b,maxRetries:E,delayRenderRetries:C,delayRenderTimeoutInMilliseconds:j,...I})=>{const P=d.useRef(null),L=Na(b);if(e.length===0)return u.jsx(WT,{...I,ref:t,hidden:n,name:r,stack:o,showInTimeline:i,src:s,from:a,trimBefore:l,durationInFrames:c,freeze:f,premountFor:p,postmountFor:h,styleWhilePremounted:g,styleWhilePostmounted:w,controls:x,width:k,height:m,className:v,style:y,id:S,pauseWhenLoading:L,maxRetries:E,delayRenderRetries:C,delayRenderTimeoutInMilliseconds:j,outlineRef:P});if(!s)throw new Error('No "src" prop was passed to <Img>.');YT({props:I,ref:t,width:k,height:m});const W=typeof k=="number"?k:void 0,$=typeof m=="number"?m:void 0,A=I,U=GT(y)??"fill";return u.jsx(VT,{src:s,width:W,height:$,fit:U,effects:e,className:v,style:y,id:S,pauseWhenLoading:L,maxRetries:E,delayRenderRetries:C,delayRenderTimeoutInMilliseconds:j,from:a,trimBefore:l,durationInFrames:c,freeze:f,premountFor:p,postmountFor:h,styleWhilePremounted:g,styleWhilePostmounted:w,hidden:n,name:r??"<Img>",showInTimeline:i,stack:o,_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/img",controls:x,outlineRef:P,...A})},$c=zr({Component:XT,componentName:"<Img>",componentIdentity:"dev.remotion.remotion.Img",schema:HT,supportsEffects:!0});dn($c);var qT=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}`)},Ob=({packageName:e,componentName:t})=>`${qT(e)}.${t}`,Gh={...Dr,...kr},JT={...Gh,...Eo},Db={...JT,...ko},QT={...Db,...mc,...P1},eR={...Gh,...mc,...P1},tR=(e,t)=>{typeof e=="function"?e(t):e&&(e.current=t)},zb=e=>{const t=zr(e);return dn(t),t},Ou=(e,t,n)=>{const r=d.forwardRef((i,s)=>{const{durationInFrames:a,from:l,trimBefore:c,freeze:f,hidden:p,name:h,showInTimeline:g,stack:w,controls:x,...k}=i,m=d.useRef(null),v=d.useCallback(y=>{m.current=y,tR(s,y)},[s]);return u.jsx(Ft,{layout:"none",from:l??0,trimBefore:c,durationInFrames:a??1/0,freeze:f,hidden:p,name:h??t,showInTimeline:g??!0,controls:x,_remotionInternalStack:w,_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/interactive",outlineRef:m,children:ge.createElement(e,{...k,ref:v})})});r.displayName=t;const o=zb({Component:r,componentName:t,componentIdentity:Ob({packageName:"remotion",componentName:t.slice(1,-1)}),schema:n,supportsEffects:!1});return o.displayName=t,o},Ye=(e,t)=>Ou(e,t,QT),oi=(e,t)=>Ou(e,t,Gh),Yr={baseSchema:Dr,transformSchema:kr,textSchema:mc,backgroundSchema:Eo,borderSchema:ko,premountSchema:ns,sequenceSchema:Zi,withSchema:zb,_internalMakeRemotionComponentIdentity:Ob,A:Ye("a","<Interactive.A>"),Article:Ye("article","<Interactive.Article>"),Aside:Ye("aside","<Interactive.Aside>"),Button:Ye("button","<Interactive.Button>"),Circle:oi("circle","<Interactive.Circle>"),Code:Ye("code","<Interactive.Code>"),Div:Ye("div","<Interactive.Div>"),Ellipse:oi("ellipse","<Interactive.Ellipse>"),Em:Ye("em","<Interactive.Em>"),Footer:Ye("footer","<Interactive.Footer>"),G:oi("g","<Interactive.G>"),H1:Ye("h1","<Interactive.H1>"),H2:Ye("h2","<Interactive.H2>"),H3:Ye("h3","<Interactive.H3>"),H4:Ye("h4","<Interactive.H4>"),H5:Ye("h5","<Interactive.H5>"),H6:Ye("h6","<Interactive.H6>"),Header:Ye("header","<Interactive.Header>"),Label:Ye("label","<Interactive.Label>"),Li:Ye("li","<Interactive.Li>"),Line:oi("line","<Interactive.Line>"),Main:Ye("main","<Interactive.Main>"),Nav:Ye("nav","<Interactive.Nav>"),Ol:Ye("ol","<Interactive.Ol>"),P:Ye("p","<Interactive.P>"),Path:oi("path","<Interactive.Path>"),Pre:Ye("pre","<Interactive.Pre>"),Rect:oi("rect","<Interactive.Rect>"),Section:Ye("section","<Interactive.Section>"),Small:Ye("small","<Interactive.Small>"),Span:Ye("span","<Interactive.Span>"),Strong:Ye("strong","<Interactive.Strong>"),Svg:Ou("svg","<Interactive.Svg>",Db),Text:Ou("text","<Interactive.Text>",eR),Ul:Ye("ul","<Interactive.Ul>")},nR=async({resolvedSrc:e,signal:t,requestInit:n,contentType:r})=>{const{decoder:o,selectedTrack:i}=await db({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()}},Bb=ge.createRef(),rR=({children:e,onlyRenderComposition:t,currentCompositionMetadata:n,initialCompositions:r,initialCanvasContent:o})=>{const[i,s]=d.useState([]),[a,l]=d.useState(o),[c,f]=d.useState(r),p=d.useRef(c),h=d.useCallback(y=>{f(S=>{const b=y(S);return p.current=b,b})},[]),g=d.useCallback(y=>{h(S=>{if(S.find(b=>b.id===y.id))throw new Error(`Multiple composition with id ${y.id} are registered.`);return[...S,y]})},[h]),w=d.useCallback(y=>{f(S=>S.filter(b=>b.id!==y))},[]),x=d.useCallback((y,S,b,E)=>{s(C=>[...C,{name:y,parent:S,nonce:b,stack:E}])},[]),k=d.useCallback((y,S)=>{s(b=>b.filter(E=>!(E.name===y&&E.parent===S)))},[]);d.useImperativeHandle(Bb,()=>({getCompositions:()=>p.current}),[]);const m=d.useMemo(()=>({registerComposition:g,unregisterComposition:w,registerFolder:x,unregisterFolder:k,setCanvasContent:l,onlyRenderComposition:t}),[g,x,w,k,t]),v=d.useMemo(()=>({compositions:c,folders:i,currentCompositionMetadata:n,canvasContent:a}),[c,i,n,a]);return u.jsx(Ji.Provider,{value:v,children:u.jsx(Pa.Provider,{value:m,children:e})})},Wb={};i1(Wb,{makeDefaultPreviewCSS:()=>iR,injectCSS:()=>oR,OBJECTFIT_CONTAIN_CLASS_NAME:()=>ba});var Cl={},oR=e=>{if(typeof document>"u")return()=>{};if(Cl[e])return()=>{};const t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");return n.appendChild(document.createTextNode(e)),t.prepend(n),Cl[e]=n,()=>{const r=Cl[e];r&&(r.parentNode&&r.parentNode.removeChild(r),delete Cl[e])}},ba="__remotion_objectfitcontain",iR=(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} .${ba} {
66
+ object-fit: contain;
67
+ }
68
+ `:`
69
+ * {
70
+ box-sizing: border-box;
71
+ }
72
+ body {
73
+ margin: 0;
74
+ background-color: ${t};
75
+ }
76
+ .${ba} {
77
+ object-fit: contain;
78
+ }
79
+ `,Vb="__remotion-studio-container",sR=()=>document.getElementById(Vb),aR=ge.createContext(null),lR=null,Od=[],uR=()=>lR,cR=e=>(Od.push(e),()=>{Od=Od.filter(t=>t!==e)}),Xh=d.createContext(null),dR=()=>{const e=d.useContext(Xh);return!e||e.videoEnabled===null?window.remotion_videoEnabled:e.videoEnabled},fR=()=>{const e=d.useContext(Xh);return!e||e.audioEnabled===null?window.remotion_audioEnabled:e.audioEnabled},pR=({children:e,videoEnabled:t,audioEnabled:n})=>{const r=d.useMemo(()=>({videoEnabled:t,audioEnabled:n}),[t,n]);return u.jsx(Xh.Provider,{value:r,children:e})},hR=({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(Xo.Provider,{value:c,children:u.jsx($a.Provider,{value:l,children:u.jsx(uI,{frameState:a,children:u.jsx(pR,{videoEnabled:i,audioEnabled:s,children:u.jsx(f1,{children:u.jsx(gb,{children:u.jsx(mI,{children:u.jsx(vb,{children:u.jsx(Cb,{children:u.jsx(wb,{audioLatencyHint:r,audioEnabled:s,previewSampleRate:o,children:u.jsx(xb,{numberOfAudioTags:t,children:e})})})})})})})})})})})},ky=["h264","h265","vp8","vp9","av1","mp3","aac","wav","prores","h264-mkv","h264-ts","gif"];function mR(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(!ky.includes(e))throw new Error(`The "${n}" prop ${t} must be one of ${ky.join(", ")}, but you passed ${e}.`)}}var gR=({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;$u(l,"width",e!=null&&e.width?s:a);const c=(e==null?void 0:e.height)??r??void 0;$u(c,"height",e!=null&&e.height?s:a);const f=(e==null?void 0:e.fps)??n??null;cc(f,e!=null&&e.fps?s:a);const p=(e==null?void 0:e.durationInFrames)??i??null;uc(p,{allowFloats:!1,component:`of the "<Composition />" component with the id "${t}"`});const h=e==null?void 0:e.defaultCodec;mR(h,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,m=e==null?void 0:e.defaultSampleRate;return{width:l,height:c,fps:f,durationInFrames:p,defaultCodec:h,defaultOutName:g,defaultVideoImageFormat:w,defaultPixelFormat:x,defaultProResProfile:k,defaultSampleRate:m}},Ey=({calculated:e,compositionDurationInFrames:t,compositionFps:n,compositionHeight:r,compositionId:o,compositionWidth:i,defaultProps:s,originalProps:a})=>{const l=gR({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:up(s??{}),props:up((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}}},Hb=({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=>Ey({calculated:f,compositionDurationInFrames:i,compositionFps:s,compositionHeight:a,compositionWidth:l,compositionId:o,defaultProps:n,originalProps:r})):Ey({calculated:c,compositionDurationInFrames:i,compositionFps:s,compositionHeight:a,compositionWidth:l,compositionId:o,defaultProps:n,originalProps:r})},Ub=e=>{const t=Hb(e);return typeof t=="object"&&"then"in t?t.then(({videoConfig:n})=>n):t.videoConfig},yR=e=>{try{return{type:"success",result:Hb(e)}}catch(t){return{type:"error",error:t}}},vR=e=>{try{return{type:"success",result:Ub(e)}}catch(t){return{type:"error",error:t}}},wR=ge.createContext(()=>{}),xR=()=>{if(Vn().isRendering){const e=window.remotion_envVariables;return e?{...JSON.parse(e),NODE_ENV:"production"}:{}}return{NODE_ENV:"production"}},bR=()=>{const e=xR();window.process||(window.process={}),window.process.env||(window.process.env={}),Object.keys(e).forEach(t=>{window.process.env[t]=e[t]})},SR=ge.createContext(null),kR=d.createContext({setSize:()=>{},size:{size:"auto",translation:{x:0,y:0}}}),ER=({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)},CR=ge.createContext(null),IR=({src:e,transparent:t,currentTime:n,toneMapped:r})=>`http://localhost:${window.remotion_proxyPort}/proxy?src=${encodeURIComponent(br(e))}&time=${encodeURIComponent(Math.max(0,n))}&transparent=${String(t)}&toneMapped=${String(r)}`,jR=({onError:e,volume:t,playbackRate:n,src:r,muted:o,allowAmplificationDuringRender:i,transparent:s,toneMapped:a,toneFrequency:l,name:c,loopVolumeCurveBehavior:f,delayRenderRetries:p,delayRenderTimeoutInMilliseconds:h,onVideoFrame:g,crossOrigin:w,audioStreamIndex:x,preservePitch:k,...m})=>{const v=So(),y=Nt(),S=ss(f),b=hc(),E=d.useContext(Rt),C=Ho(),{registerRenderAsset:j,unregisterRenderAsset:I}=d.useContext(Jo);if(!r)throw new TypeError("No `src` was passed to <OffthreadVideo>.");const P=d.useMemo(()=>`offthreadvideo-${qo(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(!b)throw new Error("No video config found");const L=ei({volume:t,frame:S,mediaVolume:1});ls(L),d.useEffect(()=>{if(!r)throw new Error("No src passed");if(window.remotion_audioEnabled&&!o&&!(L<=0))return j({type:"video",src:br(r),id:P,frame:v,volume:L,mediaFrame:y,playbackRate:n,toneFrequency:l,audioStartFrame:Math.max(0,-((E==null?void 0:E.cumulatedNegativeFrom)??0)),audioStreamIndex:x}),()=>I(P)},[o,r,j,P,I,L,y,v,n,l,E==null?void 0:E.cumulatedNegativeFrom,x]);const W=d.useMemo(()=>jb({frame:y,playbackRate:n||1,startFrom:-C})/b.fps,[y,C,n,b.fps]),$=d.useMemo(()=>IR({src:r,currentTime:W,transparent:s,toneMapped:a}),[a,W,r,s]),[A,U]=d.useState(null),{delayRender:z,continueRender:O}=or();d.useLayoutEffect(()=>{if(!window.remotion_videoEnabled)return;const ie=[];U(null);const ue=new AbortController,me=z(`Fetching ${$} from server`,{retries:p??void 0,timeoutInMilliseconds:h??void 0});return(async()=>{try{const ee=await fetch($,{signal:ue.signal,cache:"no-store"});if(ee.status!==200){if(ee.status===500){const q=await ee.json();if(q.error){const X=q.error.replace(/^Error: /,"");throw new Error(X)}}throw new Error(`Server returned status ${ee.status} while fetching ${$}`)}const K=await ee.blob(),ce=URL.createObjectURL(K);ie.push(()=>URL.revokeObjectURL(ce)),U({src:ce,handle:me})}catch(ee){if(ee.message.includes("aborted")){O(me);return}if(ue.signal.aborted){O(me);return}ee.message.includes("Failed to fetch")&&(ee=new Error(`Failed to fetch ${$}. This could be caused by Chrome rejecting the request because the disk space is low. Consider increasing the disk size of your environment.`,{cause:ee})),e?e(ee):xa(ee)}})(),ie.push(()=>{ue.signal.aborted||ue.abort()}),()=>{ie.forEach(ee=>ee())}},[$,p,h,e,O,z]);const R=d.useCallback(()=>{e?e==null||e(new Error("Failed to load image with src "+A)):xa("Failed to load image with src "+A)},[A,e]),Z=d.useMemo(()=>[ba,m.className].filter(Qi).join(" "),[m.className]),B=d.useCallback(ie=>{g&&g(ie)},[g]);return!A||!window.remotion_videoEnabled?null:(O(A.handle),u.jsx($c,{src:A.src,delayRenderRetries:p,delayRenderTimeoutInMilliseconds:h,onImageFrame:B,...m,onError:R,className:Z}))},Zb=({ref:e,onVideoFrame:t})=>{d.useEffect(()=>{const{current:n}=e;if(!n||!t)return;let r=0;const o=(i,s)=>{e.current&&(t(e.current,i,s),r=e.current.requestVideoFrameCallback(o))};if(t(n),!!n.requestVideoFrameCallback)return r=n.requestVideoFrameCallback(o),()=>{r&&n.cancelVideoFrameCallback(r)}},[t,e])};class Ti extends Error{constructor({message:n,src:r}){super(n);We(this,"src");this.name="MediaPlaybackError",this.src=r}}var TR=(e,t)=>{const n=d.useContext(is);if(!n)throw new Error("SharedAudioContext not found");const r=d.useRef(null),o=d.useMemo(()=>n.audioContext?Wh({audioContext:n.audioContext,ref:r}):null,[n.audioContext]);(ge.useInsertionEffect??ge.useLayoutEffect)(()=>()=>{requestAnimationFrame(()=>{o==null||o.cleanup()})},[o]);const{volume:s,muted:a,playbackRate:l,preservePitch:c,onlyWarnForMediaSeekingError:f,src:p,onDuration:h,acceptableTimeShift:g,acceptableTimeShiftInSeconds:w,toneFrequency:x,name:k,_remotionInternalNativeLoopPassed:m,_remotionInternalStack:v,style:y,pauseWhenBuffering:S,showInTimeline:b,loopVolumeCurveBehavior:E,onError:C,onAutoPlayError:j,onVideoFrame:I,crossOrigin:P,delayRenderRetries:L,delayRenderTimeoutInMilliseconds:W,allowAmplificationDuringRender:$,useWebAudioApi:A,audioStreamIndex:U,...z}=e,O=ss(E??"repeat"),{fps:R,durationInFrames:Z}=ht(),B=d.useContext(Rt),ie=Sr(),ue=_a(),[me]=d.useState(()=>String(Math.random()));if(typeof g<"u")throw new Error("acceptableTimeShift has been removed. Use acceptableTimeShiftInSeconds instead.");const[re]=Zh(),[ee]=Kh(),K=ei({frame:O,volume:s,mediaVolume:re});ls(K);const ce=d.useCallback(()=>v??null,[v]);Vh({volume:s,mediaVolume:re,mediaType:"video",src:p,playbackRate:e.playbackRate??1,displayName:k??null,id:me,getStack:ce,showInTimeline:b,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}),Rb({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:S,onAutoPlayError:j??null}),Fb({id:me,isPostmounting:!!(B!=null&&B.postmounting),isPremounting:!!(B!=null&&B.premounting),mediaRef:r,mediaType:"video",onAutoPlayError:j??null}),Sb({logLevel:ie,mediaRef:r,volume:K,source:o,shouldUseWebAudioApi:A??!1});const q=B?B.relativeFrom:0,X=B?Math.min(B.durationInFrames,Z):Z,N=Qo(p),G=sT({actualSrc:N,actualFrom:q,duration:X,fps:R});d.useImperativeHandle(t,()=>r.current,[]),d.useState(()=>Gt({logLevel:ie,message:`Mounting video with source = ${G}, v=${Bs}, user agent=${typeof navigator>"u"?"server":navigator.userAgent}`,tag:"video",mountTime:ue})),d.useEffect(()=>{const{current:ne}=r;if(!ne)return;const V=()=>{var se;if(ne.error){if(console.error("Error occurred in video",ne==null?void 0:ne.error),C){const _=new Ti({message:`Code ${ne.error.code}: ${ne.error.message}`,src:p});C(_);return}throw new Ti({message:`The browser threw an error while playing the video ${p}: Code ${ne.error.code} - ${(se=ne==null?void 0:ne.error)==null?void 0:se.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 _=new Ti({message:`The browser threw an error while playing the video ${p}`,src:p});C(_);return}throw new Ti({message:"The browser threw an error while playing the video",src:p})}};return ne.addEventListener("error",V,{once:!0}),()=>{ne.removeEventListener("error",V)}},[C,p]);const T=d.useRef(h);T.current=h,Zb({ref:r,onVideoFrame:I}),d.useEffect(()=>{var se;const{current:ne}=r;if(!ne)return;if(ne.duration){(se=T.current)==null||se.call(T,p,ne.duration);return}const V=()=>{var _;(_=T.current)==null||_.call(T,p,ne.duration)};return ne.addEventListener("loadedmetadata",V),()=>{ne.removeEventListener("loadedmetadata",V)}},[p]),d.useEffect(()=>{const{current:ne}=r;ne&&(Fc()?ne.preload="metadata":ne.preload="auto")},[]);const M=d.useMemo(()=>({...y}),[y]),Q=Bh({crossOrigin:P,requestsVideoFrame:!!I,isClientSideRendering:!1});return u.jsx("video",{...z,ref:r,muted:a||ee||K<=0,playsInline:!0,src:G,loop:m,style:M,disableRemotePlayback:!0,crossOrigin:Q,controls:!1})},qh=d.forwardRef(TR),Jh=e=>{const{startFrom:t,endAt:n,trimBefore:r,trimAfter:o,name:i,pauseWhenBuffering:s,stack:a,showInTimeline:l,...c}=e,f=vt(),p=Na(s);if(f.isClientSideRendering)throw new Error("<OffthreadVideo> is not supported in @remotion/web-renderer. Use <Video> from @remotion/media instead. See https://remotion.dev/docs/client-side-rendering/limitations");const h=d.useCallback(()=>{},[]);if(typeof e.src!="string")throw new TypeError(`The \`<OffthreadVideo>\` tag requires a string for \`src\`, but got ${JSON.stringify(e.src)} instead.`);jc({startFrom:t,endAt:n,trimBefore:r,trimAfter:o});const{trimBeforeValue:g,trimAfterValue:w}=Tc({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(Jh,{pauseWhenBuffering:p,...c,trimAfter:void 0,name:void 0,showInTimeline:l,trimBefore:void 0,stack:void 0,startFrom:void 0,endAt:void 0})});if(Ic(e,"Video"),f.isRendering)return u.jsx(jR,{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:m,onVideoFrame:v,crossOrigin:y,delayRenderRetries:S,delayRenderTimeoutInMilliseconds:b,...E}=c;return u.jsx(qh,{_remotionInternalStack:a??null,onDuration:h,onlyWarnForMediaSeekingError:!0,pauseWhenBuffering:p,showInTimeline:l??!0,onAutoPlayError:m??void 0,onVideoFrame:v??null,crossOrigin:y,...E,_remotionInternalNativeLoopPassed:!1})},Kb=({src:e,acceptableTimeShiftInSeconds:t,allowAmplificationDuringRender:n,audioStreamIndex:r,crossOrigin:o,delayRenderRetries:i,delayRenderTimeoutInMilliseconds:s,loopVolumeCurveBehavior:a,muted:l,name:c,onAutoPlayError:f,onError:p,onVideoFrame:h,pauseWhenBuffering:g,playbackRate:w,preservePitch:x,showInTimeline:k,style:m,toneFrequency:v,toneMapped:y,transparent:S,trimAfter:b,trimBefore:E,useWebAudioApi:C,volume:j,_remotionInternalNativeLoopPassed:I,endAt:P,stack:L,startFrom:W,imageFormat:$,...A})=>{if($)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(Jh,{acceptableTimeShiftInSeconds:t,allowAmplificationDuringRender:n??!0,audioStreamIndex:r??0,crossOrigin:o,delayRenderRetries:i,delayRenderTimeoutInMilliseconds:s,loopVolumeCurveBehavior:a??"repeat",muted:l??!1,name:c,onAutoPlayError:f??null,onError:p,onVideoFrame:h,pauseWhenBuffering:Na(g),playbackRate:w??1,preservePitch:x,toneFrequency:v??1,showInTimeline:k??!0,src:e,stack:L,startFrom:W,_remotionInternalNativeLoopPassed:I??!1,endAt:P,style:m,toneMapped:y??!0,transparent:S??!1,trimAfter:b,trimBefore:E,useWebAudioApi:C??!1,volume:j,...A})};dn(Kb);var RR="remotion_staticFilesChanged";function FR(){const e=ge.useContext(Ji),t=ge.useContext(ts),n=ge.useContext(es),r=ge.useContext(Rt),o=ge.useContext($a),i=ge.useContext(Go),s=ge.useContext(Cc),a=ge.useContext(dc),l=ge.useContext(Jo),c=ge.useContext(rs),f=ge.useContext(gc),p=ge.useContext(vc),h=ge.useContext(as),g=ge.useContext(Xo);return d.useMemo(()=>({compositionManagerCtx:e,timelineContext:t,setTimelineContext:n,sequenceContext:r,nonceContext:o,canUseRemotionHooksContext:i,preloadContext:s,resolveCompositionContext:a,renderAssetManagerContext:l,sequenceManagerContext:c,sequenceManagerRefContext:f,visualModePropStatusesRefContext:p,bufferManagerContext:h,logLevelContext:g}),[e,o,r,n,t,i,s,a,l,c,f,p,h,g])}var PR=e=>{const{children:t,contexts:n}=e;return u.jsx(Xo.Provider,{value:n.logLevelContext,children:u.jsx(Go.Provider,{value:n.canUseRemotionHooksContext,children:u.jsx($a.Provider,{value:n.nonceContext,children:u.jsx(Cc.Provider,{value:n.preloadContext,children:u.jsx(Ji.Provider,{value:n.compositionManagerCtx,children:u.jsx(gc.Provider,{value:n.sequenceManagerRefContext,children:u.jsx(rs.Provider,{value:n.sequenceManagerContext,children:u.jsx(vc.Provider,{value:n.visualModePropStatusesRefContext,children:u.jsx(Jo.Provider,{value:n.renderAssetManagerContext,children:u.jsx(dc.Provider,{value:n.resolveCompositionContext,children:u.jsx(ts.Provider,{value:n.timelineContext,children:u.jsx(es.Provider,{value:n.setTimelineContext,children:u.jsx(Rt.Provider,{value:n.sequenceContext,children:u.jsx(as.Provider,{value:n.bufferManagerContext,children:t})})})})})})})})})})})})})})},$R=d.createRef(),ke={MaxMediaCacheSizeContext:aR,useUnsafeVideoConfig:hc,useFrameForVolumeProp:ss,useTimelinePosition:So,useAbsoluteTimelinePosition:T1,evaluateVolume:ei,getAbsoluteSrc:br,getAnimatedImageDurationInSeconds:nR,getAssetDisplayName:kb,Timeline:fp,validateMediaTrimProps:jc,validateMediaProps:Ic,resolveTrimProps:Tc,VideoForPreview:qh,CompositionManager:Ji,CompositionSetters:Pa,VisualModePropStatusesContext:yc,VisualModePropStatusesRefContext:vc,VisualModeDragOverridesContext:wc,VisualModeSettersContext:L1,SequenceManager:rs,SequenceManagerRefContext:gc,SequenceStackTracesUpdateContext:wR,baseSchema:Dr,sequenceSchema:Zi,SequenceWithoutSchema:sb,sequenceStyleSchema:M1,sequenceVisualStyleSchema:cI,sequencePremountSchema:$1,textSchema:mc,transformSchema:kr,premountSchema:ns,flattenActiveSchema:Oh,getFlatSchemaWithAllKeys:Dh,RemotionRootContexts:hR,CompositionManagerProvider:rR,useVideo:pc,getRoot:uR,useMediaVolumeState:Zh,usePlayerMutedState:Kh,useMediaInTimeline:Vh,useLazyComponent:v1,truthy:Qi,SequenceContext:Rt,PremountContext:D1,usePremounting:La,useRemotionContexts:FR,RemotionContextProvider:PR,CSSUtils:Wb,setupEnvVariables:bR,MediaVolumeContext:Hh,SetMediaVolumeContext:Uh,getRemotionEnvironment:Vn,SharedAudioContext:is,SharedAudioContextProvider:wb,SharedAudioTagsContext:Rc,SharedAudioTagsContextProvider:xb,invalidCompositionErrorMessage:Q2,invalidFolderNameErrorMessage:S2,calculateMediaDuration:kc,isCompositionIdValid:x1,isFolderNameValid:l1,getPreviewDomElement:sR,compositionsRef:Bb,portalNode:cp,waitForRoot:cR,SetTimelineContext:es,CanUseRemotionHooksProvider:sp,CanUseRemotionHooks:Go,PrefetchProvider:gb,DurationsContextProvider:vb,IsPlayerContextProvider:I2,useIsPlayer:Eh,EditorPropsProvider:f1,EditorPropsContext:Ch,usePreload:Qo,NonceContext:$a,resolveVideoConfig:Ub,resolveVideoConfigOrCatch:vR,resolveVideoConfigWithMetadataOrCatch:yR,ResolveCompositionContext:dc,useResolvedVideoConfig:Ih,resolveCompositionsRef:N2,REMOTION_STUDIO_CONTAINER_ELEMENT:Vb,RenderAssetManager:Jo,persistCurrentFrame:k1,usePlaybackRate:Ph,useTimelineContext:bo,useTimelineSetFrame:R1,isIosSafari:Fc,WATCH_REMOTION_STATIC_FILES:RR,addSequenceStackTraces:dn,useMediaStartsAt:Ho,BufferingProvider:Cb,BufferingContextReact:as,getComponentsToAddStacksTo:rI,getSequenceComponent:iI,getSingleChildComponent:sI,CurrentScaleContext:SR,PixelDensityContext:CR,PreviewSizeContext:kR,calculateScale:ER,validateRenderAsset:hb,Log:_t,LogLevelContext:Xo,useLogLevel:Sr,playbackLogging:Gt,timeValueRef:A2,compositionSelectorRef:$R,RemotionEnvironmentContext:p1,warnAboutTooHighVolume:ls,AudioForPreview:Pb,OBJECTFIT_CONTAIN_CLASS_NAME:ba,InnerOffthreadVideo:Jh,useBasicMediaInTimeline:Eb,getInputPropsOverride:d1,setInputPropsOverride:$2,useVideoEnabled:dR,useAudioEnabled:fR,useIsPlayerBuffering:Ib,TimelinePosition:fp,DelayRenderContextType:y1,TimelineContext:ts,PlaybackRateContext:Th,AbsoluteTimeContext:Rh,RenderAssetManagerProvider:Vj,getEffectiveVisualModeValue:J1,CompositionRenderErrorContext:s1,useEffectChainState:Wa,createEffectChainState:cb,cleanupEffectChainState:hp,runEffectChain:Ba,useMemoizedEffects:za,useMemoizedEffectDefinitions:Da,createEffect:zj,createWebGLContextError:Ej,createWebGL2ContextError:ub,computeEffectiveSchemaValuesDotNotation:rb,interpolateKeyframedStatus:Oa,makeStaticDragOverride:dj,makeKeyframedDragOverride:fj,resolveDragOverrideValue:bc,getStaticDragOverrideValue:pj,OverrideIdsToNodePathsGettersContext:Lh,OverrideIdsToNodePathsSettersContext:aj,findPropsToDelete:tb,makeSequencePropsSubscriptionKey:Rr,getPropStatusesCtx:eb,getEffectPropStatusesCtx:Q1,hiddenField:$h,durationInFramesField:_h,freezeField:Ah,fromField:A1},Yb=e=>ge.Children.toArray(e).reduce((n,r)=>r.type===ge.Fragment?n.concat(Yb(r.props.children)):(n.push(r),n),[]),MR={durationInFrames:Yr.baseSchema.durationInFrames,name:Yr.sequenceSchema.name,hidden:Yr.sequenceSchema.hidden,showInTimeline:Yr.sequenceSchema.showInTimeline,freeze:Yr.baseSchema.freeze,trimBefore:Yr.sequenceSchema.trimBefore,layout:Yr.sequenceSchema.layout},_R=d.forwardRef(({offset:e=0,className:t="",stack:n=null,_remotionInternalRender:r=null,...o},i)=>(yI(),r?r({...o,offset:e,className:t||void 0,stack:n},i):u.jsx(O1,{children:o.children}))),Gb=Yr.withSchema({Component:_R,componentName:"<Series.Sequence>",componentIdentity:"dev.remotion.remotion.Series.Sequence",schema:MR,supportsEffects:!1}),AR=sb,Cy=({durationInFrames:e,offset:t,index:n,childrenLength:r})=>{const o=`index = ${n}, duration = ${e}`;(n!==r-1||e!==1/0)&&uc(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},NR=e=>{const t=d.useMemo(()=>{const n=Yb(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!==Gb)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 Cy({durationInFrames:l.props.durationInFrames,offset:l.props.offset,index:o,childrenLength:n.length}),ge.cloneElement(l,{_remotionInternalRender:(c,f)=>{const p=c.durationInFrames,{durationInFrames:h,children:g,offset:w,controls:x,stack:k,from:m,name:v,...y}=c,S=Cy({durationInFrames:p,offset:w,index:o,childrenLength:n.length}),b=i+S,E=i+p+S;return u.jsxs(u.Fragment,{children:[u.jsx(AR,{ref:f,name:v||"<Series.Sequence>",_remotionInternalDocumentationLink:v?void 0:"https://www.remotion.dev/docs/series",_remotionInternalStack:k??void 0,controls:x??void 0,from:b,durationInFrames:p,...y,children:u.jsx(O1,{children:g})}),r(o+1,E)]})}})};return r(0,0)},[e.children]);return u.jsx(gI,{children:u.jsx(Ft,{layout:"none",name:"<Series>",_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/series",...e,children:t})})},LR=Object.assign(zr({Component:NR,componentName:"<Series>",componentIdentity:"dev.remotion.remotion.Series",schema:hI,supportsEffects:!1}),{Sequence:Gb});dn(LR);var OR={"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";"},Iy={},DR=e=>{Iy[e]||(console.warn(e),Iy[e]=!0)},zR=e=>{for(const t of Object.keys(OR))if(e.includes(t))return{containsHex:!0,hexCode:t};return{containsHex:!1}},vp=e=>e.startsWith("/")?vp(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}/${vp(e)}`}return`/${vp(e)}`},WR=e=>e.split("/").map(o=>encodeURIComponent(o)).join("/"),Va=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=zR(e);t.containsHex&&DR(`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=WR(e),r=BR(n);return r.startsWith("/")?r:`/${r}`},VR=e=>{const t={...e,durationInFrames:1,fps:1};return ge.createElement(Mu,t)};dn(VR);var jy=e=>Math.round(e*1e5)/1e5,Dd=({element:e,desiredTime:t,logLevel:n,mountTime:r})=>{if(Lu(e.currentTime,t))return{wait:Promise.resolve(t),cancel:()=>{}};nu({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)}}},HR=({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=Dd({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=Dd({element:e,desiredTime:p+i*g,logLevel:r,mountTime:o});s=w.cancel,w.wait.then(x=>{const k=Math.abs(t-x);if(jy(k)<=jy(i))return l();const m=Dd({element:e,desiredTime:t+i,logLevel:r,mountTime:o});return s=m.cancel,m.wait.then(()=>{l()}).catch(v=>{c(v)})}).catch(x=>{c(x)})}),s=f.cancel}),cancel:()=>{s()}}},UR=({onError:e,volume:t,allowAmplificationDuringRender:n,playbackRate:r,onDuration:o,toneFrequency:i,name:s,acceptableTimeShiftInSeconds:a,delayRenderRetries:l,delayRenderTimeoutInMilliseconds:c,loopVolumeCurveBehavior:f,audioStreamIndex:p,onVideoFrame:h,preservePitch:g,...w},x)=>{const k=So(),m=Nt(),v=ss(f??"repeat"),y=hc(),S=d.useRef(null),b=d.useContext(Rt),E=Ho(),C=vt(),j=Sr(),I=_a(),{delayRender:P,continueRender:L}=or(),{registerRenderAsset:W,unregisterRenderAsset:$}=d.useContext(Jo),A=d.useMemo(()=>`video-${qo(w.src??"")}-${b==null?void 0:b.cumulatedFrom}-${b==null?void 0:b.relativeFrom}-${b==null?void 0:b.durationInFrames}`,[w.src,b==null?void 0:b.cumulatedFrom,b==null?void 0:b.relativeFrom,b==null?void 0:b.durationInFrames]);if(!y)throw new Error("No video config found");const U=ei({volume:t,frame:v,mediaVolume:1});ls(U),d.useEffect(()=>{if(!w.src)throw new Error("No src passed");if(!w.muted&&!(U<=0)&&window.remotion_audioEnabled)return W({type:"video",src:br(w.src),id:A,frame:k,volume:U,mediaFrame:m,playbackRate:r??1,toneFrequency:i??1,audioStartFrame:Math.max(0,-((b==null?void 0:b.cumulatedNegativeFrom)??0)),audioStreamIndex:p??0}),()=>$(A)},[w.muted,w.src,W,A,$,U,m,k,r,i,b==null?void 0:b.cumulatedNegativeFrom,p]),d.useImperativeHandle(x,()=>S.current,[]),Zb({ref:S,onVideoFrame:h}),d.useEffect(()=>{var me,re;if(!window.remotion_videoEnabled)return;const{current:O}=S;if(!O)return;const R=Tb({frame:m,playbackRate:r||1,startFrom:-E,fps:y.fps}),Z=P(`Rendering <Html5Video /> with src="${w.src}" at time ${R}`,{retries:l??void 0,timeoutInMilliseconds:c??void 0});if(((re=(me=window.process)==null?void 0:me.env)==null?void 0:re.NODE_ENV)==="test"){L(Z);return}if(Lu(O.currentTime,R)){if(O.readyState>=2){L(Z);return}const ee=()=>{L(Z)};return O.addEventListener("loadeddata",ee,{once:!0}),()=>{O.removeEventListener("loadeddata",ee)}}const B=()=>{L(Z)},ie=HR({element:O,desiredTime:R,fps:y.fps,logLevel:j,mountTime:I});ie.prom.then(()=>{L(Z)}),O.addEventListener("ended",B,{once:!0});const ue=()=>{var ee;if(O!=null&&O.error){if(console.error("Error occurred in video",O==null?void 0:O.error),e)return;throw new Ti({message:`The browser threw an error while playing the video ${w.src}: Code ${O.error.code} - ${(ee=O==null?void 0:O.error)==null?void 0:ee.message}. See https://remotion.dev/docs/media-playback-error for help. Pass an onError() prop to handle the error.`,src:w.src})}else throw new Ti({message:"The browser threw an error",src:w.src})};return O.addEventListener("error",ue,{once:!0}),()=>{ie.cancel(),O.removeEventListener("ended",B),O.removeEventListener("error",ue),L(Z)}},[v,w.src,r,y.fps,m,E,e,l,c,j,I,L,P]);const{src:z}=w;return C.isRendering&&d.useLayoutEffect(()=>{var B,ie;if(((ie=(B=window.process)==null?void 0:B.env)==null?void 0:ie.NODE_ENV)==="test")return;const O=P("Loading <Html5Video> duration with src="+z,{retries:l??void 0,timeoutInMilliseconds:c??void 0}),{current:R}=S,Z=()=>{R!=null&&R.duration&&o(z,R.duration),L(O)};return R!=null&&R.duration?(o(z,R.duration),L(O)):R==null||R.addEventListener("loadedmetadata",Z,{once:!0}),()=>{R==null||R.removeEventListener("loadedmetadata",Z),L(O)}},[z,o,l,c,L,P]),u.jsx("video",{ref:S,disableRemotePlayback:!0,...w})},ZR=d.forwardRef(UR),KR=(e,t)=>{const{startFrom:n,endAt:r,trimBefore:o,trimAfter:i,name:s,pauseWhenBuffering:a,stack:l,_remotionInternalNativeLoopPassed:c,showInTimeline:f,onAutoPlayError:p,onVideoFrame:h,...g}=e,{loop:w,...x}=e,{fps:k}=ht(),m=vt(),v=Na(a);if(m.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:y,setDurations:S}=d.useContext(zh);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 b=Qo(e.src),E=d.useCallback((P,L)=>{S({type:"got-duration",durationInSeconds:L,src:P})},[S]),C=y[br(b)]??y[br(e.src)];jc({startFrom:n,endAt:r,trimBefore:o,trimAfter:i});const{trimBeforeValue:j,trimAfterValue:I}=Tc({startFrom:n,endAt:r,trimBefore:o,trimAfter:i});if(w&&C!==void 0){if(!Number.isFinite(C))return u.jsx(ru,{...x,ref:t,stack:l,_remotionInternalNativeLoopPassed:!0});const P=C*k;return u.jsx(Ec,{durationInFrames:kc({trimAfter:I,mediaDurationInFrames:P,playbackRate:e.playbackRate??1,trimBefore:j}),layout:"none",name:s,showInTimeline:!1,children:u.jsx(ru,{...x,ref:t,stack:l,_remotionInternalNativeLoopPassed:!0})})}return typeof j<"u"||typeof I<"u"?u.jsx(Ft,{layout:"none",from:0-(j??0),showInTimeline:!1,durationInFrames:I===void 0?void 0:I/(e.playbackRate??1),name:s,children:u.jsx(ru,{pauseWhenBuffering:v,onVideoFrame:h,...g,ref:t,stack:l})}):(Ic({playbackRate:e.playbackRate,preservePitch:e.preservePitch,volume:e.volume},"Html5Video"),m.isRendering?u.jsx(ZR,{onDuration:E,onVideoFrame:h??null,...g,ref:t}):u.jsx(qh,{onlyWarnForMediaSeekingError:!1,...g,ref:t,onVideoFrame:h??null,pauseWhenBuffering:v,onDuration:E,_remotionInternalStack:l??null,_remotionInternalNativeLoopPassed:c??!1,showInTimeline:f??!0,onAutoPlayError:p??void 0}))},ru=d.forwardRef(KR);dn(ru);aI();var YR={},GR=new Proxy(YR,{get(e,t){return t==="Bundling"||t==="Rendering"||t==="Log"||t==="Puppeteer"||t==="Output"?GR:()=>{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";dn(Ft);oI(Ft);dn(Mu);dn(k2);typeof window<"u"&&(window.remotion_renderReady=!1,window.remotion_delayRenderTimeouts||(window.remotion_delayRenderTimeouts={}),window.remotion_delayRenderHandles=[]);var 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}},qR={"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"}},JR={"style.backgroundColor":{type:"color",default:"transparent",description:"Color"}},QR={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}},eF={...QR},tF={...XR,...JR,...qR,...eF},nF={layout:{type:"enum",default:"absolute-fill",description:"Layout",variants:{"absolute-fill":tF,none:{}}}};({...nF.layout});var rF=(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 oF(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 iF(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 sF(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 Mc={validateFps:sF,validateDimension:oF,validateDurationInFrames:iF,validateDefaultAndInputProps:rF};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 Bt=25,wp=16,aF=()=>u.jsx("svg",{width:Bt,height:Bt,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"})}),lF=()=>u.jsxs("svg",{viewBox:"0 0 100 100",width:Bt,height:Bt,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"})]}),uF=({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:wp,width:wp,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"})]})},cF=()=>u.jsx("svg",{width:Bt,height:Bt,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"})}),dF=()=>u.jsx("svg",{width:Bt,height:Bt,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"})}),Ty="__remotion_buffering_indicator",Ry="__remotion_buffering_animation",fF={width:Bt,height:Bt,overflow:"hidden",lineHeight:"normal",fontSize:"inherit"},pF={width:14,height:14,overflow:"hidden",lineHeight:"normal",fontSize:"inherit"},hF=({type:e})=>{const t=e==="player"?fF:pF;return u.jsxs(u.Fragment,{children:[u.jsx("style",{type:"text/css",children:`
97
+ @keyframes ${Ry} {
98
+ 0% {
99
+ rotate: 0deg;
100
+ }
101
+ 100% {
102
+ rotate: 360deg;
103
+ }
104
+ }
105
+
106
+ .${Ty} {
107
+ animation: ${Ry} 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:Ty,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})})})]})},mF=({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},Xb=({previewSize:e,compositionWidth:t,compositionHeight:n,canvasSize:r})=>{const o=ke.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}},qb=({config:e,style:t,canvasSize:n,overflowVisible:r,layout:o})=>e?{position:"relative",overflow:r?"visible":"hidden",...mF({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}:{},Jb=({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"}:{},Qb=({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"}},eS=ge.createContext(void 0),tS=ge.createContext(void 0);class gF{constructor(){We(this,"listeners",{ended:[],error:[],pause:[],play:[],ratechange:[],scalechange:[],seeked:[],timeupdate:[],frameupdate:[],fullscreenchange:[],volumechange:[],mutechange:[],waiting:[],resume:[]});We(this,"dispatchSeek",t=>{this.dispatchEvent("seeked",{frame:t})});We(this,"dispatchVolumeChange",t=>{this.dispatchEvent("volumechange",{volume:t})});We(this,"dispatchPause",()=>{this.dispatchEvent("pause",void 0)});We(this,"dispatchPlay",()=>{this.dispatchEvent("play",void 0)});We(this,"dispatchEnded",()=>{this.dispatchEvent("ended",void 0)});We(this,"dispatchRateChange",t=>{this.dispatchEvent("ratechange",{playbackRate:t})});We(this,"dispatchScaleChange",t=>{this.dispatchEvent("scalechange",{scale:t})});We(this,"dispatchError",t=>{this.dispatchEvent("error",{error:t})});We(this,"dispatchTimeUpdate",t=>{this.dispatchEvent("timeupdate",t)});We(this,"dispatchFrameUpdate",t=>{this.dispatchEvent("frameupdate",t)});We(this,"dispatchFullscreenChange",t=>{this.dispatchEvent("fullscreenchange",t)});We(this,"dispatchMuteChange",t=>{this.dispatchEvent("mutechange",t)});We(this,"dispatchWaiting",t=>{this.dispatchEvent("waiting",t)});We(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 yF{constructor(){We(this,"listeners",{error:[],waiting:[],resume:[]});We(this,"dispatchError",t=>{this.dispatchEvent("error",{error:t})});We(this,"dispatchWaiting",t=>{this.dispatchEvent("waiting",t)});We(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 nS=e=>{const t=d.useContext(ke.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])},vF=({children:e,currentPlaybackRate:t})=>{const[n]=d.useState(()=>new gF);if(!d.useContext(ke.BufferingContextReact))throw new Error("BufferingContextReact not found");return d.useEffect(()=>{t&&n.dispatchRateChange(t)},[n,t]),nS(n),u.jsx(eS.Provider,{value:n,children:e})},Qh=(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},_c=()=>{const[e,t,n]=ke.Timeline.usePlayingState(),[r,o]=d.useState(!1),i=ke.Timeline.useTimelinePosition(),s=d.useRef(i),a=ke.Timeline.useTimelineSetFrame(),l=ke.Timeline.useTimelineSetFrame(),c=d.useContext(ke.SharedAudioContext),f=d.useContext(ke.SharedAudioTagsContext),{audioAndVideoTags:p}=ke.useTimelineContext(),h=d.useRef(i);h.current=i;const g=ke.useVideo(),w=ke.useUnsafeVideoConfig(),x=d.useContext(eS),k=((w==null?void 0:w.durationInFrames)??1)-1,m=i===k,v=i===0;if(!x)throw new TypeError("Expected Player event emitter context");const y=d.useContext(ke.BufferingContextReact);if(!y)throw new Error("Missing the buffering context. Most likely you have a Remotion version mismatch.");const{buffering:S}=y,b=d.useCallback(O=>{const R=w?ke.TimelinePosition.clampFrameToCompositionRange(O,w.durationInFrames):Math.max(0,O);g!=null&&g.id&&l(Z=>({...Z,[g.id]:R})),h.current=R,x.dispatchSeek(R)},[w,x,l,g==null?void 0:g.id]),E=d.useCallback(O=>{n.current||(o(!0),m&&b(0),c==null||c.resume(),f&&f.numberOfAudioTags>0&&O&&f.playAllAudios(),p.current.forEach(R=>R.play("player play() was called and playing audio from a click")),n.current=!0,t(!0),s.current=h.current,x.dispatchPlay())},[n,m,c,f,t,x,b,p]),C=d.useCallback(()=>{n.current&&(n.current=!1,t(!1),x.dispatchPause(),c==null||c.suspend())},[x,n,t,c]),j=d.useCallback(()=>{n.current&&(n.current=!1,h.current=s.current,w&&(l(O=>({...O,[w.id]:s.current})),t(!1),x.dispatchPause()))},[w,x,n,t,l]),I=g==null?void 0:g.id,P=d.useCallback(O=>{if(!I)return null;n.current||a(R=>{const Z=R[I]??window.remotion_initialFrame??0,B=Math.max(0,Z-O);return Z===B?R:{...R,[I]:B}})},[n,a,I]),L=d.useCallback(O=>{if(!I)return null;n.current||a(R=>{const Z=R[I]??window.remotion_initialFrame??0,B=Math.min(k,Z+O);return Z===B?R:{...R,[I]:B}})},[I,n,k,a]),W=d.useCallback(O=>{n.current?C():E(O)},[n,C,E]),$=d.useCallback(()=>n.current,[n]),A=d.useCallback(()=>h.current,[h]),U=d.useCallback(()=>S.current,[S]);return d.useMemo(()=>({frameBack:P,frameForward:L,isLastFrame:m,emitter:x,playing:e,play:E,pause:C,seek:b,isFirstFrame:v,getCurrentFrame:A,isPlaying:$,isBuffering:U,pauseAndReturnToPlayStart:j,hasPlayed:r,toggle:W}),[x,P,L,r,v,m,A,C,j,E,e,b,W,$,U])},wF=({browserMediaControlsBehavior:e,videoConfig:t,playbackRate:n})=>{const{playing:r,pause:o,play:i,emitter:s,getCurrentFrame:a,seek:l}=_c(),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])},xF=({time:e,currentFrame:t,playbackSpeed:n,fps:r,actualLastFrame:o,actualFirstFrame:i,framesAdvanced:s,shouldLoop:a})=>{const c=(n<0?Math.ceil:Math.floor)(e*n/(1e3/r))-s,f=c+t,p=t>o||t<i,h=f>o||f<i,g=!a&&h&&!p;return n>0?h?{nextFrame:i,framesToAdvance:c,hasEnded:g}:{nextFrame:f,framesToAdvance:c,hasEnded:g}:h?{nextFrame:o,framesToAdvance:c,hasEnded:g}:{nextFrame:f,framesToAdvance:c,hasEnded:g}},Fy=()=>typeof document>"u"?!1:document.visibilityState==="hidden",bF=()=>{const e=d.useRef(Fy());return d.useEffect(()=>{const t=()=>{e.current=Fy()};return document.addEventListener("visibilitychange",t),()=>{document.removeEventListener("visibilitychange",t)}},[]),e},SF=.1,Py=({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)<SF+f&&!i||Math.abs(a)<Number.EPSILON?!1:(ke.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)},kF=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}`)},EF=({loop:e,playbackRate:t,moveToBeginningWhenEnded:n,inFrame:r,outFrame:o,browserMediaControlsBehavior:i,getCurrentFrame:s,muted:a})=>{const l=ke.useUnsafeVideoConfig(),c=ke.Timeline.useTimelinePosition(),{playing:f,pause:p,emitter:h,isPlaying:g}=_c(),w=ke.Timeline.useTimelineSetFrame(),x=d.useContext(ke.SharedAudioContext),k=ke.useLogLevel(),m=bF(),v=d.useRef(0),y=d.useContext(ke.BufferingContextReact);if(!y)throw new Error("Missing the buffering context. Most likely you have a Remotion version mismatch.");wF({browserMediaControlsBehavior:i,playbackRate:t,videoConfig:l}),d.useLayoutEffect(()=>{if(!x||!x.audioContext||!l||a)return;Py({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 S=x==null?void 0:x.audioContext;if(!S||!l||a)return;const b=()=>{const E=x==null?void 0:x.getAudioContextState();E&&kF(E)&&Py({audioContext:S,audioSyncAnchor:x.audioSyncAnchor,absoluteTimeInSeconds:s()/l.fps,globalPlaybackRate:t,logLevel:k,force:!0})};return S==null||S.addEventListener("statechange",b),()=>{S==null||S.removeEventListener("statechange",b)}},[l,s,k,a,t,x]),d.useEffect(()=>{var $;if(!l)return;if(!f){($=x==null?void 0:x.suspend)==null||$.call(x);return}let S=!1,b=null,E=performance.now(),C=0;const j=()=>{b!==null&&(b.type==="raf"?cancelAnimationFrame(b.id):clearTimeout(b.id))},I=()=>{S=!0,j()},P=()=>{var ie,ue;if(S)return;if(!g()){(ie=x==null?void 0:x.suspend)==null||ie.call(x);return}!a&&!y.buffering.current&&((ue=x==null?void 0:x.resume)==null||ue.call(x));const A=performance.now()-E,U=o??l.durationInFrames-1,z=r??0,O=s(),{nextFrame:R,framesToAdvance:Z,hasEnded:B}=xF({time:A,currentFrame:O,playbackSpeed:t,fps:l.fps,actualFirstFrame:z,actualLastFrame:U,framesAdvanced:C,shouldLoop:e});if(C+=Z,R!==s()&&(!B||n)&&!y.buffering.current&&w(me=>({...me,[l.id]:R})),B){I(),p(),h.dispatchEnded();return}L()},L=()=>{var U,z;const A=((U=x==null?void 0:x.getIsResumingAudioContext)==null?void 0:U.call(x))??null;if(A!==null&&!a){A.then(()=>{E=performance.now(),C=0,L()});return}if(y.buffering.current){a||(z=x==null?void 0:x.suspend)==null||z.call(x);const O=y.listenForResume(()=>{O.remove(),E=performance.now(),C=0,L()});return}if(m.current){b={type:"timeout",id:setTimeout(P,1e3/l.fps)};return}b={type:"raf",id:requestAnimationFrame(P)}};L();const W=()=>{document.visibilityState!=="visible"&&(j(),P())};return window.addEventListener("visibilitychange",W),()=>{window.removeEventListener("visibilitychange",W),I()}},[l,e,p,f,w,h,t,r,o,n,m,s,y,g,x,k,a]),d.useEffect(()=>{const S=performance.now(),b=S-v.current;if(b>=250){h.dispatchTimeUpdate({frame:c}),v.current=S;return}const E=setTimeout(()=>{h.dispatchTimeUpdate({frame:c}),v.current=performance.now()},250-b);return()=>clearTimeout(E)},[h,c]),d.useEffect(()=>{h.dispatchFrameUpdate({frame:c})},[h,c])},zd=[],Bd=e=>e?"current"in e?e.current:e:null,em=(e,t)=>{const[n,r]=d.useState(()=>{const s=Bd(e);if(!s)return null;const a=s.getClientRects();return a[0]?{width:a[0].width,height:a[0].height,left:a[0].x,top:a[0].y,windowSize:{height:window.innerHeight,width:window.innerWidth}}:null}),o=d.useMemo(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(s=>{const{contentRect:a,target:l}=s[0],c=l.getClientRects();if(!(c!=null&&c[0])){r(null);return}const f=a.width===0?1:c[0].width/a.width,p=a.height===0?1:c[0].height/a.height,h=t.shouldApplyCssTransforms||f===0?c[0].width:c[0].width*(1/f),g=t.shouldApplyCssTransforms||p===0?c[0].height:c[0].height*(1/p);r(w=>w&&w.width===h&&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:h,height:g,left:c[0].x,top:c[0].y,windowSize:{height:window.innerHeight,width:window.innerWidth}})}),[t.shouldApplyCssTransforms]),i=d.useCallback(()=>{const s=Bd(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=Bd(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(()=>(zd.push(i),()=>{zd=zd.filter(s=>s!==i)}),[i]),d.useMemo(()=>n?{...n,refresh:i}:null,[n,i])},tm=e=>e??"__remotion-player",CF={display:"flex",justifyContent:"center",alignItems:"center",flex:1,height:"100%",width:"100%"};class rS extends ge.Component{constructor(){super(...arguments);We(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:CF,children:this.props.errorFallback({error:this.state.hasError})}):this.props.children}}var IF=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}},Wd={backgroundColor:"red",position:"absolute",padding:12,fontFamily:"Arial"},jF=["28d262b44cc61fa750f1686b16ad0604dabfe193fbc263eec05c89b7ad4c2cd6","4db1b0a94be33165dfefcb3ba03d04c7a2666dd27c496d3dc9fa41858e94925e","fbc48530bbf245da790f63675e84e06bab38c3b114fab07eb350025119922bdc","7baf10a8932757b1b3a22b3fce10a048747ac2f8eaf638603487e3705b07eb83","8a6c21a598d8c667272b5207c051b85997bf5b45d5fb712378be3f27cd72c6a6","a2f7aaac9c50a9255e7fc376110c4e0bfe153722dc66ed3c5d3bf2a135f65518"],$y=!1,TF=()=>{const[e,t]=ge.useState(!1);return d.useEffect(()=>{$y||($y=!0,IF().then(n=>{n&&jF.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,Wd,{zIndex:"9999",cssText:`${Wd.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:Wd,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},My=({playing:e,buffering:t})=>e&&t?u.jsx(hF,{type:"player"}):e?u.jsx(lF,{}):u.jsx(aF,{}),ii=12,_y=5,RF=({volume:e,isVertical:t,onBlur:n,inputRef:r,setVolume:o})=>{const i=d.useMemo(()=>{const h={paddingLeft:5,height:Bt,width:Ao,display:"inline-flex",alignItems:"center"};return t?{...h,position:"absolute",transform:`rotate(-90deg) translateX(${Ao/2+Bt/2}px)`}:{...h}},[t]),s=typeof ge.useId>"u"?"volume-slider":ge.useId(),[a]=d.useState(()=>`__remotion-volume-slider-${qo(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:_y/2,cursor:"pointer",height:_y,width:Ao,backgroundImage:`linear-gradient(
114
+ to right,
115
+ white ${e*100}%, rgba(255, 255, 255, 0) ${e*100}%
116
+ )`};return t?{...p,bottom:Bt+Ao/2}:p},[t,e]),f=`
117
+ .${a}::-webkit-slider-thumb {
118
+ -webkit-appearance: none;
119
+ background-color: white;
120
+ border-radius: ${ii/2}px;
121
+ box-shadow: 0 0 2px black;
122
+ height: ${ii}px;
123
+ width: ${ii}px;
124
+ }
125
+
126
+ .${a}::-moz-range-thumb {
127
+ -webkit-appearance: none;
128
+ background-color: white;
129
+ border-radius: ${ii/2}px;
130
+ box-shadow: 0 0 2px black;
131
+ height: ${ii}px;
132
+ width: ${ii}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})]})},FF=e=>u.jsx(RF,{...e}),Ao=100,PF=({displayVerticalVolumeSlider:e,renderMuteButton:t,renderVolumeSlider:n})=>{const[r,o]=ke.usePlayerMutedState(),[i,s]=ke.useMediaVolumeState(),[a,l]=d.useState(!1),c=d.useRef(null),f=d.useRef(null),p=Qh(c,!1),h=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(S=>!S)},[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:Bt,height:Bt,cursor:"pointer",appearance:"none",background:"none",border:"none",padding:0}),[]),m=d.useCallback(({muted:S,volume:b})=>{const E=S||b===0;return u.jsx("button",{"aria-label":E?"Unmute sound":"Mute sound",title:E?"Unmute sound":"Mute sound",onClick:w,onBlur:h,onFocus:()=>l(!0),style:k,type:"button",children:E?u.jsx(cF,{}):u.jsx(dF,{})})},[h,w,k]),v=d.useMemo(()=>t?t({muted:r,volume:i}):m({muted:r,volume:i}),[r,i,m,t]),y=d.useMemo(()=>(a||p)&&!r&&!ke.isIosSafari()?(n??FF)({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:[v,y]})};function $F(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 MF=35,_F=70,AF={height:30,paddingRight:15,paddingLeft:12,display:"flex",flexDirection:"row",alignItems:"center"},NF={width:22,display:"flex",alignItems:"center"},LF={width:14,height:14,color:"black"},OF=()=>u.jsx("svg",{viewBox:"0 0 512 512",style:LF,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"})}),DF=e=>{const t=e.toString();return t.includes(".")?t:t+".0"},zF=({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(()=>({...AF,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:NF,children:e===n?u.jsx(OF,{}):null}),DF(e),"x"]},e)},BF=({setIsComponentVisible:e,playbackRates:t,canvasSize:n})=>{const{setPlaybackRate:r,playbackRate:o}=ke.usePlaybackRate(),[i,s]=d.useState(o);d.useEffect(()=>{const c=f=>{if(f.preventDefault(),f.key==="ArrowUp"){const p=t.findIndex(h=>h===i);if(p===0)return;s(p===-1?t[0]:t[p-1])}else if(f.key==="ArrowDown"){const p=t.findIndex(h=>h===i);if(p===t.length-1)return;s(p===-1?t[t.length-1]:t[p+1])}else f.key==="Enter"&&(r(i),e(!1))};return window.addEventListener("keydown",c),()=>{window.removeEventListener("keydown",c)}},[t,i,r,e]);const a=d.useCallback(c=>{r(c),e(!1)},[e,r]),l=d.useMemo(()=>({position:"absolute",right:0,width:125,maxHeight:n.height-_F-MF,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(zF,{selectedRate:o,onSelect:a,rate:c,keyboardSelectedRate:i},c))})},WF={fontSize:13,fontWeight:"bold",color:"white",border:"2px solid white",borderRadius:20,paddingLeft:8,paddingRight:8,paddingTop:2,paddingBottom:2},xp={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"},VF={...xp,position:"relative"},HF=({playbackRates:e,canvasSize:t})=>{const{ref:n,isComponentVisible:r,setIsComponentVisible:o}=$F(!1),{playbackRate:i}=ke.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:VF,onClick:s,children:[u.jsxs("div",{style:WF,children:[i,"x"]}),r&&u.jsx(BF,{canvasSize:t,playbackRates:e,setIsComponentVisible:o})]})})},Ay=(e,t,n)=>Math.round(os(e,[0,n],[0,t-1],{extrapolateLeft:"clamp",extrapolateRight:"clamp"})),Ri=5,$s=12,bp=4,UF={userSelect:"none",WebkitUserSelect:"none",paddingTop:bp,paddingBottom:bp,boxSizing:"border-box",cursor:"pointer",position:"relative",touchAction:"none"},ZF={height:Ri,backgroundColor:"rgba(255, 255, 255, 0.25)",width:"100%",borderRadius:Ri/2},KF=e=>{let t=e;for(;t.parentElement;)t=t.parentElement;return t},YF=({durationInFrames:e,onSeekEnd:t,onSeekStart:n,inFrame:r,outFrame:o})=>{const i=d.useRef(null),s=Qh(i,!1),a=em(i,{triggerOnWindowResize:!0,shouldApplyCssTransforms:!0}),{seek:l,play:c,pause:f,playing:p}=_c(),h=ke.Timeline.useTimelinePosition(),[g,w]=d.useState({dragging:!1}),x=(a==null?void 0:a.width)??0,k=d.useCallback(E=>{var I;if(E.button!==0)return;const C=(I=i.current)==null?void 0:I.getBoundingClientRect().left,j=Ay(E.clientX-C,e,x);f(),l(j),w({dragging:!0,wasPlaying:p}),n()},[e,x,f,l,p,n]),m=d.useCallback(E=>{var I;if(!a)throw new Error("Player has no size");if(!g.dragging)return;const C=(I=i.current)==null?void 0:I.getBoundingClientRect().left,j=Ay(E.clientX-C,e,a.width);l(j)},[g.dragging,e,l,a]),v=d.useCallback(()=>{w({dragging:!1}),g.dragging&&(g.wasPlaying?c():f(),t())},[g,t,f,c]);d.useEffect(()=>{if(!g.dragging)return;const E=KF(i.current);return E.addEventListener("pointermove",m),E.addEventListener("pointerup",v),()=>{E.removeEventListener("pointermove",m),E.removeEventListener("pointerup",v)}},[g.dragging,m,v]);const y=d.useMemo(()=>({height:$s,width:$s,borderRadius:$s/2,position:"absolute",top:bp-$s/2+5/2,backgroundColor:"white",left:Math.max(0,h/Math.max(1,e-1)*x-$s/2),boxShadow:"0 0 2px black",opacity:Number(s||g.dragging)}),[s,g.dragging,e,h,x]),S=d.useMemo(()=>({height:Ri,backgroundColor:"rgba(255, 255, 255, 1)",width:(h-(r??0))/(e-1)*x,marginLeft:(r??0)/(e-1)*x,borderRadius:Ri/2}),[e,h,r,x]),b=d.useMemo(()=>({height:Ri,backgroundColor:"rgba(255, 255, 255, 0.25)",width:((o??e-1)-(r??0))/(e-1)*100+"%",marginLeft:(r??0)/(e-1)*100+"%",borderRadius:Ri/2,position:"absolute"}),[e,r,o]);return u.jsxs("div",{ref:i,onPointerDown:k,style:UF,children:[u.jsxs("div",{style:ZF,children:[u.jsx("div",{style:b}),u.jsx("div",{style:S})]}),u.jsx("div",{style:y})]})},Ny=e=>{const t=Math.floor(e/60),n=Math.floor(e-t*60);return`${String(t)}:${String(n).padStart(2,"0")}`},GF=({durationInFrames:e,maxTimeLabelWidth:t,fps:n})=>{const r=ke.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:[Ny(s/n)," / ",Ny(e/n)]})},XF=10,Sp=12,qF=({allowFullscreen:e,playerWidth:t})=>d.useMemo(()=>{const r=Bt,o=Bt,i=e?wp:0,s=o+r+i+Sp*2+XF*2,a=t-s,l=Math.max(a,0),c=l-Ao,p=(c<Ao?l:c)+s+Ao,h=t<p;return{maxTimeLabelWidth:l===0?null:l,displayVerticalVolumeSlider:h}},[e,t]),JF=[0,.013,.049,.104,.175,.259,.352,.45,.55,.648,.741,.825,.896,.951,.987],QF=[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],eP=1/.7,tP={boxSizing:"border-box",position:"absolute",bottom:0,width:"100%",paddingTop:40,paddingBottom:10,backgroundImage:`linear-gradient(to bottom,${JF.map((e,t)=>`hsla(0, 0%, 0%, ${e}) ${QF[t]*eP}%`).join(", ")}, hsl(0, 0%, 0%) 100%)`,backgroundSize:"auto 145px",display:"flex",paddingRight:Sp,paddingLeft:Sp,flexDirection:"column",transition:"opacity 0.3s"},nP={display:"flex",flexDirection:"row",width:"100%",alignItems:"center",justifyContent:"center",userSelect:"none",WebkitUserSelect:"none"},rP={display:"flex",flexDirection:"row",userSelect:"none",WebkitUserSelect:"none",alignItems:"center"},Ms={width:12},oP={height:8},iP={flex:1},sP={},aP=({durationInFrames:e,isFullscreen:t,fps:n,showVolumeControls:r,onFullscreenButtonClick:o,allowFullscreen:i,onExitFullscreenButtonClick:s,spaceKeyToPlayOrPause:a,onSeekEnd:l,onSeekStart:c,inFrame:f,outFrame:p,initiallyShowControls:h,canvasSize:g,renderPlayPauseButton:w,renderFullscreenButton:x,alwaysShowControls:k,showPlaybackRateControl:m,containerRef:v,buffering:y,hideControlsWhenPointerDoesntMove:S,onPointerDown:b,onDoubleClick:E,renderMuteButton:C,renderVolumeSlider:j,playing:I,toggle:P,renderCustomControls:L})=>{const W=d.useRef(null),[$,A]=d.useState(!1),U=Qh(v,S),{maxTimeLabelWidth:z,displayVerticalVolumeSlider:O}=qF({allowFullscreen:i,playerWidth:(g==null?void 0:g.width)??0}),[R,Z]=d.useState(()=>{if(typeof h=="boolean")return h;if(typeof h=="number"){if(h%1!==0)throw new Error("initiallyShowControls must be an integer or a boolean");if(Number.isNaN(h))throw new Error("initiallyShowControls must not be NaN");if(!Number.isFinite(h))throw new Error("initiallyShowControls must be finite");if(h<=0)throw new Error("initiallyShowControls must be a positive integer");return h}throw new TypeError("initiallyShowControls must be a number or a boolean")}),B=d.useMemo(()=>({...tP,opacity:Number(U||!I||R||k)}),[U,R,I,k]);d.useEffect(()=>{W.current&&a&&W.current.focus({preventScroll:!0})},[I,a]),d.useEffect(()=>{A((typeof document<"u"&&(document.fullscreenEnabled||document.webkitFullscreenEnabled))??!1)},[]),d.useEffect(()=>{if(R===!1)return;const q=setTimeout(()=>{Z(!1)},R===!0?2e3:R);return()=>{clearInterval(q)}},[R]);const ie=d.useMemo(()=>{if(m===!0)return[.5,.8,1,1.2,1.5,1.8,2,2.5,3];if(Array.isArray(m)){for(const ce of m){if(typeof ce!="number")throw new Error("Every item in showPlaybackRateControl must be a number");if(ce<=0)throw new Error("Every item in showPlaybackRateControl must be positive")}return m}return null},[m]),ue=L?L():null,me=d.useRef(null),re=d.useRef(null),ee=d.useCallback(ce=>{(ce.target===me.current||ce.target===re.current)&&(b==null||b(ce))},[b]),K=d.useCallback(ce=>{(ce.target===me.current||ce.target===re.current)&&(E==null||E(ce))},[E]);return u.jsxs("div",{ref:me,style:B,onPointerDown:ee,onDoubleClick:K,children:[u.jsxs("div",{ref:re,style:nP,children:[u.jsxs("div",{style:rP,children:[u.jsx("button",{ref:W,type:"button",style:xp,onClick:P,"aria-label":I?"Pause video":"Play video",title:I?"Pause video":"Play video",children:w===null?u.jsx(My,{buffering:y,playing:I}):w({playing:I,isBuffering:y})??u.jsx(My,{buffering:y,playing:I})}),r?u.jsxs(u.Fragment,{children:[u.jsx("div",{style:Ms}),u.jsx(PF,{renderMuteButton:C,renderVolumeSlider:j,displayVerticalVolumeSlider:O})]}):null,u.jsx("div",{style:Ms}),u.jsx(GF,{durationInFrames:e,fps:n,maxTimeLabelWidth:z}),u.jsx("div",{style:Ms})]}),u.jsx("div",{style:iP}),ue,ue&&ie&&g?u.jsx("div",{style:Ms}):null,ie&&g&&u.jsx(HF,{canvasSize:g,playbackRates:ie}),ie&&$&&i?u.jsx("div",{style:Ms}):null,u.jsx("div",{style:sP,children:$&&i?u.jsx("button",{type:"button","aria-label":t?"Exit fullscreen":"Enter Fullscreen",title:t?"Exit fullscreen":"Enter Fullscreen",style:xp,onClick:t?s:o,children:x===null?u.jsx(uF,{isFullscreen:t}):x({isFullscreen:t})}):null})]}),u.jsx("div",{style:oP}),u.jsx(YF,{onSeekEnd:l,onSeekStart:c,durationInFrames:e,inFrame:f,outFrame:p})]})},oS=typeof document>"u",lP=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}}},uP=e=>new Promise(t=>setTimeout(t,e)),cP=()=>{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])},dP=(e,t,n)=>{const r=cP(),o=d.useCallback(async l=>{if(l instanceof PointerEvent?l.pointerType==="touch":l.nativeEvent.pointerType==="touch"){e(l);return}r.clearPendingPromises();const c=lP(uP(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])},kp=ge.version.split(".")[0];if(kp==="0")throw new Error(`Version ${kp} of "react" is not supported by Remotion`);var fP=parseInt(kp,10)>=18,pP=({controls:e,style:t,loop:n,autoPlay:r,allowFullscreen:o,inputProps:i,clickToPlay:s,showVolumeControls:a,doubleClickToFullscreen:l,spaceKeyToPlayOrPause:c,errorFallback:f,playbackRate:p,renderLoading:h,renderPoster:g,className:w,moveToBeginningWhenEnded:x,showPosterWhenUnplayed:k,showPosterWhenEnded:m,showPosterWhenPaused:v,showPosterWhenBuffering:y,showPosterWhenBufferingAndPaused:S,inFrame:b,outFrame:E,initiallyShowControls:C,renderFullscreen:j,renderPlayPauseButton:I,renderMuteButton:P,renderVolumeSlider:L,renderCustomControls:W,alwaysShowControls:$,showPlaybackRateControl:A,posterFillMode:U,bufferStateDelayInMilliseconds:z,hideControlsWhenPointerDoesntMove:O,overflowVisible:R,browserMediaControlsBehavior:Z,overrideInternalClassName:B,noSuspense:ie},ue)=>{const me=ke.useUnsafeVideoConfig(),re=ke.useVideo(),ee=d.useRef(null),K=em(ee,{triggerOnWindowResize:!1,shouldApplyCssTransforms:!1}),[ce,q]=d.useState(!1),[X,N]=d.useState(r),[G,T]=d.useState(()=>!1),[M,Q]=d.useState(!1),ne=d.useMemo(()=>typeof document>"u"?!1:!!(document.fullscreenEnabled||document.webkitFullscreenEnabled),[]),V=_c(),se=V.toggle,{playerMuted:_,mediaVolume:Y}=d.useContext(ke.MediaVolumeContext);d.useEffect(()=>{V.emitter.dispatchVolumeChange(Y)},[V.emitter,Y]);const fe=_||Y===0;d.useEffect(()=>{V.emitter.dispatchMuteChange({isMuted:fe})},[V.emitter,fe]),EF({loop:n,playbackRate:p,moveToBeginningWhenEnded:x,inFrame:b,outFrame:E,getCurrentFrame:V.getCurrentFrame,browserMediaControlsBehavior:Z,muted:fe}),d.useEffect(()=>{ce&&!V.playing&&(q(!1),V.play())},[ce,V]),d.useEffect(()=>{const{current:F}=ee;if(!F)return;const H=()=>{const le=document.fullscreenElement===F||document.webkitFullscreenElement===F;T(le)};return document.addEventListener("fullscreenchange",H),document.addEventListener("webkitfullscreenchange",H),()=>{document.removeEventListener("fullscreenchange",H),document.removeEventListener("webkitfullscreenchange",H)}},[]);const we=d.useCallback(F=>{se(F)},[se]),Ee=d.useCallback(()=>{if(!o)throw new Error("allowFullscreen is false");if(!ne)throw new Error("Browser doesnt support fullscreen");if(!ee.current)throw new Error("No player ref found");ee.current.webkitRequestFullScreen?ee.current.webkitRequestFullScreen():ee.current.requestFullscreen()},[o,ne]),Te=d.useCallback(()=>{document.webkitExitFullscreen?document.webkitExitFullscreen():document.exitFullscreen()},[]);d.useEffect(()=>{const{current:F}=ee;if(!F)return;const H=()=>{const le=document.webkitFullscreenElement??document.fullscreenElement;le&&le===ee.current?V.emitter.dispatchFullscreenChange({isFullscreen:!0}):V.emitter.dispatchFullscreenChange({isFullscreen:!1})};return F.addEventListener("webkitfullscreenchange",H),F.addEventListener("fullscreenchange",H),()=>{F.removeEventListener("webkitfullscreenchange",H),F.removeEventListener("fullscreenchange",H)}},[V.emitter]);const ze=(me==null?void 0:me.durationInFrames)??1,be=d.useMemo(()=>!me||!K?null:Xb({canvasSize:K,compositionHeight:me.height,compositionWidth:me.width,previewSize:"auto"}),[K,me]),de=(be==null?void 0:be.scale)??1,he=d.useRef(!1);d.useEffect(()=>{if(!he.current){he.current=!0;return}V.emitter.dispatchScaleChange(de)},[V.emitter,de]);const{setMediaVolume:Ae,setPlayerMuted:Fe}=d.useContext(ke.SetMediaVolumeContext),[Je,gt]=d.useState(!1);d.useEffect(()=>{let F=null,H=!1;const le=()=>{H=!1,requestAnimationFrame(()=>{z===0?gt(!0):F=setTimeout(()=>{H||gt(!0)},z)})},ye=()=>{requestAnimationFrame(()=>{H=!0,gt(!1),F&&clearTimeout(F)})};return V.emitter.addEventListener("waiting",le),V.emitter.addEventListener("resume",ye),()=>{V.emitter.removeEventListener("waiting",le),V.emitter.removeEventListener("resume",ye),gt(!1),F&&clearTimeout(F),H=!0}},[z,V.emitter]),d.useImperativeHandle(ue,()=>{const F={play:V.play,pause:()=>{q(!1),V.pause()},toggle:we,getContainerNode:()=>ee.current,getCurrentFrame:V.getCurrentFrame,isPlaying:V.isPlaying,seekTo:H=>{const le=ze-1,ye=Math.max(0,Math.min(le,H));V.isPlaying()&&(q(ye!==le||n),V.pause()),ye===le&&!n&&V.emitter.dispatchEnded(),V.seek(ye)},isFullscreen:()=>{const{current:H}=ee;return H?document.fullscreenElement===H||document.webkitFullscreenElement===H:!1},requestFullscreen:Ee,exitFullscreen:Te,getVolume:()=>_?0:Y,setVolume:H=>{if(typeof H!="number")throw new TypeError(`setVolume() takes a number, got value of type ${typeof H}`);if(isNaN(H))throw new TypeError("setVolume() got a number that is NaN. Volume must be between 0 and 1.");if(H<0||H>1)throw new TypeError(`setVolume() got a number that is out of range. Must be between 0 and 1, got ${H}`);Ae(H)},isMuted:()=>fe,mute:()=>{Fe(!0)},unmute:()=>{Fe(!1)},getScale:()=>de,pauseAndReturnToPlayStart:()=>{V.pauseAndReturnToPlayStart()}};return Object.assign(V.emitter,F)},[ze,Te,n,_,fe,Y,V,Ee,Fe,Ae,we,de]);const Ne=re?re.component:null,Le=d.useMemo(()=>qb({canvasSize:K,config:me,style:t,overflowVisible:R,layout:be}),[K,me,be,R,t]),Jt=d.useMemo(()=>Qb({config:me,layout:be,scale:de,overflowVisible:R}),[me,be,R,de]),Vt=d.useMemo(()=>Jb({config:me,layout:be,scale:de,overflowVisible:R}),[me,be,R,de]),St=V.pause,Qt=V.emitter.dispatchError,en=d.useCallback(F=>{St(),Qt(F)},[Qt,St]),Mn=d.useCallback(F=>{F.stopPropagation(),Ee()},[Ee]),sr=d.useCallback(F=>{F.stopPropagation(),Te()},[Te]),ar=d.useCallback(F=>{(F instanceof MouseEvent?F.button===2:F.nativeEvent.button)||we(F)},[we]),_n=d.useCallback(()=>{Q(!0)},[]),Kn=d.useCallback(()=>{Q(!1)},[]),Ke=d.useCallback(()=>{G?Te():Ee()},[Te,G,Ee]),{handlePointerDown:fn,handleDoubleClick:Sn}=dP(ar,Ke,l&&o&&ne);d.useEffect(()=>{X&&(V.play(),N(!1))},[X,V]);const Yn=d.useMemo(()=>h?h({height:Le.height,width:Le.width,isBuffering:Je}):null,[Le.height,Le.width,h,Je]),tn=d.useMemo(()=>({type:"scale",scale:de}),[de]);if(!me)return null;const Ge=g?g({height:U==="player-size"?Le.height:me.height,width:U==="player-size"?Le.width:me.width,isBuffering:Je}):null;if(Ge===void 0)throw new TypeError("renderPoster() must return a React element, but undefined was returned");const lr=Ge&&[v&&!V.isPlaying()&&!M,m&&V.isLastFrame&&!V.isPlaying(),k&&!V.hasPlayed&&!V.isPlaying(),y&&Je&&V.isPlaying(),S&&Je&&!V.isPlaying()].some(Boolean),{left:us,top:ur,width:Co,height:Io,...cs}=Jt,Br=u.jsxs(u.Fragment,{children:[u.jsxs("div",{style:Jt,onPointerDown:s?fn:void 0,onDoubleClick:l?Sn:void 0,children:[u.jsxs("div",{style:Vt,className:tm(B),children:[Ne?u.jsx(rS,{onError:en,errorFallback:f,children:u.jsx(ke.CurrentScaleContext.Provider,{value:tn,children:u.jsx(Ne,{...(re==null?void 0:re.props)??{},...i??{}})})}):null,lr&&U==="composition-size"?u.jsx("div",{style:{...cs,width:me.width,height:me.height},onPointerDown:s?fn:void 0,onDoubleClick:l?Sn:void 0,children:Ge}):null]}),u.jsx(TF,{})]}),lr&&U==="player-size"?u.jsx("div",{style:Jt,onPointerDown:s?fn:void 0,onDoubleClick:l?Sn:void 0,children:Ge}):null,e?u.jsx(aP,{fps:me.fps,playing:V.playing,toggle:V.toggle,durationInFrames:me.durationInFrames,containerRef:ee,onFullscreenButtonClick:Mn,isFullscreen:G,allowFullscreen:o,showVolumeControls:a,onExitFullscreenButtonClick:sr,spaceKeyToPlayOrPause:c,onSeekEnd:Kn,onSeekStart:_n,inFrame:b,outFrame:E,initiallyShowControls:C,canvasSize:K,renderFullscreenButton:j,renderPlayPauseButton:I,alwaysShowControls:$,showPlaybackRateControl:A,buffering:Je,hideControlsWhenPointerDoesntMove:O,onDoubleClick:l?Sn:void 0,onPointerDown:s?fn:void 0,renderMuteButton:P,renderVolumeSlider:L,renderCustomControls:W}):null]});return ie||oS&&!fP?u.jsx("div",{ref:ee,style:Le,className:w,children:Br}):u.jsx("div",{ref:ee,style:Le,className:w,children:u.jsx(d.Suspense,{fallback:Yn,children:Br})})},hP=d.forwardRef(pP),iS="remotion.volumePreference",mP=(e,t,n)=>{if(!(typeof window>"u"))try{window.localStorage.setItem(n??iS,String(e))}catch(r){ke.Log.error({logLevel:t,tag:null},"Could not persist volume",r)}},gP=e=>{if(typeof window>"u")return 1;try{const t=window.localStorage.getItem(e??iS);return t?Number(t):1}catch{return 1}},nm="player-comp",sS=({children:e,timelineContext:t,playbackRateContext:n,fps:r,compositionHeight:o,compositionWidth:i,durationInFrames:s,component:a,numberOfSharedAudioTags:l,initiallyMuted:c,logLevel:f,audioLatencyHint:p,sampleRate:h,volumePersistenceKey:g,initialVolume:w,inputProps:x,audioEnabled:k})=>{const m=w===void 0,v=d.useMemo(()=>({compositions:[{component:a,durationInFrames:s,height:o,width:i,fps:r,id:nm,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]),[y,S]=d.useState(()=>c),[b,E]=d.useState(()=>m?gP(g??null):w),C=d.useMemo(()=>({playerMuted:y,mediaVolume:b}),[y,b]),j=d.useRef(!1),I=j.current||k&&!y&&b>0;j.current=I;const P=d.useCallback(A=>{E(A),m&&mP(A,f,g??null)},[m,f,g]),L=d.useMemo(()=>({setPlayerMuted:S,setMediaVolume:P}),[P]),W=d.useMemo(()=>({logLevel:f,mountTime:Date.now()}),[f]),$=d.useMemo(()=>({isPlayer:!0,isRendering:!1,isStudio:!1,isClientSideRendering:!1,isReadOnlyStudio:!1}),[]);return u.jsx(ke.RemotionEnvironmentContext.Provider,{value:$,children:u.jsx(ke.LogLevelContext.Provider,{value:W,children:u.jsx(ke.CanUseRemotionHooksProvider,{children:u.jsx(ke.AbsoluteTimeContext.Provider,{value:t,children:u.jsx(ke.PlaybackRateContext.Provider,{value:n,children:u.jsx(ke.TimelineContext.Provider,{value:t,children:u.jsx(ke.CompositionManager.Provider,{value:v,children:u.jsx(ke.PrefetchProvider,{children:u.jsx(ke.DurationsContextProvider,{children:u.jsx(ke.MediaVolumeContext.Provider,{value:C,children:u.jsx(ke.SetMediaVolumeContext.Provider,{value:L,children:u.jsx(ke.BufferingProvider,{children:u.jsx(ke.SharedAudioContextProvider,{audioLatencyHint:p,audioEnabled:I,previewSampleRate:h,children:u.jsx(ke.SharedAudioTagsContextProvider,{numberOfAudioTags:l,children:e})})})})})})})})})})})})})})},Ly=!1,yP=(e,t)=>{e||Ly||(Ly=!0,ke.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."))},Oy=(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},vP=({inFrame:e,durationInFrames:t,outFrame:n})=>{const r=Oy(e,"inFrame"),o=Oy(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)}},wP=({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)}`)}},xP=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.")}},bP=Mc.validateFps,Dy=Mc.validateDimension,SP=Mc.validateDurationInFrames,kP=Mc.validateDefaultAndInputProps,EP=e=>"component"in e?e.component:null,CP=({durationInFrames:e,compositionHeight:t,compositionWidth:n,fps:r,inputProps:o,style:i,controls:s=!1,loop:a=!1,autoPlay:l=!1,showVolumeControls:c=!0,allowFullscreen:f=!0,clickToPlay:p,doubleClickToFullscreen:h=!1,spaceKeyToPlayOrPause:g=!0,moveToBeginningWhenEnded:w=!0,numberOfSharedAudioTags:x=5,errorFallback:k=()=>"⚠️",playbackRate:m=1,renderLoading:v,className:y,showPosterWhenUnplayed:S,showPosterWhenEnded:b,showPosterWhenPaused:E,showPosterWhenBuffering:C,showPosterWhenBufferingAndPaused:j,initialFrame:I,renderPoster:P,inFrame:L,outFrame:W,initiallyShowControls:$,renderFullscreenButton:A,renderPlayPauseButton:U,renderVolumeSlider:z,renderCustomControls:O,alwaysShowControls:R=!1,initiallyMuted:Z=!1,showPlaybackRateControl:B=!1,posterFillMode:ie="player-size",bufferStateDelayInMilliseconds:ue,hideControlsWhenPointerDoesntMove:me=!0,overflowVisible:re=!1,renderMuteButton:ee,browserMediaControlsBehavior:K,overrideInternalClassName:ce,logLevel:q="info",noSuspense:X,acknowledgeRemotionLicense:N,audioLatencyHint:G="playback",sampleRate:T=48e3,volumePersistenceKey:M,initialVolume:Q,...ne},V)=>{if(typeof window<"u"&&(window.remotion_isPlayer=!0),ne.defaultProps!==void 0)throw new Error("The <Player /> component does not accept `defaultProps`, but some were passed. Use `inputProps` instead.");const se=EP(ne);if((se==null?void 0:se.type)===Mu)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(se===Mu)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(()=>yP(!!N,q));const _=ke.useLazyComponent({compProps:ne,componentName:"Player",noSuspense:!!X});wP({initialFrame:I,durationInFrames:e});const[Y,fe]=d.useState(()=>({[nm]:I??0})),[we,Ee]=d.useState(!1),[Te]=d.useState("player-comp"),ze=d.useRef(null),be=d.useRef([]),de=d.useRef(!1),[he,Ae]=d.useState(m);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(Dy(t,"compositionHeight","of the <Player /> component"),Dy(n,"compositionWidth","of the <Player /> component"),SP(e,{component:"of the <Player/> component",allowFloats:!1}),bP(r,"as a prop of the <Player/> component",!1),kP(o,"inputProps",null),vP({durationInFrames:e,inFrame:L,outFrame:W}),typeof s!="boolean"&&typeof s<"u")throw new TypeError(`'controls' must be a boolean or undefined but got '${typeof s}' instead`);if(typeof l!="boolean"&&typeof l<"u")throw new TypeError(`'autoPlay' must be a boolean or undefined but got '${typeof l}' instead`);if(typeof a!="boolean"&&typeof a<"u")throw new TypeError(`'loop' must be a boolean or undefined but got '${typeof a}' instead`);if(typeof h!="boolean"&&typeof h<"u")throw new TypeError(`'doubleClickToFullscreen' must be a boolean or undefined but got '${typeof h}' instead`);if(typeof c!="boolean"&&typeof c<"u")throw new TypeError(`'showVolumeControls' must be a boolean or undefined but got '${typeof c}' instead`);if(typeof f!="boolean"&&typeof f<"u")throw new TypeError(`'allowFullscreen' must be a boolean or undefined but got '${typeof f}' instead`);if(typeof p!="boolean"&&typeof p<"u")throw new TypeError(`'clickToPlay' must be a boolean or undefined but got '${typeof p}' instead`);if(typeof g!="boolean"&&typeof g<"u")throw new TypeError(`'spaceKeyToPlayOrPause' must be a boolean or undefined but got '${typeof g}' instead`);if(typeof T!="number"||!Number.isFinite(T)||Number.isNaN(T)||T<=0||T%1!==0)throw new TypeError(`'sampleRate' must be a positive integer but got '${T}' instead`);if(typeof Q<"u"&&typeof Q!="number")throw new TypeError(`'initialVolume' must be a number or undefined but got '${typeof Q}' instead`);if(typeof Q=="number"&&(!Number.isFinite(Q)||Number.isNaN(Q)||Q<0||Q>1))throw new TypeError(`'initialVolume' must be between 0 and 1 but got '${Q}' 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`);xP(he),d.useEffect(()=>{Ae(m)},[m]),d.useImperativeHandle(V,()=>ze.current,[]),d.useState(()=>{ke.playbackLogging({logLevel:q,message:`[player] Mounting <Player>. User agent = ${typeof navigator>"u"?"server":navigator.userAgent}`,tag:"player",mountTime:Date.now()})});const Fe=d.useMemo(()=>({frame:Y,playing:we,rootId:Te,imperativePlaying:de,audioAndVideoTags:be}),[Y,we,Te]),Je=d.useMemo(()=>({playbackRate:he,setPlaybackRate:Ae}),[he]),gt=d.useMemo(()=>({setFrame:fe,setPlaying:Ee}),[fe]);typeof window<"u"&&d.useLayoutEffect(()=>{ke.CSSUtils.injectCSS(ke.CSSUtils.makeDefaultPreviewCSS(`.${tm(ce)}`,"#fff"))},[ce]);const Ne=d.useMemo(()=>o??{},[o]),Le=d.useMemo(()=>K??{mode:"prevent-media-session"},[K]);return u.jsx(ke.IsPlayerContextProvider,{children:u.jsx(sS,{timelineContext:Fe,playbackRateContext:Je,component:_,compositionHeight:t,compositionWidth:n,durationInFrames:e,fps:r,numberOfSharedAudioTags:x,initiallyMuted:Z,logLevel:q,audioLatencyHint:G,sampleRate:T,volumePersistenceKey:M,initialVolume:Q,inputProps:Ne,audioEnabled:!0,children:u.jsx(ke.SetTimelineContext.Provider,{value:gt,children:u.jsx(vF,{currentPlaybackRate:he,children:u.jsx(hP,{ref:ze,posterFillMode:ie,renderLoading:v,autoPlay:!!l,loop:!!a,controls:!!s,errorFallback:k,style:i,inputProps:Ne,allowFullscreen:!!f,moveToBeginningWhenEnded:!!w,clickToPlay:typeof p=="boolean"?p:!!s,showVolumeControls:!!c,doubleClickToFullscreen:!!h,spaceKeyToPlayOrPause:!!g,playbackRate:he,className:y??void 0,showPosterWhenUnplayed:!!S,showPosterWhenEnded:!!b,showPosterWhenPaused:!!E,showPosterWhenBuffering:!!C,showPosterWhenBufferingAndPaused:!!j,renderPoster:P,inFrame:L??null,outFrame:W??null,initiallyShowControls:$??!0,renderFullscreen:A??null,renderPlayPauseButton:U??null,renderMuteButton:ee??null,renderVolumeSlider:z??null,renderCustomControls:O??null,alwaysShowControls:R,showPlaybackRateControl:B,bufferStateDelayInMilliseconds:ue??300,hideControlsWhenPointerDoesntMove:me,overflowVisible:re,browserMediaControlsBehavior:Le,overrideInternalClassName:ce??void 0,noSuspense:!!X})})})})})},IP=d.forwardRef,jP=IP(CP),TP=()=>{const e=d.useContext(tS);if(!e)throw new TypeError("Expected Player event emitter context");return d.useMemo(()=>({emitter:e}),[e])},Ep=ge.version.split(".")[0];if(Ep==="0")throw new Error(`Version ${Ep} of "react" is not supported by Remotion`);var RP=parseInt(Ep,10)>=18,FP=({style:e,inputProps:t,errorFallback:n,renderLoading:r,className:o,overflowVisible:i,noSuspense:s,overrideInternalClassName:a},l)=>{const c=ke.useUnsafeVideoConfig(),f=ke.useVideo(),p=d.useRef(null),h=em(p,{triggerOnWindowResize:!1,shouldApplyCssTransforms:!1}),g=d.useMemo(()=>!c||!h?null:Xb({canvasSize:h,compositionHeight:c.height,compositionWidth:c.width,previewSize:"auto"}),[h,c]),w=(g==null?void 0:g.scale)??1,x=TP();nS(x.emitter),d.useImperativeHandle(l,()=>{const j={getContainerNode:()=>p.current,getScale:()=>w};return Object.assign(x.emitter,j)},[w,x.emitter]);const k=f?f.component:null,m=d.useMemo(()=>qb({config:c,style:e,canvasSize:h,overflowVisible:i,layout:g}),[h,c,g,i,e]),v=d.useMemo(()=>Qb({config:c,layout:g,scale:w,overflowVisible:i}),[c,g,i,w]),y=d.useMemo(()=>Jb({config:c,layout:g,scale:w,overflowVisible:i}),[c,g,i,w]),S=d.useCallback(j=>{x.emitter.dispatchError(j)},[x.emitter]),b=d.useMemo(()=>r?r({height:m.height,width:m.width,isBuffering:!1}):null,[m.height,m.width,r]),E=d.useMemo(()=>({type:"scale",scale:w}),[w]);if(!c)return null;const C=u.jsx("div",{style:v,children:u.jsx("div",{style:y,className:tm(a),children:k?u.jsx(rS,{onError:S,errorFallback:n,children:u.jsx(ke.CurrentScaleContext.Provider,{value:E,children:u.jsx(k,{...(f==null?void 0:f.props)??{},...t??{}})})}):null})});return s||oS&&!RP?u.jsx("div",{ref:p,style:m,className:o,children:C}):u.jsx("div",{ref:p,style:m,className:o,children:u.jsx(d.Suspense,{fallback:b,children:C})})},PP=d.forwardRef(FP),$P=({frameToDisplay:e,style:t,inputProps:n,compositionHeight:r,compositionWidth:o,durationInFrames:i,fps:s,className:a,errorFallback:l=()=>"⚠️",renderLoading:c,overflowVisible:f=!1,overrideInternalClassName:p,logLevel:h="info",noSuspense:g,...w},x)=>{typeof window<"u"&&d.useLayoutEffect(()=>{window.remotion_isPlayer=!0},[]);const[k]=d.useState(()=>String(qo(null))),m=d.useRef(null),v=d.useMemo(()=>({playing:!1,frame:{[nm]:e},rootId:k,imperativePlaying:{current:!1},audioAndVideoTags:{current:[]}}),[e,k]),y=d.useMemo(()=>({playbackRate:1,setPlaybackRate:()=>{throw new Error("thumbnail")}}),[]);d.useImperativeHandle(x,()=>m.current,[]);const S=ke.useLazyComponent({compProps:w,componentName:"Thumbnail",noSuspense:!!g}),[b]=d.useState(()=>new yF),E=d.useMemo(()=>n??{},[n]);return u.jsx(ke.IsPlayerContextProvider,{children:u.jsx(sS,{timelineContext:v,playbackRateContext:y,component:S,compositionHeight:r,compositionWidth:o,durationInFrames:i,fps:s,numberOfSharedAudioTags:0,initiallyMuted:!0,logLevel:h,audioLatencyHint:"playback",sampleRate:48e3,inputProps:E,audioEnabled:!1,children:u.jsx(tS.Provider,{value:b,children:u.jsx(PP,{ref:m,className:a,errorFallback:l,inputProps:E,renderLoading:c,style:t,overflowVisible:f,overrideInternalClassName:p,noSuspense:!!g})})})})},MP=d.forwardRef;MP($P);const Oi=[1,1.5,2,4];function zy(e){return Oi.find(t=>t>e+1e-9)??Oi[Oi.length-1]}function _P(e,t){switch(t){case"L":return e.playing&&e.rate>0?{rate:zy(e.rate),playing:!0}:{rate:Oi[0],playing:!0};case"J":return e.playing&&e.rate<0?{rate:-zy(-e.rate),playing:!0}:{rate:-Oi[0],playing:!0};case"K":return{rate:Oi[0],playing:!e.playing}}}function Ac(e,t,n){const r=Math.round(e*n),o=Math.round(t*n);return{from:r,durationInFrames:Math.max(1,o-r)}}function AP(e,t){return e.filter(n=>Math.round(n.srcOut*t)>Math.round(n.srcIn*t))}function NP(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 LP(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}function OP(e,t){let n=1;for(const r of e)t>=r.startSec&&t<r.endSec&&(n=r.gain);return n}const DP=({src:e,spans:t,punchInScale:n=1.07,punch:r=null,punchThresholdSec:o=.15,audioFadeSec:i=.01,background:s="black",gain:a=[]})=>{const{fps:l}=ht(),c=d.useMemo(()=>AP(t,l),[t,l]),f=d.useMemo(()=>LP(c,r,n,o),[c,r,n,o]),p=Math.max(1,Math.round(i*l));return u.jsx(Fn,{style:{backgroundColor:s},children:c.map((h,g)=>{const{from:w,durationInFrames:x}=Ac(h.outIn,h.outOut,l);return u.jsx(Ft,{from:w,durationInFrames:x,premountFor:l*3,children:u.jsx(Fn,{style:{transform:`scale(${f[g]})`},children:u.jsx(Kb,{src:e,trimBefore:Math.round(h.srcIn*l),trimAfter:Math.round(h.srcOut*l),pauseWhenBuffering:!0,style:{width:"100%",height:"100%",objectFit:"cover",objectPosition:"var(--ossclip-obj-x, 50%) var(--ossclip-obj-y, 50%)"},volume:k=>Math.max(0,Math.min(1,(k+1)/p,(x-k)/p))*OP(a,(w+k)/l),allowAmplificationDuringRender:!0,useWebAudioApi:a.some(k=>k.gain>1)})})},g)})})};function te(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 Sa extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const aS={};function go(e){return aS}function lS(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 zP(e,t){return typeof t=="bigint"?t.toString():t}function uS(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function rm(e){return e==null}function om(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function BP(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 rt(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 Nc(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function _s(e){return JSON.stringify(e)}const cS=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Cp(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const WP=uS(()=>{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 Du(e){if(Cp(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(Cp(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}const VP=new Set(["string","number","symbol"]);function Ha(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ti(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 HP(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const UP={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 ZP(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 ti(e,{...e._zod.def,shape:n,checks:[]})}function KP(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 ti(e,{...e._zod.def,shape:n,checks:[]})}function YP(e,t){if(!Du(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 Nc(this,"shape",r),r},checks:[]};return ti(e,n)}function GP(e,t){return ti(e,{...e._zod.def,get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return Nc(this,"shape",n),n},catchall:t._zod.def.catchall,checks:[]})}function XP(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 ti(t,{...t._zod.def,shape:o,checks:[]})}function qP(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 ti(t,{...t._zod.def,shape:o,checks:[]})}function ea(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 No(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Il(e){return typeof e=="string"?e:e==null?void 0:e.message}function yo(e,t,n){var o,i,s,a,l,c;const r={...e,path:e.path??[]};if(!e.message){const f=Il((s=(i=(o=e.inst)==null?void 0:o._zod.def)==null?void 0:i.error)==null?void 0:s.call(i,e))??Il((a=t==null?void 0:t.error)==null?void 0:a.call(t,e))??Il((l=n.customError)==null?void 0:l.call(n,e))??Il((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 im(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function ka(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const dS=(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,zP,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},fS=te("$ZodError",dS),pS=te("$ZodError",dS,{Parent:Error});function JP(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 QP(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 e$=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 Sa;if(s.issues.length){const a=new((o==null?void 0:o.Err)??e)(s.issues.map(l=>yo(l,i,go())));throw cS(a,o==null?void 0:o.callee),a}return s.value},t$=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=>yo(l,i,go())));throw cS(a,o==null?void 0:o.callee),a}return s.value},hS=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 Sa;return i.issues.length?{success:!1,error:new(e??fS)(i.issues.map(s=>yo(s,o,go())))}:{success:!0,data:i.value}},n$=hS(pS),mS=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=>yo(s,o,go())))}:{success:!0,data:i.value}},r$=mS(pS),o$=/^[cC][^\s-]{8,}$/,i$=/^[0-9a-z]+$/,s$=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,a$=/^[0-9a-vA-V]{20}$/,l$=/^[A-Za-z0-9]{27}$/,u$=/^[a-zA-Z0-9_-]{21}$/,c$=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,d$=/^([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})$/,By=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)$/,f$=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,p$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function h$(){return new RegExp(p$,"u")}const m$=/^(?:(?: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])$/,g$=/^(([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})$/,y$=/^((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])$/,v$=/^(([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])$/,w$=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,gS=/^[A-Za-z0-9_-]*$/,x$=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,b$=/^\+(?:[0-9]){6,14}[0-9]$/,yS="(?:(?:\\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])))",S$=new RegExp(`^${yS}$`);function vS(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 k$(e){return new RegExp(`^${vS(e)}$`)}function E$(e){const t=vS({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(`^${yS}T(?:${r})$`)}const C$=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}$`)},I$=/^\d+$/,j$=/^-?\d+(?:\.\d+)?/i,T$=/true|false/i,R$=/^[^A-Z]*$/,F$=/^[^a-z]*$/,xn=te("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),wS={number:"number",bigint:"bigint",object:"date"},xS=te("$ZodCheckLessThan",(e,t)=>{xn.init(e,t);const n=wS[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})}}),bS=te("$ZodCheckGreaterThan",(e,t)=>{xn.init(e,t);const n=wS[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})}}),P$=te("$ZodCheckMultipleOf",(e,t)=>{xn.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):BP(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})}}),$$=te("$ZodCheckNumberFormat",(e,t)=>{var s;xn.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]=UP[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=I$)}),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})}}),M$=te("$ZodCheckMaxLength",(e,t)=>{var n;xn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!rm(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=im(o);r.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),_$=te("$ZodCheckMinLength",(e,t)=>{var n;xn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!rm(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=im(o);r.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),A$=te("$ZodCheckLengthEquals",(e,t)=>{var n;xn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!rm(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=im(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})}}),Lc=te("$ZodCheckStringFormat",(e,t)=>{var n,r;xn.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=()=>{})}),N$=te("$ZodCheckRegex",(e,t)=>{Lc.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})}}),L$=te("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=R$),Lc.init(e,t)}),O$=te("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=F$),Lc.init(e,t)}),D$=te("$ZodCheckIncludes",(e,t)=>{xn.init(e,t);const n=Ha(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})}}),z$=te("$ZodCheckStartsWith",(e,t)=>{xn.init(e,t);const n=new RegExp(`^${Ha(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})}}),B$=te("$ZodCheckEndsWith",(e,t)=>{xn.init(e,t);const n=new RegExp(`.*${Ha(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})}}),W$=te("$ZodCheckOverwrite",(e,t)=>{xn.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class V${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 H$={major:4,minor:0,patch:0},ot=te("$ZodType",(e,t)=>{var o;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=H$;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=ea(s),f;for(const p of a){if(p._zod.def.when){if(!p._zod.def.when(s))continue}else if(c)continue;const h=s.issues.length,g=p._zod.check(s);if(g instanceof Promise&&(l==null?void 0:l.async)===!1)throw new Sa;if(f||g instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await g,s.issues.length!==h&&(c||(c=ea(s,h)))});else{if(s.issues.length===h)continue;c||(c=ea(s,h))}}return f?f.then(()=>s):s};e._zod.run=(s,a)=>{const l=e._zod.parse(s,a);if(l instanceof Promise){if(a.async===!1)throw new Sa;return l.then(c=>i(c,r,a))}return i(l,r,a)}}e["~standard"]={validate:i=>{var s;try{const a=n$(e,i);return a.success?{value:a.data}:{issues:(s=a.error)==null?void 0:s.issues}}catch{return r$(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}}),sm=te("$ZodString",(e,t)=>{var n;ot.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??C$(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}}),it=te("$ZodStringFormat",(e,t)=>{Lc.init(e,t),sm.init(e,t)}),U$=te("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=d$),it.init(e,t)}),Z$=te("$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=By(r))}else t.pattern??(t.pattern=By());it.init(e,t)}),K$=te("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=f$),it.init(e,t)}),Y$=te("$ZodURL",(e,t)=>{it.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:x$.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})}}}),G$=te("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=h$()),it.init(e,t)}),X$=te("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=u$),it.init(e,t)}),q$=te("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=o$),it.init(e,t)}),J$=te("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=i$),it.init(e,t)}),Q$=te("$ZodULID",(e,t)=>{t.pattern??(t.pattern=s$),it.init(e,t)}),eM=te("$ZodXID",(e,t)=>{t.pattern??(t.pattern=a$),it.init(e,t)}),tM=te("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=l$),it.init(e,t)}),nM=te("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=E$(t)),it.init(e,t)}),rM=te("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=S$),it.init(e,t)}),oM=te("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=k$(t)),it.init(e,t)}),iM=te("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=c$),it.init(e,t)}),sM=te("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=m$),it.init(e,t),e._zod.onattach.push(n=>{const r=n._zod.bag;r.format="ipv4"})}),aM=te("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=g$),it.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})}}}),lM=te("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=y$),it.init(e,t)}),uM=te("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=v$),it.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 SS(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const cM=te("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=w$),it.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64"}),e._zod.check=n=>{SS(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function dM(e){if(!gS.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return SS(n)}const fM=te("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=gS),it.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64url"}),e._zod.check=n=>{dM(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),pM=te("$ZodE164",(e,t)=>{t.pattern??(t.pattern=b$),it.init(e,t)});function hM(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 mM=te("$ZodJWT",(e,t)=>{it.init(e,t),e._zod.check=n=>{hM(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),kS=te("$ZodNumber",(e,t)=>{ot.init(e,t),e._zod.pattern=e._zod.bag.pattern??j$,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}}),gM=te("$ZodNumber",(e,t)=>{$$.init(e,t),kS.init(e,t)}),yM=te("$ZodBoolean",(e,t)=>{ot.init(e,t),e._zod.pattern=T$,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}}),vM=te("$ZodUnknown",(e,t)=>{ot.init(e,t),e._zod.parse=n=>n}),wM=te("$ZodNever",(e,t)=>{ot.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Wy(e,t,n){e.issues.length&&t.issues.push(...No(n,e.issues)),t.value[n]=e.value}const xM=te("$ZodArray",(e,t)=>{ot.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=>Wy(c,n,s))):Wy(l,n,s)}return i.length?Promise.all(i).then(()=>n):n}});function jl(e,t,n){e.issues.length&&t.issues.push(...No(n,e.issues)),t.value[n]=e.value}function Vy(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(...No(n,e.issues)):e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}const bM=te("$ZodObject",(e,t)=>{ot.init(e,t);const n=uS(()=>{const p=Object.keys(t.shape);for(const g of p)if(!(t.shape[g]instanceof ot))throw new Error(`Invalid element at key "${g}": expected a Zod schema`);const h=HP(t.shape);return{shape:t.shape,keys:p,keySet:new Set(p),numKeys:p.length,optionalKeys:new Set(h)}});rt(e._zod,"propValues",()=>{const p=t.shape,h={};for(const g in p){const w=p[g]._zod;if(w.values){h[g]??(h[g]=new Set);for(const x of w.values)h[g].add(x)}}return h});const r=p=>{const h=new V$(["shape","payload","ctx"]),g=n.value,w=v=>{const y=_s(v);return`shape[${y}]._zod.run({ value: input[${y}], issues: [] }, ctx)`};h.write("const input = payload.value;");const x=Object.create(null);let k=0;for(const v of g.keys)x[v]=`key_${k++}`;h.write("const newResult = {}");for(const v of g.keys)if(g.optionalKeys.has(v)){const y=x[v];h.write(`const ${y} = ${w(v)};`);const S=_s(v);h.write(`
137
+ if (${y}.issues.length) {
138
+ if (input[${S}] === undefined) {
139
+ if (${S} in input) {
140
+ newResult[${S}] = undefined;
141
+ }
142
+ } else {
143
+ payload.issues = payload.issues.concat(
144
+ ${y}.issues.map((iss) => ({
145
+ ...iss,
146
+ path: iss.path ? [${S}, ...iss.path] : [${S}],
147
+ }))
148
+ );
149
+ }
150
+ } else if (${y}.value === undefined) {
151
+ if (${S} in input) newResult[${S}] = undefined;
152
+ } else {
153
+ newResult[${S}] = ${y}.value;
154
+ }
155
+ `)}else{const y=x[v];h.write(`const ${y} = ${w(v)};`),h.write(`
156
+ if (${y}.issues.length) payload.issues = payload.issues.concat(${y}.issues.map(iss => ({
157
+ ...iss,
158
+ path: iss.path ? [${_s(v)}, ...iss.path] : [${_s(v)}]
159
+ })));`),h.write(`newResult[${_s(v)}] = ${y}.value`)}h.write("payload.value = newResult;"),h.write("return payload;");const m=h.compile();return(v,y)=>m(p,v,y)};let o;const i=Cp,s=!aS.jitless,l=s&&WP.value,c=t.catchall;let f;e._zod.parse=(p,h)=>{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&&(h==null?void 0:h.async)===!1&&h.jitless!==!0)o||(o=r(t.shape)),p=o(p,h);else{p.value={};const y=f.shape;for(const S of f.keys){const b=y[S],E=b._zod.run({value:g[S],issues:[]},h),C=b._zod.optin==="optional"&&b._zod.optout==="optional";E instanceof Promise?w.push(E.then(j=>C?Vy(j,p,S,g):jl(j,p,S))):C?Vy(E,p,S,g):jl(E,p,S)}}if(!c)return w.length?Promise.all(w).then(()=>p):p;const x=[],k=f.keySet,m=c._zod,v=m.def.type;for(const y of Object.keys(g)){if(k.has(y))continue;if(v==="never"){x.push(y);continue}const S=m.run({value:g[y],issues:[]},h);S instanceof Promise?w.push(S.then(b=>jl(b,p,y))):jl(S,p,y)}return x.length&&p.issues.push({code:"unrecognized_keys",keys:x,input:g,inst:e}),w.length?Promise.all(w).then(()=>p):p}});function Hy(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=>yo(i,r,go())))}),t}const SM=te("$ZodUnion",(e,t)=>{ot.init(e,t),rt(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),rt(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),rt(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),rt(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=>om(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=>Hy(s,n,e,r)):Hy(i,n,e,r)}}),kM=te("$ZodIntersection",(e,t)=>{ot.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])=>Uy(n,l,c)):Uy(n,i,s)}});function Ip(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(Du(e)&&Du(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=Ip(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=Ip(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 Uy(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),ea(e))return e;const r=Ip(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 EM=te("$ZodRecord",(e,t)=>{ot.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Du(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(...No(l,f.issues)),n.value[l]=f.value})):(c.issues.length&&n.issues.push(...No(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=>yo(c,r,go())),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(...No(s,c.issues)),n.value[a.value]=c.value})):(l.issues.length&&n.issues.push(...No(s,l.issues)),n.value[a.value]=l.value)}}return i.length?Promise.all(i).then(()=>n):n}}),CM=te("$ZodEnum",(e,t)=>{ot.init(e,t);const n=lS(t.entries);e._zod.values=new Set(n),e._zod.pattern=new RegExp(`^(${n.filter(r=>VP.has(typeof r)).map(r=>typeof r=="string"?Ha(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}}),IM=te("$ZodLiteral",(e,t)=>{ot.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?Ha(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}}),jM=te("$ZodTransform",(e,t)=>{ot.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 Sa;return n.value=o,n}}),TM=te("$ZodOptional",(e,t)=>{ot.init(e,t),e._zod.optin="optional",e._zod.optout="optional",rt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),rt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${om(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)}),RM=te("$ZodNullable",(e,t)=>{ot.init(e,t),rt(e._zod,"optin",()=>t.innerType._zod.optin),rt(e._zod,"optout",()=>t.innerType._zod.optout),rt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${om(n.source)}|null)$`):void 0}),rt(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)}),FM=te("$ZodDefault",(e,t)=>{ot.init(e,t),e._zod.optin="optional",rt(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=>Zy(i,t)):Zy(o,t)}});function Zy(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const PM=te("$ZodPrefault",(e,t)=>{ot.init(e,t),e._zod.optin="optional",rt(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))}),$M=te("$ZodNonOptional",(e,t)=>{ot.init(e,t),rt(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=>Ky(i,e)):Ky(o,e)}});function Ky(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 MM=te("$ZodCatch",(e,t)=>{ot.init(e,t),e._zod.optin="optional",rt(e._zod,"optout",()=>t.innerType._zod.optout),rt(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=>yo(s,r,go()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(i=>yo(i,r,go()))},input:n.value}),n.issues=[]),n)}}),_M=te("$ZodPipe",(e,t)=>{ot.init(e,t),rt(e._zod,"values",()=>t.in._zod.values),rt(e._zod,"optin",()=>t.in._zod.optin),rt(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=>Yy(i,t,r)):Yy(o,t,r)}});function Yy(e,t,n){return ea(e)?e:t.out._zod.run({value:e.value,issues:e.issues},n)}const AM=te("$ZodReadonly",(e,t)=>{ot.init(e,t),rt(e._zod,"propValues",()=>t.innerType._zod.propValues),rt(e._zod,"values",()=>t.innerType._zod.values),rt(e._zod,"optin",()=>t.innerType._zod.optin),rt(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(Gy):Gy(o)}});function Gy(e){return e.value=Object.freeze(e.value),e}const NM=te("$ZodCustom",(e,t)=>{xn.init(e,t),ot.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=>Xy(i,n,r,e));Xy(o,n,r,e)}});function Xy(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(ka(o))}}class ES{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 LM(){return new ES}const Vs=LM();function OM(e,t){return new e({type:"string",...Ce(t)})}function DM(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Ce(t)})}function qy(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Ce(t)})}function zM(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Ce(t)})}function BM(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ce(t)})}function WM(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ce(t)})}function VM(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ce(t)})}function HM(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Ce(t)})}function UM(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Ce(t)})}function ZM(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ce(t)})}function KM(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Ce(t)})}function YM(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ce(t)})}function GM(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Ce(t)})}function XM(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Ce(t)})}function qM(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ce(t)})}function JM(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ce(t)})}function QM(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ce(t)})}function e_(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ce(t)})}function t_(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ce(t)})}function n_(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Ce(t)})}function r_(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Ce(t)})}function o_(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Ce(t)})}function i_(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Ce(t)})}function s_(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ce(t)})}function a_(e,t){return new e({type:"string",format:"date",check:"string_format",...Ce(t)})}function l_(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Ce(t)})}function u_(e,t){return new e({type:"string",format:"duration",check:"string_format",...Ce(t)})}function c_(e,t){return new e({type:"number",checks:[],...Ce(t)})}function d_(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Ce(t)})}function f_(e,t){return new e({type:"boolean",...Ce(t)})}function p_(e){return new e({type:"unknown"})}function h_(e,t){return new e({type:"never",...Ce(t)})}function Jy(e,t){return new xS({check:"less_than",...Ce(t),value:e,inclusive:!1})}function Vd(e,t){return new xS({check:"less_than",...Ce(t),value:e,inclusive:!0})}function Qy(e,t){return new bS({check:"greater_than",...Ce(t),value:e,inclusive:!1})}function Hd(e,t){return new bS({check:"greater_than",...Ce(t),value:e,inclusive:!0})}function ev(e,t){return new P$({check:"multiple_of",...Ce(t),value:e})}function CS(e,t){return new M$({check:"max_length",...Ce(t),maximum:e})}function zu(e,t){return new _$({check:"min_length",...Ce(t),minimum:e})}function IS(e,t){return new A$({check:"length_equals",...Ce(t),length:e})}function m_(e,t){return new N$({check:"string_format",format:"regex",...Ce(t),pattern:e})}function g_(e){return new L$({check:"string_format",format:"lowercase",...Ce(e)})}function y_(e){return new O$({check:"string_format",format:"uppercase",...Ce(e)})}function v_(e,t){return new D$({check:"string_format",format:"includes",...Ce(t),includes:e})}function w_(e,t){return new z$({check:"string_format",format:"starts_with",...Ce(t),prefix:e})}function x_(e,t){return new B$({check:"string_format",format:"ends_with",...Ce(t),suffix:e})}function Ua(e){return new W$({check:"overwrite",tx:e})}function b_(e){return Ua(t=>t.normalize(e))}function S_(){return Ua(e=>e.trim())}function k_(){return Ua(e=>e.toLowerCase())}function E_(){return Ua(e=>e.toUpperCase())}function C_(e,t,n){return new e({type:"array",element:t,...Ce(n)})}function I_(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Ce(n)})}class tv{constructor(t){this.counter=0,this.metadataRegistry=(t==null?void 0:t.metadata)??Vs,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,h,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=(h=(p=t._zod).toJSONSchema)==null?void 0:h.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 m=k;m.type="string";const{minimum:v,maximum:y,format:S,patterns:b,contentEncoding:E}=t._zod.bag;if(typeof v=="number"&&(m.minLength=v),typeof y=="number"&&(m.maxLength=y),S&&(m.format=i[S]??S,m.format===""&&delete m.format),E&&(m.contentEncoding=E),b&&b.size>0){const C=[...b];C.length===1?m.pattern=C[0].source:C.length>1&&(a.schema.allOf=[...C.map(j=>({...this.target==="draft-7"?{type:"string"}:{},pattern:j.source}))])}break}case"number":{const m=k,{minimum:v,maximum:y,format:S,multipleOf:b,exclusiveMaximum:E,exclusiveMinimum:C}=t._zod.bag;typeof S=="string"&&S.includes("int")?m.type="integer":m.type="number",typeof C=="number"&&(m.exclusiveMinimum=C),typeof v=="number"&&(m.minimum=v,typeof C=="number"&&(C>=v?delete m.minimum:delete m.exclusiveMinimum)),typeof E=="number"&&(m.exclusiveMaximum=E),typeof y=="number"&&(m.maximum=y,typeof E=="number"&&(E<=y?delete m.maximum:delete m.exclusiveMaximum)),typeof b=="number"&&(m.multipleOf=b);break}case"boolean":{const m=k;m.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 m=k,{minimum:v,maximum:y}=t._zod.bag;typeof v=="number"&&(m.minItems=v),typeof y=="number"&&(m.maxItems=y),m.type="array",m.items=this.process(o.element,{...w,path:[...w.path,"items"]});break}case"object":{const m=k;m.type="object",m.properties={};const v=o.shape;for(const b in v)m.properties[b]=this.process(v[b],{...w,path:[...w.path,"properties",b]});const y=new Set(Object.keys(v)),S=new Set([...y].filter(b=>{const E=o.shape[b]._zod;return this.io==="input"?E.optin===void 0:E.optout===void 0}));S.size>0&&(m.required=Array.from(S)),((g=o.catchall)==null?void 0:g._zod.def.type)==="never"?m.additionalProperties=!1:o.catchall?o.catchall&&(m.additionalProperties=this.process(o.catchall,{...w,path:[...w.path,"additionalProperties"]})):this.io==="output"&&(m.additionalProperties=!1);break}case"union":{const m=k;m.anyOf=o.options.map((v,y)=>this.process(v,{...w,path:[...w.path,"anyOf",y]}));break}case"intersection":{const m=k,v=this.process(o.left,{...w,path:[...w.path,"allOf",0]}),y=this.process(o.right,{...w,path:[...w.path,"allOf",1]}),S=E=>"allOf"in E&&Object.keys(E).length===1,b=[...S(v)?v.allOf:[v],...S(y)?y.allOf:[y]];m.allOf=b;break}case"tuple":{const m=k;m.type="array";const v=o.items.map((b,E)=>this.process(b,{...w,path:[...w.path,"prefixItems",E]}));if(this.target==="draft-2020-12"?m.prefixItems=v:m.items=v,o.rest){const b=this.process(o.rest,{...w,path:[...w.path,"items"]});this.target==="draft-2020-12"?m.items=b:m.additionalItems=b}o.rest&&(m.items=this.process(o.rest,{...w,path:[...w.path,"items"]}));const{minimum:y,maximum:S}=t._zod.bag;typeof y=="number"&&(m.minItems=y),typeof S=="number"&&(m.maxItems=S);break}case"record":{const m=k;m.type="object",m.propertyNames=this.process(o.keyType,{...w,path:[...w.path,"propertyNames"]}),m.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 m=k,v=lS(o.entries);v.every(y=>typeof y=="number")&&(m.type="number"),v.every(y=>typeof y=="string")&&(m.type="string"),m.enum=v;break}case"literal":{const m=k,v=[];for(const y of o.values)if(y===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof y=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");v.push(Number(y))}else v.push(y);if(v.length!==0)if(v.length===1){const y=v[0];m.type=y===null?"null":typeof y,m.const=y}else v.every(y=>typeof y=="number")&&(m.type="number"),v.every(y=>typeof y=="string")&&(m.type="string"),v.every(y=>typeof y=="boolean")&&(m.type="string"),v.every(y=>y===null)&&(m.type="null"),m.enum=v;break}case"file":{const m=k,v={type:"string",format:"binary",contentEncoding:"binary"},{minimum:y,maximum:S,mime:b}=t._zod.bag;y!==void 0&&(v.minLength=y),S!==void 0&&(v.maxLength=S),b?b.length===1?(v.contentMediaType=b[0],Object.assign(m,v)):m.anyOf=b.map(E=>({...v,contentMediaType:E})):Object.assign(m,v);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{const m=this.process(o.innerType,w);k.anyOf=[m,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,w),a.ref=o.innerType;break}case"success":{const m=k;m.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 m;try{m=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}k.default=m;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{const m=k,v=t._zod.pattern;if(!v)throw new Error("Pattern not found in template literal");m.type="string",m.pattern=v.source;break}case"pipe":{const m=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(m,w),a.ref=m;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 m=t._zod.innerType;this.process(m,w),a.ref=m;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,h,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 b;const m=this.target==="draft-2020-12"?"$defs":"definitions";if(r.external){const E=(b=r.external.registry.get(k[0]))==null?void 0:b.id,C=r.external.uri??(I=>I);if(E)return{ref:C(E)};const j=k[1].defId??k[1].schema.id??`schema${this.counter++}`;return k[1].defId=j,{defId:j,ref:`${C("__shared")}#/${m}/${j}`}}if(k[1]===o)return{ref:"#"};const y=`#/${m}/`,S=k[1].schema.id??`__schema${this.counter++}`;return{defId:S,ref:y+S}},s=k=>{if(k[1].schema.$ref)return;const m=k[1],{ref:v,defId:y}=i(k);m.def={...m.schema},y&&(m.defId=y);const S=m.schema;for(const b in S)delete S[b];S.$ref=v};if(r.cycles==="throw")for(const k of this.seen.entries()){const m=k[1];if(m.cycle)throw new Error(`Cycle detected: #/${(f=m.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 m=k[1];if(t===k[0]){s(k);continue}if(r.external){const y=(p=r.external.registry.get(k[0]))==null?void 0:p.id;if(t!==k[0]&&y){s(k);continue}}if((h=this.metadataRegistry.get(k[0]))==null?void 0:h.id){s(k);continue}if(m.cycle){s(k);continue}if(m.count>1&&r.reused==="ref"){s(k);continue}}const a=(k,m)=>{const v=this.seen.get(k),y=v.def??v.schema,S={...y};if(v.ref===null)return;const b=v.ref;if(v.ref=null,b){a(b,m);const E=this.seen.get(b).schema;E.$ref&&m.target==="draft-7"?(y.allOf=y.allOf??[],y.allOf.push(E)):(Object.assign(y,E),Object.assign(y,S))}v.isParent||this.override({zodSchema:k,jsonSchema:y,path:v.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 m=k[1];m.def&&m.defId&&(c[m.defId]=m.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 j_(e,t){if(e instanceof ES){const r=new tv(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 tv(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 T_=te("ZodISODateTime",(e,t)=>{nM.init(e,t),dt.init(e,t)});function R_(e){return s_(T_,e)}const F_=te("ZodISODate",(e,t)=>{rM.init(e,t),dt.init(e,t)});function P_(e){return a_(F_,e)}const $_=te("ZodISOTime",(e,t)=>{oM.init(e,t),dt.init(e,t)});function M_(e){return l_($_,e)}const __=te("ZodISODuration",(e,t)=>{iM.init(e,t),dt.init(e,t)});function A_(e){return u_(__,e)}const N_=(e,t)=>{fS.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>QP(e,n)},flatten:{value:n=>JP(e,n)},addIssue:{value:n=>e.issues.push(n)},addIssues:{value:n=>e.issues.push(...n)},isEmpty:{get(){return e.issues.length===0}}})},Oc=te("ZodError",N_,{Parent:Error}),L_=e$(Oc),O_=t$(Oc),D_=hS(Oc),z_=mS(Oc),mt=te("ZodType",(e,t)=>(ot.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)=>ti(e,n,r),e.brand=()=>e,e.register=(n,r)=>(n.add(e,r),e),e.parse=(n,r)=>L_(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>D_(e,n,r),e.parseAsync=async(n,r)=>O_(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>z_(e,n,r),e.spa=e.safeParseAsync,e.refine=(n,r)=>e.check(PA(n,r)),e.superRefine=n=>e.check($A(n)),e.overwrite=n=>e.check(Ua(n)),e.optional=()=>ov(e),e.nullable=()=>iv(e),e.nullish=()=>ov(iv(e)),e.nonoptional=n=>kA(e,n),e.array=()=>He(e),e.or=n=>Za([e,n]),e.and=n=>pA(e,n),e.transform=n=>sv(e,yA(n)),e.default=n=>xA(e,n),e.prefault=n=>SA(e,n),e.catch=n=>CA(e,n),e.pipe=n=>sv(e,n),e.readonly=()=>TA(e),e.describe=n=>{const r=e.clone();return Vs.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=Vs.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Vs.get(e);const r=e.clone();return Vs.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),jS=te("_ZodString",(e,t)=>{sm.init(e,t),mt.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(m_(...r)),e.includes=(...r)=>e.check(v_(...r)),e.startsWith=(...r)=>e.check(w_(...r)),e.endsWith=(...r)=>e.check(x_(...r)),e.min=(...r)=>e.check(zu(...r)),e.max=(...r)=>e.check(CS(...r)),e.length=(...r)=>e.check(IS(...r)),e.nonempty=(...r)=>e.check(zu(1,...r)),e.lowercase=r=>e.check(g_(r)),e.uppercase=r=>e.check(y_(r)),e.trim=()=>e.check(S_()),e.normalize=(...r)=>e.check(b_(...r)),e.toLowerCase=()=>e.check(k_()),e.toUpperCase=()=>e.check(E_())}),B_=te("ZodString",(e,t)=>{sm.init(e,t),jS.init(e,t),e.email=n=>e.check(DM(W_,n)),e.url=n=>e.check(HM(V_,n)),e.jwt=n=>e.check(i_(oA,n)),e.emoji=n=>e.check(UM(H_,n)),e.guid=n=>e.check(qy(nv,n)),e.uuid=n=>e.check(zM(Tl,n)),e.uuidv4=n=>e.check(BM(Tl,n)),e.uuidv6=n=>e.check(WM(Tl,n)),e.uuidv7=n=>e.check(VM(Tl,n)),e.nanoid=n=>e.check(ZM(U_,n)),e.guid=n=>e.check(qy(nv,n)),e.cuid=n=>e.check(KM(Z_,n)),e.cuid2=n=>e.check(YM(K_,n)),e.ulid=n=>e.check(GM(Y_,n)),e.base64=n=>e.check(n_(tA,n)),e.base64url=n=>e.check(r_(nA,n)),e.xid=n=>e.check(XM(G_,n)),e.ksuid=n=>e.check(qM(X_,n)),e.ipv4=n=>e.check(JM(q_,n)),e.ipv6=n=>e.check(QM(J_,n)),e.cidrv4=n=>e.check(e_(Q_,n)),e.cidrv6=n=>e.check(t_(eA,n)),e.e164=n=>e.check(o_(rA,n)),e.datetime=n=>e.check(R_(n)),e.date=n=>e.check(P_(n)),e.time=n=>e.check(M_(n)),e.duration=n=>e.check(A_(n))});function ve(e){return OM(B_,e)}const dt=te("ZodStringFormat",(e,t)=>{it.init(e,t),jS.init(e,t)}),W_=te("ZodEmail",(e,t)=>{K$.init(e,t),dt.init(e,t)}),nv=te("ZodGUID",(e,t)=>{U$.init(e,t),dt.init(e,t)}),Tl=te("ZodUUID",(e,t)=>{Z$.init(e,t),dt.init(e,t)}),V_=te("ZodURL",(e,t)=>{Y$.init(e,t),dt.init(e,t)}),H_=te("ZodEmoji",(e,t)=>{G$.init(e,t),dt.init(e,t)}),U_=te("ZodNanoID",(e,t)=>{X$.init(e,t),dt.init(e,t)}),Z_=te("ZodCUID",(e,t)=>{q$.init(e,t),dt.init(e,t)}),K_=te("ZodCUID2",(e,t)=>{J$.init(e,t),dt.init(e,t)}),Y_=te("ZodULID",(e,t)=>{Q$.init(e,t),dt.init(e,t)}),G_=te("ZodXID",(e,t)=>{eM.init(e,t),dt.init(e,t)}),X_=te("ZodKSUID",(e,t)=>{tM.init(e,t),dt.init(e,t)}),q_=te("ZodIPv4",(e,t)=>{sM.init(e,t),dt.init(e,t)}),J_=te("ZodIPv6",(e,t)=>{aM.init(e,t),dt.init(e,t)}),Q_=te("ZodCIDRv4",(e,t)=>{lM.init(e,t),dt.init(e,t)}),eA=te("ZodCIDRv6",(e,t)=>{uM.init(e,t),dt.init(e,t)}),tA=te("ZodBase64",(e,t)=>{cM.init(e,t),dt.init(e,t)}),nA=te("ZodBase64URL",(e,t)=>{fM.init(e,t),dt.init(e,t)}),rA=te("ZodE164",(e,t)=>{pM.init(e,t),dt.init(e,t)}),oA=te("ZodJWT",(e,t)=>{mM.init(e,t),dt.init(e,t)}),TS=te("ZodNumber",(e,t)=>{kS.init(e,t),mt.init(e,t),e.gt=(r,o)=>e.check(Qy(r,o)),e.gte=(r,o)=>e.check(Hd(r,o)),e.min=(r,o)=>e.check(Hd(r,o)),e.lt=(r,o)=>e.check(Jy(r,o)),e.lte=(r,o)=>e.check(Vd(r,o)),e.max=(r,o)=>e.check(Vd(r,o)),e.int=r=>e.check(rv(r)),e.safe=r=>e.check(rv(r)),e.positive=r=>e.check(Qy(0,r)),e.nonnegative=r=>e.check(Hd(0,r)),e.negative=r=>e.check(Jy(0,r)),e.nonpositive=r=>e.check(Vd(0,r)),e.multipleOf=(r,o)=>e.check(ev(r,o)),e.step=(r,o)=>e.check(ev(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 ae(e){return c_(TS,e)}const iA=te("ZodNumberFormat",(e,t)=>{gM.init(e,t),TS.init(e,t)});function rv(e){return d_(iA,e)}const sA=te("ZodBoolean",(e,t)=>{yM.init(e,t),mt.init(e,t)});function Xt(e){return f_(sA,e)}const aA=te("ZodUnknown",(e,t)=>{vM.init(e,t),mt.init(e,t)});function Ki(){return p_(aA)}const lA=te("ZodNever",(e,t)=>{wM.init(e,t),mt.init(e,t)});function am(e){return h_(lA,e)}const uA=te("ZodArray",(e,t)=>{xM.init(e,t),mt.init(e,t),e.element=t.element,e.min=(n,r)=>e.check(zu(n,r)),e.nonempty=n=>e.check(zu(1,n)),e.max=(n,r)=>e.check(CS(n,r)),e.length=(n,r)=>e.check(IS(n,r)),e.unwrap=()=>e.element});function He(e,t){return C_(uA,e,t)}const RS=te("ZodObject",(e,t)=>{bM.init(e,t),mt.init(e,t),rt(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:Ki()}),e.loose=()=>e.clone({...e._zod.def,catchall:Ki()}),e.strict=()=>e.clone({...e._zod.def,catchall:am()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>YP(e,n),e.merge=n=>GP(e,n),e.pick=n=>ZP(e,n),e.omit=n=>KP(e,n),e.partial=(...n)=>XP($S,e,n[0]),e.required=(...n)=>qP(MS,e,n[0])});function Se(e,t){const n={type:"object",get shape(){return Nc(this,"shape",{...e}),this.shape},...Ce(t)};return new RS(n)}function cA(e,t){return new RS({type:"object",get shape(){return Nc(this,"shape",{...e}),this.shape},catchall:am(),...Ce(t)})}const dA=te("ZodUnion",(e,t)=>{SM.init(e,t),mt.init(e,t),e.options=t.options});function Za(e,t){return new dA({type:"union",options:e,...Ce(t)})}const fA=te("ZodIntersection",(e,t)=>{kM.init(e,t),mt.init(e,t)});function pA(e,t){return new fA({type:"intersection",left:e,right:t})}const FS=te("ZodRecord",(e,t)=>{EM.init(e,t),mt.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function zn(e,t,n){return new FS({type:"record",keyType:e,valueType:t,...Ce(n)})}function hA(e,t,n){return new FS({type:"record",keyType:Za([e,am()]),valueType:t,...Ce(n)})}const jp=te("ZodEnum",(e,t)=>{CM.init(e,t),mt.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 jp({...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 jp({...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 jp({type:"enum",entries:n,...Ce(t)})}const mA=te("ZodLiteral",(e,t)=>{IM.init(e,t),mt.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 PS(e,t){return new mA({type:"literal",values:Array.isArray(e)?e:[e],...Ce(t)})}const gA=te("ZodTransform",(e,t)=>{jM.init(e,t),mt.init(e,t),e._zod.parse=(n,r)=>{n.addIssue=i=>{if(typeof i=="string")n.issues.push(ka(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(ka(s))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function yA(e){return new gA({type:"transform",transform:e})}const $S=te("ZodOptional",(e,t)=>{TM.init(e,t),mt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ov(e){return new $S({type:"optional",innerType:e})}const vA=te("ZodNullable",(e,t)=>{RM.init(e,t),mt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function iv(e){return new vA({type:"nullable",innerType:e})}const wA=te("ZodDefault",(e,t)=>{FM.init(e,t),mt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function xA(e,t){return new wA({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const bA=te("ZodPrefault",(e,t)=>{PM.init(e,t),mt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function SA(e,t){return new bA({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const MS=te("ZodNonOptional",(e,t)=>{$M.init(e,t),mt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function kA(e,t){return new MS({type:"nonoptional",innerType:e,...Ce(t)})}const EA=te("ZodCatch",(e,t)=>{MM.init(e,t),mt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function CA(e,t){return new EA({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const IA=te("ZodPipe",(e,t)=>{_M.init(e,t),mt.init(e,t),e.in=t.in,e.out=t.out});function sv(e,t){return new IA({type:"pipe",in:e,out:t})}const jA=te("ZodReadonly",(e,t)=>{AM.init(e,t),mt.init(e,t)});function TA(e){return new jA({type:"readonly",innerType:e})}const RA=te("ZodCustom",(e,t)=>{NM.init(e,t),mt.init(e,t)});function FA(e){const t=new xn({check:"custom"});return t._zod.check=e,t}function PA(e,t={}){return I_(RA,e,t)}function $A(e){const t=FA(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(ka(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(ka(o))}},e(n.value,n)));return t}const Dc=ir(["full-bleed","video-top","pip-bubble","graphic-only","blurred-behind","lower-third","split-left","split-right"]),zc=ir(["TitleCard","StatCard","RuleCard","StrikethroughReveal","FlowDiagram","TerminalMock","ChatMock","ScreenshotFrame","BulletList"]),lm=Se({startWord:ae().int().nonnegative(),endWord:ae().int().nonnegative()}),MA=Se({id:ve(),anchor:lm,layout:Dc,component:zc,props:zn(ve(),Ki()),overrides:zn(ve(),Ki()).default({}),rationale:ve().optional()});Se({id:ve(),kind:ir(["graphic","plain"]).optional(),kept:Se({srcIn:ae().nonnegative(),srcOut:ae().nonnegative()}).optional(),anchor:lm.optional(),layout:Dc,component:zc.optional(),props:zn(ve(),Ki()).optional(),startSec:ae().nonnegative(),endSec:ae().nonnegative(),graphicRect:Se({x:ae(),y:ae(),w:ae(),h:ae()}).optional(),elements:zn(ve(),Se({dx:ae().optional(),dy:ae().optional(),scale:ae().positive().optional(),hidden:Xt().optional()})).optional(),video:Se({scale:ae().positive().max(4).optional(),dy:ae().optional(),dx:ae().optional(),autoZoom:Xt().optional(),volume:ae().min(0).max(4).optional()}).optional(),pip:Se({cornerRadius:ae().min(0).max(1).optional(),x:ae().min(0).max(1).optional(),y:ae().min(0).max(1).optional()}).optional(),captionY:ae().min(0).max(1).optional(),captionScale:ae().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'})});Se({centerYFrac:ae().min(0).max(1),sizeFrac:ae().min(0).max(1).optional(),centerXFrac:ae().min(0).max(1).optional(),sourceAspect:ae().positive().optional(),subject:ir(["face","screen"]).optional()});const Bc=Se({bg:ve().default("#0B0B0E"),fg:ve().default("#FFFFFF"),accent:ve().default("#FFE14D"),muted:ve().default("#9A9AA3"),success:ve().default("#5FBF77"),cardBg:ve().default("#15151B"),cardBorder:ve().default("#2A2A33"),danger:ve().default("#FF5C5C"),radiusPx:ae().default(24),fontDisplay:ve().default("'Inter', 'Helvetica Neue', 'Arial Black', Arial, sans-serif"),fontMono:ve().default("'SF Mono', 'Cascadia Code', Consolas, monospace")}),_A=Bc.parse({}),AA=Se({eyebrow:ve().max(28).optional(),title:ve().min(1).max(48).describe("the claim WITHOUT the emphasis token — never repeat the emphasis here"),emphasis:ve().max(16).optional().describe("the number/punch token pulled OUT of the title (e.g. '861%') — not a duplicate of it"),sub:ve().max(64).optional()}),NA=Se({label:ve().min(1).max(28),value:ve().min(1).max(12),caption:ve().max(40).optional(),inverted:Xt().default(!1)}),LA=Se({kicker:ve().min(1).max(24),text:ve().min(1).max(40),struck:ve().max(40).optional()}),OA=Se({lines:He(Se({text:ve().min(1).max(32),struck:Xt().default(!1),mark:ir(["none","cross","check"]).default("none")})).min(1).max(4)}),DA=Se({title:ve().max(28).optional(),items:He(ve().min(1).max(36)).min(2).max(5)}),zA=Se({nodes:He(ve().min(1).max(16)).min(2).max(5),emphasizeLast:Xt().default(!0)}),BA=Se({windows:He(Se({title:ve().max(24),lines:He(ve().max(40)).min(1).max(6)})).min(1).max(5),fanOut:ve().max(20).optional()}),WA=Se({messages:He(Se({from:ir(["user","agent"]),text:ve().min(1).max(60)})).min(1).max(4),keyword:ve().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'.")}),VA=Se({src:ve().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:ve().max(32).optional(),kenBurns:Xt().default(!0)}),_S={TitleCard:{propsSchema:AA,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:NA,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:LA,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:OA,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:zA,defaultProps:{nodes:["A","B"]},defaultLayout:"graphic-only",altLayouts:[],whenToUse:"A causal chain or pipeline as chips with arrows (TEAM → AI AGENTS → CHURN)."},TerminalMock:{propsSchema:BA,defaultProps:{windows:[{title:"terminal-01",lines:["$ run"]}]},defaultLayout:"graphic-only",altLayouts:[],whenToUse:"Anything about running code/processes/agents — stylized terminal windows."},ChatMock:{propsSchema:WA,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:VA,defaultProps:{},defaultLayout:"video-top",altLayouts:["blurred-behind"],whenToUse:"Reference to a document/PR/review — a framed screenshot look with a label chip."},BulletList:{propsSchema:DA,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 av(e,t,n={}){const r=_S[e],o={...r.defaultProps,...t,...n},i=r.propsSchema.safeParse(o);return i.success?i.data:null}function HA(e){const t=_S[e];if(!t)return[];const n=j_(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 UA=cA({preset:ve().optional(),lut:ve().optional(),intensity:ae().min(0).max(1).optional(),exposure:ae().min(-2).max(2).optional(),temperature:ae().min(-100).max(100).optional(),saturation:ae().min(0).max(2).optional(),contrast:ae().min(0).max(2).optional()}).refine(e=>e.preset!==void 0!=(e.lut!==void 0),{message:'set exactly one of "preset" or "lut" — a grade needs one look, not zero or two'}),qr={temperature:0,tint:0,exposure:0,contrast:1,lift:0,saturation:1,shadowTint:[0,0,0],highlightTint:[0,0,0],defaultIntensity:1},um={"talking-head":{...qr,temperature:10,contrast:1.06,lift:.045,saturation:1.05,defaultIntensity:.6},"teal-orange":{...qr,shadowTint:[-.03,.01,.04],highlightTint:[.04,.01,-.03],contrast:1.15,saturation:1.05,defaultIntensity:.7},"filmic-fade":{...qr,lift:.06,contrast:.95,saturation:.9,temperature:8,defaultIntensity:.8},punchy:{...qr,contrast:1.2,saturation:1.15,defaultIntensity:.7},cwa:{...qr,temperature:6,exposure:.1,contrast:1.09,lift:.05,saturation:1.06,shadowTint:[-.015,0,.02],highlightTint:[.02,.005,-.01],defaultIntensity:1},mono:{...qr,saturation:0,contrast:1.1,defaultIntensity:1}},Pt=[.2126,.7152,.0722],ZA=e=>Math.min(1,Math.max(0,e)),lv=(e,t,n)=>e+(t-e)*n;function KA(e,t,n){let r=n*2**e.exposure;const o=t===0?1+e.temperature*.0015:t===1?1+e.tint*.0015:1-e.temperature*.0015;return r*=o,r=.5+(r-.5)*e.contrast,r=r*(1-e.lift)+e.lift,r}const uv=33,YA=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];function GA(e,t){const n=new Array(20).fill(0);for(let r=0;r<4;r++){for(let i=0;i<4;i++){let s=0;for(let a=0;a<4;a++)s+=e[r*5+a]*t[a*5+i];n[r*5+i]=s}let o=e[r*5+4];for(let i=0;i<4;i++)o+=e[r*5+i]*t[i*5+4];n[r*5+4]=o}return n}function XA(e){const{params:t,intensity:n}=e,r=f=>{const p=[];for(let h=0;h<uv;h++){const g=h/(uv-1);p.push(lv(g,ZA(KA(t,f,g)),n))}return p},o=[t.highlightTint[0]-t.shadowTint[0],t.highlightTint[1]-t.shadowTint[1],t.highlightTint[2]-t.shadowTint[2]],i=[1+o[0]*Pt[0],o[0]*Pt[1],o[0]*Pt[2],0,t.shadowTint[0],o[1]*Pt[0],1+o[1]*Pt[1],o[1]*Pt[2],0,t.shadowTint[1],o[2]*Pt[0],o[2]*Pt[1],1+o[2]*Pt[2],0,t.shadowTint[2],0,0,0,1,0],s=t.saturation,a=[(1-s)*Pt[0]+s,(1-s)*Pt[1],(1-s)*Pt[2],0,0,(1-s)*Pt[0],(1-s)*Pt[1]+s,(1-s)*Pt[2],0,0,(1-s)*Pt[0],(1-s)*Pt[1],(1-s)*Pt[2]+s,0,0,0,0,0,1,0],c=GA(a,i).map((f,p)=>lv(YA[p],f,n));return{tableR:r(0),tableG:r(1),tableB:r(2),colorMatrix:c}}function qA(e){if(e.lut!==void 0)return{kind:"lut",lutRef:e.lut,tweaks:{...qr,exposure:e.exposure??0,temperature:e.temperature??0,saturation:e.saturation??1,contrast:e.contrast??1},intensity:e.intensity??1};const t=um[e.preset??""]??qr;return{kind:"preset",params:{...t,exposure:t.exposure+(e.exposure??0),temperature:t.temperature+(e.temperature??0),saturation:t.saturation*(e.saturation??1),contrast:t.contrast*(e.contrast??1)},intensity:e.intensity??t.defaultIntensity}}const JA=Se({text:ve(),start:ae().nonnegative(),end:ae().nonnegative(),conf:ae().min(0).max(1).optional()}),QA=Se({language:ve().default("en"),words:He(JA)}),e4=ir(["exact","light","standard","aggressive"]),AS=ir(["silence","pause","filler","retake","user","clip"]),cv=Se({srcIn:ae().nonnegative(),srcOut:ae().nonnegative(),kind:ir(["keep","remove"]),reason:AS.optional(),confidence:ae().min(0).max(1).optional()}),Rl=Se({start:ae(),end:ae()}),t4=Se({silences:He(Rl),gaps:He(Rl),cuttable:He(Rl),breaths:He(Rl).default([]),fillers:He(Se({wordIndex:ae().int(),text:ve(),start:ae(),end:ae()}))}),n4=Se({duration:ae().positive(),width:ae().int().positive(),height:ae().int().positive(),fps:ae().positive(),hasAudio:Xt(),rotation:ae().int().optional()}),r4=Se({width:ae().int().positive().default(1080),height:ae().int().positive().default(1920),fps:ae().positive().default(30)}),o4=Se({level:ir(["subtle","normal","meme"]),placements:He(Se({soundId:ve(),word:ae().int().nonnegative(),sceneId:ve().optional(),gain:ae().min(0).max(2).optional(),rationale:ve().optional()}))});Se({version:PS(1),source:Se({path:ve(),probe:n4,audioPath:ve().optional(),mezzaninePath:ve().optional(),face:Se({centerXFrac:ae(),centerYFrac:ae(),sizeFrac:ae(),framesSampled:ae().int(),framesDetected:ae().int()}).nullable().optional()}),cleanup:e4,intent:ve().optional(),transcript:QA.optional(),repairs:He(Se({startWord:ae().int(),endWord:ae().int(),heard:ve(),correction:ve(),applied:Xt(),rejected:ve().optional()})).optional(),analysis:t4.optional(),cutlist:He(cv).optional(),cutlistProposed:He(cv).optional(),clip:Se({targetSec:ae().positive(),startWord:ae().int().nonnegative(),endWord:ae().int().nonnegative(),startSec:ae().nonnegative(),endSec:ae().nonnegative(),reason:ve()}).optional(),scenes:He(MA).optional(),sfx:o4.optional(),producer:Se({provider:ve(),models:He(ve()).default([]),cached:Xt().default(!1),at:ve().optional()}).optional(),theme:Bc.optional(),render:r4});const i4=Se({dx:ae().optional(),dy:ae().optional(),scale:ae().positive().optional(),hidden:Xt().optional()}),s4=Za([Se({startSec:ae().finite().nonnegative(),endSec:ae().finite().nonnegative()}),Se({srcStart:ae().finite().nonnegative(),srcEnd:ae().finite().nonnegative()}).refine(e=>e.srcEnd>e.srcStart,{message:"srcEnd must be after srcStart"})]);function cm(e){return"srcStart"in e}const NS=Se({props:zn(ve(),Ki()).default({}),elements:zn(ve(),i4).default({}),timing:s4.optional(),component:zc.optional(),layout:Dc.optional(),video:Se({scale:ae().positive().max(4).optional(),dy:ae().optional(),dx:ae().optional(),autoZoom:Xt().optional(),volume:ae().min(0).max(4).optional()}).optional(),pip:Se({cornerRadius:ae().min(0).max(1).optional(),x:ae().min(0).max(1).optional(),y:ae().min(0).max(1).optional()}).optional(),captionY:ae().min(0).max(1).optional(),captionScale:ae().min(.2).max(3).optional(),graphicRect:Se({x:ae().min(0).max(1),y:ae().min(0).max(1),w:ae().min(.08).max(1),h:ae().min(.05).max(1)}).optional(),anchor:lm.optional(),hidden:Xt().optional()}),a4=Se({text:ve().min(1).max(80),was:ve()}),l4=Se({fromKey:ve().regex(/^w\d+$/),toKey:ve().regex(/^w\d+$/),text:ve().min(1).max(400),was:ve()});function dv(e,t,n){var r;return((r=e[t])==null?void 0:r.was)??n}function fv(e,t,n,r){var o;return((o=e.find(i=>i.fromKey===t&&i.toKey===n))==null?void 0:o.was)??r}function LS(e){return String(Math.round(e*1e3))}const u4=Za([Se({at:ae().finite().nonnegative().optional(),src:ae().finite().nonnegative().optional(),id:ve().min(1)}).refine(e=>e.at!==void 0||e.src!==void 0,{message:"a split needs `at` or `src`"}),ae().finite().nonnegative().transform(e=>({at:e,src:void 0,id:LS(e)}))]);function dm(e){return e.flatMap(t=>t.at!==void 0?[{at:t.at,id:t.id}]:[])}function c4(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 d4(e,t){const n=LS(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 f4(e){return`${e.soundId}@${e.word}`}const p4=Se({word:ae().int().nonnegative().optional(),soundId:ve().min(1).optional(),gain:ae().min(0).max(2).optional(),muted:Xt().optional()}),h4=Se({id:ve().regex(/^[A-Za-z0-9_-]+$/),soundId:ve().min(1),word:ae().int().nonnegative(),gain:ae().min(0).max(2).optional()}),m4=Se({theme:Bc.partial().default({}),colorGrade:Za([UA,PS(!1)]).optional(),captionsHidden:Xt().optional(),scenes:zn(ve(),NS).default({}),captions:zn(ve(),a4).default({}),captionWordsHidden:zn(ve(),Se({was:ve()})).default({}),captionRangeEdits:He(l4).default([]),captionLineTiming:zn(ve(),Se({lead:ae().min(-30).max(30),tail:ae().min(-30).max(30)})).default({}),captionLineWindows:zn(ve(),Se({srcStart:ae(),srcEnd:ae()}).refine(e=>e.srcEnd-e.srcStart>=Wu,{message:"caption window must be at least 50ms (MIN_CAPTION_SEC) wide, ordered start → end"})).default({}),splits:He(u4).default([]),cuts:He(Se({startSec:ae().nonnegative(),endSec:ae().nonnegative(),src:Se({startSec:ae().nonnegative(),endSec:ae().nonnegative()}).optional()})).default([]),cleanup:Se({reasons:hA(AS,Xt()).default({}),kept:He(Se({srcIn:ae().nonnegative(),srcOut:ae().nonnegative()})).default([]),dismissed:He(Se({srcIn:ae().nonnegative(),srcOut:ae().nonnegative()})).default([])}).default({reasons:{},kept:[],dismissed:[]}),sfx:Se({edits:zn(ve(),p4).default({}),added:He(h4).default([])}).optional()}),g4=()=>m4.parse({});function y4(e,t){return av(e,{},t)??av(e,{},{})}function v4(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 w4(e,t){if(!cm(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 pv(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&&cm(s)});if(n.length===0)return{doc:e,reports:[]};const r=[],o={...e.scenes};for(const i of n){const s=o[i],a=w4(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 ou(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=v4(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?y4(s.component,s.props):{...i.props,...s.props},f=s.layout!==void 0&&s.layout!==i.layout,{graphicRect:p,...h}=i;return{...f?h:i,component:l,layout:s.layout??i.layout,props:c,...Object.keys(s.elements).length>0?{elements:s.elements}:{},...s.video?{video:s.video}:{},...s.pip?{pip:s.pip}:{},...s.captionY!==void 0?{captionY:s.captionY}:{},...s.captionScale!==void 0?{captionScale:s.captionScale}:{},...s.graphicRect?{graphicRect:s.graphicRect}:{},...s.timing&&!cm(s.timing)&&!i.pinned?{startSec:s.timing.startSec,endSec:s.timing.endSec,pinned:!0}:{}}}),orphans:r}}const Yi=.3;function Bu(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+Yi&&r.at<=s.endSec-Yi);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 OS(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 x4(e,t,n=dm(t.splits)){return OS(Bu(e,n),t)}function b4(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 Cn(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 Ea(e){return/^\d+$/.test(e)}function Xe(e){return!e||!Number.isFinite(e.srcStart)?null:Cn(e.srcStart)}const S4=8;function k4(e,t,n){var i,s;if(!Ea(e))return{to:e};const r=Number(e);if(((i=n[r])==null?void 0:i.text)===t.was)return hv(n[r]);const o=[];for(let a=1;a<=S4;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"}:hv(n[o[0]])}function hv(e){const t=Xe(e);return t===null?{to:null,reason:"unanchorable"}:{to:t}}function E4(e,t){const n=t.flatMap(a=>a.words),r={},o=[],i=Object.entries(e).map(([a,l])=>({key:a,edit:l,legacy:Ea(a),claim:k4(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 C4(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 DS(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=Xe(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 I4(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 zS(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 $=0;$<r.length;$++)for(let A=0;A<r[$].words.length;A++)l.push({line:$,word:A,w:r[$].words[A]});const c=l.findIndex($=>Xe($.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 $=c;$<l.length;$++)if(Xe(l[$].w)===s.toKey){f=$;break}if(f===-1){n.push({key:a,expected:s.was,found:null});continue}const p=l.slice(c,f+1),h=p.map($=>$.w.text).join(" ").normalize("NFC");if(h!==s.was.normalize("NFC")){n.push({key:a,expected:s.was,found:h});continue}const g=s.text.trim().split(/\s+/).filter(Boolean);if(g.length===0){n.push({key:a,expected:s.was,found:h});continue}o.add(a);for(const $ of p){const A=Xe($.w);A!==null&&i.add(A)}if(g.length===p.length){const $=new Map(p.map((A,U)=>[`${A.line}:${A.word}`,g[U]]));r=r.map((A,U)=>({...A,words:A.words.map((z,O)=>{const R=$.get(`${U}:${O}`);return R===void 0?z:{...z,text:R}})}));continue}const w=[],x=new Map;for(const $ of p){const A=x.get($.line);A?(A.last=$.word,A.words.push($.w)):(w.push($.line),x.set($.line,{first:$.word,last:$.word,words:[$.w]}))}const k=w.map($=>x.get($).words.reduce((A,U)=>A+(U.end-U.start),0)),m=k.reduce(($,A)=>$+A,0),v=m>0?k:k.map(()=>1),y=m>0?m:k.length,S=v.map($=>g.length*$/y),b=S.map($=>Math.floor($));let E=g.length-b.reduce(($,A)=>$+A,0);const C=S.map(($,A)=>({i:A,rem:$-Math.floor($)})).sort(($,A)=>A.rem-$.rem||$.i-A.i);for(let $=0;E>0;$=($+1)%C.length)b[C[$].i]++,E--;const j=p[0].w.srcStart,I=p[p.length-1].w.srcStart,P=g.map(($,A)=>g.length===1?j:j+(I-j)*A/(g.length-1));let L=0;const W=[];for(let $=0;$<r.length;$++){const A=r[$],U=x.get($);if(!U){W.push(A);continue}const z=b[w.indexOf($)],O=g.slice(L,L+z),R=P.slice(L,L+z);L+=z;const Z=z===0?[]:I4(O,U.words[0].start,U.words[U.words.length-1].end,R),B=[...A.words.slice(0,U.first),...Z,...A.words.slice(U.last+1)];B.length!==0&&W.push({...A,words:B})}r=W}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 h of i.words){const g=Xe(h),w=g===null?void 0:t[g];if(g===null||!w){s.push(h);continue}if(r.has(g)){n.push({key:g,expected:w.was,found:h.text,reason:"duplicate-anchor"}),s.push(h);continue}if(r.add(g),h.text!==w.was){n.push({key:g,expected:w.was,found:h.text}),s.push(h);continue}}if(s.length===i.words.length){o.push(i);continue}if(s.length===0)continue;const a=i.words[i.words.length-1],l=s[0],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 Wu=.05;function WS(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 VS(e,t){const n=[],r=e.length;if(r===0){for(const f of Object.keys(t))n.push({key:f,expected:"",found:null});return{lines:[],dropped:n}}if(Object.keys(t).length===0)return{lines:[...e],dropped:n};const o=e.map(f=>f.start),i=e.map(f=>f.end),s=new Set;for(let f=0;f<r;f++){const p=e[f],h=Xe(p.words[0]),g=h===null?void 0:t[h];if(!(h===null||!g)){if(s.has(h)){n.push({key:h,expected:"",found:p.words[0].text,reason:"duplicate-anchor"});continue}s.add(h),i[f]=p.end+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]+Wu),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]-Wu),a)}const c=e.map((f,p)=>{const h=o[p],g=i[p];return h===f.start&&g===f.end?f:{...f,start:h,end:g,words:WS(f.words,f.start,f.end,h,g)}});for(const f of Object.keys(t))s.has(f)||n.push({key:f,expected:"",found:null});return{lines:c,dropped:n}}function HS(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=Xe(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+Wu);return c===s.start&&f===s.end?s:{...s,start:c,end:f,words:WS(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 j4(e,t){return Bc.parse({...e,...t.theme})}function mv(e,t,n,r){const o=e.scenes[t]??NS.parse({});return{...e,scenes:{...e.scenes,[t]:{...o,elements:{...o.elements,[n]:{...o.elements[n],...r}}}}}}function T4(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 R4(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 F4(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 P4(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 US(e){const t=e.indexOf("@");return t===-1?e:e.slice(0,t)}const $4=.6;function M4(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 _4(e,t){const n=t.outputDurationSec,r=[...e].sort((f,p)=>f.startSec-p.startSec);if(n<=0)return r;const o=M4(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),h=[f.start,...p,f.end];for(let g=0;g<h.length-1;g++){const w=h[g],x=h[g+1];if(x-w<$4)continue;let k=0;for(let m=0;m<o.length;m++)o[m]<=w+1e-9&&(k=m);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 N4=1.05;function L4(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 O4(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 Wc{constructor(t){We(this,"spans");We(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 ro(e){return new Wc(e.map(t=>({srcIn:t.srcIn,srcOut:t.srcOut,kind:"keep"})))}function ZS(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 gv(e,t){const n=o=>o.words;if(e.every(o=>n(o).every(i=>i.srcStart!==void 0)))return[...e];const r=ro(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,z4=new RegExp("\\p{L}","u");function fm(e){for(const t of e){if(D4.test(t))return"rtl";if(z4.test(t))return"ltr"}return"ltr"}const Ca="Noto Nastaliq Urdu",KS="fonts/NotoNastaliqUrdu-Bold.ttf";function B4(e){return e.some(t=>fm(t.words.map(n=>n.text).join(" "))==="rtl")}const W4=1.5,yv=.7;function V4(e,t={}){const n=[...t.breakpoints??[]].sort((r,o)=>r-o);return e.map((r,o)=>{if(r.end-r.start>=yv)return r;let i=r.start+yv;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 H4(e){return e?{maxWordsPerLine:6,maxLineDuration:2.4}:{maxWordsPerLine:3,maxLineDuration:1.2}}function U4(e,t,n={}){var h,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-W4);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=((h=f[0])==null?void 0:h.start)??w.start,k=(g=f[f.length-1])==null?void 0:g.end,m=f.length>0&&a.some(v=>v>x+1e-6&&v<=w.start+1e-6);(f.length>=r||w.end-x>o||k!==void 0&&w.start-k>i||m)&&p(),f.push(w)}p();for(let w=0;w<c.length;w++){const x=c[w],k=c[w+1],m=x.words[x.words.length-1].end,v=a.find(S=>S>x.start+1e-6);let y=x.end+s;k&&(y=Math.min(y,k.start)),v!==void 0&&(y=Math.min(y,v)),x.end=Math.min(Math.max(y,m),t.outputDuration)}return V4(c,{breakpoints:a,maxEnd:t.outputDuration})}const YS=9,Z4=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 K4(e,t=YS){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&&Z4.has(s[s.length-1].toLowerCase().replace(/\W/g,""));)s.pop();return s.join(" ").replace(/[,;:—–-]+$/,"")}function Vc(e){return e!=="user"&&e!=="clip"}function pm(e,t){if(!t)return[];const n=t.kept??[];return e.filter(r=>{var o;return r.kind==="remove"&&Vc(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 hm(e,t){const n=(t==null?void 0:t.dismissed)??[];return n.length===0?[]:e.filter(r=>r.kind==="remove"&&Vc(r.reason)&&n.some(o=>o.srcIn<r.srcOut&&o.srcOut>r.srcIn))}function Y4(e,t){const n=new Set([...pm(e,t),...hm(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 G4(e){return`take-kept-${Math.round(e*1e3)}`}const Fl=.05;function X4(e,t,n){const r=[...e],o=[];for(const i of t){const s=G4(i.srcIn),a=`kept range ${i.srcIn.toFixed(3)}–${i.srcOut.toFixed(3)}s`;if(r.some(m=>m.id===s||m.id.startsWith(`${s}@`)))continue;if(i.srcOut-i.srcIn<Yi){o.push(`${a} is shorter than ${Yi}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(m=>m.startSec<=l+1e-6&&m.endSec>l+1e-6),p=f===-1?void 0:r[f];if(p===void 0){if(r.some(b=>b.startSec<c-1e-6&&b.endSec>l+1e-6)){o.push(`${a} straddles existing cues — no block carved`);continue}const v=[...r].filter(b=>b.kind==="plain").sort((b,E)=>Math.abs(b.startSec-l)-Math.abs(E.startSec-l))[0],y={id:s,kind:"plain",layout:(v==null?void 0:v.layout)??"video-top",...(v==null?void 0:v.video)!==void 0?{video:v.video}:{},startSec:l,endSec:c,...i.dismissed===!0?{}:{kept:{srcIn:i.srcIn,srcOut:i.srcOut}}},S=r.findIndex(b=>b.startSec>=c-1e-6);r.splice(S===-1?r.length:S,0,y);continue}if(p.kind!=="plain"){o.push(`${a} sits under graphic "${p.id}" — the graphic keeps the window`);continue}const h=Math.min(c,p.endSec);h<c-1e-6&&o.push(`${a} crosses out of take "${p.id}" — carved up to its edge (${h.toFixed(3)}s)`);const g={...p,id:s,startSec:Math.max(p.startSec,l),endSec:h,...i.dismissed===!0?{}:{kept:{srcIn:i.srcIn,srcOut:i.srcOut}}},w=l-p.startSec,x=p.endSec-h,k=[...w>=Fl?[{...p,endSec:l}]:[],w>=Fl?g:{...g,startSec:p.startSec},...x>=Fl?[{...p,startSec:h}]:[]];if(x<Fl){const m=k[k.length-1];k[k.length-1]={...m,endSec:p.endSec}}r.splice(f,1,...k)}return{cues:r,reports:o}}function q4(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}const vv=.002;function J4(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>=vv?(r.push({srcIn:i,srcOut:a,kind:"keep"}),r.push({srcIn:a,srcOut:l,kind:"remove",reason:"user",confidence:1})):r.push({srcIn:i,srcOut:l,kind:"remove",reason:"user",confidence:1}),i=l)}if(o.srcOut-i>=vv)r.push({srcIn:i,srcOut:o.srcOut,kind:"keep"});else if(i<o.srcOut){const s=r[r.length-1];s&&s.kind==="remove"&&s.srcOut===i?r[r.length-1]={...s,srcOut:o.srcOut}:r.push({srcIn:i,srcOut:o.srcOut,kind:"remove",reason:"user",confidence:1})}}return r}const mm=1e-6;function Q4(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?Y4(e,t):r.map(h=>({srcIn:h.srcIn,srcOut:h.srcOut,kind:"keep"})),f=new Wc(J4(c,i)),p=ro(r);return ZS(p,f,mm)?null:{oldMap:p,newMap:f}}catch{return null}}function e3(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 GS(e,t,n){const r=e.fromLive(t),o=e.fromLive(n);return o-r<mm?{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 t3(e,t,n){const r=[],o=(s,a)=>q4(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<mm?(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 Pl(e){const t=/^w(-?\d+)$/.exec(e);return t?Number(t[1]):null}function n3(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)=>(Pl(f[0])??0)-(Pl(p[0])??0));for(const[f,p]of c){const h=Pl(f),g=h===null?void 0:r.get(h),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=Pl(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 bn={width:1080,height:1920};bn.width;bn.height;const Ka={centerYFrac:.38,sizeFrac:.22},r3=.35,o3=.45,XS=1-1/N4,i3=.4*XS,s3=.6*XS;function qS(e,t,n=bn){const r=e.w*n.width,o=e.h*n.height;return Math.max(o,r/(t.sourceAspect??n.width/n.height))}function a3(e,t,n=bn){if(t.subject==="screen")return .5;const r=e.h*n.height,o=qS(e,t,n),i=o-r;if(i<=1)return .5;const s=t.sizeFrac??Ka.sizeFrac,a=(t.centerYFrac-s/2-r3*s)*o,l=(t.centerYFrac+s/2)*o,c=(a+l)/2-o3*r,f=a-i3*r,p=l+s3*r-r,h=p<=f?Math.min(Math.max(c,p),f):p;return Math.min(1,Math.max(0,h/i))}function l3(e,t,n,r,o=bn){if(r.length===0)return e;const i=t.h*o.height,s=qS(t,n,o);if(s-i<=1)return e;const l=i/s,c=1-l;if(c<=0)return e;let f=e*c;for(let p=0;p<r.length+1;p++){const h=r.find(y=>{const S=y.y,b=y.y+y.h,E=f+l,C=S<f&&f<b,j=S<E&&E<b;return C||j});if(!h)break;const g=[],w=h.y+h.h;w<=c&&g.push(w);const x=h.y-l;if(x>=0&&g.push(x),h.h<=l){const y=Math.max(0,h.y+h.h-l),S=Math.min(c,h.y);y<=S&&g.push(Math.min(Math.max(f,y),S))}const k=n.sizeFrac??Ka.sizeFrac,m=n.centerYFrac+k/2,v=g.filter(y=>y+l>=m);if(v.length===0)return e;f=v.reduce((y,S)=>Math.abs(S-f)<Math.abs(y-f)?S:y)}return Math.min(1,Math.max(0,f/c))}function u3(e,t,n=bn){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 c3={top:.12,bottom:.22,right:.16,left:.04},d3={top:.06,bottom:.12,right:.05,left:.05};function gr(e=bn){return e.width>e.height?d3:c3}function f3(e=bn){const t=gr(e);return{x:t.left,y:t.top,w:1-t.left-t.right,h:1-t.top-t.bottom}}const p3=.08,h3=.05;function Vu(e,t=bn){const n=f3(t),r=1e-9,o=(c,f,p)=>c<f-r?f:c>p+r?p:c,i=o(e.w,p3,n.w),s=o(e.h,h3,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 wv=.045;function m3(e){return e.width>e.height?44:64}const Cr={x:0,y:0,w:1,h:1},Ud=.3,si={x:.5-Ud/2,y:.66,w:Ud,h:Ud*1080/1920};function Uo(e,t=Ka,n=[],r=bn){const o=a=>l3(a3(a,t,r),a,t,n,r),i=a=>u3(a,t,r),s=r.width>r.height;switch(e){case"full-bleed":return{video:{rect:Cr,cornerRadius:0,blurPx:0,dim:0,opacity:1,objectPosY:o(Cr),objectPosX:i(Cr)},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:Cr,cornerRadius:0,blurPx:0,dim:0,opacity:1,objectPosY:o(Cr),objectPosX:i(Cr)},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:si,cornerRadius:1,blurPx:0,dim:0,opacity:1,objectPosY:o(si),objectPosX:i(si)},graphic:{x:.06,y:.14,w:.78,h:.42},captionAnchor:s?.78:.61};case"graphic-only":return{video:{rect:si,cornerRadius:1,blurPx:0,dim:0,opacity:0,objectPosY:o(si),objectPosX:i(si)},graphic:{x:.04,y:.14,w:.8,h:.54},captionAnchor:s?.8:.73};case"blurred-behind":return{video:{rect:Cr,cornerRadius:0,blurPx:22,dim:.55,opacity:1,objectPosY:o(Cr),objectPosX:i(Cr)},graphic:{x:.07,y:.24,w:.77,h:.36},captionAnchor:s?.8:.69}}}const g3={x:.07,y:.24,w:.77,h:.36};function JS(e,t=bn){return e.graphicRect?Vu(e.graphicRect,t):Uo(e.layout,Ka,[],t).graphic??g3}const QS=.35;function po(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 y3(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 xv(e,t,n){return{rect:y3(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 Hu(e){return e*e*(3-2*e)}function ek(e){return e.filter(t=>!(t.kind==="plain"&&t.layout==="full-bleed"))}function Zd(e,t,n,r){const o=Uo(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 v3(e,t,n=Ka,r=[],o=bn){const i=ek(e),s=r.filter(m=>t>=m.startSec&&t<m.endSec),a=Uo("full-bleed",n,s,o).video,l=po(i,t);if(!l)return a;const c=Zd(l,n,s,o),f=Math.min(QS,(l.endSec-l.startSec)/2),p=t-l.startSec,h=l.endSec-t,g=po(i,l.startSec-.001),w=po(i,l.endSec+.001),x=g?Zd(g,n,s,o):a,k=w?Zd(w,n,s,o):a;return p<f?xv(x,c,Hu(p/f)):h<f?xv(c,k,Hu(1-h/f)):c}function w3(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 Kd(e){return e==="pip-bubble"||e==="graphic-only"?1:0}function x3(e,t){const n=ek(e),r=po(n,t);if(!r)return 0;const o=Kd(r.layout),i=Math.min(QS,(r.endSec-r.startSec)/2),s=po(n,r.startSec-.001),a=po(n,r.endSec+.001),l=s?Kd(s.layout):0,c=a?Kd(a.layout):0,f=t-r.startSec,p=r.endSec-t;return f<i?Bn(l,o,Hu(f/i)):p<i?Bn(o,c,Hu(1-p/i)):o}function b3(e,t,n){return e.filter(r=>(r.startSec??Number.NEGATIVE_INFINITY)<n&&(r.endSec??Number.POSITIVE_INFINITY)>t)}function S3(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 k3(e,t,n,r=bn){const o=Uo(e,void 0,[],r),i=gr(r),s=o.captionAnchor,a=l=>{const c={y:l-wv,h:wv*2};if(c.y<i.top||c.y+c.h>1-i.bottom||S3(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 E3=.3,C3=.3,I3=.133,gm=e=>e*(2-e);function tk(e,t=E3,n=C3){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 bv=.4;function j3(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 T3(e,t){return t?e>=t.startSec-bv&&e<=t.endSec+bv:!1}function R3(e,t){return e??m3(t)}function F3(e){return e*10/64}function P3(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 $3(e,t){return e==="rtl"?`'${Ca}', ${t}`:t}function M3(e){return e==="rtl"?1.9:1.15}const _3=()=>{const[e]=ge.useState(()=>X2(`load ${Ca}`));return ge.useEffect(()=>{let t=!1;const n=()=>{t||(t=!0,q2(e))};return new FontFace(Ca,`url("${Va(KS)}") 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:h}=ht(),g=gr({width:p,height:h}),w=e.start+c/f,x=fm(e.words.map(k=>k.text).join(" "));return u.jsx(Fn,{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:$3(x,i),fontWeight:900,fontSize:r,lineHeight:M3(x),textAlign:"center",color:s,WebkitTextStroke:`${F3(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,m)=>{const v=Math.max(k.end,k.start+.12),y=w>=k.start&&w<=v,S=y?Math.min(1,(w-k.start)/I3):0,b=gm(S);return u.jsx("span",{"data-caption-word":t+m,"data-caption-text":k.text,"data-caption-src":Xe(k)===null?void 0:k.srcStart,style:{display:"inline-block",pointerEvents:"auto",transform:b>0?`scale(${1+.08*b})`:"scale(1)",color:y?o:s},children:j3(k.text,T3(k.start,l)?a:void 0)},m)})})})},N3=({lines:e,cues:t=[],verticalAnchor:n=.76,fontSizePx:r,activeColor:o="#FFE14D",theme:i,ctaKeyword:s,ctaWindow:a,sourceTextRegions:l=[]})=>{const{fps:c,width:f,height:p}=ht(),h={width:f,height:p},g=R3(r,h),{fontFamily:w,color:x}=P3(i),k=[];let m=0;for(const v of e)k.push(m),m+=v.words.length;return u.jsxs(Fn,{children:[B4(e)?u.jsx(_3,{}):null,e.map((v,y)=>{const S=t.length>0?po(t,v.start):null,b=(S==null?void 0:S.captionY)!==void 0?S.captionY:t.length>0||l.length>0?k3((S==null?void 0:S.layout)??"full-bleed",b3(l,v.start,v.end),S==null?void 0:S.graphicRect,h):n,{from:E,durationInFrames:C}=Ac(v.start,v.end,c);return u.jsx(Ft,{from:E,durationInFrames:C,children:u.jsx(A3,{line:v,wordOffset:k[y],verticalAnchor:b,fontSizePx:g*((S==null?void 0:S.captionScale)??1),activeColor:o,fontFamily:w,textColor:x,ctaKeyword:s,ctaWindow:a})},y)})]})};function nk(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)*Sv(r),p=-t.y*c+(n.height-l*c)*Sv(o);return{width:i*c,height:s*c,left:f,top:p}}function Sv(e){return Number.isFinite(e)?Math.min(1,Math.max(0,e)):.5}function rk(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 L3(e,t){return rk(e,{x:0,y:0,w:e.width,h:e.height},t)}function ok(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 O3(e,t,n,r,o,i){return e==="fit"?rk(t,n,r):nk(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}:O4(e,ok(t,n),r)}function z3(e,t,n){if(e.length===0)return null;const r=ok(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 B3(e,t,n,r,o,i,s,a,l){if(!o)return null;if(e&&e.length>0){const f=z3(e,n,r);if(f)return nk(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:O3(i,o,c,s,a,l)}const W3=Se({tableR:He(ae()),tableG:He(ae()),tableB:He(ae()),colorMatrix:He(ae()).length(20)});function V3(e){const t=W3.safeParse(e);return t.success?t.data:null}function H3(e){const t=[...e.tableR,...e.tableG,...e.tableB,...e.colorMatrix];let n=2166136261;for(const r of t){const o=String(r);for(let i=0;i<o.length;i++)n^=o.charCodeAt(i),n=Math.imul(n,16777619)}return`ossclip-grade-${(n>>>0).toString(16)}`}function U3(e,t){const n=[];return e&&n.push(`url(#${e})`),t>.5&&n.push(`blur(${t}px)`),n.length>0?n.join(" "):void 0}const Z3=({cues:e,theme:t,face:n,zoomPlan:r,sourceTextRegions:o,contentTimeline:i,framingTimeline:s,spans:a,sourceSize:l,contentCropMode:c="cover",sourceFit:f="cover",colorGrade:p,children:h})=>{const g=Nt(),{fps:w,width:x,height:k}=ht(),m=g/w,y=v3(e,m,n??void 0,o??[],{width:x,height:k}),S=x3(e,m),b=y.rect.w*x,E=y.rect.h*k,C=y.cornerRadius*Math.min(b,E)/2,j=po(e,m),I=j==null?void 0:j.video,P=r&&r.length>0?L4(r,m):1,L=Math.max(0,y.opacity*(1-.6*y.cornerRadius)),W=(I==null?void 0:I.autoZoom)!==!1,$=f==="contain"&&l!==void 0,A=W&&!$?1+(P-1)*L:1,U=(I==null?void 0:I.scale)??1,z=(I==null?void 0:I.dx)??0,O=(I==null?void 0:I.dy)??0,R=w3(A,U,z,O),Z=p?H3(p):null;return u.jsxs(Fn,{children:[p?u.jsx("svg",{width:0,height:0,style:{position:"absolute"},"aria-hidden":!0,children:u.jsxs("filter",{id:Z,colorInterpolationFilters:"sRGB",children:[u.jsxs("feComponentTransfer",{children:[u.jsx("feFuncR",{type:"table",tableValues:p.tableR.join(" ")}),u.jsx("feFuncG",{type:"table",tableValues:p.tableG.join(" ")}),u.jsx("feFuncB",{type:"table",tableValues:p.tableB.join(" ")})]}),u.jsx("feColorMatrix",{type:"matrix",values:p.colorMatrix.join(" ")})]})}):null,u.jsx(Fn,{style:{background:t.bg,opacity:S}}),u.jsxs("div",{"data-edit-video":j==null?void 0:j.id,style:{position:"absolute",left:`${y.rect.x*100}%`,top:`${y.rect.y*100}%`,width:b,height:E,borderRadius:C,overflow:"hidden",opacity:y.opacity,backgroundColor:$?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:U3(Z,y.blurPx),transform:R,transformOrigin:"50% 40%","--ossclip-obj-y":`${y.objectPosY*100}%`,"--ossclip-obj-x":`${y.objectPosX*100}%`},children:$?u.jsx(K3,{source:l,slot:{width:b,height:E},children:h}):u.jsx(Y3,{timeline:i,framing:s,spans:a,sourceSize:l,mode:c,tSec:m,slot:{width:b,height:E},posX:y.objectPosX,posY:y.objectPosY,children:h})}),u.jsx("div",{style:{position:"absolute",inset:0,background:"black",opacity:y.dim}})]})]})},K3=({source:e,slot:t,children:n})=>{const r=L3(e,t);return u.jsx("div",{style:{position:"absolute",width:r.width,height:r.height,left:r.left,top:r.top},children:n})},Y3=({timeline:e,framing:t,spans:n,sourceSize:r,mode:o,tSec:i,slot:s,posX:a,posY:l,children:c})=>{const f=B3(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})},ym=.94,G3=new Set(["FlowDiagram","StrikethroughReveal","ChatMock","BulletList"]),kv=2.4,$l=.45,Hc=.58,Kt=.72,X3=.62;function hi(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 tt=e=>typeof e=="string"?e:"",eo=e=>Array.isArray(e)?e:[];function q3(e,t,n,r=1/0){switch(e){case"TitleCard":{const o=n-80,i=tt(t.emphasis),s=28;let a=0,l=0;tt(t.eyebrow)&&(a+=34*1.2,l++),i&&(a+=210*.95,l++);const c=i?64:96;return a+=hi(tt(t.title).length,c,o,1.05,Kt),l++,tt(t.sub)&&(a+=hi(tt(t.sub).length,40,o,1.2,Hc),l++),a+s*Math.max(0,l-1)}case"StatCard":{const o=hi(tt(t.label).length,42,n*.55,1.15,Kt);let i=88+Math.max(o,110*1.15)+4;return tt(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+=hi(tt(t.text).length,72,o,1.02,Kt),tt(t.struck)&&(i+=26+hi(tt(t.struck).length,44,o,1.2,Kt)),i}case"StrikethroughReveal":{const o=eo(t.lines).map(a=>tt(a==null?void 0:a.text)),i=uk(o,n,r),s=o.reduce((a,l)=>a+lk(l,i,n).length,0);return s*i*1.08+i*.2*Math.max(0,s-1)}case"FlowDiagram":{const o=eo(t.nodes).map(l=>tt(l)),i=Math.max(1,o.length),{mode:s,fontSize:a}=gk(o,n,r);return s==="row"?a*ta+4:a*(ta*i+mk*(i-1))}case"TerminalMock":{const o=eo(t.windows);let i=0;for(const s of o){const a=eo(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),tt(t.fanOut)&&(i+=22+40*1.2),i}case"ChatMock":{const o=pk(t).map(s=>s.text),i=hk(o,{widthPx:n,heightPx:r});return fk(o,i,n)}case"ScreenshotFrame":{const o=n*.94;return(tt(t.src)?o*9/16:480)+4}case"BulletList":{const o=eo(t.items).map(s=>tt(s)),i=ak(o,n,r,!!tt(t.title),tt(t.title));return nN(o.length,i,!!tt(t.title))}}}const Ur=e=>tt(e).split(/\s+/).reduce((t,n)=>Math.max(t,n.length),0);function J3(e,t){switch(e){case"RuleCard":{const n=Ur(t.kicker)*30*(Kt+.28),r=Ur(t.text)*72*Kt,o=Ur(t.struck)*44*(Kt+.04),i=Math.max(n,r,o);return i>0?156+i:0}case"TitleCard":{const n=tt(t.emphasis)?64:96,r=Ur(t.eyebrow)*34*(Kt+.35),o=Ur(t.emphasis)*210*Kt,i=Ur(t.title)*n*(Kt+.02),s=Ur(t.sub)*40*Hc,a=Math.max(r,o,i,s);return a>0?80+a:0}case"TerminalMock":{let n=0;for(const r of eo(t.windows))for(const o of eo(r==null?void 0:r.lines))n=Math.max(n,tt(o).length);return n>0?108+n*27*X3:0}case"StatCard":{const n=tt(t.value).length*110*Kt;return n===0?0:164+Ur(t.label)*42*Kt+40+n}default:return 0}}const Ev=36,Q3=120,ik=1.6,sk=.88,eN=(Kt+.28)*.36,tN=1.1;function nN(e,t,n){return(Math.max(1,e)*ik+(n?sk:0))*t}function ak(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 Ev;const s=Math.min(t/(i*Kt+tN),o?t/(o.length*eN):1/0),a=n*ym/(Math.max(1,e.length)*ik+(r?sk:0));return Math.max(Ev,Math.min(Q3,Math.floor(Math.min(s,a))))}const rN=92,oN=44,iN=150,sN=[" → "," -> "," → "," > "];function lk(e,t,n){const r=o=>o.length*t*Kt<=n;if(r(e))return[e];for(const o of sN){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 uk(e,t=831,n=1/0){const r=e.reduce((s,a)=>Math.max(s,a.length),0);if(r===0)return rN;const o=t/(r*Kt),i=n/(Math.max(1,e.length)*1.28);return Math.max(oN,Math.min(iN,Math.floor(Math.min(o,i))))}const Cv=22,Iv=44,aN=96,jv=22,ck=.85,dk=.82;function fk(e,t,n){const o=(n-80)*dk-2*t*ck;let i=0;for(const s of e)i+=hi(s.length,t,o,1.2,Hc)+t*1.2+4;return i+t*.5*Math.max(0,e.length-1)}function pk(e){const t=tt(e.keyword);return t?[{from:"user",text:`"${t.toUpperCase()}"`}]:eo(e.messages).map(n=>{const r=n??{};return{from:r.from==="agent"?"agent":"user",text:tt(r.text)}})}function hk(e,t={}){const n=t.widthPx??831,r=t.heightPx??1/0,o=n-80,i=e.reduce((p,h)=>Math.max(p,h.length),0);if(i===0)return Iv;const s=e.flatMap(p=>p.split(/\s+/)).reduce((p,h)=>Math.max(p,h.length),0),a=p=>o*dk/(p*Hc+2*ck),l=Math.min(i,jv),c=i>jv?Iv:aN;let f=Math.floor(Math.min(a(l),a(s),c));for(;f>Cv&&fk(e,f,n)>r*ym;)f-=1;return Math.max(Cv,f)}const Tv=26,lN=22,uN=76,ta=2.1,mk=2.05;function gk(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/ta)),f=Math.max(...e.map(x=>x.length),1),p=ta*o+mk*(o-1),h=Math.floor(Math.min(l/(i*f+s),n/p,uN)),g=c>=Tv;return h>=lN?g?c*ta>=h*p?{mode:"row",fontSize:c}:{mode:"stack",fontSize:h}:{mode:"stack",fontSize:h}:{mode:"row",fontSize:Math.max(Tv,c)}}function cN(e,t,n){if(G3.has(e))return 1;const r=n.heightPx*ym,o=c=>q3(e,t,n.widthPx/c)*c<=r;if(!o($l))return $l;const i=J3(e,t),s=i>0?n.widthPx/i:kv;let a=$l,l=Math.max($l,Math.min(kv,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}=ht();return pp({frame:t-e,fps:n,config:{damping:200,stiffness:130},durationInFrames:Math.round(n*.5)})}function vr(e,t=26){return{opacity:e,transform:`translateY(${(1-e)*t}px)`}}function Zo(e){return{opacity:e,transform:`scale(${.9+.1*e})`}}function dN(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 Tt(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 fN=({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:{...vr(r),fontSize:34,fontWeight:700,letterSpacing:"0.35em",color:t.muted,textTransform:"uppercase",...Tt(n,"eyebrow")},children:e.eyebrow}):null,s?u.jsx("div",{"data-edit-id":"emphasis",style:{...vr(o,40),fontSize:210,fontWeight:900,lineHeight:.95,...Tt(n,"emphasis")},children:s}):null,a?null:u.jsx("div",{"data-edit-id":"title",style:{...vr(s?i:o,34),fontSize:s?64:96,fontWeight:900,lineHeight:1.05,textTransform:"uppercase",letterSpacing:"0.02em",...Tt(n,"title")},children:e.title}),e.sub?u.jsx("div",{"data-edit-id":"sub",style:{...vr(i),fontSize:40,fontWeight:600,color:t.muted,...Tt(n,"sub")},children:e.sub}):null]})},pN=({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:{...Zo(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%",...Tt(n,"label")},children:e.label}),u.jsx("div",{"data-edit-id":"value",style:{fontSize:110,fontWeight:900,whiteSpace:"nowrap",...Tt(n,"value")},children:e.value})]}),e.caption?u.jsx("div",{"data-edit-id":"caption",style:{...vr(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",...Tt(n,"caption")},children:e.caption}):null]})},hN=({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:{...Zo(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,...Tt(n,"kicker")},children:e.kicker}),u.jsx("div",{"data-edit-id":"text",style:{fontSize:72,fontWeight:900,lineHeight:1.02,textTransform:"uppercase",...Tt(n,"text")},children:e.text})]}),e.struck?u.jsx("div",{"data-edit-id":"struck",style:{...vr(o),fontSize:44,fontWeight:800,color:t.muted,textDecoration:"line-through",textDecorationThickness:6,textDecorationColor:t.danger,textTransform:"uppercase",letterSpacing:"0.04em",...Tt(n,"struck")},children:e.struck}):null]})},mN=({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:{...vr(l,30),position:"relative",display:"inline-block",...Tt(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]})},gN=({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=uk(i,n,r),a=e.lines.flatMap((l,c)=>lk(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(mN,{text:l.text,struck:l.struck,mark:l.mark,delay:c*6,fontSize:s,theme:t,editId:`line-${l.lineIndex}`,edits:o},c))})},yN=({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:{...Zo(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,...Tt(s,i)},children:e})},vN=({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 wN(e,t=xN,n){return gk(e,t,n)}const xN=864,bN=({props:e,theme:t,widthPx:n,heightPx:r,edits:o})=>{const{mode:i,fontSize:s}=wN(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(vN,{delay:c*6+3,fontSize:s,theme:t,down:!a}):null,u.jsx(yN,{text:l,emphasized:e.emphasizeLast&&c===e.nodes.length-1,delay:c*6,fontSize:s,theme:t,editId:`node-${c}`,edits:o})]},c))})},SN=({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:{...Zo(s),background:r.cardBg,border:`2px solid ${r.cardBorder}`,borderRadius:r.radiusPx/2,overflow:"hidden",width:"100%",fontFamily:r.fontMono,...Tt(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))})]})},kN=({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(SN,{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:{...vr(r),fontFamily:t.fontDisplay,fontSize:40,fontWeight:900,letterSpacing:"0.2em",color:t.fg,textTransform:"uppercase",...Tt(n,"fanOut")},children:["⌄ ",e.fanOut]}):null]})},EN=({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:{...Zo(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,...Tt(s,i)},children:t})},CN=({props:e,theme:t,widthPx:n,heightPx:r,edits:o})=>{const i=pk(e),s=hk(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(EN,{from:a.from,text:a.text,delay:l*8,fontSize:s,theme:t,editId:`message-${l}`,edits:o},l))})},IN=({props:e,theme:t,edits:n})=>{const r=At(0),o=At(8),i=Nt(),{fps:s}=ht(),a=e.kenBurns?os(i,[0,s*8],[1,1.08],{extrapolateRight:"clamp"}):1,l=e.src?/^https?:\/\//.test(e.src)?e.src:Va(e.src):null;return u.jsxs("div",{"data-edit-id":"src",style:{...Zo(r),position:"relative",width:"94%",...Tt(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($c,{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:{...Zo(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",...Tt(n,"label")},children:e.label}):null]})},jN=({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:{...vr(s,26),display:"flex",alignItems:"baseline",gap:n*.35,...Tt(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})]})},TN=({props:e,theme:t,widthPx:n,heightPx:r,edits:o})=>{const i=ak(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:{...vr(s,20),fontSize:i*.36,fontWeight:700,letterSpacing:"0.28em",textTransform:"uppercase",color:t.muted,...Tt(o,"title")},children:e.title}):null,e.items.map((a,l)=>u.jsx(jN,{text:a,index:l,fontSize:i,theme:t,edits:o},l))]})},RN={TitleCard:fN,StatCard:pN,RuleCard:hN,StrikethroughReveal:gN,FlowDiagram:bN,TerminalMock:kN,ChatMock:CN,ScreenshotFrame:IN,BulletList:TN},FN=new Set(["lower-third","full-bleed"]),PN=.55,$N=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}, ${PN})`},MN=e=>({width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",opacity:e,transform:e<1?`translateY(${(1-e)*18}px)`:void 0}),_N=({durationInFrames:e,children:t})=>{const n=Nt(),{fps:r}=ht(),{exitSec:o}=tk(e/r),i=(e-n)/r,s=o<=0?1:Math.min(1,Math.max(0,i/o));return u.jsx("div",{style:MN(gm(s)),children:t})},AN=({durationInFrames:e,themeBg:t,radiusPx:n})=>{const r=Nt(),{fps:o}=ht(),{enterSec:i}=tk(e/o),s=i<=0?1:Math.min(1,Math.max(0,r/o/i)),a=gm(s);return u.jsx("div",{style:{position:"absolute",inset:0,background:$N(t),backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)",borderRadius:n,opacity:a,transform:a<1?`translateY(${(1-a)*18}px)`:void 0}})},NN=({cues:e,theme:t})=>{const{fps:n,width:r,height:o}=ht();return u.jsx(Fn,{style:{pointerEvents:"none"},children:e.map(i=>{if(i.kind==="plain"||!i.component||!i.props)return null;const s=JS(i,{width:r,height:o}),a=RN[i.component],{from:l,durationInFrames:c}=Ac(i.startSec,i.endSec,n),f=s.w*r,p=s.h*o,h=FN.has(i.layout),g=h?Math.min(24,Math.round(p*.12)):0,w=f-g*2,x=p-g*2,k=cN(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(_N,{durationInFrames:c,children:[h?u.jsx(AN,{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:dN(i.elements,k)})})]})})},i.id)})})},LN="made with ossclip",ON=.45,DN=.024;function zN(e=bn){const t=gr(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)*DN),opacity:ON,text:LN}}function BN(e){return e===!0}const WN=({theme:e,frame:t})=>{const n=zN(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})},VN=4;function HN(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 UN(e,t){return Ac(0,e,t)}function ZN(e,t){const n=Math.min(VN,t),r=t-e;return r>=n?1:Math.min(1,Math.max(0,r/n))}const KN=({cover:e,durationInFrames:t})=>{const n=Nt();return u.jsx(Fn,{style:{backgroundColor:"black",opacity:ZN(n,t)},children:u.jsx($c,{src:/^https?:\/\//.test(e.fileName)?e.fileName:Va(e.fileName),style:{width:"100%",height:"100%",objectFit:"cover"}})})},YN=({cover:e})=>{const{fps:t}=ht(),{from:n,durationInFrames:r}=UN(e.durationSec,t);return u.jsx(Ft,{from:n,durationInFrames:r,layout:"none",children:u.jsx(Fn,{style:{pointerEvents:"none"},children:u.jsx(KN,{cover:e,durationInFrames:r})})})},GN=1;function XN(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(GN,Math.max(0,r.gain??1))})}return t}function qN(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 JN=({cues:e})=>{const{fps:t,durationInFrames:n}=ht();return u.jsx(u.Fragment,{children:qN(e,t,n).map((r,o)=>u.jsx(Ft,{from:r.from,layout:"none",children:u.jsx(ST,{src:/^https?:\/\//.test(r.soundFile)?r.soundFile:Va(r.soundFile),volume:r.gain})},`${r.from}-${o}`))})};function QN(e){return e!==!0}const e5=({videoFileName:e,spans:t,captionLines:n,sceneCues:r,theme:o,settings:i,face:s,zoomPlan:a,ctaKeyword:l,ctaWindow:c,sourceTextRegions:f,contentTimeline:p,framingTimeline:h,sourceSize:g,contentCropMode:w,sourceFit:x,watermark:k,captionsHidden:m,staticCamera:v,punch:y,coverInVideo:S,sfxCues:b,colorGrade:E})=>{if(!e)return u.jsx(Fn,{style:{backgroundColor:"#111",color:"#888",alignItems:"center",justifyContent:"center",fontFamily:"monospace",fontSize:40},children:"no production loaded"});const C=/^https?:\/\//.test(e)?e:Va(e),j=x==="contain"||v===!0?null:NP(y),I=HN(S),P=XN(b),L=V3(E),W=r.flatMap($=>{var A;return((A=$.video)==null?void 0:A.volume)!==void 0&&$.video.volume!==1?[{startSec:$.startSec,endSec:$.endSec,gain:$.video.volume}]:[]});return u.jsxs(Fn,{style:{backgroundColor:"black"},children:[u.jsx(Z3,{cues:r,theme:o,face:s,zoomPlan:a,sourceTextRegions:f,contentTimeline:p,framingTimeline:h,spans:t,sourceSize:g,contentCropMode:w,sourceFit:x,colorGrade:L,children:u.jsx(DP,{src:C,spans:t,...W.length>0?{gain:W}:{},...j?{punch:j}:{},...x==="contain"?{punchInScale:1,background:"transparent"}:{},...v===!0?{punchInScale:1}:{}})}),u.jsx(NN,{cues:r,theme:o}),P.length>0?u.jsx(JN,{cues:P}):null,QN(m)?u.jsx(N3,{lines:n,cues:r,activeColor:o.accent,theme:o,ctaKeyword:l,ctaWindow:c,sourceTextRegions:f}):null,BN(k)?u.jsx(WN,{theme:o,frame:{width:i.width,height:i.height}}):null,I?u.jsx(YN,{cover:I}):null]})},t5=600,n5=()=>({doc:g4(),past:[],future:[],dirty:!1,savedAt:0,lastCoalesce:null}),hr=(e,t)=>e.scenes[t]??{props:{},elements:{}},ai=e=>e.sfx??{edits:{},added:[]},li=(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 r5(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 o5(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<t5;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=hr(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(mv(e.doc,t.sceneId,t.elementId,t.patch),t.coalesce);case"clearElement":return n(T4(e.doc,t.sceneId,t.elementId));case"hideElement":return n(mv(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(R4(e.doc,t.sceneId,t.elementId)):e}case"patchTiming":{const o=hr(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,timing:t.timing}}})}case"clearTiming":return n(F4(e.doc,t.sceneId));case"patchVideo":{const o=hr(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=hr(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=hr(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,captionY:t.y}}},t.coalesce)}case"patchCaptionScale":{const o=hr(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:d4(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"setColorGrade":{if(t.value===void 0){if(e.doc.colorGrade===void 0)return e;const{colorGrade:o,...i}=e.doc;return n(i)}return JSON.stringify(t.value)===JSON.stringify(e.doc.colorGrade)?e:n({...e.doc,colorGrade:t.value},t.coalesce)}case"hideScene":{const o=hr(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=hr(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,component:t.component}}})}case"patchLayout":{const{graphicRect:o,...i}=hr(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...i,layout:t.layout}}})}case"patchGraphicRect":{const o=hr(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,graphicRect:t.rect}}},t.coalesce)}case"clearGraphicRect":return n(P4(e.doc,t.sceneId));case"patchCaption":{const o=Cn(t.srcStart),i=dv(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=Cn(t.fromSrcStart),i=Cn(t.toSrcStart),s=t.text.trim();if(!s)return e;const a=fv(e.doc.captionRangeEdits,o,i,t.was);if(s===a){const k=e.doc.captionRangeEdits.filter(m=>m.fromKey!==o||m.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(Ea(k))return!1;const m=Number(k.slice(1));return m>=l&&m<=c},p=Object.fromEntries(Object.entries(e.doc.captions).filter(([k])=>!f(k))),h=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 m=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||m>c}),{fromKey:o,toKey:i,text:s,was:a}];return n({...e.doc,captions:p,captionWordsHidden:h,captionLineTiming:g,captionLineWindows:w,captionRangeEdits:x})}case"patchCaptionAllOccurrences":{let o=e.doc.captions,i=!1;for(const s of t.entries){const a=Cn(s.srcStart),l=dv(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=Cn(a.fromSrcStart),c=Cn(a.toSrcStart),f=fv(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)),h=Math.max(Math.round(a.fromSrcStart*1e3),Math.round(a.toSrcStart*1e3)),g=w=>{if(Ea(w))return!1;const x=Number(w.slice(1));return x>=p&&x<=h};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>h}),{fromKey:l,toKey:c,text:o,was:f}]},s=!0}return s?n(i):e}case"patchCaptionLineTiming":{let o=e.doc.captionLineTiming,i=!1;for(const s of t.entries){const a=Cn(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=Cn(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=Cn(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=Cn(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=Cn(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}=n3(e.doc,t.mapping);for(const s of i)console.warn(`caption re-key: ${s}`);return n(o)}case"patchSfx":{const o=ai(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(li(e.doc,{...o,edits:l}),t.coalesce)}case"muteSfx":{const o=ai(e.doc),i=o.edits[t.key];return(i==null?void 0:i.muted)===!0?e:n(li(e.doc,{...o,edits:{...o.edits,[t.key]:{...i,muted:!0}}}))}case"restoreSfx":{const o=ai(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(li(e.doc,{...o,edits:l}))}case"addSfx":{const o=ai(e.doc);return n(li(e.doc,{...o,added:[...o.added,{id:r5(t.soundId,t.word,o.added),soundId:t.soundId,word:t.word,...t.gain!==void 0?{gain:t.gain}:{}}]}))}case"patchSfxAdded":{const o=ai(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(li(e.doc,{...o,added:l}),t.coalesce)}case"removeSfxAdded":{const o=ai(e.doc),i=o.added.filter(s=>s.id!==t.id);return i.length===o.added.length?e:n(li(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 i5(){const[e,t]=d.useReducer(o5,void 0,n5),n=d.useRef([]),r=async()=>{const o=b4(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}),setColorGrade:(o,i)=>t({type:"setColorGrade",value:o,coalesce:i}),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 s5(e){const t=e.spans;if(t===void 0)return{};let n;try{n=ro(t).spans.length}catch{return{}}if(n===0)return{};const r={};return e.captionLines&&(r.captionLines=gv(e.captionLines,t)),e.baseCaptionLines&&(r.baseCaptionLines=gv(e.baseCaptionLines,t)),r}function Rv(e,t){const n=t.baseCaptionLines??t.captionLines??[],r=E4(e.captions,n);return{doc:{...e,captions:C4(e.captions,r)},unresolved:r.unresolved}}function yk(e){const t={};for(const[n,r]of Object.entries(e))Ea(n)||(t[n]=r);return t}function a5(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 l5(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 vk(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 u5(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 c5(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 d5(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 Yd(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 f5(e){if(e===void 0||e.trim()==="")return null;const t=Number(e);return Xe({srcStart:t})===null?null:t}function p5(e,t,n){if(Object.keys(t).length===0)return{lines:[...e],dropped:[]};let r=null;try{r=n.length>0?ro(n):null}catch{r=null}return r===null?{lines:[...e],dropped:Object.keys(t).map(o=>({key:o,expected:"",found:null}))}:HS(e,t,r)}function h5(e,t,n,r){const o=U4(e,t,{breakpoints:r.breakpoints,...H4(r.landscape)}),i=DS(o,yk(n.captions)).lines,s=zS(i,n.captionRangeEdits).lines,a=BS(s,n.captionWordsHidden).lines,l=VS(a,n.captionLineTiming),c=HS(l.lines,n.captionLineWindows,t);return{baseLines:o,liveLines:s,timingLines:a,lines:c.lines,dropped:[...l.dropped,...c.dropped]}}function wk(e){return`/api/sfx/audio?id=${encodeURIComponent(e)}`}function m5(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 xk(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 g5(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=f4(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,h=p===void 0?void 0:r.get(p),g=h??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,...h!==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 Fv(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 Pv(e){const t=e==null?void 0:e.closest("[data-edit-video]");return(t==null?void 0:t.dataset.editVideo)||null}function $v(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 Mv=.015,y5=1e-9;function ui(e,t){let n=null,r=1/0;for(const o of e){const i=Math.abs(o.feature-o.target);i<=t+y5&&i<r&&(n=o,r=i)}return n}function _v(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=ui([...c?[{target:.5,feature:s}]:[],{target:n.left,feature:e.x},{target:1-n.right,feature:a}],r);f&&(o.x=e.x+(f.target-f.feature),i.push({axis:"x",at:f.target}));const p=e.y+e.h/2,h=e.y+e.h,g=.5-e.h/2,w=g>=n.top&&g+e.h<=1-n.bottom,x=ui([...w?[{target:.5,feature:p}]:[],{target:n.top,feature:e.y},{target:1-n.bottom,feature:h}],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=ui([{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=ui([{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=ui([{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=ui([{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 v5(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=US(e.id);return{sceneId:e.id,rootId:o,isSplitHalf:o!==e.id,startSec:e.startSec,endSec:e.endSec,targets:n}}function Av(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 Nv=64,Ml=9,_l=e=>Math.round(e*10)/10,ci=e=>Math.round(e*1e4)/1e4,bk={position:"absolute",width:10,height:10,background:"#5b8cff",border:"1px solid #0B0B0E",borderRadius:2,pointerEvents:"auto",zIndex:6},Lv={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"}},w5={...bk,background:"#ffe14d"},x5={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}},b5={position:"absolute",cursor:"move",pointerEvents:"auto",zIndex:5},Sk=/^(line|node|message|window|item)-(\d+)$/;function S5(e,t,n){const r=Sk.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 k5(e,t){const n=Sk.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 kk(){const e=document.activeElement;(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&e.blur()}const E5=({stageRef:e,selection:t,onSelect:n,edits:r,onSave:o,settings:i,playerRef:s,onTransport:a,onVideoPreview:l,onGraphicPreview:c,cue:f,cues:p,onToggleHelp:h,onRequestDelete:g,fromLive:w=v=>v,hasOldClockPreimage:x=()=>!0,toSourceSec:k=null,onClockRefused:m=()=>{}})=>{const[v,y]=d.useState(null),S=d.useRef(null),b=d.useRef(0),E=d.useRef(null),C=d.useRef(0),j=d.useRef(null),I=d.useRef(0),P=d.useRef(null),[L,W]=d.useState(!1),[$,A]=d.useState([]),U=d.useRef(null),[z,O]=d.useState(null),[R,Z]=d.useState(null),B=d.useRef(null),[ie,ue]=d.useState({dx:0,dy:0}),me=d.useRef(null),re=d.useRef(t),ee=d.useCallback(q=>{re.current=q,n(q)},[n]);d.useEffect(()=>{re.current=t},[t]);const K=(q,X)=>{const N=[];let G=null;for(let T=0;T<25;T++){const M=document.elementFromPoint(q,X);if(!M||M===document.documentElement||M===document.body){G=M;break}if(G=M,M.hasAttribute("data-edit-id")||M.hasAttribute("data-edit-scene")||M.hasAttribute("data-caption-word")||M.closest("[data-edit-video]")!==null||["BUTTON","INPUT","SELECT","TEXTAREA"].includes(M.tagName)||!(M instanceof HTMLElement))break;N.push({el:M,prev:M.style.pointerEvents}),M.style.pointerEvents="none"}return N.forEach(({el:T,prev:M})=>{T.style.pointerEvents=M}),G},ce=d.useCallback(()=>{var M,Q;const q=e.current,X=(M=s.current)==null?void 0:M.getScale(),N=((Q=q==null?void 0:q.querySelector(".__remotion-player"))==null?void 0:Q.getBoundingClientRect())??(q==null?void 0:q.getBoundingClientRect());if(!N||!X||X<=0)return null;const G=i.width*X,T=i.height*X;return{left:N.left+(N.width-G)/2,top:N.top+(N.height-T)/2,w:G,h:T}},[e,s,i]);return d.useEffect(()=>{if(!t){y(null);return}let q;const X=()=>{var G;const N=e.current;if(N){const T=t.elementId?$v(N,t.sceneId,t.elementId):((G=N.querySelector(`[data-edit-scene="${t.sceneId}"]`))==null?void 0:G.getBoundingClientRect())??null;y(T)}q=requestAnimationFrame(X)};return q=requestAnimationFrame(X),()=>cancelAnimationFrame(q)},[e,t]),d.useEffect(()=>{const q=X=>{var T,M;const N=e.current;if(!N||!N.contains(X.target)||X.altKey||X.button!==0)return;(((T=re.current)==null?void 0:T.elementId)&&((M=me.current)==null?void 0:M.contains(X.target))||Fv(K(X.clientX,X.clientY))!==null)&&X.stopPropagation()};return window.addEventListener("pointerdown",q,!0),()=>window.removeEventListener("pointerdown",q,!0)},[e]),d.useEffect(()=>{const q=X=>{var _,Y,fe,we,Ee,Te,ze;const N=e.current;if(!N||!N.contains(X.target))return;const G=document.activeElement;if((G instanceof HTMLInputElement||G instanceof HTMLTextAreaElement)&&G.contains(X.target)||(kk(),X.altKey||X.button!==0))return;const T=X.target instanceof Element?X.target.closest("[data-el-handle]"):null,M=re.current;if(T&&(M!=null&&M.elementId)){const be=$v(N,M.sceneId,M.elementId);if(be){const de=be.left+be.width/2,he=be.top+be.height/2,Ae=Math.hypot(X.clientX-de,X.clientY-he);if(Ae>2){const Fe=((Y=(_=r.doc.scenes[M.sceneId])==null?void 0:_.elements[M.elementId])==null?void 0:Y.scale)??1;U.current={sceneId:M.sceneId,elementId:M.elementId,cx:de,cy:he,startDist:Ae,prior:Fe,factor:1},O(1)}}return}if((fe=re.current)!=null&&fe.elementId&&((we=me.current)!=null&&we.contains(X.target))){B.current={x:X.clientX,y:X.clientY,dx:0,dy:0},ue({dx:0,dy:0});return}const Q=X.target instanceof Element?X.target.closest("[data-box-handle]"):null,ne=re.current;if(Q&&ne&&!ne.elementId){const be=N.querySelector(`[data-edit-scene="${ne.sceneId}"]`),de=ce();if(be&&de){const he=be.getBoundingClientRect();P.current=null,j.current={sceneId:ne.sceneId,handle:Q.dataset.boxHandle,x:X.clientX,y:X.clientY,dx:0,dy:0,start:{x:(he.left-de.left)/de.w,y:(he.top-de.top)/de.h,w:he.width/de.w,h:he.height/de.h}},W(!0)}return}const V=K(X.clientX,X.clientY),se=Fv(V);if(!se){const be=V==null?void 0:V.closest("[data-edit-scene]");if(be){ee({sceneId:be.dataset.editScene,elementId:null});return}const de=Pv(V),he=N.getBoundingClientRect().bottom;if(de&&X.clientY<he-Nv){ee({sceneId:de,elementId:null});const Ae=p.find(Je=>Je.id===de);if((Ae==null?void 0:Ae.layout)==="pip-bubble"&&!X.altKey){const Je=Uo("pip-bubble",void 0,[],i).video.rect;E.current={sceneId:de,x:X.clientX,y:X.clientY,base:{x:((Ee=Ae.pip)==null?void 0:Ee.x)??Je.x,y:((Te=Ae.pip)==null?void 0:Te.y)??Je.y},slot:{w:Je.w,h:Je.h}};return}const Fe=(ze=r.doc.scenes[de])==null?void 0:ze.video;S.current={sceneId:de,x:X.clientX,y:X.clientY,dx:0,dy:0,baseDx:(Fe==null?void 0:Fe.dx)??0,baseDy:(Fe==null?void 0:Fe.dy)??0};return}ee(null);return}ee({sceneId:se.sceneId,elementId:se.elementId}),B.current={x:X.clientX,y:X.clientY,dx:0,dy:0},ue({dx:0,dy:0})};return window.addEventListener("mousedown",q),()=>window.removeEventListener("mousedown",q)},[e,ee,r,ce,p,i]),d.useEffect(()=>{const q=()=>{var M,Q;const G=(M=s.current)==null?void 0:M.getScale(),T=(Q=e.current)==null?void 0:Q.getBoundingClientRect();return G&&G>0?1/G:T&&T.width>0?i.width/T.width:1},X=G=>{const T=e.current;if(T&&!(j.current||U.current))if(E.current)T.style.cursor="move";else if(S.current)T.style.cursor="grabbing";else{const _=G.target instanceof Element?G.target:null,Y=_!==null&&T.contains(_)&&!_.closest("button, input, select, textarea, [data-edit-id], [data-edit-scene], [data-caption-word]")&&G.clientY<T.getBoundingClientRect().bottom-Nv,fe=Y&&(()=>{var Ee;const we=Pv(_);return we!==null&&((Ee=p.find(Te=>Te.id===we))==null?void 0:Ee.layout)==="pip-bubble"})();T.style.cursor=Y?fe?"move":"grab":""}const M=U.current;if(M){const Y=Math.hypot(G.clientX-M.cx,G.clientY-M.cy)/M.startDist;M.factor=Math.min(4/M.prior,Math.max(.05/M.prior,Y)),O(M.factor);return}const Q=j.current;if(Q){Q.dx=G.clientX-Q.x,Q.dy=G.clientY-Q.y,P.current=G.altKey,I.current||(I.current=requestAnimationFrame(()=>{I.current=0;const _=j.current,Y=ce();if(!_||!Y)return;const fe=Vu(Av(_.start,_.handle,_.dx/Y.w,_.dy/Y.h),i);if(G.altKey)A([]),c({sceneId:_.sceneId,rect:fe});else{const we=_v(fe,_.handle,gr(i),Mv);A(we.guides),c({sceneId:_.sceneId,rect:we.rect})}}));return}if(E.current){C.current||(C.current=requestAnimationFrame(()=>{C.current=0;const _=E.current,Y=ce();if(!_||!Y)return;const fe=(G.clientX-_.x)/Y.w,we=(G.clientY-_.y)/Y.h;r.patchPip(_.sceneId,{x:ci(Math.min(Math.max(_.base.x+fe,0),1-_.slot.w)),y:ci(Math.min(Math.max(_.base.y+we,0),1-_.slot.h))},`pip:${_.sceneId}:drag`)}));return}const V=S.current;if(V){V.dx=G.clientX-V.x,V.dy=G.clientY-V.y,b.current||(b.current=requestAnimationFrame(()=>{b.current=0;const _=S.current;if(!_)return;const Y=q();l({sceneId:_.sceneId,patch:{dx:_.baseDx+_.dx*Y,dy:_.baseDy+_.dy*Y}})}));return}const se=B.current;se&&(se.dx=G.clientX-se.x,se.dy=G.clientY-se.y,ue({dx:se.dx,dy:se.dy}))},N=G=>{const T=U.current;if(T){U.current=null,O(null),Math.abs(T.factor-1)>.001&&r.patchElement(T.sceneId,T.elementId,{scale:Math.round(T.prior*T.factor*1e3)/1e3});return}const M=j.current;if(M){if(j.current=null,W(!1),A([]),I.current&&(cancelAnimationFrame(I.current),I.current=0),M.dx!==0||M.dy!==0){const _=ce();if(_){let Y=Vu(Av(M.start,M.handle,M.dx/_.w,M.dy/_.h),i);(P.current??G.altKey)||(Y=_v(Y,M.handle,gr(i),Mv).rect),r.patchGraphicRect(M.sceneId,{x:ci(Y.x),y:ci(Y.y),w:ci(Y.w),h:ci(Y.h)})}}P.current=null,c(null);return}if(E.current){E.current=null,C.current&&(cancelAnimationFrame(C.current),C.current=0);return}const ne=S.current;if(ne){if(S.current=null,b.current&&(cancelAnimationFrame(b.current),b.current=0),ne.dx!==0||ne.dy!==0){const _=q();r.patchVideo(ne.sceneId,{dx:_l(ne.baseDx+ne.dx*_),dy:_l(ne.baseDy+ne.dy*_)})}l(null);return}const V=B.current,se=re.current;if(!V||!(se!=null&&se.elementId)){B.current=null;return}if(V.dx!==0||V.dy!==0){const _=q(),Y=r.doc.scenes[se.sceneId],fe=Y==null?void 0:Y.elements[se.elementId];r.patchElement(se.sceneId,se.elementId,{dx:_l(((fe==null?void 0:fe.dx)??0)+V.dx*_),dy:_l(((fe==null?void 0:fe.dy)??0)+V.dy*_)})}B.current=null,ue({dx:0,dy:0})};return window.addEventListener("mousemove",X),window.addEventListener("mouseup",N),()=>{window.removeEventListener("mousemove",X),window.removeEventListener("mouseup",N)}},[r,e,i,s,l,c,ce,p]),d.useEffect(()=>{const q=X=>{var Q;const N=e.current;if(!N||!N.contains(X.target))return;const G=(Q=K(X.clientX,X.clientY))==null?void 0:Q.closest("[data-caption-word]");if(!G)return;X.preventDefault();const T=f5(G.dataset.captionSrc),M=G.dataset.captionText??"";T===null||!M||Z({srcStart:T,was:M,draft:M,rect:G.getBoundingClientRect()})};return window.addEventListener("dblclick",q),()=>window.removeEventListener("dblclick",q)},[e]),d.useEffect(()=>{const q=()=>{const T=document.activeElement;return T instanceof HTMLInputElement||T instanceof HTMLTextAreaElement||T instanceof HTMLSelectElement||T instanceof HTMLElement&&T.isContentEditable},X=()=>{const T=document.activeElement;return T instanceof HTMLTextAreaElement||T instanceof HTMLElement&&T.isContentEditable?!0:T instanceof HTMLInputElement&&!["range","checkbox","radio","button"].includes(T.type)},N=()=>{const T=document.activeElement;T instanceof HTMLElement&&!X()&&T.blur()},G=T=>{var Q,ne,V;if(R!==null)return;const M=T.metaKey||T.ctrlKey;if(T.key==="Escape"){if(q()){(Q=document.activeElement)==null||Q.blur();return}ee(null)}else if(M&&T.key.toLowerCase()==="z")T.preventDefault(),T.shiftKey?r.redo():r.undo();else if(M&&T.key.toLowerCase()==="y")T.preventDefault(),r.redo();else if(M&&T.key.toLowerCase()==="s")T.preventDefault(),o();else if(T.key===" "&&!M){if(X())return;const se=document.activeElement;if(se instanceof HTMLElement&&se.tagName==="BUTTON"&&((ne=e.current)!=null&&ne.contains(se)))return;N(),T.preventDefault(),(V=s.current)==null||V.toggle()}else if(!M&&["j","k","l"].includes(T.key.toLowerCase())){if(X())return;N(),T.preventDefault(),a(T.key.toUpperCase())}else if(!M&&!T.altKey&&(T.key==="ArrowLeft"||T.key==="ArrowRight")){if(q())return;T.preventDefault();const se=s.current;if(!se)return;se.seekTo(Math.max(0,se.getCurrentFrame()+(T.key==="ArrowRight"?1:-1)))}else if(M&&T.key.toLowerCase()==="b"){{const Ee=document.activeElement;if(Ee instanceof HTMLTextAreaElement||Ee instanceof HTMLElement&&Ee.isContentEditable)return;Ee instanceof HTMLElement&&Ee.blur()}T.preventDefault();const se=s.current;if(!se)return;const _=se.getCurrentFrame()/i.fps;if(!p.find(Ee=>_>=Ee.startSec+Yi&&_<=Ee.endSec-Yi))return;const fe=k===null?void 0:Math.round(k(_)*1e3)/1e3,we=x(_)?Math.round(w(_)*1e3)/1e3:void 0;if(we===void 0&&fe===void 0){m("Can't split here: this moment isn't anchorable yet — render once and try again.");return}r.addSplit({at:we,src:fe})}else if(!M&&T.altKey&&(T.key==="ArrowLeft"||T.key==="ArrowRight")){if(X())return;const se=re.current,_=se?(()=>{const Y=p.findIndex(fe=>fe.id===se.sceneId);return Y===-1?void 0:p[Y+(T.key==="ArrowRight"?1:-1)]})():p[T.key==="ArrowRight"?0:p.length-1];if(!_)return;T.preventDefault(),ee({sceneId:_.id,elementId:null})}else if(M&&(T.key==="ArrowLeft"||T.key==="ArrowRight")){if(X())return;T.preventDefault();const se=s.current;if(!se)return;const _=se.getCurrentFrame()/i.fps,Y=p.findIndex(we=>_>=we.startSec&&_<we.endSec),fe=p[(Y===-1?0:Y)+(T.key==="ArrowRight"?1:-1)];if(!fe)return;se.seekTo(Math.round(fe.startSec*i.fps)),ee({sceneId:fe.id,elementId:null})}else if(!M&&!T.altKey&&T.key==="?"){if(q())return;T.preventDefault(),h()}else if(!M&&(T.key==="Delete"||T.key==="Backspace")){if(q())return;const se=re.current;if(!se||se.elementId!==null||!f||f.id!==se.sceneId)return;const _=v5(f,r.doc);if(!_)return;T.preventDefault(),g(_)}};return window.addEventListener("keydown",G),()=>window.removeEventListener("keydown",G)},[ee,r,R,o,s,e,a,f,p,i,h,g,w,x,k,m]),u.jsxs("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:[ie.dx!==0||ie.dy!==0||L?u.jsx("div",{"data-testid":"safe-area-guide",style:{position:"absolute",left:`${gr(i).left*100}%`,top:`${gr(i).top*100}%`,right:`${gr(i).right*100}%`,bottom:`${gr(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,$.map(q=>u.jsx("div",{"data-testid":`guide-${q.axis}`,style:{position:"absolute",pointerEvents:"none",background:"#FFE14D",...q.axis==="x"?{left:`${q.at*100}%`,top:0,bottom:0,width:1}:{top:`${q.at*100}%`,left:0,right:0,height:1}}},q.axis)),v&&t?u.jsxs("div",{ref:me,"data-testid":"overlay-box",style:{position:"fixed",pointerEvents:"auto",left:v.left+ie.dx-Ml/2+v.width*(1-(z??1))/2,top:v.top+ie.dy-Ml/2+v.height*(1-(z??1))/2,width:v.width*(z??1)+Ml,height:v.height*(z??1)+Ml,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(q=>u.jsx("div",{"data-el-handle":q,"data-testid":`el-handle-${q}`,style:{...w5,...Lv[q]}},q)):null,!t.elementId&&f&&f.kind!=="plain"?u.jsxs(u.Fragment,{children:[["top","bottom","left","right"].map(q=>u.jsx("div",{"data-box-handle":"move","data-testid":q==="top"?"box-handle-move":`box-handle-move-${q}`,style:{...b5,...x5[q]}},q)),["nw","n","ne","e","se","s","sw","w"].map(q=>u.jsx("div",{"data-box-handle":q,"data-testid":`box-handle-${q}`,style:{...bk,...Lv[q]}},q))]}):null]}):null,R?u.jsx("input",{autoFocus:!0,"data-testid":"caption-edit",value:R.draft,onChange:q=>Z({...R,draft:q.target.value}),onBlur:()=>{const q=R.draft.trim();q&&r.patchCaption(R.srcStart,q,R.was),Z(null)},onKeyDown:q=>{q.key==="Enter"&&q.target.blur(),q.key==="Escape"&&Z(null)},style:{position:"fixed",pointerEvents:"auto",left:R.rect.left-4,top:R.rect.top-4,width:Math.max(R.rect.width+40,90),height:R.rect.height+8,fontSize:Math.max(13,Math.min(R.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]})},iu={items:[],issues:[],configGrade:null},C5=Object.keys(um);function I5(e,t){return e===!1?"off":e===void 0?t!==null?"default":"off":e.lut!==void 0?`lut:${e.lut}`:`preset:${e.preset??""}`}function j5(e,t){if(e==="default")return;if(e==="off")return!1;const n=t!==!1&&t!==void 0?{...t.intensity!==void 0?{intensity:t.intensity}:{},...t.exposure!==void 0?{exposure:t.exposure}:{},...t.temperature!==void 0?{temperature:t.temperature}:{},...t.saturation!==void 0?{saturation:t.saturation}:{},...t.contrast!==void 0?{contrast:t.contrast}:{}}:{};return e.startsWith("lut:")?{lut:e.slice(4),...n}:{preset:e.slice(7),...n}}function T5(e,t){return e===!1?null:e!==void 0?e:t}function R5(e){var n;const t=e.preset!==void 0?((n=um[e.preset])==null?void 0:n.defaultIntensity)??1:1;return{intensity:e.intensity??t,exposure:e.exposure??0,temperature:e.temperature??0,saturation:e.saturation??1,contrast:e.contrast??1}}function F5(e){return e.lut!==void 0?`LUT ${e.lut}`:e.preset??"grade"}function P5(e,t){if(e===!1)return;if(e===void 0)return t;if(e.lut!==void 0)return;const n=qA(e);return n.kind==="preset"?XA(n):void 0}const Ot={display:"flex",flexDirection:"column",gap:6},As={display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},Oe={fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"#9A9AA3"},Tr={fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",fontSize:13,background:"#0F0F14",border:"1px solid #2A2A33",borderRadius:6,color:"#fff",padding:"6px 8px",width:"100%"},Tp={...Tr,fontFamily:"'Inter', system-ui, sans-serif"},Ve={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)},$5=e=>String(Math.round(e*1e3)/1e3),Ov=e=>Math.round(e*1e3)/1e3,Ek=e=>{var t;try{(t=new Audio(wk(e)).play())==null||t.catch(()=>{})}catch{}},Ck=(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},Dv=({edits:e,library:t,wordAtPlayhead:n})=>{var l;const[r,o]=ge.useState(""),[i,s]=ge.useState(!1),a=r||((l=t[0])==null?void 0:l.id)||"";return u.jsxs("div",{style:Ve,"data-testid":"sfx-add-section",children:[u.jsx("span",{style:Oe,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:Tr,value:a,onChange:c=>o(c.target.value),children:Ck(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(),Ek(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]})]})},Ns=({id:e,value:t,min:n,max:r,step:o,onCommit:i})=>u.jsxs("div",{style:Ot,children:[u.jsxs("span",{style:Oe,children:[e," ",u.jsx("span",{style:{color:"#EDEDF2"},children:t.toFixed(2)})]}),u.jsx("input",{type:"range","data-testid":`grade-${e}`,min:n,max:r,step:o,value:t,onChange:s=>i(Number(s.target.value))})]}),hn=({id:e,value:t,onCommit:n,min:r,max:o,dragStep:i})=>{const[s,a]=ge.useState(null),[l,c]=ge.useState(!1),f=ge.useRef(null),p=ge.useRef(null),h=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:Ot,children:[u.jsx("span",{style:Oe,children:e}),u.jsx("input",{type:"text",inputMode:"decimal",ref:f,"data-testid":`field-${e}`,style:{...Tr,...x?{}:{cursor:"ew-resize",touchAction:"none"},...l?{borderColor:"#FFE14D",color:"#FFE14D"}:{}},value:s??(Number.isFinite(t)?$5(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 m=p.current;if(!m)return;const v=k.clientX-m.x;if(!m.moved&&Math.abs(v)<=2)return;m.moved=!0;const y=Math.round(Math.min(g,Math.max(h,m.v+v*w))*1e3)/1e3;n(y)},onPointerUp:()=>{var m,v,y;const k=((m=p.current)==null?void 0:m.moved)===!0;p.current=null,c(!1),k||((v=f.current)==null||v.focus(),(y=f.current)==null||y.select())},onPointerCancel:()=>{p.current=null,c(!1)},onChange:k=>{a(k.target.value);const m=k.target.value.trim();if(m==="")return;const v=Number(m.replace(",","."));Number.isFinite(v)&&n(Math.min(g,Math.max(h,v)))}})]})},Al=({id:e,value:t,isColor:n,onCommit:r})=>u.jsxs("div",{style:Ot,children:[u.jsx("span",{style:Oe,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:{...Tp,flex:1},value:t,onChange:o=>r(o.target.value)})]})]}),M5=({selection:e,cue:t,frame:n,allSceneIds:r,edits:o,onSelect:i,resolvedTheme:s,anchorText:a,onVideoPreview:l,runInfo:c,captionsHiddenByFlag:f,fromLive:p=E=>E,hasOldClockPreimage:h=()=>!0,toSourceSec:g=null,onClockRefused:w=()=>{},sfxMarker:x=null,sfxLibrary:k=[],sfxEnabled:m=!1,lutMenu:v=iu,deletedScenes:y=[],sfxWordAtPlayhead:S=()=>null,playheadSec:b})=>{var W,$,A,U,z,O,R,Z,B,ie,ue,me,re,ee;if(x){const K=x,ce=K.kind==="added",q=(X,N)=>{ce?o.patchSfxAdded(K.key,X,N):K.planned&&o.patchSfx(K.key,X,K.planned,N)};return u.jsxs("div",{children:[u.jsxs("div",{style:Ve,children:[u.jsx("span",{style:Oe,children:"Sound effect"}),u.jsxs("div",{style:{fontSize:15,fontWeight:700,fontFamily:"ui-monospace, monospace"},children:[K.soundId,K.muted?u.jsx("span",{style:{color:"#9A9AA3",fontWeight:400},children:" (muted)"}):null,ce?u.jsx("span",{style:{color:"#9A9AA3",fontWeight:400},children:" (added)"}):null]}),u.jsxs("div",{style:{fontSize:12,color:"#9A9AA3"},children:["anchored to word ",K.word," · drag the diamond to retime"]})]}),u.jsxs("div",{style:Ve,children:[u.jsxs("div",{style:Ot,children:[u.jsx("span",{style:Oe,children:"Sound"}),u.jsx("select",{"data-testid":"sfx-sound",style:Tr,value:K.soundId,onChange:X=>q({soundId:X.target.value}),children:Ck(k,K.soundId)})]}),u.jsx("button",{"data-testid":"sfx-preview",style:{...Et,color:"#EDEDF2",borderColor:"#2A2A33"},onClick:()=>{Ct(),Ek(K.soundId)},children:"▸ Hear it"})]}),u.jsx("div",{style:Ve,children:u.jsxs("div",{style:Ot,children:[u.jsxs("span",{style:Oe,children:["gain"," ",u.jsxs("span",{style:{color:"#EDEDF2"},children:[K.gain.toFixed(2),"×"]})]}),u.jsx("input",{type:"range","data-testid":"sfx-gain-slider",min:0,max:2,step:.05,value:K.gain,onChange:X=>q({gain:Number(X.target.value)},`sfx:${K.key}:gain`)})]})}),u.jsx("div",{style:Ve,children:ce?u.jsx("button",{"data-testid":"sfx-delete",style:Et,onClick:()=>{Ct(),o.removeSfxAdded(K.key)},children:"Delete this sound"}):K.muted?u.jsxs(u.Fragment,{children:[u.jsx("button",{"data-testid":"sfx-restore",style:{...Et,color:"#EDEDF2",borderColor:"#2A2A33"},onClick:()=>{Ct(),o.restoreSfx(K.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(K.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(Dv,{edits:o,library:k,wordAtPlayhead:S})]})}if(e!=null&&e.elementId&&t){const K=e.elementId,ce=((W=t.elements)==null?void 0:W[K])??{},q=t.props?k5(K,t.props):null,X=/^window-\d+$/.test(K);return u.jsxs("div",{children:[u.jsxs("div",{style:Ve,children:[u.jsx("span",{style:Oe,children:"Selected"}),u.jsx("div",{style:{fontSize:15,fontWeight:700,fontFamily:"ui-monospace, monospace"},children:K})]}),(()=>{var ne;const N=/^line-(\d+)$/.exec(K),G=(ne=t.props)==null?void 0:ne.lines;if(t.component!=="StrikethroughReveal"||!N||!Array.isArray(G))return null;const T=Number(N[1]),M=G[T];if(!M)return null;const Q=M.struck?"struck":(M.mark??"none")!=="none"?M.mark:"plain";return u.jsx("div",{style:Ve,children:u.jsxs("div",{style:Ot,children:[u.jsx("span",{style:Oe,children:"Line style"}),u.jsxs("select",{"data-testid":"line-style",style:Tr,value:Q,onChange:V=>{const se=V.target.value,_=G.slice();_[T]={..._[T],struck:se==="struck",mark:se==="cross"||se==="check"?se:"none"},o.patchProps(e.sceneId,{lines:_})},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"})]})]})})})(),q!==null?u.jsx("div",{style:Ve,children:u.jsxs("div",{style:Ot,children:[u.jsx("span",{style:Oe,children:"Text"}),(()=>{const N=G=>{const T=t.props??{},M=/^(line|node|message|window|item)-\d+$/.test(K)?S5(K,T,G):{[K]:G};M&&o.patchProps(e.sceneId,M,`text:${e.sceneId}:${K}`)};return X?u.jsx("textarea",{style:{...Tp,resize:"vertical",fontFamily:"inherit"},"data-testid":"element-text",rows:Math.min(6,Math.max(2,q.split(`
164
+ `).length)),value:q,onChange:G=>N(G.target.value)}):u.jsx("input",{style:Tp,"data-testid":"element-text",value:q,onChange:G=>N(G.target.value)})})()]})}):null,u.jsxs("div",{style:Ve,children:[u.jsxs("div",{style:Ot,children:[u.jsxs("span",{style:Oe,children:["scale"," ",u.jsxs("span",{style:{color:"#EDEDF2"},children:[(ce.scale??1).toFixed(2),"×"]})]}),u.jsx("input",{type:"range","data-testid":"el-scale-slider",min:.1,max:3,step:.01,value:ce.scale??1,onChange:N=>o.patchElement(e.sceneId,K,{scale:Number(N.target.value)},`element:${e.sceneId}:${K}:scale`)})]}),u.jsxs("div",{style:As,children:[u.jsx(hn,{id:"x",value:ce.dx??0,dragStep:1,onCommit:N=>o.patchElement(e.sceneId,K,{dx:N},`element:${e.sceneId}:${K}:dx`)}),u.jsx(hn,{id:"y",value:ce.dy??0,dragStep:1,onCommit:N=>o.patchElement(e.sceneId,K,{dy:N},`element:${e.sceneId}:${K}:dy`)})]}),u.jsx(hn,{id:"scale",value:ce.scale??1,min:.05,max:4,dragStep:.01,onCommit:N=>o.patchElement(e.sceneId,K,{scale:N},`element:${e.sceneId}:${K}:scale`)})]}),u.jsxs("div",{style:Ve,children:[u.jsx("button",{style:Et,onClick:()=>{Ct(),o.clearElement(e.sceneId,K)},children:"Reset element"}),u.jsx("button",{"data-testid":"delete-element",style:{...Et,marginTop:8},onClick:()=>{Ct(),o.hideElement(e.sceneId,K),i({sceneId:e.sceneId,elementId:null})},children:"Delete element"})]})]})}if(e&&t){const K=t.kind==="plain",ce=K?y.filter(N=>{const G=(N.startSec+N.endSec)/2;return G>=t.startSec&&G<t.endSec}):[],q=o.doc.cuts.findIndex(N=>N.src===void 0&&N.startSec===t.startSec&&N.endSec===t.endSec);if(q!==-1)return u.jsx("div",{children:u.jsxs("div",{style:Ve,children:[u.jsx("span",{style:Oe,children:K?"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(q)},children:"Restore"})]})});const X=Object.entries(t.elements??{}).filter(([,N])=>N.hidden===!0).map(([N])=>{var M,Q;const T=((Q=(M=o.doc.scenes[e.sceneId])==null?void 0:M.elements[N])==null?void 0:Q.hidden)===!0?e.sceneId:US(e.sceneId);return{id:N,owningSceneId:T}});return u.jsxs("div",{children:[u.jsxs("div",{style:Ve,children:[u.jsx("span",{style:Oe,children:K?"Take":"Scene"}),u.jsx("div",{style:{fontSize:15,fontWeight:700,fontFamily:"ui-monospace, monospace"},children:e.sceneId}),(()=>{const N=b==null?void 0:b();return N!==void 0&&(N<t.startSec||N>=t.endSec)?u.jsx("div",{"data-testid":"playhead-outside-hint",style:{fontSize:12,color:"#FFE14D"},children:"The playhead is outside this block — edits here preview once playback enters its window."}):null})(),K?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]}),ce.length>0?u.jsxs("div",{style:Ve,children:[u.jsx("span",{style:Oe,children:"Deleted here"}),ce.map(N=>u.jsxs(ge.Fragment,{children:[u.jsxs("div",{style:{fontSize:12,color:"#9A9AA3"},children:[u.jsx("span",{style:{fontFamily:"ui-monospace, monospace"},children:N.id})," — its graphic is off; the window plays as this take."]}),u.jsxs("button",{"data-testid":`restore-scene-${N.id}`,style:{...Et,color:"#5FBF77",border:"1px solid #24402c"},onClick:()=>{Ct(),o.restoreScene(N.id)},children:["Restore ",N.id]})]},N.id))]}):null,u.jsxs("div",{style:Ve,children:[!K&&t.component?u.jsxs("div",{style:Ot,children:[u.jsx("span",{style:Oe,children:"Component"}),u.jsx("select",{style:Tr,value:t.component,onChange:N=>o.patchComponent(e.sceneId,N.target.value),children:zc.options.map(N=>u.jsx("option",{value:N,children:N},N))})]}):null,!K&&t.component?HA(t.component).map(N=>{var G,T,M;return N.kind==="boolean"?u.jsxs("div",{style:Ot,children:[u.jsx("span",{style:Oe,children:N.key}),u.jsx("input",{type:"checkbox","data-testid":`prop-${N.key}`,checked:typeof((G=t.props)==null?void 0:G[N.key])=="boolean"?t.props[N.key]:N.fallback===!0,onChange:Q=>o.patchProps(e.sceneId,{[N.key]:Q.target.checked})})]},N.key):u.jsxs("div",{style:Ot,children:[u.jsx("span",{style:Oe,children:N.key}),u.jsx("select",{style:Tr,"data-testid":`prop-${N.key}`,value:String(((T=t.props)==null?void 0:T[N.key])??((M=N.options)==null?void 0:M[0])??""),onChange:Q=>o.patchProps(e.sceneId,{[N.key]:Q.target.value}),children:(N.options??[]).map(Q=>u.jsx("option",{value:Q,children:Q},Q))})]},N.key)}):null,u.jsxs("div",{style:Ot,children:[u.jsx("span",{style:Oe,children:"Layout"}),u.jsx("select",{style:Tr,"data-testid":"layout-select",value:t.layout,onChange:N=>o.patchLayout(e.sceneId,N.target.value),children:Dc.options.map(N=>u.jsx("option",{value:N,children:N},N))})]})]}),u.jsxs("div",{style:Ve,children:[u.jsx("span",{style:Oe,children:"Video framing"}),u.jsxs("div",{style:Ot,children:[u.jsxs("span",{style:Oe,children:["zoom"," ",u.jsxs("span",{style:{color:"#EDEDF2"},children:[((($=t.video)==null?void 0:$.scale)??1).toFixed(2),"×"]})]}),u.jsx("input",{type:"range","data-testid":"zoom-slider",min:.5,max:3,step:.01,value:((A=t.video)==null?void 0:A.scale)??1,onChange:N=>l({sceneId:e.sceneId,patch:{scale:Number(N.target.value)}}),onPointerUp:N=>{const G=Number(N.target.value);o.patchVideo(e.sceneId,{scale:G},`video:${e.sceneId}:scale`),l(null)},onKeyUp:N=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(N.key))return;const T=Number(N.target.value);o.patchVideo(e.sceneId,{scale:T},`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:((U=t.video)==null?void 0:U.autoZoom)!==!1,onChange:N=>o.patchVideo(e.sceneId,{autoZoom:N.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(hn,{id:"scale",value:((z=t.video)==null?void 0:z.scale)??1,min:.05,max:4,dragStep:.01,onCommit:N=>o.patchVideo(e.sceneId,{scale:N},`video:${e.sceneId}:scale`)}),u.jsxs("div",{style:As,children:[u.jsx(hn,{id:"dx",value:((O=t.video)==null?void 0:O.dx)??0,dragStep:1,onCommit:N=>o.patchVideo(e.sceneId,{dx:N},`video:${e.sceneId}:dx`)}),u.jsx(hn,{id:"dy",value:((R=t.video)==null?void 0:R.dy)??0,dragStep:1,onCommit:N=>o.patchVideo(e.sceneId,{dy:N},`video:${e.sceneId}:dy`)})]}),t.video?u.jsx("button",{style:Et,onClick:()=>{Ct(),o.clearVideo(e.sceneId)},children:"Reset framing"}):null]}),u.jsxs("div",{style:Ve,children:[u.jsx("span",{style:Oe,children:"Audio"}),u.jsx("div",{style:Ot,children:u.jsxs("span",{style:Oe,children:["volume"," ",u.jsxs("span",{style:{color:"#EDEDF2"},children:[Math.round((((Z=t.video)==null?void 0:Z.volume)??1)*100),"%",(((B=t.video)==null?void 0:B.volume)??1)===0?" · muted":""]})]})}),u.jsx("input",{type:"range","data-testid":"volume-slider",min:0,max:4,step:.05,value:((ie=t.video)==null?void 0:ie.volume)??1,onChange:N=>o.patchVideo(e.sceneId,{volume:Number(N.target.value)},`video:${e.sceneId}:volume`)}),u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"This window only — for a clip recorded quieter than the rest. Above 100% amplifies (preview and render); very high boosts also raise the recording's noise floor."})]}),t.layout==="pip-bubble"?(()=>{const N=Uo("pip-bubble",void 0,[],n).video,G=t.pip??{},T=G.cornerRadius??N.cornerRadius;return u.jsxs("div",{style:Ve,children:[u.jsx("span",{style:Oe,children:"PiP bubble"}),u.jsxs("div",{style:Ot,children:[u.jsxs("span",{style:Oe,children:["roundness"," ",u.jsx("span",{style:{color:"#EDEDF2"},children:T.toFixed(2)})]}),u.jsx("input",{type:"range","data-testid":"pip-roundness",min:0,max:1,step:.01,value:T,onChange:M=>o.patchPip(e.sceneId,{cornerRadius:Number(M.target.value)},`pip:${e.sceneId}:cornerRadius`)})]}),u.jsxs("div",{style:As,children:[u.jsx(hn,{id:"pip-x",value:G.x??N.rect.x,min:0,max:1-N.rect.w,dragStep:.002,onCommit:M=>o.patchPip(e.sceneId,{x:M},`pip:${e.sceneId}:x`)}),u.jsx(hn,{id:"pip-y",value:G.y??N.rect.y,min:0,max:1-N.rect.h,dragStep:.002,onCommit:M=>o.patchPip(e.sceneId,{y:M},`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 T;if(K)return null;const N=JS(t,n),G=M=>Q=>o.patchGraphicRect(e.sceneId,Vu({...N,[M]:Q},n),`box:${e.sceneId}:${M}`);return u.jsxs("div",{style:Ve,children:[u.jsx("span",{style:Oe,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:As,children:[u.jsx(hn,{id:"box-x",value:N.x,min:0,max:1,dragStep:.002,onCommit:G("x")}),u.jsx(hn,{id:"box-y",value:N.y,min:0,max:1,dragStep:.002,onCommit:G("y")})]}),u.jsxs("div",{style:As,children:[u.jsx(hn,{id:"box-w",value:N.w,min:.08,max:1,dragStep:.002,onCommit:G("w")}),u.jsx(hn,{id:"box-h",value:N.h,min:.05,max:1,dragStep:.002,onCommit:G("h")})]}),(T=o.doc.scenes[e.sceneId])!=null&&T.graphicRect?u.jsx("button",{"data-testid":"reset-box",style:Et,onClick:()=>{Ct(),o.clearGraphicRect(e.sceneId)},children:"Reset box"}):null]})})(),(()=>{const N=Uo(t.layout,void 0,[],n).captionAnchor,G=t.captionY??N,T=t.captionScale??1,M=o.doc.scenes[e.sceneId];return u.jsxs("div",{style:Ve,children:[u.jsx("span",{style:Oe,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:Ot,children:[u.jsxs("span",{style:Oe,children:["position"," ",u.jsx("span",{style:{color:"#EDEDF2"},children:G.toFixed(2)})]}),u.jsx("input",{type:"range","data-testid":"caption-y-slider",min:.05,max:.95,step:.01,value:G,onChange:Q=>o.patchCaptionY(e.sceneId,Number(Q.target.value),`captionY:${e.sceneId}`)})]}),u.jsxs("div",{style:Ot,children:[u.jsxs("span",{style:Oe,children:["scale"," ",u.jsxs("span",{style:{color:"#EDEDF2"},children:[T.toFixed(2),"×"]})]}),u.jsx("input",{type:"range","data-testid":"caption-scale-slider",min:.2,max:3,step:.01,value:T,onChange:Q=>o.patchCaptionScale(e.sceneId,Number(Q.target.value),`captionScale:${e.sceneId}`)})]}),u.jsx(hn,{id:"caption-scale",value:T,min:.2,max:3,dragStep:.01,onCommit:Q=>o.patchCaptionScale(e.sceneId,Q,`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:G,scale:T})},children:"Apply to all scenes"}),(M==null?void 0:M.captionY)!==void 0||(M==null?void 0:M.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:Ve,children:[u.jsx("span",{style:Oe,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:K?"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]}),K?null:u.jsx("div",{style:Ve,children:u.jsx("button",{"data-testid":"delete-scene",style:Et,onClick:()=>{Ct(),o.hideScene(e.sceneId)},children:"Delete scene"})}),X.length>0?u.jsxs("div",{style:Ve,children:[u.jsx("span",{style:Oe,children:"Hidden elements"}),X.map(({id:N,owningSceneId:G})=>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:N}),u.jsx("button",{"data-testid":`restore-element-${N}`,style:{...Et,color:"#5FBF77",border:"1px solid #24402c",padding:"4px 8px"},onClick:()=>{Ct(),o.restoreElement(G,N)},children:"Restore"})]},N))]}):null,u.jsxs("div",{style:Ve,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 N=GS({fromLive:p,hasOldClockPreimage:h},t.startSec,t.endSec);if(g!==null){const G={startSec:Ov(g(t.startSec)),endSec:Ov(g(t.endSec))},T=N.kind==="degenerate"?{startSec:p(t.startSec),endSec:p(t.endSec)}:{startSec:N.startSec,endSec:N.endSec};o.cutChunk(T.startSec,T.endSec,G);return}if(N.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}N.kind==="shrunk"&&console.warn(`ossclip cut preview: ${N.report}`),o.cutChunk(N.startSec,N.endSec)},children:"Delete this chunk"})]})]})}const E=o.doc.theme,C=(K,ce)=>o.patchTheme({[K]:ce}),j=K=>`${Math.floor(K/60)}:${String(Math.floor(K%60)).padStart(2,"0")}`,I=((ue=c==null?void 0:c.usage)==null?void 0:ue.totals)??null,P=((me=c==null?void 0:c.production)==null?void 0:me.producer)??null,L=((re=c==null?void 0:c.production)==null?void 0:re.clip)??null;return u.jsxs("div",{children:[u.jsxs("div",{style:Ve,children:[u.jsx("span",{style:Oe,children:"Theme"}),u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Nothing selected — global tokens."})]}),u.jsxs("div",{style:Ve,children:[u.jsx(Al,{id:"accent",value:E.accent??s.accent,isColor:!0,onCommit:K=>C("accent",K)}),u.jsx(Al,{id:"bg",value:E.bg??s.bg,isColor:!0,onCommit:K=>C("bg",K)}),u.jsx(Al,{id:"fg",value:E.fg??s.fg,isColor:!0,onCommit:K=>C("fg",K)}),u.jsx(hn,{id:"radiusPx",value:E.radiusPx??s.radiusPx,min:0,dragStep:.5,onCommit:K=>C("radiusPx",K)}),u.jsx(Al,{id:"fontDisplay",value:E.fontDisplay??s.fontDisplay,isColor:!1,onCommit:K=>C("fontDisplay",K)})]}),u.jsxs("div",{style:Ve,children:[u.jsx("span",{style:Oe,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:K=>o.setCaptionsHidden(!K.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]}),(()=>{const K=o.doc.colorGrade,ce=T5(K,v.configGrade),q=(N,G)=>{ce!==null&&o.setColorGrade({...ce,[N]:G},`colorGrade:${N}`)},X=ce===null?null:R5(ce);return u.jsxs("div",{style:Ve,"data-testid":"color-section",children:[u.jsx("span",{style:Oe,children:"Color"}),u.jsxs("select",{"data-testid":"grade-source",style:Tr,value:I5(K,v.configGrade),onChange:N=>o.setColorGrade(j5(N.target.value,K)),children:[u.jsx("option",{value:"off",children:"Off"}),v.configGrade!==null?u.jsxs("option",{value:"default",children:["Default (",F5(v.configGrade),")"]}):null,C5.map(N=>u.jsx("option",{value:`preset:${N}`,children:N},N)),v.items.map(N=>u.jsxs("option",{value:`lut:${N.file}`,children:[N.title," (.cube)"]},N.file))]}),ce!==null&&ce.lut!==void 0?u.jsx("div",{"data-testid":"grade-lut-note",style:{fontSize:12,color:"#9A9AA3"},children:"LUT grades apply on the next render — the preview stays ungraded."}):null,X!==null?u.jsxs(u.Fragment,{children:[u.jsx(Ns,{id:"intensity",value:X.intensity,min:0,max:1,step:.01,onCommit:N=>q("intensity",N)}),u.jsx(Ns,{id:"exposure",value:X.exposure,min:-2,max:2,step:.05,onCommit:N=>q("exposure",N)}),u.jsx(Ns,{id:"temperature",value:X.temperature,min:-100,max:100,step:1,onCommit:N=>q("temperature",N)}),u.jsx(Ns,{id:"saturation",value:X.saturation,min:0,max:2,step:.01,onCommit:N=>q("saturation",N)}),u.jsx(Ns,{id:"contrast",value:X.contrast,min:0,max:2,step:.01,onCommit:N=>q("contrast",N)})]}):null,v.issues.length>0?u.jsx("div",{"data-testid":"grade-lut-issues",style:{fontSize:12,color:"#FFE14D"},children:v.issues.map(N=>`${N.file}: ${N.message}`).join(" · ")}):null]})})(),m?u.jsx(Dv,{edits:o,library:k,wordAtPlayhead:S}):null,P||I?u.jsxs("div",{style:Ve,"data-testid":"run-info",children:[u.jsx("span",{style:Oe,children:"This video"}),P?u.jsxs("div",{style:{fontSize:12,color:"#C9C9D4"},children:["planned by ",u.jsx("span",{style:{color:"#EDEDF2"},children:P.provider}),P.models.length>0?` (${P.models.join(", ")})`:"",P.cached?" · reused from cache":"",P.at?` · ${new Date(P.at).toLocaleString()}`:""]}):null,I?u.jsxs("div",{style:{fontSize:12,color:"#C9C9D4"},children:[I.calls," LLM call",I.calls===1?"":"s"," ·"," ",I.inputTokens.toLocaleString()," in / ",I.outputTokens.toLocaleString()," out tokens",I.anyEstimated?" (partly estimated)":""]}):null,I&&I.equivalentUsd!==null?u.jsx("div",{style:{fontSize:12,color:"#C9C9D4"},children:I.allUnbilled?`~$${I.equivalentUsd.toFixed(2)} of API-rate work, covered by the subscription`:I.billedUsd!==null?`~$${I.billedUsd.toFixed(2)} charged at API rates`:`~$${I.equivalentUsd.toFixed(2)} at API rates`}):null,L?u.jsxs("div",{style:{fontSize:12,color:"#C9C9D4"},children:["clip: ",j(L.startSec),"–",j(L.endSec),(ee=c==null?void 0:c.production)!=null&&ee.sourceDuration?` of ${j(c.production.sourceDuration)}`:""," ","(--clip ",L.targetSec,")"]}):null]}):null,u.jsx("div",{style:Ve,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."})})]})},Gd=1.2,Uu=.05;function zv(e,t,n,r){return n<=0||r<=0?0:Math.min(1,Math.max(0,(e-t)/n))*r}const _5=16,A5=e=>Math.min(_5,Math.max(1,e));function N5(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 vm=e=>e.filter(t=>t.kind!=="plain");function L5(e,t,n,r){const o=vm(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+Uu:0,p=c?c.startSec-Uu:r,h=Math.min(Math.max(s.startSec+n,f),Math.max(f,p-a));return{startSec:h,endSec:h+a}}const Bv=e=>Math.round(e*1e3)/1e3;function Wv(e,t,n){if(!n)return{startSec:e,endSec:t};const r=Bv(n(e)),o=Bv(n(t));return o>r?{srcStart:r,srcEnd:o}:{startSec:e,endSec:t}}function O5(e,t,n,r,o){const i=vm(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+Uu:0,f=l?l.startSec-Uu:o;let p=Math.min(Math.max(n,c),Math.max(c,f-Gd)),h=Math.max(Math.min(r,f),p+Gd);return h>f&&(h=f,p=Math.max(c,h-Gd)),{startSec:p,endSec:h}}function Vv(e,t,n,r){const o=[0,r,n];for(const a of vm(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 Nl(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 Ik(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 Xd(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 wm={silence:"#4DA3FF",pause:"#B78CFF",filler:"#FFB84D",retake:"#FF7AB8",user:"#6BDD8B",clip:"#4DDCD4"},D5="#8a8a95";function z5(e){const t=`${(e.srcOut-e.srcIn).toFixed(1)}s removed`;return e.reason?`${e.reason} · ${t}`:t}const B5=1e-6;function W5(e,t,n){if(t.length===0)return[];const r=new Set(pm(e,n)),o=new Set(hm(e,n)),i=[];for(const s of e){if(o.has(s)||s.kind!=="remove"||s.srcOut<=s.srcIn)continue;const a=Ik(t,s.srcIn),l=i.filter(c=>Math.abs(c.outSec-a)<B5).length;i.push({srcIn:s.srcIn,srcOut:s.srcOut,reason:s.reason,outSec:a,label:z5(s),color:s.reason?wm[s.reason]:D5,stackIndex:l,vetoable:Vc(s.reason),vetoed:r.has(s)})}return i}const V5={silence:"Silences",pause:"Pauses",filler:"Fillers",retake:"Retakes",user:"Your cuts",clip:"Clip window"};function H5(e){const t=new Map;for(const n of e){if(n.kind!=="remove"||n.reason===void 0||!Vc(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(wm).map(n=>t.get(n)).filter(n=>n!==void 0)}function U5(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 Z5=({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:{...K5,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:Y5,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))})},K5={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)"},Y5={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"},G5=.75;function X5(e,t,n){return t>e?t-e>G5?[]:n.filter(r=>!r.muted&&r.atSec>e&&r.atSec<=t):[]}function q5(e){return Number.isFinite(e)?Math.min(1,Math.max(0,e)):1}function J5(e){const t=[];for(const n of e)n.muted||t.includes(n.soundId)||t.push(n.soundId);return t}const Q5=10,Hv=4,Uv=8,Zv=8,eL=300,tL=e=>{const t=Math.max(0,Math.round(e));return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`},nL=(e,t)=>{const[n,r]=ge.useState({}),o=ge.useRef({}),i=t.map(s=>s.toFixed(1)).join(",");return ge.useEffect(()=>{if(!e||t.length===0)return;const s=[...new Set(t.map(p=>p.toFixed(1)))].filter(p=>o.current[p]===void 0);if(s.length===0)return;let a=!1;const l=document.createElement("video");l.src=e,l.muted=!0,l.preload="auto";const c=document.createElement("canvas");return(async()=>{await new Promise((h,g)=>{l.onloadedmetadata=()=>h(),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 h of s){if(a)return;await new Promise(g=>{l.onseeked=()=>g(),l.currentTime=Math.max(0,Number(h))}),p.drawImage(l,0,0,c.width,c.height),o.current[h]=c.toDataURL("image/jpeg",.6)}a||r({...o.current})}})().catch(()=>{}),()=>{a=!0,l.removeAttribute("src"),l.load()}},[e,i]),n},rL=(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?[]:J5(n)).join(",");d.useEffect(()=>{const l=i.current;for(const c of a===""?[]:a.split(","))if(!l.has(c))try{const f=new Audio(wk(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 S;if(!c)return;const k=x.detail.frame/t,m=f;f=k;const{markers:v,enabled:y}=o.current;if(!(m===null||!y))for(const b of X5(m,k,v)){const E=i.current.get(b.soundId);if(E)try{E.volume=q5(b.gain),E.currentTime=0,(S=E.play())==null||S.catch(()=>{})}catch{}}},h=()=>{c=!0,f=null},g=()=>{c=!1,f=null};return l.addEventListener("frameupdate",p),l.addEventListener("play",h),l.addEventListener("pause",g),()=>{l.removeEventListener("frameupdate",p),l.removeEventListener("play",h),l.removeEventListener("pause",g)}},[e,t])},oL=({cues:e,cuts:t=[],spans:n=[],cleanup:r=[],durationSec:o,fps:i,playerRef:s,selection:a,onSelect:l,edits:c,videoSrc:f,toSourceSec:p,pinSourceSec:h=null,toLive:g=y=>y,onRevived:w,sfxMarkers:x=null,sfxWords:k=[],sfxSelected:m=null,onSelectSfx:v})=>{const y=d.useRef(null),S=d.useRef(null),b=d.useRef(!1),E=d.useRef(null),[C,j]=d.useState(0),I=d.useRef(C);I.current=C;const[P,L]=d.useState(null),W=d.useRef(null),[$,A]=d.useState(null),U=d.useRef($);U.current=$;const[z,O]=d.useState(null),[R,Z]=d.useState(1),B=ge.useMemo(()=>p?e.filter(T=>T.kind==="plain").map(T=>p((T.startSec+T.endSec)/2)):[],[e,p]),ie=nL(f,B),[ue,me]=d.useState(!0);rL(s,i,x,ue);const re=d.useRef(null),ee=d.useRef(null),K=d.useCallback((T,M)=>{const Q=re.current;Z(ne=>{const V=A5(T);if(V===ne||!Q)return V;const se=Q.getBoundingClientRect();return ee.current={prevZoom:ne,anchorX:M!==void 0?M-se.left:se.width/2},V})},[]);d.useLayoutEffect(()=>{const T=re.current,M=ee.current;!T||!M||(ee.current=null,T.scrollLeft=N5(M.prevZoom,R,T.clientWidth,T.scrollLeft,M.anchorX))},[R]);const ce=d.useRef(R);ce.current=R,d.useEffect(()=>{const T=re.current;if(!T)return;const M=Q=>{Q.ctrlKey||Q.metaKey?(Q.preventDefault(),K(ce.current*Math.exp(-Q.deltaY*.01),Q.clientX)):T.scrollWidth>T.clientWidth&&(Q.preventDefault(),T.scrollLeft+=Q.deltaY+Q.deltaX)};return T.addEventListener("wheel",M,{passive:!1}),()=>T.removeEventListener("wheel",M)},[K]),d.useEffect(()=>{const T=s.current;if(!T)return;j(T.getCurrentFrame());const M=Q=>j(Q.detail.frame);return T.addEventListener("frameupdate",M),()=>T.removeEventListener("frameupdate",M)},[s]),d.useEffect(()=>{const T=re.current;if(!T||o<=0||T.scrollWidth<=T.clientWidth||b.current||E.current!==null||S.current!==null)return;const M=C/i/o*T.scrollWidth,{scrollLeft:Q,clientWidth:ne}=T;(M<Q||M>Q+ne)&&(T.scrollLeft=Math.max(0,Math.min(T.scrollWidth-ne,M-ne*.1)))},[C,i,o]),d.useEffect(()=>{var M,Q;if(!a||b.current||E.current!==null||S.current!==null)return;const T=(M=re.current)==null?void 0:M.querySelector(`[data-testid="timeline-block-${a.sceneId}"]`);(Q=T==null?void 0:T.scrollIntoView)==null||Q.call(T,{inline:"nearest",block:"nearest"})},[a]);const q=d.useCallback(T=>{var ne;const M=y.current;if(!M||o<=0)return;const Q=M.getBoundingClientRect();(ne=s.current)==null||ne.seekTo(Math.round(zv(T,Q.left,Q.width,o)*i))},[s,o,i]),X=d.useCallback((T,M)=>Q=>{Q.stopPropagation(),Q.preventDefault();const ne=y.current;ne&&(S.current={sceneId:T.id,edge:M,startContentX:Q.clientX-ne.getBoundingClientRect().left,origStart:T.startSec,origEnd:T.endSec},O({sceneId:T.id,startSec:T.startSec,endSec:T.endSec,snapped:null}))},[]),N=d.useRef(0);d.useEffect(()=>{const T=ne=>{const V=re.current;if(!V||V.scrollWidth<=V.clientWidth)return;const se=Date.now();if(se-N.current<eL)return;const _=V.getBoundingClientRect(),Y=V.scrollWidth-V.clientWidth;ne>=_.right-Zv&&V.scrollLeft<Y?(V.scrollLeft=Math.min(Y,V.scrollLeft+V.clientWidth),N.current=se):ne<=_.left+Zv&&V.scrollLeft>0&&(V.scrollLeft=Math.max(0,V.scrollLeft-V.clientWidth),N.current=se)},M=ne=>{var Ae,Fe,Je;(b.current||((Ae=E.current)==null?void 0:Ae.moved)===!0||((Fe=W.current)==null?void 0:Fe.moved)===!0||S.current!==null)&&T(ne.clientX);const se=W.current;if(se){if(!se.moved&&Math.abs(ne.clientX-se.startX)<Hv)return;se.moved=!0;const gt=y.current,Ne=gt==null?void 0:gt.getBoundingClientRect();if(!Ne||o<=0)return;const Le=xk(k,zv(ne.clientX,Ne.left,Ne.width,o));if(Le===null)return;const Jt=(Je=k.find(Vt=>Vt.word===Le))==null?void 0:Je.atSec;if(Jt===void 0)return;A({key:se.marker.key,word:Le,atSec:Jt});return}if(b.current){q(ne.clientX);return}const _=E.current;if(_&&o>0){if(!_.moved&&Math.abs(ne.clientX-_.startX)<Hv)return;if(_.moved=!0,_.scrub){q(ne.clientX);return}const gt=y.current,Ne=gt==null?void 0:gt.getBoundingClientRect(),Le=Ne?(ne.clientX-Ne.left-_.startContentX)/Ne.width*o:0;let Jt=Le,Vt=null;const St=Ne&&Ne.width>0&&!ne.altKey?e.find(en=>en.id===_.sceneId):void 0;if(St&&Ne){const en=Uv/(Ne.width/o),Mn=Vv(e,_.sceneId,I.current/i,o),sr=St.startSec+Le,ar=St.endSec+Le,_n=Nl(sr,Mn,en),Kn=Nl(ar,Mn,en),Ke=_n.snapped===null?1/0:Math.abs(_n.sec-sr),fn=Kn.snapped===null?1/0:Math.abs(Kn.sec-ar);Ke<=fn&&_n.snapped!==null?(Jt=Le+(_n.sec-sr),Vt=_n.snapped):Kn.snapped!==null&&(Jt=Le+(Kn.sec-ar),Vt=Kn.snapped)}const Qt=L5(e,_.sceneId,Jt,o);if(Qt){const en=Vt!==null&&(Math.abs(Qt.startSec-Vt)<1e-6||Math.abs(Qt.endSec-Vt)<1e-6)?Vt:null;O({sceneId:_.sceneId,...Qt,snapped:en})}return}const Y=S.current;if(!Y||o<=0)return;const fe=y.current;if(!fe)return;const we=fe.getBoundingClientRect(),Ee=(ne.clientX-we.left-Y.startContentX)/we.width*o;let Te=Y.edge==="start"?Y.origStart+Ee:Y.origStart,ze=Y.edge==="end"?Y.origEnd+Ee:Y.origEnd,be=null;if(!ne.altKey&&we.width>0){const gt=Uv/(we.width/o),Ne=Vv(e,Y.sceneId,I.current/i,o);if(Y.edge==="start"){const Le=Nl(Te,Ne,gt);Te=Le.sec,be=Le.snapped}else{const Le=Nl(ze,Ne,gt);ze=Le.sec,be=Le.snapped}}const de=O5(e,Y.sceneId,Te,ze,o),he=be!==null&&(Math.abs(de.startSec-be)<1e-6||Math.abs(de.endSec-be)<1e-6)?be:null;O({sceneId:Y.sceneId,...de,snapped:he})},Q=ne=>{b.current=!1;const V=W.current;if(V){W.current=null;const Y=U.current;if(A(null),V.moved&&Y&&Y.key===V.marker.key){const fe=V.marker;Y.word!==fe.word&&(fe.kind==="added"?c.patchSfxAdded(fe.key,{word:Y.word}):fe.planned&&c.patchSfx(fe.key,{word:Y.word},fe.planned))}return}const se=E.current;if(se){E.current=null,se.moved&&!se.scrub&&O(Y=>(Y&&Y.sceneId===se.sceneId&&c.patchTiming(se.sceneId,Wv(Y.startSec,Y.endSec,h)),null));return}const _=S.current;_&&(O(Y=>(Y&&Y.sceneId===_.sceneId&&(Y.startSec!==_.origStart||Y.endSec!==_.origEnd)&&c.patchTiming(_.sceneId,Wv(Y.startSec,Y.endSec,h)),null)),S.current=null)};return window.addEventListener("mousemove",M),window.addEventListener("mouseup",Q),()=>{window.removeEventListener("mousemove",M),window.removeEventListener("mouseup",Q)}},[e,o,c,q,i,h,k]);const G=o>0?Math.min(1,C/i/o)*100:0;return u.jsxs("div",{style:iL,onMouseDownCapture:kk,children:[P!==null?(()=>{const T=U5(P.seam),{srcIn:M,srcOut:Q}=P.seam;return u.jsx(Z5,{x:P.x,y:P.y,onClose:()=>L(null),items:[{label:T.keep,onPick:()=>{c.toggleKept(M,Q),P.seam.vetoed||w==null||w(M,Q)}},{label:T.dismiss,onPick:()=>{c.dismissRemoval(M,Q),w==null||w(M,Q)}}]})})():null,u.jsxs("div",{style:sL,children:[x===null?null:u.jsx("button",{"data-testid":"sfx-preview-toggle",style:{...Ll,marginRight:"auto",width:"auto",padding:"0 6px",color:ue?Ol:"#9A9AA3",borderColor:ue?Ol:"#2A2A33"},"aria-pressed":ue,onClick:()=>me(T=>!T),title:ue?"Sound effects play with the preview — click to mute them":"Sound effects are muted in the preview — click to hear them",children:ue?"♪ sfx on":"♪ sfx off"}),u.jsx("span",{style:lL,children:"ctrl+scroll to zoom"}),u.jsx("button",{"data-testid":"zoom-out",style:Ll,onClick:()=>K(R/2),disabled:R<=1,title:"Zoom out (ctrl/cmd + scroll on the timeline)",children:"−"}),u.jsxs("span",{"data-testid":"zoom-level",style:aL,children:[Math.round(R*10)/10,"×"]}),u.jsx("button",{"data-testid":"zoom-in",style:Ll,onClick:()=>K(R*2),disabled:R>=16,title:"Zoom in (ctrl/cmd + scroll on the timeline)",children:"+"}),u.jsx("button",{"data-testid":"zoom-fit",style:{...Ll,width:"auto",padding:"0 8px"},onClick:()=>K(1),disabled:R<=1,title:"Fit the whole clip in view",children:"fit"})]}),u.jsx("div",{ref:re,"data-testid":"timeline-scroller",style:uL,children:u.jsxs("div",{style:{width:`${R*100}%`,minWidth:"100%",paddingBottom:6},children:[(()=>{const T=W5(r,n,c.doc.cleanup);return T.length===0?null:u.jsxs("div",{"data-testid":"marker-lane",style:yL,children:[T.map(M=>{const Q=o>0?Math.min(100,Math.max(0,M.outSec/o*100)):0,ne=M.vetoed?`${M.label} — kept: playing in the preview (click to re-remove)`:M.vetoable?`${M.label} — click to keep this; the preview updates immediately`:M.label;return u.jsx("div",{"data-testid":`timeline-removal-${M.srcIn}-${M.srcOut}`,...M.vetoed?{"data-vetoed":"true"}:{},title:ne,...M.vetoable?{onMouseDown:V=>{V.button!==2&&(V.stopPropagation(),V.preventDefault(),c.toggleKept(M.srcIn,M.srcOut),M.vetoed||w==null||w(M.srcIn,M.srcOut))},onContextMenu:V=>{V.preventDefault(),V.stopPropagation(),L({x:V.clientX,y:V.clientY,seam:M})}}:{},style:{...vL,...M.vetoable?{cursor:"pointer"}:{},left:`${Q}%`,...Q>90?{transform:"translateX(-100%)"}:{},marginLeft:M.stackIndex*10,zIndex:2+M.stackIndex,...M.vetoed?{background:"transparent",border:`1px dashed ${M.color}`,color:M.color,opacity:.7}:{background:`${M.color}30`,border:`1px solid ${M.color}`,color:"#EDEDF2"}},children:M.vetoed?`kept · ${M.label}`:M.label},`removal-${M.srcIn}-${M.srcOut}`)}),T.filter(M=>M.vetoed&&o>0).map(M=>{const Q=Math.min(100,Math.max(0,M.outSec/o*100)),ne=Math.min(100-Q,(M.srcOut-M.srcIn)/o*100);return u.jsx("div",{"data-testid":`timeline-kept-band-${M.srcIn}-${M.srcOut}`,style:{...SL,left:`${Q}%`,width:`${ne}%`,borderColor:M.color}},`kept-band-${M.srcIn}-${M.srcOut}`)})]})})(),x===null?null:u.jsx("div",{"data-testid":"sfx-lane",style:wL,children:x.map(T=>{const M=($==null?void 0:$.key)===T.key,Q=M?$.atSec:T.atSec,ne=M?$.word:T.word,V=o>0?Math.min(100,Math.max(0,Q/o*100)):0,se=m===T.key;return u.jsx("div",{"data-testid":`sfx-marker-${T.key}`,...T.muted?{"data-muted":"true"}:{},...se?{"data-selected":"true"}:{},title:`${T.soundId} · word ${ne} · gain ${T.gain}`+(T.muted?" · muted (restore it in the panel)":"")+(T.kind==="added"?" · added by you":"")+" — drag to another word",onMouseDown:_=>{_.button!==2&&(_.stopPropagation(),_.preventDefault(),v==null||v(T.key),W.current={marker:T,startX:_.clientX,moved:!1})},style:{...xL,left:`${V}%`,zIndex:se||M?3:2},children:u.jsx("div",{style:{...bL,border:`1px solid ${se?"#5b8cff":Ol}`,background:T.muted?"transparent":Ol,opacity:T.muted?.45:1,...T.kind==="added"?{borderStyle:"dashed"}:{}}})},T.key)})}),u.jsx("div",{"data-testid":"ruler",style:cL,onMouseDown:T=>{T.preventDefault(),q(T.clientX),b.current=!0},children:(()=>{var _;if(o<=0)return u.jsx("span",{style:qd,children:"0:00"});const M=(((_=re.current)==null?void 0:_.clientWidth)??1200)*R/o;let ne=[.5,1,2,5,10,15,30,60,120,300,600].find(Y=>Y*M>=70)??600;for(;o/(ne/5)>600;)ne*=2;const V=ne/5,se=[];for(let Y=0;Y<=o+1e-6;Y+=V){const fe=Math.round(Y/V)%5===0,we=`${Y/o*100}%`;se.push(u.jsx("div",{style:{position:"absolute",left:we,bottom:0,width:1,height:fe?8:4,background:fe?"#3A3A44":"#26262e",pointerEvents:"none"}},Y.toFixed(3))),fe&&Y+V<=o&&se.push(u.jsx("span",{style:{...qd,position:"absolute",left:we,top:0,transform:Y===0?void 0:"translateX(-50%)",pointerEvents:"none"},children:tL(Y)},`l${Y.toFixed(3)}`))}return u.jsxs(u.Fragment,{children:[se,u.jsx("span",{style:{...qd,position:"absolute",right:2,top:0,pointerEvents:"none"},children:Xd(o,i)})]})})()}),u.jsxs("div",{ref:y,style:dL,onMouseDown:T=>{T.preventDefault(),q(T.clientX),b.current=!0},children:[e.map(T=>{var we;const M=T.kind==="plain",Q=(z==null?void 0:z.sceneId)===T.id,ne=Q?z.startSec:T.startSec,V=Q?z.endSec:T.endSec,se=o>0?ne/o*100:0,_=o>0?Math.max(0,(V-ne)/o*100):0,Y=(a==null?void 0:a.sceneId)===T.id,fe=M&&p?ie[p((T.startSec+T.endSec)/2).toFixed(1)]:void 0;return u.jsxs("div",{"data-testid":`timeline-block-${T.id}`,onMouseDown:Ee=>{var Te;Ee.stopPropagation(),Ee.preventDefault(),l({sceneId:T.id,elementId:null}),E.current={sceneId:T.id,startX:Ee.clientX,startContentX:Ee.clientX-(((Te=y.current)==null?void 0:Te.getBoundingClientRect().left)??0),moved:!1,scrub:M}},style:{...fL,left:`${se}%`,width:`${_}%`,zIndex:Q?4:Y?3:1,border:Y?"2px solid #5b8cff":T.kept!==void 0?"1px dashed #B78CFF":M?"1px solid #22222a":"1px solid #2A2A33",backgroundColor:Y?"#1c2333":T.kept!==void 0?"#1a1524":M?"#131318":"#1A1A21",...fe?{backgroundImage:`linear-gradient(rgba(10,10,14,0.35), rgba(10,10,14,0.6)), url(${fe})`,backgroundSize:"auto 100%, auto 100%",backgroundRepeat:"repeat-x"}:{}},children:[u.jsx("span",{style:M?fe?{...Jd,color:"#D8D8DE",textShadow:"0 1px 2px rgba(0,0,0,0.9)"}:{...Jd,color:"#55555f"}:Jd,children:T.kept!==void 0?"KEPT":T.id}),((we=T.video)==null?void 0:we.volume)!==void 0&&T.video.volume!==1?u.jsx("span",{"data-testid":`volume-badge-${T.id}`,style:Kv,children:T.video.volume===0?"MUTE":`${Math.round(T.video.volume*100)}%`}):null,!M&&T.pinned?u.jsx("span",{style:Kv,children:"PIN"}):null,M?null:u.jsxs(u.Fragment,{children:[u.jsx("div",{onMouseDown:X(T,"start"),style:{...Yv,left:0,cursor:"ew-resize"}}),u.jsx("div",{onMouseDown:X(T,"end"),style:{...Yv,right:0,cursor:"ew-resize"}})]})]},T.id)}),t.map((T,M)=>{const Q=V=>o>0?Math.min(100,Math.max(0,V/o*100)):0;if(!T.src){const V=Math.min(Math.max(g(T.startSec),0),o),se=Math.min(Math.max(g(T.endSec),0),o),_=Q(V),Y=o>0?Math.max(0,(se-V)/o*100):0;return u.jsx("div",{"data-testid":`timeline-cut-${T.startSec}-${T.endSec}`,style:{...pL,left:`${_}%`,width:`${Y}%`},children:u.jsx("div",{style:hL})},`cut-${M}-${T.startSec}-${T.endSec}`)}if(n.length===0)return null;const ne=Q(Ik(n,T.src.startSec));return u.jsx("div",{"data-testid":`timeline-cut-seam-${T.startSec}-${T.endSec}`,title:"Restore cut — the material returns on the next produce/Render",onMouseDown:V=>{V.stopPropagation(),V.preventDefault(),c.restoreChunk(M)},style:{...mL,left:`${ne}%`},children:u.jsx("div",{style:gL})},`cut-${M}-${T.startSec}-${T.endSec}`)}),z?u.jsxs("div",{"data-testid":"drag-readout",style:{...Gv,left:`${o>0?z.startSec/o*100:0}%`,transform:o>0&&z.startSec/o>.85?"translateX(-100%)":Gv.transform},children:[Xd(z.startSec,i)," – ",Xd(z.endSec,i)]}):null,(z==null?void 0:z.snapped)!==null&&(z==null?void 0:z.snapped)!==void 0?u.jsx("div",{"data-testid":"snap-tick",style:{...kL,left:`${o>0?z.snapped/o*100:0}%`}}):null,u.jsx("div",{"data-testid":"playhead",style:{...EL,left:`${G}%`},children:u.jsx("div",{"data-testid":"playhead-grab",onMouseDown:T=>{T.stopPropagation(),T.preventDefault(),b.current=!0},style:CL})})]})]})})]})},iL={flexShrink:0,borderTop:"1px solid #1E1E24",background:"#111116",padding:"6px 20px 8px"},sL={display:"flex",justifyContent:"flex-end",alignItems:"center",gap:6,marginBottom:4},Ll={width:22,height:18,fontSize:12,lineHeight:1,color:"#EDEDF2",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:4,cursor:"pointer",padding:0},aL={fontSize:10,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#9A9AA3",minWidth:26,textAlign:"center"},lL={fontSize:10,color:"#55555f",marginRight:4,userSelect:"none"},uL={overflowX:"auto",overflowY:"hidden"},cL={position:"relative",height:18,padding:"0 2px",marginBottom:4,borderBottom:"1px solid #1E1E24",cursor:"ew-resize",userSelect:"none"},qd={fontSize:10,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#9A9AA3"},dL={position:"relative",height:44,background:"#0F0F14",border:"1px solid #2A2A33",borderRadius:6,overflow:"visible",userSelect:"none"},fL={position:"absolute",top:3,bottom:3,borderRadius:4,boxSizing:"border-box",cursor:"pointer",display:"flex",alignItems:"center",overflow:"hidden"},Jd={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"},Kv={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"},pL={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)"},hL={position:"absolute",left:0,right:0,top:"50%",height:2,background:"rgba(255,92,92,0.8)"},mL={position:"absolute",top:-4,bottom:-4,width:12,marginLeft:-6,zIndex:4,cursor:"pointer",pointerEvents:"auto"},gL={position:"absolute",left:"50%",top:0,bottom:0,width:2,background:"#FF5C5C",pointerEvents:"none"},yL={position:"relative",height:22,marginBottom:2},vL={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"},Ol="#4ECDC4",wL={position:"relative",height:14,marginBottom:2},xL={position:"absolute",top:0,bottom:0,width:14,marginLeft:-7,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer"},bL={width:8,height:8,transform:"rotate(45deg)",borderRadius:1,pointerEvents:"none"},SL={position:"absolute",bottom:0,height:0,borderBottom:"2px dotted",opacity:.6,pointerEvents:"none"},Yv={position:"absolute",top:0,bottom:0,width:Q5},kL={position:"absolute",top:-4,bottom:-4,width:1,zIndex:6,background:"#FFE14D",pointerEvents:"none"},Gv={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"},EL={position:"absolute",top:-26,bottom:-4,width:2,zIndex:5,background:"#FFE14D",pointerEvents:"none"},CL={position:"absolute",top:0,bottom:0,left:-4,width:10,pointerEvents:"auto",cursor:"ew-resize"};function IL(e,t,n){const r=e.filter(h=>Xe(h.word)!==null);if(r.length===0)return null;const o=e[0].word,i=e[e.length-1].word,s=Math.max(o.start,t??0),a=i.end;if(a<=s)return null;const l=[];e.every(h=>{const g=Xe(h.word);return g!==null&&g in n.captionWordsHidden})||l.push("caption");const f=n.cuts.some(h=>h.src===void 0&&h.startSec===s&&h.endSec===a),p=e.some(h=>h.synthetic);return!f&&!p&&l.push("caption-video"),l.length===0?null:{startSec:s,endSec:a,words:r.map(h=>({srcStart:h.word.srcStart,was:h.live})),targets:l}}function jL(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?Xe(s[0].word):null,c=[];for(let f=0;f+o<=e.length;){if(f>t-o&&f<=n){f=n+1;continue}const p=e.slice(f,f+o),h=p.every(w=>Xe(w.word)!==null&&r(w.word)===void 0),g=l!==null&&Xe(p[0].word)===l;if(h&&!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 TL(e,t,n,r,o){const i=Math.max(0,Math.floor(o)),s=new Float32Array(i);if(i===0||!(r>n)||!(t>0)||e.length===0)return{buckets:s,fromSec:n,toSec:r};const a=r-n;for(let l=0;l<i;l++){const c=Math.max(0,Math.ceil((n+a*l/i)*t)),f=Math.min(e.length,Math.ceil((n+a*(l+1)/i)*t));let p=0;for(let h=c;h<f;h++){const g=Math.abs(e[h]);g>p&&(p=g)}s[l]=p}return{buckets:s,fromSec:n,toSec:r}}const jo=560,Ln=48,Xv=10;let Dl=null;const RL=e=>((Dl===null||Dl.key!==e)&&(Dl={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)}),Dl.promise),qv=6,Jv=8,FL=e=>{const t=e.anchorTop+e.anchorHeight+qv,n=e.anchorTop-e.menuH-qv,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(Jv,Math.min(i,e.clientWidth-e.menuW-Jv));return{top:o,left:s}},Qv="transcript-word-",e0=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^="${Qv}"]`))??null;if(n===null)return null;const r=Number(n.getAttribute("data-testid").slice(Qv.length));return Number.isInteger(r)?r:null},t0=(e,t)=>{const n=Math.max(0,e.start-Xv),r=e.end+Xv;return{start:n,end:Number.isFinite(t)&&t>0?Math.min(r,Math.max(t,n)):r}},n0=.001,PL=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)<n0&&Math.abs(s-o.srcEnd)<n0;return{srcStart:o.srcStart,window:a?null:{srcStart:i,srcEnd:s}}})},$L=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},ML=(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)}},_L=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))}},Qd=(e,t)=>{const n=e[t],r=n==null?void 0:n.words[0],o=Xe(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)}},AL=(e,t)=>{const n=[];let r=0;for(const o of e){const i=new Set(o.words.map(l=>Xe(l)).filter(l=>l!==null)),s=t[r],a=l=>{const c=Xe(l);return c!==null&&i.has(c)};s!==void 0&&s.words.some(a)?(n.push(r),r++):n.push(null)}return n},NL=({baseLines:e,liveLines:t,timingLines:n,fps:r,playerRef:o,edits:i,onDeleteWords:s,width:a,workdir:l,toPlayerSec:c=p=>p,fromPlayerSec:f=p=>p})=>{const[p,h]=d.useState(""),[g,w]=d.useState(null),[x,k]=d.useState(null),[m,v]=d.useState(null),[y,S]=d.useState(null),[b,E]=d.useState(!1),[C,j]=d.useState(!1);d.useEffect(()=>{const F=H=>{const le=q.current;if(!le||le.contains(H.target))return;x!==null&&k(null),m!==null&&v(null),g!==null&&w(null),y!==null&&S(null);const ye=window.getSelection();ye&&ye.anchorNode&&le.contains(ye.anchorNode)&&ye.removeAllRanges()};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[x,m,g,y]);const[I,P]=d.useState(null),[L,W]=d.useState(0),$=d.useRef(null),A=d.useRef(null),[U,z]=d.useState(null),[O,R]=d.useState(null),[Z,B]=d.useState(null),[ie,ue]=d.useState(!1),[me,re]=d.useState(null),[ee,K]=d.useState(!1),ce=d.useRef(null),q=d.useRef(null),X=d.useRef(null),N=d.useMemo(()=>{const F=new Map;for(const H of e)for(const le of H.words){const ye=Xe(le);if(ye===null)continue;const Ie=F.get(ye);Ie?Ie.push(le.text):F.set(ye,[le.text])}return F},[e]),G=d.useMemo(()=>{var ye;const F=[];let H=0;const le=new Map;for(let Ie=0;Ie<t.length;Ie++){const $e=t[Ie];for(let Pe=0;Pe<$e.words.length;Pe++){const Be=$e.words[Pe],Ze=Xe(Be);let nn;if(Ze!==null){const pn=le.get(Ze)??0;le.set(Ze,pn+1),nn=(ye=N.get(Ze))==null?void 0:ye[pn]}F.push({index:H,base:nn??Be.text,live:Be.text,synthetic:Ze!==null&&nn===void 0,start:Be.start,end:Be.end,lineIndex:Ie,word:Be}),H++}}return F},[N,t]);d.useEffect(()=>{k(null),v(null)},[G.length]);const T=d.useMemo(()=>new Set(Object.keys(i.doc.captionWordsHidden)),[i.doc.captionWordsHidden]),M=F=>{const H=Xe(F.word);return H!==null&&T.has(H)},Q=d.useMemo(()=>fm(G.map(F=>F.live).join(" ")),[G]);d.useEffect(()=>{if(Q!=="rtl"||typeof FontFace>"u"||!document.fonts)return;let F=!1;for(const H of document.fonts)H.family===Ca&&(F=!0);if(!F)try{new FontFace(Ca,`url("/media/${KS}") format("truetype")`).load().then(le=>document.fonts.add(le),()=>{})}catch{}},[Q]),d.useEffect(()=>{const F=o.current;if(!F)return;const H=le=>{const ye=f(le.detail.frame/r),Ie=G.find($e=>ye>=$e.start&&ye<$e.end);B($e=>Ie?Ie.index===$e?$e:Ie.index:$e)};return F.addEventListener("frameupdate",H),()=>F.removeEventListener("frameupdate",H)},[o,r,G,f]),d.useEffect(()=>{var F,H,le;Z!==null&&((le=(H=(F=ce.current)==null?void 0:F.querySelector(`[data-testid="transcript-word-${Z}"]`))==null?void 0:H.scrollIntoView)==null||le.call(H,{block:"nearest"}))},[Z]);const ne=p.trim().normalize("NFC").toLowerCase(),V=d.useMemo(()=>ne?G.filter(F=>F.live.normalize("NFC").toLowerCase().includes(ne)).map(F=>F.index):[],[ne,G]),se=d.useMemo(()=>ne?new Set(V):null,[ne,V]),[_,Y]=d.useState(0),fe=F=>{var H,le,ye;(ye=(le=(H=ce.current)==null?void 0:H.querySelector(`[data-testid="transcript-word-${F}"]`))==null?void 0:le.scrollIntoView)==null||ye.call(le,{block:"center"})};d.useEffect(()=>{Y(0),V.length>0&&fe(V[0])},[V]);const we=F=>{if(V.length===0)return;const H=(_+F+V.length)%V.length;Y(H),fe(V[H])},Ee=F=>{const H=F.draft.trim();H&&i.patchCaption(F.srcStart,H,F.base),w(null)},Te=F=>{Xe(F.word)!==null&&ze(F.word)===void 0&&w({index:F.index,draft:F.live,srcStart:F.word.srcStart,base:F.base})},ze=F=>{const H=Xe(F);if(H===null)return;const le=Number(H.slice(1));return i.doc.captionRangeEdits.find(ye=>{const Ie=Number(ye.fromKey.slice(1)),$e=Number(ye.toKey.slice(1));return le>=Math.min(Ie,$e)&&le<=Math.max(Ie,$e)})},be=x===null?null:Math.min(x.anchor,x.focus),de=x===null?null:Math.max(x.anchor,x.focus),he=be===null||de===null?[]:G.slice(be,de+1),Ae=he.length>0&&he.every(M),Fe=he.some(F=>Xe(F.word)===null),Je=he.map(F=>ze(F.word)).find(F=>F!==void 0),gt=F=>{var Ze,nn,pn;if(g!==null||m!==null||y!==null)return;const H=ce.current;if(!H)return;const le=(Ze=document.getSelection)==null?void 0:Ze.call(document);if(!le||le.isCollapsed)return;const{anchorNode:ye,focusNode:Ie}=le;if(!ye||!Ie||!H.contains(ye)||!H.contains(Ie))return;const $e=Ie.nodeType===3?Ie.parentElement:Ie;if((nn=$e==null?void 0:$e.closest)!=null&&nn.call($e,"input, textarea"))return;const Pe=e0(ye),Be=e0(Ie);Pe===null||Be===null||F.detail>=2&&Pe===Be||(k({anchor:Math.min(Pe,Be),focus:Math.max(Pe,Be)}),(pn=le.removeAllRanges)==null||pn.call(le))};d.useLayoutEffect(()=>{if(be===null||de===null){re(null);return}const F=ce.current,H=(F==null?void 0:F.querySelector(`[data-testid="transcript-word-${be}"]`))??null,le=(F==null?void 0:F.querySelector(`[data-testid="transcript-word-${de}"]`))??null;if(!F||le===null){re(null);return}const ye=H!==null&&H.offsetTop===le.offsetTop,Ie=ye?Math.min(H.offsetLeft,le.offsetLeft):le.offsetLeft,$e=ye?Math.max(H.offsetLeft+H.offsetWidth,le.offsetLeft+le.offsetWidth):le.offsetLeft+le.offsetWidth,Pe=X.current,Be=FL({anchorTop:le.offsetTop,anchorHeight:le.offsetHeight,anchorLeft:Ie,anchorWidth:$e-Ie,menuW:(Pe==null?void 0:Pe.offsetWidth)??0,menuH:(Pe==null?void 0:Pe.offsetHeight)??0,scrollTop:F.scrollTop,clientWidth:F.clientWidth,clientHeight:F.clientHeight});re(Ze=>Ze!==null&&Ze.top===Be.top&&Ze.left===Be.left?Ze:Be)},[be,de,a,g,m,y,me]),d.useEffect(()=>{K(!1),S(null)},[be,de]),d.useEffect(()=>{m!==null&&(be!==m.selLo||de!==m.selHi)&&v(null)},[m,be,de]);const Ne=d.useMemo(()=>m!==null&&be!==null&&de!==null?jL(G,be,de,ze):[],[m,be,de,G,i.doc.captionRangeEdits]),Le=()=>{if(he.length===0||Fe)return;const F=IL(he.map(H=>({word:H.word,live:H.live,synthetic:H.synthetic})),be!==null&&be>0?G[be-1].end:null,i.doc);F!==null&&(s(F),k(null))},Jt=()=>{if(he.length===0||Fe)return;const F=Je;if(F!==void 0){const H=Math.min(Number(F.fromKey.slice(1)),Number(F.toKey.slice(1))),le=Math.max(Number(F.fromKey.slice(1)),Number(F.toKey.slice(1))),ye=G.filter(Ie=>{const $e=Xe(Ie.word);if($e===null)return!1;const Pe=Number($e.slice(1));return Pe>=H&&Pe<=le});if(ye.length===0)return;k({anchor:ye[0].index,focus:ye[ye.length-1].index}),v({draft:ye.map(Ie=>Ie.live).join(" ").normalize("NFC"),fromSrcStart:Number(F.fromKey.slice(1))/1e3,toSrcStart:Number(F.toKey.slice(1))/1e3,was:ye.map(Ie=>Ie.base).join(" ").normalize("NFC"),rawWas:ye.map(Ie=>Ie.base).join(" "),covered:!0,selLo:ye[0].index,selHi:ye[ye.length-1].index});return}v({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:be,selHi:de})},Vt=F=>{const H=F.draft.trim();if(H){const le=H.split(/\s+/).filter(Boolean);!F.covered&&F.fromSrcStart===F.toSrcStart&&le.length===1?i.patchCaption(F.fromSrcStart,H,F.rawWas):i.patchCaptionRange(F.fromSrcStart,F.toSrcStart,H,F.was),k(null)}v(null)},St=F=>{const H=F.draft.trim();if(H){const le=H.split(/\s+/).filter(Boolean);!F.covered&&F.fromSrcStart===F.toSrcStart&&le.length===1?i.patchCaptionAllOccurrences([{srcStart:F.fromSrcStart,was:F.rawWas},...Ne.map(ye=>({srcStart:ye.fromSrcStart,was:ye.rawWas}))],H):i.patchCaptionRangeAllOccurrences([{fromSrcStart:F.fromSrcStart,toSrcStart:F.toSrcStart,was:F.was},...Ne],H),k(null)}v(null)},Qt=()=>{he.length===0||Fe||(i.hideCaptionWords(he.filter(F=>!M(F)).map(F=>({srcStart:F.word.srcStart,was:F.live}))),k(null))},en=()=>{he.length!==0&&(i.restoreCaptionWords(he.filter(M).map(F=>F.word.srcStart)),k(null))},Mn=d.useMemo(()=>AL(t,n),[t,n]),sr=F=>{var le;const H=Mn[F]??null;return H===null?null:Xe((le=n[H])==null?void 0:le.words[0])},ar=F=>{const H=sr(F);if(H===null)return;const le=i.doc.captionLineWindows[H];if(le!==void 0)return`caption placed at ${le.srcStart.toFixed(2)}s–${le.srcEnd.toFixed(2)}s of the source — Timing to change`;const ye=i.doc.captionLineTiming[H];return ye===void 0?void 0:`caption timing adjusted (${Math.round(ye.lead*1e3)}ms in / ${Math.round(ye.tail*1e3)}ms out) — Timing to change`},_n=he.length===0?0:he[he.length-1].lineIndex-he[0].lineIndex+1,Kn=()=>{if(he.length===0||Fe)return;const F=n,H=Mn[he[0].lineIndex]??null,le=Mn[he[he.length-1].lineIndex]??null;if(H===null||le===null)return;const ye=[];for(let Be=H;Be<=le;Be++){const Ze=Qd(F,Be);if(Ze===null)return;ye.push(Ze)}const Ie=ye[0],$e=ye[ye.length-1],Pe={start:Ie.srcStart,end:$e.srcEnd};S({track:F,from:H,to:le,span:Pe,newSpan:(()=>{var nn,pn;const Be=t0(Pe,L),Ze=i.doc.captionLineWindows;return ML({start:((nn=Ze[Ie.key])==null?void 0:nn.srcStart)??Pe.start,end:((pn=Ze[$e.key])==null?void 0:pn.srcEnd)??Pe.end},Be.start,Be.end)})()})},Ke=d.useMemo(()=>{if(y===null)return null;const F=[];for(let H=y.from;H<=y.to;H++){const le=Qd(y.track,H);if(le===null)return null;F.push(le)}return F},[y]),fn=d.useMemo(()=>y===null||Ke===null?null:PL({lines:Ke,span:y.span,newSpan:y.newSpan}),[y,Ke]),Sn=d.useMemo(()=>{const F=new Map;for(const le of fn??[])le.window!==null&&F.set(Cn(le.srcStart),le.window);const H=[];for(let le=0;le<n.length;le++){const ye=Qd(n,le);if(ye===null)continue;const Ie=F.get(ye.key)??i.doc.captionLineWindows[ye.key];H.push({key:ye.key,srcStart:(Ie==null?void 0:Ie.srcStart)??ye.srcStart,srcEnd:(Ie==null?void 0:Ie.srcEnd)??ye.srcEnd})}return H},[n,i.doc.captionLineWindows,fn]),Yn=d.useMemo(()=>$L(Sn),[Sn]),tn=y===null?0:y.to-y.from+1,Ge=d.useMemo(()=>y===null?null:t0(y.span,L),[y,L]);d.useEffect(()=>{R(null),W(0)},[l]),d.useEffect(()=>{if(y===null||O!==null)return;let F=!1;return RL(l).then(H=>{!F&&H!==null&&(R(H),H.sampleRate>0&&W(H.channel.length/H.sampleRate))}),()=>{F=!0}},[y,O,l]);const lr=F=>Ge===null?0:(F-Ge.start)/(Ge.end-Ge.start)*jo;d.useEffect(()=>{var pn;if(y===null||Ge===null)return;const F=$.current,H=((pn=F==null?void 0:F.getContext)==null?void 0:pn.call(F,"2d"))??null;if(!F||!H)return;const le=lr;H.fillStyle="#0F0F14",H.fillRect(0,0,jo,Ln);const ye=Math.floor(jo/2),Ie=O===null?new Float32Array(ye):TL(O.channel,O.sampleRate,Ge.start,Ge.end,ye).buckets;H.fillStyle="#4a4a58";const $e=jo/ye;for(let Ht=0;Ht<ye;Ht++){const rn=Math.max(1,Ie[Ht]*(Ln-4));H.fillRect(Ht*$e,(Ln-rn)/2,Math.max(1,$e-1),rn)}const Pe=new Set((Ke==null?void 0:Ke.map(Ht=>Ht.key))??[]);for(const Ht of Sn){if(Pe.has(Ht.key))continue;const rn=le(Ht.srcStart),ds=Math.max(1,le(Ht.srcEnd)-rn);H.fillStyle=Yn.has(Ht.key)?"rgba(240, 165, 60, 0.28)":"rgba(255, 255, 255, 0.05)",H.fillRect(rn,0,ds,Ln)}const Be=le(y.newSpan.start),Ze=le(y.newSpan.end),nn=(Ke==null?void 0:Ke.some(Ht=>Yn.has(Ht.key)))??!1;H.fillStyle=nn?"rgba(240, 165, 60, 0.22)":"rgba(255, 225, 77, 0.18)",H.fillRect(Be,0,Math.max(1,Ze-Be),Ln),H.fillStyle=nn?"#F0A53C":"#FFE14D",H.fillRect(Be-1,0,2,Ln),H.fillRect(Ze-1,0,2,Ln)},[y,Ge,Ke,Sn,Yn,O]);const us=Ge===null?0:(Ge.end-Ge.start)/jo,ur=y===null||Ge===null?null:{lead:lr(y.newSpan.start),tail:lr(y.newSpan.end)},Co=F=>H=>{y!==null&&(H.preventDefault(),z({edge:F,startX:H.clientX,span:y.newSpan}))};d.useEffect(()=>{if(U===null||y===null||Ge===null)return;const F=le=>{S({...y,newSpan:_L({edge:U.edge,span:U.span,dSec:(le.clientX-U.startX)*us,lo:Ge.start,hi:Ge.end})})},H=()=>z(null);return window.addEventListener("pointermove",F),window.addEventListener("pointerup",H),window.addEventListener("pointercancel",H),window.addEventListener("blur",H),()=>{window.removeEventListener("pointermove",F),window.removeEventListener("pointerup",H),window.removeEventListener("pointercancel",H),window.removeEventListener("blur",H)}},[U,y,Ge,us]),d.useEffect(()=>{y===null&&U!==null&&z(null)},[y,U]);const Io=()=>{var H;const F=A.current;if(!(F===null||y===null)){if(b){F.pause(),E(!1),P(null);return}F.currentTime=y.newSpan.start;try{const le=(H=F.play)==null?void 0:H.call(F);le&&typeof le.catch=="function"&&le.catch(()=>{})}catch{}E(!0),P(y.newSpan.start)}},cs=()=>{const F=A.current;if(!(F===null||y===null||!b)){if(F.currentTime<y.newSpan.end){P(F.currentTime);return}if(C){F.currentTime=y.newSpan.start,P(y.newSpan.start);return}F.pause(),E(!1),P(null)}};d.useEffect(()=>{var F;y!==null||!b||((F=A.current)==null||F.pause(),E(!1),P(null))},[y,b]);const Br=F=>{i.patchCaptionLineWindows(F),S(null)};return u.jsxs("div",{"data-testid":"transcript-panel",ref:q,style:{...LL,width:a},children:[u.jsxs("div",{style:OL,children:[u.jsx("span",{style:DL,children:"Transcript"}),u.jsxs("div",{style:tO,children:[u.jsx("span",{style:o0,children:"Click to jump · double-click to retype · drag to select"}),u.jsx("button",{"data-testid":"transcript-help-toggle",style:nO,onClick:()=>ue(F=>!F),title:"What each gesture does","aria-label":"Transcript help","aria-expanded":ie,children:"?"})]}),ie?u.jsx("div",{"data-testid":"transcript-help",style:o0,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:{...zL,flex:1},placeholder:"Find a word…",value:p,onChange:F=>h(F.target.value),onKeyDown:F=>{F.key==="Enter"&&(F.preventDefault(),we(F.shiftKey?-1:1))}}),u.jsx("button",{"data-testid":"transcript-prev",style:i0,onClick:()=>we(-1),disabled:V.length===0,title:"Previous match (⇧Enter)","aria-label":"Previous match",children:"‹"}),u.jsx("button",{"data-testid":"transcript-next",style:i0,onClick:()=>we(1),disabled:V.length===0,title:"Next match (Enter)","aria-label":"Next match",children:"›"})]}),se?u.jsx("div",{"data-testid":"transcript-match-count",style:{fontSize:11,color:"#9A9AA3"},children:V.length===0?"0 matches":`${_+1}/${V.length} match${V.length===1?"":"es"}`}):null]}),u.jsxs("div",{style:BL,"data-testid":"transcript-body",dir:Q,ref:ce,onMouseUp:gt,tabIndex:0,onKeyDown:F=>{if(!(g!==null||m!==null)){if(y!==null){F.key==="Escape"&&(F.stopPropagation(),S(null));return}if(F.key==="Escape"){if(x===null)return;F.stopPropagation(),k(null),v(null);return}(F.key==="Delete"||F.key==="Backspace")&&x!==null&&(F.preventDefault(),F.stopPropagation(),Ae?en():Le())}},children:[G.map((F,H)=>{const le=ze(F.word),ye=ar(F.lineIndex),Ie=(()=>{const Pe=sr(F.lineIndex);return Pe!==null&&Yn.has(Pe)})(),$e=M(F)?"hidden from captions — select and Restore":le!==void 0?`part of a rewritten range (was “${le.was}”) — select it and use Edit`:F.synthetic?`rewritten (was “${F.base}”) — select and Edit to change`:F.live!==F.base?`edited (was “${F.base}”) — double-click to retype`:"click to jump · double-click to retype";return u.jsxs(ge.Fragment,{children:[H>0?" ":null,(g==null?void 0:g.index)===F.index?u.jsx("input",{autoFocus:!0,"data-testid":"transcript-edit",style:aO,value:g.draft,onChange:Pe=>w({...g,draft:Pe.target.value}),onBlur:()=>Ee(g),onKeyDown:Pe=>{Pe.key==="Enter"&&Pe.target.blur(),Pe.key==="Escape"&&w(null)}}):u.jsx("span",{"data-testid":`transcript-word-${F.index}`,onClick:Pe=>{var Be;if(m!==null&&v(null),y!==null&&S(null),Pe.shiftKey){k(Ze=>Ze===null?{anchor:F.index,focus:F.index}:{...Ze,focus:F.index});return}(Be=o.current)==null||Be.seekTo(Math.ceil(c(F.start)*r)),k({anchor:F.index,focus:F.index})},onDoubleClick:()=>Te(F),title:`${$e}${ye===void 0?"":` · ${ye}`}${Ie?" · overlaps another caption":""}`,style:{...WL,...ye!==void 0?XL:{},...M(F)?GL:{},...F.live!==F.base||F.synthetic?UL:{},...Ie?KL:{},...Z===F.index?ZL:{},...be!==null&&F.index>=be&&F.index<=de?YL:{},...se!=null&&se.has(F.index)?VL:{},...V[_]===F.index?HL:{}},children:F.live})]},F.index)}),x!==null&&me!==null&&g===null&&m===null&&y===null?u.jsxs("div",{"data-testid":"transcript-selection-menu",role:"menu",ref:X,dir:"ltr",style:{...su,top:me.top,left:me.left},children:[u.jsx(di,{"data-testid":"transcript-edit-range",onClick:Jt,disabled:Fe,title:Fe?"A selected word has no source anchor (this project predates them) — re-run produce first":Je!==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(di,{"data-testid":"transcript-timing",onClick:Kn,disabled:he.length===0||Fe,title:Fe?"A selected word has no source anchor (this project predates them) — re-run produce first":_n===1?"Adjust when this caption appears and leaves":`Adjust when these ${_n} captions appear and leave`,children:"Timing"}),Ae?u.jsx(di,{"data-testid":"transcript-restore",onClick:en,title:"Show these words in the captions again",children:"Restore"}):u.jsxs("span",{style:{position:"relative"},children:[u.jsx(di,{"data-testid":"transcript-delete-menu",onClick:()=>K(F=>!F),title:"Delete these words — from the captions only, or from the video too",children:"Delete ▾"}),ee?u.jsxs("div",{"data-testid":"transcript-delete-flyout",dir:"ltr",style:rO,children:[u.jsx(di,{"data-testid":"transcript-hide",onClick:()=>{K(!1),Qt()},disabled:Fe,title:Fe?"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(di,{"data-testid":"transcript-delete",onClick:()=>{K(!1),Le()},disabled:Fe,title:Fe?"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:s0,children:[he.length," word",he.length===1?"":"s"]})]}):null,m!==null&&me!==null?u.jsxs("div",{"data-testid":"transcript-range-popover",ref:X,dir:"ltr",style:{...su,top:me.top,left:me.left,flexDirection:"column",alignItems:"stretch",gap:6},children:[u.jsx("textarea",{autoFocus:!0,"data-testid":"transcript-range-edit",rows:3,dir:"auto",style:iO,value:m.draft,onChange:F=>v({...m,draft:F.target.value}),onKeyDown:F=>{F.key==="Enter"&&!F.shiftKey&&(F.preventDefault(),Vt(m)),F.key==="Escape"&&v(null)}}),u.jsxs("div",{style:{display:"flex",gap:6},children:[u.jsx("button",{"data-testid":"transcript-apply",style:Zr,onClick:()=>Vt(m),title:"Rewrite this selection (Enter)",children:"Apply"}),Ne.length>0?u.jsxs("button",{"data-testid":"transcript-apply-all",style:Zr,onClick:()=>St(m),title:"Rewrite this selection AND every other place the same words occur — one undo step",children:["Apply to all (",Ne.length,")"]}):null,u.jsx("button",{style:Zr,onClick:()=>v(null),title:"Discard the rewrite (Esc)",children:"Cancel"})]})]}):null,u.jsx("audio",{"data-testid":"transcript-timing-audio",ref:A,src:"/media/audio.wav",preload:"none",onTimeUpdate:cs,onLoadedMetadata:F=>{const H=F.currentTarget.duration;Number.isFinite(H)&&H>0&&W(H)}}),y!==null&&Ge!==null&&me!==null?u.jsxs("div",{"data-testid":"transcript-timing-popover",ref:X,dir:"ltr",style:{...su,top:me.top,left:me.left,flexDirection:"column",alignItems:"stretch",gap:6},children:[u.jsxs("div",{style:{position:"relative",width:jo,height:Ln},children:[u.jsx("canvas",{"data-testid":"transcript-timing-canvas",ref:$,width:jo,height:Ln,style:{display:"block",borderRadius:4}}),ur!==null?u.jsxs(u.Fragment,{children:[u.jsx("div",{"data-testid":"transcript-timing-band",title:tn===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:Co("band"),style:{...JL,left:ur.lead,width:Math.max(0,ur.tail-ur.lead),cursor:(U==null?void 0:U.edge)==="band"?"grabbing":"grab"}}),u.jsx(r0,{"data-testid":"transcript-timing-handle-lead",title:tn===1?"Drag to move when this caption comes in":"Drag to move when the first caption comes in",x:ur.lead,active:(U==null?void 0:U.edge)==="lead",onPointerDown:Co("lead")}),u.jsx(r0,{"data-testid":"transcript-timing-handle-tail",title:tn===1?"Drag to move when this caption goes out":"Drag to move when the last caption goes out",x:ur.tail,active:(U==null?void 0:U.edge)==="tail",onPointerDown:Co("tail")}),I!==null?u.jsx("div",{"data-testid":"transcript-timing-playhead",style:{...QL,left:lr(I)}}):null]}):null]}),u.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[u.jsx("button",{"data-testid":"transcript-timing-play",style:Zr,onClick:Io,title:b?"Pause":tn===1?"Play the audio under this caption's window":"Play the audio under these captions' window",children:b?"Pause":"Play"}),u.jsx("button",{"data-testid":"transcript-timing-loop",style:C?{...Zr,...sO}:Zr,"aria-pressed":C,onClick:()=>j(F=>!F),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:s0,children:[y.newSpan.start.toFixed(2),"s – ",y.newSpan.end.toFixed(2),"s",` · ${tn} caption${tn===1?"":"s"}`,(Ke??[]).some(F=>Yn.has(F.key))?" · overlaps":""]}),u.jsx("button",{"data-testid":"transcript-timing-apply",style:Zr,onClick:()=>{fn!==null&&Br(fn)},title:tn===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:Zr,onClick:()=>S(null),title:"Discard the placement (Esc)",children:"Cancel"})]})]}):null]})]})},di=({children:e,...t})=>{const[n,r]=d.useState(!1);return u.jsx("button",{role:"menuitem",...t,style:{...oO,...n&&!t.disabled?{background:"#34343F"}:{},...t.disabled?{opacity:.5,cursor:"default"}:{}},onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:e})},r0=({x:e,active:t,...n})=>{const[r,o]=d.useState(!1);return u.jsx("div",{...n,style:{...qL,left:e-jk/2},onPointerEnter:()=>o(!0),onPointerLeave:()=>o(!1),children:u.jsx("div",{style:{...eO,background:t?"#fff":r?"#FFF0A0":"#FFE14D",width:t?4:2}})})},LL={flexShrink:0,display:"flex",flexDirection:"column",background:"#111116",minHeight:0},OL={display:"flex",flexDirection:"column",gap:8,padding:"14px 14px 10px",borderBottom:"1px solid #1E1E24"},DL={fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"#9A9AA3"},o0={fontSize:11,lineHeight:1.45,color:"#6a6a75"},zL={fontFamily:"'Inter', system-ui, sans-serif",fontSize:13,background:"#0F0F14",border:"1px solid #2A2A33",borderRadius:6,color:"#fff",padding:"6px 8px"},BL={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"},WL={cursor:"pointer",borderRadius:3,padding:"2px 4px",unicodeBidi:"isolate"},VL={background:"#2b2b1a",outline:"1px solid #6b6432"},HL={background:"#3d3a17",outline:"2px solid #FFE14D",color:"#fff"},i0={width:26,height:30,fontSize:16,lineHeight:1,color:"#EDEDF2",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:6,cursor:"pointer",padding:0},UL={color:"#FFE14D"},ZL={background:"#2E5CFF30",color:"#F2F4FF",borderRadius:4},KL={color:"#F0A53C"},YL={background:"#FFE14D",color:"#111",borderRadius:0,boxShadow:"-4px 0 0 0 #FFE14D, 4px 0 0 0 #FFE14D"},GL={textDecoration:"line-through",color:"#6a6a75"},XL={borderBottom:"1px dotted #9A9AA3"},jk=12,qL={position:"absolute",top:0,width:jk,height:Ln,cursor:"ew-resize",touchAction:"none",display:"flex",justifyContent:"center"},JL={position:"absolute",top:0,height:Ln,touchAction:"none"},QL={position:"absolute",top:0,width:1,height:Ln,background:"#FFFFFF",pointerEvents:"none"},eO={height:"100%",borderRadius:1,pointerEvents:"none"},tO={display:"flex",gap:6,alignItems:"center",justifyContent:"space-between"},nO={width:20,height:20,fontSize:11,lineHeight:1,color:"#9A9AA3",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:6,cursor:"pointer",padding:0,flexShrink:0},su={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},rO={...su,top:"100%",left:0,marginTop:4,zIndex:32,minWidth:170,flexDirection:"column",alignItems:"stretch"},s0={fontSize:11,color:"#9A9AA3",paddingInline:"6px 8px",whiteSpace:"nowrap"},oO={fontSize:12,fontWeight:600,color:"#EDEDF2",background:"transparent",border:"none",borderRadius:6,padding:"6px 10px",cursor:"pointer",textAlign:"left",whiteSpace:"nowrap"},iO={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"},Zr={fontSize:11,color:"#EDEDF2",background:"#34343F",border:"1px solid #45454F",borderRadius:6,cursor:"pointer",padding:"4px 8px"},sO={color:"#111",background:"#FFE14D",borderColor:"#FFE14D"},aO={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"},lO=[{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"]]}],uO=({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:cO,onMouseDown:e,children:u.jsxs("div",{"data-testid":"shortcuts-modal",style:dO,onMouseDown:t=>t.stopPropagation(),children:[u.jsxs("div",{style:fO,children:[u.jsx("span",{style:pO,children:"keybinds"}),u.jsx("span",{style:hO,children:"esc close"})]}),u.jsx("div",{style:mO,children:"available commands and configured shortcuts"}),lO.map(t=>u.jsxs("div",{style:{marginTop:18},children:[u.jsx("div",{style:gO,children:t.title}),t.rows.map(([n,r])=>u.jsxs("div",{style:yO,children:[u.jsx("span",{style:vO,children:n}),u.jsx("span",{style:wO,children:r})]},n))]},t.title))]})})),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",overflowY:"auto",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",borderRadius:4,padding:"3px 10px"},mO={fontSize:13,color:"#6a6a75",marginTop:4},gO={fontSize:14,fontWeight:700,color:"#8ab4f8",marginBottom:6},yO={display:"flex",gap:16,padding:"3px 0"},vO={width:290,flexShrink:0,color:"#c5a3ff",fontWeight:600,fontSize:13},wO={color:"#C9C9D4",fontSize:13},a0={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`}},xO=({plan:e,onConfirm:t,onCancel:n})=>{const[r,o]=d.useState(e.targets[0]),i=d.useRef(null),s=d.useRef(null);return d.useEffect(()=>{const a=l=>{if(l.key==="Escape"){l.stopPropagation(),n();return}if(l.key!=="Tab")return;const c=i.current;if(!c)return;const f=c.querySelectorAll("input, button"),p=f[0],h=f[f.length-1];!p||!h||(l.shiftKey&&document.activeElement===p?(l.preventDefault(),h.focus()):!l.shiftKey&&document.activeElement===h&&(l.preventDefault(),p.focus()))};return window.addEventListener("keydown",a,!0),()=>window.removeEventListener("keydown",a,!0)},[n]),d.useEffect(()=>{var l;const a=document.activeElement;return(l=s.current)==null||l.focus(),()=>{var c;return(c=a==null?void 0:a.focus)==null?void 0:c.call(a)}},[]),u.jsx("div",{style:bO,onMouseDown:n,children:u.jsxs("form",{ref:i,"data-testid":"delete-scene-modal",role:"dialog","aria-modal":"true","aria-label":`Delete ${e.rootId}`,style:SO,onMouseDown:a=>a.stopPropagation(),onSubmit:a=>{a.preventDefault(),t(r)},children:[u.jsxs("div",{style:kO,children:[u.jsxs("span",{style:EO,children:["delete ",e.rootId,e.isSplitHalf?u.jsx("span",{style:CO,children:"half"}):null,"?"]}),u.jsx("span",{style:IO,children:"esc cancel"})]}),u.jsx("div",{style:jO,children:"undoable with ⌘Z, like every other edit"}),u.jsx("div",{style:{marginTop:16},children:e.targets.map(a=>u.jsxs("label",{style:TO,"data-testid":`delete-option-${a}`,children:[u.jsx("input",{type:"radio",name:"delete-target",value:a,checked:r===a,onChange:()=>o(a),style:RO}),u.jsxs("span",{children:[u.jsx("span",{style:FO,children:a0[a].label}),u.jsx("span",{style:PO,children:a0[a].detail(e)})]})]},a))}),u.jsxs("div",{style:$O,children:[u.jsx("button",{type:"button","data-testid":"delete-cancel",style:Tk,onClick:n,children:"Cancel"}),u.jsx("button",{ref:s,type:"submit","data-testid":"delete-confirm",style:MO,children:"Delete"})]})]})})},bO={position:"fixed",inset:0,zIndex:30,background:"rgba(5,5,8,0.6)",display:"flex",alignItems:"center",justifyContent:"center"},SO={width:420,maxWidth:"90vw",background:"#12121A",border:"1px solid #3A3A48",borderRadius:8,padding:"18px 22px 20px",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace"},kO={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12},EO={fontSize:16,fontWeight:700,color:"#EDEDF2"},CO={fontSize:11,fontWeight:700,color:"#0B0B0E",background:"#c5a3ff",borderRadius:4,padding:"2px 6px",marginLeft:6},IO={fontSize:12,fontWeight:700,color:"#0B0B0E",background:"#a8c7fa",borderRadius:4,padding:"3px 10px",whiteSpace:"nowrap"},jO={fontSize:12,color:"#6a6a75",marginTop:4},TO={display:"flex",alignItems:"flex-start",gap:10,padding:"8px 0",cursor:"pointer"},RO={accentColor:"#8ab4f8",marginTop:2,cursor:"pointer"},FO={display:"block",fontSize:13,fontWeight:600,color:"#EDEDF2"},PO={display:"block",fontSize:12,color:"#9A9AA3",marginTop:2},$O={display:"flex",justifyContent:"flex-end",gap:8,marginTop:14},Tk={fontSize:12,fontWeight:600,color:"#C9C9D4",background:"transparent",border:"1px solid #2A2A33",borderRadius:6,padding:"7px 12px",cursor:"pointer",fontFamily:"inherit"},MO={...Tk,color:"#FF5C5C",border:"1px solid #452626"},l0={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`}},_O=({plan:e,onConfirm:t,onCancel:n})=>{const[r,o]=d.useState(e.targets[0]),i=d.useRef(null),s=d.useRef(null);d.useEffect(()=>{const l=c=>{if(c.key==="Escape"){c.stopPropagation(),n();return}if(c.key!=="Tab")return;const f=i.current;if(!f)return;const p=f.querySelectorAll("input, button"),h=p[0],g=p[p.length-1];!h||!g||(c.shiftKey&&document.activeElement===h?(c.preventDefault(),g.focus()):!c.shiftKey&&document.activeElement===g&&(c.preventDefault(),h.focus()))};return window.addEventListener("keydown",l,!0),()=>window.removeEventListener("keydown",l,!0)},[n]),d.useEffect(()=>{var c;const l=document.activeElement;return(c=s.current)==null||c.focus(),()=>{var f;return(f=l==null?void 0:l.focus)==null?void 0:f.call(l)}},[]);const a=e.words.length;return u.jsx("div",{style:AO,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:NO,onMouseDown:l=>l.stopPropagation(),onSubmit:l=>{l.preventDefault(),t(r)},children:[u.jsxs("div",{style:LO,children:[u.jsxs("span",{style:OO,children:["delete ",a," word",a===1?"":"s","?"]}),u.jsx("span",{style:DO,children:"esc cancel"})]}),u.jsx("div",{style:zO,children:"undoable with ⌘Z, like every other edit"}),u.jsx("div",{style:{marginTop:16},children:e.targets.map(l=>u.jsxs("label",{style:BO,"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:WO}),u.jsxs("span",{children:[u.jsx("span",{style:VO,children:l0[l].label}),u.jsx("span",{style:HO,children:l0[l].detail(e)})]})]},l))}),u.jsxs("div",{style:UO,children:[u.jsx("button",{type:"button","data-testid":"delete-words-cancel",style:Rk,onClick:n,children:"Cancel"}),u.jsx("button",{ref:s,type:"submit","data-testid":"delete-words-confirm",style:ZO,children:"Delete"})]})]})})},AO={position:"fixed",inset:0,zIndex:30,background:"rgba(5,5,8,0.6)",display:"flex",alignItems:"center",justifyContent:"center"},NO={width:420,maxWidth:"90vw",background:"#12121A",border:"1px solid #3A3A48",borderRadius:8,padding:"18px 22px 20px",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace"},LO={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12},OO={fontSize:16,fontWeight:700,color:"#EDEDF2"},DO={fontSize:12,fontWeight:700,color:"#0B0B0E",background:"#a8c7fa",borderRadius:4,padding:"3px 10px",whiteSpace:"nowrap"},zO={fontSize:12,color:"#6a6a75",marginTop:4},BO={display:"flex",alignItems:"flex-start",gap:10,padding:"8px 0",cursor:"pointer"},WO={accentColor:"#8ab4f8",marginTop:2,cursor:"pointer"},VO={display:"block",fontSize:13,fontWeight:600,color:"#EDEDF2"},HO={display:"block",fontSize:12,color:"#9A9AA3",marginTop:2},UO={display:"flex",justifyContent:"flex-end",gap:8,marginTop:14},Rk={fontSize:12,fontWeight:600,color:"#C9C9D4",background:"transparent",border:"1px solid #2A2A33",borderRadius:6,padding:"7px 12px",cursor:"pointer",fontFamily:"inherit"},ZO={...Rk,color:"#FF5C5C",border:"1px solid #452626"},KO=(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("/")}},u0=e=>e.scrollTop+e.clientHeight<e.scrollHeight-1,YO=(e,t,n)=>n<=0?-1:Math.max(0,Math.min(n-1,e+t)),c0=({recent:e,required:t,onOpen:n,onClose:r})=>{const[o,i]=d.useState(null),[s,a]=d.useState(null),[l,c]=d.useState(!1),f=d.useRef(null),p=d.useRef(null),[h,g]=d.useState(!1),[w,x]=d.useState(!1),k=()=>{g(f.current?u0(f.current):!1)},m=()=>{x(p.current?u0(p.current):!1)},v=async b=>{try{const E=await fetch(`/api/fs${b?`?dir=${encodeURIComponent(b)}`:""}`),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(()=>{v()},[]),d.useEffect(()=>{const b=()=>{k(),m()};return b(),window.addEventListener("resize",b),()=>window.removeEventListener("resize",b)},[o,e]),d.useEffect(()=>{if(t)return;const b=E=>{E.key==="Escape"&&(E.stopPropagation(),r())};return window.addEventListener("keydown",b,!0),()=>window.removeEventListener("keydown",b,!0)},[t,r]);const y=b=>{var P;const E=b.key==="ArrowDown"?1:b.key==="ArrowUp"?-1:0;if(E===0&&b.key!=="Home"&&b.key!=="End")return;const C=Array.from(b.currentTarget.querySelectorAll("button"));if(C.length===0)return;const j=C.indexOf(document.activeElement),I=b.key==="Home"?0:b.key==="End"?C.length-1:YO(j,E,C.length);b.preventDefault(),(P=C[I])==null||P.focus()},S=b=>{c(!0),a(null),n(b).then(E=>{c(!1),E&&a(E)})};return u.jsx("div",{style:GO,onMouseDown:t?void 0:r,children:u.jsxs("div",{"data-testid":"project-picker",style:XO,onMouseDown:b=>b.stopPropagation(),children:[u.jsxs("div",{style:qO,children:[u.jsx("span",{style:JO,children:t?"open a project":"switch project"}),t?null:u.jsx("button",{"data-testid":"project-picker-close",style:QO,onClick:r,children:"esc close"})]}),u.jsx("div",{style:eD,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:tD,children:s}):null,e.length>0?u.jsxs("div",{style:{marginTop:16,flexShrink:0},children:[u.jsx("div",{style:d0,children:"recent"}),u.jsx("div",{ref:p,className:"ossclip-scroll-list",style:w?{...f0,...h0}:f0,onScroll:m,onKeyDown:y,"data-testid":"project-recent-list",children:e.map(b=>{const{head:E,tail:C}=KO(b);return u.jsxs("button",{"data-testid":"project-recent",className:"ossclip-picker-row",style:{...ef,...sD},disabled:l,onClick:()=>S(b),title:b,children:[u.jsx("span",{style:{color:"#FFE14D",flexShrink:0},children:"▸"}),u.jsxs("span",{style:aD,children:[u.jsx("span",{style:lD,children:C}),E?u.jsx("span",{style:uD,children:E}):null]})]},b)})})]}):null,u.jsxs("div",{style:iD,children:[u.jsx("div",{style:d0,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:nD,children:[u.jsx("span",{style:rD,title:o.dir,children:o.dir}),o.isWorkdir?u.jsx("button",{"data-testid":"project-open-current",style:oD,disabled:l,onClick:()=>S(o.dir),children:"open this project"}):null]}),u.jsxs("div",{ref:f,className:"ossclip-scroll-list",style:h?{...p0,...h0}:p0,onScroll:k,onKeyDown:y,"data-testid":"project-fs-list",children:[o.parent?u.jsxs("button",{"data-testid":"project-fs-up",className:"ossclip-picker-row",style:ef,disabled:l,onClick:()=>void v(o.parent),children:[u.jsx("span",{style:{color:"#6a6a75",flexShrink:0},children:"↑"}),u.jsx("span",{style:m0,children:".."})]}):null,o.entries.map(b=>u.jsxs("button",{"data-testid":b.isWorkdir?"project-fs-workdir":"project-fs-dir",className:`ossclip-picker-row${b.isWorkdir?" is-workdir":""}`,style:ef,disabled:l,onClick:()=>b.isWorkdir?S(b.path):void v(b.path),title:b.path,children:[u.jsx("span",{style:{flexShrink:0,color:b.isWorkdir?"#FFE14D":"#6a6a75"},children:b.isWorkdir?"▸":"▪"}),u.jsxs("span",{style:m0,children:[b.name,b.isWorkdir?null:u.jsx("span",{style:{color:"#55555f"},children:"/"})]}),b.isWorkdir?u.jsx("span",{style:cD,children:"project"}):null]},b.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…"})]})]})})},GO={position:"fixed",inset:0,zIndex:30,background:"rgba(5,5,8,0.6)",display:"flex",alignItems:"center",justifyContent:"center"},XO={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"},qO={display:"flex",justifyContent:"space-between",alignItems:"center"},JO={fontSize:18,fontWeight:700,color:"#EDEDF2"},QO={fontSize:13,fontWeight:700,color:"#0B0B0E",background:"#a8c7fa",border:"none",borderRadius:4,padding:"3px 10px",cursor:"pointer"},eD={fontSize:13,color:"#6a6a75",marginTop:4},tD={marginTop:12,fontSize:13,color:"#FF5C5C"},d0={fontSize:14,fontWeight:700,color:"#8ab4f8",marginBottom:6},nD={display:"flex",alignItems:"center",gap:10,marginBottom:6},rD={fontSize:12,color:"#9A9AA3",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},oD={flexShrink:0,fontSize:12,fontWeight:700,color:"#0B0B0E",background:"#FFE14D",border:"1px solid #FFE14D",borderRadius:6,padding:"4px 10px",cursor:"pointer"},iD={marginTop:16,display:"flex",flexDirection:"column",flex:1,minHeight:0},f0={maxHeight:218,overflowY:"auto",overscrollBehavior:"contain",flexShrink:0,display:"flex",flexDirection:"column",gap:2},p0={flex:1,minHeight:0,overflowY:"auto",overscrollBehavior:"contain",display:"flex",flexDirection:"column",gap:2},h0={maskImage:"linear-gradient(to bottom, black calc(100% - 24px), transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black calc(100% - 24px), transparent 100%)"},ef={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"},m0={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},sD={minHeight:46,alignItems:"center"},aD={display:"flex",flexDirection:"column",minWidth:0},lD={color:"#EDEDF2",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},uD={fontSize:11,color:"#6a6a75",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},cD={marginLeft:10,fontSize:11,fontWeight:700,color:"#FFE14D"},dD=({defaultOutPath:e,onCancel:t,onConfirm:n})=>{const[r,o]=d.useState(e??""),[i,s]=ge.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:fD,onMouseDown:t,children:u.jsxs("div",{"data-testid":"render-modal",style:pD,onMouseDown:f=>f.stopPropagation(),children:[u.jsxs("div",{style:hD,children:[u.jsx("div",{style:mD,children:"🎬 Render Master Video"}),u.jsx("button",{style:gD,onClick:t,children:"✕"})]}),u.jsx("div",{style:yD,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:vD,children:"Export File Destination"}),u.jsxs("div",{style:wD,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:xD,autoFocus:!0}),u.jsx("button",{"data-testid":"render-browse-btn",style:bD,onClick:c,disabled:a,title:"Open native file picker to choose destination",children:a?"Browsing…":"📁 Browse…"})]})]}),u.jsxs("div",{style:SD,children:[u.jsx("button",{style:kD,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:ED,onClick:()=>n(r.trim()?r.trim():void 0,i),children:"Start Render ⚡"})]})]})})},fD={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},pD={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"},hD={display:"flex",justifyContent:"space-between",alignItems:"center"},mD={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},gD={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},yD={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},vD={display:"block",fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.04em"},wD={display:"flex",gap:8},xD={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"},bD={background:"#1E1E2A",border:"1px solid #3A3A48",borderRadius:6,color:"#EDEDF2",padding:"0 16px",fontSize:13,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap"},SD={display:"flex",justifyContent:"flex-end",gap:12,marginTop:24},kD={background:"transparent",border:"1px solid #2C2C38",borderRadius:6,color:"#C9C9D4",padding:"9px 18px",fontSize:13,fontWeight:600,cursor:"pointer"},ED={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 CD(e){switch(e){case"override":return"Project override";case"flag":case"config":return"Your default portrait"}}function ID(e){const t=/^data:([^;,]+);base64,(.+)$/s.exec(e);return t?{mimeType:t[1],data:t[2]}:null}function jD(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 g0=60,TD=({onClose:e})=>{const[t,n]=d.useState(null),[r,o]=d.useState(null),[i,s]=d.useState(""),[a,l]=d.useState(""),[c,f]=d.useState(""),[p,h]=d.useState(null),[g,w]=d.useState(!1),[x,k]=d.useState(null),[m,v]=d.useState(null),y=d.useRef(null);d.useEffect(()=>{const I=P=>{P.key==="Escape"&&(P.stopPropagation(),e())};return window.addEventListener("keydown",I,!0),()=>window.removeEventListener("keydown",I,!0)},[e]),d.useEffect(()=>{(async()=>{try{const I=await fetch("/api/thumbnail"),P=await I.json();if(!I.ok)throw new Error(P.error??`GET /api/thumbnail failed: ${I.status}`);n(P),h(P.imageUrl),P.concept&&(s(P.concept.overlayText),l(P.concept.scene),f(P.concept.styleNotes))}catch(I){o(I instanceof Error?I.message:String(I))}})()},[]);const S=async()=>{w(!0),k(null);try{const I=await fetch("/api/thumbnail/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({concept:{scene:a,overlayText:i,styleNotes:c}})}),P=await I.json();if(!I.ok||P.ok!==!0){k(P.error??`regenerate failed: ${I.status}`);return}h(P.imageUrl??null)}catch(I){k(I instanceof Error?I.message:String(I))}finally{w(!1)}},b=I=>{n(P=>P&&{...P,portrait:I})},E=async I=>{v(null);try{const P=await new Promise((A,U)=>{const z=new FileReader;z.onload=()=>A(String(z.result)),z.onerror=()=>U(new Error("could not read the image file")),z.readAsDataURL(I)}),L=ID(P);if(L===null){v("could not read the image file");return}const W=await fetch("/api/thumbnail/portrait",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(L)}),$=await W.json();if(!W.ok||$.ok!==!0){v($.error??`swap failed: ${W.status}`);return}b($.portrait??null)}catch(P){v(P instanceof Error?P.message:String(P))}},C=async()=>{v(null);try{const I=await fetch("/api/thumbnail/portrait",{method:"DELETE"}),P=await I.json();if(!I.ok||P.ok!==!0){v(P.error??`reset failed: ${I.status}`);return}b(P.portrait??null)}catch(I){v(I instanceof Error?I.message:String(I))}},j=(t==null?void 0:t.status)==="unavailable";return u.jsx("div",{style:RD,onMouseDown:e,children:u.jsxs("div",{"data-testid":"thumbnail-modal",style:FD,onMouseDown:I=>I.stopPropagation(),children:[u.jsxs("div",{style:PD,children:[u.jsx("div",{style:$D,children:"AI Thumbnail"}),u.jsx("button",{style:MD,onClick:e,"aria-label":"Close",children:"✕"})]}),r?u.jsxs("div",{"data-testid":"thumbnail-load-error",style:of,children:["Couldn't load the thumbnail state: ",r]}):t===null?u.jsx("div",{style:tf,children:"Loading…"}):j?u.jsx("div",{"data-testid":"thumbnail-unavailable",style:{...tf,marginTop:12},children:jD(t.reason)}):u.jsxs(u.Fragment,{children:[t.status==="skipped"?u.jsx("div",{"data-testid":"thumbnail-skipped-note",style:{...tf,marginTop:8},children:"Thumbnail was skipped at the concept approval prompt — regenerating replaces that decision."}):null,u.jsx("div",{style:_D,children:p?u.jsx("img",{"data-testid":"thumbnail-image",src:p,alt:"Current AI thumbnail",style:AD}):u.jsx("div",{"data-testid":"thumbnail-placeholder",style:ND,children:"No thumbnail generated yet — edit the concept and hit Regenerate."})}),t.portrait?u.jsxs("div",{"data-testid":"portrait-strip",style:LD,children:[u.jsx("img",{"data-testid":"portrait-preview",src:t.portrait.url,alt:"Portrait reference",style:OD}),u.jsxs("div",{style:{flex:1,minWidth:0},children:[u.jsx("div",{"data-testid":"portrait-source",style:DD,children:CD(t.portrait.source)}),u.jsx("div",{style:v0,children:"The swap applies to this project only and is used by future renders too."})]}),u.jsx("button",{"data-testid":"portrait-swap-btn",style:y0,onClick:()=>{var I;return(I=y.current)==null?void 0:I.click()},disabled:g,children:"Swap face…"}),t.portrait.source==="override"?u.jsx("button",{"data-testid":"portrait-reset-btn",style:y0,onClick:()=>void C(),disabled:g,children:"Use default"}):null,u.jsx("input",{ref:y,"data-testid":"portrait-file-input",type:"file",accept:"image/png,image/jpeg,image/webp",style:{display:"none"},onChange:I=>{var L;const P=(L=I.target.files)==null?void 0:L[0];I.target.value="",P&&E(P)}})]}):null,m?u.jsx("div",{"data-testid":"portrait-error",style:of,children:m}):null,u.jsxs("div",{style:{marginTop:16},children:[u.jsxs("label",{style:nf,children:["Overlay text — the words ON the image (",g0," chars, 4–9 words)"]}),u.jsx("input",{"data-testid":"thumbnail-overlay-input",type:"text",maxLength:g0,value:i,onChange:I=>s(I.target.value),style:rf})]}),u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:nf,children:"Scene — what the image shows"}),u.jsx("textarea",{"data-testid":"thumbnail-scene-input",value:a,onChange:I=>l(I.target.value),rows:3,style:{...rf,resize:"vertical"}})]}),u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:nf,children:"Style notes — palette, lighting, mood"}),u.jsx("textarea",{"data-testid":"thumbnail-style-input",value:c,onChange:I=>f(I.target.value),rows:3,style:{...rf,resize:"vertical"}})]}),x?u.jsx("div",{"data-testid":"thumbnail-error",style:of,children:x}):null,u.jsxs("div",{style:zD,children:[u.jsx("div",{style:v0,children:"Regenerating replaces the video's .thumbnail.png and saves this concept for future renders."}),u.jsx("button",{"data-testid":"thumbnail-regenerate-btn",style:{...BD,...g?{opacity:.6,cursor:"default"}:{}},onClick:()=>void S(),disabled:g,children:g?"Generating…":"Regenerate"})]})]})]})})},RD={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},FD={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"},PD={display:"flex",justifyContent:"space-between",alignItems:"center"},$D={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},MD={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},tf={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},_D={marginTop:16,border:"1px solid #2C2C38",borderRadius:6,background:"#09090D",aspectRatio:"16 / 9",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},AD={width:"100%",height:"100%",objectFit:"contain"},ND={color:"#8B8B9E",fontSize:13,padding:16,textAlign:"center"},LD={display:"flex",alignItems:"center",gap:12,marginTop:12,padding:"10px 12px",border:"1px solid #2C2C38",borderRadius:6,background:"#09090D"},OD={width:44,height:44,borderRadius:6,objectFit:"cover",flexShrink:0,border:"1px solid #2C2C38"},DD={fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:2},y0={background:"transparent",border:"1px solid #3A3A48",borderRadius:6,color:"#C9C9D4",padding:"7px 12px",fontSize:12,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap"},nf={display:"block",fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.04em"},rf={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"},of={marginTop:12,color:"#FF5C5C",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",whiteSpace:"pre-wrap"},zD={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,marginTop:20},v0={fontSize:12,color:"#8B8B9E",lineHeight:1.4},BD={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)"},WD=({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=H5(e),o=t.doc.cleanup.kept.length;return u.jsx("div",{style:HD,onMouseDown:n,children:u.jsxs("div",{"data-testid":"cleanup-modal",style:UD,onMouseDown:i=>i.stopPropagation(),children:[u.jsxs("div",{style:ZD,children:[u.jsx("div",{style:KD,children:"Cleanup"}),u.jsx("button",{style:YD,onClick:n,"aria-label":"Close",children:"✕"})]}),u.jsx("div",{style:sf,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:{...sf,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:w0,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:{...GD,background:wm[i.reason]}}),u.jsxs("span",{style:{...x0,...s?{}:{color:"#8B8B9E"}},children:[V5[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:XD,children:"kept — live in the preview"})]},i.reason)})}),o>0?u.jsxs("div",{"data-testid":"cleanup-kept-note",style:{...qD,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:{...sf,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:w0,children:[u.jsxs("span",{style:x0,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:VD,onClick:()=>t.restoreDismissed(i.srcIn,i.srcOut),children:"Restore proposal"})]},`${i.srcIn}-${i.srcOut}`))]}):null]})})},VD={fontSize:12,fontWeight:600,color:"#C9C9D4",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:6,padding:"5px 10px",cursor:"pointer",whiteSpace:"nowrap"},HD={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},UD={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"},ZD={display:"flex",justifyContent:"space-between",alignItems:"center"},KD={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},YD={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},sf={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},w0={display:"flex",alignItems:"center",gap:10,padding:"8px 10px",border:"1px solid #2C2C38",borderRadius:6,background:"#09090D",marginBottom:8,cursor:"pointer"},GD={width:10,height:10,borderRadius:2,flexShrink:0},x0={fontSize:13,color:"#EDEDF2",flex:1,minWidth:0},XD={fontSize:11,color:"#FFE14D",whiteSpace:"nowrap"},qD={fontSize:12,color:"#8B8B9E",lineHeight:1.4},b0=3,S0=5,af=500;function JD(e){return e.split(/\s+/).filter(t=>t.replace(/^#+/,"").length>0).map(t=>t.startsWith("#")?t:`#${t}`)}function QD(e){return e.map(t=>t.startsWith("#")?t:`#${t}`).join(" ")}function Fk(e){return e.split(",").map(t=>t.trim()).filter(t=>t.length>0)}function Pk(e){return e.join(", ")}function e6(e){return Pk(Fk(e)).length}function t6(e){const t=Math.max(0,Math.floor(e));return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function n6(e){return`[${{browse:"Browse",search:"Search",benefit:"Benefit",alt:"Alt"}[e]}]`}const r6="This run never generated YouTube metadata. Run produce with --youtube (and an LLM provider) once — the pack lands here afterwards.",o6=({onClose:e})=>{var W;const[t,n]=d.useState(null),[r,o]=d.useState(null),[i,s]=d.useState([]),[a,l]=d.useState(null),[c,f]=d.useState(""),[p,h]=d.useState(""),[g,w]=d.useState(""),[x,k]=d.useState(null),[m,v]=d.useState(null),[y,S]=d.useState(null),[b,E]=d.useState(!1),[C,j]=d.useState(null);d.useEffect(()=>{const $=A=>{A.key==="Escape"&&(A.stopPropagation(),e())};return window.addEventListener("keydown",$,!0),()=>window.removeEventListener("keydown",$,!0)},[e]);const I=d.useCallback(async()=>{try{const $=await fetch("/api/youtube"),A=await $.json();if(!$.ok)throw new Error(A.error??`GET /api/youtube failed: ${$.status}`);n(A),A.pack&&(s(A.pack.titles),l(A.pack.titleAngles??null),f(A.pack.description),h(QD(A.pack.hashtags)),w(Pk(A.pack.tags)),k(A.pack.hook60??null),v(A.pack.linkedinPost??null),S(A.pack.communityPost??null))}catch($){o($ instanceof Error?$.message:String($))}},[]);d.useEffect(()=>{I()},[I]);const P=async()=>{var $;E(!0),j(null);try{const A=await fetch("/api/youtube",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({pack:{titles:i,...a!==null?{titleAngles:a}:{},description:c,hashtags:JD(p),tags:Fk(g),...($=t==null?void 0:t.pack)!=null&&$.chapters?{chapters:t.pack.chapters}:{},...x!==null?{hook60:x}:{},...m!==null?{linkedinPost:m}:{},...y!==null?{communityPost:y}:{}}})}),U=await A.json();if(!A.ok||U.ok!==!0){j(U.error??`save failed: ${A.status}`);return}await I()}catch(A){j(A instanceof Error?A.message:String(A))}finally{E(!1)}},L=e6(g);return u.jsx("div",{style:i6,onMouseDown:e,children:u.jsxs("div",{"data-testid":"youtube-modal",style:s6,onMouseDown:$=>$.stopPropagation(),children:[u.jsxs("div",{style:a6,children:[u.jsx("div",{style:l6,children:"YouTube SEO metadata"}),u.jsx("button",{style:u6,onClick:e,"aria-label":"Close",children:"✕"})]}),r?u.jsxs("div",{"data-testid":"youtube-load-error",style:C0,children:["Couldn't load the YouTube pack: ",r]}):t===null?u.jsx("div",{style:k0,children:"Loading…"}):t.available?u.jsxs(u.Fragment,{children:[u.jsxs("div",{style:{marginTop:16},children:[u.jsxs("label",{style:Kr,children:["Title options (",b0,"–",S0,", up to 100 chars each)"]}),i.map(($,A)=>u.jsxs("div",{style:c6,children:[(a==null?void 0:a[A])!==void 0?u.jsx("span",{"data-testid":`youtube-title-angle-${A}`,style:d6,children:n6(a[A])}):null,u.jsx("input",{"data-testid":`youtube-title-input-${A}`,type:"text",maxLength:100,value:$,onChange:U=>s(z=>z.map((O,R)=>R===A?U.target.value:O)),style:To}),u.jsx("button",{"data-testid":`youtube-title-remove-${A}`,style:E0,disabled:i.length<=b0,onClick:()=>{s(U=>U.filter((z,O)=>O!==A)),l(U=>U&&U.filter((z,O)=>O!==A))},"aria-label":`Remove title ${A+1}`,children:"✕"})]},A)),u.jsx("button",{"data-testid":"youtube-title-add",style:E0,disabled:i.length>=S0,onClick:()=>{s($=>[...$,""]),l($=>$&&[...$,"alt"])},children:"+ Add title"})]}),u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Kr,children:"Description"}),u.jsx("textarea",{"data-testid":"youtube-description-input",value:c,onChange:$=>f($.target.value),rows:6,style:{...To,resize:"vertical"}})]}),u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Kr,children:"Hashtags — space-separated, # added if missing"}),u.jsx("input",{"data-testid":"youtube-hashtags-input",type:"text",value:p,onChange:$=>h($.target.value),style:To})]}),u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Kr,children:"Tags — comma-separated"}),u.jsx("input",{"data-testid":"youtube-tags-input",type:"text",value:g,onChange:$=>w($.target.value),style:To}),u.jsxs("div",{"data-testid":"youtube-tags-counter",style:{...f6,...L>af?{color:"#FFB84D"}:{}},children:[L," / ",af,L>af?" — tags past the budget are dropped on save":""]})]}),(W=t.pack)!=null&&W.chapters&&t.pack.chapters.length>0?u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Kr,children:"Chapters (read-only — embedded in the description on save/render)"}),u.jsx("div",{"data-testid":"youtube-chapters",style:p6,children:t.pack.chapters.map(($,A)=>u.jsxs("div",{children:[t6($.atSec)," ",$.title]},A))}),u.jsx("div",{style:I0,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:Kr,children:"First-60s hook strategy (for you — never uploaded)"}),u.jsx("textarea",{"data-testid":"youtube-hook60-input",value:x,onChange:$=>k($.target.value),rows:3,style:{...To,resize:"vertical"}})]}):null,m!==null?u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Kr,children:"LinkedIn post"}),u.jsx("textarea",{"data-testid":"youtube-linkedin-input",value:m,onChange:$=>v($.target.value),rows:6,style:{...To,resize:"vertical"}})]}):null,y!==null?u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Kr,children:"Community post"}),u.jsx("textarea",{"data-testid":"youtube-community-input",value:y,onChange:$=>S($.target.value),rows:3,style:{...To,resize:"vertical"}})]}):null,C?u.jsx("div",{"data-testid":"youtube-error",style:C0,children:C}):null,u.jsxs("div",{style:h6,children:[u.jsx("div",{style:I0,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:{...m6,...b?{opacity:.6,cursor:"default"}:{}},onClick:()=>void P(),disabled:b,children:b?"Saving…":"Save"})]})]}):u.jsx("div",{"data-testid":"youtube-unavailable",style:{...k0,marginTop:12},children:r6})]})})},i6={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},s6={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"},a6={display:"flex",justifyContent:"space-between",alignItems:"center"},l6={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},u6={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},k0={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},Kr={display:"block",fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.04em"},To={width:"100%",boxSizing:"border-box",background:"#09090D",border:"1px solid #2C2C38",borderRadius:6,padding:"10px 14px",color:"#EDEDF2",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",outline:"none"},c6={display:"flex",gap:8,alignItems:"center",marginBottom:8},d6={fontSize:11,fontWeight:700,color:"#8B8B9E",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",whiteSpace:"nowrap",minWidth:62},E0={fontSize:12,fontWeight:600,color:"#C9C9D4",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:6,padding:"6px 10px",cursor:"pointer",whiteSpace:"nowrap"},f6={marginTop:6,fontSize:12,color:"#8B8B9E",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace"},p6={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},C0={marginTop:12,color:"#FF5C5C",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",whiteSpace:"pre-wrap"},h6={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,marginTop:20},I0={fontSize:12,color:"#8B8B9E",lineHeight:1.4,marginTop:6},m6={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 g6(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 y6(e){const t=e.trim().replace(/\s+/g," "),n=K4(t);return{preview:n,trimmed:n!==t}}function $k(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 j0(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 v6(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 T0(e){return{...e.typed===(e.persistedText??"")?{}:{text:e.typed},...e.atSec===void 0?{}:{atSec:e.atSec},from:e.from}}function w6(e){if(e.from==="final")return{atSec:e.playheadOutSec,note:null};const t=new Wc(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 x6(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 b6(e){if(e.prevFrom===e.nextFrom)return null;const t=$k(e.atRaw);if(!t.ok||t.atSec===void 0)return null;const n=new Wc(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 S6=({onClose:e,playheadSec:t})=>{const[n,r]=d.useState(null),[o,i]=d.useState(null),[s,a]=d.useState(""),[l,c]=d.useState(""),[f,p]=d.useState("final"),[h,g]=d.useState(null),[w,x]=d.useState(!1),[k,m]=d.useState(null),[v,y]=d.useState([]),[S,b]=d.useState([]),[E,C]=d.useState(null),[j,I]=d.useState(null);d.useEffect(()=>{const z=O=>{O.key==="Escape"&&(O.stopPropagation(),e())};return window.addEventListener("keydown",z,!0),()=>window.removeEventListener("keydown",z,!0)},[e]),d.useEffect(()=>{(async()=>{try{const z=await fetch("/api/cover"),O=await z.json();if(!z.ok)throw new Error(O.error??`GET /api/cover failed: ${z.status}`);r(O),g(O.imageUrl),b(O.cutlist??[]),O.provenance&&(a(O.provenance.text),j0(O.provenance).enabled&&p(O.provenance.frame.source))}catch(z){i(z instanceof Error?z.message:String(z))}})()},[]);const P=$k(l),L=y6(s),W=j0((n==null?void 0:n.provenance)??null),$=async()=>{var z;if(P.ok){x(!0),m(null),y([]);try{const O=await fetch("/api/cover/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(T0({typed:s,persistedText:((z=n==null?void 0:n.provenance)==null?void 0:z.text)??null,atSec:P.atSec,from:f}))}),R=await O.json();if(!O.ok||R.ok!==!0){m(R.error??`regenerate failed: ${O.status}`);return}if(g(R.imageUrl??null),I(null),y(R.notes??[]),R.provenance){const Z=R.provenance;r(B=>B&&{...B,provenance:Z,status:"ready"}),a(Z.text)}}catch(O){m(O instanceof Error?O.message:String(O))}finally{x(!1)}}},A=async()=>{var z;if(P.ok){x(!0),m(null),y([]);try{const O=await fetch("/api/cover/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(T0({typed:s,persistedText:((z=n==null?void 0:n.provenance)==null?void 0:z.text)??null,atSec:P.atSec,from:f}))}),R=await O.json();if(!O.ok||R.ok!==!0){m(R.error??`preview failed: ${O.status}`);return}I(R.previewImageUrl??null),y(R.notes??[])}catch(O){m(O instanceof Error?O.message:String(O))}finally{x(!1)}}},U=(n==null?void 0:n.status)==="unavailable";return u.jsx("div",{style:k6,onMouseDown:e,children:u.jsxs("div",{"data-testid":"cover-modal",style:E6,onMouseDown:z=>z.stopPropagation(),children:[u.jsxs("div",{style:C6,children:[u.jsx("div",{style:I6,children:"Cover image"}),u.jsx("button",{style:j6,onClick:e,"aria-label":"Close",children:"✕"})]}),o?u.jsxs("div",{"data-testid":"cover-load-error",style:lf,children:["Couldn't load the cover state: ",o]}):n===null?u.jsx("div",{style:R0,children:"Loading…"}):U?u.jsx("div",{"data-testid":"cover-unavailable",style:{...R0,marginTop:12},children:g6(n.reason)}):u.jsxs(u.Fragment,{children:[u.jsx("div",{style:T6,children:j?u.jsx("img",{"data-testid":"cover-image",src:j,alt:"Cover preview",style:F0}):h?u.jsx("img",{"data-testid":"cover-image",src:h,alt:"Current cover",style:F0}):u.jsx("div",{"data-testid":"cover-placeholder",style:F6,children:"No cover on disk yet — set a headline and hit Apply."})}),j?u.jsx("div",{"data-testid":"cover-preview-badge",style:R6,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:P0,children:["Headline — at most ",YS," words (§35)"]}),u.jsx("input",{"data-testid":"cover-text-input",type:"text",value:s,onChange:z=>a(z.target.value),style:$0}),L.trimmed?u.jsxs("div",{"data-testid":"cover-headline-preview",style:{...Ro,marginTop:6},children:["Will render as: “",L.preview,"”"]}):null]}),u.jsxs("div",{style:{marginTop:16},children:[u.jsx("label",{style:P0,children:"Frame"}),u.jsxs("div",{style:M0,children:[u.jsx("button",{"data-testid":"cover-playhead-btn",style:zl,onClick:()=>{const z=t(),O=w6({playheadOutSec:z.sec,from:f,cutlist:S});c(O.atSec.toFixed(2)),C(z.snapped?[x6(z.sec),O.note].filter(R=>R!==null).join(" "):O.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:z=>{c(z.target.value),C(null)},style:{...$0,flex:1}})]}),P.ok?null:u.jsx("div",{"data-testid":"cover-at-error",style:lf,children:P.message}),E?u.jsx("div",{"data-testid":"cover-clock-note",style:{...Ro,marginTop:6},children:E}):null,u.jsx("div",{style:{...M0,marginTop:10},children:["final","source"].map(z=>{const O=z==="source"&&!W.enabled;return u.jsx("button",{"data-testid":`cover-from-${z}`,style:{...zl,...f===z?P6:{},...O?{opacity:.5,cursor:"default"}:{}},onClick:()=>{const R=b6({atRaw:l,prevFrom:f,nextFrom:z,cutlist:S});R!==null&&(c(R.atRaw),C(R.note)),p(z)},disabled:w||O,"aria-pressed":f===z,children:z==="final"?"Finished video":"Original take"},z)})}),u.jsx("div",{"data-testid":"cover-from-note",style:{...Ro,marginTop:6},children:v6(f)}),W.note?u.jsx("div",{"data-testid":"cover-from-disabled-note",style:{...Ro,marginTop:4},children:W.note}):null,u.jsx("div",{style:{...Ro,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."})]}),v.length>0?u.jsx("div",{"data-testid":"cover-notes",style:{...Ro,marginTop:12},children:v.map(z=>u.jsx("div",{children:z},z))}):null,k?u.jsx("div",{"data-testid":"cover-error",style:lf,children:k}):null,u.jsxs("div",{style:$6,children:[u.jsx("div",{style:Ro,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:zl,onClick:e,children:"Cancel"}),u.jsx("button",{"data-testid":"cover-preview-btn",style:{...zl,...w||!P.ok?{opacity:.6,cursor:"default"}:{}},onClick:()=>void A(),disabled:w||!P.ok,children:"Preview"}),u.jsx("button",{"data-testid":"cover-apply-btn",style:{...M6,...w||!P.ok?{opacity:.6,cursor:"default"}:{}},onClick:()=>void $(),disabled:w||!P.ok,children:w?"Rebuilding…":"Apply"})]})]})]})]})})},k6={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},E6={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"},C6={display:"flex",justifyContent:"space-between",alignItems:"center"},I6={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},j6={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},R0={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},T6={marginTop:16,border:"1px solid #2C2C38",borderRadius:6,background:"#09090D",maxHeight:320,minHeight:180,display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},F0={maxWidth:"100%",maxHeight:320,objectFit:"contain"},R6={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},F6={color:"#8B8B9E",fontSize:13,padding:16,textAlign:"center"},P0={display:"block",fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.04em"},$0={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"},M0={display:"flex",alignItems:"center",gap:8},zl={background:"transparent",border:"1px solid #3A3A48",borderRadius:6,color:"#C9C9D4",padding:"9px 12px",fontSize:12,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap"},P6={borderColor:"#5b8cff",color:"#EDEDF2"},lf={marginTop:12,color:"#FF5C5C",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",whiteSpace:"pre-wrap"},$6={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,marginTop:20},Ro={fontSize:12,color:"#8B8B9E",lineHeight:1.4,wordBreak:"break-all"},M6={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 _6(e){return e==="linkedin-page"?"linkedin":e}function A6(e){const t=[],n=new Map;for(const r of e){const o=_6(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 N6={x:280,linkedin:1500,instagram:2200,tiktok:2200,facebook:2200,youtube:5e3};function L6(e){return N6[e]??1500}const O6=["private","unlisted","public"];function _0(e){return e==="public"?"Public goes live immediately and straight to subscribers' feeds.":null}const D6='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.',z6="No captions to post yet — run produce with --youtube (or approve a pack in the SEO panel) so publish has copy to send.",B6="No finished render to publish — render first.";function Rp(e){const t=Math.round(e);return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function A0(e){if(e===null)return"Encoding & publishing…";if(e.phase==="uploading")return"Uploading…";const t=e.pct!==null?`${e.pct}%`:"…",n=e.etaSec!==null?` · ~${Rp(e.etaSec)} left`:"";return`Encoding${e.file!=null?` ${e.file}`:""} ${t}${n}`}function W6(e,t){return typeof e!="number"||typeof t!="number"||e<=t?null:`video ${Rp(e)} > ${Rp(t)} cap`}function V6(e){return`⚠ ${e} word${e===1?"":"s"} not in the take`}function H6(e){if(e.trim().length===0)return null;const t=Date.parse(e);return Number.isNaN(t)?null:new Date(t).toISOString()}function N0(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 U6=[{label:"In an hour",at:e=>N0(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),N0(t)}}],Z6=({onClose:e})=>{const[t,n]=d.useState(null),[r,o]=d.useState(null),[i,s]=d.useState({}),[a,l]=d.useState({}),[c,f]=d.useState(""),[p,h]=d.useState("private"),g=ge.useRef(null),[w,x]=d.useState(!1),[k,m]=d.useState(null),[v,y]=d.useState(null),[S,b]=d.useState(null),[E,C]=d.useState({}),[j,I]=d.useState(null),[P,L]=d.useState({}),[W,$]=d.useState({}),[A,U]=d.useState(""),[z,O]=d.useState(null),[R,Z]=d.useState(!1),[B,ie]=d.useState(null),[ue,me]=d.useState(null);d.useEffect(()=>{const _=Y=>{Y.key==="Escape"&&(Y.stopPropagation(),e())};return window.addEventListener("keydown",_,!0),()=>window.removeEventListener("keydown",_,!0)},[e]);const re=d.useCallback(async()=>{try{const _=await fetch("/api/publish"),Y=await _.json();if(!_.ok)throw new Error(Y.error??`GET /api/publish failed: ${_.status}`);n(Y),Y.integrations&&l(Object.fromEntries(Y.integrations.map(fe=>[fe.id,fe.caption])))}catch(_){o(_ instanceof Error?_.message:String(_))}},[]);d.useEffect(()=>{re()},[re]);const ee=Object.entries(i).filter(([,_])=>_).map(([_])=>_),K=Object.fromEntries(((t==null?void 0:t.integrations)??[]).map(_=>[_.id,_.durationCapSec??null])),ce=A6(((t==null?void 0:t.integrations)??[]).map(_=>({..._,caption:a[_.id]??_.caption}))),q=((t==null?void 0:t.integrations)??[]).some(_=>_.provider==="youtube"&&i[_.id]===!0),X=H6(c),N=c.trim().length>0&&X===null,G=((t==null?void 0:t.receipt)??null)!==null||S!==null,T=async()=>{x(!0),y(null);const _=()=>{fetch("/api/publish/progress").then(fe=>fe.json()).then(fe=>m(fe.progress??null)).catch(()=>{})};_();const Y=window.setInterval(_,1e3);try{const fe=await fetch("/api/publish",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({integrationIds:ee,...X!==null?{at:X}:{},captions:Object.fromEntries(ee.map(Ee=>[Ee,a[Ee]??""])),...q?{youtubePrivacy:p}:{},...G?{force:!0}:{}})}),we=await fe.json();if(!fe.ok||we.ok!==!0||!we.receipt){y(we.error??`publish failed: ${fe.status}`);return}b(we.receipt)}catch(fe){y(fe instanceof Error?fe.message:String(fe))}finally{window.clearInterval(Y),m(null),x(!1)}},M=async(_,Y,fe,we)=>{L(Ee=>({...Ee,[_]:{}})),$(Ee=>({...Ee,[_]:!1}));try{const Ee=await fetch("/api/publish/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({network:_,instruction:we,currentCaption:fe})}),Te=await Ee.json();if(!Ee.ok||Te.ok!==!0||typeof Te.caption!="string"){L(be=>({...be,[_]:{error:Te.error??`regenerate failed: ${Ee.status}`}}));return}const ze=Te.caption;l(be=>({...be,...Object.fromEntries(Y.map(de=>[de,ze]))})),L(be=>({...be,[_]:{usage:Te.usage,notes:Te.notes??[]}}))}catch(Ee){L(Te=>({...Te,[_]:{error:Ee instanceof Error?Ee.message:String(Ee)}}))}},Q=async(_,Y,fe)=>{const we=(E[_]??"").trim();if(we.length!==0){I(_);try{await M(_,Y,fe,we)}finally{I(null)}}},ne=async()=>{const _=A.trim();if(_.length===0)return;const Y=ce.filter(fe=>fe.channels.some(we=>i[we.id]===!0));if(Y.length!==0)try{for(let fe=0;fe<Y.length;fe++){const we=Y[fe],Ee=we.channels.map(be=>be.id),Te=(E[we.network]??"").trim(),ze=Te.length>0?Te:_;O({network:we.network,index:fe+1,total:Y.length}),I(we.network),await M(we.network,Ee,a[Ee[0]]??we.caption,ze)}}finally{I(null),O(null)}},V=async()=>{Z(!0),ie(null);try{const _=await fetch("/api/youtube/generate",{method:"POST"}),Y=await _.json();if(!_.ok||Y.ok!==!0){ie(Y.error??`generate failed: ${_.status}`);return}me(Y.usage??null),await re()}catch(_){ie(_ instanceof Error?_.message:String(_))}finally{Z(!1)}},se=S??(t==null?void 0:t.receipt)??null;return u.jsx("div",{style:K6,onMouseDown:e,children:u.jsxs("div",{"data-testid":"publish-modal",style:Y6,onMouseDown:_=>_.stopPropagation(),children:[u.jsxs("div",{style:G6,children:[u.jsx("div",{style:X6,children:"Publish to social"}),u.jsx("button",{style:q6,onClick:e,"aria-label":"Close",children:"✕"})]}),r?u.jsxs("div",{"data-testid":"publish-load-error",style:Bl,children:["Couldn't load publish state: ",r]}):t===null?u.jsx("div",{style:Lt,children:"Loading…"}):t.configured?t.reachable===!1?u.jsxs("div",{"data-testid":"publish-unreachable",style:{...Lt,marginTop:12},children:["Postiz didn't answer: ",t.reason]}):t.packAvailable?t.outPathExists?S!==null?u.jsxs("div",{"data-testid":"publish-done",style:{...Lt,marginTop:12},children:[S.when.kind==="now"?`Published to ${S.targets.length} account(s).`:`Scheduled for ${S.when.iso} on ${S.targets.length} account(s).`,S.postIds.length>0?` Posts: ${S.postIds.join(", ")}.`:""," Track it in your Postiz launches view."]}):u.jsxs(u.Fragment,{children:[ue!==null?u.jsx("div",{"data-testid":"publish-generate-usage",style:{...Lt,marginTop:8},children:ue}):null,se!==null?u.jsxs("div",{"data-testid":"publish-receipt-note",style:{...Lt,marginTop:8},children:["This project already published on ",se.publishedAt," to"," ",se.targets.map(_=>_.provider).join(", ")," — publishing again will post it again."]}):null,u.jsxs("div",{style:{marginTop:16},children:[u.jsx("label",{style:L0,children:"Accounts"}),(t.integrations??[]).length===0?u.jsx("div",{style:Lt,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:A,onChange:_=>U(_.target.value),style:{...au,flex:1,padding:"6px 10px",fontSize:12}}),u.jsx("button",{type:"button","data-testid":"publish-regen-all",disabled:j!==null||z!==null||A.trim().length===0||ee.length===0,onClick:()=>void ne(),style:fi,children:"Regenerate selected captions"})]}),z!==null?u.jsxs("div",{"data-testid":"publish-regen-all-progress",style:{...Lt,marginBottom:8},children:["Regenerating ",z.network,"… ",z.index,"/",z.total]}):null,ce.map(_=>{var ze,be,de;const Y=_.channels.map(he=>he.id),fe=Y.filter(he=>i[he]===!0),we=fe.length>0,Ee=L6(_.channels[0].provider),Te=a[Y[0]]??_.caption;return u.jsxs("div",{style:tz,children:[u.jsxs("div",{style:nz,children:[u.jsx("span",{style:rz,children:_.network}),u.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:_.channels.map(he=>{const Ae=i[he.id]===!0,Fe=W6(t.durationSec,K[he.id]);return u.jsxs("button",{type:"button","data-testid":`publish-chip-${he.id}`,"aria-pressed":Ae,disabled:Fe!==null,title:Fe??void 0,onClick:()=>s(Je=>({...Je,[he.id]:!Ae})),style:{...fi,...Ae?Q6:{},...Fe!==null?J6:{}},children:[he.name,Fe!==null?` — ${Fe}`:""]},he.id)})})]}),we?u.jsxs(u.Fragment,{children:[_.mixed?u.jsx("div",{"data-testid":`publish-mixed-${_.network}`,style:{...Lt,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-${_.network}`,value:Te,rows:4,onChange:he=>l(Ae=>({...Ae,...Object.fromEntries(Y.map(Fe=>[Fe,he.target.value]))})),style:oz}),u.jsxs("div",{"data-testid":`publish-count-${_.network}`,style:{...O0,...Te.length>Ee?{color:"#FF5C5C"}:{}},children:[Te.length," / ",Ee,fe.length>1?` · posts to ${fe.length} channels`:""]}),_.network==="youtube"?u.jsxs("div",{style:{marginTop:8},children:[u.jsx("label",{style:{...O0,marginRight:8},htmlFor:"publish-youtube-privacy",children:"Privacy"}),u.jsx("select",{id:"publish-youtube-privacy","data-testid":"publish-youtube-privacy",value:p,onChange:he=>h(he.target.value),style:ez,children:O6.map(he=>u.jsx("option",{value:he,children:he==="private"?"Private (default)":he==="unlisted"?"Unlisted":"Public"},he))}),_0(p)!==null?u.jsx("div",{"data-testid":"publish-youtube-privacy-note",style:{...Lt,color:"#E5B300"},children:_0(p)}):null]}):null,u.jsxs("div",{style:{display:"flex",gap:6,marginTop:6},children:[u.jsx("input",{"data-testid":`publish-regen-instruction-${_.network}`,placeholder:'Fix the caption, e.g. "the 50 teams figure was an example, not a fact"',value:E[_.network]??"",onChange:he=>C(Ae=>({...Ae,[_.network]:he.target.value})),style:{...au,flex:1,padding:"6px 10px",fontSize:12}}),u.jsx("button",{type:"button","data-testid":`publish-regen-${_.network}`,disabled:j!==null||z!==null||(E[_.network]??"").trim().length===0,onClick:()=>void Q(_.network,Y,Te),style:fi,children:j===_.network?"Regenerating…":"Regenerate"})]}),((ze=P[_.network])==null?void 0:ze.error)!==void 0?u.jsx("div",{"data-testid":`publish-regen-error-${_.network}`,style:Bl,children:P[_.network].error}):null,((be=P[_.network])==null?void 0:be.usage)!==void 0?u.jsx("div",{"data-testid":`publish-regen-usage-${_.network}`,style:{...Lt,marginTop:4},children:P[_.network].usage}):null,(((de=P[_.network])==null?void 0:de.notes)??[]).length>0?u.jsxs(u.Fragment,{children:[u.jsxs("button",{type:"button","data-testid":`publish-regen-notes-toggle-${_.network}`,"aria-expanded":W[_.network]===!0,onClick:()=>$(he=>({...he,[_.network]:he[_.network]!==!0})),style:iz,children:[V6(P[_.network].notes.length)," ",W[_.network]===!0?"▾":"▸"]}),W[_.network]===!0?P[_.network].notes.map(he=>u.jsx("div",{"data-testid":`publish-regen-note-${_.network}`,style:{...Lt,marginTop:2,color:"#E5B300"},children:he},he)):null]}):null]}):null]},_.network)})]}),u.jsxs("div",{style:{marginTop:16},children:[u.jsx("label",{style:L0,children:"When"}),u.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[u.jsx("input",{ref:g,"data-testid":"publish-schedule",type:"datetime-local",value:c,onChange:_=>f(_.target.value),onClick:()=>{var _,Y;try{(Y=(_=g.current)==null?void 0:_.showPicker)==null||Y.call(_)}catch{}},style:{...au,width:"auto",cursor:"pointer"}}),U6.map(_=>u.jsx("button",{type:"button","data-testid":`publish-when-${_.label.replace(/\s+/g,"-").toLowerCase()}`,onClick:()=>f(_.at(new Date)),style:fi,children:_.label},_.label)),c.trim().length>0?u.jsx("button",{type:"button","data-testid":"publish-when-clear",onClick:()=>f(""),style:fi,children:"Clear"}):null,u.jsx("span",{style:Lt,children:X===null?"empty = publish now":`scheduled: ${X}`})]})]}),v?u.jsx("div",{"data-testid":"publish-error",style:Bl,children:v}):null,w?u.jsx("div",{"data-testid":"publish-busy-note",style:{...Lt,marginTop:12},children:"Encoding the delivery file and uploading through Postiz — this can take a few minutes for a long video."}):null,w?u.jsx("div",{"data-testid":"publish-progress",style:{...Lt,marginTop:4},children:A0(k)}):null,u.jsxs("div",{style:sz,children:[u.jsx("div",{style:az,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:lz,disabled:w||ee.length===0||N,onClick:()=>void T(),children:w?A0(k):G?"Publish again":X!==null?"Schedule":"Publish now"})]})]}):u.jsx("div",{"data-testid":"publish-no-render",style:{...Lt,marginTop:12},children:B6}):u.jsxs("div",{"data-testid":"publish-no-pack",style:{...Lt,marginTop:12},children:[z6,u.jsx("div",{style:{marginTop:10},children:u.jsx("button",{type:"button","data-testid":"publish-generate-pack",disabled:R,onClick:()=>void V(),style:fi,children:R?"Generating captions… (one LLM call)":"Generate captions"})}),B!==null?u.jsx("div",{"data-testid":"publish-generate-error",style:Bl,children:B}):null]}):u.jsx("div",{"data-testid":"publish-unconfigured",style:{...Lt,marginTop:12},children:D6})]})})},K6={position:"fixed",inset:0,background:"rgba(0,0,0,0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:60},Y6={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)"},G6={display:"flex",justifyContent:"space-between",alignItems:"center"},X6={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},q6={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},Lt={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},fi={background:"transparent",border:"1px solid #3a3a44",borderRadius:999,color:"#c9c9d4",cursor:"pointer",fontSize:12,padding:"4px 10px"},J6={opacity:.45,cursor:"not-allowed"},Q6={background:"#5b8cff",borderColor:"#5b8cff",color:"#0b0b0f",fontWeight:700},L0={display:"block",fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.04em"},au={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"},ez={...au,width:"auto",padding:"5px 8px",fontSize:12,cursor:"pointer"},tz={border:"1px solid #2C2C38",borderRadius:6,background:"#09090D",padding:"10px 14px",marginBottom:8},nz={display:"flex",gap:10,alignItems:"center",cursor:"pointer"},rz={fontSize:11,fontWeight:700,color:"#8B8B9E",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",textTransform:"uppercase",letterSpacing:"0.04em",minWidth:72},oz={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"},iz={background:"transparent",border:"none",padding:0,marginTop:4,cursor:"pointer",textAlign:"left",fontSize:12,color:"#E5B300",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace"},O0={marginTop:4,fontSize:12,color:"#8B8B9E",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace"},Bl={marginTop:12,color:"#FF5C5C",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",whiteSpace:"pre-wrap"},sz={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,marginTop:20},az={fontSize:12,color:"#8B8B9E",lineHeight:1.4},lz={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 Wl(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 uz(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 D0(e,t){const n=Math.max(0,Math.floor((t-e)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function cz(e,t){return e?{load:e,notifyDiscard:t}:{load:null,notifyDiscard:!1}}function dz(e,t){return e===null||e===t}function fz(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 pz(e){if(e.dirty){if(e.renderRunning){e.onBlocked();return}e.save().catch(t=>e.onSaveError(t instanceof Error?t.message:String(t)))}}function hz(e,t,n=r=>r){const{cues:r}=ou(e,t);return Bu(r,dm(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 z0=e=>e,B0=e=>({...e,...s5(e)}),W0=e=>{const t=vk(e);e.forEach((n,r)=>{console.warn(`ossclip §137: dropped caption edit ${JSON.stringify(n)} — ${t[r]}`)})},mz=()=>{const e=i5(),t=d.useRef(e.dirty);t.current=e.dirty;const[n,r]=d.useState(!1),[o,i]=d.useState(!1),[s,a]=d.useState(null),[l,c]=d.useState(null),[f,p]=d.useState([]),[h,g]=d.useState([]),w=d.useRef(e.doc.captions);w.current=e.doc.captions;const[x,k]=d.useState(()=>{try{return localStorage.getItem("ossclip-dismissed-drops")}catch{return null}}),m=d.useCallback(D=>{k(D);try{D===null?localStorage.removeItem("ossclip-dismissed-drops"):localStorage.setItem("ossclip-dismissed-drops",D)}catch{}},[]),[v,y]=d.useState(()=>{try{return localStorage.getItem("ossclip-dismissed-migration")}catch{return null}}),S=d.useCallback(D=>{y(D);try{localStorage.setItem("ossclip-dismissed-migration",D)}catch{}},[]),[b,E]=d.useState(null),[C,j]=d.useState(null),[I,P]=d.useState([]),[L,W]=d.useState(null),[$,A]=d.useState({sfx:null,words:null}),[U,z]=d.useState([]),[O,R]=d.useState(iu),[Z,B]=d.useState(null),ie=d.useRef(!1),ue=d.useCallback((D,J)=>{ie.current||(ie.current=!0,(async()=>{try{const oe=await fetch("/api/retranscribe-range",{method:"POST",body:JSON.stringify({srcIn:D,srcOut:J})}),je=await oe.json();if(!je.ok){console.warn(`re-transcribe failed: ${je.error??oe.status}`);return}for(const Gn of je.reports??[])console.warn(`re-transcribe: ${Gn}`);e.rekeyCaptionKeys(je.mapping??[]);const An=(await(await fetch("/api/transcript")).json()).transcript;An&&Array.isArray(An.words)&&W({language:typeof An.language=="string"?An.language:"en",words:An.words})}catch(oe){console.warn(`re-transcribe failed: ${oe instanceof Error?oe.message:String(oe)}`)}finally{ie.current=!1}})())},[e]),[me,re]=d.useState(null),[ee,K]=d.useState(null),[ce,q]=d.useState(()=>{try{const D=Number(localStorage.getItem("ossclip-sidebar-w"));return Number.isFinite(D)&&D>=220&&D<=560?D:260}catch{return 260}}),X=d.useCallback(D=>{K(D),B(null)},[]),N=d.useCallback(D=>{B(D),D!==null&&K(null)},[]),[G,T]=d.useState(!1),[M,Q]=d.useState(1),[ne,V]=d.useState(null),[se,_]=d.useState(!1),[Y,fe]=d.useState([]),[we,Ee]=d.useState(null),Te=d.useRef(null),[ze,be]=d.useState(!1),[de,he]=d.useState(null),[Ae,Fe]=d.useState(!1),[Je,gt]=d.useState(),Ne=d.useRef(null);d.useEffect(()=>()=>{Ne.current!==null&&window.clearInterval(Ne.current)},[]);const[Le,Jt]=d.useState(null),Vt=d.useRef(null),St=d.useRef(null),Qt=d.useRef(null),en=d.useRef(null),[Mn,sr]=d.useState(null),[ar,_n]=d.useState(null),Kn=d.useCallback(D=>{var je;if(Qt.current=D,_n(D),(je=en.current)==null||je.disconnect(),en.current=null,!D)return;const J=()=>sr({w:Math.max(0,D.clientWidth-cf*2),h:Math.max(0,D.clientHeight-cf*2)});J();const oe=new ResizeObserver(J);oe.observe(D),en.current=oe},[]),[Ke,fn]=d.useState(1),Sn=d.useRef(Ke);Sn.current=Ke;const Yn=d.useRef(null),tn=d.useCallback((D,J)=>{const oe=Qt.current,je=Math.min(8,Math.max(.25,D)),_e=Sn.current;if(oe&&je!==_e){const wt=oe.getBoundingClientRect();Yn.current={prev:_e,ax:((J==null?void 0:J.x)??wt.left+wt.width/2)-wt.left,ay:((J==null?void 0:J.y)??wt.top+wt.height/2)-wt.top,sl:oe.scrollLeft,st:oe.scrollTop}}fn(je)},[]);d.useLayoutEffect(()=>{const D=Qt.current,J=Yn.current;if(!D||!J)return;Yn.current=null;const oe=Ke/J.prev;D.scrollLeft=(J.sl+J.ax)*oe-J.ax,D.scrollTop=(J.st+J.ay)*oe-J.ay},[Ke]),d.useEffect(()=>{const D=ar;if(!D)return;const J=oe=>{(oe.ctrlKey||oe.metaKey)&&(oe.preventDefault(),tn(Sn.current*Math.exp(-oe.deltaY*.01),{x:oe.clientX,y:oe.clientY}))};return D.addEventListener("wheel",J,{passive:!1}),()=>D.removeEventListener("wheel",J)},[ar,tn]);const Ge=d.useRef(null);d.useEffect(()=>{const D=oe=>{const je=Ge.current,_e=Qt.current;!je||!_e||(_e.scrollLeft=je.sl-(oe.clientX-je.x),_e.scrollTop=je.st-(oe.clientY-je.y))},J=()=>{Ge.current=null};return window.addEventListener("mousemove",D),window.addEventListener("mouseup",J),()=>{window.removeEventListener("mousemove",D),window.removeEventListener("mouseup",J)}},[]);const[lr,us]=d.useState(!1),[ur,Co]=d.useState(()=>{const D=Number(window.localStorage.getItem(H0));return Number.isFinite(D)&&D>0?U0(D):300}),Io=d.useRef(null);d.useEffect(()=>{const D=oe=>{const je=Io.current;je&&Co(U0(je.startW+(oe.clientX-je.startX)))},J=()=>{Io.current&&(Io.current=null,Co(oe=>(window.localStorage.setItem(H0,String(oe)),oe)))};return window.addEventListener("mousemove",D),window.addEventListener("mouseup",J),()=>{window.removeEventListener("mousemove",D),window.removeEventListener("mouseup",J)}},[]);const[cs,Br]=d.useState(!1),[F,H]=d.useState(!1),[le,ye]=d.useState(!1),[Ie,$e]=d.useState(!1),[Pe,Be]=d.useState(!1),[Ze,nn]=d.useState(!1),[pn,Ht]=d.useState(!1);d.useEffect(()=>{if(!Ie)return;const D=J=>{J.key==="Escape"&&(J.stopPropagation(),$e(!1))};return window.addEventListener("keydown",D,!0),()=>window.removeEventListener("keydown",D,!0)},[Ie]);const[rn,ds]=d.useState(null),[cr,Uc]=d.useState(null),[Zc,Kc]=d.useState(!0),xm=d.useCallback(D=>{const J=_P({rate:M,playing:G},D);Q(J.rate);const oe=St.current;oe&&(J.playing&&!G&&oe.play(),!J.playing&&G&&oe.pause())},[M,G]);d.useEffect(()=>{const D=St.current;if(!D)return;const J=()=>T(!0),oe=()=>T(!1);return D.addEventListener("play",J),D.addEventListener("pause",oe),()=>{D.removeEventListener("play",J),D.removeEventListener("pause",oe)}});const fs=d.useCallback(()=>{if(Ne.current!==null)return;const D=window.setInterval(()=>{(async()=>{try{const oe=await(await fetch("/api/render/status")).json();if(oe.running||oe.exitCode===null){he(je=>({running:oe.running,lines:oe.lines??[],startedAt:oe.startedAt??(je==null?void 0:je.startedAt)}));return}if(Ne.current!==null&&(window.clearInterval(Ne.current),Ne.current=null),oe.exitCode===0){const _e=await(await fetch("/api/production")).json(),wt=B0(_e.renderProps);E(wt),be(!!_e.canRender);const An=cz(_e.overrides,t.current);if(An.load){const Gn=w.current,fr=Rv(An.load,wt);e.load(fr.doc),W0(fr.unresolved),p(fr.unresolved);const ft=l5(a5(Gn,fr.doc.captions));for(const ys of ft)console.warn(`ossclip §137: ${ys}`);g(ft)}else p([]),g([]);An.notifyDiscard&&r(!0),he(Gn=>({running:!1,lines:oe.lines??[],succeeded:!0,startedAt:oe.startedAt??(Gn==null?void 0:Gn.startedAt),finishedAt:Date.now()})),fetch("/api/reveal-output",{method:"POST"}).catch(()=>{})}else he({running:!1,lines:oe.lines??[],failed:oe.exitCode,cancelled:oe.cancelled})}catch{Ne.current===null&&fs()}})()},1e3);Ne.current=D},[]),Yc=d.useCallback(async()=>{const D=await fetch("/api/production");if(!D.ok)throw new Error(`GET /api/production failed: ${D.status}`);const J=await D.json();if(J.defaultOutPath&&gt(J.defaultOutPath),fe(J.recent??[]),J.noWorkdir){p([]),g([]),_(!0);return}const oe=B0(J.renderProps);E(oe);const je=Te.current,_e=J.workdir??null;Te.current=_e,Ee(_e),be(!!J.canRender);const wt=Rv(J.overrides,oe);e.load(wt.doc),W0(wt.unresolved),p(wt.unresolved),g([]),fetch("/api/usage").then(async ft=>j(ft.ok?await ft.json():null)).catch(()=>j(null)),fetch("/api/cleanup").then(async ft=>P(ft.ok?(await ft.json()).cutlist??[]:[])).catch(()=>P([])),fetch("/api/transcript").then(async ft=>{const Er=(ft.ok?await ft.json():{transcript:null}).transcript;W(Er&&Array.isArray(Er.words)?{language:typeof Er.language=="string"?Er.language:"en",words:Er.words}:null)}).catch(()=>W(null)),fetch("/api/sfx/plan").then(async ft=>A(ft.ok?await ft.json():{sfx:null,words:null})).catch(()=>A({sfx:null,words:null})),fetch("/api/sfx/library").then(async ft=>z(ft.ok?(await ft.json()).sounds??[]:[])).catch(()=>z([])),fetch("/api/luts").then(async ft=>R(ft.ok?await ft.json():iu)).catch(()=>R(iu)),B(null);const Gn=await(await fetch("/api/render/status")).json(),fr=dz(je,_e)?fz(Gn):null;fr&&(he(fr),fr.running?fs():Kc(!1))},[fs]);d.useEffect(()=>{Yc().catch(D=>re(D instanceof Error?D.message:String(D)))},[]);const bm=d.useCallback(async D=>{if(e.dirty&&!window.confirm("Unsaved edits will be lost — switch projects anyway?"))return null;try{const J=await fetch("/api/workdir",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:D})}),oe=await J.json().catch(()=>({}));return J.ok?(K(null),V(null),Jt(null),he(null),fn(1),E(null),_(!1),await Yc(),null):oe.error??`open failed: ${J.status}`}catch(J){return J instanceof Error?J.message:String(J)}},[e.dirty,Yc]),Ya=d.useMemo(()=>{if(!b)return{lines:[],dropped:[]};const D=b.baseCaptionLines??b.captionLines??[];return DS(D,yk(e.doc.captions))},[b,e.doc.captions]),ps=d.useMemo(()=>b?zS(Ya.lines,e.doc.captionRangeEdits):{lines:[],dropped:[]},[b,Ya,e.doc.captionRangeEdits]),hs=d.useMemo(()=>b?BS(ps.lines,e.doc.captionWordsHidden):{lines:[],dropped:[]},[b,ps,e.doc.captionWordsHidden]),Ga=d.useMemo(()=>b?VS(hs.lines,e.doc.captionLineTiming):{lines:[],dropped:[]},[b,hs,e.doc.captionLineTiming]),Xa=d.useMemo(()=>b?p5(Ga.lines,e.doc.captionLineWindows,b.spans??[]):{lines:[],dropped:[]},[b,Ga,e.doc.captionLineWindows]),qa=d.useMemo(()=>vk(f),[f]),on=d.useMemo(()=>b?Q4(I,e.doc.cleanup,e.doc.cuts,b.spans??[]):null,[b,I,e.doc.cleanup,e.doc.cuts]),st=d.useMemo(()=>{let D;try{const J=(b==null?void 0:b.spans)??[];if(J.length>0){const oe=ro(J);D=je=>oe.toSource(je)}}catch{D=void 0}return e3(on,{identityToSource:D})},[on,b]),sn=d.useMemo(()=>{if(!b)return null;const D=()=>{try{const xt=b.spans??[];return xt.length>0?ro(xt):null}catch{return null}},J=(b.baseSceneCues??b.sceneCues??[]).filter(xt=>xt.kind!=="plain"),oe=b.baseTheme??b.theme??_A,je=D(),_e=je?pv(e.doc,je).doc:e.doc,{cues:wt}=ou(J,_e),{cues:An}=x4(wt,e.doc),Gn=_4(An,{outputDurationSec:b.outputDurationSec,clipStarts:(b.spans??[]).map(xt=>xt.outIn)}),fr=Bu(Gn,dm(e.doc.splits)),{cues:ft}=ou(fr,_e),{cues:ys}=OS(ft,e.doc);let Er=ne?ys.map(xt=>xt.id===ne.sceneId?{...xt,video:{...xt.video,...ne.patch}}:xt):ys;Le&&(Er=Er.map(xt=>xt.id===Le.sceneId?{...xt,graphicRect:Le.rect}:xt));const ed={...b,sceneCues:Er,captionLines:Xa.lines,theme:j4(oe,e.doc),captionsHidden:b.captionsHiddenByFlag===!0||e.doc.captionsHidden===!0,colorGrade:P5(e.doc.colorGrade,b.colorGrade),videoFileName:`/media/${b.videoFileName}`,...b.coverInVideo?{coverInVideo:{...b.coverInVideo,fileName:`/media/${b.coverInVideo.fileName}`}}:{}},Cm=(xt,Im,vs)=>{var _m,Am;const Wk=pm(I,e.doc.cleanup).map(kn=>({srcIn:kn.srcIn,srcOut:kn.srcOut})),Vk=hm(I,e.doc.cleanup).map(kn=>({srcIn:kn.srcIn,srcOut:kn.srcOut,dismissed:!0})),jm=e.doc.splits.filter(kn=>kn.at===void 0&&kn.src!==void 0),td=[...Wk,...Vk],Tm=L!==null&&(td.length>0||on!==null);if(vs===null||td.length===0&&jm.length===0&&!Tm)return{props:xt,reports:Im};const Rm=X4(xt.sceneCues??[],td,vs),Fm=c4(jm,vs),Hk=Bu(Rm.cues,Fm.points),Pm=pv(e.doc,vs),{cues:$m}=ou(Hk,Pm.doc);let Mm=xt.captionLines,nd;return Tm&&L!==null&&(nd=h5(L,vs,e.doc,{breakpoints:$m.filter(kn=>kn.kind!=="plain").flatMap(kn=>[kn.startSec,kn.endSec]),landscape:(((_m=b.settings)==null?void 0:_m.width)??1080)>(((Am=b.settings)==null?void 0:Am.height)??1920)}),Mm=nd.lines),{props:{...xt,sceneCues:$m,captionLines:Mm},reports:[...Im,...Rm.reports,...Fm.reports,...Pm.reports],transcript:nd}};if(!on)return Cm(ed,[],je);const{fields:zk,reports:Bk}=t3(ed,on.oldMap,on.newMap);return Cm({...ed,...zk},Bk,on.newMap)},[b,e.doc,ne,Le,Xa,on,I,L]),Re=sn===null?null:sn.props,dr=sn==null?void 0:sn.transcript,ms=d.useMemo(()=>{var J;const D=[...u5(Ya.dropped),...d5(ps.dropped),...c5(hs.dropped),...Yd(Ga.dropped),...Yd(Xa.dropped)];for(const oe of Yd(((J=sn==null?void 0:sn.transcript)==null?void 0:J.dropped)??[]))D.includes(oe)||D.push(oe);return D},[Ya,ps,hs,Ga,Xa,sn]),Ja=d.useMemo(()=>{const D=$.words;if(D===null||D.length===0)return[];let J=(on==null?void 0:on.newMap)??null;if(J===null)try{const oe=(b==null?void 0:b.spans)??[];J=oe.length>0?ro(oe):null}catch{J=null}return m5(D,J)},[$,on,b]),Sm=d.useMemo(()=>A4((Re==null?void 0:Re.sceneCues)??[]),[Re]),Gc=d.useMemo(()=>g5($.sfx,e.doc.sfx,Ja,Sm),[$.sfx,e.doc.sfx,Ja,Sm]),Mk=d.useMemo(()=>Gc.find(D=>D.key===Z)??null,[Gc,Z]),Xc=ms.join(`
165
+ `),_k=ms.length>0&&Xc!==x;d.useEffect(()=>{if(ms.length!==0)for(const D of ms)console.warn(`ossclip §137: ${D}`)},[Xc]);const qc=Re==null?void 0:Re.sceneCues;d.useEffect(()=>{qc&&e.syncCues(qc)},[qc]);const Ak=((sn==null?void 0:sn.reports)??[]).join(`
166
+ `);d.useEffect(()=>{if(!(!sn||sn.reports.length===0))for(const D of sn.reports)console.warn(`ossclip cut preview: ${D}`)},[Ak]);const Jc=d.useRef(null);d.useEffect(()=>{if(!b){Jc.current=null;return}const D=on?on.newMap:ro(b.spans??[]),J=Jc.current;if(Jc.current={props:b,map:D},!J||J.props!==b||ZS(J.map,D,1e-6))return;const oe=St.current;if(!oe)return;const je=b.settings.fps,_e=J.map.toSource(oe.getCurrentFrame()/je),wt=D.toOutput(_e)??D.toOutputClamped(_e);oe.seekTo(Math.round(wt*je))},[on,b]);const km=()=>{pz({dirty:e.dirty,renderRunning:(de==null?void 0:de.running)===!0,save:e.save,onBlocked:()=>i(!0),onSaveError:D=>re(D)})},Em=d.useCallback(async(D,J)=>{try{e.dirty&&await e.save();const oe=await fetch("/api/render",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...D?{out:D}:{},...J===!0?{replan:!0}:{}})});if(!oe.ok){const je=await oe.json().catch(()=>({}));throw new Error(je.error??`render failed to start: ${oe.status}`)}he({running:!0,lines:[],startedAt:Date.now()}),Kc(!0),a(null),fs()}catch(oe){a(oe instanceof Error?oe.message:String(oe))}},[e,fs]),gs=d.useMemo(()=>{if(!b)return[];const D=(b.baseSceneCues??b.sceneCues??[]).filter(J=>J.kind!=="plain");return hz(D,e.doc,st.toLive)},[b,e.doc,st]),Wr=d.useMemo(()=>ee?(Re==null?void 0:Re.sceneCues.find(D=>D.id===ee.sceneId))??gs.find(D=>D.id===ee.sceneId)??null:null,[Re,ee,gs]);d.useEffect(()=>{var je;if(!ee||!Re||((je=e.doc.scenes[ee.sceneId])==null?void 0:je.hidden)!==!0)return;const D=gs.find(_e=>_e.id===ee.sceneId),J=D?(D.startSec+D.endSec)/2:null,oe=J!==null?Re.sceneCues.find(_e=>_e.startSec<=J&&J<_e.endSec):void 0;K(oe?{sceneId:oe.id,elementId:null}:null)},[ee,Re,e.doc.scenes,gs]);const Nk=d.useMemo(()=>{if(!Wr||!Re)return;const D=Re.captionLines.filter(oe=>oe.start<Wr.endSec&&oe.end>Wr.startSec).flatMap(oe=>oe.words).filter(oe=>oe.start<Wr.endSec&&oe.end>Wr.startSec).map(oe=>oe.text);if(D.length===0)return;const J=D.join(" ");return J.length>90?`${J.slice(0,90)}…`:J},[Wr,Re]);if(me)return u.jsx("div",{style:uf,children:u.jsxs("div",{style:{padding:24,color:"#FF5C5C",fontFamily:"ui-monospace, monospace"},children:["Couldn't load the production: ",me]})});if(!Re)return u.jsx("div",{style:uf,children:se?u.jsx(c0,{recent:Y,required:!0,onOpen:bm,onClose:()=>{}}):u.jsx("div",{style:{padding:24,color:"#9A9AA3"},children:"Loading production…"})});const Lk=Re.settings.width/Re.settings.height,Ok=Mn?Math.max(220,Math.min(Mn.w,Mn.h*Lk)):380,Dk=Math.round(Ok*Ke),Qc=u.jsx("button",{"data-testid":"render-logs-toggle",style:{...at,padding:"2px 8px"},onClick:()=>Kc(D=>!D),title:Zc?"Collapse the log":"Expand the log",children:Zc?"▾ logs":"▸ logs"});return u.jsxs("div",{style:uf,children:[u.jsxs("div",{style:wz,children:[u.jsx("span",{style:xz,children:"ossclip"}),we?u.jsx("span",{"data-testid":"workdir-label",style:bz,title:we,children:we.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:()=>_(!0),title:we?`Open another project — currently ${we}`:"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(yz,{})}),u.jsx("button",{"data-testid":"redo-button",style:at,onClick:()=>e.redo(),disabled:!e.canRedo,title:"Redo (⌘⇧Z)","aria-label":"Redo",children:u.jsx(vz,{})}),u.jsx("button",{"data-testid":"transcript-toggle",style:{...at,...lr?{borderColor:"#5b8cff"}:{}},onClick:()=>us(D=>!D),title:"Find and retype caption words across the whole transcript",children:"Transcript"}),u.jsx("button",{"data-testid":"cover-button",style:{...at,...Pe?{borderColor:"#5b8cff"}:{}},onClick:()=>Be(!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,...pn?{borderColor:"#5b8cff"}:{}},onClick:()=>Ht(!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,...Ie||F||le?{borderColor:"#5b8cff"}:{}},onClick:()=>$e(D=>!D),title:"AI thumbnail and SEO metadata for the YouTube upload","aria-haspopup":"menu","aria-expanded":Ie,children:"YouTube ▾"}),Ie?u.jsxs(u.Fragment,{children:[u.jsx("div",{style:Ez,onMouseDown:()=>$e(!1)}),u.jsxs("div",{style:Cz,role:"menu",children:[u.jsx("button",{"data-testid":"youtube-menu-thumbnail",style:V0,role:"menuitem",onClick:()=>{$e(!1),H(!0)},children:"Thumbnail"}),u.jsx("button",{"data-testid":"youtube-menu-seo",style:V0,role:"menuitem",onClick:()=>{$e(!1),ye(!0)},children:"SEO metadata"})]})]}):null]}),u.jsx("button",{"data-testid":"publish-button",style:{...at,...Ze?{borderColor:"#5b8cff"}:{}},onClick:()=>nn(!0),title:"Push the finished render to your social accounts via your Postiz instance",children:"Publish"}),u.jsx("button",{style:{...at,...e.dirty?kz:{}},onClick:km,disabled:!e.dirty||(de==null?void 0:de.running)===!0,title:(de==null?void 0:de.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 Em(),disabled:!ze||(de==null?void 0:de.running)===!0,title:ze?"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:de!=null&&de.running?"Rendering…":"Render"}),u.jsx("button",{"data-testid":"render-destination-button",style:{...at,borderTopLeftRadius:0,borderBottomLeftRadius:0,padding:"7px 8px"},onClick:()=>Fe(!0),disabled:!ze||(de==null?void 0:de.running)===!0,title:"Choose export file destination (Browse…)",children:"▾"})]})]}),u.jsx("span",{style:{...Sz,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:()=>Br(D=>!D),title:"Keyboard shortcuts (?)",children:"?"})]}),cs?u.jsx(uO,{onClose:()=>Br(!1)}):null,F?u.jsx(TD,{onClose:()=>H(!1)}):null,pn?u.jsx(WD,{cutlist:I,edits:e,onClose:()=>Ht(!1)}):null,le?u.jsx(o6,{onClose:()=>ye(!1)}):null,Ze?u.jsx(Z6,{onClose:()=>nn(!1)}):null,Pe?u.jsx(S6,{onClose:()=>Be(!1),playheadSec:()=>{var J;const D=(((J=St.current)==null?void 0:J.getCurrentFrame())??0)/Re.settings.fps;return{sec:st.fromLive(D),snapped:!st.hasOldClockPreimage(D)}}}):null,Ae?u.jsx(dD,{defaultOutPath:Je,onCancel:()=>Fe(!1),onConfirm:(D,J)=>{Fe(!1),Em(D,J)}}):null,rn?u.jsx(xO,{plan:rn,onCancel:()=>ds(null),onConfirm:D=>{if(D==="graphic")e.hideScene(rn.sceneId);else{const J=GS(st,rn.startSec,rn.endSec);if(st.toSourceSec!==null){const oe=st.toSourceSec,je={startSec:Math.round(oe(rn.startSec)*1e3)/1e3,endSec:Math.round(oe(rn.endSec)*1e3)/1e3},_e=J.kind==="degenerate"?{startSec:st.fromLive(rn.startSec),endSec:st.fromLive(rn.endSec)}:{startSec:J.startSec,endSec:J.endSec};e.cutChunk(_e.startSec,_e.endSec,je)}else J.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."):(J.kind==="shrunk"&&console.warn(`ossclip cut preview: ${J.report}`),e.cutChunk(J.startSec,J.endSec))}ds(null)}}):null,cr?u.jsx(_O,{plan:cr,onCancel:()=>Uc(null),onConfirm:D=>{if(D==="caption")e.hideCaptionWords(cr.words);else{const J=dr?st.toSourceSec:st.oldToSourceSec,oe=wt=>Math.round(wt*1e3)/1e3,je=J===null?void 0:{startSec:oe(J(cr.startSec)),endSec:oe(J(cr.endSec))},_e=dr?{startSec:oe(st.fromLive(cr.startSec)),endSec:oe(st.fromLive(cr.endSec))}:{startSec:cr.startSec,endSec:cr.endSec};e.cutWords(cr.words,_e.startSec,_e.endSec,je)}Uc(null)}}):null,se?u.jsx(c0,{recent:Y,required:!1,onOpen:bm,onClose:()=>_(!1)}):null,de?u.jsxs("div",{"data-testid":"render-log",style:{..._z,borderColor:de.failed!==void 0?"#FF5C5C":"#2A2A33"},children:[de.failed!==void 0?u.jsxs("div",{style:{color:de.cancelled?"#9A9AA3":"#FF5C5C",marginBottom:4},"data-testid":de.cancelled?"render-cancelled":"render-failed",children:[de.cancelled?"render cancelled":`render failed (exit ${de.failed})`,u.jsx("button",{style:{...at,marginLeft:10,padding:"2px 8px"},onClick:()=>he(null),children:"Dismiss"}),u.jsx("span",{style:{marginLeft:6},children:Qc})]}):null,de.succeeded?u.jsxs("div",{"data-testid":"render-succeeded",style:Z0,children:[u.jsxs("span",{style:{color:"#5FBF77"},children:["✓ done",de.startedAt!=null&&de.finishedAt!==void 0?` · ${D0(de.startedAt,de.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:()=>he(null),children:"Dismiss"}),Qc]}):null,de.running?u.jsxs("div",{"data-testid":"render-status",style:Z0,children:[u.jsx("style",{children:"@keyframes ossclip-spin { to { transform: rotate(360deg) } }"}),u.jsx("span",{style:Az,"aria-hidden":!0}),u.jsxs("span",{style:{color:"#EDEDF2"},children:["rendering",de.startedAt!=null?` · ${D0(de.startedAt,Date.now())}`:"",Wl(de.lines)!==null?` · ${Wl(de.lines)}%`:""]}),Wl(de.lines)!==null?u.jsx("div",{style:Nz,children:u.jsx("div",{"data-testid":"render-progress-bar",style:{...Lz,width:`${Wl(de.lines)}%`}})}):null,u.jsx("button",{"data-testid":"render-cancel",style:{...at,padding:"2px 8px"},onClick:()=>void fetch("/api/render/cancel",{method:"POST"}),children:"Cancel"}),Qc]}):null,Zc?u.jsxs(u.Fragment,{children:[uz(de.lines).map(D=>u.jsx("div",{"data-testid":"render-pinned",style:{color:"#C9C9D4"},children:D},D)),u.jsx(gz,{lines:de.lines})]}):null]}):null,n?u.jsxs("div",{"data-testid":"reanchor-notice",style:pi,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,(qa.length>0||h.length>0)&&[...qa,...h].join(`
167
+ `)!==v?u.jsxs("div",{"data-testid":"caption-migration-notice",style:pi,children:[[...qa,...h].map((D,J)=>u.jsx("div",{children:D},J)),u.jsx("button",{style:{...at,marginLeft:10,padding:"2px 8px"},onClick:()=>{S([...qa,...h].join(`
168
+ `)),p([]),g([])},children:"Dismiss"})]}):null,_k?u.jsxs("div",{"data-testid":"caption-dropped-notice",style:pi,children:[ms.map((D,J)=>u.jsx("div",{children:D},J)),u.jsx("button",{style:{...at,marginLeft:10,padding:"2px 8px"},onClick:()=>m(Xc),children:"Dismiss"})]}):null,o?u.jsxs("div",{"data-testid":"save-blocked-notice",style:pi,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:pi,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:pi,children:[l,u.jsx("button",{style:{...at,marginLeft:10,padding:"2px 8px"},onClick:()=>c(null),children:"Dismiss"})]}):null,u.jsxs("div",{style:Iz,children:[lr?u.jsxs(u.Fragment,{children:[u.jsx(NL,{baseLines:dr?dr.baseLines:(b==null?void 0:b.baseCaptionLines)??(b==null?void 0:b.captionLines)??[],liveLines:dr?dr.liveLines:ps.lines,timingLines:dr?dr.timingLines:hs.lines,fps:Re.settings.fps,playerRef:St,edits:e,onDeleteWords:Uc,width:ur,workdir:we,toPlayerSec:dr?z0:st.toLive,fromPlayerSec:dr?z0:st.fromLive}),u.jsx("div",{"data-testid":"transcript-divider",style:jz,title:"Drag to resize the transcript pane",onMouseDown:D=>{D.preventDefault(),Io.current={startX:D.clientX,startW:ur}}})]}):null,u.jsxs("div",{style:Tz,children:[u.jsx("div",{ref:Kn,style:Rz,onMouseDown:D=>{var J,oe;if(D.button===0&&!D.altKey&&!((oe=(J=D.target).closest)!=null&&oe.call(J,'[data-testid="stage"]'))&&X(null),D.altKey||D.button===1){D.preventDefault();const je=Qt.current;je&&(Ge.current={x:D.clientX,y:D.clientY,sl:je.scrollLeft,st:je.scrollTop})}},children:u.jsx("div",{style:{margin:"auto",padding:cf},children:u.jsxs("div",{ref:Vt,"data-testid":"stage","data-playing":G?"true":"false","data-rate":M,style:{position:"relative",display:"inline-block"},children:[u.jsx(jP,{ref:St,component:e5,inputProps:Re,durationInFrames:Math.max(1,Math.round(Re.outputDurationSec*Re.settings.fps)),fps:Re.settings.fps,compositionWidth:Re.settings.width,compositionHeight:Re.settings.height,style:{width:Dk},controls:!0,clickToPlay:!1,playbackRate:M}),u.jsx(E5,{stageRef:Vt,selection:ee,onSelect:X,edits:e,onSave:km,settings:Re.settings,cues:Re.sceneCues,playerRef:St,cue:Wr,onTransport:xm,onVideoPreview:V,onGraphicPreview:Jt,onToggleHelp:()=>Br(D=>!D),onRequestDelete:ds,fromLive:st.fromLive,hasOldClockPreimage:st.hasOldClockPreimage,toSourceSec:st.toSourceSec,onClockRefused:c}),u.jsx("button",{"data-testid":"rate-chip",onClick:()=>xm("L"),title:"Playback rate — click to speed up (J/K/L on the keyboard)",style:Oz,children:M<0?`◂◂ ${Math.abs(M)}×`:`${M}×`})]})})}),u.jsxs("div",{style:Fz,children:[u.jsx("button",{"data-testid":"view-zoom-out",style:df,onClick:()=>tn(Ke/2),disabled:Ke<=.25,title:"Zoom the preview out — below 100% shrinks under the fitted size",children:"−"}),u.jsxs("span",{"data-testid":"view-zoom-level",style:Pz,children:[Math.round(Ke*100),"%"]}),u.jsx("button",{"data-testid":"view-zoom-in",style:df,onClick:()=>tn(Ke*2),disabled:Ke>=8,title:"Zoom the preview in — a viewing magnifier, it never edits the video",children:"+"}),u.jsx("button",{"data-testid":"view-zoom-fit",style:{...df,width:"auto",padding:"0 8px"},onClick:()=>tn(1),disabled:Math.abs(Ke-1)<.001,title:"Fit the preview to the window",children:"fit"}),u.jsx("span",{style:$z,children:"⌥-drag pans"})]})]}),u.jsxs("div",{"data-testid":"sidebar",style:{...Mz,width:ce,position:"relative"},onMouseDown:D=>{D.target===D.currentTarget&&X(null)},children:[u.jsx("div",{"data-testid":"sidebar-resize",onPointerDown:D=>{D.preventDefault(),D.currentTarget.setPointerCapture(D.pointerId);const J=je=>{const _e=Math.min(560,Math.max(220,window.innerWidth-je.clientX));q(_e)},oe=je=>{window.removeEventListener("pointermove",J),window.removeEventListener("pointerup",oe);try{const _e=Math.min(560,Math.max(220,window.innerWidth-je.clientX));localStorage.setItem("ossclip-sidebar-w",String(_e))}catch{}};window.addEventListener("pointermove",J),window.addEventListener("pointerup",oe)},style:{position:"absolute",left:0,top:0,bottom:0,width:6,cursor:"col-resize",zIndex:4}}),u.jsx(M5,{selection:ee,cue:Wr,frame:{width:Re.settings.width,height:Re.settings.height},allSceneIds:Re.sceneCues.map(D=>D.id),edits:e,onSelect:X,resolvedTheme:Re.theme,anchorText:Nk,onVideoPreview:V,runInfo:C,captionsHiddenByFlag:(b==null?void 0:b.captionsHiddenByFlag)===!0,fromLive:st.fromLive,hasOldClockPreimage:st.hasOldClockPreimage,toSourceSec:st.toSourceSec,onClockRefused:c,sfxMarker:Mk,sfxLibrary:U,sfxEnabled:$.sfx!==null,lutMenu:O,deletedScenes:gs,playheadSec:()=>{var D;return(((D=St.current)==null?void 0:D.getCurrentFrame())??0)/Re.settings.fps},sfxWordAtPlayhead:()=>{var J;const D=(((J=St.current)==null?void 0:J.getCurrentFrame())??0)/Re.settings.fps;return xk(Ja,D)}})]})]}),u.jsx(oL,{cues:Re.sceneCues,cuts:e.doc.cuts,spans:Re.spans??[],cleanup:I,durationSec:Re.outputDurationSec,fps:Re.settings.fps,playerRef:St,selection:ee,onSelect:X,edits:e,onRevived:ue,videoSrc:Re.videoFileName,toLive:st.toLive,pinSourceSec:st.toSourceSec,sfxMarkers:$.sfx===null?null:Gc,sfxWords:Ja,sfxSelected:Z,onSelectSfx:N,toSourceSec:D=>{var J;for(const oe of Re.spans??[])if(D>=oe.outIn&&D<oe.outOut)return oe.srcIn+(D-oe.outIn);return((J=(Re.spans??[])[0])==null?void 0:J.srcIn)??D}})]})},gz=({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))})},yz=()=>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"})]}),vz=()=>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"})]}),uf={fontFamily:"'Inter', system-ui, sans-serif",background:"#0B0B0E",color:"#EDEDF2",height:"100vh",overflow:"hidden",display:"flex",flexDirection:"column"},wz={display:"flex",alignItems:"center",gap:14,padding:"10px 20px",borderBottom:"1px solid #1E1E24",background:"#111116"},xz={fontWeight:800,fontSize:14,letterSpacing:"0.02em",color:"#FFE14D",marginRight:8},bz={fontSize:12,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#6a6a75",maxWidth:260,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},Sz={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"},kz={background:"#FFE14D",color:"#0B0B0E",border:"1px solid #FFE14D"},Ez={position:"fixed",inset:0,zIndex:30},Cz={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"},V0={fontSize:12,fontWeight:600,color:"#EDEDF2",background:"transparent",border:"none",borderRadius:4,padding:"8px 10px",cursor:"pointer",textAlign:"left"},Iz={display:"flex",flex:1,minHeight:0},cf=32,H0="ossclip.transcriptWidth",U0=e=>Math.min(640,Math.max(220,e)),jz={width:5,flexShrink:0,cursor:"col-resize",background:"#1E1E24",borderLeft:"1px solid #2A2A33"},Tz={position:"relative",flex:1,minWidth:0},Rz={position:"absolute",inset:0,display:"flex",overflow:"auto"},Fz={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},df={width:22,height:18,fontSize:12,lineHeight:1,color:"#EDEDF2",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:4,cursor:"pointer",padding:0},Pz={fontSize:10,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#9A9AA3",minWidth:34,textAlign:"center"},$z={fontSize:10,color:"#55555f",userSelect:"none"},Mz={flexShrink:0,borderLeft:"1px solid #1E1E24",background:"#111116",overflowY:"auto"},_z={fontSize:11,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#9A9AA3",background:"#0F0F14",borderBottom:"1px solid #2A2A33",padding:"6px 20px",whiteSpace:"pre-wrap",flexShrink:0},pi={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},Z0={display:"flex",alignItems:"center",gap:10,marginBottom:4},Az={width:12,height:12,flexShrink:0,border:"2px solid #2A2A33",borderTopColor:"#FFE14D",borderRadius:"50%",animation:"ossclip-spin 0.8s linear infinite"},Nz={flex:1,maxWidth:260,height:4,background:"#1E1E24",borderRadius:2,overflow:"hidden"},Lz={height:"100%",background:"#FFE14D",borderRadius:2,transition:"width 0.6s ease"},Oz={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"};ff.createRoot(document.getElementById("root")).render(u.jsx(ge.StrictMode,{children:u.jsx(mz,{})}));