@clipen/clipen-cli 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -4
- package/apps/web/dist/assets/{index-CaxEZKLc.css → index-CJ80KHsQ.css} +1 -1
- package/apps/web/dist/assets/index-C_4u_hVf.js +16 -0
- package/apps/web/dist/index.html +2 -2
- package/bin/clipen.js +237 -78
- package/package.json +8 -2
- package/pyproject.toml +1 -1
- package/src/clipen/__init__.py +1 -1
- package/src/clipen/analysis/qwen_worker.py +13 -4
- package/src/clipen/analysis/setup.py +26 -1
- package/src/clipen/analysis/setup_cli.py +59 -10
- package/src/clipen/bootstrap.py +411 -176
- package/src/clipen/cli.py +40 -15
- package/src/clipen/controller/app.py +37 -17
- package/src/clipen/controller/server.py +65 -27
- package/src/clipen/editing/agent_repository.py +8 -0
- package/src/clipen/editing/alignment_setup.py +40 -15
- package/src/clipen/editing/change_report.py +17 -0
- package/src/clipen/editing/coordinator.py +6 -0
- package/src/clipen/editing/evidence_jobs.py +3 -1
- package/src/clipen/editing/history_changes.py +56 -27
- package/src/clipen/editing/production_catalog.py +3 -3
- package/src/clipen/editing/production_media.py +18 -0
- package/src/clipen/editing/production_progress.py +46 -3
- package/src/clipen/editing/production_tools.py +3 -1
- package/src/clipen/editing/versions.py +53 -10
- package/src/clipen/finishing/audio.py +59 -45
- package/src/clipen/i18n.py +155 -0
- package/src/clipen/locale_en.py +528 -0
- package/src/clipen/mcp_editing/__main__.py +8 -0
- package/src/clipen/own_python.py +43 -0
- package/src/clipen/projects/models.py +16 -1
- package/src/clipen/projects/picker.py +3 -1
- package/src/clipen/projects/storage.py +17 -1
- package/src/clipen/providers/claude_editing.py +3 -1
- package/src/clipen/providers/codex_editing.py +3 -1
- package/src/clipen/providers/editing_agent.py +36 -1
- package/src/clipen/providers/liveness.py +39 -0
- package/src/clipen/rendering/custom_components.py +104 -2
- package/src/clipen/rendering/custom_render.py +45 -0
- package/src/clipen/skills/builtin/display.en.json +89 -0
- package/src/clipen/skills/builtin/references/graphics.md +1 -2
- package/src/clipen/skills/catalog.py +22 -0
- package/src/clipen/terminal.py +344 -0
- package/src/clipen/workspace.py +97 -28
- package/apps/web/dist/assets/index-C3Zw0WaM.js +0 -14
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports);(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var t=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`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`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function ee(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var k=/\/+/g;function A(e,t){return typeof e==`object`&&e&&e.key!=null?ee(``+e.key):t.toString(36)}function j(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function te(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,te(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+A(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(k,`$&/`)+`/`),te(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(k,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+A(a,u),c+=te(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+A(a,u++),c+=te(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return te(j(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function ne(e,t,n){if(e==null)return e;var r=[],i=0;return te(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function re(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var M=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},N={map:ne,forEach:function(e,t,n){ne(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return ne(e,function(){t++}),t},toArray:function(e){return ne(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=N,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:re}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,M)}catch(e){M(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.8`})),n=e(((e,n)=>{n.exports=t()})),r=e((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&A(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&A(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var ee=new MessageChannel,k=ee.port2;ee.port1.onmessage=D,O=function(){k.postMessage(null)}}else O=function(){_(D,0)};function A(t,n){C=_(function(){t(e.unstable_now())},n)}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(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,A(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),i=e(((e,t)=>{t.exports=r()})),a=e((e=>{var t=n();function r(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;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.`}function i(){}var a={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`);function s(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(r(299));return s(e,t,null,n)},e.flushSync=function(e){var t=c.T,n=a.p;try{if(c.T=null,a.p=2,e)return e()}finally{c.T=t,a.p=n,a.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??a.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=l(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else a.d.m(e)}},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.8`})),o=e(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=a()})),s=e((e=>{var t=i(),r=n(),a=o();function s(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;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.`}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function l(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 u(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 d(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function f(e){if(l(e)!==e)throw Error(s(188))}function p(e){var t=e.alternate;if(!t){if(t=l(e),t===null)throw Error(s(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return f(i),e;if(a===r)return f(i),t;a=a.sibling}throw Error(s(188))}if(n.return!==r.return)n=i,r=a;else{for(var o=!1,c=i.child;c;){if(c===n){o=!0,n=i,r=a;break}if(c===r){o=!0,r=i,n=a;break}c=c.sibling}if(!o){for(c=a.child;c;){if(c===n){o=!0,n=a,r=i;break}if(c===r){o=!0,r=a,n=i;break}c=c.sibling}if(!o)throw Error(s(189))}}if(n.alternate!==r)throw Error(s(190))}if(n.tag!==3)throw Error(s(188));return n.stateNode.current===n?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),ee=Symbol.for(`react.activity`),k=Symbol.for(`react.memo_cache_sentinel`),A=Symbol.iterator;function j(e){return typeof e!=`object`||!e?null:(e=A&&e[A]||e[`@@iterator`],typeof e==`function`?e:null)}var te=Symbol.for(`react.client.reference`);function ne(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===te?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case ee:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?ne(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return ne(e(t))}catch{}}return null}var re=Array.isArray,M=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,N=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P={pending:!1,data:null,method:null,action:null},F=[],I=-1;function ie(e){return{current:e}}function L(e){0>I||(e.current=F[I],F[I]=null,I--)}function R(e,t){I++,F[I]=e.current,e.current=t}var ae=ie(null),oe=ie(null),se=ie(null),ce=ie(null);function le(e,t){switch(R(se,t),R(oe,e),R(ae,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}L(ae),R(ae,e)}function ue(){L(ae),L(oe),L(se)}function z(e){e.memoizedState!==null&&R(ce,e);var t=ae.current,n=Hd(t,e.type);t!==n&&(R(oe,e),R(ae,n))}function de(e){oe.current===e&&(L(ae),L(oe)),ce.current===e&&(L(ce),Qf._currentValue=P)}var fe,pe;function B(e){if(fe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);fe=t&&t[1]||``,pe=-1<e.stack.indexOf(`
|
|
2
|
-
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
3
|
-
`+fe+e+pe}var me=!1;function he(e,t){if(!e||me)return``;me=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
4
|
-
`),l=s.split(`
|
|
5
|
-
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
|
|
6
|
-
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{me=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?B(n):``}function ge(e,t){switch(e.tag){case 26:case 27:case 5:return B(e.type);case 16:return B(`Lazy`);case 13:return e.child!==t&&t!==null?B(`Suspense Fallback`):B(`Suspense`);case 19:return B(`SuspenseList`);case 0:case 15:return he(e.type,!1);case 11:return he(e.type.render,!1);case 1:return he(e.type,!0);case 31:return B(`Activity`);default:return``}}function _e(e){try{var t=``,n=null;do t+=ge(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
7
|
-
Error generating stack: `+e.message+`
|
|
8
|
-
`+e.stack}}var ve=Object.prototype.hasOwnProperty,ye=t.unstable_scheduleCallback,V=t.unstable_cancelCallback,be=t.unstable_shouldYield,xe=t.unstable_requestPaint,H=t.unstable_now,Se=t.unstable_getCurrentPriorityLevel,Ce=t.unstable_ImmediatePriority,U=t.unstable_UserBlockingPriority,we=t.unstable_NormalPriority,Te=t.unstable_LowPriority,Ee=t.unstable_IdlePriority,De=t.log,Oe=t.unstable_setDisableYieldValue,ke=null,Ae=null;function je(e){if(typeof De==`function`&&Oe(e),Ae&&typeof Ae.setStrictMode==`function`)try{Ae.setStrictMode(ke,e)}catch{}}var Me=Math.clz32?Math.clz32:Fe,Ne=Math.log,Pe=Math.LN2;function Fe(e){return e>>>=0,e===0?32:31-(Ne(e)/Pe|0)|0}var Ie=256,Le=262144,Re=4194304;function ze(e){var t=e&42;if(t!==0)return t;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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Be(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=ze(n))):i=ze(o):i=ze(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=ze(n))):i=ze(o)):i=ze(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Ve(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function He(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32: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:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ue(){var e=Re;return Re<<=1,!(Re&62914560)&&(Re=4194304),e}function We(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ge(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ke(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Me(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&qe(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function qe(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Me(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Je(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Me(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Ye(e,t){var n=t&-t;return n=n&42?1:Xe(n),(n&(e.suspendedLanes|t))===0?n:0}function Xe(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Ze(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function Qe(){var e=N.p;return e===0?(e=window.event,e===void 0?32:mp(e.type)):e}function $e(e,t){var n=N.p;try{return N.p=e,t()}finally{N.p=n}}var et=Math.random().toString(36).slice(2),tt=`__reactFiber$`+et,nt=`__reactProps$`+et,rt=`__reactContainer$`+et,it=`__reactEvents$`+et,at=`__reactListeners$`+et,ot=`__reactHandles$`+et,st=`__reactResources$`+et,ct=`__reactMarker$`+et;function lt(e){delete e[tt],delete e[nt],delete e[it],delete e[at],delete e[ot]}function ut(e){var t=e[tt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[rt]||n[tt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=df(e);e!==null;){if(n=e[tt])return n;e=df(e)}return t}e=n,n=e.parentNode}return null}function dt(e){if(e=e[tt]||e[rt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function ft(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(s(33))}function pt(e){var t=e[st];return t||=e[st]={hoistableStyles:new Map,hoistableScripts:new Map},t}function mt(e){e[ct]=!0}var ht=new Set,gt={};function _t(e,t){vt(e,t),vt(e+`Capture`,t)}function vt(e,t){for(gt[e]=t,e=0;e<t.length;e++)ht.add(t[e])}var yt=RegExp(`^[: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]*$`),bt={},xt={};function St(e){return ve.call(xt,e)?!0:ve.call(bt,e)?!1:yt.test(e)?xt[e]=!0:(bt[e]=!0,!1)}function Ct(e,t,n){if(St(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}}function wt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function Tt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function Et(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Dt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Ot(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function kt(e){if(!e._valueTracker){var t=Dt(e)?`checked`:`value`;e._valueTracker=Ot(e,t,``+e[t])}}function At(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Dt(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function jt(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Mt=/[\n"\\]/g;function Nt(e){return e.replace(Mt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Pt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Et(t)):e.value!==``+Et(t)&&(e.value=``+Et(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):It(e,o,Et(n)):It(e,o,Et(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Et(s):e.removeAttribute(`name`)}function Ft(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){kt(e);return}n=n==null?``:``+Et(n),t=t==null?n:``+Et(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),kt(e)}function It(e,t,n){t===`number`&&jt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Lt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+Et(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Rt(e,t,n){if(t!=null&&(t=``+Et(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Et(n)}function zt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(s(92));if(re(r)){if(1<r.length)throw Error(s(93));r=r[0]}n=r}n??=``,t=n}n=Et(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),kt(e)}function Bt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Vt=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function Ht(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Vt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Ut(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(s(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var i in t)r=t[i],t.hasOwnProperty(i)&&n[i]!==r&&Ht(e,i,r)}else for(var a in t)t.hasOwnProperty(a)&&Ht(e,a,t[a])}function Wt(e){if(e.indexOf(`-`)===-1)return!1;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 Gt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),Kt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function qt(e){return Kt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Jt(){}var Yt=null;function Xt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Zt=null,Qt=null;function $t(e){var t=dt(e);if(t&&(e=t.stateNode)){var n=e[nt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Pt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Nt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=r[nt]||null;if(!i)throw Error(s(90));Pt(r,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&At(r)}break a;case`textarea`:Rt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Lt(e,!!n.multiple,t,!1)}}}var en=!1;function tn(e,t,n){if(en)return e(t,n);en=!0;try{return e(t)}finally{if(en=!1,(Zt!==null||Qt!==null)&&(bu(),Zt&&(t=Zt,e=Qt,Qt=Zt=null,$t(t),e)))for(t=0;t<e.length;t++)$t(e[t])}}function nn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[nt]||null;if(r===null)return null;n=r[t];a: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 a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(s(231,t,typeof n));return n}var rn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),an=!1;if(rn)try{var on={};Object.defineProperty(on,"passive",{get:function(){an=!0}}),window.addEventListener(`test`,on,on),window.removeEventListener(`test`,on,on)}catch{an=!1}var sn=null,cn=null,ln=null;function un(){if(ln)return ln;var e,t=cn,n=t.length,r,i=`value`in sn?sn.value:sn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return ln=i.slice(e,1<r?1-r:void 0)}function dn(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 fn(){return!0}function pn(){return!1}function mn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?fn:pn,this.isPropagationStopped=pn,this}return h(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=fn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=fn)},persist:function(){},isPersistent:fn}),t}var hn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},gn=mn(hn),_n=h({},hn,{view:0,detail:0}),vn=mn(_n),yn,bn,xn,Sn=h({},_n,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Nn,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!==xn&&(xn&&e.type===`mousemove`?(yn=e.screenX-xn.screenX,bn=e.screenY-xn.screenY):bn=yn=0,xn=e),yn)},movementY:function(e){return`movementY`in e?e.movementY:bn}}),Cn=mn(Sn),wn=mn(h({},Sn,{dataTransfer:0})),Tn=mn(h({},_n,{relatedTarget:0})),En=mn(h({},hn,{animationName:0,elapsedTime:0,pseudoElement:0})),Dn=mn(h({},hn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),On=mn(h({},hn,{data:0})),kn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},An={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`},jn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Mn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=jn[e])?!!t[e]:!1}function Nn(){return Mn}var Pn=mn(h({},_n,{key:function(e){if(e.key){var t=kn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=dn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?An[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Nn,charCode:function(e){return e.type===`keypress`?dn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?dn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Fn=mn(h({},Sn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),In=mn(h({},_n,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Nn})),Ln=mn(h({},hn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Rn=mn(h({},Sn,{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})),zn=mn(h({},hn,{newState:0,oldState:0})),Bn=[9,13,27,32],Vn=rn&&`CompositionEvent`in window,Hn=null;rn&&`documentMode`in document&&(Hn=document.documentMode);var Un=rn&&`TextEvent`in window&&!Hn,Wn=rn&&(!Vn||Hn&&8<Hn&&11>=Hn),Gn=` `,Kn=!1;function qn(e,t){switch(e){case`keyup`:return Bn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Jn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Yn=!1;function Xn(e,t){switch(e){case`compositionend`:return Jn(t);case`keypress`:return t.which===32?(Kn=!0,Gn):null;case`textInput`:return e=t.data,e===Gn&&Kn?null:e;default:return null}}function Zn(e,t){if(Yn)return e===`compositionend`||!Vn&&qn(e,t)?(e=un(),ln=cn=sn=null,Yn=!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 Wn&&t.locale!==`ko`?null:t.data;default:return null}}var Qn={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 $n(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Qn[e.type]:t===`textarea`}function er(e,t,n,r){Zt?Qt?Qt.push(r):Qt=[r]:Zt=r,t=Ed(t,`onChange`),0<t.length&&(n=new gn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var tr=null,nr=null;function rr(e){yd(e,0)}function ir(e){if(At(ft(e)))return e}function ar(e,t){if(e===`change`)return t}var or=!1;if(rn){var sr;if(rn){var cr=`oninput`in document;if(!cr){var lr=document.createElement(`div`);lr.setAttribute(`oninput`,`return;`),cr=typeof lr.oninput==`function`}sr=cr}else sr=!1;or=sr&&(!document.documentMode||9<document.documentMode)}function ur(){tr&&(tr.detachEvent(`onpropertychange`,dr),nr=tr=null)}function dr(e){if(e.propertyName===`value`&&ir(nr)){var t=[];er(t,nr,e,Xt(e)),tn(rr,t)}}function fr(e,t,n){e===`focusin`?(ur(),tr=t,nr=n,tr.attachEvent(`onpropertychange`,dr)):e===`focusout`&&ur()}function pr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return ir(nr)}function mr(e,t){if(e===`click`)return ir(t)}function hr(e,t){if(e===`input`||e===`change`)return ir(t)}function gr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var _r=typeof Object.is==`function`?Object.is:gr;function vr(e,t){if(_r(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)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 i=n[r];if(!ve.call(t,i)||!_r(e[i],t[i]))return!1}return!0}function yr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function br(e,t){var n=yr(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}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=yr(n)}}function xr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?xr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Sr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=jt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=jt(e.document)}return t}function Cr(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`)}var wr=rn&&`documentMode`in document&&11>=document.documentMode,Tr=null,Er=null,Dr=null,Or=!1;function kr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Or||Tr==null||Tr!==jt(r)||(r=Tr,`selectionStart`in r&&Cr(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}),Dr&&vr(Dr,r)||(Dr=r,r=Ed(Er,`onSelect`),0<r.length&&(t=new gn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Tr)))}function Ar(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var jr={animationend:Ar(`Animation`,`AnimationEnd`),animationiteration:Ar(`Animation`,`AnimationIteration`),animationstart:Ar(`Animation`,`AnimationStart`),transitionrun:Ar(`Transition`,`TransitionRun`),transitionstart:Ar(`Transition`,`TransitionStart`),transitioncancel:Ar(`Transition`,`TransitionCancel`),transitionend:Ar(`Transition`,`TransitionEnd`)},Mr={},Nr={};rn&&(Nr=document.createElement(`div`).style,`AnimationEvent`in window||(delete jr.animationend.animation,delete jr.animationiteration.animation,delete jr.animationstart.animation),`TransitionEvent`in window||delete jr.transitionend.transition);function Pr(e){if(Mr[e])return Mr[e];if(!jr[e])return e;var t=jr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Nr)return Mr[e]=t[n];return e}var Fr=Pr(`animationend`),Ir=Pr(`animationiteration`),Lr=Pr(`animationstart`),Rr=Pr(`transitionrun`),zr=Pr(`transitionstart`),Br=Pr(`transitioncancel`),Vr=Pr(`transitionend`),Hr=new Map,Ur=`abort auxClick beforeToggle 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(` `);Ur.push(`scrollEnd`);function Wr(e,t){Hr.set(e,t),_t(t,[e])}var Gr=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Kr=[],qr=0,Jr=0;function Yr(){for(var e=qr,t=Jr=qr=0;t<e;){var n=Kr[t];Kr[t++]=null;var r=Kr[t];Kr[t++]=null;var i=Kr[t];Kr[t++]=null;var a=Kr[t];if(Kr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&$r(n,i,a)}}function Xr(e,t,n,r){Kr[qr++]=e,Kr[qr++]=t,Kr[qr++]=n,Kr[qr++]=r,Jr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Zr(e,t,n,r){return Xr(e,t,n,r),ei(e)}function Qr(e,t){return Xr(e,null,null,t),ei(e)}function $r(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Me(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function ei(e){if(50<du)throw du=0,fu=null,Error(s(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ti={};function ni(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.refCleanup=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 ri(e,t,n,r){return new ni(e,t,n,r)}function ii(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ai(e,t){var n=e.alternate;return n===null?(n=ri(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&65011712,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.refCleanup=e.refCleanup,n}function oi(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function si(e,t,n,r,i,a){var o=0;if(r=e,typeof e==`function`)ii(e)&&(o=1);else if(typeof e==`string`)o=Uf(e,n,ae.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case ee:return e=ri(31,n,t,i),e.elementType=ee,e.lanes=a,e;case y:return ci(n.children,i,a,t);case b:o=8,i|=24;break;case x:return e=ri(12,n,t,i|2),e.elementType=x,e.lanes=a,e;case T:return e=ri(13,n,t,i),e.elementType=T,e.lanes=a,e;case E:return e=ri(19,n,t,i),e.elementType=E,e.lanes=a,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case C:o=10;break a;case S:o=9;break a;case w:o=11;break a;case D:o=14;break a;case O:o=16,r=null;break a}o=29,n=Error(s(130,e===null?`null`:typeof e,``)),r=null}return t=ri(o,n,t,i),t.elementType=e,t.type=r,t.lanes=a,t}function ci(e,t,n,r){return e=ri(7,e,r,t),e.lanes=n,e}function li(e,t,n){return e=ri(6,e,null,t),e.lanes=n,e}function ui(e){var t=ri(18,null,null,0);return t.stateNode=e,t}function di(e,t,n){return t=ri(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var fi=new WeakMap;function pi(e,t){if(typeof e==`object`&&e){var n=fi.get(e);return n===void 0?(t={value:e,source:t,stack:_e(t)},fi.set(e,t),t):n}return{value:e,source:t,stack:_e(t)}}var mi=[],hi=0,gi=null,_i=0,vi=[],yi=0,bi=null,xi=1,Si=``;function Ci(e,t){mi[hi++]=_i,mi[hi++]=gi,gi=e,_i=t}function wi(e,t,n){vi[yi++]=xi,vi[yi++]=Si,vi[yi++]=bi,bi=e;var r=xi;e=Si;var i=32-Me(r)-1;r&=~(1<<i),n+=1;var a=32-Me(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,xi=1<<32-Me(t)+i|n<<i|r,Si=a+e}else xi=1<<a|n<<i|r,Si=e}function Ti(e){e.return!==null&&(Ci(e,1),wi(e,1,0))}function Ei(e){for(;e===gi;)gi=mi[--hi],mi[hi]=null,_i=mi[--hi],mi[hi]=null;for(;e===bi;)bi=vi[--yi],vi[yi]=null,Si=vi[--yi],vi[yi]=null,xi=vi[--yi],vi[yi]=null}function Di(e,t){vi[yi++]=xi,vi[yi++]=Si,vi[yi++]=bi,xi=t.id,Si=t.overflow,bi=e}var Oi=null,ki=null,W=!1,Ai=null,ji=!1,Mi=Error(s(519));function Ni(e){throw zi(pi(Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Mi}function Pi(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[tt]=e,t[nt]=r,n){case`dialog`:Q(`cancel`,t),Q(`close`,t);break;case`iframe`:case`object`:case`embed`:Q(`load`,t);break;case`video`:case`audio`:for(n=0;n<_d.length;n++)Q(_d[n],t);break;case`source`:Q(`error`,t);break;case`img`:case`image`:case`link`:Q(`error`,t),Q(`load`,t);break;case`details`:Q(`toggle`,t);break;case`input`:Q(`invalid`,t),Ft(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Q(`invalid`,t);break;case`textarea`:Q(`invalid`,t),zt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||Md(t.textContent,n)?(r.popover!=null&&(Q(`beforetoggle`,t),Q(`toggle`,t)),r.onScroll!=null&&Q(`scroll`,t),r.onScrollEnd!=null&&Q(`scrollend`,t),r.onClick!=null&&(t.onclick=Jt),t=!0):t=!1,t||Ni(e,!0)}function Fi(e){for(Oi=e.return;Oi;)switch(Oi.tag){case 5:case 31:case 13:ji=!1;return;case 27:case 3:ji=!0;return;default:Oi=Oi.return}}function Ii(e){if(e!==Oi)return!1;if(!W)return Fi(e),W=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||Ud(e.type,e.memoizedProps)),n=!n),n&&ki&&Ni(e),Fi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(s(317));ki=uf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(s(317));ki=uf(e)}else t===27?(t=ki,Zd(e.type)?(e=lf,lf=null,ki=e):ki=t):ki=Oi?cf(e.stateNode.nextSibling):null;return!0}function Li(){ki=Oi=null,W=!1}function Ri(){var e=Ai;return e!==null&&(Zl===null?Zl=e:Zl.push.apply(Zl,e),Ai=null),e}function zi(e){Ai===null?Ai=[e]:Ai.push(e)}var Bi=ie(null),Vi=null,Hi=null;function Ui(e,t,n){R(Bi,t._currentValue),t._currentValue=n}function Wi(e){e._currentValue=Bi.current,L(Bi)}function Gi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Ki(e,t,n,r){var i=e.child;for(i!==null&&(i.return=e);i!==null;){var a=i.dependencies;if(a!==null){var o=i.child;a=a.firstContext;a:for(;a!==null;){var c=a;a=i;for(var l=0;l<t.length;l++)if(c.context===t[l]){a.lanes|=n,c=a.alternate,c!==null&&(c.lanes|=n),Gi(a.return,n,e),r||(o=null);break a}a=c.next}}else if(i.tag===18){if(o=i.return,o===null)throw Error(s(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),Gi(o,n,e),o=null}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===e){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}}function qi(e,t,n,r){e=null;for(var i=t,a=!1;i!==null;){if(!a){if(i.flags&524288)a=!0;else if(i.flags&262144)break}if(i.tag===10){var o=i.alternate;if(o===null)throw Error(s(387));if(o=o.memoizedProps,o!==null){var c=i.type;_r(i.pendingProps.value,o.value)||(e===null?e=[c]:e.push(c))}}else if(i===ce.current){if(o=i.alternate,o===null)throw Error(s(387));o.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(e===null?e=[Qf]:e.push(Qf))}i=i.return}e!==null&&Ki(t,e,n,r),t.flags|=262144}function Ji(e){for(e=e.firstContext;e!==null;){if(!_r(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Yi(e){Vi=e,Hi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Xi(e){return Qi(Vi,e)}function Zi(e,t){return Vi===null&&Yi(e),Qi(e,t)}function Qi(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Hi===null){if(e===null)throw Error(s(308));Hi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Hi=Hi.next=t;return n}var $i=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},ea=t.unstable_scheduleCallback,ta=t.unstable_NormalPriority,na={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ra(){return{controller:new $i,data:new Map,refCount:0}}function ia(e){e.refCount--,e.refCount===0&&ea(ta,function(){e.controller.abort()})}var aa=null,oa=0,sa=0,ca=null;function la(e,t){if(aa===null){var n=aa=[];oa=0,sa=dd(),ca={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return oa++,t.then(ua,ua),t}function ua(){if(--oa===0&&aa!==null){ca!==null&&(ca.status=`fulfilled`);var e=aa;aa=null,sa=0,ca=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function da(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var fa=M.S;M.S=function(e,t){eu=H(),typeof t==`object`&&t&&typeof t.then==`function`&&la(e,t),fa!==null&&fa(e,t)};var pa=ie(null);function ma(){var e=pa.current;return e===null?Rl.pooledCache:e}function ha(e,t){t===null?R(pa,pa.current):R(pa,t.pool)}function ga(){var e=ma();return e===null?null:{parent:na._currentValue,pool:e}}var _a=Error(s(460)),va=Error(s(474)),ya=Error(s(542)),ba={then:function(){}};function xa(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Sa(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Jt,Jt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ea(e),e;default:if(typeof t.status==`string`)t.then(Jt,Jt);else{if(e=Rl,e!==null&&100<e.shellSuspendCounter)throw Error(s(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ea(e),e}throw wa=t,_a}}function Ca(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(wa=e,_a):e}}var wa=null;function Ta(){if(wa===null)throw Error(s(459));var e=wa;return wa=null,e}function Ea(e){if(e===_a||e===ya)throw Error(s(483))}var Da=null,Oa=0;function ka(e){var t=Oa;return Oa+=1,Da===null&&(Da=[]),Sa(Da,e,t)}function Aa(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function ja(e,t){throw t.$$typeof===g?Error(s(525)):(e=Object.prototype.toString.call(t),Error(s(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Ma(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function i(e,t){return e=ai(e,t),e.index=0,e.sibling=null,e}function a(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function o(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=li(n,e.mode,r),t.return=e,t):(t=i(t,n),t.return=e,t)}function l(e,t,n,r){var a=n.type;return a===y?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===a||typeof a==`object`&&a&&a.$$typeof===O&&Ca(a)===t.type)?(t=i(t,n.props),Aa(t,n),t.return=e,t):(t=si(n.type,n.key,n.props,null,e.mode,r),Aa(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=di(n,e.mode,r),t.return=e,t):(t=i(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,a){return t===null||t.tag!==7?(t=ci(n,e.mode,r,a),t.return=e,t):(t=i(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=li(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=si(t.type,t.key,t.props,null,e.mode,n),Aa(n,t),n.return=e,n;case v:return t=di(t,e.mode,n),t.return=e,t;case O:return t=Ca(t),f(e,t,n)}if(re(t)||j(t))return t=ci(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,ka(t),n);if(t.$$typeof===C)return f(e,Zi(e,t),n);ja(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case _:return n.key===i?l(e,t,n,r):null;case v:return n.key===i?u(e,t,n,r):null;case O:return n=Ca(n),p(e,t,n,r)}if(re(n)||j(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,ka(n),r);if(n.$$typeof===C)return p(e,t,Zi(e,n),r);ja(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case _:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case v:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case O:return r=Ca(r),m(e,t,n,r,i)}if(re(r)||j(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,ka(r),i);if(r.$$typeof===C)return m(e,t,n,Zi(t,r),i);ja(t,r)}return null}function h(i,o,s,c){for(var l=null,u=null,d=o,h=o=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),o=a(_,o,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),W&&Ci(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(o=a(d,o,h),u===null?l=d:u.sibling=d,u=d);return W&&Ci(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),o=a(g,o,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),W&&Ci(i,h),l}function g(i,o,c,l){if(c==null)throw Error(s(151));for(var u=null,d=null,h=o,g=o=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),o=a(y,o,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),W&&Ci(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(o=a(v,o,g),d===null?u=v:d.sibling=v,d=v);return W&&Ci(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),o=a(v,o,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),W&&Ci(i,g),u}function b(e,r,a,c){if(typeof a==`object`&&a&&a.type===y&&a.key===null&&(a=a.props.children),typeof a==`object`&&a){switch(a.$$typeof){case _:a:{for(var l=a.key;r!==null;){if(r.key===l){if(l=a.type,l===y){if(r.tag===7){n(e,r.sibling),c=i(r,a.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&Ca(l)===r.type){n(e,r.sibling),c=i(r,a.props),Aa(c,a),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}a.type===y?(c=ci(a.props.children,e.mode,c,a.key),c.return=e,e=c):(c=si(a.type,a.key,a.props,null,e.mode,c),Aa(c,a),c.return=e,e=c)}return o(e);case v:a:{for(l=a.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===a.containerInfo&&r.stateNode.implementation===a.implementation){n(e,r.sibling),c=i(r,a.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=di(a,e.mode,c),c.return=e,e=c}return o(e);case O:return a=Ca(a),b(e,r,a,c)}if(re(a))return h(e,r,a,c);if(j(a)){if(l=j(a),typeof l!=`function`)throw Error(s(150));return a=l.call(a),g(e,r,a,c)}if(typeof a.then==`function`)return b(e,r,ka(a),c);if(a.$$typeof===C)return b(e,r,Zi(e,a),c);ja(e,a)}return typeof a==`string`&&a!==``||typeof a==`number`||typeof a==`bigint`?(a=``+a,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,a),c.return=e,e=c):(n(e,r),c=li(a,e.mode,c),c.return=e,e=c),o(e)):n(e,r)}return function(e,t,n,r){try{Oa=0;var i=b(e,t,n,r);return Da=null,i}catch(t){if(t===_a||t===ya)throw t;var a=ri(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Na=Ma(!0),Pa=Ma(!1),Fa=!1;function Ia(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function La(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ra(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function za(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,q&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ei(e),$r(e,null,n),t}return Xr(e,r,t,n),ei(e)}function Ba(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Je(e,n)}}function Va(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ha=!1;function Ua(){if(Ha){var e=ca;if(e!==null)throw e}}function Wa(e,t,n,r){Ha=!1;var i=e.updateQueue;Fa=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Y&f)===f:(r&f)===f){f!==0&&f===sa&&(Ha=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(m=g.payload,typeof m==`function`){d=m.call(_,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m==`function`?m.call(_,d,f):m,f==null)break a;d=h({},d,f);break a;case 2:Fa=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Gl|=o,e.lanes=o,e.memoizedState=d}}function Ga(e,t){if(typeof e!=`function`)throw Error(s(191,e));e.call(t)}function Ka(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ga(n[e],t)}var qa=ie(null),Ja=ie(0);function Ya(e,t){e=Ul,R(Ja,e),R(qa,t),Ul=e|t.baseLanes}function Xa(){R(Ja,Ul),R(qa,qa.current)}function Za(){Ul=Ja.current,L(qa),L(Ja)}var Qa=ie(null),$a=null;function eo(e){var t=e.alternate;R(ao,ao.current&1),R(Qa,e),$a===null&&(t===null||qa.current!==null||t.memoizedState!==null)&&($a=e)}function to(e){R(ao,ao.current),R(Qa,e),$a===null&&($a=e)}function no(e){e.tag===22?(R(ao,ao.current),R(Qa,e),$a===null&&($a=e)):ro(e)}function ro(){R(ao,ao.current),R(Qa,Qa.current)}function io(e){L(Qa),$a===e&&($a=null),L(ao)}var ao=ie(0);function oo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||af(n)||of(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){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 so=0,G=null,K=null,co=null,lo=!1,uo=!1,fo=!1,po=0,mo=0,ho=null,go=0;function _o(){throw Error(s(321))}function vo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!_r(e[n],t[n]))return!1;return!0}function yo(e,t,n,r,i,a){return so=a,G=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,M.H=e===null||e.memoizedState===null?Is:Ls,fo=!1,a=n(r,i),fo=!1,uo&&(a=xo(t,n,r,i)),bo(e),a}function bo(e){M.H=Fs;var t=K!==null&&K.next!==null;if(so=0,co=K=G=null,lo=!1,mo=0,ho=null,t)throw Error(s(300));e===null||ec||(e=e.dependencies,e!==null&&Ji(e)&&(ec=!0))}function xo(e,t,n,r){G=e;var i=0;do{if(uo&&(ho=null),mo=0,uo=!1,25<=i)throw Error(s(301));if(i+=1,co=K=null,e.updateQueue!=null){var a=e.updateQueue;a.lastEffect=null,a.events=null,a.stores=null,a.memoCache!=null&&(a.memoCache.index=0)}M.H=Rs,a=t(n,r)}while(uo);return a}function So(){var e=M.H,t=e.useState()[0];return t=typeof t.then==`function`?ko(t):t,e=e.useState()[0],(K===null?null:K.memoizedState)!==e&&(G.flags|=1024),t}function Co(){var e=po!==0;return po=0,e}function wo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function To(e){if(lo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}lo=!1}so=0,co=K=G=null,uo=!1,mo=po=0,ho=null}function Eo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return co===null?G.memoizedState=co=e:co=co.next=e,co}function Do(){if(K===null){var e=G.alternate;e=e===null?null:e.memoizedState}else e=K.next;var t=co===null?G.memoizedState:co.next;if(t!==null)co=t,K=e;else{if(e===null)throw G.alternate===null?Error(s(467)):Error(s(310));K=e,e={memoizedState:K.memoizedState,baseState:K.baseState,baseQueue:K.baseQueue,queue:K.queue,next:null},co===null?G.memoizedState=co=e:co=co.next=e}return co}function Oo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ko(e){var t=mo;return mo+=1,ho===null&&(ho=[]),e=Sa(ho,e,t),t=G,(co===null?t.memoizedState:co.next)===null&&(t=t.alternate,M.H=t===null||t.memoizedState===null?Is:Ls),e}function Ao(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return ko(e);if(e.$$typeof===C)return Xi(e)}throw Error(s(438,String(e)))}function jo(e){var t=null,n=G.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=G.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Oo(),G.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=k;return t.index++,n}function Mo(e,t){return typeof t==`function`?t(e):t}function No(e){return Po(Do(),K,e)}function Po(e,t,n){var r=e.queue;if(r===null)throw Error(s(311));r.lastRenderedReducer=n;var i=e.baseQueue,a=r.pending;if(a!==null){if(i!==null){var o=i.next;i.next=a.next,a.next=o}t.baseQueue=i=a,r.pending=null}if(a=e.baseState,i===null)e.memoizedState=a;else{t=i.next;var c=o=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(so&f)===f:(Y&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===sa&&(d=!0);else if((so&p)===p){u=u.next,p===sa&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,o=a):l=l.next=f,G.lanes|=p,Gl|=p;f=u.action,fo&&n(a,f),a=u.hasEagerState?u.eagerState:n(a,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,o=a):l=l.next=p,G.lanes|=f,Gl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?o=a:l.next=c,!_r(a,e.memoizedState)&&(ec=!0,d&&(n=ca,n!==null)))throw n;e.memoizedState=a,e.baseState=o,e.baseQueue=l,r.lastRenderedState=a}return i===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Fo(e){var t=Do(),n=t.queue;if(n===null)throw Error(s(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,a=t.memoizedState;if(i!==null){n.pending=null;var o=i=i.next;do a=e(a,o.action),o=o.next;while(o!==i);_r(a,t.memoizedState)||(ec=!0),t.memoizedState=a,t.baseQueue===null&&(t.baseState=a),n.lastRenderedState=a}return[a,r]}function Io(e,t,n){var r=G,i=Do(),a=W;if(a){if(n===void 0)throw Error(s(407));n=n()}else n=t();var o=!_r((K||i).memoizedState,n);if(o&&(i.memoizedState=n,ec=!0),i=i.queue,ss(zo.bind(null,r,i,e),[e]),i.getSnapshot!==t||o||co!==null&&co.memoizedState.tag&1){if(r.flags|=2048,ns(9,{destroy:void 0},Ro.bind(null,r,i,n,t),null),Rl===null)throw Error(s(349));a||so&127||Lo(r,t,n)}return n}function Lo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=G.updateQueue,t===null?(t=Oo(),G.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Ro(e,t,n,r){t.value=n,t.getSnapshot=r,Bo(t)&&Vo(e)}function zo(e,t,n){return n(function(){Bo(t)&&Vo(e)})}function Bo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!_r(e,n)}catch{return!0}}function Vo(e){var t=Qr(e,2);t!==null&&hu(t,e,2)}function Ho(e){var t=Eo();if(typeof e==`function`){var n=e;if(e=n(),fo){je(!0);try{n()}finally{je(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mo,lastRenderedState:e},t}function Uo(e,t,n,r){return e.baseState=n,Po(e,K,typeof r==`function`?r:Mo)}function Wo(e,t,n,r,i){if(Ms(e))throw Error(s(485));if(e=t.action,e!==null){var a={payload:i,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){a.listeners.push(e)}};M.T===null?a.isTransition=!1:n(!0),r(a),n=t.pending,n===null?(a.next=t.pending=a,Go(t,a)):(a.next=n.next,t.pending=n.next=a)}}function Go(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=M.T,o={};M.T=o;try{var s=n(i,r),c=M.S;c!==null&&c(o,s),Ko(e,t,s)}catch(n){Jo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),M.T=a}}else try{a=n(i,r),Ko(e,t,a)}catch(n){Jo(e,t,n)}}function Ko(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){qo(e,t,n)},function(n){return Jo(e,t,n)}):qo(e,t,n)}function qo(e,t,n){t.status=`fulfilled`,t.value=n,Yo(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Go(e,n)))}function Jo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Yo(t),t=t.next;while(t!==r)}e.action=null}function Yo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Xo(e,t){return t}function Zo(e,t){if(W){var n=Rl.formState;if(n!==null){a:{var r=G;if(W){if(ki){b:{for(var i=ki,a=ji;i.nodeType!==8;){if(!a){i=null;break b}if(i=cf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){ki=cf(i.nextSibling),r=i.data===`F!`;break a}}Ni(r)}r=!1}r&&(t=n[0])}}return n=Eo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xo,lastRenderedState:t},n.queue=r,n=ks.bind(null,G,r),r.dispatch=n,r=Ho(!1),a=js.bind(null,G,!1,r.queue),r=Eo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Wo.bind(null,G,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Qo(e){return $o(Do(),K,e)}function $o(e,t,n){if(t=Po(e,t,Xo)[0],e=No(Mo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=ko(t)}catch(e){throw e===_a?ya:e}else r=t;t=Do();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(G.flags|=2048,ns(9,{destroy:void 0},es.bind(null,i,n),null)),[r,a,e]}function es(e,t){e.action=t}function ts(e){var t=Do(),n=K;if(n!==null)return $o(t,n,e);Do(),t=t.memoizedState,n=Do();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function ns(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=G.updateQueue,t===null&&(t=Oo(),G.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function rs(){return Do().memoizedState}function is(e,t,n,r){var i=Eo();G.flags|=e,i.memoizedState=ns(1|t,{destroy:void 0},n,r===void 0?null:r)}function as(e,t,n,r){var i=Do();r=r===void 0?null:r;var a=i.memoizedState.inst;K!==null&&r!==null&&vo(r,K.memoizedState.deps)?i.memoizedState=ns(t,a,n,r):(G.flags|=e,i.memoizedState=ns(1|t,a,n,r))}function os(e,t){is(8390656,8,e,t)}function ss(e,t){as(2048,8,e,t)}function cs(e){G.flags|=4;var t=G.updateQueue;if(t===null)t=Oo(),G.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function ls(e){var t=Do().memoizedState;return cs({ref:t,nextImpl:e}),function(){if(q&2)throw Error(s(440));return t.impl.apply(void 0,arguments)}}function us(e,t){return as(4,2,e,t)}function ds(e,t){return as(4,4,e,t)}function fs(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function ps(e,t,n){n=n==null?null:n.concat([e]),as(4,4,fs.bind(null,t,e),n)}function ms(){}function hs(e,t){var n=Do();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&vo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function gs(e,t){var n=Do();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&vo(t,r[1]))return r[0];if(r=e(),fo){je(!0);try{e()}finally{je(!1)}}return n.memoizedState=[r,t],r}function _s(e,t,n){return n===void 0||so&1073741824&&!(Y&261930)?e.memoizedState=t:(e.memoizedState=n,e=mu(),G.lanes|=e,Gl|=e,n)}function vs(e,t,n,r){return _r(n,t)?n:qa.current===null?!(so&42)||so&1073741824&&!(Y&261930)?(ec=!0,e.memoizedState=n):(e=mu(),G.lanes|=e,Gl|=e,t):(e=_s(e,n,r),_r(e,t)||(ec=!0),e)}function ys(e,t,n,r,i){var a=N.p;N.p=a!==0&&8>a?a:8;var o=M.T,s={};M.T=s,js(e,!1,t,n);try{var c=i(),l=M.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?As(e,t,da(c,r),pu(e)):As(e,t,r,pu(e))}catch(n){As(e,t,{then:function(){},status:`rejected`,reason:n},pu())}finally{N.p=a,o!==null&&s.types!==null&&(o.types=s.types),M.T=o}}function bs(){}function xs(e,t,n,r){if(e.tag!==5)throw Error(s(476));var i=Ss(e).queue;ys(e,i,t,P,n===null?bs:function(){return Cs(e),n(r)})}function Ss(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:P,baseState:P,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mo,lastRenderedState:P},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Cs(e){var t=Ss(e);t.next===null&&(t=e.alternate.memoizedState),As(e,t.next.queue,{},pu())}function ws(){return Xi(Qf)}function Ts(){return Do().memoizedState}function Es(){return Do().memoizedState}function Ds(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=pu();e=Ra(n);var r=za(t,e,n);r!==null&&(hu(r,t,n),Ba(r,t,n)),t={cache:ra()},e.payload=t;return}t=t.return}}function Os(e,t,n){var r=pu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ms(e)?Ns(t,n):(n=Zr(e,t,n,r),n!==null&&(hu(n,e,r),Ps(n,t,r)))}function ks(e,t,n){As(e,t,n,pu())}function As(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ms(e))Ns(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,_r(s,o))return Xr(e,t,i,0),Rl===null&&Yr(),!1}catch{}if(n=Zr(e,t,i,r),n!==null)return hu(n,e,r),Ps(n,t,r),!0}return!1}function js(e,t,n,r){if(r={lane:2,revertLane:dd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ms(e)){if(t)throw Error(s(479))}else t=Zr(e,n,r,2),t!==null&&hu(t,e,2)}function Ms(e){var t=e.alternate;return e===G||t!==null&&t===G}function Ns(e,t){uo=lo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ps(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Je(e,n)}}var Fs={readContext:Xi,use:Ao,useCallback:_o,useContext:_o,useEffect:_o,useImperativeHandle:_o,useLayoutEffect:_o,useInsertionEffect:_o,useMemo:_o,useReducer:_o,useRef:_o,useState:_o,useDebugValue:_o,useDeferredValue:_o,useTransition:_o,useSyncExternalStore:_o,useId:_o,useHostTransitionStatus:_o,useFormState:_o,useActionState:_o,useOptimistic:_o,useMemoCache:_o,useCacheRefresh:_o};Fs.useEffectEvent=_o;var Is={readContext:Xi,use:Ao,useCallback:function(e,t){return Eo().memoizedState=[e,t===void 0?null:t],e},useContext:Xi,useEffect:os,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),is(4194308,4,fs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return is(4194308,4,e,t)},useInsertionEffect:function(e,t){is(4,2,e,t)},useMemo:function(e,t){var n=Eo();t=t===void 0?null:t;var r=e();if(fo){je(!0);try{e()}finally{je(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Eo();if(n!==void 0){var i=n(t);if(fo){je(!0);try{n(t)}finally{je(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Os.bind(null,G,e),[r.memoizedState,e]},useRef:function(e){var t=Eo();return e={current:e},t.memoizedState=e},useState:function(e){e=Ho(e);var t=e.queue,n=ks.bind(null,G,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ms,useDeferredValue:function(e,t){return _s(Eo(),e,t)},useTransition:function(){var e=Ho(!1);return e=ys.bind(null,G,e.queue,!0,!1),Eo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=G,i=Eo();if(W){if(n===void 0)throw Error(s(407));n=n()}else{if(n=t(),Rl===null)throw Error(s(349));Y&127||Lo(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,os(zo.bind(null,r,a,e),[e]),r.flags|=2048,ns(9,{destroy:void 0},Ro.bind(null,r,a,n,t),null),n},useId:function(){var e=Eo(),t=Rl.identifierPrefix;if(W){var n=Si,r=xi;n=(r&~(1<<32-Me(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=po++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=go++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:ws,useFormState:Zo,useActionState:Zo,useOptimistic:function(e){var t=Eo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=js.bind(null,G,!0,n),n.dispatch=t,[e,t]},useMemoCache:jo,useCacheRefresh:function(){return Eo().memoizedState=Ds.bind(null,G)},useEffectEvent:function(e){var t=Eo(),n={impl:e};return t.memoizedState=n,function(){if(q&2)throw Error(s(440));return n.impl.apply(void 0,arguments)}}},Ls={readContext:Xi,use:Ao,useCallback:hs,useContext:Xi,useEffect:ss,useImperativeHandle:ps,useInsertionEffect:us,useLayoutEffect:ds,useMemo:gs,useReducer:No,useRef:rs,useState:function(){return No(Mo)},useDebugValue:ms,useDeferredValue:function(e,t){return vs(Do(),K.memoizedState,e,t)},useTransition:function(){var e=No(Mo)[0],t=Do().memoizedState;return[typeof e==`boolean`?e:ko(e),t]},useSyncExternalStore:Io,useId:Ts,useHostTransitionStatus:ws,useFormState:Qo,useActionState:Qo,useOptimistic:function(e,t){return Uo(Do(),K,e,t)},useMemoCache:jo,useCacheRefresh:Es};Ls.useEffectEvent=ls;var Rs={readContext:Xi,use:Ao,useCallback:hs,useContext:Xi,useEffect:ss,useImperativeHandle:ps,useInsertionEffect:us,useLayoutEffect:ds,useMemo:gs,useReducer:Fo,useRef:rs,useState:function(){return Fo(Mo)},useDebugValue:ms,useDeferredValue:function(e,t){var n=Do();return K===null?_s(n,e,t):vs(n,K.memoizedState,e,t)},useTransition:function(){var e=Fo(Mo)[0],t=Do().memoizedState;return[typeof e==`boolean`?e:ko(e),t]},useSyncExternalStore:Io,useId:Ts,useHostTransitionStatus:ws,useFormState:ts,useActionState:ts,useOptimistic:function(e,t){var n=Do();return K===null?(n.baseState=e,[e,n.queue.dispatch]):Uo(n,K,e,t)},useMemoCache:jo,useCacheRefresh:Es};Rs.useEffectEvent=ls;function zs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:h({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Bs={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=pu(),i=Ra(r);i.payload=t,n!=null&&(i.callback=n),t=za(e,i,r),t!==null&&(hu(t,e,r),Ba(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=pu(),i=Ra(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=za(e,i,r),t!==null&&(hu(t,e,r),Ba(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=pu(),r=Ra(n);r.tag=2,t!=null&&(r.callback=t),t=za(e,r,n),t!==null&&(hu(t,e,n),Ba(t,e,n))}};function Vs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!vr(n,r)||!vr(i,a):!0}function Hs(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&&Bs.enqueueReplaceState(t,t.state,null)}function Us(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=h({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Ws(e){Gr(e)}function Gs(e){console.error(e)}function Ks(e){Gr(e)}function qs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Js(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Ys(e,t,n){return n=Ra(n),n.tag=3,n.payload={element:null},n.callback=function(){qs(e,t)},n}function Xs(e){return e=Ra(e),e.tag=3,e}function Zs(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Js(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Js(t,n,r),typeof i!=`function`&&(ru===null?ru=new Set([this]):ru.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Qs(e,t,n,r,i){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&qi(t,n,i,!0),n=Qa.current,n!==null){switch(n.tag){case 31:case 13:return $a===null?Du():n.alternate===null&&Wl===0&&(Wl=3),n.flags&=-257,n.flags|=65536,n.lanes=i,r===ba?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Gu(e,r,i)),!1;case 22:return n.flags|=65536,r===ba?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Gu(e,r,i)),!1}throw Error(s(435,n.tag))}return Gu(e,r,i),Du(),!1}if(W)return t=Qa.current,t===null?(r!==Mi&&(t=Error(s(423),{cause:r}),zi(pi(t,n))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,r=pi(r,n),i=Ys(e.stateNode,r,i),Va(e,i),Wl!==4&&(Wl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=i,r!==Mi&&(e=Error(s(422),{cause:r}),zi(pi(e,n)))),!1;var a=Error(s(520),{cause:r});if(a=pi(a,n),Xl===null?Xl=[a]:Xl.push(a),Wl!==4&&(Wl=2),t===null)return!0;r=pi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,e=Ys(n.stateNode,r,e),Va(n,e),!1;case 1:if(t=n.type,a=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||a!==null&&typeof a.componentDidCatch==`function`&&(ru===null||!ru.has(a))))return n.flags|=65536,i&=-i,n.lanes|=i,i=Xs(i),Zs(i,e,n,r),Va(n,i),!1}n=n.return}while(n!==null);return!1}var $s=Error(s(461)),ec=!1;function tc(e,t,n,r){t.child=e===null?Pa(t,null,n,r):Na(t,e.child,n,r)}function nc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return Yi(t),r=yo(e,t,n,o,a,i),s=Co(),e!==null&&!ec?(wo(e,t,i),Ec(e,t,i)):(W&&s&&Ti(t),t.flags|=1,tc(e,t,r,i),t.child)}function rc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ii(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,ic(e,t,a,r,i)):(e=si(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Dc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?vr:n,n(o,r)&&e.ref===t.ref)return Ec(e,t,i)}return t.flags|=1,e=ai(a,r),e.ref=t.ref,e.return=t,t.child=e}function ic(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(vr(a,r)&&e.ref===t.ref){if(ec=!1,t.pendingProps=r=a,Dc(e,i))e.flags&131072&&(ec=!0);else return t.lanes=e.lanes,Ec(e,t,i)}}return fc(e,t,n,r,i)}function ac(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return sc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ha(t,a===null?null:a.cachePool),a===null?Xa():Ya(t,a),no(t);else return r=t.lanes=536870912,sc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&ha(t,null),Xa(),ro(t)):(ha(t,a.cachePool),Ya(t,a),ro(t),t.memoizedState=null);return tc(e,t,i,n),t.child}function oc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function sc(e,t,n,r,i){var a=ma();return a=a===null?null:{parent:na._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&ha(t,null),Xa(),no(t),e!==null&&qi(e,t,r,!0),t.childLanes=i,null}function cc(e,t){return t=xc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function lc(e,t,n){return Na(t,e.child,null,n),e=cc(t,t.pendingProps),e.flags|=2,io(t),t.memoizedState=null,e}function uc(e,t,n){var r=t.pendingProps,i=!!(t.flags&128);if(t.flags&=-129,e===null){if(W){if(r.mode===`hidden`)return e=cc(t,r),t.lanes=536870912,oc(null,e);if(to(t),(e=ki)?(e=rf(e,ji),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:bi===null?null:{id:xi,overflow:Si},retryLane:536870912,hydrationErrors:null},n=ui(e),n.return=t,t.child=n,Oi=t,ki=null)):e=null,e===null)throw Ni(t);return t.lanes=536870912,null}return cc(t,r)}var a=e.memoizedState;if(a!==null){var o=a.dehydrated;if(to(t),i){if(t.flags&256)t.flags&=-257,t=lc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(s(558))}else if(ec||qi(e,t,n,!1),i=(n&e.childLanes)!==0,ec||i){if(r=Rl,r!==null&&(o=Ye(r,n),o!==0&&o!==a.retryLane))throw a.retryLane=o,Qr(e,o),hu(r,e,o),$s;Du(),t=lc(e,t,n)}else e=a.treeContext,ki=cf(o.nextSibling),Oi=t,W=!0,Ai=null,ji=!1,e!==null&&Di(t,e),t=cc(t,r),t.flags|=4096;return t}return e=ai(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function dc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(s(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function fc(e,t,n,r,i){return Yi(t),n=yo(e,t,n,r,void 0,i),r=Co(),e!==null&&!ec?(wo(e,t,i),Ec(e,t,i)):(W&&r&&Ti(t),t.flags|=1,tc(e,t,n,i),t.child)}function pc(e,t,n,r,i,a){return Yi(t),t.updateQueue=null,n=xo(t,r,n,i),bo(e),r=Co(),e!==null&&!ec?(wo(e,t,a),Ec(e,t,a)):(W&&r&&Ti(t),t.flags|=1,tc(e,t,n,a),t.child)}function mc(e,t,n,r,i){if(Yi(t),t.stateNode===null){var a=ti,o=n.contextType;typeof o==`object`&&o&&(a=Xi(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Bs,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Ia(t),o=n.contextType,a.context=typeof o==`object`&&o?Xi(o):ti,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(zs(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Bs.enqueueReplaceState(a,a.state,null),Wa(t,r,a,i),Ua(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Us(n,s);a.props=c;var l=a.context,u=n.contextType;o=ti,typeof u==`object`&&u&&(o=Xi(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Hs(t,a,r,o),Fa=!1;var f=t.memoizedState;a.state=f,Wa(t,r,a,i),Ua(),l=t.memoizedState,s||f!==l||Fa?(typeof d==`function`&&(zs(t,n,d,r),l=t.memoizedState),(c=Fa||Vs(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,La(e,t),o=t.memoizedProps,u=Us(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=ti,typeof l==`object`&&l&&(c=Xi(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Hs(t,a,r,c),Fa=!1,f=t.memoizedState,a.state=f,Wa(t,r,a,i),Ua();var p=t.memoizedState;o!==d||f!==p||Fa||e!==null&&e.dependencies!==null&&Ji(e.dependencies)?(typeof s==`function`&&(zs(t,n,s,r),p=t.memoizedState),(u=Fa||Vs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Ji(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,dc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Na(t,e.child,null,i),t.child=Na(t,null,n,i)):tc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Ec(e,t,i),e}function hc(e,t,n,r){return Li(),t.flags|=256,tc(e,t,n,r),t.child}var gc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function _c(e){return{baseLanes:e,cachePool:ga()}}function vc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Jl),e}function yc(e,t,n){var r=t.pendingProps,i=!1,a=!!(t.flags&128),o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:!!(ao.current&2)),o&&(i=!0,t.flags&=-129),o=!!(t.flags&32),t.flags&=-33,e===null){if(W){if(i?eo(t):ro(t),(e=ki)?(e=rf(e,ji),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:bi===null?null:{id:xi,overflow:Si},retryLane:536870912,hydrationErrors:null},n=ui(e),n.return=t,t.child=n,Oi=t,ki=null)):e=null,e===null)throw Ni(t);return of(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,i?(ro(t),i=t.mode,c=xc({mode:`hidden`,children:c},i),r=ci(r,i,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=_c(n),r.childLanes=vc(e,o,n),t.memoizedState=gc,oc(null,r)):(eo(t),bc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(a)t.flags&256?(eo(t),t.flags&=-257,t=Sc(e,t,n)):t.memoizedState===null?(ro(t),c=r.fallback,i=t.mode,r=xc({mode:`visible`,children:r.children},i),c=ci(c,i,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Na(t,e.child,null,n),r=t.child,r.memoizedState=_c(n),r.childLanes=vc(e,o,n),t.memoizedState=gc,t=oc(null,r)):(ro(t),t.child=e.child,t.flags|=128,t=null);else if(eo(t),of(c)){if(o=c.nextSibling&&c.nextSibling.dataset,o)var u=o.dgst;o=u,r=Error(s(419)),r.stack=``,r.digest=o,zi({value:r,source:null,stack:null}),t=Sc(e,t,n)}else if(ec||qi(e,t,n,!1),o=(n&e.childLanes)!==0,ec||o){if(o=Rl,o!==null&&(r=Ye(o,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Qr(e,r),hu(o,e,r),$s;af(c)||Du(),t=Sc(e,t,n)}else af(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,ki=cf(c.nextSibling),Oi=t,W=!0,Ai=null,ji=!1,e!==null&&Di(t,e),t=bc(t,r.children),t.flags|=4096);return t}return i?(ro(t),c=r.fallback,i=t.mode,l=e.child,u=l.sibling,r=ai(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=ci(c,i,n,null),c.flags|=2):c=ai(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,oc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=_c(n):(i=c.cachePool,i===null?i=ga():(l=na._currentValue,i=i.parent===l?i:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:i}),r.memoizedState=c,r.childLanes=vc(e,o,n),t.memoizedState=gc,oc(e.child,r)):(eo(t),n=e.child,e=n.sibling,n=ai(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function bc(e,t){return t=xc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function xc(e,t){return e=ri(22,e,null,t),e.lanes=0,e}function Sc(e,t,n){return Na(t,e.child,null,n),e=bc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Cc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Gi(e.return,t,n)}function wc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function Tc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=ao.current,s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,R(ao,o),tc(e,t,r,n),r=W?_i:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Cc(e,n,t);else if(e.tag===19)Cc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&oo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),wc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&oo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}wc(t,!0,n,null,a,r);break;case`together`:wc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Ec(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Gl|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(qi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(s(153));if(t.child!==null){for(e=t.child,n=ai(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ai(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Dc(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&Ji(e)))}function Oc(e,t,n){switch(t.tag){case 3:le(t,t.stateNode.containerInfo),Ui(t,na,e.memoizedState.cache),Li();break;case 27:case 5:z(t);break;case 4:le(t,t.stateNode.containerInfo);break;case 10:Ui(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,to(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(eo(t),e=Ec(e,t,n),e===null?null:e.sibling):yc(e,t,n):(eo(t),t.flags|=128,null);eo(t);break;case 19:var i=!!(e.flags&128);if(r=(n&t.childLanes)!==0,r||=(qi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Tc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),R(ao,ao.current),r)break;return null;case 22:return t.lanes=0,ac(e,t,n,t.pendingProps);case 24:Ui(t,na,e.memoizedState.cache)}return Ec(e,t,n)}function kc(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)ec=!0;else{if(!Dc(e,n)&&!(t.flags&128))return ec=!1,Oc(e,t,n);ec=!!(e.flags&131072)}}else ec=!1,W&&t.flags&1048576&&wi(t,_i,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Ca(t.elementType),t.type=e,typeof e==`function`)ii(e)?(r=Us(e,r),t.tag=1,t=mc(null,t,e,r,n)):(t.tag=0,t=fc(null,t,e,r,n));else{if(e!=null){var i=e.$$typeof;if(i===w){t.tag=11,t=nc(null,t,e,r,n);break a}if(i===D){t.tag=14,t=rc(null,t,e,r,n);break a}}throw t=ne(e)||e,Error(s(306,t,``))}}return t;case 0:return fc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,i=Us(r,t.pendingProps),mc(e,t,r,i,n);case 3:a:{if(le(t,t.stateNode.containerInfo),e===null)throw Error(s(387));r=t.pendingProps;var a=t.memoizedState;i=a.element,La(e,t),Wa(t,r,null,n);var o=t.memoizedState;if(r=o.cache,Ui(t,na,r),r!==a.cache&&Ki(t,[na],n,!0),Ua(),r=o.element,a.isDehydrated){if(a={element:r,isDehydrated:!1,cache:o.cache},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){t=hc(e,t,r,n);break a}if(r!==i){i=pi(Error(s(424)),t),zi(i),t=hc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(ki=cf(e.firstChild),Oi=t,W=!0,Ai=null,ji=!0,n=Pa(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Li(),r===i){t=Ec(e,t,n);break a}tc(e,t,r,n)}t=t.child}return t;case 26:return dc(e,t),e===null?(n=kf(t.type,null,t.pendingProps,null))?t.memoizedState=n:W||(n=t.type,e=t.pendingProps,r=Bd(se.current).createElement(n),r[tt]=t,r[nt]=e,Pd(r,n,e),mt(r),t.stateNode=r):t.memoizedState=kf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return z(t),e===null&&W&&(r=t.stateNode=ff(t.type,t.pendingProps,se.current),Oi=t,ji=!0,i=ki,Zd(t.type)?(lf=i,ki=cf(r.firstChild)):ki=i),tc(e,t,t.pendingProps.children,n),dc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&W&&((i=r=ki)&&(r=tf(r,t.type,t.pendingProps,ji),r===null?i=!1:(t.stateNode=r,Oi=t,ki=cf(r.firstChild),ji=!1,i=!0)),i||Ni(t)),z(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,r=a.children,Ud(i,a)?r=null:o!==null&&Ud(i,o)&&(t.flags|=32),t.memoizedState!==null&&(i=yo(e,t,So,null,null,n),Qf._currentValue=i),dc(e,t),tc(e,t,r,n),t.child;case 6:return e===null&&W&&((e=n=ki)&&(n=nf(n,t.pendingProps,ji),n===null?e=!1:(t.stateNode=n,Oi=t,ki=null,e=!0)),e||Ni(t)),null;case 13:return yc(e,t,n);case 4:return le(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Na(t,null,r,n):tc(e,t,r,n),t.child;case 11:return nc(e,t,t.type,t.pendingProps,n);case 7:return tc(e,t,t.pendingProps,n),t.child;case 8:return tc(e,t,t.pendingProps.children,n),t.child;case 12:return tc(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Ui(t,t.type,r.value),tc(e,t,r.children,n),t.child;case 9:return i=t.type._context,r=t.pendingProps.children,Yi(t),i=Xi(i),r=r(i),t.flags|=1,tc(e,t,r,n),t.child;case 14:return rc(e,t,t.type,t.pendingProps,n);case 15:return ic(e,t,t.type,t.pendingProps,n);case 19:return Tc(e,t,n);case 31:return uc(e,t,n);case 22:return ac(e,t,n,t.pendingProps);case 24:return Yi(t),r=Xi(na),e===null?(i=ma(),i===null&&(i=Rl,a=ra(),i.pooledCache=a,a.refCount++,a!==null&&(i.pooledCacheLanes|=n),i=a),t.memoizedState={parent:r,cache:i},Ia(t),Ui(t,na,i)):((e.lanes&n)!==0&&(La(e,t),Wa(t,null,null,n),Ua()),i=e.memoizedState,a=t.memoizedState,i.parent===r?(r=a.cache,Ui(t,na,r),r!==i.cache&&Ki(t,[na],n,!0)):(i={parent:r,cache:r},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),Ui(t,na,r))),tc(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(s(156,t.tag))}function Ac(e){e.flags|=4}function jc(e,t,n,r,i){if((t=!!(e.mode&32))&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(wu())e.flags|=8192;else throw wa=ba,va}}else e.flags&=-16777217}function Mc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Wf(t)){if(wu())e.flags|=8192;else throw wa=ba,va}}function Nc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Ue(),e.lanes|=t,Yl|=t)}function Pc(e,t){if(!W)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 Fc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Ic(e,t,n){var r=t.pendingProps;switch(Ei(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Fc(t),null;case 1:return Fc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Wi(na),ue(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Ii(t)?Ac(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ri())),Fc(t),null;case 26:var i=t.type,a=t.memoizedState;return e===null?(Ac(t),a===null?(Fc(t),jc(t,i,null,r,n)):(Fc(t),Mc(t,a))):a?a===e.memoizedState?(Fc(t),t.flags&=-16777217):(Ac(t),Fc(t),Mc(t,a)):(e=e.memoizedProps,e!==r&&Ac(t),Fc(t),jc(t,i,e,r,n)),null;case 27:if(de(t),n=se.current,i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ac(t);else{if(!r){if(t.stateNode===null)throw Error(s(166));return Fc(t),null}e=ae.current,Ii(t)?Pi(t,e):(e=ff(i,r,n),t.stateNode=e,Ac(t))}return Fc(t),null;case 5:if(de(t),i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ac(t);else{if(!r){if(t.stateNode===null)throw Error(s(166));return Fc(t),null}if(a=ae.current,Ii(t))Pi(t,a);else{var o=Bd(se.current);switch(a){case 1:a=o.createElementNS(`http://www.w3.org/2000/svg`,i);break;case 2:a=o.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;default:switch(i){case`svg`:a=o.createElementNS(`http://www.w3.org/2000/svg`,i);break;case`math`:a=o.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;case`script`:a=o.createElement(`div`),a.innerHTML=`<script><\/script>`,a=a.removeChild(a.firstChild);break;case`select`:a=typeof r.is==`string`?o.createElement(`select`,{is:r.is}):o.createElement(`select`),r.multiple?a.multiple=!0:r.size&&(a.size=r.size);break;default:a=typeof r.is==`string`?o.createElement(i,{is:r.is}):o.createElement(i)}}a[tt]=t,a[nt]=r;a:for(o=t.child;o!==null;){if(o.tag===5||o.tag===6)a.appendChild(o.stateNode);else if(o.tag!==4&&o.tag!==27&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===t)break a;for(;o.sibling===null;){if(o.return===null||o.return===t)break a;o=o.return}o.sibling.return=o.return,o=o.sibling}t.stateNode=a;a:switch(Pd(a,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Ac(t)}}return Fc(t),jc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Ac(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(s(166));if(e=se.current,Ii(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=Oi,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[tt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Md(e.nodeValue,n)),e||Ni(t,!0)}else e=Bd(e).createTextNode(r),e[tt]=t,t.stateNode=e}return Fc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Ii(t),n!==null){if(e===null){if(!r)throw Error(s(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(s(557));e[tt]=t}else Li(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Fc(t),e=!1}else n=Ri(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(io(t),t):(io(t),null);if(t.flags&128)throw Error(s(558))}return Fc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=Ii(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(s(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(s(317));i[tt]=t}else Li(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Fc(t),i=!1}else i=Ri(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(io(t),t):(io(t),null)}return io(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),a=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(a=r.memoizedState.cachePool.pool),a!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Nc(t,t.updateQueue),Fc(t),null);case 4:return ue(),e===null&&Sd(t.stateNode.containerInfo),Fc(t),null;case 10:return Wi(t.type),Fc(t),null;case 19:if(L(ao),r=t.memoizedState,r===null)return Fc(t),null;if(i=!!(t.flags&128),a=r.rendering,a===null){if(i)Pc(r,!1);else{if(Wl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=oo(e),a!==null){for(t.flags|=128,Pc(r,!1),e=a.updateQueue,t.updateQueue=e,Nc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)oi(n,e),n=n.sibling;return R(ao,ao.current&1|2),W&&Ci(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&H()>tu&&(t.flags|=128,i=!0,Pc(r,!1),t.lanes=4194304)}}else{if(!i){if(e=oo(a),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Nc(t,e),Pc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!a.alternate&&!W)return Fc(t),null}else 2*H()-r.renderingStartTime>tu&&n!==536870912&&(t.flags|=128,i=!0,Pc(r,!1),t.lanes=4194304)}r.isBackwards?(a.sibling=t.child,t.child=a):(e=r.last,e===null?t.child=a:e.sibling=a,r.last=a)}return r.tail===null?(Fc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=H(),e.sibling=null,n=ao.current,R(ao,i?n&1|2:n&1),W&&Ci(t,r.treeForkCount),e);case 22:case 23:return io(t),Za(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Fc(t),t.subtreeFlags&6&&(t.flags|=8192)):Fc(t),n=t.updateQueue,n!==null&&Nc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&L(pa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Wi(na),Fc(t),null;case 25:return null;case 30:return null}throw Error(s(156,t.tag))}function Lc(e,t){switch(Ei(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Wi(na),ue(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return de(t),null;case 31:if(t.memoizedState!==null){if(io(t),t.alternate===null)throw Error(s(340));Li()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(io(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(s(340));Li()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return L(ao),null;case 4:return ue(),null;case 10:return Wi(t.type),null;case 22:case 23:return io(t),Za(),e!==null&&L(pa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Wi(na),null;case 25:return null;default:return null}}function Rc(e,t){switch(Ei(t),t.tag){case 3:Wi(na),ue();break;case 26:case 27:case 5:de(t);break;case 4:ue();break;case 31:t.memoizedState!==null&&io(t);break;case 13:io(t);break;case 19:L(ao);break;case 10:Wi(t.type);break;case 22:case 23:io(t),Za(),e!==null&&L(pa);break;case 24:Wi(na)}}function zc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Z(t,t.return,e)}}function Bc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Z(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Z(t,t.return,e)}}function Vc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ka(t,n)}catch(t){Z(e,e.return,t)}}}function Hc(e,t,n){n.props=Us(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Z(e,t,n)}}function Uc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Z(e,t,n)}}function Wc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){Z(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Z(e,t,n)}else n.current=null}}function Gc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Z(e,e.return,t)}}function Kc(e,t,n){try{var r=e.stateNode;Fd(r,e.type,n,t),r[nt]=t}catch(t){Z(e,e.return,t)}}function qc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zd(e.type)||e.tag===4}function Jc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||qc(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.tag===27&&Zd(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Yc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Jt));else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Yc(e,t,n),e=e.sibling;e!==null;)Yc(e,t,n),e=e.sibling}function Xc(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&&(r===27&&Zd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Xc(e,t,n),e=e.sibling;e!==null;)Xc(e,t,n),e=e.sibling}function Zc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Pd(t,r,n),t[tt]=e,t[nt]=n}catch(t){Z(e,e.return,t)}}var Qc=!1,$c=!1,el=!1,tl=typeof WeakSet==`function`?WeakSet:Set,nl=null;function rl(e,t){if(e=e.containerInfo,Rd=sp,e=Sr(e),Cr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break a}var o=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||i!==0&&f.nodeType!==3||(c=o+i),f!==a||r!==0&&f.nodeType!==3||(l=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===i&&(c=o),p===a&&++d===r&&(l=o),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(zd={focusedElem:e,selectionRange:n},sp=!1,nl=t;nl!==null;)if(t=nl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,nl=e;else for(;nl!==null;){switch(t=nl,a=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)i=e[n],i.ref.impl=i.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&a!==null){e=void 0,n=t,i=a.memoizedProps,a=a.memoizedState,r=n.stateNode;try{var h=Us(n.type,i);e=r.getSnapshotBeforeUpdate(h,a),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Z(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)ef(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:ef(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(s(163))}if(e=t.sibling,e!==null){e.return=t.return,nl=e;break}nl=t.return}}function il(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:yl(e,n),r&4&&zc(5,n);break;case 1:if(yl(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Z(n,n.return,e)}else{var i=Us(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Z(n,n.return,e)}}}r&64&&Vc(n),r&512&&Uc(n,n.return);break;case 3:if(yl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Ka(e,t)}catch(e){Z(n,n.return,e)}}break;case 27:t===null&&r&4&&Zc(n);case 26:case 5:yl(e,n),t===null&&r&4&&Gc(n),r&512&&Uc(n,n.return);break;case 12:yl(e,n);break;case 31:yl(e,n),r&4&&ul(e,n);break;case 13:yl(e,n),r&4&&dl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Ju.bind(null,n),sf(e,n))));break;case 22:if(r=n.memoizedState!==null||Qc,!r){t=t!==null&&t.memoizedState!==null||$c,i=Qc;var a=$c;Qc=r,($c=t)&&!a?xl(e,n,!!(n.subtreeFlags&8772)):yl(e,n),Qc=i,$c=a}break;case 30:break;default:yl(e,n)}}function al(e){var t=e.alternate;t!==null&&(e.alternate=null,al(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&<(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var ol=null,sl=!1;function cl(e,t,n){for(n=n.child;n!==null;)ll(e,t,n),n=n.sibling}function ll(e,t,n){if(Ae&&typeof Ae.onCommitFiberUnmount==`function`)try{Ae.onCommitFiberUnmount(ke,n)}catch{}switch(n.tag){case 26:$c||Wc(n,t),cl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:$c||Wc(n,t);var r=ol,i=sl;Zd(n.type)&&(ol=n.stateNode,sl=!1),cl(e,t,n),pf(n.stateNode),ol=r,sl=i;break;case 5:$c||Wc(n,t);case 6:if(r=ol,i=sl,ol=null,cl(e,t,n),ol=r,sl=i,ol!==null){if(sl)try{(ol.nodeType===9?ol.body:ol.nodeName===`HTML`?ol.ownerDocument.body:ol).removeChild(n.stateNode)}catch(e){Z(n,t,e)}else try{ol.removeChild(n.stateNode)}catch(e){Z(n,t,e)}}break;case 18:ol!==null&&(sl?(e=ol,Qd(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Np(e)):Qd(ol,n.stateNode));break;case 4:r=ol,i=sl,ol=n.stateNode.containerInfo,sl=!0,cl(e,t,n),ol=r,sl=i;break;case 0:case 11:case 14:case 15:Bc(2,n,t),$c||Bc(4,n,t),cl(e,t,n);break;case 1:$c||(Wc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Hc(n,t,r)),cl(e,t,n);break;case 21:cl(e,t,n);break;case 22:$c=(r=$c)||n.memoizedState!==null,cl(e,t,n),$c=r;break;default:cl(e,t,n)}}function ul(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Np(e)}catch(e){Z(t,t.return,e)}}}function dl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Np(e)}catch(e){Z(t,t.return,e)}}function fl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new tl),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new tl),t;default:throw Error(s(435,e.tag))}}function pl(e,t){var n=fl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Yu.bind(null,e,t);t.then(r,r)}})}function ml(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r],a=e,o=t,c=o;a:for(;c!==null;){switch(c.tag){case 27:if(Zd(c.type)){ol=c.stateNode,sl=!1;break a}break;case 5:ol=c.stateNode,sl=!1;break a;case 3:case 4:ol=c.stateNode.containerInfo,sl=!0;break a}c=c.return}if(ol===null)throw Error(s(160));ll(a,o,i),ol=null,sl=!1,a=i.alternate,a!==null&&(a.return=null),i.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)gl(t,e),t=t.sibling}var hl=null;function gl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:ml(t,e),_l(e),r&4&&(Bc(3,e,e.return),zc(3,e),Bc(5,e,e.return));break;case 1:ml(t,e),_l(e),r&512&&($c||n===null||Wc(n,n.return)),r&64&&Qc&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var i=hl;if(ml(t,e),_l(e),r&512&&($c||n===null||Wc(n,n.return)),r&4){var a=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null){if(r===null){if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,i=i.ownerDocument||i;b:switch(r){case`title`:a=i.getElementsByTagName(`title`)[0],(!a||a[ct]||a[tt]||a.namespaceURI===`http://www.w3.org/2000/svg`||a.hasAttribute(`itemprop`))&&(a=i.createElement(r),i.head.insertBefore(a,i.querySelector(`head > title`))),Pd(a,r,n),a[tt]=e,mt(a),r=a;break a;case`link`:var o=Vf(`link`,`href`,i).get(r+(n.href||``));if(o){for(var c=0;c<o.length;c++)if(a=o[c],a.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&a.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&a.getAttribute(`title`)===(n.title==null?null:n.title)&&a.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(c,1);break b}}a=i.createElement(r),Pd(a,r,n),i.head.appendChild(a);break;case`meta`:if(o=Vf(`meta`,`content`,i).get(r+(n.content||``))){for(c=0;c<o.length;c++)if(a=o[c],a.getAttribute(`content`)===(n.content==null?null:``+n.content)&&a.getAttribute(`name`)===(n.name==null?null:n.name)&&a.getAttribute(`property`)===(n.property==null?null:n.property)&&a.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&a.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){o.splice(c,1);break b}}a=i.createElement(r),Pd(a,r,n),i.head.appendChild(a);break;default:throw Error(s(468,r))}a[tt]=e,mt(a),r=a}e.stateNode=r}else Hf(i,e.type,e.stateNode)}else e.stateNode=If(i,r,e.memoizedProps)}else a===r?r===null&&e.stateNode!==null&&Kc(e,e.memoizedProps,n.memoizedProps):(a===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):a.count--,r===null?Hf(i,e.type,e.stateNode):If(i,r,e.memoizedProps))}break;case 27:ml(t,e),_l(e),r&512&&($c||n===null||Wc(n,n.return)),n!==null&&r&4&&Kc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(ml(t,e),_l(e),r&512&&($c||n===null||Wc(n,n.return)),e.flags&32){i=e.stateNode;try{Bt(i,``)}catch(t){Z(e,e.return,t)}}r&4&&e.stateNode!=null&&(i=e.memoizedProps,Kc(e,i,n===null?i:n.memoizedProps)),r&1024&&(el=!0);break;case 6:if(ml(t,e),_l(e),r&4){if(e.stateNode===null)throw Error(s(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Z(e,e.return,t)}}break;case 3:if(Bf=null,i=hl,hl=gf(t.containerInfo),ml(t,e),hl=i,_l(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Np(t.containerInfo)}catch(t){Z(e,e.return,t)}el&&(el=!1,vl(e));break;case 4:r=hl,hl=gf(e.stateNode.containerInfo),ml(t,e),_l(e),hl=r;break;case 12:ml(t,e),_l(e);break;case 31:ml(t,e),_l(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,pl(e,r)));break;case 13:ml(t,e),_l(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&($l=H()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,pl(e,r)));break;case 22:i=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Qc,d=$c;if(Qc=u||i,$c=d||l,ml(t,e),$c=d,Qc=u,_l(e),r&8192)a:for(t=e.stateNode,t._visibility=i?t._visibility&-2:t._visibility|1,i&&(n===null||l||Qc||$c||bl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(a=l.stateNode,i)o=a.style,typeof o.setProperty==`function`?o.setProperty(`display`,`none`,`important`):o.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){Z(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=i?``:l.memoizedProps}catch(e){Z(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;i?$d(m,!0):$d(l.stateNode,!1)}catch(e){Z(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,pl(e,n))));break;case 19:ml(t,e),_l(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,pl(e,r)));break;case 30:break;case 21:break;default:ml(t,e),_l(e)}}function _l(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(qc(r)){n=r;break}r=r.return}if(n==null)throw Error(s(160));switch(n.tag){case 27:var i=n.stateNode;Xc(e,Jc(e),i);break;case 5:var a=n.stateNode;n.flags&32&&(Bt(a,``),n.flags&=-33),Xc(e,Jc(e),a);break;case 3:case 4:var o=n.stateNode.containerInfo;Yc(e,Jc(e),o);break;default:throw Error(s(161))}}catch(t){Z(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function vl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;vl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function yl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)il(e,t.alternate,t),t=t.sibling}function bl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Bc(4,t,t.return),bl(t);break;case 1:Wc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Hc(t,t.return,n),bl(t);break;case 27:pf(t.stateNode);case 26:case 5:Wc(t,t.return),bl(t);break;case 22:t.memoizedState===null&&bl(t);break;case 30:bl(t);break;default:bl(t)}e=e.sibling}}function xl(e,t,n){for(n&&=!!(t.subtreeFlags&8772),t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:xl(i,a,n),zc(4,a);break;case 1:if(xl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Z(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Ga(c[i],s)}catch(e){Z(r,r.return,e)}}n&&o&64&&Vc(a),Uc(a,a.return);break;case 27:Zc(a);case 26:case 5:xl(i,a,n),n&&r===null&&o&4&&Gc(a),Uc(a,a.return);break;case 12:xl(i,a,n);break;case 31:xl(i,a,n),n&&o&4&&ul(i,a);break;case 13:xl(i,a,n),n&&o&4&&dl(i,a);break;case 22:a.memoizedState===null&&xl(i,a,n),Uc(a,a.return);break;case 30:break;default:xl(i,a,n)}t=t.sibling}}function Sl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&ia(n))}function Cl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ia(e))}function wl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Tl(e,t,n,r),t=t.sibling}function Tl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:wl(e,t,n,r),i&2048&&zc(9,t);break;case 1:wl(e,t,n,r);break;case 3:wl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ia(e)));break;case 12:if(i&2048){wl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){Z(t,t.return,e)}}else wl(e,t,n,r);break;case 31:wl(e,t,n,r);break;case 13:wl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?wl(e,t,n,r):(a._visibility|=2,El(e,t,n,r,!!(t.subtreeFlags&10256)||!1)):a._visibility&2?wl(e,t,n,r):Dl(e,t),i&2048&&Sl(o,t);break;case 24:wl(e,t,n,r),i&2048&&Cl(t.alternate,t);break;default:wl(e,t,n,r)}}function El(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:El(a,o,s,c,i),zc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,El(a,o,s,c,i)):u._visibility&2?El(a,o,s,c,i):Dl(a,o),i&&l&2048&&Sl(o.alternate,o);break;case 24:El(a,o,s,c,i),i&&l&2048&&Cl(o.alternate,o);break;default:El(a,o,s,c,i)}t=t.sibling}}function Dl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Dl(n,r),i&2048&&Sl(r.alternate,r);break;case 24:Dl(n,r),i&2048&&Cl(r.alternate,r);break;default:Dl(n,r)}t=t.sibling}}var Ol=8192;function kl(e,t,n){if(e.subtreeFlags&Ol)for(e=e.child;e!==null;)Al(e,t,n),e=e.sibling}function Al(e,t,n){switch(e.tag){case 26:kl(e,t,n),e.flags&Ol&&e.memoizedState!==null&&Gf(n,hl,e.memoizedState,e.memoizedProps);break;case 5:kl(e,t,n);break;case 3:case 4:var r=hl;hl=gf(e.stateNode.containerInfo),kl(e,t,n),hl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Ol,Ol=16777216,kl(e,t,n),Ol=r):kl(e,t,n));break;default:kl(e,t,n)}}function jl(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Ml(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];nl=r,Fl(r,e)}jl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Nl(e),e=e.sibling}function Nl(e){switch(e.tag){case 0:case 11:case 15:Ml(e),e.flags&2048&&Bc(9,e,e.return);break;case 3:Ml(e);break;case 12:Ml(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Pl(e)):Ml(e);break;default:Ml(e)}}function Pl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];nl=r,Fl(r,e)}jl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Bc(8,t,t.return),Pl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Pl(t));break;default:Pl(t)}e=e.sibling}}function Fl(e,t){for(;nl!==null;){var n=nl;switch(n.tag){case 0:case 11:case 15:Bc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:ia(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,nl=r;else a:for(n=e;nl!==null;){r=nl;var i=r.sibling,a=r.return;if(al(r),r===n){nl=null;break a}if(i!==null){i.return=a,nl=i;break a}nl=a}}}var Il={getCacheForType:function(e){var t=Xi(na),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Xi(na).controller.signal}},Ll=typeof WeakMap==`function`?WeakMap:Map,q=0,Rl=null,J=null,Y=0,X=0,zl=null,Bl=!1,Vl=!1,Hl=!1,Ul=0,Wl=0,Gl=0,Kl=0,ql=0,Jl=0,Yl=0,Xl=null,Zl=null,Ql=!1,$l=0,eu=0,tu=1/0,nu=null,ru=null,iu=0,au=null,ou=null,su=0,cu=0,lu=null,uu=null,du=0,fu=null;function pu(){return q&2&&Y!==0?Y&-Y:M.T===null?Qe():dd()}function mu(){if(Jl===0){if(!(Y&536870912)||W){var e=Le;Le<<=1,!(Le&3932160)&&(Le=262144),Jl=e}else Jl=536870912}return e=Qa.current,e!==null&&(e.flags|=32),Jl}function hu(e,t,n){(e===Rl&&(X===2||X===9)||e.cancelPendingCommit!==null)&&(Su(e,0),yu(e,Y,Jl,!1)),Ge(e,n),(!(q&2)||e!==Rl)&&(e===Rl&&(!(q&2)&&(Kl|=n),Wl===4&&yu(e,Y,Jl,!1)),rd(e))}function gu(e,t,n){if(q&6)throw Error(s(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||Ve(e,t),i=r?Au(e,t):Ou(e,t,!0),a=r;do{if(i===0){Vl&&!r&&yu(e,t,0,!1);break}if(n=e.current.alternate,a&&!vu(n)){i=Ou(e,t,!1),a=!1;continue}if(i===2){if(a=t,e.errorRecoveryDisabledLanes&a)var o=0;else o=e.pendingLanes&-536870913,o=o===0?o&536870912?536870912:0:o;if(o!==0){t=o;a:{var c=e;i=Xl;var l=c.current.memoizedState.isDehydrated;if(l&&(Su(c,o).flags|=256),o=Ou(c,o,!1),o!==2){if(Hl&&!l){c.errorRecoveryDisabledLanes|=a,Kl|=a,i=4;break a}a=Zl,Zl=i,a!==null&&(Zl===null?Zl=a:Zl.push.apply(Zl,a))}i=o}if(a=!1,i!==2)continue}}if(i===1){Su(e,0),yu(e,t,0,!0);break}a:{switch(r=e,a=i,a){case 0:case 1:throw Error(s(345));case 4:if((t&4194048)!==t)break;case 6:yu(r,t,Jl,!Bl);break a;case 2:Zl=null;break;case 3:case 5:break;default:throw Error(s(329))}if((t&62914560)===t&&(i=$l+300-H(),10<i)){if(yu(r,t,Jl,!Bl),Be(r,0,!0)!==0)break a;su=t,r.timeoutHandle=Kd(_u.bind(null,r,n,Zl,nu,Ql,t,Jl,Kl,Yl,Bl,a,`Throttled`,-0,0),i);break a}_u(r,n,Zl,nu,Ql,t,Jl,Kl,Yl,Bl,a,null,-0,0)}break}while(1);rd(e)}function _u(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Jt},Al(t,a,d);var m=(a&62914560)===a?$l-H():(a&4194048)===a?eu-H():0;if(m=qf(d,m),m!==null){su=a,e.cancelPendingCommit=m(Lu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),yu(e,a,o,!l);return}}Lu(e,t,a,n,r,i,o,s,c)}function vu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!_r(a(),i))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 yu(e,t,n,r){t&=~ql,t&=~Kl,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Me(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&qe(e,n,t)}function bu(){return q&6?!0:(id(0,!1),!1)}function xu(){if(J!==null){if(X===0)var e=J.return;else e=J,Hi=Vi=null,To(e),Da=null,Oa=0,e=J;for(;e!==null;)Rc(e.alternate,e),e=e.return;J=null}}function Su(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,qd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),su=0,xu(),Rl=e,J=n=ai(e.current,null),Y=t,X=0,zl=null,Bl=!1,Vl=Ve(e,t),Hl=!1,Yl=Jl=ql=Kl=Gl=Wl=0,Zl=Xl=null,Ql=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Me(r),a=1<<i;t|=e[i],r&=~a}return Ul=t,Yr(),n}function Cu(e,t){G=null,M.H=Fs,t===_a||t===ya?(t=Ta(),X=3):t===va?(t=Ta(),X=4):X=t===$s?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,zl=t,J===null&&(Wl=1,qs(e,pi(t,e.current)))}function wu(){var e=Qa.current;return e===null?!0:(Y&4194048)===Y?$a===null:(Y&62914560)===Y||Y&536870912?e===$a:!1}function Tu(){var e=M.H;return M.H=Fs,e===null?Fs:e}function Eu(){var e=M.A;return M.A=Il,e}function Du(){Wl=4,Bl||(Y&4194048)!==Y&&Qa.current!==null||(Vl=!0),!(Gl&134217727)&&!(Kl&134217727)||Rl===null||yu(Rl,Y,Jl,!1)}function Ou(e,t,n){var r=q;q|=2;var i=Tu(),a=Eu();(Rl!==e||Y!==t)&&(nu=null,Su(e,t)),t=!1;var o=Wl;a:do try{if(X!==0&&J!==null){var s=J,c=zl;switch(X){case 8:xu(),o=6;break a;case 3:case 2:case 9:case 6:Qa.current===null&&(t=!0);var l=X;if(X=0,zl=null,Pu(e,s,c,l),n&&Vl){o=0;break a}break;default:l=X,X=0,zl=null,Pu(e,s,c,l)}}ku(),o=Wl;break}catch(t){Cu(e,t)}while(1);return t&&e.shellSuspendCounter++,Hi=Vi=null,q=r,M.H=i,M.A=a,J===null&&(Rl=null,Y=0,Yr()),o}function ku(){for(;J!==null;)Mu(J)}function Au(e,t){var n=q;q|=2;var r=Tu(),i=Eu();Rl!==e||Y!==t?(nu=null,tu=H()+500,Su(e,t)):Vl=Ve(e,t);a:do try{if(X!==0&&J!==null){t=J;var a=zl;b:switch(X){case 1:X=0,zl=null,Pu(e,t,a,1);break;case 2:case 9:if(xa(a)){X=0,zl=null,Nu(t);break}t=function(){X!==2&&X!==9||Rl!==e||(X=7),rd(e)},a.then(t,t);break a;case 3:X=7;break a;case 4:X=5;break a;case 7:xa(a)?(X=0,zl=null,Nu(t)):(X=0,zl=null,Pu(e,t,a,7));break;case 5:var o=null;switch(J.tag){case 26:o=J.memoizedState;case 5:case 27:var c=J;if(o?Wf(o):c.stateNode.complete){X=0,zl=null;var l=c.sibling;if(l!==null)J=l;else{var u=c.return;u===null?J=null:(J=u,Fu(u))}break b}}X=0,zl=null,Pu(e,t,a,5);break;case 6:X=0,zl=null,Pu(e,t,a,6);break;case 8:xu(),Wl=6;break a;default:throw Error(s(462))}}ju();break}catch(t){Cu(e,t)}while(1);return Hi=Vi=null,M.H=r,M.A=i,q=n,J===null?(Rl=null,Y=0,Yr(),Wl):0}function ju(){for(;J!==null&&!be();)Mu(J)}function Mu(e){var t=kc(e.alternate,e,Ul);e.memoizedProps=e.pendingProps,t===null?Fu(e):J=t}function Nu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=pc(n,t,t.pendingProps,t.type,void 0,Y);break;case 11:t=pc(n,t,t.pendingProps,t.type.render,t.ref,Y);break;case 5:To(t);default:Rc(n,t),t=J=oi(t,Ul),t=kc(n,t,Ul)}e.memoizedProps=e.pendingProps,t===null?Fu(e):J=t}function Pu(e,t,n,r){Hi=Vi=null,To(t),Da=null,Oa=0;var i=t.return;try{if(Qs(e,i,t,n,Y)){Wl=1,qs(e,pi(n,e.current)),J=null;return}}catch(t){if(i!==null)throw J=i,t;Wl=1,qs(e,pi(n,e.current)),J=null;return}t.flags&32768?(W||r===1?e=!0:Vl||Y&536870912?e=!1:(Bl=e=!0,(r===2||r===9||r===3||r===6)&&(r=Qa.current,r!==null&&r.tag===13&&(r.flags|=16384))),Iu(t,e)):Fu(t)}function Fu(e){var t=e;do{if(t.flags&32768){Iu(t,Bl);return}e=t.return;var n=Ic(t.alternate,t,Ul);if(n!==null){J=n;return}if(t=t.sibling,t!==null){J=t;return}J=t=e}while(t!==null);Wl===0&&(Wl=5)}function Iu(e,t){do{var n=Lc(e.alternate,e);if(n!==null){n.flags&=32767,J=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){J=e;return}J=e=n}while(e!==null);Wl=6,J=null}function Lu(e,t,n,r,i,a,o,c,l){e.cancelPendingCommit=null;do Hu();while(iu!==0);if(q&6)throw Error(s(327));if(t!==null){if(t===e.current)throw Error(s(177));if(a=t.lanes|t.childLanes,a|=Jr,Ke(e,n,a,o,c,l),e===Rl&&(J=Rl=null,Y=0),ou=t,au=e,su=n,cu=a,lu=i,uu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Xu(we,function(){return Uu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=M.T,M.T=null,i=N.p,N.p=2,o=q,q|=4;try{rl(e,t,n)}finally{q=o,N.p=i,M.T=r}}iu=1,Ru(),zu(),Bu()}}function Ru(){if(iu===1){iu=0;var e=au,t=ou,n=!!(t.flags&13878);if(t.subtreeFlags&13878||n){n=M.T,M.T=null;var r=N.p;N.p=2;var i=q;q|=4;try{gl(t,e);var a=zd,o=Sr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&xr(s.ownerDocument.documentElement,s)){if(c!==null&&Cr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=br(s,h),v=br(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}sp=!!Rd,zd=Rd=null}finally{q=i,N.p=r,M.T=n}}e.current=t,iu=2}}function zu(){if(iu===2){iu=0;var e=au,t=ou,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=M.T,M.T=null;var r=N.p;N.p=2;var i=q;q|=4;try{il(e,t.alternate,t)}finally{q=i,N.p=r,M.T=n}}iu=3}}function Bu(){if(iu===4||iu===3){iu=0,xe();var e=au,t=ou,n=su,r=uu;t.subtreeFlags&10256||t.flags&10256?iu=5:(iu=0,ou=au=null,Vu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(ru=null),Ze(n),t=t.stateNode,Ae&&typeof Ae.onCommitFiberRoot==`function`)try{Ae.onCommitFiberRoot(ke,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=M.T,i=N.p,N.p=2,M.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{M.T=t,N.p=i}}su&3&&Hu(),rd(e),i=e.pendingLanes,n&261930&&i&42?e===fu?du++:(du=0,fu=e):du=0,id(0,!1)}}function Vu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ia(t)))}function Hu(){return Ru(),zu(),Bu(),Uu()}function Uu(){if(iu!==5)return!1;var e=au,t=cu;cu=0;var n=Ze(su),r=M.T,i=N.p;try{N.p=32>n?32:n,M.T=null,n=lu,lu=null;var a=au,o=su;if(iu=0,ou=au=null,su=0,q&6)throw Error(s(331));var c=q;if(q|=4,Nl(a.current),Tl(a,a.current,o,n),q=c,id(0,!1),Ae&&typeof Ae.onPostCommitFiberRoot==`function`)try{Ae.onPostCommitFiberRoot(ke,a)}catch{}return!0}finally{N.p=i,M.T=r,Vu(e,t)}}function Wu(e,t,n){t=pi(n,t),t=Ys(e.stateNode,t,2),e=za(e,t,2),e!==null&&(Ge(e,2),rd(e))}function Z(e,t,n){if(e.tag===3)Wu(e,e,n);else for(;t!==null;){if(t.tag===3){Wu(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(ru===null||!ru.has(r))){e=pi(n,e),n=Xs(2),r=za(t,n,2),r!==null&&(Zs(n,r,t,e),Ge(r,2),rd(r));break}}t=t.return}}function Gu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Ll;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Hl=!0,i.add(n),e=Ku.bind(null,e,t,n),t.then(e,e))}function Ku(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Rl===e&&(Y&n)===n&&(Wl===4||Wl===3&&(Y&62914560)===Y&&300>H()-$l?!(q&2)&&Su(e,0):ql|=n,Yl===Y&&(Yl=0)),rd(e)}function qu(e,t){t===0&&(t=Ue()),e=Qr(e,t),e!==null&&(Ge(e,t),rd(e))}function Ju(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),qu(e,n)}function Yu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(s(314))}r!==null&&r.delete(t),qu(e,n)}function Xu(e,t){return ye(e,t)}var Zu=null,Qu=null,$u=!1,ed=!1,td=!1,nd=0;function rd(e){e!==Qu&&e.next===null&&(Qu===null?Zu=Qu=e:Qu=Qu.next=e),ed=!0,$u||($u=!0,ud())}function id(e,t){if(!td&&ed){td=!0;do for(var n=!1,r=Zu;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Me(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,ld(r,a))}else a=Y,a=Be(r,r===Rl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ve(r,a)||(n=!0,ld(r,a))}r=r.next}while(n);td=!1}}function ad(){od()}function od(){ed=$u=!1;var e=0;nd!==0&&Gd()&&(e=nd);for(var t=H(),n=null,r=Zu;r!==null;){var i=r.next,a=sd(r,t);a===0?(r.next=null,n===null?Zu=i:n.next=i,i===null&&(Qu=n)):(n=r,(e!==0||a&3)&&(ed=!0)),r=i}iu!==0&&iu!==5||id(e,!1),nd!==0&&(nd=0)}function sd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Me(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=He(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Rl,n=Y,n=Be(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(X===2||X===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&V(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Ve(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&V(r),Ze(n)){case 2:case 8:n=U;break;case 32:n=we;break;case 268435456:n=Ee;break;default:n=we}return r=cd.bind(null,e),n=ye(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&V(r),e.callbackPriority=2,e.callbackNode=null,2}function cd(e,t){if(iu!==0&&iu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Hu()&&e.callbackNode!==n)return null;var r=Y;return r=Be(e,e===Rl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(gu(e,r,t),sd(e,H()),e.callbackNode!=null&&e.callbackNode===n?cd.bind(null,e):null)}function ld(e,t){if(Hu())return null;gu(e,t,!0)}function ud(){Yd(function(){q&6?ye(Ce,ad):od()})}function dd(){if(nd===0){var e=sa;e===0&&(e=Ie,Ie<<=1,!(Ie&261888)&&(Ie=256)),nd=e}return nd}function fd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:qt(``+e)}function pd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function md(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=fd((i[nt]||null).action),o=r.submitter;o&&(t=(t=o[nt]||null)?fd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new gn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(nd!==0){var e=o?pd(i,o):new FormData(i);xs(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?pd(i,o):new FormData(i),xs(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var hd=0;hd<Ur.length;hd++){var gd=Ur[hd];Wr(gd.toLowerCase(),`on`+(gd[0].toUpperCase()+gd.slice(1)))}Wr(Fr,`onAnimationEnd`),Wr(Ir,`onAnimationIteration`),Wr(Lr,`onAnimationStart`),Wr(`dblclick`,`onDoubleClick`),Wr(`focusin`,`onFocus`),Wr(`focusout`,`onBlur`),Wr(Rr,`onTransitionRun`),Wr(zr,`onTransitionStart`),Wr(Br,`onTransitionCancel`),Wr(Vr,`onTransitionEnd`),vt(`onMouseEnter`,[`mouseout`,`mouseover`]),vt(`onMouseLeave`,[`mouseout`,`mouseover`]),vt(`onPointerEnter`,[`pointerout`,`pointerover`]),vt(`onPointerLeave`,[`pointerout`,`pointerover`]),_t(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),_t(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),_t(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),_t(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),_t(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),_t(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var _d=`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(` `),vd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(_d));function yd(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Gr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Gr(e)}i.currentTarget=null,a=c}}}}function Q(e,t){var n=t[it];n===void 0&&(n=t[it]=new Set);var r=e+`__bubble`;n.has(r)||(Cd(t,e,2,!1),n.add(r))}function bd(e,t,n){var r=0;t&&(r|=4),Cd(n,e,r,t)}var xd=`_reactListening`+Math.random().toString(36).slice(2);function Sd(e){if(!e[xd]){e[xd]=!0,ht.forEach(function(t){t!==`selectionchange`&&(vd.has(t)||bd(t,!1,e),bd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[xd]||(t[xd]=!0,bd(`selectionchange`,!1,t))}}function Cd(e,t,n,r){switch(mp(t)){case 2:var i=cp;break;case 8:i=lp;break;default:i=up}n=i.bind(null,t,n,e),i=void 0,!an||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function wd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var s=r.stateNode.containerInfo;if(s===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&o.stateNode.containerInfo===i)return;o=o.return}for(;s!==null;){if(o=ut(s),o===null)return;if(c=o.tag,c===5||c===6||c===26||c===27){r=a=o;continue a}s=s.parentNode}}r=r.return}tn(function(){var r=a,i=Xt(n),o=[];a:{var s=Hr.get(e);if(s!==void 0){var c=gn,u=e;switch(e){case`keypress`:if(dn(n)===0)break a;case`keydown`:case`keyup`:c=Pn;break;case`focusin`:u=`focus`,c=Tn;break;case`focusout`:u=`blur`,c=Tn;break;case`beforeblur`:case`afterblur`:c=Tn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:c=Cn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=wn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=In;break;case Fr:case Ir:case Lr:c=En;break;case Vr:c=Ln;break;case`scroll`:case`scrollend`:c=vn;break;case`wheel`:c=Rn;break;case`copy`:case`cut`:case`paste`:c=Dn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=Fn;break;case`toggle`:case`beforetoggle`:c=zn}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?s===null?null:s+`Capture`:s;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=nn(m,p),g!=null&&d.push(Td(m,g,h))),f)break;m=m.return}0<d.length&&(s=new c(s,u,null,n,i),o.push({event:s,listeners:d}))}}if(!(t&7)){a:{if(s=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,s&&n!==Yt&&(u=n.relatedTarget||n.fromElement)&&(ut(u)||u[rt]))break a;if((c||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,c?(u=n.relatedTarget||n.toElement,c=r,u=u?ut(u):null,u!==null&&(f=l(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(c=null,u=r),c!==u)){if(d=Cn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Fn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=c==null?s:ft(c),h=u==null?s:ft(u),s=new d(g,m+`leave`,c,n,i),s.target=f,s.relatedTarget=h,g=null,ut(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,c&&u)b:{for(d=Dd,p=c,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;c!==null&&Od(o,s,c,d,!1),u!==null&&f!==null&&Od(o,f,u,d,!0)}}a:{if(s=r?ft(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var v=ar;else if($n(s)){if(or)v=hr;else{v=pr;var y=fr}}else c=s.nodeName,!c||c.toLowerCase()!==`input`||s.type!==`checkbox`&&s.type!==`radio`?r&&Wt(r.elementType)&&(v=ar):v=mr;if(v&&=v(e,r)){er(o,v,n,i);break a}y&&y(e,s,r),e===`focusout`&&r&&s.type===`number`&&r.memoizedProps.value!=null&&It(s,`number`,s.value)}switch(y=r?ft(r):window,e){case`focusin`:($n(y)||y.contentEditable===`true`)&&(Tr=y,Er=r,Dr=null);break;case`focusout`:Dr=Er=Tr=null;break;case`mousedown`:Or=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Or=!1,kr(o,n,i);break;case`selectionchange`:if(wr)break;case`keydown`:case`keyup`:kr(o,n,i)}var b;if(Vn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else Yn?qn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Wn&&n.locale!==`ko`&&(Yn||x!==`onCompositionStart`?x===`onCompositionEnd`&&Yn&&(b=un()):(sn=i,cn=`value`in sn?sn.value:sn.textContent,Yn=!0)),y=Ed(r,x),0<y.length&&(x=new On(x,e,null,n,i),o.push({event:x,listeners:y}),b?x.data=b:(b=Jn(n),b!==null&&(x.data=b)))),(b=Un?Xn(e,n):Zn(e,n))&&(x=Ed(r,`onBeforeInput`),0<x.length&&(y=new On(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:y,listeners:x}),y.data=b)),md(o,e,r,n,i)}yd(o,t)})}function Td(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ed(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=nn(e,n),i!=null&&r.unshift(Td(e,i,a)),i=nn(e,t),i!=null&&r.push(Td(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Dd(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Od(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=nn(n,a),l!=null&&o.unshift(Td(n,l,c))):i||(l=nn(n,a),l!=null&&o.push(Td(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var kd=/\r\n?/g,Ad=/\u0000|\uFFFD/g;function jd(e){return(typeof e==`string`?e:``+e).replace(kd,`
|
|
9
|
-
`).replace(Ad,``)}function Md(e,t){return t=jd(t),jd(e)===t}function $(e,t,n,r,i,a){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Bt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Bt(e,``+r);break;case`className`:wt(e,`class`,r);break;case`tabIndex`:wt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:wt(e,n,r);break;case`style`:Ut(e,r,a);break;case`data`:if(t!==`object`){wt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=qt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof a==`function`&&(n===`formAction`?(t!==`input`&&$(e,t,`name`,i.name,i,null),$(e,t,`formEncType`,i.formEncType,i,null),$(e,t,`formMethod`,i.formMethod,i,null),$(e,t,`formTarget`,i.formTarget,i,null)):($(e,t,`encType`,i.encType,i,null),$(e,t,`method`,i.method,i,null),$(e,t,`target`,i.target,i,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=qt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Jt);break;case`onScroll`:r!=null&&Q(`scroll`,e);break;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(s(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(s(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=qt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Q(`beforetoggle`,e),Q(`toggle`,e),Ct(e,`popover`,r);break;case`xlinkActuate`:Tt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Tt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Tt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Tt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Tt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Tt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Tt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Tt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Tt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Ct(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Gt.get(n)||n,Ct(e,n,r))}}function Nd(e,t,n,r,i,a){switch(n){case`style`:Ut(e,r,a);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(s(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(s(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Bt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Bt(e,``+r);break;case`onScroll`:r!=null&&Q(`scroll`,e);break;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Jt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!gt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(i=n.endsWith(`Capture`),t=n.slice(2,i?n.length-7:void 0),a=e[nt]||null,a=a==null?null:a[n],typeof a==`function`&&e.removeEventListener(t,a,i),typeof r==`function`)){typeof a!=`function`&&a!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,i);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):Ct(e,n,r)}}}function Pd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Q(`error`,e),Q(`load`,e);var r=!1,i=!1,a;for(a in n)if(n.hasOwnProperty(a)){var o=n[a];if(o!=null)switch(a){case`src`:r=!0;break;case`srcSet`:i=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(s(137,t));default:$(e,t,a,o,n,null)}}i&&$(e,t,`srcSet`,n.srcSet,n,null),r&&$(e,t,`src`,n.src,n,null);return;case`input`:Q(`invalid`,e);var c=a=o=i=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:i=d;break;case`type`:o=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:a=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(s(137,t));break;default:$(e,t,r,d,n,null)}}Ft(e,a,c,l,u,o,i,!1);return;case`select`:for(i in Q(`invalid`,e),r=o=a=null,n)if(n.hasOwnProperty(i)&&(c=n[i],c!=null))switch(i){case`value`:a=c;break;case`defaultValue`:o=c;break;case`multiple`:r=c;default:$(e,t,i,c,n,null)}t=a,n=o,e.multiple=!!r,t==null?n!=null&&Lt(e,!!r,n,!0):Lt(e,!!r,t,!1);return;case`textarea`:for(o in Q(`invalid`,e),a=i=r=null,n)if(n.hasOwnProperty(o)&&(c=n[o],c!=null))switch(o){case`value`:r=c;break;case`defaultValue`:i=c;break;case`children`:a=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(s(91));break;default:$(e,t,o,c,n,null)}zt(e,r,i,a);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:$(e,t,l,r,n,null)}return;case`dialog`:Q(`beforetoggle`,e),Q(`toggle`,e),Q(`cancel`,e),Q(`close`,e);break;case`iframe`:case`object`:Q(`load`,e);break;case`video`:case`audio`:for(r=0;r<_d.length;r++)Q(_d[r],e);break;case`image`:Q(`error`,e),Q(`load`,e);break;case`details`:Q(`toggle`,e);break;case`embed`:case`source`:case`link`:Q(`error`,e),Q(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(s(137,t));default:$(e,t,u,r,n,null)}return;default:if(Wt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Nd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&$(e,t,c,r,n,null))}function Fd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var i=null,a=null,o=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||$(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:a=m;break;case`name`:i=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:o=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(s(137,t));break;default:m!==f&&$(e,t,p,m,r,f)}}Pt(e,o,c,l,u,d,a,i);return;case`select`:for(a in m=o=c=p=null,n)if(l=n[a],n.hasOwnProperty(a)&&l!=null)switch(a){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(a)||$(e,t,a,null,r,l)}for(i in r)if(a=r[i],l=n[i],r.hasOwnProperty(i)&&(a!=null||l!=null))switch(i){case`value`:p=a;break;case`defaultValue`:c=a;break;case`multiple`:o=a;default:a!==l&&$(e,t,i,a,r,l)}t=c,n=o,r=m,p==null?!!r!=!!n&&(t==null?Lt(e,!!n,n?[]:``,!1):Lt(e,!!n,t,!0)):Lt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(i=n[c],n.hasOwnProperty(c)&&i!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:$(e,t,c,null,r,i)}for(o in r)if(i=r[o],a=n[o],r.hasOwnProperty(o)&&(i!=null||a!=null))switch(o){case`value`:p=i;break;case`defaultValue`:m=i;break;case`children`:break;case`dangerouslySetInnerHTML`:if(i!=null)throw Error(s(91));break;default:i!==a&&$(e,t,o,i,r,a)}Rt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:$(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:$(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&$(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(s(137,t));break;default:$(e,t,u,p,r,m)}return;default:if(Wt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Nd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Nd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&$(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||$(e,t,f,p,r,m)}function Id(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Ld(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Id(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Id(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Rd=null,zd=null;function Bd(e){return e.nodeType===9?e:e.ownerDocument}function Vd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Hd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Ud(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Wd=null;function Gd(){var e=window.event;return e&&e.type===`popstate`?e!==Wd&&(Wd=e,!0):(Wd=null,!1)}var Kd=typeof setTimeout==`function`?setTimeout:void 0,qd=typeof clearTimeout==`function`?clearTimeout:void 0,Jd=typeof Promise==`function`?Promise:void 0,Yd=typeof queueMicrotask==`function`?queueMicrotask:Jd===void 0?Kd:function(e){return Jd.resolve(null).then(e).catch(Xd)};function Xd(e){setTimeout(function(){throw e})}function Zd(e){return e===`head`}function Qd(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Np(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)pf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,pf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[ct]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&pf(e.ownerDocument.body)}n=i}while(n);Np(t)}function $d(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function ef(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:ef(n),lt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function tf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[ct])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=cf(e.nextSibling),e===null)break}return null}function nf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=cf(e.nextSibling),e===null))return null;return e}function rf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=cf(e.nextSibling),e===null))return null;return e}function af(e){return e.data===`$?`||e.data===`$~`}function of(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function sf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function cf(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===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var lf=null;function uf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return cf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function df(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function ff(e,t,n){switch(t=Bd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(s(452));return e;case`head`:if(e=t.head,!e)throw Error(s(453));return e;case`body`:if(e=t.body,!e)throw Error(s(454));return e;default:throw Error(s(451))}}function pf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);lt(e)}var mf=new Map,hf=new Set;function gf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var _f=N.d;N.d={f:vf,r:yf,D:Sf,C:Cf,L:wf,m:Tf,X:Df,S:Ef,M:Of};function vf(){var e=_f.f(),t=bu();return e||t}function yf(e){var t=dt(e);t!==null&&t.tag===5&&t.type===`form`?Cs(t):_f.r(e)}var bf=typeof document>`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=Nt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),mt(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Nt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Nt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Nt(n.imageSizes)+`"]`)):i+=`[href="`+Nt(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),mt(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Nt(r)+`"][href="`+Nt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=h({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),mt(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=pt(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);mt(c),Pd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=pt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),mt(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=pt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),mt(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var i=(i=se.current)?gf(i):null;if(!i)throw Error(s(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=pt(i).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Af(n.href);var a=pt(i).hoistableStyles,o=a.get(e);if(o||(i=i.ownerDocument||i,o={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},a.set(e,o),(a=i.querySelector(jf(e)))&&!a._p&&(o.instance=a,o.state.loading=5),mf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},mf.set(e,n),a||Nf(i,e,n,o.state))),t&&r===null)throw Error(s(528,``));return o}if(t&&r!==null)throw Error(s(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=pt(i).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(s(444,e))}}function Af(e){return`href="`+Nt(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Pd(t,`link`,n),mt(t),e.head.appendChild(t))}function Pf(e){return`[src="`+Nt(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Nt(n.href)+`"]`);if(r)return t.instance=r,mt(r),r;var i=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),mt(r),Pd(r,`style`,i),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Af(n.href);var a=e.querySelector(jf(i));if(a)return t.state.loading|=4,t.instance=a,mt(a),a;r=Mf(n),(i=mf.get(i))&&Rf(r,i),a=(e.ownerDocument||e).createElement(`link`),mt(a);var o=a;return o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),t.state.loading|=4,Lf(a,n.precedence,e),t.instance=a;case`script`:return a=Pf(n.src),(i=e.querySelector(Ff(a)))?(t.instance=i,mt(i),i):(r=n,(i=mf.get(a))&&(r=h({},n),zf(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),mt(i),Pd(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(s(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Rf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function zf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Bf=null;function Vf(e,t,n){if(Bf===null){var r=new Map,i=Bf=new Map;i.set(n,r)}else i=Bf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[ct]||a[tt]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Hf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Uf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,mt(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),mt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Kf===0&&(Kf=62500*Ld());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Jf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var Qf={$$typeof:C,Provider:null,Consumer:null,_currentValue:P,_currentValue2:P,_threadCount:0};function $f(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=We(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=We(0),this.hiddenUpdates=We(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function ep(e,t,n,r,i,a,o,s,c,l,u,d){return e=new $f(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ri(3,null,null,t),e.current=a,a.stateNode=e,t=ra(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Ia(a),e}function tp(e){return e?(e=ti,e):ti}function np(e,t,n,r,i,a){i=tp(i),r.context===null?r.context=i:r.pendingContext=i,r=Ra(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=za(e,r,t),n!==null&&(hu(n,e,t),Ba(n,e,t))}function rp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ip(e,t){rp(e,t),(e=e.alternate)&&rp(e,t)}function ap(e){if(e.tag===13||e.tag===31){var t=Qr(e,67108864);t!==null&&hu(t,e,67108864),ip(e,67108864)}}function op(e){if(e.tag===13||e.tag===31){var t=pu();t=Xe(t);var n=Qr(e,t);n!==null&&hu(n,e,t),ip(e,t)}}var sp=!0;function cp(e,t,n,r){var i=M.T;M.T=null;var a=N.p;try{N.p=2,up(e,t,n,r)}finally{N.p=a,M.T=i}}function lp(e,t,n,r){var i=M.T;M.T=null;var a=N.p;try{N.p=8,up(e,t,n,r)}finally{N.p=a,M.T=i}}function up(e,t,n,r){if(sp){var i=dp(r);if(i===null)wd(e,t,r,fp,n),Cp(e,r);else if(Tp(i,e,t,n,r))r.stopPropagation();else if(Cp(e,r),t&4&&-1<Sp.indexOf(e)){for(;i!==null;){var a=dt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=ze(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Me(o);s.entanglements[1]|=c,o&=~c}rd(a),!(q&6)&&(tu=H()+500,id(0,!1))}}break;case 31:case 13:s=Qr(a,2),s!==null&&hu(s,a,2),bu(),ip(a,2)}if(a=dp(r),a===null&&wd(e,t,r,fp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else wd(e,t,r,null,n)}}function dp(e){return e=Xt(e),pp(e)}var fp=null;function pp(e){if(fp=null,e=ut(e),e!==null){var t=l(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=u(t),e!==null)return e;e=null}else if(n===31){if(e=d(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 fp=e,null}function mp(e){switch(e){case`beforetoggle`: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`toggle`: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 2;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`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Se()){case Ce:return 2;case U:return 8;case we:case Te:return 32;case Ee:return 268435456;default:return 32}default:return 32}}var hp=!1,gp=null,_p=null,vp=null,yp=new Map,bp=new Map,xp=[],Sp=`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`.split(` `);function Cp(e,t){switch(e){case`focusin`:case`focusout`:gp=null;break;case`dragenter`:case`dragleave`:_p=null;break;case`mouseover`:case`mouseout`:vp=null;break;case`pointerover`:case`pointerout`:yp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:bp.delete(t.pointerId)}}function wp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=dt(t),t!==null&&ap(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Tp(e,t,n,r,i){switch(t){case`focusin`:return gp=wp(gp,e,t,n,r,i),!0;case`dragenter`:return _p=wp(_p,e,t,n,r,i),!0;case`mouseover`:return vp=wp(vp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return yp.set(a,wp(yp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,bp.set(a,wp(bp.get(a)||null,e,t,n,r,i)),!0}return!1}function Ep(e){var t=ut(e.target);if(t!==null){var n=l(t);if(n!==null){if(t=n.tag,t===13){if(t=u(n),t!==null){e.blockedOn=t,$e(e.priority,function(){op(n)});return}}else if(t===31){if(t=d(n),t!==null){e.blockedOn=t,$e(e.priority,function(){op(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 Dp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=dp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Yt=r,n.target.dispatchEvent(r),Yt=null}else return t=dt(n),t!==null&&ap(t),e.blockedOn=n,!1;t.shift()}return!0}function Op(e,t,n){Dp(e)&&n.delete(t)}function kp(){hp=!1,gp!==null&&Dp(gp)&&(gp=null),_p!==null&&Dp(_p)&&(_p=null),vp!==null&&Dp(vp)&&(vp=null),yp.forEach(Op),bp.forEach(Op)}function Ap(e,n){e.blockedOn===n&&(e.blockedOn=null,hp||(hp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,kp)))}var jp=null;function Mp(e){jp!==e&&(jp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){jp===e&&(jp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(pp(r||n)===null)continue;break}var a=dt(n);a!==null&&(e.splice(t,3),t-=3,xs(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Np(e){function t(t){return Ap(t,e)}gp!==null&&Ap(gp,e),_p!==null&&Ap(_p,e),vp!==null&&Ap(vp,e),yp.forEach(t),bp.forEach(t);for(var n=0;n<xp.length;n++){var r=xp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<xp.length&&(n=xp[0],n.blockedOn===null);)Ep(n),n.blockedOn===null&&xp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[nt]||null;if(typeof a==`function`)o||Mp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[nt]||null)s=o.formAction;else if(pp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Mp(n)}}}function Pp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Fp(e){this._internalRoot=e}Ip.prototype.render=Fp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(s(409));var n=t.current;np(n,pu(),e,t,null,null)},Ip.prototype.unmount=Fp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;np(e.current,2,null,e,null,null),bu(),t[rt]=null}};function Ip(e){this._internalRoot=e}Ip.prototype.unstable_scheduleHydration=function(e){if(e){var t=Qe();e={blockedOn:null,target:e,priority:t};for(var n=0;n<xp.length&&t!==0&&t<xp[n].priority;n++);xp.splice(n,0,e),n===0&&Ep(e)}};var Lp=r.version;if(Lp!==`19.2.8`)throw Error(s(527,Lp,`19.2.8`));N.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(s(188)):(e=Object.keys(e).join(`,`),Error(s(268,e)));return e=p(t),e=e===null?null:m(e),e=e===null?null:e.stateNode,e};var Rp={bundleType:0,version:`19.2.8`,rendererPackageName:`react-dom`,currentDispatcherRef:M,reconcilerVersion:`19.2.8`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var zp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zp.isDisabled&&zp.supportsFiber)try{ke=zp.inject(Rp),Ae=zp}catch{}}e.createRoot=function(e,t){if(!c(e))throw Error(s(299));var n=!1,r=``,i=Ws,a=Gs,o=Ks;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(a=t.onCaughtError),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=ep(e,1,!1,null,null,n,r,null,i,a,o,Pp),e[rt]=t.current,Sd(e),new Fp(t)}})),c=e(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=s()})),l=n(),u=c();async function d(){return(await _(`/api/production/skill-library`)).skills}async function f(e){let t=await v(`/api/production/skill-library/commands/import`,e,{request_id:crypto.randomUUID()});return t?{state:`ready`,...t.skill}:null}async function p(e,t){await v(`/api/production/skill-library/${encodeURIComponent(t)}/commands/remove`,e,{})}async function m(){return(await _(`/api/production/skills`)).skills}async function h(e,t,n,r,i,a,o,s,c){return(await v(`/api/projects/${t}/production/commands/start`,e,{request_id:crypto.randomUUID(),consent:!0,skill_id:n,intent:r,...i?{visual_style_id:i}:{},...a?{font_style_id:a}:{},...o?{target_duration_seconds:o}:{},...s?{music_asset_id:s}:{},...c?{template_id:c}:{}})).run}var g=class extends Error{code;status;constructor(e,t,n){super(t),this.name=`ApiError`,this.code=e,this.status=n}};async function _(e,t={}){let n=await fetch(e,{credentials:`same-origin`,cache:`no-store`,...t});if(n.status===204)return null;let r;try{r=await n.json()}catch{throw new g(`response_invalid`,`Clipen 回傳了無法辨識的資料。`,n.status)}if(!n.ok){let e=r;throw new g(typeof e.error?.code==`string`?e.error.code:`request_failed`,typeof e.error?.message==`string`?e.error.message:`Clipen 無法完成這次操作。`,n.status)}return r}async function v(e,t,n){return _(e,{method:`POST`,headers:{"Content-Type":`application/json`,"X-Clipen-CSRF":t},body:JSON.stringify(n)})}async function y(){await _(`/api/session/connect`,{method:`POST`})}async function b(){return _(`/api/system/power`)}async function x(){return _(`/api/provider/account`)}async function S(){return _(`/api/status`)}async function C(){return(await _(`/api/projects`)).projects}async function w(e){return(await _(`/api/projects/${e}`)).project}async function T(e,t){return(await v(`/api/commands/create-project`,e,{request_id:crypto.randomUUID(),name:t})).project}async function E(e,t,n,r){return(await v(`/api/projects/${t.project_id}/commands/update-details`,e,{request_id:crypto.randomUUID(),expected_revision:t.revision,name:n,brief:r})).project}async function D(e,t){return(await v(`/api/system/commands/select-directory`,e,{request_id:crypto.randomUUID(),role:t}))?.selection??null}async function O(e,t,n,r){return(await v(`/api/projects/${t.project_id}/commands/set-directory`,e,{request_id:crypto.randomUUID(),expected_revision:t.revision,role:n,selection_token:r})).project}async function ee(e,t,n){return(await v(`/api/projects/${t.project_id}/commands/remove-directory`,e,{request_id:crypto.randomUUID(),expected_revision:t.revision,role:n})).project}async function k(e,t,n){return(await v(`/api/projects/${t.project_id}/commands/delete`,e,{request_id:crypto.randomUUID(),expected_revision:t.revision,confirmation_name:n})).deleted_project_id}async function A(e){return _(`/api/projects/${e}/inventory`)}async function j(e,t,n=0){return _(`/api/projects/${e}/inventories/${t}?offset=${n}&limit=100`)}async function te(e,t){return(await v(`/api/projects/${t.project_id}/commands/start-inventory`,e,{request_id:crypto.randomUUID(),expected_revision:t.revision})).inventory}async function ne(e,t,n){return(await v(`/api/projects/${t}/inventories/${n}/commands/cancel`,e,{})).inventory}async function re(e){return _(`/api/projects/${e}/analysis`)}async function M(e){return _(`/api/projects/${e}/edit-agent`)}async function N(e,t,n){return(await v(`/api/projects/${t}/edit-agent/${n}/commands/cancel`,e,{})).run}async function P(e,t,n=0,r={}){let i=new URLSearchParams({offset:String(n),limit:`12`});return r.tripDay&&i.set(`trip_day`,String(r.tripDay)),r.reviewState&&r.reviewState!==`all`&&i.set(`review_state`,r.reviewState),(await _(`/api/projects/${e}/analyses/${t}/results?${i.toString()}`)).results}async function F(e,t,n,r,i=0){return(await _(`/api/projects/${e}/analyses/${t}/items/${n}/${r}/transcript?offset=${i}&limit=100`)).transcript}async function I(e,t,n){return(await _(`/api/projects/${e}/annotations/${t}/${n}`)).annotation}async function ie(e,t,n){return(await v(`/api/projects/${t}/annotation/commands/save`,e,{request_id:crypto.randomUUID(),version_id:n.material.version_id,stream_index:n.transcript?.stream_index??-1,expected_material_revision:n.material.revision,expected_transcript_revision:n.transcript?.revision??0,material:{people:n.material.people,location:n.material.location,trip_day:n.material.trip_day,day_part:n.material.day_part,note:n.material.note,usage:n.material.usage},transcript:n.transcript&&{source_revision_id:n.transcript.source_revision_id,confirmed:n.transcript.confirmed,discarded:n.transcript.discarded,corrections:n.transcript.corrections}})).annotation}async function L(e){return(await v(`/api/system/commands/remove-asr`,e,{})).runtime}async function R(e,t,n){return(await v(`/api/projects/${t.project_id}/commands/start-analysis`,e,{request_id:crypto.randomUUID(),expected_revision:t.revision,scope_id:n})).analysis}async function ae(e,t,n){return(await v(`/api/projects/${t}/analyses/${n}/commands/cancel`,e,{})).analysis}async function oe(e,t,n){return(await v(`/api/projects/${t}/analyses/${n}/commands/resume`,e,{request_id:crypto.randomUUID()})).analysis}function se(e,t=0){return _(`/api/projects/${e}/evidence?offset=${t}`)}function ce(e,t,n,r){return v(`/api/projects/${e}/evidence/commands/${n}`,t,r)}async function le(e,t,n){return(await v(`/api/projects/${encodeURIComponent(t)}/production/commands/resume/${encodeURIComponent(n)}`,e,{consent:!0})).run}function ue(e,t){return _(`/api/projects/${e}/production/${t}/workbench`)}function z(e,t,n,r,i){return v(`/api/projects/${t}/production/${n}/workbench/edit`,e,{tool:`restore_revision`,arguments:{revision_id:i,summary:`使用者還原影片版本`},expected_revision_id:r,mutation_id:crypto.randomUUID()})}function de(e,t,n,r,i){return v(`/api/projects/${t}/production/${n}/workbench/edit`,e,{tool:`edit_component`,arguments:{...i,summary:`使用者修改元件`},expected_revision_id:r,mutation_id:crypto.randomUUID()})}function fe(e,t,n,r,i){return v(`/api/projects/${t}/production/${n}/workbench/edit`,e,{tool:`edit_component_look`,arguments:{...i,summary:`使用者修改元件外觀`},expected_revision_id:r,mutation_id:crypto.randomUUID()})}function pe(e,t,n,r,i){return v(`/api/projects/${t}/production/${n}/workbench/edit`,e,{tool:`remove_program_component`,arguments:{element_id:i,summary:`使用者刪除元件`},expected_revision_id:r,mutation_id:crypto.randomUUID()})}function B(e,t,n,r){return v(`/api/projects/${t}/production/${n}/workbench/render`,e,{expected_revision_id:r})}function me(e,t,n,r,i,a,o){return v(`/api/projects/${t}/production/${n}/workbench/refine`,e,{request_id:crypto.randomUUID(),expected_revision_id:r,instruction:i,consent:!0,...a?{music_asset_id:a}:{},...o===void 0?{}:{expected_references_version:o}})}function he(e,t,n){return v(`/api/projects/${t}/production/${n}/workbench/resolve`,e,{})}function ge(e,t,n,r){return v(`/api/projects/${t}/production/${n}/workbench/resolve_titles`,e,{folder:r})}function _e(e,t,n,r){return v(`/api/projects/${t}/production/${n}/workbench/resolve_status`,e,{folder:r})}async function ve(e,t,n){return v(`/api/projects/${t}/production/${n}/workbench/export`,e,{})}async function ye(e){return(await _(`/api/projects/${e}/production/music`)).assets}async function V(e,t,n){return(await _(`/api/projects/${t}/production/music?filename=${encodeURIComponent(n.name)}`,{method:`POST`,headers:{"Content-Type":`application/octet-stream`,"X-Clipen-CSRF":e},body:n})).asset}function be(e,t=0){return _(`/api/production/prompts?${new URLSearchParams({offset:String(t),limit:`30`,...e?{project_id:e}:{}})}`)}function xe(e,t,n,r){return v(`/api/projects/${t}/production/prompts`,e,{request_id:crypto.randomUUID(),kind:n,text:r})}function H(e,t,n,r,i,a,o){return _(`/api/projects/${t}/production/${n}/workbench/frame`,{method:`POST`,headers:{"Content-Type":`application/json`,"X-Clipen-CSRF":e},body:JSON.stringify({expected_revision_id:r,frame:i,...o?{component:o}:{}}),signal:a})}function Se(e,t,n,r,i,a){return v(`/api/projects/${t}/production/${n}/workbench/reference`,e,{expected_revision_id:r,expected_version:i,mutation_id:crypto.randomUUID(),...a})}var Ce=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),U=e(((e,t)=>{t.exports=Ce()}))(),we={minimal:`最低`,low:`低`,medium:`中`,high:`高`,xhigh:`很高`,max:`最高`,ultra:`極高`},Te={five_hour:`5 小時額度`,weekly:`每週額度`,other:`額度`};function Ee(e){if(!e)return null;let t=new Date(e*1e3);return`${t.getTime()-Date.now()<864e5?t.toLocaleTimeString(`zh-TW`,{hour12:!1,hour:`2-digit`,minute:`2-digit`}):t.toLocaleDateString(`zh-TW`,{month:`numeric`,day:`numeric`})} 重置`}function De(e){return Math.max(0,100-e.used_percent)}function Oe({label:e,ready:t,providerReady:n,providerName:r}){let[i,a]=(0,l.useState)(null);(0,l.useEffect)(()=>{if(!n)return;let e=!1,t=()=>void x().then(t=>{e||a(t)}).catch(()=>{});t();let r=window.setInterval(t,12e4);return window.addEventListener(`focus`,t),()=>{e=!0,window.clearInterval(r),window.removeEventListener(`focus`,t)}},[n]);let o=i?.model,s=r===`Claude`?`Claude Code`:r,c=i?.quota,u=c?.windows[0],d=c?.limited||u!==void 0&&De(u)<20,f=t?n?[r,o?.name].filter(Boolean).join(` · `):`${r} 需要處理`:e,p=c?.limited?`額度已用完`:u?`剩 ${De(u)}%`:null;return!t||!n?(0,U.jsxs)(`div`,{className:`connection-badge`,"aria-live":`polite`,children:[(0,U.jsx)(`span`,{"aria-hidden":`true`}),f]}):(0,U.jsxs)(`details`,{className:`provider-badge`,children:[(0,U.jsxs)(`summary`,{className:`connection-badge is-ready ${d?`is-low`:``}`,"aria-label":`目前使用 ${f}${p?`,${p}`:``},查看模型與額度`,children:[(0,U.jsx)(`span`,{"aria-hidden":`true`}),f,p&&(0,U.jsx)(`em`,{className:`provider-quota-pill`,children:p})]}),(0,U.jsxs)(`div`,{className:`provider-popover`,children:[(0,U.jsxs)(`dl`,{children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`AI`}),(0,U.jsxs)(`dd`,{children:[r,c?.plan?`(${c.plan.charAt(0).toUpperCase()}${c.plan.slice(1)} 方案)`:``]})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`模型`}),(0,U.jsx)(`dd`,{children:o?(0,U.jsxs)(U.Fragment,{children:[o.name,o.effort?`,推理強度${we[o.effort]??o.effort}`:``]}):`第一次製作後顯示`})]}),c?.source===`live`&&c.windows.map(e=>(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:Te[e.kind]}),(0,U.jsxs)(`dd`,{children:[(0,U.jsx)(`meter`,{min:0,max:100,low:20,high:50,optimum:100,value:De(e),"aria-label":`${Te[e.kind]}剩 ${De(e)}%`}),(0,U.jsxs)(`span`,{children:[`剩 `,De(e),`%`,Ee(e.resets_at)?`,${Ee(e.resets_at)}`:``]})]})]},e.kind)),c?.source===`last_run`&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`額度`}),(0,U.jsxs)(`dd`,{children:[c.limited?`已達上限`:c.warning?`快用完了`:`可以使用`,Ee(c.resets_at)?`,${Ee(c.resets_at)}`:``]})]}),!c&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`額度`}),(0,U.jsx)(`dd`,{children:r===`Claude`?`第一次製作後顯示`:`暫時讀不到`})]})]}),c?.source===`last_run`&&(0,U.jsx)(`p`,{children:`Claude Code 不提供剩餘百分比,這是最近一次製作時回報的狀態。`}),o?.unavailable&&(0,U.jsxs)(`p`,{children:[`你在 `,s,` 設定的模型 `,o.unavailable,` 目前不能用在這個帳號,改用預設模型`,o.source===`codex_config`?`;推理強度沿用你的設定`:``,`。`]}),o&&!o.unavailable&&(o.source===`codex_config`||o.source===`claude_config`)&&(0,U.jsxs)(`p`,{children:[`沿用你在 `,s,` 設定的模型與推理強度。`]}),o&&o.source==="default"&&!o.unavailable&&(0,U.jsxs)(`p`,{children:[`你沒有在 `,s,` 設定模型,使用帳號的預設模型。`]}),!o&&r===`Claude`&&(0,U.jsx)(`p`,{children:`你沒有在 Claude Code 設定模型;第一次製作後會顯示實際使用的模型。`})]})]})}var ke=(0,l.createContext)({name:`Codex`});function Ae(){return(0,l.useContext)(ke)}var je={codex:`Codex`,claude:`Claude`};function Me(e){return e&&je[e]||`AI`}var Ne={running:`處理中`,succeeded:`已完成`,failed:`未完成`,cancelled:`已停止`,interrupted:`已中斷`},Pe={evidence_disk_full:`Clipen 儲存磁碟空間不足,請釋放空間後再試;毛片不會被刪除。`,source_changed:`來源檔案已改變,請重新檢查素材。`,time_metadata_missing:`缺少可靠的來源時間資訊,未推測時間位置。`,frame_decode_failed:`無法解碼畫面。`,scene_decode_failed:`無法取得場景變化。`,frame_time_mapping_invalid:`無法可靠對應來源時間,結果未採用。`,audio_decode_failed:`無法解碼音訊。`,evidence_scope_changed:`素材範圍已改變,請重新擷取。`,outcome_unknown:`中斷時無法確認 AI 是否完成;不會自動重送,可能已使用額度。`,controller_stopped:`Clipen 已關閉,已完成的本機成果保留。`};function Fe(e,t){if(!e.source)return`時間未知`;let n=BigInt(t)-BigInt(e.source.start_pts);return`${(Number(n)*e.source.time_base.num/e.source.time_base.den).toFixed(2)} 秒`}function Ie({projectId:e,csrf:t,inventoryId:n}){let r=Ae(),[i,a]=(0,l.useState)(null),[o,s]=(0,l.useState)(``),[c,u]=(0,l.useState)(!1),[d,f]=(0,l.useState)(null),[p,m]=(0,l.useState)(0),[h,g]=(0,l.useState)(0),_=i?.latest?.state===`running`||i?.latest?.observations.some(e=>e.state===`running`);(0,l.useEffect)(()=>{let t=!0,n;async function r(){try{let i=await se(e,h);if(!t)return;a(i),s(``),(i.latest?.state===`running`||i.latest?.observations.some(e=>e.state===`running`))&&(n=setTimeout(()=>void r(),1500))}catch(e){t&&s(e instanceof Error?e.message:`無法讀取分析狀態。`)}}return r(),()=>{t=!1,clearTimeout(n)}},[e,n,_,p,h]);async function v(n,r){if(!(c||!i)){u(!0),s(``);try{await ce(e,t,n,n===`start`?{request_id:crypto.randomUUID(),expected_revision:i.scope?.project_revision,scope_id:i.scope?.scope_id}:n===`observe`?{run_id:i.latest?.run_id,request_id:crypto.randomUUID(),item_key:r,consent:!0}:{run_id:i.latest?.run_id}),a(await se(e,h)),f(null),m(e=>e+1)}catch(e){s(e instanceof Error?e.message:`操作失敗,請重新讀取狀態。`)}finally{u(!1)}}}let y=i?.latest,b=Math.max(0,(i?.limits.ai_calls_per_run??3)-(y?.observations.length??0));return(0,U.jsxs)(`section`,{className:`analysis-section evidence-section`,"aria-labelledby":`evidence-title`,children:[(0,U.jsx)(`div`,{className:`analysis-heading`,children:(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`eyebrow`,children:`畫面與聲音證據`}),(0,U.jsx)(`h2`,{id:`evidence-title`,children:`先看取樣,再決定是否交給 AI`})]})}),(0,U.jsx)(`p`,{children:`在本機取樣代表畫面與音量,不花 AI 額度,也不改動毛片。`}),o&&(0,U.jsxs)(`div`,{role:`alert`,children:[(0,U.jsx)(`p`,{children:o}),(0,U.jsx)(`button`,{className:`button secondary`,type:`button`,onClick:()=>m(e=>e+1),children:`重新讀取狀態`})]}),!i&&!o&&(0,U.jsx)(`p`,{role:`status`,children:`正在讀取證據分析狀態…`}),i?.blocked_reason&&(0,U.jsx)(`p`,{children:i.blocked_reason}),i?.scope&&(0,U.jsxs)(`div`,{className:`evidence-actions`,children:[(0,U.jsxs)(`span`,{children:[i.scope.total,` 個影音串流`]}),(0,U.jsx)(`button`,{className:`button primary`,type:`button`,disabled:c||_,onClick:()=>void v(`start`),children:y?`更新本機證據`:`擷取本機證據`}),_&&(0,U.jsx)(`button`,{className:`button secondary`,type:`button`,disabled:c,onClick:()=>void v(`cancel`),children:`停止分析`}),y&&!y.stale&&[`interrupted`,`cancelled`].includes(y.state)&&(0,U.jsx)(`button`,{className:`button secondary`,type:`button`,disabled:c||_,onClick:()=>void v(`resume`),children:`接續本機擷取`})]}),y&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{role:`status`,children:[`本機擷取:`,Ne[y.state]??y.state,` · `,y.completed_count,` / `,y.total,` 個串流已處理 · `,y.issue_count,` 個需注意`]}),y.state===`running`&&y.progress.display_name&&(0,U.jsxs)(`p`,{role:`status`,children:[`正在處理 `,y.progress.display_name,`:`,y.progress.phase===`frames`?`取樣畫面 ${y.progress.frames}(動態,上限 ${i.limits.frames_per_stream})`:y.progress.phase===`scenes`?`讀取全片的稀疏壓縮關鍵幀資訊`:`量測前 120 秒的音訊能量`]}),y.state===`running`&&(0,U.jsx)(`progress`,{value:y.completed_count,max:y.total,"aria-label":`本機證據擷取進度`}),y.error_code&&(0,U.jsx)(`p`,{children:Pe[y.error_code]??`未完成,已保存的成果仍保留。`}),y.stale&&(0,U.jsx)(`p`,{role:`alert`,children:`以下是舊素材範圍的結果,不能再送出 AI 觀察。請重新擷取。`}),(0,U.jsxs)(`p`,{children:[`AI 觀察剩餘 `,b,` 次`]}),(0,U.jsxs)(`details`,{className:`evidence-samples`,children:[(0,U.jsx)(`summary`,{children:`查看取樣畫面與技術資訊`}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`p`,{children:[`每支影片依片長取樣,略過相似畫面,保留 1~`,i.limits.frames_per_stream,` 張代表畫面;音量只量前 120 秒,不逐幀掃描,也不是完整的影片理解。未變更的成果會重用;本機語音辨識執行中時,擷取會等它。每次 AI 觀察最多 8 張縮圖、120 秒;Token 用量不等於帳號 Quota 百分比,無法保證固定額度成本。`]}),y.total>y.page_size&&(0,U.jsxs)(`nav`,{className:`evidence-actions`,"aria-label":`證據結果分頁`,children:[(0,U.jsx)(`button`,{className:`button secondary`,type:`button`,disabled:h===0||c,onClick:()=>g(e=>Math.max(0,e-y.page_size)),children:`上一頁`}),(0,U.jsxs)(`span`,{children:[`第 `,Math.floor(h/y.page_size)+1,` / `,Math.ceil(y.total/y.page_size),` 頁`]}),(0,U.jsx)(`button`,{className:`button secondary`,type:`button`,disabled:h+y.page_size>=y.total||c,onClick:()=>g(e=>e+y.page_size),children:`下一頁`})]}),y.results.length===0&&y.state===`running`&&(0,U.jsx)(`p`,{children:`此頁的串流尚待處理。`}),y.results.map(t=>{let n=y.observations.find(e=>e.item_key===t.key);return(0,U.jsxs)(`details`,{className:`evidence-item`,children:[(0,U.jsxs)(`summary`,{children:[t.role===`reference`?`範例作品`:`毛片`,` · `,t.display_name,` · `,t.kind===`video`?`${t.frames.length} 張畫面取樣`:`音訊能量`,t.error_code?` · 需注意`:``]}),t.error_code?(0,U.jsx)(`p`,{role:`alert`,children:Pe[t.error_code]??`無法擷取此串流,請確認來源磁碟可讀取。`}):(0,U.jsxs)(U.Fragment,{children:[t.kind===`video`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{children:`畫面:僅在下列時間點有取樣。語音請見本機逐字稿分析區;圖片無法證明聲音或畫面間的動作;預覽色彩不適合用來判斷精確調色。`}),(0,U.jsx)(`div`,{className:`evidence-frames`,children:t.frames.map((n,r)=>(0,U.jsxs)(`figure`,{children:[(0,U.jsx)(`img`,{loading:`lazy`,width:`240`,height:`160`,src:`/api/projects/${e}/evidence/${y.run_id}/images/${n.artifact_id}`,alt:`${t.display_name},${Fe(t,n.pts)}的取樣畫面`}),(0,U.jsxs)(`figcaption`,{children:[r+1,` · `,Fe(t,n.pts)]})]},n.artifact_id))}),(0,U.jsx)(`p`,{children:t.scene_error_code?`舊版場景變化分析未完成;已取得的畫面取樣仍保留。`:t.keyframe_fallback_code?`壓縮關鍵幀資訊無法使用,已自動改用整段時間覆蓋取樣。`:(0,U.jsxs)(U.Fragment,{children:[`在全片 `,t.keyframe_candidates?.probe_count??0,` 個稀疏時間點讀到 `,t.keyframe_candidates?.candidate_pts.length??0,` 個 codec 關鍵幀候選點`,t.keyframe_candidates?.candidate_limit_reached?`(已達 256 點上限)`:``,`,再與整段時間錨點共同選擇;封包大小只代表壓縮內容複雜度,不代表語意或真正換場。`]})}),t.keyframe_selection&&(0,U.jsxs)(`p`,{children:[`這支影片去除相似畫面後最多保留 `,t.keyframe_selection.retained_limit??t.keyframe_selection.frame_budget??8,` 張;從 `,t.keyframe_selection.candidate_count,` 個候選時間點解出 `,t.keyframe_selection.decoded_count??t.keyframe_selection.selected.length,` 張,略過 `,t.keyframe_selection.duplicate_count??0,` 張相似畫面,並補取 `,t.keyframe_selection.backfill_attempts??0,` 張後,保留 `,t.frames.length,` 張代表畫面。`,t.keyframe_selection.semantic_relevance?`包含本機語意相關性訊號。`:`目前僅使用本機時間、壓縮內容複雜度與縮圖相似度訊號。`]})]}):(0,U.jsxs)(`p`,{children:[`聲音:已量測 `,t.audio_features?.windows.length??0,` 個音訊能量視窗,其中 `,t.audio_features?.windows.filter(e=>e.low_energy).length??0,` 個低能量視窗;未判斷音樂、人聲或音效種類。`]}),(0,U.jsxs)(`p`,{children:[`連續覆蓋:`,t.coverage?.complete?`此聲音串流的能量量測完成`:`仍有未分析範圍`,`。`]}),!!t.coverage?.uncovered.length&&(0,U.jsxs)(`p`,{children:[`未連續分析:`,t.coverage.uncovered.map(e=>`${Fe(t,e.start_pts)}~${Fe(t,e.end_pts)}`).join(`、`)]}),t.kind===`video`&&!n&&!y.stale&&(0,U.jsx)(U.Fragment,{children:d===t.key?(0,U.jsxs)(`div`,{className:`evidence-consent`,children:[(0,U.jsxs)(`p`,{children:[`將從上方 `,t.frames.length,` 張本機縮圖中,依時間平均選出最多 `,i.limits.ai_images_per_call,` 張傳給 `,r.name,`,包含圖片中可見的私人資訊。不會傳送原始影片、音訊、完整逐字稿或 Repo。這會使用 AI 額度;失敗不會自動重試。`]}),(0,U.jsx)(`button`,{className:`button primary`,type:`button`,disabled:c||_,onClick:()=>void v(`observe`,t.key),children:`同意傳送並開始觀察`}),(0,U.jsx)(`button`,{className:`button secondary`,type:`button`,disabled:c,onClick:()=>f(null),children:`先不要`})]}):(0,U.jsx)(`button`,{className:`button secondary`,type:`button`,disabled:c||_||y.state!==`succeeded`||b===0||!i?.provider_available,onClick:()=>f(t.key),children:`讓 AI 觀察這批畫面`})})]}),n&&(0,U.jsxs)(`div`,{className:`evidence-observation`,children:[(0,U.jsxs)(`h3`,{children:[`AI 圖片觀察:`,Ne[n.state]??n.state]}),n.error_code&&(0,U.jsx)(`p`,{children:Pe[n.error_code]??`此次觀察未完成,不會自動重送。`}),(0,U.jsx)(`p`,{children:n.usage?`實際 input ${n.usage.input_tokens.toLocaleString()} · cached input ${n.usage.cached_input_tokens.toLocaleString()} · output ${n.usage.output_tokens.toLocaleString()} tokens`:`尚無可確認的 Token 用量,不代表沒有消耗。`}),n.result&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`ol`,{children:n.result.observations.map(e=>(0,U.jsxs)(`li`,{children:[e.description,(0,U.jsxs)(`p`,{children:[`不確定處:`,e.uncertainty]})]},e.index))}),(0,U.jsx)(`h4`,{children:t.role===`reference`?`範例風格證據`:`畫面風格觀察`}),(0,U.jsx)(`p`,{children:n.result.style_summary}),(0,U.jsxs)(`p`,{children:[`限制:`,n.result.limitations]})]})]})]},t.key)})]})]})]})]})}var Le=[{value:`dawn`,label:`清晨`},{value:`morning`,label:`早上`},{value:`noon`,label:`中午`},{value:`afternoon`,label:`下午`},{value:`evening`,label:`傍晚`},{value:`night`,label:`晚上`},{value:`late_night`,label:`深夜`}],Re=[{value:`normal`,label:`交給 AI 判斷`,help:`依剪輯計畫選用`},{value:`must_use`,label:`優先使用`,help:`這段對成片很重要`},{value:`ambient_only`,label:`只取畫面`,help:`不採用這段逐字稿`},{value:`exclude`,label:`不要使用`,help:`排除這段素材`}];function ze(e){return[...new Set(e.split(/[,,、\n]/).map(e=>e.trim()).filter(Boolean))]}function Be(e){return e.material.revision===0?{...e,material:{...e.material,location:e.suggestion.location,trip_day:e.suggestion.trip_day,day_part:e.suggestion.day_part}}:e}function Ve({csrf:e,projectId:t,initial:n,transcript:r,mediaKind:i,formatTime:a,onSaved:o}){let s=(0,l.useMemo)(()=>Be(n),[n]),[c,u]=(0,l.useState)(s),[d,f]=(0,l.useState)(n.material.people.join(`、`)),[p,m]=(0,l.useState)(!1),[h,g]=(0,l.useState)(!1),[_,v]=(0,l.useState)(null),[y,b]=(0,l.useState)(!1),x=(0,l.useRef)(null),S=(0,l.useMemo)(()=>new Map(c.transcript?.corrections.map(e=>[e.ordinal,e.text])??[]),[c.transcript?.corrections]),C=(0,l.useMemo)(()=>({...c,material:{...c.material,people:ze(d)}}),[c,d]),w=JSON.stringify(C)!==JSON.stringify(s),T=n.material.revision===0&&(n.transcript?.revision??0)===0,E=Le.find(e=>e.value===c.material.day_part)?.label,D=[c.material.trip_day?`第 ${c.material.trip_day} 天`:null,E??null,c.material.location,...ze(d).slice(0,2)].filter(Boolean).join(` · `);function O(e,t){g(!1),u(n=>({...n,material:{...n.material,[e]:t}}))}function ee(e,t,n){if(!c.transcript)return;let r=c.transcript.corrections.filter(t=>t.ordinal!==e);n!==t&&r.push({ordinal:e,text:n}),r.sort((e,t)=>e.ordinal-t.ordinal),g(!1),u(e=>({...e,transcript:e.transcript&&{...e.transcript,corrections:r,confirmed:!1}}))}async function k(n){m(!0),v(null);try{let r=await ie(e,t,n);u(r),f(r.material.people.join(`、`)),g(!0),o(r)}catch(e){v(e instanceof Error?e.message:`無法保存素材資訊。`)}finally{m(!1)}}async function A(){await k(C)}async function j(e){if(!c.transcript||e&&!window.confirm(`確定要移除這份逐字稿?
|
|
10
|
-
|
|
11
|
-
素材與原始辨識紀錄不會被刪除,之後仍可恢復;移除後 AI 不會使用這份文字。`))return;let t={...C,transcript:{...c.transcript,discarded:e,confirmed:!e&&c.transcript.confirmed}};u(t),g(!1),await k(t)}function te(e){if(!x.current||!r)return;let t=Number(BigInt(e)-BigInt(r.source_start_pts));x.current.currentTime=Math.max(0,t*r.time_base.num/r.time_base.den),x.current.play()}return(0,U.jsxs)(`div`,{className:`annotation-editor`,children:[(0,U.jsxs)(`div`,{className:`annotation-workbench`,children:[(0,U.jsxs)(`div`,{className:`material-player`,children:[i===`video`?(0,U.jsx)(`video`,{ref:e=>{x.current=e},controls:!0,preload:`metadata`,onError:()=>b(!0),src:`/api/projects/${t}/media/${n.material.version_id}`,children:`目前的瀏覽器無法直接播放這個素材。`}):(0,U.jsx)(`audio`,{ref:e=>{x.current=e},controls:!0,preload:`metadata`,onError:()=>b(!0),src:`/api/projects/${t}/media/${n.material.version_id}`,children:`目前的瀏覽器無法直接播放這個素材。`}),(0,U.jsx)(`p`,{children:y?`無法直接播放。請確認外接硬碟仍連接;若素材編碼不受瀏覽器支援,後續可建立本機預覽檔。`:`本機唯讀播放,不會上傳或建立副本。`})]}),(0,U.jsxs)(`div`,{className:`annotation-decision`,children:[(0,U.jsxs)(`div`,{className:`annotation-intro`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:`整理這段素材`}),(0,U.jsx)(`p`,{children:`先決定怎麼使用,再補充必要線索。`})]}),(0,U.jsx)(`div`,{className:`annotation-origin`,children:n.material.revision===0&&n.suggestion.capture_time&&(0,U.jsxs)(`span`,{children:[`拍攝於 `,n.suggestion.capture_time.replace(`T`,` `).slice(5,16)]})})]}),(0,U.jsxs)(`fieldset`,{className:`annotation-usage`,children:[(0,U.jsx)(`legend`,{children:`這段要怎麼用?`}),(0,U.jsx)(`div`,{className:`usage-options`,children:Re.map(e=>(0,U.jsxs)(`label`,{className:c.material.usage===e.value?`is-selected`:``,children:[(0,U.jsx)(`input`,{type:`radio`,name:`usage-${n.material.version_id}`,value:e.value,checked:c.material.usage===e.value,onChange:()=>O(`usage`,e.value)}),(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`strong`,{children:e.label}),(0,U.jsx)(`small`,{children:e.help})]})]},e.value))})]})]})]}),(0,U.jsxs)(`details`,{className:`annotation-context-disclosure`,children:[(0,U.jsxs)(`summary`,{children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:`場景資訊與備註`}),(0,U.jsx)(`span`,{children:D||`沒有補充資訊`})]}),(0,U.jsxs)(`span`,{className:`disclosure-action`,children:[(0,U.jsx)(`span`,{className:`when-closed`,children:`選填 · 展開`}),(0,U.jsx)(`span`,{className:`when-open`,children:`收合`})]})]}),(0,U.jsxs)(`div`,{className:`annotation-context`,children:[(0,U.jsxs)(`div`,{className:`annotation-grid compact`,children:[(0,U.jsxs)(`label`,{className:`annotation-field`,children:[(0,U.jsx)(`span`,{children:`人物`}),(0,U.jsx)(`input`,{value:d,maxLength:800,placeholder:`例如:我、朋友`,onChange:e=>{f(e.target.value),g(!1)}})]}),(0,U.jsxs)(`label`,{className:`annotation-field`,children:[(0,U.jsxs)(`span`,{children:[`地點 `,n.material.revision===0&&n.suggestion.location&&(0,U.jsx)(`small`,{className:`auto-label`,children:`自動`})]}),(0,U.jsx)(`input`,{value:c.material.location??``,maxLength:160,placeholder:`未指定`,onChange:e=>O(`location`,e.target.value||null)})]}),(0,U.jsxs)(`label`,{className:`annotation-field`,children:[(0,U.jsxs)(`span`,{children:[`旅行日 `,n.material.revision===0&&n.suggestion.capture_time&&(0,U.jsx)(`small`,{className:`auto-label`,children:`自動`})]}),(0,U.jsxs)(`div`,{className:`day-input`,children:[(0,U.jsx)(`span`,{children:`第`}),(0,U.jsx)(`input`,{"aria-label":`旅行第幾天`,type:`number`,min:`1`,max:`365`,value:c.material.trip_day??``,placeholder:`—`,onChange:e=>O(`trip_day`,e.target.value?Number(e.target.value):null)}),(0,U.jsx)(`span`,{children:`天`})]})]}),(0,U.jsxs)(`label`,{className:`annotation-field`,children:[(0,U.jsxs)(`span`,{children:[`時段 `,n.material.revision===0&&n.suggestion.capture_time&&(0,U.jsx)(`small`,{className:`auto-label`,children:`自動`})]}),(0,U.jsxs)(`select`,{value:c.material.day_part??``,onChange:e=>O(`day_part`,e.target.value||null),children:[(0,U.jsx)(`option`,{value:``,children:`未指定`}),Le.map(e=>(0,U.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]})]}),(0,U.jsxs)(`label`,{className:`annotation-field annotation-note`,children:[(0,U.jsxs)(`span`,{children:[`給剪輯 AI 的備註 `,(0,U.jsx)(`small`,{children:`選填`})]}),(0,U.jsx)(`textarea`,{rows:2,maxLength:2e3,value:c.material.note,placeholder:`例如:進店前的轉場,希望保留笑聲`,onChange:e=>O(`note`,e.target.value)}),(0,U.jsxs)(`small`,{children:[c.material.note.length.toLocaleString(),` / 2,000`]})]})]})]}),r&&c.transcript&&(0,U.jsxs)(`div`,{className:`transcript-review`,children:[c.transcript.stale&&(0,U.jsx)(`p`,{className:`annotation-stale`,role:`status`,children:`逐字稿已重新分析;舊修正沒有自動套用,請依目前文字重新核對。`}),(0,U.jsxs)(`div`,{className:`transcript-review-heading`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:c.transcript.discarded?`逐字稿已移除`:`核對逐字稿`}),(0,U.jsx)(`p`,{children:c.transcript.discarded?`AI 不會使用這份文字;素材仍可依畫面內容參與剪輯。`:`只改錯字;時間碼仍以原始分析為準。`})]}),(0,U.jsxs)(`div`,{className:`transcript-heading-actions`,children:[!c.transcript.discarded&&(0,U.jsxs)(`label`,{className:`confirm-transcript`,children:[(0,U.jsx)(`input`,{type:`checkbox`,disabled:r.next_offset!==null,checked:c.transcript.confirmed,onChange:e=>{g(!1),u(t=>({...t,transcript:t.transcript&&{...t.transcript,confirmed:e.target.checked}}))}}),(0,U.jsx)(`span`,{children:r.next_offset===null?`我已核對全部文字`:`載入全部文字後可確認`})]}),(0,U.jsx)(`button`,{className:`button transcript-discard ${c.transcript.discarded?`restore`:``}`,type:`button`,disabled:p,onClick:()=>void j(!c.transcript?.discarded),children:c.transcript.discarded?`恢復逐字稿`:`移除逐字稿`})]})]}),c.transcript.discarded?(0,U.jsxs)(`div`,{className:`transcript-discarded-message`,children:[(0,U.jsx)(`strong`,{children:`已從剪輯計畫的文字線索中移除`}),(0,U.jsx)(`p`,{children:`適合背景談話、路人聲音或與作品無關的收音。原始影片與辨識資料都還在。`})]}):(0,U.jsx)(`ol`,{className:`transcript-segments editable`,children:r.segments.map(e=>{let t=S.get(e.ordinal),n=t===``;return(0,U.jsxs)(`li`,{className:n?`is-removed`:``,children:[(0,U.jsx)(`button`,{className:`transcript-seek`,type:`button`,onClick:()=>te(e.start_pts),children:a(e.start_pts)}),n?(0,U.jsxs)(`div`,{className:`transcript-segment-removed`,children:[(0,U.jsx)(`strong`,{children:`這段逐字稿已移除`}),(0,U.jsx)(`span`,{children:`不會提供給剪輯 AI`})]}):(0,U.jsx)(`textarea`,{rows:2,"aria-label":`逐字稿片段 ${e.ordinal+1}`,value:t??e.text,onChange:t=>ee(e.ordinal,e.text,t.target.value)}),(0,U.jsxs)(`div`,{className:`transcript-segment-actions`,children:[!n&&(0,U.jsx)(`span`,{className:S.has(e.ordinal)?`corrected`:``,children:S.has(e.ordinal)?`已修正`:`原始辨識`}),(0,U.jsx)(`button`,{type:`button`,className:`transcript-segment-remove ${n?`restore`:``}`,onClick:()=>ee(e.ordinal,e.text,n?e.text:``),children:n?`恢復這段`:`移除這段`})]})]},e.ordinal)})})]}),(0,U.jsxs)(`div`,{className:`annotation-actions ${w?`has-changes`:``}`,children:[(0,U.jsxs)(`div`,{"aria-live":`polite`,children:[_&&(0,U.jsx)(`p`,{className:`form-error`,role:`alert`,children:_}),h&&(0,U.jsx)(`p`,{className:`save-success`,children:`已保存。AI 製作時會參考這些標註。`}),!_&&!h&&w&&(0,U.jsx)(`p`,{className:`unsaved-hint`,children:`有尚未保存的修改`})]}),w||p?(0,U.jsx)(`button`,{className:`button primary`,type:`button`,disabled:p,onClick:()=>void A(),children:p?`正在保存…`:`保存修改`}):T?(0,U.jsx)(`button`,{className:`button secondary mark-reviewed`,type:`button`,onClick:()=>void A(),children:`標記為已看過`}):(0,U.jsx)(`span`,{className:`annotation-current`,children:`✓ 目前設定已套用`})]})]})}var He={pending:`尚未處理`,prepared:`等待辨識`,transcribed:`有逐字稿`,needs_review:`辨識不確定`,no_audio:`沒有音軌`,no_speech:`未偵測到人聲`,failed:`需要處理`},Ue={root_changed:`外接磁碟重新掛載後的素材位置無法確認,這個項目沒有進行辨識。`,root_unavailable:`目前無法讀取素材磁碟,這個項目沒有進行辨識。`,source_changed:`分析期間素材有變動,這份結果未被採用。`,audio_decode_failed:`無法從這個素材讀取音訊。`,audio_decode_timeout:`音訊準備時間過長,已安全停止這個項目。`,audio_output_missing:`沒有取得可供辨識的音訊。`,audio_artifact_too_large:`音訊衍生成果超過安全大小限制。`,audio_time_mapping_invalid:`無法把音訊時間可靠地對回原始素材。`,normalized_audio_invalid:`轉換後的音訊格式無法驗證。`,ffmpeg_unavailable:`找不到 FFmpeg,無法準備音訊。`,ffmpeg_unsupported:`目前的 FFmpeg 版本不支援這個素材。`,ffmpeg_output_too_large:`音訊轉換輸出超過安全大小限制。`,asr_failed:`本機語音辨識沒有完成這個項目。`,asr_timeout:`語音辨識時間過長,已安全停止這個項目。`,asr_result_invalid:`語音辨識結果格式無法驗證。`,asr_result_too_large:`逐字稿結果超過安全大小限制。`,asr_output_too_large:`語音辨識輸出超過安全大小限制。`,asr_model_changed:`辨識期間模型內容有變動,結果未被採用。`,asr_model_unavailable:`本機語音辨識模型暫時無法使用。`,asr_runtime_unavailable:`本機語音辨識環境暫時無法使用。`,asr_runtime_unsupported:`目前的語音辨識環境不受支援。`,transcript_low_confidence:`原始收音與有限的增強比對沒有得到穩定結果,或無法確認人聲是否屬於拍攝主體。這份逐字稿不會被當成可信口語,請搭配畫面與原音確認。`,transcript_quality_unverified:`這是舊版產生的逐字稿,品質尚未驗證,請先核對。`,preparation_item_internal_error:`處理這個項目時發生未預期的本機錯誤。`},We={normal:`一般素材`,must_use:`優先使用`,exclude:`不要使用`,ambient_only:`只取畫面/環境音`},Ge={pending:`尚未處理`,reviewed:`已看過`,confirmed:`已核對`,priority:`優先使用`,excluded:`不要使用`};function Ke(e){return`${e.version_id}:${e.stream_index}`}function qe(e,t){try{let n=BigInt(e)*BigInt(t.num)*1000n/BigInt(t.den),r=n<0n,i=r?-n:n,a=i/3600000n;i%=3600000n;let o=i/60000n;i%=60000n;let s=i/1000n,c=i%1000n,l=a>0n?`${a}:${o.toString().padStart(2,`0`)}:${s.toString().padStart(2,`0`)}`:`${o}:${s.toString().padStart(2,`0`)}`;return`${r?`−`:``}${l}.${c.toString().padStart(3,`0`)}`}catch{return`時間未知`}}function Je({csrf:e,projectId:t,run:n,refreshToken:r=0}){let[i,a]=(0,l.useState)(0),[o,s]=(0,l.useState)(null),[c,u]=(0,l.useState)(`all`),[d,f]=(0,l.useState)(0),[p,m]=(0,l.useState)(null),[h,g]=(0,l.useState)({}),[_,v]=(0,l.useState)({}),y=`${n.run_id}:${i}:${o??`all`}:${c}:${r}:${d}`,b=p?.requestKey===y?p:null,x=b?.state===`ready`?b.page??null:null,S=b===null,C=b?.state===`failed`?b.message??`無法讀取逐字稿清單。`:null;(0,l.useEffect)(()=>{let e=!0;return P(t,n.run_id,i,{tripDay:o,reviewState:c}).then(t=>{e&&m({requestKey:y,state:`ready`,page:t})}).catch(t=>{e&&m({requestKey:y,state:`failed`,message:t instanceof Error?t.message:`無法讀取逐字稿清單。`})}),()=>{e=!1}},[i,t,y,c,n.run_id,o]);function w(e,r){if(!r)return;let i=Ke(e);_[i]||(v(e=>({...e,[i]:{state:`loading`}})),I(t,e.version_id,e.stream_index).then(e=>v(t=>({...t,[i]:{state:`ready`,annotation:e}}))).catch(e=>v(t=>({...t,[i]:{state:`failed`,message:e instanceof Error?e.message:`無法讀取素材資訊。`}})))),!(![`transcribed`,`needs_review`].includes(e.status)||h[i])&&(g(e=>({...e,[i]:{state:`loading`}})),F(t,n.run_id,e.version_id,e.stream_index).then(e=>{g(t=>({...t,[i]:{state:`ready`,page:e}}))}).catch(e=>{g(t=>({...t,[i]:{state:`failed`,message:e instanceof Error?e.message:`無法讀取這份逐字稿。`}}))}))}function T(e){let r=Ke(e),i=h[r];i?.state!==`ready`||!i.page||i.page.next_offset===null||(g(e=>({...e,[r]:{...i,loadingMore:!0}})),F(t,n.run_id,e.version_id,e.stream_index,i.page.next_offset).then(e=>{g(t=>({...t,[r]:{state:`ready`,page:{...e,offset:0,segments:[...i.page.segments,...e.segments]}}}))}).catch(e=>{g(t=>({...t,[r]:{...i,loadingMore:!1,message:e instanceof Error?e.message:`無法讀取更多逐字稿。`}}))}))}let E=x?Math.floor(x.offset/x.limit)+1:1,D=x?Math.max(1,Math.ceil(x.total/x.limit)):1;return(0,U.jsxs)(`section`,{className:`transcript-results`,"aria-labelledby":`transcript-results-title`,children:[(0,U.jsxs)(`div`,{className:`transcript-results-heading`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{id:`transcript-results-title`,children:`挑重要素材,補充剪輯線索`}),(0,U.jsx)(`p`,{children:`只處理想放進成片、或 AI 容易誤解的片段,其餘交給 AI 判斷。`})]}),x&&(0,U.jsxs)(`span`,{children:[`共 `,x.total.toLocaleString(),` 支素材`]})]}),x&&(0,U.jsxs)(`div`,{className:`review-filters`,"aria-label":`篩選素材`,children:[(0,U.jsxs)(`label`,{children:[(0,U.jsx)(`span`,{children:`旅行日`}),(0,U.jsxs)(`select`,{value:o??``,onChange:e=>{a(0),s(e.target.value?Number(e.target.value):null)},children:[(0,U.jsx)(`option`,{value:``,children:`全部日期`}),(x.filters?.trip_days??[]).map(e=>(0,U.jsxs)(`option`,{value:e.day,children:[`第 `,e.day,` 天(`,e.count,`)`]},e.day))]})]}),(0,U.jsxs)(`label`,{children:[(0,U.jsx)(`span`,{children:`處理狀態`}),(0,U.jsxs)(`select`,{value:c,onChange:e=>{a(0),u(e.target.value)},children:[(0,U.jsx)(`option`,{value:`all`,children:`全部狀態`}),(0,U.jsx)(`option`,{value:`pending`,children:`尚未處理`}),(0,U.jsx)(`option`,{value:`reviewed`,children:`已處理`})]})]}),(o!==null||c!==`all`)&&(0,U.jsxs)(`span`,{children:[`符合條件:`,x.total.toLocaleString(),` 支`]})]}),S&&(0,U.jsx)(`p`,{className:`transcript-list-state`,role:`status`,children:`正在讀取分析結果…`}),C&&(0,U.jsx)(`p`,{className:`transcript-list-state has-error`,role:`alert`,children:C}),x&&!S&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`transcript-list`,children:[x.items.length===0&&(0,U.jsx)(`p`,{className:`transcript-list-state`,children:`這次分析沒有可顯示的項目。`}),x.items.map(n=>{let r=Ke(n),i=h[r],a=_[r],o=[`transcribed`,`needs_review`].includes(n.status),s=n.user_state??`pending`,c=n.source&&n.preview_start_pts?qe(n.preview_start_pts,n.source.time_base):null,l=c===`0:00.000`?null:c,u=[n.role===`reference`?`參考作品`:null,n.stream_index>1?`音軌 ${n.stream_index}`:null].filter(Boolean).join(` · `);return(0,U.jsxs)(`details`,{className:`transcript-item status-${n.status} user-${s}`,onToggle:e=>w(n,e.currentTarget.open),children:[(0,U.jsxs)(`summary`,{children:[(0,U.jsxs)(`div`,{className:`transcript-item-main`,children:[(0,U.jsx)(`strong`,{children:n.display_name}),u&&(0,U.jsx)(`span`,{children:u}),a?.state===`ready`&&a.annotation&&(0,U.jsxs)(`div`,{className:`annotation-summary`,children:[a.annotation.material.usage!==`normal`&&(0,U.jsx)(`span`,{children:We[a.annotation.material.usage]}),a.annotation.material.trip_day&&(0,U.jsxs)(`span`,{children:[`第 `,a.annotation.material.trip_day,` 天`]}),a.annotation.material.location&&(0,U.jsx)(`span`,{children:a.annotation.material.location}),a.annotation.material.people.map(e=>(0,U.jsx)(`span`,{children:e},e)),a.annotation.transcript?.discarded&&(0,U.jsx)(`span`,{children:`逐字稿已移除`}),a.annotation.transcript?.confirmed&&(0,U.jsx)(`span`,{children:`逐字稿已核對`})]}),n.preview_text&&(0,U.jsxs)(`p`,{children:[n.preview_text,n.preview_truncated?`…`:``]})]}),(0,U.jsxs)(`div`,{className:`transcript-item-meta`,children:[l&&(0,U.jsxs)(`span`,{children:[l,` 起`]}),n.trip_day&&(0,U.jsxs)(`span`,{className:`trip-day-badge`,children:[`第 `,n.trip_day,` 天`]}),n.transcript_discarded&&(0,U.jsx)(`span`,{className:`user-state state-discarded`,children:`逐字稿已移除`}),s!==`pending`&&(0,U.jsx)(`span`,{className:`user-state state-${s}`,children:Ge[s]}),(0,U.jsx)(`span`,{className:`transcript-status`,children:He[n.status]})]})]}),(0,U.jsxs)(`div`,{className:`transcript-item-body`,children:[n.status===`failed`&&(0,U.jsx)(`p`,{className:`transcript-issue`,children:n.issue_code?Ue[n.issue_code]??`這個項目沒有產生可靠逐字稿,可以重新分析後再確認。`:`這個項目沒有產生可靠逐字稿。`}),n.status===`no_speech`&&(0,U.jsx)(`p`,{children:`這段有音軌,但本機辨識沒有找到可轉錄的人聲。`}),n.status===`no_audio`&&(0,U.jsx)(`p`,{children:`這個素材沒有可供語音辨識的音軌。`}),n.status===`needs_review`&&(0,U.jsx)(`p`,{className:`transcript-issue`,children:n.issue_code?Ue[n.issue_code]??Ue.transcript_low_confidence:Ue.transcript_low_confidence}),o&&i?.state===`loading`&&(0,U.jsx)(`p`,{role:`status`,children:`正在載入逐字稿…`}),o&&i?.state===`failed`&&(0,U.jsx)(`p`,{role:`alert`,className:`transcript-issue`,children:i.message}),a?.state===`loading`&&(0,U.jsx)(`p`,{role:`status`,children:`正在載入素材資訊…`}),a?.state===`failed`&&(0,U.jsx)(`p`,{role:`alert`,className:`transcript-issue`,children:a.message}),a?.state===`ready`&&a.annotation&&(!o||i?.state===`ready`)&&(0,U.jsx)(Ve,{csrf:e,projectId:t,initial:a.annotation,transcript:i?.page,mediaKind:n.kind,formatTime:e=>qe(e,i?.page?.time_base??{num:1,den:1}),onSaved:e=>{v(t=>({...t,[r]:{state:`ready`,annotation:e}})),f(e=>e+1)}},`${a.annotation.material.revision}:${a.annotation.transcript?.revision??0}`),o&&i?.state===`ready`&&i.page?.next_offset!==null&&(0,U.jsx)(`button`,{className:`button secondary load-transcript`,onClick:()=>T(n),disabled:i.loadingMore,children:i.loadingMore?`正在載入…`:`載入更多逐字稿`}),i?.message&&(0,U.jsx)(`p`,{role:`alert`,className:`transcript-issue`,children:i.message})]})]},r)})]}),(0,U.jsxs)(`nav`,{className:`transcript-pagination`,"aria-label":`逐字稿結果分頁`,children:[(0,U.jsx)(`button`,{className:`button secondary`,disabled:x.offset===0||S,onClick:()=>a(Math.max(0,x.offset-x.limit)),children:`上一頁`}),(0,U.jsxs)(`span`,{children:[`第 `,E,` / `,D,` 頁`]}),(0,U.jsx)(`button`,{className:`button secondary`,disabled:x.next_offset===null||S,onClick:()=>x.next_offset!==null&&a(x.next_offset),children:`下一頁`})]})]})]})}function Ye(){let[e,t]=(0,l.useState)(null);return(0,l.useEffect)(()=>{let e=!1,n=()=>void b().then(n=>{e||t(n)}).catch(()=>{});n();let r=window.setInterval(n,6e4);return window.addEventListener(`focus`,n),()=>{e=!0,window.clearInterval(r),window.removeEventListener(`focus`,n)}},[]),e?.on_battery?(0,U.jsxs)(`p`,{className:`power-notice`,role:`note`,children:[(0,U.jsxs)(`strong`,{children:[`Mac 目前使用電池`,e.percent===null?``:`(${e.percent}%)`,`。`]}),`製作期間闔上螢幕會讓 Mac 睡著,製作也會跟著暫停;建議先接上電源,或保持螢幕打開。`]}):null}var Xe={provider_protocol_error:{title:`AI 未正常完成製作流程`,reason:`AI 的回傳結果未能完成 Clipen 的交付流程。`,next:`先確認保留的製作結果,再決定是否重新製作。`},delivery_blocked:{title:`影片還沒通過交付檢查`,reason:`AI 做出了草稿,但下方列出的項目還沒通過 Clipen 的檢查,所以不算完成。`,next:`草稿已保留,可以先看影片。到「審片修改」說明要怎麼處理尚待完成的項目,例如快剪段落改用配樂、對話段落保留完整句子。`},provider_stopped_early:{title:`AI 先停下來了`,reason:`AI 在完成前結束了這次工作,通常是需要你提供檔案、做決定,或遇到做不到的要求。`,next:`先看下方 AI 的說明。照說明處理後,到「審片修改」再送出一次修改;如果只是中途停下,也可以按「繼續這份草稿」。`},provider_usage_limit:{title:`{provider} 額度暫時不足`,reason:`這次 AI 工作因用量限制而停止。`,next:`草稿已保留。待 {provider} 額度恢復後按「繼續這份草稿」接續製作;額度還沒恢復時會再次停止,草稿不受影響。`},provider_authentication_required:{title:`{provider} 需要重新登入`,reason:`{provider} 的登入在製作途中過期了,這次工作因此停下。`,next:`在終端機執行 {login} 完成登入,再按「繼續這份草稿」接著做;不用重新啟動 Clipen,草稿不受影響。`},provider_network_error:{title:`與 AI 的連線中斷`,reason:`這次工作未能維持與 {provider} 的網路連線。`,next:`確認網路恢復,再重新製作。`},provider_timed_out:{title:`AI 工作逾時`,reason:`這次工作超過執行時間限制,尚未完成交付。`,next:`草稿已保留,按「繼續這份草稿」接續製作。`},tool_budget_exhausted:{title:`這次製作尚未完成`,reason:`AI 已達這次工作允許的操作上限,並非影片已經完成。`,next:`先查看保留的結果,試著縮小製作範圍後重新製作。`},preview_budget_exhausted:{title:`這次影片尚未完成`,reason:`AI 已達這次工作允許的預覽輸出上限。`,next:`先查看目前預覽,再以明確的修改需求建立新工作。`},provider_permission_error:{title:`AI 無法執行需要的操作`,reason:`{provider} 回報權限問題。`,next:`查看詳細資訊與 {provider} 的權限設定,處理後再重新製作。`},provider_unavailable:{title:`目前無法使用 {provider}`,reason:`Clipen 無法使用 AI 執行環境。`,next:`確認 {provider} 可以啟動,重啟 Clipen 後再試。`},provider_launch_failed:{title:`AI 工作未能啟動`,reason:`Clipen 啟動 AI 執行程序時失敗。`,next:`確認 {provider} 可以啟動,重啟 Clipen 後再試。`},provider_mismatch:{title:`這份工作屬於另一個 AI`,reason:`這個工作是用其他 AI 建立的,Clipen 不會改用目前的 AI 接續。`,next:`用建立它的 AI 重新啟動 Clipen 再繼續,或建立新的製作工作。`},controller_stopped:{title:`Clipen 關閉時中斷了製作`,reason:`上次關閉 Clipen 時,這個工作尚未完成。`,next:`先檢查已保留的草稿;重新製作會建立另一個工作。`},controller_restarted:{title:`上次製作尚未完成`,reason:`Clipen 重新啟動時發現未結束的工作。`,next:`先檢查已保留的草稿;重新製作會建立另一個工作。`},root_unavailable:{title:`讀不到素材磁碟`,reason:`製作需要的來源資料夾目前無法存取。`,next:`重新連接磁碟,回到素材頁確認位置並完成檢查。`},root_changed:{title:`素材位置已改變`,reason:`原先授權的資料夾已改變。`,next:`回到素材頁重新選擇資料夾並完成檢查。`},ffmpeg_unavailable:{title:`找不到影片處理工具`,reason:`本機無法啟動 FFmpeg。`,next:`確認 FFmpeg 已安裝並可使用,再重新製作。`}};function Ze(e,t=`Codex`){let n=Xe[e??``]??{title:`這次製作尚未完成`,reason:`目前資料不足以確認中斷原因。`,next:`可以先查看保留的結果,或稍後重新製作。`},r=t===`Claude`?`claude auth login`:`codex login`,i=e=>e.replaceAll(`{provider}`,t).replaceAll(`{login}`,r);return{title:i(n.title),reason:i(n.reason),next:i(n.next)}}var Qe={subtitle_coverage_incomplete:`部分對話仍缺字幕,還需要補齊。`,subtitle_source_range_unresolved:`部分對話的辨識與時間尚未修好,還無法完成字幕。`,production_music_required:`尚未完成配樂:需要加入有來源與授權資料的音樂。`,production_transition_required:`尚未完成轉場:剪點之間還缺少轉場安排。`,production_editing_required:`尚未完成精剪:還需要選材、剪點與段落安排。`,program_graphics_missing:`尚未完成畫面設計:目前還沒有節目元件。`,program_component_collision:`畫面元件互相重疊,需要調整位置或出現時間。`,component_anchor_missing:`畫面元件失去對應鏡頭,需要重新連結。`,component_anchor_out_of_bounds:`畫面元件超出對應鏡頭的時間,需要調整。`,program_component_overflow:`文字超出版面,需要縮短或調整位置。`,text_layout_collision:`字幕或文字互相遮擋,需要重新排版。`,source_speech_evidence_missing:`部分口語尚未辨識,還無法確認字幕是否完整。`,subtitle_alignment_required:`字幕時間尚未核對,或修改文字後需要重新確認對齊。`,program_subtitles_missing:`保留的口語還沒有對應字幕。`,subtitle_muted_source:`字幕對應的原音已靜音,需要確認聲音與字幕安排。`,subtitle_source_changed:`口語內容已更正,對應字幕尚未更新。`,retimed_speech_mapping_unavailable:`變速片段的口語與字幕時間尚無法可靠對應。`,mix_review_required:`預覽的混音尚未完成檢查。`,hdr_preview_unsupported:`這段 HDR 素材目前無法使用此預覽流程。`,program_component_missing_glyph:`這個字型無法顯示部分文字,需要更換文字或字型。`,text_style_missing:`文字缺少可渲染的樣式,需要修復。`,audio_out_of_bounds:`音樂或音效超出片段範圍,需要調整時間。`};function $e(e){return Qe[e]??`有一項聲畫或來源檢查尚未通過;詳細資訊保留了原始檢查內容。`}var et={understand:`理解需求`,sources:`選素材`,edit:`剪輯`,graphics:`字幕與畫面`,music:`配樂`,render:`輸出影片`,review:`檢查`},tt={understand:`理解`,sources:`選材`,edit:`剪輯`,graphics:`字幕`,music:`配樂`,render:`輸出`,review:`檢查`};function nt(e,t){let n=e?new Date(e).getTime():NaN;if(Number.isNaN(n))return null;let r=Math.max(0,Math.floor((t-n)/6e4));return r<1?`剛開始`:r<60?`已進行 ${r} 分鐘`:`已進行 ${Math.floor(r/60)} 小時 ${r%60} 分鐘`}function rt({stages:e,reached:t,active:n}){let r=Math.max(0,Math.min(t,e.length-1));return(0,U.jsx)(`ol`,{className:`production-stages`,"aria-label":`製作階段`,children:e.map((i,a)=>{let o=t>=e.length||a<r?`done`:a===r&&n?`current`:a===r?`stopped`:`pending`,s=et[i]??i;return(0,U.jsxs)(`li`,{className:`is-${o}`,"aria-current":o===`current`?`step`:void 0,"aria-label":o===`done`?`${s},已完成`:s,children:[(0,U.jsx)(`span`,{className:`production-stage-dot`,"aria-hidden":`true`}),(0,U.jsx)(`span`,{className:`production-stage-name`,"aria-hidden":`true`,children:s}),(0,U.jsx)(`span`,{className:`production-stage-short`,"aria-hidden":`true`,children:tt[i]??s})]},i)})})}function it(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleTimeString(`zh-TW`,{hour12:!1,hour:`2-digit`,minute:`2-digit`})}function at({status:e,busy:t,onResume:n,onCancel:r,onRefresh:i,onEdit:a,onView:o,onRefine:s,compact:c=!1}){let u=Ae(),[d,f]=(0,l.useState)(!1),[p,m]=(0,l.useState)(()=>Date.now()),h=e.latest_run&&[`queued`,`running`].includes(e.latest_run.state);(0,l.useEffect)(()=>{if(!h)return;let e=window.setInterval(()=>m(Date.now()),3e4);return()=>window.clearInterval(e)},[h]);let g=e.production,_=g?e.latest_run:null;if(!g||!_)return null;let v=[`queued`,`running`].includes(_.state),y=[`failed`,`interrupted`].includes(_.state),b=_.state===`failed`&&[`provider_timed_out`,`provider_usage_limit`,`provider_stopped_early`,`provider_authentication_required`].includes(_.error_code??``),x=_.state===`failed`&&_.error_code===`delivery_blocked`,S=_.state===`failed`&&[`delivery_blocked`,`provider_stopped_early`,`provider_mismatch`].includes(_.error_code??``),C=_.state===`failed`&&_.error_code===`provider_mismatch`,w=C?{title:`這支片是用 ${Me(_.provider)} 做的`,reason:`Clipen 現在用的是 ${u.name}。中斷的工作只會由原本的 AI 接續,避免花到另一個帳號的額度。`,next:`到「審片修改」送出修改,就會改由 ${u.name} 接手,從目前的版本繼續;想讓 ${Me(_.provider)} 繼續,請用 clipen ${_.provider} 重新啟動 Clipen。`}:Ze(_.error_code,u.name),T=g.progress,E=T?.activity??[],D=(!y||[`provider_stopped_early`,`delivery_blocked`].includes(_.error_code??``))&&T?.ai_message?.trim()||null,O=g.local_jobs.find(e=>e.state===`running`),ee=g.preview&&[`queued`,`running`].includes(g.preview.state),k=y?w.title:_.state===`cancelled`?`已停止製作`:_.phase===`user_edit`?`修改已儲存`:_.state===`succeeded`?`影片完成了`:_.state===`queued`?`等待開始製作`:`AI 正在製作`,A=O?O.kind===`setup`?`首次使用,正在準備語音功能。`:`正在整理對話與字幕。`:ee?`正在輸出影片。`:E.at(-1)?.label??`正在準備製作。`,j=O?.kind===`setup`&&O.total_bytes&&O.total_bytes>0?Math.max(0,Math.min(100,Math.round((O.completed_bytes??0)/O.total_bytes*100))):null,te=nt(T?.started_at,p),ne=T?.slept_seconds??0,re=Math.max(1,Math.round(ne/60)),M=re<60?`${re} 分鐘`:`${Math.floor(re/60)} 小時 ${re%60} 分鐘`,N=[...new Map((g.validation?.issues??[]).map(e=>[e.code,e])).values()],P=y&&D!==null,F=JSON.stringify({run_id:_.run_id,state:_.state,phase:_.phase,error_code:_.error_code,tool_calls:_.budget.tool_calls,max_tool_calls:_.budget.max_tool_calls,preview_error:g.preview?.error_code??null,local_jobs:g.local_jobs,validation:g.validation,recent_tools:E.filter(e=>e.tool).map(e=>({tool:e.tool,at:e.created_at}))},null,2);async function I(){try{await navigator.clipboard.writeText(F),f(!0)}catch{f(!1)}}if(c){let e=y?w.title:v&&!ee?`${k}:${A}`:k;return(0,U.jsxs)(`section`,{className:`production-status-line ${y?`has-problem`:``} ${v?`is-active`:``}`,"aria-label":`製作狀態`,children:[(0,U.jsx)(`span`,{className:`production-status-dot`,"aria-hidden":`true`}),(0,U.jsxs)(`p`,{role:`status`,"aria-live":`polite`,children:[e,v&&te?(0,U.jsx)(`small`,{children:te}):null]}),b&&(0,U.jsx)(`button`,{className:`button secondary`,type:`button`,disabled:t,onClick:n,children:`繼續這份草稿`}),v&&(0,U.jsx)(`button`,{className:`button ghost`,type:`button`,disabled:t,onClick:r,children:`停止製作`}),o&&(0,U.jsx)(`button`,{className:`button ghost`,type:`button`,onClick:o,children:`查看詳情`})]})}return(0,U.jsxs)(`section`,{className:`production-status-panel ${y?`has-problem`:``} ${v?`is-active`:``}`,"aria-labelledby":`production-status-heading`,children:[(0,U.jsxs)(`div`,{className:`production-status-heading`,role:`status`,"aria-live":`polite`,children:[(0,U.jsx)(`h3`,{id:`production-status-heading`,children:k}),v&&te&&(0,U.jsx)(`span`,{className:`production-elapsed`,children:te})]}),(v||y)&&!C&&T?.stages&&(0,U.jsx)(rt,{stages:T.stages,reached:T.reached??-1,active:v}),(0,U.jsx)(`p`,{children:y?w.next:v?A:_.state===`cancelled`?`草稿已保留,可以先看看目前的結果。`:`播放下方影片,看看是否符合你的期待。`}),v&&ee&&(0,U.jsxs)(`div`,{className:`production-job`,children:[(0,U.jsx)(`progress`,{"aria-label":`輸出影片進度`,value:g.preview?.progress??0,max:1}),(0,U.jsxs)(`span`,{children:[`輸出影片 `,Math.round((g.preview?.progress??0)*100),`%`,g.preview?.stage?` · ${g.preview.stage}`:``]})]}),ne>=60&&(0,U.jsxs)(`p`,{className:`production-slept`,role:`note`,children:[`這次製作期間 Mac 睡眠了約 `,M,`,製作在這段時間暫停`,y?`,這可能是沒有完成的原因`:``,`。製作時請接上電源,或不要闔上螢幕。`]}),v&&/Mac/.test(navigator.platform)&&(0,U.jsx)(`p`,{className:`production-status-note`,children:`製作期間 Mac 不會自動睡眠;只用電池時闔上螢幕仍會睡著,製作也會跟著暫停。`}),v&&j!==null&&(0,U.jsxs)(`div`,{className:`production-job`,children:[(0,U.jsx)(`progress`,{"aria-label":`準備語音功能`,value:j,max:100}),(0,U.jsxs)(`span`,{children:[`語音功能準備進度 `,j,`%`]})]}),P&&(0,U.jsxs)(`blockquote`,{className:`production-ai-message`,children:[(0,U.jsx)(`strong`,{children:`AI 的說明`}),(0,U.jsx)(`p`,{children:D})]}),x&&N.length>0&&(0,U.jsx)(`ul`,{className:`production-blockers`,children:N.map(e=>(0,U.jsx)(`li`,{children:$e(e.code)},e.code))}),(0,U.jsxs)(`div`,{className:`production-recovery-actions`,children:[y&&(g.preview?.state===`succeeded`||g.last_successful_preview?.state===`succeeded`)&&(0,U.jsx)(`a`,{className:`button secondary`,href:`#production-output`,onClick:o,children:`查看影片`}),S&&s&&(0,U.jsx)(`button`,{className:`button primary`,type:`button`,disabled:t,onClick:s,children:C?`審片後用 ${u.name} 修改`:`審片並交給 AI 修改`}),b&&(0,U.jsx)(`button`,{className:`button ${S&&s?`secondary`:`primary`}`,type:`button`,disabled:t,onClick:n,children:`繼續這份草稿`}),y&&(0,U.jsx)(`button`,{className:`button secondary`,type:`button`,disabled:t,onClick:a,children:`重新製作`}),v&&(0,U.jsx)(`button`,{className:`button ghost`,type:`button`,disabled:t,onClick:r,children:`停止製作`})]}),(0,U.jsxs)(`details`,{className:`production-more`,children:[(0,U.jsx)(`summary`,{children:`查看製作詳情`}),T?.request&&(0,U.jsxs)(`div`,{className:`production-detail`,children:[(0,U.jsx)(`strong`,{children:`你這次的要求`}),(0,U.jsx)(`p`,{children:T.request})]}),y&&(0,U.jsxs)(`div`,{className:`production-detail`,children:[(0,U.jsx)(`strong`,{children:`發生了什麼`}),(0,U.jsx)(`p`,{children:w.reason}),(0,U.jsxs)(`p`,{children:[`你的草稿都還在,沒有被刪掉。`,b?`「繼續這份草稿」會接著目前的進度做,`:``,`「重新製作」會另外做一支新影片。`]})]}),D&&!P&&(0,U.jsxs)(`div`,{className:`production-detail`,children:[(0,U.jsx)(`strong`,{children:`AI 的說明`}),(0,U.jsx)(`p`,{className:`production-ai-text`,children:D})]}),N.length>0&&!x&&(0,U.jsxs)(`div`,{className:`production-checks`,children:[(0,U.jsx)(`strong`,{children:v?`AI 還在處理的事`:`還需要處理的事`}),(0,U.jsx)(`ul`,{children:N.map(e=>(0,U.jsx)(`li`,{children:$e(e.code)},e.code))})]}),E.length>0&&(0,U.jsxs)(`div`,{className:`production-activity`,children:[(0,U.jsx)(`strong`,{children:`AI 做了哪些事`}),(0,U.jsx)(`ol`,{children:E.map(e=>(0,U.jsxs)(`li`,{children:[(0,U.jsx)(`time`,{dateTime:e.created_at,children:it(e.created_at)}),(0,U.jsx)(`span`,{children:e.label})]},e.sequence))}),(0,U.jsx)(`p`,{children:`這是製作過程的步驟,實際結果請以影片為準。`})]}),(0,U.jsxs)(`div`,{className:`production-detail-footer`,children:[(0,U.jsx)(`button`,{className:`button ghost`,type:`button`,onClick:i,children:`重新整理`}),(0,U.jsxs)(`details`,{className:`production-diagnostics`,children:[(0,U.jsx)(`summary`,{children:`回報問題用的技術資料`}),(0,U.jsx)(`p`,{children:`一般不需要看這裡。向我們回報問題時,可以複製這段資料一起附上,裡面不含你的影片或聲音檔案。`}),(0,U.jsx)(`button`,{className:`button ghost`,type:`button`,onClick:()=>void I(),children:d?`已複製`:`複製技術資料`}),(0,U.jsx)(`pre`,{children:F})]})]})]})]})}function ot(e,t){let n=new Map;for(let t of e){let e=t.duplicate_group||t.asset_id,r=n.get(e)??[];r.push(t),n.set(e,r)}let r=[...n.values()].map(e=>({asset:e.find(e=>e.asset_id===t)??e[0],copies:e.length})),i=new Map;return r.map(({asset:e,copies:t})=>{let n=`${e.name}(${Math.round(e.duration_seconds)} 秒)`,r=(i.get(n)??0)+1;return i.set(n,r),{asset:e,copies:t,label:`${n}${r>1?` · 版本 ${r}`:``}`}})}function st({projectId:e,csrf:t,value:n,onChange:r,disabled:i,defaultLabel:a=`讓 AI 尋找配樂`}){let o=(0,l.useId)(),[s,c]=(0,l.useState)([]),[u,d]=(0,l.useState)(!1),[f,p]=(0,l.useState)(``),[m,h]=(0,l.useState)(``),g=ot(s,n),_=g.filter(({asset:e})=>e.asset_id===n||e.name.toLocaleLowerCase().includes(m.trim().toLocaleLowerCase()));(0,l.useEffect)(()=>{let t=!1;return ye(e).then(e=>{t||c(e)}).catch(e=>{t||p(String(e))}),()=>{t=!0}},[e,n]);async function v(n){if(!(!n||i)){if(n.size>134217728){p(`音樂檔上限為 128 MB。`);return}d(!0),p(``);try{let i=await V(t,e,n);c(e=>[...e.filter(e=>e.asset_id!==i.asset_id),i]),r(i.asset_id)}catch(e){p(e instanceof Error?e.message:`音樂上傳失敗。`)}finally{d(!1)}}}return(0,U.jsxs)(`fieldset`,{className:`production-music-picker`,disabled:i||u,children:[(0,U.jsx)(`legend`,{children:`配樂`}),g.length>5&&(0,U.jsxs)(`label`,{children:[`搜尋配樂`,(0,U.jsx)(`input`,{type:`search`,"aria-label":`搜尋配樂`,value:m,onChange:e=>h(e.target.value),placeholder:`輸入曲名`})]}),(0,U.jsx)(`label`,{htmlFor:`${o}-choice`,children:`使用哪首音樂?`}),(0,U.jsxs)(`select`,{id:`${o}-choice`,value:n,onChange:e=>r(e.target.value),children:[(0,U.jsx)(`option`,{value:``,children:a}),_.map(({asset:e,label:t})=>(0,U.jsx)(`option`,{value:e.asset_id,children:t},e.asset_id))]}),s.length>g.length&&(0,U.jsx)(`p`,{children:`相同音源與授權的重複項目已合併顯示。`}),m.trim()&&!_.some(({asset:e})=>e.name.toLocaleLowerCase().includes(m.trim().toLocaleLowerCase()))&&(0,U.jsx)(`p`,{role:`status`,children:`沒有符合的曲目;目前選用的配樂仍保留。`}),(0,U.jsx)(`label`,{htmlFor:`${o}-file`,children:`或選擇自己的音樂檔`}),(0,U.jsx)(`input`,{id:`${o}-file`,type:`file`,accept:`.mp3,.wav,.m4a,.aac,.flac,.ogg,.aiff,.aif`,onChange:e=>{v(e.target.files?.[0]),e.target.value=``}}),(0,U.jsx)(`p`,{children:u?`正在匯入與檢查音樂…`:`檔案會保存在這個作品的本機資料內。指定後,AI 會使用這首歌安排剪輯與混音。`}),f&&(0,U.jsx)(`p`,{role:`alert`,className:`inline-message error`,children:f})]})}function ct(e){if(!e)return null;try{let t=JSON.parse(e),n=t?.form;return typeof t?.revisionId!=`string`||!n||!Number.isFinite(n.at)||n.at<0||![`change`,`remove`,`keep`,`highlight`,`location`,`audio`,`note`].includes(n.kind)||![`referenceId`,`end`,`target`,`note`,`layer`].every(e=>typeof n[e]==`string`)||n.note.length>2e3||!Number.isFinite(n.gain)||n.gain<-60||n.gain>0||typeof n.fill!=`boolean`?null:t}catch{return null}}function lt(e){return e.split(/(?:^|\n)審片注記(時間是目前這一版影片的位置):(?:\r?\n|$)/,1)[0].trim()}function ut(e,t,n){return t.some(t=>t.trim()===e.trim())?n:e}function dt(e,t,n=``,r=``){let i=`clipen:prompt-draft:${e}:${t}`,a=`clipen:prompt-draft:v2:${e}:${t}:${r}`,o=(0,l.useRef)(0),[s,c]=(0,l.useState)(()=>{try{return localStorage.getItem(a)??n}catch{return n}});function u(e){o.current+=1,c(e);try{localStorage.setItem(a,e)}catch{}}return(0,l.useEffect)(()=>{let r=!1,s=o.current;try{if(localStorage.getItem(a)!==null)return}catch{}let l=null;try{l=localStorage.getItem(i)}catch{return}if(l===null)return;async function u(){let u=[],d=0;for(;;){let n=await be(e,d);if(r||s!==o.current)return;if(u.push(...n.prompts.filter(e=>e.kind===t&&e.source===`submitted`).map(e=>e.text)),d+=n.prompts.length,d>=n.total)break;if(!n.prompts.length)return}let f=ut(l,u,n);c(e=>{if(e!==n)return e;try{localStorage.setItem(a,f),localStorage.removeItem(i)}catch{}return f})}return u().catch(()=>{}),()=>{r=!0}},[e,t,a,i,n]),[s,u]}var ft=[[`change`,`要修改`],[`remove`,`拿掉`],[`keep`,`這樣可以`],[`highlight`,`加強爆點`],[`location`,`地點補充`],[`audio`,`聲音`],[`note`,`其他`]],pt=Object.fromEntries(ft),mt=[`remove`,`keep`],ht={change:`例如:這段字幕改成「第一次吃到」,晚一秒出現。`,remove:`可以不填;或補充原因,例如:直式畫面,和前後接不起來。`,keep:`可以不填;例如:這段文字和時間都很好。`,highlight:`例如:第一口之後的反應是笑點,請留鋪陳再強調。`,location:`例如:這裡是銀座的某某店,不是淺草。`,audio:`例如:風聲太大,壓低原音,讓配樂接上;保留說話內容。`,note:`補充只有你知道的拍攝背景或想法。`};function gt(e,t=!1){let n=Math.floor(e/60),r=e-n*60;return`${n}:${t?r.toFixed(1).padStart(4,`0`):String(Math.floor(r)).padStart(2,`0`)}`}function _t(e,t=new Date){let n=new Date(e);if(Number.isNaN(n.getTime()))return``;let r=n.toLocaleTimeString(`zh-TW`,{hour:`2-digit`,minute:`2-digit`,hour12:!1}),i=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime(),a=Math.round((i(t)-i(n))/864e5);return a===0?`今天 ${r}`:a===1?`昨天 ${r}`:`${n.getMonth()+1}/${n.getDate()} ${r}`}function vt(e){return e>=1e8?`${(e/1e8).toFixed(e>=1e9?0:1)} 億`:e>=1e4?`${(e/1e4).toFixed(e>=1e6?0:1)} 萬`:e.toLocaleString(`en-US`)}function yt(e){return{short:`輸入 ${vt(e.input_tokens)} · 輸出 ${vt(e.output_tokens)} tokens`,detail:`輸入 ${vt(e.input_tokens)}(其中 ${vt(e.cached_input_tokens)} 來自快取)· 輸出 ${vt(e.output_tokens)} · 合計 ${vt(e.input_tokens+e.output_tokens)}`}}function bt(e){if(e.kind===`restore`)return e.restored_from?`回到${_t(e.restored_from)} 的樣子`:`回到較早的樣子`;if(e.kind===`manual`)return e.changes||`手動修改`;let t=e.detail?.split(`
|
|
12
|
-
`).map(e=>e.trim()).filter(Boolean)??[],n=t.find(e=>!e.startsWith(`請依下面的審片注記`)&&!e.startsWith(`審片注記`)&&!/^\d+\.\s/.test(e)),r=t.filter(e=>/^\d+\.\s/.test(e)).length,i=(e.label??`AI`).replace(/完成$/,``);return n?`${i}:「${n.length>36?`${n.slice(0,36)}…`:n}」`:r?`${i}:依 ${r} 筆審片注記修改`:e.label}function xt(e){let t=e.trim().split(`:`);return!t.length||t.length>2||t.some(e=>!/^\d+(\.\d+)?$/.test(e))?NaN:t.length===2?Number(t[0])*60+Number(t[1]):Number(t[0])}function St(e){return e.tracks.filter(e=>e.kind===`video`).flatMap(e=>e.items)}function Ct(e){return e===`agent-subtitles`?`字幕`:e?.startsWith(`program-components`)?`元件`:`文字`}function wt(e,t){let n=St(e),r=n.findIndex(e=>e.start_frame<=t&&t<e.start_frame+e.duration_frames),i=r<0?[]:[{id:n[r].item_id,label:`鏡頭 ${r+1}(畫面)`,start:n[r].start_frame,end:n[r].start_frame+n[r].duration_frames}];for(let n of e.tracks)if(n.kind!==`video`&&n.kind!==`audio`)for(let e of n.items){if(!e.text||e.start_frame>t||t>=e.start_frame+e.duration_frames)continue;let r=e.text.replace(/\s+/g,` `);i.push({id:e.item_id,label:`${Ct(n.track_id)}「${r.length>24?`${r.slice(0,24)}…`:r}」`,start:e.start_frame,end:e.start_frame+e.duration_frames,text:!0})}return i}function Tt(e,t){let n=t.frame_rate.num/t.frame_rate.den,r=e.current_range,i=St(t).findIndex(e=>e.item_id===r?.item_id),a=r?(r.at_frame??r.start_frame)/n:null,o=a===null?`位置已變動`:e.explicit_range&&r?`${gt(a)}–${gt((r.start_frame+r.duration_frames)/n)}`:gt(a),s=e.element_id&&e.element_text?`${Ct(e.element_track)}「${e.element_text.replace(/\s+/g,` `)}」`:i>=0?`鏡頭 ${i+1}`:`這個畫面`;return{at:a,time:o,target:s,line:`${o} ${pt[e.kind]}:${s}。${e.note}${e.kind===`audio`&&e.source_gain_db!==void 0?`(原音 ${e.source_gain_db} dB${e.fill_music?`,配樂補滿`:``})`:``}`}}function Et(e,t,n){let r=[...t].map(e=>Tt(e,n)).sort((e,t)=>(e.at??1/0)-(t.at??1/0)).map((e,t)=>`${t+1}. ${e.line}`),i=lt(e)||(r.length?`請依下面的審片注記修改目前影片,其他部分保留。`:``);return r.length?`${i}\n\n審片注記(時間是目前這一版影片的位置):\n${r.join(`
|
|
13
|
-
`)}`:i}var Dt=[0,.95],Ot=[0,.95],kt=[-.95,.95],At=e=>e.custom?{x:kt,y:kt}:{x:Dt,y:Ot},jt=(e,[t,n])=>Math.round(Math.min(n,Math.max(t,e))*1e3)/1e3,Mt=e=>e.tracks.filter(e=>e.track_id===`program-components`||e.track_id.startsWith(`program-components-`));function Nt(e,t=e.at){return e.shots.find(e=>e.start<=t&&t<e.end)??e.shots[e.shots.length-1]}function Pt(e,t,n){let r=Math.max(6,Math.min(e.total,Math.round(n)));return{at:Math.max(0,Math.min(e.total-r,Math.round(t))),duration:r}}function Ft(e,t,n){let r=t?.components[n],i=e.tracks.flatMap(e=>e.items).find(e=>e.item_id===n);if(!r||!i)return null;let[a=``,...o]=(i.text??``).split(`
|
|
14
|
-
`),s=(e=[],t={})=>Object.fromEntries(e.map(e=>[e.key,t[e.key]??e.value])),c={words:s(r.fields?.texts,r.edits?.texts),paints:s(r.fields?.colors,r.edits?.colors),text:a,detail:o.join(` `),x:r.x??0,y:r.y??0,scale:r.scale??1,colors:r.colors??{},visual:r.visual_style_id,font:r.font_style_id,look:r.look_id??``,at:i.start_frame,duration:i.duration_frames,lane:Math.max(0,Mt(e).findIndex(e=>e.items.some(e=>e.item_id===n)))},l=St(e).map(e=>({id:e.item_id,start:e.start_frame,end:e.start_frame+e.duration_frames}));return{id:n,custom:!!r.custom,...c,saved:c,shots:l,total:e.duration_frames}}function It(e){let t=Nt(e),n={item_id:t.id,start_offset_frames:e.at-t.start,duration_frames:e.duration,...e.lane===e.saved.lane?{}:{lane:e.lane}};return e.custom?{element_id:e.id,texts:e.words,colors:e.paints,x:e.x,y:e.y,...n,...e.look&&e.look!==e.saved.look?{look_id:e.look}:{}}:{element_id:e.id,text:e.text.trim(),detail:e.detail.trim(),x:e.x,y:e.y,scale:e.scale,colors:e.colors,visual_style_id:e.visual,font_style_id:e.font,...n}}function Lt(e){let{saved:t}=e;return e.text.trim()!==t.text||e.detail.trim()!==t.detail||e.x!==t.x||e.y!==t.y||e.scale!==t.scale||JSON.stringify(e.colors)!==JSON.stringify(t.colors)||e.visual!==t.visual||e.font!==t.font||e.at!==t.at||e.duration!==t.duration||e.lane!==t.lane||e.look!==t.look||JSON.stringify(e.words)!==JSON.stringify(t.words)||JSON.stringify(e.paints)!==JSON.stringify(t.paints)}var Rt=[[`accent`,`主色`],[`paper`,`亮色`],[`ink`,`暗色`]];function zt({label:e,value:t,format:n,parse:r,onCommit:i,disabled:a,suffix:o}){let[s,c]=(0,l.useState)(null),u=()=>{if(s===null)return;let e=r(s);Number.isFinite(e)&&i(e),c(null)};return(0,U.jsxs)(`label`,{children:[e,(0,U.jsxs)(`span`,{className:`rv-field`,children:[(0,U.jsx)(`input`,{value:s??n(t),disabled:a,inputMode:`decimal`,onChange:e=>c(e.target.value),onBlur:u,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),u()),e.key===`Escape`&&c(null)}}),o&&(0,U.jsx)(`em`,{children:o})]})]})}function Bt({edit:e,settings:t,editing:n,fps:r,busy:i,disabled:a,locked:o,onChange:s,onSave:c,onCancel:l,onRemove:u}){let d=Lt(e),f=!!e.text.trim()&&(!e.custom||Object.values(e.words).every(e=>e.trim())),p=t=>s({...e,...t}),m=e=>{e.key===`Enter`&&d&&f&&c()},h=e.x!==e.saved.x||e.y!==e.saved.y,g={words:Object.fromEntries((t.fields?.texts??[]).map(e=>[e.key,e.value])),paints:Object.fromEntries((t.fields?.colors??[]).map(e=>[e.key,e.value]))},_=e.custom&&(JSON.stringify(e.words)!==JSON.stringify(g.words)||JSON.stringify(e.paints)!==JSON.stringify(g.paints)),v=n.visual_styles.find(t=>t.id===e.visual)?.colors??{accent:`#e9b44c`,paper:`#ffffff`,ink:`#111111`};return(0,U.jsxs)(`div`,{className:`rv-inspector`,children:[(0,U.jsxs)(`div`,{className:`rv-panel-head`,children:[(0,U.jsx)(`h4`,{children:t.name}),(0,U.jsx)(`span`,{className:`rv-time`,children:gt(e.at/r)}),(0,U.jsx)(`button`,{type:`button`,className:`rv-icon`,"aria-label":`關閉`,onClick:l,children:`×`})]}),o&&(0,U.jsxs)(`p`,{className:`rv-locked`,role:`status`,children:[(0,U.jsx)(`span`,{className:`rv-spinner`,"aria-hidden":`true`}),o]}),e.custom?(0,U.jsxs)(U.Fragment,{children:[(t.fields?.texts??[]).map(t=>(0,U.jsxs)(`label`,{children:[t.label,(0,U.jsx)(`input`,{value:e.words[t.key]??``,maxLength:120,disabled:a||i,onChange:n=>p({words:{...e.words,[t.key]:n.target.value}}),onKeyDown:m})]},t.key)),(t.fields?.colors.length??0)>0&&(0,U.jsx)(`div`,{className:`rv-colors`,role:`group`,"aria-label":`顏色`,children:t.fields?.colors.map(t=>(0,U.jsxs)(`label`,{className:`rv-swatch`,title:t.label,children:[(0,U.jsx)(`input`,{type:`color`,value:e.paints[t.key]??t.value,disabled:a||i,"aria-label":t.label,onChange:n=>p({paints:{...e.paints,[t.key]:n.target.value}})}),(0,U.jsx)(`span`,{style:{background:e.paints[t.key]??t.value}}),t.label]},t.key))}),_&&(0,U.jsx)(`button`,{type:`button`,className:`rv-link`,onClick:()=>p(g),children:`恢復 AI 的設計`}),(n.looks?.length??0)>0&&(0,U.jsxs)(`label`,{children:[`外觀`,(0,U.jsxs)(`select`,{value:e.look,disabled:a||i,onChange:e=>p({look:e.target.value}),children:[!e.saved.look&&(0,U.jsx)(`option`,{value:``,children:`(較早的元件,沒有外觀)`}),n.looks?.map(e=>(0,U.jsx)(`option`,{value:e.look_id,children:e.name},e.look_id))]})]}),(0,U.jsx)(`p`,{className:`rv-hint`,children:(t.fields?.texts.length??0)+(t.fields?.colors.length??0)>0?`這是 AI 自由設計的元件。想改版面或動畫,在下方寫給 AI 修改。`:`這是 AI 自由設計的元件,沒有標出可以直接改的文字或顏色。想改它,在下方寫給 AI 修改。`})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`label`,{children:[`主要文字`,(0,U.jsxs)(`span`,{className:`rv-counter${e.text.trim().length>t.max_characters?` is-over`:``}`,children:[e.text.trim().length,`/`,t.max_characters]}),(0,U.jsx)(`input`,{value:e.text,maxLength:48,autoFocus:!0,disabled:a||i,onChange:e=>p({text:e.target.value}),onKeyDown:m})]}),(0,U.jsxs)(`label`,{children:[`補充文字`,(0,U.jsx)(`input`,{value:e.detail,maxLength:48,placeholder:`可不填`,disabled:a||i,onChange:e=>p({detail:e.target.value}),onKeyDown:m})]}),(0,U.jsxs)(`div`,{className:`rv-pair`,children:[n.visual_styles.length>1&&(0,U.jsxs)(`label`,{children:[`樣式`,(0,U.jsx)(`select`,{value:e.visual,disabled:a||i,onChange:e=>p({visual:e.target.value}),children:n.visual_styles.map(e=>(0,U.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),n.font_styles.length>1&&(0,U.jsxs)(`label`,{children:[`字體`,(0,U.jsx)(`select`,{value:e.font,disabled:a||i,onChange:e=>p({font:e.target.value}),children:n.font_styles.map(e=>(0,U.jsx)(`option`,{value:e.id,children:e.name},e.id))})]})]}),(0,U.jsxs)(`div`,{className:`rv-look`,children:[(0,U.jsxs)(`label`,{className:`rv-scale`,children:[`大小`,(0,U.jsxs)(`span`,{className:`rv-counter`,children:[Math.round(e.scale*100),`%`]}),(0,U.jsx)(`input`,{type:`range`,min:60,max:160,step:5,value:Math.round(e.scale*100),disabled:a||i,"aria-label":`元件大小`,onChange:e=>p({scale:Number(e.target.value)/100})})]}),(0,U.jsxs)(`div`,{className:`rv-colors`,role:`group`,"aria-label":`顏色`,children:[Rt.map(([t,n])=>(0,U.jsxs)(`label`,{className:`rv-swatch`,title:n,children:[(0,U.jsx)(`input`,{type:`color`,value:e.colors[t]??v[t],disabled:a||i,"aria-label":n,onChange:n=>p({colors:{...e.colors,[t]:n.target.value}})}),(0,U.jsx)(`span`,{style:{background:e.colors[t]??v[t]}}),n]},t)),(Object.keys(e.colors).length>0||e.scale!==1)&&(0,U.jsx)(`button`,{type:`button`,className:`rv-link`,onClick:()=>p({colors:{},scale:1}),children:`恢復樣式原樣`})]})]})]}),(0,U.jsxs)(`div`,{className:`rv-pair`,children:[(0,U.jsx)(zt,{label:`出現`,value:e.at/r,format:e=>gt(e,!0),parse:xt,disabled:a||i,onCommit:t=>p(Pt(e,t*r,e.duration))}),(0,U.jsx)(zt,{label:`長度`,suffix:`秒`,value:e.duration/r,format:e=>e.toFixed(1),parse:Number,disabled:a||i,onCommit:t=>p(Pt(e,e.at,Math.min(t*r,e.total-e.at)))})]}),(0,U.jsxs)(`p`,{className:`rv-hint`,children:[`在畫面上拖曳元件就能移動,方向鍵可以微調;在下方時間線拖曳可以改出現時間或換軌,拉兩端可以改長度。 元件從 `,gt(Nt(e).start/r,!0),` 開始的鏡頭出現,重剪時會跟著這段素材走,長度可以跨過剪接點。`,h&&(0,U.jsx)(`button`,{type:`button`,className:`rv-link`,onClick:()=>p({x:e.saved.x,y:e.saved.y}),children:`回到原位`}),(e.at!==e.saved.at||e.duration!==e.saved.duration||e.lane!==e.saved.lane)&&(0,U.jsx)(`button`,{type:`button`,className:`rv-link`,onClick:()=>p({at:e.saved.at,duration:e.saved.duration,lane:e.saved.lane}),children:`恢復原本的時間`})]}),(0,U.jsxs)(`div`,{className:`rv-row`,children:[(0,U.jsx)(`button`,{type:`button`,className:`button primary`,disabled:a||i||!d||!f,onClick:c,children:i?`儲存中…`:`儲存`}),(0,U.jsx)(`button`,{type:`button`,className:`button ghost`,onClick:l,children:`取消`}),(0,U.jsx)(`button`,{type:`button`,className:`rv-text-button is-danger`,disabled:a||i,onClick:u,children:`刪除元件`})]})]})}function Vt({projectId:e,csrf:t,runId:n,revisionId:r,timeline:i,frame:a,component:o,onMove:s,limits:c={x:Dt,y:Ot}}){let u=i.frame_rate.num/i.frame_rate.den,d=o?JSON.stringify(o):``,f=`${r}:${a}:${d}`,[p,m]=(0,l.useState)({key:``,image:``,error:``,box:null,at:null}),h=(0,l.useRef)(null),g=(0,l.useRef)(null);(0,l.useEffect)(()=>{let i=new AbortController,o=window.setTimeout(()=>{let o=d?JSON.parse(d):void 0;H(t,e,n,r,a,i.signal,o).then(e=>{i.signal.aborted||m({key:f,image:e.image_data_url,error:``,box:e.component_box??null,at:o?{x:o.x??0,y:o.y??0}:null})}).catch(e=>{i.signal.aborted||m(t=>({...t,key:f,error:e instanceof Error?e.message:`暫時無法讀取畫面。`}))})},300);return()=>{window.clearTimeout(o),i.abort()}},[t,e,n,r,a,d,f]);let{image:_,error:v,box:y,at:b}=p,x=y&&b&&o&&s?{left:y.x+(o.x??b.x)-b.x,top:y.y+(o.y??b.y)-b.y}:null;function S(e){!o||!s||(e.currentTarget.setPointerCapture(e.pointerId),g.current={x:o.x??0,y:o.y??0,clientX:e.clientX,clientY:e.clientY})}function C(e){let t=g.current,n=h.current?.getBoundingClientRect();!t||!n||!s||s(jt(t.x+(e.clientX-t.clientX)/n.width,c.x),jt(t.y+(e.clientY-t.clientY)/n.height,c.y))}function w(e){if(!o||!s)return;let t=e.shiftKey?.02:.005,n={ArrowLeft:[-t,0],ArrowRight:[t,0],ArrowUp:[0,-t],ArrowDown:[0,t]}[e.key];n&&(e.preventDefault(),e.stopPropagation(),s(jt((o.x??0)+n[0],c.x),jt((o.y??0)+n[1],c.y)))}let T=i.canvas.width/i.canvas.height;return(0,U.jsxs)(`div`,{className:`rv-still${p.key!==f&&_?` is-loading`:``}`,ref:h,style:{aspectRatio:`${i.canvas.width}/${i.canvas.height}`,width:`min(100%, calc(max(220px, 100vh - 480px) * ${T}))`},children:[_?(0,U.jsx)(`img`,{src:_,alt:`${gt(a/u)} 的畫面`,draggable:!1}):(0,U.jsx)(`span`,{className:`rv-still-wait`,children:`正在取得畫面…`}),x&&y&&(0,U.jsx)(`div`,{className:`rv-grab`,role:`slider`,tabIndex:0,"aria-label":`元件位置,拖曳或用方向鍵移動`,"aria-valuetext":`水平 ${Math.round((o?.x??0)*100)}%,垂直 ${Math.round((o?.y??0)*100)}%`,style:{left:`${x.left*100}%`,top:`${x.top*100}%`,width:`${y.width*100}%`,height:`${y.height*100}%`},onPointerDown:S,onPointerMove:C,onPointerUp:()=>{g.current=null},onPointerCancel:()=>{g.current=null},onKeyDown:w}),v&&(0,U.jsx)(`p`,{className:`rv-still-error`,role:`alert`,children:v})]})}var Ht=72,Ut=7,Wt=8,Gt=[`#8e5a9e`,`#3f7fa8`,`#b0683a`,`#4f8a5b`,`#a64d63`,`#7a6f2e`,`#5a62b0`,`#2e8a86`],Kt=(e,t)=>e.start<t.end&&t.start<e.end,qt=[1,2,5,10,15,30,60,120,300];function Jt(e,t){let[n,r]=(0,l.useState)({}),i=t.join(`,`);return(0,l.useEffect)(()=>{if(!e||!t.length)return;let n=!1,i=document.createElement(`video`);i.muted=!0,i.preload=`auto`,i.crossOrigin=`anonymous`,i.src=e;let a=document.createElement(`canvas`);a.width=112,a.height=63;let o=a.getContext(`2d`),s=0,c={};function l(){n||s>=t.length||(i.currentTime=Math.min(t[s],Math.max(0,(i.duration||t[s])-.05)))}return i.addEventListener(`loadeddata`,l),i.addEventListener(`seeked`,()=>{if(!(n||!o)){try{o.drawImage(i,0,0,a.width,a.height),c[s]=a.toDataURL(`image/jpeg`,.7)}catch{}s+=1,(s%8==0||s>=t.length)&&r({...c}),l()}}),()=>{n=!0,i.removeAttribute(`src`),i.load()}},[e,i]),n}function Yt({timeline:e,now:t,notes:n,video:r,onSeek:i,selected:a=null,onSelect:o,draft:s=null,onPlace:c,looks:u={},unreviewed:d=[]}){let f=new Set(d),p=e.frame_rate.num/e.frame_rate.den,m=Math.max(1,e.duration_frames),h=m/p,g=(0,l.useRef)(null),[_,v]=(0,l.useState)(800),[y,b]=(0,l.useState)(0),x=(0,l.useRef)(!1),S=(0,l.useRef)(null),[C,w]=(0,l.useState)(!1);(0,l.useEffect)(()=>{let e=g.current;if(!e)return;let t=new ResizeObserver(()=>v(e.clientWidth-Ht));return t.observe(e),()=>t.disconnect()},[]);let T=Math.max(200,_)/h*2**y,E=h*T,D=e=>e/p*T,O=St(e).map((e,t)=>({id:e.item_id,start:e.start_frame,end:e.start_frame+e.duration_frames,label:`鏡頭 ${t+1}`})),ee=e=>(e??``).replace(/\s+/g,` `),k=e=>u[e]?{tone:Gt[u[e].index%Gt.length],kind:u[e].name}:{},A=e.tracks.filter(e=>(e.kind===`title`||e.kind===`graphic`)&&e.track_id===`agent-subtitles`).flatMap(e=>e.items.map(e=>({id:e.item_id,start:e.start_frame,end:e.start_frame+e.duration_frames,label:ee(e.text),unchecked:f.has(e.item_id)}))),j=Mt(e).map(e=>e.items.filter(e=>e.item_id!==s?.id).map(e=>({id:e.item_id,start:e.start_frame,end:e.start_frame+e.duration_frames,label:ee(e.text),selectable:!!o,unchecked:f.has(e.item_id),...k(e.item_id)})));if(s){let t=Mt(e).flatMap(e=>e.items).find(e=>e.item_id===s.id);for(;j.length<=s.lane;)j.push([]);j[s.lane].push({id:s.id,start:s.start,end:s.end,label:ee(t?.text),selectable:!0,...k(s.id)})}C&&j.push([]);let te=(e,t)=>!(j[e]??[]).some(e=>e.id!==t.id&&Kt(e,t)),ne=St(e).flatMap(e=>(e.effects??[]).filter(e=>e.effect_id===`audio.layers`).flatMap(e=>e.parameters.layers??[]).map((t,n)=>{let r=e.start_frame+Number(t.start_frame??0);return{id:`${e.item_id}-${n}`,start:r,end:r+Number(t.duration_frames??0),label:`配樂`}})),re=A.length?3:2,M=[...j.map((e,t)=>({id:`g${t}`,name:`V${re+t}`,label:j.length>1?`元件 ${t+1}`:`元件`,spans:e,kind:`component`,lane:t})).reverse(),...A.length?[{id:`v2`,name:`V2`,label:`字幕`,spans:A,kind:`caption`}]:[],{id:`v1`,name:`V1`,label:`畫面`,spans:O,kind:`shot`},...ne.length?[{id:`a1`,name:`A1`,label:`配樂`,spans:ne,kind:`music`}]:[]],N=[...j.flat(),...A].filter(e=>e.unchecked).sort((e,t)=>e.start-t.start);function P(){let e=N.find(e=>e.start>Math.round(t*p))??N[0];e&&i(e.start/p)}let F=Jt(r,O.map(e=>(e.start+Math.min(p,(e.end-e.start)/2))/p)),I=qt.find(e=>e*T>=64)??600,ie=Array.from({length:Math.floor(h/I)+1},(e,t)=>t*I);(0,l.useEffect)(()=>{let e=g.current;if(!e||x.current)return;let n=t*T;(n<e.scrollLeft||n>e.scrollLeft+e.clientWidth-Ht-40)&&(e.scrollLeft=Math.max(0,n-80))},[t,T]);function L(e){let t=g.current;if(!t)return;let n=t.getBoundingClientRect().left+Ht-t.scrollLeft,r=Math.min(h-1/p,Math.max(0,(e.clientX-n)/T));i(Math.round(r*p)/p)}function R(e,t){let n=t.dataset.pick??``,r=j.findIndex(e=>e.some(e=>e.id===n)),i=j[r]?.find(e=>e.id===n);if(!i)return;let a=t.getBoundingClientRect(),o=e.clientX-a.left,s=!c||a.width<21?`move`:o<Ut?`left`:o>a.width-Ut?`right`:`move`;S.current={id:n,mode:s,x:e.clientX,y:e.clientY,row:t.closest(`.nle-track`)?.offsetHeight??30,from:{id:n,start:i.start,end:i.end,lane:r},moved:!1},e.currentTarget.setPointerCapture(e.pointerId)}function ae(e){let n=[0,m,Math.round(t*p),...O.flatMap(e=>[e.start,e.end])].reduce((t,n)=>Math.abs(n-e)<Math.abs(t-e)?n:t,e);return Math.abs(D(n)-D(e))<=Wt?n:e}function oe(e){let t=S.current;if(!t||!c)return;let n=e.clientX-t.x,r=e.clientY-t.y;if(!t.moved&&Math.abs(n)<4&&Math.abs(r)<4)return;t.moved||(t.moved=!0,w(!0));let i=Math.round(n/T*p),{from:a}=t,o=a.start,s=a.end,l=a.lane;if(t.mode===`left`)o=Math.max(0,Math.min(s-6,ae(a.start+i)));else if(t.mode===`right`)s=Math.min(m,Math.max(o+6,ae(a.end+i)));else{let e=a.end-a.start,n=a.start+i,c=ae(n)-n,u=ae(n+e)-n-e;o=n+(c&&(!u||Math.abs(c)<=Math.abs(u))?c:u),o=Math.max(0,Math.min(m-e,o)),s=o+e;let d=Math.max(0,Math.min(j.length-1,a.lane-Math.round(r/t.row))),f={id:t.id,start:o,end:s,lane:d};l=te(d,f)?d:[...j.keys()].find(e=>e>=d&&te(e,f))??j.length}c(t.id,o,s-o,l)}function se(){let e=S.current;S.current=null,x.current=!1,e&&(e.moved?w(!1):o?.(e.id))}return(0,U.jsxs)(`div`,{className:`nle`,children:[(0,U.jsxs)(`div`,{className:`nle-toolbar`,children:[(0,U.jsx)(`span`,{className:`nle-clock`,children:gt(t,!0)}),(0,U.jsxs)(`span`,{className:`nle-duration`,children:[`/ `,gt(h)]}),N.length>0&&(0,U.jsxs)(`span`,{className:`nle-unseen`,title:`AI 這一版只看過部分畫面;虛線框的字幕與元件它沒有看過,建議先檢查。`,children:[(0,U.jsx)(`span`,{className:`nle-unseen-key`,"aria-hidden":`true`}),`AI 沒看過 `,N.length,` 處`,(0,U.jsx)(`button`,{type:`button`,className:`button ghost`,onClick:P,children:`跳到下一處`})]}),(0,U.jsxs)(`label`,{className:`nle-zoom`,children:[`縮放`,(0,U.jsx)(`input`,{type:`range`,min:0,max:6,step:1,value:y,onChange:e=>b(Number(e.target.value)),"aria-label":`時間軸縮放`})]}),(0,U.jsx)(`button`,{type:`button`,className:`button ghost`,onClick:()=>b(0),disabled:y===0,children:`整部片`})]}),(0,U.jsx)(`div`,{className:`nle-scroll`,ref:g,children:(0,U.jsxs)(`div`,{className:`nle-canvas`,style:{width:E+Ht},onPointerDown:e=>{if(e.target.closest(`.nle-heads, .nle-marker`))return;let t=e.target.closest(`[data-pick]`);if(t&&o){R(e,t);return}x.current=!0,e.currentTarget.setPointerCapture(e.pointerId),L(e)},onPointerMove:e=>{S.current?oe(e):x.current&&L(e)},onPointerUp:se,onPointerCancel:se,children:[(0,U.jsxs)(`div`,{className:`nle-ruler`,children:[(0,U.jsx)(`div`,{className:`nle-corner`}),(0,U.jsxs)(`div`,{className:`nle-ruler-track`,style:{width:E},children:[ie.map(e=>(0,U.jsx)(`span`,{className:`nle-tick`,style:{left:e*T},children:gt(e)},e)),n.filter(e=>e.at!==null).map(e=>(0,U.jsx)(`button`,{type:`button`,className:`nle-marker is-${e.kind}`,style:{left:(e.at??0)*T},title:`${gt(e.at??0)} ${e.label}`,"aria-label":`跳到注記 ${gt(e.at??0)}:${e.label}`,onClick:()=>i(e.at??0)},e.id))]})]}),M.map(e=>(0,U.jsxs)(`div`,{className:`nle-track is-${e.kind}`,children:[(0,U.jsxs)(`div`,{className:`nle-heads`,children:[(0,U.jsx)(`strong`,{children:e.name}),(0,U.jsx)(`span`,{children:e.label})]}),(0,U.jsx)(`div`,{className:`nle-lane${e.lane!==void 0&&C&&!e.spans.length?` is-new`:``}`,style:{width:E},children:e.spans.map((t,n)=>(0,U.jsx)(`div`,{className:`nle-clip${t.selectable?` is-pickable`:``}${t.selectable&&c?` is-movable`:``}${t.id===a?` is-selected`:``}${t.unchecked?` is-unseen`:``}`,"data-pick":t.selectable?t.id:void 0,style:{left:D(t.start),width:Math.max(2,D(t.end)-D(t.start)),...e.kind===`shot`&&F[n]?{backgroundImage:`url(${F[n]})`}:{},...t.tone?{backgroundColor:t.tone}:{}},title:`${gt(t.start/p)}–${gt(t.end/p)} ${t.kind?`[${t.kind}]`:``}${t.label}${t.unchecked?`(AI 沒看過)`:``}${t.selectable?c?`(點一下編輯,拖曳改時間或換軌,拉兩端改長度)`:`(點一下編輯)`:``}`,children:D(t.end)-D(t.start)>44&&(0,U.jsx)(`span`,{children:t.label})},t.id))})]},e.id)),(0,U.jsx)(`span`,{className:`nle-playhead`,style:{left:Ht+t*T},"aria-hidden":`true`})]})})]})}function Xt({visible:e,projectId:t,csrf:n,runId:r,data:i,video:a,disabled:o,locked:s,onChanged:c,onDirty:u,onSaveComponent:d,onRemoveComponent:f,stage:p,unreviewed:m=[]}){let h=i.revision.timeline,g=h.frame_rate.num/h.frame_rate.den,_=i.references??{version:0,items:[]},v=(0,l.useRef)(null),y=`clipen:review-note-draft:${t}:${r}`,[b,x]=(0,l.useState)(()=>{try{return ct(localStorage.getItem(y))}catch{return null}}),S=b?.revisionId===i.revision.revision_id?b.form:null,C=b&&!S?b.form:null,[w,T]=(0,l.useState)(S?.at??0),[E,D]=(0,l.useState)(null),O=i.component_editing,ee=E?O?.components[E.id]:void 0;function k(e){let t=e?{revisionId:i.revision.revision_id,form:e}:null;x(t);try{t?localStorage.setItem(y,JSON.stringify(t)):localStorage.removeItem(y)}catch{}}let[A,j]=(0,l.useState)(!1),[te,ne]=(0,l.useState)(``),re=Math.max(0,Math.min(h.duration_frames-1,Math.round(w*g))),M=S?Math.round(S.at*g):re,N=wt(h,M),P=N[0],F=(St(h).find(e=>e.item_id===P?.id)?.effects??[]).filter(e=>e.effect_id===`audio.layers`).flatMap(e=>e.parameters.layers??[]);(0,l.useEffect)(()=>{u(!!(A||b))},[A,b,u]),(0,l.useEffect)(()=>{e||v.current?.pause()},[e]);function I(e){T(e),v.current&&(v.current.currentTime=e)}function ie(){v.current?.pause();let e=v.current?v.current.currentTime:w;D(null),T(e),ne(``),k({referenceId:``,at:e,end:``,kind:C?.kind??`change`,target:``,note:C?.note??``,gain:C?.gain??-12,fill:C?.fill??!0,layer:``})}function L(e){if(S)return;let t=Ft(h,O,e);if(!t){ne(`這個元件不能直接編輯,請記一筆注記交給 AI。`);return}v.current?.pause(),ne(``),D(t),I((t.at+t.duration/2)/g)}function R(e,t,n,r){if(S)return;let i=E?.id===e?E:Ft(h,O,e);if(!i){ne(`這個元件不能直接編輯,請記一筆注記交給 AI。`);return}E?.id!==e&&(v.current?.pause(),ne(``)),D({...i,...Pt(i,t,n),lane:r})}function ae(e){v.current?.pause();let t=(h.duration_frames-1)/g,n=v.current?v.current.currentTime:w,r=Math.max(0,Math.min(t,Math.round((n+e)*g)/g));I(r),S&&k({...S,at:r})}(0,l.useEffect)(()=>{if(!e)return;function t(e){if(e.key===`Escape`&&E){D(null);return}let t=e.target?.closest(`input, textarea, select, [contenteditable="true"]`),n=e.target?.closest(`video`);t||n&&n!==v.current||o||A||E||e.metaKey||e.ctrlKey||e.altKey||(e.key.toLowerCase()===`m`&&!S?(e.preventDefault(),ie()):(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),ae((e.key===`ArrowLeft`?-1:1)*(e.shiftKey?1/g:1))))}return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)});function oe(e){if(b)return;let t=e.current_range;if(!t){ne(`這筆注記的畫面已被改動,請刪除後在新的位置重新記一筆。`);return}let n=(t.at_frame??t.start_frame)/g;D(null),I(n),ne(``),k({referenceId:e.reference_id,at:n,end:e.explicit_range?gt((t.start_frame+t.duration_frames)/g,!0):``,kind:e.kind,target:e.element_id??``,note:e.note,gain:e.source_gain_db??-12,fill:e.fill_music??!0,layer:e.audio_layer_id??``})}async function se(e){if(!(A||o)){j(!0),ne(``);try{c(await Se(n,t,r,i.revision.revision_id,_.version,e)),`reference`in e&&k(null)}catch(e){ne(e instanceof Error?e.message:`無法儲存注記。`);try{let e=await ue(t,r);e.references&&c(e.references)}catch{}}finally{j(!1)}}}async function ce(e){if(!(!E||A)){j(!0),ne(``);try{await e()&&D(null)}finally{j(!1)}}}let le=S?.end.trim()?xt(S.end):null,z=N.find(e=>e.id===S?.target),de=``;S&&(P?le!==null&&!(le>S.at)?de=`結束時間要晚於標記的時間,例如 2:55。`:!mt.includes(S.kind)&&!S.note.trim()&&(de=`寫下要怎麼改。`):de=`這個時間點沒有畫面,請換個位置。`);function fe(){if(!S||!P||de)return;let e,t;le===null?z?.text?(e=Math.max(P.start,z.start),t=Math.min(P.end,z.end)):(e=P.start,t=P.end):(e=M,t=Math.min(P.end,Math.round(le*g))),se({reference:{reference_id:S.referenceId||crypto.randomUUID(),kind:S.kind,item_id:P.id,start_offset_frames:e-P.start,duration_frames:Math.max(1,t-e),note:S.note.trim(),at_offset_frames:M-P.start,explicit_range:le!==null,...z?.text?{element_id:z.id}:{},...S.kind===`audio`?{source_gain_db:S.gain,fill_music:S.fill,...S.layer?{audio_layer_id:S.layer}:{}}:{}}})}let pe=_.items.map(e=>({item:e,...Tt(e,h)})).sort((e,t)=>(e.at??1/0)-(t.at??1/0)),B=E&&ee?Math.min(h.duration_frames-1,E.at+Math.floor(E.duration/2)):re,me;return me=E&&ee&&O?(0,U.jsx)(Bt,{edit:E,settings:ee,editing:O,fps:g,busy:A,disabled:o||!!s,locked:s,onChange:D,onCancel:()=>D(null),onSave:()=>void ce(()=>d(It(E))),onRemove:()=>void ce(()=>f(E.id))}):S?(0,U.jsxs)(`fieldset`,{className:`rv-note-form`,disabled:o||A,children:[(0,U.jsxs)(`div`,{className:`rv-panel-head`,children:[(0,U.jsx)(`h4`,{children:S.referenceId?`修改注記`:`記一筆`}),(0,U.jsx)(`span`,{className:`rv-time`,children:gt(S.at,!0)}),(0,U.jsx)(`button`,{type:`button`,className:`rv-icon`,"aria-label":`取消`,onClick:()=>k(null),children:`×`})]}),(0,U.jsx)(`div`,{className:`review-chips`,role:`radiogroup`,"aria-label":`要怎麼處理`,children:ft.map(([e,t])=>(0,U.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":S.kind===e,className:`review-chip is-${e}`,onClick:()=>k({...S,kind:e}),children:t},e))}),N.length>1&&(0,U.jsx)(`div`,{className:`review-chips`,role:`radiogroup`,"aria-label":`指的是`,children:N.map((e,t)=>(0,U.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":t===0?!z?.text:S.target===e.id,className:`review-chip`,onClick:()=>k({...S,target:t===0?``:e.id}),children:e.label},e.id))}),(0,U.jsx)(`textarea`,{"aria-label":`注記說明`,rows:3,maxLength:2e3,value:S.note,placeholder:ht[S.kind],onChange:e=>k({...S,note:e.target.value}),autoFocus:!0,onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&!de&&fe()}}),S.kind===`audio`&&(0,U.jsxs)(U.Fragment,{children:[F.length>0&&(0,U.jsxs)(`label`,{children:[`哪個聲音`,(0,U.jsxs)(`select`,{value:S.layer,onChange:e=>k({...S,layer:e.target.value}),children:[(0,U.jsx)(`option`,{value:``,children:`這段素材的原音`}),F.map(e=>(0,U.jsx)(`option`,{value:String(e.layer_id),children:i.audio_assets.find(t=>t.asset_id===e.asset_id)?.name??`配樂/音效`},String(e.layer_id)))]})]}),(0,U.jsxs)(`label`,{children:[`降低音量 `,S.gain,` dB`,(0,U.jsx)(`input`,{"aria-label":`希望降低音量`,type:`range`,min:-60,max:0,step:1,value:S.gain,onChange:e=>k({...S,gain:Number(e.target.value)})})]}),(0,U.jsxs)(`label`,{className:`consent-check`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:S.fill,onChange:e=>k({...S,fill:e.target.checked})}),`讓配樂補滿這段`]})]}),(0,U.jsxs)(`details`,{className:`rv-range`,open:!!S.end,children:[(0,U.jsx)(`summary`,{children:`只改其中一段`}),(0,U.jsxs)(`div`,{className:`rv-row`,children:[(0,U.jsx)(`input`,{"aria-label":`結束時間`,value:S.end,placeholder:`到 2:55`,onChange:e=>k({...S,end:e.target.value})}),a&&(0,U.jsx)(`button`,{type:`button`,className:`button ghost`,onClick:()=>k({...S,end:gt(v.current?.currentTime??w,!0)}),children:`到目前時間`})]})]}),de&&S.note&&(0,U.jsx)(`p`,{className:`rv-hint`,children:de}),(0,U.jsxs)(`div`,{className:`rv-row`,children:[(0,U.jsx)(`button`,{type:`button`,className:`button primary`,disabled:!!de,onClick:fe,children:A?`儲存中…`:`記下`}),(0,U.jsx)(`button`,{type:`button`,className:`button ghost`,onClick:()=>k(null),children:`取消`})]})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`rv-panel-head`,children:[(0,U.jsx)(`h4`,{children:`注記`}),pe.length>0&&(0,U.jsx)(`span`,{className:`rv-count`,children:pe.length}),(0,U.jsxs)(`button`,{type:`button`,className:`button secondary rv-mark`,disabled:o||A,onClick:ie,children:[`記一筆`,(0,U.jsx)(`kbd`,{children:`M`})]})]}),C&&(0,U.jsxs)(`div`,{className:`rv-outdated`,role:`status`,children:[(0,U.jsxs)(`p`,{children:[`上一版有一筆沒記下的注記:「`,C.note,`」`]}),(0,U.jsx)(`button`,{type:`button`,className:`button ghost`,onClick:()=>k(null),children:`不要了`})]}),pe.length?(0,U.jsx)(`ol`,{className:`rv-notes`,children:pe.map(({item:e,at:t,time:n,target:r})=>(0,U.jsxs)(`li`,{className:`is-${e.kind}`,children:[(0,U.jsxs)(`button`,{type:`button`,className:`rv-note-jump`,disabled:t===null,onClick:()=>{t!==null&&I(t)},"aria-label":`跳到 ${n}`,children:[(0,U.jsx)(`span`,{className:`rv-time`,children:n}),(0,U.jsx)(`span`,{className:`review-kind is-${e.kind}`,children:pt[e.kind]}),(0,U.jsx)(`span`,{className:`rv-note-target`,children:r}),e.note&&(0,U.jsx)(`span`,{className:`rv-note-text`,children:e.note}),(e.current_range?.element_present===!1||!e.current_range)&&(0,U.jsx)(`small`,{children:`畫面已經改過,AI 會依原始素材找回位置。`})]}),(0,U.jsxs)(`div`,{className:`rv-note-actions`,children:[(0,U.jsx)(`button`,{type:`button`,className:`rv-text-button`,disabled:o||A||!!b,onClick:()=>oe(e),children:`修改`}),(0,U.jsx)(`button`,{type:`button`,className:`rv-text-button`,disabled:o||A,onClick:()=>void se({delete_id:e.reference_id}),children:`刪除`})]})]},e.reference_id))}):(0,U.jsxs)(`div`,{className:`rv-empty`,children:[(0,U.jsxs)(`p`,{children:[`看到要改的地方,按 `,(0,U.jsx)(`kbd`,{children:`M`}),` 記一筆。`]}),(0,U.jsx)(`p`,{children:`想改畫面上的字,點時間線上紫色的元件;拖曳它可以改時間或換軌,拉兩端可以改長度。`})]})]}),(0,U.jsxs)(`section`,{className:`rv-studio`,"aria-label":`審片`,children:[(0,U.jsx)(`div`,{className:`rv-stage`,children:p??(E||!a?(0,U.jsx)(Vt,{projectId:t,csrf:n,runId:r,revisionId:i.revision.revision_id,timeline:h,frame:B,component:E?It(E):void 0,limits:E?At(E):void 0,onMove:E?(e,t)=>D({...E,x:e,y:t}):void 0}):(0,U.jsx)(`video`,{ref:v,controls:!0,preload:`metadata`,src:a.media_url,"aria-label":`審片用影片`,onLoadedMetadata:e=>{e.currentTarget.currentTime=w},onTimeUpdate:e=>T(e.currentTarget.currentTime),onSeeked:e=>T(e.currentTarget.currentTime)}))}),(0,U.jsxs)(`aside`,{className:`rv-panel`,children:[te&&(0,U.jsx)(`p`,{role:`alert`,className:`rv-error`,children:te}),me]}),(0,U.jsx)(Yt,{unreviewed:m,timeline:h,now:w,video:a?.media_url??null,selected:E?.id??null,onSelect:S?void 0:L,draft:E?{id:E.id,start:E.at,end:E.at+E.duration,lane:E.lane}:null,onPlace:S||o||s||A?void 0:R,looks:Object.fromEntries(Object.entries(O?.components??{}).flatMap(([e,t])=>{let n=O?.looks?.findIndex(n=>n.look_id===(e===E?.id?E.look:t.look_id))??-1;return n>=0?[[e,{name:O.looks[n].name,index:n}]]:[]})),onSeek:e=>{I(e),S&&k({...S,at:e})},notes:pe.map(({item:e,at:t,target:n})=>({id:e.reference_id,at:t,label:`${pt[e.kind]} ${n}`,kind:e.kind}))})]})}function Zt({looks:e,fonts:t,disabled:n,onSave:r}){let[i,a]=(0,l.useState)({}),[o,s]=(0,l.useState)(``);return e.length?(0,U.jsxs)(`div`,{className:`rv-looks`,children:[(0,U.jsx)(`p`,{className:`rv-looks-intro`,children:`同一類元件共用一套字型和配色。改這裡,用這套外觀的元件會一起換;版面和動畫不變。`}),e.map(e=>{let c=i[e.look_id]??{fonts:{},colors:{}},l=Object.keys(c.fonts).length+Object.keys(c.colors).length>0,u=t=>a(n=>({...n,[e.look_id]:t}));async function d(){s(e.look_id);let t=await r(e.look_id,c);s(``),t&&a(t=>{let{[e.look_id]:n,...r}=t;return r})}return(0,U.jsxs)(`section`,{className:`rv-look`,"aria-label":`${e.name}外觀`,children:[(0,U.jsxs)(`header`,{children:[(0,U.jsx)(`strong`,{children:e.name}),(0,U.jsx)(`span`,{children:e.used_by?`${e.used_by} 個元件`:`還沒有元件使用`})]}),e.fonts.map(e=>{let r=c.fonts[e.key]??e.family;return(0,U.jsxs)(`label`,{className:`rv-look-font`,children:[e.label,(0,U.jsx)(`select`,{value:r,disabled:n,style:{fontFamily:`"${r}", "PingFang TC", sans-serif`},onChange:t=>{let{[e.key]:n,...r}=c.fonts;u({...c,fonts:t.target.value===e.family?r:{...r,[e.key]:t.target.value}})},children:t.map(e=>(0,U.jsx)(`option`,{value:e.family,children:e.label},e.family))})]},e.key)}),e.colors.length>0&&(0,U.jsx)(`div`,{className:`rv-colors`,role:`group`,"aria-label":`${e.name}的顏色`,children:e.colors.map(e=>{let t=c.colors[e.key]??e.value;return(0,U.jsxs)(`label`,{className:`rv-swatch`,title:e.label,children:[(0,U.jsx)(`input`,{type:`color`,value:t,disabled:n,"aria-label":e.label,onChange:t=>{let{[e.key]:n,...r}=c.colors;u({...c,colors:t.target.value.toLowerCase()===e.value?r:{...r,[e.key]:t.target.value.toLowerCase()}})}}),(0,U.jsx)(`span`,{style:{background:t}}),e.label]},e.key)})}),l&&(0,U.jsxs)(`div`,{className:`rv-row`,children:[(0,U.jsx)(`button`,{type:`button`,className:`button primary`,disabled:n||!!o,onClick:()=>void d(),children:o===e.look_id?`套用中…`:`套用`}),(0,U.jsx)(`button`,{type:`button`,className:`button ghost`,disabled:!!o,onClick:()=>u({fonts:{},colors:{}}),children:`取消`})]})]},e.look_id)})]}):(0,U.jsx)(`p`,{className:`rv-looks-empty`,children:`AI 還沒有替元件定外觀。較早做的元件沒有外觀;請 AI 重新設計後,就能在這裡統一換字型和配色。`})}function Qt({report:e,request:t}){let n=!e.changes.length&&!e.notes.length&&!e.not_done.length;return(0,U.jsxs)(`div`,{className:`rv-report-body`,children:[t&&(0,U.jsxs)(`p`,{className:`rv-report-request`,children:[(0,U.jsx)(`span`,{children:`你的要求`}),t]}),e.summary&&(0,U.jsx)(`p`,{className:`rv-report-summary`,children:e.summary}),e.changes.length>0&&(0,U.jsxs)(`section`,{children:[(0,U.jsx)(`h5`,{children:`改了什麼`}),(0,U.jsx)(`ol`,{className:`rv-report-changes`,children:e.changes.map((e,t)=>(0,U.jsxs)(`li`,{children:[(0,U.jsx)(`strong`,{children:e.what}),(0,U.jsx)(`span`,{children:e.why})]},t))})]}),e.notes.length>0&&(0,U.jsxs)(`section`,{children:[(0,U.jsx)(`h5`,{children:`你的注記`}),(0,U.jsx)(`ul`,{className:`rv-report-notes`,children:e.notes.map(e=>(0,U.jsxs)(`li`,{className:`is-${e.outcome}`,children:[(0,U.jsx)(`span`,{className:`rv-report-outcome`,children:e.outcome_label}),(0,U.jsxs)(`div`,{children:[e.note&&(0,U.jsx)(`q`,{children:e.note}),(0,U.jsx)(`p`,{children:e.explanation}),e.reason_label&&(0,U.jsx)(`small`,{className:`rv-report-reason`,children:e.reason_label})]})]},e.reference_id))})]}),e.not_done.length>0&&(0,U.jsxs)(`section`,{className:`rv-report-missing`,children:[(0,U.jsx)(`h5`,{children:`沒做到的地方`}),(0,U.jsx)(`ul`,{children:e.not_done.map((e,t)=>(0,U.jsxs)(`li`,{className:e.reason?`is-${e.reason}`:void 0,children:[e.reason_label&&(0,U.jsx)(`span`,{className:`rv-report-reason`,children:e.reason_label}),(0,U.jsx)(`strong`,{children:e.what}),e.detail&&(0,U.jsx)(`span`,{children:e.detail})]},t))}),e.not_done.some(e=>e.reason===`needs_you`)&&(0,U.jsx)(`p`,{className:`rv-hint`,children:`回覆「需要你決定或提供」的項目後,下一次修改 AI 會接著做。`})]}),n&&(0,U.jsx)(`p`,{className:`rv-hint`,children:`這一版是在 Clipen 要求修改說明之前做的,只有上面這句摘要。`})]})}var $t=8e3;function en({visible:e,projectId:t,csrf:n,runId:r,revisionId:i,active:a,onChanged:o,musicId:s,onMusicChange:c,previews:u,runProvider:d,aiReview:f=null}){let p=Ae(),m=!!(d&&p.id&&d!==p.id),[h,g]=(0,l.useState)(null),[_,v]=(0,l.useState)(!1),[y,b]=(0,l.useState)(``),[x,S]=(0,l.useState)(``),[C,w]=dt(t,`refinement`,``,r),[T,E]=(0,l.useState)(!1),[D,O]=(0,l.useState)(!1),[ee,k]=(0,l.useState)(!1),[A,j]=(0,l.useState)(null),[te,ne]=(0,l.useState)(null),[re,M]=(0,l.useState)(!1),[N,P]=(0,l.useState)(null),[F,I]=(0,l.useState)(null),[ie,L]=(0,l.useState)(null),R=`clipen:report-read:${t}:${r}`,[ae,oe]=(0,l.useState)(()=>{try{return localStorage.getItem(R)}catch{return null}});function se(e){oe(e);try{localStorage.setItem(R,e)}catch{}}(0,l.useEffect)(()=>{let e=!1;return ue(t,r).then(t=>{e||(g(t),j(null),P(null))}).catch(t=>{e||b(String(t))}),()=>{e=!0}},[t,r,i]),(0,l.useEffect)(()=>{if(!x)return;let e=window.setTimeout(()=>S(``),4e3);return()=>window.clearTimeout(e)},[x]);let ce=h?.revision.revision_id,le=u.find(e=>e?.state===`succeeded`&&e.revision_id===ce)??null,ye=u.find(e=>e&&e.revision_id===ce&&[`queued`,`running`].includes(e.state))??null,V=!!ye,be=_||a||V,xe=h?.references?.items??[],H=h?Et(C,xe,h.revision.timeline):``,Se=h?.history.find(e=>e.revision_id===ce),Ce=Se&&Se===h?.history[0]&&Se.kind===`ai_complete`&&Se.report&&ae!==Se.revision_id?Se:null,we=h?h.revision.timeline.duration_frames*h.revision.timeline.frame_rate.den/h.revision.timeline.frame_rate.num:0,Te=le?null:u.find(e=>e?.state===`succeeded`&&e.revision_id!==ce)??null,Ee=h?.history.find(e=>e.revision_id===Te?.revision_id),De=le??(Te&&Ee?.duration_seconds!=null&&Math.abs(Ee.duration_seconds-we)<.05?Te:null);async function Oe(e,n){if(_||a||!h)return!1;v(!0),b(``),S(``);let i=!1;try{await e(),S(n),i=!0}catch(e){b(e instanceof Error?e.message:`這次操作沒有完成。`)}finally{try{g(await ue(t,r))}catch{}o(),v(!1)}return i}function ke(){if(!h)return;let e=H.length<=$t?H:`${C.trim()||`請依審片注記修改目前影片,其他部分保留。`}\n\n(共 ${xe.length} 筆審片注記,詳見附帶的注記資料。)`.slice(0,$t);O(!1),Oe(async()=>{await me(n,t,r,h.revision.revision_id,e,s||void 0,h.references?.version??0),w(``),E(!1)},`AI 開始修改了。`)}async function je(e){let i=(await e).revision?.revision_id;i&&await B(n,t,r,i).catch(()=>{})}function Ne(){h&&Oe(()=>B(n,t,r,h.revision.revision_id),`開始輸出這一版,好了就能播放。`)}function Pe(){M(!0),Oe(async()=>{try{j(await he(n,t,r)),ne(null)}finally{M(!1)}},`已匯出,Finder 打開了匯出的資料夾。`)}function Fe(){A&&Oe(async()=>{await ge(n,t,r,A.folder),ne(await _e(n,t,r,A.folder))},`可改字的時間線做好了。`)}function Ie(){Oe(async()=>{let e=await ve(n,t,r),i=document.createElement(`a`);i.href=e.download_url,i.download=``,i.click()},`剪輯資料開始下載。`)}(0,l.useEffect)(()=>{if(!A||!A.editable_overlays||!e)return;let i=!1,a=()=>void _e(n,t,r,A.folder).then(e=>{i||ne(e)}).catch(()=>{});a();let o=window.setInterval(a,3e3);return()=>{i=!0,window.clearInterval(o)}},[A,e,n,t,r]);function Le(e){h&&(I(null),Oe(()=>z(n,t,r,h.revision.revision_id,e.revision_id),`已回到${_t(e.created_at)} 的樣子。`).then(e=>{e&&P(null)}))}let Re=N?.preview_url?(0,U.jsxs)(`div`,{className:`rv-compare`,children:[(0,U.jsx)(`video`,{controls:!0,autoPlay:!0,preload:`metadata`,src:N.preview_url,"aria-label":`${_t(N.created_at)} 的影片`},N.preview_url),(0,U.jsxs)(`div`,{className:`rv-compare-bar`,children:[(0,U.jsxs)(`span`,{children:[`正在看`,(0,U.jsx)(`strong`,{children:_t(N.created_at)}),`的影片:`,bt(N),`。現在的影片不受影響。`]}),(0,U.jsx)(`button`,{type:`button`,className:`button secondary`,disabled:be,onClick:()=>I(N),children:`回到這裡`}),(0,U.jsx)(`button`,{type:`button`,className:`button ghost`,onClick:()=>P(null),children:`回到現在`})]})]}):void 0;return(0,U.jsxs)(`section`,{className:`rv`,"aria-label":`審片修改`,children:[(0,U.jsxs)(`header`,{className:`rv-bar`,children:[(0,U.jsxs)(`div`,{className:`rv-title`,children:[(0,U.jsx)(`h3`,{children:`審片`}),h&&(0,U.jsxs)(`span`,{children:[Se?`已儲存 · ${_t(Se.created_at)}`:`目前的影片`,` · `,gt(we)]})]}),(0,U.jsxs)(`div`,{className:`rv-tools`,children:[h&&!le&&!V&&(0,U.jsx)(`button`,{type:`button`,className:`button primary`,disabled:be,onClick:Ne,children:`輸出這一版`}),(0,U.jsx)(nn,{label:`元件外觀`,disabled:!h,children:()=>(0,U.jsx)(Zt,{looks:h?.component_editing?.looks??[],fonts:h?.component_editing?.font_choices??[],disabled:be,onSave:(e,i)=>Oe(()=>je(fe(n,t,r,h.revision.revision_id,{look_id:e,...i})),`外觀換好了,正在輸出新影片。`)})}),(0,U.jsx)(nn,{label:`修改紀錄`,disabled:!h,children:e=>(0,U.jsxs)(U.Fragment,{children:[h?.ai_usage&&(0,U.jsxs)(`p`,{className:`rv-usage-total`,title:yt(h.ai_usage).detail,children:[`這部片 AI 總用量 `,(0,U.jsx)(`strong`,{children:yt(h.ai_usage).short}),(0,U.jsx)(`span`,{children:yt(h.ai_usage).detail})]}),(0,U.jsx)(`ol`,{className:`rv-versions`,"aria-label":`修改紀錄,最新的在最上面`,children:h?.history.map((t,n)=>{let r=n===0&&t.revision_id===ce,i=!r&&t.revision_id===ce;return(0,U.jsxs)(`li`,{className:r?`is-current`:``,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`span`,{className:`rv-version-time`,children:[r&&(0,U.jsx)(`em`,{children:`現在`}),_t(t.created_at),t.duration_seconds==null?``:` · ${gt(t.duration_seconds)}`]}),(0,U.jsx)(`strong`,{title:bt(t),children:bt(t)}),t.kind!==`manual`&&t.kind!==`restore`&&t.changes&&(0,U.jsx)(`small`,{children:t.changes}),t.report&&(0,U.jsx)(`button`,{type:`button`,className:`rv-text-button rv-report-open`,onClick:()=>{e(),L(t)},children:`看 AI 的修改說明`}),(0,U.jsx)(`small`,{className:`rv-usage`,title:t.usage?yt(t.usage).detail:void 0,children:t.kind===`ai_complete`||t.kind===`ai_partial`?t.usage?`AI 用量:${yt(t.usage).short}`:`AI 用量沒有記錄`:`手動,不用 AI 額度`})]}),!r&&(0,U.jsx)(`div`,{className:`rv-row`,children:i?(0,U.jsx)(`span`,{className:`rv-version-same`,children:`和現在一樣`}):(0,U.jsxs)(U.Fragment,{children:[t.preview_url&&(0,U.jsx)(`button`,{type:`button`,className:`rv-text-button`,onClick:()=>{P(t),e()},children:`看看`}),(0,U.jsx)(`button`,{type:`button`,className:`rv-text-button`,disabled:be,onClick:()=>{e(),I(t)},children:`回到這裡`})]})})]},`${t.revision_id}-${t.created_at}`)})})]})}),(0,U.jsx)(nn,{label:re?`匯出中…`:`匯出`,disabled:!h||re,children:e=>(0,U.jsxs)(`div`,{className:`rv-menu-list`,children:[(0,U.jsxs)(`button`,{type:`button`,disabled:_||a,onClick:()=>{e(),Pe()},children:[(0,U.jsx)(`strong`,{children:`DaVinci Resolve`}),(0,U.jsx)(`span`,{children:`自己動手細剪,素材、元件和配樂一起帶過去`})]}),le&&(0,U.jsxs)(`a`,{href:le.media_url,download:!0,onClick:e,children:[(0,U.jsx)(`strong`,{children:`下載這一版影片`}),(0,U.jsx)(`span`,{children:`MP4`})]}),(0,U.jsxs)(`button`,{type:`button`,disabled:_||a,onClick:()=>{e(),Ie()},children:[(0,U.jsx)(`strong`,{children:`剪輯資料`}),(0,U.jsx)(`span`,{children:`JSON,給開發或備份用`})]})]})})]})]}),Ce?.report&&(0,U.jsxs)(`section`,{className:`rv-report`,"aria-label":`AI 這次的修改說明`,children:[(0,U.jsxs)(`div`,{className:`rv-report-head`,children:[(0,U.jsx)(`strong`,{children:`AI 這次的修改說明`}),(0,U.jsx)(`span`,{children:_t(Ce.created_at)}),(0,U.jsx)(`button`,{type:`button`,className:`rv-icon`,"aria-label":`知道了`,onClick:()=>se(Ce.revision_id),children:`×`})]}),(0,U.jsx)(Qt,{report:Ce.report}),(0,U.jsx)(`div`,{className:`rv-row`,children:(0,U.jsx)(`button`,{type:`button`,className:`button ghost`,onClick:()=>se(Ce.revision_id),children:`知道了`})})]}),ye&&(0,U.jsx)(tn,{job:ye,playing:De?Ee?`${_t(Ee.created_at)} `:`上一版`:null}),h&&!le&&!V&&De&&(0,U.jsxs)(`p`,{className:`rv-stale`,children:[`現在播的是`,Ee?`${_t(Ee.created_at)} `:`上一版`,`的影片,還看不到剛改的地方。按「輸出這一版」更新。`]}),y&&(0,U.jsxs)(`p`,{className:`rv-alert`,role:`alert`,children:[y,(0,U.jsx)(`button`,{type:`button`,className:`rv-icon`,"aria-label":`關閉`,onClick:()=>b(``),children:`×`})]}),x&&(0,U.jsx)(`p`,{className:`rv-toast`,role:`status`,children:x}),h&&(0,U.jsx)(Xt,{unreviewed:f&&f.revision_id===ce?f.unreviewed_item_ids:[],visible:e,projectId:t,csrf:n,runId:r,data:h,video:De,disabled:_||a,locked:V?`新影片輸出中,完成後才能再修改元件。`:void 0,stage:Re,onChanged:e=>g(t=>t&&{...t,references:e}),onDirty:k,onSaveComponent:e=>Oe(()=>je(de(n,t,r,h.revision.revision_id,e)),`存好了,正在輸出新影片。`),onRemoveComponent:e=>Oe(()=>je(pe(n,t,r,h.revision.revision_id,e)),`元件刪掉了,正在輸出新影片。可以從「版本」還原。`)}),h&&(0,U.jsx)(`footer`,{className:`rv-composer`,children:a?(0,U.jsxs)(`p`,{className:`rv-working`,children:[(0,U.jsx)(`span`,{className:`rv-pulse`}),`AI 正在修改這支片,好了會自動更新。`]}):V?(0,U.jsxs)(`p`,{className:`rv-working`,children:[(0,U.jsx)(`span`,{className:`rv-spinner`,"aria-hidden":`true`}),`新影片輸出中。完成後就能繼續修改或交給 AI;這段時間可以看片、記注記。`]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`textarea`,{"aria-label":`這一版還要怎麼改?`,rows:1,value:C,maxLength:$t,onChange:e=>w(e.target.value),placeholder:xe.length?`還有其他想法嗎?(可不填,${xe.length} 筆注記會一起交給 AI)`:`這一版還要怎麼改?例如:節奏再快一點,早餐段落縮短`}),(0,U.jsx)(nn,{label:`配樂`,disabled:_,up:!0,children:()=>(0,U.jsx)(`div`,{className:`rv-music`,children:(0,U.jsx)(st,{projectId:t,csrf:n,value:s,onChange:c,disabled:_,defaultLabel:`沿用目前配樂`})})}),(0,U.jsx)(`button`,{type:`button`,className:`button primary`,disabled:_||ee||!H,title:ee?`先記下或取消正在寫的注記`:void 0,onClick:()=>O(!0),children:`交給 AI 修改`})]})}),(0,U.jsxs)(rn,{open:D,label:`交給 AI 修改`,onClose:()=>O(!1),children:[(0,U.jsxs)(`h3`,{children:[`交給 `,p.name,` 修改`]}),(0,U.jsxs)(`p`,{children:[xe.length?`${xe.length} 筆注記${C.trim()?`和你的說明`:``}`:`你的說明`,`會交給 `,p.name,`,從現在的影片繼續改。現在這版會留在修改紀錄裡,隨時可以回來。`]}),m&&(0,U.jsxs)(`p`,{className:`rv-note`,children:[`這支片原本由 `,Me(d),` 製作,這次改由 `,p.name,` 接手。`]}),(0,U.jsx)(Ye,{}),(0,U.jsxs)(`label`,{className:`consent-check`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:T,onChange:e=>E(e.target.checked)}),`同意使用 `,p.name,` 的額度`]}),(0,U.jsxs)(`div`,{className:`rv-row rv-dialog-actions`,children:[(0,U.jsx)(`button`,{type:`button`,className:`button ghost`,onClick:()=>O(!1),children:`取消`}),(0,U.jsx)(`button`,{type:`button`,className:`button primary`,disabled:!T||_,onClick:ke,children:`開始修改`})]})]}),(0,U.jsx)(rn,{open:!!ie,label:`AI 的修改說明`,onClose:()=>L(null),children:ie?.report&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`h4`,{children:[bt(ie),(0,U.jsxs)(`small`,{children:[` · `,_t(ie.created_at)]})]}),(0,U.jsx)(Qt,{report:ie.report,request:ie.detail}),(0,U.jsx)(`div`,{className:`rv-row`,children:(0,U.jsx)(`button`,{type:`button`,className:`button primary`,onClick:()=>L(null),children:`關閉`})})]})}),(0,U.jsx)(rn,{open:!!F,label:`回到較早的樣子`,onClose:()=>I(null),children:F&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`h3`,{children:[`回到`,_t(F.created_at),` 的樣子?`]}),(0,U.jsx)(`p`,{className:`rv-return-what`,children:bt(F)}),(0,U.jsx)(`p`,{children:`影片會變回那時候的樣子。現在這版不會消失,會留在修改紀錄裡,隨時可以再回來。`}),(0,U.jsxs)(`div`,{className:`rv-row rv-dialog-actions`,children:[(0,U.jsx)(`button`,{type:`button`,className:`button ghost`,onClick:()=>I(null),children:`取消`}),(0,U.jsx)(`button`,{type:`button`,className:`button primary`,disabled:be,onClick:()=>Le(F),children:`回到這裡`})]})]})}),(0,U.jsx)(rn,{open:!!A,label:`到 DaVinci Resolve 繼續剪`,onClose:()=>j(null),children:A&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h3`,{children:`到 DaVinci Resolve 繼續剪`}),(0,U.jsx)(`p`,{className:`rv-path`,children:A.folder}),(0,U.jsxs)(`ol`,{className:`rv-steps`,children:[(0,U.jsx)(`li`,{children:`在 Resolve 選「檔案 › 匯入 › 時間線…」,選資料夾裡的 .fcpxml。`}),(0,U.jsx)(`li`,{children:`如果說找不到素材,按「Locate」,選毛片資料夾。`}),A.captions>0&&(0,U.jsx)(`li`,{children:`再選「檔案 › 匯入 › 字幕…」,選「字幕.srt」,拖到字幕軌。`})]}),A.editable_overlays>0&&(0,U.jsxs)(`details`,{className:`rv-resolve-titles`,children:[(0,U.jsx)(`summary`,{children:`也想在 Resolve 改元件的字`}),(0,U.jsxs)(`ol`,{className:`rv-steps`,children:[(0,U.jsx)(`li`,{children:`在 Resolve 選「檔案 › 匯出 › 時間線…」,存成 .drt。`}),(0,U.jsx)(`li`,{children:`Clipen 會做好一份「(可改字)」的 .drt,匯入它就能改字。`})]}),(0,U.jsx)(on,{status:te,disabled:_||a,onConvert:Fe})]}),A.notes.length>0&&(0,U.jsxs)(`details`,{children:[(0,U.jsxs)(`summary`,{children:[`要留意的地方(`,A.notes.length,`)`]}),(0,U.jsx)(`ul`,{children:A.notes.map(e=>(0,U.jsx)(`li`,{children:e},e))})]}),(0,U.jsx)(`div`,{className:`rv-row rv-dialog-actions`,children:(0,U.jsx)(`button`,{type:`button`,className:`button primary`,onClick:()=>j(null),children:`好`})})]})})]})}function tn({job:e,playing:t}){let[n,r]=(0,l.useState)(()=>Date.now());(0,l.useEffect)(()=>{let e=window.setInterval(()=>r(Date.now()),1e3);return()=>window.clearInterval(e)},[]);let i=e.state===`running`?Math.max(0,Math.min(1,e.progress)):0,a=Date.parse(e.started_at??e.created_at),o=Number.isFinite(a)?Math.max(0,(n-a)/1e3):0,s=i>.08&&o>3?Math.max(1,Math.round(o*(1-i)/i)):null,c=s===null?`正在估算時間`:s<60?`約剩 ${s} 秒`:`約剩 ${Math.ceil(s/60)} 分鐘`;return(0,U.jsxs)(`div`,{className:`rv-render`,role:`status`,"aria-live":`polite`,children:[(0,U.jsxs)(`div`,{className:`rv-render-head`,children:[(0,U.jsx)(`span`,{className:`rv-spinner`,"aria-hidden":`true`}),(0,U.jsx)(`strong`,{children:e.state===`queued`?`準備輸出新影片…`:`正在輸出新影片`}),e.state===`running`&&(0,U.jsxs)(`span`,{children:[e.stage?`${e.stage} · `:``,Math.round(i*100),`% · `,c]})]}),(0,U.jsx)(`div`,{className:`rv-render-bar`,"aria-hidden":`true`,children:(0,U.jsx)(`i`,{style:{width:`${Math.max(3,i*100)}%`}})}),(0,U.jsxs)(`p`,{children:[t?`先播${t}的影片,`:``,`完成後會自動換成新影片。輸出期間先不能修改影片,可以繼續看片、記注記。`]})]})}function nn({label:e,disabled:t,up:n,children:r}){let[i,a]=(0,l.useState)(!1),o=(0,l.useRef)(null);return(0,l.useEffect)(()=>{if(!i)return;let e=e=>{o.current?.contains(e.target)||a(!1)},t=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]),(0,U.jsxs)(`div`,{className:`rv-menu`,ref:o,children:[(0,U.jsxs)(`button`,{type:`button`,className:`button secondary`,"aria-expanded":i,disabled:t,onClick:()=>a(!i),children:[e,(0,U.jsx)(`span`,{className:`rv-caret`,"aria-hidden":`true`})]}),i&&(0,U.jsx)(`div`,{className:`rv-menu-panel${n?` is-up`:``}`,children:r(()=>a(!1))})]})}function rn({open:e,label:t,onClose:n,children:r}){let i=(0,l.useRef)(null);return(0,l.useEffect)(()=>{let t=i.current;t&&(e&&!t.open&&t.showModal(),!e&&t.open&&t.close())},[e]),(0,U.jsx)(`dialog`,{ref:i,className:`rv-dialog`,"aria-label":t,onClose:n,onClick:e=>{e.target===e.currentTarget&&n()},children:(0,U.jsx)(`div`,{className:`rv-dialog-body`,children:e&&r})})}var an=e=>e.split(`/`).pop()??e;function on({status:e,disabled:t,onConvert:n}){return e?e.state===`converted`&&e.converted?(0,U.jsxs)(`p`,{className:`resolve-timeline is-ready`,role:`status`,children:[`做好了:「`,an(e.converted),`」,在匯出的資料夾裡。`]}):e.state===`found`&&e.source?(0,U.jsxs)(`div`,{className:`resolve-timeline`,role:`status`,children:[(0,U.jsxs)(`p`,{children:[`找到「`,an(e.source),`」,正在轉成可改字的版本。沒自動完成的話按這裡:`]}),(0,U.jsx)(`button`,{type:`button`,className:`button ghost`,disabled:t,onClick:n,children:`轉成可改字的版本`})]}):(0,U.jsxs)(`div`,{className:`resolve-timeline`,role:`status`,children:[(0,U.jsx)(`p`,{children:`還沒找到 .drt。存到下面任一個地方就行:`}),(0,U.jsx)(`ul`,{children:e.folders.map(e=>(0,U.jsxs)(`li`,{children:[e.label,(0,U.jsx)(`small`,{children:e.path})]},e.path))})]}):(0,U.jsx)(`p`,{className:`rv-hint`,role:`status`,children:`正在找 Resolve 存出的 .drt…`})}function sn({projectId:e,csrf:t,kind:n,text:r,onUse:i,disabled:a}){let o=(0,l.useId)(),[s,c]=(0,l.useState)(!1),[u,d]=(0,l.useState)(!1),[f,p]=(0,l.useState)([]),[m,h]=(0,l.useState)(0),[g,_]=(0,l.useState)(!1),[v,y]=(0,l.useState)(``),[b,x]=(0,l.useState)(``),[S,C]=(0,l.useState)(0);(0,l.useEffect)(()=>{if(!s)return;let t=!1;return be(u?void 0:e).then(e=>{t||(p(e.prompts),h(e.total),y(``))}).catch(e=>{t||y(String(e))}),()=>{t=!0}},[s,u,e,S,a]);async function w(){_(!0),y(``),x(``);try{await xe(t,e,n,r),x(`需求已儲存在作品中,可隨時帶入。`),C(e=>e+1)}catch(e){y(e instanceof Error?e.message:`無法儲存需求。`)}finally{_(!1)}}async function T(){_(!0);try{let t=await be(u?void 0:e,f.length);p(e=>[...e,...t.prompts]),h(t.total)}catch(e){y(String(e))}finally{_(!1)}}return(0,U.jsxs)(`div`,{className:`prompt-history`,children:[(0,U.jsxs)(`div`,{className:`workbench-tabs`,children:[(0,U.jsx)(`button`,{type:`button`,className:`button ghost`,disabled:a||g||!r.trim(),onClick:()=>void w(),children:`儲存這段需求`}),(0,U.jsx)(`span`,{children:`只儲存文字,不會啟動 AI。`})]}),(0,U.jsx)(`p`,{className:`prompt-draft-hint`,children:`輸入草稿會在本機保留;每次送出的製作與修訂需求也會保存。`}),b&&(0,U.jsx)(`p`,{role:`status`,children:b}),v&&(0,U.jsx)(`p`,{role:`alert`,className:`inline-message error`,children:v}),(0,U.jsxs)(`details`,{open:s,onToggle:e=>c(e.currentTarget.open),children:[(0,U.jsx)(`summary`,{children:`已儲存的需求與歷史紀錄`}),(0,U.jsxs)(`label`,{className:`consent-check`,htmlFor:`${o}-scope`,children:[(0,U.jsx)(`input`,{id:`${o}-scope`,type:`checkbox`,disabled:g,checked:u,onChange:e=>d(e.target.checked)}),`包含此工作區其他作品`]}),!f.length&&(0,U.jsx)(`p`,{children:`目前沒有已儲存的需求。`}),(0,U.jsx)(`ol`,{children:f.map(e=>(0,U.jsxs)(`li`,{children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:e.kind===`production`?`影片製作`:`AI 修訂`}),(0,U.jsxs)(`span`,{children:[e.project_name,` · `,new Date(e.created_at).toLocaleString(`zh-TW`)]})]}),(0,U.jsx)(`p`,{children:e.text}),!!e.references?.items.length&&(0,U.jsxs)(`details`,{children:[(0,U.jsxs)(`summary`,{children:[`本次參考註記(`,e.references.items.length,` 筆)`]}),(0,U.jsx)(`ul`,{children:e.references.items.map(e=>(0,U.jsxs)(`li`,{children:[e.note,e.kind===`audio`?` · ${e.source_gain_db} dB${e.fill_music?` · 配樂補滿`:``}`:``]},e.reference_id))}),(0,U.jsx)(`p`,{children:`帶入需求只會複製文字;片段註記請確認目前影片中的範圍。`})]}),(0,U.jsx)(`button`,{type:`button`,className:`button secondary`,disabled:a,onClick:()=>{i(e.text),x(`已帶入需求,可先修改文字再送出。`)},children:`帶入需求`})]},`${e.project_id}:${e.prompt_id}`))}),f.length<m&&(0,U.jsx)(`button`,{type:`button`,className:`button ghost`,disabled:g,onClick:()=>void T(),children:`載入更早的需求`})]})]})}var cn={film:`M4 3h16v18H4zM4 8h16M4 16h16M8 3v5m8-5v5M8 16v5m8-5v5`,play:`m9 5 11 7-11 7V5Z`,edit:`m14 5 5 5M4 20l4-1L20 7a2.1 2.1 0 0 0-3-3L5 16l-1 4Z`,sparkle:`m12 3 2.7 6.3L21 12l-6.3 2.7L12 21l-2.7-6.3L3 12l6.3-2.7L12 3Zm7-2v4m-2-2h4`,folder:`M3 7V5h6l2 2h10v13H3V7Z`,plus:`M12 5v14M5 12h14`,arrow:`M5 12h14m-6-6 6 6-6 6`,audio:`M4 9v6m4-10v14m4-16v18m4-16v14m4-10v6`,text:`M4 5h16M12 5v15m-4 0h8`,layers:`m12 3 10 5-10 5L2 8l10-5Zm-9 9 9 5 9-5M3 16l9 5 9-5`,download:`M12 3v12m-5-5 5 5 5-5M4 16v5h16v-5`,check:`m5 12 4 4L19 6`,"arrow-left":`M19 12H5m6-6-6 6 6 6`};function ln({name:e,size:t=18,style:n}){return(0,U.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,style:n,children:(0,U.jsx)(`path`,{d:cn[e]})})}function un({skillId:e,templates:t,selectedId:n,disabled:r,onSelect:i}){let a=(0,l.useId)(),[o,s]=(0,l.useState)(`全部`),[c,u]=(0,l.useState)(``),[d,f]=(0,l.useState)(null),[p]=(0,l.useState)(()=>window.matchMedia(`(prefers-reduced-motion: reduce)`).matches),m=(0,l.useRef)(null),h=[`全部`,...new Set(t.map(e=>e.category))],g=t.filter(e=>(o===`全部`||e.category===o)&&[e.name,e.description,e.category,e.editorial_direction,e.design_direction??``,...(e.references??[]).map(e=>e.creator),...e.tags].join(` `).toLocaleLowerCase().includes(c.trim().toLocaleLowerCase())),_=t=>`/api/production/skills/${encodeURIComponent(e)}/styles/${encodeURIComponent(t.visual_style_id)}/preview`;(0,l.useEffect)(()=>{d?m.current?.showModal():m.current?.close()},[d]);function v(e){i?.(e),f(null)}return(0,U.jsxs)(`section`,{className:`template-library`,"aria-labelledby":`${a}-title`,children:[(0,U.jsxs)(`div`,{className:`template-library-heading`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{id:`${a}-title`,children:`內建節目樣板`}),(0,U.jsxs)(`p`,{children:[t.length,` 套原創節目樣板,各有自己的故事、剪輯與聲音規則。`]})]}),(0,U.jsx)(ln,{name:`layers`,size:25})]}),(0,U.jsxs)(`div`,{className:`template-toolbar`,children:[(0,U.jsx)(`div`,{className:`template-categories`,role:`group`,"aria-label":`樣板分類`,children:h.map(e=>(0,U.jsx)(`button`,{type:`button`,"aria-pressed":o===e,onClick:()=>s(e),children:e},e))}),(0,U.jsx)(`input`,{type:`search`,"aria-label":`搜尋影片樣板`,placeholder:`搜尋旅遊、開箱、美食…`,value:c,onChange:e=>u(e.target.value)})]}),(0,U.jsxs)(`p`,{className:`template-result-count`,role:`status`,children:[`顯示 `,g.length,` 套`,n&&t.some(e=>e.template_id===n)?` · 已選:${t.find(e=>e.template_id===n).name}`:``]}),(0,U.jsx)(`div`,{className:`template-grid`,children:g.map(e=>(0,U.jsxs)(`article`,{className:`template-card ${n===e.template_id?`is-selected`:``}`,children:[(0,U.jsxs)(`button`,{type:`button`,className:`template-cover`,onClick:()=>f(e),"aria-label":`查看${e.name}示例`,children:[(0,U.jsx)(`img`,{src:_(e),alt:`${e.name}原生元件設計預覽`,loading:`lazy`}),(0,U.jsxs)(`span`,{className:`template-play`,children:[(0,U.jsx)(ln,{name:`play`,size:14}),`動態示例`]}),n===e.template_id&&(0,U.jsxs)(`span`,{className:`template-selected`,children:[(0,U.jsx)(ln,{name:`check`,size:14}),`已選用`]})]}),(0,U.jsxs)(`div`,{className:`template-card-body`,children:[(0,U.jsx)(`span`,{className:`template-category`,children:e.category}),(0,U.jsx)(`h4`,{children:e.name}),(0,U.jsx)(`p`,{children:e.description}),(0,U.jsx)(`div`,{className:`template-tags`,children:e.tags.map(e=>(0,U.jsx)(`span`,{children:e},e))}),(0,U.jsxs)(`div`,{className:`template-card-actions`,children:[(0,U.jsx)(`button`,{type:`button`,className:`button ghost`,onClick:()=>f(e),children:`查看示例`}),i&&(0,U.jsx)(`button`,{type:`button`,className:`button ${n===e.template_id?`ghost`:`secondary`}`,disabled:r||n===e.template_id,onClick:()=>v(e),children:n===e.template_id?`目前樣板`:`使用這套`})]})]})]},e.template_id))}),!g.length&&(0,U.jsxs)(`div`,{className:`template-empty`,children:[(0,U.jsx)(ln,{name:`film`,size:30}),(0,U.jsx)(`p`,{children:`沒有符合的樣板,試試其他關鍵字。`}),(0,U.jsx)(`button`,{type:`button`,className:`button secondary`,onClick:()=>{u(``),s(`全部`)},children:`查看全部樣板`})]}),(0,U.jsxs)(`p`,{className:`prompt-draft-hint`,children:[`每套示例展示片頭、章節、資訊與重點反應,皆為原創插畫與無聲動畫。正式影片會使用你的素材與配樂;`,i?`選樣板不會啟動製作。`:`建立作品後,在「新片設定」選用。`]}),(0,U.jsx)(`dialog`,{className:`template-dialog`,ref:m,"aria-labelledby":`${a}-sample-title`,onCancel:e=>{e.preventDefault(),f(null)},onClose:()=>f(null),children:d&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`template-dialog-heading`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`span`,{className:`studio-section-number`,children:d.category}),(0,U.jsx)(`h3`,{id:`${a}-sample-title`,children:d.name})]}),(0,U.jsx)(`button`,{type:`button`,className:`button ghost`,onClick:()=>f(null),"aria-label":`關閉樣板示例`,children:`關閉 ×`})]}),(0,U.jsx)(`video`,{controls:!0,autoPlay:!p,muted:!0,loop:!0,playsInline:!0,preload:`metadata`,poster:_(d),src:`/api/production/skills/${encodeURIComponent(e)}/templates/${encodeURIComponent(d.template_id)}/sample`,"aria-label":`${d.name}動態元件示例`},d.template_id),(0,U.jsxs)(`div`,{className:`template-sample-chapters`,"aria-label":`示例段落`,children:[(0,U.jsx)(`span`,{children:`00–02 片頭識別`}),(0,U.jsx)(`span`,{children:`02–04 章節帶入`}),(0,U.jsx)(`span`,{children:`04–06 資訊標註`}),(0,U.jsx)(`span`,{children:`06–08 重點反應`})]}),(0,U.jsxs)(`div`,{className:`template-dialog-copy`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h4`,{children:`這套樣板怎麼說故事?`}),(0,U.jsx)(`p`,{children:d.editorial_direction}),(0,U.jsxs)(`p`,{children:[`配樂方向:`,d.music_direction]}),(0,U.jsx)(`div`,{className:`template-tags`,children:d.tags.map(e=>(0,U.jsx)(`span`,{children:e},e))}),(0,U.jsxs)(`p`,{className:`prompt-draft-hint`,children:[d.sample_duration_seconds??3,` 秒無聲設計示例,正式影片會依你的內容安排。`]})]}),i&&(0,U.jsxs)(`button`,{type:`button`,className:`button primary`,disabled:r,onClick:()=>v(d),children:[(0,U.jsx)(ln,{name:`check`}),`使用這套樣板`]})]}),!!d.references?.length&&(0,U.jsxs)(`details`,{className:`template-references`,children:[(0,U.jsx)(`summary`,{children:`設計參考與轉化`}),(0,U.jsx)(`p`,{children:`參考創作者的節目包裝原則,字體搭配、圖形與動畫由 Clipen 重新設計。`}),(0,U.jsx)(`ul`,{children:d.references.map(e=>(0,U.jsxs)(`li`,{children:[(0,U.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,children:[e.creator,` · `,e.title,` ↗`]}),(0,U.jsx)(`p`,{children:e.takeaway})]},e.url))})]})]})})]})}function dn({skills:e,skillId:t,templateId:n,disabled:r,onChoose:i}){let a=(0,l.useId)(),o=e.find(e=>e.templates?.length),s=e.find(e=>e.kind===`genre`),c=e.filter(e=>e.source===`custom`),u=n?o?.templates?.find(e=>e.template_id===n):void 0,d=u?u.name:e.find(e=>e.skill_id===t)?.name;function f(e){o&&i({skillId:o.skill_id,templateId:e.template_id,visualStyleId:e.visual_style_id,fontStyleId:e.font_style_id})}function p(e){i({skillId:e.skill_id,templateId:``,visualStyleId:e.selected_visual_style_id??`variety`,fontStyleId:e.selected_font_style_id??`default`,defaultDurationSeconds:e.default_duration_seconds})}return(0,U.jsxs)(`section`,{className:`skill-picker`,"aria-labelledby":`${a}-title`,children:[(0,U.jsxs)(`div`,{className:`skill-picker-heading`,children:[(0,U.jsx)(`h3`,{id:`${a}-title`,children:`選一個剪輯樣板`}),(0,U.jsxs)(`p`,{children:[`目前選用:`,(0,U.jsx)(`strong`,{children:d??`尚未選擇`}),`。樣板決定故事、節奏、字幕與畫面,你寫的需求永遠優先。`]})]}),c.length>0&&(0,U.jsxs)(`div`,{className:`skill-picker-mine`,children:[(0,U.jsx)(`h4`,{children:`我的樣板`}),(0,U.jsx)(`div`,{className:`skill-grid`,children:c.map(e=>{let n=e.skill_id===t&&!u;return(0,U.jsxs)(`article`,{className:`skill-card ${n?`is-selected`:``}`,children:[(0,U.jsx)(`h3`,{children:e.name}),e.description&&(0,U.jsx)(`p`,{children:e.description}),(0,U.jsx)(`div`,{className:`skill-actions`,children:(0,U.jsx)(`button`,{type:`button`,className:`button ${n?`secondary`:`primary`}`,disabled:r||n,onClick:()=>p(e),children:n?`目前樣板`:`使用這套`})})]},e.skill_id)})})]}),o&&(0,U.jsx)(un,{skillId:o.skill_id,templates:o.templates??[],selectedId:u?u.template_id:``,disabled:r,onSelect:f}),s&&(0,U.jsx)(`p`,{className:`skill-picker-basic`,children:s.skill_id===t&&!u?`目前不使用樣板,採用基本的旅遊節目設定。`:(0,U.jsx)(`button`,{type:`button`,className:`link-button`,disabled:r,onClick:()=>p(s),children:`不使用樣板,採用基本設定`})})]})}function fn({projectId:e,csrf:t,brief:n,sourceReady:r}){let i=Ae(),[a,o]=(0,l.useState)([]),[s,c]=(0,l.useState)(``),[u,d]=(0,l.useState)(`travel-program`),[f,p]=(0,l.useState)(`tpl-travel-vlog`),[g,_]=(0,l.useState)(`travel-vlog`),[v,y]=(0,l.useState)(`variety-tw`),[b,x]=(0,l.useState)(`10`),S=Math.round(Number(b)*60),C=b.trim()!==``&&Number.isFinite(S)&&S>=30&&S<=1200,[w,T]=dt(e,`production`,n||`以人物對話與實際體驗串起一段旅遊節目,有清楚故事、節目字幕、配樂、適合的轉場、節目主標、動態大字與有設計感的畫面內動畫。保留人物與現場,不使用獨立字卡代替敘事。`),[E,D]=(0,l.useState)(null),[O,ee]=(0,l.useState)(!1),[k,A]=(0,l.useState)(!1),[j,te]=(0,l.useState)(`overview`),[ne,re]=(0,l.useState)(!1),P=(0,l.useRef)(null),[F,I]=(0,l.useState)(!1),[ie,L]=(0,l.useState)(null),[R,ae]=(0,l.useState)(!0),[oe,se]=(0,l.useState)(!1),[ce,ue]=(0,l.useState)(0),z=!!(E?.latest_run&&[`queued`,`running`].includes(E.latest_run.state));(0,l.useEffect)(()=>{let e=!1;return m().then(t=>{e||o(t)}).catch(t=>{e||L(String(t))}),()=>{e=!0}},[e]),(0,l.useEffect)(()=>{let t=!1,n,r=async()=>{let i=!1;try{let n=await M(e);if(t)return;D(n),se(!1),c(e=>e||n.production?.intent.music_choice?.asset_id||``),i=!!(n.latest_run&&([`queued`,`running`].includes(n.latest_run.state)||n.latest_run.state===`succeeded`&&n.latest_run.provider_attempt_id===null))||!!n.production?.local_jobs.some(e=>e.state===`running`)||!!(n.production?.preview&&[`queued`,`running`].includes(n.production.preview.state))}catch{if(t)return;se(!0),i=!0}finally{t||(ae(!1),i&&(n=window.setTimeout(()=>void r(),3e3)))}};return r(),()=>{t=!0,window.clearTimeout(n)}},[e,ce]);async function de(){if(!(F||R||oe||z||!O||!r||!w.trim()||!C)){I(!0),L(null);try{await h(t,e,u,w,f,v,S,s||void 0,g||void 0),D(await M(e)),ee(!1),A(!1),te(`overview`)}catch(e){se(!0),L(e instanceof Error?e.message:`無法確認是否已啟動,正在重新讀取狀態。`)}finally{I(!1),ue(e=>e+1)}}}async function fe(){if(!(!E?.latest_run||F||z)){I(!0),L(null);try{await le(t,e,E.latest_run.run_id),D(await M(e)),A(!1),te(`overview`)}catch(e){L(e instanceof Error?e.message:`無法接續製作。`)}finally{I(!1),ue(e=>e+1)}}}async function pe(){if(!(!E?.latest_run||F)){I(!0),L(null);try{await N(t,e,E.latest_run.run_id),D(await M(e))}catch(e){L(e instanceof Error?e.message:`無法取消製作。`)}finally{I(!1),ue(e=>e+1)}}}let B=E?.production,me=B?E?.latest_run:null,he=B?.preview,ge=B?.finished_preview??null,_e=B?.draft_preview??null,ve=!!(_e&&(ne||!ge)),ye=he?.state===`succeeded`?he:B?.last_successful_preview??he,V=ve?_e:ge??ye,be=ve?_e?.version:V===ge?ge?.version:null,xe=!ve&&V?.state===`succeeded`&&V.render_id!==he?.render_id&&!_e,H=B?.draft.timeline,Se=H?.tracks.filter(e=>e.track_id===`program-components`||e.track_id.startsWith(`program-components-`)).reduce((e,t)=>e+t.items.length,0)??0,Ce=H?.tracks.find(e=>e.track_id===`agent-subtitles`)?.items.length??0,we=H?H.duration_frames*H.frame_rate.den/H.frame_rate.num:0;(0,l.useEffect)(()=>{j!==`overview`&&P.current?.pause()},[j]);function Te(){if(!B)return;let e=B.skill.selected_visual_style_id??`tpl-travel-vlog`,t=a.find(e=>e.skill_id===B.skill.skill_id)??a.find(t=>t.visual_styles?.some(t=>t.visual_style_id===e));if(!t){L(`目前影片的樣板已無法用於新製作,請選擇其他樣板。`);return}d(t.skill_id),p(e),_(t.templates?.find(t=>t.visual_style_id===e)?.template_id??``),y(B.skill.selected_font_style_id??`default`),x(String(Number(((B.intent.target_duration_seconds??60)/60).toFixed(3)))),T(B.intent.brief),c(B.intent.music_choice?.asset_id??``),ee(!1)}return(0,U.jsxs)(`section`,{className:`production-workspace`,"aria-labelledby":`production-heading`,onPlayCapture:e=>{e.currentTarget.querySelectorAll(`video`).forEach(t=>{t!==e.target&&t.pause()})},children:[(0,U.jsx)(`h2`,{id:`production-heading`,className:`sr-only`,children:`AI 節目製作`}),B&&(0,U.jsx)(`nav`,{className:`studio-view-nav`,"aria-label":`製作工作區`,children:[[`overview`,`影片總覽`,`play`],[`edit`,`審片修改`,`edit`],[`new`,`新片設定`,`plus`]].map(([e,t,n])=>(0,U.jsxs)(`button`,{type:`button`,"aria-pressed":j===e,onClick:()=>{te(e),e===`new`&&A(!0)},children:[(0,U.jsx)(ln,{name:n}),t]},e))}),ie&&(0,U.jsx)(`p`,{className:`inline-message error`,role:`alert`,children:ie}),R&&(0,U.jsx)(`p`,{role:`status`,children:`正在讀取製作工作…`}),oe&&(0,U.jsxs)(`div`,{className:`production-connection-notice`,role:`status`,children:[(0,U.jsx)(`strong`,{children:`暫時讀不到最新製作狀態`}),(0,U.jsx)(`p`,{children:`以下保留上次讀取的資料;這不代表 AI 已停止。正在自動重新連線。`}),(0,U.jsx)(`button`,{type:`button`,className:`button secondary`,onClick:()=>ue(e=>e+1),children:`立即重試連線`})]}),E?.production&&(j===`overview`||z||[`failed`,`interrupted`].includes(me?.state??``))&&(0,U.jsx)(at,{status:E,busy:F,compact:j!==`overview`,onView:()=>te(`overview`),onRefine:H&&H.duration_frames>0?()=>te(`edit`):void 0,onResume:()=>void fe(),onCancel:()=>void pe(),onRefresh:()=>ue(e=>e+1),onEdit:()=>{ee(!1),A(!0),te(`new`),window.requestAnimationFrame(()=>document.getElementById(`production-intent`)?.focus())}}),B&&(0,U.jsxs)(`div`,{className:`production-output studio-screen`,id:`production-output`,tabIndex:-1,hidden:j!==`overview`,children:[(0,U.jsxs)(`div`,{className:`screen-heading`,children:[(0,U.jsx)(`h3`,{children:`你的影片`}),(0,U.jsxs)(`span`,{className:`studio-version`,children:[Math.floor(we/60),`:`,String(Math.round(we%60)).padStart(2,`0`)]})]}),V?.state===`succeeded`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`film-version-bar ${ve?`is-draft`:``}`,role:`status`,children:[(0,U.jsxs)(`span`,{className:`film-version-now`,children:[`正在看:`,(0,U.jsx)(`strong`,{children:ve?`未完成的草稿${_e?.version?.kind===`ai_partial`?`(${_e.version.label})`:``}`:ge&&V===ge?`完成的版本${ge.version?`(${ge.version.label})`:``}`:V.stale||xe?`先前的版本`:`目前的預覽`}),be&&(0,U.jsx)(`small`,{children:_t(be.created_at)})]}),(0,U.jsx)(`span`,{className:`film-version-why`,children:ve?z?`AI 還在製作,畫面可能只改了一部分。`:`AI 沒做完這一輪的檢查,畫面可能只改了一部分。`:_e?z?`AI 製作中,有一份新的草稿。`:`有一份比這版新、但還沒做完的草稿。`:xe?he&&[`queued`,`running`].includes(he.state)?`新的影片正在輸出。`:`最新一次輸出沒有完成。`:V.stale?`之後的修改還沒輸出成影片。`:``}),ve&&ge&&(0,U.jsx)(`button`,{type:`button`,className:`button ghost`,onClick:()=>re(!1),children:`回到完成的版本`}),!ve&&_e&&(0,U.jsx)(`button`,{type:`button`,className:`button ghost`,onClick:()=>re(!0),children:`看草稿`})]}),(0,U.jsx)(`video`,{ref:P,controls:!0,preload:`metadata`,src:V.media_url,"aria-label":`影片預覽`},V.render_id),(0,U.jsxs)(`div`,{className:`screen-actions`,children:[(0,U.jsxs)(`a`,{className:`button secondary`,href:V.media_url,download:!0,children:[(0,U.jsx)(ln,{name:`download`}),`下載這版影片`]}),(0,U.jsxs)(`button`,{type:`button`,className:`button primary`,onClick:()=>te(`edit`),children:[(0,U.jsx)(ln,{name:`edit`}),`審片並記下修改`]})]})]}):(0,U.jsx)(`p`,{children:V&&[`queued`,`running`].includes(V.state)?`正在合成預覽…`:V?.state===`failed`?`這次預覽輸出失敗,草稿仍保留。`:`AI 尚未產生可觀看預覽。`}),(0,U.jsxs)(`details`,{className:`production-film-info`,children:[(0,U.jsx)(`summary`,{children:`影片資訊與配樂來源`}),(0,U.jsxs)(`p`,{children:[B.skill.name,` · `,B.skill.version]}),(0,U.jsxs)(`p`,{children:[we.toFixed(1),` 秒 · `,Ce,` 段字幕 · `,Se,` 個畫面元件`]}),(0,U.jsx)(`p`,{children:B.draft.summary}),B.production_contents?.music.map((e,t)=>(0,U.jsxs)(`div`,{className:`finishing-music-credit`,children:[(0,U.jsxs)(`strong`,{children:[e.role===`music`?`配樂`:`聲音素材`,`:`,e.name]}),(0,U.jsxs)(`p`,{children:[`音源使用 `,gt(e.source_offset_seconds??0,!0),`–`,gt((e.source_offset_seconds??0)+e.duration_seconds,!0),e.source_duration_seconds==null?``:`/原曲 ${gt(e.source_duration_seconds,!0)}`]}),(0,U.jsxs)(`p`,{children:[e.provenance.creator?`作者:${e.provenance.creator} · `:``,e.provenance.license===`by`?`CC BY ${e.provenance.license_version??``}`:e.provenance.license===`cc0`?`CC0`:e.provenance.license===`user_supplied`?`使用者提供`:e.provenance.license??`授權條件尚未取得`]}),e.provenance.attribution&&(0,U.jsxs)(`p`,{children:[`署名內容:`,e.provenance.attribution]}),e.provenance.changes&&(0,U.jsxs)(`p`,{children:[`使用方式:`,e.provenance.changes]}),e.provenance.source_url&&(0,U.jsx)(`a`,{href:e.provenance.source_url,target:`_blank`,rel:`noreferrer`,children:`曲目來源`}),` `,e.provenance.license_url&&(0,U.jsx)(`a`,{href:e.provenance.license_url,target:`_blank`,rel:`noreferrer`,children:`授權條件`})]},`${e.name}-${t}`)),B.export_url&&(0,U.jsx)(`a`,{className:`button ghost`,href:B.export_url,download:!0,children:`下載剪輯資料`}),me?.usage&&(0,U.jsxs)(`p`,{children:[`最近一次 AI 執行用量:輸入 `,me.usage.input_tokens.toLocaleString(),`、快取輸入 `,me.usage.cached_input_tokens.toLocaleString(),`、輸出 `,me.usage.output_tokens.toLocaleString(),` Tokens。`]}),me&&!me.usage&&(0,U.jsx)(`p`,{children:`實際 AI 用量尚未取得,不代表零用量。`})]})]}),B&&me&&H&&H.duration_frames>0&&(0,U.jsx)(`div`,{hidden:j!==`edit`,children:(0,U.jsx)(en,{visible:j===`edit`,runProvider:me.provider,projectId:e,csrf:t,runId:me.run_id,revisionId:B.draft.revision_id,previews:[he,_e,ge,B.last_successful_preview],aiReview:B.ai_review??null,active:z,onChanged:()=>ue(e=>e+1),musicId:s,onMusicChange:c},me.run_id)}),!R&&(0,U.jsxs)(`details`,{className:`production-editor`,hidden:!!B&&j!==`new`,open:!B||k,onToggle:e=>A(e.currentTarget.open),children:[(0,U.jsx)(`summary`,{children:B?z?`本次製作需求`:`製作下一支影片`:`設定你的影片`}),(0,U.jsxs)(`div`,{className:`production-brief`,children:[B&&!z&&(0,U.jsxs)(`div`,{className:`inline-message`,children:[(0,U.jsx)(`p`,{children:`這裡設定的是下一支新影片,請確認樣板、片長與需求。`}),(0,U.jsx)(`button`,{type:`button`,className:`button secondary`,disabled:F,onClick:Te,children:`沿用目前影片的設定`})]}),z&&B?(0,U.jsxs)(`p`,{className:`skill-picker-active`,children:[`本次使用的剪輯樣板:`,(0,U.jsx)(`strong`,{children:B.skill.name})]}):a.length>0&&(0,U.jsx)(dn,{skills:a,skillId:u,templateId:g,disabled:F,onChoose:e=>{d(e.skillId),_(e.templateId),p(e.visualStyleId),y(e.fontStyleId),e.defaultDurationSeconds&&e.defaultDurationSeconds%60==0&&x(String(e.defaultDurationSeconds/60))}}),(0,U.jsx)(`label`,{htmlFor:`production-duration`,children:`預計片長(分鐘)`}),(0,U.jsx)(`input`,{id:`production-duration`,type:`number`,min:.5,max:20,step:`any`,inputMode:`decimal`,value:z?Number(B?.intent.target_duration_seconds??60)/60:b,disabled:z||F,"aria-describedby":`production-duration-hint`,"aria-invalid":!z&&!C,onChange:e=>x(e.target.value)}),(0,U.jsxs)(`p`,{id:`production-duration-hint`,children:[`可自訂 0.5–20 分鐘,支援小數。`,C?`目標 ${gt(S)},以秒為單位安排。`:``]}),!z&&!C&&(0,U.jsx)(`p`,{className:`inline-message error`,role:`alert`,children:`請輸入 0.5–20 分鐘。`}),(0,U.jsx)(`p`,{className:`inline-message`,children:`畫面上的標題、地點與資訊元件,AI 會依這部片自己設計。想要什麼感覺(例如日系雜誌、手寫筆記、霓虹街頭),直接寫在上面的需求裡。`}),(0,U.jsx)(st,{projectId:e,csrf:t,value:s,onChange:c,disabled:z||F}),(0,U.jsx)(`label`,{htmlFor:`production-intent`,children:`這次想做什麼影片?`}),(0,U.jsx)(`textarea`,{id:`production-intent`,value:z?B?.intent.brief??w:w,maxLength:8e3,rows:4,disabled:!!z||F,onChange:e=>T(e.target.value)}),(0,U.jsx)(sn,{projectId:e,csrf:t,kind:`production`,text:w,onUse:T,disabled:z||F}),!r&&(0,U.jsx)(`p`,{className:`inline-message`,role:`status`,children:`目前無法使用來源素材。請回到「素材」頁確認磁碟位置與檢查結果,再開始製作。`}),!z&&(0,U.jsxs)(U.Fragment,{children:[B&&(0,U.jsx)(`p`,{children:`這會依下方設定製作一支新影片,目前版本會保留。`}),(0,U.jsx)(`p`,{children:C?`製作約 ${gt(S)} 的影片;片長越長,分析、字幕與輸出需要的時間和 AI 額度越多。`:`設定片長後即可開始製作。`}),(0,U.jsx)(Ye,{}),(0,U.jsxs)(`label`,{className:`consent-check`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:O,onChange:e=>ee(e.target.checked)}),(0,U.jsxs)(`span`,{children:[`同意使用 `,i.name,` 額度分析縮圖與口語、依需要下載本機語音功能,並搜尋及下載有來源與授權資料的配樂。原片與音訊留在本機。`]})]}),(0,U.jsx)(`button`,{className:`button primary`,disabled:F||R||oe||!r||!O||!w.trim()||!C||a.length===0,onClick:()=>void de(),children:F?`正在啟動…`:`開始製作`})]})]})]}),E?.result&&E.result.run_id!==E.latest_run?.run_id&&(0,U.jsxs)(`details`,{className:`production-output`,children:[(0,U.jsx)(`summary`,{children:`上一次完成的版本`}),(0,U.jsx)(`p`,{children:`這版已保留供比較,仍需依實際觀看結果驗收。`}),E.result.preview_url&&(0,U.jsx)(`video`,{controls:!0,preload:`metadata`,src:E.result.preview_url,"aria-label":`上一次完成版本`}),E.result.export_url&&(0,U.jsx)(`a`,{href:E.result.export_url,download:!0,children:`下載這版可編輯時間軸`})]})]})}function pn({csrf:e}){let t=(0,l.useId)(),[n,r]=(0,l.useState)([]),[i,a]=(0,l.useState)(!0),[o,s]=(0,l.useState)(!1),[c,u]=(0,l.useState)(null),[m,h]=(0,l.useState)(null),[g,_]=(0,l.useState)(null),[v,y]=(0,l.useState)(0);(0,l.useEffect)(()=>{let e=!1;return d().then(t=>{e||(r(t),u(null))}).catch(t=>{e||u(t instanceof Error?t.message:`無法讀取剪輯樣板。`)}).finally(()=>{e||a(!1)}),()=>{e=!0}},[v]);let b=()=>y(e=>e+1);async function x(){s(!0),u(null),h(null);try{let t=await f(e);t&&(h(t.name),b())}catch(e){u(e instanceof Error?e.message:`無法加入這個樣板。`)}finally{s(!1)}}async function S(t){s(!0),u(null);try{await p(e,t),_(null),h(null),b()}catch(e){u(e instanceof Error?e.message:`無法移除這個樣板。`)}finally{s(!1)}}return(0,U.jsxs)(`section`,{className:`skill-library`,"aria-labelledby":`${t}-title`,children:[(0,U.jsxs)(`div`,{className:`section-title-row`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h2`,{id:`${t}-title`,children:`我的剪輯樣板`}),(0,U.jsx)(`p`,{children:`除了內建的節目樣板,也可以加入別人分享或自己做的剪輯樣板,製作影片時就能選用。`})]}),(0,U.jsxs)(`button`,{type:`button`,className:`button secondary`,disabled:o,onClick:()=>void x(),children:[(0,U.jsx)(ln,{name:`plus`}),o?`請選擇樣板資料夾…`:`加入樣板`]})]}),c&&(0,U.jsx)(`p`,{className:`inline-message error`,role:`alert`,children:c}),m&&(0,U.jsxs)(`p`,{className:`inline-message success`,role:`status`,children:[`已加入「`,m,`」,製作影片時就能選用。`]}),!i&&n.length>0&&(0,U.jsx)(`div`,{className:`skill-grid`,children:n.map(e=>e.state===`ready`?(0,U.jsxs)(`article`,{className:`skill-card`,children:[(0,U.jsx)(`h3`,{children:e.name}),(0,U.jsx)(`p`,{children:e.description}),g===e.skill_id?(0,U.jsxs)(`div`,{className:`skill-confirm`,role:`alert`,children:[(0,U.jsxs)(`p`,{children:[`移除「`,e.name,`」?已經用它做的影片不受影響。`]}),(0,U.jsx)(`button`,{type:`button`,className:`button secondary`,disabled:o,onClick:()=>_(null),children:`取消`}),(0,U.jsx)(`button`,{type:`button`,className:`button danger`,disabled:o,onClick:()=>void S(e.skill_id),children:`移除`})]}):(0,U.jsx)(`div`,{className:`skill-actions`,children:(0,U.jsx)(`button`,{type:`button`,className:`button ghost`,disabled:o,onClick:()=>_(e.skill_id),children:`移除`})})]},e.skill_id):(0,U.jsxs)(`article`,{className:`skill-card is-invalid`,children:[(0,U.jsx)(`h3`,{children:`無法使用的樣板`}),(0,U.jsx)(`p`,{children:e.error}),(0,U.jsx)(`div`,{className:`skill-actions`,children:(0,U.jsx)(`button`,{type:`button`,className:`button ghost`,disabled:o,onClick:()=>void S(e.skill_id),children:`移除`})})]},e.skill_id))})]})}function mn(){let[e,t]=(0,l.useState)(null);return(0,l.useEffect)(()=>{let e=!1;return m().then(n=>{e||t(n.find(e=>e.templates?.length)??null)}).catch(()=>{}),()=>{e=!0}},[]),e?(0,U.jsx)(`div`,{className:`home-templates`,children:(0,U.jsx)(un,{skillId:e.skill_id,templates:e.templates??[],selectedId:``,disabled:!0})}):null}var hn=[{id:`materials`,label:`素材`},{id:`production`,label:`AI 節目製作`}],gn=[{id:`analysis`,label:`逐字稿與片段補充`}];function _n(e,t){return{login_required:`完成 ${t} 登入後再重啟 Clipen。你仍可先建立作品與整理素材位置。`,unsupported:`更新 ${t} CLI 後再重啟 Clipen。本機作品資料不受影響。`,confinement_failed:`安全隔離未通過,因此 Clipen 不會把任何作品資料交給 AI。`,unavailable:`目前找不到 ${t} CLI。你仍可先建立作品與整理素材位置。`}[e]}var vn={available:{label:`可使用`,help:`Clipen 只保存這個位置,不會修改裡面的檔案。`},offline:{label:`磁碟未連接`,help:`重新連接外接磁碟後,Clipen 會再次確認這個位置。`},changed:{label:`位置已改變`,help:`這個路徑現在指向不同資料夾,請重新選擇。`},permission_required:{label:`需要權限`,help:`請重新選擇資料夾,讓 macOS 確認存取。`}},yn={controller_restarted:`Clipen 上次關閉時檢查尚未完成,請重新檢查。`,controller_stopped:`Clipen 關閉時已安全停止檢查,請重新檢查。`,probe_unavailable:`找不到 FFprobe。請先安裝 FFmpeg,再重新檢查。`,probe_unsupported:`目前的 FFprobe 版本不支援這次檢查,請更新 FFmpeg。`,inventory_input_changed:`檢查期間素材位置有變動,請重新檢查。`,root_unavailable:`素材磁碟目前無法使用,請確認磁碟已連接。`,root_changed:`素材位置已改變,請重新選擇資料夾。`,discovery_timeout:`資料夾內容很多,這次檢查已安全停止。請整理後再試一次。`,too_many_files:`資料夾中的檔案超過安全檢查上限,請縮小素材範圍。`,tree_too_deep:`資料夾層級太深,請整理後再試一次。`},bn={entry_unreadable:`無法讀取這個項目`,probe_unsupported:`不支援的媒體格式`,probe_unreadable:`無法讀取媒體資訊`,probe_timeout:`讀取媒體資訊逾時`,probe_changed:`檢查時檔案有變動`,probe_entry_unreadable:`無法讀取檔案`,probe_entry_not_regular:`檔案位置已改變`},xn={controller_restarted:`Clipen 上次關閉時仍在分析。已保存的音訊與逐字稿切塊仍在,可以接續。`,controller_stopped:`Clipen 關閉時已安全停止分析,可以從 checkpoint 接續。`,ffmpeg_unavailable:`找不到 FFmpeg,無法準備語音辨識需要的音訊。`,asr_runtime_unavailable:`本機語音辨識執行環境目前無法使用。`,asr_model_changed:`語音辨識模型內容已改變,為避免混用結果,這次分析已停止。`,scope_changed:`素材檢查結果已改變,請重新確認分析範圍。`,root_changed:`外接磁碟上的素材位置已改變,這次沒有執行語音辨識。請重新檢查素材後再試。`,root_unavailable:`目前無法讀取素材磁碟,這次沒有執行語音辨識。`,preparation_all_items_failed:`所有可分析素材都在語音辨識前失敗,沒有產生可用逐字稿。`},Sn={inventory_required:`請先完成素材檢查。`,preparation_empty:`目前沒有可進行口語分析的影音素材。`,root_unavailable:`目前無法讀取素材磁碟,請確認外接硬碟已連接。`,root_changed:`素材資料夾已改變,請先重新選擇並檢查素材。`},Cn={asr_runtime_create_failed:`無法建立隔離的執行環境,請確認磁碟空間後再試一次。`,asr_runtime_install_failed:`語音辨識元件下載或安裝失敗,請確認網路後再試一次。`,asr_disk_space_insufficient:`磁碟空間不足,請至少保留約 3.5 GB 可用空間後再安裝。`,asr_disk_space_unavailable:`目前無法確認安裝磁碟的可用空間。`,asr_runtime_install_timeout:`安裝時間超過安全上限,已停止這次設定。`,asr_download_failed:`模型下載失敗,請確認網路後再試一次。`,asr_download_verification_failed:`下載的模型未通過完整性驗證,Clipen 沒有啟用它。`,asr_model_invalid:`模型檔案不完整,Clipen 沒有啟用它。`,asr_receipt_invalid:`安裝紀錄不完整,請清除後重新安裝。`,asr_setup_cleanup_failed:`未完成的暫存內容無法清除,請重新啟動 Clipen 再試一次。`};function wn(e){if(e===null)return`大小未知`;if(e<1024)return`${e} B`;let t=[`KB`,`MB`,`GB`,`TB`],n=e/1024,r=t[0];for(let e=1;e<t.length&&n>=1024;e+=1)n/=1024,r=t[e];return`${n>=10?n.toFixed(0):n.toFixed(1)} ${r}`}function Tn(){return new URLSearchParams(window.location.search).get(`project`)}function En(e){return e instanceof Error?e.message:`Clipen 無法完成這次操作。`}function Dn(e){let t=new Date(e);return Number.isNaN(t.getTime())?`最近更新`:new Intl.DateTimeFormat(`zh-TW`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}).format(t)}function On({status:e}){return e.provider.state===`ready`?null:(0,U.jsxs)(`aside`,{className:`provider-notice`,role:`status`,children:[(0,U.jsx)(`span`,{className:`notice-symbol`,"aria-hidden":`true`,children:`!`}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:e.provider.message}),(0,U.jsx)(`p`,{children:_n(e.provider.state,e.provider.name)})]})]})}function kn({csrf:e,onCreated:t,onCancel:n}){let[r,i]=(0,l.useState)(``),[a,o]=(0,l.useState)(!1),[s,c]=(0,l.useState)(null);async function u(n){if(n.preventDefault(),!(!r.trim()||a)){o(!0),c(null);try{t(await T(e,r))}catch(e){c(En(e))}finally{o(!1)}}}return(0,U.jsxs)(`section`,{className:`create-panel`,"aria-labelledby":`create-title`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`eyebrow`,children:`建立作品`}),(0,U.jsx)(`h2`,{id:`create-title`,children:`先替這次剪輯取個名字`}),(0,U.jsx)(`p`,{children:`建立後再選擇毛片、參考作品並填寫剪輯需求。`})]}),(0,U.jsxs)(`form`,{onSubmit:u,children:[(0,U.jsx)(`label`,{htmlFor:`project-name`,children:`作品名稱`}),(0,U.jsx)(`input`,{id:`project-name`,autoFocus:!0,maxLength:120,placeholder:`例如:手沖咖啡教學`,value:r,onChange:e=>i(e.target.value)}),s&&(0,U.jsx)(`p`,{className:`form-error`,role:`alert`,children:s}),(0,U.jsxs)(`div`,{className:`form-actions`,children:[(0,U.jsx)(`button`,{type:`button`,className:`button secondary`,onClick:n,disabled:a,children:`取消`}),(0,U.jsx)(`button`,{type:`submit`,className:`button primary`,disabled:!r.trim()||a,children:a?`正在建立…`:`建立作品`})]})]})]})}function An({projects:e,csrf:t,onProjects:n,onOpen:r}){let[i,a]=(0,l.useState)(!1);function o(t){n([t,...e.filter(e=>e.project_id!==t.project_id)]),r(t)}return(0,U.jsxs)(`main`,{className:`home-main`,children:[(0,U.jsxs)(`section`,{className:`home-heading`,children:[(0,U.jsx)(`div`,{children:(0,U.jsx)(`h1`,{children:`你的作品`})}),!i&&e.length>0&&(0,U.jsxs)(`button`,{className:`button primary create-button`,onClick:()=>a(!0),children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,children:`+`}),` 建立作品`]})]}),i&&(0,U.jsx)(kn,{csrf:t,onCreated:o,onCancel:()=>a(!1)}),!i&&e.length===0&&(0,U.jsxs)(`section`,{className:`empty-projects`,"aria-labelledby":`empty-title`,children:[(0,U.jsx)(`div`,{className:`empty-mark`,"aria-hidden":`true`,children:(0,U.jsx)(`span`,{})}),(0,U.jsx)(`h2`,{id:`empty-title`,children:`還沒有作品`}),(0,U.jsx)(`p`,{children:`選好素材、定下風格,開始你的第一支影片。`}),(0,U.jsx)(`button`,{className:`button primary`,onClick:()=>a(!0),children:`建立第一個作品`})]}),!i&&e.length>0&&(0,U.jsxs)(`section`,{className:`project-section`,"aria-labelledby":`project-list-title`,children:[(0,U.jsxs)(`div`,{className:`section-title-row`,children:[(0,U.jsx)(`h2`,{id:`project-list-title`,children:`最近作品`}),(0,U.jsxs)(`span`,{children:[e.length,` 個作品`]})]}),(0,U.jsx)(`div`,{className:`project-grid`,children:e.map(e=>{let t=e.directories.find(e=>e.role===`source`);return(0,U.jsxs)(`button`,{className:`project-card`,onClick:()=>r(e),children:[(0,U.jsx)(jn,{projectId:e.project_id,version:e.last_activity_at??e.updated_at}),(0,U.jsx)(`strong`,{children:e.name}),(0,U.jsx)(`span`,{className:`project-next`,children:t?`開啟作品`:`下一步:選擇毛片資料夾`}),(0,U.jsxs)(`span`,{className:`project-time`,children:[`最近活動:`,Dn(e.last_activity_at??e.updated_at)]})]},e.project_id)})})]}),!i&&(0,U.jsx)(mn,{}),!i&&(0,U.jsx)(pn,{csrf:t})]})}function jn({projectId:e,version:t}){let[n,r]=(0,l.useState)(null),i=n!==t;return(0,U.jsx)(`span`,{className:`project-cover ${i?`has-still`:``}`,"aria-hidden":`true`,children:i?(0,U.jsx)(`img`,{src:`/api/projects/${e}/cover?v=${encodeURIComponent(t)}`,alt:``,loading:`lazy`,onError:()=>r(t)}):(0,U.jsx)(ln,{name:`film`,size:32})})}function Mn({role:e,reference:t,busy:n,onChoose:r,onRemove:i}){let a=e===`source`,o=t?vn[t.availability]:null;return(0,U.jsxs)(`article`,{className:`directory-card ${t?`has-directory`:``}`,children:[(0,U.jsx)(`div`,{className:`directory-icon`,"aria-hidden":`true`,children:(0,U.jsx)(`span`,{})}),(0,U.jsxs)(`div`,{className:`directory-content`,children:[(0,U.jsxs)(`div`,{className:`directory-title-row`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{children:a?`毛片資料夾`:`參考作品資料夾`}),(0,U.jsx)(`p`,{children:a?`剪輯會使用的原始影片與聲音`:`用來理解風格,可稍後再加入`})]}),t&&(0,U.jsx)(`span`,{className:`availability ${t.availability}`,children:o?.label})]}),t?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`selected-path`,children:[(0,U.jsx)(`strong`,{children:t.display_name}),(0,U.jsx)(`span`,{title:t.display_path,children:t.display_path})]}),(0,U.jsx)(`p`,{className:`directory-help`,children:o?.help}),(0,U.jsxs)(`div`,{className:`directory-actions`,children:[(0,U.jsx)(`button`,{className:`text-button`,onClick:r,disabled:n,children:n?`等待選擇…`:`重新選擇`}),(0,U.jsx)(`button`,{className:`text-button danger`,onClick:i,disabled:n,children:`移除引用`})]})]}):(0,U.jsx)(`button`,{className:`button secondary choose-button`,onClick:r,disabled:n,children:n?`請在 macOS 視窗選擇…`:a?`選擇毛片資料夾`:`選擇參考資料夾`})]})]})}function Nn({summary:e,page:t,loading:n,sourceReady:r,actionBusy:i,onStart:a,onCancel:o,onLoadMore:s,loadingMore:c,loadMoreError:l}){let u=e?.latest??null,d=e?.current??null,f=u!==null&&[`queued`,`running`,`cancelling`].includes(u.state),p=u!==null&&[`failed`,`cancelled`,`interrupted`].includes(u.state),m=t?.items.filter(e=>e.status!==`ignored`)??[];return(0,U.jsxs)(`section`,{className:`inventory-section`,"aria-labelledby":`inventory-title`,children:[(0,U.jsxs)(`div`,{className:`inventory-heading`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`eyebrow`,children:`下一步`}),(0,U.jsx)(`h2`,{id:`inventory-title`,children:`檢查素材是否可用`}),(0,U.jsx)(`p`,{children:`Clipen 會讀取媒體格式、長度與影音軌資訊。這次不會呼叫 AI,也不會修改或複製任何素材。`})]}),!f&&(0,U.jsx)(`button`,{className:`button primary`,onClick:a,disabled:!(r&&!i&&!f),children:i?`正在準備…`:u?`重新檢查素材`:`檢查素材`})]}),!r&&(0,U.jsxs)(`div`,{className:`inventory-empty muted-state`,children:[(0,U.jsx)(`strong`,{children:d?`重新確認毛片資料夾`:`先選擇可使用的毛片資料夾`}),(0,U.jsx)(`p`,{children:d?`先前的檢查結果已暫時隱藏,重新選擇並檢查後才會用於後續分析。`:`完成上方的毛片位置設定後,就能開始檢查。`})]}),r&&n&&!e&&(0,U.jsxs)(`div`,{className:`inventory-empty`,role:`status`,children:[(0,U.jsx)(`span`,{className:`small-spinner`,"aria-hidden":`true`}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:`正在讀取上次檢查狀態`}),(0,U.jsx)(`p`,{children:`素材尚未被重新讀取。`})]})]}),r&&!n&&!u&&(0,U.jsxs)(`div`,{className:`inventory-empty`,children:[(0,U.jsx)(`span`,{className:`inventory-mark`,"aria-hidden":`true`}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:`尚未檢查素材`}),(0,U.jsx)(`p`,{children:`按下「檢查素材」後,這裡會即時顯示進度與需要處理的檔案。`})]})]}),u&&f&&(0,U.jsxs)(`div`,{className:`inventory-progress`,role:`status`,"aria-live":`polite`,children:[(0,U.jsxs)(`div`,{className:`progress-main`,children:[(0,U.jsx)(`span`,{className:`small-spinner`,"aria-hidden":`true`}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:u.state===`cancelling`?`正在安全停止…`:`正在檢查素材…`}),(0,U.jsxs)(`p`,{children:[`已找到 `,u.counts.discovered.toLocaleString(),` 個檔案,已讀取 `,u.counts.probed.toLocaleString(),` 個媒體資訊。`]})]})]}),(0,U.jsx)(`button`,{className:`button secondary`,onClick:()=>o(u),disabled:i||u.state===`cancelling`,children:u.state===`cancelling`?`停止中…`:`停止檢查`})]}),u&&p&&(0,U.jsxs)(`div`,{className:`inventory-outcome ${u.state===`failed`?`has-error`:``}`,role:`status`,children:[(0,U.jsx)(`span`,{className:`outcome-symbol`,"aria-hidden":`true`,children:u.state===`failed`?`!`:`×`}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:u.state===`failed`?`這次檢查沒有完成`:u.state===`cancelled`?`檢查已取消`:`檢查已安全中斷`}),(0,U.jsx)(`p`,{children:u.error_code?yn[u.error_code]??`Clipen 無法完成這次素材檢查,請重新試一次。`:`素材沒有被修改,你可以隨時重新檢查。`}),d&&d.run_id!==u.run_id&&(0,U.jsx)(`small`,{children:`下方仍保留上次成功的檢查結果。`})]})]}),d&&r&&(0,U.jsxs)(`div`,{className:`inventory-results`,children:[(0,U.jsxs)(`div`,{className:`result-title-row`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:d.counts.issues?`素材已檢查,部分檔案需要注意`:`素材已準備好`}),(0,U.jsxs)(`p`,{children:[d.counts.discovered.toLocaleString(),` 個檔案完成整理`]})]}),(0,U.jsx)(`span`,{className:`result-ready`,children:`檢查完成`})]}),(0,U.jsxs)(`div`,{className:`inventory-counts`,"aria-label":`素材檢查摘要`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:d.counts.usable.toLocaleString()}),(0,U.jsx)(`span`,{children:`可使用媒體`})]}),(0,U.jsxs)(`div`,{className:d.counts.issues?`attention`:``,children:[(0,U.jsx)(`strong`,{children:d.counts.issues.toLocaleString()}),(0,U.jsx)(`span`,{children:`需要注意`})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:d.counts.ignored.toLocaleString()}),(0,U.jsx)(`span`,{children:`略過的其他檔案`})]})]}),t&&t.total>0&&(0,U.jsxs)(`details`,{className:`asset-list`,children:[(0,U.jsxs)(`summary`,{className:`asset-list-heading`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:`查看媒體清單`}),(0,U.jsx)(`span`,{children:`只有需要找特定檔案時才需要展開`})]}),(0,U.jsxs)(`span`,{children:[`顯示 `,m.length.toLocaleString(),` 個媒體 · 已讀取 `,t.items.length.toLocaleString(),` / `,t.total.toLocaleString(),` 筆`]})]}),(0,U.jsxs)(`div`,{className:`asset-list-content`,children:[m.map(e=>{let t=e.probe?.duration_seconds,n=[...new Set(e.streams.map(e=>e.codec))].join(` · `);return(0,U.jsxs)(`div`,{className:`asset-row ${e.status}`,children:[(0,U.jsx)(`span`,{className:`asset-kind ${e.kind}`,"aria-hidden":`true`,children:e.kind===`video`?`V`:e.kind===`audio`?`A`:`I`}),(0,U.jsxs)(`div`,{className:`asset-name`,children:[(0,U.jsx)(`strong`,{children:e.display_name}),(0,U.jsx)(`span`,{title:e.relative_path,children:e.relative_path})]}),(0,U.jsx)(`div`,{className:`asset-detail`,children:e.status===`needs_attention`?(0,U.jsx)(`strong`,{children:e.issue_code?bn[e.issue_code]??`需要確認`:`需要確認`}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{children:typeof t==`string`&&Number.isFinite(Number(t))?`${Number(t).toFixed(1)} 秒`:wn(e.size_bytes)}),n&&(0,U.jsx)(`span`,{children:n})]})})]},e.asset_id)}),t.next_offset!==null&&(0,U.jsx)(`button`,{type:`button`,className:`button secondary`,disabled:c,onClick:s,children:c?`正在載入…`:`載入更多素材`}),l&&(0,U.jsx)(`p`,{role:`alert`,className:`inline-message error`,children:l}),(0,U.jsxs)(`p`,{className:`asset-limit`,children:[`已讀取 `,t.items.length.toLocaleString(),` / `,t.total.toLocaleString(),` 筆;略過的其他檔案不列入媒體清單。`]})]})]})]})]})}function Pn({csrf:e,projectId:t,summary:n,loading:r,actionBusy:i,onStart:a,onCancel:o,onResume:s,onRemoveRuntime:c}){let l=n?.latest??null,u=n?.current??null,d=n?.scope??null,f=l!==null&&[`queued`,`running`,`cancelling`].includes(l.state),p=l?.state===`interrupted`,m=!!(n?.runtime.state===`ready`&&d&&!f&&!p&&!i),h=l&&l.counts.total>0?Math.round((l.counts.transcribed+l.counts.no_audio+l.counts.no_speech+l.counts.issues)/l.counts.total*100):0,g=l?l.counts.transcribed+l.counts.no_audio+l.counts.no_speech+l.counts.issues:0,_=n?.runtime;return(0,U.jsxs)(`section`,{className:`analysis-section`,"aria-labelledby":`analysis-title`,children:[(0,U.jsxs)(`div`,{className:`analysis-heading`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`eyebrow`,children:`02 · 分析`}),(0,U.jsx)(`h2`,{id:`analysis-title`,children:`產生繁體中文逐字稿`}),(0,U.jsx)(`p`,{children:`在本機用原始收音辨識,不確定的段落會標出來讓你核對。`})]}),!f&&!p&&(0,U.jsx)(`button`,{className:`button primary`,onClick:a,disabled:!m,children:i?`正在準備…`:u?`重新分析並取代結果`:`開始分析`})]}),r&&!n&&(0,U.jsxs)(`div`,{className:`analysis-card`,role:`status`,children:[(0,U.jsx)(`span`,{className:`small-spinner`,"aria-hidden":`true`}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:`正在讀取分析狀態`}),(0,U.jsx)(`p`,{children:`尚未開始新的素材處理。`})]})]}),n?.blocked_reason&&(0,U.jsxs)(`div`,{className:`analysis-outcome has-error`,role:`alert`,children:[(0,U.jsx)(`span`,{className:`outcome-symbol`,"aria-hidden":`true`,children:`!`}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:`目前不能開始逐字稿分析`}),(0,U.jsx)(`p`,{children:Sn[n.blocked_reason]??`請先確認素材狀態。`})]})]}),_?.state===`setup_required`&&_.notice&&(0,U.jsxs)(`div`,{className:`analysis-card setup-required runtime-setup`,children:[(0,U.jsx)(`span`,{className:`outcome-symbol`,"aria-hidden":`true`,children:`↓`}),(0,U.jsxs)(`div`,{className:`runtime-setup-content`,children:[(0,U.jsx)(`strong`,{children:`Clipen 完整設定尚未完成`}),(0,U.jsxs)(`p`,{children:[`請關閉 Clipen,回到 Terminal 執行 `,(0,U.jsx)(`code`,{children:`clipen install`}),`。設定會取得同意後一次完成語音辨識環境與模型下載。`]}),(0,U.jsxs)(`dl`,{className:`runtime-facts`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`下載`}),(0,U.jsxs)(`dd`,{children:[`約 `,wn(_.notice.download_bytes)]})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`安裝後`}),(0,U.jsxs)(`dd`,{children:[`約 `,wn(_.notice.installed_bytes)]})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`模型`}),(0,U.jsxs)(`dd`,{children:[_.notice.model.name,` · 固定版本 `,_.notice.model.revision.slice(0,8)]})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`dt`,{children:`位置`}),(0,U.jsx)(`dd`,{title:_.notice.install_location,children:_.notice.install_location})]})]}),(0,U.jsxs)(`p`,{className:`runtime-license`,children:[`MLX Speech 本機程式採用 `,(0,U.jsxs)(`a`,{href:_.notice.license.software_url,target:`_blank`,rel:`noreferrer`,children:[_.notice.license.software,` 授權`]}),`;模型採用 `,(0,U.jsxs)(`a`,{href:_.notice.license.model_url,target:`_blank`,rel:`noreferrer`,children:[_.notice.license.model,` 授權`]}),`。`,_.notice.license.notice]})]})]}),_?.state===`removing`&&(0,U.jsxs)(`div`,{className:`analysis-card`,role:`status`,children:[(0,U.jsx)(`span`,{className:`small-spinner`,"aria-hidden":`true`}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:_.message}),(0,U.jsx)(`p`,{children:`只會移除 Clipen 管理的模型與執行環境。`})]})]}),_?.state===`failed`&&(0,U.jsxs)(`div`,{className:`analysis-outcome has-error runtime-failed`,role:`alert`,children:[(0,U.jsx)(`span`,{className:`outcome-symbol`,"aria-hidden":`true`,children:`!`}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:`本機語音辨識設定沒有完成`}),(0,U.jsx)(`p`,{children:_.error_code?Cn[_.error_code]??_.message:_.message})]}),(0,U.jsx)(`button`,{className:`button secondary`,onClick:c,disabled:i,children:`清除未完成安裝`})]}),n?.runtime.state===`ready`&&d&&!l&&(0,U.jsxs)(`div`,{className:`analysis-card scope-preview`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:`分析範圍已準備好`}),(0,U.jsxs)(`p`,{children:[d.counts.audio_streams,` 條音軌,共約 `,d.duration_seconds,` 秒;預計使用 `,wn(d.estimated_audio_bytes),` 暫存空間。`]})]}),d.counts.no_audio>0&&(0,U.jsxs)(`span`,{children:[d.counts.no_audio,` 個素材沒有音軌,會清楚標記並略過`]})]}),l&&f&&(0,U.jsxs)(`div`,{className:`analysis-progress`,role:`status`,"aria-live":`polite`,children:[(0,U.jsxs)(`div`,{className:`progress-main`,children:[(0,U.jsx)(`span`,{className:`small-spinner`,"aria-hidden":`true`}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:l.state===`cancelling`?`正在保存 checkpoint 並停止…`:`正在辨識人聲並產生繁體中文逐字稿…`}),(0,U.jsxs)(`p`,{children:[`完成 `,h,`% · 已處理 `,g.toLocaleString(),` / `,l.counts.total.toLocaleString(),` 個項目 · `,l.counts.issues,` 個需要注意`]}),h===0&&l.state!==`cancelling`&&(0,U.jsx)(`small`,{children:`第一次辨識會先載入本機模型;弱收音只會有限度重試,避免整批素材雙跑造成過熱。`}),(0,U.jsx)(`progress`,{value:h,max:100,"aria-label":`本機語音辨識進度`})]})]}),(0,U.jsx)(`button`,{className:`button secondary`,onClick:()=>o(l),disabled:i||l.state===`cancelling`,children:l.state===`cancelling`?`停止中…`:`停止分析`})]}),l&&p&&(0,U.jsxs)(`div`,{className:`analysis-outcome interrupted`,children:[(0,U.jsx)(`span`,{className:`outcome-symbol`,"aria-hidden":`true`,children:`↻`}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:`上次分析安全中斷`}),(0,U.jsx)(`p`,{children:l.error_code?xn[l.error_code]??`已完成的 checkpoint 仍保留。`:`已完成的 checkpoint 仍保留。`})]}),(0,U.jsx)(`button`,{className:`button primary`,onClick:()=>s(l),disabled:i,children:i?`正在接續…`:`接續分析`})]}),l&&[`failed`,`cancelled`].includes(l.state)&&(0,U.jsxs)(`div`,{className:`analysis-outcome ${l.state===`failed`?`has-error`:``}`,children:[(0,U.jsx)(`span`,{className:`outcome-symbol`,"aria-hidden":`true`,children:l.state===`failed`?`!`:`×`}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:l.state===`failed`?`這次分析沒有完成`:`分析已取消`}),(0,U.jsx)(`p`,{children:l.error_code?xn[l.error_code]??`請確認本機分析環境後再試一次。`:`毛片沒有被修改,可以重新開始分析。`})]})]}),l&&g>0&&(f||[`failed`,`cancelled`,`interrupted`].includes(l.state))&&(0,U.jsxs)(`div`,{className:`analysis-live-results`,children:[(0,U.jsx)(`strong`,{children:f?`先抽查目前結果`:`查看這次已保存的部分結果`}),(0,U.jsx)(`p`,{children:f?`不必等整批完成;若前幾支逐字稿明顯不對,可以立即停止分析。`:`即使分析停止,已完成的項目仍可用來判斷設定是否合適。`}),(0,U.jsx)(Je,{csrf:e,projectId:t,run:l,refreshToken:g})]}),u&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`analysis-results`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:u.counts.issues?`繁體中文逐字稿已完成,部分素材需要注意`:`繁體中文逐字稿已準備好`}),(0,U.jsx)(`p`,{children:[`${u.counts.transcribed} 個有逐字稿`,u.counts.no_speech?`${u.counts.no_speech} 個沒有人聲`:null,u.counts.no_audio?`${u.counts.no_audio} 個沒有音軌`:null,u.counts.issues?`${u.counts.issues} 個需要處理`:null].filter(Boolean).join(` · `)}),(0,U.jsx)(`p`,{className:`analysis-replace-note`,children:`重新分析會取代這份逐字稿,毛片不受影響。`})]}),(0,U.jsx)(`span`,{className:`result-ready`,children:`分析完成`})]}),(0,U.jsx)(Je,{csrf:e,projectId:t,run:u},u.run_id)]}),_?.state===`ready`&&!f&&(0,U.jsxs)(`details`,{className:`runtime-settings`,children:[(0,U.jsx)(`summary`,{children:`本機語音辨識設定`}),(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`p`,{children:[_.message,`。移除只會刪除 Clipen 管理的模型與執行環境,不會碰素材或逐字稿。`]}),(0,U.jsx)(`button`,{className:`text-button danger`,onClick:c,disabled:i,children:`移除本機語音辨識`})]})]})]})}function Fn({project:e,csrf:t,onProject:n,onBack:r,onDeleted:i}){let[a,o]=(0,l.useState)(e.name),[s,c]=(0,l.useState)(e.brief),[u,d]=(0,l.useState)(!1),[f,p]=(0,l.useState)(``),[m,h]=(0,l.useState)(null),[_,v]=(0,l.useState)(!1),[y,b]=(0,l.useState)(!1),[x,S]=(0,l.useState)(null),[C,T]=(0,l.useState)(null),[M,N]=(0,l.useState)(null),[P,F]=(0,l.useState)(null),[I,ie]=(0,l.useState)(null),[se,ce]=(0,l.useState)(!1),[le,ue]=(0,l.useState)(null),[z,de]=(0,l.useState)(!0),[fe,pe]=(0,l.useState)(!1),[B,me]=(0,l.useState)(null),[he,ge]=(0,l.useState)(!1),[_e,ve]=(0,l.useState)(null);function ye(e){if(!Ee(e)){ve(`materials`),N(null),T(V?.availability===`available`?`先按下方的「檢查素材」,完成後就能使用這一步。`:`先選擇毛片資料夾並按「檢查素材」,完成後就能使用這一步。`),document.getElementById(`inventory-title`)?.scrollIntoView({behavior:`smooth`,block:`center`});return}ve(e),window.scrollTo(0,0)}let V=e.directories.find(e=>e.role===`source`),be=e.directories.find(e=>e.role===`reference`);(0,l.useEffect)(()=>{let t=!0;return A(e.project_id).then(e=>{t&&F(e)}).catch(e=>{t&&N(En(e))}).finally(()=>{t&&de(!1)}),()=>{t=!1}},[e.project_id,e.revision]);let xe=P?.latest?.state;(0,l.useEffect)(()=>{if(!xe||![`queued`,`running`,`cancelling`].includes(xe))return;let t=!0,n=window.setInterval(()=>{A(e.project_id).then(e=>{t&&F(e)}).catch(()=>{})},650);return()=>{t=!1,window.clearInterval(n)}},[xe,e.project_id]);let H=V?.availability===`available`?P?.current?.run_id:void 0;(0,l.useEffect)(()=>{if(!H)return;let t=!0;return j(e.project_id,H).then(e=>{t&&(ie(e),ue(null))}).catch(e=>{t&&N(En(e))}),()=>{t=!1}},[H,e.project_id]);let Se=I?.inventory.run_id===H?I:null;async function Ce(){let t=Se?.next_offset;if(!H||t==null||se)return;let n=H;ce(!0),ue(null);try{let r=await j(e.project_id,n,t);ie(e=>e?.inventory.run_id===n&&e.next_offset===t?{...r,offset:0,items:[...e.items,...r.items]}:e)}catch(e){ue(En(e))}finally{ce(!1)}}(0,l.useEffect)(()=>{if(!H)return;let t=!0;return re(e.project_id).then(e=>{t&&me(e)}).catch(e=>{t&&N(En(e))}),()=>{t=!1}},[H,e.project_id]);let we=B&&(B.scope?.inventory_run_id===H||B.latest?.inventory_run_id===H||B.current?.inventory_run_id===H)?B:null,Te=H?`production`:`materials`;function Ee(e){return e===`materials`||!!H}let De=_e&&Ee(_e)?_e:Te,Oe=B?.latest?.state;(0,l.useEffect)(()=>{if(!Oe||![`queued`,`running`,`cancelling`].includes(Oe))return;let t=!0,n=!1,r=()=>{n||(n=!0,re(e.project_id).then(e=>{t&&me(e)}).catch(()=>{}).finally(()=>{n=!1}))},i=B?.latest?.run_id,a=i?new EventSource(`/api/projects/${e.project_id}/analyses/${i}/events`):null;a&&(a.onmessage=r);let o=window.setInterval(r,5e3);return()=>{t=!1,a?.close(),window.clearInterval(o)}},[B?.latest?.run_id,Oe,e.project_id]);let ke=B?.runtime.state;(0,l.useEffect)(()=>{if(ke!==`removing`)return;let t=!0,n=!1,r=window.setInterval(()=>{n||(n=!0,re(e.project_id).then(e=>{t&&me(e)}).catch(()=>{}).finally(()=>{n=!1}))},700);return()=>{t=!1,window.clearInterval(r)}},[e.project_id,ke]);async function Ae(t){if(t instanceof g&&t.code===`revision_conflict`)try{let t=await w(e.project_id);n(t),o(t.name),c(t.brief),v(!1)}catch{}N(En(t))}let je=(0,l.useRef)(0);(0,l.useEffect)(()=>{_&&(je.current+=1)},[_,a,s]);async function Me(){let r=je.current;b(!0),N(null);try{let i=await E(t,e,a,s);v(je.current!==r),n(i)}catch(e){await Ae(e)}finally{b(!1)}}(0,l.useEffect)(()=>{if(!_||!a.trim()||y)return;let e=window.setTimeout(()=>void Me(),900);return()=>window.clearTimeout(e)},[_,a,s,y]);async function Ne(){if(!(fe||!V||V.availability!==`available`)){pe(!0),N(null),T(null);try{let r=e;if(_){if(!a.trim())return;r=await E(t,e,a,s),v(!1),n(r)}let i=await te(t,r);F(e=>({latest:i,current:e?.current??null})),T(`素材檢查已開始,你可以留在這裡查看進度`)}catch(e){await Ae(e)}finally{pe(!1)}}}async function Pe(n){if(!fe){pe(!0),N(null),T(null);try{let r=await ne(t,e.project_id,n.run_id);F(e=>({latest:r,current:e?.current??null}))}catch(e){N(En(e))}finally{pe(!1)}}}async function Fe(){if(!(he||!we?.scope||we.runtime.state!==`ready`)){ge(!0),N(null),T(null);try{let n=await R(t,e,we.scope.scope_id);me(e=>e&&{...e,latest:n,current:null}),T(`新的本機素材分析已開始,舊分析結果已移除;毛片不會被修改`)}catch(e){N(En(e))}finally{ge(!1)}}}async function Le(n){if(!he){ge(!0),N(null);try{let r=await ae(t,e.project_id,n.run_id);me(e=>e&&{...e,latest:r})}catch(e){N(En(e))}finally{ge(!1)}}}async function Re(n){if(!he){ge(!0),N(null);try{let r=await oe(t,e.project_id,n.run_id);me(e=>e&&{...e,latest:r}),T(`已從上次保存的 checkpoint 接續分析`)}catch(e){N(En(e))}finally{ge(!1)}}}async function ze(){if(!he&&window.confirm(`移除 Clipen 管理的本機語音辨識?毛片與已產生的逐字稿不會被刪除。`)){ge(!0),N(null),me(e=>e&&{...e,runtime:{...e.runtime,state:`removing`,phase:`removing`,message:`正在停止分析並移除本機語音辨識…`}});try{let e=await L(t);me(t=>t&&{...t,runtime:e}),T(`本機語音辨識已移除;毛片與分析成果沒有變動,需要時請在 Terminal 執行 clipen install`)}catch(e){N(En(e))}finally{ge(!1)}}}async function Be(){if(!(u||f!==e.name)){d(!0),h(null);try{i(await k(t,e,f))}catch(e){h(En(e)),d(!1)}}}async function Ve(r){if(!x){S(r),N(null),T(null);try{let i=await D(t,r);if(!i)return;n(await O(t,e,r,i.selection_token)),T(r===`source`?`毛片位置已保存`:`參考作品位置已保存`)}catch(e){await Ae(e)}finally{S(null)}}}async function He(r){if(!x){S(r),N(null),T(null);try{n(await ee(t,e,r)),T(`資料夾引用已移除,原始檔案沒有變動`)}catch(e){await Ae(e)}finally{S(null)}}}return(0,U.jsxs)(`main`,{className:`workspace-main`,children:[(0,U.jsxs)(`nav`,{className:`workspace-bar`,"aria-label":`作品階段`,children:[(0,U.jsx)(`button`,{type:`button`,className:`workspace-back`,onClick:r,"aria-label":`回到所有作品`,children:(0,U.jsx)(ln,{name:`arrow-left`,size:16})}),(0,U.jsx)(`strong`,{className:`workspace-name`,children:e.name}),(0,U.jsx)(`ol`,{className:`workspace-steps`,children:hn.map(e=>{let t=Ee(e.id);return(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,"aria-disabled":!t,title:t?void 0:`先選擇毛片資料夾並檢查素材`,className:De===e.id?`is-active`:``,"aria-current":De===e.id?`step`:void 0,onClick:()=>ye(e.id),children:[e.label,e.id===`materials`&&H&&(0,U.jsx)(ln,{name:`check`,size:14})]})},e.id)})}),gn.map(e=>(0,U.jsx)(`button`,{type:`button`,className:`workspace-tool ${De===e.id?`is-active`:``}`,"aria-disabled":!Ee(e.id),title:Ee(e.id)?void 0:`先選擇毛片資料夾並檢查素材`,onClick:()=>ye(e.id),children:e.label},e.id))]}),(0,U.jsx)(`div`,{className:`workspace-layout`,children:(0,U.jsxs)(`section`,{className:`materials-panel`,"aria-label":`作品工作區`,children:[De===`materials`&&(0,U.jsxs)(`div`,{className:`panel-heading`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`eyebrow`,children:`01 · 素材`}),(0,U.jsx)(`h1`,{id:`materials-title`,children:`準備這次剪輯`}),(0,U.jsx)(`p`,{children:`先告訴 Clipen 毛片在哪裡並檢查素材,就能開始 AI 節目製作。檢查與本機分析都不會呼叫 AI;只有明確同意後才會用到 AI 額度。`})]}),(0,U.jsxs)(`div`,{className:`save-state ${_?`unsaved`:``}`,"aria-live":`polite`,children:[(0,U.jsx)(`span`,{"aria-hidden":`true`}),y?`保存中`:_?`尚未保存`:`已保存`]})]}),(M||C)&&(0,U.jsx)(`div`,{className:M?`inline-message error`:`inline-message success`,role:M?`alert`:`status`,children:M??C}),De===`materials`&&(0,U.jsxs)(`div`,{className:`stage-view`,children:[(0,U.jsxs)(`div`,{className:`directory-section`,children:[(0,U.jsx)(`div`,{className:`section-title-row`,children:(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h2`,{children:`素材位置`}),(0,U.jsx)(`p`,{children:`macOS 會讓你親自選擇資料夾;Clipen 不接受手動輸入路徑。`})]})}),(0,U.jsx)(Mn,{role:`source`,reference:V,busy:x===`source`,onChoose:()=>void Ve(`source`),onRemove:()=>void He(`source`)}),(0,U.jsx)(Mn,{role:`reference`,reference:be,busy:x===`reference`,onChoose:()=>void Ve(`reference`),onRemove:()=>void He(`reference`)})]}),(0,U.jsxs)(`div`,{className:`scope-note`,children:[(0,U.jsx)(`span`,{className:`lock-icon`,"aria-hidden":`true`}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`strong`,{children:`目前只保存位置`}),(0,U.jsx)(`p`,{children:`Clipen 不會複製、搬移、重新命名或修改毛片。只有按下下方的「檢查素材」才會開始讀取媒體資訊。`})]})]}),(0,U.jsx)(Nn,{summary:P,page:Se,loading:z,sourceReady:V?.availability===`available`,actionBusy:fe,onStart:()=>void Ne(),onCancel:e=>void Pe(e),onLoadMore:()=>void Ce(),loadingMore:se,loadMoreError:le}),H&&(0,U.jsxs)(`div`,{className:`stage-next`,children:[(0,U.jsx)(`span`,{children:`素材已經整理完成`}),(0,U.jsx)(`button`,{className:`button primary`,type:`button`,onClick:()=>ye(`production`),children:`開始 AI 節目製作`})]}),(0,U.jsxs)(`form`,{className:`project-form`,"aria-labelledby":`project-details-title`,onSubmit:e=>e.preventDefault(),children:[(0,U.jsx)(`h2`,{id:`project-details-title`,children:`作品資料`}),(0,U.jsx)(`label`,{htmlFor:`workspace-name`,children:`作品名稱`}),(0,U.jsx)(`input`,{id:`workspace-name`,maxLength:120,value:a,onChange:e=>{o(e.target.value),v(!0),T(null)}}),(0,U.jsxs)(`label`,{htmlFor:`workspace-brief`,children:[`剪輯需求`,(0,U.jsx)(`small`,{children:`選填,開始製作時還能再改`})]}),(0,U.jsx)(`textarea`,{id:`workspace-brief`,maxLength:8e3,rows:5,placeholder:`例如:剪成 30 秒的手沖教學,步驟清楚、節奏俐落,保留沖水聲。`,value:s,onChange:e=>{c(e.target.value),v(!0),T(null)}}),(0,U.jsxs)(`div`,{className:`form-footer`,children:[(0,U.jsxs)(`span`,{children:[s.length.toLocaleString(),` / 8,000`]}),(0,U.jsx)(`span`,{children:a.trim()?`修改會自動保存`:`作品名稱不能空白`})]})]}),(0,U.jsxs)(`section`,{className:`danger-zone`,"aria-labelledby":`delete-project-title`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h2`,{id:`delete-project-title`,children:`刪除作品`}),(0,U.jsx)(`p`,{children:`刪除縮圖、逐字稿、分析與剪輯計畫。毛片、參考作品及工作區其他檔案不會被刪除。`})]}),(0,U.jsxs)(`label`,{htmlFor:`delete-project-confirmation`,children:[`輸入作品名稱「`,e.name,`」以確認`]}),m&&(0,U.jsx)(`p`,{className:`form-error`,role:`alert`,children:m}),(0,U.jsxs)(`div`,{className:`danger-actions`,children:[(0,U.jsx)(`input`,{id:`delete-project-confirmation`,value:f,onChange:e=>p(e.target.value),disabled:u}),(0,U.jsx)(`button`,{className:`button danger-button`,type:`button`,disabled:f!==e.name||u,onClick:()=>void Be(),children:u?`正在刪除…`:`永久刪除作品`})]})]})]}),De===`production`&&H&&(0,U.jsx)(fn,{projectId:e.project_id,csrf:t,brief:e.brief,sourceReady:V?.availability===`available`},e.project_id),De===`analysis`&&H&&(0,U.jsxs)(`div`,{className:`stage-view`,children:[(0,U.jsx)(Ie,{projectId:e.project_id,csrf:t,inventoryId:H},`${e.project_id}:${H}`),(0,U.jsx)(Pn,{csrf:t,projectId:e.project_id,summary:we,loading:!we,actionBusy:he,onStart:()=>void Fe(),onCancel:e=>void Le(e),onResume:e=>void Re(e),onRemoveRuntime:()=>void ze()}),(0,U.jsxs)(`div`,{className:`stage-next`,children:[(0,U.jsx)(`span`,{children:`逐字稿與片段補充會交給 AI 節目製作參考`}),(0,U.jsx)(`button`,{className:`button primary`,type:`button`,onClick:()=>ye(`production`),children:`回到 AI 節目製作`})]})]})]})})]})}function In(){let[e,t]=(0,l.useState)({kind:`connecting`}),[n,r]=(0,l.useState)(Tn());(0,l.useEffect)(()=>{let e=new AbortController;async function n(){try{await y();let[n,r]=await Promise.all([S(),C()]);e.signal.aborted||t({kind:`ready`,status:n,projects:r})}catch(n){e.signal.aborted||t({kind:`failed`,message:En(n),serverUnavailable:!(n instanceof g)})}}return n(),()=>e.abort()},[]),(0,l.useEffect)(()=>{let e=()=>r(Tn());return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]),(0,l.useEffect)(()=>{if(n!==null||e.kind!==`ready`)return;let r=!1;return C().then(e=>{r||t(t=>t.kind===`ready`?{...t,projects:e}:t)}).catch(()=>{}),()=>{r=!0}},[n,e.kind]);let i=(0,l.useMemo)(()=>e.kind===`ready`?e.projects.find(e=>e.project_id===n):void 0,[e,n]);function a(e){let t=e?`/?project=${encodeURIComponent(e.project_id)}`:`/`;window.history.pushState(null,``,t),r(e?.project_id??null)}function o(e){t(t=>{if(t.kind!==`ready`)return t;let n=[e,...t.projects.filter(t=>t.project_id!==e.project_id)];return{...t,projects:n}})}function s(e){t(t=>t.kind===`ready`?{...t,projects:t.projects.filter(t=>t.project_id!==e)}:t),a(null)}let c=e.kind===`ready`,u=c&&e.status.provider.state===`ready`;return(0,U.jsxs)(`div`,{className:`app-shell`,children:[(0,U.jsxs)(`header`,{className:`topbar`,children:[(0,U.jsxs)(`button`,{className:`brand`,onClick:()=>a(null),"aria-label":`Clipen 作品首頁`,children:[(0,U.jsx)(`span`,{className:`brand-mark`,children:(0,U.jsx)(ln,{name:`film`,size:21})}),`clipen`,(0,U.jsx)(`span`,{className:`brand-studio`,children:`STUDIO`})]}),(0,U.jsx)(Oe,{ready:c,providerReady:u,providerName:c?e.status.provider.name:``,label:e.kind===`connecting`?`正在連接`:`連線中斷`})]}),e.kind===`connecting`&&(0,U.jsx)(`main`,{className:`system-main`,children:(0,U.jsxs)(`section`,{className:`system-card`,children:[(0,U.jsx)(`div`,{className:`spinner`}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`eyebrow`,children:`正在準備`}),(0,U.jsx)(`h1`,{children:`連接本機工作台…`}),(0,U.jsx)(`p`,{children:`正在載入你的作品與 AI 狀態。`})]})]})}),e.kind===`failed`&&(0,U.jsx)(`main`,{className:`system-main`,children:(0,U.jsxs)(`section`,{className:`system-card warning`,role:`alert`,children:[(0,U.jsx)(`span`,{className:`notice-symbol`,children:`!`}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`eyebrow`,children:`無法連線`}),(0,U.jsx)(`h1`,{children:e.serverUnavailable?`Clipen 本機服務未啟動`:`本機工作台拒絕連線`}),(0,U.jsx)(`p`,{children:e.message}),e.serverUnavailable&&(0,U.jsx)(`code`,{children:`clipen codex 或 clipen claude`})]})]})}),c&&(0,U.jsxs)(ke.Provider,{value:{name:e.status.provider.name,id:e.status.provider.id},children:[(0,U.jsx)(On,{status:e.status}),n&&!i?(0,U.jsx)(`main`,{className:`system-main`,children:(0,U.jsxs)(`section`,{className:`system-card warning`,children:[(0,U.jsx)(`span`,{className:`notice-symbol`,children:`!`}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`eyebrow`,children:`找不到作品`}),(0,U.jsx)(`h1`,{children:`這個作品不存在或無法讀取`}),(0,U.jsx)(`button`,{className:`button primary`,onClick:()=>a(null),children:`回到作品首頁`})]})]})}):i?(0,U.jsx)(Fn,{project:i,csrf:e.status.session.csrf_token,onProject:o,onBack:()=>a(null),onDeleted:s},i.project_id):(0,U.jsx)(An,{projects:e.projects,csrf:e.status.session.csrf_token,onProjects:n=>t({...e,projects:n}),onOpen:e=>a(e)})]})]})}(0,u.createRoot)(document.getElementById(`root`)).render((0,U.jsx)(l.StrictMode,{children:(0,U.jsx)(In,{})}));
|