diff --git "a/web/backend/static/assets/index-DKqfgLWk.js" "b/web/backend/static/assets/index-DKqfgLWk.js" new file mode 100644--- /dev/null +++ "b/web/backend/static/assets/index-DKqfgLWk.js" @@ -0,0 +1,71 @@ +function bd(e,t){for(var n=0;nr[l]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const s of l)if(s.type==="childList")for(const i of s.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(l){const s={};return l.integrity&&(s.integrity=l.integrity),l.referrerPolicy&&(s.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?s.credentials="include":l.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(l){if(l.ep)return;l.ep=!0;const s=n(l);fetch(l.href,s)}})();function Ud(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var uu={exports:{}},Fl={},cu={exports:{}},B={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var jr=Symbol.for("react.element"),Dd=Symbol.for("react.portal"),Bd=Symbol.for("react.fragment"),$d=Symbol.for("react.strict_mode"),Ad=Symbol.for("react.profiler"),Vd=Symbol.for("react.provider"),Wd=Symbol.for("react.context"),Hd=Symbol.for("react.forward_ref"),Qd=Symbol.for("react.suspense"),Kd=Symbol.for("react.memo"),Gd=Symbol.for("react.lazy"),Io=Symbol.iterator;function Yd(e){return e===null||typeof e!="object"?null:(e=Io&&e[Io]||e["@@iterator"],typeof e=="function"?e:null)}var du={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},fu=Object.assign,pu={};function Ln(e,t,n){this.props=e,this.context=t,this.refs=pu,this.updater=n||du}Ln.prototype.isReactComponent={};Ln.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Ln.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function mu(){}mu.prototype=Ln.prototype;function Oi(e,t,n){this.props=e,this.context=t,this.refs=pu,this.updater=n||du}var Mi=Oi.prototype=new mu;Mi.constructor=Oi;fu(Mi,Ln.prototype);Mi.isPureReactComponent=!0;var Fo=Array.isArray,hu=Object.prototype.hasOwnProperty,Ii={current:null},gu={key:!0,ref:!0,__self:!0,__source:!0};function vu(e,t,n){var r,l={},s=null,i=null;if(t!=null)for(r in t.ref!==void 0&&(i=t.ref),t.key!==void 0&&(s=""+t.key),t)hu.call(t,r)&&!gu.hasOwnProperty(r)&&(l[r]=t[r]);var u=arguments.length-2;if(u===1)l.children=n;else if(1>>1,W=E[V];if(0>>1;Vl(A,I))Dl(J,A)?(E[V]=J,E[D]=I,V=D):(E[V]=A,E[F]=I,V=F);else if(Dl(J,I))E[V]=J,E[D]=I,V=D;else break e}}return z}function l(E,z){var I=E.sortIndex-z.sortIndex;return I!==0?I:E.id-z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var i=Date,u=i.now();e.unstable_now=function(){return i.now()-u}}var a=[],c=[],d=1,m=null,h=3,x=!1,y=!1,k=!1,N=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,f=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function g(E){for(var z=n(c);z!==null;){if(z.callback===null)r(c);else if(z.startTime<=E)r(c),z.sortIndex=z.expirationTime,t(a,z);else break;z=n(c)}}function w(E){if(k=!1,g(E),!y)if(n(a)!==null)y=!0,_(j);else{var z=n(c);z!==null&&b(w,z.startTime-E)}}function j(E,z){y=!1,k&&(k=!1,p(P),P=-1),x=!0;var I=h;try{for(g(z),m=n(a);m!==null&&(!(m.expirationTime>z)||E&&!$());){var V=m.callback;if(typeof V=="function"){m.callback=null,h=m.priorityLevel;var W=V(m.expirationTime<=z);z=e.unstable_now(),typeof W=="function"?m.callback=W:m===n(a)&&r(a),g(z)}else r(a);m=n(a)}if(m!==null)var we=!0;else{var F=n(c);F!==null&&b(w,F.startTime-z),we=!1}return we}finally{m=null,h=I,x=!1}}var R=!1,S=null,P=-1,T=5,L=-1;function $(){return!(e.unstable_now()-LE||125V?(E.sortIndex=I,t(c,E),n(a)===null&&E===n(c)&&(k?(p(P),P=-1):k=!0,b(w,I-V))):(E.sortIndex=W,t(a,E),y||x||(y=!0,_(j))),E},e.unstable_shouldYield=$,e.unstable_wrapCallback=function(E){var z=h;return function(){var I=h;h=z;try{return E.apply(this,arguments)}finally{h=I}}}})(Su);ku.exports=Su;var uf=ku.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var cf=v,Me=uf;function C(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ms=Object.prototype.hasOwnProperty,df=/^[: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]*$/,Uo={},Do={};function ff(e){return Ms.call(Do,e)?!0:Ms.call(Uo,e)?!1:df.test(e)?Do[e]=!0:(Uo[e]=!0,!1)}function pf(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function mf(e,t,n,r){if(t===null||typeof t>"u"||pf(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Ne(e,t,n,r,l,s,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=i}var he={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){he[e]=new Ne(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];he[t]=new Ne(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){he[e]=new Ne(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){he[e]=new Ne(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){he[e]=new Ne(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){he[e]=new Ne(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){he[e]=new Ne(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){he[e]=new Ne(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){he[e]=new Ne(e,5,!1,e.toLowerCase(),null,!1,!1)});var bi=/[\-:]([a-z])/g;function Ui(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(bi,Ui);he[t]=new Ne(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(bi,Ui);he[t]=new Ne(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(bi,Ui);he[t]=new Ne(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){he[e]=new Ne(e,1,!1,e.toLowerCase(),null,!1,!1)});he.xlinkHref=new Ne("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){he[e]=new Ne(e,1,!1,e.toLowerCase(),null,!0,!0)});function Di(e,t,n,r){var l=he.hasOwnProperty(t)?he[t]:null;(l!==null?l.type!==0:r||!(2u||l[i]!==s[u]){var a=` +`+l[i].replace(" at new "," at ");return e.displayName&&a.includes("")&&(a=a.replace("",e.displayName)),a}while(1<=i&&0<=u);break}}}finally{rs=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Hn(e):""}function hf(e){switch(e.tag){case 5:return Hn(e.type);case 16:return Hn("Lazy");case 13:return Hn("Suspense");case 19:return Hn("SuspenseList");case 0:case 2:case 15:return e=ls(e.type,!1),e;case 11:return e=ls(e.type.render,!1),e;case 1:return e=ls(e.type,!0),e;default:return""}}function Us(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case on:return"Fragment";case sn:return"Portal";case Is:return"Profiler";case Bi:return"StrictMode";case Fs:return"Suspense";case bs:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Eu:return(e.displayName||"Context")+".Consumer";case Nu:return(e._context.displayName||"Context")+".Provider";case $i:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ai:return t=e.displayName||null,t!==null?t:Us(e.type)||"Memo";case xt:t=e._payload,e=e._init;try{return Us(e(t))}catch{}}return null}function gf(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Us(t);case 8:return t===Bi?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Mt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function _u(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function vf(e){var t=_u(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(i){r=""+i,s.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Mr(e){e._valueTracker||(e._valueTracker=vf(e))}function Pu(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=_u(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function ul(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Ds(e,t){var n=t.checked;return te({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function $o(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Mt(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Ru(e,t){t=t.checked,t!=null&&Di(e,"checked",t,!1)}function Bs(e,t){Ru(e,t);var n=Mt(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?$s(e,t.type,n):t.hasOwnProperty("defaultValue")&&$s(e,t.type,Mt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Ao(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function $s(e,t,n){(t!=="number"||ul(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Qn=Array.isArray;function xn(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=Ir.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function sr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Yn={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},xf=["Webkit","ms","Moz","O"];Object.keys(Yn).forEach(function(e){xf.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Yn[t]=Yn[e]})});function Ou(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Yn.hasOwnProperty(e)&&Yn[e]?(""+t).trim():t+"px"}function Mu(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Ou(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var yf=te({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ws(e,t){if(t){if(yf[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(C(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(C(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(C(61))}if(t.style!=null&&typeof t.style!="object")throw Error(C(62))}}function Hs(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Qs=null;function Vi(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ks=null,yn=null,wn=null;function Ho(e){if(e=Cr(e)){if(typeof Ks!="function")throw Error(C(280));var t=e.stateNode;t&&(t=$l(t),Ks(e.stateNode,e.type,t))}}function Iu(e){yn?wn?wn.push(e):wn=[e]:yn=e}function Fu(){if(yn){var e=yn,t=wn;if(wn=yn=null,Ho(e),t)for(e=0;e>>=0,e===0?32:31-(Tf(e)/Lf|0)|0}var Fr=64,br=4194304;function Kn(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function pl(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,s=e.pingedLanes,i=n&268435455;if(i!==0){var u=i&~l;u!==0?r=Kn(u):(s&=i,s!==0&&(r=Kn(s)))}else i=n&~l,i!==0?r=Kn(i):s!==0&&(r=Kn(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&l)&&(l=r&-r,s=t&-t,l>=s||l===16&&(s&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Nr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ge(t),e[t]=n}function If(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Jn),ea=" ",ta=!1;function nc(e,t){switch(e){case"keyup":return up.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function rc(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var an=!1;function dp(e,t){switch(e){case"compositionend":return rc(t);case"keypress":return t.which!==32?null:(ta=!0,ea);case"textInput":return e=t.data,e===ea&&ta?null:e;default:return null}}function fp(e,t){if(an)return e==="compositionend"||!Ji&&nc(e,t)?(e=ec(),qr=Gi=St=null,an=!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)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=sa(n)}}function oc(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?oc(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ac(){for(var e=window,t=ul();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ul(e.document)}return t}function Zi(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function kp(e){var t=ac(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&oc(n.ownerDocument.documentElement,n)){if(r!==null&&Zi(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,s=Math.min(r.start,l);r=r.end===void 0?s:Math.min(r.end,l),!e.extend&&s>r&&(l=r,r=s,s=l),l=ia(n,s);var i=ia(n,r);l&&i&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,un=null,qs=null,qn=null,ei=!1;function oa(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ei||un==null||un!==ul(r)||(r=un,"selectionStart"in r&&Zi(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}),qn&&dr(qn,r)||(qn=r,r=gl(qs,"onSelect"),0fn||(e.current=ii[fn],ii[fn]=null,fn--)}function G(e,t){fn++,ii[fn]=e.current,e.current=t}var It={},ye=bt(It),_e=bt(!1),Kt=It;function En(e,t){var n=e.type.contextTypes;if(!n)return It;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},s;for(s in n)l[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function Pe(e){return e=e.childContextTypes,e!=null}function xl(){X(_e),X(ye)}function ma(e,t,n){if(ye.current!==It)throw Error(C(168));G(ye,t),G(_e,n)}function vc(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(C(108,gf(e)||"Unknown",l));return te({},n,r)}function yl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||It,Kt=ye.current,G(ye,e),G(_e,_e.current),!0}function ha(e,t,n){var r=e.stateNode;if(!r)throw Error(C(169));n?(e=vc(e,t,Kt),r.__reactInternalMemoizedMergedChildContext=e,X(_e),X(ye),G(ye,e)):X(_e),G(_e,n)}var rt=null,Al=!1,xs=!1;function xc(e){rt===null?rt=[e]:rt.push(e)}function Op(e){Al=!0,xc(e)}function Ut(){if(!xs&&rt!==null){xs=!0;var e=0,t=Q;try{var n=rt;for(Q=1;e>=i,l-=i,lt=1<<32-Ge(t)+l|n<P?(T=S,S=null):T=S.sibling;var L=h(p,S,g[P],w);if(L===null){S===null&&(S=T);break}e&&S&&L.alternate===null&&t(p,S),f=s(L,f,P),R===null?j=L:R.sibling=L,R=L,S=T}if(P===g.length)return n(p,S),Z&&Bt(p,P),j;if(S===null){for(;PP?(T=S,S=null):T=S.sibling;var $=h(p,S,L.value,w);if($===null){S===null&&(S=T);break}e&&S&&$.alternate===null&&t(p,S),f=s($,f,P),R===null?j=$:R.sibling=$,R=$,S=T}if(L.done)return n(p,S),Z&&Bt(p,P),j;if(S===null){for(;!L.done;P++,L=g.next())L=m(p,L.value,w),L!==null&&(f=s(L,f,P),R===null?j=L:R.sibling=L,R=L);return Z&&Bt(p,P),j}for(S=r(p,S);!L.done;P++,L=g.next())L=x(S,p,P,L.value,w),L!==null&&(e&&L.alternate!==null&&S.delete(L.key===null?P:L.key),f=s(L,f,P),R===null?j=L:R.sibling=L,R=L);return e&&S.forEach(function(U){return t(p,U)}),Z&&Bt(p,P),j}function N(p,f,g,w){if(typeof g=="object"&&g!==null&&g.type===on&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case Or:e:{for(var j=g.key,R=f;R!==null;){if(R.key===j){if(j=g.type,j===on){if(R.tag===7){n(p,R.sibling),f=l(R,g.props.children),f.return=p,p=f;break e}}else if(R.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===xt&&xa(j)===R.type){n(p,R.sibling),f=l(R,g.props),f.ref=An(p,R,g),f.return=p,p=f;break e}n(p,R);break}else t(p,R);R=R.sibling}g.type===on?(f=Qt(g.props.children,p.mode,w,g.key),f.return=p,p=f):(w=ol(g.type,g.key,g.props,null,p.mode,w),w.ref=An(p,f,g),w.return=p,p=w)}return i(p);case sn:e:{for(R=g.key;f!==null;){if(f.key===R)if(f.tag===4&&f.stateNode.containerInfo===g.containerInfo&&f.stateNode.implementation===g.implementation){n(p,f.sibling),f=l(f,g.children||[]),f.return=p,p=f;break e}else{n(p,f);break}else t(p,f);f=f.sibling}f=Cs(g,p.mode,w),f.return=p,p=f}return i(p);case xt:return R=g._init,N(p,f,R(g._payload),w)}if(Qn(g))return y(p,f,g,w);if(bn(g))return k(p,f,g,w);Wr(p,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,f!==null&&f.tag===6?(n(p,f.sibling),f=l(f,g),f.return=p,p=f):(n(p,f),f=Es(g,p.mode,w),f.return=p,p=f),i(p)):n(p,f)}return N}var _n=Sc(!0),jc=Sc(!1),Sl=bt(null),jl=null,hn=null,no=null;function ro(){no=hn=jl=null}function lo(e){var t=Sl.current;X(Sl),e._currentValue=t}function ui(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Sn(e,t){jl=e,no=hn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Ce=!0),e.firstContext=null)}function Ae(e){var t=e._currentValue;if(no!==e)if(e={context:e,memoizedValue:t,next:null},hn===null){if(jl===null)throw Error(C(308));hn=e,jl.dependencies={lanes:0,firstContext:e}}else hn=hn.next=e;return t}var Vt=null;function so(e){Vt===null?Vt=[e]:Vt.push(e)}function Nc(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,so(t)):(n.next=l.next,l.next=n),t.interleaved=n,ct(e,r)}function ct(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var yt=!1;function io(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ec(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function it(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Rt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,H&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,ct(e,n)}return l=r.interleaved,l===null?(t.next=t,so(r)):(t.next=l.next,l.next=t),r.interleaved=t,ct(e,n)}function tl(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Hi(e,n)}}function ya(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?l=s=i:s=s.next=i,n=n.next}while(n!==null);s===null?l=s=t:s=s.next=t}else l=s=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:s,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Nl(e,t,n,r){var l=e.updateQueue;yt=!1;var s=l.firstBaseUpdate,i=l.lastBaseUpdate,u=l.shared.pending;if(u!==null){l.shared.pending=null;var a=u,c=a.next;a.next=null,i===null?s=c:i.next=c,i=a;var d=e.alternate;d!==null&&(d=d.updateQueue,u=d.lastBaseUpdate,u!==i&&(u===null?d.firstBaseUpdate=c:u.next=c,d.lastBaseUpdate=a))}if(s!==null){var m=l.baseState;i=0,d=c=a=null,u=s;do{var h=u.lane,x=u.eventTime;if((r&h)===h){d!==null&&(d=d.next={eventTime:x,lane:0,tag:u.tag,payload:u.payload,callback:u.callback,next:null});e:{var y=e,k=u;switch(h=t,x=n,k.tag){case 1:if(y=k.payload,typeof y=="function"){m=y.call(x,m,h);break e}m=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=k.payload,h=typeof y=="function"?y.call(x,m,h):y,h==null)break e;m=te({},m,h);break e;case 2:yt=!0}}u.callback!==null&&u.lane!==0&&(e.flags|=64,h=l.effects,h===null?l.effects=[u]:h.push(u))}else x={eventTime:x,lane:h,tag:u.tag,payload:u.payload,callback:u.callback,next:null},d===null?(c=d=x,a=m):d=d.next=x,i|=h;if(u=u.next,u===null){if(u=l.shared.pending,u===null)break;h=u,u=h.next,h.next=null,l.lastBaseUpdate=h,l.shared.pending=null}}while(!0);if(d===null&&(a=m),l.baseState=a,l.firstBaseUpdate=c,l.lastBaseUpdate=d,t=l.shared.interleaved,t!==null){l=t;do i|=l.lane,l=l.next;while(l!==t)}else s===null&&(l.shared.lanes=0);Xt|=i,e.lanes=i,e.memoizedState=m}}function wa(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=ws.transition;ws.transition={};try{e(!1),t()}finally{Q=n,ws.transition=r}}function Ac(){return Ve().memoizedState}function bp(e,t,n){var r=Lt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Vc(e))Wc(t,n);else if(n=Nc(e,t,n,r),n!==null){var l=Se();Ye(n,e,r,l),Hc(n,t,r)}}function Up(e,t,n){var r=Lt(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Vc(e))Wc(t,l);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var i=t.lastRenderedState,u=s(i,n);if(l.hasEagerState=!0,l.eagerState=u,Xe(u,i)){var a=t.interleaved;a===null?(l.next=l,so(t)):(l.next=a.next,a.next=l),t.interleaved=l;return}}catch{}finally{}n=Nc(e,t,l,r),n!==null&&(l=Se(),Ye(n,e,r,l),Hc(n,t,r))}}function Vc(e){var t=e.alternate;return e===ee||t!==null&&t===ee}function Wc(e,t){er=Cl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Hc(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Hi(e,n)}}var _l={readContext:Ae,useCallback:ge,useContext:ge,useEffect:ge,useImperativeHandle:ge,useInsertionEffect:ge,useLayoutEffect:ge,useMemo:ge,useReducer:ge,useRef:ge,useState:ge,useDebugValue:ge,useDeferredValue:ge,useTransition:ge,useMutableSource:ge,useSyncExternalStore:ge,useId:ge,unstable_isNewReconciler:!1},Dp={readContext:Ae,useCallback:function(e,t){return Ze().memoizedState=[e,t===void 0?null:t],e},useContext:Ae,useEffect:Sa,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,rl(4194308,4,bc.bind(null,t,e),n)},useLayoutEffect:function(e,t){return rl(4194308,4,e,t)},useInsertionEffect:function(e,t){return rl(4,2,e,t)},useMemo:function(e,t){var n=Ze();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ze();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=bp.bind(null,ee,e),[r.memoizedState,e]},useRef:function(e){var t=Ze();return e={current:e},t.memoizedState=e},useState:ka,useDebugValue:ho,useDeferredValue:function(e){return Ze().memoizedState=e},useTransition:function(){var e=ka(!1),t=e[0];return e=Fp.bind(null,e[1]),Ze().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ee,l=Ze();if(Z){if(n===void 0)throw Error(C(407));n=n()}else{if(n=t(),de===null)throw Error(C(349));Yt&30||Rc(r,t,n)}l.memoizedState=n;var s={value:n,getSnapshot:t};return l.queue=s,Sa(Lc.bind(null,r,s,e),[e]),r.flags|=2048,yr(9,Tc.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=Ze(),t=de.identifierPrefix;if(Z){var n=st,r=lt;n=(r&~(1<<32-Ge(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=vr++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[qe]=t,e[mr]=r,td(e,t,!1,!1),t.stateNode=e;e:{switch(i=Hs(n,r),n){case"dialog":Y("cancel",e),Y("close",e),l=r;break;case"iframe":case"object":case"embed":Y("load",e),l=r;break;case"video":case"audio":for(l=0;lTn&&(t.flags|=128,r=!0,Vn(s,!1),t.lanes=4194304)}else{if(!r)if(e=El(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Vn(s,!0),s.tail===null&&s.tailMode==="hidden"&&!i.alternate&&!Z)return ve(t),null}else 2*le()-s.renderingStartTime>Tn&&n!==1073741824&&(t.flags|=128,r=!0,Vn(s,!1),t.lanes=4194304);s.isBackwards?(i.sibling=t.child,t.child=i):(n=s.last,n!==null?n.sibling=i:t.child=i,s.last=i)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=le(),t.sibling=null,n=q.current,G(q,r?n&1|2:n&1),t):(ve(t),null);case 22:case 23:return ko(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Le&1073741824&&(ve(t),t.subtreeFlags&6&&(t.flags|=8192)):ve(t),null;case 24:return null;case 25:return null}throw Error(C(156,t.tag))}function Kp(e,t){switch(eo(t),t.tag){case 1:return Pe(t.type)&&xl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Pn(),X(_e),X(ye),uo(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return ao(t),null;case 13:if(X(q),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(C(340));Cn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return X(q),null;case 4:return Pn(),null;case 10:return lo(t.type._context),null;case 22:case 23:return ko(),null;case 24:return null;default:return null}}var Qr=!1,xe=!1,Gp=typeof WeakSet=="function"?WeakSet:Set,O=null;function gn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ne(e,t,r)}else n.current=null}function xi(e,t,n){try{n()}catch(r){ne(e,t,r)}}var Oa=!1;function Yp(e,t){if(ti=ml,e=ac(),Zi(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var i=0,u=-1,a=-1,c=0,d=0,m=e,h=null;t:for(;;){for(var x;m!==n||l!==0&&m.nodeType!==3||(u=i+l),m!==s||r!==0&&m.nodeType!==3||(a=i+r),m.nodeType===3&&(i+=m.nodeValue.length),(x=m.firstChild)!==null;)h=m,m=x;for(;;){if(m===e)break t;if(h===n&&++c===l&&(u=i),h===s&&++d===r&&(a=i),(x=m.nextSibling)!==null)break;m=h,h=m.parentNode}m=x}n=u===-1||a===-1?null:{start:u,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(ni={focusedElem:e,selectionRange:n},ml=!1,O=t;O!==null;)if(t=O,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,O=e;else for(;O!==null;){t=O;try{var y=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var k=y.memoizedProps,N=y.memoizedState,p=t.stateNode,f=p.getSnapshotBeforeUpdate(t.elementType===t.type?k:He(t.type,k),N);p.__reactInternalSnapshotBeforeUpdate=f}break;case 3:var g=t.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(C(163))}}catch(w){ne(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,O=e;break}O=t.return}return y=Oa,Oa=!1,y}function tr(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var s=l.destroy;l.destroy=void 0,s!==void 0&&xi(t,n,s)}l=l.next}while(l!==r)}}function Hl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function yi(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function ld(e){var t=e.alternate;t!==null&&(e.alternate=null,ld(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[qe],delete t[mr],delete t[si],delete t[Lp],delete t[zp])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function sd(e){return e.tag===5||e.tag===3||e.tag===4}function Ma(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||sd(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function wi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=vl));else if(r!==4&&(e=e.child,e!==null))for(wi(e,t,n),e=e.sibling;e!==null;)wi(e,t,n),e=e.sibling}function ki(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(ki(e,t,n),e=e.sibling;e!==null;)ki(e,t,n),e=e.sibling}var pe=null,Qe=!1;function gt(e,t,n){for(n=n.child;n!==null;)id(e,t,n),n=n.sibling}function id(e,t,n){if(et&&typeof et.onCommitFiberUnmount=="function")try{et.onCommitFiberUnmount(bl,n)}catch{}switch(n.tag){case 5:xe||gn(n,t);case 6:var r=pe,l=Qe;pe=null,gt(e,t,n),pe=r,Qe=l,pe!==null&&(Qe?(e=pe,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):pe.removeChild(n.stateNode));break;case 18:pe!==null&&(Qe?(e=pe,n=n.stateNode,e.nodeType===8?vs(e.parentNode,n):e.nodeType===1&&vs(e,n),ur(e)):vs(pe,n.stateNode));break;case 4:r=pe,l=Qe,pe=n.stateNode.containerInfo,Qe=!0,gt(e,t,n),pe=r,Qe=l;break;case 0:case 11:case 14:case 15:if(!xe&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var s=l,i=s.destroy;s=s.tag,i!==void 0&&(s&2||s&4)&&xi(n,t,i),l=l.next}while(l!==r)}gt(e,t,n);break;case 1:if(!xe&&(gn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(u){ne(n,t,u)}gt(e,t,n);break;case 21:gt(e,t,n);break;case 22:n.mode&1?(xe=(r=xe)||n.memoizedState!==null,gt(e,t,n),xe=r):gt(e,t,n);break;default:gt(e,t,n)}}function Ia(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Gp),t.forEach(function(r){var l=lm.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function We(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=i),r&=~s}if(r=l,r=le()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Jp(r/1960))-r,10e?16:e,jt===null)var r=!1;else{if(e=jt,jt=null,Tl=0,H&6)throw Error(C(331));var l=H;for(H|=4,O=e.current;O!==null;){var s=O,i=s.child;if(O.flags&16){var u=s.deletions;if(u!==null){for(var a=0;ale()-yo?Ht(e,0):xo|=n),Re(e,t)}function md(e,t){t===0&&(e.mode&1?(t=br,br<<=1,!(br&130023424)&&(br=4194304)):t=1);var n=Se();e=ct(e,t),e!==null&&(Nr(e,t,n),Re(e,n))}function rm(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),md(e,n)}function lm(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(C(314))}r!==null&&r.delete(t),md(e,n)}var hd;hd=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||_e.current)Ce=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Ce=!1,Hp(e,t,n);Ce=!!(e.flags&131072)}else Ce=!1,Z&&t.flags&1048576&&yc(t,kl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;ll(e,t),e=t.pendingProps;var l=En(t,ye.current);Sn(t,n),l=fo(null,t,r,e,l,n);var s=po();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Pe(r)?(s=!0,yl(t)):s=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,io(t),l.updater=Wl,t.stateNode=l,l._reactInternals=t,di(t,r,e,n),t=mi(null,t,r,!0,s,n)):(t.tag=0,Z&&s&&qi(t),ke(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(ll(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=im(r),e=He(r,e),l){case 0:t=pi(null,t,r,e,n);break e;case 1:t=Ta(null,t,r,e,n);break e;case 11:t=Pa(null,t,r,e,n);break e;case 14:t=Ra(null,t,r,He(r.type,e),n);break e}throw Error(C(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:He(r,l),pi(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:He(r,l),Ta(e,t,r,l,n);case 3:e:{if(Zc(t),e===null)throw Error(C(387));r=t.pendingProps,s=t.memoizedState,l=s.element,Ec(e,t),Nl(t,r,null,n);var i=t.memoizedState;if(r=i.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){l=Rn(Error(C(423)),t),t=La(e,t,r,n,l);break e}else if(r!==l){l=Rn(Error(C(424)),t),t=La(e,t,r,n,l);break e}else for(ze=Pt(t.stateNode.containerInfo.firstChild),Oe=t,Z=!0,Ke=null,n=jc(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Cn(),r===l){t=dt(e,t,n);break e}ke(e,t,r,n)}t=t.child}return t;case 5:return Cc(t),e===null&&ai(t),r=t.type,l=t.pendingProps,s=e!==null?e.memoizedProps:null,i=l.children,ri(r,l)?i=null:s!==null&&ri(r,s)&&(t.flags|=32),Jc(e,t),ke(e,t,i,n),t.child;case 6:return e===null&&ai(t),null;case 13:return qc(e,t,n);case 4:return oo(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=_n(t,null,r,n):ke(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:He(r,l),Pa(e,t,r,l,n);case 7:return ke(e,t,t.pendingProps,n),t.child;case 8:return ke(e,t,t.pendingProps.children,n),t.child;case 12:return ke(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,s=t.memoizedProps,i=l.value,G(Sl,r._currentValue),r._currentValue=i,s!==null)if(Xe(s.value,i)){if(s.children===l.children&&!_e.current){t=dt(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var u=s.dependencies;if(u!==null){i=s.child;for(var a=u.firstContext;a!==null;){if(a.context===r){if(s.tag===1){a=it(-1,n&-n),a.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var d=c.pending;d===null?a.next=a:(a.next=d.next,d.next=a),c.pending=a}}s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),ui(s.return,n,t),u.lanes|=n;break}a=a.next}}else if(s.tag===10)i=s.type===t.type?null:s.child;else if(s.tag===18){if(i=s.return,i===null)throw Error(C(341));i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),ui(i,n,t),i=s.sibling}else i=s.child;if(i!==null)i.return=s;else for(i=s;i!==null;){if(i===t){i=null;break}if(s=i.sibling,s!==null){s.return=i.return,i=s;break}i=i.return}s=i}ke(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,Sn(t,n),l=Ae(l),r=r(l),t.flags|=1,ke(e,t,r,n),t.child;case 14:return r=t.type,l=He(r,t.pendingProps),l=He(r.type,l),Ra(e,t,r,l,n);case 15:return Yc(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:He(r,l),ll(e,t),t.tag=1,Pe(r)?(e=!0,yl(t)):e=!1,Sn(t,n),Qc(t,r,l),di(t,r,l,n),mi(null,t,r,!0,e,n);case 19:return ed(e,t,n);case 22:return Xc(e,t,n)}throw Error(C(156,t.tag))};function gd(e,t){return Vu(e,t)}function sm(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Be(e,t,n,r){return new sm(e,t,n,r)}function jo(e){return e=e.prototype,!(!e||!e.isReactComponent)}function im(e){if(typeof e=="function")return jo(e)?1:0;if(e!=null){if(e=e.$$typeof,e===$i)return 11;if(e===Ai)return 14}return 2}function zt(e,t){var n=e.alternate;return n===null?(n=Be(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function ol(e,t,n,r,l,s){var i=2;if(r=e,typeof e=="function")jo(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case on:return Qt(n.children,l,s,t);case Bi:i=8,l|=8;break;case Is:return e=Be(12,n,t,l|2),e.elementType=Is,e.lanes=s,e;case Fs:return e=Be(13,n,t,l),e.elementType=Fs,e.lanes=s,e;case bs:return e=Be(19,n,t,l),e.elementType=bs,e.lanes=s,e;case Cu:return Kl(n,l,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Nu:i=10;break e;case Eu:i=9;break e;case $i:i=11;break e;case Ai:i=14;break e;case xt:i=16,r=null;break e}throw Error(C(130,e==null?e:typeof e,""))}return t=Be(i,n,t,l),t.elementType=e,t.type=r,t.lanes=s,t}function Qt(e,t,n,r){return e=Be(7,e,r,t),e.lanes=n,e}function Kl(e,t,n,r){return e=Be(22,e,r,t),e.elementType=Cu,e.lanes=n,e.stateNode={isHidden:!1},e}function Es(e,t,n){return e=Be(6,e,null,t),e.lanes=n,e}function Cs(e,t,n){return t=Be(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function om(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=is(0),this.expirationTimes=is(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=is(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function No(e,t,n,r,l,s,i,u,a){return e=new om(e,t,n,u,a),t===1?(t=1,s===!0&&(t|=8)):t=0,s=Be(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},io(s),e}function am(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(wd)}catch(e){console.error(e)}}wd(),wu.exports=Ie;var pm=wu.exports,kd,Va=pm;kd=Va.createRoot,Va.hydrateRoot;/** + * @remix-run/router v1.23.2 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function kr(){return kr=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function Po(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function hm(){return Math.random().toString(36).substr(2,8)}function Ha(e,t){return{usr:e.state,key:e.key,idx:t}}function Ci(e,t,n,r){return n===void 0&&(n=null),kr({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Mn(t):t,{state:n,key:t&&t.key||r||hm()})}function Ol(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function Mn(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function gm(e,t,n,r){r===void 0&&(r={});let{window:l=document.defaultView,v5Compat:s=!1}=r,i=l.history,u=Nt.Pop,a=null,c=d();c==null&&(c=0,i.replaceState(kr({},i.state,{idx:c}),""));function d(){return(i.state||{idx:null}).idx}function m(){u=Nt.Pop;let N=d(),p=N==null?null:N-c;c=N,a&&a({action:u,location:k.location,delta:p})}function h(N,p){u=Nt.Push;let f=Ci(k.location,N,p);c=d()+1;let g=Ha(f,c),w=k.createHref(f);try{i.pushState(g,"",w)}catch(j){if(j instanceof DOMException&&j.name==="DataCloneError")throw j;l.location.assign(w)}s&&a&&a({action:u,location:k.location,delta:1})}function x(N,p){u=Nt.Replace;let f=Ci(k.location,N,p);c=d();let g=Ha(f,c),w=k.createHref(f);i.replaceState(g,"",w),s&&a&&a({action:u,location:k.location,delta:0})}function y(N){let p=l.location.origin!=="null"?l.location.origin:l.location.href,f=typeof N=="string"?N:Ol(N);return f=f.replace(/ $/,"%20"),se(p,"No window.location.(origin|href) available to create URL for href: "+f),new URL(f,p)}let k={get action(){return u},get location(){return e(l,i)},listen(N){if(a)throw new Error("A history only accepts one active listener");return l.addEventListener(Wa,m),a=N,()=>{l.removeEventListener(Wa,m),a=null}},createHref(N){return t(l,N)},createURL:y,encodeLocation(N){let p=y(N);return{pathname:p.pathname,search:p.search,hash:p.hash}},push:h,replace:x,go(N){return i.go(N)}};return k}var Qa;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Qa||(Qa={}));function vm(e,t,n){return n===void 0&&(n="/"),xm(e,t,n)}function xm(e,t,n,r){let l=typeof t=="string"?Mn(t):t,s=Ro(l.pathname||"/",n);if(s==null)return null;let i=Sd(e);ym(i);let u=null;for(let a=0;u==null&&a{let a={relativePath:u===void 0?s.path||"":u,caseSensitive:s.caseSensitive===!0,childrenIndex:i,route:s};a.relativePath.startsWith("/")&&(se(a.relativePath.startsWith(r),'Absolute route path "'+a.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),a.relativePath=a.relativePath.slice(r.length));let c=Ot([r,a.relativePath]),d=n.concat(a);s.children&&s.children.length>0&&(se(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),Sd(s.children,t,d,c)),!(s.path==null&&!s.index)&&t.push({path:c,score:Cm(c,s.index),routesMeta:d})};return e.forEach((s,i)=>{var u;if(s.path===""||!((u=s.path)!=null&&u.includes("?")))l(s,i);else for(let a of jd(s.path))l(s,i,a)}),t}function jd(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,l=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return l?[s,""]:[s];let i=jd(r.join("/")),u=[];return u.push(...i.map(a=>a===""?s:[s,a].join("/"))),l&&u.push(...i),u.map(a=>e.startsWith("/")&&a===""?"/":a)}function ym(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:_m(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const wm=/^:[\w-]+$/,km=3,Sm=2,jm=1,Nm=10,Em=-2,Ka=e=>e==="*";function Cm(e,t){let n=e.split("/"),r=n.length;return n.some(Ka)&&(r+=Em),t&&(r+=Sm),n.filter(l=>!Ka(l)).reduce((l,s)=>l+(wm.test(s)?km:s===""?jm:Nm),r)}function _m(e,t){return e.length===t.length&&e.slice(0,-1).every((r,l)=>r===t[l])?e[e.length-1]-t[t.length-1]:0}function Pm(e,t,n){let{routesMeta:r}=e,l={},s="/",i=[];for(let u=0;u{let{paramName:h,isOptional:x}=d;if(h==="*"){let k=u[m]||"";i=s.slice(0,s.length-k.length).replace(/(.)\/+$/,"$1")}const y=u[m];return x&&!y?c[h]=void 0:c[h]=(y||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:i,pattern:e}}function Tm(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),Po(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],l="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,u,a)=>(r.push({paramName:u,isOptional:a!=null}),a?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),l+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?l+="\\/*$":e!==""&&e!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,t?void 0:"i"),r]}function Lm(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Po(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Ro(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}const zm=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Om=e=>zm.test(e);function Mm(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:l=""}=typeof e=="string"?Mn(e):e,s;if(n)if(Om(n))s=n;else{if(n.includes("//")){let i=n;n=n.replace(/\/\/+/g,"/"),Po(!1,"Pathnames cannot have embedded double slashes - normalizing "+(i+" -> "+n))}n.startsWith("/")?s=Ga(n.substring(1),"/"):s=Ga(n,t)}else s=t;return{pathname:s,search:bm(r),hash:Um(l)}}function Ga(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(l=>{l===".."?n.length>1&&n.pop():l!=="."&&n.push(l)}),n.length>1?n.join("/"):"/"}function _s(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function Im(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function To(e,t){let n=Im(e);return t?n.map((r,l)=>l===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Lo(e,t,n,r){r===void 0&&(r=!1);let l;typeof e=="string"?l=Mn(e):(l=kr({},e),se(!l.pathname||!l.pathname.includes("?"),_s("?","pathname","search",l)),se(!l.pathname||!l.pathname.includes("#"),_s("#","pathname","hash",l)),se(!l.search||!l.search.includes("#"),_s("#","search","hash",l)));let s=e===""||l.pathname==="",i=s?"/":l.pathname,u;if(i==null)u=n;else{let m=t.length-1;if(!r&&i.startsWith("..")){let h=i.split("/");for(;h[0]==="..";)h.shift(),m-=1;l.pathname=h.join("/")}u=m>=0?t[m]:"/"}let a=Mm(l,u),c=i&&i!=="/"&&i.endsWith("/"),d=(s||i===".")&&n.endsWith("/");return!a.pathname.endsWith("/")&&(c||d)&&(a.pathname+="/"),a}const Ot=e=>e.join("/").replace(/\/\/+/g,"/"),Fm=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),bm=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Um=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function Dm(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const Nd=["post","put","patch","delete"];new Set(Nd);const Bm=["get",...Nd];new Set(Bm);/** + * React Router v6.30.3 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function Sr(){return Sr=Object.assign?Object.assign.bind():function(e){for(var t=1;t{u.current=!0}),v.useCallback(function(c,d){if(d===void 0&&(d={}),!u.current)return;if(typeof c=="number"){r.go(c);return}let m=Lo(c,JSON.parse(i),s,d.relative==="path");e==null&&t!=="/"&&(m.pathname=m.pathname==="/"?t:Ot([t,m.pathname])),(d.replace?r.replace:r.push)(m,d.state,d)},[t,r,i,s,e])}const Wm=v.createContext(null);function Hm(e){let t=v.useContext(pt).outlet;return t&&v.createElement(Wm.Provider,{value:e},t)}function _d(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=v.useContext(Dt),{matches:l}=v.useContext(pt),{pathname:s}=Fn(),i=JSON.stringify(To(l,r.v7_relativeSplatPath));return v.useMemo(()=>Lo(e,JSON.parse(i),s,n==="path"),[e,i,s,n])}function Qm(e,t){return Km(e,t)}function Km(e,t,n,r){In()||se(!1);let{navigator:l}=v.useContext(Dt),{matches:s}=v.useContext(pt),i=s[s.length-1],u=i?i.params:{};i&&i.pathname;let a=i?i.pathnameBase:"/";i&&i.route;let c=Fn(),d;if(t){var m;let N=typeof t=="string"?Mn(t):t;a==="/"||(m=N.pathname)!=null&&m.startsWith(a)||se(!1),d=N}else d=c;let h=d.pathname||"/",x=h;if(a!=="/"){let N=a.replace(/^\//,"").split("/");x="/"+h.replace(/^\//,"").split("/").slice(N.length).join("/")}let y=vm(e,{pathname:x}),k=Zm(y&&y.map(N=>Object.assign({},N,{params:Object.assign({},u,N.params),pathname:Ot([a,l.encodeLocation?l.encodeLocation(N.pathname).pathname:N.pathname]),pathnameBase:N.pathnameBase==="/"?a:Ot([a,l.encodeLocation?l.encodeLocation(N.pathnameBase).pathname:N.pathnameBase])})),s,n,r);return t&&k?v.createElement(Zl.Provider,{value:{location:Sr({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:Nt.Pop}},k):k}function Gm(){let e=nh(),t=Dm(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,l={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},t),n?v.createElement("pre",{style:l},n):null,null)}const Ym=v.createElement(Gm,null);class Xm extends v.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?v.createElement(pt.Provider,{value:this.props.routeContext},v.createElement(Ed.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Jm(e){let{routeContext:t,match:n,children:r}=e,l=v.useContext(zo);return l&&l.static&&l.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(l.staticContext._deepestRenderedBoundaryId=n.route.id),v.createElement(pt.Provider,{value:t},r)}function Zm(e,t,n,r){var l;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var s;if(!n)return null;if(n.errors)e=n.matches;else if((s=r)!=null&&s.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let i=e,u=(l=n)==null?void 0:l.errors;if(u!=null){let d=i.findIndex(m=>m.route.id&&(u==null?void 0:u[m.route.id])!==void 0);d>=0||se(!1),i=i.slice(0,Math.min(i.length,d+1))}let a=!1,c=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d=0?i=i.slice(0,c+1):i=[i[0]];break}}}return i.reduceRight((d,m,h)=>{let x,y=!1,k=null,N=null;n&&(x=u&&m.route.id?u[m.route.id]:void 0,k=m.route.errorElement||Ym,a&&(c<0&&h===0?(lh("route-fallback"),y=!0,N=null):c===h&&(y=!0,N=m.route.hydrateFallbackElement||null)));let p=t.concat(i.slice(0,h+1)),f=()=>{let g;return x?g=k:y?g=N:m.route.Component?g=v.createElement(m.route.Component,null):m.route.element?g=m.route.element:g=d,v.createElement(Jm,{match:m,routeContext:{outlet:d,matches:p,isDataRoute:n!=null},children:g})};return n&&(m.route.ErrorBoundary||m.route.errorElement||h===0)?v.createElement(Xm,{location:n.location,revalidation:n.revalidation,component:k,error:x,children:f(),routeContext:{outlet:null,matches:p,isDataRoute:!0}}):f()},null)}var Pd=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(Pd||{}),Rd=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(Rd||{});function qm(e){let t=v.useContext(zo);return t||se(!1),t}function eh(e){let t=v.useContext($m);return t||se(!1),t}function th(e){let t=v.useContext(pt);return t||se(!1),t}function Td(e){let t=th(),n=t.matches[t.matches.length-1];return n.route.id||se(!1),n.route.id}function nh(){var e;let t=v.useContext(Ed),n=eh(),r=Td();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function rh(){let{router:e}=qm(Pd.UseNavigateStable),t=Td(Rd.UseNavigateStable),n=v.useRef(!1);return Cd(()=>{n.current=!0}),v.useCallback(function(l,s){s===void 0&&(s={}),n.current&&(typeof l=="number"?e.navigate(l):e.navigate(l,Sr({fromRouteId:t},s)))},[e,t])}const Ya={};function lh(e,t,n){Ya[e]||(Ya[e]=!0)}function sh(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function _i(e){let{to:t,replace:n,state:r,relative:l}=e;In()||se(!1);let{future:s,static:i}=v.useContext(Dt),{matches:u}=v.useContext(pt),{pathname:a}=Fn(),c=ql(),d=Lo(t,To(u,s.v7_relativeSplatPath),a,l==="path"),m=JSON.stringify(d);return v.useEffect(()=>c(JSON.parse(m),{replace:n,state:r,relative:l}),[c,m,l,n,r]),null}function ih(e){return Hm(e.context)}function Te(e){se(!1)}function oh(e){let{basename:t="/",children:n=null,location:r,navigationType:l=Nt.Pop,navigator:s,static:i=!1,future:u}=e;In()&&se(!1);let a=t.replace(/^\/*/,"/"),c=v.useMemo(()=>({basename:a,navigator:s,static:i,future:Sr({v7_relativeSplatPath:!1},u)}),[a,u,s,i]);typeof r=="string"&&(r=Mn(r));let{pathname:d="/",search:m="",hash:h="",state:x=null,key:y="default"}=r,k=v.useMemo(()=>{let N=Ro(d,a);return N==null?null:{location:{pathname:N,search:m,hash:h,state:x,key:y},navigationType:l}},[a,d,m,h,x,y,l]);return k==null?null:v.createElement(Dt.Provider,{value:c},v.createElement(Zl.Provider,{children:n,value:k}))}function ah(e){let{children:t,location:n}=e;return Qm(Pi(t),n)}new Promise(()=>{});function Pi(e,t){t===void 0&&(t=[]);let n=[];return v.Children.forEach(e,(r,l)=>{if(!v.isValidElement(r))return;let s=[...t,l];if(r.type===v.Fragment){n.push.apply(n,Pi(r.props.children,s));return}r.type!==Te&&se(!1),!r.props.index||!r.props.children||se(!1);let i={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(i.children=Pi(r.props.children,s)),n.push(i)}),n}/** + * React Router DOM v6.30.3 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function Ri(){return Ri=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[l]=e[l]);return n}function ch(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function dh(e,t){return e.button===0&&(!t||t==="_self")&&!ch(e)}const fh=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],ph="6";try{window.__reactRouterVersion=ph}catch{}const mh="startTransition",Xa=tf[mh];function hh(e){let{basename:t,children:n,future:r,window:l}=e,s=v.useRef();s.current==null&&(s.current=mm({window:l,v5Compat:!0}));let i=s.current,[u,a]=v.useState({action:i.action,location:i.location}),{v7_startTransition:c}=r||{},d=v.useCallback(m=>{c&&Xa?Xa(()=>a(m)):a(m)},[a,c]);return v.useLayoutEffect(()=>i.listen(d),[i,d]),v.useEffect(()=>sh(r),[r]),v.createElement(oh,{basename:t,children:n,location:u.location,navigationType:u.action,navigator:i,future:r})}const gh=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",vh=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,xh=v.forwardRef(function(t,n){let{onClick:r,relative:l,reloadDocument:s,replace:i,state:u,target:a,to:c,preventScrollReset:d,viewTransition:m}=t,h=uh(t,fh),{basename:x}=v.useContext(Dt),y,k=!1;if(typeof c=="string"&&vh.test(c)&&(y=c,gh))try{let g=new URL(window.location.href),w=c.startsWith("//")?new URL(g.protocol+c):new URL(c),j=Ro(w.pathname,x);w.origin===g.origin&&j!=null?c=j+w.search+w.hash:k=!0}catch{}let N=Am(c,{relative:l}),p=yh(c,{replace:i,state:u,target:a,preventScrollReset:d,relative:l,viewTransition:m});function f(g){r&&r(g),g.defaultPrevented||p(g)}return v.createElement("a",Ri({},h,{href:y||N,onClick:k||s?r:f,ref:n,target:a}))});var Ja;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Ja||(Ja={}));var Za;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Za||(Za={}));function yh(e,t){let{target:n,replace:r,state:l,preventScrollReset:s,relative:i,viewTransition:u}=t===void 0?{}:t,a=ql(),c=Fn(),d=_d(e,{relative:i});return v.useCallback(m=>{if(dh(m,n)){m.preventDefault();let h=r!==void 0?r:Ol(c)===Ol(d);a(e,{replace:h,state:l,preventScrollReset:s,relative:i,viewTransition:u})}},[c,a,d,r,l,n,e,s,i,u])}const Ld="videogen-ui-settings",Ml=3,qa={version:Ml,fontSize:"standard",colorTheme:"blue"},wh=["compact","small","standard","large","xlarge"],kh=["blue","cream","gray","lavender"];function zd(e){return wh.includes(e)}function Sh(e){return kh.includes(e)}function jh(e){return e?e==="comfortable"?"standard":e==="standard"?"small":zd(e)?e:null:null}function Nh(){try{const e=localStorage.getItem(Ld);if(!e)return qa;const t=JSON.parse(e);let n="standard";if(t.fontSize)if((t.version===2||t.version===Ml)&&zd(t.fontSize))n=t.fontSize;else{const l=jh(t.fontSize);l&&(n=l)}let r="blue";return t.colorTheme&&Sh(t.colorTheme)&&(r=t.colorTheme),{version:Ml,fontSize:n,colorTheme:r}}catch{}return qa}function eu(e){document.documentElement.dataset.fontSize=e}function tu(e){document.documentElement.dataset.theme=e}const Od=v.createContext(null);function Eh({children:e}){const[t,n]=v.useState(()=>{const i=Nh();return typeof document<"u"&&(eu(i.fontSize),tu(i.colorTheme)),i});v.useLayoutEffect(()=>{eu(t.fontSize)},[t.fontSize]),v.useLayoutEffect(()=>{tu(t.colorTheme)},[t.colorTheme]),v.useEffect(()=>{localStorage.setItem(Ld,JSON.stringify({version:Ml,fontSize:t.fontSize,colorTheme:t.colorTheme}))},[t]);const r=v.useCallback(i=>{n(u=>({...u,fontSize:i}))},[]),l=v.useCallback(i=>{n(u=>({...u,colorTheme:i}))},[]),s=v.useMemo(()=>({fontSize:t.fontSize,setFontSize:r,colorTheme:t.colorTheme,setColorTheme:l}),[t.fontSize,t.colorTheme,r,l]);return o.jsx(Od.Provider,{value:s,children:e})}function Ch(){const e=v.useContext(Od);if(!e)throw new Error("useUiSettings must be used within UiSettingsProvider");return e}const Oo="",Mo="web_ui_auth_token";function en(e,t={}){const n=new Headers(t.headers),r=sessionStorage.getItem(Mo);return r&&n.set("Authorization",`Bearer ${r}`),fetch(e,{...t,credentials:"include",headers:n})}const _h=15e3;async function Md(){const e=new AbortController,t=setTimeout(()=>e.abort(),_h);try{const n=await en(`${Oo}/api/me`,{signal:e.signal});if(!n.ok)throw new Error("me failed");return n.json()}finally{clearTimeout(t)}}async function Ph(e){const t=await fetch(`${Oo}/api/login`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({password:e})}),n=await t.json().catch(()=>({}));if(!t.ok)throw new Error(n.detail||"Login failed");n.auth_token&&sessionStorage.setItem(Mo,n.auth_token)}async function Rh(){await en(`${Oo}/api/logout`,{method:"POST"}),sessionStorage.removeItem(Mo)}const Id=v.createContext(null);function Th({children:e}){const[t,n]=v.useState(null),[r,l]=v.useState(null);return v.useEffect(()=>{let s=!1;return en("/api/config/generation-options").then(async i=>{if(i.status===401)return window.location.assign("/login"),null;const u=await i.json().catch(()=>({}));if(!i.ok){const a=u.detail,c=typeof a=="string"?a:Array.isArray(a)?JSON.stringify(a):i.statusText;throw new Error(c)}return u}).then(i=>{s||i===null||n(i)}).catch(i=>{s||l(i instanceof Error?i.message:"Failed to load options")}),()=>{s=!0}},[]),r?o.jsxs("div",{className:"p-8 text-sm text-red-800",children:["页面暂时打不开,请稍后再试。",r?o.jsxs("span",{className:"block mt-2 text-xs text-mist",children:["(",r,")"]}):null]}):t?o.jsx(Id.Provider,{value:t,children:e}):o.jsx("div",{className:"p-8 text-sm text-mist",children:"加载中…"})}const Lh=new Set(["gemini-3.1-flash-image-preview","veo-3.0-fast-generate-001","veo-3.1-fast-generate-preview"]);function Il(e,t){var l;const n=e.find(s=>Lh.has(s.value));if(n)return n.value;const r=e.find(s=>{var i;return(i=s.label)==null?void 0:i.includes("快速")});return(r==null?void 0:r.value)??((l=e[0])==null?void 0:l.value)??t}function Ps(e,t){const n=e.find(r=>r.value===t);return(n==null?void 0:n.supports_reference_images)!==!1}function Fd(e,t){const n=e.find(r=>r.value===t);return(n==null?void 0:n.supports_4k)!==!1}function Pr(){const e=v.useContext(Id);if(!e)throw new Error("useGenerationOptions must be used inside GenerationOptionsProvider");return e}const zh=[{to:"/image",title:"图片编辑或生成",sub:"文字或配图,生成图片"},{to:"/video",title:"视频生成",sub:"一句话或几张图,生成视频"},{to:"/video-frames",title:"视频生成(首尾过渡)",sub:"给定起止画面,中间自动生成"}],Oh=[{to:"/tools/upscale",title:"超分辨率",sub:"获得更高分辨率的图片"},{to:"/tools/frame",title:"提取视频帧",sub:"选择视频特定帧,导出 PNG"},{to:"/tools/crop",title:"图像裁剪",sub:"交互式裁剪图片,导出 PNG"},{to:"/tools/replace-bg",title:"替换纯色背景",sub:"把特定颜色替换为目标颜色"}],Mh=[{to:"/examples",title:"示例",sub:"歌曲彩幕制作"}];function Rs({item:e,active:t}){return o.jsxs(xh,{to:e.to,className:`rounded-lg px-3 py-2.5 text-base transition-colors ${t?"bg-white text-ink shadow-sm border border-line/90":"text-mist hover:text-ink hover:bg-white/60"}`,children:[o.jsx("span",{className:"block font-semibold text-ink",children:e.title}),o.jsx("span",{className:"block text-sm text-mist",children:e.sub})]})}const Ih=[{value:"blue",label:"淡蓝",swatch:"#8eb0dc"},{value:"cream",label:"淡米黄",swatch:"#ddd2bc"},{value:"gray",label:"浅灰",swatch:"#b4bcc8"},{value:"lavender",label:"淡紫灰",swatch:"#bdb3df"}],Fh=[{value:"compact",label:"小",labelEn:"Extra small"},{value:"small",label:"较小",labelEn:"Small"},{value:"standard",label:"中",labelEn:"Standard"},{value:"large",label:"较大",labelEn:"Large"},{value:"xlarge",label:"大",labelEn:"Extra large"}];function bh(){const{fontSize:e,setFontSize:t,colorTheme:n,setColorTheme:r}=Ch(),[l,s]=v.useState(null),i=Fn(),u=ql();return v.useEffect(()=>{let a=!0;return Md().then(c=>{a&&s(c.authenticated)}).catch(()=>{a&&s(!1)}),()=>{a=!1}},[]),l===null?o.jsx("div",{className:"min-h-screen flex items-center justify-center text-mist text-sm",children:"请稍候…"}):l?o.jsxs("div",{className:"min-h-screen flex",children:[o.jsxs("aside",{className:"w-[17.5rem] min-w-[15rem] shrink-0 border-r border-line/80 bg-panel/95 p-6 sm:p-7 flex flex-col gap-7",children:[o.jsx("div",{children:o.jsx("p",{className:"font-display text-2xl font-semibold text-ink",children:"AI创作台"})}),o.jsxs("div",{className:"flex flex-col gap-5",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-semibold text-clay tracking-wide mb-2",children:"创作"}),o.jsx("nav",{className:"flex flex-col gap-1",children:zh.map(a=>o.jsx(Rs,{item:a,active:i.pathname===a.to},a.to))})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-semibold text-clay tracking-wide mb-2",children:"辅助工具"}),o.jsx("nav",{className:"flex flex-col gap-1",children:Oh.map(a=>o.jsx(Rs,{item:a,active:i.pathname===a.to},a.to))})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-semibold text-clay tracking-wide mb-2",children:"示例"}),o.jsx("nav",{className:"flex flex-col gap-1",children:Mh.map(a=>o.jsx(Rs,{item:a,active:i.pathname===a.to},a.to))})]})]}),o.jsxs("div",{className:"mt-auto space-y-4",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-semibold text-clay tracking-wide mb-2",id:"theme-swatch-label",children:"界面配色"}),o.jsx("div",{role:"radiogroup","aria-labelledby":"theme-swatch-label",className:"flex flex-wrap gap-2.5",children:Ih.map(({value:a,label:c,swatch:d})=>{const m=n===a;return o.jsx("button",{type:"button",role:"radio","aria-checked":m,title:c,onClick:()=>r(a),className:`h-9 w-9 shrink-0 rounded-full border-2 transition-shadow focus:outline-none focus-visible:ring-2 focus-visible:ring-clay focus-visible:ring-offset-2 focus-visible:ring-offset-paper ${m?"border-ink ring-2 ring-ink/50 ring-offset-2 ring-offset-paper":"border-line/55 shadow-sm hover:brightness-[0.98]"}`,style:{backgroundColor:d}},a)})})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-semibold text-clay tracking-wide mb-2",children:"字体大小"}),o.jsx("label",{htmlFor:"ui-font-size",className:"sr-only",children:"字体大小"}),o.jsx("select",{id:"ui-font-size",value:e,onChange:a=>t(a.target.value),className:"w-full rounded-lg border border-slate-400/90 bg-white px-3 py-2.5 text-base text-ink shadow-sm focus:outline-none focus:ring-2 focus:ring-clay/40",children:Fh.map(a=>o.jsxs("option",{value:a.value,children:[a.label," · ",a.labelEn]},a.value))})]}),o.jsx("button",{type:"button",onClick:()=>Rh().then(()=>u("/login",{replace:!0})),className:"text-sm text-mist hover:text-ink underline underline-offset-2",children:"退出登录"})]})]}),o.jsx("main",{className:"flex-1 min-w-0 p-6 sm:p-10 lg:p-12 overflow-auto",children:o.jsx("div",{className:"mx-auto w-full max-w-7xl xl:max-w-[96rem] 2xl:max-w-[min(104rem,calc(100vw-3rem))]",children:o.jsx(Th,{children:o.jsx(ih,{})})})})]}):o.jsx(_i,{to:"/login",replace:!0})}function Uh(){const[e,t]=v.useState(""),[n,r]=v.useState(null),[l,s]=v.useState(!1),[i,u]=v.useState(!0),a=ql();v.useEffect(()=>{Md().then(d=>{d.authenticated&&a("/image",{replace:!0})}).catch(()=>{}).finally(()=>u(!1))},[a]);async function c(d){d.preventDefault(),r(null),s(!0);try{await Ph(e),a("/image",{replace:!0})}catch(m){r(m instanceof Error?m.message:"登录失败")}finally{s(!1)}}return i?o.jsx("div",{className:"min-h-screen flex items-center justify-center text-mist text-sm",children:"请稍候…"}):o.jsx("div",{className:"min-h-screen flex items-center justify-center p-6 sm:p-10 bg-gradient-to-br from-paper via-panel/30 to-paper",children:o.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-line/80 bg-white/85 backdrop-blur-sm shadow-xl shadow-black/10 p-10 sm:p-12",children:[o.jsx("h1",{className:"font-display text-3xl font-semibold text-ink mb-2",children:"AI创作台"}),o.jsx("p",{className:"text-base text-mist mb-8",children:"输入密码后即可使用"}),o.jsxs("form",{onSubmit:c,className:"space-y-5",children:[o.jsx("input",{type:"password",autoComplete:"current-password",className:"w-full rounded-lg border border-line/90 bg-white px-4 py-3 text-base text-ink placeholder:text-slate-400 focus:outline-none focus:ring-2 focus:ring-clay/50",placeholder:"密码",value:e,onChange:d=>t(d.target.value)}),n&&o.jsx("p",{className:"text-base text-red-700",children:n}),o.jsx("button",{type:"submit",disabled:l||!e.trim(),className:"w-full rounded-lg bg-ink text-paper py-3 text-base font-medium hover:bg-slate-800 disabled:opacity-40 transition-colors",children:l?"验证中…":"进入"})]})]})})}function Dh(e){const t=e.match(/^data:([^;,]+)/);if(!t)return"bin";const n=t[1].toLowerCase();return n.includes("png")?"png":n.includes("jpeg")||n.includes("jpg")?"jpg":n.includes("webp")?"webp":n.includes("mp4")?"mp4":n.includes("webm")?"webm":n.includes("gif")?"gif":"bin"}function Bh(e,t){const n=document.createElement("a");n.href=e,n.download=t,n.rel="noopener",n.click()}function tn({dataUrl:e,filenameBase:t="download",label:n="下载",className:r="rounded-lg border border-slate-300 bg-white px-3 py-1.5 text-sm text-ink hover:bg-slate-50"}){const l=Dh(e),s=`${t}-${Date.now()}.${l}`;return o.jsx("button",{type:"button",onClick:()=>Bh(e,s),className:r,children:n})}function es({active:e}){const[t,n]=v.useState(0);return v.useEffect(()=>{if(!e){n(0);return}const r=Date.now(),l=window.setInterval(()=>{n(Math.floor((Date.now()-r)/1e3))},150);return()=>clearInterval(l)},[e]),e?o.jsxs("p",{className:"text-sm text-mist tabular-nums",children:["已等待 ",o.jsx("span",{className:"text-ink font-medium",children:t})," 秒"]}):null}function ot({label:e,file:t,onChange:n,required:r}){const l=v.useId(),[s,i]=v.useState(null);return v.useEffect(()=>{if(!t){i(null);return}const u=URL.createObjectURL(t);return i(u),()=>{URL.revokeObjectURL(u)}},[t]),o.jsxs("label",{htmlFor:l,className:"flex flex-col gap-2 rounded-lg border border-slate-300/80 bg-white/60 p-3 min-h-[120px] cursor-pointer hover:border-clay/80 transition-colors",children:[o.jsx("span",{className:"text-xs font-semibold text-ink",children:e}),t&&s?o.jsxs("div",{className:"flex gap-2 items-start",children:[o.jsx("img",{src:s,alt:"",className:"h-20 w-20 shrink-0 rounded border border-slate-200 object-cover bg-slate-100"}),o.jsx("span",{className:"text-xs text-ink/70 break-all line-clamp-3",children:t.name})]}):o.jsx("span",{className:"text-sm text-ink/80",children:r?"选择图片(必选)":"选择图片(可选)"}),o.jsx("input",{id:l,type:"file",accept:"image/*",className:"sr-only",onChange:u=>{var a;return n(((a=u.target.files)==null?void 0:a[0])??null)}})]})}const Ts="gemini-3.1-flash-image-preview",nu="gemini-3-pro-image-preview";function $h(){var L,$;const e=Pr(),t=((L=e.image.models.find(U=>U.value===Ts))==null?void 0:L.label)??"Nano Banana 2",n=(($=e.image.models.find(U=>U.value===nu))==null?void 0:$.label)??"Nano Banana Pro",[r,l]=v.useState(""),[s,i]=v.useState("flash-minimal"),[u,a]=v.useState(e.image.aspect_ratios[0]??"1:1"),[c,d]=v.useState(e.image.resolutions[0]??"1K"),[m,h]=v.useState(null),[x,y]=v.useState(null),[k,N]=v.useState(null),[p,f]=v.useState(!1),[g,w]=v.useState(null),[j,R]=v.useState(null),S=v.useRef(null),P=v.useMemo(()=>[{id:"flash-minimal",label:t},{id:"flash-high",label:`${t}(长思考)`},{id:"pro-high",label:`${n}(长思考)`}],[t,n]);async function T(U){if(U.preventDefault(),w(null),R(null),!r.trim()){w("请填写提示词。");return}let ie,fe;switch(s){case"flash-minimal":ie=Ts,fe="minimal";break;case"flash-high":ie=Ts,fe="high";break;case"pro-high":ie=nu,fe="high";break}const M=new FormData;M.append("prompt",r.trim()),M.append("model",ie),M.append("aspect_ratio",u),M.append("resolution",c),M.append("thinking_level",fe),m&&M.append("image_0",m),x&&M.append("image_1",x),k&&M.append("image_2",k),f(!0);try{const _=await en("/api/generate/image",{method:"POST",body:M}),b=await _.json().catch(()=>({}));if(!_.ok)throw new Error(b.detail||_.statusText);const E=b.image_base64,z=b.mime_type;R(`data:${z};base64,${E}`)}catch(_){w(_ instanceof Error?_.message:"请求失败")}finally{f(!1)}}return o.jsxs("div",{className:"max-w-3xl",children:[o.jsx("h1",{className:"font-display text-2xl font-semibold text-ink mb-2",children:"图片编辑或生成"}),o.jsxs("div",{className:"mb-6 space-y-1.5",children:[o.jsx("p",{className:"text-mist text-sm leading-relaxed",children:"填写提示词;参考图最多三张。再选比例与分辨率。"}),o.jsxs("p",{className:"text-xs text-mist leading-relaxed",children:[t," 与 ",n," 为实验性,接口或效果可能变更。"]})]}),o.jsxs("form",{ref:S,onSubmit:T,className:"space-y-5",children:[o.jsxs("fieldset",{disabled:p,className:"border-0 p-0 m-0 min-w-0 space-y-5 disabled:pointer-events-none disabled:opacity-[0.92]",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-semibold text-ink mb-1",children:"模型"}),o.jsx("select",{className:"w-full max-w-md rounded-lg border border-slate-300 bg-white px-2 py-2 text-sm",value:s,onChange:U=>i(U.target.value),children:P.map(U=>o.jsx("option",{value:U.id,children:U.label},U.id))}),o.jsxs("p",{className:"text-xs text-mist mt-1.5",children:[t," 为默认快速选项;",t,"(长思考)与 ",n,"(长思考)为长思考模式,更慢、更细;",n," 为 Pro 路线。"]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-semibold text-ink mb-1",children:"提示词(必填)"}),o.jsx("textarea",{className:"w-full min-h-[120px] rounded-lg border border-slate-300 bg-white px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-clay/50",value:r,onChange:U=>l(U.target.value),placeholder:"填写画面描述…"})]}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-semibold text-ink mb-1",children:"宽高比"}),o.jsx("select",{className:"w-full rounded-lg border border-slate-300 bg-white px-2 py-2 text-sm",value:u,onChange:U=>a(U.target.value),children:e.image.aspect_ratios.map(U=>o.jsx("option",{value:U,children:U},U))})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-semibold text-ink mb-1",children:"分辨率"}),o.jsx("select",{className:"w-full rounded-lg border border-slate-300 bg-white px-2 py-2 text-sm",value:c,onChange:U=>d(U.target.value),children:e.image.resolutions.map(U=>o.jsx("option",{value:U,children:U},U))})]})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-semibold text-ink mb-2",children:"参考图(最多三张)"}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[o.jsx(ot,{label:"参考图 1",file:m,onChange:h}),o.jsx(ot,{label:"参考图 2",file:x,onChange:y}),o.jsx(ot,{label:"参考图 3",file:k,onChange:N})]})]}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("button",{type:"submit",className:"rounded-lg bg-ink text-paper px-5 py-2 text-sm font-medium hover:bg-slate-800 disabled:opacity-40",children:p?"生成中…":"生成图片"}),o.jsx(es,{active:p})]})]}),g&&o.jsx("p",{className:"text-sm text-red-700",children:g})]}),j&&o.jsxs("div",{className:"mt-10 border-t border-slate-200 pt-8",children:[o.jsx("h2",{className:"font-display text-xl font-semibold text-ink mb-3",children:"生成结果"}),o.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-3",children:[o.jsx(tn,{dataUrl:j,filenameBase:"image-gen",label:"下载图片"}),o.jsx("button",{type:"button",onClick:()=>{var U;return(U=S.current)==null?void 0:U.requestSubmit()},className:"rounded-lg border border-slate-300 bg-white px-5 py-2 text-sm font-medium text-ink hover:bg-slate-50",children:"重新生成"})]}),o.jsx("img",{src:j,alt:"生成结果",className:"max-w-full rounded-xl border border-slate-200 shadow-lg"})]})]})}const K=8,Ah=.22,Vh=8,Wh=8;function ru(e,t){const n=Math.max(1e-9,Math.abs(e)),r=Math.max(1e-9,Math.abs(t));return n>=r?`${(n/r).toFixed(3)}∶1`:`1∶${(r/n).toFixed(3)}`}function lu(e){const t=e.trim();if(t==="free"||!t)return null;const n=t.split(":");if(n.length!==2)return null;const r=Number(n[0]),l=Number(n[1]);return!Number.isFinite(r)||!Number.isFinite(l)||l===0?null:r/l}function Hh(e,t,n){if(e/t>n){const i=t,u=i*n;return{x:(e-u)/2,y:0,w:u,h:i}}const l=e,s=l/n;return{x:0,y:(t-s)/2,w:l,h:s}}function Ls(e,t,n){let{x:r,y:l,w:s,h:i}=e;return s=Math.max(K,Math.min(s,t)),i=Math.max(K,Math.min(i,n)),r=Math.max(0,Math.min(r,t-s)),l=Math.max(0,Math.min(l,n-i)),{x:r,y:l,w:s,h:i}}function Ti(e,t){return{x:e.x*t,y:e.y*t,w:e.w*t,h:e.h*t}}function su(e,t,n,r,l,s){return{ix:e/n*l,iy:t/r*s}}function Qh(e,t,n,r,l,s,i,u){e.fillStyle=`rgba(0,0,0,${u})`,n>0&&e.fillRect(0,0,s,n),n+l0&&e.fillRect(0,n,t,l),t+rMath.hypot(e-c,t-d)<=Vh;if(u(n,r))return"nw";if(u(n+l,r))return"ne";if(u(n,r+s))return"sw";if(u(n+l,r+s))return"se";const a=Wh/2;if(i){if(e>=n&&e<=n+l&&t>=r-a&&t<=r+a)return"n";if(e>=n&&e<=n+l&&t>=r+s-a&&t<=r+s+a)return"s";if(t>=r&&t<=r+s&&e>=n-a&&e<=n+a)return"w";if(t>=r&&t<=r+s&&e>=n+l-a&&e<=n+l+a)return"e"}return e>=n&&e<=n+l&&t>=r&&t<=r+s?"move":null}function zs(e,t){if(!e)return"default";switch(e){case"nw":case"se":return"nwse-resize";case"ne":case"sw":return"nesw-resize";case"n":case"s":return"ns-resize";case"e":case"w":return"ew-resize";case"move":return t?"grab":"move";default:return"default"}}function Kh(e,t,n){return{...e,x:e.x+t,y:e.y+n}}function Gh(e,t,n,r){const{x:l,y:s,w:i,h:u}=e,a=l+i,c=s+u;switch(t){case"n":{const d=Math.min(r,c-K);return{x:l,y:d,w:i,h:c-d}}case"s":return{x:l,y:s,w:i,h:Math.max(K,r-s)};case"w":{const d=Math.min(n,a-K);return{x:d,y:s,w:a-d,h:u}}case"e":return{x:l,y:s,w:Math.max(K,n-l),h:u}}}function Yh(e,t,n,r){const{x:l,y:s,w:i,h:u}=e,a=l+i,c=s+u;switch(t){case"se":return{x:l,y:s,w:Math.max(K,n-l),h:Math.max(K,r-s)};case"nw":return{x:Math.min(n,a-K),y:Math.min(r,c-K),w:Math.max(K,a-n),h:Math.max(K,c-r)};case"ne":return{x:l,y:Math.min(r,c-K),w:Math.max(K,n-l),h:Math.max(K,c-r)};case"sw":return{x:Math.min(n,a-K),y:s,w:Math.max(K,a-n),h:Math.max(K,r-s)}}}function Xh(e,t,n,r,l){const{x:s,y:i,w:u,h:a}=e,c=s+u,d=i+a;let m=s,h=i,x=u,y=a;switch(t){case"se":{x=Math.max(K,n-s),y=Math.max(K,r-i),x/y>l?y=x/l:x=y*l;break}case"nw":{x=Math.max(K,c-n),y=Math.max(K,d-r),x/y>l?y=x/l:x=y*l,m=c-x,h=d-y;break}case"ne":{x=Math.max(K,n-s),y=Math.max(K,d-r),x/y>l?y=x/l:x=y*l,m=s,h=d-y;break}case"sw":{x=Math.max(K,c-n),y=Math.max(K,r-i),x/y>l?y=x/l:x=y*l,m=c-x,h=i;break}}return{x:m,y:h,w:x,h:y}}const Jh="rgba(220, 38, 38, 0.9)",Zh="rgba(248, 113, 113, 0.38)",qh="rgba(220, 38, 38, 0.38)",eg="rgba(153, 27, 27, 0.7)",tg="rgba(220, 38, 38, 0.5)",ng="rgba(127, 29, 29, 0.8)";function rg(e,t,n,r,l,s,i,u){e.setTransform(i,0,0,i,0,0),e.clearRect(0,0,l,s),e.drawImage(t,0,0,l,s);const a=Ti(n,r),{x:c,y:d,w:m,h}=a;Qh(e,c,d,m,h,l,s,Ah),e.lineWidth=1,e.setLineDash([6,4]),e.strokeStyle=Zh,e.strokeRect(c+.75,d+.75,m-1.5,h-1.5),e.strokeStyle=Jh,e.setLineDash([6,4]),e.strokeRect(c+.5,d+.5,m-1,h-1),e.setLineDash([]);const x=3;u&&(e.fillStyle=qh,e.strokeStyle=eg,e.lineWidth=1,e.fillRect(c,d-x/2,m,x),e.strokeRect(c,d-x/2,m,x),e.fillRect(c,d+h-x/2,m,x),e.strokeRect(c,d+h-x/2,m,x),e.fillRect(c-x/2,d,x,h),e.strokeRect(c-x/2,d,x,h),e.fillRect(c+m-x/2,d,x,h),e.strokeRect(c+m-x/2,d,x,h));const y=4,k=[[c,d],[c+m,d],[c,d+h],[c+m,d+h]];e.fillStyle=tg,e.strokeStyle=ng,e.lineWidth=1;for(const[N,p]of k)e.fillRect(N-y,p-y,y*2,y*2),e.strokeRect(N-y,p-y,y*2,y*2)}function lg(){const e=Pr(),t=v.useMemo(()=>[{value:"free",label:"自由"},...e.image.aspect_ratios.map(_=>({value:_,label:_.replace(/:/g,"∶")}))],[e.image.aspect_ratios]),n=v.useRef(null),r=v.useRef(null),l=v.useRef(null),s=v.useRef(null),[i,u]=v.useState(null),[a,c]=v.useState(null),[d,m]=v.useState(null),[h,x]=v.useState(null),[y,k]=v.useState("free"),[N,p]=v.useState({w:0,h:0}),[f,g]=v.useState(null),[w,j]=v.useState(null),R=v.useRef(1),S=v.useRef(null);v.useEffect(()=>{s.current=h},[h]);const P=v.useCallback(()=>{const _=n.current;if(!_||!d)return;const b=_.clientWidth,E=Math.min(b>0?b:800,960),z=Math.min(window.innerHeight*.65,720),I=Math.min(E/d.w,z/d.h,1);R.current=I,p({w:d.w*I,h:d.h*I})},[d]),T=v.useCallback(()=>{const _=r.current,b=l.current,E=s.current;if(!_||!b||!d||!E)return;const z=N.w,I=N.h;if(z<=0||I<=0)return;const V=window.devicePixelRatio||1;_.width=Math.floor(z*V),_.height=Math.floor(I*V),_.style.width=`${z}px`,_.style.height=`${I}px`;const W=_.getContext("2d");W&&rg(W,b,E,R.current,z,I,V,y==="free")},[d,N,y]);v.useEffect(()=>{T()},[T,h]),v.useEffect(()=>{if(!d||!h||!l.current){g(null);return}const _=l.current,b=Ls({...h},d.w,d.h),E=document.createElement("canvas");E.width=Math.round(b.w),E.height=Math.round(b.h);const z=E.getContext("2d");z&&(z.drawImage(_,b.x,b.y,b.w,b.h,0,0,b.w,b.h),g(E.toDataURL("image/png")))},[h,d]),v.useEffect(()=>()=>{a&&URL.revokeObjectURL(a)},[a]);function L(_){if(j(null),g(null),x(null),s.current=null,m(null),a&&URL.revokeObjectURL(a),c(null),u(null),l.current=null,S.current=null,!_||!_.type.startsWith("image/")){_&&j("请选择图片文件");return}u(_),c(URL.createObjectURL(_))}v.useEffect(()=>{if(!a)return;const _=new Image;_.crossOrigin="anonymous",_.onload=()=>{l.current=_,m({w:_.naturalWidth,h:_.naturalHeight}),j(null)},_.onerror=()=>j("无法加载图片"),_.src=a},[a]),v.useLayoutEffect(()=>{if(!d)return;const _=lu(y);if(_==null){const b={x:0,y:0,w:d.w,h:d.h};x(b),s.current=b}else{const b=Hh(d.w,d.h,_);x(b),s.current=b}},[d,y]),v.useLayoutEffect(()=>{!d||!h||P()},[d,h,P]),v.useEffect(()=>{if(!d||!h)return;const _=new ResizeObserver(()=>P()),b=n.current;return b&&_.observe(b),window.addEventListener("resize",P),()=>{_.disconnect(),window.removeEventListener("resize",P)}},[d,h,P]);function $(_,b,E){const z=r.current;if(!z)return{lx:0,ly:0};const I=z.getBoundingClientRect(),V=I.width>0?I.width:1,W=I.height>0?I.height:1,we=(_.clientX-I.left)/V*b,F=(_.clientY-I.top)/W*E;return{lx:we,ly:F}}function U(_){const b=s.current,E=d;if(!b||!E)return;const z=N.w,I=N.h;if(z<=0)return;const{lx:V,ly:W}=$(_,z,I),we=R.current,F=Ti(b,we),A=y==="free";let D=iu(V,W,F.x,F.y,F.w,F.h,A);if(!D)return;!A&&(D==="n"||D==="s"||D==="e"||D==="w")&&(D="move");const{ix:J,iy:nn}=su(V,W,z,I,E.w,E.h);D==="move"?S.current={kind:"move",start:{...b},startIx:J,startIy:nn}:S.current={kind:"handle",handle:D,start:{...b}},_.currentTarget.setPointerCapture(_.pointerId),_.currentTarget.style.cursor=zs(D,A)}function ie(_){const b=d,E=N.w,z=N.h;if(!b||E<=0)return;const{lx:I,ly:V}=$(_,E,z),{ix:W,iy:we}=su(I,V,E,z,b.w,b.h),F=s.current,A=R.current,D=y==="free",J=S.current;if(!J){if(!F)return;const re=Ti(F,A),ht=iu(I,V,re.x,re.y,re.w,re.h,D);_.currentTarget.style.cursor=zs(ht,D);return}if(J.kind==="move"){_.currentTarget.style.cursor=D?"grabbing":"move";const re=Kh(J.start,W-J.startIx,we-J.startIy),ht=Ls(re,b.w,b.h);s.current=ht,x(ht);return}_.currentTarget.style.cursor=zs(J.handle,D);const nn=lu(y);let mt;if(D){const re=J.handle;if(re==="n"||re==="s"||re==="e"||re==="w")mt=Gh(J.start,re,W,we);else if(re==="nw"||re==="ne"||re==="sw"||re==="se")mt=Yh(J.start,re,W,we);else return}else if(nn!=null&&(J.handle==="nw"||J.handle==="ne"||J.handle==="sw"||J.handle==="se"))mt=Xh(J.start,J.handle,W,we,nn);else return;const rn=Ls(mt,b.w,b.h);s.current=rn,x(rn)}function fe(_){S.current=null;try{_.currentTarget.releasePointerCapture(_.pointerId)}catch{}_.currentTarget.style.cursor=""}function M(_){S.current||(_.currentTarget.style.cursor="")}return o.jsxs("div",{className:"max-w-4xl",children:[o.jsx("h1",{className:"font-display text-2xl font-semibold text-ink mb-2",children:"图像裁剪"}),o.jsx("div",{className:"text-mist text-sm mb-4 leading-relaxed space-y-2",children:o.jsx("p",{children:"拖边框或四角调整范围,框内拖动可平移。固定比例时拖四角保持比例;自由模式可拖四边。红色细线为裁剪框;右侧显示尺寸,下方实时预览并可下载 PNG。"})}),o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-semibold text-ink mb-2",children:"图片(必选)"}),o.jsx("input",{type:"file",accept:"image/*",className:"text-sm text-ink file:mr-3 file:rounded-lg file:border-0 file:bg-slate-200 file:px-3 file:py-1.5 file:text-sm file:text-ink",onChange:_=>{var b;return L(((b=_.target.files)==null?void 0:b[0])??null)}})]}),i&&d&&h&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[o.jsx("span",{className:"text-sm font-semibold text-ink",children:"裁剪比例"}),o.jsx("div",{className:"flex flex-wrap gap-2",children:t.map(_=>o.jsx("button",{type:"button",onClick:()=>k(_.value),className:`text-xs px-3 py-1.5 rounded-lg border transition-colors ${y===_.value?"bg-ink text-white border-ink":"bg-white text-ink border-slate-300 hover:bg-slate-50"}`,children:_.label},_.value))})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium text-ink mb-1",children:"裁剪编辑"}),o.jsxs("p",{className:"text-xs text-mist mb-3",children:["请",o.jsx("strong",{children:"拖动裁剪框的边线或角点"}),"改变大小;在框",o.jsx("strong",{children:"内部空白处"}),"拖动可平移。(自由模式:四边与四角均可拖。)"]}),o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[1fr_minmax(200px,260px)] gap-4 items-start",children:[o.jsx("div",{ref:n,className:"w-full min-w-0 min-h-[120px] order-2 lg:order-1",children:o.jsx("canvas",{ref:r,className:"max-w-full rounded-none border border-slate-200 bg-neutral-200",style:{touchAction:"none",verticalAlign:"middle"},onPointerDown:U,onPointerMove:ie,onPointerUp:fe,onPointerCancel:fe,onPointerLeave:M})}),o.jsxs("aside",{className:"rounded-xl border border-slate-200 bg-slate-50/90 p-3 text-sm order-1 lg:order-2 lg:sticky lg:top-4",children:[o.jsx("p",{className:"text-xs font-medium text-mist mb-3",children:"尺寸与比例"}),o.jsxs("dl",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("dt",{className:"text-xs text-mist",children:"原图"}),o.jsxs("dd",{className:"font-mono text-ink tabular-nums mt-1",children:[d.w," × ",d.h," px"]}),o.jsxs("dd",{className:"text-xs text-mist mt-1",children:["比例 ",ru(d.w,d.h)]})]}),o.jsxs("div",{children:[o.jsx("dt",{className:"text-xs text-mist",children:"裁剪框(实时)"}),o.jsxs("dd",{className:"font-mono text-ink tabular-nums mt-1",children:[Math.round(h.w)," × ",Math.round(h.h)," px"]}),o.jsxs("dd",{className:"text-xs text-mist mt-1",children:["比例 ",ru(h.w,h.h)]}),o.jsxs("dd",{className:"text-xs text-mist/90 mt-1",children:["约占原图像素"," ",d.w*d.h>0?`${(h.w*h.h/(d.w*d.h)*100).toFixed(1)}%`:"—"]})]})]})]})]})]}),f&&o.jsxs("div",{className:"rounded-xl border border-slate-200 bg-white/80 p-4 space-y-3",children:[o.jsx("p",{className:"text-sm font-medium text-ink",children:"裁剪结果(实时)"}),o.jsx("img",{src:f,alt:"裁剪结果",className:"max-w-full rounded-lg border border-slate-200"}),o.jsx(tn,{dataUrl:f,filenameBase:"crop",label:"下载 PNG"})]})]})]}),w&&o.jsx("p",{className:"mt-4 text-sm text-red-700 bg-red-50 border border-red-200 rounded-lg px-3 py-2",children:w})]})}function al(e){return Math.max(0,Math.min(255,Math.round(e)))}function Li(e,t,n){return`#${[e,t,n].map(r=>al(r).toString(16).padStart(2,"0")).join("")}`}function zi(e){const n=e.trim().match(/^#?([0-9a-f]{6})$/i);if(!n)return null;const r=parseInt(n[1],16);return{r:r>>16&255,g:r>>8&255,b:r&255}}function sg(e,t,n,r,l,s,i,u,a){const c=e.data;for(let d=0;d{const d=zi(c.target.value);d&&(l(d.r,d.g,d.b),i(c.target.value))},className:"h-10 w-16 cursor-pointer rounded border border-slate-300 bg-white"})]}),o.jsxs("div",{className:"grid grid-cols-3 gap-2 text-xs",children:[o.jsxs("label",{className:"block",children:["R",o.jsx("input",{type:"number",min:0,max:255,value:t,onChange:c=>{const d=al(Number(c.target.value));l(d,n,r)},className:"w-full mt-0.5 rounded border border-slate-300 px-1 py-1"})]}),o.jsxs("label",{className:"block",children:["G",o.jsx("input",{type:"number",min:0,max:255,value:n,onChange:c=>{const d=al(Number(c.target.value));l(t,d,r)},className:"w-full mt-0.5 rounded border border-slate-300 px-1 py-1"})]}),o.jsxs("label",{className:"block",children:["B",o.jsx("input",{type:"number",min:0,max:255,value:r,onChange:c=>{const d=al(Number(c.target.value));l(t,n,d)},className:"w-full mt-0.5 rounded border border-slate-300 px-1 py-1"})]})]}),o.jsxs("div",{className:"flex flex-wrap gap-2 items-center",children:[o.jsx("label",{className:"text-xs text-mist shrink-0",children:"Hex"}),o.jsx("input",{type:"text",value:s,onChange:c=>i(c.target.value),placeholder:"#RRGGBB",className:"flex-1 min-w-[140px] rounded border border-slate-300 px-2 py-1 text-sm font-mono"}),o.jsx("button",{type:"button",onClick:u,className:"text-xs px-2 py-1 rounded border border-slate-300 hover:bg-slate-50",children:"应用 Hex"})]})]})}function ig(){const e=v.useRef(null),t=v.useRef(null),[n,r]=v.useState(null),[l,s]=v.useState(null),[i,u]=v.useState("source"),[a,c]=v.useState(255),[d,m]=v.useState(255),[h,x]=v.useState(255),[y,k]=v.useState("#ffffff"),[N,p]=v.useState(0),[f,g]=v.useState(255),[w,j]=v.useState(0),[R,S]=v.useState("#00ff00"),[P,T]=v.useState(100),[L,$]=v.useState(40),[U,ie]=v.useState(null),[fe,M]=v.useState(null),_=v.useCallback((F,A,D)=>{k(Li(F,A,D))},[]),b=v.useCallback((F,A,D)=>{S(Li(F,A,D))},[]);v.useEffect(()=>()=>{l&&URL.revokeObjectURL(l)},[l]);const E=v.useCallback(()=>{if(!n||!l||!e.current)return;const F=e.current,A=F.getContext("2d");if(!A)return;const D=new Image;D.onload=()=>{F.width=D.naturalWidth,F.height=D.naturalHeight,A.drawImage(D,0,0),t.current=A.getImageData(0,0,F.width,F.height),ie(null)},D.onerror=()=>M("无法加载图片"),D.src=l},[n,l]);v.useEffect(()=>{E()},[E]);function z(F){if(M(null),ie(null),l&&URL.revokeObjectURL(l),s(null),r(null),t.current=null,!F||!F.type.startsWith("image/")){F&&M("请选择图片文件");return}r(F),s(URL.createObjectURL(F))}function I(F){const A=e.current;if(!A||!t.current)return;const D=A.getBoundingClientRect(),J=(F.clientX-D.left)/D.width*A.width,nn=(F.clientY-D.top)/D.height*A.height,mt=Math.floor(J),rn=Math.floor(nn);if(mt<0||rn<0||mt>=A.width||rn>=A.height)return;const re=(rn*A.width+mt)*4,ht=t.current.data,Rr=ht[re],Tr=ht[re+1],Lr=ht[re+2];i==="source"?(c(Rr),m(Tr),x(Lr),_(Rr,Tr,Lr)):(p(Rr),g(Tr),j(Lr),b(Rr,Tr,Lr))}function V(){const F=zi(y);if(!F){M("原始颜色 Hex 格式无效(需 #RRGGBB)");return}M(null),c(F.r),m(F.g),x(F.b)}function W(){const F=zi(R);if(!F){M("目标颜色 Hex 格式无效(需 #RRGGBB)");return}M(null),p(F.r),g(F.g),j(F.b)}function we(){if(!t.current||!e.current){M("请先上传图片");return}M(null);const F=new ImageData(new Uint8ClampedArray(t.current.data),t.current.width,t.current.height),A=Math.round(P/100*255);sg(F,a,d,h,N,f,w,A,L);const D=document.createElement("canvas");D.width=F.width,D.height=F.height,D.getContext("2d").putImageData(F,0,0),ie(D.toDataURL("image/png"))}return o.jsxs("div",{className:"max-w-4xl",children:[o.jsx("h1",{className:"font-display text-2xl font-semibold text-ink mb-2",children:"替换纯色背景"}),o.jsx("div",{className:"text-mist text-sm mb-4 leading-relaxed space-y-2",children:o.jsxs("p",{children:["设定",o.jsx("strong",{className:"text-ink/90",children:"原始色"}),"与",o.jsx("strong",{className:"text-ink/90",children:"目标色"}),";容差内像素替换为目标色。取色:系统调色板、手动输入,或点选预览图。"]})}),o.jsx("p",{className:"text-amber-900 text-sm mb-6 bg-amber-50 border border-amber-200/80 rounded-lg px-3 py-2",children:"适合大块纯色背景;渐变或复杂纹理效果会不理想。"}),o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-semibold text-ink mb-2",children:"图片(必选)"}),o.jsx("input",{type:"file",accept:"image/*",className:"text-sm text-ink file:mr-3 file:rounded-lg file:border-0 file:bg-slate-200 file:px-3 file:py-1.5 file:text-sm file:text-ink",onChange:F=>{var A;return z(((A=F.target.files)==null?void 0:A[0])??null)}})]}),n&&l&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsxs("fieldset",{className:"border-0 p-0 m-0 mb-3",children:[o.jsx("legend",{className:"text-sm font-semibold text-ink mb-2",children:"预览图取色(可选)"}),o.jsxs("div",{className:"flex flex-wrap gap-4 text-sm",children:[o.jsxs("label",{className:"inline-flex items-center gap-2 cursor-pointer",children:[o.jsx("input",{type:"radio",name:"pickFor",checked:i==="source",onChange:()=>u("source"),className:"text-ink"}),"原始颜色(要替换掉的背景色)"]}),o.jsxs("label",{className:"inline-flex items-center gap-2 cursor-pointer",children:[o.jsx("input",{type:"radio",name:"pickFor",checked:i==="target",onChange:()=>u("target"),className:"text-ink"}),"目标颜色(替换成的颜色)"]})]})]}),o.jsx("p",{className:"text-sm text-mist mb-2",children:"需要吸管时,用颜色卡片里的「系统调色板」。"}),o.jsx("canvas",{ref:e,onClick:I,className:"max-w-full rounded-xl border border-slate-200 cursor-crosshair bg-slate-100"})]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsx(ou,{title:"原始颜色",r:a,g:d,b:h,onRgbChange:(F,A,D)=>{c(F),m(A),x(D),_(F,A,D)},hexInput:y,onHexInputChange:k,onApplyHex:V}),o.jsx(ou,{title:"目标颜色",r:N,g:f,b:w,onRgbChange:(F,A,D)=>{p(F),g(A),j(D),b(F,A,D)},hexInput:R,onHexInputChange:S,onApplyHex:W})]})]}),o.jsxs("div",{className:"border-t border-slate-200 pt-6 space-y-4",children:[o.jsxs("div",{children:[o.jsxs("label",{className:"block text-sm font-semibold text-ink mb-1",children:["目标不透明度:",P,"%"]}),o.jsx("input",{type:"range",min:0,max:100,value:P,onChange:F=>T(Number(F.target.value)),className:"w-full max-w-md h-2 rounded-full accent-ink appearance-none bg-slate-400/90"})]}),o.jsxs("div",{children:[o.jsxs("label",{className:"block text-sm font-semibold text-ink mb-1",children:["颜色容差:",L]}),o.jsx("input",{type:"range",min:0,max:120,value:L,onChange:F=>$(Number(F.target.value)),className:"w-full max-w-md h-2 rounded-full accent-ink appearance-none bg-slate-400/90"})]}),o.jsx("button",{type:"button",onClick:we,className:"rounded-lg bg-ink text-paper px-5 py-2 text-sm font-medium hover:bg-slate-800",children:"生成预览"})]}),fe&&o.jsx("p",{className:"text-sm text-red-700",children:fe}),U&&o.jsxs("div",{className:"border-t border-slate-200 pt-8",children:[o.jsx("h2",{className:"font-display text-xl font-semibold text-ink mb-3",children:"预览"}),o.jsx("img",{src:U,alt:"预览",className:"max-w-full rounded-xl border border-slate-200 shadow-lg"}),o.jsx("div",{className:"mt-3",children:o.jsx(tn,{dataUrl:U,filenameBase:"replace-bg",label:"下载 PNG"})})]})]})]})}const og="保持内容完全不变,提高图片的分辨率";function ag(e){const t=e.trim().match(/^(\d+(?:\.\d+)?)\s*:\s*(\d+(?:\.\d+)?)$/);if(!t)return null;const n=Number(t[1]),r=Number(t[2]);return r===0||!Number.isFinite(n)||!Number.isFinite(r)?null:n/r}function ug(e,t,n){const r=e/t,l=n.map(h=>({label:h,r:ag(h)})).filter(h=>h.r!==null&&h.r>0);if(l.length===0)return{value:n[0]??"1:1",warn:!0,detail:`${e}×${t}px`};const s=l.map(h=>({...h,logDiff:Math.abs(Math.log(r)-Math.log(h.r))}));s.sort((h,x)=>h.logDiff-x.logDiff);const i=s[0],u=i.logDiff,a=s.length>1?s[1].logDiff:1/0;let c=!1;s.length>1&&a<1/0&&u>0&&a/u<1.35&&(c=!0),u>.12&&(c=!0),Math.max(e,t)/Math.min(e,t)>3.5&&(c=!0);const m=`${e}×${t}px,约 ${i.label}(宽:高)`;return{value:i.label,warn:c,detail:m}}function cg(){const e=Pr(),[t,n]=v.useState(og),[r,l]=v.useState(()=>Il(e.image.models,"gemini-3.1-flash-image-preview")),[s,i]=v.useState(e.image.aspect_ratios[0]??"1:1"),[u,a]=v.useState(()=>{const S=e.image.resolutions;return S.includes("4K")?"4K":S[S.length-1]??"4K"}),[c,d]=v.useState(null),[m,h]=v.useState(null),[x,y]=v.useState(!1),[k,N]=v.useState(!1),[p,f]=v.useState(null),[g,w]=v.useState(null),j=v.useRef(null);v.useEffect(()=>{if(!c){h(null),y(!1),i(e.image.aspect_ratios[0]??"1:1");const T=e.image.resolutions;a(T.includes("4K")?"4K":T[T.length-1]??"4K");return}const S=URL.createObjectURL(c),P=new Image;P.onload=()=>{URL.revokeObjectURL(S);const T=P.naturalWidth,L=P.naturalHeight,$=ug(T,L,e.image.aspect_ratios);i($.value),y($.warn),h($.detail)},P.onerror=()=>{URL.revokeObjectURL(S),y(!0),h("无法读取图片尺寸")},P.src=S},[c,e.image.aspect_ratios,e.image.resolutions]);async function R(S){if(S.preventDefault(),f(null),w(null),!t.trim()){f("请填写提示词。");return}if(!c){f("请上传一张需要放大的图片。");return}const P=new FormData;P.append("prompt",t.trim()),P.append("model",r),P.append("aspect_ratio",s),P.append("resolution",u),P.append("image_0",c),N(!0);try{const T=await en("/api/generate/image",{method:"POST",body:P}),L=await T.json().catch(()=>({}));if(!T.ok)throw new Error(L.detail||T.statusText);const $=L.image_base64,U=L.mime_type;w(`data:${U};base64,${$}`)}catch(T){f(T instanceof Error?T.message:"请求失败")}finally{N(!1)}}return o.jsxs("div",{className:"max-w-3xl",children:[o.jsx("h1",{className:"font-display text-2xl font-semibold text-ink mb-2",children:"超分辨率"}),o.jsxs("div",{className:"mb-6 space-y-1.5",children:[o.jsx("p",{className:"text-mist text-sm leading-relaxed",children:"原图必选。选图后宽高比自动匹配(可改);分辨率默认 4K。比例差太远时会提示。"}),o.jsx("p",{className:"text-xs text-mist leading-relaxed",children:"下拉中的名称为配置所示;当前图片模型为实验性,接口或效果可能变更。"})]}),o.jsxs("form",{ref:j,onSubmit:R,className:"space-y-5",children:[o.jsxs("fieldset",{disabled:k,className:"border-0 p-0 m-0 min-w-0 space-y-5 disabled:pointer-events-none disabled:opacity-[0.92]",children:[o.jsxs("div",{children:[o.jsx(ot,{label:"原图",file:c,onChange:d,required:!0}),m&&o.jsxs("p",{className:"text-xs text-mist mt-2",children:["检测到:",m]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-semibold text-ink mb-1",children:"提示词(必填)"}),o.jsx("textarea",{className:"w-full min-h-[100px] rounded-lg border border-slate-300 bg-white px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-clay/50",value:t,onChange:S=>n(S.target.value),placeholder:"填写增强说明…"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-semibold text-ink mb-1",children:"模型"}),o.jsx("select",{className:"w-full max-w-md rounded-lg border border-slate-300 bg-white px-2 py-2 text-sm",value:r,onChange:S=>l(S.target.value),children:e.image.models.map(S=>o.jsx("option",{value:S.value,children:S.label},S.value))})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-semibold text-ink mb-1",children:"输出分辨率"}),o.jsx("select",{className:"w-full max-w-md rounded-lg border border-slate-300 bg-white px-2 py-2 text-sm",value:u,onChange:S=>a(S.target.value),children:e.image.resolutions.map(S=>o.jsx("option",{value:S,children:S},S))})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-semibold text-ink mb-1",children:"宽高比(可改)"}),o.jsx("select",{className:"w-full max-w-md rounded-lg border border-slate-300 bg-white px-2 py-2 text-sm",value:s,onChange:S=>i(S.target.value),children:e.image.aspect_ratios.map(S=>o.jsx("option",{value:S,children:S},S))}),x&&c&&o.jsx("p",{className:"text-xs text-amber-800 bg-amber-50 border border-amber-200/80 rounded-lg px-3 py-2 mt-2 leading-relaxed",children:"警告:该图的宽高比与列表中的比例都不一致,你仍可点击下方进行生成,但是生成图在内容或构图上可能与原图不一致。"})]}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("button",{type:"submit",className:"rounded-lg bg-ink text-paper px-5 py-2 text-sm font-medium hover:bg-slate-800 disabled:opacity-40",children:k?"生成中…":"生成高清图"}),o.jsx(es,{active:k})]})]}),p&&o.jsx("p",{className:"text-sm text-red-700",children:p})]}),g&&o.jsxs("div",{className:"mt-10 border-t border-slate-200 pt-8",children:[o.jsx("h2",{className:"font-display text-xl font-semibold text-ink mb-3",children:"结果"}),o.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-3",children:[o.jsx(tn,{dataUrl:g,filenameBase:"upscale",label:"下载图片"}),o.jsx("button",{type:"button",onClick:()=>{var S;return(S=j.current)==null?void 0:S.requestSubmit()},className:"rounded-lg border border-slate-300 bg-white px-5 py-2 text-sm font-medium text-ink hover:bg-slate-50",children:"重新生成"})]}),o.jsx("img",{src:g,alt:"超分辨率结果",className:"max-w-full rounded-xl border border-slate-200 shadow-lg"})]})]})}function au(e){if(!Number.isFinite(e))return"0:00";const t=Math.floor(e%60);return`${Math.floor(e/60)}:${t.toString().padStart(2,"0")}`}function dg(){const e=v.useRef(null),t=v.useRef(null),[n,r]=v.useState(null),[l,s]=v.useState(null),[i,u]=v.useState(0),[a,c]=v.useState(0),[d,m]=v.useState(null),[h,x]=v.useState(null);v.useEffect(()=>()=>{l&&URL.revokeObjectURL(l)},[l]);const y=v.useCallback(()=>{const p=e.current,f=t.current;if(!p||!f||p.readyState<2)return;const g=p.videoWidth,w=p.videoHeight;if(g===0||w===0)return;f.width=g,f.height=w;const j=f.getContext("2d");j&&(j.drawImage(p,0,0,g,w),m(f.toDataURL("image/png")))},[]);v.useEffect(()=>{const p=e.current;if(!p||!l)return;const f=()=>{const j=p.duration;u(Number.isFinite(j)?j:0),c(0),p.currentTime=0,requestAnimationFrame(()=>y())},g=()=>{c(p.currentTime),y()},w=()=>c(p.currentTime);return p.addEventListener("loadedmetadata",f),p.addEventListener("seeked",g),p.addEventListener("timeupdate",w),()=>{p.removeEventListener("loadedmetadata",f),p.removeEventListener("seeked",g),p.removeEventListener("timeupdate",w)}},[l,y]);function k(p){if(x(null),m(null),l&&URL.revokeObjectURL(l),s(null),r(p),!p)return;if(!p.type.startsWith("video/")){x("请选择视频文件。");return}const f=URL.createObjectURL(p);s(f)}function N(p){const f=e.current;f&&(f.currentTime=p)}return o.jsxs("div",{className:"max-w-3xl",children:[o.jsx("h1",{className:"font-display text-2xl font-semibold text-ink mb-2",children:"提取视频帧"}),o.jsx("p",{className:"text-mist text-sm mb-6 leading-relaxed",children:"本地选视频,拖动进度条选时刻,预览后下载 PNG。不上传服务器。"}),o.jsxs("div",{className:"space-y-5",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-semibold text-ink mb-2",children:"视频(必选)"}),o.jsx("input",{type:"file",accept:"video/*",className:"text-sm text-ink file:mr-3 file:rounded-lg file:border-0 file:bg-slate-200 file:px-3 file:py-1.5 file:text-sm file:text-ink",onChange:p=>{var f;return k(((f=p.target.files)==null?void 0:f[0])??null)}}),n&&o.jsxs("p",{className:"text-xs text-mist mt-1",children:["已选:",n.name,"(",(n.size/(1024*1024)).toFixed(2)," MB)"]})]}),l&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"rounded-xl overflow-hidden border border-slate-200 bg-black",children:o.jsx("video",{ref:e,src:l,className:"w-full max-h-[360px] object-contain",playsInline:!0,muted:!0,preload:"metadata"})}),o.jsxs("div",{children:[o.jsxs("div",{className:"flex justify-between text-xs text-mist mb-1",children:[o.jsx("span",{children:au(a)}),o.jsxs("span",{children:["/ ",au(i)]})]}),o.jsx("input",{type:"range",min:0,max:i||0,step:.01,value:a,onInput:p=>N(Number(p.target.value)),onChange:p=>N(Number(p.target.value)),className:"w-full accent-ink h-2 rounded-full appearance-none bg-slate-400/90"}),o.jsx("p",{className:"text-xs text-mist mt-1",children:"停稳后显示当前帧预览。"})]}),o.jsx("canvas",{ref:t,className:"hidden","aria-hidden":!0}),d&&o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-semibold text-ink mb-2",children:"当前帧预览"}),o.jsx("img",{src:d,alt:"当前帧",className:"max-w-full max-h-64 rounded-lg border border-slate-200 object-contain bg-slate-100"}),o.jsx("div",{className:"mt-3",children:o.jsx(tn,{dataUrl:d,filenameBase:"video-frame",label:"下载当前帧 PNG",className:"rounded-lg bg-ink text-paper px-5 py-2 text-sm font-medium hover:bg-slate-800"})})]})]}),h&&o.jsx("p",{className:"text-sm text-red-700",children:h})]})]})}function fg(){const e=Pr(),t=e.video.durations_seconds,n=t.includes(4)?4:t[0]??4,[r,l]=v.useState(""),[s,i]=v.useState(()=>Il(e.video.models,"veo-3.0-fast-generate-001")),[u,a]=v.useState(e.video.aspect_ratios[0]??"16:9"),[c,d]=v.useState(e.video.resolutions[1]??e.video.resolutions[0]??"1080p"),[m,h]=v.useState(n),[x,y]=v.useState(null),[k,N]=v.useState(null),[p,f]=v.useState(null),[g,w]=v.useState(!1),[j,R]=v.useState(null),[S,P]=v.useState(null),T=v.useRef(null),L=!!(x||k||p),$=Fd(e.video.models,s),U=L||c==="1080p"||c==="4k",ie=t.filter(M=>M===4||M===6);v.useEffect(()=>{!$&&c==="4k"&&d("1080p")},[$,c]),v.useEffect(()=>{!U&&m===8&&h(4)},[U,m]),v.useEffect(()=>{var b;if(!L||Ps(e.video.models,s))return;const M=e.video.models.filter(E=>E.supports_reference_images!==!1),_=Il(M,((b=M[0])==null?void 0:b.value)??"veo-3.0-fast-generate-001");_&&i(_)},[L,s,e.video.models]);async function fe(M){if(M.preventDefault(),R(null),P(null),!r.trim()){R("请填写提示词。");return}if(L&&!Ps(e.video.models,s)){R("该视频模型不支持参考图,请更换模型或移除参考图。");return}const _=new FormData;_.append("prompt",r.trim()),_.append("model",s),_.append("resolution",c),_.append("aspect_ratio",u),_.append("duration_seconds",String(U?8:m)),x&&_.append("image_0",x),k&&_.append("image_1",k),p&&_.append("image_2",p),w(!0);try{const b=await en("/api/generate/video",{method:"POST",body:_}),E=await b.json().catch(()=>({}));if(!b.ok)throw new Error(E.detail||b.statusText);const z=E.video_base64,I=E.mime_type;P(`data:${I};base64,${z}`)}catch(b){R(b instanceof Error?b.message:"请求失败")}finally{w(!1)}}return o.jsxs("div",{className:"max-w-3xl",children:[o.jsx("h1",{className:"font-display text-2xl font-semibold text-ink mb-2",children:"视频生成"}),o.jsxs("div",{className:"mb-6 space-y-1.5",children:[o.jsx("p",{className:"text-mist text-sm leading-relaxed",children:"填写提示词;参考图最多三张。有参考图、1080p 或 4K 时固定 8 秒;720p 仅文字时可选 4/6 秒。Veo 3.1 Lite 不支持参考图与 4K。"}),o.jsx("p",{className:"text-xs text-mist leading-relaxed",children:"Veo 3 与 Veo 3 Fast 为稳定版;Veo 3.1 系列为实验性,接口或效果可能变更。"})]}),o.jsxs("form",{ref:T,onSubmit:fe,className:"space-y-5",children:[o.jsxs("fieldset",{disabled:g,className:"border-0 p-0 m-0 min-w-0 space-y-5 disabled:pointer-events-none disabled:opacity-[0.92]",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-semibold text-ink mb-1",children:"视频模型"}),o.jsx("select",{className:"w-full max-w-md rounded-lg border border-slate-300 bg-white px-2 py-2 text-sm",value:s,onChange:M=>i(M.target.value),children:e.video.models.map(M=>o.jsxs("option",{value:M.value,disabled:L&&M.supports_reference_images===!1,children:[M.label,M.supports_reference_images===!1?"(不支持参考图)":""]},M.value))}),!Ps(e.video.models,s)&&o.jsx("p",{className:"text-xs text-mist mt-1",children:"当前模型无参考图;请换模型或移除参考图。"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-semibold text-ink mb-1",children:"提示词(必填)"}),o.jsx("textarea",{className:"w-full min-h-[120px] rounded-lg border border-slate-300 bg-white px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-clay/50",value:r,onChange:M=>l(M.target.value),placeholder:"填写短片描述…"})]}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-semibold text-ink mb-1",children:"宽高比"}),o.jsx("select",{className:"w-full rounded-lg border border-slate-300 bg-white px-2 py-2 text-sm",value:u,onChange:M=>a(M.target.value),children:e.video.aspect_ratios.map(M=>o.jsx("option",{value:M,children:M},M))})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-semibold text-ink mb-1",children:"分辨率"}),o.jsx("select",{className:"w-full rounded-lg border border-slate-300 bg-white px-2 py-2 text-sm",value:c,onChange:M=>d(M.target.value),children:e.video.resolutions.filter(M=>$||M!=="4k").map(M=>o.jsx("option",{value:M,children:M},M))})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-semibold text-ink mb-1",children:"时长(秒)"}),o.jsx("select",{className:"w-full rounded-lg border border-slate-300 bg-white px-2 py-2 text-sm disabled:opacity-50",value:U?8:m,disabled:U,onChange:M=>h(Number(M.target.value)),children:(U?[8]:ie).map(M=>o.jsxs("option",{value:M,children:[M,"s"]},M))}),U?o.jsx("p",{className:"text-xs text-mist mt-1",children:L?"有参考图时固定 8 秒。":"1080p / 4K 时固定 8 秒。"}):o.jsx("p",{className:"text-xs text-mist mt-1",children:"720p 且无参考图时,仅支持 4 秒或 6 秒。"})]})]}),o.jsxs("div",{children:[o.jsxs("p",{className:"text-sm font-semibold text-ink mb-2",children:["参考图(最多三张)",L&&o.jsx("span",{className:"block text-xs font-normal text-mist mt-1",children:"有参考图时勿选 Veo 3.1 Lite;可选 Veo 3、Veo 3 Fast、Veo 3.1 Fast 或 Veo 3.1(标准)。"})]}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[o.jsx(ot,{label:"参考图 1",file:x,onChange:y}),o.jsx(ot,{label:"参考图 2",file:k,onChange:N}),o.jsx(ot,{label:"参考图 3",file:p,onChange:f})]})]}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("button",{type:"submit",className:"rounded-lg bg-ink text-paper px-5 py-2 text-sm font-medium hover:bg-slate-800 disabled:opacity-40",children:g?"生成中…":"生成视频"}),o.jsx(es,{active:g})]})]}),j&&o.jsx("p",{className:"text-sm text-red-700",children:j})]}),S&&o.jsxs("div",{className:"mt-10 border-t border-slate-200 pt-8",children:[o.jsx("h2",{className:"font-display text-xl font-semibold text-ink mb-3",children:"生成结果"}),o.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-3",children:[o.jsx(tn,{dataUrl:S,filenameBase:"video-gen",label:"下载视频"}),o.jsx("button",{type:"button",onClick:()=>{var M;return(M=T.current)==null?void 0:M.requestSubmit()},className:"rounded-lg border border-slate-300 bg-white px-5 py-2 text-sm font-medium text-ink hover:bg-slate-50",children:"重新生成"})]}),o.jsx("video",{src:S,controls:!0,className:"max-w-full rounded-xl border border-slate-200 shadow-lg"})]})]})}function pg(){const t=Pr().video_frames,[n,r]=v.useState(""),[l,s]=v.useState(()=>Il(t.models,"veo-3.0-fast-generate-001")),[i,u]=v.useState(t.aspect_ratios[0]??"16:9"),[a,c]=v.useState(t.resolutions[1]??t.resolutions[0]??"1080p"),[d,m]=v.useState(null),[h,x]=v.useState(null),[y,k]=v.useState(!1),[N,p]=v.useState(!1),[f,g]=v.useState(null),[w,j]=v.useState(null),R=v.useRef(null),S=Fd(t.models,l);v.useEffect(()=>{y&&x(null)},[y]),v.useEffect(()=>{!S&&a==="4k"&&c("1080p")},[S,a]);async function P(T){if(T.preventDefault(),g(null),j(null),!n.trim()){g("请填写提示词。");return}if(!d){g("请上传第一帧图片。");return}const L=new FormData;L.append("prompt",n.trim()),L.append("model",l),L.append("resolution",a),L.append("aspect_ratio",i),L.append("duration_seconds","8"),L.append("start_frame",d),L.append("end_same_as_start",y?"true":"false"),!y&&h&&L.append("end_frame",h),p(!0);try{const $=await en("/api/generate/video-frames",{method:"POST",body:L}),U=await $.json().catch(()=>({}));if(!$.ok)throw new Error(U.detail||$.statusText);const ie=U.video_base64,fe=U.mime_type;j(`data:${fe};base64,${ie}`)}catch($){g($ instanceof Error?$.message:"请求失败")}finally{p(!1)}}return o.jsxs("div",{className:"max-w-3xl",children:[o.jsx("h1",{className:"font-display text-2xl font-semibold text-ink mb-2",children:"视频生成(首尾过渡)"}),o.jsxs("div",{className:"mb-6 space-y-1.5",children:[o.jsx("p",{className:"text-mist text-sm leading-relaxed",children:"起始帧(必选);填写提示词(必填)。结尾帧(可选),或与起始帧相同。时长 8 秒。"}),o.jsx("p",{className:"text-xs text-mist leading-relaxed",children:"Veo 3 与 Veo 3 Fast 为稳定版;Veo 3.1 系列为实验性,接口或效果可能变更。"})]}),o.jsxs("form",{ref:R,onSubmit:P,className:"space-y-5",children:[o.jsxs("fieldset",{disabled:N,className:"border-0 p-0 m-0 min-w-0 space-y-5 disabled:pointer-events-none disabled:opacity-[0.92]",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-semibold text-ink mb-1",children:"视频模型"}),o.jsx("select",{className:"w-full max-w-md rounded-lg border border-slate-300 bg-white px-2 py-2 text-sm",value:l,onChange:T=>s(T.target.value),children:t.models.map(T=>o.jsx("option",{value:T.value,children:T.label},T.value))})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-semibold text-ink mb-1",children:"提示词(必填)"}),o.jsx("textarea",{className:"w-full min-h-[120px] rounded-lg border border-slate-300 bg-white px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-clay/50",value:n,onChange:T=>r(T.target.value),placeholder:"描述内容如何变化…"})]}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-semibold text-ink mb-1",children:"宽高比"}),o.jsx("select",{className:"w-full rounded-lg border border-slate-300 bg-white px-2 py-2 text-sm",value:i,onChange:T=>u(T.target.value),children:t.aspect_ratios.map(T=>o.jsx("option",{value:T,children:T},T))})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-semibold text-ink mb-1",children:"分辨率"}),o.jsx("select",{className:"w-full rounded-lg border border-slate-300 bg-white px-2 py-2 text-sm",value:a,onChange:T=>c(T.target.value),children:t.resolutions.filter(T=>S||T!=="4k").map(T=>o.jsx("option",{value:T,children:T},T))})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-semibold text-ink mb-1",children:"时长(秒)"}),o.jsx("select",{className:"w-full rounded-lg border border-slate-300 bg-white px-2 py-2 text-sm disabled:opacity-60",value:8,disabled:!0,children:o.jsx("option",{value:8,children:"8s(固定)"})})]})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-semibold text-ink mb-2",children:"帧"}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(ot,{label:"起始帧",file:d,onChange:m}),o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer text-sm text-ink select-none",children:[o.jsx("input",{type:"checkbox",className:"rounded border-slate-300 text-ink focus:ring-clay/50",checked:y,onChange:T=>k(T.target.checked)}),"结尾帧与起始帧相同"]}),!y&&o.jsx(ot,{label:"结尾帧",file:h,onChange:x}),y&&o.jsx("p",{className:"text-xs text-mist pl-0.5",children:"结尾帧与起始帧为同一张图。"})]})]}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("button",{type:"submit",className:"rounded-lg bg-ink text-paper px-5 py-2 text-sm font-medium hover:bg-slate-800 disabled:opacity-40",children:N?"生成中…":"生成视频"}),o.jsx(es,{active:N})]})]}),f&&o.jsx("p",{className:"text-sm text-red-700",children:f})]}),w&&o.jsxs("div",{className:"mt-10 border-t border-slate-200 pt-8",children:[o.jsx("h2",{className:"font-display text-xl font-semibold text-ink mb-3",children:"生成结果"}),o.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-3",children:[o.jsx(tn,{dataUrl:w,filenameBase:"video-frames",label:"下载视频"}),o.jsx("button",{type:"button",onClick:()=>{var T;return(T=R.current)==null?void 0:T.requestSubmit()},className:"rounded-lg border border-slate-300 bg-white px-5 py-2 text-sm font-medium text-ink hover:bg-slate-50",children:"重新生成"})]}),o.jsx("video",{src:w,controls:!0,className:"max-w-full rounded-xl border border-slate-200 shadow-lg"})]})]})}const be="/demo-assets",mg=`A title 'Autumn Leaves' appears in the image, as if composed of leaves. +'Autumn' in the first row and 'Leaves' in the second row. italics. bold. A bit continuous strokes but still readable. Not too large, with certain margin from the edges. +The background should be like the original image. +The leaves that compose the title should be darker, mixing red and gold, while the background leaves should be yellow.`,hg=`Some dash grids and lines slowly emit from the center of the image. Black background. Loop video. +The size of the center black area should not change.`,gg="Transform this image into: The water flows slowly under the moonlight. Loop video.";function Os({text:e}){return o.jsx("div",{className:"rounded-lg border border-slate-200 bg-white px-4 py-3 text-sm text-ink/95 leading-relaxed whitespace-pre-wrap",children:e})}function vt({src:e,alt:t}){return o.jsx("img",{src:e,alt:t,className:"w-full max-h-[min(70vh,52rem)] object-contain rounded-xl border border-slate-200/90 bg-white shadow-md"})}function Yr({src:e}){return o.jsx("video",{src:e,controls:!0,playsInline:!0,className:"w-full max-h-[min(70vh,52rem)] rounded-xl border border-slate-200/90 bg-black/5 shadow-md"})}function vg(){return o.jsxs("div",{className:"max-w-5xl space-y-14",children:[o.jsxs("header",{children:[o.jsx("h1",{className:"font-display text-2xl font-semibold text-ink mb-2",children:"示例"}),o.jsx("p",{className:"text-mist text-sm leading-relaxed",children:"以下为站内能力示例(与创作台一致)。"})]}),o.jsxs("section",{className:"space-y-4",children:[o.jsx("h2",{className:"font-display text-xl font-semibold text-ink",children:"1. 手写字体生成"}),o.jsxs("p",{className:"text-sm text-mist leading-relaxed",children:["对应创作台:",o.jsx("span",{className:"text-ink/90",children:"图片编辑或生成"}),"(纯提示词生成手写风格字形等)。"]}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[o.jsxs("figure",{className:"space-y-2",children:[o.jsx(vt,{src:`${be}/example_1_prompt_to_image/output_a.png`,alt:"手写字体示例 A"}),o.jsx("figcaption",{className:"text-xs text-mist",children:"输出 A"})]}),o.jsxs("figure",{className:"space-y-2",children:[o.jsx(vt,{src:`${be}/example_1_prompt_to_image/output_b.png`,alt:"手写字体示例 B"}),o.jsx("figcaption",{className:"text-xs text-mist",children:"输出 B"})]})]})]}),o.jsxs("section",{className:"space-y-4",children:[o.jsx("h2",{className:"font-display text-xl font-semibold text-ink",children:"2. 在图片上加文字"}),o.jsxs("p",{className:"text-sm text-mist leading-relaxed",children:["对应创作台:",o.jsx("span",{className:"text-ink/90",children:"图片编辑或生成"}),"(一张参考图 + 提示词,在图上叠加或书写文字)。"]}),o.jsx("p",{className:"text-xs font-medium text-mist tracking-wide",children:"提示词"}),o.jsx(Os,{text:mg}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsxs("figure",{className:"space-y-2",children:[o.jsx(vt,{src:`${be}/example_2_image_to_image/input.png`,alt:"加字示例 输入图"}),o.jsx("figcaption",{className:"text-xs text-mist",children:"输入参考图片"})]}),o.jsxs("figure",{className:"space-y-2",children:[o.jsx(vt,{src:`${be}/example_2_image_to_image/output.png`,alt:"加字示例 输出图"}),o.jsx("figcaption",{className:"text-xs text-mist",children:"输出"})]})]})]}),o.jsxs("section",{className:"space-y-4",children:[o.jsx("h2",{className:"font-display text-xl font-semibold text-ink",children:"3. 循环视频制作"}),o.jsxs("p",{className:"text-sm text-mist leading-relaxed",children:["对应创作台:",o.jsx("span",{className:"text-ink/90",children:"视频生成(首尾过渡)"}),"(首尾可用同一帧形成循环感;素材为示例首尾帧与成片)。"]}),o.jsxs("div",{className:"space-y-8",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx("p",{className:"text-sm font-medium text-ink",children:"示例 A"}),o.jsx("p",{className:"text-xs font-medium text-mist tracking-wide",children:"提示词"}),o.jsx(Os,{text:hg}),o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4 items-start",children:[o.jsxs("figure",{className:"space-y-2",children:[o.jsx(vt,{src:`${be}/example_3a_loop_video/first_last_frame.png`,alt:"循环视频示例 A 首尾帧"}),o.jsx("figcaption",{className:"text-xs text-mist",children:"输入(首尾帧)"})]}),o.jsxs("figure",{className:"space-y-2",children:[o.jsx(Yr,{src:`${be}/example_3a_loop_video/output.mp4`}),o.jsx("figcaption",{className:"text-xs text-mist",children:"输出视频"})]})]})]}),o.jsxs("div",{className:"space-y-3 border-t border-slate-200/80 pt-8",children:[o.jsx("p",{className:"text-sm font-medium text-ink",children:"示例 B"}),o.jsx("p",{className:"text-xs font-medium text-mist tracking-wide",children:"提示词"}),o.jsx(Os,{text:gg}),o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4 items-start",children:[o.jsxs("figure",{className:"space-y-2",children:[o.jsx(vt,{src:`${be}/example_3b_loop_video/first_last_frame.png`,alt:"循环视频示例 B 首尾帧"}),o.jsx("figcaption",{className:"text-xs text-mist",children:"输入(首尾帧)"})]}),o.jsxs("figure",{className:"space-y-2",children:[o.jsx(Yr,{src:`${be}/example_3b_loop_video/output.mp4`}),o.jsx("figcaption",{className:"text-xs text-mist",children:"输出视频"})]})]})]})]})]}),o.jsxs("section",{className:"space-y-4",children:[o.jsx("h2",{className:"font-display text-xl font-semibold text-ink",children:"4. 图像超分辨率"}),o.jsxs("p",{className:"text-sm text-mist leading-relaxed",children:["对应创作台:",o.jsx("span",{className:"text-ink/90",children:"超分辨率"}),"(保留内容、提升清晰度)。"]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsxs("figure",{className:"space-y-2",children:[o.jsx(vt,{src:`${be}/example_4_super_res/input.png`,alt:"超分示例 原图"}),o.jsx("figcaption",{className:"text-xs text-mist",children:"输入"})]}),o.jsxs("figure",{className:"space-y-2",children:[o.jsx(vt,{src:`${be}/example_4_super_res/output_4k.png`,alt:"超分示例 4K 输出"}),o.jsx("figcaption",{className:"text-xs text-mist",children:"输出(4K)"})]})]})]}),o.jsxs("section",{className:"space-y-4",children:[o.jsx("h2",{className:"font-display text-xl font-semibold text-ink",children:"5. 视频延伸(长视频生成)"}),o.jsx("p",{className:"text-sm text-mist leading-relaxed",children:"成片风格预览如下;完整能力将在后续版本开放。"}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[o.jsxs("figure",{className:"space-y-2",children:[o.jsx(Yr,{src:`${be}/example_5_video_extension/output_a.mp4`}),o.jsx("figcaption",{className:"text-xs text-mist",children:"输出 A"})]}),o.jsxs("figure",{className:"space-y-2",children:[o.jsx(Yr,{src:`${be}/example_5_video_extension/output_b.mp4`}),o.jsx("figcaption",{className:"text-xs text-mist",children:"输出 B"})]})]}),o.jsx("p",{className:"text-sm text-ink/85 font-medium tracking-wide",children:"此功能敬请期待"})]})]})}function xg(){return o.jsx(Eh,{children:o.jsxs(ah,{children:[o.jsx(Te,{path:"/login",element:o.jsx(Uh,{})}),o.jsxs(Te,{element:o.jsx(bh,{}),children:[o.jsx(Te,{path:"/",element:o.jsx(_i,{to:"/image",replace:!0})}),o.jsx(Te,{path:"/image",element:o.jsx($h,{})}),o.jsx(Te,{path:"/video",element:o.jsx(fg,{})}),o.jsx(Te,{path:"/video-frames",element:o.jsx(pg,{})}),o.jsx(Te,{path:"/tools/upscale",element:o.jsx(cg,{})}),o.jsx(Te,{path:"/tools/frame",element:o.jsx(dg,{})}),o.jsx(Te,{path:"/tools/crop",element:o.jsx(lg,{})}),o.jsx(Te,{path:"/tools/replace-bg",element:o.jsx(ig,{})}),o.jsx(Te,{path:"/examples",element:o.jsx(vg,{})})]}),o.jsx(Te,{path:"*",element:o.jsx(_i,{to:"/",replace:!0})})]})})}kd(document.getElementById("root")).render(o.jsx(v.StrictMode,{children:o.jsx(hh,{children:o.jsx(xg,{})})}));