(()=>{"use strict";var e={551(e,t,n){
/**
 * @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 a=n(540),r=n(982);function i(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var l=new Set,o={};function c(e,t){u(e,t),u(e+"Capture",t)}function u(e,t){for(o[e]=t,e=0;e<t.length;e++)l.add(t[e])}var s=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),m=Object.prototype.hasOwnProperty,f=/^[: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]*$/,d={},p={};function v(e,t,n,a,r,i,l){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=a,this.attributeNamespace=r,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=l}var y={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){y[e]=new v(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];y[t]=new v(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){y[e]=new v(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){y[e]=new v(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){y[e]=new v(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){y[e]=new v(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){y[e]=new v(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){y[e]=new v(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){y[e]=new v(e,5,!1,e.toLowerCase(),null,!1,!1)});var g=/[\-:]([a-z])/g;function b(e){return e[1].toUpperCase()}function h(e,t,n,a){var r=y.hasOwnProperty(t)?y[t]:null;(null!==r?0!==r.type:a||!(2<t.length)||"o"!==t[0]&&"O"!==t[0]||"n"!==t[1]&&"N"!==t[1])&&(function(e,t,n,a){if(null==t||function(e,t,n,a){if(null!==n&&0===n.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!a&&(null!==n?!n.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,n,a))return!0;if(a)return!1;if(null!==n)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(t,n,r,a)&&(n=null),a||null===r?function(e){return!!m.call(p,e)||!m.call(d,e)&&(f.test(e)?p[e]=!0:(d[e]=!0,!1))}(t)&&(null===n?e.removeAttribute(t):e.setAttribute(t,""+n)):r.mustUseProperty?e[r.propertyName]=null===n?3!==r.type&&"":n:(t=r.attributeName,a=r.attributeNamespace,null===n?e.removeAttribute(t):(n=3===(r=r.type)||4===r&&!0===n?"":""+n,a?e.setAttributeNS(a,t,n):e.setAttribute(t,n))))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(g,b);y[t]=new v(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(g,b);y[t]=new v(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(g,b);y[t]=new v(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!1,!1)}),y.xlinkHref=new v("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!0,!0)});var E=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,x=Symbol.for("react.element"),k=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),_=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),S=Symbol.for("react.provider"),C=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),A=Symbol.for("react.lazy");Symbol.for("react.scope"),Symbol.for("react.debug_trace_mode");var D=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden"),Symbol.for("react.cache"),Symbol.for("react.tracing_marker");var F=Symbol.iterator;function L(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=F&&e[F]||e["@@iterator"])?e:null}var z,R=Object.assign;function I(e){if(void 0===z)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);z=t&&t[1]||""}return"\n"+z+e}var M=!1;function B(e,t){if(!e||M)return"";M=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(t,[])}catch(e){var a=e}Reflect.construct(e,[],t)}else{try{t.call()}catch(e){a=e}e.call(t.prototype)}else{try{throw Error()}catch(e){a=e}e()}}catch(t){if(t&&a&&"string"==typeof t.stack){for(var r=t.stack.split("\n"),i=a.stack.split("\n"),l=r.length-1,o=i.length-1;1<=l&&0<=o&&r[l]!==i[o];)o--;for(;1<=l&&0<=o;l--,o--)if(r[l]!==i[o]){if(1!==l||1!==o)do{if(l--,0>--o||r[l]!==i[o]){var c="\n"+r[l].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}}while(1<=l&&0<=o);break}}}finally{M=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?I(e):""}function U(e){switch(e.tag){case 5:return I(e.type);case 16:return I("Lazy");case 13:return I("Suspense");case 19:return I("SuspenseList");case 0:case 2:case 15:return e=B(e.type,!1);case 11:return e=B(e.type.render,!1);case 1:return e=B(e.type,!0);default:return""}}function W(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case w:return"Fragment";case k:return"Portal";case N:return"Profiler";case _:return"StrictMode";case O:return"Suspense";case j:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case C:return(e.displayName||"Context")+".Consumer";case S:return(e._context.displayName||"Context")+".Provider";case P:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case T:return null!==(t=e.displayName||null)?t:W(e.type)||"Memo";case A:t=e._payload,e=e._init;try{return W(e(t))}catch(e){}}return null}function V(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=(e=t.render).displayName||e.name||"",t.displayName||(""!==e?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return W(t);case 8:return t===_?"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("function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t}return null}function $(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function G(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function H(e){e._valueTracker||(e._valueTracker=function(e){var t=G(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),a=""+e[t];if(!e.hasOwnProperty(t)&&void 0!==n&&"function"==typeof n.get&&"function"==typeof n.set){var r=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(e){a=""+e,i.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return a},setValue:function(e){a=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function Q(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),a="";return e&&(a=G(e)?e.checked?"true":"false":e.value),(e=a)!==n&&(t.setValue(e),!0)}function Y(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}function q(e,t){var n=t.checked;return R({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:e._wrapperState.initialChecked})}function X(e,t){var n=null==t.defaultValue?"":t.defaultValue,a=null!=t.checked?t.checked:t.defaultChecked;n=$(null!=t.value?t.value:n),e._wrapperState={initialChecked:a,initialValue:n,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function K(e,t){null!=(t=t.checked)&&h(e,"checked",t,!1)}function J(e,t){K(e,t);var n=$(t.value),a=t.type;if(null!=n)"number"===a?(0===n&&""===e.value||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if("submit"===a||"reset"===a)return void e.removeAttribute("value");t.hasOwnProperty("value")?ee(e,t.type,n):t.hasOwnProperty("defaultValue")&&ee(e,t.type,$(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function Z(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var a=t.type;if(!("submit"!==a&&"reset"!==a||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}""!==(n=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==n&&(e.name=n)}function ee(e,t,n){"number"===t&&Y(e.ownerDocument)===e||(null==n?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var te=Array.isArray;function ne(e,t,n,a){if(e=e.options,t){t={};for(var r=0;r<n.length;r++)t["$"+n[r]]=!0;for(n=0;n<e.length;n++)r=t.hasOwnProperty("$"+e[n].value),e[n].selected!==r&&(e[n].selected=r),r&&a&&(e[n].defaultSelected=!0)}else{for(n=""+$(n),t=null,r=0;r<e.length;r++){if(e[r].value===n)return e[r].selected=!0,void(a&&(e[r].defaultSelected=!0));null!==t||e[r].disabled||(t=e[r])}null!==t&&(t.selected=!0)}}function ae(e,t){if(null!=t.dangerouslySetInnerHTML)throw Error(i(91));return R({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function re(e,t){var n=t.value;if(null==n){if(n=t.children,t=t.defaultValue,null!=n){if(null!=t)throw Error(i(92));if(te(n)){if(1<n.length)throw Error(i(93));n=n[0]}t=n}null==t&&(t=""),n=t}e._wrapperState={initialValue:$(n)}}function ie(e,t){var n=$(t.value),a=$(t.defaultValue);null!=n&&((n=""+n)!==e.value&&(e.value=n),null==t.defaultValue&&e.defaultValue!==n&&(e.defaultValue=n)),null!=a&&(e.defaultValue=""+a)}function le(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}function oe(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function ce(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?oe(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var ue,se,me=(se=function(e,t){if("http://www.w3.org/2000/svg"!==e.namespaceURI||"innerHTML"in e)e.innerHTML=t;else{for((ue=ue||document.createElement("div")).innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=ue.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,n,a){MSApp.execUnsafeLocalFunction(function(){return se(e,t)})}:se);function fe(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}var de={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},pe=["Webkit","ms","Moz","O"];function ve(e,t,n){return null==t||"boolean"==typeof t||""===t?"":n||"number"!=typeof t||0===t||de.hasOwnProperty(e)&&de[e]?(""+t).trim():t+"px"}function ye(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var a=0===n.indexOf("--"),r=ve(n,t[n],a);"float"===n&&(n="cssFloat"),a?e.setProperty(n,r):e[n]=r}}Object.keys(de).forEach(function(e){pe.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),de[t]=de[e]})});var ge=R({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 be(e,t){if(t){if(ge[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(i(137,e));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(i(60));if("object"!=typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(i(61))}if(null!=t.style&&"object"!=typeof t.style)throw Error(i(62))}}function he(e,t){if(-1===e.indexOf("-"))return"string"==typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ee=null;function xe(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var ke=null,we=null,_e=null;function Ne(e){if(e=hr(e)){if("function"!=typeof ke)throw Error(i(280));var t=e.stateNode;t&&(t=xr(t),ke(e.stateNode,e.type,t))}}function Se(e){we?_e?_e.push(e):_e=[e]:we=e}function Ce(){if(we){var e=we,t=_e;if(_e=we=null,Ne(e),t)for(e=0;e<t.length;e++)Ne(t[e])}}function Pe(e,t){return e(t)}function Oe(){}var je=!1;function Te(e,t,n){if(je)return e(t,n);je=!0;try{return Pe(e,t,n)}finally{je=!1,(null!==we||null!==_e)&&(Oe(),Ce())}}function Ae(e,t){var n=e.stateNode;if(null===n)return null;var a=xr(n);if(null===a)return null;n=a[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(a=!a.disabled)||(a=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!a;break e;default:e=!1}if(e)return null;if(n&&"function"!=typeof n)throw Error(i(231,t,typeof n));return n}var De=!1;if(s)try{var Fe={};Object.defineProperty(Fe,"passive",{get:function(){De=!0}}),window.addEventListener("test",Fe,Fe),window.removeEventListener("test",Fe,Fe)}catch(se){De=!1}function Le(e,t,n,a,r,i,l,o,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(e){this.onError(e)}}var ze=!1,Re=null,Ie=!1,Me=null,Be={onError:function(e){ze=!0,Re=e}};function Ue(e,t,n,a,r,i,l,o,c){ze=!1,Re=null,Le.apply(Be,arguments)}function We(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{!!(4098&(t=e).flags)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function Ve(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function $e(e){if(We(e)!==e)throw Error(i(188))}function Ge(e){return null!==(e=function(e){var t=e.alternate;if(!t){if(null===(t=We(e)))throw Error(i(188));return t!==e?null:e}for(var n=e,a=t;;){var r=n.return;if(null===r)break;var l=r.alternate;if(null===l){if(null!==(a=r.return)){n=a;continue}break}if(r.child===l.child){for(l=r.child;l;){if(l===n)return $e(r),e;if(l===a)return $e(r),t;l=l.sibling}throw Error(i(188))}if(n.return!==a.return)n=r,a=l;else{for(var o=!1,c=r.child;c;){if(c===n){o=!0,n=r,a=l;break}if(c===a){o=!0,a=r,n=l;break}c=c.sibling}if(!o){for(c=l.child;c;){if(c===n){o=!0,n=l,a=r;break}if(c===a){o=!0,a=l,n=r;break}c=c.sibling}if(!o)throw Error(i(189))}}if(n.alternate!==a)throw Error(i(190))}if(3!==n.tag)throw Error(i(188));return n.stateNode.current===n?e:t}(e))?He(e):null}function He(e){if(5===e.tag||6===e.tag)return e;for(e=e.child;null!==e;){var t=He(e);if(null!==t)return t;e=e.sibling}return null}var Qe=r.unstable_scheduleCallback,Ye=r.unstable_cancelCallback,qe=r.unstable_shouldYield,Xe=r.unstable_requestPaint,Ke=r.unstable_now,Je=r.unstable_getCurrentPriorityLevel,Ze=r.unstable_ImmediatePriority,et=r.unstable_UserBlockingPriority,tt=r.unstable_NormalPriority,nt=r.unstable_LowPriority,at=r.unstable_IdlePriority,rt=null,it=null;var lt=Math.clz32?Math.clz32:function(e){return e>>>=0,0===e?32:31-(ot(e)/ct|0)|0},ot=Math.log,ct=Math.LN2;var ut=64,st=4194304;function mt(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194240&e;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return 130023424&e;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ft(e,t){var n=e.pendingLanes;if(0===n)return 0;var a=0,r=e.suspendedLanes,i=e.pingedLanes,l=268435455&n;if(0!==l){var o=l&~r;0!==o?a=mt(o):0!==(i&=l)&&(a=mt(i))}else 0!==(l=n&~r)?a=mt(l):0!==i&&(a=mt(i));if(0===a)return 0;if(0!==t&&t!==a&&0===(t&r)&&((r=a&-a)>=(i=t&-t)||16===r&&4194240&i))return t;if(4&a&&(a|=16&n),0!==(t=e.entangledLanes))for(e=e.entanglements,t&=a;0<t;)r=1<<(n=31-lt(t)),a|=e[n],t&=~r;return a}function dt(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;default:return-1}}function pt(e){return 0!==(e=-1073741825&e.pendingLanes)?e:1073741824&e?1073741824:0}function vt(){var e=ut;return!(4194240&(ut<<=1))&&(ut=64),e}function yt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function gt(e,t,n){e.pendingLanes|=t,536870912!==t&&(e.suspendedLanes=0,e.pingedLanes=0),(e=e.eventTimes)[t=31-lt(t)]=n}function bt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var a=31-lt(n),r=1<<a;r&t|e[a]&t&&(e[a]|=t),n&=~r}}var ht=0;function Et(e){return 1<(e&=-e)?4<e?268435455&e?16:536870912:4:1}var xt,kt,wt,_t,Nt,St=!1,Ct=[],Pt=null,Ot=null,jt=null,Tt=new Map,At=new Map,Dt=[],Ft="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 Lt(e,t){switch(e){case"focusin":case"focusout":Pt=null;break;case"dragenter":case"dragleave":Ot=null;break;case"mouseover":case"mouseout":jt=null;break;case"pointerover":case"pointerout":Tt.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":At.delete(t.pointerId)}}function zt(e,t,n,a,r,i){return null===e||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:a,nativeEvent:i,targetContainers:[r]},null!==t&&(null!==(t=hr(t))&&kt(t)),e):(e.eventSystemFlags|=a,t=e.targetContainers,null!==r&&-1===t.indexOf(r)&&t.push(r),e)}function Rt(e){var t=br(e.target);if(null!==t){var n=We(t);if(null!==n)if(13===(t=n.tag)){if(null!==(t=Ve(n)))return e.blockedOn=t,void Nt(e.priority,function(){wt(n)})}else if(3===t&&n.stateNode.current.memoizedState.isDehydrated)return void(e.blockedOn=3===n.tag?n.stateNode.containerInfo:null)}e.blockedOn=null}function It(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var n=qt(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==n)return null!==(t=hr(n))&&kt(t),e.blockedOn=n,!1;var a=new(n=e.nativeEvent).constructor(n.type,n);Ee=a,n.target.dispatchEvent(a),Ee=null,t.shift()}return!0}function Mt(e,t,n){It(e)&&n.delete(t)}function Bt(){St=!1,null!==Pt&&It(Pt)&&(Pt=null),null!==Ot&&It(Ot)&&(Ot=null),null!==jt&&It(jt)&&(jt=null),Tt.forEach(Mt),At.forEach(Mt)}function Ut(e,t){e.blockedOn===t&&(e.blockedOn=null,St||(St=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,Bt)))}function Wt(e){function t(t){return Ut(t,e)}if(0<Ct.length){Ut(Ct[0],e);for(var n=1;n<Ct.length;n++){var a=Ct[n];a.blockedOn===e&&(a.blockedOn=null)}}for(null!==Pt&&Ut(Pt,e),null!==Ot&&Ut(Ot,e),null!==jt&&Ut(jt,e),Tt.forEach(t),At.forEach(t),n=0;n<Dt.length;n++)(a=Dt[n]).blockedOn===e&&(a.blockedOn=null);for(;0<Dt.length&&null===(n=Dt[0]).blockedOn;)Rt(n),null===n.blockedOn&&Dt.shift()}var Vt=E.ReactCurrentBatchConfig,$t=!0;function Gt(e,t,n,a){var r=ht,i=Vt.transition;Vt.transition=null;try{ht=1,Qt(e,t,n,a)}finally{ht=r,Vt.transition=i}}function Ht(e,t,n,a){var r=ht,i=Vt.transition;Vt.transition=null;try{ht=4,Qt(e,t,n,a)}finally{ht=r,Vt.transition=i}}function Qt(e,t,n,a){if($t){var r=qt(e,t,n,a);if(null===r)$a(e,t,a,Yt,n),Lt(e,a);else if(function(e,t,n,a,r){switch(t){case"focusin":return Pt=zt(Pt,e,t,n,a,r),!0;case"dragenter":return Ot=zt(Ot,e,t,n,a,r),!0;case"mouseover":return jt=zt(jt,e,t,n,a,r),!0;case"pointerover":var i=r.pointerId;return Tt.set(i,zt(Tt.get(i)||null,e,t,n,a,r)),!0;case"gotpointercapture":return i=r.pointerId,At.set(i,zt(At.get(i)||null,e,t,n,a,r)),!0}return!1}(r,e,t,n,a))a.stopPropagation();else if(Lt(e,a),4&t&&-1<Ft.indexOf(e)){for(;null!==r;){var i=hr(r);if(null!==i&&xt(i),null===(i=qt(e,t,n,a))&&$a(e,t,a,Yt,n),i===r)break;r=i}null!==r&&a.stopPropagation()}else $a(e,t,a,null,n)}}var Yt=null;function qt(e,t,n,a){if(Yt=null,null!==(e=br(e=xe(a))))if(null===(t=We(e)))e=null;else if(13===(n=t.tag)){if(null!==(e=Ve(t)))return e;e=null}else if(3===n){if(t.stateNode.current.memoizedState.isDehydrated)return 3===t.tag?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Yt=e,null}function Xt(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Je()){case Ze:return 1;case et:return 4;case tt:case nt:return 16;case at:return 536870912;default:return 16}default:return 16}}var Kt=null,Jt=null,Zt=null;function en(){if(Zt)return Zt;var e,t,n=Jt,a=n.length,r="value"in Kt?Kt.value:Kt.textContent,i=r.length;for(e=0;e<a&&n[e]===r[e];e++);var l=a-e;for(t=1;t<=l&&n[a-t]===r[i-t];t++);return Zt=r.slice(e,1<t?1-t:void 0)}function tn(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}function nn(){return!0}function an(){return!1}function rn(e){function t(t,n,a,r,i){for(var l in this._reactName=t,this._targetInst=a,this.type=n,this.nativeEvent=r,this.target=i,this.currentTarget=null,e)e.hasOwnProperty(l)&&(t=e[l],this[l]=t?t(r):r[l]);return this.isDefaultPrevented=(null!=r.defaultPrevented?r.defaultPrevented:!1===r.returnValue)?nn:an,this.isPropagationStopped=an,this}return R(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=nn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=nn)},persist:function(){},isPersistent:nn}),t}var ln,on,cn,un={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},sn=rn(un),mn=R({},un,{view:0,detail:0}),fn=rn(mn),dn=R({},mn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Nn,button:0,buttons:0,relatedTarget:function(e){return void 0===e.relatedTarget?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==cn&&(cn&&"mousemove"===e.type?(ln=e.screenX-cn.screenX,on=e.screenY-cn.screenY):on=ln=0,cn=e),ln)},movementY:function(e){return"movementY"in e?e.movementY:on}}),pn=rn(dn),vn=rn(R({},dn,{dataTransfer:0})),yn=rn(R({},mn,{relatedTarget:0})),gn=rn(R({},un,{animationName:0,elapsedTime:0,pseudoElement:0})),bn=R({},un,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),hn=rn(bn),En=rn(R({},un,{data:0})),xn={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},kn={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"},wn={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function _n(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=wn[e])&&!!t[e]}function Nn(){return _n}var Sn=R({},mn,{key:function(e){if(e.key){var t=xn[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=tn(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?kn[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Nn,charCode:function(e){return"keypress"===e.type?tn(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?tn(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),Cn=rn(Sn),Pn=rn(R({},dn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),On=rn(R({},mn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Nn})),jn=rn(R({},un,{propertyName:0,elapsedTime:0,pseudoElement:0})),Tn=R({},dn,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),An=rn(Tn),Dn=[9,13,27,32],Fn=s&&"CompositionEvent"in window,Ln=null;s&&"documentMode"in document&&(Ln=document.documentMode);var zn=s&&"TextEvent"in window&&!Ln,Rn=s&&(!Fn||Ln&&8<Ln&&11>=Ln),In=String.fromCharCode(32),Mn=!1;function Bn(e,t){switch(e){case"keyup":return-1!==Dn.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Un(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var Wn=!1;var Vn={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function $n(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Vn[e.type]:"textarea"===t}function Gn(e,t,n,a){Se(a),0<(t=Ha(t,"onChange")).length&&(n=new sn("onChange","change",null,n,a),e.push({event:n,listeners:t}))}var Hn=null,Qn=null;function Yn(e){Ia(e,0)}function qn(e){if(Q(Er(e)))return e}function Xn(e,t){if("change"===e)return t}var Kn=!1;if(s){var Jn;if(s){var Zn="oninput"in document;if(!Zn){var ea=document.createElement("div");ea.setAttribute("oninput","return;"),Zn="function"==typeof ea.oninput}Jn=Zn}else Jn=!1;Kn=Jn&&(!document.documentMode||9<document.documentMode)}function ta(){Hn&&(Hn.detachEvent("onpropertychange",na),Qn=Hn=null)}function na(e){if("value"===e.propertyName&&qn(Qn)){var t=[];Gn(t,Qn,e,xe(e)),Te(Yn,t)}}function aa(e,t,n){"focusin"===e?(ta(),Qn=n,(Hn=t).attachEvent("onpropertychange",na)):"focusout"===e&&ta()}function ra(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return qn(Qn)}function ia(e,t){if("click"===e)return qn(t)}function la(e,t){if("input"===e||"change"===e)return qn(t)}var oa="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t};function ca(e,t){if(oa(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),a=Object.keys(t);if(n.length!==a.length)return!1;for(a=0;a<n.length;a++){var r=n[a];if(!m.call(t,r)||!oa(e[r],t[r]))return!1}return!0}function ua(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function sa(e,t){var n,a=ua(e);for(e=0;a;){if(3===a.nodeType){if(n=e+a.textContent.length,e<=t&&n>=t)return{node:a,offset:t-e};e=n}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=ua(a)}}function ma(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?ma(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function fa(){for(var e=window,t=Y();t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch(e){n=!1}if(!n)break;t=Y((e=t.contentWindow).document)}return t}function da(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}function pa(e){var t=fa(),n=e.focusedElem,a=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&ma(n.ownerDocument.documentElement,n)){if(null!==a&&da(n))if(t=a.start,void 0===(e=a.end)&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if((e=(t=n.ownerDocument||document)&&t.defaultView||window).getSelection){e=e.getSelection();var r=n.textContent.length,i=Math.min(a.start,r);a=void 0===a.end?i:Math.min(a.end,r),!e.extend&&i>a&&(r=a,a=i,i=r),r=sa(n,i);var l=sa(n,a);r&&l&&(1!==e.rangeCount||e.anchorNode!==r.node||e.anchorOffset!==r.offset||e.focusNode!==l.node||e.focusOffset!==l.offset)&&((t=t.createRange()).setStart(r.node,r.offset),e.removeAllRanges(),i>a?(e.addRange(t),e.extend(l.node,l.offset)):(t.setEnd(l.node,l.offset),e.addRange(t)))}for(t=[],e=n;e=e.parentNode;)1===e.nodeType&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for("function"==typeof n.focus&&n.focus(),n=0;n<t.length;n++)(e=t[n]).element.scrollLeft=e.left,e.element.scrollTop=e.top}}var va=s&&"documentMode"in document&&11>=document.documentMode,ya=null,ga=null,ba=null,ha=!1;function Ea(e,t,n){var a=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;ha||null==ya||ya!==Y(a)||("selectionStart"in(a=ya)&&da(a)?a={start:a.selectionStart,end:a.selectionEnd}:a={anchorNode:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset},ba&&ca(ba,a)||(ba=a,0<(a=Ha(ga,"onSelect")).length&&(t=new sn("onSelect","select",null,t,n),e.push({event:t,listeners:a}),t.target=ya)))}function xa(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var ka={animationend:xa("Animation","AnimationEnd"),animationiteration:xa("Animation","AnimationIteration"),animationstart:xa("Animation","AnimationStart"),transitionend:xa("Transition","TransitionEnd")},wa={},_a={};function Na(e){if(wa[e])return wa[e];if(!ka[e])return e;var t,n=ka[e];for(t in n)if(n.hasOwnProperty(t)&&t in _a)return wa[e]=n[t];return e}s&&(_a=document.createElement("div").style,"AnimationEvent"in window||(delete ka.animationend.animation,delete ka.animationiteration.animation,delete ka.animationstart.animation),"TransitionEvent"in window||delete ka.transitionend.transition);var Sa=Na("animationend"),Ca=Na("animationiteration"),Pa=Na("animationstart"),Oa=Na("transitionend"),ja=new Map,Ta="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 Aa(e,t){ja.set(e,t),c(t,[e])}for(var Da=0;Da<Ta.length;Da++){var Fa=Ta[Da];Aa(Fa.toLowerCase(),"on"+(Fa[0].toUpperCase()+Fa.slice(1)))}Aa(Sa,"onAnimationEnd"),Aa(Ca,"onAnimationIteration"),Aa(Pa,"onAnimationStart"),Aa("dblclick","onDoubleClick"),Aa("focusin","onFocus"),Aa("focusout","onBlur"),Aa(Oa,"onTransitionEnd"),u("onMouseEnter",["mouseout","mouseover"]),u("onMouseLeave",["mouseout","mouseover"]),u("onPointerEnter",["pointerout","pointerover"]),u("onPointerLeave",["pointerout","pointerover"]),c("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),c("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),c("onBeforeInput",["compositionend","keypress","textInput","paste"]),c("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var La="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(" "),za=new Set("cancel close invalid load scroll toggle".split(" ").concat(La));function Ra(e,t,n){var a=e.type||"unknown-event";e.currentTarget=n,function(e,t,n,a,r,l,o,c,u){if(Ue.apply(this,arguments),ze){if(!ze)throw Error(i(198));var s=Re;ze=!1,Re=null,Ie||(Ie=!0,Me=s)}}(a,t,void 0,e),e.currentTarget=null}function Ia(e,t){t=!!(4&t);for(var n=0;n<e.length;n++){var a=e[n],r=a.event;a=a.listeners;e:{var i=void 0;if(t)for(var l=a.length-1;0<=l;l--){var o=a[l],c=o.instance,u=o.currentTarget;if(o=o.listener,c!==i&&r.isPropagationStopped())break e;Ra(r,o,u),i=c}else for(l=0;l<a.length;l++){if(c=(o=a[l]).instance,u=o.currentTarget,o=o.listener,c!==i&&r.isPropagationStopped())break e;Ra(r,o,u),i=c}}}if(Ie)throw e=Me,Ie=!1,Me=null,e}function Ma(e,t){var n=t[vr];void 0===n&&(n=t[vr]=new Set);var a=e+"__bubble";n.has(a)||(Va(t,e,2,!1),n.add(a))}function Ba(e,t,n){var a=0;t&&(a|=4),Va(n,e,a,t)}var Ua="_reactListening"+Math.random().toString(36).slice(2);function Wa(e){if(!e[Ua]){e[Ua]=!0,l.forEach(function(t){"selectionchange"!==t&&(za.has(t)||Ba(t,!1,e),Ba(t,!0,e))});var t=9===e.nodeType?e:e.ownerDocument;null===t||t[Ua]||(t[Ua]=!0,Ba("selectionchange",!1,t))}}function Va(e,t,n,a){switch(Xt(t)){case 1:var r=Gt;break;case 4:r=Ht;break;default:r=Qt}n=r.bind(null,t,n,e),r=void 0,!De||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(r=!0),a?void 0!==r?e.addEventListener(t,n,{capture:!0,passive:r}):e.addEventListener(t,n,!0):void 0!==r?e.addEventListener(t,n,{passive:r}):e.addEventListener(t,n,!1)}function $a(e,t,n,a,r){var i=a;if(!(1&t||2&t||null===a))e:for(;;){if(null===a)return;var l=a.tag;if(3===l||4===l){var o=a.stateNode.containerInfo;if(o===r||8===o.nodeType&&o.parentNode===r)break;if(4===l)for(l=a.return;null!==l;){var c=l.tag;if((3===c||4===c)&&((c=l.stateNode.containerInfo)===r||8===c.nodeType&&c.parentNode===r))return;l=l.return}for(;null!==o;){if(null===(l=br(o)))return;if(5===(c=l.tag)||6===c){a=i=l;continue e}o=o.parentNode}}a=a.return}Te(function(){var a=i,r=xe(n),l=[];e:{var o=ja.get(e);if(void 0!==o){var c=sn,u=e;switch(e){case"keypress":if(0===tn(n))break e;case"keydown":case"keyup":c=Cn;break;case"focusin":u="focus",c=yn;break;case"focusout":u="blur",c=yn;break;case"beforeblur":case"afterblur":c=yn;break;case"click":if(2===n.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":c=pn;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":c=vn;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":c=On;break;case Sa:case Ca:case Pa:c=gn;break;case Oa:c=jn;break;case"scroll":c=fn;break;case"wheel":c=An;break;case"copy":case"cut":case"paste":c=hn;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":c=Pn}var s=!!(4&t),m=!s&&"scroll"===e,f=s?null!==o?o+"Capture":null:o;s=[];for(var d,p=a;null!==p;){var v=(d=p).stateNode;if(5===d.tag&&null!==v&&(d=v,null!==f&&(null!=(v=Ae(p,f))&&s.push(Ga(p,v,d)))),m)break;p=p.return}0<s.length&&(o=new c(o,u,null,n,r),l.push({event:o,listeners:s}))}}if(!(7&t)){if(c="mouseout"===e||"pointerout"===e,(!(o="mouseover"===e||"pointerover"===e)||n===Ee||!(u=n.relatedTarget||n.fromElement)||!br(u)&&!u[pr])&&(c||o)&&(o=r.window===r?r:(o=r.ownerDocument)?o.defaultView||o.parentWindow:window,c?(c=a,null!==(u=(u=n.relatedTarget||n.toElement)?br(u):null)&&(u!==(m=We(u))||5!==u.tag&&6!==u.tag)&&(u=null)):(c=null,u=a),c!==u)){if(s=pn,v="onMouseLeave",f="onMouseEnter",p="mouse","pointerout"!==e&&"pointerover"!==e||(s=Pn,v="onPointerLeave",f="onPointerEnter",p="pointer"),m=null==c?o:Er(c),d=null==u?o:Er(u),(o=new s(v,p+"leave",c,n,r)).target=m,o.relatedTarget=d,v=null,br(r)===a&&((s=new s(f,p+"enter",u,n,r)).target=d,s.relatedTarget=m,v=s),m=v,c&&u)e:{for(f=u,p=0,d=s=c;d;d=Qa(d))p++;for(d=0,v=f;v;v=Qa(v))d++;for(;0<p-d;)s=Qa(s),p--;for(;0<d-p;)f=Qa(f),d--;for(;p--;){if(s===f||null!==f&&s===f.alternate)break e;s=Qa(s),f=Qa(f)}s=null}else s=null;null!==c&&Ya(l,o,c,s,!1),null!==u&&null!==m&&Ya(l,m,u,s,!0)}if("select"===(c=(o=a?Er(a):window).nodeName&&o.nodeName.toLowerCase())||"input"===c&&"file"===o.type)var y=Xn;else if($n(o))if(Kn)y=la;else{y=ra;var g=aa}else(c=o.nodeName)&&"input"===c.toLowerCase()&&("checkbox"===o.type||"radio"===o.type)&&(y=ia);switch(y&&(y=y(e,a))?Gn(l,y,n,r):(g&&g(e,o,a),"focusout"===e&&(g=o._wrapperState)&&g.controlled&&"number"===o.type&&ee(o,"number",o.value)),g=a?Er(a):window,e){case"focusin":($n(g)||"true"===g.contentEditable)&&(ya=g,ga=a,ba=null);break;case"focusout":ba=ga=ya=null;break;case"mousedown":ha=!0;break;case"contextmenu":case"mouseup":case"dragend":ha=!1,Ea(l,n,r);break;case"selectionchange":if(va)break;case"keydown":case"keyup":Ea(l,n,r)}var b;if(Fn)e:{switch(e){case"compositionstart":var h="onCompositionStart";break e;case"compositionend":h="onCompositionEnd";break e;case"compositionupdate":h="onCompositionUpdate";break e}h=void 0}else Wn?Bn(e,n)&&(h="onCompositionEnd"):"keydown"===e&&229===n.keyCode&&(h="onCompositionStart");h&&(Rn&&"ko"!==n.locale&&(Wn||"onCompositionStart"!==h?"onCompositionEnd"===h&&Wn&&(b=en()):(Jt="value"in(Kt=r)?Kt.value:Kt.textContent,Wn=!0)),0<(g=Ha(a,h)).length&&(h=new En(h,e,null,n,r),l.push({event:h,listeners:g}),b?h.data=b:null!==(b=Un(n))&&(h.data=b))),(b=zn?function(e,t){switch(e){case"compositionend":return Un(t);case"keypress":return 32!==t.which?null:(Mn=!0,In);case"textInput":return(e=t.data)===In&&Mn?null:e;default:return null}}(e,n):function(e,t){if(Wn)return"compositionend"===e||!Fn&&Bn(e,t)?(e=en(),Zt=Jt=Kt=null,Wn=!1,e):null;switch(e){case"paste":default:return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Rn&&"ko"!==t.locale?null:t.data}}(e,n))&&(0<(a=Ha(a,"onBeforeInput")).length&&(r=new En("onBeforeInput","beforeinput",null,n,r),l.push({event:r,listeners:a}),r.data=b))}Ia(l,t)})}function Ga(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ha(e,t){for(var n=t+"Capture",a=[];null!==e;){var r=e,i=r.stateNode;5===r.tag&&null!==i&&(r=i,null!=(i=Ae(e,n))&&a.unshift(Ga(e,i,r)),null!=(i=Ae(e,t))&&a.push(Ga(e,i,r))),e=e.return}return a}function Qa(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag);return e||null}function Ya(e,t,n,a,r){for(var i=t._reactName,l=[];null!==n&&n!==a;){var o=n,c=o.alternate,u=o.stateNode;if(null!==c&&c===a)break;5===o.tag&&null!==u&&(o=u,r?null!=(c=Ae(n,i))&&l.unshift(Ga(n,c,o)):r||null!=(c=Ae(n,i))&&l.push(Ga(n,c,o))),n=n.return}0!==l.length&&e.push({event:t,listeners:l})}var qa=/\r\n?/g,Xa=/\u0000|\uFFFD/g;function Ka(e){return("string"==typeof e?e:""+e).replace(qa,"\n").replace(Xa,"")}function Ja(e,t,n){if(t=Ka(t),Ka(e)!==t&&n)throw Error(i(425))}function Za(){}var er=null,tr=null;function nr(e,t){return"textarea"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"object"==typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var ar="function"==typeof setTimeout?setTimeout:void 0,rr="function"==typeof clearTimeout?clearTimeout:void 0,ir="function"==typeof Promise?Promise:void 0,lr="function"==typeof queueMicrotask?queueMicrotask:void 0!==ir?function(e){return ir.resolve(null).then(e).catch(or)}:ar;function or(e){setTimeout(function(){throw e})}function cr(e,t){var n=t,a=0;do{var r=n.nextSibling;if(e.removeChild(n),r&&8===r.nodeType)if("/$"===(n=r.data)){if(0===a)return e.removeChild(r),void Wt(t);a--}else"$"!==n&&"$?"!==n&&"$!"!==n||a++;n=r}while(n);Wt(t)}function ur(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break;if(8===t){if("$"===(t=e.data)||"$!"===t||"$?"===t)break;if("/$"===t)return null}}return e}function sr(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("$"===n||"$!"===n||"$?"===n){if(0===t)return e;t--}else"/$"===n&&t++}e=e.previousSibling}return null}var mr=Math.random().toString(36).slice(2),fr="__reactFiber$"+mr,dr="__reactProps$"+mr,pr="__reactContainer$"+mr,vr="__reactEvents$"+mr,yr="__reactListeners$"+mr,gr="__reactHandles$"+mr;function br(e){var t=e[fr];if(t)return t;for(var n=e.parentNode;n;){if(t=n[pr]||n[fr]){if(n=t.alternate,null!==t.child||null!==n&&null!==n.child)for(e=sr(e);null!==e;){if(n=e[fr])return n;e=sr(e)}return t}n=(e=n).parentNode}return null}function hr(e){return!(e=e[fr]||e[pr])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function Er(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(i(33))}function xr(e){return e[dr]||null}var kr=[],wr=-1;function _r(e){return{current:e}}function Nr(e){0>wr||(e.current=kr[wr],kr[wr]=null,wr--)}function Sr(e,t){wr++,kr[wr]=e.current,e.current=t}var Cr={},Pr=_r(Cr),Or=_r(!1),jr=Cr;function Tr(e,t){var n=e.type.contextTypes;if(!n)return Cr;var a=e.stateNode;if(a&&a.__reactInternalMemoizedUnmaskedChildContext===t)return a.__reactInternalMemoizedMaskedChildContext;var r,i={};for(r in n)i[r]=t[r];return a&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Ar(e){return null!=(e=e.childContextTypes)}function Dr(){Nr(Or),Nr(Pr)}function Fr(e,t,n){if(Pr.current!==Cr)throw Error(i(168));Sr(Pr,t),Sr(Or,n)}function Lr(e,t,n){var a=e.stateNode;if(t=t.childContextTypes,"function"!=typeof a.getChildContext)return n;for(var r in a=a.getChildContext())if(!(r in t))throw Error(i(108,V(e)||"Unknown",r));return R({},n,a)}function zr(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Cr,jr=Pr.current,Sr(Pr,e),Sr(Or,Or.current),!0}function Rr(e,t,n){var a=e.stateNode;if(!a)throw Error(i(169));n?(e=Lr(e,t,jr),a.__reactInternalMemoizedMergedChildContext=e,Nr(Or),Nr(Pr),Sr(Pr,e)):Nr(Or),Sr(Or,n)}var Ir=null,Mr=!1,Br=!1;function Ur(e){null===Ir?Ir=[e]:Ir.push(e)}function Wr(){if(!Br&&null!==Ir){Br=!0;var e=0,t=ht;try{var n=Ir;for(ht=1;e<n.length;e++){var a=n[e];do{a=a(!0)}while(null!==a)}Ir=null,Mr=!1}catch(t){throw null!==Ir&&(Ir=Ir.slice(e+1)),Qe(Ze,Wr),t}finally{ht=t,Br=!1}}return null}var Vr=[],$r=0,Gr=null,Hr=0,Qr=[],Yr=0,qr=null,Xr=1,Kr="";function Jr(e,t){Vr[$r++]=Hr,Vr[$r++]=Gr,Gr=e,Hr=t}function Zr(e,t,n){Qr[Yr++]=Xr,Qr[Yr++]=Kr,Qr[Yr++]=qr,qr=e;var a=Xr;e=Kr;var r=32-lt(a)-1;a&=~(1<<r),n+=1;var i=32-lt(t)+r;if(30<i){var l=r-r%5;i=(a&(1<<l)-1).toString(32),a>>=l,r-=l,Xr=1<<32-lt(t)+r|n<<r|a,Kr=i+e}else Xr=1<<i|n<<r|a,Kr=e}function ei(e){null!==e.return&&(Jr(e,1),Zr(e,1,0))}function ti(e){for(;e===Gr;)Gr=Vr[--$r],Vr[$r]=null,Hr=Vr[--$r],Vr[$r]=null;for(;e===qr;)qr=Qr[--Yr],Qr[Yr]=null,Kr=Qr[--Yr],Qr[Yr]=null,Xr=Qr[--Yr],Qr[Yr]=null}var ni=null,ai=null,ri=!1,ii=null;function li(e,t){var n=ju(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,null===(t=e.deletions)?(e.deletions=[n],e.flags|=16):t.push(n)}function oi(e,t){switch(e.tag){case 5:var n=e.type;return null!==(t=1!==t.nodeType||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,ni=e,ai=ur(t.firstChild),!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,ni=e,ai=null,!0);case 13:return null!==(t=8!==t.nodeType?null:t)&&(n=null!==qr?{id:Xr,overflow:Kr}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},(n=ju(18,null,null,0)).stateNode=t,n.return=e,e.child=n,ni=e,ai=null,!0);default:return!1}}function ci(e){return!(!(1&e.mode)||128&e.flags)}function ui(e){if(ri){var t=ai;if(t){var n=t;if(!oi(e,t)){if(ci(e))throw Error(i(418));t=ur(n.nextSibling);var a=ni;t&&oi(e,t)?li(a,n):(e.flags=-4097&e.flags|2,ri=!1,ni=e)}}else{if(ci(e))throw Error(i(418));e.flags=-4097&e.flags|2,ri=!1,ni=e}}}function si(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;ni=e}function mi(e){if(e!==ni)return!1;if(!ri)return si(e),ri=!0,!1;var t;if((t=3!==e.tag)&&!(t=5!==e.tag)&&(t="head"!==(t=e.type)&&"body"!==t&&!nr(e.type,e.memoizedProps)),t&&(t=ai)){if(ci(e))throw fi(),Error(i(418));for(;t;)li(e,t),t=ur(t.nextSibling)}if(si(e),13===e.tag){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(i(317));e:{for(e=e.nextSibling,t=0;e;){if(8===e.nodeType){var n=e.data;if("/$"===n){if(0===t){ai=ur(e.nextSibling);break e}t--}else"$"!==n&&"$!"!==n&&"$?"!==n||t++}e=e.nextSibling}ai=null}}else ai=ni?ur(e.stateNode.nextSibling):null;return!0}function fi(){for(var e=ai;e;)e=ur(e.nextSibling)}function di(){ai=ni=null,ri=!1}function pi(e){null===ii?ii=[e]:ii.push(e)}var vi=E.ReactCurrentBatchConfig;function yi(e,t,n){if(null!==(e=n.ref)&&"function"!=typeof e&&"object"!=typeof e){if(n._owner){if(n=n._owner){if(1!==n.tag)throw Error(i(309));var a=n.stateNode}if(!a)throw Error(i(147,e));var r=a,l=""+e;return null!==t&&null!==t.ref&&"function"==typeof t.ref&&t.ref._stringRef===l?t.ref:(t=function(e){var t=r.refs;null===e?delete t[l]:t[l]=e},t._stringRef=l,t)}if("string"!=typeof e)throw Error(i(284));if(!n._owner)throw Error(i(290,e))}return e}function gi(e,t){throw e=Object.prototype.toString.call(t),Error(i(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function bi(e){return(0,e._init)(e._payload)}function hi(e){function t(t,n){if(e){var a=t.deletions;null===a?(t.deletions=[n],t.flags|=16):a.push(n)}}function n(n,a){if(!e)return null;for(;null!==a;)t(n,a),a=a.sibling;return null}function a(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function r(e,t){return(e=Au(e,t)).index=0,e.sibling=null,e}function l(t,n,a){return t.index=a,e?null!==(a=t.alternate)?(a=a.index)<n?(t.flags|=2,n):a:(t.flags|=2,n):(t.flags|=1048576,n)}function o(t){return e&&null===t.alternate&&(t.flags|=2),t}function c(e,t,n,a){return null===t||6!==t.tag?((t=zu(n,e.mode,a)).return=e,t):((t=r(t,n)).return=e,t)}function u(e,t,n,a){var i=n.type;return i===w?m(e,t,n.props.children,a,n.key):null!==t&&(t.elementType===i||"object"==typeof i&&null!==i&&i.$$typeof===A&&bi(i)===t.type)?((a=r(t,n.props)).ref=yi(e,t,n),a.return=e,a):((a=Du(n.type,n.key,n.props,null,e.mode,a)).ref=yi(e,t,n),a.return=e,a)}function s(e,t,n,a){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=Ru(n,e.mode,a)).return=e,t):((t=r(t,n.children||[])).return=e,t)}function m(e,t,n,a,i){return null===t||7!==t.tag?((t=Fu(n,e.mode,a,i)).return=e,t):((t=r(t,n)).return=e,t)}function f(e,t,n){if("string"==typeof t&&""!==t||"number"==typeof t)return(t=zu(""+t,e.mode,n)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case x:return(n=Du(t.type,t.key,t.props,null,e.mode,n)).ref=yi(e,null,t),n.return=e,n;case k:return(t=Ru(t,e.mode,n)).return=e,t;case A:return f(e,(0,t._init)(t._payload),n)}if(te(t)||L(t))return(t=Fu(t,e.mode,n,null)).return=e,t;gi(e,t)}return null}function d(e,t,n,a){var r=null!==t?t.key:null;if("string"==typeof n&&""!==n||"number"==typeof n)return null!==r?null:c(e,t,""+n,a);if("object"==typeof n&&null!==n){switch(n.$$typeof){case x:return n.key===r?u(e,t,n,a):null;case k:return n.key===r?s(e,t,n,a):null;case A:return d(e,t,(r=n._init)(n._payload),a)}if(te(n)||L(n))return null!==r?null:m(e,t,n,a,null);gi(e,n)}return null}function p(e,t,n,a,r){if("string"==typeof a&&""!==a||"number"==typeof a)return c(t,e=e.get(n)||null,""+a,r);if("object"==typeof a&&null!==a){switch(a.$$typeof){case x:return u(t,e=e.get(null===a.key?n:a.key)||null,a,r);case k:return s(t,e=e.get(null===a.key?n:a.key)||null,a,r);case A:return p(e,t,n,(0,a._init)(a._payload),r)}if(te(a)||L(a))return m(t,e=e.get(n)||null,a,r,null);gi(t,a)}return null}function v(r,i,o,c){for(var u=null,s=null,m=i,v=i=0,y=null;null!==m&&v<o.length;v++){m.index>v?(y=m,m=null):y=m.sibling;var g=d(r,m,o[v],c);if(null===g){null===m&&(m=y);break}e&&m&&null===g.alternate&&t(r,m),i=l(g,i,v),null===s?u=g:s.sibling=g,s=g,m=y}if(v===o.length)return n(r,m),ri&&Jr(r,v),u;if(null===m){for(;v<o.length;v++)null!==(m=f(r,o[v],c))&&(i=l(m,i,v),null===s?u=m:s.sibling=m,s=m);return ri&&Jr(r,v),u}for(m=a(r,m);v<o.length;v++)null!==(y=p(m,r,v,o[v],c))&&(e&&null!==y.alternate&&m.delete(null===y.key?v:y.key),i=l(y,i,v),null===s?u=y:s.sibling=y,s=y);return e&&m.forEach(function(e){return t(r,e)}),ri&&Jr(r,v),u}function y(r,o,c,u){var s=L(c);if("function"!=typeof s)throw Error(i(150));if(null==(c=s.call(c)))throw Error(i(151));for(var m=s=null,v=o,y=o=0,g=null,b=c.next();null!==v&&!b.done;y++,b=c.next()){v.index>y?(g=v,v=null):g=v.sibling;var h=d(r,v,b.value,u);if(null===h){null===v&&(v=g);break}e&&v&&null===h.alternate&&t(r,v),o=l(h,o,y),null===m?s=h:m.sibling=h,m=h,v=g}if(b.done)return n(r,v),ri&&Jr(r,y),s;if(null===v){for(;!b.done;y++,b=c.next())null!==(b=f(r,b.value,u))&&(o=l(b,o,y),null===m?s=b:m.sibling=b,m=b);return ri&&Jr(r,y),s}for(v=a(r,v);!b.done;y++,b=c.next())null!==(b=p(v,r,y,b.value,u))&&(e&&null!==b.alternate&&v.delete(null===b.key?y:b.key),o=l(b,o,y),null===m?s=b:m.sibling=b,m=b);return e&&v.forEach(function(e){return t(r,e)}),ri&&Jr(r,y),s}return function e(a,i,l,c){if("object"==typeof l&&null!==l&&l.type===w&&null===l.key&&(l=l.props.children),"object"==typeof l&&null!==l){switch(l.$$typeof){case x:e:{for(var u=l.key,s=i;null!==s;){if(s.key===u){if((u=l.type)===w){if(7===s.tag){n(a,s.sibling),(i=r(s,l.props.children)).return=a,a=i;break e}}else if(s.elementType===u||"object"==typeof u&&null!==u&&u.$$typeof===A&&bi(u)===s.type){n(a,s.sibling),(i=r(s,l.props)).ref=yi(a,s,l),i.return=a,a=i;break e}n(a,s);break}t(a,s),s=s.sibling}l.type===w?((i=Fu(l.props.children,a.mode,c,l.key)).return=a,a=i):((c=Du(l.type,l.key,l.props,null,a.mode,c)).ref=yi(a,i,l),c.return=a,a=c)}return o(a);case k:e:{for(s=l.key;null!==i;){if(i.key===s){if(4===i.tag&&i.stateNode.containerInfo===l.containerInfo&&i.stateNode.implementation===l.implementation){n(a,i.sibling),(i=r(i,l.children||[])).return=a,a=i;break e}n(a,i);break}t(a,i),i=i.sibling}(i=Ru(l,a.mode,c)).return=a,a=i}return o(a);case A:return e(a,i,(s=l._init)(l._payload),c)}if(te(l))return v(a,i,l,c);if(L(l))return y(a,i,l,c);gi(a,l)}return"string"==typeof l&&""!==l||"number"==typeof l?(l=""+l,null!==i&&6===i.tag?(n(a,i.sibling),(i=r(i,l)).return=a,a=i):(n(a,i),(i=zu(l,a.mode,c)).return=a,a=i),o(a)):n(a,i)}}var Ei=hi(!0),xi=hi(!1),ki=_r(null),wi=null,_i=null,Ni=null;function Si(){Ni=_i=wi=null}function Ci(e){var t=ki.current;Nr(ki),e._currentValue=t}function Pi(e,t,n){for(;null!==e;){var a=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==a&&(a.childLanes|=t)):null!==a&&(a.childLanes&t)!==t&&(a.childLanes|=t),e===n)break;e=e.return}}function Oi(e,t){wi=e,Ni=_i=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(0!==(e.lanes&t)&&(ho=!0),e.firstContext=null)}function ji(e){var t=e._currentValue;if(Ni!==e)if(e={context:e,memoizedValue:t,next:null},null===_i){if(null===wi)throw Error(i(308));_i=e,wi.dependencies={lanes:0,firstContext:e}}else _i=_i.next=e;return t}var Ti=null;function Ai(e){null===Ti?Ti=[e]:Ti.push(e)}function Di(e,t,n,a){var r=t.interleaved;return null===r?(n.next=n,Ai(t)):(n.next=r.next,r.next=n),t.interleaved=n,Fi(e,a)}function Fi(e,t){e.lanes|=t;var n=e.alternate;for(null!==n&&(n.lanes|=t),n=e,e=e.return;null!==e;)e.childLanes|=t,null!==(n=e.alternate)&&(n.childLanes|=t),n=e,e=e.return;return 3===n.tag?n.stateNode:null}var Li=!1;function zi(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ri(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Ii(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Mi(e,t,n){var a=e.updateQueue;if(null===a)return null;if(a=a.shared,2&Cc){var r=a.pending;return null===r?t.next=t:(t.next=r.next,r.next=t),a.pending=t,Fi(e,n)}return null===(r=a.interleaved)?(t.next=t,Ai(a)):(t.next=r.next,r.next=t),a.interleaved=t,Fi(e,n)}function Bi(e,t,n){if(null!==(t=t.updateQueue)&&(t=t.shared,4194240&n)){var a=t.lanes;n|=a&=e.pendingLanes,t.lanes=n,bt(e,n)}}function Ui(e,t){var n=e.updateQueue,a=e.alternate;if(null!==a&&n===(a=a.updateQueue)){var r=null,i=null;if(null!==(n=n.firstBaseUpdate)){do{var l={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};null===i?r=i=l:i=i.next=l,n=n.next}while(null!==n);null===i?r=i=t:i=i.next=t}else r=i=t;return n={baseState:a.baseState,firstBaseUpdate:r,lastBaseUpdate:i,shared:a.shared,effects:a.effects},void(e.updateQueue=n)}null===(e=n.lastBaseUpdate)?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Wi(e,t,n,a){var r=e.updateQueue;Li=!1;var i=r.firstBaseUpdate,l=r.lastBaseUpdate,o=r.shared.pending;if(null!==o){r.shared.pending=null;var c=o,u=c.next;c.next=null,null===l?i=u:l.next=u,l=c;var s=e.alternate;null!==s&&((o=(s=s.updateQueue).lastBaseUpdate)!==l&&(null===o?s.firstBaseUpdate=u:o.next=u,s.lastBaseUpdate=c))}if(null!==i){var m=r.baseState;for(l=0,s=u=c=null,o=i;;){var f=o.lane,d=o.eventTime;if((a&f)===f){null!==s&&(s=s.next={eventTime:d,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var p=e,v=o;switch(f=t,d=n,v.tag){case 1:if("function"==typeof(p=v.payload)){m=p.call(d,m,f);break e}m=p;break e;case 3:p.flags=-65537&p.flags|128;case 0:if(null==(f="function"==typeof(p=v.payload)?p.call(d,m,f):p))break e;m=R({},m,f);break e;case 2:Li=!0}}null!==o.callback&&0!==o.lane&&(e.flags|=64,null===(f=r.effects)?r.effects=[o]:f.push(o))}else d={eventTime:d,lane:f,tag:o.tag,payload:o.payload,callback:o.callback,next:null},null===s?(u=s=d,c=m):s=s.next=d,l|=f;if(null===(o=o.next)){if(null===(o=r.shared.pending))break;o=(f=o).next,f.next=null,r.lastBaseUpdate=f,r.shared.pending=null}}if(null===s&&(c=m),r.baseState=c,r.firstBaseUpdate=u,r.lastBaseUpdate=s,null!==(t=r.shared.interleaved)){r=t;do{l|=r.lane,r=r.next}while(r!==t)}else null===i&&(r.shared.lanes=0);Lc|=l,e.lanes=l,e.memoizedState=m}}function Vi(e,t,n){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var a=e[t],r=a.callback;if(null!==r){if(a.callback=null,a=n,"function"!=typeof r)throw Error(i(191,r));r.call(a)}}}var $i={},Gi=_r($i),Hi=_r($i),Qi=_r($i);function Yi(e){if(e===$i)throw Error(i(174));return e}function qi(e,t){switch(Sr(Qi,t),Sr(Hi,e),Sr(Gi,$i),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ce(null,"");break;default:t=ce(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}Nr(Gi),Sr(Gi,t)}function Xi(){Nr(Gi),Nr(Hi),Nr(Qi)}function Ki(e){Yi(Qi.current);var t=Yi(Gi.current),n=ce(t,e.type);t!==n&&(Sr(Hi,e),Sr(Gi,n))}function Ji(e){Hi.current===e&&(Nr(Gi),Nr(Hi))}var Zi=_r(0);function el(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||"$!"===n.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(128&t.flags)return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var tl=[];function nl(){for(var e=0;e<tl.length;e++)tl[e]._workInProgressVersionPrimary=null;tl.length=0}var al=E.ReactCurrentDispatcher,rl=E.ReactCurrentBatchConfig,il=0,ll=null,ol=null,cl=null,ul=!1,sl=!1,ml=0,fl=0;function dl(){throw Error(i(321))}function pl(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!oa(e[n],t[n]))return!1;return!0}function vl(e,t,n,a,r,l){if(il=l,ll=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,al.current=null===e||null===e.memoizedState?Jl:Zl,e=n(a,r),sl){l=0;do{if(sl=!1,ml=0,25<=l)throw Error(i(301));l+=1,cl=ol=null,t.updateQueue=null,al.current=eo,e=n(a,r)}while(sl)}if(al.current=Kl,t=null!==ol&&null!==ol.next,il=0,cl=ol=ll=null,ul=!1,t)throw Error(i(300));return e}function yl(){var e=0!==ml;return ml=0,e}function gl(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===cl?ll.memoizedState=cl=e:cl=cl.next=e,cl}function bl(){if(null===ol){var e=ll.alternate;e=null!==e?e.memoizedState:null}else e=ol.next;var t=null===cl?ll.memoizedState:cl.next;if(null!==t)cl=t,ol=e;else{if(null===e)throw Error(i(310));e={memoizedState:(ol=e).memoizedState,baseState:ol.baseState,baseQueue:ol.baseQueue,queue:ol.queue,next:null},null===cl?ll.memoizedState=cl=e:cl=cl.next=e}return cl}function hl(e,t){return"function"==typeof t?t(e):t}function El(e){var t=bl(),n=t.queue;if(null===n)throw Error(i(311));n.lastRenderedReducer=e;var a=ol,r=a.baseQueue,l=n.pending;if(null!==l){if(null!==r){var o=r.next;r.next=l.next,l.next=o}a.baseQueue=r=l,n.pending=null}if(null!==r){l=r.next,a=a.baseState;var c=o=null,u=null,s=l;do{var m=s.lane;if((il&m)===m)null!==u&&(u=u.next={lane:0,action:s.action,hasEagerState:s.hasEagerState,eagerState:s.eagerState,next:null}),a=s.hasEagerState?s.eagerState:e(a,s.action);else{var f={lane:m,action:s.action,hasEagerState:s.hasEagerState,eagerState:s.eagerState,next:null};null===u?(c=u=f,o=a):u=u.next=f,ll.lanes|=m,Lc|=m}s=s.next}while(null!==s&&s!==l);null===u?o=a:u.next=c,oa(a,t.memoizedState)||(ho=!0),t.memoizedState=a,t.baseState=o,t.baseQueue=u,n.lastRenderedState=a}if(null!==(e=n.interleaved)){r=e;do{l=r.lane,ll.lanes|=l,Lc|=l,r=r.next}while(r!==e)}else null===r&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function xl(e){var t=bl(),n=t.queue;if(null===n)throw Error(i(311));n.lastRenderedReducer=e;var a=n.dispatch,r=n.pending,l=t.memoizedState;if(null!==r){n.pending=null;var o=r=r.next;do{l=e(l,o.action),o=o.next}while(o!==r);oa(l,t.memoizedState)||(ho=!0),t.memoizedState=l,null===t.baseQueue&&(t.baseState=l),n.lastRenderedState=l}return[l,a]}function kl(){}function wl(e,t){var n=ll,a=bl(),r=t(),l=!oa(a.memoizedState,r);if(l&&(a.memoizedState=r,ho=!0),a=a.queue,Ll(Sl.bind(null,n,a,e),[e]),a.getSnapshot!==t||l||null!==cl&&1&cl.memoizedState.tag){if(n.flags|=2048,jl(9,Nl.bind(null,n,a,r,t),void 0,null),null===Pc)throw Error(i(349));30&il||_l(n,t,r)}return r}function _l(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},null===(t=ll.updateQueue)?(t={lastEffect:null,stores:null},ll.updateQueue=t,t.stores=[e]):null===(n=t.stores)?t.stores=[e]:n.push(e)}function Nl(e,t,n,a){t.value=n,t.getSnapshot=a,Cl(t)&&Pl(e)}function Sl(e,t,n){return n(function(){Cl(t)&&Pl(e)})}function Cl(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!oa(e,n)}catch(e){return!0}}function Pl(e){var t=Fi(e,1);null!==t&&tu(t,e,1,-1)}function Ol(e){var t=gl();return"function"==typeof e&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:hl,lastRenderedState:e},t.queue=e,e=e.dispatch=Ql.bind(null,ll,e),[t.memoizedState,e]}function jl(e,t,n,a){return e={tag:e,create:t,destroy:n,deps:a,next:null},null===(t=ll.updateQueue)?(t={lastEffect:null,stores:null},ll.updateQueue=t,t.lastEffect=e.next=e):null===(n=t.lastEffect)?t.lastEffect=e.next=e:(a=n.next,n.next=e,e.next=a,t.lastEffect=e),e}function Tl(){return bl().memoizedState}function Al(e,t,n,a){var r=gl();ll.flags|=e,r.memoizedState=jl(1|t,n,void 0,void 0===a?null:a)}function Dl(e,t,n,a){var r=bl();a=void 0===a?null:a;var i=void 0;if(null!==ol){var l=ol.memoizedState;if(i=l.destroy,null!==a&&pl(a,l.deps))return void(r.memoizedState=jl(t,n,i,a))}ll.flags|=e,r.memoizedState=jl(1|t,n,i,a)}function Fl(e,t){return Al(8390656,8,e,t)}function Ll(e,t){return Dl(2048,8,e,t)}function zl(e,t){return Dl(4,2,e,t)}function Rl(e,t){return Dl(4,4,e,t)}function Il(e,t){return"function"==typeof t?(e=e(),t(e),function(){t(null)}):null!=t?(e=e(),t.current=e,function(){t.current=null}):void 0}function Ml(e,t,n){return n=null!=n?n.concat([e]):null,Dl(4,4,Il.bind(null,t,e),n)}function Bl(){}function Ul(e,t){var n=bl();t=void 0===t?null:t;var a=n.memoizedState;return null!==a&&null!==t&&pl(t,a[1])?a[0]:(n.memoizedState=[e,t],e)}function Wl(e,t){var n=bl();t=void 0===t?null:t;var a=n.memoizedState;return null!==a&&null!==t&&pl(t,a[1])?a[0]:(e=e(),n.memoizedState=[e,t],e)}function Vl(e,t,n){return 21&il?(oa(n,t)||(n=vt(),ll.lanes|=n,Lc|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,ho=!0),e.memoizedState=n)}function $l(e,t){var n=ht;ht=0!==n&&4>n?n:4,e(!0);var a=rl.transition;rl.transition={};try{e(!1),t()}finally{ht=n,rl.transition=a}}function Gl(){return bl().memoizedState}function Hl(e,t,n){var a=eu(e);if(n={lane:a,action:n,hasEagerState:!1,eagerState:null,next:null},Yl(e))ql(t,n);else if(null!==(n=Di(e,t,n,a))){tu(n,e,a,Zc()),Xl(n,t,a)}}function Ql(e,t,n){var a=eu(e),r={lane:a,action:n,hasEagerState:!1,eagerState:null,next:null};if(Yl(e))ql(t,r);else{var i=e.alternate;if(0===e.lanes&&(null===i||0===i.lanes)&&null!==(i=t.lastRenderedReducer))try{var l=t.lastRenderedState,o=i(l,n);if(r.hasEagerState=!0,r.eagerState=o,oa(o,l)){var c=t.interleaved;return null===c?(r.next=r,Ai(t)):(r.next=c.next,c.next=r),void(t.interleaved=r)}}catch(e){}null!==(n=Di(e,t,r,a))&&(tu(n,e,a,r=Zc()),Xl(n,t,a))}}function Yl(e){var t=e.alternate;return e===ll||null!==t&&t===ll}function ql(e,t){sl=ul=!0;var n=e.pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Xl(e,t,n){if(4194240&n){var a=t.lanes;n|=a&=e.pendingLanes,t.lanes=n,bt(e,n)}}var Kl={readContext:ji,useCallback:dl,useContext:dl,useEffect:dl,useImperativeHandle:dl,useInsertionEffect:dl,useLayoutEffect:dl,useMemo:dl,useReducer:dl,useRef:dl,useState:dl,useDebugValue:dl,useDeferredValue:dl,useTransition:dl,useMutableSource:dl,useSyncExternalStore:dl,useId:dl,unstable_isNewReconciler:!1},Jl={readContext:ji,useCallback:function(e,t){return gl().memoizedState=[e,void 0===t?null:t],e},useContext:ji,useEffect:Fl,useImperativeHandle:function(e,t,n){return n=null!=n?n.concat([e]):null,Al(4194308,4,Il.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Al(4194308,4,e,t)},useInsertionEffect:function(e,t){return Al(4,2,e,t)},useMemo:function(e,t){var n=gl();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var a=gl();return t=void 0!==n?n(t):t,a.memoizedState=a.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},a.queue=e,e=e.dispatch=Hl.bind(null,ll,e),[a.memoizedState,e]},useRef:function(e){return e={current:e},gl().memoizedState=e},useState:Ol,useDebugValue:Bl,useDeferredValue:function(e){return gl().memoizedState=e},useTransition:function(){var e=Ol(!1),t=e[0];return e=$l.bind(null,e[1]),gl().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var a=ll,r=gl();if(ri){if(void 0===n)throw Error(i(407));n=n()}else{if(n=t(),null===Pc)throw Error(i(349));30&il||_l(a,t,n)}r.memoizedState=n;var l={value:n,getSnapshot:t};return r.queue=l,Fl(Sl.bind(null,a,l,e),[e]),a.flags|=2048,jl(9,Nl.bind(null,a,l,n,t),void 0,null),n},useId:function(){var e=gl(),t=Pc.identifierPrefix;if(ri){var n=Kr;t=":"+t+"R"+(n=(Xr&~(1<<32-lt(Xr)-1)).toString(32)+n),0<(n=ml++)&&(t+="H"+n.toString(32)),t+=":"}else t=":"+t+"r"+(n=fl++).toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Zl={readContext:ji,useCallback:Ul,useContext:ji,useEffect:Ll,useImperativeHandle:Ml,useInsertionEffect:zl,useLayoutEffect:Rl,useMemo:Wl,useReducer:El,useRef:Tl,useState:function(){return El(hl)},useDebugValue:Bl,useDeferredValue:function(e){return Vl(bl(),ol.memoizedState,e)},useTransition:function(){return[El(hl)[0],bl().memoizedState]},useMutableSource:kl,useSyncExternalStore:wl,useId:Gl,unstable_isNewReconciler:!1},eo={readContext:ji,useCallback:Ul,useContext:ji,useEffect:Ll,useImperativeHandle:Ml,useInsertionEffect:zl,useLayoutEffect:Rl,useMemo:Wl,useReducer:xl,useRef:Tl,useState:function(){return xl(hl)},useDebugValue:Bl,useDeferredValue:function(e){var t=bl();return null===ol?t.memoizedState=e:Vl(t,ol.memoizedState,e)},useTransition:function(){return[xl(hl)[0],bl().memoizedState]},useMutableSource:kl,useSyncExternalStore:wl,useId:Gl,unstable_isNewReconciler:!1};function to(e,t){if(e&&e.defaultProps){for(var n in t=R({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}return t}function no(e,t,n,a){n=null==(n=n(a,t=e.memoizedState))?t:R({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}var ao={isMounted:function(e){return!!(e=e._reactInternals)&&We(e)===e},enqueueSetState:function(e,t,n){e=e._reactInternals;var a=Zc(),r=eu(e),i=Ii(a,r);i.payload=t,null!=n&&(i.callback=n),null!==(t=Mi(e,i,r))&&(tu(t,e,r,a),Bi(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var a=Zc(),r=eu(e),i=Ii(a,r);i.tag=1,i.payload=t,null!=n&&(i.callback=n),null!==(t=Mi(e,i,r))&&(tu(t,e,r,a),Bi(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Zc(),a=eu(e),r=Ii(n,a);r.tag=2,null!=t&&(r.callback=t),null!==(t=Mi(e,r,a))&&(tu(t,e,a,n),Bi(t,e,a))}};function ro(e,t,n,a,r,i,l){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(a,i,l):!t.prototype||!t.prototype.isPureReactComponent||(!ca(n,a)||!ca(r,i))}function io(e,t,n){var a=!1,r=Cr,i=t.contextType;return"object"==typeof i&&null!==i?i=ji(i):(r=Ar(t)?jr:Pr.current,i=(a=null!=(a=t.contextTypes))?Tr(e,r):Cr),t=new t(n,i),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=ao,e.stateNode=t,t._reactInternals=e,a&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=r,e.__reactInternalMemoizedMaskedChildContext=i),t}function lo(e,t,n,a){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,a),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,a),t.state!==e&&ao.enqueueReplaceState(t,t.state,null)}function oo(e,t,n,a){var r=e.stateNode;r.props=n,r.state=e.memoizedState,r.refs={},zi(e);var i=t.contextType;"object"==typeof i&&null!==i?r.context=ji(i):(i=Ar(t)?jr:Pr.current,r.context=Tr(e,i)),r.state=e.memoizedState,"function"==typeof(i=t.getDerivedStateFromProps)&&(no(e,t,i,n),r.state=e.memoizedState),"function"==typeof t.getDerivedStateFromProps||"function"==typeof r.getSnapshotBeforeUpdate||"function"!=typeof r.UNSAFE_componentWillMount&&"function"!=typeof r.componentWillMount||(t=r.state,"function"==typeof r.componentWillMount&&r.componentWillMount(),"function"==typeof r.UNSAFE_componentWillMount&&r.UNSAFE_componentWillMount(),t!==r.state&&ao.enqueueReplaceState(r,r.state,null),Wi(e,n,r,a),r.state=e.memoizedState),"function"==typeof r.componentDidMount&&(e.flags|=4194308)}function co(e,t){try{var n="",a=t;do{n+=U(a),a=a.return}while(a);var r=n}catch(e){r="\nError generating stack: "+e.message+"\n"+e.stack}return{value:e,source:t,stack:r,digest:null}}function uo(e,t,n){return{value:e,source:null,stack:null!=n?n:null,digest:null!=t?t:null}}function so(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var mo="function"==typeof WeakMap?WeakMap:Map;function fo(e,t,n){(n=Ii(-1,n)).tag=3,n.payload={element:null};var a=t.value;return n.callback=function(){Vc||(Vc=!0,$c=a),so(0,t)},n}function po(e,t,n){(n=Ii(-1,n)).tag=3;var a=e.type.getDerivedStateFromError;if("function"==typeof a){var r=t.value;n.payload=function(){return a(r)},n.callback=function(){so(0,t)}}var i=e.stateNode;return null!==i&&"function"==typeof i.componentDidCatch&&(n.callback=function(){so(0,t),"function"!=typeof a&&(null===Gc?Gc=new Set([this]):Gc.add(this));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),n}function vo(e,t,n){var a=e.pingCache;if(null===a){a=e.pingCache=new mo;var r=new Set;a.set(t,r)}else void 0===(r=a.get(t))&&(r=new Set,a.set(t,r));r.has(n)||(r.add(n),e=_u.bind(null,e,t,n),t.then(e,e))}function yo(e){do{var t;if((t=13===e.tag)&&(t=null===(t=e.memoizedState)||null!==t.dehydrated),t)return e;e=e.return}while(null!==e);return null}function go(e,t,n,a,r){return 1&e.mode?(e.flags|=65536,e.lanes=r,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,1===n.tag&&(null===n.alternate?n.tag=17:((t=Ii(-1,1)).tag=2,Mi(n,t,1))),n.lanes|=1),e)}var bo=E.ReactCurrentOwner,ho=!1;function Eo(e,t,n,a){t.child=null===e?xi(t,null,n,a):Ei(t,e.child,n,a)}function xo(e,t,n,a,r){n=n.render;var i=t.ref;return Oi(t,r),a=vl(e,t,n,a,i,r),n=yl(),null===e||ho?(ri&&n&&ei(t),t.flags|=1,Eo(e,t,a,r),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~r,Vo(e,t,r))}function ko(e,t,n,a,r){if(null===e){var i=n.type;return"function"!=typeof i||Tu(i)||void 0!==i.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=Du(n.type,null,a,t,t.mode,r)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=i,wo(e,t,i,a,r))}if(i=e.child,0===(e.lanes&r)){var l=i.memoizedProps;if((n=null!==(n=n.compare)?n:ca)(l,a)&&e.ref===t.ref)return Vo(e,t,r)}return t.flags|=1,(e=Au(i,a)).ref=t.ref,e.return=t,t.child=e}function wo(e,t,n,a,r){if(null!==e){var i=e.memoizedProps;if(ca(i,a)&&e.ref===t.ref){if(ho=!1,t.pendingProps=a=i,0===(e.lanes&r))return t.lanes=e.lanes,Vo(e,t,r);131072&e.flags&&(ho=!0)}}return So(e,t,n,a,r)}function _o(e,t,n){var a=t.pendingProps,r=a.children,i=null!==e?e.memoizedState:null;if("hidden"===a.mode)if(1&t.mode){if(!(1073741824&n))return e=null!==i?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Sr(Ac,Tc),Tc|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},a=null!==i?i.baseLanes:n,Sr(Ac,Tc),Tc|=a}else t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Sr(Ac,Tc),Tc|=n;else null!==i?(a=i.baseLanes|n,t.memoizedState=null):a=n,Sr(Ac,Tc),Tc|=a;return Eo(e,t,r,n),t.child}function No(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function So(e,t,n,a,r){var i=Ar(n)?jr:Pr.current;return i=Tr(t,i),Oi(t,r),n=vl(e,t,n,a,i,r),a=yl(),null===e||ho?(ri&&a&&ei(t),t.flags|=1,Eo(e,t,n,r),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~r,Vo(e,t,r))}function Co(e,t,n,a,r){if(Ar(n)){var i=!0;zr(t)}else i=!1;if(Oi(t,r),null===t.stateNode)Wo(e,t),io(t,n,a),oo(t,n,a,r),a=!0;else if(null===e){var l=t.stateNode,o=t.memoizedProps;l.props=o;var c=l.context,u=n.contextType;"object"==typeof u&&null!==u?u=ji(u):u=Tr(t,u=Ar(n)?jr:Pr.current);var s=n.getDerivedStateFromProps,m="function"==typeof s||"function"==typeof l.getSnapshotBeforeUpdate;m||"function"!=typeof l.UNSAFE_componentWillReceiveProps&&"function"!=typeof l.componentWillReceiveProps||(o!==a||c!==u)&&lo(t,l,a,u),Li=!1;var f=t.memoizedState;l.state=f,Wi(t,a,l,r),c=t.memoizedState,o!==a||f!==c||Or.current||Li?("function"==typeof s&&(no(t,n,s,a),c=t.memoizedState),(o=Li||ro(t,n,o,a,f,c,u))?(m||"function"!=typeof l.UNSAFE_componentWillMount&&"function"!=typeof l.componentWillMount||("function"==typeof l.componentWillMount&&l.componentWillMount(),"function"==typeof l.UNSAFE_componentWillMount&&l.UNSAFE_componentWillMount()),"function"==typeof l.componentDidMount&&(t.flags|=4194308)):("function"==typeof l.componentDidMount&&(t.flags|=4194308),t.memoizedProps=a,t.memoizedState=c),l.props=a,l.state=c,l.context=u,a=o):("function"==typeof l.componentDidMount&&(t.flags|=4194308),a=!1)}else{l=t.stateNode,Ri(e,t),o=t.memoizedProps,u=t.type===t.elementType?o:to(t.type,o),l.props=u,m=t.pendingProps,f=l.context,"object"==typeof(c=n.contextType)&&null!==c?c=ji(c):c=Tr(t,c=Ar(n)?jr:Pr.current);var d=n.getDerivedStateFromProps;(s="function"==typeof d||"function"==typeof l.getSnapshotBeforeUpdate)||"function"!=typeof l.UNSAFE_componentWillReceiveProps&&"function"!=typeof l.componentWillReceiveProps||(o!==m||f!==c)&&lo(t,l,a,c),Li=!1,f=t.memoizedState,l.state=f,Wi(t,a,l,r);var p=t.memoizedState;o!==m||f!==p||Or.current||Li?("function"==typeof d&&(no(t,n,d,a),p=t.memoizedState),(u=Li||ro(t,n,u,a,f,p,c)||!1)?(s||"function"!=typeof l.UNSAFE_componentWillUpdate&&"function"!=typeof l.componentWillUpdate||("function"==typeof l.componentWillUpdate&&l.componentWillUpdate(a,p,c),"function"==typeof l.UNSAFE_componentWillUpdate&&l.UNSAFE_componentWillUpdate(a,p,c)),"function"==typeof l.componentDidUpdate&&(t.flags|=4),"function"==typeof l.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof l.componentDidUpdate||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!=typeof l.getSnapshotBeforeUpdate||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=a,t.memoizedState=p),l.props=a,l.state=p,l.context=c,a=u):("function"!=typeof l.componentDidUpdate||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!=typeof l.getSnapshotBeforeUpdate||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),a=!1)}return Po(e,t,n,a,i,r)}function Po(e,t,n,a,r,i){No(e,t);var l=!!(128&t.flags);if(!a&&!l)return r&&Rr(t,n,!1),Vo(e,t,i);a=t.stateNode,bo.current=t;var o=l&&"function"!=typeof n.getDerivedStateFromError?null:a.render();return t.flags|=1,null!==e&&l?(t.child=Ei(t,e.child,null,i),t.child=Ei(t,null,o,i)):Eo(e,t,o,i),t.memoizedState=a.state,r&&Rr(t,n,!0),t.child}function Oo(e){var t=e.stateNode;t.pendingContext?Fr(0,t.pendingContext,t.pendingContext!==t.context):t.context&&Fr(0,t.context,!1),qi(e,t.containerInfo)}function jo(e,t,n,a,r){return di(),pi(r),t.flags|=256,Eo(e,t,n,a),t.child}var To,Ao,Do,Fo={dehydrated:null,treeContext:null,retryLane:0};function Lo(e){return{baseLanes:e,cachePool:null,transitions:null}}function zo(e,t,n){var a,r=t.pendingProps,l=Zi.current,o=!1,c=!!(128&t.flags);if((a=c)||(a=(null===e||null!==e.memoizedState)&&!!(2&l)),a?(o=!0,t.flags&=-129):null!==e&&null===e.memoizedState||(l|=1),Sr(Zi,1&l),null===e)return ui(t),null!==(e=t.memoizedState)&&null!==(e=e.dehydrated)?(1&t.mode?"$!"===e.data?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(c=r.children,e=r.fallback,o?(r=t.mode,o=t.child,c={mode:"hidden",children:c},1&r||null===o?o=Lu(c,r,0,null):(o.childLanes=0,o.pendingProps=c),e=Fu(e,r,n,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=Lo(n),t.memoizedState=Fo,e):Ro(t,c));if(null!==(l=e.memoizedState)&&null!==(a=l.dehydrated))return function(e,t,n,a,r,l,o){if(n)return 256&t.flags?(t.flags&=-257,Io(e,t,o,a=uo(Error(i(422))))):null!==t.memoizedState?(t.child=e.child,t.flags|=128,null):(l=a.fallback,r=t.mode,a=Lu({mode:"visible",children:a.children},r,0,null),(l=Fu(l,r,o,null)).flags|=2,a.return=t,l.return=t,a.sibling=l,t.child=a,1&t.mode&&Ei(t,e.child,null,o),t.child.memoizedState=Lo(o),t.memoizedState=Fo,l);if(!(1&t.mode))return Io(e,t,o,null);if("$!"===r.data){if(a=r.nextSibling&&r.nextSibling.dataset)var c=a.dgst;return a=c,Io(e,t,o,a=uo(l=Error(i(419)),a,void 0))}if(c=0!==(o&e.childLanes),ho||c){if(null!==(a=Pc)){switch(o&-o){case 4:r=2;break;case 16:r=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:r=32;break;case 536870912:r=268435456;break;default:r=0}0!==(r=0!==(r&(a.suspendedLanes|o))?0:r)&&r!==l.retryLane&&(l.retryLane=r,Fi(e,r),tu(a,e,r,-1))}return pu(),Io(e,t,o,a=uo(Error(i(421))))}return"$?"===r.data?(t.flags|=128,t.child=e.child,t=Su.bind(null,e),r._reactRetry=t,null):(e=l.treeContext,ai=ur(r.nextSibling),ni=t,ri=!0,ii=null,null!==e&&(Qr[Yr++]=Xr,Qr[Yr++]=Kr,Qr[Yr++]=qr,Xr=e.id,Kr=e.overflow,qr=t),t=Ro(t,a.children),t.flags|=4096,t)}(e,t,c,r,a,l,n);if(o){o=r.fallback,c=t.mode,a=(l=e.child).sibling;var u={mode:"hidden",children:r.children};return 1&c||t.child===l?(r=Au(l,u)).subtreeFlags=14680064&l.subtreeFlags:((r=t.child).childLanes=0,r.pendingProps=u,t.deletions=null),null!==a?o=Au(a,o):(o=Fu(o,c,n,null)).flags|=2,o.return=t,r.return=t,r.sibling=o,t.child=r,r=o,o=t.child,c=null===(c=e.child.memoizedState)?Lo(n):{baseLanes:c.baseLanes|n,cachePool:null,transitions:c.transitions},o.memoizedState=c,o.childLanes=e.childLanes&~n,t.memoizedState=Fo,r}return e=(o=e.child).sibling,r=Au(o,{mode:"visible",children:r.children}),!(1&t.mode)&&(r.lanes=n),r.return=t,r.sibling=null,null!==e&&(null===(n=t.deletions)?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Ro(e,t){return(t=Lu({mode:"visible",children:t},e.mode,0,null)).return=e,e.child=t}function Io(e,t,n,a){return null!==a&&pi(a),Ei(t,e.child,null,n),(e=Ro(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function Mo(e,t,n){e.lanes|=t;var a=e.alternate;null!==a&&(a.lanes|=t),Pi(e.return,t,n)}function Bo(e,t,n,a,r){var i=e.memoizedState;null===i?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:a,tail:n,tailMode:r}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=a,i.tail=n,i.tailMode=r)}function Uo(e,t,n){var a=t.pendingProps,r=a.revealOrder,i=a.tail;if(Eo(e,t,a.children,n),2&(a=Zi.current))a=1&a|2,t.flags|=128;else{if(null!==e&&128&e.flags)e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&Mo(e,n,t);else if(19===e.tag)Mo(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}a&=1}if(Sr(Zi,a),1&t.mode)switch(r){case"forwards":for(n=t.child,r=null;null!==n;)null!==(e=n.alternate)&&null===el(e)&&(r=n),n=n.sibling;null===(n=r)?(r=t.child,t.child=null):(r=n.sibling,n.sibling=null),Bo(t,!1,r,n,i);break;case"backwards":for(n=null,r=t.child,t.child=null;null!==r;){if(null!==(e=r.alternate)&&null===el(e)){t.child=r;break}e=r.sibling,r.sibling=n,n=r,r=e}Bo(t,!0,n,null,i);break;case"together":Bo(t,!1,null,null,void 0);break;default:t.memoizedState=null}else t.memoizedState=null;return t.child}function Wo(e,t){!(1&t.mode)&&null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Vo(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),Lc|=t.lanes,0===(n&t.childLanes))return null;if(null!==e&&t.child!==e.child)throw Error(i(153));if(null!==t.child){for(n=Au(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=Au(e,e.pendingProps)).return=t;n.sibling=null}return t.child}function $o(e,t){if(!ri)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var a=null;null!==n;)null!==n.alternate&&(a=n),n=n.sibling;null===a?t||null===e.tail?e.tail=null:e.tail.sibling=null:a.sibling=null}}function Go(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,a=0;if(t)for(var r=e.child;null!==r;)n|=r.lanes|r.childLanes,a|=14680064&r.subtreeFlags,a|=14680064&r.flags,r.return=e,r=r.sibling;else for(r=e.child;null!==r;)n|=r.lanes|r.childLanes,a|=r.subtreeFlags,a|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=a,e.childLanes=n,t}function Ho(e,t,n){var a=t.pendingProps;switch(ti(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Go(t),null;case 1:case 17:return Ar(t.type)&&Dr(),Go(t),null;case 3:return a=t.stateNode,Xi(),Nr(Or),Nr(Pr),nl(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),null!==e&&null!==e.child||(mi(t)?t.flags|=4:null===e||e.memoizedState.isDehydrated&&!(256&t.flags)||(t.flags|=1024,null!==ii&&(iu(ii),ii=null))),Go(t),null;case 5:Ji(t);var r=Yi(Qi.current);if(n=t.type,null!==e&&null!=t.stateNode)Ao(e,t,n,a),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!a){if(null===t.stateNode)throw Error(i(166));return Go(t),null}if(e=Yi(Gi.current),mi(t)){a=t.stateNode,n=t.type;var l=t.memoizedProps;switch(a[fr]=t,a[dr]=l,e=!!(1&t.mode),n){case"dialog":Ma("cancel",a),Ma("close",a);break;case"iframe":case"object":case"embed":Ma("load",a);break;case"video":case"audio":for(r=0;r<La.length;r++)Ma(La[r],a);break;case"source":Ma("error",a);break;case"img":case"image":case"link":Ma("error",a),Ma("load",a);break;case"details":Ma("toggle",a);break;case"input":X(a,l),Ma("invalid",a);break;case"select":a._wrapperState={wasMultiple:!!l.multiple},Ma("invalid",a);break;case"textarea":re(a,l),Ma("invalid",a)}for(var c in be(n,l),r=null,l)if(l.hasOwnProperty(c)){var u=l[c];"children"===c?"string"==typeof u?a.textContent!==u&&(!0!==l.suppressHydrationWarning&&Ja(a.textContent,u,e),r=["children",u]):"number"==typeof u&&a.textContent!==""+u&&(!0!==l.suppressHydrationWarning&&Ja(a.textContent,u,e),r=["children",""+u]):o.hasOwnProperty(c)&&null!=u&&"onScroll"===c&&Ma("scroll",a)}switch(n){case"input":H(a),Z(a,l,!0);break;case"textarea":H(a),le(a);break;case"select":case"option":break;default:"function"==typeof l.onClick&&(a.onclick=Za)}a=r,t.updateQueue=a,null!==a&&(t.flags|=4)}else{c=9===r.nodeType?r:r.ownerDocument,"http://www.w3.org/1999/xhtml"===e&&(e=oe(n)),"http://www.w3.org/1999/xhtml"===e?"script"===n?((e=c.createElement("div")).innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):"string"==typeof a.is?e=c.createElement(n,{is:a.is}):(e=c.createElement(n),"select"===n&&(c=e,a.multiple?c.multiple=!0:a.size&&(c.size=a.size))):e=c.createElementNS(e,n),e[fr]=t,e[dr]=a,To(e,t),t.stateNode=e;e:{switch(c=he(n,a),n){case"dialog":Ma("cancel",e),Ma("close",e),r=a;break;case"iframe":case"object":case"embed":Ma("load",e),r=a;break;case"video":case"audio":for(r=0;r<La.length;r++)Ma(La[r],e);r=a;break;case"source":Ma("error",e),r=a;break;case"img":case"image":case"link":Ma("error",e),Ma("load",e),r=a;break;case"details":Ma("toggle",e),r=a;break;case"input":X(e,a),r=q(e,a),Ma("invalid",e);break;case"option":default:r=a;break;case"select":e._wrapperState={wasMultiple:!!a.multiple},r=R({},a,{value:void 0}),Ma("invalid",e);break;case"textarea":re(e,a),r=ae(e,a),Ma("invalid",e)}for(l in be(n,r),u=r)if(u.hasOwnProperty(l)){var s=u[l];"style"===l?ye(e,s):"dangerouslySetInnerHTML"===l?null!=(s=s?s.__html:void 0)&&me(e,s):"children"===l?"string"==typeof s?("textarea"!==n||""!==s)&&fe(e,s):"number"==typeof s&&fe(e,""+s):"suppressContentEditableWarning"!==l&&"suppressHydrationWarning"!==l&&"autoFocus"!==l&&(o.hasOwnProperty(l)?null!=s&&"onScroll"===l&&Ma("scroll",e):null!=s&&h(e,l,s,c))}switch(n){case"input":H(e),Z(e,a,!1);break;case"textarea":H(e),le(e);break;case"option":null!=a.value&&e.setAttribute("value",""+$(a.value));break;case"select":e.multiple=!!a.multiple,null!=(l=a.value)?ne(e,!!a.multiple,l,!1):null!=a.defaultValue&&ne(e,!!a.multiple,a.defaultValue,!0);break;default:"function"==typeof r.onClick&&(e.onclick=Za)}switch(n){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break e;case"img":a=!0;break e;default:a=!1}}a&&(t.flags|=4)}null!==t.ref&&(t.flags|=512,t.flags|=2097152)}return Go(t),null;case 6:if(e&&null!=t.stateNode)Do(0,t,e.memoizedProps,a);else{if("string"!=typeof a&&null===t.stateNode)throw Error(i(166));if(n=Yi(Qi.current),Yi(Gi.current),mi(t)){if(a=t.stateNode,n=t.memoizedProps,a[fr]=t,(l=a.nodeValue!==n)&&null!==(e=ni))switch(e.tag){case 3:Ja(a.nodeValue,n,!!(1&e.mode));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&Ja(a.nodeValue,n,!!(1&e.mode))}l&&(t.flags|=4)}else(a=(9===n.nodeType?n:n.ownerDocument).createTextNode(a))[fr]=t,t.stateNode=a}return Go(t),null;case 13:if(Nr(Zi),a=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(ri&&null!==ai&&1&t.mode&&!(128&t.flags))fi(),di(),t.flags|=98560,l=!1;else if(l=mi(t),null!==a&&null!==a.dehydrated){if(null===e){if(!l)throw Error(i(318));if(!(l=null!==(l=t.memoizedState)?l.dehydrated:null))throw Error(i(317));l[fr]=t}else di(),!(128&t.flags)&&(t.memoizedState=null),t.flags|=4;Go(t),l=!1}else null!==ii&&(iu(ii),ii=null),l=!0;if(!l)return 65536&t.flags?t:null}return 128&t.flags?(t.lanes=n,t):((a=null!==a)!==(null!==e&&null!==e.memoizedState)&&a&&(t.child.flags|=8192,1&t.mode&&(null===e||1&Zi.current?0===Dc&&(Dc=3):pu())),null!==t.updateQueue&&(t.flags|=4),Go(t),null);case 4:return Xi(),null===e&&Wa(t.stateNode.containerInfo),Go(t),null;case 10:return Ci(t.type._context),Go(t),null;case 19:if(Nr(Zi),null===(l=t.memoizedState))return Go(t),null;if(a=!!(128&t.flags),null===(c=l.rendering))if(a)$o(l,!1);else{if(0!==Dc||null!==e&&128&e.flags)for(e=t.child;null!==e;){if(null!==(c=el(e))){for(t.flags|=128,$o(l,!1),null!==(a=c.updateQueue)&&(t.updateQueue=a,t.flags|=4),t.subtreeFlags=0,a=n,n=t.child;null!==n;)e=a,(l=n).flags&=14680066,null===(c=l.alternate)?(l.childLanes=0,l.lanes=e,l.child=null,l.subtreeFlags=0,l.memoizedProps=null,l.memoizedState=null,l.updateQueue=null,l.dependencies=null,l.stateNode=null):(l.childLanes=c.childLanes,l.lanes=c.lanes,l.child=c.child,l.subtreeFlags=0,l.deletions=null,l.memoizedProps=c.memoizedProps,l.memoizedState=c.memoizedState,l.updateQueue=c.updateQueue,l.type=c.type,e=c.dependencies,l.dependencies=null===e?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Sr(Zi,1&Zi.current|2),t.child}e=e.sibling}null!==l.tail&&Ke()>Uc&&(t.flags|=128,a=!0,$o(l,!1),t.lanes=4194304)}else{if(!a)if(null!==(e=el(c))){if(t.flags|=128,a=!0,null!==(n=e.updateQueue)&&(t.updateQueue=n,t.flags|=4),$o(l,!0),null===l.tail&&"hidden"===l.tailMode&&!c.alternate&&!ri)return Go(t),null}else 2*Ke()-l.renderingStartTime>Uc&&1073741824!==n&&(t.flags|=128,a=!0,$o(l,!1),t.lanes=4194304);l.isBackwards?(c.sibling=t.child,t.child=c):(null!==(n=l.last)?n.sibling=c:t.child=c,l.last=c)}return null!==l.tail?(t=l.tail,l.rendering=t,l.tail=t.sibling,l.renderingStartTime=Ke(),t.sibling=null,n=Zi.current,Sr(Zi,a?1&n|2:1&n),t):(Go(t),null);case 22:case 23:return su(),a=null!==t.memoizedState,null!==e&&null!==e.memoizedState!==a&&(t.flags|=8192),a&&1&t.mode?!!(1073741824&Tc)&&(Go(t),6&t.subtreeFlags&&(t.flags|=8192)):Go(t),null;case 24:case 25:return null}throw Error(i(156,t.tag))}function Qo(e,t){switch(ti(t),t.tag){case 1:return Ar(t.type)&&Dr(),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return Xi(),Nr(Or),Nr(Pr),nl(),65536&(e=t.flags)&&!(128&e)?(t.flags=-65537&e|128,t):null;case 5:return Ji(t),null;case 13:if(Nr(Zi),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(i(340));di()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return Nr(Zi),null;case 4:return Xi(),null;case 10:return Ci(t.type._context),null;case 22:case 23:return su(),null;default:return null}}To=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)e.appendChild(n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},Ao=function(e,t,n,a){var r=e.memoizedProps;if(r!==a){e=t.stateNode,Yi(Gi.current);var i,l=null;switch(n){case"input":r=q(e,r),a=q(e,a),l=[];break;case"select":r=R({},r,{value:void 0}),a=R({},a,{value:void 0}),l=[];break;case"textarea":r=ae(e,r),a=ae(e,a),l=[];break;default:"function"!=typeof r.onClick&&"function"==typeof a.onClick&&(e.onclick=Za)}for(s in be(n,a),n=null,r)if(!a.hasOwnProperty(s)&&r.hasOwnProperty(s)&&null!=r[s])if("style"===s){var c=r[s];for(i in c)c.hasOwnProperty(i)&&(n||(n={}),n[i]="")}else"dangerouslySetInnerHTML"!==s&&"children"!==s&&"suppressContentEditableWarning"!==s&&"suppressHydrationWarning"!==s&&"autoFocus"!==s&&(o.hasOwnProperty(s)?l||(l=[]):(l=l||[]).push(s,null));for(s in a){var u=a[s];if(c=null!=r?r[s]:void 0,a.hasOwnProperty(s)&&u!==c&&(null!=u||null!=c))if("style"===s)if(c){for(i in c)!c.hasOwnProperty(i)||u&&u.hasOwnProperty(i)||(n||(n={}),n[i]="");for(i in u)u.hasOwnProperty(i)&&c[i]!==u[i]&&(n||(n={}),n[i]=u[i])}else n||(l||(l=[]),l.push(s,n)),n=u;else"dangerouslySetInnerHTML"===s?(u=u?u.__html:void 0,c=c?c.__html:void 0,null!=u&&c!==u&&(l=l||[]).push(s,u)):"children"===s?"string"!=typeof u&&"number"!=typeof u||(l=l||[]).push(s,""+u):"suppressContentEditableWarning"!==s&&"suppressHydrationWarning"!==s&&(o.hasOwnProperty(s)?(null!=u&&"onScroll"===s&&Ma("scroll",e),l||c===u||(l=[])):(l=l||[]).push(s,u))}n&&(l=l||[]).push("style",n);var s=l;(t.updateQueue=s)&&(t.flags|=4)}},Do=function(e,t,n,a){n!==a&&(t.flags|=4)};var Yo=!1,qo=!1,Xo="function"==typeof WeakSet?WeakSet:Set,Ko=null;function Jo(e,t){var n=e.ref;if(null!==n)if("function"==typeof n)try{n(null)}catch(n){wu(e,t,n)}else n.current=null}function Zo(e,t,n){try{n()}catch(n){wu(e,t,n)}}var ec=!1;function tc(e,t,n){var a=t.updateQueue;if(null!==(a=null!==a?a.lastEffect:null)){var r=a=a.next;do{if((r.tag&e)===e){var i=r.destroy;r.destroy=void 0,void 0!==i&&Zo(t,n,i)}r=r.next}while(r!==a)}}function nc(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var n=t=t.next;do{if((n.tag&e)===e){var a=n.create;n.destroy=a()}n=n.next}while(n!==t)}}function ac(e){var t=e.ref;if(null!==t){var n=e.stateNode;e.tag,e=n,"function"==typeof t?t(e):t.current=e}}function rc(e){var t=e.alternate;null!==t&&(e.alternate=null,rc(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&(null!==(t=e.stateNode)&&(delete t[fr],delete t[dr],delete t[vr],delete t[yr],delete t[gr])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function ic(e){return 5===e.tag||3===e.tag||4===e.tag}function lc(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||ic(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(2&e.flags)continue e;if(null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function oc(e,t,n){var a=e.tag;if(5===a||6===a)e=e.stateNode,t?8===n.nodeType?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(8===n.nodeType?(t=n.parentNode).insertBefore(e,n):(t=n).appendChild(e),null!=(n=n._reactRootContainer)||null!==t.onclick||(t.onclick=Za));else if(4!==a&&null!==(e=e.child))for(oc(e,t,n),e=e.sibling;null!==e;)oc(e,t,n),e=e.sibling}function cc(e,t,n){var a=e.tag;if(5===a||6===a)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(4!==a&&null!==(e=e.child))for(cc(e,t,n),e=e.sibling;null!==e;)cc(e,t,n),e=e.sibling}var uc=null,sc=!1;function mc(e,t,n){for(n=n.child;null!==n;)fc(e,t,n),n=n.sibling}function fc(e,t,n){if(it&&"function"==typeof it.onCommitFiberUnmount)try{it.onCommitFiberUnmount(rt,n)}catch(e){}switch(n.tag){case 5:qo||Jo(n,t);case 6:var a=uc,r=sc;uc=null,mc(e,t,n),sc=r,null!==(uc=a)&&(sc?(e=uc,n=n.stateNode,8===e.nodeType?e.parentNode.removeChild(n):e.removeChild(n)):uc.removeChild(n.stateNode));break;case 18:null!==uc&&(sc?(e=uc,n=n.stateNode,8===e.nodeType?cr(e.parentNode,n):1===e.nodeType&&cr(e,n),Wt(e)):cr(uc,n.stateNode));break;case 4:a=uc,r=sc,uc=n.stateNode.containerInfo,sc=!0,mc(e,t,n),uc=a,sc=r;break;case 0:case 11:case 14:case 15:if(!qo&&(null!==(a=n.updateQueue)&&null!==(a=a.lastEffect))){r=a=a.next;do{var i=r,l=i.destroy;i=i.tag,void 0!==l&&(2&i||4&i)&&Zo(n,t,l),r=r.next}while(r!==a)}mc(e,t,n);break;case 1:if(!qo&&(Jo(n,t),"function"==typeof(a=n.stateNode).componentWillUnmount))try{a.props=n.memoizedProps,a.state=n.memoizedState,a.componentWillUnmount()}catch(e){wu(n,t,e)}mc(e,t,n);break;case 21:mc(e,t,n);break;case 22:1&n.mode?(qo=(a=qo)||null!==n.memoizedState,mc(e,t,n),qo=a):mc(e,t,n);break;default:mc(e,t,n)}}function dc(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var n=e.stateNode;null===n&&(n=e.stateNode=new Xo),t.forEach(function(t){var a=Cu.bind(null,e,t);n.has(t)||(n.add(t),t.then(a,a))})}}function pc(e,t){var n=t.deletions;if(null!==n)for(var a=0;a<n.length;a++){var r=n[a];try{var l=e,o=t,c=o;e:for(;null!==c;){switch(c.tag){case 5:uc=c.stateNode,sc=!1;break e;case 3:case 4:uc=c.stateNode.containerInfo,sc=!0;break e}c=c.return}if(null===uc)throw Error(i(160));fc(l,o,r),uc=null,sc=!1;var u=r.alternate;null!==u&&(u.return=null),r.return=null}catch(e){wu(r,t,e)}}if(12854&t.subtreeFlags)for(t=t.child;null!==t;)vc(t,e),t=t.sibling}function vc(e,t){var n=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(pc(t,e),yc(e),4&a){try{tc(3,e,e.return),nc(3,e)}catch(t){wu(e,e.return,t)}try{tc(5,e,e.return)}catch(t){wu(e,e.return,t)}}break;case 1:pc(t,e),yc(e),512&a&&null!==n&&Jo(n,n.return);break;case 5:if(pc(t,e),yc(e),512&a&&null!==n&&Jo(n,n.return),32&e.flags){var r=e.stateNode;try{fe(r,"")}catch(t){wu(e,e.return,t)}}if(4&a&&null!=(r=e.stateNode)){var l=e.memoizedProps,o=null!==n?n.memoizedProps:l,c=e.type,u=e.updateQueue;if(e.updateQueue=null,null!==u)try{"input"===c&&"radio"===l.type&&null!=l.name&&K(r,l),he(c,o);var s=he(c,l);for(o=0;o<u.length;o+=2){var m=u[o],f=u[o+1];"style"===m?ye(r,f):"dangerouslySetInnerHTML"===m?me(r,f):"children"===m?fe(r,f):h(r,m,f,s)}switch(c){case"input":J(r,l);break;case"textarea":ie(r,l);break;case"select":var d=r._wrapperState.wasMultiple;r._wrapperState.wasMultiple=!!l.multiple;var p=l.value;null!=p?ne(r,!!l.multiple,p,!1):d!==!!l.multiple&&(null!=l.defaultValue?ne(r,!!l.multiple,l.defaultValue,!0):ne(r,!!l.multiple,l.multiple?[]:"",!1))}r[dr]=l}catch(t){wu(e,e.return,t)}}break;case 6:if(pc(t,e),yc(e),4&a){if(null===e.stateNode)throw Error(i(162));r=e.stateNode,l=e.memoizedProps;try{r.nodeValue=l}catch(t){wu(e,e.return,t)}}break;case 3:if(pc(t,e),yc(e),4&a&&null!==n&&n.memoizedState.isDehydrated)try{Wt(t.containerInfo)}catch(t){wu(e,e.return,t)}break;case 4:default:pc(t,e),yc(e);break;case 13:pc(t,e),yc(e),8192&(r=e.child).flags&&(l=null!==r.memoizedState,r.stateNode.isHidden=l,!l||null!==r.alternate&&null!==r.alternate.memoizedState||(Bc=Ke())),4&a&&dc(e);break;case 22:if(m=null!==n&&null!==n.memoizedState,1&e.mode?(qo=(s=qo)||m,pc(t,e),qo=s):pc(t,e),yc(e),8192&a){if(s=null!==e.memoizedState,(e.stateNode.isHidden=s)&&!m&&1&e.mode)for(Ko=e,m=e.child;null!==m;){for(f=Ko=m;null!==Ko;){switch(p=(d=Ko).child,d.tag){case 0:case 11:case 14:case 15:tc(4,d,d.return);break;case 1:Jo(d,d.return);var v=d.stateNode;if("function"==typeof v.componentWillUnmount){a=d,n=d.return;try{t=a,v.props=t.memoizedProps,v.state=t.memoizedState,v.componentWillUnmount()}catch(e){wu(a,n,e)}}break;case 5:Jo(d,d.return);break;case 22:if(null!==d.memoizedState){Ec(f);continue}}null!==p?(p.return=d,Ko=p):Ec(f)}m=m.sibling}e:for(m=null,f=e;;){if(5===f.tag){if(null===m){m=f;try{r=f.stateNode,s?"function"==typeof(l=r.style).setProperty?l.setProperty("display","none","important"):l.display="none":(c=f.stateNode,o=null!=(u=f.memoizedProps.style)&&u.hasOwnProperty("display")?u.display:null,c.style.display=ve("display",o))}catch(t){wu(e,e.return,t)}}}else if(6===f.tag){if(null===m)try{f.stateNode.nodeValue=s?"":f.memoizedProps}catch(t){wu(e,e.return,t)}}else if((22!==f.tag&&23!==f.tag||null===f.memoizedState||f===e)&&null!==f.child){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;null===f.sibling;){if(null===f.return||f.return===e)break e;m===f&&(m=null),f=f.return}m===f&&(m=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:pc(t,e),yc(e),4&a&&dc(e);case 21:}}function yc(e){var t=e.flags;if(2&t){try{e:{for(var n=e.return;null!==n;){if(ic(n)){var a=n;break e}n=n.return}throw Error(i(160))}switch(a.tag){case 5:var r=a.stateNode;32&a.flags&&(fe(r,""),a.flags&=-33),cc(e,lc(e),r);break;case 3:case 4:var l=a.stateNode.containerInfo;oc(e,lc(e),l);break;default:throw Error(i(161))}}catch(t){wu(e,e.return,t)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function gc(e,t,n){Ko=e,bc(e,t,n)}function bc(e,t,n){for(var a=!!(1&e.mode);null!==Ko;){var r=Ko,i=r.child;if(22===r.tag&&a){var l=null!==r.memoizedState||Yo;if(!l){var o=r.alternate,c=null!==o&&null!==o.memoizedState||qo;o=Yo;var u=qo;if(Yo=l,(qo=c)&&!u)for(Ko=r;null!==Ko;)c=(l=Ko).child,22===l.tag&&null!==l.memoizedState?xc(r):null!==c?(c.return=l,Ko=c):xc(r);for(;null!==i;)Ko=i,bc(i,t,n),i=i.sibling;Ko=r,Yo=o,qo=u}hc(e)}else 8772&r.subtreeFlags&&null!==i?(i.return=r,Ko=i):hc(e)}}function hc(e){for(;null!==Ko;){var t=Ko;if(8772&t.flags){var n=t.alternate;try{if(8772&t.flags)switch(t.tag){case 0:case 11:case 15:qo||nc(5,t);break;case 1:var a=t.stateNode;if(4&t.flags&&!qo)if(null===n)a.componentDidMount();else{var r=t.elementType===t.type?n.memoizedProps:to(t.type,n.memoizedProps);a.componentDidUpdate(r,n.memoizedState,a.__reactInternalSnapshotBeforeUpdate)}var l=t.updateQueue;null!==l&&Vi(t,l,a);break;case 3:var o=t.updateQueue;if(null!==o){if(n=null,null!==t.child)switch(t.child.tag){case 5:case 1:n=t.child.stateNode}Vi(t,o,n)}break;case 5:var c=t.stateNode;if(null===n&&4&t.flags){n=c;var u=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":u.autoFocus&&n.focus();break;case"img":u.src&&(n.src=u.src)}}break;case 6:case 4:case 12:case 19:case 17:case 21:case 22:case 23:case 25:break;case 13:if(null===t.memoizedState){var s=t.alternate;if(null!==s){var m=s.memoizedState;if(null!==m){var f=m.dehydrated;null!==f&&Wt(f)}}}break;default:throw Error(i(163))}qo||512&t.flags&&ac(t)}catch(e){wu(t,t.return,e)}}if(t===e){Ko=null;break}if(null!==(n=t.sibling)){n.return=t.return,Ko=n;break}Ko=t.return}}function Ec(e){for(;null!==Ko;){var t=Ko;if(t===e){Ko=null;break}var n=t.sibling;if(null!==n){n.return=t.return,Ko=n;break}Ko=t.return}}function xc(e){for(;null!==Ko;){var t=Ko;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{nc(4,t)}catch(e){wu(t,n,e)}break;case 1:var a=t.stateNode;if("function"==typeof a.componentDidMount){var r=t.return;try{a.componentDidMount()}catch(e){wu(t,r,e)}}var i=t.return;try{ac(t)}catch(e){wu(t,i,e)}break;case 5:var l=t.return;try{ac(t)}catch(e){wu(t,l,e)}}}catch(e){wu(t,t.return,e)}if(t===e){Ko=null;break}var o=t.sibling;if(null!==o){o.return=t.return,Ko=o;break}Ko=t.return}}var kc,wc=Math.ceil,_c=E.ReactCurrentDispatcher,Nc=E.ReactCurrentOwner,Sc=E.ReactCurrentBatchConfig,Cc=0,Pc=null,Oc=null,jc=0,Tc=0,Ac=_r(0),Dc=0,Fc=null,Lc=0,zc=0,Rc=0,Ic=null,Mc=null,Bc=0,Uc=1/0,Wc=null,Vc=!1,$c=null,Gc=null,Hc=!1,Qc=null,Yc=0,qc=0,Xc=null,Kc=-1,Jc=0;function Zc(){return 6&Cc?Ke():-1!==Kc?Kc:Kc=Ke()}function eu(e){return 1&e.mode?2&Cc&&0!==jc?jc&-jc:null!==vi.transition?(0===Jc&&(Jc=vt()),Jc):0!==(e=ht)?e:e=void 0===(e=window.event)?16:Xt(e.type):1}function tu(e,t,n,a){if(50<qc)throw qc=0,Xc=null,Error(i(185));gt(e,n,a),2&Cc&&e===Pc||(e===Pc&&(!(2&Cc)&&(zc|=n),4===Dc&&lu(e,jc)),nu(e,a),1===n&&0===Cc&&!(1&t.mode)&&(Uc=Ke()+500,Mr&&Wr()))}function nu(e,t){var n=e.callbackNode;!function(e,t){for(var n=e.suspendedLanes,a=e.pingedLanes,r=e.expirationTimes,i=e.pendingLanes;0<i;){var l=31-lt(i),o=1<<l,c=r[l];-1===c?0!==(o&n)&&0===(o&a)||(r[l]=dt(o,t)):c<=t&&(e.expiredLanes|=o),i&=~o}}(e,t);var a=ft(e,e===Pc?jc:0);if(0===a)null!==n&&Ye(n),e.callbackNode=null,e.callbackPriority=0;else if(t=a&-a,e.callbackPriority!==t){if(null!=n&&Ye(n),1===t)0===e.tag?function(e){Mr=!0,Ur(e)}(ou.bind(null,e)):Ur(ou.bind(null,e)),lr(function(){!(6&Cc)&&Wr()}),n=null;else{switch(Et(a)){case 1:n=Ze;break;case 4:n=et;break;case 16:default:n=tt;break;case 536870912:n=at}n=Pu(n,au.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function au(e,t){if(Kc=-1,Jc=0,6&Cc)throw Error(i(327));var n=e.callbackNode;if(xu()&&e.callbackNode!==n)return null;var a=ft(e,e===Pc?jc:0);if(0===a)return null;if(30&a||0!==(a&e.expiredLanes)||t)t=vu(e,a);else{t=a;var r=Cc;Cc|=2;var l=du();for(Pc===e&&jc===t||(Wc=null,Uc=Ke()+500,mu(e,t));;)try{gu();break}catch(t){fu(e,t)}Si(),_c.current=l,Cc=r,null!==Oc?t=0:(Pc=null,jc=0,t=Dc)}if(0!==t){if(2===t&&(0!==(r=pt(e))&&(a=r,t=ru(e,r))),1===t)throw n=Fc,mu(e,0),lu(e,a),nu(e,Ke()),n;if(6===t)lu(e,a);else{if(r=e.current.alternate,!(30&a||function(e){for(var t=e;;){if(16384&t.flags){var n=t.updateQueue;if(null!==n&&null!==(n=n.stores))for(var a=0;a<n.length;a++){var r=n[a],i=r.getSnapshot;r=r.value;try{if(!oa(i(),r))return!1}catch(e){return!1}}}if(n=t.child,16384&t.subtreeFlags&&null!==n)n.return=t,t=n;else{if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}(r)||(t=vu(e,a),2===t&&(l=pt(e),0!==l&&(a=l,t=ru(e,l))),1!==t)))throw n=Fc,mu(e,0),lu(e,a),nu(e,Ke()),n;switch(e.finishedWork=r,e.finishedLanes=a,t){case 0:case 1:throw Error(i(345));case 2:case 5:Eu(e,Mc,Wc);break;case 3:if(lu(e,a),(130023424&a)===a&&10<(t=Bc+500-Ke())){if(0!==ft(e,0))break;if(((r=e.suspendedLanes)&a)!==a){Zc(),e.pingedLanes|=e.suspendedLanes&r;break}e.timeoutHandle=ar(Eu.bind(null,e,Mc,Wc),t);break}Eu(e,Mc,Wc);break;case 4:if(lu(e,a),(4194240&a)===a)break;for(t=e.eventTimes,r=-1;0<a;){var o=31-lt(a);l=1<<o,(o=t[o])>r&&(r=o),a&=~l}if(a=r,10<(a=(120>(a=Ke()-a)?120:480>a?480:1080>a?1080:1920>a?1920:3e3>a?3e3:4320>a?4320:1960*wc(a/1960))-a)){e.timeoutHandle=ar(Eu.bind(null,e,Mc,Wc),a);break}Eu(e,Mc,Wc);break;default:throw Error(i(329))}}}return nu(e,Ke()),e.callbackNode===n?au.bind(null,e):null}function ru(e,t){var n=Ic;return e.current.memoizedState.isDehydrated&&(mu(e,t).flags|=256),2!==(e=vu(e,t))&&(t=Mc,Mc=n,null!==t&&iu(t)),e}function iu(e){null===Mc?Mc=e:Mc.push.apply(Mc,e)}function lu(e,t){for(t&=~Rc,t&=~zc,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-lt(t),a=1<<n;e[n]=-1,t&=~a}}function ou(e){if(6&Cc)throw Error(i(327));xu();var t=ft(e,0);if(!(1&t))return nu(e,Ke()),null;var n=vu(e,t);if(0!==e.tag&&2===n){var a=pt(e);0!==a&&(t=a,n=ru(e,a))}if(1===n)throw n=Fc,mu(e,0),lu(e,t),nu(e,Ke()),n;if(6===n)throw Error(i(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Eu(e,Mc,Wc),nu(e,Ke()),null}function cu(e,t){var n=Cc;Cc|=1;try{return e(t)}finally{0===(Cc=n)&&(Uc=Ke()+500,Mr&&Wr())}}function uu(e){null!==Qc&&0===Qc.tag&&!(6&Cc)&&xu();var t=Cc;Cc|=1;var n=Sc.transition,a=ht;try{if(Sc.transition=null,ht=1,e)return e()}finally{ht=a,Sc.transition=n,!(6&(Cc=t))&&Wr()}}function su(){Tc=Ac.current,Nr(Ac)}function mu(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(-1!==n&&(e.timeoutHandle=-1,rr(n)),null!==Oc)for(n=Oc.return;null!==n;){var a=n;switch(ti(a),a.tag){case 1:null!=(a=a.type.childContextTypes)&&Dr();break;case 3:Xi(),Nr(Or),Nr(Pr),nl();break;case 5:Ji(a);break;case 4:Xi();break;case 13:case 19:Nr(Zi);break;case 10:Ci(a.type._context);break;case 22:case 23:su()}n=n.return}if(Pc=e,Oc=e=Au(e.current,null),jc=Tc=t,Dc=0,Fc=null,Rc=zc=Lc=0,Mc=Ic=null,null!==Ti){for(t=0;t<Ti.length;t++)if(null!==(a=(n=Ti[t]).interleaved)){n.interleaved=null;var r=a.next,i=n.pending;if(null!==i){var l=i.next;i.next=r,a.next=l}n.pending=a}Ti=null}return e}function fu(e,t){for(;;){var n=Oc;try{if(Si(),al.current=Kl,ul){for(var a=ll.memoizedState;null!==a;){var r=a.queue;null!==r&&(r.pending=null),a=a.next}ul=!1}if(il=0,cl=ol=ll=null,sl=!1,ml=0,Nc.current=null,null===n||null===n.return){Dc=1,Fc=t,Oc=null;break}e:{var l=e,o=n.return,c=n,u=t;if(t=jc,c.flags|=32768,null!==u&&"object"==typeof u&&"function"==typeof u.then){var s=u,m=c,f=m.tag;if(!(1&m.mode||0!==f&&11!==f&&15!==f)){var d=m.alternate;d?(m.updateQueue=d.updateQueue,m.memoizedState=d.memoizedState,m.lanes=d.lanes):(m.updateQueue=null,m.memoizedState=null)}var p=yo(o);if(null!==p){p.flags&=-257,go(p,o,c,0,t),1&p.mode&&vo(l,s,t),u=s;var v=(t=p).updateQueue;if(null===v){var y=new Set;y.add(u),t.updateQueue=y}else v.add(u);break e}if(!(1&t)){vo(l,s,t),pu();break e}u=Error(i(426))}else if(ri&&1&c.mode){var g=yo(o);if(null!==g){!(65536&g.flags)&&(g.flags|=256),go(g,o,c,0,t),pi(co(u,c));break e}}l=u=co(u,c),4!==Dc&&(Dc=2),null===Ic?Ic=[l]:Ic.push(l),l=o;do{switch(l.tag){case 3:l.flags|=65536,t&=-t,l.lanes|=t,Ui(l,fo(0,u,t));break e;case 1:c=u;var b=l.type,h=l.stateNode;if(!(128&l.flags||"function"!=typeof b.getDerivedStateFromError&&(null===h||"function"!=typeof h.componentDidCatch||null!==Gc&&Gc.has(h)))){l.flags|=65536,t&=-t,l.lanes|=t,Ui(l,po(l,c,t));break e}}l=l.return}while(null!==l)}hu(n)}catch(e){t=e,Oc===n&&null!==n&&(Oc=n=n.return);continue}break}}function du(){var e=_c.current;return _c.current=Kl,null===e?Kl:e}function pu(){0!==Dc&&3!==Dc&&2!==Dc||(Dc=4),null===Pc||!(268435455&Lc)&&!(268435455&zc)||lu(Pc,jc)}function vu(e,t){var n=Cc;Cc|=2;var a=du();for(Pc===e&&jc===t||(Wc=null,mu(e,t));;)try{yu();break}catch(t){fu(e,t)}if(Si(),Cc=n,_c.current=a,null!==Oc)throw Error(i(261));return Pc=null,jc=0,Dc}function yu(){for(;null!==Oc;)bu(Oc)}function gu(){for(;null!==Oc&&!qe();)bu(Oc)}function bu(e){var t=kc(e.alternate,e,Tc);e.memoizedProps=e.pendingProps,null===t?hu(e):Oc=t,Nc.current=null}function hu(e){var t=e;do{var n=t.alternate;if(e=t.return,32768&t.flags){if(null!==(n=Qo(n,t)))return n.flags&=32767,void(Oc=n);if(null===e)return Dc=6,void(Oc=null);e.flags|=32768,e.subtreeFlags=0,e.deletions=null}else if(null!==(n=Ho(n,t,Tc)))return void(Oc=n);if(null!==(t=t.sibling))return void(Oc=t);Oc=t=e}while(null!==t);0===Dc&&(Dc=5)}function Eu(e,t,n){var a=ht,r=Sc.transition;try{Sc.transition=null,ht=1,function(e,t,n,a){do{xu()}while(null!==Qc);if(6&Cc)throw Error(i(327));n=e.finishedWork;var r=e.finishedLanes;if(null===n)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(i(177));e.callbackNode=null,e.callbackPriority=0;var l=n.lanes|n.childLanes;if(function(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var a=e.eventTimes;for(e=e.expirationTimes;0<n;){var r=31-lt(n),i=1<<r;t[r]=0,a[r]=-1,e[r]=-1,n&=~i}}(e,l),e===Pc&&(Oc=Pc=null,jc=0),!(2064&n.subtreeFlags)&&!(2064&n.flags)||Hc||(Hc=!0,Pu(tt,function(){return xu(),null})),l=!!(15990&n.flags),!!(15990&n.subtreeFlags)||l){l=Sc.transition,Sc.transition=null;var o=ht;ht=1;var c=Cc;Cc|=4,Nc.current=null,function(e,t){if(er=$t,da(e=fa())){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{var a=(n=(n=e.ownerDocument)&&n.defaultView||window).getSelection&&n.getSelection();if(a&&0!==a.rangeCount){n=a.anchorNode;var r=a.anchorOffset,l=a.focusNode;a=a.focusOffset;try{n.nodeType,l.nodeType}catch(e){n=null;break e}var o=0,c=-1,u=-1,s=0,m=0,f=e,d=null;t:for(;;){for(var p;f!==n||0!==r&&3!==f.nodeType||(c=o+r),f!==l||0!==a&&3!==f.nodeType||(u=o+a),3===f.nodeType&&(o+=f.nodeValue.length),null!==(p=f.firstChild);)d=f,f=p;for(;;){if(f===e)break t;if(d===n&&++s===r&&(c=o),d===l&&++m===a&&(u=o),null!==(p=f.nextSibling))break;d=(f=d).parentNode}f=p}n=-1===c||-1===u?null:{start:c,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(tr={focusedElem:e,selectionRange:n},$t=!1,Ko=t;null!==Ko;)if(e=(t=Ko).child,1028&t.subtreeFlags&&null!==e)e.return=t,Ko=e;else for(;null!==Ko;){t=Ko;try{var v=t.alternate;if(1024&t.flags)switch(t.tag){case 0:case 11:case 15:case 5:case 6:case 4:case 17:break;case 1:if(null!==v){var y=v.memoizedProps,g=v.memoizedState,b=t.stateNode,h=b.getSnapshotBeforeUpdate(t.elementType===t.type?y:to(t.type,y),g);b.__reactInternalSnapshotBeforeUpdate=h}break;case 3:var E=t.stateNode.containerInfo;1===E.nodeType?E.textContent="":9===E.nodeType&&E.documentElement&&E.removeChild(E.documentElement);break;default:throw Error(i(163))}}catch(e){wu(t,t.return,e)}if(null!==(e=t.sibling)){e.return=t.return,Ko=e;break}Ko=t.return}v=ec,ec=!1}(e,n),vc(n,e),pa(tr),$t=!!er,tr=er=null,e.current=n,gc(n,e,r),Xe(),Cc=c,ht=o,Sc.transition=l}else e.current=n;if(Hc&&(Hc=!1,Qc=e,Yc=r),l=e.pendingLanes,0===l&&(Gc=null),function(e){if(it&&"function"==typeof it.onCommitFiberRoot)try{it.onCommitFiberRoot(rt,e,void 0,!(128&~e.current.flags))}catch(e){}}(n.stateNode),nu(e,Ke()),null!==t)for(a=e.onRecoverableError,n=0;n<t.length;n++)r=t[n],a(r.value,{componentStack:r.stack,digest:r.digest});if(Vc)throw Vc=!1,e=$c,$c=null,e;!!(1&Yc)&&0!==e.tag&&xu(),l=e.pendingLanes,1&l?e===Xc?qc++:(qc=0,Xc=e):qc=0,Wr()}(e,t,n,a)}finally{Sc.transition=r,ht=a}return null}function xu(){if(null!==Qc){var e=Et(Yc),t=Sc.transition,n=ht;try{if(Sc.transition=null,ht=16>e?16:e,null===Qc)var a=!1;else{if(e=Qc,Qc=null,Yc=0,6&Cc)throw Error(i(331));var r=Cc;for(Cc|=4,Ko=e.current;null!==Ko;){var l=Ko,o=l.child;if(16&Ko.flags){var c=l.deletions;if(null!==c){for(var u=0;u<c.length;u++){var s=c[u];for(Ko=s;null!==Ko;){var m=Ko;switch(m.tag){case 0:case 11:case 15:tc(8,m,l)}var f=m.child;if(null!==f)f.return=m,Ko=f;else for(;null!==Ko;){var d=(m=Ko).sibling,p=m.return;if(rc(m),m===s){Ko=null;break}if(null!==d){d.return=p,Ko=d;break}Ko=p}}}var v=l.alternate;if(null!==v){var y=v.child;if(null!==y){v.child=null;do{var g=y.sibling;y.sibling=null,y=g}while(null!==y)}}Ko=l}}if(2064&l.subtreeFlags&&null!==o)o.return=l,Ko=o;else e:for(;null!==Ko;){if(2048&(l=Ko).flags)switch(l.tag){case 0:case 11:case 15:tc(9,l,l.return)}var b=l.sibling;if(null!==b){b.return=l.return,Ko=b;break e}Ko=l.return}}var h=e.current;for(Ko=h;null!==Ko;){var E=(o=Ko).child;if(2064&o.subtreeFlags&&null!==E)E.return=o,Ko=E;else e:for(o=h;null!==Ko;){if(2048&(c=Ko).flags)try{switch(c.tag){case 0:case 11:case 15:nc(9,c)}}catch(e){wu(c,c.return,e)}if(c===o){Ko=null;break e}var x=c.sibling;if(null!==x){x.return=c.return,Ko=x;break e}Ko=c.return}}if(Cc=r,Wr(),it&&"function"==typeof it.onPostCommitFiberRoot)try{it.onPostCommitFiberRoot(rt,e)}catch(e){}a=!0}return a}finally{ht=n,Sc.transition=t}}return!1}function ku(e,t,n){e=Mi(e,t=fo(0,t=co(n,t),1),1),t=Zc(),null!==e&&(gt(e,1,t),nu(e,t))}function wu(e,t,n){if(3===e.tag)ku(e,e,n);else for(;null!==t;){if(3===t.tag){ku(t,e,n);break}if(1===t.tag){var a=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof a.componentDidCatch&&(null===Gc||!Gc.has(a))){t=Mi(t,e=po(t,e=co(n,e),1),1),e=Zc(),null!==t&&(gt(t,1,e),nu(t,e));break}}t=t.return}}function _u(e,t,n){var a=e.pingCache;null!==a&&a.delete(t),t=Zc(),e.pingedLanes|=e.suspendedLanes&n,Pc===e&&(jc&n)===n&&(4===Dc||3===Dc&&(130023424&jc)===jc&&500>Ke()-Bc?mu(e,0):Rc|=n),nu(e,t)}function Nu(e,t){0===t&&(1&e.mode?(t=st,!(130023424&(st<<=1))&&(st=4194304)):t=1);var n=Zc();null!==(e=Fi(e,t))&&(gt(e,t,n),nu(e,n))}function Su(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),Nu(e,n)}function Cu(e,t){var n=0;switch(e.tag){case 13:var a=e.stateNode,r=e.memoizedState;null!==r&&(n=r.retryLane);break;case 19:a=e.stateNode;break;default:throw Error(i(314))}null!==a&&a.delete(t),Nu(e,n)}function Pu(e,t){return Qe(e,t)}function Ou(e,t,n,a){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ju(e,t,n,a){return new Ou(e,t,n,a)}function Tu(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Au(e,t){var n=e.alternate;return null===n?((n=ju(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=14680064&e.flags,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Du(e,t,n,a,r,l){var o=2;if(a=e,"function"==typeof e)Tu(e)&&(o=1);else if("string"==typeof e)o=5;else e:switch(e){case w:return Fu(n.children,r,l,t);case _:o=8,r|=8;break;case N:return(e=ju(12,n,t,2|r)).elementType=N,e.lanes=l,e;case O:return(e=ju(13,n,t,r)).elementType=O,e.lanes=l,e;case j:return(e=ju(19,n,t,r)).elementType=j,e.lanes=l,e;case D:return Lu(n,r,l,t);default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case S:o=10;break e;case C:o=9;break e;case P:o=11;break e;case T:o=14;break e;case A:o=16,a=null;break e}throw Error(i(130,null==e?e:typeof e,""))}return(t=ju(o,n,t,r)).elementType=e,t.type=a,t.lanes=l,t}function Fu(e,t,n,a){return(e=ju(7,e,a,t)).lanes=n,e}function Lu(e,t,n,a){return(e=ju(22,e,a,t)).elementType=D,e.lanes=n,e.stateNode={isHidden:!1},e}function zu(e,t,n){return(e=ju(6,e,null,t)).lanes=n,e}function Ru(e,t,n){return(t=ju(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Iu(e,t,n,a,r){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=yt(0),this.expirationTimes=yt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=yt(0),this.identifierPrefix=a,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function Mu(e,t,n,a,r,i,l,o,c){return e=new Iu(e,t,n,o,c),1===t?(t=1,!0===i&&(t|=8)):t=0,i=ju(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:a,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},zi(i),e}function Bu(e){if(!e)return Cr;e:{if(We(e=e._reactInternals)!==e||1!==e.tag)throw Error(i(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Ar(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(null!==t);throw Error(i(171))}if(1===e.tag){var n=e.type;if(Ar(n))return Lr(e,n,t)}return t}function Uu(e,t,n,a,r,i,l,o,c){return(e=Mu(n,a,!0,e,0,i,0,o,c)).context=Bu(null),n=e.current,(i=Ii(a=Zc(),r=eu(n))).callback=null!=t?t:null,Mi(n,i,r),e.current.lanes=r,gt(e,r,a),nu(e,a),e}function Wu(e,t,n,a){var r=t.current,i=Zc(),l=eu(r);return n=Bu(n),null===t.context?t.context=n:t.pendingContext=n,(t=Ii(i,l)).payload={element:e},null!==(a=void 0===a?null:a)&&(t.callback=a),null!==(e=Mi(r,t,l))&&(tu(e,r,l,i),Bi(e,r,l)),l}function Vu(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function $u(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n<t?n:t}}function Gu(e,t){$u(e,t),(e=e.alternate)&&$u(e,t)}kc=function(e,t,n){if(null!==e)if(e.memoizedProps!==t.pendingProps||Or.current)ho=!0;else{if(0===(e.lanes&n)&&!(128&t.flags))return ho=!1,function(e,t,n){switch(t.tag){case 3:Oo(t),di();break;case 5:Ki(t);break;case 1:Ar(t.type)&&zr(t);break;case 4:qi(t,t.stateNode.containerInfo);break;case 10:var a=t.type._context,r=t.memoizedProps.value;Sr(ki,a._currentValue),a._currentValue=r;break;case 13:if(null!==(a=t.memoizedState))return null!==a.dehydrated?(Sr(Zi,1&Zi.current),t.flags|=128,null):0!==(n&t.child.childLanes)?zo(e,t,n):(Sr(Zi,1&Zi.current),null!==(e=Vo(e,t,n))?e.sibling:null);Sr(Zi,1&Zi.current);break;case 19:if(a=0!==(n&t.childLanes),128&e.flags){if(a)return Uo(e,t,n);t.flags|=128}if(null!==(r=t.memoizedState)&&(r.rendering=null,r.tail=null,r.lastEffect=null),Sr(Zi,Zi.current),a)break;return null;case 22:case 23:return t.lanes=0,_o(e,t,n)}return Vo(e,t,n)}(e,t,n);ho=!!(131072&e.flags)}else ho=!1,ri&&1048576&t.flags&&Zr(t,Hr,t.index);switch(t.lanes=0,t.tag){case 2:var a=t.type;Wo(e,t),e=t.pendingProps;var r=Tr(t,Pr.current);Oi(t,n),r=vl(null,t,a,e,r,n);var l=yl();return t.flags|=1,"object"==typeof r&&null!==r&&"function"==typeof r.render&&void 0===r.$$typeof?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Ar(a)?(l=!0,zr(t)):l=!1,t.memoizedState=null!==r.state&&void 0!==r.state?r.state:null,zi(t),r.updater=ao,t.stateNode=r,r._reactInternals=t,oo(t,a,e,n),t=Po(null,t,a,!0,l,n)):(t.tag=0,ri&&l&&ei(t),Eo(null,t,r,n),t=t.child),t;case 16:a=t.elementType;e:{switch(Wo(e,t),e=t.pendingProps,a=(r=a._init)(a._payload),t.type=a,r=t.tag=function(e){if("function"==typeof e)return Tu(e)?1:0;if(null!=e){if((e=e.$$typeof)===P)return 11;if(e===T)return 14}return 2}(a),e=to(a,e),r){case 0:t=So(null,t,a,e,n);break e;case 1:t=Co(null,t,a,e,n);break e;case 11:t=xo(null,t,a,e,n);break e;case 14:t=ko(null,t,a,to(a.type,e),n);break e}throw Error(i(306,a,""))}return t;case 0:return a=t.type,r=t.pendingProps,So(e,t,a,r=t.elementType===a?r:to(a,r),n);case 1:return a=t.type,r=t.pendingProps,Co(e,t,a,r=t.elementType===a?r:to(a,r),n);case 3:e:{if(Oo(t),null===e)throw Error(i(387));a=t.pendingProps,r=(l=t.memoizedState).element,Ri(e,t),Wi(t,a,null,n);var o=t.memoizedState;if(a=o.element,l.isDehydrated){if(l={element:a,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=l,t.memoizedState=l,256&t.flags){t=jo(e,t,a,n,r=co(Error(i(423)),t));break e}if(a!==r){t=jo(e,t,a,n,r=co(Error(i(424)),t));break e}for(ai=ur(t.stateNode.containerInfo.firstChild),ni=t,ri=!0,ii=null,n=xi(t,null,a,n),t.child=n;n;)n.flags=-3&n.flags|4096,n=n.sibling}else{if(di(),a===r){t=Vo(e,t,n);break e}Eo(e,t,a,n)}t=t.child}return t;case 5:return Ki(t),null===e&&ui(t),a=t.type,r=t.pendingProps,l=null!==e?e.memoizedProps:null,o=r.children,nr(a,r)?o=null:null!==l&&nr(a,l)&&(t.flags|=32),No(e,t),Eo(e,t,o,n),t.child;case 6:return null===e&&ui(t),null;case 13:return zo(e,t,n);case 4:return qi(t,t.stateNode.containerInfo),a=t.pendingProps,null===e?t.child=Ei(t,null,a,n):Eo(e,t,a,n),t.child;case 11:return a=t.type,r=t.pendingProps,xo(e,t,a,r=t.elementType===a?r:to(a,r),n);case 7:return Eo(e,t,t.pendingProps,n),t.child;case 8:case 12:return Eo(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(a=t.type._context,r=t.pendingProps,l=t.memoizedProps,o=r.value,Sr(ki,a._currentValue),a._currentValue=o,null!==l)if(oa(l.value,o)){if(l.children===r.children&&!Or.current){t=Vo(e,t,n);break e}}else for(null!==(l=t.child)&&(l.return=t);null!==l;){var c=l.dependencies;if(null!==c){o=l.child;for(var u=c.firstContext;null!==u;){if(u.context===a){if(1===l.tag){(u=Ii(-1,n&-n)).tag=2;var s=l.updateQueue;if(null!==s){var m=(s=s.shared).pending;null===m?u.next=u:(u.next=m.next,m.next=u),s.pending=u}}l.lanes|=n,null!==(u=l.alternate)&&(u.lanes|=n),Pi(l.return,n,t),c.lanes|=n;break}u=u.next}}else if(10===l.tag)o=l.type===t.type?null:l.child;else if(18===l.tag){if(null===(o=l.return))throw Error(i(341));o.lanes|=n,null!==(c=o.alternate)&&(c.lanes|=n),Pi(o,n,t),o=l.sibling}else o=l.child;if(null!==o)o.return=l;else for(o=l;null!==o;){if(o===t){o=null;break}if(null!==(l=o.sibling)){l.return=o.return,o=l;break}o=o.return}l=o}Eo(e,t,r.children,n),t=t.child}return t;case 9:return r=t.type,a=t.pendingProps.children,Oi(t,n),a=a(r=ji(r)),t.flags|=1,Eo(e,t,a,n),t.child;case 14:return r=to(a=t.type,t.pendingProps),ko(e,t,a,r=to(a.type,r),n);case 15:return wo(e,t,t.type,t.pendingProps,n);case 17:return a=t.type,r=t.pendingProps,r=t.elementType===a?r:to(a,r),Wo(e,t),t.tag=1,Ar(a)?(e=!0,zr(t)):e=!1,Oi(t,n),io(t,a,r),oo(t,a,r,n),Po(null,t,a,!0,e,n);case 19:return Uo(e,t,n);case 22:return _o(e,t,n)}throw Error(i(156,t.tag))};var Hu="function"==typeof reportError?reportError:function(e){console.error(e)};function Qu(e){this._internalRoot=e}function Yu(e){this._internalRoot=e}function qu(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function Xu(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function Ku(){}function Ju(e,t,n,a,r){var i=n._reactRootContainer;if(i){var l=i;if("function"==typeof r){var o=r;r=function(){var e=Vu(l);o.call(e)}}Wu(t,l,e,r)}else l=function(e,t,n,a,r){if(r){if("function"==typeof a){var i=a;a=function(){var e=Vu(l);i.call(e)}}var l=Uu(t,a,e,0,null,!1,0,"",Ku);return e._reactRootContainer=l,e[pr]=l.current,Wa(8===e.nodeType?e.parentNode:e),uu(),l}for(;r=e.lastChild;)e.removeChild(r);if("function"==typeof a){var o=a;a=function(){var e=Vu(c);o.call(e)}}var c=Mu(e,0,!1,null,0,!1,0,"",Ku);return e._reactRootContainer=c,e[pr]=c.current,Wa(8===e.nodeType?e.parentNode:e),uu(function(){Wu(t,c,n,a)}),c}(n,t,e,r,a);return Vu(l)}Yu.prototype.render=Qu.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(i(409));Wu(e,t,null,null)},Yu.prototype.unmount=Qu.prototype.unmount=function(){var e=this._internalRoot;if(null!==e){this._internalRoot=null;var t=e.containerInfo;uu(function(){Wu(null,e,null,null)}),t[pr]=null}},Yu.prototype.unstable_scheduleHydration=function(e){if(e){var t=_t();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Dt.length&&0!==t&&t<Dt[n].priority;n++);Dt.splice(n,0,e),0===n&&Rt(e)}},xt=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=mt(t.pendingLanes);0!==n&&(bt(t,1|n),nu(t,Ke()),!(6&Cc)&&(Uc=Ke()+500,Wr()))}break;case 13:uu(function(){var t=Fi(e,1);if(null!==t){var n=Zc();tu(t,e,1,n)}}),Gu(e,1)}},kt=function(e){if(13===e.tag){var t=Fi(e,134217728);if(null!==t)tu(t,e,134217728,Zc());Gu(e,134217728)}},wt=function(e){if(13===e.tag){var t=eu(e),n=Fi(e,t);if(null!==n)tu(n,e,t,Zc());Gu(e,t)}},_t=function(){return ht},Nt=function(e,t){var n=ht;try{return ht=e,t()}finally{ht=n}},ke=function(e,t,n){switch(t){case"input":if(J(e,n),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var a=n[t];if(a!==e&&a.form===e.form){var r=xr(a);if(!r)throw Error(i(90));Q(a),J(a,r)}}}break;case"textarea":ie(e,n);break;case"select":null!=(t=n.value)&&ne(e,!!n.multiple,t,!1)}},Pe=cu,Oe=uu;var Zu={usingClientEntryPoint:!1,Events:[hr,Er,xr,Se,Ce,cu]},es={findFiberByHostInstance:br,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},ts={bundleType:es.bundleType,version:es.version,rendererPackageName:es.rendererPackageName,rendererConfig:es.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:E.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return null===(e=Ge(e))?null:e.stateNode},findFiberByHostInstance:es.findFiberByHostInstance||function(){return null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var ns=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ns.isDisabled&&ns.supportsFiber)try{rt=ns.inject(ts),it=ns}catch(se){}}t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Zu,t.createPortal=function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!qu(t))throw Error(i(200));return function(e,t,n){var a=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:k,key:null==a?null:""+a,children:e,containerInfo:t,implementation:n}}(e,t,null,n)},t.createRoot=function(e,t){if(!qu(e))throw Error(i(299));var n=!1,a="",r=Hu;return null!=t&&(!0===t.unstable_strictMode&&(n=!0),void 0!==t.identifierPrefix&&(a=t.identifierPrefix),void 0!==t.onRecoverableError&&(r=t.onRecoverableError)),t=Mu(e,1,!1,null,0,n,0,a,r),e[pr]=t.current,Wa(8===e.nodeType?e.parentNode:e),new Qu(t)},t.findDOMNode=function(e){if(null==e)return null;if(1===e.nodeType)return e;var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(i(188));throw e=Object.keys(e).join(","),Error(i(268,e))}return e=null===(e=Ge(t))?null:e.stateNode},t.flushSync=function(e){return uu(e)},t.hydrate=function(e,t,n){if(!Xu(t))throw Error(i(200));return Ju(null,e,t,!0,n)},t.hydrateRoot=function(e,t,n){if(!qu(e))throw Error(i(405));var a=null!=n&&n.hydratedSources||null,r=!1,l="",o=Hu;if(null!=n&&(!0===n.unstable_strictMode&&(r=!0),void 0!==n.identifierPrefix&&(l=n.identifierPrefix),void 0!==n.onRecoverableError&&(o=n.onRecoverableError)),t=Uu(t,null,e,1,null!=n?n:null,r,0,l,o),e[pr]=t.current,Wa(e),a)for(e=0;e<a.length;e++)r=(r=(n=a[e])._getVersion)(n._source),null==t.mutableSourceEagerHydrationData?t.mutableSourceEagerHydrationData=[n,r]:t.mutableSourceEagerHydrationData.push(n,r);return new Yu(t)},t.render=function(e,t,n){if(!Xu(t))throw Error(i(200));return Ju(null,e,t,!1,n)},t.unmountComponentAtNode=function(e){if(!Xu(e))throw Error(i(40));return!!e._reactRootContainer&&(uu(function(){Ju(null,null,e,!1,function(){e._reactRootContainer=null,e[pr]=null})}),!0)},t.unstable_batchedUpdates=cu,t.unstable_renderSubtreeIntoContainer=function(e,t,n,a){if(!Xu(n))throw Error(i(200));if(null==e||void 0===e._reactInternals)throw Error(i(38));return Ju(e,t,n,!1,a)},t.version="18.3.1-next-f1338f8080-20240426"},338(e,t,n){var a=n(961);t.H=a.createRoot,a.hydrateRoot},961(e,t,n){!function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}(),e.exports=n(551)},287(e,t){
/**
 * @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 n=Symbol.for("react.element"),a=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),s=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),d=Symbol.iterator;var p={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,y={};function g(e,t,n){this.props=e,this.context=t,this.refs=y,this.updater=n||p}function b(){}function h(e,t,n){this.props=e,this.context=t,this.refs=y,this.updater=n||p}g.prototype.isReactComponent={},g.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},g.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},b.prototype=g.prototype;var E=h.prototype=new b;E.constructor=h,v(E,g.prototype),E.isPureReactComponent=!0;var x=Array.isArray,k=Object.prototype.hasOwnProperty,w={current:null},_={key:!0,ref:!0,__self:!0,__source:!0};function N(e,t,a){var r,i={},l=null,o=null;if(null!=t)for(r in void 0!==t.ref&&(o=t.ref),void 0!==t.key&&(l=""+t.key),t)k.call(t,r)&&!_.hasOwnProperty(r)&&(i[r]=t[r]);var c=arguments.length-2;if(1===c)i.children=a;else if(1<c){for(var u=Array(c),s=0;s<c;s++)u[s]=arguments[s+2];i.children=u}if(e&&e.defaultProps)for(r in c=e.defaultProps)void 0===i[r]&&(i[r]=c[r]);return{$$typeof:n,type:e,key:l,ref:o,props:i,_owner:w.current}}function S(e){return"object"==typeof e&&null!==e&&e.$$typeof===n}var C=/\/+/g;function P(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(e){return t[e]})}(""+e.key):t.toString(36)}function O(e,t,r,i,l){var o=typeof e;"undefined"!==o&&"boolean"!==o||(e=null);var c=!1;if(null===e)c=!0;else switch(o){case"string":case"number":c=!0;break;case"object":switch(e.$$typeof){case n:case a:c=!0}}if(c)return l=l(c=e),e=""===i?"."+P(c,0):i,x(l)?(r="",null!=e&&(r=e.replace(C,"$&/")+"/"),O(l,t,r,"",function(e){return e})):null!=l&&(S(l)&&(l=function(e,t){return{$$typeof:n,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(l,r+(!l.key||c&&c.key===l.key?"":(""+l.key).replace(C,"$&/")+"/")+e)),t.push(l)),1;if(c=0,i=""===i?".":i+":",x(e))for(var u=0;u<e.length;u++){var s=i+P(o=e[u],u);c+=O(o,t,r,s,l)}else if(s=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=d&&e[d]||e["@@iterator"])?e:null}(e),"function"==typeof s)for(e=s.call(e),u=0;!(o=e.next()).done;)c+=O(o=o.value,t,r,s=i+P(o,u++),l);else if("object"===o)throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return c}function j(e,t,n){if(null==e)return e;var a=[],r=0;return O(e,a,"","",function(e){return t.call(n,e,r++)}),a}function T(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)},function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var A={current:null},D={transition:null},F={ReactCurrentDispatcher:A,ReactCurrentBatchConfig:D,ReactCurrentOwner:w};function L(){throw Error("act(...) is not supported in production builds of React.")}t.Children={map:j,forEach:function(e,t,n){j(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return j(e,function(){t++}),t},toArray:function(e){return j(e,function(e){return e})||[]},only:function(e){if(!S(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},t.Component=g,t.Fragment=r,t.Profiler=l,t.PureComponent=h,t.StrictMode=i,t.Suspense=s,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=F,t.act=L,t.cloneElement=function(e,t,a){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=v({},e.props),i=e.key,l=e.ref,o=e._owner;if(null!=t){if(void 0!==t.ref&&(l=t.ref,o=w.current),void 0!==t.key&&(i=""+t.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(u in t)k.call(t,u)&&!_.hasOwnProperty(u)&&(r[u]=void 0===t[u]&&void 0!==c?c[u]:t[u])}var u=arguments.length-2;if(1===u)r.children=a;else if(1<u){c=Array(u);for(var s=0;s<u;s++)c[s]=arguments[s+2];r.children=c}return{$$typeof:n,type:e.type,key:i,ref:l,props:r,_owner:o}},t.createContext=function(e){return(e={$$typeof:c,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:o,_context:e},e.Consumer=e},t.createElement=N,t.createFactory=function(e){var t=N.bind(null,e);return t.type=e,t},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:u,render:e}},t.isValidElement=S,t.lazy=function(e){return{$$typeof:f,_payload:{_status:-1,_result:e},_init:T}},t.memo=function(e,t){return{$$typeof:m,type:e,compare:void 0===t?null:t}},t.startTransition=function(e){var t=D.transition;D.transition={};try{e()}finally{D.transition=t}},t.unstable_act=L,t.useCallback=function(e,t){return A.current.useCallback(e,t)},t.useContext=function(e){return A.current.useContext(e)},t.useDebugValue=function(){},t.useDeferredValue=function(e){return A.current.useDeferredValue(e)},t.useEffect=function(e,t){return A.current.useEffect(e,t)},t.useId=function(){return A.current.useId()},t.useImperativeHandle=function(e,t,n){return A.current.useImperativeHandle(e,t,n)},t.useInsertionEffect=function(e,t){return A.current.useInsertionEffect(e,t)},t.useLayoutEffect=function(e,t){return A.current.useLayoutEffect(e,t)},t.useMemo=function(e,t){return A.current.useMemo(e,t)},t.useReducer=function(e,t,n){return A.current.useReducer(e,t,n)},t.useRef=function(e){return A.current.useRef(e)},t.useState=function(e){return A.current.useState(e)},t.useSyncExternalStore=function(e,t,n){return A.current.useSyncExternalStore(e,t,n)},t.useTransition=function(){return A.current.useTransition()},t.version="18.3.1"},540(e,t,n){e.exports=n(287)},463(e,t){
/**
 * @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.
 */
function n(e,t){var n=e.length;e.push(t);e:for(;0<n;){var a=n-1>>>1,r=e[a];if(!(0<i(r,t)))break e;e[a]=t,e[n]=r,n=a}}function a(e){return 0===e.length?null:e[0]}function r(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var a=0,r=e.length,l=r>>>1;a<l;){var o=2*(a+1)-1,c=e[o],u=o+1,s=e[u];if(0>i(c,n))u<r&&0>i(s,c)?(e[a]=s,e[u]=n,a=u):(e[a]=c,e[o]=n,a=o);else{if(!(u<r&&0>i(s,n)))break e;e[a]=s,e[u]=n,a=u}}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if("object"==typeof performance&&"function"==typeof performance.now){var l=performance;t.unstable_now=function(){return l.now()}}else{var o=Date,c=o.now();t.unstable_now=function(){return o.now()-c}}var u=[],s=[],m=1,f=null,d=3,p=!1,v=!1,y=!1,g="function"==typeof setTimeout?setTimeout:null,b="function"==typeof clearTimeout?clearTimeout:null,h="undefined"!=typeof setImmediate?setImmediate:null;function E(e){for(var t=a(s);null!==t;){if(null===t.callback)r(s);else{if(!(t.startTime<=e))break;r(s),t.sortIndex=t.expirationTime,n(u,t)}t=a(s)}}function x(e){if(y=!1,E(e),!v)if(null!==a(u))v=!0,D(k);else{var t=a(s);null!==t&&F(x,t.startTime-e)}}function k(e,n){v=!1,y&&(y=!1,b(S),S=-1),p=!0;var i=d;try{for(E(n),f=a(u);null!==f&&(!(f.expirationTime>n)||e&&!O());){var l=f.callback;if("function"==typeof l){f.callback=null,d=f.priorityLevel;var o=l(f.expirationTime<=n);n=t.unstable_now(),"function"==typeof o?f.callback=o:f===a(u)&&r(u),E(n)}else r(u);f=a(u)}if(null!==f)var c=!0;else{var m=a(s);null!==m&&F(x,m.startTime-n),c=!1}return c}finally{f=null,d=i,p=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var w,_=!1,N=null,S=-1,C=5,P=-1;function O(){return!(t.unstable_now()-P<C)}function j(){if(null!==N){var e=t.unstable_now();P=e;var n=!0;try{n=N(!0,e)}finally{n?w():(_=!1,N=null)}}else _=!1}if("function"==typeof h)w=function(){h(j)};else if("undefined"!=typeof MessageChannel){var T=new MessageChannel,A=T.port2;T.port1.onmessage=j,w=function(){A.postMessage(null)}}else w=function(){g(j,0)};function D(e){N=e,_||(_=!0,w())}function F(e,n){S=g(function(){e(t.unstable_now())},n)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){v||p||(v=!0,D(k))},t.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):C=0<e?Math.floor(1e3/e):5},t.unstable_getCurrentPriorityLevel=function(){return d},t.unstable_getFirstCallbackNode=function(){return a(u)},t.unstable_next=function(e){switch(d){case 1:case 2:case 3:var t=3;break;default:t=d}var n=d;d=t;try{return e()}finally{d=n}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=d;d=e;try{return t()}finally{d=n}},t.unstable_scheduleCallback=function(e,r,i){var l=t.unstable_now();switch("object"==typeof i&&null!==i?i="number"==typeof(i=i.delay)&&0<i?l+i:l:i=l,e){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 e={id:m++,callback:r,priorityLevel:e,startTime:i,expirationTime:o=i+o,sortIndex:-1},i>l?(e.sortIndex=i,n(s,e),null===a(u)&&e===a(s)&&(y?(b(S),S=-1):y=!0,F(x,i-l))):(e.sortIndex=o,n(u,e),v||p||(v=!0,D(k))),e},t.unstable_shouldYield=O,t.unstable_wrapCallback=function(e){var t=d;return function(){var n=d;d=t;try{return e.apply(this,arguments)}finally{d=n}}}},982(e,t,n){e.exports=n(463)}},t={};function n(a){var r=t[a];if(void 0!==r)return r.exports;var i=t[a]={exports:{}};return e[a](i,i.exports,n),i.exports}var a,r,i,l,o=n(540),c=n(338),u=/%(((\d+)\$)|(\(([$_a-zA-Z][$_a-zA-Z0-9]*)\)))?[ +0#-]*\d*(\.(\d+|\*))?(ll|[lhqL])?([cduxXefgsp%])/g;function s(e,...t){return function(e,...t){var n=0;return Array.isArray(t[0])&&(t=t[0]),e.replace(u,function(){var e,a,r,i,l;return e=arguments[3],a=arguments[5],"%"===(i=arguments[9])?"%":("*"===(r=arguments[7])&&(r=t[n],n++),void 0===a?(void 0===e&&(e=n+1),n++,l=t[e-1]):t[0]&&"object"==typeof t[0]&&t[0].hasOwnProperty(a)&&(l=t[0][a]),"f"===i?l=parseFloat(l)||0:"d"===i&&(l=parseInt(l)||0),void 0!==r&&("f"===i?l=l.toFixed(r):"s"===i&&(l=l.substr(0,r))),null!=l?l:"")})}(e,...t)}a={"(":9,"!":8,"*":7,"/":7,"%":7,"+":6,"-":6,"<":5,"<=":5,">":5,">=":5,"==":4,"!=":4,"&&":3,"||":2,"?":1,"?:":1},r=["(","?"],i={")":["("],":":["?","?:"]},l=/<=|>=|==|!=|&&|\|\||\?:|\(|!|\*|\/|%|\+|-|<|>|\?|\)|:/;var m={"!":function(e){return!e},"*":function(e,t){return e*t},"/":function(e,t){return e/t},"%":function(e,t){return e%t},"+":function(e,t){return e+t},"-":function(e,t){return e-t},"<":function(e,t){return e<t},"<=":function(e,t){return e<=t},">":function(e,t){return e>t},">=":function(e,t){return e>=t},"==":function(e,t){return e===t},"!=":function(e,t){return e!==t},"&&":function(e,t){return e&&t},"||":function(e,t){return e||t},"?:":function(e,t,n){if(e)throw t;return n}};function f(e){var t=function(e){for(var t,n,o,c,u=[],s=[];t=e.match(l);){for(n=t[0],(o=e.substr(0,t.index).trim())&&u.push(o);c=s.pop();){if(i[n]){if(i[n][0]===c){n=i[n][1]||n;break}}else if(r.indexOf(c)>=0||a[c]<a[n]){s.push(c);break}u.push(c)}i[n]||s.push(n),e=e.substr(t.index+n.length)}return(e=e.trim())&&u.push(e),u.concat(s.reverse())}(e);return function(e){return function(e,t){var n,a,r,i,l,o,c=[];for(n=0;n<e.length;n++){if(l=e[n],i=m[l]){for(a=i.length,r=Array(a);a--;)r[a]=c.pop();try{o=i.apply(null,r)}catch(e){return e}}else o=t.hasOwnProperty(l)?t[l]:+l;c.push(o)}return c[0]}(t,e)}}var d={contextDelimiter:"",onMissingKey:null};function p(e,t){var n;for(n in this.data=e,this.pluralForms={},this.options={},d)this.options[n]=void 0!==t&&n in t?t[n]:d[n]}p.prototype.getPluralForm=function(e,t){var n,a,r,i=this.pluralForms[e];return i||("function"!=typeof(r=(n=this.data[e][""])["Plural-Forms"]||n["plural-forms"]||n.plural_forms)&&(a=function(e){var t,n,a;for(t=e.split(";"),n=0;n<t.length;n++)if(0===(a=t[n].trim()).indexOf("plural="))return a.substr(7)}(n["Plural-Forms"]||n["plural-forms"]||n.plural_forms),r=function(e){var t=f(e);return function(e){return+t({n:e})}}(a)),i=this.pluralForms[e]=r),i(t)},p.prototype.dcnpgettext=function(e,t,n,a,r){var i,l,o;return i=void 0===r?0:this.getPluralForm(e,r),l=n,t&&(l=t+this.options.contextDelimiter+n),(o=this.data[e][l])&&o[i]?o[i]:(this.options.onMissingKey&&this.options.onMissingKey(n,e),0===i?n:a)};var v={plural_forms:e=>1===e?0:1},y=/^i18n\.(n?gettext|has_translation)(_|$)/;var g=function(e){return"string"!=typeof e||""===e?(console.error("The namespace must be a non-empty string."),!1):!!/^[a-zA-Z][a-zA-Z0-9_.\-\/]*$/.test(e)||(console.error("The namespace can only contain numbers, letters, dashes, periods, underscores and slashes."),!1)};var b=function(e){return"string"!=typeof e||""===e?(console.error("The hook name must be a non-empty string."),!1):/^__/.test(e)?(console.error("The hook name cannot begin with `__`."),!1):!!/^[a-zA-Z][a-zA-Z0-9_.-]*$/.test(e)||(console.error("The hook name can only contain numbers, letters, dashes, periods and underscores."),!1)};var h=function(e,t){return function(n,a,r,i=10){const l=e[t];if(!b(n))return;if(!g(a))return;if("function"!=typeof r)return void console.error("The hook callback must be a function.");if("number"!=typeof i)return void console.error("If specified, the hook priority must be a number.");const o={callback:r,priority:i,namespace:a};if(l[n]){const e=l[n].handlers;let t;for(t=e.length;t>0&&!(i>=e[t-1].priority);t--);t===e.length?e[t]=o:e.splice(t,0,o),l.__current.forEach(e=>{e.name===n&&e.currentIndex>=t&&e.currentIndex++})}else l[n]={handlers:[o],runs:0};"hookAdded"!==n&&e.doAction("hookAdded",n,a,r,i)}};var E=function(e,t,n=!1){return function(a,r){const i=e[t];if(!b(a))return;if(!n&&!g(r))return;if(!i[a])return 0;let l=0;if(n)l=i[a].handlers.length,i[a]={runs:i[a].runs,handlers:[]};else{const e=i[a].handlers;for(let t=e.length-1;t>=0;t--)e[t].namespace===r&&(e.splice(t,1),l++,i.__current.forEach(e=>{e.name===a&&e.currentIndex>=t&&e.currentIndex--}))}return"hookRemoved"!==a&&e.doAction("hookRemoved",a,r),l}};var x=function(e,t){return function(n,a){const r=e[t];return void 0!==a?n in r&&r[n].handlers.some(e=>e.namespace===a):n in r}};var k=function(e,t,n,a){return function(r,...i){const l=e[t];l[r]||(l[r]={handlers:[],runs:0}),l[r].runs++;const o=l[r].handlers;if(!o||!o.length)return n?i[0]:void 0;const c={name:r,currentIndex:0};return(a?async function(){try{l.__current.add(c);let e=n?i[0]:void 0;for(;c.currentIndex<o.length;){const t=o[c.currentIndex];e=await t.callback.apply(null,i),n&&(i[0]=e),c.currentIndex++}return n?e:void 0}finally{l.__current.delete(c)}}:function(){try{l.__current.add(c);let e=n?i[0]:void 0;for(;c.currentIndex<o.length;){e=o[c.currentIndex].callback.apply(null,i),n&&(i[0]=e),c.currentIndex++}return n?e:void 0}finally{l.__current.delete(c)}})()}};var w=function(e,t){return function(){const n=e[t],a=Array.from(n.__current);return a.at(-1)?.name??null}};var _=function(e,t){return function(n){const a=e[t];return void 0===n?a.__current.size>0:Array.from(a.__current).some(e=>e.name===n)}};var N=function(e,t){return function(n){const a=e[t];if(b(n))return a[n]&&a[n].runs?a[n].runs:0}},S=class{actions;filters;addAction;addFilter;removeAction;removeFilter;hasAction;hasFilter;removeAllActions;removeAllFilters;doAction;doActionAsync;applyFilters;applyFiltersAsync;currentAction;currentFilter;doingAction;doingFilter;didAction;didFilter;constructor(){this.actions=Object.create(null),this.actions.__current=new Set,this.filters=Object.create(null),this.filters.__current=new Set,this.addAction=h(this,"actions"),this.addFilter=h(this,"filters"),this.removeAction=E(this,"actions"),this.removeFilter=E(this,"filters"),this.hasAction=x(this,"actions"),this.hasFilter=x(this,"filters"),this.removeAllActions=E(this,"actions",!0),this.removeAllFilters=E(this,"filters",!0),this.doAction=k(this,"actions",!1,!1),this.doActionAsync=k(this,"actions",!1,!0),this.applyFilters=k(this,"filters",!0,!1),this.applyFiltersAsync=k(this,"filters",!0,!0),this.currentAction=w(this,"actions"),this.currentFilter=w(this,"filters"),this.doingAction=_(this,"actions"),this.doingFilter=_(this,"filters"),this.didAction=N(this,"actions"),this.didFilter=N(this,"filters")}};var C=function(){return new S}(),{addAction:P,addFilter:O,removeAction:j,removeFilter:T,hasAction:A,hasFilter:D,removeAllActions:F,removeAllFilters:L,doAction:z,doActionAsync:R,applyFilters:I,applyFiltersAsync:M,currentAction:B,currentFilter:U,doingAction:W,doingFilter:V,didAction:$,didFilter:G,actions:H,filters:Q}=C,Y=((e,t,n)=>{const a=new p({}),r=new Set,i=()=>{r.forEach(e=>e())},l=(e,t="default")=>{a.data[t]={...a.data[t],...e},a.data[t][""]={...v,...a.data[t]?.[""]},delete a.pluralForms[t]},o=(e,t)=>{l(e,t),i()},c=(e="default",t,n,r,i)=>(a.data[e]||l(void 0,e),a.dcnpgettext(e,t,n,r,i)),u=e=>e||"default",s=(e,t,a)=>{let r=c(a,t,e);return n?(r=n.applyFilters("i18n.gettext_with_context",r,e,t,a),n.applyFilters("i18n.gettext_with_context_"+u(a),r,e,t,a)):r};if(e&&o(e,t),n){const e=e=>{y.test(e)&&i()};n.addAction("hookAdded","core/i18n",e),n.addAction("hookRemoved","core/i18n",e)}return{getLocaleData:(e="default")=>a.data[e],setLocaleData:o,addLocaleData:(e,t="default")=>{a.data[t]={...a.data[t],...e,"":{...v,...a.data[t]?.[""],...e?.[""]}},delete a.pluralForms[t],i()},resetLocaleData:(e,t)=>{a.data={},a.pluralForms={},o(e,t)},subscribe:e=>(r.add(e),()=>r.delete(e)),__:(e,t)=>{let a=c(t,void 0,e);return n?(a=n.applyFilters("i18n.gettext",a,e,t),n.applyFilters("i18n.gettext_"+u(t),a,e,t)):a},_x:s,_n:(e,t,a,r)=>{let i=c(r,void 0,e,t,a);return n?(i=n.applyFilters("i18n.ngettext",i,e,t,a,r),n.applyFilters("i18n.ngettext_"+u(r),i,e,t,a,r)):i},_nx:(e,t,a,r,i)=>{let l=c(i,r,e,t,a);return n?(l=n.applyFilters("i18n.ngettext_with_context",l,e,t,a,r,i),n.applyFilters("i18n.ngettext_with_context_"+u(i),l,e,t,a,r,i)):l},isRTL:()=>"rtl"===s("ltr","text direction"),hasTranslation:(e,t,r)=>{const i=t?t+""+e:e;let l=!!a.data?.[r??"default"]?.[i];return n&&(l=n.applyFilters("i18n.has_translation",l,e,t,r),l=n.applyFilters("i18n.has_translation_"+u(r),l,e,t,r)),l}}})(void 0,void 0,C),q=(Y.getLocaleData.bind(Y),Y.setLocaleData.bind(Y),Y.resetLocaleData.bind(Y),Y.subscribe.bind(Y),Y.__.bind(Y));Y._x.bind(Y),Y._n.bind(Y),Y._nx.bind(Y),Y.isRTL.bind(Y),Y.hasTranslation.bind(Y);function X(e){return X="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},X(e)}function K(e){return function(e){if(Array.isArray(e))return ee(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Z(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function J(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i,l,o=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(a=i.call(n)).done)&&(o.push(a.value),o.length!==t);c=!0);}catch(e){u=!0,r=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(u)throw r}}return o}}(e,t)||Z(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Z(e,t){if(e){if("string"==typeof e)return ee(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ee(e,t):void 0}}function ee(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}function te(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,n="function"==typeof Symbol?Symbol:{},a=n.iterator||"@@iterator",r=n.toStringTag||"@@toStringTag";function i(n,a,r,i){var c=a&&a.prototype instanceof o?a:o,u=Object.create(c.prototype);return ne(u,"_invoke",function(n,a,r){var i,o,c,u=0,s=r||[],m=!1,f={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return i=t,o=0,c=e,f.n=n,l}};function d(n,a){for(o=n,c=a,t=0;!m&&u&&!r&&t<s.length;t++){var r,i=s[t],d=f.p,p=i[2];n>3?(r=p===a)&&(c=i[(o=i[4])?5:(o=3,3)],i[4]=i[5]=e):i[0]<=d&&((r=n<2&&d<i[1])?(o=0,f.v=a,f.n=i[1]):d<p&&(r=n<3||i[0]>a||a>p)&&(i[4]=n,i[5]=a,f.n=p,o=0))}if(r||n>1)return l;throw m=!0,a}return function(r,s,p){if(u>1)throw TypeError("Generator is already running");for(m&&1===s&&d(s,p),o=s,c=p;(t=o<2?e:c)||!m;){i||(o?o<3?(o>1&&(f.n=-1),d(o,c)):f.n=c:f.v=c);try{if(u=2,i){if(o||(r="next"),t=i[r]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,o<2&&(o=0)}else 1===o&&(t=i.return)&&t.call(i),o<2&&(c=TypeError("The iterator does not provide a '"+r+"' method"),o=1);i=e}else if((t=(m=f.n<0)?c:n.call(a,f))!==l)break}catch(t){i=e,o=1,c=t}finally{u=1}}return{value:t,done:m}}}(n,r,i),!0),u}var l={};function o(){}function c(){}function u(){}t=Object.getPrototypeOf;var s=[][a]?t(t([][a]())):(ne(t={},a,function(){return this}),t),m=u.prototype=o.prototype=Object.create(s);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,ne(e,r,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=u,ne(m,"constructor",u),ne(u,"constructor",c),c.displayName="GeneratorFunction",ne(u,r,"GeneratorFunction"),ne(m),ne(m,r,"Generator"),ne(m,a,function(){return this}),ne(m,"toString",function(){return"[object Generator]"}),(te=function(){return{w:i,m:f}})()}function ne(e,t,n,a){var r=Object.defineProperty;try{r({},"",{})}catch(e){r=0}ne=function(e,t,n,a){function i(t,n){ne(e,t,function(e){return this._invoke(t,n,e)})}t?r?r(e,t,{value:n,enumerable:!a,configurable:!a,writable:!a}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},ne(e,t,n,a)}function ae(e,t,n,a,r,i,l){try{var o=e[i](l),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(a,r)}function re(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,a)}return n}function ie(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?re(Object(n),!0).forEach(function(t){le(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):re(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function le(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=X(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!=X(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==X(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var oe=window.manfietExpenseTrackerData||{},ce=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=ie({"Content-Type":"application/json"},t.headers||{});return oe.restNonce&&(n["X-WP-Nonce"]=oe.restNonce),fetch(e,ie(ie({credentials:"same-origin"},t),{},{headers:n})).then(function(){var e,t=(e=te().m(function e(t){var n;return te().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,t.json().catch(function(){return{}});case 1:if(n=e.v,t.ok){e.n=2;break}throw new Error(n.message||"Request failed");case 2:return e.a(2,n)}},e)}),function(){var t=this,n=arguments;return new Promise(function(a,r){var i=e.apply(t,n);function l(e){ae(i,a,r,l,o,"next",e)}function o(e){ae(i,a,r,l,o,"throw",e)}l(void 0)})});return function(e){return t.apply(this,arguments)}}())};const ue=function(e){var t=e.onExpenseAdded,n=e.hideTitle,a=void 0!==n&&n,r=oe.restBase||"/wp-json/manfi-expense-tracker/v1/",i=J((0,o.useState)([]),2),l=i[0],c=i[1],u=J((0,o.useState)([]),2),s=u[0],m=u[1],f=J((0,o.useState)({category:"",new_category:"",amount:"",date:(new Date).toISOString().slice(0,10),recurring_interval:"",tags:[],remark:""}),2),d=f[0],p=f[1],v=J((0,o.useState)(""),2),y=v[0],g=v[1],b=J((0,o.useState)(""),2),h=b[0],E=b[1],x=J((0,o.useState)(!1),2),k=x[0],w=x[1];(0,o.useEffect)(function(){Promise.all([ce("".concat(r,"categories")),ce("".concat(r,"tags")).catch(function(){return[]})]).then(function(e){var t=J(e,2),n=t[0],a=t[1],r=Array.isArray(n)?n:[],i=Array.isArray(a)?a:[];c(r),m(i),r.length&&!d.category&&p(function(e){return ie(ie({},e),{},{category:String(r[0].id)})})}).catch(function(){g(q("Failed to load categories.","manfi-expense-tracker"))})},[]);var _=function(e,t){p(function(n){return ie(ie({},n),{},le({},e,t))})},N=function(e){e.preventDefault();var n="__new__"===d.category?d.new_category.trim():d.category.trim();n?!d.amount||parseFloat(d.amount)<=0?g(q("Amount must be greater than zero.","manfi-expense-tracker")):d.date?(w(!0),g(""),E(""),ce("".concat(r,"expenses"),{method:"POST",body:JSON.stringify({category:"__new__"===d.category?n:void 0,category_id:"__new__"===d.category?void 0:Number(d.category),amount:d.amount,date:d.date,recurring_interval:d.recurring_interval,tags:s.filter(function(e){return d.tags.includes(String(e.id))}).map(function(e){return e.tag_name}),remark:d.remark?d.remark.trim():""})}).then(function(e){l.some(function(e){return e.category_name===n})||c(function(t){return[].concat(K(t),[{id:(null==e?void 0:e.category_id)||"new-".concat(n),category_name:n,display_name:n,path_name:n,parent_id:0,is_global:Boolean(oe.canManageExpenses)}])}),p(function(t){return ie(ie({},t),{},{category:null!=e&&e.category_id?String(e.category_id):t.category,new_category:"",amount:"",recurring_interval:"",tags:[],remark:""})}),E(q("Expense added successfully.","manfi-expense-tracker")),"function"==typeof t&&t(),window.dispatchEvent(new CustomEvent("manfiet-expense-added"))}).catch(function(e){g(e.message||q("Failed to add expense.","manfi-expense-tracker"))}).finally(function(){w(!1)})):g(q("Date is required.","manfi-expense-tracker")):g(q("Category is required.","manfi-expense-tracker"))};return"frontend"===oe.pageView?o.createElement("div",{className:"manfiet-card manfiet-expense-form-card"},o.createElement("form",{onSubmit:N},!a&&o.createElement("h3",{className:"manfiet-section-title"},q("Add New Expense","manfi-expense-tracker")),y&&o.createElement("p",{className:"manfiet-alert manfiet-alert-error"},y),h&&o.createElement("p",{className:"manfiet-alert manfiet-alert-success"},h),o.createElement("div",{className:"manfiet-expense-form-layout"},o.createElement("div",{className:"manfiet-expense-primary-fields"},o.createElement("div",{className:"manfiet-field"},o.createElement("label",{htmlFor:"manfiet-expense-category",className:"manfiet-label"},q("Category","manfi-expense-tracker")),o.createElement("select",{id:"manfiet-expense-category",value:d.category,onChange:function(e){return _("category",e.target.value)},className:"manfiet-input"},o.createElement("option",{value:""},q("Select a category","manfi-expense-tracker")),l.map(function(e){return o.createElement("option",{key:e.id,value:String(e.id)},e.display_name||e.path_name||e.category_name)}),o.createElement("option",{value:"__new__"},q("Add new category","manfi-expense-tracker")))),"__new__"===d.category&&o.createElement("div",{className:"manfiet-field",style:{gridColumn:"span 2"}},o.createElement("label",{htmlFor:"manfiet-expense-new-category",className:"manfiet-label"},q("New Category Name","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-expense-new-category",type:"text",value:d.new_category,onChange:function(e){return _("new_category",e.target.value)},placeholder:q("Enter a new category name","manfi-expense-tracker"),className:"manfiet-input"})),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{htmlFor:"manfiet-expense-amount",className:"manfiet-label"},q("Amount","manfi-expense-tracker")," (",oe.currencySymbol||"$",")"),o.createElement("input",{id:"manfiet-expense-amount",type:"number",min:"0.01",step:"0.01",value:d.amount,onChange:function(e){return _("amount",e.target.value)},placeholder:"0.00",className:"manfiet-input"})),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{htmlFor:"manfiet-expense-date",className:"manfiet-label"},q("Date","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-expense-date",type:"date",value:d.date,onChange:function(e){return _("date",e.target.value)},className:"manfiet-input"})),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{htmlFor:"manfiet-expense-recurring",className:"manfiet-label"},q("Recurring Interval","manfi-expense-tracker")),o.createElement("select",{id:"manfiet-expense-recurring",value:d.recurring_interval,onChange:function(e){return _("recurring_interval",e.target.value)},className:"manfiet-input"},o.createElement("option",{value:""},q("One-time","manfi-expense-tracker")),o.createElement("option",{value:"day"},q("Daily","manfi-expense-tracker")),o.createElement("option",{value:"week"},q("Weekly","manfi-expense-tracker")),o.createElement("option",{value:"month"},q("Monthly","manfi-expense-tracker")),o.createElement("option",{value:"year"},q("Yearly","manfi-expense-tracker")))),o.createElement("div",{className:"manfiet-field",style:{gridColumn:"span 2"}},o.createElement("label",{htmlFor:"manfiet-expense-remark",className:"manfiet-label"},q("Remark","manfi-expense-tracker")),o.createElement("textarea",{id:"manfiet-expense-remark",value:d.remark,onChange:function(e){return _("remark",e.target.value)},placeholder:q("Optional notes...","manfi-expense-tracker"),className:"manfiet-input",rows:2}))),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label"},q("Select Tags","manfi-expense-tracker")),o.createElement("div",{className:"manfiet-tag-chips-wrapper"},0===s.length?o.createElement("p",{style:{fontSize:"13px",color:"#94a3b8",margin:0,fontStyle:"italic"}},q("No tags created yet.","manfi-expense-tracker")):o.createElement("div",{className:"manfiet-tag-chips"},s.map(function(e){var t=d.tags.includes(String(e.id));return o.createElement("button",{key:e.id,type:"button",onClick:function(){var n=t?d.tags.filter(function(t){return t!==String(e.id)}):[].concat(K(d.tags),[String(e.id)]);_("tags",n)},className:"manfiet-tag-chip ".concat(t?"manfiet-tag-chip-selected":"")},e.tag_name,t&&o.createElement("span",{className:"manfiet-tag-chip-check"},"✓"))}))))),o.createElement("div",{className:"manfiet-form-actions"},o.createElement("button",{type:"submit",disabled:k,className:"manfiet-btn-save-expense"},q(k?"Saving...":"Save Expense","manfi-expense-tracker"))))):o.createElement("form",{onSubmit:N,className:"manfiet-form-stack"},!a&&o.createElement("h3",{className:"manfiet-section-title"},q("Add Expense","manfi-expense-tracker")),y&&o.createElement("p",{className:"manfiet-alert manfiet-alert-error"},y),h&&o.createElement("p",{className:"manfiet-alert manfiet-alert-success"},h),o.createElement("div",{className:"manfiet-form-grid"},o.createElement("div",{className:"manfiet-field"},o.createElement("label",{htmlFor:"manfiet-expense-category",className:"manfiet-label"},q("Category","manfi-expense-tracker")),o.createElement("select",{id:"manfiet-expense-category",value:d.category,onChange:function(e){return _("category",e.target.value)},className:"manfiet-input"},o.createElement("option",{value:""},q("Select a category","manfi-expense-tracker")),l.map(function(e){return o.createElement("option",{key:e.id,value:String(e.id)},e.display_name||e.path_name||e.category_name)}),o.createElement("option",{value:"__new__"},q("Add new category","manfi-expense-tracker")))),"__new__"===d.category&&o.createElement("div",{className:"manfiet-field"},o.createElement("label",{htmlFor:"manfiet-expense-new-category",className:"manfiet-label"},q("New Category Name","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-expense-new-category",type:"text",value:d.new_category,onChange:function(e){return _("new_category",e.target.value)},placeholder:q("Enter a new category name","manfi-expense-tracker"),className:"manfiet-input"})),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{htmlFor:"manfiet-expense-amount",className:"manfiet-label"},q("Amount","manfi-expense-tracker")," (",oe.currencySymbol||"$",")"),o.createElement("input",{id:"manfiet-expense-amount",type:"number",min:"0.01",step:"0.01",value:d.amount,onChange:function(e){return _("amount",e.target.value)},placeholder:"0.00",className:"manfiet-input"})),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{htmlFor:"manfiet-expense-date",className:"manfiet-label"},q("Date","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-expense-date",type:"date",value:d.date,onChange:function(e){return _("date",e.target.value)},className:"manfiet-input"})),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{htmlFor:"manfiet-expense-recurring",className:"manfiet-label"},q("Recurring Interval","manfi-expense-tracker")),o.createElement("select",{id:"manfiet-expense-recurring",value:d.recurring_interval,onChange:function(e){return _("recurring_interval",e.target.value)},className:"manfiet-input"},o.createElement("option",{value:""},q("One-time","manfi-expense-tracker")),o.createElement("option",{value:"day"},q("Daily","manfi-expense-tracker")),o.createElement("option",{value:"week"},q("Weekly","manfi-expense-tracker")),o.createElement("option",{value:"month"},q("Monthly","manfi-expense-tracker")),o.createElement("option",{value:"year"},q("Yearly","manfi-expense-tracker")))),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{htmlFor:"manfiet-expense-tags",className:"manfiet-label"},q("Tags","manfi-expense-tracker")),o.createElement("select",{id:"manfiet-expense-tags",multiple:!0,value:d.tags,onChange:function(e){var t=Array.from(e.target.selectedOptions).map(function(e){return e.value});_("tags",t)},className:"manfiet-input manfiet-input-multi"},s.map(function(e){return o.createElement("option",{key:e.id,value:String(e.id)},e.tag_name)}))),o.createElement("div",{className:"manfiet-field",style:{gridColumn:"span 2"}},o.createElement("label",{htmlFor:"manfiet-expense-remark",className:"manfiet-label"},q("Remark","manfi-expense-tracker")),o.createElement("textarea",{id:"manfiet-expense-remark",value:d.remark,onChange:function(e){return _("remark",e.target.value)},placeholder:q("Optional notes...","manfi-expense-tracker"),className:"manfiet-input",rows:3}))),o.createElement("button",{type:"submit",disabled:k,className:"manfiet-button manfiet-button-primary"},q(k?"Saving...":"Save Expense","manfi-expense-tracker")))};function se(e){return se="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},se(e)}function me(e){return function(e){if(Array.isArray(e))return pe(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||de(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i,l,o=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(a=i.call(n)).done)&&(o.push(a.value),o.length!==t);c=!0);}catch(e){u=!0,r=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(u)throw r}}return o}}(e,t)||de(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function de(e,t){if(e){if("string"==typeof e)return pe(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?pe(e,t):void 0}}function pe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}function ve(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,n="function"==typeof Symbol?Symbol:{},a=n.iterator||"@@iterator",r=n.toStringTag||"@@toStringTag";function i(n,a,r,i){var c=a&&a.prototype instanceof o?a:o,u=Object.create(c.prototype);return ye(u,"_invoke",function(n,a,r){var i,o,c,u=0,s=r||[],m=!1,f={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return i=t,o=0,c=e,f.n=n,l}};function d(n,a){for(o=n,c=a,t=0;!m&&u&&!r&&t<s.length;t++){var r,i=s[t],d=f.p,p=i[2];n>3?(r=p===a)&&(c=i[(o=i[4])?5:(o=3,3)],i[4]=i[5]=e):i[0]<=d&&((r=n<2&&d<i[1])?(o=0,f.v=a,f.n=i[1]):d<p&&(r=n<3||i[0]>a||a>p)&&(i[4]=n,i[5]=a,f.n=p,o=0))}if(r||n>1)return l;throw m=!0,a}return function(r,s,p){if(u>1)throw TypeError("Generator is already running");for(m&&1===s&&d(s,p),o=s,c=p;(t=o<2?e:c)||!m;){i||(o?o<3?(o>1&&(f.n=-1),d(o,c)):f.n=c:f.v=c);try{if(u=2,i){if(o||(r="next"),t=i[r]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,o<2&&(o=0)}else 1===o&&(t=i.return)&&t.call(i),o<2&&(c=TypeError("The iterator does not provide a '"+r+"' method"),o=1);i=e}else if((t=(m=f.n<0)?c:n.call(a,f))!==l)break}catch(t){i=e,o=1,c=t}finally{u=1}}return{value:t,done:m}}}(n,r,i),!0),u}var l={};function o(){}function c(){}function u(){}t=Object.getPrototypeOf;var s=[][a]?t(t([][a]())):(ye(t={},a,function(){return this}),t),m=u.prototype=o.prototype=Object.create(s);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,ye(e,r,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=u,ye(m,"constructor",u),ye(u,"constructor",c),c.displayName="GeneratorFunction",ye(u,r,"GeneratorFunction"),ye(m),ye(m,r,"Generator"),ye(m,a,function(){return this}),ye(m,"toString",function(){return"[object Generator]"}),(ve=function(){return{w:i,m:f}})()}function ye(e,t,n,a){var r=Object.defineProperty;try{r({},"",{})}catch(e){r=0}ye=function(e,t,n,a){function i(t,n){ye(e,t,function(e){return this._invoke(t,n,e)})}t?r?r(e,t,{value:n,enumerable:!a,configurable:!a,writable:!a}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},ye(e,t,n,a)}function ge(e,t,n,a,r,i,l){try{var o=e[i](l),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(a,r)}function be(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,a)}return n}function he(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?be(Object(n),!0).forEach(function(t){Ee(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):be(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ee(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=se(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!=se(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==se(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var xe=window.manfietExpenseTrackerData||{},ke=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=he({"Content-Type":"application/json"},t.headers||{});return xe.restNonce&&(n["X-WP-Nonce"]=xe.restNonce),fetch(e,he(he({credentials:"same-origin"},t),{},{headers:n})).then(function(){var e,t=(e=ve().m(function e(t){var n;return ve().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,t.json().catch(function(){return{}});case 1:if(n=e.v,t.ok){e.n=2;break}throw new Error(n.message||"Request failed");case 2:return e.a(2,n)}},e)}),function(){var t=this,n=arguments;return new Promise(function(a,r){var i=e.apply(t,n);function l(e){ge(i,a,r,l,o,"next",e)}function o(e){ge(i,a,r,l,o,"throw",e)}l(void 0)})});return function(e){return t.apply(this,arguments)}}())};const we=function(e){var t=e.expenses,n=e.onExpenseUpdated,a=xe.restBase||"/wp-json/manfi-expense-tracker/v1/",r=fe((0,o.useState)([]),2),i=r[0],l=r[1],c=fe((0,o.useState)([]),2),u=c[0],m=c[1],f=fe((0,o.useState)(null),2),d=f[0],p=f[1],v=fe((0,o.useState)(!1),2),y=v[0],g=v[1],b=fe((0,o.useState)({category_id:"",amount:"",date:"",recurring_interval:"",tag_ids:[],remark:""}),2),h=b[0],E=b[1],x=fe((0,o.useState)(""),2),k=x[0],w=x[1],_=fe((0,o.useState)({key:"date",direction:"desc"}),2),N=_[0],S=_[1],C=Number(xe.expensesPerPage)||20,P=fe((0,o.useState)(1),2),O=P[0],j=P[1],T=(0,o.useRef)(t.length);(0,o.useEffect)(function(){T.current!==t.length&&(j(1),T.current=t.length)},[t.length]);var A=(0,o.useMemo)(function(){var e=me(t);return null!==N.key&&e.sort(function(e,t){var n=e[N.key],a=t[N.key];return"amount"===N.key?(n=parseFloat(n||0),a=parseFloat(a||0)):"date"===N.key?(n=new Date(n||0).getTime(),a=new Date(a||0).getTime()):(n=String(n||"").toLowerCase(),a=String(a||"").toLowerCase()),n<a?"asc"===N.direction?-1:1:n>a?"asc"===N.direction?1:-1:0}),e},[t,N]),D=Math.ceil(A.length/C),F=(0,o.useMemo)(function(){var e=(O-1)*C;return A.slice(e,e+C)},[A,O,C]),L=function(e){var t="asc";N.key===e&&"asc"===N.direction&&(t="desc"),S({key:e,direction:t})},z=function(e){return N.key!==e?o.createElement("span",{className:"manfiet-sort-indicator"},"↕"):"asc"===N.direction?o.createElement("span",{className:"manfiet-sort-indicator active"},"▲"):o.createElement("span",{className:"manfiet-sort-indicator active"},"▼")};(0,o.useEffect)(function(){ke("".concat(a,"categories")).then(function(e){return l(Array.isArray(e)?e:[])}).catch(function(){return l([])}),ke("".concat(a,"tags")).then(function(e){return m(Array.isArray(e)?e:[])}).catch(function(){return m([])})},[a]);var R=(0,o.useMemo)(function(){var e=new Map;return i.forEach(function(t){e.set(t.path_name||t.category_name,t)}),e},[i]),I=function(){p(null),w("")};return t.length?o.createElement(o.Fragment,null,o.createElement("div",{className:"manfiet-table-scroll"},k&&o.createElement("p",{className:"manfiet-alert manfiet-alert-error"},k),o.createElement("table",{className:"manfiet-table"},o.createElement("thead",null,o.createElement("tr",null,o.createElement("th",{className:"sortable",onClick:function(){return L("category")}},q("Category","manfi-expense-tracker"),z("category")),o.createElement("th",{className:"manfiet-align-right sortable",onClick:function(){return L("amount")}},q("Amount","manfi-expense-tracker"),z("amount")),o.createElement("th",{className:"sortable",onClick:function(){return L("date")}},q("Date","manfi-expense-tracker"),z("date")),o.createElement("th",{className:"sortable",onClick:function(){return L("recurring_interval")}},q("Recurring","manfi-expense-tracker"),z("recurring_interval")),o.createElement("th",null,q("Tags","manfi-expense-tracker")),o.createElement("th",{className:"manfiet-align-center"},q("Actions","manfi-expense-tracker")))),o.createElement("tbody",null,F.map(function(e){var t=d===e.id;return o.createElement("tr",{key:e.id},o.createElement("td",null,t?o.createElement(o.Fragment,null,o.createElement("select",{className:"manfiet-input",value:h.category_id,onChange:function(e){return E(function(t){return he(he({},t),{},{category_id:e.target.value})})}},o.createElement("option",{value:""},q("Select category","manfi-expense-tracker")),i.map(function(e){return o.createElement("option",{key:e.id,value:e.id},e.display_name||e.path_name||e.category_name)})),o.createElement("textarea",{className:"manfiet-input",style:{marginTop:"6px",resize:"vertical",minHeight:"50px",fontFamily:"inherit"},placeholder:q("Remark (optional)","manfi-expense-tracker"),value:h.remark,onChange:function(e){return E(function(t){return he(he({},t),{},{remark:e.target.value})})},rows:2})):o.createElement(o.Fragment,null,o.createElement("div",null,e.category),e.remark&&o.createElement("div",{style:{fontSize:"11px",color:"#64748b",fontStyle:"italic",marginTop:"3px"}},e.remark))),o.createElement("td",{className:"manfiet-align-right manfiet-font-semibold"},t?o.createElement("input",{type:"number",min:"0.01",step:"0.01",className:"manfiet-input",value:h.amount,onChange:function(e){return E(function(t){return he(he({},t),{},{amount:e.target.value})})}}):o.createElement(o.Fragment,null,xe.currencySymbol||"$",Number(e.amount).toFixed(2))),o.createElement("td",null,t?o.createElement("input",{type:"date",className:"manfiet-input",value:h.date,onChange:function(e){return E(function(t){return he(he({},t),{},{date:e.target.value})})}}):e.date),o.createElement("td",null,t?o.createElement("select",{className:"manfiet-input",value:h.recurring_interval,onChange:function(e){return E(function(t){return he(he({},t),{},{recurring_interval:e.target.value})})}},o.createElement("option",{value:""},q("One-time","manfi-expense-tracker")),o.createElement("option",{value:"day"},q("Daily","manfi-expense-tracker")),o.createElement("option",{value:"week"},q("Weekly","manfi-expense-tracker")),o.createElement("option",{value:"month"},q("Monthly","manfi-expense-tracker")),o.createElement("option",{value:"year"},q("Yearly","manfi-expense-tracker"))):e.recurring_interval||q("One-time","manfi-expense-tracker")),o.createElement("td",null,t?o.createElement("select",{multiple:!0,className:"manfiet-input manfiet-input-multi",value:h.tag_ids,onChange:function(e){var t=Array.from(e.target.selectedOptions).map(function(e){return e.value});E(function(e){return he(he({},e),{},{tag_ids:t})})}},u.map(function(e){return o.createElement("option",{key:e.id,value:String(e.id)},e.tag_name)})):o.createElement("div",{className:"manfiet-tag-list"},(Array.isArray(e.tags)?e.tags:[]).length>0?e.tags.map(function(t){return o.createElement("span",{key:"".concat(e.id,"-").concat(t),className:"manfiet-tag-chip"},t)}):o.createElement("span",{className:"manfiet-text-muted"},q("No tags","manfi-expense-tracker")))),o.createElement("td",{className:"manfiet-align-center manfiet-nowrap"},t?o.createElement(o.Fragment,null,o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-primary manfiet-button-sm",onClick:function(){return t=e.id,void(h.category_id?!h.amount||Number(h.amount)<=0?w(q("Amount must be greater than zero.","manfi-expense-tracker")):h.date?(g(!0),w(""),ke("".concat(a,"expenses/").concat(t),{method:"PUT",body:JSON.stringify({category_id:Number(h.category_id),amount:Number(h.amount),date:h.date,recurring_interval:h.recurring_interval,tags:u.filter(function(e){return h.tag_ids.includes(String(e.id))}).map(function(e){return e.tag_name}),remark:h.remark?h.remark.trim():""})}).then(function(){p(null),"function"==typeof n&&n()}).catch(function(e){w(e.message||q("Failed to update expense.","manfi-expense-tracker"))}).finally(function(){g(!1)})):w(q("Date is required.","manfi-expense-tracker")):w(q("Please select a category.","manfi-expense-tracker")));var t},disabled:y},q(y?"Saving...":"Save","manfi-expense-tracker")),o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-secondary manfiet-button-sm",onClick:I,disabled:y},q("Cancel","manfi-expense-tracker"))):o.createElement(o.Fragment,null,o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-info manfiet-button-sm",onClick:function(){return function(e){var t,n=R.get(e.category),a=(Array.isArray(e.tags)?e.tags:[]).map(function(e){var t=u.find(function(t){return t.tag_name===e});return t?String(t.id):null}).filter(Boolean);p(e.id),E({category_id:n?String(n.id):"",amount:String(null!==(t=e.amount)&&void 0!==t?t:""),date:e.date||"",recurring_interval:e.recurring_interval||"",tag_ids:a,remark:e.remark||""}),w("")}(e)},style:{marginRight:"6px"}},q("Edit","manfi-expense-tracker")),o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-danger manfiet-button-sm",onClick:function(){return t=e.id,void(window.confirm(q("Are you sure you want to delete this expense?","manfi-expense-tracker"))&&(w(""),ke("".concat(a,"expenses/").concat(t),{method:"DELETE"}).then(function(){"function"==typeof n&&n()}).catch(function(e){w(e.message||q("Failed to delete expense.","manfi-expense-tracker"))})));var t}},q("Delete","manfi-expense-tracker")))))})))),D>1&&o.createElement("div",{className:"manfiet-pagination-row"},o.createElement("div",{className:"manfiet-pagination-summary"},s(q("Showing %d–%d of %d expenses","manfi-expense-tracker"),(O-1)*C+1,Math.min(O*C,A.length),A.length)),o.createElement("div",{className:"manfiet-pagination-pages"},o.createElement("button",{type:"button",className:"manfiet-page-btn",onClick:function(){return j(1)},disabled:1===O,title:q("First Page","manfi-expense-tracker")},"«"),o.createElement("button",{type:"button",className:"manfiet-page-btn",onClick:function(){return j(function(e){return Math.max(e-1,1)})},disabled:1===O,title:q("Previous Page","manfi-expense-tracker")},"‹"),Array.from({length:D},function(e,t){return t+1}).filter(function(e){return 1===e||e===D||Math.abs(e-O)<=2}).map(function(e,t,n){var a=t>0&&e-n[t-1]>1;return o.createElement(o.Fragment,{key:e},a&&o.createElement("span",{className:"manfiet-pagination-ellipsis"},"..."),o.createElement("button",{type:"button",className:"manfiet-page-btn ".concat(O===e?"is-active":""),onClick:function(){return j(e)},disabled:O===e},e))}),o.createElement("button",{type:"button",className:"manfiet-page-btn",onClick:function(){return j(function(e){return Math.min(e+1,D)})},disabled:O===D,title:q("Next Page","manfi-expense-tracker")},"›"),o.createElement("button",{type:"button",className:"manfiet-page-btn",onClick:function(){return j(D)},disabled:O===D,title:q("Last Page","manfi-expense-tracker")},"»")))):o.createElement("p",null,q("No expenses found yet.","manfi-expense-tracker"))};function _e(e){return _e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_e(e)}function Ne(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i,l,o=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(a=i.call(n)).done)&&(o.push(a.value),o.length!==t);c=!0);}catch(e){u=!0,r=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(u)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Se(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Se(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Se(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}function Ce(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,n="function"==typeof Symbol?Symbol:{},a=n.iterator||"@@iterator",r=n.toStringTag||"@@toStringTag";function i(n,a,r,i){var c=a&&a.prototype instanceof o?a:o,u=Object.create(c.prototype);return Pe(u,"_invoke",function(n,a,r){var i,o,c,u=0,s=r||[],m=!1,f={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return i=t,o=0,c=e,f.n=n,l}};function d(n,a){for(o=n,c=a,t=0;!m&&u&&!r&&t<s.length;t++){var r,i=s[t],d=f.p,p=i[2];n>3?(r=p===a)&&(c=i[(o=i[4])?5:(o=3,3)],i[4]=i[5]=e):i[0]<=d&&((r=n<2&&d<i[1])?(o=0,f.v=a,f.n=i[1]):d<p&&(r=n<3||i[0]>a||a>p)&&(i[4]=n,i[5]=a,f.n=p,o=0))}if(r||n>1)return l;throw m=!0,a}return function(r,s,p){if(u>1)throw TypeError("Generator is already running");for(m&&1===s&&d(s,p),o=s,c=p;(t=o<2?e:c)||!m;){i||(o?o<3?(o>1&&(f.n=-1),d(o,c)):f.n=c:f.v=c);try{if(u=2,i){if(o||(r="next"),t=i[r]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,o<2&&(o=0)}else 1===o&&(t=i.return)&&t.call(i),o<2&&(c=TypeError("The iterator does not provide a '"+r+"' method"),o=1);i=e}else if((t=(m=f.n<0)?c:n.call(a,f))!==l)break}catch(t){i=e,o=1,c=t}finally{u=1}}return{value:t,done:m}}}(n,r,i),!0),u}var l={};function o(){}function c(){}function u(){}t=Object.getPrototypeOf;var s=[][a]?t(t([][a]())):(Pe(t={},a,function(){return this}),t),m=u.prototype=o.prototype=Object.create(s);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,Pe(e,r,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=u,Pe(m,"constructor",u),Pe(u,"constructor",c),c.displayName="GeneratorFunction",Pe(u,r,"GeneratorFunction"),Pe(m),Pe(m,r,"Generator"),Pe(m,a,function(){return this}),Pe(m,"toString",function(){return"[object Generator]"}),(Ce=function(){return{w:i,m:f}})()}function Pe(e,t,n,a){var r=Object.defineProperty;try{r({},"",{})}catch(e){r=0}Pe=function(e,t,n,a){function i(t,n){Pe(e,t,function(e){return this._invoke(t,n,e)})}t?r?r(e,t,{value:n,enumerable:!a,configurable:!a,writable:!a}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},Pe(e,t,n,a)}function Oe(e,t,n,a,r,i,l){try{var o=e[i](l),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(a,r)}function je(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,a)}return n}function Te(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?je(Object(n),!0).forEach(function(t){Ae(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):je(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ae(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=_e(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!=_e(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==_e(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var De=window.manfietExpenseTrackerData||{},Fe=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Te({"Content-Type":"application/json"},t.headers||{});return De.restNonce&&(n["X-WP-Nonce"]=De.restNonce),fetch(e,Te(Te({credentials:"same-origin"},t),{},{headers:n})).then(function(){var e,t=(e=Ce().m(function e(t){var n;return Ce().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,t.json().catch(function(){return{}});case 1:if(n=e.v,t.ok){e.n=2;break}throw new Error(n.message||"Request failed");case 2:return e.a(2,n)}},e)}),function(){var t=this,n=arguments;return new Promise(function(a,r){var i=e.apply(t,n);function l(e){Oe(i,a,r,l,o,"next",e)}function o(e){Oe(i,a,r,l,o,"throw",e)}l(void 0)})});return function(e){return t.apply(this,arguments)}}())};const Le=function(e){var t=e.onFilter,n=e.activeFilters,a=e.onClear,r=e.compact,i=void 0!==r&&r,l=De.restBase||"/wp-json/manfi-expense-tracker/v1/",c=Ne((0,o.useState)([]),2),u=c[0],s=c[1],m=Ne((0,o.useState)([]),2),f=m[0],d=m[1],p=Ne((0,o.useState)(""),2),v=p[0],y=p[1],g=Ne((0,o.useState)({category:(null==n?void 0:n.category)||"",tagName:(null==n?void 0:n.tagName)||"",startDate:(null==n?void 0:n.startDate)||"",endDate:(null==n?void 0:n.endDate)||"",search:(null==n?void 0:n.search)||""}),2),b=g[0],h=g[1];(0,o.useEffect)(function(){Promise.all([Fe("".concat(l,"categories")),Fe("".concat(l,"tags")).catch(function(){return[]})]).then(function(e){var t=Ne(e,2),n=t[0],a=t[1];s(Array.isArray(n)?n:[]),d(Array.isArray(a)?a:[])}).catch(function(e){return console.error("Failed to load filter metadata:",e)})},[]),(0,o.useEffect)(function(){h(function(e){return Te(Te({},e),{},{category:(null==n?void 0:n.category)||"",tagName:(null==n?void 0:n.tagName)||"",startDate:(null==n?void 0:n.startDate)||"",endDate:(null==n?void 0:n.endDate)||"",search:(null==n?void 0:n.search)||""})}),null!=n&&n.startDate||null!=n&&n.endDate||y("")},[n]);var E=function(){for(var e=[],t=new Date,n=0;n<12;n++){var a=t.getFullYear(),r=t.getMonth(),i="".concat(a,"-").concat(String(r+1).padStart(2,"0")),l=t.toLocaleDateString("default",{month:"long",year:"numeric"});e.push({value:i,label:l}),t.setMonth(t.getMonth()-1)}return e},x=function(e){var n=e.target.value;y(n);var a="",r="";if(n){var i=Ne(n.split("-").map(Number),2),l=i[0],o=i[1];a="".concat(l,"-").concat(String(o).padStart(2,"0"),"-01");var c=new Date(l,o,0).getDate();r="".concat(l,"-").concat(String(o).padStart(2,"0"),"-").concat(String(c).padStart(2,"0"))}var u=Te(Te({},b),{},{startDate:a,endDate:r});h(u),t(u)},k=function(){var e={category:"",tagName:"",startDate:"",endDate:"",search:""};h(e),y(""),"function"==typeof a?a():t(e)};return i?o.createElement("div",{className:"manfiet-filters-inline"},o.createElement("input",{type:"text",value:b.search,onChange:function(e){var n=Te(Te({},b),{},{search:e.target.value});h(n),t(n)},placeholder:q("Search expenses...","manfi-expense-tracker"),className:"manfiet-input manfiet-input-sm",style:{width:"160px"}}),o.createElement("select",{value:b.category,onChange:function(e){var n=Te(Te({},b),{},{category:e.target.value});h(n),t(n)},className:"manfiet-input manfiet-input-sm",style:{width:"150px"}},o.createElement("option",{value:""},q("All Categories","manfi-expense-tracker")),u.map(function(e){return o.createElement("option",{key:e.id,value:e.path_name||e.category_name},e.display_name||e.path_name||e.category_name)})),o.createElement("select",{value:b.tagName,onChange:function(e){var n=Te(Te({},b),{},{tagName:e.target.value});h(n),t(n)},className:"manfiet-input manfiet-input-sm",style:{width:"130px"}},o.createElement("option",{value:""},q("All Tags","manfi-expense-tracker")),f.map(function(e){return o.createElement("option",{key:e.id,value:e.tag_name},e.tag_name)})),o.createElement("select",{value:v,onChange:x,className:"manfiet-input manfiet-input-sm",style:{width:"140px"}},o.createElement("option",{value:""},q("Select Month","manfi-expense-tracker")),E().map(function(e){return o.createElement("option",{key:e.value,value:e.value},e.label)})),o.createElement("div",{className:"manfiet-date-inputs-inline",style:{display:"flex",alignItems:"center",gap:"4px"}},o.createElement("input",{type:"date",value:b.startDate,onChange:function(e){var n=Te(Te({},b),{},{startDate:e.target.value});h(n),y(""),t(n)},className:"manfiet-input manfiet-input-sm",style:{width:"125px",padding:"4px 6px"}}),o.createElement("span",{style:{fontSize:"11px",color:"#64748b"}},"-"),o.createElement("input",{type:"date",value:b.endDate,onChange:function(e){var n=Te(Te({},b),{},{endDate:e.target.value});h(n),y(""),t(n)},className:"manfiet-input manfiet-input-sm",style:{width:"125px",padding:"4px 6px"}})),(b.category||b.tagName||b.startDate||b.endDate||b.search)&&o.createElement("button",{type:"button",onClick:k,className:"manfiet-button manfiet-button-secondary manfiet-button-sm",style:{padding:"4px 10px",height:"30px",minHeight:"auto"}},q("Clear","manfi-expense-tracker"))):o.createElement("div",{className:"manfiet-form-stack"},o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label"},q("Search","manfi-expense-tracker")),o.createElement("input",{type:"text",value:b.search,onChange:function(e){return h(Te(Te({},b),{},{search:e.target.value}))},placeholder:q("Search expenses...","manfi-expense-tracker"),className:"manfiet-input"})),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label"},q("Category","manfi-expense-tracker")),o.createElement("select",{value:b.category,onChange:function(e){return h(Te(Te({},b),{},{category:e.target.value}))},className:"manfiet-input"},o.createElement("option",{value:""},q("All Categories","manfi-expense-tracker")),u.map(function(e){return o.createElement("option",{key:e.id,value:e.path_name||e.category_name},e.display_name||e.path_name||e.category_name)}))),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label"},q("Tag","manfi-expense-tracker")),o.createElement("select",{value:b.tagName,onChange:function(e){return h(Te(Te({},b),{},{tagName:e.target.value}))},className:"manfiet-input"},o.createElement("option",{value:""},q("All Tags","manfi-expense-tracker")),f.map(function(e){return o.createElement("option",{key:e.id,value:e.tag_name},e.tag_name)}))),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label"},q("Filter by Month","manfi-expense-tracker")),o.createElement("select",{value:v,onChange:x,className:"manfiet-input"},o.createElement("option",{value:""},q("Select Month","manfi-expense-tracker")),E().map(function(e){return o.createElement("option",{key:e.value,value:e.value},e.label)}))),o.createElement("div",{className:"manfiet-field-row",style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"10px"}},o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label"},q("Start Date","manfi-expense-tracker")),o.createElement("input",{type:"date",value:b.startDate,onChange:function(e){h(Te(Te({},b),{},{startDate:e.target.value})),y("")},className:"manfiet-input"})),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label"},q("End Date","manfi-expense-tracker")),o.createElement("input",{type:"date",value:b.endDate,onChange:function(e){h(Te(Te({},b),{},{endDate:e.target.value})),y("")},className:"manfiet-input"}))),o.createElement("div",{className:"manfiet-form-actions",style:{display:"flex",gap:"8px",marginTop:"10px"}},o.createElement("button",{type:"button",onClick:function(){t(b)},className:"manfiet-button manfiet-button-primary",style:{flex:1}},q("Filter","manfi-expense-tracker")),o.createElement("button",{type:"button",onClick:k,className:"manfiet-button manfiet-button-secondary",style:{flex:1}},q("Clear","manfi-expense-tracker"))))};function ze(e){return ze="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ze(e)}function Re(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i,l,o=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(a=i.call(n)).done)&&(o.push(a.value),o.length!==t);c=!0);}catch(e){u=!0,r=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(u)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ie(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ie(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ie(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}function Me(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,a)}return n}function Be(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Me(Object(n),!0).forEach(function(t){Ue(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Me(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ue(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=ze(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!=ze(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==ze(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var We=window.manfietExpenseTrackerData||{};const Ve=function(){var e=Re((0,o.useState)([]),2),t=e[0],n=e[1],a=Re((0,o.useState)(0),2),r=a[0],i=a[1],l=Re((0,o.useState)({category:"",startDate:"",endDate:"",tagName:"",search:""}),2),c=l[0],u=l[1],s=We.restBase||"/wp-json/manfi-expense-tracker/v1/",m=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c,t=new URLSearchParams;e.category&&t.set("category",e.category),e.startDate&&e.endDate&&(t.set("start_date",e.startDate),t.set("end_date",e.endDate)),e.tagName&&t.set("tag_name",e.tagName);var a=t.toString()?"?".concat(t.toString()):"";(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Be({"Content-Type":"application/json"},t.headers||{});return We.restNonce&&(n["X-WP-Nonce"]=We.restNonce),fetch(e,Be(Be({credentials:"same-origin"},t),{},{headers:n})).then(function(e){if(!e.ok)throw new Error("Request failed");return e.json()})})("".concat(s,"expenses").concat(a)).then(function(e){return n(Array.isArray(e)?e:[])}).catch(function(e){console.error(q("Error fetching expenses:","manfi-expense-tracker"),e),n([])})};(0,o.useEffect)(function(){m(c);var e=function(){m(c)};return window.addEventListener("manfiet-expense-added",e),function(){return window.removeEventListener("manfiet-expense-added",e)}},[c.category,c.startDate,c.endDate,c.tagName]);var f=(0,o.useMemo)(function(){if(!c.search)return t;var e=c.search.toLowerCase();return t.filter(function(t){var n=String(t.category||"").toLowerCase().includes(e),a=String(t.amount||"").includes(e),r=String(t.date||"").includes(e),i=String(t.recurring_interval||"").toLowerCase().includes(e),l=(Array.isArray(t.tags)?t.tags:[]).some(function(t){return String(t||"").toLowerCase().includes(e)});return n||a||r||i||l})},[t,c.search]);(0,o.useEffect)(function(){var e=f.reduce(function(e,t){return e+parseFloat(t.amount||0)},0);i(e)},[f]);var d=We.exportUrls||{},p=Boolean(We.canManageExpenses);return o.createElement("div",{className:"manfiet-page-shell manfiet-page-shell-wide manfiet-admin-dashboard-shell"},o.createElement("div",{className:"manfiet-page-hero"},o.createElement("div",{className:"left-section"},o.createElement("h1",{className:"manfiet-page-title"},q("Admin Expense Dashboard","manfi-expense-tracker")),o.createElement("p",{className:"manfiet-page-subtitle"},q("Track and manage all expenses","manfi-expense-tracker")))),o.createElement("div",{className:"manfiet-stats-grid manfiet-mb-16"},o.createElement("div",{className:"manfiet-card manfiet-stat-card"},o.createElement("div",{className:"manfiet-stat-label"},q("Total Expenses","manfi-expense-tracker")),o.createElement("div",{className:"manfiet-stat-value"},f.length)),o.createElement("div",{className:"manfiet-card manfiet-stat-card"},o.createElement("div",{className:"manfiet-stat-label"},q("Total Spent","manfi-expense-tracker")),o.createElement("div",{className:"manfiet-stat-value"},We.currencySymbol||"$",r.toFixed(2))),o.createElement("div",{className:"manfiet-card manfiet-stat-card"},o.createElement("div",{className:"manfiet-stat-label"},q("Average Expense","manfi-expense-tracker")),o.createElement("div",{className:"manfiet-stat-value"},We.currencySymbol||"$",f.length>0?(r/f.length).toFixed(2):"0.00"))),p&&o.createElement("div",{className:"manfiet-card manfiet-mb-16"},o.createElement("h3",{className:"manfiet-card-title"},q("Export Full Report","manfi-expense-tracker")),o.createElement("div",{className:"manfiet-form-row"},o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-primary",onClick:function(){window.location.href=d.csv}},q("Export Full Report (CSV)","manfi-expense-tracker")),o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-info",onClick:function(){window.location.href=d.excel}},q("Export Full Report (Excel)","manfi-expense-tracker")),o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-danger",onClick:function(){window.location.href=d.pdf}},q("Export Full Report (PDF)","manfi-expense-tracker")))),o.createElement("div",{className:"manfiet-card"},o.createElement("div",{className:"manfiet-card-header-with-filters"},o.createElement("div",{style:{display:"flex",alignItems:"center",gap:"12px",flexShrink:0}},o.createElement("h3",{className:"manfiet-card-title",style:{margin:0}},q("All Expenses","manfi-expense-tracker")),o.createElement("a",{href:We.addExpenseUrl||"#",className:"manfiet-btn manfiet-btn-primary",style:{textDecoration:"none",whiteSpace:"nowrap",fontSize:"13px",padding:"6px 14px"}},"+ ",q("Add Expense","manfi-expense-tracker"))),o.createElement("div",{className:"manfiet-header-filters"},o.createElement(Le,{activeFilters:c,onFilter:function(e){return u(e)},onClear:function(){return u({category:"",startDate:"",endDate:"",tagName:"",search:""})},compact:!0}))),o.createElement(we,{expenses:f,onExpenseUpdated:function(){return m(c)}})))};function $e(e){return $e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$e(e)}function Ge(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i,l,o=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(a=i.call(n)).done)&&(o.push(a.value),o.length!==t);c=!0);}catch(e){u=!0,r=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(u)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return He(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?He(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function He(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}function Qe(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,n="function"==typeof Symbol?Symbol:{},a=n.iterator||"@@iterator",r=n.toStringTag||"@@toStringTag";function i(n,a,r,i){var c=a&&a.prototype instanceof o?a:o,u=Object.create(c.prototype);return Ye(u,"_invoke",function(n,a,r){var i,o,c,u=0,s=r||[],m=!1,f={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return i=t,o=0,c=e,f.n=n,l}};function d(n,a){for(o=n,c=a,t=0;!m&&u&&!r&&t<s.length;t++){var r,i=s[t],d=f.p,p=i[2];n>3?(r=p===a)&&(c=i[(o=i[4])?5:(o=3,3)],i[4]=i[5]=e):i[0]<=d&&((r=n<2&&d<i[1])?(o=0,f.v=a,f.n=i[1]):d<p&&(r=n<3||i[0]>a||a>p)&&(i[4]=n,i[5]=a,f.n=p,o=0))}if(r||n>1)return l;throw m=!0,a}return function(r,s,p){if(u>1)throw TypeError("Generator is already running");for(m&&1===s&&d(s,p),o=s,c=p;(t=o<2?e:c)||!m;){i||(o?o<3?(o>1&&(f.n=-1),d(o,c)):f.n=c:f.v=c);try{if(u=2,i){if(o||(r="next"),t=i[r]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,o<2&&(o=0)}else 1===o&&(t=i.return)&&t.call(i),o<2&&(c=TypeError("The iterator does not provide a '"+r+"' method"),o=1);i=e}else if((t=(m=f.n<0)?c:n.call(a,f))!==l)break}catch(t){i=e,o=1,c=t}finally{u=1}}return{value:t,done:m}}}(n,r,i),!0),u}var l={};function o(){}function c(){}function u(){}t=Object.getPrototypeOf;var s=[][a]?t(t([][a]())):(Ye(t={},a,function(){return this}),t),m=u.prototype=o.prototype=Object.create(s);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,Ye(e,r,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=u,Ye(m,"constructor",u),Ye(u,"constructor",c),c.displayName="GeneratorFunction",Ye(u,r,"GeneratorFunction"),Ye(m),Ye(m,r,"Generator"),Ye(m,a,function(){return this}),Ye(m,"toString",function(){return"[object Generator]"}),(Qe=function(){return{w:i,m:f}})()}function Ye(e,t,n,a){var r=Object.defineProperty;try{r({},"",{})}catch(e){r=0}Ye=function(e,t,n,a){function i(t,n){Ye(e,t,function(e){return this._invoke(t,n,e)})}t?r?r(e,t,{value:n,enumerable:!a,configurable:!a,writable:!a}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},Ye(e,t,n,a)}function qe(e,t,n,a,r,i,l){try{var o=e[i](l),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(a,r)}function Xe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,a)}return n}function Ke(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Xe(Object(n),!0).forEach(function(t){Je(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xe(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Je(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=$e(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!=$e(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==$e(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ze=window.manfietExpenseTrackerData||{},et=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Ke({"Content-Type":"application/json"},t.headers||{});return Ze.restNonce&&(n["X-WP-Nonce"]=Ze.restNonce),fetch(e,Ke(Ke({credentials:"same-origin"},t),{},{headers:n})).then(function(){var e,t=(e=Qe().m(function e(t){var n;return Qe().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,t.json().catch(function(){return{}});case 1:if(n=e.v,t.ok){e.n=2;break}throw new Error(n.message||"Request failed");case 2:return e.a(2,n)}},e)}),function(){var t=this,n=arguments;return new Promise(function(a,r){var i=e.apply(t,n);function l(e){qe(i,a,r,l,o,"next",e)}function o(e){qe(i,a,r,l,o,"throw",e)}l(void 0)})});return function(e){return t.apply(this,arguments)}}())};const tt=function(e){var t=e.clickableNames,n=void 0!==t&&t,a=e.activeTagName,r=void 0===a?"":a,i=e.onTagClick,l=void 0===i?null:i,c=Ze.restBase||"/wp-json/manfi-expense-tracker/v1/",u=Boolean(Ze.canManageExpenses),s=Ge((0,o.useState)([]),2),m=s[0],f=s[1],d=Ge((0,o.useState)(""),2),p=d[0],v=d[1],y=Ge((0,o.useState)(""),2),g=y[0],b=y[1],h=function(){et("".concat(c,"tags")).then(function(e){return f(Array.isArray(e)?e:[])}).catch(function(e){return b(e.message||q("Failed to load tags.","manfi-expense-tracker"))})};(0,o.useEffect)(function(){h()},[]);return o.createElement("div",{className:"manfiet-card"},o.createElement("h3",{className:"manfiet-card-title"},q("Expense Tags","manfi-expense-tracker")),g&&o.createElement("p",{className:"manfiet-alert manfiet-alert-error"},g),o.createElement("div",{className:"manfiet-form-row manfiet-mb-14"},o.createElement("input",{type:"text",className:"manfiet-input manfiet-flex-input",placeholder:q("Enter tag name","manfi-expense-tracker"),value:p,onChange:function(e){return v(e.target.value)}}),o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-primary",onClick:function(){p.trim()?(b(""),et("".concat(c,"tags"),{method:"POST",body:JSON.stringify({tag_name:p.trim(),is_global:u})}).then(function(){v(""),h()}).catch(function(e){return b(e.message||q("Failed to add tag.","manfi-expense-tracker"))})):b(q("Tag name cannot be empty.","manfi-expense-tracker"))}},q("Add Tag","manfi-expense-tracker"))),o.createElement("div",{className:"manfiet-tag-list"},m.length>0?m.map(function(e){var t=r===e.tag_name;return o.createElement("span",{key:e.id,className:"manfiet-tag-chip-row ".concat(t?"is-active":"")},n?o.createElement("button",{type:"button",className:"manfiet-inline-link manfiet-tag-name-link ".concat(t?"is-active":""),onClick:function(){return function(e){n&&"function"==typeof l&&l(e)}(e)}},e.tag_name):o.createElement("span",{className:"manfiet-tag-chip"},e.tag_name),o.createElement("button",{type:"button",className:"manfiet-tag-remove",onClick:function(){return t=e.id,b(""),void et("".concat(c,"tags/").concat(t),{method:"DELETE"}).then(function(){return f(function(e){return e.filter(function(e){return e.id!==t})})}).catch(function(e){return b(e.message||q("Failed to delete tag.","manfi-expense-tracker"))});var t},title:q("Remove tag","manfi-expense-tracker"),"aria-label":q("Remove tag","manfi-expense-tracker")},o.createElement("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o.createElement("path",{d:"M9 3L3 9M3 3L9 9",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"}))))}):o.createElement("span",{className:"manfiet-text-muted"},q("No tags added yet.","manfi-expense-tracker"))))};function nt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i,l,o=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(a=i.call(n)).done)&&(o.push(a.value),o.length!==t);c=!0);}catch(e){u=!0,r=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(u)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return at(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?at(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function at(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}var rt=window.manfietExpenseTrackerData||{};const it=function(){var e=nt((0,o.useState)([]),2),t=e[0],n=e[1],a=rt.restBase||"/wp-json/manfi-expense-tracker/v1/",r=function(){fetch("".concat(a,"expenses"),{credentials:"same-origin",headers:rt.restNonce?{"X-WP-Nonce":rt.restNonce}:{}}).then(function(e){return e.json()}).then(function(e){return n(e)}).catch(function(e){return console.error(q("Error fetching expenses:","manfi-expense-tracker"),e)})};return(0,o.useEffect)(function(){r()},[]),o.createElement("div",{className:"manfiet-page-shell manfiet-page-shell-wide manfiet-user-dashboard-shell"},o.createElement("div",{className:"manfiet-page-hero"},o.createElement("div",{className:"left-section"},o.createElement("h1",{className:"manfiet-page-title"},q("My Expenses","manfi-expense-tracker")),o.createElement("p",{className:"manfiet-page-subtitle"},q("Track and manage your personal expenses","manfi-expense-tracker")))),o.createElement(tt,null),o.createElement(ue,{onExpenseAdded:r}),o.createElement(we,{expenses:t,onExpenseUpdated:r}))};function lt(e){return lt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},lt(e)}function ot(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i,l,o=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(a=i.call(n)).done)&&(o.push(a.value),o.length!==t);c=!0);}catch(e){u=!0,r=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(u)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ct(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ct(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ct(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}function ut(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,a)}return n}function st(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ut(Object(n),!0).forEach(function(t){mt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ut(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function mt(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=lt(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!=lt(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==lt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ft=window.manfietExpenseTrackerData||{},dt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=st({"Content-Type":"application/json"},t.headers||{});return ft.restNonce&&(n["X-WP-Nonce"]=ft.restNonce),fetch(e,st(st({credentials:"same-origin"},t),{},{headers:n})).then(function(e){if(!e.ok)throw new Error("Request failed");return e.json()})};const pt=function(){var e=ot((0,o.useState)({week:0,month:0,year:0}),2),t=e[0],n=e[1],a=ot((0,o.useState)({week:0,month:0,year:0}),2),r=a[0],i=a[1],l=ot((0,o.useState)({week:0,month:0,year:0}),2),c=l[0],u=l[1],s=ot((0,o.useState)(!0),2),m=s[0],f=s[1],d=ot((0,o.useState)(""),2),p=d[0],v=d[1],y=ot((0,o.useState)(""),2),g=y[0],b=y[1],h=ft.restBase||"/wp-json/manfi-expense-tracker/v1/",E=function(){dt("".concat(h,"budget")).then(function(e){n(e.budgets||{week:0,month:0,year:0}),i(e.spent||{week:0,month:0,year:0}),u(e.usage||{week:0,month:0,year:0}),f(!1)}).catch(function(){b(q("Error fetching budget data.","manfi-expense-tracker")),f(!1)})};(0,o.useEffect)(function(){E();var e=function(){f(!0),E()};return window.addEventListener("manfiet-expense-added",e),function(){window.removeEventListener("manfiet-expense-added",e)}},[]);var x={week:q("Weekly","manfi-expense-tracker"),month:q("Monthly","manfi-expense-tracker"),year:q("Yearly","manfi-expense-tracker")},k=function(e){return e>=100?"#dc2626":e>=70?"#d97706":"#16a34a"};return o.createElement("div",{className:"manfiet-page-shell"},o.createElement("div",{className:"manfiet-page-hero"},o.createElement("div",{className:"left-section"},o.createElement("h2",{className:"manfiet-page-title"},q("Budget Management","manfi-expense-tracker")),o.createElement("p",{className:"manfiet-page-subtitle"},q("Set weekly, monthly, and yearly budgets. Alerts are shown after 70% usage.","manfi-expense-tracker")))),o.createElement("div",{className:"manfiet-card"},p&&o.createElement("p",{className:"manfiet-alert manfiet-alert-success"},p),g&&o.createElement("p",{className:"manfiet-alert manfiet-alert-error"},g),m?o.createElement("p",null,q("Loading...","manfi-expense-tracker")):o.createElement("div",{className:"manfiet-table-scroll"},o.createElement("table",{className:"manfiet-table"},o.createElement("thead",null,o.createElement("tr",null,o.createElement("th",null,q("Period","manfi-expense-tracker")),o.createElement("th",{className:"manfiet-align-right"},q("Budget","manfi-expense-tracker")),o.createElement("th",{className:"manfiet-align-right"},q("Spent","manfi-expense-tracker")),o.createElement("th",{className:"manfiet-align-right"},q("Usage %","manfi-expense-tracker")),o.createElement("th",null,q("Progress","manfi-expense-tracker")))),o.createElement("tbody",null,["week","month","year"].map(function(e){var a,i=Number(c[e]||0),l=Math.min(i,100);return o.createElement("tr",{key:e},o.createElement("td",{className:"manfiet-font-semibold"},x[e]),o.createElement("td",{className:"manfiet-align-right"},o.createElement("input",{type:"number",min:"1",value:t[e]||0,onChange:function(t){return function(e,t){n(function(n){return st(st({},n),{},mt({},e,Number(t)))})}(e,t.target.value)},className:"manfiet-budget-input"})),o.createElement("td",{className:"manfiet-align-right"},(a=r[e],"".concat(ft.currencySymbol||"$").concat(Number(a||0).toFixed(2)))),o.createElement("td",{className:"manfiet-align-right manfiet-font-semibold"},i.toFixed(2),"%"),o.createElement("td",null,o.createElement("div",{className:"manfiet-progress-track"},o.createElement("div",{className:"manfiet-progress-bar",style:{width:"".concat(l,"%"),backgroundColor:k(i)}}))))}))),o.createElement("button",{onClick:function(){v(""),b(""),dt("".concat(h,"budget"),{method:"POST",body:JSON.stringify({budgets:t})}).then(function(){v(q("Budget updated successfully.","manfi-expense-tracker")),E()}).catch(function(e){b(e.message||q("Error updating budget.","manfi-expense-tracker"))})},className:"manfiet-button manfiet-button-primary"},q("Save Budgets","manfi-expense-tracker")))))};function vt(e){return vt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vt(e)}function yt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i,l,o=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(a=i.call(n)).done)&&(o.push(a.value),o.length!==t);c=!0);}catch(e){u=!0,r=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(u)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return gt(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gt(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function gt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}function bt(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,n="function"==typeof Symbol?Symbol:{},a=n.iterator||"@@iterator",r=n.toStringTag||"@@toStringTag";function i(n,a,r,i){var c=a&&a.prototype instanceof o?a:o,u=Object.create(c.prototype);return ht(u,"_invoke",function(n,a,r){var i,o,c,u=0,s=r||[],m=!1,f={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return i=t,o=0,c=e,f.n=n,l}};function d(n,a){for(o=n,c=a,t=0;!m&&u&&!r&&t<s.length;t++){var r,i=s[t],d=f.p,p=i[2];n>3?(r=p===a)&&(c=i[(o=i[4])?5:(o=3,3)],i[4]=i[5]=e):i[0]<=d&&((r=n<2&&d<i[1])?(o=0,f.v=a,f.n=i[1]):d<p&&(r=n<3||i[0]>a||a>p)&&(i[4]=n,i[5]=a,f.n=p,o=0))}if(r||n>1)return l;throw m=!0,a}return function(r,s,p){if(u>1)throw TypeError("Generator is already running");for(m&&1===s&&d(s,p),o=s,c=p;(t=o<2?e:c)||!m;){i||(o?o<3?(o>1&&(f.n=-1),d(o,c)):f.n=c:f.v=c);try{if(u=2,i){if(o||(r="next"),t=i[r]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,o<2&&(o=0)}else 1===o&&(t=i.return)&&t.call(i),o<2&&(c=TypeError("The iterator does not provide a '"+r+"' method"),o=1);i=e}else if((t=(m=f.n<0)?c:n.call(a,f))!==l)break}catch(t){i=e,o=1,c=t}finally{u=1}}return{value:t,done:m}}}(n,r,i),!0),u}var l={};function o(){}function c(){}function u(){}t=Object.getPrototypeOf;var s=[][a]?t(t([][a]())):(ht(t={},a,function(){return this}),t),m=u.prototype=o.prototype=Object.create(s);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,ht(e,r,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=u,ht(m,"constructor",u),ht(u,"constructor",c),c.displayName="GeneratorFunction",ht(u,r,"GeneratorFunction"),ht(m),ht(m,r,"Generator"),ht(m,a,function(){return this}),ht(m,"toString",function(){return"[object Generator]"}),(bt=function(){return{w:i,m:f}})()}function ht(e,t,n,a){var r=Object.defineProperty;try{r({},"",{})}catch(e){r=0}ht=function(e,t,n,a){function i(t,n){ht(e,t,function(e){return this._invoke(t,n,e)})}t?r?r(e,t,{value:n,enumerable:!a,configurable:!a,writable:!a}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},ht(e,t,n,a)}function Et(e,t,n,a,r,i,l){try{var o=e[i](l),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(a,r)}function xt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,a)}return n}function kt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?xt(Object(n),!0).forEach(function(t){wt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function wt(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=vt(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!=vt(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==vt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var _t=window.manfietExpenseTrackerData||{},Nt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=kt({"Content-Type":"application/json"},t.headers||{});return _t.restNonce&&(n["X-WP-Nonce"]=_t.restNonce),fetch(e,kt(kt({credentials:"same-origin"},t),{},{headers:n})).then(function(){var e,t=(e=bt().m(function e(t){var n;return bt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,t.json().catch(function(){return{}});case 1:if(n=e.v,t.ok){e.n=2;break}throw new Error(n.message||"Request failed");case 2:return e.a(2,n)}},e)}),function(){var t=this,n=arguments;return new Promise(function(a,r){var i=e.apply(t,n);function l(e){Et(i,a,r,l,o,"next",e)}function o(e){Et(i,a,r,l,o,"throw",e)}l(void 0)})});return function(e){return t.apply(this,arguments)}}())};const St=function(e){var t=e.title,n=e.filter,a=_t.restBase||"/wp-json/manfi-expense-tracker/v1/",r=yt((0,o.useState)([]),2),i=r[0],l=r[1],c=yt((0,o.useState)({page:1,per_page:50,total:0,total_pages:0}),2),u=c[0],s=c[1],m=yt((0,o.useState)(!1),2),f=m[0],d=m[1],p=yt((0,o.useState)(""),2),v=p[0],y=p[1],g=function(e){if(n&&(n.category_id||n.tag_name)){var t=new URLSearchParams;t.set("page",String(e)),t.set("per_page","50"),n.category_id&&(t.set("category_id",String(n.category_id)),t.set("include_children",n.include_children?"1":"0")),n.tag_name&&t.set("tag_name",n.tag_name),d(!0),y(""),Nt("".concat(a,"expenses/explore?").concat(t.toString())).then(function(t){var n=Array.isArray(t.items)?t.items:[],a=t.pagination||{};l(n),s({page:Number(a.page||e),per_page:Number(a.per_page||50),total:Number(a.total||0),total_pages:Number(a.total_pages||0)})}).catch(function(e){l([]),y(e.message||q("Failed to load expenses.","manfi-expense-tracker"))}).finally(function(){return d(!1)})}};(0,o.useEffect)(function(){l([]),s({page:1,per_page:50,total:0,total_pages:0}),n&&g(1)},[null==n?void 0:n.category_id,null==n?void 0:n.include_children,null==n?void 0:n.tag_name]);var b=u.page>1,h=u.total_pages>u.page,E=(0,o.useMemo)(function(){var e=u.total_pages,t=u.page;if(e<=0)return[1];if(e<=7)return Array.from({length:e},function(e,t){return t+1});var n=[1],a=Math.max(2,t-1),r=Math.min(e-1,t+1);t<=3&&(a=2,r=4),t>=e-2&&(a=e-3,r=e-1),a>2&&n.push("left-ellipsis");for(var i=a;i<=r;i+=1)n.push(i);return r<e-1&&n.push("right-ellipsis"),n.push(e),n},[u.page,u.total_pages]);return o.createElement("div",{className:"manfiet-card manfiet-mt-12"},o.createElement("div",{className:"manfiet-card-head-row manfiet-mb-14"},o.createElement("h3",{className:"manfiet-card-title manfiet-card-title-no-margin"},t),o.createElement("div",{className:"manfiet-pagination-summary"},q(f?"Loading expenses...":"Newest first (LIFO). 50 per page.","manfi-expense-tracker"))),v&&o.createElement("p",{className:"manfiet-alert manfiet-alert-error"},v),0===i.length?o.createElement("p",{className:"manfiet-text-muted"},q(f?"Loading...":"No expenses found for this filter.","manfi-expense-tracker")):o.createElement("div",{className:"manfiet-table-scroll"},o.createElement("table",{className:"manfiet-table"},o.createElement("thead",null,o.createElement("tr",null,o.createElement("th",null,q("Category","manfi-expense-tracker")),o.createElement("th",{className:"manfiet-align-right"},q("Amount","manfi-expense-tracker")),o.createElement("th",null,q("Date","manfi-expense-tracker")),o.createElement("th",null,q("Recurring","manfi-expense-tracker")),o.createElement("th",null,q("Tags","manfi-expense-tracker")))),o.createElement("tbody",null,i.map(function(e){return o.createElement("tr",{key:e.id},o.createElement("td",null,e.category),o.createElement("td",{className:"manfiet-align-right manfiet-font-semibold"},_t.currencySymbol||"$",Number(e.amount||0).toFixed(2)),o.createElement("td",null,e.date),o.createElement("td",null,e.recurring_interval||q("One-time","manfi-expense-tracker")),o.createElement("td",null,o.createElement("div",{className:"manfiet-tag-list"},(Array.isArray(e.tags)?e.tags:[]).length>0?e.tags.map(function(t){return o.createElement("span",{key:"".concat(e.id,"-").concat(t),className:"manfiet-tag-chip"},t)}):o.createElement("span",{className:"manfiet-text-muted"},q("No tags","manfi-expense-tracker")))))})))),o.createElement("div",{className:"manfiet-pagination-row"},o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-secondary manfiet-button-sm",disabled:!b||f,onClick:function(){return g(u.page-1)}},q("Previous","manfi-expense-tracker")),o.createElement("div",{className:"manfiet-pagination-pages",role:"navigation","aria-label":q("Pagination","manfi-expense-tracker")},E.map(function(e){return"number"!=typeof e?o.createElement("span",{key:e,className:"manfiet-pagination-ellipsis","aria-hidden":"true"},"..."):o.createElement("button",{key:"page-".concat(e),type:"button",className:"manfiet-page-btn ".concat(e===u.page?"is-active":""),disabled:f||e===u.page,onClick:function(){return g(e)},"aria-current":e===u.page?"page":void 0},e)})),o.createElement("span",{className:"manfiet-pagination-status"},u.total_pages>0?q("Page","manfi-expense-tracker")+" "+u.page+" "+q("of","manfi-expense-tracker")+" "+u.total_pages+" ("+u.total+" "+q("total","manfi-expense-tracker")+")":q("Page 1 of 1 (0 total)","manfi-expense-tracker")),o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-secondary manfiet-button-sm",disabled:!h||f,onClick:function(){return g(u.page+1)}},q("Next","manfi-expense-tracker"))))};function Ct(e){return Ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ct(e)}function Pt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i,l,o=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(a=i.call(n)).done)&&(o.push(a.value),o.length!==t);c=!0);}catch(e){u=!0,r=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(u)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ot(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ot(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ot(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}function jt(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,n="function"==typeof Symbol?Symbol:{},a=n.iterator||"@@iterator",r=n.toStringTag||"@@toStringTag";function i(n,a,r,i){var c=a&&a.prototype instanceof o?a:o,u=Object.create(c.prototype);return Tt(u,"_invoke",function(n,a,r){var i,o,c,u=0,s=r||[],m=!1,f={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return i=t,o=0,c=e,f.n=n,l}};function d(n,a){for(o=n,c=a,t=0;!m&&u&&!r&&t<s.length;t++){var r,i=s[t],d=f.p,p=i[2];n>3?(r=p===a)&&(c=i[(o=i[4])?5:(o=3,3)],i[4]=i[5]=e):i[0]<=d&&((r=n<2&&d<i[1])?(o=0,f.v=a,f.n=i[1]):d<p&&(r=n<3||i[0]>a||a>p)&&(i[4]=n,i[5]=a,f.n=p,o=0))}if(r||n>1)return l;throw m=!0,a}return function(r,s,p){if(u>1)throw TypeError("Generator is already running");for(m&&1===s&&d(s,p),o=s,c=p;(t=o<2?e:c)||!m;){i||(o?o<3?(o>1&&(f.n=-1),d(o,c)):f.n=c:f.v=c);try{if(u=2,i){if(o||(r="next"),t=i[r]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,o<2&&(o=0)}else 1===o&&(t=i.return)&&t.call(i),o<2&&(c=TypeError("The iterator does not provide a '"+r+"' method"),o=1);i=e}else if((t=(m=f.n<0)?c:n.call(a,f))!==l)break}catch(t){i=e,o=1,c=t}finally{u=1}}return{value:t,done:m}}}(n,r,i),!0),u}var l={};function o(){}function c(){}function u(){}t=Object.getPrototypeOf;var s=[][a]?t(t([][a]())):(Tt(t={},a,function(){return this}),t),m=u.prototype=o.prototype=Object.create(s);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,Tt(e,r,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=u,Tt(m,"constructor",u),Tt(u,"constructor",c),c.displayName="GeneratorFunction",Tt(u,r,"GeneratorFunction"),Tt(m),Tt(m,r,"Generator"),Tt(m,a,function(){return this}),Tt(m,"toString",function(){return"[object Generator]"}),(jt=function(){return{w:i,m:f}})()}function Tt(e,t,n,a){var r=Object.defineProperty;try{r({},"",{})}catch(e){r=0}Tt=function(e,t,n,a){function i(t,n){Tt(e,t,function(e){return this._invoke(t,n,e)})}t?r?r(e,t,{value:n,enumerable:!a,configurable:!a,writable:!a}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},Tt(e,t,n,a)}function At(e,t,n,a,r,i,l){try{var o=e[i](l),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(a,r)}function Dt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,a)}return n}function Ft(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Dt(Object(n),!0).forEach(function(t){Lt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Dt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Lt(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Ct(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!=Ct(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Ct(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var zt=window.manfietExpenseTrackerData||{},Rt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Ft({"Content-Type":"application/json"},t.headers||{});return zt.restNonce&&(n["X-WP-Nonce"]=zt.restNonce),fetch(e,Ft(Ft({credentials:"same-origin"},t),{},{headers:n})).then(function(){var e,t=(e=jt().m(function e(t){var n;return jt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,t.json().catch(function(){return{}});case 1:if(n=e.v,t.ok){e.n=2;break}throw new Error(n.message||"Request failed");case 2:return e.a(2,n)}},e)}),function(){var t=this,n=arguments;return new Promise(function(a,r){var i=e.apply(t,n);function l(e){At(i,a,r,l,o,"next",e)}function o(e){At(i,a,r,l,o,"throw",e)}l(void 0)})});return function(e){return t.apply(this,arguments)}}())};const It=function(){var e=Pt((0,o.useState)([]),2),t=e[0],n=e[1],a=Pt((0,o.useState)(""),2),r=a[0],i=a[1],l=Pt((0,o.useState)("0"),2),c=l[0],u=l[1],s=Pt((0,o.useState)(null),2),m=s[0],f=s[1],d=Pt((0,o.useState)(""),2),p=d[0],v=d[1],y=Pt((0,o.useState)("0"),2),g=y[0],b=y[1],h=Pt((0,o.useState)(null),2),E=h[0],x=h[1],k=Pt((0,o.useState)(!1),2),w=k[0],_=k[1],N=Pt((0,o.useState)(null),2),S=N[0],C=N[1],P=Pt((0,o.useState)(""),2),O=P[0],j=P[1],T=Pt((0,o.useState)("global"),2),A=T[0],D=T[1],F=Pt((0,o.useState)(!0),2),L=F[0],z=F[1],R=Pt((0,o.useState)(""),2),I=R[0],M=R[1],B=Pt((0,o.useState)(""),2),U=B[0],W=B[1],V=zt.restBase||"/wp-json/manfi-expense-tracker/v1/",$=Boolean(zt.canManageExpenses),G=function(){Rt("".concat(V,"categories")).then(function(e){n(Array.isArray(e)?e:[])}).catch(function(){return j(q("Error fetching categories.","manfi-expense-tracker"))})};(0,o.useEffect)(function(){G()},[]);var H=(0,o.useMemo)(function(){return t.filter(function(e){return!!$||!e.is_global})},[t,$]),Q=(0,o.useMemo)(function(){var e=new Set(t.map(function(e){return Number(e.id)})),n=new Map;t.forEach(function(t){var a=Number(t.parent_id||0),r=a>0&&e.has(a)?a:0;n.has(r)||n.set(r,[]),n.get(r).push(t)}),n.forEach(function(e){e.sort(function(e,t){return(e.category_name||"").localeCompare(t.category_name||"")})});var a=[],r=function(e,t){(n.get(e)||[]).forEach(function(e){a.push(Ft(Ft({},e),{},{treeDepth:t})),r(Number(e.id),t+1)})};return r(0,0),a},[t]),Y=function(){w||x(null)},X=function(){f(null),v(""),b("0"),z(!0),W("")},K=function(){m&&(p.trim()?Rt("".concat(V,"categories/").concat(m),{method:"PUT",body:JSON.stringify({category_name:p.trim(),parent_id:Number(g),is_global:L,description:U.trim()})}).then(function(){X(),G()}).catch(function(e){return j(e.message||q("Failed to update category.","manfi-expense-tracker"))}):j(q("Category name cannot be empty.","manfi-expense-tracker")))};return o.createElement("div",{className:"manfiet-page-shell"},o.createElement("div",{className:"manfiet-page-hero"},o.createElement("div",{className:"left-section"},o.createElement("h2",{className:"manfiet-page-title"},q("Manage Expense Categories","manfi-expense-tracker")),$&&o.createElement("p",{className:"manfiet-page-subtitle"},q("Categories created here are available in the expense form dropdown for all users.","manfi-expense-tracker")))),o.createElement("div",{className:"manfiet-card manfiet-mb-14"},O&&o.createElement("p",{className:"manfiet-alert manfiet-alert-error"},O),o.createElement("div",{className:"manfiet-form-grid manfiet-form-grid-end"},o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-category-name"},q("Category Name","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-category-name",type:"text",value:r,onChange:function(e){return i(e.target.value)},placeholder:q("Enter category name","manfi-expense-tracker"),className:"manfiet-input"})),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-category-parent"},q("Parent Category","manfi-expense-tracker")),o.createElement("select",{id:"manfiet-category-parent",value:c,onChange:function(e){return u(e.target.value)},className:"manfiet-input"},o.createElement("option",{value:"0"},q("No parent (top level)","manfi-expense-tracker")),H.map(function(e){return o.createElement("option",{key:e.id,value:e.id},e.display_name||e.path_name||e.category_name)}))),$&&o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-category-type"},q("Type","manfi-expense-tracker")),o.createElement("select",{id:"manfiet-category-type",value:A,onChange:function(e){return D(e.target.value)},className:"manfiet-input"},o.createElement("option",{value:"global"},q("Global (Shared)","manfi-expense-tracker")),o.createElement("option",{value:"personal"},q("Personal (Private)","manfi-expense-tracker")))),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-category-description"},q("Description","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-category-description",type:"text",value:I,onChange:function(e){return M(e.target.value)},placeholder:q("Why this category is used...","manfi-expense-tracker"),className:"manfiet-input"})),o.createElement("button",{type:"button",onClick:function(){r.trim()?(j(""),Rt("".concat(V,"categories"),{method:"POST",body:JSON.stringify({category_name:r,parent_id:Number(c),is_global:!!$&&"global"===A,description:I})}).then(function(){i(""),u("0"),D("global"),M(""),j(""),G()}).catch(function(e){return j(e.message||q("Failed to add category.","manfi-expense-tracker"))})):j(q("Category name cannot be empty.","manfi-expense-tracker"))},className:"manfiet-button manfiet-button-primary"},q("Add Category","manfi-expense-tracker")))),0===t.length?o.createElement("div",{className:"manfiet-card"},o.createElement("p",null,q("No categories found. Create your first category below.","manfi-expense-tracker"))):o.createElement("div",{className:"manfiet-card"},o.createElement("table",{className:"manfiet-table manfiet-table-categories"},o.createElement("thead",null,o.createElement("tr",null,o.createElement("th",null,q("Category Name","manfi-expense-tracker")),o.createElement("th",{className:"manfiet-align-center manfiet-col-type"},q("Type","manfi-expense-tracker")),o.createElement("th",{className:"manfiet-align-center manfiet-col-actions"},q("Actions","manfi-expense-tracker")))),o.createElement("tbody",null,Q.map(function(e){return o.createElement("tr",{key:e.id},o.createElement("td",null,m===e.id?o.createElement("div",{className:"manfiet-form-stack"},o.createElement("input",{type:"text",className:"manfiet-input",value:p,onChange:function(e){return v(e.target.value)}}),o.createElement("select",{className:"manfiet-input",value:g,onChange:function(e){return b(e.target.value)}},o.createElement("option",{value:"0"},q("No parent (top level)","manfi-expense-tracker")),function(e){return t.filter(function(t){return t.id!==e.id&&t.is_global===e.is_global})}(e).map(function(e){return o.createElement("option",{key:e.id,value:e.id},e.display_name||e.path_name||e.category_name)})),$&&o.createElement("select",{className:"manfiet-input",value:L?"global":"personal",onChange:function(e){return z("global"===e.target.value)},style:{marginTop:"6px"}},o.createElement("option",{value:"global"},q("Global (Shared)","manfi-expense-tracker")),o.createElement("option",{value:"personal"},q("Personal (Private)","manfi-expense-tracker"))),o.createElement("input",{type:"text",className:"manfiet-input",value:U,onChange:function(e){return W(e.target.value)},placeholder:q("Description","manfi-expense-tracker"),style:{marginTop:"6px"}})):o.createElement("button",{type:"button",className:"manfiet-inline-link manfiet-cat-name-link ".concat(S&&S.id===e.id?"is-active":""),onClick:function(){return function(e){C(e)}(e)}},o.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start"}},o.createElement("span",{className:0===e.treeDepth?"manfiet-cat-parent-name":"manfiet-cat-child-name"},e.treeDepth>0&&o.createElement("span",{className:"manfiet-cat-dashes","aria-hidden":"true"},"— ".repeat(e.treeDepth)),e.category_name),e.description&&o.createElement("span",{className:"manfiet-cat-desc",style:{fontSize:"11px",color:"#64748b",marginTop:"2px",marginLeft:e.treeDepth>0?"".concat(18*e.treeDepth,"px"):"0",fontWeight:"normal",fontStyle:"italic"}},e.description)))),o.createElement("td",{className:"manfiet-align-center"},o.createElement("span",{className:e.is_global?"manfiet-pill manfiet-pill-global":"manfiet-pill manfiet-pill-personal"},e.is_global?q("Global","manfi-expense-tracker"):q("Personal","manfi-expense-tracker"))),o.createElement("td",{className:"manfiet-align-center"},m===e.id?o.createElement(o.Fragment,null,o.createElement("button",{type:"button",onClick:K,className:"manfiet-button manfiet-button-primary manfiet-button-sm"},q("Save","manfi-expense-tracker")),o.createElement("button",{type:"button",onClick:X,className:"manfiet-button manfiet-button-secondary manfiet-button-sm"},q("Cancel","manfi-expense-tracker"))):o.createElement(o.Fragment,null,o.createElement("button",{type:"button",onClick:function(){return function(e){j(""),f(e.id),v(e.category_name||""),b(String(e.parent_id||0)),z(Boolean(e.is_global)),W(e.description||"")}(e)},className:"manfiet-button manfiet-button-info manfiet-button-sm"},q("Edit","manfi-expense-tracker")),o.createElement("button",{type:"button",onClick:function(){return function(e){j(""),x(e)}(e)},className:"manfiet-button manfiet-button-danger manfiet-button-sm"},q("Delete","manfi-expense-tracker")))))})))),S&&o.createElement(St,{title:q("Expenses by Category","manfi-expense-tracker")+": "+(S.display_name||S.path_name||S.category_name),filter:{category_id:S.id,include_children:!0}}),E&&o.createElement("div",{className:"manfiet-modal-backdrop",role:"presentation",onClick:Y},o.createElement("div",{className:"manfiet-modal",role:"dialog","aria-modal":"true","aria-labelledby":"manfiet-delete-category-title",onClick:function(e){return e.stopPropagation()}},o.createElement("h3",{id:"manfiet-delete-category-title",className:"manfiet-modal-title"},q("Delete Category?","manfi-expense-tracker")),o.createElement("p",{className:"manfiet-modal-text"},q("Are you sure you want to delete this category?","manfi-expense-tracker"),o.createElement("strong",null," ",E.display_name||E.path_name||E.category_name)),o.createElement("div",{className:"manfiet-modal-actions"},o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-secondary",onClick:Y,disabled:w},q("Cancel","manfi-expense-tracker")),o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-danger",onClick:function(){return e=E.id,_(!0),void Rt("".concat(V,"categories/").concat(e),{method:"DELETE"}).then(function(){n(t.filter(function(t){return t.id!==e})),x(null)}).catch(function(e){return j(e.message||q("Error deleting category.","manfi-expense-tracker"))}).finally(function(){return _(!1)});var e},disabled:w},q(w?"Deleting...":"Yes, Delete","manfi-expense-tracker"))))))};function Mt(e){return Mt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Mt(e)}function Bt(e){return function(e){if(Array.isArray(e))return Vt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Wt(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ut(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i,l,o=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(a=i.call(n)).done)&&(o.push(a.value),o.length!==t);c=!0);}catch(e){u=!0,r=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(u)throw r}}return o}}(e,t)||Wt(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Wt(e,t){if(e){if("string"==typeof e)return Vt(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Vt(e,t):void 0}}function Vt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}function $t(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,n="function"==typeof Symbol?Symbol:{},a=n.iterator||"@@iterator",r=n.toStringTag||"@@toStringTag";function i(n,a,r,i){var c=a&&a.prototype instanceof o?a:o,u=Object.create(c.prototype);return Gt(u,"_invoke",function(n,a,r){var i,o,c,u=0,s=r||[],m=!1,f={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return i=t,o=0,c=e,f.n=n,l}};function d(n,a){for(o=n,c=a,t=0;!m&&u&&!r&&t<s.length;t++){var r,i=s[t],d=f.p,p=i[2];n>3?(r=p===a)&&(c=i[(o=i[4])?5:(o=3,3)],i[4]=i[5]=e):i[0]<=d&&((r=n<2&&d<i[1])?(o=0,f.v=a,f.n=i[1]):d<p&&(r=n<3||i[0]>a||a>p)&&(i[4]=n,i[5]=a,f.n=p,o=0))}if(r||n>1)return l;throw m=!0,a}return function(r,s,p){if(u>1)throw TypeError("Generator is already running");for(m&&1===s&&d(s,p),o=s,c=p;(t=o<2?e:c)||!m;){i||(o?o<3?(o>1&&(f.n=-1),d(o,c)):f.n=c:f.v=c);try{if(u=2,i){if(o||(r="next"),t=i[r]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,o<2&&(o=0)}else 1===o&&(t=i.return)&&t.call(i),o<2&&(c=TypeError("The iterator does not provide a '"+r+"' method"),o=1);i=e}else if((t=(m=f.n<0)?c:n.call(a,f))!==l)break}catch(t){i=e,o=1,c=t}finally{u=1}}return{value:t,done:m}}}(n,r,i),!0),u}var l={};function o(){}function c(){}function u(){}t=Object.getPrototypeOf;var s=[][a]?t(t([][a]())):(Gt(t={},a,function(){return this}),t),m=u.prototype=o.prototype=Object.create(s);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,Gt(e,r,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=u,Gt(m,"constructor",u),Gt(u,"constructor",c),c.displayName="GeneratorFunction",Gt(u,r,"GeneratorFunction"),Gt(m),Gt(m,r,"Generator"),Gt(m,a,function(){return this}),Gt(m,"toString",function(){return"[object Generator]"}),($t=function(){return{w:i,m:f}})()}function Gt(e,t,n,a){var r=Object.defineProperty;try{r({},"",{})}catch(e){r=0}Gt=function(e,t,n,a){function i(t,n){Gt(e,t,function(e){return this._invoke(t,n,e)})}t?r?r(e,t,{value:n,enumerable:!a,configurable:!a,writable:!a}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},Gt(e,t,n,a)}function Ht(e,t,n,a,r,i,l){try{var o=e[i](l),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(a,r)}function Qt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,a)}return n}function Yt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Qt(Object(n),!0).forEach(function(t){qt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function qt(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Mt(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!=Mt(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Mt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Xt=window.manfietExpenseTrackerData||{},Kt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Yt({"Content-Type":"application/json"},t.headers||{});return Xt.restNonce&&(n["X-WP-Nonce"]=Xt.restNonce),fetch(e,Yt(Yt({credentials:"same-origin"},t),{},{headers:n})).then(function(){var e,t=(e=$t().m(function e(t){var n;return $t().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,t.json().catch(function(){return{}});case 1:if(n=e.v,t.ok){e.n=2;break}throw new Error(n.message||"Request failed");case 2:return e.a(2,n)}},e)}),function(){var t=this,n=arguments;return new Promise(function(a,r){var i=e.apply(t,n);function l(e){Ht(i,a,r,l,o,"next",e)}function o(e){Ht(i,a,r,l,o,"throw",e)}l(void 0)})});return function(e){return t.apply(this,arguments)}}())},Jt=function(e){var t=Number(e);return Number.isFinite(t)?t:0},Zt=function(e){return"".concat(Xt.currencySymbol||"$").concat(Jt(e).toFixed(2))},en=function(e){return e.toISOString().slice(0,10)},tn=function(e,t){var n=new Map;return e.forEach(function(e){var a=Jt(e.amount),r=function(e){if(!e)return null;var t=new Date("".concat(e,"T00:00:00"));return Number.isNaN(t.getTime())?null:t}(e.date);if(r){var i="";i="daily"===t?en(r):"weekly"===t?en(function(e){var t=new Date(e.getTime()),n=t.getDay(),a=0===n?-6:1-n;return t.setDate(t.getDate()+a),t}(r)):"monthly"===t?"".concat(r.getFullYear(),"-").concat(String(r.getMonth()+1).padStart(2,"0")):String(r.getFullYear()),n.set(i,(n.get(i)||0)+a)}}),Array.from(n.entries()).sort(function(e,t){return String(e[0]).localeCompare(String(t[0]))}).map(function(e){var t=Ut(e,2);return{label:t[0],value:t[1]}})},nn=function(e){var t=e.data,n=t.reduce(function(e,t){return e+t.value},0);if(n<=0)return o.createElement("p",null,q("No data available.","manfi-expense-tracker"));var a=110,r=88,i=["#1d4ed8","#0ea5e9","#10b981","#f59e0b","#ef4444","#8b5cf6","#14b8a6"],l=0,c=t.map(function(e,t){var o=e.value/n,c=l*Math.PI*2-Math.PI/2,u=(l+=o)*Math.PI*2-Math.PI/2,s=a+r*Math.cos(c),m=a+r*Math.sin(c),f=a+r*Math.cos(u),d=a+r*Math.sin(u),p=o>.5?1:0,v=["M ".concat(a," ").concat(a),"L ".concat(s," ").concat(m),"A ".concat(r," ").concat(r," 0 ").concat(p," 1 ").concat(f," ").concat(d),"Z"].join(" ");return{key:e.label,path:v,color:i[t%i.length],label:e.label,amount:e.value,percent:(100*(o||0)).toFixed(1)}});return o.createElement("div",{className:"manfiet-chart-pie-wrap"},o.createElement("svg",{width:"220",height:"220",viewBox:"0 0 220 220",role:"img","aria-label":q("Category share pie chart","manfi-expense-tracker")},c.map(function(e){return o.createElement("path",{key:e.key,d:e.path,fill:e.color,stroke:"#ffffff",strokeWidth:"1"})})),o.createElement("div",null,c.map(function(e){return o.createElement("div",{key:e.key,className:"manfiet-chart-legend-item"},o.createElement("span",{className:"manfiet-chart-legend-dot",style:{backgroundColor:e.color}}),o.createElement("span",{className:"manfiet-chart-legend-label"},e.label,": ",Zt(e.amount)," (",e.percent,"%)"))})))},an=function(e){var t=e.data,n=Math.max.apply(Math,Bt(t.map(function(e){return e.value})).concat([0]));return n<=0?o.createElement("p",null,q("No data available.","manfi-expense-tracker")):o.createElement("div",{className:"manfiet-chart-bars-wrap"},t.map(function(e,t){var a=Math.max(3,Math.round(e.value/n*100));return o.createElement("div",{key:e.label,className:"manfiet-bar-item"},o.createElement("div",{className:"manfiet-bar-header"},o.createElement("span",null,e.label),o.createElement("span",null,Zt(e.value))),o.createElement("div",{className:"manfiet-progress-track manfiet-progress-track-sm"},o.createElement("div",{className:"manfiet-progress-bar",style:{width:"".concat(a,"%"),backgroundColor:t%2==0?"#2563eb":"#0ea5e9"}})))}))},rn=function(e){var t=e.data;if(!t.length)return o.createElement("p",null,q("No data available for this period.","manfi-expense-tracker"));var n=260,a=35,r=Math.max(640,30*t.length),i=Math.max.apply(Math,Bt(t.map(function(e){return e.value})).concat([1])),l=t.length>1?(r-70)/(t.length-1):0,c=t.map(function(e,t){var n=a+t*l,r=200-e.value/i*180;return Yt(Yt({},e),{},{x:n,y:r})}),u=c.map(function(e,t){return"".concat(0===t?"M":"L"," ").concat(e.x," ").concat(e.y)}).join(" "),s=l>0?Math.ceil(45/l):1;return o.createElement("div",{className:"manfiet-chart-line-wrap"},o.createElement("svg",{width:r,height:n,role:"img","aria-label":q("Expense trend chart","manfi-expense-tracker")},o.createElement("line",{x1:a,y1:200,x2:r-a,y2:200,stroke:"#cbd5e1",strokeWidth:"1"}),o.createElement("line",{x1:a,y1:20,x2:a,y2:200,stroke:"#cbd5e1",strokeWidth:"1"}),o.createElement("path",{d:u,fill:"none",stroke:"#1d4ed8",strokeWidth:"3",strokeLinejoin:"round",strokeLinecap:"round"}),c.map(function(e,t){var n=t%s===0;return o.createElement("g",{key:e.label},o.createElement("circle",{cx:e.x,cy:e.y,r:"4",fill:"#1d4ed8"}),n&&o.createElement("text",{x:e.x,y:212,textAnchor:"end",fontSize:"10",fill:"#475569",transform:"rotate(-45, ".concat(e.x,", ").concat(212,")")},e.label))})))};const ln=function(){var e=Xt.restBase||"/wp-json/manfi-expense-tracker/v1/",t=Xt.exportUrls||{},n=Ut((0,o.useState)([]),2),a=n[0],r=n[1],i=Ut((0,o.useState)("monthly"),2),l=i[0],c=i[1],u=Ut((0,o.useState)(""),2),s=u[0],m=u[1],f=Ut((0,o.useState)(""),2),d=f[0],p=f[1],v=Ut((0,o.useState)(!0),2),y=v[0],g=v[1],b=Ut((0,o.useState)(""),2),h=b[0],E=b[1],x=function(){var t,n,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],l=new URLSearchParams,o=null!==(t=a.startDate)&&void 0!==t?t:s,c=null!==(n=a.endDate)&&void 0!==n?n:d;o&&c&&(l.set("start_date",o),l.set("end_date",c)),i&&g(!0);var u=l.toString()?"?".concat(l.toString()):"";return Kt("".concat(e,"expenses").concat(u)).then(function(e){r(Array.isArray(e)?e:[]),E("")}).catch(function(e){E(e.message||q("Failed to load reports.","manfi-expense-tracker"))}).finally(function(){i&&g(!1)})};(0,o.useEffect)(function(){x({},!0)},[e]),(0,o.useEffect)(function(){var e=function(){x({},!1)};return window.addEventListener("manfiet-expense-added",e),function(){return window.removeEventListener("manfiet-expense-added",e)}},[e,s,d]);var k=(0,o.useMemo)(function(){var e=new Map;return a.forEach(function(t){var n=t.category||q("Uncategorized","manfi-expense-tracker");e.set(n,(e.get(n)||0)+Jt(t.amount))}),Array.from(e.entries()).map(function(e){var t=Ut(e,2);return{label:t[0],value:t[1]}}).sort(function(e,t){return t.value-e.value}).slice(0,8)},[a]),w=(0,o.useMemo)(function(){return tn(a,l)},[a,l]),_=a.reduce(function(e,t){return e+Jt(t.amount)},0),N=function(e){if(!e)return"";try{var t=new URL(e,window.location.origin);return s&&d?(t.searchParams.set("start_date",s),t.searchParams.set("end_date",d)):(t.searchParams.delete("start_date"),t.searchParams.delete("end_date")),t.toString()}catch(t){return e}};return o.createElement("div",{className:"manfiet-page-shell manfiet-page-shell-wide"},o.createElement("div",{className:"manfiet-page-hero"},o.createElement("div",{className:"left-section"},o.createElement("h2",{className:"manfiet-page-title"},q("Expense Reports","manfi-expense-tracker")),o.createElement("p",{className:"manfiet-page-subtitle"},q("Visual reports, exports, and trend analysis for spending behavior.","manfi-expense-tracker")))),o.createElement("div",{className:"manfiet-card manfiet-mb-16"},o.createElement("h3",{className:"manfiet-card-title"},q("Report Range","manfi-expense-tracker")),o.createElement("div",{className:"manfiet-form-row manfiet-form-row-end"},o.createElement("label",{className:"manfiet-field manfiet-field-sm"},o.createElement("span",{className:"manfiet-label"},q("Start Date","manfi-expense-tracker")),o.createElement("input",{className:"manfiet-input",type:"date",value:s,onChange:function(e){return m(e.target.value)}})),o.createElement("label",{className:"manfiet-field manfiet-field-sm"},o.createElement("span",{className:"manfiet-label"},q("End Date","manfi-expense-tracker")),o.createElement("input",{className:"manfiet-input",type:"date",value:d,onChange:function(e){return p(e.target.value)}})),o.createElement("button",{type:"button",onClick:function(){s&&!d||!s&&d?E(q("Select both start and end date to filter reports.","manfi-expense-tracker")):s&&d&&s>d?E(q("Start date cannot be later than end date.","manfi-expense-tracker")):x({startDate:s,endDate:d},!0)},className:"manfiet-button manfiet-button-primary"},q("Apply Filter","manfi-expense-tracker")),o.createElement("button",{type:"button",onClick:function(){m(""),p(""),x({startDate:"",endDate:""},!0)},className:"manfiet-button manfiet-button-secondary"},q("Reset","manfi-expense-tracker")))),o.createElement("div",{className:"manfiet-card manfiet-mb-16"},o.createElement("h3",{className:"manfiet-card-title"},q("Export Full Report","manfi-expense-tracker")),o.createElement("div",{className:"manfiet-form-row"},o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-primary",onClick:function(){window.location.href=N(t.csv)}},q("Export Full Report (CSV)","manfi-expense-tracker")),o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-info",onClick:function(){window.location.href=N(t.excel)}},q("Export Full Report (Excel)","manfi-expense-tracker")),o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-danger",onClick:function(){window.location.href=N(t.pdf)}},q("Export Full Report (PDF)","manfi-expense-tracker")))),o.createElement("div",{className:"manfiet-stats-grid manfiet-mb-16"},o.createElement("div",{className:"manfiet-card manfiet-stat-card"},o.createElement("div",{className:"manfiet-stat-label"},q("Total Expenses","manfi-expense-tracker")),o.createElement("div",{className:"manfiet-stat-value"},a.length)),o.createElement("div",{className:"manfiet-card manfiet-stat-card"},o.createElement("div",{className:"manfiet-stat-label"},q("Total Spent","manfi-expense-tracker")),o.createElement("div",{className:"manfiet-stat-value"},Zt(_))),o.createElement("div",{className:"manfiet-card manfiet-stat-card"},o.createElement("div",{className:"manfiet-stat-label"},q("Average Expense","manfi-expense-tracker")),o.createElement("div",{className:"manfiet-stat-value"},Zt(a.length?_/a.length:0)))),h&&o.createElement("p",{className:"manfiet-alert manfiet-alert-error"},h),y?o.createElement("p",null,q("Loading...","manfi-expense-tracker")):null,!y&&!h&&o.createElement(o.Fragment,null,o.createElement("div",{className:"manfiet-reports-grid manfiet-mb-16"},o.createElement("div",{className:"manfiet-card"},o.createElement("h3",{className:"manfiet-card-title"},q("Pie Chart by Category","manfi-expense-tracker")),o.createElement(nn,{data:k})),o.createElement("div",{className:"manfiet-card"},o.createElement("h3",{className:"manfiet-card-title"},q("Bar Chart by Category","manfi-expense-tracker")),o.createElement(an,{data:k}))),o.createElement("div",{className:"manfiet-card"},o.createElement("div",{className:"manfiet-card-head-row"},o.createElement("h3",{className:"manfiet-card-title manfiet-card-title-no-margin"},q("Expense Trend Graph","manfi-expense-tracker")),o.createElement("select",{className:"manfiet-input",value:l,onChange:function(e){return c(e.target.value)}},o.createElement("option",{value:"daily"},q("Daily","manfi-expense-tracker")),o.createElement("option",{value:"weekly"},q("Weekly","manfi-expense-tracker")),o.createElement("option",{value:"monthly"},q("Monthly","manfi-expense-tracker")),o.createElement("option",{value:"yearly"},q("Yearly","manfi-expense-tracker")))),o.createElement("div",{className:"manfiet-mt-12"},o.createElement(rn,{data:w})))))};function on(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i,l,o=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(a=i.call(n)).done)&&(o.push(a.value),o.length!==t);c=!0);}catch(e){u=!0,r=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(u)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return cn(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?cn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function cn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}const un=function(){var e=on((0,o.useState)(null),2),t=e[0],n=e[1];return o.createElement("div",{className:"manfiet-page-shell"},o.createElement("div",{className:"manfiet-page-hero"},o.createElement("div",{className:"left-section"},o.createElement("h2",{className:"manfiet-page-title"},q("Manage Expense Tags","manfi-expense-tracker")),o.createElement("p",{className:"manfiet-page-subtitle"},q("Click any tag name to see expenses using that tag.","manfi-expense-tracker")))),o.createElement(tt,{clickableNames:!0,activeTagName:(null==t?void 0:t.tag_name)||"",onTagClick:function(e){return n(e)}}),t&&o.createElement(St,{title:q("Expenses by Tag","manfi-expense-tracker")+": "+t.tag_name,filter:{tag_name:t.tag_name}}))};function sn(e){return sn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},sn(e)}function mn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i,l,o=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(a=i.call(n)).done)&&(o.push(a.value),o.length!==t);c=!0);}catch(e){u=!0,r=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(u)throw r}}return o}}(e,t)||dn(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fn(e){return function(e){if(Array.isArray(e))return pn(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||dn(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function dn(e,t){if(e){if("string"==typeof e)return pn(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?pn(e,t):void 0}}function pn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}function vn(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,n="function"==typeof Symbol?Symbol:{},a=n.iterator||"@@iterator",r=n.toStringTag||"@@toStringTag";function i(n,a,r,i){var c=a&&a.prototype instanceof o?a:o,u=Object.create(c.prototype);return yn(u,"_invoke",function(n,a,r){var i,o,c,u=0,s=r||[],m=!1,f={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return i=t,o=0,c=e,f.n=n,l}};function d(n,a){for(o=n,c=a,t=0;!m&&u&&!r&&t<s.length;t++){var r,i=s[t],d=f.p,p=i[2];n>3?(r=p===a)&&(c=i[(o=i[4])?5:(o=3,3)],i[4]=i[5]=e):i[0]<=d&&((r=n<2&&d<i[1])?(o=0,f.v=a,f.n=i[1]):d<p&&(r=n<3||i[0]>a||a>p)&&(i[4]=n,i[5]=a,f.n=p,o=0))}if(r||n>1)return l;throw m=!0,a}return function(r,s,p){if(u>1)throw TypeError("Generator is already running");for(m&&1===s&&d(s,p),o=s,c=p;(t=o<2?e:c)||!m;){i||(o?o<3?(o>1&&(f.n=-1),d(o,c)):f.n=c:f.v=c);try{if(u=2,i){if(o||(r="next"),t=i[r]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,o<2&&(o=0)}else 1===o&&(t=i.return)&&t.call(i),o<2&&(c=TypeError("The iterator does not provide a '"+r+"' method"),o=1);i=e}else if((t=(m=f.n<0)?c:n.call(a,f))!==l)break}catch(t){i=e,o=1,c=t}finally{u=1}}return{value:t,done:m}}}(n,r,i),!0),u}var l={};function o(){}function c(){}function u(){}t=Object.getPrototypeOf;var s=[][a]?t(t([][a]())):(yn(t={},a,function(){return this}),t),m=u.prototype=o.prototype=Object.create(s);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,yn(e,r,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=u,yn(m,"constructor",u),yn(u,"constructor",c),c.displayName="GeneratorFunction",yn(u,r,"GeneratorFunction"),yn(m),yn(m,r,"Generator"),yn(m,a,function(){return this}),yn(m,"toString",function(){return"[object Generator]"}),(vn=function(){return{w:i,m:f}})()}function yn(e,t,n,a){var r=Object.defineProperty;try{r({},"",{})}catch(e){r=0}yn=function(e,t,n,a){function i(t,n){yn(e,t,function(e){return this._invoke(t,n,e)})}t?r?r(e,t,{value:n,enumerable:!a,configurable:!a,writable:!a}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},yn(e,t,n,a)}function gn(e,t,n,a,r,i,l){try{var o=e[i](l),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(a,r)}function bn(e){return function(){var t=this,n=arguments;return new Promise(function(a,r){var i=e.apply(t,n);function l(e){gn(i,a,r,l,o,"next",e)}function o(e){gn(i,a,r,l,o,"throw",e)}l(void 0)})}}function hn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,a)}return n}function En(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?hn(Object(n),!0).forEach(function(t){xn(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function xn(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=sn(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!=sn(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==sn(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var kn=window.manfietExpenseTrackerData||{},wn=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=En({"Content-Type":"application/json"},t.headers||{});return kn.restNonce&&(n["X-WP-Nonce"]=kn.restNonce),fetch(e,En(En({credentials:"same-origin"},t),{},{headers:n})).then(function(){var e=bn(vn().m(function e(t){var n;return vn().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,t.json().catch(function(){return{}});case 1:if(n=e.v,t.ok){e.n=2;break}throw new Error(n.message||"Request failed");case 2:return e.a(2,n)}},e)}));return function(t){return e.apply(this,arguments)}}())},_n=Date.now(),Nn=function(){return String(_n++)},Sn=function(){return{id:Nn(),name:"",daily_budget:"",duration:"",description:""}},Cn=function(){var e;return{id:null,invoice_type:"standard",service_type_label:"",currency:"BDT",vendor_id:"",client_id:"",client_name:"",invoice_no:"",date:(new Date).toISOString().slice(0,10),due_date:"",late_fee_pct:String(null!==(e=kn.invoiceLateFeePct)&&void 0!==e?e:"5"),address:"",phone:"",email:"",email2:"",service_desc:"",notes:"",exchange_rate:"150",discount_type:"percentage",discount_val:"0",discount_pct:"0",vat_pct:"15",adjustment_usd:"",adjustment_bdt:"",adjustment_note:"",status:"pending",previous_invoice_id:"",previous_invoice_no:"",previous_due_amount:"0",payment_received_amount:"0",payments:[],financial_account_ids:[],campaigns:[Sn()],share_token:"",payment_link:""}},Pn={BDT:"৳",USD:"$",GBP:"£",EUR:"€",CAD:"CA$",AUD:"A$",INR:"₹",AED:"AED ",SAR:"SAR ",MYR:"RM ",SGD:"S$"},On=function(e){return"".concat(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"BDT";return Pn[e]||"".concat(e," ")}(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"BDT")).concat(Number(e||0).toFixed(2))},jn=function(e){return"$".concat(Number(e||0).toFixed(2))},Tn=function(e){return"৳".concat(Number(e||0).toFixed(2))},An=function(e){if(!e)return null;var t=new Date("".concat(e,"T00:00:00"));return Number.isNaN(t.getTime())?null:t},Dn=function(e){return An(e.date||e.created_at||"")},Fn=function(e){var t=new Date(e);return t.setHours(0,0,0,0),t},Ln=function(e){return e?e.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}):""},zn=function(e){var t=new Date(e);return t.setHours(23,59,59,999),t},Rn=[{value:"this-week",label:q("This week","manfi-expense-tracker")},{value:"this-month",label:q("This month","manfi-expense-tracker")},{value:"last-month",label:q("Last month","manfi-expense-tracker")},{value:"last-6-months",label:q("Last 6 months","manfi-expense-tracker")},{value:"last-year",label:q("Last year","manfi-expense-tracker")},{value:"custom",label:q("Custom range","manfi-expense-tracker")}],In=function(e,t,n){var a=Fn(new Date),r=null,i=zn(a);switch(e){case"this-week":var l=a.getDay();(r=Fn(new Date(a))).setDate(a.getDate()-l);break;case"this-month":r=Fn(new Date(a.getFullYear(),a.getMonth(),1));break;case"last-month":r=Fn(new Date(a.getFullYear(),a.getMonth()-1,1)),i=zn(new Date(a.getFullYear(),a.getMonth(),0));break;case"last-6-months":r=Fn(new Date(a.getFullYear(),a.getMonth()-5,1));break;case"last-year":r=Fn(new Date(a.getFullYear()-1,a.getMonth(),1));break;case"custom":r=t?Fn(new Date("".concat(t,"T00:00:00"))):null,i=n?zn(new Date("".concat(n,"T00:00:00"))):null;break;default:r=null}return{start:r,end:i}},Mn=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"standard",a=Number(e.daily_budget||0),r="fixed"===n,i=e.duration;return r||""===i||null==i?t=1:(t=Number(i),isNaN(t)&&(t=1)),Number((a*t).toFixed(2))},Bn=function(e,t){var n=String((arguments.length>2&&void 0!==arguments[2]?arguments[2]:"pending")||"pending");if("draft"===n)return n;var a=Number(e||0),r=Number(t||0);return"overdue"===n&&r<=0?n:r<=0?"pending":r>=a?"paid":"partial"},Un=function(e){var t=e.monthly,n=Array.isArray(t)?t:[],a=Math.max.apply(Math,fn(n.map(function(e){return Number(e.value||0)})).concat([0]));return!n.length||a<=0?o.createElement("p",{className:"manfiet-text-muted"},q("No invoice data available yet.","manfi-expense-tracker")):o.createElement("div",{className:"manfiet-chart-bars-wrap manfiet-invoice-chart"},n.map(function(e,t){var n=Number(e.value||0),r=Math.max(4,Math.round(n/a*100));return o.createElement("div",{key:e.label,className:"manfiet-bar-item"},o.createElement("div",{className:"manfiet-bar-header"},o.createElement("span",null,e.label),o.createElement("span",null,Tn(n))),o.createElement("div",{className:"manfiet-progress-track manfiet-progress-track-sm"},o.createElement("div",{className:"manfiet-progress-bar",style:{width:"".concat(r,"%"),backgroundColor:t%2==0?"#2563eb":"#0ea5e9"}})))}))},Wn=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=new URL(window.location.href);return n.searchParams.set("page",e),t?n.searchParams.set("invoice_id",String(t)):n.searchParams.delete("invoice_id"),n.toString()};const Vn=function(e){var t,n,a,r,i,l,c=e.mode,u=void 0===c?"dashboard":c,s=kn.restBase||"/wp-json/manfi-expense-tracker/v1/",m="create"===u,f=mn((0,o.useState)(Cn()),2),d=f[0],p=f[1],v=mn((0,o.useState)([]),2),y=v[0],g=v[1],b=mn((0,o.useState)([]),2),h=b[0],E=b[1],x=mn((0,o.useState)([]),2),k=x[0],w=x[1],_=mn((0,o.useState)([]),2),N=_[0],S=_[1],C=mn((0,o.useState)({summary:{count:0,total:0,average:0},monthly:[],status_counts:{}}),2),P=(C[0],C[1]),O=mn((0,o.useState)(!0),2),j=O[0],T=O[1],A=mn((0,o.useState)(!1),2),D=A[0],F=A[1],L=mn((0,o.useState)(""),2),z=L[0],R=L[1],I=mn((0,o.useState)(""),2),M=I[0],B=I[1],U=mn((0,o.useState)(""),2),W=U[0],V=U[1],$=function(){var e=new Date;return e.setMinutes(e.getMinutes()-e.getTimezoneOffset()),e.toISOString().slice(0,16)},G=mn((0,o.useState)(null),2),H=G[0],Q=G[1],Y=mn((0,o.useState)(""),2),X=Y[0],K=Y[1],J=mn((0,o.useState)($()),2),Z=J[0],ee=J[1],te=mn((0,o.useState)("bKash"),2),ne=te[0],ae=te[1],re=mn((0,o.useState)(""),2),ie=re[0],le=re[1],oe=mn((0,o.useState)(""),2),ce=oe[0],ue=oe[1],se=mn((0,o.useState)(""),2),me=se[0],fe=se[1],de=mn((0,o.useState)(!1),2),pe=de[0],ve=de[1],ye=mn((0,o.useState)(""),2),ge=ye[0],be=ye[1],he=mn((0,o.useState)("this-month"),2),Ee=he[0],xe=he[1],ke=mn((0,o.useState)(""),2),we=ke[0],_e=ke[1],Ne=mn((0,o.useState)(""),2),Se=Ne[0],Ce=Ne[1],Pe=function(e){Q(e),K(""),ee($()),ae("bKash"),le(""),ue(""),fe(""),be(""),B("")},Oe=function(e,t){window.confirm(q("Are you sure you want to delete this payment record?","manfi-expense-tracker"))&&(ve(!0),wn("".concat(s,"invoices/").concat(e,"/payment/").concat(t),{method:"DELETE"}).then(function(t){B(q("Payment record deleted successfully.","manfi-expense-tracker")),H&&String(H.id)===String(e)&&Q(t),Ae()}).catch(function(e){be(e.message||q("Failed to delete payment.","manfi-expense-tracker"))}).finally(function(){return ve(!1)}))},je=(0,o.useMemo)(function(){return function(e){var t,n,a="daily_rate"===e.invoice_type,r=Number(e.exchange_rate||0),i=e.campaigns.reduce(function(t,n){return t+Mn(n,e.invoice_type)},0),l=e.discount_type||"percentage",o=Number(null!==(t=null!==(n=e.discount_val)&&void 0!==n?n:e.discount_pct)&&void 0!==t?t:0),c=Number(e.vat_pct||0),u=Number(e.previous_due_amount||0),s=Number(e.payment_received_amount||0),m=Number(e.adjustment_usd||0),f=Number(e.adjustment_bdt||0),d=a&&r>0?i*r:i,p=0,v=0;"flat"===l?(p=Math.min(d,Math.max(0,o)),v=d>0?Number((p/d*100).toFixed(2)):0):p=d*((v=Math.max(0,o))/100);var y=Math.max(0,d-p),g=y*(c/100),b=y+g+f,h=b+u;return{subtotalUsd:i,subtotalBdt:d,discountType:l,discountVal:o,discountPct:v,discountBdt:p,afterDiscount:y,vatBdt:g,adjustmentUsd:m,adjustmentBdt:f,grandTotal:b,previousDueAmount:u,paymentReceivedAmount:s,amountDue:h,balanceDue:Math.max(0,h-s),overpaidAmount:Math.max(0,s-h)}}(d)},[d]),Te=((0,o.useMemo)(function(){return Bn(je.amountDue,je.paymentReceivedAmount,d.status)},[d.status,je.amountDue,je.paymentReceivedAmount]),(0,o.useMemo)(function(){var e=d.client_id?String(d.client_id):"",t=String(d.client_name||"").trim().toLowerCase(),n=new Set(y.filter(function(e){return!d.id||String(e.id)!==String(d.id)}).map(function(e){return String(e.previous_invoice_id||"")}).filter(function(e){return""!==e&&"0"!==e}));return y.filter(function(a){var r,i,l,o;return(!d.id||String(a.id)!==String(d.id))&&(!((!d.previous_invoice_id||String(a.id)!==String(d.previous_invoice_id))&&n.has(String(a.id)))&&(!(Number(null!==(r=null!==(i=null!==(l=a.balance_due)&&void 0!==l?l:a.amount_due)&&void 0!==i?i:null===(o=a.totals)||void 0===o?void 0:o.grand_total)&&void 0!==r?r:0)<=0)&&(e?String(a.client_id||"")===e:!t||String(a.client_name||"").trim().toLowerCase()===t)))})},[d.client_id,d.client_name,d.id,d.previous_invoice_id,y])),Ae=function(){return T(!0),Promise.all([wn("".concat(s,"invoices")),wn("".concat(s,"invoice-report")),wn("".concat(s,"financial-accounts")),wn("".concat(s,"vendors")),wn("".concat(s,"clients"))]).then(function(e){var t=mn(e,5),n=t[0],a=t[1],r=t[2],i=t[3],l=t[4];g(Array.isArray(n)?n:[]),P(a||{summary:{count:0,total:0,average:0},monthly:[],status_counts:{}}),S(Array.isArray(r)?r:[]),E(Array.isArray(i)?i:[]),w(Array.isArray(l)?l:[]),R("")}).catch(function(e){R(e.message||q("Failed to load invoices.","manfi-expense-tracker"))}).finally(function(){return T(!1)})},De=(0,o.useMemo)(function(){return new URLSearchParams(window.location.search).get("invoice_id")||""},[]);(0,o.useEffect)(function(){if(d.client_id&&k.length){var e=k.find(function(e){return String(e.id)===String(d.client_id)});e&&e.client_name&&p(function(t){return En(En({},t),{},{client_name:e.client_name})})}},[d.client_id,k]),(0,o.useEffect)(function(){if(d.id&&(d.vendor_id||1!==h.length||p(function(e){return En(En({},e),{},{vendor_id:String(h[0].id)})}),!d.client_id&&d.client_name&&k.length)){var e=k.find(function(e){return String(e.client_name||"").trim().toLowerCase()===String(d.client_name||"").trim().toLowerCase()});e?p(function(t){return En(En({},t),{},{client_id:String(e.id)})}):1===k.length&&p(function(e){return En(En({},e),{},{client_id:String(k[0].id)})})}},[d.id,d.vendor_id,d.client_id,d.client_name,h,k]),(0,o.useEffect)(function(){Ae()},[s]);var Fe=function(e,t){p(function(n){return En(En({},n),{},xn({},e,t))})},Le=function(e,t,n){p(function(a){var r=a.campaigns.map(function(a,r){return r===e?En(En({},a),{},xn({},t,n)):a});return En(En({},a),{},{campaigns:r})})},ze=function(){p(Cn()),V(""),B(""),R("")},Re=function(e){var t,n,a,r,i,l,o,c,u,s,m,f=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];p({id:String(e.id),invoice_type:e.invoice_type||"standard",service_type_label:e.service_type_label||"",currency:e.currency||"BDT",vendor_id:e.vendor_id?String(e.vendor_id):"",client_id:e.client_id?String(e.client_id):"",client_name:e.client_name||"",invoice_no:e.invoice_no||"",date:e.date||(new Date).toISOString().slice(0,10),due_date:e.due_date||"",late_fee_pct:String(null!==(t=null!==(n=e.late_fee_pct)&&void 0!==n?n:kn.invoiceLateFeePct)&&void 0!==t?t:"5"),address:e.address||"",phone:e.phone||"",email:e.email||"",email2:e.email2||"",service_desc:e.service_desc||"",notes:e.notes||"",exchange_rate:String(null!==(a=e.exchange_rate)&&void 0!==a?a:"150"),discount_type:e.discount_type||(Number(null!==(r=null!==(i=e.discount_val)&&void 0!==i?i:e.discount_amount)&&void 0!==r?r:0)>0&&0===Number(e.discount_pct||0)?"flat":"percentage"),discount_val:String(null!==(l=null!==(o=e.discount_val)&&void 0!==o?o:"flat"===e.discount_type?e.discount_amount:e.discount_pct)&&void 0!==l?l:"0"),discount_pct:String(null!==(c=e.discount_pct)&&void 0!==c?c:"0"),vat_pct:String(null!==(u=e.vat_pct)&&void 0!==u?u:"15"),adjustment_usd:e.adjustment_usd?String(e.adjustment_usd):"",adjustment_bdt:e.adjustment_bdt?String(e.adjustment_bdt):"",adjustment_note:e.adjustment_note||"",status:e.status||"pending",previous_invoice_id:e.previous_invoice_id?String(e.previous_invoice_id):"",previous_invoice_no:e.previous_invoice_no||"",previous_due_amount:String(null!==(s=e.previous_due_amount)&&void 0!==s?s:"0"),payment_received_amount:String(null!==(m=e.payment_received_amount)&&void 0!==m?m:"0"),payments:Array.isArray(e.payments)?e.payments:[],financial_account_ids:Array.isArray(e.financial_account_ids)?e.financial_account_ids.map(function(e){return String(e)}):[],campaigns:Array.isArray(e.campaigns)&&e.campaigns.length>0?e.campaigns.map(function(e){var t,n;return{id:e.id||Nn(),name:e.name||"",daily_budget:String(null!==(t=e.daily_budget)&&void 0!==t?t:""),duration:String(null!==(n=e.duration)&&void 0!==n?n:""),description:e.description||""}}):[Sn()],share_token:e.share_token||"",payment_link:e.payment_link||""}),V(e.share_url||""),B(q("Editing invoice","manfi-expense-tracker")),R(""),f&&window.scrollTo({top:0,behavior:"smooth"})};(0,o.useEffect)(function(){if(m&&De&&!j&&0!==y.length){var e=y.find(function(e){return String(e.id)===String(De)});e&&String(d.id)!==String(e.id)&&Re(e,!1)}},[d.id,De,y,m,j]);var Ie=function(){var e=bn(vn().m(function e(t){return vn().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t){e.n=1;break}return e.a(2);case 1:return e.p=1,e.n=2,navigator.clipboard.writeText(t);case 2:B(q("Invoice link copied to clipboard.","manfi-expense-tracker")),e.n=4;break;case 3:e.p=3,e.v,B(t);case 4:return e.a(2)}},e,null,[[1,3]])}));return function(t){return e.apply(this,arguments)}}(),Me=(0,o.useMemo)(function(){var e=In(Ee,we,Se),t=e.start,n=e.end;return y.filter(function(e){var a=Dn(e);return a?!(t&&a<t)&&!(n&&a>n):"last-year"!==Ee&&"last-6-months"!==Ee&&"this-month"!==Ee&&"this-week"!==Ee&&"last-month"!==Ee})},[Se,we,Ee,y]),Be=(0,o.useMemo)(function(){var e=Fn(new Date),t={totalInvoiced:0,totalPaid:0,totalUnpaid:0,paidCount:0,partialCount:0,overdueCount:0,unpaidCount:0,dueSoonCount:0,overdueAmount:0,partialAmount:0,pendingAmount:0},n=[],a=new Map;Me.forEach(function(r){var i,l,o,c=Number(null!==(i=null!==(l=r.amount_due)&&void 0!==l?l:null===(o=r.totals)||void 0===o?void 0:o.grand_total)&&void 0!==i?i:0),u=function(e){return Number(e.payment_received_amount||0)}(r),s=function(e){var t,n,a,r;return Number(null!==(t=e.balance_due)&&void 0!==t?t:Math.max(0,Number(null!==(n=null!==(a=e.amount_due)&&void 0!==a?a:null===(r=e.totals)||void 0===r?void 0:r.grand_total)&&void 0!==n?n:0)-Number(e.payment_received_amount||0)))}(r),m=An(r.due_date),f=function(e){return String(e.status||"pending").toLowerCase()}(r),d="paid"===f||s<=0,p=!d&&("partial"===f||u>0),v=!d&&s>0&&("overdue"===f||m&&m<e),y=!d&&!p&&!v&&s>0,g=m?Math.max(0,Math.ceil((e.getTime()-m.getTime())/864e5)):0,b=!(d||v||!(s>0)||!m)&&Math.ceil((m.getTime()-e.getTime())/864e5)<=7;t.totalInvoiced+=c,t.totalPaid+=u,t.totalUnpaid+=s,d?t.paidCount+=1:p?(t.partialCount+=1,t.partialAmount+=s):v?(t.overdueCount+=1,t.overdueAmount+=s):y&&(t.unpaidCount+=1,t.pendingAmount+=s),b&&(t.dueSoonCount+=1);var h=Dn(r);if(h){var E=h.toISOString().slice(0,7);a.set(E,(a.get(E)||0)+c)}s>0&&(v||p||y||b)&&n.push(En(En({},r),{},{amountDue:c,paidAmount:u,balanceDue:s,dueDate:m,daysLate:g,isPaid:d,isPartial:p,isOverdue:v,isUnpaid:y,dueSoon:b}))}),n.sort(function(e,t){var n=e.isOverdue?0:e.isPartial?1:e.dueSoon?2:3,a=t.isOverdue?0:t.isPartial?1:t.dueSoon?2:3;return n!==a?n-a:(t.daysLate||0)-(e.daysLate||0)});var r=Array.from(a.entries()).sort(function(e,t){var n=mn(e,1)[0],a=mn(t,1)[0];return String(n).localeCompare(String(a))}).map(function(e){var t=mn(e,2),n=t[0],a=t[1];return{label:n,value:Number(a.toFixed(2))}});return{summary:t,monthly:r,attentionInvoices:n.slice(0,6),count:Me.length,range:In(Ee,we,Se)}},[Se,we,Ee,Me]),Ue=Wn("manfiet-invoice-manager"),We=Wn("manfiet-invoice-create"),Ve=(0,o.useMemo)(function(){var e;if("custom"===Ee){var t=we?Ln(Fn(new Date("".concat(we,"T00:00:00")))):"",n=Se?Ln(Fn(new Date("".concat(Se,"T00:00:00")))):"";return t&&n?"".concat(t," - ").concat(n):t?"".concat(t," - ").concat(q("Open ended","manfi-expense-tracker")):n?"".concat(q("Up to","manfi-expense-tracker")," ").concat(n):q("Custom range","manfi-expense-tracker")}return(null===(e=Rn.find(function(e){return e.value===Ee}))||void 0===e?void 0:e.label)||q("This month","manfi-expense-tracker")},[Se,we,Ee]),$e=q(m?"Create Invoice":"Invoice Dashboard","manfi-expense-tracker"),Ge=q(m?"Create or edit a single invoice and track any carried due from a previous invoice.":"Review invoice totals, payment status, and recent balances in one place.","manfi-expense-tracker");return o.createElement("div",{className:"manfiet-page-shell manfiet-page-shell-wide manfiet-invoice-manager-shell"},o.createElement("div",{className:"manfiet-page-hero"},o.createElement("div",{className:"left-section"},o.createElement("h1",{className:"manfiet-page-title"},$e),o.createElement("p",{className:"manfiet-page-subtitle"},Ge),m?o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-secondary",onClick:function(){return window.location.href=Ue}},q("Back to Dashboard","manfi-expense-tracker")):o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-primary",onClick:function(){return window.location.href=We}},q("Create Invoice","manfi-expense-tracker"))),o.createElement("div",{className:"manfiet-hero-toolbar"},!m&&o.createElement("div",{className:"manfiet-dashboard-range-panel"},o.createElement("div",{className:"manfiet-dashboard-range-top"},o.createElement("div",null,o.createElement("div",{className:"manfiet-dashboard-range-label"},q("Date range","manfi-expense-tracker")),o.createElement("div",{className:"manfiet-dashboard-range-value"},Ve)),o.createElement("div",{className:"manfiet-dashboard-range-count"},Me.length," ",q("invoices","manfi-expense-tracker"))),o.createElement("div",{className:"manfiet-dashboard-range-controls"},o.createElement("div",{className:"manfiet-field manfiet-dashboard-range-field"},o.createElement("label",{className:"manfiet-sr-only",htmlFor:"manfiet-dashboard-range"},q("Range","manfi-expense-tracker")),o.createElement("select",{id:"manfiet-dashboard-range",className:"manfiet-input manfiet-dashboard-range-select",value:Ee,onChange:function(e){return xe(e.target.value)}},Rn.map(function(e){return o.createElement("option",{key:e.value,value:e.value},e.label)}))),"custom"===Ee&&o.createElement(o.Fragment,null,o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-dashboard-range-start"},q("From","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-dashboard-range-start",type:"date",className:"manfiet-input",value:we,onChange:function(e){return _e(e.target.value)}})),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-dashboard-range-end"},q("To","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-dashboard-range-end",type:"date",className:"manfiet-input",value:Se,onChange:function(e){return Ce(e.target.value)}}))))))),!m&&o.createElement(o.Fragment,null,o.createElement("div",{className:"manfiet-stats-grid manfiet-mb-16"},o.createElement("div",{className:"manfiet-card manfiet-stat-card"},o.createElement("div",{className:"manfiet-stat-label"},q("Invoices","manfi-expense-tracker")),o.createElement("div",{className:"manfiet-stat-value"},Be.count||0)),o.createElement("div",{className:"manfiet-card manfiet-stat-card"},o.createElement("div",{className:"manfiet-stat-label"},q("Total Invoiced","manfi-expense-tracker")),o.createElement("div",{className:"manfiet-stat-value"},Tn(Be.summary.totalInvoiced))),o.createElement("div",{className:"manfiet-card manfiet-stat-card"},o.createElement("div",{className:"manfiet-stat-label"},q("Total Paid","manfi-expense-tracker")),o.createElement("div",{className:"manfiet-stat-value"},Tn(Be.summary.totalPaid))),o.createElement("div",{className:"manfiet-card manfiet-stat-card"},o.createElement("div",{className:"manfiet-stat-label"},q("Total Unpaid","manfi-expense-tracker")),o.createElement("div",{className:"manfiet-stat-value"},Tn(Be.summary.totalUnpaid))),o.createElement("div",{className:"manfiet-card manfiet-stat-card"},o.createElement("div",{className:"manfiet-stat-label"},q("Overdue","manfi-expense-tracker")),o.createElement("div",{className:"manfiet-stat-value"},Be.summary.overdueCount),o.createElement("div",{className:"manfiet-text-muted"},Tn(Be.summary.overdueAmount)," ",q("at risk","manfi-expense-tracker"))),o.createElement("div",{className:"manfiet-card manfiet-stat-card"},o.createElement("div",{className:"manfiet-stat-label"},q("Partial","manfi-expense-tracker")),o.createElement("div",{className:"manfiet-stat-value"},Be.summary.partialCount),o.createElement("div",{className:"manfiet-text-muted"},Tn(Be.summary.partialAmount)," ",q("remaining","manfi-expense-tracker"))),o.createElement("div",{className:"manfiet-card manfiet-stat-card"},o.createElement("div",{className:"manfiet-stat-label"},q("Pending / Unpaid","manfi-expense-tracker")),o.createElement("div",{className:"manfiet-stat-value"},Be.summary.unpaidCount),o.createElement("div",{className:"manfiet-text-muted"},Tn(Be.summary.pendingAmount)," ",q("awaiting payment","manfi-expense-tracker"))),o.createElement("div",{className:"manfiet-card manfiet-stat-card"},o.createElement("div",{className:"manfiet-stat-label"},q("Paid","manfi-expense-tracker")),o.createElement("div",{className:"manfiet-stat-value"},Be.summary.paidCount))),o.createElement("div",{className:"manfiet-card manfiet-mb-16"},o.createElement("div",{className:"manfiet-card-head-row manfiet-mb-14"},o.createElement("h3",{className:"manfiet-card-title manfiet-card-title-no-margin"},q("Payment Attention","manfi-expense-tracker"))),0===Be.attentionInvoices.length?o.createElement("p",{className:"manfiet-text-muted"},q("No overdue or partially unpaid invoices right now.","manfi-expense-tracker")):o.createElement("div",{className:"manfiet-table-scroll"},o.createElement("table",{className:"manfiet-table"},o.createElement("thead",null,o.createElement("tr",null,o.createElement("th",null,q("Invoice","manfi-expense-tracker")),o.createElement("th",null,q("Client","manfi-expense-tracker")),o.createElement("th",null,q("Due Date","manfi-expense-tracker")),o.createElement("th",null,q("Status","manfi-expense-tracker")),o.createElement("th",null,q("Paid","manfi-expense-tracker")),o.createElement("th",null,q("Remaining","manfi-expense-tracker")),o.createElement("th",null,q("Priority","manfi-expense-tracker")),o.createElement("th",null,q("Actions","manfi-expense-tracker")))),o.createElement("tbody",null,Be.attentionInvoices.map(function(e){return o.createElement("tr",{key:"attention-".concat(e.id)},o.createElement("td",null,e.invoice_no),o.createElement("td",null,e.client_name),o.createElement("td",null,e.dueDate?e.dueDate.toLocaleDateString():q("Not set","manfi-expense-tracker")),o.createElement("td",null,o.createElement("span",{className:"manfiet-pill manfiet-pill-".concat(e.status||"pending")},e.status||"pending")),o.createElement("td",null,Tn(e.paidAmount)),o.createElement("td",null,Tn(e.balanceDue)),o.createElement("td",null,e.isOverdue?"".concat(e.daysLate," ").concat(q("days overdue","manfi-expense-tracker")):e.isPartial?q("Partially paid","manfi-expense-tracker"):e.dueSoon?q("Due soon","manfi-expense-tracker"):q("Unpaid","manfi-expense-tracker")),o.createElement("td",null,o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-primary manfiet-button-sm",onClick:function(){return Pe(e)}},q("Payment","manfi-expense-tracker")),o.createElement("a",{href:"".concat(s,"invoices/").concat(e.id,"/pdf?token=").concat(e.share_token),download:!0,className:"manfiet-button manfiet-button-secondary manfiet-button-sm manfiet-ml-8"},q("PDF","manfi-expense-tracker")),o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-info manfiet-button-sm manfiet-ml-8",onClick:function(){window.location.href=Wn("manfiet-invoice-create",e.id)}},q("Open","manfi-expense-tracker"))))})))))),m&&o.createElement("div",{className:"manfiet-card manfiet-mb-16"},o.createElement("h3",{className:"manfiet-card-title"},d.id?q("Edit Invoice","manfi-expense-tracker"):q("Create Invoice","manfi-expense-tracker")),z&&o.createElement("p",{className:"manfiet-alert manfiet-alert-error"},z),M&&o.createElement("p",{className:"manfiet-alert manfiet-alert-success"},M),o.createElement("form",{onSubmit:function(e){var t,n,a,r,i;e.preventDefault(),F(!0),R(""),B("");var l={invoice_type:d.invoice_type||"standard",service_type_label:d.service_type_label||"",vendor_id:d.vendor_id,client_id:d.client_id,client_name:d.client_name,currency:d.currency||"BDT",invoice_no:d.invoice_no,date:d.date,due_date:d.due_date,late_fee_pct:null!==(t=d.late_fee_pct)&&void 0!==t?t:"5",address:d.address,phone:d.phone,email:d.email,email2:d.email2,service_desc:d.service_desc,notes:d.notes,exchange_rate:d.exchange_rate,discount_type:d.discount_type||"percentage",discount_val:null!==(n=null!==(a=d.discount_val)&&void 0!==a?a:d.discount_pct)&&void 0!==n?n:"0",discount_pct:"flat"===d.discount_type?je.discountPct:null!==(r=null!==(i=d.discount_val)&&void 0!==i?i:d.discount_pct)&&void 0!==r?r:"0",vat_pct:d.vat_pct,adjustment_usd:d.adjustment_usd,adjustment_bdt:d.adjustment_bdt,adjustment_note:d.adjustment_note,status:Bn(je.amountDue,je.paymentReceivedAmount,d.status),previous_invoice_id:d.previous_invoice_id,previous_invoice_no:d.previous_invoice_no,previous_due_amount:d.previous_due_amount,payment_received_amount:d.payment_received_amount,payments:d.payments||[],financial_account_ids:d.financial_account_ids,payment_link:d.payment_link,campaigns:d.campaigns.map(function(e){return{name:e.name,daily_budget:e.daily_budget,duration:"fixed"===d.invoice_type?"1":e.duration||"1",description:e.description,amount:Mn(e,d.invoice_type)}})},o=d.id?"PUT":"POST",c=d.id?"".concat(s,"invoices/").concat(d.id):"".concat(s,"invoices");wn(c,{method:o,body:JSON.stringify(l)}).then(function(e){var t=!d.id;B(q(t?"Invoice created successfully. Continue editing or print.":"Invoice updated successfully.","manfi-expense-tracker")),V(e.share_url||""),Re(e),Ae()}).catch(function(e){R(e.message||q("Failed to save invoice.","manfi-expense-tracker"))}).finally(function(){return F(!1)})},className:"manfiet-form-stack"},o.createElement("div",{className:"manfiet-card manfiet-card-inset manfiet-mb-14"},o.createElement("h4",{className:"manfiet-card-subtitle"},q("Vendor & Client","manfi-expense-tracker")),o.createElement("p",{className:"manfiet-text-muted manfiet-mb-12"},q("Select a vendor (your company) and client (customer). If not available, create them on their respective pages first.","manfi-expense-tracker")),o.createElement("div",{className:"manfiet-form-grid"},o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-vendor-select"},q("Vendor (Your Company)","manfi-expense-tracker")),o.createElement("select",{id:"manfiet-vendor-select",className:"manfiet-input",value:d.vendor_id,onChange:function(e){return Fe("vendor_id",e.target.value)}},o.createElement("option",{value:""},q("-- Select vendor --","manfi-expense-tracker")),h.map(function(e){return o.createElement("option",{key:e.id,value:String(e.id)},e.company_name)})),0===h.length&&o.createElement("p",{className:"manfiet-text-muted manfiet-mt-4"},q("No vendors available. Create one on the Vendors page.","manfi-expense-tracker"))),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-client-select"},q("Client (Customer)","manfi-expense-tracker")),o.createElement("select",{id:"manfiet-client-select",className:"manfiet-input",value:d.client_id,onChange:function(e){return Fe("client_id",e.target.value)}},o.createElement("option",{value:""},q("-- Select client --","manfi-expense-tracker")),k.map(function(e){return o.createElement("option",{key:e.id,value:String(e.id)},e.client_name)})),0===k.length&&o.createElement("p",{className:"manfiet-text-muted manfiet-mt-4"},q("No clients available. Create one on the Clients page.","manfi-expense-tracker"))))),o.createElement("div",{className:"manfiet-form-grid"},o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-invoice-type"},q("Invoice Type / Mode","manfi-expense-tracker")),o.createElement("select",{id:"manfiet-invoice-type",className:"manfiet-input",value:d.invoice_type||"standard",onChange:function(e){return Fe("invoice_type",e.target.value)}},o.createElement("option",{value:"standard"},q("Standard Products & Services (Direct Currency)","manfi-expense-tracker")),o.createElement("option",{value:"daily_rate"},q("Daily Rate & Campaign (USD with Exchange Rate)","manfi-expense-tracker")),o.createElement("option",{value:"hourly"},q("Hourly & Retainer Services","manfi-expense-tracker")),o.createElement("option",{value:"fixed"},q("Fixed Milestone / Flat Fee","manfi-expense-tracker")))),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-currency"},q("Currency","manfi-expense-tracker")),o.createElement("select",{id:"manfiet-currency",className:"manfiet-input",value:d.currency||"BDT",onChange:function(e){return Fe("currency",e.target.value)}},o.createElement("option",{value:"BDT"},"BDT (৳) - Bangladeshi Taka"),o.createElement("option",{value:"USD"},"USD ($) - US Dollar"),o.createElement("option",{value:"GBP"},"GBP (£) - British Pound"),o.createElement("option",{value:"EUR"},"EUR (€) - Euro"),o.createElement("option",{value:"CAD"},"CAD (CA$) - Canadian Dollar"),o.createElement("option",{value:"AUD"},"AUD (A$) - Australian Dollar"),o.createElement("option",{value:"INR"},"INR (₹) - Indian Rupee"),o.createElement("option",{value:"AED"},"AED (AED) - UAE Dirham"),o.createElement("option",{value:"SAR"},"SAR (SAR) - Saudi Riyal"),o.createElement("option",{value:"MYR"},"MYR (RM) - Malaysian Ringgit"),o.createElement("option",{value:"SGD"},"SGD (S$) - Singapore Dollar"))),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-service-type-label"},q("Category / Service Label","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-service-type-label",className:"manfiet-input",value:d.service_type_label||"",onChange:function(e){return Fe("service_type_label",e.target.value)},placeholder:q("e.g. E-Commerce Order, Web Development, Consulting","manfi-expense-tracker")})),!d.client_id&&o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-client-name"},q("Client Name","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-client-name",className:"manfiet-input",value:d.client_name,onChange:function(e){return Fe("client_name",e.target.value)},placeholder:q("Enter client name manually if not selecting from list","manfi-expense-tracker")})),d.client_id&&o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-client-name-readonly"},q("Client Name","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-client-name-readonly",className:"manfiet-input",value:d.client_name,readOnly:!0,style:{backgroundColor:"#f0f0f0",cursor:"not-allowed"}}),o.createElement("p",{className:"manfiet-text-muted manfiet-mt-4"},q("Auto-populated from selected client. Clear client selection to edit.","manfi-expense-tracker"))),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-invoice-no"},q("Invoice #","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-invoice-no",className:"manfiet-input",value:d.invoice_no,onChange:function(e){return Fe("invoice_no",e.target.value)}}),!d.id&&o.createElement("p",{className:"manfiet-text-muted manfiet-mt-4"},q("Leave blank to generate automatically.","manfi-expense-tracker"))),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-invoice-date"},q("Date","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-invoice-date",type:"date",className:"manfiet-input",value:d.date,onChange:function(e){return Fe("date",e.target.value)}})),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-due-date"},q("Due Date","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-due-date",type:"date",className:"manfiet-input",value:d.due_date,onChange:function(e){return Fe("due_date",e.target.value)}})),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-late-fee-pct"},q("Overdue Due Fee (%)","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-late-fee-pct",type:"number",min:"0",step:"0.1",className:"manfiet-input",value:d.late_fee_pct,onChange:function(e){return Fe("late_fee_pct",e.target.value)},placeholder:"5.0"}),o.createElement("p",{className:"manfiet-text-muted manfiet-mt-4"},q("Late fee % applied if unpaid after due date.","manfi-expense-tracker"))),"daily_rate"===d.invoice_type&&o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-exchange-rate"},q("Exchange Rate (BDT/USD)","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-exchange-rate",type:"number",min:"0",step:"0.01",className:"manfiet-input",value:d.exchange_rate,onChange:function(e){return Fe("exchange_rate",e.target.value)}})),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-discount-type"},q("Discount Type","manfi-expense-tracker")),o.createElement("select",{id:"manfiet-discount-type",className:"manfiet-input",value:d.discount_type||"percentage",onChange:function(e){return Fe("discount_type",e.target.value)}},o.createElement("option",{value:"percentage"},q("Percentage (%)","manfi-expense-tracker")),o.createElement("option",{value:"flat"},q("Flat Amount","manfi-expense-tracker")))),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-discount-val"},"flat"===d.discount_type?"".concat(q("Discount Amount","manfi-expense-tracker")," (").concat(Pn[d.currency]||d.currency,")"):q("Discount %","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-discount-val",type:"number",min:"0",step:"0.01",className:"manfiet-input",value:null!==(t=null!==(n=d.discount_val)&&void 0!==n?n:d.discount_pct)&&void 0!==t?t:"0",onChange:function(e){Fe("discount_val",e.target.value),"flat"!==d.discount_type&&Fe("discount_pct",e.target.value)},placeholder:"0"})),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-vat-pct"},q("VAT %","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-vat-pct",type:"number",min:"0",step:"0.01",className:"manfiet-input",value:d.vat_pct,onChange:function(e){return Fe("vat_pct",e.target.value)}})),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-status"},q("Status","manfi-expense-tracker")),o.createElement("select",{id:"manfiet-status",className:"manfiet-input",value:d.status,onChange:function(e){return Fe("status",e.target.value)}},o.createElement("option",{value:"pending"},q("Pending","manfi-expense-tracker")),o.createElement("option",{value:"partial"},q("Partial","manfi-expense-tracker")),o.createElement("option",{value:"paid"},q("Paid","manfi-expense-tracker")),o.createElement("option",{value:"overdue"},q("Overdue","manfi-expense-tracker")),o.createElement("option",{value:"draft"},q("Draft","manfi-expense-tracker"))))),o.createElement("div",{className:"manfiet-card manfiet-card-inset manfiet-mb-14"},o.createElement("h4",{className:"manfiet-card-subtitle"},q("Invoice Adjustment (Optional)","manfi-expense-tracker")),o.createElement("p",{className:"manfiet-text-muted manfiet-mb-12"},q("Add a manual adjustment (credit/debit) from a previous invoice or general changes. Positive values increase the invoice total, negative values decrease it.","manfi-expense-tracker")),o.createElement("div",{className:"manfiet-form-grid"},"daily_rate"===d.invoice_type&&o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-adjustment-usd"},q("Adjustment Amount (USD)","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-adjustment-usd",type:"number",step:"0.01",className:"manfiet-input",value:d.adjustment_usd,onChange:function(e){var t=e.target.value;Fe("adjustment_usd",t);var n=Number(d.exchange_rate||0),a=""!==t&&n>0?String((Number(t)*n).toFixed(2)):"";Fe("adjustment_bdt",a)},placeholder:q("e.g. -10.00","manfi-expense-tracker")})),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-adjustment-bdt"},q("Adjustment Amount","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-adjustment-bdt",type:"number",step:"0.01",className:"manfiet-input",value:d.adjustment_bdt,onChange:function(e){var t=e.target.value;if(Fe("adjustment_bdt",t),"daily_rate"===d.invoice_type){var n=Number(d.exchange_rate||0),a=""!==t&&n>0?String((Number(t)/n).toFixed(2)):"";Fe("adjustment_usd",a)}},placeholder:q("e.g. -1500.00","manfi-expense-tracker")}))),o.createElement("div",{className:"manfiet-field manfiet-mt-12"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-adjustment-note"},q("Adjustment Note / Message","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-adjustment-note",className:"manfiet-input",value:d.adjustment_note,onChange:function(e){return Fe("adjustment_note",e.target.value)},placeholder:q("e.g. Credit adjustment from previous period","manfi-expense-tracker")}))),o.createElement("div",{className:"manfiet-card manfiet-card-inset manfiet-mb-14"},o.createElement("h4",{className:"manfiet-card-subtitle"},q("Payment Tracking","manfi-expense-tracker")),o.createElement("p",{className:"manfiet-text-muted manfiet-mb-12"},q("Link a previous invoice when you are carrying an unpaid balance into this invoice. Enter how much was received so the balance stays visible.","manfi-expense-tracker")),o.createElement("div",{className:"manfiet-form-grid"},o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-previous-invoice"},q("Previous Invoice","manfi-expense-tracker")),o.createElement("select",{id:"manfiet-previous-invoice",className:"manfiet-input",value:d.previous_invoice_id,onChange:function(e){return function(e){var t,n,a,r,i;if(e){var l=y.find(function(t){return String(t.id)===String(e)});if(l){var o=Number(null!==(t=null!==(n=null!==(a=l.balance_due)&&void 0!==a?a:l.amount_due)&&void 0!==n?n:null===(r=l.totals)||void 0===r?void 0:r.grand_total)&&void 0!==t?t:0),c=l.due_date?new Date("".concat(l.due_date,"T23:59:59")):null,u=d.date?new Date("".concat(d.date,"T00:00:00")):new Date,s="overdue"===l.status||c&&c<u,m=Boolean(null!==(i=kn.invoiceLateFeeEnabled)&&void 0!==i?i:1)&&s&&o>0,f=d.adjustment_bdt,v=d.adjustment_usd,g=d.adjustment_note;if(m){var b,h=Number(null!==(b=kn.invoiceLateFeePct)&&void 0!==b?b:5),E="flat"===(kn.invoiceLateFeeType||"percentage")?h:Number((o*(h/100)).toFixed(2)),x=Number(d.exchange_rate||150);f=E.toFixed(2),"daily_rate"===d.invoice_type&&x>0&&(v=(E/x).toFixed(2));var k=l.currency||d.currency||"BDT";g="Adjusted due fee ".concat(h,"% of ").concat(o.toFixed(2)," ").concat(k.toLowerCase()," from previous invoice ").concat(l.invoice_no||"").trim()}p(function(e){return En(En({},e),{},{previous_invoice_id:String(l.id),previous_invoice_no:l.invoice_no||"",previous_due_amount:o.toFixed(2)},m?{adjustment_bdt:f,adjustment_usd:v,adjustment_note:g}:{})})}else p(function(t){return En(En({},t),{},{previous_invoice_id:String(e)})})}else p(function(e){return En(En({},e),{},{previous_invoice_id:"",previous_invoice_no:"",previous_due_amount:"0"})})}(e.target.value)}},o.createElement("option",{value:""},q("-- None --","manfi-expense-tracker")),Te.map(function(e){var t,n,a,r;return o.createElement("option",{key:e.id,value:String(e.id)},e.invoice_no," - ",e.client_name," - ",On(Number(null!==(t=null!==(n=null!==(a=e.balance_due)&&void 0!==a?a:e.amount_due)&&void 0!==n?n:null===(r=e.totals)||void 0===r?void 0:r.grand_total)&&void 0!==t?t:0),e.currency||d.currency)," ",q("due","manfi-expense-tracker"))})),0===Te.length&&o.createElement("p",{className:"manfiet-text-muted manfiet-mt-4"},q("No open invoices found for this client.","manfi-expense-tracker"))),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-previous-invoice-no"},q("Previous Invoice #","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-previous-invoice-no",className:"manfiet-input",value:d.previous_invoice_no,onChange:function(e){return Fe("previous_invoice_no",e.target.value)},placeholder:q("Selected invoice number","manfi-expense-tracker")})),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-previous-due"},q("Previous Due","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-previous-due",type:"number",min:"0",step:"0.01",className:"manfiet-input",value:d.previous_due_amount,onChange:function(e){return Fe("previous_due_amount",e.target.value)}})),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-payment-received"},q("Current Payment Received (Total)","manfi-expense-tracker")),o.createElement("div",{style:{display:"flex",gap:"8px"}},o.createElement("input",{id:"manfiet-payment-received",type:"number",min:"0",step:"0.01",className:"manfiet-input",value:d.payment_received_amount,onChange:function(e){return Fe("payment_received_amount",e.target.value)}}),d.id&&o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-primary",style:{whitespace:"nowrap"},onClick:function(){return Pe(d)}},q("+ Add Payment","manfi-expense-tracker"))),o.createElement("p",{className:"manfiet-text-muted manfiet-mt-4"},q("Total amount received for this invoice.","manfi-expense-tracker")))),function(e){var t=y.find(function(e){return String(e.id)===String(d.previous_invoice_id)});if(!t)return null;var n=t.due_date?new Date("".concat(t.due_date,"T23:59:59")):null,a=d.date?new Date("".concat(d.date,"T00:00:00")):new Date,r="overdue"===t.status||n&&n<a,i=Number(d.previous_due_amount||t.balance_due||0);if(!r||i<=0)return null;var l=Number(null!==(e=kn.invoiceLateFeePct)&&void 0!==e?e:5),c="flat"===(kn.invoiceLateFeeType||"percentage")?l:Number((i*(l/100)).toFixed(2));return o.createElement("div",{style:{background:"#fffbeb",border:"1.5px solid #fde68a",borderRadius:"8px",padding:"12px 16px",marginTop:"14px",display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:"10px"}},o.createElement("div",{style:{display:"flex",alignItems:"center",gap:"10px"}},o.createElement("span",{style:{fontSize:"20px"}},"⚡"),o.createElement("div",null,o.createElement("div",{style:{fontSize:"13.5px",color:"#92400e",fontWeight:"700"}},q("Overdue Invoice Detected:","manfi-expense-tracker")," ",t.invoice_no,t.due_date?" (".concat(q("Due Date was:","manfi-expense-tracker")," ").concat(t.due_date,")"):""),o.createElement("div",{style:{fontSize:"12.5px",color:"#b45309",marginTop:"2px"}},q("Overdue balance:","manfi-expense-tracker")," ",o.createElement("strong",null,On(i,t.currency||d.currency))," • ",q("Late fine at","manfi-expense-tracker")," ",l,"%: ",o.createElement("strong",null,"+",On(c,d.currency))))),o.createElement("div",{style:{display:"flex",gap:"8px",alignItems:"center"}},o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-primary manfiet-button-sm",style:{background:"#d97706",borderColor:"#b45309",fontWeight:"600",padding:"6px 14px"},onClick:function(){return function(){var e,t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:null)||y.find(function(e){return String(e.id)===String(d.previous_invoice_id)}),n=Number(d.previous_due_amount||(null==t?void 0:t.balance_due)||(null==t?void 0:t.amount_due)||0);if(!(n<=0)){var a=Number(null!==(e=kn.invoiceLateFeePct)&&void 0!==e?e:5),r="flat"===(kn.invoiceLateFeeType||"percentage")?a:Number((n*(a/100)).toFixed(2)),i=Number(d.exchange_rate||150),l=r.toFixed(2),o="daily_rate"===d.invoice_type&&i>0?(r/i).toFixed(2):"",c=(null==t?void 0:t.invoice_no)||d.previous_invoice_no||"",u=(null==t?void 0:t.currency)||d.currency||"BDT",s="Adjusted due fee ".concat(a,"% of ").concat(n.toFixed(2)," ").concat(u.toLowerCase()," from previous invoice ").concat(c).trim();p(function(e){return En(En({},e),{},{adjustment_bdt:l,adjustment_usd:o,adjustment_note:s})})}}(t)}},q("⚡ Apply Late Fee Adjustment","manfi-expense-tracker"))))}(),d.payments&&d.payments.length>0&&o.createElement("div",{className:"manfiet-mt-14",style:{background:"#ffffff",padding:"12px",borderRadius:"8px",border:"1px solid #e2e8f0"}},o.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"}},o.createElement("h5",{style:{margin:0,fontSize:"14px",fontWeight:"600",color:"#1e293b"}},q("Recorded Payments History","manfi-expense-tracker")),d.id&&o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-primary manfiet-button-sm",onClick:function(){return Pe(d)}},q("+ Add Payment","manfi-expense-tracker"))),o.createElement("div",{className:"manfiet-table-responsive"},o.createElement("table",{className:"manfiet-table manfiet-table-sm",style:{width:"100%",fontSize:"13px"}},o.createElement("thead",null,o.createElement("tr",null,o.createElement("th",null,q("Date & Time","manfi-expense-tracker")),o.createElement("th",null,q("Method","manfi-expense-tracker")),o.createElement("th",null,q("Trx ID","manfi-expense-tracker")),o.createElement("th",null,q("Amount","manfi-expense-tracker")),d.id&&o.createElement("th",{style:{textAlign:"right"}},q("Action","manfi-expense-tracker")))),o.createElement("tbody",null,d.payments.map(function(e){return o.createElement("tr",{key:e.id},o.createElement("td",null,e.date||"-"),o.createElement("td",null,o.createElement("span",{className:"manfiet-badge",style:{background:"#e0f2fe",color:"#0369a1",padding:"2px 8px",borderRadius:"4px",fontSize:"12px",fontWeight:"500"}},e.method||"Default")),o.createElement("td",null,o.createElement("code",null,e.transaction_id||"-")),o.createElement("td",null,o.createElement("strong",null,On(e.amount,d.currency))),d.id&&o.createElement("td",{style:{textAlign:"right"}},o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-danger manfiet-button-sm",onClick:function(){return Oe(d.id,e.id)}},q("Delete","manfi-expense-tracker"))))}))))),o.createElement("div",{className:"manfiet-summary-list manfiet-mt-12"},o.createElement("div",null,o.createElement("span",null,q("Amount Due","manfi-expense-tracker")),o.createElement("strong",null,On(je.amountDue,d.currency))),o.createElement("div",null,o.createElement("span",null,q("Current Received","manfi-expense-tracker")),o.createElement("strong",null,On(je.paymentReceivedAmount,d.currency))),o.createElement("div",null,o.createElement("span",null,q("Balance Due","manfi-expense-tracker")),o.createElement("strong",null,On(je.balanceDue,d.currency))))),o.createElement("div",{className:"manfiet-card manfiet-card-inset manfiet-mb-14"},o.createElement("h4",{className:"manfiet-card-subtitle"},q("Invoice Contact Overrides","manfi-expense-tracker")),o.createElement("p",{className:"manfiet-text-muted manfiet-mb-12"},q("Use these only if you want to override the saved vendor or client contact details on this invoice.","manfi-expense-tracker")),o.createElement("div",{className:"manfiet-form-grid"},o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-phone"},q("Client Phone Number","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-phone",className:"manfiet-input",value:d.phone,onChange:function(e){return Fe("phone",e.target.value)}})),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-email"},q("Client Email Address","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-email",className:"manfiet-input",value:d.email,onChange:function(e){return Fe("email",e.target.value)}})),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-email2"},q("Client Secondary Email","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-email2",className:"manfiet-input",value:d.email2,onChange:function(e){return Fe("email2",e.target.value)}}))),o.createElement("div",{className:"manfiet-field manfiet-mt-12"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-address"},q("Client Address","manfi-expense-tracker")),o.createElement("textarea",{id:"manfiet-address",className:"manfiet-input",rows:"3",value:d.address,onChange:function(e){return Fe("address",e.target.value)}}))),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-service-desc"},q("Service Description","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-service-desc",className:"manfiet-input",value:d.service_desc,onChange:function(e){return Fe("service_desc",e.target.value)},placeholder:q("e.g. Services & Billing","manfi-expense-tracker")})),o.createElement("div",{className:"manfiet-field manfiet-mt-12"},o.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"6px"}},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-notes",style:{margin:0}},q("Notes & Conditions","manfi-expense-tracker")),o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-secondary manfiet-button-sm",style:{fontSize:"11.5px",padding:"3px 10px",background:"#f1f5f9",color:"#1e293b",border:"1px solid #cbd5e1"},onClick:function(){var e=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:d.due_date,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d.invoice_no,a=kn.invoiceDefaultTerms||"• Payment is due on or before the specified due date ({due_date}).\n• An overdue/late payment fee of {late_fee}% will apply to any unpaid balance after the due date.\n• Please mention invoice #{invoice_no} as reference when making payments.",r=null!==(e=kn.invoiceLateFeePct)&&void 0!==e?e:5,i=t||"the due date";return a.replace(/\{due_date\}/g,i).replace(/\{late_fee\}/g,String(r)).replace(/\{invoice_no\}/g,n||"INV-XXXX")}(d.due_date,d.invoice_no);Fe("notes",d.notes?"".concat(d.notes.trim(),"\n\n").concat(e):e)}},q("📋 Insert Standard Terms & Late Fee Policy","manfi-expense-tracker"))),o.createElement("textarea",{id:"manfiet-notes",className:"manfiet-input",rows:"3",value:d.notes,onChange:function(e){return Fe("notes",e.target.value)},placeholder:q("Enter custom terms, notes, or conditions...","manfi-expense-tracker")})),o.createElement("div",{className:"manfiet-card manfiet-card-inset"},o.createElement("h4",{className:"manfiet-card-subtitle"},q("Payment Accounts","manfi-expense-tracker")),o.createElement("p",{className:"manfiet-text-muted manfiet-mb-12"},q("Select the payment accounts to display on this invoice:","manfi-expense-tracker")),0===N.length?o.createElement("p",{className:"manfiet-text-muted"},q("No financial accounts available. Create them on the Financial Accounts page.","manfi-expense-tracker")):o.createElement("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:"10px",marginTop:"10px"}},N.map(function(e){var t=String(e.id),n=d.financial_account_ids.includes(t);return o.createElement("label",{key:e.id,style:{display:"flex",alignItems:"center",gap:"10px",padding:"10px 14px",background:n?"#eff6ff":"#ffffff",border:"1.5px solid ".concat(n?"#2563eb":"#e2e8f0"),borderRadius:"8px",cursor:"pointer",transition:"all 0.15s ease",boxShadow:n?"0 1px 3px rgba(37,99,235,0.1)":"none"}},o.createElement("input",{type:"checkbox",checked:n,onChange:function(e){var n=e.target.checked;p(function(e){var a=e.financial_account_ids||[];return En(En({},e),{},n?{financial_account_ids:a.includes(t)?a:[].concat(fn(a),[t])}:{financial_account_ids:a.filter(function(e){return e!==t})})})},style:{width:"18px",height:"18px",cursor:"pointer",accentColor:"#2563eb"}}),o.createElement("div",{style:{display:"flex",flexDirection:"column"}},o.createElement("span",{style:{fontWeight:"600",fontSize:"13px",color:"#1e293b"}},e.label||function(e){return e&&([e.provider_name,e.account_type,e.account_number].filter(Boolean).join(" - ")||e.title)||""}(e)),o.createElement("span",{style:{fontSize:"11px",color:"#64748b"}},e.account_type||q("Account","manfi-expense-tracker"))))})),o.createElement("div",{className:"manfiet-field manfiet-mt-16"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-payment-link"},q("Custom Payment / Checkout Link","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-payment-link",type:"url",className:"manfiet-input",value:d.payment_link||"",onChange:function(e){return Fe("payment_link",e.target.value)},placeholder:q("e.g. https://buy.stripe.com/..., https://paypal.me/...","manfi-expense-tracker")}),o.createElement("p",{className:"manfiet-text-muted manfiet-mt-4"},q('Provide a direct hosted checkout or payment URL. A "Pay Invoice Online" button will be displayed on the public share page.',"manfi-expense-tracker")))),o.createElement("div",{className:"manfiet-card manfiet-card-inset"},o.createElement("div",{className:"manfiet-card-head-row manfiet-mb-14"},o.createElement("h4",{className:"manfiet-card-subtitle"},"daily_rate"===d.invoice_type?q("Campaigns & Daily Rates","manfi-expense-tracker"):"hourly"===d.invoice_type?q("Tasks & Hourly Rates","manfi-expense-tracker"):"fixed"===d.invoice_type?q("Milestones & Fixed Fees","manfi-expense-tracker"):q("Invoice Line Items / Services","manfi-expense-tracker")),o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-secondary manfiet-button-sm",onClick:function(){p(function(e){return En(En({},e),{},{campaigns:[].concat(fn(e.campaigns),[Sn()])})})}},q("+ Add Line Item","manfi-expense-tracker"))),o.createElement("div",{className:"manfiet-form-stack"},d.campaigns.map(function(e,t){var n=Mn(e,d.invoice_type),a="daily_rate"===d.invoice_type,r="hourly"===d.invoice_type,i="fixed"===d.invoice_type;return o.createElement("div",{key:e.id,className:"manfiet-invoice-campaign-row"},o.createElement("div",{className:"manfiet-form-grid"},o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label"},q(i?"Milestone / Title":"Item / Service Name","manfi-expense-tracker")),o.createElement("input",{className:"manfiet-input",value:e.name,onChange:function(e){return Le(t,"name",e.target.value)},placeholder:q("Enter title or item name","manfi-expense-tracker")})),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label"},q(a?"Daily Budget ($)":r?"Hourly Rate":i?"Amount":"Unit Price / Rate","manfi-expense-tracker")),o.createElement("input",{type:"number",min:"0",step:"0.01",className:"manfiet-input",value:e.daily_budget,onChange:function(e){return Le(t,"daily_budget",e.target.value)},placeholder:"0.00"})),!i&&o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label"},q(a?"Duration (Days)":r?"Hours Worked":"Quantity","manfi-expense-tracker")),o.createElement("input",{type:"number",min:"0",step:"0.1",className:"manfiet-input",value:e.duration,onChange:function(e){return Le(t,"duration",e.target.value)},placeholder:"1"})),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label"},q(a?"Amount (USD)":"Line Total","manfi-expense-tracker")),o.createElement("input",{className:"manfiet-input",value:a?"$".concat(n.toFixed(2)):On(n,d.currency),readOnly:!0,style:{fontWeight:"600",backgroundColor:"#f8fafc"}}))),o.createElement("div",{className:"manfiet-invoice-campaign-actions"},o.createElement("input",{className:"manfiet-input",placeholder:q("Short note or description for this item","manfi-expense-tracker"),value:e.description,onChange:function(e){return Le(t,"description",e.target.value)}}),o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-danger manfiet-button-sm",onClick:function(){return function(e){p(function(t){return En(En({},t),{},{campaigns:t.campaigns.length>1?t.campaigns.filter(function(t,n){return n!==e}):[Sn()]})})}(t)},disabled:1===d.campaigns.length},q("Remove","manfi-expense-tracker"))))}))),o.createElement("div",{className:"manfiet-invoice-summary-grid"},o.createElement("div",{className:"manfiet-card manfiet-card-inset"},o.createElement("h4",{className:"manfiet-card-subtitle"},q("Totals Preview","manfi-expense-tracker")),o.createElement("div",{className:"manfiet-summary-list"},"daily_rate"===d.invoice_type?o.createElement(o.Fragment,null,o.createElement("div",null,o.createElement("span",null,q("Subtotal (USD)","manfi-expense-tracker")),o.createElement("strong",null,jn(je.subtotalUsd))),0!==je.adjustmentUsd&&o.createElement("div",null,o.createElement("span",null,q("Adjustment (USD)","manfi-expense-tracker")),o.createElement("strong",{style:{color:je.adjustmentUsd<0?"#b91c1c":"#15803d"}},je.adjustmentUsd<0?"− ":"+ ",jn(Math.abs(je.adjustmentUsd)))),o.createElement("div",null,o.createElement("span",null,q("Subtotal (BDT)","manfi-expense-tracker")),o.createElement("strong",null,Tn(je.subtotalBdt)))):o.createElement("div",null,o.createElement("span",null,q("Subtotal","manfi-expense-tracker")),o.createElement("strong",null,On(je.subtotalBdt,d.currency))),o.createElement("div",null,o.createElement("span",null,q("Discount","manfi-expense-tracker"),"flat"===d.discount_type?" (".concat(q("Flat","manfi-expense-tracker"),")"):" (".concat(je.discountPct,"%)")),o.createElement("strong",{style:{color:je.discountBdt>0?"#15803d":"inherit"}},je.discountBdt>0?"− ":"",On(je.discountBdt,d.currency))),o.createElement("div",null,o.createElement("span",null,q("VAT","manfi-expense-tracker")),o.createElement("strong",null,On(je.vatBdt,d.currency))),0!==je.adjustmentBdt&&o.createElement("div",null,o.createElement("span",null,q("Adjustment","manfi-expense-tracker")),o.createElement("strong",{style:{color:je.adjustmentBdt<0?"#b91c1c":"#15803d"}},je.adjustmentBdt<0?"− ":"+ ",On(Math.abs(je.adjustmentBdt),d.currency))),o.createElement("div",{className:"is-total"},o.createElement("span",null,q("Grand Total","manfi-expense-tracker")),o.createElement("strong",null,On(je.grandTotal,d.currency))),je.previousDueAmount>0&&o.createElement("div",null,o.createElement("span",null,q("Previous Due","manfi-expense-tracker")),o.createElement("strong",null,"+ ",On(je.previousDueAmount,d.currency))),o.createElement("div",null,o.createElement("span",null,q("Total Amount Due","manfi-expense-tracker")),o.createElement("strong",null,On(je.amountDue,d.currency))),o.createElement("div",null,o.createElement("span",null,q("Paid Amount","manfi-expense-tracker")),o.createElement("strong",{style:{color:"#15803d"}},"− ",On(je.paymentReceivedAmount,d.currency))),je.overpaidAmount>0&&o.createElement("div",null,o.createElement("span",{style:{color:"#1e40af",fontWeight:"600"}},q("Overpaid / Refundable","manfi-expense-tracker")),o.createElement("strong",{style:{color:"#2563eb"}},On(je.overpaidAmount,d.currency))),o.createElement("div",{className:"is-total",style:{borderTop:"2px solid #cbd5e1",paddingTop:"6px"}},o.createElement("span",null,q("Balance Due","manfi-expense-tracker")),o.createElement("strong",{style:{color:je.balanceDue>0?"#b91c1c":"#15803d"}},On(je.balanceDue,d.currency)))),d.payments&&d.payments.length>0&&o.createElement("div",{style:{marginTop:"12px",paddingTop:"10px",borderTop:"1px dashed #cbd5e1",fontSize:"13px"}},o.createElement("strong",{style:{display:"block",marginBottom:"6px",color:"#334155"}},q("Payments Recorded:","manfi-expense-tracker")),d.payments.map(function(e){return o.createElement("div",{key:e.id,style:{display:"flex",justifyContent:"space-between",alignItems:"center",color:"#475569",marginBottom:"4px",background:"#f8fafc",padding:"4px 8px",borderRadius:"4px",border:"1px solid #f1f5f9"}},o.createElement("span",null,e.date||"Payment","  ",o.createElement("span",{className:"manfiet-badge",style:{background:"#e0f2fe",color:"#0369a1",padding:"1px 6px",borderRadius:"3px",fontSize:"11px",fontWeight:"500"}},e.method||"bKash"),e.transaction_id?o.createElement("code",null," (",e.transaction_id,")"):""),o.createElement("strong",{style:{color:"#15803d"}},Tn(e.amount)))})),W&&o.createElement("p",{className:"manfiet-invoice-link-box"},o.createElement("strong",null,q("Share Link:","manfi-expense-tracker"))," ",o.createElement("a",{href:W,target:"_blank",rel:"noreferrer"},W),o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-secondary manfiet-button-sm manfiet-ml-8",onClick:function(){return Ie(W)}},q("Copy Link","manfi-expense-tracker")))),o.createElement("div",{className:"manfiet-card manfiet-card-inset"},o.createElement("h4",{className:"manfiet-card-subtitle"},q("Save Invoice","manfi-expense-tracker")),o.createElement("div",{className:"manfiet-form-row manfiet-form-row-end"},d.id&&o.createElement("a",{href:"".concat(s,"invoices/").concat(d.id,"/pdf?token=").concat(d.share_token),download:!0,className:"manfiet-button manfiet-button-secondary"},q("Download PDF","manfi-expense-tracker")),o.createElement("button",{type:"submit",className:"manfiet-button manfiet-button-primary",disabled:D},D?q("Saving...","manfi-expense-tracker"):d.id?q("Update Invoice","manfi-expense-tracker"):q("Create Invoice","manfi-expense-tracker")),o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-secondary",onClick:function(){ze(),B(q("Ready to create a new invoice.","manfi-expense-tracker")),window.scrollTo({top:0,behavior:"smooth"})}},q("New Invoice","manfi-expense-tracker"))))))),!m&&o.createElement(o.Fragment,null,o.createElement("div",{className:"manfiet-card manfiet-mb-16"},o.createElement("div",{className:"manfiet-card-head-row manfiet-mb-14"},o.createElement("h3",{className:"manfiet-card-title manfiet-card-title-no-margin"},q("Invoice Report","manfi-expense-tracker"))),o.createElement("div",{className:"manfiet-invoice-report-grid"},o.createElement("div",null,o.createElement(Un,{monthly:Be.monthly||[]})),o.createElement("div",{className:"manfiet-report-side"},o.createElement("div",{className:"manfiet-summary-list"},o.createElement("div",null,o.createElement("span",null,q("Pending / Unpaid","manfi-expense-tracker")),o.createElement("strong",null,Be.summary.unpaidCount||0)),o.createElement("div",null,o.createElement("span",null,q("Partial","manfi-expense-tracker")),o.createElement("strong",null,Be.summary.partialCount||0)),o.createElement("div",null,o.createElement("span",null,q("Paid","manfi-expense-tracker")),o.createElement("strong",null,Be.summary.paidCount||0)),o.createElement("div",null,o.createElement("span",null,q("Overdue","manfi-expense-tracker")),o.createElement("strong",null,Be.summary.overdueCount||0)),o.createElement("div",null,o.createElement("span",null,q("Due Soon","manfi-expense-tracker")),o.createElement("strong",null,Be.summary.dueSoonCount||0))),o.createElement("p",{className:"manfiet-text-muted"},q("Use the chart to track invoice volume and the table below to manage invoices that need follow-up.","manfi-expense-tracker"))))),o.createElement("div",{className:"manfiet-card"},o.createElement("div",{className:"manfiet-card-head-row manfiet-mb-14"},o.createElement("h3",{className:"manfiet-card-title manfiet-card-title-no-margin"},q("Saved Invoices","manfi-expense-tracker"))),j?o.createElement("p",null,q("Loading invoices...","manfi-expense-tracker")):0===Me.length?o.createElement("p",{className:"manfiet-text-muted"},q("No invoices found in the selected range.","manfi-expense-tracker")):o.createElement("div",{className:"manfiet-table-scroll"},o.createElement("table",{className:"manfiet-table"},o.createElement("thead",null,o.createElement("tr",null,o.createElement("th",null,q("Invoice","manfi-expense-tracker")),o.createElement("th",null,q("Client","manfi-expense-tracker")),o.createElement("th",null,q("Total","manfi-expense-tracker")),o.createElement("th",null,q("Paid","manfi-expense-tracker")),o.createElement("th",null,q("Due","manfi-expense-tracker")),o.createElement("th",null,q("Status","manfi-expense-tracker")),o.createElement("th",null,q("Link","manfi-expense-tracker")),o.createElement("th",null,q("Actions","manfi-expense-tracker")))),o.createElement("tbody",null,Me.map(function(e){var t,n;return o.createElement("tr",{key:e.id},o.createElement("td",null,e.invoice_no),o.createElement("td",null,e.client_name),o.createElement("td",null,Tn(null!=e.amount_due?e.amount_due:(null===(t=e.totals)||void 0===t?void 0:t.grand_total)||0)),o.createElement("td",null,Tn(e.payment_received_amount||0)),o.createElement("td",null,Tn(null!==(n=e.balance_due)&&void 0!==n?n:0)),o.createElement("td",null,o.createElement("span",{className:"manfiet-pill manfiet-pill-".concat(e.status||"pending")},e.status||"pending")),o.createElement("td",null,o.createElement("a",{href:e.share_url,target:"_blank",rel:"noreferrer"},q("Open","manfi-expense-tracker"))),o.createElement("td",null,o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-primary manfiet-button-sm",onClick:function(){return Pe(e)}},q("Payment","manfi-expense-tracker")),o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-info manfiet-button-sm",onClick:function(){window.location.href=Wn("manfiet-invoice-create",e.id)}},q("Edit","manfi-expense-tracker")),o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-secondary manfiet-button-sm manfiet-ml-8",onClick:function(){return Ie(e.share_url)}},q("Copy","manfi-expense-tracker")),o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-danger manfiet-button-sm manfiet-ml-8",onClick:function(){return function(e){window.confirm(q("Delete this invoice?","manfi-expense-tracker"))&&wn("".concat(s,"invoices/").concat(e.id),{method:"DELETE"}).then(function(){B(q("Invoice deleted.","manfi-expense-tracker")),d.id===e.id&&ze(),Ae()}).catch(function(e){R(e.message||q("Failed to delete invoice.","manfi-expense-tracker"))})}(e)}},q("Delete","manfi-expense-tracker"))))})))))),H&&o.createElement("div",{className:"manfiet-modal-backdrop",role:"dialog","aria-modal":"true","aria-labelledby":"manfiet-payment-modal-title"},o.createElement("div",{className:"manfiet-modal manfiet-modal-lg"},o.createElement("h3",{className:"manfiet-modal-title",id:"manfiet-payment-modal-title"},q("Record Payment","manfi-expense-tracker")),o.createElement("p",{className:"manfiet-modal-text"},o.createElement("strong",null,H.invoice_no)," - ",H.client_name,o.createElement("br",null),q("Amount due:","manfi-expense-tracker")," ",o.createElement("strong",null,Tn(null!==(a=null!==(r=H.amount_due)&&void 0!==r?r:null===(i=H.totals)||void 0===i?void 0:i.grand_total)&&void 0!==a?a:0)),"  |  ",q("Already paid:","manfi-expense-tracker")," ",o.createElement("strong",null,Tn(H.payment_received_amount||0)),"  |  ",q("Balance:","manfi-expense-tracker")," ",o.createElement("strong",{style:{color:H.balance_due>0?"#d97706":"#16a34a"}},Tn(null!==(l=H.balance_due)&&void 0!==l?l:0))),ge&&o.createElement("p",{className:"manfiet-alert manfiet-alert-error"},ge),o.createElement("div",{className:"manfiet-card manfiet-card-inset manfiet-mb-14",style:{padding:"14px",background:"#f8fafc",borderRadius:"8px",border:"1px solid #e2e8f0"}},o.createElement("h4",{className:"manfiet-card-subtitle",style:{margin:"0 0 10px",fontSize:"15px"}},q("Add New Payment","manfi-expense-tracker")),o.createElement("div",{className:"manfiet-form-grid",style:{gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:"10px"}},o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-payment-amount"},q("Payment Amount (৳)","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-payment-amount",type:"number",min:"0",step:"0.01",className:"manfiet-input",value:X,onChange:function(e){return K(e.target.value)},placeholder:"0.00"})),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-payment-date"},q("Payment Date & Time","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-payment-date",type:"datetime-local",className:"manfiet-input",value:Z,onChange:function(e){return ee(e.target.value)}})),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-payment-method"},q("Payment Method","manfi-expense-tracker")),o.createElement("select",{id:"manfiet-payment-method",className:"manfiet-input",value:ne,onChange:function(e){return ae(e.target.value)}},o.createElement("option",{value:"bKash"},"bKash"),o.createElement("option",{value:"Nagad"},"Nagad"),o.createElement("option",{value:"Rocket"},"Rocket"),o.createElement("option",{value:"Bank Transfer"},"Bank Transfer"),o.createElement("option",{value:"Cash"},"Cash"),o.createElement("option",{value:"Card"},"Card"),o.createElement("option",{value:"Other"},"Other (Custom)"))),"Other"===ne&&o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-custom-method"},q("Custom Method","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-custom-method",type:"text",className:"manfiet-input",value:ie,onChange:function(e){return le(e.target.value)},placeholder:"e.g. Wallet, Check"})),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-transaction-id"},q("Transaction ID / Reference","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-transaction-id",type:"text",className:"manfiet-input",value:ce,onChange:function(e){return ue(e.target.value)},placeholder:"e.g. TRX123456"}))),o.createElement("div",{className:"manfiet-field manfiet-mt-8"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-payment-note"},q("Payment Note (Optional)","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-payment-note",type:"text",className:"manfiet-input",value:me,onChange:function(e){return fe(e.target.value)},placeholder:"Optional note"})),o.createElement("div",{className:"manfiet-mt-12",style:{textAlign:"right"}},o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-primary",onClick:function(){if(H){var e=Number(X||0);if(Number.isNaN(e)||e<=0)be(q("Enter a valid payment amount greater than zero.","manfi-expense-tracker"));else{var t="Other"===ne?ie:ne;ve(!0),wn("".concat(s,"invoices/").concat(H.id,"/payment"),{method:"POST",body:JSON.stringify({payment_amount:e,payment_date:Z,payment_method:t,transaction_id:ce,note:me})}).then(function(e){B(q("Payment recorded successfully.","manfi-expense-tracker")),Q(e),K(""),ue(""),fe(""),Ae()}).catch(function(e){be(e.message||q("Failed to update payment.","manfi-expense-tracker"))}).finally(function(){return ve(!1)})}}},disabled:pe},q(pe?"Saving...":"+ Save Payment","manfi-expense-tracker")))),H.payments&&H.payments.length>0&&o.createElement("div",{className:"manfiet-card manfiet-card-inset manfiet-mb-14",style:{padding:"14px",borderRadius:"8px",border:"1px solid #e2e8f0"}},o.createElement("h4",{className:"manfiet-card-subtitle",style:{margin:"0 0 10px",fontSize:"15px"}},q("Recorded Payments History","manfi-expense-tracker")),o.createElement("div",{className:"manfiet-table-responsive",style:{maxHeight:"220px",overflowY:"auto"}},o.createElement("table",{className:"manfiet-table manfiet-table-sm",style:{width:"100%",fontSize:"13px"}},o.createElement("thead",null,o.createElement("tr",null,o.createElement("th",null,q("Date & Time","manfi-expense-tracker")),o.createElement("th",null,q("Method","manfi-expense-tracker")),o.createElement("th",null,q("Trx ID","manfi-expense-tracker")),o.createElement("th",null,q("Amount","manfi-expense-tracker")),o.createElement("th",{style:{textAlign:"right"}},q("Action","manfi-expense-tracker")))),o.createElement("tbody",null,H.payments.map(function(e){return o.createElement("tr",{key:e.id},o.createElement("td",null,e.date||"-"),o.createElement("td",null,o.createElement("span",{className:"manfiet-badge",style:{background:"#e0f2fe",color:"#0369a1",padding:"2px 8px",borderRadius:"4px",fontSize:"12px",fontWeight:"500"}},e.method||"Default")),o.createElement("td",null,o.createElement("code",null,e.transaction_id||"-")),o.createElement("td",null,o.createElement("strong",null,Tn(e.amount))),o.createElement("td",{style:{textAlign:"right"}},o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-danger manfiet-button-sm",onClick:function(){return Oe(H.id,e.id)},disabled:pe},q("Delete","manfi-expense-tracker"))))}))))),o.createElement("div",{className:"manfiet-modal-actions manfiet-mt-16"},o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-secondary",onClick:function(){Q(null),K(""),ee($()),ae("bKash"),le(""),ue(""),fe(""),be("")},disabled:pe},q("Close","manfi-expense-tracker"))))))};function $n(e){return $n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$n(e)}function Gn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i,l,o=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(a=i.call(n)).done)&&(o.push(a.value),o.length!==t);c=!0);}catch(e){u=!0,r=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(u)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Hn(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Hn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Hn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}function Qn(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,n="function"==typeof Symbol?Symbol:{},a=n.iterator||"@@iterator",r=n.toStringTag||"@@toStringTag";function i(n,a,r,i){var c=a&&a.prototype instanceof o?a:o,u=Object.create(c.prototype);return Yn(u,"_invoke",function(n,a,r){var i,o,c,u=0,s=r||[],m=!1,f={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return i=t,o=0,c=e,f.n=n,l}};function d(n,a){for(o=n,c=a,t=0;!m&&u&&!r&&t<s.length;t++){var r,i=s[t],d=f.p,p=i[2];n>3?(r=p===a)&&(c=i[(o=i[4])?5:(o=3,3)],i[4]=i[5]=e):i[0]<=d&&((r=n<2&&d<i[1])?(o=0,f.v=a,f.n=i[1]):d<p&&(r=n<3||i[0]>a||a>p)&&(i[4]=n,i[5]=a,f.n=p,o=0))}if(r||n>1)return l;throw m=!0,a}return function(r,s,p){if(u>1)throw TypeError("Generator is already running");for(m&&1===s&&d(s,p),o=s,c=p;(t=o<2?e:c)||!m;){i||(o?o<3?(o>1&&(f.n=-1),d(o,c)):f.n=c:f.v=c);try{if(u=2,i){if(o||(r="next"),t=i[r]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,o<2&&(o=0)}else 1===o&&(t=i.return)&&t.call(i),o<2&&(c=TypeError("The iterator does not provide a '"+r+"' method"),o=1);i=e}else if((t=(m=f.n<0)?c:n.call(a,f))!==l)break}catch(t){i=e,o=1,c=t}finally{u=1}}return{value:t,done:m}}}(n,r,i),!0),u}var l={};function o(){}function c(){}function u(){}t=Object.getPrototypeOf;var s=[][a]?t(t([][a]())):(Yn(t={},a,function(){return this}),t),m=u.prototype=o.prototype=Object.create(s);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,Yn(e,r,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=u,Yn(m,"constructor",u),Yn(u,"constructor",c),c.displayName="GeneratorFunction",Yn(u,r,"GeneratorFunction"),Yn(m),Yn(m,r,"Generator"),Yn(m,a,function(){return this}),Yn(m,"toString",function(){return"[object Generator]"}),(Qn=function(){return{w:i,m:f}})()}function Yn(e,t,n,a){var r=Object.defineProperty;try{r({},"",{})}catch(e){r=0}Yn=function(e,t,n,a){function i(t,n){Yn(e,t,function(e){return this._invoke(t,n,e)})}t?r?r(e,t,{value:n,enumerable:!a,configurable:!a,writable:!a}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},Yn(e,t,n,a)}function qn(e,t,n,a,r,i,l){try{var o=e[i](l),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(a,r)}function Xn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,a)}return n}function Kn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Xn(Object(n),!0).forEach(function(t){Jn(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Jn(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=$n(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!=$n(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==$n(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Zn=window.manfietExpenseTrackerData||{},ea=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Kn({"Content-Type":"application/json"},t.headers||{});return Zn.restNonce&&(n["X-WP-Nonce"]=Zn.restNonce),fetch(e,Kn(Kn({credentials:"same-origin"},t),{},{headers:n})).then(function(){var e,t=(e=Qn().m(function e(t){var n;return Qn().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,t.json().catch(function(){return{}});case 1:if(n=e.v,t.ok){e.n=2;break}throw new Error(n.message||"Request failed");case 2:return e.a(2,n)}},e)}),function(){var t=this,n=arguments;return new Promise(function(a,r){var i=e.apply(t,n);function l(e){qn(i,a,r,l,o,"next",e)}function o(e){qn(i,a,r,l,o,"throw",e)}l(void 0)})});return function(e){return t.apply(this,arguments)}}())},ta=[{value:"bank",label:q("Bank","manfi-expense-tracker")},{value:"bkash",label:q("bKash","manfi-expense-tracker")},{value:"nagad",label:q("Nagad","manfi-expense-tracker")},{value:"rocket",label:q("Rocket","manfi-expense-tracker")},{value:"card",label:q("Card","manfi-expense-tracker")},{value:"other",label:q("Other","manfi-expense-tracker")}];const na=function(e){var t=e.mode,n=void 0===t?"dashboard":t,a=Zn.restBase||"/wp-json/manfi-expense-tracker/v1/",r="create"===n,i=Gn((0,o.useState)([]),2),l=i[0],c=i[1],u=Gn((0,o.useState)({id:null,account_type:"bank",provider_name:"",account_number:"",holder_name:"",routing_number:"",branch_name:"",note:"",is_default:!1}),2),s=u[0],m=u[1],f=Gn((0,o.useState)(null),2),d=f[0],p=f[1],v=Gn((0,o.useState)(!0),2),y=v[0],g=v[1],b=Gn((0,o.useState)(!1),2),h=b[0],E=b[1],x=Gn((0,o.useState)(""),2),k=x[0],w=x[1],_=Gn((0,o.useState)(""),2),N=_[0],S=_[1],C=function(){return g(!0),ea("".concat(a,"financial-accounts")).then(function(e){c(Array.isArray(e)?e:[]),w("")}).catch(function(e){w(e.message||q("Failed to load financial accounts.","manfi-expense-tracker"))}).finally(function(){return g(!1)})};(0,o.useEffect)(function(){C()},[a]);var P="".concat(window.location.pathname,"?page=manfiet-financial-accounts-create"),O="".concat(window.location.pathname,"?page=manfiet-financial-accounts"),j=new URLSearchParams(window.location.search).get("account_id")||"",T=function(e,t){m(function(n){return Kn(Kn({},n),{},Jn({},e,t))})},A=function(){m({id:null,account_type:"bank",provider_name:"",account_number:"",holder_name:"",routing_number:"",branch_name:"",note:"",is_default:!1}),p(null),S(""),w("")};(0,o.useEffect)(function(){if(r&&j&&!y&&0!==l.length){var e,t=l.find(function(e){return String(e.id)===String(j)});t&&d!==t.id&&(p((e=t).id),m({id:e.id,account_type:e.account_type||"bank",provider_name:e.provider_name||"",account_number:e.account_number||"",holder_name:e.holder_name||"",routing_number:e.routing_number||"",branch_name:e.branch_name||"",note:e.note||"",is_default:Boolean(e.is_default)}),S(q("Editing financial account","manfi-expense-tracker")),w(""),window.scrollTo({top:0,behavior:"smooth"}))}},[j,l,d,r,y]);return o.createElement("div",{className:"manfiet-page-shell manfiet-page-shell-wide manfiet-financial-accounts-shell"},o.createElement("div",{className:"manfiet-page-hero"},o.createElement("div",{className:"left-section"},o.createElement("h1",{className:"manfiet-page-title"},q(r?"Create Financial Account":"Financial Accounts","manfi-expense-tracker")),o.createElement("p",{className:"manfiet-page-subtitle"},q(r?"Add a new payout account for invoices.":"Store bank, bKash, Nagad, Rocket, card, and other payout accounts for reuse in invoices.","manfi-expense-tracker"))),o.createElement("div",{className:"manfiet-form-row manfiet-form-row-end manfiet-mt-12"},r?o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-secondary",onClick:function(){window.location.href=O}},q("Back to Financial Accounts","manfi-expense-tracker")):o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-primary",onClick:function(){window.location.href=P}},q("Create Financial Account","manfi-expense-tracker")))),r&&o.createElement("div",{className:"manfiet-card manfiet-mb-16"},o.createElement("h3",{className:"manfiet-card-title"},q(d?"Edit Account":"Add New Account","manfi-expense-tracker")),k&&o.createElement("p",{className:"manfiet-alert manfiet-alert-error"},k),N&&o.createElement("p",{className:"manfiet-alert manfiet-alert-success"},N),o.createElement("form",{onSubmit:function(e){e.preventDefault(),E(!0),w(""),S("");var t={account_type:s.account_type,provider_name:s.provider_name,account_number:s.account_number,holder_name:s.holder_name,routing_number:s.routing_number,branch_name:s.branch_name,note:s.note,is_default:s.is_default},n=d?"PUT":"POST",r=d?"".concat(a,"financial-accounts/").concat(d):"".concat(a,"financial-accounts");ea(r,{method:n,body:JSON.stringify(t)}).then(function(){S(q(d?"Financial account updated.":"Financial account created.","manfi-expense-tracker")),A(),C()}).catch(function(e){w(e.message||q("Failed to save financial account.","manfi-expense-tracker"))}).finally(function(){return E(!1)})},className:"manfiet-form-stack"},o.createElement("div",{className:"manfiet-form-grid"},o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-account-type"},q("Account Type","manfi-expense-tracker")),o.createElement("select",{id:"manfiet-account-type",className:"manfiet-input",value:s.account_type,onChange:function(e){return T("account_type",e.target.value)}},ta.map(function(e){return o.createElement("option",{key:e.value,value:e.value},e.label)}))),"bkash"===s.account_type||"nagad"===s.account_type||"rocket"===s.account_type?o.createElement(o.Fragment,null,o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-holder-name"},q("Holder Name","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-holder-name",className:"manfiet-input",value:s.holder_name,onChange:function(e){return T("holder_name",e.target.value)},placeholder:q("Account holder full name","manfi-expense-tracker")})),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-account-number"},q("Mobile Number","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-account-number",className:"manfiet-input",value:s.account_number,onChange:function(e){return T("account_number",e.target.value)},placeholder:q("e.g. 01XXXXXXXXX","manfi-expense-tracker")}))):o.createElement(o.Fragment,null,o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-provider-name"},q("Provider / Bank Name","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-provider-name",className:"manfiet-input",value:s.provider_name,onChange:function(e){return T("provider_name",e.target.value)},placeholder:q("Example: Prime Bank","manfi-expense-tracker")})),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-account-number"},q("Account / Number","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-account-number",className:"manfiet-input",value:s.account_number,onChange:function(e){return T("account_number",e.target.value)},placeholder:q("Account number, wallet number, or card number","manfi-expense-tracker")})),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-holder-name"},q("Holder Name","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-holder-name",className:"manfiet-input",value:s.holder_name,onChange:function(e){return T("holder_name",e.target.value)}})),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-routing-number"},q("Routing / Reference","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-routing-number",className:"manfiet-input",value:s.routing_number,onChange:function(e){return T("routing_number",e.target.value)}})),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-branch-name"},q("Branch","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-branch-name",className:"manfiet-input",value:s.branch_name,onChange:function(e){return T("branch_name",e.target.value)}})))),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-account-note"},q("Note","manfi-expense-tracker")),o.createElement("textarea",{id:"manfiet-account-note",className:"manfiet-input",rows:"3",value:s.note,onChange:function(e){return T("note",e.target.value)},placeholder:q("Optional note for invoice display or internal use","manfi-expense-tracker")})),o.createElement("label",{className:"manfiet-check-row"},o.createElement("input",{type:"checkbox",checked:s.is_default,onChange:function(e){return T("is_default",e.target.checked)}}),o.createElement("span",null,q("Mark as default account","manfi-expense-tracker"))),o.createElement("div",{className:"manfiet-form-row manfiet-form-row-end"},o.createElement("button",{type:"submit",className:"manfiet-button manfiet-button-primary",disabled:h},q(h?"Saving...":d?"Update Account":"Save Account","manfi-expense-tracker")),o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-secondary",onClick:A},q("Reset","manfi-expense-tracker"))))),!r&&o.createElement("div",{className:"manfiet-card"},o.createElement("div",{className:"manfiet-card-head-row manfiet-mb-14"},o.createElement("h3",{className:"manfiet-card-title manfiet-card-title-no-margin"},q("Saved Accounts","manfi-expense-tracker"))),y?o.createElement("p",null,q("Loading accounts...","manfi-expense-tracker")):0===l.length?o.createElement("p",{className:"manfiet-text-muted"},q("No financial accounts added yet.","manfi-expense-tracker")):o.createElement("div",{className:"manfiet-table-scroll"},o.createElement("table",{className:"manfiet-table"},o.createElement("thead",null,o.createElement("tr",null,o.createElement("th",null,q("Type","manfi-expense-tracker")),o.createElement("th",null,q("Provider","manfi-expense-tracker")),o.createElement("th",null,q("Number","manfi-expense-tracker")),o.createElement("th",null,q("Holder","manfi-expense-tracker")),o.createElement("th",null,q("Default","manfi-expense-tracker")),o.createElement("th",null,q("Actions","manfi-expense-tracker")))),o.createElement("tbody",null,l.map(function(e){return o.createElement("tr",{key:e.id},o.createElement("td",null,e.account_type),o.createElement("td",null,e.provider_name),o.createElement("td",null,e.account_number),o.createElement("td",null,e.holder_name||"-"),o.createElement("td",null,e.is_default?q("Yes","manfi-expense-tracker"):q("No","manfi-expense-tracker")),o.createElement("td",null,o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-info manfiet-button-sm",onClick:function(){window.location.href="".concat(P,"&account_id=").concat(e.id)}},q("Edit","manfi-expense-tracker")),o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-danger manfiet-button-sm manfiet-ml-8",onClick:function(){return t=e.id,void(window.confirm(q("Delete this financial account?","manfi-expense-tracker"))&&(E(!0),w(""),ea("".concat(a,"financial-accounts/").concat(t),{method:"DELETE"}).then(function(){S(q("Financial account deleted.","manfi-expense-tracker")),C(),d===t&&A()}).catch(function(e){w(e.message||q("Failed to delete financial account.","manfi-expense-tracker"))}).finally(function(){return E(!1)})));var t},disabled:h},q("Delete","manfi-expense-tracker"))))}))))))};function aa(e){return aa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},aa(e)}function ra(e){return function(e){if(Array.isArray(e))return oa(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||la(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ia(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i,l,o=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(a=i.call(n)).done)&&(o.push(a.value),o.length!==t);c=!0);}catch(e){u=!0,r=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(u)throw r}}return o}}(e,t)||la(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function la(e,t){if(e){if("string"==typeof e)return oa(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?oa(e,t):void 0}}function oa(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}function ca(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,n="function"==typeof Symbol?Symbol:{},a=n.iterator||"@@iterator",r=n.toStringTag||"@@toStringTag";function i(n,a,r,i){var c=a&&a.prototype instanceof o?a:o,u=Object.create(c.prototype);return ua(u,"_invoke",function(n,a,r){var i,o,c,u=0,s=r||[],m=!1,f={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return i=t,o=0,c=e,f.n=n,l}};function d(n,a){for(o=n,c=a,t=0;!m&&u&&!r&&t<s.length;t++){var r,i=s[t],d=f.p,p=i[2];n>3?(r=p===a)&&(c=i[(o=i[4])?5:(o=3,3)],i[4]=i[5]=e):i[0]<=d&&((r=n<2&&d<i[1])?(o=0,f.v=a,f.n=i[1]):d<p&&(r=n<3||i[0]>a||a>p)&&(i[4]=n,i[5]=a,f.n=p,o=0))}if(r||n>1)return l;throw m=!0,a}return function(r,s,p){if(u>1)throw TypeError("Generator is already running");for(m&&1===s&&d(s,p),o=s,c=p;(t=o<2?e:c)||!m;){i||(o?o<3?(o>1&&(f.n=-1),d(o,c)):f.n=c:f.v=c);try{if(u=2,i){if(o||(r="next"),t=i[r]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,o<2&&(o=0)}else 1===o&&(t=i.return)&&t.call(i),o<2&&(c=TypeError("The iterator does not provide a '"+r+"' method"),o=1);i=e}else if((t=(m=f.n<0)?c:n.call(a,f))!==l)break}catch(t){i=e,o=1,c=t}finally{u=1}}return{value:t,done:m}}}(n,r,i),!0),u}var l={};function o(){}function c(){}function u(){}t=Object.getPrototypeOf;var s=[][a]?t(t([][a]())):(ua(t={},a,function(){return this}),t),m=u.prototype=o.prototype=Object.create(s);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,ua(e,r,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=u,ua(m,"constructor",u),ua(u,"constructor",c),c.displayName="GeneratorFunction",ua(u,r,"GeneratorFunction"),ua(m),ua(m,r,"Generator"),ua(m,a,function(){return this}),ua(m,"toString",function(){return"[object Generator]"}),(ca=function(){return{w:i,m:f}})()}function ua(e,t,n,a){var r=Object.defineProperty;try{r({},"",{})}catch(e){r=0}ua=function(e,t,n,a){function i(t,n){ua(e,t,function(e){return this._invoke(t,n,e)})}t?r?r(e,t,{value:n,enumerable:!a,configurable:!a,writable:!a}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},ua(e,t,n,a)}function sa(e,t,n,a,r,i,l){try{var o=e[i](l),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(a,r)}function ma(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,a)}return n}function fa(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ma(Object(n),!0).forEach(function(t){da(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ma(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function da(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=aa(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!=aa(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==aa(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var pa=window.manfietExpenseTrackerData||{},va=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=fa({"Content-Type":"application/json"},t.headers||{});return pa.restNonce&&(n["X-WP-Nonce"]=pa.restNonce),fetch(e,fa(fa({credentials:"same-origin"},t),{},{headers:n})).then(function(){var e,t=(e=ca().m(function e(t){var n;return ca().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,t.json().catch(function(){return{}});case 1:if(n=e.v,t.ok){e.n=2;break}throw new Error(n.message||"Request failed");case 2:return e.a(2,n)}},e)}),function(){var t=this,n=arguments;return new Promise(function(a,r){var i=e.apply(t,n);function l(e){sa(i,a,r,l,o,"next",e)}function o(e){sa(i,a,r,l,o,"throw",e)}l(void 0)})});return function(e){return t.apply(this,arguments)}}())},ya=function(e){if(!e)return[""];if(Array.isArray(e))return e.length?e:[""];var t=String(e).split(/[\r\n,]+/).map(function(e){return e.trim()}).filter(Boolean);return t.length?t:[""]};const ga=function(e){var t=e.mode,n=void 0===t?"dashboard":t,a=pa.restBase||"/wp-json/manfi-expense-tracker/v1/",r="create"===n,i=ia((0,o.useState)([]),2),l=i[0],c=i[1],u=ia((0,o.useState)({id:null,company_name:"",phones:[""],emails:[""],websites:[""],address:"",logos:[""],tagline:""}),2),s=u[0],m=u[1],f=ia((0,o.useState)(null),2),d=f[0],p=f[1],v=ia((0,o.useState)(!0),2),y=v[0],g=v[1],b=ia((0,o.useState)(!1),2),h=b[0],E=b[1],x=ia((0,o.useState)(""),2),k=x[0],w=x[1],_=ia((0,o.useState)(""),2),N=_[0],S=_[1],C=ia((0,o.useState)(null),2),P=C[0],O=C[1],j=function(){return g(!0),va("".concat(a,"vendors")).then(function(e){c(Array.isArray(e)?e:[]),w("")}).catch(function(e){w(e.message||q("Failed to load vendors.","manfi-expense-tracker"))}).finally(function(){return g(!1)})};(0,o.useEffect)(function(){j()},[a]);var T="".concat(window.location.pathname,"?page=manfiet-vendors-create"),A="".concat(window.location.pathname,"?page=manfiet-vendors"),D=new URLSearchParams(window.location.search).get("vendor_id")||"",F=function(e,t){m(function(n){return fa(fa({},n),{},da({},e,t))})},L=function(e,t){return m(function(n){return fa(fa({},n),{},{logos:n.logos.map(function(n,a){return a===e?t:n})})})},z=function(){m({id:null,company_name:"",phones:[""],emails:[""],websites:[""],address:"",logos:[""],tagline:""}),p(null),S(""),w("")},R=function(e){p(e.id),m({id:e.id,company_name:e.company_name||"",phones:ya(e.phone),emails:ya(e.email),websites:ya(e.website_url),address:e.address||"",logos:ya(e.logo_url),tagline:e.tagline||""}),S(q("Editing vendor","manfi-expense-tracker")),w(""),window.scrollTo({top:0,behavior:"smooth"})};(0,o.useEffect)(function(){if(r&&D&&!y&&0!==l.length){var e=l.find(function(e){return String(e.id)===String(D)});e&&d!==e.id&&R(e)}},[d,r,y,D,l]);return o.createElement("div",{className:"manfiet-wrap"},o.createElement("div",{className:"manfiet-header",style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"24px"}},o.createElement("div",null,o.createElement("h1",{className:"manfiet-title"},q(r?"Create Vendor":"Vendor Manager","manfi-expense-tracker")),o.createElement("p",{className:"manfiet-subtitle"},q("Manage vendor / agency profiles used in invoices. Add cloneable partner logos, phone numbers, emails & websites for joint collaborations.","manfi-expense-tracker"))),r?o.createElement("a",{href:A,className:"manfiet-button manfiet-button-secondary"},q("Back to Vendors","manfi-expense-tracker")):o.createElement("a",{href:T,className:"manfiet-button manfiet-button-primary"},"+ ",q("Create Vendor","manfi-expense-tracker"))),k&&o.createElement("div",{className:"manfiet-alert manfiet-alert-error",style:{marginBottom:"16px"}},k),N&&o.createElement("div",{className:"manfiet-alert manfiet-alert-success",style:{marginBottom:"16px"}},N),r&&o.createElement("div",{className:"manfiet-card",style:{marginBottom:"24px"}},o.createElement("h3",{className:"manfiet-card-title"},q(d?"Edit Vendor":"Add New Vendor","manfi-expense-tracker")),o.createElement("form",{onSubmit:function(e){if(e.preventDefault(),E(!0),w(""),S(""),!s.company_name.trim())return w(q("Company name is required.","manfi-expense-tracker")),void E(!1);var t={company_name:s.company_name.trim(),phone:s.phones.map(function(e){return e.trim()}).filter(Boolean).join(", "),email:s.emails.map(function(e){return e.trim()}).filter(Boolean).join(", "),website_url:s.websites.map(function(e){return e.trim()}).filter(Boolean).join(", "),address:s.address.trim(),logo_url:s.logos.map(function(e){return e.trim()}).filter(Boolean).join(", "),tagline:s.tagline.trim()},n=Boolean(d),r=n?"".concat(a,"vendors/").concat(d):"".concat(a,"vendors");va(r,{method:n?"PUT":"POST",body:JSON.stringify(t)}).then(function(e){S(q(n?"Vendor updated successfully.":"Vendor created successfully.","manfi-expense-tracker")),j(),n?R(e):z()}).catch(function(e){w(e.message||q("Failed to save vendor.","manfi-expense-tracker"))}).finally(function(){return E(!1)})},className:"manfiet-form"},o.createElement("div",{className:"manfiet-field",style:{marginBottom:"20px"}},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-company-name"},q("Company / Joint Agency Name","manfi-expense-tracker")," ",o.createElement("span",{style:{color:"#dc2626"}},"*")),o.createElement("input",{id:"manfiet-company-name",className:"manfiet-input",value:s.company_name,onChange:function(e){return F("company_name",e.target.value)},placeholder:q("e.g. Digital Agency Ltd","manfi-expense-tracker"),required:!0})),o.createElement("div",{className:"manfiet-card manfiet-card-inset",style:{marginBottom:"20px",background:"#fafafa",border:"1px solid #e2e8f0",padding:"16px",borderRadius:"8px"}},o.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"12px"}},o.createElement("label",{className:"manfiet-label",style:{margin:0,fontWeight:"600",color:"#1e293b"}},"📞 ",q("Phone Numbers (Cloneable)","manfi-expense-tracker")),o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-secondary",style:{padding:"4px 12px",fontSize:"13px",display:"flex",alignItems:"center",gap:"4px"},onClick:function(){return m(function(e){return fa(fa({},e),{},{phones:[].concat(ra(e.phones),[""])})})}},"+ ",q("Add Another Phone","manfi-expense-tracker"))),s.phones.map(function(e,t){return o.createElement("div",{key:t,style:{display:"flex",gap:"8px",marginBottom:"8px"}},o.createElement("input",{className:"manfiet-input",value:e,onChange:function(e){return n=t,a=e.target.value,m(function(e){return fa(fa({},e),{},{phones:e.phones.map(function(e,t){return t===n?a:e})})});var n,a},placeholder:q("Phone ".concat(t+1," (e.g. +1 555-0199)"),"manfi-expense-tracker")}),s.phones.length>1&&o.createElement("button",{type:"button",onClick:function(){return e=t,m(function(t){return fa(fa({},t),{},{phones:t.phones.filter(function(t,n){return n!==e})})});var e},style:{background:"#fee2e2",color:"#b91c1c",border:"1px solid #fca5a5",padding:"0 14px",borderRadius:"6px",cursor:"pointer",fontWeight:"bold"},title:q("Remove phone","manfi-expense-tracker")},"✕"))})),o.createElement("div",{className:"manfiet-card manfiet-card-inset",style:{marginBottom:"20px",background:"#fafafa",border:"1px solid #e2e8f0",padding:"16px",borderRadius:"8px"}},o.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"12px"}},o.createElement("label",{className:"manfiet-label",style:{margin:0,fontWeight:"600",color:"#1e293b"}},"✉️ ",q("Email Addresses (Cloneable)","manfi-expense-tracker")),o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-secondary",style:{padding:"4px 12px",fontSize:"13px",display:"flex",alignItems:"center",gap:"4px"},onClick:function(){return m(function(e){return fa(fa({},e),{},{emails:[].concat(ra(e.emails),[""])})})}},"+ ",q("Add Another Email","manfi-expense-tracker"))),s.emails.map(function(e,t){return o.createElement("div",{key:t,style:{display:"flex",gap:"8px",marginBottom:"8px"}},o.createElement("input",{className:"manfiet-input",type:"email",value:e,onChange:function(e){return n=t,a=e.target.value,m(function(e){return fa(fa({},e),{},{emails:e.emails.map(function(e,t){return t===n?a:e})})});var n,a},placeholder:q("Email ".concat(t+1," (e.g. contact@example.com)"),"manfi-expense-tracker")}),s.emails.length>1&&o.createElement("button",{type:"button",onClick:function(){return e=t,m(function(t){return fa(fa({},t),{},{emails:t.emails.filter(function(t,n){return n!==e})})});var e},style:{background:"#fee2e2",color:"#b91c1c",border:"1px solid #fca5a5",padding:"0 14px",borderRadius:"6px",cursor:"pointer",fontWeight:"bold"},title:q("Remove email","manfi-expense-tracker")},"✕"))})),o.createElement("div",{className:"manfiet-card manfiet-card-inset",style:{marginBottom:"20px",background:"#fafafa",border:"1px solid #e2e8f0",padding:"16px",borderRadius:"8px"}},o.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"12px"}},o.createElement("label",{className:"manfiet-label",style:{margin:0,fontWeight:"600",color:"#1e293b"}},"🌐 ",q("Website URLs (Cloneable)","manfi-expense-tracker")),o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-secondary",style:{padding:"4px 12px",fontSize:"13px",display:"flex",alignItems:"center",gap:"4px"},onClick:function(){return m(function(e){return fa(fa({},e),{},{websites:[].concat(ra(e.websites),[""])})})}},"+ ",q("Add Another Website","manfi-expense-tracker"))),s.websites.map(function(e,t){return o.createElement("div",{key:t,style:{display:"flex",gap:"8px",marginBottom:"8px"}},o.createElement("input",{className:"manfiet-input",type:"url",value:e,onChange:function(e){return n=t,a=e.target.value,m(function(e){return fa(fa({},e),{},{websites:e.websites.map(function(e,t){return t===n?a:e})})});var n,a},placeholder:q("Website ".concat(t+1," (e.g. https://example.com)"),"manfi-expense-tracker")}),s.websites.length>1&&o.createElement("button",{type:"button",onClick:function(){return e=t,m(function(t){return fa(fa({},t),{},{websites:t.websites.filter(function(t,n){return n!==e})})});var e},style:{background:"#fee2e2",color:"#b91c1c",border:"1px solid #fca5a5",padding:"0 14px",borderRadius:"6px",cursor:"pointer",fontWeight:"bold"},title:q("Remove website","manfi-expense-tracker")},"✕"))})),o.createElement("div",{className:"manfiet-field",style:{marginBottom:"20px"}},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-address"},q("Address (Multi-line / Joint Offices)","manfi-expense-tracker")),o.createElement("textarea",{id:"manfiet-address",className:"manfiet-input",rows:"3",value:s.address,onChange:function(e){return F("address",e.target.value)},placeholder:q("123 Business Street, Suite 100, City, Country","manfi-expense-tracker")})),o.createElement("div",{className:"manfiet-field",style:{marginBottom:"20px"}},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-tagline"},q("Tagline / Slogan","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-tagline",className:"manfiet-input",value:s.tagline,onChange:function(e){return F("tagline",e.target.value)},placeholder:q("e.g. Delivering Quality Services","manfi-expense-tracker")})),o.createElement("div",{className:"manfiet-card manfiet-card-inset",style:{marginBottom:"24px",background:"#f8fafc",border:"1px solid #cbd5e1",padding:"16px",borderRadius:"8px"}},o.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px"}},o.createElement("div",null,o.createElement("h4",{className:"manfiet-card-subtitle",style:{margin:0,fontSize:"15px",color:"#0f172a"}},"🖼️ ",q("Company / Partner Logos (Cloneable)","manfi-expense-tracker")),o.createElement("p",{style:{fontSize:"12px",color:"#64748b",margin:"4px 0 0 0"}},q("Add logo slots for joint agency partners. Upload images directly or enter image URLs.","manfi-expense-tracker"))),o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-secondary",style:{padding:"6px 14px",fontSize:"13px",display:"flex",alignItems:"center",gap:"4px"},onClick:function(){return m(function(e){return fa(fa({},e),{},{logos:[].concat(ra(e.logos),[""])})})}},"+ ",q("Add Partner Logo Slot","manfi-expense-tracker"))),s.logos.map(function(e,t){return o.createElement("div",{key:t,style:{padding:"14px",background:"#ffffff",border:"1px solid #e2e8f0",borderRadius:"8px",marginBottom:"12px",boxShadow:"0 1px 3px rgba(0,0,0,0.04)"}},o.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"}},o.createElement("span",{style:{fontWeight:"600",fontSize:"13px",color:"#334155"}},q("Logo Slot #".concat(t+1),"manfi-expense-tracker")),s.logos.length>1&&o.createElement("button",{type:"button",onClick:function(){return e=t,m(function(t){return fa(fa({},t),{},{logos:t.logos.filter(function(t,n){return n!==e})})});var e},style:{background:"#fee2e2",color:"#b91c1c",border:"1px solid #fca5a5",padding:"2px 10px",borderRadius:"4px",fontSize:"12px",cursor:"pointer",fontWeight:"500"}},q("Remove Slot","manfi-expense-tracker"))),o.createElement("div",{style:{display:"flex",gap:"10px",alignItems:"center"}},o.createElement("input",{className:"manfiet-input",value:e,onChange:function(e){return L(t,e.target.value)},placeholder:q("Enter logo URL or upload image on right...","manfi-expense-tracker"),style:{flex:1}}),o.createElement("label",{style:{background:"#2563eb",color:"#ffffff",padding:"9px 14px",borderRadius:"6px",cursor:"pointer",fontSize:"13px",fontWeight:"500",whiteSpace:"nowrap",display:"inline-block"}},q(P===t?"Uploading...":"📤 Upload Logo","manfi-expense-tracker"),o.createElement("input",{type:"file",accept:"image/*",style:{display:"none"},onChange:function(e){return function(e,t){var n,a=null===(n=t.target.files)||void 0===n?void 0:n[0];if(a){O(e);var r=new FormData;r.append("file",a),fetch("/wp-json/wp/v2/media",{method:"POST",body:r,headers:pa.restNonce?{"X-WP-Nonce":pa.restNonce}:{},credentials:"same-origin"}).then(function(e){return e.json()}).then(function(t){if(!t.source_url)throw new Error(q("Upload failed: no URL returned","manfi-expense-tracker"));L(e,t.source_url),S(q("Logo uploaded successfully.","manfi-expense-tracker"))}).catch(function(e){w(e.message||q("Failed to upload logo.","manfi-expense-tracker"))}).finally(function(){return O(null)})}}(t,e)},disabled:P===t}))),e&&o.createElement("div",{style:{marginTop:"10px",padding:"8px 12px",background:"#f8fafc",border:"1px solid #e2e8f0",borderRadius:"6px",display:"flex",alignItems:"center",gap:"12px"}},o.createElement("img",{src:e,alt:"Logo slot ".concat(t+1),style:{maxHeight:"50px",width:"auto",borderRadius:"4px",border:"1px solid #cbd5e1",padding:"2px",background:"#fff"}}),o.createElement("span",{style:{fontSize:"11px",color:"#64748b",wordBreak:"break-all"}},e)))})),o.createElement("div",{className:"manfiet-form-row manfiet-form-row-end"},o.createElement("button",{type:"submit",className:"manfiet-button manfiet-button-primary",disabled:h},q(h?"Saving...":d?"Update Vendor":"Save Vendor","manfi-expense-tracker")),o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-secondary",onClick:z},q("Reset","manfi-expense-tracker"))))),!r&&o.createElement("div",{className:"manfiet-card"},o.createElement("div",{className:"manfiet-card-head-row manfiet-mb-14"},o.createElement("h3",{className:"manfiet-card-title manfiet-card-title-no-margin"},q("Saved Vendors","manfi-expense-tracker"))),y?o.createElement("p",null,q("Loading vendors...","manfi-expense-tracker")):0===l.length?o.createElement("p",{className:"manfiet-text-muted"},q("No vendors added yet.","manfi-expense-tracker")):o.createElement("div",{className:"manfiet-table-scroll"},o.createElement("table",{className:"manfiet-table"},o.createElement("thead",null,o.createElement("tr",null,o.createElement("th",null,q("Company","manfi-expense-tracker")),o.createElement("th",null,q("Phone","manfi-expense-tracker")),o.createElement("th",null,q("Email","manfi-expense-tracker")),o.createElement("th",null,q("Tagline","manfi-expense-tracker")),o.createElement("th",null,q("Actions","manfi-expense-tracker")))),o.createElement("tbody",null,l.map(function(e){return o.createElement("tr",{key:e.id},o.createElement("td",null,e.company_name),o.createElement("td",null,e.phone||"-"),o.createElement("td",null,e.email||"-"),o.createElement("td",null,e.tagline||"-"),o.createElement("td",null,o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-info manfiet-button-sm",onClick:function(){window.location.href="".concat(T,"&vendor_id=").concat(e.id)}},q("Edit","manfi-expense-tracker")),o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-danger manfiet-button-sm manfiet-ml-8",onClick:function(){return t=e.id,void(window.confirm(q("Delete this vendor?","manfi-expense-tracker"))&&(E(!0),w(""),va("".concat(a,"vendors/").concat(t),{method:"DELETE"}).then(function(){S(q("Vendor deleted.","manfi-expense-tracker")),j(),d===t&&z()}).catch(function(e){w(e.message||q("Failed to delete vendor.","manfi-expense-tracker"))}).finally(function(){return E(!1)})));var t},disabled:h},q("Delete","manfi-expense-tracker"))))}))))))};function ba(e){return ba="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ba(e)}function ha(e){return function(e){if(Array.isArray(e))return ka(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||xa(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ea(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i,l,o=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(a=i.call(n)).done)&&(o.push(a.value),o.length!==t);c=!0);}catch(e){u=!0,r=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(u)throw r}}return o}}(e,t)||xa(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function xa(e,t){if(e){if("string"==typeof e)return ka(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ka(e,t):void 0}}function ka(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}function wa(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,n="function"==typeof Symbol?Symbol:{},a=n.iterator||"@@iterator",r=n.toStringTag||"@@toStringTag";function i(n,a,r,i){var c=a&&a.prototype instanceof o?a:o,u=Object.create(c.prototype);return _a(u,"_invoke",function(n,a,r){var i,o,c,u=0,s=r||[],m=!1,f={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return i=t,o=0,c=e,f.n=n,l}};function d(n,a){for(o=n,c=a,t=0;!m&&u&&!r&&t<s.length;t++){var r,i=s[t],d=f.p,p=i[2];n>3?(r=p===a)&&(c=i[(o=i[4])?5:(o=3,3)],i[4]=i[5]=e):i[0]<=d&&((r=n<2&&d<i[1])?(o=0,f.v=a,f.n=i[1]):d<p&&(r=n<3||i[0]>a||a>p)&&(i[4]=n,i[5]=a,f.n=p,o=0))}if(r||n>1)return l;throw m=!0,a}return function(r,s,p){if(u>1)throw TypeError("Generator is already running");for(m&&1===s&&d(s,p),o=s,c=p;(t=o<2?e:c)||!m;){i||(o?o<3?(o>1&&(f.n=-1),d(o,c)):f.n=c:f.v=c);try{if(u=2,i){if(o||(r="next"),t=i[r]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,o<2&&(o=0)}else 1===o&&(t=i.return)&&t.call(i),o<2&&(c=TypeError("The iterator does not provide a '"+r+"' method"),o=1);i=e}else if((t=(m=f.n<0)?c:n.call(a,f))!==l)break}catch(t){i=e,o=1,c=t}finally{u=1}}return{value:t,done:m}}}(n,r,i),!0),u}var l={};function o(){}function c(){}function u(){}t=Object.getPrototypeOf;var s=[][a]?t(t([][a]())):(_a(t={},a,function(){return this}),t),m=u.prototype=o.prototype=Object.create(s);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,_a(e,r,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=u,_a(m,"constructor",u),_a(u,"constructor",c),c.displayName="GeneratorFunction",_a(u,r,"GeneratorFunction"),_a(m),_a(m,r,"Generator"),_a(m,a,function(){return this}),_a(m,"toString",function(){return"[object Generator]"}),(wa=function(){return{w:i,m:f}})()}function _a(e,t,n,a){var r=Object.defineProperty;try{r({},"",{})}catch(e){r=0}_a=function(e,t,n,a){function i(t,n){_a(e,t,function(e){return this._invoke(t,n,e)})}t?r?r(e,t,{value:n,enumerable:!a,configurable:!a,writable:!a}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},_a(e,t,n,a)}function Na(e,t,n,a,r,i,l){try{var o=e[i](l),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(a,r)}function Sa(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,a)}return n}function Ca(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Sa(Object(n),!0).forEach(function(t){Pa(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Sa(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Pa(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=ba(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!=ba(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==ba(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Oa=window.manfietExpenseTrackerData||{},ja=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Ca({"Content-Type":"application/json"},t.headers||{});return Oa.restNonce&&(n["X-WP-Nonce"]=Oa.restNonce),fetch(e,Ca(Ca({credentials:"same-origin"},t),{},{headers:n})).then(function(){var e,t=(e=wa().m(function e(t){var n;return wa().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,t.json().catch(function(){return{}});case 1:if(n=e.v,t.ok){e.n=2;break}throw new Error(n.message||"Request failed");case 2:return e.a(2,n)}},e)}),function(){var t=this,n=arguments;return new Promise(function(a,r){var i=e.apply(t,n);function l(e){Na(i,a,r,l,o,"next",e)}function o(e){Na(i,a,r,l,o,"throw",e)}l(void 0)})});return function(e){return t.apply(this,arguments)}}())},Ta=function(e){var t=(e||[]).filter(Boolean);return t.length>0?t.join(", "):"-"};const Aa=function(e){var t=e.mode,n=void 0===t?"dashboard":t,a=Oa.restBase||"/wp-json/manfi-expense-tracker/v1/",r="create"===n,i=Ea((0,o.useState)([]),2),l=i[0],c=i[1],u=Ea((0,o.useState)({id:null,client_name:"",contact_person:"",phones:[""],emails:[""],address:""}),2),s=u[0],m=u[1],f=Ea((0,o.useState)(null),2),d=f[0],p=f[1],v=Ea((0,o.useState)(!0),2),y=v[0],g=v[1],b=Ea((0,o.useState)(!1),2),h=b[0],E=b[1],x=Ea((0,o.useState)(""),2),k=x[0],w=x[1],_=Ea((0,o.useState)(""),2),N=_[0],S=_[1],C=function(){return g(!0),ja("".concat(a,"clients")).then(function(e){c(Array.isArray(e)?e:[]),w("")}).catch(function(e){w(e.message||q("Failed to load clients.","manfi-expense-tracker"))}).finally(function(){return g(!1)})};(0,o.useEffect)(function(){C()},[a]);var P="".concat(window.location.pathname,"?page=manfiet-clients-create"),O="".concat(window.location.pathname,"?page=manfiet-clients"),j=new URLSearchParams(window.location.search).get("client_id")||"",T=function(e,t){m(function(n){return Ca(Ca({},n),{},Pa({},e,t))})},A=function(){m({id:null,client_name:"",contact_person:"",phones:[""],emails:[""],address:""}),p(null),S(""),w("")};(0,o.useEffect)(function(){if(r&&j&&!y&&0!==l.length){var e=l.find(function(e){return String(e.id)===String(j)});e&&d!==e.id&&function(e){p(e.id);var t=Array.isArray(e.phones)&&e.phones.length>0?e.phones:e.phone?[e.phone]:[""],n=[];Array.isArray(e.emails)&&e.emails.length>0?n=e.emails:(e.email&&n.push(e.email),e.email2&&n.push(e.email2)),0===n.length&&(n=[""]),m({id:e.id,client_name:e.client_name||"",contact_person:e.contact_person||"",phones:t,emails:n,address:e.address||""}),S(q("Editing client","manfi-expense-tracker")),w(""),window.scrollTo({top:0,behavior:"smooth"})}(e)}},[j,l,d,r,y]);return o.createElement("div",{className:"manfiet-page-shell manfiet-page-shell-wide manfiet-clients-shell"},o.createElement("div",{className:"manfiet-page-hero"},o.createElement("div",{className:"left-section"},o.createElement("h1",{className:"manfiet-page-title"},q(r?"Create Client":"Clients","manfi-expense-tracker")),o.createElement("p",{className:"manfiet-page-subtitle"},q(r?"Add a client record for reuse in invoices.":"Store your customer or client information for reuse in invoices.","manfi-expense-tracker"))),o.createElement("div",{className:"manfiet-form-row manfiet-form-row-end manfiet-mt-12"},r?o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-secondary",onClick:function(){window.location.href=O}},q("Back to Clients","manfi-expense-tracker")):o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-primary",onClick:function(){window.location.href=P}},q("Create Client","manfi-expense-tracker")))),r&&o.createElement("div",{className:"manfiet-card manfiet-mb-16"},o.createElement("h3",{className:"manfiet-card-title"},q(d?"Edit Client":"Add New Client","manfi-expense-tracker")),k&&o.createElement("p",{className:"manfiet-alert manfiet-alert-error"},k),N&&o.createElement("p",{className:"manfiet-alert manfiet-alert-success"},N),o.createElement("form",{onSubmit:function(e){if(e.preventDefault(),E(!0),w(""),S(""),!s.client_name.trim())return w(q("Client/Company name is required.","manfi-expense-tracker")),void E(!1);var t=s.phones.map(function(e){return e.trim()}).filter(Boolean),n=s.emails.map(function(e){return e.trim()}).filter(Boolean),r={client_name:s.client_name.trim(),contact_person:s.contact_person.trim(),phones:t,emails:n,phone:t[0]||"",email:n[0]||"",email2:n[1]||"",address:s.address.trim()},i=d?"PUT":"POST",l=d?"".concat(a,"clients/").concat(d):"".concat(a,"clients");ja(l,{method:i,body:JSON.stringify(r)}).then(function(){S(q(d?"Client updated.":"Client created.","manfi-expense-tracker")),A(),C()}).catch(function(e){w(e.message||q("Failed to save client.","manfi-expense-tracker"))}).finally(function(){return E(!1)})},className:"manfiet-form-stack"},o.createElement("div",{className:"manfiet-form-grid"},o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-client-name"},q("Client / Company Name","manfi-expense-tracker")," ",o.createElement("span",{className:"manfiet-required"},"*")),o.createElement("input",{id:"manfiet-client-name",className:"manfiet-input",value:s.client_name,onChange:function(e){return T("client_name",e.target.value)},placeholder:q("e.g. Acme Corporation","manfi-expense-tracker"),required:!0})),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-contact-person"},q("Contact Person Name","manfi-expense-tracker")),o.createElement("input",{id:"manfiet-contact-person",className:"manfiet-input",value:s.contact_person,onChange:function(e){return T("contact_person",e.target.value)},placeholder:q("e.g. John Doe","manfi-expense-tracker")}))),o.createElement("div",{className:"manfiet-card manfiet-card-inset manfiet-mb-14"},o.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"}},o.createElement("label",{className:"manfiet-label",style:{margin:0,fontWeight:"600"}},q("Phone Number(s)","manfi-expense-tracker")),o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-secondary manfiet-button-sm",onClick:function(){m(function(e){return Ca(Ca({},e),{},{phones:[].concat(ha(e.phones),[""])})})}},"+ ",q("Add Phone","manfi-expense-tracker"))),o.createElement("div",{className:"manfiet-form-stack"},s.phones.map(function(e,t){return o.createElement("div",{key:"phone-".concat(t),style:{display:"flex",gap:"8px",alignItems:"center"}},o.createElement("input",{className:"manfiet-input",style:{flex:1},value:e,onChange:function(e){return n=t,a=e.target.value,void m(function(e){var t=ha(e.phones);return t[n]=a,Ca(Ca({},e),{},{phones:t})});var n,a},placeholder:q("e.g. +1 555-0199","manfi-expense-tracker")}),s.phones.length>1&&o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-danger manfiet-button-sm",onClick:function(){return e=t,void m(function(t){return Ca(Ca({},t),{},{phones:t.phones.length>1?t.phones.filter(function(t,n){return n!==e}):[""]})});var e}},q("Remove","manfi-expense-tracker")))}))),o.createElement("div",{className:"manfiet-card manfiet-card-inset manfiet-mb-14"},o.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"}},o.createElement("label",{className:"manfiet-label",style:{margin:0,fontWeight:"600"}},q("Email Address(es)","manfi-expense-tracker")),o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-secondary manfiet-button-sm",onClick:function(){m(function(e){return Ca(Ca({},e),{},{emails:[].concat(ha(e.emails),[""])})})}},"+ ",q("Add Email","manfi-expense-tracker"))),o.createElement("div",{className:"manfiet-form-stack"},s.emails.map(function(e,t){return o.createElement("div",{key:"email-".concat(t),style:{display:"flex",gap:"8px",alignItems:"center"}},o.createElement("input",{className:"manfiet-input",type:"email",style:{flex:1},value:e,onChange:function(e){return n=t,a=e.target.value,void m(function(e){var t=ha(e.emails);return t[n]=a,Ca(Ca({},e),{},{emails:t})});var n,a},placeholder:q("client@example.com","manfi-expense-tracker")}),s.emails.length>1&&o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-danger manfiet-button-sm",onClick:function(){return e=t,void m(function(t){return Ca(Ca({},t),{},{emails:t.emails.length>1?t.emails.filter(function(t,n){return n!==e}):[""]})});var e}},q("Remove","manfi-expense-tracker")))}))),o.createElement("div",{className:"manfiet-field"},o.createElement("label",{className:"manfiet-label",htmlFor:"manfiet-address"},q("Address","manfi-expense-tracker")),o.createElement("textarea",{id:"manfiet-address",className:"manfiet-input",rows:"3",value:s.address,onChange:function(e){return T("address",e.target.value)},placeholder:q("Street address, city, state, postal code","manfi-expense-tracker")})),o.createElement("div",{className:"manfiet-form-row manfiet-form-row-end"},o.createElement("button",{type:"submit",className:"manfiet-button manfiet-button-primary",disabled:h},q(h?"Saving...":d?"Update Client":"Save Client","manfi-expense-tracker")),o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-secondary",onClick:A},q("Reset","manfi-expense-tracker"))))),!r&&o.createElement("div",{className:"manfiet-card"},o.createElement("div",{className:"manfiet-card-head-row manfiet-mb-14"},o.createElement("h3",{className:"manfiet-card-title manfiet-card-title-no-margin"},q("Saved Clients","manfi-expense-tracker"))),y?o.createElement("p",null,q("Loading clients...","manfi-expense-tracker")):0===l.length?o.createElement("p",{className:"manfiet-text-muted"},q("No clients added yet.","manfi-expense-tracker")):o.createElement("div",{className:"manfiet-table-scroll"},o.createElement("table",{className:"manfiet-table"},o.createElement("thead",null,o.createElement("tr",null,o.createElement("th",null,q("Company / Client","manfi-expense-tracker")),o.createElement("th",null,q("Contact Person","manfi-expense-tracker")),o.createElement("th",null,q("Phone(s)","manfi-expense-tracker")),o.createElement("th",null,q("Email(s)","manfi-expense-tracker")),o.createElement("th",null,q("Address","manfi-expense-tracker")),o.createElement("th",null,q("Actions","manfi-expense-tracker")))),o.createElement("tbody",null,l.map(function(e){var t=Array.isArray(e.phones)&&e.phones.length>0?e.phones.join(", "):e.phone||"-",n=Array.isArray(e.emails)&&e.emails.length>0?e.emails.join(", "):Ta([e.email,e.email2]);return o.createElement("tr",{key:e.id},o.createElement("td",null,o.createElement("strong",null,e.client_name)),o.createElement("td",null,e.contact_person||"-"),o.createElement("td",null,t),o.createElement("td",null,n),o.createElement("td",null,e.address?e.address.substring(0,40)+(e.address.length>40?"...":""):"-"),o.createElement("td",null,o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-info manfiet-button-sm",onClick:function(){window.location.href="".concat(P,"&client_id=").concat(e.id)}},q("Edit","manfi-expense-tracker")),o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-danger manfiet-button-sm manfiet-ml-8",onClick:function(){return t=e.id,void(window.confirm(q("Delete this client?","manfi-expense-tracker"))&&(E(!0),w(""),ja("".concat(a,"clients/").concat(t),{method:"DELETE"}).then(function(){S(q("Client deleted.","manfi-expense-tracker")),C(),d===t&&A()}).catch(function(e){w(e.message||q("Failed to delete client.","manfi-expense-tracker"))}).finally(function(){return E(!1)})));var t},disabled:h},q("Delete","manfi-expense-tracker"))))}))))))};function Da(e){return Da="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Da(e)}function Fa(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,i,l,o=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(a=i.call(n)).done)&&(o.push(a.value),o.length!==t);c=!0);}catch(e){u=!0,r=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(u)throw r}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return La(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?La(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function La(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}function za(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,n="function"==typeof Symbol?Symbol:{},a=n.iterator||"@@iterator",r=n.toStringTag||"@@toStringTag";function i(n,a,r,i){var c=a&&a.prototype instanceof o?a:o,u=Object.create(c.prototype);return Ra(u,"_invoke",function(n,a,r){var i,o,c,u=0,s=r||[],m=!1,f={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return i=t,o=0,c=e,f.n=n,l}};function d(n,a){for(o=n,c=a,t=0;!m&&u&&!r&&t<s.length;t++){var r,i=s[t],d=f.p,p=i[2];n>3?(r=p===a)&&(c=i[(o=i[4])?5:(o=3,3)],i[4]=i[5]=e):i[0]<=d&&((r=n<2&&d<i[1])?(o=0,f.v=a,f.n=i[1]):d<p&&(r=n<3||i[0]>a||a>p)&&(i[4]=n,i[5]=a,f.n=p,o=0))}if(r||n>1)return l;throw m=!0,a}return function(r,s,p){if(u>1)throw TypeError("Generator is already running");for(m&&1===s&&d(s,p),o=s,c=p;(t=o<2?e:c)||!m;){i||(o?o<3?(o>1&&(f.n=-1),d(o,c)):f.n=c:f.v=c);try{if(u=2,i){if(o||(r="next"),t=i[r]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,o<2&&(o=0)}else 1===o&&(t=i.return)&&t.call(i),o<2&&(c=TypeError("The iterator does not provide a '"+r+"' method"),o=1);i=e}else if((t=(m=f.n<0)?c:n.call(a,f))!==l)break}catch(t){i=e,o=1,c=t}finally{u=1}}return{value:t,done:m}}}(n,r,i),!0),u}var l={};function o(){}function c(){}function u(){}t=Object.getPrototypeOf;var s=[][a]?t(t([][a]())):(Ra(t={},a,function(){return this}),t),m=u.prototype=o.prototype=Object.create(s);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,Ra(e,r,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=u,Ra(m,"constructor",u),Ra(u,"constructor",c),c.displayName="GeneratorFunction",Ra(u,r,"GeneratorFunction"),Ra(m),Ra(m,r,"Generator"),Ra(m,a,function(){return this}),Ra(m,"toString",function(){return"[object Generator]"}),(za=function(){return{w:i,m:f}})()}function Ra(e,t,n,a){var r=Object.defineProperty;try{r({},"",{})}catch(e){r=0}Ra=function(e,t,n,a){function i(t,n){Ra(e,t,function(e){return this._invoke(t,n,e)})}t?r?r(e,t,{value:n,enumerable:!a,configurable:!a,writable:!a}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},Ra(e,t,n,a)}function Ia(e,t,n,a,r,i,l){try{var o=e[i](l),c=o.value}catch(e){return void n(e)}o.done?t(c):Promise.resolve(c).then(a,r)}function Ma(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,a)}return n}function Ba(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ma(Object(n),!0).forEach(function(t){Ua(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ma(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ua(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Da(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!=Da(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Da(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Wa=window.manfietExpenseTrackerData||{},Va=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Ba({"Content-Type":"application/json"},t.headers||{});return Wa.restNonce&&(n["X-WP-Nonce"]=Wa.restNonce),fetch(e,Ba(Ba({credentials:"same-origin"},t),{},{headers:n})).then(function(){var e,t=(e=za().m(function e(t){var n;return za().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,t.json().catch(function(){return{}});case 1:if(n=e.v,t.ok){e.n=2;break}throw new Error(n.message||"Request failed");case 2:return e.a(2,n)}},e)}),function(){var t=this,n=arguments;return new Promise(function(a,r){var i=e.apply(t,n);function l(e){Ia(i,a,r,l,o,"next",e)}function o(e){Ia(i,a,r,l,o,"throw",e)}l(void 0)})});return function(e){return t.apply(this,arguments)}}())},$a=function(e){var t=e.size,n=void 0===t?18:t,a=e.color,r=void 0===a?"currentColor":a;return o.createElement("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{display:"block"}},o.createElement("circle",{cx:"12",cy:"12",r:"3"}),o.createElement("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"}))},Ga=function(e){var t=e.size,n=void 0===t?18:t,a=e.color,r=void 0===a?"currentColor":a;return o.createElement("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{display:"block"}},o.createElement("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),o.createElement("path",{d:"M2 17l10 5 10-5"}),o.createElement("path",{d:"M2 12l10 5 10-5"}))},Ha=function(e){var t=e.size,n=void 0===t?18:t,a=e.color,r=void 0===a?"currentColor":a;return o.createElement("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{display:"block"}},o.createElement("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),o.createElement("line",{x1:"3",y1:"9",x2:"21",y2:"9"}),o.createElement("line",{x1:"3",y1:"15",x2:"21",y2:"15"}),o.createElement("line",{x1:"9",y1:"3",x2:"9",y2:"21"}),o.createElement("line",{x1:"15",y1:"3",x2:"15",y2:"21"}))},Qa=function(e){var t=e.size,n=void 0===t?18:t,a=e.color,r=void 0===a?"currentColor":a;return o.createElement("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{display:"block"}},o.createElement("path",{d:"M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"}),o.createElement("polyline",{points:"22,6 12,13 2,6"}))},Ya=function(e){var t=e.size,n=void 0===t?18:t,a=e.color,r=void 0===a?"currentColor":a;return o.createElement("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{display:"block"}},o.createElement("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),o.createElement("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),o.createElement("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"}))},qa=function(e){var t=e.size,n=void 0===t?18:t,a=e.color,r=void 0===a?"currentColor":a;return o.createElement("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{display:"block"}},o.createElement("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),o.createElement("path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"}))},Xa=function(e){var t=e.size,n=void 0===t?14:t,a=e.color,r=void 0===a?"currentColor":a;return o.createElement("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{display:"block"}},o.createElement("polyline",{points:"23 4 23 10 17 10"}),o.createElement("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"}))},Ka=function(e){var t=e.size,n=void 0===t?14:t,a=e.color,r=void 0===a?"currentColor":a;return o.createElement("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{display:"block"}},o.createElement("polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2"}))};const Ja=function(){var e,t=Wa.restBase||"/wp-json/manfi-expense-tracker/v1/",n=Fa((0,o.useState)({default_budget:500,default_weekly_budget:125,default_yearly_budget:6e3,export_unknown_user_label:"Unknown User",expenses_per_page:20,currency:"USD",enable_invoice_manager:0,invoice_late_fee_enabled:1,invoice_late_fee_pct:5,invoice_late_fee_type:"percentage",invoice_default_terms:"• Payment is due on or before the specified due date.\n• An overdue/late payment fee of {late_fee}% will apply to any unpaid balance after the due date.\n• Please mention the invoice number as reference when making payments.",enable_gutenberg_blocks:1,enable_elementor_widgets:0,email_sender_address:"",email_sender_name:"Manfi Expense Tracker",currency_symbols:{}}),2),a=n[0],r=n[1],i=Fa((0,o.useState)(!0),2),l=i[0],c=i[1],u=Fa((0,o.useState)(!1),2),s=u[0],m=u[1],f=Fa((0,o.useState)(""),2),d=f[0],p=f[1],v=Fa((0,o.useState)(""),2),y=v[0],g=v[1],b=Fa((0,o.useState)(""),2),h=b[0],E=b[1],x=Fa((0,o.useState)("general"),2),k=x[0],w=x[1],_=[{id:"general",label:q("General & Budgets","manfi-expense-tracker"),Icon:$a},{id:"modules",label:q("Modules & Builder","manfi-expense-tracker"),Icon:Ga},{id:"gsheets",label:q("Google Sheets Sync","manfi-expense-tracker"),Icon:Ha},{id:"email",label:q("Email Alerts","manfi-expense-tracker"),Icon:Qa},{id:"advanced",label:q("Advanced & Rollback","manfi-expense-tracker"),Icon:Ya}],N=Fa((0,o.useState)({webhook_url:"",auto_sync:!1,sync_token:"",expenses_formula:"",invoices_formula:""}),2),S=N[0],C=N[1],P=Fa((0,o.useState)(!1),2),O=P[0],j=P[1],T=Fa((0,o.useState)(""),2),A=T[0],D=T[1];(0,o.useEffect)(function(){Promise.all([Va("".concat(t,"settings")),Va("".concat(t,"gsheets/settings"))]).then(function(e){var t=Fa(e,2),n=t[0],a=t[1];r(n),C(a),c(!1)}).catch(function(e){p(e.message||q("Failed to load settings.","manfi-expense-tracker")),c(!1)})},[]);var F=function(e,t){r(function(n){return Ba(Ba({},n),{},Ua({},e,t))})},L=function(e,t){navigator.clipboard.writeText(e).then(function(){D(t),setTimeout(function(){return D("")},2e3)})},z=function(e){e.preventDefault(),m(!0),p(""),g(""),Va("".concat(t,"settings"),{method:"POST",body:JSON.stringify(a)}).then(function(e){g(e.message||q("Settings saved successfully.","manfi-expense-tracker")),m(!1),window.scrollTo({top:0,behavior:"smooth"})}).catch(function(e){p(e.message||q("Failed to save settings.","manfi-expense-tracker")),m(!1),window.scrollTo({top:0,behavior:"smooth"})})};if(l)return o.createElement("div",{className:"manfiet-page-shell"},o.createElement("div",{style:{padding:"40px",textAlign:"center",color:"#64748b"}},o.createElement("div",{style:{fontSize:"32px",marginBottom:"12px"}},"🔄"),o.createElement("p",{style:{margin:0,fontWeight:"600"}},q("Loading settings dashboard...","manfi-expense-tracker"))));var R=a.currency_symbols&&a.currency_symbols[a.currency]||"$";return o.createElement("div",{className:"manfiet-page-shell"},o.createElement("div",{className:"manfiet-page-hero"},o.createElement("div",{className:"left-section"},o.createElement("h1",{className:"manfiet-page-title"},q("Global Plugin Settings","manfi-expense-tracker")),o.createElement("p",{className:"manfiet-page-subtitle"},q("Configure thresholds, currency formatting, email logs, module switches, and developer rollback tools.","manfi-expense-tracker")))),d&&o.createElement("div",{className:"manfiet-alert manfiet-alert-error",style:{marginBottom:"24px",borderRadius:"8px"}},d),y&&o.createElement("div",{className:"manfiet-alert manfiet-alert-success",style:{marginBottom:"24px",borderRadius:"8px"}},y),o.createElement("div",{style:{display:"flex",gap:"8px",borderBottom:"2px solid #e2e8f0",paddingBottom:"12px",marginBottom:"24px",flexWrap:"wrap"}},_.map(function(e){var t=k===e.id,n=e.Icon;return o.createElement("button",{key:e.id,type:"button",onClick:function(){return w(e.id)},style:{display:"flex",alignItems:"center",gap:"8px",padding:"10px 18px",borderRadius:"8px",border:"none",background:t?"#2563eb":"#f1f5f9",color:t?"#ffffff":"#475569",fontWeight:t?"700":"600",fontSize:"14px",cursor:"pointer",transition:"all 0.2s ease",boxShadow:t?"0 4px 12px rgba(37, 99, 235, 0.25)":"none"}},o.createElement(n,{size:16,color:t?"#ffffff":"#475569"}),o.createElement("span",null,e.label))})),"general"===k&&o.createElement("form",{onSubmit:z,style:{display:"flex",flexDirection:"column",gap:"28px"}},o.createElement("div",{className:"manfiet-card",style:{padding:"30px"}},o.createElement("div",{style:{display:"flex",alignItems:"center",gap:"10px",marginBottom:"8px",borderBottom:"1px solid #e2e8f0",paddingBottom:"12px"}},o.createElement($a,{size:20,color:"#2563eb"}),o.createElement("h3",{className:"manfiet-card-title",style:{margin:0,fontSize:"18px",fontWeight:"700"}},q("General Configuration","manfi-expense-tracker"))),o.createElement("p",{style:{margin:"0 0 20px 0",fontSize:"13px",color:"#64748b"}},q("Adjust primary currency defaults, table pagination counts, and CSV/Excel backup fields.","manfi-expense-tracker")),o.createElement("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(280px, 1fr))",gap:"24px"}},o.createElement("div",null,o.createElement("label",{className:"manfiet-label",style:{fontWeight:"600",display:"block",marginBottom:"6px"}},q("Plugin Currency","manfi-expense-tracker")),o.createElement("p",{style:{margin:"0 0 8px 0",fontSize:"12px",color:"#94a3b8"}},q("Global currency code used across entries, dashboards, and generated invoices.","manfi-expense-tracker")),o.createElement("select",{className:"manfiet-input",value:a.currency,onChange:function(e){return F("currency",e.target.value)},style:{width:"100%",height:"40px",borderRadius:"6px"}},o.createElement("option",{value:"USD"},q("USD ($)","manfi-expense-tracker")),o.createElement("option",{value:"EUR"},q("EUR (€)","manfi-expense-tracker")),o.createElement("option",{value:"GBP"},q("GBP (£)","manfi-expense-tracker")),o.createElement("option",{value:"INR"},q("INR (₹)","manfi-expense-tracker")),o.createElement("option",{value:"BDT"},q("BDT (৳)","manfi-expense-tracker")),o.createElement("option",{value:"CAD"},q("CAD (C$)","manfi-expense-tracker")),o.createElement("option",{value:"AUD"},q("AUD (A$)","manfi-expense-tracker")),o.createElement("option",{value:"JPY"},q("JPY (¥)","manfi-expense-tracker")),o.createElement("option",{value:"CNY"},q("CNY (¥)","manfi-expense-tracker")))),o.createElement("div",null,o.createElement("label",{className:"manfiet-label",style:{fontWeight:"600",display:"block",marginBottom:"6px"}},q("Expenses Per Page","manfi-expense-tracker")),o.createElement("p",{style:{margin:"0 0 8px 0",fontSize:"12px",color:"#94a3b8"}},q("Default pagination limit for listings, budgets, and dashboard lists.","manfi-expense-tracker")),o.createElement("input",{type:"number",className:"manfiet-input",value:a.expenses_per_page,onChange:function(e){return F("expenses_per_page",e.target.value)},min:"1",max:"500",style:{width:"100%",borderRadius:"6px"}})),o.createElement("div",null,o.createElement("label",{className:"manfiet-label",style:{fontWeight:"600",display:"block",marginBottom:"6px"}},q("Missing User Label (Export)","manfi-expense-tracker")),o.createElement("p",{style:{margin:"0 0 8px 0",fontSize:"12px",color:"#94a3b8"}},q("Fallback name displayed in exports if the linked user account has been deleted.","manfi-expense-tracker")),o.createElement("input",{type:"text",className:"manfiet-input",value:a.export_unknown_user_label,onChange:function(e){return F("export_unknown_user_label",e.target.value)},style:{width:"100%",borderRadius:"6px"}})))),o.createElement("div",{className:"manfiet-card",style:{padding:"30px"}},o.createElement("div",{style:{display:"flex",alignItems:"center",gap:"10px",marginBottom:"8px",borderBottom:"1px solid #e2e8f0",paddingBottom:"12px"}},o.createElement(qa,{size:20,color:"#2563eb"}),o.createElement("h3",{className:"manfiet-card-title",style:{margin:0,fontSize:"18px",fontWeight:"700"}},q("Budget Alarm Thresholds","manfi-expense-tracker"))),o.createElement("p",{style:{margin:"0 0 20px 0",fontSize:"13px",color:"#64748b"}},q("Set default ceiling targets. Automatic admin warnings and email notifications will trigger when a user transcends these limits.","manfi-expense-tracker")),o.createElement("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(280px, 1fr))",gap:"24px"}},o.createElement("div",{style:{background:"#f8fafc",padding:"18px",borderRadius:"8px",border:"1px solid #e2e8f0"}},o.createElement("label",{className:"manfiet-label",style:{fontWeight:"600",display:"block",marginBottom:"6px",color:"#0f172a"}},q("Default Monthly Budget Limit","manfi-expense-tracker")),o.createElement("p",{style:{margin:"0 0 12px 0",fontSize:"11px",color:"#94a3b8",lineHeight:"1.4"}},q("Default monthly limit allocated per user account.","manfi-expense-tracker")),o.createElement("div",{style:{position:"relative"}},o.createElement("span",{style:{position:"absolute",left:"12px",top:"10px",color:"#64748b",fontWeight:"bold"}},R),o.createElement("input",{type:"number",className:"manfiet-input",value:a.default_budget,onChange:function(e){return F("default_budget",e.target.value)},min:"0",style:{width:"100%",paddingLeft:"30px",borderRadius:"6px"}}))),o.createElement("div",{style:{background:"#f8fafc",padding:"18px",borderRadius:"8px",border:"1px solid #e2e8f0"}},o.createElement("label",{className:"manfiet-label",style:{fontWeight:"600",display:"block",marginBottom:"6px",color:"#0f172a"}},q("Default Weekly Budget Limit","manfi-expense-tracker")),o.createElement("p",{style:{margin:"0 0 12px 0",fontSize:"11px",color:"#94a3b8",lineHeight:"1.4"}},q("Default weekly limit allocated per user account.","manfi-expense-tracker")),o.createElement("div",{style:{position:"relative"}},o.createElement("span",{style:{position:"absolute",left:"12px",top:"10px",color:"#64748b",fontWeight:"bold"}},R),o.createElement("input",{type:"number",className:"manfiet-input",value:a.default_weekly_budget,onChange:function(e){return F("default_weekly_budget",e.target.value)},min:"0",style:{width:"100%",paddingLeft:"30px",borderRadius:"6px"}}))),o.createElement("div",{style:{background:"#f8fafc",padding:"18px",borderRadius:"8px",border:"1px solid #e2e8f0"}},o.createElement("label",{className:"manfiet-label",style:{fontWeight:"600",display:"block",marginBottom:"6px",color:"#0f172a"}},q("Default Yearly Budget Limit","manfi-expense-tracker")),o.createElement("p",{style:{margin:"0 0 12px 0",fontSize:"11px",color:"#94a3b8",lineHeight:"1.4"}},q("Default yearly limit allocated per user account.","manfi-expense-tracker")),o.createElement("div",{style:{position:"relative"}},o.createElement("span",{style:{position:"absolute",left:"12px",top:"10px",color:"#64748b",fontWeight:"bold"}},R),o.createElement("input",{type:"number",className:"manfiet-input",value:a.default_yearly_budget,onChange:function(e){return F("default_yearly_budget",e.target.value)},min:"0",style:{width:"100%",paddingLeft:"30px",borderRadius:"6px"}}))))),o.createElement("div",{style:{display:"flex",justifyContent:"flex-start"}},o.createElement("button",{type:"submit",className:"manfiet-button manfiet-button-primary",disabled:s,style:{padding:"14px 44px",fontSize:"15px",fontWeight:"700",borderRadius:"8px",cursor:"pointer",transition:"all 0.2s ease",boxShadow:"0 4px 12px rgba(37, 99, 235, 0.2)"}},q(s?"Saving Configurations...":"Save General Settings","manfi-expense-tracker")))),"modules"===k&&o.createElement("form",{onSubmit:z,style:{display:"flex",flexDirection:"column",gap:"28px"}},o.createElement("div",{className:"manfiet-card",style:{padding:"30px"}},o.createElement("div",{style:{display:"flex",alignItems:"center",gap:"10px",marginBottom:"8px",borderBottom:"1px solid #e2e8f0",paddingBottom:"12px"}},o.createElement(Ga,{size:20,color:"#2563eb"}),o.createElement("h3",{className:"manfiet-card-title",style:{margin:0,fontSize:"18px",fontWeight:"700"}},q("Active Modules & Integrations","manfi-expense-tracker"))),o.createElement("p",{style:{margin:"0 0 20px 0",fontSize:"13px",color:"#64748b"}},q("Toggle optional sub-systems, invoice editors, and visual block builder capabilities.","manfi-expense-tracker")),o.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"16px"}},o.createElement("div",{style:{display:"flex",alignItems:"flex-start",gap:"12px",background:"#f8fafc",padding:"14px 18px",borderRadius:"8px",border:"1px solid #e2e8f0"}},o.createElement("input",{type:"checkbox",id:"enable_invoice_manager",checked:1===a.enable_invoice_manager,onChange:function(e){return F("enable_invoice_manager",e.target.checked?1:0)},style:{width:"18px",height:"18px",marginTop:"2px",cursor:"pointer"}}),o.createElement("div",{style:{cursor:"pointer"},onClick:function(){return F("enable_invoice_manager",1===a.enable_invoice_manager?0:1)}},o.createElement("label",{htmlFor:"enable_invoice_manager",style:{fontWeight:"600",color:"#0f172a",display:"block",cursor:"pointer"}},q("Invoice Manager Module (Beta)","manfi-expense-tracker")),o.createElement("span",{style:{fontSize:"12.5px",color:"#64748b",display:"block",marginTop:"4px",lineHeight:"1.4"}},q("Exposes customer directories, vendor managers, financial bank ledgers, and enqueues custom PDF builders.","manfi-expense-tracker")))),o.createElement("div",{style:{display:"flex",alignItems:"flex-start",gap:"12px",background:"#f8fafc",padding:"14px 18px",borderRadius:"8px",border:"1px solid #e2e8f0"}},o.createElement("input",{type:"checkbox",id:"enable_gutenberg_blocks",checked:1===a.enable_gutenberg_blocks,onChange:function(e){return F("enable_gutenberg_blocks",e.target.checked?1:0)},style:{width:"18px",height:"18px",marginTop:"2px",cursor:"pointer"}}),o.createElement("div",{style:{cursor:"pointer"},onClick:function(){return F("enable_gutenberg_blocks",1===a.enable_gutenberg_blocks?0:1)}},o.createElement("label",{htmlFor:"enable_gutenberg_blocks",style:{fontWeight:"600",color:"#0f172a",display:"block",cursor:"pointer"}},q("WordPress Gutenberg Block Registrar","manfi-expense-tracker")),o.createElement("span",{style:{fontSize:"12.5px",color:"#64748b",display:"block",marginTop:"4px",lineHeight:"1.4"}},q("Enables block builder widgets. Exposes native page blocks to render dashboards and statistics grids on front-end layouts.","manfi-expense-tracker")))),o.createElement("div",{style:{display:"flex",alignItems:"flex-start",gap:"12px",background:"#f8fafc",padding:"14px 18px",borderRadius:"8px",border:"1px solid #e2e8f0"}},o.createElement("input",{type:"checkbox",id:"enable_elementor_widgets",checked:1===a.enable_elementor_widgets,onChange:function(e){return F("enable_elementor_widgets",e.target.checked?1:0)},style:{width:"18px",height:"18px",marginTop:"2px",cursor:"pointer"}}),o.createElement("div",{style:{cursor:"pointer"},onClick:function(){return F("enable_elementor_widgets",1===a.enable_elementor_widgets?0:1)}},o.createElement("label",{htmlFor:"enable_elementor_widgets",style:{fontWeight:"600",color:"#0f172a",display:"block",cursor:"pointer"}},q("Elementor Addon Widgets","manfi-expense-tracker")),o.createElement("span",{style:{fontSize:"12.5px",color:"#64748b",display:"block",marginTop:"4px",lineHeight:"1.4"}},q("Registers Elementor drag-and-drop templates. (Only operational when Elementor core is installed).","manfi-expense-tracker")))))),o.createElement("div",{className:"manfiet-card",style:{padding:"30px"}},o.createElement("div",{style:{display:"flex",alignItems:"center",gap:"10px",marginBottom:"8px",borderBottom:"1px solid #e2e8f0",paddingBottom:"12px"}},o.createElement($a,{size:20,color:"#2563eb"}),o.createElement("h3",{className:"manfiet-card-title",style:{margin:0,fontSize:"18px",fontWeight:"700"}},q("Invoice Overdue Late Fee & Terms","manfi-expense-tracker"))),o.createElement("p",{style:{margin:"0 0 20px 0",fontSize:"13px",color:"#64748b"}},q("Configure automatic overdue fine/due fee calculations and standard Terms & Conditions templates for generated invoices.","manfi-expense-tracker")),o.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"20px"}},o.createElement("div",{style:{display:"flex",alignItems:"flex-start",gap:"12px",background:"#f8fafc",padding:"14px 18px",borderRadius:"8px",border:"1px solid #e2e8f0"}},o.createElement("input",{type:"checkbox",id:"invoice_late_fee_enabled",checked:1===a.invoice_late_fee_enabled,onChange:function(e){return F("invoice_late_fee_enabled",e.target.checked?1:0)},style:{width:"18px",height:"18px",marginTop:"2px",cursor:"pointer"}}),o.createElement("div",{style:{cursor:"pointer"},onClick:function(){return F("invoice_late_fee_enabled",1===a.invoice_late_fee_enabled?0:1)}},o.createElement("label",{htmlFor:"invoice_late_fee_enabled",style:{fontWeight:"600",color:"#0f172a",display:"block",cursor:"pointer"}},q("Enable Automatic Overdue Late Due Fee Calculation","manfi-expense-tracker")),o.createElement("span",{style:{fontSize:"12.5px",color:"#64748b",display:"block",marginTop:"4px",lineHeight:"1.4"}},q("Automatically computes and attaches late fine adjustments when carrying forward past due balances from overdue invoices.","manfi-expense-tracker")))),o.createElement("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(240px, 1fr))",gap:"16px"}},o.createElement("div",null,o.createElement("label",{htmlFor:"invoice_late_fee_type",style:{fontWeight:"600",color:"#0f172a",display:"block",marginBottom:"6px",fontSize:"13.5px"}},q("Late Fee Calculation Mode","manfi-expense-tracker")),o.createElement("select",{id:"invoice_late_fee_type",className:"manfiet-input",value:a.invoice_late_fee_type||"percentage",onChange:function(e){return F("invoice_late_fee_type",e.target.value)}},o.createElement("option",{value:"percentage"},q("Percentage (%) on Overdue Balance","manfi-expense-tracker")),o.createElement("option",{value:"flat"},q("Fixed Flat Amount","manfi-expense-tracker")))),o.createElement("div",null,o.createElement("label",{htmlFor:"invoice_late_fee_pct",style:{fontWeight:"600",color:"#0f172a",display:"block",marginBottom:"6px",fontSize:"13.5px"}},"flat"===a.invoice_late_fee_type?q("Default Flat Late Fee Amount","manfi-expense-tracker"):q("Default Overdue Late Fee Percentage (%)","manfi-expense-tracker")),o.createElement("input",{type:"number",step:"0.1",min:"0",id:"invoice_late_fee_pct",className:"manfiet-input",value:null!==(e=a.invoice_late_fee_pct)&&void 0!==e?e:5,onChange:function(e){return F("invoice_late_fee_pct",parseFloat(e.target.value)||0)},placeholder:"5.0"}),o.createElement("p",{className:"description",style:{margin:"4px 0 0 0",fontSize:"12px",color:"#64748b"}},"flat"===a.invoice_late_fee_type?q("Flat fine amount added when overdue.","manfi-expense-tracker"):q("e.g. 5% applied automatically to unpaid balances past their due date.","manfi-expense-tracker")))),o.createElement("div",null,o.createElement("label",{htmlFor:"invoice_default_terms",style:{fontWeight:"600",color:"#0f172a",display:"block",marginBottom:"6px",fontSize:"13.5px"}},q("Default Terms & Conditions / Notes Template","manfi-expense-tracker")),o.createElement("textarea",{id:"invoice_default_terms",className:"manfiet-input",rows:"4",value:a.invoice_default_terms||"",onChange:function(e){return F("invoice_default_terms",e.target.value)},placeholder:"Enter default invoice terms & conditions..."}),o.createElement("p",{className:"description",style:{margin:"4px 0 0 0",fontSize:"12px",color:"#64748b"}},q("Available tags: {due_date} = Due Date, {late_fee} = Late fee rate, {invoice_no} = Invoice number.","manfi-expense-tracker"))))),o.createElement("div",{style:{display:"flex",justifyContent:"flex-start"}},o.createElement("button",{type:"submit",className:"manfiet-button manfiet-button-primary",disabled:s,style:{padding:"14px 44px",fontSize:"15px",fontWeight:"700",borderRadius:"8px",cursor:"pointer",transition:"all 0.2s ease",boxShadow:"0 4px 12px rgba(37, 99, 235, 0.2)"}},q(s?"Saving Configurations...":"Save Module Settings","manfi-expense-tracker")))),"gsheets"===k&&o.createElement("div",{className:"manfiet-card",style:{borderLeft:"4px solid #10b981",padding:"30px 30px 30px 24px"}},o.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"12px"}},o.createElement("div",{style:{display:"flex",alignItems:"center",gap:"10px"}},o.createElement(Ha,{size:20,color:"#10b981"}),o.createElement("h3",{className:"manfiet-card-title",style:{margin:0,fontSize:"18px",fontWeight:"700",color:"#0f172a"}},q("Google Sheets & Live Data Sync","manfi-expense-tracker"))),o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-secondary",onClick:function(){confirm(q("Regenerating token will invalidate existing Google Sheets IMPORTDATA links. Continue?","manfi-expense-tracker"))&&(j(!0),Va("".concat(t,"gsheets/settings"),{method:"POST",body:JSON.stringify({regenerate_token:1})}).then(function(e){C(e),g(q("New security token generated successfully.","manfi-expense-tracker"))}).catch(function(e){return p(e.message||q("Failed to regenerate token.","manfi-expense-tracker"))}).finally(function(){return j(!1)}))},disabled:O,style:{fontSize:"12px",padding:"6px 14px",display:"flex",alignItems:"center",gap:"6px"}},o.createElement(Xa,{size:12,color:"currentColor"}),o.createElement("span",null,q("Regenerate Token","manfi-expense-tracker")))),o.createElement("p",{style:{margin:"0 0 20px 0",fontSize:"13px",color:"#64748b",lineHeight:"1.6"}},q("Sync expenses and invoices directly with Google Sheets. Paste pre-formatted =IMPORTDATA() formulas into any Google Sheet cell for live CSV feed sync, or configure a Webhook for automated background pushes.","manfi-expense-tracker")),o.createElement("div",{className:"manfiet-card manfiet-card-inset",style:{background:"#f8fafc",border:"1px solid #e2e8f0",padding:"16px",borderRadius:"8px",marginBottom:"20px"}},o.createElement("h4",{style:{margin:"0 0 12px 0",fontSize:"14px",fontWeight:"600",color:"#1e293b",display:"flex",alignItems:"center",gap:"8px"}},o.createElement(Ha,{size:16,color:"#10b981"}),o.createElement("span",null,q("Live Google Sheets =IMPORTDATA() Formulas","manfi-expense-tracker"))),o.createElement("div",{style:{display:"grid",gap:"14px"}},o.createElement("div",null,o.createElement("label",{className:"manfiet-label",style:{fontSize:"12px",color:"#475569",fontWeight:"600"}},q("Expenses Live Feed Formula:","manfi-expense-tracker")),o.createElement("div",{style:{display:"flex",gap:"8px",marginTop:"4px"}},o.createElement("input",{type:"text",readOnly:!0,className:"manfiet-input",value:S.expenses_formula,style:{fontFamily:"monospace",fontSize:"12px",background:"#ffffff"}}),o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-secondary",onClick:function(){return L(S.expenses_formula,"expenses")},style:{whiteSpace:"nowrap",fontSize:"12px"}},q("expenses"===A?"Copied! ✓":"Copy Formula","manfi-expense-tracker")))),o.createElement("div",null,o.createElement("label",{className:"manfiet-label",style:{fontSize:"12px",color:"#475569",fontWeight:"600"}},q("Invoices Live Feed Formula:","manfi-expense-tracker")),o.createElement("div",{style:{display:"flex",gap:"8px",marginTop:"4px"}},o.createElement("input",{type:"text",readOnly:!0,className:"manfiet-input",value:S.invoices_formula,style:{fontFamily:"monospace",fontSize:"12px",background:"#ffffff"}}),o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-secondary",onClick:function(){return L(S.invoices_formula,"invoices")},style:{whiteSpace:"nowrap",fontSize:"12px"}},q("invoices"===A?"Copied! ✓":"Copy Formula","manfi-expense-tracker")))))),o.createElement("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(280px, 1fr))",gap:"20px",marginBottom:"20px"}},o.createElement("div",null,o.createElement("label",{className:"manfiet-label",style:{fontWeight:"600",display:"block",marginBottom:"6px"}},q("Google Apps Script / Webhook URL","manfi-expense-tracker")),o.createElement("input",{type:"url",className:"manfiet-input",value:S.webhook_url,onChange:function(e){return C(function(t){return Ba(Ba({},t),{},{webhook_url:e.target.value})})},style:{width:"100%",borderRadius:"6px"},placeholder:"https://script.google.com/macros/s/.../exec"})),o.createElement("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center"}},o.createElement("label",{style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer",fontWeight:"600",color:"#1e293b"}},o.createElement("input",{type:"checkbox",checked:S.auto_sync,onChange:function(e){return C(function(t){return Ba(Ba({},t),{},{auto_sync:e.target.checked})})}}),q("Enable Automated Real-Time Background Webhook Sync","manfi-expense-tracker")),o.createElement("p",{style:{margin:"4px 0 0 28px",fontSize:"12px",color:"#94a3b8"}},q("Fires an instant background payload on expense/invoice create, edit, or delete events.","manfi-expense-tracker")))),o.createElement("div",{style:{display:"flex",gap:"12px",alignItems:"center"}},o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-primary",onClick:function(){j(!0),Va("".concat(t,"gsheets/settings"),{method:"POST",body:JSON.stringify({webhook_url:S.webhook_url,auto_sync:S.auto_sync})}).then(function(e){C(e),g(q("Google Sheets & Sync settings saved.","manfi-expense-tracker"))}).catch(function(e){return p(e.message||q("Failed to save Google Sheets settings.","manfi-expense-tracker"))}).finally(function(){return j(!1)})},disabled:O},q(O?"Saving Google Sync...":"Save Sync Settings","manfi-expense-tracker")),o.createElement("button",{type:"button",className:"manfiet-button manfiet-button-secondary",onClick:function(){j(!0),Va("".concat(t,"gsheets/sync-all"),{method:"POST"}).then(function(e){return g(e.message||q("Bulk sync triggered.","manfi-expense-tracker"))}).catch(function(e){return p(e.message||q("Failed to trigger bulk sync.","manfi-expense-tracker"))}).finally(function(){return j(!1)})},disabled:O||!S.webhook_url,style:{display:"flex",alignItems:"center",gap:"6px"},title:S.webhook_url?"":q("Configure a Webhook URL above to trigger bulk sync","manfi-expense-tracker")},o.createElement(Ka,{size:14,color:"currentColor"}),o.createElement("span",null,q("Sync All Data Now","manfi-expense-tracker"))))),"email"===k&&o.createElement("form",{onSubmit:z,style:{display:"flex",flexDirection:"column",gap:"28px"}},o.createElement("div",{className:"manfiet-card",style:{padding:"30px"}},o.createElement("div",{style:{display:"flex",alignItems:"center",gap:"10px",marginBottom:"8px",borderBottom:"1px solid #e2e8f0",paddingBottom:"12px"}},o.createElement(Qa,{size:20,color:"#2563eb"}),o.createElement("h3",{className:"manfiet-card-title",style:{margin:0,fontSize:"18px",fontWeight:"700"}},q("Email Sender Configurations","manfi-expense-tracker"))),o.createElement("p",{style:{margin:"0 0 20px 0",fontSize:"13px",color:"#64748b"}},q("Configure outgoing mail metadata. These credentials stamp alert reports and threshold warning emails dispatched by the plugin.","manfi-expense-tracker")),o.createElement("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(280px, 1fr))",gap:"24px"}},o.createElement("div",null,o.createElement("label",{className:"manfiet-label",style:{fontWeight:"600",display:"block",marginBottom:"6px"}},q("Sender Email Address","manfi-expense-tracker")),o.createElement("p",{style:{margin:"0 0 8px 0",fontSize:"12px",color:"#94a3b8"}},q('The "From" email address attached to outgoing budget system alerts.',"manfi-expense-tracker")),o.createElement("input",{type:"email",className:"manfiet-input",value:a.email_sender_address,onChange:function(e){return F("email_sender_address",e.target.value)},style:{width:"100%",borderRadius:"6px"},placeholder:"e.g. alerts@yoursite.com"})),o.createElement("div",null,o.createElement("label",{className:"manfiet-label",style:{fontWeight:"600",display:"block",marginBottom:"6px"}},q("Sender Display Name","manfi-expense-tracker")),o.createElement("p",{style:{margin:"0 0 8px 0",fontSize:"12px",color:"#94a3b8"}},q('Friendly label showing in inbox clients (e.g., "Finance Alerts Hub").',"manfi-expense-tracker")),o.createElement("input",{type:"text",className:"manfiet-input",value:a.email_sender_name,onChange:function(e){return F("email_sender_name",e.target.value)},style:{width:"100%",borderRadius:"6px"},placeholder:"e.g. Manfi Expense Alerts"})))),o.createElement("div",{style:{display:"flex",justifyContent:"flex-start"}},o.createElement("button",{type:"submit",className:"manfiet-button manfiet-button-primary",disabled:s,style:{padding:"14px 44px",fontSize:"15px",fontWeight:"700",borderRadius:"8px",cursor:"pointer",transition:"all 0.2s ease",boxShadow:"0 4px 12px rgba(37, 99, 235, 0.2)"}},q(s?"Saving Configurations...":"Save Email Settings","manfi-expense-tracker")))),"advanced"===k&&o.createElement("div",{className:"manfiet-card",style:{borderLeft:"4px solid #d63638",padding:"30px 30px 30px 24px"}},o.createElement("div",{style:{display:"flex",alignItems:"center",gap:"10px",marginBottom:"8px"}},o.createElement(Ya,{size:20,color:"#d63638"}),o.createElement("h3",{className:"manfiet-card-title",style:{color:"#d63638",margin:0,fontSize:"18px",fontWeight:"700"}},q("Danger Zone — Version Rollback","manfi-expense-tracker"))),o.createElement("p",{style:{fontSize:"13px",margin:"0 0 20px 0",color:"#64748b",lineHeight:"1.5"}},q("Experience glitches on the current build? Instantly downgrade directory structures back to a previous official stable release. Overwrites active local files.","manfi-expense-tracker")),o.createElement("form",{method:"post",action:Wa.rollbackUrl||"",onSubmit:function(e){confirm(q("Warning: This will overwrite your active plugin files with the selected version. Are you sure you want to proceed?","manfi-expense-tracker"))||e.preventDefault()},style:{display:"flex",alignItems:"center",gap:"14px",flexWrap:"wrap"}},o.createElement("input",{type:"hidden",name:"action",value:"manfiet_version_rollback"}),o.createElement("input",{type:"hidden",name:"_wpnonce",value:Wa.rollbackNonce||""}),o.createElement("select",{name:"rollback_version",required:!0,className:"manfiet-input",value:h,onChange:function(e){return E(e.target.value)},style:{maxWidth:"280px",height:"40px",borderRadius:"6px"}},o.createElement("option",{value:""},q("— select version —","manfi-expense-tracker")),o.createElement("option",{value:"1.0.7"},q("Version 1.0.7 (Stable)","manfi-expense-tracker")),o.createElement("option",{value:"1.0.6"},q("Version 1.0.6","manfi-expense-tracker")),o.createElement("option",{value:"1.0.5"},q("Version 1.0.5","manfi-expense-tracker")),o.createElement("option",{value:"1.0.4"},q("Version 1.0.4","manfi-expense-tracker")),o.createElement("option",{value:"1.0.3"},q("Version 1.0.3","manfi-expense-tracker")),o.createElement("option",{value:"1.0.2"},q("Version 1.0.2","manfi-expense-tracker")),o.createElement("option",{value:"1.0.1"},q("Version 1.0.1","manfi-expense-tracker")),o.createElement("option",{value:"1.0.0"},q("Version 1.0.0","manfi-expense-tracker"))),o.createElement("button",{type:"submit",className:"manfiet-button",style:{height:"40px",lineHeight:"40px",background:"#d63638",color:"#ffffff",border:"none",fontWeight:"700",padding:"0 28px",borderRadius:"6px",cursor:"pointer",boxShadow:"0 4px 12px rgba(214, 54, 56, 0.2)",transition:"background 0.2s"}},q("Rollback Version","manfi-expense-tracker")))))};var Za=window.manfietExpenseTrackerData||{},er=function(e){var t,n=e.overrideView||("manfiet-invoice-manager"===(t=new URLSearchParams(window.location.search).get("page")||"")?"invoice-manager":"manfiet-invoice-create"===t?"invoice-create":"manfiet-expense-categories"===t?"categories":"manfiet-expense-tags"===t?"tags":"manfiet-expense-budget"===t?"budget":"manfiet-expense-reports"===t?"reports":"manfiet-financial-accounts"===t?"financial-accounts":"manfiet-financial-accounts-create"===t?"financial-accounts-create":"manfiet-vendors"===t?"vendors":"manfiet-vendors-create"===t?"vendors-create":"manfiet-clients"===t?"clients":"manfiet-clients-create"===t?"clients-create":Za.pageView||"frontend"),a=Boolean(Za.canManageExpenses);return"expense-entry"===n?o.createElement(ue,{onExpenseAdded:function(){}}):"categories"===n?a?o.createElement(It,null):o.createElement("p",null,"You do not have permission to manage expense categories."):"budget"===n?a?o.createElement(pt,null):o.createElement("p",null,"You do not have permission to manage budgets."):"tags"===n?a?o.createElement(un,null):o.createElement("p",null,"You do not have permission to manage tags."):"reports"===n?a?o.createElement(ln,null):o.createElement("p",null,"You do not have permission to view reports."):"invoice-manager"===n?a?o.createElement(Vn,{mode:"dashboard"}):o.createElement("p",null,"You do not have permission to manage invoices."):"invoice-create"===n?a?o.createElement(Vn,{mode:"create"}):o.createElement("p",null,"You do not have permission to manage invoices."):"financial-accounts"===n?a?o.createElement(na,null):o.createElement("p",null,"You do not have permission to manage financial accounts."):"financial-accounts-create"===n?a?o.createElement(na,{mode:"create"}):o.createElement("p",null,"You do not have permission to manage financial accounts."):"vendors"===n?a?o.createElement(ga,null):o.createElement("p",null,"You do not have permission to manage vendors."):"vendors-create"===n?a?o.createElement(ga,{mode:"create"}):o.createElement("p",null,"You do not have permission to manage vendors."):"clients"===n?a?o.createElement(Aa,null):o.createElement("p",null,"You do not have permission to manage clients."):"settings"===n?a?o.createElement(Ja,null):o.createElement("p",null,"You do not have permission to manage settings."):"clients-create"===n?a?o.createElement(Aa,{mode:"create"}):o.createElement("p",null,"You do not have permission to manage clients."):o.createElement("div",null,a?o.createElement(Ve,null):o.createElement(it,null))},tr=document.getElementById("manfi-expense-tracker");tr&&(0,c.H)(tr).render(o.createElement(er,null));document.querySelectorAll(".manfi-expense-tracker-mount").forEach(function(e){var t=(0,c.H)(e),n=e.getAttribute("data-view");t.render(o.createElement(er,{overrideView:n}))})})();