ima2-gen 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -11
- package/bin/commands/backfillThumbs.js +18 -0
- package/bin/commands/edit.js +7 -6
- package/bin/commands/gen.js +7 -6
- package/bin/commands/multimode.js +5 -4
- package/bin/commands/node.js +4 -4
- package/bin/ima2.js +7 -1
- package/bin/lib/config-store.js +1 -1
- package/docs/API.md +55 -4
- package/docs/CLI.md +9 -3
- package/docs/PROMPT_STUDIO.md +3 -1
- package/docs/migration/runtime-test-inventory.md +3 -1
- package/lib/agentRuntime.js +22 -16
- package/lib/agentSettings.js +1 -1
- package/lib/agyImageAdapter.js +232 -0
- package/lib/capabilities.js +2 -1
- package/lib/configKeys.js +1 -1
- package/lib/geminiApiImageAdapter.js +183 -0
- package/lib/grokImageAdapter.js +16 -9
- package/lib/grokMultimodeAdapter.js +2 -1
- package/lib/grokRuntime.js +3 -0
- package/lib/grokSizeMapper.js +13 -1
- package/lib/grokVideoAdapter.js +14 -7
- package/lib/historyList.js +18 -2
- package/lib/imageModels.js +15 -0
- package/lib/imageThumb.js +38 -0
- package/lib/providerOptions.js +36 -1
- package/lib/responsesFallback.js +52 -44
- package/lib/runtimeContext.js +27 -0
- package/lib/storageMigration.js +1 -1
- package/lib/thumbBackfill.js +59 -0
- package/lib/vertexAuth.js +44 -0
- package/lib/videoThumb.js +60 -0
- package/package.json +4 -2
- package/routes/auth.js +238 -0
- package/routes/edit.js +41 -7
- package/routes/generate.js +40 -12
- package/routes/history.js +13 -0
- package/routes/index.js +4 -0
- package/routes/keys.js +254 -0
- package/routes/multimode.js +39 -6
- package/routes/nodes.js +57 -35
- package/routes/quota.js +58 -7
- package/routes/video.js +7 -3
- package/server.js +123 -0
- package/ui/dist/.vite/manifest.json +12 -12
- package/ui/dist/assets/AgentWorkspace-CYv84Rus.js +3 -0
- package/ui/dist/assets/{CardNewsWorkspace-BN-ga1lG.js → CardNewsWorkspace-Dqyc1WZ1.js} +2 -2
- package/ui/dist/assets/{NodeCanvas-BbMa4IhI.js → NodeCanvas-ChEXzQbb.js} +2 -2
- package/ui/dist/assets/{PromptBuilderPanel-DRwBJRDQ.js → PromptBuilderPanel-B95ZufnR.js} +1 -1
- package/ui/dist/assets/{PromptImportDialog-Dp85kHCq.js → PromptImportDialog-DGOwFQET.js} +2 -2
- package/ui/dist/assets/{PromptImportDiscoverySection-BE8Q8MLD.js → PromptImportDiscoverySection-CgvdnR49.js} +1 -1
- package/ui/dist/assets/{PromptImportFolderSection-PtH5x0sc.js → PromptImportFolderSection-CfUye9J8.js} +1 -1
- package/ui/dist/assets/{PromptLibraryPanel-FnM9tHI9.js → PromptLibraryPanel-B9kndPw1.js} +2 -2
- package/ui/dist/assets/SettingsWorkspace-B3tgLrmF.js +1 -0
- package/ui/dist/assets/index-BhcvL0g-.js +1 -0
- package/ui/dist/assets/index-BtK3YhJc.js +39 -0
- package/ui/dist/assets/index-ClOLOjnA.css +1 -0
- package/ui/dist/index.html +2 -2
- package/ui/dist/assets/AgentWorkspace-C21zqdTZ.js +0 -3
- package/ui/dist/assets/SettingsWorkspace-MARPGyBL.js +0 -1
- package/ui/dist/assets/index-BAFI6htx.js +0 -42
- package/ui/dist/assets/index-BSXxr_Bt.js +0 -1
- package/ui/dist/assets/index-DS-ADE7U.css +0 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/NodeCanvas-ChEXzQbb.js","assets/NodeCanvas-BZV40eAE.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))r(c);new MutationObserver(c=>{for(const f of c)if(f.type==="childList")for(const p of f.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&r(p)}).observe(document,{childList:!0,subtree:!0});function i(c){const f={};return c.integrity&&(f.integrity=c.integrity),c.referrerPolicy&&(f.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?f.credentials="include":c.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function r(c){if(c.ep)return;c.ep=!0;const f=i(c);fetch(c.href,f)}})();function jb(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var eu={exports:{}},Si={};var Gp;function kb(){if(Gp)return Si;Gp=1;var n=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function i(r,c,f){var p=null;if(f!==void 0&&(p=""+f),c.key!==void 0&&(p=""+c.key),"key"in c){f={};for(var m in c)m!=="key"&&(f[m]=c[m])}else f=c;return c=f.ref,{$$typeof:n,type:r,key:p,ref:c!==void 0?c:null,props:f}}return Si.Fragment=o,Si.jsx=i,Si.jsxs=i,Si}var qp;function zb(){return qp||(qp=1,eu.exports=kb()),eu.exports}var d=zb(),tu={exports:{}},de={};var Hp;function Db(){if(Hp)return de;Hp=1;var n=Symbol.for("react.transitional.element"),o=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),p=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),b=Symbol.iterator;function N(C){return C===null||typeof C!="object"?null:(C=b&&C[b]||C["@@iterator"],typeof C=="function"?C:null)}var _={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},M=Object.assign,I={};function G(C,B,J){this.props=C,this.context=B,this.refs=I,this.updater=J||_}G.prototype.isReactComponent={},G.prototype.setState=function(C,B){if(typeof C!="object"&&typeof C!="function"&&C!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,C,B,"setState")},G.prototype.forceUpdate=function(C){this.updater.enqueueForceUpdate(this,C,"forceUpdate")};function L(){}L.prototype=G.prototype;function O(C,B,J){this.props=C,this.context=B,this.refs=I,this.updater=J||_}var k=O.prototype=new L;k.constructor=O,M(k,G.prototype),k.isPureReactComponent=!0;var $=Array.isArray;function K(){}var W={H:null,A:null,T:null,S:null},Ee=Object.prototype.hasOwnProperty;function Oe(C,B,J){var ae=J.ref;return{$$typeof:n,type:C,key:B,ref:ae!==void 0?ae:null,props:J}}function V(C,B){return Oe(C.type,B,C.props)}function ie(C){return typeof C=="object"&&C!==null&&C.$$typeof===n}function oe(C){var B={"=":"=0",":":"=2"};return"$"+C.replace(/[=:]/g,function(J){return B[J]})}var Ce=/\/+/g;function we(C,B){return typeof C=="object"&&C!==null&&C.key!=null?oe(""+C.key):B.toString(36)}function Z(C){switch(C.status){case"fulfilled":return C.value;case"rejected":throw C.reason;default:switch(typeof C.status=="string"?C.then(K,K):(C.status="pending",C.then(function(B){C.status==="pending"&&(C.status="fulfilled",C.value=B)},function(B){C.status==="pending"&&(C.status="rejected",C.reason=B)})),C.status){case"fulfilled":return C.value;case"rejected":throw C.reason}}throw C}function T(C,B,J,ae,se){var fe=typeof C;(fe==="undefined"||fe==="boolean")&&(C=null);var ve=!1;if(C===null)ve=!0;else switch(fe){case"bigint":case"string":case"number":ve=!0;break;case"object":switch(C.$$typeof){case n:case o:ve=!0;break;case x:return ve=C._init,T(ve(C._payload),B,J,ae,se)}}if(ve)return se=se(C),ve=ae===""?"."+we(C,0):ae,$(se)?(J="",ve!=null&&(J=ve.replace(Ce,"$&/")+"/"),T(se,B,J,"",function(ea){return ea})):se!=null&&(ie(se)&&(se=V(se,J+(se.key==null||C&&C.key===se.key?"":(""+se.key).replace(Ce,"$&/")+"/")+ve)),B.push(se)),1;ve=0;var Ze=ae===""?".":ae+":";if($(C))for(var qe=0;qe<C.length;qe++)ae=C[qe],fe=Ze+we(ae,qe),ve+=T(ae,B,J,fe,se);else if(qe=N(C),typeof qe=="function")for(C=qe.call(C),qe=0;!(ae=C.next()).done;)ae=ae.value,fe=Ze+we(ae,qe++),ve+=T(ae,B,J,fe,se);else if(fe==="object"){if(typeof C.then=="function")return T(Z(C),B,J,ae,se);throw B=String(C),Error("Objects are not valid as a React child (found: "+(B==="[object Object]"?"object with keys {"+Object.keys(C).join(", ")+"}":B)+"). If you meant to render a collection of children, use an array instead.")}return ve}function X(C,B,J){if(C==null)return C;var ae=[],se=0;return T(C,ae,"","",function(fe){return B.call(J,fe,se++)}),ae}function te(C){if(C._status===-1){var B=C._result;B=B(),B.then(function(J){(C._status===0||C._status===-1)&&(C._status=1,C._result=J)},function(J){(C._status===0||C._status===-1)&&(C._status=2,C._result=J)}),C._status===-1&&(C._status=0,C._result=B)}if(C._status===1)return C._result.default;throw C._result}var ye=typeof reportError=="function"?reportError:function(C){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var B=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof C=="object"&&C!==null&&typeof C.message=="string"?String(C.message):String(C),error:C});if(!window.dispatchEvent(B))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",C);return}console.error(C)},me={map:X,forEach:function(C,B,J){X(C,function(){B.apply(this,arguments)},J)},count:function(C){var B=0;return X(C,function(){B++}),B},toArray:function(C){return X(C,function(B){return B})||[]},only:function(C){if(!ie(C))throw Error("React.Children.only expected to receive a single React element child.");return C}};return de.Activity=S,de.Children=me,de.Component=G,de.Fragment=i,de.Profiler=c,de.PureComponent=O,de.StrictMode=r,de.Suspense=y,de.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=W,de.__COMPILER_RUNTIME={__proto__:null,c:function(C){return W.H.useMemoCache(C)}},de.cache=function(C){return function(){return C.apply(null,arguments)}},de.cacheSignal=function(){return null},de.cloneElement=function(C,B,J){if(C==null)throw Error("The argument must be a React element, but you passed "+C+".");var ae=M({},C.props),se=C.key;if(B!=null)for(fe in B.key!==void 0&&(se=""+B.key),B)!Ee.call(B,fe)||fe==="key"||fe==="__self"||fe==="__source"||fe==="ref"&&B.ref===void 0||(ae[fe]=B[fe]);var fe=arguments.length-2;if(fe===1)ae.children=J;else if(1<fe){for(var ve=Array(fe),Ze=0;Ze<fe;Ze++)ve[Ze]=arguments[Ze+2];ae.children=ve}return Oe(C.type,se,ae)},de.createContext=function(C){return C={$$typeof:p,_currentValue:C,_currentValue2:C,_threadCount:0,Provider:null,Consumer:null},C.Provider=C,C.Consumer={$$typeof:f,_context:C},C},de.createElement=function(C,B,J){var ae,se={},fe=null;if(B!=null)for(ae in B.key!==void 0&&(fe=""+B.key),B)Ee.call(B,ae)&&ae!=="key"&&ae!=="__self"&&ae!=="__source"&&(se[ae]=B[ae]);var ve=arguments.length-2;if(ve===1)se.children=J;else if(1<ve){for(var Ze=Array(ve),qe=0;qe<ve;qe++)Ze[qe]=arguments[qe+2];se.children=Ze}if(C&&C.defaultProps)for(ae in ve=C.defaultProps,ve)se[ae]===void 0&&(se[ae]=ve[ae]);return Oe(C,fe,se)},de.createRef=function(){return{current:null}},de.forwardRef=function(C){return{$$typeof:m,render:C}},de.isValidElement=ie,de.lazy=function(C){return{$$typeof:x,_payload:{_status:-1,_result:C},_init:te}},de.memo=function(C,B){return{$$typeof:g,type:C,compare:B===void 0?null:B}},de.startTransition=function(C){var B=W.T,J={};W.T=J;try{var ae=C(),se=W.S;se!==null&&se(J,ae),typeof ae=="object"&&ae!==null&&typeof ae.then=="function"&&ae.then(K,ye)}catch(fe){ye(fe)}finally{B!==null&&J.types!==null&&(B.types=J.types),W.T=B}},de.unstable_useCacheRefresh=function(){return W.H.useCacheRefresh()},de.use=function(C){return W.H.use(C)},de.useActionState=function(C,B,J){return W.H.useActionState(C,B,J)},de.useCallback=function(C,B){return W.H.useCallback(C,B)},de.useContext=function(C){return W.H.useContext(C)},de.useDebugValue=function(){},de.useDeferredValue=function(C,B){return W.H.useDeferredValue(C,B)},de.useEffect=function(C,B){return W.H.useEffect(C,B)},de.useEffectEvent=function(C){return W.H.useEffectEvent(C)},de.useId=function(){return W.H.useId()},de.useImperativeHandle=function(C,B,J){return W.H.useImperativeHandle(C,B,J)},de.useInsertionEffect=function(C,B){return W.H.useInsertionEffect(C,B)},de.useLayoutEffect=function(C,B){return W.H.useLayoutEffect(C,B)},de.useMemo=function(C,B){return W.H.useMemo(C,B)},de.useOptimistic=function(C,B){return W.H.useOptimistic(C,B)},de.useReducer=function(C,B,J){return W.H.useReducer(C,B,J)},de.useRef=function(C){return W.H.useRef(C)},de.useState=function(C){return W.H.useState(C)},de.useSyncExternalStore=function(C,B,J){return W.H.useSyncExternalStore(C,B,J)},de.useTransition=function(){return W.H.useTransition()},de.version="19.2.5",de}var Pp;function Mu(){return Pp||(Pp=1,tu.exports=Db()),tu.exports}var D=Mu();const or=jb(D);var au={exports:{}},xi={},nu={exports:{}},lu={};var Up;function Lb(){return Up||(Up=1,(function(n){function o(T,X){var te=T.length;T.push(X);e:for(;0<te;){var ye=te-1>>>1,me=T[ye];if(0<c(me,X))T[ye]=X,T[te]=me,te=ye;else break e}}function i(T){return T.length===0?null:T[0]}function r(T){if(T.length===0)return null;var X=T[0],te=T.pop();if(te!==X){T[0]=te;e:for(var ye=0,me=T.length,C=me>>>1;ye<C;){var B=2*(ye+1)-1,J=T[B],ae=B+1,se=T[ae];if(0>c(J,te))ae<me&&0>c(se,J)?(T[ye]=se,T[ae]=te,ye=ae):(T[ye]=J,T[B]=te,ye=B);else if(ae<me&&0>c(se,te))T[ye]=se,T[ae]=te,ye=ae;else break e}}return X}function c(T,X){var te=T.sortIndex-X.sortIndex;return te!==0?te:T.id-X.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;n.unstable_now=function(){return f.now()}}else{var p=Date,m=p.now();n.unstable_now=function(){return p.now()-m}}var y=[],g=[],x=1,S=null,b=3,N=!1,_=!1,M=!1,I=!1,G=typeof setTimeout=="function"?setTimeout:null,L=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function k(T){for(var X=i(g);X!==null;){if(X.callback===null)r(g);else if(X.startTime<=T)r(g),X.sortIndex=X.expirationTime,o(y,X);else break;X=i(g)}}function $(T){if(M=!1,k(T),!_)if(i(y)!==null)_=!0,K||(K=!0,oe());else{var X=i(g);X!==null&&Z($,X.startTime-T)}}var K=!1,W=-1,Ee=5,Oe=-1;function V(){return I?!0:!(n.unstable_now()-Oe<Ee)}function ie(){if(I=!1,K){var T=n.unstable_now();Oe=T;var X=!0;try{e:{_=!1,M&&(M=!1,L(W),W=-1),N=!0;var te=b;try{t:{for(k(T),S=i(y);S!==null&&!(S.expirationTime>T&&V());){var ye=S.callback;if(typeof ye=="function"){S.callback=null,b=S.priorityLevel;var me=ye(S.expirationTime<=T);if(T=n.unstable_now(),typeof me=="function"){S.callback=me,k(T),X=!0;break t}S===i(y)&&r(y),k(T)}else r(y);S=i(y)}if(S!==null)X=!0;else{var C=i(g);C!==null&&Z($,C.startTime-T),X=!1}}break e}finally{S=null,b=te,N=!1}X=void 0}}finally{X?oe():K=!1}}}var oe;if(typeof O=="function")oe=function(){O(ie)};else if(typeof MessageChannel<"u"){var Ce=new MessageChannel,we=Ce.port2;Ce.port1.onmessage=ie,oe=function(){we.postMessage(null)}}else oe=function(){G(ie,0)};function Z(T,X){W=G(function(){T(n.unstable_now())},X)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(T){T.callback=null},n.unstable_forceFrameRate=function(T){0>T||125<T?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Ee=0<T?Math.floor(1e3/T):5},n.unstable_getCurrentPriorityLevel=function(){return b},n.unstable_next=function(T){switch(b){case 1:case 2:case 3:var X=3;break;default:X=b}var te=b;b=X;try{return T()}finally{b=te}},n.unstable_requestPaint=function(){I=!0},n.unstable_runWithPriority=function(T,X){switch(T){case 1:case 2:case 3:case 4:case 5:break;default:T=3}var te=b;b=T;try{return X()}finally{b=te}},n.unstable_scheduleCallback=function(T,X,te){var ye=n.unstable_now();switch(typeof te=="object"&&te!==null?(te=te.delay,te=typeof te=="number"&&0<te?ye+te:ye):te=ye,T){case 1:var me=-1;break;case 2:me=250;break;case 5:me=1073741823;break;case 4:me=1e4;break;default:me=5e3}return me=te+me,T={id:x++,callback:X,priorityLevel:T,startTime:te,expirationTime:me,sortIndex:-1},te>ye?(T.sortIndex=te,o(g,T),i(y)===null&&T===i(g)&&(M?(L(W),W=-1):M=!0,Z($,te-ye))):(T.sortIndex=me,o(y,T),_||N||(_=!0,K||(K=!0,oe()))),T},n.unstable_shouldYield=V,n.unstable_wrapCallback=function(T){var X=b;return function(){var te=b;b=X;try{return T.apply(this,arguments)}finally{b=te}}}})(lu)),lu}var Bp;function Gb(){return Bp||(Bp=1,nu.exports=Lb()),nu.exports}var iu={exports:{}},mt={};var Fp;function qb(){if(Fp)return mt;Fp=1;var n=Mu();function o(y){var g="https://react.dev/errors/"+y;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var x=2;x<arguments.length;x++)g+="&args[]="+encodeURIComponent(arguments[x])}return"Minified React error #"+y+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var r={d:{f:i,r:function(){throw Error(o(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},c=Symbol.for("react.portal");function f(y,g,x){var S=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:S==null?null:""+S,children:y,containerInfo:g,implementation:x}}var p=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(y,g){if(y==="font")return"";if(typeof g=="string")return g==="use-credentials"?g:""}return mt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,mt.createPortal=function(y,g){var x=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11)throw Error(o(299));return f(y,g,null,x)},mt.flushSync=function(y){var g=p.T,x=r.p;try{if(p.T=null,r.p=2,y)return y()}finally{p.T=g,r.p=x,r.d.f()}},mt.preconnect=function(y,g){typeof y=="string"&&(g?(g=g.crossOrigin,g=typeof g=="string"?g==="use-credentials"?g:"":void 0):g=null,r.d.C(y,g))},mt.prefetchDNS=function(y){typeof y=="string"&&r.d.D(y)},mt.preinit=function(y,g){if(typeof y=="string"&&g&&typeof g.as=="string"){var x=g.as,S=m(x,g.crossOrigin),b=typeof g.integrity=="string"?g.integrity:void 0,N=typeof g.fetchPriority=="string"?g.fetchPriority:void 0;x==="style"?r.d.S(y,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:S,integrity:b,fetchPriority:N}):x==="script"&&r.d.X(y,{crossOrigin:S,integrity:b,fetchPriority:N,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},mt.preinitModule=function(y,g){if(typeof y=="string")if(typeof g=="object"&&g!==null){if(g.as==null||g.as==="script"){var x=m(g.as,g.crossOrigin);r.d.M(y,{crossOrigin:x,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0})}}else g==null&&r.d.M(y)},mt.preload=function(y,g){if(typeof y=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var x=g.as,S=m(x,g.crossOrigin);r.d.L(y,x,{crossOrigin:S,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0,type:typeof g.type=="string"?g.type:void 0,fetchPriority:typeof g.fetchPriority=="string"?g.fetchPriority:void 0,referrerPolicy:typeof g.referrerPolicy=="string"?g.referrerPolicy:void 0,imageSrcSet:typeof g.imageSrcSet=="string"?g.imageSrcSet:void 0,imageSizes:typeof g.imageSizes=="string"?g.imageSizes:void 0,media:typeof g.media=="string"?g.media:void 0})}},mt.preloadModule=function(y,g){if(typeof y=="string")if(g){var x=m(g.as,g.crossOrigin);r.d.m(y,{as:typeof g.as=="string"&&g.as!=="script"?g.as:void 0,crossOrigin:x,integrity:typeof g.integrity=="string"?g.integrity:void 0})}else r.d.m(y)},mt.requestFormReset=function(y){r.d.r(y)},mt.unstable_batchedUpdates=function(y,g){return y(g)},mt.useFormState=function(y,g,x){return p.H.useFormState(y,g,x)},mt.useFormStatus=function(){return p.H.useHostTransitionStatus()},mt.version="19.2.5",mt}var Kp;function Jh(){if(Kp)return iu.exports;Kp=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(o){console.error(o)}}return n(),iu.exports=qb(),iu.exports}var Vp;function Hb(){if(Vp)return xi;Vp=1;var n=Gb(),o=Mu(),i=Jh();function r(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(e){var t=e,a=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(a=t.return),e=t.return;while(e)}return t.tag===3?a:null}function p(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function m(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function y(e){if(f(e)!==e)throw Error(r(188))}function g(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(r(188));return t!==e?null:e}for(var a=e,l=t;;){var s=a.return;if(s===null)break;var u=s.alternate;if(u===null){if(l=s.return,l!==null){a=l;continue}break}if(s.child===u.child){for(u=s.child;u;){if(u===a)return y(s),e;if(u===l)return y(s),t;u=u.sibling}throw Error(r(188))}if(a.return!==l.return)a=s,l=u;else{for(var h=!1,v=s.child;v;){if(v===a){h=!0,a=s,l=u;break}if(v===l){h=!0,l=s,a=u;break}v=v.sibling}if(!h){for(v=u.child;v;){if(v===a){h=!0,a=u,l=s;break}if(v===l){h=!0,l=u,a=s;break}v=v.sibling}if(!h)throw Error(r(189))}}if(a.alternate!==l)throw Error(r(190))}if(a.tag!==3)throw Error(r(188));return a.stateNode.current===a?e:t}function x(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=x(e),t!==null)return t;e=e.sibling}return null}var S=Object.assign,b=Symbol.for("react.element"),N=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),M=Symbol.for("react.fragment"),I=Symbol.for("react.strict_mode"),G=Symbol.for("react.profiler"),L=Symbol.for("react.consumer"),O=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),$=Symbol.for("react.suspense"),K=Symbol.for("react.suspense_list"),W=Symbol.for("react.memo"),Ee=Symbol.for("react.lazy"),Oe=Symbol.for("react.activity"),V=Symbol.for("react.memo_cache_sentinel"),ie=Symbol.iterator;function oe(e){return e===null||typeof e!="object"?null:(e=ie&&e[ie]||e["@@iterator"],typeof e=="function"?e:null)}var Ce=Symbol.for("react.client.reference");function we(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Ce?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case M:return"Fragment";case G:return"Profiler";case I:return"StrictMode";case $:return"Suspense";case K:return"SuspenseList";case Oe:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case _:return"Portal";case O:return e.displayName||"Context";case L:return(e._context.displayName||"Context")+".Consumer";case k:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case W:return t=e.displayName||null,t!==null?t:we(e.type)||"Memo";case Ee:t=e._payload,e=e._init;try{return we(e(t))}catch{}}return null}var Z=Array.isArray,T=o.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te={pending:!1,data:null,method:null,action:null},ye=[],me=-1;function C(e){return{current:e}}function B(e){0>me||(e.current=ye[me],ye[me]=null,me--)}function J(e,t){me++,ye[me]=e.current,e.current=t}var ae=C(null),se=C(null),fe=C(null),ve=C(null);function Ze(e,t){switch(J(fe,t),J(se,e),J(ae,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?rp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=rp(t),e=sp(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}B(ae),J(ae,e)}function qe(){B(ae),B(se),B(fe)}function ea(e){e.memoizedState!==null&&J(ve,e);var t=ae.current,a=sp(t,e.type);t!==a&&(J(se,e),J(ae,a))}function U(e){se.current===e&&(B(ae),B(se)),ve.current===e&&(B(ve),gi._currentValue=te)}var Se,Pe;function Ve(e){if(Se===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);Se=t&&t[1]||"",Pe=-1<a.stack.indexOf(`
|
|
3
|
+
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
4
|
+
`+Se+e+Pe}var Ma=!1;function on(e,t){if(!e||Ma)return"";Ma=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(t){var Y=function(){throw Error()};if(Object.defineProperty(Y.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Y,[])}catch(H){var q=H}Reflect.construct(e,[],Y)}else{try{Y.call()}catch(H){q=H}e.call(Y.prototype)}}else{try{throw Error()}catch(H){q=H}(Y=e())&&typeof Y.catch=="function"&&Y.catch(function(){})}}catch(H){if(H&&q&&typeof H.stack=="string")return[H.stack,q.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var s=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");s&&s.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var u=l.DetermineComponentFrameRoot(),h=u[0],v=u[1];if(h&&v){var A=h.split(`
|
|
5
|
+
`),z=v.split(`
|
|
6
|
+
`);for(s=l=0;l<A.length&&!A[l].includes("DetermineComponentFrameRoot");)l++;for(;s<z.length&&!z[s].includes("DetermineComponentFrameRoot");)s++;if(l===A.length||s===z.length)for(l=A.length-1,s=z.length-1;1<=l&&0<=s&&A[l]!==z[s];)s--;for(;1<=l&&0<=s;l--,s--)if(A[l]!==z[s]){if(l!==1||s!==1)do if(l--,s--,0>s||A[l]!==z[s]){var P=`
|
|
7
|
+
`+A[l].replace(" at new "," at ");return e.displayName&&P.includes("<anonymous>")&&(P=P.replace("<anonymous>",e.displayName)),P}while(1<=l&&0<=s);break}}}finally{Ma=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?Ve(a):""}function Pi(e,t){switch(e.tag){case 26:case 27:case 5:return Ve(e.type);case 16:return Ve("Lazy");case 13:return e.child!==t&&t!==null?Ve("Suspense Fallback"):Ve("Suspense");case 19:return Ve("SuspenseList");case 0:case 15:return on(e.type,!1);case 11:return on(e.type.render,!1);case 1:return on(e.type,!0);case 31:return Ve("Activity");default:return""}}function Ra(e){try{var t="",a=null;do t+=Pi(e,a),a=e,e=e.return;while(e);return t}catch(l){return`
|
|
8
|
+
Error generating stack: `+l.message+`
|
|
9
|
+
`+l.stack}}var Cl=Object.prototype.hasOwnProperty,Q=n.unstable_scheduleCallback,Me=n.unstable_cancelCallback,ht=n.unstable_shouldYield,ue=n.unstable_requestPaint,Fe=n.unstable_now,jn=n.unstable_getCurrentPriorityLevel,zt=n.unstable_ImmediatePriority,qu=n.unstable_UserBlockingPriority,Ui=n.unstable_NormalPriority,py=n.unstable_LowPriority,Hu=n.unstable_IdlePriority,hy=n.log,gy=n.unstable_setDisableYieldValue,wl=null,At=null;function Ia(e){if(typeof hy=="function"&&gy(e),At&&typeof At.setStrictMode=="function")try{At.setStrictMode(wl,e)}catch{}}var Ct=Math.clz32?Math.clz32:by,yy=Math.log,vy=Math.LN2;function by(e){return e>>>=0,e===0?32:31-(yy(e)/vy|0)|0}var Bi=256,Fi=262144,Ki=4194304;function rn(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Vi(e,t,a){var l=e.pendingLanes;if(l===0)return 0;var s=0,u=e.suspendedLanes,h=e.pingedLanes;e=e.warmLanes;var v=l&134217727;return v!==0?(l=v&~u,l!==0?s=rn(l):(h&=v,h!==0?s=rn(h):a||(a=v&~e,a!==0&&(s=rn(a))))):(v=l&~u,v!==0?s=rn(v):h!==0?s=rn(h):a||(a=l&~e,a!==0&&(s=rn(a)))),s===0?0:t!==0&&t!==s&&(t&u)===0&&(u=s&-s,a=t&-t,u>=a||u===32&&(a&4194048)!==0)?t:s}function Ml(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Sy(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Pu(){var e=Ki;return Ki<<=1,(Ki&62914560)===0&&(Ki=4194304),e}function Ur(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function Rl(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function xy(e,t,a,l,s,u){var h=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var v=e.entanglements,A=e.expirationTimes,z=e.hiddenUpdates;for(a=h&~a;0<a;){var P=31-Ct(a),Y=1<<P;v[P]=0,A[P]=-1;var q=z[P];if(q!==null)for(z[P]=null,P=0;P<q.length;P++){var H=q[P];H!==null&&(H.lane&=-536870913)}a&=~Y}l!==0&&Uu(e,l,0),u!==0&&s===0&&e.tag!==0&&(e.suspendedLanes|=u&~(h&~t))}function Uu(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-Ct(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|a&261930}function Bu(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var l=31-Ct(a),s=1<<l;s&t|e[l]&t&&(e[l]|=t),a&=~s}}function Fu(e,t){var a=t&-t;return a=(a&42)!==0?1:Br(a),(a&(e.suspendedLanes|t))!==0?0:a}function Br(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Fr(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Ku(){var e=X.p;return e!==0?e:(e=window.event,e===void 0?32:Ip(e.type))}function Vu(e,t){var a=X.p;try{return X.p=e,t()}finally{X.p=a}}var Oa=Math.random().toString(36).slice(2),rt="__reactFiber$"+Oa,vt="__reactProps$"+Oa,kn="__reactContainer$"+Oa,Kr="__reactEvents$"+Oa,Ty="__reactListeners$"+Oa,Ny="__reactHandles$"+Oa,Yu="__reactResources$"+Oa,Il="__reactMarker$"+Oa;function Vr(e){delete e[rt],delete e[vt],delete e[Kr],delete e[Ty],delete e[Ny]}function zn(e){var t=e[rt];if(t)return t;for(var a=e.parentNode;a;){if(t=a[kn]||a[rt]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=hp(e);e!==null;){if(a=e[rt])return a;e=hp(e)}return t}e=a,a=e.parentNode}return null}function Dn(e){if(e=e[rt]||e[kn]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Ol(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(r(33))}function Ln(e){var t=e[Yu];return t||(t=e[Yu]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function lt(e){e[Il]=!0}var Xu=new Set,Qu={};function sn(e,t){Gn(e,t),Gn(e+"Capture",t)}function Gn(e,t){for(Qu[e]=t,e=0;e<t.length;e++)Xu.add(t[e])}var _y=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Zu={},Ju={};function Ey(e){return Cl.call(Ju,e)?!0:Cl.call(Zu,e)?!1:_y.test(e)?Ju[e]=!0:(Zu[e]=!0,!1)}function Yi(e,t,a){if(Ey(t))if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var l=t.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+a)}}function Xi(e,t,a){if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+a)}}function ca(e,t,a,l){if(l===null)e.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(t,a,""+l)}}function Dt(e){switch(typeof e){case"bigint":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 Ay(e,t,a){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var s=l.get,u=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(h){a=""+h,u.call(this,h)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return a},setValue:function(h){a=""+h},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Yr(e){if(!e._valueTracker){var t=$u(e)?"checked":"value";e._valueTracker=Ay(e,t,""+e[t])}}function Wu(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),l="";return e&&(l=$u(e)?e.checked?"true":"false":e.value),e=l,e!==a?(t.setValue(e),!0):!1}function Qi(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}}var Cy=/[\n"\\]/g;function Lt(e){return e.replace(Cy,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Xr(e,t,a,l,s,u,h,v){e.name="",h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"?e.type=h:e.removeAttribute("type"),t!=null?h==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Dt(t)):e.value!==""+Dt(t)&&(e.value=""+Dt(t)):h!=="submit"&&h!=="reset"||e.removeAttribute("value"),t!=null?Qr(e,h,Dt(t)):a!=null?Qr(e,h,Dt(a)):l!=null&&e.removeAttribute("value"),s==null&&u!=null&&(e.defaultChecked=!!u),s!=null&&(e.checked=s&&typeof s!="function"&&typeof s!="symbol"),v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?e.name=""+Dt(v):e.removeAttribute("name")}function ed(e,t,a,l,s,u,h,v){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(e.type=u),t!=null||a!=null){if(!(u!=="submit"&&u!=="reset"||t!=null)){Yr(e);return}a=a!=null?""+Dt(a):"",t=t!=null?""+Dt(t):a,v||t===e.value||(e.value=t),e.defaultValue=t}l=l??s,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=v?e.checked:!!l,e.defaultChecked=!!l,h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.name=h),Yr(e)}function Qr(e,t,a){t==="number"&&Qi(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function qn(e,t,a,l){if(e=e.options,t){t={};for(var s=0;s<a.length;s++)t["$"+a[s]]=!0;for(a=0;a<e.length;a++)s=t.hasOwnProperty("$"+e[a].value),e[a].selected!==s&&(e[a].selected=s),s&&l&&(e[a].defaultSelected=!0)}else{for(a=""+Dt(a),t=null,s=0;s<e.length;s++){if(e[s].value===a){e[s].selected=!0,l&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function td(e,t,a){if(t!=null&&(t=""+Dt(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+Dt(a):""}function ad(e,t,a,l){if(t==null){if(l!=null){if(a!=null)throw Error(r(92));if(Z(l)){if(1<l.length)throw Error(r(93));l=l[0]}a=l}a==null&&(a=""),t=a}a=Dt(t),e.defaultValue=a,l=e.textContent,l===a&&l!==""&&l!==null&&(e.value=l),Yr(e)}function Hn(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=t;return}}e.textContent=t}var wy=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function nd(e,t,a){var l=t.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?l?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":l?e.setProperty(t,a):typeof a!="number"||a===0||wy.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function ld(e,t,a){if(t!=null&&typeof t!="object")throw Error(r(62));if(e=e.style,a!=null){for(var l in a)!a.hasOwnProperty(l)||t!=null&&t.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var s in t)l=t[s],t.hasOwnProperty(s)&&a[s]!==l&&nd(e,s,l)}else for(var u in t)t.hasOwnProperty(u)&&nd(e,u,t[u])}function Zr(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var My=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Ry=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Zi(e){return Ry.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ua(){}var Jr=null;function $r(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Pn=null,Un=null;function id(e){var t=Dn(e);if(t&&(e=t.stateNode)){var a=e[vt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Xr(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),t=a.name,a.type==="radio"&&t!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Lt(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var l=a[t];if(l!==e&&l.form===e.form){var s=l[vt]||null;if(!s)throw Error(r(90));Xr(l,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name)}}for(t=0;t<a.length;t++)l=a[t],l.form===e.form&&Wu(l)}break e;case"textarea":td(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&qn(e,!!a.multiple,t,!1)}}}var Wr=!1;function od(e,t,a){if(Wr)return e(t,a);Wr=!0;try{var l=e(t);return l}finally{if(Wr=!1,(Pn!==null||Un!==null)&&(Go(),Pn&&(t=Pn,e=Un,Un=Pn=null,id(t),e)))for(t=0;t<e.length;t++)id(e[t])}}function jl(e,t){var a=e.stateNode;if(a===null)return null;var l=a[vt]||null;if(l===null)return null;a=l[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(r(231,t,typeof a));return a}var da=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),es=!1;if(da)try{var kl={};Object.defineProperty(kl,"passive",{get:function(){es=!0}}),window.addEventListener("test",kl,kl),window.removeEventListener("test",kl,kl)}catch{es=!1}var ja=null,ts=null,Ji=null;function rd(){if(Ji)return Ji;var e,t=ts,a=t.length,l,s="value"in ja?ja.value:ja.textContent,u=s.length;for(e=0;e<a&&t[e]===s[e];e++);var h=a-e;for(l=1;l<=h&&t[a-l]===s[u-l];l++);return Ji=s.slice(e,1<l?1-l:void 0)}function $i(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Wi(){return!0}function sd(){return!1}function bt(e){function t(a,l,s,u,h){this._reactName=a,this._targetInst=s,this.type=l,this.nativeEvent=u,this.target=h,this.currentTarget=null;for(var v in e)e.hasOwnProperty(v)&&(a=e[v],this[v]=a?a(u):u[v]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?Wi:sd,this.isPropagationStopped=sd,this}return S(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Wi)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Wi)},persist:function(){},isPersistent:Wi}),t}var cn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},eo=bt(cn),zl=S({},cn,{view:0,detail:0}),Iy=bt(zl),as,ns,Dl,to=S({},zl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:is,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Dl&&(Dl&&e.type==="mousemove"?(as=e.screenX-Dl.screenX,ns=e.screenY-Dl.screenY):ns=as=0,Dl=e),as)},movementY:function(e){return"movementY"in e?e.movementY:ns}}),cd=bt(to),Oy=S({},to,{dataTransfer:0}),jy=bt(Oy),ky=S({},zl,{relatedTarget:0}),ls=bt(ky),zy=S({},cn,{animationName:0,elapsedTime:0,pseudoElement:0}),Dy=bt(zy),Ly=S({},cn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Gy=bt(Ly),qy=S({},cn,{data:0}),ud=bt(qy),Hy={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Py={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Uy={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function By(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Uy[e])?!!t[e]:!1}function is(){return By}var Fy=S({},zl,{key:function(e){if(e.key){var t=Hy[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=$i(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Py[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:is,charCode:function(e){return e.type==="keypress"?$i(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?$i(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Ky=bt(Fy),Vy=S({},to,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),dd=bt(Vy),Yy=S({},zl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:is}),Xy=bt(Yy),Qy=S({},cn,{propertyName:0,elapsedTime:0,pseudoElement:0}),Zy=bt(Qy),Jy=S({},to,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),$y=bt(Jy),Wy=S({},cn,{newState:0,oldState:0}),ev=bt(Wy),tv=[9,13,27,32],os=da&&"CompositionEvent"in window,Ll=null;da&&"documentMode"in document&&(Ll=document.documentMode);var av=da&&"TextEvent"in window&&!Ll,fd=da&&(!os||Ll&&8<Ll&&11>=Ll),md=" ",pd=!1;function hd(e,t){switch(e){case"keyup":return tv.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function gd(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Bn=!1;function nv(e,t){switch(e){case"compositionend":return gd(t);case"keypress":return t.which!==32?null:(pd=!0,md);case"textInput":return e=t.data,e===md&&pd?null:e;default:return null}}function lv(e,t){if(Bn)return e==="compositionend"||!os&&hd(e,t)?(e=rd(),Ji=ts=ja=null,Bn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return fd&&t.locale!=="ko"?null:t.data;default:return null}}var iv={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function yd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!iv[e.type]:t==="textarea"}function vd(e,t,a,l){Pn?Un?Un.push(l):Un=[l]:Pn=l,t=Ko(t,"onChange"),0<t.length&&(a=new eo("onChange","change",null,a,l),e.push({event:a,listeners:t}))}var Gl=null,ql=null;function ov(e){tp(e,0)}function ao(e){var t=Ol(e);if(Wu(t))return e}function bd(e,t){if(e==="change")return t}var Sd=!1;if(da){var rs;if(da){var ss="oninput"in document;if(!ss){var xd=document.createElement("div");xd.setAttribute("oninput","return;"),ss=typeof xd.oninput=="function"}rs=ss}else rs=!1;Sd=rs&&(!document.documentMode||9<document.documentMode)}function Td(){Gl&&(Gl.detachEvent("onpropertychange",Nd),ql=Gl=null)}function Nd(e){if(e.propertyName==="value"&&ao(ql)){var t=[];vd(t,ql,e,$r(e)),od(ov,t)}}function rv(e,t,a){e==="focusin"?(Td(),Gl=t,ql=a,Gl.attachEvent("onpropertychange",Nd)):e==="focusout"&&Td()}function sv(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ao(ql)}function cv(e,t){if(e==="click")return ao(t)}function uv(e,t){if(e==="input"||e==="change")return ao(t)}function dv(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var wt=typeof Object.is=="function"?Object.is:dv;function Hl(e,t){if(wt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var a=Object.keys(e),l=Object.keys(t);if(a.length!==l.length)return!1;for(l=0;l<a.length;l++){var s=a[l];if(!Cl.call(t,s)||!wt(e[s],t[s]))return!1}return!0}function _d(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Ed(e,t){var a=_d(e);e=0;for(var l;a;){if(a.nodeType===3){if(l=e+a.textContent.length,e<=t&&l>=t)return{node:a,offset:t-e};e=l}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=_d(a)}}function Ad(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ad(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Cd(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Qi(e.document);t instanceof e.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)e=t.contentWindow;else break;t=Qi(e.document)}return t}function cs(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var fv=da&&"documentMode"in document&&11>=document.documentMode,Fn=null,us=null,Pl=null,ds=!1;function wd(e,t,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;ds||Fn==null||Fn!==Qi(l)||(l=Fn,"selectionStart"in l&&cs(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Pl&&Hl(Pl,l)||(Pl=l,l=Ko(us,"onSelect"),0<l.length&&(t=new eo("onSelect","select",null,t,a),e.push({event:t,listeners:l}),t.target=Fn)))}function un(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var Kn={animationend:un("Animation","AnimationEnd"),animationiteration:un("Animation","AnimationIteration"),animationstart:un("Animation","AnimationStart"),transitionrun:un("Transition","TransitionRun"),transitionstart:un("Transition","TransitionStart"),transitioncancel:un("Transition","TransitionCancel"),transitionend:un("Transition","TransitionEnd")},fs={},Md={};da&&(Md=document.createElement("div").style,"AnimationEvent"in window||(delete Kn.animationend.animation,delete Kn.animationiteration.animation,delete Kn.animationstart.animation),"TransitionEvent"in window||delete Kn.transitionend.transition);function dn(e){if(fs[e])return fs[e];if(!Kn[e])return e;var t=Kn[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in Md)return fs[e]=t[a];return e}var Rd=dn("animationend"),Id=dn("animationiteration"),Od=dn("animationstart"),mv=dn("transitionrun"),pv=dn("transitionstart"),hv=dn("transitioncancel"),jd=dn("transitionend"),kd=new Map,ms="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");ms.push("scrollEnd");function Vt(e,t){kd.set(e,t),sn(t,[e])}var no=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Gt=[],Vn=0,ps=0;function lo(){for(var e=Vn,t=ps=Vn=0;t<e;){var a=Gt[t];Gt[t++]=null;var l=Gt[t];Gt[t++]=null;var s=Gt[t];Gt[t++]=null;var u=Gt[t];if(Gt[t++]=null,l!==null&&s!==null){var h=l.pending;h===null?s.next=s:(s.next=h.next,h.next=s),l.pending=s}u!==0&&zd(a,s,u)}}function io(e,t,a,l){Gt[Vn++]=e,Gt[Vn++]=t,Gt[Vn++]=a,Gt[Vn++]=l,ps|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function hs(e,t,a,l){return io(e,t,a,l),oo(e)}function fn(e,t){return io(e,null,null,t),oo(e)}function zd(e,t,a){e.lanes|=a;var l=e.alternate;l!==null&&(l.lanes|=a);for(var s=!1,u=e.return;u!==null;)u.childLanes|=a,l=u.alternate,l!==null&&(l.childLanes|=a),u.tag===22&&(e=u.stateNode,e===null||e._visibility&1||(s=!0)),e=u,u=u.return;return e.tag===3?(u=e.stateNode,s&&t!==null&&(s=31-Ct(a),e=u.hiddenUpdates,l=e[s],l===null?e[s]=[t]:l.push(t),t.lane=a|536870912),u):null}function oo(e){if(50<ci)throw ci=0,_c=null,Error(r(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Yn={};function gv(e,t,a,l){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Mt(e,t,a,l){return new gv(e,t,a,l)}function gs(e){return e=e.prototype,!(!e||!e.isReactComponent)}function fa(e,t){var a=e.alternate;return a===null?(a=Mt(e.tag,t,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=t,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,t=e.dependencies,a.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function Dd(e,t){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,t=a.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function ro(e,t,a,l,s,u){var h=0;if(l=e,typeof e=="function")gs(e)&&(h=1);else if(typeof e=="string")h=xb(e,a,ae.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Oe:return e=Mt(31,a,t,s),e.elementType=Oe,e.lanes=u,e;case M:return mn(a.children,s,u,t);case I:h=8,s|=24;break;case G:return e=Mt(12,a,t,s|2),e.elementType=G,e.lanes=u,e;case $:return e=Mt(13,a,t,s),e.elementType=$,e.lanes=u,e;case K:return e=Mt(19,a,t,s),e.elementType=K,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case O:h=10;break e;case L:h=9;break e;case k:h=11;break e;case W:h=14;break e;case Ee:h=16,l=null;break e}h=29,a=Error(r(130,e===null?"null":typeof e,"")),l=null}return t=Mt(h,a,t,s),t.elementType=e,t.type=l,t.lanes=u,t}function mn(e,t,a,l){return e=Mt(7,e,l,t),e.lanes=a,e}function ys(e,t,a){return e=Mt(6,e,null,t),e.lanes=a,e}function Ld(e){var t=Mt(18,null,null,0);return t.stateNode=e,t}function vs(e,t,a){return t=Mt(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Gd=new WeakMap;function qt(e,t){if(typeof e=="object"&&e!==null){var a=Gd.get(e);return a!==void 0?a:(t={value:e,source:t,stack:Ra(t)},Gd.set(e,t),t)}return{value:e,source:t,stack:Ra(t)}}var Xn=[],Qn=0,so=null,Ul=0,Ht=[],Pt=0,ka=null,ta=1,aa="";function ma(e,t){Xn[Qn++]=Ul,Xn[Qn++]=so,so=e,Ul=t}function qd(e,t,a){Ht[Pt++]=ta,Ht[Pt++]=aa,Ht[Pt++]=ka,ka=e;var l=ta;e=aa;var s=32-Ct(l)-1;l&=~(1<<s),a+=1;var u=32-Ct(t)+s;if(30<u){var h=s-s%5;u=(l&(1<<h)-1).toString(32),l>>=h,s-=h,ta=1<<32-Ct(t)+s|a<<s|l,aa=u+e}else ta=1<<u|a<<s|l,aa=e}function bs(e){e.return!==null&&(ma(e,1),qd(e,1,0))}function Ss(e){for(;e===so;)so=Xn[--Qn],Xn[Qn]=null,Ul=Xn[--Qn],Xn[Qn]=null;for(;e===ka;)ka=Ht[--Pt],Ht[Pt]=null,aa=Ht[--Pt],Ht[Pt]=null,ta=Ht[--Pt],Ht[Pt]=null}function Hd(e,t){Ht[Pt++]=ta,Ht[Pt++]=aa,Ht[Pt++]=ka,ta=t.id,aa=t.overflow,ka=e}var st=null,Ue=null,Ae=!1,za=null,Ut=!1,xs=Error(r(519));function Da(e){var t=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Bl(qt(t,e)),xs}function Pd(e){var t=e.stateNode,a=e.type,l=e.memoizedProps;switch(t[rt]=e,t[vt]=l,a){case"dialog":Te("cancel",t),Te("close",t);break;case"iframe":case"object":case"embed":Te("load",t);break;case"video":case"audio":for(a=0;a<di.length;a++)Te(di[a],t);break;case"source":Te("error",t);break;case"img":case"image":case"link":Te("error",t),Te("load",t);break;case"details":Te("toggle",t);break;case"input":Te("invalid",t),ed(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Te("invalid",t);break;case"textarea":Te("invalid",t),ad(t,l.value,l.defaultValue,l.children)}a=l.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||t.textContent===""+a||l.suppressHydrationWarning===!0||ip(t.textContent,a)?(l.popover!=null&&(Te("beforetoggle",t),Te("toggle",t)),l.onScroll!=null&&Te("scroll",t),l.onScrollEnd!=null&&Te("scrollend",t),l.onClick!=null&&(t.onclick=ua),t=!0):t=!1,t||Da(e,!0)}function Ud(e){for(st=e.return;st;)switch(st.tag){case 5:case 31:case 13:Ut=!1;return;case 27:case 3:Ut=!0;return;default:st=st.return}}function Zn(e){if(e!==st)return!1;if(!Ae)return Ud(e),Ae=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||qc(e.type,e.memoizedProps)),a=!a),a&&Ue&&Da(e),Ud(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));Ue=pp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));Ue=pp(e)}else t===27?(t=Ue,Za(e.type)?(e=Fc,Fc=null,Ue=e):Ue=t):Ue=st?Ft(e.stateNode.nextSibling):null;return!0}function pn(){Ue=st=null,Ae=!1}function Ts(){var e=za;return e!==null&&(Nt===null?Nt=e:Nt.push.apply(Nt,e),za=null),e}function Bl(e){za===null?za=[e]:za.push(e)}var Ns=C(null),hn=null,pa=null;function La(e,t,a){J(Ns,t._currentValue),t._currentValue=a}function ha(e){e._currentValue=Ns.current,B(Ns)}function _s(e,t,a){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===a)break;e=e.return}}function Es(e,t,a,l){var s=e.child;for(s!==null&&(s.return=e);s!==null;){var u=s.dependencies;if(u!==null){var h=s.child;u=u.firstContext;e:for(;u!==null;){var v=u;u=s;for(var A=0;A<t.length;A++)if(v.context===t[A]){u.lanes|=a,v=u.alternate,v!==null&&(v.lanes|=a),_s(u.return,a,e),l||(h=null);break e}u=v.next}}else if(s.tag===18){if(h=s.return,h===null)throw Error(r(341));h.lanes|=a,u=h.alternate,u!==null&&(u.lanes|=a),_s(h,a,e),h=null}else h=s.child;if(h!==null)h.return=s;else for(h=s;h!==null;){if(h===e){h=null;break}if(s=h.sibling,s!==null){s.return=h.return,h=s;break}h=h.return}s=h}}function Jn(e,t,a,l){e=null;for(var s=t,u=!1;s!==null;){if(!u){if((s.flags&524288)!==0)u=!0;else if((s.flags&262144)!==0)break}if(s.tag===10){var h=s.alternate;if(h===null)throw Error(r(387));if(h=h.memoizedProps,h!==null){var v=s.type;wt(s.pendingProps.value,h.value)||(e!==null?e.push(v):e=[v])}}else if(s===ve.current){if(h=s.alternate,h===null)throw Error(r(387));h.memoizedState.memoizedState!==s.memoizedState.memoizedState&&(e!==null?e.push(gi):e=[gi])}s=s.return}e!==null&&Es(t,e,a,l),t.flags|=262144}function co(e){for(e=e.firstContext;e!==null;){if(!wt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function gn(e){hn=e,pa=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ct(e){return Bd(hn,e)}function uo(e,t){return hn===null&&gn(e),Bd(e,t)}function Bd(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},pa===null){if(e===null)throw Error(r(308));pa=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else pa=pa.next=t;return a}var yv=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(a,l){e.push(l)}};this.abort=function(){t.aborted=!0,e.forEach(function(a){return a()})}},vv=n.unstable_scheduleCallback,bv=n.unstable_NormalPriority,We={$$typeof:O,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function As(){return{controller:new yv,data:new Map,refCount:0}}function Fl(e){e.refCount--,e.refCount===0&&vv(bv,function(){e.controller.abort()})}var Kl=null,Cs=0,$n=0,Wn=null;function Sv(e,t){if(Kl===null){var a=Kl=[];Cs=0,$n=Rc(),Wn={status:"pending",value:void 0,then:function(l){a.push(l)}}}return Cs++,t.then(Fd,Fd),t}function Fd(){if(--Cs===0&&Kl!==null){Wn!==null&&(Wn.status="fulfilled");var e=Kl;Kl=null,$n=0,Wn=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function xv(e,t){var a=[],l={status:"pending",value:null,reason:null,then:function(s){a.push(s)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var s=0;s<a.length;s++)(0,a[s])(t)},function(s){for(l.status="rejected",l.reason=s,s=0;s<a.length;s++)(0,a[s])(void 0)}),l}var Kd=T.S;T.S=function(e,t){Mm=Fe(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Sv(e,t),Kd!==null&&Kd(e,t)};var yn=C(null);function ws(){var e=yn.current;return e!==null?e:He.pooledCache}function fo(e,t){t===null?J(yn,yn.current):J(yn,t.pool)}function Vd(){var e=ws();return e===null?null:{parent:We._currentValue,pool:e}}var el=Error(r(460)),Ms=Error(r(474)),mo=Error(r(542)),po={then:function(){}};function Yd(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Xd(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(ua,ua),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Zd(e),e;default:if(typeof t.status=="string")t.then(ua,ua);else{if(e=He,e!==null&&100<e.shellSuspendCounter)throw Error(r(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var s=t;s.status="fulfilled",s.value=l}},function(l){if(t.status==="pending"){var s=t;s.status="rejected",s.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Zd(e),e}throw bn=t,el}}function vn(e){try{var t=e._init;return t(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(bn=a,el):a}}var bn=null;function Qd(){if(bn===null)throw Error(r(459));var e=bn;return bn=null,e}function Zd(e){if(e===el||e===mo)throw Error(r(483))}var tl=null,Vl=0;function ho(e){var t=Vl;return Vl+=1,tl===null&&(tl=[]),Xd(tl,e,t)}function Yl(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function go(e,t){throw t.$$typeof===b?Error(r(525)):(e=Object.prototype.toString.call(t),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Jd(e){function t(R,w){if(e){var j=R.deletions;j===null?(R.deletions=[w],R.flags|=16):j.push(w)}}function a(R,w){if(!e)return null;for(;w!==null;)t(R,w),w=w.sibling;return null}function l(R){for(var w=new Map;R!==null;)R.key!==null?w.set(R.key,R):w.set(R.index,R),R=R.sibling;return w}function s(R,w){return R=fa(R,w),R.index=0,R.sibling=null,R}function u(R,w,j){return R.index=j,e?(j=R.alternate,j!==null?(j=j.index,j<w?(R.flags|=67108866,w):j):(R.flags|=67108866,w)):(R.flags|=1048576,w)}function h(R){return e&&R.alternate===null&&(R.flags|=67108866),R}function v(R,w,j,F){return w===null||w.tag!==6?(w=ys(j,R.mode,F),w.return=R,w):(w=s(w,j),w.return=R,w)}function A(R,w,j,F){var re=j.type;return re===M?P(R,w,j.props.children,F,j.key):w!==null&&(w.elementType===re||typeof re=="object"&&re!==null&&re.$$typeof===Ee&&vn(re)===w.type)?(w=s(w,j.props),Yl(w,j),w.return=R,w):(w=ro(j.type,j.key,j.props,null,R.mode,F),Yl(w,j),w.return=R,w)}function z(R,w,j,F){return w===null||w.tag!==4||w.stateNode.containerInfo!==j.containerInfo||w.stateNode.implementation!==j.implementation?(w=vs(j,R.mode,F),w.return=R,w):(w=s(w,j.children||[]),w.return=R,w)}function P(R,w,j,F,re){return w===null||w.tag!==7?(w=mn(j,R.mode,F,re),w.return=R,w):(w=s(w,j),w.return=R,w)}function Y(R,w,j){if(typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint")return w=ys(""+w,R.mode,j),w.return=R,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case N:return j=ro(w.type,w.key,w.props,null,R.mode,j),Yl(j,w),j.return=R,j;case _:return w=vs(w,R.mode,j),w.return=R,w;case Ee:return w=vn(w),Y(R,w,j)}if(Z(w)||oe(w))return w=mn(w,R.mode,j,null),w.return=R,w;if(typeof w.then=="function")return Y(R,ho(w),j);if(w.$$typeof===O)return Y(R,uo(R,w),j);go(R,w)}return null}function q(R,w,j,F){var re=w!==null?w.key:null;if(typeof j=="string"&&j!==""||typeof j=="number"||typeof j=="bigint")return re!==null?null:v(R,w,""+j,F);if(typeof j=="object"&&j!==null){switch(j.$$typeof){case N:return j.key===re?A(R,w,j,F):null;case _:return j.key===re?z(R,w,j,F):null;case Ee:return j=vn(j),q(R,w,j,F)}if(Z(j)||oe(j))return re!==null?null:P(R,w,j,F,null);if(typeof j.then=="function")return q(R,w,ho(j),F);if(j.$$typeof===O)return q(R,w,uo(R,j),F);go(R,j)}return null}function H(R,w,j,F,re){if(typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint")return R=R.get(j)||null,v(w,R,""+F,re);if(typeof F=="object"&&F!==null){switch(F.$$typeof){case N:return R=R.get(F.key===null?j:F.key)||null,A(w,R,F,re);case _:return R=R.get(F.key===null?j:F.key)||null,z(w,R,F,re);case Ee:return F=vn(F),H(R,w,j,F,re)}if(Z(F)||oe(F))return R=R.get(j)||null,P(w,R,F,re,null);if(typeof F.then=="function")return H(R,w,j,ho(F),re);if(F.$$typeof===O)return H(R,w,j,uo(w,F),re);go(w,F)}return null}function ne(R,w,j,F){for(var re=null,Re=null,le=w,he=w=0,_e=null;le!==null&&he<j.length;he++){le.index>he?(_e=le,le=null):_e=le.sibling;var Ie=q(R,le,j[he],F);if(Ie===null){le===null&&(le=_e);break}e&&le&&Ie.alternate===null&&t(R,le),w=u(Ie,w,he),Re===null?re=Ie:Re.sibling=Ie,Re=Ie,le=_e}if(he===j.length)return a(R,le),Ae&&ma(R,he),re;if(le===null){for(;he<j.length;he++)le=Y(R,j[he],F),le!==null&&(w=u(le,w,he),Re===null?re=le:Re.sibling=le,Re=le);return Ae&&ma(R,he),re}for(le=l(le);he<j.length;he++)_e=H(le,R,he,j[he],F),_e!==null&&(e&&_e.alternate!==null&&le.delete(_e.key===null?he:_e.key),w=u(_e,w,he),Re===null?re=_e:Re.sibling=_e,Re=_e);return e&&le.forEach(function(tn){return t(R,tn)}),Ae&&ma(R,he),re}function ce(R,w,j,F){if(j==null)throw Error(r(151));for(var re=null,Re=null,le=w,he=w=0,_e=null,Ie=j.next();le!==null&&!Ie.done;he++,Ie=j.next()){le.index>he?(_e=le,le=null):_e=le.sibling;var tn=q(R,le,Ie.value,F);if(tn===null){le===null&&(le=_e);break}e&&le&&tn.alternate===null&&t(R,le),w=u(tn,w,he),Re===null?re=tn:Re.sibling=tn,Re=tn,le=_e}if(Ie.done)return a(R,le),Ae&&ma(R,he),re;if(le===null){for(;!Ie.done;he++,Ie=j.next())Ie=Y(R,Ie.value,F),Ie!==null&&(w=u(Ie,w,he),Re===null?re=Ie:Re.sibling=Ie,Re=Ie);return Ae&&ma(R,he),re}for(le=l(le);!Ie.done;he++,Ie=j.next())Ie=H(le,R,he,Ie.value,F),Ie!==null&&(e&&Ie.alternate!==null&&le.delete(Ie.key===null?he:Ie.key),w=u(Ie,w,he),Re===null?re=Ie:Re.sibling=Ie,Re=Ie);return e&&le.forEach(function(Ob){return t(R,Ob)}),Ae&&ma(R,he),re}function Ge(R,w,j,F){if(typeof j=="object"&&j!==null&&j.type===M&&j.key===null&&(j=j.props.children),typeof j=="object"&&j!==null){switch(j.$$typeof){case N:e:{for(var re=j.key;w!==null;){if(w.key===re){if(re=j.type,re===M){if(w.tag===7){a(R,w.sibling),F=s(w,j.props.children),F.return=R,R=F;break e}}else if(w.elementType===re||typeof re=="object"&&re!==null&&re.$$typeof===Ee&&vn(re)===w.type){a(R,w.sibling),F=s(w,j.props),Yl(F,j),F.return=R,R=F;break e}a(R,w);break}else t(R,w);w=w.sibling}j.type===M?(F=mn(j.props.children,R.mode,F,j.key),F.return=R,R=F):(F=ro(j.type,j.key,j.props,null,R.mode,F),Yl(F,j),F.return=R,R=F)}return h(R);case _:e:{for(re=j.key;w!==null;){if(w.key===re)if(w.tag===4&&w.stateNode.containerInfo===j.containerInfo&&w.stateNode.implementation===j.implementation){a(R,w.sibling),F=s(w,j.children||[]),F.return=R,R=F;break e}else{a(R,w);break}else t(R,w);w=w.sibling}F=vs(j,R.mode,F),F.return=R,R=F}return h(R);case Ee:return j=vn(j),Ge(R,w,j,F)}if(Z(j))return ne(R,w,j,F);if(oe(j)){if(re=oe(j),typeof re!="function")throw Error(r(150));return j=re.call(j),ce(R,w,j,F)}if(typeof j.then=="function")return Ge(R,w,ho(j),F);if(j.$$typeof===O)return Ge(R,w,uo(R,j),F);go(R,j)}return typeof j=="string"&&j!==""||typeof j=="number"||typeof j=="bigint"?(j=""+j,w!==null&&w.tag===6?(a(R,w.sibling),F=s(w,j),F.return=R,R=F):(a(R,w),F=ys(j,R.mode,F),F.return=R,R=F),h(R)):a(R,w)}return function(R,w,j,F){try{Vl=0;var re=Ge(R,w,j,F);return tl=null,re}catch(le){if(le===el||le===mo)throw le;var Re=Mt(29,le,null,R.mode);return Re.lanes=F,Re.return=R,Re}}}var Sn=Jd(!0),$d=Jd(!1),Ga=!1;function Rs(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Is(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function qa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ha(e,t,a){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(je&2)!==0){var s=l.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),l.pending=t,t=oo(e),zd(e,null,a),t}return io(e,l,t,a),oo(e)}function Xl(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,a|=l,t.lanes=a,Bu(e,a)}}function Os(e,t){var a=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var s=null,u=null;if(a=a.firstBaseUpdate,a!==null){do{var h={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};u===null?s=u=h:u=u.next=h,a=a.next}while(a!==null);u===null?s=u=t:u=u.next=t}else s=u=t;a={baseState:l.baseState,firstBaseUpdate:s,lastBaseUpdate:u,shared:l.shared,callbacks:l.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var js=!1;function Ql(){if(js){var e=Wn;if(e!==null)throw e}}function Zl(e,t,a,l){js=!1;var s=e.updateQueue;Ga=!1;var u=s.firstBaseUpdate,h=s.lastBaseUpdate,v=s.shared.pending;if(v!==null){s.shared.pending=null;var A=v,z=A.next;A.next=null,h===null?u=z:h.next=z,h=A;var P=e.alternate;P!==null&&(P=P.updateQueue,v=P.lastBaseUpdate,v!==h&&(v===null?P.firstBaseUpdate=z:v.next=z,P.lastBaseUpdate=A))}if(u!==null){var Y=s.baseState;h=0,P=z=A=null,v=u;do{var q=v.lane&-536870913,H=q!==v.lane;if(H?(Ne&q)===q:(l&q)===q){q!==0&&q===$n&&(js=!0),P!==null&&(P=P.next={lane:0,tag:v.tag,payload:v.payload,callback:null,next:null});e:{var ne=e,ce=v;q=t;var Ge=a;switch(ce.tag){case 1:if(ne=ce.payload,typeof ne=="function"){Y=ne.call(Ge,Y,q);break e}Y=ne;break e;case 3:ne.flags=ne.flags&-65537|128;case 0:if(ne=ce.payload,q=typeof ne=="function"?ne.call(Ge,Y,q):ne,q==null)break e;Y=S({},Y,q);break e;case 2:Ga=!0}}q=v.callback,q!==null&&(e.flags|=64,H&&(e.flags|=8192),H=s.callbacks,H===null?s.callbacks=[q]:H.push(q))}else H={lane:q,tag:v.tag,payload:v.payload,callback:v.callback,next:null},P===null?(z=P=H,A=Y):P=P.next=H,h|=q;if(v=v.next,v===null){if(v=s.shared.pending,v===null)break;H=v,v=H.next,H.next=null,s.lastBaseUpdate=H,s.shared.pending=null}}while(!0);P===null&&(A=Y),s.baseState=A,s.firstBaseUpdate=z,s.lastBaseUpdate=P,u===null&&(s.shared.lanes=0),Ka|=h,e.lanes=h,e.memoizedState=Y}}function Wd(e,t){if(typeof e!="function")throw Error(r(191,e));e.call(t)}function ef(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)Wd(a[e],t)}var al=C(null),yo=C(0);function tf(e,t){e=_a,J(yo,e),J(al,t),_a=e|t.baseLanes}function ks(){J(yo,_a),J(al,al.current)}function zs(){_a=yo.current,B(al),B(yo)}var Rt=C(null),Bt=null;function Pa(e){var t=e.alternate;J(Je,Je.current&1),J(Rt,e),Bt===null&&(t===null||al.current!==null||t.memoizedState!==null)&&(Bt=e)}function Ds(e){J(Je,Je.current),J(Rt,e),Bt===null&&(Bt=e)}function af(e){e.tag===22?(J(Je,Je.current),J(Rt,e),Bt===null&&(Bt=e)):Ua()}function Ua(){J(Je,Je.current),J(Rt,Rt.current)}function It(e){B(Rt),Bt===e&&(Bt=null),B(Je)}var Je=C(0);function vo(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Uc(a)||Bc(a)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ga=0,pe=null,De=null,et=null,bo=!1,nl=!1,xn=!1,So=0,Jl=0,ll=null,Tv=0;function Ye(){throw Error(r(321))}function Ls(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!wt(e[a],t[a]))return!1;return!0}function Gs(e,t,a,l,s,u){return ga=u,pe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,T.H=e===null||e.memoizedState===null?Hf:Ws,xn=!1,u=a(l,s),xn=!1,nl&&(u=lf(t,a,l,s)),nf(e),u}function nf(e){T.H=ei;var t=De!==null&&De.next!==null;if(ga=0,et=De=pe=null,bo=!1,Jl=0,ll=null,t)throw Error(r(300));e===null||tt||(e=e.dependencies,e!==null&&co(e)&&(tt=!0))}function lf(e,t,a,l){pe=e;var s=0;do{if(nl&&(ll=null),Jl=0,nl=!1,25<=s)throw Error(r(301));if(s+=1,et=De=null,e.updateQueue!=null){var u=e.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}T.H=Pf,u=t(a,l)}while(nl);return u}function Nv(){var e=T.H,t=e.useState()[0];return t=typeof t.then=="function"?$l(t):t,e=e.useState()[0],(De!==null?De.memoizedState:null)!==e&&(pe.flags|=1024),t}function qs(){var e=So!==0;return So=0,e}function Hs(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function Ps(e){if(bo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}bo=!1}ga=0,et=De=pe=null,nl=!1,Jl=So=0,ll=null}function gt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return et===null?pe.memoizedState=et=e:et=et.next=e,et}function $e(){if(De===null){var e=pe.alternate;e=e!==null?e.memoizedState:null}else e=De.next;var t=et===null?pe.memoizedState:et.next;if(t!==null)et=t,De=e;else{if(e===null)throw pe.alternate===null?Error(r(467)):Error(r(310));De=e,e={memoizedState:De.memoizedState,baseState:De.baseState,baseQueue:De.baseQueue,queue:De.queue,next:null},et===null?pe.memoizedState=et=e:et=et.next=e}return et}function xo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function $l(e){var t=Jl;return Jl+=1,ll===null&&(ll=[]),e=Xd(ll,e,t),t=pe,(et===null?t.memoizedState:et.next)===null&&(t=t.alternate,T.H=t===null||t.memoizedState===null?Hf:Ws),e}function To(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return $l(e);if(e.$$typeof===O)return ct(e)}throw Error(r(438,String(e)))}function Us(e){var t=null,a=pe.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var l=pe.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(s){return s.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),a===null&&(a=xo(),pe.updateQueue=a),a.memoCache=t,a=t.data[t.index],a===void 0)for(a=t.data[t.index]=Array(e),l=0;l<e;l++)a[l]=V;return t.index++,a}function ya(e,t){return typeof t=="function"?t(e):t}function No(e){var t=$e();return Bs(t,De,e)}function Bs(e,t,a){var l=e.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=a;var s=e.baseQueue,u=l.pending;if(u!==null){if(s!==null){var h=s.next;s.next=u.next,u.next=h}t.baseQueue=s=u,l.pending=null}if(u=e.baseState,s===null)e.memoizedState=u;else{t=s.next;var v=h=null,A=null,z=t,P=!1;do{var Y=z.lane&-536870913;if(Y!==z.lane?(Ne&Y)===Y:(ga&Y)===Y){var q=z.revertLane;if(q===0)A!==null&&(A=A.next={lane:0,revertLane:0,gesture:null,action:z.action,hasEagerState:z.hasEagerState,eagerState:z.eagerState,next:null}),Y===$n&&(P=!0);else if((ga&q)===q){z=z.next,q===$n&&(P=!0);continue}else Y={lane:0,revertLane:z.revertLane,gesture:null,action:z.action,hasEagerState:z.hasEagerState,eagerState:z.eagerState,next:null},A===null?(v=A=Y,h=u):A=A.next=Y,pe.lanes|=q,Ka|=q;Y=z.action,xn&&a(u,Y),u=z.hasEagerState?z.eagerState:a(u,Y)}else q={lane:Y,revertLane:z.revertLane,gesture:z.gesture,action:z.action,hasEagerState:z.hasEagerState,eagerState:z.eagerState,next:null},A===null?(v=A=q,h=u):A=A.next=q,pe.lanes|=Y,Ka|=Y;z=z.next}while(z!==null&&z!==t);if(A===null?h=u:A.next=v,!wt(u,e.memoizedState)&&(tt=!0,P&&(a=Wn,a!==null)))throw a;e.memoizedState=u,e.baseState=h,e.baseQueue=A,l.lastRenderedState=u}return s===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Fs(e){var t=$e(),a=t.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=e;var l=a.dispatch,s=a.pending,u=t.memoizedState;if(s!==null){a.pending=null;var h=s=s.next;do u=e(u,h.action),h=h.next;while(h!==s);wt(u,t.memoizedState)||(tt=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),a.lastRenderedState=u}return[u,l]}function of(e,t,a){var l=pe,s=$e(),u=Ae;if(u){if(a===void 0)throw Error(r(407));a=a()}else a=t();var h=!wt((De||s).memoizedState,a);if(h&&(s.memoizedState=a,tt=!0),s=s.queue,Ys(cf.bind(null,l,s,e),[e]),s.getSnapshot!==t||h||et!==null&&et.memoizedState.tag&1){if(l.flags|=2048,il(9,{destroy:void 0},sf.bind(null,l,s,a,t),null),He===null)throw Error(r(349));u||(ga&127)!==0||rf(l,t,a)}return a}function rf(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=pe.updateQueue,t===null?(t=xo(),pe.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function sf(e,t,a,l){t.value=a,t.getSnapshot=l,uf(t)&&df(e)}function cf(e,t,a){return a(function(){uf(t)&&df(e)})}function uf(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!wt(e,a)}catch{return!0}}function df(e){var t=fn(e,2);t!==null&&_t(t,e,2)}function Ks(e){var t=gt();if(typeof e=="function"){var a=e;if(e=a(),xn){Ia(!0);try{a()}finally{Ia(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ya,lastRenderedState:e},t}function ff(e,t,a,l){return e.baseState=a,Bs(e,De,typeof l=="function"?l:ya)}function _v(e,t,a,l,s){if(Ao(e))throw Error(r(485));if(e=t.action,e!==null){var u={payload:s,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(h){u.listeners.push(h)}};T.T!==null?a(!0):u.isTransition=!1,l(u),a=t.pending,a===null?(u.next=t.pending=u,mf(t,u)):(u.next=a.next,t.pending=a.next=u)}}function mf(e,t){var a=t.action,l=t.payload,s=e.state;if(t.isTransition){var u=T.T,h={};T.T=h;try{var v=a(s,l),A=T.S;A!==null&&A(h,v),pf(e,t,v)}catch(z){Vs(e,t,z)}finally{u!==null&&h.types!==null&&(u.types=h.types),T.T=u}}else try{u=a(s,l),pf(e,t,u)}catch(z){Vs(e,t,z)}}function pf(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){hf(e,t,l)},function(l){return Vs(e,t,l)}):hf(e,t,a)}function hf(e,t,a){t.status="fulfilled",t.value=a,gf(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,mf(e,a)))}function Vs(e,t,a){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=a,gf(t),t=t.next;while(t!==l)}e.action=null}function gf(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function yf(e,t){return t}function vf(e,t){if(Ae){var a=He.formState;if(a!==null){e:{var l=pe;if(Ae){if(Ue){t:{for(var s=Ue,u=Ut;s.nodeType!==8;){if(!u){s=null;break t}if(s=Ft(s.nextSibling),s===null){s=null;break t}}u=s.data,s=u==="F!"||u==="F"?s:null}if(s){Ue=Ft(s.nextSibling),l=s.data==="F!";break e}}Da(l)}l=!1}l&&(t=a[0])}}return a=gt(),a.memoizedState=a.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:yf,lastRenderedState:t},a.queue=l,a=Lf.bind(null,pe,l),l.dispatch=a,l=Ks(!1),u=$s.bind(null,pe,!1,l.queue),l=gt(),s={state:t,dispatch:null,action:e,pending:null},l.queue=s,a=_v.bind(null,pe,s,u,a),s.dispatch=a,l.memoizedState=e,[t,a,!1]}function bf(e){var t=$e();return Sf(t,De,e)}function Sf(e,t,a){if(t=Bs(e,t,yf)[0],e=No(ya)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=$l(t)}catch(h){throw h===el?mo:h}else l=t;t=$e();var s=t.queue,u=s.dispatch;return a!==t.memoizedState&&(pe.flags|=2048,il(9,{destroy:void 0},Ev.bind(null,s,a),null)),[l,u,e]}function Ev(e,t){e.action=t}function xf(e){var t=$e(),a=De;if(a!==null)return Sf(t,a,e);$e(),t=t.memoizedState,a=$e();var l=a.queue.dispatch;return a.memoizedState=e,[t,l,!1]}function il(e,t,a,l){return e={tag:e,create:a,deps:l,inst:t,next:null},t=pe.updateQueue,t===null&&(t=xo(),pe.updateQueue=t),a=t.lastEffect,a===null?t.lastEffect=e.next=e:(l=a.next,a.next=e,e.next=l,t.lastEffect=e),e}function Tf(){return $e().memoizedState}function _o(e,t,a,l){var s=gt();pe.flags|=e,s.memoizedState=il(1|t,{destroy:void 0},a,l===void 0?null:l)}function Eo(e,t,a,l){var s=$e();l=l===void 0?null:l;var u=s.memoizedState.inst;De!==null&&l!==null&&Ls(l,De.memoizedState.deps)?s.memoizedState=il(t,u,a,l):(pe.flags|=e,s.memoizedState=il(1|t,u,a,l))}function Nf(e,t){_o(8390656,8,e,t)}function Ys(e,t){Eo(2048,8,e,t)}function Av(e){pe.flags|=4;var t=pe.updateQueue;if(t===null)t=xo(),pe.updateQueue=t,t.events=[e];else{var a=t.events;a===null?t.events=[e]:a.push(e)}}function _f(e){var t=$e().memoizedState;return Av({ref:t,nextImpl:e}),function(){if((je&2)!==0)throw Error(r(440));return t.impl.apply(void 0,arguments)}}function Ef(e,t){return Eo(4,2,e,t)}function Af(e,t){return Eo(4,4,e,t)}function Cf(e,t){if(typeof t=="function"){e=e();var a=t(e);return function(){typeof a=="function"?a():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function wf(e,t,a){a=a!=null?a.concat([e]):null,Eo(4,4,Cf.bind(null,t,e),a)}function Xs(){}function Mf(e,t){var a=$e();t=t===void 0?null:t;var l=a.memoizedState;return t!==null&&Ls(t,l[1])?l[0]:(a.memoizedState=[e,t],e)}function Rf(e,t){var a=$e();t=t===void 0?null:t;var l=a.memoizedState;if(t!==null&&Ls(t,l[1]))return l[0];if(l=e(),xn){Ia(!0);try{e()}finally{Ia(!1)}}return a.memoizedState=[l,t],l}function Qs(e,t,a){return a===void 0||(ga&1073741824)!==0&&(Ne&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=Im(),pe.lanes|=e,Ka|=e,a)}function If(e,t,a,l){return wt(a,t)?a:al.current!==null?(e=Qs(e,a,l),wt(e,t)||(tt=!0),e):(ga&42)===0||(ga&1073741824)!==0&&(Ne&261930)===0?(tt=!0,e.memoizedState=a):(e=Im(),pe.lanes|=e,Ka|=e,t)}function Of(e,t,a,l,s){var u=X.p;X.p=u!==0&&8>u?u:8;var h=T.T,v={};T.T=v,$s(e,!1,t,a);try{var A=s(),z=T.S;if(z!==null&&z(v,A),A!==null&&typeof A=="object"&&typeof A.then=="function"){var P=xv(A,l);Wl(e,t,P,kt(e))}else Wl(e,t,l,kt(e))}catch(Y){Wl(e,t,{then:function(){},status:"rejected",reason:Y},kt())}finally{X.p=u,h!==null&&v.types!==null&&(h.types=v.types),T.T=h}}function Cv(){}function Zs(e,t,a,l){if(e.tag!==5)throw Error(r(476));var s=jf(e).queue;Of(e,s,t,te,a===null?Cv:function(){return kf(e),a(l)})}function jf(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:te,baseState:te,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ya,lastRenderedState:te},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ya,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function kf(e){var t=jf(e);t.next===null&&(t=e.alternate.memoizedState),Wl(e,t.next.queue,{},kt())}function Js(){return ct(gi)}function zf(){return $e().memoizedState}function Df(){return $e().memoizedState}function wv(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=kt();e=qa(a);var l=Ha(t,e,a);l!==null&&(_t(l,t,a),Xl(l,t,a)),t={cache:As()},e.payload=t;return}t=t.return}}function Mv(e,t,a){var l=kt();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Ao(e)?Gf(t,a):(a=hs(e,t,a,l),a!==null&&(_t(a,e,l),qf(a,t,l)))}function Lf(e,t,a){var l=kt();Wl(e,t,a,l)}function Wl(e,t,a,l){var s={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Ao(e))Gf(t,s);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var h=t.lastRenderedState,v=u(h,a);if(s.hasEagerState=!0,s.eagerState=v,wt(v,h))return io(e,t,s,0),He===null&&lo(),!1}catch{}if(a=hs(e,t,s,l),a!==null)return _t(a,e,l),qf(a,t,l),!0}return!1}function $s(e,t,a,l){if(l={lane:2,revertLane:Rc(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Ao(e)){if(t)throw Error(r(479))}else t=hs(e,a,l,2),t!==null&&_t(t,e,2)}function Ao(e){var t=e.alternate;return e===pe||t!==null&&t===pe}function Gf(e,t){nl=bo=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function qf(e,t,a){if((a&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,a|=l,t.lanes=a,Bu(e,a)}}var ei={readContext:ct,use:To,useCallback:Ye,useContext:Ye,useEffect:Ye,useImperativeHandle:Ye,useLayoutEffect:Ye,useInsertionEffect:Ye,useMemo:Ye,useReducer:Ye,useRef:Ye,useState:Ye,useDebugValue:Ye,useDeferredValue:Ye,useTransition:Ye,useSyncExternalStore:Ye,useId:Ye,useHostTransitionStatus:Ye,useFormState:Ye,useActionState:Ye,useOptimistic:Ye,useMemoCache:Ye,useCacheRefresh:Ye};ei.useEffectEvent=Ye;var Hf={readContext:ct,use:To,useCallback:function(e,t){return gt().memoizedState=[e,t===void 0?null:t],e},useContext:ct,useEffect:Nf,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,_o(4194308,4,Cf.bind(null,t,e),a)},useLayoutEffect:function(e,t){return _o(4194308,4,e,t)},useInsertionEffect:function(e,t){_o(4,2,e,t)},useMemo:function(e,t){var a=gt();t=t===void 0?null:t;var l=e();if(xn){Ia(!0);try{e()}finally{Ia(!1)}}return a.memoizedState=[l,t],l},useReducer:function(e,t,a){var l=gt();if(a!==void 0){var s=a(t);if(xn){Ia(!0);try{a(t)}finally{Ia(!1)}}}else s=t;return l.memoizedState=l.baseState=s,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:s},l.queue=e,e=e.dispatch=Mv.bind(null,pe,e),[l.memoizedState,e]},useRef:function(e){var t=gt();return e={current:e},t.memoizedState=e},useState:function(e){e=Ks(e);var t=e.queue,a=Lf.bind(null,pe,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:Xs,useDeferredValue:function(e,t){var a=gt();return Qs(a,e,t)},useTransition:function(){var e=Ks(!1);return e=Of.bind(null,pe,e.queue,!0,!1),gt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var l=pe,s=gt();if(Ae){if(a===void 0)throw Error(r(407));a=a()}else{if(a=t(),He===null)throw Error(r(349));(Ne&127)!==0||rf(l,t,a)}s.memoizedState=a;var u={value:a,getSnapshot:t};return s.queue=u,Nf(cf.bind(null,l,u,e),[e]),l.flags|=2048,il(9,{destroy:void 0},sf.bind(null,l,u,a,t),null),a},useId:function(){var e=gt(),t=He.identifierPrefix;if(Ae){var a=aa,l=ta;a=(l&~(1<<32-Ct(l)-1)).toString(32)+a,t="_"+t+"R_"+a,a=So++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=Tv++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Js,useFormState:vf,useActionState:vf,useOptimistic:function(e){var t=gt();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=$s.bind(null,pe,!0,a),a.dispatch=t,[e,t]},useMemoCache:Us,useCacheRefresh:function(){return gt().memoizedState=wv.bind(null,pe)},useEffectEvent:function(e){var t=gt(),a={impl:e};return t.memoizedState=a,function(){if((je&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}},Ws={readContext:ct,use:To,useCallback:Mf,useContext:ct,useEffect:Ys,useImperativeHandle:wf,useInsertionEffect:Ef,useLayoutEffect:Af,useMemo:Rf,useReducer:No,useRef:Tf,useState:function(){return No(ya)},useDebugValue:Xs,useDeferredValue:function(e,t){var a=$e();return If(a,De.memoizedState,e,t)},useTransition:function(){var e=No(ya)[0],t=$e().memoizedState;return[typeof e=="boolean"?e:$l(e),t]},useSyncExternalStore:of,useId:zf,useHostTransitionStatus:Js,useFormState:bf,useActionState:bf,useOptimistic:function(e,t){var a=$e();return ff(a,De,e,t)},useMemoCache:Us,useCacheRefresh:Df};Ws.useEffectEvent=_f;var Pf={readContext:ct,use:To,useCallback:Mf,useContext:ct,useEffect:Ys,useImperativeHandle:wf,useInsertionEffect:Ef,useLayoutEffect:Af,useMemo:Rf,useReducer:Fs,useRef:Tf,useState:function(){return Fs(ya)},useDebugValue:Xs,useDeferredValue:function(e,t){var a=$e();return De===null?Qs(a,e,t):If(a,De.memoizedState,e,t)},useTransition:function(){var e=Fs(ya)[0],t=$e().memoizedState;return[typeof e=="boolean"?e:$l(e),t]},useSyncExternalStore:of,useId:zf,useHostTransitionStatus:Js,useFormState:xf,useActionState:xf,useOptimistic:function(e,t){var a=$e();return De!==null?ff(a,De,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Us,useCacheRefresh:Df};Pf.useEffectEvent=_f;function ec(e,t,a,l){t=e.memoizedState,a=a(l,t),a=a==null?t:S({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var tc={enqueueSetState:function(e,t,a){e=e._reactInternals;var l=kt(),s=qa(l);s.payload=t,a!=null&&(s.callback=a),t=Ha(e,s,l),t!==null&&(_t(t,e,l),Xl(t,e,l))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var l=kt(),s=qa(l);s.tag=1,s.payload=t,a!=null&&(s.callback=a),t=Ha(e,s,l),t!==null&&(_t(t,e,l),Xl(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=kt(),l=qa(a);l.tag=2,t!=null&&(l.callback=t),t=Ha(e,l,a),t!==null&&(_t(t,e,a),Xl(t,e,a))}};function Uf(e,t,a,l,s,u,h){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,u,h):t.prototype&&t.prototype.isPureReactComponent?!Hl(a,l)||!Hl(s,u):!0}function Bf(e,t,a,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(a,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(a,l),t.state!==e&&tc.enqueueReplaceState(t,t.state,null)}function Tn(e,t){var a=t;if("ref"in t){a={};for(var l in t)l!=="ref"&&(a[l]=t[l])}if(e=e.defaultProps){a===t&&(a=S({},a));for(var s in e)a[s]===void 0&&(a[s]=e[s])}return a}function Ff(e){no(e)}function Kf(e){console.error(e)}function Vf(e){no(e)}function Co(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function Yf(e,t,a){try{var l=e.onCaughtError;l(a.value,{componentStack:a.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(s){setTimeout(function(){throw s})}}function ac(e,t,a){return a=qa(a),a.tag=3,a.payload={element:null},a.callback=function(){Co(e,t)},a}function Xf(e){return e=qa(e),e.tag=3,e}function Qf(e,t,a,l){var s=a.type.getDerivedStateFromError;if(typeof s=="function"){var u=l.value;e.payload=function(){return s(u)},e.callback=function(){Yf(t,a,l)}}var h=a.stateNode;h!==null&&typeof h.componentDidCatch=="function"&&(e.callback=function(){Yf(t,a,l),typeof s!="function"&&(Va===null?Va=new Set([this]):Va.add(this));var v=l.stack;this.componentDidCatch(l.value,{componentStack:v!==null?v:""})})}function Rv(e,t,a,l,s){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=a.alternate,t!==null&&Jn(t,a,s,!0),a=Rt.current,a!==null){switch(a.tag){case 31:case 13:return Bt===null?qo():a.alternate===null&&Xe===0&&(Xe=3),a.flags&=-257,a.flags|=65536,a.lanes=s,l===po?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([l]):t.add(l),Cc(e,l,s)),!1;case 22:return a.flags|=65536,l===po?a.flags|=16384:(t=a.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([l])},a.updateQueue=t):(a=t.retryQueue,a===null?t.retryQueue=new Set([l]):a.add(l)),Cc(e,l,s)),!1}throw Error(r(435,a.tag))}return Cc(e,l,s),qo(),!1}if(Ae)return t=Rt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=s,l!==xs&&(e=Error(r(422),{cause:l}),Bl(qt(e,a)))):(l!==xs&&(t=Error(r(423),{cause:l}),Bl(qt(t,a))),e=e.current.alternate,e.flags|=65536,s&=-s,e.lanes|=s,l=qt(l,a),s=ac(e.stateNode,l,s),Os(e,s),Xe!==4&&(Xe=2)),!1;var u=Error(r(520),{cause:l});if(u=qt(u,a),si===null?si=[u]:si.push(u),Xe!==4&&(Xe=2),t===null)return!0;l=qt(l,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=s&-s,a.lanes|=e,e=ac(a.stateNode,l,e),Os(a,e),!1;case 1:if(t=a.type,u=a.stateNode,(a.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(Va===null||!Va.has(u))))return a.flags|=65536,s&=-s,a.lanes|=s,s=Xf(s),Qf(s,e,a,l),Os(a,s),!1}a=a.return}while(a!==null);return!1}var nc=Error(r(461)),tt=!1;function ut(e,t,a,l){t.child=e===null?$d(t,null,a,l):Sn(t,e.child,a,l)}function Zf(e,t,a,l,s){a=a.render;var u=t.ref;if("ref"in l){var h={};for(var v in l)v!=="ref"&&(h[v]=l[v])}else h=l;return gn(t),l=Gs(e,t,a,h,u,s),v=qs(),e!==null&&!tt?(Hs(e,t,s),va(e,t,s)):(Ae&&v&&bs(t),t.flags|=1,ut(e,t,l,s),t.child)}function Jf(e,t,a,l,s){if(e===null){var u=a.type;return typeof u=="function"&&!gs(u)&&u.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=u,$f(e,t,u,l,s)):(e=ro(a.type,null,l,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!dc(e,s)){var h=u.memoizedProps;if(a=a.compare,a=a!==null?a:Hl,a(h,l)&&e.ref===t.ref)return va(e,t,s)}return t.flags|=1,e=fa(u,l),e.ref=t.ref,e.return=t,t.child=e}function $f(e,t,a,l,s){if(e!==null){var u=e.memoizedProps;if(Hl(u,l)&&e.ref===t.ref)if(tt=!1,t.pendingProps=l=u,dc(e,s))(e.flags&131072)!==0&&(tt=!0);else return t.lanes=e.lanes,va(e,t,s)}return lc(e,t,a,l,s)}function Wf(e,t,a,l){var s=l.children,u=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((t.flags&128)!==0){if(u=u!==null?u.baseLanes|a:a,e!==null){for(l=t.child=e.child,s=0;l!==null;)s=s|l.lanes|l.childLanes,l=l.sibling;l=s&~u}else l=0,t.child=null;return em(e,t,u,a,l)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&fo(t,u!==null?u.cachePool:null),u!==null?tf(t,u):ks(),af(t);else return l=t.lanes=536870912,em(e,t,u!==null?u.baseLanes|a:a,a,l)}else u!==null?(fo(t,u.cachePool),tf(t,u),Ua(),t.memoizedState=null):(e!==null&&fo(t,null),ks(),Ua());return ut(e,t,s,a),t.child}function ti(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function em(e,t,a,l,s){var u=ws();return u=u===null?null:{parent:We._currentValue,pool:u},t.memoizedState={baseLanes:a,cachePool:u},e!==null&&fo(t,null),ks(),af(t),e!==null&&Jn(e,t,l,!0),t.childLanes=s,null}function wo(e,t){return t=Ro({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function tm(e,t,a){return Sn(t,e.child,null,a),e=wo(t,t.pendingProps),e.flags|=2,It(t),t.memoizedState=null,e}function Iv(e,t,a){var l=t.pendingProps,s=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Ae){if(l.mode==="hidden")return e=wo(t,l),t.lanes=536870912,ti(null,e);if(Ds(t),(e=Ue)?(e=mp(e,Ut),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ka!==null?{id:ta,overflow:aa}:null,retryLane:536870912,hydrationErrors:null},a=Ld(e),a.return=t,t.child=a,st=t,Ue=null)):e=null,e===null)throw Da(t);return t.lanes=536870912,null}return wo(t,l)}var u=e.memoizedState;if(u!==null){var h=u.dehydrated;if(Ds(t),s)if(t.flags&256)t.flags&=-257,t=tm(e,t,a);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(r(558));else if(tt||Jn(e,t,a,!1),s=(a&e.childLanes)!==0,tt||s){if(l=He,l!==null&&(h=Fu(l,a),h!==0&&h!==u.retryLane))throw u.retryLane=h,fn(e,h),_t(l,e,h),nc;qo(),t=tm(e,t,a)}else e=u.treeContext,Ue=Ft(h.nextSibling),st=t,Ae=!0,za=null,Ut=!1,e!==null&&Hd(t,e),t=wo(t,l),t.flags|=4096;return t}return e=fa(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Mo(e,t){var a=t.ref;if(a===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(r(284));(e===null||e.ref!==a)&&(t.flags|=4194816)}}function lc(e,t,a,l,s){return gn(t),a=Gs(e,t,a,l,void 0,s),l=qs(),e!==null&&!tt?(Hs(e,t,s),va(e,t,s)):(Ae&&l&&bs(t),t.flags|=1,ut(e,t,a,s),t.child)}function am(e,t,a,l,s,u){return gn(t),t.updateQueue=null,a=lf(t,l,a,s),nf(e),l=qs(),e!==null&&!tt?(Hs(e,t,u),va(e,t,u)):(Ae&&l&&bs(t),t.flags|=1,ut(e,t,a,u),t.child)}function nm(e,t,a,l,s){if(gn(t),t.stateNode===null){var u=Yn,h=a.contextType;typeof h=="object"&&h!==null&&(u=ct(h)),u=new a(l,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=tc,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=l,u.state=t.memoizedState,u.refs={},Rs(t),h=a.contextType,u.context=typeof h=="object"&&h!==null?ct(h):Yn,u.state=t.memoizedState,h=a.getDerivedStateFromProps,typeof h=="function"&&(ec(t,a,h,l),u.state=t.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(h=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),h!==u.state&&tc.enqueueReplaceState(u,u.state,null),Zl(t,l,u,s),Ql(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){u=t.stateNode;var v=t.memoizedProps,A=Tn(a,v);u.props=A;var z=u.context,P=a.contextType;h=Yn,typeof P=="object"&&P!==null&&(h=ct(P));var Y=a.getDerivedStateFromProps;P=typeof Y=="function"||typeof u.getSnapshotBeforeUpdate=="function",v=t.pendingProps!==v,P||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(v||z!==h)&&Bf(t,u,l,h),Ga=!1;var q=t.memoizedState;u.state=q,Zl(t,l,u,s),Ql(),z=t.memoizedState,v||q!==z||Ga?(typeof Y=="function"&&(ec(t,a,Y,l),z=t.memoizedState),(A=Ga||Uf(t,a,A,l,q,z,h))?(P||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=z),u.props=l,u.state=z,u.context=h,l=A):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{u=t.stateNode,Is(e,t),h=t.memoizedProps,P=Tn(a,h),u.props=P,Y=t.pendingProps,q=u.context,z=a.contextType,A=Yn,typeof z=="object"&&z!==null&&(A=ct(z)),v=a.getDerivedStateFromProps,(z=typeof v=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(h!==Y||q!==A)&&Bf(t,u,l,A),Ga=!1,q=t.memoizedState,u.state=q,Zl(t,l,u,s),Ql();var H=t.memoizedState;h!==Y||q!==H||Ga||e!==null&&e.dependencies!==null&&co(e.dependencies)?(typeof v=="function"&&(ec(t,a,v,l),H=t.memoizedState),(P=Ga||Uf(t,a,P,l,q,H,A)||e!==null&&e.dependencies!==null&&co(e.dependencies))?(z||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(l,H,A),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(l,H,A)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||h===e.memoizedProps&&q===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||h===e.memoizedProps&&q===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=H),u.props=l,u.state=H,u.context=A,l=P):(typeof u.componentDidUpdate!="function"||h===e.memoizedProps&&q===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||h===e.memoizedProps&&q===e.memoizedState||(t.flags|=1024),l=!1)}return u=l,Mo(e,t),l=(t.flags&128)!==0,u||l?(u=t.stateNode,a=l&&typeof a.getDerivedStateFromError!="function"?null:u.render(),t.flags|=1,e!==null&&l?(t.child=Sn(t,e.child,null,s),t.child=Sn(t,null,a,s)):ut(e,t,a,s),t.memoizedState=u.state,e=t.child):e=va(e,t,s),e}function lm(e,t,a,l){return pn(),t.flags|=256,ut(e,t,a,l),t.child}var ic={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function oc(e){return{baseLanes:e,cachePool:Vd()}}function rc(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=jt),e}function im(e,t,a){var l=t.pendingProps,s=!1,u=(t.flags&128)!==0,h;if((h=u)||(h=e!==null&&e.memoizedState===null?!1:(Je.current&2)!==0),h&&(s=!0,t.flags&=-129),h=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ae){if(s?Pa(t):Ua(),(e=Ue)?(e=mp(e,Ut),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ka!==null?{id:ta,overflow:aa}:null,retryLane:536870912,hydrationErrors:null},a=Ld(e),a.return=t,t.child=a,st=t,Ue=null)):e=null,e===null)throw Da(t);return Bc(e)?t.lanes=32:t.lanes=536870912,null}var v=l.children;return l=l.fallback,s?(Ua(),s=t.mode,v=Ro({mode:"hidden",children:v},s),l=mn(l,s,a,null),v.return=t,l.return=t,v.sibling=l,t.child=v,l=t.child,l.memoizedState=oc(a),l.childLanes=rc(e,h,a),t.memoizedState=ic,ti(null,l)):(Pa(t),sc(t,v))}var A=e.memoizedState;if(A!==null&&(v=A.dehydrated,v!==null)){if(u)t.flags&256?(Pa(t),t.flags&=-257,t=cc(e,t,a)):t.memoizedState!==null?(Ua(),t.child=e.child,t.flags|=128,t=null):(Ua(),v=l.fallback,s=t.mode,l=Ro({mode:"visible",children:l.children},s),v=mn(v,s,a,null),v.flags|=2,l.return=t,v.return=t,l.sibling=v,t.child=l,Sn(t,e.child,null,a),l=t.child,l.memoizedState=oc(a),l.childLanes=rc(e,h,a),t.memoizedState=ic,t=ti(null,l));else if(Pa(t),Bc(v)){if(h=v.nextSibling&&v.nextSibling.dataset,h)var z=h.dgst;h=z,l=Error(r(419)),l.stack="",l.digest=h,Bl({value:l,source:null,stack:null}),t=cc(e,t,a)}else if(tt||Jn(e,t,a,!1),h=(a&e.childLanes)!==0,tt||h){if(h=He,h!==null&&(l=Fu(h,a),l!==0&&l!==A.retryLane))throw A.retryLane=l,fn(e,l),_t(h,e,l),nc;Uc(v)||qo(),t=cc(e,t,a)}else Uc(v)?(t.flags|=192,t.child=e.child,t=null):(e=A.treeContext,Ue=Ft(v.nextSibling),st=t,Ae=!0,za=null,Ut=!1,e!==null&&Hd(t,e),t=sc(t,l.children),t.flags|=4096);return t}return s?(Ua(),v=l.fallback,s=t.mode,A=e.child,z=A.sibling,l=fa(A,{mode:"hidden",children:l.children}),l.subtreeFlags=A.subtreeFlags&65011712,z!==null?v=fa(z,v):(v=mn(v,s,a,null),v.flags|=2),v.return=t,l.return=t,l.sibling=v,t.child=l,ti(null,l),l=t.child,v=e.child.memoizedState,v===null?v=oc(a):(s=v.cachePool,s!==null?(A=We._currentValue,s=s.parent!==A?{parent:A,pool:A}:s):s=Vd(),v={baseLanes:v.baseLanes|a,cachePool:s}),l.memoizedState=v,l.childLanes=rc(e,h,a),t.memoizedState=ic,ti(e.child,l)):(Pa(t),a=e.child,e=a.sibling,a=fa(a,{mode:"visible",children:l.children}),a.return=t,a.sibling=null,e!==null&&(h=t.deletions,h===null?(t.deletions=[e],t.flags|=16):h.push(e)),t.child=a,t.memoizedState=null,a)}function sc(e,t){return t=Ro({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Ro(e,t){return e=Mt(22,e,null,t),e.lanes=0,e}function cc(e,t,a){return Sn(t,e.child,null,a),e=sc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function om(e,t,a){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),_s(e.return,t,a)}function uc(e,t,a,l,s,u){var h=e.memoizedState;h===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:s,treeForkCount:u}:(h.isBackwards=t,h.rendering=null,h.renderingStartTime=0,h.last=l,h.tail=a,h.tailMode=s,h.treeForkCount=u)}function rm(e,t,a){var l=t.pendingProps,s=l.revealOrder,u=l.tail;l=l.children;var h=Je.current,v=(h&2)!==0;if(v?(h=h&1|2,t.flags|=128):h&=1,J(Je,h),ut(e,t,l,a),l=Ae?Ul:0,!v&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&om(e,a,t);else if(e.tag===19)om(e,a,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(s){case"forwards":for(a=t.child,s=null;a!==null;)e=a.alternate,e!==null&&vo(e)===null&&(s=a),a=a.sibling;a=s,a===null?(s=t.child,t.child=null):(s=a.sibling,a.sibling=null),uc(t,!1,s,a,u,l);break;case"backwards":case"unstable_legacy-backwards":for(a=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&vo(e)===null){t.child=s;break}e=s.sibling,s.sibling=a,a=s,s=e}uc(t,!0,a,null,u,l);break;case"together":uc(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function va(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),Ka|=t.lanes,(a&t.childLanes)===0)if(e!==null){if(Jn(e,t,a,!1),(a&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,a=fa(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=fa(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function dc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&co(e)))}function Ov(e,t,a){switch(t.tag){case 3:Ze(t,t.stateNode.containerInfo),La(t,We,e.memoizedState.cache),pn();break;case 27:case 5:ea(t);break;case 4:Ze(t,t.stateNode.containerInfo);break;case 10:La(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Ds(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(Pa(t),t.flags|=128,null):(a&t.child.childLanes)!==0?im(e,t,a):(Pa(t),e=va(e,t,a),e!==null?e.sibling:null);Pa(t);break;case 19:var s=(e.flags&128)!==0;if(l=(a&t.childLanes)!==0,l||(Jn(e,t,a,!1),l=(a&t.childLanes)!==0),s){if(l)return rm(e,t,a);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),J(Je,Je.current),l)break;return null;case 22:return t.lanes=0,Wf(e,t,a,t.pendingProps);case 24:La(t,We,e.memoizedState.cache)}return va(e,t,a)}function sm(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)tt=!0;else{if(!dc(e,a)&&(t.flags&128)===0)return tt=!1,Ov(e,t,a);tt=(e.flags&131072)!==0}else tt=!1,Ae&&(t.flags&1048576)!==0&&qd(t,Ul,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=vn(t.elementType),t.type=e,typeof e=="function")gs(e)?(l=Tn(e,l),t.tag=1,t=nm(null,t,e,l,a)):(t.tag=0,t=lc(null,t,e,l,a));else{if(e!=null){var s=e.$$typeof;if(s===k){t.tag=11,t=Zf(null,t,e,l,a);break e}else if(s===W){t.tag=14,t=Jf(null,t,e,l,a);break e}}throw t=we(e)||e,Error(r(306,t,""))}}return t;case 0:return lc(e,t,t.type,t.pendingProps,a);case 1:return l=t.type,s=Tn(l,t.pendingProps),nm(e,t,l,s,a);case 3:e:{if(Ze(t,t.stateNode.containerInfo),e===null)throw Error(r(387));l=t.pendingProps;var u=t.memoizedState;s=u.element,Is(e,t),Zl(t,l,null,a);var h=t.memoizedState;if(l=h.cache,La(t,We,l),l!==u.cache&&Es(t,[We],a,!0),Ql(),l=h.element,u.isDehydrated)if(u={element:l,isDehydrated:!1,cache:h.cache},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){t=lm(e,t,l,a);break e}else if(l!==s){s=qt(Error(r(424)),t),Bl(s),t=lm(e,t,l,a);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,Ue=Ft(e.firstChild),st=t,Ae=!0,za=null,Ut=!0,a=$d(t,null,l,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(pn(),l===s){t=va(e,t,a);break e}ut(e,t,l,a)}t=t.child}return t;case 26:return Mo(e,t),e===null?(a=bp(t.type,null,t.pendingProps,null))?t.memoizedState=a:Ae||(a=t.type,e=t.pendingProps,l=Vo(fe.current).createElement(a),l[rt]=t,l[vt]=e,dt(l,a,e),lt(l),t.stateNode=l):t.memoizedState=bp(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ea(t),e===null&&Ae&&(l=t.stateNode=gp(t.type,t.pendingProps,fe.current),st=t,Ut=!0,s=Ue,Za(t.type)?(Fc=s,Ue=Ft(l.firstChild)):Ue=s),ut(e,t,t.pendingProps.children,a),Mo(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ae&&((s=l=Ue)&&(l=sb(l,t.type,t.pendingProps,Ut),l!==null?(t.stateNode=l,st=t,Ue=Ft(l.firstChild),Ut=!1,s=!0):s=!1),s||Da(t)),ea(t),s=t.type,u=t.pendingProps,h=e!==null?e.memoizedProps:null,l=u.children,qc(s,u)?l=null:h!==null&&qc(s,h)&&(t.flags|=32),t.memoizedState!==null&&(s=Gs(e,t,Nv,null,null,a),gi._currentValue=s),Mo(e,t),ut(e,t,l,a),t.child;case 6:return e===null&&Ae&&((e=a=Ue)&&(a=cb(a,t.pendingProps,Ut),a!==null?(t.stateNode=a,st=t,Ue=null,e=!0):e=!1),e||Da(t)),null;case 13:return im(e,t,a);case 4:return Ze(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=Sn(t,null,l,a):ut(e,t,l,a),t.child;case 11:return Zf(e,t,t.type,t.pendingProps,a);case 7:return ut(e,t,t.pendingProps,a),t.child;case 8:return ut(e,t,t.pendingProps.children,a),t.child;case 12:return ut(e,t,t.pendingProps.children,a),t.child;case 10:return l=t.pendingProps,La(t,t.type,l.value),ut(e,t,l.children,a),t.child;case 9:return s=t.type._context,l=t.pendingProps.children,gn(t),s=ct(s),l=l(s),t.flags|=1,ut(e,t,l,a),t.child;case 14:return Jf(e,t,t.type,t.pendingProps,a);case 15:return $f(e,t,t.type,t.pendingProps,a);case 19:return rm(e,t,a);case 31:return Iv(e,t,a);case 22:return Wf(e,t,a,t.pendingProps);case 24:return gn(t),l=ct(We),e===null?(s=ws(),s===null&&(s=He,u=As(),s.pooledCache=u,u.refCount++,u!==null&&(s.pooledCacheLanes|=a),s=u),t.memoizedState={parent:l,cache:s},Rs(t),La(t,We,s)):((e.lanes&a)!==0&&(Is(e,t),Zl(t,null,null,a),Ql()),s=e.memoizedState,u=t.memoizedState,s.parent!==l?(s={parent:l,cache:l},t.memoizedState=s,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=s),La(t,We,l)):(l=u.cache,La(t,We,l),l!==s.cache&&Es(t,[We],a,!0))),ut(e,t,t.pendingProps.children,a),t.child;case 29:throw t.pendingProps}throw Error(r(156,t.tag))}function ba(e){e.flags|=4}function fc(e,t,a,l,s){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(s&335544128)===s)if(e.stateNode.complete)e.flags|=8192;else if(zm())e.flags|=8192;else throw bn=po,Ms}else e.flags&=-16777217}function cm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!_p(t))if(zm())e.flags|=8192;else throw bn=po,Ms}function Io(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Pu():536870912,e.lanes|=t,cl|=t)}function ai(e,t){if(!Ae)switch(e.tailMode){case"hidden":t=e.tail;for(var a=null;t!==null;)t.alternate!==null&&(a=t),t=t.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function Be(e){var t=e.alternate!==null&&e.alternate.child===e.child,a=0,l=0;if(t)for(var s=e.child;s!==null;)a|=s.lanes|s.childLanes,l|=s.subtreeFlags&65011712,l|=s.flags&65011712,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)a|=s.lanes|s.childLanes,l|=s.subtreeFlags,l|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=l,e.childLanes=a,t}function jv(e,t,a){var l=t.pendingProps;switch(Ss(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Be(t),null;case 1:return Be(t),null;case 3:return a=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),ha(We),qe(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Zn(t)?ba(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Ts())),Be(t),null;case 26:var s=t.type,u=t.memoizedState;return e===null?(ba(t),u!==null?(Be(t),cm(t,u)):(Be(t),fc(t,s,null,l,a))):u?u!==e.memoizedState?(ba(t),Be(t),cm(t,u)):(Be(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&ba(t),Be(t),fc(t,s,e,l,a)),null;case 27:if(U(t),a=fe.current,s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&ba(t);else{if(!l){if(t.stateNode===null)throw Error(r(166));return Be(t),null}e=ae.current,Zn(t)?Pd(t):(e=gp(s,l,a),t.stateNode=e,ba(t))}return Be(t),null;case 5:if(U(t),s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&ba(t);else{if(!l){if(t.stateNode===null)throw Error(r(166));return Be(t),null}if(u=ae.current,Zn(t))Pd(t);else{var h=Vo(fe.current);switch(u){case 1:u=h.createElementNS("http://www.w3.org/2000/svg",s);break;case 2:u=h.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;default:switch(s){case"svg":u=h.createElementNS("http://www.w3.org/2000/svg",s);break;case"math":u=h.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;case"script":u=h.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof l.is=="string"?h.createElement("select",{is:l.is}):h.createElement("select"),l.multiple?u.multiple=!0:l.size&&(u.size=l.size);break;default:u=typeof l.is=="string"?h.createElement(s,{is:l.is}):h.createElement(s)}}u[rt]=t,u[vt]=l;e:for(h=t.child;h!==null;){if(h.tag===5||h.tag===6)u.appendChild(h.stateNode);else if(h.tag!==4&&h.tag!==27&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===t)break e;for(;h.sibling===null;){if(h.return===null||h.return===t)break e;h=h.return}h.sibling.return=h.return,h=h.sibling}t.stateNode=u;e:switch(dt(u,s,l),s){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&ba(t)}}return Be(t),fc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&ba(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(r(166));if(e=fe.current,Zn(t)){if(e=t.stateNode,a=t.memoizedProps,l=null,s=st,s!==null)switch(s.tag){case 27:case 5:l=s.memoizedProps}e[rt]=t,e=!!(e.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||ip(e.nodeValue,a)),e||Da(t,!0)}else e=Vo(e).createTextNode(l),e[rt]=t,t.stateNode=e}return Be(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(l=Zn(t),a!==null){if(e===null){if(!l)throw Error(r(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(557));e[rt]=t}else pn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Be(t),e=!1}else a=Ts(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(It(t),t):(It(t),null);if((t.flags&128)!==0)throw Error(r(558))}return Be(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(s=Zn(t),l!==null&&l.dehydrated!==null){if(e===null){if(!s)throw Error(r(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));s[rt]=t}else pn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Be(t),s=!1}else s=Ts(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),s=!0;if(!s)return t.flags&256?(It(t),t):(It(t),null)}return It(t),(t.flags&128)!==0?(t.lanes=a,t):(a=l!==null,e=e!==null&&e.memoizedState!==null,a&&(l=t.child,s=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(s=l.alternate.memoizedState.cachePool.pool),u=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(u=l.memoizedState.cachePool.pool),u!==s&&(l.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),Io(t,t.updateQueue),Be(t),null);case 4:return qe(),e===null&&kc(t.stateNode.containerInfo),Be(t),null;case 10:return ha(t.type),Be(t),null;case 19:if(B(Je),l=t.memoizedState,l===null)return Be(t),null;if(s=(t.flags&128)!==0,u=l.rendering,u===null)if(s)ai(l,!1);else{if(Xe!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=vo(e),u!==null){for(t.flags|=128,ai(l,!1),e=u.updateQueue,t.updateQueue=e,Io(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)Dd(a,e),a=a.sibling;return J(Je,Je.current&1|2),Ae&&ma(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&Fe()>Do&&(t.flags|=128,s=!0,ai(l,!1),t.lanes=4194304)}else{if(!s)if(e=vo(u),e!==null){if(t.flags|=128,s=!0,e=e.updateQueue,t.updateQueue=e,Io(t,e),ai(l,!0),l.tail===null&&l.tailMode==="hidden"&&!u.alternate&&!Ae)return Be(t),null}else 2*Fe()-l.renderingStartTime>Do&&a!==536870912&&(t.flags|=128,s=!0,ai(l,!1),t.lanes=4194304);l.isBackwards?(u.sibling=t.child,t.child=u):(e=l.last,e!==null?e.sibling=u:t.child=u,l.last=u)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=Fe(),e.sibling=null,a=Je.current,J(Je,s?a&1|2:a&1),Ae&&ma(t,l.treeForkCount),e):(Be(t),null);case 22:case 23:return It(t),zs(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(a&536870912)!==0&&(t.flags&128)===0&&(Be(t),t.subtreeFlags&6&&(t.flags|=8192)):Be(t),a=t.updateQueue,a!==null&&Io(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==a&&(t.flags|=2048),e!==null&&B(yn),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),ha(We),Be(t),null;case 25:return null;case 30:return null}throw Error(r(156,t.tag))}function kv(e,t){switch(Ss(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ha(We),qe(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return U(t),null;case 31:if(t.memoizedState!==null){if(It(t),t.alternate===null)throw Error(r(340));pn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(It(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));pn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return B(Je),null;case 4:return qe(),null;case 10:return ha(t.type),null;case 22:case 23:return It(t),zs(),e!==null&&B(yn),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ha(We),null;case 25:return null;default:return null}}function um(e,t){switch(Ss(t),t.tag){case 3:ha(We),qe();break;case 26:case 27:case 5:U(t);break;case 4:qe();break;case 31:t.memoizedState!==null&&It(t);break;case 13:It(t);break;case 19:B(Je);break;case 10:ha(t.type);break;case 22:case 23:It(t),zs(),e!==null&&B(yn);break;case 24:ha(We)}}function ni(e,t){try{var a=t.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var s=l.next;a=s;do{if((a.tag&e)===e){l=void 0;var u=a.create,h=a.inst;l=u(),h.destroy=l}a=a.next}while(a!==s)}}catch(v){ze(t,t.return,v)}}function Ba(e,t,a){try{var l=t.updateQueue,s=l!==null?l.lastEffect:null;if(s!==null){var u=s.next;l=u;do{if((l.tag&e)===e){var h=l.inst,v=h.destroy;if(v!==void 0){h.destroy=void 0,s=t;var A=a,z=v;try{z()}catch(P){ze(s,A,P)}}}l=l.next}while(l!==u)}}catch(P){ze(t,t.return,P)}}function dm(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{ef(t,a)}catch(l){ze(e,e.return,l)}}}function fm(e,t,a){a.props=Tn(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(l){ze(e,t,l)}}function li(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof a=="function"?e.refCleanup=a(l):a.current=l}}catch(s){ze(e,t,s)}}function na(e,t){var a=e.ref,l=e.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(s){ze(e,t,s)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(s){ze(e,t,s)}else a.current=null}function mm(e){var t=e.type,a=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&l.focus();break e;case"img":a.src?l.src=a.src:a.srcSet&&(l.srcset=a.srcSet)}}catch(s){ze(e,e.return,s)}}function mc(e,t,a){try{var l=e.stateNode;ab(l,e.type,a,t),l[vt]=t}catch(s){ze(e,e.return,s)}}function pm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Za(e.type)||e.tag===4}function pc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||pm(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Za(e.type)||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 hc(e,t,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(e),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=ua));else if(l!==4&&(l===27&&Za(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(hc(e,t,a),e=e.sibling;e!==null;)hc(e,t,a),e=e.sibling}function Oo(e,t,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?a.insertBefore(e,t):a.appendChild(e);else if(l!==4&&(l===27&&Za(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Oo(e,t,a),e=e.sibling;e!==null;)Oo(e,t,a),e=e.sibling}function hm(e){var t=e.stateNode,a=e.memoizedProps;try{for(var l=e.type,s=t.attributes;s.length;)t.removeAttributeNode(s[0]);dt(t,l,a),t[rt]=e,t[vt]=a}catch(u){ze(e,e.return,u)}}var Sa=!1,at=!1,gc=!1,gm=typeof WeakSet=="function"?WeakSet:Set,it=null;function zv(e,t){if(e=e.containerInfo,Lc=Wo,e=Cd(e),cs(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var s=l.anchorOffset,u=l.focusNode;l=l.focusOffset;try{a.nodeType,u.nodeType}catch{a=null;break e}var h=0,v=-1,A=-1,z=0,P=0,Y=e,q=null;t:for(;;){for(var H;Y!==a||s!==0&&Y.nodeType!==3||(v=h+s),Y!==u||l!==0&&Y.nodeType!==3||(A=h+l),Y.nodeType===3&&(h+=Y.nodeValue.length),(H=Y.firstChild)!==null;)q=Y,Y=H;for(;;){if(Y===e)break t;if(q===a&&++z===s&&(v=h),q===u&&++P===l&&(A=h),(H=Y.nextSibling)!==null)break;Y=q,q=Y.parentNode}Y=H}a=v===-1||A===-1?null:{start:v,end:A}}else a=null}a=a||{start:0,end:0}}else a=null;for(Gc={focusedElem:e,selectionRange:a},Wo=!1,it=t;it!==null;)if(t=it,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,it=e;else for(;it!==null;){switch(t=it,u=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)s=e[a],s.ref.impl=s.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&u!==null){e=void 0,a=t,s=u.memoizedProps,u=u.memoizedState,l=a.stateNode;try{var ne=Tn(a.type,s);e=l.getSnapshotBeforeUpdate(ne,u),l.__reactInternalSnapshotBeforeUpdate=e}catch(ce){ze(a,a.return,ce)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,a=e.nodeType,a===9)Pc(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Pc(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(r(163))}if(e=t.sibling,e!==null){e.return=t.return,it=e;break}it=t.return}}function ym(e,t,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:Ta(e,a),l&4&&ni(5,a);break;case 1:if(Ta(e,a),l&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(h){ze(a,a.return,h)}else{var s=Tn(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(s,t,e.__reactInternalSnapshotBeforeUpdate)}catch(h){ze(a,a.return,h)}}l&64&&dm(a),l&512&&li(a,a.return);break;case 3:if(Ta(e,a),l&64&&(e=a.updateQueue,e!==null)){if(t=null,a.child!==null)switch(a.child.tag){case 27:case 5:t=a.child.stateNode;break;case 1:t=a.child.stateNode}try{ef(e,t)}catch(h){ze(a,a.return,h)}}break;case 27:t===null&&l&4&&hm(a);case 26:case 5:Ta(e,a),t===null&&l&4&&mm(a),l&512&&li(a,a.return);break;case 12:Ta(e,a);break;case 31:Ta(e,a),l&4&&Sm(e,a);break;case 13:Ta(e,a),l&4&&xm(e,a),l&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=Fv.bind(null,a),ub(e,a))));break;case 22:if(l=a.memoizedState!==null||Sa,!l){t=t!==null&&t.memoizedState!==null||at,s=Sa;var u=at;Sa=l,(at=t)&&!u?Na(e,a,(a.subtreeFlags&8772)!==0):Ta(e,a),Sa=s,at=u}break;case 30:break;default:Ta(e,a)}}function vm(e){var t=e.alternate;t!==null&&(e.alternate=null,vm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Vr(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Ke=null,St=!1;function xa(e,t,a){for(a=a.child;a!==null;)bm(e,t,a),a=a.sibling}function bm(e,t,a){if(At&&typeof At.onCommitFiberUnmount=="function")try{At.onCommitFiberUnmount(wl,a)}catch{}switch(a.tag){case 26:at||na(a,t),xa(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:at||na(a,t);var l=Ke,s=St;Za(a.type)&&(Ke=a.stateNode,St=!1),xa(e,t,a),mi(a.stateNode),Ke=l,St=s;break;case 5:at||na(a,t);case 6:if(l=Ke,s=St,Ke=null,xa(e,t,a),Ke=l,St=s,Ke!==null)if(St)try{(Ke.nodeType===9?Ke.body:Ke.nodeName==="HTML"?Ke.ownerDocument.body:Ke).removeChild(a.stateNode)}catch(u){ze(a,t,u)}else try{Ke.removeChild(a.stateNode)}catch(u){ze(a,t,u)}break;case 18:Ke!==null&&(St?(e=Ke,dp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),yl(e)):dp(Ke,a.stateNode));break;case 4:l=Ke,s=St,Ke=a.stateNode.containerInfo,St=!0,xa(e,t,a),Ke=l,St=s;break;case 0:case 11:case 14:case 15:Ba(2,a,t),at||Ba(4,a,t),xa(e,t,a);break;case 1:at||(na(a,t),l=a.stateNode,typeof l.componentWillUnmount=="function"&&fm(a,t,l)),xa(e,t,a);break;case 21:xa(e,t,a);break;case 22:at=(l=at)||a.memoizedState!==null,xa(e,t,a),at=l;break;default:xa(e,t,a)}}function Sm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{yl(e)}catch(a){ze(t,t.return,a)}}}function xm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{yl(e)}catch(a){ze(t,t.return,a)}}function Dv(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new gm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new gm),t;default:throw Error(r(435,e.tag))}}function jo(e,t){var a=Dv(e);t.forEach(function(l){if(!a.has(l)){a.add(l);var s=Kv.bind(null,e,l);l.then(s,s)}})}function xt(e,t){var a=t.deletions;if(a!==null)for(var l=0;l<a.length;l++){var s=a[l],u=e,h=t,v=h;e:for(;v!==null;){switch(v.tag){case 27:if(Za(v.type)){Ke=v.stateNode,St=!1;break e}break;case 5:Ke=v.stateNode,St=!1;break e;case 3:case 4:Ke=v.stateNode.containerInfo,St=!0;break e}v=v.return}if(Ke===null)throw Error(r(160));bm(u,h,s),Ke=null,St=!1,u=s.alternate,u!==null&&(u.return=null),s.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Tm(t,e),t=t.sibling}var Yt=null;function Tm(e,t){var a=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:xt(t,e),Tt(e),l&4&&(Ba(3,e,e.return),ni(3,e),Ba(5,e,e.return));break;case 1:xt(t,e),Tt(e),l&512&&(at||a===null||na(a,a.return)),l&64&&Sa&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?l:a.concat(l))));break;case 26:var s=Yt;if(xt(t,e),Tt(e),l&512&&(at||a===null||na(a,a.return)),l&4){var u=a!==null?a.memoizedState:null;if(l=e.memoizedState,a===null)if(l===null)if(e.stateNode===null){e:{l=e.type,a=e.memoizedProps,s=s.ownerDocument||s;t:switch(l){case"title":u=s.getElementsByTagName("title")[0],(!u||u[Il]||u[rt]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=s.createElement(l),s.head.insertBefore(u,s.querySelector("head > title"))),dt(u,l,a),u[rt]=e,lt(u),l=u;break e;case"link":var h=Tp("link","href",s).get(l+(a.href||""));if(h){for(var v=0;v<h.length;v++)if(u=h[v],u.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&u.getAttribute("rel")===(a.rel==null?null:a.rel)&&u.getAttribute("title")===(a.title==null?null:a.title)&&u.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){h.splice(v,1);break t}}u=s.createElement(l),dt(u,l,a),s.head.appendChild(u);break;case"meta":if(h=Tp("meta","content",s).get(l+(a.content||""))){for(v=0;v<h.length;v++)if(u=h[v],u.getAttribute("content")===(a.content==null?null:""+a.content)&&u.getAttribute("name")===(a.name==null?null:a.name)&&u.getAttribute("property")===(a.property==null?null:a.property)&&u.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&u.getAttribute("charset")===(a.charSet==null?null:a.charSet)){h.splice(v,1);break t}}u=s.createElement(l),dt(u,l,a),s.head.appendChild(u);break;default:throw Error(r(468,l))}u[rt]=e,lt(u),l=u}e.stateNode=l}else Np(s,e.type,e.stateNode);else e.stateNode=xp(s,l,e.memoizedProps);else u!==l?(u===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):u.count--,l===null?Np(s,e.type,e.stateNode):xp(s,l,e.memoizedProps)):l===null&&e.stateNode!==null&&mc(e,e.memoizedProps,a.memoizedProps)}break;case 27:xt(t,e),Tt(e),l&512&&(at||a===null||na(a,a.return)),a!==null&&l&4&&mc(e,e.memoizedProps,a.memoizedProps);break;case 5:if(xt(t,e),Tt(e),l&512&&(at||a===null||na(a,a.return)),e.flags&32){s=e.stateNode;try{Hn(s,"")}catch(ne){ze(e,e.return,ne)}}l&4&&e.stateNode!=null&&(s=e.memoizedProps,mc(e,s,a!==null?a.memoizedProps:s)),l&1024&&(gc=!0);break;case 6:if(xt(t,e),Tt(e),l&4){if(e.stateNode===null)throw Error(r(162));l=e.memoizedProps,a=e.stateNode;try{a.nodeValue=l}catch(ne){ze(e,e.return,ne)}}break;case 3:if(Qo=null,s=Yt,Yt=Yo(t.containerInfo),xt(t,e),Yt=s,Tt(e),l&4&&a!==null&&a.memoizedState.isDehydrated)try{yl(t.containerInfo)}catch(ne){ze(e,e.return,ne)}gc&&(gc=!1,Nm(e));break;case 4:l=Yt,Yt=Yo(e.stateNode.containerInfo),xt(t,e),Tt(e),Yt=l;break;case 12:xt(t,e),Tt(e);break;case 31:xt(t,e),Tt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,jo(e,l)));break;case 13:xt(t,e),Tt(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(zo=Fe()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,jo(e,l)));break;case 22:s=e.memoizedState!==null;var A=a!==null&&a.memoizedState!==null,z=Sa,P=at;if(Sa=z||s,at=P||A,xt(t,e),at=P,Sa=z,Tt(e),l&8192)e:for(t=e.stateNode,t._visibility=s?t._visibility&-2:t._visibility|1,s&&(a===null||A||Sa||at||Nn(e)),a=null,t=e;;){if(t.tag===5||t.tag===26){if(a===null){A=a=t;try{if(u=A.stateNode,s)h=u.style,typeof h.setProperty=="function"?h.setProperty("display","none","important"):h.display="none";else{v=A.stateNode;var Y=A.memoizedProps.style,q=Y!=null&&Y.hasOwnProperty("display")?Y.display:null;v.style.display=q==null||typeof q=="boolean"?"":(""+q).trim()}}catch(ne){ze(A,A.return,ne)}}}else if(t.tag===6){if(a===null){A=t;try{A.stateNode.nodeValue=s?"":A.memoizedProps}catch(ne){ze(A,A.return,ne)}}}else if(t.tag===18){if(a===null){A=t;try{var H=A.stateNode;s?fp(H,!0):fp(A.stateNode,!1)}catch(ne){ze(A,A.return,ne)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;a===t&&(a=null),t=t.return}a===t&&(a=null),t.sibling.return=t.return,t=t.sibling}l&4&&(l=e.updateQueue,l!==null&&(a=l.retryQueue,a!==null&&(l.retryQueue=null,jo(e,a))));break;case 19:xt(t,e),Tt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,jo(e,l)));break;case 30:break;case 21:break;default:xt(t,e),Tt(e)}}function Tt(e){var t=e.flags;if(t&2){try{for(var a,l=e.return;l!==null;){if(pm(l)){a=l;break}l=l.return}if(a==null)throw Error(r(160));switch(a.tag){case 27:var s=a.stateNode,u=pc(e);Oo(e,u,s);break;case 5:var h=a.stateNode;a.flags&32&&(Hn(h,""),a.flags&=-33);var v=pc(e);Oo(e,v,h);break;case 3:case 4:var A=a.stateNode.containerInfo,z=pc(e);hc(e,z,A);break;default:throw Error(r(161))}}catch(P){ze(e,e.return,P)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Nm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Nm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Ta(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)ym(e,t.alternate,t),t=t.sibling}function Nn(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ba(4,t,t.return),Nn(t);break;case 1:na(t,t.return);var a=t.stateNode;typeof a.componentWillUnmount=="function"&&fm(t,t.return,a),Nn(t);break;case 27:mi(t.stateNode);case 26:case 5:na(t,t.return),Nn(t);break;case 22:t.memoizedState===null&&Nn(t);break;case 30:Nn(t);break;default:Nn(t)}e=e.sibling}}function Na(e,t,a){for(a=a&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,s=e,u=t,h=u.flags;switch(u.tag){case 0:case 11:case 15:Na(s,u,a),ni(4,u);break;case 1:if(Na(s,u,a),l=u,s=l.stateNode,typeof s.componentDidMount=="function")try{s.componentDidMount()}catch(z){ze(l,l.return,z)}if(l=u,s=l.updateQueue,s!==null){var v=l.stateNode;try{var A=s.shared.hiddenCallbacks;if(A!==null)for(s.shared.hiddenCallbacks=null,s=0;s<A.length;s++)Wd(A[s],v)}catch(z){ze(l,l.return,z)}}a&&h&64&&dm(u),li(u,u.return);break;case 27:hm(u);case 26:case 5:Na(s,u,a),a&&l===null&&h&4&&mm(u),li(u,u.return);break;case 12:Na(s,u,a);break;case 31:Na(s,u,a),a&&h&4&&Sm(s,u);break;case 13:Na(s,u,a),a&&h&4&&xm(s,u);break;case 22:u.memoizedState===null&&Na(s,u,a),li(u,u.return);break;case 30:break;default:Na(s,u,a)}t=t.sibling}}function yc(e,t){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&Fl(a))}function vc(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Fl(e))}function Xt(e,t,a,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)_m(e,t,a,l),t=t.sibling}function _m(e,t,a,l){var s=t.flags;switch(t.tag){case 0:case 11:case 15:Xt(e,t,a,l),s&2048&&ni(9,t);break;case 1:Xt(e,t,a,l);break;case 3:Xt(e,t,a,l),s&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Fl(e)));break;case 12:if(s&2048){Xt(e,t,a,l),e=t.stateNode;try{var u=t.memoizedProps,h=u.id,v=u.onPostCommit;typeof v=="function"&&v(h,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(A){ze(t,t.return,A)}}else Xt(e,t,a,l);break;case 31:Xt(e,t,a,l);break;case 13:Xt(e,t,a,l);break;case 23:break;case 22:u=t.stateNode,h=t.alternate,t.memoizedState!==null?u._visibility&2?Xt(e,t,a,l):ii(e,t):u._visibility&2?Xt(e,t,a,l):(u._visibility|=2,ol(e,t,a,l,(t.subtreeFlags&10256)!==0||!1)),s&2048&&yc(h,t);break;case 24:Xt(e,t,a,l),s&2048&&vc(t.alternate,t);break;default:Xt(e,t,a,l)}}function ol(e,t,a,l,s){for(s=s&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,h=t,v=a,A=l,z=h.flags;switch(h.tag){case 0:case 11:case 15:ol(u,h,v,A,s),ni(8,h);break;case 23:break;case 22:var P=h.stateNode;h.memoizedState!==null?P._visibility&2?ol(u,h,v,A,s):ii(u,h):(P._visibility|=2,ol(u,h,v,A,s)),s&&z&2048&&yc(h.alternate,h);break;case 24:ol(u,h,v,A,s),s&&z&2048&&vc(h.alternate,h);break;default:ol(u,h,v,A,s)}t=t.sibling}}function ii(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var a=e,l=t,s=l.flags;switch(l.tag){case 22:ii(a,l),s&2048&&yc(l.alternate,l);break;case 24:ii(a,l),s&2048&&vc(l.alternate,l);break;default:ii(a,l)}t=t.sibling}}var oi=8192;function rl(e,t,a){if(e.subtreeFlags&oi)for(e=e.child;e!==null;)Em(e,t,a),e=e.sibling}function Em(e,t,a){switch(e.tag){case 26:rl(e,t,a),e.flags&oi&&e.memoizedState!==null&&Tb(a,Yt,e.memoizedState,e.memoizedProps);break;case 5:rl(e,t,a);break;case 3:case 4:var l=Yt;Yt=Yo(e.stateNode.containerInfo),rl(e,t,a),Yt=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=oi,oi=16777216,rl(e,t,a),oi=l):rl(e,t,a));break;default:rl(e,t,a)}}function Am(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function ri(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var l=t[a];it=l,wm(l,e)}Am(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Cm(e),e=e.sibling}function Cm(e){switch(e.tag){case 0:case 11:case 15:ri(e),e.flags&2048&&Ba(9,e,e.return);break;case 3:ri(e);break;case 12:ri(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,ko(e)):ri(e);break;default:ri(e)}}function ko(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var l=t[a];it=l,wm(l,e)}Am(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ba(8,t,t.return),ko(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,ko(t));break;default:ko(t)}e=e.sibling}}function wm(e,t){for(;it!==null;){var a=it;switch(a.tag){case 0:case 11:case 15:Ba(8,a,t);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var l=a.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Fl(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,it=l;else e:for(a=e;it!==null;){l=it;var s=l.sibling,u=l.return;if(vm(l),l===a){it=null;break e}if(s!==null){s.return=u,it=s;break e}it=u}}}var Lv={getCacheForType:function(e){var t=ct(We),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a},cacheSignal:function(){return ct(We).controller.signal}},Gv=typeof WeakMap=="function"?WeakMap:Map,je=0,He=null,xe=null,Ne=0,ke=0,Ot=null,Fa=!1,sl=!1,bc=!1,_a=0,Xe=0,Ka=0,_n=0,Sc=0,jt=0,cl=0,si=null,Nt=null,xc=!1,zo=0,Mm=0,Do=1/0,Lo=null,Va=null,nt=0,Ya=null,ul=null,Ea=0,Tc=0,Nc=null,Rm=null,ci=0,_c=null;function kt(){return(je&2)!==0&&Ne!==0?Ne&-Ne:T.T!==null?Rc():Ku()}function Im(){if(jt===0)if((Ne&536870912)===0||Ae){var e=Fi;Fi<<=1,(Fi&3932160)===0&&(Fi=262144),jt=e}else jt=536870912;return e=Rt.current,e!==null&&(e.flags|=32),jt}function _t(e,t,a){(e===He&&(ke===2||ke===9)||e.cancelPendingCommit!==null)&&(dl(e,0),Xa(e,Ne,jt,!1)),Rl(e,a),((je&2)===0||e!==He)&&(e===He&&((je&2)===0&&(_n|=a),Xe===4&&Xa(e,Ne,jt,!1)),la(e))}function Om(e,t,a){if((je&6)!==0)throw Error(r(327));var l=!a&&(t&127)===0&&(t&e.expiredLanes)===0||Ml(e,t),s=l?Pv(e,t):Ac(e,t,!0),u=l;do{if(s===0){sl&&!l&&Xa(e,t,0,!1);break}else{if(a=e.current.alternate,u&&!qv(a)){s=Ac(e,t,!1),u=!1;continue}if(s===2){if(u=t,e.errorRecoveryDisabledLanes&u)var h=0;else h=e.pendingLanes&-536870913,h=h!==0?h:h&536870912?536870912:0;if(h!==0){t=h;e:{var v=e;s=si;var A=v.current.memoizedState.isDehydrated;if(A&&(dl(v,h).flags|=256),h=Ac(v,h,!1),h!==2){if(bc&&!A){v.errorRecoveryDisabledLanes|=u,_n|=u,s=4;break e}u=Nt,Nt=s,u!==null&&(Nt===null?Nt=u:Nt.push.apply(Nt,u))}s=h}if(u=!1,s!==2)continue}}if(s===1){dl(e,0),Xa(e,t,0,!0);break}e:{switch(l=e,u=s,u){case 0:case 1:throw Error(r(345));case 4:if((t&4194048)!==t)break;case 6:Xa(l,t,jt,!Fa);break e;case 2:Nt=null;break;case 3:case 5:break;default:throw Error(r(329))}if((t&62914560)===t&&(s=zo+300-Fe(),10<s)){if(Xa(l,t,jt,!Fa),Vi(l,0,!0)!==0)break e;Ea=t,l.timeoutHandle=cp(jm.bind(null,l,a,Nt,Lo,xc,t,jt,_n,cl,Fa,u,"Throttled",-0,0),s);break e}jm(l,a,Nt,Lo,xc,t,jt,_n,cl,Fa,u,null,-0,0)}}break}while(!0);la(e)}function jm(e,t,a,l,s,u,h,v,A,z,P,Y,q,H){if(e.timeoutHandle=-1,Y=t.subtreeFlags,Y&8192||(Y&16785408)===16785408){Y={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ua},Em(t,u,Y);var ne=(u&62914560)===u?zo-Fe():(u&4194048)===u?Mm-Fe():0;if(ne=Nb(Y,ne),ne!==null){Ea=u,e.cancelPendingCommit=ne(Pm.bind(null,e,t,u,a,l,s,h,v,A,P,Y,null,q,H)),Xa(e,u,h,!z);return}}Pm(e,t,u,a,l,s,h,v,A)}function qv(e){for(var t=e;;){var a=t.tag;if((a===0||a===11||a===15)&&t.flags&16384&&(a=t.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var l=0;l<a.length;l++){var s=a[l],u=s.getSnapshot;s=s.value;try{if(!wt(u(),s))return!1}catch{return!1}}if(a=t.child,t.subtreeFlags&16384&&a!==null)a.return=t,t=a;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Xa(e,t,a,l){t&=~Sc,t&=~_n,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var s=t;0<s;){var u=31-Ct(s),h=1<<u;l[u]=-1,s&=~h}a!==0&&Uu(e,a,t)}function Go(){return(je&6)===0?(ui(0),!1):!0}function Ec(){if(xe!==null){if(ke===0)var e=xe.return;else e=xe,pa=hn=null,Ps(e),tl=null,Vl=0,e=xe;for(;e!==null;)um(e.alternate,e),e=e.return;xe=null}}function dl(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,ib(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),Ea=0,Ec(),He=e,xe=a=fa(e.current,null),Ne=t,ke=0,Ot=null,Fa=!1,sl=Ml(e,t),bc=!1,cl=jt=Sc=_n=Ka=Xe=0,Nt=si=null,xc=!1,(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var s=31-Ct(l),u=1<<s;t|=e[s],l&=~u}return _a=t,lo(),a}function km(e,t){pe=null,T.H=ei,t===el||t===mo?(t=Qd(),ke=3):t===Ms?(t=Qd(),ke=4):ke=t===nc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Ot=t,xe===null&&(Xe=1,Co(e,qt(t,e.current)))}function zm(){var e=Rt.current;return e===null?!0:(Ne&4194048)===Ne?Bt===null:(Ne&62914560)===Ne||(Ne&536870912)!==0?e===Bt:!1}function Dm(){var e=T.H;return T.H=ei,e===null?ei:e}function Lm(){var e=T.A;return T.A=Lv,e}function qo(){Xe=4,Fa||(Ne&4194048)!==Ne&&Rt.current!==null||(sl=!0),(Ka&134217727)===0&&(_n&134217727)===0||He===null||Xa(He,Ne,jt,!1)}function Ac(e,t,a){var l=je;je|=2;var s=Dm(),u=Lm();(He!==e||Ne!==t)&&(Lo=null,dl(e,t)),t=!1;var h=Xe;e:do try{if(ke!==0&&xe!==null){var v=xe,A=Ot;switch(ke){case 8:Ec(),h=6;break e;case 3:case 2:case 9:case 6:Rt.current===null&&(t=!0);var z=ke;if(ke=0,Ot=null,fl(e,v,A,z),a&&sl){h=0;break e}break;default:z=ke,ke=0,Ot=null,fl(e,v,A,z)}}Hv(),h=Xe;break}catch(P){km(e,P)}while(!0);return t&&e.shellSuspendCounter++,pa=hn=null,je=l,T.H=s,T.A=u,xe===null&&(He=null,Ne=0,lo()),h}function Hv(){for(;xe!==null;)Gm(xe)}function Pv(e,t){var a=je;je|=2;var l=Dm(),s=Lm();He!==e||Ne!==t?(Lo=null,Do=Fe()+500,dl(e,t)):sl=Ml(e,t);e:do try{if(ke!==0&&xe!==null){t=xe;var u=Ot;t:switch(ke){case 1:ke=0,Ot=null,fl(e,t,u,1);break;case 2:case 9:if(Yd(u)){ke=0,Ot=null,qm(t);break}t=function(){ke!==2&&ke!==9||He!==e||(ke=7),la(e)},u.then(t,t);break e;case 3:ke=7;break e;case 4:ke=5;break e;case 7:Yd(u)?(ke=0,Ot=null,qm(t)):(ke=0,Ot=null,fl(e,t,u,7));break;case 5:var h=null;switch(xe.tag){case 26:h=xe.memoizedState;case 5:case 27:var v=xe;if(h?_p(h):v.stateNode.complete){ke=0,Ot=null;var A=v.sibling;if(A!==null)xe=A;else{var z=v.return;z!==null?(xe=z,Ho(z)):xe=null}break t}}ke=0,Ot=null,fl(e,t,u,5);break;case 6:ke=0,Ot=null,fl(e,t,u,6);break;case 8:Ec(),Xe=6;break e;default:throw Error(r(462))}}Uv();break}catch(P){km(e,P)}while(!0);return pa=hn=null,T.H=l,T.A=s,je=a,xe!==null?0:(He=null,Ne=0,lo(),Xe)}function Uv(){for(;xe!==null&&!ht();)Gm(xe)}function Gm(e){var t=sm(e.alternate,e,_a);e.memoizedProps=e.pendingProps,t===null?Ho(e):xe=t}function qm(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=am(a,t,t.pendingProps,t.type,void 0,Ne);break;case 11:t=am(a,t,t.pendingProps,t.type.render,t.ref,Ne);break;case 5:Ps(t);default:um(a,t),t=xe=Dd(t,_a),t=sm(a,t,_a)}e.memoizedProps=e.pendingProps,t===null?Ho(e):xe=t}function fl(e,t,a,l){pa=hn=null,Ps(t),tl=null,Vl=0;var s=t.return;try{if(Rv(e,s,t,a,Ne)){Xe=1,Co(e,qt(a,e.current)),xe=null;return}}catch(u){if(s!==null)throw xe=s,u;Xe=1,Co(e,qt(a,e.current)),xe=null;return}t.flags&32768?(Ae||l===1?e=!0:sl||(Ne&536870912)!==0?e=!1:(Fa=e=!0,(l===2||l===9||l===3||l===6)&&(l=Rt.current,l!==null&&l.tag===13&&(l.flags|=16384))),Hm(t,e)):Ho(t)}function Ho(e){var t=e;do{if((t.flags&32768)!==0){Hm(t,Fa);return}e=t.return;var a=jv(t.alternate,t,_a);if(a!==null){xe=a;return}if(t=t.sibling,t!==null){xe=t;return}xe=t=e}while(t!==null);Xe===0&&(Xe=5)}function Hm(e,t){do{var a=kv(e.alternate,e);if(a!==null){a.flags&=32767,xe=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){xe=e;return}xe=e=a}while(e!==null);Xe=6,xe=null}function Pm(e,t,a,l,s,u,h,v,A){e.cancelPendingCommit=null;do Po();while(nt!==0);if((je&6)!==0)throw Error(r(327));if(t!==null){if(t===e.current)throw Error(r(177));if(u=t.lanes|t.childLanes,u|=ps,xy(e,a,u,h,v,A),e===He&&(xe=He=null,Ne=0),ul=t,Ya=e,Ea=a,Tc=u,Nc=s,Rm=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Vv(Ui,function(){return Vm(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=T.T,T.T=null,s=X.p,X.p=2,h=je,je|=4;try{zv(e,t,a)}finally{je=h,X.p=s,T.T=l}}nt=1,Um(),Bm(),Fm()}}function Um(){if(nt===1){nt=0;var e=Ya,t=ul,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=T.T,T.T=null;var l=X.p;X.p=2;var s=je;je|=4;try{Tm(t,e);var u=Gc,h=Cd(e.containerInfo),v=u.focusedElem,A=u.selectionRange;if(h!==v&&v&&v.ownerDocument&&Ad(v.ownerDocument.documentElement,v)){if(A!==null&&cs(v)){var z=A.start,P=A.end;if(P===void 0&&(P=z),"selectionStart"in v)v.selectionStart=z,v.selectionEnd=Math.min(P,v.value.length);else{var Y=v.ownerDocument||document,q=Y&&Y.defaultView||window;if(q.getSelection){var H=q.getSelection(),ne=v.textContent.length,ce=Math.min(A.start,ne),Ge=A.end===void 0?ce:Math.min(A.end,ne);!H.extend&&ce>Ge&&(h=Ge,Ge=ce,ce=h);var R=Ed(v,ce),w=Ed(v,Ge);if(R&&w&&(H.rangeCount!==1||H.anchorNode!==R.node||H.anchorOffset!==R.offset||H.focusNode!==w.node||H.focusOffset!==w.offset)){var j=Y.createRange();j.setStart(R.node,R.offset),H.removeAllRanges(),ce>Ge?(H.addRange(j),H.extend(w.node,w.offset)):(j.setEnd(w.node,w.offset),H.addRange(j))}}}}for(Y=[],H=v;H=H.parentNode;)H.nodeType===1&&Y.push({element:H,left:H.scrollLeft,top:H.scrollTop});for(typeof v.focus=="function"&&v.focus(),v=0;v<Y.length;v++){var F=Y[v];F.element.scrollLeft=F.left,F.element.scrollTop=F.top}}Wo=!!Lc,Gc=Lc=null}finally{je=s,X.p=l,T.T=a}}e.current=t,nt=2}}function Bm(){if(nt===2){nt=0;var e=Ya,t=ul,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=T.T,T.T=null;var l=X.p;X.p=2;var s=je;je|=4;try{ym(e,t.alternate,t)}finally{je=s,X.p=l,T.T=a}}nt=3}}function Fm(){if(nt===4||nt===3){nt=0,ue();var e=Ya,t=ul,a=Ea,l=Rm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?nt=5:(nt=0,ul=Ya=null,Km(e,e.pendingLanes));var s=e.pendingLanes;if(s===0&&(Va=null),Fr(a),t=t.stateNode,At&&typeof At.onCommitFiberRoot=="function")try{At.onCommitFiberRoot(wl,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=T.T,s=X.p,X.p=2,T.T=null;try{for(var u=e.onRecoverableError,h=0;h<l.length;h++){var v=l[h];u(v.value,{componentStack:v.stack})}}finally{T.T=t,X.p=s}}(Ea&3)!==0&&Po(),la(e),s=e.pendingLanes,(a&261930)!==0&&(s&42)!==0?e===_c?ci++:(ci=0,_c=e):ci=0,ui(0)}}function Km(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Fl(t)))}function Po(){return Um(),Bm(),Fm(),Vm()}function Vm(){if(nt!==5)return!1;var e=Ya,t=Tc;Tc=0;var a=Fr(Ea),l=T.T,s=X.p;try{X.p=32>a?32:a,T.T=null,a=Nc,Nc=null;var u=Ya,h=Ea;if(nt=0,ul=Ya=null,Ea=0,(je&6)!==0)throw Error(r(331));var v=je;if(je|=4,Cm(u.current),_m(u,u.current,h,a),je=v,ui(0,!1),At&&typeof At.onPostCommitFiberRoot=="function")try{At.onPostCommitFiberRoot(wl,u)}catch{}return!0}finally{X.p=s,T.T=l,Km(e,t)}}function Ym(e,t,a){t=qt(a,t),t=ac(e.stateNode,t,2),e=Ha(e,t,2),e!==null&&(Rl(e,2),la(e))}function ze(e,t,a){if(e.tag===3)Ym(e,e,a);else for(;t!==null;){if(t.tag===3){Ym(t,e,a);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Va===null||!Va.has(l))){e=qt(a,e),a=Xf(2),l=Ha(t,a,2),l!==null&&(Qf(a,l,t,e),Rl(l,2),la(l));break}}t=t.return}}function Cc(e,t,a){var l=e.pingCache;if(l===null){l=e.pingCache=new Gv;var s=new Set;l.set(t,s)}else s=l.get(t),s===void 0&&(s=new Set,l.set(t,s));s.has(a)||(bc=!0,s.add(a),e=Bv.bind(null,e,t,a),t.then(e,e))}function Bv(e,t,a){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,He===e&&(Ne&a)===a&&(Xe===4||Xe===3&&(Ne&62914560)===Ne&&300>Fe()-zo?(je&2)===0&&dl(e,0):Sc|=a,cl===Ne&&(cl=0)),la(e)}function Xm(e,t){t===0&&(t=Pu()),e=fn(e,t),e!==null&&(Rl(e,t),la(e))}function Fv(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),Xm(e,a)}function Kv(e,t){var a=0;switch(e.tag){case 31:case 13:var l=e.stateNode,s=e.memoizedState;s!==null&&(a=s.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(r(314))}l!==null&&l.delete(t),Xm(e,a)}function Vv(e,t){return Q(e,t)}var Uo=null,ml=null,wc=!1,Bo=!1,Mc=!1,Qa=0;function la(e){e!==ml&&e.next===null&&(ml===null?Uo=ml=e:ml=ml.next=e),Bo=!0,wc||(wc=!0,Xv())}function ui(e,t){if(!Mc&&Bo){Mc=!0;do for(var a=!1,l=Uo;l!==null;){if(e!==0){var s=l.pendingLanes;if(s===0)var u=0;else{var h=l.suspendedLanes,v=l.pingedLanes;u=(1<<31-Ct(42|e)+1)-1,u&=s&~(h&~v),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(a=!0,$m(l,u))}else u=Ne,u=Vi(l,l===He?u:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(u&3)===0||Ml(l,u)||(a=!0,$m(l,u));l=l.next}while(a);Mc=!1}}function Yv(){Qm()}function Qm(){Bo=wc=!1;var e=0;Qa!==0&&lb()&&(e=Qa);for(var t=Fe(),a=null,l=Uo;l!==null;){var s=l.next,u=Zm(l,t);u===0?(l.next=null,a===null?Uo=s:a.next=s,s===null&&(ml=a)):(a=l,(e!==0||(u&3)!==0)&&(Bo=!0)),l=s}nt!==0&&nt!==5||ui(e),Qa!==0&&(Qa=0)}function Zm(e,t){for(var a=e.suspendedLanes,l=e.pingedLanes,s=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var h=31-Ct(u),v=1<<h,A=s[h];A===-1?((v&a)===0||(v&l)!==0)&&(s[h]=Sy(v,t)):A<=t&&(e.expiredLanes|=v),u&=~v}if(t=He,a=Ne,a=Vi(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,a===0||e===t&&(ke===2||ke===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&Me(l),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||Ml(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(l!==null&&Me(l),Fr(a)){case 2:case 8:a=qu;break;case 32:a=Ui;break;case 268435456:a=Hu;break;default:a=Ui}return l=Jm.bind(null,e),a=Q(a,l),e.callbackPriority=t,e.callbackNode=a,t}return l!==null&&l!==null&&Me(l),e.callbackPriority=2,e.callbackNode=null,2}function Jm(e,t){if(nt!==0&&nt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Po()&&e.callbackNode!==a)return null;var l=Ne;return l=Vi(e,e===He?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Om(e,l,t),Zm(e,Fe()),e.callbackNode!=null&&e.callbackNode===a?Jm.bind(null,e):null)}function $m(e,t){if(Po())return null;Om(e,t,!0)}function Xv(){ob(function(){(je&6)!==0?Q(zt,Yv):Qm()})}function Rc(){if(Qa===0){var e=$n;e===0&&(e=Bi,Bi<<=1,(Bi&261888)===0&&(Bi=256)),Qa=e}return Qa}function Wm(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Zi(""+e)}function ep(e,t){var a=t.ownerDocument.createElement("input");return a.name=t.name,a.value=t.value,e.id&&a.setAttribute("form",e.id),t.parentNode.insertBefore(a,t),e=new FormData(e),a.parentNode.removeChild(a),e}function Qv(e,t,a,l,s){if(t==="submit"&&a&&a.stateNode===s){var u=Wm((s[vt]||null).action),h=l.submitter;h&&(t=(t=h[vt]||null)?Wm(t.formAction):h.getAttribute("formAction"),t!==null&&(u=t,h=null));var v=new eo("action","action",null,l,s);e.push({event:v,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Qa!==0){var A=h?ep(s,h):new FormData(s);Zs(a,{pending:!0,data:A,method:s.method,action:u},null,A)}}else typeof u=="function"&&(v.preventDefault(),A=h?ep(s,h):new FormData(s),Zs(a,{pending:!0,data:A,method:s.method,action:u},u,A))},currentTarget:s}]})}}for(var Ic=0;Ic<ms.length;Ic++){var Oc=ms[Ic],Zv=Oc.toLowerCase(),Jv=Oc[0].toUpperCase()+Oc.slice(1);Vt(Zv,"on"+Jv)}Vt(Rd,"onAnimationEnd"),Vt(Id,"onAnimationIteration"),Vt(Od,"onAnimationStart"),Vt("dblclick","onDoubleClick"),Vt("focusin","onFocus"),Vt("focusout","onBlur"),Vt(mv,"onTransitionRun"),Vt(pv,"onTransitionStart"),Vt(hv,"onTransitionCancel"),Vt(jd,"onTransitionEnd"),Gn("onMouseEnter",["mouseout","mouseover"]),Gn("onMouseLeave",["mouseout","mouseover"]),Gn("onPointerEnter",["pointerout","pointerover"]),Gn("onPointerLeave",["pointerout","pointerover"]),sn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),sn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),sn("onBeforeInput",["compositionend","keypress","textInput","paste"]),sn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),sn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),sn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var di="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),$v=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(di));function tp(e,t){t=(t&4)!==0;for(var a=0;a<e.length;a++){var l=e[a],s=l.event;l=l.listeners;e:{var u=void 0;if(t)for(var h=l.length-1;0<=h;h--){var v=l[h],A=v.instance,z=v.currentTarget;if(v=v.listener,A!==u&&s.isPropagationStopped())break e;u=v,s.currentTarget=z;try{u(s)}catch(P){no(P)}s.currentTarget=null,u=A}else for(h=0;h<l.length;h++){if(v=l[h],A=v.instance,z=v.currentTarget,v=v.listener,A!==u&&s.isPropagationStopped())break e;u=v,s.currentTarget=z;try{u(s)}catch(P){no(P)}s.currentTarget=null,u=A}}}}function Te(e,t){var a=t[Kr];a===void 0&&(a=t[Kr]=new Set);var l=e+"__bubble";a.has(l)||(ap(t,e,2,!1),a.add(l))}function jc(e,t,a){var l=0;t&&(l|=4),ap(a,e,l,t)}var Fo="_reactListening"+Math.random().toString(36).slice(2);function kc(e){if(!e[Fo]){e[Fo]=!0,Xu.forEach(function(a){a!=="selectionchange"&&($v.has(a)||jc(a,!1,e),jc(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Fo]||(t[Fo]=!0,jc("selectionchange",!1,t))}}function ap(e,t,a,l){switch(Ip(t)){case 2:var s=Ab;break;case 8:s=Cb;break;default:s=Qc}a=s.bind(null,t,a,e),s=void 0,!es||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),l?s!==void 0?e.addEventListener(t,a,{capture:!0,passive:s}):e.addEventListener(t,a,!0):s!==void 0?e.addEventListener(t,a,{passive:s}):e.addEventListener(t,a,!1)}function zc(e,t,a,l,s){var u=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var h=l.tag;if(h===3||h===4){var v=l.stateNode.containerInfo;if(v===s)break;if(h===4)for(h=l.return;h!==null;){var A=h.tag;if((A===3||A===4)&&h.stateNode.containerInfo===s)return;h=h.return}for(;v!==null;){if(h=zn(v),h===null)return;if(A=h.tag,A===5||A===6||A===26||A===27){l=u=h;continue e}v=v.parentNode}}l=l.return}od(function(){var z=u,P=$r(a),Y=[];e:{var q=kd.get(e);if(q!==void 0){var H=eo,ne=e;switch(e){case"keypress":if($i(a)===0)break e;case"keydown":case"keyup":H=Ky;break;case"focusin":ne="focus",H=ls;break;case"focusout":ne="blur",H=ls;break;case"beforeblur":case"afterblur":H=ls;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":H=cd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":H=jy;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":H=Xy;break;case Rd:case Id:case Od:H=Dy;break;case jd:H=Zy;break;case"scroll":case"scrollend":H=Iy;break;case"wheel":H=$y;break;case"copy":case"cut":case"paste":H=Gy;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":H=dd;break;case"toggle":case"beforetoggle":H=ev}var ce=(t&4)!==0,Ge=!ce&&(e==="scroll"||e==="scrollend"),R=ce?q!==null?q+"Capture":null:q;ce=[];for(var w=z,j;w!==null;){var F=w;if(j=F.stateNode,F=F.tag,F!==5&&F!==26&&F!==27||j===null||R===null||(F=jl(w,R),F!=null&&ce.push(fi(w,F,j))),Ge)break;w=w.return}0<ce.length&&(q=new H(q,ne,null,a,P),Y.push({event:q,listeners:ce}))}}if((t&7)===0){e:{if(q=e==="mouseover"||e==="pointerover",H=e==="mouseout"||e==="pointerout",q&&a!==Jr&&(ne=a.relatedTarget||a.fromElement)&&(zn(ne)||ne[kn]))break e;if((H||q)&&(q=P.window===P?P:(q=P.ownerDocument)?q.defaultView||q.parentWindow:window,H?(ne=a.relatedTarget||a.toElement,H=z,ne=ne?zn(ne):null,ne!==null&&(Ge=f(ne),ce=ne.tag,ne!==Ge||ce!==5&&ce!==27&&ce!==6)&&(ne=null)):(H=null,ne=z),H!==ne)){if(ce=cd,F="onMouseLeave",R="onMouseEnter",w="mouse",(e==="pointerout"||e==="pointerover")&&(ce=dd,F="onPointerLeave",R="onPointerEnter",w="pointer"),Ge=H==null?q:Ol(H),j=ne==null?q:Ol(ne),q=new ce(F,w+"leave",H,a,P),q.target=Ge,q.relatedTarget=j,F=null,zn(P)===z&&(ce=new ce(R,w+"enter",ne,a,P),ce.target=j,ce.relatedTarget=Ge,F=ce),Ge=F,H&&ne)t:{for(ce=Wv,R=H,w=ne,j=0,F=R;F;F=ce(F))j++;F=0;for(var re=w;re;re=ce(re))F++;for(;0<j-F;)R=ce(R),j--;for(;0<F-j;)w=ce(w),F--;for(;j--;){if(R===w||w!==null&&R===w.alternate){ce=R;break t}R=ce(R),w=ce(w)}ce=null}else ce=null;H!==null&&np(Y,q,H,ce,!1),ne!==null&&Ge!==null&&np(Y,Ge,ne,ce,!0)}}e:{if(q=z?Ol(z):window,H=q.nodeName&&q.nodeName.toLowerCase(),H==="select"||H==="input"&&q.type==="file")var Re=bd;else if(yd(q))if(Sd)Re=uv;else{Re=sv;var le=rv}else H=q.nodeName,!H||H.toLowerCase()!=="input"||q.type!=="checkbox"&&q.type!=="radio"?z&&Zr(z.elementType)&&(Re=bd):Re=cv;if(Re&&(Re=Re(e,z))){vd(Y,Re,a,P);break e}le&&le(e,q,z),e==="focusout"&&z&&q.type==="number"&&z.memoizedProps.value!=null&&Qr(q,"number",q.value)}switch(le=z?Ol(z):window,e){case"focusin":(yd(le)||le.contentEditable==="true")&&(Fn=le,us=z,Pl=null);break;case"focusout":Pl=us=Fn=null;break;case"mousedown":ds=!0;break;case"contextmenu":case"mouseup":case"dragend":ds=!1,wd(Y,a,P);break;case"selectionchange":if(fv)break;case"keydown":case"keyup":wd(Y,a,P)}var he;if(os)e:{switch(e){case"compositionstart":var _e="onCompositionStart";break e;case"compositionend":_e="onCompositionEnd";break e;case"compositionupdate":_e="onCompositionUpdate";break e}_e=void 0}else Bn?hd(e,a)&&(_e="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(_e="onCompositionStart");_e&&(fd&&a.locale!=="ko"&&(Bn||_e!=="onCompositionStart"?_e==="onCompositionEnd"&&Bn&&(he=rd()):(ja=P,ts="value"in ja?ja.value:ja.textContent,Bn=!0)),le=Ko(z,_e),0<le.length&&(_e=new ud(_e,e,null,a,P),Y.push({event:_e,listeners:le}),he?_e.data=he:(he=gd(a),he!==null&&(_e.data=he)))),(he=av?nv(e,a):lv(e,a))&&(_e=Ko(z,"onBeforeInput"),0<_e.length&&(le=new ud("onBeforeInput","beforeinput",null,a,P),Y.push({event:le,listeners:_e}),le.data=he)),Qv(Y,e,z,a,P)}tp(Y,t)})}function fi(e,t,a){return{instance:e,listener:t,currentTarget:a}}function Ko(e,t){for(var a=t+"Capture",l=[];e!==null;){var s=e,u=s.stateNode;if(s=s.tag,s!==5&&s!==26&&s!==27||u===null||(s=jl(e,a),s!=null&&l.unshift(fi(e,s,u)),s=jl(e,t),s!=null&&l.push(fi(e,s,u))),e.tag===3)return l;e=e.return}return[]}function Wv(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function np(e,t,a,l,s){for(var u=t._reactName,h=[];a!==null&&a!==l;){var v=a,A=v.alternate,z=v.stateNode;if(v=v.tag,A!==null&&A===l)break;v!==5&&v!==26&&v!==27||z===null||(A=z,s?(z=jl(a,u),z!=null&&h.unshift(fi(a,z,A))):s||(z=jl(a,u),z!=null&&h.push(fi(a,z,A)))),a=a.return}h.length!==0&&e.push({event:t,listeners:h})}var eb=/\r\n?/g,tb=/\u0000|\uFFFD/g;function lp(e){return(typeof e=="string"?e:""+e).replace(eb,`
|
|
10
|
+
`).replace(tb,"")}function ip(e,t){return t=lp(t),lp(e)===t}function Le(e,t,a,l,s,u){switch(a){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||Hn(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&Hn(e,""+l);break;case"className":Xi(e,"class",l);break;case"tabIndex":Xi(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":Xi(e,a,l);break;case"style":ld(e,l,u);break;case"data":if(t!=="object"){Xi(e,"data",l);break}case"src":case"href":if(l===""&&(t!=="a"||a!=="href")){e.removeAttribute(a);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=Zi(""+l),e.setAttribute(a,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof u=="function"&&(a==="formAction"?(t!=="input"&&Le(e,t,"name",s.name,s,null),Le(e,t,"formEncType",s.formEncType,s,null),Le(e,t,"formMethod",s.formMethod,s,null),Le(e,t,"formTarget",s.formTarget,s,null)):(Le(e,t,"encType",s.encType,s,null),Le(e,t,"method",s.method,s,null),Le(e,t,"target",s.target,s,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=Zi(""+l),e.setAttribute(a,l);break;case"onClick":l!=null&&(e.onclick=ua);break;case"onScroll":l!=null&&Te("scroll",e);break;case"onScrollEnd":l!=null&&Te("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(a=l.__html,a!=null){if(s.children!=null)throw Error(r(60));e.innerHTML=a}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}a=Zi(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,""+l):e.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":l===!0?e.setAttribute(a,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,l):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(a,l):e.removeAttribute(a);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(a):e.setAttribute(a,l);break;case"popover":Te("beforetoggle",e),Te("toggle",e),Yi(e,"popover",l);break;case"xlinkActuate":ca(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":ca(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":ca(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":ca(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":ca(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":ca(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":ca(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":ca(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":ca(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Yi(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=My.get(a)||a,Yi(e,a,l))}}function Dc(e,t,a,l,s,u){switch(a){case"style":ld(e,l,u);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(a=l.__html,a!=null){if(s.children!=null)throw Error(r(60));e.innerHTML=a}}break;case"children":typeof l=="string"?Hn(e,l):(typeof l=="number"||typeof l=="bigint")&&Hn(e,""+l);break;case"onScroll":l!=null&&Te("scroll",e);break;case"onScrollEnd":l!=null&&Te("scrollend",e);break;case"onClick":l!=null&&(e.onclick=ua);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Qu.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(s=a.endsWith("Capture"),t=a.slice(2,s?a.length-7:void 0),u=e[vt]||null,u=u!=null?u[a]:null,typeof u=="function"&&e.removeEventListener(t,u,s),typeof l=="function")){typeof u!="function"&&u!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(t,l,s);break e}a in e?e[a]=l:l===!0?e.setAttribute(a,""):Yi(e,a,l)}}}function dt(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Te("error",e),Te("load",e);var l=!1,s=!1,u;for(u in a)if(a.hasOwnProperty(u)){var h=a[u];if(h!=null)switch(u){case"src":l=!0;break;case"srcSet":s=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:Le(e,t,u,h,a,null)}}s&&Le(e,t,"srcSet",a.srcSet,a,null),l&&Le(e,t,"src",a.src,a,null);return;case"input":Te("invalid",e);var v=u=h=s=null,A=null,z=null;for(l in a)if(a.hasOwnProperty(l)){var P=a[l];if(P!=null)switch(l){case"name":s=P;break;case"type":h=P;break;case"checked":A=P;break;case"defaultChecked":z=P;break;case"value":u=P;break;case"defaultValue":v=P;break;case"children":case"dangerouslySetInnerHTML":if(P!=null)throw Error(r(137,t));break;default:Le(e,t,l,P,a,null)}}ed(e,u,v,A,z,h,s,!1);return;case"select":Te("invalid",e),l=h=u=null;for(s in a)if(a.hasOwnProperty(s)&&(v=a[s],v!=null))switch(s){case"value":u=v;break;case"defaultValue":h=v;break;case"multiple":l=v;default:Le(e,t,s,v,a,null)}t=u,a=h,e.multiple=!!l,t!=null?qn(e,!!l,t,!1):a!=null&&qn(e,!!l,a,!0);return;case"textarea":Te("invalid",e),u=s=l=null;for(h in a)if(a.hasOwnProperty(h)&&(v=a[h],v!=null))switch(h){case"value":l=v;break;case"defaultValue":s=v;break;case"children":u=v;break;case"dangerouslySetInnerHTML":if(v!=null)throw Error(r(91));break;default:Le(e,t,h,v,a,null)}ad(e,l,s,u);return;case"option":for(A in a)a.hasOwnProperty(A)&&(l=a[A],l!=null)&&(A==="selected"?e.selected=l&&typeof l!="function"&&typeof l!="symbol":Le(e,t,A,l,a,null));return;case"dialog":Te("beforetoggle",e),Te("toggle",e),Te("cancel",e),Te("close",e);break;case"iframe":case"object":Te("load",e);break;case"video":case"audio":for(l=0;l<di.length;l++)Te(di[l],e);break;case"image":Te("error",e),Te("load",e);break;case"details":Te("toggle",e);break;case"embed":case"source":case"link":Te("error",e),Te("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(z in a)if(a.hasOwnProperty(z)&&(l=a[z],l!=null))switch(z){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:Le(e,t,z,l,a,null)}return;default:if(Zr(t)){for(P in a)a.hasOwnProperty(P)&&(l=a[P],l!==void 0&&Dc(e,t,P,l,a,void 0));return}}for(v in a)a.hasOwnProperty(v)&&(l=a[v],l!=null&&Le(e,t,v,l,a,null))}function ab(e,t,a,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var s=null,u=null,h=null,v=null,A=null,z=null,P=null;for(H in a){var Y=a[H];if(a.hasOwnProperty(H)&&Y!=null)switch(H){case"checked":break;case"value":break;case"defaultValue":A=Y;default:l.hasOwnProperty(H)||Le(e,t,H,null,l,Y)}}for(var q in l){var H=l[q];if(Y=a[q],l.hasOwnProperty(q)&&(H!=null||Y!=null))switch(q){case"type":u=H;break;case"name":s=H;break;case"checked":z=H;break;case"defaultChecked":P=H;break;case"value":h=H;break;case"defaultValue":v=H;break;case"children":case"dangerouslySetInnerHTML":if(H!=null)throw Error(r(137,t));break;default:H!==Y&&Le(e,t,q,H,l,Y)}}Xr(e,h,v,A,z,P,u,s);return;case"select":H=h=v=q=null;for(u in a)if(A=a[u],a.hasOwnProperty(u)&&A!=null)switch(u){case"value":break;case"multiple":H=A;default:l.hasOwnProperty(u)||Le(e,t,u,null,l,A)}for(s in l)if(u=l[s],A=a[s],l.hasOwnProperty(s)&&(u!=null||A!=null))switch(s){case"value":q=u;break;case"defaultValue":v=u;break;case"multiple":h=u;default:u!==A&&Le(e,t,s,u,l,A)}t=v,a=h,l=H,q!=null?qn(e,!!a,q,!1):!!l!=!!a&&(t!=null?qn(e,!!a,t,!0):qn(e,!!a,a?[]:"",!1));return;case"textarea":H=q=null;for(v in a)if(s=a[v],a.hasOwnProperty(v)&&s!=null&&!l.hasOwnProperty(v))switch(v){case"value":break;case"children":break;default:Le(e,t,v,null,l,s)}for(h in l)if(s=l[h],u=a[h],l.hasOwnProperty(h)&&(s!=null||u!=null))switch(h){case"value":q=s;break;case"defaultValue":H=s;break;case"children":break;case"dangerouslySetInnerHTML":if(s!=null)throw Error(r(91));break;default:s!==u&&Le(e,t,h,s,l,u)}td(e,q,H);return;case"option":for(var ne in a)q=a[ne],a.hasOwnProperty(ne)&&q!=null&&!l.hasOwnProperty(ne)&&(ne==="selected"?e.selected=!1:Le(e,t,ne,null,l,q));for(A in l)q=l[A],H=a[A],l.hasOwnProperty(A)&&q!==H&&(q!=null||H!=null)&&(A==="selected"?e.selected=q&&typeof q!="function"&&typeof q!="symbol":Le(e,t,A,q,l,H));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ce in a)q=a[ce],a.hasOwnProperty(ce)&&q!=null&&!l.hasOwnProperty(ce)&&Le(e,t,ce,null,l,q);for(z in l)if(q=l[z],H=a[z],l.hasOwnProperty(z)&&q!==H&&(q!=null||H!=null))switch(z){case"children":case"dangerouslySetInnerHTML":if(q!=null)throw Error(r(137,t));break;default:Le(e,t,z,q,l,H)}return;default:if(Zr(t)){for(var Ge in a)q=a[Ge],a.hasOwnProperty(Ge)&&q!==void 0&&!l.hasOwnProperty(Ge)&&Dc(e,t,Ge,void 0,l,q);for(P in l)q=l[P],H=a[P],!l.hasOwnProperty(P)||q===H||q===void 0&&H===void 0||Dc(e,t,P,q,l,H);return}}for(var R in a)q=a[R],a.hasOwnProperty(R)&&q!=null&&!l.hasOwnProperty(R)&&Le(e,t,R,null,l,q);for(Y in l)q=l[Y],H=a[Y],!l.hasOwnProperty(Y)||q===H||q==null&&H==null||Le(e,t,Y,q,l,H)}function op(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function nb(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,a=performance.getEntriesByType("resource"),l=0;l<a.length;l++){var s=a[l],u=s.transferSize,h=s.initiatorType,v=s.duration;if(u&&v&&op(h)){for(h=0,v=s.responseEnd,l+=1;l<a.length;l++){var A=a[l],z=A.startTime;if(z>v)break;var P=A.transferSize,Y=A.initiatorType;P&&op(Y)&&(A=A.responseEnd,h+=P*(A<v?1:(v-z)/(A-z)))}if(--l,t+=8*(u+h)/(s.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Lc=null,Gc=null;function Vo(e){return e.nodeType===9?e:e.ownerDocument}function rp(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function sp(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function qc(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Hc=null;function lb(){var e=window.event;return e&&e.type==="popstate"?e===Hc?!1:(Hc=e,!0):(Hc=null,!1)}var cp=typeof setTimeout=="function"?setTimeout:void 0,ib=typeof clearTimeout=="function"?clearTimeout:void 0,up=typeof Promise=="function"?Promise:void 0,ob=typeof queueMicrotask=="function"?queueMicrotask:typeof up<"u"?function(e){return up.resolve(null).then(e).catch(rb)}:cp;function rb(e){setTimeout(function(){throw e})}function Za(e){return e==="head"}function dp(e,t){var a=t,l=0;do{var s=a.nextSibling;if(e.removeChild(a),s&&s.nodeType===8)if(a=s.data,a==="/$"||a==="/&"){if(l===0){e.removeChild(s),yl(t);return}l--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")l++;else if(a==="html")mi(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,mi(a);for(var u=a.firstChild;u;){var h=u.nextSibling,v=u.nodeName;u[Il]||v==="SCRIPT"||v==="STYLE"||v==="LINK"&&u.rel.toLowerCase()==="stylesheet"||a.removeChild(u),u=h}}else a==="body"&&mi(e.ownerDocument.body);a=s}while(a);yl(t)}function fp(e,t){var a=e;e=0;do{var l=a.nextSibling;if(a.nodeType===1?t?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(t?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),l&&l.nodeType===8)if(a=l.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=l}while(a)}function Pc(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var a=t;switch(t=t.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":Pc(a),Vr(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function sb(e,t,a,l){for(;e.nodeType===1;){var s=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[Il])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(u=e.getAttribute("rel"),u==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(u!==s.rel||e.getAttribute("href")!==(s.href==null||s.href===""?null:s.href)||e.getAttribute("crossorigin")!==(s.crossOrigin==null?null:s.crossOrigin)||e.getAttribute("title")!==(s.title==null?null:s.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(u=e.getAttribute("src"),(u!==(s.src==null?null:s.src)||e.getAttribute("type")!==(s.type==null?null:s.type)||e.getAttribute("crossorigin")!==(s.crossOrigin==null?null:s.crossOrigin))&&u&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var u=s.name==null?null:""+s.name;if(s.type==="hidden"&&e.getAttribute("name")===u)return e}else return e;if(e=Ft(e.nextSibling),e===null)break}return null}function cb(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=Ft(e.nextSibling),e===null))return null;return e}function mp(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Ft(e.nextSibling),e===null))return null;return e}function Uc(e){return e.data==="$?"||e.data==="$~"}function Bc(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function ub(e,t){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||a.readyState!=="loading")t();else{var l=function(){t(),a.removeEventListener("DOMContentLoaded",l)};a.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function Ft(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Fc=null;function pp(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return Ft(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function hp(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(t===0)return e;t--}else a!=="/$"&&a!=="/&"||t++}e=e.previousSibling}return null}function gp(e,t,a){switch(t=Vo(a),e){case"html":if(e=t.documentElement,!e)throw Error(r(452));return e;case"head":if(e=t.head,!e)throw Error(r(453));return e;case"body":if(e=t.body,!e)throw Error(r(454));return e;default:throw Error(r(451))}}function mi(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Vr(e)}var Kt=new Map,yp=new Set;function Yo(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Aa=X.d;X.d={f:db,r:fb,D:mb,C:pb,L:hb,m:gb,X:vb,S:yb,M:bb};function db(){var e=Aa.f(),t=Go();return e||t}function fb(e){var t=Dn(e);t!==null&&t.tag===5&&t.type==="form"?kf(t):Aa.r(e)}var pl=typeof document>"u"?null:document;function vp(e,t,a){var l=pl;if(l&&typeof t=="string"&&t){var s=Lt(t);s='link[rel="'+e+'"][href="'+s+'"]',typeof a=="string"&&(s+='[crossorigin="'+a+'"]'),yp.has(s)||(yp.add(s),e={rel:e,crossOrigin:a,href:t},l.querySelector(s)===null&&(t=l.createElement("link"),dt(t,"link",e),lt(t),l.head.appendChild(t)))}}function mb(e){Aa.D(e),vp("dns-prefetch",e,null)}function pb(e,t){Aa.C(e,t),vp("preconnect",e,t)}function hb(e,t,a){Aa.L(e,t,a);var l=pl;if(l&&e&&t){var s='link[rel="preload"][as="'+Lt(t)+'"]';t==="image"&&a&&a.imageSrcSet?(s+='[imagesrcset="'+Lt(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(s+='[imagesizes="'+Lt(a.imageSizes)+'"]')):s+='[href="'+Lt(e)+'"]';var u=s;switch(t){case"style":u=hl(e);break;case"script":u=gl(e)}Kt.has(u)||(e=S({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),Kt.set(u,e),l.querySelector(s)!==null||t==="style"&&l.querySelector(pi(u))||t==="script"&&l.querySelector(hi(u))||(t=l.createElement("link"),dt(t,"link",e),lt(t),l.head.appendChild(t)))}}function gb(e,t){Aa.m(e,t);var a=pl;if(a&&e){var l=t&&typeof t.as=="string"?t.as:"script",s='link[rel="modulepreload"][as="'+Lt(l)+'"][href="'+Lt(e)+'"]',u=s;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=gl(e)}if(!Kt.has(u)&&(e=S({rel:"modulepreload",href:e},t),Kt.set(u,e),a.querySelector(s)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(hi(u)))return}l=a.createElement("link"),dt(l,"link",e),lt(l),a.head.appendChild(l)}}}function yb(e,t,a){Aa.S(e,t,a);var l=pl;if(l&&e){var s=Ln(l).hoistableStyles,u=hl(e);t=t||"default";var h=s.get(u);if(!h){var v={loading:0,preload:null};if(h=l.querySelector(pi(u)))v.loading=5;else{e=S({rel:"stylesheet",href:e,"data-precedence":t},a),(a=Kt.get(u))&&Kc(e,a);var A=h=l.createElement("link");lt(A),dt(A,"link",e),A._p=new Promise(function(z,P){A.onload=z,A.onerror=P}),A.addEventListener("load",function(){v.loading|=1}),A.addEventListener("error",function(){v.loading|=2}),v.loading|=4,Xo(h,t,l)}h={type:"stylesheet",instance:h,count:1,state:v},s.set(u,h)}}}function vb(e,t){Aa.X(e,t);var a=pl;if(a&&e){var l=Ln(a).hoistableScripts,s=gl(e),u=l.get(s);u||(u=a.querySelector(hi(s)),u||(e=S({src:e,async:!0},t),(t=Kt.get(s))&&Vc(e,t),u=a.createElement("script"),lt(u),dt(u,"link",e),a.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(s,u))}}function bb(e,t){Aa.M(e,t);var a=pl;if(a&&e){var l=Ln(a).hoistableScripts,s=gl(e),u=l.get(s);u||(u=a.querySelector(hi(s)),u||(e=S({src:e,async:!0,type:"module"},t),(t=Kt.get(s))&&Vc(e,t),u=a.createElement("script"),lt(u),dt(u,"link",e),a.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(s,u))}}function bp(e,t,a,l){var s=(s=fe.current)?Yo(s):null;if(!s)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=hl(a.href),a=Ln(s).hoistableStyles,l=a.get(t),l||(l={type:"style",instance:null,count:0,state:null},a.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=hl(a.href);var u=Ln(s).hoistableStyles,h=u.get(e);if(h||(s=s.ownerDocument||s,h={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,h),(u=s.querySelector(pi(e)))&&!u._p&&(h.instance=u,h.state.loading=5),Kt.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Kt.set(e,a),u||Sb(s,e,a,h.state))),t&&l===null)throw Error(r(528,""));return h}if(t&&l!==null)throw Error(r(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=gl(a),a=Ln(s).hoistableScripts,l=a.get(t),l||(l={type:"script",instance:null,count:0,state:null},a.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function hl(e){return'href="'+Lt(e)+'"'}function pi(e){return'link[rel="stylesheet"]['+e+"]"}function Sp(e){return S({},e,{"data-precedence":e.precedence,precedence:null})}function Sb(e,t,a,l){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=e.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),dt(t,"link",a),lt(t),e.head.appendChild(t))}function gl(e){return'[src="'+Lt(e)+'"]'}function hi(e){return"script[async]"+e}function xp(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+Lt(a.href)+'"]');if(l)return t.instance=l,lt(l),l;var s=S({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),lt(l),dt(l,"style",s),Xo(l,a.precedence,e),t.instance=l;case"stylesheet":s=hl(a.href);var u=e.querySelector(pi(s));if(u)return t.state.loading|=4,t.instance=u,lt(u),u;l=Sp(a),(s=Kt.get(s))&&Kc(l,s),u=(e.ownerDocument||e).createElement("link"),lt(u);var h=u;return h._p=new Promise(function(v,A){h.onload=v,h.onerror=A}),dt(u,"link",l),t.state.loading|=4,Xo(u,a.precedence,e),t.instance=u;case"script":return u=gl(a.src),(s=e.querySelector(hi(u)))?(t.instance=s,lt(s),s):(l=a,(s=Kt.get(u))&&(l=S({},a),Vc(l,s)),e=e.ownerDocument||e,s=e.createElement("script"),lt(s),dt(s,"link",l),e.head.appendChild(s),t.instance=s);case"void":return null;default:throw Error(r(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,Xo(l,a.precedence,e));return t.instance}function Xo(e,t,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),s=l.length?l[l.length-1]:null,u=s,h=0;h<l.length;h++){var v=l[h];if(v.dataset.precedence===t)u=v;else if(u!==s)break}u?u.parentNode.insertBefore(e,u.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function Kc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Vc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Qo=null;function Tp(e,t,a){if(Qo===null){var l=new Map,s=Qo=new Map;s.set(a,l)}else s=Qo,l=s.get(a),l||(l=new Map,s.set(a,l));if(l.has(e))return l;for(l.set(e,null),a=a.getElementsByTagName(e),s=0;s<a.length;s++){var u=a[s];if(!(u[Il]||u[rt]||e==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var h=u.getAttribute(t)||"";h=e+h;var v=l.get(h);v?v.push(u):l.set(h,[u])}}return l}function Np(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function xb(e,t,a){if(a===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function _p(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Tb(e,t,a,l){if(a.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var s=hl(l.href),u=t.querySelector(pi(s));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Zo.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=u,lt(u);return}u=t.ownerDocument||t,l=Sp(l),(s=Kt.get(s))&&Kc(l,s),u=u.createElement("link"),lt(u);var h=u;h._p=new Promise(function(v,A){h.onload=v,h.onerror=A}),dt(u,"link",l),a.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Zo.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var Yc=0;function Nb(e,t){return e.stylesheets&&e.count===0&&$o(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var l=setTimeout(function(){if(e.stylesheets&&$o(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&Yc===0&&(Yc=62500*nb());var s=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&$o(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>Yc?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(s)}}:null}function Zo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)$o(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Jo=null;function $o(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Jo=new Map,t.forEach(_b,e),Jo=null,Zo.call(e))}function _b(e,t){if(!(t.state.loading&4)){var a=Jo.get(e);if(a)var l=a.get(null);else{a=new Map,Jo.set(e,a);for(var s=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<s.length;u++){var h=s[u];(h.nodeName==="LINK"||h.getAttribute("media")!=="not all")&&(a.set(h.dataset.precedence,h),l=h)}l&&a.set(null,l)}s=t.instance,h=s.getAttribute("data-precedence"),u=a.get(h)||l,u===l&&a.set(null,s),a.set(h,s),this.count++,l=Zo.bind(this),s.addEventListener("load",l),s.addEventListener("error",l),u?u.parentNode.insertBefore(s,u.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(s,e.firstChild)),t.state.loading|=4}}var gi={$$typeof:O,Provider:null,Consumer:null,_currentValue:te,_currentValue2:te,_threadCount:0};function Eb(e,t,a,l,s,u,h,v,A){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ur(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ur(0),this.hiddenUpdates=Ur(null),this.identifierPrefix=l,this.onUncaughtError=s,this.onCaughtError=u,this.onRecoverableError=h,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=A,this.incompleteTransitions=new Map}function Ep(e,t,a,l,s,u,h,v,A,z,P,Y){return e=new Eb(e,t,a,h,A,z,P,Y,v),t=1,u===!0&&(t|=24),u=Mt(3,null,null,t),e.current=u,u.stateNode=e,t=As(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:l,isDehydrated:a,cache:t},Rs(u),e}function Ap(e){return e?(e=Yn,e):Yn}function Cp(e,t,a,l,s,u){s=Ap(s),l.context===null?l.context=s:l.pendingContext=s,l=qa(t),l.payload={element:a},u=u===void 0?null:u,u!==null&&(l.callback=u),a=Ha(e,l,t),a!==null&&(_t(a,e,t),Xl(a,e,t))}function wp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function Xc(e,t){wp(e,t),(e=e.alternate)&&wp(e,t)}function Mp(e){if(e.tag===13||e.tag===31){var t=fn(e,67108864);t!==null&&_t(t,e,67108864),Xc(e,67108864)}}function Rp(e){if(e.tag===13||e.tag===31){var t=kt();t=Br(t);var a=fn(e,t);a!==null&&_t(a,e,t),Xc(e,t)}}var Wo=!0;function Ab(e,t,a,l){var s=T.T;T.T=null;var u=X.p;try{X.p=2,Qc(e,t,a,l)}finally{X.p=u,T.T=s}}function Cb(e,t,a,l){var s=T.T;T.T=null;var u=X.p;try{X.p=8,Qc(e,t,a,l)}finally{X.p=u,T.T=s}}function Qc(e,t,a,l){if(Wo){var s=Zc(l);if(s===null)zc(e,t,l,er,a),Op(e,l);else if(Mb(s,e,t,a,l))l.stopPropagation();else if(Op(e,l),t&4&&-1<wb.indexOf(e)){for(;s!==null;){var u=Dn(s);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var h=rn(u.pendingLanes);if(h!==0){var v=u;for(v.pendingLanes|=2,v.entangledLanes|=2;h;){var A=1<<31-Ct(h);v.entanglements[1]|=A,h&=~A}la(u),(je&6)===0&&(Do=Fe()+500,ui(0))}}break;case 31:case 13:v=fn(u,2),v!==null&&_t(v,u,2),Go(),Xc(u,2)}if(u=Zc(l),u===null&&zc(e,t,l,er,a),u===s)break;s=u}s!==null&&l.stopPropagation()}else zc(e,t,l,null,a)}}function Zc(e){return e=$r(e),Jc(e)}var er=null;function Jc(e){if(er=null,e=zn(e),e!==null){var t=f(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=p(t),e!==null)return e;e=null}else if(a===31){if(e=m(t),e!==null)return e;e=null}else if(a===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return er=e,null}function Ip(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(jn()){case zt:return 2;case qu:return 8;case Ui:case py:return 32;case Hu:return 268435456;default:return 32}default:return 32}}var $c=!1,Ja=null,$a=null,Wa=null,yi=new Map,vi=new Map,en=[],wb="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Op(e,t){switch(e){case"focusin":case"focusout":Ja=null;break;case"dragenter":case"dragleave":$a=null;break;case"mouseover":case"mouseout":Wa=null;break;case"pointerover":case"pointerout":yi.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":vi.delete(t.pointerId)}}function bi(e,t,a,l,s,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:a,eventSystemFlags:l,nativeEvent:u,targetContainers:[s]},t!==null&&(t=Dn(t),t!==null&&Mp(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function Mb(e,t,a,l,s){switch(t){case"focusin":return Ja=bi(Ja,e,t,a,l,s),!0;case"dragenter":return $a=bi($a,e,t,a,l,s),!0;case"mouseover":return Wa=bi(Wa,e,t,a,l,s),!0;case"pointerover":var u=s.pointerId;return yi.set(u,bi(yi.get(u)||null,e,t,a,l,s)),!0;case"gotpointercapture":return u=s.pointerId,vi.set(u,bi(vi.get(u)||null,e,t,a,l,s)),!0}return!1}function jp(e){var t=zn(e.target);if(t!==null){var a=f(t);if(a!==null){if(t=a.tag,t===13){if(t=p(a),t!==null){e.blockedOn=t,Vu(e.priority,function(){Rp(a)});return}}else if(t===31){if(t=m(a),t!==null){e.blockedOn=t,Vu(e.priority,function(){Rp(a)});return}}else if(t===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function tr(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=Zc(e.nativeEvent);if(a===null){a=e.nativeEvent;var l=new a.constructor(a.type,a);Jr=l,a.target.dispatchEvent(l),Jr=null}else return t=Dn(a),t!==null&&Mp(t),e.blockedOn=a,!1;t.shift()}return!0}function kp(e,t,a){tr(e)&&a.delete(t)}function Rb(){$c=!1,Ja!==null&&tr(Ja)&&(Ja=null),$a!==null&&tr($a)&&($a=null),Wa!==null&&tr(Wa)&&(Wa=null),yi.forEach(kp),vi.forEach(kp)}function ar(e,t){e.blockedOn===t&&(e.blockedOn=null,$c||($c=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,Rb)))}var nr=null;function zp(e){nr!==e&&(nr=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){nr===e&&(nr=null);for(var t=0;t<e.length;t+=3){var a=e[t],l=e[t+1],s=e[t+2];if(typeof l!="function"){if(Jc(l||a)===null)continue;break}var u=Dn(a);u!==null&&(e.splice(t,3),t-=3,Zs(u,{pending:!0,data:s,method:a.method,action:l},l,s))}}))}function yl(e){function t(A){return ar(A,e)}Ja!==null&&ar(Ja,e),$a!==null&&ar($a,e),Wa!==null&&ar(Wa,e),yi.forEach(t),vi.forEach(t);for(var a=0;a<en.length;a++){var l=en[a];l.blockedOn===e&&(l.blockedOn=null)}for(;0<en.length&&(a=en[0],a.blockedOn===null);)jp(a),a.blockedOn===null&&en.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(l=0;l<a.length;l+=3){var s=a[l],u=a[l+1],h=s[vt]||null;if(typeof u=="function")h||zp(a);else if(h){var v=null;if(u&&u.hasAttribute("formAction")){if(s=u,h=u[vt]||null)v=h.formAction;else if(Jc(s)!==null)continue}else v=h.action;typeof v=="function"?a[l+1]=v:(a.splice(l,3),l-=3),zp(a)}}}function Dp(){function e(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(h){return s=h})},focusReset:"manual",scroll:"manual"})}function t(){s!==null&&(s(),s=null),l||setTimeout(a,20)}function a(){if(!l&&!navigation.transition){var u=navigation.currentEntry;u&&u.url!=null&&navigation.navigate(u.url,{state:u.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,s=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(a,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),s!==null&&(s(),s=null)}}}function Wc(e){this._internalRoot=e}lr.prototype.render=Wc.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));var a=t.current,l=kt();Cp(a,l,e,t,null,null)},lr.prototype.unmount=Wc.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Cp(e.current,2,null,e,null,null),Go(),t[kn]=null}};function lr(e){this._internalRoot=e}lr.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ku();e={blockedOn:null,target:e,priority:t};for(var a=0;a<en.length&&t!==0&&t<en[a].priority;a++);en.splice(a,0,e),a===0&&jp(e)}};var Lp=o.version;if(Lp!=="19.2.5")throw Error(r(527,Lp,"19.2.5"));X.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=g(t),e=e!==null?x(e):null,e=e===null?null:e.stateNode,e};var Ib={bundleType:0,version:"19.2.5",rendererPackageName:"react-dom",currentDispatcherRef:T,reconcilerVersion:"19.2.5"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ir=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ir.isDisabled&&ir.supportsFiber)try{wl=ir.inject(Ib),At=ir}catch{}}return xi.createRoot=function(e,t){if(!c(e))throw Error(r(299));var a=!1,l="",s=Ff,u=Kf,h=Vf;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(s=t.onUncaughtError),t.onCaughtError!==void 0&&(u=t.onCaughtError),t.onRecoverableError!==void 0&&(h=t.onRecoverableError)),t=Ep(e,1,!1,null,null,a,l,null,s,u,h,Dp),e[kn]=t.current,kc(e),new Wc(t)},xi.hydrateRoot=function(e,t,a){if(!c(e))throw Error(r(299));var l=!1,s="",u=Ff,h=Kf,v=Vf,A=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(s=a.identifierPrefix),a.onUncaughtError!==void 0&&(u=a.onUncaughtError),a.onCaughtError!==void 0&&(h=a.onCaughtError),a.onRecoverableError!==void 0&&(v=a.onRecoverableError),a.formState!==void 0&&(A=a.formState)),t=Ep(e,1,!0,t,a??null,l,s,A,u,h,v,Dp),t.context=Ap(null),a=t.current,l=kt(),l=Br(l),s=qa(l),s.callback=null,Ha(a,s,l),a=l,t.current.lanes=a,Rl(t,a),la(t),e[kn]=t.current,kc(e),new lr(t)},xi.version="19.2.5",xi}var Yp;function Pb(){if(Yp)return au.exports;Yp=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(o){console.error(o)}}return n(),au.exports=Hb(),au.exports}var Ub=Pb();const Bb="modulepreload",Fb=function(n){return"/"+n},Xp={},wa=function(o,i,r){let c=Promise.resolve();if(i&&i.length>0){let y=function(g){return Promise.all(g.map(x=>Promise.resolve(x).then(S=>({status:"fulfilled",value:S}),S=>({status:"rejected",reason:S}))))};document.getElementsByTagName("link");const p=document.querySelector("meta[property=csp-nonce]"),m=p?.nonce||p?.getAttribute("nonce");c=y(i.map(g=>{if(g=Fb(g),g in Xp)return;Xp[g]=!0;const x=g.endsWith(".css"),S=x?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${S}`))return;const b=document.createElement("link");if(b.rel=x?"stylesheet":Bb,x||(b.as="script"),b.crossOrigin="",b.href=g,m&&b.setAttribute("nonce",m),document.head.appendChild(b),x)return new Promise((N,_)=>{b.addEventListener("load",N),b.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${g}`)))})}))}function f(p){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=p,window.dispatchEvent(m),!m.defaultPrevented)throw p}return c.then(p=>{for(const m of p||[])m.status==="rejected"&&f(m.reason);return o().catch(f)})},Qp=n=>{let o;const i=new Set,r=(g,x)=>{const S=typeof g=="function"?g(o):g;if(!Object.is(S,o)){const b=o;o=x??(typeof S!="object"||S===null)?S:Object.assign({},o,S),i.forEach(N=>N(o,b))}},c=()=>o,m={setState:r,getState:c,getInitialState:()=>y,subscribe:g=>(i.add(g),()=>i.delete(g))},y=o=n(r,c,m);return m},Kb=(n=>n?Qp(n):Qp),Vb=n=>n;function Yb(n,o=Vb){const i=or.useSyncExternalStore(n.subscribe,or.useCallback(()=>o(n.getState()),[n,o]),or.useCallback(()=>o(n.getInitialState()),[n,o]));return or.useDebugValue(i),i}const Zp=n=>{const o=Kb(n),i=r=>Yb(o,r);return Object.assign(i,o),i},$h=(n=>n?Zp(n):Zp),Xb=["default","gpt","claude","gemini","grok"];function Jp(n){return Array.isArray(n.images)}function Qb(n){let o="message";const i=[];for(const c of n.split(`
|
|
11
|
+
`))c.startsWith("event:")&&(o=c.slice(6).trim()),c.startsWith("data:")&&i.push(c.slice(5).trimStart());if(i.length===0)return null;const r=i.join(`
|
|
12
|
+
`);return!r||r==="[DONE]"?null:{event:o,data:JSON.parse(r)}}async function Zb(n,o={}){const i=await fetch("/api/node/generate",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(n)});if(!(i.headers.get("content-type")??"").includes("text/event-stream")){const y=await i.json().catch(()=>({}));if(!i.ok){const g=y,x=g?.error?.message??`Request failed: ${i.status}`,S=new Error(x);throw S.code=g?.error?.code,S.status=g?.status??i.status,S}return y}if(!i.ok||!i.body)throw new Error(`Request failed: ${i.status}`);const c=i.body.getReader(),f=new TextDecoder;let p="",m=null;for(;;){const{done:y,value:g}=await c.read();if(y)break;p+=f.decode(g,{stream:!0});let x=p.indexOf(`
|
|
13
|
+
|
|
14
|
+
`);for(;x!==-1;){const S=p.slice(0,x);p=p.slice(x+2);const b=Qb(S);if(b){if(b.event==="partial")o.onPartial?.(b.data);else if(b.event==="phase")o.onPhase?.(b.data);else if(b.event==="done")m=b.data;else if(b.event==="error"){const N=b.data,_=N?.error?.message??"Node generation failed",M=new Error(_);throw M.code=N?.error?.code,M.status=N?.status,M}}x=p.indexOf(`
|
|
15
|
+
|
|
16
|
+
`)}}if(!m){const y=new Error("No image data returned from the node stream");throw y.code="EMPTY_RESPONSE",y.status=422,y}return m}async function be(n,o){const i=await fetch(n,o),r=await i.json().catch(()=>({}));if(!i.ok){const c=r.error,f=r.code,p=typeof c=="string"?c:c?.message??`Request failed: ${i.status}`,m=new Error(p);throw m.status=i.status,typeof c!="string"&&c?.code?m.code=c.code:f&&(m.code=f),typeof r.currentVersion=="number"&&(m.currentVersion=r.currentVersion),m}return r}function Wh(n){const o=new URLSearchParams;n?.kind&&o.set("kind",n.kind),n?.sessionId&&o.set("sessionId",n.sessionId),n?.includeTerminal&&o.set("includeTerminal","1");const i=o.size>0?`?${o.toString()}`:"";return be(`/api/inflight${i}`)}function ou(n){return be(`/api/inflight/${encodeURIComponent(n)}`,{method:"DELETE"})}function Jb(){return be("/api/oauth/status")}function $b(){return be("/api/billing")}function Wb(n){return be("/api/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}function eg(n){let o=null;const i=[];for(const c of n.split(`
|
|
17
|
+
`))c.startsWith("event:")&&(o=c.slice(6).trim()),c.startsWith("data:")&&i.push(c.slice(5).trimStart());if(i.length===0)return null;const r=i.join(`
|
|
18
|
+
`);return!r||r==="[DONE]"?null:{event:o,data:JSON.parse(r)}}async function eS(n,o={},i={}){const r=await fetch("/api/generate/multimode",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(n),signal:i.signal});if(!(r.headers.get("content-type")??"").includes("text/event-stream")){const g=await r.json().catch(()=>({}));if(!r.ok){const x=g,S=new Error(x.error??`Request failed: ${r.status}`);throw S.code=x.code,S.status=x.status??r.status,S}return g}if(!r.ok||!r.body)throw new Error(`Request failed: ${r.status}`);const f=r.body.getReader(),p=new TextDecoder;let m="",y=null;for(;;){const{done:g,value:x}=await f.read();if(g)break;m+=p.decode(x,{stream:!0});let S=m.indexOf(`
|
|
19
|
+
|
|
20
|
+
`);for(;S!==-1;){const b=m.slice(0,S);m=m.slice(S+2);const N=eg(b);if(N){if(N.event==="partial")o.onPartial?.(N.data);else if(N.event==="image")o.onImage?.(N.data);else if(N.event==="phase")o.onPhase?.(N.data);else if(N.event==="done")y=N.data;else if(N.event==="error"){const _=N.data,M=new Error(_.error??"Multimode generation failed");throw M.code=_.code,M.status=_.status,M}}S=m.indexOf(`
|
|
21
|
+
|
|
22
|
+
`)}}if(!y){const g=new Error("No image data returned from the multimode stream");throw g.code="EMPTY_RESPONSE",g.status=422,g}if(!Array.isArray(y.images)||y.images.length===0){const g=new Error("No image data returned from the multimode stream");throw g.code="EMPTY_RESPONSE",g.status=422,g}return y}function u_(n){return be("/api/edit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}let Ti=null;function tg(){if(!Ti){const n=localStorage.getItem("ima2.browserId");n?Ti=n:(Ti=`${Date.now().toString(36)}_${Math.random().toString(36).slice(2,9)}`,localStorage.setItem("ima2.browserId",Ti))}return Ti}function Al(n,o){const i={...o?.headers,"X-Ima2-Browser-Id":tg()};return be(n,{...o,headers:i})}function Nl(n={}){const o=new URLSearchParams;return o.set("limit",String(n.limit??50)),n.since!=null&&o.set("since",String(n.since)),n.cursor&&(o.set("before",String(n.cursor.before)),o.set("beforeFilename",n.cursor.beforeFilename)),n.sessionId&&o.set("sessionId",n.sessionId),n.favoritesOnly&&o.set("favoritesOnly","1"),Al(`/api/history?${o.toString()}`)}function tS(n={}){const o=new URLSearchParams;return o.set("groupBy","session"),o.set("limit",String(n.limit??200)),n.cursor&&(o.set("before",String(n.cursor.before)),o.set("beforeFilename",n.cursor.beforeFilename)),n.sessionId&&o.set("sessionId",n.sessionId),Al(`/api/history?${o.toString()}`)}function aS(n){return Al("/api/history/favorite",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filename:n})})}async function nS(){return(await be("/api/storage/status")).data}function lS(){return be("/api/storage/open-generated-dir",{method:"POST"})}function $p(n){return be(`/api/history/${encodeURIComponent(n)}`,{method:"DELETE"})}function iS(n){return be(`/api/history/${encodeURIComponent(n)}/permanent`,{method:"DELETE"})}function oS(n,o){return be(`/api/history/${encodeURIComponent(n)}/restore`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({trashId:o})})}function rS(n){return be("/api/comfy/export-image",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filename:n.filename})})}function sS(n){return be("/api/metadata/read",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}function d_(n){return Al(`/api/annotations/${encodeURIComponent(n)}`)}async function f_(n,o){await Al(`/api/annotations/${encodeURIComponent(n)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({annotations:o})})}async function m_(n){await Al(`/api/annotations/${encodeURIComponent(n)}`,{method:"DELETE"})}function p_(n){const o=new URLSearchParams({sourceFilename:n.sourceFilename});return be(`/api/canvas-versions?${o.toString()}`,{method:"POST",headers:{"Content-Type":"image/png"},body:n.image})}function h_(n,o){const i=new URLSearchParams;o.sourceFilename&&i.set("sourceFilename",o.sourceFilename);const r=i.size>0?`?${i.toString()}`:"";return be(`/api/canvas-versions/${encodeURIComponent(n)}${r}`,{method:"PUT",headers:{"Content-Type":"image/png"},body:o.image})}function cS(){return be("/api/sessions")}function uS(n){return be("/api/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:n})})}function ag(n){return be(`/api/sessions/${encodeURIComponent(n)}`)}function dS(n,o){return be(`/api/sessions/${encodeURIComponent(n)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:o})})}function fS(n){return be(`/api/sessions/${encodeURIComponent(n)}`,{method:"DELETE"})}function mS(n,o,i,r,c={}){const f={"Content-Type":"application/json","If-Match":String(o)};return c.saveId&&(f["X-Ima2-Graph-Save-Id"]=c.saveId),c.saveReason&&(f["X-Ima2-Graph-Save-Reason"]=c.saveReason),c.tabId&&(f["X-Ima2-Tab-Id"]=c.tabId),be(`/api/sessions/${encodeURIComponent(n)}/graph`,{method:"PUT",headers:f,body:JSON.stringify({nodes:i,edges:r})})}function pS(n){const o=new URLSearchParams;return be(`/api/prompts?${o.toString()}`)}function hS(n){return be("/api/prompts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}function gS(n){return be(`/api/prompts/${encodeURIComponent(n)}`,{method:"DELETE"})}function yS(n){return be(`/api/prompts/${encodeURIComponent(n)}/favorite`,{method:"POST"})}function vS(n){return be("/api/prompts/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}function g_(n){return be("/api/prompts/import/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}function y_(n){return be("/api/prompts/import/commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}function v_(){return be("/api/prompts/import/curated-sources")}function b_(n){return be("/api/prompts/import/curated-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}function S_(n){return be("/api/prompts/import/curated-refresh",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}function x_(n){const o=new URLSearchParams,i=o.size>0?`?${o.toString()}`:"";return be(`/api/prompts/import/discovery${i}`)}function T_(n){return be("/api/prompts/import/discovery-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({q:n.q,seeds:n.seeds,limit:n.limit})})}function N_(n){return be("/api/prompts/import/discovery-review",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}function __(n){return be("/api/prompts/import/folder-files",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:{kind:"github-folder",input:n.source.input}})})}function E_(n){return be("/api/prompts/import/folder-preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:{kind:"github-folder",input:n.source.input},paths:n.paths})})}async function bS(n){const o=await n.arrayBuffer(),i=await fetch("/api/history/import-local",{method:"POST",headers:{"Content-Type":n.type||"image/png","X-Ima2-Original-Filename":encodeURIComponent(n.name)},body:o});if(!i.ok){let c={};try{c=await i.json()}catch{}const f=new Error(c.error||`Import failed (${i.status})`);throw f.code=c.code||"IMPORT_FAILED",f}return(await i.json()).item}function A_(n){return be("/api/prompt-builder/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async function Wp(n,o={},i={}){const r=await fetch("/api/video/generate",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify({provider:"grok",...n}),signal:i.signal});if(!(r.headers.get("content-type")??"").includes("text/event-stream")){const x=await r.json().catch(()=>({})),S=new Error(x.error??`Request failed: ${r.status}`);throw S.code=x.code,S.status=x.status??r.status,S}if(!r.ok||!r.body)throw new Error(`Request failed: ${r.status}`);const f=r.body.getReader(),p=new TextDecoder;let m="",y=null;for(;;){const{done:g,value:x}=await f.read();if(g)break;m+=p.decode(x,{stream:!0});let S=m.indexOf(`
|
|
23
|
+
|
|
24
|
+
`);for(;S!==-1;){const b=m.slice(0,S);m=m.slice(S+2);const N=eg(b);if(N){if(N.event==="planning")o.onPlanning?.();else if(N.event==="submitted")o.onSubmitted?.(N.data);else if(N.event==="progress")o.onProgress?.(N.data);else if(N.event==="done")y=N.data;else if(N.event==="error"){const _=N.data,M=new Error(_.error??"Video generation failed");throw M.code=_.code,M.status=_.status,M}}S=m.indexOf(`
|
|
25
|
+
|
|
26
|
+
`)}}if(!y){const g=new Error("No video returned from the stream");throw g.code="EMPTY_RESPONSE",g.status=422,g}return y}function SS(n){return new Promise((o,i)=>{const r=new FileReader;r.onload=()=>o(String(r.result)),r.onerror=()=>i(r.error),r.readAsDataURL(n)})}function xS(n,o=256){return new Promise(i=>{const r=new Image;r.onload=()=>{const c=Math.min(1,o/Math.max(r.width,r.height)),f=document.createElement("canvas");f.width=r.width*c,f.height=r.height*c;const p=f.getContext("2d");if(!p)return i(n);p.drawImage(r,0,0,f.width,f.height),i(f.toDataURL("image/jpeg",.6))},r.onerror=()=>i(n),r.src=n})}const TS={maxB64Bytes:6e6,preserveTransparency:!1,maxEdge:4096,qualityLadder:[.85,.7,.55]},eh=16777216;function th(n,o,i){let r=n,c=o;if(r<=0||c<=0)return{w:1,h:1};const f=Math.max(r,c);if(f>i){const p=i/f;r=Math.round(r*p),c=Math.round(c*p)}if(r*c>eh){const p=Math.sqrt(eh/(r*c));r=Math.max(1,Math.floor(r*p)),c=Math.max(1,Math.floor(c*p))}return{w:r,h:c}}function rr(n){return new Promise((o,i)=>{const r=new FileReader;r.onload=()=>{typeof r.result=="string"?o(r.result):i(new Error("FileReader returned non-string"))},r.onerror=()=>i(r.error??new Error("FileReader failed")),r.readAsDataURL(n)})}function ru(n,o,i){return new Promise((r,c)=>{n.toBlob(f=>f?r(f):c(new Error("canvas.toBlob returned null")),o,i)})}function sr(n){const o=n.indexOf(",");return o<0?n.length:n.length-o-1}async function bu(n,o={}){const i={...TS,...o},r=await rr(n);if(sr(r)<=i.maxB64Bytes)return r;let c;try{c=await createImageBitmap(n)}catch(f){throw new Error("이미지 디코드 실패. JPEG/PNG로 변환 후 다시 시도해 주세요.",{cause:f})}try{const{w:f,h:p}=th(c.width,c.height,i.maxEdge),m=document.createElement("canvas");m.width=f,m.height=p;const y=m.getContext("2d");if(!y)throw new Error("canvas 2d context unavailable");if(y.drawImage(c,0,0,f,p),i.preserveTransparency){const x=await ru(m,"image/png"),S=await rr(x);if(sr(S)>i.maxB64Bytes)throw new Error("이미지 압축 실패. JPEG/PNG로 미리 변환 후 다시 시도해 주세요.");return S}for(const x of i.qualityLadder){const S=await ru(m,"image/jpeg",x),b=await rr(S);if(sr(b)<=i.maxB64Bytes)return b}const g=th(f,p,2048);m.width=g.w,m.height=g.h,y.drawImage(c,0,0,g.w,g.h);for(const x of[.7,.5,.35]){const S=await ru(m,"image/jpeg",x),b=await rr(S);if(sr(b)<=i.maxB64Bytes)return b}throw new Error("이미지 압축 실패. JPEG/PNG로 미리 변환 후 다시 시도해 주세요.")}finally{c.close?.()}}function cr(n){const o=(n.type||"").toLowerCase();if(o.includes("heic")||o.includes("heif"))return!0;const i=(n.name||"").toLowerCase();return i.endsWith(".heic")||i.endsWith(".heif")}function ah(n){return(n.type||"").toLowerCase()==="image/png"}const NS={ok:"확인",cancel:"취소",delete:"삭제",close:"닫기",saving:"저장 중...",loading:"불러오는 중..."},_S={modeImage:"이미지",settings:"설정",controls:"생성 옵션",generate:"생성",generateAria:"이미지 생성을 위한 프롬프트 시트 열기"},ES={close:"프롬프트 시트 닫기",generate:"이미지 생성",controlsOpen:"생성 옵션 열기",tabs:{prompt:"프롬프트",controls:"옵션",library:"라이브러리"}},AS={localImportSuccess:"이미지가 갤러리에 추가됐어요",localImportFailed:"이미지 가져오기 실패",localImportInvalid:"PNG, JPEG, WebP만 지원해요",localStorageFull:"로컬 저장소가 가득 차서 최근 상태가 저장되지 않을 수 있습니다.",refLimitExceeded:"참조 이미지는 최대 5장까지 추가할 수 있습니다. 초과한 이미지는 제외되었습니다.",refTooLarge:"이미지가 너무 큽니다. JPEG/PNG로 미리 변환하거나 해상도를 낮춰 다시 시도해 주세요.",refNotBase64:"이미지 파일이 손상되었거나 지원하지 않는 형식입니다.",refEmpty:"빈 이미지 파일입니다. 다른 파일을 선택해 주세요.",refHeicUnsupported:"HEIC/HEIF는 지원하지 않습니다. JPEG 또는 PNG로 변환 후 다시 시도해 주세요.",noCurrentImageForRef:"참조로 사용할 현재 이미지가 없습니다.",refSlotFull:"참조 이미지 슬롯이 가득 찼습니다. 최대 5장까지 가능합니다.",currentImageLoadFailed:"현재 이미지를 불러오지 못했습니다.",addedCurrentAsRef:"현재 이미지를 참조에 추가했습니다.",sessionLoadFailed:"세션을 불러오지 못했습니다.",sessionCreateFailed:"세션을 만들지 못했습니다.",sessionRenameFailed:"세션 이름을 바꾸지 못했습니다.",sessionDeleteFailed:"세션을 삭제하지 못했습니다.",promptRequired:"프롬프트를 입력하세요.",nodeCreated:"노드 {id} 생성 완료 ({elapsed}초)",nodeRootCreated:"이 이미지를 첫 노드로 만들었습니다.",animateStarted:"이미지를 비디오로 변환 중…",animateProgress:"비디오 렌더링 중… {n}%",animateDone:"비디오가 준비됐어요. 히스토리를 확인하세요.",animateFailed:"비디오 생성에 실패했습니다.",nodeCreateFailed:"노드 생성에 실패했습니다.",generatedBatch:"{count}장을 {elapsed}초 만에 생성했습니다.",generatedSingle:"{elapsed}초 만에 생성했습니다.",generateFailed:"생성에 실패했습니다.",sessionReloadedElsewhere:"그래프 버전이 달라져 최신 그래프를 다시 불러왔습니다.",promptCopied:"프롬프트를 복사했습니다",imageCopied:"클립보드에 복사했습니다",frameCopied:"프레임을 클립보드에 복사했습니다",copyFailed:"복사에 실패했습니다",openGeneratedDirFailed:"이미지 폴더를 열지 못했습니다. ima2 doctor로 저장 경로를 확인해 주세요.",openGeneratedDirOpened:"생성 이미지 폴더를 열었습니다.",noPromptToFork:"가져올 프롬프트가 없습니다",forkStarted:"이 이미지의 프롬프트를 가져왔습니다. 수정 후 다시 생성하세요",forkStartedNoPrompt:"이미지를 참조로 첨부했어요. 프롬프트 입력 후 생성하세요",comfyExported:"ComfyUI로 보냈습니다: {filename}",comfyExportInvalidUrl:"ComfyUI URL은 로컬 HTTP 주소여야 합니다.",comfyExportInvalidImage:"이 저장 이미지는 ComfyUI로 보낼 수 없습니다.",comfyExportImageNotFound:"저장된 이미지 파일을 찾지 못했습니다.",comfyExportFailed:"ComfyUI로 이미지를 업로드하지 못했습니다.",cancelFailed:"생성을 취소하지 못했습니다."},CS={queued:"대기 중",planning:"프롬프트 생성 중",streaming:"생성 중",decoding:"마무리 중",canceling:"취소 중",noPrompt:"프롬프트 없음",cancelAria:"생성 취소: {prompt}"},wS={title:"크기",grokAspectTitle:"종횡비",grokResolutionTitle:"해상도",width:"가로",height:"세로",hint:"16px 단위, 최대 변 3840, 비율 3:1 이하, 65.5만-829만 픽셀",autoLabel:"자동",autoSub:"모델 추천",customLabel:"직접 입력",customSub:"자유 설정",customPlus:"+ 직접",customSlots:"저장 크기",customSlot:"커스텀",customSlotLimit:"커스텀 크기는 최대 3개",saveCustomSlot:"커스텀 크기 저장",replaceCustomSlot:"슬롯 교체",ratioFree:"자유",ratio21x9:"21:9",normalizedPreview:"전송 크기",noAdjustment:"조정 없음",squareMaxHint:"829만 픽셀 제한 때문에 정사각형 최대는 {size}입니다.",adjustedReasons:{snap:"16px 보정",maxEdge:"최대 변",ratio:"비율 제한",minPixels:"최소 픽셀",maxPixels:"최대 픽셀",min:"최소 변",max:"최대 변",pixels:"픽셀 제한"}},MS={title:"크기 조정이 필요합니다",body:"입력한 크기가 이미지 생성 제한을 벗어나 자동 조정이 필요합니다.",requested:"요청한 크기",adjusted:"조정될 크기",approve:"승인 후 생성",cancel:"취소",reasonRatio:"비율 제한 3:1을 초과했습니다.",reasonPixels:"최대 픽셀 수 제한을 초과했습니다.",reasonMinPixels:"요청한 이미지의 픽셀 수가 너무 적습니다.",reasonMin:"최소 크기보다 작습니다.",reasonMax:"최대 크기보다 큽니다.",reasonSnap:"16px 단위에 맞춰야 합니다."},RS={title:"품질",grokTitle:"Grok 품질",grokModelTitle:"모델",lowLabel:"낮음",lowSub:"빠름",mediumLabel:"중간",mediumSub:"균형",highLabel:"높음",highSub:"최상"},IS={title:"모더레이션",autoLabel:"자동",autoSub:"표준 필터",lowLabel:"낮음",lowSub:"완화 필터",explain:"자동은 표준 안전 필터를 사용합니다. 낮음은 제한을 조금 완화해 경계선 프롬프트가 더 통과할 수 있습니다."},OS={title:"포맷"},jS={title:"개수",customPlus:"+n",customLabel:"직접 입력 개수",highCountHint:"고품질이나 참조 이미지에서는 시간이 더 걸릴 수 있습니다.",minMaxHint:"1-8장까지 가능합니다.",decrease:"개수 줄이기",increase:"개수 늘리기"},kS={label:"멀티모드",tooltip:"한 프롬프트로 단계별 시퀀스를 생성합니다",shortHint:"단계별 생성",maxStages:"최대 단계",highCountHint:"단계가 많으면 몇 분 걸릴 수 있습니다.",minMaxHint:"1-8단계까지 가능합니다.",composerBadge:"시퀀스 · 최대 {count}장",composerAriaLabel:"멀티모드 프롬프트 입력창, 최대 {count}개의 별도 이미지",promptPlaceholder:"단계별로 만들 장면을 입력하세요. 콜라주가 아니라 별도 이미지로 요청합니다.",promptPlaceholderWithRefs:"첨부한 참조를 바탕으로 단계별 시퀀스를 입력하세요.",toggleDisabledGenerating:"현재 생성이 끝난 뒤 변경할 수 있습니다",sequenceTitle:"멀티모드 시퀀스",sequenceProgress:"{returned}/{requested}장",stageLabel:"{index}단계",generating:"생성 중...",partialAlt:"멀티모드 중간 미리보기",partial:"{requested}장 중 {returned}장을 {elapsed}초 만에 생성했습니다.",complete:"{requested}장 중 {returned}장을 {elapsed}초 만에 생성했습니다.",notReturned:"반환되지 않음",empty:"반환된 이미지 없음",error:"생성 실패",canceled:"취소됨",cancel:"취소"},zS={restoreTitle:"이미지 설정 복원",restoreBody:"이 이미지에 ima2 생성 정보가 있습니다. 프롬프트와 설정을 적용하거나 참조 이미지만 추가할 수 있습니다.",applySettings:"설정 적용",useAsReferenceOnly:"참조만 추가",noMetadata:"ima2 메타데이터가 없습니다.",invalidMetadata:"이미지 메타데이터가 올바르지 않습니다.",unsupportedFormat:"PNG, JPEG, WebP 메타데이터만 복원할 수 있습니다.",readFailed:"메타데이터를 읽지 못했습니다.",applied:"이미지 설정을 복원했습니다.",sourceXmp:"XMP",sourcePngComment:"PNG comment",imageAlt:"드롭한 이미지 미리보기",prompt:"프롬프트",size:"크기",quality:"품질",model:"모델",source:"출처"},DS={title:"생성 준비 상태",open:"준비 상태 확인",openTitle:"프로바이더, 인증, 모델, 웹 검색 준비 상태 확인",settingsTitle:"생성 준비 상태",settingsBody:"프로바이더, 인증, 모델, 추론, 웹 검색 상태를 팝업으로 확인합니다.",ready:"생성 준비 완료",readyBody:"선택한 프로바이더를 사용할 수 있습니다.",blocked:"프로바이더 확인 필요",provider:"프로바이더",model:"모델",reasoning:"추론",webSearch:"웹 검색",grokApi:"Grok API",grokApiBody:"번들된 progrok에서 필수 검색 → grok-4.3 이미지+텍스트 tool planning(영어 프롬프트) → xAI Images API 순서로 실행됩니다. 첨부 레퍼런스는 xAI 이미지 편집으로 보내 i2i 맥락을 보존합니다.",openAccount:"계정 설정 열기"},LS={button:"생성",buttonLoading:"생성 중 ({n})"},GS={label:"API 상태",checking:"확인 중...",offline:"오프라인",remaining:"${remaining} 남음",thisMonth:"이번 달 ${amount}",oauthFree:"GPT OAuth 무료 사용 가능",apiDisabled:"API 키 사용 가능",apiReady:"API 키 사용 가능",oauthMode:"GPT OAuth 모드"},qS={openGalleryAria:"갤러리 열기",openGalleryTitle:"전체 갤러리 열기",openGalleryShort:"전체",galleryCard:"갤러리 열기",recentTitle:"최근 생성",collapseRecent:"최근 생성 접기",expandRecent:"최근 생성 펼치기",collapseRecentShort:"접기",expandRecentShort:"펼치기",emptyRecent:"생성 히스토리가 여기에 표시됩니다.",selectRecent:"생성 히스토리 선택",deleteImageAria:"이미지 기록 삭제",deleteSequenceAria:"{count}장 시퀀스 삭제",deleteSequenceConfirm:"이 멀티모드 시퀀스의 이미지 {count}장을 삭제할까요?",sequenceDeleted:"시퀀스 이미지 {count}장을 히스토리에서 삭제했습니다"},HS={closeSettings:"설정 닫기",detailSettings:"세부 설정",toggleShow:"세부 설정 보기",toggleHide:"세부 설정 숨기기",open:"열기",close:"닫기"},PS={label:"프롬프트",refCount:"참조 {count}/{max}",refChipTitle:"참조 이미지 {n}",refChipAlt:"참조 이미지 {n}",refRemoveAria:"참조 이미지 {n} 제거",placeholder:"원하는 이미지를 설명하고, 드래그 앤 드롭이나 붙여넣기로 참조 이미지를 추가할 수 있어요...",placeholderWithRefs:"첨부한 이미지로 무엇을 만들지 설명해 주세요...",attach:"첨부",attachTitle:"참조 이미지 첨부",useCurrent:"현재 결과 사용",useCurrentTitle:"현재 결과를 참조로 사용",continue:"이어가기",continueTitle:"현재 결과를 참조로 이어서 작업",savePrompt:"저장",storyboard:"스토리보드",storyboardTitle:"스토리보드 모드 — 인물과 장면의 연속성을 유지하며 순차 프레임 생성",videoToggleTitle:"비디오 모드 전환 (Grok 1.5)",directMode:"Direct",directModeActive:"1:1 Direct 켜짐",directModeTitle:"프롬프트를 원문 그대로 전달 (Direct 모드)",moveBlockUp:"{name} 위로 이동",moveBlockDown:"{name} 아래로 이동",afterBlocks:"본문 프롬프트 뒤",hint:"Ctrl + Enter로 생성",dropHere:"놓아서 참조 이미지로 추가 ({max}장까지)"},US={resultAlt:"생성 결과",imageViewerAria:"생성 이미지 뷰어. 좌우 방향키로 이전 또는 다음 이미지를 볼 수 있습니다.",tokens:"{n} 토큰",open:"캔버스 열기",openAria:"캔버스 모드에서 이미지 열기",dragToComposer:"작성창으로 드래그해서 참조 추가",close:"캔버스 닫기",blank:{title:"흰 캔버스",subtitle:"흰 종이에 그린 뒤 여기서 이어가세요.",create:"흰 캔버스 만들기",creating:"만드는 중...",failed:"흰 캔버스를 만들 수 없습니다"},drop:{hint:"이미지를 떨어뜨려 갤러리에 추가"},toolbar:{label:"캔버스 주석 도구",select:"선택",bgGroup:"내보내기 배경",bgAlpha:"투명",bgMatte:"단색",bgMatteColor:"단색 색상",cleanup:"배경 정리",cleanupMark:"표시",cleanupRemove:"제거",cleanupPreserve:"보존",cleanupInput:"입력",cleanupClick:"클릭",cleanupBrush:"브러시",cleanupBrushSize:"브러시",cleanupTolerance:"감도",cleanupAutoSample:"모서리",cleanupPickSeed:"배경 찍기",cleanupPickingSeed:"배경 클릭",cleanupActive:"활성",cleanupPreview:"미리보기",cleanupPreviewing:"미리보기 중...",cleanupApply:"PNG 적용",cleanupApplying:"적용 중...",cleanupReset:"초기화",cleanupSeedCount:"{n}개 seed",cleanupRemoved:"{n}% 제거",cleanupPickHint:"이미지 위 배경을 클릭하세요",cleanupBrushHint:"표시할 영역을 칠하세요",cleanupMaskHint:"보라색 영역이 제거 예정",cleanupApplied:"투명 PNG 생성됨",cleanupFailed:"배경 정리 실패",zoomGroup:"캔버스 확대/축소",zoomIn:"확대",zoomOut:"축소",zoomReset:"확대 초기화",zoomShortcutHint:"핀치 확대 · 두손가락 이동 · [ / ] · 0",pen:"펜",box:"박스",arrow:"화살표",memo:"메모",eraser:"지우개",eraserMenu:"지우개 옵션",objectEraser:"객체 지우개",brushEraser:"브러시 지우개",apply:"캔버스 버전 저장",applyDone:"캔버스 버전 저장됨",applyFailed:"캔버스 버전 저장 실패",export:"이미지 내보내기",exporting:"내보내는 중...",exportFailed:"내보내기 실패",undo:"실행 취소",redo:"다시 실행",deleteSelected:"선택 삭제",editMask:"박스 영역 편집",editMaskDisabled:"먼저 박스를 그려주세요",editMaskFailed:"마스크 편집 실패",editMaskUnsupported:"현재 이미지 제공자는 마스크 편집을 지원하지 않습니다",style:"스타일",color:"색상",strokeWidth:"선 굵기",clear:"모두 지우기"},version:{saving:"캔버스 버전 저장 중...",saved:"캔버스 버전 저장됨",failed:"캔버스 버전 저장 실패",usingAsReference:"캔버스 버전을 참조 이미지로 사용할 수 있습니다"}},BS={today:"오늘",yesterday:"어제",thisWeek:"이번 주",earlier:"이전",imageAltFallback:"생성 이미지",deleteTitle:"시스템 휴지통으로 이동",deleteAria:"이미지 삭제",ariaLabel:"이미지 갤러리",title:"갤러리",total:"총 {n}장",totalFiltered:" / 전체 {n}장",sortByAria:"정렬 기준",sortByDate:"날짜",sortBySession:"세션",favoriteFilterAria:"즐겨찾기 필터",filterAll:"전체",filterFavorites:"즐겨찾기",searchPlaceholder:"프롬프트나 파일명을 검색",searchDisabledPlaceholder:"세션 보기에서는 검색이 비활성화됩니다",closeAria:"갤러리 닫기",closeTitle:"닫기 (Esc)",sessionLabel:"세션 {name}",standalone:"독립 이미지",emptySessions:"아직 저장된 세션이 없습니다.",emptyAll:"아직 생성된 이미지가 없습니다. 먼저 하나 만들어보세요.",emptyFavorites:"아직 즐겨찾기한 이미지가 없습니다.",noResults:"검색 결과가 없습니다.",loadOlder:"이전 이미지 더 불러오기",loadingOlder:"이전 이미지 불러오는 중...",loadOlderFavorites:"이전 즐겨찾기 더 불러오기",loadingOlderFavorites:"이전 즐겨찾기 불러오는 중...",sessionPaginationHint:"세션 보기는 현재 페이지 기준입니다. 이전 이미지를 더 보려면 날짜 보기로 전환해 주세요.",loadOlderFailed:"이전 갤러리 항목을 불러오지 못했습니다.",storageNoticeTitle:"저장 위치 안내",storageNoticeRecoverable:"놀라게 해드려 죄송합니다. 최근 버전에서 갤러리 저장 위치가 설치 폴더에서 사용자 데이터 폴더로 바뀌었습니다. 예전 이미지가 이전 generated 폴더에 남아 있을 수 있어요. ima2 doctor를 실행하거나 복구 안내를 확인해 주세요.",storageNoticeNotFound:"놀라게 해드려 죄송합니다. 현재 이 컴퓨터에서 이전 generated 폴더를 찾지 못했습니다. 업데이트 중 예전 전역 설치 폴더가 교체된 경우 자동 복구가 어려울 수 있습니다. ima2 doctor와 복구 안내의 수동 검색 방법을 확인해 주세요.",storageNoticeUnknown:"저장 위치 상태를 확인하지 못했습니다. 업데이트 후 갤러리가 비어 보인다면 ima2 doctor로 이미지 폴더를 확인해 주세요.",openGeneratedDir:"폴더 열기",openGeneratedDirTitle:"생성 이미지 폴더 열기",cardNewsSet:"카드뉴스 세트",cardNewsCard:"카드뉴스 카드",openCardNewsSet:"세트 열기",openCardNewsSetFailed:"카드뉴스 세트를 열지 못했습니다.",copyCardNewsSetPath:"경로 복사",cardNewsPathCopied:"카드뉴스 세트 경로를 복사했습니다.",downloadCardNewsManifest:"매니페스트",cardNewsCount:"{n}장",deleted:"삭제됨: {filename}",undo:"되돌리기",secondsSuffix:"{n}초",permanentDeleted:"완전 삭제됨: {filename}",movedToSystemTrash:"시스템 휴지통으로 이동됨: {filename}",deleteFailed:"이미지를 삭제하지 못했습니다.",restoreFailed:"이미지를 복구하지 못했습니다.",favoriteTitle:"즐겨찾기 추가",unfavoriteTitle:"즐겨찾기 해제",favoriteAria:"즐겨찾기 추가",unfavoriteAria:"즐겨찾기 해제",scopeAria:"갤러리 범위",scope:{current:"현재 세션",all:"전체 이미지"},empty:{currentSession:"이번 세션에는 아직 이미지가 없습니다."}},FS={empty:"비어 있음",pending:"생성 중",reconciling:"동기화 중",reconcilingPhase:"동기화 중 · {phase}",ready:"완료 · {elapsed}s",readyWithSearch:"완료 · {elapsed}s · 검색 {searches}",stale:"오래된 상태",staleWithError:"오래된 상태: {error}",assetMissing:"에셋 누락",assetMissingWithError:"에셋 누락: {error}",error:"오류: {error}",errorUnknown:"알 수 없음",nodeImageAlt:"노드 이미지",partialImageAlt:"노드 중간 이미지 미리보기",noAsset:"에셋 없음",stateStale:"상태 오래됨",noImage:"이미지 없음",editPromptPlaceholder:"수정 프롬프트...",promptPlaceholder:"프롬프트...",regenerate:"재생성",newVariation:"새 변형",generate:"생성",generateTitle:"노드 이미지 생성",addChild:"자식",addChildTitle:"자식 노드 추가",duplicateBranch:"복제",duplicateBranchTitle:"새 브랜치 루트로 복제",deleteTitle:"삭제",regenerateTitle:"현재 노드 이미지를 제자리에서 다시 생성",newVariationTitle:"같은 부모 아래 새 변형 노드를 생성",parentImageRequired:"부모 이미지를 먼저 생성해야 합니다.",attachRef:"첨부",attachRefTitle:"노드 참조 이미지 첨부",refAlt:"노드 참조 이미지 {n}",removeRef:"참조 이미지 {n} 제거",dropRefs:"이미지를 여기에 놓기",nodeRefsUnsupportedForEdit:"추가 참조 이미지는 현재 루트 노드에서만 지원합니다.",nodeRefsUsedWithParent:"부모 이미지와 함께 참조로 사용됩니다.",classicRefsParkedTitle:"클래식 참조 이미지가 보관 중입니다",classicRefsParkedBody:"이 이미지는 클래식 작성창용이라 노드 모드 생성에는 사용되지 않습니다.",clearParkedRefs:"보관된 참조 비우기"},KS={selectionOn:"선택중",selectionOff:"선택",selectAll:"전체",summary:"선택 {selected} · 미생성 {missing} · 영향 {stale}",generateMissing:"미생성",regenerateSelected:"재생성",stopRemaining:"중단",stopping:"중단중",clear:"해제",noneSelected:"선택된 노드가 없습니다.",parentRequired:"부모 이미지가 준비되지 않은 선택 노드가 {count}개 있습니다.",nothingToRun:"생성할 선택 노드가 없습니다.",stopQueued:"현재 노드가 끝나면 남은 작업을 중단합니다.",failed:"{done}/{total} 완료 후 중단되었습니다.",finished:"{done}/{total} 노드 작업 완료",staleBecauseParentChanged:"상위 노드가 재생성되어 다시 확인이 필요합니다."},VS={disconnect:"끊기",disconnectTitle:"선택한 연결선 끊기",disconnected:"연결선을 끊었습니다.",parentConflict:"한 노드에는 부모 연결을 하나만 둘 수 있습니다."},YS={authTitle:"공급자",apiLabel:"API 키",oauthNotReady:"GPT OAuth 프록시가 아직 준비되지 않았습니다.",codexLoginRequired:"Codex 로그인이 필요합니다.",codexLoginHint:"터미널에서 `codex login`을 실행한 뒤 이 페이지를 새로고침하세요.",oauthStarting:"GPT OAuth 프록시가 시작 중입니다. 몇 초 후 다시 시도하세요.",serverUnreachable:"서버에 연결할 수 없습니다. 백엔드가 실행 중인지 확인하세요.",apiInvalid:"API 키가 없거나 유효하지 않습니다. 서버의 .env 파일에서 OPENAI_API_KEY를 확인하세요.",grokOffline:"Grok 프록시가 실행되지 않고 있습니다.",grokNoImageModel:"Grok 이미지 생성 모델을 찾을 수 없습니다.",grokNotReady:"Grok을 사용할 수 없습니다.",grokOfflineHint:"필요하면 `ima2 grok login`을 한 번 실행한 뒤 `ima2 serve`를 시작하세요. ima2가 번들된 Grok 프록시를 자동으로 띄웁니다.",grokManagedByIma2:"Grok은 `ima2 serve` 안에서 번들된 progrok 프록시(127.0.0.1:18645)로 로컬 실행됩니다.",grokClassicOnly:"이 화면에서는 Grok 이미지 생성을 사용할 수 없습니다.",grokClassicOnlyHint:"Grok이 켜진 생성 화면에서 사용하세요.",grokCompatTitle:"Grok 이미지 API",grokCompatBody:"ima2 serve가 번들된 progrok 프록시(127.0.0.1:18645)를 관리합니다. Grok은 검색을 항상 사용한 뒤 첨부 레퍼런스를 grok-4.3 planner에 함께 보내고, xAI 이미지 편집으로 유지하며, 크기는 xAI aspect ratio/resolution으로 매핑됩니다. 출력 포맷, 모더레이션, 추론은 OpenAI 공급자에서만 설정됩니다.",settingsBody:"앞으로 생성 요청에 사용할 공급자를 선택합니다.",availableTitle:"{name} 사용 가능",availableAria:"{name}: 사용 가능",unavailableAria:"{name}: 사용 불가",availableSr:"(사용 가능)",unavailableSr:"(사용 불가)",xaiApiKeyRequired:"xAI API 키 필요",geminiApiKeyRequired:"Gemini API 키 필요",comingSoon:"준비 중",agyCompatTitle:"Gemini (agy)",agyCompatBody:"1024x1024 고정, JPEG 출력, 최대 3개 참조. 품질/크기 조절 없음.",agyCompatBodyLong:"1024x1024 고정 출력, JPEG 형식, 최대 3개 참조 이미지. 웹 검색, 품질/크기 조절 없음.",gptCompatTitle:"GPT Image",gptCompatBody:"OpenAI Responses API를 통한 이미지 생성. 품질, 크기, 형식, 모더레이션, 웹 검색 설정 지원."},XS={image:"이미지",video:"비디오"},QS={free:"무료",approx:"약 ${amount}",multimodeApprox:"최대 약 ${amount} ({count}장)",label:"예상 비용"},ZS={download:"다운로드",copyImage:"이미지 복사",copyLastFrame:`마지막
|
|
27
|
+
프레임`,copyFirstFrame:`처음
|
|
28
|
+
프레임`,copyMidFrame:`중간
|
|
29
|
+
프레임`,copyPrompt:"프롬프트 복사",continueHere:"여기서 이어서",continueHereTitle:"이 이미지의 프롬프트를 가져와 이어서 작업",animate:"애니메이트",animating:"애니메이트 중…",animateTitle:"이 이미지로 Grok 비디오 생성 (이미지→비디오)",firstNode:"첫 노드",firstNodeTitle:"이 이미지를 Node Mode의 준비된 첫 노드로 보냅니다",delete:"삭제",deleteTitle:"휴지통으로 이동",more:"더보기",sendToComfyUI:"ComfyUI로 보내기",sendToComfyUITitle:"이 저장된 이미지를 로컬 ComfyUI로 업로드",permanentDelete:"완전 삭제",permanentDeleteConfirm:'"{filename}" 이미지를 완전히 삭제할까요? 이 작업은 되돌릴 수 없습니다.'},JS={switchTitle:"세션 전환",loading:"불러오는 중...",newSession:"새 세션",newSessionTitle:"새 세션",renameTitle:"이름 변경",renamePrompt:"세션 이름",deleteTitle:"삭제",deleteConfirm:'"{title}" 세션을 삭제할까요? 이 작업은 되돌릴 수 없습니다.',empty:"아직 세션이 없습니다",firstGraph:"첫 번째 그래프",untitled:"제목 없는 세션",assetAbortedError:"생성이 정상적으로 끝나지 않았습니다. 이 노드에서 다시 시도하세요."},$S={ariaLabel:"UI 모드",classic:"기본",node:"노드",cardNews:"카드뉴스",agent:"에이전트"},WS={workspace:"에이전트 작업공간",title:"에이전트",newSession:"새 에이전트",sessions:"세션",openSessions:"세션 열기",closeSessions:"세션 닫기",sessionSearch:"세션 검색",renameSession:"세션 이름 바꾸기",deleteSession:"세션 삭제",deleteConfirm:'"{title}" 세션을 삭제할까요?',imageCount:"{count}장",compacted:"컴팩트됨",web:"웹",chat:"채팅",user:"사용자",assistant:"에이전트",tool:"도구",toolExpand:"도구 상세 펼치기",toolCollapse:"도구 상세 접기",toolImageCount:"{count}장",toolCallCount:"{count}개 호출",toolGroup:"도구 실행",toolInput:"입력",toolOutput:"출력",toolArtifacts:"결과물",requestId:"요청 ID",duration:"소요 시간",toolStatus:{queued:"대기",running:"실행 중",complete:"완료",error:"오류"},rightSidebar:"에이전트 사이드 도구",sidebarTabs:{image:"이미지",library:"라이브러리",forms:"양식",quality:"품질",model:"모델",queue:"큐"},modelSettings:"모델 설정",closeModelSettings:"모델 설정 닫기",openModelSettings:"모델 설정 열기",model:"모델",provider:"프로바이더",reasoningEffort:"추론",generationStrategy:"생성 계획",generationStrategyAuto:"사용자 요청 기준",generationStrategyManual:"고정 개수",quality:"품질",size:"크기",format:"포맷",moderation:"모더레이션",variantsCount:"변형 수",maxAutoVariants:"자동 최대",parallelism:"병렬 수",promptLibrary:"프롬프트 라이브러리",forms:"양식",noForms:"양식 템플릿이 없습니다",insertPrompt:"삽입",queue:"큐",runningShort:"실행",queuedShort:"대기",queueEmpty:"대기 중인 에이전트 작업이 없습니다.",cancelQueue:"취소",retryQueue:"재시도",sessionRunning:"생성 실행 중",sessionQueued:"{count}개 대기",sessionError:"생성 오류",queueStatus:{queued:"대기",running:"실행 중",succeeded:"완료",failed:"실패",canceled:"취소됨"},statusReady:"준비됨",statusGenerating:"생성 중",statusReconnecting:"연결 복구 중",pending:"이미지를 생성하는 중...",composerPlaceholder:"만들 이미지를 입력하세요",slashCommands:"에이전트 슬래시 명령",slashDesc_question:"이미지 생성 없이 질문",slashDesc_variants:"N개 이미지 변형 생성 (1-8)",slashDesc_generate:"bounded fanout 생성 (1-8)",slashDesc_parallelism:"동시 실행 제한",slashDesc_help:"사용 가능한 명령어 도움말",attachReference:"참조 첨부",send:"전송",webSearch:"검색 사용",emptyChat:"메시지를 입력하면 이미지 작업이 시작됩니다.",imagePane:"이미지",currentImage:"현재 이미지",openImage:"이미지 열기",closeImage:"이미지 닫기",selectImage:"이미지 포커스",variants:"변형",contextTabs:"이미지 컨텍스트",imageTab:"이미지",refsTab:"참조",webTab:"웹 근거",memoryTab:"기억",noImage:"현재 이미지 없음",noRefs:"참조 없음",noWeb:"웹 근거 없음",memoryItemStyle:"스타일 잠금은 이미지 컨텍스트에 보존됩니다.",memoryItemSubject:"피사체 잠금은 재개 후에도 복원됩니다.",imageAlt:"에이전트 이미지",filename:"파일",prompt:"프롬프트"},e0={workspace:"카드뉴스 작업공간",composer:"카드뉴스",composerHint:"템플릿은 스냅샷 기준이고, 출력 크기는 별도로 지정합니다.",topic:"주제",topicPlaceholder:"예: 중간고사 역전 플랜",audience:"대상",audiencePlaceholder:"예: 학부모",goal:"목표",goalPlaceholder:"예: 상담 신청",brief:"내용",briefPlaceholder:"카드뉴스에 들어갈 핵심 내용과 금지사항을 적어주세요.",outputSize:"출력 크기",customSize:"직접",draft:"초안 만들기",drafting:"초안 작성 중...",generateSet:"세트 생성",batchGenerate:"일괄 생성",generating:"생성 중...",generated:"{count}장 생성 완료.",missingGeneratedCard:"생성 응답에 이 카드가 포함되지 않았습니다.",error:"카드 생성에 실패했습니다.",imageTemplate:"이미지 템플릿",roleTemplate:"카드 구조",newTemplateLater:"커스텀 템플릿은 dev MVP 이후에 지원합니다",emptyTitle:"초안 대기 중",emptyBody:"왼쪽 설정으로 카드 덱을 준비합니다.",inspector:"카드 편집",cardTitle:"카드 제목",headline:"제목",body:"본문",visualPrompt:"이미지 프롬프트",summaryCopy:"요약 문구",designPrompt:"장면 / 디자인 프롬프트",textFields:"텍스트 박스",addTextField:"텍스트 박스 추가",removeTextField:"삭제",noTextFields:"아직 텍스트 박스가 없습니다.",textFieldText:"텍스트",textKind:"종류",placement:"위치",renderMode:"표시 방식",hierarchyLabel:"위계",textTooLong:"권장 길이를 초과했습니다.",selectTextField:"텍스트 박스 선택: {text}",textKinds:{headline:"제목",body:"설명 텍스트",caption:"캡션",cta:"행동 유도",badge:"배지",number:"숫자"},renderModes:{"in-image":"이미지에 표시","ui-only":"메모만"},hierarchy:{primary:"주요",secondary:"보조",supporting:"부가"},placements:{"top-left":"좌측 상단","top-center":"상단 중앙","top-right":"우측 상단","center-left":"좌측 중앙",center:"중앙","center-right":"우측 중앙","bottom-left":"좌측 하단","bottom-center":"하단 중앙","bottom-right":"우측 하단",free:"직접 지정"},roles:{cover:"표지",hook:"후킹",problem:"문제",insight:"인사이트",example:"예시",data:"데이터",summary:"요약",cta:"행동 유도"},locked:"잠김",unlocked:"열림",noCard:"선택된 카드 없음",generatedMeta:"생성 메타데이터",lockedHelp:"잠긴 카드는 일괄 생성과 재시도에서 제외됩니다.",retryCard:"이 카드 재시도",actions:{copyPrompt:"프롬프트 복사",copyCopy:"문구 복사",openImage:"이미지 열기",downloadCard:"다운로드"},status:{draft:"초안",queued:"대기",generating:"생성 중",generated:"완료",error:"오류",skipped:"제외",locked:"잠김"},progress:{generating:"생성 중 {done}/{total}",summary:"완료 {done}/{total}",detail:"대기 {queued} · 오류 {errors} · 제외 {skipped}",cardGenerating:"이 카드를 생성 중입니다."},planner:{structured:"구조화 JSON",jsonMode:"JSON 모드",repaired:"보정됨",fallback:"기본 초안",jsonOnlyHelp:"초안은 JSON만 만들고 이미지는 나중에 생성합니다.",error:"초안 생성 실패"}},t0={plannerModelTitle:"플래너 모델",reasoningEffortTitle:"추론 강도",modeLabel:"비디오 모드",mode:{"text-to-video":"텍스트 → 비디오 (참조 이미지 없음)","image-to-video":"이미지 → 비디오 (참조 1장)","reference-to-video":"레퍼런스 → 비디오 (참조 {n}장)"},seriesTopicTitle:"시리즈 주제",seriesTopicPlaceholder:"예: 한국 여행 브이로그",durationTitle:"길이",resolutionTitle:"해상도",aspectTitle:"비율"},a0={appName:"이미지 생성기",imageModelLabel:"모델",imageSectionLabel:"이미지",gptImageSubLabel:"GPT-IMAGE-2",grokImageSubLabel:"Grok Imagine",geminiImageSubLabel:"Gemini",videoSectionLabel:"비디오",imageModelAria:"이미지 모델 선택",quickSettingsAria:"모델과 추론 강도 선택. 현재 모델 {model}, 추론 {effort}",quickSettingsModelOnlyAria:"이미지 모델 선택. 현재 모델 {model}",quickSettingsMenu:"모델 및 추론 빠른 설정",reasoningLabel:"추론",videoModelLabel:"비디오",nodeModeHint:"노드 모드에서는 노드를 눌러 프롬프트를 수정한 뒤 생성하세요. 오른쪽 패널의 설정 (품질/크기)은 새로 만드는 모든 결과에 적용됩니다."},n0={openAria:"설정 열기",openTitle:"설정",closeAria:"설정 닫기",closeTitle:"캔버스로 돌아가기",navAria:"설정 섹션",contentAria:"설정 내용",jumpTo:"{section} 섹션으로 이동",eyebrow:"작업공간 설정",title:"설정",subtitle:"계정, 화면, 앞으로 늘어날 작업공간 옵션을 이곳에 모아 생성 흐름은 가볍게 유지합니다.",sections:{account:{title:"계정",hint:"GPT OAuth 상태"},generation:{title:"생성",hint:"모델 기본값"},appearance:{title:"화면",hint:"라이트/다크"},workspace:{title:"작업공간",hint:"프로필"},language:{title:"언어",hint:"UI 문구"},future:{title:"예정",hint:"확장 공간"}},account:{primaryEyebrow:"현재 공급자",oauthTitle:"GPT OAuth 사용 중",oauthBody:"GPT OAuth 생성은 Codex OAuth 세션으로 실행됩니다. 유효한 키가 설정되어 있으면 API-Key 모드로 전환할 수 있습니다.",apiSourceEnv:"OPENAI_API_KEY 감지됨",apiSourceConfig:"config.json API 키 감지됨",apiTitle:"API 키 공급자 사용 가능",apiBody:"ima2-gen은 이 API 키로 Responses API 기반 생성, 편집, 멀티모드, 노드 요청을 처리할 수 있습니다.",apiDisabled:"사용 불가",apiReady:"준비됨",apiUnavailable:"사용 불가",apiUnknown:"상태 불명",grokEyebrow:"로컬 xAI 프록시",grokTitle:"Grok 이미지 공급자",grokBody:"설정된 로컬 포트의 progrok을 통해 xAI Images API 생성을 사용합니다.",status:{ready:"준비됨",authRequired:"로그인 필요",starting:"시작 중",offline:"오프라인",noImageModel:"이미지 모델 없음",error:"오류",checking:"확인 중"}},quota:{eyebrow:"사용량 쿼타",title:"속도 제한",codexNotLoggedIn:"로그인 필요",fetchError:"쿼타를 불러올 수 없음",noData:"사용량 데이터 없음",grokUsageLink:"Grok 사용량 보기 →"},imageModel:{title:"이미지 모델",body:"앞으로 생성 요청에 사용할 이미지 모델을 선택합니다. Grok 모델을 선택하면 공급자도 Grok으로 전환됩니다.",gpt54Mini:"GPT-5.4 Mini",gpt54:"GPT-5.4",gpt55:"GPT-5.5",grokImagine:"Grok Imagine",grokImagineQuality:"Grok Imagine Quality",nanoBanana2:"Nano Banana 2",nanoBanana2Api:"Nano Banana 2",nanoBananaPro:"나노 바나나 Pro",agy:"Antigravity (agy)",gpt53CodexSpark:"GPT-5.3 Codex Spark — 이미지 생성 미지원",unsupportedHelp:"Grok 모델은 번들된 로컬 프록시를 통해 xAI Images API를 사용합니다. GPT 모델은 OpenAI Responses 이미지 생성을 사용합니다."},apiKeys:{accordionTitle:"API Keys",envSource:"환경 변수에서 로드됨",configSource:"설정 파일에서 로드됨",openai:{label:"GPT API Key (OpenAI)",placeholder:"OpenAI API 키 붙여넣기 (sk-...)"},xai:{label:"Grok API Key (xAI)",placeholder:"xAI API 키 붙여넣기 (xai-...)"},gemini:{label:"Gemini (Google)",placeholder:"Gemini API 키 붙여넣기 (AI...)"},vertex:{label:"Vertex AI (서비스 계정)",placeholder:'Google Cloud 서비스 계정 JSON 붙여넣기 { "type": "service_account", ... }',authModeApiKey:"API Key",authModeVertex:"Vertex JSON"},save:"저장",saved:"저장됨 ✓",saving:"검증 중...",remove:"삭제",status:{valid:"유효",notConfigured:"미설정"}},videoModel:{grokImagine:"Grok Imagine Video",grokImagine15:"Grok Imagine Video 1.5"},reasoning:{title:"추론 강도",body:"값이 높을수록 생성 전에 plan/검색/프롬프트 보강에 더 많은 reasoning 토큰을 사용합니다.",none:"Off — 추가 추론 없음",low:"Low — 가장 빠름, 추론 최소",medium:"Medium — 기본 균형값",high:"High — 더 깊은 리서치와 통합",xhigh:"Xhigh — 최대 추론, 가장 느림"},webSearch:{title:"웹서치",body:"실존 인물, 브랜드, 제품, 장소, 최신 이벤트를 생성 전에 실시간 검색해서 반영합니다.",on:"검색 켬",off:"검색 끔"},grokCompatibility:{title:"Grok 호환성",body:"Grok 이미지 생성은 먼저 필수 웹 검색을 수행하고, 그 다음 텍스트와 첨부 이미지를 함께 보는 image-tool planner가 최종 이미지 프롬프트를 영어로 작성한 뒤 xAI Images API로 실행됩니다. 첨부 레퍼런스는 xAI 이미지 편집 경로로 유지되고, 크기는 aspect ratio/resolution으로 매핑됩니다. 출력 포맷·모더레이션·추론은 GPT OAuth/API 키 공급자에서만 사용됩니다."},grokPlanner:{title:"Grok planner 모델",body:"검색과 이미지/비디오 프롬프트 기획에 사용하는 모델입니다. grok-4.3이 기본값이며 I2V/Ref2V 기획 시 이미지 입력을 지원합니다."},gallery:{defaultScopeTitle:"기본 갤러리 보기",defaultScopeBody:"갤러리를 열 때 처음 보여줄 범위를 선택합니다."},appearance:{themeTitle:"테마",themeBody:"이 기기에서 사용할 테마 스타일과 밝기를 선택합니다.",historyStripLayoutTitle:"히스토리 썸네일",historyStripLayoutBody:"작업공간 옆 작은 히스토리 배열 방식을 고릅니다.",historyStripLayout:{rail:"세로",horizontal:"상단 가로",sidebar:"사이드바"}},language:{title:"언어",body:"생성 프롬프트와 무관하게 인터페이스 언어만 바꿉니다."},future:{title:"나중을 위한 자리",body:"GPT OAuth 복구 도구나 작업공간 옵션이 실제로 필요해지면 이곳에 추가합니다."}},l0={loading:"세션 불러오는 중...",addFirst:"+ 첫 노드 추가",addRootTitle:"루트 노드 추가",hint:"핸들을 빈 공간으로 드래그하면 새 브랜치가 생깁니다. Delete 또는 Backspace로 삭제할 수 있습니다."},i0={title:"{provider} 사용 불가",ariaLabel:"{provider} 사용 불가"},o0={label:"언어",ko:"한국어",en:"English"},r0={label:"테마",modeLabel:"밝기",styleLabel:"테마 스타일",system:"시스템",dark:"다크",light:"라이트",family:{default:"기본",gpt:"GPT",claude:"Claude",gemini:"Gemini",grok:"Grok"}},s0={close:"닫기",details:"자세한 원본 오류 보기",unknown:{title:"알 수 없는 오류가 발생했어요",body:"잠시 후 다시 시도해 주세요. 문제가 계속되면 원본 오류 메시지를 복사해 제보해 주세요."},moderationRefused:{title:"프롬프트가 모더레이션에 걸렸어요",body:"표현 수위를 낮추거나 다른 문구로 바꿔 보세요. 레퍼런스 이미지의 선정적/폭력적 요소도 영향을 줄 수 있어요.",cta:"프롬프트 수정"},emptyResponse:{title:"이미지가 돌아오지 않았어요",body:"Codex가 응답을 보냈지만 이미지 데이터가 비어 있었어요. 모더레이션 문제가 아니라 일시적 오류이거나 지원되지 않는 옵션 조합일 수 있어요. 다시 시도하거나 크기·품질·모델을 바꿔 보세요.",cta:"다시 시도"},streamParseFailed:{title:"이미지 응답 스트림을 해석하지 못했어요",body:"응답 데이터는 도착했지만 앱이 이미지 스트림을 끝까지 읽지 못했어요. 네트워크 프록시나 일시적인 스트림 오류일 수 있어요.",cta:"다시 시도"},imageToolNotCalled:{title:"이미지 도구가 호출되지 않았어요",body:"응답은 완료됐지만 이미지 생성 도구 호출이 확인되지 않았어요. 같은 프롬프트로 다시 시도하거나 모델/검색 옵션을 바꿔 보세요.",cta:"다시 시도"},webSearchOnlyResponse:{title:"이미지 도구가 호출되지 않았어요",body:"웹 검색 도구만 호출되고 이미지 생성 도구가 실행되지 않았어요. 검색 옵션을 끄거나 다시 시도해 주세요.",cta:"다시 시도"},imageToolFailed:{title:"이미지 도구 호출이 실패했어요",body:"이미지 생성 도구가 호출됐지만 실패 상태로 끝났어요. 문제가 반복되면 `ima2 doctor image-probe --json` 결과와 함께 제보해 주세요.",cta:"다시 시도"},imageToolNoResult:{title:"이미지 데이터가 비어 있었어요",body:"이미지 도구 호출은 완료됐지만 결과 이미지가 포함되지 않았어요. 옵션 조합이나 계정 권한 문제일 수 있어요.",cta:"다시 시도"},oauthImageCapabilityUnavailable:{title:"현재 계정에서 이미지 도구를 사용할 수 없는 것 같아요",body:"GPT OAuth 로그인은 되어 있지만, 이 계정/모델 조합에서 이미지 생성 도구 권한이 없을 수 있어요. API-Key 모드나 다른 모델로 확인해 주세요.",cta:"확인"},responsesStreamError:{title:"이미지 응답 스트림이 오류로 종료됐어요",body:"OpenAI 응답 스트림에서 오류 이벤트가 반환됐어요. 잠시 후 다시 시도하고, 반복되면 원본 오류 세부 정보를 확인해 주세요.",cta:"다시 시도"},upstream5xx:{title:"OpenAI 서버가 혼잡합니다",body:"잠시 후 다시 시도하면 대부분 해결돼요. 상태 페이지(status.openai.com)도 확인해 보세요.",cta:"다시 시도"},authChatgptExpired:{title:"Codex ChatGPT 로그인이 만료됐어요",body:"터미널에서 `ima2 setup`을 다시 실행한 뒤(옵션 1) 앱을 새로고침해 주세요.",cta:"새로고침"},authApiKeyInvalid:{title:"API 키 인증 실패",body:"키가 없거나 잘못됐거나, 한도/조직 권한 문제가 있을 수 있어요. GPT OAuth로 전환하거나 설정된 API 키를 갱신해 주세요.",cta:"확인"},networkFailed:{title:"네트워크 연결 실패",body:"OpenAI 또는 로컬 런타임 서비스에 연결하지 못했어요. 먼저 새로고침하고, 계속되면 VPN/방화벽과 `ima2 doctor`에 표시되는 포트를 확인해 주세요.",cta:"새로고침"},oauthUnavailable:{title:"GPT OAuth 프록시를 사용할 수 없어요",body:"GPT OAuth 프록시가 아직 시작 중이거나, 사용할 수 없거나, fallback 포트로 이동했을 수 있어요. 먼저 새로고침하고, 계속되면 `ima2 doctor`의 GPT OAuth URL을 확인해 주세요.",cta:"새로고침"},invalidRequest:{title:"이미지 요청을 수정해야 해요",body:"생성 요청의 일부 값이 올바르지 않습니다. 아래 원본 오류를 확인한 뒤 프롬프트나 크기를 수정해 다시 시도해 주세요.",cta:"입력 수정"},apikeyDisabled:{title:"API-Key 모드를 사용할 수 없어요",body:"이 빌드는 API-Key 생성을 지원하지만 현재 요청에서 설정된 키를 사용할 수 없었습니다. GPT OAuth로 전환하거나 API 키를 갱신해 주세요.",cta:"확인"},agyGenerationFailed:{title:"Gemini 생성 실패",body:"Antigravity CLI에서 오류가 발생했습니다. agy 바이너리가 설치되어 있고 Gemini 계정이 활성화되어 있는지 확인하세요.",cta:"재시도"},agyTimeout:{title:"Gemini 생성 시간 초과",body:"agy 프로세스가 제한 시간(360초) 내에 응답하지 않았습니다. 다시 시도하거나 agy CLI 상태를 확인하세요.",cta:"재시도"},agyProcessError:{title:"Gemini 프로세스 오류",body:"agy CLI가 예기치 않은 오류로 종료되었습니다. 'agy --version'으로 바이너리가 정상인지 확인하세요.",cta:"재시도"},agyQuotaExhausted:{title:"Gemini 할당량 소진",body:"Gemini 이미지 생성 용량이 소진되었습니다. 할당량은 자동으로 리셋됩니다 — 에러 상세에서 리셋 타이머를 확인하세요.",cta:"확인"}},c0={title:"프롬프트 라이브러리",saveTitle:"프롬프트 라이브러리에 저장",save:"저장",saved:"프롬프트를 저장했습니다",saveFailed:"저장에 실패했습니다",name:"이름",tags:"태그",search:"프롬프트 검색...",favorites:"즐겨찾기",load:"불러오기",insert:"삽입",inserted:"프롬프트를 삽입했습니다",removeInserted:"삽입한 프롬프트 {name} 제거",favorite:"즐겨찾기",unfavorite:"즐겨찾기 해제",empty:"저장된 프롬프트가 없어요.",content:"내용",copy:"복사",untitled:"제목 없음",addNew:"새 프롬프트 추가",import:"불러오기",importFiles:".txt, .md, .markdown 또는 GitHub 파일 불러오기",dropImport:".txt, .md, .markdown 파일을 놓으면 프롬프트로 가져옵니다",importTitle:"프롬프트 가져오기",importDropTitle:"파일을 여기에 드래그하세요",importDropHint:".txt, .md, .markdown 파일을 preview한 뒤 저장합니다",importChooseFiles:"파일 선택",importGithubLabel:"GitHub 파일 URL 또는 경로",importPreview:"미리보기",importPreviewEmpty:"파일을 드래그하거나 GitHub 경로를 입력하면 후보가 표시됩니다.",importCommit:"선택 항목 저장",importSelected:"선택한 프롬프트 불러오기 ({count})",importThisPrompt:"이 프롬프트 불러오기",previewPrompt:"내용 보기",selectPrompt:"선택",selectedPrompt:"선택됨",selectedCount:"{count}개 선택됨",selectAllCandidates:"전체 선택",clearCandidateSelection:"선택 해제",addAnotherSource:"다른 소스 추가",searchResultsHeader:"검색 결과 ({count}개)",searchResults:"검색 결과",promptText:"프롬프트 내용",importSelectAtLeastOne:"저장할 프롬프트를 하나 이상 선택하세요.",imported:"프롬프트 {count}개를 가져왔습니다",importFailed:"가져오기에 실패했습니다",importNoValidFiles:".txt, .md, .markdown 프롬프트 파일이 없습니다.",curatedSources:"추천 소스",curatedSourcesHint:"검토된 공개 프롬프트 소스 검색",curatedSearch:"검색",curatedSearchPlaceholder:"nano banana, gpt-image-2, typography...",refreshSource:"갱신",curatedRefreshed:"프롬프트 후보 {count}개를 인덱싱했습니다",sourceTrustTier:"소스 신뢰도",requiresAttribution:"출처 표시 필요",sourceDetails:"출처",license:"라이선스",attributionRequired:"출처 표기 필요",modelHints:"모델 힌트",taskHints:"작업 힌트",warnings:"경고",compatibilityWarnings:"호환성 경고",transparentUnsupportedGptImage2:"gpt-image-2는 투명 배경을 지원하지 않습니다",noCuratedResults:"추천 소스에서 프롬프트 후보를 찾지 못했습니다.",discovery:"발견",discoverySearch:"GitHub 검색",discoverySearchPlaceholder:"프롬프트 저장소 검색...",discoveryCandidates:"발견 후보",discoveryApprove:"승인",discoveryReject:"거절",discoveryApproved:"승인됨",discoveryRejected:"거절됨",discoveryScore:"점수",discoveryWarnings:"발견 경고",discoveryRateLimited:"GitHub discovery가 rate limit에 걸렸습니다.",discoveryNoResults:"발견 후보가 없습니다.",discoveryReviewQueue:"검토 대기열",discoveryRequiresPaths:"기본 검색 전에 검토된 파일 경로를 추가하세요.",folderBrowse:"폴더 보기",folderBrowseHint:"GitHub 폴더의 지원 파일만 불러옵니다",folderFiles:"폴더 파일",folderFilesEmpty:"가져올 수 있는 .md / .markdown / .txt 파일이 없습니다",folderPreviewSelected:"선택 파일 미리보기",folderSelectedCount:"{count}개 선택됨",folderWarnings:"폴더 경고",folderTooManyFiles:"파일이 너무 많아 일부만 표시했습니다",folderNoSelection:"미리볼 파일을 선택하세요",folderUnsupported:"GitHub 폴더만 지원합니다"},u0={title:"프롬프트 빌더",subtitle:"맥락을 이어가며 최종 프롬프트를 정리합니다.",scopeDraft:"새 작업",scopeImage:"선택 이미지: {name}",scopeImageFallback:"현재 이미지",newWorkTitle:"이미지 컨텍스트 없이 새 작업 시작",model:"빌더 모델",empty:"원하는 방향을 말해보세요. 현재 프롬프트와 설정을 함께 참고합니다.",user:"나",assistant:"빌더",placeholder:"어떤 이미지를 만들어볼까요?",send:"전송",sending:"작성 중",thinking:"프롬프트를 정리하는 중...",clear:"비우기",applyToPrompt:"본문에 적용",insertAsBlock:"블록 삽입",finalKoreanPrompt:"한국어 프롬프트",finalEnglishPrompt:"영어 프롬프트",blockName:"빌더 제안",applied:"빌더 제안을 본문 프롬프트에 적용했습니다",inserted:"빌더 제안을 프롬프트 블록으로 삽입했습니다",failed:"프롬프트 빌더 호출에 실패했습니다",removeScopeImage:"빌더에서 선택 이미지 제외",removeAttachment:"첨부 {name} 제거",attach:"파일 첨부",attachmentOnlyMessage:"첨부한 파일을 참고해서 프롬프트를 도와줘"},d0={sectionTitle:"작업 공간",sectionBody:"작업 공간 레이아웃 프로필을 선택합니다.",profileLabel:"작업 공간 프로필",defaultLabel:"기본",defaultDesc:"사이드바 컴포저가 있는 기본 생성 흐름.",promptStudioLabel:"프롬프트 스튜디오",promptStudioDesc:"프롬프트 빌더 패널, 그룹 히스토리, 향상된 뷰어."},f0={controls:"이미지 확대 컨트롤",zoomIn:"확대",zoomOut:"축소",reset:"확대 초기화"},m0={common:NS,appBar:_S,sheet:ES,toast:AS,inflight:CS,size:wS,sizeConfirm:MS,quality:RS,moderation:IS,format:OS,count:jS,multimode:kS,metadata:zS,readiness:DS,generate:LS,billing:GS,history:qS,panel:HS,prompt:PS,canvas:US,gallery:BS,node:FS,nodeBatch:KS,edge:VS,provider:YS,grokMode:XS,cost:QS,result:ZS,session:JS,uiMode:$S,agent:WS,cardNews:e0,video:t0,sidebar:a0,settings:n0,nodeCanvas:l0,apiDisabled:i0,language:o0,theme:r0,errorCard:s0,promptLibrary:c0,promptBuilder:u0,workspace:d0,viewer:f0},p0={ok:"OK",cancel:"Cancel",delete:"Delete",close:"Close",saving:"Saving...",loading:"Loading..."},h0={modeImage:"Image",settings:"Settings",controls:"Generation controls",generate:"Generate",generateAria:"Open prompt sheet to generate an image"},g0={close:"Close prompt sheet",generate:"Generate image",controlsOpen:"Open generation controls",tabs:{prompt:"Prompt",controls:"Controls",library:"Library"}},y0={localImportSuccess:"Image added to gallery",localImportFailed:"Failed to import image",localImportInvalid:"Only PNG, JPEG, or WebP is supported",localStorageFull:"Local storage is full — recent state may not persist.",refLimitExceeded:"References are capped at 5. Extra images were dropped.",refTooLarge:"Image is too large. Convert to JPEG/PNG or lower the resolution and try again.",refNotBase64:"Image file is corrupted or uses an unsupported encoding.",refEmpty:"Empty image file. Please pick a different file.",refHeicUnsupported:"HEIC/HEIF is not supported. Convert to JPEG or PNG and try again.",noCurrentImageForRef:"No current image to use as reference.",refSlotFull:"Reference slots are full (max 5).",currentImageLoadFailed:"Failed to load current image.",addedCurrentAsRef:"Added current image as a reference.",sessionLoadFailed:"Failed to load session.",sessionCreateFailed:"Failed to create session.",sessionRenameFailed:"Failed to rename session.",sessionDeleteFailed:"Failed to delete session.",promptRequired:"Enter a prompt.",nodeCreated:"Node {id} created ({elapsed}s)",nodeRootCreated:"Created a first node from this image.",animateStarted:"Animating image to video…",animateProgress:"Rendering video… {n}%",animateDone:"Video ready. Check your history.",animateFailed:"Video generation failed.",nodeCreateFailed:"Node generation failed.",generatedBatch:"Generated {count} images in {elapsed}s.",generatedSingle:"Generated in {elapsed}s.",generateFailed:"Generation failed.",sessionReloadedElsewhere:"Graph version changed, so the latest graph was reloaded.",promptCopied:"Prompt copied",imageCopied:"Copied to clipboard",frameCopied:"Frame copied to clipboard",copyFailed:"Copy failed",openGeneratedDirFailed:"Could not open the image folder. Run ima2 doctor to check the storage path.",openGeneratedDirOpened:"Opened the generated image folder.",noPromptToFork:"No prompt to fork",forkStarted:"Prompt imported. Edit and generate again.",forkStartedNoPrompt:"Image attached as reference. Type a prompt and generate.",comfyExported:"Sent to ComfyUI as {filename}.",comfyExportInvalidUrl:"ComfyUI URL must be a local HTTP address.",comfyExportInvalidImage:"This saved image cannot be sent to ComfyUI.",comfyExportImageNotFound:"Saved image file was not found.",comfyExportFailed:"Could not upload image to ComfyUI.",cancelFailed:"Could not cancel generation."},v0={queued:"Queued",planning:"Planning",streaming:"Generating",decoding:"Finalizing",canceling:"Canceling",noPrompt:"No prompt",cancelAria:"Cancel generation: {prompt}"},b0={title:"Size",grokAspectTitle:"Aspect Ratio",grokResolutionTitle:"Resolution",width:"Width",height:"Height",hint:"16px steps, max edge 3840, ratio up to 3:1, 655K–8.29M pixels",autoLabel:"Auto",autoSub:"Model pick",customLabel:"Custom",customSub:"Free form",customPlus:"+ Custom",customSlots:"Saved sizes",customSlot:"Custom",customSlotLimit:"Up to 3 custom sizes",saveCustomSlot:"Save custom size",replaceCustomSlot:"Replace slot",ratioFree:"Free",ratio21x9:"21:9",normalizedPreview:"Will send",noAdjustment:"No adjustment",squareMaxHint:"Square maximum is {size} because of the 8.29M pixel limit.",adjustedReasons:{snap:"snapped to 16px",maxEdge:"max edge",ratio:"ratio limit",minPixels:"minimum pixels",maxPixels:"maximum pixels",min:"minimum edge",max:"maximum edge",pixels:"pixel limit"}},S0={title:"Size adjustment required",body:"The requested size is outside the image generation limits.",requested:"Requested size",adjusted:"Adjusted size",approve:"Approve and generate",cancel:"Cancel",reasonRatio:"The ratio exceeds the 3:1 limit.",reasonPixels:"The maximum pixel limit is exceeded.",reasonMinPixels:"The requested image has too few pixels.",reasonMin:"The size is below the minimum.",reasonMax:"The size is above the maximum.",reasonSnap:"The size must align to 16px increments."},x0={title:"Quality",grokTitle:"Grok quality",grokModelTitle:"Model",lowLabel:"Low",lowSub:"Fast",mediumLabel:"Medium",mediumSub:"Balanced",highLabel:"High",highSub:"Best"},T0={title:"Moderation",autoLabel:"Auto",autoSub:"Standard filter",lowLabel:"Low",lowSub:"Relaxed filter",explain:"Auto uses the standard safety filter. Low relaxes limits so borderline prompts may pass through."},N0={title:"Format"},_0={title:"Count",customPlus:"+n",customLabel:"Custom count",highCountHint:"Higher counts can take longer with references or high quality.",minMaxHint:"Use 1–8 images.",decrease:"Decrease count",increase:"Increase count"},E0={label:"Multimode",tooltip:"Generate a staged sequence from one prompt",shortHint:"one prompt sequence",maxStages:"Max stages",highCountHint:"Higher stage counts can take several minutes.",minMaxHint:"Use 1–8 stages.",composerBadge:"Sequence · up to {count}",composerAriaLabel:"Multimode prompt composer, up to {count} separate images",promptPlaceholder:"Describe the sequence. The app will ask for separate images, not a collage.",promptPlaceholderWithRefs:"Describe the staged sequence using the attached references.",toggleDisabledGenerating:"Wait for the current generation to finish",sequenceTitle:"Multimode sequence",sequenceProgress:"{returned}/{requested} images",stageLabel:"Stage {index}",generating:"Generating...",partialAlt:"Partial multimode preview",partial:"Generated {returned}/{requested} images in {elapsed}s.",complete:"Generated {returned}/{requested} images in {elapsed}s.",notReturned:"Not returned",empty:"No image returned",error:"Generation failed",canceled:"Canceled",cancel:"Cancel"},A0={restoreTitle:"Restore image settings",restoreBody:"This image contains ima2 generation metadata. Apply its prompt and settings, or attach it as a reference only.",applySettings:"Apply settings",useAsReferenceOnly:"Reference only",noMetadata:"No ima2 metadata found.",invalidMetadata:"Invalid image metadata.",unsupportedFormat:"Only PNG, JPEG, and WebP metadata can be restored.",readFailed:"Could not read image metadata.",applied:"Image settings restored.",sourceXmp:"XMP",sourcePngComment:"PNG comment",imageAlt:"Dropped image preview",prompt:"Prompt",size:"Size",quality:"Quality",model:"Model",source:"Source"},C0={title:"Generation readiness",open:"Check readiness",openTitle:"Check provider, auth, model, and web-search readiness",settingsTitle:"Generation readiness",settingsBody:"Open a compact popup with provider, auth, model, reasoning, and web-search state.",ready:"Ready to generate",readyBody:"The selected provider is available.",blocked:"Provider needs attention",provider:"Provider",model:"Model",reasoning:"Reasoning",webSearch:"Web search",grokApi:"Grok API",grokApiBody:"Runs through bundled progrok: mandatory search, grok-4.3 image+text tool planning in English, then xAI Images API. Attached references use xAI image editing so i2i context is preserved.",openAccount:"Open account settings"},w0={button:"Generate",buttonLoading:"Generating ({n})"},M0={label:"API Status",checking:"Checking...",offline:"Offline",remaining:"${remaining} remaining",thisMonth:"${amount} this month",oauthFree:"GPT OAuth · free via codex",apiDisabled:"API key ready",apiReady:"API key ready",oauthMode:"GPT OAuth mode"},R0={openGalleryAria:"Open gallery",openGalleryTitle:"Open full gallery",openGalleryShort:"All",galleryCard:"Open gallery",recentTitle:"Recent Generations",collapseRecent:"Collapse recent generations",expandRecent:"Expand recent generations",collapseRecentShort:"Hide",expandRecentShort:"Show",emptyRecent:"Generated images will appear here.",selectRecent:"Select generated image",deleteImageAria:"Delete image from history",deleteSequenceAria:"Delete {count}-image sequence",deleteSequenceConfirm:"Delete all {count} images in this multimode sequence?",sequenceDeleted:"Deleted {count} sequence images from history"},I0={closeSettings:"Close settings",detailSettings:"Settings",toggleShow:"Show settings",toggleHide:"Hide settings",open:"Open",close:"Close"},O0={label:"Prompt",refCount:"Refs {count}/{max}",refChipTitle:"Reference {n}",refChipAlt:"Reference {n}",refRemoveAria:"Remove reference {n}",placeholder:"Describe the image you want. Drag & drop or paste to attach reference images...",placeholderWithRefs:"Describe what to do with the attached images...",attach:"Attach",attachTitle:"Attach reference images",useCurrent:"Use current",useCurrentTitle:"Use current result as a reference",continue:"Continue",continueTitle:"Continue from current result as reference",savePrompt:"Save",storyboard:"Storyboard",storyboardTitle:"Enable storyboard mode — maintains character and scene continuity across sequential frames",videoToggleTitle:"Toggle video mode (Grok 1.5)",directMode:"Direct",directModeActive:"1:1 Direct on",directModeTitle:"Pass prompt through verbatim (Direct mode)",moveBlockUp:"Move {name} up",moveBlockDown:"Move {name} down",afterBlocks:"After main prompt",hint:"Ctrl + Enter to generate",dropHere:"Drop to attach as reference (up to {max})"},j0={resultAlt:"result",imageViewerAria:"Generated image viewer. Use left and right arrow keys to move between images.",tokens:"{n} tokens",open:"Open Canvas",openAria:"Open image in canvas mode",dragToComposer:"Drag to composer as reference",close:"Close Canvas",blank:{title:"Blank canvas",subtitle:"Sketch on white paper, then continue from it.",create:"Create blank canvas",creating:"Creating...",failed:"Could not create blank canvas"},drop:{hint:"Drop image to add to gallery"},toolbar:{label:"Canvas annotation tools",select:"Select",bgGroup:"Export background",bgAlpha:"Alpha",bgMatte:"Matte",bgMatteColor:"Matte color",cleanup:"Clean background",cleanupMark:"Mark",cleanupRemove:"Remove",cleanupPreserve:"Preserve",cleanupInput:"Input",cleanupClick:"Click",cleanupBrush:"Brush",cleanupBrushSize:"Brush",cleanupTolerance:"Tolerance",cleanupAutoSample:"Corners",cleanupPickSeed:"Pick seed",cleanupPickingSeed:"Click background",cleanupActive:"Active",cleanupPreview:"Preview",cleanupPreviewing:"Previewing...",cleanupApply:"Apply PNG",cleanupApplying:"Applying...",cleanupReset:"Reset",cleanupSeedCount:"{n} seeds",cleanupRemoved:"{n}% removed",cleanupPickHint:"Click the background on the image",cleanupBrushHint:"Paint the area to mark",cleanupMaskHint:"Purple mask will be removed",cleanupApplied:"Transparent PNG created",cleanupFailed:"Background cleanup failed",zoomGroup:"Canvas zoom",zoomIn:"Zoom in",zoomOut:"Zoom out",zoomReset:"Reset zoom",zoomShortcutHint:"Pinch zoom · two-finger pan · [ / ] · 0",pen:"Pen",box:"Box",arrow:"Arrow",memo:"Sticky memo",eraser:"Eraser",eraserMenu:"Eraser options",objectEraser:"Object eraser",brushEraser:"Brush eraser",apply:"Save canvas version",applyDone:"Canvas version saved",applyFailed:"Could not save canvas version",export:"Export image",exporting:"Exporting...",exportFailed:"Export failed",undo:"Undo",redo:"Redo",deleteSelected:"Delete selected",editMask:"Edit boxed areas",editMaskDisabled:"Draw a box first",editMaskFailed:"Masked edit failed",editMaskUnsupported:"Masked edit is not supported by the current image provider",style:"Style",color:"Color",strokeWidth:"Stroke width",clear:"Clear all"},version:{saving:"Saving canvas version...",saved:"Canvas version saved",failed:"Could not save canvas version",usingAsReference:"Canvas version is ready as a reference"}},k0={today:"Today",yesterday:"Yesterday",thisWeek:"This week",earlier:"Earlier",imageAltFallback:"Generated image",deleteTitle:"Move to system trash",deleteAria:"Delete image",ariaLabel:"Image gallery",title:"Gallery",total:"{n} total",totalFiltered:" / {n} total",sortByAria:"Sort by",sortByDate:"Date",sortBySession:"Session",favoriteFilterAria:"Favorite filter",filterAll:"All",filterFavorites:"Favorites",searchPlaceholder:"Search prompts or filenames",searchDisabledPlaceholder:"Search is disabled in session view",closeAria:"Close gallery",closeTitle:"Close (Esc)",sessionLabel:"Session {name}",standalone:"Standalone images",emptySessions:"No sessions saved yet.",emptyAll:"No images yet. Create one first.",emptyFavorites:"No favorite images yet.",noResults:"No results.",loadOlder:"Load older",loadingOlder:"Loading older...",loadOlderFavorites:"Load older favorites",loadingOlderFavorites:"Loading older favorites...",sessionPaginationHint:"Session view uses the current page. Switch to Date view to load older images.",loadOlderFailed:"Could not load older gallery items.",storageNoticeTitle:"Storage notice",storageNoticeRecoverable:"Sorry for the scare. Recent versions moved the gallery folder from the installed package to your user data folder. Your old images may still be in the previous generated folder. Run ima2 doctor or open the recovery guide.",storageNoticeNotFound:"Sorry for the scare. We could not find a previous generated folder on this machine. If the old global install folder was replaced during update, automatic recovery may not be possible. Run ima2 doctor and check the recovery guide for manual search steps.",storageNoticeUnknown:"Storage status could not be checked. If the gallery looks empty after an update, run ima2 doctor to inspect the image folder.",openGeneratedDir:"Open folder",openGeneratedDirTitle:"Open generated image folder",cardNewsSet:"Card News set",cardNewsCard:"Card News card",openCardNewsSet:"Open set",openCardNewsSetFailed:"Could not open the Card News set.",copyCardNewsSetPath:"Copy path",cardNewsPathCopied:"Card News set path copied.",downloadCardNewsManifest:"Manifest",cardNewsCount:"{n} cards",deleted:"Deleted: {filename}",undo:"Undo",secondsSuffix:"{n}s",permanentDeleted:"Permanently deleted: {filename}",movedToSystemTrash:"Moved to system trash: {filename}",deleteFailed:"Could not delete image.",restoreFailed:"Could not restore image.",favoriteTitle:"Add to favorites",unfavoriteTitle:"Remove from favorites",favoriteAria:"Add to favorites",unfavoriteAria:"Remove from favorites",scopeAria:"Gallery scope",scope:{current:"Current session",all:"All images"},empty:{currentSession:"No images in this session yet."}},z0={empty:"Empty",pending:"Generating",reconciling:"Syncing",reconcilingPhase:"Syncing · {phase}",ready:"Done · {elapsed}s",readyWithSearch:"Done · {elapsed}s · searched {searches}",stale:"Stale",staleWithError:"Stale: {error}",assetMissing:"Asset missing",assetMissingWithError:"Asset missing: {error}",error:"Error: {error}",errorUnknown:"unknown",nodeImageAlt:"Node image",partialImageAlt:"Partial node image preview",noAsset:"No asset",stateStale:"State stale",noImage:"No image",editPromptPlaceholder:"Edit prompt...",promptPlaceholder:"Prompt...",regenerate:"Regen",newVariation:"New variant",generate:"Gen",generateTitle:"Generate node image",addChild:"Child",addChildTitle:"Add child node",duplicateBranch:"Branch",duplicateBranchTitle:"Duplicate as a new branch root",deleteTitle:"Delete",regenerateTitle:"Regenerate this node in place",newVariationTitle:"Create a new sibling variant under the same parent",parentImageRequired:"Generate the parent image first.",attachRef:"Attach",attachRefTitle:"Attach node reference images",refAlt:"Node reference {n}",removeRef:"Remove reference {n}",dropRefs:"Drop images here",nodeRefsUnsupportedForEdit:"Extra references are only supported on root nodes for now.",nodeRefsUsedWithParent:"Used together with the parent image.",classicRefsParkedTitle:"Classic references are parked",classicRefsParkedBody:"These images belong to the classic composer and are inactive in node mode.",clearParkedRefs:"Clear parked references"},D0={selectionOn:"Selecting",selectionOff:"Select",selectAll:"Select all",summary:"{selected} selected · {missing} missing · {stale} affected",generateMissing:"Generate missing",regenerateSelected:"Regenerate selected",stopRemaining:"Stop remaining",stopping:"Stopping",clear:"Clear",noneSelected:"No nodes selected.",parentRequired:"{count} selected node(s) need a ready parent image first.",nothingToRun:"No selected nodes need generation.",stopQueued:"The current node will finish, then the remaining queue will stop.",failed:"Stopped after {done}/{total} node(s).",finished:"Finished {done}/{total} node(s).",staleBecauseParentChanged:"An upstream node was regenerated; refresh this node when needed."},L0={disconnect:"Disconnect",disconnectTitle:"Disconnect selected edge",disconnected:"Connection removed.",parentConflict:"A node can only have one parent connection."},G0={authTitle:"Provider",apiLabel:"API Key",oauthNotReady:"GPT OAuth proxy is not ready yet.",codexLoginRequired:"Codex login required.",codexLoginHint:"Run `codex login` in your terminal, then refresh this page.",oauthStarting:"GPT OAuth proxy is starting. Try again in a few seconds.",serverUnreachable:"Cannot reach the server. Make sure the backend is running.",apiInvalid:"API key is missing or invalid. Check OPENAI_API_KEY in the server's .env.",grokOffline:"Grok proxy is not running.",grokNoImageModel:"No Grok image generation model found.",grokNotReady:"Grok is not available.",grokOfflineHint:"Run `ima2 grok login` once if needed, then start `ima2 serve`; ima2 starts the bundled Grok proxy automatically.",grokManagedByIma2:"Grok runs locally inside `ima2 serve` through the bundled progrok proxy at 127.0.0.1:18645.",grokClassicOnly:"Grok image generation is not available in this surface.",grokClassicOnlyHint:"Use a generation surface with Grok enabled.",grokCompatTitle:"Grok image API",grokCompatBody:"ima2 serve manages the bundled progrok proxy at 127.0.0.1:18645. Grok always searches before image generation, sends attached references into the grok-4.3 planner, keeps them through xAI image editing, and maps size to xAI aspect ratio/resolution. Output format, moderation, and reasoning are OpenAI-provider settings only.",settingsBody:"Choose which provider future generation requests use.",availableTitle:"{name} available",availableAria:"{name}: available",unavailableAria:"{name}: unavailable",availableSr:"(available)",unavailableSr:"(unavailable)",xaiApiKeyRequired:"xAI API key required",geminiApiKeyRequired:"Gemini API key required",comingSoon:"Coming soon",agyCompatTitle:"Gemini (agy)",agyCompatBody:"1024x1024 fixed, JPEG output, max 3 refs. No quality/size control.",agyCompatBodyLong:"1024x1024 fixed output, JPEG format, max 3 reference images. No web search, no quality/size control.",gptCompatTitle:"GPT Image",gptCompatBody:"OpenAI image generation via Responses API. Supports quality, size, format, moderation, and web search settings."},q0={image:"Image",video:"Video"},H0={free:"free",approx:"~${amount}",multimodeApprox:"up to ~${amount} ({count})",label:"Est. cost"},P0={download:"Download",copyImage:"Copy image",copyLastFrame:`Last
|
|
30
|
+
Frame`,copyFirstFrame:`First
|
|
31
|
+
Frame`,copyMidFrame:`Mid
|
|
32
|
+
Frame`,copyPrompt:"Copy prompt",continueHere:"Continue here",continueHereTitle:"Import this image's prompt and keep working",animate:"Animate",animating:"Animating…",animateTitle:"Generate a Grok video from this image (image-to-video)",firstNode:"First node",firstNodeTitle:"Send this image to Node Mode as a ready first node",delete:"Delete",deleteTitle:"Move to trash",more:"More",sendToComfyUI:"Send to ComfyUI",sendToComfyUITitle:"Upload this saved image to local ComfyUI",permanentDelete:"Permanently delete",permanentDeleteConfirm:'Permanently delete "{filename}"? This cannot be undone.'},U0={switchTitle:"Switch session",loading:"Loading...",newSession:"New session",newSessionTitle:"New session",renameTitle:"Rename",renamePrompt:"Session name",deleteTitle:"Delete",deleteConfirm:'Delete session "{title}"? This cannot be undone.',empty:"No sessions yet",firstGraph:"My first graph",untitled:"Untitled session",assetAbortedError:"Generation did not finish cleanly. Retry from this node."},B0={ariaLabel:"UI mode",classic:"Classic",node:"Node",cardNews:"Card News",agent:"Agent"},F0={workspace:"Agent workspace",title:"Agent",newSession:"New Agent",sessions:"Sessions",openSessions:"Open sessions",closeSessions:"Close sessions",sessionSearch:"Search sessions",renameSession:"Rename session",deleteSession:"Delete session",deleteConfirm:'Delete "{title}"?',imageCount:"{count} images",compacted:"Compacted",web:"Web",chat:"Chat",user:"User",assistant:"Agent",tool:"Tool",toolExpand:"Show tool details",toolCollapse:"Hide tool details",toolImageCount:"{count} img",toolCallCount:"{count} calls",toolGroup:"Tool run",toolInput:"Input",toolOutput:"Output",toolArtifacts:"Artifacts",requestId:"Request ID",duration:"Duration",toolStatus:{queued:"Queued",running:"Running",complete:"Complete",error:"Error"},rightSidebar:"Agent side tools",sidebarTabs:{image:"Image",library:"Library",forms:"Forms",quality:"Quality",model:"Model",queue:"Queue"},modelSettings:"Model settings",closeModelSettings:"Close model settings",openModelSettings:"Open model settings",model:"Model",provider:"Provider",reasoningEffort:"Reasoning",generationStrategy:"Generation plan",generationStrategyAuto:"Based on user request",generationStrategyManual:"Fixed count",quality:"Quality",size:"Size",format:"Format",moderation:"Moderation",variantsCount:"Variants",maxAutoVariants:"Auto max",parallelism:"Parallelism",promptLibrary:"Prompt library",forms:"Forms",noForms:"No form templates",insertPrompt:"Insert",queue:"Queue",runningShort:"run",queuedShort:"wait",queueEmpty:"No queued Agent work.",cancelQueue:"Cancel",retryQueue:"Retry",sessionRunning:"Generation running",sessionQueued:"{count} queued",sessionError:"Generation error",queueStatus:{queued:"Queued",running:"Running",succeeded:"Done",failed:"Failed",canceled:"Canceled"},statusReady:"Ready",statusGenerating:"Generating",statusReconnecting:"Reconnecting",pending:"Generating image...",composerPlaceholder:"Describe the image to create",slashCommands:"Agent slash commands",slashDesc_question:"Ask a question without generating images",slashDesc_variants:"Generate N image variants (1-8)",slashDesc_generate:"Bounded fanout generation (1-8)",slashDesc_parallelism:"Limit concurrent tool calls",slashDesc_help:"Show available commands",attachReference:"Attach reference",send:"Send",webSearch:"Use search",emptyChat:"Enter a message to start image work.",imagePane:"Image",currentImage:"Current image",openImage:"Open image",closeImage:"Close image",selectImage:"Focus image",variants:"Variants",contextTabs:"Image context",imageTab:"Image",refsTab:"Refs",webTab:"Web",memoryTab:"Memory",noImage:"No current image",noRefs:"No references",noWeb:"No web evidence",memoryItemStyle:"Style locks are retained in image context.",memoryItemSubject:"Subject locks are restored after resume.",imageAlt:"Agent image",filename:"File",prompt:"Prompt"},K0={workspace:"Card News workspace",composer:"Card News",composerHint:"Templates are visual snapshots; output size is set separately.",topic:"Topic",topicPlaceholder:"e.g. Exam comeback plan",audience:"Audience",audiencePlaceholder:"e.g. Parents",goal:"Goal",goalPlaceholder:"e.g. Book a consultation",brief:"Brief",briefPlaceholder:"Describe the card news content, required points, and exclusions.",outputSize:"Output size",customSize:"Custom",draft:"Draft outline",drafting:"Drafting...",generateSet:"Generate set",batchGenerate:"Batch generate",generating:"Generating...",generated:"Generated {count} cards.",missingGeneratedCard:"The generation response did not include this card.",error:"Card generation failed.",imageTemplate:"Image template",roleTemplate:"Card structure",newTemplateLater:"Custom templates are planned after the dev MVP",emptyTitle:"Waiting for a draft",emptyBody:"Use the left setup panel to prepare the card deck.",inspector:"Card inspector",cardTitle:"Card title",headline:"Headline",body:"Body",visualPrompt:"Image prompt",summaryCopy:"Summary copy",designPrompt:"Scene / design prompt",textFields:"Text boxes",addTextField:"Add text box",removeTextField:"Remove",noTextFields:"No text boxes yet.",textFieldText:"Text",textKind:"Kind",placement:"Placement",renderMode:"Render mode",hierarchyLabel:"Hierarchy",textTooLong:"Text exceeds the suggested length.",selectTextField:"Select text box: {text}",textKinds:{headline:"Headline",body:"Supporting text",caption:"Caption",cta:"CTA",badge:"Badge",number:"Number"},renderModes:{"in-image":"In image","ui-only":"UI only"},hierarchy:{primary:"Primary",secondary:"Secondary",supporting:"Supporting"},placements:{"top-left":"Top-left","top-center":"Top-center","top-right":"Top-right","center-left":"Center-left",center:"Center","center-right":"Center-right","bottom-left":"Bottom-left","bottom-center":"Bottom-center","bottom-right":"Bottom-right",free:"Free"},roles:{cover:"Cover",hook:"Hook",problem:"Problem",insight:"Insight",example:"Example",data:"Data",summary:"Summary",cta:"CTA"},locked:"Locked",unlocked:"Unlocked",noCard:"No card selected",generatedMeta:"Generated metadata",lockedHelp:"Locked cards are excluded from batch generation and retry.",retryCard:"Retry this card",actions:{copyPrompt:"Copy prompt",copyCopy:"Copy copy",openImage:"Open image",downloadCard:"Download"},status:{draft:"Draft",queued:"Queued",generating:"Generating",generated:"Done",error:"Error",skipped:"Skipped",locked:"Locked"},progress:{generating:"Generating {done}/{total}",summary:"Done {done}/{total}",detail:"{queued} queued · {errors} errors · {skipped} skipped",cardGenerating:"Generating this card."},planner:{structured:"Structured JSON",jsonMode:"JSON mode",repaired:"Repaired",fallback:"Fallback draft",jsonOnlyHelp:"Draft creates JSON only. Images are generated later.",error:"Draft failed"}},V0={plannerModelTitle:"Planner Model",reasoningEffortTitle:"Reasoning Effort",modeLabel:"Video mode",mode:{"text-to-video":"Text → video (no reference images)","image-to-video":"Image → video (1 reference)","reference-to-video":"Reference → video ({n} references)"},seriesTopicTitle:"Series topic",seriesTopicPlaceholder:"e.g. Korean travel vlog",durationTitle:"Length",resolutionTitle:"Resolution",aspectTitle:"Aspect ratio"},Y0={appName:"Image Generator",imageModelLabel:"Model",imageSectionLabel:"Image",gptImageSubLabel:"GPT-IMAGE-2",grokImageSubLabel:"Grok Imagine",geminiImageSubLabel:"Gemini",videoSectionLabel:"Video",imageModelAria:"Choose image model",quickSettingsAria:"Choose model and reasoning effort. Current model {model}, reasoning {effort}",quickSettingsModelOnlyAria:"Choose image model. Current model {model}",quickSettingsMenu:"Model and reasoning quick settings",reasoningLabel:"Reasoning",videoModelLabel:"Video",nodeModeHint:"In node mode, click a node to edit its prompt and generate. Settings on the right panel (quality/size) apply to every new result."},X0={openAria:"Open settings",openTitle:"Settings",closeAria:"Close settings",closeTitle:"Return to canvas",navAria:"Settings sections",contentAria:"Settings content",jumpTo:"Jump to {section}",eyebrow:"Workspace settings",title:"Settings",subtitle:"Account, display, and future workspace controls live here so the generator stays focused.",sections:{account:{title:"Account",hint:"GPT OAuth status"},generation:{title:"Generation",hint:"Model defaults"},appearance:{title:"Appearance",hint:"Light and dark"},workspace:{title:"Workspace",hint:"Profile"},language:{title:"Language",hint:"Interface copy"},future:{title:"Future",hint:"Reserved"}},account:{primaryEyebrow:"Active provider",oauthTitle:"GPT OAuth is active",oauthBody:"GPT OAuth generation runs through your Codex OAuth session. You can switch to API-key mode when a valid key is configured.",apiSourceEnv:"OPENAI_API_KEY detected",apiSourceConfig:"config.json API key detected",apiTitle:"API key provider available",apiBody:"ima2-gen can use this API key for generation, edit, multimode, and node requests through the Responses API.",apiDisabled:"Unavailable",apiReady:"Ready",apiUnavailable:"Unavailable",apiUnknown:"Status unknown",grokEyebrow:"Local xAI proxy",grokTitle:"Grok image provider",grokBody:"Uses progrok at the configured local port for xAI Images API generation.",status:{ready:"Ready",authRequired:"Login required",starting:"Starting",offline:"Offline",noImageModel:"No image model",error:"Error",checking:"Checking"}},quota:{eyebrow:"Usage quota",title:"Rate limits",codexNotLoggedIn:"Not logged in",fetchError:"Could not load quota",noData:"No usage data",grokUsageLink:"View Grok usage →"},imageModel:{title:"Image model",body:"Choose the image model used for future generations. Selecting a Grok model switches the provider to Grok.",gpt54Mini:"GPT-5.4 Mini",gpt54:"GPT-5.4",gpt55:"GPT-5.5",grokImagine:"Grok Imagine",grokImagineQuality:"Grok Imagine Quality",nanoBanana2:"Nano Banana 2",nanoBanana2Api:"Nano Banana 2",nanoBananaPro:"Nano Banana Pro",agy:"Antigravity (agy)",gpt53CodexSpark:"GPT-5.3 Codex Spark — unsupported for images",unsupportedHelp:"Grok models use xAI's Images API through the bundled local proxy. GPT models use OpenAI Responses image generation."},apiKeys:{accordionTitle:"API Keys",envSource:"Loaded from environment",configSource:"Loaded from config",openai:{label:"GPT API Key (OpenAI)",placeholder:"Paste your OpenAI API key (sk-...)"},xai:{label:"Grok API Key (xAI)",placeholder:"Paste your xAI API key (xai-...)"},gemini:{label:"Gemini (Google)",placeholder:"Paste your Gemini API key (AI...)"},vertex:{label:"Vertex AI (Service Account)",placeholder:'Paste your Google Cloud service account JSON { "type": "service_account", ... }',authModeApiKey:"API Key",authModeVertex:"Vertex JSON"},save:"Save",saved:"Saved ✓",saving:"Validating...",remove:"Remove",status:{valid:"Valid",notConfigured:"Not configured"}},videoModel:{grokImagine:"Grok Imagine Video",grokImagine15:"Grok Imagine Video 1.5"},reasoning:{title:"Reasoning effort",body:"Higher effort spends more reasoning tokens on planning, web search, and prompt enrichment before generating.",none:"Off — no extra reasoning",low:"Low — fastest, minimal reasoning",medium:"Medium — balanced default",high:"High — deeper research and synthesis",xhigh:"Xhigh — maximum reasoning, slowest"},webSearch:{title:"Web search",body:"Use live search before generation for real people, brands, products, places, and recent events.",on:"Search on",off:"Search off"},grokCompatibility:{title:"Grok compatibility",body:"Grok image generation first runs mandatory web search, then sends text and attached images to a local image-tool planner that writes the final image prompt in English. Attached references route through xAI image editing; size is mapped to aspect ratio/resolution. Output format, moderation, and reasoning are only used by GPT OAuth and API key providers."},grokPlanner:{title:"Grok planner model",body:"The model used for search and image/video prompt planning. grok-4.3 is the default and supports image input for I2V/Ref2V planning."},gallery:{defaultScopeTitle:"Default gallery view",defaultScopeBody:"Choose what the gallery shows when you open it."},appearance:{themeTitle:"Theme",themeBody:"Pick a theme style and brightness for this device.",historyStripLayoutTitle:"History thumbnails",historyStripLayoutBody:"Choose how the compact history strip sits beside the workspace.",historyStripLayout:{rail:"Rail",horizontal:"Top row",sidebar:"Sidebar"}},language:{title:"Language",body:"Switch the UI language without changing generated content."},future:{title:"Reserved for later",body:"Future provider repair and workspace controls will appear here when they become useful."}},Q0={loading:"Loading session...",addFirst:"+ Add first node",addRootTitle:"Add root node",hint:"Drag a handle into empty space to branch. Press Delete or Backspace to remove."},Z0={title:"{provider} unavailable",ariaLabel:"{provider} unavailable"},J0={label:"Language",ko:"한국어",en:"English"},$0={label:"Theme",modeLabel:"Brightness",styleLabel:"Theme style",system:"System",dark:"Dark",light:"Light",family:{default:"Default",gpt:"GPT",claude:"Claude",gemini:"Gemini",grok:"Grok"}},W0={close:"Close",details:"Show raw error details",unknown:{title:"An unexpected error occurred",body:"Please try again shortly. If it persists, copy the raw error message below and report it."},moderationRefused:{title:"Prompt blocked by moderation",body:"Soften the wording or rephrase. Sensitive/violent content in reference images can also trigger this.",cta:"Edit prompt"},emptyResponse:{title:"No image was returned",body:"Codex responded but didn't include image data. This isn't a moderation block — it's likely a transient hiccup or an unsupported size/quality/model combination. Retry, or try a different size or model.",cta:"Retry"},streamParseFailed:{title:"Could not parse the image response stream",body:"Response data arrived, but the app could not read the image stream cleanly. This can happen with a proxy or transient stream transport issue.",cta:"Retry"},imageToolNotCalled:{title:"The image tool was not called",body:"The response completed, but no image-generation tool call was observed. Retry the same prompt, or try another model/search setting.",cta:"Retry"},webSearchOnlyResponse:{title:"The image tool was not called",body:"Only web search ran; the image-generation tool did not. Turn off search or retry the request.",cta:"Retry"},imageToolFailed:{title:"The image tool call failed",body:"The image-generation tool was called, but it ended in a failed state. If this repeats, report it with `ima2 doctor image-probe --json` output.",cta:"Retry"},imageToolNoResult:{title:"The image result was empty",body:"The image tool call completed but did not include image data. This can point to an unsupported option combination or account capability issue.",cta:"Retry"},oauthImageCapabilityUnavailable:{title:"This account may not have image-tool access",body:"GPT OAuth is connected, but this account/model combination may not be entitled to use image generation. Compare with API-key mode or another model.",cta:"OK"},responsesStreamError:{title:"The image response stream ended with an error",body:"OpenAI returned an error event inside the response stream. Retry shortly, and check the raw error details if it persists.",cta:"Retry"},upstream5xx:{title:"OpenAI is currently busy",body:"Retrying usually resolves this. Check status.openai.com if it persists.",cta:"Retry"},authChatgptExpired:{title:"Codex ChatGPT session expired",body:"Run `ima2 setup` in your terminal (option 1), then reload this app.",cta:"Reload"},authApiKeyInvalid:{title:"API key authentication failed",body:"The key is missing, invalid, revoked, out of quota, or tied to the wrong org. Switch to GPT OAuth or update the configured API key.",cta:"OK"},networkFailed:{title:"Network connection failed",body:"Could not reach OpenAI or the local runtime service. Reload first; if it persists, check VPN/firewall and the port shown by `ima2 doctor`.",cta:"Reload"},oauthUnavailable:{title:"GPT OAuth proxy unavailable",body:"The GPT OAuth proxy is starting, unavailable, or moved to a fallback port. Reload first; if it persists, run `ima2 doctor` and check the reported GPT OAuth URL.",cta:"Reload"},invalidRequest:{title:"Image request needs changes",body:"One or more generation parameters are invalid. Check the raw error details below, then edit the prompt or size and try again.",cta:"Edit input"},apikeyDisabled:{title:"API-key mode is unavailable",body:"This build supports API-key generation, but the current request could not use a configured key. Switch to GPT OAuth or update the API key.",cta:"OK"},agyGenerationFailed:{title:"Gemini generation failed",body:"The Antigravity CLI returned an error. Check that the agy binary is installed and your Gemini account is active.",cta:"Retry"},agyTimeout:{title:"Gemini generation timed out",body:"The agy process did not respond within the timeout window (360s). Try again or check the agy CLI status.",cta:"Retry"},agyProcessError:{title:"Gemini process error",body:"The agy CLI exited with an unexpected error. Verify the binary is working with 'agy --version'.",cta:"Retry"},agyQuotaExhausted:{title:"Gemini quota exhausted",body:"You have exhausted your Gemini image generation capacity. Your quota will reset automatically — check the reset timer in the error details.",cta:"OK"}},ex={title:"Prompt Library",saveTitle:"Save to Prompt Library",save:"Save",saved:"Prompt saved",saveFailed:"Save failed",name:"Name",tags:"Tags",search:"Search prompts...",favorites:"Favorites",load:"Load",insert:"Insert",inserted:"Prompt inserted",removeInserted:"Remove inserted prompt {name}",favorite:"Favorite",unfavorite:"Unfavorite",empty:"No saved prompts yet.",content:"Content",copy:"Copy",untitled:"Untitled",addNew:"Add new prompt",import:"Import",importFiles:"Import .txt, .md, .markdown, or GitHub files",dropImport:"Drop .txt, .md, or .markdown files to import prompts",importTitle:"Import prompts",importDropTitle:"Drag files here",importDropHint:"Preview .txt, .md, and .markdown files before saving",importChooseFiles:"Choose files",importGithubLabel:"GitHub file URL or path",importPreview:"Preview",importPreviewEmpty:"Drop files or enter a GitHub path to preview candidates.",importCommit:"Save selected",importSelected:"Import selected ({count})",importThisPrompt:"Import this prompt",previewPrompt:"Preview",selectPrompt:"Select",selectedPrompt:"Selected",selectedCount:"{count} selected",selectAllCandidates:"Select all",clearCandidateSelection:"Clear",addAnotherSource:"Add another source",searchResultsHeader:"Search results ({count})",searchResults:"Search results",promptText:"Prompt text",importSelectAtLeastOne:"Select at least one prompt to save.",imported:"Imported {count} prompt(s)",importFailed:"Import failed",importNoValidFiles:"No .txt, .md, or .markdown prompt files found.",curatedSources:"Curated sources",curatedSourcesHint:"Search indexed public prompt sources",curatedSearch:"Search",curatedSearchPlaceholder:"nano banana, gpt-image-2, typography...",refreshSource:"Refresh",curatedRefreshed:"Indexed {count} prompt candidate(s)",sourceTrustTier:"Source trust",requiresAttribution:"Attribution required",sourceDetails:"Source",license:"License",attributionRequired:"Attribution required",modelHints:"Model hints",taskHints:"Task hints",warnings:"Warnings",compatibilityWarnings:"Compatibility warnings",transparentUnsupportedGptImage2:"Transparent background is not supported by gpt-image-2",noCuratedResults:"No curated prompt candidates found.",discovery:"Discovery",discoverySearch:"Search GitHub",discoverySearchPlaceholder:"Search prompt repositories...",discoveryCandidates:"Discovery candidates",discoveryApprove:"Approve",discoveryReject:"Reject",discoveryApproved:"Approved",discoveryRejected:"Rejected",discoveryScore:"Score",discoveryWarnings:"Discovery warnings",discoveryRateLimited:"GitHub discovery is rate limited.",discoveryNoResults:"No discovery candidates found.",discoveryReviewQueue:"Review queue",discoveryRequiresPaths:"Add reviewed file paths before default search.",folderBrowse:"Browse folder",folderBrowseHint:"Loads supported files from a GitHub folder",folderFiles:"Folder files",folderFilesEmpty:"No importable .md, .markdown, or .txt files found.",folderPreviewSelected:"Preview selected files",folderSelectedCount:"{count} selected",folderWarnings:"Folder warnings",folderTooManyFiles:"Too many files; showing a limited set.",folderNoSelection:"Select files to preview.",folderUnsupported:"Only GitHub folders are supported."},tx={title:"Prompt Builder",subtitle:"Refine prompts through multi-turn context.",scopeDraft:"New work",scopeImage:"Selected image: {name}",scopeImageFallback:"Current image",newWorkTitle:"Start a new work without image context",model:"Builder model",empty:"Describe the direction you want. I will include your current prompt and settings as context.",user:"You",assistant:"Builder",placeholder:"What kind of image should we make?",send:"Send",sending:"Writing",thinking:"Refining the prompt...",clear:"Clear",applyToPrompt:"Apply to prompt",insertAsBlock:"Insert block",finalKoreanPrompt:"Korean prompt",finalEnglishPrompt:"English prompt",blockName:"Builder suggestion",applied:"Builder suggestion applied to the main prompt",inserted:"Builder suggestion inserted as a prompt block",failed:"Prompt builder request failed",removeScopeImage:"Remove selected image from builder context",removeAttachment:"Remove attachment {name}",attach:"Attach file",attachmentOnlyMessage:"Use the attached file as context and help with the prompt"},ax={sectionTitle:"Workspace",sectionBody:"Choose a workspace layout profile.",profileLabel:"Workspace profile",defaultLabel:"Default",defaultDesc:"Standard generation workflow with sidebar composer.",promptStudioLabel:"Prompt Studio",promptStudioDesc:"Prompt builder panel, grouped history, and enhanced viewer."},nx={controls:"Image zoom controls",zoomIn:"Zoom in",zoomOut:"Zoom out",reset:"Reset zoom"},lx={common:p0,appBar:h0,sheet:g0,toast:y0,inflight:v0,size:b0,sizeConfirm:S0,quality:x0,moderation:T0,format:N0,count:_0,multimode:E0,metadata:A0,readiness:C0,generate:w0,billing:M0,history:R0,panel:I0,prompt:O0,canvas:j0,gallery:k0,node:z0,nodeBatch:D0,edge:L0,provider:G0,grokMode:q0,cost:H0,result:P0,session:U0,uiMode:B0,agent:F0,cardNews:K0,video:V0,sidebar:Y0,settings:X0,nodeCanvas:Q0,apiDisabled:Z0,language:J0,theme:$0,errorCard:W0,promptLibrary:ex,promptBuilder:tx,workspace:ax,viewer:nx},nh={ko:m0,en:lx};function lh(n,o){return o.split(".").reduce((i,r)=>{if(i!=null)return i[r]},n)}function ix(n,o){return n.replace(/\{(\w+)\}/g,(i,r)=>r in o?String(o[r]):`{${r}}`)}function ee(n,o){const i=E.getState().locale;return ng(i,n,o)}function ng(n,o,i){const r=lh(nh[n],o),c=typeof r=="string"?r:lh(nh.en,o),f=typeof c=="string"?c:o;return i?ix(f,i):f}function ge(){const n=E(o=>o.locale);return{locale:n,t:(o,i)=>ng(n,o,i)}}const C_=["ko","en"];function ox(){try{const n=localStorage.getItem("ima2.locale");if(n==="ko"||n==="en")return n}catch{}return typeof navigator<"u"&&(navigator.language||"").toLowerCase().startsWith("ko")?"ko":"en"}function rx(n){try{localStorage.setItem("ima2.locale",n)}catch{}}function sx(n){return Math.round(n/16)*16}const Cn=16,Ru=3840,su=655360,Er=8294400,cx=3,_l=3,ih=Math.floor(Math.sqrt(Er)/Cn)*Cn,lg=Cn,ux=Ru,ur=cx;function oh(n){return Math.floor(n/16)*16}function Dr(n){return Math.ceil(n/16)*16}function Jt(n){return Math.min(ux,Math.max(lg,n))}function sa(n,o){const i=typeof n=="number"?n:Number.parseInt(n,10);return Number.isFinite(i)?i:o}function Rn(n,o){n.includes(o)||n.push(o)}function rh(n,o){const i=sx(n);return i!==n&&Rn(o,"snap"),i}function sh(n,o){return n<lg&&Rn(o,"min"),n>Ru&&Rn(o,"maxEdge"),Jt(n)}function ch(n,o,i){return n>o*ur?(Rn(i,"ratio"),{w:n,h:Jt(Dr(n/ur))}):o>n*ur?(Rn(i,"ratio"),{w:Jt(Dr(o/ur)),h:o}):{w:n,h:o}}function dx(n,o,i){if(n*o<su){Rn(i,"minPixels");const p=Math.sqrt(su/(n*o));let m=Jt(Dr(n*p)),y=Jt(Dr(o*p));for(;m*y<su;)m<=y?m=Jt(m+Cn):y=Jt(y+Cn);return{w:m,h:y}}if(n*o<=Er)return{w:n,h:o};Rn(i,"maxPixels");const r=Math.sqrt(Er/(n*o));let c=Jt(oh(n*r)),f=Jt(oh(o*r));for(;c*f>Er;)c>=f?c=Jt(c-Cn):f=Jt(f-Cn);return{w:c,h:f}}function Iu(n,o,i,r){const c=[],f=sa(n,i),p=sa(o,r);let m=sh(rh(f,c),c),y=sh(rh(p,c),c);return{w:m,h:y}=ch(m,y,c),{w:m,h:y}=dx(m,y,c),{w:m,h:y}=ch(m,y,c),{requestedW:f,requestedH:p,w:m,h:y,adjusted:m!==f||y!==p,reasons:c}}function ig(n,o,i,r){const c=Iu(n,o,i,r);return{w:c.w,h:c.h}}const fx=[{id:"free",label:"Free",w:0,h:0},{id:"1:1",label:"1:1",w:1,h:1},{id:"3:2",label:"3:2",w:3,h:2},{id:"2:3",label:"2:3",w:2,h:3},{id:"16:9",label:"16:9",w:16,h:9},{id:"9:16",label:"9:16",w:9,h:16},{id:"21:9",label:"21:9",w:21,h:9},{id:"9:21",label:"9:21",w:9,h:21}];function mx(n,o){return`${n}x${o}`}function px(n,o=1024){if(n.id==="free")return null;const i=o,r=n.w>=n.h,c=r?Math.round(i*n.w/n.h):i,f=r?i:Math.round(i*n.h/n.w);return ig(c,f,c,f)}function Hr(n){const o=ig(n.w,n.h,2400,1024);return{...n,w:o.w,h:o.h,label:n.label||`${o.w}×${o.h}`}}function El(n){return n.slice(0,_l).map(Hr)}function hx(n,o){const i=Hr(o),r=n.findIndex(c=>c.id===i.id);return r>=0?El(n.map((c,f)=>f===r?i:c)):n.length>=_l?El(n):El([...n,i])}function gx(n,o,i){const r=Hr({...i,id:o});return El(n.map(c=>c.id===o?r:c))}const yx=[{value:"1024x1024",label:"1024×1024",sub:"1:1"},{value:"1536x1024",label:"1536×1024",sub:"3:2"},{value:"1024x1536",label:"1024×1536",sub:"2:3"}],vx=[{value:"1360x1024",label:"1360×1024",sub:"4:3"},{value:"1024x1360",label:"1024×1360",sub:"3:4"},{value:"1824x1024",label:"1824×1024",sub:"16:9"}],bx=[{value:"1024x1824",label:"1024×1824",sub:"9:16"},{value:"2048x2048",label:"2048×2048",sub:"2K 1:1"},{value:"2048x1152",label:"2048×1152",sub:"2K 16:9"}],Sx=[{value:"1152x2048",label:"1152×2048",sub:"2K 9:16"},{value:"3840x2160",label:"3840×2160",sub:"4K 16:9"},{value:"2160x3840",label:"2160×3840",sub:"4K 9:16"}];function xx(){return[{value:"auto",label:ee("size.autoLabel"),sub:ee("size.autoSub")},{value:"custom",label:ee("size.customLabel"),sub:ee("size.customSub")}]}const Su="gpt-5.4-mini",In=[{value:"gpt-5.4-mini",shortLabel:"5.4m",fullLabelKey:"settings.imageModel.gpt54Mini"},{value:"gpt-5.4",shortLabel:"5.4",fullLabelKey:"settings.imageModel.gpt54"},{value:"gpt-5.5",shortLabel:"5.5",fullLabelKey:"settings.imageModel.gpt55"},{value:"grok-imagine-image",shortLabel:"grok",fullLabelKey:"settings.imageModel.grokImagine"},{value:"grok-imagine-image-quality",shortLabel:"grok+",fullLabelKey:"settings.imageModel.grokImagineQuality"},{value:"nano-banana-2",shortLabel:"nb2 agy",fullLabelKey:"settings.imageModel.nanoBanana2",providerHint:"agy"},{value:"nano-banana-2",shortLabel:"nb2 api",fullLabelKey:"settings.imageModel.nanoBanana2Api",providerHint:"gemini-api"},{value:"nano-banana-pro",shortLabel:"nbp api",fullLabelKey:"settings.imageModel.nanoBananaPro",providerHint:"gemini-api"}],Pr=new Set(["nano-banana-2","nano-banana-pro"]),cu=In.filter(n=>!n.value.startsWith("grok-")&&!Pr.has(n.value)),uh=In.filter(n=>n.value.startsWith("grok-")),Tx=In.filter(n=>Pr.has(n.value)),Nx=[{value:"gpt-5.3-codex-spark",fullLabelKey:"settings.imageModel.gpt53CodexSpark"}];function og(n){return In.some(o=>o.value===n)}function Ar(n){return typeof n=="string"&&n.startsWith("grok-")}function Mi(n){return typeof n=="string"&&Pr.has(n)}function _x(n,o){return n?Pr.has(n)?`${n} ${o==="gemini-api"?"gemini-api":o==="agy"?"agy":o||"agy"}`:In.find(i=>i.value===n)?.shortLabel??n:null}const dr=[{value:"grok-imagine-video",shortLabel:"grokv",fullLabelKey:"settings.videoModel.grokImagine"},{value:"grok-imagine-video-1.5-preview",shortLabel:"grokv1.5",fullLabelKey:"settings.videoModel.grokImagine15"}],rg=10;function sg(n){return n>=2?"reference-to-video":n===1?"image-to-video":"text-to-video"}function Ex(n,o){return o==="reference-to-video"?Math.min(n,rg):n}const Ax="none",Cr=[{value:"none",shortLabel:"off",fullLabelKey:"settings.reasoning.none"},{value:"low",shortLabel:"low",fullLabelKey:"settings.reasoning.low"},{value:"medium",shortLabel:"med",fullLabelKey:"settings.reasoning.medium"},{value:"high",shortLabel:"high",fullLabelKey:"settings.reasoning.high"},{value:"xhigh",shortLabel:"xhigh",fullLabelKey:"settings.reasoning.xhigh"}];function cg(n){return Cr.some(o=>o.value===n)}const Cx={low:"l",medium:"m",high:"h",xhigh:"x"};function wx(n){return!cg(n)||n==="none"?null:`R:${Cx[n]}`}const ft=["ima2.rightPanelOpen","ima2.uiMode","ima2.historyStripLayout","ima2:theme","ima2:themeFamily","ima2.canvas.exportBackground.v1","ima2.imageModel","ima2.reasoningEffort","ima2.webSearchEnabled","ima2.generationDefaults","ima2.inFlight","ima2.selectedFilename","ima2.activeSessionId","ima2.graphTabId","ima2.galleryScope","ima2.galleryDefaultScope","ima2.locale","ima2.workspaceProfile","ima2.workspaceOverrides","ima2.videoDefaults"],ug=ft[0],dg=ft[1],fg=ft[2],mg=ft[3],pg=ft[4],hg=ft[5],gg=ft[6],yg=ft[7],vg=ft[8],bg=ft[9],Sg=ft[10],xu=ft[11],Tu=ft[12],dh=ft[13],uu=ft[14],fh=ft[15],xg=ft[19],Mx=!0,En=()=>"nc_"+Math.random().toString(36).slice(2,10);function mh(n,o){return{x:n*360,y:o*320}}function Rx(n,o){return n.find(i=>i.target===o)??null}function Ix(n,o,i){return n.some(r=>r.target===i&&r.source!==o)}function an(n,o){const i=new Map(n.map(r=>[r.id,r]));return n.map(r=>{const c=Rx(o,r.id),p=(c?i.get(c.source):null)?.data.serverNodeId??null;return r.data.parentServerNodeId===p?r:{...r,data:{...r.data,parentServerNodeId:p}}})}const Ox=360,Tg=320;function jx(n,o,i){const r=new Set(i.filter(c=>c.source===n).map(c=>c.target));return o.filter(c=>r.has(c.id))}function du(n){const o=n.filter(r=>!r.data.parentServerNodeId);if(o.length===0)return mh(0,0);const i=Math.max(...o.map(r=>r.position.y));return{x:mh(0,0).x,y:i+Tg}}function ph(n,o,i){const r=jx(n.id,o,i),c=n.position.x+Ox;if(r.length===0)return{x:c,y:n.position.y};const f=Math.max(...r.map(p=>p.position.y));return{x:c,y:f+Tg}}const Ng="ima2.nodeRefs.v1";function Ou(){try{const n=localStorage.getItem(Ng);if(!n)return{};const o=JSON.parse(n);return o&&typeof o=="object"?o:{}}catch{return{}}}function _g(n){try{localStorage.setItem(Ng,JSON.stringify(n))}catch{}}function kx(n,o){if(!n)return[];const i=Ou()[n]?.[o];return Array.isArray(i)?i.filter(r=>typeof r=="string"):[]}function wr(n,o,i){if(!n)return;const r=Ou(),c={...r[n]??{}};i.length===0?delete c[o]:c[o]=i,r[n]=c,_g(r)}function fu(n,o){wr(n,o,[])}function zx(n,o){if(!n)return;const i=Ou(),r=i[n];if(!r)return;const c=new Set(o);for(const f of Object.keys(r))c.has(f)||delete r[f];i[n]=r,_g(i)}function Dx(n,o,i){const r=new Set(n.map(m=>m.id));if(!r.has(i))return[];const c=new Map;for(const m of r)c.set(m,new Set);for(const m of o)!r.has(m.source)||!r.has(m.target)||(c.get(m.source)?.add(m.target),c.get(m.target)?.add(m.source));const f=new Set,p=[i];for(let m=0;m<p.length;m++){const y=p[m];if(!f.has(y)){f.add(y);for(const g of c.get(y)??[])f.has(g)||p.push(g)}}return n.filter(m=>f.has(m.id)).map(m=>m.id)}function Nu(n){return n.filter(o=>o.selected).map(o=>o.id)}function Ri(n,o){const i=new Set(o);return n.map(r=>({...r,selected:i.has(r.id)}))}function Lx(n,o,i,r){const c=new Set(Dx(n,o,i));if(!c.size)return n;if(!r)return Ri(n,c);const f=n.find(y=>y.id===i),p=n.some(y=>c.has(y.id)&&y.selected),m=new Set(Nu(n));if(p)f?.selected?m.delete(i):m.add(i);else for(const y of c)m.add(y);return Ri(n,m)}function Gx(n){return n.data.status==="ready"&&!!n.data.imageUrl}function qx(n,o,i){const r=new Set(i),c=new Set(n.map(S=>S.id)),f=new Map,p=new Map;for(const S of r)c.has(S)&&(f.set(S,0),p.set(S,[]));for(const S of o)!r.has(S.source)||!r.has(S.target)||(p.get(S.source)?.push(S.target),f.set(S.target,(f.get(S.target)??0)+1));const m=n.map(S=>S.id),y=m.filter(S=>r.has(S)&&(f.get(S)??0)===0),g=[];for(let S=0;S<y.length;S++){const b=y[S];g.push(b);for(const N of p.get(b)??[])f.set(N,(f.get(N)??0)-1),(f.get(N)??0)===0&&y.push(N)}const x=new Set(g);return g.concat(m.filter(S=>r.has(S)&&!x.has(S)))}function Hx(n,o){const i=new Set(o),r=new Set,c=new Map;for(const p of n){const m=c.get(p.source)??[];m.push(p.target),c.set(p.source,m)}const f=[...i];for(let p=0;p<f.length;p++)for(const m of c.get(f[p])??[])i.has(m)||r.has(m)||(r.add(m),f.push(m));return[...r]}function Px(n,o,i){const r=new Set(i);return n.filter(c=>c.source===o&&!r.has(c.target)).map(c=>c.target)}function Ux(n,o,i){const r=new Set(i),c=new Map(n.map(p=>[p.id,p])),f=[];for(const p of o){if(!r.has(p.target)||r.has(p.source))continue;c.get(p.source)?.data.serverNodeId||f.push(p.target)}return f}const Ii={REF_TOO_LARGE:{surface:"toast",toastKey:"toast.refTooLarge"},REF_NOT_BASE64:{surface:"toast",toastKey:"toast.refNotBase64"},REF_EMPTY:{surface:"toast",toastKey:"toast.refEmpty"},REF_TOO_MANY:{surface:"toast",toastKey:"toast.refLimitExceeded"},MODERATION_REFUSED:{surface:"card",cardKey:"errorCard.moderationRefused",cta:"dismiss"},SAFETY_REFUSAL:{surface:"card",cardKey:"errorCard.moderationRefused",cta:"dismiss"},EMPTY_RESPONSE:{surface:"card",cardKey:"errorCard.emptyResponse",cta:"dismiss"},STREAM_PARSE_FAILED:{surface:"card",cardKey:"errorCard.streamParseFailed",cta:"retry"},IMAGE_TOOL_NOT_CALLED:{surface:"card",cardKey:"errorCard.imageToolNotCalled",cta:"retry"},WEB_SEARCH_ONLY_RESPONSE:{surface:"card",cardKey:"errorCard.webSearchOnlyResponse",cta:"retry"},IMAGE_TOOL_FAILED:{surface:"card",cardKey:"errorCard.imageToolFailed",cta:"retry"},IMAGE_TOOL_COMPLETED_WITHOUT_RESULT:{surface:"card",cardKey:"errorCard.imageToolNoResult",cta:"retry"},OAUTH_IMAGE_CAPABILITY_UNAVAILABLE:{surface:"card",cardKey:"errorCard.oauthImageCapabilityUnavailable",cta:"dismiss"},RESPONSES_STREAM_ERROR:{surface:"card",cardKey:"errorCard.responsesStreamError",cta:"retry"},UPSTREAM_5XX:{surface:"card",cardKey:"errorCard.upstream5xx",cta:"retry"},AUTH_CHATGPT_EXPIRED:{surface:"card",cardKey:"errorCard.authChatgptExpired",cta:"reauth"},AUTH_API_KEY_INVALID:{surface:"card",cardKey:"errorCard.authApiKeyInvalid",cta:"dismiss"},NETWORK_FAILED:{surface:"card",cardKey:"errorCard.networkFailed",cta:"reload"},OAUTH_UNAVAILABLE:{surface:"card",cardKey:"errorCard.oauthUnavailable",cta:"reload"},INVALID_REQUEST:{surface:"card",cardKey:"errorCard.invalidRequest",cta:"dismiss"},INVALID_MODERATION:{surface:"toast",toastKey:"toast.generateFailed"},APIKEY_DISABLED:{surface:"card",cardKey:"errorCard.apikeyDisabled",cta:"dismiss"},AGY_GENERATION_FAILED:{surface:"card",cardKey:"errorCard.agyGenerationFailed",cta:"retry"},AGY_TIMEOUT:{surface:"card",cardKey:"errorCard.agyTimeout",cta:"retry"},AGY_PROCESS_ERROR:{surface:"card",cardKey:"errorCard.agyProcessError",cta:"retry"},AGY_QUOTA_EXHAUSTED:{surface:"card",cardKey:"errorCard.agyQuotaExhausted",cta:"dismiss"},AGY_PARSE_FAILED:{surface:"card",cardKey:"errorCard.agyProcessError",cta:"retry"},AGY_ARTIFACT_NOT_FOUND:{surface:"card",cardKey:"errorCard.agyProcessError",cta:"retry"},DB_ERROR:{surface:"toast",toastKey:"toast.generateFailed"},UNKNOWN:{surface:"toast",toastKey:"toast.generateFailed"}};function Bx(n){const o=(n||"").toLowerCase();return o?o.includes("moderation_blocked")||o.includes("moderation refused")?"MODERATION_REFUSED":o.includes("no image data returned")?"EMPTY_RESPONSE":o.includes("stream could not be parsed")?"STREAM_PARSE_FAILED":o.includes("web search but not the image tool")?"WEB_SEARCH_ONLY_RESPONSE":o.includes("without calling the image tool")?"IMAGE_TOOL_NOT_CALLED":o.includes("image tool call failed")?"IMAGE_TOOL_FAILED":o.includes("image tool completed without image data")?"IMAGE_TOOL_COMPLETED_WITHOUT_RESULT":o.includes("token is expired")||o.includes("sign in again")||o.includes("access token")&&o.includes("expired")||o.includes("token")&&o.includes("expired")&&!o.includes("api key")?"AUTH_CHATGPT_EXPIRED":o.includes("incorrect api key")||o.includes("invalid authentication")||o.includes("exceeded your current quota")||o.includes("incorrect organization")?"AUTH_API_KEY_INVALID":o.includes("failed to fetch")||o.includes("econnrefused")||o.includes("econnreset")||o.includes("enotfound")||o.includes("etimedout")||o.includes("network error")?"NETWORK_FAILED":o.includes("oauth")&&(o.includes("not running")||o.includes("unavailable")||o.includes("not ready"))?"OAUTH_UNAVAILABLE":o.includes("invalid_request_error")||o.includes("invalid_value")||o.includes("invalid size")||o.includes("invalid request")||o.includes("requested resolution")||o.includes("minimum pixel budget")||o.includes("unsupported value")?"INVALID_REQUEST":o.includes("resource exhausted")||o.includes("exhausted your capacity")||o.includes("quota will reset")?"AGY_QUOTA_EXHAUSTED":o.includes("agy generation timed out")?"AGY_TIMEOUT":o.includes("agy generation failed")?"AGY_GENERATION_FAILED":o.includes("agy process error")||o.includes("agy exited")?"AGY_PROCESS_ERROR":o.includes("agy artifact not found")?"AGY_ARTIFACT_NOT_FOUND":o.includes("could not parse artifact path from agy")?"AGY_PARSE_FAILED":o.includes("an error occurred while processing")||/\b5\d\d\b/.test(o)?"UPSTREAM_5XX":"UNKNOWN":"UNKNOWN"}function Fx(n){const o=n,i=typeof o?.message=="string"?o.message:String(n??""),r=typeof o?.code=="string"?o.code:"",c=r&&r in Ii?r:Bx(i),f=Ii[c]??Ii.UNKNOWN;return{code:c,spec:f,message:i}}function Ni(n,o){const{code:i,spec:r,message:c}=Fx(n);if(r.surface==="card")o.showErrorCard(i,{fallbackMessage:c});else{const f=r.toastKey?ee(r.toastKey):c||ee("toast.generateFailed");o.showToast(f,!0)}return{code:i,message:c}}const Gi=!0,Eg=!1,Ag=!1,hh=10;function Cg(n,o){return o?o.filename&&n.filename===o.filename?!0:n.image===o.image:!1}function Kx(n){return[n.canvasSourceFilename,n.canvasEditableFilename].filter(o=>!!o)}function Mn(n){return n.filter(o=>!o.canvasVersion)}function ia(n,o){if(!o)return null;const i=Mn(n);if(!o.canvasVersion)return i.find(f=>Cg(f,o))??null;const r=Kx(o);return i.find(f=>f.filename?r.includes(f.filename):!1)??null}function Vx(n,o){const i=Mn(n),r=ia(n,o);return i.findIndex(c=>Cg(c,r))}function Yx(n,o,i){const r=Mn(n);if(r.length===0)return null;if(i==="first")return r[0]??null;if(i==="last")return r[r.length-1]??null;const c=Vx(n,o);if(c<0)return null;if(i==="pagePrevious"||i==="pageNext"){const p=i==="pagePrevious"?-hh:hh,m=Math.max(0,Math.min(r.length-1,c+p));return r[m]??null}const f=i==="previous"?c-1:c+1;return r[f]??null}function gh(n,o){const i=Mn(n),r=i.findIndex(c=>c.filename===o);return r<0?null:i[r+1]??i[r-1]??null}function yt(n){return n.filename||n.image}function Oi(n){return!n.canvasVersion}function Mr(n){const o=new Set;return n.filter(i=>{const r=yt(i);return o.has(r)?!1:(o.add(r),!0)})}const wg=72,yh=10;function Mg(n,o){const i=n.sequenceIndex??Number.MAX_SAFE_INTEGER,r=o.sequenceIndex??Number.MAX_SAFE_INTEGER;return i!==r?i-r:(n.createdAt??0)-(o.createdAt??0)}function Xx(n){return n<=1?1:n===2?2:4}function Rg(n){const o=new Set,i=new Map,r=[];for(const c of n){if(!Oi(c))continue;if(c.sequenceId){const p=`sequence:${c.sequenceId}`;let m=i.get(c.sequenceId);m||(m={type:"sequence",key:p,sequenceId:c.sequenceId,items:[]},i.set(c.sequenceId,m),r.push(m)),m.items.push(c);continue}const f=yt(c);o.has(f)||(o.add(f),r.push({type:"image",key:f,item:c}))}for(const c of i.values())c.items.sort(Mg);return r}function Ig(n,o){return o?`sequence:${o}`:n?.sequenceId?`sequence:${n.sequenceId}`:n?yt(n):null}function mu(n){return n.type==="sequence"?{type:"sequence",sequenceId:n.sequenceId}:{type:"image",item:n.item}}function Qx(n,o,i,r,c=wg){const f=Rg(n).slice(0,c);if(f.length===0)return null;const p=f[0],m=f[f.length-1];if(!p||!m)return null;if(i==="first")return mu(p);if(i==="last")return mu(m);const y=Ig(o,r),g=y?f.findIndex(N=>N.key===y):-1;if(g<0)return null;const x=i==="pagePrevious"?-yh:i==="pageNext"?yh:i==="previous"?-1:1,S=Math.max(0,Math.min(f.length-1,g+x));if(S===g)return null;const b=f[S];return b?mu(b):null}const Og={promptBuilderSurface:"right-panel",composerPlacement:"sidebar",multimodeHistoryGrouping:"individual",restoreComposerFromHistory:!0,viewerTools:"basic"},Zx={promptBuilderSurface:"right-panel",composerPlacement:"bottom",multimodeHistoryGrouping:"sequence",restoreComposerFromHistory:!1,viewerTools:"zoom-pan"},Jx={default:Og,"prompt-studio":Zx};function zi(n,o){return Jx[n]??Og}function $x(n,o){return zi(n).promptBuilderSurface!=="off"}const Wx=/\.(mp4|webm|mov)$/i;function ln(n){if(!n||n.startsWith("data:image/"))return!1;const o=n.split("?")[0];return Wx.test(o)||n.startsWith("data:video/")}function Wt(n){return n?n.mediaType==="video"?!0:ln(n.filename)||ln(n.url)||ln(n.image):!1}function ju(n,o){return new Promise((i,r)=>{const c=document.createElement("video");c.crossOrigin="anonymous",c.preload="auto",c.muted=!0,c.onloadedmetadata=()=>{c.currentTime=Math.max(0,o(c.duration))},c.onseeked=()=>{try{const f=document.createElement("canvas");f.width=c.videoWidth,f.height=c.videoHeight;const p=f.getContext("2d");if(!p){r(new Error("canvas 2d context unavailable"));return}p.drawImage(c,0,0);const m=f.toDataURL("image/jpeg",.85);i(m)}catch(f){r(f)}finally{c.src="",c.load()}},c.onerror=()=>{r(new Error("Failed to load video for frame extraction"))},c.src=n})}function Di(n){return ju(n,o=>o-.1)}function e1(n){return ju(n,o=>Math.min(o*.3,.4))}function t1(n){return ju(n,o=>o/2)}const Rr="Your video prompt should describe: visual flow, motion flow, sound/no-music intent, dialogue/no-dialogue, and the desired ending frame. Pace the scene to fill the selected duration naturally — opening composition, connected action/emotion change, and a stable ending frame.";function a1(n){const o=n.length<=4?n:[n[0],...n.slice(-3)];return o.map((i,r)=>({...i,ordinal:r+1,role:r===0?"start":r===o.length-1?"parent":"ancestor"}))}function fr(n){return typeof n=="string"&&n.trim()?n.trim():null}function jg(n){if(n.videoContinuity?.entries?.length)return{...n.videoContinuity,parentFilename:n.filename??n.videoContinuity.parentFilename??null,sourceFrame:"last",entries:a1(n.videoContinuity.entries)};const o=fr(n.revisedPrompt)??fr(n.prompt);if(!o)return null;const i=n.filename??null;return{lineageId:`lineage:${i??Date.now()}`,parentFilename:i,sourceFrame:"last",maxEntries:4,retention:"keep-start-plus-latest-3",entries:[{id:`clip:${i??"unknown"}`,ordinal:1,role:"start",filename:i,userPrompt:fr(n.userPrompt)??fr(n.prompt),revisedPrompt:o,createdAt:n.createdAt??Date.now()}]}}function Li(n){return{image:n.url||n.image,url:n.url,filename:n.filename,prompt:n.prompt??null,userPrompt:n.userPrompt??null,revisedPrompt:n.revisedPrompt??null,createdAt:n.createdAt,mediaType:n.mediaType,videoContinuity:n.videoContinuity??null}}function n1(n){const o=n.entries[n.entries.length-1];return{id:`video-continuity:${n.lineageId}`,name:"Video Continuity",text:["Video continuity context:","The attached image is the last frame of the previous video.",o?`Continue from previous revisedPrompt #${o.ordinal}: ${o.revisedPrompt}`:null,"The new prompt must define next motion, camera, sound/music/no-music, dialogue/no-dialogue, and ending frame.","Pace the new clip to naturally fill the selected duration with a production-level sequence from the last-frame anchor."].filter(Boolean).join(`
|
|
33
|
+
`)}}function kg(n){if(!n?.entries?.length)return null;const o=n.entries[n.entries.length-1];return`${n.entries.length}/4 clips · last frame · ${o?.filename??"unsaved source"}`}function l1(){try{const n=localStorage.getItem(ug);return n===null?!0:JSON.parse(n)===!0}catch{return!0}}function i1(){try{const n=localStorage.getItem(dg);if(n==="agent")return Ag?n:"classic";if(n==="card-news")return Eg?n:"classic";if(n==="node")return Gi?n:"classic";if(n==="classic")return n}catch{}return"classic"}function pu(){try{const n=localStorage.getItem(mg);if(n==="system"||n==="dark"||n==="light")return n}catch{}return"system"}function vh(){try{const n=localStorage.getItem(pg);if(n&&Xb.includes(n))return n}catch{}return"default"}function o1(){try{const n=localStorage.getItem(fg);if(n==="rail"||n==="horizontal"||n==="sidebar")return n}catch{}return"rail"}function bh(n){try{const o=localStorage.getItem(n);if(o==="current-session"||o==="all")return o}catch{}return"current-session"}function Sh(){if(typeof window>"u")return{mode:"alpha",matteColor:"#ffffff"};try{const n=window.localStorage.getItem(hg);if(!n)return{mode:"alpha",matteColor:"#ffffff"};const o=JSON.parse(n),i=o.mode==="matte"?"matte":"alpha",r=typeof o.matteColor=="string"&&/^#[0-9a-fA-F]{6}$/.test(o.matteColor)?o.matteColor:"#ffffff";return{mode:i,matteColor:r}}catch{return{mode:"alpha",matteColor:"#ffffff"}}}function xh(n,o){if(!(typeof window>"u"))try{window.localStorage.setItem(hg,JSON.stringify({mode:n,matteColor:o}))}catch{}}function zg(){try{const n=localStorage.getItem(gg);if(og(n))return n}catch{}return Su}function _i(n){try{localStorage.setItem(gg,n)}catch{}}function r1(){try{const n=localStorage.getItem(yg);if(cg(n))return n}catch{}return Ax}function s1(n){try{localStorage.setItem(yg,n)}catch{}}function c1(){try{const n=localStorage.getItem(vg);if(n==="false")return!1;if(n==="true")return!0}catch{}return Mx}function u1(n){try{localStorage.setItem(vg,String(n))}catch{}}const Th={model:!1,duration:5,resolution:"480p",aspectRatio:"auto"};function ku(){try{const n=localStorage.getItem(xg);if(!n)return Th;const o=JSON.parse(n);return{model:typeof o.model=="string"?o.model:!1,duration:typeof o.duration=="number"?o.duration:5,resolution:o.resolution==="480p"||o.resolution==="720p"?o.resolution:"480p",aspectRatio:typeof o.aspectRatio=="string"?o.aspectRatio:"auto"}}catch{return Th}}function vl(n){try{const o=ku();localStorage.setItem(xg,JSON.stringify({...o,...n}))}catch{}}function mr(n){return n==="dark"||n==="light"?n:typeof window>"u"||typeof window.matchMedia!="function"?"dark":window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark"}const Dg=18e4,bl=new Set;function Nh(n){const o=n.uiMode==="node"?[{kind:"node",sessionId:n.activeSessionId??void 0}]:[{kind:"classic"}];return n.inFlight.some(i=>i.kind==="multimode")&&o.push({kind:"multimode"}),o.push({kind:"video"}),o}function _h(n,o){const i=n.kind??"classic";return o.some(r=>i===r.kind&&(r.kind!=="node"||(n.sessionId??null)===(r.sessionId??null)))}async function Eh(n){const o=await Promise.all(n.map(i=>Wh({kind:i.kind,sessionId:i.sessionId,includeTerminal:!0})));return{jobs:o.flatMap(i=>i.jobs),terminalJobs:o.flatMap(i=>i.terminalJobs??[])}}function pr(n,o){const i=o.filter(c=>c.placement!=="after"),r=o.filter(c=>c.placement==="after");return[...i.map(c=>c.text.trim()).filter(Boolean),n.trim(),...r.map(c=>c.text.trim()).filter(Boolean)].filter(Boolean).join(`
|
|
34
|
+
|
|
35
|
+
`)}function d1(n){if(!n||typeof n!="object")return null;const o=n;return typeof o.id!="string"||typeof o.name!="string"||typeof o.text!="string"?null:{id:o.id,name:o.name,text:o.text,placement:o.placement==="after"?"after":"before"}}function qi(n){if(!Array.isArray(n))return null;const o=n.map(d1);return o.every(i=>i!==null)?o:null}function _u(n){return n.map(o=>({id:o.id,name:o.name,text:o.text,placement:o.placement==="after"?"after":"before"}))}function f1(n){const o=qi(n.composerInsertedPrompts);return typeof n.composerPrompt=="string"?{prompt:n.composerPrompt,insertedPrompts:o??[]}:o?{insertedPrompts:o}:{}}function hr(n){const o=n.meta??{},i=n.kind==="classic"||n.kind==="node"||n.kind==="multimode"?n.kind:o.kind==="classic"||o.kind==="node"||o.kind==="multimode"?o.kind:void 0;return{id:n.requestId,prompt:typeof n.prompt=="string"?n.prompt:"",startedAt:n.startedAt,composerPrompt:typeof o.composerPrompt=="string"?o.composerPrompt:void 0,composerInsertedPrompts:qi(o.composerInsertedPrompts)??void 0,phase:typeof n.phase=="string"?n.phase:void 0,sessionId:typeof o.sessionId=="string"?o.sessionId:null,parentNodeId:typeof o.parentNodeId=="string"?o.parentNodeId:null,clientNodeId:typeof o.clientNodeId=="string"?o.clientNodeId:null,kind:i}}function Ah(n){const o=typeof n.errorCode=="string"&&n.errorCode?n.errorCode:"UNKNOWN",i=new Error(o==="EMPTY_RESPONSE"?"No image data returned from the image backend.":"Generation failed on the server.");return i.code=o,i.status=typeof n.httpStatus=="number"?n.httpStatus:void 0,i}function Ch(n){if(!n||typeof n!="object")return!1;const o=n;return o.code==="GENERATION_CANCELED"||o.status===499}function wh(n){return n.filename||n.image}function Mh(n,o){const i=new Map(n.map(r=>[wh(r),r]));for(const r of o)i.set(wh(r),r);return[...i.values()].sort((r,c)=>(r.sequenceIndex??Number.MAX_SAFE_INTEGER)-(c.sequenceIndex??Number.MAX_SAFE_INTEGER))}function Rh(){try{const n=localStorage.getItem(Sg);if(!n)return[];const o=JSON.parse(n);if(!Array.isArray(o))return[];const i=Date.now();return o.filter(r=>r&&typeof r.id=="string"&&typeof r.prompt=="string"&&typeof r.startedAt=="number"&&i-r.startedAt<Dg).map(r=>({id:r.id,prompt:r.prompt,startedAt:r.startedAt,composerPrompt:typeof r.composerPrompt=="string"?r.composerPrompt:void 0,composerInsertedPrompts:qi(r.composerInsertedPrompts)??void 0,phase:typeof r.phase=="string"?r.phase:void 0,sessionId:typeof r.sessionId=="string"?r.sessionId:null,parentNodeId:typeof r.parentNodeId=="string"?r.parentNodeId:null,clientNodeId:typeof r.clientNodeId=="string"?r.clientNodeId:null,kind:r.kind==="classic"||r.kind==="node"||r.kind==="multimode"||r.kind==="video"?r.kind:void 0}))}catch{return[]}}function Et(n){try{localStorage.setItem(Sg,JSON.stringify(n))}catch(o){const i=window;if(!i.__ima2QuotaWarned){i.__ima2QuotaWarned=!0,console.warn("[ima2] localStorage write failed:",o);try{E.getState().showToast(ee("toast.localStorageFull"),!0)}catch{}}}}function Ih(){try{const n=localStorage.getItem(xu);return typeof n=="string"&&n.length>0?n:null}catch{return null}}function oa(n){try{n?localStorage.setItem(xu,n):localStorage.removeItem(xu)}catch{}}function m1(){try{const n=localStorage.getItem(Tu);return typeof n=="string"&&n.length>0?n:null}catch{return null}}function hu(n){try{n?localStorage.setItem(Tu,n):localStorage.removeItem(Tu)}catch{}}const Zt=500,Qt=5;function p1(n){return n==="classic"||n==="edit"||n==="generate"||n==="card-news-card"||n==="card-news-set"?n:null}function Ei(n){const o=qi(n.composerInsertedPrompts),i=n.mediaType==="video"||/\.(mp4|webm|mov)$/i.test(n.filename??"");return{image:n.url,url:n.url,mediaType:n.mediaType,video:n.video??null,videoSeries:n.videoSeries??null,videoContinuity:n.videoContinuity??null,filename:n.filename,thumb:n.thumb??(i?void 0:n.url),prompt:n.prompt??void 0,userPrompt:n.userPrompt??null,revisedPrompt:n.revisedPrompt??null,promptMode:n.promptMode??null,composerPrompt:n.composerPrompt??null,composerInsertedPrompts:o?_u(o):null,size:n.size??void 0,quality:n.quality??void 0,format:n.format,model:n.model??void 0,reasoningEffort:n.reasoningEffort??void 0,elapsed:n.elapsed??void 0,provider:n.provider,usage:n.usage??void 0,createdAt:n.createdAt,sessionId:n.sessionId??null,nodeId:n.nodeId??null,clientNodeId:n.clientNodeId??null,requestId:n.requestId??null,kind:p1(n.kind),canvasVersion:!!n.canvasVersion,canvasSourceFilename:n.canvasSourceFilename??null,canvasEditableFilename:n.canvasEditableFilename??null,canvasMergedAt:n.canvasMergedAt??void 0,setId:n.setId??null,cardId:n.cardId??null,cardOrder:n.cardOrder??null,headline:n.headline??null,body:n.body??null,cards:n.cards,refsCount:n.refsCount??0,isFavorite:n.isFavorite??!1,sequenceId:n.sequenceId??null,sequenceIndex:n.sequenceIndex??null,sequenceTotalRequested:n.sequenceTotalRequested??null,sequenceTotalReturned:n.sequenceTotalReturned??null,sequenceStatus:n.sequenceStatus??null}}function $t(n){return n.filename??n.image}function Lg(n,o){const i=$t(o);return n.filter(r=>$t(r)!==i)}function Gg(n,o){const i=$t(o);return n.find(r=>$t(r)===i)}function qg(n,o){return o?{...o,...n,createdAt:n.createdAt??o.createdAt,requestId:n.requestId??o.requestId,sessionId:n.sessionId??o.sessionId,kind:n.kind??o.kind,refsCount:n.refsCount??o.refsCount,isFavorite:n.isFavorite??o.isFavorite}:n}function Oh(n,o){const i=new Map(n.map(r=>[$t(r),r]));for(const r of o)i.set($t(r),r);return[...n.map(r=>i.get($t(r))??r),...o.filter(r=>!n.some(c=>$t(c)===$t(r)))]}function Ir(n,o){return n.slice(0,Math.max(Zt,o))}function gu(n){return n.replace(/^data:[^;]+;base64,/,"")}async function gr(n,o="reference.png"){const i=await fetch(n);if(!i.ok)throw new Error(`reference fetch failed: ${i.status}`);const r=await i.blob(),c=new File([r],o,{type:r.type||"image/png"});return bu(c,{preserveTransparency:!1})}const Sl="source-right",Ai="target-left";function yr(n,o,i,r){return`${n}:${i??"auto"}->${o}:${r??"auto"}`}function h1(n,o){return n&&n.startsWith(`${o}-`)?n:null}function g1(n){switch(n){case"source-top":return"target-bottom";case"source-right":return"target-left";case"source-bottom":return"target-top";case"source-left":return"target-right";default:return null}}function Hg(n){const o=n.nodes.map(r=>{const c=r.data??{},f=typeof c.imageUrl=="string"&&c.imageUrl.length>0?c.imageUrl:null,p=typeof c.serverNodeId=="string"&&c.serverNodeId.length>0?`/generated/${c.serverNodeId}.png`:null,m=f??p,y={clientId:r.id,serverNodeId:c.serverNodeId??null,parentServerNodeId:c.parentServerNodeId??null,prompt:typeof c.prompt=="string"?c.prompt:"",imageUrl:m,status:c.status??(m?"ready":"empty"),pendingRequestId:c.pendingRequestId??null,recoveryRequestId:c.recoveryRequestId??null,pendingPhase:c.pendingPhase??null,pendingStartedAt:typeof c.pendingStartedAt=="number"?c.pendingStartedAt:null,partialImageUrl:null,error:c.error,elapsed:c.elapsed,reasoningEffort:c.reasoningEffort,webSearchCalls:c.webSearchCalls,model:c.model??null,size:c.size??null,referenceImages:kx(n.id,r.id),video:c.video??null};return{id:r.id,type:"imageNode",position:{x:r.x,y:r.y},data:y}}),i=n.edges.map(r=>{const c=r.data??{};return{id:r.id,source:r.source,target:r.target,sourceHandle:typeof c.sourceHandle=="string"?c.sourceHandle:null,targetHandle:typeof c.targetHandle=="string"?c.targetHandle:null}});return{graphNodes:an(o,i),graphEdges:i,graphVersion:n.graphVersion}}function y1(n,o){let i=!1;const r={};for(const[c,f]of Object.entries(n)){const p=f.images.filter(m=>m.filename!==o);if(p.length===f.images.length){r[c]=f;continue}i=!0,p.length!==0&&(r[c]={...f,images:p,returned:p.length,status:f.status==="complete"&&p.length<f.requested?"partial":f.status})}return i?r:n}function v1(n){const o=n.multimodePreviewFlightId;return o?o.startsWith("history:")?o.slice(8):n.multimodeSequences[o]?.sequenceId??null:null}function b1(n,o){return`${n}x${o}`}function ji(n){return Math.min(8,Math.max(1,Math.trunc(n||1)))}const Pg=new Set(["1024x1024","1536x1024","1024x1536","1360x1024","1024x1360","1824x1024","1024x1824","2048x2048","2048x1152","1152x2048","3840x2160","2160x3840","auto","custom"]);function S1(n){if(typeof n!="string")return{};if(Pg.has(n))return{preset:n};const o=/^(\d+)x(\d+)$/.exec(n);if(!o)return{};const i=Number(o[1]),r=Number(o[2]);return!Number.isFinite(i)||!Number.isFinite(r)?{}:{preset:"custom",w:i,h:r}}function Ug(n){return n==="low"||n==="medium"||n==="high"}function Bg(n){return n==="png"||n==="jpeg"||n==="webp"}function Fg(n){return n==="low"||n==="auto"}function x1(n){return n==="oauth"||n==="api"||n==="grok"||n==="grok-api"||n==="agy"||n==="gemini-api"}function T1(n){return n==="auto"||n==="direct"}function N1(n){return typeof n=="string"&&Pg.has(n)}function Kg(){try{const n=localStorage.getItem(bg);if(!n)return{};const o=JSON.parse(n),i={};x1(o.provider)&&(i.provider=o.provider),Ug(o.quality)&&(i.quality=o.quality),N1(o.sizePreset)&&(i.sizePreset=o.sizePreset),typeof o.customW=="number"&&Number.isFinite(o.customW)&&(i.customW=sa(o.customW,1920)),typeof o.customH=="number"&&Number.isFinite(o.customH)&&(i.customH=sa(o.customH,1088)),Bg(o.format)&&(i.format=o.format),Fg(o.moderation)&&(i.moderation=o.moderation),typeof o.count=="number"&&(i.count=ji(o.count)),typeof o.multimode=="boolean"&&(i.multimode=o.multimode),typeof o.multimodeMaxImages=="number"&&(i.multimodeMaxImages=ji(o.multimodeMaxImages)),T1(o.promptMode)&&(i.promptMode=o.promptMode),typeof o.prompt=="string"&&(i.prompt=o.prompt);const r=qi(o.insertedPrompts);return r&&(i.insertedPrompts=r),i}catch{return{}}}function Qe(n){try{const o=Kg();localStorage.setItem(bg,JSON.stringify({...o,...n}))}catch{}}function _1(n,o){const i={},r=o.userPrompt||o.prompt;typeof r=="string"&&(i.prompt=r),Ug(o.quality)&&(i.quality=o.quality),Bg(o.format)&&(i.format=o.format),Fg(o.moderation)&&(i.moderation=o.moderation),(o.promptMode==="auto"||o.promptMode==="direct")&&(i.promptMode=o.promptMode),o.model&&og(o.model)&&(i.imageModel=o.model);const c=S1(o.size);return c.preset&&(i.sizePreset=c.preset),c.preset==="custom"&&c.w&&c.h&&(i.customW=sa(c.w,n.customW),i.customH=sa(c.h,n.customH)),i}function vr(n,o){if(n.provider==="grok"||n.provider==="grok-api"||n.provider==="agy"||n.provider==="gemini-api"||n.sizePreset!=="custom")return null;const i=Iu(n.customW,n.customH,n.customW,n.customH);return i.adjusted?{requestedW:i.requestedW,requestedH:i.requestedH,adjustedW:i.w,adjustedH:i.h,reasons:i.reasons,continuation:o}:null}const pt=Kg(),Vg=zg(),wi=ku(),E1=wi.model||Ar(Vg)?"grok":(pt.provider??"oauth")==="grok"?"oauth":pt.provider??"oauth",E=$h((n,o)=>({provider:E1,quality:pt.quality??"medium",sizePreset:pt.sizePreset??"1024x1024",customW:pt.customW??1920,customH:pt.customH??1088,grokAspectRatio:pt.grokAspectRatio??"1:1",grokResolution:pt.grokResolution??"1k",format:pt.format??"png",moderation:pt.moderation??"low",count:pt.count??1,multimode:pt.multimode??!1,multimodeMaxImages:pt.multimodeMaxImages??4,multimodeSequences:{},multimodeAbortControllers:{},multimodePreviewFlightId:null,promptMode:pt.promptMode??"auto",prompt:pt.prompt??"",insertedPrompts:pt.insertedPrompts??[],referenceImages:[],canvasReferenceImage:null,workspaceProfile:(()=>{try{return localStorage.getItem("ima2.workspaceProfile")==="prompt-studio"?"prompt-studio":"default"}catch{return"default"}})(),promptBuilderOpen:!1,storyboardActive:!1,promptLibraryOpen:!1,promptLibrary:{prompts:[],folders:[]},promptLibraryLoading:!1,galleryFavorites:new Set,browserId:tg(),canvasOpen:!1,canvasZoom:1,canvasPanX:0,canvasPanY:0,canvasExportBackground:Sh().mode,canvasExportMatteColor:Sh().matteColor,addReferences:async i=>{const r=Qt-o().referenceImages.length,c=i.slice(0,Math.max(0,r)),f=c.filter(cr),p=c.filter(x=>!cr(x)),y=(await Promise.all(p.map(async x=>{try{return await bu(x,{preserveTransparency:ah(x)})}catch(S){return console.warn("[addReferences] compress failed",S),null}}))).filter(x=>!!x);n(x=>({referenceImages:[...x.referenceImages,...y].slice(0,Qt)})),f.length>0&&o().showToast(ee("toast.refHeicUnsupported"),!0),p.length-y.length>0&&o().showToast(ee("toast.refTooLarge"),!0),i.length>r&&o().showToast(ee("toast.refLimitExceeded"),!0)},addReferenceDataUrl:i=>{n(r=>r.referenceImages.length>=Qt?r:{referenceImages:[...r.referenceImages,i]})},metadataRestore:null,readDroppedImageMetadata:async(i,r=null)=>{if(!i.type.startsWith("image/"))return!1;let c="";try{c=await SS(i);const f=await sS({filename:i.name,dataUrl:c});return f.metadata?(n({metadataRestore:{filename:i.name,image:c,metadata:f.metadata,source:f.source??"xmp",targetNodeId:r}}),!0):!1}catch{return o().showToast(ee("metadata.readFailed"),!0),!1}},applyMetadataRestore:()=>{const i=o().metadataRestore;if(!i)return;const r=_1(o(),i.metadata);if(r.imageModel&&_i(r.imageModel),i.targetNodeId&&typeof r.prompt=="string"){const c=r.prompt;n({...r,metadataRestore:null,graphNodes:o().graphNodes.map(f=>f.id===i.targetNodeId?{...f,data:{...f.data,prompt:c}}:f)}),o().scheduleGraphSave()}else n({...r,metadataRestore:null});o().showToast(ee("metadata.applied"))},cancelMetadataRestore:()=>n({metadataRestore:null}),addMetadataRestoreAsReference:()=>{const i=o().metadataRestore;i&&(i.targetNodeId?o().addNodeReferenceDataUrl(i.targetNodeId,i.image):o().addReferenceDataUrl(i.image),n({metadataRestore:null}))},removeReference:i=>{n(r=>{const c=r.referenceImages.filter((m,y)=>y!==i),f=c.length===0,p=f?r.insertedPrompts.filter(m=>!m.id.startsWith("video-continuity:")):r.insertedPrompts;return p.length!==r.insertedPrompts.length&&Qe({insertedPrompts:p}),{referenceImages:c,insertedPrompts:p,videoContinuityLineage:f?null:r.videoContinuityLineage,canvasReferenceImage:r.referenceImages[i]===r.canvasReferenceImage?null:r.canvasReferenceImage}})},clearReferences:()=>{const i=o().insertedPrompts.filter(r=>!r.id.startsWith("video-continuity:"));i.length!==o().insertedPrompts.length&&Qe({insertedPrompts:i}),n({referenceImages:[],canvasReferenceImage:null,videoContinuityLineage:null,insertedPrompts:i})},attachCanvasVersionReference:async i=>{let r;try{r=await gr(i.image,i.filename||"canvas-version-reference.png")}catch{throw o().showToast(ee("toast.currentImageLoadFailed"),!0),new Error("canvas_reference_attach_failed")}n(c=>{const p=(c.canvasReferenceImage?c.referenceImages.filter(m=>m!==c.canvasReferenceImage):c.referenceImages).filter(m=>m!==r);return{canvasReferenceImage:r,referenceImages:[r,...p].slice(0,Qt)}}),o().showToast(ee("canvas.version.usingAsReference"))},useCurrentAsReference:async()=>{const i=o().currentImage;if(!i){o().showToast(ee("toast.noCurrentImageForRef"),!0);return}if(o().referenceImages.length>=Qt){o().showToast(ee("toast.refSlotFull"),!0);return}let r;try{r=await gr(i.image,i.filename||"current-reference.png")}catch{o().showToast(ee("toast.currentImageLoadFailed"),!0);return}n(c=>({referenceImages:[...c.referenceImages,r].slice(0,Qt)})),o().showToast(ee("toast.addedCurrentAsRef"))},useImageAsReference:async i=>{if(o().referenceImages.length>=Qt){o().showToast(ee("toast.refSlotFull"),!0);return}let r;try{r=await gr(i.image,i.filename||"canvas-reference.png")}catch{o().showToast(ee("toast.currentImageLoadFailed"),!0);return}n(c=>({referenceImages:[...c.referenceImages,r].slice(0,Qt)})),o().showToast(ee("toast.addedCurrentAsRef"))},activeGenerations:0,unseenGeneratedCount:0,inFlight:[],cancelInFlightJob:async i=>{if(i){n(r=>{const c=r.inFlight.map(f=>f.id===i?{...f,phase:"canceling"}:f);return Et(c),{inFlight:c}});try{await ou(i),o().startInFlightPolling()}catch{o().showToast(ee("toast.cancelFailed"),!0)}}},startInFlightPolling:()=>{if(typeof window>"u")return;const i=window;if(i.__ima2InflightTimer)return;const r=async()=>{const f=o().inFlight.length===0&&o().activeGenerations===0;f&&i.__ima2InflightTimer&&(clearInterval(i.__ima2InflightTimer),i.__ima2InflightTimer=void 0);let p=new Set;if(!f)try{const m=Nh(o()),{jobs:y,terminalJobs:g=[]}=await Eh(m);p=new Set(y.map(L=>L.requestId));const x=new Map(y.map(L=>[L.requestId,L])),S=new Map(g.map(L=>[L.requestId,L])),b=[];let N=!1;const _=Date.now(),M=5e3,I=[];for(const L of o().inFlight){if(!_h(L,m)){I.push(L);continue}const O=S.get(L.id);if(O){N=!0,O.status==="error"&&b.push(Ah(O));continue}if(!x.has(L.id)&&_-L.startedAt>M){N=!0;continue}const k=x.get(L.id);if(k){const $=hr(k),K={...L,phase:$.phase,sessionId:$.sessionId,parentNodeId:$.parentNodeId,clientNodeId:$.clientNodeId,kind:$.kind};(K.phase!==L.phase||K.sessionId!==L.sessionId||K.parentNodeId!==L.parentNodeId||K.clientNodeId!==L.clientNodeId||K.kind!==L.kind)&&(N=!0),I.push(K)}else I.push(L)}const G=new Set(I.map(L=>L.id));for(const L of y)G.has(L.requestId)||(I.push(hr(L)),N=!0);N&&(Et(I),n({inFlight:I,activeGenerations:I.length}));for(const L of b)Ni(L,o())}catch{}try{const m=o().history.reduce((b,N)=>N.createdAt&&N.createdAt>b?N.createdAt:b,0),{items:y}=await Nl({limit:Zt,since:m}),g=y.map(Ei);g.length>0&&n(b=>{const N=new Set(b.history.map($t)),_=g.filter(I=>{const G=$t(I);return N.has(G)?!1:(N.add(G),!0)});if(_.length===0)return{};const M=b.currentImage??_[0];return!b.currentImage&&_[0]?.filename&&oa(_[0].filename),{history:Ir([..._,...b.history],Math.max(Zt,b.history.length+_.length)),currentImage:M,loadedHistoryRetainLimit:Math.max(b.loadedHistoryRetainLimit,b.history.length+_.length)}});const x=Date.now(),S=o().inFlight.filter(b=>p.has(b.id)||x-b.startedAt<Dg);S.length!==o().inFlight.length&&(Et(S),n({inFlight:S,activeGenerations:S.length}))}catch{}};i.__ima2InflightTimer=window.setInterval(r,1500)},reconcileInflight:async()=>{try{const i=Nh(o()),{jobs:r,terminalJobs:c=[]}=await Eh(i),f=new Map(r.map(N=>[N.requestId,N])),p=new Map(c.map(N=>[N.requestId,N])),m=[],y=Date.now(),g=o().inFlight,S=(g.length>0?g:Rh()).flatMap(N=>{const _=f.get(N.id);if(_){const I=hr(_);return[{...N,...I,prompt:N.prompt||I.prompt,phase:N.phase||I.phase}]}if(!_h(N,i))return[N];const M=p.get(N.id);return M?(M.status==="error"&&m.push(Ah(M)),[]):y-N.startedAt<1e4?[N]:[]}),b=new Set(S.map(N=>N.id));for(const N of r)b.has(N.requestId)||S.push(hr(N));Et(S),n({inFlight:S,activeGenerations:S.length});for(const N of m)Ni(N,o());S.length>0&&o().startInFlightPolling()}catch{}},syncFromStorage:()=>{const i=Rh(),r=Ih(),c=zg(),f=ku();n(p=>{const m=r?p.history.find(S=>S.filename===r)??null:null,y=m?ia(p.history,m):null,g=Mn(p.history)[0]??null,x=p.currentImage?.canvasVersion?ia(p.history,p.currentImage)??g:p.currentImage;return{inFlight:i,activeGenerations:i.length,imageModel:c,videoModelSelected:f.model,videoDuration:f.duration,videoResolution:f.resolution,videoAspectRatio:f.aspectRatio,currentImage:r&&x?.filename!==r?y??x:x}}),i.length>0&&o().startInFlightPolling()},currentImage:null,applyMergedCanvasImage:i=>{n(r=>({history:i.filename?r.history.some(c=>c.filename===i.filename)?r.history.map(c=>c.filename===i.filename?i:c):Ir([i,...r.history],r.loadedHistoryRetainLimit+1):r.history,loadedHistoryRetainLimit:Math.max(r.loadedHistoryRetainLimit,Math.min(r.history.length+1,r.loadedHistoryRetainLimit+1))}))},addGeneratedHistoryItem:async i=>{await br(i,n,o)},history:[],historyNextCursor:null,historyLoadingOlder:!1,favoriteHistoryNextCursor:null,favoriteHistoryLoadingOlder:!1,loadedHistoryRetainLimit:Zt,loadOlderHistory:async()=>{const i=o().historyNextCursor;if(!(!i||o().historyLoadingOlder)){n({historyLoadingOlder:!0});try{const r=await Nl({limit:Zt,cursor:i}),c=r.items.map(Ei);n(f=>{const p=new Set(f.history.map(y=>y.filename??y.image)),m=c.filter(y=>{const g=y.filename??y.image;return p.has(g)?!1:(p.add(g),!0)});return{history:[...f.history,...m],historyNextCursor:r.nextCursor,historyLoadingOlder:!1,loadedHistoryRetainLimit:Math.max(f.loadedHistoryRetainLimit,f.history.length+m.length)}})}catch{n({historyLoadingOlder:!1}),o().showToast(ee("gallery.loadOlderFailed"),!0)}}},loadFavoriteHistory:async()=>{try{const i=await Nl({limit:Zt,favoritesOnly:!0}),r=i.items.map(Ei);n(c=>{const f=Oh(c.history,r);return{history:f,favoriteHistoryNextCursor:i.nextCursor,loadedHistoryRetainLimit:Math.max(c.loadedHistoryRetainLimit,f.length),galleryFavorites:new Set([...Array.from(c.galleryFavorites),...r.filter(p=>p.filename).map(p=>p.filename)])}})}catch{o().showToast(ee("gallery.loadOlderFailed"),!0)}},loadOlderFavoriteHistory:async()=>{const i=o().favoriteHistoryNextCursor;if(!(!i||o().favoriteHistoryLoadingOlder)){n({favoriteHistoryLoadingOlder:!0});try{const r=await Nl({limit:Zt,cursor:i,favoritesOnly:!0}),c=r.items.map(Ei);n(f=>{const p=Oh(f.history,c);return{history:p,favoriteHistoryNextCursor:r.nextCursor,favoriteHistoryLoadingOlder:!1,loadedHistoryRetainLimit:Math.max(f.loadedHistoryRetainLimit,p.length),galleryFavorites:new Set([...Array.from(f.galleryFavorites),...c.filter(m=>m.filename).map(m=>m.filename)])}})}catch{n({favoriteHistoryLoadingOlder:!1}),o().showToast(ee("gallery.loadOlderFailed"),!0)}}},trashPending:null,toast:null,toastLog:[],customSizeConfirm:null,errorCard:null,errorCardLog:[],rightPanelOpen:l1(),toggleRightPanel:()=>n(i=>{const r=!i.rightPanelOpen;try{localStorage.setItem(ug,JSON.stringify(r))}catch{}return{rightPanelOpen:r}}),composeSheetOpen:!1,composeSheetTab:"prompt",openComposeSheet:(i="prompt")=>n({composeSheetOpen:!0,composeSheetTab:i}),setComposeSheetTab:i=>n({composeSheetTab:i}),closeComposeSheet:()=>n({composeSheetOpen:!1}),galleryOpen:!1,openGallery:()=>n(i=>({galleryOpen:!0,galleryScope:i.galleryDefaultScope})),closeGallery:()=>n({galleryOpen:!1}),galleryScope:bh(uu),galleryDefaultScope:bh(fh),setGalleryScope:i=>{try{localStorage.setItem(uu,i)}catch{}n({galleryScope:i})},setGalleryDefaultScope:i=>{try{localStorage.setItem(fh,i),localStorage.setItem(uu,i)}catch{}n({galleryDefaultScope:i,galleryScope:i})},imageModel:Vg,reasoningEffort:r1(),webSearchEnabled:c1(),settingsOpen:!1,activeSettingsSection:"account",readinessPopupOpen:!1,openSettings:(i="account")=>n({settingsOpen:!0,activeSettingsSection:i}),closeSettings:()=>n({settingsOpen:!1}),toggleSettings:()=>n(i=>({settingsOpen:!i.settingsOpen,activeSettingsSection:i.settingsOpen?i.activeSettingsSection:"account"})),setActiveSettingsSection:i=>n({activeSettingsSection:i}),openReadinessPopup:()=>n({readinessPopupOpen:!0}),closeReadinessPopup:()=>n({readinessPopupOpen:!1}),uiMode:i1(),setUIMode:i=>{const r=i==="agent"&&!Ag||i==="card-news"&&!Eg?"classic":i;try{localStorage.setItem(dg,r)}catch{}n({uiMode:r})},theme:pu(),resolvedTheme:mr(pu()),themeFamily:vh(),historyStripLayout:o1(),setTheme:i=>{try{localStorage.setItem(mg,i)}catch{}n({theme:i,resolvedTheme:mr(i)})},setThemeFamily:i=>{try{localStorage.setItem(pg,i)}catch{}n({themeFamily:i})},setHistoryStripLayout:i=>{try{localStorage.setItem(fg,i)}catch{}n({historyStripLayout:i})},syncThemeFromStorage:()=>{const i=pu();n({theme:i,resolvedTheme:mr(i)})},syncThemeFamilyFromStorage:()=>{n({themeFamily:vh()})},refreshResolvedTheme:()=>{n(i=>({resolvedTheme:mr(i.theme)}))},locale:ox(),setLocale:i=>{rx(i),n({locale:i})},graphNodes:[],graphEdges:[],setGraphNodes:i=>{n({graphNodes:an(i,o().graphEdges)}),o().scheduleGraphSave()},setGraphEdges:i=>{n({graphEdges:i,graphNodes:an(o().graphNodes,i)}),o().scheduleGraphSave()},disconnectEdge:i=>{o().disconnectEdges([i])},disconnectEdges:i=>{const r=new Set(i);if(r.size===0)return;const c=o().graphEdges.filter(y=>r.has(y.id));if(c.length===0)return;const f=o().graphEdges.filter(y=>!r.has(y.id)),p=new Set(c.map(y=>y.target)),m=o().graphNodes.map(y=>{if(!p.has(y.id))return y;const g=f.find(S=>S.target===y.id),x=g?o().graphNodes.find(S=>S.id===g.source):null;return{...y,data:{...y.data,parentServerNodeId:x?.data.serverNodeId??null}}});n({graphNodes:an(m,f),graphEdges:f}),o().scheduleGraphSave(),o().flushGraphSave("edge-disconnect"),o().showToast(ee("edge.disconnected"))},nodeSelectionMode:!1,nodeBatchRunning:!1,nodeBatchStopping:!1,toggleNodeSelectionMode:()=>{const i=!o().nodeSelectionMode;n({nodeSelectionMode:i,...i?{}:{graphNodes:Ri(o().graphNodes,[])}})},selectAllGraphNodes:()=>{n({graphNodes:Ri(o().graphNodes,o().graphNodes.map(i=>i.id))})},selectNodeGraph:(i,r)=>{n({graphNodes:Lx(o().graphNodes,o().graphEdges,i,r)})},clearNodeSelection:()=>{n({graphNodes:Ri(o().graphNodes,[])})},cancelNodeBatch:()=>{o().nodeBatchRunning&&(n({nodeBatchStopping:!0}),o().showToast(ee("nodeBatch.stopQueued")))},sessions:[],activeSessionId:null,activeSessionGraphVersion:null,sessionLoading:!1,async loadSessions(){try{const{sessions:i}=await cS();if(n({sessions:i}),!o().activeSessionId){const c=m1(),f=c?i.some(p=>p.id===c):!1;c&&f?await o().switchSession(c):await o().createAndSwitchSession(ee("session.firstGraph"))}}catch(i){console.warn("[sessions] load failed:",i)}},async switchSession(i){n({sessionLoading:!0}),await o().flushGraphSave("switch-session");try{const{session:r}=await ag(i),{graphNodes:c,graphEdges:f,graphVersion:p}=Hg(r);n({activeSessionId:i,activeSessionGraphVersion:p,graphNodes:c,graphEdges:f,sessionLoading:!1}),hu(i),await o().reconcileGraphPending().catch(()=>{})}catch(r){console.warn("[sessions] switch failed:",r),n({sessionLoading:!1}),o().showToast(ee("toast.sessionLoadFailed"),!0)}},async reconcileGraphPending(){const i=o().activeSessionId;if(!i)return;if(o().graphNodes.filter(c=>c.data?.pendingRequestId&&(c.data.status==="pending"||c.data.status==="reconciling")).length>0){let c=[];try{c=(await Wh({kind:"node",sessionId:i})).jobs}catch{c=[]}const f=new Map(c.map(g=>[g.requestId,g.phase])),p=Date.now(),m=1e4,y=o().graphNodes.map(g=>{const x=g.data?.pendingRequestId;if(!x||g.data.status!=="pending"&&g.data.status!=="reconciling")return g;if(f.has(x)){const N=f.get(x)??null;return{...g,data:{...g.data,status:"reconciling",pendingPhase:N}}}const S=g.data.pendingStartedAt??0;if(S&&p-S<m)return{...g,data:{...g.data,status:"reconciling"}};const b=!!g.data.imageUrl||!!g.data.serverNodeId;return{...g,data:{...g.data,pendingRequestId:null,pendingPhase:null,pendingStartedAt:null,partialImageUrl:null,status:b?"ready":"stale",error:b?void 0:ee("session.assetAbortedError")}}});n({graphNodes:y})}await Jg(o,n).catch(()=>{})},async createAndSwitchSession(i){i==null&&(i=ee("session.untitled"));try{const{session:r}=await uS(i);n({sessions:[r,...o().sessions],activeSessionId:r.id,activeSessionGraphVersion:r.graphVersion,graphNodes:[],graphEdges:[]}),hu(r.id)}catch(r){console.warn("[sessions] create failed:",r),o().showToast(ee("toast.sessionCreateFailed"),!0)}},async renameCurrentSession(i){const r=o().activeSessionId;if(r)try{await dS(r,i),n({sessions:o().sessions.map(c=>c.id===r?{...c,title:i,updatedAt:Date.now()}:c)})}catch{o().showToast(ee("toast.sessionRenameFailed"),!0)}},async deleteSessionById(i){try{await fS(i);const r=o().sessions.filter(c=>c.id!==i);n({sessions:r}),o().activeSessionId===i&&(n({activeSessionId:null,activeSessionGraphVersion:null,graphNodes:[],graphEdges:[]}),hu(null),r.length>0?await o().switchSession(r[0].id):await o().createAndSwitchSession(ee("session.firstGraph")))}catch{o().showToast(ee("toast.sessionDeleteFailed"),!0)}},scheduleGraphSave(){Wg(o,n)},async flushGraphSave(i="manual"){await M1(o,n,i)},addRootNode:()=>{const i=En(),r={id:i,type:"imageNode",position:du(o().graphNodes),data:{clientId:i,serverNodeId:null,parentServerNodeId:null,prompt:"",imageUrl:null,status:"empty",pendingRequestId:null,pendingPhase:null}};return n({graphNodes:[...o().graphNodes,r]}),o().scheduleGraphSave(),i},createRootNodeFromHistoryItem:i=>{const r=En(),c={id:r,type:"imageNode",position:du(o().graphNodes),data:{clientId:r,serverNodeId:i.nodeId??null,parentServerNodeId:null,prompt:i.prompt??"",imageUrl:i.image,status:"ready",pendingRequestId:null,pendingPhase:null,model:i.model??null,size:i.size??null,elapsed:i.elapsed??void 0,video:i.video??null}};return n({uiMode:"node",graphNodes:[...o().graphNodes,c]}),o().scheduleGraphSave(),r},addChildNode:i=>{const r=o().graphNodes.find(m=>m.id===i);if(!r)return i;const c=En(),f={id:c,type:"imageNode",position:ph(r,o().graphNodes,o().graphEdges),data:{clientId:c,serverNodeId:null,parentServerNodeId:r.data.serverNodeId,prompt:ln(r.data.imageUrl)&&r.data.prompt||"",imageUrl:null,status:"empty",pendingRequestId:null,pendingPhase:null}},p={id:yr(i,c,Sl,Ai),source:i,target:c,sourceHandle:Sl,targetHandle:Ai};if(n({graphNodes:[...o().graphNodes,f],graphEdges:[...o().graphEdges,p]}),o().scheduleGraphSave(),r.data.imageUrl&&ln(r.data.imageUrl)){const m=r.data.imageUrl;r.data.video&&r.data.video.topic&&o().setVideoTopic(r.data.video.topic),(async()=>{try{const y=await Di(m);n({graphNodes:o().graphNodes.map(g=>g.id===c?{...g,data:{...g.data,referenceImages:[y]}}:g)}),o().scheduleGraphSave()}catch{}})()}return c},addSiblingNode:i=>{const r=o().graphNodes.find(x=>x.id===i);if(!r)return i;const c=o().graphEdges.find(x=>x.target===i);if(!c){const x=En(),S={id:x,type:"imageNode",position:du(o().graphNodes),data:{clientId:x,serverNodeId:null,parentServerNodeId:null,prompt:r.data.prompt,imageUrl:null,status:"empty",pendingRequestId:null,pendingPhase:null}};return n({graphNodes:[...o().graphNodes,S]}),o().scheduleGraphSave(),x}const f=c.source,p=o().graphNodes.find(x=>x.id===f);if(!p)return i;const m=En(),y={id:m,type:"imageNode",position:ph(p,o().graphNodes,o().graphEdges),data:{clientId:m,serverNodeId:null,parentServerNodeId:r.data.parentServerNodeId,prompt:r.data.prompt,imageUrl:null,status:"empty",pendingRequestId:null,pendingPhase:null}},g={id:yr(f,m,Sl,Ai),source:f,target:m,sourceHandle:Sl,targetHandle:Ai};return n({graphNodes:[...o().graphNodes,y],graphEdges:[...o().graphEdges,g]}),o().scheduleGraphSave(),m},updateNodePrompt:(i,r)=>{n({graphNodes:o().graphNodes.map(c=>c.id===i?{...c,data:{...c.data,prompt:r}}:c)}),o().scheduleGraphSave()},addNodeReferences:async(i,r)=>{const c=o().graphNodes.find(N=>N.id===i);if(!c)return;const f=c.data.referenceImages??[],p=Qt-f.length;if(p<=0){o().showToast(ee("toast.refLimitExceeded"),!0);return}const m=r.slice(0,Math.max(0,p)),y=m.filter(cr),g=m.filter(N=>!cr(N)),S=(await Promise.all(g.map(async N=>{try{return await bu(N,{preserveTransparency:ah(N)})}catch(_){return console.warn("[addNodeReferences] compress failed",_),null}}))).filter(N=>!!N);if(S.length>0){const N=o().activeSessionId;n({graphNodes:o().graphNodes.map(_=>{if(_.id!==i)return _;const M=[..._.data.referenceImages??[],...S].slice(0,Qt);return wr(N,i,M),{..._,data:{..._.data,referenceImages:M}}})}),o().scheduleGraphSave()}y.length>0&&o().showToast(ee("toast.refHeicUnsupported"),!0),g.length-S.length>0&&o().showToast(ee("toast.refTooLarge"),!0),r.length>p&&o().showToast(ee("toast.refLimitExceeded"),!0)},addNodeReferenceDataUrl:(i,r)=>{o().graphNodes.find(f=>f.id===i)&&(n({graphNodes:o().graphNodes.map(f=>{if(f.id!==i)return f;const p=f.data.referenceImages??[];if(p.length>=Qt)return f;const m=[...p,r];return wr(o().activeSessionId,i,m),{...f,data:{...f.data,referenceImages:m}}})}),o().scheduleGraphSave())},removeNodeReference:(i,r)=>{n({graphNodes:o().graphNodes.map(c=>{if(c.id!==i)return c;const f=(c.data.referenceImages??[]).filter((p,m)=>m!==r);return wr(o().activeSessionId,i,f),{...c,data:{...c.data,referenceImages:f}}})}),o().scheduleGraphSave()},clearNodeReferences:i=>{fu(o().activeSessionId,i),n({graphNodes:o().graphNodes.map(r=>r.id===i?{...r,data:{...r.data,referenceImages:void 0}}:r)}),o().scheduleGraphSave()},duplicateBranchRoot:i=>{const r=o().graphNodes.find(p=>p.id===i);if(!r)return i;const c=En();o().graphNodes.filter(p=>!p.data.parentServerNodeId).length;const f={id:c,type:"imageNode",position:{x:r.position.x+420,y:r.position.y+40},data:{clientId:c,serverNodeId:null,parentServerNodeId:null,prompt:r.data.prompt,imageUrl:null,status:"empty",pendingRequestId:null,pendingPhase:null}};if(n({graphNodes:[...o().graphNodes,f]}),o().scheduleGraphSave(),r.data.imageUrl){const p=r.data.imageUrl;(async()=>{try{const m=await gr(p,"node-reference.png");n({graphNodes:o().graphNodes.map(y=>y.id===c?{...y,data:{...y.data,referenceImages:[m]}}:y)})}catch{}})()}return c},async generateNode(i){const r=o().graphNodes.find(p=>p.id===i);if(!r)return;const{prompt:c}=r.data;if(!c.trim()){o().showToast(ee("toast.promptRequired"),!0);return}if(o().videoModelSelected)return o().runVideoGenerate(i);const f=vr(o(),{kind:"node",clientId:i});if(f){n({customSizeConfirm:f});return}await o().runGenerateNode(i)},async generateNodeInPlace(i){const r=o().graphNodes.find(f=>f.id===i);if(!r)return;if(!r.data.prompt.trim()){o().showToast(ee("toast.promptRequired"),!0);return}if(o().videoModelSelected)return o().runVideoGenerate(i);const c=vr(o(),{kind:"node-in-place",clientId:i});if(c){n({customSizeConfirm:c});return}await o().runGenerateNodeInPlace(i)},async generateNodeVariation(i,r){const c=o().graphNodes.find(p=>p.id===i);if(!c)return;if(!c.data.prompt.trim()){o().showToast(ee("toast.promptRequired"),!0);return}if(o().videoModelSelected){const p=o().addSiblingNode(i);return o().runVideoGenerate(p)}if(!r){const p=vr(o(),{kind:"node-variation",clientId:i});if(p){n({customSizeConfirm:p});return}}const f=o().addSiblingNode(i);await o().runGenerateNodeInPlace(f,{sizeOverride:r})},async runGenerateNode(i,r){const f=o().graphNodes.find(p=>p.id===i)?.data.status==="ready"?o().addSiblingNode(i):i;await o().runGenerateNodeInPlace(f,{sizeOverride:r})},async runGenerateNodeInPlace(i,r={}){if(bl.has(i))return null;bl.add(i);const c=o().graphNodes,f=an(c,o().graphEdges);f.some((k,$)=>k.data.parentServerNodeId!==c[$]?.data.parentServerNodeId)&&n({graphNodes:f});const p=f.find(k=>k.id===i);if(!p)return bl.delete(i),null;const{prompt:m,parentServerNodeId:y}=p.data;if(!m.trim())return o().showToast(ee("toast.promptRequired"),!0),bl.delete(i),null;const g=p.data.referenceImages??[],x=o(),S=r.sizeOverride??x.getResolvedSize(),b=r.parentServerNodeIdOverride!==void 0?r.parentServerNodeIdOverride:y;if(o().graphEdges.find(k=>k.target===i)&&!b)return o().showToast(ee("node.parentImageRequired"),!0),bl.delete(i),null;const _=x.activeSessionId,M=Date.now(),I=Math.random().toString(36).slice(2,6),G=`fn_${i}_${M}_${I}`,L=[...x.inFlight,{id:G,prompt:m,startedAt:M,kind:"node",sessionId:_,clientNodeId:i}];Et(L),n({graphNodes:o().graphNodes.map(k=>k.id===i?{...k,data:{...k.data,status:"pending",pendingRequestId:G,recoveryRequestId:G,pendingPhase:"queued",pendingStartedAt:M,partialImageUrl:null,error:void 0,size:S}}:k),activeGenerations:x.activeGenerations+1,inFlight:L}),o().startInFlightPolling();let O=!0;try{const k=await Zb({parentNodeId:b,prompt:m,quality:x.quality,size:S,format:x.format,moderation:x.moderation,provider:x.provider,model:x.imageModel,reasoningEffort:x.reasoningEffort,storyboard:x.storyboardActive||void 0,requestId:G,sessionId:_,clientNodeId:i,contextMode:"parent-plus-refs",searchMode:x.webSearchEnabled?"on":"off",webSearchEnabled:x.webSearchEnabled,...g.length?{references:g.map(gu)}:{}},{onPartial:$=>{o().activeSessionId===_&&n({graphNodes:o().graphNodes.map(K=>K.id===i?{...K,data:{...K.data,status:"pending",partialImageUrl:$.image,pendingPhase:"partial"}}:K)})},onPhase:$=>{o().activeSessionId===_&&$.phase&&n({graphNodes:o().graphNodes.map(K=>K.id===i?{...K,data:{...K.data,pendingPhase:$.phase??K.data.pendingPhase}}:K)})}});return o().activeSessionId===_&&(n({graphNodes:o().graphNodes.map($=>{if($.id!==i)return $;const K={...$.data};return delete K.partialImageUrl,{...$,data:{...K,serverNodeId:k.nodeId,imageUrl:k.url,status:"ready",pendingRequestId:null,recoveryRequestId:null,pendingPhase:null,pendingStartedAt:null,elapsed:k.elapsed,reasoningEffort:k.reasoningEffort,webSearchCalls:k.webSearchCalls,model:k.model??null,size:k.size??S}}})}),O=!0,r.suppressToast||o().showToast(ee("toast.nodeCreated",{id:k.nodeId.slice(0,8),elapsed:k.elapsed}))),k.nodeId}catch(k){const $=k instanceof Error?k.message:ee("toast.nodeCreateFailed");return o().activeSessionId===_&&(n({graphNodes:o().graphNodes.map(K=>K.id===i?{...K,data:{...K.data,status:"error",pendingRequestId:null,pendingPhase:null,pendingStartedAt:null,partialImageUrl:null,error:$}}:K)}),O=!0,Ni(k,o())),null}finally{bl.delete(i);const k=o().inFlight.filter($=>$.id!==G);Et(k),n({activeGenerations:Math.max(0,o().activeGenerations-1),inFlight:k}),o().activeSessionId===_&&O&&(o().scheduleGraphSave(),o().flushGraphSave("node-complete"))}},async runNodeBatch(i){if(o().nodeBatchRunning)return;const r=Nu(o().graphNodes);if(r.length===0){o().showToast(ee("nodeBatch.noneSelected"),!0);return}const c=Ux(o().graphNodes,o().graphEdges,r);if(c.length>0){o().showToast(ee("nodeBatch.parentRequired",{count:c.length}),!0);return}const f=qx(o().graphNodes,o().graphEdges,r),p=new Set(r),m=f.filter(x=>{if(i==="regenerate-all")return!0;const S=o().graphNodes.find(b=>b.id===x);return S?!Gx(S):!1});if(m.length===0){o().showToast(ee("nodeBatch.nothingToRun"));return}n({nodeBatchRunning:!0,nodeBatchStopping:!1});const y=new Map;let g=0;try{for(const x of m){if(o().nodeBatchStopping)break;const S=o().graphEdges.find(I=>I.target===x),b=S?y.get(S.source)??o().graphNodes.find(I=>I.id===x)?.data.parentServerNodeId??null:null,N=o().videoModelSelected?await o().runVideoGenerate(x).then(()=>o().graphNodes.find(G=>G.id===x)?.data.serverNodeId??null):await o().runGenerateNodeInPlace(x,{parentServerNodeIdOverride:b,suppressToast:!0});if(!N){o().showToast(ee("nodeBatch.failed",{done:g,total:m.length}),!0);break}g+=1,y.set(x,N);const _=Px(o().graphEdges,x,p),M=new Set(Hx(o().graphEdges,p));n({graphNodes:o().graphNodes.map(I=>M.has(I.id)?{...I,data:{...I.data,status:"stale",parentServerNodeId:_.includes(I.id)?N:I.data.parentServerNodeId,error:ee("nodeBatch.staleBecauseParentChanged")}}:I)})}o().showToast(ee("nodeBatch.finished",{done:g,total:m.length})),o().scheduleGraphSave()}finally{n({nodeBatchRunning:!1,nodeBatchStopping:!1})}},deleteNode:i=>{const c=o().graphNodes.find(m=>m.id===i)?.data?.pendingRequestId;c&&ou(c),fu(o().activeSessionId,i);const f=o().graphNodes.filter(m=>m.id!==i),p=o().graphEdges.filter(m=>m.source!==i&&m.target!==i);n({graphNodes:an(f,p),graphEdges:p}),o().scheduleGraphSave()},deleteNodes:i=>{const r=new Set(i);for(const p of r)fu(o().activeSessionId,p);for(const p of o().graphNodes)r.has(p.id)&&p.data?.pendingRequestId&&ou(p.data.pendingRequestId);const c=o().graphNodes.filter(p=>!r.has(p.id)),f=o().graphEdges.filter(p=>!r.has(p.source)&&!r.has(p.target));n({graphNodes:an(c,f),graphEdges:f}),o().scheduleGraphSave()},addChildNodeAt:(i,r,c=Sl)=>{const f=o().graphNodes.find(S=>S.id===i);if(!f)return i;const p=En(),m=h1(c,"source")??Sl,y=g1(m)??Ai,g={id:p,type:"imageNode",position:r,data:{clientId:p,serverNodeId:null,parentServerNodeId:f.data.serverNodeId,prompt:"",imageUrl:null,status:"empty",pendingRequestId:null,pendingPhase:null}},x={id:yr(i,p,m,y),source:i,target:p,sourceHandle:m,targetHandle:y};return n({graphNodes:[...o().graphNodes,g],graphEdges:[...o().graphEdges,x]}),o().scheduleGraphSave(),p},connectNodes:(i,r,c=null,f=null)=>{if(i===r||o().graphEdges.find(g=>g.source===i&&g.target===r))return;if(Ix(o().graphEdges,i,r)){o().showToast(ee("edge.parentConflict"),!0);return}if(!o().graphNodes.find(g=>g.id===i))return;const y=[...o().graphEdges,{id:yr(i,r,c,f),source:i,target:r,sourceHandle:c,targetHandle:f}];n({graphNodes:an(o().graphNodes,y),graphEdges:y}),o().scheduleGraphSave()},setProvider:i=>{Qe({provider:i});const r=o().imageModel;if(!(i==="grok"||i==="grok-api")&&o().videoModelSelected&&(n({videoModelSelected:!1}),vl({model:!1})),(i==="grok"||i==="grok-api")&&!Ar(r)){const f="grok-imagine-image";_i(f),n({provider:i,imageModel:f})}else if((i==="agy"||i==="gemini-api")&&!Mi(r)){const f=i==="gemini-api"?"nano-banana-pro":"nano-banana-2";_i(f),n({provider:i,imageModel:f})}else i!=="grok"&&i!=="grok-api"&&i!=="agy"&&i!=="gemini-api"&&(Ar(r)||Mi(r))?(n({provider:i,imageModel:Su}),_i(Su)):n({provider:i})},setQuality:i=>{Qe({quality:i}),n({quality:i})},setSizePreset:i=>{Qe({sizePreset:i}),n({sizePreset:i})},setCustomSize:(i,r)=>n(c=>{const f=sa(i,c.customW),p=sa(r,c.customH);return Qe({customW:f,customH:p}),{customW:f,customH:p}}),setGrokAspectRatio:i=>{Qe({grokAspectRatio:i}),n({grokAspectRatio:i})},setGrokResolution:i=>{Qe({grokResolution:i}),n({grokResolution:i})},setFormat:i=>{Qe({format:i}),n({format:i})},setModeration:i=>{Qe({moderation:i}),n({moderation:i})},setImageModel:i=>{if(_i(i),n({videoModelSelected:!1}),vl({model:!1}),Ar(i)){Qe({provider:"grok"}),n({provider:"grok",imageModel:i});return}if(Mi(i)){const r=o().provider;r!=="agy"&&r!=="gemini-api"?(Qe({provider:"agy"}),n({provider:"agy",imageModel:i})):n({imageModel:i});return}if(o().provider==="grok"||o().provider==="agy"||o().provider==="gemini-api"){Qe({provider:"oauth"}),n({provider:"oauth",imageModel:i});return}n({imageModel:i})},videoModelSelected:wi.model,videoDuration:wi.duration,videoResolution:wi.resolution,videoAspectRatio:wi.aspectRatio,videoTopic:"",videoContinuityLineage:null,videoProgress:null,selectVideoModel:i=>{const r=i||"grok-imagine-video";n({videoModelSelected:r}),vl({model:r}),o().provider!=="grok"&&o().setProvider("grok")},setVideoDuration:i=>{n({videoDuration:i}),vl({duration:i})},setVideoResolution:i=>{n({videoResolution:i}),vl({resolution:i})},setVideoAspectRatio:i=>{n({videoAspectRatio:i}),vl({aspectRatio:i})},setVideoTopic:i=>n({videoTopic:i}),setVideoContinuityLineage:i=>n({videoContinuityLineage:i}),activeVideoRefCount:()=>{const i=o();if(i.uiMode==="node"){const r=Nu(i.graphNodes)[0];return i.graphNodes.find(f=>f.id===r)?.data.referenceImages?.length??0}return i.referenceImages.length},runVideoGenerate:async i=>{const r=i?o().graphNodes.find(M=>M.id===i):null,c=r?r.data.referenceImages??[]:o().referenceImages,f=sg(c.length),p=r?r.data.prompt.trim():pr(o().prompt,o().insertedPrompts);if(!p.trim()){o().showToast(Rr,!0);return}let m,y,g=r?r.data.videoContinuity??null:o().videoContinuityLineage,x;if(r&&c.length===0&&r.data.parentServerNodeId){const M=o().graphNodes.find(I=>I.data.serverNodeId===r.data.parentServerNodeId);if(M?.data.imageUrl)if(ln(M.data.imageUrl))try{y=await Di(M.data.imageUrl),g=M.data.videoContinuity??jg({filename:M.data.imageUrl.replace(/^\/generated\//,""),prompt:M.data.prompt,userPrompt:M.data.prompt,revisedPrompt:M.data.prompt,createdAt:Date.now(),videoContinuity:null}),x=M.data.imageUrl.replace(/^\/generated\//,"")}catch{}else m=M.data.imageUrl.replace(/^\/generated\//,"")}const S=Date.now(),b=`vid_${S}_${Math.random().toString(36).slice(2,6)}`,N=o().activeSessionId,_=[...o().inFlight,{id:b,prompt:p,startedAt:S,kind:"video",sessionId:N,clientNodeId:i??null}];Et(_),r&&n({graphNodes:o().graphNodes.map(M=>M.id===i?{...M,data:{...M.data,status:"pending",pendingRequestId:b,pendingPhase:"queued",pendingStartedAt:S,partialImageUrl:null,error:void 0}}:M)}),n({inFlight:_,activeGenerations:_.length,videoProgress:0}),o().startInFlightPolling();try{const M=await Wp({prompt:p,requestId:b,model:typeof o().videoModelSelected=="string"&&o().videoModelSelected||void 0,referenceImages:c.length>=2?c:void 0,sourceImage:c.length===1?c[0]:y,sourceFilename:c.length===0&&!y?m:void 0,continueFromVideo:x,continuityLineage:g,duration:Ex(o().videoDuration,f),resolution:o().videoResolution,aspectRatio:o().videoAspectRatio,topic:o().videoTopic||void 0,storyboard:o().storyboardActive||void 0,sessionId:N,clientNodeId:i??null},{onPlanning:()=>n({inFlight:o().inFlight.map(I=>I.id===b?{...I,phase:"planning"}:I)}),onSubmitted:()=>n({inFlight:o().inFlight.map(I=>I.id===b?{...I,phase:"streaming"}:I)}),onProgress:({progress:I})=>n({videoProgress:I??null})});r&&M&&o().activeSessionId===N&&(n({graphNodes:o().graphNodes.map(I=>I.id===i?{...I,data:{...I.data,serverNodeId:M.filename.replace(/\.[^.]+$/,""),imageUrl:M.url,status:"ready",pendingRequestId:null,pendingPhase:null,pendingStartedAt:null,elapsed:M.elapsed??void 0,model:null,videoContinuity:M.videoContinuity??g,video:{...M.video??{},...M.videoSeries?.topic?{topic:M.videoSeries.topic}:{}}}}:I)}),o().scheduleGraphSave(),o().flushGraphSave("video-node-complete"))}catch(M){const I=M instanceof Error?M.message:"Video generation failed";r&&o().activeSessionId===N&&n({graphNodes:o().graphNodes.map(G=>G.id===i?{...G,data:{...G.data,status:"error",pendingRequestId:null,pendingPhase:null,pendingStartedAt:null,error:I}}:G)}),o().showToast(I,!0)}finally{const M=o().inFlight.filter(I=>I.id!==b);Et(M),n({inFlight:M,activeGenerations:M.length,videoProgress:null}),o().startInFlightPolling()}},animateImage:async(i,r)=>{const c=r?.trim();if(!c)throw o().showToast(Rr,!0),new Error(Rr);const f=Date.now(),p=`vid_${f}_${Math.random().toString(36).slice(2,6)}`,m=[...o().inFlight,{id:p,prompt:c,startedAt:f,kind:"video",sessionId:o().activeSessionId,clientNodeId:null}];Et(m),n({inFlight:m,activeGenerations:m.length,videoProgress:0}),o().startInFlightPolling();try{await Wp({prompt:c,requestId:p,mode:"image-to-video",sourceFilename:i,duration:5,resolution:"480p",aspectRatio:"auto"},{onPlanning:()=>n({inFlight:o().inFlight.map(y=>y.id===p?{...y,phase:"planning"}:y)}),onSubmitted:()=>n({inFlight:o().inFlight.map(y=>y.id===p?{...y,phase:"streaming"}:y)}),onProgress:({progress:y})=>n({videoProgress:y??null})})}catch(y){const g=y instanceof Error?y.message:"Video generation failed";o().showToast(g,!0)}finally{const y=o().inFlight.filter(g=>g.id!==p);Et(y),n({inFlight:y,activeGenerations:y.length,videoProgress:null}),o().startInFlightPolling()}},setReasoningEffort:i=>{s1(i),n({reasoningEffort:i})},setWebSearchEnabled:i=>{u1(i),n({webSearchEnabled:i})},setCount:i=>{const r=ji(i);Qe({count:r}),n({count:r})},setMultimode:i=>{if(i&&o().uiMode!=="classic")return;Qe({multimode:i});const r=o();n({multimode:i,multimodeSequences:i?r.multimodeSequences:{},multimodePreviewFlightId:i?r.multimodePreviewFlightId:null})},setMultimodeMaxImages:i=>{const r=ji(i);Qe({multimodeMaxImages:r}),n({multimodeMaxImages:r})},setPromptMode:i=>{Qe({promptMode:i}),n({promptMode:i})},setPrompt:i=>{Qe({prompt:i}),n({prompt:i})},insertPromptToComposer:i=>n(r=>{const c=r.insertedPrompts.some(m=>m.id===i.id),f={...i,placement:i.placement==="after"?"after":"before"},p=c?r.insertedPrompts:[...r.insertedPrompts,f];return Qe({insertedPrompts:p}),{insertedPrompts:p}}),removeInsertedPromptFromComposer:i=>n(r=>{const c=r.insertedPrompts.filter(f=>f.id!==i);return Qe({insertedPrompts:c}),{insertedPrompts:c,videoContinuityLineage:i.startsWith("video-continuity:")?null:r.videoContinuityLineage}}),moveInsertedPromptInComposer:(i,r)=>n(c=>{const f=c.insertedPrompts.filter(N=>N.placement!=="after"),p=c.insertedPrompts.filter(N=>N.placement==="after"),m=[...f.map(N=>({kind:"prompt",prompt:N})),{kind:"main"},...p.map(N=>({kind:"prompt",prompt:N}))],y=m.findIndex(N=>N.kind==="prompt"&&N.prompt.id===i);if(y<0)return{};const g=r==="up"?y-1:y+1;if(g<0||g>=m.length)return{};const[x]=m.splice(y,1);m.splice(g,0,x);const S=m.findIndex(N=>N.kind==="main"),b=m.filter(N=>N.kind==="prompt").map((N,_)=>({...N.prompt,placement:_<S?"before":"after"}));return Qe({insertedPrompts:b}),{insertedPrompts:b}}),clearInsertedPrompts:()=>{Qe({insertedPrompts:[]}),n({insertedPrompts:[],videoContinuityLineage:null})},selectHistory:i=>{const r=o().history,c=i.canvasVersion?ia(r,i)??Mn(r)[0]??null:ia(r,i)??i;oa(c?.filename??null);const f=zi(o().workspaceProfile).restoreComposerFromHistory,p=o().prompt,m=o().insertedPrompts,y=p.trim()!==""||m.length>0,g=f&&c&&!y?f1(c):{},x=o().multimodePreviewFlightId,S=x?o().multimodeSequences[x]:null,b=S&&c&&S.images.some(N=>N.filename===c.filename);n({currentImage:c,unseenGeneratedCount:0,multimodePreviewFlightId:b?x:null,...g})},showHistorySequence:i=>{const r=o().history.filter(y=>y.sequenceId===i&&!y.canvasVersion).sort(Mg);if(r.length===0)return;const c=`history:${i}`,f=Math.max(r.length,...r.map(y=>y.sequenceTotalRequested??0)),p=r.length,m=r[0]?.sequenceStatus==="empty"?"empty":p>=f?"complete":"partial";oa(null),n(y=>({currentImage:null,unseenGeneratedCount:0,canvasOpen:!1,multimodePreviewFlightId:c,multimodeSequences:{...y.multimodeSequences,[c]:{sequenceId:i,requestId:c,requested:f,returned:p,images:r,partials:[],status:m}}}))},markGeneratedResultsSeen:()=>n({unseenGeneratedCount:0}),selectHistoryShortcutTarget:i=>{const r=o(),c=zi(r.workspaceProfile);if(r.uiMode==="classic"&&c.multimodeHistoryGrouping==="sequence"){const p=Qx(r.history,r.currentImage,i,v1(r));if(!p)return;if(p.type==="sequence"){o().showHistorySequence(p.sequenceId);return}o().selectHistory(p.item);return}const f=Yx(r.history,r.currentImage,i);f&&o().selectHistory(f)},trashHistoryItem:async i=>{const r=i.canvasVersion?ia(o().history,i):i;if(!r||r.canvasVersion||!r.filename){o().showToast(ee("gallery.deleteFailed"),!0);return}const c=r.filename,f=o().currentImage,m=(f?ia(o().history,f)??f:null)?.filename===c,y=m?gh(o().history,c):f;try{await $p(c),n(g=>{const x=y1(g.multimodeSequences,c),S=g.multimodePreviewFlightId&&!x[g.multimodePreviewFlightId]?null:g.multimodePreviewFlightId;return{history:g.history.filter(b=>b.filename!==c),currentImage:y,multimodePreviewFlightId:S,multimodeSequences:x,trashPending:null}}),m&&oa(y?.filename??null),o().showToast(ee("gallery.movedToSystemTrash",{filename:c}))}catch(g){console.error("[history] trash failed",g),o().showToast(ee("gallery.deleteFailed"),!0)}},trashHistorySequence:async i=>{const r=o().history.filter(g=>g.sequenceId===i&&!g.canvasVersion&&!!g.filename);if(r.length===0){o().showToast(ee("gallery.deleteFailed"),!0);return}if(!window.confirm(ee("history.deleteSequenceConfirm",{count:r.length})))return;const f=new Set(r.map(g=>g.filename).filter(g=>!!g)),p=o().currentImage,m=!!(p?.filename&&f.has(p.filename)),y=o().multimodePreviewFlightId===`history:${i}`||o().multimodePreviewFlightId===i;try{for(const g of f)await $p(g);n(g=>{const x={...g.multimodeSequences};return delete x[`history:${i}`],delete x[i],{history:g.history.filter(S=>!S.filename||!f.has(S.filename)),currentImage:m?null:g.currentImage,multimodePreviewFlightId:y?null:g.multimodePreviewFlightId,multimodeSequences:x,trashPending:null}}),m&&oa(null),o().showToast(ee("history.sequenceDeleted",{count:f.size}))}catch(g){console.error("[history] sequence trash failed",g),o().showToast(ee("gallery.deleteFailed"),!0)}},restorePendingTrash:async()=>{const i=o().trashPending;if(i)try{await oS(i.filename,i.trashId),o().addHistoryItem(i.item),n({trashPending:null})}catch(r){console.error("[history] restore failed",r),o().showToast(ee("gallery.restoreFailed"),!0)}},clearPendingTrash:()=>n({trashPending:null}),permanentlyDeleteHistoryItemByClick:async i=>{await o().permanentlyDeleteHistoryItemByShortcut(i)},permanentlyDeleteHistoryItemByShortcut:async i=>{const r=i.canvasVersion?ia(o().history,i):i;if(!r||r.canvasVersion||!r.filename){o().showToast(ee("gallery.deleteFailed"),!0);return}const c=r.filename;if(!window.confirm(ee("result.permanentDeleteConfirm",{filename:c})))return;const p=o().currentImage,y=(p?ia(o().history,p)??p:null)?.filename===c,g=y?gh(o().history,c):p;try{await iS(c),n(x=>({history:x.history.filter(S=>S.filename!==c),currentImage:g,trashPending:x.trashPending?.filename===c?null:x.trashPending})),y&&oa(g?.filename??null),o().showToast(ee("gallery.permanentDeleted",{filename:c}))}catch(x){console.error("[history] permanent delete failed",x),o().showToast(ee("gallery.deleteFailed"),!0)}},removeFromHistory:i=>{const r=o(),c=r.history.filter(p=>p.filename!==i),f=r.currentImage&&r.currentImage.filename===i?null:r.currentImage;n({history:c,currentImage:f}),f===null&&oa(null)},addHistoryItem:i=>{const r=o(),c={...i,createdAt:i.createdAt||Date.now()},f=Gg(r.history,c),p=qg(c,f),m=Lg(r.history,p);n({history:Ir([p,...m],r.loadedHistoryRetainLimit+1),loadedHistoryRetainLimit:Math.max(r.loadedHistoryRetainLimit,Math.min(r.history.length+1,r.loadedHistoryRetainLimit+1))})},importLocalImageToHistory:async i=>{if(!i.type||!/^image\/(png|jpeg|webp)$/.test(i.type))return o().showToast(ee("toast.localImportInvalid"),!0),null;try{const r=await bS(i);return o().addHistoryItem(r),n({currentImage:r,unseenGeneratedCount:0}),r.filename&&oa(r.filename),o().showToast(ee("toast.localImportSuccess")),r}catch{return o().showToast(ee("toast.localImportFailed"),!0),null}},getResolvedSize:()=>{const{provider:i,sizePreset:r,customW:c,customH:f,grokAspectRatio:p,grokResolution:m}=o();return i==="grok"||i==="grok-api"?`grok:${p}:${m}`:r==="custom"?`${c}x${f}`:r},async generate(){const i=o();if(!pr(i.prompt,i.insertedPrompts))return;if(i.videoModelSelected)return o().runVideoGenerate();const c=i.uiMode==="classic"&&i.multimode,f=vr(i,{kind:c?"multimode":"classic"});if(f){n({customSizeConfirm:f});return}if(c){await o().generateMultimode();return}await o().runGenerate()},async generateMultimode(i){const r=o();if(r.uiMode!=="classic")return;const c=pr(r.prompt,r.insertedPrompts);if(!c)return;const f=r.prompt,p=_u(r.insertedPrompts),m=i??r.getResolvedSize(),y=`mm_${Date.now()}_${Math.random().toString(36).slice(2,7)}`,g=new AbortController,x=Date.now(),S=ji(r.multimodeMaxImages),b=[...r.inFlight,{id:y,prompt:c,startedAt:x,kind:"multimode",composerPrompt:f,composerInsertedPrompts:p}],N={sequenceId:y,requestId:y,requested:S,returned:0,images:[],partials:[],status:"pending"};Et(b),n({activeGenerations:r.activeGenerations+1,inFlight:b,multimodeAbortControllers:{...r.multimodeAbortControllers,[y]:g},multimodeSequences:{...r.multimodeSequences,[y]:N},multimodePreviewFlightId:y}),o().startInFlightPolling();try{const _=await eS({prompt:c,quality:r.quality,size:m,format:r.format,moderation:r.moderation,provider:r.provider,maxImages:S,model:r.imageModel,reasoningEffort:r.reasoningEffort,webSearchEnabled:r.webSearchEnabled,requestId:y,mode:r.promptMode,composerPrompt:f,composerInsertedPrompts:p,...r.referenceImages.length?{references:r.referenceImages.map(gu)}:{}},{onPartial:G=>{n(L=>{const O=L.multimodeSequences[y];return O?{multimodeSequences:{...L.multimodeSequences,[y]:{...O,partials:[...O.partials,{image:G.image,index:G.index??null}].slice(-S)}}}:{}})},onImage:G=>{n(L=>{const O=L.multimodeSequences[y];if(!O)return{};const k=Mh(O.images,[G]);return k.length===O.images.length?{}:{multimodeSequences:{...L.multimodeSequences,[y]:{...O,sequenceId:G.sequenceId??O.sequenceId,returned:k.length,images:k,status:"partial"}}}})}},{signal:g.signal}),M=_.images.map(G=>({...G,prompt:c,elapsed:Number.parseFloat(_.elapsed),provider:_.provider,usage:_.usage,requestId:G.requestId??_.requestId??y,composerPrompt:f,composerInsertedPrompts:p,quality:_.quality??r.quality,size:_.size??m,model:_.model??r.imageModel}));for(const G of M)await br(G,n,o);n(G=>({multimodeSequences:{...G.multimodeSequences,[y]:(()=>{const L=G.multimodeSequences[y],O=Mh(L?.images??[],M);return{sequenceId:_.sequenceId,requestId:y,requested:_.requested,returned:O.length,images:O,partials:[],status:_.status,elapsed:_.elapsed}})()}}));const I=_.status==="complete"?"multimode.complete":"multimode.partial";o().showToast(ee(I,{returned:_.returned,requested:_.requested,elapsed:_.elapsed}))}catch(_){_.name==="AbortError"||Ch(_)?n(M=>{const I=M.multimodeSequences[y];return I?{multimodeSequences:{...M.multimodeSequences,[y]:{...I,status:"canceled"}}}:{}}):(n(M=>{const I=M.multimodeSequences[y];return I?{multimodeSequences:{...M.multimodeSequences,[y]:{...I,status:"error",error:_.message}}}:{}}),Ni(_,o()))}finally{const _=o().inFlight.filter(M=>M.id!==y);Et(_),n(M=>{const I={...M.multimodeAbortControllers};delete I[y];let G=M.multimodePreviewFlightId;const L=M.multimodeSequences[y]?.status,O=L==="complete"||L==="partial";if(G===y&&!O){const $=Object.keys(I);G=$.length>0?$[$.length-1]:null}const k={...M.multimodeSequences};return O&&G!==y&&delete k[y],{activeGenerations:Math.max(0,M.activeGenerations-1),inFlight:_,multimodeAbortControllers:I,multimodePreviewFlightId:G,multimodeSequences:k}})}},cancelMultimode:()=>{const i=o().multimodePreviewFlightId;i&&(o().multimodeAbortControllers[i]?.abort(),o().cancelInFlightJob(i),n(r=>{const c=r.multimodeSequences[i];return c?{multimodeSequences:{...r.multimodeSequences,[i]:{...c,status:"canceled"}}}:{}}))},async runGenerate(i){const r=o(),c=pr(r.prompt,r.insertedPrompts);if(!c)return;const f=r.prompt,p=_u(r.insertedPrompts),m=i??r.getResolvedSize(),y=`f_${Date.now()}_${Math.random().toString(36).slice(2,7)}`,g=Date.now(),x=[...r.inFlight,{id:y,prompt:c,startedAt:g,composerPrompt:f,composerInsertedPrompts:p}];Et(x),n({activeGenerations:r.activeGenerations+1,inFlight:x}),o().startInFlightPolling();try{const S={prompt:c,quality:r.quality,size:m,format:r.format,moderation:r.moderation,provider:r.provider,n:r.count,model:r.imageModel,reasoningEffort:r.reasoningEffort,storyboard:r.storyboardActive||void 0,webSearchEnabled:r.webSearchEnabled,requestId:y,mode:r.promptMode,composerPrompt:f,composerInsertedPrompts:p,...r.referenceImages.length?{references:r.referenceImages.map(gu)}:{}},b=await Wb(S);if(Jp(b)&&b.images.length>1){for(const N of b.images){const _={image:N.image,filename:N.filename,reasoningEffort:b.reasoningEffort??r.reasoningEffort,prompt:c,composerPrompt:f,composerInsertedPrompts:p,elapsed:b.elapsed,provider:b.provider,usage:b.usage,requestId:b.requestId??y,quality:b.quality??r.quality,size:b.size??m,model:b.model??r.imageModel};await br(_,n,o)}o().showToast(ee("toast.generatedBatch",{count:b.images.length,elapsed:b.elapsed}))}else{let N;if(Jp(b)){const _=b.images[0];N={image:_.image,filename:_.filename,reasoningEffort:b.reasoningEffort??r.reasoningEffort,prompt:c,composerPrompt:f,composerInsertedPrompts:p,elapsed:b.elapsed,provider:b.provider,usage:b.usage,requestId:b.requestId??y,quality:b.quality??r.quality,size:b.size??m,model:b.model??r.imageModel}}else N={image:b.image,filename:b.filename,reasoningEffort:b.reasoningEffort??r.reasoningEffort,prompt:c,composerPrompt:f,composerInsertedPrompts:p,elapsed:b.elapsed,provider:b.provider,usage:b.usage,requestId:b.requestId??y,quality:b.quality??r.quality,size:b.size??m,model:b.model??r.imageModel};await br(N,n,o),o().showToast(ee("toast.generatedSingle",{elapsed:b.elapsed}))}}catch(S){Ch(S)||Ni(S,o())}finally{const S=o().inFlight.filter(b=>b.id!==y);Et(S),n({activeGenerations:Math.max(0,o().activeGenerations-1),inFlight:S})}},async confirmCustomSizeAdjustment(){const i=o().customSizeConfirm;if(!i)return;const r=b1(i.adjustedW,i.adjustedH);if(n({customW:i.adjustedW,customH:i.adjustedH,customSizeConfirm:null}),i.continuation.kind==="classic"){await o().runGenerate(r);return}if(i.continuation.kind==="multimode"){await o().generateMultimode(r);return}if(i.continuation.kind==="node-in-place"){await o().runGenerateNodeInPlace(i.continuation.clientId,{sizeOverride:r});return}if(i.continuation.kind==="node-variation"){await o().generateNodeVariation(i.continuation.clientId,r);return}await o().runGenerateNode(i.continuation.clientId,r)},cancelCustomSizeAdjustment:()=>n({customSizeConfirm:null}),hydrateHistory(){(async()=>{try{const i=await Nl({limit:Zt}),r=i.items.map(Ei);if(n({historyNextCursor:i.nextCursor,loadedHistoryRetainLimit:Zt}),r.length>0){const c=Ih(),f=c?r.find(y=>y.filename===c):null,p=Mn(r),m=(f?ia(r,f):null)??p[0]??null;n({history:r,currentImage:m,historyNextCursor:i.nextCursor,loadedHistoryRetainLimit:Math.max(Zt,r.length)}),m?.filename!==c&&oa(m?.filename??null)}}catch(i){console.warn("[history] load failed:",i)}})()},showToast(i,r=!1){const c=Date.now(),f={message:i,error:r,id:c+Math.random(),createdAt:c};n(p=>({toast:f,toastLog:[...p.toastLog,f].slice(-50)}))},dismissToast(i){n(r=>{const c=r.toastLog.filter(f=>f.id!==i);return{toastLog:c,toast:r.toast?.id===i?c[c.length-1]??null:r.toast}})},showErrorCard(i,r){const c=Date.now(),f={code:i,fallbackMessage:r?.fallbackMessage,id:c+Math.random(),createdAt:c};n(p=>({errorCard:f,errorCardLog:[...p.errorCardLog,f]}))},dismissErrorCard(i){n(r=>{if(i==null)return{errorCard:null,errorCardLog:[]};const c=r.errorCardLog.filter(f=>f.id!==i);return{errorCardLog:c,errorCard:r.errorCard?.id===i?c[c.length-1]??null:r.errorCard}})},setWorkspaceProfile(i){n({workspaceProfile:i});try{localStorage.setItem("ima2.workspaceProfile",i)}catch{}},togglePromptBuilder(){n(i=>({promptBuilderOpen:!i.promptBuilderOpen}))},toggleStoryboard(){n(i=>({storyboardActive:!i.storyboardActive}))},setPromptLibraryOpen(i){n({promptLibraryOpen:i})},togglePromptLibrary(){n(i=>({promptLibraryOpen:!i.promptLibraryOpen}))},async loadPromptLibrary(){n({promptLibraryLoading:!0});try{const i=await pS();n({promptLibrary:{prompts:i.prompts,folders:i.folders},promptLibraryLoading:!1})}catch(i){console.error("[PromptLibrary] load failed",i),n({promptLibraryLoading:!1})}},async savePromptToLibrary(i){try{await hS(i),await o().loadPromptLibrary(),o().showToast(ee("promptLibrary.saved"))}catch(r){console.error("[PromptLibrary] save failed",r),o().showToast(ee("promptLibrary.saveFailed"),!0)}},async deletePromptFromLibrary(i){try{await gS(i),await o().loadPromptLibrary()}catch(r){console.error("[PromptLibrary] delete failed",r)}},async togglePromptFavorite(i){try{await yS(i),await o().loadPromptLibrary()}catch(r){console.error("[PromptLibrary] favorite toggle failed",r)}},async importPromptsToLibrary(i){try{const r=[];for(const f of i){if(!/\.(txt|md|markdown)$/i.test(f.name))continue;const p=await f.text();if(!p.trim())continue;const m=f.name.replace(/\.(txt|md|markdown)$/i,"");r.push({name:m.trim()||ee("promptLibrary.untitled"),text:p.trim(),tags:[]})}if(r.length===0){o().showToast(ee("promptLibrary.importNoValidFiles"),!0);return}const c=await vS({prompts:r});await o().loadPromptLibrary(),o().showToast(ee("promptLibrary.imported",{count:c.promptsImported}))}catch(r){console.error("[PromptLibrary] import failed",r),o().showToast(ee("promptLibrary.importFailed"),!0)}},async toggleGalleryFavorite(i){try{const r=await aS(i);n(c=>{const f=new Set(c.galleryFavorites);return r.isFavorite?f.add(i):f.delete(i),{galleryFavorites:f}}),n(c=>({history:c.history.map(f=>f.filename===i?{...f,isFavorite:r.isFavorite}:f)}))}catch(r){console.error("[GalleryFavorite] toggle failed",r)}},openCanvas:()=>n({canvasOpen:!0,canvasZoom:1,canvasPanX:0,canvasPanY:0}),closeCanvas:()=>n({canvasOpen:!1}),setCanvasZoom:i=>n({canvasZoom:Math.max(.5,Math.min(3,i))}),resetCanvasZoom:()=>n({canvasZoom:1,canvasPanX:0,canvasPanY:0}),setCanvasPan:(i,r)=>{n({canvasPanX:Math.max(-4e3,Math.min(4e3,i)),canvasPanY:Math.max(-4e3,Math.min(4e3,r))})},resetCanvasPan:()=>n({canvasPanX:0,canvasPanY:0}),setCanvasExportBackground:i=>{n({canvasExportBackground:i}),xh(i,o().canvasExportMatteColor)},setCanvasExportMatteColor:i=>{n({canvasExportMatteColor:i}),xh(o().canvasExportBackground,i)}})),A1=800;let ra=null,Or=!1,jr=!1,An=null,Yg=0;function Xg(){try{const n=sessionStorage.getItem(dh);if(n)return n;const o=`tab_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`;return sessionStorage.setItem(dh,o),o}catch{return"tab_unavailable"}}function Qg(n){const o={...n};return delete o.referenceImages,delete o.partialImageUrl,n.status==="pending"||n.status==="reconciling"?{...o,status:"empty",pendingRequestId:null,recoveryRequestId:n.pendingRequestId??n.recoveryRequestId??null,pendingPhase:null,pendingStartedAt:null,error:void 0}:o}function Zg(n){return n.map(o=>({id:o.id,source:o.source,target:o.target,data:{sourceHandle:o.sourceHandle??null,targetHandle:o.targetHandle??null}}))}async function Jg(n,o){const i=n().activeSessionId;if(!i||n().graphNodes.filter(m=>!m.data.imageUrl&&!m.data.serverNodeId).length===0)return;let c=[];try{c=(await Nl({sessionId:i,limit:Zt})).items}catch{return}let f=!1;const p=n().graphNodes.map(m=>{if(m.data.imageUrl||m.data.serverNodeId)return m;const y=m.data.pendingStartedAt??0,g=m.data.pendingRequestId??m.data.recoveryRequestId??null,S=(g?c.find(b=>(b.sessionId??null)===i&&(b.requestId??null)===g):null)??c.find(b=>(b.sessionId??null)===i&&(b.clientNodeId??null)===m.id&&(!y||(b.createdAt??0)>=y));return S?(f=!0,{...m,data:{...m.data,status:"ready",imageUrl:S.url,serverNodeId:S.nodeId??m.data.serverNodeId,size:S.size??m.data.size??null,elapsed:S.elapsed??m.data.elapsed,reasoningEffort:S.reasoningEffort??m.data.reasoningEffort,video:S.video??m.data.video??null,pendingRequestId:null,recoveryRequestId:null,pendingPhase:null,pendingStartedAt:null,partialImageUrl:null,error:void 0}}):m});f&&(o({graphNodes:p}),Wg(n,o,"recovery"))}async function C1(n,o){const i=n().activeSessionId;if(!i)return;const{session:r}=await ag(i),{graphNodes:c,graphEdges:f,graphVersion:p}=Hg(r);o({graphNodes:c,graphEdges:f,activeSessionGraphVersion:p}),n().showToast(ee("toast.sessionReloadedElsewhere"),!0),await Jg(n,o).catch(()=>{})}async function w1(n,o,i){const r=n().activeSessionId,c=n().activeSessionGraphVersion;if(!r||c==null)return"skipped";const{graphNodes:f,graphEdges:p,sessionLoading:m}=n();if(m||f.length===0&&c>0)return"skipped";const y=f.map(S=>({id:S.id,x:S.position.x,y:S.position.y,data:Qg(S.data)})),g=Zg(p),x=`gs_${Date.now().toString(36)}_${++Yg}`;try{const S=await mS(r,c,y,g,{saveId:x,saveReason:i,tabId:Xg()});return n().activeSessionId!==r?"skipped":(zx(r,n().graphNodes.map(b=>b.id)),o({activeSessionGraphVersion:S.graphVersion}),"saved")}catch(S){return S.status===409?(await C1(n,o),"conflict"):(console.warn("[sessions] save failed:",S),"failed")}}async function $g(n,o,i){if(Or){jr=!0,An&&await An;return}Or=!0,An=(async()=>{let r=i;do{jr=!1;const c=await w1(n,o,r);if(c==="conflict"||c==="failed")break;r="queued"}while(jr)})().finally(()=>{Or=!1,An=null}),await An}function Wg(n,o,i="debounced"){const r=n();r.activeSessionId&&(r.sessionLoading||(ra&&clearTimeout(ra),ra=setTimeout(()=>{ra=null,$g(n,o,i)},A1)))}async function M1(n,o,i="manual"){let r=!1;if(ra&&(clearTimeout(ra),ra=null,r=!0),Or){jr=!0,An&&await An;return}r&&await $g(n,o,i)}function R1(n){const o=n();if(!o.activeSessionId||o.activeSessionGraphVersion==null||o.sessionLoading||o.graphNodes.length===0&&o.activeSessionGraphVersion>0)return;ra&&(clearTimeout(ra),ra=null);const i=o.graphNodes.map(p=>({id:p.id,x:p.position.x,y:p.position.y,data:Qg(p.data)})),r=Zg(o.graphEdges),c=`/api/sessions/${encodeURIComponent(o.activeSessionId)}/graph`,f=JSON.stringify({nodes:i,edges:r});try{fetch(c,{method:"PUT",headers:{"Content-Type":"application/json","If-Match":String(o.activeSessionGraphVersion),"X-Ima2-Graph-Save-Id":`gs_${Date.now().toString(36)}_${++Yg}`,"X-Ima2-Graph-Save-Reason":"beforeunload","X-Ima2-Tab-Id":Xg()},body:f,keepalive:!0})}catch{}}async function br(n,o,i){const r=await xS(n.image).catch(()=>n.image),c=n.filename?`/generated/${n.filename}`:n.image,f={...n,thumb:r,url:c,createdAt:n.createdAt||Date.now()},p=i(),m=Gg(p.history,f),y=qg(f,m),g=Lg(p.history,y),x=Ir([y,...g],p.loadedHistoryRetainLimit+1);oa(y.filename??null),o({history:x,currentImage:y,loadedHistoryRetainLimit:Math.max(p.loadedHistoryRetainLimit,Math.min(p.history.length+1,p.loadedHistoryRetainLimit+1)),unseenGeneratedCount:i().unseenGeneratedCount+1})}function I1(n){for(const o of n.history)if(o.sessionId)return o.sessionId;return null}function O1(){const{t:n}=ge(),o=E(r=>r.uiMode),i=E(r=>r.setUIMode);return d.jsxs("div",{className:"ui-mode-switch",role:"tablist","aria-label":n("uiMode.ariaLabel"),children:[d.jsx("button",{type:"button",role:"tab","aria-selected":o==="classic",className:`ui-mode-switch__tab${o==="classic"?" active":""}`,onClick:()=>i("classic"),children:n("uiMode.classic")}),d.jsx("button",{type:"button",role:"tab","aria-selected":o==="node",className:`ui-mode-switch__tab${o==="node"?" active":""}`,onClick:()=>i("node"),children:n("uiMode.node")}),null,null]})}function j1({text:n,mode:o,onClose:i}){const{t:r}=ge(),c=E(_=>_.savePromptToLibrary),[f,p]=D.useState(n.slice(0,30)),[m,y]=D.useState(n),[g,x]=D.useState(""),[S,b]=D.useState(!1),N=async()=>{m.trim()&&(b(!0),await c({name:f.trim()||m.slice(0,30),text:m.trim(),tags:g.split(",").map(_=>_.trim()).filter(Boolean),mode:o||void 0}),b(!1),i())};return d.jsxs("div",{className:"save-prompt-popover",onClick:_=>_.stopPropagation(),children:[d.jsxs("div",{className:"save-prompt-popover__header",children:[d.jsx("span",{children:r("promptLibrary.saveTitle")}),d.jsx("button",{className:"save-prompt-popover__close",onClick:i,"aria-label":r("common.close"),children:"×"})]}),d.jsxs("div",{className:"save-prompt-popover__body",children:[d.jsxs("label",{children:[r("promptLibrary.name"),d.jsx("input",{type:"text",value:f,onChange:_=>p(_.target.value),placeholder:m.slice(0,30)})]}),d.jsxs("label",{children:[r("promptLibrary.content"),d.jsx("textarea",{value:m,onChange:_=>y(_.target.value),placeholder:"Enter prompt...",rows:4,autoFocus:!0})]}),d.jsxs("label",{children:[r("promptLibrary.tags"),d.jsx("input",{type:"text",value:g,onChange:_=>x(_.target.value),placeholder:"cta, product, summer"})]})]}),d.jsx("div",{className:"save-prompt-popover__footer",children:d.jsx("button",{onClick:N,disabled:S||!m.trim(),className:"save-prompt-popover__save",children:r(S?"common.saving":"promptLibrary.save")})})]})}function k1({variant:n="label"}){const{t:o}=ge(),i=E(f=>f.webSearchEnabled),r=E(f=>f.setWebSearchEnabled),c=o(i?"settings.webSearch.on":"settings.webSearch.off");return d.jsx("button",{type:"button",className:`${n==="compact"?"composer__tool ":""}web-search-toggle web-search-toggle--${n}${i?" is-active":""}`,onClick:()=>r(!i),"aria-pressed":i,"aria-label":c,title:c,children:n==="compact"?d.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[d.jsx("circle",{cx:"12",cy:"12",r:"10"}),d.jsx("path",{d:"M2 12h20"}),d.jsx("path",{d:"M12 2a15.3 15.3 0 0 1 0 20"}),d.jsx("path",{d:"M12 2a15.3 15.3 0 0 0 0 20"})]}):d.jsx("span",{children:c})})}async function ey(n){const o=E.getState(),i=Wt(n),r=!!n.prompt;if(o.clearReferences(),o.setPrompt(r&&!i?n.prompt:""),i){const c=n.url||n.image,f=await Di(c);o.addReferenceDataUrl(f);const p=jg(n);o.setVideoContinuityLineage(p),p&&o.insertPromptToComposer(n1(p)),n.videoSeries?.topic&&o.setVideoTopic(n.videoSeries.topic),o.videoModelSelected||o.selectVideoModel("grok-imagine-video-1.5-preview")}else await o.useImageAsReference(n);return{ok:!0,isVideo:i,hasPrompt:r}}const xl=5;function z1(n){const o=Number.parseFloat(n);return Number.isFinite(o)&&o>0?o:null}function zu({variant:n="sidebar"}){const o=E(U=>U.prompt),i=E(U=>U.setPrompt),r=E(U=>U.insertedPrompts),c=E(U=>U.removeInsertedPromptFromComposer),f=E(U=>U.moveInsertedPromptInComposer),p=E(U=>U.generate),{t:m}=ge(),y=E(U=>U.referenceImages),g=E(U=>U.addReferences),x=E(U=>U.addReferenceDataUrl),S=E(U=>U.useImageAsReference),b=E(U=>U.readDroppedImageMetadata),N=E(U=>U.removeReference),_=E(U=>U.currentImage),M=E(U=>U.videoModelSelected),I=E(U=>U.selectVideoModel),G=E(U=>U.setImageModel),L=E(U=>U.storyboardActive),O=E(U=>U.toggleStoryboard),k=D.useRef(null),$=D.useRef(null),[K,W]=D.useState(!1),[Ee,Oe]=D.useState(!1),V=E(U=>U.promptMode),ie=E(U=>U.setPromptMode),oe=E(U=>U.multimode),Ce=E(U=>U.multimodeMaxImages),we=V==="direct",Z=r.filter(U=>U.placement!=="after"),T=r.filter(U=>U.placement==="after"),X=[...Z.map(U=>U.id),"__main_prompt__",...T.map(U=>U.id)],te=y.length<xl,ye=oe?y.length>0?m("multimode.promptPlaceholderWithRefs"):m("multimode.promptPlaceholder"):y.length>0?m("prompt.placeholderWithRefs"):m("prompt.placeholder"),me=async U=>{U.length!==0&&(U.length===1&&await b(U[0])||await g(U))},C=async U=>{try{const Se=U.url||U.image;if(!Se)return;const Pe={image:Se,url:U.url,filename:U.filename};if(Wt(Pe)){const Ve=await Di(Se);Ve&&x(Ve)}else await S(Pe)}catch{}},B=U=>{U.preventDefault(),W(!1);const Se=U.dataTransfer.getData("application/ima2-ref");if(Se){try{const Ve=JSON.parse(Se);C(Ve)}catch{}return}const Pe=Array.from(U.dataTransfer.files).filter(Ve=>Ve.type.startsWith("image/"));Pe.length>0&&me(Pe)},J=U=>{U.preventDefault(),K||W(!0)},ae=U=>{U.currentTarget.contains(U.relatedTarget)||W(!1)},se=U=>{if(!U)return[];const Se=[];for(const Pe of Array.from(U)){if(Pe.kind!=="file"||!Pe.type.startsWith("image/"))continue;const Ve=Pe.getAsFile();Ve&&Se.push(Ve)}return Se},fe=U=>{if(!te)return;const Se=se(U.clipboardData?.items??null);if(Se.length===0)return;U.preventDefault();const Pe=xl-y.length;g(Se.slice(0,Pe))},ve=D.useRef(null),Ze=D.useRef(n);D.useLayoutEffect(()=>{const U=$.current;if(!U)return;(ve.current===null||Ze.current!==n)&&(ve.current=z1(window.getComputedStyle(U).maxHeight)??0,Ze.current=n),U.style.height="auto";const Se=ve.current,Pe=Se?Math.min(U.scrollHeight,Se):U.scrollHeight;U.style.height=`${Pe}px`},[o,n]),D.useEffect(()=>{const U=Se=>{const Pe=Se.target,Ve=Pe?.tagName;if(Ve==="INPUT"||Ve==="TEXTAREA"||Pe?.isContentEditable)return;const Ma=se(Se.clipboardData?.items??null);if(Ma.length===0||y.length>=xl)return;Se.preventDefault();const on=xl-y.length;g(Ma.slice(0,on))};return window.addEventListener("paste",U),()=>window.removeEventListener("paste",U)},[y.length,g]);const qe=(U,Se)=>{const Pe=X.indexOf(U);return Pe<0?!1:Se==="up"?Pe>0:Pe<X.length-1},ea=U=>d.jsxs("div",{className:"composer__prompt-chip",title:U.name,children:[d.jsx("span",{className:"composer__prompt-chip-plus","aria-hidden":"true",children:"+"}),d.jsx("span",{className:"composer__prompt-chip-title",children:U.name}),d.jsxs("div",{className:"composer__prompt-chip-actions",children:[d.jsx("button",{type:"button",className:"composer__prompt-chip-move",onClick:()=>f(U.id,"up"),disabled:!qe(U.id,"up"),"aria-label":m("prompt.moveBlockUp",{name:U.name}),title:m("prompt.moveBlockUp",{name:U.name}),children:"^"}),d.jsx("button",{type:"button",className:"composer__prompt-chip-move",onClick:()=>f(U.id,"down"),disabled:!qe(U.id,"down"),"aria-label":m("prompt.moveBlockDown",{name:U.name}),title:m("prompt.moveBlockDown",{name:U.name}),children:"v"}),d.jsx("button",{type:"button",className:"composer__prompt-chip-remove",onClick:()=>c(U.id),"aria-label":m("promptLibrary.removeInserted",{name:U.name}),children:"x"})]})]},U.id);return d.jsxs("div",{className:`composer composer--${n}${K?" composer--drag":""}${we?" composer--direct":""}${oe?" composer--multimode":""}${we&&oe?" composer--combined-modes":""}`,role:"group","aria-label":oe?m("multimode.composerAriaLabel",{count:Ce}):m("prompt.label"),onDrop:B,onDragOver:J,onDragLeave:ae,onPaste:fe,children:[d.jsxs("div",{className:"composer__header",children:[d.jsx("span",{className:"section-title composer__label",children:m("prompt.label")}),d.jsxs("div",{className:"composer__header-meta",children:[oe&&d.jsx("span",{className:"composer__mode-badge",children:m("multimode.composerBadge",{count:Ce})}),we&&d.jsx("span",{className:"composer__direct-badge",children:m("prompt.directModeActive")}),y.length>0&&d.jsx("span",{className:"composer__count",children:m("prompt.refCount",{count:y.length,max:xl})})]})]}),y.length>0&&d.jsx("div",{className:"composer__chips",children:y.map((U,Se)=>d.jsxs("div",{className:"composer__chip",title:m("prompt.refChipTitle",{n:Se+1}),children:[d.jsx("img",{src:U,alt:m("prompt.refChipAlt",{n:Se+1}),loading:"lazy",decoding:"async"}),d.jsx("button",{type:"button",className:"composer__chip-remove",onClick:()=>N(Se),"aria-label":m("prompt.refRemoveAria",{n:Se+1}),children:"×"})]},Se))}),Z.length>0&&d.jsx("div",{className:"composer__prompt-chips",children:Z.map(ea)}),d.jsx("textarea",{ref:$,className:"prompt-area composer__textarea",value:o,placeholder:ye,onChange:U=>i(U.target.value),onKeyDown:U=>{U.key==="Enter"&&(U.metaKey||U.ctrlKey)&&(U.preventDefault(),p())}}),T.length>0&&d.jsxs("div",{className:"composer__prompt-chips composer__prompt-chips--after",children:[d.jsx("span",{className:"composer__prompt-chips-label",children:m("prompt.afterBlocks")}),T.map(ea)]}),d.jsx("div",{className:"composer__hint-row",children:d.jsx("span",{className:"composer__hint",children:m("prompt.hint")})}),d.jsxs("div",{className:"composer__toolbar",children:[d.jsx("button",{type:"button",className:"composer__tool",onClick:()=>te&&k.current?.click(),disabled:!te,title:m("prompt.attachTitle"),"aria-label":m("prompt.attachTitle"),children:d.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:d.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})})}),d.jsx("button",{type:"button",className:"composer__tool",onClick:()=>_&&void ey(_).catch(()=>{}),disabled:!_||!te,title:m("prompt.continueTitle"),children:m("prompt.continue")}),d.jsxs("button",{type:"button",className:`composer__tool${M?" composer__tool--on":""}`,onClick:()=>{M?G("gpt-5.5"):I("grok-imagine-video-1.5-preview")},title:m("prompt.videoToggleTitle"),"aria-label":m("prompt.videoToggleTitle"),"aria-pressed":!!M,children:[d.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[d.jsx("polygon",{points:"23 7 16 12 23 17 23 7"}),d.jsx("rect",{x:"1",y:"5",width:"15",height:"14",rx:"2",ry:"2"})]}),d.jsx("span",{className:"sr-only",children:"Video"})]}),d.jsx("button",{type:"button",className:`composer__tool${we?" composer__tool--on":""}`,onClick:()=>ie(we?"auto":"direct"),title:m("prompt.directModeTitle"),"aria-label":m("prompt.directModeTitle"),"aria-pressed":we,children:d.jsx("span",{"aria-hidden":"true",style:{fontWeight:700,fontSize:11},children:"1:1"})}),d.jsx(k1,{variant:"compact"}),d.jsxs("div",{className:"composer__tool-wrap",children:[d.jsx("button",{type:"button",className:"composer__tool composer__tool--full",onClick:()=>Oe(U=>!U),disabled:!o.trim(),title:m("promptLibrary.saveTitle"),"aria-label":m("promptLibrary.saveTitle"),children:m("prompt.savePrompt")}),Ee&&d.jsx(j1,{text:o,mode:V,onClose:()=>Oe(!1)})]})]}),d.jsx("div",{className:"composer__storyboard-row",children:d.jsx("button",{type:"button",className:`composer__tool composer__tool--storyboard${L?" composer__tool--on":""}`,onClick:O,title:m("prompt.storyboardTitle"),"aria-pressed":L,children:m("prompt.storyboard")})}),K&&d.jsx("div",{className:"composer__dropzone","aria-hidden":"true",children:m("prompt.dropHere",{max:xl})}),d.jsx("input",{ref:k,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:U=>{const Se=Array.from(U.target.files??[]);Se.length>0&&me(Se),U.target.value=""}})]})}function Du(){const n=E(f=>f.activeGenerations),o=E(f=>f.generate),i=E(f=>f.openReadinessPopup),{t:r}=ge(),c=n>0;return d.jsxs("div",{className:"generate-row",children:[d.jsxs("button",{type:"button",className:`generate-btn${c?" generate-btn--active":""}`,onClick:()=>{o()},children:[r("generate.button"),c?d.jsx("span",{className:"generate-btn__count","aria-label":r("generate.buttonLoading",{n}),children:n}):null]}),d.jsx("button",{type:"button",className:"generate-row__readiness",onClick:i,title:r("readiness.openTitle"),"aria-label":r("readiness.openTitle"),children:"?"})]})}function D1(n,o=28){const i=n.trim().replace(/\s+/g," ");return i.length>o?`${i.slice(0,o)}...`:i}function kr(){const n=E(f=>f.inFlight),o=E(f=>f.cancelInFlightJob),i=E(f=>f.videoProgress),{t:r}=ge(),c={queued:r("inflight.queued"),planning:r("inflight.planning"),streaming:r("inflight.streaming"),decoding:r("inflight.decoding"),canceling:r("inflight.canceling")};return n.length===0?null:d.jsx("ul",{className:"in-flight-list",children:n.map(f=>{const p=f.phase?c[f.phase]??f.phase:r("inflight.queued"),y=f.prompt.trim().replace(/\s+/g," ")||r("inflight.noPrompt");return d.jsxs("li",{className:"in-flight-item","data-phase":f.phase??"queued",title:y,"aria-label":`${p}: ${y}`,children:[d.jsx("span",{className:"in-flight-prompt",children:D1(f.prompt)}),d.jsx("span",{className:"in-flight-phase",children:f.kind==="video"&&i!=null&&i>0?`${Math.round(i*100)}%`:p}),d.jsx("button",{type:"button",className:"in-flight-cancel",onClick:()=>{o(f.id)},disabled:f.phase==="canceling","aria-label":r("inflight.cancelAria",{prompt:y}),title:r("common.cancel"),children:"×"}),d.jsx("span",{className:"in-flight-spinner","aria-hidden":"true"})]},f.id)})})}function L1(){const{t:n}=ge(),o=E(b=>b.sessions),i=E(b=>b.activeSessionId),r=E(b=>b.switchSession),c=E(b=>b.createAndSwitchSession),f=E(b=>b.renameCurrentSession),p=E(b=>b.deleteSessionById),[m,y]=D.useState(!1),g=o.find(b=>b.id===i),x=()=>{const b=window.prompt(n("session.renamePrompt"),g?.title??n("session.newSession"));b&&b.trim()&&f(b.trim())},S=(b,N)=>{window.confirm(n("session.deleteConfirm",{title:N}))&&p(b)};return d.jsxs("div",{className:"session-picker",children:[d.jsxs("div",{className:"session-picker-row",children:[d.jsxs("button",{type:"button",className:"session-current",onClick:()=>y(b=>!b),title:n("session.switchTitle"),children:[d.jsx("span",{className:"session-title",children:g?.title??n("session.loading")}),d.jsx("span",{className:"session-caret",children:m?"▴":"▾"})]}),d.jsx("button",{type:"button",className:"session-btn",onClick:()=>{c(n("session.newSession"))},title:n("session.newSessionTitle"),children:"+"}),d.jsx("button",{type:"button",className:"session-btn",onClick:x,title:n("session.renameTitle"),disabled:!g,children:"✎"})]}),m&&d.jsxs("ul",{className:"session-list",children:[o.map(b=>d.jsxs("li",{className:b.id===i?"is-active":"",children:[d.jsxs("button",{type:"button",className:"session-item",onClick:()=>{y(!1),r(b.id)},children:[d.jsx("span",{className:"session-item-title",children:b.title}),d.jsx("span",{className:"session-item-count",children:b.nodeCount})]}),d.jsx("button",{type:"button",className:"session-del",onClick:()=>S(b.id,b.title),title:n("session.deleteTitle"),children:"×"})]},b.id)),o.length===0&&d.jsx("li",{className:"session-empty",children:n("session.empty")})]})]})}function G1(){const{t:n}=ge(),o=E(r=>r.settingsOpen),i=E(r=>r.toggleSettings);return d.jsx("button",{type:"button",className:`settings-button${o?" is-active":""}`,onClick:i,"aria-label":n("settings.openAria"),"aria-pressed":o,title:n("settings.openTitle"),children:d.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[d.jsx("path",{d:"M12 8.2a3.8 3.8 0 1 0 0 7.6 3.8 3.8 0 0 0 0-7.6Zm0 5.7a1.9 1.9 0 1 1 0-3.8 1.9 1.9 0 0 1 0 3.8Z"}),d.jsx("path",{d:"m20.3 13.4.1-1.4-.1-1.4-2.2-.5a6.9 6.9 0 0 0-.6-1.3l1.2-1.9a9.6 9.6 0 0 0-2-2l-1.9 1.2c-.4-.2-.9-.4-1.3-.6L13 3.3a9.5 9.5 0 0 0-2.8 0l-.5 2.2c-.5.2-.9.3-1.3.6L6.5 4.9a9.6 9.6 0 0 0-2 2l1.2 1.9c-.2.4-.4.9-.6 1.3l-2.2.5a9.5 9.5 0 0 0 0 2.8l2.2.5c.2.5.3.9.6 1.3l-1.2 1.9a9.6 9.6 0 0 0 2 2l1.9-1.2c.4.2.9.4 1.3.6l.5 2.2a9.5 9.5 0 0 0 2.8 0l.5-2.2c.5-.2.9-.3 1.3-.6l1.9 1.2a9.6 9.6 0 0 0 2-2l-1.2-1.9c.2-.4.4-.9.6-1.3l2.2-.5Z"})]})})}var ty=Jh();function ay({variant:n}){const{t:o}=ge(),[i,r]=D.useState(!1),c=D.useRef(null),f=D.useRef(null),p=D.useRef(null),m=D.useRef([]),[y,g]=D.useState({top:0,left:12,width:280}),x=E(V=>V.imageModel),S=E(V=>V.provider),b=E(V=>V.setImageModel),N=E(V=>V.setProvider),_=E(V=>V.videoModelSelected),M=E(V=>V.selectVideoModel),I=E(V=>V.reasoningEffort),G=E(V=>V.setReasoningEffort),L=n==="settings"?"settings-image-model":"sidebar-image-model",O=In,k=O.find(V=>V.value===x&&(!V.providerHint||V.providerHint===S))??O.find(V=>V.value===x)??O[0],$=Cr.find(V=>V.value===I)??Cr[0],K=V=>{b(V.target.value)},W=()=>m.current.filter(V=>V!==null),Ee=V=>{const ie=W();if(ie.length===0)return;const oe=(V+ie.length)%ie.length;ie[oe]?.focus()},Oe=V=>{const ie=W();if(ie.length===0)return;const oe=ie.findIndex(we=>we===document.activeElement),Ce=ie.length-1;if(V.key==="ArrowDown"||V.key==="ArrowRight"){V.preventDefault(),Ee(oe>=0?oe+1:0);return}if(V.key==="ArrowUp"||V.key==="ArrowLeft"){V.preventDefault(),Ee(oe>=0?oe-1:Ce);return}if(V.key==="Home"){V.preventDefault(),Ee(0);return}if(V.key==="End"){V.preventDefault(),Ee(Ce);return}V.key==="Escape"&&(V.preventDefault(),r(!1),f.current?.focus())};return D.useEffect(()=>{if(n!=="sidebar"||!i)return;const V=oe=>{const Ce=oe.target;Ce instanceof Node&&(c.current?.contains(Ce)||p.current?.contains(Ce)||r(!1))},ie=oe=>{oe.key==="Escape"&&r(!1)};return document.addEventListener("pointerdown",V),document.addEventListener("keydown",ie),()=>{document.removeEventListener("pointerdown",V),document.removeEventListener("keydown",ie)}},[i,n]),D.useLayoutEffect(()=>{if(n!=="sidebar"||!i)return;(()=>{const Ce=f.current?.getBoundingClientRect();if(Ce){const Z=Math.min(280,Math.max(218,window.innerWidth-24)),T=Ce.right-Z,X=window.innerWidth-Z-12,te=Math.max(12,Math.min(T,X));g({top:Ce.bottom+7,left:te,width:Z})}})();const ie=()=>r(!1),oe=document.querySelector(".sidebar__scroll");return oe?.addEventListener("scroll",ie,{passive:!0}),window.addEventListener("scroll",ie,!0),window.addEventListener("resize",ie),()=>{oe?.removeEventListener("scroll",ie),window.removeEventListener("scroll",ie,!0),window.removeEventListener("resize",ie)}},[i,n]),D.useEffect(()=>{if(n!=="sidebar"||!i)return;const V=O.findIndex(oe=>oe.value===x),ie=requestAnimationFrame(()=>{Ee(V>=0?V:0)});return()=>cancelAnimationFrame(ie)},[x,O,i,n]),n==="sidebar"?d.jsxs("div",{ref:c,className:"image-model-select image-model-select--sidebar",children:[d.jsxs("button",{ref:f,id:L,type:"button",className:"image-model-select__trigger image-model-select__trigger--pill","aria-haspopup":"menu","aria-expanded":i,"aria-label":o("sidebar.quickSettingsAria",{model:k.shortLabel,effort:$.shortLabel}),onClick:()=>r(V=>!V),children:[d.jsxs("span",{className:"image-model-select__trigger-top",children:[d.jsx("span",{className:"image-model-select__trigger-model",children:_?dr.find(V=>V.value===_)?.shortLabel??dr[0].shortLabel:k.shortLabel.split(" ")[0]}),d.jsx("span",{className:"image-model-select__trigger-chevron","aria-hidden":"true",children:"▾"})]}),Mi(x)?d.jsx("span",{className:"image-model-select__trigger-effort",children:k.shortLabel.split(" ")[1]||""}):d.jsx("span",{className:"image-model-select__trigger-effort",children:$.shortLabel})]}),i?ty.createPortal(d.jsxs("div",{ref:p,className:"image-model-select__menu",role:"menu","aria-label":o("sidebar.quickSettingsMenu"),onKeyDown:Oe,style:{position:"fixed",top:y.top,left:y.left,width:y.width,zIndex:160},children:[d.jsxs("div",{className:"image-model-select__section",role:"group","aria-label":o("sidebar.imageSectionLabel"),children:[d.jsx("div",{className:"image-model-select__section-title",children:o("sidebar.imageSectionLabel")}),d.jsx("div",{className:"image-model-select__subsection-title",children:o("sidebar.gptImageSubLabel")}),cu.map((V,ie)=>d.jsxs("button",{ref:oe=>{m.current[ie]=oe},type:"button",className:`image-model-select__item${V.value===x&&!_?" is-active":""}`,role:"menuitemradio","aria-checked":V.value===x&&!_,tabIndex:-1,onClick:()=>{b(V.value),r(!1)},children:[d.jsx("span",{children:V.shortLabel}),d.jsx("small",{children:o(V.fullLabelKey)})]},V.value)),d.jsx("div",{className:"image-model-select__subsection-title",children:o("sidebar.grokImageSubLabel")}),uh.map((V,ie)=>d.jsxs("button",{ref:oe=>{m.current[cu.length+ie]=oe},type:"button",className:`image-model-select__item${V.value===x&&!_?" is-active":""}`,role:"menuitemradio","aria-checked":V.value===x&&!_,tabIndex:-1,onClick:()=>{b(V.value),r(!1)},children:[d.jsx("span",{children:V.shortLabel}),d.jsx("small",{children:o(V.fullLabelKey)})]},V.value)),d.jsx("div",{className:"image-model-select__subsection-title",children:o("sidebar.geminiImageSubLabel")}),Tx.map((V,ie)=>{const oe=V.providerHint,Ce=V.value===x&&oe===S&&!_;return d.jsxs("button",{ref:we=>{m.current[cu.length+uh.length+ie]=we},type:"button",className:`image-model-select__item${Ce?" is-active":""}`,role:"menuitemradio","aria-checked":Ce,tabIndex:-1,onClick:()=>{oe&&N(oe),b(V.value),r(!1)},children:[d.jsx("span",{children:V.shortLabel}),d.jsx("small",{children:o(V.fullLabelKey)})]},`${V.value}-${oe||ie}`)})]}),d.jsxs("div",{className:"image-model-select__section",role:"group","aria-label":o("sidebar.videoSectionLabel"),children:[d.jsx("div",{className:"image-model-select__section-title",children:o("sidebar.videoSectionLabel")}),dr.map((V,ie)=>d.jsxs("button",{ref:oe=>{m.current[O.length+ie]=oe},type:"button",className:`image-model-select__item${_===V.value?" is-active":""}`,role:"menuitemradio","aria-checked":_===V.value,tabIndex:-1,onClick:()=>{M(V.value),r(!1)},children:[d.jsx("span",{children:V.shortLabel}),d.jsx("small",{children:o(V.fullLabelKey)})]},V.value))]}),!Mi(x)&&d.jsxs("details",{className:"image-model-select__section image-model-select__collapsible",children:[d.jsxs("summary",{className:"image-model-select__section-title image-model-select__section-title--toggle",children:[o("sidebar.reasoningLabel"),d.jsx("span",{className:"image-model-select__chevron","aria-hidden":"true",children:"▸"})]}),d.jsx("div",{role:"group","aria-label":o("sidebar.reasoningLabel"),children:Cr.map((V,ie)=>d.jsxs("button",{ref:oe=>{m.current[O.length+dr.length+ie]=oe},type:"button",className:`image-model-select__item${V.value===I?" is-active":""}`,role:"menuitemradio","aria-checked":V.value===I,tabIndex:-1,onClick:()=>{G(V.value),r(!1)},children:[d.jsx("span",{children:V.shortLabel}),d.jsx("small",{children:o(V.fullLabelKey)})]},V.value))})]})]}),document.body):null]}):d.jsx("div",{className:"image-model-select image-model-select--settings",children:d.jsxs("select",{id:L,value:x,onChange:K,children:[O.map(V=>d.jsx("option",{value:V.value,children:o(V.fullLabelKey)},V.value)),Nx.map(V=>d.jsx("option",{value:V.value,disabled:!0,children:o(V.fullLabelKey)},V.value))]})})}function ny(n){return{...n,textFields:Array.isArray(n.textFields)?n.textFields:[]}}function ki(n){return{...n,cards:Array.isArray(n.cards)?n.cards.map(ny):[]}}async function On(n,o){const i=await fetch(n,o),r=await i.json().catch(()=>({}));if(!i.ok){const c=r,f=typeof c.error=="string"?c.error:c.error?.message||`Request failed: ${i.status}`,p=new Error(f);throw typeof c.error!="string"&&(p.code=c.error?.code),p}return r}function q1(){return On("/api/cardnews/image-templates")}function H1(){return On("/api/cardnews/role-templates")}async function P1(n){const o=await On("/api/cardnews/draft",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});return{...o,plan:ki(o.plan)}}function U1(n){return On("/api/cardnews/jobs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}function B1(n){return On(`/api/cardnews/jobs/${encodeURIComponent(n)}`)}async function F1(n){const i=(await On(`/api/cardnews/cards/${encodeURIComponent(n.card.id)}/regenerate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...n,cards:[n.card]})})).cards.find(r=>r.id===n.card.id);if(!i)throw new Error("Regenerated card not found");return{card:i}}function jh(n){return On(`/api/cardnews/sets/${encodeURIComponent(n)}`).then(o=>({...o,plan:ki(o.plan)}))}function K1(n){return`/api/cardnews/sets/${encodeURIComponent(n)}/manifest?download=1`}function V1(n){return n[0]?.id||"academy-lesson-square"}function Y1(n){return n.find(o=>o.id==="mid-5")?.id||n[0]?.id||"mid-5"}function X1(n){return Math.round(n/16)*16}function Lr(n){return Math.min(Ru,Math.max(1024,X1(n)))}function kh(n){return n.outputSizePreset!=="custom"?n.outputSizePreset:`${Lr(n.customW)}x${Lr(n.customH)}`}function ly(n){if(n){if(typeof n=="string")return n;if(typeof n=="object"&&"message"in n){const o=n.message;return typeof o=="string"?o:void 0}return String(n)}}function Q1(n,o){const i=o.status||"generated";return{...n,...o,textFields:Array.isArray(o.textFields)?o.textFields:n.textFields,status:i,error:i==="error"?ly(o.error)||ee("cardNews.error"):void 0}}function Z1(n){return new Promise(o=>setTimeout(o,n))}function yu(n,o){const i=new Map(o.cards.map(r=>[r.id,r]));return{...n,cards:n.cards.map(r=>{const c=i.get(r.id);return c?{...r,...c,textFields:Array.isArray(c.textFields)?c.textFields:r.textFields,status:c.status||r.status,error:ly(c.error)}:r})}}const ot=$h((n,o)=>({templates:[],roleTemplates:[],activePlan:null,selectedCardId:null,selectedTextFieldId:null,topic:"",audience:"",goal:"",contentBrief:"",imageTemplateId:"academy-lesson-square",roleTemplateId:"mid-5",outputSizePreset:"2048x2048",customW:2048,customH:2048,loading:!1,generating:!1,error:null,draftError:null,plannerMeta:null,async hydrate(){if(!(o().loading||o().templates.length>0)){n({loading:!0,error:null});try{const[i,r]=await Promise.all([q1(),H1()]);n({templates:i.templates,roleTemplates:r.templates,imageTemplateId:V1(i.templates),roleTemplateId:Y1(r.templates),loading:!1})}catch(i){n({loading:!1,error:i instanceof Error?i.message:String(i)})}}},setBriefField(i,r){n({[i]:r})},setImageTemplate(i){n({imageTemplateId:i})},setRoleTemplate(i){n({roleTemplateId:i})},setOutputSizePreset(i){n({outputSizePreset:i})},setCustomSize(i,r){n({customW:Lr(i),customH:Lr(r)})},async draft(){const i=o();n({loading:!0,error:null,draftError:null});try{const{plan:r,planner:c}=await P1({topic:i.topic,audience:i.audience,goal:i.goal,contentBrief:i.contentBrief,imageTemplateId:i.imageTemplateId,roleTemplateId:i.roleTemplateId,size:kh(i)});n({activePlan:ki(r),selectedCardId:r.cards[0]?.id||null,selectedTextFieldId:null,plannerMeta:c||null,loading:!1})}catch(r){const c=r instanceof Error?r.message:String(r);n({loading:!1,draftError:c,error:c})}},updateCard(i,r){n(c=>({activePlan:c.activePlan?{...c.activePlan,cards:c.activePlan.cards.map(f=>f.id===i?{...f,...r}:f)}:null}))},updateTextField(i,r,c){n(f=>({activePlan:f.activePlan?{...f.activePlan,cards:f.activePlan.cards.map(p=>p.id!==i||p.locked?p:{...p,textFields:p.textFields.map(m=>m.id===r?{...m,...c,source:c.source||"user"}:m)})}:null}))},addTextField(i,r){n(c=>({activePlan:c.activePlan?{...c.activePlan,cards:c.activePlan.cards.map(f=>f.id===i&&!f.locked?{...f,textFields:[...f.textFields,{...r,source:"user"}]}:f)}:null,selectedTextFieldId:r.id}))},removeTextField(i,r){n(c=>({activePlan:c.activePlan?{...c.activePlan,cards:c.activePlan.cards.map(f=>f.id===i&&!f.locked?{...f,textFields:f.textFields.filter(p=>p.id!==r)}:f)}:null,selectedTextFieldId:c.selectedTextFieldId===r?null:c.selectedTextFieldId}))},selectCard(i){n({selectedCardId:i,selectedTextFieldId:null})},selectTextField(i){n({selectedTextFieldId:i})},getGenerationSummary(){const i=o().activePlan?.cards||[];return{total:i.length,done:i.filter(r=>r.status==="generated").length,queued:i.filter(r=>r.status==="queued").length,generating:i.filter(r=>r.status==="generating").length,errors:i.filter(r=>r.status==="error").length,skipped:i.filter(r=>r.locked||r.status==="skipped").length}},async generateSet(){const i=o();if(!i.activePlan)return;const r=E.getState();n({generating:!0,error:null,activePlan:{...i.activePlan,cards:i.activePlan.cards.map(c=>c.locked?{...c,status:"skipped"}:{...c,status:"queued",error:void 0})}});try{const c=o().activePlan||i.activePlan;let p=await U1({...c,size:kh(i),quality:r.quality,moderation:r.moderation,model:r.imageModel,sessionId:r.activeSessionId});for(n(y=>({activePlan:y.activePlan?yu(y.activePlan,p):y.activePlan}));["queued","running"].includes(p.status);)await Z1(900),p=await B1(p.jobId),n(y=>({activePlan:y.activePlan?yu(y.activePlan,p):y.activePlan}));const m=await jh(p.setId).catch(()=>null);n(y=>({generating:!1,activePlan:m?.plan?ki(m.plan):y.activePlan?yu(y.activePlan,p):y.activePlan,selectedTextFieldId:null})),r.showToast(ee("cardNews.generated",{count:p.generated}))}catch(c){const f=c instanceof Error?c.message:String(c);n(p=>({generating:!1,error:f,activePlan:p.activePlan?{...p.activePlan,cards:p.activePlan.cards.map(m=>m.status==="queued"||m.status==="generating"?{...m,status:"error",error:f}:m)}:p.activePlan}))}},async retryCard(i){const c=o().activePlan,f=c?.cards.find(m=>m.id===i);if(!c||!f||f.locked||!["draft","error"].includes(f.status))return;const p=E.getState();n({error:null,activePlan:{...c,cards:c.cards.map(m=>m.id===i?{...m,status:"generating",error:void 0}:m)}});try{const{card:m}=await F1({setId:c.setId,card:f,quality:p.quality,moderation:p.moderation,model:p.imageModel});n(y=>({activePlan:y.activePlan?{...y.activePlan,cards:y.activePlan.cards.map(g=>g.id===i?Q1(g,ny(m)):g)}:y.activePlan}))}catch(m){const y=m instanceof Error?m.message:String(m);n(g=>({error:y,activePlan:g.activePlan?{...g.activePlan,cards:g.activePlan.cards.map(x=>x.id===i?{...x,status:"error",error:y}:x)}:g.activePlan}))}},async loadSet(i){n({loading:!0,error:null,selectedTextFieldId:null});try{const{plan:r}=await jh(i);n({activePlan:ki(r),selectedCardId:r.cards[0]?.id||null,selectedTextFieldId:null,loading:!1})}catch(r){n({loading:!1,error:r instanceof Error?r.message:String(r)})}}}));function J1(){const{t:n}=ge(),o=ot(k=>k.hydrate),i=ot(k=>k.topic),r=ot(k=>k.audience),c=ot(k=>k.goal),f=ot(k=>k.contentBrief),p=ot(k=>k.outputSizePreset),m=ot(k=>k.customW),y=ot(k=>k.customH),g=ot(k=>k.setBriefField),x=ot(k=>k.setOutputSizePreset),S=ot(k=>k.setCustomSize),b=ot(k=>k.draft),N=ot(k=>k.loading),_=ot(k=>k.generating),M=ot(k=>k.draftError),I=ot(k=>k.generateSet),G=ot(k=>k.activePlan),L=G?.cards||[],O={total:L.length,done:L.filter(k=>k.status==="generated").length};return D.useEffect(()=>{o()},[o]),d.jsxs("section",{className:"card-news-composer","aria-label":n("cardNews.composer"),children:[d.jsx("div",{className:"card-news-composer__head",children:d.jsxs("div",{children:[d.jsx("div",{className:"section-title",children:n("cardNews.composer")}),d.jsx("p",{children:n("cardNews.composerHint")})]})}),d.jsxs("label",{className:"card-news-field",children:[d.jsx("span",{children:n("cardNews.topic")}),d.jsx("input",{value:i,placeholder:n("cardNews.topicPlaceholder"),onChange:k=>g("topic",k.target.value)})]}),d.jsxs("label",{className:"card-news-field",children:[d.jsx("span",{children:n("cardNews.audience")}),d.jsx("input",{value:r,placeholder:n("cardNews.audiencePlaceholder"),onChange:k=>g("audience",k.target.value)})]}),d.jsxs("label",{className:"card-news-field",children:[d.jsx("span",{children:n("cardNews.goal")}),d.jsx("input",{value:c,placeholder:n("cardNews.goalPlaceholder"),onChange:k=>g("goal",k.target.value)})]}),d.jsxs("label",{className:"card-news-field",children:[d.jsx("span",{children:n("cardNews.brief")}),d.jsx("textarea",{value:f,placeholder:n("cardNews.briefPlaceholder"),onChange:k=>g("contentBrief",k.target.value)})]}),d.jsxs("div",{className:"card-news-field",children:[d.jsx("span",{children:n("cardNews.outputSize")}),d.jsx("div",{className:"card-news-size-row",role:"group","aria-label":n("cardNews.outputSize"),children:["1024x1024","2048x2048","custom"].map(k=>d.jsx("button",{type:"button",className:`option-btn${p===k?" active":""}`,onClick:()=>x(k),children:k==="custom"?n("cardNews.customSize"):k==="1024x1024"?"1024²":"2048²"},k))}),p==="custom"?d.jsxs("div",{className:"card-news-custom-size",children:[d.jsx("input",{className:"custom-size-input",type:"text",inputMode:"numeric",value:m,onChange:k=>S(Number.parseInt(k.target.value,10)||m,y),"aria-label":n("size.width")}),d.jsx("span",{children:"×"}),d.jsx("input",{className:"custom-size-input",type:"text",inputMode:"numeric",value:y,onChange:k=>S(m,Number.parseInt(k.target.value,10)||y),"aria-label":n("size.height")})]}):null]}),d.jsxs("button",{type:"button",className:"generate-btn card-news-draft-btn",onClick:()=>{b()},disabled:N||!i.trim(),children:[N?d.jsx("span",{className:"card-news-spinner","aria-hidden":"true"}):null,n(N?"cardNews.drafting":"cardNews.draft")]}),M?d.jsx("div",{className:"card-news-error",role:"alert",children:M}):null,N?d.jsxs("div",{className:"card-news-inline-status",role:"status",children:[d.jsx("span",{className:"card-news-spinner","aria-hidden":"true"}),d.jsx("span",{children:n("cardNews.drafting")})]}):null,d.jsxs("button",{type:"button",className:"composer__tool card-news-generate-btn",onClick:()=>{I()},disabled:!G||_||G.cards.every(k=>k.locked),children:[_?d.jsx("span",{className:"card-news-spinner","aria-hidden":"true"}):null,_?n("cardNews.progress.generating",{done:O.done,total:O.total}):n("cardNews.batchGenerate")]})]})}function $1({item:n,active:o,selectLabel:i,deleteLabel:r,setRef:c,onSelect:f,onDelete:p}){const m=yt(n),y=Wt(n),g=x=>{x.dataTransfer.setData("application/ima2-ref",JSON.stringify(y?Li(n):{image:n.url||n.image,filename:n.filename})),x.dataTransfer.effectAllowed="copy"};return d.jsxs("div",{className:"sidebar-history__item",children:[d.jsx("button",{ref:x=>c(m,x),type:"button",className:`sidebar-history__thumb${o?" active":""}${y?" sidebar-history__thumb--video":""}`,onClick:()=>f(n),"aria-label":i,title:n.prompt??"",draggable:!0,onDragStart:g,children:y?d.jsxs(d.Fragment,{children:[n.thumb?d.jsx("img",{src:n.thumb,alt:"",loading:"lazy",decoding:"async"}):d.jsx("video",{src:n.url||n.image,muted:!0,playsInline:!0,preload:"metadata"}),d.jsx("span",{className:"sidebar-history__play-badge","aria-hidden":"true",children:"▶"})]}):d.jsx("img",{src:n.thumb||n.url||n.image,alt:"",loading:"lazy",decoding:"async"})}),d.jsx("button",{type:"button",className:"sidebar-history__delete",onClick:x=>{x.preventDefault(),x.stopPropagation(),p(n)},"aria-label":r,title:r,children:"x"})]})}function W1({entry:n,active:o,selectLabel:i,deleteLabel:r,setRef:c,onSelect:f,onDelete:p}){const m=Xx(n.items.length);return d.jsxs("div",{className:"sidebar-history__item",children:[d.jsxs("button",{ref:y=>c(n.key,y),type:"button",className:`sidebar-history__sequence${o?" active":""}`,onClick:()=>f(n.sequenceId),"aria-label":i,children:[d.jsx("span",{className:`sidebar-history__sequence-grid count-${m}`,"aria-hidden":"true",children:Array.from({length:m}).map((y,g)=>{const x=n.items[g];return x&&Wt(x)&&!x.thumb?d.jsx("video",{src:x.url||x.image,muted:!0,playsInline:!0,preload:"metadata"},yt(x)):x?d.jsx("img",{src:x.thumb||x.url||x.image,alt:"",loading:"lazy",decoding:"async"},yt(x)):d.jsx("span",{className:"sidebar-history__sequence-placeholder"},`sequence-placeholder-${n.sequenceId}-${g}`)})}),d.jsx("span",{className:"sidebar-history__sequence-badge",children:n.items.length})]}),d.jsx("button",{type:"button",className:"sidebar-history__delete",onClick:y=>{y.preventDefault(),y.stopPropagation(),p(n.sequenceId)},"aria-label":r,title:r,children:"x"})]})}const zh="ima2.sidebarHistoryCollapsed";function Dh(){return d.jsx("div",{className:"sidebar-history__item",children:d.jsx("div",{className:"sidebar-history__thumb sidebar-history__thumb--skeleton","aria-label":"Generating..."})})}function eT({count:n}){const o=Math.min(n,4);return d.jsx("div",{className:"sidebar-history__item",children:d.jsx("div",{className:"sidebar-history__thumb sidebar-history__thumb--collection-skeleton",children:Array.from({length:o},(i,r)=>d.jsx("div",{className:"sidebar-collection-mini sidebar-collection-mini--skeleton"},r))})})}function tT(){const n=E(G=>G.history),o=E(G=>G.currentImage),i=E(G=>G.selectHistory),r=E(G=>G.showHistorySequence),c=E(G=>G.trashHistoryItem),f=E(G=>G.trashHistorySequence),p=E(G=>G.inFlight),m=E(G=>G.multimodeSequences),y=E(G=>{const L=G.multimodePreviewFlightId;return L?L.startsWith("history:")?L.slice(8):G.multimodeSequences[L]?.sequenceId??null:null}),g=E(G=>G.openGallery),x=D.useRef({}),[S,b]=D.useState(()=>{try{return localStorage.getItem(zh)==="1"}catch{return!1}}),{t:N}=ge(),_=Ig(o,y),M=D.useMemo(()=>Rg(n).slice(0,wg),[n]);D.useEffect(()=>{!_||S||x.current[_]?.scrollIntoView({block:"nearest",inline:"nearest"})},[_,S,M]),D.useEffect(()=>{try{localStorage.setItem(zh,S?"1":"0")}catch{}},[S]);const I=(G,L)=>{x.current[G]=L};return d.jsxs("section",{className:`sidebar-history${S?" sidebar-history--collapsed":""}`,"aria-label":N("history.recentTitle"),children:[d.jsxs("div",{className:"sidebar-history__header",children:[d.jsx("span",{className:"section-title",children:N("history.recentTitle")}),d.jsxs("div",{className:"sidebar-history__header-actions",children:[d.jsx("button",{type:"button",className:"sidebar-history__gallery-button",onClick:g,"aria-label":N("history.galleryCard"),title:N("history.openGalleryTitle"),children:d.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[d.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),d.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),d.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),d.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1"})]})}),d.jsx("button",{type:"button",className:"sidebar-history__toggle",onClick:()=>b(G=>!G),title:N(S?"history.expandRecent":"history.collapseRecent"),"aria-expanded":!S,children:N(S?"history.expandRecentShort":"history.collapseRecentShort")})]})]}),S?null:d.jsxs("div",{className:"sidebar-history__grid",children:[p.map(G=>{const L=m[G.id];if(G.kind==="multimode"&&L){const O=[d.jsx(eT,{count:L.requested},`coll-sk-${G.id}`)];for(let k=0;k<L.requested;k++)L.images[k]||O.push(d.jsx(Dh,{},`sk-${G.id}-${k}`));return O}return d.jsx(Dh,{},`sk-${G.id}`)}),M.length===0&&p.length===0?d.jsx("button",{type:"button",className:"sidebar-history__empty",onClick:g,children:N("history.emptyRecent")}):null,M.map(G=>G.type==="sequence"?d.jsx(W1,{entry:G,active:_===G.key,selectLabel:N("history.selectRecent"),deleteLabel:N("history.deleteSequenceAria",{count:G.items.length}),setRef:I,onSelect:r,onDelete:L=>{f(L)}},G.key):d.jsx($1,{item:G.item,active:_===G.key,selectLabel:N("history.selectRecent"),deleteLabel:N("history.deleteImageAria"),setRef:I,onSelect:i,onDelete:L=>{c(L)}},G.key))]})]})}const Lh="(max-width: 800px)";function Hi(){const[n,o]=D.useState(()=>typeof window<"u"?window.matchMedia(Lh).matches:!1);return D.useEffect(()=>{if(typeof window>"u")return;const i=window.matchMedia(Lh),r=()=>o(i.matches);return i.addEventListener("change",r),()=>i.removeEventListener("change",r)},[]),n}function aT(){const{t:n}=ge(),o=E(g=>g.uiMode),i=E(g=>g.workspaceProfile),r=E(g=>g.referenceImages),c=E(g=>g.clearReferences),f=Hi(),p=o==="node"&&Gi?"node":"classic",m=zi(i),y=!f&&p==="classic"&&m.composerPlacement==="bottom"&&m.multimodeHistoryGrouping==="sequence";return d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"logo",children:[d.jsx("div",{className:"logo-mark","aria-hidden":"true"}),d.jsxs("div",{className:"logo-copy",children:[d.jsx("div",{className:"logo-title",children:"ima2"}),d.jsx("div",{className:"logo-title logo-title--gen",children:"gen"})]}),d.jsxs("div",{className:"logo-actions",children:[d.jsx(lT,{}),d.jsx(ay,{variant:"sidebar"}),d.jsx(G1,{})]})]}),d.jsx(O1,{}),p==="classic"?y?d.jsxs(d.Fragment,{children:[d.jsx(tT,{}),d.jsx(kr,{})]}):d.jsxs(d.Fragment,{children:[d.jsx(zu,{}),d.jsx(Du,{}),d.jsx(kr,{})]}):p==="card-news"?d.jsx(d.Fragment,{children:d.jsx(J1,{})}):p==="node"?d.jsxs(d.Fragment,{children:[d.jsx(L1,{}),r.length>0?d.jsxs("div",{className:"node-mode-ref-warning",role:"status",children:[d.jsx("strong",{children:n("node.classicRefsParkedTitle")}),d.jsx("span",{children:n("node.classicRefsParkedBody")}),d.jsx("button",{type:"button",onClick:c,children:n("node.clearParkedRefs")})]}):null,d.jsx("div",{className:"sidebar__node-hint",children:n("sidebar.nodeModeHint")}),d.jsx(kr,{})]}):null]})}function nT(){return d.jsx("aside",{className:"sidebar",children:d.jsx("div",{className:"sidebar__scroll",children:d.jsx(aT,{})})})}function lT(){const{t:n}=ge(),o=E(p=>p.togglePromptLibrary),i=E(p=>p.promptLibraryOpen),r=E(p=>p.rightPanelOpen),c=E(p=>p.toggleRightPanel),f=()=>{!i&&!r&&c(),o()};return d.jsx("button",{type:"button",className:"settings-button",onClick:f,title:n("promptLibrary.title"),"aria-label":n("promptLibrary.title"),children:d.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:d.jsx("path",{d:"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"})})})}const iT=1024,oT=1024,rT="blank-canvas.png";function Gh(n,o){return typeof n!="number"||!Number.isFinite(n)||n<=0?o:Math.max(1,Math.round(n))}async function sT(n){const o=Gh(n?.width,iT),i=Gh(n?.height,oT),r=document.createElement("canvas");r.width=o,r.height=i;const c=r.getContext("2d");if(!c)throw new Error("blank_canvas_context_unavailable");c.fillStyle="#ffffff",c.fillRect(0,0,r.width,r.height);const f=await new Promise((p,m)=>{r.toBlob(y=>{y?p(y):m(new Error("blank_canvas_blob_unavailable"))},"image/png")});return new File([f],rT,{type:"image/png"})}const Sr=1024;function cT(n){const o=/^(\d+)x(\d+)$/.exec(n);if(!o)return{width:Sr,height:Sr};const i=Number.parseInt(o[1]??"",10),r=Number.parseInt(o[2]??"",10);return!Number.isFinite(i)||!Number.isFinite(r)||i<=0||r<=0?{width:Sr,height:Sr}:{width:i,height:r}}function uT(){const n=E(y=>y.importLocalImageToHistory),o=E(y=>y.openCanvas),i=E(y=>y.showToast),r=E(y=>y.getResolvedSize),{t:c}=ge(),[f,p]=D.useState(!1),m=D.useCallback(async()=>{if(!f){p(!0);try{const y=cT(r()),g=await sT(y);await n(g)&&o()}catch{i(c("canvas.blank.failed"),!0)}finally{p(!1)}}},[f,r,n,o,i,c]);return{creatingBlankCanvas:f,createBlankCanvas:m}}const dT="canvas-mode-context",fT="Canvas Mode",mT=["Canvas Mode context:","The user edited or annotated the reference image on a canvas.","If the image is a blank white canvas or paper with user-drawn strokes, treat those strokes as source content and preserve/complete them.","If the image is an existing picture with circles, arrows, sticky notes, handwritten marks, or memo notes over it, treat those marks as edit instructions. Apply the instruction, then remove the marks from the final image unless explicitly asked to keep them.","Infer the intended edit from the canvas marks and memo text. Preserve unrelated image content."].join(`
|
|
36
|
+
`);function pT({imageOverride:n=null,onAfterDeleteFocus:o}){const{t:i}=ge(),r=E(T=>T.currentImage),c=E(T=>T.showToast),f=E(T=>T.insertPromptToComposer),p=E(T=>T.createRootNodeFromHistoryItem),m=E(T=>T.trashHistoryItem),y=E(T=>T.permanentlyDeleteHistoryItemByClick),g=E(T=>T.canvasOpen),x=E(T=>T.openCanvas),[S,b]=D.useState(!1),[N,_]=D.useState(!1),M=n??r;if(!M)return null;const I=Wt(M),G=I?M.url||M.image:"",L=!!M.filename,O=!!M.filename&&!I,k=async()=>{if(!(!M.filename||N)){_(!0);try{await E.getState().animateImage(M.filename,M.prompt??void 0),c(i("toast.animateDone"))}catch(T){const X=T instanceof Error?T.message:i("toast.animateFailed");c(X,!0)}finally{_(!1)}}},$=()=>{const T=document.createElement("a");T.href=M.image,T.download=M.filename||"generated.png",T.click()},K=async T=>{const te=await(await fetch(T)).blob();let ye;if(te.type==="image/png")ye=te;else{const me=new Image;me.crossOrigin="anonymous";const C=URL.createObjectURL(te);await new Promise((J,ae)=>{me.onload=()=>J(),me.onerror=ae,me.src=C});const B=document.createElement("canvas");B.width=me.naturalWidth,B.height=me.naturalHeight,B.getContext("2d").drawImage(me,0,0),URL.revokeObjectURL(C),ye=await new Promise((J,ae)=>B.toBlob(se=>se?J(se):ae(),"image/png"))}await navigator.clipboard.write([new ClipboardItem({"image/png":ye})])},W=async()=>{try{if(I){const T=await Di(G);await K(T)}else await K(M.image);c(i(I?"toast.frameCopied":"toast.imageCopied"))}catch{c(i("toast.copyFailed"),!0)}},Ee=async()=>{try{const T=await e1(G);await K(T),c(i("toast.frameCopied"))}catch{c(i("toast.copyFailed"),!0)}},Oe=async()=>{try{const T=await t1(G);await K(T),c(i("toast.frameCopied"))}catch{c(i("toast.copyFailed"),!0)}},V=()=>{M.prompt&&(navigator.clipboard.writeText(M.prompt),c(i("toast.promptCopied")))},ie=async()=>{let T={ok:!1,isVideo:!1,hasPrompt:!1};try{T=await ey(M)}catch{}g&&n&&f({id:dT,name:fT,text:mT});const X=document.querySelector('textarea[name="prompt"], textarea#prompt, .sidebar textarea');X&&(X.focus(),X.setSelectionRange(X.value.length,X.value.length)),c(i(T.hasPrompt?"toast.forkStarted":"toast.forkStartedNoPrompt"))},oe=async()=>{if(!(!M.filename||S)){b(!0);try{const T=await rS({filename:M.filename});c(i("toast.comfyExported",{filename:T.uploadedFilename}))}catch(T){const X=T instanceof Error?T.code:void 0;c(i(X==="COMFY_URL_NOT_LOCAL"?"toast.comfyExportInvalidUrl":X==="COMFY_IMAGE_INVALID"?"toast.comfyExportInvalidImage":X==="COMFY_IMAGE_NOT_FOUND"?"toast.comfyExportImageNotFound":"toast.comfyExportFailed"),!0)}finally{b(!1)}}},Ce=()=>{p(M),c(i("toast.nodeRootCreated"))},we=async()=>{try{await m(M)}finally{o?.()}},Z=async()=>{try{await y(M)}finally{o?.()}};return d.jsxs("div",{className:"result-actions",children:[d.jsx("button",{type:"button",className:"action-btn",onClick:$,children:i("result.download")}),d.jsx("button",{type:"button",className:`action-btn${I?" action-btn--frame":""}`,onClick:W,children:i(I?"result.copyLastFrame":"result.copyImage")}),I&&d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:"action-btn action-btn--frame",onClick:Ee,children:i("result.copyFirstFrame")}),d.jsx("button",{type:"button",className:"action-btn action-btn--frame",onClick:Oe,children:i("result.copyMidFrame")})]}),d.jsx("button",{type:"button",className:"action-btn",onClick:V,children:i("result.copyPrompt")}),d.jsx("button",{type:"button",className:"action-btn action-btn--primary",onClick:ie,title:i("result.continueHereTitle"),children:i("result.continueHere")}),O&&d.jsx("button",{type:"button",className:"action-btn",onClick:()=>{k()},disabled:N,title:i("result.animateTitle"),children:i(N?"result.animating":"result.animate")}),d.jsx("button",{type:"button",className:"action-btn",onClick:Ce,title:i("result.firstNodeTitle"),children:i("result.firstNode")}),!g&&d.jsx("button",{type:"button",className:"action-btn",onClick:x,title:i("canvas.open"),"aria-label":i("canvas.openAria"),children:d.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:d.jsx("path",{d:"M4 4h8v8M12 4l-8 8"})})}),M.filename&&d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:"action-btn action-btn--danger",onClick:()=>{we()},title:i("result.deleteTitle"),children:i("result.delete")}),d.jsxs("details",{className:"result-actions__more",children:[d.jsx("summary",{className:"action-btn",children:i("result.more")}),d.jsxs("div",{className:"result-actions__menu",children:[L&&d.jsx("button",{type:"button",className:"result-actions__menu-item",onClick:()=>{oe()},title:i("result.sendToComfyUITitle"),disabled:S,children:i("result.sendToComfyUI")}),d.jsx("button",{type:"button",className:"result-actions__menu-item result-actions__danger-item",onClick:()=>{Z()},children:i("result.permanentDelete")})]})]})]})]})}function hT({prompt:n,onCopy:o}){const{t:i}=ge(),r=c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),o())};return d.jsx("div",{className:"result-prompt",onClick:o,onKeyDown:r,role:"button",tabIndex:0,title:i("result.copyPrompt"),"aria-label":i("result.copyPrompt"),children:d.jsx("span",{className:"result-prompt__text",children:n})})}function gT(){const n=E(b=>{const N=b.multimodePreviewFlightId;return N?b.multimodeSequences[N]??null:null}),o=E(b=>b.cancelMultimode),i=E(b=>{const N=b.multimodePreviewFlightId;return!!(N&&(b.multimodeAbortControllers[N]||b.inFlight.some(_=>_.id===N)))}),r=E(b=>b.selectHistory),c=E(b=>b.currentImage),f=E(b=>b.openCanvas),{t:p}=ge(),m=b=>{r(b)},y=b=>{r(b),f()};if(!n)return null;const g=new Map,x=n.partials.filter(b=>b.index==null);for(const b of n.partials)b.index!=null&&g.set(b.index,b);const S=Array.from({length:n.requested},(b,N)=>{const _=n.images[N],M=g.get(N)??(_?void 0:x.shift());return{index:N,image:_,partial:M}});return d.jsxs("section",{className:"multimode-sequence","aria-live":"polite",children:[d.jsxs("div",{className:"multimode-sequence__header",children:[d.jsxs("div",{children:[d.jsx("div",{className:"multimode-sequence__title",children:p("multimode.sequenceTitle")}),d.jsx("div",{className:"multimode-sequence__meta",children:p("multimode.sequenceProgress",{returned:n.returned,requested:n.requested})})]}),i?d.jsx("button",{type:"button",className:"secondary-btn",onClick:o,children:p("multimode.cancel")}):null]}),d.jsx("div",{className:`multimode-sequence__grid count-${Math.min(n.requested,4)}`,children:S.map(({index:b,image:N,partial:_})=>{const M=N&&c?.filename&&N.filename===c.filename;return d.jsxs("article",{className:`multimode-sequence__slot${N?" done":""}${M?" active":""}`,onClick:N?()=>m(N):void 0,onDoubleClick:N?()=>y(N):void 0,role:N?"button":void 0,tabIndex:N?0:void 0,onKeyDown:N?I=>{(I.key==="Enter"||I.key===" ")&&(I.preventDefault(),m(N))}:void 0,children:[d.jsx("div",{className:"multimode-sequence__badge",children:p("multimode.stageLabel",{index:b+1})}),N?d.jsx("img",{src:N.url??N.image,alt:p("canvas.resultAlt"),loading:"lazy",decoding:"async",className:"multimode-sequence__img-fade"}):_?d.jsx("img",{src:_.image,alt:p("multimode.partialAlt"),loading:"lazy",decoding:"async",className:"multimode-sequence__img-fade"}):n.status==="pending"||n.status==="complete"?d.jsx("div",{className:"multimode-sequence__skeleton"}):d.jsx("div",{className:"multimode-sequence__empty",children:n.status==="error"?p("multimode.error"):n.status==="empty"?p("multimode.empty"):n.status==="canceled"?p("multimode.canceled"):n.status==="partial"?p("multimode.notReturned"):p("multimode.generating")})]},N?.filename??b)})})]})}function yT({zoom:n,minZoom:o,maxZoom:i,onZoomIn:r,onZoomOut:c,onReset:f,labels:p}){return d.jsxs("div",{className:"viewer-controls","aria-label":p.controls,onPointerDown:m=>m.stopPropagation(),onDoubleClick:m=>m.stopPropagation(),onWheel:m=>m.stopPropagation(),children:[d.jsx("button",{type:"button",className:"viewer-control-btn",onClick:m=>{m.stopPropagation(),c()},disabled:n<=o,"aria-label":p.zoomOut,children:"-"}),d.jsxs("button",{type:"button",className:"viewer-control-btn viewer-control-btn--label",onClick:m=>{m.stopPropagation(),f()},"aria-label":p.reset,children:[Math.round(n*100),"%"]}),d.jsx("button",{type:"button",className:"viewer-control-btn",onClick:m=>{m.stopPropagation(),r()},disabled:n>=i,"aria-label":p.zoomIn,children:"+"})]})}function zr(n){return n instanceof HTMLElement?n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement||n instanceof HTMLSelectElement||n instanceof HTMLButtonElement||n.isContentEditable:!1}const wn=1,iy=5,xr=.22;function vT(n){return Math.min(iy,Math.max(wn,n))}function bT(n){const[o,i]=D.useState(1),[r,c]=D.useState({x:0,y:0}),[f,p]=D.useState(null),m=D.useRef(0),y=D.useRef(null),g=D.useCallback(()=>{cancelAnimationFrame(m.current),m.current=0,y.current=null,i(1),c({x:0,y:0}),p(null)},[]);D.useEffect(()=>{g()},[g,n]),D.useEffect(()=>()=>{cancelAnimationFrame(m.current)},[]);const x=D.useCallback(I=>{i(G=>{const L=vT(G+I);return L<=wn?(c({x:0,y:0}),wn):Number(L.toFixed(2))})},[]),S=D.useCallback(I=>{I.preventDefault(),x(I.deltaY<0?xr:-xr)},[x]),b=D.useCallback(()=>{if(o>wn){g();return}i(2)},[g,o]),N=D.useCallback(I=>{o<=wn||I.button!==0||(I.preventDefault(),I.currentTarget.setPointerCapture(I.pointerId),p({pointerId:I.pointerId,startX:I.clientX,startY:I.clientY,baseX:r.x,baseY:r.y}))},[r.x,r.y,o]),_=D.useCallback(I=>{if(!f||f.pointerId!==I.pointerId)return;const G={x:f.baseX+I.clientX-f.startX,y:f.baseY+I.clientY-f.startY};y.current=G,cancelAnimationFrame(m.current),m.current=requestAnimationFrame(()=>{c(G),y.current=null})},[f]),M=D.useCallback(I=>{!f||f.pointerId!==I.pointerId||(cancelAnimationFrame(m.current),m.current=0,y.current&&(c(y.current),y.current=null),p(null),I.currentTarget.releasePointerCapture(I.pointerId))},[f]);return{zoom:o,pan:r,reset:g,zoomIn:()=>x(xr),zoomOut:()=>x(-xr),handleWheel:S,handleDoubleClick:b,handlePointerDown:N,handlePointerMove:_,handlePointerUp:M}}const ST=D.lazy(()=>wa(()=>import("./index-BhcvL0g-.js"),[]).then(n=>({default:n.CanvasModeWorkspace})));function xT(n){return n==="low"?"l":n==="medium"?"m":n==="high"?"h":n??null}function TT(n){if(!n)return null;const o=n.match(/^(\d+)x\1$/);return o?`${o[1]}²`:n.replace("x","×")}function NT(n){const o=n.url??n.image;if(!n.canvasVersion||!n.canvasMergedAt||o.startsWith("data:"))return o;const i=o.includes("?")?"&":"?";return`${o}${i}canvasMergedAt=${n.canvasMergedAt}`}function Eu(){const n=E(T=>T.currentImage),o=E(T=>T.importLocalImageToHistory),i=E(T=>{const X=T.multimodePreviewFlightId;return X?T.multimodeSequences[X]??null:null}),r=E(T=>T.selectHistoryShortcutTarget),c=E(T=>T.trashHistoryItem),f=E(T=>T.permanentlyDeleteHistoryItemByShortcut),p=E(T=>T.markGeneratedResultsSeen),m=E(T=>T.activeGenerations),y=E(T=>T.quality),g=E(T=>T.getResolvedSize),x=E(T=>T.canvasOpen),S=E(T=>T.openCanvas),b=E(T=>T.showToast),{t:N}=ge(),[_,M]=D.useState(!1),{creatingBlankCanvas:I,createBlankCanvas:G}=uT(),L=D.useRef(null),O=n?`${n.filename??n.url??n.image}:${n.canvasMergedAt??""}`:null,k=bT(O),$=()=>{n?.prompt&&(navigator.clipboard.writeText(n.prompt),b(N("toast.promptCopied")))},K=T=>{if(T.key==="Delete"||T.key==="Backspace"){if(!n||T.target!==T.currentTarget||zr(T.target))return;if(T.preventDefault(),T.shiftKey){f(n);return}c(n);return}T.key!=="ArrowLeft"&&T.key!=="ArrowRight"&&T.key!=="Home"&&T.key!=="End"||T.target===T.currentTarget&&(zr(T.target)||(T.preventDefault(),T.key==="ArrowLeft"?r("previous"):T.key==="ArrowRight"?r("next"):T.key==="Home"?r("first"):T.key==="End"&&r("last")))},W=T=>{zr(T.target)||(p(),T.currentTarget.focus())},Ee=D.useCallback(()=>{window.requestAnimationFrame(()=>L.current?.focus())},[]),Oe=D.useCallback(T=>{Array.from(T.dataTransfer.types).includes("Files")&&(T.preventDefault(),M(X=>X||!0))},[]),V=D.useCallback(T=>{T.currentTarget.contains(T.relatedTarget)||M(!1)},[]),ie=D.useCallback(async T=>{if(!Array.from(T.dataTransfer.types).includes("Files"))return;T.preventDefault(),M(!1);const X=Array.from(T.dataTransfer.files).filter(te=>/^image\/(png|jpeg|webp)$/.test(te.type));X.length!==0&&await o(X[0])},[o]);if(x&&n)return d.jsx(D.Suspense,{fallback:d.jsx("main",{className:"canvas canvas--mode-open","aria-busy":"true"}),children:d.jsx(ST,{currentImage:n})});const oe=xT(n?.quality??y),Ce=TT(n?.size??g()),we=_x(n?.model,n?.provider),Z=n?NT(n):null;return d.jsxs("main",{className:`canvas${_?" canvas--drop-active":""}`,onDragOver:Oe,onDragLeave:V,onDrop:ie,children:[_?d.jsx("div",{className:"canvas__drop-overlay","aria-hidden":!0,children:d.jsx("span",{className:"canvas__drop-hint",children:N("canvas.drop.hint")})}):null,d.jsx("div",{className:`progress-bar${m>0?" active":""}`}),i?d.jsx(gT,{}):n&&Z?d.jsxs("div",{ref:L,className:"result-container visible",tabIndex:0,onMouseDown:W,onKeyDown:K,"aria-label":N("canvas.imageViewerAria"),children:[d.jsxs("div",{className:`result-preview-frame canvas-annotation-frame${k.zoom>wn?" canvas-annotation-frame--zoomed":""}`,onWheel:k.handleWheel,onDoubleClick:k.handleDoubleClick,onPointerDown:k.handlePointerDown,onPointerMove:k.handlePointerMove,onPointerUp:k.handlePointerUp,onPointerCancel:k.handlePointerUp,children:[Wt(n)?d.jsxs(d.Fragment,{children:[d.jsx("video",{className:"result-img",src:Z,controls:!0,autoPlay:!0,loop:!0,playsInline:!0,style:{transform:`translate(${k.pan.x}px, ${k.pan.y}px) scale(${k.zoom})`}},O??void 0),d.jsx("div",{className:"result-drag-handle",draggable:!0,onDragStart:T=>{T.dataTransfer.setData("application/ima2-ref",JSON.stringify(Li(n))),T.dataTransfer.effectAllowed="copy"},title:N("canvas.dragToComposer"),"aria-label":N("canvas.dragToComposer"),children:"DRAG"})]}):d.jsxs(d.Fragment,{children:[d.jsx("img",{className:"result-img",src:Z,alt:N("canvas.resultAlt"),decoding:"async",style:{transform:`translate(${k.pan.x}px, ${k.pan.y}px) scale(${k.zoom})`},onDoubleClick:T=>{T.stopPropagation(),S()}},O??void 0),d.jsx("div",{className:"result-drag-handle",draggable:!0,onDragStart:T=>{T.dataTransfer.setData("application/ima2-ref",JSON.stringify({image:n.url||n.image,filename:n.filename})),T.dataTransfer.effectAllowed="copy"},title:N("canvas.dragToComposer"),"aria-label":N("canvas.dragToComposer"),children:"DRAG"})]}),d.jsx(yT,{zoom:k.zoom,minZoom:wn,maxZoom:iy,onZoomIn:k.zoomIn,onZoomOut:k.zoomOut,onReset:k.reset,labels:{controls:N("viewer.controls"),zoomIn:N("viewer.zoomIn"),zoomOut:N("viewer.zoomOut"),reset:N("viewer.reset")}})]}),d.jsx("div",{className:"result-meta",children:(Wt(n)?[n.elapsed!=null?`${n.elapsed}s`:null,n.video?.duration?`${n.video.duration}s clip`:null,n.video?.resolution??null,n.video?.aspectRatio??null,kg(n.videoContinuity),we]:[n.elapsed!=null?`${n.elapsed}s`:null,n.usage?N("canvas.tokens",{n:n.usage.total_tokens??"?"}):null,wx(n.reasoningEffort),oe,Ce,we]).filter(T=>!!T).join(" · ")}),d.jsx(pT,{onAfterDeleteFocus:Ee}),n.prompt?d.jsx(hT,{prompt:n.prompt,onCopy:$}):null]}):n?null:d.jsxs("div",{className:"canvas__blank-entry",children:[d.jsx("div",{className:"canvas__blank-sheet","aria-hidden":!0}),d.jsxs("div",{className:"canvas__blank-copy",children:[d.jsx("strong",{children:N("canvas.blank.title")}),d.jsx("span",{children:N("canvas.blank.subtitle")})]}),d.jsx("button",{type:"button",className:"canvas__blank-button",onClick:()=>{G()},disabled:I,children:N(I?"canvas.blank.creating":"canvas.blank.create")})]})]})}function _T(){return d.jsxs("div",{className:"classic-workspace",children:[d.jsx("div",{className:"classic-workspace__stage",children:d.jsx(Eu,{})}),d.jsxs("div",{className:"classic-workspace__dock",children:[d.jsx(zu,{variant:"bottom"}),d.jsx(Du,{})]})]})}function Ca({title:n,help:o,items:i,value:r,onChange:c}){return d.jsxs("div",{className:"option-group",children:[n?d.jsx("div",{className:"section-title",children:n}):null,d.jsx("div",{className:"option-row",children:i.map(f=>d.jsxs("button",{className:`option-btn${f.value===r?" active":""}`,style:f.color?{color:f.color}:void 0,disabled:f.disabled,onClick:()=>c(f.value),type:"button",children:[f.label,f.sub?d.jsxs(d.Fragment,{children:[d.jsx("br",{}),d.jsx("span",{className:"option-sub",children:f.sub})]}):null]},f.value))}),o?d.jsx("p",{className:"option-help",children:o}):null]})}const oy="ima2.customSizeSlots";function ET(n){if(!n||typeof n!="object")return!1;const o=n;return typeof o.id=="string"&&typeof o.w=="number"&&typeof o.h=="number"&&typeof o.updatedAt=="number"}function AT(){try{const n=localStorage.getItem(oy);if(!n)return[];const o=JSON.parse(n);return Array.isArray(o)?El(o.filter(ET)):[]}catch{return[]}}function CT(n){try{localStorage.setItem(oy,JSON.stringify(El(n)))}catch{}}function wT(n,o,i){return Hr({id:`slot_${Date.now()}_${Math.random().toString(36).slice(2,7)}`,w:n,h:o,ratio:i,updatedAt:Date.now()})}function Ci(n){return n.map(o=>({value:o.value,label:o.label,sub:o.sub}))}function MT(){const n=E(Z=>Z.sizePreset),o=E(Z=>Z.setSizePreset),i=E(Z=>Z.customW),r=E(Z=>Z.customH),c=E(Z=>Z.setCustomSize),{t:f}=ge(),[p,m]=D.useState(String(i)),[y,g]=D.useState(String(r)),[x,S]=D.useState(n==="custom"),[b,N]=D.useState(()=>AT()),[_,M]=D.useState(null),[I,G]=D.useState("free"),L=n==="custom",O=Iu(p,y,i,r),k=xx().filter(Z=>Z.value==="auto");D.useEffect(()=>{m(String(i)),g(String(r))},[i,r]),D.useEffect(()=>{L||(S(!1),M(null))},[L]);function $(Z){N(Z),CT(Z)}function K(){const Z=sa(p,i),T=sa(y,r);c(Z,T),m(String(Z)),g(String(T))}function W(Z){Z.key==="Enter"&&(Z.preventDefault(),K())}function Ee(){o("custom"),S(!0),M(b.length>=_l?b[0]?.id??null:null)}function Oe(Z){o(Z),Z!=="custom"&&(S(!1),M(null))}function V(Z){o("custom"),c(Z.w,Z.h),m(String(Z.w)),g(String(Z.h)),S(!1),M(Z.id)}function ie(Z){G(Z.id);const T=px(Z);T&&(m(String(T.w)),g(String(T.h)))}function oe(){const Z=wT(O.w,O.h,I),T=b.length>=_l&&_?gx(b,_,Z):hx(b,Z);$(T),o("custom"),c(O.w,O.h),m(String(O.w)),g(String(O.h)),M(Z.id),S(!1)}const Ce=O.reasons.length>0?O.reasons.map(Z=>f(`size.adjustedReasons.${Z}`)).join(", "):f("size.noAdjustment"),we=O.reasons.includes("maxPixels")&&O.requestedW===O.requestedH&&O.w===O.h?f("size.squareMaxHint",{size:`${ih}×${ih}`}):null;return d.jsxs("div",{className:"option-group size-picker",children:[d.jsx("div",{className:"section-title",children:f("size.title")}),d.jsx(Ca,{title:"",items:Ci(yx),value:n,onChange:Oe}),d.jsx(Ca,{title:"",items:Ci(vx),value:n,onChange:Oe}),d.jsx(Ca,{title:"",items:Ci(bx),value:n,onChange:Oe}),d.jsx(Ca,{title:"",items:Ci(Sx),value:n,onChange:Oe}),d.jsxs("div",{className:"option-row size-picker__quick-row",children:[Ci(k).map(Z=>d.jsxs("button",{type:"button",className:`option-btn${n===Z.value?" active":""}`,onClick:()=>Oe(Z.value),children:[Z.label,Z.sub?d.jsxs(d.Fragment,{children:[d.jsx("br",{}),d.jsx("span",{className:"option-sub",children:Z.sub})]}):null]},Z.value)),d.jsxs("button",{type:"button",className:`option-btn${L?" active":""}`,onClick:Ee,children:[f("size.customPlus"),d.jsx("br",{}),d.jsx("span",{className:"option-sub",children:f("size.customSub")})]})]}),b.length>0?d.jsx("div",{className:"option-row size-picker__slot-row",children:b.map(Z=>d.jsxs("button",{type:"button",className:`option-btn size-picker__slot${L&&i===Z.w&&r===Z.h?" active":""}`,onClick:()=>V(Z),children:[Z.w,"×",Z.h,d.jsx("br",{}),d.jsx("span",{className:"option-sub",children:Z.ratio||f("size.customSlot")})]},Z.id))}):null,x?d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"size-picker__ratio-row",children:fx.map(Z=>d.jsx("button",{type:"button",className:`size-picker__ratio${I===Z.id?" active":""}`,onClick:()=>ie(Z),children:Z.id==="free"?f("size.ratioFree"):Z.label},Z.id))}),d.jsxs("div",{className:"option-row size-picker__custom-row",children:[d.jsx("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",className:"custom-size-input",value:p,onChange:Z=>m(Z.target.value.replace(/\D/g,"")),onBlur:K,onKeyDown:W,placeholder:f("size.width")}),d.jsx("span",{className:"size-picker__dimension-separator","aria-hidden":"true",children:"×"}),d.jsx("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",className:"custom-size-input",value:y,onChange:Z=>g(Z.target.value.replace(/\D/g,"")),onBlur:K,onKeyDown:W,placeholder:f("size.height")})]}),d.jsxs("div",{className:"size-picker__preview",children:[d.jsx("span",{children:f("size.normalizedPreview")}),d.jsx("strong",{children:mx(O.w,O.h)})]}),d.jsx("div",{className:"size-picker__preview size-picker__preview--reason",children:Ce}),we?d.jsx("div",{className:"size-picker__preview size-picker__preview--detail",children:we}):null,b.length>=_l?d.jsxs("div",{className:"size-picker__replace-row",children:[d.jsx("span",{children:f("size.replaceCustomSlot")}),b.map(Z=>d.jsxs("button",{type:"button",className:`size-picker__replace${_===Z.id?" active":""}`,onClick:()=>M(Z.id),children:[Z.w,"×",Z.h]},Z.id))]}):null,d.jsx("button",{type:"button",className:"size-picker__save",onClick:oe,children:b.length>=_l?f("size.replaceCustomSlot"):f("size.saveCustomSlot")}),d.jsx("div",{className:"size-hint",children:f("size.hint")})]}):null]})}const vu=[1,2,4];function qh(n){return Math.min(8,Math.max(1,Math.trunc(n||1)))}function RT(){const n=E(L=>L.count),o=E(L=>L.setCount),i=E(L=>L.uiMode),r=E(L=>L.multimode),c=E(L=>L.multimodeMaxImages),f=E(L=>L.setMultimodeMaxImages),{t:p}=ge(),m=i==="classic"&&r,y=m?c:n,g=m?f:o,[x,S]=D.useState(!vu.includes(y)),[b,N]=D.useState(String(y));D.useEffect(()=>{S(!vu.includes(y)),N(String(y))},[m,y]);function _(L=b){const O=qh(Number.parseInt(L,10));g(O),N(String(O))}function M(L){S(!1),N(String(L)),g(L)}function I(L){const O=qh(y+L);S(!0),N(String(O)),g(O)}function G(L){L.key==="Enter"&&(L.preventDefault(),_())}return d.jsxs("div",{className:"option-group count-picker",children:[d.jsx("div",{className:"section-title",children:p(m?"multimode.maxStages":"count.title")}),d.jsxs("div",{className:"option-row",children:[vu.map(L=>d.jsx("button",{type:"button",className:`option-btn${y===L&&!x?" active":""}`,onClick:()=>M(L),children:L},L)),d.jsx("button",{type:"button",className:`option-btn${x?" active":""}`,onClick:()=>{S(L=>!L),N(String(y))},children:p("count.customPlus")})]}),x?d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"count-picker__custom",children:[d.jsx("button",{type:"button",className:"count-picker__step",onClick:()=>I(-1),"aria-label":p("count.decrease"),children:"-"}),d.jsx("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",className:"count-picker__input",value:b,onChange:L=>N(L.target.value.replace(/\D/g,"")),onBlur:()=>_(),onKeyDown:G,"aria-label":p("count.customLabel")}),d.jsx("button",{type:"button",className:"count-picker__step",onClick:()=>I(1),"aria-label":p("count.increase"),children:"+"})]}),d.jsx("p",{className:"option-help",children:y>=5?p(m?"multimode.highCountHint":"count.highCountHint"):p(m?"multimode.minMaxHint":"count.minMaxHint")})]}):null]})}const IT={low:{"1024x1024":.006,"1024x1536":.005,"1536x1024":.005,"1024x1360":.005,"1360x1024":.005,"1024x1824":.006,"1824x1024":.006,"2048x2048":.012,"2048x1152":.009,"1152x2048":.009,"3840x2160":.023,"2160x3840":.023,auto:.006},medium:{"1024x1024":.053,"1024x1536":.041,"1536x1024":.041,"1024x1360":.041,"1360x1024":.041,"1024x1824":.05,"1824x1024":.05,"2048x2048":.106,"2048x1152":.08,"1152x2048":.08,"3840x2160":.2,"2160x3840":.2,auto:.053},high:{"1024x1024":.211,"1024x1536":.165,"1536x1024":.165,"1024x1360":.165,"1360x1024":.165,"1024x1824":.2,"1824x1024":.2,"2048x2048":.422,"2048x1152":.32,"1152x2048":.32,"3840x2160":.8,"2160x3840":.8,auto:.211}},OT={512:.045,"1K":.067,"2K":.101,"4K":.151},jT={512:.134,"1K":.134,"2K":.134,"4K":.24};function kT(n){return n<=512?"512":n<=1024?"1K":n<=2048?"2K":"4K"}function zT(n,o){const i=n.match(/^(\d+)x(\d+)$/);if(!i)return .003;const r=Math.max(Number(i[1]),Number(i[2])),c=kT(r),p=o==="nano-banana-pro"?jT:OT;return p[c]??p["1K"]??.003}function DT(n,o,i,r){return i==="gemini-api"?zT(o,r):IT[n]?.[o]??0}function LT(){const{t:n}=ge(),o=E(b=>b.provider),i=E(b=>b.quality),r=E(b=>b.multimode),c=E(b=>b.multimodeMaxImages),p=E(b=>b.getResolvedSize)(),m=E(b=>b.imageModel),y=o==="oauth"||o==="grok"||o==="agy",g=DT(i,p,o,m),x=y?n("cost.free"):r?n("cost.multimodeApprox",{amount:(g*c).toFixed(3),count:c}):n("cost.approx",{amount:g.toFixed(3)}),S=y?"var(--green)":void 0;return d.jsxs("div",{className:"cost-estimate",children:[d.jsx("span",{children:n("cost.label")}),d.jsx("span",{className:"price",style:S?{color:S}:void 0,children:x})]})}function GT(){const[n,o]=D.useState(null);return D.useEffect(()=>{let i=!1,r=null;const c=async()=>{try{const f=await Jb();if(i)return;o(f),f.status==="starting"&&(r=setTimeout(c,3e3))}catch{i||o(null)}};return c(),()=>{i=!0,r&&clearTimeout(r)}},[]),n}function qT(){const[n,o]=D.useState(null),[i,r]=D.useState(!1);return D.useEffect(()=>{let c=!1;return $b().then(f=>{c||o(f)}).catch(()=>{c||r(!0)}),()=>{c=!0}},[]),{data:n,error:i}}function HT(){const[n,o]=D.useState(null);return D.useEffect(()=>{let i=!1,r=null;const c=async()=>{try{const f=await fetch("/api/grok/status");if(i)return;const p=await f.json();o(p),p.status!=="ready"&&(r=setTimeout(c,1e4))}catch{i||o({status:"offline"})}};return c(),()=>{i=!0,r&&clearTimeout(r)}},[]),n}function PT(){const[n,o]=D.useState(null),[i,r]=D.useState(null),c=D.useCallback(async()=>{try{const p=await(await fetch("/api/keys/status")).json();o(p),r(null)}catch(f){r(f instanceof Error?f:new Error(String(f)))}},[]);return D.useEffect(()=>{let f=!1,p=null;return(async()=>(await c(),f||(p=setInterval(c,3e4))))(),()=>{f=!0,p&&clearInterval(p)}},[c]),{data:n,error:i,mutate:c}}function UT({open:n,providerLabel:o,reason:i,hint:r,onClose:c}){const{t:f}=ge();if(D.useEffect(()=>{if(!n)return;const m=y=>{y.key==="Escape"&&c()};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[n,c]),!n)return null;const p=f("apiDisabled.title",{provider:o});return d.jsx("div",{className:"modal-backdrop",onClick:c,role:"presentation",children:d.jsxs("div",{className:"modal",role:"dialog","aria-modal":"true","aria-label":p,onClick:m=>m.stopPropagation(),children:[d.jsx("div",{className:"modal__title",children:p}),d.jsxs("div",{className:"modal__body",children:[d.jsx("p",{children:i}),r?d.jsx("p",{className:"modal__hint",children:r}):null]}),d.jsx("div",{className:"modal__actions",children:d.jsx("button",{type:"button",className:"modal__btn",onClick:c,children:f("common.ok")})})]})})}function ry(){const{t:n}=ge(),o=GT(),{data:i}=qT(),r=HT(),{data:c}=PT(),f=o?.status==="ready";let p=n("provider.oauthNotReady"),m;o?.status==="auth_required"?(p=n("provider.codexLoginRequired"),m=n("provider.codexLoginHint")):o?.status==="starting"?p=n("provider.oauthStarting"):o||(p=n("provider.serverUnreachable"));const y=i?.apiKeyValid===!0,g=r?.status==="ready",x=r?r.status==="offline"?n("provider.grokOffline"):r.status==="no_image_model"?n("provider.grokNoImageModel"):r.status==="error"?n("provider.grokNotReady"):"":n("provider.grokNotReady"),S=c?.xai?.valid===!0,b=c?.gemini?.valid===!0||c?.vertex?.valid===!0;return{oauth:{ok:f,reason:p,hint:m},api:{ok:y,reason:y?"":n("provider.apiInvalid")},grok:{ok:g,reason:x,hint:g?void 0:n("provider.grokOfflineHint")},"grok-api":{ok:S,reason:S?"":n("provider.xaiApiKeyRequired")},agy:{ok:!0,reason:""},"gemini-api":{ok:b,reason:b?"":n("provider.geminiApiKeyRequired")}}}const Hh=[{header:"GPT",cells:[{value:"oauth",label:"OAuth"},{value:"api",label:"API"}]},{header:"Grok",cells:[{value:"grok",label:"OAuth"},{value:"grok-api",label:"API"}]},{header:"Gemini",cells:[{value:"agy",label:"agy"},{value:"gemini-api",label:"API"}]}];function BT({allowGrok:n=!0}){const{t:o}=ge(),i=E(S=>S.provider),r=E(S=>S.setProvider),c=ry(),[f,p]=D.useState(null),m={...c,grok:n?c.grok:{ok:!1,reason:o("provider.grokClassicOnly"),hint:o("provider.grokClassicOnlyHint")}},y=S=>{S.disabled||(m[S.value].ok?r(S.value):p(S.value))},g=f?Hh.flatMap(S=>S.cells).find(S=>S.value===f)?.label??"":"",x=f?{label:g,...m[f]}:null;return d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"section-title",children:o("provider.authTitle")}),d.jsx("div",{className:"provider-grid",children:Hh.map(S=>d.jsxs("div",{className:"provider-grid__col",children:[d.jsx("div",{className:"provider-grid__header",children:S.header}),S.cells.map((b,N)=>{const _=!b.disabled&&i===b.value,M=b.disabled?!1:m[b.value].ok;return d.jsxs("button",{type:"button",className:`provider-pill${_?" selected":""}${b.disabled?" disabled":""}`,onClick:()=>y(b),disabled:b.disabled,title:b.disabled?o("provider.comingSoon"):M?b.label:m[b.value].reason,"aria-label":b.disabled?`${S.header} ${b.label} (coming soon)`:M?o("provider.availableAria",{name:`${S.header} ${b.label}`}):o("provider.unavailableAria",{name:`${S.header} ${b.label}`}),"aria-pressed":_,children:[!b.disabled&&d.jsx("span",{className:`status-dot ${M?"status-dot--ok":"status-dot--bad"}`,"aria-hidden":"true"}),d.jsx("span",{children:b.label})]},`${S.header}-${N}`)})]},S.header))}),d.jsx(UT,{open:!!x,providerLabel:x?.label??"",reason:x?.reason??"",hint:x?.hint,onClose:()=>p(null)})]})}const FT=[{value:"1:1",label:"1:1"},{value:"3:2",label:"3:2"},{value:"2:3",label:"2:3"},{value:"4:3",label:"4:3"},{value:"3:4",label:"3:4"},{value:"16:9",label:"16:9"},{value:"9:16",label:"9:16"},{value:"2:1",label:"2:1"},{value:"1:2",label:"1:2"},{value:"auto",label:"Auto"}],KT=[{value:"1k",label:"1K"},{value:"2k",label:"2K"}];function VT(){const{t:n}=ge(),o=E(f=>f.grokAspectRatio),i=E(f=>f.grokResolution),r=E(f=>f.setGrokAspectRatio),c=E(f=>f.setGrokResolution);return d.jsxs("div",{className:"option-group grok-size-picker",children:[d.jsx("div",{className:"section-title",children:n("size.grokAspectTitle")}),d.jsx("div",{className:"grok-size-picker__aspects",children:FT.map(f=>d.jsx("button",{type:"button",className:`option-btn grok-size-picker__aspect${o===f.value?" active":""}`,onClick:()=>r(f.value),children:f.label},f.value))}),d.jsx("div",{className:"section-title",style:{marginTop:8},children:n("size.grokResolutionTitle")}),d.jsx("div",{className:"grok-size-picker__resolutions",children:KT.map(f=>d.jsx("button",{type:"button",className:`option-btn grok-size-picker__res${i===f.value?" active":""}`,onClick:()=>c(f.value),children:f.label},f.value))})]})}const YT=[{value:"grok-imagine-image",label:"Grok",sub:"Fast"},{value:"grok-imagine-image-quality",label:"Grok+",sub:"Best"}];function XT(){const{t:n}=ge(),o=E(r=>r.imageModel),i=E(r=>r.setImageModel);return d.jsxs("div",{className:"option-group",children:[d.jsx("div",{className:"section-title",children:n("quality.grokModelTitle")}),d.jsx("div",{className:"option-row",children:YT.map(r=>d.jsxs("button",{type:"button",className:`option-btn${o===r.value?" active":""}`,onClick:()=>i(r.value),children:[r.label,d.jsx("br",{}),d.jsx("span",{className:"option-sub",children:r.sub})]},r.value))})]})}const QT=[{value:"480p",label:"480p"},{value:"720p",label:"720p"}],ZT=["auto","1:1","16:9","9:16","4:3","3:4","3:2","2:3"].map(n=>({value:n,label:n})),JT=[3,5,8,10,12,15],$T=[{value:"grok-imagine-video",label:"Grok V",sub:"Fast"},{value:"grok-imagine-video-1.5-preview",label:"Grok V1.5",sub:"Preview"}];function WT(){const{t:n}=ge(),o=E(O=>O.videoModelSelected),i=E(O=>O.selectVideoModel),r=E(O=>O.activeVideoRefCount()),c=E(O=>O.videoDuration),f=E(O=>O.setVideoDuration),p=E(O=>O.videoResolution),m=E(O=>O.setVideoResolution),y=E(O=>O.videoAspectRatio),g=E(O=>O.setVideoAspectRatio),x=E(O=>O.videoTopic),S=E(O=>O.setVideoTopic),b=E(O=>O.videoContinuityLineage),N=r>=2?rg:15,_=sg(r),M=kg(b),[I,G]=D.useState(null);D.useEffect(()=>{fetch("/api/config/grok-planner").then(O=>O.json()).then(G).catch(()=>{})},[]);const L=async O=>{try{await fetch("/api/config/grok-planner",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:O})}),G(k=>k?{...k,model:O}:null)}catch{}};return d.jsxs("div",{className:"right-panel-settings video-controls",children:[d.jsxs("div",{className:"option-group",children:[d.jsx("div",{className:"section-title",children:n("quality.grokModelTitle")??"Model"}),d.jsx("div",{className:"option-row",children:$T.map(O=>d.jsxs("button",{type:"button",className:`option-btn${o===O.value?" active":""}`,onClick:()=>i(O.value),children:[O.label,d.jsx("br",{}),d.jsx("span",{className:"option-sub",children:O.sub})]},O.value))})]}),d.jsxs("div",{className:"provider-compat-note",role:"note",children:[d.jsx("strong",{children:n("video.modeLabel")}),d.jsx("span",{children:n(`video.mode.${_}`,{n:r})})]}),M?d.jsxs("div",{className:"provider-compat-note",role:"note",children:[d.jsx("strong",{children:"Continuity"}),d.jsx("span",{children:M})]}):null,d.jsxs("div",{className:"option-group",children:[d.jsx("div",{className:"section-title",children:n("video.seriesTopicTitle")??"시리즈 주제"}),d.jsx("input",{type:"text",className:"video-topic-input",placeholder:n("video.seriesTopicPlaceholder")??"예: 한국 여행 브이로그",value:x,onChange:O=>S(O.target.value)})]}),d.jsxs("div",{className:"option-group",children:[d.jsx("div",{className:"section-title",children:n("video.durationTitle")}),d.jsx("div",{className:"option-row",children:JT.filter(O=>O<=N).map(O=>d.jsxs("button",{type:"button",className:`option-btn${c===O?" active":""}`,onClick:()=>f(O),children:[O,"s"]},O))})]}),d.jsx(Ca,{title:n("video.resolutionTitle"),items:QT,value:p,onChange:m}),d.jsx(Ca,{title:n("video.aspectTitle"),items:ZT,value:y,onChange:g}),I&&d.jsx("div",{className:"video-controls__pills",children:d.jsx("select",{className:"video-controls__pill",value:I.model,onChange:O=>{L(O.target.value)},"aria-label":n("video.plannerModelTitle"),children:I.options.map(O=>d.jsx("option",{value:O,children:O},O))})}),d.jsxs("details",{className:"provider-compat-details",style:{marginTop:8},children:[d.jsx("summary",{children:"Active prompt"}),d.jsx("p",{children:Rr})]})]})}const eN=[{value:"png",label:"PNG"},{value:"jpeg",label:"JPEG"},{value:"webp",label:"WebP"}],Tr=[{value:"1:1",label:"1:1"},{value:"2:3",label:"2:3"},{value:"3:2",label:"3:2"},{value:"3:4",label:"3:4"},{value:"4:3",label:"4:3"},{value:"4:5",label:"4:5"},{value:"5:4",label:"5:4"},{value:"9:16",label:"9:16"},{value:"16:9",label:"16:9"},{value:"21:9",label:"21:9"}],tN=[{value:"512",label:"512px"},{value:"1K",label:"1K"},{value:"2K",label:"2K"},{value:"4K",label:"4K"}],Au={"1:1":{512:"512x512","1K":"1024x1024","2K":"2048x2048","4K":"4096x4096"},"2:3":{512:"424x632","1K":"848x1264","2K":"1696x2528","4K":"3392x5056"},"3:2":{512:"632x424","1K":"1264x848","2K":"2528x1696","4K":"5056x3392"},"3:4":{512:"448x600","1K":"896x1200","2K":"1792x2400","4K":"3584x4800"},"4:3":{512:"600x448","1K":"1200x896","2K":"2400x1792","4K":"4800x3584"},"4:5":{512:"464x576","1K":"928x1152","2K":"1856x2304","4K":"3712x4608"},"5:4":{512:"576x464","1K":"1152x928","2K":"2304x1856","4K":"4608x3712"},"9:16":{512:"384x688","1K":"768x1376","2K":"1536x2752","4K":"3072x5504"},"16:9":{512:"688x384","1K":"1376x768","2K":"2752x1536","4K":"5504x3072"},"21:9":{512:"792x168","1K":"1584x672","2K":"3168x1344","4K":"6336x2688"}};function aN(n){for(const[o,i]of Object.entries(Au))for(const[r,c]of Object.entries(i))if(c===n)return{ratio:o,res:r};return{ratio:"1:1",res:"1K"}}function sy(){const{t:n}=ge(),o=E(T=>T.provider),i=E(T=>T.quality),r=E(T=>T.setQuality),c=E(T=>T.format),f=E(T=>T.setFormat),p=E(T=>T.moderation),m=E(T=>T.setModeration),y=E(T=>T.multimode),g=E(T=>T.setMultimode),x=E(T=>T.imageModel),S=E(T=>T.setImageModel),b=E(T=>T.selectVideoModel),N=E(T=>T.sizePreset),_=E(T=>T.customW),M=E(T=>T.customH),I=E(T=>T.setSizePreset),G=E(T=>T.setCustomSize),L=E(T=>T.uiMode),O=E(T=>T.videoModelSelected),k=L==="classic",$=o==="grok"||o==="grok-api",K=o==="agy",W=o==="gemini-api",Ee=K||W,Oe=$||Ee,V=N==="custom"?`${_}x${M}`:"1024x1024",ie=W?aN(V):{ratio:"1:1",res:"1K"},oe=(T,X)=>{const te=Au[T]?.[X]||"1024x1024",[ye,me]=te.split("x").map(Number);I("custom"),G(ye,me)},Ce=[{value:"low",label:n("quality.lowLabel"),sub:n("quality.lowSub")},{value:"medium",label:n("quality.mediumLabel"),sub:n("quality.mediumSub")},{value:"high",label:n("quality.highLabel"),sub:n("quality.highSub")}],we=[{value:"auto",label:n("moderation.autoLabel"),sub:n("moderation.autoSub")},{value:"low",label:n("moderation.lowLabel"),sub:n("moderation.lowSub"),color:"var(--amber)"}],Z=T=>{T==="video"?b("grok-imagine-video"):S(x)};return d.jsxs("div",{className:"right-panel-settings",role:"tabpanel",children:[d.jsx(BT,{allowGrok:!0}),$?d.jsxs("details",{className:"provider-compat-details",children:[d.jsx("summary",{children:n("provider.grokCompatTitle")}),d.jsx("p",{children:n("provider.grokCompatBody")})]}):K?d.jsxs("details",{className:"provider-compat-details",children:[d.jsx("summary",{children:n("provider.agyCompatTitle")}),d.jsx("p",{children:n("provider.agyCompatBody")})]}):W?d.jsxs("details",{className:"provider-compat-details",children:[d.jsx("summary",{children:"Gemini API"}),d.jsx("p",{children:"Google Gemini API. Supports aspect ratio + resolution control (512px–4K)."})]}):d.jsxs("details",{className:"provider-compat-details",children:[d.jsx("summary",{children:n("provider.gptCompatTitle")}),d.jsx("p",{children:n("provider.gptCompatBody")})]}),$&&d.jsx("div",{className:"option-group grok-mode-toggle",children:d.jsxs("div",{className:"option-row",children:[d.jsx("button",{type:"button",className:`option-btn${O?"":" active"}`,onClick:()=>Z("image"),children:n("grokMode.image")}),d.jsx("button",{type:"button",className:`option-btn${O?" active":""}`,onClick:()=>Z("video"),children:n("grokMode.video")})]})}),O?d.jsx(WT,{}):d.jsxs(d.Fragment,{children:[K?null:$?d.jsxs(d.Fragment,{children:[d.jsx(XT,{}),d.jsx(VT,{})]}):W?d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"option-group",children:[d.jsx("div",{className:"section-title",children:n("quality.grokModelTitle")||"Model"}),d.jsxs("div",{className:"option-row",children:[d.jsxs("button",{type:"button",className:`option-btn${x==="nano-banana-2"?" active":""}`,onClick:()=>S("nano-banana-2"),style:{lineHeight:"1.3"},children:[d.jsx("span",{children:"Nano"}),d.jsx("br",{}),d.jsx("span",{children:"Banana 2"})]}),d.jsxs("button",{type:"button",className:`option-btn${x==="nano-banana-pro"?" active":""}`,onClick:()=>S("nano-banana-pro"),style:{lineHeight:"1.3"},children:[d.jsx("span",{children:"Nano"}),d.jsx("br",{}),d.jsx("span",{children:"Banana Pro"})]})]})]}),d.jsxs("div",{className:"option-group",children:[d.jsx("div",{className:"section-title",children:n("size.grokAspectTitle")||"Aspect Ratio"}),[Tr.slice(0,3),Tr.slice(3,6),Tr.slice(6,8),Tr.slice(8)].map((T,X)=>d.jsx("div",{className:"option-row",children:T.map(te=>d.jsx("button",{type:"button",className:`option-btn${ie.ratio===te.value?" active":""}`,onClick:()=>oe(te.value,ie.res),children:te.label},te.value))},X))]}),d.jsxs("div",{className:"option-group",children:[d.jsx("div",{className:"section-title",children:n("size.grokResolutionTitle")||"Resolution"}),d.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"4px"},children:tN.map(T=>d.jsxs("button",{type:"button",className:`option-btn${ie.res===T.value?" active":""}`,onClick:()=>oe(ie.ratio,T.value),style:{padding:"6px 4px"},children:[d.jsx("span",{children:T.label}),d.jsx("br",{}),d.jsx("small",{children:Au[ie.ratio]?.[T.value]?.replace("x","×")||""})]},T.value))})]})]}):d.jsxs(d.Fragment,{children:[d.jsx(Ca,{title:n("quality.title"),items:Ce,value:i,onChange:r}),d.jsx(MT,{})]}),Oe?null:d.jsxs(d.Fragment,{children:[d.jsx(Ca,{title:n("format.title"),items:eN,value:c,onChange:f}),d.jsx(Ca,{title:n("moderation.title"),items:we,value:p,onChange:m}),d.jsx("p",{className:"option-help",children:n("moderation.explain")})]}),k&&!Ee&&d.jsx("div",{className:"option-group multimode-toggle",children:d.jsxs("button",{type:"button",className:`multimode-toggle__button${y?" active":""}`,"aria-pressed":y,title:n("multimode.tooltip"),onClick:()=>g(!y),children:[d.jsx("span",{children:n("multimode.label")}),d.jsx("span",{children:n("multimode.shortHint")})]})}),Ee?null:d.jsx(RT,{}),d.jsx(LT,{})]})]})}const nN=D.lazy(()=>wa(()=>import("./PromptLibraryPanel-B9kndPw1.js"),[]).then(n=>({default:n.PromptLibraryPanel}))),lN=D.lazy(()=>wa(()=>import("./PromptBuilderPanel-B95ZufnR.js"),[]).then(n=>({default:n.PromptBuilderPanel})));function iN(){const n=E(_=>_.rightPanelOpen),o=E(_=>_.toggleRightPanel),i=E(_=>_.promptLibraryOpen),r=E(_=>_.setPromptLibraryOpen),c=E(_=>_.promptBuilderOpen),f=E(_=>_.togglePromptBuilder),p=E(_=>_.workspaceProfile),{t:m}=ge(),[y,g]=D.useState(typeof window<"u"?window.matchMedia("(max-width: 800px)").matches:!1);D.useEffect(()=>{if(typeof window>"u")return;const _=window.matchMedia("(max-width: 800px)"),M=()=>g(_.matches);return _.addEventListener("change",M),()=>_.removeEventListener("change",M)},[]);const x=$x(p)&&!y,S=y?n:!0,b=c&&x?"builder":i?"library":"settings",N=_=>{_==="builder"?(c||f(),i&&r(!1)):_==="library"?(c&&f(),i||r(!0)):(c&&f(),i&&r(!1))};return d.jsxs(d.Fragment,{children:[y&&n?d.jsx("div",{className:"right-panel-backdrop",role:"button","aria-label":m("panel.closeSettings"),onClick:o}):null,d.jsxs("aside",{className:`right-panel${n?"":" collapsed"}${y&&S?" drawer-open":""}`,"aria-label":m("panel.detailSettings"),children:[!y&&d.jsx("button",{type:"button",className:"right-panel-toggle","aria-expanded":n,"aria-controls":"right-panel-body",onClick:o,title:m(n?"panel.toggleHide":"panel.toggleShow"),children:n?">":"<"}),d.jsxs("div",{id:"right-panel-body",className:"right-panel-body",hidden:!n,children:[d.jsxs("div",{className:"right-panel-tabs",role:"tablist","aria-label":m("panel.detailSettings"),children:[x?d.jsx("button",{type:"button",role:"tab","aria-selected":b==="builder",className:`right-panel-tabs__button${b==="builder"?" active":""}`,onClick:()=>N("builder"),children:m("promptBuilder.title")}):null,d.jsx("button",{type:"button",role:"tab","aria-selected":b==="settings",className:`right-panel-tabs__button${b==="settings"?" active":""}`,onClick:()=>N("settings"),children:m("panel.detailSettings")}),d.jsx("button",{type:"button",role:"tab","aria-selected":b==="library",className:`right-panel-tabs__button right-panel-tabs__button--full${b==="library"?" active":""}`,onClick:()=>N("library"),children:m("promptLibrary.title")})]}),b==="builder"&&x?d.jsx(D.Suspense,{fallback:d.jsx("div",{className:"prompt-library-panel__loading",children:m("common.loading")}),children:d.jsx(lN,{variant:"sidebar"})}):b==="library"?d.jsx(D.Suspense,{fallback:d.jsx("div",{className:"prompt-library-panel__loading",children:m("common.loading")}),children:d.jsx(nN,{variant:"embedded"})}):d.jsx(sy,{})]})]})]})}function oN(n){const o=n.currentTarget;if(o.scrollWidth<=o.clientWidth||!(Math.abs(n.deltaY)>Math.abs(n.deltaX)))return;const r=o.scrollLeft<=0,c=o.scrollLeft+o.clientWidth>=o.scrollWidth-1,f=n.deltaY<0,p=n.deltaY>0;f&&r||p&&c||(n.preventDefault(),o.scrollLeft+=n.deltaY)}function rN({id:n}){return d.jsx("div",{className:"history-thumb history-thumb--skeleton","aria-label":"Generating..."},n)}function sN({id:n,count:o}){const i=Math.min(o,4);return d.jsx("div",{className:"history-thumb history-thumb--collection-skeleton","aria-label":`Generating ${o} images...`,children:Array.from({length:i},(r,c)=>d.jsx("div",{className:"collection-mini collection-mini--skeleton"},c))},`coll-${n}`)}function cN({sequenceId:n,images:o}){const i=E(p=>p.showHistorySequence),c=E(p=>p.multimodePreviewFlightId)===`history:${n}`,f=o.slice(0,4);return d.jsx("button",{type:"button",className:`history-thumb history-thumb--collection${c?" active":""}`,onClick:()=>i(n),"aria-label":`${o.length} image collection`,children:f.map((p,m)=>!p.thumb&&(ln(p.url)||ln(p.image))?d.jsx("video",{className:"collection-mini",src:p.url||p.image,muted:!0,playsInline:!0,preload:"metadata"},m):d.jsx("img",{className:"collection-mini",src:p.thumb||p.url||p.image,alt:"",loading:"lazy",decoding:"async"},m))})}function uN(){const n=E(_=>_.history),o=E(_=>_.currentImage),i=E(_=>_.historyStripLayout),r=E(_=>_.selectHistory),c=E(_=>_.openGallery),f=E(_=>_.inFlight),p=E(_=>_.multimodeSequences),m=D.useRef({}),{t:y}=ge(),g=o?yt(o):null,x=D.useMemo(()=>Mr(n.filter(Oi)),[n]),S=D.useMemo(()=>{const _=[];for(const M of f){const I=p[M.id];if(M.kind==="multimode"&&I){_.push({type:"collection-skeleton",id:M.id,count:I.requested});for(let G=0;G<I.requested;G++)I.images[G]||_.push({type:"skeleton",id:`${M.id}_${G}`,count:1})}else _.push({type:"skeleton",id:M.id,count:1})}return _},[f,p]),{completedSequences:b,sequenceFirstKeys:N}=D.useMemo(()=>{const _=new Map,M=new Set;for(const I of x)if(I.sequenceId&&(I.sequenceTotalRequested??0)>1){_.has(I.sequenceId)||M.add(yt(I));const G=_.get(I.sequenceId)||[];G.push(I),_.set(I.sequenceId,G)}return{completedSequences:_,sequenceFirstKeys:M}},[x]);return D.useEffect(()=>{g&&m.current[g]?.scrollIntoView({block:"nearest",inline:"nearest"})},[g,x]),d.jsxs("div",{className:`history-strip${i==="horizontal"?" history-strip--horizontal":""}${i==="sidebar"?" history-strip--sidebar":""}`,onWheel:oN,"data-layout":i,children:[d.jsx("button",{type:"button",className:"history-thumb history-thumb--add",onClick:c,"aria-label":y("history.openGalleryAria"),title:y("history.openGalleryTitle"),children:d.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[d.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),d.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),d.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),d.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1"})]})}),S.map(_=>_.type==="collection-skeleton"?d.jsx(sN,{id:_.id,count:_.count},`coll-${_.id}`):d.jsx(rN,{id:_.id},_.id)),x.map(_=>{const M=yt(_),I=g===M;if(_.sequenceId&&b.has(_.sequenceId)&&N.has(M)){const G=b.get(_.sequenceId);return[d.jsx(cN,{sequenceId:_.sequenceId,images:G},`coll-${_.sequenceId}`),...G.map(L=>{const O=yt(L),k=g===O;return Wt(L)?d.jsxs("div",{ref:$=>{m.current[O]=$},className:`history-thumb history-thumb--video history-thumb--fade-in${k?" active":""}`,onClick:()=>r(L),draggable:!0,onDragStart:$=>{$.dataTransfer.setData("application/ima2-ref",JSON.stringify(Li(L))),$.dataTransfer.effectAllowed="copy"},children:[L.thumb?d.jsx("img",{src:L.thumb,alt:"",loading:"lazy",decoding:"async"}):d.jsx("video",{src:L.url||L.image,muted:!0,playsInline:!0,preload:"metadata"}),d.jsx("span",{className:"history-thumb__play-badge","aria-hidden":"true",children:"▶"})]},O):d.jsx("img",{ref:$=>{m.current[O]=$},src:L.thumb||L.url||L.image,alt:"",className:`history-thumb history-thumb--fade-in${k?" active":""}`,loading:"lazy",decoding:"async",onClick:()=>r(L),draggable:!0,onDragStart:$=>{$.dataTransfer.setData("application/ima2-ref",JSON.stringify({image:L.url||L.image,filename:L.filename})),$.dataTransfer.effectAllowed="copy"}},O)})]}return _.sequenceId&&b.has(_.sequenceId)&&!N.has(M)?null:Wt(_)?d.jsxs("div",{ref:G=>{m.current[M]=G},className:`history-thumb history-thumb--video${I?" active":""}`,onClick:()=>r(_),draggable:!0,onDragStart:G=>{G.dataTransfer.setData("application/ima2-ref",JSON.stringify(Li(_))),G.dataTransfer.effectAllowed="copy"},children:[_.thumb?d.jsx("img",{src:_.thumb,alt:"",loading:"lazy",decoding:"async"}):d.jsx("video",{src:_.url||_.image,muted:!0,playsInline:!0,preload:"metadata"}),d.jsx("span",{className:"history-thumb__play-badge","aria-hidden":"true",children:"▶"})]},M):d.jsx("img",{ref:G=>{m.current[M]=G},src:_.thumb||_.url||_.image,alt:"",className:`history-thumb${I?" active":""}`,loading:"lazy",decoding:"async",onClick:()=>r(_),draggable:!0,onDragStart:G=>{G.dataTransfer.setData("application/ima2-ref",JSON.stringify({image:_.url||_.image,filename:_.filename})),G.dataTransfer.effectAllowed="copy"}},M)})]})}const Ph=3e3;function dN(){const{t:n}=ge(),o=E(g=>g.toastLog),i=E(g=>g.errorCardLog),r=E(g=>g.dismissToast),c=E(g=>g.dismissErrorCard),[f,p]=D.useState(()=>typeof document>"u"?!0:document.visibilityState==="visible"),m=D.useRef(new Map);D.useEffect(()=>{const g=()=>p(document.visibilityState==="visible");return document.addEventListener("visibilitychange",g),window.addEventListener("focus",g),window.addEventListener("blur",g),()=>{document.removeEventListener("visibilitychange",g),window.removeEventListener("focus",g),window.removeEventListener("blur",g)}},[]),D.useEffect(()=>{const g=m.current,x=new Set([...o.map(S=>`toast-${S.id}`),...i.map(S=>`error-card-${S.id}`)]);for(const[S,b]of g)(!x.has(S)||!f)&&(clearTimeout(b),g.delete(S));if(f){for(const S of o){const b=`toast-${S.id}`;if(g.has(b))continue;const N=setTimeout(()=>{g.delete(b),r(S.id)},Ph);g.set(b,N)}for(const S of i){const b=`error-card-${S.id}`;if(g.has(b))continue;const N=setTimeout(()=>{g.delete(b),c(S.id)},Ph);g.set(b,N)}}},[c,r,i,f,o]),D.useEffect(()=>()=>{for(const g of m.current.values())clearTimeout(g);m.current.clear()},[]);const y=[...o.map(g=>({kind:"toast",id:g.id,key:`toast-${g.id}`,message:g.message,error:g.error,createdAt:g.createdAt})),...i.map(g=>{const x=Ii[g.code]??Ii.UNKNOWN,S=n(`${x.cardKey??"errorCard.unknown"}.title`),b=n(`${x.cardKey??"errorCard.unknown"}.body`);return{kind:"error-card",id:g.id,key:`error-card-${g.id}`,message:g.fallbackMessage?`${S}: ${b} ${g.fallbackMessage}`:`${S}: ${b}`,error:!0,createdAt:g.createdAt}})].sort((g,x)=>g.createdAt-x.createdAt).slice(-5);return y.length===0?null:d.jsx("div",{className:"toast-stack","aria-live":"polite","aria-relevant":"additions removals",children:y.map(g=>{const x=["toast","visible",g.error?"error":"",g.kind==="error-card"?"toast--card":""].filter(Boolean).join(" ");return d.jsxs("div",{className:x,role:g.error?"alert":"status",children:[d.jsx("span",{className:"toast__message",children:g.message}),d.jsx("button",{type:"button",className:"toast__dismiss","aria-label":"Dismiss notification",onClick:()=>g.kind==="error-card"?c(g.id):r(g.id),children:"x"})]},g.key)})})}function fN(){return null}function mN(n){if(!n)return"earlier";const o=new Date(n);if(Number.isNaN(o.getTime()))return"earlier";const r=Math.floor((new Date().getTime()-o.getTime())/864e5);return r===0?"today":r===1?"yesterday":r<7?"thisWeek":o.toLocaleDateString("ko-KR",{year:"numeric",month:"short",day:"numeric"})}function pN({item:n,onOpen:o,onCopyPath:i,onDownloadManifest:r}){const{t:c}=ge(),p=n.cards?.find(m=>m.headline)?.headline||n.headline||c("gallery.cardNewsSet");return d.jsxs(d.Fragment,{children:[d.jsxs("button",{type:"button",className:"gallery__tile",onClick:()=>o(n),title:p,children:[n.image?d.jsx("img",{src:n.image,alt:p,loading:"lazy"}):null,d.jsxs("div",{className:"gallery__caption",children:[d.jsx("small",{children:c("gallery.cardNewsSet")}),d.jsx("span",{className:"gallery__caption-text",children:p})]}),d.jsx("div",{className:"gallery-card-news-strip",children:(n.cards||[]).slice(0,5).map((m,y)=>d.jsxs("span",{children:[m.url?d.jsx("img",{src:m.url,alt:m.headline??"",loading:"lazy"}):null,d.jsx("em",{children:m.cardOrder??y+1})]},`${m.url}-${y}`))})]}),d.jsxs("div",{className:"gallery-card-news-actions",children:[d.jsx("span",{children:c("gallery.cardNewsCount",{n:n.cards?.length??0})}),d.jsx("button",{type:"button",onClick:()=>o(n),children:c("gallery.openCardNewsSet")}),d.jsx("button",{type:"button",onClick:m=>i(n,m),children:c("gallery.copyCardNewsSetPath")}),d.jsx("button",{type:"button",onClick:m=>r(n,m),children:c("gallery.downloadCardNewsManifest")})]})]})}function hN({item:n,active:o,itemRef:i,onSelect:r,onDelete:c,onToggleFavorite:f,t:p}){const m=y=>{y.dataTransfer.setData("application/ima2-ref",JSON.stringify(Wt(n)?Li(n):{image:n.url||n.image,filename:n.filename})),y.dataTransfer.effectAllowed="copy"};return d.jsxs("div",{ref:i,className:`gallery__tile-wrap${o?" gallery__tile-wrap--active":""}${n.isFavorite?" gallery__tile-wrap--favorite":""}`,children:[d.jsxs("button",{type:"button",className:`gallery__tile${o?" gallery__tile--active":""}`,onClick:()=>r(n),title:n.prompt??"",draggable:!0,onDragStart:m,children:[Wt(n)?d.jsxs("div",{className:"gallery__tile-video-wrap",children:[n.thumb?d.jsx("img",{src:n.thumb,alt:n.prompt??p("gallery.imageAltFallback"),loading:"lazy",decoding:"async",className:"gallery__tile-video"}):d.jsx("video",{src:n.url||n.image,muted:!0,playsInline:!0,preload:"metadata",className:"gallery__tile-video"}),d.jsx("span",{className:"gallery__play-badge","aria-hidden":"true",children:"▶"})]}):d.jsx("img",{src:n.thumb||n.image,alt:n.prompt??p("gallery.imageAltFallback"),loading:"lazy",decoding:"async"}),n.prompt&&d.jsx("div",{className:"gallery__caption",children:d.jsx("span",{className:"gallery__caption-text",children:n.prompt})})]}),n.filename&&f&&d.jsx("button",{type:"button",className:`gallery__favorite${n.isFavorite?" gallery__favorite--on":""}`,onClick:y=>{y.stopPropagation(),f(n)},title:n.isFavorite?p("gallery.unfavoriteTitle"):p("gallery.favoriteTitle"),"aria-label":n.isFavorite?p("gallery.unfavoriteAria"):p("gallery.favoriteAria"),children:n.isFavorite?"★":"☆"}),n.filename&&d.jsx("button",{type:"button",className:"gallery__delete",onClick:y=>c(n,y),title:p("gallery.deleteTitle"),"aria-label":p("gallery.deleteAria"),children:"×"})]})}function Tl(n,o,i){let r=i.initialDeps??[],c,f=!0;function p(){var m,y,g;let x;i.key&&((m=i.debug)!=null&&m.call(i))&&(x=Date.now());const S=n();if(!(S.length!==r.length||S.some((_,M)=>r[M]!==_)))return c;r=S;let N;if(i.key&&((y=i.debug)!=null&&y.call(i))&&(N=Date.now()),c=o(...S),i.key&&((g=i.debug)!=null&&g.call(i))){const _=Math.round((Date.now()-x)*100)/100,M=Math.round((Date.now()-N)*100)/100,I=M/16,G=(L,O)=>{for(L=String(L);L.length<O;)L=" "+L;return L};console.info(`%c⏱ ${G(M,5)} /${G(_,5)} ms`,`
|
|
37
|
+
font-size: .6rem;
|
|
38
|
+
font-weight: bold;
|
|
39
|
+
color: hsl(${Math.max(0,Math.min(120-120*I,120))}deg 100% 31%);`,i?.key)}return i?.onChange&&!(f&&i.skipInitialOnChange)&&i.onChange(c),f=!1,c}return p.updateDeps=m=>{r=m},p}function Uh(n,o){if(n===void 0)throw new Error("Unexpected undefined");return n}const gN=(n,o)=>Math.abs(n-o)<1.01,yN=(n,o,i)=>{let r;return function(...c){n.clearTimeout(r),r=n.setTimeout(()=>o.apply(this,c),i)}},Bh=n=>{const{offsetWidth:o,offsetHeight:i}=n;return{width:o,height:i}},vN=n=>n,bN=n=>{const o=Math.max(n.startIndex-n.overscan,0),i=Math.min(n.endIndex+n.overscan,n.count-1),r=[];for(let c=o;c<=i;c++)r.push(c);return r},SN=(n,o)=>{const i=n.scrollElement;if(!i)return;const r=n.targetWindow;if(!r)return;const c=p=>{const{width:m,height:y}=p;o({width:Math.round(m),height:Math.round(y)})};if(c(Bh(i)),!r.ResizeObserver)return()=>{};const f=new r.ResizeObserver(p=>{const m=()=>{const y=p[0];if(y?.borderBoxSize){const g=y.borderBoxSize[0];if(g){c({width:g.inlineSize,height:g.blockSize});return}}c(Bh(i))};n.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(m):m()});return f.observe(i,{box:"border-box"}),()=>{f.unobserve(i)}},Fh={passive:!0},Kh=typeof window>"u"?!0:"onscrollend"in window,xN=(n,o)=>{const i=n.scrollElement;if(!i)return;const r=n.targetWindow;if(!r)return;let c=0;const f=n.options.useScrollendEvent&&Kh?()=>{}:yN(r,()=>{o(c,!1)},n.options.isScrollingResetDelay),p=x=>()=>{const{horizontal:S,isRtl:b}=n.options;c=S?i.scrollLeft*(b&&-1||1):i.scrollTop,f(),o(c,x)},m=p(!0),y=p(!1);i.addEventListener("scroll",m,Fh);const g=n.options.useScrollendEvent&&Kh;return g&&i.addEventListener("scrollend",y,Fh),()=>{i.removeEventListener("scroll",m),g&&i.removeEventListener("scrollend",y)}},TN=(n,o,i)=>{if(o?.borderBoxSize){const r=o.borderBoxSize[0];if(r)return Math.round(r[i.options.horizontal?"inlineSize":"blockSize"])}return n[i.options.horizontal?"offsetWidth":"offsetHeight"]},NN=(n,{adjustments:o=0,behavior:i},r)=>{var c,f;const p=n+o;(f=(c=r.scrollElement)==null?void 0:c.scrollTo)==null||f.call(c,{[r.options.horizontal?"left":"top"]:p,behavior:i})};class _N{constructor(o){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var i,r,c;return((c=(r=(i=this.targetWindow)==null?void 0:i.performance)==null?void 0:r.now)==null?void 0:c.call(r))??Date.now()},this.observer=(()=>{let i=null;const r=()=>i||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:i=new this.targetWindow.ResizeObserver(c=>{c.forEach(f=>{const p=()=>{const m=f.target,y=this.indexFromElement(m);if(!m.isConnected){this.observer.unobserve(m);return}this.shouldMeasureDuringScroll(y)&&this.resizeItem(y,this.options.measureElement(m,f,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(p):p()})}));return{disconnect:()=>{var c;(c=r())==null||c.disconnect(),i=null},observe:c=>{var f;return(f=r())==null?void 0:f.observe(c,{box:"border-box"})},unobserve:c=>{var f;return(f=r())==null?void 0:f.unobserve(c)}}})(),this.range=null,this.setOptions=i=>{Object.entries(i).forEach(([r,c])=>{typeof c>"u"&&delete i[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:vN,rangeExtractor:bN,onChange:()=>{},measureElement:TN,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",...i}},this.notify=i=>{var r,c;(c=(r=this.options).onChange)==null||c.call(r,this,i)},this.maybeNotify=Tl(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),i=>{this.notify(i)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(i=>i()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var i;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((i=this.scrollElement)==null?void 0:i.window)??null,this.elementsCache.forEach(c=>{this.observer.observe(c)}),this.unsubs.push(this.options.observeElementRect(this,c=>{this.scrollRect=c,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(c,f)=>{this.scrollAdjustments=0,this.scrollDirection=f?this.getScrollOffset()<c?"forward":"backward":null,this.scrollOffset=c,this.isScrolling=f,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(i,r)=>{const c=new Map,f=new Map;for(let p=r-1;p>=0;p--){const m=i[p];if(c.has(m.lane))continue;const y=f.get(m.lane);if(y==null||m.end>y.end?f.set(m.lane,m):m.end<y.end&&c.set(m.lane,!0),c.size===this.options.lanes)break}return f.size===this.options.lanes?Array.from(f.values()).sort((p,m)=>p.end===m.end?p.index-m.index:p.end-m.end)[0]:void 0},this.getMeasurementOptions=Tl(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(i,r,c,f,p,m,y)=>(this.prevLanes!==void 0&&this.prevLanes!==m&&(this.lanesChangedFlag=!0),this.prevLanes=m,this.pendingMeasuredCacheIndexes=[],{count:i,paddingStart:r,scrollMargin:c,getItemKey:f,enabled:p,lanes:m,laneAssignmentMode:y}),{key:!1}),this.getMeasurements=Tl(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:i,paddingStart:r,scrollMargin:c,getItemKey:f,enabled:p,lanes:m,laneAssignmentMode:y},g)=>{if(!p)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>i)for(const N of this.laneAssignments.keys())N>=i&&this.laneAssignments.delete(N);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(N=>{this.itemSizeCache.set(N.key,N.size)}));const x=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===i&&(this.lanesSettling=!1);const S=this.measurementsCache.slice(0,x),b=new Array(m).fill(void 0);for(let N=0;N<x;N++){const _=S[N];_&&(b[_.lane]=N)}for(let N=x;N<i;N++){const _=f(N),M=this.laneAssignments.get(N);let I,G;const L=y==="estimate"||g.has(_);if(M!==void 0&&this.options.lanes>1){I=M;const K=b[I],W=K!==void 0?S[K]:void 0;G=W?W.end+this.options.gap:r+c}else{const K=this.options.lanes===1?S[N-1]:this.getFurthestMeasurement(S,N);G=K?K.end+this.options.gap:r+c,I=K?K.lane:N%this.options.lanes,this.options.lanes>1&&L&&this.laneAssignments.set(N,I)}const O=g.get(_),k=typeof O=="number"?O:this.options.estimateSize(N),$=G+k;S[N]={index:N,start:G,size:k,end:$,key:_,lane:I},b[I]=N}return this.measurementsCache=S,S},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Tl(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(i,r,c,f)=>this.range=i.length>0&&r>0?EN({measurements:i,outerSize:r,scrollOffset:c,lanes:f}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Tl(()=>{let i=null,r=null;const c=this.calculateRange();return c&&(i=c.startIndex,r=c.endIndex),this.maybeNotify.updateDeps([this.isScrolling,i,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,i,r]},(i,r,c,f,p)=>f===null||p===null?[]:i({startIndex:f,endIndex:p,overscan:r,count:c}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=i=>{const r=this.options.indexAttribute,c=i.getAttribute(r);return c?parseInt(c,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=i=>{var r;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const c=this.scrollState.index??((r=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:r.index);if(c!==void 0&&this.range){const f=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),p=Math.max(0,c-f),m=Math.min(this.options.count-1,c+f);return i>=p&&i<=m}return!0},this.measureElement=i=>{if(!i){this.elementsCache.forEach((p,m)=>{p.isConnected||(this.observer.unobserve(p),this.elementsCache.delete(m))});return}const r=this.indexFromElement(i),c=this.options.getItemKey(r),f=this.elementsCache.get(c);f!==i&&(f&&this.observer.unobserve(f),this.observer.observe(i),this.elementsCache.set(c,i)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(r)&&this.resizeItem(r,this.options.measureElement(i,void 0,this))},this.resizeItem=(i,r)=>{var c;const f=this.measurementsCache[i];if(!f)return;const p=this.itemSizeCache.get(f.key)??f.size,m=r-p;m!==0&&(((c=this.scrollState)==null?void 0:c.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(f,m,this):f.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=m,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(f.index),this.itemSizeCache=new Map(this.itemSizeCache.set(f.key,r)),this.notify(!1))},this.getVirtualItems=Tl(()=>[this.getVirtualIndexes(),this.getMeasurements()],(i,r)=>{const c=[];for(let f=0,p=i.length;f<p;f++){const m=i[f],y=r[m];c.push(y)}return c},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=i=>{const r=this.getMeasurements();if(r.length!==0)return Uh(r[cy(0,r.length-1,c=>Uh(r[c]).start,i)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const i=this.scrollElement.document.documentElement;return this.options.horizontal?i.scrollWidth-this.scrollElement.innerWidth:i.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(i,r,c=0)=>{if(!this.scrollElement)return 0;const f=this.getSize(),p=this.getScrollOffset();r==="auto"&&(r=i>=p+f?"end":"start"),r==="center"?i+=(c-f)/2:r==="end"&&(i-=f);const m=this.getMaxScrollOffset();return Math.max(Math.min(m,i),0)},this.getOffsetForIndex=(i,r="auto")=>{i=Math.max(0,Math.min(i,this.options.count-1));const c=this.getSize(),f=this.getScrollOffset(),p=this.measurementsCache[i];if(!p)return;if(r==="auto")if(p.end>=f+c-this.options.scrollPaddingEnd)r="end";else if(p.start<=f+this.options.scrollPaddingStart)r="start";else return[f,r];if(r==="end"&&i===this.options.count-1)return[this.getMaxScrollOffset(),r];const m=r==="end"?p.end+this.options.scrollPaddingEnd:p.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(m,r,p.size),r]},this.scrollToOffset=(i,{align:r="start",behavior:c="auto"}={})=>{const f=this.getOffsetForAlignment(i,r),p=this.now();this.scrollState={index:null,align:r,behavior:c,startedAt:p,lastTargetOffset:f,stableFrames:0},this._scrollToOffset(f,{adjustments:void 0,behavior:c}),this.scheduleScrollReconcile()},this.scrollToIndex=(i,{align:r="auto",behavior:c="auto"}={})=>{i=Math.max(0,Math.min(i,this.options.count-1));const f=this.getOffsetForIndex(i,r);if(!f)return;const[p,m]=f,y=this.now();this.scrollState={index:i,align:m,behavior:c,startedAt:y,lastTargetOffset:p,stableFrames:0},this._scrollToOffset(p,{adjustments:void 0,behavior:c}),this.scheduleScrollReconcile()},this.scrollBy=(i,{behavior:r="auto"}={})=>{const c=this.getScrollOffset()+i,f=this.now();this.scrollState={index:null,align:"start",behavior:r,startedAt:f,lastTargetOffset:c,stableFrames:0},this._scrollToOffset(c,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var i;const r=this.getMeasurements();let c;if(r.length===0)c=this.options.paddingStart;else if(this.options.lanes===1)c=((i=r[r.length-1])==null?void 0:i.end)??0;else{const f=Array(this.options.lanes).fill(null);let p=r.length-1;for(;p>=0&&f.some(m=>m===null);){const m=r[p];f[m.lane]===null&&(f[m.lane]=m.end),p--}c=Math.max(...f.filter(m=>m!==null))}return Math.max(c-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(i,{adjustments:r,behavior:c})=>{this.options.scrollToFn(i,{behavior:c,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(o)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const r=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,c=r?r[0]:this.scrollState.lastTargetOffset,f=1,p=c!==this.scrollState.lastTargetOffset;if(!p&&gN(c,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=f){this.scrollState=null;return}}else this.scrollState.stableFrames=0,p&&(this.scrollState.lastTargetOffset=c,this.scrollState.behavior="auto",this._scrollToOffset(c,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const cy=(n,o,i,r)=>{for(;n<=o;){const c=(n+o)/2|0,f=i(c);if(f<r)n=c+1;else if(f>r)o=c-1;else return c}return n>0?n-1:0};function EN({measurements:n,outerSize:o,scrollOffset:i,lanes:r}){const c=n.length-1,f=y=>n[y].start;if(n.length<=r)return{startIndex:0,endIndex:c};let p=cy(0,c,f,i),m=p;if(r===1)for(;m<c&&n[m].end<i+o;)m++;else if(r>1){const y=Array(r).fill(0);for(;m<c&&y.some(x=>x<i+o);){const x=n[m];y[x.lane]=x.end,m++}const g=Array(r).fill(i+o);for(;p>=0&&g.some(x=>x>=i);){const x=n[p];g[x.lane]=x.start,p--}p=Math.max(0,p-p%r),m=Math.min(c,m+(r-1-m%r))}return{startIndex:p,endIndex:m}}const Vh=typeof document<"u"?D.useLayoutEffect:D.useEffect;function AN({useFlushSync:n=!0,...o}){const i=D.useReducer(()=>({}),{})[1],r={...o,onChange:(f,p)=>{var m;n&&p?ty.flushSync(i):i(),(m=o.onChange)==null||m.call(o,f,p)}},[c]=D.useState(()=>new _N(r));return c.setOptions(r),Vh(()=>c._didMount(),[]),Vh(()=>c._willUpdate()),c}function CN(n){return AN({observeElementRect:SN,observeElementOffset:xN,scrollToFn:NN,...n})}const Gr=170,qr=10,uy=36,wN=44;function MN(n){const o=Math.max(Gr,n-uy);return Math.max(1,Math.floor((o+qr)/(Gr+qr)))}function RN(n,o){const i=Math.max(Gr,n-uy);return Math.max(Gr,Math.floor((i-qr*Math.max(0,o-1))/o))+qr}function IN(n,o){const i=[];for(const[r,c]of n){i.push({type:"header",id:`h-${r}`,label:r,count:c.length});for(let f=0;f<c.length;f+=o)i.push({type:"items",id:`r-${r}-${f}`,items:c.slice(f,f+o)})}return i}function ON({dateGroups:n,selectedKey:o,scrollElement:i,localizeBucket:r,renderTile:c}){const f=D.useRef(null),[p,m]=D.useState(0),y=D.useMemo(()=>MN(p||960),[p]),g=D.useMemo(()=>RN(p||960,y),[p,y]),x=D.useMemo(()=>IN(n,y),[n,y]);D.useEffect(()=>{const b=f.current;if(!b)return;const N=()=>m(b.clientWidth);N();const _=new ResizeObserver(N);return _.observe(b),()=>_.disconnect()},[]);const S=CN({count:x.length,getScrollElement:()=>i,estimateSize:b=>x[b]?.type==="header"?wN:g,overscan:6});return D.useEffect(()=>{if(!o)return;const b=x.findIndex(N=>N.type==="items"&&N.items.some(_=>yt(_)===o));b>=0&&S.scrollToIndex(b,{align:"center"})},[x,o,S]),d.jsx("div",{ref:f,className:"gallery__virtual",style:{height:S.getTotalSize()},children:S.getVirtualItems().map(b=>{const N=x[b.index];return N?d.jsx("div",{className:"gallery__virtual-row",style:{transform:`translateY(${b.start}px)`},children:N.type==="header"?d.jsxs("header",{className:"gallery__group-header gallery__group-header--virtual",children:[d.jsx("span",{className:"gallery__group-label",children:r(N.label)}),d.jsx("span",{className:"gallery__group-count",children:N.count})]}):d.jsx("div",{className:"gallery__grid gallery__grid--virtual",children:N.items.map((_,M)=>c(_,N.id,M))})},N.id):null})})}function Yh({showSessions:n,favoritesOnly:o,query:i,historyNextCursor:r,favoriteHistoryNextCursor:c,historyLoadingOlder:f,favoriteHistoryLoadingOlder:p,onLoadOlder:m,onLoadOlderFavorites:y,t:g}){return n?d.jsx("div",{className:"gallery__load-more gallery__load-more--hint",children:g("gallery.sessionPaginationHint")}):i.trim()?null:o?c?d.jsx("div",{className:"gallery__load-more",children:d.jsx("button",{type:"button",onClick:y,disabled:p,children:g(p?"gallery.loadingOlderFavorites":"gallery.loadOlderFavorites")})}):null:r?d.jsx("div",{className:"gallery__load-more",children:d.jsx("button",{type:"button",onClick:m,disabled:f,children:g(f?"gallery.loadingOlder":"gallery.loadOlder")})}):null}function jN({groups:n,loose:o,favoritesOnly:i,galleryScope:r,setGalleryScope:c,renderTile:f,t:p}){return n.length===0&&o.length===0?d.jsx("div",{className:"gallery__empty",children:i?p("gallery.emptyFavorites"):r==="current-session"?d.jsxs(d.Fragment,{children:[d.jsx("p",{children:p("gallery.empty.currentSession")}),d.jsx("button",{type:"button",onClick:()=>c("all"),children:p("gallery.scope.all")})]}):p("gallery.emptySessions")}):d.jsxs(d.Fragment,{children:[n.map(m=>d.jsxs("section",{className:"gallery__group",children:[d.jsxs("header",{className:"gallery__group-header",children:[d.jsx("span",{className:"gallery__group-label",title:m.sessionId,children:m.title?m.displayLabel:p("gallery.sessionLabel",{name:m.displayLabel})}),d.jsx("span",{className:"gallery__group-count",children:m.items.length})]}),d.jsx("div",{className:"gallery__grid",children:m.items.map((y,g)=>f(y,m.sessionId,g))})]},m.sessionId)),o.length>0&&d.jsxs("section",{className:"gallery__group",children:[d.jsxs("header",{className:"gallery__group-header",children:[d.jsx("span",{className:"gallery__group-label",children:p("gallery.standalone")}),d.jsx("span",{className:"gallery__group-count",children:o.length})]}),d.jsx("div",{className:"gallery__grid",children:o.map((m,y)=>f(m,"loose",y))})]})]})}function kN({status:n,dismissed:o,onOpenFolder:i,onDismiss:r,t:c}){const f=n!=null&&n.state!=="ok"&&!o,p=n?.state==="recoverable"?"gallery.storageNoticeRecoverable":n?.state==="not_found"?"gallery.storageNoticeNotFound":"gallery.storageNoticeUnknown";return d.jsxs("div",{className:`gallery__storage-bar${f?" gallery__storage-bar--notice":""}`,children:[f?d.jsxs("div",{className:"gallery__storage-copy",children:[d.jsx("div",{className:"gallery__storage-title",children:c("gallery.storageNoticeTitle")}),d.jsx("div",{className:"gallery__storage-text",children:c(p)})]}):d.jsx("div",{className:"gallery__storage-copy gallery__storage-copy--quiet",children:n?.generatedDirLabel??"~/.ima2/generated"}),d.jsxs("div",{className:"gallery__storage-actions",children:[d.jsx("button",{type:"button",className:"gallery__storage-button",onClick:i,title:c("gallery.openGeneratedDirTitle"),children:c("gallery.openGeneratedDir")}),f&&d.jsx("button",{type:"button",className:"gallery__storage-button gallery__storage-button--ghost",onClick:r,children:c("common.close")})]})]})}const Xh="ima2.storageNoticeDismissed.0.09.23";function zN(){const{t:n}=ge(),o=E(Q=>Q.galleryOpen),i=E(Q=>Q.closeGallery),r=E(Q=>Q.history),c=E(Q=>Q.selectHistory),f=E(Q=>Q.currentImage),p=E(Q=>Q.trashHistoryItem),m=E(Q=>Q.showToast),y=E(Q=>Q.toggleGalleryFavorite),g=E(Q=>Q.galleryScope),x=E(Q=>Q.setGalleryScope),S=E(Q=>Q.historyNextCursor),b=E(Q=>Q.historyLoadingOlder),N=E(Q=>Q.favoriteHistoryNextCursor),_=E(Q=>Q.favoriteHistoryLoadingOlder),M=E(Q=>Q.loadOlderHistory),I=E(Q=>Q.loadFavoriteHistory),G=E(Q=>Q.loadOlderFavoriteHistory),L=E(I1),[O,k]=D.useState(""),[$,K]=D.useState("date"),[W,Ee]=D.useState(!1),[Oe,V]=D.useState([]),[ie,oe]=D.useState([]),[Ce,we]=D.useState(null),[Z,T]=D.useState(()=>{try{return localStorage.getItem(Xh)==="1"}catch{return!1}}),X=D.useRef(null),te=D.useRef({}),[ye,me]=D.useState(null),C=D.useRef(0),B=D.useRef({open:!1,selectedKey:null}),J=D.useMemo(()=>Mr(r.filter(Oi)),[r]),ae=D.useCallback(Q=>{X.current=Q,me(Q)},[]);D.useEffect(()=>{if(!o)return;const Q=Me=>{Me.key==="Escape"&&i()};return window.addEventListener("keydown",Q),()=>window.removeEventListener("keydown",Q)},[o,i]),D.useEffect(()=>{o||k("")},[o]),D.useEffect(()=>{if(!o)return;let Q=!1;return(async()=>{try{const Me=await nS();Q||we(Me)}catch{Q||we({generatedDirLabel:"~/.ima2/generated",generatedCount:0,legacyCandidatesScanned:0,legacySourcesFound:0,legacyFilesFound:0,state:"unknown",messageKind:"unknown",recoveryDocsPath:"docs/RECOVER_OLD_IMAGES.md",doctorCommand:"ima2 doctor",overrides:{generatedDir:!1,configDir:!1}})}})(),()=>{Q=!0}},[o]),D.useEffect(()=>{if(!o||$!=="session")return;let Q=!1;return(async()=>{try{const Me=await tS({limit:500,sessionId:g==="current-session"?L:void 0});if(Q)return;const ht=ue=>{const Fe=ue.kind,jn=Fe==="classic"||Fe==="edit"||Fe==="generate"||Fe==="card-news-card"||Fe==="card-news-set"?Fe:null,zt=ue.mediaType==="video"||/\.(mp4|webm|mov)$/i.test(ue.filename??"");return{image:ue.url,url:ue.url,filename:ue.filename,thumb:ue.thumb??(zt?void 0:ue.url),mediaType:ue.mediaType,video:ue.video??null,videoSeries:ue.videoSeries??null,videoContinuity:ue.videoContinuity??null,prompt:ue.prompt??void 0,size:ue.size??void 0,quality:ue.quality??void 0,model:ue.model??void 0,provider:ue.provider,createdAt:ue.createdAt,sessionId:ue.sessionId??null,nodeId:ue.nodeId??null,clientNodeId:ue.clientNodeId??null,kind:jn,setId:ue.setId??null,cardId:ue.cardId??null,cardOrder:ue.cardOrder??null,headline:ue.headline??null,body:ue.body??null,cards:ue.cards,isFavorite:ue.isFavorite??!1}};V(Me.sessions.map(ue=>({sessionId:ue.sessionId,title:ue.title??null,label:ue.label??null,displayLabel:ue.title||ue.label||ue.sessionId.slice(0,8),items:Mr(ue.items.filter(Oi).map(ht))})).filter(ue=>ue.items.length>0)),oe(Mr(Me.loose.filter(Oi).map(ht)))}catch{}})(),()=>{Q=!0}},[o,$,g,L]),D.useEffect(()=>{!o||$==="session"||!W||I()},[o,$,W,I]);const se=D.useMemo(()=>{const Q=O.trim().toLowerCase().normalize("NFC");return J.filter(Me=>W&&!Me.isFavorite?!1:Q?(Me.prompt??"").toLowerCase().normalize("NFC").includes(Q)||(Me.filename??"").toLowerCase().normalize("NFC").includes(Q):!0)},[J,O,W]),fe=D.useMemo(()=>W?Oe.map(Q=>({...Q,items:Q.items.filter(Me=>Me.isFavorite)})).filter(Q=>Q.items.length>0):Oe,[Oe,W]),ve=D.useMemo(()=>W?ie.filter(Q=>Q.isFavorite):ie,[ie,W]),Ze=D.useMemo(()=>{const Q=new Map;for(const Me of se){const ht=mN(Me.createdAt);Q.has(ht)||Q.set(ht,[]),Q.get(ht).push(Me)}return Array.from(Q.entries())},[se]),qe=$==="session"?fe.reduce((Q,Me)=>Q+Me.items.length,0)+ve.length:se.length;D.useLayoutEffect(()=>{const Q=f?yt(f):null;if(!o){B.current={open:!1,selectedKey:Q};return}const Me=B.current,ht=!Me.open||Me.selectedKey!==Q;B.current={open:!0,selectedKey:Q};const ue=Q?te.current[Q]:null;if(ht&&ue){ue.scrollIntoView({block:"center"});return}X.current&&(X.current.scrollTop=C.current)},[o,f?.filename,f?.image,$,qe,Ze.length,fe.length,ve.length]);async function ea(Q,Me){Me.stopPropagation();const ht=yt(Q);await p(Q),delete te.current[ht],window.requestAnimationFrame(()=>X.current?.focus())}async function U(){try{await lS(),m(n("toast.openGeneratedDirOpened"))}catch{m(n("toast.openGeneratedDirFailed"),!0)}}async function Se(Q){if(Q.setId)try{await ot.getState().loadSet(Q.setId),E.getState().setUIMode("card-news"),i()}catch{m(n("gallery.openCardNewsSetFailed"),!0)}}async function Pe(Q,Me){if(Me.stopPropagation(),!Q.setId)return;const ht=`generated/cardnews/${Q.setId}`;try{await navigator.clipboard?.writeText(ht),m(n("gallery.cardNewsPathCopied"))}catch{m(n("toast.copyFailed"),!0)}}function Ve(Q,Me){Me.stopPropagation(),Q.setId&&window.open(K1(Q.setId),"_blank","noopener,noreferrer")}function Ma(){T(!0);try{localStorage.setItem(Xh,"1")}catch{}}if(!o)return null;const on=Q=>Q==="earlier"||Q==="today"||Q==="yesterday"||Q==="thisWeek"?n(`gallery.${Q}`):Q,Pi=(Q,Me,ht)=>{const ue=f?.image===Q.image,Fe=yt(Q),jn=zt=>{te.current[Fe]=zt};return Q.kind==="card-news-set"?d.jsx("div",{ref:jn,className:"gallery__tile-wrap gallery-card-news-set",children:d.jsx(pN,{item:Q,onOpen:zt=>{Se(zt)},onCopyPath:Pe,onDownloadManifest:Ve})},`${Me}-${Fe}`):d.jsx(hN,{item:Q,active:ue,itemRef:jn,onSelect:zt=>{c(zt),i()},onDelete:ea,onToggleFavorite:zt=>{y(zt.filename)},t:n},`${Me}-${Fe}`)},Ra=$==="session",Cl=f?yt(f):null;return d.jsx("div",{className:"gallery-backdrop",onClick:i,role:"presentation",children:d.jsxs("div",{className:"gallery",role:"dialog","aria-modal":"true","aria-label":n("gallery.ariaLabel"),onClick:Q=>Q.stopPropagation(),children:[d.jsxs("div",{className:"gallery__header",children:[d.jsxs("div",{className:"gallery__title-row",children:[d.jsx("div",{className:"gallery__title",children:n("gallery.title")}),d.jsxs("div",{className:"gallery__meta",children:[n("gallery.total",{n:qe}),O||W?n("gallery.totalFiltered",{n:J.length}):""]}),d.jsxs("div",{className:"gallery__favorite-filter",role:"tablist","aria-label":n("gallery.favoriteFilterAria"),children:[d.jsx("button",{type:"button",role:"tab","aria-selected":!W,className:W?"":"active",onClick:()=>Ee(!1),children:n("gallery.filterAll")}),d.jsx("button",{type:"button",role:"tab","aria-selected":W,className:W?"active":"",onClick:()=>Ee(!0),children:n("gallery.filterFavorites")})]}),d.jsxs("div",{className:"gallery__group-toggle",role:"tablist","aria-label":n("gallery.sortByAria"),children:[d.jsx("button",{type:"button",role:"tab","aria-selected":$==="date",className:$==="date"?"active":"",onClick:()=>K("date"),children:n("gallery.sortByDate")}),d.jsx("button",{type:"button",role:"tab","aria-selected":$==="session",className:$==="session"?"active":"",onClick:()=>K("session"),children:n("gallery.sortBySession")})]}),d.jsxs("div",{className:"gallery__scope",role:"tablist","aria-label":n("gallery.scopeAria"),children:[d.jsx("button",{type:"button",role:"tab","aria-selected":g==="current-session",className:g==="current-session"?"active":"",onClick:()=>x("current-session"),disabled:!L,children:n("gallery.scope.current")}),d.jsx("button",{type:"button",role:"tab","aria-selected":g==="all",className:g==="all"?"active":"",onClick:()=>x("all"),children:n("gallery.scope.all")})]})]}),d.jsx("input",{type:"text",className:"gallery__search",placeholder:n(Ra?"gallery.searchDisabledPlaceholder":"gallery.searchPlaceholder"),value:O,onChange:Q=>k(Q.target.value),autoFocus:!0,disabled:Ra}),d.jsx("button",{type:"button",className:"gallery__close",onClick:i,"aria-label":n("gallery.closeAria"),title:n("gallery.closeTitle"),children:"×"})]}),d.jsx(kN,{status:Ce,dismissed:Z,onOpenFolder:U,onDismiss:Ma,t:n}),d.jsx("div",{className:"gallery__scroll",ref:ae,tabIndex:-1,onScroll:()=>{C.current=X.current?.scrollTop??0},children:Ra?d.jsxs(d.Fragment,{children:[d.jsx(jN,{groups:fe,loose:ve,favoritesOnly:W,galleryScope:g,setGalleryScope:x,renderTile:Pi,t:n}),d.jsx(Yh,{showSessions:Ra,favoritesOnly:W,query:O,historyNextCursor:S,favoriteHistoryNextCursor:N,historyLoadingOlder:b,favoriteHistoryLoadingOlder:_,onLoadOlder:()=>{M()},onLoadOlderFavorites:()=>{G()},t:n})]}):se.length===0?d.jsx("div",{className:"gallery__empty",children:J.length===0?n("gallery.emptyAll"):n(W?"gallery.emptyFavorites":"gallery.noResults")}):d.jsxs(d.Fragment,{children:[d.jsx(ON,{dateGroups:Ze,selectedKey:Cl,scrollElement:ye,localizeBucket:on,renderTile:Pi}),d.jsx(Yh,{showSessions:Ra,favoritesOnly:W,query:O,historyNextCursor:S,favoriteHistoryNextCursor:N,historyLoadingOlder:b,favoriteHistoryLoadingOlder:_,onLoadOlder:()=>{M()},onLoadOlderFavorites:()=>{G()},t:n})]})})]})})}function DN(n){return n.includes("ratio")?"sizeConfirm.reasonRatio":n.includes("maxPixels")||n.includes("pixels")?"sizeConfirm.reasonPixels":n.includes("minPixels")?"sizeConfirm.reasonMinPixels":n.includes("min")?"sizeConfirm.reasonMin":n.includes("maxEdge")||n.includes("max")?"sizeConfirm.reasonMax":"sizeConfirm.reasonSnap"}function LN(){const n=E(m=>m.customSizeConfirm),o=E(m=>m.confirmCustomSizeAdjustment),i=E(m=>m.cancelCustomSizeAdjustment),r=D.useRef(null),{t:c}=ge();if(D.useEffect(()=>{if(!n)return;r.current?.focus();const m=y=>{y.key==="Escape"&&i()};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[i,n]),!n)return null;const f=`${n.requestedW}x${n.requestedH}`,p=`${n.adjustedW}x${n.adjustedH}`;return d.jsx("div",{className:"modal-backdrop custom-size-confirm-backdrop",role:"presentation",children:d.jsxs("div",{className:"modal custom-size-confirm",role:"dialog","aria-modal":"true","aria-labelledby":"custom-size-confirm-title","aria-describedby":"custom-size-confirm-body",children:[d.jsx("div",{id:"custom-size-confirm-title",className:"modal__title",children:c("sizeConfirm.title")}),d.jsxs("div",{id:"custom-size-confirm-body",className:"modal__body",children:[d.jsx("p",{children:c("sizeConfirm.body")}),d.jsxs("dl",{className:"size-confirm__pairs",children:[d.jsxs("div",{className:"size-confirm__pair",children:[d.jsx("dt",{children:c("sizeConfirm.requested")}),d.jsx("dd",{children:f})]}),d.jsxs("div",{className:"size-confirm__pair",children:[d.jsx("dt",{children:c("sizeConfirm.adjusted")}),d.jsx("dd",{children:p})]})]}),d.jsx("p",{className:"size-confirm__reason",children:c(DN(n.reasons))})]}),d.jsxs("div",{className:"modal__actions",children:[d.jsx("button",{ref:r,type:"button",className:"modal__btn modal__btn--secondary",onClick:i,children:c("sizeConfirm.cancel")}),d.jsx("button",{type:"button",className:"modal__btn",onClick:()=>{o()},children:c("sizeConfirm.approve")})]})]})})}function Nr(n){return n==null||n===""?"-":String(n)}function GN(){const{t:n}=ge(),o=E(m=>m.metadataRestore),i=E(m=>m.applyMetadataRestore),r=E(m=>m.addMetadataRestoreAsReference),c=E(m=>m.cancelMetadataRestore);if(!o)return null;const f=o.metadata,p=f.userPrompt||f.prompt||f.revisedPrompt||"";return d.jsx("div",{className:"modal-backdrop metadata-restore-backdrop",role:"presentation",children:d.jsxs("div",{className:"modal metadata-restore",role:"dialog","aria-modal":"true","aria-labelledby":"metadata-restore-title",children:[d.jsx("div",{id:"metadata-restore-title",className:"modal__title",children:n("metadata.restoreTitle")}),d.jsxs("div",{className:"modal__body metadata-restore__body",children:[d.jsx("p",{children:n("metadata.restoreBody")}),d.jsxs("div",{className:"metadata-restore__preview",children:[d.jsx("img",{src:o.image,alt:n("metadata.imageAlt")}),d.jsxs("div",{className:"metadata-restore__details",children:[d.jsxs("div",{children:[d.jsx("span",{children:n("metadata.prompt")}),d.jsx("strong",{title:p,children:Nr(p)})]}),d.jsxs("div",{children:[d.jsx("span",{children:n("metadata.size")}),d.jsx("strong",{children:Nr(f.size)})]}),d.jsxs("div",{children:[d.jsx("span",{children:n("metadata.quality")}),d.jsx("strong",{children:Nr(f.quality)})]}),d.jsxs("div",{children:[d.jsx("span",{children:n("metadata.model")}),d.jsx("strong",{children:Nr(f.model)})]}),d.jsxs("div",{children:[d.jsx("span",{children:n("metadata.source")}),d.jsx("strong",{children:o.source==="png-comment"?n("metadata.sourcePngComment"):n("metadata.sourceXmp")})]})]})]})]}),d.jsxs("div",{className:"modal__actions",children:[d.jsx("button",{type:"button",className:"modal__btn modal__btn--secondary",onClick:c,children:n("common.cancel")}),d.jsx("button",{type:"button",className:"modal__btn modal__btn--secondary",onClick:r,children:n("metadata.useAsReferenceOnly")}),d.jsx("button",{type:"button",className:"modal__btn",onClick:i,children:n("metadata.applySettings")})]})]})})}function qN(){const{t:n}=ge(),o=E(_=>_.readinessPopupOpen),i=E(_=>_.closeReadinessPopup),r=E(_=>_.openSettings),c=E(_=>_.provider),f=E(_=>_.imageModel),p=E(_=>_.reasoningEffort),m=E(_=>_.webSearchEnabled),y=ry(),g=c==="grok",x=In.find(_=>_.value===f);if(!o)return null;const S=y[c],b=S.ok,N=()=>{i(),r("account")};return d.jsx("div",{className:"modal-backdrop provider-readiness-backdrop",onClick:i,role:"presentation",children:d.jsxs("div",{className:"modal provider-readiness",role:"dialog","aria-modal":"true","aria-labelledby":"provider-readiness-title",onClick:_=>_.stopPropagation(),children:[d.jsx("div",{id:"provider-readiness-title",className:"modal__title",children:n("readiness.title")}),d.jsxs("div",{className:"modal__body provider-readiness__body",children:[d.jsxs("div",{className:`provider-readiness__status${b?" is-ok":" is-blocked"}`,children:[d.jsx("span",{"aria-hidden":"true"}),d.jsx("strong",{children:n(b?"readiness.ready":"readiness.blocked")}),d.jsx("small",{children:b?n("readiness.readyBody"):S.reason})]}),S.hint?d.jsx("p",{className:"modal__hint",children:S.hint}):null,d.jsxs("dl",{className:"provider-readiness__facts",children:[d.jsxs("div",{children:[d.jsx("dt",{children:n("readiness.provider")}),d.jsx("dd",{children:c==="agy"?"Gemini":c==="grok"?"Grok OAuth":c==="oauth"?"GPT OAuth":"GPT API"})]}),d.jsxs("div",{children:[d.jsx("dt",{children:n("readiness.model")}),d.jsx("dd",{children:x?n(x.fullLabelKey):f})]}),g?d.jsxs("div",{children:[d.jsx("dt",{children:n("readiness.grokApi")}),d.jsx("dd",{children:n("readiness.grokApiBody")})]}):d.jsxs(d.Fragment,{children:[d.jsxs("div",{children:[d.jsx("dt",{children:n("readiness.reasoning")}),d.jsx("dd",{children:p})]}),d.jsxs("div",{children:[d.jsx("dt",{children:n("readiness.webSearch")}),d.jsx("dd",{children:n(m?"settings.webSearch.on":"settings.webSearch.off")})]})]})]})]}),d.jsxs("div",{className:"modal__actions",children:[d.jsx("button",{type:"button",className:"modal__btn modal__btn--secondary",onClick:i,children:n("common.close")}),d.jsx("button",{type:"button",className:"modal__btn",onClick:N,children:n("readiness.openAccount")})]})]})})}function HN(){const n=E(p=>p.trashPending),o=E(p=>p.restorePendingTrash),i=E(p=>p.clearPendingTrash),{t:r}=ge(),[c,f]=D.useState(Date.now());return D.useEffect(()=>{if(!n)return;f(Date.now());const p=window.setInterval(()=>{const m=Date.now();f(m),m>=n.expiresAt&&i()},500);return()=>window.clearInterval(p)},[i,n]),n?d.jsxs("div",{className:"trash-undo-toast",children:[d.jsx("span",{children:r("gallery.deleted",{filename:n.filename})}),d.jsx("button",{type:"button",onClick:()=>{o()},children:r("gallery.undo")}),d.jsx("span",{className:"trash-undo-toast__timer",children:r("gallery.secondsSuffix",{n:Math.max(0,Math.ceil((n.expiresAt-c)/1e3))})})]}):null}function PN(){return d.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[d.jsx("line",{x1:"4",y1:"6",x2:"14",y2:"6"}),d.jsx("circle",{cx:"17",cy:"6",r:"2.2"}),d.jsx("line",{x1:"4",y1:"12",x2:"8",y2:"12"}),d.jsx("circle",{cx:"11",cy:"12",r:"2.2"}),d.jsx("line",{x1:"14",y1:"12",x2:"20",y2:"12"}),d.jsx("line",{x1:"4",y1:"18",x2:"14",y2:"18"}),d.jsx("circle",{cx:"17",cy:"18",r:"2.2"})]})}function UN(){const n=E(g=>g.composeSheetOpen),o=E(g=>g.composeSheetTab),i=E(g=>g.openComposeSheet),r=E(g=>g.settingsOpen),c=E(g=>g.uiMode),{t:f}=ge();if(!Hi()||r||c==="card-news"||c==="agent")return null;const m=n&&o==="controls",y=f("sheet.controlsOpen");return d.jsx("button",{type:"button",className:"mobile-settings-toggle","aria-expanded":m,"aria-controls":"mobile-generate-sheet","aria-label":y,title:y,onClick:()=>i("controls"),children:d.jsx(PN,{})})}function BN(){const{t:n}=ge(),o=E(p=>p.openComposeSheet),i=E(p=>p.settingsOpen),c=E(p=>p.uiMode)==="node"&&Gi?"node":"classic";return!Hi()||i||c!=="classic"?null:d.jsxs("header",{className:"mobile-app-bar",role:"banner",children:[d.jsxs("div",{className:"mobile-app-bar__brand",children:[d.jsx("div",{className:"logo-mark","aria-hidden":"true"}),d.jsxs("div",{className:"mobile-app-bar__brand-copy",children:[d.jsx("span",{className:"mobile-app-bar__title",children:"ima2-gen"}),d.jsx("span",{className:"mobile-app-bar__mode",children:n("appBar.modeImage")})]})]}),d.jsxs("div",{className:"mobile-app-bar__actions",children:[d.jsx(ay,{variant:"sidebar"}),d.jsx("button",{type:"button",className:"mobile-app-bar__icon-button",onClick:()=>o("library"),"aria-label":n("promptLibrary.title"),title:n("promptLibrary.title"),children:d.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:d.jsx("path",{d:"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"})})}),d.jsx("button",{type:"button",className:"mobile-app-bar__icon-button",onClick:()=>o("controls"),"aria-label":n("appBar.controls"),title:n("appBar.controls"),children:d.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[d.jsx("circle",{cx:"12",cy:"12",r:"3"}),d.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]})}),d.jsxs("button",{type:"button",className:"mobile-app-bar__generate",onClick:()=>o("prompt"),"aria-label":n("appBar.generateAria"),children:[d.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[d.jsx("path",{d:"M12 3l1.8 5.4L19 10l-5.2 1.6L12 17l-1.8-5.4L5 10l5.2-1.6L12 3z"}),d.jsx("path",{d:"M19 15l.8 2.2L22 18l-2.2.8L19 21l-.8-2.2L16 18l2.2-.8L19 15z"})]}),d.jsx("span",{children:n("appBar.generate")})]})]})]})}const FN=D.lazy(()=>wa(()=>import("./PromptLibraryPanel-B9kndPw1.js"),[]).then(n=>({default:n.PromptLibraryPanel}))),KN=["prompt","controls","library"];function VN(){const{t:n}=ge(),o=E(g=>g.composeSheetOpen),i=E(g=>g.composeSheetTab),r=E(g=>g.setComposeSheetTab),c=E(g=>g.closeComposeSheet),f=E(g=>g.settingsOpen),m=E(g=>g.uiMode)==="node"&&Gi?"node":"classic",y=Hi();return D.useEffect(()=>{if(!o)return;const g=x=>{x.key==="Escape"&&c()};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[o,c]),!y||f||m!=="classic"?null:d.jsxs(d.Fragment,{children:[o?d.jsx("div",{className:"compose-sheet-backdrop",role:"button","aria-label":n("sheet.close"),onClick:c}):null,d.jsxs("section",{id:"mobile-generate-sheet",className:`compose-sheet${o?" compose-sheet--open":""}`,role:"dialog","aria-modal":o?"true":"false","aria-label":n("sheet.generate"),"aria-hidden":!o,children:[d.jsx("button",{type:"button",className:"compose-sheet__handle",onClick:c,"aria-label":n("sheet.close")}),d.jsx("div",{className:"mobile-sheet-tabs",role:"tablist","aria-label":n("sheet.generate"),children:KN.map(g=>d.jsx("button",{type:"button",role:"tab","aria-selected":i===g,className:`mobile-sheet-tabs__button${i===g?" active":""}`,onClick:()=>r(g),children:n(`sheet.tabs.${g}`)},g))}),d.jsx("div",{className:"compose-sheet__body",children:i==="prompt"?d.jsxs("div",{className:"compose-sheet__panel compose-sheet__panel--prompt",role:"tabpanel",children:[d.jsx(zu,{}),d.jsx(Du,{}),d.jsx(kr,{})]}):i==="controls"?d.jsx("div",{className:"compose-sheet__panel compose-sheet__panel--controls",role:"tabpanel",children:d.jsx(sy,{})}):d.jsx("div",{className:"compose-sheet__panel compose-sheet__panel--library",role:"tabpanel",children:d.jsx(D.Suspense,{fallback:d.jsx("div",{className:"prompt-library-panel__loading",children:n("common.loading")}),children:d.jsx(FN,{variant:"embedded",forceOpen:!0,onRequestClose:()=>r("prompt")})})})})]})]})}const YN={ArrowLeft:"previous",ArrowRight:"next",Home:"first",End:"last",PageUp:"pagePrevious",PageDown:"pageNext"};function XN(){const n=E(r=>r.uiMode),o=E(r=>!!r.currentImage||!!r.multimodePreviewFlightId),i=E(r=>r.selectHistoryShortcutTarget);D.useEffect(()=>{if(n!=="classic")return;const r=c=>{const f=YN[c.key];f&&(c.defaultPrevented||zr(c.target)||o&&(c.preventDefault(),i(f)))};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[o,i,n])}const _r=64,dy="Image Gen";let Lu=dy,Cu=!1,nn=null,Gu="",wu=!1;function fy(){return navigator}function my(){if(typeof document>"u")return null;if(nn)return nn;const n=document.querySelector('link[rel~="icon"]');if(n)return nn=n,Gu=n.href||n.getAttribute("href")||"",n;const o=document.createElement("link");return o.rel="icon",document.head.appendChild(o),nn=o,wu=!0,o}function QN(n){const o=document.createElement("canvas");o.width=_r,o.height=_r;const i=o.getContext("2d");return i?(i.clearRect(0,0,_r,_r),i.fillStyle="#0a0a0a",ZN(i,6,6,52,52,12),i.fill(),i.strokeStyle="#ffffff",i.lineWidth=5,i.beginPath(),i.arc(30,32,14,0,Math.PI*2),i.stroke(),i.fillStyle="#ffffff",i.beginPath(),i.arc(30,32,5,0,Math.PI*2),i.fill(),i.beginPath(),i.arc(48,16,n>1?13:10,0,Math.PI*2),i.fillStyle="#ff335f",i.fill(),i.lineWidth=4,i.strokeStyle="#ffffff",i.stroke(),n>1&&(i.fillStyle="#ffffff",i.font="bold 15px sans-serif",i.textAlign="center",i.textBaseline="middle",i.fillText(String(Math.min(n,9)),48,17)),o.toDataURL("image/png")):Gu}function ZN(n,o,i,r,c,f){n.beginPath(),n.moveTo(o+f,i),n.arcTo(o+r,i,o+r,i+c,f),n.arcTo(o+r,i+c,o,i+c,f),n.arcTo(o,i+c,o,i,f),n.arcTo(o,i,o+r,i,f),n.closePath()}async function JN(n){const o=fy();if(typeof o.setAppBadge=="function")try{await o.setAppBadge(n)}catch{}}async function $N(){const n=fy();if(typeof n.clearAppBadge=="function")try{await n.clearAppBadge()}catch{}}function WN(n){document.title=`(${n}) ${Lu}`;const o=my();o&&(o.href=QN(n)),JN(n)}function Qh(){document.title=Lu,nn&&(wu?(nn.remove(),nn=null,wu=!1):nn.href=Gu),$N()}function Zh(){Cu||typeof document>"u"||(Cu=!0,Lu=document.title||dy,my())}function e_(n){D.useEffect(()=>(Zh(),()=>{Cu&&Qh()}),[]),D.useEffect(()=>{Zh(),n>0?WN(n):Qh()},[n])}function t_(){D.useEffect(()=>{if(typeof window>"u")return;const n=window.visualViewport;if(!n)return;const o=()=>{const i=Math.round(n.height),r=Math.round(n.offsetTop);document.documentElement.style.setProperty("--vv-h",`${i}px`),document.documentElement.style.setProperty("--vv-offset-top",`${r}px`)};return o(),n.addEventListener("resize",o),n.addEventListener("scroll",o),()=>{n.removeEventListener("resize",o),n.removeEventListener("scroll",o)}},[])}const a_=D.lazy(()=>wa(()=>import("./NodeCanvas-ChEXzQbb.js"),__vite__mapDeps([0,1])).then(n=>({default:n.NodeCanvas}))),n_=D.lazy(()=>wa(()=>import("./SettingsWorkspace-B3tgLrmF.js"),[]).then(n=>({default:n.SettingsWorkspace}))),l_=D.lazy(()=>wa(()=>import("./CardNewsWorkspace-Dqyc1WZ1.js"),[]).then(n=>({default:n.CardNewsWorkspace}))),i_=D.lazy(()=>wa(()=>import("./AgentWorkspace-CYv84Rus.js"),[]).then(n=>({default:n.AgentWorkspace}))),o_=D.lazy(()=>wa(()=>import("./PromptLibraryPanel-B9kndPw1.js"),[]).then(n=>({default:n.PromptLibraryPanel})));function r_(){return d.jsx("main",{className:"canvas canvas--lazy-loading","aria-busy":"true"})}function s_(){XN(),t_();const n=E(K=>K.hydrateHistory),o=E(K=>K.loadSessions),i=E(K=>K.startInFlightPolling),r=E(K=>K.reconcileInflight),c=E(K=>K.syncFromStorage),f=E(K=>K.theme),p=E(K=>K.resolvedTheme),m=E(K=>K.themeFamily),y=E(K=>K.settingsOpen),g=E(K=>K.unseenGeneratedCount),x=E(K=>K.historyStripLayout),S=E(K=>K.workspaceProfile),b=E(K=>K.syncThemeFromStorage),N=E(K=>K.syncThemeFamilyFromStorage),_=E(K=>K.refreshResolvedTheme),I=E(K=>K.uiMode)==="node"&&Gi?"node":"classic",G=I==="agent",L=Hi(),O=zi(S),k=!L&&I==="classic"&&O.composerPlacement==="bottom"&&O.multimodeHistoryGrouping==="sequence",$=!k&&!G;return e_(g),D.useEffect(()=>{n(),o(),r(),i()},[n,o,r,i]),D.useEffect(()=>{const K=W=>{W.key&&(W.key==="ima2.inFlight"||W.key==="ima2.selectedFilename"?c():W.key==="ima2:theme"?b():W.key==="ima2:themeFamily"&&N())};return window.addEventListener("storage",K),()=>window.removeEventListener("storage",K)},[c,b,N]),D.useEffect(()=>{const K=document.documentElement;K.dataset.theme=p,K.dataset.themeMode=p,K.dataset.themeFamily=m,K.style.colorScheme=p},[p,m]),D.useEffect(()=>{if(f!=="system")return;const K=window.matchMedia("(prefers-color-scheme: light)");return K.addEventListener("change",_),()=>K.removeEventListener("change",_)},[_,f]),D.useEffect(()=>{const K=()=>{R1(E.getState)};return window.addEventListener("beforeunload",K),()=>{window.removeEventListener("beforeunload",K)}},[]),d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:`app${S==="prompt-studio"?" app--prompt-studio":""}${y?" app--settings-open":""}${$&&x==="horizontal"?" app--history-horizontal":""}${$&&x==="sidebar"?" app--history-sidebar":""}`,"data-theme-mode":p,"data-theme-family":m,"data-history-strip-layout":x,"data-mobile":L?"1":void 0,"data-ui-mode":I,children:[d.jsx(nT,{}),d.jsx(BN,{}),$?d.jsx(uN,{}):null,d.jsx(D.Suspense,{fallback:d.jsx(r_,{}),children:y?d.jsx(n_,{}):I==="classic"?k?d.jsx(_T,{}):d.jsx(Eu,{}):I==="node"?d.jsx(a_,{}):I==="card-news"?d.jsx(l_,{}):I==="agent"?d.jsx(i_,{}):d.jsx(Eu,{})}),I==="agent"||I==="card-news"?null:d.jsx(iN,{})]}),d.jsx(LN,{}),d.jsx(HN,{}),d.jsx(dN,{}),d.jsx(fN,{}),d.jsx(zN,{}),d.jsx(GN,{}),d.jsx(qN,{}),d.jsx(VN,{}),d.jsx(UN,{}),I==="card-news"?d.jsx(D.Suspense,{fallback:null,children:d.jsx(o_,{})}):null]})}function c_(){if(window.location.protocol!=="http:"||window.location.hostname!=="localhost")return!1;const n=new URL(window.location.href);return n.hostname="127.0.0.1",window.location.replace(n.toString()),!0}c_()||Ub.createRoot(document.getElementById("root")).render(d.jsx(D.StrictMode,{children:d.jsx(s_,{})}));export{E_ as $,zr as A,h_ as B,m_ as C,Su as D,u_ as E,uT as F,d_ as G,f_ as H,ay as I,$h as J,A_ as K,v_ as L,gT as M,g_ as N,b_ as O,S_ as P,y_ as Q,or as R,j1 as S,Xb as T,O1 as U,x_ as V,k1 as W,T_ as X,N_ as Y,__ as Z,wa as _,D as a,E as b,_x as c,Hx as d,Hi as e,wx as f,jb as g,GT as h,ln as i,d as j,HT as k,qT as l,PT as m,Gx as n,Cr as o,C_ as p,ot as q,Mu as r,oN as s,In as t,ge as u,Ar as v,pT as w,hT as x,Jp as y,p_ as z};
|