Hamdast1/dist/assets/index-B28_Ysnv.js
reza7321 213c0a70f0 امروز ۳۱ اردیبهشت
چت بات عمومی خرابه
2026-05-21 14:50:03 +03:30

399 lines
666 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

function jv(e,n){for(var a=0;a<n.length;a++){const s=n[a];if(typeof s!="string"&&!Array.isArray(s)){for(const o in s)if(o!=="default"&&!(o in e)){const l=Object.getOwnPropertyDescriptor(s,o);l&&Object.defineProperty(e,o,l.get?l:{enumerable:!0,get:()=>s[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))s(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const d of l.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&s(d)}).observe(document,{childList:!0,subtree:!0});function a(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function s(o){if(o.ep)return;o.ep=!0;const l=a(o);fetch(o.href,l)}})();function Og(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Lu={exports:{}},bi={},Au={exports:{}},et={};/**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var g0;function Cv(){if(g0)return et;g0=1;var e=Symbol.for("react.element"),n=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),h=Symbol.iterator;function b(T){return T===null||typeof T!="object"?null:(T=h&&T[h]||T["@@iterator"],typeof T=="function"?T:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,N={};function j(T,O,ne){this.props=T,this.context=O,this.refs=N,this.updater=ne||k}j.prototype.isReactComponent={},j.prototype.setState=function(T,O){if(typeof T!="object"&&typeof T!="function"&&T!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,T,O,"setState")},j.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function M(){}M.prototype=j.prototype;function P(T,O,ne){this.props=T,this.context=O,this.refs=N,this.updater=ne||k}var F=P.prototype=new M;F.constructor=P,C(F,j.prototype),F.isPureReactComponent=!0;var U=Array.isArray,W=Object.prototype.hasOwnProperty,J={current:null},A={key:!0,ref:!0,__self:!0,__source:!0};function w(T,O,ne){var ie,oe={},ae=null,ue=null;if(O!=null)for(ie in O.ref!==void 0&&(ue=O.ref),O.key!==void 0&&(ae=""+O.key),O)W.call(O,ie)&&!A.hasOwnProperty(ie)&&(oe[ie]=O[ie]);var xe=arguments.length-2;if(xe===1)oe.children=ne;else if(1<xe){for(var ve=Array(xe),Ve=0;Ve<xe;Ve++)ve[Ve]=arguments[Ve+2];oe.children=ve}if(T&&T.defaultProps)for(ie in xe=T.defaultProps,xe)oe[ie]===void 0&&(oe[ie]=xe[ie]);return{$$typeof:e,type:T,key:ae,ref:ue,props:oe,_owner:J.current}}function R(T,O){return{$$typeof:e,type:T.type,key:O,ref:T.ref,props:T.props,_owner:T._owner}}function E(T){return typeof T=="object"&&T!==null&&T.$$typeof===e}function Y(T){var O={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(ne){return O[ne]})}var K=/\/+/g;function I(T,O){return typeof T=="object"&&T!==null&&T.key!=null?Y(""+T.key):O.toString(36)}function $(T,O,ne,ie,oe){var ae=typeof T;(ae==="undefined"||ae==="boolean")&&(T=null);var ue=!1;if(T===null)ue=!0;else switch(ae){case"string":case"number":ue=!0;break;case"object":switch(T.$$typeof){case e:case n:ue=!0}}if(ue)return ue=T,oe=oe(ue),T=ie===""?"."+I(ue,0):ie,U(oe)?(ne="",T!=null&&(ne=T.replace(K,"$&/")+"/"),$(oe,O,ne,"",function(Ve){return Ve})):oe!=null&&(E(oe)&&(oe=R(oe,ne+(!oe.key||ue&&ue.key===oe.key?"":(""+oe.key).replace(K,"$&/")+"/")+T)),O.push(oe)),1;if(ue=0,ie=ie===""?".":ie+":",U(T))for(var xe=0;xe<T.length;xe++){ae=T[xe];var ve=ie+I(ae,xe);ue+=$(ae,O,ne,ve,oe)}else if(ve=b(T),typeof ve=="function")for(T=ve.call(T),xe=0;!(ae=T.next()).done;)ae=ae.value,ve=ie+I(ae,xe++),ue+=$(ae,O,ne,ve,oe);else if(ae==="object")throw O=String(T),Error("Objects are not valid as a React child (found: "+(O==="[object Object]"?"object with keys {"+Object.keys(T).join(", ")+"}":O)+"). If you meant to render a collection of children, use an array instead.");return ue}function ee(T,O,ne){if(T==null)return T;var ie=[],oe=0;return $(T,ie,"","",function(ae){return O.call(ne,ae,oe++)}),ie}function G(T){if(T._status===-1){var O=T._result;O=O(),O.then(function(ne){(T._status===0||T._status===-1)&&(T._status=1,T._result=ne)},function(ne){(T._status===0||T._status===-1)&&(T._status=2,T._result=ne)}),T._status===-1&&(T._status=0,T._result=O)}if(T._status===1)return T._result.default;throw T._result}var z={current:null},D={transition:null},X={ReactCurrentDispatcher:z,ReactCurrentBatchConfig:D,ReactCurrentOwner:J};function q(){throw Error("act(...) is not supported in production builds of React.")}return et.Children={map:ee,forEach:function(T,O,ne){ee(T,function(){O.apply(this,arguments)},ne)},count:function(T){var O=0;return ee(T,function(){O++}),O},toArray:function(T){return ee(T,function(O){return O})||[]},only:function(T){if(!E(T))throw Error("React.Children.only expected to receive a single React element child.");return T}},et.Component=j,et.Fragment=a,et.Profiler=o,et.PureComponent=P,et.StrictMode=s,et.Suspense=m,et.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=X,et.act=q,et.cloneElement=function(T,O,ne){if(T==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+T+".");var ie=C({},T.props),oe=T.key,ae=T.ref,ue=T._owner;if(O!=null){if(O.ref!==void 0&&(ae=O.ref,ue=J.current),O.key!==void 0&&(oe=""+O.key),T.type&&T.type.defaultProps)var xe=T.type.defaultProps;for(ve in O)W.call(O,ve)&&!A.hasOwnProperty(ve)&&(ie[ve]=O[ve]===void 0&&xe!==void 0?xe[ve]:O[ve])}var ve=arguments.length-2;if(ve===1)ie.children=ne;else if(1<ve){xe=Array(ve);for(var Ve=0;Ve<ve;Ve++)xe[Ve]=arguments[Ve+2];ie.children=xe}return{$$typeof:e,type:T.type,key:oe,ref:ae,props:ie,_owner:ue}},et.createContext=function(T){return T={$$typeof:d,_currentValue:T,_currentValue2:T,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},T.Provider={$$typeof:l,_context:T},T.Consumer=T},et.createElement=w,et.createFactory=function(T){var O=w.bind(null,T);return O.type=T,O},et.createRef=function(){return{current:null}},et.forwardRef=function(T){return{$$typeof:f,render:T}},et.isValidElement=E,et.lazy=function(T){return{$$typeof:y,_payload:{_status:-1,_result:T},_init:G}},et.memo=function(T,O){return{$$typeof:g,type:T,compare:O===void 0?null:O}},et.startTransition=function(T){var O=D.transition;D.transition={};try{T()}finally{D.transition=O}},et.unstable_act=q,et.useCallback=function(T,O){return z.current.useCallback(T,O)},et.useContext=function(T){return z.current.useContext(T)},et.useDebugValue=function(){},et.useDeferredValue=function(T){return z.current.useDeferredValue(T)},et.useEffect=function(T,O){return z.current.useEffect(T,O)},et.useId=function(){return z.current.useId()},et.useImperativeHandle=function(T,O,ne){return z.current.useImperativeHandle(T,O,ne)},et.useInsertionEffect=function(T,O){return z.current.useInsertionEffect(T,O)},et.useLayoutEffect=function(T,O){return z.current.useLayoutEffect(T,O)},et.useMemo=function(T,O){return z.current.useMemo(T,O)},et.useReducer=function(T,O,ne){return z.current.useReducer(T,O,ne)},et.useRef=function(T){return z.current.useRef(T)},et.useState=function(T){return z.current.useState(T)},et.useSyncExternalStore=function(T,O,ne){return z.current.useSyncExternalStore(T,O,ne)},et.useTransition=function(){return z.current.useTransition()},et.version="18.3.1",et}var y0;function Hl(){return y0||(y0=1,Au.exports=Cv()),Au.exports}/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var x0;function Nv(){if(x0)return bi;x0=1;var e=Hl(),n=Symbol.for("react.element"),a=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function d(f,m,g){var y,h={},b=null,k=null;g!==void 0&&(b=""+g),m.key!==void 0&&(b=""+m.key),m.ref!==void 0&&(k=m.ref);for(y in m)s.call(m,y)&&!l.hasOwnProperty(y)&&(h[y]=m[y]);if(f&&f.defaultProps)for(y in m=f.defaultProps,m)h[y]===void 0&&(h[y]=m[y]);return{$$typeof:n,type:f,key:b,ref:k,props:h,_owner:o.current}}return bi.Fragment=a,bi.jsx=d,bi.jsxs=d,bi}var v0;function Ev(){return v0||(v0=1,Lu.exports=Nv()),Lu.exports}var u=Ev(),nl={},Ou={exports:{}},Pn={},Bu={exports:{}},zu={};/**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var b0;function Tv(){return b0||(b0=1,(function(e){function n(D,X){var q=D.length;D.push(X);e:for(;0<q;){var T=q-1>>>1,O=D[T];if(0<o(O,X))D[T]=X,D[q]=O,q=T;else break e}}function a(D){return D.length===0?null:D[0]}function s(D){if(D.length===0)return null;var X=D[0],q=D.pop();if(q!==X){D[0]=q;e:for(var T=0,O=D.length,ne=O>>>1;T<ne;){var ie=2*(T+1)-1,oe=D[ie],ae=ie+1,ue=D[ae];if(0>o(oe,q))ae<O&&0>o(ue,oe)?(D[T]=ue,D[ae]=q,T=ae):(D[T]=oe,D[ie]=q,T=ie);else if(ae<O&&0>o(ue,q))D[T]=ue,D[ae]=q,T=ae;else break e}}return X}function o(D,X){var q=D.sortIndex-X.sortIndex;return q!==0?q:D.id-X.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var d=Date,f=d.now();e.unstable_now=function(){return d.now()-f}}var m=[],g=[],y=1,h=null,b=3,k=!1,C=!1,N=!1,j=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,P=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function F(D){for(var X=a(g);X!==null;){if(X.callback===null)s(g);else if(X.startTime<=D)s(g),X.sortIndex=X.expirationTime,n(m,X);else break;X=a(g)}}function U(D){if(N=!1,F(D),!C)if(a(m)!==null)C=!0,G(W);else{var X=a(g);X!==null&&z(U,X.startTime-D)}}function W(D,X){C=!1,N&&(N=!1,M(w),w=-1),k=!0;var q=b;try{for(F(X),h=a(m);h!==null&&(!(h.expirationTime>X)||D&&!Y());){var T=h.callback;if(typeof T=="function"){h.callback=null,b=h.priorityLevel;var O=T(h.expirationTime<=X);X=e.unstable_now(),typeof O=="function"?h.callback=O:h===a(m)&&s(m),F(X)}else s(m);h=a(m)}if(h!==null)var ne=!0;else{var ie=a(g);ie!==null&&z(U,ie.startTime-X),ne=!1}return ne}finally{h=null,b=q,k=!1}}var J=!1,A=null,w=-1,R=5,E=-1;function Y(){return!(e.unstable_now()-E<R)}function K(){if(A!==null){var D=e.unstable_now();E=D;var X=!0;try{X=A(!0,D)}finally{X?I():(J=!1,A=null)}}else J=!1}var I;if(typeof P=="function")I=function(){P(K)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,ee=$.port2;$.port1.onmessage=K,I=function(){ee.postMessage(null)}}else I=function(){j(K,0)};function G(D){A=D,J||(J=!0,I())}function z(D,X){w=j(function(){D(e.unstable_now())},X)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(D){D.callback=null},e.unstable_continueExecution=function(){C||k||(C=!0,G(W))},e.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<D?Math.floor(1e3/D):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_getFirstCallbackNode=function(){return a(m)},e.unstable_next=function(D){switch(b){case 1:case 2:case 3:var X=3;break;default:X=b}var q=b;b=X;try{return D()}finally{b=q}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(D,X){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var q=b;b=D;try{return X()}finally{b=q}},e.unstable_scheduleCallback=function(D,X,q){var T=e.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?T+q:T):q=T,D){case 1:var O=-1;break;case 2:O=250;break;case 5:O=1073741823;break;case 4:O=1e4;break;default:O=5e3}return O=q+O,D={id:y++,callback:X,priorityLevel:D,startTime:q,expirationTime:O,sortIndex:-1},q>T?(D.sortIndex=q,n(g,D),a(m)===null&&D===a(g)&&(N?(M(w),w=-1):N=!0,z(U,q-T))):(D.sortIndex=O,n(m,D),C||k||(C=!0,G(W))),D},e.unstable_shouldYield=Y,e.unstable_wrapCallback=function(D){var X=b;return function(){var q=b;b=X;try{return D.apply(this,arguments)}finally{b=q}}}})(zu)),zu}var w0;function Pv(){return w0||(w0=1,Bu.exports=Tv()),Bu.exports}/**
* @license React
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var k0;function Rv(){if(k0)return Pn;k0=1;var e=Hl(),n=Pv();function a(t){for(var r="https://reactjs.org/docs/error-decoder.html?invariant="+t,i=1;i<arguments.length;i++)r+="&args[]="+encodeURIComponent(arguments[i]);return"Minified React error #"+t+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,o={};function l(t,r){d(t,r),d(t+"Capture",r)}function d(t,r){for(o[t]=r,t=0;t<r.length;t++)s.add(r[t])}var f=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),m=Object.prototype.hasOwnProperty,g=/^[: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]*$/,y={},h={};function b(t){return m.call(h,t)?!0:m.call(y,t)?!1:g.test(t)?h[t]=!0:(y[t]=!0,!1)}function k(t,r,i,c){if(i!==null&&i.type===0)return!1;switch(typeof r){case"function":case"symbol":return!0;case"boolean":return c?!1:i!==null?!i.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function C(t,r,i,c){if(r===null||typeof r>"u"||k(t,r,i,c))return!0;if(c)return!1;if(i!==null)switch(i.type){case 3:return!r;case 4:return r===!1;case 5:return isNaN(r);case 6:return isNaN(r)||1>r}return!1}function N(t,r,i,c,p,x,S){this.acceptsBooleans=r===2||r===3||r===4,this.attributeName=c,this.attributeNamespace=p,this.mustUseProperty=i,this.propertyName=t,this.type=r,this.sanitizeURL=x,this.removeEmptyString=S}var j={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){j[t]=new N(t,0,!1,t,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var r=t[0];j[r]=new N(r,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){j[t]=new N(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){j[t]=new N(t,2,!1,t,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){j[t]=new N(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){j[t]=new N(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){j[t]=new N(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){j[t]=new N(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){j[t]=new N(t,5,!1,t.toLowerCase(),null,!1,!1)});var M=/[\-:]([a-z])/g;function P(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var r=t.replace(M,P);j[r]=new N(r,1,!1,t,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var r=t.replace(M,P);j[r]=new N(r,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(t){var r=t.replace(M,P);j[r]=new N(r,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){j[t]=new N(t,1,!1,t.toLowerCase(),null,!1,!1)}),j.xlinkHref=new N("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){j[t]=new N(t,1,!1,t.toLowerCase(),null,!0,!0)});function F(t,r,i,c){var p=j.hasOwnProperty(r)?j[r]:null;(p!==null?p.type!==0:c||!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=="N")&&(C(r,i,p,c)&&(i=null),c||p===null?b(r)&&(i===null?t.removeAttribute(r):t.setAttribute(r,""+i)):p.mustUseProperty?t[p.propertyName]=i===null?p.type===3?!1:"":i:(r=p.attributeName,c=p.attributeNamespace,i===null?t.removeAttribute(r):(p=p.type,i=p===3||p===4&&i===!0?"":""+i,c?t.setAttributeNS(c,r,i):t.setAttribute(r,i))))}var U=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,W=Symbol.for("react.element"),J=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),E=Symbol.for("react.provider"),Y=Symbol.for("react.context"),K=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),$=Symbol.for("react.suspense_list"),ee=Symbol.for("react.memo"),G=Symbol.for("react.lazy"),z=Symbol.for("react.offscreen"),D=Symbol.iterator;function X(t){return t===null||typeof t!="object"?null:(t=D&&t[D]||t["@@iterator"],typeof t=="function"?t:null)}var q=Object.assign,T;function O(t){if(T===void 0)try{throw Error()}catch(i){var r=i.stack.trim().match(/\n( *(at )?)/);T=r&&r[1]||""}return`
`+T+t}var ne=!1;function ie(t,r){if(!t||ne)return"";ne=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(r)if(r=function(){throw Error()},Object.defineProperty(r.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(r,[])}catch(re){var c=re}Reflect.construct(t,[],r)}else{try{r.call()}catch(re){c=re}t.call(r.prototype)}else{try{throw Error()}catch(re){c=re}t()}}catch(re){if(re&&c&&typeof re.stack=="string"){for(var p=re.stack.split(`
`),x=c.stack.split(`
`),S=p.length-1,_=x.length-1;1<=S&&0<=_&&p[S]!==x[_];)_--;for(;1<=S&&0<=_;S--,_--)if(p[S]!==x[_]){if(S!==1||_!==1)do if(S--,_--,0>_||p[S]!==x[_]){var B=`
`+p[S].replace(" at new "," at ");return t.displayName&&B.includes("<anonymous>")&&(B=B.replace("<anonymous>",t.displayName)),B}while(1<=S&&0<=_);break}}}finally{ne=!1,Error.prepareStackTrace=i}return(t=t?t.displayName||t.name:"")?O(t):""}function oe(t){switch(t.tag){case 5:return O(t.type);case 16:return O("Lazy");case 13:return O("Suspense");case 19:return O("SuspenseList");case 0:case 2:case 15:return t=ie(t.type,!1),t;case 11:return t=ie(t.type.render,!1),t;case 1:return t=ie(t.type,!0),t;default:return""}}function ae(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case A:return"Fragment";case J:return"Portal";case R:return"Profiler";case w:return"StrictMode";case I:return"Suspense";case $:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Y:return(t.displayName||"Context")+".Consumer";case E:return(t._context.displayName||"Context")+".Provider";case K:var r=t.render;return t=t.displayName,t||(t=r.displayName||r.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case ee:return r=t.displayName||null,r!==null?r:ae(t.type)||"Memo";case G:r=t._payload,t=t._init;try{return ae(t(r))}catch{}}return null}function ue(t){var r=t.type;switch(t.tag){case 24:return"Cache";case 9:return(r.displayName||"Context")+".Consumer";case 10:return(r._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=r.render,t=t.displayName||t.name||"",r.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return r;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ae(r);case 8:return r===w?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r}return null}function xe(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function ve(t){var r=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function Ve(t){var r=ve(t)?"checked":"value",i=Object.getOwnPropertyDescriptor(t.constructor.prototype,r),c=""+t[r];if(!t.hasOwnProperty(r)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var p=i.get,x=i.set;return Object.defineProperty(t,r,{configurable:!0,get:function(){return p.call(this)},set:function(S){c=""+S,x.call(this,S)}}),Object.defineProperty(t,r,{enumerable:i.enumerable}),{getValue:function(){return c},setValue:function(S){c=""+S},stopTracking:function(){t._valueTracker=null,delete t[r]}}}}function Ce(t){t._valueTracker||(t._valueTracker=Ve(t))}function Ue(t){if(!t)return!1;var r=t._valueTracker;if(!r)return!0;var i=r.getValue(),c="";return t&&(c=ve(t)?t.checked?"true":"false":t.value),t=c,t!==i?(r.setValue(t),!0):!1}function Oe(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function dt(t,r){var i=r.checked;return q({},r,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:i??t._wrapperState.initialChecked})}function xt(t,r){var i=r.defaultValue==null?"":r.defaultValue,c=r.checked!=null?r.checked:r.defaultChecked;i=xe(r.value!=null?r.value:i),t._wrapperState={initialChecked:c,initialValue:i,controlled:r.type==="checkbox"||r.type==="radio"?r.checked!=null:r.value!=null}}function vt(t,r){r=r.checked,r!=null&&F(t,"checked",r,!1)}function Se(t,r){vt(t,r);var i=xe(r.value),c=r.type;if(i!=null)c==="number"?(i===0&&t.value===""||t.value!=i)&&(t.value=""+i):t.value!==""+i&&(t.value=""+i);else if(c==="submit"||c==="reset"){t.removeAttribute("value");return}r.hasOwnProperty("value")?we(t,r.type,i):r.hasOwnProperty("defaultValue")&&we(t,r.type,xe(r.defaultValue)),r.checked==null&&r.defaultChecked!=null&&(t.defaultChecked=!!r.defaultChecked)}function Re(t,r,i){if(r.hasOwnProperty("value")||r.hasOwnProperty("defaultValue")){var c=r.type;if(!(c!=="submit"&&c!=="reset"||r.value!==void 0&&r.value!==null))return;r=""+t._wrapperState.initialValue,i||r===t.value||(t.value=r),t.defaultValue=r}i=t.name,i!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,i!==""&&(t.name=i)}function we(t,r,i){(r!=="number"||Oe(t.ownerDocument)!==t)&&(i==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+i&&(t.defaultValue=""+i))}var me=Array.isArray;function Ie(t,r,i,c){if(t=t.options,r){r={};for(var p=0;p<i.length;p++)r["$"+i[p]]=!0;for(i=0;i<t.length;i++)p=r.hasOwnProperty("$"+t[i].value),t[i].selected!==p&&(t[i].selected=p),p&&c&&(t[i].defaultSelected=!0)}else{for(i=""+xe(i),r=null,p=0;p<t.length;p++){if(t[p].value===i){t[p].selected=!0,c&&(t[p].defaultSelected=!0);return}r!==null||t[p].disabled||(r=t[p])}r!==null&&(r.selected=!0)}}function be(t,r){if(r.dangerouslySetInnerHTML!=null)throw Error(a(91));return q({},r,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function Ae(t,r){var i=r.value;if(i==null){if(i=r.children,r=r.defaultValue,i!=null){if(r!=null)throw Error(a(92));if(me(i)){if(1<i.length)throw Error(a(93));i=i[0]}r=i}r==null&&(r=""),i=r}t._wrapperState={initialValue:xe(i)}}function Qe(t,r){var i=xe(r.value),c=xe(r.defaultValue);i!=null&&(i=""+i,i!==t.value&&(t.value=i),r.defaultValue==null&&t.defaultValue!==i&&(t.defaultValue=i)),c!=null&&(t.defaultValue=""+c)}function Ge(t){var r=t.textContent;r===t._wrapperState.initialValue&&r!==""&&r!==null&&(t.value=r)}function rt(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function ht(t,r){return t==null||t==="http://www.w3.org/1999/xhtml"?rt(r):t==="http://www.w3.org/2000/svg"&&r==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Qt,Pt=(function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(r,i,c,p){MSApp.execUnsafeLocalFunction(function(){return t(r,i,c,p)})}:t})(function(t,r){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=r;else{for(Qt=Qt||document.createElement("div"),Qt.innerHTML="<svg>"+r.valueOf().toString()+"</svg>",r=Qt.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;r.firstChild;)t.appendChild(r.firstChild)}});function qe(t,r){if(r){var i=t.firstChild;if(i&&i===t.lastChild&&i.nodeType===3){i.nodeValue=r;return}}t.textContent=r}var kn={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ft=["Webkit","ms","Moz","O"];Object.keys(kn).forEach(function(t){ft.forEach(function(r){r=r+t.charAt(0).toUpperCase()+t.substring(1),kn[r]=kn[t]})});function Mn(t,r,i){return r==null||typeof r=="boolean"||r===""?"":i||typeof r!="number"||r===0||kn.hasOwnProperty(t)&&kn[t]?(""+r).trim():r+"px"}function Te(t,r){t=t.style;for(var i in r)if(r.hasOwnProperty(i)){var c=i.indexOf("--")===0,p=Mn(i,r[i],c);i==="float"&&(i="cssFloat"),c?t.setProperty(i,p):t[i]=p}}var Ze=q({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ot(t,r){if(r){if(Ze[t]&&(r.children!=null||r.dangerouslySetInnerHTML!=null))throw Error(a(137,t));if(r.dangerouslySetInnerHTML!=null){if(r.children!=null)throw Error(a(60));if(typeof r.dangerouslySetInnerHTML!="object"||!("__html"in r.dangerouslySetInnerHTML))throw Error(a(61))}if(r.style!=null&&typeof r.style!="object")throw Error(a(62))}}function it(t,r){if(t.indexOf("-")===-1)return typeof r.is=="string";switch(t){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 Zt=null;function gt(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var yr=null,an=null,Vn=null;function Fr(t){if(t=si(t)){if(typeof yr!="function")throw Error(a(280));var r=t.stateNode;r&&(r=yo(r),yr(t.stateNode,t.type,r))}}function Ye(t){an?Vn?Vn.push(t):Vn=[t]:an=t}function Et(){if(an){var t=an,r=Vn;if(Vn=an=null,Fr(t),r)for(t=0;t<r.length;t++)Fr(r[t])}}function Lt(t,r){return t(r)}function $t(){}var In=!1;function kt(t,r,i){if(In)return t(r,i);In=!0;try{return Lt(t,r,i)}finally{In=!1,(an!==null||Vn!==null)&&($t(),Et())}}function At(t,r){var i=t.stateNode;if(i===null)return null;var c=yo(i);if(c===null)return null;i=c[r];e:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(t=t.type,c=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!c;break e;default:t=!1}if(t)return null;if(i&&typeof i!="function")throw Error(a(231,r,typeof i));return i}var xr=!1;if(f)try{var Ht={};Object.defineProperty(Ht,"passive",{get:function(){xr=!0}}),window.addEventListener("test",Ht,Ht),window.removeEventListener("test",Ht,Ht)}catch{xr=!1}function L(t,r,i,c,p,x,S,_,B){var re=Array.prototype.slice.call(arguments,3);try{r.apply(i,re)}catch(fe){this.onError(fe)}}var V=!1,Q=null,le=!1,ce=null,_e={onError:function(t){V=!0,Q=t}};function Fe(t,r,i,c,p,x,S,_,B){V=!1,Q=null,L.apply(_e,arguments)}function Ke(t,r,i,c,p,x,S,_,B){if(Fe.apply(this,arguments),V){if(V){var re=Q;V=!1,Q=null}else throw Error(a(198));le||(le=!0,ce=re)}}function ye(t){var r=t,i=t;if(t.alternate)for(;r.return;)r=r.return;else{t=r;do r=t,(r.flags&4098)!==0&&(i=r.return),t=r.return;while(t)}return r.tag===3?i:null}function De(t){if(t.tag===13){var r=t.memoizedState;if(r===null&&(t=t.alternate,t!==null&&(r=t.memoizedState)),r!==null)return r.dehydrated}return null}function $e(t){if(ye(t)!==t)throw Error(a(188))}function Xe(t){var r=t.alternate;if(!r){if(r=ye(t),r===null)throw Error(a(188));return r!==t?null:t}for(var i=t,c=r;;){var p=i.return;if(p===null)break;var x=p.alternate;if(x===null){if(c=p.return,c!==null){i=c;continue}break}if(p.child===x.child){for(x=p.child;x;){if(x===i)return $e(p),t;if(x===c)return $e(p),r;x=x.sibling}throw Error(a(188))}if(i.return!==c.return)i=p,c=x;else{for(var S=!1,_=p.child;_;){if(_===i){S=!0,i=p,c=x;break}if(_===c){S=!0,c=p,i=x;break}_=_.sibling}if(!S){for(_=x.child;_;){if(_===i){S=!0,i=x,c=p;break}if(_===c){S=!0,c=x,i=p;break}_=_.sibling}if(!S)throw Error(a(189))}}if(i.alternate!==c)throw Error(a(190))}if(i.tag!==3)throw Error(a(188));return i.stateNode.current===i?t:r}function Le(t){return t=Xe(t),t!==null?tt(t):null}function tt(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var r=tt(t);if(r!==null)return r;t=t.sibling}return null}var ut=n.unstable_scheduleCallback,Ot=n.unstable_cancelCallback,St=n.unstable_shouldYield,pt=n.unstable_requestPaint,at=n.unstable_now,sn=n.unstable_getCurrentPriorityLevel,Dr=n.unstable_ImmediatePriority,nr=n.unstable_UserBlockingPriority,rr=n.unstable_NormalPriority,vr=n.unstable_LowPriority,_n=n.unstable_IdlePriority,Wr=null,Wt=null;function Xa(t){if(Wt&&typeof Wt.onCommitFiberRoot=="function")try{Wt.onCommitFiberRoot(Wr,t,void 0,(t.current.flags&128)===128)}catch{}}var on=Math.clz32?Math.clz32:ln,Ja=Math.log,st=Math.LN2;function ln(t){return t>>>=0,t===0?32:31-(Ja(t)/st|0)|0}var gn=64,Sn=4194304;function Kr(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Yr(t,r){var i=t.pendingLanes;if(i===0)return 0;var c=0,p=t.suspendedLanes,x=t.pingedLanes,S=i&268435455;if(S!==0){var _=S&~p;_!==0?c=Kr(_):(x&=S,x!==0&&(c=Kr(x)))}else S=i&~p,S!==0?c=Kr(S):x!==0&&(c=Kr(x));if(c===0)return 0;if(r!==0&&r!==c&&(r&p)===0&&(p=c&-c,x=r&-r,p>=x||p===16&&(x&4194240)!==0))return r;if((c&4)!==0&&(c|=i&16),r=t.entangledLanes,r!==0)for(t=t.entanglements,r&=c;0<r;)i=31-on(r),p=1<<i,c|=t[i],r&=~p;return c}function bt(t,r){switch(t){case 1:case 2:case 4:return r+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Lr(t,r){for(var i=t.suspendedLanes,c=t.pingedLanes,p=t.expirationTimes,x=t.pendingLanes;0<x;){var S=31-on(x),_=1<<S,B=p[S];B===-1?((_&i)===0||(_&c)!==0)&&(p[S]=bt(_,r)):B<=r&&(t.expiredLanes|=_),x&=~_}}function qa(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function eo(){var t=gn;return gn<<=1,(gn&4194240)===0&&(gn=64),t}function ac(t){for(var r=[],i=0;31>i;i++)r.push(t);return r}function Us(t,r,i){t.pendingLanes|=r,r!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,r=31-on(r),t[r]=i}function Wx(t,r){var i=t.pendingLanes&~r;t.pendingLanes=r,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=r,t.mutableReadLanes&=r,t.entangledLanes&=r,r=t.entanglements;var c=t.eventTimes;for(t=t.expirationTimes;0<i;){var p=31-on(i),x=1<<p;r[p]=0,c[p]=-1,t[p]=-1,i&=~x}}function sc(t,r){var i=t.entangledLanes|=r;for(t=t.entanglements;i;){var c=31-on(i),p=1<<c;p&r|t[c]&r&&(t[c]|=r),i&=~p}}var mt=0;function Gf(t){return t&=-t,1<t?4<t?(t&268435455)!==0?16:536870912:4:1}var Xf,ic,Jf,qf,Qf,oc=!1,to=[],Gr=null,Xr=null,Jr=null,$s=new Map,Hs=new Map,qr=[],Kx="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Zf(t,r){switch(t){case"focusin":case"focusout":Gr=null;break;case"dragenter":case"dragleave":Xr=null;break;case"mouseover":case"mouseout":Jr=null;break;case"pointerover":case"pointerout":$s.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":Hs.delete(r.pointerId)}}function Ws(t,r,i,c,p,x){return t===null||t.nativeEvent!==x?(t={blockedOn:r,domEventName:i,eventSystemFlags:c,nativeEvent:x,targetContainers:[p]},r!==null&&(r=si(r),r!==null&&ic(r)),t):(t.eventSystemFlags|=c,r=t.targetContainers,p!==null&&r.indexOf(p)===-1&&r.push(p),t)}function Yx(t,r,i,c,p){switch(r){case"focusin":return Gr=Ws(Gr,t,r,i,c,p),!0;case"dragenter":return Xr=Ws(Xr,t,r,i,c,p),!0;case"mouseover":return Jr=Ws(Jr,t,r,i,c,p),!0;case"pointerover":var x=p.pointerId;return $s.set(x,Ws($s.get(x)||null,t,r,i,c,p)),!0;case"gotpointercapture":return x=p.pointerId,Hs.set(x,Ws(Hs.get(x)||null,t,r,i,c,p)),!0}return!1}function eh(t){var r=Na(t.target);if(r!==null){var i=ye(r);if(i!==null){if(r=i.tag,r===13){if(r=De(i),r!==null){t.blockedOn=r,Qf(t.priority,function(){Jf(i)});return}}else if(r===3&&i.stateNode.current.memoizedState.isDehydrated){t.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}t.blockedOn=null}function no(t){if(t.blockedOn!==null)return!1;for(var r=t.targetContainers;0<r.length;){var i=cc(t.domEventName,t.eventSystemFlags,r[0],t.nativeEvent);if(i===null){i=t.nativeEvent;var c=new i.constructor(i.type,i);Zt=c,i.target.dispatchEvent(c),Zt=null}else return r=si(i),r!==null&&ic(r),t.blockedOn=i,!1;r.shift()}return!0}function th(t,r,i){no(t)&&i.delete(r)}function Gx(){oc=!1,Gr!==null&&no(Gr)&&(Gr=null),Xr!==null&&no(Xr)&&(Xr=null),Jr!==null&&no(Jr)&&(Jr=null),$s.forEach(th),Hs.forEach(th)}function Ks(t,r){t.blockedOn===r&&(t.blockedOn=null,oc||(oc=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,Gx)))}function Ys(t){function r(p){return Ks(p,t)}if(0<to.length){Ks(to[0],t);for(var i=1;i<to.length;i++){var c=to[i];c.blockedOn===t&&(c.blockedOn=null)}}for(Gr!==null&&Ks(Gr,t),Xr!==null&&Ks(Xr,t),Jr!==null&&Ks(Jr,t),$s.forEach(r),Hs.forEach(r),i=0;i<qr.length;i++)c=qr[i],c.blockedOn===t&&(c.blockedOn=null);for(;0<qr.length&&(i=qr[0],i.blockedOn===null);)eh(i),i.blockedOn===null&&qr.shift()}var Qa=U.ReactCurrentBatchConfig,ro=!0;function Xx(t,r,i,c){var p=mt,x=Qa.transition;Qa.transition=null;try{mt=1,lc(t,r,i,c)}finally{mt=p,Qa.transition=x}}function Jx(t,r,i,c){var p=mt,x=Qa.transition;Qa.transition=null;try{mt=4,lc(t,r,i,c)}finally{mt=p,Qa.transition=x}}function lc(t,r,i,c){if(ro){var p=cc(t,r,i,c);if(p===null)Nc(t,r,c,ao,i),Zf(t,c);else if(Yx(p,t,r,i,c))c.stopPropagation();else if(Zf(t,c),r&4&&-1<Kx.indexOf(t)){for(;p!==null;){var x=si(p);if(x!==null&&Xf(x),x=cc(t,r,i,c),x===null&&Nc(t,r,c,ao,i),x===p)break;p=x}p!==null&&c.stopPropagation()}else Nc(t,r,c,null,i)}}var ao=null;function cc(t,r,i,c){if(ao=null,t=gt(c),t=Na(t),t!==null)if(r=ye(t),r===null)t=null;else if(i=r.tag,i===13){if(t=De(r),t!==null)return t;t=null}else if(i===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;t=null}else r!==t&&(t=null);return ao=t,null}function nh(t){switch(t){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(sn()){case Dr:return 1;case nr:return 4;case rr:case vr:return 16;case _n:return 536870912;default:return 16}default:return 16}}var Qr=null,uc=null,so=null;function rh(){if(so)return so;var t,r=uc,i=r.length,c,p="value"in Qr?Qr.value:Qr.textContent,x=p.length;for(t=0;t<i&&r[t]===p[t];t++);var S=i-t;for(c=1;c<=S&&r[i-c]===p[x-c];c++);return so=p.slice(t,1<c?1-c:void 0)}function io(t){var r=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&r===13&&(t=13)):t=r,t===10&&(t=13),32<=t||t===13?t:0}function oo(){return!0}function ah(){return!1}function Fn(t){function r(i,c,p,x,S){this._reactName=i,this._targetInst=p,this.type=c,this.nativeEvent=x,this.target=S,this.currentTarget=null;for(var _ in t)t.hasOwnProperty(_)&&(i=t[_],this[_]=i?i(x):x[_]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?oo:ah,this.isPropagationStopped=ah,this}return q(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=oo)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=oo)},persist:function(){},isPersistent:oo}),r}var Za={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},dc=Fn(Za),Gs=q({},Za,{view:0,detail:0}),qx=Fn(Gs),fc,hc,Xs,lo=q({},Gs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:mc,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Xs&&(Xs&&t.type==="mousemove"?(fc=t.screenX-Xs.screenX,hc=t.screenY-Xs.screenY):hc=fc=0,Xs=t),fc)},movementY:function(t){return"movementY"in t?t.movementY:hc}}),sh=Fn(lo),Qx=q({},lo,{dataTransfer:0}),Zx=Fn(Qx),e2=q({},Gs,{relatedTarget:0}),pc=Fn(e2),t2=q({},Za,{animationName:0,elapsedTime:0,pseudoElement:0}),n2=Fn(t2),r2=q({},Za,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),a2=Fn(r2),s2=q({},Za,{data:0}),ih=Fn(s2),i2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},o2={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"},l2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function c2(t){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(t):(t=l2[t])?!!r[t]:!1}function mc(){return c2}var u2=q({},Gs,{key:function(t){if(t.key){var r=i2[t.key]||t.key;if(r!=="Unidentified")return r}return t.type==="keypress"?(t=io(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?o2[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:mc,charCode:function(t){return t.type==="keypress"?io(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?io(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),d2=Fn(u2),f2=q({},lo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),oh=Fn(f2),h2=q({},Gs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:mc}),p2=Fn(h2),m2=q({},Za,{propertyName:0,elapsedTime:0,pseudoElement:0}),g2=Fn(m2),y2=q({},lo,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),x2=Fn(y2),v2=[9,13,27,32],gc=f&&"CompositionEvent"in window,Js=null;f&&"documentMode"in document&&(Js=document.documentMode);var b2=f&&"TextEvent"in window&&!Js,lh=f&&(!gc||Js&&8<Js&&11>=Js),ch=" ",uh=!1;function dh(t,r){switch(t){case"keyup":return v2.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function fh(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var es=!1;function w2(t,r){switch(t){case"compositionend":return fh(r);case"keypress":return r.which!==32?null:(uh=!0,ch);case"textInput":return t=r.data,t===ch&&uh?null:t;default:return null}}function k2(t,r){if(es)return t==="compositionend"||!gc&&dh(t,r)?(t=rh(),so=uc=Qr=null,es=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return lh&&r.locale!=="ko"?null:r.data;default:return null}}var S2={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 hh(t){var r=t&&t.nodeName&&t.nodeName.toLowerCase();return r==="input"?!!S2[t.type]:r==="textarea"}function ph(t,r,i,c){Ye(c),r=po(r,"onChange"),0<r.length&&(i=new dc("onChange","change",null,i,c),t.push({event:i,listeners:r}))}var qs=null,Qs=null;function j2(t){Ih(t,0)}function co(t){var r=ss(t);if(Ue(r))return t}function C2(t,r){if(t==="change")return r}var mh=!1;if(f){var yc;if(f){var xc="oninput"in document;if(!xc){var gh=document.createElement("div");gh.setAttribute("oninput","return;"),xc=typeof gh.oninput=="function"}yc=xc}else yc=!1;mh=yc&&(!document.documentMode||9<document.documentMode)}function yh(){qs&&(qs.detachEvent("onpropertychange",xh),Qs=qs=null)}function xh(t){if(t.propertyName==="value"&&co(Qs)){var r=[];ph(r,Qs,t,gt(t)),kt(j2,r)}}function N2(t,r,i){t==="focusin"?(yh(),qs=r,Qs=i,qs.attachEvent("onpropertychange",xh)):t==="focusout"&&yh()}function E2(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return co(Qs)}function T2(t,r){if(t==="click")return co(r)}function P2(t,r){if(t==="input"||t==="change")return co(r)}function R2(t,r){return t===r&&(t!==0||1/t===1/r)||t!==t&&r!==r}var ar=typeof Object.is=="function"?Object.is:R2;function Zs(t,r){if(ar(t,r))return!0;if(typeof t!="object"||t===null||typeof r!="object"||r===null)return!1;var i=Object.keys(t),c=Object.keys(r);if(i.length!==c.length)return!1;for(c=0;c<i.length;c++){var p=i[c];if(!m.call(r,p)||!ar(t[p],r[p]))return!1}return!0}function vh(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function bh(t,r){var i=vh(t);t=0;for(var c;i;){if(i.nodeType===3){if(c=t+i.textContent.length,t<=r&&c>=r)return{node:i,offset:r-t};t=c}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=vh(i)}}function wh(t,r){return t&&r?t===r?!0:t&&t.nodeType===3?!1:r&&r.nodeType===3?wh(t,r.parentNode):"contains"in t?t.contains(r):t.compareDocumentPosition?!!(t.compareDocumentPosition(r)&16):!1:!1}function kh(){for(var t=window,r=Oe();r instanceof t.HTMLIFrameElement;){try{var i=typeof r.contentWindow.location.href=="string"}catch{i=!1}if(i)t=r.contentWindow;else break;r=Oe(t.document)}return r}function vc(t){var r=t&&t.nodeName&&t.nodeName.toLowerCase();return r&&(r==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||r==="textarea"||t.contentEditable==="true")}function M2(t){var r=kh(),i=t.focusedElem,c=t.selectionRange;if(r!==i&&i&&i.ownerDocument&&wh(i.ownerDocument.documentElement,i)){if(c!==null&&vc(i)){if(r=c.start,t=c.end,t===void 0&&(t=r),"selectionStart"in i)i.selectionStart=r,i.selectionEnd=Math.min(t,i.value.length);else if(t=(r=i.ownerDocument||document)&&r.defaultView||window,t.getSelection){t=t.getSelection();var p=i.textContent.length,x=Math.min(c.start,p);c=c.end===void 0?x:Math.min(c.end,p),!t.extend&&x>c&&(p=c,c=x,x=p),p=bh(i,x);var S=bh(i,c);p&&S&&(t.rangeCount!==1||t.anchorNode!==p.node||t.anchorOffset!==p.offset||t.focusNode!==S.node||t.focusOffset!==S.offset)&&(r=r.createRange(),r.setStart(p.node,p.offset),t.removeAllRanges(),x>c?(t.addRange(r),t.extend(S.node,S.offset)):(r.setEnd(S.node,S.offset),t.addRange(r)))}}for(r=[],t=i;t=t.parentNode;)t.nodeType===1&&r.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof i.focus=="function"&&i.focus(),i=0;i<r.length;i++)t=r[i],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var I2=f&&"documentMode"in document&&11>=document.documentMode,ts=null,bc=null,ei=null,wc=!1;function Sh(t,r,i){var c=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;wc||ts==null||ts!==Oe(c)||(c=ts,"selectionStart"in c&&vc(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),ei&&Zs(ei,c)||(ei=c,c=po(bc,"onSelect"),0<c.length&&(r=new dc("onSelect","select",null,r,i),t.push({event:r,listeners:c}),r.target=ts)))}function uo(t,r){var i={};return i[t.toLowerCase()]=r.toLowerCase(),i["Webkit"+t]="webkit"+r,i["Moz"+t]="moz"+r,i}var ns={animationend:uo("Animation","AnimationEnd"),animationiteration:uo("Animation","AnimationIteration"),animationstart:uo("Animation","AnimationStart"),transitionend:uo("Transition","TransitionEnd")},kc={},jh={};f&&(jh=document.createElement("div").style,"AnimationEvent"in window||(delete ns.animationend.animation,delete ns.animationiteration.animation,delete ns.animationstart.animation),"TransitionEvent"in window||delete ns.transitionend.transition);function fo(t){if(kc[t])return kc[t];if(!ns[t])return t;var r=ns[t],i;for(i in r)if(r.hasOwnProperty(i)&&i in jh)return kc[t]=r[i];return t}var Ch=fo("animationend"),Nh=fo("animationiteration"),Eh=fo("animationstart"),Th=fo("transitionend"),Ph=new Map,Rh="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Zr(t,r){Ph.set(t,r),l(r,[t])}for(var Sc=0;Sc<Rh.length;Sc++){var jc=Rh[Sc],_2=jc.toLowerCase(),F2=jc[0].toUpperCase()+jc.slice(1);Zr(_2,"on"+F2)}Zr(Ch,"onAnimationEnd"),Zr(Nh,"onAnimationIteration"),Zr(Eh,"onAnimationStart"),Zr("dblclick","onDoubleClick"),Zr("focusin","onFocus"),Zr("focusout","onBlur"),Zr(Th,"onTransitionEnd"),d("onMouseEnter",["mouseout","mouseover"]),d("onMouseLeave",["mouseout","mouseover"]),d("onPointerEnter",["pointerout","pointerover"]),d("onPointerLeave",["pointerout","pointerover"]),l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),l("onBeforeInput",["compositionend","keypress","textInput","paste"]),l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ti="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(" "),D2=new Set("cancel close invalid load scroll toggle".split(" ").concat(ti));function Mh(t,r,i){var c=t.type||"unknown-event";t.currentTarget=i,Ke(c,r,void 0,t),t.currentTarget=null}function Ih(t,r){r=(r&4)!==0;for(var i=0;i<t.length;i++){var c=t[i],p=c.event;c=c.listeners;e:{var x=void 0;if(r)for(var S=c.length-1;0<=S;S--){var _=c[S],B=_.instance,re=_.currentTarget;if(_=_.listener,B!==x&&p.isPropagationStopped())break e;Mh(p,_,re),x=B}else for(S=0;S<c.length;S++){if(_=c[S],B=_.instance,re=_.currentTarget,_=_.listener,B!==x&&p.isPropagationStopped())break e;Mh(p,_,re),x=B}}}if(le)throw t=ce,le=!1,ce=null,t}function jt(t,r){var i=r[Ic];i===void 0&&(i=r[Ic]=new Set);var c=t+"__bubble";i.has(c)||(_h(r,t,2,!1),i.add(c))}function Cc(t,r,i){var c=0;r&&(c|=4),_h(i,t,c,r)}var ho="_reactListening"+Math.random().toString(36).slice(2);function ni(t){if(!t[ho]){t[ho]=!0,s.forEach(function(i){i!=="selectionchange"&&(D2.has(i)||Cc(i,!1,t),Cc(i,!0,t))});var r=t.nodeType===9?t:t.ownerDocument;r===null||r[ho]||(r[ho]=!0,Cc("selectionchange",!1,r))}}function _h(t,r,i,c){switch(nh(r)){case 1:var p=Xx;break;case 4:p=Jx;break;default:p=lc}i=p.bind(null,r,i,t),p=void 0,!xr||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(p=!0),c?p!==void 0?t.addEventListener(r,i,{capture:!0,passive:p}):t.addEventListener(r,i,!0):p!==void 0?t.addEventListener(r,i,{passive:p}):t.addEventListener(r,i,!1)}function Nc(t,r,i,c,p){var x=c;if((r&1)===0&&(r&2)===0&&c!==null)e:for(;;){if(c===null)return;var S=c.tag;if(S===3||S===4){var _=c.stateNode.containerInfo;if(_===p||_.nodeType===8&&_.parentNode===p)break;if(S===4)for(S=c.return;S!==null;){var B=S.tag;if((B===3||B===4)&&(B=S.stateNode.containerInfo,B===p||B.nodeType===8&&B.parentNode===p))return;S=S.return}for(;_!==null;){if(S=Na(_),S===null)return;if(B=S.tag,B===5||B===6){c=x=S;continue e}_=_.parentNode}}c=c.return}kt(function(){var re=x,fe=gt(i),he=[];e:{var de=Ph.get(t);if(de!==void 0){var ke=dc,Ne=t;switch(t){case"keypress":if(io(i)===0)break e;case"keydown":case"keyup":ke=d2;break;case"focusin":Ne="focus",ke=pc;break;case"focusout":Ne="blur",ke=pc;break;case"beforeblur":case"afterblur":ke=pc;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ke=sh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ke=Zx;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ke=p2;break;case Ch:case Nh:case Eh:ke=n2;break;case Th:ke=g2;break;case"scroll":ke=qx;break;case"wheel":ke=x2;break;case"copy":case"cut":case"paste":ke=a2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ke=oh}var Pe=(r&4)!==0,Bt=!Pe&&t==="scroll",Z=Pe?de!==null?de+"Capture":null:de;Pe=[];for(var H=re,te;H!==null;){te=H;var pe=te.stateNode;if(te.tag===5&&pe!==null&&(te=pe,Z!==null&&(pe=At(H,Z),pe!=null&&Pe.push(ri(H,pe,te)))),Bt)break;H=H.return}0<Pe.length&&(de=new ke(de,Ne,null,i,fe),he.push({event:de,listeners:Pe}))}}if((r&7)===0){e:{if(de=t==="mouseover"||t==="pointerover",ke=t==="mouseout"||t==="pointerout",de&&i!==Zt&&(Ne=i.relatedTarget||i.fromElement)&&(Na(Ne)||Ne[Ar]))break e;if((ke||de)&&(de=fe.window===fe?fe:(de=fe.ownerDocument)?de.defaultView||de.parentWindow:window,ke?(Ne=i.relatedTarget||i.toElement,ke=re,Ne=Ne?Na(Ne):null,Ne!==null&&(Bt=ye(Ne),Ne!==Bt||Ne.tag!==5&&Ne.tag!==6)&&(Ne=null)):(ke=null,Ne=re),ke!==Ne)){if(Pe=sh,pe="onMouseLeave",Z="onMouseEnter",H="mouse",(t==="pointerout"||t==="pointerover")&&(Pe=oh,pe="onPointerLeave",Z="onPointerEnter",H="pointer"),Bt=ke==null?de:ss(ke),te=Ne==null?de:ss(Ne),de=new Pe(pe,H+"leave",ke,i,fe),de.target=Bt,de.relatedTarget=te,pe=null,Na(fe)===re&&(Pe=new Pe(Z,H+"enter",Ne,i,fe),Pe.target=te,Pe.relatedTarget=Bt,pe=Pe),Bt=pe,ke&&Ne)t:{for(Pe=ke,Z=Ne,H=0,te=Pe;te;te=rs(te))H++;for(te=0,pe=Z;pe;pe=rs(pe))te++;for(;0<H-te;)Pe=rs(Pe),H--;for(;0<te-H;)Z=rs(Z),te--;for(;H--;){if(Pe===Z||Z!==null&&Pe===Z.alternate)break t;Pe=rs(Pe),Z=rs(Z)}Pe=null}else Pe=null;ke!==null&&Fh(he,de,ke,Pe,!1),Ne!==null&&Bt!==null&&Fh(he,Bt,Ne,Pe,!0)}}e:{if(de=re?ss(re):window,ke=de.nodeName&&de.nodeName.toLowerCase(),ke==="select"||ke==="input"&&de.type==="file")var Me=C2;else if(hh(de))if(mh)Me=P2;else{Me=E2;var Be=N2}else(ke=de.nodeName)&&ke.toLowerCase()==="input"&&(de.type==="checkbox"||de.type==="radio")&&(Me=T2);if(Me&&(Me=Me(t,re))){ph(he,Me,i,fe);break e}Be&&Be(t,de,re),t==="focusout"&&(Be=de._wrapperState)&&Be.controlled&&de.type==="number"&&we(de,"number",de.value)}switch(Be=re?ss(re):window,t){case"focusin":(hh(Be)||Be.contentEditable==="true")&&(ts=Be,bc=re,ei=null);break;case"focusout":ei=bc=ts=null;break;case"mousedown":wc=!0;break;case"contextmenu":case"mouseup":case"dragend":wc=!1,Sh(he,i,fe);break;case"selectionchange":if(I2)break;case"keydown":case"keyup":Sh(he,i,fe)}var ze;if(gc)e:{switch(t){case"compositionstart":var We="onCompositionStart";break e;case"compositionend":We="onCompositionEnd";break e;case"compositionupdate":We="onCompositionUpdate";break e}We=void 0}else es?dh(t,i)&&(We="onCompositionEnd"):t==="keydown"&&i.keyCode===229&&(We="onCompositionStart");We&&(lh&&i.locale!=="ko"&&(es||We!=="onCompositionStart"?We==="onCompositionEnd"&&es&&(ze=rh()):(Qr=fe,uc="value"in Qr?Qr.value:Qr.textContent,es=!0)),Be=po(re,We),0<Be.length&&(We=new ih(We,t,null,i,fe),he.push({event:We,listeners:Be}),ze?We.data=ze:(ze=fh(i),ze!==null&&(We.data=ze)))),(ze=b2?w2(t,i):k2(t,i))&&(re=po(re,"onBeforeInput"),0<re.length&&(fe=new ih("onBeforeInput","beforeinput",null,i,fe),he.push({event:fe,listeners:re}),fe.data=ze))}Ih(he,r)})}function ri(t,r,i){return{instance:t,listener:r,currentTarget:i}}function po(t,r){for(var i=r+"Capture",c=[];t!==null;){var p=t,x=p.stateNode;p.tag===5&&x!==null&&(p=x,x=At(t,i),x!=null&&c.unshift(ri(t,x,p)),x=At(t,r),x!=null&&c.push(ri(t,x,p))),t=t.return}return c}function rs(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function Fh(t,r,i,c,p){for(var x=r._reactName,S=[];i!==null&&i!==c;){var _=i,B=_.alternate,re=_.stateNode;if(B!==null&&B===c)break;_.tag===5&&re!==null&&(_=re,p?(B=At(i,x),B!=null&&S.unshift(ri(i,B,_))):p||(B=At(i,x),B!=null&&S.push(ri(i,B,_)))),i=i.return}S.length!==0&&t.push({event:r,listeners:S})}var L2=/\r\n?/g,A2=/\u0000|\uFFFD/g;function Dh(t){return(typeof t=="string"?t:""+t).replace(L2,`
`).replace(A2,"")}function mo(t,r,i){if(r=Dh(r),Dh(t)!==r&&i)throw Error(a(425))}function go(){}var Ec=null,Tc=null;function Pc(t,r){return t==="textarea"||t==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var Rc=typeof setTimeout=="function"?setTimeout:void 0,O2=typeof clearTimeout=="function"?clearTimeout:void 0,Lh=typeof Promise=="function"?Promise:void 0,B2=typeof queueMicrotask=="function"?queueMicrotask:typeof Lh<"u"?function(t){return Lh.resolve(null).then(t).catch(z2)}:Rc;function z2(t){setTimeout(function(){throw t})}function Mc(t,r){var i=r,c=0;do{var p=i.nextSibling;if(t.removeChild(i),p&&p.nodeType===8)if(i=p.data,i==="/$"){if(c===0){t.removeChild(p),Ys(r);return}c--}else i!=="$"&&i!=="$?"&&i!=="$!"||c++;i=p}while(i);Ys(r)}function ea(t){for(;t!=null;t=t.nextSibling){var r=t.nodeType;if(r===1||r===3)break;if(r===8){if(r=t.data,r==="$"||r==="$!"||r==="$?")break;if(r==="/$")return null}}return t}function Ah(t){t=t.previousSibling;for(var r=0;t;){if(t.nodeType===8){var i=t.data;if(i==="$"||i==="$!"||i==="$?"){if(r===0)return t;r--}else i==="/$"&&r++}t=t.previousSibling}return null}var as=Math.random().toString(36).slice(2),br="__reactFiber$"+as,ai="__reactProps$"+as,Ar="__reactContainer$"+as,Ic="__reactEvents$"+as,V2="__reactListeners$"+as,U2="__reactHandles$"+as;function Na(t){var r=t[br];if(r)return r;for(var i=t.parentNode;i;){if(r=i[Ar]||i[br]){if(i=r.alternate,r.child!==null||i!==null&&i.child!==null)for(t=Ah(t);t!==null;){if(i=t[br])return i;t=Ah(t)}return r}t=i,i=t.parentNode}return null}function si(t){return t=t[br]||t[Ar],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function ss(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(a(33))}function yo(t){return t[ai]||null}var _c=[],is=-1;function ta(t){return{current:t}}function Ct(t){0>is||(t.current=_c[is],_c[is]=null,is--)}function wt(t,r){is++,_c[is]=t.current,t.current=r}var na={},cn=ta(na),jn=ta(!1),Ea=na;function os(t,r){var i=t.type.contextTypes;if(!i)return na;var c=t.stateNode;if(c&&c.__reactInternalMemoizedUnmaskedChildContext===r)return c.__reactInternalMemoizedMaskedChildContext;var p={},x;for(x in i)p[x]=r[x];return c&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=r,t.__reactInternalMemoizedMaskedChildContext=p),p}function Cn(t){return t=t.childContextTypes,t!=null}function xo(){Ct(jn),Ct(cn)}function Oh(t,r,i){if(cn.current!==na)throw Error(a(168));wt(cn,r),wt(jn,i)}function Bh(t,r,i){var c=t.stateNode;if(r=r.childContextTypes,typeof c.getChildContext!="function")return i;c=c.getChildContext();for(var p in c)if(!(p in r))throw Error(a(108,ue(t)||"Unknown",p));return q({},i,c)}function vo(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||na,Ea=cn.current,wt(cn,t),wt(jn,jn.current),!0}function zh(t,r,i){var c=t.stateNode;if(!c)throw Error(a(169));i?(t=Bh(t,r,Ea),c.__reactInternalMemoizedMergedChildContext=t,Ct(jn),Ct(cn),wt(cn,t)):Ct(jn),wt(jn,i)}var Or=null,bo=!1,Fc=!1;function Vh(t){Or===null?Or=[t]:Or.push(t)}function $2(t){bo=!0,Vh(t)}function ra(){if(!Fc&&Or!==null){Fc=!0;var t=0,r=mt;try{var i=Or;for(mt=1;t<i.length;t++){var c=i[t];do c=c(!0);while(c!==null)}Or=null,bo=!1}catch(p){throw Or!==null&&(Or=Or.slice(t+1)),ut(Dr,ra),p}finally{mt=r,Fc=!1}}return null}var ls=[],cs=0,wo=null,ko=0,Un=[],$n=0,Ta=null,Br=1,zr="";function Pa(t,r){ls[cs++]=ko,ls[cs++]=wo,wo=t,ko=r}function Uh(t,r,i){Un[$n++]=Br,Un[$n++]=zr,Un[$n++]=Ta,Ta=t;var c=Br;t=zr;var p=32-on(c)-1;c&=~(1<<p),i+=1;var x=32-on(r)+p;if(30<x){var S=p-p%5;x=(c&(1<<S)-1).toString(32),c>>=S,p-=S,Br=1<<32-on(r)+p|i<<p|c,zr=x+t}else Br=1<<x|i<<p|c,zr=t}function Dc(t){t.return!==null&&(Pa(t,1),Uh(t,1,0))}function Lc(t){for(;t===wo;)wo=ls[--cs],ls[cs]=null,ko=ls[--cs],ls[cs]=null;for(;t===Ta;)Ta=Un[--$n],Un[$n]=null,zr=Un[--$n],Un[$n]=null,Br=Un[--$n],Un[$n]=null}var Dn=null,Ln=null,Tt=!1,sr=null;function $h(t,r){var i=Yn(5,null,null,0);i.elementType="DELETED",i.stateNode=r,i.return=t,r=t.deletions,r===null?(t.deletions=[i],t.flags|=16):r.push(i)}function Hh(t,r){switch(t.tag){case 5:var i=t.type;return r=r.nodeType!==1||i.toLowerCase()!==r.nodeName.toLowerCase()?null:r,r!==null?(t.stateNode=r,Dn=t,Ln=ea(r.firstChild),!0):!1;case 6:return r=t.pendingProps===""||r.nodeType!==3?null:r,r!==null?(t.stateNode=r,Dn=t,Ln=null,!0):!1;case 13:return r=r.nodeType!==8?null:r,r!==null?(i=Ta!==null?{id:Br,overflow:zr}:null,t.memoizedState={dehydrated:r,treeContext:i,retryLane:1073741824},i=Yn(18,null,null,0),i.stateNode=r,i.return=t,t.child=i,Dn=t,Ln=null,!0):!1;default:return!1}}function Ac(t){return(t.mode&1)!==0&&(t.flags&128)===0}function Oc(t){if(Tt){var r=Ln;if(r){var i=r;if(!Hh(t,r)){if(Ac(t))throw Error(a(418));r=ea(i.nextSibling);var c=Dn;r&&Hh(t,r)?$h(c,i):(t.flags=t.flags&-4097|2,Tt=!1,Dn=t)}}else{if(Ac(t))throw Error(a(418));t.flags=t.flags&-4097|2,Tt=!1,Dn=t}}}function Wh(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Dn=t}function So(t){if(t!==Dn)return!1;if(!Tt)return Wh(t),Tt=!0,!1;var r;if((r=t.tag!==3)&&!(r=t.tag!==5)&&(r=t.type,r=r!=="head"&&r!=="body"&&!Pc(t.type,t.memoizedProps)),r&&(r=Ln)){if(Ac(t))throw Kh(),Error(a(418));for(;r;)$h(t,r),r=ea(r.nextSibling)}if(Wh(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(a(317));e:{for(t=t.nextSibling,r=0;t;){if(t.nodeType===8){var i=t.data;if(i==="/$"){if(r===0){Ln=ea(t.nextSibling);break e}r--}else i!=="$"&&i!=="$!"&&i!=="$?"||r++}t=t.nextSibling}Ln=null}}else Ln=Dn?ea(t.stateNode.nextSibling):null;return!0}function Kh(){for(var t=Ln;t;)t=ea(t.nextSibling)}function us(){Ln=Dn=null,Tt=!1}function Bc(t){sr===null?sr=[t]:sr.push(t)}var H2=U.ReactCurrentBatchConfig;function ii(t,r,i){if(t=i.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(i._owner){if(i=i._owner,i){if(i.tag!==1)throw Error(a(309));var c=i.stateNode}if(!c)throw Error(a(147,t));var p=c,x=""+t;return r!==null&&r.ref!==null&&typeof r.ref=="function"&&r.ref._stringRef===x?r.ref:(r=function(S){var _=p.refs;S===null?delete _[x]:_[x]=S},r._stringRef=x,r)}if(typeof t!="string")throw Error(a(284));if(!i._owner)throw Error(a(290,t))}return t}function jo(t,r){throw t=Object.prototype.toString.call(r),Error(a(31,t==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":t))}function Yh(t){var r=t._init;return r(t._payload)}function Gh(t){function r(Z,H){if(t){var te=Z.deletions;te===null?(Z.deletions=[H],Z.flags|=16):te.push(H)}}function i(Z,H){if(!t)return null;for(;H!==null;)r(Z,H),H=H.sibling;return null}function c(Z,H){for(Z=new Map;H!==null;)H.key!==null?Z.set(H.key,H):Z.set(H.index,H),H=H.sibling;return Z}function p(Z,H){return Z=da(Z,H),Z.index=0,Z.sibling=null,Z}function x(Z,H,te){return Z.index=te,t?(te=Z.alternate,te!==null?(te=te.index,te<H?(Z.flags|=2,H):te):(Z.flags|=2,H)):(Z.flags|=1048576,H)}function S(Z){return t&&Z.alternate===null&&(Z.flags|=2),Z}function _(Z,H,te,pe){return H===null||H.tag!==6?(H=Ru(te,Z.mode,pe),H.return=Z,H):(H=p(H,te),H.return=Z,H)}function B(Z,H,te,pe){var Me=te.type;return Me===A?fe(Z,H,te.props.children,pe,te.key):H!==null&&(H.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===G&&Yh(Me)===H.type)?(pe=p(H,te.props),pe.ref=ii(Z,H,te),pe.return=Z,pe):(pe=Go(te.type,te.key,te.props,null,Z.mode,pe),pe.ref=ii(Z,H,te),pe.return=Z,pe)}function re(Z,H,te,pe){return H===null||H.tag!==4||H.stateNode.containerInfo!==te.containerInfo||H.stateNode.implementation!==te.implementation?(H=Mu(te,Z.mode,pe),H.return=Z,H):(H=p(H,te.children||[]),H.return=Z,H)}function fe(Z,H,te,pe,Me){return H===null||H.tag!==7?(H=Aa(te,Z.mode,pe,Me),H.return=Z,H):(H=p(H,te),H.return=Z,H)}function he(Z,H,te){if(typeof H=="string"&&H!==""||typeof H=="number")return H=Ru(""+H,Z.mode,te),H.return=Z,H;if(typeof H=="object"&&H!==null){switch(H.$$typeof){case W:return te=Go(H.type,H.key,H.props,null,Z.mode,te),te.ref=ii(Z,null,H),te.return=Z,te;case J:return H=Mu(H,Z.mode,te),H.return=Z,H;case G:var pe=H._init;return he(Z,pe(H._payload),te)}if(me(H)||X(H))return H=Aa(H,Z.mode,te,null),H.return=Z,H;jo(Z,H)}return null}function de(Z,H,te,pe){var Me=H!==null?H.key:null;if(typeof te=="string"&&te!==""||typeof te=="number")return Me!==null?null:_(Z,H,""+te,pe);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case W:return te.key===Me?B(Z,H,te,pe):null;case J:return te.key===Me?re(Z,H,te,pe):null;case G:return Me=te._init,de(Z,H,Me(te._payload),pe)}if(me(te)||X(te))return Me!==null?null:fe(Z,H,te,pe,null);jo(Z,te)}return null}function ke(Z,H,te,pe,Me){if(typeof pe=="string"&&pe!==""||typeof pe=="number")return Z=Z.get(te)||null,_(H,Z,""+pe,Me);if(typeof pe=="object"&&pe!==null){switch(pe.$$typeof){case W:return Z=Z.get(pe.key===null?te:pe.key)||null,B(H,Z,pe,Me);case J:return Z=Z.get(pe.key===null?te:pe.key)||null,re(H,Z,pe,Me);case G:var Be=pe._init;return ke(Z,H,te,Be(pe._payload),Me)}if(me(pe)||X(pe))return Z=Z.get(te)||null,fe(H,Z,pe,Me,null);jo(H,pe)}return null}function Ne(Z,H,te,pe){for(var Me=null,Be=null,ze=H,We=H=0,qt=null;ze!==null&&We<te.length;We++){ze.index>We?(qt=ze,ze=null):qt=ze.sibling;var ct=de(Z,ze,te[We],pe);if(ct===null){ze===null&&(ze=qt);break}t&&ze&&ct.alternate===null&&r(Z,ze),H=x(ct,H,We),Be===null?Me=ct:Be.sibling=ct,Be=ct,ze=qt}if(We===te.length)return i(Z,ze),Tt&&Pa(Z,We),Me;if(ze===null){for(;We<te.length;We++)ze=he(Z,te[We],pe),ze!==null&&(H=x(ze,H,We),Be===null?Me=ze:Be.sibling=ze,Be=ze);return Tt&&Pa(Z,We),Me}for(ze=c(Z,ze);We<te.length;We++)qt=ke(ze,Z,We,te[We],pe),qt!==null&&(t&&qt.alternate!==null&&ze.delete(qt.key===null?We:qt.key),H=x(qt,H,We),Be===null?Me=qt:Be.sibling=qt,Be=qt);return t&&ze.forEach(function(fa){return r(Z,fa)}),Tt&&Pa(Z,We),Me}function Pe(Z,H,te,pe){var Me=X(te);if(typeof Me!="function")throw Error(a(150));if(te=Me.call(te),te==null)throw Error(a(151));for(var Be=Me=null,ze=H,We=H=0,qt=null,ct=te.next();ze!==null&&!ct.done;We++,ct=te.next()){ze.index>We?(qt=ze,ze=null):qt=ze.sibling;var fa=de(Z,ze,ct.value,pe);if(fa===null){ze===null&&(ze=qt);break}t&&ze&&fa.alternate===null&&r(Z,ze),H=x(fa,H,We),Be===null?Me=fa:Be.sibling=fa,Be=fa,ze=qt}if(ct.done)return i(Z,ze),Tt&&Pa(Z,We),Me;if(ze===null){for(;!ct.done;We++,ct=te.next())ct=he(Z,ct.value,pe),ct!==null&&(H=x(ct,H,We),Be===null?Me=ct:Be.sibling=ct,Be=ct);return Tt&&Pa(Z,We),Me}for(ze=c(Z,ze);!ct.done;We++,ct=te.next())ct=ke(ze,Z,We,ct.value,pe),ct!==null&&(t&&ct.alternate!==null&&ze.delete(ct.key===null?We:ct.key),H=x(ct,H,We),Be===null?Me=ct:Be.sibling=ct,Be=ct);return t&&ze.forEach(function(Sv){return r(Z,Sv)}),Tt&&Pa(Z,We),Me}function Bt(Z,H,te,pe){if(typeof te=="object"&&te!==null&&te.type===A&&te.key===null&&(te=te.props.children),typeof te=="object"&&te!==null){switch(te.$$typeof){case W:e:{for(var Me=te.key,Be=H;Be!==null;){if(Be.key===Me){if(Me=te.type,Me===A){if(Be.tag===7){i(Z,Be.sibling),H=p(Be,te.props.children),H.return=Z,Z=H;break e}}else if(Be.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===G&&Yh(Me)===Be.type){i(Z,Be.sibling),H=p(Be,te.props),H.ref=ii(Z,Be,te),H.return=Z,Z=H;break e}i(Z,Be);break}else r(Z,Be);Be=Be.sibling}te.type===A?(H=Aa(te.props.children,Z.mode,pe,te.key),H.return=Z,Z=H):(pe=Go(te.type,te.key,te.props,null,Z.mode,pe),pe.ref=ii(Z,H,te),pe.return=Z,Z=pe)}return S(Z);case J:e:{for(Be=te.key;H!==null;){if(H.key===Be)if(H.tag===4&&H.stateNode.containerInfo===te.containerInfo&&H.stateNode.implementation===te.implementation){i(Z,H.sibling),H=p(H,te.children||[]),H.return=Z,Z=H;break e}else{i(Z,H);break}else r(Z,H);H=H.sibling}H=Mu(te,Z.mode,pe),H.return=Z,Z=H}return S(Z);case G:return Be=te._init,Bt(Z,H,Be(te._payload),pe)}if(me(te))return Ne(Z,H,te,pe);if(X(te))return Pe(Z,H,te,pe);jo(Z,te)}return typeof te=="string"&&te!==""||typeof te=="number"?(te=""+te,H!==null&&H.tag===6?(i(Z,H.sibling),H=p(H,te),H.return=Z,Z=H):(i(Z,H),H=Ru(te,Z.mode,pe),H.return=Z,Z=H),S(Z)):i(Z,H)}return Bt}var ds=Gh(!0),Xh=Gh(!1),Co=ta(null),No=null,fs=null,zc=null;function Vc(){zc=fs=No=null}function Uc(t){var r=Co.current;Ct(Co),t._currentValue=r}function $c(t,r,i){for(;t!==null;){var c=t.alternate;if((t.childLanes&r)!==r?(t.childLanes|=r,c!==null&&(c.childLanes|=r)):c!==null&&(c.childLanes&r)!==r&&(c.childLanes|=r),t===i)break;t=t.return}}function hs(t,r){No=t,zc=fs=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&r)!==0&&(Nn=!0),t.firstContext=null)}function Hn(t){var r=t._currentValue;if(zc!==t)if(t={context:t,memoizedValue:r,next:null},fs===null){if(No===null)throw Error(a(308));fs=t,No.dependencies={lanes:0,firstContext:t}}else fs=fs.next=t;return r}var Ra=null;function Hc(t){Ra===null?Ra=[t]:Ra.push(t)}function Jh(t,r,i,c){var p=r.interleaved;return p===null?(i.next=i,Hc(r)):(i.next=p.next,p.next=i),r.interleaved=i,Vr(t,c)}function Vr(t,r){t.lanes|=r;var i=t.alternate;for(i!==null&&(i.lanes|=r),i=t,t=t.return;t!==null;)t.childLanes|=r,i=t.alternate,i!==null&&(i.childLanes|=r),i=t,t=t.return;return i.tag===3?i.stateNode:null}var aa=!1;function Wc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function qh(t,r){t=t.updateQueue,r.updateQueue===t&&(r.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Ur(t,r){return{eventTime:t,lane:r,tag:0,payload:null,callback:null,next:null}}function sa(t,r,i){var c=t.updateQueue;if(c===null)return null;if(c=c.shared,(lt&2)!==0){var p=c.pending;return p===null?r.next=r:(r.next=p.next,p.next=r),c.pending=r,Vr(t,i)}return p=c.interleaved,p===null?(r.next=r,Hc(c)):(r.next=p.next,p.next=r),c.interleaved=r,Vr(t,i)}function Eo(t,r,i){if(r=r.updateQueue,r!==null&&(r=r.shared,(i&4194240)!==0)){var c=r.lanes;c&=t.pendingLanes,i|=c,r.lanes=i,sc(t,i)}}function Qh(t,r){var i=t.updateQueue,c=t.alternate;if(c!==null&&(c=c.updateQueue,i===c)){var p=null,x=null;if(i=i.firstBaseUpdate,i!==null){do{var S={eventTime:i.eventTime,lane:i.lane,tag:i.tag,payload:i.payload,callback:i.callback,next:null};x===null?p=x=S:x=x.next=S,i=i.next}while(i!==null);x===null?p=x=r:x=x.next=r}else p=x=r;i={baseState:c.baseState,firstBaseUpdate:p,lastBaseUpdate:x,shared:c.shared,effects:c.effects},t.updateQueue=i;return}t=i.lastBaseUpdate,t===null?i.firstBaseUpdate=r:t.next=r,i.lastBaseUpdate=r}function To(t,r,i,c){var p=t.updateQueue;aa=!1;var x=p.firstBaseUpdate,S=p.lastBaseUpdate,_=p.shared.pending;if(_!==null){p.shared.pending=null;var B=_,re=B.next;B.next=null,S===null?x=re:S.next=re,S=B;var fe=t.alternate;fe!==null&&(fe=fe.updateQueue,_=fe.lastBaseUpdate,_!==S&&(_===null?fe.firstBaseUpdate=re:_.next=re,fe.lastBaseUpdate=B))}if(x!==null){var he=p.baseState;S=0,fe=re=B=null,_=x;do{var de=_.lane,ke=_.eventTime;if((c&de)===de){fe!==null&&(fe=fe.next={eventTime:ke,lane:0,tag:_.tag,payload:_.payload,callback:_.callback,next:null});e:{var Ne=t,Pe=_;switch(de=r,ke=i,Pe.tag){case 1:if(Ne=Pe.payload,typeof Ne=="function"){he=Ne.call(ke,he,de);break e}he=Ne;break e;case 3:Ne.flags=Ne.flags&-65537|128;case 0:if(Ne=Pe.payload,de=typeof Ne=="function"?Ne.call(ke,he,de):Ne,de==null)break e;he=q({},he,de);break e;case 2:aa=!0}}_.callback!==null&&_.lane!==0&&(t.flags|=64,de=p.effects,de===null?p.effects=[_]:de.push(_))}else ke={eventTime:ke,lane:de,tag:_.tag,payload:_.payload,callback:_.callback,next:null},fe===null?(re=fe=ke,B=he):fe=fe.next=ke,S|=de;if(_=_.next,_===null){if(_=p.shared.pending,_===null)break;de=_,_=de.next,de.next=null,p.lastBaseUpdate=de,p.shared.pending=null}}while(!0);if(fe===null&&(B=he),p.baseState=B,p.firstBaseUpdate=re,p.lastBaseUpdate=fe,r=p.shared.interleaved,r!==null){p=r;do S|=p.lane,p=p.next;while(p!==r)}else x===null&&(p.shared.lanes=0);_a|=S,t.lanes=S,t.memoizedState=he}}function Zh(t,r,i){if(t=r.effects,r.effects=null,t!==null)for(r=0;r<t.length;r++){var c=t[r],p=c.callback;if(p!==null){if(c.callback=null,c=i,typeof p!="function")throw Error(a(191,p));p.call(c)}}}var oi={},wr=ta(oi),li=ta(oi),ci=ta(oi);function Ma(t){if(t===oi)throw Error(a(174));return t}function Kc(t,r){switch(wt(ci,r),wt(li,t),wt(wr,oi),t=r.nodeType,t){case 9:case 11:r=(r=r.documentElement)?r.namespaceURI:ht(null,"");break;default:t=t===8?r.parentNode:r,r=t.namespaceURI||null,t=t.tagName,r=ht(r,t)}Ct(wr),wt(wr,r)}function ps(){Ct(wr),Ct(li),Ct(ci)}function ep(t){Ma(ci.current);var r=Ma(wr.current),i=ht(r,t.type);r!==i&&(wt(li,t),wt(wr,i))}function Yc(t){li.current===t&&(Ct(wr),Ct(li))}var Rt=ta(0);function Po(t){for(var r=t;r!==null;){if(r.tag===13){var i=r.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||i.data==="$?"||i.data==="$!"))return r}else if(r.tag===19&&r.memoizedProps.revealOrder!==void 0){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var Gc=[];function Xc(){for(var t=0;t<Gc.length;t++)Gc[t]._workInProgressVersionPrimary=null;Gc.length=0}var Ro=U.ReactCurrentDispatcher,Jc=U.ReactCurrentBatchConfig,Ia=0,Mt=null,Kt=null,Xt=null,Mo=!1,ui=!1,di=0,W2=0;function un(){throw Error(a(321))}function qc(t,r){if(r===null)return!1;for(var i=0;i<r.length&&i<t.length;i++)if(!ar(t[i],r[i]))return!1;return!0}function Qc(t,r,i,c,p,x){if(Ia=x,Mt=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,Ro.current=t===null||t.memoizedState===null?X2:J2,t=i(c,p),ui){x=0;do{if(ui=!1,di=0,25<=x)throw Error(a(301));x+=1,Xt=Kt=null,r.updateQueue=null,Ro.current=q2,t=i(c,p)}while(ui)}if(Ro.current=Fo,r=Kt!==null&&Kt.next!==null,Ia=0,Xt=Kt=Mt=null,Mo=!1,r)throw Error(a(300));return t}function Zc(){var t=di!==0;return di=0,t}function kr(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Xt===null?Mt.memoizedState=Xt=t:Xt=Xt.next=t,Xt}function Wn(){if(Kt===null){var t=Mt.alternate;t=t!==null?t.memoizedState:null}else t=Kt.next;var r=Xt===null?Mt.memoizedState:Xt.next;if(r!==null)Xt=r,Kt=t;else{if(t===null)throw Error(a(310));Kt=t,t={memoizedState:Kt.memoizedState,baseState:Kt.baseState,baseQueue:Kt.baseQueue,queue:Kt.queue,next:null},Xt===null?Mt.memoizedState=Xt=t:Xt=Xt.next=t}return Xt}function fi(t,r){return typeof r=="function"?r(t):r}function eu(t){var r=Wn(),i=r.queue;if(i===null)throw Error(a(311));i.lastRenderedReducer=t;var c=Kt,p=c.baseQueue,x=i.pending;if(x!==null){if(p!==null){var S=p.next;p.next=x.next,x.next=S}c.baseQueue=p=x,i.pending=null}if(p!==null){x=p.next,c=c.baseState;var _=S=null,B=null,re=x;do{var fe=re.lane;if((Ia&fe)===fe)B!==null&&(B=B.next={lane:0,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null}),c=re.hasEagerState?re.eagerState:t(c,re.action);else{var he={lane:fe,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null};B===null?(_=B=he,S=c):B=B.next=he,Mt.lanes|=fe,_a|=fe}re=re.next}while(re!==null&&re!==x);B===null?S=c:B.next=_,ar(c,r.memoizedState)||(Nn=!0),r.memoizedState=c,r.baseState=S,r.baseQueue=B,i.lastRenderedState=c}if(t=i.interleaved,t!==null){p=t;do x=p.lane,Mt.lanes|=x,_a|=x,p=p.next;while(p!==t)}else p===null&&(i.lanes=0);return[r.memoizedState,i.dispatch]}function tu(t){var r=Wn(),i=r.queue;if(i===null)throw Error(a(311));i.lastRenderedReducer=t;var c=i.dispatch,p=i.pending,x=r.memoizedState;if(p!==null){i.pending=null;var S=p=p.next;do x=t(x,S.action),S=S.next;while(S!==p);ar(x,r.memoizedState)||(Nn=!0),r.memoizedState=x,r.baseQueue===null&&(r.baseState=x),i.lastRenderedState=x}return[x,c]}function tp(){}function np(t,r){var i=Mt,c=Wn(),p=r(),x=!ar(c.memoizedState,p);if(x&&(c.memoizedState=p,Nn=!0),c=c.queue,nu(sp.bind(null,i,c,t),[t]),c.getSnapshot!==r||x||Xt!==null&&Xt.memoizedState.tag&1){if(i.flags|=2048,hi(9,ap.bind(null,i,c,p,r),void 0,null),Jt===null)throw Error(a(349));(Ia&30)!==0||rp(i,r,p)}return p}function rp(t,r,i){t.flags|=16384,t={getSnapshot:r,value:i},r=Mt.updateQueue,r===null?(r={lastEffect:null,stores:null},Mt.updateQueue=r,r.stores=[t]):(i=r.stores,i===null?r.stores=[t]:i.push(t))}function ap(t,r,i,c){r.value=i,r.getSnapshot=c,ip(r)&&op(t)}function sp(t,r,i){return i(function(){ip(r)&&op(t)})}function ip(t){var r=t.getSnapshot;t=t.value;try{var i=r();return!ar(t,i)}catch{return!0}}function op(t){var r=Vr(t,1);r!==null&&cr(r,t,1,-1)}function lp(t){var r=kr();return typeof t=="function"&&(t=t()),r.memoizedState=r.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:fi,lastRenderedState:t},r.queue=t,t=t.dispatch=G2.bind(null,Mt,t),[r.memoizedState,t]}function hi(t,r,i,c){return t={tag:t,create:r,destroy:i,deps:c,next:null},r=Mt.updateQueue,r===null?(r={lastEffect:null,stores:null},Mt.updateQueue=r,r.lastEffect=t.next=t):(i=r.lastEffect,i===null?r.lastEffect=t.next=t:(c=i.next,i.next=t,t.next=c,r.lastEffect=t)),t}function cp(){return Wn().memoizedState}function Io(t,r,i,c){var p=kr();Mt.flags|=t,p.memoizedState=hi(1|r,i,void 0,c===void 0?null:c)}function _o(t,r,i,c){var p=Wn();c=c===void 0?null:c;var x=void 0;if(Kt!==null){var S=Kt.memoizedState;if(x=S.destroy,c!==null&&qc(c,S.deps)){p.memoizedState=hi(r,i,x,c);return}}Mt.flags|=t,p.memoizedState=hi(1|r,i,x,c)}function up(t,r){return Io(8390656,8,t,r)}function nu(t,r){return _o(2048,8,t,r)}function dp(t,r){return _o(4,2,t,r)}function fp(t,r){return _o(4,4,t,r)}function hp(t,r){if(typeof r=="function")return t=t(),r(t),function(){r(null)};if(r!=null)return t=t(),r.current=t,function(){r.current=null}}function pp(t,r,i){return i=i!=null?i.concat([t]):null,_o(4,4,hp.bind(null,r,t),i)}function ru(){}function mp(t,r){var i=Wn();r=r===void 0?null:r;var c=i.memoizedState;return c!==null&&r!==null&&qc(r,c[1])?c[0]:(i.memoizedState=[t,r],t)}function gp(t,r){var i=Wn();r=r===void 0?null:r;var c=i.memoizedState;return c!==null&&r!==null&&qc(r,c[1])?c[0]:(t=t(),i.memoizedState=[t,r],t)}function yp(t,r,i){return(Ia&21)===0?(t.baseState&&(t.baseState=!1,Nn=!0),t.memoizedState=i):(ar(i,r)||(i=eo(),Mt.lanes|=i,_a|=i,t.baseState=!0),r)}function K2(t,r){var i=mt;mt=i!==0&&4>i?i:4,t(!0);var c=Jc.transition;Jc.transition={};try{t(!1),r()}finally{mt=i,Jc.transition=c}}function xp(){return Wn().memoizedState}function Y2(t,r,i){var c=ca(t);if(i={lane:c,action:i,hasEagerState:!1,eagerState:null,next:null},vp(t))bp(r,i);else if(i=Jh(t,r,i,c),i!==null){var p=xn();cr(i,t,c,p),wp(i,r,c)}}function G2(t,r,i){var c=ca(t),p={lane:c,action:i,hasEagerState:!1,eagerState:null,next:null};if(vp(t))bp(r,p);else{var x=t.alternate;if(t.lanes===0&&(x===null||x.lanes===0)&&(x=r.lastRenderedReducer,x!==null))try{var S=r.lastRenderedState,_=x(S,i);if(p.hasEagerState=!0,p.eagerState=_,ar(_,S)){var B=r.interleaved;B===null?(p.next=p,Hc(r)):(p.next=B.next,B.next=p),r.interleaved=p;return}}catch{}finally{}i=Jh(t,r,p,c),i!==null&&(p=xn(),cr(i,t,c,p),wp(i,r,c))}}function vp(t){var r=t.alternate;return t===Mt||r!==null&&r===Mt}function bp(t,r){ui=Mo=!0;var i=t.pending;i===null?r.next=r:(r.next=i.next,i.next=r),t.pending=r}function wp(t,r,i){if((i&4194240)!==0){var c=r.lanes;c&=t.pendingLanes,i|=c,r.lanes=i,sc(t,i)}}var Fo={readContext:Hn,useCallback:un,useContext:un,useEffect:un,useImperativeHandle:un,useInsertionEffect:un,useLayoutEffect:un,useMemo:un,useReducer:un,useRef:un,useState:un,useDebugValue:un,useDeferredValue:un,useTransition:un,useMutableSource:un,useSyncExternalStore:un,useId:un,unstable_isNewReconciler:!1},X2={readContext:Hn,useCallback:function(t,r){return kr().memoizedState=[t,r===void 0?null:r],t},useContext:Hn,useEffect:up,useImperativeHandle:function(t,r,i){return i=i!=null?i.concat([t]):null,Io(4194308,4,hp.bind(null,r,t),i)},useLayoutEffect:function(t,r){return Io(4194308,4,t,r)},useInsertionEffect:function(t,r){return Io(4,2,t,r)},useMemo:function(t,r){var i=kr();return r=r===void 0?null:r,t=t(),i.memoizedState=[t,r],t},useReducer:function(t,r,i){var c=kr();return r=i!==void 0?i(r):r,c.memoizedState=c.baseState=r,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:r},c.queue=t,t=t.dispatch=Y2.bind(null,Mt,t),[c.memoizedState,t]},useRef:function(t){var r=kr();return t={current:t},r.memoizedState=t},useState:lp,useDebugValue:ru,useDeferredValue:function(t){return kr().memoizedState=t},useTransition:function(){var t=lp(!1),r=t[0];return t=K2.bind(null,t[1]),kr().memoizedState=t,[r,t]},useMutableSource:function(){},useSyncExternalStore:function(t,r,i){var c=Mt,p=kr();if(Tt){if(i===void 0)throw Error(a(407));i=i()}else{if(i=r(),Jt===null)throw Error(a(349));(Ia&30)!==0||rp(c,r,i)}p.memoizedState=i;var x={value:i,getSnapshot:r};return p.queue=x,up(sp.bind(null,c,x,t),[t]),c.flags|=2048,hi(9,ap.bind(null,c,x,i,r),void 0,null),i},useId:function(){var t=kr(),r=Jt.identifierPrefix;if(Tt){var i=zr,c=Br;i=(c&~(1<<32-on(c)-1)).toString(32)+i,r=":"+r+"R"+i,i=di++,0<i&&(r+="H"+i.toString(32)),r+=":"}else i=W2++,r=":"+r+"r"+i.toString(32)+":";return t.memoizedState=r},unstable_isNewReconciler:!1},J2={readContext:Hn,useCallback:mp,useContext:Hn,useEffect:nu,useImperativeHandle:pp,useInsertionEffect:dp,useLayoutEffect:fp,useMemo:gp,useReducer:eu,useRef:cp,useState:function(){return eu(fi)},useDebugValue:ru,useDeferredValue:function(t){var r=Wn();return yp(r,Kt.memoizedState,t)},useTransition:function(){var t=eu(fi)[0],r=Wn().memoizedState;return[t,r]},useMutableSource:tp,useSyncExternalStore:np,useId:xp,unstable_isNewReconciler:!1},q2={readContext:Hn,useCallback:mp,useContext:Hn,useEffect:nu,useImperativeHandle:pp,useInsertionEffect:dp,useLayoutEffect:fp,useMemo:gp,useReducer:tu,useRef:cp,useState:function(){return tu(fi)},useDebugValue:ru,useDeferredValue:function(t){var r=Wn();return Kt===null?r.memoizedState=t:yp(r,Kt.memoizedState,t)},useTransition:function(){var t=tu(fi)[0],r=Wn().memoizedState;return[t,r]},useMutableSource:tp,useSyncExternalStore:np,useId:xp,unstable_isNewReconciler:!1};function ir(t,r){if(t&&t.defaultProps){r=q({},r),t=t.defaultProps;for(var i in t)r[i]===void 0&&(r[i]=t[i]);return r}return r}function au(t,r,i,c){r=t.memoizedState,i=i(c,r),i=i==null?r:q({},r,i),t.memoizedState=i,t.lanes===0&&(t.updateQueue.baseState=i)}var Do={isMounted:function(t){return(t=t._reactInternals)?ye(t)===t:!1},enqueueSetState:function(t,r,i){t=t._reactInternals;var c=xn(),p=ca(t),x=Ur(c,p);x.payload=r,i!=null&&(x.callback=i),r=sa(t,x,p),r!==null&&(cr(r,t,p,c),Eo(r,t,p))},enqueueReplaceState:function(t,r,i){t=t._reactInternals;var c=xn(),p=ca(t),x=Ur(c,p);x.tag=1,x.payload=r,i!=null&&(x.callback=i),r=sa(t,x,p),r!==null&&(cr(r,t,p,c),Eo(r,t,p))},enqueueForceUpdate:function(t,r){t=t._reactInternals;var i=xn(),c=ca(t),p=Ur(i,c);p.tag=2,r!=null&&(p.callback=r),r=sa(t,p,c),r!==null&&(cr(r,t,c,i),Eo(r,t,c))}};function kp(t,r,i,c,p,x,S){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(c,x,S):r.prototype&&r.prototype.isPureReactComponent?!Zs(i,c)||!Zs(p,x):!0}function Sp(t,r,i){var c=!1,p=na,x=r.contextType;return typeof x=="object"&&x!==null?x=Hn(x):(p=Cn(r)?Ea:cn.current,c=r.contextTypes,x=(c=c!=null)?os(t,p):na),r=new r(i,x),t.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,r.updater=Do,t.stateNode=r,r._reactInternals=t,c&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=p,t.__reactInternalMemoizedMaskedChildContext=x),r}function jp(t,r,i,c){t=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(i,c),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(i,c),r.state!==t&&Do.enqueueReplaceState(r,r.state,null)}function su(t,r,i,c){var p=t.stateNode;p.props=i,p.state=t.memoizedState,p.refs={},Wc(t);var x=r.contextType;typeof x=="object"&&x!==null?p.context=Hn(x):(x=Cn(r)?Ea:cn.current,p.context=os(t,x)),p.state=t.memoizedState,x=r.getDerivedStateFromProps,typeof x=="function"&&(au(t,r,x,i),p.state=t.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(r=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),r!==p.state&&Do.enqueueReplaceState(p,p.state,null),To(t,i,p,c),p.state=t.memoizedState),typeof p.componentDidMount=="function"&&(t.flags|=4194308)}function ms(t,r){try{var i="",c=r;do i+=oe(c),c=c.return;while(c);var p=i}catch(x){p=`
Error generating stack: `+x.message+`
`+x.stack}return{value:t,source:r,stack:p,digest:null}}function iu(t,r,i){return{value:t,source:null,stack:i??null,digest:r??null}}function ou(t,r){try{console.error(r.value)}catch(i){setTimeout(function(){throw i})}}var Q2=typeof WeakMap=="function"?WeakMap:Map;function Cp(t,r,i){i=Ur(-1,i),i.tag=3,i.payload={element:null};var c=r.value;return i.callback=function(){Uo||(Uo=!0,ku=c),ou(t,r)},i}function Np(t,r,i){i=Ur(-1,i),i.tag=3;var c=t.type.getDerivedStateFromError;if(typeof c=="function"){var p=r.value;i.payload=function(){return c(p)},i.callback=function(){ou(t,r)}}var x=t.stateNode;return x!==null&&typeof x.componentDidCatch=="function"&&(i.callback=function(){ou(t,r),typeof c!="function"&&(oa===null?oa=new Set([this]):oa.add(this));var S=r.stack;this.componentDidCatch(r.value,{componentStack:S!==null?S:""})}),i}function Ep(t,r,i){var c=t.pingCache;if(c===null){c=t.pingCache=new Q2;var p=new Set;c.set(r,p)}else p=c.get(r),p===void 0&&(p=new Set,c.set(r,p));p.has(i)||(p.add(i),t=fv.bind(null,t,r,i),r.then(t,t))}function Tp(t){do{var r;if((r=t.tag===13)&&(r=t.memoizedState,r=r!==null?r.dehydrated!==null:!0),r)return t;t=t.return}while(t!==null);return null}function Pp(t,r,i,c,p){return(t.mode&1)===0?(t===r?t.flags|=65536:(t.flags|=128,i.flags|=131072,i.flags&=-52805,i.tag===1&&(i.alternate===null?i.tag=17:(r=Ur(-1,1),r.tag=2,sa(i,r,1))),i.lanes|=1),t):(t.flags|=65536,t.lanes=p,t)}var Z2=U.ReactCurrentOwner,Nn=!1;function yn(t,r,i,c){r.child=t===null?Xh(r,null,i,c):ds(r,t.child,i,c)}function Rp(t,r,i,c,p){i=i.render;var x=r.ref;return hs(r,p),c=Qc(t,r,i,c,x,p),i=Zc(),t!==null&&!Nn?(r.updateQueue=t.updateQueue,r.flags&=-2053,t.lanes&=~p,$r(t,r,p)):(Tt&&i&&Dc(r),r.flags|=1,yn(t,r,c,p),r.child)}function Mp(t,r,i,c,p){if(t===null){var x=i.type;return typeof x=="function"&&!Pu(x)&&x.defaultProps===void 0&&i.compare===null&&i.defaultProps===void 0?(r.tag=15,r.type=x,Ip(t,r,x,c,p)):(t=Go(i.type,null,c,r,r.mode,p),t.ref=r.ref,t.return=r,r.child=t)}if(x=t.child,(t.lanes&p)===0){var S=x.memoizedProps;if(i=i.compare,i=i!==null?i:Zs,i(S,c)&&t.ref===r.ref)return $r(t,r,p)}return r.flags|=1,t=da(x,c),t.ref=r.ref,t.return=r,r.child=t}function Ip(t,r,i,c,p){if(t!==null){var x=t.memoizedProps;if(Zs(x,c)&&t.ref===r.ref)if(Nn=!1,r.pendingProps=c=x,(t.lanes&p)!==0)(t.flags&131072)!==0&&(Nn=!0);else return r.lanes=t.lanes,$r(t,r,p)}return lu(t,r,i,c,p)}function _p(t,r,i){var c=r.pendingProps,p=c.children,x=t!==null?t.memoizedState:null;if(c.mode==="hidden")if((r.mode&1)===0)r.memoizedState={baseLanes:0,cachePool:null,transitions:null},wt(ys,An),An|=i;else{if((i&1073741824)===0)return t=x!==null?x.baseLanes|i:i,r.lanes=r.childLanes=1073741824,r.memoizedState={baseLanes:t,cachePool:null,transitions:null},r.updateQueue=null,wt(ys,An),An|=t,null;r.memoizedState={baseLanes:0,cachePool:null,transitions:null},c=x!==null?x.baseLanes:i,wt(ys,An),An|=c}else x!==null?(c=x.baseLanes|i,r.memoizedState=null):c=i,wt(ys,An),An|=c;return yn(t,r,p,i),r.child}function Fp(t,r){var i=r.ref;(t===null&&i!==null||t!==null&&t.ref!==i)&&(r.flags|=512,r.flags|=2097152)}function lu(t,r,i,c,p){var x=Cn(i)?Ea:cn.current;return x=os(r,x),hs(r,p),i=Qc(t,r,i,c,x,p),c=Zc(),t!==null&&!Nn?(r.updateQueue=t.updateQueue,r.flags&=-2053,t.lanes&=~p,$r(t,r,p)):(Tt&&c&&Dc(r),r.flags|=1,yn(t,r,i,p),r.child)}function Dp(t,r,i,c,p){if(Cn(i)){var x=!0;vo(r)}else x=!1;if(hs(r,p),r.stateNode===null)Ao(t,r),Sp(r,i,c),su(r,i,c,p),c=!0;else if(t===null){var S=r.stateNode,_=r.memoizedProps;S.props=_;var B=S.context,re=i.contextType;typeof re=="object"&&re!==null?re=Hn(re):(re=Cn(i)?Ea:cn.current,re=os(r,re));var fe=i.getDerivedStateFromProps,he=typeof fe=="function"||typeof S.getSnapshotBeforeUpdate=="function";he||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(_!==c||B!==re)&&jp(r,S,c,re),aa=!1;var de=r.memoizedState;S.state=de,To(r,c,S,p),B=r.memoizedState,_!==c||de!==B||jn.current||aa?(typeof fe=="function"&&(au(r,i,fe,c),B=r.memoizedState),(_=aa||kp(r,i,_,c,de,B,re))?(he||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount()),typeof S.componentDidMount=="function"&&(r.flags|=4194308)):(typeof S.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=c,r.memoizedState=B),S.props=c,S.state=B,S.context=re,c=_):(typeof S.componentDidMount=="function"&&(r.flags|=4194308),c=!1)}else{S=r.stateNode,qh(t,r),_=r.memoizedProps,re=r.type===r.elementType?_:ir(r.type,_),S.props=re,he=r.pendingProps,de=S.context,B=i.contextType,typeof B=="object"&&B!==null?B=Hn(B):(B=Cn(i)?Ea:cn.current,B=os(r,B));var ke=i.getDerivedStateFromProps;(fe=typeof ke=="function"||typeof S.getSnapshotBeforeUpdate=="function")||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(_!==he||de!==B)&&jp(r,S,c,B),aa=!1,de=r.memoizedState,S.state=de,To(r,c,S,p);var Ne=r.memoizedState;_!==he||de!==Ne||jn.current||aa?(typeof ke=="function"&&(au(r,i,ke,c),Ne=r.memoizedState),(re=aa||kp(r,i,re,c,de,Ne,B)||!1)?(fe||typeof S.UNSAFE_componentWillUpdate!="function"&&typeof S.componentWillUpdate!="function"||(typeof S.componentWillUpdate=="function"&&S.componentWillUpdate(c,Ne,B),typeof S.UNSAFE_componentWillUpdate=="function"&&S.UNSAFE_componentWillUpdate(c,Ne,B)),typeof S.componentDidUpdate=="function"&&(r.flags|=4),typeof S.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof S.componentDidUpdate!="function"||_===t.memoizedProps&&de===t.memoizedState||(r.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||_===t.memoizedProps&&de===t.memoizedState||(r.flags|=1024),r.memoizedProps=c,r.memoizedState=Ne),S.props=c,S.state=Ne,S.context=B,c=re):(typeof S.componentDidUpdate!="function"||_===t.memoizedProps&&de===t.memoizedState||(r.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||_===t.memoizedProps&&de===t.memoizedState||(r.flags|=1024),c=!1)}return cu(t,r,i,c,x,p)}function cu(t,r,i,c,p,x){Fp(t,r);var S=(r.flags&128)!==0;if(!c&&!S)return p&&zh(r,i,!1),$r(t,r,x);c=r.stateNode,Z2.current=r;var _=S&&typeof i.getDerivedStateFromError!="function"?null:c.render();return r.flags|=1,t!==null&&S?(r.child=ds(r,t.child,null,x),r.child=ds(r,null,_,x)):yn(t,r,_,x),r.memoizedState=c.state,p&&zh(r,i,!0),r.child}function Lp(t){var r=t.stateNode;r.pendingContext?Oh(t,r.pendingContext,r.pendingContext!==r.context):r.context&&Oh(t,r.context,!1),Kc(t,r.containerInfo)}function Ap(t,r,i,c,p){return us(),Bc(p),r.flags|=256,yn(t,r,i,c),r.child}var uu={dehydrated:null,treeContext:null,retryLane:0};function du(t){return{baseLanes:t,cachePool:null,transitions:null}}function Op(t,r,i){var c=r.pendingProps,p=Rt.current,x=!1,S=(r.flags&128)!==0,_;if((_=S)||(_=t!==null&&t.memoizedState===null?!1:(p&2)!==0),_?(x=!0,r.flags&=-129):(t===null||t.memoizedState!==null)&&(p|=1),wt(Rt,p&1),t===null)return Oc(r),t=r.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?((r.mode&1)===0?r.lanes=1:t.data==="$!"?r.lanes=8:r.lanes=1073741824,null):(S=c.children,t=c.fallback,x?(c=r.mode,x=r.child,S={mode:"hidden",children:S},(c&1)===0&&x!==null?(x.childLanes=0,x.pendingProps=S):x=Xo(S,c,0,null),t=Aa(t,c,i,null),x.return=r,t.return=r,x.sibling=t,r.child=x,r.child.memoizedState=du(i),r.memoizedState=uu,t):fu(r,S));if(p=t.memoizedState,p!==null&&(_=p.dehydrated,_!==null))return ev(t,r,S,c,_,p,i);if(x){x=c.fallback,S=r.mode,p=t.child,_=p.sibling;var B={mode:"hidden",children:c.children};return(S&1)===0&&r.child!==p?(c=r.child,c.childLanes=0,c.pendingProps=B,r.deletions=null):(c=da(p,B),c.subtreeFlags=p.subtreeFlags&14680064),_!==null?x=da(_,x):(x=Aa(x,S,i,null),x.flags|=2),x.return=r,c.return=r,c.sibling=x,r.child=c,c=x,x=r.child,S=t.child.memoizedState,S=S===null?du(i):{baseLanes:S.baseLanes|i,cachePool:null,transitions:S.transitions},x.memoizedState=S,x.childLanes=t.childLanes&~i,r.memoizedState=uu,c}return x=t.child,t=x.sibling,c=da(x,{mode:"visible",children:c.children}),(r.mode&1)===0&&(c.lanes=i),c.return=r,c.sibling=null,t!==null&&(i=r.deletions,i===null?(r.deletions=[t],r.flags|=16):i.push(t)),r.child=c,r.memoizedState=null,c}function fu(t,r){return r=Xo({mode:"visible",children:r},t.mode,0,null),r.return=t,t.child=r}function Lo(t,r,i,c){return c!==null&&Bc(c),ds(r,t.child,null,i),t=fu(r,r.pendingProps.children),t.flags|=2,r.memoizedState=null,t}function ev(t,r,i,c,p,x,S){if(i)return r.flags&256?(r.flags&=-257,c=iu(Error(a(422))),Lo(t,r,S,c)):r.memoizedState!==null?(r.child=t.child,r.flags|=128,null):(x=c.fallback,p=r.mode,c=Xo({mode:"visible",children:c.children},p,0,null),x=Aa(x,p,S,null),x.flags|=2,c.return=r,x.return=r,c.sibling=x,r.child=c,(r.mode&1)!==0&&ds(r,t.child,null,S),r.child.memoizedState=du(S),r.memoizedState=uu,x);if((r.mode&1)===0)return Lo(t,r,S,null);if(p.data==="$!"){if(c=p.nextSibling&&p.nextSibling.dataset,c)var _=c.dgst;return c=_,x=Error(a(419)),c=iu(x,c,void 0),Lo(t,r,S,c)}if(_=(S&t.childLanes)!==0,Nn||_){if(c=Jt,c!==null){switch(S&-S){case 4:p=2;break;case 16:p=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:p=32;break;case 536870912:p=268435456;break;default:p=0}p=(p&(c.suspendedLanes|S))!==0?0:p,p!==0&&p!==x.retryLane&&(x.retryLane=p,Vr(t,p),cr(c,t,p,-1))}return Tu(),c=iu(Error(a(421))),Lo(t,r,S,c)}return p.data==="$?"?(r.flags|=128,r.child=t.child,r=hv.bind(null,t),p._reactRetry=r,null):(t=x.treeContext,Ln=ea(p.nextSibling),Dn=r,Tt=!0,sr=null,t!==null&&(Un[$n++]=Br,Un[$n++]=zr,Un[$n++]=Ta,Br=t.id,zr=t.overflow,Ta=r),r=fu(r,c.children),r.flags|=4096,r)}function Bp(t,r,i){t.lanes|=r;var c=t.alternate;c!==null&&(c.lanes|=r),$c(t.return,r,i)}function hu(t,r,i,c,p){var x=t.memoizedState;x===null?t.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:c,tail:i,tailMode:p}:(x.isBackwards=r,x.rendering=null,x.renderingStartTime=0,x.last=c,x.tail=i,x.tailMode=p)}function zp(t,r,i){var c=r.pendingProps,p=c.revealOrder,x=c.tail;if(yn(t,r,c.children,i),c=Rt.current,(c&2)!==0)c=c&1|2,r.flags|=128;else{if(t!==null&&(t.flags&128)!==0)e:for(t=r.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Bp(t,i,r);else if(t.tag===19)Bp(t,i,r);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===r)break e;for(;t.sibling===null;){if(t.return===null||t.return===r)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}c&=1}if(wt(Rt,c),(r.mode&1)===0)r.memoizedState=null;else switch(p){case"forwards":for(i=r.child,p=null;i!==null;)t=i.alternate,t!==null&&Po(t)===null&&(p=i),i=i.sibling;i=p,i===null?(p=r.child,r.child=null):(p=i.sibling,i.sibling=null),hu(r,!1,p,i,x);break;case"backwards":for(i=null,p=r.child,r.child=null;p!==null;){if(t=p.alternate,t!==null&&Po(t)===null){r.child=p;break}t=p.sibling,p.sibling=i,i=p,p=t}hu(r,!0,i,null,x);break;case"together":hu(r,!1,null,null,void 0);break;default:r.memoizedState=null}return r.child}function Ao(t,r){(r.mode&1)===0&&t!==null&&(t.alternate=null,r.alternate=null,r.flags|=2)}function $r(t,r,i){if(t!==null&&(r.dependencies=t.dependencies),_a|=r.lanes,(i&r.childLanes)===0)return null;if(t!==null&&r.child!==t.child)throw Error(a(153));if(r.child!==null){for(t=r.child,i=da(t,t.pendingProps),r.child=i,i.return=r;t.sibling!==null;)t=t.sibling,i=i.sibling=da(t,t.pendingProps),i.return=r;i.sibling=null}return r.child}function tv(t,r,i){switch(r.tag){case 3:Lp(r),us();break;case 5:ep(r);break;case 1:Cn(r.type)&&vo(r);break;case 4:Kc(r,r.stateNode.containerInfo);break;case 10:var c=r.type._context,p=r.memoizedProps.value;wt(Co,c._currentValue),c._currentValue=p;break;case 13:if(c=r.memoizedState,c!==null)return c.dehydrated!==null?(wt(Rt,Rt.current&1),r.flags|=128,null):(i&r.child.childLanes)!==0?Op(t,r,i):(wt(Rt,Rt.current&1),t=$r(t,r,i),t!==null?t.sibling:null);wt(Rt,Rt.current&1);break;case 19:if(c=(i&r.childLanes)!==0,(t.flags&128)!==0){if(c)return zp(t,r,i);r.flags|=128}if(p=r.memoizedState,p!==null&&(p.rendering=null,p.tail=null,p.lastEffect=null),wt(Rt,Rt.current),c)break;return null;case 22:case 23:return r.lanes=0,_p(t,r,i)}return $r(t,r,i)}var Vp,pu,Up,$p;Vp=function(t,r){for(var i=r.child;i!==null;){if(i.tag===5||i.tag===6)t.appendChild(i.stateNode);else if(i.tag!==4&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break;for(;i.sibling===null;){if(i.return===null||i.return===r)return;i=i.return}i.sibling.return=i.return,i=i.sibling}},pu=function(){},Up=function(t,r,i,c){var p=t.memoizedProps;if(p!==c){t=r.stateNode,Ma(wr.current);var x=null;switch(i){case"input":p=dt(t,p),c=dt(t,c),x=[];break;case"select":p=q({},p,{value:void 0}),c=q({},c,{value:void 0}),x=[];break;case"textarea":p=be(t,p),c=be(t,c),x=[];break;default:typeof p.onClick!="function"&&typeof c.onClick=="function"&&(t.onclick=go)}ot(i,c);var S;i=null;for(re in p)if(!c.hasOwnProperty(re)&&p.hasOwnProperty(re)&&p[re]!=null)if(re==="style"){var _=p[re];for(S in _)_.hasOwnProperty(S)&&(i||(i={}),i[S]="")}else re!=="dangerouslySetInnerHTML"&&re!=="children"&&re!=="suppressContentEditableWarning"&&re!=="suppressHydrationWarning"&&re!=="autoFocus"&&(o.hasOwnProperty(re)?x||(x=[]):(x=x||[]).push(re,null));for(re in c){var B=c[re];if(_=p!=null?p[re]:void 0,c.hasOwnProperty(re)&&B!==_&&(B!=null||_!=null))if(re==="style")if(_){for(S in _)!_.hasOwnProperty(S)||B&&B.hasOwnProperty(S)||(i||(i={}),i[S]="");for(S in B)B.hasOwnProperty(S)&&_[S]!==B[S]&&(i||(i={}),i[S]=B[S])}else i||(x||(x=[]),x.push(re,i)),i=B;else re==="dangerouslySetInnerHTML"?(B=B?B.__html:void 0,_=_?_.__html:void 0,B!=null&&_!==B&&(x=x||[]).push(re,B)):re==="children"?typeof B!="string"&&typeof B!="number"||(x=x||[]).push(re,""+B):re!=="suppressContentEditableWarning"&&re!=="suppressHydrationWarning"&&(o.hasOwnProperty(re)?(B!=null&&re==="onScroll"&&jt("scroll",t),x||_===B||(x=[])):(x=x||[]).push(re,B))}i&&(x=x||[]).push("style",i);var re=x;(r.updateQueue=re)&&(r.flags|=4)}},$p=function(t,r,i,c){i!==c&&(r.flags|=4)};function pi(t,r){if(!Tt)switch(t.tailMode){case"hidden":r=t.tail;for(var i=null;r!==null;)r.alternate!==null&&(i=r),r=r.sibling;i===null?t.tail=null:i.sibling=null;break;case"collapsed":i=t.tail;for(var c=null;i!==null;)i.alternate!==null&&(c=i),i=i.sibling;c===null?r||t.tail===null?t.tail=null:t.tail.sibling=null:c.sibling=null}}function dn(t){var r=t.alternate!==null&&t.alternate.child===t.child,i=0,c=0;if(r)for(var p=t.child;p!==null;)i|=p.lanes|p.childLanes,c|=p.subtreeFlags&14680064,c|=p.flags&14680064,p.return=t,p=p.sibling;else for(p=t.child;p!==null;)i|=p.lanes|p.childLanes,c|=p.subtreeFlags,c|=p.flags,p.return=t,p=p.sibling;return t.subtreeFlags|=c,t.childLanes=i,r}function nv(t,r,i){var c=r.pendingProps;switch(Lc(r),r.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return dn(r),null;case 1:return Cn(r.type)&&xo(),dn(r),null;case 3:return c=r.stateNode,ps(),Ct(jn),Ct(cn),Xc(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(t===null||t.child===null)&&(So(r)?r.flags|=4:t===null||t.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,sr!==null&&(Cu(sr),sr=null))),pu(t,r),dn(r),null;case 5:Yc(r);var p=Ma(ci.current);if(i=r.type,t!==null&&r.stateNode!=null)Up(t,r,i,c,p),t.ref!==r.ref&&(r.flags|=512,r.flags|=2097152);else{if(!c){if(r.stateNode===null)throw Error(a(166));return dn(r),null}if(t=Ma(wr.current),So(r)){c=r.stateNode,i=r.type;var x=r.memoizedProps;switch(c[br]=r,c[ai]=x,t=(r.mode&1)!==0,i){case"dialog":jt("cancel",c),jt("close",c);break;case"iframe":case"object":case"embed":jt("load",c);break;case"video":case"audio":for(p=0;p<ti.length;p++)jt(ti[p],c);break;case"source":jt("error",c);break;case"img":case"image":case"link":jt("error",c),jt("load",c);break;case"details":jt("toggle",c);break;case"input":xt(c,x),jt("invalid",c);break;case"select":c._wrapperState={wasMultiple:!!x.multiple},jt("invalid",c);break;case"textarea":Ae(c,x),jt("invalid",c)}ot(i,x),p=null;for(var S in x)if(x.hasOwnProperty(S)){var _=x[S];S==="children"?typeof _=="string"?c.textContent!==_&&(x.suppressHydrationWarning!==!0&&mo(c.textContent,_,t),p=["children",_]):typeof _=="number"&&c.textContent!==""+_&&(x.suppressHydrationWarning!==!0&&mo(c.textContent,_,t),p=["children",""+_]):o.hasOwnProperty(S)&&_!=null&&S==="onScroll"&&jt("scroll",c)}switch(i){case"input":Ce(c),Re(c,x,!0);break;case"textarea":Ce(c),Ge(c);break;case"select":case"option":break;default:typeof x.onClick=="function"&&(c.onclick=go)}c=p,r.updateQueue=c,c!==null&&(r.flags|=4)}else{S=p.nodeType===9?p:p.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=rt(i)),t==="http://www.w3.org/1999/xhtml"?i==="script"?(t=S.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof c.is=="string"?t=S.createElement(i,{is:c.is}):(t=S.createElement(i),i==="select"&&(S=t,c.multiple?S.multiple=!0:c.size&&(S.size=c.size))):t=S.createElementNS(t,i),t[br]=r,t[ai]=c,Vp(t,r,!1,!1),r.stateNode=t;e:{switch(S=it(i,c),i){case"dialog":jt("cancel",t),jt("close",t),p=c;break;case"iframe":case"object":case"embed":jt("load",t),p=c;break;case"video":case"audio":for(p=0;p<ti.length;p++)jt(ti[p],t);p=c;break;case"source":jt("error",t),p=c;break;case"img":case"image":case"link":jt("error",t),jt("load",t),p=c;break;case"details":jt("toggle",t),p=c;break;case"input":xt(t,c),p=dt(t,c),jt("invalid",t);break;case"option":p=c;break;case"select":t._wrapperState={wasMultiple:!!c.multiple},p=q({},c,{value:void 0}),jt("invalid",t);break;case"textarea":Ae(t,c),p=be(t,c),jt("invalid",t);break;default:p=c}ot(i,p),_=p;for(x in _)if(_.hasOwnProperty(x)){var B=_[x];x==="style"?Te(t,B):x==="dangerouslySetInnerHTML"?(B=B?B.__html:void 0,B!=null&&Pt(t,B)):x==="children"?typeof B=="string"?(i!=="textarea"||B!=="")&&qe(t,B):typeof B=="number"&&qe(t,""+B):x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&x!=="autoFocus"&&(o.hasOwnProperty(x)?B!=null&&x==="onScroll"&&jt("scroll",t):B!=null&&F(t,x,B,S))}switch(i){case"input":Ce(t),Re(t,c,!1);break;case"textarea":Ce(t),Ge(t);break;case"option":c.value!=null&&t.setAttribute("value",""+xe(c.value));break;case"select":t.multiple=!!c.multiple,x=c.value,x!=null?Ie(t,!!c.multiple,x,!1):c.defaultValue!=null&&Ie(t,!!c.multiple,c.defaultValue,!0);break;default:typeof p.onClick=="function"&&(t.onclick=go)}switch(i){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}}c&&(r.flags|=4)}r.ref!==null&&(r.flags|=512,r.flags|=2097152)}return dn(r),null;case 6:if(t&&r.stateNode!=null)$p(t,r,t.memoizedProps,c);else{if(typeof c!="string"&&r.stateNode===null)throw Error(a(166));if(i=Ma(ci.current),Ma(wr.current),So(r)){if(c=r.stateNode,i=r.memoizedProps,c[br]=r,(x=c.nodeValue!==i)&&(t=Dn,t!==null))switch(t.tag){case 3:mo(c.nodeValue,i,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&mo(c.nodeValue,i,(t.mode&1)!==0)}x&&(r.flags|=4)}else c=(i.nodeType===9?i:i.ownerDocument).createTextNode(c),c[br]=r,r.stateNode=c}return dn(r),null;case 13:if(Ct(Rt),c=r.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(Tt&&Ln!==null&&(r.mode&1)!==0&&(r.flags&128)===0)Kh(),us(),r.flags|=98560,x=!1;else if(x=So(r),c!==null&&c.dehydrated!==null){if(t===null){if(!x)throw Error(a(318));if(x=r.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(a(317));x[br]=r}else us(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;dn(r),x=!1}else sr!==null&&(Cu(sr),sr=null),x=!0;if(!x)return r.flags&65536?r:null}return(r.flags&128)!==0?(r.lanes=i,r):(c=c!==null,c!==(t!==null&&t.memoizedState!==null)&&c&&(r.child.flags|=8192,(r.mode&1)!==0&&(t===null||(Rt.current&1)!==0?Yt===0&&(Yt=3):Tu())),r.updateQueue!==null&&(r.flags|=4),dn(r),null);case 4:return ps(),pu(t,r),t===null&&ni(r.stateNode.containerInfo),dn(r),null;case 10:return Uc(r.type._context),dn(r),null;case 17:return Cn(r.type)&&xo(),dn(r),null;case 19:if(Ct(Rt),x=r.memoizedState,x===null)return dn(r),null;if(c=(r.flags&128)!==0,S=x.rendering,S===null)if(c)pi(x,!1);else{if(Yt!==0||t!==null&&(t.flags&128)!==0)for(t=r.child;t!==null;){if(S=Po(t),S!==null){for(r.flags|=128,pi(x,!1),c=S.updateQueue,c!==null&&(r.updateQueue=c,r.flags|=4),r.subtreeFlags=0,c=i,i=r.child;i!==null;)x=i,t=c,x.flags&=14680066,S=x.alternate,S===null?(x.childLanes=0,x.lanes=t,x.child=null,x.subtreeFlags=0,x.memoizedProps=null,x.memoizedState=null,x.updateQueue=null,x.dependencies=null,x.stateNode=null):(x.childLanes=S.childLanes,x.lanes=S.lanes,x.child=S.child,x.subtreeFlags=0,x.deletions=null,x.memoizedProps=S.memoizedProps,x.memoizedState=S.memoizedState,x.updateQueue=S.updateQueue,x.type=S.type,t=S.dependencies,x.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),i=i.sibling;return wt(Rt,Rt.current&1|2),r.child}t=t.sibling}x.tail!==null&&at()>xs&&(r.flags|=128,c=!0,pi(x,!1),r.lanes=4194304)}else{if(!c)if(t=Po(S),t!==null){if(r.flags|=128,c=!0,i=t.updateQueue,i!==null&&(r.updateQueue=i,r.flags|=4),pi(x,!0),x.tail===null&&x.tailMode==="hidden"&&!S.alternate&&!Tt)return dn(r),null}else 2*at()-x.renderingStartTime>xs&&i!==1073741824&&(r.flags|=128,c=!0,pi(x,!1),r.lanes=4194304);x.isBackwards?(S.sibling=r.child,r.child=S):(i=x.last,i!==null?i.sibling=S:r.child=S,x.last=S)}return x.tail!==null?(r=x.tail,x.rendering=r,x.tail=r.sibling,x.renderingStartTime=at(),r.sibling=null,i=Rt.current,wt(Rt,c?i&1|2:i&1),r):(dn(r),null);case 22:case 23:return Eu(),c=r.memoizedState!==null,t!==null&&t.memoizedState!==null!==c&&(r.flags|=8192),c&&(r.mode&1)!==0?(An&1073741824)!==0&&(dn(r),r.subtreeFlags&6&&(r.flags|=8192)):dn(r),null;case 24:return null;case 25:return null}throw Error(a(156,r.tag))}function rv(t,r){switch(Lc(r),r.tag){case 1:return Cn(r.type)&&xo(),t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 3:return ps(),Ct(jn),Ct(cn),Xc(),t=r.flags,(t&65536)!==0&&(t&128)===0?(r.flags=t&-65537|128,r):null;case 5:return Yc(r),null;case 13:if(Ct(Rt),t=r.memoizedState,t!==null&&t.dehydrated!==null){if(r.alternate===null)throw Error(a(340));us()}return t=r.flags,t&65536?(r.flags=t&-65537|128,r):null;case 19:return Ct(Rt),null;case 4:return ps(),null;case 10:return Uc(r.type._context),null;case 22:case 23:return Eu(),null;case 24:return null;default:return null}}var Oo=!1,fn=!1,av=typeof WeakSet=="function"?WeakSet:Set,je=null;function gs(t,r){var i=t.ref;if(i!==null)if(typeof i=="function")try{i(null)}catch(c){It(t,r,c)}else i.current=null}function mu(t,r,i){try{i()}catch(c){It(t,r,c)}}var Hp=!1;function sv(t,r){if(Ec=ro,t=kh(),vc(t)){if("selectionStart"in t)var i={start:t.selectionStart,end:t.selectionEnd};else e:{i=(i=t.ownerDocument)&&i.defaultView||window;var c=i.getSelection&&i.getSelection();if(c&&c.rangeCount!==0){i=c.anchorNode;var p=c.anchorOffset,x=c.focusNode;c=c.focusOffset;try{i.nodeType,x.nodeType}catch{i=null;break e}var S=0,_=-1,B=-1,re=0,fe=0,he=t,de=null;t:for(;;){for(var ke;he!==i||p!==0&&he.nodeType!==3||(_=S+p),he!==x||c!==0&&he.nodeType!==3||(B=S+c),he.nodeType===3&&(S+=he.nodeValue.length),(ke=he.firstChild)!==null;)de=he,he=ke;for(;;){if(he===t)break t;if(de===i&&++re===p&&(_=S),de===x&&++fe===c&&(B=S),(ke=he.nextSibling)!==null)break;he=de,de=he.parentNode}he=ke}i=_===-1||B===-1?null:{start:_,end:B}}else i=null}i=i||{start:0,end:0}}else i=null;for(Tc={focusedElem:t,selectionRange:i},ro=!1,je=r;je!==null;)if(r=je,t=r.child,(r.subtreeFlags&1028)!==0&&t!==null)t.return=r,je=t;else for(;je!==null;){r=je;try{var Ne=r.alternate;if((r.flags&1024)!==0)switch(r.tag){case 0:case 11:case 15:break;case 1:if(Ne!==null){var Pe=Ne.memoizedProps,Bt=Ne.memoizedState,Z=r.stateNode,H=Z.getSnapshotBeforeUpdate(r.elementType===r.type?Pe:ir(r.type,Pe),Bt);Z.__reactInternalSnapshotBeforeUpdate=H}break;case 3:var te=r.stateNode.containerInfo;te.nodeType===1?te.textContent="":te.nodeType===9&&te.documentElement&&te.removeChild(te.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(a(163))}}catch(pe){It(r,r.return,pe)}if(t=r.sibling,t!==null){t.return=r.return,je=t;break}je=r.return}return Ne=Hp,Hp=!1,Ne}function mi(t,r,i){var c=r.updateQueue;if(c=c!==null?c.lastEffect:null,c!==null){var p=c=c.next;do{if((p.tag&t)===t){var x=p.destroy;p.destroy=void 0,x!==void 0&&mu(r,i,x)}p=p.next}while(p!==c)}}function Bo(t,r){if(r=r.updateQueue,r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var c=i.create;i.destroy=c()}i=i.next}while(i!==r)}}function gu(t){var r=t.ref;if(r!==null){var i=t.stateNode;switch(t.tag){case 5:t=i;break;default:t=i}typeof r=="function"?r(t):r.current=t}}function Wp(t){var r=t.alternate;r!==null&&(t.alternate=null,Wp(r)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(r=t.stateNode,r!==null&&(delete r[br],delete r[ai],delete r[Ic],delete r[V2],delete r[U2])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Kp(t){return t.tag===5||t.tag===3||t.tag===4}function Yp(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Kp(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function yu(t,r,i){var c=t.tag;if(c===5||c===6)t=t.stateNode,r?i.nodeType===8?i.parentNode.insertBefore(t,r):i.insertBefore(t,r):(i.nodeType===8?(r=i.parentNode,r.insertBefore(t,i)):(r=i,r.appendChild(t)),i=i._reactRootContainer,i!=null||r.onclick!==null||(r.onclick=go));else if(c!==4&&(t=t.child,t!==null))for(yu(t,r,i),t=t.sibling;t!==null;)yu(t,r,i),t=t.sibling}function xu(t,r,i){var c=t.tag;if(c===5||c===6)t=t.stateNode,r?i.insertBefore(t,r):i.appendChild(t);else if(c!==4&&(t=t.child,t!==null))for(xu(t,r,i),t=t.sibling;t!==null;)xu(t,r,i),t=t.sibling}var en=null,or=!1;function ia(t,r,i){for(i=i.child;i!==null;)Gp(t,r,i),i=i.sibling}function Gp(t,r,i){if(Wt&&typeof Wt.onCommitFiberUnmount=="function")try{Wt.onCommitFiberUnmount(Wr,i)}catch{}switch(i.tag){case 5:fn||gs(i,r);case 6:var c=en,p=or;en=null,ia(t,r,i),en=c,or=p,en!==null&&(or?(t=en,i=i.stateNode,t.nodeType===8?t.parentNode.removeChild(i):t.removeChild(i)):en.removeChild(i.stateNode));break;case 18:en!==null&&(or?(t=en,i=i.stateNode,t.nodeType===8?Mc(t.parentNode,i):t.nodeType===1&&Mc(t,i),Ys(t)):Mc(en,i.stateNode));break;case 4:c=en,p=or,en=i.stateNode.containerInfo,or=!0,ia(t,r,i),en=c,or=p;break;case 0:case 11:case 14:case 15:if(!fn&&(c=i.updateQueue,c!==null&&(c=c.lastEffect,c!==null))){p=c=c.next;do{var x=p,S=x.destroy;x=x.tag,S!==void 0&&((x&2)!==0||(x&4)!==0)&&mu(i,r,S),p=p.next}while(p!==c)}ia(t,r,i);break;case 1:if(!fn&&(gs(i,r),c=i.stateNode,typeof c.componentWillUnmount=="function"))try{c.props=i.memoizedProps,c.state=i.memoizedState,c.componentWillUnmount()}catch(_){It(i,r,_)}ia(t,r,i);break;case 21:ia(t,r,i);break;case 22:i.mode&1?(fn=(c=fn)||i.memoizedState!==null,ia(t,r,i),fn=c):ia(t,r,i);break;default:ia(t,r,i)}}function Xp(t){var r=t.updateQueue;if(r!==null){t.updateQueue=null;var i=t.stateNode;i===null&&(i=t.stateNode=new av),r.forEach(function(c){var p=pv.bind(null,t,c);i.has(c)||(i.add(c),c.then(p,p))})}}function lr(t,r){var i=r.deletions;if(i!==null)for(var c=0;c<i.length;c++){var p=i[c];try{var x=t,S=r,_=S;e:for(;_!==null;){switch(_.tag){case 5:en=_.stateNode,or=!1;break e;case 3:en=_.stateNode.containerInfo,or=!0;break e;case 4:en=_.stateNode.containerInfo,or=!0;break e}_=_.return}if(en===null)throw Error(a(160));Gp(x,S,p),en=null,or=!1;var B=p.alternate;B!==null&&(B.return=null),p.return=null}catch(re){It(p,r,re)}}if(r.subtreeFlags&12854)for(r=r.child;r!==null;)Jp(r,t),r=r.sibling}function Jp(t,r){var i=t.alternate,c=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(lr(r,t),Sr(t),c&4){try{mi(3,t,t.return),Bo(3,t)}catch(Pe){It(t,t.return,Pe)}try{mi(5,t,t.return)}catch(Pe){It(t,t.return,Pe)}}break;case 1:lr(r,t),Sr(t),c&512&&i!==null&&gs(i,i.return);break;case 5:if(lr(r,t),Sr(t),c&512&&i!==null&&gs(i,i.return),t.flags&32){var p=t.stateNode;try{qe(p,"")}catch(Pe){It(t,t.return,Pe)}}if(c&4&&(p=t.stateNode,p!=null)){var x=t.memoizedProps,S=i!==null?i.memoizedProps:x,_=t.type,B=t.updateQueue;if(t.updateQueue=null,B!==null)try{_==="input"&&x.type==="radio"&&x.name!=null&&vt(p,x),it(_,S);var re=it(_,x);for(S=0;S<B.length;S+=2){var fe=B[S],he=B[S+1];fe==="style"?Te(p,he):fe==="dangerouslySetInnerHTML"?Pt(p,he):fe==="children"?qe(p,he):F(p,fe,he,re)}switch(_){case"input":Se(p,x);break;case"textarea":Qe(p,x);break;case"select":var de=p._wrapperState.wasMultiple;p._wrapperState.wasMultiple=!!x.multiple;var ke=x.value;ke!=null?Ie(p,!!x.multiple,ke,!1):de!==!!x.multiple&&(x.defaultValue!=null?Ie(p,!!x.multiple,x.defaultValue,!0):Ie(p,!!x.multiple,x.multiple?[]:"",!1))}p[ai]=x}catch(Pe){It(t,t.return,Pe)}}break;case 6:if(lr(r,t),Sr(t),c&4){if(t.stateNode===null)throw Error(a(162));p=t.stateNode,x=t.memoizedProps;try{p.nodeValue=x}catch(Pe){It(t,t.return,Pe)}}break;case 3:if(lr(r,t),Sr(t),c&4&&i!==null&&i.memoizedState.isDehydrated)try{Ys(r.containerInfo)}catch(Pe){It(t,t.return,Pe)}break;case 4:lr(r,t),Sr(t);break;case 13:lr(r,t),Sr(t),p=t.child,p.flags&8192&&(x=p.memoizedState!==null,p.stateNode.isHidden=x,!x||p.alternate!==null&&p.alternate.memoizedState!==null||(wu=at())),c&4&&Xp(t);break;case 22:if(fe=i!==null&&i.memoizedState!==null,t.mode&1?(fn=(re=fn)||fe,lr(r,t),fn=re):lr(r,t),Sr(t),c&8192){if(re=t.memoizedState!==null,(t.stateNode.isHidden=re)&&!fe&&(t.mode&1)!==0)for(je=t,fe=t.child;fe!==null;){for(he=je=fe;je!==null;){switch(de=je,ke=de.child,de.tag){case 0:case 11:case 14:case 15:mi(4,de,de.return);break;case 1:gs(de,de.return);var Ne=de.stateNode;if(typeof Ne.componentWillUnmount=="function"){c=de,i=de.return;try{r=c,Ne.props=r.memoizedProps,Ne.state=r.memoizedState,Ne.componentWillUnmount()}catch(Pe){It(c,i,Pe)}}break;case 5:gs(de,de.return);break;case 22:if(de.memoizedState!==null){Zp(he);continue}}ke!==null?(ke.return=de,je=ke):Zp(he)}fe=fe.sibling}e:for(fe=null,he=t;;){if(he.tag===5){if(fe===null){fe=he;try{p=he.stateNode,re?(x=p.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none"):(_=he.stateNode,B=he.memoizedProps.style,S=B!=null&&B.hasOwnProperty("display")?B.display:null,_.style.display=Mn("display",S))}catch(Pe){It(t,t.return,Pe)}}}else if(he.tag===6){if(fe===null)try{he.stateNode.nodeValue=re?"":he.memoizedProps}catch(Pe){It(t,t.return,Pe)}}else if((he.tag!==22&&he.tag!==23||he.memoizedState===null||he===t)&&he.child!==null){he.child.return=he,he=he.child;continue}if(he===t)break e;for(;he.sibling===null;){if(he.return===null||he.return===t)break e;fe===he&&(fe=null),he=he.return}fe===he&&(fe=null),he.sibling.return=he.return,he=he.sibling}}break;case 19:lr(r,t),Sr(t),c&4&&Xp(t);break;case 21:break;default:lr(r,t),Sr(t)}}function Sr(t){var r=t.flags;if(r&2){try{e:{for(var i=t.return;i!==null;){if(Kp(i)){var c=i;break e}i=i.return}throw Error(a(160))}switch(c.tag){case 5:var p=c.stateNode;c.flags&32&&(qe(p,""),c.flags&=-33);var x=Yp(t);xu(t,x,p);break;case 3:case 4:var S=c.stateNode.containerInfo,_=Yp(t);yu(t,_,S);break;default:throw Error(a(161))}}catch(B){It(t,t.return,B)}t.flags&=-3}r&4096&&(t.flags&=-4097)}function iv(t,r,i){je=t,qp(t)}function qp(t,r,i){for(var c=(t.mode&1)!==0;je!==null;){var p=je,x=p.child;if(p.tag===22&&c){var S=p.memoizedState!==null||Oo;if(!S){var _=p.alternate,B=_!==null&&_.memoizedState!==null||fn;_=Oo;var re=fn;if(Oo=S,(fn=B)&&!re)for(je=p;je!==null;)S=je,B=S.child,S.tag===22&&S.memoizedState!==null?e0(p):B!==null?(B.return=S,je=B):e0(p);for(;x!==null;)je=x,qp(x),x=x.sibling;je=p,Oo=_,fn=re}Qp(t)}else(p.subtreeFlags&8772)!==0&&x!==null?(x.return=p,je=x):Qp(t)}}function Qp(t){for(;je!==null;){var r=je;if((r.flags&8772)!==0){var i=r.alternate;try{if((r.flags&8772)!==0)switch(r.tag){case 0:case 11:case 15:fn||Bo(5,r);break;case 1:var c=r.stateNode;if(r.flags&4&&!fn)if(i===null)c.componentDidMount();else{var p=r.elementType===r.type?i.memoizedProps:ir(r.type,i.memoizedProps);c.componentDidUpdate(p,i.memoizedState,c.__reactInternalSnapshotBeforeUpdate)}var x=r.updateQueue;x!==null&&Zh(r,x,c);break;case 3:var S=r.updateQueue;if(S!==null){if(i=null,r.child!==null)switch(r.child.tag){case 5:i=r.child.stateNode;break;case 1:i=r.child.stateNode}Zh(r,S,i)}break;case 5:var _=r.stateNode;if(i===null&&r.flags&4){i=_;var B=r.memoizedProps;switch(r.type){case"button":case"input":case"select":case"textarea":B.autoFocus&&i.focus();break;case"img":B.src&&(i.src=B.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(r.memoizedState===null){var re=r.alternate;if(re!==null){var fe=re.memoizedState;if(fe!==null){var he=fe.dehydrated;he!==null&&Ys(he)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(a(163))}fn||r.flags&512&&gu(r)}catch(de){It(r,r.return,de)}}if(r===t){je=null;break}if(i=r.sibling,i!==null){i.return=r.return,je=i;break}je=r.return}}function Zp(t){for(;je!==null;){var r=je;if(r===t){je=null;break}var i=r.sibling;if(i!==null){i.return=r.return,je=i;break}je=r.return}}function e0(t){for(;je!==null;){var r=je;try{switch(r.tag){case 0:case 11:case 15:var i=r.return;try{Bo(4,r)}catch(B){It(r,i,B)}break;case 1:var c=r.stateNode;if(typeof c.componentDidMount=="function"){var p=r.return;try{c.componentDidMount()}catch(B){It(r,p,B)}}var x=r.return;try{gu(r)}catch(B){It(r,x,B)}break;case 5:var S=r.return;try{gu(r)}catch(B){It(r,S,B)}}}catch(B){It(r,r.return,B)}if(r===t){je=null;break}var _=r.sibling;if(_!==null){_.return=r.return,je=_;break}je=r.return}}var ov=Math.ceil,zo=U.ReactCurrentDispatcher,vu=U.ReactCurrentOwner,Kn=U.ReactCurrentBatchConfig,lt=0,Jt=null,zt=null,tn=0,An=0,ys=ta(0),Yt=0,gi=null,_a=0,Vo=0,bu=0,yi=null,En=null,wu=0,xs=1/0,Hr=null,Uo=!1,ku=null,oa=null,$o=!1,la=null,Ho=0,xi=0,Su=null,Wo=-1,Ko=0;function xn(){return(lt&6)!==0?at():Wo!==-1?Wo:Wo=at()}function ca(t){return(t.mode&1)===0?1:(lt&2)!==0&&tn!==0?tn&-tn:H2.transition!==null?(Ko===0&&(Ko=eo()),Ko):(t=mt,t!==0||(t=window.event,t=t===void 0?16:nh(t.type)),t)}function cr(t,r,i,c){if(50<xi)throw xi=0,Su=null,Error(a(185));Us(t,i,c),((lt&2)===0||t!==Jt)&&(t===Jt&&((lt&2)===0&&(Vo|=i),Yt===4&&ua(t,tn)),Tn(t,c),i===1&&lt===0&&(r.mode&1)===0&&(xs=at()+500,bo&&ra()))}function Tn(t,r){var i=t.callbackNode;Lr(t,r);var c=Yr(t,t===Jt?tn:0);if(c===0)i!==null&&Ot(i),t.callbackNode=null,t.callbackPriority=0;else if(r=c&-c,t.callbackPriority!==r){if(i!=null&&Ot(i),r===1)t.tag===0?$2(n0.bind(null,t)):Vh(n0.bind(null,t)),B2(function(){(lt&6)===0&&ra()}),i=null;else{switch(Gf(c)){case 1:i=Dr;break;case 4:i=nr;break;case 16:i=rr;break;case 536870912:i=_n;break;default:i=rr}i=u0(i,t0.bind(null,t))}t.callbackPriority=r,t.callbackNode=i}}function t0(t,r){if(Wo=-1,Ko=0,(lt&6)!==0)throw Error(a(327));var i=t.callbackNode;if(vs()&&t.callbackNode!==i)return null;var c=Yr(t,t===Jt?tn:0);if(c===0)return null;if((c&30)!==0||(c&t.expiredLanes)!==0||r)r=Yo(t,c);else{r=c;var p=lt;lt|=2;var x=a0();(Jt!==t||tn!==r)&&(Hr=null,xs=at()+500,Da(t,r));do try{uv();break}catch(_){r0(t,_)}while(!0);Vc(),zo.current=x,lt=p,zt!==null?r=0:(Jt=null,tn=0,r=Yt)}if(r!==0){if(r===2&&(p=qa(t),p!==0&&(c=p,r=ju(t,p))),r===1)throw i=gi,Da(t,0),ua(t,c),Tn(t,at()),i;if(r===6)ua(t,c);else{if(p=t.current.alternate,(c&30)===0&&!lv(p)&&(r=Yo(t,c),r===2&&(x=qa(t),x!==0&&(c=x,r=ju(t,x))),r===1))throw i=gi,Da(t,0),ua(t,c),Tn(t,at()),i;switch(t.finishedWork=p,t.finishedLanes=c,r){case 0:case 1:throw Error(a(345));case 2:La(t,En,Hr);break;case 3:if(ua(t,c),(c&130023424)===c&&(r=wu+500-at(),10<r)){if(Yr(t,0)!==0)break;if(p=t.suspendedLanes,(p&c)!==c){xn(),t.pingedLanes|=t.suspendedLanes&p;break}t.timeoutHandle=Rc(La.bind(null,t,En,Hr),r);break}La(t,En,Hr);break;case 4:if(ua(t,c),(c&4194240)===c)break;for(r=t.eventTimes,p=-1;0<c;){var S=31-on(c);x=1<<S,S=r[S],S>p&&(p=S),c&=~x}if(c=p,c=at()-c,c=(120>c?120:480>c?480:1080>c?1080:1920>c?1920:3e3>c?3e3:4320>c?4320:1960*ov(c/1960))-c,10<c){t.timeoutHandle=Rc(La.bind(null,t,En,Hr),c);break}La(t,En,Hr);break;case 5:La(t,En,Hr);break;default:throw Error(a(329))}}}return Tn(t,at()),t.callbackNode===i?t0.bind(null,t):null}function ju(t,r){var i=yi;return t.current.memoizedState.isDehydrated&&(Da(t,r).flags|=256),t=Yo(t,r),t!==2&&(r=En,En=i,r!==null&&Cu(r)),t}function Cu(t){En===null?En=t:En.push.apply(En,t)}function lv(t){for(var r=t;;){if(r.flags&16384){var i=r.updateQueue;if(i!==null&&(i=i.stores,i!==null))for(var c=0;c<i.length;c++){var p=i[c],x=p.getSnapshot;p=p.value;try{if(!ar(x(),p))return!1}catch{return!1}}}if(i=r.child,r.subtreeFlags&16384&&i!==null)i.return=r,r=i;else{if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function ua(t,r){for(r&=~bu,r&=~Vo,t.suspendedLanes|=r,t.pingedLanes&=~r,t=t.expirationTimes;0<r;){var i=31-on(r),c=1<<i;t[i]=-1,r&=~c}}function n0(t){if((lt&6)!==0)throw Error(a(327));vs();var r=Yr(t,0);if((r&1)===0)return Tn(t,at()),null;var i=Yo(t,r);if(t.tag!==0&&i===2){var c=qa(t);c!==0&&(r=c,i=ju(t,c))}if(i===1)throw i=gi,Da(t,0),ua(t,r),Tn(t,at()),i;if(i===6)throw Error(a(345));return t.finishedWork=t.current.alternate,t.finishedLanes=r,La(t,En,Hr),Tn(t,at()),null}function Nu(t,r){var i=lt;lt|=1;try{return t(r)}finally{lt=i,lt===0&&(xs=at()+500,bo&&ra())}}function Fa(t){la!==null&&la.tag===0&&(lt&6)===0&&vs();var r=lt;lt|=1;var i=Kn.transition,c=mt;try{if(Kn.transition=null,mt=1,t)return t()}finally{mt=c,Kn.transition=i,lt=r,(lt&6)===0&&ra()}}function Eu(){An=ys.current,Ct(ys)}function Da(t,r){t.finishedWork=null,t.finishedLanes=0;var i=t.timeoutHandle;if(i!==-1&&(t.timeoutHandle=-1,O2(i)),zt!==null)for(i=zt.return;i!==null;){var c=i;switch(Lc(c),c.tag){case 1:c=c.type.childContextTypes,c!=null&&xo();break;case 3:ps(),Ct(jn),Ct(cn),Xc();break;case 5:Yc(c);break;case 4:ps();break;case 13:Ct(Rt);break;case 19:Ct(Rt);break;case 10:Uc(c.type._context);break;case 22:case 23:Eu()}i=i.return}if(Jt=t,zt=t=da(t.current,null),tn=An=r,Yt=0,gi=null,bu=Vo=_a=0,En=yi=null,Ra!==null){for(r=0;r<Ra.length;r++)if(i=Ra[r],c=i.interleaved,c!==null){i.interleaved=null;var p=c.next,x=i.pending;if(x!==null){var S=x.next;x.next=p,c.next=S}i.pending=c}Ra=null}return t}function r0(t,r){do{var i=zt;try{if(Vc(),Ro.current=Fo,Mo){for(var c=Mt.memoizedState;c!==null;){var p=c.queue;p!==null&&(p.pending=null),c=c.next}Mo=!1}if(Ia=0,Xt=Kt=Mt=null,ui=!1,di=0,vu.current=null,i===null||i.return===null){Yt=1,gi=r,zt=null;break}e:{var x=t,S=i.return,_=i,B=r;if(r=tn,_.flags|=32768,B!==null&&typeof B=="object"&&typeof B.then=="function"){var re=B,fe=_,he=fe.tag;if((fe.mode&1)===0&&(he===0||he===11||he===15)){var de=fe.alternate;de?(fe.updateQueue=de.updateQueue,fe.memoizedState=de.memoizedState,fe.lanes=de.lanes):(fe.updateQueue=null,fe.memoizedState=null)}var ke=Tp(S);if(ke!==null){ke.flags&=-257,Pp(ke,S,_,x,r),ke.mode&1&&Ep(x,re,r),r=ke,B=re;var Ne=r.updateQueue;if(Ne===null){var Pe=new Set;Pe.add(B),r.updateQueue=Pe}else Ne.add(B);break e}else{if((r&1)===0){Ep(x,re,r),Tu();break e}B=Error(a(426))}}else if(Tt&&_.mode&1){var Bt=Tp(S);if(Bt!==null){(Bt.flags&65536)===0&&(Bt.flags|=256),Pp(Bt,S,_,x,r),Bc(ms(B,_));break e}}x=B=ms(B,_),Yt!==4&&(Yt=2),yi===null?yi=[x]:yi.push(x),x=S;do{switch(x.tag){case 3:x.flags|=65536,r&=-r,x.lanes|=r;var Z=Cp(x,B,r);Qh(x,Z);break e;case 1:_=B;var H=x.type,te=x.stateNode;if((x.flags&128)===0&&(typeof H.getDerivedStateFromError=="function"||te!==null&&typeof te.componentDidCatch=="function"&&(oa===null||!oa.has(te)))){x.flags|=65536,r&=-r,x.lanes|=r;var pe=Np(x,_,r);Qh(x,pe);break e}}x=x.return}while(x!==null)}i0(i)}catch(Me){r=Me,zt===i&&i!==null&&(zt=i=i.return);continue}break}while(!0)}function a0(){var t=zo.current;return zo.current=Fo,t===null?Fo:t}function Tu(){(Yt===0||Yt===3||Yt===2)&&(Yt=4),Jt===null||(_a&268435455)===0&&(Vo&268435455)===0||ua(Jt,tn)}function Yo(t,r){var i=lt;lt|=2;var c=a0();(Jt!==t||tn!==r)&&(Hr=null,Da(t,r));do try{cv();break}catch(p){r0(t,p)}while(!0);if(Vc(),lt=i,zo.current=c,zt!==null)throw Error(a(261));return Jt=null,tn=0,Yt}function cv(){for(;zt!==null;)s0(zt)}function uv(){for(;zt!==null&&!St();)s0(zt)}function s0(t){var r=c0(t.alternate,t,An);t.memoizedProps=t.pendingProps,r===null?i0(t):zt=r,vu.current=null}function i0(t){var r=t;do{var i=r.alternate;if(t=r.return,(r.flags&32768)===0){if(i=nv(i,r,An),i!==null){zt=i;return}}else{if(i=rv(i,r),i!==null){i.flags&=32767,zt=i;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Yt=6,zt=null;return}}if(r=r.sibling,r!==null){zt=r;return}zt=r=t}while(r!==null);Yt===0&&(Yt=5)}function La(t,r,i){var c=mt,p=Kn.transition;try{Kn.transition=null,mt=1,dv(t,r,i,c)}finally{Kn.transition=p,mt=c}return null}function dv(t,r,i,c){do vs();while(la!==null);if((lt&6)!==0)throw Error(a(327));i=t.finishedWork;var p=t.finishedLanes;if(i===null)return null;if(t.finishedWork=null,t.finishedLanes=0,i===t.current)throw Error(a(177));t.callbackNode=null,t.callbackPriority=0;var x=i.lanes|i.childLanes;if(Wx(t,x),t===Jt&&(zt=Jt=null,tn=0),(i.subtreeFlags&2064)===0&&(i.flags&2064)===0||$o||($o=!0,u0(rr,function(){return vs(),null})),x=(i.flags&15990)!==0,(i.subtreeFlags&15990)!==0||x){x=Kn.transition,Kn.transition=null;var S=mt;mt=1;var _=lt;lt|=4,vu.current=null,sv(t,i),Jp(i,t),M2(Tc),ro=!!Ec,Tc=Ec=null,t.current=i,iv(i),pt(),lt=_,mt=S,Kn.transition=x}else t.current=i;if($o&&($o=!1,la=t,Ho=p),x=t.pendingLanes,x===0&&(oa=null),Xa(i.stateNode),Tn(t,at()),r!==null)for(c=t.onRecoverableError,i=0;i<r.length;i++)p=r[i],c(p.value,{componentStack:p.stack,digest:p.digest});if(Uo)throw Uo=!1,t=ku,ku=null,t;return(Ho&1)!==0&&t.tag!==0&&vs(),x=t.pendingLanes,(x&1)!==0?t===Su?xi++:(xi=0,Su=t):xi=0,ra(),null}function vs(){if(la!==null){var t=Gf(Ho),r=Kn.transition,i=mt;try{if(Kn.transition=null,mt=16>t?16:t,la===null)var c=!1;else{if(t=la,la=null,Ho=0,(lt&6)!==0)throw Error(a(331));var p=lt;for(lt|=4,je=t.current;je!==null;){var x=je,S=x.child;if((je.flags&16)!==0){var _=x.deletions;if(_!==null){for(var B=0;B<_.length;B++){var re=_[B];for(je=re;je!==null;){var fe=je;switch(fe.tag){case 0:case 11:case 15:mi(8,fe,x)}var he=fe.child;if(he!==null)he.return=fe,je=he;else for(;je!==null;){fe=je;var de=fe.sibling,ke=fe.return;if(Wp(fe),fe===re){je=null;break}if(de!==null){de.return=ke,je=de;break}je=ke}}}var Ne=x.alternate;if(Ne!==null){var Pe=Ne.child;if(Pe!==null){Ne.child=null;do{var Bt=Pe.sibling;Pe.sibling=null,Pe=Bt}while(Pe!==null)}}je=x}}if((x.subtreeFlags&2064)!==0&&S!==null)S.return=x,je=S;else e:for(;je!==null;){if(x=je,(x.flags&2048)!==0)switch(x.tag){case 0:case 11:case 15:mi(9,x,x.return)}var Z=x.sibling;if(Z!==null){Z.return=x.return,je=Z;break e}je=x.return}}var H=t.current;for(je=H;je!==null;){S=je;var te=S.child;if((S.subtreeFlags&2064)!==0&&te!==null)te.return=S,je=te;else e:for(S=H;je!==null;){if(_=je,(_.flags&2048)!==0)try{switch(_.tag){case 0:case 11:case 15:Bo(9,_)}}catch(Me){It(_,_.return,Me)}if(_===S){je=null;break e}var pe=_.sibling;if(pe!==null){pe.return=_.return,je=pe;break e}je=_.return}}if(lt=p,ra(),Wt&&typeof Wt.onPostCommitFiberRoot=="function")try{Wt.onPostCommitFiberRoot(Wr,t)}catch{}c=!0}return c}finally{mt=i,Kn.transition=r}}return!1}function o0(t,r,i){r=ms(i,r),r=Cp(t,r,1),t=sa(t,r,1),r=xn(),t!==null&&(Us(t,1,r),Tn(t,r))}function It(t,r,i){if(t.tag===3)o0(t,t,i);else for(;r!==null;){if(r.tag===3){o0(r,t,i);break}else if(r.tag===1){var c=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(oa===null||!oa.has(c))){t=ms(i,t),t=Np(r,t,1),r=sa(r,t,1),t=xn(),r!==null&&(Us(r,1,t),Tn(r,t));break}}r=r.return}}function fv(t,r,i){var c=t.pingCache;c!==null&&c.delete(r),r=xn(),t.pingedLanes|=t.suspendedLanes&i,Jt===t&&(tn&i)===i&&(Yt===4||Yt===3&&(tn&130023424)===tn&&500>at()-wu?Da(t,0):bu|=i),Tn(t,r)}function l0(t,r){r===0&&((t.mode&1)===0?r=1:(r=Sn,Sn<<=1,(Sn&130023424)===0&&(Sn=4194304)));var i=xn();t=Vr(t,r),t!==null&&(Us(t,r,i),Tn(t,i))}function hv(t){var r=t.memoizedState,i=0;r!==null&&(i=r.retryLane),l0(t,i)}function pv(t,r){var i=0;switch(t.tag){case 13:var c=t.stateNode,p=t.memoizedState;p!==null&&(i=p.retryLane);break;case 19:c=t.stateNode;break;default:throw Error(a(314))}c!==null&&c.delete(r),l0(t,i)}var c0;c0=function(t,r,i){if(t!==null)if(t.memoizedProps!==r.pendingProps||jn.current)Nn=!0;else{if((t.lanes&i)===0&&(r.flags&128)===0)return Nn=!1,tv(t,r,i);Nn=(t.flags&131072)!==0}else Nn=!1,Tt&&(r.flags&1048576)!==0&&Uh(r,ko,r.index);switch(r.lanes=0,r.tag){case 2:var c=r.type;Ao(t,r),t=r.pendingProps;var p=os(r,cn.current);hs(r,i),p=Qc(null,r,c,t,p,i);var x=Zc();return r.flags|=1,typeof p=="object"&&p!==null&&typeof p.render=="function"&&p.$$typeof===void 0?(r.tag=1,r.memoizedState=null,r.updateQueue=null,Cn(c)?(x=!0,vo(r)):x=!1,r.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,Wc(r),p.updater=Do,r.stateNode=p,p._reactInternals=r,su(r,c,t,i),r=cu(null,r,c,!0,x,i)):(r.tag=0,Tt&&x&&Dc(r),yn(null,r,p,i),r=r.child),r;case 16:c=r.elementType;e:{switch(Ao(t,r),t=r.pendingProps,p=c._init,c=p(c._payload),r.type=c,p=r.tag=gv(c),t=ir(c,t),p){case 0:r=lu(null,r,c,t,i);break e;case 1:r=Dp(null,r,c,t,i);break e;case 11:r=Rp(null,r,c,t,i);break e;case 14:r=Mp(null,r,c,ir(c.type,t),i);break e}throw Error(a(306,c,""))}return r;case 0:return c=r.type,p=r.pendingProps,p=r.elementType===c?p:ir(c,p),lu(t,r,c,p,i);case 1:return c=r.type,p=r.pendingProps,p=r.elementType===c?p:ir(c,p),Dp(t,r,c,p,i);case 3:e:{if(Lp(r),t===null)throw Error(a(387));c=r.pendingProps,x=r.memoizedState,p=x.element,qh(t,r),To(r,c,null,i);var S=r.memoizedState;if(c=S.element,x.isDehydrated)if(x={element:c,isDehydrated:!1,cache:S.cache,pendingSuspenseBoundaries:S.pendingSuspenseBoundaries,transitions:S.transitions},r.updateQueue.baseState=x,r.memoizedState=x,r.flags&256){p=ms(Error(a(423)),r),r=Ap(t,r,c,i,p);break e}else if(c!==p){p=ms(Error(a(424)),r),r=Ap(t,r,c,i,p);break e}else for(Ln=ea(r.stateNode.containerInfo.firstChild),Dn=r,Tt=!0,sr=null,i=Xh(r,null,c,i),r.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(us(),c===p){r=$r(t,r,i);break e}yn(t,r,c,i)}r=r.child}return r;case 5:return ep(r),t===null&&Oc(r),c=r.type,p=r.pendingProps,x=t!==null?t.memoizedProps:null,S=p.children,Pc(c,p)?S=null:x!==null&&Pc(c,x)&&(r.flags|=32),Fp(t,r),yn(t,r,S,i),r.child;case 6:return t===null&&Oc(r),null;case 13:return Op(t,r,i);case 4:return Kc(r,r.stateNode.containerInfo),c=r.pendingProps,t===null?r.child=ds(r,null,c,i):yn(t,r,c,i),r.child;case 11:return c=r.type,p=r.pendingProps,p=r.elementType===c?p:ir(c,p),Rp(t,r,c,p,i);case 7:return yn(t,r,r.pendingProps,i),r.child;case 8:return yn(t,r,r.pendingProps.children,i),r.child;case 12:return yn(t,r,r.pendingProps.children,i),r.child;case 10:e:{if(c=r.type._context,p=r.pendingProps,x=r.memoizedProps,S=p.value,wt(Co,c._currentValue),c._currentValue=S,x!==null)if(ar(x.value,S)){if(x.children===p.children&&!jn.current){r=$r(t,r,i);break e}}else for(x=r.child,x!==null&&(x.return=r);x!==null;){var _=x.dependencies;if(_!==null){S=x.child;for(var B=_.firstContext;B!==null;){if(B.context===c){if(x.tag===1){B=Ur(-1,i&-i),B.tag=2;var re=x.updateQueue;if(re!==null){re=re.shared;var fe=re.pending;fe===null?B.next=B:(B.next=fe.next,fe.next=B),re.pending=B}}x.lanes|=i,B=x.alternate,B!==null&&(B.lanes|=i),$c(x.return,i,r),_.lanes|=i;break}B=B.next}}else if(x.tag===10)S=x.type===r.type?null:x.child;else if(x.tag===18){if(S=x.return,S===null)throw Error(a(341));S.lanes|=i,_=S.alternate,_!==null&&(_.lanes|=i),$c(S,i,r),S=x.sibling}else S=x.child;if(S!==null)S.return=x;else for(S=x;S!==null;){if(S===r){S=null;break}if(x=S.sibling,x!==null){x.return=S.return,S=x;break}S=S.return}x=S}yn(t,r,p.children,i),r=r.child}return r;case 9:return p=r.type,c=r.pendingProps.children,hs(r,i),p=Hn(p),c=c(p),r.flags|=1,yn(t,r,c,i),r.child;case 14:return c=r.type,p=ir(c,r.pendingProps),p=ir(c.type,p),Mp(t,r,c,p,i);case 15:return Ip(t,r,r.type,r.pendingProps,i);case 17:return c=r.type,p=r.pendingProps,p=r.elementType===c?p:ir(c,p),Ao(t,r),r.tag=1,Cn(c)?(t=!0,vo(r)):t=!1,hs(r,i),Sp(r,c,p),su(r,c,p,i),cu(null,r,c,!0,t,i);case 19:return zp(t,r,i);case 22:return _p(t,r,i)}throw Error(a(156,r.tag))};function u0(t,r){return ut(t,r)}function mv(t,r,i,c){this.tag=t,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Yn(t,r,i,c){return new mv(t,r,i,c)}function Pu(t){return t=t.prototype,!(!t||!t.isReactComponent)}function gv(t){if(typeof t=="function")return Pu(t)?1:0;if(t!=null){if(t=t.$$typeof,t===K)return 11;if(t===ee)return 14}return 2}function da(t,r){var i=t.alternate;return i===null?(i=Yn(t.tag,r,t.key,t.mode),i.elementType=t.elementType,i.type=t.type,i.stateNode=t.stateNode,i.alternate=t,t.alternate=i):(i.pendingProps=r,i.type=t.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=t.flags&14680064,i.childLanes=t.childLanes,i.lanes=t.lanes,i.child=t.child,i.memoizedProps=t.memoizedProps,i.memoizedState=t.memoizedState,i.updateQueue=t.updateQueue,r=t.dependencies,i.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},i.sibling=t.sibling,i.index=t.index,i.ref=t.ref,i}function Go(t,r,i,c,p,x){var S=2;if(c=t,typeof t=="function")Pu(t)&&(S=1);else if(typeof t=="string")S=5;else e:switch(t){case A:return Aa(i.children,p,x,r);case w:S=8,p|=8;break;case R:return t=Yn(12,i,r,p|2),t.elementType=R,t.lanes=x,t;case I:return t=Yn(13,i,r,p),t.elementType=I,t.lanes=x,t;case $:return t=Yn(19,i,r,p),t.elementType=$,t.lanes=x,t;case z:return Xo(i,p,x,r);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case E:S=10;break e;case Y:S=9;break e;case K:S=11;break e;case ee:S=14;break e;case G:S=16,c=null;break e}throw Error(a(130,t==null?t:typeof t,""))}return r=Yn(S,i,r,p),r.elementType=t,r.type=c,r.lanes=x,r}function Aa(t,r,i,c){return t=Yn(7,t,c,r),t.lanes=i,t}function Xo(t,r,i,c){return t=Yn(22,t,c,r),t.elementType=z,t.lanes=i,t.stateNode={isHidden:!1},t}function Ru(t,r,i){return t=Yn(6,t,null,r),t.lanes=i,t}function Mu(t,r,i){return r=Yn(4,t.children!==null?t.children:[],t.key,r),r.lanes=i,r.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},r}function yv(t,r,i,c,p){this.tag=r,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ac(0),this.expirationTimes=ac(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ac(0),this.identifierPrefix=c,this.onRecoverableError=p,this.mutableSourceEagerHydrationData=null}function Iu(t,r,i,c,p,x,S,_,B){return t=new yv(t,r,i,_,B),r===1?(r=1,x===!0&&(r|=8)):r=0,x=Yn(3,null,null,r),t.current=x,x.stateNode=t,x.memoizedState={element:c,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},Wc(x),t}function xv(t,r,i){var c=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:J,key:c==null?null:""+c,children:t,containerInfo:r,implementation:i}}function d0(t){if(!t)return na;t=t._reactInternals;e:{if(ye(t)!==t||t.tag!==1)throw Error(a(170));var r=t;do{switch(r.tag){case 3:r=r.stateNode.context;break e;case 1:if(Cn(r.type)){r=r.stateNode.__reactInternalMemoizedMergedChildContext;break e}}r=r.return}while(r!==null);throw Error(a(171))}if(t.tag===1){var i=t.type;if(Cn(i))return Bh(t,i,r)}return r}function f0(t,r,i,c,p,x,S,_,B){return t=Iu(i,c,!0,t,p,x,S,_,B),t.context=d0(null),i=t.current,c=xn(),p=ca(i),x=Ur(c,p),x.callback=r??null,sa(i,x,p),t.current.lanes=p,Us(t,p,c),Tn(t,c),t}function Jo(t,r,i,c){var p=r.current,x=xn(),S=ca(p);return i=d0(i),r.context===null?r.context=i:r.pendingContext=i,r=Ur(x,S),r.payload={element:t},c=c===void 0?null:c,c!==null&&(r.callback=c),t=sa(p,r,S),t!==null&&(cr(t,p,S,x),Eo(t,p,S)),S}function qo(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function h0(t,r){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var i=t.retryLane;t.retryLane=i!==0&&i<r?i:r}}function _u(t,r){h0(t,r),(t=t.alternate)&&h0(t,r)}function vv(){return null}var p0=typeof reportError=="function"?reportError:function(t){console.error(t)};function Fu(t){this._internalRoot=t}Qo.prototype.render=Fu.prototype.render=function(t){var r=this._internalRoot;if(r===null)throw Error(a(409));Jo(t,r,null,null)},Qo.prototype.unmount=Fu.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var r=t.containerInfo;Fa(function(){Jo(null,t,null,null)}),r[Ar]=null}};function Qo(t){this._internalRoot=t}Qo.prototype.unstable_scheduleHydration=function(t){if(t){var r=qf();t={blockedOn:null,target:t,priority:r};for(var i=0;i<qr.length&&r!==0&&r<qr[i].priority;i++);qr.splice(i,0,t),i===0&&eh(t)}};function Du(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Zo(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function m0(){}function bv(t,r,i,c,p){if(p){if(typeof c=="function"){var x=c;c=function(){var re=qo(S);x.call(re)}}var S=f0(r,c,t,0,null,!1,!1,"",m0);return t._reactRootContainer=S,t[Ar]=S.current,ni(t.nodeType===8?t.parentNode:t),Fa(),S}for(;p=t.lastChild;)t.removeChild(p);if(typeof c=="function"){var _=c;c=function(){var re=qo(B);_.call(re)}}var B=Iu(t,0,!1,null,null,!1,!1,"",m0);return t._reactRootContainer=B,t[Ar]=B.current,ni(t.nodeType===8?t.parentNode:t),Fa(function(){Jo(r,B,i,c)}),B}function el(t,r,i,c,p){var x=i._reactRootContainer;if(x){var S=x;if(typeof p=="function"){var _=p;p=function(){var B=qo(S);_.call(B)}}Jo(r,S,t,p)}else S=bv(i,r,t,p,c);return qo(S)}Xf=function(t){switch(t.tag){case 3:var r=t.stateNode;if(r.current.memoizedState.isDehydrated){var i=Kr(r.pendingLanes);i!==0&&(sc(r,i|1),Tn(r,at()),(lt&6)===0&&(xs=at()+500,ra()))}break;case 13:Fa(function(){var c=Vr(t,1);if(c!==null){var p=xn();cr(c,t,1,p)}}),_u(t,1)}},ic=function(t){if(t.tag===13){var r=Vr(t,134217728);if(r!==null){var i=xn();cr(r,t,134217728,i)}_u(t,134217728)}},Jf=function(t){if(t.tag===13){var r=ca(t),i=Vr(t,r);if(i!==null){var c=xn();cr(i,t,r,c)}_u(t,r)}},qf=function(){return mt},Qf=function(t,r){var i=mt;try{return mt=t,r()}finally{mt=i}},yr=function(t,r,i){switch(r){case"input":if(Se(t,i),r=i.name,i.type==="radio"&&r!=null){for(i=t;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll("input[name="+JSON.stringify(""+r)+'][type="radio"]'),r=0;r<i.length;r++){var c=i[r];if(c!==t&&c.form===t.form){var p=yo(c);if(!p)throw Error(a(90));Ue(c),Se(c,p)}}}break;case"textarea":Qe(t,i);break;case"select":r=i.value,r!=null&&Ie(t,!!i.multiple,r,!1)}},Lt=Nu,$t=Fa;var wv={usingClientEntryPoint:!1,Events:[si,ss,yo,Ye,Et,Nu]},vi={findFiberByHostInstance:Na,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},kv={bundleType:vi.bundleType,version:vi.version,rendererPackageName:vi.rendererPackageName,rendererConfig:vi.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:U.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=Le(t),t===null?null:t.stateNode},findFiberByHostInstance:vi.findFiberByHostInstance||vv,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var tl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!tl.isDisabled&&tl.supportsFiber)try{Wr=tl.inject(kv),Wt=tl}catch{}}return Pn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=wv,Pn.createPortal=function(t,r){var i=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Du(r))throw Error(a(200));return xv(t,r,null,i)},Pn.createRoot=function(t,r){if(!Du(t))throw Error(a(299));var i=!1,c="",p=p0;return r!=null&&(r.unstable_strictMode===!0&&(i=!0),r.identifierPrefix!==void 0&&(c=r.identifierPrefix),r.onRecoverableError!==void 0&&(p=r.onRecoverableError)),r=Iu(t,1,!1,null,null,i,!1,c,p),t[Ar]=r.current,ni(t.nodeType===8?t.parentNode:t),new Fu(r)},Pn.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var r=t._reactInternals;if(r===void 0)throw typeof t.render=="function"?Error(a(188)):(t=Object.keys(t).join(","),Error(a(268,t)));return t=Le(r),t=t===null?null:t.stateNode,t},Pn.flushSync=function(t){return Fa(t)},Pn.hydrate=function(t,r,i){if(!Zo(r))throw Error(a(200));return el(null,t,r,!0,i)},Pn.hydrateRoot=function(t,r,i){if(!Du(t))throw Error(a(405));var c=i!=null&&i.hydratedSources||null,p=!1,x="",S=p0;if(i!=null&&(i.unstable_strictMode===!0&&(p=!0),i.identifierPrefix!==void 0&&(x=i.identifierPrefix),i.onRecoverableError!==void 0&&(S=i.onRecoverableError)),r=f0(r,null,t,1,i??null,p,!1,x,S),t[Ar]=r.current,ni(t),c)for(t=0;t<c.length;t++)i=c[t],p=i._getVersion,p=p(i._source),r.mutableSourceEagerHydrationData==null?r.mutableSourceEagerHydrationData=[i,p]:r.mutableSourceEagerHydrationData.push(i,p);return new Qo(r)},Pn.render=function(t,r,i){if(!Zo(r))throw Error(a(200));return el(null,t,r,!1,i)},Pn.unmountComponentAtNode=function(t){if(!Zo(t))throw Error(a(40));return t._reactRootContainer?(Fa(function(){el(null,null,t,!1,function(){t._reactRootContainer=null,t[Ar]=null})}),!0):!1},Pn.unstable_batchedUpdates=Nu,Pn.unstable_renderSubtreeIntoContainer=function(t,r,i,c){if(!Zo(i))throw Error(a(200));if(t==null||t._reactInternals===void 0)throw Error(a(38));return el(t,r,i,!1,c)},Pn.version="18.3.1-next-f1338f8080-20240426",Pn}var S0;function Bg(){if(S0)return Ou.exports;S0=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),Ou.exports=Rv(),Ou.exports}var j0;function Mv(){if(j0)return nl;j0=1;var e=Bg();return nl.createRoot=e.createRoot,nl.hydrateRoot=e.hydrateRoot,nl}var Iv=Mv(),v=Hl();const ge=Og(v),_v=jv({__proto__:null,default:ge},[v]);/**
* react-router v7.15.1
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/var zg=e=>{throw TypeError(e)},Vg=(e,n,a)=>n.has(e)||zg("Cannot "+a),Gn=(e,n,a)=>(Vg(e,n,"read from private field"),a?a.call(e):n.get(e)),Ni=(e,n,a)=>n.has(e)?zg("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(e):n.set(e,a),jr=(e,n,a,s)=>(Vg(e,n,"write to private field"),n.set(e,a),a),C0="popstate";function N0(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function Fv(e={}){function n(s,o){var g;let l=(g=o.state)==null?void 0:g.masked,{pathname:d,search:f,hash:m}=l||s.location;return Fi("",{pathname:d,search:f,hash:m},o.state&&o.state.usr||null,o.state&&o.state.key||"default",l?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function a(s,o){return typeof o=="string"?o:Mr(o)}return Lv(n,a,null,e)}function Je(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function Ft(e,n){if(!e){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function Dv(){return Math.random().toString(36).substring(2,10)}function E0(e,n){return{usr:e.state,key:e.key,idx:n,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Fi(e,n,a=null,s,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof n=="string"?_r(n):n,state:a,key:n&&n.key||s||Dv(),mask:o}}function Mr({pathname:e="/",search:n="",hash:a=""}){return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),a&&a!=="#"&&(e+=a.charAt(0)==="#"?a:"#"+a),e}function _r(e){let n={};if(e){let a=e.indexOf("#");a>=0&&(n.hash=e.substring(a),e=e.substring(0,a));let s=e.indexOf("?");s>=0&&(n.search=e.substring(s),e=e.substring(0,s)),e&&(n.pathname=e)}return n}function Lv(e,n,a,s={}){let{window:o=document.defaultView,v5Compat:l=!1}=s,d=o.history,f="POP",m=null,g=y();g==null&&(g=0,d.replaceState({...d.state,idx:g},""));function y(){return(d.state||{idx:null}).idx}function h(){f="POP";let j=y(),M=j==null?null:j-g;g=j,m&&m({action:f,location:N.location,delta:M})}function b(j,M){f="PUSH";let P=N0(j)?j:Fi(N.location,j,M);g=y()+1;let F=E0(P,g),U=N.createHref(P.mask||P);try{d.pushState(F,"",U)}catch(W){if(W instanceof DOMException&&W.name==="DataCloneError")throw W;o.location.assign(U)}l&&m&&m({action:f,location:N.location,delta:1})}function k(j,M){f="REPLACE";let P=N0(j)?j:Fi(N.location,j,M);g=y();let F=E0(P,g),U=N.createHref(P.mask||P);d.replaceState(F,"",U),l&&m&&m({action:f,location:N.location,delta:0})}function C(j){return Ug(j)}let N={get action(){return f},get location(){return e(o,d)},listen(j){if(m)throw new Error("A history only accepts one active listener");return o.addEventListener(C0,h),m=j,()=>{o.removeEventListener(C0,h),m=null}},createHref(j){return n(o,j)},createURL:C,encodeLocation(j){let M=C(j);return{pathname:M.pathname,search:M.search,hash:M.hash}},push:b,replace:k,go(j){return d.go(j)}};return N}function Ug(e,n=!1){let a="http://localhost";typeof window<"u"&&(a=window.location.origin!=="null"?window.location.origin:window.location.href),Je(a,"No window.location.(origin|href) available to create URL");let s=typeof e=="string"?e:Mr(e);return s=s.replace(/ $/,"%20"),!n&&s.startsWith("//")&&(s=a+s),new URL(s,a)}var Ei,T0=class{constructor(e){if(Ni(this,Ei,new Map),e)for(let[n,a]of e)this.set(n,a)}get(e){if(Gn(this,Ei).has(e))return Gn(this,Ei).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw new Error("No value found for context")}set(e,n){Gn(this,Ei).set(e,n)}};Ei=new WeakMap;var Av=new Set(["lazy","caseSensitive","path","id","index","children"]);function Ov(e){return Av.has(e)}var Bv=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function zv(e){return Bv.has(e)}function Vv(e){return e.index===!0}function Di(e,n,a=[],s={},o=!1){return e.map((l,d)=>{let f=[...a,String(d)],m=typeof l.id=="string"?l.id:f.join("-");if(Je(l.index!==!0||!l.children,"Cannot specify children on an index route"),Je(o||!s[m],`Found a route id collision on id "${m}". Route id's must be globally unique within Data Router usages`),Vv(l)){let g={...l,id:m};return s[m]=P0(g,n(g)),g}else{let g={...l,id:m,children:void 0};return s[m]=P0(g,n(g)),l.children&&(g.children=Di(l.children,n,f,s,o)),g}})}function P0(e,n){return Object.assign(e,{...n,...typeof n.lazy=="object"&&n.lazy!=null?{lazy:{...e.lazy,...n.lazy}}:{}})}function $g(e,n,a="/"){return dr(e,n,a,!1)}function dr(e,n,a,s,o){let l=typeof n=="string"?_r(n):n,d=er(l.pathname||"/",a);if(d==null)return null;let f=o??gl(e),m=null,g=Zv(d);for(let y=0;m==null&&y<f.length;++y)m=qv(f[y],g,s);return m}function Hg(e,n){let{route:a,pathname:s,params:o}=e;return{id:a.id,pathname:s,params:o,data:n[a.id],loaderData:n[a.id],handle:a.handle}}function gl(e){let n=Wg(e);return Uv(n),n}function Wg(e,n=[],a=[],s="",o=!1){let l=(d,f,m=o,g)=>{let y={relativePath:g===void 0?d.path||"":g,caseSensitive:d.caseSensitive===!0,childrenIndex:f,route:d};if(y.relativePath.startsWith("/")){if(!y.relativePath.startsWith(s)&&m)return;Je(y.relativePath.startsWith(s),`Absolute route path "${y.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),y.relativePath=y.relativePath.slice(s.length)}let h=Qn([s,y.relativePath]),b=a.concat(y);d.children&&d.children.length>0&&(Je(d.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${h}".`),Wg(d.children,n,b,h,m)),!(d.path==null&&!d.index)&&n.push({path:h,score:Xv(h,d.index),routesMeta:b})};return e.forEach((d,f)=>{var m;if(d.path===""||!((m=d.path)!=null&&m.includes("?")))l(d,f);else for(let g of Kg(d.path))l(d,f,!0,g)}),n}function Kg(e){let n=e.split("/");if(n.length===0)return[];let[a,...s]=n,o=a.endsWith("?"),l=a.replace(/\?$/,"");if(s.length===0)return o?[l,""]:[l];let d=Kg(s.join("/")),f=[];return f.push(...d.map(m=>m===""?l:[l,m].join("/"))),o&&f.push(...d),f.map(m=>e.startsWith("/")&&m===""?"/":m)}function Uv(e){e.sort((n,a)=>n.score!==a.score?a.score-n.score:Jv(n.routesMeta.map(s=>s.childrenIndex),a.routesMeta.map(s=>s.childrenIndex)))}var $v=/^:[\w-]+$/,Hv=3,Wv=2,Kv=1,Yv=10,Gv=-2,R0=e=>e==="*";function Xv(e,n){let a=e.split("/"),s=a.length;return a.some(R0)&&(s+=Gv),n&&(s+=Wv),a.filter(o=>!R0(o)).reduce((o,l)=>o+($v.test(l)?Hv:l===""?Kv:Yv),s)}function Jv(e,n){return e.length===n.length&&e.slice(0,-1).every((s,o)=>s===n[o])?e[e.length-1]-n[n.length-1]:0}function qv(e,n,a=!1){let{routesMeta:s}=e,o={},l="/",d=[];for(let f=0;f<s.length;++f){let m=s[f],g=f===s.length-1,y=l==="/"?n:n.slice(l.length)||"/",h=Rl({path:m.relativePath,caseSensitive:m.caseSensitive,end:g},y),b=m.route;if(!h&&g&&a&&!s[s.length-1].route.index&&(h=Rl({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},y)),!h)return null;Object.assign(o,h.params),d.push({params:o,pathname:Qn([l,h.pathname]),pathnameBase:nb(Qn([l,h.pathnameBase])),route:b}),h.pathnameBase!=="/"&&(l=Qn([l,h.pathnameBase]))}return d}function Rl(e,n){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[a,s]=Qv(e.path,e.caseSensitive,e.end),o=n.match(a);if(!o)return null;let l=o[0],d=l.replace(/(.)\/+$/,"$1"),f=o.slice(1);return{params:s.reduce((g,{paramName:y,isOptional:h},b)=>{if(y==="*"){let C=f[b]||"";d=l.slice(0,l.length-C.length).replace(/(.)\/+$/,"$1")}const k=f[b];return h&&!k?g[y]=void 0:g[y]=(k||"").replace(/%2F/g,"/"),g},{}),pathname:l,pathnameBase:d,pattern:e}}function Qv(e,n=!1,a=!0){Ft(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let s=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(d,f,m,g,y)=>{if(s.push({paramName:f,isOptional:m!=null}),m){let h=y.charAt(g+d.length);return h&&h!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(s.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):a?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,n?void 0:"i"),s]}function Zv(e){try{return e.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return Ft(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${n}).`),e}}function er(e,n){if(n==="/")return e;if(!e.toLowerCase().startsWith(n.toLowerCase()))return null;let a=n.endsWith("/")?n.length-1:n.length,s=e.charAt(a);return s&&s!=="/"?null:e.slice(a)||"/"}function eb({basename:e,pathname:n}){return n==="/"?e:Qn([e,n])}var Yg=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,qd=e=>Yg.test(e);function tb(e,n="/"){let{pathname:a,search:s="",hash:o=""}=typeof e=="string"?_r(e):e,l;return a?(a=Qd(a),a.startsWith("/")?l=M0(a.substring(1),"/"):l=M0(a,n)):l=n,{pathname:l,search:rb(s),hash:ab(o)}}function M0(e,n){let a=Ml(n).split("/");return e.split("/").forEach(o=>{o===".."?a.length>1&&a.pop():o!=="."&&a.push(o)}),a.length>1?a.join("/"):"/"}function Vu(e,n,a,s){return`Cannot include a '${e}' character in a manually specified \`to.${n}\` field [${JSON.stringify(s)}]. Please separate it out to the \`to.${a}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Gg(e){return e.filter((n,a)=>a===0||n.route.path&&n.route.path.length>0)}function Wl(e){let n=Gg(e);return n.map((a,s)=>s===n.length-1?a.pathname:a.pathnameBase)}function Ui(e,n,a,s=!1){let o;typeof e=="string"?o=_r(e):(o={...e},Je(!o.pathname||!o.pathname.includes("?"),Vu("?","pathname","search",o)),Je(!o.pathname||!o.pathname.includes("#"),Vu("#","pathname","hash",o)),Je(!o.search||!o.search.includes("#"),Vu("#","search","hash",o)));let l=e===""||o.pathname==="",d=l?"/":o.pathname,f;if(d==null)f=a;else{let h=n.length-1;if(!s&&d.startsWith("..")){let b=d.split("/");for(;b[0]==="..";)b.shift(),h-=1;o.pathname=b.join("/")}f=h>=0?n[h]:"/"}let m=tb(o,f),g=d&&d!=="/"&&d.endsWith("/"),y=(l||d===".")&&a.endsWith("/");return!m.pathname.endsWith("/")&&(g||y)&&(m.pathname+="/"),m}var Qd=e=>e.replace(/\/\/+/g,"/"),Qn=e=>Qd(e.join("/")),Ml=e=>e.replace(/\/+$/,""),nb=e=>Ml(e).replace(/^\/*/,"/"),rb=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,ab=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,$i=class{constructor(e,n,a,s=!1){this.status=e,this.statusText=n||"",this.internal=s,a instanceof Error?(this.data=a.toString(),this.error=a):this.data=a}};function Li(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Hi(e){let n=e.map(a=>a.route.path).filter(Boolean);return Qn(n)||"/"}var Xg=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Jg(e,n){let a=e;if(typeof a!="string"||!Yg.test(a))return{absoluteURL:void 0,isExternal:!1,to:a};let s=a,o=!1;if(Xg)try{let l=new URL(window.location.href),d=a.startsWith("//")?new URL(l.protocol+a):new URL(a),f=er(d.pathname,n);d.origin===l.origin&&f!=null?a=f+d.search+d.hash:o=!0}catch{Ft(!1,`<Link to="${a}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:s,isExternal:o,to:a}}var xa=Symbol("Uninstrumented");function sb(e,n){let a={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(o=>o({id:n.id,index:n.index,path:n.path,instrument(l){let d=Object.keys(a);for(let f of d)l[f]&&a[f].push(l[f])}}));let s={};if(typeof n.lazy=="function"&&a.lazy.length>0){let o=Cs(a.lazy,n.lazy,()=>{});o&&(s.lazy=o)}if(typeof n.lazy=="object"){let o=n.lazy;["middleware","loader","action"].forEach(l=>{let d=o[l],f=a[`lazy.${l}`];if(typeof d=="function"&&f.length>0){let m=Cs(f,d,()=>{});m&&(s.lazy=Object.assign(s.lazy||{},{[l]:m}))}})}return["loader","action"].forEach(o=>{let l=n[o];if(typeof l=="function"&&a[o].length>0){let d=l[xa]??l,f=Cs(a[o],d,(...m)=>I0(m[0]));f&&(o==="loader"&&d.hydrate===!0&&(f.hydrate=!0),f[xa]=d,s[o]=f)}}),n.middleware&&n.middleware.length>0&&a.middleware.length>0&&(s.middleware=n.middleware.map(o=>{let l=o[xa]??o,d=Cs(a.middleware,l,(...f)=>I0(f[0]));return d?(d[xa]=l,d):o})),s}function ib(e,n){let a={navigate:[],fetch:[]};if(n.forEach(s=>s({instrument(o){let l=Object.keys(o);for(let d of l)o[d]&&a[d].push(o[d])}})),a.navigate.length>0){let s=e.navigate[xa]??e.navigate,o=Cs(a.navigate,s,(...l)=>{let[d,f]=l;return{to:typeof d=="number"||typeof d=="string"?d:d?Mr(d):".",..._0(e,f??{})}});o&&(o[xa]=s,e.navigate=o)}if(a.fetch.length>0){let s=e.fetch[xa]??e.fetch,o=Cs(a.fetch,s,(...l)=>{let[d,,f,m]=l;return{href:f??".",fetcherKey:d,..._0(e,m??{})}});o&&(o[xa]=s,e.fetch=o)}return e}function Cs(e,n,a){return e.length===0?null:async(...s)=>{let o=await qg(e,a(...s),()=>n(...s),e.length-1);if(o.type==="error")throw o.value;return o.value}}async function qg(e,n,a,s){let o=e[s],l;if(o){let d,f=async()=>(d?console.error("You cannot call instrumented handlers more than once"):d=qg(e,n,a,s-1),l=await d,Je(l,"Expected a result"),l.type==="error"&&l.value instanceof Error?{status:"error",error:l.value}:{status:"success",error:void 0});try{await o(f,n)}catch(m){console.error("An instrumentation function threw an error:",m)}d||await f(),await d}else try{l={type:"success",value:await a()}}catch(d){l={type:"error",value:d}}return l||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function I0(e){let{request:n,context:a,params:s,pattern:o}=e;return{request:ob(n),params:{...s},pattern:o,context:lb(a)}}function _0(e,n){return{currentUrl:Mr(e.state.location),..."formMethod"in n?{formMethod:n.formMethod}:{},..."formEncType"in n?{formEncType:n.formEncType}:{},..."formData"in n?{formData:n.formData}:{},..."body"in n?{body:n.body}:{}}}function ob(e){return{method:e.method,url:e.url,headers:{get:(...n)=>e.headers.get(...n)}}}function lb(e){if(ub(e)){let n={...e};return Object.freeze(n),n}else return{get:n=>e.get(n)}}var cb=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function ub(e){if(e===null||typeof e!="object")return!1;const n=Object.getPrototypeOf(e);return n===Object.prototype||n===null||Object.getOwnPropertyNames(n).sort().join("\0")===cb}var Qg=["POST","PUT","PATCH","DELETE"],db=new Set(Qg),fb=["GET",...Qg],hb=new Set(fb),Zg=new Set([301,302,303,307,308]),pb=new Set([307,308]),Uu={state:"idle",location:void 0,matches:void 0,historyAction:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},mb={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},wi={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},gb=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),e1="remix-router-transitions",t1=Symbol("ResetLoaderData"),za,bs,ha,ws,yb=class{constructor(e){Ni(this,za),Ni(this,bs),Ni(this,ha),Ni(this,ws),jr(this,za,e),jr(this,bs,gl(e))}get stableRoutes(){return Gn(this,za)}get activeRoutes(){return Gn(this,ha)??Gn(this,za)}get branches(){return Gn(this,ws)??Gn(this,bs)}get hasHMRRoutes(){return Gn(this,ha)!=null}setRoutes(e){jr(this,za,e),jr(this,bs,gl(e))}setHmrRoutes(e){jr(this,ha,e),jr(this,ws,gl(e))}commitHmrRoutes(){Gn(this,ha)&&(jr(this,za,Gn(this,ha)),jr(this,bs,Gn(this,ws)),jr(this,ha,void 0),jr(this,ws,void 0))}};za=new WeakMap;bs=new WeakMap;ha=new WeakMap;ws=new WeakMap;function xb(e){const n=e.window?e.window:typeof window<"u"?window:void 0,a=typeof n<"u"&&typeof n.document<"u"&&typeof n.document.createElement<"u";Je(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let s=e.hydrationRouteProperties||[],o=e.mapRouteProperties||gb,l=o;if(e.instrumentations){let L=e.instrumentations;l=V=>({...o(V),...sb(L.map(Q=>Q.route).filter(Boolean),V)})}let d={},f=new yb(Di(e.routes,l,void 0,d)),m=e.basename||"/";m.startsWith("/")||(m=`/${m}`);let g=e.dataStrategy||Sb,y={...e.future},h=null,b=new Set,k=null,C=null,N=null,j=null,M=e.hydrationData!=null,P=dr(f.activeRoutes,e.history.location,m,!1,f.branches),F=!1,U=null,W,J;if(P==null&&!e.patchRoutesOnNavigation){let L=Xn(404,{pathname:e.history.location.pathname}),{matches:V,route:Q}=rl(f.activeRoutes);W=!0,J=!W,P=V,U={[Q.id]:L}}else if(P&&!e.hydrationData&&In(P,f.activeRoutes,e.history.location.pathname).active&&(P=null),P)if(P.some(L=>L.route.lazy))W=!1,J=!W;else if(!P.some(L=>Zd(L.route)))W=!0,J=!W;else{let L=e.hydrationData?e.hydrationData.loaderData:null,V=e.hydrationData?e.hydrationData.errors:null,Q=P;if(V){let le=P.findIndex(ce=>V[ce.route.id]!==void 0);Q=Q.slice(0,le+1)}J=!1,W=!0,Q.forEach(le=>{let ce=n1(le.route,L,V);J=J||ce.renderFallback,W=W&&!ce.shouldLoad})}else{W=!1,J=!W,P=[];let L=In(null,f.activeRoutes,e.history.location.pathname);L.active&&L.matches&&(F=!0,P=L.matches)}let A,w={historyAction:e.history.action,location:e.history.location,matches:P,initialized:W,renderFallback:J,navigation:Uu,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||U,fetchers:new Map,blockers:new Map},R="POP",E=null,Y=!1,K,I=!1,$=new Map,ee=null,G=!1,z=!1,D=new Set,X=new Map,q=0,T=-1,O=new Map,ne=new Set,ie=new Map,oe=new Map,ae=new Set,ue=new Map,xe,ve=null;function Ve(){if(h=e.history.listen(({action:L,location:V,delta:Q})=>{if(xe){xe(),xe=void 0;return}Ft(ue.size===0||Q!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let le=Vn({currentLocation:w.location,nextLocation:V,historyAction:L});if(le&&Q!=null){let ce=new Promise(_e=>{xe=_e});e.history.go(Q*-1),an(le,{state:"blocked",location:V,proceed(){an(le,{state:"proceeding",proceed:void 0,reset:void 0,location:V}),ce.then(()=>e.history.go(Q))},reset(){let _e=new Map(w.blockers);_e.set(le,wi),Oe({blockers:_e})}}),E==null||E.resolve(),E=null;return}return Se(L,V)}),a){Vb(n,$);let L=()=>Ub(n,$);n.addEventListener("pagehide",L),ee=()=>n.removeEventListener("pagehide",L)}return w.initialized||Se("POP",w.location,{initialHydration:!0}),A}function Ce(){h&&h(),ee&&ee(),b.clear(),K&&K.abort(),w.fetchers.forEach((L,V)=>Mn(w.fetchers,V)),w.blockers.forEach((L,V)=>yr(V))}function Ue(L){if(b.add(L),k){let{newErrors:V}=k;k=null,L(w,{deletedFetchers:[],newErrors:V,viewTransitionOpts:void 0,flushSync:!1})}return()=>b.delete(L)}function Oe(L,V={}){L.matches&&(L.matches=L.matches.map(ce=>{let _e=d[ce.route.id],Fe=ce.route;return Fe.element!==_e.element||Fe.errorElement!==_e.errorElement||Fe.hydrateFallbackElement!==_e.hydrateFallbackElement?{...ce,route:_e}:ce})),w={...w,...L};let Q=[],le=[];w.fetchers.forEach((ce,_e)=>{ce.state==="idle"&&(ae.has(_e)?Q.push(_e):le.push(_e))}),ae.forEach(ce=>{!w.fetchers.has(ce)&&!X.has(ce)&&Q.push(ce)}),b.size===0&&(k={newErrors:L.errors??null}),[...b].forEach(ce=>ce(w,{deletedFetchers:Q,newErrors:L.errors??null,viewTransitionOpts:V.viewTransitionOpts,flushSync:V.flushSync===!0})),Q.forEach(ce=>Mn(w.fetchers,ce)),le.forEach(ce=>w.fetchers.delete(ce))}function dt(L,V,{flushSync:Q}={}){var $e,Xe;let le=w.actionData!=null&&w.navigation.formMethod!=null&&hn(w.navigation.formMethod)&&w.navigation.state==="loading"&&(($e=L.state)==null?void 0:$e._isRedirect)!==!0,ce;V.actionData?Object.keys(V.actionData).length>0?ce=V.actionData:ce=null:le?ce=w.actionData:ce=null;let _e=V.loaderData?H0(w.loaderData,V.loaderData,V.matches||[],V.errors):w.loaderData,Fe=w.blockers;Fe.size>0&&(Fe=new Map(Fe),Fe.forEach((Le,tt)=>Fe.set(tt,wi)));let Ke=G?!1:$t(L,V.matches||w.matches),ye=Y===!0||w.navigation.formMethod!=null&&hn(w.navigation.formMethod)&&((Xe=L.state)==null?void 0:Xe._isRedirect)!==!0;f.commitHmrRoutes(),G||R==="POP"||(R==="PUSH"?e.history.push(L,L.state):R==="REPLACE"&&e.history.replace(L,L.state));let De;if(R==="POP"){let Le=$.get(w.location.pathname);Le&&Le.has(L.pathname)?De={currentLocation:w.location,nextLocation:L}:$.has(L.pathname)&&(De={currentLocation:L,nextLocation:w.location})}else if(I){let Le=$.get(w.location.pathname);Le?Le.add(L.pathname):(Le=new Set([L.pathname]),$.set(w.location.pathname,Le)),De={currentLocation:w.location,nextLocation:L}}Oe({...V,actionData:ce,loaderData:_e,historyAction:R,location:L,initialized:!0,renderFallback:!1,navigation:Uu,revalidation:"idle",restoreScrollPosition:Ke,preventScrollReset:ye,blockers:Fe},{viewTransitionOpts:De,flushSync:Q===!0}),R="POP",Y=!1,I=!1,G=!1,z=!1,E==null||E.resolve(),E=null,ve==null||ve.resolve(),ve=null}async function xt(L,V){if(E==null||E.resolve(),E=null,typeof L=="number"){E||(E=G0());let ut=E.promise;return e.history.go(L),ut}let Q=bd(w.location,w.matches,m,L,V==null?void 0:V.fromRouteId,V==null?void 0:V.relative),{path:le,submission:ce,error:_e}=F0(!1,Q,V),Fe;V!=null&&V.mask&&(Fe={pathname:"",search:"",hash:"",...typeof V.mask=="string"?_r(V.mask):{...w.location.mask,...V.mask}});let Ke=w.location,ye=Fi(Ke,le,V&&V.state,void 0,Fe);ye={...ye,...e.history.encodeLocation(ye)};let De=V&&V.replace!=null?V.replace:void 0,$e="PUSH";De===!0?$e="REPLACE":De===!1||ce!=null&&hn(ce.formMethod)&&ce.formAction===w.location.pathname+w.location.search&&($e="REPLACE");let Xe=V&&"preventScrollReset"in V?V.preventScrollReset===!0:void 0,Le=(V&&V.flushSync)===!0,tt=Vn({currentLocation:Ke,nextLocation:ye,historyAction:$e});if(tt){an(tt,{state:"blocked",location:ye,proceed(){an(tt,{state:"proceeding",proceed:void 0,reset:void 0,location:ye}),xt(L,V)},reset(){let ut=new Map(w.blockers);ut.set(tt,wi),Oe({blockers:ut})}});return}await Se($e,ye,{submission:ce,pendingError:_e,preventScrollReset:Xe,replace:V&&V.replace,enableViewTransition:V&&V.viewTransition,flushSync:Le,callSiteDefaultShouldRevalidate:V&&V.defaultShouldRevalidate})}function vt(){ve||(ve=G0()),Qt(),Oe({revalidation:"loading"});let L=ve.promise;return w.navigation.state==="submitting"?L:w.navigation.state==="idle"?(Se(w.historyAction,w.location,{startUninterruptedRevalidation:!0}),L):(Se(R||w.historyAction,w.navigation.location,{overrideNavigation:w.navigation,enableViewTransition:I===!0}),L)}async function Se(L,V,Q){K&&K.abort(),K=null,R=L,G=(Q&&Q.startUninterruptedRevalidation)===!0,Lt(w.location,w.matches),Y=(Q&&Q.preventScrollReset)===!0,I=(Q&&Q.enableViewTransition)===!0;let le=f.activeRoutes,ce=Q!=null&&Q.initialHydration&&w.matches&&w.matches.length>0&&!F?w.matches:dr(le,V,m,!1,f.branches),_e=(Q&&Q.flushSync)===!0;if(ce&&w.initialized&&!z&&Mb(w.location,V)&&!(Q&&Q.submission&&hn(Q.submission.formMethod))){dt(V,{matches:ce},{flushSync:_e});return}let Fe=In(ce,le,V.pathname);if(Fe.active&&Fe.matches&&(ce=Fe.matches),!ce){let{error:St,notFoundMatches:pt,route:at}=Fr(V.pathname);dt(V,{matches:pt,loaderData:{},errors:{[at.id]:St}},{flushSync:_e});return}let Ke=Q&&Q.overrideNavigation?{...Q.overrideNavigation,matches:ce,historyAction:L}:void 0;K=new AbortController;let ye=ks(e.history,V,K.signal,Q&&Q.submission),De=e.getContext?await e.getContext():new T0,$e;if(Q&&Q.pendingError)$e=[ga(ce).route.id,{type:"error",error:Q.pendingError}];else if(Q&&Q.submission&&hn(Q.submission.formMethod)){let St=await Re(ye,V,Q.submission,ce,L,De,Fe.active,Q&&Q.initialHydration===!0,{replace:Q.replace,flushSync:_e});if(St.shortCircuited)return;if(St.pendingActionResult){let[pt,at]=St.pendingActionResult;if(On(at)&&Li(at.error)&&at.error.status===404){K=null,dt(V,{matches:St.matches,loaderData:{},errors:{[pt]:at.error}});return}}ce=St.matches||ce,$e=St.pendingActionResult,Ke=$u(V,ce,L,Q.submission),_e=!1,Fe.active=!1,ye=ks(e.history,ye.url,ye.signal)}let{shortCircuited:Xe,matches:Le,loaderData:tt,errors:ut,workingFetchers:Ot}=await we(ye,V,ce,L,De,Fe.active,Ke,Q&&Q.submission,Q&&Q.fetcherSubmission,Q&&Q.replace,Q&&Q.initialHydration===!0,_e,$e,Q&&Q.callSiteDefaultShouldRevalidate);Xe||(K=null,dt(V,{matches:Le||ce,...W0($e),loaderData:tt,errors:ut,...Ot?{fetchers:Ot}:{}}))}async function Re(L,V,Q,le,ce,_e,Fe,Ke,ye={}){Qt();let De=Bb(V,le,ce,Q);if(Oe({navigation:De},{flushSync:ye.flushSync===!0}),Fe){let Le=await kt(le,V.pathname,L.signal);if(Le.type==="aborted")return{shortCircuited:!0};if(Le.type==="error"){if(Le.partialMatches.length===0){let{matches:ut,route:Ot}=rl(f.activeRoutes);return{matches:ut,pendingActionResult:[Ot.id,{type:"error",error:Le.error}]}}let tt=ga(Le.partialMatches).route.id;return{matches:Le.partialMatches,pendingActionResult:[tt,{type:"error",error:Le.error}]}}else if(Le.matches)le=Le.matches;else{let{notFoundMatches:tt,error:ut,route:Ot}=Fr(V.pathname);return{matches:tt,pendingActionResult:[Ot.id,{type:"error",error:ut}]}}}let $e,Xe=yl(le,V);if(!Xe.route.action&&!Xe.route.lazy)$e={type:"error",error:Xn(405,{method:L.method,pathname:V.pathname,routeId:Xe.route.id})};else{let Le=Rs(l,d,L,V,le,Xe,Ke?[]:s,_e),tt=await rt(L,V,Le,_e,null);if($e=tt[Xe.route.id],!$e){for(let ut of le)if(tt[ut.route.id]){$e=tt[ut.route.id];break}}if(L.signal.aborted)return{shortCircuited:!0}}if(Ua($e)){let Le;return ye&&ye.replace!=null?Le=ye.replace:Le=V0($e.response.headers.get("Location"),new URL(L.url),m,e.history)===w.location.pathname+w.location.search,await Ge(L,$e,!0,{submission:Q,replace:Le}),{shortCircuited:!0}}if(On($e)){let Le=ga(le,Xe.route.id);return(ye&&ye.replace)!==!0&&(R="PUSH"),{matches:le,pendingActionResult:[Le.route.id,$e,Xe.route.id]}}return{matches:le,pendingActionResult:[Xe.route.id,$e]}}async function we(L,V,Q,le,ce,_e,Fe,Ke,ye,De,$e,Xe,Le,tt){let ut=Fe||$u(V,Q,le,Ke),Ot=Ke||ye||Y0(ut),St=!G&&!$e;if(_e){if(St){let ln=me(Le);Oe({navigation:ut,...ln!==void 0?{actionData:ln}:{}},{flushSync:Xe})}let st=await kt(Q,V.pathname,L.signal);if(st.type==="aborted")return{shortCircuited:!0};if(st.type==="error"){if(st.partialMatches.length===0){let{matches:gn,route:Sn}=rl(f.activeRoutes);return{matches:gn,loaderData:{},errors:{[Sn.id]:st.error}}}let ln=ga(st.partialMatches).route.id;return{matches:st.partialMatches,loaderData:{},errors:{[ln]:st.error}}}else if(st.matches)Q=st.matches;else{let{error:ln,notFoundMatches:gn,route:Sn}=Fr(V.pathname);return{matches:gn,loaderData:{},errors:{[Sn.id]:ln}}}}let pt=f.activeRoutes,{dsMatches:at,revalidatingFetchers:sn}=D0(L,ce,l,d,e.history,w,Q,Ot,V,$e?[]:s,$e===!0,z,D,ae,ie,ne,pt,m,e.patchRoutesOnNavigation!=null,f.branches,Le,tt);if(T=++q,!e.dataStrategy&&!at.some(st=>st.shouldLoad)&&!at.some(st=>st.route.middleware&&st.route.middleware.length>0)&&sn.length===0){let st=new Map(w.fetchers),ln=it(st);return dt(V,{matches:Q,loaderData:{},errors:Le&&On(Le[1])?{[Le[0]]:Le[1].error}:null,...W0(Le),...ln?{fetchers:st}:{}},{flushSync:Xe}),{shortCircuited:!0}}if(St){let st={};if(!_e){st.navigation=ut;let ln=me(Le);ln!==void 0&&(st.actionData=ln)}sn.length>0&&(st.fetchers=Ie(sn)),Oe(st,{flushSync:Xe})}sn.forEach(st=>{Ze(st.key),st.controller&&X.set(st.key,st.controller)});let Dr=()=>sn.forEach(st=>Ze(st.key));K&&K.signal.addEventListener("abort",Dr);let{loaderResults:nr,fetcherResults:rr}=await ht(at,sn,L,V,ce);if(L.signal.aborted)return{shortCircuited:!0};K&&K.signal.removeEventListener("abort",Dr),sn.forEach(st=>X.delete(st.key));let vr=al(nr);if(vr)return await Ge(L,vr.result,!0,{replace:De}),{shortCircuited:!0};if(vr=al(rr),vr)return ne.add(vr.key),await Ge(L,vr.result,!0,{replace:De}),{shortCircuited:!0};let _n=new Map(w.fetchers),{loaderData:Wr,errors:Wt}=$0(w,Q,nr,Le,sn,rr,_n);$e&&w.errors&&(Wt={...w.errors,...Wt});let Xa=it(_n),on=Zt(T,_n),Ja=Xa||on||sn.length>0;return{matches:Q,loaderData:Wr,errors:Wt,...Ja?{workingFetchers:_n}:{}}}function me(L){if(L&&!On(L[1]))return{[L[0]]:L[1].data};if(w.actionData)return Object.keys(w.actionData).length===0?null:w.actionData}function Ie(L){let V=new Map(w.fetchers);return L.forEach(Q=>{let le=V.get(Q.key),ce=ki(void 0,le?le.data:void 0);V.set(Q.key,ce)}),V}async function be(L,V,Q,le){Ze(L);let ce=(le&&le.flushSync)===!0,_e=f.activeRoutes,Fe=bd(w.location,w.matches,m,Q,V,le==null?void 0:le.relative),Ke=dr(_e,Fe,m,!1,f.branches),ye=In(Ke,_e,Fe);if(ye.active&&ye.matches&&(Ke=ye.matches),!Ke){qe(L,V,Xn(404,{pathname:Fe}),{flushSync:ce});return}let{path:De,submission:$e,error:Xe}=F0(!0,Fe,le);if(Xe){qe(L,V,Xe,{flushSync:ce});return}let Le=e.getContext?await e.getContext():new T0,tt=(le&&le.preventScrollReset)===!0;if($e&&hn($e.formMethod)){await Ae(L,V,De,Ke,Le,ye.active,ce,tt,$e,le&&le.defaultShouldRevalidate);return}ie.set(L,{routeId:V,path:De}),await Qe(L,V,De,Ke,Le,ye.active,ce,tt,$e)}async function Ae(L,V,Q,le,ce,_e,Fe,Ke,ye,De){Qt(),ie.delete(L);let $e=w.fetchers.get(L);Pt(L,zb(ye,$e),{flushSync:Fe});let Xe=new AbortController,Le=ks(e.history,Q,Xe.signal,ye);if(_e){let bt=await kt(le,new URL(Le.url).pathname,Le.signal,L);if(bt.type==="aborted")return;if(bt.type==="error"){qe(L,V,bt.error,{flushSync:Fe});return}else if(bt.matches)le=bt.matches;else{qe(L,V,Xn(404,{pathname:Q}),{flushSync:Fe});return}}let tt=yl(le,Q);if(!tt.route.action&&!tt.route.lazy){let bt=Xn(405,{method:ye.formMethod,pathname:Q,routeId:V});qe(L,V,bt,{flushSync:Fe});return}X.set(L,Xe);let ut=q,Ot=Rs(l,d,Le,Q,le,tt,s,ce),St=await rt(Le,Q,Ot,ce,L),pt=St[tt.route.id];if(!pt){for(let bt of Ot)if(St[bt.route.id]){pt=St[bt.route.id];break}}if(Le.signal.aborted){X.get(L)===Xe&&X.delete(L);return}if(ae.has(L)){if(Ua(pt)||On(pt)){Pt(L,Nr(void 0));return}}else{if(Ua(pt))if(X.delete(L),T>ut){Pt(L,Nr(void 0));return}else return ne.add(L),Pt(L,ki(ye)),Ge(Le,pt,!1,{fetcherSubmission:ye,preventScrollReset:Ke});if(On(pt)){qe(L,V,pt.error);return}}let at=w.navigation.location||w.location,sn=ks(e.history,at,Xe.signal),Dr=f.activeRoutes,nr=w.navigation.state!=="idle"?dr(Dr,w.navigation.location,m,!1,f.branches):w.matches;Je(nr,"Didn't find any matches after fetcher action");let rr=++q;O.set(L,rr);let{dsMatches:vr,revalidatingFetchers:_n}=D0(sn,ce,l,d,e.history,w,nr,ye,at,s,!1,z,D,ae,ie,ne,Dr,m,e.patchRoutesOnNavigation!=null,f.branches,[tt.route.id,pt],De),Wr=ki(ye,pt.data),Wt=new Map(w.fetchers);Wt.set(L,Wr),_n.filter(bt=>bt.key!==L).forEach(bt=>{let Lr=bt.key,qa=Wt.get(Lr),eo=ki(void 0,qa?qa.data:void 0);Wt.set(Lr,eo),Ze(Lr),bt.controller&&X.set(Lr,bt.controller)}),Oe({fetchers:Wt});let Xa=()=>_n.forEach(bt=>Ze(bt.key));Xe.signal.addEventListener("abort",Xa);let{loaderResults:on,fetcherResults:Ja}=await ht(vr,_n,sn,at,ce);if(Xe.signal.aborted)return;Xe.signal.removeEventListener("abort",Xa),O.delete(L),X.delete(L),_n.forEach(bt=>X.delete(bt.key));let st=w.fetchers.has(L),ln=bt=>{if(!st)return bt;let Lr=new Map(bt.fetchers);return Lr.set(L,Nr(pt.data)),{...bt,fetchers:Lr}},gn=al(on);if(gn)return w=ln(w),Ge(sn,gn.result,!1,{preventScrollReset:Ke});if(gn=al(Ja),gn)return ne.add(gn.key),w=ln(w),Ge(sn,gn.result,!1,{preventScrollReset:Ke});let Sn=new Map(w.fetchers);st&&Sn.set(L,Nr(pt.data));let{loaderData:Kr,errors:Yr}=$0(w,nr,on,void 0,_n,Ja,Sn);Zt(rr,Sn),w.navigation.state==="loading"&&rr>T?(Je(R,"Expected pending action"),K&&K.abort(),dt(w.navigation.location,{matches:nr,loaderData:Kr,errors:Yr,fetchers:Sn})):(Oe({errors:Yr,loaderData:H0(w.loaderData,Kr,nr,Yr),fetchers:Sn}),z=!1)}async function Qe(L,V,Q,le,ce,_e,Fe,Ke,ye){let De=w.fetchers.get(L);Pt(L,ki(ye,De?De.data:void 0),{flushSync:Fe});let $e=new AbortController,Xe=ks(e.history,Q,$e.signal);if(_e){let pt=await kt(le,new URL(Xe.url).pathname,Xe.signal,L);if(pt.type==="aborted")return;if(pt.type==="error"){qe(L,V,pt.error,{flushSync:Fe});return}else if(pt.matches)le=pt.matches;else{qe(L,V,Xn(404,{pathname:Q}),{flushSync:Fe});return}}let Le=yl(le,Q);X.set(L,$e);let tt=q,ut=Rs(l,d,Xe,Q,le,Le,s,ce),Ot=await rt(Xe,Q,ut,ce,L),St=Ot[Le.route.id];if(!St){for(let pt of le)if(Ot[pt.route.id]){St=Ot[pt.route.id];break}}if(X.get(L)===$e&&X.delete(L),!Xe.signal.aborted){if(ae.has(L)){Pt(L,Nr(void 0));return}if(Ua(St))if(T>tt){Pt(L,Nr(void 0));return}else{ne.add(L),await Ge(Xe,St,!1,{preventScrollReset:Ke});return}if(On(St)){qe(L,V,St.error);return}Pt(L,Nr(St.data))}}async function Ge(L,V,Q,{submission:le,fetcherSubmission:ce,preventScrollReset:_e,replace:Fe}={}){Q||(E==null||E.resolve(),E=null),V.response.headers.has("X-Remix-Revalidate")&&(z=!0);let Ke=V.response.headers.get("Location");Je(Ke,"Expected a Location header on the redirect Response"),Ke=V0(Ke,new URL(L.url),m,e.history);let ye=Fi(w.location,Ke,{_isRedirect:!0});if(a){let ut=!1;if(V.response.headers.has("X-Remix-Reload-Document"))ut=!0;else if(qd(Ke)){const Ot=Ug(Ke,!0);ut=Ot.origin!==n.location.origin||er(Ot.pathname,m)==null}if(ut){Fe?n.location.replace(Ke):n.location.assign(Ke);return}}K=null;let De=Fe===!0||V.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:$e,formAction:Xe,formEncType:Le}=w.navigation;!le&&!ce&&$e&&Xe&&Le&&(le=Y0(w.navigation));let tt=le||ce;if(pb.has(V.response.status)&&tt&&hn(tt.formMethod))await Se(De,ye,{submission:{...tt,formAction:Ke},preventScrollReset:_e||Y,enableViewTransition:Q?I:void 0});else{let ut=$u(ye,[],De,le);await Se(De,ye,{overrideNavigation:ut,fetcherSubmission:ce,preventScrollReset:_e||Y,enableViewTransition:Q?I:void 0})}}async function rt(L,V,Q,le,ce){var Ke;let _e,Fe={};try{_e=await Cb(g,L,V,Q,ce,le,!1)}catch(ye){return Q.filter(De=>De.shouldLoad).forEach(De=>{Fe[De.route.id]={type:"error",error:ye}}),Fe}if(L.signal.aborted)return Fe;if(!hn(L.method))for(let ye of Q){if(((Ke=_e[ye.route.id])==null?void 0:Ke.type)==="error")break;!_e.hasOwnProperty(ye.route.id)&&!w.loaderData.hasOwnProperty(ye.route.id)&&(!w.errors||!w.errors.hasOwnProperty(ye.route.id))&&ye.shouldCallHandler()&&(_e[ye.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${ye.route.id}`)})}for(let[ye,De]of Object.entries(_e))if(Db(De)){let $e=De.result;Fe[ye]={type:"redirect",response:Pb($e,L,ye,Q,m)}}else Fe[ye]=await Tb(De);return Fe}async function ht(L,V,Q,le,ce){let _e=rt(Q,le,L,ce,null),Fe=Promise.all(V.map(async De=>{if(De.matches&&De.match&&De.request&&De.controller){let Xe=(await rt(De.request,De.path,De.matches,ce,De.key))[De.match.route.id];return{[De.key]:Xe}}else return Promise.resolve({[De.key]:{type:"error",error:Xn(404,{pathname:De.path})}})})),Ke=await _e,ye=(await Fe).reduce((De,$e)=>Object.assign(De,$e),{});return{loaderResults:Ke,fetcherResults:ye}}function Qt(){z=!0,ie.forEach((L,V)=>{X.has(V)&&D.add(V),Ze(V)})}function Pt(L,V,Q={}){let le=new Map(w.fetchers);le.set(L,V),Oe({fetchers:le},{flushSync:(Q&&Q.flushSync)===!0})}function qe(L,V,Q,le={}){let ce=ga(w.matches,V),_e=new Map(w.fetchers);Mn(_e,L),Oe({errors:{[ce.route.id]:Q},fetchers:_e},{flushSync:(le&&le.flushSync)===!0})}function kn(L){return oe.set(L,(oe.get(L)||0)+1),ae.has(L)&&ae.delete(L),w.fetchers.get(L)||mb}function ft(L,V){Ze(L,V==null?void 0:V.reason),Pt(L,Nr(null))}function Mn(L,V){let Q=w.fetchers.get(V);X.has(V)&&!(Q&&Q.state==="loading"&&O.has(V))&&Ze(V),ie.delete(V),O.delete(V),ne.delete(V),ae.delete(V),D.delete(V),L.delete(V)}function Te(L){let V=(oe.get(L)||0)-1;V<=0?(oe.delete(L),ae.add(L)):oe.set(L,V),Oe({fetchers:new Map(w.fetchers)})}function Ze(L,V){let Q=X.get(L);Q&&(Q.abort(V),X.delete(L))}function ot(L,V){for(let Q of L){let le=V.get(Q);Je(le,`Expected fetcher: ${Q}`);let ce=Nr(le.data);V.set(Q,ce)}}function it(L){let V=[],Q=!1;for(let le of ne){let ce=L.get(le);Je(ce,`Expected fetcher: ${le}`),ce.state==="loading"&&(ne.delete(le),V.push(le),Q=!0)}return ot(V,L),Q}function Zt(L,V){let Q=[];for(let[le,ce]of O)if(ce<L){let _e=V.get(le);Je(_e,`Expected fetcher: ${le}`),_e.state==="loading"&&(Ze(le),O.delete(le),Q.push(le))}return ot(Q,V),Q.length>0}function gt(L,V){let Q=w.blockers.get(L)||wi;return ue.get(L)!==V&&ue.set(L,V),Q}function yr(L){w.blockers.delete(L),ue.delete(L)}function an(L,V){let Q=w.blockers.get(L)||wi;Je(Q.state==="unblocked"&&V.state==="blocked"||Q.state==="blocked"&&V.state==="blocked"||Q.state==="blocked"&&V.state==="proceeding"||Q.state==="blocked"&&V.state==="unblocked"||Q.state==="proceeding"&&V.state==="unblocked",`Invalid blocker state transition: ${Q.state} -> ${V.state}`);let le=new Map(w.blockers);le.set(L,V),Oe({blockers:le})}function Vn({currentLocation:L,nextLocation:V,historyAction:Q}){if(ue.size===0)return;ue.size>1&&Ft(!1,"A router only supports one blocker at a time");let le=Array.from(ue.entries()),[ce,_e]=le[le.length-1],Fe=w.blockers.get(ce);if(!(Fe&&Fe.state==="proceeding")&&_e({currentLocation:L,nextLocation:V,historyAction:Q}))return ce}function Fr(L){let V=Xn(404,{pathname:L}),Q=f.activeRoutes,{matches:le,route:ce}=rl(Q);return{notFoundMatches:le,route:ce,error:V}}function Ye(L,V,Q){if(C=L,j=V,N=Q||null,!M&&w.navigation===Uu){M=!0;let le=$t(w.location,w.matches);le!=null&&Oe({restoreScrollPosition:le})}return()=>{C=null,j=null,N=null}}function Et(L,V){return N&&N(L,V.map(le=>Hg(le,w.loaderData)))||L.key}function Lt(L,V){if(C&&j){let Q=Et(L,V);C[Q]=j()}}function $t(L,V){if(C){let Q=Et(L,V),le=C[Q];if(typeof le=="number")return le}return null}function In(L,V,Q){if(e.patchRoutesOnNavigation){let le=f.branches;if(L){if(Object.keys(L[0].params).length>0)return{active:!0,matches:dr(V,Q,m,!0,le)}}else return{active:!0,matches:dr(V,Q,m,!0,le)||[]}}return{active:!1,matches:null}}async function kt(L,V,Q,le){if(!e.patchRoutesOnNavigation)return{type:"success",matches:L};let ce=L;for(;;){let _e=d;try{await e.patchRoutesOnNavigation({signal:Q,path:V,matches:ce,fetcherKey:le,patch:(De,$e)=>{Q.aborted||L0(De,$e,f,_e,l,!1)}})}catch(De){return{type:"error",error:De,partialMatches:ce}}if(Q.aborted)return{type:"aborted"};let Fe=f.branches,Ke=dr(f.activeRoutes,V,m,!1,Fe),ye=null;if(Ke){if(Object.keys(Ke[0].params).length===0)return{type:"success",matches:Ke};if(ye=dr(f.activeRoutes,V,m,!0,Fe),!(ye&&ce.length<ye.length&&At(ce,ye.slice(0,ce.length))))return{type:"success",matches:Ke}}if(ye||(ye=dr(f.activeRoutes,V,m,!0,Fe)),!ye||At(ce,ye))return{type:"success",matches:null};ce=ye}}function At(L,V){return L.length===V.length&&L.every((Q,le)=>Q.route.id===V[le].route.id)}function xr(L){d={},f.setHmrRoutes(Di(L,l,void 0,d))}function Ht(L,V,Q=!1){L0(L,V,f,d,l,Q),f.hasHMRRoutes||Oe({})}return A={get basename(){return m},get future(){return y},get state(){return w},get routes(){return f.stableRoutes},get branches(){return f.branches},get manifest(){return d},get window(){return n},initialize:Ve,subscribe:Ue,enableScrollRestoration:Ye,navigate:xt,fetch:be,revalidate:vt,createHref:L=>e.history.createHref(L),encodeLocation:L=>e.history.encodeLocation(L),getFetcher:kn,resetFetcher:ft,deleteFetcher:Te,dispose:Ce,getBlocker:gt,deleteBlocker:yr,patchRoutes:Ht,_internalFetchControllers:X,_internalSetRoutes:xr,_internalSetStateDoNotUseOrYouWillBreakYourApp(L){Oe(L)}},e.instrumentations&&(A=ib(A,e.instrumentations.map(L=>L.router).filter(Boolean))),A}function vb(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function bd(e,n,a,s,o,l){let d,f;if(o){d=[];for(let g of n)if(d.push(g),g.route.id===o){f=g;break}}else d=n,f=n[n.length-1];let m=Ui(s||".",Wl(d),er(e.pathname,a)||e.pathname,l==="path");if(s==null&&(m.search=e.search,m.hash=e.hash),(s==null||s===""||s===".")&&f){let g=tf(m.search);if(f.route.index&&!g)m.search=m.search?m.search.replace(/^\?/,"?index&"):"?index";else if(!f.route.index&&g){let y=new URLSearchParams(m.search),h=y.getAll("index");y.delete("index"),h.filter(k=>k).forEach(k=>y.append("index",k));let b=y.toString();m.search=b?`?${b}`:""}}return a!=="/"&&(m.pathname=eb({basename:a,pathname:m.pathname})),Mr(m)}function F0(e,n,a){if(!a||!vb(a))return{path:n};if(a.formMethod&&!Ob(a.formMethod))return{path:n,error:Xn(405,{method:a.formMethod})};let s=()=>({path:n,error:Xn(400,{type:"invalid-body"})}),l=(a.formMethod||"get").toUpperCase(),d=c1(n);if(a.body!==void 0){if(a.formEncType==="text/plain"){if(!hn(l))return s();let h=typeof a.body=="string"?a.body:a.body instanceof FormData||a.body instanceof URLSearchParams?Array.from(a.body.entries()).reduce((b,[k,C])=>`${b}${k}=${C}
`,""):String(a.body);return{path:n,submission:{formMethod:l,formAction:d,formEncType:a.formEncType,formData:void 0,json:void 0,text:h}}}else if(a.formEncType==="application/json"){if(!hn(l))return s();try{let h=typeof a.body=="string"?JSON.parse(a.body):a.body;return{path:n,submission:{formMethod:l,formAction:d,formEncType:a.formEncType,formData:void 0,json:h,text:void 0}}}catch{return s()}}}Je(typeof FormData=="function","FormData is not available in this environment");let f,m;if(a.formData)f=kd(a.formData),m=a.formData;else if(a.body instanceof FormData)f=kd(a.body),m=a.body;else if(a.body instanceof URLSearchParams)f=a.body,m=U0(f);else if(a.body==null)f=new URLSearchParams,m=new FormData;else try{f=new URLSearchParams(a.body),m=U0(f)}catch{return s()}let g={formMethod:l,formAction:d,formEncType:a&&a.formEncType||"application/x-www-form-urlencoded",formData:m,json:void 0,text:void 0};if(hn(g.formMethod))return{path:n,submission:g};let y=_r(n);return e&&y.search&&tf(y.search)&&f.append("index",""),y.search=`?${f}`,{path:Mr(y),submission:g}}function D0(e,n,a,s,o,l,d,f,m,g,y,h,b,k,C,N,j,M,P,F,U,W){var G;let J=U?On(U[1])?U[1].error:U[1].data:void 0,A=o.createURL(l.location),w=o.createURL(m),R;if(y&&l.errors){let z=Object.keys(l.errors)[0];R=d.findIndex(D=>D.route.id===z)}else if(U&&On(U[1])){let z=U[0];R=d.findIndex(D=>D.route.id===z)-1}let E=U?U[1].statusCode:void 0,Y=E&&E>=400,K={currentUrl:A,currentParams:((G=l.matches[0])==null?void 0:G.params)||{},nextUrl:w,nextParams:d[0].params,...f,actionResult:J,actionStatus:E},I=Hi(d),$=d.map((z,D)=>{let{route:X}=z,q=null;if(R!=null&&D>R)q=!1;else if(X.lazy)q=!0;else if(!Zd(X))q=!1;else if(y){let{shouldLoad:ie}=n1(X,l.loaderData,l.errors);q=ie}else bb(l.loaderData,l.matches[D],z)&&(q=!0);if(q!==null)return wd(a,s,e,m,I,z,g,n,q);let T=!1;typeof W=="boolean"?T=W:Y?T=!1:(h||A.pathname+A.search===w.pathname+w.search||A.search!==w.search||wb(l.matches[D],z))&&(T=!0);let O={...K,defaultShouldRevalidate:T},ne=Pi(z,O);return wd(a,s,e,m,I,z,g,n,ne,O,W)}),ee=[];return C.forEach((z,D)=>{if(y||!d.some(ae=>ae.route.id===z.routeId)||k.has(D))return;let X=l.fetchers.get(D),q=X&&X.state!=="idle"&&X.data===void 0,T=dr(j,z.path,M??"/",!1,F);if(!T){if(P&&q)return;ee.push({key:D,routeId:z.routeId,path:z.path,matches:null,match:null,request:null,controller:null});return}if(N.has(D))return;let O=yl(T,z.path),ne=new AbortController,ie=ks(o,z.path,ne.signal),oe=null;if(b.has(D))b.delete(D),oe=Rs(a,s,ie,z.path,T,O,g,n);else if(q)h&&(oe=Rs(a,s,ie,z.path,T,O,g,n));else{let ae;typeof W=="boolean"?ae=W:Y?ae=!1:ae=h;let ue={...K,defaultShouldRevalidate:ae};Pi(O,ue)&&(oe=Rs(a,s,ie,z.path,T,O,g,n,ue))}oe&&ee.push({key:D,routeId:z.routeId,path:z.path,matches:oe,match:O,request:ie,controller:ne})}),{dsMatches:$,revalidatingFetchers:ee}}function Zd(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function n1(e,n,a){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!Zd(e))return{shouldLoad:!1,renderFallback:!1};let s=n!=null&&e.id in n,o=a!=null&&a[e.id]!==void 0;if(!s&&o)return{shouldLoad:!1,renderFallback:!1};if(typeof e.loader=="function"&&e.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!s};let l=!s&&!o;return{shouldLoad:l,renderFallback:l}}function bb(e,n,a){let s=!n||a.route.id!==n.route.id,o=!e.hasOwnProperty(a.route.id);return s||o}function wb(e,n){let a=e.route.path;return e.pathname!==n.pathname||a!=null&&a.endsWith("*")&&e.params["*"]!==n.params["*"]}function Pi(e,n){if(e.route.shouldRevalidate){let a=e.route.shouldRevalidate(n);if(typeof a=="boolean")return a}return n.defaultShouldRevalidate}function L0(e,n,a,s,o,l){let d;if(e){let g=s[e];Je(g,`No route found to patch children into: routeId = ${e}`),g.children||(g.children=[]),d=g.children}else d=a.activeRoutes;let f=[],m=[];if(n.forEach(g=>{let y=d.find(h=>r1(g,h));y?m.push({existingRoute:y,newRoute:g}):f.push(g)}),f.length>0){let g=Di(f,o,[e||"_","patch",String((d==null?void 0:d.length)||"0")],s);d.push(...g)}if(l&&m.length>0)for(let g=0;g<m.length;g++){let{existingRoute:y,newRoute:h}=m[g],b=y,[k]=Di([h],o,[],{},!0);Object.assign(b,{element:k.element?k.element:b.element,errorElement:k.errorElement?k.errorElement:b.errorElement,hydrateFallbackElement:k.hydrateFallbackElement?k.hydrateFallbackElement:b.hydrateFallbackElement})}a.hasHMRRoutes||a.setRoutes([...a.activeRoutes])}function r1(e,n){var a;return"id"in e&&"id"in n&&e.id===n.id?!0:e.index===n.index&&e.path===n.path&&e.caseSensitive===n.caseSensitive?(!e.children||e.children.length===0)&&(!n.children||n.children.length===0)?!0:((a=e.children)==null?void 0:a.every((s,o)=>{var l;return(l=n.children)==null?void 0:l.some(d=>r1(s,d))}))??!1:!1}var A0=new WeakMap,a1=({key:e,route:n,manifest:a,mapRouteProperties:s})=>{let o=a[n.id];if(Je(o,"No route found in manifest"),!o.lazy||typeof o.lazy!="object")return;let l=o.lazy[e];if(!l)return;let d=A0.get(o);d||(d={},A0.set(o,d));let f=d[e];if(f)return f;let m=(async()=>{let g=Ov(e),h=o[e]!==void 0&&e!=="hasErrorBoundary";if(g)Ft(!g,"Route property "+e+" is not a supported lazy route property. This property will be ignored."),d[e]=Promise.resolve();else if(h)Ft(!1,`Route "${o.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let b=await l();b!=null&&(Object.assign(o,{[e]:b}),Object.assign(o,s(o)))}typeof o.lazy=="object"&&(o.lazy[e]=void 0,Object.values(o.lazy).every(b=>b===void 0)&&(o.lazy=void 0))})();return d[e]=m,m},O0=new WeakMap;function kb(e,n,a,s,o){let l=a[e.id];if(Je(l,"No route found in manifest"),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy=="function"){let y=O0.get(l);if(y)return{lazyRoutePromise:y,lazyHandlerPromise:y};let h=(async()=>{Je(typeof e.lazy=="function","No lazy route function found");let b=await e.lazy(),k={};for(let C in b){let N=b[C];if(N===void 0)continue;let j=zv(C),P=l[C]!==void 0&&C!=="hasErrorBoundary";j?Ft(!j,"Route property "+C+" is not a supported property to be returned from a lazy route function. This property will be ignored."):P?Ft(!P,`Route "${l.id}" has a static property "${C}" defined but its lazy function is also returning a value for this property. The lazy route property "${C}" will be ignored.`):k[C]=N}Object.assign(l,k),Object.assign(l,{...s(l),lazy:void 0})})();return O0.set(l,h),h.catch(()=>{}),{lazyRoutePromise:h,lazyHandlerPromise:h}}let d=Object.keys(e.lazy),f=[],m;for(let y of d){if(o&&o.includes(y))continue;let h=a1({key:y,route:e,manifest:a,mapRouteProperties:s});h&&(f.push(h),y===n&&(m=h))}let g=f.length>0?Promise.all(f).then(()=>{}):void 0;return g==null||g.catch(()=>{}),m==null||m.catch(()=>{}),{lazyRoutePromise:g,lazyHandlerPromise:m}}async function B0(e){let n=e.matches.filter(o=>o.shouldLoad),a={};return(await Promise.all(n.map(o=>o.resolve()))).forEach((o,l)=>{a[n[l].route.id]=o}),a}async function Sb(e){return e.matches.some(n=>n.route.middleware)?s1(e,()=>B0(e)):B0(e)}function s1(e,n){return jb(e,n,s=>{if(Ab(s))throw s;return s},_b,a);function a(s,o,l){if(l)return Promise.resolve(Object.assign(l.value,{[o]:{type:"error",result:s}}));{let{matches:d}=e,f=Math.min(Math.max(d.findIndex(g=>g.route.id===o),0),Math.max(d.findIndex(g=>g.shouldCallHandler()),0)),m=ga(d,d[f].route.id).route.id;return Promise.resolve({[m]:{type:"error",result:s}})}}}async function jb(e,n,a,s,o){let{matches:l,...d}=e,f=l.flatMap(g=>g.route.middleware?g.route.middleware.map(y=>[g.route.id,y]):[]);return await i1(d,f,n,a,s,o)}async function i1(e,n,a,s,o,l,d=0){let{request:f}=e;if(f.signal.aborted)throw f.signal.reason??new Error(`Request aborted: ${f.method} ${f.url}`);let m=n[d];if(!m)return await a();let[g,y]=m,h,b=async()=>{if(h)throw new Error("You may only call `next()` once per middleware");try{return h={value:await i1(e,n,a,s,o,l,d+1)},h.value}catch(k){return h={value:await l(k,g,h)},h.value}};try{let k=await y(e,b),C=k!=null?s(k):void 0;return o(C)?C:h?C??h.value:(h={value:await b()},h.value)}catch(k){return await l(k,g,h)}}function o1(e,n,a,s,o){let l=a1({key:"middleware",route:s.route,manifest:n,mapRouteProperties:e}),d=kb(s.route,hn(a.method)?"action":"loader",n,e,o);return{middleware:l,route:d.lazyRoutePromise,handler:d.lazyHandlerPromise}}function wd(e,n,a,s,o,l,d,f,m,g=null,y){let h=!1,b=o1(e,n,a,l,d);return{...l,_lazyPromises:b,shouldLoad:m,shouldRevalidateArgs:g,shouldCallHandler(k){return h=!0,g?typeof y=="boolean"?Pi(l,{...g,defaultShouldRevalidate:y}):typeof k=="boolean"?Pi(l,{...g,defaultShouldRevalidate:k}):Pi(l,g):m},resolve(k){let{lazy:C,loader:N,middleware:j}=l.route,M=h||m||k&&!hn(a.method)&&(C||N),P=j&&j.length>0&&!N&&!C;return M&&(hn(a.method)||!P)?Nb({request:a,path:s,pattern:o,match:l,lazyHandlerPromise:b==null?void 0:b.handler,lazyRoutePromise:b==null?void 0:b.route,handlerOverride:k,scopedContext:f}):Promise.resolve({type:"data",result:void 0})}}}function Rs(e,n,a,s,o,l,d,f,m=null){return o.map(g=>g.route.id!==l.route.id?{...g,shouldLoad:!1,shouldRevalidateArgs:m,shouldCallHandler:()=>!1,_lazyPromises:o1(e,n,a,g,d),resolve:()=>Promise.resolve({type:"data",result:void 0})}:wd(e,n,a,s,Hi(o),g,d,f,!0,m))}async function Cb(e,n,a,s,o,l,d){s.some(y=>{var h;return(h=y._lazyPromises)==null?void 0:h.middleware})&&await Promise.all(s.map(y=>{var h;return(h=y._lazyPromises)==null?void 0:h.middleware}));let f={request:n,url:l1(n,a),pattern:Hi(s),params:s[0].params,context:l,matches:s},g=await e({...f,fetcherKey:o,runClientMiddleware:y=>{let h=f;return s1(h,()=>y({...h,fetcherKey:o,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(s.flatMap(y=>{var h,b;return[(h=y._lazyPromises)==null?void 0:h.handler,(b=y._lazyPromises)==null?void 0:b.route]}))}catch{}return g}async function Nb({request:e,path:n,pattern:a,match:s,lazyHandlerPromise:o,lazyRoutePromise:l,handlerOverride:d,scopedContext:f}){let m,g,y=hn(e.method),h=y?"action":"loader",b=k=>{let C,N=new Promise((P,F)=>C=F);g=()=>C(),e.signal.addEventListener("abort",g);let j=P=>typeof k!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${h}" [routeId: ${s.route.id}]`)):k({request:e,url:l1(e,n),pattern:a,params:s.params,context:f},...P!==void 0?[P]:[]),M=(async()=>{try{return{type:"data",result:await(d?d(F=>j(F)):j())}}catch(P){return{type:"error",result:P}}})();return Promise.race([M,N])};try{let k=y?s.route.action:s.route.loader;if(o||l)if(k){let C,[N]=await Promise.all([b(k).catch(j=>{C=j}),o,l]);if(C!==void 0)throw C;m=N}else{await o;let C=y?s.route.action:s.route.loader;if(C)[m]=await Promise.all([b(C),l]);else if(h==="action"){let N=new URL(e.url),j=N.pathname+N.search;throw Xn(405,{method:e.method,pathname:j,routeId:s.route.id})}else return{type:"data",result:void 0}}else if(k)m=await b(k);else{let C=new URL(e.url),N=C.pathname+C.search;throw Xn(404,{pathname:N})}}catch(k){return{type:"error",result:k}}finally{g&&e.signal.removeEventListener("abort",g)}return m}async function Eb(e){let n=e.headers.get("Content-Type");return n&&/\bapplication\/json\b/.test(n)?e.body==null?null:e.json():e.text()}async function Tb(e){var s,o,l,d,f;let{result:n,type:a}=e;if(ef(n)){let m;try{m=await Eb(n)}catch(g){return{type:"error",error:g}}return a==="error"?{type:"error",error:new $i(n.status,n.statusText,m),statusCode:n.status,headers:n.headers}:{type:"data",data:m,statusCode:n.status,headers:n.headers}}return a==="error"?K0(n)?n.data instanceof Error?{type:"error",error:n.data,statusCode:(s=n.init)==null?void 0:s.status,headers:(o=n.init)!=null&&o.headers?new Headers(n.init.headers):void 0}:{type:"error",error:Ib(n),statusCode:Li(n)?n.status:void 0,headers:(l=n.init)!=null&&l.headers?new Headers(n.init.headers):void 0}:{type:"error",error:n,statusCode:Li(n)?n.status:void 0}:K0(n)?{type:"data",data:n.data,statusCode:(d=n.init)==null?void 0:d.status,headers:(f=n.init)!=null&&f.headers?new Headers(n.init.headers):void 0}:{type:"data",data:n}}function Pb(e,n,a,s,o){let l=e.headers.get("Location");if(Je(l,"Redirects returned/thrown from loaders/actions must have a Location header"),!qd(l)){let d=s.slice(0,s.findIndex(f=>f.route.id===a)+1);l=bd(new URL(n.url),d,o,l),e.headers.set("Location",l)}return e}var z0=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function V0(e,n,a,s){if(qd(e)){let o=e,l=o.startsWith("//")?new URL(n.protocol+o):new URL(o);if(z0.includes(l.protocol))throw new Error("Invalid redirect location");let d=er(l.pathname,a)!=null;if(l.origin===n.origin&&d)return Qd(l.pathname)+l.search+l.hash}try{let o=s.createURL(e);if(z0.includes(o.protocol))throw new Error("Invalid redirect location")}catch{}return e}function ks(e,n,a,s){let o=e.createURL(c1(n)).toString(),l={signal:a};if(s&&hn(s.formMethod)){let{formMethod:d,formEncType:f}=s;l.method=d.toUpperCase(),f==="application/json"?(l.headers=new Headers({"Content-Type":f}),l.body=JSON.stringify(s.json)):f==="text/plain"?l.body=s.text:f==="application/x-www-form-urlencoded"&&s.formData?l.body=kd(s.formData):l.body=s.formData}return new Request(o,l)}function l1(e,n){let a=new URL(e.url),s=typeof n=="string"?_r(n):n;if(a.pathname=s.pathname||"/",s.search){let o=new URLSearchParams(s.search),l=o.getAll("index");o.delete("index");for(let d of l.filter(Boolean))o.append("index",d);a.search=o.size?`?${o.toString()}`:""}else a.search="";return a.hash=s.hash||"",a}function kd(e){let n=new URLSearchParams;for(let[a,s]of e.entries())n.append(a,typeof s=="string"?s:s.name);return n}function U0(e){let n=new FormData;for(let[a,s]of e.entries())n.append(a,s);return n}function Rb(e,n,a,s=!1,o=!1){let l={},d=null,f,m=!1,g={},y=a&&On(a[1])?a[1].error:void 0;return e.forEach(h=>{if(!(h.route.id in n))return;let b=h.route.id,k=n[b];if(Je(!Ua(k),"Cannot handle redirect results in processLoaderData"),On(k)){let C=k.error;if(y!==void 0&&(C=y,y=void 0),d=d||{},o)d[b]=C;else{let N=ga(e,b);d[N.route.id]==null&&(d[N.route.id]=C)}s||(l[b]=t1),m||(m=!0,f=Li(k.error)?k.error.status:500),k.headers&&(g[b]=k.headers)}else l[b]=k.data,k.statusCode&&k.statusCode!==200&&!m&&(f=k.statusCode),k.headers&&(g[b]=k.headers)}),y!==void 0&&a&&(d={[a[0]]:y},a[2]&&(l[a[2]]=void 0)),{loaderData:l,errors:d,statusCode:f||200,loaderHeaders:g}}function $0(e,n,a,s,o,l,d){let{loaderData:f,errors:m}=Rb(n,a,s);return o.filter(g=>!g.matches||g.matches.some(y=>y.shouldLoad)).forEach(g=>{let{key:y,match:h,controller:b}=g;if(b&&b.signal.aborted)return;let k=l[y];if(Je(k,"Did not find corresponding fetcher result"),On(k)){let C=ga(e.matches,h==null?void 0:h.route.id);m&&m[C.route.id]||(m={...m,[C.route.id]:k.error}),d.delete(y)}else if(Ua(k))Je(!1,"Unhandled fetcher revalidation redirect");else{let C=Nr(k.data);d.set(y,C)}}),{loaderData:f,errors:m}}function H0(e,n,a,s){let o=Object.entries(n).filter(([,l])=>l!==t1).reduce((l,[d,f])=>(l[d]=f,l),{});for(let l of a){let d=l.route.id;if(!n.hasOwnProperty(d)&&e.hasOwnProperty(d)&&l.route.loader&&(o[d]=e[d]),s&&s.hasOwnProperty(d))break}return o}function W0(e){return e?On(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function ga(e,n){return(n?e.slice(0,e.findIndex(s=>s.route.id===n)+1):[...e]).reverse().find(s=>s.route.hasErrorBoundary===!0)||e[0]}function rl(e){let n=e.length===1?e[0]:e.find(a=>a.index||!a.path||a.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:n}],route:n}}function Xn(e,{pathname:n,routeId:a,method:s,type:o,message:l}={}){let d="Unknown Server Error",f="Unknown @remix-run/router error";return e===400?(d="Bad Request",s&&n&&a?f=`You made a ${s} request to "${n}" but did not provide a \`loader\` for route "${a}", so there is no way to handle the request.`:o==="invalid-body"&&(f="Unable to encode submission body")):e===403?(d="Forbidden",f=`Route "${a}" does not match URL "${n}"`):e===404?(d="Not Found",f=`No route matches URL "${n}"`):e===405&&(d="Method Not Allowed",s&&n&&a?f=`You made a ${s.toUpperCase()} request to "${n}" but did not provide an \`action\` for route "${a}", so there is no way to handle the request.`:s&&(f=`Invalid request method "${s.toUpperCase()}"`)),new $i(e||500,d,new Error(f),!0)}function al(e){let n=Object.entries(e);for(let a=n.length-1;a>=0;a--){let[s,o]=n[a];if(Ua(o))return{key:s,result:o}}}function c1(e){let n=typeof e=="string"?_r(e):e;return Mr({...n,hash:""})}function Mb(e,n){return e.pathname!==n.pathname||e.search!==n.search?!1:e.hash===""?n.hash!=="":e.hash===n.hash?!0:n.hash!==""}function Ib(e){var n,a;return new $i(((n=e.init)==null?void 0:n.status)??500,((a=e.init)==null?void 0:a.statusText)??"Internal Server Error",e.data)}function _b(e){return e!=null&&typeof e=="object"&&Object.entries(e).every(([n,a])=>typeof n=="string"&&Fb(a))}function Fb(e){return e!=null&&typeof e=="object"&&"type"in e&&"result"in e&&(e.type==="data"||e.type==="error")}function Db(e){return ef(e.result)&&Zg.has(e.result.status)}function On(e){return e.type==="error"}function Ua(e){return(e&&e.type)==="redirect"}function K0(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function ef(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function Lb(e){return Zg.has(e)}function Ab(e){return ef(e)&&Lb(e.status)&&e.headers.has("Location")}function Ob(e){return hb.has(e.toUpperCase())}function hn(e){return db.has(e.toUpperCase())}function tf(e){return new URLSearchParams(e).getAll("index").some(n=>n==="")}function yl(e,n){let a=typeof n=="string"?_r(n).search:n.search;if(e[e.length-1].route.index&&tf(a||""))return e[e.length-1];let s=Gg(e);return s[s.length-1]}function Y0(e){let{formMethod:n,formAction:a,formEncType:s,text:o,formData:l,json:d}=e;if(!(!n||!a||!s)){if(o!=null)return{formMethod:n,formAction:a,formEncType:s,formData:void 0,json:void 0,text:o};if(l!=null)return{formMethod:n,formAction:a,formEncType:s,formData:l,json:void 0,text:void 0};if(d!==void 0)return{formMethod:n,formAction:a,formEncType:s,formData:void 0,json:d,text:void 0}}}function $u(e,n,a,s){return s?{state:"loading",location:e,matches:n,historyAction:a,formMethod:s.formMethod,formAction:s.formAction,formEncType:s.formEncType,formData:s.formData,json:s.json,text:s.text}:{state:"loading",location:e,matches:n,historyAction:a,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function Bb(e,n,a,s){return{state:"submitting",location:e,matches:n,historyAction:a,formMethod:s.formMethod,formAction:s.formAction,formEncType:s.formEncType,formData:s.formData,json:s.json,text:s.text}}function ki(e,n){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:n}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:n}}function zb(e,n){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:n?n.data:void 0}}function Nr(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function Vb(e,n){try{let a=e.sessionStorage.getItem(e1);if(a){let s=JSON.parse(a);for(let[o,l]of Object.entries(s||{}))l&&Array.isArray(l)&&n.set(o,new Set(l||[]))}}catch{}}function Ub(e,n){if(n.size>0){let a={};for(let[s,o]of n)a[s]=[...o];try{e.sessionStorage.setItem(e1,JSON.stringify(a))}catch(s){Ft(!1,`Failed to save applied view transitions in sessionStorage (${s}).`)}}}function G0(){let e,n,a=new Promise((s,o)=>{e=async l=>{s(l);try{await a}catch{}},n=async l=>{o(l);try{await a}catch{}}});return{promise:a,resolve:e,reject:n}}var Ya=v.createContext(null);Ya.displayName="DataRouter";var Wi=v.createContext(null);Wi.displayName="DataRouterState";var u1=v.createContext(!1);function d1(){return v.useContext(u1)}var nf=v.createContext({isTransitioning:!1});nf.displayName="ViewTransition";var f1=v.createContext(new Map);f1.displayName="Fetchers";var $b=v.createContext(null);$b.displayName="Await";var zn=v.createContext(null);zn.displayName="Navigation";var Kl=v.createContext(null);Kl.displayName="Location";var tr=v.createContext({outlet:null,matches:[],isDataRoute:!1});tr.displayName="Route";var rf=v.createContext(null);rf.displayName="RouteError";var h1="REACT_ROUTER_ERROR",Hb="REDIRECT",Wb="ROUTE_ERROR_RESPONSE";function Kb(e){if(e.startsWith(`${h1}:${Hb}:{`))try{let n=JSON.parse(e.slice(28));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.location=="string"&&typeof n.reloadDocument=="boolean"&&typeof n.replace=="boolean")return n}catch{}}function Yb(e){if(e.startsWith(`${h1}:${Wb}:{`))try{let n=JSON.parse(e.slice(40));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string")return new $i(n.status,n.statusText,n.data)}catch{}}function Gb(e,{relative:n}={}){Je(As(),"useHref() may be used only in the context of a <Router> component.");let{basename:a,navigator:s}=v.useContext(zn),{hash:o,pathname:l,search:d}=Ki(e,{relative:n}),f=l;return a!=="/"&&(f=l==="/"?a:Qn([a,l])),s.createHref({pathname:f,search:d,hash:o})}function As(){return v.useContext(Kl)!=null}function Ut(){return Je(As(),"useLocation() may be used only in the context of a <Router> component."),v.useContext(Kl).location}var p1="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function m1(e){v.useContext(zn).static||v.useLayoutEffect(e)}function mn(){let{isDataRoute:e}=v.useContext(tr);return e?c5():Xb()}function Xb(){Je(As(),"useNavigate() may be used only in the context of a <Router> component.");let e=v.useContext(Ya),{basename:n,navigator:a}=v.useContext(zn),{matches:s}=v.useContext(tr),{pathname:o}=Ut(),l=JSON.stringify(Wl(s)),d=v.useRef(!1);return m1(()=>{d.current=!0}),v.useCallback((m,g={})=>{if(Ft(d.current,p1),!d.current)return;if(typeof m=="number"){a.go(m);return}let y=Ui(m,JSON.parse(l),o,g.relative==="path");e==null&&n!=="/"&&(y.pathname=y.pathname==="/"?n:Qn([n,y.pathname])),(g.replace?a.replace:a.push)(y,g.state,g)},[n,a,l,o,e])}var Jb=v.createContext(null);function qb(e){let n=v.useContext(tr).outlet;return v.useMemo(()=>n&&v.createElement(Jb.Provider,{value:e},n),[n,e])}function Yl(){let{matches:e}=v.useContext(tr),n=e[e.length-1];return(n==null?void 0:n.params)??{}}function Ki(e,{relative:n}={}){let{matches:a}=v.useContext(tr),{pathname:s}=Ut(),o=JSON.stringify(Wl(a));return v.useMemo(()=>Ui(e,JSON.parse(o),s,n==="path"),[e,o,s,n])}function Qb(e,n,a){Je(As(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=v.useContext(zn),{matches:o}=v.useContext(tr),l=o[o.length-1],d=l?l.params:{},f=l?l.pathname:"/",m=l?l.pathnameBase:"/",g=l&&l.route;{let j=g&&g.path||"";x1(f,!g||j.endsWith("*")||j.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${j}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
Please change the parent <Route path="${j}"> to <Route path="${j==="/"?"*":`${j}/*`}">.`)}let y=Ut(),h;h=y;let b=h.pathname||"/",k=b;if(m!=="/"){let j=m.replace(/^\//,"").split("/");k="/"+b.replace(/^\//,"").split("/").slice(j.length).join("/")}let C=a&&a.state.matches.length?a.state.matches.map(j=>Object.assign(j,{route:a.manifest[j.route.id]||j.route})):$g(e,{pathname:k});return Ft(g||C!=null,`No routes matched location "${h.pathname}${h.search}${h.hash}" `),Ft(C==null||C[C.length-1].route.element!==void 0||C[C.length-1].route.Component!==void 0||C[C.length-1].route.lazy!==void 0,`Matched leaf route at location "${h.pathname}${h.search}${h.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),r5(C&&C.map(j=>Object.assign({},j,{params:Object.assign({},d,j.params),pathname:Qn([m,s.encodeLocation?s.encodeLocation(j.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:j.pathname]),pathnameBase:j.pathnameBase==="/"?m:Qn([m,s.encodeLocation?s.encodeLocation(j.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:j.pathnameBase])})),o,a)}function Zb(){let e=l5(),n=Li(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),a=e instanceof Error?e.stack:null,s="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:s},l={padding:"2px 4px",backgroundColor:s},d=null;return console.error("Error handled by React Router default ErrorBoundary:",e),d=v.createElement(v.Fragment,null,v.createElement("p",null,"💿 Hey developer 👋"),v.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",v.createElement("code",{style:l},"ErrorBoundary")," or"," ",v.createElement("code",{style:l},"errorElement")," prop on your route.")),v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},n),a?v.createElement("pre",{style:o},a):null,d)}var e5=v.createElement(Zb,null),g1=class extends v.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){this.props.onError?this.props.onError(e,n):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const a=Yb(e.digest);a&&(e=a)}let n=e!==void 0?v.createElement(tr.Provider,{value:this.props.routeContext},v.createElement(rf.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?v.createElement(t5,{error:e},n):n}};g1.contextType=u1;var Hu=new WeakMap;function t5({children:e,error:n}){let{basename:a}=v.useContext(zn);if(typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){let s=Kb(n.digest);if(s){let o=Hu.get(n);if(o)throw o;let l=Jg(s.location,a);if(Xg&&!Hu.get(n))if(l.isExternal||s.reloadDocument)window.location.href=l.absoluteURL||l.to;else{const d=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(l.to,{replace:s.replace}));throw Hu.set(n,d),d}return v.createElement("meta",{httpEquiv:"refresh",content:`0;url=${l.absoluteURL||l.to}`})}}return e}function n5({routeContext:e,match:n,children:a}){let s=v.useContext(Ya);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),v.createElement(tr.Provider,{value:e},a)}function r5(e,n=[],a){let s=a==null?void 0:a.state;if(e==null){if(!s)return null;if(s.errors)e=s.matches;else if(n.length===0&&!s.initialized&&s.matches.length>0)e=s.matches;else return null}let o=e,l=s==null?void 0:s.errors;if(l!=null){let y=o.findIndex(h=>h.route.id&&(l==null?void 0:l[h.route.id])!==void 0);Je(y>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(l).join(",")}`),o=o.slice(0,Math.min(o.length,y+1))}let d=!1,f=-1;if(a&&s){d=s.renderFallback;for(let y=0;y<o.length;y++){let h=o[y];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(f=y),h.route.id){let{loaderData:b,errors:k}=s,C=h.route.loader&&!b.hasOwnProperty(h.route.id)&&(!k||k[h.route.id]===void 0);if(h.route.lazy||C){a.isStatic&&(d=!0),f>=0?o=o.slice(0,f+1):o=[o[0]];break}}}}let m=a==null?void 0:a.onError,g=s&&m?(y,h)=>{var b,k;m(y,{location:s.location,params:((k=(b=s.matches)==null?void 0:b[0])==null?void 0:k.params)??{},pattern:Hi(s.matches),errorInfo:h})}:void 0;return o.reduceRight((y,h,b)=>{let k,C=!1,N=null,j=null;s&&(k=l&&h.route.id?l[h.route.id]:void 0,N=h.route.errorElement||e5,d&&(f<0&&b===0?(x1("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),C=!0,j=null):f===b&&(C=!0,j=h.route.hydrateFallbackElement||null)));let M=n.concat(o.slice(0,b+1)),P=()=>{let F;return k?F=N:C?F=j:h.route.Component?F=v.createElement(h.route.Component,null):h.route.element?F=h.route.element:F=y,v.createElement(n5,{match:h,routeContext:{outlet:y,matches:M,isDataRoute:s!=null},children:F})};return s&&(h.route.ErrorBoundary||h.route.errorElement||b===0)?v.createElement(g1,{location:s.location,revalidation:s.revalidation,component:N,error:k,children:P(),routeContext:{outlet:null,matches:M,isDataRoute:!0},onError:g}):P()},null)}function af(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function a5(e){let n=v.useContext(Ya);return Je(n,af(e)),n}function y1(e){let n=v.useContext(Wi);return Je(n,af(e)),n}function s5(e){let n=v.useContext(tr);return Je(n,af(e)),n}function sf(e){let n=s5(e),a=n.matches[n.matches.length-1];return Je(a.route.id,`${e} can only be used on routes that contain a unique "id"`),a.route.id}function i5(){return sf("useRouteId")}function o5(){let{matches:e,loaderData:n}=y1("useMatches");return v.useMemo(()=>e.map(a=>Hg(a,n)),[e,n])}function l5(){var s;let e=v.useContext(rf),n=y1("useRouteError"),a=sf("useRouteError");return e!==void 0?e:(s=n.errors)==null?void 0:s[a]}function c5(){let{router:e}=a5("useNavigate"),n=sf("useNavigate"),a=v.useRef(!1);return m1(()=>{a.current=!0}),v.useCallback(async(o,l={})=>{Ft(a.current,p1),a.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:n,...l}))},[e,n])}var X0={};function x1(e,n,a){!n&&!X0[e]&&(X0[e]=!0,Ft(!1,a))}var J0={};function q0(e,n){!e&&!J0[n]&&(J0[n]=!0,console.warn(n))}var u5="useOptimistic",Q0=_v[u5],d5=()=>{};function f5(e){return Q0?Q0(e):[e,d5]}function h5(e){let n={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&Ft(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(n,{element:v.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&Ft(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(n,{hydrateFallbackElement:v.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&Ft(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(n,{errorElement:v.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),n}var p5=["HydrateFallback","hydrateFallbackElement"],m5=class{constructor(){this.status="pending",this.promise=new Promise((e,n)=>{this.resolve=a=>{this.status==="pending"&&(this.status="resolved",e(a))},this.reject=a=>{this.status==="pending"&&(this.status="rejected",n(a))}})}};function g5({router:e,flushSync:n,onError:a,useTransitions:s}){s=d1()||s;let[l,d]=v.useState(e.state),[f,m]=f5(l),[g,y]=v.useState(),[h,b]=v.useState({isTransitioning:!1}),[k,C]=v.useState(),[N,j]=v.useState(),[M,P]=v.useState(),F=v.useRef(new Map),U=v.useCallback((w,{deletedFetchers:R,newErrors:E,flushSync:Y,viewTransitionOpts:K})=>{E&&a&&Object.values(E).forEach($=>{var ee;return a($,{location:w.location,params:((ee=w.matches[0])==null?void 0:ee.params)??{},pattern:Hi(w.matches)})}),w.fetchers.forEach(($,ee)=>{$.data!==void 0&&F.current.set(ee,$.data)}),R.forEach($=>F.current.delete($)),q0(Y===!1||n!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let I=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition=="function";if(q0(K==null||I,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!K||!I){n&&Y?n(()=>d(w)):s===!1?d(w):v.startTransition(()=>{s===!0&&m($=>Z0($,w)),d(w)});return}if(n&&Y){n(()=>{N&&(k==null||k.resolve(),N.skipTransition()),b({isTransitioning:!0,flushSync:!0,currentLocation:K.currentLocation,nextLocation:K.nextLocation})});let $=e.window.document.startViewTransition(()=>{n(()=>d(w))});$.finished.finally(()=>{n(()=>{C(void 0),j(void 0),y(void 0),b({isTransitioning:!1})})}),n(()=>j($));return}N?(k==null||k.resolve(),N.skipTransition(),P({state:w,currentLocation:K.currentLocation,nextLocation:K.nextLocation})):(y(w),b({isTransitioning:!0,flushSync:!1,currentLocation:K.currentLocation,nextLocation:K.nextLocation}))},[e.window,n,N,k,s,m,a]);v.useLayoutEffect(()=>e.subscribe(U),[e,U]),v.useEffect(()=>{h.isTransitioning&&!h.flushSync&&C(new m5)},[h]),v.useEffect(()=>{if(k&&g&&e.window){let w=g,R=k.promise,E=e.window.document.startViewTransition(async()=>{s===!1?d(w):v.startTransition(()=>{s===!0&&m(Y=>Z0(Y,w)),d(w)}),await R});E.finished.finally(()=>{C(void 0),j(void 0),y(void 0),b({isTransitioning:!1})}),j(E)}},[g,k,e.window,s,m]),v.useEffect(()=>{k&&g&&f.location.key===g.location.key&&k.resolve()},[k,N,f.location,g]),v.useEffect(()=>{!h.isTransitioning&&M&&(y(M.state),b({isTransitioning:!0,flushSync:!1,currentLocation:M.currentLocation,nextLocation:M.nextLocation}),P(void 0))},[h.isTransitioning,M]);let W=v.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:w=>e.navigate(w),push:(w,R,E)=>e.navigate(w,{state:R,preventScrollReset:E==null?void 0:E.preventScrollReset}),replace:(w,R,E)=>e.navigate(w,{replace:!0,state:R,preventScrollReset:E==null?void 0:E.preventScrollReset})}),[e]),J=e.basename||"/",A=v.useMemo(()=>({router:e,navigator:W,static:!1,basename:J,onError:a}),[e,W,J,a]);return v.createElement(v.Fragment,null,v.createElement(Ya.Provider,{value:A},v.createElement(Wi.Provider,{value:f},v.createElement(f1.Provider,{value:F.current},v.createElement(nf.Provider,{value:h},v.createElement(v5,{basename:J,location:f.location,navigationType:f.historyAction,navigator:W,useTransitions:s},v.createElement(y5,{routes:e.routes,manifest:e.manifest,future:e.future,state:f,isStatic:!1,onError:a})))))),null)}function Z0(e,n){return{...e,navigation:n.navigation.state!=="idle"?n.navigation:e.navigation,revalidation:n.revalidation!=="idle"?n.revalidation:e.revalidation,actionData:n.navigation.state!=="submitting"?n.actionData:e.actionData,fetchers:n.fetchers}}var y5=v.memo(x5);function x5({routes:e,manifest:n,future:a,state:s,isStatic:o,onError:l}){return Qb(e,void 0,{manifest:n,state:s,isStatic:o,onError:l})}function v1({to:e,replace:n,state:a,relative:s}){Je(As(),"<Navigate> may be used only in the context of a <Router> component.");let{static:o}=v.useContext(zn);Ft(!o,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:l}=v.useContext(tr),{pathname:d}=Ut(),f=mn(),m=Ui(e,Wl(l),d,s==="path"),g=JSON.stringify(m);return v.useEffect(()=>{f(JSON.parse(g),{replace:n,state:a,relative:s})},[f,g,s,n,a]),null}function v5({basename:e="/",children:n=null,location:a,navigationType:s="POP",navigator:o,static:l=!1,useTransitions:d}){Je(!As(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),m=v.useMemo(()=>({basename:f,navigator:o,static:l,useTransitions:d,future:{}}),[f,o,l,d]);typeof a=="string"&&(a=_r(a));let{pathname:g="/",search:y="",hash:h="",state:b=null,key:k="default",mask:C}=a,N=v.useMemo(()=>{let j=er(g,f);return j==null?null:{location:{pathname:j,search:y,hash:h,state:b,key:k,mask:C},navigationType:s}},[f,g,y,h,b,k,s,C]);return Ft(N!=null,`<Router basename="${f}"> is not able to match the URL "${g}${y}${h}" because it does not start with the basename, so the <Router> won't render anything.`),N==null?null:v.createElement(zn.Provider,{value:m},v.createElement(Kl.Provider,{children:n,value:N}))}var xl="get",vl="application/x-www-form-urlencoded";function Gl(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function b5(e){return Gl(e)&&e.tagName.toLowerCase()==="button"}function w5(e){return Gl(e)&&e.tagName.toLowerCase()==="form"}function k5(e){return Gl(e)&&e.tagName.toLowerCase()==="input"}function S5(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function j5(e,n){return e.button===0&&(!n||n==="_self")&&!S5(e)}function Sd(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((n,a)=>{let s=e[a];return n.concat(Array.isArray(s)?s.map(o=>[a,o]):[[a,s]])},[]))}function C5(e,n){let a=Sd(e);return n&&n.forEach((s,o)=>{a.has(o)||n.getAll(o).forEach(l=>{a.append(o,l)})}),a}var sl=null;function N5(){if(sl===null)try{new FormData(document.createElement("form"),0),sl=!1}catch{sl=!0}return sl}var E5=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Wu(e){return e!=null&&!E5.has(e)?(Ft(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${vl}"`),null):e}function T5(e,n){let a,s,o,l,d;if(w5(e)){let f=e.getAttribute("action");s=f?er(f,n):null,a=e.getAttribute("method")||xl,o=Wu(e.getAttribute("enctype"))||vl,l=new FormData(e)}else if(b5(e)||k5(e)&&(e.type==="submit"||e.type==="image")){let f=e.form;if(f==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=e.getAttribute("formaction")||f.getAttribute("action");if(s=m?er(m,n):null,a=e.getAttribute("formmethod")||f.getAttribute("method")||xl,o=Wu(e.getAttribute("formenctype"))||Wu(f.getAttribute("enctype"))||vl,l=new FormData(f,e),!N5()){let{name:g,type:y,value:h}=e;if(y==="image"){let b=g?`${g}.`:"";l.append(`${b}x`,"0"),l.append(`${b}y`,"0")}else g&&l.append(g,h)}}else{if(Gl(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');a=xl,s=null,o=vl,d=e}return l&&o==="text/plain"&&(d=l,l=void 0),{action:s,method:a.toLowerCase(),encType:o,formData:l,body:d}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function of(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function b1(e,n,a,s){let o=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return a?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${s}`:o.pathname=`${o.pathname}.${s}`:o.pathname==="/"?o.pathname=`_root.${s}`:n&&er(o.pathname,n)==="/"?o.pathname=`${Ml(n)}/_root.${s}`:o.pathname=`${Ml(o.pathname)}.${s}`,o}async function P5(e,n){if(e.id in n)return n[e.id];try{let a=await import(e.module);return n[e.id]=a,a}catch(a){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(a),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function R5(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function M5(e,n,a){let s=await Promise.all(e.map(async o=>{let l=n.routes[o.route.id];if(l){let d=await P5(l,a);return d.links?d.links():[]}return[]}));return D5(s.flat(1).filter(R5).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function em(e,n,a,s,o,l){let d=(m,g)=>a[g]?m.route.id!==a[g].route.id:!0,f=(m,g)=>{var y;return a[g].pathname!==m.pathname||((y=a[g].route.path)==null?void 0:y.endsWith("*"))&&a[g].params["*"]!==m.params["*"]};return l==="assets"?n.filter((m,g)=>d(m,g)||f(m,g)):l==="data"?n.filter((m,g)=>{var h;let y=s.routes[m.route.id];if(!y||!y.hasLoader)return!1;if(d(m,g)||f(m,g))return!0;if(m.route.shouldRevalidate){let b=m.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:((h=a[0])==null?void 0:h.params)||{},nextUrl:new URL(e,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function I5(e,n,{includeHydrateFallback:a}={}){return _5(e.map(s=>{let o=n.routes[s.route.id];if(!o)return[];let l=[o.module];return o.clientActionModule&&(l=l.concat(o.clientActionModule)),o.clientLoaderModule&&(l=l.concat(o.clientLoaderModule)),a&&o.hydrateFallbackModule&&(l=l.concat(o.hydrateFallbackModule)),o.imports&&(l=l.concat(o.imports)),l}).flat(1))}function _5(e){return[...new Set(e)]}function F5(e){let n={},a=Object.keys(e).sort();for(let s of a)n[s]=e[s];return n}function D5(e,n){let a=new Set;return new Set(n),e.reduce((s,o)=>{let l=JSON.stringify(F5(o));return a.has(l)||(a.add(l),s.push({key:l,link:o})),s},[])}function lf(){let e=v.useContext(Ya);return of(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function L5(){let e=v.useContext(Wi);return of(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var cf=v.createContext(void 0);cf.displayName="FrameworkContext";function uf(){let e=v.useContext(cf);return of(e,"You must render this element inside a <HydratedRouter> element"),e}function A5(e,n){let a=v.useContext(cf),[s,o]=v.useState(!1),[l,d]=v.useState(!1),{onFocus:f,onBlur:m,onMouseEnter:g,onMouseLeave:y,onTouchStart:h}=n,b=v.useRef(null);v.useEffect(()=>{if(e==="render"&&d(!0),e==="viewport"){let N=M=>{M.forEach(P=>{d(P.isIntersecting)})},j=new IntersectionObserver(N,{threshold:.5});return b.current&&j.observe(b.current),()=>{j.disconnect()}}},[e]),v.useEffect(()=>{if(s){let N=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(N)}}},[s]);let k=()=>{o(!0)},C=()=>{o(!1),d(!1)};return a?e!=="intent"?[l,b,{}]:[l,b,{onFocus:Si(f,k),onBlur:Si(m,C),onMouseEnter:Si(g,k),onMouseLeave:Si(y,C),onTouchStart:Si(h,k)}]:[!1,b,{}]}function Si(e,n){return a=>{e&&e(a),a.defaultPrevented||n(a)}}function O5({page:e,...n}){let a=d1(),{router:s}=lf(),o=v.useMemo(()=>$g(s.routes,e,s.basename),[s.routes,e,s.basename]);return o?a?v.createElement(z5,{page:e,matches:o,...n}):v.createElement(V5,{page:e,matches:o,...n}):null}function B5(e){let{manifest:n,routeModules:a}=uf(),[s,o]=v.useState([]);return v.useEffect(()=>{let l=!1;return M5(e,n,a).then(d=>{l||o(d)}),()=>{l=!0}},[e,n,a]),s}function z5({page:e,matches:n,...a}){let s=Ut(),{future:o}=uf(),{basename:l}=lf(),d=v.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let f=b1(e,l,o.unstable_trailingSlashAwareDataRequests,"rsc"),m=!1,g=[];for(let y of n)typeof y.route.shouldRevalidate=="function"?m=!0:g.push(y.route.id);return m&&g.length>0&&f.searchParams.set("_routes",g.join(",")),[f.pathname+f.search]},[l,o.unstable_trailingSlashAwareDataRequests,e,s,n]);return v.createElement(v.Fragment,null,d.map(f=>v.createElement("link",{key:f,rel:"prefetch",as:"fetch",href:f,...a})))}function V5({page:e,matches:n,...a}){let s=Ut(),{future:o,manifest:l,routeModules:d}=uf(),{basename:f}=lf(),{loaderData:m,matches:g}=L5(),y=v.useMemo(()=>em(e,n,g,l,s,"data"),[e,n,g,l,s]),h=v.useMemo(()=>em(e,n,g,l,s,"assets"),[e,n,g,l,s]),b=v.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let N=new Set,j=!1;if(n.forEach(P=>{var U;let F=l.routes[P.route.id];!F||!F.hasLoader||(!y.some(W=>W.route.id===P.route.id)&&P.route.id in m&&((U=d[P.route.id])!=null&&U.shouldRevalidate)||F.hasClientLoader?j=!0:N.add(P.route.id))}),N.size===0)return[];let M=b1(e,f,o.unstable_trailingSlashAwareDataRequests,"data");return j&&N.size>0&&M.searchParams.set("_routes",n.filter(P=>N.has(P.route.id)).map(P=>P.route.id).join(",")),[M.pathname+M.search]},[f,o.unstable_trailingSlashAwareDataRequests,m,s,l,y,n,e,d]),k=v.useMemo(()=>I5(h,l),[h,l]),C=B5(h);return v.createElement(v.Fragment,null,b.map(N=>v.createElement("link",{key:N,rel:"prefetch",as:"fetch",href:N,...a})),k.map(N=>v.createElement("link",{key:N,rel:"modulepreload",href:N,...a})),C.map(({key:N,link:j})=>v.createElement("link",{key:N,nonce:a.nonce,...j,crossOrigin:j.crossOrigin??a.crossOrigin})))}function U5(...e){return n=>{e.forEach(a=>{typeof a=="function"?a(n):a!=null&&(a.current=n)})}}var $5=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{$5&&(window.__reactRouterVersion="7.15.1")}catch{}function H5(e,n){return xb({basename:n==null?void 0:n.basename,getContext:n==null?void 0:n.getContext,future:n==null?void 0:n.future,history:Fv({window:n==null?void 0:n.window}),hydrationData:W5(),routes:e,mapRouteProperties:h5,hydrationRouteProperties:p5,dataStrategy:n==null?void 0:n.dataStrategy,patchRoutesOnNavigation:n==null?void 0:n.patchRoutesOnNavigation,window:n==null?void 0:n.window,instrumentations:n==null?void 0:n.instrumentations}).initialize()}function W5(){let e=window==null?void 0:window.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:K5(e.errors)}),e}function K5(e){if(!e)return null;let n=Object.entries(e),a={};for(let[s,o]of n)if(o&&o.__type==="RouteErrorResponse")a[s]=new $i(o.status,o.statusText,o.data,o.internal===!0);else if(o&&o.__type==="Error"){if(o.__subType){let l=window[o.__subType];if(typeof l=="function")try{let d=new l(o.message);d.stack="",a[s]=d}catch{}}if(a[s]==null){let l=new Error(o.message);l.stack="",a[s]=l}}else a[s]=o;return a}var w1=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,k1=v.forwardRef(function({onClick:n,discover:a="render",prefetch:s="none",relative:o,reloadDocument:l,replace:d,mask:f,state:m,target:g,to:y,preventScrollReset:h,viewTransition:b,defaultShouldRevalidate:k,...C},N){let{basename:j,navigator:M,useTransitions:P}=v.useContext(zn),F=typeof y=="string"&&w1.test(y),U=Jg(y,j);y=U.to;let W=Gb(y,{relative:o}),J=Ut(),A=null;if(f){let ee=Ui(f,[],J.mask?J.mask.pathname:"/",!0);j!=="/"&&(ee.pathname=ee.pathname==="/"?j:Qn([j,ee.pathname])),A=M.createHref(ee)}let[w,R,E]=A5(s,C),Y=X5(y,{replace:d,mask:f,state:m,target:g,preventScrollReset:h,relative:o,viewTransition:b,defaultShouldRevalidate:k,useTransitions:P});function K(ee){n&&n(ee),ee.defaultPrevented||Y(ee)}let I=!(U.isExternal||l),$=v.createElement("a",{...C,...E,href:(I?A:void 0)||U.absoluteURL||W,onClick:I?K:n,ref:U5(N,R),target:g,"data-discover":!F&&a==="render"?"true":void 0});return w&&!F?v.createElement(v.Fragment,null,$,v.createElement(O5,{page:W})):$});k1.displayName="Link";var S1=v.forwardRef(function({"aria-current":n="page",caseSensitive:a=!1,className:s="",end:o=!1,style:l,to:d,viewTransition:f,children:m,...g},y){let h=Ki(d,{relative:g.relative}),b=Ut(),k=v.useContext(Wi),{navigator:C,basename:N}=v.useContext(zn),j=k!=null&&tw(h)&&f===!0,M=C.encodeLocation?C.encodeLocation(h).pathname:h.pathname,P=b.pathname,F=k&&k.navigation&&k.navigation.location?k.navigation.location.pathname:null;a||(P=P.toLowerCase(),F=F?F.toLowerCase():null,M=M.toLowerCase()),F&&N&&(F=er(F,N)||F);const U=M!=="/"&&M.endsWith("/")?M.length-1:M.length;let W=P===M||!o&&P.startsWith(M)&&P.charAt(U)==="/",J=F!=null&&(F===M||!o&&F.startsWith(M)&&F.charAt(M.length)==="/"),A={isActive:W,isPending:J,isTransitioning:j},w=W?n:void 0,R;typeof s=="function"?R=s(A):R=[s,W?"active":null,J?"pending":null,j?"transitioning":null].filter(Boolean).join(" ");let E=typeof l=="function"?l(A):l;return v.createElement(k1,{...g,"aria-current":w,className:R,ref:y,style:E,to:d,viewTransition:f},typeof m=="function"?m(A):m)});S1.displayName="NavLink";var Y5=v.forwardRef(({discover:e="render",fetcherKey:n,navigate:a,reloadDocument:s,replace:o,state:l,method:d=xl,action:f,onSubmit:m,relative:g,preventScrollReset:y,viewTransition:h,defaultShouldRevalidate:b,...k},C)=>{let{useTransitions:N}=v.useContext(zn),j=Z5(),M=ew(f,{relative:g}),P=d.toLowerCase()==="get"?"get":"post",F=typeof f=="string"&&w1.test(f),U=W=>{if(m&&m(W),W.defaultPrevented)return;W.preventDefault();let J=W.nativeEvent.submitter,A=(J==null?void 0:J.getAttribute("formmethod"))||d,w=()=>j(J||W.currentTarget,{fetcherKey:n,method:A,navigate:a,replace:o,state:l,relative:g,preventScrollReset:y,viewTransition:h,defaultShouldRevalidate:b});N&&a!==!1?v.startTransition(()=>w()):w()};return v.createElement("form",{ref:C,method:P,action:M,onSubmit:s?m:U,...k,"data-discover":!F&&e==="render"?"true":void 0})});Y5.displayName="Form";function G5(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function j1(e){let n=v.useContext(Ya);return Je(n,G5(e)),n}function X5(e,{target:n,replace:a,mask:s,state:o,preventScrollReset:l,relative:d,viewTransition:f,defaultShouldRevalidate:m,useTransitions:g}={}){let y=mn(),h=Ut(),b=Ki(e,{relative:d});return v.useCallback(k=>{if(j5(k,n)){k.preventDefault();let C=a!==void 0?a:Mr(h)===Mr(b),N=()=>y(e,{replace:C,mask:s,state:o,preventScrollReset:l,relative:d,viewTransition:f,defaultShouldRevalidate:m});g?v.startTransition(()=>N()):N()}},[h,y,b,a,s,o,n,e,l,d,f,m,g])}function J5(e){Ft(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let n=v.useRef(Sd(e)),a=v.useRef(!1),s=Ut(),o=v.useMemo(()=>C5(s.search,a.current?null:n.current),[s.search]),l=mn(),d=v.useCallback((f,m)=>{const g=Sd(typeof f=="function"?f(new URLSearchParams(o)):f);a.current=!0,l("?"+g,m)},[l,o]);return[o,d]}var q5=0,Q5=()=>`__${String(++q5)}__`;function Z5(){let{router:e}=j1("useSubmit"),{basename:n}=v.useContext(zn),a=i5(),s=e.fetch,o=e.navigate;return v.useCallback(async(l,d={})=>{let{action:f,method:m,encType:g,formData:y,body:h}=T5(l,n);if(d.navigate===!1){let b=d.fetcherKey||Q5();await s(b,a,d.action||f,{defaultShouldRevalidate:d.defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:y,body:h,formMethod:d.method||m,formEncType:d.encType||g,flushSync:d.flushSync})}else await o(d.action||f,{defaultShouldRevalidate:d.defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:y,body:h,formMethod:d.method||m,formEncType:d.encType||g,replace:d.replace,state:d.state,fromRouteId:a,flushSync:d.flushSync,viewTransition:d.viewTransition})},[s,o,n,a])}function ew(e,{relative:n}={}){let{basename:a}=v.useContext(zn),s=v.useContext(tr);Je(s,"useFormAction must be used inside a RouteContext");let[o]=s.matches.slice(-1),l={...Ki(e||".",{relative:n})},d=Ut();if(e==null){l.search=d.search;let f=new URLSearchParams(l.search),m=f.getAll("index");if(m.some(y=>y==="")){f.delete("index"),m.filter(h=>h).forEach(h=>f.append("index",h));let y=f.toString();l.search=y?`?${y}`:""}}return(!e||e===".")&&o.route.index&&(l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index"),a!=="/"&&(l.pathname=l.pathname==="/"?a:Qn([a,l.pathname])),Mr(l)}function tw(e,{relative:n}={}){let a=v.useContext(nf);Je(a!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=j1("useViewTransitionState"),o=Ki(e,{relative:n});if(!a.isTransitioning)return!1;let l=er(a.currentLocation.pathname,s)||a.currentLocation.pathname,d=er(a.nextLocation.pathname,s)||a.nextLocation.pathname;return Rl(o.pathname,d)!=null||Rl(o.pathname,l)!=null}var df=Bg();const nw=Og(df);function rw(e){return v.createElement(g5,{flushSync:df.flushSync,...e})}const nt="http://141.11.1.189",C1=()=>!!localStorage.getItem("accessToken"),aw=()=>{const e=localStorage.getItem("userInfo");if(!e)return null;try{return JSON.parse(e)}catch{return null}},Ga=()=>localStorage.getItem("accessToken"),sw=()=>localStorage.getItem("username"),iw=async()=>{const e=Ga();if(e)try{await fetch(`${nt}/api/logout`,{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8",Authorization:`Bearer ${e}`},body:""})}catch(n){console.error("خطا در logout از سرور:",n)}localStorage.removeItem("accessToken"),localStorage.removeItem("refreshToken"),localStorage.removeItem("userId"),localStorage.removeItem("username"),localStorage.removeItem("userInfo"),localStorage.removeItem("userProfile")},ow=()=>C1()?!0:(localStorage.removeItem("accessToken"),localStorage.removeItem("refreshToken"),localStorage.removeItem("userId"),localStorage.removeItem("username"),localStorage.removeItem("userInfo"),localStorage.removeItem("userProfile"),!1);function N1({children:e}){const n=Ut();return ow()?u.jsx(u.Fragment,{children:e}):u.jsx(v1,{to:"/login",replace:!0,state:{from:n,error:"لطفاً ابتدا وارد سیستم شوید"}})}const ff=v.createContext({});function hf(e){const n=v.useRef(null);return n.current===null&&(n.current=e()),n.current}const lw=typeof window<"u",E1=lw?v.useLayoutEffect:v.useEffect,Xl=v.createContext(null);function pf(e,n){e.indexOf(n)===-1&&e.push(n)}function Il(e,n){const a=e.indexOf(n);a>-1&&e.splice(a,1)}const Ir=(e,n,a)=>a>n?n:a<e?e:a;let mf=()=>{};const ka={},T1=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function P1(e){return typeof e=="object"&&e!==null}const R1=e=>/^0[^.\s]+$/u.test(e);function M1(e){let n;return()=>(n===void 0&&(n=e()),n)}const Zn=e=>e,cw=(e,n)=>a=>n(e(a)),Yi=(...e)=>e.reduce(cw),Ai=(e,n,a)=>{const s=n-e;return s===0?1:(a-e)/s};class gf{constructor(){this.subscriptions=[]}add(n){return pf(this.subscriptions,n),()=>Il(this.subscriptions,n)}notify(n,a,s){const o=this.subscriptions.length;if(o)if(o===1)this.subscriptions[0](n,a,s);else for(let l=0;l<o;l++){const d=this.subscriptions[l];d&&d(n,a,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Bn=e=>e*1e3,Jn=e=>e/1e3;function I1(e,n){return n?e*(1e3/n):0}const _1=(e,n,a)=>(((1-3*a+3*n)*e+(3*a-6*n))*e+3*n)*e,uw=1e-7,dw=12;function fw(e,n,a,s,o){let l,d,f=0;do d=n+(a-n)/2,l=_1(d,s,o)-e,l>0?a=d:n=d;while(Math.abs(l)>uw&&++f<dw);return d}function Gi(e,n,a,s){if(e===n&&a===s)return Zn;const o=l=>fw(l,0,1,e,a);return l=>l===0||l===1?l:_1(o(l),n,s)}const F1=e=>n=>n<=.5?e(2*n)/2:(2-e(2*(1-n)))/2,D1=e=>n=>1-e(1-n),L1=Gi(.33,1.53,.69,.99),yf=D1(L1),A1=F1(yf),O1=e=>e>=1?1:(e*=2)<1?.5*yf(e):.5*(2-Math.pow(2,-10*(e-1))),xf=e=>1-Math.sin(Math.acos(e)),B1=D1(xf),z1=F1(xf),hw=Gi(.42,0,1,1),pw=Gi(0,0,.58,1),V1=Gi(.42,0,.58,1),mw=e=>Array.isArray(e)&&typeof e[0]!="number",U1=e=>Array.isArray(e)&&typeof e[0]=="number",gw={linear:Zn,easeIn:hw,easeInOut:V1,easeOut:pw,circIn:xf,circInOut:z1,circOut:B1,backIn:yf,backInOut:A1,backOut:L1,anticipate:O1},yw=e=>typeof e=="string",tm=e=>{if(U1(e)){mf(e.length===4);const[n,a,s,o]=e;return Gi(n,a,s,o)}else if(yw(e))return gw[e];return e},il=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function xw(e,n){let a=new Set,s=new Set,o=!1,l=!1;const d=new WeakSet;let f={delta:0,timestamp:0,isProcessing:!1};function m(y){d.has(y)&&(g.schedule(y),e()),y(f)}const g={schedule:(y,h=!1,b=!1)=>{const C=b&&o?a:s;return h&&d.add(y),C.add(y),y},cancel:y=>{s.delete(y),d.delete(y)},process:y=>{if(f=y,o){l=!0;return}o=!0;const h=a;a=s,s=h,a.forEach(m),a.clear(),o=!1,l&&(l=!1,g.process(y))}};return g}const vw=40;function $1(e,n){let a=!1,s=!0;const o={delta:0,timestamp:0,isProcessing:!1},l=()=>a=!0,d=il.reduce((F,U)=>(F[U]=xw(l),F),{}),{setup:f,read:m,resolveKeyframes:g,preUpdate:y,update:h,preRender:b,render:k,postRender:C}=d,N=()=>{const F=ka.useManualTiming,U=F?o.timestamp:performance.now();a=!1,F||(o.delta=s?1e3/60:Math.max(Math.min(U-o.timestamp,vw),1)),o.timestamp=U,o.isProcessing=!0,f.process(o),m.process(o),g.process(o),y.process(o),h.process(o),b.process(o),k.process(o),C.process(o),o.isProcessing=!1,a&&n&&(s=!1,e(N))},j=()=>{a=!0,s=!0,o.isProcessing||e(N)};return{schedule:il.reduce((F,U)=>{const W=d[U];return F[U]=(J,A=!1,w=!1)=>(a||j(),W.schedule(J,A,w)),F},{}),cancel:F=>{for(let U=0;U<il.length;U++)d[il[U]].cancel(F)},state:o,steps:d}}const{schedule:yt,cancel:Sa,state:nn,steps:Ku}=$1(typeof requestAnimationFrame<"u"?requestAnimationFrame:Zn,!0);let bl;function bw(){bl=void 0}const bn={now:()=>(bl===void 0&&bn.set(nn.isProcessing||ka.useManualTiming?nn.timestamp:performance.now()),bl),set:e=>{bl=e,queueMicrotask(bw)}},H1=e=>n=>typeof n=="string"&&n.startsWith(e),W1=H1("--"),ww=H1("var(--"),vf=e=>ww(e)?kw.test(e.split("/*")[0].trim()):!1,kw=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function nm(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const Os={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Oi={...Os,transform:e=>Ir(0,1,e)},ol={...Os,default:1},Ri=e=>Math.round(e*1e5)/1e5,bf=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Sw(e){return e==null}const jw=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,wf=(e,n)=>a=>!!(typeof a=="string"&&jw.test(a)&&a.startsWith(e)||n&&!Sw(a)&&Object.prototype.hasOwnProperty.call(a,n)),K1=(e,n,a)=>s=>{if(typeof s!="string")return s;const[o,l,d,f]=s.match(bf);return{[e]:parseFloat(o),[n]:parseFloat(l),[a]:parseFloat(d),alpha:f!==void 0?parseFloat(f):1}},Cw=e=>Ir(0,255,e),Yu={...Os,transform:e=>Math.round(Cw(e))},$a={test:wf("rgb","red"),parse:K1("red","green","blue"),transform:({red:e,green:n,blue:a,alpha:s=1})=>"rgba("+Yu.transform(e)+", "+Yu.transform(n)+", "+Yu.transform(a)+", "+Ri(Oi.transform(s))+")"};function Nw(e){let n="",a="",s="",o="";return e.length>5?(n=e.substring(1,3),a=e.substring(3,5),s=e.substring(5,7),o=e.substring(7,9)):(n=e.substring(1,2),a=e.substring(2,3),s=e.substring(3,4),o=e.substring(4,5),n+=n,a+=a,s+=s,o+=o),{red:parseInt(n,16),green:parseInt(a,16),blue:parseInt(s,16),alpha:o?parseInt(o,16)/255:1}}const jd={test:wf("#"),parse:Nw,transform:$a.transform},Xi=e=>({test:n=>typeof n=="string"&&n.endsWith(e)&&n.split(" ").length===1,parse:parseFloat,transform:n=>`${n}${e}`}),pa=Xi("deg"),Rr=Xi("%"),Ee=Xi("px"),Ew=Xi("vh"),Tw=Xi("vw"),rm={...Rr,parse:e=>Rr.parse(e)/100,transform:e=>Rr.transform(e*100)},Ns={test:wf("hsl","hue"),parse:K1("hue","saturation","lightness"),transform:({hue:e,saturation:n,lightness:a,alpha:s=1})=>"hsla("+Math.round(e)+", "+Rr.transform(Ri(n))+", "+Rr.transform(Ri(a))+", "+Ri(Oi.transform(s))+")"},Vt={test:e=>$a.test(e)||jd.test(e)||Ns.test(e),parse:e=>$a.test(e)?$a.parse(e):Ns.test(e)?Ns.parse(e):jd.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?$a.transform(e):Ns.transform(e),getAnimatableNone:e=>{const n=Vt.parse(e);return n.alpha=0,Vt.transform(n)}},Pw=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Rw(e){var n,a;return isNaN(e)&&typeof e=="string"&&(((n=e.match(bf))==null?void 0:n.length)||0)+(((a=e.match(Pw))==null?void 0:a.length)||0)>0}const Y1="number",G1="color",Mw="var",Iw="var(",am="${}",_w=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function _s(e){const n=e.toString(),a=[],s={color:[],number:[],var:[]},o=[];let l=0;const f=n.replace(_w,m=>(Vt.test(m)?(s.color.push(l),o.push(G1),a.push(Vt.parse(m))):m.startsWith(Iw)?(s.var.push(l),o.push(Mw),a.push(m)):(s.number.push(l),o.push(Y1),a.push(parseFloat(m))),++l,am)).split(am);return{values:a,split:f,indexes:s,types:o}}function Fw(e){return _s(e).values}function X1({split:e,types:n}){const a=e.length;return s=>{let o="";for(let l=0;l<a;l++)if(o+=e[l],s[l]!==void 0){const d=n[l];d===Y1?o+=Ri(s[l]):d===G1?o+=Vt.transform(s[l]):o+=s[l]}return o}}function Dw(e){return X1(_s(e))}const Lw=e=>typeof e=="number"?0:Vt.test(e)?Vt.getAnimatableNone(e):e,Aw=(e,n)=>typeof e=="number"?n!=null&&n.trim().endsWith("/")?e:0:Lw(e);function Ow(e){const n=_s(e);return X1(n)(n.values.map((s,o)=>Aw(s,n.split[o])))}const pr={test:Rw,parse:Fw,createTransformer:Dw,getAnimatableNone:Ow};function Gu(e,n,a){return a<0&&(a+=1),a>1&&(a-=1),a<1/6?e+(n-e)*6*a:a<1/2?n:a<2/3?e+(n-e)*(2/3-a)*6:e}function Bw({hue:e,saturation:n,lightness:a,alpha:s}){e/=360,n/=100,a/=100;let o=0,l=0,d=0;if(!n)o=l=d=a;else{const f=a<.5?a*(1+n):a+n-a*n,m=2*a-f;o=Gu(m,f,e+1/3),l=Gu(m,f,e),d=Gu(m,f,e-1/3)}return{red:Math.round(o*255),green:Math.round(l*255),blue:Math.round(d*255),alpha:s}}function _l(e,n){return a=>a>0?n:e}const Nt=(e,n,a)=>e+(n-e)*a,Xu=(e,n,a)=>{const s=e*e,o=a*(n*n-s)+s;return o<0?0:Math.sqrt(o)},zw=[jd,$a,Ns],Vw=e=>zw.find(n=>n.test(e));function sm(e){const n=Vw(e);if(!n)return!1;let a=n.parse(e);return n===Ns&&(a=Bw(a)),a}const im=(e,n)=>{const a=sm(e),s=sm(n);if(!a||!s)return _l(e,n);const o={...a};return l=>(o.red=Xu(a.red,s.red,l),o.green=Xu(a.green,s.green,l),o.blue=Xu(a.blue,s.blue,l),o.alpha=Nt(a.alpha,s.alpha,l),$a.transform(o))},Cd=new Set(["none","hidden"]);function Uw(e,n){return Cd.has(e)?a=>a<=0?e:n:a=>a>=1?n:e}function $w(e,n){return a=>Nt(e,n,a)}function kf(e){return typeof e=="number"?$w:typeof e=="string"?vf(e)?_l:Vt.test(e)?im:Kw:Array.isArray(e)?J1:typeof e=="object"?Vt.test(e)?im:Hw:_l}function J1(e,n){const a=[...e],s=a.length,o=e.map((l,d)=>kf(l)(l,n[d]));return l=>{for(let d=0;d<s;d++)a[d]=o[d](l);return a}}function Hw(e,n){const a={...e,...n},s={};for(const o in a)e[o]!==void 0&&n[o]!==void 0&&(s[o]=kf(e[o])(e[o],n[o]));return o=>{for(const l in s)a[l]=s[l](o);return a}}function Ww(e,n){const a=[],s={color:0,var:0,number:0};for(let o=0;o<n.values.length;o++){const l=n.types[o],d=e.indexes[l][s[l]],f=e.values[d]??0;a[o]=f,s[l]++}return a}const Kw=(e,n)=>{const a=pr.createTransformer(n),s=_s(e),o=_s(n);return s.indexes.var.length===o.indexes.var.length&&s.indexes.color.length===o.indexes.color.length&&s.indexes.number.length>=o.indexes.number.length?Cd.has(e)&&!o.values.length||Cd.has(n)&&!s.values.length?Uw(e,n):Yi(J1(Ww(s,o),o.values),a):_l(e,n)};function q1(e,n,a){return typeof e=="number"&&typeof n=="number"&&typeof a=="number"?Nt(e,n,a):kf(e)(e,n)}const Yw=e=>{const n=({timestamp:a})=>e(a);return{start:(a=!0)=>yt.update(n,a),stop:()=>Sa(n),now:()=>nn.isProcessing?nn.timestamp:bn.now()}},Q1=(e,n,a=10)=>{let s="";const o=Math.max(Math.round(n/a),2);for(let l=0;l<o;l++)s+=Math.round(e(l/(o-1))*1e4)/1e4+", ";return`linear(${s.substring(0,s.length-2)})`},Fl=2e4;function Sf(e){let n=0;const a=50;let s=e.next(n);for(;!s.done&&n<Fl;)n+=a,s=e.next(n);return n>=Fl?1/0:n}function Gw(e,n=100,a){const s=a({...e,keyframes:[0,n]}),o=Math.min(Sf(s),Fl);return{type:"keyframes",ease:l=>s.next(o*l).value/n,duration:Jn(o)}}const _t={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function Nd(e,n){return e*Math.sqrt(1-n*n)}const Xw=12;function Jw(e,n,a){let s=a;for(let o=1;o<Xw;o++)s=s-e(s)/n(s);return s}const Ju=.001;function qw({duration:e=_t.duration,bounce:n=_t.bounce,velocity:a=_t.velocity,mass:s=_t.mass}){let o,l,d=1-n;d=Ir(_t.minDamping,_t.maxDamping,d),e=Ir(_t.minDuration,_t.maxDuration,Jn(e)),d<1?(o=g=>{const y=g*d,h=y*e,b=y-a,k=Nd(g,d),C=Math.exp(-h);return Ju-b/k*C},l=g=>{const h=g*d*e,b=h*a+a,k=Math.pow(d,2)*Math.pow(g,2)*e,C=Math.exp(-h),N=Nd(Math.pow(g,2),d);return(-o(g)+Ju>0?-1:1)*((b-k)*C)/N}):(o=g=>{const y=Math.exp(-g*e),h=(g-a)*e+1;return-Ju+y*h},l=g=>{const y=Math.exp(-g*e),h=(a-g)*(e*e);return y*h});const f=5/e,m=Jw(o,l,f);if(e=Bn(e),isNaN(m))return{stiffness:_t.stiffness,damping:_t.damping,duration:e};{const g=Math.pow(m,2)*s;return{stiffness:g,damping:d*2*Math.sqrt(s*g),duration:e}}}const Qw=["duration","bounce"],Zw=["stiffness","damping","mass"];function om(e,n){return n.some(a=>e[a]!==void 0)}function e3(e){let n={velocity:_t.velocity,stiffness:_t.stiffness,damping:_t.damping,mass:_t.mass,isResolvedFromDuration:!1,...e};if(!om(e,Zw)&&om(e,Qw))if(n.velocity=0,e.visualDuration){const a=e.visualDuration,s=2*Math.PI/(a*1.2),o=s*s,l=2*Ir(.05,1,1-(e.bounce||0))*Math.sqrt(o);n={...n,mass:_t.mass,stiffness:o,damping:l}}else{const a=qw({...e,velocity:0});n={...n,...a,mass:_t.mass},n.isResolvedFromDuration=!0}return n}function Dl(e=_t.visualDuration,n=_t.bounce){const a=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:n}:e;let{restSpeed:s,restDelta:o}=a;const l=a.keyframes[0],d=a.keyframes[a.keyframes.length-1],f={done:!1,value:l},{stiffness:m,damping:g,mass:y,duration:h,velocity:b,isResolvedFromDuration:k}=e3({...a,velocity:-Jn(a.velocity||0)}),C=b||0,N=g/(2*Math.sqrt(m*y)),j=d-l,M=Jn(Math.sqrt(m/y)),P=Math.abs(j)<5;s||(s=P?_t.restSpeed.granular:_t.restSpeed.default),o||(o=P?_t.restDelta.granular:_t.restDelta.default);let F,U,W,J,A,w;if(N<1)W=Nd(M,N),J=(C+N*M*j)/W,F=E=>{const Y=Math.exp(-N*M*E);return d-Y*(J*Math.sin(W*E)+j*Math.cos(W*E))},A=N*M*J+j*W,w=N*M*j-J*W,U=E=>Math.exp(-N*M*E)*(A*Math.sin(W*E)+w*Math.cos(W*E));else if(N===1){F=Y=>d-Math.exp(-M*Y)*(j+(C+M*j)*Y);const E=C+M*j;U=Y=>Math.exp(-M*Y)*(M*E*Y-C)}else{const E=M*Math.sqrt(N*N-1);F=$=>{const ee=Math.exp(-N*M*$),G=Math.min(E*$,300);return d-ee*((C+N*M*j)*Math.sinh(G)+E*j*Math.cosh(G))/E};const Y=(C+N*M*j)/E,K=N*M*Y-j*E,I=N*M*j-Y*E;U=$=>{const ee=Math.exp(-N*M*$),G=Math.min(E*$,300);return ee*(K*Math.sinh(G)+I*Math.cosh(G))}}const R={calculatedDuration:k&&h||null,velocity:E=>Bn(U(E)),next:E=>{if(!k&&N<1){const K=Math.exp(-N*M*E),I=Math.sin(W*E),$=Math.cos(W*E),ee=d-K*(J*I+j*$),G=Bn(K*(A*I+w*$));return f.done=Math.abs(G)<=s&&Math.abs(d-ee)<=o,f.value=f.done?d:ee,f}const Y=F(E);if(k)f.done=E>=h;else{const K=Bn(U(E));f.done=Math.abs(K)<=s&&Math.abs(d-Y)<=o}return f.value=f.done?d:Y,f},toString:()=>{const E=Math.min(Sf(R),Fl),Y=Q1(K=>R.next(E*K).value,E,30);return E+"ms "+Y},toTransition:()=>{}};return R}Dl.applyToOptions=e=>{const n=Gw(e,100,Dl);return e.ease=n.ease,e.duration=Bn(n.duration),e.type="keyframes",e};const t3=5;function Z1(e,n,a){const s=Math.max(n-t3,0);return I1(a-e(s),n-s)}function Ed({keyframes:e,velocity:n=0,power:a=.8,timeConstant:s=325,bounceDamping:o=10,bounceStiffness:l=500,modifyTarget:d,min:f,max:m,restDelta:g=.5,restSpeed:y}){const h=e[0],b={done:!1,value:h},k=w=>f!==void 0&&w<f||m!==void 0&&w>m,C=w=>f===void 0?m:m===void 0||Math.abs(f-w)<Math.abs(m-w)?f:m;let N=a*n;const j=h+N,M=d===void 0?j:d(j);M!==j&&(N=M-h);const P=w=>-N*Math.exp(-w/s),F=w=>M+P(w),U=w=>{const R=P(w),E=F(w);b.done=Math.abs(R)<=g,b.value=b.done?M:E};let W,J;const A=w=>{k(b.value)&&(W=w,J=Dl({keyframes:[b.value,C(b.value)],velocity:Z1(F,w,b.value),damping:o,stiffness:l,restDelta:g,restSpeed:y}))};return A(0),{calculatedDuration:null,next:w=>{let R=!1;return!J&&W===void 0&&(R=!0,U(w),A(w)),W!==void 0&&w>=W?J.next(w-W):(!R&&U(w),b)}}}function n3(e,n,a){const s=[],o=a||ka.mix||q1,l=e.length-1;for(let d=0;d<l;d++){let f=o(e[d],e[d+1]);if(n){const m=Array.isArray(n)?n[d]||Zn:n;f=Yi(m,f)}s.push(f)}return s}function r3(e,n,{clamp:a=!0,ease:s,mixer:o}={}){const l=e.length;if(mf(l===n.length),l===1)return()=>n[0];if(l===2&&n[0]===n[1])return()=>n[1];const d=e[0]===e[1];e[0]>e[l-1]&&(e=[...e].reverse(),n=[...n].reverse());const f=n3(n,s,o),m=f.length,g=y=>{if(d&&y<e[0])return n[0];let h=0;if(m>1)for(;h<e.length-2&&!(y<e[h+1]);h++);const b=Ai(e[h],e[h+1],y);return f[h](b)};return a?y=>g(Ir(e[0],e[l-1],y)):g}function a3(e,n){const a=e[e.length-1];for(let s=1;s<=n;s++){const o=Ai(0,n,s);e.push(Nt(a,1,o))}}function s3(e){const n=[0];return a3(n,e.length-1),n}function i3(e,n){return e.map(a=>a*n)}function o3(e,n){return e.map(()=>n||V1).splice(0,e.length-1)}function Mi({duration:e=300,keyframes:n,times:a,ease:s="easeInOut"}){const o=mw(s)?s.map(tm):tm(s),l={done:!1,value:n[0]},d=i3(a&&a.length===n.length?a:s3(n),e),f=r3(d,n,{ease:Array.isArray(o)?o:o3(n,o)});return{calculatedDuration:e,next:m=>(l.value=f(m),l.done=m>=e,l)}}const l3=e=>e!==null;function Jl(e,{repeat:n,repeatType:a="loop"},s,o=1){const l=e.filter(l3),f=o<0||n&&a!=="loop"&&n%2===1?0:l.length-1;return!f||s===void 0?l[f]:s}const c3={decay:Ed,inertia:Ed,tween:Mi,keyframes:Mi,spring:Dl};function ey(e){typeof e.type=="string"&&(e.type=c3[e.type])}class jf{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(n=>{this.resolve=n})}notifyFinished(){this.resolve()}then(n,a){return this.finished.then(n,a)}}const u3=e=>e/100;class Ll extends jf{constructor(n){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{var s,o;const{motionValue:a}=this.options;a&&a.updatedAt!==bn.now()&&this.tick(bn.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(o=(s=this.options).onStop)==null||o.call(s))},this.options=n,this.initAnimation(),this.play(),n.autoplay===!1&&this.pause()}initAnimation(){const{options:n}=this;ey(n);const{type:a=Mi,repeat:s=0,repeatDelay:o=0,repeatType:l,velocity:d=0}=n;let{keyframes:f}=n;const m=a||Mi;m!==Mi&&typeof f[0]!="number"&&(this.mixKeyframes=Yi(u3,q1(f[0],f[1])),f=[0,100]);const g=m({...n,keyframes:f});l==="mirror"&&(this.mirroredGenerator=m({...n,keyframes:[...f].reverse(),velocity:-d})),g.calculatedDuration===null&&(g.calculatedDuration=Sf(g));const{calculatedDuration:y}=g;this.calculatedDuration=y,this.resolvedDuration=y+o,this.totalDuration=this.resolvedDuration*(s+1)-o,this.generator=g}updateTime(n){const a=Math.round(n-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=a}tick(n,a=!1){const{generator:s,totalDuration:o,mixKeyframes:l,mirroredGenerator:d,resolvedDuration:f,calculatedDuration:m}=this;if(this.startTime===null)return s.next(0);const{delay:g=0,keyframes:y,repeat:h,repeatType:b,repeatDelay:k,type:C,onUpdate:N,finalKeyframe:j}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,n):this.speed<0&&(this.startTime=Math.min(n-o/this.speed,this.startTime)),a?this.currentTime=n:this.updateTime(n);const M=this.currentTime-g*(this.playbackSpeed>=0?1:-1),P=this.playbackSpeed>=0?M<0:M>o;this.currentTime=Math.max(M,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=o);let F=this.currentTime,U=s;if(h){const w=Math.min(this.currentTime,o)/f;let R=Math.floor(w),E=w%1;!E&&w>=1&&(E=1),E===1&&R--,R=Math.min(R,h+1),!!(R%2)&&(b==="reverse"?(E=1-E,k&&(E-=k/f)):b==="mirror"&&(U=d)),F=Ir(0,1,E)*f}let W;P?(this.delayState.value=y[0],W=this.delayState):W=U.next(F),l&&!P&&(W.value=l(W.value));let{done:J}=W;!P&&m!==null&&(J=this.playbackSpeed>=0?this.currentTime>=o:this.currentTime<=0);const A=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&J);return A&&C!==Ed&&(W.value=Jl(y,this.options,j,this.speed)),N&&N(W.value),A&&this.finish(),W}then(n,a){return this.finished.then(n,a)}get duration(){return Jn(this.calculatedDuration)}get iterationDuration(){const{delay:n=0}=this.options||{};return this.duration+Jn(n)}get time(){return Jn(this.currentTime)}set time(n){n=Bn(n),this.currentTime=n,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=n:this.driver&&(this.startTime=this.driver.now()-n/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=n,this.tick(n))}getGeneratorVelocity(){const n=this.currentTime;if(n<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(n);const a=this.generator.next(n).value;return Z1(s=>this.generator.next(s).value,n,a)}get speed(){return this.playbackSpeed}set speed(n){const a=this.playbackSpeed!==n;a&&this.driver&&this.updateTime(bn.now()),this.playbackSpeed=n,a&&this.driver&&(this.time=Jn(this.currentTime))}play(){var o,l;if(this.isStopped)return;const{driver:n=Yw,startTime:a}=this.options;this.driver||(this.driver=n(d=>this.tick(d))),(l=(o=this.options).onPlay)==null||l.call(o);const s=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=s):this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime||(this.startTime=a??s),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(bn.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var n,a;this.notifyFinished(),this.teardown(),this.state="finished",(a=(n=this.options).onComplete)==null||a.call(n)}cancel(){var n,a;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(a=(n=this.options).onCancel)==null||a.call(n)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(n){return this.startTime=0,this.tick(n,!0)}attachTimeline(n){var a;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(a=this.driver)==null||a.stop(),n.observe(this)}}function d3(e){for(let n=1;n<e.length;n++)e[n]??(e[n]=e[n-1])}const Ha=e=>e*180/Math.PI,Td=e=>{const n=Ha(Math.atan2(e[1],e[0]));return Pd(n)},f3={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Td,rotateZ:Td,skewX:e=>Ha(Math.atan(e[1])),skewY:e=>Ha(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Pd=e=>(e=e%360,e<0&&(e+=360),e),lm=Td,cm=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),um=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),h3={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:cm,scaleY:um,scale:e=>(cm(e)+um(e))/2,rotateX:e=>Pd(Ha(Math.atan2(e[6],e[5]))),rotateY:e=>Pd(Ha(Math.atan2(-e[2],e[0]))),rotateZ:lm,rotate:lm,skewX:e=>Ha(Math.atan(e[4])),skewY:e=>Ha(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Rd(e){return e.includes("scale")?1:0}function Md(e,n){if(!e||e==="none")return Rd(n);const a=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let s,o;if(a)s=h3,o=a;else{const f=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);s=f3,o=f}if(!o)return Rd(n);const l=s[n],d=o[1].split(",").map(m3);return typeof l=="function"?l(d):d[l]}const p3=(e,n)=>{const{transform:a="none"}=getComputedStyle(e);return Md(a,n)};function m3(e){return parseFloat(e.trim())}const Bs=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],zs=new Set(Bs),dm=e=>e===Os||e===Ee,g3=new Set(["x","y","z"]),y3=Bs.filter(e=>!g3.has(e));function x3(e){const n=[];return y3.forEach(a=>{const s=e.getValue(a);s!==void 0&&(n.push([a,s.get()]),s.set(a.startsWith("scale")?1:0))}),n}const va={width:({x:e},{paddingLeft:n="0",paddingRight:a="0",boxSizing:s})=>{const o=e.max-e.min;return s==="border-box"?o:o-parseFloat(n)-parseFloat(a)},height:({y:e},{paddingTop:n="0",paddingBottom:a="0",boxSizing:s})=>{const o=e.max-e.min;return s==="border-box"?o:o-parseFloat(n)-parseFloat(a)},top:(e,{top:n})=>parseFloat(n),left:(e,{left:n})=>parseFloat(n),bottom:({y:e},{top:n})=>parseFloat(n)+(e.max-e.min),right:({x:e},{left:n})=>parseFloat(n)+(e.max-e.min),x:(e,{transform:n})=>Md(n,"x"),y:(e,{transform:n})=>Md(n,"y")};va.translateX=va.x;va.translateY=va.y;const Wa=new Set;let Id=!1,_d=!1,Fd=!1;function ty(){if(_d){const e=Array.from(Wa).filter(s=>s.needsMeasurement),n=new Set(e.map(s=>s.element)),a=new Map;n.forEach(s=>{const o=x3(s);o.length&&(a.set(s,o),s.render())}),e.forEach(s=>s.measureInitialState()),n.forEach(s=>{s.render();const o=a.get(s);o&&o.forEach(([l,d])=>{var f;(f=s.getValue(l))==null||f.set(d)})}),e.forEach(s=>s.measureEndState()),e.forEach(s=>{s.suspendedScrollY!==void 0&&window.scrollTo(0,s.suspendedScrollY)})}_d=!1,Id=!1,Wa.forEach(e=>e.complete(Fd)),Wa.clear()}function ny(){Wa.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(_d=!0)})}function v3(){Fd=!0,ny(),ty(),Fd=!1}class Cf{constructor(n,a,s,o,l,d=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...n],this.onComplete=a,this.name=s,this.motionValue=o,this.element=l,this.isAsync=d}scheduleResolve(){this.state="scheduled",this.isAsync?(Wa.add(this),Id||(Id=!0,yt.read(ny),yt.resolveKeyframes(ty))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:n,name:a,element:s,motionValue:o}=this;if(n[0]===null){const l=o==null?void 0:o.get(),d=n[n.length-1];if(l!==void 0)n[0]=l;else if(s&&a){const f=s.readValue(a,d);f!=null&&(n[0]=f)}n[0]===void 0&&(n[0]=d),o&&l===void 0&&o.set(n[0])}d3(n)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(n=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,n),Wa.delete(this)}cancel(){this.state==="scheduled"&&(Wa.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const b3=e=>e.startsWith("--");function ry(e,n,a){b3(n)?e.style.setProperty(n,a):e.style[n]=a}const w3={};function ay(e,n){const a=M1(e);return()=>w3[n]??a()}const k3=ay(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),sy=ay(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Ti=([e,n,a,s])=>`cubic-bezier(${e}, ${n}, ${a}, ${s})`,fm={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Ti([0,.65,.55,1]),circOut:Ti([.55,0,1,.45]),backIn:Ti([.31,.01,.66,-.59]),backOut:Ti([.33,1.53,.69,.99])};function iy(e,n){if(e)return typeof e=="function"?sy()?Q1(e,n):"ease-out":U1(e)?Ti(e):Array.isArray(e)?e.map(a=>iy(a,n)||fm.easeOut):fm[e]}function S3(e,n,a,{delay:s=0,duration:o=300,repeat:l=0,repeatType:d="loop",ease:f="easeOut",times:m}={},g=void 0){const y={[n]:a};m&&(y.offset=m);const h=iy(f,o);Array.isArray(h)&&(y.easing=h);const b={delay:s,duration:o,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:l+1,direction:d==="reverse"?"alternate":"normal"};return g&&(b.pseudoElement=g),e.animate(y,b)}function oy(e){return typeof e=="function"&&"applyToOptions"in e}function j3({type:e,...n}){return oy(e)&&sy()?e.applyToOptions(n):(n.duration??(n.duration=300),n.ease??(n.ease="easeOut"),n)}class ly extends jf{constructor(n){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!n)return;const{element:a,name:s,keyframes:o,pseudoElement:l,allowFlatten:d=!1,finalKeyframe:f,onComplete:m}=n;this.isPseudoElement=!!l,this.allowFlatten=d,this.options=n,mf(typeof n.type!="string");const g=j3(n);this.animation=S3(a,s,o,g,l),g.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!l){const y=Jl(o,this.options,f,this.speed);this.updateMotionValue&&this.updateMotionValue(y),ry(a,s,y),this.animation.cancel()}m==null||m(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var n,a;(a=(n=this.animation).finish)==null||a.call(n)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:n}=this;n==="idle"||n==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var a,s,o;const n=(a=this.options)==null?void 0:a.element;!this.isPseudoElement&&(n!=null&&n.isConnected)&&((o=(s=this.animation).commitStyles)==null||o.call(s))}get duration(){var a,s;const n=((s=(a=this.animation.effect)==null?void 0:a.getComputedTiming)==null?void 0:s.call(a).duration)||0;return Jn(Number(n))}get iterationDuration(){const{delay:n=0}=this.options||{};return this.duration+Jn(n)}get time(){return Jn(Number(this.animation.currentTime)||0)}set time(n){const a=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Bn(n),a&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(n){n<0&&(this.finishedTime=null),this.animation.playbackRate=n}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(n){this.manualStartTime=this.animation.startTime=n}attachTimeline({timeline:n,rangeStart:a,rangeEnd:s,observe:o}){var l;return this.allowFlatten&&((l=this.animation.effect)==null||l.updateTiming({easing:"linear"})),this.animation.onfinish=null,n&&k3()?(this.animation.timeline=n,a&&(this.animation.rangeStart=a),s&&(this.animation.rangeEnd=s),Zn):o(this)}}const cy={anticipate:O1,backInOut:A1,circInOut:z1};function C3(e){return e in cy}function N3(e){typeof e.ease=="string"&&C3(e.ease)&&(e.ease=cy[e.ease])}const qu=10;class E3 extends ly{constructor(n){N3(n),ey(n),super(n),n.startTime!==void 0&&n.autoplay!==!1&&(this.startTime=n.startTime),this.options=n}updateMotionValue(n){const{motionValue:a,onUpdate:s,onComplete:o,element:l,...d}=this.options;if(!a)return;if(n!==void 0){a.set(n);return}const f=new Ll({...d,autoplay:!1}),m=Math.max(qu,bn.now()-this.startTime),g=Ir(0,qu,m-qu),y=f.sample(m).value,{name:h}=this.options;l&&h&&ry(l,h,y),a.setWithVelocity(f.sample(Math.max(0,m-g)).value,y,g),f.stop()}}const hm=(e,n)=>n==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(pr.test(e)||e==="0")&&!e.startsWith("url("));function T3(e){const n=e[0];if(e.length===1)return!0;for(let a=0;a<e.length;a++)if(e[a]!==n)return!0}function P3(e,n,a,s){const o=e[0];if(o===null)return!1;if(n==="display"||n==="visibility")return!0;const l=e[e.length-1],d=hm(o,n),f=hm(l,n);return!d||!f?!1:T3(e)||(a==="spring"||oy(a))&&s}function Dd(e){e.duration=0,e.type="keyframes"}const uy=new Set(["opacity","clipPath","filter","transform"]),R3=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function M3(e){for(let n=0;n<e.length;n++)if(typeof e[n]=="string"&&R3.test(e[n]))return!0;return!1}const I3=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),_3=M1(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function F3(e){var h;const{motionValue:n,name:a,repeatDelay:s,repeatType:o,damping:l,type:d,keyframes:f}=e;if(!(((h=n==null?void 0:n.owner)==null?void 0:h.current)instanceof HTMLElement))return!1;const{onUpdate:g,transformTemplate:y}=n.owner.getProps();return _3()&&a&&(uy.has(a)||I3.has(a)&&M3(f))&&(a!=="transform"||!y)&&!g&&!s&&o!=="mirror"&&l!==0&&d!=="inertia"}const D3=40;class L3 extends jf{constructor({autoplay:n=!0,delay:a=0,type:s="keyframes",repeat:o=0,repeatDelay:l=0,repeatType:d="loop",keyframes:f,name:m,motionValue:g,element:y,...h}){var C;super(),this.stop=()=>{var N,j;this._animation&&(this._animation.stop(),(N=this.stopTimeline)==null||N.call(this)),(j=this.keyframeResolver)==null||j.cancel()},this.createdAt=bn.now();const b={autoplay:n,delay:a,type:s,repeat:o,repeatDelay:l,repeatType:d,name:m,motionValue:g,element:y,...h},k=(y==null?void 0:y.KeyframeResolver)||Cf;this.keyframeResolver=new k(f,(N,j,M)=>this.onKeyframesResolved(N,j,b,!M),m,g,y),(C=this.keyframeResolver)==null||C.scheduleResolve()}onKeyframesResolved(n,a,s,o){var M,P;this.keyframeResolver=void 0;const{name:l,type:d,velocity:f,delay:m,isHandoff:g,onUpdate:y}=s;this.resolvedAt=bn.now();let h=!0;P3(n,l,d,f)||(h=!1,(ka.instantAnimations||!m)&&(y==null||y(Jl(n,s,a))),n[0]=n[n.length-1],Dd(s),s.repeat=0);const k={startTime:o?this.resolvedAt?this.resolvedAt-this.createdAt>D3?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:a,...s,keyframes:n},C=h&&!g&&F3(k),N=(P=(M=k.motionValue)==null?void 0:M.owner)==null?void 0:P.current;let j;if(C)try{j=new E3({...k,element:N})}catch{j=new Ll(k)}else j=new Ll(k);j.finished.then(()=>{this.notifyFinished()}).catch(Zn),this.pendingTimeline&&(this.stopTimeline=j.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=j}get finished(){return this._animation?this.animation.finished:this._finished}then(n,a){return this.finished.finally(n).then(()=>{})}get animation(){var n;return this._animation||((n=this.keyframeResolver)==null||n.resume(),v3()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(n){this.animation.time=n}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(n){this.animation.speed=n}get startTime(){return this.animation.startTime}attachTimeline(n){return this._animation?this.stopTimeline=this.animation.attachTimeline(n):this.pendingTimeline=n,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var n;this._animation&&this.animation.cancel(),(n=this.keyframeResolver)==null||n.cancel()}}function dy(e,n,a,s=0,o=1){const l=Array.from(e).sort((g,y)=>g.sortNodePosition(y)).indexOf(n),d=e.size,f=(d-1)*s;return typeof a=="function"?a(l,d):o===1?l*s:f-l*s}const A3=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function O3(e){const n=A3.exec(e);if(!n)return[,];const[,a,s,o]=n;return[`--${a??s}`,o]}function fy(e,n,a=1){const[s,o]=O3(e);if(!s)return;const l=window.getComputedStyle(n).getPropertyValue(s);if(l){const d=l.trim();return T1(d)?parseFloat(d):d}return vf(o)?fy(o,n,a+1):o}const B3={type:"spring",stiffness:500,damping:25,restSpeed:10},z3=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),V3={type:"keyframes",duration:.8},U3={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},$3=(e,{keyframes:n})=>n.length>2?V3:zs.has(e)?e.startsWith("scale")?z3(n[1]):B3:U3;function hy(e,n){if(e!=null&&e.inherit&&n){const{inherit:a,...s}=e;return{...n,...s}}return e}function Nf(e,n){const a=(e==null?void 0:e[n])??(e==null?void 0:e.default)??e;return a!==e?hy(a,e):a}const H3=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function W3(e){for(const n in e)if(!H3.has(n))return!0;return!1}const Ef=(e,n,a,s={},o,l)=>d=>{const f=Nf(s,e)||{},m=f.delay||s.delay||0;let{elapsed:g=0}=s;g=g-Bn(m);const y={keyframes:Array.isArray(a)?a:[null,a],ease:"easeOut",velocity:n.getVelocity(),...f,delay:-g,onUpdate:b=>{n.set(b),f.onUpdate&&f.onUpdate(b)},onComplete:()=>{d(),f.onComplete&&f.onComplete()},name:e,motionValue:n,element:l?void 0:o};W3(f)||Object.assign(y,$3(e,y)),y.duration&&(y.duration=Bn(y.duration)),y.repeatDelay&&(y.repeatDelay=Bn(y.repeatDelay)),y.from!==void 0&&(y.keyframes[0]=y.from);let h=!1;if((y.type===!1||y.duration===0&&!y.repeatDelay)&&(Dd(y),y.delay===0&&(h=!0)),(ka.instantAnimations||ka.skipAnimations||o!=null&&o.shouldSkipAnimations)&&(h=!0,Dd(y),y.delay=0),y.allowFlatten=!f.type&&!f.ease,h&&!l&&n.get()!==void 0){const b=Jl(y.keyframes,f);if(b!==void 0){yt.update(()=>{y.onUpdate(b),y.onComplete()});return}}return f.isSync?new Ll(y):new L3(y)};function pm(e){const n=[{},{}];return e==null||e.values.forEach((a,s)=>{n[0][s]=a.get(),n[1][s]=a.getVelocity()}),n}function Tf(e,n,a,s){if(typeof n=="function"){const[o,l]=pm(s);n=n(a!==void 0?a:e.custom,o,l)}if(typeof n=="string"&&(n=e.variants&&e.variants[n]),typeof n=="function"){const[o,l]=pm(s);n=n(a!==void 0?a:e.custom,o,l)}return n}function Ka(e,n,a){const s=e.getProps();return Tf(s,n,a!==void 0?a:s.custom,e)}const py=new Set(["width","height","top","left","right","bottom",...Bs]),mm=30,K3=e=>!isNaN(parseFloat(e));class Y3{constructor(n,a={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=s=>{var l;const o=bn.now();if(this.updatedAt!==o&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(s),this.current!==this.prev&&((l=this.events.change)==null||l.notify(this.current),this.dependents))for(const d of this.dependents)d.dirty()},this.hasAnimated=!1,this.setCurrent(n),this.owner=a.owner}setCurrent(n){this.current=n,this.updatedAt=bn.now(),this.canTrackVelocity===null&&n!==void 0&&(this.canTrackVelocity=K3(this.current))}setPrevFrameValue(n=this.current){this.prevFrameValue=n,this.prevUpdatedAt=this.updatedAt}onChange(n){return this.on("change",n)}on(n,a){this.events[n]||(this.events[n]=new gf);const s=this.events[n].add(a);return n==="change"?()=>{s(),yt.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const n in this.events)this.events[n].clear()}attach(n,a){this.passiveEffect=n,this.stopPassiveEffect=a}set(n){this.passiveEffect?this.passiveEffect(n,this.updateAndNotify):this.updateAndNotify(n)}setWithVelocity(n,a,s){this.set(a),this.prev=void 0,this.prevFrameValue=n,this.prevUpdatedAt=this.updatedAt-s}jump(n,a=!0){this.updateAndNotify(n),this.prev=n,this.prevUpdatedAt=this.prevFrameValue=void 0,a&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var n;(n=this.events.change)==null||n.notify(this.current)}addDependent(n){this.dependents||(this.dependents=new Set),this.dependents.add(n)}removeDependent(n){this.dependents&&this.dependents.delete(n)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const n=bn.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||n-this.updatedAt>mm)return 0;const a=Math.min(this.updatedAt-this.prevUpdatedAt,mm);return I1(parseFloat(this.current)-parseFloat(this.prevFrameValue),a)}start(n){return this.stop(),new Promise(a=>{this.hasAnimated=!0,this.animation=n(a),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var n,a;(n=this.dependents)==null||n.clear(),(a=this.events.destroy)==null||a.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Fs(e,n){return new Y3(e,n)}const Ld=e=>Array.isArray(e);function G3(e,n,a){e.hasValue(n)?e.getValue(n).set(a):e.addValue(n,Fs(a))}function X3(e){return Ld(e)?e[e.length-1]||0:e}function J3(e,n){const a=Ka(e,n);let{transitionEnd:s={},transition:o={},...l}=a||{};l={...l,...s};for(const d in l){const f=X3(l[d]);G3(e,d,f)}}const rn=e=>!!(e&&e.getVelocity);function q3(e){return!!(rn(e)&&e.add)}function Ad(e,n){const a=e.getValue("willChange");if(q3(a))return a.add(n);if(!a&&ka.WillChange){const s=new ka.WillChange("auto");e.addValue("willChange",s),s.add(n)}}function Pf(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}const Q3="framerAppearId",my="data-"+Pf(Q3);function gy(e){return e.props[my]}function Z3({protectedKeys:e,needsAnimating:n},a){const s=e.hasOwnProperty(a)&&n[a]!==!0;return n[a]=!1,s}function yy(e,n,{delay:a=0,transitionOverride:s,type:o}={}){let{transition:l,transitionEnd:d,...f}=n;const m=e.getDefaultTransition();l=l?hy(l,m):m;const g=l==null?void 0:l.reduceMotion;s&&(l=s);const y=[],h=o&&e.animationState&&e.animationState.getState()[o];for(const b in f){const k=e.getValue(b,e.latestValues[b]??null),C=f[b];if(C===void 0||h&&Z3(h,b))continue;const N={delay:a,...Nf(l||{},b)},j=k.get();if(j!==void 0&&!k.isAnimating()&&!Array.isArray(C)&&C===j&&!N.velocity){yt.update(()=>k.set(C));continue}let M=!1;if(window.MotionHandoffAnimation){const U=gy(e);if(U){const W=window.MotionHandoffAnimation(U,b,yt);W!==null&&(N.startTime=W,M=!0)}}Ad(e,b);const P=g??e.shouldReduceMotion;k.start(Ef(b,k,C,P&&py.has(b)?{type:!1}:N,e,M));const F=k.animation;F&&y.push(F)}if(d){const b=()=>yt.update(()=>{d&&J3(e,d)});y.length?Promise.all(y).then(b):b()}return y}function Od(e,n,a={}){var m;const s=Ka(e,n,a.type==="exit"?(m=e.presenceContext)==null?void 0:m.custom:void 0);let{transition:o=e.getDefaultTransition()||{}}=s||{};a.transitionOverride&&(o=a.transitionOverride);const l=s?()=>Promise.all(yy(e,s,a)):()=>Promise.resolve(),d=e.variantChildren&&e.variantChildren.size?(g=0)=>{const{delayChildren:y=0,staggerChildren:h,staggerDirection:b}=o;return e4(e,n,g,y,h,b,a)}:()=>Promise.resolve(),{when:f}=o;if(f){const[g,y]=f==="beforeChildren"?[l,d]:[d,l];return g().then(()=>y())}else return Promise.all([l(),d(a.delay)])}function e4(e,n,a=0,s=0,o=0,l=1,d){const f=[];for(const m of e.variantChildren)m.notify("AnimationStart",n),f.push(Od(m,n,{...d,delay:a+(typeof s=="function"?0:s)+dy(e.variantChildren,m,s,o,l)}).then(()=>m.notify("AnimationComplete",n)));return Promise.all(f)}function t4(e,n,a={}){e.notify("AnimationStart",n);let s;if(Array.isArray(n)){const o=n.map(l=>Od(e,l,a));s=Promise.all(o)}else if(typeof n=="string")s=Od(e,n,a);else{const o=typeof n=="function"?Ka(e,n,a.custom):n;s=Promise.all(yy(e,o,a))}return s.then(()=>{e.notify("AnimationComplete",n)})}const n4={test:e=>e==="auto",parse:e=>e},xy=e=>n=>n.test(e),vy=[Os,Ee,Rr,pa,Tw,Ew,n4],gm=e=>vy.find(xy(e));function r4(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||R1(e):!0}const a4=new Set(["brightness","contrast","saturate","opacity"]);function s4(e){const[n,a]=e.slice(0,-1).split("(");if(n==="drop-shadow")return e;const[s]=a.match(bf)||[];if(!s)return e;const o=a.replace(s,"");let l=a4.has(n)?1:0;return s!==a&&(l*=100),n+"("+l+o+")"}const i4=/\b([a-z-]*)\(.*?\)/gu,Bd={...pr,getAnimatableNone:e=>{const n=e.match(i4);return n?n.map(s4).join(" "):e}},zd={...pr,getAnimatableNone:e=>{const n=pr.parse(e);return pr.createTransformer(e)(n.map(s=>typeof s=="number"?0:typeof s=="object"?{...s,alpha:1}:s))}},ym={...Os,transform:Math.round},o4={rotate:pa,rotateX:pa,rotateY:pa,rotateZ:pa,scale:ol,scaleX:ol,scaleY:ol,scaleZ:ol,skew:pa,skewX:pa,skewY:pa,distance:Ee,translateX:Ee,translateY:Ee,translateZ:Ee,x:Ee,y:Ee,z:Ee,perspective:Ee,transformPerspective:Ee,opacity:Oi,originX:rm,originY:rm,originZ:Ee},Rf={borderWidth:Ee,borderTopWidth:Ee,borderRightWidth:Ee,borderBottomWidth:Ee,borderLeftWidth:Ee,borderRadius:Ee,borderTopLeftRadius:Ee,borderTopRightRadius:Ee,borderBottomRightRadius:Ee,borderBottomLeftRadius:Ee,width:Ee,maxWidth:Ee,height:Ee,maxHeight:Ee,top:Ee,right:Ee,bottom:Ee,left:Ee,inset:Ee,insetBlock:Ee,insetBlockStart:Ee,insetBlockEnd:Ee,insetInline:Ee,insetInlineStart:Ee,insetInlineEnd:Ee,padding:Ee,paddingTop:Ee,paddingRight:Ee,paddingBottom:Ee,paddingLeft:Ee,paddingBlock:Ee,paddingBlockStart:Ee,paddingBlockEnd:Ee,paddingInline:Ee,paddingInlineStart:Ee,paddingInlineEnd:Ee,margin:Ee,marginTop:Ee,marginRight:Ee,marginBottom:Ee,marginLeft:Ee,marginBlock:Ee,marginBlockStart:Ee,marginBlockEnd:Ee,marginInline:Ee,marginInlineStart:Ee,marginInlineEnd:Ee,fontSize:Ee,backgroundPositionX:Ee,backgroundPositionY:Ee,...o4,zIndex:ym,fillOpacity:Oi,strokeOpacity:Oi,numOctaves:ym},l4={...Rf,color:Vt,backgroundColor:Vt,outlineColor:Vt,fill:Vt,stroke:Vt,borderColor:Vt,borderTopColor:Vt,borderRightColor:Vt,borderBottomColor:Vt,borderLeftColor:Vt,filter:Bd,WebkitFilter:Bd,mask:zd,WebkitMask:zd},by=e=>l4[e],c4=new Set([Bd,zd]);function wy(e,n){let a=by(e);return c4.has(a)||(a=pr),a.getAnimatableNone?a.getAnimatableNone(n):void 0}const u4=new Set(["auto","none","0"]);function d4(e,n,a){let s=0,o;for(;s<e.length&&!o;){const l=e[s];typeof l=="string"&&!u4.has(l)&&_s(l).values.length&&(o=e[s]),s++}if(o&&a)for(const l of n)e[l]=wy(a,o)}class f4 extends Cf{constructor(n,a,s,o,l){super(n,a,s,o,l,!0)}readKeyframes(){const{unresolvedKeyframes:n,element:a,name:s}=this;if(!a||!a.current)return;super.readKeyframes();for(let y=0;y<n.length;y++){let h=n[y];if(typeof h=="string"&&(h=h.trim(),vf(h))){const b=fy(h,a.current);b!==void 0&&(n[y]=b),y===n.length-1&&(this.finalKeyframe=h)}}if(this.resolveNoneKeyframes(),!py.has(s)||n.length!==2)return;const[o,l]=n,d=gm(o),f=gm(l),m=nm(o),g=nm(l);if(m!==g&&va[s]){this.needsMeasurement=!0;return}if(d!==f)if(dm(d)&&dm(f))for(let y=0;y<n.length;y++){const h=n[y];typeof h=="string"&&(n[y]=parseFloat(h))}else va[s]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:n,name:a}=this,s=[];for(let o=0;o<n.length;o++)(n[o]===null||r4(n[o]))&&s.push(o);s.length&&d4(n,s,a)}measureInitialState(){const{element:n,unresolvedKeyframes:a,name:s}=this;if(!n||!n.current)return;s==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=va[s](n.measureViewportBox(),window.getComputedStyle(n.current)),a[0]=this.measuredOrigin;const o=a[a.length-1];o!==void 0&&n.getValue(s,o).jump(o,!1)}measureEndState(){var f;const{element:n,name:a,unresolvedKeyframes:s}=this;if(!n||!n.current)return;const o=n.getValue(a);o&&o.jump(this.measuredOrigin,!1);const l=s.length-1,d=s[l];s[l]=va[a](n.measureViewportBox(),window.getComputedStyle(n.current)),d!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=d),(f=this.removedTransforms)!=null&&f.length&&this.removedTransforms.forEach(([m,g])=>{n.getValue(m).set(g)}),this.resolveNoneKeyframes()}}function ky(e,n,a){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let s=document;const o=(a==null?void 0:a[e])??s.querySelectorAll(e);return o?Array.from(o):[]}return Array.from(e).filter(s=>s!=null)}const Sy=(e,n)=>n&&typeof e=="number"?n.transform(e):e;function wl(e){return P1(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}const{schedule:Mf}=$1(queueMicrotask,!1),fr={x:!1,y:!1};function jy(){return fr.x||fr.y}function h4(e){return e==="x"||e==="y"?fr[e]?null:(fr[e]=!0,()=>{fr[e]=!1}):fr.x||fr.y?null:(fr.x=fr.y=!0,()=>{fr.x=fr.y=!1})}function Cy(e,n){const a=ky(e),s=new AbortController,o={passive:!0,...n,signal:s.signal};return[a,o,()=>s.abort()]}function p4(e){return!(e.pointerType==="touch"||jy())}function m4(e,n,a={}){const[s,o,l]=Cy(e,a);return s.forEach(d=>{let f=!1,m=!1,g;const y=()=>{d.removeEventListener("pointerleave",C)},h=j=>{g&&(g(j),g=void 0),y()},b=j=>{f=!1,window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",b),m&&(m=!1,h(j))},k=()=>{f=!0,window.addEventListener("pointerup",b,o),window.addEventListener("pointercancel",b,o)},C=j=>{if(j.pointerType!=="touch"){if(f){m=!0;return}h(j)}},N=j=>{if(!p4(j))return;m=!1;const M=n(d,j);typeof M=="function"&&(g=M,d.addEventListener("pointerleave",C,o))};d.addEventListener("pointerenter",N,o),d.addEventListener("pointerdown",k,o)}),l}const Ny=(e,n)=>n?e===n?!0:Ny(e,n.parentElement):!1,If=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,g4=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function y4(e){return g4.has(e.tagName)||e.isContentEditable===!0}const x4=new Set(["INPUT","SELECT","TEXTAREA"]);function v4(e){return x4.has(e.tagName)||e.isContentEditable===!0}const kl=new WeakSet;function xm(e){return n=>{n.key==="Enter"&&e(n)}}function Qu(e,n){e.dispatchEvent(new PointerEvent("pointer"+n,{isPrimary:!0,bubbles:!0}))}const b4=(e,n)=>{const a=e.currentTarget;if(!a)return;const s=xm(()=>{if(kl.has(a))return;Qu(a,"down");const o=xm(()=>{Qu(a,"up")}),l=()=>Qu(a,"cancel");a.addEventListener("keyup",o,n),a.addEventListener("blur",l,n)});a.addEventListener("keydown",s,n),a.addEventListener("blur",()=>a.removeEventListener("keydown",s),n)};function vm(e){return If(e)&&!jy()}const bm=new WeakSet;function w4(e,n,a={}){const[s,o,l]=Cy(e,a),d=f=>{const m=f.currentTarget;if(!vm(f)||bm.has(f))return;kl.add(m),a.stopPropagation&&bm.add(f);const g=n(m,f),y=(k,C)=>{window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",b),kl.has(m)&&kl.delete(m),vm(k)&&typeof g=="function"&&g(k,{success:C})},h=k=>{y(k,m===window||m===document||a.useGlobalTarget||Ny(m,k.target))},b=k=>{y(k,!1)};window.addEventListener("pointerup",h,o),window.addEventListener("pointercancel",b,o)};return s.forEach(f=>{(a.useGlobalTarget?window:f).addEventListener("pointerdown",d,o),wl(f)&&(f.addEventListener("focus",g=>b4(g,o)),!y4(f)&&!f.hasAttribute("tabindex")&&(f.tabIndex=0))}),l}function _f(e){return P1(e)&&"ownerSVGElement"in e}const Sl=new WeakMap;let ma;const Ey=(e,n,a)=>(s,o)=>o&&o[0]?o[0][e+"Size"]:_f(s)&&"getBBox"in s?s.getBBox()[n]:s[a],k4=Ey("inline","width","offsetWidth"),S4=Ey("block","height","offsetHeight");function j4({target:e,borderBoxSize:n}){var a;(a=Sl.get(e))==null||a.forEach(s=>{s(e,{get width(){return k4(e,n)},get height(){return S4(e,n)}})})}function C4(e){e.forEach(j4)}function N4(){typeof ResizeObserver>"u"||(ma=new ResizeObserver(C4))}function E4(e,n){ma||N4();const a=ky(e);return a.forEach(s=>{let o=Sl.get(s);o||(o=new Set,Sl.set(s,o)),o.add(n),ma==null||ma.observe(s)}),()=>{a.forEach(s=>{const o=Sl.get(s);o==null||o.delete(n),o!=null&&o.size||ma==null||ma.unobserve(s)})}}const jl=new Set;let Es;function T4(){Es=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};jl.forEach(n=>n(e))},window.addEventListener("resize",Es)}function P4(e){return jl.add(e),Es||T4(),()=>{jl.delete(e),!jl.size&&typeof Es=="function"&&(window.removeEventListener("resize",Es),Es=void 0)}}function wm(e,n){return typeof e=="function"?P4(e):E4(e,n)}function R4(e){return _f(e)&&e.tagName==="svg"}const M4=[...vy,Vt,pr],I4=e=>M4.find(xy(e)),km=()=>({translate:0,scale:1,origin:0,originPoint:0}),Ts=()=>({x:km(),y:km()}),Sm=()=>({min:0,max:0}),Gt=()=>({x:Sm(),y:Sm()}),_4=new WeakMap;function ql(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function Bi(e){return typeof e=="string"||Array.isArray(e)}const Ff=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Df=["initial",...Ff];function Ql(e){return ql(e.animate)||Df.some(n=>Bi(e[n]))}function Ty(e){return!!(Ql(e)||e.variants)}function F4(e,n,a){for(const s in n){const o=n[s],l=a[s];if(rn(o))e.addValue(s,o);else if(rn(l))e.addValue(s,Fs(o,{owner:e}));else if(l!==o)if(e.hasValue(s)){const d=e.getValue(s);d.liveStyle===!0?d.jump(o):d.hasAnimated||d.set(o)}else{const d=e.getStaticValue(s);e.addValue(s,Fs(d!==void 0?d:o,{owner:e}))}}for(const s in a)n[s]===void 0&&e.removeValue(s);return n}const Al={current:null},Lf={current:!1},D4=typeof window<"u";function Py(){if(Lf.current=!0,!!D4)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),n=()=>Al.current=e.matches;e.addEventListener("change",n),n()}else Al.current=!1}const jm=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Ol={};function Ry(e){Ol=e}function L4(){return Ol}class A4{scrapeMotionValuesFromProps(n,a,s){return{}}constructor({parent:n,props:a,presenceContext:s,reducedMotionConfig:o,skipAnimations:l,blockInitialAnimation:d,visualState:f},m={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Cf,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const k=bn.now();this.renderScheduledAt<k&&(this.renderScheduledAt=k,yt.render(this.render,!1,!0))};const{latestValues:g,renderState:y}=f;this.latestValues=g,this.baseTarget={...g},this.initialValues=a.initial?{...g}:{},this.renderState=y,this.parent=n,this.props=a,this.presenceContext=s,this.depth=n?n.depth+1:0,this.reducedMotionConfig=o,this.skipAnimationsConfig=l,this.options=m,this.blockInitialAnimation=!!d,this.isControllingVariants=Ql(a),this.isVariantNode=Ty(a),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(n&&n.current);const{willChange:h,...b}=this.scrapeMotionValuesFromProps(a,{},this);for(const k in b){const C=b[k];g[k]!==void 0&&rn(C)&&C.set(g[k])}}mount(n){var a,s;if(this.hasBeenMounted)for(const o in this.initialValues)(a=this.values.get(o))==null||a.jump(this.initialValues[o]),this.latestValues[o]=this.initialValues[o];this.current=n,_4.set(n,this),this.projection&&!this.projection.instance&&this.projection.mount(n),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((o,l)=>this.bindToMotionValue(l,o)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(Lf.current||Py(),this.shouldReduceMotion=Al.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(s=this.parent)==null||s.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var n;this.projection&&this.projection.unmount(),Sa(this.notifyUpdate),Sa(this.render),this.valueSubscriptions.forEach(a=>a()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(n=this.parent)==null||n.removeChild(this);for(const a in this.events)this.events[a].clear();for(const a in this.features){const s=this.features[a];s&&(s.unmount(),s.isMounted=!1)}this.current=null}addChild(n){this.children.add(n),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(n)}removeChild(n){this.children.delete(n),this.enteringChildren&&this.enteringChildren.delete(n)}bindToMotionValue(n,a){if(this.valueSubscriptions.has(n)&&this.valueSubscriptions.get(n)(),a.accelerate&&uy.has(n)&&this.current instanceof HTMLElement){const{factory:d,keyframes:f,times:m,ease:g,duration:y}=a.accelerate,h=new ly({element:this.current,name:n,keyframes:f,times:m,ease:g,duration:Bn(y)}),b=d(h);this.valueSubscriptions.set(n,()=>{b(),h.cancel()});return}const s=zs.has(n);s&&this.onBindTransform&&this.onBindTransform();const o=a.on("change",d=>{this.latestValues[n]=d,this.props.onUpdate&&yt.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let l;typeof window<"u"&&window.MotionCheckAppearSync&&(l=window.MotionCheckAppearSync(this,n,a)),this.valueSubscriptions.set(n,()=>{o(),l&&l(),a.owner&&a.stop()})}sortNodePosition(n){return!this.current||!this.sortInstanceNodePosition||this.type!==n.type?0:this.sortInstanceNodePosition(this.current,n.current)}updateFeatures(){let n="animation";for(n in Ol){const a=Ol[n];if(!a)continue;const{isEnabled:s,Feature:o}=a;if(!this.features[n]&&o&&s(this.props)&&(this.features[n]=new o(this)),this.features[n]){const l=this.features[n];l.isMounted?l.update():(l.mount(),l.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Gt()}getStaticValue(n){return this.latestValues[n]}setStaticValue(n,a){this.latestValues[n]=a}update(n,a){(n.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=n,this.prevPresenceContext=this.presenceContext,this.presenceContext=a;for(let s=0;s<jm.length;s++){const o=jm[s];this.propEventSubscriptions[o]&&(this.propEventSubscriptions[o](),delete this.propEventSubscriptions[o]);const l="on"+o,d=n[l];d&&(this.propEventSubscriptions[o]=this.on(o,d))}this.prevMotionValues=F4(this,this.scrapeMotionValuesFromProps(n,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(n){return this.props.variants?this.props.variants[n]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(n){const a=this.getClosestVariantNode();if(a)return a.variantChildren&&a.variantChildren.add(n),()=>a.variantChildren.delete(n)}addValue(n,a){const s=this.values.get(n);a!==s&&(s&&this.removeValue(n),this.bindToMotionValue(n,a),this.values.set(n,a),this.latestValues[n]=a.get())}removeValue(n){this.values.delete(n);const a=this.valueSubscriptions.get(n);a&&(a(),this.valueSubscriptions.delete(n)),delete this.latestValues[n],this.removeValueFromRenderState(n,this.renderState)}hasValue(n){return this.values.has(n)}getValue(n,a){if(this.props.values&&this.props.values[n])return this.props.values[n];let s=this.values.get(n);return s===void 0&&a!==void 0&&(s=Fs(a===null?void 0:a,{owner:this}),this.addValue(n,s)),s}readValue(n,a){let s=this.latestValues[n]!==void 0||!this.current?this.latestValues[n]:this.getBaseTargetFromProps(this.props,n)??this.readValueFromInstance(this.current,n,this.options);return s!=null&&(typeof s=="string"&&(T1(s)||R1(s))?s=parseFloat(s):!I4(s)&&pr.test(a)&&(s=wy(n,a)),this.setBaseTarget(n,rn(s)?s.get():s)),rn(s)?s.get():s}setBaseTarget(n,a){this.baseTarget[n]=a}getBaseTarget(n){var l;const{initial:a}=this.props;let s;if(typeof a=="string"||typeof a=="object"){const d=Tf(this.props,a,(l=this.presenceContext)==null?void 0:l.custom);d&&(s=d[n])}if(a&&s!==void 0)return s;const o=this.getBaseTargetFromProps(this.props,n);return o!==void 0&&!rn(o)?o:this.initialValues[n]!==void 0&&s===void 0?void 0:this.baseTarget[n]}on(n,a){return this.events[n]||(this.events[n]=new gf),this.events[n].add(a)}notify(n,...a){this.events[n]&&this.events[n].notify(...a)}scheduleRenderMicrotask(){Mf.render(this.render)}}class My extends A4{constructor(){super(...arguments),this.KeyframeResolver=f4}sortInstanceNodePosition(n,a){return n.compareDocumentPosition(a)&2?1:-1}getBaseTargetFromProps(n,a){const s=n.style;return s?s[a]:void 0}removeValueFromRenderState(n,{vars:a,style:s}){delete a[n],delete s[n]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:n}=this.props;rn(n)&&(this.childSubscription=n.on("change",a=>{this.current&&(this.current.textContent=`${a}`)}))}}class Ca{constructor(n){this.isMounted=!1,this.node=n}update(){}}function Iy({top:e,left:n,right:a,bottom:s}){return{x:{min:n,max:a},y:{min:e,max:s}}}function O4({x:e,y:n}){return{top:n.min,right:e.max,bottom:n.max,left:e.min}}function B4(e,n){if(!n)return e;const a=n({x:e.left,y:e.top}),s=n({x:e.right,y:e.bottom});return{top:a.y,left:a.x,bottom:s.y,right:s.x}}function Zu(e){return e===void 0||e===1}function Vd({scale:e,scaleX:n,scaleY:a}){return!Zu(e)||!Zu(n)||!Zu(a)}function Va(e){return Vd(e)||_y(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function _y(e){return Cm(e.x)||Cm(e.y)}function Cm(e){return e&&e!=="0%"}function Bl(e,n,a){const s=e-a,o=n*s;return a+o}function Nm(e,n,a,s,o){return o!==void 0&&(e=Bl(e,o,s)),Bl(e,a,s)+n}function Ud(e,n=0,a=1,s,o){e.min=Nm(e.min,n,a,s,o),e.max=Nm(e.max,n,a,s,o)}function Fy(e,{x:n,y:a}){Ud(e.x,n.translate,n.scale,n.originPoint),Ud(e.y,a.translate,a.scale,a.originPoint)}const Em=.999999999999,Tm=1.0000000000001;function z4(e,n,a,s=!1){var f;const o=a.length;if(!o)return;n.x=n.y=1;let l,d;for(let m=0;m<o;m++){l=a[m],d=l.projectionDelta;const{visualElement:g}=l.options;g&&g.props.style&&g.props.style.display==="contents"||(s&&l.options.layoutScroll&&l.scroll&&l!==l.root&&(Pr(e.x,-l.scroll.offset.x),Pr(e.y,-l.scroll.offset.y)),d&&(n.x*=d.x.scale,n.y*=d.y.scale,Fy(e,d)),s&&Va(l.latestValues)&&Cl(e,l.latestValues,(f=l.layout)==null?void 0:f.layoutBox))}n.x<Tm&&n.x>Em&&(n.x=1),n.y<Tm&&n.y>Em&&(n.y=1)}function Pr(e,n){e.min+=n,e.max+=n}function Pm(e,n,a,s,o=.5){const l=Nt(e.min,e.max,o);Ud(e,n,a,l,s)}function Rm(e,n){return typeof e=="string"?parseFloat(e)/100*(n.max-n.min):e}function Cl(e,n,a){const s=a??e;Pm(e.x,Rm(n.x,s.x),n.scaleX,n.scale,n.originX),Pm(e.y,Rm(n.y,s.y),n.scaleY,n.scale,n.originY)}function Dy(e,n){return Iy(B4(e.getBoundingClientRect(),n))}function V4(e,n,a){const s=Dy(e,a),{scroll:o}=n;return o&&(Pr(s.x,o.offset.x),Pr(s.y,o.offset.y)),s}const U4={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},$4=Bs.length;function H4(e,n,a){let s="",o=!0;for(let l=0;l<$4;l++){const d=Bs[l],f=e[d];if(f===void 0)continue;let m=!0;if(typeof f=="number")m=f===(d.startsWith("scale")?1:0);else{const g=parseFloat(f);m=d.startsWith("scale")?g===1:g===0}if(!m||a){const g=Sy(f,Rf[d]);if(!m){o=!1;const y=U4[d]||d;s+=`${y}(${g}) `}a&&(n[d]=g)}}return s=s.trim(),a?s=a(n,o?"":s):o&&(s="none"),s}function Af(e,n,a){const{style:s,vars:o,transformOrigin:l}=e;let d=!1,f=!1;for(const m in n){const g=n[m];if(zs.has(m)){d=!0;continue}else if(W1(m)){o[m]=g;continue}else{const y=Sy(g,Rf[m]);m.startsWith("origin")?(f=!0,l[m]=y):s[m]=y}}if(n.transform||(d||a?s.transform=H4(n,e.transform,a):s.transform&&(s.transform="none")),f){const{originX:m="50%",originY:g="50%",originZ:y=0}=l;s.transformOrigin=`${m} ${g} ${y}`}}function Ly(e,{style:n,vars:a},s,o){const l=e.style;let d;for(d in n)l[d]=n[d];o==null||o.applyProjectionStyles(l,s);for(d in a)l.setProperty(d,a[d])}function Mm(e,n){return n.max===n.min?0:e/(n.max-n.min)*100}const ji={correct:(e,n)=>{if(!n.target)return e;if(typeof e=="string")if(Ee.test(e))e=parseFloat(e);else return e;const a=Mm(e,n.target.x),s=Mm(e,n.target.y);return`${a}% ${s}%`}},W4={correct:(e,{treeScale:n,projectionDelta:a})=>{const s=e,o=pr.parse(e);if(o.length>5)return s;const l=pr.createTransformer(e),d=typeof o[0]!="number"?1:0,f=a.x.scale*n.x,m=a.y.scale*n.y;o[0+d]/=f,o[1+d]/=m;const g=Nt(f,m,.5);return typeof o[2+d]=="number"&&(o[2+d]/=g),typeof o[3+d]=="number"&&(o[3+d]/=g),l(o)}},$d={borderRadius:{...ji,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ji,borderTopRightRadius:ji,borderBottomLeftRadius:ji,borderBottomRightRadius:ji,boxShadow:W4};function Ay(e,{layout:n,layoutId:a}){return zs.has(e)||e.startsWith("origin")||(n||a!==void 0)&&(!!$d[e]||e==="opacity")}function Of(e,n,a){var d;const s=e.style,o=n==null?void 0:n.style,l={};if(!s)return l;for(const f in s)(rn(s[f])||o&&rn(o[f])||Ay(f,e)||((d=a==null?void 0:a.getValue(f))==null?void 0:d.liveStyle)!==void 0)&&(l[f]=s[f]);return l}function K4(e){return window.getComputedStyle(e)}class Y4 extends My{constructor(){super(...arguments),this.type="html",this.renderInstance=Ly}readValueFromInstance(n,a){var s;if(zs.has(a))return(s=this.projection)!=null&&s.isProjecting?Rd(a):p3(n,a);{const o=K4(n),l=(W1(a)?o.getPropertyValue(a):o[a])||0;return typeof l=="string"?l.trim():l}}measureInstanceViewportBox(n,{transformPagePoint:a}){return Dy(n,a)}build(n,a,s){Af(n,a,s.transformTemplate)}scrapeMotionValuesFromProps(n,a,s){return Of(n,a,s)}}const G4={offset:"stroke-dashoffset",array:"stroke-dasharray"},X4={offset:"strokeDashoffset",array:"strokeDasharray"};function J4(e,n,a=1,s=0,o=!0){e.pathLength=1;const l=o?G4:X4;e[l.offset]=`${-s}`,e[l.array]=`${n} ${a}`}const q4=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function Oy(e,{attrX:n,attrY:a,attrScale:s,pathLength:o,pathSpacing:l=1,pathOffset:d=0,...f},m,g,y){if(Af(e,f,g),m){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:h,style:b}=e;h.transform&&(b.transform=h.transform,delete h.transform),(b.transform||h.transformOrigin)&&(b.transformOrigin=h.transformOrigin??"50% 50%",delete h.transformOrigin),b.transform&&(b.transformBox=(y==null?void 0:y.transformBox)??"fill-box",delete h.transformBox);for(const k of q4)h[k]!==void 0&&(b[k]=h[k],delete h[k]);n!==void 0&&(h.x=n),a!==void 0&&(h.y=a),s!==void 0&&(h.scale=s),o!==void 0&&J4(h,o,l,d,!1)}const By=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),zy=e=>typeof e=="string"&&e.toLowerCase()==="svg";function Q4(e,n,a,s){Ly(e,n,void 0,s);for(const o in n.attrs)e.setAttribute(By.has(o)?o:Pf(o),n.attrs[o])}function Vy(e,n,a){const s=Of(e,n,a);for(const o in e)if(rn(e[o])||rn(n[o])){const l=Bs.indexOf(o)!==-1?"attr"+o.charAt(0).toUpperCase()+o.substring(1):o;s[l]=e[o]}return s}class Z4 extends My{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Gt}getBaseTargetFromProps(n,a){return n[a]}readValueFromInstance(n,a){if(zs.has(a)){const s=by(a);return s&&s.default||0}return a=By.has(a)?a:Pf(a),n.getAttribute(a)}scrapeMotionValuesFromProps(n,a,s){return Vy(n,a,s)}build(n,a,s){Oy(n,a,this.isSVGTag,s.transformTemplate,s.style)}renderInstance(n,a,s,o){Q4(n,a,s,o)}mount(n){this.isSVGTag=zy(n.tagName),super.mount(n)}}const ek=Df.length;function Uy(e){if(!e)return;if(!e.isControllingVariants){const a=e.parent?Uy(e.parent)||{}:{};return e.props.initial!==void 0&&(a.initial=e.props.initial),a}const n={};for(let a=0;a<ek;a++){const s=Df[a],o=e.props[s];(Bi(o)||o===!1)&&(n[s]=o)}return n}function $y(e,n){if(!Array.isArray(n))return!1;const a=n.length;if(a!==e.length)return!1;for(let s=0;s<a;s++)if(n[s]!==e[s])return!1;return!0}const tk=[...Ff].reverse(),nk=Ff.length;function rk(e){return n=>Promise.all(n.map(({animation:a,options:s})=>t4(e,a,s)))}function ak(e){let n=rk(e),a=Im(),s=!0,o=!1;const l=g=>(y,h)=>{var k;const b=Ka(e,h,g==="exit"?(k=e.presenceContext)==null?void 0:k.custom:void 0);if(b){const{transition:C,transitionEnd:N,...j}=b;y={...y,...j,...N}}return y};function d(g){n=g(e)}function f(g){const{props:y}=e,h=Uy(e.parent)||{},b=[],k=new Set;let C={},N=1/0;for(let M=0;M<nk;M++){const P=tk[M],F=a[P],U=y[P]!==void 0?y[P]:h[P],W=Bi(U),J=P===g?F.isActive:null;J===!1&&(N=M);let A=U===h[P]&&U!==y[P]&&W;if(A&&(s||o)&&e.manuallyAnimateOnMount&&(A=!1),F.protectedKeys={...C},!F.isActive&&J===null||!U&&!F.prevProp||ql(U)||typeof U=="boolean")continue;if(P==="exit"&&F.isActive&&J!==!0){F.prevResolvedValues&&(C={...C,...F.prevResolvedValues});continue}const w=sk(F.prevProp,U);let R=w||P===g&&F.isActive&&!A&&W||M>N&&W,E=!1;const Y=Array.isArray(U)?U:[U];let K=Y.reduce(l(P),{});J===!1&&(K={});const{prevResolvedValues:I={}}=F,$={...I,...K},ee=D=>{R=!0,k.has(D)&&(E=!0,k.delete(D)),F.needsAnimating[D]=!0;const X=e.getValue(D);X&&(X.liveStyle=!1)};for(const D in $){const X=K[D],q=I[D];if(C.hasOwnProperty(D))continue;let T=!1;Ld(X)&&Ld(q)?T=!$y(X,q):T=X!==q,T?X!=null?ee(D):k.add(D):X!==void 0&&k.has(D)?ee(D):F.protectedKeys[D]=!0}F.prevProp=U,F.prevResolvedValues=K,F.isActive&&(C={...C,...K}),(s||o)&&e.blockInitialAnimation&&(R=!1);const G=A&&w;R&&(!G||E)&&b.push(...Y.map(D=>{const X={type:P};if(typeof D=="string"&&(s||o)&&!G&&e.manuallyAnimateOnMount&&e.parent){const{parent:q}=e,T=Ka(q,D);if(q.enteringChildren&&T){const{delayChildren:O}=T.transition||{};X.delay=dy(q.enteringChildren,e,O)}}return{animation:D,options:X}}))}if(k.size){const M={};if(typeof y.initial!="boolean"){const P=Ka(e,Array.isArray(y.initial)?y.initial[0]:y.initial);P&&P.transition&&(M.transition=P.transition)}k.forEach(P=>{const F=e.getBaseTarget(P),U=e.getValue(P);U&&(U.liveStyle=!0),M[P]=F??null}),b.push({animation:M})}let j=!!b.length;return s&&(y.initial===!1||y.initial===y.animate)&&!e.manuallyAnimateOnMount&&(j=!1),s=!1,o=!1,j?n(b):Promise.resolve()}function m(g,y){var b;if(a[g].isActive===y)return Promise.resolve();(b=e.variantChildren)==null||b.forEach(k=>{var C;return(C=k.animationState)==null?void 0:C.setActive(g,y)}),a[g].isActive=y;const h=f(g);for(const k in a)a[k].protectedKeys={};return h}return{animateChanges:f,setActive:m,setAnimateFunction:d,getState:()=>a,reset:()=>{a=Im(),o=!0}}}function sk(e,n){return typeof n=="string"?n!==e:Array.isArray(n)?!$y(n,e):!1}function Oa(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Im(){return{animate:Oa(!0),whileInView:Oa(),whileHover:Oa(),whileTap:Oa(),whileDrag:Oa(),whileFocus:Oa(),exit:Oa()}}function Hd(e,n){e.min=n.min,e.max=n.max}function ur(e,n){Hd(e.x,n.x),Hd(e.y,n.y)}function _m(e,n){e.translate=n.translate,e.scale=n.scale,e.originPoint=n.originPoint,e.origin=n.origin}const Hy=1e-4,ik=1-Hy,ok=1+Hy,Wy=.01,lk=0-Wy,ck=0+Wy;function wn(e){return e.max-e.min}function uk(e,n,a){return Math.abs(e-n)<=a}function Fm(e,n,a,s=.5){e.origin=s,e.originPoint=Nt(n.min,n.max,e.origin),e.scale=wn(a)/wn(n),e.translate=Nt(a.min,a.max,e.origin)-e.originPoint,(e.scale>=ik&&e.scale<=ok||isNaN(e.scale))&&(e.scale=1),(e.translate>=lk&&e.translate<=ck||isNaN(e.translate))&&(e.translate=0)}function Ii(e,n,a,s){Fm(e.x,n.x,a.x,s?s.originX:void 0),Fm(e.y,n.y,a.y,s?s.originY:void 0)}function Dm(e,n,a,s=0){const o=s?Nt(a.min,a.max,s):a.min;e.min=o+n.min,e.max=e.min+wn(n)}function dk(e,n,a,s){Dm(e.x,n.x,a.x,s==null?void 0:s.x),Dm(e.y,n.y,a.y,s==null?void 0:s.y)}function Lm(e,n,a,s=0){const o=s?Nt(a.min,a.max,s):a.min;e.min=n.min-o,e.max=e.min+wn(n)}function zl(e,n,a,s){Lm(e.x,n.x,a.x,s==null?void 0:s.x),Lm(e.y,n.y,a.y,s==null?void 0:s.y)}function Am(e,n,a,s,o){return e-=n,e=Bl(e,1/a,s),o!==void 0&&(e=Bl(e,1/o,s)),e}function fk(e,n=0,a=1,s=.5,o,l=e,d=e){if(Rr.test(n)&&(n=parseFloat(n),n=Nt(d.min,d.max,n/100)-d.min),typeof n!="number")return;let f=Nt(l.min,l.max,s);e===l&&(f-=n),e.min=Am(e.min,n,a,f,o),e.max=Am(e.max,n,a,f,o)}function Om(e,n,[a,s,o],l,d){fk(e,n[a],n[s],n[o],n.scale,l,d)}const hk=["x","scaleX","originX"],pk=["y","scaleY","originY"];function Bm(e,n,a,s){Om(e.x,n,hk,a?a.x:void 0,s?s.x:void 0),Om(e.y,n,pk,a?a.y:void 0,s?s.y:void 0)}function zm(e){return e.translate===0&&e.scale===1}function Ky(e){return zm(e.x)&&zm(e.y)}function Vm(e,n){return e.min===n.min&&e.max===n.max}function mk(e,n){return Vm(e.x,n.x)&&Vm(e.y,n.y)}function Um(e,n){return Math.round(e.min)===Math.round(n.min)&&Math.round(e.max)===Math.round(n.max)}function Yy(e,n){return Um(e.x,n.x)&&Um(e.y,n.y)}function $m(e){return wn(e.x)/wn(e.y)}function Hm(e,n){return e.translate===n.translate&&e.scale===n.scale&&e.originPoint===n.originPoint}function Tr(e){return[e("x"),e("y")]}function gk(e,n,a){let s="";const o=e.x.translate/n.x,l=e.y.translate/n.y,d=(a==null?void 0:a.z)||0;if((o||l||d)&&(s=`translate3d(${o}px, ${l}px, ${d}px) `),(n.x!==1||n.y!==1)&&(s+=`scale(${1/n.x}, ${1/n.y}) `),a){const{transformPerspective:g,rotate:y,rotateX:h,rotateY:b,skewX:k,skewY:C}=a;g&&(s=`perspective(${g}px) ${s}`),y&&(s+=`rotate(${y}deg) `),h&&(s+=`rotateX(${h}deg) `),b&&(s+=`rotateY(${b}deg) `),k&&(s+=`skewX(${k}deg) `),C&&(s+=`skewY(${C}deg) `)}const f=e.x.scale*n.x,m=e.y.scale*n.y;return(f!==1||m!==1)&&(s+=`scale(${f}, ${m})`),s||"none"}const Gy=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],yk=Gy.length,Wm=e=>typeof e=="string"?parseFloat(e):e,Km=e=>typeof e=="number"||Ee.test(e);function xk(e,n,a,s,o,l){o?(e.opacity=Nt(0,a.opacity??1,vk(s)),e.opacityExit=Nt(n.opacity??1,0,bk(s))):l&&(e.opacity=Nt(n.opacity??1,a.opacity??1,s));for(let d=0;d<yk;d++){const f=Gy[d];let m=Ym(n,f),g=Ym(a,f);if(m===void 0&&g===void 0)continue;m||(m=0),g||(g=0),m===0||g===0||Km(m)===Km(g)?(e[f]=Math.max(Nt(Wm(m),Wm(g),s),0),(Rr.test(g)||Rr.test(m))&&(e[f]+="%")):e[f]=g}(n.rotate||a.rotate)&&(e.rotate=Nt(n.rotate||0,a.rotate||0,s))}function Ym(e,n){return e[n]!==void 0?e[n]:e.borderRadius}const vk=Xy(0,.5,B1),bk=Xy(.5,.95,Zn);function Xy(e,n,a){return s=>s<e?0:s>n?1:a(Ai(e,n,s))}function wk(e,n,a){const s=rn(e)?e:Fs(e);return s.start(Ef("",s,n,a)),s.animation}function zi(e,n,a,s={passive:!0}){return e.addEventListener(n,a,s),()=>e.removeEventListener(n,a)}const kk=(e,n)=>e.depth-n.depth;class Sk{constructor(){this.children=[],this.isDirty=!1}add(n){pf(this.children,n),this.isDirty=!0}remove(n){Il(this.children,n),this.isDirty=!0}forEach(n){this.isDirty&&this.children.sort(kk),this.isDirty=!1,this.children.forEach(n)}}function jk(e,n){const a=bn.now(),s=({timestamp:o})=>{const l=o-a;l>=n&&(Sa(s),e(l-n))};return yt.setup(s,!0),()=>Sa(s)}function Nl(e){return rn(e)?e.get():e}class Ck{constructor(){this.members=[]}add(n){pf(this.members,n);for(let a=this.members.length-1;a>=0;a--){const s=this.members[a];if(s===n||s===this.lead||s===this.prevLead)continue;const o=s.instance;(!o||o.isConnected===!1)&&!s.snapshot&&(Il(this.members,s),s.unmount())}n.scheduleRender()}remove(n){if(Il(this.members,n),n===this.prevLead&&(this.prevLead=void 0),n===this.lead){const a=this.members[this.members.length-1];a&&this.promote(a)}}relegate(n){var a;for(let s=this.members.indexOf(n)-1;s>=0;s--){const o=this.members[s];if(o.isPresent!==!1&&((a=o.instance)==null?void 0:a.isConnected)!==!1)return this.promote(o),!0}return!1}promote(n,a){var o;const s=this.lead;if(n!==s&&(this.prevLead=s,this.lead=n,n.show(),s)){s.updateSnapshot(),n.scheduleRender();const{layoutDependency:l}=s.options,{layoutDependency:d}=n.options;(l===void 0||l!==d)&&(n.resumeFrom=s,a&&(s.preserveOpacity=!0),s.snapshot&&(n.snapshot=s.snapshot,n.snapshot.latestValues=s.animationValues||s.latestValues),(o=n.root)!=null&&o.isUpdating&&(n.isLayoutDirty=!0)),n.options.crossfade===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(n=>{var a,s,o,l,d;(s=(a=n.options).onExitComplete)==null||s.call(a),(d=(o=n.resumingFrom)==null?void 0:(l=o.options).onExitComplete)==null||d.call(l)})}scheduleRender(){this.members.forEach(n=>n.instance&&n.scheduleRender(!1))}removeLeadSnapshot(){var n;(n=this.lead)!=null&&n.snapshot&&(this.lead.snapshot=void 0)}}const El={hasAnimatedSinceResize:!0,hasEverUpdated:!1},ed=["","X","Y","Z"],Nk=1e3;let Ek=0;function td(e,n,a,s){const{latestValues:o}=n;o[e]&&(a[e]=o[e],n.setStaticValue(e,0),s&&(s[e]=0))}function Jy(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:n}=e.options;if(!n)return;const a=gy(n);if(window.MotionHasOptimisedAnimation(a,"transform")){const{layout:o,layoutId:l}=e.options;window.MotionCancelOptimisedAnimation(a,"transform",yt,!(o||l))}const{parent:s}=e;s&&!s.hasCheckedOptimisedAppear&&Jy(s)}function qy({attachResizeListener:e,defaultParent:n,measureScroll:a,checkIsScrollRoot:s,resetTransform:o}){return class{constructor(d={},f=n==null?void 0:n()){this.id=Ek++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(Rk),this.nodes.forEach(Lk),this.nodes.forEach(Ak),this.nodes.forEach(Mk)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=d,this.root=f?f.root||f:this,this.path=f?[...f.path,f]:[],this.parent=f,this.depth=f?f.depth+1:0;for(let m=0;m<this.path.length;m++)this.path[m].shouldResetTransform=!0;this.root===this&&(this.nodes=new Sk)}addEventListener(d,f){return this.eventHandlers.has(d)||this.eventHandlers.set(d,new gf),this.eventHandlers.get(d).add(f)}notifyListeners(d,...f){const m=this.eventHandlers.get(d);m&&m.notify(...f)}hasListeners(d){return this.eventHandlers.has(d)}mount(d){if(this.instance)return;this.isSVG=_f(d)&&!R4(d),this.instance=d;const{layoutId:f,layout:m,visualElement:g}=this.options;if(g&&!g.current&&g.mount(d),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(m||f)&&(this.isLayoutDirty=!0),e){let y,h=0;const b=()=>this.root.updateBlockedByResize=!1;yt.read(()=>{h=window.innerWidth}),e(d,()=>{const k=window.innerWidth;k!==h&&(h=k,this.root.updateBlockedByResize=!0,y&&y(),y=jk(b,250),El.hasAnimatedSinceResize&&(El.hasAnimatedSinceResize=!1,this.nodes.forEach(Jm)))})}f&&this.root.registerSharedNode(f,this),this.options.animate!==!1&&g&&(f||m)&&this.addEventListener("didUpdate",({delta:y,hasLayoutChanged:h,hasRelativeLayoutChanged:b,layout:k})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const C=this.options.transition||g.getDefaultTransition()||Uk,{onLayoutAnimationStart:N,onLayoutAnimationComplete:j}=g.getProps(),M=!this.targetLayout||!Yy(this.targetLayout,k),P=!h&&b;if(this.options.layoutRoot||this.resumeFrom||P||h&&(M||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const F={...Nf(C,"layout"),onPlay:N,onComplete:j};(g.shouldReduceMotion||this.options.layoutRoot)&&(F.delay=0,F.type=!1),this.startAnimation(F),this.setAnimationOrigin(y,P)}else h||Jm(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=k})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const d=this.getStack();d&&d.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Sa(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Ok),this.animationId++)}getTransformTemplate(){const{visualElement:d}=this.options;return d&&d.getProps().transformTemplate}willUpdate(d=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Jy(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let y=0;y<this.path.length;y++){const h=this.path[y];h.shouldResetTransform=!0,(typeof h.latestValues.x=="string"||typeof h.latestValues.y=="string")&&(h.isLayoutDirty=!0),h.updateScroll("snapshot"),h.options.layoutRoot&&h.willUpdate(!1)}const{layoutId:f,layout:m}=this.options;if(f===void 0&&!m)return;const g=this.getTransformTemplate();this.prevTransformTemplateValue=g?g(this.latestValues,""):void 0,this.updateSnapshot(),d&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const m=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),m&&this.nodes.forEach(_k),this.nodes.forEach(Gm);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Xm);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(Fk),this.nodes.forEach(Dk),this.nodes.forEach(Tk),this.nodes.forEach(Pk)):this.nodes.forEach(Xm),this.clearAllSnapshots();const f=bn.now();nn.delta=Ir(0,1e3/60,f-nn.timestamp),nn.timestamp=f,nn.isProcessing=!0,Ku.update.process(nn),Ku.preRender.process(nn),Ku.render.process(nn),nn.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Mf.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Ik),this.sharedNodes.forEach(Bk)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,yt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){yt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!wn(this.snapshot.measuredBox.x)&&!wn(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let m=0;m<this.path.length;m++)this.path[m].updateScroll();const d=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=Gt()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:f}=this.options;f&&f.notify("LayoutMeasure",this.layout.layoutBox,d?d.layoutBox:void 0)}updateScroll(d="measure"){let f=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===d&&(f=!1),f&&this.instance){const m=s(this.instance);this.scroll={animationId:this.root.animationId,phase:d,isRoot:m,offset:a(this.instance),wasRoot:this.scroll?this.scroll.isRoot:m}}}resetTransform(){if(!o)return;const d=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,f=this.projectionDelta&&!Ky(this.projectionDelta),m=this.getTransformTemplate(),g=m?m(this.latestValues,""):void 0,y=g!==this.prevTransformTemplateValue;d&&this.instance&&(f||Va(this.latestValues)||y)&&(o(this.instance,g),this.shouldResetTransform=!1,this.scheduleRender())}measure(d=!0){const f=this.measurePageBox();let m=this.removeElementScroll(f);return d&&(m=this.removeTransform(m)),$k(m),{animationId:this.root.animationId,measuredBox:f,layoutBox:m,latestValues:{},source:this.id}}measurePageBox(){var g;const{visualElement:d}=this.options;if(!d)return Gt();const f=d.measureViewportBox();if(!(((g=this.scroll)==null?void 0:g.wasRoot)||this.path.some(Hk))){const{scroll:y}=this.root;y&&(Pr(f.x,y.offset.x),Pr(f.y,y.offset.y))}return f}removeElementScroll(d){var m;const f=Gt();if(ur(f,d),(m=this.scroll)!=null&&m.wasRoot)return f;for(let g=0;g<this.path.length;g++){const y=this.path[g],{scroll:h,options:b}=y;y!==this.root&&h&&b.layoutScroll&&(h.wasRoot&&ur(f,d),Pr(f.x,h.offset.x),Pr(f.y,h.offset.y))}return f}applyTransform(d,f=!1,m){var y,h;const g=m||Gt();ur(g,d);for(let b=0;b<this.path.length;b++){const k=this.path[b];!f&&k.options.layoutScroll&&k.scroll&&k!==k.root&&(Pr(g.x,-k.scroll.offset.x),Pr(g.y,-k.scroll.offset.y)),Va(k.latestValues)&&Cl(g,k.latestValues,(y=k.layout)==null?void 0:y.layoutBox)}return Va(this.latestValues)&&Cl(g,this.latestValues,(h=this.layout)==null?void 0:h.layoutBox),g}removeTransform(d){var m;const f=Gt();ur(f,d);for(let g=0;g<this.path.length;g++){const y=this.path[g];if(!Va(y.latestValues))continue;let h;y.instance&&(Vd(y.latestValues)&&y.updateSnapshot(),h=Gt(),ur(h,y.measurePageBox())),Bm(f,y.latestValues,(m=y.snapshot)==null?void 0:m.layoutBox,h)}return Va(this.latestValues)&&Bm(f,this.latestValues),f}setTargetDelta(d){this.targetDelta=d,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(d){this.options={...this.options,...d,crossfade:d.crossfade!==void 0?d.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==nn.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(d=!1){var k;const f=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=f.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=f.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=f.isSharedProjectionDirty);const m=!!this.resumingFrom||this!==f;if(!(d||m&&this.isSharedProjectionDirty||this.isProjectionDirty||(k=this.parent)!=null&&k.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:y,layoutId:h}=this.options;if(!this.layout||!(y||h))return;this.resolvedRelativeTargetAt=nn.timestamp;const b=this.getClosestProjectingParent();b&&this.linkedParentVersion!==b.layoutVersion&&!b.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&b&&b.layout?this.createRelativeTarget(b,this.layout.layoutBox,b.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Gt(),this.targetWithTransforms=Gt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),dk(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):ur(this.target,this.layout.layoutBox),Fy(this.target,this.targetDelta)):ur(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&b&&!!b.resumingFrom==!!this.resumingFrom&&!b.options.layoutScroll&&b.target&&this.animationProgress!==1?this.createRelativeTarget(b,this.target,b.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||Vd(this.parent.latestValues)||_y(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(d,f,m){this.relativeParent=d,this.linkedParentVersion=d.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Gt(),this.relativeTargetOrigin=Gt(),zl(this.relativeTargetOrigin,f,m,this.options.layoutAnchor||void 0),ur(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var C;const d=this.getLead(),f=!!this.resumingFrom||this!==d;let m=!0;if((this.isProjectionDirty||(C=this.parent)!=null&&C.isProjectionDirty)&&(m=!1),f&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(m=!1),this.resolvedRelativeTargetAt===nn.timestamp&&(m=!1),m)return;const{layout:g,layoutId:y}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(g||y))return;ur(this.layoutCorrected,this.layout.layoutBox);const h=this.treeScale.x,b=this.treeScale.y;z4(this.layoutCorrected,this.treeScale,this.path,f),d.layout&&!d.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(d.target=d.layout.layoutBox,d.targetWithTransforms=Gt());const{target:k}=d;if(!k){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(_m(this.prevProjectionDelta.x,this.projectionDelta.x),_m(this.prevProjectionDelta.y,this.projectionDelta.y)),Ii(this.projectionDelta,this.layoutCorrected,k,this.latestValues),(this.treeScale.x!==h||this.treeScale.y!==b||!Hm(this.projectionDelta.x,this.prevProjectionDelta.x)||!Hm(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",k))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(d=!0){var f;if((f=this.options.visualElement)==null||f.scheduleRender(),d){const m=this.getStack();m&&m.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Ts(),this.projectionDelta=Ts(),this.projectionDeltaWithTransform=Ts()}setAnimationOrigin(d,f=!1){const m=this.snapshot,g=m?m.latestValues:{},y={...this.latestValues},h=Ts();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!f;const b=Gt(),k=m?m.source:void 0,C=this.layout?this.layout.source:void 0,N=k!==C,j=this.getStack(),M=!j||j.members.length<=1,P=!!(N&&!M&&this.options.crossfade===!0&&!this.path.some(Vk));this.animationProgress=0;let F;this.mixTargetDelta=U=>{const W=U/1e3;qm(h.x,d.x,W),qm(h.y,d.y,W),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(zl(b,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),zk(this.relativeTarget,this.relativeTargetOrigin,b,W),F&&mk(this.relativeTarget,F)&&(this.isProjectionDirty=!1),F||(F=Gt()),ur(F,this.relativeTarget)),N&&(this.animationValues=y,xk(y,g,this.latestValues,W,P,M)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=W},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(d){var f,m,g;this.notifyListeners("animationStart"),(f=this.currentAnimation)==null||f.stop(),(g=(m=this.resumingFrom)==null?void 0:m.currentAnimation)==null||g.stop(),this.pendingAnimation&&(Sa(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=yt.update(()=>{El.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Fs(0)),this.motionValue.jump(0,!1),this.currentAnimation=wk(this.motionValue,[0,1e3],{...d,velocity:0,isSync:!0,onUpdate:y=>{this.mixTargetDelta(y),d.onUpdate&&d.onUpdate(y)},onStop:()=>{},onComplete:()=>{d.onComplete&&d.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const d=this.getStack();d&&d.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Nk),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const d=this.getLead();let{targetWithTransforms:f,target:m,layout:g,latestValues:y}=d;if(!(!f||!m||!g)){if(this!==d&&this.layout&&g&&Qy(this.options.animationType,this.layout.layoutBox,g.layoutBox)){m=this.target||Gt();const h=wn(this.layout.layoutBox.x);m.x.min=d.target.x.min,m.x.max=m.x.min+h;const b=wn(this.layout.layoutBox.y);m.y.min=d.target.y.min,m.y.max=m.y.min+b}ur(f,m),Cl(f,y),Ii(this.projectionDeltaWithTransform,this.layoutCorrected,f,y)}}registerSharedNode(d,f){this.sharedNodes.has(d)||this.sharedNodes.set(d,new Ck),this.sharedNodes.get(d).add(f);const g=f.options.initialPromotionConfig;f.promote({transition:g?g.transition:void 0,preserveFollowOpacity:g&&g.shouldPreserveFollowOpacity?g.shouldPreserveFollowOpacity(f):void 0})}isLead(){const d=this.getStack();return d?d.lead===this:!0}getLead(){var f;const{layoutId:d}=this.options;return d?((f=this.getStack())==null?void 0:f.lead)||this:this}getPrevLead(){var f;const{layoutId:d}=this.options;return d?(f=this.getStack())==null?void 0:f.prevLead:void 0}getStack(){const{layoutId:d}=this.options;if(d)return this.root.sharedNodes.get(d)}promote({needsReset:d,transition:f,preserveFollowOpacity:m}={}){const g=this.getStack();g&&g.promote(this,m),d&&(this.projectionDelta=void 0,this.needsReset=!0),f&&this.setOptions({transition:f})}relegate(){const d=this.getStack();return d?d.relegate(this):!1}resetSkewAndRotation(){const{visualElement:d}=this.options;if(!d)return;let f=!1;const{latestValues:m}=d;if((m.z||m.rotate||m.rotateX||m.rotateY||m.rotateZ||m.skewX||m.skewY)&&(f=!0),!f)return;const g={};m.z&&td("z",d,g,this.animationValues);for(let y=0;y<ed.length;y++)td(`rotate${ed[y]}`,d,g,this.animationValues),td(`skew${ed[y]}`,d,g,this.animationValues);d.render();for(const y in g)d.setStaticValue(y,g[y]),this.animationValues&&(this.animationValues[y]=g[y]);d.scheduleRender()}applyProjectionStyles(d,f){if(!this.instance||this.isSVG)return;if(!this.isVisible){d.visibility="hidden";return}const m=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,d.visibility="",d.opacity="",d.pointerEvents=Nl(f==null?void 0:f.pointerEvents)||"",d.transform=m?m(this.latestValues,""):"none";return}const g=this.getLead();if(!this.projectionDelta||!this.layout||!g.target){this.options.layoutId&&(d.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,d.pointerEvents=Nl(f==null?void 0:f.pointerEvents)||""),this.hasProjected&&!Va(this.latestValues)&&(d.transform=m?m({},""):"none",this.hasProjected=!1);return}d.visibility="";const y=g.animationValues||g.latestValues;this.applyTransformsToTarget();let h=gk(this.projectionDeltaWithTransform,this.treeScale,y);m&&(h=m(y,h)),d.transform=h;const{x:b,y:k}=this.projectionDelta;d.transformOrigin=`${b.origin*100}% ${k.origin*100}% 0`,g.animationValues?d.opacity=g===this?y.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:y.opacityExit:d.opacity=g===this?y.opacity!==void 0?y.opacity:"":y.opacityExit!==void 0?y.opacityExit:0;for(const C in $d){if(y[C]===void 0)continue;const{correct:N,applyTo:j,isCSSVariable:M}=$d[C],P=h==="none"?y[C]:N(y[C],g);if(j){const F=j.length;for(let U=0;U<F;U++)d[j[U]]=P}else M?this.options.visualElement.renderState.vars[C]=P:d[C]=P}this.options.layoutId&&(d.pointerEvents=g===this?Nl(f==null?void 0:f.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(d=>{var f;return(f=d.currentAnimation)==null?void 0:f.stop()}),this.root.nodes.forEach(Gm),this.root.sharedNodes.clear()}}}function Tk(e){e.updateLayout()}function Pk(e){var a;const n=((a=e.resumeFrom)==null?void 0:a.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:o}=e.layout,{animationType:l}=e.options,d=n.source!==e.layout.source;if(l==="size")Tr(h=>{const b=d?n.measuredBox[h]:n.layoutBox[h],k=wn(b);b.min=s[h].min,b.max=b.min+k});else if(l==="x"||l==="y"){const h=l==="x"?"y":"x";Hd(d?n.measuredBox[h]:n.layoutBox[h],s[h])}else Qy(l,n.layoutBox,s)&&Tr(h=>{const b=d?n.measuredBox[h]:n.layoutBox[h],k=wn(s[h]);b.max=b.min+k,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[h].max=e.relativeTarget[h].min+k)});const f=Ts();Ii(f,s,n.layoutBox);const m=Ts();d?Ii(m,e.applyTransform(o,!0),n.measuredBox):Ii(m,s,n.layoutBox);const g=!Ky(f);let y=!1;if(!e.resumeFrom){const h=e.getClosestProjectingParent();if(h&&!h.resumeFrom){const{snapshot:b,layout:k}=h;if(b&&k){const C=e.options.layoutAnchor||void 0,N=Gt();zl(N,n.layoutBox,b.layoutBox,C);const j=Gt();zl(j,s,k.layoutBox,C),Yy(N,j)||(y=!0),h.options.layoutRoot&&(e.relativeTarget=j,e.relativeTargetOrigin=N,e.relativeParent=h)}}}e.notifyListeners("didUpdate",{layout:s,snapshot:n,delta:m,layoutDelta:f,hasLayoutChanged:g,hasRelativeLayoutChanged:y})}else if(e.isLead()){const{onExitComplete:s}=e.options;s&&s()}e.options.transition=void 0}function Rk(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function Mk(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function Ik(e){e.clearSnapshot()}function Gm(e){e.clearMeasurements()}function _k(e){e.isLayoutDirty=!0,e.updateLayout()}function Xm(e){e.isLayoutDirty=!1}function Fk(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function Dk(e){const{visualElement:n}=e.options;n&&n.getProps().onBeforeLayoutMeasure&&n.notify("BeforeLayoutMeasure"),e.resetTransform()}function Jm(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function Lk(e){e.resolveTargetDelta()}function Ak(e){e.calcProjection()}function Ok(e){e.resetSkewAndRotation()}function Bk(e){e.removeLeadSnapshot()}function qm(e,n,a){e.translate=Nt(n.translate,0,a),e.scale=Nt(n.scale,1,a),e.origin=n.origin,e.originPoint=n.originPoint}function Qm(e,n,a,s){e.min=Nt(n.min,a.min,s),e.max=Nt(n.max,a.max,s)}function zk(e,n,a,s){Qm(e.x,n.x,a.x,s),Qm(e.y,n.y,a.y,s)}function Vk(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const Uk={duration:.45,ease:[.4,0,.1,1]},Zm=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),eg=Zm("applewebkit/")&&!Zm("chrome/")?Math.round:Zn;function tg(e){e.min=eg(e.min),e.max=eg(e.max)}function $k(e){tg(e.x),tg(e.y)}function Qy(e,n,a){return e==="position"||e==="preserve-aspect"&&!uk($m(n),$m(a),.2)}function Hk(e){var n;return e!==e.root&&((n=e.scroll)==null?void 0:n.wasRoot)}const Wk=qy({attachResizeListener:(e,n)=>zi(e,"resize",n),measureScroll:()=>{var e,n;return{x:document.documentElement.scrollLeft||((e=document.body)==null?void 0:e.scrollLeft)||0,y:document.documentElement.scrollTop||((n=document.body)==null?void 0:n.scrollTop)||0}},checkIsScrollRoot:()=>!0}),nd={current:void 0},Zy=qy({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!nd.current){const e=new Wk({});e.mount(window),e.setOptions({layoutScroll:!0}),nd.current=e}return nd.current},resetTransform:(e,n)=>{e.style.transform=n!==void 0?n:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),Bf=v.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function ng(e,n){if(typeof e=="function")return e(n);e!=null&&(e.current=n)}function Kk(...e){return n=>{let a=!1;const s=e.map(o=>{const l=ng(o,n);return!a&&typeof l=="function"&&(a=!0),l});if(a)return()=>{for(let o=0;o<s.length;o++){const l=s[o];typeof l=="function"?l():ng(e[o],null)}}}}function Yk(...e){return v.useCallback(Kk(...e),e)}class Gk extends v.Component{getSnapshotBeforeUpdate(n){const a=this.props.childRef.current;if(wl(a)&&n.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const s=a.offsetParent,o=wl(s)&&s.offsetWidth||0,l=wl(s)&&s.offsetHeight||0,d=getComputedStyle(a),f=this.props.sizeRef.current;f.height=parseFloat(d.height),f.width=parseFloat(d.width),f.top=a.offsetTop,f.left=a.offsetLeft,f.right=o-f.width-f.left,f.bottom=l-f.height-f.top}return null}componentDidUpdate(){}render(){return this.props.children}}function Xk({children:e,isPresent:n,anchorX:a,anchorY:s,root:o,pop:l}){var b;const d=v.useId(),f=v.useRef(null),m=v.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:g}=v.useContext(Bf),y=((b=e.props)==null?void 0:b.ref)??(e==null?void 0:e.ref),h=Yk(f,y);return v.useInsertionEffect(()=>{const{width:k,height:C,top:N,left:j,right:M,bottom:P}=m.current;if(n||l===!1||!f.current||!k||!C)return;const F=a==="left"?`left: ${j}`:`right: ${M}`,U=s==="bottom"?`bottom: ${P}`:`top: ${N}`;f.current.dataset.motionPopId=d;const W=document.createElement("style");g&&(W.nonce=g);const J=o??document.head;return J.appendChild(W),W.sheet&&W.sheet.insertRule(`
[data-motion-pop-id="${d}"] {
position: absolute !important;
width: ${k}px !important;
height: ${C}px !important;
${F}px !important;
${U}px !important;
}
`),()=>{var A;(A=f.current)==null||A.removeAttribute("data-motion-pop-id"),J.contains(W)&&J.removeChild(W)}},[n]),u.jsx(Gk,{isPresent:n,childRef:f,sizeRef:m,pop:l,children:l===!1?e:v.cloneElement(e,{ref:h})})}const Jk=({children:e,initial:n,isPresent:a,onExitComplete:s,custom:o,presenceAffectsLayout:l,mode:d,anchorX:f,anchorY:m,root:g})=>{const y=hf(qk),h=v.useId();let b=!0,k=v.useMemo(()=>(b=!1,{id:h,initial:n,isPresent:a,custom:o,onExitComplete:C=>{y.set(C,!0);for(const N of y.values())if(!N)return;s&&s()},register:C=>(y.set(C,!1),()=>y.delete(C))}),[a,y,s]);return l&&b&&(k={...k}),v.useMemo(()=>{y.forEach((C,N)=>y.set(N,!1))},[a]),v.useEffect(()=>{!a&&!y.size&&s&&s()},[a]),e=u.jsx(Xk,{pop:d==="popLayout",isPresent:a,anchorX:f,anchorY:m,root:g,children:e}),u.jsx(Xl.Provider,{value:k,children:e})};function qk(){return new Map}function ex(e=!0){const n=v.useContext(Xl);if(n===null)return[!0,null];const{isPresent:a,onExitComplete:s,register:o}=n,l=v.useId();v.useEffect(()=>{if(e)return o(l)},[e]);const d=v.useCallback(()=>e&&s&&s(l),[l,s,e]);return!a&&s?[!1,d]:[!0]}const ll=e=>e.key||"";function rg(e){const n=[];return v.Children.forEach(e,a=>{v.isValidElement(a)&&n.push(a)}),n}const pn=({children:e,custom:n,initial:a=!0,onExitComplete:s,presenceAffectsLayout:o=!0,mode:l="sync",propagate:d=!1,anchorX:f="left",anchorY:m="top",root:g})=>{const[y,h]=ex(d),b=v.useMemo(()=>rg(e),[e]),k=d&&!y?[]:b.map(ll),C=v.useRef(!0),N=v.useRef(b),j=hf(()=>new Map),M=v.useRef(new Set),[P,F]=v.useState(b),[U,W]=v.useState(b);E1(()=>{C.current=!1,N.current=b;for(let w=0;w<U.length;w++){const R=ll(U[w]);k.includes(R)?(j.delete(R),M.current.delete(R)):j.get(R)!==!0&&j.set(R,!1)}},[U,k.length,k.join("-")]);const J=[];if(b!==P){let w=[...b];for(let R=0;R<U.length;R++){const E=U[R],Y=ll(E);k.includes(Y)||(w.splice(R,0,E),J.push(E))}return l==="wait"&&J.length&&(w=J),W(rg(w)),F(b),null}const{forceRender:A}=v.useContext(ff);return u.jsx(u.Fragment,{children:U.map(w=>{const R=ll(w),E=d&&!y?!1:b===U||k.includes(R),Y=()=>{if(M.current.has(R))return;if(j.has(R))M.current.add(R),j.set(R,!0);else return;let K=!0;j.forEach(I=>{I||(K=!1)}),K&&(A==null||A(),W(N.current),d&&(h==null||h()),s&&s())};return u.jsx(Jk,{isPresent:E,initial:!C.current||a?void 0:!1,custom:n,presenceAffectsLayout:o,mode:l,root:g,onExitComplete:E?void 0:Y,anchorX:f,anchorY:m,children:w},R)})})},tx=v.createContext({strict:!1}),ag={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let sg=!1;function Qk(){if(sg)return;const e={};for(const n in ag)e[n]={isEnabled:a=>ag[n].some(s=>!!a[s])};Ry(e),sg=!0}function nx(){return Qk(),L4()}function Zk(e){const n=nx();for(const a in e)n[a]={...n[a],...e[a]};Ry(n)}const eS=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function Vl(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||eS.has(e)}let rx=e=>!Vl(e);function tS(e){typeof e=="function"&&(rx=n=>n.startsWith("on")?!Vl(n):e(n))}try{tS(require("@emotion/is-prop-valid").default)}catch{}function nS(e,n,a){const s={};for(const o in e)o==="values"&&typeof e.values=="object"||rn(e[o])||(rx(o)||a===!0&&Vl(o)||!n&&!Vl(o)||e.draggable&&o.startsWith("onDrag"))&&(s[o]=e[o]);return s}const Zl=v.createContext({});function rS(e,n){if(Ql(e)){const{initial:a,animate:s}=e;return{initial:a===!1||Bi(a)?a:void 0,animate:Bi(s)?s:void 0}}return e.inherit!==!1?n:{}}function aS(e){const{initial:n,animate:a}=rS(e,v.useContext(Zl));return v.useMemo(()=>({initial:n,animate:a}),[ig(n),ig(a)])}function ig(e){return Array.isArray(e)?e.join(" "):e}const zf=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function ax(e,n,a){for(const s in n)!rn(n[s])&&!Ay(s,a)&&(e[s]=n[s])}function sS({transformTemplate:e},n){return v.useMemo(()=>{const a=zf();return Af(a,n,e),Object.assign({},a.vars,a.style)},[n])}function iS(e,n){const a=e.style||{},s={};return ax(s,a,e),Object.assign(s,sS(e,n)),s}function oS(e,n){const a={},s=iS(e,n);return e.drag&&e.dragListener!==!1&&(a.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(a.tabIndex=0),a.style=s,a}const sx=()=>({...zf(),attrs:{}});function lS(e,n,a,s){const o=v.useMemo(()=>{const l=sx();return Oy(l,n,zy(s),e.transformTemplate,e.style),{...l.attrs,style:{...l.style}}},[n]);if(e.style){const l={};ax(l,e.style,e),o.style={...l,...o.style}}return o}const cS=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Vf(e){return typeof e!="string"||e.includes("-")?!1:!!(cS.indexOf(e)>-1||/[A-Z]/u.test(e))}function uS(e,n,a,{latestValues:s},o,l=!1,d){const m=(d??Vf(e)?lS:oS)(n,s,o,e),g=nS(n,typeof e=="string",l),y=e!==v.Fragment?{...g,...m,ref:a}:{},{children:h}=n,b=v.useMemo(()=>rn(h)?h.get():h,[h]);return v.createElement(e,{...y,children:b})}function dS({scrapeMotionValuesFromProps:e,createRenderState:n},a,s,o){return{latestValues:fS(a,s,o,e),renderState:n()}}function fS(e,n,a,s){const o={},l=s(e,{});for(const b in l)o[b]=Nl(l[b]);let{initial:d,animate:f}=e;const m=Ql(e),g=Ty(e);n&&g&&!m&&e.inherit!==!1&&(d===void 0&&(d=n.initial),f===void 0&&(f=n.animate));let y=a?a.initial===!1:!1;y=y||d===!1;const h=y?f:d;if(h&&typeof h!="boolean"&&!ql(h)){const b=Array.isArray(h)?h:[h];for(let k=0;k<b.length;k++){const C=Tf(e,b[k]);if(C){const{transitionEnd:N,transition:j,...M}=C;for(const P in M){let F=M[P];if(Array.isArray(F)){const U=y?F.length-1:0;F=F[U]}F!==null&&(o[P]=F)}for(const P in N)o[P]=N[P]}}}return o}const ix=e=>(n,a)=>{const s=v.useContext(Zl),o=v.useContext(Xl),l=()=>dS(e,n,s,o);return a?l():hf(l)},hS=ix({scrapeMotionValuesFromProps:Of,createRenderState:zf}),pS=ix({scrapeMotionValuesFromProps:Vy,createRenderState:sx}),mS=Symbol.for("motionComponentSymbol");function gS(e,n,a){const s=v.useRef(a);v.useInsertionEffect(()=>{s.current=a});const o=v.useRef(null);return v.useCallback(l=>{var f;l&&((f=e.onMount)==null||f.call(e,l));const d=s.current;if(typeof d=="function")if(l){const m=d(l);typeof m=="function"&&(o.current=m)}else o.current?(o.current(),o.current=null):d(l);else d&&(d.current=l);n&&(l?n.mount(l):n.unmount())},[n])}const ox=v.createContext({});function Ss(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function yS(e,n,a,s,o,l){var F,U;const{visualElement:d}=v.useContext(Zl),f=v.useContext(tx),m=v.useContext(Xl),g=v.useContext(Bf),y=g.reducedMotion,h=g.skipAnimations,b=v.useRef(null),k=v.useRef(!1);s=s||f.renderer,!b.current&&s&&(b.current=s(e,{visualState:n,parent:d,props:a,presenceContext:m,blockInitialAnimation:m?m.initial===!1:!1,reducedMotionConfig:y,skipAnimations:h,isSVG:l}),k.current&&b.current&&(b.current.manuallyAnimateOnMount=!0));const C=b.current,N=v.useContext(ox);C&&!C.projection&&o&&(C.type==="html"||C.type==="svg")&&xS(b.current,a,o,N);const j=v.useRef(!1);v.useInsertionEffect(()=>{C&&j.current&&C.update(a,m)});const M=a[my],P=v.useRef(!!M&&typeof window<"u"&&!((F=window.MotionHandoffIsComplete)!=null&&F.call(window,M))&&((U=window.MotionHasOptimisedAnimation)==null?void 0:U.call(window,M)));return E1(()=>{k.current=!0,C&&(j.current=!0,window.MotionIsMounted=!0,C.updateFeatures(),C.scheduleRenderMicrotask(),P.current&&C.animationState&&C.animationState.animateChanges())}),v.useEffect(()=>{C&&(!P.current&&C.animationState&&C.animationState.animateChanges(),P.current&&(queueMicrotask(()=>{var W;(W=window.MotionHandoffMarkAsComplete)==null||W.call(window,M)}),P.current=!1),C.enteringChildren=void 0)}),C}function xS(e,n,a,s){const{layoutId:o,layout:l,drag:d,dragConstraints:f,layoutScroll:m,layoutRoot:g,layoutAnchor:y,layoutCrossfade:h}=n;e.projection=new a(e.latestValues,n["data-framer-portal-id"]?void 0:lx(e.parent)),e.projection.setOptions({layoutId:o,layout:l,alwaysMeasureLayout:!!d||f&&Ss(f),visualElement:e,animationType:typeof l=="string"?l:"both",initialPromotionConfig:s,crossfade:h,layoutScroll:m,layoutRoot:g,layoutAnchor:y})}function lx(e){if(e)return e.options.allowProjection!==!1?e.projection:lx(e.parent)}function rd(e,{forwardMotionProps:n=!1,type:a}={},s,o){s&&Zk(s);const l=a?a==="svg":Vf(e),d=l?pS:hS;function f(g,y){let h;const b={...v.useContext(Bf),...g,layoutId:vS(g)},{isStatic:k}=b,C=aS(g),N=d(g,k);if(!k&&typeof window<"u"){bS();const j=wS(b);h=j.MeasureLayout,C.visualElement=yS(e,N,b,o,j.ProjectionNode,l)}return u.jsxs(Zl.Provider,{value:C,children:[h&&C.visualElement?u.jsx(h,{visualElement:C.visualElement,...b}):null,uS(e,g,gS(N,C.visualElement,y),N,k,n,l)]})}f.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const m=v.forwardRef(f);return m[mS]=e,m}function vS({layoutId:e}){const n=v.useContext(ff).id;return n&&e!==void 0?n+"-"+e:e}function bS(e,n){v.useContext(tx).strict}function wS(e){const n=nx(),{drag:a,layout:s}=n;if(!a&&!s)return{};const o={...a,...s};return{MeasureLayout:a!=null&&a.isEnabled(e)||s!=null&&s.isEnabled(e)?o.MeasureLayout:void 0,ProjectionNode:o.ProjectionNode}}function kS(e,n){if(typeof Proxy>"u")return rd;const a=new Map,s=(l,d)=>rd(l,d,e,n),o=(l,d)=>s(l,d);return new Proxy(o,{get:(l,d)=>d==="create"?s:(a.has(d)||a.set(d,rd(d,void 0,e,n)),a.get(d))})}const SS=(e,n)=>n.isSVG??Vf(e)?new Z4(n):new Y4(n,{allowProjection:e!==v.Fragment});class jS extends Ca{constructor(n){super(n),n.animationState||(n.animationState=ak(n))}updateAnimationControlsSubscription(){const{animate:n}=this.node.getProps();ql(n)&&(this.unmountControls=n.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:n}=this.node.getProps(),{animate:a}=this.node.prevProps||{};n!==a&&this.updateAnimationControlsSubscription()}unmount(){var n;this.node.animationState.reset(),(n=this.unmountControls)==null||n.call(this)}}let CS=0;class NS extends Ca{constructor(){super(...arguments),this.id=CS++,this.isExitComplete=!1}update(){var l;if(!this.node.presenceContext)return;const{isPresent:n,onExitComplete:a}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||n===s)return;if(n&&s===!1){if(this.isExitComplete){const{initial:d,custom:f}=this.node.getProps();if(typeof d=="string"){const m=Ka(this.node,d,f);if(m){const{transition:g,transitionEnd:y,...h}=m;for(const b in h)(l=this.node.getValue(b))==null||l.jump(h[b])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const o=this.node.animationState.setActive("exit",!n);a&&!n&&o.then(()=>{this.isExitComplete=!0,a(this.id)})}mount(){const{register:n,onExitComplete:a}=this.node.presenceContext||{};a&&a(this.id),n&&(this.unmount=n(this.id))}unmount(){}}const ES={animation:{Feature:jS},exit:{Feature:NS}};function Ji(e){return{point:{x:e.pageX,y:e.pageY}}}const TS=e=>n=>If(n)&&e(n,Ji(n));function _i(e,n,a,s){return zi(e,n,TS(a),s)}const cx=({current:e})=>e?e.ownerDocument.defaultView:null,og=(e,n)=>Math.abs(e-n);function PS(e,n){const a=og(e.x,n.x),s=og(e.y,n.y);return Math.sqrt(a**2+s**2)}const lg=new Set(["auto","scroll"]);class ux{constructor(n,a,{transformPagePoint:s,contextWindow:o=window,dragSnapToOrigin:l=!1,distanceThreshold:d=3,element:f}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=k=>{this.handleScroll(k.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=cl(this.lastRawMoveEventInfo,this.transformPagePoint));const k=ad(this.lastMoveEventInfo,this.history),C=this.startEvent!==null,N=PS(k.offset,{x:0,y:0})>=this.distanceThreshold;if(!C&&!N)return;const{point:j}=k,{timestamp:M}=nn;this.history.push({...j,timestamp:M});const{onStart:P,onMove:F}=this.handlers;C||(P&&P(this.lastMoveEvent,k),this.startEvent=this.lastMoveEvent),F&&F(this.lastMoveEvent,k)},this.handlePointerMove=(k,C)=>{this.lastMoveEvent=k,this.lastRawMoveEventInfo=C,this.lastMoveEventInfo=cl(C,this.transformPagePoint),yt.update(this.updatePoint,!0)},this.handlePointerUp=(k,C)=>{this.end();const{onEnd:N,onSessionEnd:j,resumeAnimation:M}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&M&&M(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const P=ad(k.type==="pointercancel"?this.lastMoveEventInfo:cl(C,this.transformPagePoint),this.history);this.startEvent&&N&&N(k,P),j&&j(k,P)},!If(n))return;this.dragSnapToOrigin=l,this.handlers=a,this.transformPagePoint=s,this.distanceThreshold=d,this.contextWindow=o||window;const m=Ji(n),g=cl(m,this.transformPagePoint),{point:y}=g,{timestamp:h}=nn;this.history=[{...y,timestamp:h}];const{onSessionStart:b}=a;b&&b(n,ad(g,this.history)),this.removeListeners=Yi(_i(this.contextWindow,"pointermove",this.handlePointerMove),_i(this.contextWindow,"pointerup",this.handlePointerUp),_i(this.contextWindow,"pointercancel",this.handlePointerUp)),f&&this.startScrollTracking(f)}startScrollTracking(n){let a=n.parentElement;for(;a;){const s=getComputedStyle(a);(lg.has(s.overflowX)||lg.has(s.overflowY))&&this.scrollPositions.set(a,{x:a.scrollLeft,y:a.scrollTop}),a=a.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(n){const a=this.scrollPositions.get(n);if(!a)return;const s=n===window,o=s?{x:window.scrollX,y:window.scrollY}:{x:n.scrollLeft,y:n.scrollTop},l={x:o.x-a.x,y:o.y-a.y};l.x===0&&l.y===0||(s?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=l.x,this.lastMoveEventInfo.point.y+=l.y):this.history.length>0&&(this.history[0].x-=l.x,this.history[0].y-=l.y),this.scrollPositions.set(n,o),yt.update(this.updatePoint,!0))}updateHandlers(n){this.handlers=n}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Sa(this.updatePoint)}}function cl(e,n){return n?{point:n(e.point)}:e}function cg(e,n){return{x:e.x-n.x,y:e.y-n.y}}function ad({point:e},n){return{point:e,delta:cg(e,dx(n)),offset:cg(e,RS(n)),velocity:MS(n,.1)}}function RS(e){return e[0]}function dx(e){return e[e.length-1]}function MS(e,n){if(e.length<2)return{x:0,y:0};let a=e.length-1,s=null;const o=dx(e);for(;a>=0&&(s=e[a],!(o.timestamp-s.timestamp>Bn(n)));)a--;if(!s)return{x:0,y:0};s===e[0]&&e.length>2&&o.timestamp-s.timestamp>Bn(n)*2&&(s=e[1]);const l=Jn(o.timestamp-s.timestamp);if(l===0)return{x:0,y:0};const d={x:(o.x-s.x)/l,y:(o.y-s.y)/l};return d.x===1/0&&(d.x=0),d.y===1/0&&(d.y=0),d}function IS(e,{min:n,max:a},s){return n!==void 0&&e<n?e=s?Nt(n,e,s.min):Math.max(e,n):a!==void 0&&e>a&&(e=s?Nt(a,e,s.max):Math.min(e,a)),e}function ug(e,n,a){return{min:n!==void 0?e.min+n:void 0,max:a!==void 0?e.max+a-(e.max-e.min):void 0}}function _S(e,{top:n,left:a,bottom:s,right:o}){return{x:ug(e.x,a,o),y:ug(e.y,n,s)}}function dg(e,n){let a=n.min-e.min,s=n.max-e.max;return n.max-n.min<e.max-e.min&&([a,s]=[s,a]),{min:a,max:s}}function FS(e,n){return{x:dg(e.x,n.x),y:dg(e.y,n.y)}}function DS(e,n){let a=.5;const s=wn(e),o=wn(n);return o>s?a=Ai(n.min,n.max-s,e.min):s>o&&(a=Ai(e.min,e.max-o,n.min)),Ir(0,1,a)}function LS(e,n){const a={};return n.min!==void 0&&(a.min=n.min-e.min),n.max!==void 0&&(a.max=n.max-e.min),a}const Wd=.35;function AS(e=Wd){return e===!1?e=0:e===!0&&(e=Wd),{x:fg(e,"left","right"),y:fg(e,"top","bottom")}}function fg(e,n,a){return{min:hg(e,n),max:hg(e,a)}}function hg(e,n){return typeof e=="number"?e:e[n]||0}const OS=new WeakMap;class BS{constructor(n){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Gt(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=n}start(n,{snapToCursor:a=!1,distanceThreshold:s}={}){const{presenceContext:o}=this.visualElement;if(o&&o.isPresent===!1)return;const l=h=>{a&&this.snapToCursor(Ji(h).point),this.stopAnimation()},d=(h,b)=>{const{drag:k,dragPropagation:C,onDragStart:N}=this.getProps();if(k&&!C&&(this.openDragLock&&this.openDragLock(),this.openDragLock=h4(k),!this.openDragLock))return;this.latestPointerEvent=h,this.latestPanInfo=b,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Tr(M=>{let P=this.getAxisMotionValue(M).get()||0;if(Rr.test(P)){const{projection:F}=this.visualElement;if(F&&F.layout){const U=F.layout.layoutBox[M];U&&(P=wn(U)*(parseFloat(P)/100))}}this.originPoint[M]=P}),N&&yt.update(()=>N(h,b),!1,!0),Ad(this.visualElement,"transform");const{animationState:j}=this.visualElement;j&&j.setActive("whileDrag",!0)},f=(h,b)=>{this.latestPointerEvent=h,this.latestPanInfo=b;const{dragPropagation:k,dragDirectionLock:C,onDirectionLock:N,onDrag:j}=this.getProps();if(!k&&!this.openDragLock)return;const{offset:M}=b;if(C&&this.currentDirection===null){this.currentDirection=VS(M),this.currentDirection!==null&&N&&N(this.currentDirection);return}this.updateAxis("x",b.point,M),this.updateAxis("y",b.point,M),this.visualElement.render(),j&&yt.update(()=>j(h,b),!1,!0)},m=(h,b)=>{this.latestPointerEvent=h,this.latestPanInfo=b,this.stop(h,b),this.latestPointerEvent=null,this.latestPanInfo=null},g=()=>{const{dragSnapToOrigin:h}=this.getProps();(h||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:y}=this.getProps();this.panSession=new ux(n,{onSessionStart:l,onStart:d,onMove:f,onSessionEnd:m,resumeAnimation:g},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:y,distanceThreshold:s,contextWindow:cx(this.visualElement),element:this.visualElement.current})}stop(n,a){const s=n||this.latestPointerEvent,o=a||this.latestPanInfo,l=this.isDragging;if(this.cancel(),!l||!o||!s)return;const{velocity:d}=o;this.startAnimation(d);const{onDragEnd:f}=this.getProps();f&&yt.postRender(()=>f(s,o))}cancel(){this.isDragging=!1;const{projection:n,animationState:a}=this.visualElement;n&&(n.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:s}=this.getProps();!s&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),a&&a.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(n,a,s){const{drag:o}=this.getProps();if(!s||!ul(n,o,this.currentDirection))return;const l=this.getAxisMotionValue(n);let d=this.originPoint[n]+s[n];this.constraints&&this.constraints[n]&&(d=IS(d,this.constraints[n],this.elastic[n])),l.set(d)}resolveConstraints(){var l;const{dragConstraints:n,dragElastic:a}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(l=this.visualElement.projection)==null?void 0:l.layout,o=this.constraints;n&&Ss(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&s?this.constraints=_S(s.layoutBox,n):this.constraints=!1,this.elastic=AS(a),o!==this.constraints&&!Ss(n)&&s&&this.constraints&&!this.hasMutatedConstraints&&Tr(d=>{this.constraints!==!1&&this.getAxisMotionValue(d)&&(this.constraints[d]=LS(s.layoutBox[d],this.constraints[d]))})}resolveRefConstraints(){const{dragConstraints:n,onMeasureDragConstraints:a}=this.getProps();if(!n||!Ss(n))return!1;const s=n.current,{projection:o}=this.visualElement;if(!o||!o.layout)return!1;const l=V4(s,o.root,this.visualElement.getTransformPagePoint());let d=FS(o.layout.layoutBox,l);if(a){const f=a(O4(d));this.hasMutatedConstraints=!!f,f&&(d=Iy(f))}return d}startAnimation(n){const{drag:a,dragMomentum:s,dragElastic:o,dragTransition:l,dragSnapToOrigin:d,onDragTransitionEnd:f}=this.getProps(),m=this.constraints||{},g=Tr(y=>{if(!ul(y,a,this.currentDirection))return;let h=m&&m[y]||{};(d===!0||d===y)&&(h={min:0,max:0});const b=o?200:1e6,k=o?40:1e7,C={type:"inertia",velocity:s?n[y]:0,bounceStiffness:b,bounceDamping:k,timeConstant:750,restDelta:1,restSpeed:10,...l,...h};return this.startAxisValueAnimation(y,C)});return Promise.all(g).then(f)}startAxisValueAnimation(n,a){const s=this.getAxisMotionValue(n);return Ad(this.visualElement,n),s.start(Ef(n,s,0,a,this.visualElement,!1))}stopAnimation(){Tr(n=>this.getAxisMotionValue(n).stop())}getAxisMotionValue(n){const a=`_drag${n.toUpperCase()}`,s=this.visualElement.getProps(),o=s[a];return o||this.visualElement.getValue(n,(s.initial?s.initial[n]:void 0)||0)}snapToCursor(n){Tr(a=>{const{drag:s}=this.getProps();if(!ul(a,s,this.currentDirection))return;const{projection:o}=this.visualElement,l=this.getAxisMotionValue(a);if(o&&o.layout){const{min:d,max:f}=o.layout.layoutBox[a],m=l.get()||0;l.set(n[a]-Nt(d,f,.5)+m)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:n,dragConstraints:a}=this.getProps(),{projection:s}=this.visualElement;if(!Ss(a)||!s||!this.constraints)return;this.stopAnimation();const o={x:0,y:0};Tr(d=>{const f=this.getAxisMotionValue(d);if(f&&this.constraints!==!1){const m=f.get();o[d]=DS({min:m,max:m},this.constraints[d])}});const{transformTemplate:l}=this.visualElement.getProps();this.visualElement.current.style.transform=l?l({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.constraints=!1,this.resolveConstraints(),Tr(d=>{if(!ul(d,n,null))return;const f=this.getAxisMotionValue(d),{min:m,max:g}=this.constraints[d];f.set(Nt(m,g,o[d]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;OS.set(this.visualElement,this);const n=this.visualElement.current,a=_i(n,"pointerdown",g=>{const{drag:y,dragListener:h=!0}=this.getProps(),b=g.target,k=b!==n&&v4(b);y&&h&&!k&&this.start(g)});let s;const o=()=>{const{dragConstraints:g}=this.getProps();Ss(g)&&g.current&&(this.constraints=this.resolveRefConstraints(),s||(s=zS(n,g.current,()=>this.scalePositionWithinConstraints())))},{projection:l}=this.visualElement,d=l.addEventListener("measure",o);l&&!l.layout&&(l.root&&l.root.updateScroll(),l.updateLayout()),yt.read(o);const f=zi(window,"resize",()=>this.scalePositionWithinConstraints()),m=l.addEventListener("didUpdate",(({delta:g,hasLayoutChanged:y})=>{this.isDragging&&y&&(Tr(h=>{const b=this.getAxisMotionValue(h);b&&(this.originPoint[h]+=g[h].translate,b.set(b.get()+g[h].translate))}),this.visualElement.render())}));return()=>{f(),a(),d(),m&&m(),s&&s()}}getProps(){const n=this.visualElement.getProps(),{drag:a=!1,dragDirectionLock:s=!1,dragPropagation:o=!1,dragConstraints:l=!1,dragElastic:d=Wd,dragMomentum:f=!0}=n;return{...n,drag:a,dragDirectionLock:s,dragPropagation:o,dragConstraints:l,dragElastic:d,dragMomentum:f}}}function pg(e){let n=!0;return()=>{if(n){n=!1;return}e()}}function zS(e,n,a){const s=wm(e,pg(a)),o=wm(n,pg(a));return()=>{s(),o()}}function ul(e,n,a){return(n===!0||n===e)&&(a===null||a===e)}function VS(e,n=10){let a=null;return Math.abs(e.y)>n?a="y":Math.abs(e.x)>n&&(a="x"),a}class US extends Ca{constructor(n){super(n),this.removeGroupControls=Zn,this.removeListeners=Zn,this.controls=new BS(n)}mount(){const{dragControls:n}=this.node.getProps();n&&(this.removeGroupControls=n.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Zn}update(){const{dragControls:n}=this.node.getProps(),{dragControls:a}=this.node.prevProps||{};n!==a&&(this.removeGroupControls(),n&&(this.removeGroupControls=n.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const sd=e=>(n,a)=>{e&&yt.update(()=>e(n,a),!1,!0)};class $S extends Ca{constructor(){super(...arguments),this.removePointerDownListener=Zn}onPointerDown(n){this.session=new ux(n,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:cx(this.node)})}createPanHandlers(){const{onPanSessionStart:n,onPanStart:a,onPan:s,onPanEnd:o}=this.node.getProps();return{onSessionStart:sd(n),onStart:sd(a),onMove:sd(s),onEnd:(l,d)=>{delete this.session,o&&yt.postRender(()=>o(l,d))}}}mount(){this.removePointerDownListener=_i(this.node.current,"pointerdown",n=>this.onPointerDown(n))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let id=!1;class HS extends v.Component{componentDidMount(){const{visualElement:n,layoutGroup:a,switchLayoutGroup:s,layoutId:o}=this.props,{projection:l}=n;l&&(a.group&&a.group.add(l),s&&s.register&&o&&s.register(l),id&&l.root.didUpdate(),l.addEventListener("animationComplete",()=>{this.safeToRemove()}),l.setOptions({...l.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),El.hasEverUpdated=!0}getSnapshotBeforeUpdate(n){const{layoutDependency:a,visualElement:s,drag:o,isPresent:l}=this.props,{projection:d}=s;return d&&(d.isPresent=l,n.layoutDependency!==a&&d.setOptions({...d.options,layoutDependency:a}),id=!0,o||n.layoutDependency!==a||a===void 0||n.isPresent!==l?d.willUpdate():this.safeToRemove(),n.isPresent!==l&&(l?d.promote():d.relegate()||yt.postRender(()=>{const f=d.getStack();(!f||!f.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:n,layoutAnchor:a}=this.props,{projection:s}=n;s&&(s.options.layoutAnchor=a,s.root.didUpdate(),Mf.postRender(()=>{!s.currentAnimation&&s.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:n,layoutGroup:a,switchLayoutGroup:s}=this.props,{projection:o}=n;id=!0,o&&(o.scheduleCheckAfterUnmount(),a&&a.group&&a.group.remove(o),s&&s.deregister&&s.deregister(o))}safeToRemove(){const{safeToRemove:n}=this.props;n&&n()}render(){return null}}function fx(e){const[n,a]=ex(),s=v.useContext(ff);return u.jsx(HS,{...e,layoutGroup:s,switchLayoutGroup:v.useContext(ox),isPresent:n,safeToRemove:a})}const WS={pan:{Feature:$S},drag:{Feature:US,ProjectionNode:Zy,MeasureLayout:fx}};function mg(e,n,a){const{props:s}=e;e.animationState&&s.whileHover&&e.animationState.setActive("whileHover",a==="Start");const o="onHover"+a,l=s[o];l&&yt.postRender(()=>l(n,Ji(n)))}class KS extends Ca{mount(){const{current:n}=this.node;n&&(this.unmount=m4(n,(a,s)=>(mg(this.node,s,"Start"),o=>mg(this.node,o,"End"))))}unmount(){}}class YS extends Ca{constructor(){super(...arguments),this.isActive=!1}onFocus(){let n=!1;try{n=this.node.current.matches(":focus-visible")}catch{n=!0}!n||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Yi(zi(this.node.current,"focus",()=>this.onFocus()),zi(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function gg(e,n,a){const{props:s}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&s.whileTap&&e.animationState.setActive("whileTap",a==="Start");const o="onTap"+(a==="End"?"":a),l=s[o];l&&yt.postRender(()=>l(n,Ji(n)))}class GS extends Ca{mount(){const{current:n}=this.node;if(!n)return;const{globalTapTarget:a,propagate:s}=this.node.props;this.unmount=w4(n,(o,l)=>(gg(this.node,l,"Start"),(d,{success:f})=>gg(this.node,d,f?"End":"Cancel")),{useGlobalTarget:a,stopPropagation:(s==null?void 0:s.tap)===!1})}unmount(){}}const Kd=new WeakMap,od=new WeakMap,XS=e=>{const n=Kd.get(e.target);n&&n(e)},JS=e=>{e.forEach(XS)};function qS({root:e,...n}){const a=e||document;od.has(a)||od.set(a,{});const s=od.get(a),o=JSON.stringify(n);return s[o]||(s[o]=new IntersectionObserver(JS,{root:e,...n})),s[o]}function QS(e,n,a){const s=qS(n);return Kd.set(e,a),s.observe(e),()=>{Kd.delete(e),s.unobserve(e)}}const ZS={some:0,all:1};class e6 extends Ca{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var m;(m=this.stopObserver)==null||m.call(this);const{viewport:n={}}=this.node.getProps(),{root:a,margin:s,amount:o="some",once:l}=n,d={root:a?a.current:void 0,rootMargin:s,threshold:typeof o=="number"?o:ZS[o]},f=g=>{const{isIntersecting:y}=g;if(this.isInView===y||(this.isInView=y,l&&!y&&this.hasEnteredView))return;y&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",y);const{onViewportEnter:h,onViewportLeave:b}=this.node.getProps(),k=y?h:b;k&&k(g)};this.stopObserver=QS(this.node.current,d,f)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:n,prevProps:a}=this.node;["amount","margin","root"].some(t6(n,a))&&this.startObserver()}unmount(){var n;(n=this.stopObserver)==null||n.call(this),this.hasEnteredView=!1,this.isInView=!1}}function t6({viewport:e={}},{viewport:n={}}={}){return a=>e[a]!==n[a]}const n6={inView:{Feature:e6},tap:{Feature:GS},focus:{Feature:YS},hover:{Feature:KS}},r6={layout:{ProjectionNode:Zy,MeasureLayout:fx}},a6={...ES,...n6,...WS,...r6},se=kS(a6,SS);function s6(){!Lf.current&&Py();const[e]=v.useState(Al.current);return e}/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const i6=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),o6=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(n,a,s)=>s?s.toUpperCase():a.toLowerCase()),yg=e=>{const n=o6(e);return n.charAt(0).toUpperCase()+n.slice(1)},hx=(...e)=>e.filter((n,a,s)=>!!n&&n.trim()!==""&&s.indexOf(n)===a).join(" ").trim();/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/var l6={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const c6=v.forwardRef(({color:e="currentColor",size:n=24,strokeWidth:a=2,absoluteStrokeWidth:s,className:o="",children:l,iconNode:d,...f},m)=>v.createElement("svg",{ref:m,...l6,width:n,height:n,stroke:e,strokeWidth:s?Number(a)*24/Number(n):a,className:hx("lucide",o),...f},[...d.map(([g,y])=>v.createElement(g,y)),...Array.isArray(l)?l:[l]]));/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const He=(e,n)=>{const a=v.forwardRef(({className:s,...o},l)=>v.createElement(c6,{ref:l,iconNode:n,className:hx(`lucide-${i6(yg(e))}`,`lucide-${e}`,s),...o}));return a.displayName=yg(e),a};/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const u6=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],d6=He("arrow-right",u6);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const f6=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],h6=He("book-open",f6);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const p6=[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],px=He("camera",p6);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const m6=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],g6=He("check",m6);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const y6=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],x6=He("chevron-down",y6);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const v6=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],mx=He("chevron-left",v6);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const b6=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],gx=He("chevron-right",b6);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const w6=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],k6=He("circle-alert",w6);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const S6=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],j6=He("circle-check-big",S6);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const C6=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Yd=He("circle-check",C6);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const N6=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],yx=He("circle-x",N6);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const E6=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]],T6=He("clock-3",E6);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const P6=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],R6=He("clock",P6);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const M6=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]],xg=He("download",M6);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const I6=[["path",{d:"M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z",key:"1ptgy4"}],["path",{d:"M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97",key:"1sl1rz"}]],_6=He("droplets",I6);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const F6=[["path",{d:"M14.4 14.4 9.6 9.6",key:"ic80wn"}],["path",{d:"M18.657 21.485a2 2 0 1 1-2.829-2.828l-1.767 1.768a2 2 0 1 1-2.829-2.829l6.364-6.364a2 2 0 1 1 2.829 2.829l-1.768 1.767a2 2 0 1 1 2.828 2.829z",key:"nnl7wr"}],["path",{d:"m21.5 21.5-1.4-1.4",key:"1f1ice"}],["path",{d:"M3.9 3.9 2.5 2.5",key:"1evmna"}],["path",{d:"M6.404 12.768a2 2 0 1 1-2.829-2.829l1.768-1.767a2 2 0 1 1-2.828-2.829l2.828-2.828a2 2 0 1 1 2.829 2.828l1.767-1.768a2 2 0 1 1 2.829 2.829z",key:"yhosts"}]],D6=He("dumbbell",F6);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const L6=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],A6=He("file-text",L6);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const O6=[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]],xx=He("gift",O6);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const B6=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],vx=He("image",B6);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const z6=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],V6=He("info",z6);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const U6=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],$6=He("loader-circle",U6);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const H6=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],W6=He("lock",H6);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const K6=[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]],Y6=He("log-out",K6);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const G6=[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]],bx=He("message-circle",G6);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const X6=[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]],J6=He("mic",X6);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const q6=[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]],Q6=He("music",q6);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Z6=[["path",{d:"M15 18h-5",key:"95g1m2"}],["path",{d:"M18 14h-8",key:"sponae"}],["path",{d:"M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-4 0v-9a2 2 0 0 1 2-2h2",key:"39pd36"}],["rect",{width:"8",height:"4",x:"10",y:"6",rx:"1",key:"aywv1n"}]],e8=He("newspaper",Z6);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const t8=[["path",{d:"M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4",key:"re6nr2"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"pqwjuv"}]],n8=He("notebook-pen",t8);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const r8=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],vg=He("package",r8);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const a8=[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]],s8=He("palette",a8);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const i8=[["path",{d:"M13.234 20.252 21 12.3",key:"1cbrk9"}],["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486",key:"1pkts6"}]],o8=He("paperclip",i8);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const l8=[["path",{d:"M5.8 11.3 2 22l10.7-3.79",key:"gwxi1d"}],["path",{d:"M4 3h.01",key:"1vcuye"}],["path",{d:"M22 8h.01",key:"1mrtc2"}],["path",{d:"M15 2h.01",key:"1cjtqr"}],["path",{d:"M22 20h.01",key:"1mrys2"}],["path",{d:"m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10",key:"hbicv8"}],["path",{d:"m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17",key:"1i94pl"}],["path",{d:"m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7",key:"1cofks"}],["path",{d:"M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z",key:"4kbmks"}]],c8=He("party-popper",l8);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const u8=[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]],d8=He("pause",u8);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const f8=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],bg=He("pen",f8);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const h8=[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]],p8=He("phone",h8);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const m8=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],qi=He("play",m8);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const g8=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Uf=He("plus",g8);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const y8=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],x8=He("save",y8);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const v8=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],wx=He("send",v8);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const b8=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],w8=He("shield-check",b8);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const k8=[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]],S8=He("shopping-bag",k8);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const j8=[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]],C8=He("sparkles",j8);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const N8=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],E8=He("star",N8);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const T8=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],P8=He("sun",T8);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const R8=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]],kx=He("trash-2",R8);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const M8=[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]],I8=He("trending-up",M8);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const _8=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]],$f=He("upload",_8);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const F8=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]],Sx=He("users",F8);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const D8=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],jx=He("video",D8);/**
* @license lucide-react v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const L8=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ds=He("x",L8),Cx="/assets/0a77244cc5b7dea0bea10275d45df2915d5170ca-B-lUX1TY.png",A8="data:image/svg+xml,%3csvg%20width='128'%20height='128'%20viewBox='0%200%20128%20128'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cdefs%3e%3clinearGradient%20id='phoneGrad'%20x1='26'%20y1='16'%20x2='102'%20y2='112'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23FFC4FF'/%3e%3cstop%20offset='0.5'%20stop-color='%23D56CFF'/%3e%3cstop%20offset='1'%20stop-color='%238F36EE'/%3e%3c/linearGradient%3e%3c/defs%3e%3cpath%20d='M38.6%2022.7c-2.9.9-5.5%202.8-7.2%205.4-3.3%205-4.9%2012.3-1.5%2023.4%203.7%2012%2011.2%2024.4%2020.8%2034%209.6%209.6%2022%2017.2%2034%2020.8%2011.1%203.4%2018.4%201.8%2023.4-1.5%202.6-1.7%204.5-4.3%205.4-7.2.9-2.9.8-6-.6-8.7l-8.7-16.9a8.3%208.3%200%200%200-10.5-3.9l-10.6%204.1c-1.9.7-4%20.2-5.4-1.2L57%2050.3c-1.4-1.4-1.9-3.5-1.2-5.4l4.1-10.6a8.3%208.3%200%200%200-3.9-10.5l-16.9-8.7a10.5%2010.5%200%200%200-8.7-.6z'%20fill='url(%23phoneGrad)'/%3e%3cpath%20d='M38.6%2022.7c-2.9.9-5.5%202.8-7.2%205.4-3.3%205-4.9%2012.3-1.5%2023.4%203.7%2012%2011.2%2024.4%2020.8%2034%209.6%209.6%2022%2017.2%2034%2020.8%2011.1%203.4%2018.4%201.8%2023.4-1.5%202.6-1.7%204.5-4.3%205.4-7.2.9-2.9.8-6-.6-8.7l-8.7-16.9a8.3%208.3%200%200%200-10.5-3.9l-10.6%204.1c-1.9.7-4%20.2-5.4-1.2L57%2050.3c-1.4-1.4-1.9-3.5-1.2-5.4l4.1-10.6a8.3%208.3%200%200%200-3.9-10.5l-16.9-8.7a10.5%2010.5%200%200%200-8.7-.6z'%20stroke='%23FFD7FF'%20stroke-width='3.25'/%3e%3c/svg%3e",ec=async()=>{const e=Ga();if(!e)return hr();try{const n=await fetch(`${nt}/api/call`,{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8",Authorization:`Bearer ${e}`},body:JSON.stringify({get_user_profile_function:{}})});if(!n.ok)return hr();const a=await n.json();if(a.state===0&&a.data){const s=JSON.parse(a.data);if(s.profile){const o=JSON.parse(s.profile);if(o&&o.length>0){const l=o[0];return localStorage.setItem("userProfile",JSON.stringify(l)),l}}}return hr()}catch{return hr()}},Nx=async e=>{const n=Ga();if(!n)return console.warn("توکن احراز هویت یافت نشد"),!1;try{const a=await fetch(`${nt}/api/save`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify(e)});if(!a.ok){console.warn(`خطا در ذخیره اطلاعات پروفایل: ${a.status}`);const o=hr();if(o){const l={...o,...e.user};localStorage.setItem("userProfile",JSON.stringify(l))}return!1}return(await a.json()).state===0?(await ec(),!0):!1}catch(a){console.warn("خطا در ذخیره پروفایل:",a);const s=hr();if(s){const o={...s,...e.user};localStorage.setItem("userProfile",JSON.stringify(o))}return!1}},O8=e=>e?!!(e.name&&e.family&&e.education_level&&e.base):!1,hr=()=>{const e=localStorage.getItem("userProfile");if(!e)return null;try{return JSON.parse(e)}catch{return null}},B8=async()=>{const e=Ga();if(!e)return null;try{const n=await fetch(`${nt}/api/call`,{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8",Authorization:`Bearer ${e}`},body:JSON.stringify({get_user_profile_function2:{}})});if(!n.ok)return null;const a=await n.json();if(a.state===0&&a.data){const s=JSON.parse(a.data);return{challenges:s.challenges?JSON.parse(s.challenges):[],coin_transaction:s.coin_transaction?JSON.parse(s.coin_transaction):[],posts:s.posts?JSON.parse(s.posts):[]}}return null}catch{return null}},Ex=v.createContext(void 0);function z8({children:e}){const[n,a]=v.useState(hr()),[s,o]=v.useState(!0),l=async()=>{o(!0);const f=await ec();a(f),o(!1)};v.useEffect(()=>{l()},[]);const d=O8(n);return u.jsx(Ex.Provider,{value:{profile:n,isProfileComplete:d,isLoading:s,refreshProfile:l},children:e})}function mr(){const e=v.useContext(Ex);if(!e)throw new Error("useProfile must be used within ProfileProvider");return e}const V8=async e=>{const n=Ga();n&&fetch(`${nt}/api/call`,{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8",Authorization:`Bearer ${n}`},body:JSON.stringify({user_log_function:{page_title:e}})}).catch(a=>{console.debug("Page log failed:",a)})},Tx=v.createContext(null);function U8({children:e}){const[n,a]=v.useState(null),s=v.useRef(null),o=v.useRef(!0);return v.useEffect(()=>(o.current=!0,s.current=setInterval(()=>{o.current&&n&&!document.hidden&&V8(n)},1e4),()=>{o.current=!1,s.current&&clearInterval(s.current)}),[n]),u.jsx(Tx.Provider,{value:{currentPage:n,setCurrentPage:a},children:e})}function $8(){const e=v.useContext(Tx);if(!e)throw new Error("usePageTrackingContext must be used within PageTrackingProvider");return e}function gr(e){const{setCurrentPage:n}=$8();v.useEffect(()=>(n(e),()=>{n(null)}),[e,n])}const H8=async()=>{const e=Ga();if(!e)return{inbox:[],unreadCount:0};try{const a=await(await fetch(`${nt}/api/call`,{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8",Authorization:`Bearer ${e}`},body:JSON.stringify({get_inbox_function:{}})})).json();if(a.state===0&&a.data){const s=JSON.parse(a.data),o=s.inbox?JSON.parse(s.inbox):[],l=o.filter(d=>d.status==="خوانده نشده").length;return{inbox:o,unreadCount:l}}return{inbox:[],unreadCount:0}}catch(n){return console.error("Error loading inbox:",n),{inbox:[],unreadCount:0}}},W8=async e=>{const n=Ga();!n||e.length===0||fetch(`${nt}/api/call`,{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8",Authorization:`Bearer ${n}`},body:JSON.stringify({read_inbox_function:{stage_ids:e.join(",")}})}).catch(a=>{console.debug("Mark as read failed:",a)})},Px=v.createContext(null);function K8({children:e}){const[n,a]=v.useState([]),[s,o]=v.useState(0),[l,d]=v.useState(!1),f=v.useCallback(async()=>{d(!0);try{const g=await H8();a(g.inbox),o(g.unreadCount)}catch(g){console.error("Failed to refresh inbox:",g)}finally{d(!1)}},[]),m=v.useCallback(g=>{g.length!==0&&(a(y=>y.map(h=>g.includes(String(h.stageID))?{...h,status:"خوانده شده"}:h)),o(y=>Math.max(0,y-g.length)),W8(g))},[]);return v.useEffect(()=>{f()},[f]),u.jsx(Px.Provider,{value:{messages:n,unreadCount:s,loading:l,refreshInbox:f,markMessagesAsRead:m},children:e})}function Qi(){const e=v.useContext(Px);if(!e)throw new Error("useInbox must be used within InboxProvider");return e}const Y8="/assets/login-new-bg-x9sSRPsV.png",G8="/assets/home-bg-C3pbIsUx.jpg",X8="/assets/All%20BG-Bxd0STfA.jpg",Er=X8,vn={login:Y8,home:G8,profile:Er,editProfile:Er,magicBag:Er,messages:Er,publicChat:Er,feed:Er,challenges:Er,chatbot:Er,submitChallenge:Er};function J8(e){return e==="/"?vn.home:e.startsWith("/profile")?vn.profile:e.startsWith("/edit-profile")?vn.editProfile:e.startsWith("/magic-bag")?vn.magicBag:e.startsWith("/messages")?vn.messages:e.startsWith("/public-chat")?vn.publicChat:Er}const wg=["۰","۱","۲","۳","۴","۵","۶","۷","۸","۹"],q8=["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"],dl=5,ld={duration:.6,repeat:1/0,repeatType:"mirror",ease:"easeInOut"};function Q8(){const e=mn(),n=Ut(),{refreshProfile:a}=mr(),{refreshInbox:s}=Qi();gr("ورود");const[o,l]=v.useState(""),[d,f]=v.useState(""),[m,g]=v.useState("phone"),[y,h]=v.useState(!1),[b,k]=v.useState(0),[C,N]=v.useState(""),[j,M]=v.useState(!1),P=v.useRef(null),F=v.useRef(null),U=v.useRef(null),W=v.useRef(!1);if(v.useEffect(()=>{var z;(z=n.state)!=null&&z.error&&(N(n.state.error),window.history.replaceState({},document.title))},[n]),v.useEffect(()=>{if(m==="code"&&P.current){const z=setTimeout(()=>{var D;(D=P.current)==null||D.focus()},100);return()=>clearTimeout(z)}},[m]),v.useEffect(()=>{if(m==="phone"&&F.current){const z=setTimeout(()=>{var D;(D=F.current)==null||D.focus()},100);return()=>clearTimeout(z)}},[m]),v.useEffect(()=>{m==="code"&&d.length===5&&!y&&!W.current&&(W.current=!0,K()),d.length<5&&(W.current=!1)},[d,m,y]),v.useEffect(()=>()=>{U.current&&(clearInterval(U.current),U.current=null)},[]),C1()&&!j)return u.jsx(v1,{to:"/",replace:!0});const J=z=>{let D=z;return wg.forEach((X,q)=>{D=D.replace(new RegExp(X,"g"),q.toString())}),q8.forEach((X,q)=>{D=D.replace(new RegExp(X,"g"),q.toString())}),D},A=z=>z.replace(/\d/g,D=>wg[parseInt(D,10)]),w=()=>{U.current&&(clearInterval(U.current),U.current=null)},R=()=>{w(),k(120),U.current=setInterval(()=>{k(z=>z<=1?(w(),0):z-1)},1e3)},E=async z=>{const D=await fetch(`${nt}/api/SignUpLoginBySMS`,{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8"},body:JSON.stringify(z)}),X=await D.json();return{response:D,result:X}},Y=async z=>{z.preventDefault(),h(!0),N("");try{const D=J(o),{response:X,result:q}=await E(D);X.ok&&q.state===0?(g("code"),f(""),W.current=!1,R()):N(q.message||"خطا در ارسال کد تایید")}catch(D){console.error("Error sending code:",D),N("خطا در برقراری ارتباط با سرور")}finally{h(!1)}},K=async z=>{z==null||z.preventDefault(),h(!0),N("");try{const D=J(o),X=J(d),q=await fetch(`${nt}/api/verifyloginbysms`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mobile:D,code:X})}),T=await q.json();if(q.ok&&T.state===0){M(!0);const O=JSON.parse(T.data);localStorage.setItem("accessToken",O.Token.AccessToken),localStorage.setItem("refreshToken",O.Token.RefreshToken),localStorage.setItem("userId",O.Person.ID.toString()),localStorage.setItem("username",O.Person.ID.toString()),localStorage.setItem("userInfo",JSON.stringify(O.Person)),await a(),await s(),setTimeout(()=>{sessionStorage.setItem("homeEntranceFromLogin","1"),e("/",{replace:!0})},1250)}else W.current=!1,N(T.message||"کد تایید اشتباه است")}catch(D){console.error("Error verifying code:",D),W.current=!1,N("خطا در برقراری ارتباط با سرور")}finally{h(!1)}},I=async()=>{h(!0),N("");try{const z=J(o),{response:D,result:X}=await E(z);D.ok&&X.state===0?(f(""),W.current=!1,R()):N(X.message||"خطا در ارسال مجدد کد")}catch(z){console.error("Error resending code:",z),N("خطا در برقراری ارتباط با سرور")}finally{h(!1)}},$=z=>{const D=Math.floor(z/60),X=z%60;return`${D}:${X.toString().padStart(2,"0")}`},ee=()=>{g("phone"),f(""),k(0),N(""),W.current=!1,w()},G=(z,D,X)=>{const q=z.split("");for(;q.length<dl;)q.push("");return q[D]=X,q.join("").slice(0,dl)};return u.jsxs("div",{className:"relative h-[100dvh] overflow-hidden",style:{backgroundImage:`url(${vn.login})`,backgroundSize:"cover",backgroundPosition:"center -90px",backgroundRepeat:"no-repeat",backgroundColor:"#10053a"},children:[u.jsx("div",{className:"absolute inset-0",style:{background:"linear-gradient(180deg, rgba(22, 10, 62, 0.38) 0%, rgba(24, 10, 64, 0.32) 38%, rgba(22, 8, 58, 0.74) 100%)"}}),u.jsx(pn,{children:j&&u.jsx(se.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.5,ease:"easeInOut"},className:"absolute inset-0 z-50 flex items-center justify-center px-8",style:{background:"radial-gradient(circle at 50% 35%, rgba(195, 114, 255, 0.32) 0%, rgba(53, 22, 102, 0.9) 42%, rgba(19, 8, 54, 0.98) 100%)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:u.jsxs(se.div,{initial:{opacity:0,y:14,scale:.98},animate:{opacity:1,y:0,scale:1},transition:{duration:.62,ease:[.25,.1,.25,1]},className:"w-full max-w-[280px] rounded-3xl border border-white/20 bg-white/10 p-5 text-center shadow-[0_12px_32px_rgba(0,0,0,0.35)]",children:[u.jsx(se.div,{className:"mx-auto mb-3 h-10 w-10 rounded-full border-2 border-white/25 border-t-white",animate:{rotate:360},transition:{duration:.9,repeat:1/0,ease:"linear"}}),u.jsx("p",{className:"text-base font-semibold text-white",children:"در حال ورود به همدست..."}),u.jsx(se.div,{className:"mx-auto mt-4 h-1.5 w-full overflow-hidden rounded-full bg-white/15",initial:!1,children:u.jsx(se.div,{className:"h-full rounded-full",style:{background:"linear-gradient(90deg, rgba(255,139,91,1) 0%, rgba(238,91,166,1) 45%, rgba(147,78,255,1) 100%)"},initial:{x:"-100%"},animate:{x:"100%"},transition:{duration:1.4,repeat:1/0,ease:"easeInOut"}})})]})})}),u.jsxs("div",{className:"relative z-10 mx-auto flex h-full w-full max-w-[430px] flex-col px-6 pb-8 pt-8 sm:px-7",dir:"rtl",children:[u.jsxs("div",{className:"text-center",children:[u.jsx("img",{src:Cx,alt:"همدست",className:"mx-auto h-16 w-auto object-contain"}),u.jsx("p",{className:"mt-1 text-xl font-medium text-white",children:"خوش آمدی قهرمان!"})]}),u.jsxs("section",{className:"mt-auto",children:[u.jsx(pn,{mode:"wait",initial:!1,children:u.jsxs(se.div,{initial:{opacity:0,y:8,scale:.985,filter:"blur(5px)"},animate:{opacity:1,y:0,scale:1,filter:"blur(0px)"},exit:{opacity:0,y:-8,scale:1.015,filter:"blur(5px)"},transition:{duration:.42,ease:[.25,.1,.25,1]},className:"origin-center",children:[u.jsx("h2",{className:"text-center text-[24px] font-bold leading-tight text-white",children:"ورود به حساب کاربری"}),u.jsx("p",{className:"mt-1 text-center text-base text-[#eadfff]",children:m==="phone"?"شماره تلفن خود را وارد کنید":"کد تایید ارسال شده را وارد کنید"})]},`login-copy-${m}`)}),u.jsxs("form",{onSubmit:m==="phone"?Y:K,className:"mt-4 space-y-4",children:[C&&u.jsx("div",{className:"rounded-2xl border border-red-400/40 bg-red-500/20 p-3 text-center text-sm text-red-100",children:C}),u.jsx(pn,{mode:"wait",initial:!1,children:m==="phone"?u.jsx(se.div,{initial:{opacity:0,y:8,filter:"blur(4px)"},animate:{opacity:1,y:0,filter:"blur(0px)"},exit:{opacity:0,y:-8,filter:"blur(4px)"},transition:{duration:.38,ease:"easeInOut"},children:u.jsxs("div",{className:"flex h-14 items-center rounded-full border border-[#d680ff66] px-4",style:{backgroundImage:"linear-gradient(180deg, #2E1B3D 0%, #23183E 100%), linear-gradient(120deg, #7c3aed 0%, #f97316 58%, #facc15 100%)",backgroundOrigin:"border-box",backgroundClip:"padding-box, border-box",boxShadow:"0 -7px 20px rgba(7, 0, 18, 0.5), 0 6px 14px rgba(5, 2, 12, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 2px 5px rgba(255, 222, 255, 0.09), inset 0 -2px 0 rgba(12, 7, 27, 0.72), inset 0 -8px 14px rgba(8, 4, 18, 0.34), inset 0 0 0 1px rgba(255, 255, 255, 0.045), inset 0 0 0 2px rgba(17, 10, 35, 0.32)"},dir:"ltr",children:[u.jsxs("button",{type:"button",className:"flex items-center gap-1 text-lg text-white/90",children:[u.jsx("span",{children:"+۹۸"}),u.jsx(x6,{size:16})]}),u.jsx("div",{className:"mx-3 h-7 w-px bg-white/30"}),u.jsx("input",{id:"phone",type:"tel",inputMode:"numeric",autoFocus:m==="phone",value:A(o),onChange:z=>l(J(z.target.value)),className:"w-full bg-transparent text-left text-lg text-white outline-none placeholder:text-lg placeholder:text-white/45",placeholder:"۹۱۲ ۱۲۳ ۴۵۶۷",required:!0,ref:F}),u.jsx("img",{src:A8,alt:"تلفن",className:"ml-2 h-5 w-5 object-contain opacity-100"})]})},"phone-step"):u.jsxs(se.div,{initial:{opacity:0,y:8,filter:"blur(4px)"},animate:{opacity:1,y:0,filter:"blur(0px)"},exit:{opacity:0,y:-8,filter:"blur(4px)"},transition:{duration:.38,ease:"easeInOut"},children:[u.jsxs("div",{className:"mx-auto mb-2 flex w-[16.5rem] items-center justify-between text-sm text-white/80",children:[u.jsxs("button",{type:"button",onClick:ee,className:"flex items-center gap-1 text-[#ffcf7e]",children:[u.jsx(gx,{size:14}),u.jsx("span",{children:"ویرایش شماره تلفن"})]}),u.jsx("span",{children:A(o)})]}),u.jsx("div",{className:"flex justify-center gap-1.5",dir:"ltr",children:Array.from({length:dl},(z,D)=>u.jsx("input",{type:"tel",inputMode:"numeric",pattern:"[0-9]*",maxLength:1,value:A(d[D]||""),onChange:X=>{var T;const q=J(X.target.value);if(q.match(/^[0-9]$/)){if(f(G(d,D,q)),D<dl-1){const O=(T=X.target.parentElement)==null?void 0:T.children[D+1];O==null||O.focus()}}else X.target.value===""&&f(G(d,D,""))},onKeyDown:X=>{var q;if(X.key==="Backspace"){if(d[D])f(G(d,D,""));else if(D>0){f(G(d,D-1,""));const T=(q=X.currentTarget.parentElement)==null?void 0:q.children[D-1];T==null||T.focus()}}},className:"h-13 w-13 rounded-xl border border-[#d680ff66] bg-[#2f1b59]/85 text-center text-2xl text-white outline-none",ref:D===0?P:void 0,autoFocus:m==="code"&&D===0},D))}),u.jsx("div",{className:"mx-auto w-[16.5rem]",children:u.jsx("button",{type:"button",onClick:I,className:"mt-3 text-sm text-[#f7dcff] disabled:opacity-55",disabled:b>0||y,children:b>0?`ارسال دوباره کد (${$(b)})`:"ارسال دوباره کد"})})]},"code-step")}),u.jsx(se.button,{whileTap:{scale:.985},whileHover:{scale:1.01},type:"submit",disabled:y,className:"h-14 w-full rounded-full border border-transparent text-lg font-bold text-white",style:{backgroundImage:"linear-gradient(90deg, rgba(255,139,91,1) 0%, rgba(238,91,166,1) 45%, rgba(147,78,255,1) 100%), linear-gradient(120deg, #7c3aed 0%, #f97316 58%, #facc15 100%)",backgroundOrigin:"border-box",backgroundClip:"padding-box, border-box",boxShadow:"0 10px 26px rgba(196, 87, 255, 0.35), inset 0 1px 0 rgba(255,255,255,0.35)"},children:y?u.jsxs("span",{className:"inline-flex items-center gap-1",children:[u.jsx("span",{children:"در حال پردازش"}),u.jsxs("span",{className:"inline-flex items-center",dir:"ltr","aria-hidden":"true",children:[u.jsx(se.span,{className:"inline-block",animate:{opacity:[.25,1],y:[0,-2]},transition:{...ld,delay:0},children:"."}),u.jsx(se.span,{className:"inline-block",animate:{opacity:[.25,1],y:[0,-2]},transition:{...ld,delay:.15},children:"."}),u.jsx(se.span,{className:"inline-block",animate:{opacity:[.25,1],y:[0,-2]},transition:{...ld,delay:.3},children:"."})]})]}):m==="phone"?"دریافت کد تایید":"تایید و ورود"})]}),u.jsx("div",{className:"mt-8 rounded-2xl border border-[#db8bff44] bg-[#3a1f67]/48 p-4",children:u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx(w8,{className:"h-6 w-6 text-[#f1c0ff]"}),u.jsx("p",{className:"text-sm text-white sm:text-base",children:"اطلاعات شما با استانداردهای ایمنی نرم‌افزار محافظت می‌شود."})]})})]})]})]})}const Z8="modulepreload",ej=function(e){return"/"+e},kg={},tj=function(n,a,s){let o=Promise.resolve();if(a&&a.length>0){let d=function(g){return Promise.all(g.map(y=>Promise.resolve(y).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),m=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));o=d(a.map(g=>{if(g=ej(g),g in kg)return;kg[g]=!0;const y=g.endsWith(".css"),h=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${h}`))return;const b=document.createElement("link");if(b.rel=y?"stylesheet":Z8,y||(b.as="script"),b.crossOrigin="",b.href=g,m&&b.setAttribute("nonce",m),document.head.appendChild(b),y)return new Promise((k,C)=>{b.addEventListener("load",k),b.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${g}`)))})}))}function l(d){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=d,window.dispatchEvent(f),!f.defaultPrevented)throw d}return o.then(d=>{for(const f of d||[])f.status==="rejected"&&l(f.reason);return n().catch(l)})},Dt=()=>{const e=localStorage.getItem("accessToken");return e||localStorage.getItem("authToken")},nj=()=>localStorage.getItem("userId"),Rx=e=>{let n=e.message||"خطا در عملیات";return e.data&&typeof e.data=="string"&&/[\u0600-\u06FF]/.test(e.data)&&e.data!==e.message&&(n=`${n}
${e.data}`),n},rj=e=>{try{const n=JSON.parse(e);return JSON.parse(n.feed||"[]")}catch(n){return console.error("Error parsing feed data:",n),[]}},aj=async(e,n=1)=>{const a=Dt();if(!a)return{success:!1,data:[],message:"توکن موجود نیست"};try{const o=await(await fetch(`${nt}/api/call`,{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8",Authorization:`Bearer ${a}`},body:JSON.stringify({load_feeds_function:{mission_type:e,page_number:n.toString()}})})).json();return o.resultType!==0?{success:!1,data:[],message:o.message}:{success:!0,data:rj(o.data)}}catch(s){return console.error("Error loading feeds:",s),{success:!1,data:[],message:"خطا در بارگذاری فید"}}},Ps=e=>{const n=Dt();return`${nt}/api/getimage?stageID=${e}&nameOrID=image&token=${n}`},Ul=(e,n)=>{const a=Dt();return`${nt}/api/getimage?stageID=${n}&nameOrID=image&token=${a}`},Ms=e=>{const n=Dt();return`${nt}/api/getimage?stageID=${e}&nameOrID=image&token=${n}`},Mx=e=>{const n=Dt();return`${nt}/api/getFile?stageID=${e}&nameOrID=film&token=${n}`},Ix=e=>{const n=Dt();return`${nt}/api/getFile?stageID=${e}&nameOrID=audio&token=${n}`},sj=e=>nj()===e,Sg=async(e,n,a)=>{const s=Dt();if(!s){console.error("No auth token found");return}try{fetch(`${nt}/api/call`,{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8",Authorization:`Bearer ${s}`},body:JSON.stringify({like_dislike_function:{kind:e,mission_type:n,mission_done_workflowID:a}})}).catch(o=>{console.error("Error submitting like/dislike:",o)})}catch(o){console.error("Error in submitLikeDislike:",o)}},ij=async(e,n)=>{const a=Dt();if(!a){console.error("No auth token found");return}try{fetch(`${nt}/api/call`,{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8",Authorization:`Bearer ${a}`},body:JSON.stringify({delete_done_mission_function:{mission_done_workflowID:n,mission_type:e}})}).catch(s=>{console.error("Error deleting post:",s)})}catch(s){console.error("Error in deletePost:",s)}},oj=async(e,n,a,s="")=>{const o=Dt();if(!o){console.error("No auth token found");return}try{fetch(`${nt}/api/call`,{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8",Authorization:`Bearer ${o}`},body:JSON.stringify({save_comment_function:{mission_type:e,mission_done_workflowID:n,text:a,replay_workflowID:s}})}).catch(l=>{console.error("Error saving comment:",l)})}catch(l){console.error("Error in saveComment:",l)}},lj=async e=>{const n=Dt();if(!n)return console.error("No auth token found"),!1;try{const a=await fetch(`${nt}/api/call`,{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8",Authorization:`Bearer ${n}`},body:JSON.stringify({delete_comment_function:{comment_id:e}})});return a.ok?(await a.json()).state===0:(console.error("Failed to delete comment"),!1)}catch(a){return console.error("Error deleting comment:",a),!1}},cj=async(e,n=1)=>{const a=Dt();if(!a)return console.error("No auth token found"),{comments:[]};try{const s=await fetch(`${nt}/api/call`,{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8",Authorization:`Bearer ${a}`},body:JSON.stringify({load_comments_function:{mission_done_workflowID:e,page_number:n.toString()}})}),o=await s.json();if(s.ok&&o.state===0){const l=JSON.parse(o.data);return{comments:JSON.parse(l.comments)}}else return console.error("Error loading comments:",o.message),{comments:[]}}catch(s){return console.error("Error in loadComments:",s),{comments:[]}}},uj=async e=>{const n=Dt();if(!n)return console.error("No auth token found"),{missions:[]};try{const a=await fetch(`${nt}/api/call`,{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8",Authorization:`Bearer ${n}`},body:JSON.stringify({load_missions_function:{mission_type:e}})}),s=await a.json();if(a.ok&&s.state===0){const o=JSON.parse(s.data);return{missions:JSON.parse(o.missions)}}else return console.error("Error loading missions:",s.message),{missions:[]}}catch(a){return console.error("Error in loadMissions:",a),{missions:[]}}},dj=e=>{const n=Dt();return n?`${nt}/api/getimage?stageID=${e}&nameOrID=image&token=${n}`:(console.error("No auth token found for mission image"),"")},fj=async(e,n)=>{const a=Dt();if(!a)return console.error("No auth token found"),{doing_mission:null,chats:[]};try{const s=await fetch(`${nt}/api/call`,{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8",Authorization:`Bearer ${a}`},body:JSON.stringify({start_mission_function:{mission_type:e,mission_id:n}})}),o=await s.json();if(s.ok&&o.state===0){const l=JSON.parse(o.data),d=JSON.parse(l.doing_mission),f=JSON.parse(l.chats);return{doing_mission:d.length>0?d[0]:null,chats:f}}else return console.error("Error starting mission:",o.message),{doing_mission:null,chats:[]}}catch(s){return console.error("Error in startMission:",s),{doing_mission:null,chats:[]}}},hj=async(e,n)=>{const a=Dt();if(console.log("sendChatMessage API called:",{userMessage:e,missionDoneWorkflowID:n,hasToken:!!a}),!a)return console.error("No auth token found"),{success:!1};try{const s={chat_service_function:{user_message:e,mission_done_workflowID:n}};console.log("Sending chat request to server:",JSON.stringify(s));const o=await fetch(`${nt}/api/call`,{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8",Authorization:`Bearer ${a}`},body:JSON.stringify(s)}),l=await o.json();if(o.ok&&l.state===0){const d=JSON.parse(l.data),f=Object.keys(d);if(f.length>0){const m=JSON.parse(d[f[0]]);return{success:!0,message:m.message,actions:m.actions,is_mission_end:m.is_mission_end}}return{success:!1}}else return console.error("Error sending chat message:",l.message),{success:!1}}catch(s){return console.error("Error in sendChatMessage:",s),{success:!1}}},_x=async e=>{const n=Dt();if(!n)return console.error("No auth token found"),null;try{const a=new FormData;a.append("file",e);const s=new AbortController,o=setTimeout(()=>s.abort(),3e5),l=await fetch(`${nt}/api/UploadFile`,{method:"POST",headers:{Authorization:`Bearer ${n}`},body:a,signal:s.signal});clearTimeout(o);const d=await l.json();return l.ok&&d.state===0?d.data||null:(console.error("Error uploading file:",d.message),null)}catch(a){return a instanceof Error&&a.name==="AbortError"?console.error("Error in uploadFile: Request timeout after 5 minutes"):console.error("Error in uploadFile:",a),null}},Ls=async e=>{const n=Dt();if(!n)return console.error("uploadImage: No auth token found"),null;try{console.log("uploadImage: Starting upload for file:",e.name,"size:",e.size);const{resizeImage:a}=await tj(async()=>{const{resizeImage:g}=await import("./imageResize-7aJ4C0Tb.js");return{resizeImage:g}},[]);let s=e;try{console.log("uploadImage: Resizing image..."),s=await a(e),console.log("uploadImage: Image resized successfully")}catch(g){console.warn("uploadImage: Failed to resize image, uploading original:",g),s=e}const o=new FormData;o.append("file",s),console.log("uploadImage: Sending request to:",`${nt}/api/UploadImage`),console.log("uploadImage: Token:",n.substring(0,20)+"...");const l=new AbortController,d=setTimeout(()=>l.abort(),3e5),f=await fetch(`${nt}/api/UploadImage`,{method:"POST",headers:{Authorization:`Bearer ${n}`},body:o,signal:l.signal});clearTimeout(d),console.log("uploadImage: Response status:",f.status),console.log("uploadImage: Response ok:",f.ok);const m=await f.json();return console.log("uploadImage: Response data:",JSON.stringify(m)),f.ok&&m.state===0?(console.log("uploadImage: Success! Filename:",m.data),m.data||null):(console.error("uploadImage: Error - Message:",m.message,"State:",m.state),null)}catch(a){return a instanceof Error&&a.name==="AbortError"?console.error("Error in uploadImage: Request timeout after 5 minutes"):console.error("Error in uploadImage:",a),null}},tc=async e=>{const n=Dt();if(!n)return console.error("No auth token found"),{success:!1,message:"توکن احراز هویت یافت نشد"};try{const a={do_mission_function:{title:e.title||"",mission_type:e.mission_type||"",mission_done_workflowID:e.mission_done_workflowID||"",description:e.description||"",film:e.film||"",image:e.image||"",audio:e.audio||"",team_member:e.team_member||""}};e.enter_code&&(a.do_mission_function.enter_code=e.enter_code);const s=await fetch(`${nt}/api/call`,{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8",Authorization:`Bearer ${n}`},body:JSON.stringify(a)}),o=await s.json();if(s.ok&&o.state===0)return{success:!0,message:"ماموریت با موفقیت ثبت شد"};{const l=Rx(o);return console.error("Error submitting mission:",l),{success:!1,message:l}}}catch(a){return console.error("Error in submitMission:",a),{success:!1,message:"خطا در ارتباط با سرور"}}},pj=async(e,n)=>{const a=Dt();if(!a)return console.error("No auth token found"),{success:!1,message:"توکن احراز هویت یافت نشد"};try{const s=await fetch(`${nt}/api/call`,{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8",Authorization:`Bearer ${a}`},body:JSON.stringify({supervisor_registration_function:{mission_done_workflowID:n,mobile:e}})}),o=await s.json();if(s.ok&&o.state===0)return{success:!0,message:"کد با موفقیت ارسال شد"};{const l=Rx(o);return console.error("Error sending supervisor code:",l),{success:!1,message:l}}}catch(s){return console.error("Error in sendSupervisorCode:",s),{success:!1,message:"خطا در ارتباط با سرور"}}},mj=async()=>{const e=Dt();if(!e)return console.error("No auth token found"),{success:!1,data:[],message:"توکن موجود نیست"};try{const a=await(await fetch(`${nt}/api/call`,{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8",Authorization:`Bearer ${e}`},body:JSON.stringify({load_magic_bag_mission_function:{}})})).json();if(a.state===0&&a.data){const s=JSON.parse(a.data);return{success:!0,data:JSON.parse(s.magic_bag).filter(d=>d.magic_bag_title)}}else return{success:!1,data:[],message:a.message||"خطا در بارگذاری ماموریت‌ها"}}catch(n){return console.error("Error loading magic bag missions:",n),{success:!1,data:[],message:"خطا در بارگذاری ماموریت‌های کیف جادویی"}}},cd=e=>{const n=Dt();return`${nt}/api/getfile?stageID=${e}&nameOrID=magic_bag_file&token=${n}`},gj=e=>{if(!e)return!1;const n=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg"],a=e.toLowerCase();return n.some(s=>a.endsWith(s))},Fx=async e=>{const n=Dt();if(!n)return console.error("No auth token found"),{success:!1,data:[],message:"توکن موجود نیست"};try{const s=await(await fetch(`${nt}/api/call`,{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8",Authorization:`Bearer ${n}`},body:JSON.stringify({load_team_member_function:{team_member:e}})})).json();if(s.state===0&&s.data){const o=JSON.parse(s.data);return{success:!0,data:JSON.parse(o.team_members)}}else return{success:!1,data:[],message:s.message||"خطا در بارگذاری اعضای تیم"}}catch(a){return console.error("Error loading team members:",a),{success:!1,data:[],message:"خطا در بارگذاری اعضای تیم"}}},Dx="/assets/coin-star-ZXR71mmp.png",qn="/assets/image%205-OPfS95Ik.png",yj=e=>{if(e==null)return"۰";const n="۰۱۲۳۴۵۶۷۸۹";return String(e).replace(/\d/g,a=>n[parseInt(a,10)])};function nc({showBack:e=!1,onBack:n,centerTitle:a,centerSubtitle:s}){const o=mn(),{profile:l}=mr(),[d,f]=v.useState(()=>{const h=hr();return(h==null?void 0:h.coin_count)??0});v.useEffect(()=>{(l==null?void 0:l.coin_count)!==null&&(l==null?void 0:l.coin_count)!==void 0&&f(l.coin_count)},[l]);const m=!!(l!=null&&l.image&&(l!=null&&l.user_stage_id)),g=v.useMemo(()=>m?Ul(l.image,l.user_stage_id):qn,[m,l==null?void 0:l.image,l==null?void 0:l.user_stage_id]),y={backgroundImage:`
linear-gradient(180deg, #2E1B3D 0%, #23183E 100%),
linear-gradient(120deg, #7c3aed 0%, #f97316 58%, #facc15 100%)
`,backgroundOrigin:"border-box",backgroundClip:"padding-box, border-box",boxShadow:"0 -7px 20px rgba(7, 0, 18, 0.5), 0 6px 14px rgba(5, 2, 12, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 2px 5px rgba(255, 222, 255, 0.09), inset 0 -2px 0 rgba(12, 7, 27, 0.72), inset 0 -8px 14px rgba(8, 4, 18, 0.34), inset 0 0 0 1px rgba(255, 255, 255, 0.045), inset 0 0 0 2px rgba(17, 10, 35, 0.32)",backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)"};return u.jsxs("div",{className:"relative z-20 flex items-center justify-between px-4 pt-3 pb-0",dir:"rtl",children:[e?u.jsx("button",{onClick:n,className:"w-11 h-11 rounded-full flex items-center justify-center border-[0.5px] border-transparent","aria-label":"بازگشت",style:y,children:u.jsx(gx,{size:22,color:"#ffffff"})}):u.jsx("button",{onClick:()=>o("/profile"),className:"relative w-12 h-12 rounded-full p-[2px] border-[0.5px] border-transparent overflow-hidden","aria-label":"پروفایل",style:y,children:m?u.jsx("img",{src:g,alt:"پروفایل",className:"w-full h-full rounded-full object-cover",onError:h=>{h.currentTarget.src=qn}}):u.jsx("div",{className:"w-full h-full rounded-full flex items-center justify-center",style:y,children:u.jsx("img",{src:qn,alt:"پروفایل پیش‌فرض",className:" object-cover rounded-full"})})}),u.jsx("div",{className:"absolute inset-0 pointer-events-none flex items-center justify-center text-center translate-y-1",children:a?u.jsxs("div",{className:"leading-none",children:[u.jsx("div",{className:"font-extrabold text-[22px]",style:{display:"inline-block",background:"linear-gradient(90deg, #F6D8A5 0%, #F3A599 20%, #DB7EB2 48%, #AA6798 72%, #CB75AB 100%)",WebkitBackgroundClip:"text",backgroundClip:"text",WebkitTextFillColor:"transparent",color:"transparent",textShadow:"0 2px 10px rgba(255, 119, 202, 0.4)"},children:a}),s&&u.jsx("div",{className:"mt-1 text-[11px] font-medium",style:{color:"#ffb7dd",textShadow:"0 1px 6px rgba(255, 119, 202, 0.35)"},children:s})]}):u.jsx("img",{src:Cx,alt:"مدرسه",className:"h-12 object-contain",style:{filter:"drop-shadow(0 2px 6px rgba(192, 132, 252, 0.55))"}})}),u.jsxs("div",{className:"relative h-10 w-fit rounded-full px-2.5 flex items-center gap-[6px] border-[0.5px] border-transparent",style:y,children:[u.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center border-[0.5px] border-transparent",style:y,children:u.jsx(Uf,{size:11,color:"#ffd6f0",strokeWidth:2.25})}),u.jsx("span",{className:"font-semibold leading-none text-white tracking-tight",style:{fontSize:16},children:yj(d)}),u.jsx("img",{src:Dx,alt:"سکه",className:"w-7 h-7 object-contain -my-0.5"})]})]})}const xj={backgroundImage:`
linear-gradient(180deg, #2E1B3D 0%, #23183E 100%),
linear-gradient(120deg, #7c3aed 0%, #f97316 58%, #facc15 100%)
`,backgroundOrigin:"border-box",backgroundClip:"padding-box, border-box",border:"0.5px solid transparent",boxShadow:"0 -7px 20px rgba(7, 0, 18, 0.5), 0 6px 14px rgba(5, 2, 12, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 2px 5px rgba(255, 222, 255, 0.09), inset 0 -2px 0 rgba(12, 7, 27, 0.72), inset 0 -8px 14px rgba(8, 4, 18, 0.34), inset 0 0 0 1px rgba(255, 255, 255, 0.045), inset 0 0 0 2px rgba(17, 10, 35, 0.32)",backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)"};function vj({showBack:e=!1,onBack:n,action:a,onActionClick:s}){return u.jsxs("header",{className:"app-header relative",children:[u.jsx(nc,{showBack:e,onBack:n}),a==="history"&&s&&u.jsx("button",{type:"button",onClick:s,className:"absolute right-[64px] top-3 h-10 px-3 rounded-full text-white text-xs font-bold border-[0.5px] border-transparent z-30",style:xj,"aria-label":"تاریخچه چت",children:"تاریخچه"})]})}const Lx=v.createContext(void 0);function bj({children:e}){const[n,a]=v.useState(!1),s=()=>{a(!0)},o=()=>{a(!1)};return u.jsx(Lx.Provider,{value:{hasNewItem:n,setHasNewItem:a,addNewItem:s,clearBadge:o},children:e})}function Ax(){const e=v.useContext(Lx);if(!e)throw new Error("useMagicBag must be used within MagicBagProvider");return e}const wj="/assets/nav-icon-profile-Czwx6ScU.png",kj="/assets/nav-icon-chatbot-CvcoiN6a.png",Sj="/assets/nav-icon-bag-BCVFWePV.png",jj="/assets/nav-icon-home-Bhtms1mp.png",Cj="/assets/nav-icon-bell-Dd2R6-kz.png",Nj=[{id:"chatbot",label:"چت با ربات",path:"/public-chat",icon:kj},{id:"magic-bag",label:"کیف جادویی",path:"/magic-bag",icon:Sj},{id:"home",label:"خانه",path:"/",icon:jj},{id:"messages",label:"اعلان‌ها",path:"/messages",icon:Cj},{id:"profile",label:"پروفایل",path:"/profile",icon:wj}],Ej="drop-shadow(0 0 8px rgba(255, 104, 205, 0.55)) drop-shadow(0 0 14px rgba(255, 104, 205, 0.2))",Tj="drop-shadow(0 3px 6px rgba(0, 0, 0, 0.34))",Pj="radial-gradient(ellipse at center, rgba(255, 106, 207, 0.22) 0%, rgba(255, 106, 207, 0.08) 56%, transparent 100%)",Rj=e=>{if(e>99)return"۹۹+";const n="۰۱۲۳۴۵۶۷۸۹";return String(e).replace(/\d/g,a=>n[parseInt(a,10)])},Mj=(e,n,a)=>e==="home"?a==="/":e==="chatbot"?a==="/public-chat"||a.startsWith("/chatbot"):e==="profile"?a==="/profile"||a==="/edit-profile":a===n;function Zi({fixed:e=!0}){const n=Ut(),{hasNewItem:a,clearBadge:s}=Ax(),{unreadCount:o}=Qi();return u.jsx("div",{className:e?"app-bottom-nav pointer-events-none fixed bottom-0 left-0 right-0 z-50 w-full transition-opacity duration-200":"bottom-nav app-bottom-nav pointer-events-none w-full transition-opacity duration-200",children:u.jsx("nav",{className:"pointer-events-auto relative mx-auto w-full max-w-[392px] px-1","aria-label":"ناوبری اصلی",style:{paddingBottom:"calc(env(safe-area-inset-bottom, 0px) + 8px)"},children:u.jsx("div",{className:"relative h-[86px] rounded-[999px] border-[0.5px] border-transparent px-1",style:{backgroundImage:`
linear-gradient(180deg, #2E1B3D 0%, #23183E 100%),
linear-gradient(120deg, #7c3aed 0%, #f97316 58%, #facc15 100%)
`,backgroundOrigin:"border-box",backgroundClip:"padding-box, border-box",boxShadow:"0 -7px 20px rgba(7, 0, 18, 0.5), 0 6px 14px rgba(5, 2, 12, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 2px 5px rgba(255, 222, 255, 0.09), inset 0 -2px 0 rgba(12, 7, 27, 0.72), inset 0 -8px 14px rgba(8, 4, 18, 0.34), inset 0 0 0 1px rgba(255, 255, 255, 0.045), inset 0 0 0 2px rgba(17, 10, 35, 0.32)",backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)"},children:u.jsx("div",{className:"relative mx-auto grid h-full w-[calc(100%-14px)] grid-cols-5 items-start pt-1.5",dir:"ltr",children:Nj.map(l=>{const d=l.id==="magic-bag",f=l.id==="messages"&&o>0;return u.jsx(S1,{to:l.path,end:l.path==="/",onClick:()=>{d&&a&&s()},className:"relative flex h-full min-w-0 flex-col items-center justify-start pb-1 pt-0.5 outline-none","aria-label":l.label,dir:"rtl",children:({isActive:m})=>{const g=m||Mj(l.id,l.path,n.pathname);return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"relative",children:[u.jsxs("div",{className:"relative flex h-[37px] w-[37px] items-center justify-center",style:{filter:g?Ej:Tj},children:[u.jsx("img",{src:l.icon,alt:"",className:"h-[37px] w-[37px] object-contain",style:{opacity:g?1:.92}}),d&&a&&u.jsx("span",{className:"absolute -right-0.5 top-0.5 h-3 w-3 rounded-full border border-white",style:{background:"linear-gradient(135deg, #ff4d66 0%, #d7193f 100%)",boxShadow:"0 0 10px rgba(255, 57, 92, 0.8)"}}),f&&u.jsx("span",{className:"absolute -right-2 -top-1 flex h-5 min-w-5 items-center justify-center rounded-full border border-red-200 px-1 text-[12px] font-bold leading-none text-white",style:{background:"linear-gradient(180deg, #ff403f 0%, #d51d28 100%)",boxShadow:"0 0 12px rgba(255, 58, 70, 0.85)"},children:Rj(o)})]}),g&&u.jsx("span",{className:"pointer-events-none absolute left-1/2 top-[39px] h-[12px] w-[40px] -translate-x-1/2 rounded-full",style:{background:Pj}})]}),u.jsx("span",{className:"absolute bottom-[14px] left-1/2 block w-[92%] -translate-x-1/2 truncate px-0.5 text-center font-[Alibaba] text-[10px] font-bold leading-4 sm:text-[11px]",style:{opacity:g?1:.92,color:g?"#ff79cf":"#ffd6f0",textShadow:g?"0 0 10px rgba(255, 83, 198, 0.72), 0 2px 4px rgba(0, 0, 0, 0.65)":"0 2px 5px rgba(0, 0, 0, 0.7)"},children:l.label})]})}},l.id)})})})})})}const Ij={title:"خانه",showBack:!1,action:"profile"},_j=["/","/public-chat","/magic-bag","/messages","/profile"];function jg(e){return _j.findIndex(n=>e===n||n!=="/"&&e.startsWith(`${n}/`))}const Cg={duration:.22,ease:[.22,1,.36,1]};function Fj(){const e=Ut(),n=qb(),a=e.pathname==="/public-chat",s=s6(),o=v.useRef(e.pathname),l=v.useRef(null),d=v.useMemo(()=>{const y=e.pathname,h=o.current,b=jg(h),k=jg(y);return b!==-1&&k!==-1?k>b?1:k<b?-1:0:0},[e.pathname]);v.useEffect(()=>{var y;o.current=e.pathname,(y=l.current)==null||y.scrollTo({top:0,behavior:"auto"})},[e.pathname]);const f=s?{opacity:0}:d===0?{opacity:0,y:12,scale:.98}:{opacity:0,x:d*32,scale:.98},m=s?{opacity:1}:d===0?{opacity:1,y:0,scale:1}:{opacity:1,x:0,scale:1},g=s?{opacity:0}:d===0?{opacity:0,y:-8,scale:.98}:{opacity:0,x:d*-32,scale:.98};return u.jsx("div",{className:"page-frame",children:u.jsx(pn,{mode:"wait",initial:!1,children:u.jsx(se.div,{className:"page",ref:l,initial:f,animate:m,exit:g,transition:{...Cg,duration:s?.12:Cg.duration},style:a?{willChange:"opacity, transform",overflowY:"hidden",paddingLeft:"0px",paddingRight:"0px",paddingBottom:"0px"}:{willChange:"opacity, transform"},children:n},e.pathname)})})}function ba({position:e="fixed",style:n,zIndex:a=0,imageUrl:s=vn.home}){return u.jsx("div",{className:`inset-0 w-full ${e==="fixed"?"fixed":"absolute"}`,style:{backgroundImage:`url(${s})`,backgroundSize:"100% auto",backgroundPosition:"top center",backgroundRepeat:"no-repeat",backgroundColor:"#23183E",zIndex:a,...n}})}function Dj(){const e=Ut(),n=mn(),a=o5(),s=e.pathname==="/public-chat",o=v.useMemo(()=>{var l;for(let d=a.length-1;d>=0;d-=1){const f=(l=a[d].handle)==null?void 0:l.header;if(f)return f}return Ij},[a]);return u.jsxs("div",{className:"app-viewport",children:[u.jsx(ba,{position:"fixed",zIndex:0,imageUrl:J8(e.pathname)}),u.jsx("div",{className:"app-shell-frame",children:u.jsxs("div",{className:"app-shell",children:[u.jsx(vj,{title:o.title,action:o.action,showBack:!!o.showBack,onBack:o.showBack?()=>n(o.backTo??"/"):void 0,onActionClick:o.action==="history"?()=>window.dispatchEvent(new CustomEvent("public-chat:history")):void 0}),u.jsx(Fj,{}),!s&&u.jsx(Zi,{fixed:!1})]})})]})}var fl={},Ng;function Lj(){if(Ng)return fl;Ng=1,Object.defineProperty(fl,"__esModule",{value:!0});var e=Hl();function n(w){return Array.prototype.slice.call(w)}function a(w,R){var E=Math.floor(w);return E===R||E+1===R?w:R}function s(){return Date.now()}function o(w,R,E){if(R="data-keen-slider-"+R,E===null)return w.removeAttribute(R);w.setAttribute(R,E||"")}function l(w,R){return R=R||document,typeof w=="function"&&(w=w(R)),Array.isArray(w)?w:typeof w=="string"?n(R.querySelectorAll(w)):w instanceof HTMLElement?[w]:w instanceof NodeList?n(w):[]}function d(w){w.raw&&(w=w.raw),w.cancelable&&!w.defaultPrevented&&w.preventDefault()}function f(w){w.raw&&(w=w.raw),w.stopPropagation&&w.stopPropagation()}function m(){var w=[];return{add:function(R,E,Y,K){R.addListener?R.addListener(Y):R.addEventListener(E,Y,K),w.push([R,E,Y,K])},input:function(R,E,Y,K){this.add(R,E,(function(I){return function($){$.nativeEvent&&($=$.nativeEvent);var ee=$.changedTouches||[],G=$.targetTouches||[],z=$.detail&&$.detail.x?$.detail:null;return I({id:z?z.identifier?z.identifier:"i":G[0]?G[0]?G[0].identifier:"e":"d",idChanged:z?z.identifier?z.identifier:"i":ee[0]?ee[0]?ee[0].identifier:"e":"d",raw:$,x:z&&z.x?z.x:G[0]?G[0].screenX:z?z.x:$.pageX,y:z&&z.y?z.y:G[0]?G[0].screenY:z?z.y:$.pageY})}})(Y),K)},purge:function(){w.forEach((function(R){R[0].removeListener?R[0].removeListener(R[2]):R[0].removeEventListener(R[1],R[2],R[3])})),w=[]}}}function g(w,R,E){return Math.min(Math.max(w,R),E)}function y(w){return(w>0?1:0)-(w<0?1:0)||+w}function h(w){var R=w.getBoundingClientRect();return{height:a(R.height,w.offsetHeight),width:a(R.width,w.offsetWidth)}}function b(w,R,E,Y){var K=w&&w[R];return K==null?E:Y&&typeof K=="function"?K():K}function k(w){return Math.round(1e6*w)/1e6}function C(w,R){if(w===R)return!0;var E=typeof w;if(E!==typeof R)return!1;if(E!=="object"||w===null||R===null)return E==="function"&&w.toString()===R.toString();if(w.length!==R.length||Object.getOwnPropertyNames(w).length!==Object.getOwnPropertyNames(R).length)return!1;for(var Y in w)if(!C(w[Y],R[Y]))return!1;return!0}var N=function(){return N=Object.assign||function(w){for(var R,E=1,Y=arguments.length;E<Y;E++)for(var K in R=arguments[E])Object.prototype.hasOwnProperty.call(R,K)&&(w[K]=R[K]);return w},N.apply(this,arguments)};function j(w,R,E){for(var Y,K=0,I=R.length;K<I;K++)!Y&&K in R||(Y||(Y=Array.prototype.slice.call(R,0,K)),Y[K]=R[K]);return w.concat(Y||Array.prototype.slice.call(R))}function M(w){var R,E,Y,K,I,$;function ee(q){$||($=q),G(!0);var T=q-$;T>Y&&(T=Y);var O=K[E];if(O[3]<T)return E++,ee(q);var ne=O[2],ie=O[4],oe=O[0],ae=O[1]*(0,O[5])(ie===0?1:(T-ne)/ie);if(ae&&w.track.to(oe+ae),T<Y)return D();$=null,G(!1),z(null),w.emit("animationEnded")}function G(q){R.active=q}function z(q){R.targetIdx=q}function D(){var q;q=ee,I=window.requestAnimationFrame(q)}function X(){var q;q=I,window.cancelAnimationFrame(q),G(!1),z(null),$&&w.emit("animationStopped"),$=null}return R={active:!1,start:function(q){if(X(),w.track.details){var T=0,O=w.track.details.position;E=0,Y=0,K=q.map((function(ne){var ie,oe=Number(O),ae=(ie=ne.earlyExit)!==null&&ie!==void 0?ie:ne.duration,ue=ne.easing,xe=ne.distance*ue(ae/ne.duration)||0;O+=xe;var ve=Y;return Y+=ae,T+=xe,[oe,ne.distance,ve,Y,ne.duration,ue]})),z(w.track.distToIdx(T)),D(),w.emit("animationStarted")}},stop:X,targetIdx:null}}function P(w){var R,E,Y,K,I,$,ee,G,z,D,X,q,T,O,ne=1/0,ie=[],oe=null,ae=0;function ue(Re){vt(ae+Re)}function xe(Re){var we=ve(ae+Re).abs;return Ue(we)?we:null}function ve(Re){var we=Math.floor(Math.abs(k(Re/E))),me=k((Re%E+E)%E);me===E&&(me=0);var Ie=y(Re),be=ee.indexOf(j([],ee).reduce((function(Qe,Ge){return Math.abs(Ge-me)<Math.abs(Qe-me)?Ge:Qe}))),Ae=be;return Ie<0&&we++,be===$&&(Ae=0,we+=Ie>0?1:-1),{abs:Ae+we*$*Ie,origin:be,rel:Ae}}function Ve(Re,we,me){var Ie;if(we||!dt())return Ce(Re,me);if(!Ue(Re))return null;var be=ve(me??ae),Ae=be.abs,Qe=Re-be.rel,Ge=Ae+Qe;Ie=Ce(Ge);var rt=Ce(Ge-$*y(Qe));return(rt!==null&&Math.abs(rt)<Math.abs(Ie)||Ie===null)&&(Ie=rt),k(Ie)}function Ce(Re,we){if(we==null&&(we=k(ae)),!Ue(Re)||Re===null)return null;Re=Math.round(Re);var me=ve(we),Ie=me.abs,be=me.rel,Ae=me.origin,Qe=xt(Re),Ge=(we%E+E)%E,rt=ee[Ae],ht=Math.floor((Re-(Ie-be))/$)*E;return k(rt-Ge-rt+ee[Qe]+ht+(Ae===$?E:0))}function Ue(Re){return Oe(Re)===Re}function Oe(Re){return g(Re,z,D)}function dt(){return K.loop}function xt(Re){return(Re%$+$)%$}function vt(Re){var we;we=Re-ae,ie.push({distance:we,timestamp:s()}),ie.length>6&&(ie=ie.slice(-6)),ae=k(Re);var me=Se().abs;if(me!==oe){var Ie=oe!==null;oe=me,Ie&&w.emit("slideChanged")}}function Se(Re){var we=Re?null:(function(){if($){var me=dt(),Ie=me?(ae%E+E)%E:ae,be=(me?ae%E:ae)-I[0][2],Ae=0-(be<0&&me?E-Math.abs(be):be),Qe=0,Ge=ve(ae),rt=Ge.abs,ht=Ge.rel,Qt=I[ht][2],Pt=I.map((function(qe,kn){var ft=Ae+Qe;(ft<0-qe[0]||ft>1)&&(ft+=(Math.abs(ft)>E-1&&me?E:0)*y(-ft));var Mn=kn-ht,Te=y(Mn),Ze=Mn+rt;me&&(Te===-1&&ft>Qt&&(Ze+=$),Te===1&&ft<Qt&&(Ze-=$),X!==null&&Ze<X&&(ft+=E),q!==null&&Ze>q&&(ft-=E));var ot=ft+qe[0]+qe[1],it=Math.max(ft>=0&&ot<=1?1:ot<0||ft>1?0:ft<0?Math.min(1,(qe[0]+ft)/qe[0]):(1-ft)/qe[0],0);return Qe+=qe[0]+qe[1],{abs:Ze,distance:K.rtl?-1*ft+1-qe[0]:ft,portion:it,size:qe[0]}}));return rt=Oe(rt),ht=xt(rt),{abs:Oe(rt),length:Y,max:O,maxIdx:D,min:T,minIdx:z,position:ae,progress:me?Ie/E:ae/Y,rel:ht,slides:Pt,slidesLength:E}}})();return R.details=we,w.emit("detailsChanged"),we}return R={absToRel:xt,add:ue,details:null,distToIdx:xe,idxToDist:Ve,init:function(Re){if((function(){if(K=w.options,I=(K.trackConfig||[]).map((function(be){return[b(be,"size",1),b(be,"spacing",0),b(be,"origin",0)]})),$=I.length){E=k(I.reduce((function(be,Ae){return be+Ae[0]+Ae[1]}),0));var me,Ie=$-1;Y=k(E+I[0][2]-I[Ie][0]-I[Ie][2]-I[Ie][1]),ee=I.reduce((function(be,Ae){if(!be)return[0];var Qe=I[be.length-1],Ge=be[be.length-1]+(Qe[0]+Qe[2])+Qe[1];return Ge-=Ae[2],be[be.length-1]>Ge&&(Ge=be[be.length-1]),Ge=k(Ge),be.push(Ge),(!me||me<Ge)&&(G=be.length-1),me=Ge,be}),null),Y===0&&(G=0),ee.push(k(E))}})(),!$)return Se(!0);var we;(function(){var me=w.options.range,Ie=w.options.loop;X=z=Ie?b(Ie,"min",-1/0):0,q=D=Ie?b(Ie,"max",ne):G;var be=b(me,"min",null),Ae=b(me,"max",null);be!==null&&(z=be),Ae!==null&&(D=Ae),T=z===-1/0?z:w.track.idxToDist(z||0,!0,0),O=D===ne?D:Ve(D,!0,0),Ae===null&&(q=D),b(me,"align",!1)&&D!==ne&&I[xt(D)][2]===0&&(O-=1-I[xt(D)][0],D=xe(O-ae)),T=k(T),O=k(O)})(),we=Re,Number(we)===we?ue(Ce(Oe(Re))):Se()},to:vt,velocity:function(){var Re=s(),we=ie.reduce((function(me,Ie){var be=Ie.distance,Ae=Ie.timestamp;return Re-Ae>200||(y(be)!==y(me.distance)&&me.distance&&(me={distance:0,lastTimestamp:0,time:0}),me.time&&(me.distance+=be),me.lastTimestamp&&(me.time+=Ae-me.lastTimestamp),me.lastTimestamp=Ae),me}),{distance:0,lastTimestamp:0,time:0});return we.distance/we.time||0}}}function F(w){var R,E,Y,K,I,$,ee,G;function z(oe){return 2*oe}function D(oe){return g(oe,ee,G)}function X(oe){return 1-Math.pow(1-oe,3)}function q(){return Y?w.track.velocity():0}function T(){ie();var oe=w.options.mode==="free-snap",ae=w.track,ue=q();K=y(ue);var xe=w.track.details,ve=[];if(ue||!oe){var Ve=O(ue),Ce=Ve.dist,Ue=Ve.dur;if(Ue=z(Ue),Ce*=K,oe){var Oe=ae.idxToDist(ae.distToIdx(Ce),!0);Oe&&(Ce=Oe)}ve.push({distance:Ce,duration:Ue,easing:X});var dt=xe.position,xt=dt+Ce;if(xt<I||xt>$){var vt=xt<I?I-dt:$-dt,Se=0,Re=ue;if(y(vt)===K){var we=Math.min(Math.abs(vt)/Math.abs(Ce),1),me=(function(Ae){return 1-Math.pow(1-Ae,1/3)})(we)*Ue;ve[0].earlyExit=me,Re=ue*(1-we)}else ve[0].earlyExit=0,Se+=vt;var Ie=O(Re,100),be=Ie.dist*K;w.options.rubberband&&(ve.push({distance:be,duration:z(Ie.dur),easing:X}),ve.push({distance:-be+Se,duration:500,easing:X}))}w.animator.start(ve)}else w.moveToIdx(D(xe.abs),!0,{duration:500,easing:function(Ae){return 1+--Ae*Ae*Ae*Ae*Ae}})}function O(oe,ae){ae===void 0&&(ae=1e3);var ue=147e-9+(oe=Math.abs(oe))/ae;return{dist:Math.pow(oe,2)/ue,dur:oe/ue}}function ne(){var oe=w.track.details;oe&&(I=oe.min,$=oe.max,ee=oe.minIdx,G=oe.maxIdx)}function ie(){w.animator.stop()}w.on("updated",ne),w.on("optionsChanged",ne),w.on("created",ne),w.on("dragStarted",(function(){Y=!1,ie(),R=E=w.track.details.abs})),w.on("dragChecked",(function(){Y=!0})),w.on("dragEnded",(function(){var oe=w.options.mode;oe==="snap"&&(function(){var ae=w.track,ue=w.track.details,xe=ue.position,ve=y(q());(xe>$||xe<I)&&(ve=0);var Ve=R+ve;ue.slides[ae.absToRel(Ve)].portion===0&&(Ve-=ve),R!==E&&(Ve=E),y(ae.idxToDist(Ve,!0))!==ve&&(Ve+=ve),Ve=D(Ve);var Ce=ae.idxToDist(Ve,!0);w.animator.start([{distance:Ce,duration:500,easing:function(Ue){return 1+--Ue*Ue*Ue*Ue*Ue}}])})(),oe!=="free"&&oe!=="free-snap"||T()})),w.on("dragged",(function(){E=w.track.details.abs}))}function U(w){var R,E,Y,K,I,$,ee,G,z,D,X,q,T,O,ne,ie,oe,ae,ue=m();function xe(Se){if($&&G===Se.id){var Re=Ue(Se);if(z){if(!Ce(Se))return Ve(Se);D=Re,z=!1,w.emit("dragChecked")}if(ie)return D=Re;d(Se);var we=(function(Ie){if(oe===-1/0&&ae===1/0)return Ie;var be=w.track.details,Ae=be.length,Qe=be.position,Ge=g(Ie,oe-Qe,ae-Qe);if(Ae===0)return 0;if(!w.options.rubberband)return Ge;if(Qe<=ae&&Qe>=oe||Qe<oe&&E>0||Qe>ae&&E<0)return Ie;var rt=(Qe<oe?Qe-oe:Qe-ae)/Ae,ht=K*Ae,Qt=Math.abs(rt*ht),Pt=Math.max(0,1-Qt/I*2);return Pt*Pt*Ie})(ee(D-Re)/K*Y);E=y(we);var me=w.track.details.position;(me>oe&&me<ae||me===oe&&E>0||me===ae&&E<0)&&f(Se),X+=we,!q&&Math.abs(X*K)>5&&(q=!0),w.track.add(we),D=Re,w.emit("dragged")}}function ve(Se){!$&&w.track.details&&w.track.details.length&&(X=0,$=!0,q=!1,z=!0,G=Se.id,Ce(Se),D=Ue(Se),w.emit("dragStarted"))}function Ve(Se){$&&G===Se.idChanged&&($=!1,w.emit("dragEnded"))}function Ce(Se){var Re=Oe(),we=Re?Se.y:Se.x,me=Re?Se.x:Se.y,Ie=T!==void 0&&O!==void 0&&Math.abs(O-me)<=Math.abs(T-we);return T=we,O=me,Ie}function Ue(Se){return Oe()?Se.y:Se.x}function Oe(){return w.options.vertical}function dt(){K=w.size,I=Oe()?window.innerHeight:window.innerWidth;var Se=w.track.details;Se&&(oe=Se.min,ae=Se.max)}function xt(Se){q&&(f(Se),d(Se))}function vt(){if(ue.purge(),w.options.drag&&!w.options.disabled){var Se;Se=w.options.dragSpeed||1,ee=typeof Se=="function"?Se:function(we){return we*Se},Y=w.options.rtl?-1:1,dt(),R=w.container,(function(){var we="data-keen-slider-clickable";l("[".concat(we,"]:not([").concat(we,"=false])"),R).map((function(me){ue.add(me,"dragstart",f),ue.add(me,"mousedown",f),ue.add(me,"touchstart",f)}))})(),ue.add(R,"dragstart",(function(we){d(we)})),ue.add(R,"click",xt,{capture:!0}),ue.input(R,"ksDragStart",ve),ue.input(R,"ksDrag",xe),ue.input(R,"ksDragEnd",Ve),ue.input(R,"mousedown",ve),ue.input(R,"mousemove",xe),ue.input(R,"mouseleave",Ve),ue.input(R,"mouseup",Ve),ue.input(R,"touchstart",ve,{passive:!0}),ue.input(R,"touchmove",xe,{passive:!1}),ue.input(R,"touchend",Ve),ue.input(R,"touchcancel",Ve),ue.add(window,"wheel",(function(we){$&&d(we)}));var Re="data-keen-slider-scrollable";l("[".concat(Re,"]:not([").concat(Re,"=false])"),w.container).map((function(we){return(function(me){var Ie;ue.input(me,"touchstart",(function(be){Ie=Ue(be),ie=!0,ne=!0}),{passive:!0}),ue.input(me,"touchmove",(function(be){var Ae=Oe(),Qe=Ae?me.scrollHeight-me.clientHeight:me.scrollWidth-me.clientWidth,Ge=Ie-Ue(be),rt=Ae?me.scrollTop:me.scrollLeft,ht=Ae&&me.style.overflowY==="scroll"||!Ae&&me.style.overflowX==="scroll";if(Ie=Ue(be),(Ge<0&&rt>0||Ge>0&&rt<Qe)&&ne&&ht)return ie=!0;ne=!1,d(be),ie=!1})),ue.input(me,"touchend",(function(){ie=!1}))})(we)}))}}w.on("updated",dt),w.on("optionsChanged",vt),w.on("created",vt),w.on("destroyed",ue.purge)}function W(w){var R,E,Y=null;function K(T,O,ne){w.animator.active?$(T,O,ne):requestAnimationFrame((function(){return $(T,O,ne)}))}function I(){K(!1,!1,E)}function $(T,O,ne){var ie=0,oe=w.size,ae=w.track.details;if(ae&&R){var ue=ae.slides;R.forEach((function(xe,ve){if(T)!Y&&O&&G(xe,null,ne),z(xe,null,ne);else{if(!ue[ve])return;var Ve=ue[ve].size*oe;!Y&&O&&G(xe,Ve,ne),z(xe,ue[ve].distance*oe-ie,ne),ie+=Ve}}))}}function ee(T){return w.options.renderMode==="performance"?Math.round(T):T}function G(T,O,ne){var ie=ne?"height":"width";O!==null&&(O=ee(O)+"px"),T.style["min-"+ie]=O,T.style["max-"+ie]=O}function z(T,O,ne){if(O!==null){O=ee(O);var ie=ne?O:0;O="translate3d(".concat(ne?0:O,"px, ").concat(ie,"px, 0)")}T.style.transform=O,T.style["-webkit-transform"]=O}function D(){R&&($(!0,!0,E),R=null),w.on("detailsChanged",I,!0)}function X(){K(!1,!0,E)}function q(){D(),E=w.options.vertical,w.options.disabled||w.options.renderMode==="custom"||(Y=b(w.options.slides,"perView",null)==="auto",w.on("detailsChanged",I),(R=w.slides).length&&X())}w.on("created",q),w.on("optionsChanged",q),w.on("beforeOptionsChanged",(function(){D()})),w.on("updated",X),w.on("destroyed",D)}function J(w,R){return function(E){var Y,K,I,$,ee,G=m();function z(Ce){var Ue;o(E.container,"reverse",(Ue=E.container,window.getComputedStyle(Ue,null).getPropertyValue("direction")!=="rtl"||Ce?null:"")),o(E.container,"v",E.options.vertical&&!Ce?"":null),o(E.container,"disabled",E.options.disabled&&!Ce?"":null)}function D(){X()&&ie()}function X(){var Ce=null;if($.forEach((function(Oe){Oe.matches&&(Ce=Oe.__media)})),Ce===Y)return!1;Y||E.emit("beforeOptionsChanged"),Y=Ce;var Ue=Ce?I.breakpoints[Ce]:I;return E.options=N(N({},I),Ue),z(),ve(),Ve(),ae(),!0}function q(Ce){var Ue=h(Ce);return(E.options.vertical?Ue.height:Ue.width)/E.size||1}function T(){return E.options.trackConfig.length}function O(Ce){for(var Ue in Y=!1,I=N(N({},R),Ce),G.purge(),K=E.size,$=[],I.breakpoints||[]){var Oe=window.matchMedia(Ue);Oe.__media=Ue,$.push(Oe),G.add(Oe,"change",D)}G.add(window,"orientationchange",xe),G.add(window,"resize",ue),X()}function ne(Ce){E.animator.stop();var Ue=E.track.details;E.track.init(Ce??(Ue?Ue.abs:0))}function ie(Ce){ne(Ce),E.emit("optionsChanged")}function oe(Ce,Ue){if(Ce)return O(Ce),void ie(Ue);ve(),Ve();var Oe=T();ae(),T()!==Oe?ie(Ue):ne(Ue),E.emit("updated")}function ae(){var Ce=E.options.slides;if(typeof Ce=="function")return E.options.trackConfig=Ce(E.size,E.slides);for(var Ue=E.slides,Oe=Ue.length,dt=typeof Ce=="number"?Ce:b(Ce,"number",Oe,!0),xt=[],vt=b(Ce,"perView",1,!0),Se=b(Ce,"spacing",0,!0)/E.size||0,Re=vt==="auto"?Se:Se/vt,we=b(Ce,"origin","auto"),me=0,Ie=0;Ie<dt;Ie++){var be=vt==="auto"?q(Ue[Ie]):1/vt-Se+Re,Ae=we==="center"?.5-be/2:we==="auto"?0:we;xt.push({origin:Ae,size:be,spacing:Se}),me+=be}if(me+=Se*(dt-1),we==="auto"&&!E.options.loop&&vt!==1){var Qe=0;xt.map((function(Ge){var rt=me-Qe;return Qe+=Ge.size+Se,rt>=1||(Ge.origin=1-rt-(me>1?0:1-me)),Ge}))}E.options.trackConfig=xt}function ue(){ve();var Ce=E.size;E.options.disabled||Ce===K||(K=Ce,oe())}function xe(){ue(),setTimeout(ue,500),setTimeout(ue,2e3)}function ve(){var Ce=h(E.container);E.size=(E.options.vertical?Ce.height:Ce.width)||1}function Ve(){E.slides=l(E.options.selector,E.container)}E.container=(ee=l(w,document)).length?ee[0]:null,E.destroy=function(){G.purge(),E.emit("destroyed"),z(!0)},E.prev=function(){E.moveToIdx(E.track.details.abs-1,!0)},E.next=function(){E.moveToIdx(E.track.details.abs+1,!0)},E.update=oe,O(E.options)}}var A=function(w,R,E){try{return(function(Y,K){var I,$={};return I={emit:function(ee){$[ee]&&$[ee].forEach((function(z){z(I)}));var G=I.options&&I.options[ee];G&&G(I)},moveToIdx:function(ee,G,z){var D=I.track.idxToDist(ee,G);if(D){var X=I.options.defaultAnimation;I.animator.start([{distance:D,duration:b(z||X,"duration",500),easing:b(z||X,"easing",(function(q){return 1+--q*q*q*q*q}))}])}},on:function(ee,G,z){z===void 0&&(z=!1),$[ee]||($[ee]=[]);var D=$[ee].indexOf(G);D>-1?z&&delete $[ee][D]:z||$[ee].push(G)},options:Y},(function(){if(I.track=P(I),I.animator=M(I),K)for(var ee=0,G=K;ee<G.length;ee++)(0,G[ee])(I);I.track.init(I.options.initial||0),I.emit("created")})(),I})(R,j([J(w,{drag:!0,mode:"snap",renderMode:"precision",rubberband:!0,selector:".keen-slider__slide"}),W,U,F],E||[],!0))}catch(Y){console.error(Y)}};return fl.useKeenSlider=function(w,R){var E=e.useRef(null),Y=e.useRef(!1),K=e.useRef(w),I=e.useCallback((function($){$?(K.current=w,E.current=new A($,w,R),Y.current=!1):(E.current&&E.current.destroy&&E.current.destroy(),E.current=null)}),[]);return e.useEffect((function(){C(K.current,w)||(K.current=w,E.current&&E.current.update(K.current))}),[w]),[I,E]},fl}var Aj=Lj();const Ox={1:{title:"تخته سیاه",serverName:"تخته سیاه",description:"ماموریت‌های آموزشی و خلاقانه",backgroundColor:"#0a1f2e",accentColor:"#8ACEE0",hasFeed:!0},2:{title:"نیمکت",serverName:"نیمکت",description:"لحظات استراحت و گفتگو",backgroundColor:"#0e1a25",accentColor:"#A8D5E2",hasFeed:!0},3:{title:"دفترچه یادداشت",serverName:"دفترچه یادداشت",description:"یادداشت‌ها و خاطرات",backgroundColor:"#1a1f2e",accentColor:"#B8E0F0",hasFeed:!0},4:{title:"دیوار حیاط",serverName:"دیوار حیاط",description:"نقاشی و هنر",backgroundColor:"#0f1f30",accentColor:"#90C8E0",hasFeed:!0},5:{title:"آبخوری",serverName:"آبخوری",description:"تجربه‌های روزانه",backgroundColor:"#1a1530",accentColor:"#A890E0",hasFeed:!0},6:{title:"زنگ ورزش",serverName:"زنگ ورزش",description:"فعالیت‌های ورزشی",backgroundColor:"#0a1f2e",accentColor:"#80D0E0",hasFeed:!0},7:{title:"سه ماه تعطیلی",serverName:"سه ماه تعطیلی",description:"ماجراهای تابستانی",backgroundColor:"#0f1a30",accentColor:"#90D8F0",hasFeed:!1},8:{title:"روزنامه دیواری",serverName:"روزنامه دیواری",description:"اخبار و گزارش‌ها",backgroundColor:"#151a2e",accentColor:"#A0D0E8",hasFeed:!0},9:{title:"زنگ تفریح",serverName:"زنگ تفریح",description:"سرگرمی و بازی",backgroundColor:"#0a1f2e",accentColor:"#8ACEE0",hasFeed:!1}},Oj=e=>e&&Ox[e]||null,Bj="/assets/takhtesiyah-CZHoAAAB.jpg",zj="/assets/nimkat-erYkVpnh.jpg",Vj="/assets/daftarcheyadasht-Cei08k5t.jpg",Uj="/assets/divarehayat-CpfZ3_s0.jpg",$j="/assets/abkhori-BLwhFlbe.jpg",Hj="/assets/zangvarzsh-iJQNX0Ln.jpg",Wj="/assets/semahtatili-CKTx4sxX.jpg",Kj="/assets/roznamedivari-D7e7L_HK.jpg",Yj="/assets/zangtafrih-YNSka48i.jpg",Gj="/assets/takhtesiyah-overlay-D0TInUoR.png",Xj="/assets/nimkat-overlay-C8rEc9bN.png",Jj="/assets/daftarcheyadasht-overlay-CQxwu2Xs.png",qj="/assets/divarehayat-overlay-DJcovQj8.png",Qj="/assets/abkhori-overlay-B1UUEC18.png",Zj="/assets/sample-overlay-DE8T3m17.png",eC="/assets/semahtatili-overlay-DuhScTDW.png",tC="/assets/roznamedivari-overlay-Gr9jXnq2.png",nC="/assets/zangtafrih-overlay-3HxwzusR.png",ud="/assets/sample-overlay-DE8T3m17.png",rC=new Set(["7"]),aC={1:Bj,2:zj,3:Vj,4:Uj,5:$j,6:Hj,7:Wj,8:Kj,9:Yj},sC={1:h6,2:Sx,3:n8,4:s8,5:_6,6:D6,7:P8,8:e8,9:c8},iC={1:Gj,2:Xj,3:Jj,4:qj,5:Qj,6:Zj,7:eC,8:tC,9:nC},oC=e=>{const l=new WeakMap;let d=0,f=!1,m=1;function g(b){return((b+180)%360+360)%360-180}function y(){const b=e.track.details;if(!b)return;const k=360*b.progress,C=360/e.slides.length;if(f){const A=g(k-d);Math.abs(A)>.02&&(m=A>0?1:-1)}d=k,f=!0;const N=k+m*(C*.5);let j=0,M=Number.POSITIVE_INFINITY;e.slides.forEach((A,w)=>{const R=C*w,E=g(R-k),Y=Math.abs(E),K=Y<=80,I=A,$=-22,ee=Y<=12?1:Math.max(0,1-(Y-12)/68),G=ee*ee*(3-2*ee),z=g(R-N),D=Math.abs(z);D<M&&(M=D,j=w);const X=1+G*.3,q=23+$,T=l.get(I)??{scale:X,tilt:q},O=T.scale+(X-T.scale)*.22,ne=T.tilt+(q-T.tilt)*.22;l.set(I,{scale:O,tilt:ne}),I.style.transform=`rotateY(${R}deg) translateZ(240px) rotateX(${ne.toFixed(2)}deg) scale(${O.toFixed(3)})`,I.style.setProperty("--ui-counter-tilt",`${(-ne).toFixed(2)}deg`),I.style.opacity=K?"1":"0",I.style.pointerEvents=K?"auto":"none"});const P=C*j,F=g(P-k),U=Math.max(0,1-Math.abs(F)/(80*.7)),W=U*U*(3-2*U),J=e.container;J.style.setProperty("--active-overlay-index",`${j}`),J.style.setProperty("--active-overlay-progress",`${W.toFixed(3)}`)}function h(){const b=360*e.track.details.progress;e.container.style.transform=`translateZ(-240px) rotateX(-23deg) rotateY(${-b}deg)`,y()}e.on("created",h),e.on("detailsChanged",h)};function lC(){const e=mn();gr("صفحه اصلی");const[n,a]=v.useState(0),[s,o]=v.useState(0),[l,d]=v.useState(0),f=v.useRef(0),m=v.useRef(0),g=v.useRef(0),y=v.useRef(0),h=v.useRef(0),b=v.useRef(0),k=v.useRef(0),C=v.useRef(1),N=A=>Math.max(0,Math.min(1,A)),j=(A,w)=>w<=0?0:(A%w+w)%w,M=A=>A>.5?A-1:A<-.5?A+1:A,P=A=>A*A*(3-2*A),F=Object.entries(Ox).sort(([A],[w])=>Number(A)-Number(w)).map(([A,w])=>({id:Number(A),topicId:A,title:w.title,subtitle:w.description,Icon:sC[A]||Sx,image:aC[A],overlayImage:iC[A]||ud,disabled:rC.has(A),targetPath:w.hasFeed?`/feed/${A}`:`/challenges/${A}`})),[U]=Aj.useKeenSlider({loop:!0,selector:".carousel__item",renderMode:"custom",mode:"free-snap",created(A){const w=A.track.details;if(!w)return;const R=A.slides.length,E=j(w.rel,R);f.current=E,m.current=E,g.current=E,y.current=0,b.current=w.progress*R,h.current=b.current,k.current=w.progress},dragStarted(A){const w=A.track.details;if(!w)return;const R=A.slides.length||1;b.current=w.progress*R,h.current=b.current,k.current=w.progress,A.container.setAttribute("data-drag-start-abs",String(w.abs))},dragEnded(A){const w=A.track.details;if(!w)return;const R=Number.parseFloat(A.container.getAttribute("data-drag-start-abs")||`${w.abs}`),E=w.abs-R;if(Math.abs(E)<=1.05)return;const K=Math.round(R)+(E>0?1:-1);A.moveToIdx(K,!0,{duration:360,easing:I=>1-Math.pow(1-I,3)})},animationStarted(A){const w=A.track.details;if(!w)return;const R=A.slides.length||1;b.current=w.progress*R},detailsChanged(A){const w=A.track.details;if(!w)return;const R=A.slides.length;if(!R)return;const E=M(w.progress-k.current);b.current+=E*R;const Y=Math.abs(E)>35e-5;if(k.current=w.progress,Y&&(C.current=E>0?1:-1),!Y&&!A.animator.active){const I=j(w.rel,R);f.current=I,m.current=I,g.current=I,y.current=0,h.current=b.current}else{const I=b.current-Math.floor(b.current),$=I<0?I+1:I,ee=C.current>0?$:(1-$)%1,G=0,z=N((ee-G)/(1-G)),D=z<=.001?0:z>=.999?1:P(z),X=C.current>0?j(Math.floor(b.current),R):j(Math.ceil(b.current),R),q=j(X+C.current,R);m.current=X,g.current=q,y.current=D,f.current=D>=.999?q:X}const K=A.container;K.style.setProperty("--active-overlay-index",String(g.current)),K.style.setProperty("--active-overlay-progress",y.current.toFixed(3)),a(m.current),o(g.current),d(y.current)}},[oC]),W=v.useMemo(()=>{var A;return((A=F[n])==null?void 0:A.overlayImage)||ud},[F,n]),J=v.useMemo(()=>{var A;return((A=F[s])==null?void 0:A.overlayImage)||ud},[F,s]);return u.jsx("div",{className:"home-page",dir:"rtl",children:u.jsx("div",{className:"home-carousel-wrapper",children:u.jsxs("div",{className:"home-carousel-scene",children:[u.jsxs("div",{className:"home-carousel-floating-overlay",style:{"--floating-progress":l.toFixed(3)},"aria-hidden":"true",children:[u.jsx("img",{src:W,alt:"",className:"home-carousel-floating-overlay-image home-carousel-floating-overlay-image--out"}),u.jsx("img",{src:J,alt:"",className:"home-carousel-floating-overlay-image home-carousel-floating-overlay-image--in"})]}),u.jsx("div",{className:"home-carousel keen-slider",ref:U,dir:"ltr",children:F.map((A,w)=>u.jsx("div",{className:`carousel__item number-slide${w%6+1}`,children:u.jsxs("button",{type:"button",onClick:()=>!A.disabled&&e(A.targetPath),disabled:A.disabled,className:"carousel__cell",style:{cursor:A.disabled?"not-allowed":"pointer"},dir:"rtl",children:[u.jsx("span",{className:"home-carousel-icon-badge","aria-hidden":"true",children:u.jsx(A.Icon,{size:20,strokeWidth:2})}),u.jsxs("div",{className:"home-carousel-text",children:[u.jsx("span",{className:"home-carousel-label",children:A.disabled?`🔒 ${A.title}`:A.title}),u.jsx("span",{className:"home-carousel-subtitle",children:A.subtitle})]}),u.jsx("img",{src:A.image,alt:A.title,className:"home-carousel-image",loading:"eager"})]})},A.id))})]})})})}const Tl="/assets/f7664d355c12b1003ad460ff44c8f22cfb1bbf5a-D6aHsuNC.png",cC="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODgiIGhlaWdodD0iODgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjMDAwIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBvcGFjaXR5PSIuMyIgZmlsbD0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIzLjciPjxyZWN0IHg9IjE2IiB5PSIxNiIgd2lkdGg9IjU2IiBoZWlnaHQ9IjU2IiByeD0iNiIvPjxwYXRoIGQ9Im0xNiA1OCAxNi0xOCAzMiAzMiIvPjxjaXJjbGUgY3g9IjUzIiBjeT0iMzUiIHI9IjciLz48L3N2Zz4KCg==";function ya(e){const{fallbackSrc:n,...a}=e,[s,o]=v.useState(!1),l=()=>{o(!0)},{src:d,alt:f,style:m,className:g,...y}=a,h=n||cC;return s?u.jsx("div",{className:`inline-block bg-gray-100 text-center align-middle ${g??""}`,style:m,children:u.jsx("div",{className:"flex items-center justify-center w-full h-full",children:u.jsx("img",{src:h,alt:"Error loading image",...y,"data-original-url":d})})}):u.jsx("img",{src:d,alt:f,className:g,style:m,...y,onError:l})}function uC({isOpen:e,onClose:n,comments:a,postAuthor:s,onAddComment:o,onDeleteComment:l,hasMoreComments:d=!1,isLoadingMoreComments:f=!1,onLoadMoreComments:m}){const[g,y]=v.useState(""),[h,b]=v.useState(null),[k,C]=v.useState(a),[N,j]=v.useState(null),{isProfileComplete:M,profile:P}=mr(),F=mn(),U=v.useMemo(()=>P!=null&&P.image&&(P!=null&&P.user_stage_id)?Ul(P.image,P.user_stage_id):qn,[P==null?void 0:P.image,P==null?void 0:P.user_stage_id]);v.useEffect(()=>{C(a)},[a]),v.useEffect(()=>{const A=document.documentElement,w=document.body,R=w.style.overflow,E=w.style.touchAction,Y=w.style.overscrollBehavior,K=A.style.overflow,I=A.style.touchAction,$=A.style.overscrollBehavior;return e?(w.style.overflow="hidden",w.style.touchAction="none",w.style.overscrollBehavior="none",A.style.overflow="hidden",A.style.touchAction="none",A.style.overscrollBehavior="none",w.classList.add("comments-modal-open")):(w.style.overflow=R,w.style.touchAction=E,w.style.overscrollBehavior=Y,A.style.overflow=K,A.style.touchAction=I,A.style.overscrollBehavior=$,w.classList.remove("comments-modal-open")),()=>{w.style.overflow=R,w.style.touchAction=E,w.style.overscrollBehavior=Y,A.style.overflow=K,A.style.touchAction=I,A.style.overscrollBehavior=$,w.classList.remove("comments-modal-open")}},[e]);const W=()=>{g.trim()&&(o(g,h==null?void 0:h.id),y(""),b(null))},J=({comment:A,isReply:w=!1,parentId:R})=>{const E=(P==null?void 0:P.user_stage_id)===A.userStageId;return u.jsx("div",{className:`${w?"mr-12 mt-3":""}`,dir:"rtl",children:u.jsxs("div",{className:"flex gap-3 items-start",children:[u.jsx("div",{className:"w-8 h-8 rounded-full overflow-hidden flex-shrink-0",style:{border:"2px solid rgba(138, 206, 224, 0.3)"},children:u.jsx(ya,{src:A.authorAvatar,alt:A.author,className:"w-full h-full object-cover",fallbackSrc:qn})}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[u.jsx("span",{className:"text-sm font-bold text-white",children:A.author}),A.author===s&&u.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full",style:{background:"rgba(138, 206, 224, 0.2)",color:"#8ACEE0",border:"1px solid rgba(138, 206, 224, 0.3)"},children:"نویسنده"}),u.jsx("span",{className:"text-xs text-gray-400",children:A.timestamp})]}),u.jsx("p",{className:"text-sm text-white leading-relaxed mb-2",children:A.text}),u.jsxs("div",{className:"flex items-center gap-4",children:[u.jsx("button",{onClick:()=>b({id:A.id,author:A.author}),className:"text-xs font-bold text-gray-400 hover:text-gray-200 transition-colors",children:"پاسخ"}),E&&l&&u.jsxs("button",{onClick:()=>j(A.id),className:"text-xs font-bold text-red-400 hover:text-red-300 transition-colors flex items-center gap-1",children:[u.jsx(kx,{className:"w-3.5 h-3.5"}),u.jsx("span",{children:"حذف"})]})]}),A.replies&&A.replies.length>0&&u.jsx("div",{className:"mt-3 space-y-3",children:A.replies.map(Y=>u.jsx(J,{comment:Y,isReply:!0,parentId:A.id},Y.id))})]})]})})};return typeof document>"u"?null:df.createPortal(u.jsx(pn,{children:e&&u.jsxs(u.Fragment,{children:[u.jsx(se.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:n,className:"fixed inset-0 bg-black/60 z-[120] backdrop-blur-sm"}),u.jsxs(se.div,{initial:{y:"100%"},animate:{y:0},exit:{y:"100%"},transition:{type:"spring",damping:30,stiffness:300},className:"fixed left-0 right-0 z-[121] rounded-t-3xl overflow-hidden flex flex-col max-w-md mx-auto",style:{background:"linear-gradient(180deg, rgba(46, 27, 61, 0.98) 0%, rgba(35, 24, 62, 0.98) 100%)",border:"1px solid rgba(255, 170, 224, 0.22)",bottom:"env(safe-area-inset-bottom, 0px)",maxHeight:"min(82dvh, 760px)",height:"min(82dvh, 760px)"},children:[u.jsxs("div",{className:"sticky top-0 z-10 px-4 py-3 flex items-center justify-between flex-shrink-0",style:{background:"rgba(46, 27, 61, 0.94)",borderBottom:"1px solid rgba(255, 170, 224, 0.2)"},dir:"rtl",children:[u.jsx("div",{className:"absolute top-2 left-1/2 -translate-x-1/2 w-12 h-1 rounded-full bg-gray-600"}),u.jsx("h2",{className:"text-white font-bold text-base mt-3",children:"نظرات"}),u.jsx("button",{onClick:n,className:"w-8 h-8 rounded-full flex items-center justify-center mt-3",style:{background:"rgba(255, 170, 224, 0.1)"},children:u.jsx(Ds,{className:"w-5 h-5 text-gray-300"})})]}),u.jsx("div",{className:"comments-scroll flex-1 overflow-y-auto px-4 py-4 space-y-4",style:{scrollbarWidth:"thin",scrollbarColor:"rgba(255, 170, 224, 0.3) transparent"},children:k.length===0?u.jsxs("div",{className:"flex flex-col items-center justify-center py-16",children:[u.jsx("div",{className:"w-16 h-16 rounded-full flex items-center justify-center mb-3",style:{background:"rgba(138, 206, 224, 0.1)",border:"2px solid rgba(138, 206, 224, 0.2)"},children:u.jsx("svg",{className:"w-8 h-8",style:{color:"#8ACEE0"},fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:u.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})})}),u.jsx("p",{className:"text-gray-400 text-sm",children:"هنوز نظری ثبت نشده است"}),u.jsx("p",{className:"text-gray-500 text-xs mt-1",children:"اولین نفری باشید که نظر می‌دهد"})]}):u.jsxs(u.Fragment,{children:[k.map(A=>u.jsx(J,{comment:A},A.id)),d&&u.jsx("div",{className:"pt-2 text-center",children:u.jsx(se.button,{whileTap:{scale:f?1:.97},onClick:m,disabled:f,className:"px-4 py-2 rounded-full text-xs font-bold text-white",style:{background:"linear-gradient(135deg, rgba(96, 147, 157, 0.9) 0%, rgba(76, 127, 137, 0.9) 100%)",border:"1px solid rgba(138, 206, 224, 0.3)",opacity:f?.65:1,cursor:f?"not-allowed":"pointer"},children:f?"در حال بارگذاری...":"نمایش نظرات بیشتر"})})]})}),u.jsx("div",{className:"sticky bottom-0 px-4 py-3 flex-shrink-0",style:{background:"rgba(46, 27, 61, 0.9)",borderTop:"1px solid rgba(255, 170, 224, 0.2)",paddingBottom:"calc(env(safe-area-inset-bottom, 0px) + 10px)"},dir:"rtl",children:M?u.jsxs(u.Fragment,{children:[h&&u.jsxs("div",{className:"mb-2 px-3 py-2 rounded-lg flex items-center justify-between",style:{background:"rgba(138, 206, 224, 0.1)",border:"1px solid rgba(138, 206, 224, 0.2)"},children:[u.jsxs("span",{className:"text-xs text-gray-300",children:["در حال پاسخ به ",u.jsx("span",{style:{color:"#8ACEE0"},children:h.author})]}),u.jsx("button",{onClick:()=>b(null),className:"text-gray-400 hover:text-white",children:u.jsx(Ds,{className:"w-4 h-4"})})]}),u.jsxs("div",{className:"flex gap-2 items-center",children:[u.jsx("div",{className:"w-8 h-8 rounded-full flex-shrink-0 overflow-hidden",style:{background:"linear-gradient(135deg, rgba(138, 206, 224, 0.4) 0%, rgba(62, 121, 131, 0.4) 100%)",border:"1.5px solid rgba(138, 206, 224, 0.5)"},children:u.jsx(ya,{src:U,alt:"پروفایل من",className:"w-full h-full object-cover",fallbackSrc:qn})}),u.jsx("input",{type:"text",value:g,onChange:A=>y(A.target.value),onKeyPress:A=>A.key==="Enter"&&W(),placeholder:h?`پاسخ به ${h.author}...`:"نظر خود را بنویسید...",className:"flex-1 px-4 py-2.5 rounded-full text-white placeholder-gray-400 outline-none transition-all",style:{fontSize:16,background:"rgba(32, 76, 106, 0.3)",border:"1.5px solid rgba(138, 206, 224, 0.3)"},onFocus:A=>{A.target.style.border="1.5px solid rgba(138, 206, 224, 0.6)",A.target.style.boxShadow="0 0 15px rgba(138, 206, 224, 0.3)"},onBlur:A=>{A.target.style.border="1.5px solid rgba(138, 206, 224, 0.3)",A.target.style.boxShadow="none"}}),g.trim()&&u.jsx(se.button,{initial:{scale:0},animate:{scale:1},exit:{scale:0},whileTap:{scale:.9},onClick:W,className:"px-4 py-2.5 rounded-full text-sm font-bold text-white flex-shrink-0",style:{background:"linear-gradient(135deg, #FFB800 0%, #FF9500 100%)",boxShadow:"0 4px 15px rgba(255, 165, 0, 0.4)"},children:"ارسال"})]})]}):u.jsxs("div",{className:"px-4 py-3 rounded-2xl flex items-center justify-between gap-3",style:{background:"rgba(255, 184, 0, 0.1)",border:"1.5px solid rgba(255, 184, 0, 0.3)"},children:[u.jsx("p",{className:"text-sm text-gray-300 flex-1",children:"برای ثبت نظر، ابتدا پروفایل خود را تکمیل کنید"}),u.jsx(se.button,{whileTap:{scale:.95},onClick:()=>{n(),F("/profile")},className:"px-4 py-2 rounded-full text-xs font-bold text-white flex-shrink-0",style:{background:"linear-gradient(135deg, #FFB800 0%, #FF9500 100%)",boxShadow:"0 2px 8px rgba(255, 165, 0, 0.4)"},children:"تکمیل پروفایل"})]})})]}),u.jsx(pn,{children:N&&u.jsx(se.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[60] flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.7)"},onClick:()=>j(null),children:u.jsxs(se.div,{initial:{scale:.9,y:20},animate:{scale:1,y:0},exit:{scale:.9,y:20},onClick:A=>A.stopPropagation(),className:"w-full max-w-md rounded-3xl overflow-hidden",style:{background:"linear-gradient(180deg, rgba(32, 76, 106, 0.98) 0%, rgba(20, 40, 60, 0.98) 100%)",border:"2px solid rgba(138, 206, 224, 0.3)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.5)"},children:[u.jsx("div",{className:"px-6 py-4 border-b",style:{borderColor:"rgba(138, 206, 224, 0.2)"},children:u.jsx("h3",{className:"text-lg font-bold text-center",style:{color:"#FFFFFF",textShadow:"0 2px 4px rgba(0, 0, 0, 0.3)"},children:"تایید حذف نظر"})}),u.jsx("div",{className:"p-6",dir:"rtl",children:u.jsxs("p",{className:"text-base text-center leading-relaxed",style:{color:"#FFFFFF",textShadow:"0 1px 2px rgba(0, 0, 0, 0.3)"},children:["آیا مطمئن هستید که می‌خواهید این نظر را حذف کنید؟",u.jsx("br",{}),u.jsx("span",{className:"text-sm text-gray-400 mt-2 block",children:"تمام پاسخ‌های این نظر نیز حذف خواهند شد."})]})}),u.jsxs("div",{className:"px-6 py-4 flex gap-3",dir:"rtl",children:[u.jsx(se.button,{whileTap:{scale:.95},onClick:()=>j(null),className:"flex-1 py-3 rounded-full font-bold text-white",style:{background:"linear-gradient(135deg, rgba(96, 96, 96, 0.9) 0%, rgba(64, 64, 64, 0.9) 100%)",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.3)"},children:"انصراف"}),u.jsx(se.button,{whileTap:{scale:.95},onClick:()=>{l&&l(N),j(null)},className:"flex-1 py-3 rounded-full font-bold text-white",style:{background:"linear-gradient(135deg, #ef4444 0%, #dc2626 100%)",boxShadow:"0 4px 12px rgba(239, 68, 68, 0.4)"},children:"حذف نظر"})]})]})})})]})}),document.body)}const Eg="data:image/svg+xml,%3csvg%20width='21'%20height='20'%20viewBox='0%200%2021%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%3e%3cpath%20d='M8.93014%206.45563C9.0872%206.31265%209.35273%206.12763%209.53076%205.98322C9.99282%205.60838%2010.4265%205.26103%2010.8381%204.82861C11.0691%204.58506%2011.2862%204.32893%2011.4884%204.06143C11.7709%203.68056%2011.9337%203.35265%2012.3173%203.04952C13.3709%202.21679%2014.2244%203.15344%2014.1072%204.27919C14.0171%205.14458%2013.7154%205.97962%2013.3158%206.739C13.1517%207.09648%2012.934%207.46294%2012.7408%207.80523C12.6635%207.94209%2012.5018%208.16931%2012.4512%208.30253C12.4927%208.42366%2012.7696%208.38337%2012.883%208.38297L13.4778%208.38304L15.4332%208.38323C15.7122%208.38288%2016.1319%208.36986%2016.3939%208.40266C16.8968%208.47021%2017.3516%208.7341%2017.6573%209.13565C17.9692%209.54186%2018.1046%2010.0547%2018.0335%2010.5603C17.9883%2010.8864%2017.7542%2011.4364%2017.6293%2011.7668L16.9186%2013.639L16.2115%2015.5076C16.0861%2015.8391%2015.961%2016.1948%2015.8168%2016.5163C15.6907%2016.7852%2015.5055%2017.002%2015.2755%2017.1858C14.688%2017.655%2014.0365%2017.5913%2013.336%2017.5914L11.6134%2017.5915L9.85324%2017.5913C9.59195%2017.5913%209.33116%2017.5919%209.06951%2017.5876C8.44789%2017.5776%207.91102%2017.303%207.52476%2016.8163C7.04223%2016.2083%207.13643%2015.5001%207.13651%2014.7746L7.13673%2012.6306L7.13682%2010.2716C7.13673%209.84315%207.11446%209.21564%207.17638%208.81556C7.30178%208.00526%207.83312%207.36588%208.44282%206.85042C8.59578%206.72111%208.76661%206.57232%208.93014%206.45563Z'%20fill='url(%23paint0_linear_69_15)'/%3e%3cpath%20d='M8.93014%206.45563C9.0872%206.31265%209.35273%206.12763%209.53076%205.98322C9.99282%205.60838%2010.4265%205.26103%2010.8381%204.82861C11.0691%204.58506%2011.2862%204.32893%2011.4884%204.06143C11.7709%203.68056%2011.9337%203.35265%2012.3173%203.04952C13.3709%202.21679%2014.2244%203.15344%2014.1072%204.27919C14.0171%205.14458%2013.7154%205.97962%2013.3158%206.739C13.1517%207.09648%2012.934%207.46294%2012.7408%207.80523C12.6635%207.94209%2012.5018%208.16931%2012.4512%208.30253C12.4927%208.42366%2012.7696%208.38337%2012.883%208.38297L13.4778%208.38304L15.4332%208.38323C15.7122%208.38288%2016.1319%208.36986%2016.3939%208.40266C16.8968%208.47021%2017.3516%208.7341%2017.6573%209.13565C17.9692%209.54186%2018.1046%2010.0547%2018.0335%2010.5603C17.9883%2010.8864%2017.7542%2011.4364%2017.6293%2011.7668L16.9186%2013.639L16.2115%2015.5076C16.0861%2015.8391%2015.961%2016.1948%2015.8168%2016.5163C15.6907%2016.7852%2015.5055%2017.002%2015.2755%2017.1858C14.688%2017.655%2014.0365%2017.5913%2013.336%2017.5914L11.6134%2017.5915L9.85324%2017.5913C9.59195%2017.5913%209.33116%2017.5919%209.06951%2017.5876C8.44789%2017.5776%207.91102%2017.303%207.52476%2016.8163C7.04223%2016.2083%207.13643%2015.5001%207.13651%2014.7746L7.13673%2012.6306L7.13682%2010.2716C7.13673%209.84315%207.11446%209.21564%207.17638%208.81556C7.30178%208.00526%207.83312%207.36588%208.44282%206.85042C8.59578%206.72111%208.76661%206.57232%208.93014%206.45563Z'%20fill='url(%23paint1_linear_69_15)'/%3e%3c/g%3e%3cg%3e%3cpath%20d='M3.64002%207.50399C4.59494%207.41054%205.45108%208.17183%205.46613%209.11963C5.46828%209.25479%205.47569%209.38642%205.47559%209.52292L5.47482%2010.1911L5.47518%2012.468L5.47589%2014.7783L5.47625%2015.4611C5.47625%2015.634%205.47708%2015.8864%205.45247%2016.057C5.41099%2016.3528%205.29285%2016.6329%205.10959%2016.87C4.81986%2017.2507%204.41411%2017.4334%203.94826%2017.4977C3.49341%2017.5368%203.07863%2017.42%202.71922%2017.1354C2.38499%2016.8709%202.15171%2016.4572%202.10737%2016.0359C2.08908%2015.862%202.09373%2015.6472%202.09388%2015.4695L2.09431%2014.6733L2.09488%2012.0786L2.09506%2010.0008C2.09485%209.33049%202.00446%208.64776%202.47734%208.09594C2.78563%207.73621%203.16914%207.55069%203.64002%207.50399Z'%20fill='url(%23paint2_linear_69_15)'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_69_15'%20x1='15.0323'%20y1='17.6016'%20x2='10.1059'%20y2='4.60476'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2C6C4'/%3e%3cstop%20offset='0.614493'%20stop-color='%23D7ABBE'/%3e%3cstop%20offset='1'%20stop-color='%23BD8EAF'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_69_15'%20x1='15.0323'%20y1='17.6016'%20x2='10.1059'%20y2='4.60476'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2C6C4'/%3e%3cstop%20offset='0.614493'%20stop-color='%23D7ABBE'/%3e%3cstop%20offset='1'%20stop-color='%23BD8EAF'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_69_15'%20x1='4.53955'%20y1='17.51'%20x2='-0.371472'%20y2='11.5417'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2C6C4'/%3e%3cstop%20offset='0.614493'%20stop-color='%23D7ABBE'/%3e%3cstop%20offset='1'%20stop-color='%23BD8EAF'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",dC="data:image/svg+xml,%3csvg%20width='21'%20height='20'%20viewBox='0%200%2021%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2.26151%207.04808C2.36271%206.64226%202.55803%206.19349%202.76705%205.83249C3.43492%204.67778%204.54195%203.83661%205.84047%203.49717C6.16362%203.41264%206.49438%203.35989%206.82797%203.3397C7.26517%203.31378%207.86835%203.33109%208.32121%203.33123L11.018%203.33111L13.0919%203.33118C13.578%203.33125%2014.1163%203.31349%2014.5938%203.38011C15.2393%203.47522%2015.8603%203.69267%2016.4229%204.02056C17.5546%204.68065%2018.3824%205.75166%2018.7308%207.00651C18.7754%207.22104%2018.8471%207.45922%2018.8665%207.67816C18.951%208.63431%2018.8882%209.607%2018.9074%2010.5667C18.9102%2010.7055%2018.9063%2010.8529%2018.8975%2010.9909C18.8426%2011.868%2018.5556%2012.7155%2018.0654%2013.4478C17.3301%2014.549%2016.1835%2015.3155%2014.878%2015.5787C14.2122%2015.7139%2013.6255%2015.6778%2012.9552%2015.6812C12.7386%2015.6823%2012.4033%2015.6699%2012.2037%2015.7035C12.0322%2015.7322%2011.694%2015.9027%2011.52%2015.9831L10.9278%2016.2519L7.8034%2017.6647L6.98947%2018.0321C6.85271%2018.0937%206.70771%2018.165%206.56733%2018.2151C6.53514%2018.2265%206.48044%2018.2428%206.4576%2018.2214C6.43628%2018.2013%206.40266%2018.1859%206.40648%2018.1532C6.42422%2018.0011%206.56988%2017.74%206.63335%2017.6061L7.17221%2016.4669C7.27297%2016.2575%207.37978%2016.0495%207.46758%2015.8343C7.5379%2015.6619%207.38007%2015.681%207.26229%2015.6794C7.19601%2015.6784%207.12854%2015.6812%207.06227%2015.6801C6.6308%2015.672%206.20201%2015.6108%205.78577%2015.4978C4.09155%2015.03%202.76592%2013.7208%202.28812%2012.0432C2.1831%2011.6869%202.12063%2011.3196%202.10196%2010.9489C2.07901%2010.4156%202.10022%209.81715%202.09531%209.27816C2.09064%208.76609%202.08243%208.22179%202.13015%207.71449C2.15306%207.47102%202.21758%207.27584%202.26151%207.04808Z'%20fill='url(%23paint0_linear_69_4)'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_69_4'%20x1='14.2617'%20y1='18.2393'%20x2='10.7933'%20y2='4.18829'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F2C6C4'/%3e%3cstop%20offset='0.614493'%20stop-color='%23D7ABBE'/%3e%3cstop%20offset='1'%20stop-color='%23BD8EAF'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e";function Bx({id:e,authorName:n,authorAvatar:a,image:s,title:o,caption:l,likes:d,dislikes:f,comments:m,timestamp:g,initialComments:y,mediaType:h="image",mediaUrl:b,isOwnPost:k=!1,initialLikeState:C="",missionType:N,workflowID:j,onDelete:M,teamMemberIds:P,preloadedTeamMembers:F}){const W={border:"1px solid transparent",backgroundImage:"linear-gradient(180deg, rgba(46, 27, 61, 0.95) 0%, rgba(35, 24, 62, 0.93) 100%), linear-gradient(120deg, rgba(124, 58, 237, 0.72) 0%, rgba(249, 115, 22, 0.56) 58%, rgba(250, 204, 21, 0.42) 100%)",backgroundOrigin:"border-box",backgroundClip:"padding-box, border-box",boxShadow:"0 -9px 24px rgba(7, 0, 18, 0.52), 0 14px 30px rgba(5, 2, 12, 0.42), 0 0 20px rgba(255, 121, 207, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.24), inset 0 2px 6px rgba(255, 222, 255, 0.1), inset 0 -2px 0 rgba(12, 7, 27, 0.72), inset 0 -10px 18px rgba(8, 4, 18, 0.36), inset 0 0 0 1px rgba(255, 255, 255, 0.06), inset 0 0 0 2px rgba(17, 10, 35, 0.34)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)"},[J,A]=v.useState(d),[w,R]=v.useState(f),E=()=>C==="پسند"?"liked":C==="عدم پسند"?"disliked":null,[Y,K]=v.useState(E()),[I,$]=v.useState(!1),[ee,G]=v.useState(!1),[z,D]=v.useState(!1),[X,q]=v.useState(y||[]),[T,O]=v.useState(!1),[ne,ie]=v.useState(!1),[oe,ae]=v.useState(!1),[ue,xe]=v.useState(!1),[ve,Ve]=v.useState(1),[Ce,Ue]=v.useState(!1),[Oe,dt]=v.useState(F||[]),[xt,vt]=v.useState(!1),{isProfileComplete:Se}=mr(),Re=mn(),we=Te=>{const Ze=it=>Te.filter(gt=>gt.parent===it).map(gt=>({id:gt.comment_id,author:gt.full_name,authorAvatar:Ps(gt.user_stage_id),text:gt.comment_text,timestamp:gt.datetimee,likes:0,isLiked:!1,userStageId:gt.user_stage_id,replies:Ze(gt.comment_id)}));return Te.filter(it=>!it.parent).map(it=>({id:it.comment_id,author:it.full_name,authorAvatar:Ps(it.user_stage_id),text:it.comment_text,timestamp:it.datetimee,likes:0,isLiked:!1,userStageId:it.user_stage_id,replies:Ze(it.comment_id)}))},me=async(Te,Ze)=>{if(j){Ze?xe(!0):ae(!0);try{const ot=await cj(j,Te),it=we(ot.comments);Ue(ot.comments.length>=25),Ve(Te),q(Zt=>Ze?[...Zt,...it]:it)}catch(ot){console.error("Error loading comments:",ot)}finally{ae(!1),xe(!1)}}};v.useEffect(()=>{I&&j&&me(1,!1)},[I,j]),v.useEffect(()=>{F&&dt(F)},[F]),v.useEffect(()=>{F||P&&P.trim()&&!xt&&(vt(!0),Fx(P).then(Te=>{Te.success&&dt(Te.data)}).catch(Te=>{console.error("Error loading team members:",Te)}).finally(()=>{vt(!1)}))},[P,xt,F]);const Ie=()=>{if(!Se){O(!0);return}let Te;Y==="liked"?(A(J-1),K(null),Te="حذف"):(Y==="disliked"&&R(w-1),A(J+1),K("liked"),Te="پسند"),N&&j&&Sg(Te,N,j)},be=()=>{if(!Se){O(!0);return}let Te;Y==="disliked"?(R(w-1),K(null),Te="حذف"):(Y==="liked"&&A(J-1),R(w+1),K("disliked"),Te="عدم پسند"),N&&j&&Sg(Te,N,j)},Ae=(Te,Ze)=>{if(!Se){O(!0);return}N&&j&&(oj(N,j,Te,Ze||""),setTimeout(()=>{me(1,!1)},500))},Qe=()=>{ue||oe||!Ce||me(ve+1,!0)},Ge=Te=>{lj(Te);const Ze=ot=>ot.filter(it=>it.id===Te?!1:(it.replies&&it.replies.length>0&&(it.replies=Ze(it.replies)),!0));q(ot=>Ze(ot))},rt=X.map(Te=>({id:Te.id,author:Te.author,authorAvatar:Te.authorAvatar||qn,text:Te.text,timestamp:Te.timestamp||"الان",likes:Te.likes||0,isLiked:Te.isLiked||!1,userStageId:Te.userStageId,replies:Te.replies||[]})),ht=Te=>{const Ze=["۰","۱","۲","۳","۴","۵","۶","۷","۸","۹"];return Te.toString().split("").map(ot=>Ze[parseInt(ot)]).join("")},Pt=(Te=>{if(!Te)return"لحظاتی پیش";const Ze=new Date(Te);if(Number.isNaN(Ze.getTime()))return"لحظاتی پیش";const ot=Date.now()-Ze.getTime();if(ot<=0)return"لحظاتی پیش";const it=60*1e3,Zt=60*it,gt=24*Zt,yr=7*gt,an=30*gt;return ot<Zt?`${ht(Math.max(1,Math.floor(ot/it)))} دقیقه پیش`:ot<gt?`${ht(Math.floor(ot/Zt))} ساعت پیش`:ot<an?`${ht(Math.floor(ot/yr))} هفته پیش`:`${ht(Math.floor(ot/an))} ماه پیش`})(g),qe={border:"0.6px solid rgba(255, 205, 236, 0.085)",background:"linear-gradient(130deg, rgba(255, 255, 255, 0.035) 0%, rgba(255, 255, 255, 0.0075) 32%, rgba(160, 106, 224, 0.05) 100%), linear-gradient(180deg, rgba(88, 52, 126, 0.09) 0%, rgba(48, 31, 85, 0.075) 100%)",boxShadow:"inset 0 1px 0 rgba(255, 255, 255, 0.07), inset 0 -1px 0 rgba(45, 24, 70, 0.13), inset 0 0 16px rgba(188, 131, 255, 0.04), 0 8px 22px rgba(8, 3, 18, 0.085)",backdropFilter:"blur(12px) saturate(108%)",WebkitBackdropFilter:"blur(12px) saturate(108%)"},kn={border:"0.6px solid rgba(255, 140, 220, 0.38)",background:"linear-gradient(130deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 32%, rgba(255, 121, 207, 0.12) 100%), linear-gradient(180deg, rgba(88, 52, 126, 0.16) 0%, rgba(48, 31, 85, 0.13) 100%)",boxShadow:"inset 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 -1px 0 rgba(45, 24, 70, 0.16), inset 0 0 18px rgba(255, 121, 207, 0.16), 0 0 14px rgba(255, 121, 207, 0.2)"},ft={border:"0.6px solid rgba(255, 140, 220, 0.38)",background:"linear-gradient(130deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 32%, rgba(255, 121, 207, 0.12) 100%), linear-gradient(180deg, rgba(88, 52, 126, 0.16) 0%, rgba(48, 31, 85, 0.13) 100%)",boxShadow:"inset 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 -1px 0 rgba(45, 24, 70, 0.16), inset 0 0 18px rgba(255, 121, 207, 0.16), 0 0 14px rgba(255, 121, 207, 0.2)"},Mn={border:"0.6px solid rgba(255, 205, 236, 0.085)",background:"linear-gradient(130deg, rgba(255, 255, 255, 0.035) 0%, rgba(255, 255, 255, 0.0075) 32%, rgba(160, 106, 224, 0.05) 100%), linear-gradient(180deg, rgba(88, 52, 126, 0.09) 0%, rgba(48, 31, 85, 0.075) 100%)",boxShadow:"inset 0 1px 0 rgba(255, 255, 255, 0.07), inset 0 -1px 0 rgba(45, 24, 70, 0.13), inset 0 0 16px rgba(188, 131, 255, 0.04), 0 8px 22px rgba(8, 3, 18, 0.085)",backdropFilter:"blur(12px) saturate(108%)",WebkitBackdropFilter:"blur(12px) saturate(108%)"};return u.jsxs(se.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"mb-4",children:[u.jsxs("div",{className:"feed-panel rounded-3xl overflow-hidden",style:W,children:[u.jsx("div",{className:"flex items-start px-4 pt-4 pb-2",dir:"rtl",children:u.jsxs("div",{className:"flex items-start gap-2",children:[u.jsx("div",{className:"w-12 h-12 rounded-full overflow-hidden flex-shrink-0",style:{border:"1px solid rgba(255, 170, 224, 0.82)",boxShadow:"0 0 12px rgba(255, 121, 207, 0.35)"},children:u.jsx(ya,{src:a,alt:n,className:"w-full h-full object-cover",fallbackSrc:qn})}),u.jsxs("div",{className:"pt-0",children:[u.jsx("h3",{className:"font-bold text-[18px] leading-6 text-right text-white",children:n}),u.jsx("p",{className:"text-[11px] font-normal text-right text-white/75",children:Pt})]})]})}),u.jsxs("div",{className:"px-4 pb-3",dir:"rtl",children:[u.jsx("h3",{className:"font-semibold mb-1 text-[14px]",style:{color:"#ffd6f0",textShadow:"0 2px 4px rgba(0, 0, 0, 0.6)"},children:o}),u.jsx("p",{className:"text-white leading-relaxed text-[12px]",style:{display:"-webkit-box",WebkitLineClamp:ee?"unset":4,WebkitBoxOrient:"vertical",overflow:"hidden"},children:l}),l.length>150&&u.jsx("button",{onClick:()=>G(!ee),className:"text-xs mt-1",style:{color:"#ff9be0"},children:ee?"کمتر":"بیشتر"})]}),u.jsx("div",{className:"px-4 pb-3",children:u.jsx("div",{className:"relative w-full rounded-3xl overflow-hidden",style:{background:"linear-gradient(180deg, rgba(47, 27, 66, 0.92) 0%, rgba(34, 22, 58, 0.9) 100%)",boxShadow:"0 4px 16px rgba(0, 0, 0, 0.3), 0 0 20px rgba(255, 121, 207, 0.1)",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(10, 20, 35, 0.5)"},children:h==="video"?u.jsx("video",{src:b,poster:s,controls:!0,playsInline:!0,className:"w-full h-auto cursor-pointer block",style:{objectFit:"contain",display:"block"}}):h==="audio"?u.jsxs("div",{className:"w-full",children:[s&&u.jsx(ya,{src:s,alt:"کاور صوت",className:"w-full h-auto max-h-[600px] mb-4",style:{objectFit:"contain"}}),u.jsx("audio",{src:b,controls:!0,className:"w-full",style:{background:"rgba(255, 255, 255, 0.1)",borderRadius:"12px"}})]}):u.jsx(ya,{src:s,alt:"پست",className:"w-full h-auto max-h-[600px]",style:{objectFit:"contain"}})})}),u.jsx("div",{className:"mx-[14px] mb-[10px] mt-1",dir:"rtl",children:u.jsxs("div",{className:"flex items-center justify-between gap-2",children:[u.jsxs("div",{className:"flex items-center gap-1",children:[u.jsxs(se.button,{whileTap:{scale:.9},onClick:Ie,className:"flex items-center gap-2 px-3 py-1.5 rounded-full transition-all min-w-[30px] justify-center",style:Y==="liked"?{...qe,...kn}:qe,children:[u.jsx("img",{src:Eg,alt:"",className:"w-5 h-5 object-contain",style:{filter:Y==="liked"?"saturate(1.28) hue-rotate(-8deg) brightness(1.08) drop-shadow(0 0 6px rgba(255, 121, 207, 0.6))":"none",transition:"filter 60ms linear"}}),u.jsx("span",{className:"text-sm font-bold min-w-[20px] text-center",style:{color:"#FFFFFF",textShadow:"0 1px 2px rgba(0, 0, 0, 0.3)"},children:ht(J)})]}),u.jsxs(se.button,{whileTap:{scale:.9},onClick:be,className:"flex items-center gap-2 px-3 py-1.5 rounded-full transition-all min-w-[30px] justify-center",style:Y==="disliked"?{...qe,...ft}:qe,children:[u.jsx("img",{src:Eg,alt:"",className:"w-5 h-5 object-contain rotate-180",style:{filter:Y==="disliked"?"saturate(1.28) hue-rotate(-8deg) brightness(1.08) drop-shadow(0 0 6px rgba(255, 121, 207, 0.6))":"none",transition:"filter 60ms linear"}}),u.jsx("span",{className:"text-sm font-bold min-w-[20px] text-center",style:{color:"#FFFFFF",textShadow:"0 1px 2px rgba(0, 0, 0, 0.3)"},children:ht(w)})]})]}),u.jsx("div",{className:"flex items-center",children:u.jsxs(se.button,{whileTap:{scale:.9},onClick:()=>$(!I),className:"flex items-center gap-2 px-3 py-1.5 rounded-full transition-all min-w-[30px] justify-center",style:qe,children:[u.jsx("img",{src:dC,alt:"",className:"w-5 h-5 object-contain",style:{filter:I?"drop-shadow(0 0 6px rgba(255, 121, 207, 0.6))":"none",transition:"filter 120ms ease"}}),u.jsx("span",{className:"text-sm font-bold min-w-[20px] text-center",style:{color:"#FFFFFF",textShadow:"0 1px 2px rgba(0, 0, 0, 0.3)"},children:ht(m)})]})})]})}),Oe.length>0&&u.jsxs("div",{className:"mx-[14px] mb-[16px] rounded-full px-4 py-2.5 flex items-center justify-between",style:Mn,dir:"rtl",children:[u.jsxs("button",{type:"button",onClick:()=>D(!0),className:"flex items-center gap-2",children:[u.jsxs("div",{className:"flex -space-x-2",dir:"ltr",children:[Oe.slice(0,3).map(Te=>u.jsx("div",{className:"w-8 h-8 rounded-full overflow-hidden",style:{boxShadow:"0 2px 8px rgba(0, 0, 0, 0.28)"},children:u.jsx(ya,{src:Ps(Te.StageID.toString()),alt:Te.full_name,className:"w-full h-full object-cover",fallbackSrc:qn})},Te.StageID)),Oe.length>3&&u.jsxs("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-[11px] font-bold text-white",style:{background:"rgba(255, 121, 207, 0.35)"},children:["+",ht(Oe.length-3)]})]}),u.jsx("div",{className:"text-[#ffd6f0] text-[14px] whitespace-nowrap",children:"همکاری‌کنندگان"})]}),u.jsx(mx,{size:18,color:"#ffd6f0"})]})]}),u.jsx(uC,{isOpen:I,onClose:()=>$(!1),comments:rt,postAuthor:n,onAddComment:Ae,onDeleteComment:Ge,hasMoreComments:Ce,isLoadingMoreComments:ue,onLoadMoreComments:Qe}),u.jsx(pn,{children:z&&Oe.length>0&&u.jsx(se.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50 flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.7)"},onClick:()=>D(!1),children:u.jsxs(se.div,{initial:{scale:.9,y:20},animate:{scale:1,y:0},exit:{scale:.9,y:20},onClick:Te=>Te.stopPropagation(),className:"w-full max-w-md rounded-3xl overflow-hidden",style:{background:"linear-gradient(180deg, rgba(46, 27, 61, 0.98) 0%, rgba(35, 24, 62, 0.98) 100%)",border:"1px solid rgba(255, 170, 224, 0.4)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.5)",backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)",maxHeight:"80vh"},children:[u.jsx("div",{className:"px-6 py-4 border-b",style:{borderColor:"rgba(255, 170, 224, 0.2)"},children:u.jsxs("h3",{className:"text-lg font-bold text-center",style:{color:"#FFFFFF",textShadow:"0 2px 4px rgba(0, 0, 0, 0.3)"},children:["مشارکت‌کنندگان (",ht(Oe.length)," نفر)"]})}),u.jsx("div",{className:"overflow-y-auto p-4",style:{maxHeight:"60vh"},children:u.jsx("div",{className:"space-y-3",children:Oe.map((Te,Ze)=>u.jsxs(se.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:Ze*.05},className:"flex items-center gap-3 p-3 rounded-2xl",style:{background:"linear-gradient(135deg, rgba(85, 48, 121, 0.4) 0%, rgba(48, 31, 85, 0.4) 100%)",border:"1px solid rgba(255, 170, 224, 0.2)"},dir:"rtl",children:[u.jsx("div",{className:"w-12 h-12 rounded-full overflow-hidden flex-shrink-0",style:{boxShadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},children:u.jsx(ya,{src:Ps(Te.StageID.toString()),alt:Te.full_name,className:"w-full h-full object-cover",fallbackSrc:qn})}),u.jsx("div",{className:"flex-1",children:u.jsx("h4",{className:"font-bold text-base",style:{color:"#FFFFFF",textShadow:"0 1px 2px rgba(0, 0, 0, 0.3)"},children:Te.full_name})})]},Te.StageID))})}),u.jsx("div",{className:"px-6 py-4",children:u.jsx(se.button,{whileTap:{scale:.95},onClick:()=>D(!1),className:"w-full py-3 rounded-full font-bold text-white",style:{background:"linear-gradient(135deg, rgba(255, 121, 207, 0.9) 0%, rgba(124, 58, 237, 0.85) 100%)",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.3)"},children:"بستن"})})]})})}),u.jsx(pn,{children:T&&u.jsx(se.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50 flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.7)"},onClick:()=>O(!1),children:u.jsxs(se.div,{initial:{scale:.9,y:20},animate:{scale:1,y:0},exit:{scale:.9,y:20},onClick:Te=>Te.stopPropagation(),className:"w-full max-w-md rounded-3xl overflow-hidden",style:{background:"linear-gradient(180deg, rgba(32, 76, 106, 0.98) 0%, rgba(20, 40, 60, 0.98) 100%)",border:"2px solid rgba(138, 206, 224, 0.3)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.5)",maxHeight:"80vh"},children:[u.jsx("div",{className:"px-6 py-4 border-b",style:{borderColor:"rgba(138, 206, 224, 0.2)"},children:u.jsx("h3",{className:"text-lg font-bold text-center",style:{color:"#FFFFFF",textShadow:"0 2px 4px rgba(0, 0, 0, 0.3)"},children:"اخطار"})}),u.jsx("div",{className:"p-6",dir:"rtl",children:u.jsx("p",{className:"text-base text-center leading-relaxed",style:{color:"#FFFFFF",textShadow:"0 1px 2px rgba(0, 0, 0, 0.3)"},children:"برای لایک، دیس‌لایک یا نظر دادن به پست‌ها، ابتدا باید پروفایل خود را تکمیل کنید."})}),u.jsxs("div",{className:"px-6 py-4 flex gap-3",dir:"rtl",children:[u.jsx(se.button,{whileTap:{scale:.95},onClick:()=>O(!1),className:"flex-1 py-3 rounded-full font-bold text-white",style:{background:"linear-gradient(135deg, rgba(96, 96, 96, 0.9) 0%, rgba(64, 64, 64, 0.9) 100%)",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.3)"},children:"بستن"}),u.jsx(se.button,{whileTap:{scale:.95},onClick:()=>{O(!1),Re("/profile")},className:"flex-1 py-3 rounded-full font-bold text-white",style:{background:"linear-gradient(135deg, #FFB800 0%, #FF9500 100%)",boxShadow:"0 4px 12px rgba(255, 165, 0, 0.4)"},children:"تکمیل پروفایل"})]})]})})}),u.jsx(pn,{children:ne&&u.jsx(se.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50 flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.7)"},onClick:()=>ie(!1),children:u.jsxs(se.div,{initial:{scale:.9,y:20},animate:{scale:1,y:0},exit:{scale:.9,y:20},onClick:Te=>Te.stopPropagation(),className:"w-full max-w-md rounded-3xl overflow-hidden",style:{background:"linear-gradient(180deg, rgba(32, 76, 106, 0.98) 0%, rgba(20, 40, 60, 0.98) 100%)",border:"2px solid rgba(138, 206, 224, 0.3)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.5)",maxHeight:"80vh"},children:[u.jsx("div",{className:"px-6 py-4 border-b",style:{borderColor:"rgba(138, 206, 224, 0.2)"},children:u.jsx("h3",{className:"text-lg font-bold text-center",style:{color:"#FFFFFF",textShadow:"0 2px 4px rgba(0, 0, 0, 0.3)"},children:"تایید حذف"})}),u.jsx("div",{className:"p-6",dir:"rtl",children:u.jsx("p",{className:"text-base text-center leading-relaxed",style:{color:"#FFFFFF",textShadow:"0 1px 2px rgba(0, 0, 0, 0.3)"},children:"آیا مطمئن هستید که می‌خواهید این پست را حذف کنید؟"})}),u.jsxs("div",{className:"px-6 py-4 flex gap-3",dir:"rtl",children:[u.jsx(se.button,{whileTap:{scale:.95},onClick:()=>ie(!1),className:"flex-1 py-3 rounded-full font-bold text-white",style:{background:"linear-gradient(135deg, rgba(96, 96, 96, 0.9) 0%, rgba(64, 64, 64, 0.9) 100%)",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.3)"},children:"انصراف"}),u.jsx(se.button,{whileTap:{scale:.95},onClick:()=>{N&&j&&ij(N,j),ie(!1),M&&e&&M(e)},className:"flex-1 py-3 rounded-full font-bold text-white",style:{background:"linear-gradient(135deg, #ef4444 0%, #dc2626 100%)",boxShadow:"0 4px 12px rgba(239, 68, 68, 0.4)"},children:"حذف"})]})]})})})]})}const fC=["https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?w=400&q=80","https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=400&q=80","https://images.unsplash.com/photo-1527980965255-d3b416303d12?w=400&q=80","https://images.unsplash.com/photo-1438761681033-6461ffad8d80?w=400&q=80","https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=400&q=80","https://images.unsplash.com/photo-1500648767791-00dcc994a43e?w=400&q=80","https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=400&q=80","https://images.unsplash.com/photo-1506794778202-cad84cf45f1d?w=400&q=80","https://images.unsplash.com/photo-1554151228-14d9def656e4?w=400&q=80","https://images.unsplash.com/photo-1522075469751-3a6694fb2f61?w=400&q=80","https://images.unsplash.com/photo-1517841905240-472988babdf9?w=400&q=80","https://images.unsplash.com/photo-1542909168-82c3e7fdca5c?w=400&q=80"];function hC({isOpen:e,onClose:n,onSelectAvatar:a,currentAvatar:s}){const[o,l]=v.useState(null),[d,f]=v.useState(null),[m,g]=v.useState(null),[y,h]=v.useState(!1),b=v.useRef(null),k=N=>{var M;const j=(M=N.target.files)==null?void 0:M[0];if(j){g(j);const P=new FileReader;P.onloadend=()=>{const F=P.result;f(F),l(F)},P.readAsDataURL(j)}},C=async()=>{if(console.log("handleConfirm called"),console.log("selectedAvatar:",o),console.log("uploadedImageFile:",m),!!o){h(!0);try{let N=m;if(!m&&o.startsWith("http")){console.log("Downloading suggested avatar from URL:",o);try{const M=await(await fetch(o)).blob(),P=`avatar_${Date.now()}.jpg`;N=new File([M],P,{type:M.type||"image/jpeg"}),console.log("Downloaded file:",N.name,N.size)}catch(j){console.error("Error downloading suggested avatar:",j),alert("خطا در دانلود تصویر. لطفاً دوباره تلاش کنید."),h(!1);return}}if(N){console.log("Starting image upload...",N.name);const j=await Ls(N);console.log("Upload result:",j),j?(console.log("Sending filename to parent:",j),a(j),n()):(console.error("Upload returned null filename"),alert("خطا در آپلود تصویر. لطفاً دوباره تلاش کنید."))}else console.error("No file to upload"),alert("لطفاً یک تصویر انتخاب کنید.")}catch(N){console.error("Error in handleConfirm:",N),alert("خطا در آپلود تصویر. لطفاً دوباره تلاش کنید.")}finally{h(!1)}}};return u.jsx(pn,{children:e&&u.jsx(se.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[100] flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.8)"},onClick:n,children:u.jsxs(se.div,{initial:{scale:.9,y:20},animate:{scale:1,y:0},exit:{scale:.9,y:20},onClick:N=>N.stopPropagation(),className:"w-full max-w-md rounded-3xl overflow-hidden",style:{background:"linear-gradient(180deg, rgba(32, 76, 106, 0.98) 0%, rgba(20, 40, 60, 0.98) 100%)",border:"2px solid rgba(138, 206, 224, 0.3)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.5)",maxHeight:"85vh"},children:[u.jsxs("div",{className:"px-6 py-4 border-b flex items-center justify-between",style:{borderColor:"rgba(138, 206, 224, 0.2)"},children:[u.jsx("h3",{className:"text-lg font-bold",style:{color:"#FFFFFF",textShadow:"0 2px 4px rgba(0, 0, 0, 0.3)"},children:"انتخاب عکس پروفایل"}),u.jsx(se.button,{whileTap:{scale:.9},onClick:n,className:"w-8 h-8 rounded-full flex items-center justify-center",style:{background:"linear-gradient(135deg, rgba(239, 68, 68, 0.9) 0%, rgba(220, 38, 38, 0.9) 100%)",boxShadow:"0 2px 8px rgba(239, 68, 68, 0.4)"},children:u.jsx(Ds,{className:"w-5 h-5 text-white"})})]}),u.jsxs("div",{className:"overflow-y-auto p-6",style:{maxHeight:"calc(85vh - 180px)"},children:[u.jsxs("div",{className:"mb-6",children:[u.jsx("h4",{className:"text-sm font-bold mb-3",style:{color:"#8ACEE0",textShadow:"0 1px 2px rgba(0, 0, 0, 0.3)"},children:"آپلود عکس شخصی"}),u.jsx("input",{ref:b,type:"file",accept:"image/*",onChange:k,className:"hidden"}),u.jsxs(se.button,{whileTap:{scale:.95},onClick:()=>{var N;return(N=b.current)==null?void 0:N.click()},className:"w-full py-4 rounded-2xl font-bold text-sm flex items-center justify-center gap-2",style:{background:"linear-gradient(135deg, rgba(96, 147, 157, 0.9) 0%, rgba(76, 127, 137, 0.9) 100%)",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1)",border:"2px solid rgba(138, 206, 224, 0.3)",color:"#FFFFFF",textShadow:"0 2px 4px rgba(0, 0, 0, 0.3)"},children:[u.jsx($f,{className:"w-5 h-5"}),u.jsx("span",{children:"انتخاب از گالری"})]}),d&&u.jsx(se.div,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},className:"mt-4 flex justify-center",children:u.jsx("div",{className:"w-24 h-24 rounded-full overflow-hidden",style:{border:"3px solid rgba(138, 206, 224, 0.5)",boxShadow:"0 4px 16px rgba(138, 206, 224, 0.4), inset 0 -4px 12px rgba(0, 0, 0, 0.3)"},children:u.jsx("img",{src:d,alt:"آپلود شده",className:"w-full h-full object-cover"})})})]}),u.jsxs("div",{children:[u.jsx("h4",{className:"text-sm font-bold mb-3",style:{color:"#8ACEE0",textShadow:"0 1px 2px rgba(0, 0, 0, 0.3)"},children:"عکس‌های پیشنهادی"}),u.jsx("div",{className:"grid grid-cols-4 gap-3",children:fC.map((N,j)=>u.jsxs(se.button,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{delay:j*.05},whileTap:{scale:.9},onClick:()=>{l(N),f(null),g(null)},className:"aspect-square rounded-full overflow-hidden relative",style:{border:o===N?"3px solid rgba(255, 193, 7, 0.8)":"2px solid rgba(138, 206, 224, 0.3)",boxShadow:o===N?"0 4px 16px rgba(255, 193, 7, 0.6), inset 0 0 20px rgba(255, 193, 7, 0.2)":"0 2px 8px rgba(0, 0, 0, 0.3)"},children:[u.jsx("img",{src:N,alt:`آواتار ${j+1}`,className:"w-full h-full object-cover"}),o===N&&u.jsx(se.div,{initial:{scale:0},animate:{scale:1},className:"absolute inset-0 flex items-center justify-center",style:{background:"rgba(255, 193, 7, 0.3)"},children:u.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center",style:{background:"linear-gradient(135deg, rgba(255, 193, 7, 0.95) 0%, rgba(255, 152, 0, 0.95) 100%)",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.4)"},children:u.jsx(px,{className:"w-3 h-3 text-white"})})})]},j))})]})]}),u.jsxs("div",{className:"px-6 py-4 border-t flex gap-3",style:{borderColor:"rgba(138, 206, 224, 0.2)"},children:[u.jsx(se.button,{whileTap:{scale:.95},onClick:n,className:"flex-1 py-3 rounded-full font-bold text-white",style:{background:"linear-gradient(135deg, rgba(96, 147, 157, 0.6) 0%, rgba(76, 127, 137, 0.6) 100%)",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.3)",border:"1.5px solid rgba(138, 206, 224, 0.3)"},children:"انصراف"}),u.jsx(se.button,{whileTap:{scale:o?.95:1},onClick:C,disabled:!o||y,className:"flex-1 py-3 rounded-full font-bold",style:{background:o&&!y?"linear-gradient(135deg, rgba(255, 193, 7, 0.95) 0%, rgba(255, 152, 0, 0.95) 100%)":"linear-gradient(135deg, rgba(96, 147, 157, 0.3) 0%, rgba(76, 127, 137, 0.3) 100%)",boxShadow:o&&!y?"0 4px 16px rgba(255, 193, 7, 0.5)":"0 2px 8px rgba(0, 0, 0, 0.2)",border:o&&!y?"1.5px solid rgba(255, 200, 50, 0.5)":"1.5px solid rgba(138, 206, 224, 0.2)",color:o&&!y?"#5A3800":"#FFFFFF50",textShadow:o&&!y?"0 1px 0 rgba(255, 255, 255, 0.2)":"none",cursor:o&&!y?"pointer":"not-allowed",opacity:o&&!y?1:.6},children:y?"در حال آپلود...":"تایید"})]})]})})})}function pC(e){return{"تخته سیاه":"1",نیمکت:"2","دفترچه یادداشت":"3","دیوار حیاط":"4",آبخوری:"5","زنگ ورزش":"6","سه ماه تعطیلی":"7","روزنامه دیواری":"8","زنگ تفریح":"9"}[e]||"1"}const mC=e=>e==="انجام شده"?{icon:u.jsx(Yd,{className:"w-4 h-4"}),text:"انجام شده",gradient:"linear-gradient(135deg, rgba(34, 197, 94, 0.9) 0%, rgba(22, 163, 74, 0.9) 100%)",border:"rgba(34, 197, 94, 0.5)",shadow:"0 2px 8px rgba(34, 197, 94, 0.4)"}:e==="تایید شده"?{icon:u.jsx(Yd,{className:"w-4 h-4"}),text:"تایید شده",gradient:"linear-gradient(135deg, rgba(59, 130, 246, 0.9) 0%, rgba(37, 99, 235, 0.9) 100%)",border:"rgba(59, 130, 246, 0.5)",shadow:"0 2px 8px rgba(59, 130, 246, 0.4)"}:e==="در حال انجام"?{icon:u.jsx(qi,{className:"w-4 h-4"}),text:"در حال انجام",gradient:"linear-gradient(135deg, rgba(255, 193, 7, 0.9) 0%, rgba(255, 160, 0, 0.9) 100%)",border:"rgba(255, 193, 7, 0.5)",shadow:"0 2px 8px rgba(255, 193, 7, 0.4)"}:e==="رد شده"?{icon:u.jsx(yx,{className:"w-4 h-4"}),text:"رد شده",gradient:"linear-gradient(135deg, rgba(239, 68, 68, 0.9) 0%, rgba(220, 38, 38, 0.9) 100%)",border:"rgba(239, 68, 68, 0.5)",shadow:"0 2px 8px rgba(239, 68, 68, 0.4)"}:{icon:u.jsx(R6,{className:"w-4 h-4"}),text:e,gradient:"linear-gradient(135deg, rgba(156, 163, 175, 0.9) 0%, rgba(107, 114, 128, 0.9) 100%)",border:"rgba(156, 163, 175, 0.5)",shadow:"0 2px 8px rgba(156, 163, 175, 0.4)"};function gC(){const e=mn();gr("پروفایل");const{refreshProfile:n}=mr(),[a,s]=v.useState(null),[o,l]=v.useState(null),[d,f]=v.useState(!1),[m,g]=v.useState(!0),[y,h]=v.useState("challenges"),[b,k]=v.useState(!1),[C,N]=v.useState([]),[j,M]=v.useState([]),[P,F]=v.useState([]),[U,W]=v.useState(!1);v.useEffect(()=>{const I=aw();s(I),J()},[]);const J=async()=>{g(!0);try{const I=hr();I&&l(I);const $=await ec();$&&l($)}catch{}finally{g(!1)}A()},A=async()=>{W(!0);try{const I=await B8();I&&(N(I.challenges),M(I.coin_transaction),F(I.posts))}catch(I){console.error("خطا در بارگذاری داده‌های پروفایل:",I)}finally{W(!1)}},w=async()=>{f(!0);try{await iw(),e("/login",{state:{error:"شما با موفقیت از سیستم خارج شدید"}})}catch(I){console.error("خطا در خروج:",I),e("/login",{state:{error:"شما با موفقیت از سیستم خارج شدید"}})}finally{f(!1)}},R=I=>{if(I==null)return"۰";const $="۰۱۲۳۴۵۶۷۸۹";return String(I).replace(/\d/g,ee=>$[parseInt(ee)])},E=async I=>{if(console.log("handleAvatarSelect called with:",I),o){l({...o,image:I});try{const $=o.username,ee={WorkflowID:o.user_workflowID,user:{username:$,name:o.name,family:o.family,education_level:o.education_level,base:o.base,image:I}};console.log("Saving profile with data:",JSON.stringify(ee));const G=await Nx(ee);console.log("Save profile result:",G),console.log("Reloading profile from server..."),await n(),console.log("Profile reloaded successfully")}catch($){console.error("Error saving avatar:",$),alert("خطا در ذخیره تصویر پروفایل")}}else console.error("No userProfile available")},Y=I=>{F($=>$.filter(ee=>ee.workflow_ID!==I))},K={backgroundImage:`
linear-gradient(180deg, #2E1B3D 0%, #23183E 100%),
linear-gradient(120deg, #7c3aed 0%, #f97316 58%, #facc15 100%)
`,backgroundOrigin:"border-box",backgroundClip:"padding-box, border-box",boxShadow:"0 -7px 20px rgba(7, 0, 18, 0.5), 0 6px 14px rgba(5, 2, 12, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 2px 5px rgba(255, 222, 255, 0.09), inset 0 -2px 0 rgba(12, 7, 27, 0.72), inset 0 -8px 14px rgba(8, 4, 18, 0.34), inset 0 0 0 1px rgba(255, 255, 255, 0.045), inset 0 0 0 2px rgba(17, 10, 35, 0.32)",backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)"};return u.jsxs("div",{className:"pt-6 pb-2",dir:"rtl",children:[u.jsxs(se.div,{initial:{opacity:0,y:15},animate:{opacity:1,y:0},className:"flex flex-col items-center mb-4",children:[u.jsxs("div",{className:"relative mb-3",children:[u.jsx(se.div,{initial:{scale:0},animate:{scale:1},transition:{type:"spring",duration:.5},className:"w-24 h-24 rounded-full p-[2px]",style:K,children:u.jsx("div",{className:"w-full h-full rounded-full overflow-hidden flex items-center justify-center",style:K,children:o!=null&&o.image?u.jsx(ya,{src:Ul(o.image,o.user_stage_id),alt:"پروفایل",className:"w-full h-full rounded-full object-cover",fallbackSrc:qn,style:{filter:"drop-shadow(0 3px 6px rgba(138, 206, 224, 0.6))"}}):u.jsx("img",{src:qn,alt:"پروفایل",className:"w-[84px] h-[84px] object-cover rounded-full"})})}),u.jsx(se.button,{whileTap:{scale:.9},whileHover:{scale:1.1},onClick:()=>k(!0),className:"absolute bottom-0 right-0 w-8 h-8 rounded-full flex items-center justify-center",style:{background:"linear-gradient(135deg, rgba(255, 193, 7, 0.95) 0%, rgba(255, 152, 0, 0.95) 100%)",boxShadow:"0 3px 10px rgba(255, 193, 7, 0.6), 0 0 16px rgba(255, 193, 7, 0.4)",border:"2px solid rgba(255, 255, 255, 0.9)"},children:u.jsx(px,{className:"w-3.5 h-3.5",style:{color:"#5A3800"}})})]}),u.jsx("h2",{className:"text-white text-lg font-bold mb-0.5",style:{textShadow:"0 3px 8px rgba(138, 206, 224, 0.6), 0 2px 4px rgba(0, 0, 0, 0.8)"},children:m?"در حال بارگذاری...":o?`${o.name} ${o.family}`:a?`${a.Name} ${a.Family}`:"کاربر گرامی"}),o&&u.jsxs("div",{style:{color:"rgba(138, 206, 224, 0.8)"},className:"text-[10px] mb-3",children:[o.education_level," - پایه ",o.base]}),u.jsx("div",{className:"flex gap-2.5 mb-3",children:[{label:"چالش‌ها",value:R(C.filter(I=>I.status==="انجام شده").length)},{label:"سکه‌ها",value:R(o==null?void 0:o.coin_count)},{label:"پست‌ها",value:R(P.length)}].map((I,$)=>u.jsxs("div",{className:"px-4 py-2 rounded-2xl",style:{background:"linear-gradient(135deg, rgba(32, 76, 106, 0.6) 0%, rgba(20, 40, 60, 0.6) 100%)",border:"1.5px solid rgba(138, 206, 224, 0.3)",boxShadow:"inset 0 1.5px 6px rgba(0, 0, 0, 0.4), 0 3px 8px rgba(0, 0, 0, 0.3)"},children:[u.jsx("div",{className:"text-white font-bold text-sm mb-0.5",children:I.value}),u.jsx("div",{style:{color:"#8ACEE0"},className:"text-[9px]",children:I.label})]},$))}),u.jsxs("div",{className:"flex gap-2 w-full",children:[o!=null&&o.user_workflowID?u.jsxs(se.button,{whileHover:{scale:1.03},whileTap:{scale:.97},onClick:()=>e("/edit-profile"),className:"flex-1 flex items-center justify-center gap-1.5 px-4 py-2 rounded-2xl font-bold text-xs",style:{background:"linear-gradient(135deg, rgba(76, 175, 80, 0.9) 0%, rgba(56, 142, 60, 0.9) 100%)",boxShadow:"0 3px 12px rgba(76, 175, 80, 0.4)",color:"#FFFFFF",textShadow:"0 1px 3px rgba(0, 0, 0, 0.5)"},children:[u.jsx(bg,{size:14}),u.jsx("span",{children:"ویرایش"})]}):m?null:u.jsxs(se.button,{whileHover:{scale:1.03},whileTap:{scale:.97},onClick:()=>e("/edit-profile"),className:"flex-1 flex items-center justify-center gap-1.5 px-4 py-2 rounded-2xl font-bold text-xs",style:{background:"linear-gradient(135deg, rgba(255, 193, 7, 0.9) 0%, rgba(255, 160, 0, 0.9) 100%)",boxShadow:"0 3px 12px rgba(255, 193, 7, 0.4)",color:"#FFFFFF",textShadow:"0 1px 3px rgba(0, 0, 0, 0.5)"},children:[u.jsx(bg,{size:14}),u.jsx("span",{children:"تکمیل پروفایل"})]}),u.jsxs(se.button,{whileHover:{scale:d?1:1.03},whileTap:{scale:d?1:.97},onClick:w,disabled:d,className:"flex-1 flex items-center justify-center gap-1.5 px-4 py-2 rounded-2xl font-bold text-xs",style:{background:d?"linear-gradient(135deg, rgba(120, 30, 40, 0.7) 0%, rgba(96, 24, 32, 0.7) 100%)":"linear-gradient(135deg, rgba(220, 53, 69, 0.9) 0%, rgba(176, 42, 55, 0.9) 100%)",boxShadow:"0 3px 12px rgba(220, 53, 69, 0.4)",color:"#FFFFFF",textShadow:"0 1px 3px rgba(0, 0, 0, 0.5)",opacity:d?.7:1,cursor:d?"not-allowed":"pointer"},children:[u.jsx(Y6,{size:14}),u.jsx("span",{children:d?"خروج...":"خروج"})]})]})]}),u.jsxs("div",{className:"mb-3 flex gap-2",children:[u.jsx(se.button,{whileTap:{scale:.97},onClick:()=>h("challenges"),className:"flex-1 py-2 rounded-2xl font-bold text-[11px] flex items-center justify-center gap-1",style:{background:y==="challenges"?"linear-gradient(135deg, rgba(255, 183, 0, 0.95) 0%, rgba(255, 140, 0, 0.95) 100%)":"linear-gradient(135deg, rgba(50, 107, 118, 0.6) 0%, rgba(32, 76, 106, 0.6) 100%)",boxShadow:y==="challenges"?"0 3px 12px rgba(255, 165, 0, 0.5)":"0 2px 6px rgba(0, 0, 0, 0.3)",border:y==="challenges"?"1.5px solid rgba(255, 200, 50, 0.5)":"1.5px solid rgba(138, 206, 224, 0.3)",color:y==="challenges"?"#5A3800":"#FFFFFF",textShadow:y==="challenges"?"0 1px 0 rgba(255, 255, 255, 0.2)":"none"},children:"سابقه چالش‌ها"}),u.jsx(se.button,{whileTap:{scale:.97},onClick:()=>h("coins"),className:"flex-1 py-2 rounded-2xl font-bold text-[11px] flex items-center justify-center gap-1",style:{background:y==="coins"?"linear-gradient(135deg, rgba(255, 183, 0, 0.95) 0%, rgba(255, 140, 0, 0.95) 100%)":"linear-gradient(135deg, rgba(50, 107, 118, 0.6) 0%, rgba(32, 76, 106, 0.6) 100%)",boxShadow:y==="coins"?"0 3px 12px rgba(255, 165, 0, 0.5)":"0 2px 6px rgba(0, 0, 0, 0.3)",border:y==="coins"?"1.5px solid rgba(255, 200, 50, 0.5)":"1.5px solid rgba(138, 206, 224, 0.3)",color:y==="coins"?"#5A3800":"#FFFFFF",textShadow:y==="coins"?"0 1px 0 rgba(255, 255, 255, 0.2)":"none"},children:"سابقه سکه‌ها"}),u.jsx(se.button,{whileTap:{scale:.97},onClick:()=>h("posts"),className:"flex-1 py-2 rounded-2xl font-bold text-[11px] flex items-center justify-center gap-1",style:{background:y==="posts"?"linear-gradient(135deg, rgba(255, 183, 0, 0.95) 0%, rgba(255, 140, 0, 0.95) 100%)":"linear-gradient(135deg, rgba(50, 107, 118, 0.6) 0%, rgba(32, 76, 106, 0.6) 100%)",boxShadow:y==="posts"?"0 3px 12px rgba(255, 165, 0, 0.5)":"0 2px 6px rgba(0, 0, 0, 0.3)",border:y==="posts"?"1.5px solid rgba(255, 200, 50, 0.5)":"1.5px solid rgba(138, 206, 224, 0.3)",color:y==="posts"?"#5A3800":"#FFFFFF",textShadow:y==="posts"?"0 1px 0 rgba(255, 255, 255, 0.2)":"none"},children:"پست‌ها"})]}),y==="challenges"&&u.jsx("div",{className:"space-y-3",children:U?u.jsx("div",{className:"text-center text-white/60 py-8",children:"در حال بارگذاری..."}):C.length===0?u.jsx("div",{className:"text-center text-white/60 py-8",children:"هنوز چالشی ثبت نشده است"}):C.map((I,$)=>{const ee=mC(I.status),G=parseInt(I.coin_count||"0"),z=I.status==="در حال انجام";return u.jsxs(se.div,{initial:{opacity:0,x:-30},animate:{opacity:1,x:0},transition:{delay:$*.08,duration:.3},onClick:()=>{if(z&&I.mission_id){const D=pC(I.mission_type);e(`/chatbot/${D}?missionId=${I.mission_id}&missionType=${encodeURIComponent(I.mission_type)}&continueMode=true`)}},className:`rounded-2xl p-4 ${z?"cursor-pointer":""}`,style:{background:z?"linear-gradient(135deg, rgba(255, 193, 7, 0.15) 0%, rgba(255, 152, 0, 0.15) 100%)":"linear-gradient(135deg, rgba(32, 76, 106, 0.5) 0%, rgba(20, 40, 60, 0.5) 100%)",border:z?"1.5px solid rgba(255, 193, 7, 0.4)":"1.5px solid rgba(138, 206, 224, 0.3)",boxShadow:z?"0 4px 16px rgba(255, 193, 7, 0.3)":"0 4px 12px rgba(0, 0, 0, 0.3)"},whileHover:z?{scale:1.02,y:-2}:{},whileTap:z?{scale:.98}:{},children:[u.jsxs("div",{className:"flex items-start justify-between mb-2",children:[u.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[u.jsx("h3",{className:`font-bold text-sm ${z?"text-yellow-300":"text-white"}`,children:I.mission_title}),z&&u.jsx(se.div,{animate:{x:[0,4,0]},transition:{repeat:1/0,duration:1.5},children:u.jsx(qi,{className:"w-3.5 h-3.5 text-yellow-300"})})]}),u.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1 rounded-full text-white text-[10px] font-bold",style:{background:ee.gradient,border:`1px solid ${ee.border}`,boxShadow:ee.shadow},children:[ee.icon,u.jsx("span",{children:ee.text})]})]}),u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:"text-white/60 text-xs",children:I.datetime1}),z&&u.jsx("span",{className:"text-white/50 text-[10px] px-2 py-0.5 rounded-full",style:{background:"rgba(138, 206, 224, 0.2)",border:"1px solid rgba(138, 206, 224, 0.3)"},children:I.mission_type})]}),u.jsxs("div",{className:"flex items-center gap-3",children:[(I.status==="انجام شده"||I.status==="تایید شده")&&G>0&&u.jsxs("div",{className:"flex items-center gap-1.5",children:[u.jsx("img",{src:Tl,alt:"سکه",className:"w-4 h-4"}),u.jsxs("span",{className:"text-yellow-400 font-bold text-xs",children:["+",R(G)]})]}),z?u.jsx("span",{className:"text-yellow-300 text-[10px] font-bold",children:"برای ادامه کلیک کنید ←"}):u.jsx("span",{className:"text-white/50 text-[10px]",children:I.mission_type})]})]})]},I.mission_done_id)})}),y==="coins"&&u.jsxs("div",{className:"space-y-3",children:[u.jsx(se.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},className:"rounded-2xl p-4 mb-4",style:{background:"linear-gradient(135deg, rgba(255, 193, 7, 0.2) 0%, rgba(255, 152, 0, 0.2) 100%)",border:"2px solid rgba(255, 193, 7, 0.4)",boxShadow:"0 4px 16px rgba(255, 193, 7, 0.3)"},children:u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{children:[u.jsx("p",{className:"text-white/70 text-xs mb-1",children:"مجموع سکه‌های دریافتی"}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("img",{src:Tl,alt:"سکه",className:"w-8 h-8"}),u.jsx("span",{className:"text-yellow-300 font-bold text-2xl",children:R(o==null?void 0:o.coin_count)})]})]}),u.jsx(I8,{className:"w-8 h-8 text-yellow-300"})]})}),U?u.jsx("div",{className:"text-center text-white/60 py-8",children:"در حال بارگذاری..."}):j.length===0?u.jsx("div",{className:"text-center text-white/60 py-8",children:"هنوز تراکنشی ثبت نشده است"}):j.map((I,$)=>{const ee=parseInt(I.coin_count||"0"),G=ee<0,z=Math.abs(ee);return u.jsx(se.div,{initial:{opacity:0,x:-30},animate:{opacity:1,x:0},transition:{delay:$*.08,duration:.3},className:"rounded-2xl p-4",style:{background:G?"linear-gradient(135deg, rgba(76, 29, 29, 0.5) 0%, rgba(60, 20, 20, 0.5) 100%)":"linear-gradient(135deg, rgba(32, 76, 106, 0.5) 0%, rgba(20, 40, 60, 0.5) 100%)",border:G?"1.5px solid rgba(239, 68, 68, 0.4)":"1.5px solid rgba(138, 206, 224, 0.3)",boxShadow:G?"0 4px 12px rgba(239, 68, 68, 0.2)":"0 4px 12px rgba(0, 0, 0, 0.3)"},children:u.jsxs("div",{className:"flex items-start justify-between mb-2",children:[u.jsx("h3",{className:"text-white font-bold text-sm flex-1",children:I.description}),u.jsxs("div",{className:"flex items-center gap-1.5",children:[u.jsx("img",{src:Tl,alt:"سکه",className:"w-5 h-5",style:{filter:G?"grayscale(100%) brightness(0.8)":"none"}}),u.jsxs("span",{className:"font-bold text-sm",style:{color:G?"#ef4444":"#fcd34d"},children:[G?"-":"+",R(z)]})]})]})},`${I.StageID}-${$}`)})]}),y==="posts"&&u.jsx("div",{className:"space-y-4",children:U?u.jsx("div",{className:"text-center text-white/60 py-8",children:"در حال بارگذاری..."}):P.length===0?u.jsx("div",{className:"text-center text-white/60 py-8",children:"هنوز پستی منتشر نشده است"}):P.map((I,$)=>{let ee="image",G,z;return I.film?(ee="video",G=Mx(I.StageID),z=I.image?Ms(I.StageID):""):I.audio?(ee="audio",G=Ix(I.StageID),z=I.image?Ms(I.StageID):""):(ee="image",z=I.image?Ms(I.StageID):""),u.jsxs("div",{children:[u.jsxs(se.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},transition:{delay:$*.05},className:"mb-3 flex items-center gap-3",dir:"rtl",children:[u.jsx("div",{className:"h-[1px] flex-1",style:{background:"rgba(138, 206, 224, 0.3)"}}),u.jsx("span",{className:"text-xs text-white/60 px-2",children:I.mission_type}),u.jsx("div",{className:"h-[1px] flex-1",style:{background:"rgba(138, 206, 224, 0.3)"}})]}),u.jsx(Bx,{id:I.workflow_ID,authorName:I.full_name,authorUsername:I.user_id,authorAvatar:Ps(I.person_stage_id),image:z,title:I.title,caption:I.description,likes:I.like_count||0,dislikes:I.dislike_count||0,comments:I.comment_count||0,timestamp:"",topicName:I.mission_type,mediaType:ee,mediaUrl:G,isOwnPost:!0,workflowID:I.workflow_ID,missionType:I.mission_type,initialLikeState:I.like_state||"",onDelete:Y})]},I.workflow_ID)})}),u.jsx(hC,{isOpen:b,onClose:()=>k(!1),onSelectAvatar:E,currentAvatar:o!=null&&o.image?Ul(o.image,o.user_stage_id):void 0})]})}function yC(){const e=mn(),n=Ut();gr("ویرایش پروفایل");const{refreshProfile:a}=mr(),[s,o]=v.useState(!0),[l,d]=v.useState(!1),[f,m]=v.useState(null),[g,y]=v.useState(""),[h,b]=v.useState({name:"",family:"",education_level:"",base:""}),[k,C]=v.useState({});v.useEffect(()=>{var F;N(),(F=n.state)!=null&&F.message&&(y(n.state.message),window.history.replaceState({},document.title),setTimeout(()=>{y("")},5e3))},[n]);const N=async()=>{o(!0);try{const F=hr();F&&(m(F),b({name:F.name||"",family:F.family||"",education_level:F.education_level||"",base:F.base||""}));const U=await ec();U&&(m(U),b({name:U.name||"",family:U.family||"",education_level:U.education_level||"",base:U.base||""}))}catch{console.warn("عدم دسترسی به سرور - از داده‌های کش استفاده می‌شود")}finally{o(!1)}},j=()=>{const F={};return h.name.trim()||(F.name="نام الزامی است"),h.family.trim()||(F.family="نام خانوادگی الزامی است"),h.education_level||(F.education_level="مقطع تحصیلی الزامی است"),h.base||(F.base="پایه تحصیلی الزامی است"),C(F),Object.keys(F).length===0},M=async F=>{if(F.preventDefault(),!!j()){d(!0);try{const U=sw();if(!U)throw new Error("نام کاربری یافت نشد");const W={username:U,name:h.name,family:h.family,education_level:h.education_level,base:h.base},J=f!=null&&f.user_workflowID?{WorkflowID:f.user_workflowID,user:W}:{user:W};console.log("Saving profile data:",JSON.stringify(J)),await Nx(J)?(await a(),e("/profile")):alert("خطا در ذخیره اطلاعات")}catch(U){console.error("خطا در ذخیره:",U),alert("خطا در ذخیره اطلاعات")}finally{d(!1)}}},P=(F,U)=>{b(W=>({...W,[F]:U})),k[F]&&C(W=>{const J={...W};return delete J[F],J})};return s?u.jsx("div",{className:"min-h-screen flex items-center justify-center",style:{background:"radial-gradient(120% 120% at 50% 0%, rgba(124, 58, 237, 0.32) 0%, rgba(46, 27, 61, 0.98) 52%, rgba(35, 24, 62, 1) 100%)"},children:u.jsxs(se.div,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},className:"text-center",children:[u.jsx(se.div,{className:"w-16 h-16 border-4 rounded-full mx-auto mb-4",style:{borderColor:"rgba(255, 214, 240, 0.28)",borderTopColor:"#ff79cf"},animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"}}),u.jsx("p",{className:"text-lg font-bold",style:{color:"#ffd6f0",textShadow:"0 2px 4px rgba(0, 0, 0, 0.6)"},dir:"rtl",children:"در حال بارگذاری پروفایل..."})]})}):u.jsxs("div",{className:"max-w-2xl mx-auto px-6 py-8",dir:"rtl",children:[u.jsxs("div",{className:"flex items-center gap-4 mb-8",children:[u.jsx(se.button,{whileHover:{scale:1.1},whileTap:{scale:.9},onClick:()=>e("/profile"),className:"w-10 h-10 rounded-full flex items-center justify-center",style:{background:"linear-gradient(135deg, rgba(32, 76, 106, 0.6) 0%, rgba(20, 40, 60, 0.6) 100%)",border:"2px solid rgba(138, 206, 224, 0.3)"},children:u.jsx(d6,{className:"text-white",size:20})}),u.jsx("h1",{className:"text-2xl font-bold text-white",style:{textShadow:"0 4px 12px rgba(138, 206, 224, 0.6), 0 2px 4px rgba(0, 0, 0, 0.8)"},children:f!=null&&f.user_workflowID?"ویرایش پروفایل":"تکمیل پروفایل"})]}),g&&u.jsx(se.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},className:"mb-6 p-4 rounded-xl text-center font-bold",style:{background:"linear-gradient(135deg, rgba(76, 175, 80, 0.2) 0%, rgba(56, 142, 60, 0.2) 100%)",border:"2px solid rgba(76, 175, 80, 0.4)",color:"#A7F3D0",textShadow:"0 2px 4px rgba(0, 0, 0, 0.6)"},children:g}),u.jsxs("form",{onSubmit:M,className:"space-y-6",children:[u.jsxs("div",{children:[u.jsx("label",{className:"block text-white mb-2 text-sm font-bold",children:"نام"}),u.jsx("input",{type:"text",value:h.name,onChange:F=>P("name",F.target.value),className:"w-full px-4 py-3 rounded-xl text-white font-bold",style:{background:"linear-gradient(135deg, rgba(32, 76, 106, 0.4) 0%, rgba(20, 40, 60, 0.4) 100%)",border:k.name?"2px solid rgba(220, 53, 69, 0.6)":"2px solid rgba(138, 206, 224, 0.3)",outline:"none"},placeholder:"نام خود را وارد کنید"}),k.name&&u.jsx("p",{className:"text-red-400 text-xs mt-1",children:k.name})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-white mb-2 text-sm font-bold",children:"نام خانوادگی"}),u.jsx("input",{type:"text",value:h.family,onChange:F=>P("family",F.target.value),className:"w-full px-4 py-3 rounded-xl text-white font-bold",style:{background:"linear-gradient(135deg, rgba(32, 76, 106, 0.4) 0%, rgba(20, 40, 60, 0.4) 100%)",border:k.family?"2px solid rgba(220, 53, 69, 0.6)":"2px solid rgba(138, 206, 224, 0.3)",outline:"none"},placeholder:"نام خانوادگی خود را وارد کنید"}),k.family&&u.jsx("p",{className:"text-red-400 text-xs mt-1",children:k.family})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-white mb-2 text-sm font-bold",children:"مقطع تحصیلی"}),u.jsxs("select",{value:h.education_level,onChange:F=>P("education_level",F.target.value),className:"w-full px-4 py-3 rounded-xl text-white font-bold",style:{background:"linear-gradient(135deg, rgba(32, 76, 106, 0.4) 0%, rgba(20, 40, 60, 0.4) 100%)",border:k.education_level?"2px solid rgba(220, 53, 69, 0.6)":"2px solid rgba(138, 206, 224, 0.3)",outline:"none"},children:[u.jsx("option",{value:"",children:"انتخاب کنید"}),u.jsx("option",{value:"ابتدایی",children:"ابتدایی"}),u.jsx("option",{value:"متوسطه اول",children:"متوسطه اول"}),u.jsx("option",{value:"متوسطه دوم",children:"متوسطه دوم"})]}),k.education_level&&u.jsx("p",{className:"text-red-400 text-xs mt-1",children:k.education_level})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-white mb-2 text-sm font-bold",children:"پایه تحصیلی"}),u.jsxs("select",{value:h.base,onChange:F=>P("base",F.target.value),className:"w-full px-4 py-3 rounded-xl text-white font-bold",style:{background:"linear-gradient(135deg, rgba(32, 76, 106, 0.4) 0%, rgba(20, 40, 60, 0.4) 100%)",border:k.base?"2px solid rgba(220, 53, 69, 0.6)":"2px solid rgba(138, 206, 224, 0.3)",outline:"none"},children:[u.jsx("option",{value:"",children:"انتخاب کنید"}),h.education_level==="ابتدایی"&&u.jsxs(u.Fragment,{children:[u.jsx("option",{value:"اول",children:"اول"}),u.jsx("option",{value:"دوم",children:"دوم"}),u.jsx("option",{value:"سوم",children:"سوم"}),u.jsx("option",{value:"چهارم",children:"چهارم"}),u.jsx("option",{value:"پنجم",children:"پنجم"}),u.jsx("option",{value:"ششم",children:"ششم"})]}),h.education_level==="متوسطه اول"&&u.jsxs(u.Fragment,{children:[u.jsx("option",{value:"هفتم",children:"هفتم"}),u.jsx("option",{value:"هشتم",children:"هشتم"}),u.jsx("option",{value:"نهم",children:"نهم"})]}),h.education_level==="متوسطه دوم"&&u.jsxs(u.Fragment,{children:[u.jsx("option",{value:"دهم",children:"دهم"}),u.jsx("option",{value:"یازدهم",children:"یازدهم"}),u.jsx("option",{value:"دوازدهم",children:"دوازدهم"})]})]}),k.base&&u.jsx("p",{className:"text-red-400 text-xs mt-1",children:k.base})]}),u.jsxs(se.button,{type:"submit",disabled:l,whileHover:{scale:l?1:1.02},whileTap:{scale:l?1:.98},className:"w-full flex items-center justify-center gap-3 px-8 py-4 rounded-2xl font-bold text-lg",style:{background:l?"linear-gradient(135deg, rgba(60, 140, 150, 0.7) 0%, rgba(40, 100, 110, 0.7) 100%)":"linear-gradient(135deg, rgba(76, 175, 80, 0.9) 0%, rgba(56, 142, 60, 0.9) 100%)",boxShadow:"0 12px 32px rgba(76, 175, 80, 0.4), 0 4px 12px rgba(0, 0, 0, 0.4)",color:"#FFFFFF",textShadow:"0 2px 4px rgba(0, 0, 0, 0.5)",opacity:l?.7:1,cursor:l?"not-allowed":"pointer"},children:[u.jsx(x8,{size:24}),u.jsx("span",{children:l?"در حال ذخیره...":"ذخیره اطلاعات"})]})]})]})}const dd="/assets/0469c3ac6223dede16e9f8943a3cac9943835707-RJiYkdb5.png",xC=[{id:"1",name:"نشان ستاره طلایی",price:150,isOwned:!1},{id:"2",name:"آواتار جادوگر",price:250,isOwned:!1},{id:"3",name:"قاب طلایی",price:100,isOwned:!1},{id:"4",name:"پس‌زمینه کهکشانی",price:200,isOwned:!1},{id:"5",name:"نشان شیر",price:80,isOwned:!1},{id:"6",name:"افکت درخشش",price:300,isOwned:!1,isLocked:!0},{id:"7",name:"تاج طلایی",price:180,isOwned:!1},{id:"8",name:"جام قهرمانی",price:220,isOwned:!1}],hl=[{id:"p1",name:"نشان ستاره طلایی",isOwned:!0},{id:"p2",name:"قاب طلایی",isOwned:!0}];function vC(){gr("کیف جادویی");const[e,n]=v.useState("shop"),[a,s]=v.useState([]),[o,l]=v.useState(!1),[d,f]=v.useState(null),m=1e3;return v.useEffect(()=>{e==="owned"&&a.length===0&&(async()=>{l(!0);const y=await mj();y.success?s(y.data):console.error("Error loading magic bag missions:",y.message),l(!1)})()},[e,a.length]),u.jsxs("div",{className:"pt-6 pb-2",dir:"rtl",children:[u.jsxs("div",{className:"mb-4 flex gap-2",children:[u.jsxs(se.button,{whileTap:{scale:.97},onClick:()=>n("shop"),className:"flex-1 py-2.5 rounded-2xl font-bold text-sm flex items-center justify-center gap-1.5",style:{background:e==="shop"?"linear-gradient(135deg, rgba(255, 183, 0, 0.95) 0%, rgba(255, 140, 0, 0.95) 100%)":"linear-gradient(135deg, rgba(50, 107, 118, 0.6) 0%, rgba(32, 76, 106, 0.6) 100%)",boxShadow:e==="shop"?"0 6px 18px rgba(255, 165, 0, 0.5)":"0 3px 10px rgba(0, 0, 0, 0.3)",border:e==="shop"?"1.5px solid rgba(255, 200, 50, 0.5)":"1.5px solid rgba(138, 206, 224, 0.3)",color:e==="shop"?"#5A3800":"#FFFFFF",textShadow:e==="shop"?"0 1px 0 rgba(255, 255, 255, 0.2)":"none"},children:[u.jsx(S8,{className:"w-4 h-4"}),"فروشگاه"]}),u.jsxs(se.button,{whileTap:{scale:.97},onClick:()=>n("owned"),className:"flex-1 py-2.5 rounded-2xl font-bold text-sm flex items-center justify-center gap-1.5",style:{background:e==="owned"?"linear-gradient(135deg, rgba(255, 183, 0, 0.95) 0%, rgba(255, 140, 0, 0.95) 100%)":"linear-gradient(135deg, rgba(50, 107, 118, 0.6) 0%, rgba(32, 76, 106, 0.6) 100%)",boxShadow:e==="owned"?"0 6px 18px rgba(255, 165, 0, 0.5)":"0 3px 10px rgba(0, 0, 0, 0.3)",border:e==="owned"?"1.5px solid rgba(255, 200, 50, 0.5)":"1.5px solid rgba(138, 206, 224, 0.3)",color:e==="owned"?"#5A3800":"#FFFFFF",textShadow:e==="owned"?"0 1px 0 rgba(255, 255, 255, 0.2)":"none"},children:[u.jsx(vg,{className:"w-4 h-4"}),"ایتم‌های من"]})]}),e==="shop"&&u.jsx("div",{className:"grid grid-cols-4 gap-4",children:xC.map((g,y)=>{const h=!g.isLocked&&g.price&&m>=g.price;return u.jsxs(se.button,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{delay:y*.05,duration:.3},whileHover:{scale:g.isLocked?1:1.1,y:-4},whileTap:{scale:g.isLocked?1:.9},disabled:g.isLocked,className:"flex flex-col items-center gap-1.5",children:[u.jsxs("div",{className:"relative w-full",children:[u.jsx("img",{src:dd,alt:g.name,className:"w-full h-auto object-contain",style:{filter:g.isLocked?"grayscale(100%) brightness(0.4)":"drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3))"}}),g.isLocked&&u.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:u.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center",style:{background:"linear-gradient(135deg, rgba(220, 38, 38, 0.95) 0%, rgba(185, 28, 28, 0.95) 100%)",boxShadow:"0 4px 12px rgba(220, 38, 38, 0.8)"},children:u.jsx(W6,{className:"w-4 h-4 text-white"})})}),!g.isLocked&&g.price&&u.jsxs("div",{className:"absolute top-0 left-0 flex items-center gap-1 px-2 py-1 rounded-full",style:{background:h?"linear-gradient(135deg, rgba(255, 193, 7, 0.95) 0%, rgba(255, 152, 0, 0.95) 100%)":"linear-gradient(135deg, rgba(107, 114, 128, 0.95) 0%, rgba(75, 85, 99, 0.95) 100%)",border:`1.5px solid ${h?"rgba(255, 200, 50, 0.8)":"rgba(107, 114, 128, 0.8)"}`,boxShadow:h?"0 2px 8px rgba(255, 193, 7, 0.6)":"0 2px 8px rgba(0, 0, 0, 0.4)"},children:[u.jsx("img",{src:Tl,alt:"سکه",className:"w-3.5 h-3.5"}),u.jsx("span",{className:"text-[10px] font-bold",style:{color:h?"#5A3800":"rgba(255, 255, 255, 0.7)",textShadow:h?"0 1px 0 rgba(255, 255, 255, 0.3)":"none"},children:g.price})]})]}),u.jsx("p",{className:"text-white text-[11px] font-bold text-center leading-tight line-clamp-2 w-full",style:{textShadow:"0 1px 2px rgba(0, 0, 0, 0.5)"},children:g.name})]},g.id)})}),e==="owned"&&u.jsx("div",{children:a.length===0&&hl.length===0?u.jsxs("div",{className:"flex flex-col items-center justify-center py-16",children:[u.jsx("div",{className:"w-24 h-24 rounded-full flex items-center justify-center mb-4",style:{background:"linear-gradient(135deg, rgba(138, 206, 224, 0.2) 0%, rgba(76, 127, 137, 0.2) 100%)",border:"3px solid rgba(138, 206, 224, 0.3)"},children:u.jsx(vg,{className:"w-12 h-12 text-white/50"})}),u.jsx("h3",{className:"text-white text-lg font-bold mb-2",children:"هنوز ایتمی ندارید"}),u.jsx("p",{className:"text-white/60 text-sm text-center",children:"با انجام چالش‌ها و خرید از فروشگاه، ایتم‌های جذاب جمع کنید!"}),u.jsx(se.button,{whileTap:{scale:.95},onClick:()=>n("shop"),className:"mt-6 px-6 py-3 rounded-full font-bold",style:{background:"linear-gradient(135deg, rgba(255, 183, 0, 0.95) 0%, rgba(255, 140, 0, 0.95) 100%)",boxShadow:"0 8px 24px rgba(255, 165, 0, 0.5)",color:"#5A3800"},children:"رفتن به فروشگاه"})]}):u.jsxs(u.Fragment,{children:[a.length>0&&u.jsxs(u.Fragment,{children:[u.jsx("h3",{className:"text-white text-sm font-bold mb-3",style:{textShadow:"0 2px 4px rgba(0, 0, 0, 0.5)"},children:"🏆 از ماموریت‌ها"}),o?u.jsx("div",{className:"grid grid-cols-4 gap-4 mb-6",children:[1,2,3,4].map(g=>u.jsxs("div",{className:"flex flex-col items-center gap-1.5",children:[u.jsx("div",{className:"w-full aspect-square rounded-lg animate-pulse",style:{background:"linear-gradient(135deg, rgba(138, 206, 224, 0.2) 0%, rgba(76, 127, 137, 0.2) 100%)"}}),u.jsx("div",{className:"w-full h-4 rounded animate-pulse",style:{background:"linear-gradient(135deg, rgba(138, 206, 224, 0.2) 0%, rgba(76, 127, 137, 0.2) 100%)"}})]},g))}):u.jsx("div",{className:"grid grid-cols-4 gap-4 mb-6",children:a.map((g,y)=>{const h=gj(g.magic_bag_file),b=()=>{if(h)f({url:cd(g.StageID),title:g.magic_bag_title});else{const k=document.createElement("a");k.href=cd(g.StageID),k.download=g.magic_bag_file||g.magic_bag_title,k.click()}};return u.jsxs(se.div,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{delay:y*.05,duration:.3},className:"flex flex-col items-center gap-1.5",children:[u.jsxs(se.button,{onClick:b,whileHover:{scale:1.1,y:-4},whileTap:{scale:.9},className:"relative w-full",children:[u.jsx("img",{src:cd(g.StageID),alt:g.magic_bag_title,className:"w-full h-auto object-contain",style:{filter:"drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3))"},onError:k=>{k.currentTarget.src=dd}}),!h&&u.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/30 rounded-lg",children:u.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center",style:{background:"linear-gradient(135deg, rgba(255, 183, 0, 0.95) 0%, rgba(255, 140, 0, 0.95) 100%)",boxShadow:"0 4px 12px rgba(255, 165, 0, 0.8)"},children:u.jsx(xg,{className:"w-5 h-5 text-white"})})})]}),u.jsx("p",{className:"text-white text-[11px] font-bold text-center leading-tight line-clamp-2 w-full",style:{textShadow:"0 1px 2px rgba(0, 0, 0, 0.5)"},children:g.magic_bag_title})]},g.StageID)})})]}),a.length>0&&hl.length>0&&u.jsx("div",{className:"mb-6 flex items-center gap-3",children:u.jsx("div",{className:"flex-1 h-[1px]",style:{background:"linear-gradient(90deg, transparent 0%, rgba(138, 206, 224, 0.3) 50%, transparent 100%)"}})}),hl.length>0&&u.jsxs(u.Fragment,{children:[u.jsx("h3",{className:"text-white text-sm font-bold mb-3",style:{textShadow:"0 2px 4px rgba(0, 0, 0, 0.5)"},children:"🛒 خریداری شده"}),u.jsx("div",{className:"grid grid-cols-4 gap-4",children:hl.map((g,y)=>u.jsxs(se.button,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{delay:(a.length+y)*.05,duration:.3},whileHover:{scale:1.1,y:-4},whileTap:{scale:.9},className:"flex flex-col items-center gap-1.5",children:[u.jsx("div",{className:"relative w-full",children:u.jsx("img",{src:dd,alt:g.name,className:"w-full h-auto object-contain",style:{filter:"drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3))"}})}),u.jsx("p",{className:"text-white text-[11px] font-bold text-center leading-tight line-clamp-2 w-full",style:{textShadow:"0 1px 2px rgba(0, 0, 0, 0.5)"},children:g.name})]},g.id))})]})]})}),u.jsx(pn,{children:d&&u.jsx(se.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>f(null),className:"fixed inset-0 z-50 flex items-center justify-center bg-black/90 px-4",style:{backdropFilter:"blur(8px)"},children:u.jsxs(se.div,{initial:{scale:.8,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.8,opacity:0},onClick:g=>g.stopPropagation(),className:"relative max-w-4xl w-full",children:[u.jsx(se.button,{whileTap:{scale:.9},onClick:()=>f(null),className:"absolute -top-12 left-0 w-10 h-10 rounded-full flex items-center justify-center z-10",style:{background:"linear-gradient(135deg, rgba(220, 38, 38, 0.95) 0%, rgba(185, 28, 28, 0.95) 100%)",boxShadow:"0 4px 12px rgba(220, 38, 38, 0.8)"},children:u.jsx(Ds,{className:"w-6 h-6 text-white"})}),u.jsx(se.button,{whileTap:{scale:.9},onClick:()=>{const g=document.createElement("a");g.href=d.url,g.download=d.title,g.click()},className:"absolute -top-12 right-0 w-10 h-10 rounded-full flex items-center justify-center z-10",style:{background:"linear-gradient(135deg, rgba(255, 183, 0, 0.95) 0%, rgba(255, 140, 0, 0.95) 100%)",boxShadow:"0 4px 12px rgba(255, 165, 0, 0.8)"},children:u.jsx(xg,{className:"w-6 h-6 text-white"})}),u.jsx("div",{className:"rounded-2xl overflow-hidden",style:{boxShadow:"0 25px 50px rgba(0, 0, 0, 0.5)",border:"2px solid rgba(138, 206, 224, 0.3)"},children:u.jsx("img",{src:d.url,alt:d.title,className:"w-full h-auto max-h-[80vh] object-contain bg-black/50"})}),u.jsx("div",{className:"mt-4 text-center",children:u.jsx("p",{className:"text-white text-lg font-bold",style:{textShadow:"0 2px 4px rgba(0, 0, 0, 0.8)"},children:d.title})})]})})})]})}function Hf({topicTitle:e,subtitle:n,onBack:a}){return u.jsx("div",{className:"flex-shrink-0 w-full",children:u.jsx(nc,{showBack:!0,onBack:a,centerTitle:e,centerSubtitle:n})})}const bC=e=>{switch(e){case"موفقیت":return{icon:u.jsx(Yd,{className:"w-6 h-6"}),gradient:"linear-gradient(135deg, rgba(34, 197, 94, 0.9) 0%, rgba(22, 163, 74, 0.9) 100%)",border:"rgba(34, 197, 94, 0.5)",shadow:"0 4px 16px rgba(34, 197, 94, 0.3)"};case"خبر":return{icon:u.jsx(V6,{className:"w-6 h-6"}),gradient:"linear-gradient(135deg, rgba(59, 130, 246, 0.9) 0%, rgba(37, 99, 235, 0.9) 100%)",border:"rgba(59, 130, 246, 0.5)",shadow:"0 4px 16px rgba(59, 130, 246, 0.3)"};case"اخطار":return{icon:u.jsx(k6,{className:"w-6 h-6"}),gradient:"linear-gradient(135deg, rgba(239, 68, 68, 0.9) 0%, rgba(220, 38, 38, 0.9) 100%)",border:"rgba(239, 68, 68, 0.5)",shadow:"0 4px 16px rgba(239, 68, 68, 0.3)"};case"پیشنهاد":return{icon:u.jsx(xx,{className:"w-6 h-6"}),gradient:"linear-gradient(135deg, rgba(168, 85, 247, 0.9) 0%, rgba(147, 51, 234, 0.9) 100%)",border:"rgba(168, 85, 247, 0.5)",shadow:"0 4px 16px rgba(168, 85, 247, 0.3)"};case"عادی":default:return{icon:u.jsx(A6,{className:"w-6 h-6"}),gradient:"linear-gradient(135deg, rgba(107, 114, 128, 0.9) 0%, rgba(75, 85, 99, 0.9) 100%)",border:"rgba(107, 114, 128, 0.5)",shadow:"0 4px 16px rgba(107, 114, 128, 0.3)"}}};function wC(){const e=mn();gr("پیام‌ها");const{messages:n,loading:a,markMessagesAsRead:s}=Qi(),o=v.useRef(!1),l=v.useCallback(()=>{e("/")},[e]);return v.useEffect(()=>{if(!a&&n.length>0&&!o.current){const d=n.filter(f=>f.status==="خوانده نشده").map(f=>String(f.stageID));d.length>0&&(o.current=!0,s(d))}},[a,n,s]),u.jsxs("div",{className:"min-h-screen w-full relative overflow-hidden",children:[u.jsx(ba,{position:"fixed",zIndex:0,imageUrl:vn.messages}),u.jsxs("div",{className:"relative z-10 max-w-md mx-auto",children:[u.jsx(Hf,{topicTitle:"پیام‌ها",onBack:l}),u.jsxs("div",{className:"fixed top-0 left-0 right-0 bottom-0 max-w-md mx-auto overflow-hidden",style:{paddingTop:"110px",zIndex:1},children:[u.jsx("div",{className:"h-full overflow-y-auto relative px-[20px] pt-[48px] pb-[128px]",style:{scrollbarWidth:"none",msOverflowStyle:"none",maskImage:"linear-gradient(to bottom, transparent 0%, black 60px)",WebkitMaskImage:"linear-gradient(to bottom, transparent 0%, black 60px)"},children:a?u.jsx("div",{className:"flex items-center justify-center h-full",children:u.jsxs("div",{className:"text-white text-center",children:[u.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-white mx-auto mb-4"}),u.jsx("p",{children:"در حال بارگذاری پیام‌ها..."})]})}):n.length===0?u.jsx("div",{className:"flex items-center justify-center h-full",children:u.jsx("div",{className:"text-white text-center",children:u.jsx("p",{className:"text-lg",children:"پیامی وجود ندارد"})})}):u.jsx("div",{className:"space-y-4",dir:"rtl",children:n.map((d,f)=>{const m=bC(d.kind),g=d.status==="خوانده نشده";return u.jsx(se.div,{initial:{opacity:0,x:-50},animate:{opacity:1,x:0},transition:{delay:f*.1,duration:.4},className:"relative",children:u.jsxs("div",{className:"rounded-3xl p-5 backdrop-blur-sm",style:{background:m.gradient,border:`1.5px solid ${m.border}`,boxShadow:m.shadow,opacity:g?1:.85},children:[g&&u.jsx("div",{className:"absolute top-3 left-3 w-3 h-3 rounded-full",style:{background:"linear-gradient(135deg, #FF4444 0%, #CC0000 100%)",boxShadow:"0 0 8px rgba(255, 68, 68, 0.8)"}}),u.jsxs("div",{className:"flex items-start gap-4",children:[u.jsx("div",{className:"flex-shrink-0 w-12 h-12 rounded-full flex items-center justify-center text-white",style:{background:m.gradient,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.3)"},children:m.icon}),u.jsxs("div",{className:"flex-1",children:[u.jsx("h3",{className:"text-white font-bold text-base mb-2",children:d.title}),u.jsx("p",{className:"text-white/80 text-sm leading-relaxed",children:d.Message})]})]})]})},`${d.user_id}-${f}`)})})}),u.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-16 pointer-events-none",style:{background:"linear-gradient(180deg, transparent 0%, rgba(46, 27, 61, 0.82) 50%, rgba(35, 24, 62, 1) 100%)"}})]})]}),u.jsx("style",{children:`
/* Hide scrollbar for Chrome, Safari and Opera */
.h-full.overflow-y-auto::-webkit-scrollbar {
display: none;
}
`}),u.jsx(Zi,{})]})}function kC(e){var n=[];if(e.length===0)return"";if(typeof e[0]!="string")throw new TypeError("Url must be a string. Received "+e[0]);if(e[0].match(/^[^/:]+:\/*$/)&&e.length>1){var a=e.shift();e[0]=a+e[0]}e[0].match(/^file:\/\/\//)?e[0]=e[0].replace(/^([^/:]+):\/*/,"$1:///"):e[0]=e[0].replace(/^([^/:]+):\/*/,"$1://");for(var s=0;s<e.length;s++){var o=e[s];if(typeof o!="string")throw new TypeError("Url must be a string. Received "+o);o!==""&&(s>0&&(o=o.replace(/^[\/]+/,"")),s<e.length-1?o=o.replace(/[\/]+$/,""):o=o.replace(/[\/]+$/,"/"),n.push(o))}var l=n.join("/");l=l.replace(/\/(\?|&|#[^!])/g,"$1");var d=l.split("?");return l=d.shift()+(d.length>0?"?":"")+d.join("&"),l}function zx(){var e;return typeof arguments[0]=="object"?e=arguments[0]:e=[].slice.call(arguments),kC(e)}function SC(e){return EC(e)||NC(e)||CC(e)||jC()}function jC(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function CC(e,n){if(e){if(typeof e=="string")return Gd(e,n);var a=Object.prototype.toString.call(e).slice(8,-1);if(a==="Object"&&e.constructor&&(a=e.constructor.name),a==="Map"||a==="Set")return Array.from(e);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return Gd(e,n)}}function NC(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function EC(e){if(Array.isArray(e))return Gd(e)}function Gd(e,n){(n==null||n>e.length)&&(n=e.length);for(var a=0,s=new Array(n);a<n;a++)s[a]=e[a];return s}function js(e){return SC(e).map(function(n){var a;return n==null||(a=n.codePointAt(0))===null||a===void 0?void 0:a.toString(16)}).join("-")}function TC(e){var n=js(e).split("-")[0];return n<"1f469"?"@lobehub/fluent-emoji-anim-1":n>="1f469"&&n<"1f620"?"@lobehub/fluent-emoji-anim-2":n>="1f620"&&n<"1f9a0"?"@lobehub/fluent-emoji-anim-3":"@lobehub/fluent-emoji-anim-4"}var PC=function(n,a){var s=["anim","3d"].includes(a)?"webp":"svg";switch(a){case"anim":return{path:"assets/".concat(js(n),".").concat(s),pkg:TC(n)};case"3d":return{path:"assets/".concat(js(n),".").concat(s),pkg:"@lobehub/fluent-emoji-3d"};case"flat":return{path:"assets/".concat(js(n),".").concat(s),pkg:"@lobehub/fluent-emoji-flat"};case"modern":return{path:"assets/".concat(js(n),".").concat(s),pkg:"@lobehub/fluent-emoji-modern"};case"mono":return{path:"assets/".concat(js(n),".").concat(s),pkg:"@lobehub/fluent-emoji-mono"}}},RC=function(n){var a=n.pkg,s=n.path;return zx("https://registry.npmmirror.com",a,"latest/files",s)},MC=function(n){var a=n.pkg,s=n.path;return zx("https://unpkg.com","".concat(a,"@latest"),s)},IC=function(n,a){var s=a||{},o=s.type,l=o===void 0?"3d":o,d=s.cdn,f=d===void 0?"aliyun":d,m=PC(n,l);return f==="unpkg"?MC(m):RC(m)};const pl=new RegExp("(\\p{Extended_Pictographic}(?:\\uFE0F|\\uFE0E)?(?:\\u200D\\p{Extended_Pictographic}(?:\\uFE0F|\\uFE0E)?)*)","gu");function _C({emoji:e}){const[n,a]=v.useState(!1);return n?u.jsx("span",{className:"mx-0.5 inline-block translate-y-[1px] text-[0.95em] leading-none",children:e}):u.jsx("img",{src:IC(e,{cdn:"unpkg",type:"3d"}),alt:e,loading:"lazy",onError:()=>a(!0),className:"mx-0.5 inline-block h-[1.45em] w-[1.45em] translate-y-[0.32em] object-contain",draggable:!1})}function FC(e){return e.split(pl).map((a,s)=>a?pl.test(a)?(pl.lastIndex=0,u.jsx(_C,{emoji:a},`${a}-${s}`)):(pl.lastIndex=0,a):null)}function $l({text:e}){return u.jsx(u.Fragment,{children:FC(e)})}function DC({text:e,speed:n=30,onTyping:a}){const[s,o]=v.useState(""),[l,d]=v.useState(0);return v.useEffect(()=>{if(l<e.length){const f=setTimeout(()=>{o(m=>m+e[l]),d(m=>m+1),a&&a()},n);return()=>clearTimeout(f)}},[l,e,n,a]),v.useEffect(()=>{o(""),d(0)},[e]),u.jsxs("p",{className:"text-white text-sm break-words whitespace-pre-wrap",children:[u.jsx($l,{text:s}),l<e.length&&u.jsx("span",{className:"inline-block w-1 h-4 bg-white/70 ml-0.5 animate-pulse"})]})}const rc="/assets/chatbot-bot-avatar-Bbf-v3Pj.png",LC=["۰","۱","۲","۳","۴","۵","۶","۷","۸","۹"],wa=e=>e.replace(/\d/g,n=>LC[Number(n)]),Tg={user:{background:"linear-gradient(145deg, rgba(218, 94, 142, 0.96) 0%, rgba(162, 56, 110, 0.95) 100%)",boxShadow:"0 0 24px rgba(240,110,168,0.28), 0 12px 28px rgba(84, 22, 60, 0.38), inset 0 1px 0 rgba(255,255,255,0.16)",border:"1px solid rgba(255, 178, 214, 0.58)",backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)"},other:{background:"linear-gradient(145deg, rgba(52, 34, 76, 0.94) 0%, rgba(35, 24, 62, 0.94) 100%)",backgroundImage:"linear-gradient(145deg, rgba(52, 34, 76, 0.94) 0%, rgba(35, 24, 62, 0.94) 100%), linear-gradient(120deg, #7c3aed 0%, #f97316 58%, #facc15 100%)",backgroundOrigin:"border-box",backgroundClip:"padding-box, border-box",boxShadow:"0 0 24px rgba(152,104,235,0.24), 0 12px 28px rgba(12, 8, 30, 0.4), inset 0 1px 0 rgba(255,255,255,0.12)",border:"0.5px solid transparent",backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)"}};function AC({messages:e,containerRef:n,endRef:a,onTyping:s}){return u.jsx("div",{ref:n,className:"flex-1 overflow-y-auto px-4 pb-20",dir:"rtl",children:u.jsxs("div",{className:"space-y-3",children:[e.map(o=>{const l=o.type==="user",d=o.type==="loading";return u.jsxs(se.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${l?"justify-start":"justify-end"} items-start gap-2`,children:[u.jsxs("div",{className:"relative max-w-[75%] rounded-[18px] px-4 py-3",style:l?Tg.user:Tg.other,children:[o.author&&u.jsx("p",{className:"text-xs font-bold mb-1",style:{color:"#8ACEE0"},children:o.author}),d?u.jsxs("div",{className:"flex items-center gap-1",children:[u.jsx(se.span,{className:"w-2 h-2 rounded-full bg-white",animate:{opacity:[.3,1,.3]},transition:{duration:1.5,repeat:1/0,delay:0}}),u.jsx(se.span,{className:"w-2 h-2 rounded-full bg-white",animate:{opacity:[.3,1,.3]},transition:{duration:1.5,repeat:1/0,delay:.2}}),u.jsx(se.span,{className:"w-2 h-2 rounded-full bg-white",animate:{opacity:[.3,1,.3]},transition:{duration:1.5,repeat:1/0,delay:.4}})]}):o.type==="other"&&o.isTyping?u.jsx(DC,{text:o.content,speed:30,onTyping:s}):u.jsx("p",{className:"text-white text-sm break-words whitespace-pre-wrap",children:u.jsx($l,{text:o.content})}),u.jsx("p",{className:"text-white/60 text-xs mt-1 text-left",children:wa(o.timestamp)})]}),!l&&u.jsx("div",{className:"-mr-1 mt-1 flex h-11 w-11 flex-shrink-0 items-center justify-center rounded-full",style:{background:"radial-gradient(circle, rgba(255,104,205,0.18) 0%, transparent 68%)",filter:"drop-shadow(0 0 8px rgba(255, 104, 205, 0.55)) drop-shadow(0 0 16px rgba(255, 104, 205, 0.28))"},children:u.jsx("img",{src:rc,alt:"چت‌بات",className:"h-10 w-10 object-contain"})})]},o.id)}),u.jsx("div",{ref:a})]})})}function Vx({onSendMessage:e,disabled:n=!1}){const[a,s]=v.useState(""),o=v.useRef(null),l=a.trim().length>0&&!n,d=()=>{l&&(e(a.trim()),s(""),setTimeout(()=>{o.current&&(o.current.style.height="auto",o.current.focus())},0))},f=m=>{m.key!=="Enter"||m.shiftKey||m.ctrlKey||m.metaKey||m.altKey||(m.preventDefault(),d())};return v.useEffect(()=>{if(o.current){o.current.style.height="auto";const m=o.current.scrollHeight,g=96;o.current.style.height=`${Math.min(m,g)}px`}},[a]),u.jsxs("div",{className:"px-3",children:[u.jsxs("div",{className:"flex min-h-[62px] items-center gap-2 rounded-[32px] p-2",style:{backgroundImage:"linear-gradient(180deg, #2E1B3D 0%, #23183E 100%), linear-gradient(120deg, #7c3aed 0%, #f97316 58%, #facc15 100%)",backgroundOrigin:"border-box",backgroundClip:"padding-box, border-box",border:"0.5px solid transparent",boxShadow:"0 -7px 20px rgba(7, 0, 18, 0.5), 0 6px 14px rgba(5, 2, 12, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 2px 5px rgba(255, 222, 255, 0.09), inset 0 -2px 0 rgba(12, 7, 27, 0.72), inset 0 -8px 14px rgba(8, 4, 18, 0.34), inset 0 0 0 1px rgba(255, 255, 255, 0.045), inset 0 0 0 2px rgba(17, 10, 35, 0.32)",backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)"},children:[u.jsx("textarea",{ref:o,value:a,onChange:m=>s(m.target.value),onKeyDown:f,placeholder:"پیام خود را بنویسید...",rows:1,dir:"rtl",disabled:n,"aria-label":"پیام خود را بنویسید",className:"chat-input-textarea flex-1 bg-transparent text-white placeholder:text-[rgba(207,168,212,0.7)] resize-none outline-none text-right disabled:opacity-50",style:{fontFamily:"Alibaba, sans-serif",textAlign:"right",minHeight:"36px",maxHeight:"96px",lineHeight:"1.4",overflow:"hidden",fontSize:"16px"}}),u.jsx(se.button,{type:"button",whileTap:{scale:.92},onClick:d,disabled:!l,"aria-label":"ارسال پیام",className:"flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full",style:{background:l?"linear-gradient(145deg, #F06EA8 0%, #C9579C 52%, #8A4FCF 100%)":"linear-gradient(145deg, rgba(72, 58, 105, 0.72) 0%, rgba(42, 35, 77, 0.76) 100%)",boxShadow:l?"0 0 18px rgba(240, 110, 168, 0.42), inset 0 1px 0 rgba(255,255,255,0.22)":"inset 0 1px 0 rgba(255,255,255,0.12), 0 0 12px rgba(203,117,171,0.12)",border:l?"1px solid rgba(255, 189, 228, 0.5)":"1px solid rgba(198, 111, 177, 0.22)"},children:u.jsx(wx,{className:`h-5 w-5 ${l?"text-white":"text-[#CFA8D4]/70"}`})})]}),u.jsx("style",{children:`
.chat-input-textarea {
scrollbar-width: none;
-ms-overflow-style: none;
}
.chat-input-textarea::-webkit-scrollbar {
display: none;
}
`})]})}const Ci={overlay:{backgroundColor:"rgba(0, 0, 0, 0.8)"},container:{background:"linear-gradient(180deg, rgba(32, 76, 106, 0.98) 0%, rgba(20, 40, 60, 0.98) 100%)",border:"2px solid rgba(138, 206, 224, 0.3)",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",maxHeight:"85vh"},chatItem:{background:"linear-gradient(135deg, rgba(50, 107, 118, 0.6) 0%, rgba(32, 76, 106, 0.6) 100%)",border:"1.5px solid rgba(138, 206, 224, 0.3)",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.3)"},iconContainer:{background:"linear-gradient(135deg, rgba(138, 206, 224, 0.3) 0%, rgba(76, 127, 137, 0.3) 100%)"},closeButton:{background:"linear-gradient(135deg, rgba(96, 147, 157, 0.6) 0%, rgba(76, 127, 137, 0.6) 100%)",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.3)",border:"1.5px solid rgba(138, 206, 224, 0.3)"}};function OC({isOpen:e,onClose:n,historyItems:a,onSelectChat:s}){return v.useEffect(()=>{const o=l=>{l.key==="Escape"&&n()};if(e)return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[e,n]),u.jsx(pn,{children:e&&u.jsx(se.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[100] flex items-center justify-center p-4",style:Ci.overlay,onClick:n,children:u.jsxs(se.div,{initial:{scale:.9,y:20},animate:{scale:1,y:0},exit:{scale:.9,y:20},onClick:o=>o.stopPropagation(),className:"w-full max-w-md rounded-3xl overflow-hidden",style:Ci.container,children:[u.jsx("div",{className:"px-6 py-4 border-b",style:{borderColor:"rgba(138, 206, 224, 0.2)"},children:u.jsx("h3",{className:"text-lg font-bold text-center text-white",style:{textShadow:"0 2px 4px rgba(0, 0, 0, 0.3)"},children:"تاریخچه گفتگوها"})}),u.jsx("div",{className:"overflow-y-auto p-6",style:{maxHeight:"calc(85vh - 120px)"},children:u.jsx("div",{className:"space-y-3",children:a.map((o,l)=>u.jsx(se.button,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:l*.1},whileTap:{scale:.95},onClick:()=>{n(),s(o.id)},className:"w-full p-4 rounded-2xl text-right",style:Ci.chatItem,children:u.jsxs("div",{className:"flex items-start gap-3",children:[u.jsx("div",{className:"flex-shrink-0 w-10 h-10 rounded-full flex items-center justify-center",style:Ci.iconContainer,children:u.jsx(bx,{className:"w-5 h-5",style:{color:"#8ACEE0"}})}),u.jsxs("div",{className:"flex-1",children:[u.jsx("h4",{className:"text-white font-bold text-sm mb-1",children:o.title}),u.jsx("p",{className:"text-white/60 text-xs mb-1",children:o.lastMessage}),u.jsx("p",{className:"text-white/40 text-xs",children:o.date})]})]})},o.id))})}),u.jsx("div",{className:"px-6 py-4 border-t",style:{borderColor:"rgba(138, 206, 224, 0.2)"},children:u.jsx(se.button,{whileTap:{scale:.95},onClick:n,className:"w-full py-3 rounded-full font-bold text-white",style:Ci.closeButton,children:"بستن"})})]})})})}const Wf=()=>{const e=localStorage.getItem("accessToken");return e||localStorage.getItem("authToken")},BC=async()=>{console.log("loadChatList: Function called");const e=Wf();if(console.log("loadChatList: Token:",e?e.substring(0,20)+"...":"null"),!e)return console.error("loadChatList: No token found"),{success:!1,data:[],message:"توکن احراز هویت یافت نشد"};try{console.log("loadChatList: Sending request to:",`${nt}/api/call`);const n=await fetch(`${nt}/api/call`,{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8",Authorization:`Bearer ${e}`},body:JSON.stringify({chat_list_load_function:{}})});console.log("loadChatList: Response status:",n.status);const a=await n.json();if(console.log("loadChatList: Response data:",JSON.stringify(a)),a.state===0){console.log("loadChatList: Parsing result.data");const s=JSON.parse(a.data);console.log("loadChatList: Parsed data:",s);const o=JSON.parse(s.chat_list);return console.log("loadChatList: Chat list:",o),{success:!0,data:o}}else return console.error("loadChatList: API returned error state:",a.state,a.message),{success:!1,data:[],message:a.message}}catch(n){return console.error("loadChatList: Exception caught:",n),{success:!1,data:[],message:"خطا در بارگذاری لیست چت‌ها"}}},zC=async e=>{const n=Wf();if(!n)return{success:!1,data:[],message:"توکن احراز هویت یافت نشد"};try{const s=await(await fetch(`${nt}/api/call`,{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8",Authorization:`Bearer ${n}`},body:JSON.stringify({chat_load_function:{chatlist_workflowID:e}})})).json();if(s.state===0){const o=JSON.parse(s.data);return{success:!0,data:JSON.parse(o.chats)}}else return{success:!1,data:[],message:s.message}}catch(a){return console.error("Error loading chat:",a),{success:!1,data:[],message:"خطا در بارگذاری چت"}}},VC=async(e,n="")=>{const a=Wf();if(!a)return{success:!1,message:"توکن احراز هویت یافت نشد"};try{const o=await(await fetch(`${nt}/api/call`,{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8",Authorization:`Bearer ${a}`},body:JSON.stringify({public_caht_function:{chatlist_workflowID:n,question:e}})})).json();if(o.state===0){const l=JSON.parse(o.data),d=JSON.parse(l.message);return{success:!0,answer:d.answer,newChatlistWorkflowID:d.chatlist_workflowID2}}else return{success:!1,message:o.message}}catch(s){return console.error("Error sending public chat message:",s),{success:!1,message:"خطا در ارسال پیام"}}};function UC(){gr("چت عمومی");const[e,n]=v.useState([]),[a,s]=v.useState(!1),[o,l]=v.useState([]),[d,f]=v.useState(""),[m,g]=v.useState(!1),[y,h]=v.useState(!1),[b,k]=v.useState(!0),C=v.useRef(null),N=v.useRef(null),j=()=>{const J=C.current;return J?J.scrollHeight-J.scrollTop-J.clientHeight<100:!0},M=(J=!0)=>{var A;(A=N.current)==null||A.scrollIntoView({behavior:J?"smooth":"auto",block:"end"})};v.useEffect(()=>{b&&M()},[e,b]),v.useEffect(()=>{const J=C.current;if(!J)return;const A=()=>{k(j())};return J.addEventListener("scroll",A,{passive:!0}),()=>J.removeEventListener("scroll",A)},[]);const P=J=>{const A=[];return J.forEach(w=>{w.question&&A.push({id:crypto.randomUUID(),type:"user",content:w.question,timestamp:wa(w.datetime1)}),w.answer&&A.push({id:crypto.randomUUID(),type:"other",content:w.answer,author:"ربات",timestamp:wa(w.datetime1)})}),A},F=async J=>{s(!1),g(!0),f(J);const A=await zC(J);if(A.success){const w=P(A.data);n(w),requestAnimationFrame(()=>{requestAnimationFrame(()=>{M(!1)})})}else console.error("Failed to load chat:",A.message),alert("خطا در بارگذاری چت");g(!1)},U=async J=>{const A=J.trim();if(!A||y)return;const w={id:crypto.randomUUID(),type:"user",content:A,timestamp:new Date().toLocaleTimeString("fa-IR",{hour:"2-digit",minute:"2-digit"})},R=crypto.randomUUID(),E={id:R,type:"loading",content:"",author:"ربات",timestamp:""};k(!0),n(Y=>[...Y,w,E]),h(!0);try{const Y=await VC(A,d);if(n(K=>K.filter(I=>I.id!==R)),Y.success&&Y.answer){Y.newChatlistWorkflowID&&f(Y.newChatlistWorkflowID);const K={id:crypto.randomUUID(),type:"other",content:Y.answer,author:"ربات",timestamp:new Date().toLocaleTimeString("fa-IR",{hour:"2-digit",minute:"2-digit"}),isTyping:!0};n(I=>[...I,K])}else alert(Y.message||"خطا در ارسال پیام")}catch{n(K=>K.filter(I=>I.id!==R)),alert("خطا در ارسال پیام")}finally{h(!1)}},W=v.useCallback(async()=>{s(!0);const J=await BC();J.success?l(J.data):(console.error("Failed to load chat list:",J.message),alert(J.message||"خطا در بارگذاری تاریخچه"))},[]);return v.useEffect(()=>{const J=()=>{W()};return window.addEventListener("public-chat:history",J),()=>window.removeEventListener("public-chat:history",J)},[W]),u.jsxs("div",{className:"relative h-full min-h-0 overflow-hidden",children:[u.jsxs("div",{className:"grid h-full min-h-0 grid-rows-[minmax(0,1fr)_auto]",children:[u.jsx("main",{className:"relative min-h-0 overflow-hidden",children:m?u.jsx("div",{className:"flex h-full items-center justify-center px-5",children:u.jsx("p",{className:"text-sm text-white",children:"در حال بارگذاری..."})}):e.length===0?u.jsx("div",{className:"flex h-full items-center justify-center px-5",children:u.jsx("div",{className:"max-w-sm rounded-[22px] border-[0.5px] border-transparent px-5 py-4 text-center",style:{backgroundImage:"linear-gradient(180deg, rgba(46, 27, 61, 0.92) 0%, rgba(35, 24, 62, 0.94) 100%), linear-gradient(120deg, #7c3aed 0%, #f97316 58%, #facc15 100%)",backgroundOrigin:"border-box",backgroundClip:"padding-box, border-box",boxShadow:"0 -7px 20px rgba(7, 0, 18, 0.46), 0 6px 14px rgba(5, 2, 12, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.16), inset 0 -2px 0 rgba(12, 7, 27, 0.66)",backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)"},children:u.jsxs("div",{className:"text-center",children:[u.jsx("div",{className:"mx-auto mb-2 flex h-14 w-14 items-center justify-center rounded-full border border-[#F0A6D8]/45",style:{background:"radial-gradient(circle at 50% 36%, rgba(255, 187, 232, 0.38) 0%, rgba(134, 74, 164, 0.28) 48%, rgba(26, 18, 54, 0.7) 100%)",boxShadow:"0 0 14px rgba(255,104,205,0.48), 0 0 28px rgba(255,104,205,0.22), inset 0 1px 0 rgba(255,255,255,0.22)"},children:u.jsx("img",{src:rc,alt:"چت‌بات",className:"h-11 w-11 object-contain"})}),u.jsx("p",{className:"mb-1.5 text-base font-bold text-[#FBE7F5]",children:"با ربات همدست چت کن!"}),u.jsx("p",{className:"text-xs text-[#EED3EC]/90",children:"سوالاتت رو بپرس و جواب بگیر"})]})})}):u.jsx("div",{className:"h-full min-h-0",children:u.jsx(AC,{messages:e,containerRef:C,endRef:N,onTyping:()=>{b&&M(!1)}})})}),u.jsx("footer",{className:"shrink-0",style:{paddingBottom:"calc(env(safe-area-inset-bottom, 0px) + 12px)"},children:u.jsx("div",{className:"px-3 pt-2",children:u.jsx(Vx,{onSendMessage:U,disabled:y})})})]}),u.jsx(OC,{isOpen:a,onClose:()=>s(!1),historyItems:o.map(J=>({id:J.chatlist_workflowID,title:J.title||"چت عمومی",date:wa(J.datetime1),lastMessage:""})),onSelectChat:F})]})}const $C=e=>{const[n,a]=v.useState([]),[s,o]=v.useState(!0),[l,d]=v.useState(!1),[f,m]=v.useState(null),[g,y]=v.useState(1),[h,b]=v.useState(!0),k=v.useRef(!1),C=v.useRef(null),N=v.useCallback(async(P,F)=>{if(!e||!e.hasFeed){o(!1);return}if(!k.current){k.current=!0,F?o(!0):d(!0),m(null);try{const U=await aj(e.serverName,P);if(C.current!==e.serverName)return;if(U.success){const W=U.data;(W.length===0||W.length<25)&&b(!1),a(F?W:J=>{const A=new Set(J.map(R=>R.StageID)),w=W.filter(R=>!A.has(R.StageID));return[...J,...w]})}else m(U.message||"خطا در بارگذاری فید")}catch{C.current===e.serverName&&m("خطا در ارتباط با سرور")}finally{C.current===e.serverName&&(o(!1),d(!1)),k.current=!1}}},[e]);v.useEffect(()=>{if(!e){o(!1);return}return C.current=e.serverName,a([]),y(1),b(!0),m(null),N(1,!0),()=>{C.current=null}},[e,N]);const j=v.useCallback(()=>{if(!h||l||s)return;const P=g+1;y(P),N(P,!1)},[h,l,s,g,N]),M=v.useCallback(P=>{a(F=>F.filter(U=>U.StageID.toString()!==P))},[]);return{feedItems:n,initialLoading:s,loadingMore:l,error:f,hasMore:h,loadMore:j,deletePost:M}},fd=e=>typeof e=="string"&&e.trim().length>0,HC=(e,n)=>{const a=fd(e.image),s=fd(e.film),o=fd(e.audio);let l="image",d,f="";s?(l="video",d=Mx(e.StageID),f=a?Ms(e.StageID):""):o?(l="audio",d=Ix(e.StageID),f=a?Ms(e.StageID):""):a&&(l="image",f=Ms(e.StageID));const m=e.datetimee||e.datetime1||e.create_date||"";return{id:e.StageID.toString(),authorName:e.full_name,authorUsername:e.full_name,authorAvatar:Ps(e.person_stage_id),image:f,title:e.title,caption:e.description,likes:e.like_count,dislikes:e.dislike_count,comments:e.comment_count,timestamp:m,topicName:n,initialComments:[],mediaType:l,mediaUrl:d,isOwnPost:sj(e.user_id),initialLikeState:e.like_state,missionType:n,workflowID:e.workflow_ID||e.StageID.toString(),teamMemberIds:e.team_member}};function WC({posts:e,loadingMore:n,error:a,onScroll:s,onDelete:o}){const l=v.useCallback(f=>Math.min(f*.1,1),[]),d=v.useMemo(()=>e.map((f,m)=>u.jsx(se.div,{initial:{opacity:0,y:30},animate:{opacity:1,y:0},transition:{delay:l(m)},children:u.jsx(Bx,{...f,onDelete:o})},f.id)),[e,o,l]);return u.jsx("div",{className:"feed-scroll flex-1 overflow-y-auto px-4 pb-56",onScroll:s,children:u.jsxs("div",{className:"pt-6",children:[d,n&&u.jsx("div",{className:"flex items-center justify-center mt-4 mb-4",children:u.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-[#ff9be0]"})}),a&&u.jsx("div",{className:"text-red-500 text-center mt-4 mb-4",children:a})]})})}function KC({accentColor:e,onStartMission:n}){return u.jsxs("div",{className:"flex flex-col items-center justify-center px-4 py-16 mt-32",children:[u.jsx("div",{className:"w-24 h-24 rounded-full flex items-center justify-center mb-4",style:{background:"linear-gradient(135deg, rgba(138, 206, 224, 0.15) 0%, rgba(62, 121, 131, 0.15) 100%)",border:"2px solid rgba(138, 206, 224, 0.3)"},children:u.jsx(bx,{className:"w-12 h-12",style:{color:e}})}),u.jsx("h3",{className:"text-white text-lg font-bold mb-2",children:"هنوز پستی وجود ندارد"}),u.jsx("p",{className:"text-gray-400 text-sm text-center mb-6",children:"اولین نفری باش که ماموریتشو به اشتراک میذاره!"}),u.jsx(se.button,{whileTap:{scale:.95},onClick:n,className:"px-6 py-3 rounded-full font-bold text-white",style:{background:"linear-gradient(135deg, #FFB800 0%, #FF9500 100%)",boxShadow:"0 4px 16px rgba(255, 165, 0, 0.4)"},children:"شروع ماموریت جدید"})]})}function YC({onClick:e}){return u.jsx("div",{className:"feed-floating-cta fixed left-0 right-0 z-40 px-4 max-w-md mx-auto pointer-events-none transition-opacity duration-200",style:{bottom:"calc(env(safe-area-inset-bottom, 0px) + 112px)"},children:u.jsxs(se.button,{onClick:e,whileHover:{scale:1.02,y:-2},whileTap:{scale:.98},animate:{y:[0,-4,0]},transition:{y:{duration:2.5,repeat:1/0,ease:"easeInOut"}},className:"pointer-events-auto ml-auto flex items-center gap-2",style:{filter:"drop-shadow(0 8px 18px rgba(12, 5, 24, 0.45))"},children:[u.jsx("span",{className:"rounded-full px-3 py-1.5 text-[11px] font-semibold text-white",style:{background:"linear-gradient(180deg, rgba(88, 52, 126, 0.92) 0%, rgba(48, 31, 85, 0.9) 100%)",border:"1px solid rgba(255, 170, 224, 0.46)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)"},children:"چالش خودت رو شروع کن"}),u.jsx("span",{className:"h-12 w-12 rounded-full flex items-center justify-center",style:{background:"linear-gradient(180deg, #ff79cf 0%, #a855f7 100%)",boxShadow:"inset 0 1px 0 rgba(255,255,255,0.35), 0 10px 20px rgba(31, 9, 51, 0.45)"},"aria-hidden":!0,children:u.jsx(Uf,{size:26,color:"#fff5fb",strokeWidth:2.5})})]})})}function GC(e){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css",n.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e))}const XC=e=>{switch(e){case"success":return QC;case"info":return eN;case"warning":return ZC;case"error":return tN;default:return null}},JC=Array(12).fill(0),qC=({visible:e,className:n})=>ge.createElement("div",{className:["sonner-loading-wrapper",n].filter(Boolean).join(" "),"data-visible":e},ge.createElement("div",{className:"sonner-spinner"},JC.map((a,s)=>ge.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),QC=ge.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ge.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),ZC=ge.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},ge.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),eN=ge.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ge.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),tN=ge.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ge.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),nN=ge.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},ge.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ge.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),rN=()=>{const[e,n]=ge.useState(document.hidden);return ge.useEffect(()=>{const a=()=>{n(document.hidden)};return document.addEventListener("visibilitychange",a),()=>window.removeEventListener("visibilitychange",a)},[]),e};let Xd=1;class aN{constructor(){this.subscribe=n=>(this.subscribers.push(n),()=>{const a=this.subscribers.indexOf(n);this.subscribers.splice(a,1)}),this.publish=n=>{this.subscribers.forEach(a=>a(n))},this.addToast=n=>{this.publish(n),this.toasts=[...this.toasts,n]},this.create=n=>{var a;const{message:s,...o}=n,l=typeof(n==null?void 0:n.id)=="number"||((a=n.id)==null?void 0:a.length)>0?n.id:Xd++,d=this.toasts.find(m=>m.id===l),f=n.dismissible===void 0?!0:n.dismissible;return this.dismissedToasts.has(l)&&this.dismissedToasts.delete(l),d?this.toasts=this.toasts.map(m=>m.id===l?(this.publish({...m,...n,id:l,title:s}),{...m,...n,id:l,dismissible:f,title:s}):m):this.addToast({title:s,...o,dismissible:f,id:l}),l},this.dismiss=n=>(n?(this.dismissedToasts.add(n),requestAnimationFrame(()=>this.subscribers.forEach(a=>a({id:n,dismiss:!0})))):this.toasts.forEach(a=>{this.subscribers.forEach(s=>s({id:a.id,dismiss:!0}))}),n),this.message=(n,a)=>this.create({...a,message:n}),this.error=(n,a)=>this.create({...a,message:n,type:"error"}),this.success=(n,a)=>this.create({...a,type:"success",message:n}),this.info=(n,a)=>this.create({...a,type:"info",message:n}),this.warning=(n,a)=>this.create({...a,type:"warning",message:n}),this.loading=(n,a)=>this.create({...a,type:"loading",message:n}),this.promise=(n,a)=>{if(!a)return;let s;a.loading!==void 0&&(s=this.create({...a,promise:n,type:"loading",message:a.loading,description:typeof a.description!="function"?a.description:void 0}));const o=Promise.resolve(n instanceof Function?n():n);let l=s!==void 0,d;const f=o.then(async g=>{if(d=["resolve",g],ge.isValidElement(g))l=!1,this.create({id:s,type:"default",message:g});else if(iN(g)&&!g.ok){l=!1;const h=typeof a.error=="function"?await a.error(`HTTP error! status: ${g.status}`):a.error,b=typeof a.description=="function"?await a.description(`HTTP error! status: ${g.status}`):a.description,C=typeof h=="object"&&!ge.isValidElement(h)?h:{message:h};this.create({id:s,type:"error",description:b,...C})}else if(g instanceof Error){l=!1;const h=typeof a.error=="function"?await a.error(g):a.error,b=typeof a.description=="function"?await a.description(g):a.description,C=typeof h=="object"&&!ge.isValidElement(h)?h:{message:h};this.create({id:s,type:"error",description:b,...C})}else if(a.success!==void 0){l=!1;const h=typeof a.success=="function"?await a.success(g):a.success,b=typeof a.description=="function"?await a.description(g):a.description,C=typeof h=="object"&&!ge.isValidElement(h)?h:{message:h};this.create({id:s,type:"success",description:b,...C})}}).catch(async g=>{if(d=["reject",g],a.error!==void 0){l=!1;const y=typeof a.error=="function"?await a.error(g):a.error,h=typeof a.description=="function"?await a.description(g):a.description,k=typeof y=="object"&&!ge.isValidElement(y)?y:{message:y};this.create({id:s,type:"error",description:h,...k})}}).finally(()=>{l&&(this.dismiss(s),s=void 0),a.finally==null||a.finally.call(a)}),m=()=>new Promise((g,y)=>f.then(()=>d[0]==="reject"?y(d[1]):g(d[1])).catch(y));return typeof s!="string"&&typeof s!="number"?{unwrap:m}:Object.assign(s,{unwrap:m})},this.custom=(n,a)=>{const s=(a==null?void 0:a.id)||Xd++;return this.create({jsx:n(s),id:s,...a}),s},this.getActiveToasts=()=>this.toasts.filter(n=>!this.dismissedToasts.has(n.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Rn=new aN,sN=(e,n)=>{const a=(n==null?void 0:n.id)||Xd++;return Rn.addToast({title:e,...n,id:a}),a},iN=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",oN=sN,lN=()=>Rn.toasts,cN=()=>Rn.getActiveToasts(),Pl=Object.assign(oN,{success:Rn.success,info:Rn.info,warning:Rn.warning,error:Rn.error,custom:Rn.custom,message:Rn.message,promise:Rn.promise,dismiss:Rn.dismiss,loading:Rn.loading},{getHistory:lN,getToasts:cN});GC("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}[data-sonner-toaster][data-lifted=true]{transform:translateY(-8px)}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function ml(e){return e.label!==void 0}const uN=3,dN="24px",fN="16px",Pg=4e3,hN=356,pN=14,mN=45,gN=200;function Cr(...e){return e.filter(Boolean).join(" ")}function yN(e){const[n,a]=e.split("-"),s=[];return n&&s.push(n),a&&s.push(a),s}const xN=e=>{var n,a,s,o,l,d,f,m,g;const{invert:y,toast:h,unstyled:b,interacting:k,setHeights:C,visibleToasts:N,heights:j,index:M,toasts:P,expanded:F,removeToast:U,defaultRichColors:W,closeButton:J,style:A,cancelButtonStyle:w,actionButtonStyle:R,className:E="",descriptionClassName:Y="",duration:K,position:I,gap:$,expandByDefault:ee,classNames:G,icons:z,closeButtonAriaLabel:D="Close toast"}=e,[X,q]=ge.useState(null),[T,O]=ge.useState(null),[ne,ie]=ge.useState(!1),[oe,ae]=ge.useState(!1),[ue,xe]=ge.useState(!1),[ve,Ve]=ge.useState(!1),[Ce,Ue]=ge.useState(!1),[Oe,dt]=ge.useState(0),[xt,vt]=ge.useState(0),Se=ge.useRef(h.duration||K||Pg),Re=ge.useRef(null),we=ge.useRef(null),me=M===0,Ie=M+1<=N,be=h.type,Ae=h.dismissible!==!1,Qe=h.className||"",Ge=h.descriptionClassName||"",rt=ge.useMemo(()=>j.findIndex(Ye=>Ye.toastId===h.id)||0,[j,h.id]),ht=ge.useMemo(()=>{var Ye;return(Ye=h.closeButton)!=null?Ye:J},[h.closeButton,J]),Qt=ge.useMemo(()=>h.duration||K||Pg,[h.duration,K]),Pt=ge.useRef(0),qe=ge.useRef(0),kn=ge.useRef(0),ft=ge.useRef(null),[Mn,Te]=I.split("-"),Ze=ge.useMemo(()=>j.reduce((Ye,Et,Lt)=>Lt>=rt?Ye:Ye+Et.height,0),[j,rt]),ot=rN(),it=h.invert||y,Zt=be==="loading";qe.current=ge.useMemo(()=>rt*$+Ze,[rt,Ze]),ge.useEffect(()=>{Se.current=Qt},[Qt]),ge.useEffect(()=>{ie(!0)},[]),ge.useEffect(()=>{const Ye=we.current;if(Ye){const Et=Ye.getBoundingClientRect().height;return vt(Et),C(Lt=>[{toastId:h.id,height:Et,position:h.position},...Lt]),()=>C(Lt=>Lt.filter($t=>$t.toastId!==h.id))}},[C,h.id]),ge.useLayoutEffect(()=>{if(!ne)return;const Ye=we.current,Et=Ye.style.height;Ye.style.height="auto";const Lt=Ye.getBoundingClientRect().height;Ye.style.height=Et,vt(Lt),C($t=>$t.find(kt=>kt.toastId===h.id)?$t.map(kt=>kt.toastId===h.id?{...kt,height:Lt}:kt):[{toastId:h.id,height:Lt,position:h.position},...$t])},[ne,h.title,h.description,C,h.id]);const gt=ge.useCallback(()=>{ae(!0),dt(qe.current),C(Ye=>Ye.filter(Et=>Et.toastId!==h.id)),setTimeout(()=>{U(h)},gN)},[h,U,C,qe]);ge.useEffect(()=>{if(h.promise&&be==="loading"||h.duration===1/0||h.type==="loading")return;let Ye;return F||k||ot?(()=>{if(kn.current<Pt.current){const $t=new Date().getTime()-Pt.current;Se.current=Se.current-$t}kn.current=new Date().getTime()})():(()=>{Se.current!==1/0&&(Pt.current=new Date().getTime(),Ye=setTimeout(()=>{h.onAutoClose==null||h.onAutoClose.call(h,h),gt()},Se.current))})(),()=>clearTimeout(Ye)},[F,k,h,be,ot,gt]),ge.useEffect(()=>{h.delete&&gt()},[gt,h.delete]);function yr(){var Ye;if(z!=null&&z.loading){var Et;return ge.createElement("div",{className:Cr(G==null?void 0:G.loader,h==null||(Et=h.classNames)==null?void 0:Et.loader,"sonner-loader"),"data-visible":be==="loading"},z.loading)}return ge.createElement(qC,{className:Cr(G==null?void 0:G.loader,h==null||(Ye=h.classNames)==null?void 0:Ye.loader),visible:be==="loading"})}const an=h.icon||(z==null?void 0:z[be])||XC(be);var Vn,Fr;return ge.createElement("li",{tabIndex:0,ref:we,className:Cr(E,Qe,G==null?void 0:G.toast,h==null||(n=h.classNames)==null?void 0:n.toast,G==null?void 0:G.default,G==null?void 0:G[be],h==null||(a=h.classNames)==null?void 0:a[be]),"data-sonner-toast":"","data-rich-colors":(Vn=h.richColors)!=null?Vn:W,"data-styled":!(h.jsx||h.unstyled||b),"data-mounted":ne,"data-promise":!!h.promise,"data-swiped":Ce,"data-removed":oe,"data-visible":Ie,"data-y-position":Mn,"data-x-position":Te,"data-index":M,"data-front":me,"data-swiping":ue,"data-dismissible":Ae,"data-type":be,"data-invert":it,"data-swipe-out":ve,"data-swipe-direction":T,"data-expanded":!!(F||ee&&ne),style:{"--index":M,"--toasts-before":M,"--z-index":P.length-M,"--offset":`${oe?Oe:qe.current}px`,"--initial-height":ee?"auto":`${xt}px`,...A,...h.style},onDragEnd:()=>{xe(!1),q(null),ft.current=null},onPointerDown:Ye=>{Zt||!Ae||(Re.current=new Date,dt(qe.current),Ye.target.setPointerCapture(Ye.pointerId),Ye.target.tagName!=="BUTTON"&&(xe(!0),ft.current={x:Ye.clientX,y:Ye.clientY}))},onPointerUp:()=>{var Ye,Et,Lt;if(ve||!Ae)return;ft.current=null;const $t=Number(((Ye=we.current)==null?void 0:Ye.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),In=Number(((Et=we.current)==null?void 0:Et.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),kt=new Date().getTime()-((Lt=Re.current)==null?void 0:Lt.getTime()),At=X==="x"?$t:In,xr=Math.abs(At)/kt;if(Math.abs(At)>=mN||xr>.11){dt(qe.current),h.onDismiss==null||h.onDismiss.call(h,h),O(X==="x"?$t>0?"right":"left":In>0?"down":"up"),gt(),Ve(!0);return}else{var Ht,L;(Ht=we.current)==null||Ht.style.setProperty("--swipe-amount-x","0px"),(L=we.current)==null||L.style.setProperty("--swipe-amount-y","0px")}Ue(!1),xe(!1),q(null)},onPointerMove:Ye=>{var Et,Lt,$t;if(!ft.current||!Ae||((Et=window.getSelection())==null?void 0:Et.toString().length)>0)return;const kt=Ye.clientY-ft.current.y,At=Ye.clientX-ft.current.x;var xr;const Ht=(xr=e.swipeDirections)!=null?xr:yN(I);!X&&(Math.abs(At)>1||Math.abs(kt)>1)&&q(Math.abs(At)>Math.abs(kt)?"x":"y");let L={x:0,y:0};const V=Q=>1/(1.5+Math.abs(Q)/20);if(X==="y"){if(Ht.includes("top")||Ht.includes("bottom"))if(Ht.includes("top")&&kt<0||Ht.includes("bottom")&&kt>0)L.y=kt;else{const Q=kt*V(kt);L.y=Math.abs(Q)<Math.abs(kt)?Q:kt}}else if(X==="x"&&(Ht.includes("left")||Ht.includes("right")))if(Ht.includes("left")&&At<0||Ht.includes("right")&&At>0)L.x=At;else{const Q=At*V(At);L.x=Math.abs(Q)<Math.abs(At)?Q:At}(Math.abs(L.x)>0||Math.abs(L.y)>0)&&Ue(!0),(Lt=we.current)==null||Lt.style.setProperty("--swipe-amount-x",`${L.x}px`),($t=we.current)==null||$t.style.setProperty("--swipe-amount-y",`${L.y}px`)}},ht&&!h.jsx&&be!=="loading"?ge.createElement("button",{"aria-label":D,"data-disabled":Zt,"data-close-button":!0,onClick:Zt||!Ae?()=>{}:()=>{gt(),h.onDismiss==null||h.onDismiss.call(h,h)},className:Cr(G==null?void 0:G.closeButton,h==null||(s=h.classNames)==null?void 0:s.closeButton)},(Fr=z==null?void 0:z.close)!=null?Fr:nN):null,(be||h.icon||h.promise)&&h.icon!==null&&((z==null?void 0:z[be])!==null||h.icon)?ge.createElement("div",{"data-icon":"",className:Cr(G==null?void 0:G.icon,h==null||(o=h.classNames)==null?void 0:o.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||yr():null,h.type!=="loading"?an:null):null,ge.createElement("div",{"data-content":"",className:Cr(G==null?void 0:G.content,h==null||(l=h.classNames)==null?void 0:l.content)},ge.createElement("div",{"data-title":"",className:Cr(G==null?void 0:G.title,h==null||(d=h.classNames)==null?void 0:d.title)},h.jsx?h.jsx:typeof h.title=="function"?h.title():h.title),h.description?ge.createElement("div",{"data-description":"",className:Cr(Y,Ge,G==null?void 0:G.description,h==null||(f=h.classNames)==null?void 0:f.description)},typeof h.description=="function"?h.description():h.description):null),ge.isValidElement(h.cancel)?h.cancel:h.cancel&&ml(h.cancel)?ge.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||w,onClick:Ye=>{ml(h.cancel)&&Ae&&(h.cancel.onClick==null||h.cancel.onClick.call(h.cancel,Ye),gt())},className:Cr(G==null?void 0:G.cancelButton,h==null||(m=h.classNames)==null?void 0:m.cancelButton)},h.cancel.label):null,ge.isValidElement(h.action)?h.action:h.action&&ml(h.action)?ge.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||R,onClick:Ye=>{ml(h.action)&&(h.action.onClick==null||h.action.onClick.call(h.action,Ye),!Ye.defaultPrevented&&gt())},className:Cr(G==null?void 0:G.actionButton,h==null||(g=h.classNames)==null?void 0:g.actionButton)},h.action.label):null)};function Rg(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function vN(e,n){const a={};return[e,n].forEach((s,o)=>{const l=o===1,d=l?"--mobile-offset":"--offset",f=l?fN:dN;function m(g){["top","right","bottom","left"].forEach(y=>{a[`${d}-${y}`]=typeof g=="number"?`${g}px`:g})}typeof s=="number"||typeof s=="string"?m(s):typeof s=="object"?["top","right","bottom","left"].forEach(g=>{s[g]===void 0?a[`${d}-${g}`]=f:a[`${d}-${g}`]=typeof s[g]=="number"?`${s[g]}px`:s[g]}):m(f)}),a}const bN=ge.forwardRef(function(n,a){const{invert:s,position:o="bottom-right",hotkey:l=["altKey","KeyT"],expand:d,closeButton:f,className:m,offset:g,mobileOffset:y,theme:h="light",richColors:b,duration:k,style:C,visibleToasts:N=uN,toastOptions:j,dir:M=Rg(),gap:P=pN,icons:F,containerAriaLabel:U="Notifications"}=n,[W,J]=ge.useState([]),A=ge.useMemo(()=>Array.from(new Set([o].concat(W.filter(T=>T.position).map(T=>T.position)))),[W,o]),[w,R]=ge.useState([]),[E,Y]=ge.useState(!1),[K,I]=ge.useState(!1),[$,ee]=ge.useState(h!=="system"?h:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),G=ge.useRef(null),z=l.join("+").replace(/Key/g,"").replace(/Digit/g,""),D=ge.useRef(null),X=ge.useRef(!1),q=ge.useCallback(T=>{J(O=>{var ne;return(ne=O.find(ie=>ie.id===T.id))!=null&&ne.delete||Rn.dismiss(T.id),O.filter(({id:ie})=>ie!==T.id)})},[]);return ge.useEffect(()=>Rn.subscribe(T=>{if(T.dismiss){requestAnimationFrame(()=>{J(O=>O.map(ne=>ne.id===T.id?{...ne,delete:!0}:ne))});return}setTimeout(()=>{nw.flushSync(()=>{J(O=>{const ne=O.findIndex(ie=>ie.id===T.id);return ne!==-1?[...O.slice(0,ne),{...O[ne],...T},...O.slice(ne+1)]:[T,...O]})})})}),[W]),ge.useEffect(()=>{if(h!=="system"){ee(h);return}if(h==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?ee("dark"):ee("light")),typeof window>"u")return;const T=window.matchMedia("(prefers-color-scheme: dark)");try{T.addEventListener("change",({matches:O})=>{ee(O?"dark":"light")})}catch{T.addListener(({matches:ne})=>{try{ee(ne?"dark":"light")}catch(ie){console.error(ie)}})}},[h]),ge.useEffect(()=>{W.length<=1&&Y(!1)},[W]),ge.useEffect(()=>{const T=O=>{var ne;if(l.every(ae=>O[ae]||O.code===ae)){var oe;Y(!0),(oe=G.current)==null||oe.focus()}O.code==="Escape"&&(document.activeElement===G.current||(ne=G.current)!=null&&ne.contains(document.activeElement))&&Y(!1)};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[l]),ge.useEffect(()=>{if(G.current)return()=>{D.current&&(D.current.focus({preventScroll:!0}),D.current=null,X.current=!1)}},[G.current]),ge.createElement("section",{ref:a,"aria-label":`${U} ${z}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},A.map((T,O)=>{var ne;const[ie,oe]=T.split("-");return W.length?ge.createElement("ol",{key:T,dir:M==="auto"?Rg():M,tabIndex:-1,ref:G,className:m,"data-sonner-toaster":!0,"data-sonner-theme":$,"data-y-position":ie,"data-lifted":E&&W.length>1&&!d,"data-x-position":oe,style:{"--front-toast-height":`${((ne=w[0])==null?void 0:ne.height)||0}px`,"--width":`${hN}px`,"--gap":`${P}px`,...C,...vN(g,y)},onBlur:ae=>{X.current&&!ae.currentTarget.contains(ae.relatedTarget)&&(X.current=!1,D.current&&(D.current.focus({preventScroll:!0}),D.current=null))},onFocus:ae=>{ae.target instanceof HTMLElement&&ae.target.dataset.dismissible==="false"||X.current||(X.current=!0,D.current=ae.relatedTarget)},onMouseEnter:()=>Y(!0),onMouseMove:()=>Y(!0),onMouseLeave:()=>{K||Y(!1)},onDragEnd:()=>Y(!1),onPointerDown:ae=>{ae.target instanceof HTMLElement&&ae.target.dataset.dismissible==="false"||I(!0)},onPointerUp:()=>I(!1)},W.filter(ae=>!ae.position&&O===0||ae.position===T).map((ae,ue)=>{var xe,ve;return ge.createElement(xN,{key:ae.id,icons:F,index:ue,toast:ae,defaultRichColors:b,duration:(xe=j==null?void 0:j.duration)!=null?xe:k,className:j==null?void 0:j.className,descriptionClassName:j==null?void 0:j.descriptionClassName,invert:s,visibleToasts:N,closeButton:(ve=j==null?void 0:j.closeButton)!=null?ve:f,interacting:K,position:T,style:j==null?void 0:j.style,unstyled:j==null?void 0:j.unstyled,classNames:j==null?void 0:j.classNames,cancelButtonStyle:j==null?void 0:j.cancelButtonStyle,actionButtonStyle:j==null?void 0:j.actionButtonStyle,closeButtonAriaLabel:j==null?void 0:j.closeButtonAriaLabel,removeToast:q,toasts:W.filter(Ve=>Ve.position==ae.position),heights:w.filter(Ve=>Ve.position==ae.position),setHeights:R,expandByDefault:d,gap:P,expanded:E,swipeDirections:n.swipeDirections})})):null}))}),Mg=e=>e?new Promise(n=>{const a=new Image;a.onload=()=>{if(a.decode){a.decode().then(()=>n()).catch(()=>n());return}n()},a.onerror=()=>n(),a.src=e}):Promise.resolve(),hd=e=>[e.id,e.image,e.authorAvatar].join("|");function wN(){const{topicId:e}=Yl(),n=mn(),{isProfileComplete:a}=mr(),s=v.useMemo(()=>Oj(e),[e]);gr((s==null?void 0:s.title)||"فید");const{feedItems:o,initialLoading:l,loadingMore:d,error:f,hasMore:m,loadMore:g,deletePost:y}=$C(s),h=v.useMemo(()=>s?o.map($=>HC($,s.serverName)):[],[o,s]),[b,k]=v.useState(()=>new Set),[C,N]=v.useState(!1),[j,M]=v.useState({}),[P,F]=v.useState(()=>new Set);v.useEffect(()=>{let $=!1;const ee=h.filter(G=>!b.has(hd(G)));if(ee.length!==0)return Promise.all(ee.map(async G=>(await Promise.all([Mg(G.image),Mg(G.authorAvatar)]),hd(G)))).then(G=>{$||k(z=>{const D=new Set(z);return G.forEach(X=>D.add(X)),D})}),()=>{$=!0}},[h,b]);const U=v.useMemo(()=>h.filter($=>b.has(hd($))),[h,b]),W=v.useMemo(()=>h.filter($=>typeof $.teamMemberIds=="string"&&$.teamMemberIds.trim().length>0),[h]);v.useEffect(()=>{let $=!1;const ee=W.filter(G=>!P.has(G.id));if(ee.length!==0)return Promise.all(ee.map(async G=>{const z=await Fx(G.teamMemberIds.trim());return{id:G.id,members:z.success?z.data:[]}})).then(G=>{$||(M(z=>{const D={...z};return G.forEach(({id:X,members:q})=>{D[X]=q}),D}),F(z=>{const D=new Set(z);return G.forEach(({id:X})=>D.add(X)),D}))}),()=>{$=!0}},[W,P]);const J=h.length===0||U.length===h.length,A=W.length===0||W.every($=>P.has($.id));v.useEffect(()=>{!l&&h.length>0&&J&&A&&N(!0)},[J,A,l,h.length]);const w=v.useCallback($=>{const ee=$.currentTarget,G=ee.scrollHeight-ee.clientHeight-80;ee.scrollTop>=G&&!d&&m&&g()},[d,m,g]),R=v.useCallback(()=>{if(!a){Pl.error("لطفاً ابتدا پروفایل خود را در قسمت 'پروفایل من' تکمیل کنید",{duration:3e3,position:"top-center"});return}n(`/challenges/${e}`)},[n,e,a]),E=v.useCallback(()=>{n("/")},[n]);if(!s)return u.jsx("div",{className:"flex items-center justify-center h-screen text-white",children:"موضوع یافت نشد"});const Y=!l&&!f&&h.length===0,K=!l&&h.length>0&&!C,I=U.length<h.length;return u.jsxs("div",{className:"feed-page-shell fixed inset-0 w-full h-screen overflow-hidden",children:[u.jsx(ba,{position:"fixed",zIndex:0,imageUrl:vn.feed}),u.jsxs("div",{className:"relative z-10 max-w-md mx-auto h-full flex flex-col",children:[u.jsx(Hf,{topicTitle:s.title,subtitle:"صفحه پست ها",onBack:E}),l||K?u.jsx("div",{className:"flex-1 flex items-center justify-center",children:u.jsx("div",{className:"animate-spin rounded-full h-10 w-10 border-b-2 border-white"})}):Y?u.jsx(KC,{accentColor:s.accentColor,onStartMission:R}):u.jsx(WC,{posts:U.map($=>({...$,preloadedTeamMembers:j[$.id]})),loadingMore:d||I,error:f,onScroll:w,onDelete:y})]}),u.jsx(YC,{onClick:R}),u.jsx(Zi,{fixed:!0})]})}function kN(){return u.jsx(N1,{children:u.jsx(wN,{})})}const SN="/assets/c11973053d8410ffeb3c76aa4d1da6991076e7e1-Cd6V5TCX.png",jN={backgroundImage:"linear-gradient(180deg, rgba(46, 27, 61, 0.92) 0%, rgba(35, 24, 62, 0.94) 100%), linear-gradient(120deg, #7c3aed 0%, #f97316 58%, #facc15 100%)",backgroundOrigin:"border-box",backgroundClip:"padding-box, border-box",border:"0.5px solid transparent",boxShadow:"0 -7px 20px rgba(7, 0, 18, 0.46), 0 6px 14px rgba(5, 2, 12, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.16), inset 0 -2px 0 rgba(12, 7, 27, 0.66)",backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)"};function Is({type:e,uploadedFile:n,onUpload:a,onRemove:s,fileName:o,label:l,required:d}){const f=e==="video",g=e==="image"&&!n&&!d,y=n?"0.5px solid transparent":d?"1px dashed rgba(250, 204, 21, 0.7)":"1px dashed rgba(216, 180, 254, 0.65)";return u.jsxs("div",{children:[l&&u.jsxs("label",{className:"mb-3 block text-sm font-bold text-[#FBE7F5]",children:[l,d&&u.jsx("span",{className:"mr-2 text-xs font-normal px-2 py-0.5 rounded-full",style:{background:"rgba(250, 204, 21, 0.22)",color:"#FDE68A",border:"1px solid rgba(250, 204, 21, 0.5)"},children:"الزامی"})]}),u.jsx("div",{className:"relative rounded-2xl overflow-hidden",style:g?{background:"linear-gradient(135deg, rgba(168,115,255,0.28) 0%, rgba(138,82,238,0.24) 100%)",border:y,boxShadow:"none"}:{...jN,border:y},children:n?u.jsxs("div",{className:"relative",children:[f?u.jsxs(u.Fragment,{children:[u.jsx("video",{src:n,className:"w-full h-48 object-cover",controls:!1,muted:!0}),u.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:u.jsx("div",{className:"w-14 h-14 rounded-full flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)",border:"2px solid rgba(255,255,255,0.6)"},children:u.jsx(qi,{className:"w-6 h-6 text-white fill-white ml-1"})})}),o&&u.jsx("div",{className:"absolute bottom-0 left-0 right-0 px-3 py-2",style:{background:"rgba(0,0,0,0.55)"},children:u.jsx("p",{className:"text-white text-xs truncate",children:o})})]}):u.jsx("img",{src:n,alt:"آپلود شده",className:"w-full h-48 object-cover"}),u.jsx(se.button,{whileTap:{scale:.9},onClick:s,className:"absolute top-2 left-2 w-8 h-8 rounded-full flex items-center justify-center",style:{background:"linear-gradient(145deg, rgba(220, 38, 38, 0.9) 0%, rgba(185, 28, 28, 0.9) 100%)",boxShadow:"0 4px 12px rgba(220, 38, 38, 0.4)"},children:u.jsx(Ds,{className:"w-4 h-4 text-white"})})]}):u.jsxs("label",{className:"flex h-48 cursor-pointer flex-col items-center justify-center",children:[d?u.jsx("div",{className:"w-12 h-12 rounded-full flex items-center justify-center mb-2",style:{background:"linear-gradient(135deg, rgba(250, 204, 21, 0.26) 0%, rgba(249, 115, 22, 0.24) 100%)",border:"1px solid rgba(250, 204, 21, 0.5)"},children:u.jsx(vx,{className:"w-6 h-6 text-white"})}):f?u.jsx(jx,{className:"mb-2 h-12 w-12 text-white"}):u.jsx($f,{className:"mb-2 h-12 w-12 text-[#F6D8F0]"}),u.jsx("span",{className:`text-sm ${g?"text-[#F6D8F0]":"text-white"}`,children:f?d?"انتخاب کاور برای ویدیو":"کلیک کنید برای آپلود ویدیو":"کلیک کنید برای آپلود تصویر"}),f&&!d&&u.jsx("span",{className:"mt-1 text-xs text-white",children:"MP4، MOV، AVI پشتیبانی می‌شود"}),d&&u.jsx("span",{className:"mt-1 text-xs text-[#F6D8F0]",children:"تصویری که نمایش داده می‌شود"}),u.jsx("input",{type:"file",accept:f?"video/*":"image/*",onChange:a,className:"hidden"})]})})]})}const CN={backgroundImage:"linear-gradient(180deg, rgba(46, 27, 61, 0.92) 0%, rgba(35, 24, 62, 0.94) 100%), linear-gradient(120deg, #7c3aed 0%, #f97316 58%, #facc15 100%)",backgroundOrigin:"border-box",backgroundClip:"padding-box, border-box",border:"1px solid #d680ff66",boxShadow:"0 -7px 20px rgba(7, 0, 18, 0.46), 0 6px 14px rgba(5, 2, 12, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.16), inset 0 -2px 0 rgba(12, 7, 27, 0.66)",backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)"};function NN(e,n){const[a,s]=v.useState(e);return v.useEffect(()=>{const o=setTimeout(()=>{s(e)},n);return()=>{clearTimeout(o)}},[e,n]),a}async function EN(e){try{const n=localStorage.getItem("accessToken");if(!n)return console.error("No token found"),null;const a=await fetch(`${nt}/api/call`,{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8",Authorization:`Bearer ${n}`},body:JSON.stringify({get_person_function:{mobile:e.replace(/^0/,"")}})});if(!a.ok)return null;const s=await a.json();if(s.state===0&&s.data){const o=JSON.parse(s.data);if(o.full_name&&o.user_id)return{fullName:o.full_name,userId:o.user_id}}return null}catch(n){return console.error("Error verifying phone:",n),null}}function TN({teammate:e,canRemove:n,allTeammates:a,currentUserPhone:s,currentUserId:o,onRemove:l,onChange:d,onVerify:f}){const[m,g]=v.useState(!1),[y,h]=v.useState(""),b=NN(e.phone,1e3),k=v.useMemo(()=>a.map(j=>j.phone).join(","),[a]);v.useEffect(()=>{(async()=>{if(b===y)return;if(!b){h("");return}if(!/^09\d{9}$/.test(b)){h("");return}if(a.find(F=>F.id!==e.id&&F.phone===b)){f("","","این شماره قبلاً وارد شده است"),h(b);return}g(!0);const P=await EN(b);if(g(!1),P){if(P.userId===o){f("","","شما نمی‌توانید خودتان را به عنوان عضو اضافه کنید"),h(b);return}f(P.fullName,P.userId)}else f("","","کاربر یافت نشد");h(b)})()},[b,o,k,e.id,y]);const C=e.error||e.fullName===""&&/^09\d{9}$/.test(e.phone),N=e.fullName&&!e.error;return u.jsxs("div",{className:"space-y-2",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsxs("div",{className:"flex-1 relative",children:[u.jsx("input",{type:"tel",value:e.phone,onChange:j=>{const M=j.target.value;(M===""||/^[0-9]*$/.test(M))&&d(M)},placeholder:"۰۹۱۲۳۴۵۶۷۸۹",dir:"ltr",maxLength:11,className:"h-14 w-full rounded-full py-[12px] pl-[43px] pr-[48px] text-base text-white outline-none placeholder:text-white/45",style:CN}),u.jsxs("div",{className:"absolute left-3 top-1/2 -translate-y-1/2",children:[m&&u.jsx($6,{className:"h-5 w-5 animate-spin text-[#D8B4FE]"}),!m&&N&&u.jsx(j6,{className:"m-[0px] h-5 w-5 text-emerald-300"}),!m&&C&&u.jsx(yx,{className:"h-5 w-5 text-rose-300"})]})]}),n&&u.jsx(se.button,{type:"button",whileTap:{scale:.9},onClick:l,className:"w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0",style:{background:"linear-gradient(135deg, rgba(220, 38, 38, 0.85) 0%, rgba(185, 28, 28, 0.85) 100%)",boxShadow:"0 4px 12px rgba(220, 38, 38, 0.4)"},children:u.jsx(Ds,{className:"w-5 h-5 text-white"})})]}),!m&&N&&u.jsxs("div",{className:"m-[0px] flex items-center gap-1 px-[8px] py-[0px] text-sm text-emerald-300",children:[u.jsx("span",{children:"✓"}),u.jsx("span",{children:e.fullName})]}),!m&&e.error&&u.jsxs("div",{className:"flex items-center gap-1 px-2 text-sm text-rose-300",children:[u.jsx("span",{children:"✗"}),u.jsx("span",{children:e.error})]}),!m&&!e.error&&e.fullName===""&&/^09\d{9}$/.test(e.phone)&&u.jsxs("div",{className:"flex items-center gap-1 px-2 text-sm text-rose-300",children:[u.jsx("span",{children:"✗"}),u.jsx("span",{children:"کاربر یافت نشد"})]})]})}function Kf({teammates:e,onAdd:n,onRemove:a,onChange:s,onVerify:o}){const[l,d]=v.useState(""),[f,m]=v.useState("");return v.useEffect(()=>{const g=hr();g!=null&&g.username&&d(g.username),g!=null&&g.user_id&&m(g.user_id)},[]),u.jsxs("div",{children:[u.jsx("label",{className:"mb-3 block text-sm font-bold text-[#FBE7F5]",children:"شماره تلفن هم‌تیمی‌ها"}),u.jsxs("div",{className:"space-y-3",children:[e.map(g=>u.jsx(TN,{teammate:g,canRemove:e.length>1,allTeammates:e,currentUserPhone:l,currentUserId:f,onRemove:()=>a(g.id),onChange:y=>s(g.id,y),onVerify:(y,h,b)=>o(g.id,y,h,b)},g.id)),u.jsxs(se.button,{type:"button",whileTap:{scale:.95},onClick:n,className:"w-full px-4 py-3 rounded-2xl text-white text-sm font-bold flex items-center justify-center gap-2",style:{background:"linear-gradient(135deg, rgba(168,115,255,0.28) 0%, rgba(138,82,238,0.24) 100%)",border:"1px dashed rgba(216, 180, 254, 0.65)"},children:[u.jsx(Uf,{className:"w-5 h-5"}),"افزودن هم‌تیمی"]})]})]})}const Ig={backgroundImage:"linear-gradient(180deg, rgba(46, 27, 61, 0.92) 0%, rgba(35, 24, 62, 0.94) 100%), linear-gradient(120deg, #7c3aed 0%, #f97316 58%, #facc15 100%)",backgroundOrigin:"border-box",backgroundClip:"padding-box, border-box",border:"1px solid #d680ff66",boxShadow:"0 -7px 20px rgba(7, 0, 18, 0.46), 0 6px 14px rgba(5, 2, 12, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.16), inset 0 -2px 0 rgba(12, 7, 27, 0.66)",backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)"};function ja({label:e,value:n,onChange:a,placeholder:s,multiline:o,rows:l=6}){return u.jsxs("div",{children:[u.jsx("label",{className:"mb-3 block text-sm font-bold text-[#FBE7F5]",children:e}),o?u.jsx("textarea",{value:n,onChange:d=>a(d.target.value),placeholder:s,dir:"rtl",rows:l,className:"w-full resize-none rounded-3xl px-4 py-3 text-sm text-white outline-none placeholder:text-white/45",style:Ig}):u.jsx("input",{type:"text",value:n,onChange:d=>a(d.target.value),placeholder:s,dir:"rtl",className:"h-14 w-full rounded-full px-4 text-base text-white outline-none placeholder:text-white/45",style:Ig})]})}const pd=()=>`teammate-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;function md({topicId:e,topicTitle:n,onSubmit:a}){const s=Vs(e),{refreshProfile:o}=mr(),[l,d]=v.useState(""),[f,m]=v.useState(""),[g,y]=v.useState([{id:pd(),phone:""}]),[h,b]=v.useState(null),[k,C]=v.useState(null),[N,j]=v.useState(!1),[M,P]=v.useState(""),F=R=>{var Y;const E=(Y=R.target.files)==null?void 0:Y[0];if(E){C(E);const K=new FileReader;K.onloadend=()=>b(K.result),K.readAsDataURL(E)}},U=()=>{y([...g,{id:pd(),phone:""}])},W=R=>{const E=g.filter(Y=>Y.id!==R);y(E.length>0?E:[{id:pd(),phone:""}])},J=(R,E)=>{y(g.map(Y=>Y.id===R?{...Y,phone:E,fullName:void 0,userId:void 0,error:void 0}:Y))},A=(R,E,Y,K)=>{y(g.map(I=>I.id===R?{...I,fullName:E,userId:Y,error:K}:I))},w=async()=>{if(!N){j(!0);try{let R="";if(k){P("در حال آپلود تصویر...");const I=await Ls(k);if(I)R=I;else{alert("خطا در آپلود تصویر"),j(!1),P("");return}}const E=g.filter(I=>I.userId).map(I=>I.userId).join(","),Y=localStorage.getItem("current_workflow_ID")||"";P("در حال ثبت ماموریت...");const K=await tc({title:l||"",mission_type:n,mission_done_workflowID:Y,description:f||"",film:"",image:R,audio:"",team_member:E});K.success?(await o(),a({topicId:e,title:l,learnings:f,teammates:E?[E]:[],mediaType:"image",uploadedImage:h})):alert(K.message||"خطا در ثبت ماموریت")}catch(R){console.error("Error submitting:",R),alert("خطا در ثبت ماموریت")}finally{j(!1),P("")}}};return u.jsxs("div",{className:"space-y-6",dir:"rtl",children:[u.jsx(Is,{type:"image",uploadedFile:h,onUpload:F,onRemove:()=>b(null),label:"تصویر چالش"}),s.requiresTeammates&&u.jsx(Kf,{teammates:g,onAdd:U,onRemove:W,onChange:J,onVerify:A}),u.jsx(ja,{label:"عنوان چالش",value:l,onChange:d,placeholder:"عنوان چالش خود را وارد کنید..."}),u.jsx(ja,{label:"از این چالش چه چیزی یاد گرفتیم",value:f,onChange:m,placeholder:"توضیحات خود را وارد کنید...",multiline:!0,rows:6}),u.jsx(se.button,{whileTap:{scale:.95},onClick:w,disabled:N,className:"w-full py-4 rounded-full text-white text-base font-bold mb-6",style:{backgroundImage:N?"linear-gradient(145deg, rgba(72, 58, 105, 0.72) 0%, rgba(42, 35, 77, 0.76) 100%)":"linear-gradient(90deg, rgba(255,139,91,1) 0%, rgba(238,91,166,1) 45%, rgba(147,78,255,1) 100%), linear-gradient(120deg, #7c3aed 0%, #f97316 58%, #facc15 100%)",backgroundOrigin:"border-box",backgroundClip:"padding-box, border-box",boxShadow:N?"inset 0 1px 0 rgba(255,255,255,0.12)":"0 10px 26px rgba(196, 87, 255, 0.35), inset 0 1px 0 rgba(255,255,255,0.35)",border:"1px solid transparent",opacity:N?.7:1,cursor:N?"not-allowed":"pointer"},children:N?"در حال ثبت...":"ثبت نهایی چالش"}),M&&u.jsx(se.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},className:"text-center mb-4 p-4 rounded-2xl",style:{backgroundImage:"linear-gradient(180deg, rgba(46, 27, 61, 0.88) 0%, rgba(35, 24, 62, 0.92) 100%), linear-gradient(120deg, #7c3aed 0%, #f97316 58%, #facc15 100%)",backgroundOrigin:"border-box",backgroundClip:"padding-box, border-box",border:"0.5px solid transparent"},children:u.jsxs("div",{className:"flex items-center justify-center gap-3",children:[u.jsx(se.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},className:"w-5 h-5 border-2 border-[#D8B4FE] border-t-transparent rounded-full"}),u.jsx("span",{className:"text-[#FBE7F5] font-bold text-sm",children:M})]})})]})}const gd=()=>`teammate-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;function yd({topicId:e,topicTitle:n,onSubmit:a}){const s=Vs(e),{refreshProfile:o}=mr(),[l,d]=v.useState(""),[f,m]=v.useState(""),[g,y]=v.useState([{id:gd(),phone:""}]),[h,b]=v.useState("image"),[k,C]=v.useState(null),[N,j]=v.useState(null),[M,P]=v.useState(null),[F,U]=v.useState(null),[W,J]=v.useState(null),[A,w]=v.useState(null),[R,E]=v.useState(!1),[Y,K]=v.useState(""),I=ne=>{var oe;const ie=(oe=ne.target.files)==null?void 0:oe[0];if(ie){j(ie);const ae=new FileReader;ae.onloadend=()=>C(ae.result),ae.readAsDataURL(ie)}},$=ne=>{var oe;const ie=(oe=ne.target.files)==null?void 0:oe[0];if(ie){U(ie);const ae=URL.createObjectURL(ie);P({url:ae,name:ie.name}),J(null),w(null)}},ee=ne=>{var oe;const ie=(oe=ne.target.files)==null?void 0:oe[0];if(ie){w(ie);const ae=new FileReader;ae.onloadend=()=>J(ae.result),ae.readAsDataURL(ie)}},G=ne=>{b(ne),C(null),j(null),P(null),U(null),J(null),w(null)},z=()=>{y([...g,{id:gd(),phone:""}])},D=ne=>{const ie=g.filter(oe=>oe.id!==ne);y(ie.length>0?ie:[{id:gd(),phone:""}])},X=(ne,ie)=>{y(g.map(oe=>oe.id===ne?{...oe,phone:ie,fullName:void 0,userId:void 0,error:void 0}:oe))},q=(ne,ie,oe,ae)=>{y(g.map(ue=>ue.id===ne?{...ue,fullName:ie,userId:oe,error:ae}:ue))},T=async()=>{if(!R){E(!0);try{let ne="",ie="";if(h==="video"){if(!F||!A){alert("لطفاً ویدیو و کاور آن را انتخاب کنید"),E(!1);return}K("در حال آپلود ویدیو...");const xe=await _x(F);if(!xe){alert("خطا در آپلود ویدیو"),E(!1),K("");return}ie=xe,K("در حال آپلود کاور ویدیو...");const ve=await Ls(A);if(!ve){alert("خطا در آپلود کاور ویدیو"),E(!1),K("");return}ne=ve}else if(h==="image"&&N){K("در حال آپلود تصویر...");const xe=await Ls(N);if(!xe){alert("خطا در آپلود تصویر"),E(!1),K("");return}ne=xe}const oe=g.filter(xe=>xe.userId).map(xe=>xe.userId).join(","),ae=localStorage.getItem("current_workflow_ID")||"";K("در حال ثبت ماموریت...");const ue=await tc({title:l||"",mission_type:n,mission_done_workflowID:ae,description:f||"",film:ie,image:ne,audio:"",team_member:oe});ue.success?(await o(),a({topicId:e,title:l,learnings:f,teammates:oe?[oe]:[],mediaType:h,uploadedImage:k,uploadedVideo:M,videoCover:W})):alert(ue.message||"خطا در ثبت ماموریت")}catch(ne){console.error("Error submitting:",ne),alert("خطا در ثبت ماموریت")}finally{E(!1),K("")}}},O=h==="video"&&M!==null&&W===null;return u.jsxs("div",{className:"space-y-6",dir:"rtl",children:[u.jsxs("div",{children:[u.jsx("label",{className:"mb-3 block text-sm font-bold text-[#FBE7F5]",children:"رسانه چالش"}),u.jsx("div",{className:"flex rounded-2xl p-1 mb-4",style:{backgroundImage:"linear-gradient(180deg, rgba(46, 27, 61, 0.92) 0%, rgba(35, 24, 62, 0.94) 100%), linear-gradient(120deg, #7c3aed 0%, #f97316 58%, #facc15 100%)",backgroundOrigin:"border-box",backgroundClip:"padding-box, border-box",border:"0.5px solid transparent"},children:["image","video"].map(ne=>u.jsx(se.button,{whileTap:{scale:.96},onClick:()=>G(ne),className:"flex-1 flex items-center justify-center gap-2 py-2.5 rounded-xl text-sm font-bold transition-all duration-300",style:h===ne?{background:"linear-gradient(135deg, rgba(174, 117, 255, 0.96) 0%, rgba(138, 82, 238, 0.95) 46%, rgba(102, 55, 204, 0.94) 100%)",color:"#FFFFFF",boxShadow:"0 0 18px rgba(155,108,241,0.4)"}:{color:"rgba(251,231,245,0.72)"},children:ne==="image"?u.jsxs(u.Fragment,{children:[u.jsx(vx,{className:"w-4 h-4"})," عکس"]}):u.jsxs(u.Fragment,{children:[u.jsx(jx,{className:"w-4 h-4"})," ویدیو"]})},ne))}),u.jsxs(pn,{mode:"wait",children:[h==="image"&&u.jsx(se.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},transition:{duration:.25},children:u.jsx(Is,{type:"image",uploadedFile:k,onUpload:I,onRemove:()=>C(null)})},"image-upload"),h==="video"&&u.jsxs(se.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},transition:{duration:.25},className:"space-y-4",children:[u.jsx(Is,{type:"video",uploadedFile:(M==null?void 0:M.url)||null,onUpload:$,onRemove:()=>{P(null),J(null)},fileName:M==null?void 0:M.name}),u.jsx(pn,{children:M&&u.jsx(se.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.3},children:u.jsx(Is,{type:"image",uploadedFile:W,onUpload:ee,onRemove:()=>J(null),label:"کاور ویدیو",required:!0})})})]},"video-upload")]})]}),s.requiresTeammates&&u.jsx(Kf,{teammates:g,onAdd:z,onRemove:D,onChange:X,onVerify:q}),u.jsx(ja,{label:"عنوان چالش",value:l,onChange:d,placeholder:"عنوان چالش خود را وارد کنید..."}),u.jsx(ja,{label:"از این چالش چه چیزی یاد گرفتیم",value:f,onChange:m,placeholder:"توضیحات خود را وارد کنید...",multiline:!0,rows:6}),u.jsx(se.button,{whileTap:{scale:.95},onClick:T,disabled:O||R,className:"w-full py-4 rounded-full text-white text-base font-bold mb-6 transition-opacity",style:{backgroundImage:O||R?"linear-gradient(145deg, rgba(72, 58, 105, 0.72) 0%, rgba(42, 35, 77, 0.76) 100%)":"linear-gradient(90deg, rgba(255,139,91,1) 0%, rgba(238,91,166,1) 45%, rgba(147,78,255,1) 100%), linear-gradient(120deg, #7c3aed 0%, #f97316 58%, #facc15 100%)",backgroundOrigin:"border-box",backgroundClip:"padding-box, border-box",boxShadow:O||R?"inset 0 1px 0 rgba(255,255,255,0.12)":"0 10px 26px rgba(196, 87, 255, 0.35), inset 0 1px 0 rgba(255,255,255,0.35)",border:"1px solid transparent"},children:O?"ابتدا کاور ویدیو را انتخاب کنید":R?"در حال ارسال...":"ثبت نهایی چالش"}),Y&&u.jsx(se.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},className:"text-center mb-4 p-4 rounded-2xl",style:{backgroundImage:"linear-gradient(180deg, rgba(46, 27, 61, 0.88) 0%, rgba(35, 24, 62, 0.92) 100%), linear-gradient(120deg, #7c3aed 0%, #f97316 58%, #facc15 100%)",backgroundOrigin:"border-box",backgroundClip:"padding-box, border-box",border:"0.5px solid transparent"},children:u.jsxs("div",{className:"flex items-center justify-center gap-3",children:[u.jsx(se.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},className:"w-5 h-5 border-2 border-[#D8B4FE] border-t-transparent rounded-full"}),u.jsx("span",{className:"text-[#FBE7F5] font-bold text-sm",children:Y})]})})]})}function PN({onSupervisorDataChange:e,initialMobile:n="",initialCode:a=""}){const[s,o]=v.useState(""),[l,d]=v.useState(""),[f,m]=v.useState(!1),[g,y]=v.useState(!1);v.useEffect(()=>{n&&a?(o(n),d(""),m(!0)):n&&!a&&o(n)},[n,a]),v.useEffect(()=>{const k=s.length===10?`0${s}`:s;e(k,l)},[s,l,e]);const h=async()=>{if(!s||s.length<10){alert("لطفاً شماره تلفن معتبر وارد کنید");return}const k=localStorage.getItem("current_workflow_ID");if(!k){alert("خطا: شناسه ماموریت یافت نشد. لطفاً دوباره تلاش کنید.");return}y(!0);const C=s.length===10?`0${s}`:s;try{const N=await pj(C,k);N.success?(m(!0),alert(N.message||`کد تأیید به شماره ${s} ارسال شد`)):alert(N.message||"خطا در ارسال کد. لطفاً دوباره تلاش کنید.")}catch(N){console.error("Error sending supervisor code:",N),alert("خطا در ارتباط با سرور. لطفاً دوباره تلاش کنید.")}finally{y(!1)}},b=()=>{m(!1),d("")};return u.jsxs("div",{className:"relative overflow-hidden rounded-3xl p-6",style:{backgroundImage:"linear-gradient(180deg, rgba(46, 27, 61, 0.92) 0%, rgba(35, 24, 62, 0.94) 100%), linear-gradient(120deg, #7c3aed 0%, #f97316 58%, #facc15 100%)",backgroundOrigin:"border-box",backgroundClip:"padding-box, border-box",border:"0.5px solid transparent",boxShadow:"0 -7px 20px rgba(7, 0, 18, 0.46), 0 6px 14px rgba(5, 2, 12, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.16), inset 0 -2px 0 rgba(12, 7, 27, 0.66)",backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)"},children:[u.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[u.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center",style:{background:"linear-gradient(145deg, #A873FF 0%, #8A52EE 55%, #6637CC 100%)",boxShadow:"0 4px 12px rgba(155,108,241,0.45)"},children:u.jsx(p8,{className:"w-5 h-5 text-white"})}),u.jsxs("div",{className:"flex-1",children:[u.jsx("h3",{className:"text-base font-bold text-[#FBE7F5]",children:"درخواست معرفی ناظر"}),u.jsx("p",{className:"mt-0.5 text-sm text-[#EED3EC]/85",children:"شماره تلفن ناظر خود را وارد کنید"})]})]}),u.jsxs("div",{className:"space-y-4",children:[u.jsx("div",{className:"relative",children:u.jsx("input",{type:"tel",value:s,onChange:k=>o(k.target.value.replace(/\D/g,"")),maxLength:11,placeholder:"09123456789",disabled:f,className:"w-full px-4 py-3 rounded-2xl text-white text-center text-lg font-bold tracking-wider",style:{background:"rgba(26, 18, 54, 0.6)",border:"1px solid rgba(216, 180, 254, 0.45)",outline:"none"},dir:"ltr"})}),!f&&u.jsx(se.button,{whileTap:{scale:.95},onClick:h,disabled:g||s.length<10,className:"w-full py-3 rounded-2xl text-white font-bold flex items-center justify-center gap-2",style:{background:s.length>=10?"linear-gradient(135deg, rgba(174, 117, 255, 0.96) 0%, rgba(138, 82, 238, 0.95) 46%, rgba(102, 55, 204, 0.94) 100%)":"linear-gradient(145deg, rgba(72, 58, 105, 0.72) 0%, rgba(42, 35, 77, 0.76) 100%)",boxShadow:s.length>=10?"0 0 18px rgba(155,108,241,0.4), 0 10px 20px rgba(24, 10, 54, 0.34)":"inset 0 1px 0 rgba(255,255,255,0.12)",cursor:s.length>=10?"pointer":"not-allowed"},children:g?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"w-5 h-5 border-2 border-white border-t-transparent rounded-full animate-spin"}),"در حال ارسال..."]}):u.jsxs(u.Fragment,{children:[u.jsx(wx,{className:"w-5 h-5"}),"ارسال کد تأیید"]})}),f&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"relative",children:u.jsx("input",{type:"text",value:l,onChange:k=>d(k.target.value.replace(/\D/g,"")),maxLength:6,placeholder:"کد تأیید را وارد کنید",className:"w-full px-4 py-3 rounded-2xl text-white text-center text-xl font-bold tracking-widest",style:{background:"rgba(10, 20, 35, 0.6)",border:"2px solid rgba(168, 144, 224, 0.4)",outline:"none"},dir:"ltr"})}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx("button",{onClick:b,className:"flex-1 py-2.5 rounded-2xl text-white/80 text-sm font-bold hover:text-white transition-colors",style:{background:"rgba(138, 82, 238, 0.22)",border:"1px solid rgba(216, 180, 254, 0.45)"},children:"تغییر شماره"}),u.jsx("button",{onClick:()=>{m(!1),d("")},className:"flex-1 py-2.5 rounded-2xl text-white/80 text-sm font-bold hover:text-white transition-colors",style:{background:"rgba(138, 82, 238, 0.22)",border:"1px solid rgba(216, 180, 254, 0.45)"},children:"ارسال مجدد کد"})]})]})]})]})}function RN({topicId:e,topicTitle:n,onSubmit:a,doingMission:s}){const{refreshProfile:o}=mr(),[l,d]=v.useState(""),[f,m]=v.useState(""),[g,y]=v.useState(null),[h,b]=v.useState(null),[k,C]=v.useState(""),[N,j]=v.useState(""),[M,P]=v.useState(!1),[F,U]=v.useState(""),W=(s==null?void 0:s.mobile)||"",J=(s==null?void 0:s.code)||"",A=E=>{var K;const Y=(K=E.target.files)==null?void 0:K[0];if(Y){b(Y);const I=new FileReader;I.onloadend=()=>y(I.result),I.readAsDataURL(Y)}},w=(E,Y)=>{C(E),j(Y)},R=async()=>{if(k.length<10){alert("لطفاً شماره تلفن ناظر را به طور کامل وارد کنید");return}if(N.length<6){alert("لطفاً کد تأیید 6 رقمی ناظر را وارد کنید");return}if(!M){P(!0);try{let E="";if(h){U("در حال آپلود تصویر...");const $=await Ls(h);if($)E=$;else{alert("خطا در آپلود تصویر"),P(!1),U("");return}}const Y=localStorage.getItem("current_workflow_ID")||"",K=k.length===10?`0${k}`:k;U("در حال ثبت ماموریت...");const I=await tc({title:l||"",mission_type:n,mission_done_workflowID:Y,description:f||"",film:"",image:E,audio:"",team_member:"",enter_code:N});I.success?(await o(),a({topicId:e,title:l,learnings:f,mediaType:"image",uploadedImage:g,supervisor:{phone:k,code:N}})):alert(I.message||"خطا در ثبت ماموریت")}catch(E){console.error("Error submitting:",E),alert("خطا در ثبت ماموریت")}finally{P(!1),U("")}}};return u.jsxs("div",{className:"space-y-6",dir:"rtl",children:[u.jsx(Is,{type:"image",uploadedFile:g,onUpload:A,onRemove:()=>y(null),label:"تصویر چالش"}),u.jsx(PN,{onSupervisorDataChange:w,initialMobile:W,initialCode:J}),u.jsx(ja,{label:"عنوان چالش",value:l,onChange:d,placeholder:"عنوان چالش خود را وارد کنید..."}),u.jsx(ja,{label:"از این چالش چه چیزی یاد گرفتیم",value:f,onChange:m,placeholder:"توضیحات خود را وارد کنید...",multiline:!0,rows:6}),u.jsx(se.button,{whileTap:{scale:.95},onClick:R,disabled:k.length<10||N.length<6||M,className:"w-full py-4 rounded-full text-white text-base font-bold mb-6",style:{backgroundImage:k.length>=10&&N.length>=6&&!M?"linear-gradient(90deg, rgba(255,139,91,1) 0%, rgba(238,91,166,1) 45%, rgba(147,78,255,1) 100%), linear-gradient(120deg, #7c3aed 0%, #f97316 58%, #facc15 100%)":"linear-gradient(145deg, rgba(72, 58, 105, 0.72) 0%, rgba(42, 35, 77, 0.76) 100%)",backgroundOrigin:"border-box",backgroundClip:"padding-box, border-box",boxShadow:k.length>=10&&N.length>=6&&!M?"0 10px 26px rgba(196, 87, 255, 0.35), inset 0 1px 0 rgba(255,255,255,0.35)":"inset 0 1px 0 rgba(255,255,255,0.12)",border:"1px solid transparent",cursor:k.length>=10&&N.length>=6&&!M?"pointer":"not-allowed",opacity:M?.7:1},children:k.length<10||N.length<6?"لطفاً شماره و کد ناظر را کامل کنید":M?"در حال ثبت...":"ثبت نهایی چالش"}),F&&u.jsx(se.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},className:"text-center mb-4 p-4 rounded-2xl",style:{backgroundImage:"linear-gradient(180deg, rgba(46, 27, 61, 0.88) 0%, rgba(35, 24, 62, 0.92) 100%), linear-gradient(120deg, #7c3aed 0%, #f97316 58%, #facc15 100%)",backgroundOrigin:"border-box",backgroundClip:"padding-box, border-box",border:"0.5px solid transparent"},children:u.jsxs("div",{className:"flex items-center justify-center gap-3",children:[u.jsx(se.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},className:"w-5 h-5 border-2 border-[#D8B4FE] border-t-transparent rounded-full"}),u.jsx("span",{className:"text-[#FBE7F5] font-bold text-sm",children:F})]})})]})}function MN({uploadedAudio:e,onUpload:n,onRemove:a,label:s="پادکست صوتی"}){const o=v.useRef(null);return u.jsxs("div",{className:"relative overflow-hidden rounded-3xl p-6",style:{backgroundImage:"linear-gradient(180deg, rgba(46, 27, 61, 0.92) 0%, rgba(35, 24, 62, 0.94) 100%), linear-gradient(120deg, #7c3aed 0%, #f97316 58%, #facc15 100%)",backgroundOrigin:"border-box",backgroundClip:"padding-box, border-box",border:"0.5px solid transparent",boxShadow:"0 -7px 20px rgba(7, 0, 18, 0.46), 0 6px 14px rgba(5, 2, 12, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.16), inset 0 -2px 0 rgba(12, 7, 27, 0.66)",backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)"},children:[u.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[u.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center",style:{background:"linear-gradient(145deg, #A873FF 0%, #8A52EE 55%, #6637CC 100%)",boxShadow:"0 4px 12px rgba(155,108,241,0.45)"},children:u.jsx(J6,{className:"w-5 h-5 text-white"})}),u.jsxs("div",{children:[u.jsx("h3",{className:"text-base font-bold text-[#FBE7F5]",children:s}),u.jsx("p",{className:"text-sm text-[#EED3EC]/85",children:"MP3, WAV, M4A"})]})]}),e?u.jsxs("div",{className:"relative rounded-2xl p-4",style:{background:"rgba(26, 18, 54, 0.6)",border:"1px solid rgba(216, 180, 254, 0.45)"},children:[u.jsxs("div",{className:"flex items-center gap-4",children:[u.jsx("div",{className:"w-14 h-14 rounded-xl flex items-center justify-center flex-shrink-0",style:{background:"linear-gradient(145deg, #A873FF 0%, #8A52EE 55%, #6637CC 100%)",boxShadow:"0 4px 12px rgba(155,108,241,0.45)"},children:u.jsx(Q6,{className:"w-7 h-7 text-white"})}),u.jsx("div",{className:"flex-1 min-w-0",children:u.jsxs("audio",{controls:!0,className:"w-full",style:{maxHeight:"40px"},children:[u.jsx("source",{src:e}),"مرورگر شما از پخش صوت پشتیبانی نمی‌کند."]})})]}),u.jsx(se.button,{whileTap:{scale:.9},onClick:a,className:"absolute -top-3 -left-3 w-10 h-10 rounded-full flex items-center justify-center",style:{background:"linear-gradient(135deg, #ef4444 0%, #dc2626 100%)",boxShadow:"0 4px 12px rgba(239, 68, 68, 0.4)"},children:u.jsx(kx,{className:"w-5 h-5 text-white"})})]}):u.jsxs(se.button,{whileTap:{scale:.98},onClick:()=>{var l;return(l=o.current)==null?void 0:l.click()},className:"w-full py-8 rounded-2xl border-2 border-dashed flex flex-col items-center justify-center gap-3 transition-all hover:bg-white/5",style:{borderColor:"rgba(216, 180, 254, 0.52)"},children:[u.jsx("div",{className:"w-16 h-16 rounded-full flex items-center justify-center",style:{background:"linear-gradient(135deg, rgba(168,115,255,0.25) 0%, rgba(138,82,238,0.25) 100%)"},children:u.jsx($f,{className:"h-8 w-8 text-[#D8B4FE]"})}),u.jsxs("div",{className:"text-center",children:[u.jsx("p",{className:"text-base font-bold text-[#FBE7F5]",children:"آپلود فایل صوتی"}),u.jsx("p",{className:"mt-1 text-sm text-[#EED3EC]/80",children:"برای انتخاب فایل کلیک کنید"})]})]}),u.jsx("input",{ref:o,type:"file",accept:"audio/*,.mp3,.wav,.m4a",onChange:n,className:"hidden"})]})}const xd=()=>`teammate-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;function _g({topicId:e,topicTitle:n,onSubmit:a}){const s=Vs(e),{refreshProfile:o}=mr(),[l,d]=v.useState(""),[f,m]=v.useState(""),[g,y]=v.useState([{id:xd(),phone:""}]),[h,b]=v.useState(null),[k,C]=v.useState(null),[N,j]=v.useState(null),[M,P]=v.useState(null),[F,U]=v.useState(!1),[W,J]=v.useState(""),A=$=>{var G;const ee=(G=$.target.files)==null?void 0:G[0];if(ee){C(ee);const z=new FileReader;z.onloadend=()=>b(z.result),z.readAsDataURL(ee)}},w=$=>{var G;const ee=(G=$.target.files)==null?void 0:G[0];if(ee){P(ee);const z=new FileReader;z.onloadend=()=>j(z.result),z.readAsDataURL(ee)}},R=()=>{y([...g,{id:xd(),phone:""}])},E=$=>{const ee=g.filter(G=>G.id!==$);y(ee.length>0?ee:[{id:xd(),phone:""}])},Y=($,ee)=>{y(g.map(G=>G.id===$?{...G,phone:ee,fullName:void 0,userId:void 0,error:void 0}:G))},K=($,ee,G,z)=>{y(g.map(D=>D.id===$?{...D,fullName:ee,userId:G,error:z}:D))},I=async()=>{if(!F){U(!0);try{let $="",ee="";if(k){J("در حال آپلود تصویر...");const X=await Ls(k);if(X)$=X;else{alert("خطا در آپلود تصویر"),U(!1),J("");return}}if(M){J("در حال آپلود فایل صوتی...");const X=await _x(M);if(X)ee=X;else{alert("خطا در آپلود فایل صوتی"),U(!1),J("");return}if(!k){alert("برای آپلود صوت، تصویر کاور الزامی است"),U(!1),J("");return}}const G=g.filter(X=>X.userId).map(X=>X.userId).join(","),z=localStorage.getItem("current_workflow_ID")||"";J("در حال ثبت ماموریت...");const D=await tc({title:l||"",mission_type:n,mission_done_workflowID:z,description:f||"",film:"",image:$,audio:ee,team_member:G});D.success?(await o(),a({topicId:e,title:l,learnings:f,teammates:G?[G]:[],mediaType:"image",uploadedImage:h,uploadedAudio:N})):alert(D.message||"خطا در ثبت ماموریت")}catch($){console.error("Error submitting:",$),alert("خطا در ثبت ماموریت")}finally{U(!1),J("")}}};return u.jsxs("div",{className:"space-y-6",dir:"rtl",children:[u.jsx(Is,{type:"image",uploadedFile:h,onUpload:A,onRemove:()=>b(null),label:"تصویر چالش"}),u.jsx(MN,{uploadedAudio:N,onUpload:w,onRemove:()=>j(null),label:"پادکست صوتی"}),s.requiresTeammates&&u.jsx(Kf,{teammates:g,onAdd:R,onRemove:E,onChange:Y,onVerify:K}),u.jsx(ja,{label:"عنوان چالش",value:l,onChange:d,placeholder:"عنوان چالش خود را وارد کنید..."}),u.jsx(ja,{label:"از این چالش چه چیزی یاد گرفتیم",value:f,onChange:m,placeholder:"توضیحات خود را وارد کنید...",multiline:!0,rows:6}),u.jsx(se.button,{whileTap:{scale:.95},onClick:I,disabled:F,className:"w-full py-4 rounded-full text-white text-base font-bold mb-6",style:{backgroundImage:F?"linear-gradient(145deg, rgba(72, 58, 105, 0.72) 0%, rgba(42, 35, 77, 0.76) 100%)":"linear-gradient(90deg, rgba(255,139,91,1) 0%, rgba(238,91,166,1) 45%, rgba(147,78,255,1) 100%), linear-gradient(120deg, #7c3aed 0%, #f97316 58%, #facc15 100%)",backgroundOrigin:"border-box",backgroundClip:"padding-box, border-box",boxShadow:F?"inset 0 1px 0 rgba(255,255,255,0.12)":"0 10px 26px rgba(196, 87, 255, 0.35), inset 0 1px 0 rgba(255,255,255,0.35)",border:"1px solid transparent",opacity:F?.7:1,cursor:F?"not-allowed":"pointer"},children:F?"در حال ثبت...":"ثبت نهایی چالش"}),W&&u.jsx(se.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},className:"text-center mb-4 p-4 rounded-2xl",style:{backgroundImage:"linear-gradient(180deg, rgba(46, 27, 61, 0.88) 0%, rgba(35, 24, 62, 0.92) 100%), linear-gradient(120deg, #7c3aed 0%, #f97316 58%, #facc15 100%)",backgroundOrigin:"border-box",backgroundClip:"padding-box, border-box",border:"0.5px solid transparent"},children:u.jsxs("div",{className:"flex items-center justify-center gap-3",children:[u.jsx(se.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},className:"w-5 h-5 border-2 border-[#D8B4FE] border-t-transparent rounded-full"}),u.jsx("span",{className:"text-[#FBE7F5] font-bold text-sm",children:W})]})})]})}const Fg={1:{id:"1",title:"تخته سیاه",description:"ماموریت‌های آموزشی و خلاقانه",accentColor:"#8ACEE0",backgroundColor:"#0a1f2e",mediaType:"image",requiresTeammates:!0,formComponent:md,challenges:[{id:"chalkboard-1",title:"درس جدید یاد بگیر",description:"یک مفهوم علمی یا درسی جدید را با کمک هم‌کلاسی‌هایت یاد بگیر و برای بقیه توضیح بده."},{id:"chalkboard-2",title:"معلم کوچک",description:"یه درس که بهش مسلطی رو به یه نفر از هم‌کلاسی‌هایت آموزش بده."},{id:"chalkboard-3",title:"سوال خلاقانه",description:"یه سوال مخصوص از معلمت بپرس که فکر همه رو درگیر کنه."}],chatbotIntro:`سلام! به دنیای تخته سیاه خوش اومدی 📚✨
اینجا می‌تونی ماموریت‌های آموزشی جذاب رو قبول کنی و با یادگیری جدید سکه جمع کنی!`},2:{id:"2",title:"نیمکت",description:"لحظات استراحت و گفتگو",accentColor:"#A8D5E2",backgroundColor:"#0e1a25",mediaType:"image",requiresTeammates:!1,formComponent:md,challenges:[{id:"bench-1",title:"دوست جدید پیدا کن",description:"با یه نفر که کمتر باهاش صحبت کردی، حرف بزن و یه چیز جالب ازش یاد بگیر."},{id:"bench-2",title:"گوش شنوا",description:"یه روز کامل سعی کن بیشتر گوش بدی و کمتر صحبت کنی. ببین چقدر چیز یاد می‌گیری."},{id:"bench-3",title:"مشکل‌گشا باش",description:"به یه هم‌کلاسی که مشکل دارد کمک کن. کمکت رو ثبت کن."}],chatbotIntro:`سلام! خوش اومدی به نیمکت 🪑💙
اینجا فضایی برای رشد مهارت‌های اجتماعی و دوستی‌های عمیق‌تره. بریم یه ماموریت باحال شروع کنیم!`},3:{id:"3",title:"دفترچه یادداشت",description:"یادداشت‌ها و خاطرات",accentColor:"#B8E0F0",backgroundColor:"#1a1f2e",mediaType:"both",requiresTeammates:!1,formComponent:yd,challenges:[{id:"notebook-1",title:"روزنگاری",description:"هر روز یه پاراگراف از اتفاقات روزت بنویس. بعد از یه هفته برگرد و بخونش."},{id:"notebook-2",title:"داستان کوتاه",description:"یه داستان کوتاه ۵ جمله‌ای بنویس که شخصیت اصلیش خودت باشی."},{id:"notebook-3",title:"نامه به آینده",description:"یه نامه به خودت در ۵ سال آینده بنویس. ارزوها، هدف‌ها و احساساتت رو بنویس."}],chatbotIntro:`سلام نویسنده کوچولو! 📔✏️
دفترچه یادداشت جایی‌ه که می‌تونی همه چیز رو ثبت کنی. ماموریت‌های نوشتاری خیلی جالبی برات دارم!`},4:{id:"4",title:"دیوار حیاط",description:"نقاشی و هنر",accentColor:"#90C8E0",backgroundColor:"#0f1f30",mediaType:"image",requiresTeammates:!0,formComponent:_g,challenges:[{id:"wall-1",title:"نقاشی با موضوع محیط‌زیست",description:"یه نقاشی بکش که پیام حفاظت از محیط‌زیست رو داشته باشه."},{id:"wall-2",title:"پرتره دوست",description:"یه پرتره از یکی از دوستانت بکش و بهش هدیه بده."},{id:"wall-3",title:"نقاشی با رنگ طبیعی",description:"از مواد طبیعی مثل چغندر، اسفناج یا زردچوبه رنگ بساز و باهاش نقاشی بکش."}],chatbotIntro:`سلام هنرمند! 🎨🖌️
دیوار حیاط جای ابراز خلاقیته! ماموریت‌های هنری شگفت‌انگیزی برات دارم که می‌تونی با رنگ و نقاشی دنیا رو زیباتر کنی.`},5:{id:"5",title:"آبخوری",description:"تجربه‌های روزانه",accentColor:"#A890E0",backgroundColor:"#1a1530",mediaType:"image",requiresTeammates:!1,formComponent:RN,challenges:[{id:"fountain-1",title:"صرفه‌جویی در آب",description:"یه هفته میزان مصرف آب خانوادت رو بررسی کن و یه راه‌کار برای کاهش مصرف پیدا کن."},{id:"fountain-2",title:"گیاه کوچک",description:"یه گیاه کوچک بکار، هر روز بهش آب بده و رشدش رو عکس بگیر."},{id:"fountain-3",title:"محیط‌زیست‌یار",description:"یه بار در هفته حیاط مدرسه رو از زباله پاک کن و عکس قبل و بعد بگیر."}],chatbotIntro:`سلام! 💧🌿
آبخوری یادآور ارزش آب و طبیعته. اینجا ماموریت‌هایی داریم که می‌تونه تأثیر واقعی روی محیط‌زیست داشته باشه!`},6:{id:"6",title:"زنگ ورزش",description:"فعالیت‌های ورزشی",accentColor:"#80D0E0",backgroundColor:"#0a1f2e",mediaType:"both",requiresTeammates:!0,formComponent:yd,challenges:[{id:"sports-1",title:"۱۰ دقیقه ورزش",description:"هر روز صبح ۱۰ دقیقه ورزش کن. بعد از یه هفته احساست رو گزارش بده."},{id:"sports-2",title:"بازی جدید",description:"یه بازی ورزشی که بلد نیستی رو یاد بگیر و با دوستانت بازی کن."},{id:"sports-3",title:"تیم‌سازی",description:"یه تیم ۴ نفره برای یه بازی گروهی تشکیل بده و یه مسابقه برگزار کن."}],chatbotIntro:`سلام قهرمان! 🏃‍♂️⚽
زنگ ورزش وقت نشاط و سرزندگیه! ماموریت‌های ورزشی که برات دارم نه‌تنها بدنت رو قوی می‌کنه بلکه روح تیمی رو هم تقویت می‌کنه.`},7:{id:"7",title:"سه ماه تعطیلی",description:"ماجراهای تابستانی",accentColor:"#90D8F0",backgroundColor:"#0f1a30",mediaType:"image",requiresTeammates:!1,formComponent:md,challenges:[{id:"vacation-1",title:"سفر خلاقانه",description:"یه جای جدید در شهرت کشف کن. یه پارک، موزه یا مکان تاریخی که هرگز نرفتی."},{id:"vacation-2",title:"مهارت تابستانی",description:"یه مهارت جدید در تابستان یاد بگیر: آشپزی، نقاشی، موسیقی یا هر چیزی که دوست داری."},{id:"vacation-3",title:"کتاب‌خوانی",description:"یه کتاب کامل بخوان و خلاصه‌ای ازش برای دوستانت بنویس."}],chatbotIntro:`سلام! ☀️🌊
سه ماه تعطیلی فرصت طلاییه! اینجا ماموریت‌هایی داریم که تابستانت رو به یه ماجراجویی فوق‌العاده تبدیل می‌کنه.`},8:{id:"8",title:"روزنامه دیواری",description:"اخبار و گزارش‌ها",accentColor:"#A0D0E8",backgroundColor:"#151a2e",mediaType:"both",requiresTeammates:!1,formComponent:yd,challenges:[{id:"newspaper-1",title:"خبرنگار مدرسه",description:"یه رویداد مهم در مدرسه رو گزارش بده: مسابقه، جشن یا اتفاق خاص."},{id:"newspaper-2",title:"مصاحبه با معلم",description:"با یکی از معلمانت مصاحبه کن و داستان تدریسش رو بنویس."},{id:"newspaper-3",title:"شعر و داستان",description:"یه شعر یا داستان کوتاه بنویس و برای روزنامه دیواری کلاست آماده کن."}],chatbotIntro:`سلام خبرنگار کوچولو! 📰✍️
روزنامه دیواری صدای بچه‌های مدرسه‌ست! ماموریت‌هایی داریم که می‌تونی با نوشتن و گزارش، صدات رو به گوش همه برسونی.`},9:{id:"9",title:"زنگ تفریح",description:"سرگرمی و بازی",accentColor:"#8ACEE0",backgroundColor:"#0a1f2e",mediaType:"image",requiresTeammates:!0,formComponent:_g,challenges:[{id:"recess-1",title:"بازی ابداعی",description:"یه بازی جدید اختراع کن که حداقل ۵ نفر بتونن باهم بازی کنن."},{id:"recess-2",title:"شادی‌آفرین",description:"با یه کار خلاقانه (شعر، نقاشی، بازی) حال هم‌کلاسی‌هایت رو خوب کن."},{id:"recess-3",title:"قصه‌گو",description:"یه قصه جالب بساز و برای بچه‌های کلاست تعریف کن. ببین چقدر خندیدن!"}],chatbotIntro:`سلام بازیگوش! 🎮🎉
زنگ تفریح وقت شادیه! ماموریت‌هایی داریم که خنده و نشاط رو به مدرسه برمی‌گردونه.`}};function Vs(e){return Fg[e]||Fg[1]}const IN=["۰","۱","۲","۳","۴","۵","۶","۷","۸","۹"],Jd=(e,n="")=>(e==null||e===""?n:String(e)).replace(/\d/g,s=>IN[parseInt(s,10)]),_N=e=>{const n=e==null||e===""?"15":String(e);return n.includes("دقیقه")?Jd(n):`${Jd(n)} دقیقه`};function FN(){const e=[{height:"h-[5px]",color:"#D7B6FF"},{height:"h-[8px]",color:"#F2A8D8"},{height:"h-[11px]",color:"#F7C47D"}];return u.jsx("span",{className:"inline-flex h-4 w-4 -translate-y-[2px] items-end justify-center gap-[2px] align-middle","aria-hidden":"true",children:e.map((n,a)=>u.jsx("span",{className:`w-[3px] rounded-full ${n.height}`,style:{backgroundColor:n.color}},a))})}const DN={backgroundImage:`
linear-gradient(180deg, rgba(46, 27, 61, 0.82) 0%, rgba(35, 24, 62, 0.8) 100%),
linear-gradient(128deg, rgba(255, 164, 222, 0.92) 0%, rgba(168, 120, 255, 0.88) 38%, rgba(249, 115, 22, 0.78) 72%, rgba(250, 204, 21, 0.68) 100%)
`,border:"1px solid transparent",backgroundOrigin:"border-box",backgroundClip:"padding-box, border-box",boxShadow:"0 -7px 20px rgba(7, 0, 18, 0.52), 0 10px 22px rgba(5, 2, 12, 0.38), 0 0 14px rgba(255, 121, 207, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.16), inset 0 2px 5px rgba(255, 222, 255, 0.06), inset 0 -2px 0 rgba(12, 7, 27, 0.74), inset 0 -8px 14px rgba(8, 4, 18, 0.38), inset 0 0 0 1px rgba(255, 255, 255, 0.03), inset 0 0 0 2px rgba(17, 10, 35, 0.36)",backdropFilter:"blur(14px) saturate(118%)",WebkitBackdropFilter:"blur(14px) saturate(118%)"},LN={background:"linear-gradient(132deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.018) 28%, rgba(255, 121, 207, 0.065) 58%, rgba(124, 58, 237, 0.055) 100%), linear-gradient(180deg, rgba(46, 27, 61, 0.72) 0%, rgba(35, 24, 62, 0.8) 100%)",border:"1px solid rgba(255, 191, 229, 0.2)",boxShadow:"inset 0 1px 0 rgba(255,255,255,0.15), inset 0 0 18px rgba(255,121,207,0.05), inset 0 -12px 20px rgba(8,4,18,0.34)"},AN={backgroundImage:`
linear-gradient(180deg, rgba(46, 27, 61, 0.78) 0%, rgba(35, 24, 62, 0.78) 100%),
linear-gradient(135deg, rgba(124, 58, 237, 0.95) 0%, rgba(255, 121, 207, 0.72) 48%, rgba(249, 115, 22, 0.88) 100%)
`,backgroundOrigin:"border-box",backgroundClip:"padding-box, border-box",boxShadow:"0 10px 22px rgba(0,0,0,0.38), 0 0 14px rgba(255,121,207,0.16), inset 0 1px 0 rgba(255,255,255,0.2)"},ON={backgroundImage:`
linear-gradient(145deg, rgba(46, 27, 61, 0.82) 0%, rgba(35, 24, 62, 0.88) 100%),
linear-gradient(132deg, rgba(255, 121, 207, 0.74) 0%, rgba(124, 58, 237, 0.7) 48%, rgba(249, 115, 22, 0.64) 100%)
`,backgroundOrigin:"border-box",backgroundClip:"padding-box, border-box",boxShadow:"0 8px 18px rgba(0,0,0,0.34), 0 0 12px rgba(255,121,207,0.14), inset 0 1px 0 rgba(255,255,255,0.16), inset 0 -4px 8px rgba(8,4,18,0.38)"},BN={backgroundImage:`
linear-gradient(180deg, #2E1B3D 0%, #23183E 100%),
linear-gradient(120deg, #7c3aed 0%, #f97316 58%, #facc15 100%)
`,backgroundOrigin:"border-box",backgroundClip:"padding-box, border-box",boxShadow:"0 -7px 20px rgba(7, 0, 18, 0.5), 0 6px 14px rgba(5, 2, 12, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 2px 5px rgba(255, 222, 255, 0.09), inset 0 -2px 0 rgba(12, 7, 27, 0.72), inset 0 -8px 14px rgba(8, 4, 18, 0.34), inset 0 0 0 1px rgba(255, 255, 255, 0.045), inset 0 0 0 2px rgba(17, 10, 35, 0.32)",backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)"};function Dg(){const e=mn(),{topicId:n="1"}=Yl(),a=Vs(n);gr(`انتخاب چالش ${a.title}`);const s=v.useCallback(h=>{const b=h.mission_workflowID;localStorage.setItem("current_mission_type",a.title),localStorage.setItem("current_mission_id",b),localStorage.setItem("current_mission_title",h.title);const k=new URLSearchParams({continueMode:"true",missionId:b,missionType:a.title});e(`/chatbot/${n}?${k.toString()}`,{state:{selectedMissionTitle:h.title,missionType:a.title}})},[a.title,n,e]),[o,l]=v.useState([]),[d,f]=v.useState(!0),[m,g]=v.useState(!1),y=v.useCallback(()=>{e(`/feed/${n}`)},[e,n]);return v.useEffect(()=>{(async()=>{f(!0);const b=await uj(a.title);l(b.missions),f(!1),n==="3"&&(b.missions.length>0?(g(!0),s(b.missions[0])):(alert("چالشی برای این بخش وجود ندارد"),e(`/feed/${n}`)))})()},[a.title,n,e,s]),u.jsxs("div",{className:"fixed inset-0 w-full h-screen overflow-hidden",children:[u.jsx(ba,{position:"fixed",zIndex:0,imageUrl:vn.challenges}),m&&u.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center backdrop-blur-sm",style:{background:"radial-gradient(120% 120% at 50% 0%, rgba(124, 58, 237, 0.36) 0%, rgba(46, 27, 61, 0.9) 55%, rgba(35, 24, 62, 0.96) 100%)"},children:u.jsxs("div",{className:"text-center",children:[u.jsx("div",{className:"inline-block w-12 h-12 border-4 border-[#ffd6f0]/30 border-t-[#ff79cf] rounded-full animate-spin mb-3"}),u.jsx("p",{className:"text-white text-base font-bold",children:"در حال بارگذاری چالش..."})]})}),u.jsxs("div",{className:"relative z-10 max-w-md mx-auto h-full flex flex-col",children:[u.jsx(nc,{showBack:!0,onBack:y,centerTitle:a.title,centerSubtitle:"انتخاب چالش"}),u.jsx("div",{className:"mt-2 flex-1 overflow-y-auto px-4 pb-20",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:u.jsxs("div",{className:"pt-7",children:[u.jsxs("div",{className:"mb-5 rounded-[22px] border-[0.5px] border-transparent px-4 py-3 text-right",style:{backgroundImage:"linear-gradient(180deg, rgba(46, 27, 61, 0.92) 0%, rgba(35, 24, 62, 0.94) 100%), linear-gradient(120deg, #7c3aed 0%, #f97316 58%, #facc15 100%)",backgroundOrigin:"border-box",backgroundClip:"padding-box, border-box",boxShadow:"0 -7px 20px rgba(7, 0, 18, 0.46), 0 6px 14px rgba(5, 2, 12, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.16), inset 0 -2px 0 rgba(12, 7, 27, 0.66)",backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)"},children:[u.jsx("p",{className:"text-[13px] font-bold text-[#FBE7F5]",children:"چالش مناسب رو انتخاب کن و شروع کن"}),u.jsx("p",{className:"mt-1 text-[11px] leading-5 text-[#EED3EC]/90",children:"امتیاز، سختی و زمان هر چالش رو ببین و مستقیم وارد مرحله گفتگو با ربات شو."})]}),u.jsx("div",{className:"w-full space-y-4",dir:"rtl",children:d?u.jsxs(se.div,{initial:{opacity:0},animate:{opacity:1},className:"text-center py-10",children:[u.jsx("div",{className:"inline-block w-10 h-10 border-4 border-[#ffd6f0]/30 border-t-[#ff79cf] rounded-full animate-spin mb-3"}),u.jsx("p",{className:"text-[#ffd6f0] text-xs",children:"در حال بارگذاری چالش‌ها..."})]}):o.length===0?u.jsx(se.div,{initial:{opacity:0},animate:{opacity:1},className:"text-center py-10",children:u.jsx("p",{className:"text-teal-200 text-xs",children:"هیچ چالشی یافت نشد"})}):o.map((h,b)=>u.jsx(se.div,{initial:{x:-80,opacity:0},animate:{x:0,opacity:1},transition:{delay:.3+b*.1,duration:.4},className:"relative",children:u.jsx(se.button,{type:"button",whileHover:{scale:1.01},whileTap:{scale:.99},onClick:()=>s(h),className:"block w-full rounded-[20px] border-[0.5px] border-transparent p-[1px] text-right",style:DN,"aria-label":`شروع چالش ${h.title}`,children:u.jsxs("div",{className:"relative flex min-h-[132px] items-center gap-3 overflow-hidden rounded-[19px] px-3 py-3",style:LN,children:[u.jsx("div",{className:"pointer-events-none absolute inset-0",style:{background:"linear-gradient(115deg, rgba(255,255,255,0.055) 0%, transparent 34%, rgba(255,121,207,0.05) 62%, transparent 100%)"}}),u.jsx("div",{className:"pointer-events-none absolute -left-8 top-0 h-20 w-36 rotate-[-18deg] rounded-full blur-2xl",style:{background:"rgba(255, 121, 207, 0.12)"}}),u.jsx("div",{className:"pointer-events-none absolute bottom-0 right-8 h-16 w-32 rounded-full blur-2xl",style:{background:"rgba(249, 115, 22, 0.1)"}}),u.jsx("div",{className:"relative z-10 h-[104px] w-[104px] flex-shrink-0 overflow-hidden rounded-[16px] border-[0.5px] border-transparent p-[1px]",style:AN,children:u.jsx("img",{src:dj(h.StageID),alt:h.title,className:"h-full w-full rounded-[15px] object-cover",loading:"eager",onError:k=>{k.currentTarget.src=SN,k.currentTarget.style.objectFit="contain"}})}),u.jsxs("div",{className:"relative z-10 min-w-0 flex-1 text-right",children:[u.jsxs("div",{className:"mb-1 flex items-center justify-start gap-2",children:[u.jsx("h3",{className:"truncate text-[18px] font-extrabold leading-7 text-white",children:h.title}),u.jsx("span",{className:"flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-full border-[0.5px] border-transparent text-[#ffb7dd]",style:ON,children:u.jsx(E8,{size:13,fill:"currentColor",strokeWidth:1.5})})]}),u.jsx("p",{className:"mb-3 text-[12px] font-medium leading-5 text-[#F4EAF6]/88",style:{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:h.description}),u.jsxs("div",{className:"flex w-full flex-nowrap items-center justify-between gap-1 text-[10px] font-normal leading-none text-white/90",children:[u.jsxs("span",{className:"inline-flex h-6 shrink-0 items-center gap-1 whitespace-nowrap px-0",children:[u.jsx("span",{className:"leading-none",children:Jd(h.coin_count,"250")}),u.jsx("img",{src:Dx,alt:"سکه",className:"h-4 w-4 shrink-0 object-contain"})]}),u.jsxs("span",{className:"inline-flex h-6 shrink-0 items-center gap-1 whitespace-nowrap px-0",children:[u.jsx("span",{className:"leading-none",children:h.difficulty||"متوسط"}),u.jsx(FN,{})]}),u.jsxs("span",{className:"inline-flex h-6 shrink-0 items-center gap-1 whitespace-nowrap px-0",children:[u.jsx(T6,{size:13,className:"shrink-0 text-[#ffb7dd]",strokeWidth:2.1}),u.jsx("span",{className:"leading-none",children:_N(h.duration)})]})]})]}),u.jsx("span",{className:"relative z-10 flex h-11 w-11 flex-shrink-0 items-center justify-center rounded-full border-[0.5px] border-transparent text-white",style:BN,"aria-hidden":"true",children:u.jsx(mx,{size:22,color:"#ffffff"})})]})})},h.mission_workflowID))})]})})]}),u.jsx(Zi,{}),u.jsx("style",{children:`
.flex-1.overflow-y-auto::-webkit-scrollbar {
display: none;
}
`})]})}const zN=()=>{const e=Ut(),[n]=J5(),{refreshInbox:a}=Qi(),[s,o]=v.useState(()=>{const y=e.state;return y!=null&&y.chats||y!=null&&y.doingMission?{chats:y.chats||[],doingMission:y.doingMission||null,missionType:y.missionType||""}:null}),[l,d]=v.useState(!1),[f,m]=v.useState(null),g=v.useRef(!0);return v.useEffect(()=>(g.current=!0,(async()=>{var M;const h=e.state;if(h!=null&&h.chats||h!=null&&h.doingMission)return;const b=n.get("missionId"),k=n.get("missionType"),C=n.get("continueMode");let N=null,j=null;if(C==="true"&&b&&k?(N=k,j=b,localStorage.setItem("current_mission_type",N),localStorage.setItem("current_mission_id",j)):(N=localStorage.getItem("current_mission_type"),j=localStorage.getItem("current_mission_id")),!(!N||!j)){d(!0),m(null);try{const P=await fj(N,j);if(!g.current)return;(M=P.doing_mission)!=null&&M.workflow_ID&&localStorage.setItem("current_workflow_ID",P.doing_mission.workflow_ID),await a(),o({chats:P.chats,doingMission:P.doing_mission,missionType:N})}catch{if(!g.current)return;m("خطا در بارگذاری ماموریت")}finally{g.current&&d(!1)}}})(),()=>{g.current=!1}),[e.pathname,n,a]),{sessionData:s,isLoading:l,error:f}},VN=e=>e===!0||e==="true"||e==="True",UN=({workflowId:e,onMissionEnd:n})=>{const[a,s]=v.useState([]),[o,l]=v.useState(!1),d=v.useRef(0),f=v.useRef(!0),m=v.useRef(null),g=v.useCallback(async(y,h)=>{console.log("sendMessage called:",{messageText:y,workflowId:e,isSending:o,skipUserMessage:h==null?void 0:h.skipUserMessage});const b=y.trim(),k=b.replace(/\r?\n+/g," ").trim();if(!k||!e){console.log("sendMessage aborted:",{hasMessage:!!k,hasWorkflowId:!!e});return}if(o){console.log("Already sending, skipping");return}const C=++d.current,N=k;try{if(l(!0),!(h!=null&&h.skipUserMessage)){const U={id:`user-${Date.now()}`,type:"user",content:b,mediaType:"text",timestamp:new Date,datetime1:new Date().toLocaleString("fa-IR")};f.current&&C===d.current&&s(W=>[...W,U])}const j=`bot-${Date.now()}`,M=new Date,P=M.toLocaleString("fa-IR");s(U=>[...U,{id:j,type:"bot",content:"",mediaType:"text",timestamp:M,datetime1:P,isTyping:!0}]);const F=await hj(N,e);if(!f.current||C!==d.current)return;if(F.success&&F.message){const U=VN(F.is_mission_end);m.current&&clearInterval(m.current);let W;F.actions&&F.actions.length>0&&F.actions[0].multi_choice&&(W=F.actions[0].multi_choice.map((w,R)=>({id:`action-${Date.now()}-${R}`,label:w,action:`multi_choice_${R}`}))),U&&(W||(W=[]),W.push({id:`submit-challenge-${Date.now()}`,label:"🎯 رفتن به مرحله بعد و ثبت ماموریت",action:"submit-challenge"}),n&&n());let J=0;const A=F.message;m.current=setInterval(()=>{if(!f.current||C!==d.current){m.current&&(clearInterval(m.current),m.current=null);return}if(J<A.length){const w=A.slice(0,J+1);s(R=>R.map(E=>E.id===j?{...E,content:w,isTyping:!0}:E)),J++;return}m.current&&(clearInterval(m.current),m.current=null),s(w=>w.map(R=>R.id===j?{...R,content:A,isTyping:!1,buttons:W}:R))},30)}else s(U=>U.map(W=>W.id===j?{...W,content:"متأسفانه خطایی رخ داد. لطفاً دوباره تلاش کنید.",isTyping:!1}:W))}catch{if(!f.current||C!==d.current)return;s(M=>M.map(P=>P.type==="bot"&&P.isTyping?{...P,content:"متأسفانه خطایی رخ داد. لطفاً دوباره تلاش کنید.",isTyping:!1}:P))}finally{f.current&&C===d.current&&l(!1)}},[e,o,n]);return{messages:a,setMessages:s,isSending:o,sendMessage:g,isTyping:!1,typingText:""}},$N=e=>e===!0||e==="true"||e==="True",HN=e=>{const n=[];if(e.forEach((a,s)=>{const o=a.question&&a.question.trim().toLowerCase()==="شروع";a.question&&a.question.trim()&&!o&&n.push({id:`user-${s}`,type:"user",content:a.question,mediaType:"text",timestamp:new Date,datetime1:a.datetime1}),a.answer&&a.answer.trim()&&n.push({id:`bot-${s}`,type:"bot",content:a.answer,mediaType:"text",timestamp:new Date,datetime1:a.datetime1})}),e.length>0&&n.length>0){const a=e[e.length-1];let s=-1;for(let o=n.length-1;o>=0;o--)if(n[o].type==="bot"){s=o;break}if(s!==-1){let o;a.actions&&a.actions.length>0&&a.actions[0].multi_choice&&(o=a.actions[0].multi_choice.map((l,d)=>({id:`action-init-${d}`,label:l,action:`multi_choice_${d}`}))),$N(a.is_mission_end)===!0&&(o||(o=[]),o.push({id:"submit-challenge-init",label:"🎯 رفتن به مرحله بعد و ثبت ماموریت",action:"submit-challenge"})),o&&o.length>0&&(n[s].buttons=o)}}return n},WN=e=>e==="3"?"/feed/3":-1;function KN({date:e}){return e?u.jsx("div",{className:"sticky z-20 flex justify-center",style:{top:"10px"},children:u.jsx("div",{className:"rounded-full px-4 py-1.5 text-[11px] font-bold text-[#F7D8EF] backdrop-blur-md",style:{background:"linear-gradient(145deg, rgba(35, 28, 69, 0.76) 0%, rgba(25, 22, 55, 0.72) 100%)",boxShadow:"0 0 18px rgba(203,117,171,0.22), 0 8px 18px rgba(8,6,28,0.28), inset 0 1px 0 rgba(255,255,255,0.12)",border:"1px solid rgba(198, 111, 177, 0.36)"},children:`${e}`})}):null}const Ux=e=>{const n=e.trim();if(!n)return{date:"",time:""};if(n.includes(" - ")){const[s="",o=""]=n.split(" - ");return{date:s.trim(),time:o.trim()}}const a=n.match(/^(.+?)[،,]\s*(.+)$/);return a?{date:a[1].trim(),time:a[2].trim()}:{date:n,time:""}},YN=(e,n)=>e?wa(Ux(e).date):n?wa(n.toLocaleDateString("fa-IR")):"",GN=(e,n)=>{if(e){const{time:a}=Ux(e);if(a)return wa(a)}return n?XN(n):""},XN=e=>wa(e.toLocaleTimeString("fa-IR",{hour:"2-digit",minute:"2-digit"}));function JN({duration:e,audioUrl:n}){const[a,s]=v.useState(!1),[o,l]=v.useState(0),[d,f]=v.useState(0),m=()=>{if(s(!a),!a){const g=setInterval(()=>{f(y=>y>=100?(clearInterval(g),s(!1),0):y+1)},100)}};return u.jsxs("div",{className:"rounded-2xl px-4 py-3 flex items-center gap-3 min-w-[240px]",style:{background:"linear-gradient(135deg, rgba(100, 200, 255, 0.9) 0%, rgba(50, 150, 220, 0.9) 100%)",boxShadow:"0 4px 16px rgba(100, 200, 255, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.3)",border:"1.5px solid rgba(150, 220, 255, 0.4)"},children:[u.jsx("button",{onClick:m,className:"w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0 transition-all",style:{background:"rgba(255, 255, 255, 0.25)"},children:a?u.jsx(d8,{className:"w-5 h-5 text-white fill-white"}):u.jsx(qi,{className:"w-5 h-5 text-white fill-white",style:{marginLeft:"2px"}})}),u.jsxs("div",{className:"flex-1 flex flex-col gap-1",children:[u.jsx("div",{className:"h-1 rounded-full bg-white/20 overflow-hidden",children:u.jsx("div",{className:"h-full rounded-full transition-all duration-100",style:{width:`${d}%`,background:"linear-gradient(90deg, #FFFFFF 0%, #E0F7FF 100%)"}})}),u.jsx("div",{className:"flex justify-between items-center",children:u.jsx("span",{className:"text-white/80 text-xs",children:e})})]})]})}function qN({thumbnailUrl:e,duration:n,videoUrl:a}){const[s,o]=v.useState(!1);return u.jsx("div",{className:"rounded-2xl p-3",style:{background:"linear-gradient(135deg, rgba(100, 200, 255, 0.9) 0%, rgba(50, 150, 220, 0.9) 100%)",border:"1.5px solid rgba(150, 220, 255, 0.4)",boxShadow:"0 4px 16px rgba(100, 200, 255, 0.4)"},children:u.jsxs("div",{className:"relative rounded-xl overflow-hidden group cursor-pointer",children:[u.jsx("img",{src:e,alt:"ویدیو",className:"w-full h-auto max-h-64 object-cover"}),u.jsx("div",{className:"absolute inset-0 flex items-center justify-center transition-all",style:{background:"rgba(0, 0, 0, 0.3)"},children:u.jsx("div",{className:"w-16 h-16 rounded-full flex items-center justify-center transition-all group-hover:scale-110",style:{background:"rgba(255, 255, 255, 0.9)",boxShadow:"0 4px 16px rgba(0, 0, 0, 0.3)"},children:u.jsx(qi,{className:"w-7 h-7 fill-blue-500 text-blue-500",style:{marginLeft:"3px"}})})}),u.jsx("div",{className:"absolute bottom-3 right-3 px-2 py-1 rounded text-xs font-bold text-white",style:{background:"rgba(0, 0, 0, 0.6)"},children:n})]})})}const Vi={background:"linear-gradient(145deg, rgba(218, 94, 142, 0.96) 0%, rgba(162, 56, 110, 0.95) 100%)",boxShadow:"0 0 24px rgba(240,110,168,0.28), 0 12px 28px rgba(84, 22, 60, 0.38), inset 0 1px 0 rgba(255,255,255,0.16)",border:"1px solid rgba(255, 178, 214, 0.58)",backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)"},Yf={background:"linear-gradient(145deg, rgba(52, 34, 76, 0.94) 0%, rgba(35, 24, 62, 0.94) 100%)",backgroundImage:"linear-gradient(145deg, rgba(52, 34, 76, 0.94) 0%, rgba(35, 24, 62, 0.94) 100%), linear-gradient(120deg, #7c3aed 0%, #f97316 58%, #facc15 100%)",backgroundOrigin:"border-box",backgroundClip:"padding-box, border-box",boxShadow:"0 0 24px rgba(152,104,235,0.24), 0 12px 28px rgba(12, 8, 30, 0.4), inset 0 1px 0 rgba(255,255,255,0.12)",border:"0.5px solid transparent",backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)"},QN={background:Vi.background,boxShadow:"0 12px 28px rgba(84, 22, 60, 0.38)",border:Vi.border},ZN={background:Yf.background,boxShadow:"0 12px 28px rgba(12, 8, 30, 0.4)",border:"1px solid rgba(186, 145, 235, 0.4)"},eE={background:Vi.background,boxShadow:"0 12px 28px rgba(84, 22, 60, 0.38), inset 0 1px 0 rgba(255,255,255,0.12)",border:Vi.border},tE={background:Yf.background,boxShadow:"0 12px 28px rgba(12, 8, 30, 0.4), inset 0 1px 0 rgba(255,255,255,0.12)",border:"1px solid rgba(186, 145, 235, 0.4)"},vd={background:"linear-gradient(180deg, rgba(46, 27, 61, 0.95) 0%, rgba(35, 24, 62, 0.97) 100%), linear-gradient(120deg, rgba(124, 58, 237, 0.5) 0%, rgba(249, 115, 22, 0.32) 58%, rgba(250, 204, 21, 0.25) 100%)",backgroundOrigin:"border-box",backgroundClip:"padding-box, border-box",border:"1px solid transparent",boxShadow:"0 14px 34px rgba(10, 5, 24, 0.42), 0 0 22px rgba(255, 121, 207, 0.18), inset 0 1px 0 rgba(255,255,255,0.16)",color:"#FBE7F5",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)",width:"fit-content",minWidth:"unset",maxWidth:"max-content",whiteSpace:"nowrap",margin:"0 auto"};function nE({message:e,animationDelay:n,onButtonClick:a}){var j;const s=e.type==="user",o=!s,l=GN(e.datetime1,e.timestamp),d=s?Vi:Yf,f=s?QN:ZN,m=s?eE:tE,g=v.useRef(0),y=e.mediaType==="file"?e.mediaUrl||"":((j=e.content)==null?void 0:j.trim())||"",h=M=>{const P=document.createElement("textarea");P.value=M,P.setAttribute("readonly","true"),P.style.position="fixed",P.style.opacity="0",P.style.pointerEvents="none",P.style.top="0",P.style.left="0",document.body.appendChild(P),P.focus(),P.select(),P.setSelectionRange(0,M.length);let F=!1;try{F=document.execCommand("copy")}finally{document.body.removeChild(P)}return F},b=async()=>{var M;if(y)try{if((M=navigator.clipboard)!=null&&M.writeText&&window.isSecureContext)await navigator.clipboard.writeText(y);else if(!h(y))throw new Error("fallback copy failed");Pl.success("پیام کپی شد",{position:"bottom-center",style:vd})}catch{if(h(y)){Pl.success("پیام کپی شد",{position:"bottom-center",style:vd});return}Pl.error("کپی پیام انجام نشد",{position:"bottom-center",style:vd})}},k=()=>{y&&(g.current=Date.now())},C=()=>{if(!y)return;const M=Date.now()-g.current;g.current=0,M>=450&&b()},N=()=>{g.current=0};return u.jsxs(se.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3,delay:n},className:`flex ${o?"justify-end":"justify-start"} items-start gap-2`,children:[u.jsxs("div",{className:`max-w-[75%] ${o?"ml-0":"mr-0"}`,children:[e.mediaType==="text"&&u.jsx("div",{className:"relative rounded-[18px] px-5 py-3",style:d,onPointerDown:k,onPointerUp:C,onPointerLeave:N,onPointerCancel:N,onContextMenu:M=>{y&&(M.preventDefault(),b())},children:o&&e.isTyping&&!e.content?u.jsxs("div",{className:"flex items-center gap-1 py-1",children:[u.jsx(se.span,{className:"h-2 w-2 rounded-full bg-white/70",animate:{opacity:[.3,1,.3]},transition:{duration:1.3,repeat:1/0,delay:0}}),u.jsx(se.span,{className:"h-2 w-2 rounded-full bg-white/70",animate:{opacity:[.3,1,.3]},transition:{duration:1.3,repeat:1/0,delay:.2}}),u.jsx(se.span,{className:"h-2 w-2 rounded-full bg-white/70",animate:{opacity:[.3,1,.3]},transition:{duration:1.3,repeat:1/0,delay:.4}})]}):u.jsxs("p",{className:"text-white text-sm leading-relaxed whitespace-pre-line",children:[u.jsx($l,{text:e.content}),o&&e.isTyping&&u.jsx("span",{className:"ml-0.5 inline-block h-4 w-0.5 animate-pulse bg-white/70",style:{verticalAlign:"text-bottom"}})]})}),e.mediaType==="image"&&e.content&&u.jsx("div",{className:"rounded-2xl p-3",style:f,onPointerDown:k,onPointerUp:C,onPointerLeave:N,onPointerCancel:N,onContextMenu:M=>{y&&(M.preventDefault(),b())},children:u.jsx("div",{className:"rounded-xl overflow-hidden",style:{boxShadow:"0 2px 8px rgba(0, 0, 0, 0.2)"},children:u.jsx("img",{src:e.content,alt:"تصویر",className:"w-full h-auto max-h-64 object-cover"})})}),e.mediaType==="audio"&&e.mediaUrl&&u.jsx(JN,{duration:e.duration||"0:00",audioUrl:e.mediaUrl}),e.mediaType==="video"&&e.content&&e.mediaUrl&&u.jsx(qN,{thumbnailUrl:e.content,duration:e.duration||"0:00",videoUrl:e.mediaUrl}),e.mediaType==="file"&&e.mediaUrl&&u.jsxs("div",{className:"rounded-3xl px-5 py-4 flex items-center gap-3",style:m,onPointerDown:k,onPointerUp:C,onPointerLeave:N,onPointerCancel:N,onContextMenu:M=>{y&&(M.preventDefault(),b())},children:[u.jsx("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center flex-shrink-0",style:{background:"linear-gradient(135deg, #FFD700 0%, #FFA500 100%)",boxShadow:"0 2px 8px rgba(255, 215, 0, 0.4)"},children:u.jsx(o8,{className:"w-5 h-5 text-white"})}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("p",{className:"text-white text-sm font-bold truncate",children:e.mediaUrl}),u.jsx("p",{className:"text-white/70 text-xs",children:"فایل"})]}),u.jsx("button",{className:"text-white hover:text-white/80 text-xs font-bold px-3 py-1 rounded-lg transition-all",style:{background:"rgba(255, 255, 255, 0.2)"},"aria-label":"دانلود فایل",children:"دانلود"})]}),e.buttons&&e.buttons.length>0&&u.jsx("div",{className:"mt-3 space-y-2",children:e.buttons.map(M=>u.jsx(se.button,{whileTap:{scale:.95},onClick:()=>a(M.id,M.action),className:"w-full rounded-[18px] px-4 py-3 text-center text-sm font-bold transition-all",style:{background:"linear-gradient(135deg, rgba(174, 117, 255, 0.96) 0%, rgba(138, 82, 238, 0.95) 46%, rgba(102, 55, 204, 0.94) 100%)",boxShadow:"0 0 18px rgba(155,108,241,0.4), 0 10px 20px rgba(24, 10, 54, 0.34), inset 0 1px 0 rgba(255,255,255,0.28)",border:"1px solid rgba(212, 184, 255, 0.62)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",color:"#FFFFFF"},"aria-label":M.label,children:u.jsx($l,{text:M.label})},M.id))}),u.jsx("div",{className:`mt-1 text-xs ${o?"text-left":"text-right"}`,style:{color:"rgba(255, 255, 255, 0.5)"},children:l})]}),o&&u.jsx("div",{className:"flex-shrink-0",children:u.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-full border border-[#F0A6D8]/45",style:{background:"radial-gradient(circle at 50% 36%, rgba(255, 187, 232, 0.38) 0%, rgba(134, 74, 164, 0.28) 48%, rgba(26, 18, 54, 0.7) 100%)",boxShadow:"0 0 14px rgba(255,104,205,0.48), 0 0 28px rgba(255,104,205,0.22), inset 0 1px 0 rgba(255,255,255,0.22)"},children:u.jsx("img",{src:rc,alt:"چت‌بات",className:"h-[43px] w-[43px] object-contain"})})})]})}const rE={background:"linear-gradient(145deg, rgba(52, 34, 76, 0.94) 0%, rgba(35, 24, 62, 0.94) 100%)",boxShadow:"0 0 24px rgba(152,104,235,0.24), 0 12px 28px rgba(12, 8, 30, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.12)",border:"1px solid rgba(186, 145, 235, 0.4)"};function aE({isTyping:e,typingText:n}){return u.jsx(pn,{mode:"wait",children:e&&u.jsxs(se.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},className:"flex justify-end items-start gap-2",role:"status","aria-live":"polite","aria-label":n?"در حال نوشتن پاسخ":"در حال تایپ",children:[u.jsx("div",{className:"rounded-3xl px-5 py-3 min-h-[44px] flex items-center",style:rE,children:n?u.jsxs("p",{className:"text-white text-sm leading-relaxed whitespace-pre-line",style:{minHeight:"1.25rem"},children:[n,u.jsx("span",{className:"inline-block w-0.5 h-4 bg-white/70 animate-pulse ml-0.5",style:{verticalAlign:"text-bottom"}})]}):u.jsxs("div",{className:"flex gap-1",children:[u.jsx("div",{className:"w-2 h-2 rounded-full bg-white/60 chat-typing-dot",style:{animationDelay:"0s"}}),u.jsx("div",{className:"w-2 h-2 rounded-full bg-white/60 chat-typing-dot",style:{animationDelay:"0.2s"}}),u.jsx("div",{className:"w-2 h-2 rounded-full bg-white/60 chat-typing-dot",style:{animationDelay:"0.4s"}})]})}),u.jsx("div",{className:"flex-shrink-0",children:u.jsx("img",{src:rc,alt:"چت‌بات",className:"w-12 h-12 rounded-full object-contain",style:{filter:"drop-shadow(0 2px 8px rgba(138, 206, 224, 0.5))"}})})]},"typing-indicator")})}const $x=v.forwardRef(({messages:e,onButtonClick:n,isTyping:a,typingText:s},o)=>{const l=v.useRef(null),d=v.useMemo(()=>{const m=[];for(const g of e){const y=YN(g.datetime1,g.timestamp)||"",h=m[m.length-1];!h||h.date!==y?m.push({id:`group-${m.length}-${y||"unknown"}`,date:y,messages:[g]}):h.messages.push(g)}return m},[e]),f=()=>{var m;(m=l.current)==null||m.scrollIntoView({behavior:"smooth"})};return v.useImperativeHandle(o,()=>({scrollToBottom:f})),v.useEffect(()=>{f()},[e,a,s]),u.jsxs("div",{className:"space-y-4",dir:"rtl",children:[d.map(m=>u.jsxs("div",{className:"space-y-4",children:[u.jsx(KN,{date:m.date}),m.messages.map((g,y)=>{const h=Math.min(y*.05,1);return u.jsx(nE,{message:g,animationDelay:h,onButtonClick:n},g.id)})]},m.id)),u.jsx(aE,{isTyping:a,typingText:s}),u.jsx("div",{ref:l})]})});$x.displayName="ChatMessageList";function Lg(){var J,A,w,R,E,Y;const e=mn(),n=Ut(),{topicId:a="1"}=Yl(),s=Vs(a),o=n.state;gr(`چت‌بات ${s.title}`);const{sessionData:l,isLoading:d,error:f}=zN(),m=((J=o==null?void 0:o.selectedMissionTitle)==null?void 0:J.trim())||((A=localStorage.getItem("current_mission_title"))==null?void 0:A.trim())||((R=(w=l==null?void 0:l.doingMission)==null?void 0:w.title)==null?void 0:R.trim()),[g,y]=v.useState(!1),{messages:h,setMessages:b,isSending:k,sendMessage:C,isTyping:N,typingText:j}=UN({workflowId:((E=l==null?void 0:l.doingMission)==null?void 0:E.workflow_ID)||null,onMissionEnd:()=>y(!0)}),M=v.useRef(!1),P=v.useRef(null),F=v.useRef(null);v.useEffect(()=>{if(l!=null&&l.chats&&l.chats.length>0){const K=HN(l.chats);b(K);const I=l.chats[l.chats.length-1];((I==null?void 0:I.is_mission_end)===!0||(I==null?void 0:I.is_mission_end)==="True")&&y(!0)}},[l,b]),v.useEffect(()=>{var $;const K=($=l==null?void 0:l.doingMission)==null?void 0:$.workflow_ID;if(!K||(P.current!==K&&(P.current=K,M.current=!1),M.current))return;((l==null?void 0:l.chats)||[]).length===0&&(M.current=!0,C("شروع",{skipUserMessage:!0}))},[(Y=l==null?void 0:l.doingMission)==null?void 0:Y.workflow_ID,l==null?void 0:l.chats,C]);const U=(K,I)=>{var $;if(I==="submit-challenge"){e(`/submit/${a}`,{state:{doingMission:l==null?void 0:l.doingMission}});return}if(I.startsWith("multi_choice_")){const ee=h.find(G=>{var z;return(z=G.buttons)==null?void 0:z.some(D=>D.id===K)});if(ee){const G=($=ee.buttons)==null?void 0:$.find(z=>z.id===K);G&&C(G.label)}}},W=()=>{const K=WN(a);e(K)};return d?u.jsxs("div",{className:"relative h-[100dvh] w-full overflow-hidden",children:[u.jsx(ba,{position:"fixed",zIndex:0,imageUrl:vn.chatbot}),u.jsx("div",{className:"relative z-10 flex h-full items-center justify-center text-center text-white",children:u.jsxs("div",{children:[u.jsx("div",{className:"mx-auto mb-3 h-10 w-10 animate-spin rounded-full border-4 border-[#ffd6f0]/30 border-t-[#ff79cf]"}),u.jsx("p",{className:"text-base font-bold",children:"در حال بارگذاری..."})]})})]}):f?u.jsxs("div",{className:"relative h-[100dvh] w-full overflow-hidden",children:[u.jsx(ba,{position:"fixed",zIndex:0,imageUrl:vn.chatbot}),u.jsx("div",{className:"relative z-10 flex h-full items-center justify-center px-4 text-center text-white",children:u.jsxs("div",{children:[u.jsx("p",{className:"text-base text-red-400",children:f}),u.jsx("button",{onClick:W,className:"mt-3 rounded-lg bg-white/20 px-5 py-1.5 text-sm transition hover:bg-white/30",children:"بازگشت"})]})})]}):u.jsxs("div",{className:"relative h-[100dvh] w-full overflow-hidden",children:[u.jsx(ba,{position:"fixed",zIndex:0,imageUrl:vn.chatbot}),u.jsxs("div",{className:"relative z-10 mx-auto grid h-full w-full max-w-md grid-rows-[auto_minmax(0,1fr)_auto]",children:[u.jsx("div",{className:"shrink-0",children:u.jsx(Hf,{topicTitle:m||s.title,subtitle:m?s.title:void 0,onBack:W})}),u.jsx("main",{className:"min-h-0 overflow-y-auto px-3 pb-2",style:{maskImage:"linear-gradient(to bottom, transparent 0%, black 48px)",WebkitMaskImage:"linear-gradient(to bottom, transparent 0%, black 48px)",scrollbarWidth:"none",msOverflowStyle:"none"},children:u.jsx("div",{className:"pt-8",children:u.jsx($x,{ref:F,messages:h,onButtonClick:U,isTyping:N,typingText:j})})}),u.jsx("footer",{className:"shrink-0",style:{paddingBottom:"calc(env(safe-area-inset-bottom, 0px) + 12px)"},children:u.jsx("div",{className:"px-3 pt-2",children:u.jsx(Vx,{onSendMessage:C,disabled:k||N})})})]}),u.jsx("style",{children:`
main::-webkit-scrollbar {
display: none;
}
`})]})}function sE({isOpen:e,onClose:n,topicTitle:a}){const s=v.useMemo(()=>{const o=typeof window<"u"?window.innerWidth:390;return Array.from({length:20},(l,d)=>({id:d,x:Math.random()*o,duration:3+Math.random()*2,delay:Math.random()*2,color:d%2===0?"#FFB800":"#8ACEE0"}))},[]);return u.jsx(pn,{children:e&&u.jsxs(se.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[100] flex items-center justify-center p-4",onClick:n,children:[u.jsx(se.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"absolute inset-0",style:{background:"radial-gradient(circle at center, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.95) 100%)",backdropFilter:"blur(8px)"}}),u.jsxs(se.div,{initial:{scale:.5,opacity:0,y:50},animate:{scale:1,opacity:1,y:0},exit:{scale:.8,opacity:0,y:30},transition:{type:"spring",stiffness:300,damping:25},onClick:o=>o.stopPropagation(),className:"relative max-w-sm w-full",dir:"rtl",children:[Array.from({length:12}).map((o,l)=>u.jsx(se.div,{initial:{opacity:0,scale:0},animate:{opacity:[0,1,0],scale:[0,1.5,0],x:[0,Math.cos(l/12*2*Math.PI)*100],y:[0,Math.sin(l/12*2*Math.PI)*100]},transition:{duration:2,delay:l*.1,repeat:1/0,repeatDelay:1},className:"absolute top-1/2 left-1/2 w-2 h-2 rounded-full",style:{background:"radial-gradient(circle, rgba(255, 215, 0, 1) 0%, rgba(255, 165, 0, 0.8) 100%)",boxShadow:"0 0 10px rgba(255, 215, 0, 0.8)"}},l)),u.jsxs("div",{className:"relative overflow-hidden rounded-3xl p-8",style:{background:"linear-gradient(135deg, rgba(30, 60, 90, 0.95) 0%, rgba(20, 40, 70, 0.98) 100%)",border:"3px solid rgba(138, 206, 224, 0.6)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(138, 206, 224, 0.3), inset 0 2px 10px rgba(138, 206, 224, 0.2)"},children:[u.jsx(se.div,{animate:{background:["radial-gradient(circle at 20% 20%, rgba(138, 206, 224, 0.15) 0%, transparent 50%)","radial-gradient(circle at 80% 80%, rgba(138, 206, 224, 0.15) 0%, transparent 50%)","radial-gradient(circle at 20% 20%, rgba(138, 206, 224, 0.15) 0%, transparent 50%)"]},transition:{duration:4,repeat:1/0},className:"absolute inset-0 pointer-events-none"}),u.jsx("div",{className:"flex justify-center mb-4",children:u.jsxs(se.div,{initial:{scale:0,rotate:-180},animate:{scale:1,rotate:0},transition:{delay:.2,type:"spring",stiffness:200},className:"relative",children:[u.jsx("div",{className:"w-20 h-20 rounded-full flex items-center justify-center",style:{background:"linear-gradient(135deg, #4ade80 0%, #22c55e 100%)",boxShadow:"0 10px 30px rgba(34, 197, 94, 0.5), inset 0 2px 10px rgba(255, 255, 255, 0.3)"},children:u.jsx(g6,{className:"w-10 h-10 text-white",strokeWidth:3})}),u.jsx(se.div,{animate:{scale:[1,1.3,1],opacity:[.5,0,.5]},transition:{duration:2,repeat:1/0},className:"absolute inset-0 rounded-full",style:{background:"radial-gradient(circle, rgba(74, 222, 128, 0.6) 0%, transparent 70%)"}})]})}),u.jsx(se.h2,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.3},className:"text-2xl font-black text-center mb-3",style:{color:"#8ACEE0",textShadow:"0 2px 10px rgba(138, 206, 224, 0.5), 0 0 20px rgba(138, 206, 224, 0.3)"},children:"🎉 تبریک! 🎉"}),u.jsxs(se.div,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.5},className:"space-y-3 mb-6",children:[u.jsx("p",{className:"text-white text-center text-base leading-relaxed font-bold",children:"چالش با موفقیت به پایان رسید!"}),u.jsx("p",{className:"text-white/80 text-center text-sm leading-relaxed",children:"پست شما بعد از بررسی منتشر می‌شود"})]}),u.jsx(se.div,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},transition:{delay:.7,type:"spring",stiffness:150},className:"relative mb-6",children:u.jsxs("div",{className:"relative overflow-hidden rounded-2xl p-6",style:{background:"linear-gradient(135deg, rgba(255, 184, 0, 0.2) 0%, rgba(255, 140, 0, 0.15) 100%)",border:"2px solid rgba(255, 184, 0, 0.5)",boxShadow:"0 10px 30px rgba(255, 165, 0, 0.3), inset 0 2px 8px rgba(255, 255, 255, 0.2)"},children:[u.jsx(se.div,{animate:{x:["-100%","200%"]},transition:{duration:2,repeat:1/0,repeatDelay:1},className:"absolute inset-0",style:{background:"linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%)"}}),u.jsxs("div",{className:"flex items-center justify-center gap-3 mb-2",children:[u.jsx(se.div,{animate:{rotate:[0,10,-10,0]},transition:{duration:1,repeat:1/0,repeatDelay:1},children:u.jsx(xx,{className:"w-8 h-8",style:{color:"#FFB800"}})}),u.jsx("h3",{className:"text-xl font-black",style:{color:"#FFB800",textShadow:"0 2px 10px rgba(255, 184, 0, 0.5)"},children:"جایزه دریافت شد!"}),u.jsx(se.div,{animate:{rotate:[0,-10,10,0]},transition:{duration:1,repeat:1/0,repeatDelay:1,delay:.2},children:u.jsx(C8,{className:"w-7 h-7",style:{color:"#FFB800"}})})]}),u.jsxs("p",{className:"text-white text-center text-base font-bold leading-relaxed",children:["مدال ",u.jsx("span",{style:{color:"#FFB800"},children:a})," به کیف جادوییت اضافه شد!"]})]})}),u.jsx(se.button,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.9},whileHover:{scale:1.05},whileTap:{scale:.95},onClick:n,className:"w-full py-4 rounded-full font-black text-lg",style:{background:"linear-gradient(180deg, #8ACEE0 0%, #5A9FB0 100%)",boxShadow:"0 6px 20px rgba(138, 206, 224, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.3)",color:"#0a1f2e",textShadow:"0 1px 0 rgba(255, 255, 255, 0.3)"},children:"باشه، بریم!"})]})]}),s.map(o=>u.jsx(se.div,{initial:{x:o.x,y:window.innerHeight+20,opacity:0},animate:{y:-20,opacity:[0,1,0]},transition:{duration:o.duration,delay:o.delay,repeat:1/0},className:"absolute w-1 h-1 rounded-full",style:{background:o.color,boxShadow:`0 0 6px ${o.color}`}},`particle-${o.id}`))]})})}function Ag(){var P,F;const e=mn(),n=Ut(),{topicId:a="1"}=Yl(),s=Vs(a);gr(`ثبت ماموریت ${s.title}`);const{addNewItem:o}=Ax(),{refreshInbox:l}=Qi(),[d,f]=v.useState(!1),m=v.useRef(null),[g,y]=v.useState(172),h=(P=n.state)==null?void 0:P.doingMission,b=(F=n.state)==null?void 0:F.selectedMissionTitle,k=v.useMemo(()=>b||localStorage.getItem("current_mission_title")||(h==null?void 0:h.title)||"چالش انتخاب‌شده",[b,h]),C=v.useCallback(()=>{e(-1)},[e]),N=U=>{console.log("Submitting challenge:",U),f(!0),o(),l()},j=()=>{f(!1),e(`/feed/${a}`)},M=s.formComponent;return v.useLayoutEffect(()=>{const U=()=>{var A;const J=((A=m.current)==null?void 0:A.getBoundingClientRect().height)??0;J>0&&y(Math.ceil(J))};U();const W=new ResizeObserver(()=>{U()});return m.current&&W.observe(m.current),window.addEventListener("resize",U),()=>{W.disconnect(),window.removeEventListener("resize",U)}},[]),u.jsxs("div",{className:"min-h-screen w-full relative overflow-hidden",children:[u.jsx(ba,{position:"fixed",zIndex:0,imageUrl:vn.submitChallenge}),u.jsxs("div",{className:"relative z-10 max-w-md mx-auto",children:[u.jsxs("div",{ref:m,children:[u.jsx(nc,{showBack:!0,onBack:C}),u.jsx("div",{className:"px-4 pb-2 text-center",children:u.jsx("h2",{className:"mt-1 text-[20px] font-extrabold leading-8",style:{display:"inline-block",background:"linear-gradient(90deg, #F6D8A5 0%, #F3A599 20%, #DB7EB2 48%, #AA6798 72%, #CB75AB 100%)",WebkitBackgroundClip:"text",backgroundClip:"text",WebkitTextFillColor:"transparent",color:"transparent",textShadow:"0 2px 10px rgba(255, 119, 202, 0.4)"},children:`ثبت چالش ${k}`})})]}),u.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 max-w-md mx-auto overflow-hidden",style:{paddingTop:`${g}px`,zIndex:1},children:u.jsx("div",{className:"h-full overflow-y-auto relative px-[24px] pt-[2px] pb-[132px]",style:{scrollbarWidth:"none",msOverflowStyle:"none",maskImage:"linear-gradient(to bottom, transparent 0%, black 4px)",WebkitMaskImage:"linear-gradient(to bottom, transparent 0%, black 4px)"},children:u.jsx(M,{topicId:a,topicTitle:s.title,onSubmit:N,doingMission:h})})})]}),u.jsx("style",{children:`
.h-full.overflow-y-auto::-webkit-scrollbar { display: none; }
`}),u.jsx(Zi,{}),u.jsx(sE,{isOpen:d,onClose:j,topicTitle:s.title})]})}function Hx(e){return u.jsx(N1,{children:e})}function Ba(e){return Hx(u.jsx(e,{}))}const iE=H5([{path:"/login",element:u.jsx(Q8,{})},{path:"/",element:Hx(u.jsx(Dj,{})),handle:{header:{title:"خانه",showBack:!1,action:"profile"}},children:[{index:!0,element:u.jsx(lC,{}),handle:{header:{title:"خانه",showBack:!1,action:"profile"}}},{path:"public-chat",element:u.jsx(UC,{}),handle:{header:{title:"چت با ربات",showBack:!0,backTo:"/",action:"history"}}},{path:"magic-bag",element:u.jsx(vC,{}),handle:{header:{title:"کیف جادویی",showBack:!1,action:"profile"}}},{path:"messages",element:u.jsx(wC,{}),handle:{header:{title:"اعلان‌ها",showBack:!1,action:"profile"}}},{path:"profile",element:u.jsx(gC,{}),handle:{header:{title:"پروفایل",showBack:!1,action:"profile"}}},{path:"edit-profile",element:u.jsx(yC,{}),handle:{header:{title:"ویرایش پروفایل",showBack:!0,backTo:"/profile",action:"settings"}}}]},{path:"/feed/:topicId",element:Ba(kN)},{path:"/challenges/:topicId",element:Ba(Dg)},{path:"/chatbot/:topicId",element:Ba(Lg)},{path:"/submit/:topicId",element:Ba(Ag)},{path:"/challenges",element:Ba(Dg)},{path:"/chatbot",element:Ba(Lg)},{path:"/submit-challenge",element:Ba(Ag)}]);function oE(){return u.jsx("div",{className:"fixed inset-0 flex items-center justify-center",style:{background:"radial-gradient(120% 120% at 50% 0%, rgba(124, 58, 237, 0.32) 0%, rgba(46, 27, 61, 1) 52%, rgba(35, 24, 62, 1) 100%)"},children:u.jsx("div",{className:"h-9 w-9 animate-spin rounded-full border-2 border-[#ffd6f0]/30 border-t-[#ff79cf]","aria-label":"در حال بارگذاری"})})}function lE(){return u.jsx(z8,{children:u.jsx(bj,{children:u.jsx(K8,{children:u.jsxs(U8,{children:[u.jsx(rw,{router:iE,fallbackElement:u.jsx(oE,{})}),u.jsx(bN,{position:"top-center",richColors:!0,dir:"rtl",toastOptions:{style:{fontFamily:"Alibaba, sans-serif",direction:"rtl",textAlign:"right"}}})]})})})})}Iv.createRoot(document.getElementById("root")).render(u.jsx(lE,{}));